From 0fc71f5da70ef7808487e3d299a6dce3f824de09 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 26 Apr 2024 15:56:45 +0200 Subject: [PATCH 001/101] activate Werror flag in CI build job --- .gitlab-ci.yml | 5 +++++ Makefile | 2 ++ 2 files changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02326273d..9ac0f0283 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -145,6 +145,10 @@ stages: - cp "$LTV_DIR"/*.met scripts/testv/ - cp "$LTV_DIR"/*.csv scripts/testv/ +.activate-Werror-linux: &activate-Werror-linux + - sed -i.bak "s/^# \(CFLAGS += -Werror\)/\1/" Makefile + - sed -i.bak "s/# \(set(CMAKE_C_FLAGS \"\${CMAKE_C_FLAGS} -Werror\")\)/\1/" CMakeLists.txt + .rules-pytest-mld: rules: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld" @@ -302,6 +306,7 @@ build-codec-linux-make: - .build-job-linux script: - *print-common-info + - *activate-Werror-linux - make -j # ensure that codec builds on linux with instrumentation active diff --git a/Makefile b/Makefile index 311cb8b9b..0467146ba 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,8 @@ CFLAGS += -std=c99 -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \ -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ -Werror-implicit-function-declaration \ -Wno-implicit-fallthrough -ffp-contract=off +# to be uncommented in CI +# CFLAGS += -Werror # libs to link LDLIBS += -lm -- GitLab From 43affee3dfed080f8e6c804bddfe911d78a66b85 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 26 Apr 2024 16:00:12 +0200 Subject: [PATCH 002/101] remove CMake part from Werror anchor --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ac0f0283..943857c59 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -147,7 +147,6 @@ stages: .activate-Werror-linux: &activate-Werror-linux - sed -i.bak "s/^# \(CFLAGS += -Werror\)/\1/" Makefile - - sed -i.bak "s/# \(set(CMAKE_C_FLAGS \"\${CMAKE_C_FLAGS} -Werror\")\)/\1/" CMakeLists.txt .rules-pytest-mld: rules: -- GitLab From 57df6e89239fc012ee75782591b8003027791cf0 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 29 Apr 2024 09:28:08 +0530 Subject: [PATCH 003/101] mc_dec_reconfig conversions and float cleanup --- lib_com/cldfb.c | 45 +- lib_com/ivas_prot.h | 10 + lib_dec/LD_music_post_filter.c | 38 + lib_dec/core_dec_init.c | 34 +- lib_dec/hq_core_dec.c | 76 +- lib_dec/igf_dec.c | 22 +- lib_dec/ivas_corecoder_dec_reconfig.c | 4 +- lib_dec/ivas_mc_param_dec.c | 698 +++++- lib_dec/ivas_mct_dec.c | 2982 ++++++++++++++----------- lib_dec/ivas_sba_rendering_internal.c | 58 + lib_dec/ivas_spar_md_dec.c | 122 +- lib_dec/swb_tbe_dec.c | 81 +- lib_rend/ivas_crend.c | 6 + lib_rend/ivas_stat_rend.h | 2 + 14 files changed, 2866 insertions(+), 1312 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index f8b27dd61..8859370e3 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1614,7 +1614,7 @@ void configureCldfb_ivas_fx( * * open and configures a CLDFB handle *--------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED ivas_error openCldfb_ivas( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ CLDFB_TYPE type, /* i : analysis or synthesis */ @@ -1667,7 +1667,50 @@ ivas_error openCldfb_ivas( return IVAS_ERR_OK; } +#else +ivas_error openCldfb_ivas( + HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ + CLDFB_TYPE type, /* i : analysis or synthesis */ + const int32_t sampling_rate, /* i : sampling rate */ + CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ +) +{ + HANDLE_CLDFB_FILTER_BANK hs; + int16_t buf_len; + + if ((hs = (HANDLE_CLDFB_FILTER_BANK)malloc(sizeof(CLDFB_FILTER_BANK))) == NULL) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB"); + } + + hs->type = type; + hs->prototype = prototype; + configureCldfb_ivas(hs, sampling_rate); + hs->memory_flt = NULL; + hs->memory_length = 0; + + if (type == CLDFB_ANALYSIS) + { + buf_len = hs->p_filter_length - hs->no_channels; + } + else + { + buf_len = hs->p_filter_length; + } + + if ((hs->cldfb_state = (float *)malloc(buf_len * sizeof(float))) == NULL) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB"); + } + + set_f(hs->cldfb_state, 0.0f, buf_len); + + *h_cldfb = hs; + + return IVAS_ERR_OK; +} +#endif #ifdef IVAS_FLOAT_FIXED ivas_error openCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ddaddc3e1..7bf923004 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4630,6 +4630,11 @@ void ivas_param_mc_enc( float *data_f[], /* i/o: input/transport MC data */ const int16_t input_frame /* i : input frame length */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_param_mc_dec_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif // IVAS_FLOAT_FIXED ivas_error ivas_param_mc_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -4644,6 +4649,11 @@ ivas_error ivas_param_mc_dec_reconfig_fx( ivas_error ivas_param_mc_dec_reconfig( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_dec_close_fx( + PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ +); +#endif // IVAS_FLOAT_FIXED void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC /* i/o: Parametric MC decoder handle */ diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index d6a64ad79..a17dcdfb6 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -727,6 +727,7 @@ void Post_music_postP( * * Initialize LD music postfilter state structure *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void music_postfilt_init_flt( MUSIC_POSTFILT_HANDLE hMusicPF /* i/o: LD music postfilter handle */ @@ -801,3 +802,40 @@ void music_postfilt_init_flt( #endif return; } +#else + void music_postfilt_init_flt( + MUSIC_POSTFILT_HANDLE hMusicPF /* i/o: LD music postfilter handle */ + ) + { + int16_t i; + + set_f(hMusicPF->dct_post_old_exc, 0, DCT_L_POST - OFFSET2); + + hMusicPF->LDm_enh_min_ns_gain = (float)pow(10.0f, -12 / 20.0f); + hMusicPF->LDm_last_music_flag = 0; + set_f(hMusicPF->LDm_lt_diff_etot, 0, MAX_LT); + hMusicPF->LDm_thres[0] = TH_0_MIN; + hMusicPF->LDm_thres[1] = TH_1_MIN; + hMusicPF->LDm_thres[2] = TH_2_MIN; + hMusicPF->LDm_thres[3] = TH_3_MIN; + hMusicPF->LDm_nb_thr_1 = 0; + hMusicPF->LDm_nb_thr_3 = 0; + hMusicPF->LDm_mem_etot = 0.0f; + + for (i = 0; i < VOIC_BINS_HR; i++) + { + hMusicPF->LDm_enh_lp_gbin[i] = 1.0f; + hMusicPF->LDm_enh_lf_EO[i] = 0.01f; + } + + for (i = 0; i < MBANDS_GN_LD; i++) + { + hMusicPF->LDm_bckr_noise[i] = E_MIN; + } + + set_f(hMusicPF->filt_lfE, 1.0f, DCT_L_POST); + hMusicPF->last_nonfull_music = 0; + + return; + } +#endif \ No newline at end of file diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 112074bcc..458f82feb 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -1449,7 +1449,7 @@ void open_decoder_LPD( * * Initialization TCX-LTP handle *-----------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void tcxltp_dec_init( TCX_LTP_DEC_HANDLE hTcxLtpDec, const int16_t ini_frame, @@ -1489,7 +1489,39 @@ void tcxltp_dec_init( return; } +#else +void tcxltp_dec_init( + TCX_LTP_DEC_HANDLE hTcxLtpDec, + const int16_t ini_frame, + const int16_t last_codec_mode, + const int16_t element_mode, + const int16_t pit_max, + const int32_t sr_core) +{ + hTcxLtpDec->tcxltp_gain_float = 0.0f; + + hTcxLtpDec->tcxltp = getTcxLtp(sr_core); + + if (ini_frame == 0 || (last_codec_mode == MODE1 && element_mode == EVS_MONO)) + { + hTcxLtpDec->tcxltp_pitch_int = pit_max; + hTcxLtpDec->tcxltp_pitch_fr = 0; + + if (ini_frame == 0) + { + set_f(hTcxLtpDec->tcxltp_mem_in_float, 0.0f, TCXLTP_MAX_DELAY); + set_f(hTcxLtpDec->tcxltp_mem_out_float, 0.0f, L_FRAME48k); + hTcxLtpDec->tcxltp_pitch_int_post_prev = 0; + hTcxLtpDec->tcxltp_pitch_fr_post_prev = 0; + hTcxLtpDec->tcxltp_gain_post_prev_float = 0.f; + hTcxLtpDec->tcxltp_filt_idx_prev = -1; + } + } + + return; +} +#endif /*-----------------------------------------------------------------------* * reset_tcx_overl_buf() * diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 5c4b16a56..839d6b299 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -649,7 +649,7 @@ void hq_core_dec( * * Initialize HQ core state structure *-------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void HQ_core_dec_init_flt( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ) @@ -745,6 +745,80 @@ void HQ_core_dec_init_flt( return; } +#else +void HQ_core_dec_init_flt( + HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ +) +{ + + set_f(hHQ_core->old_out, 0, L_FRAME48k); + set_f(hHQ_core->old_outLB, 0, L_FRAME32k); + set_s(hHQ_core->old_is_transient, 0, 3); + + hHQ_core->oldHqVoicing = 0; + + set_f(hHQ_core->prev_noise_level, 0.0f, 2); + hHQ_core->prev_R = 0; + set_f(hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE); + set_s(hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM); + + /* HQ GENERIC */ + hHQ_core->hq_generic_seed = RANDOM_INITSEED; + + hHQ_core->mem_norm[0] = 31; + set_s(hHQ_core->mem_norm + 1, 39, SFM_N_ENV_STAB - 1); + hHQ_core->mem_env_delta = 0; + hHQ_core->no_att_hangover = 0; + hHQ_core->energy_lt = 300.0f; + + hHQ_core->HqVoicing = 0; + set_f(hHQ_core->fer_samples, 0, L_FRAME48k); + set_f(hHQ_core->prev_env, 0, SFM_N_WB); + set_f(hHQ_core->prev_normq, 0, SFM_N_WB); + hHQ_core->prev_hqswb_clas = HQ_NORMAL; + + set_f(hHQ_core->last_ni_gain, 0, BANDS_MAX); + set_f(hHQ_core->last_env, 0, BANDS_MAX); + hHQ_core->last_max_pos_pulse = 0; + hHQ_core->prev_frm_hfe2 = 0; + hHQ_core->prev_stab_hfe2 = 0; + hHQ_core->prev_ni_ratio = 0.5f; + set_f(hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS); + + + /*----------------------------------------------------------------------------------* + * HQ FEC + *----------------------------------------------------------------------------------*/ + + set_f(hHQ_core->X_sav, 0.0f, PH_ECU_SPEC_SIZE); + hHQ_core->num_p = 0; + hHQ_core->ph_ecu_active = 0; + hHQ_core->ni_seed_forfec = 0; + hHQ_core->last_fec = 0; + hHQ_core->ph_ecu_HqVoicing = 0; + set_f(hHQ_core->oldgapsynth, 0.0f, L_FRAME48k); + hHQ_core->env_stab = 0.75f; + hHQ_core->mem_norm_hqfec[0] = 31; + set_s(hHQ_core->mem_norm_hqfec + 1, 39, SFM_N_ENV_STAB - 1); + hHQ_core->mem_env_delta_hqfec = 0; + hHQ_core->env_stab_plc = 0.0f; + set_f(hHQ_core->env_stab_state_p, 1.0f / NUM_ENV_STAB_PLC_STATES, NUM_ENV_STAB_PLC_STATES); + hHQ_core->envstabplc_hocnt = 0; + + set_f(hHQ_core->mag_chg_1st, 1.0f, LGW_MAX); + set_f(hHQ_core->Xavg, 0.0f, LGW_MAX); + hHQ_core->beta_mute = BETA_MUTE_FAC_INI_FLT; + + hHQ_core->time_offs = 0; + hHQ_core->ber_occured_in_pvq = 0; + + hHQ_core->last_hq_core_type = -1; + + reset_preecho_dec(hHQ_core); + + return; +} +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index 621ea8546..c9251d4d6 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -1603,7 +1603,7 @@ void IGFDecRestoreTCX10SubFrameData_flt( * * Initialize IGF decoder parameters *-----------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void init_igf_dec_flt( IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */ ) @@ -1625,8 +1625,24 @@ void init_igf_dec_flt( #endif return; } - - +#else +void init_igf_dec_flt( + IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */ +) +{ + set_c((int8_t *)(hIGFDec->infoTCXNoiseBuf), 0, IGF_START_MX); + set_f(hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX); + hIGFDec->igfData.igfInfo.nfSeedBuf[0] = 9733; + hIGFDec->igfData.igfInfo.nfSeedBuf[1] = 9733; + hIGFDec->igfData.igfInfo.nfSeed = &hIGFDec->igfData.igfInfo.nfSeedBuf[0]; + hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[0]; + hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[0]; + hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[0]; + hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[0]; + + return; +} +#endif /*-----------------------------------------------------------------------* * get_igf_startline_flt() * diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 67f65d1af..c916a9dd9 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -974,7 +974,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* resample CLDFB analysis instances */ FOR( i = 0; i < min( numCldfbAnalyses, numCldfbAnalyses_old ); i++ ) { - IF( EQ_32( L_mult0( extract_l(L_mult0( st_ivas->cldfbAnaDec[i]->no_channels, st_ivas->cldfbAnaDec[i]->no_col )), FRAMES_PER_SEC ), hDecoderConfig->output_Fs ) ) + IF( NE_32( L_mult0( extract_l(L_mult0( st_ivas->cldfbAnaDec[i]->no_channels, st_ivas->cldfbAnaDec[i]->no_col )), FRAMES_PER_SEC ), hDecoderConfig->output_Fs ) ) { resampleCldfb_ivas_fx( st_ivas->cldfbAnaDec[i], hDecoderConfig->output_Fs ); } @@ -1027,7 +1027,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( FOR( i = 0; i < st_ivas->cldfbAnaDec[0]->cldfb_state_length; i++ ) st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i], 16 ); // Scaling down from 27 to 11 FOR( i = 0; i < st_ivas->cldfbSynDec[0]->cldfb_state_length; i++ ) - st_ivas->cldfbSynDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbSynDec[0]->cldfb_state_fx[i], 21- Q_cldfbSynDec); // Scaling down from 21 to Q_cldfbSynDec + st_ivas->cldfbSynDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbSynDec[0]->cldfb_state_fx[i], 21- 11); // Scaling down from 21 to 11 } return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 09d03335f..4b28d4b99 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -79,6 +79,7 @@ typedef struct parameter_band_mapping_struct *-----------------------------------------------------------------------*/ static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); +static void ivas_param_mc_dec_init_fx( PARAM_MC_DEC_HANDLE hParamMC, const Word16 nchan_in, const Word16 nchan_out ); static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); #ifdef IVAS_FLOAT_FIXED @@ -131,7 +132,7 @@ static void ivas_param_mc_bs_decode_parameter_values( uint16_t bit_buffer[], int #ifdef IVAS_FLOAT_FIXED static void ivas_param_mc_bs_decode_parameter_values_fx(UWord16 bit_buffer[], Word16 *bit_pos, const Word16 max_bits, Word16 *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const Word16 map_size_wo_lfe, const Word16 map_size, const Word16 num_lfe_bands, const Word16 band_step, const Word16 num_param_bands, Word16 *value_buffer); static void ivas_param_mc_dequantize_cov_fx(PARAM_MC_DEC_HANDLE hParamMC, Word16 *ild_q_fx, Word16 *icc_q_fx, const Word16 param_band_index, const Word16 nY_cov, const PARAM_MC_SYNTHESIS_CONF synth_conf, const Word16 nY_int, const Word16 nX, Word32 *Cx_state_fx, Word16 Cx_state_e, Word32 *Cproto_fx, Word16 Cproto_e, Word32 *Cy_state_fx, Word16 *Cy_state_e); -static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info); +static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, Word16 Q_proto_mtx); static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Word32 *mixing_matrix[], Word16 *mixing_matrix_fx, Word32 *mixing_matrix_res[], Word16 *mixing_matrix_res_exp, const UWord16 nX, const UWord16 nY ); #endif @@ -140,7 +141,452 @@ static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Wo * * Open Parametric MC decoder handle *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_param_mc_dec_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + Word16 k, nchan_transport; + PARAM_MC_DEC_HANDLE hParamMC; +#ifndef FIX_901_PARAMMC_DEAD_CODE + IVAS_OUTPUT_SETUP hTransportSetup; +#endif + Word16 nchan_out_transport; + Word16 nchan_out_cov; + Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 proto_mtx_norm_fx; + Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 max_param_band_residual; + UWord16 config_index; + MC_LS_SETUP mc_ls_setup; + AUDIO_CONFIG output_config; + Word32 output_Fs, ivas_total_brate; + ivas_error error; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hParamMC = (PARAM_MC_DEC_HANDLE) malloc( sizeof( PARAM_MC_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( ( hParamMC->hMetadataPMC = (HANDLE_IVAS_PARAM_MC_METADATA) malloc( sizeof( IVAS_PARAM_MC_METADATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC metadata \n" ) ); + } + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + output_config = st_ivas->hDecoderConfig->output_config; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef FIX_901_PARAMMC_DEAD_CODE + hTransportSetup = st_ivas->hTransSetup; +#endif + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + hParamMC->hoa_encoder_fx = NULL; +#if 1/*TODO: To be removed later(floating pointer initialization)*/ + hParamMC->hoa_encoder = NULL; +#endif + + /* determine the synthesis config */ + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD || st_ivas->transport_config == output_config ) + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_DIRECT; + } + else if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_MONO_STEREO; + } + else if ( st_ivas->transport_config != output_config ) + { + if ( ( output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && nchan_out_transport > audioCfg2channels( output_config ) ) || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && nchan_out_transport > st_ivas->hOutSetup.nchan_out_woLFE ) ) + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_COV; + /* need to reset the intern config */ + st_ivas->intern_config = output_config; + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hLsSetupCustom->num_spk; +#if 1/*TODO: To be removed later*/ + st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; + st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; +#endif + st_ivas->hIntSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; + st_ivas->hIntSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; + } + } + else + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_CLDFB; + } + } + +#if 1/*TODO: To be removed later*/ + hParamMC->ls_conv_dmx_matrix = NULL; +#endif + hParamMC->ls_conv_dmx_matrix_fx = NULL; + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else + { + nchan_out_cov = nchan_out_transport; + } + + st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); + config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_brate ); + nchan_transport = st_ivas->nchan_transport; + + switch ( nchan_transport ) + { + case 4: + case 3: + st_ivas->nCPE = 2; + st_ivas->nSCE = 0; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + break; + case 2: + st_ivas->nCPE = 1; + st_ivas->nSCE = 0; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + + break; + } + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; + set_s( hParamMC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hParamMC->subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hParamMC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + + hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; +#ifndef FIX_901_PARAMMC_DEAD_CODE + ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); +#else + ivas_param_mc_metadata_open( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); +#endif + + /* init arrays for quantized parameters */ + + if ( ( hParamMC->icc_q_fx = (Word16 *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( Word16 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q_fx = (Word16 *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( Word16 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + set16_fx( hParamMC->icld_q_fx, PARAM_MC_DEFAULT_MIN_ILD_FX, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + set16_fx( hParamMC->icc_q_fx, 0, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); + +#if 1/*TODO: To be removed later(floating point initialization)*/ + if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + + param_mc_set_num_synth_bands( output_Fs, hParamMC ); + + /* Band Grouping */ + if ( hParamMC->hMetadataPMC->num_parameter_bands == 20 ) + { + mvs2s( param_mc_band_grouping_20, hParamMC->band_grouping, 20 + 1 ); + } + else if ( hParamMC->hMetadataPMC->num_parameter_bands == 14 ) + { + mvs2s( param_mc_band_grouping_14, hParamMC->band_grouping, 14 + 1 ); + } + else if ( hParamMC->hMetadataPMC->num_parameter_bands == 10 ) + { + mvs2s( param_mc_band_grouping_10, hParamMC->band_grouping, 10 + 1 ); + } + else + { + assert( 0 && "nbands must be 20, 14, or 10!" ); + } + + /* set max parameter band for abs cov */ + k = 0; + while ( hParamMC->band_grouping[k] <= PARAM_MC_MAX_BAND_ABS_COV_DEC ) + { + hParamMC->max_param_band_abs_cov = ( k++ ); + } + + /*-----------------------------------------------------------------* + * open sub-modules + *-----------------------------------------------------------------*/ + + /* prototype signal computation */ + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB || hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { +#if 1/*TODO: To be removed later (floating point malloc)*/ + if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + IF( ( hParamMC->ls_conv_dmx_matrix_fx = (Word32 *) malloc( nchan_out_transport * nchan_out_cov * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + for ( k = 0; k < nchan_out_transport; k++ ) + { + Copy32( st_ivas->hLsSetUpConversion->dmxMtx_fx[k], &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov], nchan_out_cov );/*Q30*/ + } + + /* convert ParamMC parameter bands to SFB */ + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + st_ivas->hLsSetUpConversion->sfbCnt = hParamMC->num_param_bands_synth; + for ( k = 0; k <= hParamMC->num_param_bands_synth; k++ ) + { + st_ivas->hLsSetUpConversion->sfbOffset[k] = PARAM_MC_BAND_TO_MDCT_BAND_RATIO * hParamMC->band_grouping[k]; + } + } + else + { + /* close the ls conversion handle immediately, it was only needed to get the DMX matrix in case of DMX in the covariance domain */ + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } + } + } + if ( ( hParamMC->proto_matrix_int_fx = (Word32 *) malloc( nchan_out_transport * nchan_transport * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, hParamMC->proto_matrix_int_fx, nchan_transport * nchan_out_transport );/*Q31*/ + + if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, -4 ); /*Q.26*/ + matrix_product_fx( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_cov, nchan_out_transport, 0, ivas_param_mc_conf[config_index].dmx_fac_fx, nchan_out_transport, nchan_transport, 0, proto_matrix_fx );/*Q.26*/ + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, 4 ); /*Q.26*/ + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + proto_mtx_norm_fx = ONE_IN_Q26;/*Q26*/ + for ( k = 0; k < nchan_transport * nchan_out_cov; k++ ) + { + proto_mtx_norm_fx = L_max(L_abs(proto_mtx_norm_fx), L_abs( proto_matrix_fx[k] ) );/*Q.26*/ + } + proto_mtx_norm_fx = divide3232(ONE_IN_Q26 , proto_mtx_norm_fx);/*Q15*/ + + /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ + for ( k = 0; k < nchan_transport; k++ ) + { + for ( int16_t i = 0; i < nchan_out_cov; i++ ) + { + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl(Mult_32_16(proto_matrix_fx[k * nchan_out_cov + i] , extract_l(proto_mtx_norm_fx)),4);/*Q.30*/ + } + } + } + } + else + { + Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, proto_matrix_fx, nchan_out_transport * nchan_transport );/*Q.31*/ + Scale_sig32( proto_matrix_fx, nchan_out_transport * nchan_transport, -5);/*Scaling down to 26*/ + } + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + hParamMC->num_outputs_diff = 0; + hParamMC->diff_proto_info = NULL; + hParamMC->h_output_synthesis_params.use_onset_filters = 0; + hParamMC->max_band_decorr = 0; + hParamMC->h_freq_domain_decorr_ap_params = NULL; + hParamMC->h_freq_domain_decorr_ap_state = NULL; + } + else + { + hParamMC->num_outputs_diff = nchan_out_cov; + if ( ( hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( ( error = param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ,Q26) ) != IVAS_ERR_OK ) + { + return error; + } + + /* decorrelation */ + hParamMC->h_freq_domain_decorr_ap_params = NULL; + hParamMC->h_freq_domain_decorr_ap_state = NULL; + + ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, hParamMC->num_freq_bands ); + + IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hParamMC->h_freq_domain_decorr_ap_params ), &( hParamMC->h_freq_domain_decorr_ap_state ), hParamMC->num_freq_bands, hParamMC->num_outputs_diff, hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, frequency_axis_fx, nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + hParamMC->h_output_synthesis_params.use_onset_filters = 0; + hParamMC->max_band_decorr = hParamMC->h_freq_domain_decorr_ap_params->max_band_decorr; + } + hParamMC->max_band_energy_compensation = hParamMC->band_grouping[hParamMC->hMetadataPMC->nbands_coded]; + max_param_band_residual = 0; + + for ( k = hParamMC->hMetadataPMC->num_parameter_bands; k >= 0; k-- ) + { + if ( hParamMC->band_grouping[k] <= hParamMC->max_band_decorr ) + { + max_param_band_residual = k; + assert( hParamMC->band_grouping[k] == hParamMC->max_band_decorr ); + break; + } + } + + /* output synthesis */ + if ( ( error = ivas_dirac_dec_output_synthesis_cov_open_fx( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix_fx ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_param_mc_dec_compute_interpolator_fx( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator_fx ); + + /* Head or external rotation */ + if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) + { +#if 1/*TODO : To be removed later*/ + IF ( ( hParamMC->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + IF ( ( hParamMC->hoa_encoder_fx = (Word32 *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof(Word32) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + compute_hoa_encoder_mtx_fx( st_ivas->hTransSetup.ls_azimuth_fx, st_ivas->hTransSetup.ls_elevation_fx, hParamMC->hoa_encoder_fx, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); + } + + /*-----------------------------------------------------------------* + * memory allocation + *-----------------------------------------------------------------*/ + + IF ( GT_16(hParamMC->max_band_decorr , 0) ) + { +#if 1/*TODO: To be removed later(floating point malloc)*/ + IF ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + IF ( ( hParamMC->proto_frame_dec_f = (float *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + IF ( ( hParamMC->proto_frame_f_fx = (Word32 *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + IF ( ( hParamMC->proto_frame_dec_f_fx = (Word32 *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + } + ELSE + { +#if 1/*TODO: To be removed later*/ + hParamMC->proto_frame_f = NULL; + hParamMC->proto_frame_dec_f = NULL; +#endif + hParamMC->proto_frame_f_fx = NULL; + hParamMC->proto_frame_dec_f_fx = NULL; + } + + ivas_param_mc_dec_init_fx( hParamMC, nchan_transport, nchan_out_cov ); + + IF ( hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) + { + Word16 n_cldfb_slots; + + n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; + IF ( st_ivas->hDecoderConfig->Opt_tsm ) + { + n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; + } + + IF( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set32_fx( hParamMC->Cldfb_RealBuffer_tc_fx, 0, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + IF( ( hParamMC->Cldfb_ImagBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set32_fx( hParamMC->Cldfb_ImagBuffer_tc_fx, 0, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + +#if 1/*TODO: To be removed later(floating point malloc)*/ + if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + if ( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); +#endif + + IF ( st_ivas->hTcBuffer == NULL ) + { + IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + ELSE + { + hParamMC->Cldfb_RealBuffer_tc_fx = NULL; + hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; +#if 1/*TODO: To be removed later*/ + hParamMC->Cldfb_RealBuffer_tc = NULL; + hParamMC->Cldfb_ImagBuffer_tc = NULL; +#endif + } + + hParamMC->subframes_rendered = 0; + hParamMC->slots_rendered = 0; + st_ivas->hParamMC = hParamMC; + return error; +} +#endif ivas_error ivas_param_mc_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -489,12 +935,12 @@ ivas_error ivas_param_mc_dec_open( /* output synthesis */ #ifdef IVAS_FLOAT_FIXED - floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q30, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); + floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q26, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); if ( ( error = ivas_dirac_dec_output_synthesis_cov_open_fx( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix_fx ) ) != IVAS_ERR_OK ) { return error; } - fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 30, nchan_transport * nchan_out_cov ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, Q26, nchan_transport * nchan_out_cov ); #else if ( ( error = ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix ) ) != IVAS_ERR_OK ) @@ -966,7 +1412,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( FOR ( k = 0; k < nchan_out_transport; k++ ) { Copy32( st_ivas->hLsSetUpConversion->dmxMtx_fx[k], &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov], nchan_out_cov ); - Scale_sig32( &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov],nchan_out_cov,1 ); } } /* convert ParamMC parameter bands to SFB */ @@ -1001,26 +1446,27 @@ ivas_error ivas_param_mc_dec_reconfig_fx( IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_COV) || EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) { + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, -4 ); matrix_product_fx( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_cov, nchan_out_transport, 0, ivas_param_mc_conf[config_index].dmx_fac_fx, nchan_out_transport, nchan_transport, 0, - proto_matrix_fx ); + proto_matrix_fx /*Q26*/); + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, 4 ); IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) { - proto_mtx_norm_fx = MAX_32; + proto_mtx_norm_fx = ONE_IN_Q26; FOR ( k = 0; k < nchan_transport * nchan_out_cov; k++ ) { proto_mtx_norm_fx = L_max(L_abs( proto_mtx_norm_fx ), L_abs( proto_matrix_fx[k] ) ); } - proto_mtx_norm_fx = divide3232(1 , proto_mtx_norm_fx);/*Q15*/ + proto_mtx_norm_fx = divide3232(ONE_IN_Q26 , proto_mtx_norm_fx);/*Q15*/ /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ FOR ( k = 0; k < nchan_transport; k++ ) { FOR ( Word16 i = 0; i < nchan_out_cov; i++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shr(Mpy_32_16_1(proto_matrix_fx[k * nchan_out_cov + i] , (Word16)proto_mtx_norm_fx),1); - st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl(Mpy_32_16_1(proto_matrix_fx[k * nchan_out_cov + i] , (Word16)proto_mtx_norm_fx),4); } } } @@ -1028,6 +1474,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( ELSE { Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, proto_matrix_fx, nchan_out_transport * nchan_transport ); + Scale_sig32( proto_matrix_fx, nchan_out_transport * nchan_transport, -5 ); } IF ( NE_16(nchan_transport_old , nchan_transport) && NE_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) @@ -1081,7 +1528,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } - IF ( ( param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ) ) != IVAS_ERR_OK ) + IF ( ( param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ,Q26) ) != IVAS_ERR_OK ) { return error; } @@ -1852,7 +2299,173 @@ int16_t param_mc_get_num_cldfb_syntheses( * * Close Parametric MC memories *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_dec_close_fx( + PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ +) +{ + UWord16 i; + PARAM_MC_DEC_HANDLE hParamMC; + + IF( hParamMC_out == NULL || *hParamMC_out == NULL ) + { + return; + } + + hParamMC = *hParamMC_out; + + /* close sub-modules */ + ivas_dirac_dec_output_synthesis_cov_close_fx( &hParamMC->h_output_synthesis_params, &hParamMC->h_output_synthesis_cov_state ); + + IF( hParamMC->h_freq_domain_decorr_ap_params != NULL || hParamMC->h_freq_domain_decorr_ap_state != NULL ) + { + ivas_dirac_dec_decorr_close( &hParamMC->h_freq_domain_decorr_ap_params, &hParamMC->h_freq_domain_decorr_ap_state ); + } + + /* parameter decoding */ + IF( hParamMC->hMetadataPMC != NULL ) + { +#ifndef FIX_901_PARAMMC_DEAD_CODE + ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); +#endif + free( hParamMC->hMetadataPMC ); + hParamMC->hMetadataPMC = NULL; + } + IF( hParamMC->icc_q_fx != NULL ) + { + free( hParamMC->icc_q_fx ); + hParamMC->icc_q_fx = NULL; + } + + IF( hParamMC->icld_q_fx != NULL ) + { + free( hParamMC->icld_q_fx ); + hParamMC->icld_q_fx = NULL; + } + /* diffuse prototype info */ + IF( hParamMC->diff_proto_info ) + { + FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + free( hParamMC->diff_proto_info->source_chan_idx[i] ); + hParamMC->diff_proto_info->source_chan_idx[i] = NULL; + + free( hParamMC->diff_proto_info->proto_fac_fx[i] ); + hParamMC->diff_proto_info->proto_fac_fx[i] = NULL; + } + + free( hParamMC->diff_proto_info->source_chan_idx ); + hParamMC->diff_proto_info->source_chan_idx = NULL; + + free( hParamMC->diff_proto_info->proto_fac_fx ); + hParamMC->diff_proto_info->proto_fac_fx = NULL; + + free( hParamMC->diff_proto_info->proto_index_diff ); + hParamMC->diff_proto_info->proto_index_diff = NULL; + + free( hParamMC->diff_proto_info->num_source_chan_diff ); + hParamMC->diff_proto_info->num_source_chan_diff = NULL; + + free( hParamMC->diff_proto_info ); + hParamMC->diff_proto_info = NULL; + } + /* States */ + /* free prototype signal buffers */ + IF( hParamMC->proto_frame_f_fx != NULL ) + { + free( hParamMC->proto_frame_f_fx ); + hParamMC->proto_frame_f_fx = NULL; + } + + IF( hParamMC->proto_frame_dec_f_fx != NULL ) + { + free( hParamMC->proto_frame_dec_f_fx); + hParamMC->proto_frame_dec_f_fx = NULL; + } + + IF( hParamMC->ls_conv_dmx_matrix_fx != NULL ) + { + free( hParamMC->ls_conv_dmx_matrix_fx ); + hParamMC->ls_conv_dmx_matrix_fx = NULL; + } + + IF( hParamMC->proto_matrix_int_fx != NULL ) + { + free( hParamMC->proto_matrix_int_fx ); + hParamMC->proto_matrix_int_fx = NULL; + } + + IF( hParamMC->hoa_encoder_fx != NULL ) + { + free( hParamMC->hoa_encoder_fx ); + hParamMC->hoa_encoder_fx = NULL; + } + IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) + { + free( hParamMC->Cldfb_RealBuffer_tc_fx ); + hParamMC->Cldfb_RealBuffer_tc_fx = NULL; + } + IF( hParamMC->Cldfb_ImagBuffer_tc_fx != NULL ) + { + free( hParamMC->Cldfb_ImagBuffer_tc_fx ); + hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; + } +#if 1 /*TODO: To be removed later(Floating point memory dealloc)------------------------------- */ + + IF( hParamMC->icc_q != NULL ) + { + free( hParamMC->icc_q ); + hParamMC->icc_q = NULL; + } + + IF( hParamMC->icld_q != NULL ) + { + free( hParamMC->icld_q ); + hParamMC->icld_q = NULL; + } + IF( hParamMC->diff_proto_info ) + { + FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + free( hParamMC->diff_proto_info->proto_fac[i] ); + hParamMC->diff_proto_info->proto_fac[i] = NULL; + } + free( hParamMC->diff_proto_info->proto_fac ); + hParamMC->diff_proto_info->proto_fac = NULL; + } + IF( hParamMC->proto_frame_f != NULL ) + { + free( hParamMC->proto_frame_f ); + hParamMC->proto_frame_f = NULL; + } + IF( hParamMC->proto_frame_dec_f != NULL ) + { + free( hParamMC->proto_frame_dec_f ); + hParamMC->proto_frame_dec_f = NULL; + } + IF( hParamMC->ls_conv_dmx_matrix != NULL ) + { + free( hParamMC->ls_conv_dmx_matrix ); + hParamMC->ls_conv_dmx_matrix = NULL; + } + IF( hParamMC->Cldfb_RealBuffer_tc != NULL ) + { + free( hParamMC->Cldfb_RealBuffer_tc ); + hParamMC->Cldfb_RealBuffer_tc = NULL; + } + IF( hParamMC->Cldfb_ImagBuffer_tc != NULL ) + { + free( hParamMC->Cldfb_ImagBuffer_tc ); + hParamMC->Cldfb_ImagBuffer_tc = NULL; + } +#endif /***********************************ends here************************************************/ + + free( *hParamMC_out ); + *hParamMC_out = NULL; + return; +} +#endif void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ ) @@ -1978,7 +2591,6 @@ void ivas_param_mc_dec_close( return; } - /*------------------------------------------------------------------------- * ivas_param_mc_dec_read_BS() * @@ -3519,7 +4131,65 @@ void ivas_param_mc_dec( * * Parametric MC decoding initialization *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void ivas_param_mc_dec_init_fx( + PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ + const Word16 nchan_transport, /* i : number of input (transport) channels */ + const Word16 nchan_cov ) /* i : number of cov synthesis channels */ +{ + Word16 k; + UWord16 max_param_band_residual; + Word16 len; + + /*-----------------------------------------------------------------* + * init sub-modules + *-----------------------------------------------------------------*/ + + /* decorrelation */ + IF ( GT_16(hParamMC->max_band_decorr , 0) ) + { + len = hParamMC->diff_proto_info->num_protos_diff * hParamMC->h_freq_domain_decorr_ap_params->h_onset_detection_power_params.max_band_decorr; + + /* init onsetDetectionPower */ + set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx, len ); + set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx, len ); +#if 1/*Floating point intialization: to be removed later*/ + set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1, len ); + set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2, len ); +#endif + } + + max_param_band_residual = 0; + + /* output synthesis */ + FOR ( k = hParamMC->hMetadataPMC->num_parameter_bands; k >= 0; k-- ) + { + IF ( LE_16(hParamMC->band_grouping[k] , hParamMC->max_band_decorr) ) + { + max_param_band_residual = k; + break; + } + } + + ivas_dirac_dec_output_synthesis_cov_init_fx( &( hParamMC->h_output_synthesis_cov_state ), nchan_transport, nchan_cov, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual ); + + /*-----------------------------------------------------------------* + * init proto frames + *-----------------------------------------------------------------*/ + + IF ( GT_16(hParamMC->max_band_decorr , 0) ) + { +#if 1/*TODO: To be removed later*/ + set_zero( hParamMC->proto_frame_f, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); + set_zero( hParamMC->proto_frame_dec_f, 2 * nchan_cov * hParamMC->num_freq_bands ); +#endif + set_zero_fx( hParamMC->proto_frame_f_fx, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); + set32_fx( hParamMC->proto_frame_dec_f_fx, 0, 2 * nchan_cov * hParamMC->num_freq_bands ); + } + return; +} +#endif // IVAS_FLOAT_FIXED static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ const int16_t nchan_transport, /* i : number of input (transport) channels */ @@ -5629,8 +6299,8 @@ static ivas_error param_mc_get_diff_proto_info_fx( const Word32 *proto_mtx, /* i : protoype matrix for the synthesis */ const UWord16 nchan_transport, /* i : number of transport channels */ const UWord16 nchan_out_cov, /* i : number if output channels of the covariance synthesis */ - PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info /* o : generated diffuse prototype info */ -) + PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, /* o : generated diffuse prototype info */ + Word16 Q_proto_mtx ) { #if FLT_ENABLE float proto_fac[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -5698,7 +6368,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( #if FLT_ENABLE if ( diff < 0.1f ) #else - if ( LT_64( diff_fx * 10, 2147483648 ) ) + if ( LT_64( diff_fx * 10, L_shl_sat(1, Q_proto_mtx)) ) #endif { found = 1; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 47bb00816..b6366c95c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -64,74 +64,295 @@ static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamp #ifndef IVAS_FLOAT_FIXED ivas_error ivas_mct_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output[], /* o : output synthesis signal */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t nb_bits_metadata /* i : number of metadata bits */ +) +{ + int16_t n, nCPE, cpe_id; + MCT_DEC_HANDLE hMCT; + CPE_DEC_HANDLE hCPE; + float *x[CPE_CHANNELS][NB_DIV]; + int16_t param[MCT_MAX_BLOCKS][CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV]; + int16_t param_lpc[MCT_MAX_BLOCKS][CPE_CHANNELS][NPRM_LPC_NEW]; + int16_t p_param[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + int16_t nTnsBitsTCX10[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + float Aq[MCT_MAX_BLOCKS][CPE_CHANNELS][(NB_SUBFR16k + 1) * (M + 1)]; + int16_t fUseTns[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + Decoder_State **sts; + float synth[CPE_CHANNELS][L_FRAME_PLUS]; + float output_lfe_ch[L_FRAME48k]; + int32_t ivas_total_brate; + ivas_error error; + + push_wmops("ivas_mct_dec"); + + error = IVAS_ERR_OK; + nCPE = st_ivas->nCPE; + hMCT = st_ivas->hMCT; + + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + + if (st_ivas->ivas_format == MC_FORMAT && (st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX)) + { + /* save LFE channel */ + mvr2r(output[LFE_CHANNEL], output_lfe_ch, output_frame); + } + + if (st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && !st_ivas->bfi) + { + /* get the number of channels from the signalled MC LS setup */ + n = ivas_mc_ls_setup_get_num_channels(ivas_mc_map_output_config_to_mc_ls_setup(st_ivas->transport_config)); + + if (n != st_ivas->nchan_transport) + { + /* IVAS_fmToDo: more work needed for switching the number of transport channels */ + return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "Error: wrong number of transport channels signalled in MC format!"); + } + } + + for (cpe_id = 0; cpe_id < nCPE; cpe_id++) + { + /*initialize param_lpc buffer*/ + for (n = 0; n < CPE_CHANNELS; n++) + { + set_s(param_lpc[cpe_id][n], 0, NPRM_LPC_NEW); + } + + if ((error = ivas_cpe_dec(st_ivas, cpe_id, output, output_frame, 0)) != IVAS_ERR_OK) + { + return error; + } + + if (cpe_id == 0) + { + st_ivas->hCPE[0]->hCoreCoder[0]->total_brate = ivas_total_brate; /* set high enough to read the whole side-info; total_brate is rewritten later in ivas_mdct_core_invQ() */ + } + + if (!st_ivas->bfi) + { + ivas_mdct_dec_side_bits_frame_channel(st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, + ((cpe_id + 1) * CPE_CHANNELS > hMCT->nchan_out_woLFE)); + + st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; + st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; + } + } + + /* MCT side bits decoder */ + ivas_mct_side_bits(hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata); + + for (cpe_id = 0; cpe_id < nCPE; cpe_id++) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect |= st_ivas->BER_detect; + st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect |= st_ivas->BER_detect; + + for (n = 0; n < CPE_CHANNELS; n++) + { + x[n][0] = output[n + cpe_id * CPE_CHANNELS]; + x[n][1] = output[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); + set_zero(x[n][0], L_FRAME48k / 2); + set_zero(x[n][1], L_FRAME48k / 2); + } + + ivas_mdct_core_invQ(st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], + fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1); + + st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; + st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; + } + + /* MCT core decoder */ + ivas_mct_core_dec(hMCT, st_ivas->hCPE, nCPE, output); + + /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ + if (st_ivas->sba_dirac_stereo_flag && st_ivas->ivas_format != SBA_ISM_FORMAT) + { + for (cpe_id = 1; cpe_id < nCPE; cpe_id++) + { + for (n = 0; n < CPE_CHANNELS; n++) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + } + } + } + + /* MCT reconstruction and CoreCoder updates */ + for (cpe_id = 0; cpe_id < nCPE; cpe_id++) + { + hCPE = st_ivas->hCPE[cpe_id]; + + for (n = 0; n < CPE_CHANNELS; n++) + { + x[n][0] = output[n + cpe_id * CPE_CHANNELS]; + x[n][1] = output[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); + } + + ivas_mdct_core_tns_ns(hCPE, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1); + } + + if (st_ivas->renderer_type == RENDERER_MC) + { + /* Equalization in MDCT Domain */ + ivas_ls_setup_conversion_process_mdct(st_ivas, output); + } + + else if (st_ivas->renderer_type == RENDERER_MC_PARAMMC && (st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO)) + { + float *x_all[MAX_CICP_CHANNELS][NB_DIV]; + + for (cpe_id = 0; cpe_id < nCPE; cpe_id++) + { + for (n = 0; n < CPE_CHANNELS; n++) + { + x_all[n + cpe_id * CPE_CHANNELS][0] = output[n + cpe_id * CPE_CHANNELS]; + x_all[n + cpe_id * CPE_CHANNELS][1] = output[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); + } + } + + ivas_ls_setup_conversion_process_mdct_param_mc(st_ivas, x_all); + } + + for (cpe_id = 0; cpe_id < nCPE; cpe_id++) + { + hCPE = st_ivas->hCPE[cpe_id]; + sts = hCPE->hCoreCoder; + + for (n = 0; n < CPE_CHANNELS; n++) + { + x[n][0] = output[n + cpe_id * CPE_CHANNELS]; + x[n][1] = output[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); + } + + ivas_mdct_core_reconstruct(hCPE, x, synth, fUseTns[cpe_id], 1); + + /*----------------------------------------------------------------* + * CoreCoder Post-processing and updates + *----------------------------------------------------------------*/ + + for (n = 0; n < CPE_CHANNELS; n++) + { + if (st_ivas->sba_dirac_stereo_flag && (st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2)) + { + ivas_post_proc(NULL, hCPE, n, synth[n], NULL, output_frame, 1); + } + + /* Postprocessing for ACELP/MDCT core switching and synchronization */ + if ((error = core_switching_post_dec(sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, (st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2) ? st_ivas->sba_dirac_stereo_flag : 0, -1, hCPE->last_element_mode)) != IVAS_ERR_OK) + { + return error; + } + + /* final output of synthesis signal */ + mvr2r(synth[n], output[cpe_id * CPE_CHANNELS + n], output_frame); + + /* Save synthesis for HQ FEC */ + save_synthesis_hq_fec(sts[n], output[cpe_id * CPE_CHANNELS + n], output_frame, hCPE); + + /* CoreCoder common updates */ + updt_dec_common(sts[n], NORMAL_HQ_CORE, -1, output[cpe_id * CPE_CHANNELS + n]); + + } /* n_channels loop */ + + + /* synthesis synchronization between stereo modes */ + if (!st_ivas->sba_dirac_stereo_flag || (st_ivas->ivas_format == SBA_ISM_FORMAT && cpe_id < nCPE - 2)) + { + synchro_synthesis(ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0); + } + + } + + /* move channels after LFE to correct output for multi-channel MCT */ + if (st_ivas->ivas_format == MC_FORMAT && (st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX)) + { + float tmp[L_FRAME48k]; + + /*save center channel output*/ + mvr2r(output[hMCT->nchan_out_woLFE - 1], tmp, output_frame); + + for (n = hMCT->nchan_out_woLFE - 1; n >= LFE_CHANNEL; n--) + { + mvr2r(output[n - 1], output[n + 1], output_frame); + } + mvr2r(tmp, output[LFE_CHANNEL - 1], output_frame); + + /* save LFE channel */ + mvr2r(output_lfe_ch, output[LFE_CHANNEL], output_frame); + } + + + pop_wmops(); + return error; +} +#else +ivas_error ivas_mct_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output[], /* o : output synthesis signal */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t nb_bits_metadata /* i : number of metadata bits */ + Word32 *output_fx[], /* o : output synthesis signal */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ ) { - int16_t n, nCPE, cpe_id; + Word16 ch, nCPE, cpe_id; MCT_DEC_HANDLE hMCT; CPE_DEC_HANDLE hCPE; - float *x[CPE_CHANNELS][NB_DIV]; - int16_t param[MCT_MAX_BLOCKS][CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV]; - int16_t param_lpc[MCT_MAX_BLOCKS][CPE_CHANNELS][NPRM_LPC_NEW]; - int16_t p_param[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; - int16_t nTnsBitsTCX10[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; - float Aq[MCT_MAX_BLOCKS][CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; - int16_t fUseTns[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + Word16 param[MCT_MAX_BLOCKS][CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV]; + Word16 param_lpc[MCT_MAX_BLOCKS][CPE_CHANNELS][NPRM_LPC_NEW]; + Word16 p_param[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + Word16 nTnsBitsTCX10[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + Word16 fUseTns[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; + Word16 Aq_fx[MCT_MAX_BLOCKS][CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; + Word32 output_lfe_ch_fx[L_FRAME48k]; + Word16 q_output = 11; + Word16 n, k, l, i, j; + + Word32 *x_fx[CPE_CHANNELS][NB_DIV]; + Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]; + Word16 x_len[CPE_CHANNELS][NB_DIV] = { 0 }; Decoder_State **sts; - float synth[CPE_CHANNELS][L_FRAME_PLUS]; - float output_lfe_ch[L_FRAME48k]; + Word16 synth_fx[CPE_CHANNELS][L_FRAME_PLUS]; int32_t ivas_total_brate; ivas_error error; -#ifdef IVAS_FLOAT_FIXED - /* TODO: Temporary fix to avoid garbage values while calculating its q-factor - when not initialised. */ - set_zero((float *)Aq, MCT_MAX_BLOCKS*CPE_CHANNELS*(NB_SUBFR16k + 1) * (M + 1)); -#endif - push_wmops( "ivas_mct_dec" ); error = IVAS_ERR_OK; nCPE = st_ivas->nCPE; + move16(); hMCT = st_ivas->hMCT; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + move32(); - if ( st_ivas->ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) + IF ( EQ_16(st_ivas->ivas_format, MC_FORMAT) && ( EQ_16(st_ivas->mc_mode, MC_MODE_MCT) || EQ_16(st_ivas->mc_mode, MC_MODE_PARAMUPMIX) ) ) { /* save LFE channel */ - mvr2r( output[LFE_CHANNEL], output_lfe_ch, output_frame ); + mvl2l( output_fx[LFE_CHANNEL], output_lfe_ch_fx, output_frame ); } - if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && !st_ivas->bfi ) + IF ( EQ_16(st_ivas->ivas_format, MC_FORMAT) && EQ_16(st_ivas->mc_mode, MC_MODE_MCT) && EQ_16(st_ivas->bfi, 0) ) { /* get the number of channels from the signalled MC LS setup */ n = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); - if ( n != st_ivas->nchan_transport ) + IF ( NE_16(n, st_ivas->nchan_transport) ) { /* IVAS_fmToDo: more work needed for switching the number of transport channels */ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: wrong number of transport channels signalled in MC format!" ); } } - for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + FOR ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { /*initialize param_lpc buffer*/ - for ( n = 0; n < CPE_CHANNELS; n++ ) + FOR ( n = 0; n < CPE_CHANNELS; n++ ) { set_s( param_lpc[cpe_id][n], 0, NPRM_LPC_NEW ); } -#ifdef IVAS_FLOAT_FIXED - Word32 *output_fx[2]; - Word16 q_output = 11; - output_fx[0] = malloc( sizeof( Word32 ) * L_FRAME48k ); - output_fx[1] = malloc( sizeof( Word32 ) * L_FRAME48k ); set32_fx( &output_fx[0][0], 0, L_FRAME48k ); set32_fx( &output_fx[1][0], 0, L_FRAME48k ); @@ -140,1649 +361,1837 @@ ivas_error ivas_mct_dec( return error; } - for ( int k = 0; k < L_FRAME48k; k++ ) - { - output[0][k] = (float) output_fx[0][k] / ( 1 << q_output ); - output[1][k] = (float) output_fx[1][k] / ( 1 << q_output ); - } - free( output_fx[0] ); - free( output_fx[1] ); -#else - if ( ( error = ivas_cpe_dec( st_ivas, cpe_id, output, output_frame, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED - - if ( cpe_id == 0 ) + IF ( EQ_16(cpe_id, 0) ) { st_ivas->hCPE[0]->hCoreCoder[0]->total_brate = ivas_total_brate; /* set high enough to read the whole side-info; total_brate is rewritten later in ivas_mdct_core_invQ() */ + move32(); } - if ( !st_ivas->bfi ) + IF ( EQ_16(st_ivas->bfi, 0) ) { - ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, - ( ( cpe_id + 1 ) * CPE_CHANNELS > hMCT->nchan_out_woLFE ) ); + ivas_mdct_dec_side_bits_frame_channel_fx( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, + (Word16) GT_16( i_mult(add( cpe_id, 1 ), CPE_CHANNELS ), hMCT->nchan_out_woLFE ) ); - st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; - st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; + st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect); + test(); + st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect); + test(); } } /* MCT side bits decoder */ - ivas_mct_side_bits( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); + ivas_mct_side_bits_fx( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); - for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + FOR ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { - st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect |= st_ivas->BER_detect; - st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect |= st_ivas->BER_detect; - - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - x[n][0] = output[n + cpe_id * CPE_CHANNELS]; - x[n][1] = output[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); - set_zero( x[n][0], L_FRAME48k / 2 ); - set_zero( x[n][1], L_FRAME48k / 2 ); - } - -#ifdef IVAS_FLOAT_FIXED -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - Word16 Aq_fx[MCT_MAX_BLOCKS][CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; - Word16 ch, k, l, i, j; - - Word32 *x_fx[CPE_CHANNELS][NB_DIV]; - Word16 x_e[CPE_CHANNELS][NB_DIV]; - Word16 x_len[CPE_CHANNELS][NB_DIV] = { 0 }; + st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect = s_or(st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect, st_ivas->BER_detect); + test(); + st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect = s_or(st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect, st_ivas->BER_detect); + test(); - FOR( i = 0; i < CPE_CHANNELS; ++i ) + FOR ( n = 0; n < CPE_CHANNELS; n++ ) { - x_fx[i][0] = malloc( L_FRAME48k * sizeof( Word32 ) ); - x_fx[i][1] = x_fx[i][0] + L_FRAME48k / 2; - floatToFixed_arrL( x[i][0], x_fx[i][0], 0, L_FRAME48k / 2 ); - floatToFixed_arrL( x[i][1], x_fx[i][1], 0, L_FRAME48k / 2 ); - - FOR( j = 0; j < NB_DIV; ++j ) - { - x_e[i][j] = 31; - } + x_fx[n][0] = output_fx[n + cpe_id * CPE_CHANNELS]; + x_e[n][0] = 20; + x_fx[n][1] = output_fx[n + cpe_id * CPE_CHANNELS] + shr( L_FRAME48k, 1 ); + x_e[n][1] = 20; + move16(); + move16(); + + set32_fx( x_fx[n][0], 0, shr(L_FRAME48k, 1) ); + set32_fx( x_fx[n][1], 0, shr(L_FRAME48k, 1) ); } - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - sts[ch]->gamma = float_to_fix16( sts[ch]->gamma_float, Q15 ); - sts[ch]->preemph_fac = float_to_fix16( sts[ch]->preemph_fac_float, Q15 ); - sts[ch]->Mode2_lp_gainp = float_to_fix( sts[ch]->lp_gainp, Q16 ); - sts[ch]->hTcxLtpDec->tcxltp_gain = float_to_fix16( sts[ch]->hTcxLtpDec->tcxltp_gain_float, Q15 ); - sts[ch]->inv_gamma = float_to_fix16( 1 / sts[ch]->gamma_float, Q14 ); - f2me_16( sts[ch]->last_gain_syn_deemph_float, &sts[ch]->last_gain_syn_deemph, &sts[ch]->last_gain_syn_deemph_e ); - f2me_16( sts[ch]->last_concealed_gain_syn_deemph_float, &sts[ch]->last_concealed_gain_syn_deemph, &sts[ch]->last_concealed_gain_syn_deemph_e ); - f2me_16( sts[ch]->hTcxDec->old_gaintcx_bfi_float, &sts[ch]->hTcxDec->old_gaintcx_bfi, &sts[ch]->hTcxDec->old_gaintcx_bfi_e ); - floatToFixed_arr( Aq[cpe_id][ch], Aq_fx[cpe_id][ch], Q12, ( NB_SUBFR16k + 1 ) * ( M + 1 ) ); - - sts[ch]->hTcxDec->tcxltp_last_gain_unmodified = float_to_fix16( sts[ch]->hTcxDec->tcxltp_last_gain_unmodified_float, Q15 ); - sts[ch]->old_fpitch = float_to_fix( sts[ch]->old_fpitch_float, Q16 ); - //sts[ch]->hTonalMDCTConc->lastPitchLag = float_to_fix( sts[ch]->hTonalMDCTConc->lastPitchLag_float, Q16 ); - // u8bit to 16bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[ch]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[ch]->hIGFDec->infoTCXNoise[l]; - } - FOR( l = 0; l < N_LTP_GAIN_MEMS; l++ ) - { - sts[ch]->hTcxDec->ltpGainMemory_fx[l] = float_to_fix16( sts[ch]->hTcxDec->ltpGainMemory[l], Q15 ); - } - sts[ch]->hTcxDec->cummulative_damping_tcx = float_to_fix16( sts[ch]->hTcxDec->cummulative_damping_tcx_float, Q15 ); - } - } - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( sts[ch]->rate_switching_reset ) - { - floatToFixed_arr( sts[ch]->lsp_old, sts[ch]->lsp_old_fx, Q15, M ); - } - } -#endif ivas_mdct_core_invQ_fx( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x_fx, x_e, x_fx, x_e, x_len, Aq_fx[cpe_id], NULL, 1 ); -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) - { - me2f_buf( x_fx[ch][0], x_e[ch][0], x[ch][0], sts[ch]->hTcxCfg->tcx_coded_lines ); - sts[ch]->hTcxDec->damping_float = fix16_to_float( sts[ch]->hTcxDec->damping, Q14 ); - sts[ch]->hTcxDec->gainHelper_float = me2f_16( sts[ch]->hTcxDec->gainHelper, sts[ch]->hTcxDec->gainHelper_e ); - sts[ch]->hTcxDec->stepCompensate_float = me2f_16( sts[ch]->hTcxDec->stepCompensate, sts[ch]->hTcxDec->stepCompensate_e ); - } - IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - sts[ch]->lp_gainp = fix_to_float( sts[ch]->Mode2_lp_gainp, Q16 ); - //sts[ch]->hTonalMDCTConc->lastPitchLag_float = fix_to_float( sts[ch]->hTonalMDCTConc->lastPitchLag, Q16 ); - sts[ch]->hTonalMDCTConc->nFramesLost_float = fix16_to_float( sts[ch]->hTonalMDCTConc->nFramesLost, Q1 ); - sts[ch]->hTcxDec->damping_float = fix16_to_float( sts[ch]->hTcxDec->damping, Q14 ); - sts[ch]->hTcxDec->stepCompensate_float = me2f_16( sts[ch]->hTcxDec->stepCompensate, sts[ch]->hTcxDec->stepCompensate_e ); - sts[ch]->hTcxDec->gainHelper_float = me2f_16( sts[ch]->hTcxDec->gainHelper, sts[ch]->hTcxDec->gainHelper_e ); - sts[ch]->last_concealed_gain_syn_deemph_float = me2f_16( sts[ch]->last_concealed_gain_syn_deemph, sts[ch]->last_concealed_gain_syn_deemph_e ); - sts[ch]->last_gain_syn_deemph_float = me2f_16( sts[ch]->last_gain_syn_deemph, sts[ch]->last_gain_syn_deemph_e ); - sts[ch]->hTcxDec->old_gaintcx_bfi_float = me2f_16( sts[ch]->hTcxDec->old_gaintcx_bfi, sts[ch]->hTcxDec->old_gaintcx_bfi_e ); - fixedToFloat_arr( Aq_fx[cpe_id][ch], Aq[cpe_id][ch], Q12, ( NB_SUBFR16k + 1 ) * ( M + 1 ) ); - // 16bit to u8bit - FOR( Word16 l = 0; l < IGF_START_MX; l++ ) - { - sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - FOR( Word16 l = 0; l < N_LTP_GAIN_MEMS; l++ ) - { - sts[ch]->hTcxDec->ltpGainMemory[l] = fix16_to_float( sts[ch]->hTcxDec->ltpGainMemory_fx[l], Q15 ); - } - Word16 subFrames = ( sts[ch]->core == TCX_10_CORE ) ? NB_DIV : 1; - FOR( k = 0; k < subFrames; ++k ) - { - me2f_buf( x_fx[ch][k], x_e[ch][k], x[ch][k], x_len[ch][k] ); - // To be made into Q11 - // me2f_buf(x_fx[ch][k], x_e[ch][k], x[ch][k], L_FRAME48k / 2); - } - IF( !sts[0]->bfi || ( sts[0]->bfi && sts[ch]->core != ACELP_CORE ) ) - { - me2f_buf( sts[ch]->hIGFDec->virtualSpec, sts[ch]->hIGFDec->virtualSpec_e, sts[ch]->hIGFDec->virtualSpec_float, ( N_MAX_TCX - IGF_START_MN ) ); - } - sts[ch]->hTcxDec->cummulative_damping_tcx_float = fix16_to_float( sts[ch]->hTcxDec->cummulative_damping_tcx, Q15 ); - } - } - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) + FOR(ch = 0; ch < CPE_CHANNELS; ch++) { - IF( sts[ch]->rate_switching_reset ) + Word16 subFrames = (st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->core == TCX_10_CORE) ? NB_DIV : 1; + FOR(k = 0; k < subFrames; ++k) { - Word16 old_Aq_12_8_e = norm_s( sts[ch]->old_Aq_12_8_fx[0] ); - fixedToFloat_arr( sts[ch]->old_Aq_12_8_fx, sts[ch]->old_Aq_12_8, ( 15 - old_Aq_12_8_e ), M + 1 ); + Scale_sig32(x_fx[ch][k], shr(L_FRAME48k, subFrames - 1), sub(x_e[ch][k], 20)); } } - - FOR( i = 0; i < CPE_CHANNELS; ++i ) - { - free( x_fx[i][0] ); - } - -#endif -#else - ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], - fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1 ); -#endif - - st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; - st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; - } - - /* MCT core decoder */ -#ifdef IVAS_FLOAT_FIXED -#if 1 - Word32 *signal_out_fx[MAX_TRANSPORT_CHANNELS]; - Decoder_State *st, *sts_tmp[MAX_TRANSPORT_CHANNELS]; - int i = 0; - for (cpe_id = 0; cpe_id < nCPE; cpe_id++) - { - for (int ch = 0; ch < CPE_CHANNELS; ch++) - { - sts_tmp[i] = st_ivas->hCPE[cpe_id]->hCoreCoder[ch]; - i++; - } + + st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect); + test(); + st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect); + test(); } - i = 0; - for (int ch = 0; ch < hMCT->nchan_out_woLFE; ch++) - { - if (sts_tmp[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE) - { - continue; - } - i++; - } - for (int i = 0; i < hMCT->nchan_out_woLFE; ++i) - { - signal_out_fx[i] = malloc(L_FRAME48k * sizeof(Word32)); - floatToFixed_arrL(output[i], signal_out_fx[i], Q12, L_FRAME48k); - } + /* MCT core decoder */ Word16 q_x[MAX_TRANSPORT_CHANNELS]; set16_fx(q_x, Q12, MAX_TRANSPORT_CHANNELS); -#endif - - ivas_mct_core_dec(hMCT, st_ivas->hCPE, nCPE, signal_out_fx, q_x); - - for (int ch = 0; ch < hMCT->nchan_out_woLFE; ch++) + // Scaling output buffer to q_x + FOR ( i = 0; i < hMCT->nchan_out_woLFE; ++i) { - fixedToFloat_arrL(signal_out_fx[ch], output[ch], q_x[ch], L_FRAME48k); - free(signal_out_fx[ch]); + Scale_sig32(output_fx[i], L_FRAME48k, sub(q_x[i], Q11) ); } - /*for (int ch = 0; ch < hMCT->nchan_out_woLFE; ch++) - { - dbgwrite_txt(output[ch] , L_FRAME48k, "Fixed_code_mct_core.txt", NULL); - for (int k = 0; k < L_FRAME48k; k++) - { - k = k; - } - }*/ -#if 1 - if (sts_tmp[0]->igf) + ivas_mct_core_dec(hMCT, st_ivas->hCPE, nCPE, output_fx, q_x); + // Scaling output buffer back to Q11 + FOR ( i = 0; i < hMCT->nchan_out_woLFE; ++i) { - if (!hMCT->currBlockDataCnt) - { - for (int ch = 0; ch < hMCT->nchan_out_woLFE; ch++) - { - st = sts_tmp[ch]; - - IF(st->igf) - { - me2f_buf(st->hIGFDec->virtualSpec, st->hIGFDec->virtualSpec_e, st->hIGFDec->virtualSpec_float, (N_MAX_TCX - IGF_START_MN)); - FOR(Word16 l = 0; l < IGF_START_MX; l++) - { - st->hIGFDec->infoTCXNoise[l] = (uint8_t)st->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - } + Scale_sig32(output_fx[i], L_FRAME48k, sub(Q11, q_x[i]) ); } -#endif -#else - ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output ); - /*for (int ch = 0; ch < hMCT->nchan_out_woLFE; ch++) - { - dbgwrite_txt(output[ch], L_FRAME48k, "Float_code_mct_core.txt", NULL); - }*/ -#endif + /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ - if ( st_ivas->sba_dirac_stereo_flag && st_ivas->ivas_format != SBA_ISM_FORMAT ) + IF ( NE_16(st_ivas->sba_dirac_stereo_flag, 0) && NE_16(st_ivas->ivas_format, SBA_ISM_FORMAT) ) { - for ( cpe_id = 1; cpe_id < nCPE; cpe_id++ ) + FOR ( cpe_id = 1; cpe_id < nCPE; cpe_id++ ) { - for ( n = 0; n < CPE_CHANNELS; n++ ) + FOR ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } } } + Word32 Aq_fx_32[6][2][102]; /* MCT reconstruction and CoreCoder updates */ - for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) { hCPE = st_ivas->hCPE[cpe_id]; - for ( n = 0; n < CPE_CHANNELS; n++ ) + FOR(n = 0; n < CPE_CHANNELS; n++) { - x[n][0] = output[n + cpe_id * CPE_CHANNELS]; - x[n][1] = output[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); + Copy_Scale_sig_16_32(Aq_fx[cpe_id][n], Aq_fx_32[cpe_id][n], 102, sub(Q16, Q12)); + x_fx[n][0] = output_fx[n + cpe_id * CPE_CHANNELS]; + x_fx[n][1] = output_fx[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); + x_e[n][0] = 20; + move16(); + x_e[n][1] = 20; + move16(); } - ivas_mdct_core_tns_ns( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); - } + ivas_mdct_core_tns_ns_fx(hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, x_e); - if ( st_ivas->renderer_type == RENDERER_MC ) - { - /* Equalization in MDCT Domain */ -#ifdef IVAS_FLOAT_FIXED - Word32 *output_fx[MAX_TRANSPORT_CHANNELS]; - for ( int i = 0; i < st_ivas->nchan_transport; ++i ) - { - output_fx[i] = malloc( L_FRAME48k * sizeof( Word32 ) ); - floatToFixed_arrL( output[i], output_fx[i], Q11, L_FRAME48k ); - } - ivas_ls_setup_conversion_process_mdct_fx( st_ivas, output_fx); - for ( int i = 0; i < st_ivas->nchan_transport; ++i ) + FOR(Word16 ind = 0; ind < 2; ind++) { - fixedToFloat_arrL( output_fx[i], output[i], Q11, L_FRAME48k ); - free(output_fx[i]); + Word16 nSubFrames = EQ_16(hCPE->hCoreCoder[ind]->core, TCX_20_CORE) ? 1 : NB_DIV; + Scale_sig32(x_fx[ind][0], shr(L_FRAME48k, sub(nSubFrames, 1)), sub(x_e[ind][0], 20)); + IF(nSubFrames == 2) { + Scale_sig32(x_fx[ind][1], shr(L_FRAME48k, 1), sub(x_e[ind][1], 20)); + } } -#else - ivas_ls_setup_conversion_process_mdct( st_ivas, output ); -#endif } - else if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) ) - { - float *x_all[MAX_CICP_CHANNELS][NB_DIV]; - - for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - x_all[n + cpe_id * CPE_CHANNELS][0] = output[n + cpe_id * CPE_CHANNELS]; - x_all[n + cpe_id * CPE_CHANNELS][1] = output[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); - } - } -#ifdef IVAS_FLOAT_FIXED - Word32 **output_fx; + IF ( EQ_16(st_ivas->renderer_type, RENDERER_MC) ) + { + /* Equalization in MDCT Domain */ + ivas_ls_setup_conversion_process_mdct_fx( st_ivas, output_fx); + } + ELSE IF(EQ_16(st_ivas->renderer_type, RENDERER_MC_PARAMMC) && (EQ_16(st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO) || EQ_16(st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO))) + { Word16 x_all_e[MAX_CICP_CHANNELS][NB_DIV] = { 0 }; Word32 *x_all_fx[MAX_CICP_CHANNELS][NB_DIV]; - IF( ( output_fx = (Word32 **) malloc( MAX_CICP_CHANNELS * sizeof( Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) { - FOR( n = 0; n < CPE_CHANNELS; n++ ) + FOR(n = 0; n < CPE_CHANNELS; n++) { - IF( ( output_fx[n + cpe_id * CPE_CHANNELS] = (Word32 *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); - } - f2me_buf( output[n + cpe_id * CPE_CHANNELS], output_fx[n + cpe_id * CPE_CHANNELS], &x_all_e[n + cpe_id * CPE_CHANNELS][0], 960 ); - Scale_sig32( output_fx[n + cpe_id * CPE_CHANNELS], L_FRAME48k, -1 ); /*Scaling the signal down by 1 because of overflow*/ - x_all_e[n + cpe_id * CPE_CHANNELS][0]++; x_all_fx[n + cpe_id * CPE_CHANNELS][0] = output_fx[n + cpe_id * CPE_CHANNELS]; - x_all_fx[n + cpe_id * CPE_CHANNELS][1] = output_fx[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); - x_all_e[n + cpe_id * CPE_CHANNELS][1] = x_all_e[n + cpe_id * CPE_CHANNELS][0]; - } - } - f2me_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); - f2me_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); - PARAM_MC_DEC_HANDLE hParamMC; - hParamMC = st_ivas->hParamMC; - floatToFixed_arr16( hParamMC->icld_q, hParamMC->icld_q_fx, 8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - floatToFixed_arr32( hParamMC->ls_conv_dmx_matrix, hParamMC->ls_conv_dmx_matrix_fx, 15, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) ); - FOR(Word16 chOutIdx = 0; chOutIdx < st_ivas->hDecoderConfig->nchan_out; chOutIdx++) - { - FOR(Word16 chInIdx = 0; chInIdx < st_ivas->nchan_transport; chInIdx++) - { - st_ivas->hLsSetUpConversion->dmxMtx_fx[chInIdx][chOutIdx] = float_to_fix(st_ivas->hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx], 30); /*Q30*/ - } - } - ivas_ls_setup_conversion_process_mdct_param_mc_fx( st_ivas, x_all_fx, x_all_e ); - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - me2f_buf( &x_all_fx[n + cpe_id * CPE_CHANNELS][0][0], x_all_e[n + cpe_id * CPE_CHANNELS][0], &x_all[n + cpe_id * CPE_CHANNELS][0][0], L_FRAME48k / 2 ); - me2f_buf( &x_all_fx[n + cpe_id * CPE_CHANNELS][1][0], x_all_e[n + cpe_id * CPE_CHANNELS][1], &x_all[n + cpe_id * CPE_CHANNELS][1][0], L_FRAME48k / 2 ); + x_all_fx[n + cpe_id * CPE_CHANNELS][1] = output_fx[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); + x_all_e[n + cpe_id * CPE_CHANNELS][1] = 20; + move16(); + x_all_e[n + cpe_id * CPE_CHANNELS][0] = 20; + move16(); } } - me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + ivas_ls_setup_conversion_process_mdct_param_mc_fx(st_ivas, x_all_fx, x_all_e); + + FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) { - FOR( n = 0; n < CPE_CHANNELS; n++ ) + FOR(n = 0; n < CPE_CHANNELS; n++) { - free( output_fx[n + cpe_id * CPE_CHANNELS] ); + Scale_sig32(x_all_fx[n + cpe_id * CPE_CHANNELS][0], shr(L_FRAME48k, 1), sub(x_all_e[n + cpe_id * CPE_CHANNELS][0], 20)); + Scale_sig32(x_all_fx[n + cpe_id * CPE_CHANNELS][1], shr(L_FRAME48k, 1), sub(x_all_e[n + cpe_id * CPE_CHANNELS][1], 20)); } } -#else - ivas_ls_setup_conversion_process_mdct_param_mc( st_ivas, x_all ); -#endif // + } - for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + FOR ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { hCPE = st_ivas->hCPE[cpe_id]; sts = hCPE->hCoreCoder; - for ( n = 0; n < CPE_CHANNELS; n++ ) + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + x_fx[n][0] = output_fx[n + cpe_id * CPE_CHANNELS]; + x_fx[n][1] = output_fx[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); + } + FOR(n = 0; n < CPE_CHANNELS; n++) { - x[n][0] = output[n + cpe_id * CPE_CHANNELS]; - x[n][1] = output[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); + IF(NE_16(hCPE->hCoreCoder[n]->Q_syn, 0)) + { + Scale_sig(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[n]->Q_syn); + } + if ( sts[n]->hTcxDec && sts[n]->hTcxDec->conCngLevelBackgroundTrace_e < 0 ) + { + sts[n]->hTcxDec->conCngLevelBackgroundTrace_e = 0; + } } + + Copy_Scale_sig_16_32(hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, M + 1, (28 - norm_s(hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0] - 1))); + Copy_Scale_sig_16_32(hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, M + 1, (28 - norm_s(hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0] - 1))); + ivas_mdct_core_reconstruct_fx( hCPE, x_fx, synth_fx, fUseTns[cpe_id], 1, q_output, 15 ); + + FOR(n = 0; n < CPE_CHANNELS; n++) + { + IF(NE_16(hCPE->hCoreCoder[n]->Q_syn, 0)) + { + Scale_sig(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, negate(hCPE->hCoreCoder[n]->Q_syn)); + } + IF(hCPE->hCoreCoder[n]->hBPF) + { + hCPE->hCoreCoder[n]->hBPF->pst_mem_deemp_err_fx = extract_l( L_shr( hCPE->hCoreCoder[n]->mem_error, sub(Q16, hCPE->hCoreCoder[n]->Q_syn2 - 1) ) ); + Scale_sig(hCPE->hCoreCoder[n]->hBPF->pst_old_syn_fx, NBPSF_PIT_MAX, hCPE->hCoreCoder[n]->Q_syn2 - 1); + } + IF(hCPE->hCoreCoder[n]->hTcxDec) + { + //Scale_sig(hCPE->hCoreCoder[n]->hTcxDec->synth_history_fx, NS2SA(hCPE->hCoreCoder[n]->output_Fs, PH_ECU_MEM_NS), negate(hCPE->hCoreCoder[n]->Q_syn)); + } + IF(hCPE->hCoreCoder[n]->hHQ_core) + { + Scale_sig(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, negate(hCPE->hCoreCoder[n]->Q_syn)); + } - ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 ); + } + /*----------------------------------------------------------------* * CoreCoder Post-processing and updates *----------------------------------------------------------------*/ + Word32 synth_fx_32[CPE_CHANNELS][L_FRAME48k]; - for ( n = 0; n < CPE_CHANNELS; n++ ) + FOR ( n = 0; n < CPE_CHANNELS; n++ ) { - if ( st_ivas->sba_dirac_stereo_flag && ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ) + IF ( NE_16(st_ivas->sba_dirac_stereo_flag, 0) && ( NE_16(st_ivas->ivas_format, SBA_ISM_FORMAT) || GE_16(cpe_id, sub(nCPE, 2)) ) ) { - ivas_post_proc( NULL, hCPE, n, synth[n], NULL, output_frame, 1 ); + + Copy_Scale_sig_16_32(synth_fx[n], synth_fx_32[n], L_FRAME48k, sub(Q11, 0)); + Copy_Scale_sig_16_32(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx, output_frame, Q11); + ivas_post_proc_fx( NULL, hCPE, n, synth_fx_32[n], NULL, output_frame, 1 ); + Copy_Scale_sig_32_16(synth_fx_32[n], synth_fx[n], L_FRAME48k, sub(0, Q11)); + } /* Postprocessing for ACELP/MDCT core switching and synchronization */ - if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ? st_ivas->sba_dirac_stereo_flag : 0, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) + Word16 output_mem_fx[L_FRAME48k]; + IF( hCPE->output_mem_fx[1] != NULL ) { - return error; + Copy_Scale_sig_32_16( hCPE->output_mem_fx[1], output_mem_fx, NS2SA( sts[n]->output_Fs, 3125000 ), sub(0, Q11) ); } - - /* final output of synthesis signal */ - mvr2r( synth[n], output[cpe_id * CPE_CHANNELS + n], output_frame ); - - /* Save synthesis for HQ FEC */ -#ifdef IVAS_FLOAT_FIXED - Word32 exp_max = 0, i; - Word32 output_fx[L_FRAME48k]; - if ( ( sts[n]->codec_mode == MODE1 && sts[n]->hTcxDec != NULL ) && ( ( sts[n]->core == ACELP_CORE && !( sts[n]->bfi == 1 && sts[n]->con_tcx == 1 ) ) || sts[n]->core == HQ_CORE ) ) + ELSE { - double max_prev_synth_buffer = 0.0f, max_old_out = 0.0f, max_delay_buf_out = 0.0f, max_ouput = 0.0f, max_synth_history = 0.0f; - Word32 exp_prev_synth_buffer = 0, exp_old_out = 0, exp_delay_buf_out = 0, exp_ouput = 0, exp_synth_history = 0; - - /*Find maximum values for all the buffers*/ - for ( i = 0; i < NS2SA( 48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ); i++ ) - { - max_prev_synth_buffer = max( max_prev_synth_buffer, fabs( sts[n]->prev_synth_buffer[i] ) ); - } - if ( (Word16) max_prev_synth_buffer != 0 ) - { - frexp( max_prev_synth_buffer, &exp_prev_synth_buffer ); - } - - for ( i = NS2SA( sts[n]->output_Fs, N_ZERO_MDCT_NS ); i < NS2SA( sts[n]->output_Fs, N_ZERO_MDCT_NS ) + NS2SA( sts[n]->output_Fs, PH_ECU_LOOKAHEAD_NS ); i++ ) - { - max_old_out = max( max_old_out, fabs( sts[n]->hHQ_core->old_out[i] ) ); - } - if ( (Word16) max_old_out != 0 ) - { - frexp( max_old_out, &exp_old_out ); - } - - for ( i = 0; i < NS2SA( sts[n]->output_Fs, DELAY_CLDFB_NS ); i++ ) - { - max_delay_buf_out = max( max_delay_buf_out, fabs( sts[n]->delay_buf_out[i] ) ); - } - if ( (Word16) max_delay_buf_out != 0 ) - { - frexp( max_delay_buf_out, &exp_delay_buf_out ); - } - - for ( i = 0; i < output_frame; i++ ) - { - max_ouput = max( max_ouput, fabs( output[cpe_id * CPE_CHANNELS + n][i] ) ); - } - if ( (Word16) max_ouput != 0 ) - { - frexp( max_ouput, &exp_ouput ); - } - - for ( i = output_frame; i < 2 * output_frame - NS2SA( sts[n]->output_Fs, DELAY_CLDFB_NS ) + NS2SA( sts[n]->output_Fs, PH_ECU_MEM_NS ); i++ ) - { - max_synth_history = max( max_synth_history, fabs( sts[n]->hTcxDec->synth_history[i] ) ); - } - - if ( (Word16) max_synth_history != 0 ) - { - frexp( max_synth_history, &exp_synth_history ); - } - - /*Find a commen maximum exp*/ - exp_max = max( exp_synth_history, exp_ouput ); - exp_max = max( exp_max, exp_prev_synth_buffer ); - exp_max = max( exp_max, exp_old_out ); - exp_max = max( exp_max, exp_delay_buf_out ); - - for ( i = 0; i < NS2SA( sts[n]->output_Fs, DELAY_CLDFB_NS ); i++ ) - { - f2fix_16( &sts[n]->delay_buf_out[i], &sts[n]->delay_buf_out_fx[i], exp_max ); - } - for ( i = NS2SA( sts[n]->output_Fs, N_ZERO_MDCT_NS ); i < NS2SA( sts[n]->output_Fs, PH_ECU_LOOKAHEAD_NS ); i++ ) - { - f2fix_16( &sts[n]->hHQ_core->old_out[i], &sts[n]->hHQ_core->old_out_fx[i], exp_max ); - } - for ( i = 0; i < NS2SA( 48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ); i++ ) - { - f2fix_16( &sts[n]->prev_synth_buffer[i], &sts[n]->prev_synth_buffer_fx[i], exp_max ); - } - for ( i = output_frame; i < 2 * output_frame - NS2SA( sts[n]->output_Fs, DELAY_CLDFB_NS ) + NS2SA( sts[n]->output_Fs, PH_ECU_MEM_NS ); i++ ) - { - f2fix_16( &sts[n]->hTcxDec->synth_history[i], &sts[n]->hTcxDec->synth_history_fx[i], exp_max ); - } - for ( i = 0; i < output_frame; i++ ) - { - f2fix( &output[cpe_id * CPE_CHANNELS + n][i], &output_fx[i], exp_max ); - } + set16_fx( output_mem_fx, 0, NS2SA( sts[n]->output_Fs, 3125000 ) ); } + + Word16 Q_synth = 0; - save_synthesis_hq_fec_fx( sts[n], output_fx, output_frame, hCPE ); - save_synthesis_hq_fec(sts[n], output[cpe_id * CPE_CHANNELS + n], output_frame, hCPE); - if ( ( sts[n]->codec_mode == MODE1 && sts[n]->hTcxDec != NULL ) && ( ( sts[n]->core == ACELP_CORE && !( sts[n]->bfi == 1 && sts[n]->con_tcx == 1 ) ) || sts[n]->core == HQ_CORE ) ) + IF ( ( error = core_switching_post_dec_ivas_fx( sts[n], synth_fx[n], output_fx[cpe_id * CPE_CHANNELS + n], output_mem_fx, st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ? st_ivas->sba_dirac_stereo_flag : 0, -1, hCPE->last_element_mode, &Q_synth ) ) != IVAS_ERR_OK ) { - /*dumps*/ - float track = 0; - for ( i = 0; i < 2 * output_frame; i++ ) - { - fix2f_16( &sts[n]->hTcxDec->synth_history_fx[i], &track, exp_max ); - fix2f_16( &sts[n]->hTcxDec->synth_history_fx[i], &sts[n]->hTcxDec->synth_history[i], exp_max ); -#ifdef DUMPS_ENABLED - dbgwrite_txt( &track, 1, "Fixed_code_synth_history_fx.txt", NULL ); - dbgwrite_txt( &sts[n]->hTcxDec->synth_history[i], 1, "Float_code_synth_history_fx.txt", NULL ); -#endif - } + return error; } -#else - save_synthesis_hq_fec( sts[n], output[cpe_id * CPE_CHANNELS + n], output_frame, hCPE ); -#endif + Copy_Scale_sig_16_32(synth_fx[n], output_fx[cpe_id * CPE_CHANNELS + n], output_frame, sub(Q11, Q_synth)); + + /* Save synthesis for HQ FEC */ + Word32 output_fx_[L_FRAME48k]; + mvl2l(output_fx[cpe_id * CPE_CHANNELS + n], output_fx_, L_FRAME48k); + Scale_sig32(output_fx_, L_FRAME48k, sub(Q16, Q11)); + Copy_Scale_sig32_16(sts[n]->prev_synth_buffer32_fx, sts[n]->prev_synth_buffer_fx, NS2SA(48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS), -11); + sts[n]->q_prev_synth_buffer_fx = 0; + + save_synthesis_hq_fec_fx( sts[n], output_fx_, output_frame, hCPE ); + /* CoreCoder common updates */ - updt_dec_common( sts[n], NORMAL_HQ_CORE, -1, output[cpe_id * CPE_CHANNELS + n] ); + ivas_updt_dec_common_fx( hCPE->hCoreCoder[n], NORMAL_HQ_CORE, -1, output_fx[cpe_id * CPE_CHANNELS + n], 11 ); } /* n_channels loop */ + FOR(n = 0; n < 2; n++) { + IF(hCPE->hCoreCoder[n]) + { + Copy_Scale_sig_16_32(hCPE->hCoreCoder[n]->delay_buf_out_fx, hCPE->hCoreCoder[n]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP, Q11); + } + } /* synthesis synchronization between stereo modes */ - if ( !st_ivas->sba_dirac_stereo_flag || ( st_ivas->ivas_format == SBA_ISM_FORMAT && cpe_id < nCPE - 2 ) ) + IF ( EQ_16(st_ivas->sba_dirac_stereo_flag, 0) || ( EQ_16(st_ivas->ivas_format, SBA_ISM_FORMAT) && LE_16(cpe_id, sub(nCPE, 2)) ) ) { -#ifdef IVAS_FLOAT_FIXED - synchro_synthesis_fixed( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); -#else - synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); -#endif - - //Todo use below once input is fixed not done due to complication in pointer - //synchro_synthesis_fixed_clean( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); + synchro_synthesis_fx( ivas_total_brate, hCPE, output_fx + cpe_id * CPE_CHANNELS, output_frame, 0 ); } - } /* move channels after LFE to correct output for multi-channel MCT */ - if ( st_ivas->ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) + IF ( EQ_16(st_ivas->ivas_format, MC_FORMAT) && ( EQ_16(st_ivas->mc_mode, MC_MODE_MCT) || EQ_16(st_ivas->mc_mode, MC_MODE_PARAMUPMIX) ) ) { - float tmp[L_FRAME48k]; + Word32 tmp[L_FRAME48k]; /*save center channel output*/ - mvr2r( output[hMCT->nchan_out_woLFE - 1], tmp, output_frame ); + mvl2l( output_fx[hMCT->nchan_out_woLFE - 1], tmp, output_frame ); - for ( n = hMCT->nchan_out_woLFE - 1; n >= LFE_CHANNEL; n-- ) + FOR ( n = hMCT->nchan_out_woLFE - 1; n >= LFE_CHANNEL; n-- ) { - mvr2r( output[n - 1], output[n + 1], output_frame ); + mvl2l( output_fx[n - 1], output_fx[n + 1], output_frame ); } - mvr2r( tmp, output[LFE_CHANNEL - 1], output_frame ); + mvl2l( tmp, output_fx[LFE_CHANNEL - 1], output_frame ); /* save LFE channel */ - mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); + mvl2l( output_lfe_ch_fx, output_fx[LFE_CHANNEL], output_frame ); } - pop_wmops(); return error; + } -#else -ivas_error ivas_mct_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *output_fx[], /* o : output synthesis signal */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ +#endif + + +/*------------------------------------------------------------------------- + * create_mct_dec() + * + * Create, allocate and initialize IVAS decoder MCT handle + *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error create_mct_dec_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - Word16 ch, nCPE, cpe_id; MCT_DEC_HANDLE hMCT; - CPE_DEC_HANDLE hCPE; - Word16 param[MCT_MAX_BLOCKS][CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV]; - Word16 param_lpc[MCT_MAX_BLOCKS][CPE_CHANNELS][NPRM_LPC_NEW]; - Word16 p_param[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; - Word16 nTnsBitsTCX10[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; - Word16 fUseTns[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; - STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV]; - Word16 Aq_fx[MCT_MAX_BLOCKS][CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; - Word32 output_lfe_ch_fx[L_FRAME48k]; - Word16 q_output = 11; - Word16 n, k, l, i, j; - - Word32 *x_fx[CPE_CHANNELS][NB_DIV]; - Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]; - Word16 x_len[CPE_CHANNELS][NB_DIV] = { 0 }; - Decoder_State **sts; - Word16 synth_fx[CPE_CHANNELS][L_FRAME_PLUS]; - int32_t ivas_total_brate; - ivas_error error; - - push_wmops( "ivas_mct_dec" ); - - error = IVAS_ERR_OK; - nCPE = st_ivas->nCPE; - move16(); - hMCT = st_ivas->hMCT; + Word16 n; + Word32 cp_bitrate; + Word16 max_blocks; + Word16 cpe_id; - ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - move32(); + /*--------------------------------------------------------- --------* + * Allocate MCT handle + *-----------------------------------------------------------------*/ - IF ( EQ_16(st_ivas->ivas_format, MC_FORMAT) && ( EQ_16(st_ivas->mc_mode, MC_MODE_MCT) || EQ_16(st_ivas->mc_mode, MC_MODE_PARAMUPMIX) ) ) + IF( ( hMCT = (MCT_DEC_HANDLE) malloc( sizeof( MCT_DEC_DATA ) ) ) == NULL ) { - /* save LFE channel */ - mvl2l( output_fx[LFE_CHANNEL], output_lfe_ch_fx, output_frame ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CPE\n" ) ); } - IF ( EQ_16(st_ivas->ivas_format, MC_FORMAT) && EQ_16(st_ivas->mc_mode, MC_MODE_MCT) && EQ_16(st_ivas->bfi, 0) ) - { - /* get the number of channels from the signalled MC LS setup */ - n = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); - - IF ( NE_16(n, st_ivas->nchan_transport) ) - { - /* IVAS_fmToDo: more work needed for switching the number of transport channels */ - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: wrong number of transport channels signalled in MC format!" ); - } - } + /*-----------------------------------------------------------------* + * Allocate MCT BlockData handles + *-----------------------------------------------------------------*/ - FOR ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + /* Determine active channels */ + IF( ( EQ_16(st_ivas->ivas_format , MC_FORMAT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) ) || EQ_16(st_ivas->ivas_format , SBA_FORMAT) || EQ_16(st_ivas->ivas_format , SBA_ISM_FORMAT) ) { - /*initialize param_lpc buffer*/ - FOR ( n = 0; n < CPE_CHANNELS; n++ ) + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + IF( EQ_16(st_ivas->ism_mode , ISM_SBA_MODE_DISC) ) { - set_s( param_lpc[cpe_id][n], 0, NPRM_LPC_NEW ); + hMCT->nchan_out_woLFE = add(hMCT->nchan_out_woLFE,st_ivas->nchan_ism); } + } + ELSE IF( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) + { + hMCT->nchan_out_woLFE = sub(st_ivas->nchan_transport , st_ivas->hTransSetup.num_lfe); + } + ELSE IF( EQ_16(st_ivas->ivas_format , MC_FORMAT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) + { + hMCT->nchan_out_woLFE = sub(st_ivas->nchan_transport , st_ivas->hTransSetup.num_lfe); + } + ELSE + { + assert( !"IVAS format currently not supported for MCT" ); + } - set32_fx( &output_fx[0][0], 0, L_FRAME48k ); - set32_fx( &output_fx[1][0], 0, L_FRAME48k ); + cp_bitrate = L_shl( Mult_32_16( st_ivas->hDecoderConfig->ivas_total_brate, div_s( 1, hMCT->nchan_out_woLFE ) ), 1 ); - IF( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0, &q_output ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( EQ_16(st_ivas->ism_mode , ISM_SBA_MODE_DISC) ) + { + cp_bitrate = L_shl( Mult_32_16( st_ivas->hDecoderConfig->ivas_total_brate, div_s( 1, st_ivas->nchan_transport ) ), 1 ); + } - IF ( EQ_16(cpe_id, 0) ) + /* indicate LFE for appropriate core-coder channel */ + FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + FOR( n = 0; n < CPE_CHANNELS; n++ ) { - st_ivas->hCPE[0]->hCoreCoder[0]->total_brate = ivas_total_brate; /* set high enough to read the whole side-info; total_brate is rewritten later in ivas_mdct_core_invQ() */ - move32(); + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } + } - IF ( EQ_16(st_ivas->bfi, 0) ) - { - ivas_mdct_dec_side_bits_frame_channel_fx( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, - (Word16) GT_16( i_mult(add( cpe_id, 1 ), CPE_CHANNELS ), hMCT->nchan_out_woLFE ) ); - - st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect); - test(); - st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect); - test(); - } + /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ + IF( hMCT->nchan_out_woLFE % 2 ) + { + st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } - /* MCT side bits decoder */ - ivas_mct_side_bits_fx( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata ); + /*Initialize MCT block data */ + max_blocks = shr(hMCT->nchan_out_woLFE , 1); - FOR ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + FOR( n = 0; n < max_blocks; n++ ) { - st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect = s_or(st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect, st_ivas->BER_detect); - test(); - st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect = s_or(st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect, st_ivas->BER_detect); - test(); - - FOR ( n = 0; n < CPE_CHANNELS; n++ ) + IF( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_DEC_BLOCK_DATA ) ) ) == NULL ) { - x_fx[n][0] = output_fx[n + cpe_id * CPE_CHANNELS]; - x_e[n][0] = 20; - x_fx[n][1] = output_fx[n + cpe_id * CPE_CHANNELS] + shr( L_FRAME48k, 1 ); - x_e[n][1] = 20; - move16(); - move16(); - - set32_fx( x_fx[n][0], 0, shr(L_FRAME48k, 1) ); - set32_fx( x_fx[n][1], 0, shr(L_FRAME48k, 1) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); } - ivas_mdct_core_invQ_fx( st_ivas->hCPE[cpe_id], nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], - fUseTns[cpe_id], tnsData[cpe_id], x_fx, x_e, x_fx, x_e, x_len, Aq_fx[cpe_id], NULL, 1 ); + /*Initialize all parameters to zero*/ + hMCT->hBlockData[n]->ch1 = 0; + hMCT->hBlockData[n]->ch2 = 0; - FOR(ch = 0; ch < CPE_CHANNELS; ch++) + /*-----------------------------------------------------------------* + * MDCT stereo initialization + *-----------------------------------------------------------------*/ + + IF( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_DEC_DATA ) ) ) == NULL ) { - Word16 subFrames = (st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->core == TCX_10_CORE) ? NB_DIV : 1; - FOR(k = 0; k < subFrames; ++k) - { - Scale_sig32(x_fx[ch][k], shr(L_FRAME48k, subFrames - 1), sub(x_e[ch][k], 20)); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); } - - st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect); - test(); - st_ivas->BER_detect = s_or(st_ivas->BER_detect, st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect); - test(); - } - - /* MCT core decoder */ - Word16 q_x[MAX_TRANSPORT_CHANNELS]; - set16_fx(q_x, Q12, MAX_TRANSPORT_CHANNELS); - // Scaling output buffer to q_x - FOR ( i = 0; i < hMCT->nchan_out_woLFE; ++i) + initMdctStereoDecData_fx( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, SWB ); + hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; + hMCT->hBlockData[n]->hStereoMdct->reverse_dmx = 0; + hMCT->hBlockData[n]->hStereoMdct->smooth_ratio_fx = ONE_IN_Q26; + } + FOR( ; n < MCT_MAX_BLOCKS; n++ ) { - Scale_sig32(output_fx[i], L_FRAME48k, sub(q_x[i], Q11) ); + hMCT->hBlockData[n] = NULL; } - ivas_mct_core_dec(hMCT, st_ivas->hCPE, nCPE, output_fx, q_x); - // Scaling output buffer back to Q11 - FOR ( i = 0; i < hMCT->nchan_out_woLFE; ++i) + + /*-----------------------------------------------------------------* + * Initializations + *-----------------------------------------------------------------*/ + + hMCT->currBlockDataCnt = 0; + + /*Initialize bits required to signal channel-pair index*/ + // hMCT->bitsChannelPairIndex = max( 1, (Word16) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); + hMCT->bitsChannelPairIndex = s_max( 1, floor_log_2( (Word32) hMCT->nchan_out_woLFE * ( (Word32) hMCT->nchan_out_woLFE - 1 ) / 2 - 1 )+ 1 ); + + set16_fx( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); + set16_fx( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); + + st_ivas->hMCT = hMCT; + + return IVAS_ERR_OK; +} +#endif // IVAS_FLOAT_FIXED + +ivas_error create_mct_dec( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + MCT_DEC_HANDLE hMCT; + int16_t n; + int32_t cp_bitrate; + int16_t max_blocks; + int16_t cpe_id; + + /*--------------------------------------------------------- --------* + * Allocate MCT handle + *-----------------------------------------------------------------*/ + + if ( ( hMCT = (MCT_DEC_HANDLE) malloc( sizeof( MCT_DEC_DATA ) ) ) == NULL ) { - Scale_sig32(output_fx[i], L_FRAME48k, sub(Q11, q_x[i]) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CPE\n" ) ); } - - /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ - IF ( NE_16(st_ivas->sba_dirac_stereo_flag, 0) && NE_16(st_ivas->ivas_format, SBA_ISM_FORMAT) ) + /*-----------------------------------------------------------------* + * Allocate MCT BlockData handles + *-----------------------------------------------------------------*/ + + /* Determine active channels */ + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - FOR ( cpe_id = 1; cpe_id < nCPE; cpe_id++ ) + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { - FOR ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - } + hMCT->nchan_out_woLFE += st_ivas->nchan_ism; } } - - Word32 Aq_fx_32[6][2][102]; - /* MCT reconstruction and CoreCoder updates */ - FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) + else if ( st_ivas->mc_mode == MC_MODE_MCT ) { - hCPE = st_ivas->hCPE[cpe_id]; + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + } + else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + } + else + { + assert( !"IVAS format currently not supported for MCT" ); + } - FOR(n = 0; n < CPE_CHANNELS; n++) - { - Copy_Scale_sig_16_32(Aq_fx[cpe_id][n], Aq_fx_32[cpe_id][n], 102, sub(Q16, Q12)); - x_fx[n][0] = output_fx[n + cpe_id * CPE_CHANNELS]; - x_fx[n][1] = output_fx[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); - x_e[n][0] = 20; - move16(); - x_e[n][1] = 20; - move16(); - } + cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; - ivas_mdct_core_tns_ns_fx(hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, x_e); + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; + } - FOR(Word16 ind = 0; ind < 2; ind++) + /* indicate LFE for appropriate core-coder channel */ + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) { - Word16 nSubFrames = EQ_16(hCPE->hCoreCoder[ind]->core, TCX_20_CORE) ? 1 : NB_DIV; - Scale_sig32(x_fx[ind][0], shr(L_FRAME48k, sub(nSubFrames, 1)), sub(x_e[ind][0], 20)); - IF(nSubFrames == 2) { - Scale_sig32(x_fx[ind][1], shr(L_FRAME48k, 1), sub(x_e[ind][1], 20)); - } + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } } - - IF ( EQ_16(st_ivas->renderer_type, RENDERER_MC) ) + /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ + if ( hMCT->nchan_out_woLFE % 2 ) { - /* Equalization in MDCT Domain */ - ivas_ls_setup_conversion_process_mdct_fx( st_ivas, output_fx); + st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } - ELSE IF(EQ_16(st_ivas->renderer_type, RENDERER_MC_PARAMMC) && (EQ_16(st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO) || EQ_16(st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO))) + + /*Initialize MCT block data */ + max_blocks = hMCT->nchan_out_woLFE / 2; + + for ( n = 0; n < max_blocks; n++ ) { - Word16 x_all_e[MAX_CICP_CHANNELS][NB_DIV] = { 0 }; - Word32 *x_all_fx[MAX_CICP_CHANNELS][NB_DIV]; - FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) + if ( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_DEC_BLOCK_DATA ) ) ) == NULL ) { - FOR(n = 0; n < CPE_CHANNELS; n++) - { - x_all_fx[n + cpe_id * CPE_CHANNELS][0] = output_fx[n + cpe_id * CPE_CHANNELS]; - x_all_fx[n + cpe_id * CPE_CHANNELS][1] = output_fx[n + cpe_id * CPE_CHANNELS] + (L_FRAME48k / 2); - x_all_e[n + cpe_id * CPE_CHANNELS][1] = 20; - move16(); - x_all_e[n + cpe_id * CPE_CHANNELS][0] = 20; - move16(); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); } - ivas_ls_setup_conversion_process_mdct_param_mc_fx(st_ivas, x_all_fx, x_all_e); + /*Initialize all parameters to zero*/ + hMCT->hBlockData[n]->ch1 = 0; + hMCT->hBlockData[n]->ch2 = 0; - FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) + /*-----------------------------------------------------------------* + * MDCT stereo initialization + *-----------------------------------------------------------------*/ + + if ( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_DEC_DATA ) ) ) == NULL ) { - FOR(n = 0; n < CPE_CHANNELS; n++) - { - Scale_sig32(x_all_fx[n + cpe_id * CPE_CHANNELS][0], shr(L_FRAME48k, 1), sub(x_all_e[n + cpe_id * CPE_CHANNELS][0], 20)); - Scale_sig32(x_all_fx[n + cpe_id * CPE_CHANNELS][1], shr(L_FRAME48k, 1), sub(x_all_e[n + cpe_id * CPE_CHANNELS][1], 20)); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); } +#ifndef IVAS_FLOAT_FIXED + initMdctStereoDecData( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, SWB ); +#else + initMdctStereoDecData_fx( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, SWB ); +#endif + hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; + hMCT->hBlockData[n]->hStereoMdct->reverse_dmx = 0; +#ifndef IVAS_FLOAT_FIXED + hMCT->hBlockData[n]->hStereoMdct->smooth_ratio = 1.f; +#else + hMCT->hBlockData[n]->hStereoMdct->smooth_ratio_fx = ONE_IN_Q26; +#endif } - - FOR ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + for ( ; n < MCT_MAX_BLOCKS; n++ ) { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - FOR ( n = 0; n < CPE_CHANNELS; n++ ) - { - x_fx[n][0] = output_fx[n + cpe_id * CPE_CHANNELS]; - x_fx[n][1] = output_fx[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); - } - FOR(n = 0; n < CPE_CHANNELS; n++) - { - IF(NE_16(hCPE->hCoreCoder[n]->Q_syn, 0)) - { - Scale_sig(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[n]->Q_syn); - } - if ( sts[n]->hTcxDec && sts[n]->hTcxDec->conCngLevelBackgroundTrace_e < 0 ) - { - sts[n]->hTcxDec->conCngLevelBackgroundTrace_e = 0; - } - } - - Copy_Scale_sig_16_32(hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, M + 1, (28 - norm_s(hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0] - 1))); - Copy_Scale_sig_16_32(hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, M + 1, (28 - norm_s(hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0] - 1))); - ivas_mdct_core_reconstruct_fx( hCPE, x_fx, synth_fx, fUseTns[cpe_id], 1, q_output, 15 ); - - FOR(n = 0; n < CPE_CHANNELS; n++) - { - IF(NE_16(hCPE->hCoreCoder[n]->Q_syn, 0)) - { - Scale_sig(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, negate(hCPE->hCoreCoder[n]->Q_syn)); - } - IF(hCPE->hCoreCoder[n]->hBPF) - { - hCPE->hCoreCoder[n]->hBPF->pst_mem_deemp_err_fx = extract_l( L_shr( hCPE->hCoreCoder[n]->mem_error, sub(Q16, hCPE->hCoreCoder[n]->Q_syn2 - 1) ) ); - Scale_sig(hCPE->hCoreCoder[n]->hBPF->pst_old_syn_fx, NBPSF_PIT_MAX, hCPE->hCoreCoder[n]->Q_syn2 - 1); - } - IF(hCPE->hCoreCoder[n]->hTcxDec) - { - //Scale_sig(hCPE->hCoreCoder[n]->hTcxDec->synth_history_fx, NS2SA(hCPE->hCoreCoder[n]->output_Fs, PH_ECU_MEM_NS), negate(hCPE->hCoreCoder[n]->Q_syn)); - } - IF(hCPE->hCoreCoder[n]->hHQ_core) - { - Scale_sig(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, L_FRAME48k, negate(hCPE->hCoreCoder[n]->Q_syn)); - } - - } - - - /*----------------------------------------------------------------* - * CoreCoder Post-processing and updates - *----------------------------------------------------------------*/ - Word32 synth_fx_32[CPE_CHANNELS][L_FRAME48k]; - - FOR ( n = 0; n < CPE_CHANNELS; n++ ) - { - IF ( NE_16(st_ivas->sba_dirac_stereo_flag, 0) && ( NE_16(st_ivas->ivas_format, SBA_ISM_FORMAT) || GE_16(cpe_id, sub(nCPE, 2)) ) ) - { - - Copy_Scale_sig_16_32(synth_fx[n], synth_fx_32[n], L_FRAME48k, sub(Q11, 0)); - Copy_Scale_sig_16_32(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx, output_frame, Q11); - ivas_post_proc_fx( NULL, hCPE, n, synth_fx_32[n], NULL, output_frame, 1 ); - Copy_Scale_sig_32_16(synth_fx_32[n], synth_fx[n], L_FRAME48k, sub(0, Q11)); - - } - - /* Postprocessing for ACELP/MDCT core switching and synchronization */ - Word16 output_mem_fx[L_FRAME48k]; - IF( hCPE->output_mem_fx[1] != NULL ) - { - Copy_Scale_sig_32_16( hCPE->output_mem_fx[1], output_mem_fx, NS2SA( sts[n]->output_Fs, 3125000 ), sub(0, Q11) ); - } - ELSE - { - set16_fx( output_mem_fx, 0, NS2SA( sts[n]->output_Fs, 3125000 ) ); - } - - Word16 Q_synth = 0; - - IF ( ( error = core_switching_post_dec_ivas_fx( sts[n], synth_fx[n], output_fx[cpe_id * CPE_CHANNELS + n], output_mem_fx, st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ? st_ivas->sba_dirac_stereo_flag : 0, -1, hCPE->last_element_mode, &Q_synth ) ) != IVAS_ERR_OK ) - { - return error; - } - - Copy_Scale_sig_16_32(synth_fx[n], output_fx[cpe_id * CPE_CHANNELS + n], output_frame, sub(Q11, Q_synth)); - - /* Save synthesis for HQ FEC */ - Word32 output_fx_[L_FRAME48k]; - mvl2l(output_fx[cpe_id * CPE_CHANNELS + n], output_fx_, L_FRAME48k); - Scale_sig32(output_fx_, L_FRAME48k, sub(Q16, Q11)); - Copy_Scale_sig32_16(sts[n]->prev_synth_buffer32_fx, sts[n]->prev_synth_buffer_fx, NS2SA(48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS), -11); - sts[n]->q_prev_synth_buffer_fx = 0; - - save_synthesis_hq_fec_fx( sts[n], output_fx_, output_frame, hCPE ); - - /* CoreCoder common updates */ - ivas_updt_dec_common_fx( hCPE->hCoreCoder[n], NORMAL_HQ_CORE, -1, output_fx[cpe_id * CPE_CHANNELS + n], 11 ); - - } /* n_channels loop */ - - FOR(n = 0; n < 2; n++) { - IF(hCPE->hCoreCoder[n]) - { - Copy_Scale_sig_16_32(hCPE->hCoreCoder[n]->delay_buf_out_fx, hCPE->hCoreCoder[n]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP, Q11); - } - } - - /* synthesis synchronization between stereo modes */ - IF ( EQ_16(st_ivas->sba_dirac_stereo_flag, 0) || ( EQ_16(st_ivas->ivas_format, SBA_ISM_FORMAT) && LE_16(cpe_id, sub(nCPE, 2)) ) ) - { - synchro_synthesis_fx( ivas_total_brate, hCPE, output_fx + cpe_id * CPE_CHANNELS, output_frame, 0 ); - } + hMCT->hBlockData[n] = NULL; } - /* move channels after LFE to correct output for multi-channel MCT */ - IF ( EQ_16(st_ivas->ivas_format, MC_FORMAT) && ( EQ_16(st_ivas->mc_mode, MC_MODE_MCT) || EQ_16(st_ivas->mc_mode, MC_MODE_PARAMUPMIX) ) ) - { - Word32 tmp[L_FRAME48k]; + /*-----------------------------------------------------------------* + * Initializations + *-----------------------------------------------------------------*/ - /*save center channel output*/ - mvl2l( output_fx[hMCT->nchan_out_woLFE - 1], tmp, output_frame ); + hMCT->currBlockDataCnt = 0; - FOR ( n = hMCT->nchan_out_woLFE - 1; n >= LFE_CHANNEL; n-- ) - { - mvl2l( output_fx[n - 1], output_fx[n + 1], output_frame ); - } - mvl2l( tmp, output_fx[LFE_CHANNEL - 1], output_frame ); + /*Initialize bits required to signal channel-pair index*/ + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); - /* save LFE channel */ - mvl2l( output_lfe_ch_fx, output_fx[LFE_CHANNEL], output_frame ); - } + set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); + set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); - pop_wmops(); - return error; + st_ivas->hMCT = hMCT; + return IVAS_ERR_OK; } -#endif /*------------------------------------------------------------------------- - * create_mct_dec() + * mct_dec_reconfigure() * - * Create, allocate and initialize IVAS decoder MCT handle + * Reconfigure IVAS decoder MCT handle *-------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED -ivas_error create_mct_dec_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +ivas_error mct_dec_reconfigure_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const UWord16 b_nchan_change /* i : flag indicating different channel count */ ) { MCT_DEC_HANDLE hMCT; - Word16 n; - Word32 cp_bitrate; - Word16 max_blocks; - Word16 cpe_id; - - /*--------------------------------------------------------- --------* - * Allocate MCT handle - *-----------------------------------------------------------------*/ + Decoder_State *st; + Word16 n, cpe_id, max_blocks; + Word32 cp_bitrate, L_tmp; + Word16 tmp_exp, tmp; - IF( ( hMCT = (MCT_DEC_HANDLE) malloc( sizeof( MCT_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CPE\n" ) ); - } + hMCT = st_ivas->hMCT; /*-----------------------------------------------------------------* - * Allocate MCT BlockData handles - *-----------------------------------------------------------------*/ - - /* Determine active channels */ - IF( ( EQ_16(st_ivas->ivas_format , MC_FORMAT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) ) || EQ_16(st_ivas->ivas_format , SBA_FORMAT) || EQ_16(st_ivas->ivas_format , SBA_ISM_FORMAT) ) + * Allocate and initialize MCT BlockData handles + *-----------------------------------------------------------------*/ + IF ( b_nchan_change ) { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - IF( EQ_16(st_ivas->ism_mode , ISM_SBA_MODE_DISC) ) + /* Determine active channels */ + test(); test(); test(); test(); + IF ( ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { - hMCT->nchan_out_woLFE = add(hMCT->nchan_out_woLFE,st_ivas->nchan_ism); + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + move16(); + IF ( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) + { + hMCT->nchan_out_woLFE = add( hMCT->nchan_out_woLFE, st_ivas->nchan_ism ); + } + } + ELSE IF ( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) ) + { + hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe ); + } + ELSE IF ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) + { + hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe ); + } + ELSE + { + assert( !"IVAS format currently not supported for MCT" ); } - } - ELSE IF( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) - { - hMCT->nchan_out_woLFE = sub(st_ivas->nchan_transport , st_ivas->hTransSetup.num_lfe); - } - ELSE IF( EQ_16(st_ivas->ivas_format , MC_FORMAT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) - { - hMCT->nchan_out_woLFE = sub(st_ivas->nchan_transport , st_ivas->hTransSetup.num_lfe); - } - ELSE - { - assert( !"IVAS format currently not supported for MCT" ); - } - - cp_bitrate = L_shl( Mult_32_16( st_ivas->hDecoderConfig->ivas_total_brate, div_s( 1, hMCT->nchan_out_woLFE ) ), 1 ); - - IF( EQ_16(st_ivas->ism_mode , ISM_SBA_MODE_DISC) ) - { - cp_bitrate = L_shl( Mult_32_16( st_ivas->hDecoderConfig->ivas_total_brate, div_s( 1, st_ivas->nchan_transport ) ), 1 ); } /* indicate LFE for appropriate core-coder channel */ - FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - FOR( n = 0; n < CPE_CHANNELS; n++ ) + FOR ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - IF( hMCT->nchan_out_woLFE % 2 ) + IF ( hMCT->nchan_out_woLFE % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } - /*Initialize MCT block data */ - max_blocks = shr(hMCT->nchan_out_woLFE , 1); + tmp = BASOP_Util_Divide3216_Scale(st_ivas->hDecoderConfig->ivas_total_brate, hMCT->nchan_out_woLFE, &tmp_exp ); + cp_bitrate = L_shl( tmp, tmp_exp + 2 ); - FOR( n = 0; n < max_blocks; n++ ) + IF ( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - IF( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_DEC_BLOCK_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); - } + tmp = BASOP_Util_Divide3216_Scale(st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, &tmp_exp); + cp_bitrate = L_shl(tmp, tmp_exp + 2); + } - /*Initialize all parameters to zero*/ - hMCT->hBlockData[n]->ch1 = 0; - hMCT->hBlockData[n]->ch2 = 0; + /* set correct nominal bitrates and igf config already here, otherwise we + * run into a number of problems */ + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + st_ivas->hCPE[cpe_id]->element_brate = cp_bitrate; + move32(); + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + st = st_ivas->hCPE[cpe_id]->hCoreCoder[n]; - /*-----------------------------------------------------------------* - * MDCT stereo initialization - *-----------------------------------------------------------------*/ + st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; + move32(); - IF( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_DEC_DATA ) ) ) == NULL ) + IF ( NE_32( st->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) ) + { + tmp = BASOP_Util_Divide3232_Scale( st_ivas->hCPE[cpe_id]->element_brate, FRAMES_PER_SEC, &tmp_exp ); + st->bits_frame_nominal = shr( tmp, 15 - tmp_exp ); + st->igf = getIgfPresent_fx(st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag); // no floating point so directly pluggable + + IF(st->igf) + { + IGFDecSetMode_ivas_fx(st->hIGFDec, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, -1, -1, st->rf_flag); + } + } + } + } + + /*Initialize MCT block data */ + tmp = BASOP_Util_Divide1616_Scale(hMCT->nchan_out_woLFE, CPE_CHANNELS, &tmp_exp); + max_blocks = shr( tmp, 15 - tmp_exp ); + + FOR ( n = 0; n < max_blocks; n++ ) + { + IF ( b_nchan_change ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); + IF ( hMCT->hBlockData[n] == NULL ) + { + IF ( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_BLOCK_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); + } + + /*Initialize all parameters to zero*/ + hMCT->hBlockData[n]->ch1 = 0; + move16(); + hMCT->hBlockData[n]->ch2 = 0; + move16(); + + /* MDCT stereo initialization */ + IF ( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); + } + } } - initMdctStereoDecData_fx( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, SWB ); + initMdctStereoDecData_fx( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, st_ivas->hCPE[0]->hCoreCoder[0]->bwidth ); + hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; - hMCT->hBlockData[n]->hStereoMdct->reverse_dmx = 0; - hMCT->hBlockData[n]->hStereoMdct->smooth_ratio_fx = ONE_IN_Q26; + move16(); } - FOR( ; n < MCT_MAX_BLOCKS; n++ ) + + FOR ( ; n < MCT_MAX_BLOCKS; n++ ) { - hMCT->hBlockData[n] = NULL; + /* deallocate no longer needed blocks */ + IF ( hMCT->hBlockData[n] != NULL ) + { + IF ( hMCT->hBlockData[n]->hStereoMdct != NULL ) + { + free( hMCT->hBlockData[n]->hStereoMdct ); + hMCT->hBlockData[n]->hStereoMdct = NULL; + } + + free( hMCT->hBlockData[n] ); + hMCT->hBlockData[n] = NULL; + } } /*-----------------------------------------------------------------* - * Initializations - *-----------------------------------------------------------------*/ + * Initializations + *-----------------------------------------------------------------*/ - hMCT->currBlockDataCnt = 0; + IF ( b_nchan_change ) + { + hMCT->currBlockDataCnt = 0; + move16(); - /*Initialize bits required to signal channel-pair index*/ - // hMCT->bitsChannelPairIndex = max( 1, (Word16) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); - hMCT->bitsChannelPairIndex = s_max( 1, floor_log_2( (Word32) hMCT->nchan_out_woLFE * ( (Word32) hMCT->nchan_out_woLFE - 1 ) / 2 - 1 )+ 1 ); + /*Initialize bits required to signal channel-pair index*/ - set16_fx( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); - set16_fx( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); + Word32 log_tmp; + L_tmp = L_sub( L_shr( L_mult0( hMCT->nchan_out_woLFE, sub(hMCT->nchan_out_woLFE, 1) ), 1 ), 1 ); + tmp_exp = norm_l(L_tmp); + L_tmp = L_shl(L_tmp, tmp_exp); + log_tmp = BASOP_Util_Log2(L_tmp); // ( 31 - tmp_exp ) + log_tmp = L_add(log_tmp, L_shl((Q31 - tmp_exp), Q25)); // Q25 + // scale down from Q25 to Q0 - st_ivas->hMCT = hMCT; + tmp = extract_l(L_shr(log_tmp, Q25)); + tmp = add(tmp, 1); + hMCT->bitsChannelPairIndex = s_max(1, tmp); + + set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); + set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); + } return IVAS_ERR_OK; } -#endif // IVAS_FLOAT_FIXED - -ivas_error create_mct_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +#else +ivas_error mct_dec_reconfigure( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t b_nchan_change /* i : flag indicating different channel count */ ) { MCT_DEC_HANDLE hMCT; - int16_t n; + Decoder_State *st; + int16_t n, cpe_id, max_blocks; int32_t cp_bitrate; - int16_t max_blocks; - int16_t cpe_id; - /*--------------------------------------------------------- --------* - * Allocate MCT handle + hMCT = st_ivas->hMCT; + + /*-----------------------------------------------------------------* + * Allocate and initialize MCT BlockData handles *-----------------------------------------------------------------*/ - if ( ( hMCT = (MCT_DEC_HANDLE) malloc( sizeof( MCT_DEC_DATA ) ) ) == NULL ) + if ( b_nchan_change ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CPE\n" ) ); + /* Determine active channels */ + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + hMCT->nchan_out_woLFE += st_ivas->nchan_ism; + } + } + else if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + } + else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + } + else + { + assert( !"IVAS format currently not supported for MCT" ); + } + } + + /* indicate LFE for appropriate core-coder channel */ + 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]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; + } + } + + /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ + if ( hMCT->nchan_out_woLFE % 2 ) + { + st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + } + + cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; + } + + /* set correct nominal bitrates and igf config already here, otherwise we + * run into a number of problems */ + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + st_ivas->hCPE[cpe_id]->element_brate = cp_bitrate; + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st = st_ivas->hCPE[cpe_id]->hCoreCoder[n]; + + st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; + + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + { + st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); + if ( st->igf ) + { + IGFDecSetMode_flt( st->hIGFDec, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, -1, -1, st->rf_flag ); + } + } + } + } + + /*Initialize MCT block data */ + max_blocks = hMCT->nchan_out_woLFE / CPE_CHANNELS; + + for ( n = 0; n < max_blocks; n++ ) + { + if ( b_nchan_change ) + { + if ( hMCT->hBlockData[n] == NULL ) + { + if ( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_BLOCK_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); + } + + /*Initialize all parameters to zero*/ + hMCT->hBlockData[n]->ch1 = 0; + hMCT->hBlockData[n]->ch2 = 0; + + /* MDCT stereo initialization */ + if ( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); + } + } + } + + initMdctStereoDecData( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, st_ivas->hCPE[0]->hCoreCoder[0]->bwidth ); + hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; + } + + for ( ; n < MCT_MAX_BLOCKS; n++ ) + { + /* deallocate no longer needed blocks */ + if ( hMCT->hBlockData[n] != NULL ) + { + if ( hMCT->hBlockData[n]->hStereoMdct != NULL ) + { + free( hMCT->hBlockData[n]->hStereoMdct ); + hMCT->hBlockData[n]->hStereoMdct = NULL; + } + + free( hMCT->hBlockData[n] ); + hMCT->hBlockData[n] = NULL; + } + } + + /*-----------------------------------------------------------------* + * Initializations + *-----------------------------------------------------------------*/ + + if ( b_nchan_change ) + { + hMCT->currBlockDataCnt = 0; + + /*Initialize bits required to signal channel-pair index*/ + hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); + + set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); + set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); + } + + return IVAS_ERR_OK; +} +#endif + + +/*------------------------------------------------------------------------- + * create_mct_dec_close() + * + * Close IVAS decoder MCT handle + *-------------------------------------------------------------------------*/ + +void ivas_mct_dec_close( + MCT_DEC_HANDLE *hMCT /* i/o: MCT decoder structure */ +) +#ifdef IVAS_FLOAT_FIXED +{ + Word16 n, maxBlocks; + + IF ( hMCT == NULL || *hMCT == NULL ) + { + return; + } + + maxBlocks = shr( ( *hMCT )->nchan_out_woLFE, 1 ); + + FOR ( n = 0; n < maxBlocks; n++ ) + { + IF ( ( *hMCT )->hBlockData[n] != NULL ) + { + IF ( ( *hMCT )->hBlockData[n]->hStereoMdct != NULL ) + { + free( ( *hMCT )->hBlockData[n]->hStereoMdct ); + ( *hMCT )->hBlockData[n]->hStereoMdct = NULL; + } + + free( ( *hMCT )->hBlockData[n] ); + ( *hMCT )->hBlockData[n] = NULL; + } + } + + free( *hMCT ); + *hMCT = NULL; + + return; +} +#else +{ + Word16 n, maxBlocks; + + IF ( hMCT == NULL || *hMCT == NULL ) + { + return; + } + + maxBlocks = ( *hMCT )->nchan_out_woLFE / 2; + + FOR ( n = 0; n < maxBlocks; n++ ) + { + IF ( ( *hMCT )->hBlockData[n] != NULL ) + { + IF ( ( *hMCT )->hBlockData[n]->hStereoMdct != NULL ) + { + free( ( *hMCT )->hBlockData[n]->hStereoMdct ); + ( *hMCT )->hBlockData[n]->hStereoMdct = NULL; + } + + free( ( *hMCT )->hBlockData[n] ); + ( *hMCT )->hBlockData[n] = NULL; + } + } + + free( *hMCT ); + *hMCT = NULL; + + return; +} +#endif + + +/*------------------------------------------------------------------------- + * ivas_mc_dec_config() + * + * - read transported MC LS setup + * - select MC format mode + * - reconfigure the MC format decoder + *-------------------------------------------------------------------------*/ + +/*! r : MC format mode */ +ivas_error ivas_mc_dec_config( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t idx, /* i : LS config. index */ + uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ + int16_t *data /* o : output synthesis signal */ +) +{ + AUDIO_CONFIG signaled_config; + MC_MODE last_mc_mode; + ivas_error error; + + /* store last frame MC mode */ + last_mc_mode = st_ivas->mc_mode; + + if ( !st_ivas->bfi ) + { + /* set transported MC LS setup */ + signaled_config = ivas_mc_map_ls_setup_to_output_config( idx ); + + if ( st_ivas->ini_frame == 0 ) + { + st_ivas->transport_config = signaled_config; + } + + /* select MC format mode */ + st_ivas->mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); + + /* MC format switching */ + if ( st_ivas->ini_frame != 0 ) + { + if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) + { +#ifdef IVAS_FLOAT_FIXED +#if 1 /*TODO: To be removed(Float to fixed conversion)*/ + DECODER_TC_BUFFER_HANDLE hTcBuffer; + hTcBuffer = st_ivas->hTcBuffer; + IF( st_ivas->hCombinedOrientationData ) + FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) + { + FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) + { + st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); + } + } + SPAR_DEC_HANDLE hSpar; + hSpar = st_ivas->hSpar; + Word16 nchan_transport_old = st_ivas->nchan_transport; + uint16_t nchan_internal; + Word32 ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + DECODER_CONFIG_HANDLE hDecoderConfig; + hDecoderConfig = st_ivas->hDecoderConfig; + + Word16 n_tc; + n_tc = st_ivas->hTcBuffer->nchan_transport_internal; + for ( int ch = 0; ch < n_tc; ch++ ) + { + floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); + } + Word16 cx_e = 0, cy_e = 0, mmo_e = 0, mmro_e = 0; + PARAM_MC_DEC_HANDLE hParamMC; + hParamMC = st_ivas->hParamMC; + Word16 nchan_out_transport, nchan_out_cov; + MC_LS_SETUP mc_ls_setup; + Word16 nchan_transport; + if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + if ( st_ivas->hParamMC ) + { + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else + { + nchan_out_cov = nchan_out_transport; + } + floatToFixed_arr( hParamMC->icc_q, hParamMC->icc_q_fx, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); + floatToFixed_arr( hParamMC->icld_q, hParamMC->icld_q_fx, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + Word32 max_cx_old_fx, max_cy_old_fx, max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; + float max_cx_old = hParamMC->h_output_synthesis_cov_state.cx_old[0][0], max_cy_old = hParamMC->h_output_synthesis_cov_state.cy_old[0][0], max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; + for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + { + for ( int j = 0; j < nchan_transport_old * nchan_transport_old; j++ ) + max_cx_old = max( max_cx_old, hParamMC->h_output_synthesis_cov_state.cx_old[i][j] ); + for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) + max_cy_old = max( max_cy_old, hParamMC->h_output_synthesis_cov_state.cy_old[i][j] ); + for ( int j = 0; j < nchan_transport_old * nchan_out_cov; j++ ) + max_mix_matrix_old = max( max_mix_matrix_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i][j] ); + } + } + IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) + floatToFixed_arr32( st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) ); + for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) + { + for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) + max_mix_matrix_res_old = max( max_mix_matrix_res_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i][j] ); + } + } + f2me( max_cx_old, &max_cx_old_fx, &cx_e ); + f2me( max_cy_old, &max_cy_old_fx, &cy_e ); + f2me( max_mix_matrix_old, &max_mix_matrix_old_fx, &mmo_e ); + f2me( max_mix_matrix_res_old, &max_mix_matrix_res_old_fx, &mmro_e ); + if ( mmo_e < 0 ) + mmo_e = 0; + if ( mmro_e < 0 ) + mmro_e = 0; + for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + { + + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); + } + } + for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) + { + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); + } + } + floatToFixed_arrL( hParamMC->proto_matrix_int, hParamMC->proto_matrix_int_fx, Q31, nchan_out_transport * nchan_transport ); + FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + if ( hParamMC->diff_proto_info ) + floatToFixed_arrL( hParamMC->diff_proto_info->proto_fac[i], hParamMC->diff_proto_info->proto_fac_fx[i], Q26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); + } + } + } +#endif + if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1 + if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + PARAM_MC_DEC_HANDLE hParamMC; + hParamMC = st_ivas->hParamMC; + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); + nchan_transport = st_ivas->nchan_transport; + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else + { + nchan_out_cov = nchan_out_transport; + } + if ( hParamMC ) + { + if ( st_ivas->hLsSetUpConversion ) + { + for ( Word16 k = 0; k < nchan_transport; k++ ) + { + for ( int16_t i = 0; i < nchan_out_cov; i++ ) + { + st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); + } + } + } + fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); + fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); + IF( hParamMC->diff_proto_info ) + FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + + fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); + } + fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); + IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) + fixedToFloat_arrL( st_ivas->hParamMC->ls_conv_dmx_matrix_fx, st_ivas->hParamMC->ls_conv_dmx_matrix, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) ); + if ( last_mc_mode == MC_MODE_PARAMMC ) + { + for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + { + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); + } + } + for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) + { + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); + } + } + } + } + } +#endif +#else + if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif // IVAS_FLOAT_FIXED + } + } + + st_ivas->transport_config = signaled_config; } - /*-----------------------------------------------------------------* - * Allocate MCT BlockData handles - *-----------------------------------------------------------------*/ + return IVAS_ERR_OK; +} + + +/*------------------------------------------------------------------------- + * ivas_mc_dec_reconfig() + * + * reconfigure the MC format decoder + *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_mc_dec_reconfig( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + UWord16 *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ + Word16 *data /* o : output synthesis signal */ +) +{ + Word16 nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; + Word16 numCldfbAnalyses_old, numCldfbSyntheses_old; + Word32 new_brate_SCE, new_brate_CPE, ivas_total_brate; + RENDERER_TYPE renderer_type_old; + Decoder_State *st; + ivas_error error; + MC_MODE mc_mode, last_mc_mode; + TC_BUFFER_MODE tc_buffer_mode_new; + Word16 tc_nchan_tc_new; + Word16 tc_nchan_allocate_new; + Word16 tc_granularity_new; + AUDIO_CONFIG intern_config_old; + IVAS_OUTPUT_SETUP hIntSetupOld; + Word16 nchan_out_buff_old, nchan_out_buff; + + error = IVAS_ERR_OK; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + nchan_transport_old = st_ivas->nchan_transport; + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ + + /* temporally set the current mc_mode back to the previous one to make sure the following call to + ivas_init_dec_get_num_cldfb_instances() returns the correct counts */ + mc_mode = st_ivas->mc_mode; + st_ivas->mc_mode = last_mc_mode; + ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + + st_ivas->mc_mode = mc_mode; - /* Determine active channels */ - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - hMCT->nchan_out_woLFE += st_ivas->nchan_ism; - } - } - else if ( st_ivas->mc_mode == MC_MODE_MCT ) - { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; - } - else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + nSCE_old = st_ivas->nSCE; + nCPE_old = st_ivas->nCPE; + sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag; + + /* special handling needed for the hp20 buffers for McMASA */ + IF ( EQ_16(last_mc_mode , MC_MODE_MCMASA) ) { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + nchan_hp20_old = getNumChanSynthesis( st_ivas ); } - else + ELSE { - assert( !"IVAS format currently not supported for MCT" ); + nchan_hp20_old = nchan_transport_old; } + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); - cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; + /* save old IntSetup, might be needed for JBM flushing...*/ + intern_config_old = st_ivas->intern_config; + hIntSetupOld = st_ivas->hIntSetup; + tc_granularity_new = 1; - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; - } + /* renderer might have changed, reselect */ + renderer_type_old = st_ivas->renderer_type; + ivas_renderer_select( st_ivas ); - /* indicate LFE for appropriate core-coder channel */ - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + /* side effect of the renderer selection can be a changed internal config */ + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + + /* transfer subframe info from DirAC or ParamMC to central tc buffer */ + IF ( EQ_16(last_mc_mode , MC_MODE_PARAMMC) ) { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - } + st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hParamMC->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hParamMC->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; + Copy( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - - /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( hMCT->nchan_out_woLFE % 2 ) + ELSE IF ( EQ_16(last_mc_mode , MC_MODE_MCMASA) && st_ivas->hSpatParamRendCom != NULL ) { - st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - /*Initialize MCT block data */ - max_blocks = hMCT->nchan_out_woLFE / 2; - - for ( n = 0; n < max_blocks; n++ ) + /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv + render what still fits in the new granularity */ + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); + IF ( LT_16(tc_granularity_new , st_ivas->hTcBuffer->n_samples_granularity) ) { - if ( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_DEC_BLOCK_DATA ) ) ) == NULL ) + IF ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); + return error; } - - /*Initialize all parameters to zero*/ - hMCT->hBlockData[n]->ch1 = 0; - hMCT->hBlockData[n]->ch2 = 0; - - /*-----------------------------------------------------------------* - * MDCT stereo initialization - *-----------------------------------------------------------------*/ - - if ( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_DEC_DATA ) ) ) == NULL ) + } + /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ + ELSE IF ( GT_16(tc_granularity_new , st_ivas->hTcBuffer->n_samples_granularity) ) + { + IF ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); + return error; } - -#ifndef IVAS_FLOAT_FIXED - initMdctStereoDecData( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, SWB ); -#else - initMdctStereoDecData_fx( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, SWB ); -#endif - hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; - hMCT->hBlockData[n]->hStereoMdct->reverse_dmx = 0; -#ifndef IVAS_FLOAT_FIXED - hMCT->hBlockData[n]->hStereoMdct->smooth_ratio = 1.f; -#else - hMCT->hBlockData[n]->hStereoMdct->smooth_ratio_fx = ONE_IN_Q26; -#endif } - for ( ; n < MCT_MAX_BLOCKS; n++ ) + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) { - hMCT->hBlockData[n] = NULL; - } - - /*-----------------------------------------------------------------* - * Initializations - *-----------------------------------------------------------------*/ - - hMCT->currBlockDataCnt = 0; - - /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); - - set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); - set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); - - st_ivas->hMCT = hMCT; + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); + st_ivas->nSCE = 0; + st_ivas->nCPE = st_ivas->nchan_transport / 2; - return IVAS_ERR_OK; -} + IF ( NE_16(last_mc_mode , MC_MODE_MCT) ) + { + /*De-allocate handles for other MC modes*/ + IF ( st_ivas->hParamMC != NULL ) + { + ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); + /* remove ls conversion if it was allocated by ParamMC */ + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } -/*------------------------------------------------------------------------- - * mct_dec_reconfigure() - * - * Reconfigure IVAS decoder MCT handle - *-------------------------------------------------------------------------*/ + IF ( EQ_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) + { + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); + ivas_ls_setup_conversion_close_fx( &( st_ivas->hLsSetUpConversion ) ); + } -#ifdef IVAS_FLOAT_FIXED -ivas_error mct_dec_reconfigure_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const UWord16 b_nchan_change /* i : flag indicating different channel count */ -) -{ - MCT_DEC_HANDLE hMCT; - Decoder_State *st; - Word16 n, cpe_id, max_blocks; - Word32 cp_bitrate, L_tmp; - Word16 tmp_exp, tmp; + /* De-allocate McMasa-related handles */ + ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); - hMCT = st_ivas->hMCT; + ivas_qmetadata_close( &st_ivas->hQMetaData ); + IF ( st_ivas->hDirAC != NULL ) + { + ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); + vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); + } - /*-----------------------------------------------------------------* - * Allocate and initialize MCT BlockData handles - *-----------------------------------------------------------------*/ - IF ( b_nchan_change ) - { - /* Determine active channels */ - test(); test(); test(); test(); - IF ( ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - move16(); - IF ( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) + /* init LS conversion if the renderer type asks for it */ + IF ( EQ_16(st_ivas->renderer_type , RENDERER_MC) && st_ivas->hLsSetUpConversion == NULL ) { - hMCT->nchan_out_woLFE = add( hMCT->nchan_out_woLFE, st_ivas->nchan_ism ); + if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } } - ELSE IF ( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) ) - { - hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe ); - } - ELSE IF ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) - { - hMCT->nchan_out_woLFE = sub( st_ivas->nchan_transport, st_ivas->hTransSetup.num_lfe ); - } - ELSE - { - assert( !"IVAS format currently not supported for MCT" ); - } } - - /* indicate LFE for appropriate core-coder channel */ - FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) { - FOR ( n = 0; n < CPE_CHANNELS; n++ ) + st_ivas->nSCE = 0; + st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + + IF ( NE_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - } - } + /*De-allocate handles for other MC modes*/ + IF ( st_ivas->hParamMC != NULL ) + { + ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); - /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - IF ( hMCT->nchan_out_woLFE % 2 ) - { - st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - } + /* remove ls conversion if it was allocated by ParamMC */ + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } - tmp = BASOP_Util_Divide3216_Scale(st_ivas->hDecoderConfig->ivas_total_brate, hMCT->nchan_out_woLFE, &tmp_exp ); - cp_bitrate = L_shl( tmp, tmp_exp + 2 ); + ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); - IF ( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - tmp = BASOP_Util_Divide3216_Scale(st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, &tmp_exp); - cp_bitrate = L_shl(tmp, tmp_exp + 2); - } + /* init LS conversion if the renderer type asks for it */ + IF ( ( EQ_16(st_ivas->renderer_type , RENDERER_MC) ) && st_ivas->hLsSetUpConversion == NULL ) + { + IF ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } - /* set correct nominal bitrates and igf config already here, otherwise we - * run into a number of problems */ - FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + IF ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) ) { - st_ivas->hCPE[cpe_id]->element_brate = cp_bitrate; - move32(); - FOR ( n = 0; n < CPE_CHANNELS; n++ ) + IF ( NE_16(last_mc_mode , MC_MODE_PARAMMC) ) { - st = st_ivas->hCPE[cpe_id]->hCoreCoder[n]; - - st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - move32(); + /* remove old ls conversion for MCT if open, gets reopened correctly within ivas_param_mc_dec_open when needed */ + IF ( EQ_16(renderer_type_old , RENDERER_MC) && st_ivas->hLsSetUpConversion != NULL ) + { + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } - IF ( NE_32( st->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) ) + IF ( ( error = ivas_param_mc_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { - tmp = BASOP_Util_Divide3232_Scale( st_ivas->hCPE[cpe_id]->element_brate, FRAMES_PER_SEC, &tmp_exp ); - st->bits_frame_nominal = shr( tmp, 15 - tmp_exp ); - st->igf = getIgfPresent_fx(st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag); // no floating point so directly pluggable + return error; + } - IF(st->igf) - { - IGFDecSetMode_ivas_fx(st->hIGFDec, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, -1, -1, st->rf_flag); - } + } + ELSE + { + IF ( ( error = ivas_param_mc_dec_reconfig_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; } } - } - /*Initialize MCT block data */ - tmp = BASOP_Util_Divide1616_Scale(hMCT->nchan_out_woLFE, CPE_CHANNELS, &tmp_exp); - max_blocks = shr( tmp, 15 - tmp_exp ); + /* De-allocate McMasa-related handles */ + ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); + + IF ( st_ivas->hDirAC != NULL ) + { + ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); + vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); + } - FOR ( n = 0; n < max_blocks; n++ ) - { - IF ( b_nchan_change ) + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) ) { - IF ( hMCT->hBlockData[n] == NULL ) + IF ( st_ivas->hMCT != NULL && LE_16(st_ivas->nchan_transport , CPE_CHANNELS) ) { - IF ( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_BLOCK_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); - } - - /*Initialize all parameters to zero*/ - hMCT->hBlockData[n]->ch1 = 0; - move16(); - hMCT->hBlockData[n]->ch2 = 0; - move16(); - - /* MDCT stereo initialization */ - IF ( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); - } + ivas_mct_dec_close( &st_ivas->hMCT ); } } + ELSE IF ( EQ_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) + { + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); + } - initMdctStereoDecData_fx( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, st_ivas->hCPE[0]->hCoreCoder[0]->bwidth ); - - hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; - move16(); + /* LFE handle */ + ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); } - - FOR ( ; n < MCT_MAX_BLOCKS; n++ ) + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) { - /* deallocate no longer needed blocks */ - IF ( hMCT->hBlockData[n] != NULL ) + ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); + + IF ( NE_16(last_mc_mode , MC_MODE_MCMASA) ) { - IF ( hMCT->hBlockData[n]->hStereoMdct != NULL ) + IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { - free( hMCT->hBlockData[n]->hStereoMdct ); - hMCT->hBlockData[n]->hStereoMdct = NULL; + return error; } - - free( hMCT->hBlockData[n] ); - hMCT->hBlockData[n] = NULL; } - } - /*-----------------------------------------------------------------* - * Initializations - *-----------------------------------------------------------------*/ + IF ( ( error = ivas_mcmasa_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } - IF ( b_nchan_change ) - { - hMCT->currBlockDataCnt = 0; - move16(); + /* LS conversion */ + IF ( st_ivas->hLsSetUpConversion != NULL ) + { + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } - /*Initialize bits required to signal channel-pair index*/ + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); - Word32 log_tmp; - L_tmp = L_sub( L_shr( L_mult0( hMCT->nchan_out_woLFE, sub(hMCT->nchan_out_woLFE, 1) ), 1 ), 1 ); - tmp_exp = norm_l(L_tmp); - L_tmp = L_shl(L_tmp, tmp_exp); - log_tmp = BASOP_Util_Log2(L_tmp); // ( 31 - tmp_exp ) - log_tmp = L_add(log_tmp, L_shl((Q31 - tmp_exp), Q25)); // Q25 - // scale down from Q25 to Q0 + IF ( st_ivas->hParamMC != NULL ) + { + ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); + st_ivas->hParamMC = NULL; + } - tmp = extract_l(L_shr(log_tmp, Q25)); - tmp = add(tmp, 1); - hMCT->bitsChannelPairIndex = s_max(1, tmp); + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) ) + { + ivas_mct_dec_close( &st_ivas->hMCT ); + } - set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); - set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); + /* LFE handle */ + ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); } - return IVAS_ERR_OK; -} -#else -ivas_error mct_dec_reconfigure( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const uint16_t b_nchan_change /* i : flag indicating different channel count */ -) -{ - MCT_DEC_HANDLE hMCT; - Decoder_State *st; - int16_t n, cpe_id, max_blocks; - int32_t cp_bitrate; - - hMCT = st_ivas->hMCT; + IF ( NE_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) + { + IF ( EQ_16(st_ivas->nchan_transport , 1) ) + { + st_ivas->element_mode_init = IVAS_SCE; + } + ELSE + { + st_ivas->element_mode_init = IVAS_CPE_MDCT; + } + } /*-----------------------------------------------------------------* - * Allocate and initialize MCT BlockData handles + * Reconfigure core coder *-----------------------------------------------------------------*/ - if ( b_nchan_change ) + /* special case: MCT->ParamMC with more than 2 TC, CPE 1 stays, but has the wrong mct_chan_mode in channel 1 + and might have IGF static memory not allocated and the bit stream index list not set, + set correct mct_chan_mode and init missing static mem (IGF, HQ) and some config (TNS) do it here since it is _very_ MC specific */ + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && GT_16(st_ivas->nchan_transport , CPE_CHANNELS) ) { - /* Determine active channels */ - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + st = st_ivas->hCPE[1]->hCoreCoder[1]; + + IF ( st_ivas->nchan_transport == 3 ) { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - hMCT->nchan_out_woLFE += st_ivas->nchan_ism; - } + st->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } - else if ( st_ivas->mc_mode == MC_MODE_MCT ) + ELSE { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } - else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + + IF ( st->hIGFDec == NULL ) { - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; + IF ( ( st->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for IGF\n" ) ); + } + + st->igf = 0; + init_igf_dec( st->hIGFDec ); +#if 1 /*TODO: To be removed later(floating point initialization)*/ +#if ( defined EVS_FLOAT ) || !( defined IVAS_FLOAT_FIXED ) + st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; + st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; + set_f( st->hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX ); +#endif + FOR( Word16 l = 0; l < IGF_START_MX; l++ ) + st->hIGFDec->infoTCXNoiseBuf[l] = (uint8_t) st->hIGFDec->infoTCXNoise_evs[l]; +#endif } - else + + IF ( st->hHQ_core == NULL ) { - assert( !"IVAS format currently not supported for MCT" ); + IF ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) ); + } + + /* HQ core initialization */ +#if 1/*TODO: To be removed later*/ + HQ_core_dec_init_flt( st->hHQ_core ); +#endif + HQ_core_dec_init_fx( st->hHQ_core ); } - } - /* indicate LFE for appropriate core-coder channel */ - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) + /* check if we have a doubly used hTxcCfg, if so, allocate a distint one for the old MCT LFE channel */ + IF ( st->hTcxCfg == st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg ) { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; + IF ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) ); + } } - } - /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( hMCT->nchan_out_woLFE % 2 ) + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode ); + } + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) { - st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + uint8_t separateChannelEnabled; + int16_t separateChannelIndex; + ivas_mcmasa_set_separate_channel_mode_fx( &separateChannelEnabled, &separateChannelIndex, ivas_total_brate ); + ivas_mcmasa_split_brate_fx( separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); } - - cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) { - cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; + new_brate_SCE = 0; + new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; } - - /* set correct nominal bitrates and igf config already here, otherwise we - * run into a number of problems */ - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) { - st_ivas->hCPE[cpe_id]->element_brate = cp_bitrate; - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st = st_ivas->hCPE[cpe_id]->hCoreCoder[n]; - - st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - - if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); - if ( st->igf ) - { - IGFDecSetMode_flt( st->hIGFDec, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, -1, -1, st->rf_flag ); - } - } - } + new_brate_SCE = 0; + new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; + } + ELSE + { + new_brate_SCE = 0; /* ivas_total_brate / st_ivas->nchan_transport;*/ + new_brate_CPE = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; } - /*Initialize MCT block data */ - max_blocks = hMCT->nchan_out_woLFE / CPE_CHANNELS; - - for ( n = 0; n < max_blocks; n++ ) + IF( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE ) ) != IVAS_ERR_OK ) { - if ( b_nchan_change ) + return error; + } + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && GT_16(st_ivas->nchan_transport , CPE_CHANNELS) ) + { + st = st_ivas->hCPE[1]->hCoreCoder[1]; + + /* TCX-LTP */ + IF ( st->hTcxLtpDec == NULL ) { - if ( hMCT->hBlockData[n] == NULL ) + IF ( ( st->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) { - if ( ( hMCT->hBlockData[n] = (MCT_DEC_BLOCK_DATA_HANDLE) malloc( sizeof( MCT_BLOCK_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MCT block data structure\n" ) ); - } - - /*Initialize all parameters to zero*/ - hMCT->hBlockData[n]->ch1 = 0; - hMCT->hBlockData[n]->ch2 = 0; - - /* MDCT stereo initialization */ - if ( ( hMCT->hBlockData[n]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } + tcxltp_dec_init_fx( st->hTcxLtpDec, 0, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core ); } + } - initMdctStereoDecData( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, st_ivas->hCPE[0]->hCoreCoder[0]->bwidth ); - hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; + /*-----------------------------------------------------------------* + * re-configure HP20 memories + *-----------------------------------------------------------------*/ + IF ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1/*TODO: To be removed later*/ + /*To be removed later: Contains memory allocations for floating point buffers*/ + IF ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; } +#endif + /*-----------------------------------------------------------------* + * Allocate the LFE handle that is coded separately after the allocation of the core coders + *-----------------------------------------------------------------*/ - for ( ; n < MCT_MAX_BLOCKS; n++ ) + IF ( ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) || EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) && st_ivas->hLFE == NULL ) { - /* deallocate no longer needed blocks */ - if ( hMCT->hBlockData[n] != NULL ) + Word32 binauralization_delay_ns = st_ivas->binaural_latency_ns; + IF ( st_ivas->hBinRenderer != NULL ) { - if ( hMCT->hBlockData[n]->hStereoMdct != NULL ) + IF ( st_ivas->hBinRenderer->render_lfe ) { - free( hMCT->hBlockData[n]->hStereoMdct ); - hMCT->hBlockData[n]->hStereoMdct = NULL; + /* Account for filterbank delay */ + binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS; + } + else + { + binauralization_delay_ns = 0; } + } - free( hMCT->hBlockData[n] ); - hMCT->hBlockData[n] = NULL; + IF( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) + { + return error; } + + set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); + set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); } /*-----------------------------------------------------------------* - * Initializations + * Reconfigure renderers *-----------------------------------------------------------------*/ - if ( b_nchan_change ) + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) { - hMCT->currBlockDataCnt = 0; - - /*Initialize bits required to signal channel-pair index*/ - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); - - set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); - set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); + IF ( ( NE_16(st_ivas->renderer_type , RENDERER_DISABLE) ) && ( NE_16(st_ivas->renderer_type , RENDERER_MCMASA_MONO_STEREO) ) ) + { + IF ( st_ivas->hDirAC != NULL ) + { + /* reconfigure existing DirAC dec */ + IF ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + /* init a new DirAC dec */ + IF ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + ELSE IF ( EQ_16(st_ivas->renderer_type , RENDERER_DISABLE) && st_ivas->hDirAC != NULL ) + { + ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); + vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); + } } - return IVAS_ERR_OK; -} -#endif - - -/*------------------------------------------------------------------------- - * create_mct_dec_close() - * - * Close IVAS decoder MCT handle - *-------------------------------------------------------------------------*/ - -void ivas_mct_dec_close( - MCT_DEC_HANDLE *hMCT /* i/o: MCT decoder structure */ -) -#ifdef IVAS_FLOAT_FIXED -{ - Word16 n, maxBlocks; - - IF ( hMCT == NULL || *hMCT == NULL ) + IF ( NE_16(renderer_type_old , st_ivas->renderer_type) ) { - return; - } + AUDIO_CONFIG output_config; - maxBlocks = shr( ( *hMCT )->nchan_out_woLFE, 1 ); + output_config = st_ivas->hDecoderConfig->output_config; - FOR ( n = 0; n < maxBlocks; n++ ) - { - IF ( ( *hMCT )->hBlockData[n] != NULL ) + /* binaural renderers*/ + IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL) || EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) || EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) { - IF ( ( *hMCT )->hBlockData[n]->hStereoMdct != NULL ) + /* remove unneeded binaural renderers */ + IF ( st_ivas->hBinRenderer != NULL && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) { - free( ( *hMCT )->hBlockData[n]->hStereoMdct ); - ( *hMCT )->hBlockData[n]->hStereoMdct = NULL; + ivas_binRenderer_close( &st_ivas->hBinRenderer ); } - free( ( *hMCT )->hBlockData[n] ); - ( *hMCT )->hBlockData[n] = NULL; - } - } - - free( *hMCT ); - *hMCT = NULL; + IF ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV_ROOM) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) || NE_16(st_ivas->hIntSetup.output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) ) ) + { - return; -} -#else -{ - Word16 n, maxBlocks; + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); + } - IF ( hMCT == NULL || *hMCT == NULL ) - { - return; - } + IF ( st_ivas->hBinRendererTd != NULL && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) ) ) + { + ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; + } - maxBlocks = ( *hMCT )->nchan_out_woLFE / 2; + IF ( st_ivas->hDiracDecBin != NULL ) + { + IF ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) && NE_16(st_ivas->renderer_type , RENDERER_STEREO_PARAMETRIC) ) + { + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + } + } - FOR ( n = 0; n < maxBlocks; n++ ) - { - IF ( ( *hMCT )->hBlockData[n] != NULL ) - { - IF ( ( *hMCT )->hBlockData[n]->hStereoMdct != NULL ) + /* init necessary new renderers */ + IF ( st_ivas->hBinRenderer == NULL && ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) { - free( ( *hMCT )->hBlockData[n]->hStereoMdct ); - ( *hMCT )->hBlockData[n]->hStereoMdct = NULL; + IF ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } + ELSE IF ( st_ivas->hBinRendererTd == NULL && EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) ) + { + IF( ( error = ivas_td_binaural_open_fx( st_ivas, st_ivas->hBinRendererTd->SrcInd, &st_ivas->hBinRendererTd->num_src ) ) != IVAS_ERR_OK ) + { + return error; + } + IF ( EQ_16(st_ivas->hIntSetup.output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) + { + IF ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); + } - free( ( *hMCT )->hBlockData[n] ); - ( *hMCT )->hBlockData[n] = NULL; + st_ivas->hCrendWrapper->hCrend = NULL; + st_ivas->hCrendWrapper->hHrtfCrend = NULL; + IF ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); + } + } + } + ELSE IF ( st_ivas->hCrendWrapper == NULL && ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV_ROOM) ) ) + { + IF ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; + } + } + /* mono/stereo */ + ELSE IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_MONO) || EQ_16(output_config , IVAS_AUDIO_CONFIG_STEREO) ) + { + /* nothing should happen here... */ + } + /* LS */ + ELSE IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1) || EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1_2) || EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1_4) || EQ_16(output_config , IVAS_AUDIO_CONFIG_7_1) || EQ_16(output_config , IVAS_AUDIO_CONFIG_7_1_4) || EQ_16(output_config , IVAS_AUDIO_CONFIG_LS_CUSTOM) ) + { } } + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ - free( *hMCT ); - *hMCT = NULL; - - return; -} -#endif - - -/*------------------------------------------------------------------------- - * ivas_mc_dec_config() - * - * - read transported MC LS setup - * - select MC format mode - * - reconfigure the MC format decoder - *-------------------------------------------------------------------------*/ - -/*! r : MC format mode */ -ivas_error ivas_mc_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t idx, /* i : LS config. index */ - uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ - int16_t *data /* o : output synthesis signal */ -) -{ - AUDIO_CONFIG signaled_config; - MC_MODE last_mc_mode; - ivas_error error; + IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ,Q11) ) != IVAS_ERR_OK ) + { + return error; + } - /* store last frame MC mode */ - last_mc_mode = st_ivas->mc_mode; + /*-----------------------------------------------------------------* + * JBM TC buffers + *-----------------------------------------------------------------*/ - if ( !st_ivas->bfi ) { - /* set transported MC LS setup */ - signaled_config = ivas_mc_map_ls_setup_to_output_config( idx ); + Word16 tc_nchan_full_new; + DECODER_TC_BUFFER_HANDLE hTcBuffer; - if ( st_ivas->ini_frame == 0 ) + hTcBuffer = st_ivas->hTcBuffer; + tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); + tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); + tc_nchan_allocate_new = tc_nchan_tc_new; + tc_nchan_full_new = tc_nchan_tc_new; + + IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(st_ivas->renderer_type , RENDERER_STEREO_PARAMETRIC) ) { - st_ivas->transport_config = signaled_config; + tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; + tc_nchan_full_new = tc_nchan_allocate_new; } - /* select MC format mode */ - st_ivas->mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); - - /* MC format switching */ - if ( st_ivas->ini_frame != 0 ) + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && NE_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) && NE_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) ) { - if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) + tc_nchan_full_new = 0; + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) + { + tc_nchan_allocate_new = MC_PARAMUPMIX_MAX_INPUT_CHANS; + tc_buffer_mode_new = TC_BUFFER_MODE_RENDERER; + IF ( EQ_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) || EQ_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) ) { - if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - - { - return error; - } + tc_buffer_mode_new = TC_BUFFER_MODE_BUFFER; + tc_nchan_tc_new = st_ivas->hDecoderConfig->nchan_out; + tc_nchan_allocate_new = tc_nchan_tc_new; } + tc_nchan_full_new = tc_nchan_allocate_new; } - st_ivas->transport_config = signaled_config; + /* reconfigure buffer */ + IF ( NE_16(hTcBuffer->tc_buffer_mode , tc_buffer_mode_new) || NE_16(hTcBuffer->nchan_transport_jbm , tc_nchan_tc_new) || + NE_16(hTcBuffer->nchan_buffer_full , tc_nchan_full_new) || NE_16(hTcBuffer->nchan_transport_internal , tc_nchan_allocate_new) || + NE_16(tc_granularity_new , hTcBuffer->n_samples_granularity) ) + { + IF ( ( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ + IF ( st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + ELSE IF ( st_ivas->hParamMC != NULL ) + { + st_ivas->hParamMC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hParamMC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hParamMC->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hParamMC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } } - return IVAS_ERR_OK; -} + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ -/*------------------------------------------------------------------------- - * ivas_mc_dec_reconfig() - * - * reconfigure the MC format decoder - *-------------------------------------------------------------------------*/ + nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); + + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1/*TODO: To be removed later*/ + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + return error; +} +#else static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -3046,3 +3455,4 @@ static ivas_error ivas_mc_dec_reconfig( return error; } +#endif // IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 3829a9213..ec9da41ac 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -903,6 +903,8 @@ void ivas_sba_mix_matrix_determiner_fx( } #endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED + void ivas_sba_mix_matrix_determiner( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ float *output[], /* i/o: transport/output audio channels */ @@ -1092,4 +1094,60 @@ void ivas_sba_mix_matrix_determiner( return; } +#else + +void ivas_sba_mix_matrix_determiner( + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + float *output[], /* i/o: transport/output audio channels */ + const int16_t bfi, /* i : BFI flag */ + const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ + const int16_t output_frame, /* i : output frame length */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix*/ +) +{ + int16_t i, ch; + float temp; + int16_t num_bands_out, nchan_transport, nchan_out; + + /* Convert numeric range */ + for (ch = 0; ch < nchan_remapped; ch++) + { + for (i = 0; i < output_frame; i++) + { + temp = output[ch][i]; + temp = floorf(temp + 0.5f); + + if (temp > MAX16B_FLT) + { + temp = MAX16B_FLT; + } + else if (temp < (-1.0f * PCM16_TO_FLT_FAC)) + { + temp = (-1.0f * PCM16_TO_FLT_FAC); + } + temp *= (1.0f / PCM16_TO_FLT_FAC); + output[ch][i] = temp; + } + } + + /* AGC */ + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + nchan_out = nchan_transport; + ivas_agc_dec_process(hSpar->hAgcDec, output, output, nchan_transport, output_frame); + + /* Convert numeric range back */ + for (ch = 0; ch < nchan_out; ch++) + { + for (i = 0; i < output_frame; i++) + { + output[ch][i] = output[ch][i] * PCM16_TO_FLT_FAC; + } + } + + /* Mixing matrix determiner */ + num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + ivas_spar_dec_gen_umx_mat(hSpar->hMdDec, nchan_transport, num_bands_out, bfi, num_md_sub_frames); + return; +} +#endif diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 2bd011811..695c72ec4 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -1208,7 +1208,7 @@ static void ivas_dec_mono_sba_handling( * * SPAR Meta Data decoder process *-----------------------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void ivas_spar_md_dec_process( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ @@ -1360,7 +1360,127 @@ void ivas_spar_md_dec_process( return; } +#else +void ivas_spar_md_dec_process( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ +) +{ + int16_t j, k, b, bw, dtx_vad, nB, i_ts; + ivas_spar_md_dec_state_t *hMdDec; + int16_t num_md_chs; + int16_t num_md_sub_frames; + int16_t dyn_active_w_flag; + int16_t active_w_vlbr; + + hMdDec = st_ivas->hSpar->hMdDec; + + active_w_vlbr = (st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4) ? 1 : 0; + + num_md_chs = ivas_sba_get_nchan_metadata(sba_order, st_ivas->hDecoderConfig->ivas_total_brate); + + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes(sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate); + + if (hMdDec->spar_md_cfg.nchan_transport > 1 && hMdDec->spar_md_cfg.nchan_transport <= 3) + { + hMdDec->spar_md.res_ind = 0; + dyn_active_w_flag = get_next_indice(st0, 1); + if (dyn_active_w_flag == 1) + { + if (hMdDec->spar_md_cfg.nchan_transport == 2) + { + hMdDec->spar_md.res_ind = get_next_indice(st0, 1); + hMdDec->spar_md.res_ind += hMdDec->spar_md_cfg.nchan_transport; + } + else if (hMdDec->spar_md_cfg.nchan_transport == 3) + { + hMdDec->spar_md.res_ind = remix_order_set[hMdDec->spar_md_cfg.remix_unmix_order][hMdDec->spar_md_cfg.nchan_transport]; + } + } + } + else + { + dyn_active_w_flag = 0; + if (hMdDec->spar_md_cfg.nchan_transport == FOA_CHANNELS) + { + get_next_indice(st0, 1); + } + } + + ivas_spar_dec_parse_md_bs(hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, + st_ivas->hQMetaData->sba_inactive_mode + ); + assert(nB == hMdDec->spar_md.num_bands); + assert(bw == 1); + ivas_spar_md_fill_invalid_bandcoeffs( + hMdDec->spar_md.band_coeffs, + hMdDec->band_coeffs_prev, + &hMdDec->valid_bands[0], + &hMdDec->base_band_coeffs_age[0], + &hMdDec->first_valid_frame, + nB); + + ivas_dec_mono_sba_handling(st_ivas); + + /* SPAR to DirAC conversion */ + if (hMdDec->spar_hoa_dirac2spar_md_flag == 1) + { + ivas_spar_to_dirac(st_ivas, hMdDec, dtx_vad, num_bands_out, bw, dyn_active_w_flag); + } + + /* set correct number of bands*/ + nB = IVAS_MAX_NUM_BANDS; + + /* expand DirAC MD to all time slots */ + for (i_ts = 1; i_ts < num_md_sub_frames; i_ts++) + { + for (b = 0; b < hMdDec->spar_md.num_bands; b++) + { + for (j = 0; j < IVAS_SPAR_MAX_CH - 1; j++) + { + hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re[j] = hMdDec->spar_md.band_coeffs[b].pred_re[j]; + } + + for (j = 0; j < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; j++) + { + for (k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++) + { + hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re[j][k] = hMdDec->spar_md.band_coeffs[b].C_re[j][k]; + } + } + + for (j = 0; j < IVAS_SPAR_MAX_CH - 1; j++) + { + hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re[j] = hMdDec->spar_md.band_coeffs[b].P_re[j]; + } + } + } + + ivas_get_spar_matrices(hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, num_md_chs, active_w_vlbr, dyn_active_w_flag); + +#ifdef DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS + { + static FILE *fid = 0; + int16_t band = 9; + if (!fid) + { + fid = fopen("pred_coeffs_dec.txt", "wt"); + } + fprintf(fid, "%.6f\n", hMdDec->mixer_mat[1][0][band]); + } +#endif + ivas_spar_md_fill_invalid_bands(&hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, num_md_chs, num_md_sub_frames); + + + hMdDec->dtx_md_smoothing_cntr = 1; + + return; +} + +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_spar_chk_zero_coefs() * diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index d930ea19a..c427203d2 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -3346,7 +3346,7 @@ void swb_tbe_dec( else { /* individual sqrt to avoid infinite (nan) value due to acelp_core_dec changes */ - scale = (float) (sqrt( curr_pow ) /sqrt( prev_pow )); + scale = (float)sqrt(curr_pow / prev_pow); } for ( i = 0; i < L_SHB_LAHEAD; i++ ) @@ -4744,12 +4744,13 @@ void TBEreset_dec( * * Initialize TD BWE state structure at the decoder *-------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void td_bwe_dec_init( TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ const int16_t extl, /* i : BWE extension layer */ const int32_t output_Fs /* i : output sampling rate */ ) + { int16_t i; @@ -4885,4 +4886,78 @@ void td_bwe_dec_init( #endif return; -} \ No newline at end of file +} + +#else + +void td_bwe_dec_init( + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + const int16_t extl, /* i : BWE extension layer */ + const int32_t output_Fs /* i : output sampling rate */ +) +{ + int16_t i; + + /* init. SHB buffers */; + set_f(hBWE_TD->old_bwe_exc, 0.0f, (PIT16k_MAX * 2)); + hBWE_TD->bwe_seed[0] = 23; /* 1; */ + hBWE_TD->bwe_seed[1] = 59; /* 10000; */ + set_f(hBWE_TD->old_bwe_exc_extended, 0.0f, NL_BUFF_OFFSET); + hBWE_TD->bwe_non_lin_prev_scale = 0; + + set_f(hBWE_TD->genSHBsynth_Hilbert_Mem, 0.0f, HILBERT_MEM_SIZE); + set_f(hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local, 0.0f, 2 * ALLPASSSECTIONS_STEEP); + + hBWE_TD->syn_dm_phase = 0; + hBWE_TD->prev_fbbwe_ratio = 1.0f; + hBWE_TD->prev_wb_bwe_frame_pow = 0.001f; + hBWE_TD->prev_swb_bwe_frame_pow = 0.001f; + + /* reset SHB buffers */ + ResetSHBbuffer_Dec(hBWE_TD, extl); + + if (output_Fs == 48000) + { + set_f(hBWE_TD->fbbwe_hpf_mem[0], 0, 4); + set_f(hBWE_TD->fbbwe_hpf_mem[1], 0, 4); + set_f(hBWE_TD->fbbwe_hpf_mem[2], 0, 4); + set_f(hBWE_TD->fbbwe_hpf_mem[3], 0, 4); + } + + set_f(hBWE_TD->mem_resamp_HB, 0, INTERP_3_1_MEM_LEN); + set_f(hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1); + + hBWE_TD->tilt_mem = 0.0f; + set_f(hBWE_TD->prev_lsf_diff, 0.5f, LPC_SHB_ORDER - 2); + hBWE_TD->prev_tilt_para = 0.0f; + set_f(hBWE_TD->cur_sub_Aq, 0.0f, M + 1); + set_f(hBWE_TD->int_3_over_2_tbemem_dec, 0.0f, INTERP_3_2_MEM_LEN); + + /* TD BWE post-processing */ + hBWE_TD->ptr_mem_stp_swb = hBWE_TD->mem_stp_swb + LPC_SHB_ORDER - 1; + set_f(hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER); + + for (i = 0; i < LPC_SHB_ORDER; i++) + { + hBWE_TD->swb_lsp_prev_interp[i] = (float)cos((float)i * EVS_PI / (float) 10.0f); + } + + hBWE_TD->prev1_shb_ener_sf = 1.0f; + hBWE_TD->prev2_shb_ener_sf = 1.0f; + hBWE_TD->prev3_shb_ener_sf = 1.0f; + hBWE_TD->prev_res_shb_gshape = 0.125f; + hBWE_TD->prev_mixFactors = 0.5f; + hBWE_TD->prev_GainShape = 0.0f; + set_f(hBWE_TD->fb_state_lpc_syn, 0, LPC_SHB_ORDER); + hBWE_TD->fb_tbe_demph = 0.0f; + + set_f(hBWE_TD->old_hb_synth, 0, L_FRAME48k); + + hBWE_TD->GainFrame_prevfrm = 0.0f; + + hBWE_TD->prev_ener = 0.0f; + + return; +} + +#endif \ No newline at end of file diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index ef7b6f36a..9dec7e9d4 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2960,6 +2960,12 @@ void ivas_rend_closeCrend( hCrend->lfe_delay_line = NULL; } + if ( hCrend->lfe_delay_line_fx != NULL ) + { + free( hCrend->lfe_delay_line_fx); + hCrend->lfe_delay_line_fx = NULL; + } + if ( hCrend->freq_buffer_re_diffuse != NULL ) { free( hCrend->freq_buffer_re_diffuse ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index f8e577f69..2ff4360b9 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1806,6 +1806,8 @@ typedef struct ivas_binaural_td_rendering_struct TDREND_SRC_t *Sources[MAX_NUM_TDREND_CHANNELS]; #ifdef IVAS_FLOAT_FIXED + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; Word16 Gain_fx; /* Q14 */ #endif // IVAS_FLOAT_FIXED -- GitLab From 34c3758855007534bea5d2db6345b89fe5bd1743 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 29 Apr 2024 13:41:15 +0530 Subject: [PATCH 004/101] revert mc_dec_reconfig changes and ivas_sba_linear_renderer integration --- lib_com/ivas_prot.h | 10 - lib_dec/ivas_corecoder_dec_reconfig.c | 4 +- lib_dec/ivas_jbm_dec.c | 21 +- lib_dec/ivas_mc_param_dec.c | 698 +-------------------- lib_dec/ivas_mct_dec.c | 839 +------------------------- lib_dec/ivas_stereo_dft_dec.c | 129 ++++ lib_rend/ivas_crend.c | 6 - lib_rend/ivas_stat_rend.h | 2 - 8 files changed, 174 insertions(+), 1535 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 7bf923004..ddaddc3e1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4630,11 +4630,6 @@ void ivas_param_mc_enc( float *data_f[], /* i/o: input/transport MC data */ const int16_t input_frame /* i : input frame length */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_param_mc_dec_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif // IVAS_FLOAT_FIXED ivas_error ivas_param_mc_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -4649,11 +4644,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( ivas_error ivas_param_mc_dec_reconfig( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_dec_close_fx( - PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ -); -#endif // IVAS_FLOAT_FIXED void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC /* i/o: Parametric MC decoder handle */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index c916a9dd9..67f65d1af 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -974,7 +974,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* resample CLDFB analysis instances */ FOR( i = 0; i < min( numCldfbAnalyses, numCldfbAnalyses_old ); i++ ) { - IF( NE_32( L_mult0( extract_l(L_mult0( st_ivas->cldfbAnaDec[i]->no_channels, st_ivas->cldfbAnaDec[i]->no_col )), FRAMES_PER_SEC ), hDecoderConfig->output_Fs ) ) + IF( EQ_32( L_mult0( extract_l(L_mult0( st_ivas->cldfbAnaDec[i]->no_channels, st_ivas->cldfbAnaDec[i]->no_col )), FRAMES_PER_SEC ), hDecoderConfig->output_Fs ) ) { resampleCldfb_ivas_fx( st_ivas->cldfbAnaDec[i], hDecoderConfig->output_Fs ); } @@ -1027,7 +1027,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( FOR( i = 0; i < st_ivas->cldfbAnaDec[0]->cldfb_state_length; i++ ) st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i], 16 ); // Scaling down from 27 to 11 FOR( i = 0; i < st_ivas->cldfbSynDec[0]->cldfb_state_length; i++ ) - st_ivas->cldfbSynDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbSynDec[0]->cldfb_state_fx[i], 21- 11); // Scaling down from 21 to 11 + st_ivas->cldfbSynDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbSynDec[0]->cldfb_state_fx[i], 21- Q_cldfbSynDec); // Scaling down from 21 to Q_cldfbSynDec } return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 3b06fadda..32aa6f4a4 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -3298,6 +3298,7 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hCPE[0]->element_brate = ivas_total_brate; } + /* core-decoding of transport channels */ if ( st_ivas->nSCE == 1 ) { @@ -5772,11 +5773,29 @@ ivas_error ivas_jbm_dec_render( { mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); } - +#ifdef IVAS_FLOAT_FIXED +#if 1//To Be removed + for ( n = 0; n < st_ivas->p_out_len; n++ ) + { + floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); + } +#endif + IF ( ( error = ivas_sba_linear_renderer_fx( p_output_fx, *nSamplesRendered, nchan_remapped, 0, output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1//To Be removed + for ( n = 0; n < st_ivas->p_out_len; n++ ) + { + fixedToFloat_arrL( p_output_fx[n], p_output[n], 11, 960 ); + } +#endif +#else if ( ( error = ivas_sba_linear_renderer( p_output, *nSamplesRendered, nchan_remapped, 0, output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) { return error; } +#endif } else if ( st_ivas->renderer_type == RENDERER_DIRAC ) { diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 4b28d4b99..09d03335f 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -79,7 +79,6 @@ typedef struct parameter_band_mapping_struct *-----------------------------------------------------------------------*/ static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); -static void ivas_param_mc_dec_init_fx( PARAM_MC_DEC_HANDLE hParamMC, const Word16 nchan_in, const Word16 nchan_out ); static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); #ifdef IVAS_FLOAT_FIXED @@ -132,7 +131,7 @@ static void ivas_param_mc_bs_decode_parameter_values( uint16_t bit_buffer[], int #ifdef IVAS_FLOAT_FIXED static void ivas_param_mc_bs_decode_parameter_values_fx(UWord16 bit_buffer[], Word16 *bit_pos, const Word16 max_bits, Word16 *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const Word16 map_size_wo_lfe, const Word16 map_size, const Word16 num_lfe_bands, const Word16 band_step, const Word16 num_param_bands, Word16 *value_buffer); static void ivas_param_mc_dequantize_cov_fx(PARAM_MC_DEC_HANDLE hParamMC, Word16 *ild_q_fx, Word16 *icc_q_fx, const Word16 param_band_index, const Word16 nY_cov, const PARAM_MC_SYNTHESIS_CONF synth_conf, const Word16 nY_int, const Word16 nX, Word32 *Cx_state_fx, Word16 Cx_state_e, Word32 *Cproto_fx, Word16 Cproto_e, Word32 *Cy_state_fx, Word16 *Cy_state_e); -static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, Word16 Q_proto_mtx); +static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info); static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Word32 *mixing_matrix[], Word16 *mixing_matrix_fx, Word32 *mixing_matrix_res[], Word16 *mixing_matrix_res_exp, const UWord16 nX, const UWord16 nY ); #endif @@ -141,452 +140,7 @@ static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Wo * * Open Parametric MC decoder handle *-------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_param_mc_dec_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - Word16 k, nchan_transport; - PARAM_MC_DEC_HANDLE hParamMC; -#ifndef FIX_901_PARAMMC_DEAD_CODE - IVAS_OUTPUT_SETUP hTransportSetup; -#endif - Word16 nchan_out_transport; - Word16 nchan_out_cov; - Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word32 proto_mtx_norm_fx; - Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; - Word16 max_param_band_residual; - UWord16 config_index; - MC_LS_SETUP mc_ls_setup; - AUDIO_CONFIG output_config; - Word32 output_Fs, ivas_total_brate; - ivas_error error; - - error = IVAS_ERR_OK; - - /*-----------------------------------------------------------------* - * prepare library opening - *-----------------------------------------------------------------*/ - - if ( ( hParamMC = (PARAM_MC_DEC_HANDLE) malloc( sizeof( PARAM_MC_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - - if ( ( hParamMC->hMetadataPMC = (HANDLE_IVAS_PARAM_MC_METADATA) malloc( sizeof( IVAS_PARAM_MC_METADATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC metadata \n" ) ); - } - - output_Fs = st_ivas->hDecoderConfig->output_Fs; - output_config = st_ivas->hDecoderConfig->output_config; - ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifndef FIX_901_PARAMMC_DEAD_CODE - hTransportSetup = st_ivas->hTransSetup; -#endif - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - hParamMC->hoa_encoder_fx = NULL; -#if 1/*TODO: To be removed later(floating pointer initialization)*/ - hParamMC->hoa_encoder = NULL; -#endif - - /* determine the synthesis config */ - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD || st_ivas->transport_config == output_config ) - { - hParamMC->synthesis_conf = PARAM_MC_SYNTH_DIRECT; - } - else if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) - { - hParamMC->synthesis_conf = PARAM_MC_SYNTH_MONO_STEREO; - } - else if ( st_ivas->transport_config != output_config ) - { - if ( ( output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && nchan_out_transport > audioCfg2channels( output_config ) ) || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && nchan_out_transport > st_ivas->hOutSetup.nchan_out_woLFE ) ) - { - hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_COV; - /* need to reset the intern config */ - st_ivas->intern_config = output_config; - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hLsSetupCustom->num_spk; -#if 1/*TODO: To be removed later*/ - st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; - st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; -#endif - st_ivas->hIntSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; - st_ivas->hIntSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; - } - } - else - { - hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_CLDFB; - } - } - -#if 1/*TODO: To be removed later*/ - hParamMC->ls_conv_dmx_matrix = NULL; -#endif - hParamMC->ls_conv_dmx_matrix_fx = NULL; - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - } - else - { - nchan_out_cov = nchan_out_transport; - } - - st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); - config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_brate ); - nchan_transport = st_ivas->nchan_transport; - - switch ( nchan_transport ) - { - case 4: - case 3: - st_ivas->nCPE = 2; - st_ivas->nSCE = 0; - st_ivas->element_mode_init = IVAS_CPE_MDCT; - break; - case 2: - st_ivas->nCPE = 1; - st_ivas->nSCE = 0; - st_ivas->element_mode_init = IVAS_CPE_MDCT; - - break; - } - - /*-----------------------------------------------------------------* - * set input parameters - *-----------------------------------------------------------------*/ - - hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; - set_s( hParamMC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); - set_s( hParamMC->subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); - hParamMC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; - - hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); - hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); -#else - ivas_param_mc_metadata_open( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); -#endif - - /* init arrays for quantized parameters */ - - if ( ( hParamMC->icc_q_fx = (Word16 *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( Word16 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - if ( ( hParamMC->icld_q_fx = (Word16 *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( Word16 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - set16_fx( hParamMC->icld_q_fx, PARAM_MC_DEFAULT_MIN_ILD_FX, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - set16_fx( hParamMC->icc_q_fx, 0, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - -#if 1/*TODO: To be removed later(floating point initialization)*/ - if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } -#endif - - param_mc_set_num_synth_bands( output_Fs, hParamMC ); - - /* Band Grouping */ - if ( hParamMC->hMetadataPMC->num_parameter_bands == 20 ) - { - mvs2s( param_mc_band_grouping_20, hParamMC->band_grouping, 20 + 1 ); - } - else if ( hParamMC->hMetadataPMC->num_parameter_bands == 14 ) - { - mvs2s( param_mc_band_grouping_14, hParamMC->band_grouping, 14 + 1 ); - } - else if ( hParamMC->hMetadataPMC->num_parameter_bands == 10 ) - { - mvs2s( param_mc_band_grouping_10, hParamMC->band_grouping, 10 + 1 ); - } - else - { - assert( 0 && "nbands must be 20, 14, or 10!" ); - } - - /* set max parameter band for abs cov */ - k = 0; - while ( hParamMC->band_grouping[k] <= PARAM_MC_MAX_BAND_ABS_COV_DEC ) - { - hParamMC->max_param_band_abs_cov = ( k++ ); - } - - /*-----------------------------------------------------------------* - * open sub-modules - *-----------------------------------------------------------------*/ - - /* prototype signal computation */ - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB || hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { -#if 1/*TODO: To be removed later (floating point malloc)*/ - if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } -#endif - IF( ( hParamMC->ls_conv_dmx_matrix_fx = (Word32 *) malloc( nchan_out_transport * nchan_out_cov * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - - for ( k = 0; k < nchan_out_transport; k++ ) - { - Copy32( st_ivas->hLsSetUpConversion->dmxMtx_fx[k], &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov], nchan_out_cov );/*Q30*/ - } - - /* convert ParamMC parameter bands to SFB */ - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - st_ivas->hLsSetUpConversion->sfbCnt = hParamMC->num_param_bands_synth; - for ( k = 0; k <= hParamMC->num_param_bands_synth; k++ ) - { - st_ivas->hLsSetUpConversion->sfbOffset[k] = PARAM_MC_BAND_TO_MDCT_BAND_RATIO * hParamMC->band_grouping[k]; - } - } - else - { - /* close the ls conversion handle immediately, it was only needed to get the DMX matrix in case of DMX in the covariance domain */ - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); - } - } - } - if ( ( hParamMC->proto_matrix_int_fx = (Word32 *) malloc( nchan_out_transport * nchan_transport * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, hParamMC->proto_matrix_int_fx, nchan_transport * nchan_out_transport );/*Q31*/ - - if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, -4 ); /*Q.26*/ - matrix_product_fx( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_cov, nchan_out_transport, 0, ivas_param_mc_conf[config_index].dmx_fac_fx, nchan_out_transport, nchan_transport, 0, proto_matrix_fx );/*Q.26*/ - Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, 4 ); /*Q.26*/ - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - proto_mtx_norm_fx = ONE_IN_Q26;/*Q26*/ - for ( k = 0; k < nchan_transport * nchan_out_cov; k++ ) - { - proto_mtx_norm_fx = L_max(L_abs(proto_mtx_norm_fx), L_abs( proto_matrix_fx[k] ) );/*Q.26*/ - } - proto_mtx_norm_fx = divide3232(ONE_IN_Q26 , proto_mtx_norm_fx);/*Q15*/ - - /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ - for ( k = 0; k < nchan_transport; k++ ) - { - for ( int16_t i = 0; i < nchan_out_cov; i++ ) - { - st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl(Mult_32_16(proto_matrix_fx[k * nchan_out_cov + i] , extract_l(proto_mtx_norm_fx)),4);/*Q.30*/ - } - } - } - } - else - { - Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, proto_matrix_fx, nchan_out_transport * nchan_transport );/*Q.31*/ - Scale_sig32( proto_matrix_fx, nchan_out_transport * nchan_transport, -5);/*Scaling down to 26*/ - } - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - hParamMC->num_outputs_diff = 0; - hParamMC->diff_proto_info = NULL; - hParamMC->h_output_synthesis_params.use_onset_filters = 0; - hParamMC->max_band_decorr = 0; - hParamMC->h_freq_domain_decorr_ap_params = NULL; - hParamMC->h_freq_domain_decorr_ap_state = NULL; - } - else - { - hParamMC->num_outputs_diff = nchan_out_cov; - if ( ( hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - - if ( ( error = param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ,Q26) ) != IVAS_ERR_OK ) - { - return error; - } - - /* decorrelation */ - hParamMC->h_freq_domain_decorr_ap_params = NULL; - hParamMC->h_freq_domain_decorr_ap_state = NULL; - - ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, hParamMC->num_freq_bands ); - - IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hParamMC->h_freq_domain_decorr_ap_params ), &( hParamMC->h_freq_domain_decorr_ap_state ), hParamMC->num_freq_bands, hParamMC->num_outputs_diff, hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, frequency_axis_fx, nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - hParamMC->h_output_synthesis_params.use_onset_filters = 0; - hParamMC->max_band_decorr = hParamMC->h_freq_domain_decorr_ap_params->max_band_decorr; - } - hParamMC->max_band_energy_compensation = hParamMC->band_grouping[hParamMC->hMetadataPMC->nbands_coded]; - max_param_band_residual = 0; - - for ( k = hParamMC->hMetadataPMC->num_parameter_bands; k >= 0; k-- ) - { - if ( hParamMC->band_grouping[k] <= hParamMC->max_band_decorr ) - { - max_param_band_residual = k; - assert( hParamMC->band_grouping[k] == hParamMC->max_band_decorr ); - break; - } - } - - /* output synthesis */ - if ( ( error = ivas_dirac_dec_output_synthesis_cov_open_fx( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix_fx ) ) != IVAS_ERR_OK ) - { - return error; - } - - ivas_param_mc_dec_compute_interpolator_fx( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator_fx ); - - /* Head or external rotation */ - if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) - { -#if 1/*TODO : To be removed later*/ - IF ( ( hParamMC->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } -#endif - IF ( ( hParamMC->hoa_encoder_fx = (Word32 *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof(Word32) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - compute_hoa_encoder_mtx_fx( st_ivas->hTransSetup.ls_azimuth_fx, st_ivas->hTransSetup.ls_elevation_fx, hParamMC->hoa_encoder_fx, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); - } - - /*-----------------------------------------------------------------* - * memory allocation - *-----------------------------------------------------------------*/ - - IF ( GT_16(hParamMC->max_band_decorr , 0) ) - { -#if 1/*TODO: To be removed later(floating point malloc)*/ - IF ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - IF ( ( hParamMC->proto_frame_dec_f = (float *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } -#endif - IF ( ( hParamMC->proto_frame_f_fx = (Word32 *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - IF ( ( hParamMC->proto_frame_dec_f_fx = (Word32 *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - } - ELSE - { -#if 1/*TODO: To be removed later*/ - hParamMC->proto_frame_f = NULL; - hParamMC->proto_frame_dec_f = NULL; -#endif - hParamMC->proto_frame_f_fx = NULL; - hParamMC->proto_frame_dec_f_fx = NULL; - } - - ivas_param_mc_dec_init_fx( hParamMC, nchan_transport, nchan_out_cov ); - - IF ( hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) - { - Word16 n_cldfb_slots; - - n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; - IF ( st_ivas->hDecoderConfig->Opt_tsm ) - { - n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; - } - - IF( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set32_fx( hParamMC->Cldfb_RealBuffer_tc_fx, 0, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); - IF( ( hParamMC->Cldfb_ImagBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set32_fx( hParamMC->Cldfb_ImagBuffer_tc_fx, 0, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); - -#if 1/*TODO: To be removed later(floating point malloc)*/ - if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); - if ( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); -#endif - - IF ( st_ivas->hTcBuffer == NULL ) - { - IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - ELSE - { - hParamMC->Cldfb_RealBuffer_tc_fx = NULL; - hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; -#if 1/*TODO: To be removed later*/ - hParamMC->Cldfb_RealBuffer_tc = NULL; - hParamMC->Cldfb_ImagBuffer_tc = NULL; -#endif - } - - hParamMC->subframes_rendered = 0; - hParamMC->slots_rendered = 0; - st_ivas->hParamMC = hParamMC; - return error; -} -#endif ivas_error ivas_param_mc_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -935,12 +489,12 @@ ivas_error ivas_param_mc_dec_open( /* output synthesis */ #ifdef IVAS_FLOAT_FIXED - floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q26, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); + floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q30, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); if ( ( error = ivas_dirac_dec_output_synthesis_cov_open_fx( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix_fx ) ) != IVAS_ERR_OK ) { return error; } - fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, Q26, nchan_transport * nchan_out_cov ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 30, nchan_transport * nchan_out_cov ); #else if ( ( error = ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix ) ) != IVAS_ERR_OK ) @@ -1412,6 +966,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( FOR ( k = 0; k < nchan_out_transport; k++ ) { Copy32( st_ivas->hLsSetUpConversion->dmxMtx_fx[k], &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov], nchan_out_cov ); + Scale_sig32( &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov],nchan_out_cov,1 ); } } /* convert ParamMC parameter bands to SFB */ @@ -1446,27 +1001,26 @@ ivas_error ivas_param_mc_dec_reconfig_fx( IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_COV) || EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) { - Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, -4 ); matrix_product_fx( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_cov, nchan_out_transport, 0, ivas_param_mc_conf[config_index].dmx_fac_fx, nchan_out_transport, nchan_transport, 0, - proto_matrix_fx /*Q26*/); - Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, 4 ); + proto_matrix_fx ); IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) { - proto_mtx_norm_fx = ONE_IN_Q26; + proto_mtx_norm_fx = MAX_32; FOR ( k = 0; k < nchan_transport * nchan_out_cov; k++ ) { proto_mtx_norm_fx = L_max(L_abs( proto_mtx_norm_fx ), L_abs( proto_matrix_fx[k] ) ); } - proto_mtx_norm_fx = divide3232(ONE_IN_Q26 , proto_mtx_norm_fx);/*Q15*/ + proto_mtx_norm_fx = divide3232(1 , proto_mtx_norm_fx);/*Q15*/ /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ FOR ( k = 0; k < nchan_transport; k++ ) { FOR ( Word16 i = 0; i < nchan_out_cov; i++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl(Mpy_32_16_1(proto_matrix_fx[k * nchan_out_cov + i] , (Word16)proto_mtx_norm_fx),4); + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shr(Mpy_32_16_1(proto_matrix_fx[k * nchan_out_cov + i] , (Word16)proto_mtx_norm_fx),1); + st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); } } } @@ -1474,7 +1028,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( ELSE { Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, proto_matrix_fx, nchan_out_transport * nchan_transport ); - Scale_sig32( proto_matrix_fx, nchan_out_transport * nchan_transport, -5 ); } IF ( NE_16(nchan_transport_old , nchan_transport) && NE_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) @@ -1528,7 +1081,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } - IF ( ( param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ,Q26) ) != IVAS_ERR_OK ) + IF ( ( param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ) ) != IVAS_ERR_OK ) { return error; } @@ -2299,173 +1852,7 @@ int16_t param_mc_get_num_cldfb_syntheses( * * Close Parametric MC memories *------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_dec_close_fx( - PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ -) -{ - UWord16 i; - PARAM_MC_DEC_HANDLE hParamMC; - - IF( hParamMC_out == NULL || *hParamMC_out == NULL ) - { - return; - } - - hParamMC = *hParamMC_out; - - /* close sub-modules */ - ivas_dirac_dec_output_synthesis_cov_close_fx( &hParamMC->h_output_synthesis_params, &hParamMC->h_output_synthesis_cov_state ); - - IF( hParamMC->h_freq_domain_decorr_ap_params != NULL || hParamMC->h_freq_domain_decorr_ap_state != NULL ) - { - ivas_dirac_dec_decorr_close( &hParamMC->h_freq_domain_decorr_ap_params, &hParamMC->h_freq_domain_decorr_ap_state ); - } - - /* parameter decoding */ - IF( hParamMC->hMetadataPMC != NULL ) - { -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); -#endif - free( hParamMC->hMetadataPMC ); - hParamMC->hMetadataPMC = NULL; - } - IF( hParamMC->icc_q_fx != NULL ) - { - free( hParamMC->icc_q_fx ); - hParamMC->icc_q_fx = NULL; - } - - IF( hParamMC->icld_q_fx != NULL ) - { - free( hParamMC->icld_q_fx ); - hParamMC->icld_q_fx = NULL; - } - /* diffuse prototype info */ - IF( hParamMC->diff_proto_info ) - { - FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - free( hParamMC->diff_proto_info->source_chan_idx[i] ); - hParamMC->diff_proto_info->source_chan_idx[i] = NULL; - - free( hParamMC->diff_proto_info->proto_fac_fx[i] ); - hParamMC->diff_proto_info->proto_fac_fx[i] = NULL; - } - - free( hParamMC->diff_proto_info->source_chan_idx ); - hParamMC->diff_proto_info->source_chan_idx = NULL; - - free( hParamMC->diff_proto_info->proto_fac_fx ); - hParamMC->diff_proto_info->proto_fac_fx = NULL; - - free( hParamMC->diff_proto_info->proto_index_diff ); - hParamMC->diff_proto_info->proto_index_diff = NULL; - - free( hParamMC->diff_proto_info->num_source_chan_diff ); - hParamMC->diff_proto_info->num_source_chan_diff = NULL; - - free( hParamMC->diff_proto_info ); - hParamMC->diff_proto_info = NULL; - } - /* States */ - /* free prototype signal buffers */ - IF( hParamMC->proto_frame_f_fx != NULL ) - { - free( hParamMC->proto_frame_f_fx ); - hParamMC->proto_frame_f_fx = NULL; - } - - IF( hParamMC->proto_frame_dec_f_fx != NULL ) - { - free( hParamMC->proto_frame_dec_f_fx); - hParamMC->proto_frame_dec_f_fx = NULL; - } - - IF( hParamMC->ls_conv_dmx_matrix_fx != NULL ) - { - free( hParamMC->ls_conv_dmx_matrix_fx ); - hParamMC->ls_conv_dmx_matrix_fx = NULL; - } - - IF( hParamMC->proto_matrix_int_fx != NULL ) - { - free( hParamMC->proto_matrix_int_fx ); - hParamMC->proto_matrix_int_fx = NULL; - } - - IF( hParamMC->hoa_encoder_fx != NULL ) - { - free( hParamMC->hoa_encoder_fx ); - hParamMC->hoa_encoder_fx = NULL; - } - IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) - { - free( hParamMC->Cldfb_RealBuffer_tc_fx ); - hParamMC->Cldfb_RealBuffer_tc_fx = NULL; - } - IF( hParamMC->Cldfb_ImagBuffer_tc_fx != NULL ) - { - free( hParamMC->Cldfb_ImagBuffer_tc_fx ); - hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; - } -#if 1 /*TODO: To be removed later(Floating point memory dealloc)------------------------------- */ - - IF( hParamMC->icc_q != NULL ) - { - free( hParamMC->icc_q ); - hParamMC->icc_q = NULL; - } - - IF( hParamMC->icld_q != NULL ) - { - free( hParamMC->icld_q ); - hParamMC->icld_q = NULL; - } - IF( hParamMC->diff_proto_info ) - { - FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - free( hParamMC->diff_proto_info->proto_fac[i] ); - hParamMC->diff_proto_info->proto_fac[i] = NULL; - } - free( hParamMC->diff_proto_info->proto_fac ); - hParamMC->diff_proto_info->proto_fac = NULL; - } - IF( hParamMC->proto_frame_f != NULL ) - { - free( hParamMC->proto_frame_f ); - hParamMC->proto_frame_f = NULL; - } - IF( hParamMC->proto_frame_dec_f != NULL ) - { - free( hParamMC->proto_frame_dec_f ); - hParamMC->proto_frame_dec_f = NULL; - } - IF( hParamMC->ls_conv_dmx_matrix != NULL ) - { - free( hParamMC->ls_conv_dmx_matrix ); - hParamMC->ls_conv_dmx_matrix = NULL; - } - IF( hParamMC->Cldfb_RealBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_RealBuffer_tc ); - hParamMC->Cldfb_RealBuffer_tc = NULL; - } - IF( hParamMC->Cldfb_ImagBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_ImagBuffer_tc ); - hParamMC->Cldfb_ImagBuffer_tc = NULL; - } -#endif /***********************************ends here************************************************/ - - free( *hParamMC_out ); - *hParamMC_out = NULL; - return; -} -#endif void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ ) @@ -2591,6 +1978,7 @@ void ivas_param_mc_dec_close( return; } + /*------------------------------------------------------------------------- * ivas_param_mc_dec_read_BS() * @@ -4131,65 +3519,7 @@ void ivas_param_mc_dec( * * Parametric MC decoding initialization *------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -static void ivas_param_mc_dec_init_fx( - PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ - const Word16 nchan_transport, /* i : number of input (transport) channels */ - const Word16 nchan_cov ) /* i : number of cov synthesis channels */ -{ - Word16 k; - UWord16 max_param_band_residual; - Word16 len; - - /*-----------------------------------------------------------------* - * init sub-modules - *-----------------------------------------------------------------*/ - - /* decorrelation */ - IF ( GT_16(hParamMC->max_band_decorr , 0) ) - { - len = hParamMC->diff_proto_info->num_protos_diff * hParamMC->h_freq_domain_decorr_ap_params->h_onset_detection_power_params.max_band_decorr; - - /* init onsetDetectionPower */ - set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx, len ); - set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx, len ); -#if 1/*Floating point intialization: to be removed later*/ - set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1, len ); - set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2, len ); -#endif - } - - max_param_band_residual = 0; - - /* output synthesis */ - FOR ( k = hParamMC->hMetadataPMC->num_parameter_bands; k >= 0; k-- ) - { - IF ( LE_16(hParamMC->band_grouping[k] , hParamMC->max_band_decorr) ) - { - max_param_band_residual = k; - break; - } - } - - ivas_dirac_dec_output_synthesis_cov_init_fx( &( hParamMC->h_output_synthesis_cov_state ), nchan_transport, nchan_cov, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual ); - - /*-----------------------------------------------------------------* - * init proto frames - *-----------------------------------------------------------------*/ - - IF ( GT_16(hParamMC->max_band_decorr , 0) ) - { -#if 1/*TODO: To be removed later*/ - set_zero( hParamMC->proto_frame_f, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); - set_zero( hParamMC->proto_frame_dec_f, 2 * nchan_cov * hParamMC->num_freq_bands ); -#endif - set_zero_fx( hParamMC->proto_frame_f_fx, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); - set32_fx( hParamMC->proto_frame_dec_f_fx, 0, 2 * nchan_cov * hParamMC->num_freq_bands ); - } - return; -} -#endif // IVAS_FLOAT_FIXED static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ const int16_t nchan_transport, /* i : number of input (transport) channels */ @@ -6299,8 +5629,8 @@ static ivas_error param_mc_get_diff_proto_info_fx( const Word32 *proto_mtx, /* i : protoype matrix for the synthesis */ const UWord16 nchan_transport, /* i : number of transport channels */ const UWord16 nchan_out_cov, /* i : number if output channels of the covariance synthesis */ - PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, /* o : generated diffuse prototype info */ - Word16 Q_proto_mtx ) + PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info /* o : generated diffuse prototype info */ +) { #if FLT_ENABLE float proto_fac[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -6368,7 +5698,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( #if FLT_ENABLE if ( diff < 0.1f ) #else - if ( LT_64( diff_fx * 10, L_shl_sat(1, Q_proto_mtx)) ) + if ( LT_64( diff_fx * 10, 2147483648 ) ) #endif { found = 1; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index b6366c95c..29294304c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1352,846 +1352,26 @@ ivas_error ivas_mc_dec_config( { if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*TODO: To be removed(Float to fixed conversion)*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - Word16 nchan_transport_old = st_ivas->nchan_transport; - uint16_t nchan_internal; - Word32 ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; - - Word16 n_tc; - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for ( int ch = 0; ch < n_tc; ch++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); - } - Word16 cx_e = 0, cy_e = 0, mmo_e = 0, mmro_e = 0; - PARAM_MC_DEC_HANDLE hParamMC; - hParamMC = st_ivas->hParamMC; - Word16 nchan_out_transport, nchan_out_cov; - MC_LS_SETUP mc_ls_setup; - Word16 nchan_transport; - if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) - { - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); - nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - if ( st_ivas->hParamMC ) - { - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - } - else - { - nchan_out_cov = nchan_out_transport; - } - floatToFixed_arr( hParamMC->icc_q, hParamMC->icc_q_fx, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - floatToFixed_arr( hParamMC->icld_q, hParamMC->icld_q_fx, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - Word32 max_cx_old_fx, max_cy_old_fx, max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; - float max_cx_old = hParamMC->h_output_synthesis_cov_state.cx_old[0][0], max_cy_old = hParamMC->h_output_synthesis_cov_state.cy_old[0][0], max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) - { - for ( int j = 0; j < nchan_transport_old * nchan_transport_old; j++ ) - max_cx_old = max( max_cx_old, hParamMC->h_output_synthesis_cov_state.cx_old[i][j] ); - for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) - max_cy_old = max( max_cy_old, hParamMC->h_output_synthesis_cov_state.cy_old[i][j] ); - for ( int j = 0; j < nchan_transport_old * nchan_out_cov; j++ ) - max_mix_matrix_old = max( max_mix_matrix_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i][j] ); - } - } - IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) - floatToFixed_arr32( st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) ); - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) - max_mix_matrix_res_old = max( max_mix_matrix_res_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i][j] ); - } - } - f2me( max_cx_old, &max_cx_old_fx, &cx_e ); - f2me( max_cy_old, &max_cy_old_fx, &cy_e ); - f2me( max_mix_matrix_old, &max_mix_matrix_old_fx, &mmo_e ); - f2me( max_mix_matrix_res_old, &max_mix_matrix_res_old_fx, &mmro_e ); - if ( mmo_e < 0 ) - mmo_e = 0; - if ( mmro_e < 0 ) - mmro_e = 0; - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) - { - - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); - } - } - floatToFixed_arrL( hParamMC->proto_matrix_int, hParamMC->proto_matrix_int_fx, Q31, nchan_out_transport * nchan_transport ); - FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - if ( hParamMC->diff_proto_info ) - floatToFixed_arrL( hParamMC->diff_proto_info->proto_fac[i], hParamMC->diff_proto_info->proto_fac_fx[i], Q26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); - } - } - } -#endif - if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 - if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) - { - PARAM_MC_DEC_HANDLE hParamMC; - hParamMC = st_ivas->hParamMC; - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); - st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); - nchan_transport = st_ivas->nchan_transport; - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - } - else - { - nchan_out_cov = nchan_out_transport; - } - if ( hParamMC ) - { - if ( st_ivas->hLsSetUpConversion ) - { - for ( Word16 k = 0; k < nchan_transport; k++ ) - { - for ( int16_t i = 0; i < nchan_out_cov; i++ ) - { - st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); - } - } - } - fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); - IF( hParamMC->diff_proto_info ) - FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - - fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); - } - fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); - IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) - fixedToFloat_arrL( st_ivas->hParamMC->ls_conv_dmx_matrix_fx, st_ivas->hParamMC->ls_conv_dmx_matrix, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) ); - if ( last_mc_mode == MC_MODE_PARAMMC ) - { - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) - { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); - } - } - } - } - } -#endif -#else - if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED - } - } - - st_ivas->transport_config = signaled_config; - } - - return IVAS_ERR_OK; -} - - -/*------------------------------------------------------------------------- - * ivas_mc_dec_reconfig() - * - * reconfigure the MC format decoder - *-------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -static ivas_error ivas_mc_dec_reconfig( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - UWord16 *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ - Word16 *data /* o : output synthesis signal */ -) -{ - Word16 nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; - Word16 numCldfbAnalyses_old, numCldfbSyntheses_old; - Word32 new_brate_SCE, new_brate_CPE, ivas_total_brate; - RENDERER_TYPE renderer_type_old; - Decoder_State *st; - ivas_error error; - MC_MODE mc_mode, last_mc_mode; - TC_BUFFER_MODE tc_buffer_mode_new; - Word16 tc_nchan_tc_new; - Word16 tc_nchan_allocate_new; - Word16 tc_granularity_new; - AUDIO_CONFIG intern_config_old; - IVAS_OUTPUT_SETUP hIntSetupOld; - Word16 nchan_out_buff_old, nchan_out_buff; - - error = IVAS_ERR_OK; - ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - nchan_transport_old = st_ivas->nchan_transport; - nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ - - /* temporally set the current mc_mode back to the previous one to make sure the following call to - ivas_init_dec_get_num_cldfb_instances() returns the correct counts */ - mc_mode = st_ivas->mc_mode; - st_ivas->mc_mode = last_mc_mode; - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); - - st_ivas->mc_mode = mc_mode; - - nSCE_old = st_ivas->nSCE; - nCPE_old = st_ivas->nCPE; - sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag; - - /* special handling needed for the hp20 buffers for McMASA */ - IF ( EQ_16(last_mc_mode , MC_MODE_MCMASA) ) - { - nchan_hp20_old = getNumChanSynthesis( st_ivas ); - } - ELSE - { - nchan_hp20_old = nchan_transport_old; - } - st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); - - /* save old IntSetup, might be needed for JBM flushing...*/ - intern_config_old = st_ivas->intern_config; - hIntSetupOld = st_ivas->hIntSetup; - tc_granularity_new = 1; - - /* renderer might have changed, reselect */ - renderer_type_old = st_ivas->renderer_type; - ivas_renderer_select( st_ivas ); - - /* side effect of the renderer selection can be a changed internal config */ - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - - /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - IF ( EQ_16(last_mc_mode , MC_MODE_PARAMMC) ) - { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hParamMC->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hParamMC->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; - Copy( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } - ELSE IF ( EQ_16(last_mc_mode , MC_MODE_MCMASA) && st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; - Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } - - /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv - render what still fits in the new granularity */ - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - IF ( LT_16(tc_granularity_new , st_ivas->hTcBuffer->n_samples_granularity) ) - { - IF ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } - } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - ELSE IF ( GT_16(tc_granularity_new , st_ivas->hTcBuffer->n_samples_granularity) ) - { - IF ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) - { - st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); - st_ivas->nSCE = 0; - st_ivas->nCPE = st_ivas->nchan_transport / 2; - - IF ( NE_16(last_mc_mode , MC_MODE_MCT) ) - { - /*De-allocate handles for other MC modes*/ - IF ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); - - /* remove ls conversion if it was allocated by ParamMC */ - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); - } - - IF ( EQ_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) - { - ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); - ivas_ls_setup_conversion_close_fx( &( st_ivas->hLsSetUpConversion ) ); - } - - /* De-allocate McMasa-related handles */ - ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); - - ivas_qmetadata_close( &st_ivas->hQMetaData ); - IF ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); - ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); - ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); - vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); - } - - /* init LS conversion if the renderer type asks for it */ - IF ( EQ_16(st_ivas->renderer_type , RENDERER_MC) && st_ivas->hLsSetUpConversion == NULL ) - { - if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - } - ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) - { - st_ivas->nSCE = 0; - st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2; - st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; - - IF ( NE_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) - { - /*De-allocate handles for other MC modes*/ - IF ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); - - /* remove ls conversion if it was allocated by ParamMC */ - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); - } - - ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); - ivas_qmetadata_close( &st_ivas->hQMetaData ); - - /* init LS conversion if the renderer type asks for it */ - IF ( ( EQ_16(st_ivas->renderer_type , RENDERER_MC) ) && st_ivas->hLsSetUpConversion == NULL ) - { - IF ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - IF ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) ) - { - IF ( NE_16(last_mc_mode , MC_MODE_PARAMMC) ) - { - /* remove old ls conversion for MCT if open, gets reopened correctly within ivas_param_mc_dec_open when needed */ - IF ( EQ_16(renderer_type_old , RENDERER_MC) && st_ivas->hLsSetUpConversion != NULL ) - { - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); - } - - IF ( ( error = ivas_param_mc_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - } - ELSE - { - IF ( ( error = ivas_param_mc_dec_reconfig_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* De-allocate McMasa-related handles */ - ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); - ivas_qmetadata_close( &st_ivas->hQMetaData ); - - IF ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); - ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); - ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); - vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); - } - - IF ( EQ_16(last_mc_mode , MC_MODE_MCT) ) - { - IF ( st_ivas->hMCT != NULL && LE_16(st_ivas->nchan_transport , CPE_CHANNELS) ) - { - ivas_mct_dec_close( &st_ivas->hMCT ); - } - } - ELSE IF ( EQ_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) - { - ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); - } - - /* LFE handle */ - ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); - } - ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) - { - ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); - - IF ( NE_16(last_mc_mode , MC_MODE_MCMASA) ) - { - IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - IF ( ( error = ivas_mcmasa_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* LS conversion */ - IF ( st_ivas->hLsSetUpConversion != NULL ) - { - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); - } - - ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); - - IF ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); - st_ivas->hParamMC = NULL; - } - - IF ( EQ_16(last_mc_mode , MC_MODE_MCT) ) - { - ivas_mct_dec_close( &st_ivas->hMCT ); - } - - /* LFE handle */ - ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); - } - - IF ( NE_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) - { - IF ( EQ_16(st_ivas->nchan_transport , 1) ) - { - st_ivas->element_mode_init = IVAS_SCE; - } - ELSE - { - st_ivas->element_mode_init = IVAS_CPE_MDCT; - } - } - - /*-----------------------------------------------------------------* - * Reconfigure core coder - *-----------------------------------------------------------------*/ - - /* special case: MCT->ParamMC with more than 2 TC, CPE 1 stays, but has the wrong mct_chan_mode in channel 1 - and might have IGF static memory not allocated and the bit stream index list not set, - set correct mct_chan_mode and init missing static mem (IGF, HQ) and some config (TNS) do it here since it is _very_ MC specific */ - IF ( EQ_16(last_mc_mode , MC_MODE_MCT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && GT_16(st_ivas->nchan_transport , CPE_CHANNELS) ) - { - st = st_ivas->hCPE[1]->hCoreCoder[1]; - - IF ( st_ivas->nchan_transport == 3 ) - { - st->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - } - ELSE - { - st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - } - - IF ( st->hIGFDec == NULL ) - { - IF ( ( st->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for IGF\n" ) ); - } - - st->igf = 0; - init_igf_dec( st->hIGFDec ); -#if 1 /*TODO: To be removed later(floating point initialization)*/ -#if ( defined EVS_FLOAT ) || !( defined IVAS_FLOAT_FIXED ) - st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; - st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; - set_f( st->hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX ); -#endif - FOR( Word16 l = 0; l < IGF_START_MX; l++ ) - st->hIGFDec->infoTCXNoiseBuf[l] = (uint8_t) st->hIGFDec->infoTCXNoise_evs[l]; -#endif - } - - IF ( st->hHQ_core == NULL ) - { - IF ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) ); - } - - /* HQ core initialization */ -#if 1/*TODO: To be removed later*/ - HQ_core_dec_init_flt( st->hHQ_core ); -#endif - HQ_core_dec_init_fx( st->hHQ_core ); - } - - /* check if we have a doubly used hTxcCfg, if so, allocate a distint one for the old MCT LFE channel */ - IF ( st->hTcxCfg == st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg ) - { - IF ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) ); - } - } - - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode ); - } - IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) - { - uint8_t separateChannelEnabled; - int16_t separateChannelIndex; - ivas_mcmasa_set_separate_channel_mode_fx( &separateChannelEnabled, &separateChannelIndex, ivas_total_brate ); - ivas_mcmasa_split_brate_fx( separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); - } - ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) - { - new_brate_SCE = 0; - new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; - } - ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) - { - new_brate_SCE = 0; - new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; - } - ELSE - { - new_brate_SCE = 0; /* ivas_total_brate / st_ivas->nchan_transport;*/ - new_brate_CPE = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; - } - - IF( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE ) ) != IVAS_ERR_OK ) - { - return error; - } - IF ( EQ_16(last_mc_mode , MC_MODE_MCT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && GT_16(st_ivas->nchan_transport , CPE_CHANNELS) ) - { - st = st_ivas->hCPE[1]->hCoreCoder[1]; - - /* TCX-LTP */ - IF ( st->hTcxLtpDec == NULL ) - { - IF ( ( st->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); - } - tcxltp_dec_init_fx( st->hTcxLtpDec, 0, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core ); - } - } - - /*-----------------------------------------------------------------* - * re-configure HP20 memories - *-----------------------------------------------------------------*/ - IF ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1/*TODO: To be removed later*/ - /*To be removed later: Contains memory allocations for floating point buffers*/ - IF ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - /*-----------------------------------------------------------------* - * Allocate the LFE handle that is coded separately after the allocation of the core coders - *-----------------------------------------------------------------*/ - - IF ( ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) || EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) && st_ivas->hLFE == NULL ) - { - Word32 binauralization_delay_ns = st_ivas->binaural_latency_ns; - IF ( st_ivas->hBinRenderer != NULL ) - { - IF ( st_ivas->hBinRenderer->render_lfe ) - { - /* Account for filterbank delay */ - binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS; - } - else - { - binauralization_delay_ns = 0; - } - } - - IF( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) - { - return error; - } - - set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); - set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); - } - - /*-----------------------------------------------------------------* - * Reconfigure renderers - *-----------------------------------------------------------------*/ - - IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) - { - IF ( ( NE_16(st_ivas->renderer_type , RENDERER_DISABLE) ) && ( NE_16(st_ivas->renderer_type , RENDERER_MCMASA_MONO_STEREO) ) ) - { - IF ( st_ivas->hDirAC != NULL ) - { - /* reconfigure existing DirAC dec */ - IF ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) - { - return error; - } - } - ELSE - { - /* init a new DirAC dec */ - IF ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - ELSE IF ( EQ_16(st_ivas->renderer_type , RENDERER_DISABLE) && st_ivas->hDirAC != NULL ) - { - ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); - ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); - ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); - vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); - } - } - - IF ( NE_16(renderer_type_old , st_ivas->renderer_type) ) - { - AUDIO_CONFIG output_config; - - output_config = st_ivas->hDecoderConfig->output_config; - - /* binaural renderers*/ - IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL) || EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) || EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) - { - /* remove unneeded binaural renderers */ - IF ( st_ivas->hBinRenderer != NULL && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) - { - ivas_binRenderer_close( &st_ivas->hBinRenderer ); - } - - IF ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV_ROOM) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) || NE_16(st_ivas->hIntSetup.output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) ) ) - { - - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); - } - - IF ( st_ivas->hBinRendererTd != NULL && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) ) ) - { - ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; - } - - IF ( st_ivas->hDiracDecBin != NULL ) - { - IF ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) && NE_16(st_ivas->renderer_type , RENDERER_STEREO_PARAMETRIC) ) - { - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - } - } - - /* init necessary new renderers */ - IF ( st_ivas->hBinRenderer == NULL && ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) - { - IF ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - ELSE IF ( st_ivas->hBinRendererTd == NULL && EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) ) - { - IF( ( error = ivas_td_binaural_open_fx( st_ivas, st_ivas->hBinRendererTd->SrcInd, &st_ivas->hBinRendererTd->num_src ) ) != IVAS_ERR_OK ) - { - return error; - } - IF ( EQ_16(st_ivas->hIntSetup.output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) - { - IF ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); - } + if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - st_ivas->hCrendWrapper->hCrend = NULL; - st_ivas->hCrendWrapper->hHrtfCrend = NULL; - IF ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); - } - } - } - ELSE IF ( st_ivas->hCrendWrapper == NULL && ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV_ROOM) ) ) - { - IF ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } - st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; - } - } - /* mono/stereo */ - ELSE IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_MONO) || EQ_16(output_config , IVAS_AUDIO_CONFIG_STEREO) ) - { - /* nothing should happen here... */ - } - /* LS */ - ELSE IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1) || EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1_2) || EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1_4) || EQ_16(output_config , IVAS_AUDIO_CONFIG_7_1) || EQ_16(output_config , IVAS_AUDIO_CONFIG_7_1_4) || EQ_16(output_config , IVAS_AUDIO_CONFIG_LS_CUSTOM) ) - { - } - } - /*-----------------------------------------------------------------* - * CLDFB instances - *-----------------------------------------------------------------*/ - - IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ,Q11) ) != IVAS_ERR_OK ) - { - return error; - } - - /*-----------------------------------------------------------------* - * JBM TC buffers - *-----------------------------------------------------------------*/ - - { - Word16 tc_nchan_full_new; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - - hTcBuffer = st_ivas->hTcBuffer; - tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); - tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); - tc_nchan_allocate_new = tc_nchan_tc_new; - tc_nchan_full_new = tc_nchan_tc_new; - - IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(st_ivas->renderer_type , RENDERER_STEREO_PARAMETRIC) ) - { - tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; - tc_nchan_full_new = tc_nchan_allocate_new; - } - - IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && NE_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) && NE_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) ) - { - tc_nchan_full_new = 0; - } - ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) - { - tc_nchan_allocate_new = MC_PARAMUPMIX_MAX_INPUT_CHANS; - tc_buffer_mode_new = TC_BUFFER_MODE_RENDERER; - IF ( EQ_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) || EQ_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) ) - { - tc_buffer_mode_new = TC_BUFFER_MODE_BUFFER; - tc_nchan_tc_new = st_ivas->hDecoderConfig->nchan_out; - tc_nchan_allocate_new = tc_nchan_tc_new; } - tc_nchan_full_new = tc_nchan_allocate_new; } - /* reconfigure buffer */ - IF ( NE_16(hTcBuffer->tc_buffer_mode , tc_buffer_mode_new) || NE_16(hTcBuffer->nchan_transport_jbm , tc_nchan_tc_new) || - NE_16(hTcBuffer->nchan_buffer_full , tc_nchan_full_new) || NE_16(hTcBuffer->nchan_transport_internal , tc_nchan_allocate_new) || - NE_16(tc_granularity_new , hTcBuffer->n_samples_granularity) ) - { - IF ( ( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) - { - return error; - } - } - /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - IF ( st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } - ELSE IF ( st_ivas->hParamMC != NULL ) - { - st_ivas->hParamMC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hParamMC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->hParamMC->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hParamMC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } + st_ivas->transport_config = signaled_config; } + return IVAS_ERR_OK; +} - /*-----------------------------------------------------------------* - * floating-point output audio buffers - *-----------------------------------------------------------------*/ - - nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); - IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1/*TODO: To be removed later*/ - if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - return error; -} -#else +/*------------------------------------------------------------------------- + * ivas_mc_dec_reconfig() + * + * reconfigure the MC format decoder + *-------------------------------------------------------------------------*/ static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -3455,4 +2635,3 @@ static ivas_error ivas_mc_dec_reconfig( return error; } -#endif // IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index d0381d674..d178c08fc 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -546,6 +546,7 @@ void stereo_dft_dec_open( * Reset DFT stereo memories *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_reset( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ ) @@ -847,7 +848,135 @@ void stereo_dft_dec_reset( return; } +#else + +void stereo_dft_dec_reset( + STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ +) +{ + int16_t i; + int16_t j, b; + + /*Configuration*/ + set_s( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); + + /* SIDE_GAIN */ + set_s( hStereoDft->side_gain_index, 15, STEREO_DFT_BAND_MAX ); + set_s( hStereoDft->side_gain_index_previous, 15, STEREO_DFT_BAND_MAX ); + + /*residual prediction*/ + set_s( hStereoDft->res_pred_mode, hStereoDft->hConfig->res_pred_mode, STEREO_DFT_DEC_DFT_NB ); + for ( i = 0; i < STEREO_DFT_PAST_MAX; i++ ) + { + set_zero( hStereoDft->DFT_past_DMX[i], STEREO_DFT32MS_N_32k ); + set_zero( hStereoDft->past_res_pred_gain[i], STEREO_DFT_BAND_MAX ); + } + + hStereoDft->past_DMX_pos = 0; + + set_s( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); + + for ( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) + { + hStereoDft->res_gains_ind[0][i] = 15.f; + } + + set_zero( hStereoDft->res_gains_ind[1], STEREO_DFT_BAND_MAX ); + + /*residual coding*/ + set_s( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); + hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->hConfig->res_cod_mode]; + set_zero( hStereoDft->res_cod_mem, STEREO_DFT_OVL_8k ); + + hStereoDft->res_pred_band_min = max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); + + hStereoDft->stab_fac_smooth_res = 0.f; + bass_psfilter_init( hStereoDft->hBpf ); + + tcxltp_dec_init( hStereoDft->hTcxLtpDec, 0, MODE1, IVAS_CPE_DFT, PIT_MAX, 12800 ); + + hStereoDft->reverb_flag = 0; + + hStereoDft->bpf_error_signal_last = 0.0f; + hStereoDft->bpf_error_ratio_mem = 1.0f; + hStereoDft->res_hb_nrg_mem = 0.0f; + + /*reset parameters*/ + set_zero( hStereoDft->side_gain, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); + set_zero( hStereoDft->gipd, STEREO_DFT_DEC_DFT_NB ); + set_zero( hStereoDft->itd, STEREO_DFT_DEC_DFT_NB ); + set_zero( hStereoDft->res_pred_gain, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); + + hStereoDft->wasTransient = 0; + hStereoDft->attackPresent = 0; + + hStereoDft->lt_pred_gain = 0.0f; + hStereoDft->lt_pred_gain_variation = 0.0f; + hStereoDft->lt_var_mean_ratio = STEREO_DFT_RES_RATIO_LIMIT; + hStereoDft->stefi_short_gain = 1.0f; + hStereoDft->stefi_long_gain = 0.0f; + + set_zero( hStereoDft->g_state, STEREO_DFT_BAND_MAX ); + + init_basic_allpass( &hStereoDft->ap1, dft_ap_gains[0], dft_ap_delays[0] ); + init_basic_allpass( &hStereoDft->ap2, dft_ap_gains[1], dft_ap_delays[1] ); + init_basic_allpass( &hStereoDft->ap3, dft_ap_gains[2], dft_ap_delays[2] ); + + set_zero( hStereoDft->ap_delay_mem, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); + set_zero( hStereoDft->ap_fade_mem, STEREO_DFT_ALLPASS_FADELEN_16k ); + hStereoDft->ap_wasTransient = 0; + set_zero( hStereoDft->smooth_dmx_nrg, STEREO_DFT_BAND_MAX ); + set_zero( hStereoDft->smooth_res_nrg, STEREO_DFT_BAND_MAX ); + + set_s( hStereoDft->core_hist, ACELP_CORE, STEREO_DFT_CORE_HIST_MAX ); + + set_zero( hStereoDft->hb_stefi_sig, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); + set_zero( hStereoDft->hb_nrg, STEREO_DFT_CORE_HIST_MAX ); + set_zero( hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); + + /* PLC parameters */ + set_zero( hStereoDft->res_mem, STEREO_DFT_RES_BW_MAX ); + hStereoDft->time_offs = 0; + hStereoDft->past_dmx_nrg = 0; + hStereoDft->sg_mean = 0.0f; + hStereoDft->sg_mem_corrupt = 0; + hStereoDft->recovery_flg = 0; + for ( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) + { + set_zero( hStereoDft->smooth_buf[i], SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + set_zero( hStereoDft->smooth_fac[0], SBA_DIRAC_STEREO_NUM_BANDS ); + set_zero( hStereoDft->smooth_fac[1], SBA_DIRAC_STEREO_NUM_BANDS ); + + hStereoDft->itd_xfade_target = 0.0f; + hStereoDft->itd_xfade_step = 0.0f; + hStereoDft->itd_xfade_counter = 0; + hStereoDft->itd_xfade_prev = 0.0f; + hStereoDft->last_active_element_brate = 0; + hStereoDft->ipd_xfade_target = 0.0f; + hStereoDft->ipd_xfade_step = 0.0f; + hStereoDft->ipd_xfade_counter = 0; + hStereoDft->ipd_xfade_prev = 0.0f; + + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + hStereoDft->mixer_mat_smooth[i][j][b] = 0.0f; + } + } + } + hStereoDft->first_frame = 1; + hStereoDft->g_L_prev = 0.f; + hStereoDft->g_R_prev = 0.f; + + return; +} + +#endif /*------------------------------------------------------------------------- * stereo_dft_dec_update() * diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 9dec7e9d4..ef7b6f36a 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2960,12 +2960,6 @@ void ivas_rend_closeCrend( hCrend->lfe_delay_line = NULL; } - if ( hCrend->lfe_delay_line_fx != NULL ) - { - free( hCrend->lfe_delay_line_fx); - hCrend->lfe_delay_line_fx = NULL; - } - if ( hCrend->freq_buffer_re_diffuse != NULL ) { free( hCrend->freq_buffer_re_diffuse ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2ff4360b9..f8e577f69 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1806,8 +1806,6 @@ typedef struct ivas_binaural_td_rendering_struct TDREND_SRC_t *Sources[MAX_NUM_TDREND_CHANNELS]; #ifdef IVAS_FLOAT_FIXED - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; Word16 Gain_fx; /* Q14 */ #endif // IVAS_FLOAT_FIXED -- GitLab From 093b8b4d09c23e6bc8878306e201368a70576756 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 29 Apr 2024 15:18:35 +0530 Subject: [PATCH 005/101] Windows warnings fix, MSAN error fixes and Float code cleanup --- lib_com/cldfb.c | 12 +- lib_com/fd_cng_com_fx.c | 1 + lib_com/float_to_fix_ops.c | 12 +- lib_dec/core_dec_init.c | 1 - lib_dec/init_dec_fx.c | 6 +- lib_dec/ivas_binRenderer_internal.c | 3 + lib_dec/ivas_core_dec.c | 818 +------------------ lib_dec/ivas_cpe_dec_fx.c | 255 +----- lib_dec/ivas_dirac_dec.c | 9 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 14 +- lib_dec/ivas_init_dec.c | 10 +- lib_dec/ivas_ism_dec.c | 7 + lib_dec/ivas_ism_param_dec.c | 4 +- lib_dec/ivas_ism_renderer.c | 5 +- lib_dec/ivas_jbm_dec.c | 43 +- lib_dec/ivas_masa_dec.c | 3 +- lib_dec/ivas_mc_param_dec.c | 41 +- lib_dec/ivas_mc_paramupmix_dec.c | 10 +- lib_dec/ivas_mct_core_dec.c | 4 +- lib_dec/ivas_mct_dec.c | 4 +- lib_dec/ivas_mdct_core_dec.c | 2 +- lib_dec/ivas_omasa_dec.c | 2 +- lib_dec/ivas_sba_dec.c | 3 +- lib_dec/ivas_sce_dec_fx.c | 3 +- lib_dec/ivas_spar_decoder.c | 31 +- lib_dec/ivas_spar_md_dec.c | 6 +- lib_dec/ivas_stat_dec.h | 36 +- lib_dec/ivas_stereo_dft_dec.c | 36 +- lib_dec/ivas_stereo_dft_dec_fx.c | 19 +- lib_dec/ivas_stereo_dft_plc_fx.c | 1 + lib_dec/ivas_stereo_switching_dec.c | 4 +- lib_dec/lib_dec_fx.c | 3 +- lib_dec/lsf_dec.c | 4 +- lib_dec/swb_tbe_dec.c | 2 +- lib_dec/swb_tbe_dec_fx.c | 4 +- lib_dec/tonalMDCTconcealment_fx.c | 36 +- lib_enc/ivas_spar_md_enc.c | 1 - lib_rend/ivas_crend.c | 7 + lib_rend/ivas_dirac_dec_binaural_functions.c | 7 +- lib_rend/ivas_dirac_rend.c | 51 +- lib_rend/ivas_objectRenderer_hrFilt.c | 21 - lib_rend/ivas_prot_rend.h | 5 + lib_rend/ivas_reverb.c | 23 +- lib_rend/ivas_vbap.c | 17 +- 44 files changed, 340 insertions(+), 1246 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 8859370e3..10a304247 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -856,12 +856,12 @@ void cldfbAnalysis_ts_fx( /* FFT of DST IV */ Word16 q_shift; - q_shift = sub(s_min(getScaleFactor32(rBuffer_fx, 2 * CLDFB_NO_CHANNELS_MAX), getScaleFactor32(iBuffer_fx, 2 * CLDFB_NO_CHANNELS_MAX)), find_guarded_bits_fx(M2)); + q_shift = sub(s_min(getScaleFactor32(rBuffer_fx, 2 * M2), getScaleFactor32(iBuffer_fx, 2 * M2)), find_guarded_bits_fx(M2)); *q_cldfb = add(*q_cldfb, q_shift); - for (Word16 ind = 0; ind < 2 * CLDFB_NO_CHANNELS_MAX; ind++) { + for (Word16 ind = 0; ind < 2 * M2; ind++) { rBuffer_fx[ind] = L_shl(rBuffer_fx[ind], q_shift); } - for (Word16 ind = 0; ind < 2 * CLDFB_NO_CHANNELS_MAX; ind++) { + for (Word16 ind = 0; ind < 2 * M2; ind++) { iBuffer_fx[ind] = L_shl(iBuffer_fx[ind], q_shift); } fft_cldfb_fx( rBuffer_fx, M2 ); @@ -878,12 +878,12 @@ void cldfbAnalysis_ts_fx( /* FFT of DCT IV */ fft_cldfb_fx( iBuffer_fx, M2 ); - q_shift = s_min(getScaleFactor32(rBuffer_fx, 2 * CLDFB_NO_CHANNELS_MAX), getScaleFactor32(iBuffer_fx, 2 * CLDFB_NO_CHANNELS_MAX)); + q_shift = s_min(getScaleFactor32(rBuffer_fx, 2 * M2), getScaleFactor32(iBuffer_fx, 2 * M2)); *q_cldfb = add(*q_cldfb, q_shift); - for (Word16 ind = 0; ind < 2 * CLDFB_NO_CHANNELS_MAX; ind++) { + for (Word16 ind = 0; ind < 2 * M2; ind++) { rBuffer_fx[ind] = L_shl(rBuffer_fx[ind], q_shift); } - for (Word16 ind = 0; ind < 2 * CLDFB_NO_CHANNELS_MAX; ind++) { + for (Word16 ind = 0; ind < 2 * M2; ind++) { iBuffer_fx[ind] = L_shl(iBuffer_fx[ind], q_shift); } diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index e2fdcf853..a559680b1 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -163,6 +163,7 @@ void ivas_initFdCngCom_fx( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale ) set32_fx( hFdCngCom->olapBufferSynth_fx, 0, FFTLEN ); set32_fx( hFdCngCom->olapBufferSynth2_fx, 0, FFTLEN ); set32_fx( hFdCngCom->exc_cng_32fx, 0, L_FRAME16k ); + set16_fx( hFdCngCom->exc_cng, 0, L_FRAME16k ); hFdCngCom->likelihood_noisy_speech_32fx = 0; move32(); diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index ebc877ac0..3620d6fe7 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -269,15 +269,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( //H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo; //ACELP_config *pConfigAcelp = &( st->acelp_cfg ); Word16 i = 0, - Q_old_synth = 0, Q_syn = 0, Q_synth_history = 0, /*Q_fer_samples = 0,*/ + Q_old_synth = 0, Q_syn = 0,/* Q_synth_history = 0,*/ /*Q_fer_samples = 0,*/ Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, //Q_pst_old_syn = 0, //delay_comp = 0; Word16 Q_lsf_cng = Q_factor( 6400 ); - Word16 Q_tcxltp_mem_in = 0, Q_tcxltp_mem_out = 0; - TD_BWE_DEC_HANDLE hBWE_TD = st->hBWE_TD; - Word16 Q_state_lsyn_filt_shb = 0, Q_state_lsyn_filt_dwn_shb = 0, Q_mem_resamp_HB = 0, Q_syn_overlap = 0, Q_int_3_over_2_tbemem_dec = 0, Q_mem_resamp_HB_32k = 0/*, Q_prev_fb_ener_adjust = 0 */; if ( tofix ) { @@ -497,9 +494,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //Q_pst_old_syn = 0, //delay_comp = 0; - Word16 Q_tcxltp_mem_in = 0, Q_tcxltp_mem_out = 0; - TD_BWE_DEC_HANDLE hBWE_TD = st->hBWE_TD; - Word16 Q_state_lsyn_filt_shb = 0, Q_state_lsyn_filt_dwn_shb = 0, Q_mem_resamp_HB = 0, Q_syn_overlap = 0, Q_int_3_over_2_tbemem_dec = 0, Q_mem_resamp_HB_32k = 0/*, Q_prev_fb_ener_adjust = 0*/; if ( tofix ) { @@ -791,7 +785,7 @@ void fixed_to_float_stereo_tcx_core_dec( Decoder_State *st, Word16 *signal_out ) { - TCX_DEC_HANDLE hTcxDec = st->hTcxDec; + //TCX_DEC_HANDLE hTcxDec = st->hTcxDec; //Word16 q_Aq; //st->hTcxDec->tcxltp_last_gain_unmodified_float = (Word16) fixedToFloat( st->hTcxDec->tcxltp_last_gain_unmodified, Q15 ); @@ -840,7 +834,7 @@ void fixed_to_float_stereo_tcx_core_dec( fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); } - st->hBPF->pst_mem_deemp_err_fx = st->mem_error; + st->hBPF->pst_mem_deemp_err_fx = (Word16)st->mem_error; /*=================================*/ if ( st->hFdCngDec != NULL && ( st->sr_core == INT_FS_12k8 || st->sr_core == INT_FS_16k ) && st->total_brate <= MAX_ACELP_BRATE ) { diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 458f82feb..662e4bc38 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -58,7 +58,6 @@ void open_decoder_LPD( const int16_t is_init /* i : indicate call during initialization */ ) { - int16_t i; int16_t mem_syn_r_size_old; int16_t mem_syn_r_size_new; int16_t fscaleFB; diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index eb61ce095..e43ef4bed 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1447,8 +1447,9 @@ ivas_error init_decoder_ivas_fx( } #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - //fd_bwe_dec_init_flt(st_fx->hBWE_FD); + // fd_bwe_dec_init_flt(st_fx->hBWE_FD); #endif + fd_bwe_dec_init(st_fx, st_fx->hBWE_FD); } ELSE @@ -1822,6 +1823,9 @@ ivas_error init_decoder_ivas_fx( { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TonalMDCTConcealment\n")); } +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + set_zero(st_fx->hTonalMDCTConc->timeDataBuffer_float, ( 3 * L_FRAME_MAX ) / 2); +#endif } ELSE { diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 02f158a3d..f5c63a08e 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1980,6 +1980,9 @@ void ivas_binRenderer_close( IF( ( *hBinRenderer )->hReverb != NULL ) { ivas_binaural_reverb_close( &( ( *hBinRenderer )->hReverb ) ); +#ifdef IVAS_FLOAT_FIXED + ivas_binaural_reverb_close_fx( &( ( *hBinRenderer )->hReverb ) ); +#endif } free( *hBinRenderer ); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index f4fe287de..0ad040129 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -105,47 +105,21 @@ ivas_error ivas_core_dec( STEREO_ICBWE_DEC_HANDLE hStereoICBWE; STEREO_TD_DEC_DATA_HANDLE hStereoTD; int16_t sharpFlag[CPE_CHANNELS]; - //float synth[CPE_CHANNELS][L_FRAME48k]; - //float tmp_buffer[L_FRAME48k]; - //float output[CPE_CHANNELS][L_FRAME48k]; - //fixedToFloat_arrL(output_32_fx[0],output[0],Q11,L_FRAME48k); - //if(n_channels > 1)fixedToFloat_arrL(output_32_fx[1],output[1],Q11,L_FRAME48k); -#ifdef IVAS_FLOAT_FIXED - //Word32 synth_fx[CPE_CHANNELS][L_FRAME48k]; - //set_zero( tmp_buffer, L_FRAME48k ); Word16 tmp_buffer_fx[L_FRAME48k]; - //Word32 tmp_buffer_fx_32[L_FRAME48k]; set_s(tmp_buffer_fx, 0, L_FRAME48k); Word16 tmp16 = 0, tmp16_2, j; Word16 Q_white_exc; Q_white_exc = 0; -#endif + int16_t tmps, incr; - //float bwe_exc_extended[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; -#ifdef IVAS_FLOAT_FIXED Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; -#endif - //float voice_factors[CPE_CHANNELS][NB_SUBFR16k]; -#ifdef IVAS_FLOAT_FIXED + Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; -#else - float voice_factors[CPE_CHANNELS][NB_SUBFR16k]; - float tmp; -#endif int16_t core_switching_flag[CPE_CHANNELS]; - //float old_syn_12k8_16k[CPE_CHANNELS][L_FRAME16k]; - //float pitch_buf[CPE_CHANNELS][NB_SUBFR16k]; -#ifdef IVAS_FLOAT_FIXED + Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; Word32 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k]; - //for ( i = 0; i < CPE_CHANNELS; i++ ) - //{ - // for ( int j = 0; j < NB_SUBFR16k; j++ ) - // { - // pitch_buf[i][j] = 0.f; - // } - //} -#endif + int16_t unbits[CPE_CHANNELS]; int16_t sid_bw[CPE_CHANNELS]; FRAME_MODE frameMode[CPE_CHANNELS]; @@ -153,25 +127,17 @@ ivas_error ivas_core_dec( int32_t element_brate, output_Fs; int32_t last_element_brate; int16_t use_cldfb_for_dft; - //float *p_output_mem; Word32 *p_output_mem_fx; int16_t flag_sec_CNA; int16_t read_sid_info; int16_t last_element_mode; int16_t nchan_out; - //float *save_hb_synth; Word32 *save_hb_synth_32_fx; ivas_error error; Word32 L_tmp; Word16 Q_synth; - //Word32 *output_32p_fx[CPE_CHANNELS]; Word16 output_16_fx[CPE_CHANNELS][L_FRAME48k]; - //Word32 output_32_fx[CPE_CHANNELS][L_FRAME48k]; - //output_32p_fx[0] = output_32_fx[0]; - //output_32p_fx[1] = output_32_fx[1]; - //float hb_synth[CPE_CHANNELS][L_FRAME48k]; Word16 hb_synth_16_fx[CPE_CHANNELS][L_FRAME48k]; - //Word32 hb_synth_32_fx[CPE_CHANNELS][L_FRAME48k]; Word16 synth_16_fx[CPE_CHANNELS][L_FRAME48k]; Word32 synth_32_fx[CPE_CHANNELS][L_FRAME48k]; @@ -180,17 +146,12 @@ ivas_error ivas_core_dec( { set16_fx( pitch_buf_fx[i], 0, NB_SUBFR16k ); set16_fx( output_16_fx[i], 0, L_FRAME48k ); - //set16_fx(hb_synth_16_fx[i], 0, L_FRAME48k); } -#ifdef IVAS_FLOAT_FIXED - //Word16 hb_synth_fx[6][L_FRAME48k]; /*not sure about number of channels so kept it as 6 will change it later*/ - //Word16 output_16fx[CPE_CHANNELS][L_FRAME48k]; - //Word16 synth_16fx[CPE_CHANNELS][L_FRAME48k]; Word32 pitch_buf_32fx[CPE_CHANNELS][NB_SUBFR16k]; Word16 tdm_lsfQ_PCh_fx[M], tdm_lspQ_PCh_fx[M]; Word32 conceal_eof_gain32; -#endif + #ifdef BASOP_NOGLOB Flag Overflow; #endif @@ -202,41 +163,6 @@ ivas_error ivas_core_dec( * General initialization *-----------------------------------------------------------------*/ -//#ifndef TO_BE_REMOVED_CONVERSION -// Word16 k; -// -// if ( hSCE != NULL ) -// { -// sts = hSCE->hCoreCoder; -// } -// else -// { -// sts = hCPE->hCoreCoder; -// } -// -// //core_coding_part will go in this loop, once the things are done -// for ( k = 0; k < n_channels; k++ ) -// { -// if ( sts[k]->hTcxDec != NULL ) -// { -// floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, 0, L_FRAME48k ); -// floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, 0, L_FRAME32k ); -// floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); -// //sts[k]->hTcxDec->conceal_eof_gain32 = floatToFixed( sts[k]->hTcxDec->conceal_eof_gain_float, 15 ); -// } -// } -// -// IF( sts[0]->element_mode == IVAS_CPE_MDCT && sts[0]->total_brate == SID_2k40 ) -// { -// FOR( Word16 ch = 0; ch < CPE_CHANNELS; ++ch ) -// { -// f2me_buf( sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, &sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand ); -// floatToFixed_arr( sts[ch]->hFdCngDec->hFdCngCom->A_cng_flt, sts[ch]->hFdCngDec->hFdCngCom->A_cng, Q14, M + 1 ); -// } -// } -// -//#endif - use_cldfb_for_dft = 0; tdm_LRTD_flag = -1; read_sid_info = 1; /* read SID by default */ @@ -249,7 +175,6 @@ ivas_error ivas_core_dec( last_element_brate = hSCE->last_element_brate; /* note: this parameter is unused */ last_element_mode = IVAS_SCE; hStereoTD = NULL; - //p_output_mem = NULL; p_output_mem_fx = NULL; nchan_out = 1; IF( st_ivas != NULL && st_ivas->ivas_format == ISM_FORMAT ) @@ -284,7 +209,6 @@ ivas_error ivas_core_dec( } output_Fs = sts[0]->output_Fs; - // output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); output_frame = extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) ); FOR( n = 0; n < n_channels; n++ ) @@ -404,13 +328,11 @@ ivas_error ivas_core_dec( IF( sba_dirac_stereo_flag && hSCE && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) { - //save_hb_synth = hSCE->save_hb_synth; floatToFixed_arrL( hSCE->save_hb_synth, hSCE->save_hb_synth_fx, Q11, output_frame ); save_hb_synth_32_fx = hSCE->save_hb_synth_fx; } ELSE { - //save_hb_synth = NULL; save_hb_synth_32_fx = NULL; } @@ -440,8 +362,6 @@ ivas_error ivas_core_dec( } #ifndef TO_BE_REMOVED_CONVERSION - // n_channels loop - // sts is initialized here for (Word16 k = 0; k < n_channels; k++ ) { if ( sts[k]->hTcxDec != NULL ) @@ -449,15 +369,12 @@ ivas_error ivas_core_dec( fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, 0, L_FRAME48k ); fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, 0, L_FRAME32k ); } - //fixedToFloat_arr( voice_factors_fx[k], voice_factors[k], 15, NB_SUBFR16k ); - //fixedToFloat_arrL( hb_synth_32_fx[k], hb_synth[k], 0, L_FRAME48k ); // 0 is assumed as original values are set to 0 } IF( sts[0]->element_mode == IVAS_CPE_MDCT && sts[0]->total_brate == SID_2k40 ) { FOR( Word16 ch = 0; ch < CPE_CHANNELS; ++ch ) { me2f_buf( sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand ); - //fixedToFloat_arr( sts[ch]->hFdCngDec->hFdCngCom->A_cng, sts[ch]->hFdCngDec->hFdCngCom->A_cng_flt, Q14, M + 1 ); } } @@ -510,41 +427,8 @@ ivas_error ivas_core_dec( *---------------------------------------------------------------------*/ #if 1 /*Float to fix conversions*/ - Word16/* Q_hb_prev_synth_buffer,*/ - /*Q_FBTCXdelayBuf = 15,*/ /*Q_prev_synth_buffer, */Q_syn_Overl = 15,/* Q_fer_samples = 15, */Q_old_syn_Overl = 15, /*Q_olapBufferAna = 15,*/ Q_olapBufferSynth = 15, - Q_olapBufferSynth2 = 15, Q_old_synthFB = 15; /*Initializing with max values to avoid warnings*/ - - //Q_hb_prev_synth_buffer = Q_factor_arr( st->hb_prev_synth_buffer, NS2SA( 48000, DELAY_BWE_TOTAL_NS ) ); - //Q_prev_synth_buffer = Q_factor_arr( st->prev_synth_buffer, 96 ); - //floatToFixed_arr( st->hb_prev_synth_buffer, st->hb_prev_synth_buffer_fx, Q_hb_prev_synth_buffer, NS2SA( 48000, DELAY_BWE_TOTAL_NS ) ); - - //IF( st->hHQ_core ) - //{ - // Q_fer_samples = Q_factor_arr( st->hHQ_core->fer_samples, 960 ); - //} - IF( st->hTcxDec ) - { - //Q_FBTCXdelayBuf = Q_factor_arr( st->hTcxDec->FBTCXdelayBuf_float, 111 ); - //Q_prev_synth_buffer = s_min( Q_prev_synth_buffer, Q_FBTCXdelayBuf ); - //Q_prev_synth_buffer = s_min( Q_prev_synth_buffer, 11 ); - //Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, 320 ); - //Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; - } - //Q_syn_Overl = s_min( 0, Q_syn_Overl ) - 1; - //IF( st->hHQ_core ) - //{ - - //} - IF( st->hTcxDec ) - { - //floatToFixed_arr16( st->hTcxDec->FBTCXdelayBuf_float, st->hTcxDec->FBTCXdelayBuf, Q_prev_synth_buffer, 111 ); - //floatToFixed_arrL( st->hTcxDec->FBTCXdelayBuf_float, st->hTcxDec->FBTCXdelayBuf_32, OUTPUT_Q, 111 ); - //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, Q_syn_Overl, 320 ); - //floatToFixed_arr16( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, Q_old_syn_Overl, L_FRAME32k / 2 ); - } - //floatToFixed_arr16( st->prev_synth_buffer, st->prev_synth_buffer_fx, Q_prev_synth_buffer, 96 ); - //floatToFixed_arr16( st->prev_synth_buffer, st->prev_synth_buffer_fx, 0, 96 ); - //st->q_prev_synth_buffer_fx = 0; + Word16 Q_olapBufferSynth = 15, Q_olapBufferSynth2 = 15; /*Initializing with max values to avoid warnings*/ + IF( st->cldfbAna ) { floatToFixed_arr32( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q10, st->cldfbAna->cldfb_state_length ); @@ -554,22 +438,9 @@ ivas_error ivas_core_dec( floatToFixed_arr32( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q11, st->cldfbSyn->cldfb_state_length ); } - //IF( st->hFdCngDec ) - //{ - // Q_olapBufferSynth2 = Q_factor_arrL( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, 640 ) - 1; - // floatToFixed_arr32( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, Q_olapBufferSynth2, 640 ); - //} IF( st->cldfbBPF ) floatToFixed_arr32( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q11, st->cldfbBPF->cldfb_state_length ); - IF( ( EQ_16( st->core, ACELP_CORE ) || EQ_16( st->core, AMR_WB_CORE ) ) && ( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) ) ) - { - IF( EQ_16( nchan_out, 1 ) && EQ_16( st->element_mode, IVAS_CPE_DFT ) && LE_32( st->element_brate, IVAS_24k4 ) && GT_32( last_element_brate, IVAS_24k4 ) ) - { - //Q_old_synthFB = Q_factor_arr( st->hTcxDec->old_synthFB, st->hTcxDec->old_synth_lenFB ) - 1; - //floatToFixed_arr16( st->hTcxDec->old_synthFB, st->hTcxDec->old_synthFB_fx, Q_old_synthFB, st->hTcxDec->old_synth_lenFB ); - } - } #endif Copy_Scale_sig_16_32( st->previoussynth_fx, st->previoussynth_fx_32, L_FRAME48k, 0 ); @@ -578,16 +449,6 @@ ivas_error ivas_core_dec( return error; } #if 1 /*Fixed to float function changes*/ - //fixedToFloat_arr( st->hb_prev_synth_buffer_fx, st->hb_prev_synth_buffer, Q_hb_prev_synth_buffer, NS2SA( 48000, DELAY_BWE_TOTAL_NS ) ); - //fixedToFloat_arr( st->prev_synth_buffer_fx, st->prev_synth_buffer, Q_prev_synth_buffer, 96 ); - //st->q_prev_synth_buffer_fx = Q_prev_synth_buffer; - //fixedToFloat_arr( st->prev_synth_buffer_fx, st->prev_synth_buffer, 0, 96 ); - //st->q_prev_synth_buffer_fx = 0; - - IF( st->hTcxDec ) - { - //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, Q_old_syn_Overl, L_FRAME32k / 2 ); - } IF( st->cldfbAna ) fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q10, st->cldfbAna->cldfb_state_length ); @@ -595,14 +456,6 @@ ivas_error ivas_core_dec( fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q11, st->cldfbSyn->cldfb_state_length ); IF( st->cldfbBPF ) fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q11, st->cldfbBPF->cldfb_state_length ); - IF( st->hHQ_core ) - { - - } - //IF( st->hFdCngDec ) - //{ - // fixedToFloat_arrL( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, Q_olapBufferSynth2, L_FRAME32k ); - //} #endif flag_sec_CNA = -1; @@ -620,7 +473,7 @@ ivas_error ivas_core_dec( IF ( st->core == ACELP_CORE ) { /* ACELP core decoder */ - Word16 /*output_fx[L_FRAME48k],*//* synth_fxl[L_FRAME48k],*/ old_syn_12k8_16k_fx_16[L_FRAME16k]; + Word16 old_syn_12k8_16k_fx_16[L_FRAME16k]; set_s(output_16_fx[n], 0, L_FRAME48k); Word16 save_hb_synth_fx_arr[L_FRAME48k], *save_hb_synth_16_fx; IF (save_hb_synth_32_fx) { @@ -629,13 +482,10 @@ ivas_error ivas_core_dec( ELSE { save_hb_synth_16_fx = NULL; } - //Word32 bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]; /* float2fix, to be removed */ - acelp_decoder_state_float2fix(st/*, hCPE == NULL ? NULL : hCPE->hStereoCng*/); - //if (hStereoTD) { - // floatToFixed_arr(hStereoTD->tdm_Pri_pitch_buf, hStereoTD->tdm_Pri_pitch_buf_fx, Q6, NB_SUBFR); - //} + acelp_decoder_state_float2fix(st); + IF( st->hFdCngDec != NULL ) { Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) ); @@ -652,26 +502,22 @@ ivas_error ivas_core_dec( /* fix2float, to be removed */ Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k, Q11 - st->Q_syn2); Scale_sig(output_16_fx[n], L_FRAME48k, -st->Q_syn2); - acelp_decoder_state_fix2float(st/*, hCPE == NULL ? NULL : hCPE->hStereoCng*/); - //fixedToFloat_arr(output_16_fx[n], output[n], 0, L_FRAME48k); - //fixedToFloat_arr(synth_16_fx[n], synth[n], 0, L_FRAME48k); + acelp_decoder_state_fix2float(st); + if ( save_hb_synth_32_fx ) { Copy_Scale_sig_16_32( save_hb_synth_16_fx, save_hb_synth_32_fx, output_frame, Q11 ); fixedToFloat_arrL( hSCE->save_hb_synth_fx, hSCE->save_hb_synth, negate( Q11 ), output_frame ); } - //fixedToFloat_arrL(bwe_exc_extended_fx, bwe_exc_extended[n], 2*st->Q_exc, L_FRAME32k + NL_BUFF_OFFSET); - //fixedToFloat_arr(voice_factors_fx[n], voice_factors[n], Q15, NB_SUBFR16k); - //fixedToFloat_arr(old_syn_12k8_16k_fx, old_syn_12k8_16k[n], -1, L_FRAME16k); + Copy_Scale_sig_16_32(old_syn_12k8_16k_fx_16, old_syn_12k8_16k_fx[n],L_FRAME16k,Q11 - (-1)); - //fixedToFloat_arr(pitch_buf_fx[n], pitch_buf[n], Q6, NB_SUBFR16k); } Copy_Scale_sig_32_16(st->previoussynth_fx_32, st->previoussynth_fx, L_FRAME48k, 0); IF( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { - Word16 Qsyn_temp = st->Q_syn; //Q gets change in below function. + Word16 Qsyn_temp = st->Q_syn; stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 1, last_element_mode, frameMode[n]); /* TCX decoder */ @@ -682,10 +528,7 @@ ivas_error ivas_core_dec( stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_32fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); - //fixedToFloat_arr( output_16_fx[n], output[n], 0, st->L_frame ); Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k,Q11); - //fixedToFloat_arr( synth_16_fx[n], synth[n], 0, st->hTcxDec->L_frameTCX ); - //fixedToFloat_arrL( pitch_buf_32fx[n], pitch_buf[n], Q6, NB_SUBFR16k ); Copy_Scale_sig_32_16(pitch_buf_32fx[n], pitch_buf_fx[n],NB_SUBFR16k,0); @@ -696,26 +539,18 @@ ivas_error ivas_core_dec( if ( st->core == HQ_CORE ) { /* HQ core decoder */ - //Word16 synth_fxl[L_FRAME48k]; - //Word16 output_fx[L_FRAME48k]; Q_synth = 0; Word16 Q_output = 0; HQ_DEC_HANDLE hHQ_core; - Word16 tmp_size = NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ); hHQ_core = st->hHQ_core; st->hHQ_core->Q_old_wtda = -1; st->hHQ_core->Q_old_wtda_LB = -1; - //floatToFixed_arr( synth[n], synth_16_fx[n], st->Q_syn, L_FRAME48k ); - //floatToFixed_arr( output[n], output_16_fx[n], st->Q_syn, L_FRAME48k ); - #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED floatToFixed_arr( hHQ_core->old_out, hHQ_core->old_out_fx, hHQ_core->Q_old_wtda, L_FRAME48k ); floatToFixed_arr( hHQ_core->old_outLB, hHQ_core->old_out_LB_fx, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1, L_FRAME32k / 2 ); - //floatToFixed_arr( st->hTcxDec->prev_good_synth - tmp_size, st->hTcxDec->prev_good_synth_fx - tmp_size, 0, 2 * output_frame + tmp_size ); #endif ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); @@ -723,15 +558,10 @@ ivas_error ivas_core_dec( Copy_Scale_sig_16_32(output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 - Q_output); Scale_sig(synth_16_fx[n], L_FRAME48k, -Q_synth); Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); - //fixedToFloat_arr( synth_16_fx[n], synth[n], 0, L_FRAME48k ); - //fixedToFloat_arr( output_16_fx[n], output[n], 0, L_FRAME48k ); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, -1, L_FRAME32k / 2 ); - //fixedToFloat_arr( st->hTcxDec->prev_good_synth_fx - tmp_size, st->hTcxDec->prev_good_synth - tmp_size, 0, 2 * output_frame + tmp_size ); - #endif } @@ -742,22 +572,12 @@ ivas_error ivas_core_dec( IF ( st->element_mode == IVAS_CPE_TD && n == 0 ) { - /* To be cleaned up once the caller function is converted // These changes are for system testing of fixed changes made */ - - //Word16 tdm_Pri_pitch_buf_fx[NB_SUBFR]; - Copy_Scale_sig_32_16(hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, 2 * NB_SUBFR16k + 2, -10); td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc, Q6 ); Copy_Scale_sig_16_32(hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, 2 * NB_SUBFR16k + 2, 10); - - //for ( i = 0; i < NB_SUBFR; i++ ) - //{ - // //hStereoTD->tdm_Pri_pitch_buf[i] = fix16_to_float( tdm_Pri_pitch_buf_fx[i], Q16 ); - // hStereoTD->tdm_Pri_pitch_buf[i] = fix16_to_float( tdm_Pri_pitch_buf_fx[i], Q6 ); - //} } } /* n_channels loop */ @@ -781,8 +601,6 @@ ivas_error ivas_core_dec( { #if 1 Word16 e_sig = 17; - //Word32 *output_fx[CPE_CHANNELS]; - //Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; Word16 ch; sts = hCPE->hCoreCoder; Word16 will_estimate_noise_on_channel[CPE_CHANNELS]; @@ -791,103 +609,26 @@ ivas_error ivas_core_dec( will_estimate_noise_on_channel[1] = sts[1]->core == TCX_20_CORE && !sts[1]->VAD; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { - //output_fx[ch] = malloc( sizeof( Word32 ) * L_FRAME48k ); - // synth_fx[ch] = malloc(sizeof(Word16) * L_FRAME48k); stereo_tcx_dec_mode_switch_reconf_To_fixed( sts[ch], 1, hCPE->last_element_mode ); st = sts[ch]; - IF( st->hTonalMDCTConc ) - { - FOR( i = 0; i < s_min( st->hTonalMDCTConc->nScaleFactors, 64 ); i++ ) - { - //st->hTonalMDCTConc->scaleFactorsBackground_fx[i] = floatToFixed( st->hTonalMDCTConc->scaleFactorsBackground_flt[i], 15 ); - } - - //if ( sts[0]->bfi && st->tonal_mdct_plc_active && st->hTonalMDCTConc->pTCI ) - //{ - // FOR( i = 0; i < s_min( st->hTonalMDCTConc->pTCI->numIndexes, 30 ); i++ ) - // { - // float pd = st->hTonalMDCTConc->pTCI->phaseDiff_float[i]; - // if ( pd >= PI2 ) - // pd = fmodf( pd, PI2 ) - PI2; - // st->hTonalMDCTConc->pTCI->phaseDiff[i] = (Word16) floatToFixed( pd, Q12 ); - // } - // FOR( i = 0; i < MAX_NUMBER_OF_IDX * GROUP_LENGTH; i++ ) - // { - // float pd = st->hTonalMDCTConc->pTCI->phase_currentFramePredicted_float[i]; - // pd = fmodf( pd, PI2 ); - // st->hTonalMDCTConc->pTCI->phase_currentFramePredicted[i] = (Word16) ( pd * ( 1u << Q13 ) ); - // } - //} - } - //IF( st->hTcxDec ) - //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 ); - - //if ( !sts[0]->bfi && ( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] ) ) - //{ - // sts[ch]->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx = floatToFixed( sts[ch]->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt, 31 ); - //} - IF( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] || sts[ch]->bfi ) - { - //for ( int p = 0; p < s_min( sts[ch]->hFdCngDec->hFdCngCom->fftlen, 640 ); p++ ) - //{ - // sts[ch]->hFdCngDec->hFdCngCom->fftBuffer[p] = (Word32) ( sts[ch]->hFdCngDec->hFdCngCom->fftBuffer_flt[p] * ( 1u << ( 31 - sts[ch]->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) ); - //} - //sts[ch]->hFdCngDec->msNoiseEst_exp = 31 - Q4; - //for ( int p = 0; p < NPART_SHAPING; p++ ) - //{ - //sts[ch]->hFdCngDec->msNoiseEst[p] = (Word32) ( sts[ch]->hFdCngDec->msNoiseEst_float[p] * ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); - //} - //sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q3; // Q3 - //IF( st->hFdCngDec && st->hFdCngDec->hFdCngCom ) - //{ - //FOR( Word16 ind = 0; ind < 340; ind++ ) - //{ - //st->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32) ( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * ( 1LL << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - //} - //st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = float_to_fix16( st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt, 15 ); - //} - } - - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->Q_syn, L_FRAME32k / 2 ); - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->Q_syn, L_FRAME_MAX / 2 ); st->prev_Q_syn = st->Q_syn; IF( st->hHQ_core ) floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->Q_syn, L_FRAME32k ); - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, -1 - st->Q_syn, L_FRAME_MAX / 2 ); - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, -1 - st->Q_syn, L_FRAME32k / 2 ); - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1 - st->Q_syn, L_FRAME32k / 2 ); - - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->old_excFB, st->hTcxDec->old_excFB_fx, st->Q_exc, s_min( 960, st->L_frame ) ); if ( !st->tcxonly ) { floatToFixed_arr( st->p_bpf_noise_buf_float, st->p_bpf_noise_buf, 0, L_FRAME_16k ); } - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, st->Q_syn, 1280 ); - //IF( st->hTcxDec ) - //floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, st->Q_syn, s_min( 2496, NS2SA( st->output_Fs, PH_ECU_MEM_NS ) ) ); - IF( st->hHQ_core ) floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); IF( st->hTonalMDCTConc ) floatToFixed_arr( st->hTonalMDCTConc->lastPcmOut_float, st->hTonalMDCTConc->lastPcmOut, 0, s_min( 960, st->hTonalMDCTConc->nSamples ) ); IF( st->hTonalMDCTConc ) floatToFixed_arr( st->hTonalMDCTConc->secondLastPcmOut_float, st->hTonalMDCTConc->secondLastPcmOut, 0, s_min( 960, st->hTonalMDCTConc->nSamples ) / 2 ); - //IF( st->hTcxDec ) - //st->hTcxDec->conceal_eof_gain = (Word16) floatToFixed( st->hTcxDec->conceal_eof_gain_float, Q14 ); - //IF( st->hTcxDec ) - //f2me_16( st->hTcxDec->CngLevelBackgroundTrace_bfi, &st->hTcxDec->conCngLevelBackgroundTrace, &st->hTcxDec->conCngLevelBackgroundTrace_e ); if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) { st->hTcxDec->conLastFrameLevel_e = 0; @@ -900,8 +641,6 @@ ivas_error ivas_core_dec( st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - //IF( st->hFdCngDec && st->hFdCngDec->hFdCngCom ) - //floatToFixed_arr( st->hFdCngDec->hFdCngCom->A_cng_flt, st->hFdCngDec->hFdCngCom->A_cng, 15, 17 ); } IF( st_ivas->hLsSetUpConversion ) @@ -928,63 +667,18 @@ ivas_error ivas_core_dec( FOR( ch = 0; ch < 2; ch++ ) { stereo_tcx_dec_mode_switch_reconf_To_fixed( sts[ch], 0, hCPE->last_element_mode ); - //me2f_buf( sts[ch]->hIGFDec->virtualSpec, sts[ch]->hIGFDec->virtualSpec_e, sts[ch]->hIGFDec->virtualSpec_float, ( N_MAX_TCX - IGF_START_MN ) ); + st = hCPE->hCoreCoder[ch]; - //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->Q_syn, L_FRAME_MAX / 2 ); - //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); - //st->hTcxDec->tcxltp_last_gain_unmodified_float = fix16_to_float( st->hTcxDec->tcxltp_last_gain_unmodified, Q15 ); - //st->hTcxDec->conceal_eof_gain_float = fix16_to_float( st->hTcxDec->conceal_eof_gain, Q14 ); - - //if ( sts[ch]->last_core != -1 && sts[ch]->nbLostCmpt == 1 ) - //{ - // if ( !( sts[ch]->rf_flag && sts[ch]->use_partial_copy && ( sts[ch]->rf_frame_type == RF_TCXTD1 || sts[ch]->rf_frame_type == RF_TCXTD2 ) ) ) - // { - // IF( sts[ch]->hTonalMDCTConc != NULL && sts[ch]->last_core == TCX_20_CORE && sts[ch]->second_last_core == TCX_20_CORE && ( ( sts[ch]->old_fpitch <= L_shl( sts[ch]->L_frame, 15 ) ) || ( sts[ch]->hTcxDec->tcxltp_last_gain_unmodified <= 13107 /*0.4f*/ ) ) - // /* it is fine to call the detection even if no ltp information - // is available, meaning that st->old_fpitch == - // st->tcxltp_second_last_pitch == st->L_frame */ - // && ( sts[ch]->old_fpitch == sts[ch]->hTcxDec->tcxltp_second_last_pitch ) && !sts[ch]->last_tns_active && !sts[ch]->second_last_tns_active ) - // { - - // if ( sts[ch]->hTonalMDCTConc->pTCI->numIndexes < MAX_NUMBER_OF_IDX ) - // { - // FOR( i = 0; i < s_min( 30, sts[ch]->hTonalMDCTConc->pTCI->numIndexes ); i++ ) - // { - // sts[ch]->hTonalMDCTConc->pTCI->phaseDiff_float[i] = fixedToFloat( sts[ch]->hTonalMDCTConc->pTCI->phaseDiff[i], Q12 ); - // } - // FOR( i = 0; i < MAX_NUMBER_OF_IDX * GROUP_LENGTH; i++ ) - // { - // sts[ch]->hTonalMDCTConc->pTCI->phase_currentFramePredicted_float[i] = fixedToFloat( sts[ch]->hTonalMDCTConc->pTCI->phase_currentFramePredicted[i], Q13 ); - // } - // } - // } - // } - //} - - //if ( !sts[0]->bfi && ( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] ) ) - //{ - // sts[ch]->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt = fixedToFloat( sts[ch]->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx, 31 ); - //} IF( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] || sts[ch]->bfi ) { if ( !sts[ch]->bfi ) { - //for ( int p = 0; p < s_min( 640, sts[ch]->hFdCngDec->hFdCngCom->fftlen ); p++ ) - //{ - // sts[ch]->hFdCngDec->hFdCngCom->fftBuffer_flt[p] = ( (float) sts[ch]->hFdCngDec->hFdCngCom->fftBuffer[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) ); - //} for ( int p = 0; p < s_min( 62, sts[ch]->hFdCngDec->npart_shaping ); p++ ) { sts[ch]->hFdCngDec->msNoiseEst_float[p] = ( (float) sts[ch]->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); } - - for ( int p = 0; p < s_min( 320, sts[ch]->hFdCngDec->hFdCngCom->stopFFTbin - sts[ch]->hFdCngDec->hFdCngCom->startBand ); p++ ) - { - //sts[ch]->hFdCngDec->bandNoiseShape_float[p] = ( (float) sts[ch]->hFdCngDec->bandNoiseShape[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->bandNoiseShape_exp ) ) ); - } - for ( int p = 0; p < s_min( 340, sts[ch]->hFdCngDec->hFdCngCom->stopFFTbin - sts[ch]->hFdCngDec->hFdCngCom->startBand ); p++ ) { sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); @@ -998,32 +692,10 @@ ivas_error ivas_core_dec( { sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); } - for ( int p = 0; p < FDNS_NPTS; p++ ) - { - //sts[ch]->hTonalMDCTConc->scaleFactorsBackground_flt[p] = (float) sts[ch]->hTonalMDCTConc->scaleFactorsBackground_fx[p] / ONE_IN_Q16; - } - } - if ( sts[ch]->element_mode != IVAS_CPE_MDCT || sts[ch]->core == ACELP_CORE ) - { - //int A_cng_q = 15 - norm_s( sts[ch]->hFdCngDec->hFdCngCom->A_cng[0] ); - for ( int p = 0; p < M; p++ ) - { - //sts[ch]->hFdCngDec->hFdCngCom->A_cng_flt[p] = ( (float) sts[ch]->hFdCngDec->hFdCngCom->A_cng[p] / ( 1u << A_cng_q ) ); - } } } } - //for ( int p = 0; p < s_min( 960, st->L_frame ); p++ ) - //{ - // st->hTcxDec->old_excFB[p] = (float) ( st->hTcxDec->old_excFB_fx[p] ) / ( 1u << st->Q_exc ); - //} - for ( int p = 0; p < s_min( 320, st->L_frame / 2 ); p++ ) - { - //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) ( (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * pow( 2, st->Q_syn ) ); - //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) ( (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * pow( 2, st->Q_syn ) ); - } for ( int p = 0; p < 640; p++ ) { st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); @@ -1034,19 +706,11 @@ ivas_error ivas_core_dec( fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); } - - //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, st->Q_syn, 1280 ); - //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, st->Q_syn, s_min( 2496, NS2SA( st->output_Fs, PH_ECU_MEM_NS ) ) ); - //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, s_min( 2496, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ) ); - for ( int p = 0; p < 960; p++ ) { st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); } - //IF( st->hTcxDec ) - //st->hTcxDec->CngLevelBackgroundTrace_bfi = me2f_16( st->hTcxDec->conCngLevelBackgroundTrace, st->hTcxDec->conCngLevelBackgroundTrace_e ); - IF( st->hTonalMDCTConc && st->hTonalMDCTConc->lastPcmOut_float ) fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, s_min( 960, st->hTonalMDCTConc->nSamples ) ); IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) @@ -1055,11 +719,6 @@ ivas_error ivas_core_dec( Scale_sig(synth_16_fx[0],L_FRAME48k,e_sig - 15); Scale_sig(synth_16_fx[1],L_FRAME48k,e_sig - 15); - - //fixedToFloat_arr( synth_16_fx[0], synth[0], 0, 960 ); - //fixedToFloat_arr( synth_16_fx[1], synth[1], 0, 960 ); - //fixedToFloat_arrL( output_32_fx[0], output[0], Q11, 960 ); - //fixedToFloat_arrL( output_32_fx[1], output[1], Q11, 960 ); #endif } } @@ -1067,54 +726,12 @@ ivas_error ivas_core_dec( ELSE IF( hCPE->nchan_out == 1 ) { #ifdef IVAS_FLOAT_FIXED - /* To be cleaned up once the caller function is converted // These changes are for system testing of fixed changes made */ - //double max_synth = 0.0f; - //Word16 Q_syn = 15/*, synth_fxl[CPE_CHANNELS][L_FRAME48k]*/; - //double max_output = 0.0f; - //Word16 Q_output = 31; - //Word32 output_fx[CPE_CHANNELS][L_FRAME48k]; sts[0] = hCPE->hCoreCoder[0]; sts[1] = hCPE->hCoreCoder[1]; if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - /*for ( int jj = 0; jj < output_frame; jj++ ) - { - max_synth = max( max_synth, fabs( synth[0][jj] ) ); - } - if ( (Word16) max_synth != 0 ) - { - Q_syn = norm_s( (Word16) max_synth ); - }*/ - - /*for ( int jj = 0; jj < output_frame; jj++ ) - { - synth_16_fx[0][jj] = float_to_fix16( synth[0][jj], 0 ); - }*/ - - //for ( int jj = 0; jj < output_frame; jj++ ) - //{ - // max_output = max( max_output, fabs( output[0][jj] ) ); - //} - //if ( (Word32) max_output != 0 ) - //{ - // Q_output = norm_l( (Word32) max_output ); - //} - - //for ( int jj = 0; jj < output_frame; jj++ ) - //{ - // output_32_fx[0][jj] = float_to_fix( output[0][jj], Q11 ); - //} - } - - if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) - { - //f2me_buf_16( sts[0]->hTcxLtpDec->tcxltp_mem_in_float, sts[0]->hTcxLtpDec->tcxltp_mem_in, &sts[0]->hTcxLtpDec->exp_tcxltp_mem_in, TCXLTP_MAX_DELAY ); - //f2me_buf_16( sts[1]->hTcxLtpDec->tcxltp_mem_in_float, sts[1]->hTcxLtpDec->tcxltp_mem_in, &sts[1]->hTcxLtpDec->exp_tcxltp_mem_in, TCXLTP_MAX_DELAY ); - //f2me_buf_16( sts[0]->hTcxLtpDec->tcxltp_mem_out_float, sts[0]->hTcxLtpDec->tcxltp_mem_out, &sts[0]->hTcxLtpDec->exp_tcxltp_mem_out, L_FRAME48k ); - //f2me_buf_16( sts[1]->hTcxLtpDec->tcxltp_mem_out_float, sts[1]->hTcxLtpDec->tcxltp_mem_out, &sts[1]->hTcxLtpDec->exp_tcxltp_mem_out, L_FRAME48k ); - f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); } @@ -1122,27 +739,10 @@ ivas_error ivas_core_dec( if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - //me2f_buf_16( sts[0]->hTcxLtpDec->tcxltp_mem_in, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in, sts[0]->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY ); - //me2f_buf_16( sts[0]->hTcxLtpDec->tcxltp_mem_out, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out, sts[0]->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k ); me2f_buf_16( sts[0]->hHQ_core->old_out_fx, sts[0]->hHQ_core->exp_old_out, sts[0]->hHQ_core->old_out, L_FRAME48k ); me2f_buf_16( sts[1]->hHQ_core->old_out_fx, sts[1]->hHQ_core->exp_old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); } - //for ( i = 1; i < CPE_CHANNELS; i++ ) - //{ - // for ( int jj = 0; jj < L_FRAME48k; jj++ ) - // { - // output[i][jj] = fix_to_float( output_32_fx[i][jj], Q11 ); - // } - //} - - /*for ( i = 1; i < CPE_CHANNELS; i++ ) - { - for ( int jj = 0; jj < output_frame; jj++ ) - { - synth[i][jj] = fix16_to_float( synth_16_fx[i][jj], 0 ); - } - }*/ #else updateBuffersForDmxMdctStereo( hCPE, output_frame, output, synth ); #endif @@ -1155,17 +755,8 @@ ivas_error ivas_core_dec( { IF ( NE_16(sts[n]->last_core_bfi, ACELP_CORE) ) { - //sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 27; - //for ( int p = 0; p < sts[n]->hFdCngDec->hFdCngCom->stopFFTbin - sts[n]->hFdCngDec->hFdCngCom->startBand; p++ ) - //{ - //sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = (Word32) ( sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] * ( 1u << ( 31 - sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - //} Scale_sig32(sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub(sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 27)); sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 27; - for ( int p = 0; p < FDNS_NPTS; p++ ) - { - //sts[n]->hTonalMDCTConc->scaleFactorsBackground_fx[p] = (Word32) ( sts[n]->hTonalMDCTConc->scaleFactorsBackground_flt[p] * ONE_IN_Q16 ); - } TonalMdctConceal_whiten_noise_shape_ivas_fx( sts[n], L_FRAME16k, ON_FIRST_GOOD_FRAME ); @@ -1173,10 +764,6 @@ ivas_error ivas_core_dec( { sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = (float) sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ); } - for ( int p = 0; p < FDNS_NPTS; p++ ) - { - //sts[n]->hTonalMDCTConc->scaleFactorsBackground_flt[p] = (float) sts[n]->hTonalMDCTConc->scaleFactorsBackground_fx[p] / ONE_IN_Q16; - } } } } @@ -1189,43 +776,15 @@ ivas_error ivas_core_dec( if ( sts[0]->element_mode == IVAS_CPE_TD && hCPE->hStereoCng != NULL ) { /* To be cleaned up once the caller function is converted // These changes are for system testing of fixed changes made */ - //Word32 output_fx[CPE_CHANNELS][L_FRAME16k]; - Word16 Q_c_PS_LT = 31, Q_output = 31; - double max_output_fx = 0; - - //for ( i = 0; i < CPE_CHANNELS; i++ ) - //{ - // for ( int jj = 0; jj < L_FRAME16k; jj++ ) - // { - // max_output_fx = max( max_output_fx, fabs( output[i][jj] ) ); - // } - //} - - if ( (Word32) max_output_fx != 0 ) - { - Q_output = norm_l( (Word32) max_output_fx ); - } - Q_output = 11; - //for ( i = 0; i < CPE_CHANNELS; i++ ) - //{ - // for ( int jj = 0; jj < L_FRAME16k; jj++ ) - // { - // output_32_fx[i][jj] = float_to_fix( output[i][jj], Q11 ); - // } - //} - - //if ( (Word32) hCPE->hStereoCng->c_PS_LT != 0 ) - //{ - // Q_c_PS_LT = norm_l( (Word32) hCPE->hStereoCng->c_PS_LT ); - //} - //Word32 c_PS_LT_fx = float_to_fix( hCPE->hStereoCng->c_PS_LT, Q_c_PS_LT ); + Word16 Q_c_PS_LT = 31, Q_output = 11; + Word32 c_PS_LT_fx = L_deposit_h( hCPE->hStereoCng->c_PS_LT_fx); Q_c_PS_LT = Q31; stereo_cng_compute_PScorr_fx( output_32_fx[0], output_32_fx[1], &Q_output, &c_PS_LT_fx, Q_c_PS_LT, sts[0]->L_frame, sts[1]->L_frame ); hCPE->hStereoCng->c_PS_LT_fx = extract_h( c_PS_LT_fx ); - //hCPE->hStereoCng->c_PS_LT = fix_to_float( c_PS_LT_fx, Q_c_PS_LT ); + } /*---------------------------------------------------------------------* @@ -1241,28 +800,7 @@ ivas_error ivas_core_dec( *---------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED - //Word32 hb_synth_fxg[CPE_CHANNELS][L_FRAME48k]; - if (st->last_core == ACELP_CORE && (st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE) && st->hBWE_TD != NULL) - { - FOR(int ch_ind = 0; ch_ind < n_channels; ch_ind++) - { - FOR(int ind = 0; ind < L_FRAME48k; ind++) - { - //hb_synth_32_fx[ch_ind][ind] = (Word32)(hb_synth[ch_ind][ind] * (1 << 11)); - } - } - //if (st->hBWE_TD != NULL) - //{ - // for (int i = 0; i < L_SHB_LAHEAD; i++) - // { - // for (int ii = 0; ii < L_SHB_LAHEAD; ii++) - // { - // st->hBWE_TD->syn_overlap_fx_32[ii] = (Word32)(st->hBWE_TD->syn_overlap[ii] * (1 << 11)); - // } - // } - //} - } /*cldfb struct*/ IF(st->hBWE_TD != NULL) { @@ -1276,32 +814,16 @@ ivas_error ivas_core_dec( st->hHQ_core->Q_old_postdec = 0; st->hHQ_core->Q_old_wtda = 0; } - st->bws_cnt = st->bws_cnt; - st->coder_type = st->coder_type; - st->prev_coder_type = st->prev_coder_type; - st->prev_bws_cnt = st->prev_bws_cnt; - st->old_ppp_mode = st->old_ppp_mode; /*------------------fix-to-fix-end-----------------------*/ - //Word16 *synth_fx16; - //Word16 *output_mem_fx; - Word16 output_mem_16_fx[L_FRAME48k]; Word16 *p_output_mem_16; - //synth_fx16 = (Word16 *)malloc(L_FRAME48k * sizeof(Word16)); - //Word32 output_fx32[L_FRAME48k]; - //output_mem_fx = (Word16 *)malloc(NS2SA(st->output_Fs, 3125000) * sizeof(Word16)); - - IF(p_output_mem_fx != NULL) { - //floatToFixed_arrL(p_output_mem, p_output_mem_fx, Q11, NS2SA_fx2(output_Fs, STEREO_DFT32MS_OVL_NS)); p_output_mem_16 = output_mem_16_fx; Copy_Scale_sig_32_16(p_output_mem_fx, p_output_mem_16, NS2SA_fx2(output_Fs, STEREO_DFT32MS_OVL_NS), negate(Q11)); - - //floatToFixed_arr(p_output_mem, output_mem_fx, 0, NS2SA(st->output_Fs, 3125000)); } ELSE { @@ -1309,31 +831,13 @@ ivas_error ivas_core_dec( set16_fx(output_mem_16_fx, 0, NS2SA(st->output_Fs, 3125000)); } - //floatToFixed_arr(synth[n], synth_16_fx[n], Q_synth, L_FRAME48k); - //floatToFixed_arrL(output[n], output_32_fx[n], Q11, L_FRAME48k); Scale_sig32(output_32_fx[n], L_FRAME48k, Q4 - Q11); - Word16 s_tmp; - s_tmp = extract_l(L_shr(st->output_Fs, 13)); - Word16 Fs_kHz = shl(add(s_tmp, 1), 3); - - Word16 delta = 1; - move16(); - IF(GE_16(output_frame, L_FRAME16k)) - { - delta = shr(Fs_kHz, 3); - } - IF(st->hHQ_core != NULL) { floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, 0, L_FRAME48k); } - //if (st->hTcxDec != NULL) - //{ - // st->hTcxDec->conceal_eof_gain = (Word16)floatToFixed(st->hTcxDec->conceal_eof_gain_float, 14); - //} - /*size of synth is choosen as delay comp to start with*/ /*-------------------cldfb-start-------------------------*/ @@ -1431,22 +935,9 @@ ivas_error ivas_core_dec( Scale_sig32(output_32_fx[n], L_FRAME48k, Q11 - Q4); #ifdef IVAS_FLOAT_FIXED - if (st->last_core == ACELP_CORE && (st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE) && st->hBWE_TD != NULL) - { - // Delete from here - FOR(int ch_ind = 0; ch_ind < n_channels; ch_ind++) - { - //fixedToFloat_arrL(hb_synth_32_fx[ch_ind], hb_synth[ch_ind], 11, L_FRAME48k); - } - } if (hSCE != NULL) { if (hSCE->save_synth != NULL)fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11, output_frame); } - if (sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !(st->core_brate == SID_2k40 && st->cng_type == FD_CNG)) - { - //mvr2r(synth[n], hSCE->save_synth, output_frame); - //fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11,output_frame); - } /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ @@ -1466,8 +957,7 @@ ivas_error ivas_core_dec( /*-------------------cldfb-end---------------------------*/ Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); - //fixedToFloat_arr(synth_16_fx[n], synth[n], 0, L_FRAME48k); - //fixedToFloat_arrL(output_32_fx[n], output[n], Q11, L_FRAME48k); + IF(st->hHQ_core != NULL) { fixedToFloat_arr(st->hHQ_core->old_out_fx, st->hHQ_core->old_out, 0, L_FRAME48k); @@ -1488,15 +978,6 @@ ivas_error ivas_core_dec( st->hBWE_FD->prev_flag = st->hBWE_FD->prev_flag; } - //free(synth_fx16); - //free(output_mem_fx); - - if (sba_dirac_stereo_flag && hSCE && st->core_brate == SID_2k40 && st->cng_type == FD_CNG) - { - //mvr2r(synth[n], hSCE->save_synth, output_frame); - //fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11,output_frame); - } - #endif /*---------------------------------------------------------------------* * WB TBE decoding @@ -1505,14 +986,7 @@ ivas_error ivas_core_dec( #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - //Word16 hb_synth_fx_16[CPE_CHANNELS][L_FRAME48k]; - //Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; - //Word16 output_fx_16[CPE_CHANNELS][L_FRAME48k]; - //Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; Word16 Q_input, Q_hb_synth_fx, Q_synth_fx; - - //Word32 synth_fx32[L_FRAME48k]; - //Word32 hb_synth_fx32[L_FRAME48k]; Word16 Q_syn_hb; Q_input = 0; @@ -1526,14 +1000,8 @@ ivas_error ivas_core_dec( FD_BWE_DEC_HANDLE hBWE_FD; hBWE_FD = st->hBWE_FD; - //floatToFixed_arrL( old_syn_12k8_16k[n], old_syn_12k8_16k_fx, Q11, L_FRAME16k ); // Can be removed got from last fn - - //floatToFixed_arrL( bwe_exc_extended[n], bwe_exc_extended_fx[n], 2 * st->Q_exc, L_FRAME32k + NL_BUFF_OFFSET ); Copy_Scale_sig_32_16(output_32_fx[n], output_16_fx[n], L_FRAME48k, negate(Q11)); Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, negate(Q11)); - //floatToFixed_arr( hb_synth[n], hb_synth_16_fx[n], Q_hb_synth_fx, L_FRAME48k ); - //floatToFixed_arr( output[n], output_16_fx[n], Q_input, L_FRAME48k ); - //floatToFixed_arr( synth[n], synth_16_fx[n], Q_synth_fx, L_FRAME48k ); IF( hBWE_TD != NULL ) { @@ -1598,7 +1066,7 @@ ivas_error ivas_core_dec( ivas_swb_tbe_dec_fx( st, hStereoICBWE, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], old_syn_12k8_16k_fx[n], tmp_buffer_fx /*fb_exc*/, hb_synth_32_fx[n], pitch_buf_fx[n], &Q_white_exc ); - Copy_Scale_sig_32_16( st->hBWE_TD->old_tbe_synth_fx_32, st->hBWE_TD->old_tbe_synth_fx, L_SHB_TRANSITION_LENGTH, st->prev_Qx - Q11 ); // Check + Copy_Scale_sig_32_16( st->hBWE_TD->old_tbe_synth_fx_32, st->hBWE_TD->old_tbe_synth_fx, L_SHB_TRANSITION_LENGTH, st->prev_Qx - Q11 ); IF( GT_16(Q_white_exc, 31 )) { @@ -1617,10 +1085,9 @@ ivas_error ivas_core_dec( /* SWB BWE decoder */ Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], use_cldfb_for_dft, output_frame ); - // Output Scale_sig32( hb_synth_32_fx[n], output_frame, Q11 - Q_syn_hb ); - Copy_Scale_sig_32_16( st->hBWE_FD->L_old_wtda_swb_fx32, st->hBWE_FD->L_old_wtda_swb_fx, output_frame, hBWE_FD->old_wtda_swb_fx_exp - Q11 ); // Check + Copy_Scale_sig_32_16( st->hBWE_FD->L_old_wtda_swb_fx32, st->hBWE_FD->L_old_wtda_swb_fx, output_frame, hBWE_FD->old_wtda_swb_fx_exp - Q11 ); } /*---------------------------------------------------------------------* @@ -1661,9 +1128,8 @@ ivas_error ivas_core_dec( IF ( ( output_frame >= L_FRAME32k && st->hTdCngDec != NULL ) || ( st->element_mode == IVAS_CPE_DFT && st->bwidth >= SWB && st->hTdCngDec != NULL ) ) { /* SHB CNG decoder */ - Word16 synth_fxl[960]/*, hb_synth_fxl[960]*/; /* Q-2 */ + Word16 synth_fxl[960]; /* Q-2 */ Word16 q = 2; - //st->prev_Q_bwe_syn2 = 0; Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -(Q11 + q)); Copy_Scale_sig_32_16(synth_32_fx[n], synth_fxl, L_FRAME48k, -(Q11 + q)); Scale_sig(st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, (Q8 - st->prev_Q_bwe_syn)); @@ -1681,15 +1147,9 @@ ivas_error ivas_core_dec( #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - //fixedToFloat_arrL(hb_synth_32_fx[n], hb_synth[n], Q11, L_FRAME48k); - //fixedToFloat_arrL(output_32_fx[n], output[n], Q11, L_FRAME48k); - //fixedToFloat_arrL(synth_32_fx[n], synth[n], Q11, L_FRAME48k); - //Copy_Scale_sig_32_16(synth_32_fx[n],synth_16_fx[n],L_FRAME48k,negate(Q11)); - IF(hBWE_TD != NULL) { fixedToFloat_arr(hBWE_TD->old_bwe_exc_extended_fx, hBWE_TD->old_bwe_exc_extended, st->prev_Q_bwe_exc - 16, NL_BUFF_OFFSET); - //fixedToFloat_arr(hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap, st->prev_Q_bwe_syn2, L_SHB_LAHEAD); // Check } #endif /*-------------------------------------------------------------------* @@ -1698,12 +1158,7 @@ ivas_error ivas_core_dec( test(); IF ( EQ_16(n, 0) && GE_16(st->element_mode, IVAS_CPE_DFT )) { - //Word32 *hb_synth_0 = (Word32 *) malloc( sizeof( Word32 ) * L_FRAME48k ); - //Word32 *hb_synth_1 = (Word32 *) malloc( sizeof( Word32 ) * L_FRAME48k ); Word16 q = 11; - //floatToFixed_arrL( hb_synth[0], hb_synth_32_fx[0], q, L_FRAME48k ); - //floatToFixed_arrL( hb_synth[1], hb_synth_32_fx[1], q, L_FRAME48k ); - if ( hCPE->hStereoDft != NULL ) { @@ -1713,10 +1168,6 @@ ivas_error ivas_core_dec( Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); - - //fixedToFloat_arrL( hb_synth_32_fx[0], hb_synth[0], q, L_FRAME48k ); - //fixedToFloat_arrL( hb_synth_32_fx[1], hb_synth[1], q, L_FRAME48k ); - Scale_sig32(hb_synth_32_fx[0], L_FRAME48k, sub(Q11 , q)); Scale_sig32(hb_synth_32_fx[1], L_FRAME48k, sub(Q11 , q)); @@ -1733,10 +1184,6 @@ ivas_error ivas_core_dec( hCPE->hStereoDft->td_gain[0] = 0; } } - - - //free( hb_synth_0 ); - //free( hb_synth_1 ); } IF( EQ_16( st->element_mode, EVS_MONO ) ) @@ -1802,13 +1249,6 @@ ivas_error ivas_core_dec( } set16_fx( st->hb_prev_synth_buffer_fx, 0, tmps ); -#if 1 //To be removed - /*for (i = 0; i < tmps; i++) - { - hb_synth[n][i] *= sin_table256[i * incr]; - }*/ - //set_f(st->hb_prev_synth_buffer, 0.0f, tmps); -#endif } ELSE IF ( LT_16(tmps, st->old_bwe_delay )) { @@ -1824,15 +1264,7 @@ ivas_error ivas_core_dec( tmp16 = add(tmp16, incr); } Copy(tmp_buffer_fx, st->hb_prev_synth_buffer_fx, tmps); -#if 0 //To be removed - for (i = 0; i < tmps; i++) - { - tmp_buffer[i] = st->hb_prev_synth_buffer[i] * sin_table256[255 - i * incr] + - st->hb_prev_synth_buffer[st->old_bwe_delay - 1 - i] * sin_table256[i * incr]; - } - mvr2r(tmp_buffer, st->hb_prev_synth_buffer, tmps); -#endif } ELSE IF ( GT_16(tmps, st->old_bwe_delay )) { @@ -1860,56 +1292,25 @@ ivas_error ivas_core_dec( } Copy( tmp_buffer_fx, st->hb_prev_synth_buffer_fx, tmps ); - -#if 0 //To be removed - for (i = 0; i < st->old_bwe_delay; i++) - { - tmp_buffer[i] = st->hb_prev_synth_buffer[i] * sin_table256[255 - i * incr]; - } - - for (; i < tmps; i++) - { - tmp_buffer[i] = 0.0f; - } - - for (i = 0; i < st->old_bwe_delay; i++) - { - tmp_buffer[tmps - 1 - i] += st->hb_prev_synth_buffer[st->old_bwe_delay - 1 - i] * sin_table256[i * incr]; - } - - mvr2r(tmp_buffer, st->hb_prev_synth_buffer, tmps); -#endif } test(); test(); test(); IF ( ( NE_16(st->element_mode, IVAS_CPE_TD) && !use_cldfb_for_dft ) || ( EQ_16(hCPE->element_mode, IVAS_CPE_TD) && tdm_LRTD_flag ) ) { /* Delay hb_synth */ - Word32 /*hb_synth_fxl[960],*/ hb_prev_synth_buffer_fx_32[111]; - //floatToFixed_arrL(hb_synth[n], hb_synth_fxl, Q11, 960); - //floatToFixed_arrL(st->hb_prev_synth_buffer, hb_prev_synth_buffer_fx_32, Q11, 111); + Word32 hb_prev_synth_buffer_fx_32[111]; Copy_Scale_sig_16_32(st->hb_prev_synth_buffer_fx, hb_prev_synth_buffer_fx_32, 111, 11); delay_signal_fx( hb_synth_32_fx[n], output_frame, hb_prev_synth_buffer_fx_32, tmps ); Copy_Scale_sig_32_16(hb_prev_synth_buffer_fx_32, st->hb_prev_synth_buffer_fx, 111, -11); - - //fixedToFloat_arrL(hb_synth_fxl, hb_synth[n], Q11, 960); - //fixedToFloat_arrL(hb_prev_synth_buffer_fx_32, st->hb_prev_synth_buffer, Q11, 111); } ELSE { - Copy_Scale_sig_32_16(hb_synth_32_fx[n] + output_frame - tmps, st->hb_prev_synth_buffer_fx, tmps,negate(Q11)); //ToDo: Scale Signl with appropriate Q. -#if 0 // TO BE REMOVED - mvr2r(hb_synth[n] + output_frame - tmps, st->hb_prev_synth_buffer, tmps); -#endif + Copy_Scale_sig_32_16(hb_synth_32_fx[n] + output_frame - tmps, st->hb_prev_synth_buffer_fx, tmps,negate(Q11)); } st->old_bwe_delay = tmps; #ifndef IVAS_FLOAT_FIXED - if ( st->hBWE_TD != NULL ) - { - //mvr2r( hb_synth[n], st->hBWE_TD->old_hb_synth, output_frame ); - } IF( st->hBWE_TD != NULL ) { Copy_Scale_sig_32_16( hb_synth_32_fx[n], st->hBWE_TD->old_hb_synth_fx, output_frame, negate( Q11 ) ); @@ -1921,10 +1322,7 @@ ivas_error ivas_core_dec( IF ( GE_16(output_frame, L_FRAME32k) && GT_16(st->extl, SWB_CNG) && EQ_16(st->core, ACELP_CORE) && st->hTdCngDec != NULL ) { #ifdef IVAS_FLOAT_FIXED - //Word32 hb_synth_fxl[960]; - //Word32 L_tmp; Word16 exp, fra; - //floatToFixed_arrL(hb_synth[n], hb_synth_32_fx[n], Q11, 960); #endif SWITCH(output_frame) { @@ -1969,33 +1367,6 @@ ivas_error ivas_core_dec( * - updates for potential TD->DFT stereo switching *----------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED - // TO DO delete below - //Word32 output_fx[CPE_CHANNELS][L_FRAME48k]; - //Word32 synth_fxg[CPE_CHANNELS][L_FRAME48k]; - //Word32 hb_synth_fxg[CPE_CHANNELS][L_FRAME48k]; - - FOR(int ch_ind = 0; ch_ind < n_channels; ch_ind++) - { - FOR(int ind = 0; ind < L_FRAME48k; ind++) - { - //output_32_fx[ch_ind][ind] = (Word32)(output[ch_ind][ind] * (1 << 11)); - //synth_32_fx[ch_ind][ind] = (Word32)(synth[ch_ind][ind] * (1 << 11)); - //hb_synth_32_fx[ch_ind][ind] = (Word32)(hb_synth[ch_ind][ind] * (1 << 11)); - } - } - //Word16 q_DFT[2] = { 3, 3 }; - //Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; - - //IF(DFT != NULL) - //{ - // FOR(int ind = 0; ind < CPE_CHANNELS; ind++) - // { - // FOR(int jj = 0; jj < STEREO_DFT_BUF_MAX; jj++) - // { - // DFT_fx[ind][jj] = (Word32)(DFT[ind][jj] * (1 << q_DFT[ind])); - // } - // } - //} if (hCPE != NULL) { @@ -2022,44 +1393,6 @@ ivas_error ivas_core_dec( } } } - IF(hCPE->hStereoDft != NULL) - { - FOR(int ind = 0; ind < NS2SA(16000, DELAY_BWE_TOTAL_NS); ind++) - { - hCPE->hStereoDft->ap_delay_mem_fx[ind] = (Word32)(hCPE->hStereoDft->ap_delay_mem[ind] * (1 << 11)); - } - hCPE->hStereoDft->q_ap_delay_mem_fx = 11; - IF(hCPE->hStereoDft->hTcxLtpDec != NULL) - { - FOR(Word32 p = 0; p < L_FRAME48k; p++) - { - //hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32)(hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] * (1u << OUTPUT_Q)); - } - FOR(Word32 p = 0; p < TCXLTP_MAX_DELAY; p++) - { - //hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32)(hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] * (1u << OUTPUT_Q)); - } - } - - } - IF(hCPE->hCoreCoder[ch_ind]->hTcxLtpDec != NULL) - { - FOR(Word32 p = 0; p < L_FRAME48k; p++) - { - //hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32)(hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_out_float[p] * (1u << OUTPUT_Q)); - } - FOR(Word32 p = 0; p < TCXLTP_MAX_DELAY; p++) - { - //hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32)(hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_in_float[p] * (1u << OUTPUT_Q)); - } - } - IF(hCPE->hCoreCoder[ch_ind]->hTcxDec != NULL) - { - FOR(Word32 kk = 0; kk < 111; kk++) - { - //hCPE->hCoreCoder[ch_ind]->hTcxDec->FBTCXdelayBuf_32[kk] = (Word32)(hCPE->hCoreCoder[ch_ind]->hTcxDec->FBTCXdelayBuf_float[kk] * (1 << OUTPUT_Q)); - } - } } } if (hSCE != NULL) @@ -2077,24 +1410,6 @@ ivas_error ivas_core_dec( hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] = (Word32)(hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] * (1 << 11)); } } - IF(hSCE->hCoreCoder[0]->hTcxDec != NULL) - { - FOR(Word32 kk = 0; kk < 111; kk++) - { - //hSCE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf_32[kk] = (Word32)(hSCE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf_float[kk] * (1 << OUTPUT_Q)); - } - } - IF(hSCE->hCoreCoder[0]->hTcxLtpDec != NULL) - { - FOR(Word32 p = 0; p < L_FRAME48k; p++) - { - //hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_out_32[p] = (Word32)(hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_out_float[p] * (1u << OUTPUT_Q)); - } - FOR(Word32 p = 0; p < TCXLTP_MAX_DELAY; p++) - { - //hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_in_32[p] = (Word32)(hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_in_float[p] * (1u << OUTPUT_Q)); - } - } } } @@ -2184,7 +1499,6 @@ ivas_error ivas_core_dec( Scale_sig(st->prev_synth_buffer_fx, NS2SA(48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS), exp_max - st->q_prev_synth_buffer_fx); Scale_sig(st->hTcxDec->synth_history_fx + output_frame, 2 * output_frame - NS2SA(st->output_Fs, DELAY_CLDFB_NS) + NS2SA(st->output_Fs, PH_ECU_MEM_NS) - output_frame, exp_max - st->Q_syn); - //st->hTcxDec->q_synth_history_fx = exp_max - st->q_prev_synth_buffer_fx; st->q_prev_synth_buffer_fx = exp_max - st->q_prev_synth_buffer_fx; } /* Save synthesis for HQ FEC */ @@ -2197,26 +1511,7 @@ ivas_error ivas_core_dec( Scale_sig( st->delay_buf_out_fx, NS2SA( st->output_Fs, DELAY_CLDFB_NS ), -exp_max ); #ifdef IVAS_FLOAT_FIXED - // TO DO delete below - FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ ) - { - FOR( i = 0; i < L_FRAME48k; i++ ) - { - //output[ch_ind][i] = fixedToFloat(output_32_fx[ch_ind][i], 11); - //synth[ch_ind][i] = (float) synth_32_fx[ch_ind][i] / (float) ( 1 << 11 ); - //hb_synth[ch_ind][i] = (float) hb_synth_32_fx[ch_ind][i] / (float) ( 1 << 11 ); - } - } - //IF( DFT != NULL ) - //{ - // FOR( i = 0; i < CPE_CHANNELS; i++ ) - // { - // FOR( Word16 jj = 0; jj < STEREO_DFT_BUF_MAX; jj++ ) - // { - // DFT[i][jj] = (float) DFT_fx[i][jj] / (float) ( 1 << q_DFT[i] ); - // } - // } - //} + if ( hCPE != NULL ) { @@ -2242,43 +1537,6 @@ ivas_error ivas_core_dec( hCPE->hCoreCoder[ch_ind]->p_bpf_noise_buf_float[ind] = (float) hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[ind] / (float) ( 1 << 11 ); } } - IF(hCPE->hCoreCoder[ch_ind]->hTcxLtpDec != NULL) - { - FOR(Word32 p = 0; p < L_FRAME48k; p++) - { - //hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_out_float[p] = (float)hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_out_32[p] / (1u << OUTPUT_Q); - } - FOR(Word32 p = 0; p < TCXLTP_MAX_DELAY; p++) - { - //hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_in_float[p] = (float)hCPE->hCoreCoder[ch_ind]->hTcxLtpDec->tcxltp_mem_in_32[p] / (1u << OUTPUT_Q); - } - } - IF(hCPE->hCoreCoder[ch_ind]->hTcxDec != NULL) - { - FOR(Word32 kk = 0; kk < 111; kk++) - { - //hCPE->hCoreCoder[ch_ind]->hTcxDec->FBTCXdelayBuf_float[kk] = (float)hCPE->hCoreCoder[ch_ind]->hTcxDec->FBTCXdelayBuf_32[kk] / (1 << OUTPUT_Q); - } - } - } - IF( hCPE->hStereoDft != NULL ) - { - FOR( int ind = 0; ind < NS2SA( 16000, DELAY_BWE_TOTAL_NS ); ind++ ) - { - hCPE->hStereoDft->ap_delay_mem[ind] = (float) hCPE->hStereoDft->ap_delay_mem_fx[ind] / (float) ( 1 << 11 ); - } - - IF(hCPE->hStereoDft->hTcxLtpDec != NULL) - { - FOR(Word32 p = 0; p < L_FRAME48k; p++) - { - //hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_float[p] = (float)hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_out_32[p] / (1u << OUTPUT_Q); - } - FOR(Word32 p = 0; p < TCXLTP_MAX_DELAY; p++) - { - //hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_float[p] = (float)hCPE->hStereoDft->hTcxLtpDec->tcxltp_mem_in_32[p] / (1u << OUTPUT_Q); - } - } } } } @@ -2298,34 +1556,8 @@ ivas_error ivas_core_dec( hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] = (float) hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] / (float) ( 1 << 11 ); } } - IF(hSCE->hCoreCoder[0]->hTcxDec != NULL) - { - FOR(Word32 kk = 0; kk < 111; kk++) - { - //hSCE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf_float[kk] = (float)hSCE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf_32[kk] / (1 << OUTPUT_Q); - } - } - IF(hSCE->hCoreCoder[0]->hTcxLtpDec != NULL) - { - FOR(Word32 p = 0; p < L_FRAME48k; p++) - { - //hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_out_float[p] = (float)hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_out_32[p] / (1u << OUTPUT_Q); - } - FOR(Word32 p = 0; p < TCXLTP_MAX_DELAY; p++) - { - //hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_in_float[p] = (float)hSCE->hCoreCoder[0]->hTcxLtpDec->tcxltp_mem_in_32[p] / (1u << OUTPUT_Q); - } - } } } - - if ((st->last_codec_mode == MODE1 && st->hTcxDec != NULL) && ((st->last_core == ACELP_CORE && !(st->bfi == 1 && st->last_con_tcx == 1)) || st->last_core == HQ_CORE)) - { - for (i = 0; i < 2 * output_frame + NS2SA(st->output_Fs, PH_ECU_LOOKAHEAD_NS); i++) - { - //fix2f_16(&st->hTcxDec->synth_history_fx[i], &st->hTcxDec->synth_history[i], st->hTcxDec->q_synth_history_fx); - } - } #endif } /* n_channels loop */ diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index e52a7b563..d6b5c3d6d 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -108,8 +108,6 @@ ivas_error ivas_cpe_dec_fx( element_brate_ref = hCPE->element_brate; move32(); -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED -#endif /*------------------------------------------------------------------* * Read stereo technology info & audio bandwidth *-----------------------------------------------------------------*/ @@ -122,12 +120,6 @@ ivas_error ivas_cpe_dec_fx( * dynamically allocate data structures depending on the actual stereo mode *----------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED - IF( ( error = stereo_memory_dec( ivas_total_brate, hCPE, nb_bits_metadata, st_ivas->hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) - { - return error; - } -#else #if 1 // Float to fix conversions float maxim = 0; Word16 q_output_mem, q_buff_LBTCX_mem, q_input_mem_LB, q_old_out = 31, q_old_out_LB = 31, q_tcxltp_mem_in_float; @@ -136,17 +128,6 @@ ivas_error ivas_cpe_dec_fx( q_buff_LBTCX_mem = 11; q_input_mem_LB = q_buff_LBTCX_mem; maxim = 0; - //FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) - //{ - // IF( hCPE->hCoreCoder[ind1] && hCPE->hCoreCoder[ind1]->hHQ_core ) - // FOR( Word16 ind2 = 0; ind2 < st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; ind2++ ) - // { - // maxim = fmaxf( fabsf( hCPE->hCoreCoder[ind1]->hHQ_core->old_out[ind2] ), maxim ); - // } - //} - //IF( maxim > 1.f ) - //q_old_out = norm_l( (Word32) maxim ); - //q_old_out -= 1; q_old_out = Q11; FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) { @@ -185,12 +166,6 @@ ivas_error ivas_cpe_dec_fx( IF( hCPE->hCoreCoder[ind2] && hCPE->hCoreCoder[ind2]->cldfbSyn ) hCPE->hCoreCoder[ind2]->cldfbSyn->scale = (Word16) ( hCPE->hCoreCoder[ind2]->cldfbSyn->scale_flt * ( 1u << norm_s( (Word16) hCPE->hCoreCoder[0]->cldfbSyn->scale_flt ) ) ); } - FOR(Word16 ind = 0; ind < L_FRAME16k / 2; ind++) { - //IF(hCPE->hCoreCoder[0] && hCPE->hCoreCoder[0]->hTcxDec) - //hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_32[ind] = (Word32)(hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_float[ind] * (ONE_IN_Q11)); - //IF(hCPE->hCoreCoder[1] && hCPE->hCoreCoder[1]->hTcxDec) - //hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_32[ind] = (Word32)(hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_float[ind] * (ONE_IN_Q11)); - } #endif // Float to fix conversions IF( ( error = stereo_memory_dec_fx( ivas_total_brate, hCPE, nb_bits_metadata, st_ivas->hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) @@ -214,13 +189,6 @@ ivas_error ivas_cpe_dec_fx( hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB[ind2] = (float) ( hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB_fx[ind2] ) / ( 1 << q_old_out_LB ); } } - FOR(Word16 ind = 0; ind < L_FRAME16k / 2; ind++) { - //IF(hCPE->hCoreCoder[0] && hCPE->hCoreCoder[0]->hTcxDec) - //hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_float[ind] = (float)hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_32[ind] / (float)(ONE_IN_Q11); - //IF(hCPE->hCoreCoder[1] && hCPE->hCoreCoder[1]->hTcxDec) - //hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_float[ind] = (float)hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_32[ind] / (float)(ONE_IN_Q11); - } -#endif // Fix to float conversions #endif /*------------------------------------------------------------------* @@ -598,13 +566,6 @@ ivas_error ivas_cpe_dec_fx( floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); } } - - IF( sts[0]->element_mode == IVAS_CPE_MDCT && sts[0]->total_brate == SID_2k40 ) - { - //f2me_buf(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, &sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand); - //floatToFixed_arr(sts[ch]->hFdCngDec->hFdCngCom->A_cng_flt, sts[ch]->hFdCngDec->hFdCngCom->A_cng, Q14, M + 1); - } - #endif IF( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { @@ -626,10 +587,9 @@ ivas_error ivas_cpe_dec_fx( test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && !( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) ) { - float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; - set_f( DFT[0], 0.0f, STEREO_DFT_BUF_MAX ); - set_f( DFT[1], 0.0f, STEREO_DFT_BUF_MAX ); + set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX ); + set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX ); #ifndef TO_BE_REMOVED_CONVERSION Word16 k; @@ -648,13 +608,10 @@ ivas_error ivas_cpe_dec_fx( FOR(Word16 ch = 0; ch < CPE_CHANNELS; ++ch) { f2me_buf(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, &sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand); - //floatToFixed_arr(sts[ch]->hFdCngDec->hFdCngCom->A_cng_flt, sts[ch]->hFdCngDec->hFdCngCom->A_cng, Q14, M + 1); } } #endif - set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX ); - set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX ); /* core decoder */ IF( ( error = ivas_core_dec( NULL, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, DFT_fx, 0 ) ) != IVAS_ERR_OK ) @@ -662,11 +619,7 @@ ivas_error ivas_cpe_dec_fx( return error; } - fixedToFloat_arrL( DFT_fx[0], DFT[0], hCPE->hStereoDft->q_dft, STEREO_DFT_BUF_MAX ); - fixedToFloat_arrL( DFT_fx[1], DFT[1], hCPE->hStereoDft->q_dft, STEREO_DFT_BUF_MAX ); - // Scaling of DFT's - // Word16 q_dft_tmp = s_min(getScaleFactor32(DFT_fx[0], STEREO_DFT_BUF_MAX), getScaleFactor32(DFT_fx[1], STEREO_DFT_BUF_MAX)); Word16 shift; Word32 tmp1, tmp2; maximum_abs_32_fx( DFT_fx[0], STEREO_DFT_BUF_MAX, &tmp1 ); @@ -694,14 +647,8 @@ ivas_error ivas_cpe_dec_fx( test(); IF( GT_16( hCPE->hStereoDft->res_cod_band_max, 0 ) && !st_ivas->bfi ) { -#ifndef IVAS_FLOAT_FIXED - stereo_dft_dec_res( hCPE, res_buf, output_flt[1] ); - - stereo_dft_dec_analyze( hCPE, output[1], DFT, 1, L_FRAME8k, output_frame, DFT_STEREO_DEC_ANA_LB, 0, 0 ); -#else - // Word32 output_fix[L_FRAME8k]; - hCPE->hStereoDft->q_res_cod_mem_fx = 0; // keeping same as shift needed inside. - floatToFixed_arrL( hCPE->hStereoDft->res_cod_mem, hCPE->hStereoDft->res_cod_mem_fx, Q16, sizeof( hCPE->hStereoDft->res_cod_mem_fx ) / sizeof( hCPE->hStereoDft->res_cod_mem_fx[0] ) ); + Word16 q = Q11; + Word16 q_out_DFT[2]; Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, 2 * NB_SUBFR16k + 2, -10 ); @@ -709,78 +656,23 @@ ivas_error ivas_cpe_dec_fx( Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, 2 * NB_SUBFR16k + 2, 10 ); - fixedToFloat_arrL( hCPE->hStereoDft->res_cod_mem_fx, hCPE->hStereoDft->res_cod_mem, Q16, sizeof( hCPE->hStereoDft->res_cod_mem_fx ) / sizeof( hCPE->hStereoDft->res_cod_mem_fx[0] ) ); - Scale_sig32( output[1], L_FRAME8k, Q11 - Q15 ); // Q15 -> Q11 -#endif - Word16 q = Q11; - Word16 q_out_DFT[2]; + q_out_DFT[0] = q_out_DFT[1] = hCPE->hStereoDft->q_dft; - // output in Q11, q not modified - // q_out_DFT only of 1 modified - stereo_dft_dec_analyze_fx( hCPE, output[1], DFT_fx, 1, L_FRAME8k, output_frame, DFT_STEREO_DEC_ANA_LB, 0, 0, &q, q_out_DFT ); // q not modified + stereo_dft_dec_analyze_fx( hCPE, output[1], DFT_fx, 1, L_FRAME8k, output_frame, DFT_STEREO_DEC_ANA_LB, 0, 0, &q, q_out_DFT ); Scale_sig32( DFT_fx[1], STEREO_DFT_BUF_MAX, hCPE->hStereoDft->q_dft - q_out_DFT[1] ); } - fixedToFloat_arrL( DFT_fx[0], DFT[0], hCPE->hStereoDft->q_dft, STEREO_DFT_BUF_MAX ); - fixedToFloat_arrL( DFT_fx[1], DFT[1], hCPE->hStereoDft->q_dft, STEREO_DFT_BUF_MAX ); - /* DFT stereo CNG */ -#ifndef IVAS_FLOAT_FIXED - stereo_dtf_cng( hCPE, ivas_total_brate, DFT, output_frame ); -#else { Word16 q_dft; -#if 0 - Word16 q_smoothed_psd; - float max_val = 0.0; - int i_max_val = 0, i_max_val_psd = 0; - for (int ii = 0; ii < sizeof(DFT) / sizeof(DFT[0]); ii++) - { - for (int jj = 0; jj < sizeof(DFT[0]) / sizeof(DFT[0][0]); jj++) - { - if (max_val < fabs(DFT[ii][jj])) - { - max_val = (float)fabs(DFT[ii][jj]); - } - } - } - //max_val = 0.0; - //for (int ii = 0; ii < sizeof(sts[0]->hFdCngDec->smoothed_psd) / sizeof(sts[0]->hFdCngDec->smoothed_psd[0]); ii++) - //{ - // if (max_val < fabs(sts[0]->hFdCngDec->smoothed_psd[ii])) - // { - // max_val = (float)fabs(sts[0]->hFdCngDec->smoothed_psd[ii]); - // } - //} - //i_max_val_psd = (int)max_val; - //sts[0]->hFdCngDec->q_smoothed_psd = norm_l(i_max_val_psd) - Q4; - i_max_val = (int)max_val; - if (i_max_val !=0) - q_dft = s_min(Q8, norm_l(i_max_val)); - else - q_dft = Q8; -#endif q_dft = hCPE->hStereoDft->q_dft; - // hCPE->hStereoDft->q_dft = norm_l(i_max_val); - // IF (hCPE->hStereoDft->q_dft > Q8) - //{ - // hCPE->hStereoDft->q_dft = Q8; - //} - //floatToFixed_arrL(sts[0]->hFdCngDec->bandNoiseShape_float, sts[0]->hFdCngDec->bandNoiseShape, Q31 - sts[0]->hFdCngDec->bandNoiseShape_exp, FFTLEN2); - floatToFixed_arrL(&DFT[0][0], &DFT_fx[0][0], q_dft, sizeof(DFT) / sizeof(DFT[0][0])); - //floatToFixed_arr(&hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG[0], &hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG_fx[0], Q15, sizeof(hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG_fx) / sizeof(hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG_fx[0])); floatToFixed_arr(&hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); floatToFixed_arr(&hCPE->hStereoCng->coh[0], &hCPE->hStereoCng->coh_fx[0], Q15, sizeof(hCPE->hStereoCng->coh_fx) / sizeof(hCPE->hStereoCng->coh_fx[0]) ); - //floatToFixed_arrL(&sts[0]->hFdCngDec->smoothed_psd[0], &sts[0]->hFdCngDec->smoothed_psd_fx[0], sts[0]->hFdCngDec->q_smoothed_psd, sizeof(sts[0]->hFdCngDec->smoothed_psd_fx) / sizeof(sts[0]->hFdCngDec->smoothed_psd_fx[0])); - //floatToFixed_arrL(&hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[0], - // &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[0], - // 0, - // FFTCLDFBLEN); //TODO : To check this hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel = Q31 - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp; @@ -790,59 +682,15 @@ ivas_error ivas_cpe_dec_fx( &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[0], hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel, FFTCLDFBLEN ); - // fixedToFloat_arrL(&sts[0]->hFdCngDec->smoothed_psd_fx[0], &sts[0]->hFdCngDec->smoothed_psd[0], sts[0]->hFdCngDec->q_smoothed_psd, sizeof(sts[0]->hFdCngDec->smoothed_psd_fx) / sizeof(sts[0]->hFdCngDec->smoothed_psd_fx[0])); fixedToFloat_arr( &hCPE->hStereoCng->coh_fx[0], &hCPE->hStereoCng->coh[0], Q15, sizeof( hCPE->hStereoCng->coh_fx ) / sizeof( hCPE->hStereoCng->coh_fx[0] ) ); fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - // fixedToFloat_arr(&hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG_fx[0], &hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG[0], Q15, sizeof(hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG) / sizeof(hCPE->hCoreCoder[0]->hTdCngDec->shb_lpcCNG[0])); - // fixedToFloat_arrL(sts[0]->hFdCngDec->bandNoiseShape, sts[0]->hFdCngDec->bandNoiseShape_float, Q31 - sts[0]->hFdCngDec->bandNoiseShape_exp, FFTLEN2); - fixedToFloat_arrL( &DFT_fx[0][0], &DFT[0][0], q_dft, sizeof( DFT ) / sizeof( DFT[0][0] ) ); } -#endif /* decoding */ IF( EQ_16( hCPE->nchan_out, 1 ) ) { #if 1 float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; -#if 0 - float max_val = 0.0; - int i_max_val = 0, i_max_val_psd; - //for (int ii = 0; ii < sizeof(sts[0]->hFdCngDec->smoothed_psd) / sizeof(sts[0]->hFdCngDec->smoothed_psd[0]); ii++) - //{ - // if (max_val < fabs(sts[0]->hFdCngDec->smoothed_psd[ii])) - // { - // max_val = (float)fabs(sts[0]->hFdCngDec->smoothed_psd[ii]); - // } - //} - //i_max_val_psd = (int)max_val; - //sts[0]->hFdCngDec->q_smoothed_psd = norm_l(i_max_val_psd) - Q4; - max_val = 0.0; - for (int ii = 0; ii < sizeof(DFT) / sizeof(DFT[0]); ii++) - { - for (int jj = 0; jj < sizeof(DFT[0]) / sizeof(DFT[0][0]); jj++) - { - if (max_val < fabs(DFT[ii][jj])) - { - max_val = (float)fabs(DFT[ii][jj]); - } - } - } - i_max_val = (int)max_val; - hCPE->hStereoDft->q_dft = norm_l(i_max_val) - Q6; - IF(hCPE->hStereoDft->q_dft > Q15) - { - hCPE->hStereoDft->q_dft = Q15; - } - ELSE IF(hCPE->hStereoDft->q_dft < 0) - { - hCPE->hStereoDft->q_dft = 0; - } - //hCPE->hStereoDft->q_dft = s_min(hCPE->hStereoDft->q_dft, sts[0]->hFdCngDec->q_smoothed_psd); - IF(hCPE->hStereoDft->q_dft < 0) - { - hCPE->hStereoDft->q_dft = 0; - } -#endif IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; @@ -853,8 +701,9 @@ ivas_error ivas_cpe_dec_fx( hCPE->hStereoDft->first_frame = 0; } - floatToFixed_arrL( &DFT[0][0], &DFT_fx[0][0], hCPE->hStereoDft->q_dft, sizeof( DFT ) / sizeof( DFT[0][0] ) ); - floatToFixed_arrL( &hCPE->hStereoDft->res_cod_mem[0], &hCPE->hStereoDft->res_cod_mem_fx[0], hCPE->hStereoDft->q_dft, sizeof( hCPE->hStereoDft->res_cod_mem_fx ) / sizeof( hCPE->hStereoDft->res_cod_mem_fx[0] ) ); + scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); + hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; + for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) { if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] ) @@ -896,18 +745,9 @@ ivas_error ivas_cpe_dec_fx( #endif stereo_dft_unify_dmx_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng->prev_sid_nodata ); #if 1 - if ( hCPE->hStereoDft->res_cod_band_max > 0 ) - { - if ( !sts[0]->bfi ) - { - fixedToFloat_arrL( &hCPE->hStereoDft->res_mem_fx[0], &hCPE->hStereoDft->res_mem[0], hCPE->hStereoDft->q_res_mem, 2 * hCPE->hStereoDft->band_limits[hCPE->hStereoDft->res_cod_band_max] ); - } - else - { - fixedToFloat_arrL( &hCPE->hStereoDft->res_cod_mem_fx[0], &hCPE->hStereoDft->res_cod_mem[0], hCPE->hStereoDft->q_res_cod_mem_fx, sizeof( hCPE->hStereoDft->res_cod_mem_fx ) / sizeof( hCPE->hStereoDft->res_cod_mem_fx[0] ) ); - } - } - fixedToFloat_arrL( &DFT_fx[0][0], &DFT[0][0], hCPE->hStereoDft->q_dft, ( sizeof( DFT ) / ( 2 * sizeof( DFT[0][0] ) ) ) ); + scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) ); + hCPE->hStereoDft->q_res_cod_mem_fx = Q16; + for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) { hCPE->hStereoDft->hb_nrg_subr[0] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); @@ -923,46 +763,8 @@ ivas_error ivas_cpe_dec_fx( ELSE { float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; +#if 1 { -#if 0 - float max_val = 0.0; - int i_max_val = 0, i_max_val_psd; - //for (int ii = 0; ii < sizeof(sts[0]->hFdCngDec->smoothed_psd) / sizeof(sts[0]->hFdCngDec->smoothed_psd[0]); ii++) - //{ - // if (max_val < fabs(sts[0]->hFdCngDec->smoothed_psd[ii])) - // { - // max_val = (float)fabs(sts[0]->hFdCngDec->smoothed_psd[ii]); - // } - //} - //i_max_val_psd = (int)max_val; - //sts[0]->hFdCngDec->q_smoothed_psd = norm_l(i_max_val_psd) - Q4; - max_val = 0.0; - for (int ii = 0; ii < sizeof(DFT) / sizeof(DFT[0]); ii++) - { - for (int jj = 0; jj < sizeof(DFT[0]) / sizeof(DFT[0][0]); jj++) - { - if (max_val < fabs(DFT[ii][jj])) - { - max_val = (float)fabs(DFT[ii][jj]); - } - } - } - i_max_val = (int)max_val; - hCPE->hStereoDft->q_dft = norm_l(i_max_val) - Q6; - IF (hCPE->hStereoDft->q_dft > Q15) - { - hCPE->hStereoDft->q_dft = Q15; - } - ELSE IF(hCPE->hStereoDft->q_dft < 0) - { - hCPE->hStereoDft->q_dft = 0; - } - //hCPE->hStereoDft->q_dft = s_min(hCPE->hStereoDft->q_dft, sts[0]->hFdCngDec->q_smoothed_psd); - IF (hCPE->hStereoDft->q_dft < 0) - { - hCPE->hStereoDft->q_dft = 0; - } -#endif IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; @@ -973,10 +775,9 @@ ivas_error ivas_cpe_dec_fx( hCPE->hStereoDft->first_frame = 0; } - // sts[0]->hFdCngDec->cna_rescale_fact_fx = (Word16)floatToFixed(sts[0]->hFdCngDec->cna_rescale_fact, 15); - // floatToFixed_arrL(&sts[0]->hFdCngDec->smoothed_psd[0], &sts[0]->hFdCngDec->smoothed_psd_fx[0], sts[0]->hFdCngDec->q_smoothed_psd, sizeof(sts[0]->hFdCngDec->smoothed_psd_fx) / sizeof(sts[0]->hFdCngDec->smoothed_psd_fx[0])); - floatToFixed_arrL( &DFT[0][0], &DFT_fx[0][0], hCPE->hStereoDft->q_dft, sizeof( DFT ) / sizeof( DFT[0][0] ) ); - floatToFixed_arrL( &hCPE->hStereoDft->res_cod_mem[0], &hCPE->hStereoDft->res_cod_mem_fx[0], hCPE->hStereoDft->q_dft, sizeof( hCPE->hStereoDft->res_cod_mem_fx ) / sizeof( hCPE->hStereoDft->res_cod_mem_fx[0] ) ); + scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); + hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; + for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) { if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] ) @@ -1014,15 +815,12 @@ ivas_error ivas_cpe_dec_fx( hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); } - // floatToFixed_arr(&sts[0]->hFdCngDec->cna_cm[0], &sts[0]->hFdCngDec->cna_cm_fx[0], Q15, sizeof(sts[0]->hFdCngDec->cna_cm_fx) / sizeof(sts[0]->hFdCngDec->cna_cm_fx[0])); floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - // floatToFixed_arr(&sts[0]->hFdCngDec->cna_g_state[0], &sts[0]->hFdCngDec->cna_g_state_fx[0], Q15, sizeof(sts[0]->hFdCngDec->cna_g_state_fx) / sizeof(sts[0]->hFdCngDec->cna_g_state_fx[0])); } +#endif stereo_dft_dec_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); +#if 1 { - // sts[0]->hFdCngDec->cna_rescale_fact = fixedToFloat(sts[0]->hFdCngDec->cna_rescale_fact_fx, 15); - // fixedToFloat_arrL(&sts[0]->hFdCngDec->smoothed_psd_fx[0], &sts[0]->hFdCngDec->smoothed_psd[0], sts[0]->hFdCngDec->q_smoothed_psd, sizeof(sts[0]->hFdCngDec->smoothed_psd_fx) / sizeof(sts[0]->hFdCngDec->smoothed_psd_fx[0])); - fixedToFloat_arrL( &DFT_fx[0][0], &DFT[0][0], hCPE->hStereoDft->q_dft, sizeof( DFT ) / sizeof( DFT[0][0] ) ); for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) { hCPE->hStereoDft->hb_nrg_subr[0] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); @@ -1031,12 +829,13 @@ ivas_error ivas_cpe_dec_fx( { hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); } - // fixedToFloat_arr(&sts[0]->hFdCngDec->cna_cm_fx[0], &sts[0]->hFdCngDec->cna_cm[0], Q15, sizeof(sts[0]->hFdCngDec->cna_cm_fx) / sizeof(sts[0]->hFdCngDec->cna_cm_fx[0])); fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - // fixedToFloat_arr(&sts[0]->hFdCngDec->cna_g_state_fx[0], &sts[0]->hFdCngDec->cna_g_state[0], Q15, sizeof(sts[0]->hFdCngDec->cna_g_state_fx) / sizeof(sts[0]->hFdCngDec->cna_g_state_fx[0])); fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q15, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->res_cod_mem_fx[0], &hCPE->hStereoDft->res_cod_mem[0], hCPE->hStereoDft->q_dft, sizeof( hCPE->hStereoDft->res_cod_mem_fx ) / sizeof( hCPE->hStereoDft->res_cod_mem_fx[0] ) ); + + scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) ); + hCPE->hStereoDft->q_res_cod_mem_fx = Q16; } +#endif } FOR( n = 0; n < hCPE->nchan_out; n++ ) @@ -1050,15 +849,7 @@ ivas_error ivas_cpe_dec_fx( /* synthesis iFFT */ FOR( n = 0; n < hCPE->nchan_out; n++ ) { -#ifndef IVAS_FLOAT_FIXED - stereo_dft_dec_synthesize( hCPE, DFT, n, output_flt[n], output_frame ); -#else - floatToFixed_arrL( &DFT[n][0], &DFT_fx[n][0], hCPE->hStereoDft->q_dft, sizeof( DFT[n] ) / sizeof( DFT[0][0] ) ); - stereo_dft_dec_synthesize_fx( hCPE, DFT_fx, n, output[n], output_frame ); - - fixedToFloat_arrL( &DFT_fx[n][0], &DFT[n][0], hCPE->hStereoDft->q_dft, sizeof( DFT_fx[n] ) / sizeof( DFT_fx[0][0] ) ); -#endif } // delete below @@ -1202,8 +993,6 @@ ivas_error ivas_cpe_dec_fx( st_ivas->BER_detect = s_or( st_ivas->BER_detect, sts[0]->BER_detect ); st_ivas->BER_detect = s_or( st_ivas->BER_detect, sts[1]->BER_detect ); -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED -#endif pop_wmops(); return error; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 2715e6abe..34be75e2e 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3599,7 +3599,7 @@ void ivas_dirac_dec_render_sf_fx( float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - int16_t index, num_freq_bands; + int16_t index = 0, num_freq_bands = 0; /* local copies of azi, ele, diffuseness */ Word16 azimuth[CLDFB_NO_CHANNELS_MAX]; @@ -3623,8 +3623,9 @@ void ivas_dirac_dec_render_sf_fx( Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; set_zero_fx(surCohRatio_fx, CLDFB_NO_CHANNELS_MAX); - Word16 q_cldfb, q_temp_cldfb;; + Word16 q_cldfb, q_temp_cldfb = 0; //Word32 proto_frame_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; + Word32 proto_direct_buffer_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; Word32 proto_power_smooth_fx[2 * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; Word32 reference_power_fix[5 * CLDFB_NO_CHANNELS_MAX]; @@ -3810,7 +3811,7 @@ void ivas_dirac_dec_render_sf_fx( } IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { - Word16 val = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + //Word16 val = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; FOR( i = 0; i < 32; i++ ) { Word16 exp1 = 0, exp2 = 0, exp3 = 0; @@ -5477,7 +5478,9 @@ void ivas_dirac_dec_render_sf_fx( if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f ) { float *tc_re, *tc_im; + float *w1, w2; + w1 = &st_ivas->hIsmRendererData->interpolator[interp_offset]; tc_re = pppQMfFrame_ts_re[nchan_transport + i][0]; tc_im = pppQMfFrame_ts_im[nchan_transport + i][0]; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 374a0dc9a..2d3686cfa 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -1441,7 +1441,7 @@ Word16 computeMixingMatrices_fx( Word32 svd_u_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; Word32 svd_v_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - Word16 mat_mult_buffer1_fx_e; + //Word16 mat_mult_buffer1_fx_e; Word16 Cx_fx_e; Word16 Cy_fx_e; Word16 svd_u_buffer_fx_e[MAX_OUTPUT_CHANNELS]; @@ -1493,7 +1493,7 @@ Word16 computeMixingMatrices_fx( Word32 adj_fx[MAX_OUTPUT_CHANNELS]; Word16 adj_e[MAX_OUTPUT_CHANNELS]; Word32 *adj_fx_p; - Word32 adj_buff_fx[MAX_OUTPUT_CHANNELS]; + //Word32 adj_buff_fx[MAX_OUTPUT_CHANNELS]; Word16 adj_fx_e; Word32 *Cr_p_fx, *Cy_tilde_p_fx, *Cy_p_fx; @@ -2278,8 +2278,8 @@ Word16 computeMixingMatricesResidual_fx( { Word16 i, j; Word16 out = EXIT_SUCCESS; - Word16 lengthCx = num_outputs; - Word16 lengthCy = num_outputs; + Word16 lengthCx = extract_l(num_outputs); + Word16 lengthCy = extract_l(num_outputs); #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED float svd_in_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; @@ -2303,7 +2303,7 @@ Word16 computeMixingMatricesResidual_fx( Word32 mat_mult_buffer1_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; Word32 adj_fx[MAX_OUTPUT_CHANNELS]; Word32 mat_mult_buffer3_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - Word16 mixing_matrix_e, mat_mult_buffer1_e, adj_e, mat_mult_buffer3_e, mat_mult_buffer2_e; + Word16 mixing_matrix_e = 0, mat_mult_buffer1_e, adj_e, mat_mult_buffer3_e, mat_mult_buffer2_e; Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS]; Word16 svd_s_buffer_fx_e; @@ -2487,7 +2487,7 @@ Word16 computeMixingMatricesResidual_fx( *-----------------------------------------------------------------*/ /* Computing Cy_hat_diag */ - Copy32(Cx_fx, Cy_hat_diag_fx, num_outputs); + Copy32(Cx_fx, Cy_hat_diag_fx, extract_l(num_outputs)); Cy_hat_diag_e = Cx_e; FOR ( i = 0; i < lengthCy; ++i ) @@ -2545,7 +2545,7 @@ Word16 computeMixingMatricesResidual_fx( { L_tmp = Mpy_32_32(Ky_fx[i + j * num_outputs], fac_fx); mat_mult_buffer1_fx[i + j * num_outputs] = L_tmp; - mat_mult_buffer1_buff_e[i + j * num_outputs] = L_add( Ky_fx_e[i + j * num_outputs], Kx_fx_e[i] ); + mat_mult_buffer1_buff_e[i + j * num_outputs] = extract_l(L_add( Ky_fx_e[i + j * num_outputs], Kx_fx_e[i] )); } } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4cf481f52..b962184bb 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3935,7 +3935,7 @@ void ivas_destroy_dec( free( st_ivas->mem_hp20_out_fx ); st_ivas->mem_hp20_out_fx = NULL; } -#else +#endif IF(st_ivas->mem_hp20_out != NULL) { FOR(i = 0; i < getNumChanSynthesis(st_ivas); i++) @@ -3946,7 +3946,6 @@ void ivas_destroy_dec( free(st_ivas->mem_hp20_out); st_ivas->mem_hp20_out = NULL; } -#endif /* ISM metadata handles */ ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); @@ -4067,11 +4066,16 @@ void ivas_destroy_dec( IF ( st_ivas->hBinRendererTd != NULL ) { ivas_td_binaural_close( &st_ivas->hBinRendererTd ); +#ifdef IVAS_FLOAT_FIXED + ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); +#endif } ELSE IF ( st_ivas->hHrtfTD != NULL ) { BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); - +#ifdef IVAS_FLOAT_FIXED + BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); +#endif ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index f11f5cb76..f684450d4 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -41,6 +41,7 @@ #include "ivas_prot_fx.h" #include "prot_fx2.h" #endif // IVAS_FLOAT_FIXED +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED /*-------------------------------------------------------------------------* * ivas_ism_bitrate_switching_dec() @@ -108,6 +109,12 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( { return error; } +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + IF( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 953792c7b..e17a48831 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1839,7 +1839,7 @@ void ivas_param_ism_dec_digest_tc( { #ifdef IVAS_FLOAT_FIXED ivas_param_ism_dec_dequant_DOA_fx( hParamIsmDec, st_ivas->nchan_ism ); - for ( int i = 0; i < 11; i++ ) + for ( i = 0; i < 11; i++ ) { for ( int j = 0; j < 1; j++ ) { @@ -1850,7 +1850,7 @@ void ivas_param_ism_dec_digest_tc( } } ivas_param_ism_dec_dequant_powrat_fx( hParamIsmDec ); - for ( int i = 0; i < 11; i++ ) + for ( i = 0; i < 11; i++ ) { for ( int j = 0; j < 1; j++ ) { diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index d9e80e09a..0e7d2deaa 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -236,7 +236,10 @@ void ivas_ism_render_sf( ) { int16_t i, j, k, j2; - float *g1, g2, *tc; + float g2, *tc; +#ifndef IVAS_FLOAT_FIXED + float *g1; +#endif int16_t num_objects, nchan_out_woLFE, lfe_index; int16_t azimuth, elevation; int16_t tc_offset; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 32aa6f4a4..385c0505b 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -339,7 +339,7 @@ ivas_error ivas_jbm_dec_tc( { st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - IF( EQ_16( st_ivas->hQMetaData->no_directions, 2 ) ) + IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) { st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15 ); @@ -810,10 +810,10 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); + hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; + floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - floatToFixed_arrL( &hCPE->hStereoDft->ap_delay_mem[0], &hCPE->hStereoDft->ap_delay_mem_fx[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - hCPE->hStereoDft->q_smooth_buf_fx = Q7; - floatToFixed_arrL( &hCPE->hStereoDft->smooth_buf[0][0], &hCPE->hStereoDft->smooth_buf_fx[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) @@ -874,10 +874,11 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); + hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; + fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) { @@ -1202,7 +1203,7 @@ ivas_error ivas_jbm_dec_tc( { st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - IF( EQ_16( st_ivas->hQMetaData->no_directions, 2 ) ) + IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) { st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15 ); @@ -1698,10 +1699,10 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); + hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; + floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - floatToFixed_arrL( &hCPE->hStereoDft->ap_delay_mem[0], &hCPE->hStereoDft->ap_delay_mem_fx[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - hCPE->hStereoDft->q_smooth_buf_fx = Q7; - floatToFixed_arrL( &hCPE->hStereoDft->smooth_buf[0][0], &hCPE->hStereoDft->smooth_buf_fx[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) @@ -1759,10 +1760,11 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); + hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; + fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) { @@ -2636,7 +2638,7 @@ ivas_error ivas_jbm_dec_tc( { st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - IF( EQ_16( st_ivas->hQMetaData->no_directions, 2 ) ) + IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) { st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15 ); @@ -2838,10 +2840,10 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); + hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; + floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - floatToFixed_arrL( &hCPE->hStereoDft->ap_delay_mem[0], &hCPE->hStereoDft->ap_delay_mem_fx[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - hCPE->hStereoDft->q_smooth_buf_fx = Q7; - floatToFixed_arrL( &hCPE->hStereoDft->smooth_buf[0][0], &hCPE->hStereoDft->smooth_buf_fx[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } IF( st_ivas->hSpar != NULL ) { @@ -2903,9 +2905,10 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); + hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; + fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } IF( st_ivas->hSpar != NULL ) { @@ -2913,8 +2916,6 @@ ivas_error ivas_jbm_dec_tc( for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) { fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } IF( st_ivas->hSpar != NULL ) { @@ -4945,7 +4946,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, nchan_transport * nchan_out_transport); - ivas_param_mc_dec_digest_tc_fx( st_ivas, (uint8_t) n_render_timeslots, p_data_f_fx, in_q ); + ivas_param_mc_dec_digest_tc_fx( st_ivas, (uint8_t) n_render_timeslots, (Word32 **)p_data_f_fx, in_q ); me2f_buf_16(st_ivas->hParamMC->h_output_synthesis_params.interpolator_fx, 0, st_ivas->hParamMC->h_output_synthesis_params.interpolator, n_render_timeslots ); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a97e1163b..083909963 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -3299,7 +3299,7 @@ ivas_error ivas_masa_dec_reconfigure( nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + Word16 numch_in = 0, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; ; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) @@ -3774,6 +3774,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( IF( LT_16( n_samples_granularity, st_ivas->hTcBuffer->n_samples_granularity ) ) { #ifdef IVAS_FLOAT_FIXED + IF( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 09d03335f..43326c559 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -222,6 +222,9 @@ ivas_error ivas_param_mc_dec_open( } hParamMC->ls_conv_dmx_matrix = NULL; +#ifdef IVAS_FLOAT_FIXED + hParamMC->ls_conv_dmx_matrix_fx = NULL; +#endif // IVAS_FLOAT_FIXED if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { @@ -489,7 +492,7 @@ ivas_error ivas_param_mc_dec_open( /* output synthesis */ #ifdef IVAS_FLOAT_FIXED - floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q30, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); + floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q30, nchan_out_transport * nchan_transport); if ( ( error = ivas_dirac_dec_output_synthesis_cov_open_fx( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix_fx ) ) != IVAS_ERR_OK ) { return error; @@ -1894,13 +1897,26 @@ void ivas_param_mc_dec_close( free( hParamMC->icc_q ); hParamMC->icc_q = NULL; } +#ifdef IVAS_FLOAT_FIXED + if ( hParamMC->icc_q_fx != NULL ) + { + free( hParamMC->icc_q_fx ); + hParamMC->icc_q_fx = NULL; + } +#endif if ( hParamMC->icld_q != NULL ) { free( hParamMC->icld_q ); hParamMC->icld_q = NULL; } - +#ifdef IVAS_FLOAT_FIXED + if ( hParamMC->icld_q_fx != NULL ) + { + free( hParamMC->icld_q_fx ); + hParamMC->icld_q_fx = NULL; + } +#endif /* diffuse prototype info */ if ( hParamMC->diff_proto_info ) { @@ -1948,12 +1964,26 @@ void ivas_param_mc_dec_close( free( hParamMC->ls_conv_dmx_matrix ); hParamMC->ls_conv_dmx_matrix = NULL; } +#ifdef IVAS_FLOAT_FIXED + if ( hParamMC->ls_conv_dmx_matrix_fx != NULL ) + { + free( hParamMC->ls_conv_dmx_matrix_fx ); + hParamMC->ls_conv_dmx_matrix_fx = NULL; + } +#endif if ( hParamMC->proto_matrix_int != NULL ) { free( hParamMC->proto_matrix_int ); hParamMC->proto_matrix_int = NULL; } +#ifdef IVAS_FLOAT_FIXED + if ( hParamMC->proto_matrix_int_fx != NULL ) + { + free( hParamMC->proto_matrix_int_fx ); + hParamMC->proto_matrix_int_fx = NULL; + } +#endif if ( hParamMC->hoa_encoder != NULL ) { @@ -2705,7 +2735,7 @@ void ivas_param_mc_dec_render( Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 output_f_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 *p_output_f_fx[MAX_OUTPUT_CHANNELS]; - for (int i = 0; i < MAX_OUTPUT_CHANNELS; i++) { + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++) { p_output_f_fx[i] = output_f_fx[i]; } #endif @@ -2796,7 +2826,7 @@ void ivas_param_mc_dec_render( for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { Word16 len = slot_idx_start_cldfb_synth * hParamMC->num_freq_bands + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]; - for (int i = 0; i < nchan_out_cldfb; i++) + for ( i = 0; i < nchan_out_cldfb; i++) { floatToFixed_arrL(output_f[i], output_f_fx[i], Q11, len); } @@ -2873,8 +2903,7 @@ void ivas_param_mc_dec_render( } Word16 Q_hoa_encoder = 31; floatToFixed_arrL(hParamMC->hoa_encoder, hParamMC->hoa_encoder_fx, Q_hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); - //Word32 Cldfb_RealBuffer_fx[16][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - //Word32 Cldfb_ImagBuffer_fx[16][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word16 Q_Cldfb_ImagBuffer, Q_Cldfb_RealBuffer; Q_Cldfb_ImagBuffer = Q_factor_arrL( &Cldfb_ImagBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ) - 5;/*max value =MAX_INTERN_CHANNELS(=16)*Cldfb_ImagBuffer_fx*/ Q_Cldfb_RealBuffer = Q_factor_arrL( &Cldfb_RealBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ) - 5; diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index e72aadc1e..12fbda0d4 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -531,9 +531,9 @@ static void ivas_param_upmix_dec_decorr_subframes( int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); { - Word32 i, q_format[MC_PARAMUPMIX_COMBINATIONS]; + Word32 i, q_format[MC_PARAMUPMIX_COMBINATIONS]; - FOR( i = 0; i < nchan_internal; i++ ) + FOR( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { q_format[i] = Q11; } @@ -542,7 +542,7 @@ static void ivas_param_upmix_dec_decorr_subframes( FOR( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { - Scale_sig32(pPcm_tmp_fx[i], nSamplesToDecorr, Q11- q_format[i]); + Scale_sig32(pPcm_tmp_fx[i], nSamplesToDecorr, Q11- extract_l(q_format[i])); } } for ( ch = 0; ch < nchan_internal; ch++ ) @@ -782,7 +782,7 @@ static void ivas_mc_paramupmix_dec_sf( //to be deleted if (st_ivas->hCombinedOrientationData) { - for (int i = 0; i < 3; i++) + for ( i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { @@ -794,7 +794,7 @@ static void ivas_mc_paramupmix_dec_sf( /* Implement binaural rendering */ - Word32 input_q = 6; + Word16 input_q = 6; /* Implement binaural rendering */ ivas_binRenderer_fx(st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c index d6af26d16..cc2281d50 100644 --- a/lib_dec/ivas_mct_core_dec.c +++ b/lib_dec/ivas_mct_core_dec.c @@ -354,7 +354,7 @@ void ivas_mct_core_dec( x_e = 31 - q_x[ch]; decoder_tcx_IGF_mono_fx( st, x_fx[ch][k], &x_e, &x_len, L_frame, left_rect, bfi, k ); q_x[ch] = 31 - x_e; - for ( int i = 0; i < x_len; i++ ) + for ( i = 0; i < x_len; i++ ) { x_fx[ch][k][i] = L_shr( x_fx[ch][k][i], q_x[ch] - Q12 ); } @@ -377,7 +377,7 @@ void ivas_mct_core_dec( apply_MCT_dec_fx( hMCT, sts, x_fx, q_x ); FOR( ch = 0; ch < nChannels; ch++ ) { - for ( int i = 0; i < L_FRAME48k / 2; i++ ) + for ( i = 0; i < L_FRAME48k / 2; i++ ) { x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], q_x[ch] - Q12 ); x_fx[ch][1][i] = L_shr( x_fx[ch][1][i], q_x[ch] - Q12 ); diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 29294304c..31047a2c0 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -307,7 +307,7 @@ ivas_error ivas_mct_dec_fx( Word16 Aq_fx[MCT_MAX_BLOCKS][CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; Word32 output_lfe_ch_fx[L_FRAME48k]; Word16 q_output = 11; - Word16 n, k, l, i, j; + Word16 n, k, i; Word32 *x_fx[CPE_CHANNELS][NB_DIV]; Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]; @@ -1499,7 +1499,7 @@ static ivas_error ivas_mc_dec_reconfig( nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + Word16 numch_in = 0, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; ; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index b85d47ec8..fa0aa44a1 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -923,7 +923,7 @@ void ivas_mdct_core_invQ_fx( Word16 tmp_ms_sig[CPE_CHANNELS][N_MAX]; Word16 tmp_ms_sig_e[CPE_CHANNELS]; Word32 concealment_noise_fx[CPE_CHANNELS][L_FRAME48k]; - Word16 concealment_noise_e[CPE_CHANNELS] = { 0 }, concealment_noise_len[CPE_CHANNELS]; + Word16 concealment_noise_e[CPE_CHANNELS] = { 0 }; TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode_bfi; Word16 q_l = 0, q_r = 0; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index d5d213297..e2f467250 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1389,7 +1389,7 @@ void ivas_omasa_dirac_rend_jbm( #endif #ifdef IVAS_FLOAT_FIXED - Word16 q_output = 31, q_inverse_matrix = 31; + Word16 q_output = 31; Word32 **output_fx, data_separated_objects_fx[4][960]; q_output = Q11; FOR(Word16 ind = 0; ind < MAX_NUM_OBJECTS; ind++) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5b8eb9c6b..dbf60af77 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -272,9 +272,8 @@ ivas_error ivas_sba_dec_reconfigure( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + Word16 numch_in = 0, numch_out, q1 = 30, q2 = 30; ; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index c84872f48..aea3b567c 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -548,7 +548,7 @@ void destroy_sce_dec( free( hSCE->save_hb_synth ); hSCE->save_hb_synth = NULL; } -#else +#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( hSCE->save_synth_fx != NULL ) { free( hSCE->save_synth_fx ); @@ -559,7 +559,6 @@ void destroy_sce_dec( free( hSCE->save_hb_synth_fx ); hSCE->save_hb_synth_fx = NULL; } -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED free( hSCE ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index c4e649072..2fc6f2fac 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1022,7 +1022,7 @@ void ivas_spar_get_cldfb_gains_fx( /* compute time-domain cross-fade for considered time slots*/ tmp_idx = sub( cf_start, imult1616( cf_cldfb_start, stride ) ); Word32 pFilterbank_cross_fade_fx[192];// Temporarily added to stored fixed value of hSpar->hFbMixer->pFilterbank_cross_fade_fx - floatToFixed_arrL( hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, 31, cf_len ); + floatToFixed_arrL( (float *)hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, Q31, cf_len ); FOR( sample = 0; sample < cf_len; sample++ ) { tgt_fx[tmp_idx++] = pFilterbank_cross_fade_fx[sample]; @@ -1108,7 +1108,7 @@ void ivas_spar_get_cldfb_gains_fx( { tmp = L_add(tmp,Mult_32_32(Tt_T_inv_fx[slot_row][slot_col] , Tt_tgt_fx[slot_col])); } - weights_fx[add(cf_cldfb_start , slot_row)] = L_shr(L_max( L_min( tmp, L_shl(1, (output_q-10)) ), 0 ), output_q - 10- Q_weights);/*Q_weights*/ + weights_fx[add(cf_cldfb_start , slot_row)] = extract_l(L_shr(L_max( L_min( tmp, L_shl(1, (output_q-10)) ), 0 ), output_q - 10- Q_weights));/*Q_weights*/ } hSpar->hFbMixer->cldfb_cross_fade_q = Q_weights; @@ -2691,7 +2691,6 @@ void ivas_spar_dec_digest_tc_fx( Word32 *pPcm_tmp[MAX_SPAR_INTERNAL_CHANNELS]; Word32 *p_tc[MAX_SPAR_INTERNAL_CHANNELS]; Word32 Pcm_tmp[MAX_SPAR_INTERNAL_CHANNELS][L_FRAME48k]; - Word32 i, j; Word16 q_format = Q14; ch_sba_idx = 0; move16(); @@ -3177,7 +3176,7 @@ void ivas_spar_dec_upmixer_sf_fx( #ifdef IVAS_FLOAT_FIXED /*Float to fixed*/ FOR ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - FOR ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) + FOR ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) { st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } @@ -3214,9 +3213,9 @@ void ivas_spar_dec_upmixer_sf_fx( { md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; #if 1 /*TODO: To be removed later when ivas_spar_get_parameters is integerated*/ - FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) + FOR( in_ch = 0; in_ch < numch_in; in_ch++ ) { - FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) + FOR( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) { st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } @@ -3234,11 +3233,11 @@ void ivas_spar_dec_upmixer_sf_fx( } } } - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) + FOR( i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) { st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); } @@ -3246,7 +3245,7 @@ void ivas_spar_dec_upmixer_sf_fx( } #endif ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); - FOR ( int i = 0; i < numch_out; i++ ) + FOR ( i = 0; i < numch_out; i++ ) { FOR ( int j = 0; j < numch_in; j++ ) { @@ -3343,7 +3342,7 @@ void ivas_spar_dec_upmixer_sf_fx( } } #if 1 /*TODO: To be removed when ivas_spar_get_parameters is integerated*/ - FOR( int i = 0; i < numch_out; i++ ) + FOR( i = 0; i < numch_out; i++ ) { FOR( int j = 0; j < numch_in; j++ ) { @@ -3362,7 +3361,7 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - FOR ( Word16 i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + FOR ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { cldfb_in_ts_re[in_ch][ts][i] = (float) ( cldfb_in_ts_re_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ cldfb_in_ts_im[in_ch][ts][i] = (float) ( cldfb_in_ts_im_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ @@ -3387,7 +3386,7 @@ void ivas_spar_dec_upmixer_sf_fx( { IF( st_ivas->cldfbSynDec[out_ch] ) { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) + FOR( i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) { st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] = float_to_fix( st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] ,Q11); } @@ -3509,7 +3508,7 @@ void ivas_spar_dec_upmixer_sf( slot_idx_start = hSpar->slots_rendered; #ifdef IVAS_FLOAT_FIXED - for ( int i = 0; i < s_max(st_ivas->nchan_ism,0)+ nchan_internal; i++ ) + for ( i = 0; i < s_max(st_ivas->nchan_ism,0)+ nchan_internal; i++ ) { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } @@ -3667,7 +3666,7 @@ void ivas_spar_dec_upmixer_sf( #ifdef IVAS_FLOAT_FIXED/*Float to fixed*/ for (in_ch = 0; in_ch < numch_in; in_ch++) { - for (Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++) + for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++) { st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * (1LL << (Q11))); } @@ -3707,13 +3706,13 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - for ( Word16 i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { cldfb_in_ts_re[in_ch][ts][i] = (float) ( cldfb_in_ts_re_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*q_cldfb-5*/ cldfb_in_ts_im[in_ch][ts][i] = (float) ( cldfb_in_ts_im_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*q_cldfb-5*/ } } - for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) + for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) { st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = (float) ( ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] + ( 1 << 10 ) ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 695c72ec4..4b92c2468 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -3766,13 +3766,12 @@ void ivas_spar_to_dirac( int16_t azi[IVAS_MAX_NUM_BANDS]; int16_t ele[IVAS_MAX_NUM_BANDS]; float dvx[IVAS_MAX_NUM_BANDS], dvy[IVAS_MAX_NUM_BANDS], dvz[IVAS_MAX_NUM_BANDS]; - Word32 dvx_q, dvy_q, dvz_q; Word32 dvx_fx[IVAS_MAX_NUM_BANDS], dvy_fx[IVAS_MAX_NUM_BANDS], dvz_fx[IVAS_MAX_NUM_BANDS]; float radius; - Word32 radius_fx,radius_q; + Word32 radius_fx; float en_ratio, res_pow; Word32 en_ratio_fx, res_pow_fx; - Word32 en_ratio_q, res_pow_q; + Word32 res_pow_q; int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; @@ -3859,7 +3858,6 @@ void ivas_spar_to_dirac( radius = sqrtf(dvx[band] * dvx[band] + dvy[band] * dvy[band]); - float check_qzi = atan2f(dvy[band], dvx[band]); Word16 check_azi_fx = BASOP_util_atan2(dvy_fx[band], dvx_fx[band],0); Word32 check_azi_fx_32 = L_shl(check_azi_fx,16); Word16 check_azi_fx_res; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 154a589fa..7685ba8a2 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -245,12 +245,12 @@ typedef struct stereo_dft_dec_data_struct Word16 q_DFT_past_DMX_fx[STEREO_DFT_PAST_MAX]; Word32 res_global_gain_fx; /* Q15 */ #endif // IVAS_FLOAT_FIXED - float res_cod_mem[STEREO_DFT_OVL_8k]; #ifndef IVAS_FLOAT_FIXED + float res_cod_mem[STEREO_DFT_OVL_8k]; float buff_LBTCX_mem[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; #endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED - Word32 res_cod_mem_fx[STEREO_DFT_OVL_8k]; + Word32 res_cod_mem_fx[STEREO_DFT_OVL_8k]; /* Q(q_res_cod_mem_fx) */ Word32 buff_LBTCX_mem_fx[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ Word16 q_res_cod_mem_fx; #endif @@ -265,29 +265,29 @@ typedef struct stereo_dft_dec_data_struct int16_t attackPresent; int16_t wasTransient; +#ifndef IVAS_FLOAT_FIXED float lt_pred_gain; float lt_pred_gain_variation; float lt_var_mean_ratio; -#ifndef IVAS_FLOAT_FIXED float stefi_short_gain; float stefi_long_gain; #endif basic_allpass_t ap1, ap2, ap3; - float ap_delay_mem[NS2SA( 16000, DELAY_BWE_TOTAL_NS )]; #ifndef IVAS_FLOAT_FIXED + float ap_delay_mem[NS2SA( 16000, DELAY_BWE_TOTAL_NS )]; float ap_fade_mem[STEREO_DFT_ALLPASS_FADELEN_16k]; #endif #ifdef IVAS_FLOAT_FIXED Word16 stab_fac_smooth_res_fx; /* low-pass filtered stability factor */ /* Q15 */ - Word32 lt_pred_gain_fx; - Word32 lt_pred_gain_variation_fx; - Word32 lt_var_mean_ratio_fx; - Word16 stefi_short_gain_fx; /* Q15 */ - Word16 stefi_long_gain_fx; /* Q15 */ + Word32 lt_pred_gain_fx; /* Q(q_lt_pred_gain) */ + Word32 lt_pred_gain_variation_fx; /* Q(q_lt_pred_gain) */ + Word32 lt_var_mean_ratio_fx; /* Q31 */ + Word16 stefi_short_gain_fx; /* Q15 */ + Word16 stefi_long_gain_fx; /* Q15 */ Word16 q_lt_pred_gain; - Word32 ap_delay_mem_fx[NS2SA( 16000, DELAY_BWE_TOTAL_NS )]; - Word32 ap_fade_mem_fx[STEREO_DFT_ALLPASS_FADELEN_16k]; /* Q(q_ap_fade_mem_fx) */ + Word32 ap_delay_mem_fx[NS2SA( 16000, DELAY_BWE_TOTAL_NS )]; /* Q(q_ap_fade_mem_fx) */ + Word32 ap_fade_mem_fx[STEREO_DFT_ALLPASS_FADELEN_16k]; /* Q(q_ap_fade_mem_fx) */ Word16 q_ap_fade_mem_fx; #endif @@ -336,7 +336,9 @@ typedef struct stereo_dft_dec_data_struct #endif /* PLC on residual signal */ +#ifndef IVAS_FLOAT_FIXED float res_mem[STEREO_DFT_RES_BW_MAX]; +#endif int16_t time_offs; #ifndef IVAS_FLOAT_FIXED float past_dmx_nrg; @@ -345,17 +347,17 @@ typedef struct stereo_dft_dec_data_struct int16_t sg_mem_corrupt; int16_t recovery_flg; - float smooth_buf[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; #ifndef IVAS_FLOAT_FIXED + float smooth_buf[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; float smooth_fac[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; #endif #ifdef IVAS_FLOAT_FIXED /* PLC on residual signal */ - Word32 sg_mean_fx; /* Q31 */ - Word32 res_mem_fx[STEREO_DFT_RES_BW_MAX]; - Word32 past_dmx_nrg_fx; /* Q(2 * q_dft) */ - Word32 smooth_buf_fx[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; - Word16 smooth_fac_fx[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; /* Q15 */ + Word32 sg_mean_fx; /* Q31 */ + Word32 res_mem_fx[STEREO_DFT_RES_BW_MAX]; /* Q(q_res_mem) */ + Word32 past_dmx_nrg_fx; /* Q(2 * q_dft) */ + Word32 smooth_buf_fx[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; /* Q(q_smooth_buf_fx) */ + Word16 smooth_fac_fx[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; /* Q15 */ Word16 q_smooth_buf_fx; Word16 q_hb_nrg; Word16 q_hb_nrg_subr; diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index d178c08fc..7ac9987ad 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -606,9 +606,11 @@ void stereo_dft_dec_reset( /*residual coding*/ set_s( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->hConfig->res_cod_mode]; +#ifndef IVAS_FLOAT_FIXED set_zero( hStereoDft->res_cod_mem, STEREO_DFT_OVL_8k ); -#ifdef IVAS_FLOAT_FIXED +#else set_l( hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); + hStereoDft->q_res_cod_mem_fx = Q16; #endif hStereoDft->res_pred_band_min = max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); @@ -659,10 +661,10 @@ void stereo_dft_dec_reset( hStereoDft->wasTransient = 0; hStereoDft->attackPresent = 0; +#ifndef IVAS_FLOAT_FIXED hStereoDft->lt_pred_gain = 0.0f; hStereoDft->lt_pred_gain_variation = 0.0f; hStereoDft->lt_var_mean_ratio = STEREO_DFT_RES_RATIO_LIMIT; -#ifndef IVAS_FLOAT_FIXED hStereoDft->stefi_short_gain = 1.0f; hStereoDft->stefi_long_gain = 0.0f; #else @@ -686,10 +688,12 @@ void stereo_dft_dec_reset( init_basic_allpass( &hStereoDft->ap3, dft_ap_gains[2], dft_ap_delays[2] ); #endif - set_zero( hStereoDft->ap_delay_mem, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); #ifdef IVAS_FLOAT_FIXED + set32_fx( hStereoDft->ap_delay_mem_fx, 0, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); set32_fx( hStereoDft->ap_fade_mem_fx, 0, STEREO_DFT_ALLPASS_FADELEN_16k ); + hStereoDft->q_ap_delay_mem_fx = Q11; #else + set_zero( hStereoDft->ap_delay_mem, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); set_zero( hStereoDft->ap_fade_mem, STEREO_DFT_ALLPASS_FADELEN_16k ); #endif hStereoDft->ap_wasTransient = 0; @@ -713,7 +717,11 @@ void stereo_dft_dec_reset( #endif /* PLC parameters */ +#ifdef IVAS_FLOAT_FIXED + set32_fx( hStereoDft->res_mem_fx, 0, STEREO_DFT_RES_BW_MAX ); +#else set_zero( hStereoDft->res_mem, STEREO_DFT_RES_BW_MAX ); +#endif hStereoDft->time_offs = 0; #ifdef IVAS_FLOAT_FIXED hStereoDft->past_dmx_nrg_fx = 0; @@ -725,14 +733,19 @@ void stereo_dft_dec_reset( hStereoDft->sg_mem_corrupt = 0; hStereoDft->recovery_flg = 0; +#ifndef IVAS_FLOAT_FIXED for ( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) { set_zero( hStereoDft->smooth_buf[i], SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); } -#ifndef IVAS_FLOAT_FIXED set_zero( hStereoDft->smooth_fac[0], SBA_DIRAC_STEREO_NUM_BANDS ); set_zero( hStereoDft->smooth_fac[1], SBA_DIRAC_STEREO_NUM_BANDS ); #else + FOR( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) + { + set32_fx( hStereoDft->smooth_buf_fx[i], 0, SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + hStereoDft->q_smooth_buf_fx = Q7; set16_fx( hStereoDft->smooth_fac_fx[0], 0, SBA_DIRAC_STEREO_NUM_BANDS ); set16_fx( hStereoDft->smooth_fac_fx[1], 0, SBA_DIRAC_STEREO_NUM_BANDS ); #endif @@ -821,6 +834,7 @@ void stereo_dft_dec_reset( { set_val_Word32( hStereoDft->smooth_buf_fx[i], 0, SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); } + hStereoDft->q_smooth_buf_fx = Q7; set_val_Word16( hStereoDft->smooth_fac_fx[0], 0, SBA_DIRAC_STEREO_NUM_BANDS ); set_val_Word16( hStereoDft->smooth_fac_fx[1], 0, SBA_DIRAC_STEREO_NUM_BANDS ); @@ -1060,6 +1074,7 @@ void stereo_dft_dec_update( mvr2r( hStereoDft->hb_nrg, hStereoDft->hb_nrg + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); mvr2r( hStereoDft->td_gain, hStereoDft->td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); +#ifndef IVAS_FLOAT_FIXED if ( sba_dirac_stereo_flag ) { /* buffer update, push back by 2 because of 2 subframes */ @@ -1071,6 +1086,19 @@ void stereo_dft_dec_update( } } } +#else + IF( sba_dirac_stereo_flag ) + { + /* buffer update, push back by 2 because of 2 subframes */ + FOR( b = 0; b < hStereoDft->nbands; b++ ) + { + FOR( i = SBA_DIRAC_NRG_SMOOTH_LONG; i > 1; i-- ) + { + hStereoDft->smooth_buf_fx[b][i] = hStereoDft->smooth_buf_fx[b][i - 2]; + } + } + } +#endif return; } diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index a259839b3..002582f22 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -131,6 +131,7 @@ void stereo_dft_dec_reset_fx( set_s( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->hConfig->res_cod_mode]; set_val_Word32( hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); + hStereoDft->q_res_cod_mem_fx = Q16; hStereoDft->res_pred_band_min = s_max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); move32(); @@ -178,6 +179,8 @@ void stereo_dft_dec_reset_fx( set_val_Word32( hStereoDft->ap_delay_mem_fx, 0, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); set_val_Word32( hStereoDft->ap_fade_mem_fx, 0, STEREO_DFT_ALLPASS_FADELEN_16k ); + hStereoDft->q_ap_delay_mem_fx = Q11; + move16(); hStereoDft->ap_wasTransient = 0; move16(); set_val_Word32( hStereoDft->smooth_dmx_nrg_fx, 0, STEREO_DFT_BAND_MAX ); @@ -207,6 +210,7 @@ void stereo_dft_dec_reset_fx( { set_val_Word32( hStereoDft->smooth_buf_fx[i], 0, SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); } + hStereoDft->q_smooth_buf_fx = Q7; set_val_Word16( hStereoDft->smooth_fac_fx[0], 0, SBA_DIRAC_STEREO_NUM_BANDS ); set_val_Word16( hStereoDft->smooth_fac_fx[1], 0, SBA_DIRAC_STEREO_NUM_BANDS ); @@ -1202,6 +1206,7 @@ void stereo_dft_dec_res_fx( IF ( EQ_16(hCPE->hStereoDft->res_cod_mode[STEREO_DFT_OFFSET - 1], STEREO_DFT_RES_COD_OFF) ) { set_val_Word32( hCPE->hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); + hCPE->hStereoDft->q_res_cod_mem_fx = Q16; set_val_Word32( hCPE->input_mem_fx[1], 0, NS2SA( 8000, STEREO_DFT32MS_OVL_NS ) ); set_val_Word16( hCPE->hStereoDft->hBpf->pst_old_syn_fx, 0, STEREO_DFT_NBPSF_PIT_MAX_8k ); hCPE->hStereoDft->hBpf->pst_mem_deemp_err_fx = 0; @@ -1215,20 +1220,20 @@ void stereo_dft_dec_res_fx( { /*OLA*/ /*overlapping parts*/ - Word16 q_shift = hCPE->hStereoDft->q_res_cod_mem_fx; + Word16 q_shift = sub( hCPE->hStereoDft->q_res_cod_mem_fx, Q16 ); move16(); - FOR ( i = 0; i < STEREO_DFT_OVL_8k; i++ ) + FOR( i = 0; i < STEREO_DFT_OVL_8k; i++ ) { - win[i] = extract_h(L_add(hCPE->hStereoDft->res_cod_mem_fx[i], L_shl(L_mult(win[i], hCPE->hStereoDft->win_8k_fx[i]), q_shift))); + win[i] = extract_h( L_add( hCPE->hStereoDft->res_cod_mem_fx[i], L_shl( L_mult( win[i], hCPE->hStereoDft->win_8k_fx[i] ), q_shift ) ) ); move16(); - hCPE->hStereoDft->res_cod_mem_fx[i] = L_mult(win[L_FRAME8k + i], hCPE->hStereoDft->win_8k_fx[STEREO_DFT_OVL_8k - 1 - i]); + hCPE->hStereoDft->res_cod_mem_fx[i] = L_mult( win[L_FRAME8k + i], hCPE->hStereoDft->win_8k_fx[STEREO_DFT_OVL_8k - 1 - i] ); move32(); } - IF (NE_16(q_shift, 0)) + IF( NE_16( q_shift, 0 ) ) { - v_shr_16(&win[STEREO_DFT_OVL_8k], negate(q_shift), &win[STEREO_DFT_OVL_8k], L_FRAME8k); + v_shr_16( &win[STEREO_DFT_OVL_8k], negate( q_shift ), &win[STEREO_DFT_OVL_8k], L_FRAME8k ); } - hCPE->hStereoDft->q_res_cod_mem_fx = 0; + hCPE->hStereoDft->q_res_cod_mem_fx = Q16; move16(); } ELSE diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index fd39b1cec..37d3841e0 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -129,6 +129,7 @@ void stereo_dft_res_ecu_fx( v_multc_fixed_16( res_buf, fac, res_buf, L_FRAME8k ); Copy32( res_buf + ( OFFSET8k - ZP8k ), &hStereoDft->res_cod_mem_fx[0], STEREO_DFT_OVL_8k ); + hStereoDft->q_res_cod_mem_fx = hStereoDft->q_dft; Copy32( res_buf + ZP8k, input_mem, NS2SA( 8000, STEREO_DFT32MS_OVL_NS ) ); /* Store memory for cross-fade to next frame, in case of good frame */ hStereoDft->q_ip_mem = hStereoDft->q_dft; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 5d1c93a94..b11233337 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -3035,10 +3035,8 @@ void stereo_switching_dec( } /* reset residual coding / ESF (secondary channel) */ -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - set_zero( hCPE->hStereoDft->res_cod_mem, STEREO_DFT_OVL_8k ); -#endif set32_fx( hCPE->hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); + hCPE->hStereoDft->q_res_cod_mem_fx = Q16; set32_fx( hCPE->input_mem_fx[1], 0, NS2SA( sts[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); } diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 1684c486b..9c42a0bf6 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -2244,8 +2244,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { return IVAS_ERR_UNKNOWN; } + #ifdef IVAS_FLOAT_FIXED - if ( GT_16( maxScaling, 20 ) ) + IF ( GT_32( maxScaling, 20 ) ) { maxScaling = 20; move16(); diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 5ae2b382e..01ab068f9 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -518,7 +518,7 @@ void lsf_end_dec( #ifdef IVAS_FLOAT_FIXED Word16 tdm_lsfQ_PCh_fx[M]; Word16 pred3_fx[M]; - for (int i = 0; i < M; i++) + for ( i = 0; i < M; i++) { tdm_lsfQ_PCh_fx[i] = (Word16)((tdm_lsfQ_PCh[i]) * 2.56f); pred3_fx[i] = (Word16)((pred3[i]) * 2.56f); @@ -526,7 +526,7 @@ void lsf_end_dec( tdm_SCh_LSF_intra_pred_fx(st->element_brate, tdm_lsfQ_PCh_fx, pred3_fx); - for (int i = 0; i < M; i++) + for (i = 0; i < M; i++) { pred3[i] = (pred3_fx[i]) / 2.56f; } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index c427203d2..cbdffc62b 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -560,7 +560,7 @@ void calc_tilt_bwe_fx_loc( Word16 headroom_left_r0 = W_norm(r0_fx); Word16 headroom_left_r1 = W_norm(r1_fx); Word16 r0_q = 0, r1_q = 0; - Word16 r0_bits_occ = 0, r1_bits_occ = 0; + //Word16 r0_bits_occ = 0, r1_bits_occ = 0; IF(headroom_left_r0 < 32) { r0_fx = W_shr(r0_fx, (32 - headroom_left_r0)); diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index eb81feee4..2f9f66ac5 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -4561,7 +4561,6 @@ void fb_tbe_dec_ivas_fx( Word16 i; Word16 ratio = 0; Word32 fb_exc_energy = 0; - Word32 L_tmp; Word16 fb_synth[L_FRAME48k]; TD_BWE_DEC_HANDLE hBWE_TD; hBWE_TD = st->hBWE_TD; @@ -5016,7 +5015,7 @@ void td_bwe_dec_init_ivas_fx( } set16_fx(hBWE_TD->mem_resamp_HB_fx, 0, INTERP_3_1_MEM_LEN); - set32_fx(hBWE_TD->mem_resamp_HB_32k_fx, 0, 2 * ALLPASSSECTIONS_STEEP + 1); + set16_fx(hBWE_TD->mem_resamp_HB_32k_fx, 0, 2 * ALLPASSSECTIONS_STEEP + 1); set16_fx(hBWE_TD->mem_resamp_HB_32k_fx, 0, 2 * ALLPASSSECTIONS_STEEP + 1); set32_fx(hBWE_TD->mem_resamp_HB_32k_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP + 1); @@ -5084,6 +5083,7 @@ void td_bwe_dec_init_fx( } set16_fx(hBWE_TD->mem_resamp_HB_fx, 0, INTERP_3_1_MEM_LEN); + set16_fx(hBWE_TD->mem_resamp_HB_32k_fx, 0, 2 * ALLPASSSECTIONS_STEEP + 1); set32_fx(hBWE_TD->mem_resamp_HB_32k_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP + 1); diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 1de27b44c..e79dcd83c 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -783,10 +783,10 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( // hTonalMDCTConc->nSamplesCore, // floorPowerSpectrum); - ivas_DetectTonalComponents_fx(hTonalMDCTConc->pTCI->indexOfTonalPeak, - hTonalMDCTConc->pTCI->lowerIndex, - hTonalMDCTConc->pTCI->upperIndex, - &hTonalMDCTConc->pTCI->numIndexes, + ivas_DetectTonalComponents_fx((Word16 *)hTonalMDCTConc->pTCI->indexOfTonalPeak, + (Word16 *)hTonalMDCTConc->pTCI->lowerIndex, + (Word16 *)hTonalMDCTConc->pTCI->upperIndex, + (Word16 *)&hTonalMDCTConc->pTCI->numIndexes, hTonalMDCTConc->lastPitchLag, pitchLag, hTonalMDCTConc->lastBlockData.spectralData, @@ -836,7 +836,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( } ELSE { - FOR( Word16 i = 0; i < FDNS_NPTS; i++ ) + FOR( i = 0; i < FDNS_NPTS; i++ ) { invScaleFactors_fx[i] = L_shl(invScaleFactors[i], 1 + invScaleFactors_exp[i]); // Q16 } @@ -930,10 +930,10 @@ static void CalcPowerSpecAndDetectTonalComponents( set32_fx(powerSpectrum+hTonalMDCTConc->nSamples, 0, sub(hTonalMDCTConc->nSamplesCore, hTonalMDCTConc->nSamples)); } - DetectTonalComponents(hTonalMDCTConc->pTCI->indexOfTonalPeak, - hTonalMDCTConc->pTCI->lowerIndex, - hTonalMDCTConc->pTCI->upperIndex, - &hTonalMDCTConc->pTCI->numIndexes, + DetectTonalComponents((Word16 *)hTonalMDCTConc->pTCI->indexOfTonalPeak, + (Word16 *)hTonalMDCTConc->pTCI->lowerIndex, + (Word16 *)hTonalMDCTConc->pTCI->upperIndex, + (Word16 *)&hTonalMDCTConc->pTCI->numIndexes, hTonalMDCTConc->lastPitchLag, pitchLag, hTonalMDCTConc->lastBlockData.spectralData, @@ -1152,12 +1152,12 @@ void TonalMDCTConceal_Detect( move32(); } - RefineTonalComponents(hTonalMDCTConc->pTCI->indexOfTonalPeak, - hTonalMDCTConc->pTCI->lowerIndex, - hTonalMDCTConc->pTCI->upperIndex, + RefineTonalComponents((Word16 *)hTonalMDCTConc->pTCI->indexOfTonalPeak, + (Word16 *)hTonalMDCTConc->pTCI->lowerIndex, + (Word16 *)hTonalMDCTConc->pTCI->upperIndex, hTonalMDCTConc->pTCI->phaseDiff, hTonalMDCTConc->pTCI->phase_currentFramePredicted, - &hTonalMDCTConc->pTCI->numIndexes, + (Word16 *)&hTonalMDCTConc->pTCI->numIndexes, hTonalMDCTConc->lastPitchLag, pitchLag, hTonalMDCTConc->lastBlockData.spectralData, @@ -1278,7 +1278,7 @@ void TonalMDCTConceal_Detect_ivas_fx( { //sns_shape_spectrum(powerSpectrum, psychParamsCurrent, hTonalMDCTConc->secondLastBlockData.scaleFactors, hTonalMDCTConc->nSamplesCore); Word16 power_spectrum_q; - FOR(Word16 i = 0; i < FDNS_NPTS; i++) + FOR( i = 0; i < FDNS_NPTS; i++) { sns_int_scf_fx[i] = L_shl(hTonalMDCTConc->secondLastBlockData.scaleFactors[i], 1 + hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i]); // Q16 } @@ -1296,12 +1296,12 @@ void TonalMDCTConceal_Detect_ivas_fx( move32(); } - RefineTonalComponents(hTonalMDCTConc->pTCI->indexOfTonalPeak, - hTonalMDCTConc->pTCI->lowerIndex, - hTonalMDCTConc->pTCI->upperIndex, + RefineTonalComponents((Word16 *)hTonalMDCTConc->pTCI->indexOfTonalPeak, + (Word16 *)hTonalMDCTConc->pTCI->lowerIndex, + (Word16 *)hTonalMDCTConc->pTCI->upperIndex, hTonalMDCTConc->pTCI->phaseDiff, hTonalMDCTConc->pTCI->phase_currentFramePredicted, - &hTonalMDCTConc->pTCI->numIndexes, + (Word16 *)&hTonalMDCTConc->pTCI->numIndexes, hTonalMDCTConc->lastPitchLag, pitchLag, hTonalMDCTConc->lastBlockData.spectralData, diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 79482e455..33f28aa24 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -375,7 +375,6 @@ ivas_error ivas_spar_md_enc_init_fx( { Word32 pFC[IVAS_MAX_NUM_BANDS]; Word16 table_idx; - Word32 PR_minmax_fx[2]; Word16 num_channels, i, j, k; ivas_sba_get_spar_hoa_md_flag(sba_order, hEncoderConfig->ivas_total_brate, &hMdEnc->spar_hoa_md_flag, &hMdEnc->spar_hoa_dirac2spar_md_flag); diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index ef7b6f36a..4245124f7 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2954,6 +2954,13 @@ void ivas_rend_closeCrend( } } +#ifdef IVAS_FLOAT_FIXED + if ( hCrend->lfe_delay_line_fx != NULL ) + { + free( hCrend->lfe_delay_line_fx ); + hCrend->lfe_delay_line_fx = NULL; + } +#endif if ( hCrend->lfe_delay_line != NULL ) { free( hCrend->lfe_delay_line ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 48d74e8f8..5cdfcabad 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -51,6 +51,8 @@ #ifdef IVAS_FLOAT_FIXED Word16 slot_fx[4] = {32767, 16384, 10922 ,8192}; #endif + +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED /*------------------------------------------------------------------------- * Local constants *------------------------------------------------------------------------*/ @@ -421,7 +423,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) { - ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); + ivas_binaural_reverb_close_fx( &( hDiracDecBin->hReverb ) ); } if ( hDiracDecBin->hReverb == NULL ) @@ -530,7 +532,10 @@ void ivas_dirac_dec_close_binaural_data( IF ((*hBinaural)->hReverb != NULL) { + ivas_binaural_reverb_close_fx(&((*hBinaural)->hReverb)); +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED ivas_binaural_reverb_close(&((*hBinaural)->hReverb)); +#endif } ivas_td_decorr_dec_close(&((*hBinaural)->hTdDecorr)); diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 30686c586..e551b2205 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -46,6 +46,7 @@ #include "ivas_prot_fx.h" #include "ivas_rom_binaural_crend_head.h" +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED /*------------------------------------------------------------------------- * ivas_dirac_allocate_parameters() * @@ -857,18 +858,32 @@ void ivas_dirac_rend_close_fx( { FOR (j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++) { +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED IF (hDirACRend->buffer_intensity_real[i][j] != NULL) { free(hDirACRend->buffer_intensity_real[i][j]); hDirACRend->buffer_intensity_real[i][j] = NULL; } +#endif + IF (hDirACRend->buffer_intensity_real_fx[i][j] != NULL) + { + free(hDirACRend->buffer_intensity_real_fx[i][j]); + hDirACRend->buffer_intensity_real_fx[i][j] = NULL; + } } } +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED IF (hDirACRend->buffer_energy != NULL) { free(hDirACRend->buffer_energy); hDirACRend->buffer_energy = NULL; } +#endif + IF (hDirACRend->buffer_energy_fx != NULL) + { + free(hDirACRend->buffer_energy_fx); + hDirACRend->buffer_energy_fx = NULL; + } IF (hDirACRend->masa_stereo_type_detect != NULL) { @@ -1880,10 +1895,16 @@ void ivas_dirac_free_mem_fx( { free( hDirAC_mem->cy_auto_diff_smooth_fx ); } +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED IF (hDirAC_mem->direct_responses != NULL) { free(hDirAC_mem->direct_responses); } +#endif + if (hDirAC_mem->direct_responses_fx != NULL) + { + free(hDirAC_mem->direct_responses_fx); + } IF (hDirAC_mem->proto_direct_buffer_f != NULL) { free(hDirAC_mem->proto_direct_buffer_f); @@ -1950,12 +1971,6 @@ void ivas_dirac_free_mem( { free( hDirAC_mem->proto_power_smooth ); } -#ifdef IVAS_FLOAT_FIXED - if ( hDirAC_mem->proto_power_smooth_fx != NULL ) - { - free( hDirAC_mem->proto_power_smooth_fx ); - } -#endif if ( hDirAC_mem->proto_power_diff_smooth != NULL ) { free( hDirAC_mem->proto_power_diff_smooth ); @@ -1984,20 +1999,6 @@ void ivas_dirac_free_mem( { free( hDirAC_mem->proto_direct_buffer_f ); } -#ifdef IVAS_FLOAT_FIXED - if ( hDirAC_mem->proto_direct_buffer_f_fx != NULL ) - { - free( hDirAC_mem->proto_direct_buffer_f_fx ); - } - if ( hDirAC_mem->proto_diffuse_buffer_f_fx != NULL ) - { - free( hDirAC_mem->proto_diffuse_buffer_f_fx ); - } - if (hDirAC_mem->direct_responses_fx != NULL) - { - free(hDirAC_mem->direct_responses_fx); - } -#endif if ( hDirAC_mem->proto_diffuse_buffer_f != NULL ) { free( hDirAC_mem->proto_diffuse_buffer_f ); @@ -2018,16 +2019,6 @@ void ivas_dirac_free_mem( { free( hDirAC_mem->onset_filter ); } -#ifdef IVAS_FLOAT_FIXED - if ( hDirAC_mem->reference_power_fx != NULL ) - { - free( hDirAC_mem->reference_power_fx ); - } - if ( hDirAC_mem->onset_filter_fx != NULL ) - { - free( hDirAC_mem->onset_filter_fx ); - } -#endif return; } diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 856a74a3b..3fdbe47f0 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -1133,19 +1133,6 @@ void BSplineModelEvalDealloc_fx( IF ( model->modelROM ) { -#if 1 //To be removed later :Floating point memory release - free( (void *) model->azimBsShape ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ - FOR ( i = 0; i < model->elevDim3; i++ ) - { - free( model->azimKSeq[i] ); - } - free( model->azimKSeq ); - IF ( modelEval != NULL ) - { - free( modelEval->hrfModL ); - free( modelEval->hrfModR ); - } -#endif free( (void *) model->azimBsShape_fx ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ FOR ( i = 0; i < model->elevDim3; i++ ) { @@ -1178,14 +1165,6 @@ void BSplineModelEvalDealloc( free( model->azimKSeq[i] ); } free( model->azimKSeq ); -#ifdef IVAS_FLOAT_FIXED - free( (void *) model->azimBsShape_fx ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ - FOR( i = 0; i < model->elevDim3; i++ ) - { - free( model->azimKSeq_fx[i] ); - } - free( model->azimKSeq_fx ); -#endif if ( modelEval != NULL ) { free( modelEval->hrfModL ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 5232930c9..bb95f0b38 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1631,6 +1631,11 @@ ivas_error ivas_binaural_reverb_open_parambin( const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_binaural_reverb_close_fx( + REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ +); +#endif void ivas_binaural_reverb_close( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 55375c9bd..cbf9fe390 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -981,9 +981,9 @@ static ivas_error compute_t60_coeffs_fx( Word16 bin_idx, loop_idx, tf_T60_len, len; ivas_error error; - Word16 loop_delay_sec_fx, inv_hfs_fx, norm_f_e, tmp; + Word16 loop_delay_sec_fx, norm_f_e, tmp; Word32 freq_Nyquist_fx = L_shr(output_Fs, 1); - Word16 target_gains_db_fx[RV_LENGTH_NR_FC], target_gains_exp; + Word16 target_gains_db_fx[RV_LENGTH_NR_FC]; Word16 norm_f_fx[RV_LENGTH_NR_FC]; Word32 *targetT60_fx, *pFc_fx; Word16 *pCoeffs_a_fx, *pCoeffs_b_fx, *targetT60_e; @@ -2287,7 +2287,6 @@ ivas_error ivas_reverb_open( REVERB_HANDLE pState = NULL; Word16 bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx; ivas_reverb_params_t params; - Word16 *pCoeffs_fx = params.pT60_filter_coeff_fx; Word32 pColor_target_l_fx[RV_LENGTH_NR_FC]; Word32 pColor_target_r_fx[RV_LENGTH_NR_FC]; Word32 pTime_window_fx[RV_FILTER_MAX_FFT_SIZE]; @@ -2399,7 +2398,9 @@ ivas_error ivas_reverb_open( /* Compute target levels (gains) for the coloration filters */ Word32 *pHrtf_avg_pwr_response_l_const = (Word32*)malloc(nr_fc_fft_filter * sizeof(Word32*)); Word32 *pHrtf_avg_pwr_response_r_const = (Word32*)malloc(nr_fc_fft_filter * sizeof(Word32*)); - Word32 *pT60_filter_coeff = (Word32*)malloc((params.nr_loops * 4 + 4) * sizeof(Word32*)); + Word16 lenT60_filter_coeff = add(params.t60_filter_order, 1); + lenT60_filter_coeff = add(i_mult(shl(lenT60_filter_coeff, 1), sub(params.nr_loops, 1)), add(lenT60_filter_coeff, 2)); + Word32 *pT60_filter_coeff = (Word32*)malloc((lenT60_filter_coeff) * sizeof(Word32*)); FOR (int i = 0; i < nr_fc_fft_filter; i++) @@ -2408,7 +2409,7 @@ ivas_error ivas_reverb_open( pHrtf_avg_pwr_response_l_const[i] = L_shl(params.pHrtf_avg_pwr_response_l_const_fx[i] ,5);/*Q23+5*/ pHrtf_avg_pwr_response_r_const[i] = L_shl(params.pHrtf_avg_pwr_response_r_const_fx[i] ,5);/*Q23+5*/ } - FOR (int i = 0; i < params.nr_loops * 4 + 4; i++) + FOR (int i = 0; i < lenT60_filter_coeff; i++) { pT60_filter_coeff[i] = L_shl_sat(params.pT60_filter_coeff_fx[i] ,17); } @@ -2486,6 +2487,7 @@ ivas_error ivas_reverb_open( } /* Computing coloration filters on the basis of target responses */ + ivas_reverb_calc_color_filters_fx(pColor_target_l_fx, pColor_target_r_fx, pTime_window_fx, pState->fft_size, 0, pFft_wf_filter_ch0_fx, pFft_wf_filter_ch1_fx, &q_pFft_wf_filter_ch0_fx, &q_pFft_wf_filter_ch1_fx); FOR ( int i = 0; i < nr_fc_fft_filter; i++ ) { @@ -2497,8 +2499,10 @@ ivas_error ivas_reverb_open( pFft_wf_filter_ch1_fx[i][0] = L_shl( pFft_wf_filter_ch1_fx[i][0], 31 - q_pFft_wf_filter_ch1_fx ); pFft_wf_filter_ch1_fx[i][1] = L_shl( pFft_wf_filter_ch1_fx[i][1], 31 - q_pFft_wf_filter_ch1_fx ); } + Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ + /* Copying the computed FFT colorations filters to the fft_filter components */ IF ( ( error = set_color_fft_filter( pState, 0, pFft_wf_filter_ch0_fx ) ) != IVAS_ERR_OK ) { @@ -3891,7 +3895,7 @@ static ivas_error ivas_binaural_reverb_open( } ivas_binaural_reverb_setReverbTimes_fx( hReverb, sampling_rate, revTimes_fx, revEnes_fx ); - FOR(Word16 bin = 0; bin < hReverb->numBins; bin++) + FOR( bin = 0; bin < hReverb->numBins; bin++) { hReverb->binauralCoherenceDirectGains[bin] = (float)hReverb->binauralCoherenceDirectGains_fx[bin] / ONE_IN_Q31; hReverb->binauralCoherenceCrossmixGains[bin] = (float)hReverb->binauralCoherenceCrossmixGains_fx[bin] / ONE_IN_Q31; @@ -4013,7 +4017,7 @@ ivas_error ivas_binaural_reverb_open_parambin( *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -void ivas_binaural_reverb_close( +void ivas_binaural_reverb_close_fx( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ) { @@ -4044,7 +4048,7 @@ void ivas_binaural_reverb_close( return; } -#else +#endif void ivas_binaural_reverb_close( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ) @@ -4061,8 +4065,10 @@ void ivas_binaural_reverb_close( FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { free( ( *hReverb )->tapPhaseShiftType[bin][chIdx] ); +#ifndef IVAS_FLOAT_FIXED free( ( *hReverb )->tapPointersReal[bin][chIdx] ); free( ( *hReverb )->tapPointersImag[bin][chIdx] ); +#endif free( ( *hReverb )->outputBufferReal[bin][chIdx] ); free( ( *hReverb )->outputBufferImag[bin][chIdx] ); } @@ -4075,4 +4081,3 @@ void ivas_binaural_reverb_close( return; } -#endif \ No newline at end of file diff --git a/lib_rend/ivas_vbap.c b/lib_rend/ivas_vbap.c index a579af75d..3c3fd8023 100644 --- a/lib_rend/ivas_vbap.c +++ b/lib_rend/ivas_vbap.c @@ -310,13 +310,6 @@ ivas_error vbap_init_data_fx( set16_fx( vbap->top_virtual_speaker_node_division_gains_fx, 0, num_speaker_nodes ); is_success &= vbap->top_virtual_speaker_node_division_gains_fx != NULL; - IF( ( vbap->top_virtual_speaker_node_division_gains_fx = (Word16 *) malloc( num_speaker_nodes * sizeof( Word16 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); - } - set16_fx( vbap->top_virtual_speaker_node_division_gains_fx, 0, num_speaker_nodes ); - is_success &= vbap->top_virtual_speaker_node_division_gains_fx != NULL; - IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) ) { IF( ( vbap->object_mode_top_virtual_speaker_node_division_gains_fx = (Word16 *) malloc( num_speaker_nodes * sizeof( Word16 ) ) ) == NULL ) @@ -767,6 +760,14 @@ void vbap_free_data_fx( { free( ( *hVBAPdata )->object_mode_back_virtual_speaker_node_division_gains_fx ); } + if ( ( *hVBAPdata )->search_struct[0].triplets != NULL ) + { + free( ( *hVBAPdata )->search_struct[0].triplets ); + } + if ( ( *hVBAPdata )->num_search_structs == 2 && ( *hVBAPdata )->search_struct[1].triplets != NULL ) + { + free( ( *hVBAPdata )->search_struct[1].triplets ); + } free( *hVBAPdata ); *hVBAPdata = NULL; @@ -1545,6 +1546,8 @@ static void determine_virtual_speaker_node_division_gains_fx( } } + free(exp_virtual_node_division_gains); + return; } #else -- GitLab From bf90ce95679e97d2f4b3476de4adb11d45855442 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 29 Apr 2024 16:43:27 +0530 Subject: [PATCH 006/101] SPAR MD functions clean up, integration --- lib_com/ivas_cnst.h | 7 +- lib_com/ivas_prot.h | 36 +- lib_com/ivas_prot_fx.h | 70 +- lib_com/ivas_spar_com.c | 1339 ++++++++++-- lib_com/ivas_spar_com_quant_util.c | 160 +- lib_com/ivas_stat_com.h | 3 + lib_dec/ivas_dirac_dec.c | 1 + lib_dec/ivas_init_dec.c | 30 +- lib_dec/ivas_ism_dec.c | 6 +- lib_dec/ivas_jbm_dec.c | 172 +- lib_dec/ivas_masa_dec.c | 12 +- lib_dec/ivas_mct_dec.c | 6 +- lib_dec/ivas_omasa_dec.c | 36 - lib_dec/ivas_osba_dec.c | 128 +- lib_dec/ivas_sba_dec.c | 848 +++++++- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 8 +- lib_dec/ivas_sba_rendering_internal.c | 4 +- lib_dec/ivas_spar_decoder.c | 874 ++++---- lib_dec/ivas_spar_md_dec.c | 1907 ++++++++++++------ lib_dec/ivas_stat_dec.h | 8 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 46 +- lib_rend/ivas_sba_rendering.c | 3 +- 22 files changed, 4164 insertions(+), 1540 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 5f5d16e7c..f3bbf79d2 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1046,14 +1046,15 @@ typedef enum /* Common SPAR metadata constants */ #define IVAS_ACTIVEW_DM_F_SCALE 0.5f -#define IVAS_ACTIVEW_DM_F_SCALE_FX ONE_IN_Q30 +#define IVAS_ACTIVEW_DM_F_SCALE_FX IVAS_ACTIVEW_DM_F_SCALE * ONE_IN_Q31 #define IVAS_ACTIVEW_DM_F_SCALE_DTX 0.25f -#define IVAS_ACTIVEW_DM_F_SCALE_DTX_FX ONE_IN_Q29 +#define IVAS_ACTIVEW_DM_F_SCALE_DTX_FX IVAS_ACTIVEW_DM_F_SCALE_DTX * ONE_IN_Q31 #define IVAS_ACTIVEW_DM_F_SCALE_VLBR 0.25f -#define IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX ONE_IN_Q29 +#define IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX IVAS_ACTIVEW_DM_F_SCALE_VLBR * ONE_IN_Q31 #define IVAS_SPAR_FOA_DFLT_FREQ_PER_CHAN 24000 #define IVAS_SPAR_DYN_ACTIVEW_THRESH (0.0039f) +#define IVAS_SPAR_DYN_ACTIVEW_THRESH_FX IVAS_SPAR_DYN_ACTIVEW_THRESH * ONE_IN_Q31 #define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH (32.0f) #define MAX_QUANT_STRATS 3 diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ddaddc3e1..c3a997af0 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5466,6 +5466,23 @@ void ivas_create_fullr_dmx_mat( ivas_spar_md_com_cfg *hMdCfg ); +#ifdef IVAS_FLOAT_FIXED +void ivas_create_fullr_dmx_mat_fx( + Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 q_pred_coeffs_re, + Word32 dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 q_dm_fv_re, + Word32 ***mixer_mat, + Word16 *q_mixer_mat, + const Word16 in_chans, + const Word16 start_band, + const Word16 end_band, + const Word16 active_w, + ivas_spar_md_com_cfg *hMdCfg +); +#endif // IVAS_FLOAT_FIXED + + void ivas_calc_c_p_coeffs( ivas_spar_md_t *pSparMd, float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], @@ -5480,18 +5497,18 @@ void ivas_calc_c_p_coeffs( ); #ifdef IVAS_FLOAT_FIXED void ivas_get_spar_md_from_dirac_fx( - float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float diffuseness[IVAS_MAX_NUM_BANDS], + Word32 azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + Word32 ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + Word32 diffuseness[IVAS_MAX_NUM_BANDS], const int16_t n_ts, - float ***mixer_mat, + Word32 ***mixer_mat, ivas_spar_md_t *hSpar_md, ivas_spar_md_com_cfg *hSpar_md_cfg, const int16_t start_band, const int16_t end_band, const int16_t order, const int16_t dtx_vad, - float Wscale_d[IVAS_MAX_NUM_BANDS], + Word32 Wscale_d[IVAS_MAX_NUM_BANDS], const uint8_t useLowerRes, const int16_t active_w_vlbr, const int16_t dyn_active_w_flag @@ -5595,7 +5612,14 @@ void ivas_spar_to_dirac( const int16_t bw, /* i : band joining factor */ const int16_t dyn_active_w_flag /* i : dynamic active W flag */ ); - +void ivas_spar_to_dirac_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + 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 dyn_active_w_flag /* i : dynamic active W flag */ +); void ivas_spar_update_md_hist( ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */ ); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index bc8288f74..c5f92d81c 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -687,22 +687,26 @@ Word16 masa_sq_fx( ); void ivas_compute_spar_params_fx( - Word32 * pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - Word32 dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], - const int16_t i_ts, - float ***mixer_mat, - const int16_t start_band, - const int16_t end_band, - const int16_t dtx_vad, - const int16_t num_ch, - const int16_t bands_bw, - const int16_t active_w, - const int16_t active_w_vlbr, - ivas_spar_md_com_cfg * hSparCfg, - ivas_spar_md_t * hSparMd, - float *pWscale, - const int16_t from_dirac, - const int16_t dyn_active_w_flag + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_cov_real, + Word32 dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 *q_dm_fv_re, + const Word16 i_ts, + Word32 ***mixer_mat_fx, + Word16 *q_mixer_mat, + const Word16 start_band, + const Word16 end_band, + const Word16 dtx_vad, + const Word16 num_ch, + const Word16 bands_bw, + const Word16 active_w, + const Word16 active_w_vlbr, + ivas_spar_md_com_cfg *hSparCfg, + ivas_spar_md_t *hSparMd, + Word32 *pWscale_fx, + Word16 *q_pWscale, + const Word16 from_dirac, + const Word16 dyn_active_w_flag ); ivas_error ivas_ism_metadata_dec_fx( @@ -1416,6 +1420,14 @@ void ivas_sba_dirac_stereo_dec_fx( const Word16 mcmasa /* i : McMASA flag */ ); +ivas_error ivas_osba_render_sf_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + Word32 *p_output[] /* o : rendered time signal */ +); + void ivas_hq_core_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure fx */ Word16 synth[], /* o : output synthesis */ @@ -1943,6 +1955,13 @@ ivas_error ivas_spar_dec_fx( Word16 *nb_bits_read /* o : number of MD bits read */ ); +void ivas_spar_md_dec_process_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ + const Word16 num_bands_out, /* i : number of output bands */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ +); + ivas_error TDREND_Update_object_positions_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const Word16 num_src, /* i : number of sources to render */ @@ -2114,4 +2133,23 @@ ivas_error ivas_ism_metadata_dec_create_fx( const Word16 n_ISms, /* i : number of objects */ Word32 element_brate_tmp[] /* o : element bitrate per object */ ); +ivas_error ivas_sba_dec_reconfigure_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t *nSamplesFlushed, /* o : number of samples flushed */ + int16_t *data /* o : output synthesis signal */ +); + +ivas_error ivas_spar_md_dec_matrix_open_fx( + 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 /* i : number of MD subframes */ +); +void ivas_spar_md_dec_matrix_close_fx( + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels /* i : number of internal channels */ +); +ivas_error ivas_spar_dec_open_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ +); #endif diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 743a70635..d7ccff598 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -71,7 +71,9 @@ #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH_Q29 ( 1610612736 ) #define IVAS_P_NORM_SCALING ( 1.0f ) +#define IVAS_P_NORM_SCALING_FX ( ONE_IN_Q31 ) // Q31 #define IVAS_P_NORM_SCALING_DTX ( 0.75f ) +#define IVAS_P_NORM_SCALING_DTX_FX ( 1610612736 ) // Q31 #define IVAS_MAT_DIM_3 ( 3 ) #define IVAS_MAT_DIM_2 ( 2 ) @@ -99,16 +101,21 @@ static void ivas_get_pred_coeffs_fx( const Word16 res_ind, Word16 *q_pred_coeffs, Word16 *q_dm_fv_re ); + static void ivas_reorder_array( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t order[IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t start_band, const int16_t end_band ); +static void ivas_reorder_array_fx(Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], const Word16 in_chans, const Word16 order[IVAS_SPAR_MAX_CH], Word32 ***mixer_mat, const Word16 start_band, const Word16 end_band); static void ivas_get_Wscaling_factor( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ***mixer_mat, const int16_t start_band, const int16_t end_band, const int16_t dtx_vad, const int16_t num_ch, const int16_t *pNum_dmx, const int16_t bands_bw, const int16_t active_w, const int16_t active_w_vlbr, float *pWscale, const int16_t dyn_active_w_flag ); +static void ivas_get_Wscaling_factor_fx(Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 q_cov_real, Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], Word16 q_pred_coeffs_re, Word32 ***mixer_mat, Word16 q_mixer_mat, const Word16 start_band, const Word16 end_band, const Word16 dtx_vad, const Word16 num_ch, const Word16 *pNum_dmx, const Word16 bands_bw, const Word16 active_w, const Word16 active_w_vlbr, Word32 *pWscale, Word16 *q_pWscale, const Word16 dyn_active_w_flag ); static void ivas_calc_post_pred_per_band( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ); +static void ivas_calc_post_pred_per_band_fx(Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 q_cov_real, Word32 ***mixer_mat, Word16 q_mixer_mat, const Word16 num_ch, const Word16 band_idx, Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_postpred_cov_re); static int16_t ivas_is_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int16_t dim ); +static Word16 ivas_is_mat_inv_fx(Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 q_in_re, const Word16 dim); static void ivas_calc_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int16_t dim, float out_re[MAX_MAT_DIM][MAX_MAT_DIM] ); - +static void ivas_calc_mat_inv_fx(Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 q_in_re, const Word16 dim, Word32 out_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 *q_out_re); /*-----------------------------------------------------------------------------------------* * Function ivas_get_bw_idx_from_sample_rate() @@ -1020,6 +1027,120 @@ static void ivas_get_Wscaling_factor( } +#ifdef IVAS_FLOAT_FIXED + +static void ivas_get_Wscaling_factor_fx( + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_cov_real, + Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 q_pred_coeffs_re, + Word32 ***mixer_mat, + Word16 q_mixer_mat, + const Word16 start_band, + const Word16 end_band, + const Word16 dtx_vad, + const Word16 num_ch, + const Word16 *pNum_dmx, + const Word16 bands_bw, + const Word16 active_w, + const Word16 active_w_vlbr, + Word32 *pWscale, + Word16 *q_pWscale, + const Word16 dyn_active_w_flag ) +{ + Word16 b, ch, q_tmp, q_postpred_cov_re; + Word32 dm_f_local, abs_val; + Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + + q_postpred_cov_re = 0; move16(); + + FOR ( ch = 0; ch < IVAS_SPAR_MAX_CH; ch++ ) + { + set32_fx( postpred_cov_re[ch], 0, IVAS_SPAR_MAX_CH ); + } + + IF ( EQ_16(dtx_vad, 0) ) + { + dm_f_local = IVAS_ACTIVEW_DM_F_SCALE_DTX_FX; // Q31 + move32(); + } + ELSE IF( NE_16(active_w_vlbr, 0) ) + { + dm_f_local = IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX; // Q31 + move32(); + } + ELSE + { + dm_f_local = IVAS_ACTIVEW_DM_F_SCALE_FX; // Q31 + move32(); + } + + FOR ( b = start_band; b < end_band; b++ ) + { + pWscale[b] = 1; + move32(); + + test(); + IF ( EQ_16( active_w, 1 ) && EQ_16( dyn_active_w_flag, 0 ) ) + { + Word16 guard_bits, q_Gw_sq, q_g_sq, q_min, tmp_exp; + Word32 Gw_sq, g_sq, tmp; + + g_sq = 0; + move32(); + + IF ( NE_16(num_ch, pNum_dmx[i_mult( b, bands_bw)]) ) + { + ivas_calc_post_pred_per_band_fx( cov_real, q_cov_real, mixer_mat, q_mixer_mat, num_ch, b, postpred_cov_re, &q_postpred_cov_re); + } + + Gw_sq = BASOP_Util_Divide3232_Scale(cov_real[0][0][b], L_max( postpred_cov_re[0][0], IVAS_FIX_EPS ), &tmp_exp); + q_Gw_sq = add(sub(15, tmp_exp), sub(q_cov_real, q_postpred_cov_re)); + + guard_bits = find_guarded_bits_fx(num_ch); + + FOR ( ch = 0; ch < num_ch - 1; ch++ ) + { + abs_val = L_shr(Mpy_32_32(pred_coeffs_re[ch][b], pred_coeffs_re[ch][b]), guard_bits); + g_sq = L_add(g_sq, abs_val); + } + q_g_sq = sub(add(q_pred_coeffs_re, q_pred_coeffs_re), add(31, guard_bits)); + + tmp_exp = sub(31, q_Gw_sq); + Gw_sq = Sqrt32(Gw_sq, &tmp_exp); + q_Gw_sq = sub(31, tmp_exp); + + tmp = Mpy_32_32( ONE_IN_Q31 /*4 in Q28*/, Mpy_32_32(dm_f_local, g_sq) ); + q_tmp = sub(q_g_sq, 3); + + q_min = s_min(q_Gw_sq, q_tmp); + Gw_sq = L_shr(Gw_sq, sub(q_Gw_sq, q_min)); + q_Gw_sq = q_min; move16(); + tmp = L_shr(tmp, sub(q_tmp, q_min)); + + tmp = L_add(Gw_sq, tmp); + + tmp_exp = sub(31, q_min); + tmp = Sqrt32(tmp, &tmp_exp); + q_tmp = sub(31, tmp_exp); + + q_min = s_min(q_Gw_sq, q_tmp); + Gw_sq = L_shr(Gw_sq, sub(q_Gw_sq, q_min)); + q_Gw_sq = q_min; move16(); + tmp = L_shr(tmp, sub(q_tmp, q_min)); + + pWscale[b] = Mpy_32_32(L_add(Gw_sq, tmp), ONE_IN_Q30 /* 0.5 in Q31*/); + q_pWscale[b] = q_Gw_sq; + move16(); + } + } + + return; +} + +#endif + + /*-----------------------------------------------------------------------------------------* * Function ivas_create_fullr_dmx_mat() * @@ -1131,6 +1252,134 @@ void ivas_create_fullr_dmx_mat( return; } +#ifdef IVAS_FLOAT_FIXED + +void ivas_create_fullr_dmx_mat_fx( + Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 q_pred_coeffs_re, + Word32 dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 q_dm_fv_re, + Word32 ***mixer_mat, + Word16 *q_mixer_mat, + const Word16 in_chans, + const Word16 start_band, + const Word16 end_band, + const Word16 active_w, + ivas_spar_md_com_cfg *hMdCfg) +{ + Word16 i, j, k, b; + const Word16 *order; + Word32 max_val_tmp_p2; + Word32 tmp_p1_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; + Word32 tmp_p2_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; + Word32 down_mix_mat1_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; + Word16 remix_unmix_order; + Word16 nbands; + + max_val_tmp_p2 = 0; move32(); + + nbands = sub(end_band, start_band); + remix_unmix_order = hMdCfg->remix_unmix_order; move16(); + + order = remix_order_set[remix_unmix_order]; move16(); + + FOR (i = 0; i < in_chans; i++) + { + FOR (j = 0; j < in_chans; j++) + { + set32_fx(&tmp_p1_re[i][j][start_band], 0, nbands); + set32_fx(&tmp_p2_re[i][j][start_band], 0, nbands); + set32_fx(&down_mix_mat1_re[i][j][start_band], 0, nbands); + } + } + + FOR (j = 0; j < in_chans; j++) + { + FOR (b = start_band; b < end_band; b++) + { + tmp_p2_re[j][j][b] = L_shl(1, q_pred_coeffs_re); move32(); + max_val_tmp_p2 = L_max(max_val_tmp_p2, L_abs(tmp_p2_re[j][j][b])); + } + } + + FOR (j = 1; j < in_chans; j++) + { + FOR (b = start_band; b < end_band; b++) + { + tmp_p2_re[j][0][b] = -pred_coeffs_re[j - 1][b]; move32(); + max_val_tmp_p2 = L_max(max_val_tmp_p2, L_abs(tmp_p2_re[j][0][b])); + } + } + + IF (EQ_16(active_w, 1)) + { + Word16 guard_bits; + Word32 max_val, tmp_re; + + max_val = 0; move32(); + + FOR (j = 0; j < in_chans; j++) + { + FOR (b = start_band; b < end_band; b++) + { + tmp_p1_re[j][j][b] = L_shl(1, q_dm_fv_re); move32(); + max_val = L_max(max_val, L_abs(tmp_p1_re[j][j][b])); + } + } + + FOR (j = 1; j < in_chans; j++) + { + FOR (b = start_band; b < end_band; b++) + { + tmp_p1_re[0][j][b] = dm_fv_re[j - 1][b]; move32(); + max_val = L_max(max_val, L_abs(tmp_p1_re[0][j][b])); + } + } + + guard_bits = add(norm_l(max_val), norm_l(max_val_tmp_p2)); + guard_bits = s_max(sub(find_guarded_bits_fx(sub(end_band, start_band)), guard_bits), 0); + /* 4x4 mult */ + FOR (i = 0; i < in_chans; i++) + { + FOR (j = 0; j < in_chans; j++) + { + FOR (k = 0; k < in_chans; k++) + { + FOR (b = start_band; b < end_band; b++) + { + tmp_re = L_shr(Mpy_32_32(tmp_p2_re[i][k][b], tmp_p1_re[k][j][b]), guard_bits); + down_mix_mat1_re[i][j][b] = L_add(down_mix_mat1_re[i][j][b], tmp_re); move32(); + } + } + } + } + *q_mixer_mat = sub(add(q_dm_fv_re, q_pred_coeffs_re), add(31, guard_bits)); + } + ELSE + { + FOR (j = 0; j < in_chans; j++) + { + FOR (k = 0; k < in_chans; k++) + { + FOR (b = start_band; b < end_band; b++) + { + down_mix_mat1_re[j][k][b] = tmp_p2_re[j][k][b]; move32(); + } + } + } + *q_mixer_mat = q_pred_coeffs_re; + } + + IF (NE_16(remix_unmix_order, 3)) + { + ivas_reorder_array_fx(down_mix_mat1_re, in_chans, order, mixer_mat, start_band, end_band); + } + + return; +} + +#endif // IVAS_FLOAT_FIXED + /*-----------------------------------------------------------------------------------------* * Function ivas_reorder_array() @@ -1164,6 +1413,34 @@ static void ivas_reorder_array( return; } +#ifdef IVAS_FLOAT_FIXED +static void ivas_reorder_array_fx( + Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], + const Word16 in_chans, + const Word16 order[IVAS_SPAR_MAX_CH], + Word32 ***mixer_mat, + const Word16 start_band, + const Word16 end_band ) +{ + Word16 i, j, b, idx; + + FOR ( i = 0; i < in_chans; i++ ) + { + idx = order[i]; move16(); + + FOR ( j = 0; j < in_chans; j++ ) + { + FOR ( b = start_band; b < end_band; b++ ) + { + mixer_mat[i][j][b] = in_re[idx][j][b]; + move32(); + } + } + } + + return; +} +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_calc_post_pred_per_band() @@ -1235,6 +1512,129 @@ static void ivas_calc_post_pred_per_band( } +#ifdef IVAS_FLOAT_FIXED + +static void ivas_calc_post_pred_per_band_fx( + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_cov_real, + Word32 ***mixer_mat, + Word16 q_mixer_mat, + const Word16 num_ch, + const Word16 band_idx, + Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 *q_postpred_cov_re ) +{ + Word16 i, j, k, guard_bits, tmp, q_temp_mat; + Word32 dmx_mat_conj[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word32 temp_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word32 max_val; + Word64 tmp_re; + + max_val = 1; + move32(); + FOR ( i = 0; i < num_ch; i++ ) + { + FOR ( j = 0; j < num_ch; j++ ) + { + dmx_mat_conj[i][j] = mixer_mat[j][i][band_idx]; + move32(); + max_val = L_max(max_val, L_abs(dmx_mat_conj[i][j])); + } + } + + guard_bits = find_guarded_bits_fx(num_ch); + + tmp = norm_l(max_val); + IF(LT_16(tmp, guard_bits)) + { + guard_bits = sub(guard_bits, tmp); + } + ELSE + { + guard_bits = 0; + move16(); + } + + FOR ( i = 0; i < num_ch; i++ ) + { + set32_fx( temp_mat[i], 0, num_ch ); + set32_fx( postpred_cov_re[i], 0, num_ch ); + } + + max_val = 1; + move32(); + /* num_ch x num_ch mult */ + FOR ( i = 0; i < num_ch; i++ ) + { + FOR ( j = 0; j < num_ch; j++ ) + { + tmp_re = 0; + FOR ( k = 0; k < num_ch; k++ ) + { + tmp_re = W_add(tmp_re, W_shr(W_mult0_32_32(cov_real[i][k][band_idx], dmx_mat_conj[k][j]), guard_bits)); + } + IF(LT_64(W_abs(tmp_re), L_shl(IVAS_FIX_EPS, guard_bits))) + { + tmp_re = 0; + } + temp_mat[i][j] = W_extract_l(W_shr(tmp_re, q_mixer_mat)); // Q = (q_cov_real - guard_bits) + move32(); + max_val = L_max(max_val, L_abs(temp_mat[i][j])); + } + } + q_temp_mat = sub(q_cov_real, guard_bits); + + guard_bits = find_guarded_bits_fx(num_ch); + + tmp = norm_l(max_val); + IF(LT_16(tmp, guard_bits)) + { + guard_bits = sub(guard_bits, tmp); + } + ELSE + { + guard_bits = 0; + move16(); + } + + /* num_ch x num_ch mult */ + FOR ( i = 0; i < num_ch; i++ ) + { + FOR ( j = i; j < num_ch; j++ ) + { + tmp_re = 0; move64(); + FOR ( k = 0; k < num_ch; k++ ) + { + tmp_re = W_add(tmp_re, W_shr(W_mult0_32_32(mixer_mat[i][k][band_idx], temp_mat[k][j]), guard_bits)); + } + + IF(LT_64(W_abs(tmp_re), L_shl(IVAS_FIX_EPS, guard_bits))) + { + tmp_re = 0; move64(); + } + + postpred_cov_re[i][j] = W_extract_l(W_shr(tmp_re, q_mixer_mat)); + move32(); + } + } + + *q_postpred_cov_re = sub(q_temp_mat, guard_bits); + + FOR ( i = 0; i < num_ch; i++ ) + { + FOR ( j = 0; j < i; j++ ) + { + postpred_cov_re[i][j] = postpred_cov_re[j][i]; + move32(); + } + } + + return; +} + +#endif + + /*-----------------------------------------------------------------------------------------* * Function ivas_calc_p_coeffs_per_band() * @@ -1421,13 +1821,233 @@ static void ivas_calc_p_coeffs_per_band( if ( i == j ) { pSparMd->band_coeffs[b_ts_idx].P_re[j - num_dmx] = cov_uu_re[i - num_dmx][j - num_dmx]; +#ifdef IVAS_FLOAT_FIXED + pSparMd->band_coeffs[b_ts_idx].P_re_fx[j - num_dmx] =(Word32) (pSparMd->band_coeffs[b_ts_idx].P_re[j - num_dmx] *ONE_IN_Q22); +#endif + } + } + } + } + + return; +} + +#ifdef IVAS_FLOAT_FIXED + +static void ivas_calc_p_coeffs_per_band_fx( + ivas_spar_md_t *pSparMd, + const Word16 i_ts, + Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_postpred_cov_re, + const Word16 num_ch, + const Word16 dtx_vad, + const Word16 num_dmx, + const Word16 band_idx ) +{ + Word16 i, j, k; + Word16 m; + Word32 factor; + Word32 recon_uu_re[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS]; + Word32 trace; + Word32 p_norm_scaling; + Word16 q_cov_uu_re; + Word32 cov_dd_re[IVAS_SPAR_MAX_CH - 1][IVAS_SPAR_MAX_CH - 1]; + Word32 cov_uu_re[IVAS_SPAR_MAX_CH - 1][IVAS_SPAR_MAX_CH - 1]; + Word16 b_ts_idx; + + b_ts_idx = add(band_idx, imult1616(i_ts, IVAS_MAX_NUM_BANDS)); + + IF( NE_16( num_dmx, num_ch ) ) + { + set32_fx( pSparMd->band_coeffs[b_ts_idx].P_re_fx, 0, IVAS_SPAR_MAX_CH - 1 ); + pSparMd->band_coeffs[b_ts_idx].q_P_re_fx = 0;move16(); + FOR ( i = 0; i < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; i++ ) + { + set32_fx( recon_uu_re[i], 0, IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ); + } + + FOR ( i = num_dmx; i < num_ch; i++ ) + { + FOR ( j = num_dmx; j < num_ch; j++ ) + { + cov_uu_re[i - num_dmx][j - num_dmx] = postpred_cov_re[i][j]; + move32(); + } + } + q_cov_uu_re = q_postpred_cov_re; + move16(); + + IF ( dtx_vad == 1 ) + { + FOR ( i = 1; i < num_dmx; i++ ) + { + FOR ( j = 1; j < num_dmx; j++ ) + { + cov_dd_re[i - 1][j - 1] = postpred_cov_re[i][j]; + move32(); + } + } + + Word16 q_C_re = pSparMd->band_coeffs[b_ts_idx].q_C_re_fx; move16(); + + IF ( EQ_16( num_dmx, 2 ) ) + { + Word32 re1, re2; + + re1 = W_extract_l(W_shr( W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], cov_dd_re[0][0]), q_C_re)); + re2 = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], cov_dd_re[0][0]), q_C_re)); + + recon_uu_re[0][0] = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re1), q_C_re)); + recon_uu_re[0][1] = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], re1), q_C_re)); + recon_uu_re[1][0] = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re2), q_C_re)); + recon_uu_re[1][1] = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[1][0], re2), q_C_re)); + + FOR ( i = 0; i < 2; i++ ) + { + FOR ( j = 0; j < 2; j++ ) + { + cov_uu_re[i][j] = L_sub(cov_uu_re[i][j], recon_uu_re[i][j]); + move32(); + } + } + } + ELSE IF ( EQ_16( num_dmx, 3 ) ) + { + Word32 re1[2], re2; + set32_fx( re1, 0, 2 ); + + FOR ( j = 0; j < 2; j++ ) + { + FOR ( k = 0; k < 2; k++ ) + { + Word32 re; + re = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][k], cov_dd_re[k][j]), q_C_re)); + re1[j] = L_add(re1[j], re); + move32(); + } + } + + re2 = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re1[0]), q_C_re)); + recon_uu_re[0][0] = re2; move32(); + re2 = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][1], re1[1]), q_C_re)); + recon_uu_re[0][0] = L_add(recon_uu_re[0][0], re2); + + cov_uu_re[0][0] = L_sub(cov_uu_re[0][0], recon_uu_re[0][0]); + } + ELSE IF ( EQ_16( num_dmx, 4 ) ) + { + /* Step 1: Multiply C * cov_dd * C' */ + Word32 re1[3], re; + + FOR ( i = 0; i < num_ch - num_dmx; i++ ) + { + set32_fx( re1, 0, 3 ); + FOR ( m = 0; m < num_dmx - 1; m++ ) + { + FOR ( k = 0; k < num_dmx - 1; k++ ) + { + re = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[i][k], cov_dd_re[k][m]), q_C_re)); + re1[m] = L_add(re1[m], re); + move32(); + } + } + FOR ( j = 0; j < num_ch - num_dmx; j++ ) + { + FOR ( m = 0; m < num_dmx - 1; m++ ) + { + re = W_extract_l(W_shr(W_mult0_32_32(pSparMd->band_coeffs[b_ts_idx].C_re_fx[j][m], re1[m]), q_C_re)); + recon_uu_re[i][j] = L_add(recon_uu_re[i][j], re); + move32(); + } + } + } + + /* Step 2: cov_uu - recon_uu */ + FOR ( i = 0; i < num_ch - num_dmx; i++ ) + { + FOR ( j = 0; j < num_ch - num_dmx; j++ ) + { + cov_uu_re[i][j] = L_sub(cov_uu_re[i][j], recon_uu_re[i][j]); + move32(); + } + } + } + } + + p_norm_scaling = IVAS_P_NORM_SCALING_FX; + move32(); + + test(); + IF ( EQ_16( dtx_vad, 0 ) && EQ_16( num_dmx, 1 ) ) + { + p_norm_scaling = IVAS_P_NORM_SCALING_DTX_FX; + move32(); + } + + trace = 0; + move32(); + + FOR ( i = num_dmx; i < num_ch; i++ ) + { + trace = L_add(trace, L_abs(cov_uu_re[i - num_dmx][i - num_dmx])); + } + + factor = L_max( IVAS_FIX_EPS, postpred_cov_re[0][0] ); + factor = L_max( factor, Mpy_32_32( p_norm_scaling, trace ) ); + + Word16 factor_exp = 0; move16(); + factor = BASOP_Util_Divide3232_Scale(L_shl(1, q_postpred_cov_re), factor, &factor_exp); + factor = L_shl_sat(factor, factor_exp); + + /* normalise Hermitian (except for rounding) cov_uu */ + FOR ( i = num_dmx; i < num_ch; i++ ) + { + FOR ( j = num_dmx; j < num_ch; j++ ) + { + IF ( EQ_16(i, j) ) + { + /* force diagonal to be real */ + cov_uu_re[i - num_dmx][j - num_dmx] = W_extract_l(W_shr(W_mult0_32_32(cov_uu_re[i - num_dmx][j - num_dmx], factor), 15)); + move32(); + } + ELSE + { + /* set off-diag elements to zero */ + cov_uu_re[i - num_dmx][j - num_dmx] = 0; + move32(); } } } + + Word16 cov_uu_re_exp; + /* take sqrt of max of diags and zero */ + FOR ( i = num_dmx; i < num_ch; i++ ) + { + cov_uu_re_exp = sub(31, q_cov_uu_re); + cov_uu_re[i - num_dmx][i - num_dmx] = Sqrt32( L_max( 0, cov_uu_re[i - num_dmx][i - num_dmx] ), &cov_uu_re_exp ); + cov_uu_re[i - num_dmx][i - num_dmx] = L_shl(cov_uu_re[i - num_dmx][i - num_dmx], sub( q_cov_uu_re, sub(31, cov_uu_re_exp))); + move32(); move32(); + } + + /* save into MD struct */ + FOR ( i = num_dmx; i < num_ch; i++ ) + { + FOR ( j = num_dmx; j < num_ch; j++ ) + { + IF ( EQ_16(i, j) ) + { + pSparMd->band_coeffs[b_ts_idx].P_re_fx[j - num_dmx] = cov_uu_re[i - num_dmx][j - num_dmx]; + move32(); + } + } + } + pSparMd->band_coeffs[b_ts_idx].q_P_re_fx = q_cov_uu_re; + move16(); } return; } +#endif // IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* @@ -1525,6 +2145,130 @@ static void ivas_calc_c_coeffs_per_band( return; } +#ifdef IVAS_FLOAT_FIXED + +static void ivas_calc_c_coeffs_per_band_fx( + ivas_spar_md_t *pSparMd, + const Word16 i_ts, + Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_post_pred_cov_re, + const Word16 num_ch, + const Word16 num_dmx, + const Word16 band_idx, + const Word16 dtx_vad) +{ + Word16 i, j, k; + + /* worst case for cov_ud is actually 12 x 3 */ + Word32 cov_ud_re[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_DMX_CHS - 1]; + Word32 cov_dd_re[FOA_CHANNELS - 1][FOA_CHANNELS - 1]; + Word32 cov_dd_re_inv[FOA_CHANNELS - 1][FOA_CHANNELS - 1]; + Word16 q_cov_dd_re_inv; + Word32 trace_cov_dd_re; + Word32 abs_trace; + Word16 b_ts_idx; + + b_ts_idx = add(band_idx, imult1616(i_ts, IVAS_MAX_NUM_BANDS)); + + IF (EQ_16(dtx_vad, 0)) + { + set32_fx(&pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], 0, (IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS) * (IVAS_SPAR_MAX_DMX_CHS - 1)); + pSparMd->band_coeffs[b_ts_idx].q_C_re_fx = 0; move16(); + return; + } + + FOR (i = num_dmx; i < num_ch; i++) + { + FOR (j = 1; j < num_dmx; j++) + { + cov_ud_re[i - num_dmx][j - 1] = postpred_cov_re[i][j]; + move32(); + } + } + + FOR (i = 1; i < num_dmx; i++) + { + FOR (j = 1; j < num_dmx; j++) + { + cov_dd_re[i - 1][j - 1] = postpred_cov_re[i][j]; + } + } + + trace_cov_dd_re = 0; + move32(); + + FOR (i = 0; i < num_dmx - 1; i++) + { + trace_cov_dd_re = L_add(trace_cov_dd_re, cov_dd_re[i][i]); + } + trace_cov_dd_re = Mpy_32_32(trace_cov_dd_re, 10737418 /* 0.005f in Q31*/); + + abs_trace = L_abs(trace_cov_dd_re); + + IF (LE_32( abs_trace , IVAS_FIX_EPS)) + { + /* protection from cases when variance of residual channels is very small */ + set32_fx(&pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], 0, (IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS) * (IVAS_SPAR_MAX_DMX_CHS - 1)); + pSparMd->band_coeffs[b_ts_idx].q_C_re_fx = 0; move16(); + } + ELSE + { + FOR (i = 0; i < num_dmx - 1; i++) + { + cov_dd_re[i][i] = L_add(trace_cov_dd_re, cov_dd_re[i][i]); + move32(); + } + test(); + IF (EQ_16( ivas_is_mat_inv_fx(cov_dd_re, q_post_pred_cov_re, num_dmx - 1), 1) && LT_16(num_dmx, FOA_CHANNELS)) + { + set32_fx(&pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], 0, (IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS) * (IVAS_SPAR_MAX_DMX_CHS - 1)); + pSparMd->band_coeffs[b_ts_idx].q_C_re_fx = 0; move16(); + } + ELSE + { + ivas_calc_mat_inv_fx(cov_dd_re, q_post_pred_cov_re, num_dmx - 1, cov_dd_re_inv, &q_cov_dd_re_inv); + + Word16 tmp; + Word64 max_val = 1; move64(); + Word64 C_re_fx[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_DMX_CHS - 1]; + + FOR (i = 0; i < num_ch - num_dmx; i++) + { + FOR (j = 0; j < num_dmx - 1; j++) + { + C_re_fx[i][j] = 0; + move64(); + FOR (k = 0; k < num_dmx - 1; k++) + { + C_re_fx[i][j] = W_add_nosat(C_re_fx[i][j], W_mult0_32_32(cov_ud_re[i][k], cov_dd_re_inv[k][j])); + move64(); + } + IF(LT_64(max_val, W_abs(C_re_fx[i][j]))) + { + max_val = W_abs(C_re_fx[i][j]); + } + } + } + + tmp = s_max(sub(32, W_norm(max_val)), 0); + + FOR(i = 0; i < num_ch - num_dmx; i++) + { + FOR(j = 0; j < num_dmx - 1; j++) + { + pSparMd->band_coeffs[b_ts_idx].C_re_fx[i][j] = W_extract_l(W_shr(C_re_fx[i][j], tmp)); + move32(); + } + } + pSparMd->band_coeffs[b_ts_idx].q_C_re_fx = sub(add(q_cov_dd_re_inv, q_post_pred_cov_re), tmp); + } + } + + return; +} + +#endif // IVAS_FLOAT_FIXED + /*-----------------------------------------------------------------------------------------* * Function ivas_calc_c_p_coeffs() @@ -1563,6 +2307,9 @@ void ivas_calc_c_p_coeffs( for ( j = 0; j < num_dmx - 1; j++ ) { pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].C_re[i][j] = 0.0f; +#ifdef IVAS_FLOAT_FIXED + pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = 0; +#endif } } } @@ -1576,14 +2323,79 @@ void ivas_calc_c_p_coeffs( for ( i = num_dmx; i < num_ch; i++ ) { pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].P_re[i - num_dmx] = 0; +#ifdef IVAS_FLOAT_FIXED + pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].P_re_fx[i - num_dmx] = 0; +#endif + } + } + } + + return; +} + +#ifdef IVAS_FLOAT_FIXED + +void ivas_calc_c_p_coeffs_fx( + ivas_spar_md_t *pSparMd, + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_cov_real, + const Word16 i_ts, + Word32 ***mixer_mat, + Word16 q_mixer_mat, + const Word16 num_ch, + const Word16 num_dmx, + const Word16 band_idx, + const Word16 dtx_vad, + const Word16 compute_p_flag, + const Word16 dyn_active_w_flag ) +{ + Word16 i, j, q_postpred_cov_re; + Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + + IF ( NE_16( num_dmx, num_ch )) + { + ivas_calc_post_pred_per_band_fx( cov_real, q_cov_real, mixer_mat, q_mixer_mat, num_ch, band_idx, postpred_cov_re, &q_postpred_cov_re ); + + IF ( NE_16(num_dmx, 1 )) + { + ivas_calc_c_coeffs_per_band_fx( pSparMd, i_ts, postpred_cov_re, q_postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad ); + } + + IF ( dyn_active_w_flag ) + { + FOR ( i = 0; i < num_ch - num_dmx; i++ ) + { + FOR ( j = 0; j < num_dmx - 1; j++ ) + { + pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = 0; + move32(); + } + } + pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].q_C_re_fx = 0; + move16(); + } + IF ( EQ_16( compute_p_flag, 1 ) ) + { + ivas_calc_p_coeffs_per_band_fx( pSparMd, i_ts, postpred_cov_re, q_postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx ); + } + + IF ( dyn_active_w_flag ) + { + FOR ( i = num_dmx; i < num_ch; i++ ) + { pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].P_re_fx[i - num_dmx] = 0; + move32(); } + pSparMd->band_coeffs[band_idx + i_ts * IVAS_MAX_NUM_BANDS].q_P_re_fx = 0; + move16(); } } return; } +#endif // IVAS_FLOAT_FIXED + static void ivas_calc_mat_det( double in_re[MAX_MAT_DIM][MAX_MAT_DIM], @@ -1636,6 +2448,71 @@ static void ivas_calc_mat_det( return; } +#ifdef IVAS_FLOAT_FIXED + +static void ivas_calc_mat_det_fx( + Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], + Word16 q_in_re, + const Word16 dim, + Word64 *det_re, + Word16 *q_det_re +) +{ + IF ( EQ_16( dim, IVAS_MAT_DIM_3)) + { + Word64 re1, re2, re; + re1 = W_mult0_32_32(in_re[1][1], in_re[2][2]); + re2 = W_mult0_32_32(in_re[1][2], in_re[2][1]); + re = W_sub_nosat(re1, re2); + + re1 = W_mult0_32_32(in_re[0][0], W_extract_h(re)); + + *det_re = re1; + move64(); + + re1 = W_mult0_32_32(in_re[1][0], in_re[2][2]); + re2 = W_mult0_32_32(in_re[1][2], in_re[2][0]); + re = W_sub_nosat(re1, re2); + + re1 = W_mult0_32_32(in_re[0][1], W_extract_h(re)); + + *det_re = W_sub_nosat(*det_re, re1); + + re1 = W_mult0_32_32(in_re[1][0], in_re[2][1]); + re2 = W_mult0_32_32(in_re[1][1], in_re[2][0]); + re = W_sub_nosat(re1, re2); + + re1 = W_mult0_32_32(in_re[0][2], W_extract_h(re)); + + *det_re = W_add_nosat(*det_re, re1); + + *q_det_re = add(q_in_re, sub(add(q_in_re, q_in_re), 32)); + } + ELSE IF(EQ_16(dim, IVAS_MAT_DIM_2)) + { + Word64 re1, re2; + re1 = W_mult0_32_32(in_re[0][0], in_re[1][1]); + re2 = W_mult0_32_32(in_re[0][1], in_re[1][0]); + *det_re = W_sub_nosat(re1, re2); + *q_det_re = add(q_in_re, q_in_re); + } + ELSE IF( EQ_16( dim, IVAS_MAT_DIM_1)) + { + *det_re = in_re[0][0]; + move32(); + *q_det_re = q_in_re; + move16(); + } + ELSE + { + assert(!"matrix dimention not supported!"); + } + + return; +} + +#endif // IVAS_FLOAT_FIXED + /*-----------------------------------------------------------------------------------------* * Function ivas_get_mat_cofactor() @@ -1673,6 +2550,44 @@ static void ivas_get_mat_cofactor( } +#ifdef IVAS_FLOAT_FIXED + +static void ivas_get_mat_cofactor_fx( + Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], + Word32 out_re[MAX_MAT_DIM][MAX_MAT_DIM], + const Word16 row, + const Word16 col ) +{ + Word16 i, j; + Word16 r = 0, c = 0; + move16(); move16(); + + FOR ( i = 0; i < MAX_MAT_DIM; i++ ) + { + FOR ( j = 0; j < MAX_MAT_DIM; j++ ) + { + test(); + IF ( NE_16(i, row) && NE_16(j, col) ) + { + out_re[r][c] = in_re[i][j]; + move64(); + c = add(c, 1); + } + } + IF ( EQ_16(c, 2 )) + { + r = add(r, 1); + c = 0; + move16(); + } + } + + return; +} + +#endif + + /*-----------------------------------------------------------------------------------------* * Function ivas_calc_mat_inv() * @@ -1772,6 +2687,118 @@ static void ivas_calc_mat_inv( return; } +#ifdef IVAS_FLOAT_FIXED + +static void ivas_calc_mat_inv_fx( + Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], + Word16 q_in_re, + const Word16 dim, + Word32 out_re[MAX_MAT_DIM][MAX_MAT_DIM], + Word16 *q_out_re) +{ + Word64 det; + Word16 one_by_det, q_one_by_det; + Word16 i, j, q_tmp; + + IF ( EQ_16(dim, IVAS_MAT_DIM_1)) + { + det = W_mult0_32_32(in_re[0][0], in_re[0][0]); + /* assert to catch cases when input is singular matrix*/ + assert(det > 0); + + //det = (dbl_in_re[0][0] * dbl_in_re[0][0]); + //det = 1 / det = 1 / (dbl_in_re[0][0] * dbl_in_re[0][0]); + //dbl_out_re[0][0] = dbl_in_re[0][0] * det = dbl_in_re[0][0] * (1 / (dbl_in_re[0][0] * dbl_in_re[0][0])); + //dbl_out_re[0][0] = 1 / dbl_in_re[0][0]; + + one_by_det = BASOP_Util_Divide3232_Scale(1, in_re[0][0], &q_tmp); + q_one_by_det = sub(15, add(q_tmp, q_in_re)); + + out_re[0][0] = one_by_det; move32(); + *q_out_re = q_one_by_det; move16(); + } + ELSE IF(EQ_16(dim, IVAS_MAT_DIM_2)) + { + Word64 det_re; + Word16 q_det_re; + + ivas_calc_mat_det_fx(in_re, q_in_re, dim, &det_re, &q_det_re); + q_tmp = W_norm(det_re); + q_tmp = s_max(sub(32, q_tmp),0); + + det_re = W_shr(det_re, q_tmp); + q_det_re = sub(q_det_re, q_tmp); + + det = W_mult0_32_32(W_extract_l(det_re), W_extract_l(det_re)); + /* assert to catch cases when input is singular matrix*/ + assert(det > 0); + + one_by_det = BASOP_Util_Divide3232_Scale(1, W_extract_l(det_re), &q_tmp); //Q = (15 - (q_tmp + q_det_re)) + + out_re[0][0] = Mpy_32_16_1(in_re[1][1], one_by_det); + + out_re[0][1] = -Mpy_32_16_1(in_re[0][1], one_by_det); + + out_re[1][0] = -Mpy_32_16_1(in_re[1][0], one_by_det); + + out_re[1][1] = Mpy_32_16_1(in_re[0][0], one_by_det); + + *q_out_re = sub(q_in_re, add(q_tmp, q_det_re)); // Q = (15-(q_tmp + q_det_re)) + q_in_re - 15 + } + ELSE IF(EQ_16(dim, IVAS_MAT_DIM_3)) + { + Word32 fac_re[IVAS_MAT_DIM_3][IVAS_MAT_DIM_3]; + Word64 det_re, W_tmp; + Word16 q_det_re, q_W_tmp = 0; move16(); + Word16 sign = 1; move16(); + + ivas_calc_mat_det_fx(in_re, q_in_re, dim, &det_re, &q_det_re); + q_tmp = W_norm(det_re); + q_tmp = s_max(sub(32, q_tmp), 0); + + det_re = W_shr(det_re, q_tmp); + q_det_re = sub(q_det_re, q_tmp); + + IF(EQ_64(det_re, 0)) + { + det_re = 1; move64(); + } + + one_by_det = BASOP_Util_Divide3232_Scale(1, W_extract_l(det_re), &q_tmp); + q_one_by_det = sub(15, add(q_tmp, q_det_re)); + + FOR (i = 0; i < dim; i++) + { + FOR (j = 0; j < dim; j++) + { + ivas_get_mat_cofactor_fx(in_re, fac_re, i, j); + ivas_calc_mat_det_fx(fac_re, q_in_re, IVAS_MAT_DIM_2, &W_tmp, &q_W_tmp); + + out_re[j][i] = Mpy_32_16_1(W_extract_h(W_tmp), one_by_det); move32(); + out_re[j][i] = W_extract_l(W_mult0_32_32(out_re[j][i], sign)); move32(); + + IF ( s_and(add(i, j), 1) == 0) + { + sign = -1; move16(); + } + ELSE + { + sign = 1; move16(); + } + } + } + *q_out_re = sub(add(sub(q_W_tmp, 32), q_one_by_det), 15); + } + ELSE + { + assert(!"matrix dimension not supported!"); + } + + return; +} + +#endif // IVAS_FLOAT_FIXED + /*-----------------------------------------------------------------------------------------* * Function ivas_is_mat_inv() @@ -1808,6 +2835,35 @@ static int16_t ivas_is_mat_inv( return is_det_zero; } +#ifdef IVAS_FLOAT_FIXED + +static Word16 ivas_is_mat_inv_fx( + Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], + Word16 q_in_re, + const Word16 dim) +{ + Word16 is_det_zero = 0, q_det_re = 0, tmp; move16(); move16(); + Word64 det, det_re; + + ivas_calc_mat_det_fx(in_re, q_in_re, dim, &det_re, &q_det_re); + + tmp = W_norm(det_re); + tmp = s_max(sub(32, tmp), 0); + + det_re = W_shr(det_re, tmp); + q_det_re = sub(q_det_re, tmp); + + det = W_mult0_32_32(W_extract_l(det_re), W_extract_l(det_re)); + + IF (LE_64( det, IVAS_FIX_EPS)) + { + is_det_zero = 1; move16(); + } + + return is_det_zero; +} +#endif // IVAS_FLOAT_FIXED + /*-----------------------------------------------------------------------------------------* * Function ivas_compute_spar_params() @@ -1872,81 +2928,97 @@ void ivas_compute_spar_params( #ifdef IVAS_FLOAT_FIXED void ivas_compute_spar_params_fx( Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_cov_real, Word32 dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], - const int16_t i_ts, - float ***mixer_mat, - const int16_t start_band, - const int16_t end_band, - const int16_t dtx_vad, - const int16_t num_ch, - const int16_t bands_bw, - const int16_t active_w, - const int16_t active_w_vlbr, + Word16 *q_dm_fv_re, + const Word16 i_ts, + Word32 ***mixer_mat_fx, + Word16 *q_mixer_mat, + const Word16 start_band, + const Word16 end_band, + const Word16 dtx_vad, + const Word16 num_ch, + const Word16 bands_bw, + const Word16 active_w, + const Word16 active_w_vlbr, ivas_spar_md_com_cfg *hSparCfg, ivas_spar_md_t *hSparMd, - float *pWscale, - const int16_t from_dirac, - const int16_t dyn_active_w_flag ) + Word32 *pWscale_fx, + Word16 *q_pWscale, + const Word16 from_dirac, + const Word16 dyn_active_w_flag ) { Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; - float pred_coeffs_re_flt[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; - float dm_fv_re_flt[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; - int16_t b, i, ndm; - int16_t q_pred_coeffs; - int16_t q_dm_fv_re; - float cov_real_flt[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][12]; - float *p_cov_real_flt[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - for ( i = 0; i < num_ch; i++ ) - { - for ( int j = 0; j < num_ch; j++ ) + Word16 b, i, ndm; + Word16 q_pred_coeffs; + + ivas_get_pred_coeffs_fx( cov_real, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, active_w_vlbr, dtx_vad, from_dirac, dyn_active_w_flag, hSparMd->res_ind, &q_pred_coeffs, q_dm_fv_re ); + + ivas_create_fullr_dmx_mat_fx( pred_coeffs_re, q_pred_coeffs, dm_fv_re, *q_dm_fv_re, mixer_mat_fx, q_mixer_mat, num_ch, start_band, end_band, active_w, hSparCfg ); + + ivas_get_Wscaling_factor_fx( cov_real, q_cov_real, pred_coeffs_re, q_pred_coeffs, mixer_mat_fx, *q_mixer_mat, start_band, end_band, dtx_vad, num_ch, hSparCfg->num_dmx_chans_per_band, bands_bw, active_w, active_w_vlbr, pWscale_fx, q_pWscale, dyn_active_w_flag ); + + FOR (b = start_band; b < end_band; b++) + { + Word16 tmp_exp, q_tmp, tmp; + Word16 onebyscale_fx = BASOP_Util_Divide3232_Scale(L_shl(1, q_pWscale[b]), pWscale_fx[b], &tmp_exp); + q_tmp = sub(15, tmp_exp); + + tmp = sub(add(q_pred_coeffs, q_tmp), 15); + FOR (i = 0; i < num_ch - 1; i++) + { + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[i] = Mpy_32_16_1(pred_coeffs_re[i][b], onebyscale_fx); + move32(); + IF (LT_16( tmp, 0)) + { + tmp = -tmp;move16(); + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[i] = L_shl(hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[i], add(tmp, 22)); + move32(); + } + ELSE { + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[i] = L_shr(hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[i], sub(tmp, 22)); + move32(); + } + } + // hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_pred_re_fx = sub(add(q_pred_coeffs, q_tmp), 15); + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_pred_re_fx = Q22; move16(); + + FOR (i = 0; i < num_ch; i++) + { + mixer_mat_fx[0][i][b] = W_extract_l(W_shr(W_mult0_32_32(mixer_mat_fx[0][i][b], pWscale_fx[b]), q_pWscale[b])); + move32(); + } + } + + FOR ( b = start_band; b < end_band; b++ ) + { + ndm = hSparCfg->num_dmx_chans_per_band[b * bands_bw]; move16(); + + IF ( NE_16( ndm, num_ch ) ) { - for ( int k = 0; k < 12; k++ ) + ivas_calc_c_p_coeffs_fx( hSparMd, cov_real, q_cov_real, i_ts, mixer_mat_fx, *q_mixer_mat, num_ch, ndm, b, dtx_vad, 1, dyn_active_w_flag ); + + Word16 q_tmp = hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_C_re_fx; + IF( NE_16(ndm, 1 )) { - cov_real_flt[i][j][k] = (float) cov_real[i][j][k] / ONE_IN_Q30; + for (i = 0; i < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; i++) + { + for (int j = 0; j < IVAS_SPAR_MAX_DMX_CHS - 1; j++) + { + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr(hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub(q_tmp, 22)); + } + } + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_C_re_fx = Q22; } - p_cov_real_flt[i][j] = cov_real_flt[i][j]; - } - } - - ivas_get_pred_coeffs_fx( cov_real, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, active_w_vlbr, dtx_vad, from_dirac, dyn_active_w_flag, hSparMd->res_ind, &q_pred_coeffs, &q_dm_fv_re ); - for ( b = start_band; b < end_band; b++ ) - { - for ( i = 0; i < num_ch - 1; i++ ) - { - pred_coeffs_re_flt[i][b] = (float) pred_coeffs_re[i][b] / ( 1 << q_pred_coeffs ); - dm_fv_re_flt[i][b] = (float) dm_fv_re[i][b] / ( 1 << q_dm_fv_re ); - } - } - - ivas_create_fullr_dmx_mat( pred_coeffs_re_flt, dm_fv_re_flt, mixer_mat, num_ch, start_band, end_band, active_w, hSparCfg ); + q_tmp = hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_P_re_fx; - ivas_get_Wscaling_factor( p_cov_real_flt, pred_coeffs_re_flt, mixer_mat, start_band, end_band, dtx_vad, num_ch, hSparCfg->num_dmx_chans_per_band, bands_bw, active_w, active_w_vlbr, pWscale, dyn_active_w_flag ); - - for ( b = start_band; b < end_band; b++ ) - { - float onebyscale = 1.0f / pWscale[b]; - Word32 onebyscale_fx = (Word32) ( onebyscale * ( (UWord32) 1 << ( 53 - q_pred_coeffs ) ) ); - for ( i = 0; i < num_ch - 1; i++ ) - { - hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re[i] = pred_coeffs_re_flt[i][b] * onebyscale; - hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[i] = Mpy_32_32( pred_coeffs_re[i][b], onebyscale_fx ); // q_pred_coeffs + (53 - q_pred_coeffs) - 31 = Q22 - } - - for ( i = 0; i < num_ch; i++ ) - { - mixer_mat[0][i][b] *= pWscale[b]; - } - } - - for ( b = start_band; b < end_band; b++ ) - { - ndm = hSparCfg->num_dmx_chans_per_band[b * bands_bw]; - - if ( ndm != num_ch ) - { - ivas_calc_c_p_coeffs( hSparMd, p_cov_real_flt, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, dyn_active_w_flag ); + for (int j = 0; j < IVAS_SPAR_MAX_CH - 1; j++) + { + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re_fx[j] = L_shr(hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re_fx[j], sub(q_tmp, 22)); + } + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_P_re_fx = Q22; } } @@ -1969,36 +3041,23 @@ Word32 diff_norm_order3_table[8] = { 0, 1879048192, 939524096, 626349376, 469762 #define ONE_BY_FIVE_Q31 429496729 #define ONE_BY_SEVEN_Q31 306783378 void ivas_get_spar_md_from_dirac_fx( - float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float diffuseness[IVAS_MAX_NUM_BANDS], + Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + Word32 ele_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + Word32 diffuseness_fx[IVAS_MAX_NUM_BANDS], const int16_t n_ts, - float ***mixer_mat, + Word32 ***mixer_mat_fx, ivas_spar_md_t *hSpar_md, ivas_spar_md_com_cfg *hSpar_md_cfg, const int16_t start_band, const int16_t end_band, const int16_t order, const int16_t dtx_vad, - float Wscale_d[IVAS_MAX_NUM_BANDS], + Word32 Wscale_d[IVAS_MAX_NUM_BANDS], const uint8_t useLowerRes, const int16_t active_w_vlbr, const int16_t dyn_active_w_flag ) { - Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - Word32 ele_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - Word32 diffuseness_fx[IVAS_MAX_NUM_BANDS]; - for ( int i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - for ( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - azi_dirac_fx[i][j] = (Word32)(azi_dirac[i][j] * ( 1 << 22 )); - ele_dirac_fx[i][j] = (Word32)(ele_dirac[i][j] * ( 1 << 22 )); - } - diffuseness_fx[i] = (Word32)(diffuseness[i] * ( 1 << 30 )); - } - int16_t num_ch, band, i, j; int16_t block, ch; @@ -2013,20 +3072,23 @@ void ivas_get_spar_md_from_dirac_fx( Word32 *pCov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; //float dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; Word32 dm_fv_re_fx[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; - float Wscale[IVAS_MAX_NUM_BANDS]; - //Word32 Wscale_fx[IVAS_MAX_NUM_BANDS]; - float mixer_mat_local[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; + Word16 q_dm_fv_re_fx = 0; + //float Wscale[IVAS_MAX_NUM_BANDS]; + Word16 q_Wscale[IVAS_MAX_NUM_BANDS] = { 0 }; + Word32 Wscale_fx[IVAS_MAX_NUM_BANDS] = { 0 }; + //float mixer_mat_local[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; Word32 mixer_mat_local_fx[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; - float **ppMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH]; + //float **ppMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH]; Word32 **ppMixer_mat_fx[IVAS_MAX_FB_MIXER_OUT_CH]; - float *pMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; + //float *pMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; Word32 *pMixer_mat_fx[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; + Word16 q_ppMixer_mat = 0; //float en_ratio_fac, diff_norm_order1, diff_norm_order2, diff_norm_order3; Word32 en_ratio_fac_fx, diff_norm_order1_fx, diff_norm_order2_fx, diff_norm_order3_fx; int16_t active_w; int16_t ndm, foa_ch, hoa2_ch; - float P_dir_fact[IVAS_SPAR_MAX_CH - 1]; + //float P_dir_fact[IVAS_SPAR_MAX_CH - 1]; Word32 P_dir_fact_fx[IVAS_SPAR_MAX_CH - 1]; const int16_t *remix_order; @@ -2049,38 +3111,38 @@ void ivas_get_spar_md_from_dirac_fx( { for ( j = 0; j < IVAS_MAX_SPAR_FB_MIXER_IN_CH; j++ ) { - pMixer_mat[i][j] = mixer_mat_local[i][j]; + //pMixer_mat[i][j] = mixer_mat_local[i][j]; pMixer_mat_fx[i][j] = mixer_mat_local_fx[i][j]; } - ppMixer_mat[i] = pMixer_mat[i]; + //ppMixer_mat[i] = pMixer_mat[i]; ppMixer_mat_fx[i] = pMixer_mat_fx[i]; } if ( ( start_band >= 6 && hSpar_md_cfg->nchan_transport <= 2 && ( dtx_vad == 1 ) ) || ( useLowerRes && start_band >= 3 && hSpar_md_cfg->nchan_transport <= 2 && ( dtx_vad == 1 ) ) ) { - float P_norm[3]; + //float P_norm[3]; Word32 P_norm_fx[3]; int16_t idx; ndm = hSpar_md_cfg->num_dmx_chans_per_band[start_band - 1]; // ndm max value of 4 - P_norm[0] = 0.0f; + //P_norm[0] = 0.0f; P_norm_fx[0] = 0; for ( i = 0; i < max( 0, foa_ch - ndm ); i++ ) { // use 64bit if low precission - P_norm[0] += hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; + //P_norm[0] += hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; P_norm_fx[0] = P_norm_fx[0] + Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); } //P_norm[0] *= diff_norm_order1 / min( diff_norm_order1, max( 0, foa_ch - ndm ) ); // P_norm_fx[0] *= diff_norm_order1 / min( diff_norm_order1, max( 0, foa_ch - ndm ) ); P_norm_fx[0] = Mpy_32_32( L_shl( P_norm_fx[0], 3 ), diff_norm_order1_table[min( diff_norm_order1_fx, max( 0, foa_ch - ndm ) )] ); - P_norm[1] = 0.0f; + // P_norm[1] = 0.0f; P_norm_fx[1] = 0; for ( ; i < max( 0, min( num_ch, hoa2_ch ) - ndm ); i++ ) { - P_norm[1] += hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; + //P_norm[1] += hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; P_norm_fx[1] = P_norm_fx[1] + Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); } //P_norm[1] *= diff_norm_order2 / min( diff_norm_order2, max( 0, min( num_ch, hoa2_ch ) - ndm ) ); @@ -2088,11 +3150,11 @@ void ivas_get_spar_md_from_dirac_fx( P_norm_fx[1] = Mpy_32_32( L_shl( P_norm_fx[1], 3 ), diff_norm_order2_table[min( diff_norm_order2_fx, max( 0, min( num_ch, hoa2_ch ) - ndm ) )] ); - P_norm[2] = 0.0f; + //P_norm[2] = 0.0f; P_norm_fx[2] = 0; for ( ; i < num_ch - ndm; i++ ) { - P_norm[2] += hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; + //P_norm[2] += hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; P_norm_fx[2] = P_norm_fx[2] + Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); } //P_norm[2] *= diff_norm_order3 / min( diff_norm_order3, max( 0, num_ch - ndm ) ); @@ -2102,9 +3164,9 @@ void ivas_get_spar_md_from_dirac_fx( for ( i = 0; i < max( 0, foa_ch - ndm ); i++ ) { idx = remix_order[i + ndm] - ndm; - P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; + //P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); - P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[0] ); + //P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[0] ); if ( P_dir_fact_fx[idx] == 0 ) { P_dir_fact_fx[idx] = 0; @@ -2118,9 +3180,9 @@ void ivas_get_spar_md_from_dirac_fx( for ( ; i < max( 0, min( num_ch, hoa2_ch ) - ndm ); i++ ) { idx = remix_order[i + ndm] - ndm; - P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; + //P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; P_dir_fact_fx[idx] = ( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); - P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[1] ); + //P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[1] ); if ( P_dir_fact_fx[idx] == 0 ) { P_dir_fact_fx[idx] = 0; @@ -2134,9 +3196,9 @@ void ivas_get_spar_md_from_dirac_fx( for ( ; i < num_ch - ndm; i++ ) { idx = remix_order[i + ndm] - ndm; - P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; + //P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; P_dir_fact_fx[idx] = ( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); - P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[2] ); + //P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[2] ); if ( P_dir_fact_fx[idx] == 0 ) { P_dir_fact_fx[idx] = 0; @@ -2162,7 +3224,7 @@ void ivas_get_spar_md_from_dirac_fx( 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 ); - ivas_dirac_dec_get_response_fx( (int16_t) azi_dirac[band][i_ts], (int16_t) ele_dirac[band][i_ts], response_avg_fx, order ); + ivas_dirac_dec_get_response_fx( (int16_t) L_shr(azi_dirac_fx[band][i_ts], Q22), (int16_t) L_shr(ele_dirac_fx[band][i_ts], Q22), response_avg_fx, order ); /*for ( int l = 0; l < MAX_OUTPUT_CHANNELS; l++ ) { response_avg[l] = (float) response_avg_fx[l] / ( 1 << 30 ); @@ -2171,7 +3233,7 @@ void ivas_get_spar_md_from_dirac_fx( else if ( useLowerRes ) { //ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][0], (int16_t) ele_dirac[band][0], response_avg, order ); - ivas_dirac_dec_get_response_fx( (int16_t) azi_dirac[band][0], (int16_t) ele_dirac[band][0], response_avg_fx, order ); + ivas_dirac_dec_get_response_fx( (int16_t) L_shr(azi_dirac_fx[band][0], Q22), (int16_t) L_shr(ele_dirac_fx[band][0], Q22), response_avg_fx, order ); /*for ( int l = 0; l < MAX_OUTPUT_CHANNELS; l++ ) { response_avg[l] = (float) response_avg_fx[l] / ( 1 << 30 ); @@ -2182,7 +3244,7 @@ void ivas_get_spar_md_from_dirac_fx( for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { //ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][block], (int16_t) ele_dirac[band][block], &( response[block][0] ), order ); - ivas_dirac_dec_get_response_fx( (int16_t) azi_dirac[band][block], (int16_t) ele_dirac[band][block], &( response_fx[block][0] ), order ); + ivas_dirac_dec_get_response_fx( (int16_t) L_shr(azi_dirac_fx[band][block], Q22), (int16_t) L_shr(ele_dirac_fx[band][block], Q22), &( response_fx[block][0] ), order ); /*for ( int l = 0; l < MAX_OUTPUT_CHANNELS; l++ ) { response[block][l] = (float) response_fx[block][l] / ( 1 << 30 ); @@ -2191,7 +3253,7 @@ void ivas_get_spar_md_from_dirac_fx( /* average responses in all subframes*/ { - float norm; + //float norm; Word32 norm_fx; Word16 norm_q; int16_t num_ch_order, hoa2_ch_order; @@ -2212,7 +3274,7 @@ void ivas_get_spar_md_from_dirac_fx( } /*normalize 1st order*/ - norm = 0.0f; + //norm = 0.0f; norm_fx = 0; norm_q = 0; for ( ch = 1; ch < foa_ch; ch++ ) @@ -2222,7 +3284,7 @@ void ivas_get_spar_md_from_dirac_fx( } norm_q = 31 - ( 30 + 30 - 31 ); - norm = max( EPSILON, sqrtf( norm ) ); + //norm = max( EPSILON, sqrtf( norm ) ); if ( norm_fx ) { norm_fx = Sqrt32( norm_fx, &norm_q ); @@ -2261,7 +3323,7 @@ void ivas_get_spar_md_from_dirac_fx( } /*normalize 2nd order*/ - norm = 0.0f; + //norm = 0.0f; norm_fx = 0; for ( ch = foa_ch; ch < min( hoa2_ch_order, num_ch_order ); ch++ ) { @@ -2269,7 +3331,7 @@ void ivas_get_spar_md_from_dirac_fx( norm_fx = norm_fx + Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ); } norm_q = 31 - ( 29 + 29 - 31 ); - norm = max( EPSILON, sqrtf( norm ) ); + //norm = max( EPSILON, sqrtf( norm ) ); if ( norm_fx ) { norm_fx = Sqrt32( norm_fx, &norm_q ); @@ -2305,14 +3367,14 @@ void ivas_get_spar_md_from_dirac_fx( } /*normalize 3rd order*/ - norm = 0.0f; + //norm = 0.0f; for ( ch = hoa2_ch_order; ch < num_ch_order; ch++ ) { //norm += response_avg[ch] * response_avg[ch]; norm_fx = norm_fx + Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ); } norm_q = 31 - ( 29 + 29 - 31 ); - norm = max( EPSILON, sqrtf( norm ) ); + //norm = max( EPSILON, sqrtf( norm ) ); if ( norm_fx ) { norm_fx = Sqrt32( norm_fx, &norm_q ); @@ -2450,33 +3512,36 @@ void ivas_get_spar_md_from_dirac_fx( pCov_real_fx[i][j] = cov_real_dirac_fx[i][j]; } } - static int frame_counter; + /*static int frame_counter; frame_counter++; if (frame_counter > 500) { frame_counter = frame_counter; - } + }*/ active_w = ( dyn_active_w_flag == 1 ) || ( hSpar_md_cfg->active_w == 1 ); -#ifdef IVAS_FLOAT_FIXED - ivas_compute_spar_params_fx( pCov_real_fx, dm_fv_re_fx, i_ts, ppMixer_mat, start_band, end_band, dtx_vad, num_ch, 1, active_w, active_w_vlbr, hSpar_md_cfg, hSpar_md, Wscale, 1, dyn_active_w_flag ); -#else - for (int i = 0; i < num_ch; i++) - { - for (int j = 0; j < num_ch; j++) - { - for (int k = start_band; k < end_band; k++) - { - cov_real_dirac[i][j][k] = (float)cov_real_dirac_fx[i][j][k] / (1 << 30); - } - } - } +// #ifdef IVAS_FLOAT_FIXED - ivas_compute_spar_params( pCov_real, dm_fv_re, i_ts, ppMixer_mat, start_band, end_band, dtx_vad, num_ch, 1, active_w, active_w_vlbr, hSpar_md_cfg, hSpar_md, Wscale, 1, dyn_active_w_flag ); -#endif // IVAS_FLOAT_FIXED + ivas_compute_spar_params_fx( pCov_real_fx, Q30, dm_fv_re_fx, &q_dm_fv_re_fx, i_ts, ppMixer_mat_fx, &q_ppMixer_mat, start_band, end_band, dtx_vad, num_ch, 1, active_w, active_w_vlbr, hSpar_md_cfg, hSpar_md, Wscale_fx, q_Wscale, 1, dyn_active_w_flag ); - if ( mixer_mat != NULL ) +// #else +// for (int i = 0; i < num_ch; i++) +// { +// for (int j = 0; j < num_ch; j++) +// { +// for (int k = start_band; k < end_band; k++) +// { +// cov_real_dirac[i][j][k] = (float)cov_real_dirac_fx[i][j][k] / (1 << 30); +// } +// } +// } + +// ivas_compute_spar_params( pCov_real, dm_fv_re, i_ts, ppMixer_mat, start_band, end_band, dtx_vad, num_ch, 1, active_w, active_w_vlbr, hSpar_md_cfg, hSpar_md, Wscale, 1, dyn_active_w_flag ); +// +//#endif // IVAS_FLOAT_FIXED + + if ( mixer_mat_fx != NULL ) { for ( band = start_band; band < end_band; band++ ) { @@ -2486,7 +3551,7 @@ void ivas_get_spar_md_from_dirac_fx( { for ( j = 0; j < num_ch; j++ ) { - mixer_mat[i][j][band + i_ts * IVAS_MAX_NUM_BANDS] = ppMixer_mat[i][j][band]; + mixer_mat_fx[i][j][band + i_ts * IVAS_MAX_NUM_BANDS] = ppMixer_mat_fx[i][j][band]; } } @@ -2494,7 +3559,7 @@ void ivas_get_spar_md_from_dirac_fx( { for ( j = 0; j < num_ch; j++ ) { - mixer_mat[i][j][band + i_ts * IVAS_MAX_NUM_BANDS] = 0.0f; + mixer_mat_fx[i][j][band + i_ts * IVAS_MAX_NUM_BANDS] = 0; } } @@ -2502,7 +3567,7 @@ void ivas_get_spar_md_from_dirac_fx( { for ( j = 0; j < num_ch; j++ ) { - mixer_mat[0][j][band + i_ts * IVAS_MAX_NUM_BANDS] *= Wscale_d[band]; + mixer_mat_fx[0][j][band + i_ts * IVAS_MAX_NUM_BANDS] = Mpy_32_32(mixer_mat_fx[0][j][band + i_ts * IVAS_MAX_NUM_BANDS], Wscale_d[band]); } } } @@ -5568,8 +6633,8 @@ void ivas_spar_set_bitrate_config_fx( pSpar_md_cfg->active_w = ivas_spar_br_table_consts[table_idx].active_w; pSpar_md_cfg->agc_bits_ch_idx = ivas_spar_br_table_consts[table_idx].agc_bits_ch_idx; -#if 0 //Some issues - ivas_spar_get_uniform_quant_strat_fx(pSpar_md_cfg, table_idx); +#if 1 //Some issues + ivas_spar_get_uniform_quant_strat(pSpar_md_cfg, table_idx); #endif pSpar_md_cfg->quant_strat_bits = ivas_get_bits_to_encode(MAX_QUANT_STRATS); diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index c1933745d..763eb9d84 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -41,6 +41,8 @@ #include #include "wmc_auto.h" #include "prot_fx1.h" + + /*-----------------------------------------------------------------------------------------* * Function ivas_quantise_real_values() * @@ -133,6 +135,7 @@ void ivas_quantise_real_values_fx( } +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_spar_get_uniform_quant_strat() * @@ -160,67 +163,59 @@ void ivas_spar_get_uniform_quant_strat( pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; pSpar_md_com_cfg->quant_strat[i].PR.min = -1.2f; - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -644245094/2; pSpar_md_com_cfg->quant_strat[i].PR.max = 1.2f; - pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 644245094/2; + pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; pSpar_md_com_cfg->quant_strat[i].C.min = -0.8f; - pSpar_md_com_cfg->quant_strat[i].C.min_fx = -429496729/2; pSpar_md_com_cfg->quant_strat[i].C.max = 0.8f; - pSpar_md_com_cfg->quant_strat[i].C.max_fx = 429496729/2; + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_r.min = 0; - pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; pSpar_md_com_cfg->quant_strat[i].P_r.max = 0.8f; - pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 429496729/2; + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_c.min = -0.8f; - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -429496729/2; pSpar_md_com_cfg->quant_strat[i].P_c.max = 0.8f; - pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 429496729/2; + } else { pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; pSpar_md_com_cfg->quant_strat[i].PR.max = 1; - pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 536870912/2; pSpar_md_com_cfg->quant_strat[i].PR.min = -1; - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -536870912/2; + pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; pSpar_md_com_cfg->quant_strat[i].C.max = 2; - pSpar_md_com_cfg->quant_strat[i].C.max_fx = 1073741824/2; pSpar_md_com_cfg->quant_strat[i].C.min = -2; - pSpar_md_com_cfg->quant_strat[i].C.min_fx = -1073741824/2; + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_r.max = 1.0f; - pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 536870912/2; pSpar_md_com_cfg->quant_strat[i].P_r.min = 0; - pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; pSpar_md_com_cfg->quant_strat[i].P_c.max = 0.5; - pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 268435456/2; pSpar_md_com_cfg->quant_strat[i].P_c.min = -0.5; - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -268435456/2; + } } return; } -#if 0 -void ivas_spar_get_uniform_quant_strat_fx( +#else +void ivas_spar_get_uniform_quant_strat( ivas_spar_md_com_cfg *pSpar_md_com_cfg, const Word16 table_idx) { @@ -230,58 +225,58 @@ void ivas_spar_get_uniform_quant_strat_fx( pSpar_md_com_cfg->num_quant_strats = MAX_QUANT_STRATS; - FOR (i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++) + for ( i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++ ) { - PQ_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; - C_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; - Pr_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; - Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3]; - - IF (active_w) - { - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -1288490188;//Q30 - pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 1288490188;//Q30 - - pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.min_fx = -858993459;//Q30 - pSpar_md_com_cfg->quant_strat[i].C.max_fx = 858993459;//Q30 - - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; - pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 858993459;//Q30 - - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -858993459;//Q30 - pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 858993459;//Q30 - } - ELSE - { - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q30;//Q30 - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -ONE_IN_Q30;//Q30 - - pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.max_fx = 2147483648;//Q30 - pSpar_md_com_cfg->quant_strat[i].C.min_fx = -2147483648;//Q30 - - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q30;//Q30 - pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; - - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 536870912;//Q30 - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -536870912;//Q30 - } - } + PQ_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; + C_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; + Pr_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; + Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3]; + + if ( active_w ) + { + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; + pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -322122547;//1.2*Q28 + pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 322122547;//1.2*Q28 + + pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; + pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; + pSpar_md_com_cfg->quant_strat[i].C.min_fx = -214748364; + pSpar_md_com_cfg->quant_strat[i].C.max_fx = 214748364;//.8*Q28 + + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; + pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 214748364;//.8*Q28 + + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -214748364;//.8*Q28 + pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 214748364; //.8*Q28 + } + else + { + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; + pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28; + pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -ONE_IN_Q28; + + pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; + pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; + pSpar_md_com_cfg->quant_strat[i].C.max_fx = 2 *ONE_IN_Q28; + pSpar_md_com_cfg->quant_strat[i].C.min_fx = -2*ONE_IN_Q28; + + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q28; + pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; + + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; + pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; //.5* Q28 + pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -ONE_IN_Q27;//.5* Q28 + } + } return; } @@ -402,22 +397,11 @@ void ivas_map_prior_coeffs_quant( } #endif -void ivas_spar_quant_dtx_init_fx( - ivas_spar_md_t *spar_md, - Word32 *min_max) -{ - spar_md->min_max_fx[0] = min_max[0]; - spar_md->min_max_fx[1] = min_max[1]; - - return; -} - /*-----------------------------------------------------------------------------------------* * Function ivas_spar_quant_dtx_init() * * Init SPAR MD with minmax vals *-----------------------------------------------------------------------------------------*/ - void ivas_spar_quant_dtx_init( ivas_spar_md_t *spar_md, float *min_max ) @@ -427,7 +411,7 @@ void ivas_spar_quant_dtx_init( return; } -#if 0 + void ivas_spar_quant_dtx_init_fx( ivas_spar_md_t *spar_md, Word32 *min_max) @@ -437,7 +421,7 @@ void ivas_spar_quant_dtx_init_fx( return; } -#endif + /*-----------------------------------------------------------------------------------------* * Function ivas_copy_band_coeffs_idx_to_arr() * @@ -496,7 +480,6 @@ void ivas_copy_band_coeffs_idx_to_arr( * * clear band coeffs array in SPAR MD *-----------------------------------------------------------------------------------------*/ - void ivas_clear_band_coeffs( ivas_band_coeffs_t *pband_coeffs, const uint16_t num_bands ) @@ -506,22 +489,17 @@ void ivas_clear_band_coeffs( for ( i = 0; i < num_bands; i++ ) { set_zero( (float *) pband_coeffs[i].C_re, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); - set32_fx( (Word32 *) pband_coeffs[i].C_re_fx, 0, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); set_zero( (float *) pband_coeffs[i].P_re, ( IVAS_SPAR_MAX_CH - 1 ) ); - set32_fx( (Word32 *) pband_coeffs[i].P_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) ); set_zero( (float *) pband_coeffs[i].C_quant_re, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); - set32_fx( (Word32 *) pband_coeffs[i].C_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); set_zero( (float *) pband_coeffs[i].P_quant_re, ( IVAS_SPAR_MAX_CH - 1 ) ); - set32_fx( (Word32 *) pband_coeffs[i].P_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) ); set_zero( pband_coeffs[i].pred_re, ( IVAS_SPAR_MAX_CH - 1 ) ); - set32_fx( pband_coeffs[i].pred_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) ); set_zero( pband_coeffs[i].pred_quant_re, ( IVAS_SPAR_MAX_CH - 1 ) ); - set32_fx( pband_coeffs[i].pred_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) ); + } return; } -#if 0 + void ivas_clear_band_coeffs_fx( ivas_band_coeffs_t *pband_coeffs, const UWord16 num_bands) @@ -540,7 +518,7 @@ void ivas_clear_band_coeffs_fx( return; } -#endif + /*-----------------------------------------------------------------------------------------* * Function ivas_clear_band_coeff_idx() * diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 5636c4b64..3b70fb63b 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -187,8 +187,11 @@ typedef struct ivas_band_coeffs_t float C_quant_re[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_DMX_CHS - 1]; float P_quant_re[IVAS_SPAR_MAX_CH - 1]; + Word16 q_pred_re_fx; Word32 pred_re_fx[IVAS_SPAR_MAX_CH - 1]; + Word16 q_C_re_fx; Word32 C_re_fx[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_DMX_CHS - 1]; + Word16 q_P_re_fx; Word32 P_re_fx[IVAS_SPAR_MAX_CH - 1]; Word32 pred_quant_re_fx[IVAS_SPAR_MAX_CH - 1]; Word32 C_quant_re_fx[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_DMX_CHS - 1]; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 34be75e2e..23ad8c10c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3673,6 +3673,7 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) { mvr2r( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + //Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL32( diffuseness_vector, hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], Q30, hSpatParamRendCom->num_freq_bands ); md_idx = hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b962184bb..53e5ce546 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -182,7 +182,11 @@ ivas_error ivas_dec_setup( num_bits_read = add(num_bits_read, SBA_ORDER_BITS); IF ( GT_16(st_ivas->ini_frame , 0) && NE_32(ivas_total_brate, st_ivas->last_active_ivas_total_brate) && GT_32(ivas_total_brate, IVAS_SID_5k2 )) { +#ifndef IVAS_FLOAT_FIXED IF ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#else + IF ( ( error = ivas_sba_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -267,7 +271,7 @@ ivas_error ivas_dec_setup( numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( int j = 0; j < numch_in; j++ ) @@ -291,6 +295,7 @@ ivas_error ivas_dec_setup( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -351,6 +356,7 @@ ivas_error ivas_dec_setup( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ((float)(st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i]) / (1LL << (Q11))); /*Rounding off*/ } } +#if 0 FOR(int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++) { FOR(int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++) @@ -364,6 +370,7 @@ ivas_error ivas_dec_setup( } } } +#endif // fix2float (to be cleaned) IF((LT_32(hDecoderConfig->ivas_total_brate, IVAS_24k4)) && ((EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2)) || (EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3)))) { @@ -683,7 +690,11 @@ ivas_error ivas_dec_setup( IF ( GT_16(st_ivas->ini_frame, 0) && NE_32(ivas_total_brate, st_ivas->last_active_ivas_total_brate )) { +#ifndef IVAS_FLOAT_FIXED IF ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#else + IF ( ( error = ivas_sba_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -810,7 +821,11 @@ ivas_error ivas_dec_setup( st_ivas->hDecoderConfig->ivas_total_brate = IVAS_24k4; } +#ifndef IVAS_FLOAT_FIXED IF ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#else + IF ( ( error = ivas_sba_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1552,7 +1567,7 @@ ivas_error ivas_init_decoder_fx( return error; } - IF ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_spar_dec_open_fx( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -1705,7 +1720,7 @@ ivas_error ivas_init_decoder_fx( return error; } - IF ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_spar_dec_open_fx( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -3630,7 +3645,14 @@ void destroy_core_dec( ) { #ifdef IVAS_FLOAT_FIXED - destroy_cldfb_decoder_ivas_fx( hCoreCoder ); + IF( EQ_16( hCoreCoder->element_mode, EVS_MONO ) ) + { + destroy_cldfb_decoder_fx( hCoreCoder ); + } + ELSE + { + destroy_cldfb_decoder_ivas_fx( hCoreCoder ); + } #else destroy_cldfb_decoder_flt( hCoreCoder ); #endif // IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index f684450d4..399e6508d 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -515,7 +515,8 @@ static ivas_error ivas_ism_bitrate_switching_dec( numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - + hSpar->hMdDec->Q_mixer_mat = q1; +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( int j = 0; j < numch_in; j++ ) @@ -539,6 +540,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -591,6 +593,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } +#if 0 FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -604,6 +607,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 385c0505b..86b499d06 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -622,6 +622,7 @@ ivas_error ivas_jbm_dec_tc( hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -695,6 +696,7 @@ ivas_error ivas_jbm_dec_tc( } } } +#endif #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx ), ( p_output_fx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -704,7 +706,7 @@ ivas_error ivas_jbm_dec_tc( } ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, num_md_sub_frames ); -#if 1 /*Fixed to float changes */ +#if 0 /*Fixed to float changes */ FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { @@ -814,19 +816,10 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); - } - for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) - { - for ( int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++ ) - { - floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - Q31, - st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); - } + //floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; + for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; @@ -834,6 +827,7 @@ ivas_error ivas_jbm_dec_tc( floatToFixed_arrL( &hCPE->prev_synth[0][0], &hCPE->prev_synth_fx[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, st_ivas->ivas_format == MC_FORMAT ); + FOR( i = 0; i < 2; i++ ) { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); @@ -878,19 +872,9 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } - for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) - { - for ( int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++ ) - { - fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - Q31, - st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); - } - } - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; + for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); hCPE->q_output_mem_fx[ii] = Q11; @@ -935,6 +919,7 @@ ivas_error ivas_jbm_dec_tc( hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -1008,9 +993,11 @@ ivas_error ivas_jbm_dec_tc( } } } +#endif #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, p_output_fx, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #if 1 /*Fixed to float changes */ +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -1024,6 +1011,7 @@ ivas_error ivas_jbm_dec_tc( } } } +#endif FOR( Word16 c = 0; c < nchan_transport; c++ ) { Scale_sig32( p_output_fx[c], output_frame, 11 ); @@ -1515,6 +1503,7 @@ ivas_error ivas_jbm_dec_tc( hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -1588,6 +1577,7 @@ ivas_error ivas_jbm_dec_tc( } } } +#endif #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -1596,9 +1586,12 @@ ivas_error ivas_jbm_dec_tc( ivas_pca_dec_fx( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, &p_output_fx[sba_ch_idx] ); } +#ifndef IVAS_FLOAT_FIXED + ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); +#else ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); -#if 1 /*Fixed to float changes */ - +#endif +#if 0 /* Fixed to float changes*/ FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -1703,9 +1696,11 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); + //floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } - for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) + st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; +#if 0 + for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) { for ( int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++ ) { @@ -1715,6 +1710,7 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); } } +#endif FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); @@ -1764,19 +1760,10 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); + //fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } - for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) - { - for ( int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++ ) - { - fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - Q31, - st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); - } - } - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; + FOR (int ii = 0; ii < CPE_CHANNELS; ii++) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); hCPE->q_output_mem_fx[ii] = Q11; @@ -1816,6 +1803,7 @@ ivas_error ivas_jbm_dec_tc( hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -1889,9 +1877,10 @@ ivas_error ivas_jbm_dec_tc( } } } +#endif #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, &p_output_fx[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); -#if 1 /*Fixed to float changes */ +#if 0 /*Fixed to float changes */ FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -1905,6 +1894,8 @@ ivas_error ivas_jbm_dec_tc( } } } +#endif +#if 1 FOR( Word16 c = 0; c < nchan_transport; c++ ) { Scale_sig32( p_output_fx[sba_ch_idx + c], output_frame, Q11 ); @@ -2847,17 +2838,20 @@ ivas_error ivas_jbm_dec_tc( } IF( st_ivas->hSpar != NULL ) { - floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); - for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) + //floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); + st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; +#if 0 + for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) { - for ( int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++ ) - { - floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], + for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) + { + floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], Q31, st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); } } +#endif } FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { @@ -2912,11 +2906,13 @@ ivas_error ivas_jbm_dec_tc( } IF( st_ivas->hSpar != NULL ) { - fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); - for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) + //fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); + st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; + for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) { fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); } +#if 0 IF( st_ivas->hSpar != NULL ) { fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); @@ -2931,6 +2927,7 @@ ivas_error ivas_jbm_dec_tc( } } } +#endif FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); @@ -3803,10 +3800,10 @@ ivas_error ivas_jbm_dec_tc( *--------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void 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*/ - float *data /* i : transport channels */ + 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*/ + float *data /* i : transport channels */ ) { float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k] = { 0 }; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ @@ -3929,6 +3926,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4002,6 +4000,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) @@ -4075,6 +4074,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) { +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED FOR(i_ts = 0; i_ts < num_md_sub_frames; i_ts++) { FOR(i = 0; i < num_out_ch; i++) @@ -4088,6 +4088,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF(hSpar->hMdDec->td_decorr_flag && !(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM))) { @@ -4180,6 +4181,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4253,6 +4255,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) @@ -4325,6 +4328,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4338,6 +4342,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4406,6 +4411,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4479,6 +4485,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) @@ -4551,6 +4558,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4564,6 +4572,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4634,6 +4643,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4707,6 +4717,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) @@ -4779,6 +4790,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -4792,6 +4804,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4985,6 +4998,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -5058,6 +5072,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) @@ -5130,6 +5145,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { +#if 0 FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -5143,6 +5159,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -5827,6 +5844,8 @@ ivas_error ivas_jbm_dec_render( floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } Word16 q1 = 30, q2 = 30; + hSpar->hMdDec->Q_mixer_mat = 30; +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( j = 0; j < numch_in; j++ ) @@ -5850,6 +5869,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -5857,14 +5877,14 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } + //if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) + //{ + // for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + // { + // floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + // } + // floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); + //} FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5892,6 +5912,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } +#if 0 FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -5905,6 +5926,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -5982,6 +6004,8 @@ ivas_error ivas_jbm_dec_render( floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } Word16 q1 = 30, q2 = 30; + hSpar->hMdDec->Q_mixer_mat = 30; +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( j = 0; j < numch_in; j++ ) @@ -6005,6 +6029,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -6061,6 +6086,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } +#if 0 FOR( Word16 m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -6074,6 +6100,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -6160,7 +6187,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifdef IVAS_FLOAT_FIXED Word16 q = 15; FOR(Word16 ind1 = 0; ind1 < s_max(st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max(st_ivas->nchan_transport, st_ivas->nchan_ism)); ind1++) { @@ -6190,6 +6216,7 @@ ivas_error ivas_jbm_dec_render( { return error; } + q = Q11; FOR(Word16 ind1 = 0; ind1 < s_max(st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max(st_ivas->nchan_transport, st_ivas->nchan_ism)); ind1++) { FOR(Word16 ind2 = 0; ind2 < L_FRAME48k; ind2++) @@ -6197,12 +6224,6 @@ ivas_error ivas_jbm_dec_render( p_output[ind1][ind2] = (float)(p_output_fx[ind1][ind2]) / (float)(1 << q); } } -#else - if ( ( error = ivas_osba_render_sf( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/ { @@ -6228,6 +6249,8 @@ ivas_error ivas_jbm_dec_render( floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } Word16 q1 = 30, q2 = 30; + hSpar->hMdDec->Q_mixer_mat = 30; +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( j = 0; j < numch_in; j++ ) @@ -6251,6 +6274,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -6293,6 +6317,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } +#if 0 FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -6306,6 +6331,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -6357,6 +6383,8 @@ ivas_error ivas_jbm_dec_render( floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } Word16 q1 = 30, q2 = 30; + hSpar->hMdDec->Q_mixer_mat = 30; +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( j = 0; j < numch_in; j++ ) @@ -6380,6 +6408,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -6422,6 +6451,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } +#if 0 FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -6435,6 +6465,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -6486,6 +6517,8 @@ ivas_error ivas_jbm_dec_render( floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } Word16 q1 = 30, q2 = 30; +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED + hSpar->hMdDec->Q_mixer_mat = 30; for ( int l = 0; l < numch_out; l++ ) { for ( j = 0; j < numch_in; j++ ) @@ -6509,6 +6542,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -6551,6 +6585,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED FOR( Word16 m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -6564,6 +6599,7 @@ ivas_error ivas_jbm_dec_render( } } } +#endif IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 083909963..2aba53751 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -3307,7 +3307,8 @@ ivas_error ivas_masa_dec_reconfigure( numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - + hSpar->hMdDec->Q_mixer_mat = 30; +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( int j = 0; j < numch_in; j++ ) @@ -3331,6 +3332,7 @@ ivas_error ivas_masa_dec_reconfigure( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -3383,6 +3385,7 @@ ivas_error ivas_masa_dec_reconfigure( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } +#if 0 FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -3396,6 +3399,7 @@ ivas_error ivas_masa_dec_reconfigure( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -3830,7 +3834,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( } #endif - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_spar_param_to_masa_param_mapping() * @@ -3850,7 +3854,7 @@ void fixedToFloat_arrL_check (Word32 *i, float *f, Word16 Q, Word16 l) } } } -#ifdef IVAS_FLOAT_FIXED + void ivas_spar_param_to_masa_param_mapping_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -6085,4 +6089,4 @@ static Word16 rint_fx( /* returns in Q0 */ res = negate( res ); } return res; -} \ No newline at end of file +} diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 31047a2c0..2ed47f58f 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1507,7 +1507,8 @@ static ivas_error ivas_mc_dec_reconfig( numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - + hSpar->hMdDec->Q_mixer_mat = 30; +#if 0 for ( int l = 0; l < numch_out; l++ ) { for ( int j = 0; j < numch_in; j++ ) @@ -1531,6 +1532,7 @@ static ivas_error ivas_mc_dec_reconfig( } } } +#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -1583,6 +1585,7 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } +#if 0 FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -1596,6 +1599,7 @@ static ivas_error ivas_mc_dec_reconfig( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index e2f467250..98af89d37 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -383,29 +383,6 @@ ivas_error ivas_omasa_dec_config_fx( numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes(st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate); - for (int l = 0; l < numch_out; l++) - { - for (int j = 0; j < numch_in; j++) - { - for (int n = 0; n < num_md_sub_frames * IVAS_MAX_NUM_BANDS; n++) - { - hSpar->hMdDec->mixer_mat_fx[l][j][n] = floatToFixed(hSpar->hMdDec->mixer_mat[l][j][n], q1); - } - } - } - for (int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++) - { - for (int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++) - { - for (int n = 0; n < IVAS_MAX_SPAR_FB_MIXER_IN_CH; n++) - { - for (int l = 0; l < IVAS_MAX_NUM_BANDS; l++) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][n][l] = floatToFixed(hSpar->hMdDec->mixer_mat_prev[m][j][n][l], q2); - } - } - } - } for (Word16 in_ch = 0; in_ch < numch_in; in_ch++) { for (Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++) @@ -462,19 +439,6 @@ ivas_error ivas_omasa_dec_config_fx( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ((float)(st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i]) / (1LL << (Q11))); /*Rounding off*/ } } - FOR(int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++) - { - FOR(int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++) - { - FOR(int n = 0; n < IVAS_MAX_SPAR_FB_MIXER_IN_CH; n++) - { - FOR(int l = 0; l < IVAS_MAX_NUM_BANDS; l++) - { - hSpar->hMdDec->mixer_mat_prev[m][j][n][l] = ((float)hSpar->hMdDec->mixer_mat_prev_fx[m][j][n][l] / (1 << q2)); - } - } - } - } // fix2float (to be cleaned) IF((LT_32(hDecoderConfig->ivas_total_brate, IVAS_24k4)) && ((EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2)) || (EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3)))) { diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 54a1c45fd..f8616e486 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -208,10 +208,33 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( channel_offset = st_ivas->nchan_ism; +#ifndef IVAS_FLOAT_FIXED if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f[channel_offset] ) ) != IVAS_ERR_OK ) { return error; } +#else + { + Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word32 *output_f_fx[MAX_OUTPUT_CHANNELS]; + for (int i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + output_f_fx[i] = &output_fx[0][0]; + } + for ( n = 0; n < channel_offset; n++ ) + { + floatToFixed_arr32( output_f[n], output_fx[n], Q8, 960 ); + } + if ((error = ivas_sba_dec_render_fx(st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f_fx[channel_offset], 960)) != IVAS_ERR_OK) + { + return error; + } + for ( n = 0; n < channel_offset; n++ ) + { + fixedToFloat_arrL( output_fx[n], output_f[n], Q8, 960 ); + } + } +#endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) { @@ -293,11 +316,11 @@ ivas_error ivas_osba_ism_metadata_dec( *-------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED ivas_error ivas_osba_render_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ - Word32 *p_output[] /* o : rendered time signal */ + Word32 *p_output[] /* o : rendered time signal */ ) { Word16 n; @@ -312,36 +335,87 @@ ivas_error ivas_osba_render_sf_fx( FOR(n = 0; n < st_ivas->nchan_ism; n++) { - Copy32(p_output[n], output_ism[n], nSamplesAsked); + v_shr(p_output[n], sub(Q15, Q11), output_ism[n], nSamplesAsked); } -#ifndef IVAS_FLOAT_TO_BE_REMOVED - // Not converted - // Do fixed to float - Word16 q = Q15; - float *p_output_flt[MAX_OUTPUT_CHANNELS]; - FOR(Word16 ind1 = 0; ind1 < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; ind1++) - { - p_output_flt[ind1] = (float *)malloc(L_FRAME48k * sizeof(float)); - FOR(Word16 ind2 = 0; ind2 < L_FRAME48k; ind2++) - { - p_output_flt[ind1][ind2] = (float)(p_output[ind1][ind2]) / (float)(1 << q); - } - } -#endif - IF((error = ivas_sba_dec_render(st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output_flt)) != IVAS_ERR_OK) +#if 1 /*Float to fixed conversion*/ + SPAR_DEC_HANDLE hSpar; + hSpar = st_ivas->hSpar; + uint16_t nchan_internal; + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; + DECODER_CONFIG_HANDLE hDecoderConfig; + hDecoderConfig = st_ivas->hDecoderConfig; + Word16 numch_out_dirac = hDecoderConfig->nchan_out; + + Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + + for ( int i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) + { + floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); + } + Word16 q1 = 30, q2 = 30; + hSpar->hMdDec->Q_mixer_mat = 30; + for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( int i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) + { + st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); + } + } + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) + { + for ( int i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); + } + FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + { + IF( st_ivas->cldfbSynDec[out_ch] ) + { + FOR( int i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) + { + st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] = float_to_fix( st_ivas->cldfbSynDec[out_ch]->cldfb_state[i], Q11 ); + } + } + } +#endif // + + IF((error = ivas_sba_dec_render_fx(st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output, 960)) != IVAS_ERR_OK) { return error; } -#ifndef IVAS_FLOAT_TO_BE_REMOVED - FOR(Word16 ind1 = 0; ind1 < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; ind1++) - { - FOR(Word16 ind2 = 0; ind2 < L_FRAME48k; ind2++) - { - p_output[ind1][ind2] = (Word32)(p_output_flt[ind1][ind2] * (1 << q)); - } - free(p_output_flt[ind1]); - } +#if 1 /*Fixed to float */ + FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) + { + FOR( int i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) + { + st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ + } + } + // fix2float (to be cleaned) + IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) + { + fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); + FOR( int i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + } + // fix2float end + FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + { + IF( st_ivas->cldfbSynDec[out_ch] ) + { + FOR( int i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) + { + st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); + } + } + } #endif IF(st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index dbf60af77..bc9814a9c 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -131,6 +131,7 @@ void ivas_sba_set_cna_cng_flag( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_sba_dec_reconfigure() * @@ -281,30 +282,802 @@ ivas_error ivas_sba_dec_reconfigure( numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + hSpar->hMdDec->Q_mixer_mat = 30; + //for ( int l = 0; l < numch_out; l++ ) + //{ + // for ( int j = 0; j < numch_in; j++ ) + // { + // for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) + // { + // hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); + // } + // } + //} + //for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) + //{ + // for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) + // { + // for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) + // { + // for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) + // { + // hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); + // } + // } + // } + //} + for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) + { + st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); + } + } + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) + { + for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); + } + FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + { + IF( st_ivas->cldfbSynDec[out_ch] ) + { + FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) + { + st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] = float_to_fix( st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] , Q11 ); + } + } + } + } + Word16 n_tc; + if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) + n_tc = st_ivas->nchan_ism; + else + n_tc = st_ivas->hTcBuffer->nchan_transport_internal; + for (int ch = 0; ch < n_tc; ch++) + { + floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); + } +#endif + if ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1 /*Fixed to float */ + if ( hTcBuffer->tc_buffer ) + fixedToFloat_arrL( hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len ); + IF( hSpar ) + { + FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) + { + FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) + { + st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); + } + } + /*FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) + { + FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) + { + FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) + { + FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) + { + hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); + } + } + } + }*/ + // fix2float (to be cleaned) + IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) + { + fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); + FOR( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + } + // fix2float end + FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + { + IF( st_ivas->cldfbSynDec[out_ch] ) + { + FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) + { + st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); + } + } + } + } +#endif +#else + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif // IVAS_FLOAT_FIXED + + /* restore correct values for the current frame*/ + st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); + st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; + } + else if ( granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) + { + if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* make sure the changed number of slots in the last subframe is not lost in the following steps */ + if ( st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hSpatParamRendCom->subframe_nbslots[st_ivas->hSpatParamRendCom->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; + } + st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; + } + } + + /* save old */ + if ( ism_mode_old != ISM_SBA_MODE_DISC ) + { + if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) + { + st_ivas->hTcBuffer->num_slots = st_ivas->hSpar->num_slots; + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpar->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpar->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered; + mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + else if ( st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + } + + /*-----------------------------------------------------------------* + * Allocate, initialize, and configure SBA handles + *-----------------------------------------------------------------*/ + + int16_t sba_order_internal; + SPAR_DEC_HANDLE hSpar; + hSpar = st_ivas->hSpar; + + sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); + + if ( hSpar != NULL ) + { + if ( ( hSpar->hPCA != NULL ) && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE ) || ( st_ivas->sba_order != 1 ) ) ) + { + free( st_ivas->hSpar->hPCA ); + hSpar->hPCA = NULL; + } + + if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) || ( last_ivas_total_brate >= IVAS_512k && ivas_total_brate < IVAS_512k ) || ( last_ivas_total_brate < IVAS_512k && ivas_total_brate >= IVAS_512k ) ) + { + ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 ); + +#ifdef IVAS_FLOAT_FIXED + if ( ( error = ivas_spar_dec_open_fx( st_ivas, 1 ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_spar_dec_open( st_ivas, 1 ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } + else if ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) + { + num_channels = st_ivas->hSpar->hMdDec->spar_md_cfg.num_umx_chs; + ivas_spar_md_dec_matrix_close( st_ivas->hSpar->hMdDec, num_channels ); + + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( hSpar->hPCA == NULL && st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 && st_ivas->ivas_format == SBA_FORMAT ) + { + if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); + } + + ivas_pca_dec_init( hSpar->hPCA ); +#ifdef IVAS_FLOAT_FIXED + ivas_pca_dec_init_fx(hSpar->hPCA); +#endif + + } + + ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); + } + else + { +#ifdef IVAS_FLOAT_FIXED + if ( ( error = ivas_spar_dec_open_fx( st_ivas, 0 ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } + + hSpar = st_ivas->hSpar; + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + + if ( st_ivas->nchan_transport == 1 ) + { + st_ivas->element_mode_init = IVAS_SCE; + } + else + { + st_ivas->element_mode_init = IVAS_CPE_MDCT; + } + + /*-----------------------------------------------------------------* + * Renderer selection + *-----------------------------------------------------------------*/ + + /* renderer might have changed */ + intern_config_old = st_ivas->intern_config; + ivas_renderer_select( st_ivas ); + + /* side effect of the renderer selection can be a changed internal config */ + if ( st_ivas->intern_config != intern_config_old ) + { + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + } + + /*-------------------------------------------------------------------* + * Reallocate and initialize binaural rendering handles + *--------------------------------------------------------------------*/ + + if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) + { + /* open fastconv binaural renderer */ + if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) + { + ivas_binRenderer_close( &st_ivas->hBinRenderer ); + } + + if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX && st_ivas->hMonoDmxRenderer == NULL ) + { + if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) + { + ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); + } + + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) + , + st_ivas->ivas_format + ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO ) ) ) + { + DIRAC_CONFIG_FLAG flag_config; + + flag_config = DIRAC_OPEN; + if ( st_ivas->hDirAC != NULL ) + { + flag_config = DIRAC_RECONFIGURE_MODE; + } + +#ifdef IVAS_FLOAT_FIXED + if ( ( error = ivas_dirac_dec_config_fx( st_ivas, flag_config ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_dirac_dec_config( st_ivas, flag_config ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } + else + { + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; + + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) + { + st_ivas->hSpar->enc_param_start_band = 0; + + set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; + } + + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); + + if ( st_ivas->hDirAC ) + { + st_ivas->hDirAC->hConfig->enc_param_start_band = st_ivas->hSpar->enc_param_start_band; + } + } + + if ( st_ivas->renderer_type == RENDERER_DISABLE ) + { +#ifdef IVAS_FLOAT_FIXED + ivas_dirac_rend_close_fx(&(st_ivas->hDirACRend)); + ivas_spat_hSpatParamRendCom_close_fx(&(st_ivas->hSpatParamRendCom)); + ivas_dirac_dec_close_fx(&(st_ivas->hDirAC)); + vbap_free_data_fx(&(st_ivas->hVBAPdata)); +#else + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close(&(st_ivas->hSpatParamRendCom)); + ivas_dirac_dec_close(&(st_ivas->hDirAC)); + vbap_free_data( &( st_ivas->hVBAPdata ) ); +#endif + } + + if ( st_ivas->hDirAC != NULL ) + { + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + } + + /*-----------------------------------------------------------------* + * Allocate, initialize, and configure SCE/CPE/MCT handles + *-----------------------------------------------------------------*/ + + if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + if ( ism_mode_old == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + int32_t temp_brate[MAX_SCE]; + + st_ivas->ism_mode = ISM_SBA_MODE_DISC; +#ifdef IVAS_FLOAT_FIXED + IF ( ( error = ivas_ism_metadata_dec_create_fx( st_ivas, st_ivas->nchan_ism, temp_brate ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, temp_brate ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + + if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING || + st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX || + st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || + st_ivas->renderer_type == RENDERER_OSBA_STEREO || + st_ivas->renderer_type == RENDERER_OSBA_AMBI || + st_ivas->renderer_type == RENDERER_OSBA_LS || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || + st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) + { +#ifdef IVAS_FLOAT_FIXED + IF ( ( error = ivas_ism_renderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#else + if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + } + + if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + if ( st_ivas->hMonoDmxRenderer == NULL ) + { + if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else + { + ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); + } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + /* Allocate TD renderer for the objects in DISC mode */ + if ( st_ivas->hBinRendererTd == NULL ) + { + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + /* Allocate memory for OSBA delay buffer */ + if ( ( error = ivas_osba_data_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; + } + else if ( ism_mode_old == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE ) + { + /* ISM renderer handle */ + ivas_ism_renderer_close( &st_ivas->hIsmRendererData ); + ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); + ivas_osba_data_close( &st_ivas->hSbaIsmData ); + + /* Time Domain binaural renderer handle */ + if ( st_ivas->hBinRendererTd != NULL ) + { + if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) + { + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; + } + } + nchan_transport_old += st_ivas->nchan_ism; + st_ivas->ism_mode = ISM_MODE_NONE; + } + else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; + nCPE_old = st_ivas->nCPE; + nchan_transport_old = st_ivas->nchan_transport; + nchan_transport_old += st_ivas->nchan_ism; + } + } + +#ifdef IVAS_FLOAT_FIXED + IF ( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } +#else + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + + /*-----------------------------------------------------------------* + * HP20 memories + *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED + if ((error = ivas_hp20_dec_reconfig_fx(st_ivas, nchan_hp20_old)) != IVAS_ERR_OK) + { + return error; + } +#endif // IVAS_FLOAT_FIXED + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*-----------------------------------------------------------------* + * TD Decorrelator + *-----------------------------------------------------------------*/ + + if ( st_ivas->hDiracDecBin != NULL ) + { + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*-----------------------------------------------------------------* + * JBM TC buffers + *-----------------------------------------------------------------*/ + + { + int16_t tc_nchan_to_allocate; + int16_t tc_nchan_tc; + TC_BUFFER_MODE tc_buffer_mode; + + tc_buffer_mode = TC_BUFFER_MODE_RENDERER; + tc_nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + tc_nchan_to_allocate = tc_nchan_tc; + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO ) + { + if ( ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) ) + { + tc_nchan_tc = st_ivas->hDecoderConfig->nchan_out + st_ivas->nchan_ism; + tc_nchan_to_allocate = tc_nchan_tc; + } + else + { + tc_buffer_mode = TC_BUFFER_MODE_BUFFER; + tc_nchan_tc = st_ivas->hDecoderConfig->nchan_out; + tc_nchan_to_allocate = tc_nchan_tc; + } + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + tc_nchan_to_allocate = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + tc_nchan_to_allocate += st_ivas->nchan_ism; + } + } + else + { + if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) + { + tc_nchan_to_allocate++; /* we need a channel for the CNG in this case*/ + } + } + + if ( tc_nchan_tc != st_ivas->hTcBuffer->nchan_transport_jbm || tc_nchan_to_allocate != st_ivas->hTcBuffer->nchan_transport_internal || tc_buffer_mode != st_ivas->hTcBuffer->tc_buffer_mode || granularity_new != st_ivas->hTcBuffer->n_samples_granularity ) + { + if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode, tc_nchan_tc, tc_nchan_to_allocate, tc_nchan_to_allocate, granularity_new ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + /* resync SPAR and DirAC JBM info from TC Buffer */ + if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity ) + { + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + } + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpar->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hSpar->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpar->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + int16_t granularityMultiplier = st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size; + int16_t n; + for ( n = 0; n < MAX_JBM_SUBFRAMES_5MS; n++ ) + { + st_ivas->hSpatParamRendCom->subframe_nbslots[n] = st_ivas->hTcBuffer->subframe_nbslots[n] * granularityMultiplier; + st_ivas->hSpar->subframe_nbslots[n] = st_ivas->hSpatParamRendCom->subframe_nbslots[n]; + } + } + + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef IVAS_FLOAT_FIXED + if ( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif // IVAS_FLOAT_FIXED + + return error; +} +#else +/*-------------------------------------------------------------------* + * ivas_sba_dec_reconfigure_fx() + * + * Reconfigure IVAS SBA decoder + *-------------------------------------------------------------------*/ + +ivas_error ivas_sba_dec_reconfigure_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + uint16_t *nSamplesFlushed, /* o : number of samples flushed */ + int16_t *data /* o : output synthesis signal */ +) +{ + int16_t nchan_transport_old, nSCE_old, nCPE_old, nchan_hp20_old; + AUDIO_CONFIG intern_config_old; + int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; + int16_t sba_dirac_stereo_flag_old; + int32_t ivas_total_brate; + int32_t last_ivas_total_brate; + int16_t num_channels, num_md_sub_frames; + int16_t nchan_out_buff, nchan_out_buff_old; + int16_t sba_analysis_order_old_flush; + DECODER_CONFIG_HANDLE hDecoderConfig; + ivas_error error; + ISM_MODE ism_mode_old; + int16_t granularity_new; + + ism_mode_old = st_ivas->ism_mode; + hDecoderConfig = st_ivas->hDecoderConfig; + ivas_total_brate = hDecoderConfig->ivas_total_brate; + last_ivas_total_brate = st_ivas->last_active_ivas_total_brate; + sba_analysis_order_old_flush = st_ivas->sba_analysis_order; + + /*-----------------------------------------------------------------* + * Set SBA high-level parameters + * Save old SBA high-level parameters + *-----------------------------------------------------------------*/ + + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, sba_analysis_order_old_flush, last_ivas_total_brate ); + + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + nchan_hp20_old = getNumChanSynthesis( st_ivas ); + + if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + if ( ivas_total_brate >= IVAS_256k ) + { + st_ivas->ism_mode = ISM_SBA_MODE_DISC; + } + else + { + st_ivas->ism_mode = ISM_MODE_NONE; + } + } + else + { + st_ivas->ism_mode = ISM_MODE_NONE; + } + + nSCE_old = st_ivas->nSCE; + nCPE_old = st_ivas->nCPE; + nchan_transport_old = st_ivas->nchan_transport; + sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag; + + st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); + + *nSamplesFlushed = 0; + granularity_new = st_ivas->hTcBuffer->n_samples_granularity; + + /* we may need to flush only for binaural and OSBA and TSM */ + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + RENDERER_TYPE renderer_type_new; + int16_t sba_order_internal; + + sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); + + /* get new renderer type */ + /* copy the logic from ivas_renderer_select(), because calling this function has too many side effects that would affect the flushing */ + if ( ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) <= 2 ) + { + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL ) + { + renderer_type_new = RENDERER_BINAURAL_PARAMETRIC; + } + else + { + renderer_type_new = RENDERER_BINAURAL_PARAMETRIC_ROOM; + } + } + else + { + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB + ) + { + renderer_type_new = RENDERER_BINAURAL_FASTCONV; + } + else + { + renderer_type_new = RENDERER_BINAURAL_FASTCONV_ROOM; + } + } + + /* determine new granularity */ + granularity_new = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + + /* this will change anyway only with binaural */ + if ( renderer_type_new == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + granularity_new *= JBM_CLDFB_SLOTS_IN_SUBFRAME; + } + + /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ + if ( granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) + { + /* write back info for correct rendering of the flushable samples */ + st_ivas->sba_analysis_order = sba_analysis_order_old_flush; + st_ivas->hDecoderConfig->ivas_total_brate = last_ivas_total_brate; - for ( int l = 0; l < numch_out; l++ ) +#ifdef IVAS_FLOAT_FIXED +#if 1 /*Float to fixed conversion*/ + DECODER_TC_BUFFER_HANDLE hTcBuffer; + hTcBuffer = st_ivas->hTcBuffer; + if ( st_ivas->hIsmRendererData ) + { + FOR( Word16 ind1 = 0; ind1 < st_ivas->hIsmRendererData->interpolator_len; ind1++ ) { - for ( int j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } + st_ivas->hIsmRendererData->interpolator_fx[ind1] = (Word16) L_min( 32767, floatToFixed( st_ivas->hIsmRendererData->interpolator_fx[ind1], 15 ) ); } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) + } + FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) + { + if ( st_ivas->hIsmMetaData[ind1] ) { - for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } + st_ivas->hIsmMetaData[ind1]->azimuth_fx = (Word32) ( st_ivas->hIsmMetaData[ind1]->azimuth * ( 1 << 22 ) ); + st_ivas->hIsmMetaData[ind1]->elevation_fx = (Word32) ( st_ivas->hIsmMetaData[ind1]->elevation * ( 1 << 22 ) ); + } + } + IF( st_ivas->hCombinedOrientationData ) + FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) + { + FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) + { + st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); + } + } + if ( st_ivas->hSbaIsmData ) + { + for ( Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++ ) + { + floatToFixed_arr32( st_ivas->hSbaIsmData->delayBuffer[ch_idx], st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], Q11, st_ivas->hSbaIsmData->delayBuffer_size ); } + } + SPAR_DEC_HANDLE hSpar; + hSpar = st_ivas->hSpar; + uint16_t nchan_internal; + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + DECODER_CONFIG_HANDLE hDecoderConfig; + hDecoderConfig = st_ivas->hDecoderConfig; + Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + ; + Word16 numch_out_dirac = hDecoderConfig->nchan_out; + IF( hSpar ) + { + numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + hSpar->hMdDec->Q_mixer_mat = 30; + //for ( int l = 0; l < numch_out; l++ ) + //{ + // for ( int j = 0; j < numch_in; j++ ) + // { + // for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) + // { + // hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); + // } + // } + //} + //for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) + //{ + // for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) + // { + // for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) + // { + // for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) + // { + // hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); + // } + // } + // } + //} for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -357,7 +1130,7 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) + /*FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) { @@ -369,7 +1142,7 @@ ivas_error ivas_sba_dec_reconfigure( } } } - } + }*/ // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -391,6 +1164,14 @@ ivas_error ivas_sba_dec_reconfigure( } } } + FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) + { + if ( st_ivas->hIsmMetaData[ind1] ) + { + st_ivas->hIsmMetaData[ind1]->azimuth = (float) ( st_ivas->hIsmMetaData[ind1]->azimuth_fx ) / (float) ( 1 << 22 ); + st_ivas->hIsmMetaData[ind1]->elevation = (float) ( st_ivas->hIsmMetaData[ind1]->elevation_fx ) / (float) ( 1 << 22 ); + } + } #endif #else if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, data ) ) != IVAS_ERR_OK ) @@ -462,7 +1243,7 @@ ivas_error ivas_sba_dec_reconfigure( { ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 ); - if ( ( error = ivas_spar_dec_open( st_ivas, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_dec_open_fx( st_ivas, 1 ) ) != IVAS_ERR_OK ) { return error; } @@ -470,10 +1251,10 @@ ivas_error ivas_sba_dec_reconfigure( else if ( last_ivas_total_brate < IVAS_24k4 && ivas_total_brate >= IVAS_24k4 ) { num_channels = st_ivas->hSpar->hMdDec->spar_md_cfg.num_umx_chs; - ivas_spar_md_dec_matrix_close( st_ivas->hSpar->hMdDec, num_channels ); + ivas_spar_md_dec_matrix_close_fx( st_ivas->hSpar->hMdDec, num_channels ); num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_md_dec_matrix_open_fx( st_ivas->hSpar->hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) { return error; } @@ -497,7 +1278,7 @@ ivas_error ivas_sba_dec_reconfigure( } else { - if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_dec_open_fx( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -879,6 +1660,9 @@ ivas_error ivas_sba_dec_reconfigure( return error; } +#endif + + #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_sba_dec_digest_tc() @@ -1341,7 +2125,8 @@ ivas_error ivas_sba_dec_render_fx( return IVAS_ERR_OK; } -#endif // IVAS_FLOAT_FIXED + +#else ivas_error ivas_sba_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -1369,6 +2154,7 @@ ivas_error ivas_sba_dec_render( output_f_local[ch] = output_f[ch]; } + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ @@ -1402,6 +2188,8 @@ ivas_error ivas_sba_dec_render( { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } +#endif +#if 0 Word16 q1 = 30, q2 = 30; for ( int l = 0; l < numch_out; l++ ) { @@ -1426,6 +2214,8 @@ ivas_error ivas_sba_dec_render( } } } +#endif +#if 1 for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -1442,7 +2232,7 @@ ivas_error ivas_sba_dec_render( floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); } #endif // - ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local, nchan_internal ); + ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local_fx, nchan_internal ); #ifdef IVAS_FLOAT_FIXED /*Fixed to float */ FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { @@ -1451,6 +2241,7 @@ ivas_error ivas_sba_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } +#if 0 FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) { FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) @@ -1464,6 +2255,7 @@ ivas_error ivas_sba_dec_render( } } } +#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -1521,3 +2313,5 @@ ivas_error ivas_sba_dec_render( return IVAS_ERR_OK; } +#endif // IVAS_FLOAT_FIXED + diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 4bf0e8807..b6929edf8 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1170,7 +1170,8 @@ void ivas_sba_dirac_stereo_smooth_parameters_fx( { FOR ( b = 0; b < hStereoDft->nbands; b++ ) { - hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS] = hMdDec->mixer_mat_fx[i][j][b]; + // The Q format of mixer_mat_fx is Q30 so applying the left shift. + hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS] = L_shl_sat(hMdDec->mixer_mat_fx[i][j][b], 1); move32(); } FOR ( ; b < IVAS_MAX_NUM_BANDS; b++ ) @@ -1191,9 +1192,10 @@ void ivas_sba_dirac_stereo_smooth_parameters_fx( { Word16 beta = hStereoDft->smooth_fac_fx[k][b]; move16(); + // The Q format of mixer_mat_prev_fx is Q30 so applying the left shift. hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS] = - Madd_32_16(Mpy_32_16_1(hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS], beta), - hMdDec->mixer_mat_prev_fx[i_hist][i][j][b], sub((Word16)0x7FFF, beta)); + L_add(Mpy_32_16_1(hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS], beta), + L_shl(Mpy_32_16_1(hMdDec->mixer_mat_prev_fx[i_hist][i][j][b], sub((Word16)0x7FFF, beta)), Q1)); move32(); } } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index ec9da41ac..7ef0a5f8b 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -997,6 +997,7 @@ void ivas_sba_mix_matrix_determiner( hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; +#if 0 FOR ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) @@ -1070,9 +1071,10 @@ void ivas_sba_mix_matrix_determiner( } } } +#endif #endif ivas_spar_dec_gen_umx_mat_fx( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, num_md_sub_frames); -#if 1 /*Fixed to float changes */ +#if 0 /*Fixed to float changes */ FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) { FOR( i = 0; i < num_out_ch; i++ ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 2fc6f2fac..af6840a9f 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -61,10 +61,12 @@ #ifdef IVAS_FLOAT_FIXED static ivas_error ivas_spar_dec_MD_fx( Decoder_Struct *st_ivas, Decoder_State *st0 ); -#endif +#else static ivas_error ivas_spar_dec_MD( Decoder_Struct *st_ivas, Decoder_State *st0 ); +#endif +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_spar_dec_open() * @@ -111,6 +113,212 @@ ivas_error ivas_spar_dec_open( num_decor_chs = num_channels_internal - 1; } + /* TD decorr. */ + if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_256k && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA ) ) ) + { + hSpar->hTdDecorr = NULL; + } + else + { + if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_decor_chs + 1, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* MD handle */ + if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format, st_ivas->last_active_ivas_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + hSpar->hMdDec->td_decorr_flag = 1; + if ( hSpar->hTdDecorr ) + { + hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[hSpar->hMdDec->table_idx].td_ducking; + } + + /* set FB config. */ + active_w_mixing = -1; + if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + fb_cfg->pcm_offset = NS2SA( output_Fs, DELAY_FB_1_NS + IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ); + fb_cfg->remix_order = remix_order_set[hSpar->hMdDec->spar_md_cfg.remix_unmix_order]; + + /* FB mixer handle */ + if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, output_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* AGC handle */ + if ( ( error = ivas_spar_agc_dec_open( &hSpar->hAgcDec, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* PCA handle */ + hSpar->hPCA = NULL; + if ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) + { + if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); + } + + ivas_pca_dec_init( hSpar->hPCA ); + } + + /* mixer_mat intitialization */ + for ( i = 0; i < num_channels_internal; i++ ) + { + for ( j = 0; j < num_channels_internal; j++ ) + { + for ( b = 0; b < IVAS_MAX_NUM_BANDS; b++ ) + { + hSpar->hMdDec->mixer_mat[i][j][b] = 0.0f; + for ( int16_t i_ts = 0; i_ts < ( MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); i_ts++ ) + { + hSpar->hMdDec->mixer_mat_prev[i_ts][i][j][b] = 0.0f; + } + } + } + } + hSpar->i_subframe = 0; + hSpar->AGC_flag = 0; + + /*-----------------------------------------------------------------* + * Configuration - set SPAR high-level parameters + *-----------------------------------------------------------------*/ + + ivas_spar_config( st_ivas->hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); + + switch ( sba_order_internal ) + { + case 1: + st_ivas->transport_config = IVAS_AUDIO_CONFIG_FOA; + break; + case 2: + st_ivas->transport_config = IVAS_AUDIO_CONFIG_HOA2; + break; + case 3: + st_ivas->transport_config = IVAS_AUDIO_CONFIG_HOA3; + break; + } + + ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); + + set_s( hSpar->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hSpar->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hSpar->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hSpar->subframes_rendered = 0; + hSpar->slots_rendered = 0; + hSpar->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + + /* init render timeslot mapping */ + set_s( hSpar->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; map_idx++ ) + { + hSpar->render_to_md_map[map_idx] = map_idx; + } + + /* allocate transport channels*/ + if ( st_ivas->hTcBuffer == NULL ) + { + int16_t nchan_to_allocate; + int16_t nchan_tc; + TC_BUFFER_MODE buffer_mode; + int16_t granularity; + + buffer_mode = TC_BUFFER_MODE_RENDERER; + nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + nchan_to_allocate = num_channels_internal; + + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + nchan_to_allocate += st_ivas->nchan_ism; + } + + granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + + if ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO ) ) + { + if ( ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) ) + { + nchan_tc = st_ivas->hDecoderConfig->nchan_out + st_ivas->nchan_ism; + nchan_to_allocate = nchan_tc; + } + else + { + buffer_mode = TC_BUFFER_MODE_BUFFER; + nchan_tc = st_ivas->hDecoderConfig->nchan_out; + nchan_to_allocate = nchan_tc; + } + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + /* get correct granularity in case of binaural rendering of the discrete objects with the td obj renderer */ + granularity = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); + } + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + st_ivas->hSpar = hSpar; + + return error; +} + +#else +ivas_error ivas_spar_dec_open_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ +) +{ + SPAR_DEC_HANDLE hSpar; + ivas_error error; + int16_t sba_order_internal, num_channels_internal; + IVAS_FB_CFG *fb_cfg; + int16_t i, j, b, active_w_mixing; + int32_t output_Fs; + int16_t num_decor_chs, map_idx; + + error = IVAS_ERR_OK; + + sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); + + num_channels_internal = ivas_sba_get_nchan_metadata( sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate ); + + hSpar = st_ivas->hSpar; + + if ( !spar_reconfig_flag ) + { + /* SPAR decoder handle */ + if ( ( hSpar = (SPAR_DEC_HANDLE) malloc( sizeof( SPAR_DEC_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); + } + } + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + if ( num_channels_internal > ( SBA_HOA2_ORDER + 1 ) * ( SBA_HOA2_ORDER + 1 ) ) + { + num_decor_chs = IVAS_HBR_MAX_DECOR_CHS; + } + else + { + num_decor_chs = num_channels_internal - 1; + } + /* TD decorr. */ if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_256k && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA ) ) ) { @@ -187,10 +395,10 @@ ivas_error ivas_spar_dec_open( { for ( b = 0; b < IVAS_MAX_NUM_BANDS; b++ ) { - hSpar->hMdDec->mixer_mat[i][j][b] = 0.0f; + hSpar->hMdDec->mixer_mat_fx[i][j][b] = 0; for ( int16_t i_ts = 0; i_ts < ( MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); i_ts++ ) { - hSpar->hMdDec->mixer_mat_prev[i_ts][i][j][b] = 0.0f; + hSpar->hMdDec->mixer_mat_prev_fx[i_ts][i][j][b] = 0; } } } @@ -291,7 +499,7 @@ ivas_error ivas_spar_dec_open( return error; } - +#endif /*------------------------------------------------------------------------- * ivas_spar_dec_close() @@ -381,6 +589,12 @@ ivas_error ivas_spar_dec_fx( { FOR( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) { + Word32 tmp = 0; + tmp = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); + if (GT_32(L_abs(sub(tmp, q_direction->band_data[j].elevation_fx[k])), 1 << Q5)) + { + assert(0); + } q_direction->band_data[j].elevation_fx[k] = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); q_direction->band_data[j].azimuth_fx[k] = (Word32) ( q_direction->band_data[j].azimuth[k] * ( 1 << 22 ) ); q_direction->band_data[j].energy_ratio_fx[k] = (Word32) ( q_direction->band_data[j].energy_ratio[k] * ( 1 << 30 ) ); @@ -536,7 +750,7 @@ ivas_error ivas_spar_dec_fx( return error; } -#endif +#else ivas_error ivas_spar_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ int16_t *nb_bits_read /* o : number of MD bits read */ @@ -569,49 +783,8 @@ ivas_error ivas_spar_dec( /* read DirAC bitstream */ if ( st_ivas->hQMetaData != NULL ) - { -#ifdef IVAS_FLOAT_FIXED - // To do remove this code once ivas_spar_dec_MD is done - for ( int d = 0; d < st_ivas->hQMetaData->no_directions; d++ ) - { - IVAS_QDIRECTION *q_direction; - q_direction = &st_ivas->hQMetaData->q_direction[d]; - int nbands = q_direction->cfg.nbands; - FOR( Word16 j = 0; j < nbands; j++ ) - { - FOR( Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) - { - q_direction->band_data[j].elevation_fx[k] = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); - q_direction->band_data[j].azimuth_fx[k] = (Word32) ( q_direction->band_data[j].azimuth[k] * ( 1 << 22 ) ); - q_direction->band_data[j].energy_ratio_fx[k] = (Word32) ( q_direction->band_data[j].energy_ratio[k] * ( 1 << 30 ) ); - } - } - } -#endif -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_dec_read_BS_fx( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); -#else + { ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); -#endif -#ifdef IVAS_FLOAT_FIXED - // To do remove this code once ivas_spar_dec_MD is done - for ( int d = 0; d < st_ivas->hQMetaData->no_directions; d++ ) - { - IVAS_QDIRECTION *q_direction; - q_direction = &st_ivas->hQMetaData->q_direction[d]; - int nbands = q_direction->cfg.nbands; - FOR( Word16 j = 0; j < nbands; j++ ) - { - FOR( Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) - { - - q_direction->band_data[j].elevation[k] = ( (float) q_direction->band_data[j].elevation_fx[k] / ( 1 << 22 ) ); - q_direction->band_data[j].azimuth[k] = ( (float) q_direction->band_data[j].azimuth_fx[k] / ( 1 << 22 ) ); - q_direction->band_data[j].energy_ratio[k] = ( (float) q_direction->band_data[j].energy_ratio_fx[k] / ( 1 << 30 ) ); - } - } - } -#endif } if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -670,6 +843,7 @@ ivas_error ivas_spar_dec( return error; } +#endif /*---------------------------------------------------------------------* @@ -1429,10 +1603,10 @@ static ivas_error ivas_spar_dec_MD_fx( * Decode MD *---------------------------------------------------------------------*/ - ivas_spar_md_dec_process( st_ivas, st0, num_bands_out, sba_order ); + ivas_spar_md_dec_process_fx( st_ivas, st0, num_bands_out, sba_order ); // Till here TBD -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED // float to fix Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; FOR( i = 0; i < num_channels_tmp; i++ ) @@ -1493,8 +1667,9 @@ static ivas_error ivas_spar_dec_MD_fx( ivas_spar_update_md_hist_fx( hSpar->hMdDec ); } -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED // fix to float + Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; FOR( i = 0; i < num_channels_tmp; i++ ) { FOR( j = 0; j < num_channels_tmp; j++ ) @@ -1514,7 +1689,7 @@ static ivas_error ivas_spar_dec_MD_fx( } ELSE { -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED // float to fix Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; FOR( i = 0; i < num_channels_tmp; i++ ) @@ -1540,7 +1715,8 @@ static ivas_error ivas_spar_dec_MD_fx( } set_s( hSpar->hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED + Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; FOR( i = 0; i < num_channels_tmp; i++ ) { FOR( j = 0; j < num_channels_tmp; j++ ) @@ -1563,7 +1739,7 @@ static ivas_error ivas_spar_dec_MD_fx( pop_wmops(); return IVAS_ERR_OK; } -#endif +#else static ivas_error ivas_spar_dec_MD( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Decoder_State *st0 /* i/o: decoder state structure - for bitstream handling*/ @@ -1632,12 +1808,7 @@ static ivas_error ivas_spar_dec_MD( if ( hSpar->hPCA != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_pca_read_bits_fx(st0, hSpar->hPCA); -#else - ivas_pca_read_bits(st0, hSpar->hPCA); -#endif - + ivas_pca_read_bits( st0, hSpar->hPCA ); } /*---------------------------------------------------------------------* @@ -1651,12 +1822,7 @@ static ivas_error ivas_spar_dec_MD( hSpar->AGC_flag = get_next_indice( st0, 1 ); } -#ifndef IVAS_FLOAT_FIXED ivas_agc_read_bits( hSpar->hAgcDec, st0, hSpar->hMdDec->spar_md_cfg.nchan_transport, hSpar->AGC_flag ); -#else - ivas_agc_read_bits_fx( hSpar->hAgcDec, st0, hSpar->hMdDec->spar_md_cfg.nchan_transport, hSpar->AGC_flag ); -#endif // IVAS_FLOAT_FIXED - } /*---------------------------------------------------------------------* @@ -1685,6 +1851,7 @@ static ivas_error ivas_spar_dec_MD( pop_wmops(); return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -1780,7 +1947,7 @@ static Word16 ivas_spar_get_cldfb_slot_gain_fx( return weight_fx; } -#endif +#else static float ivas_spar_get_cldfb_slot_gain( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ @@ -1789,47 +1956,48 @@ static float ivas_spar_get_cldfb_slot_gain( int16_t *time_slot_idx1, float *weight_lowfreq) { - float weight; - float output_Fs, encfb_delay, decfb_delay; - float xfade_start_ns; - int16_t xfade_delay_subframes; - int16_t i_hist; - int16_t split_band; + float weight; + float output_Fs, encfb_delay, decfb_delay; + float xfade_start_ns; + int16_t xfade_delay_subframes; + int16_t i_hist; + int16_t split_band; - *weight_lowfreq = hSpar->hFbMixer->cldfb_cross_fade[time_slot_idx]; + *weight_lowfreq = hSpar->hFbMixer->cldfb_cross_fade[time_slot_idx]; - output_Fs = (float)hDecoderConfig->output_Fs; - encfb_delay = IVAS_FB_ENC_DELAY_NS; - decfb_delay = IVAS_FB_DEC_DELAY_NS; - xfade_start_ns = hSpar->hFbMixer->cross_fade_start_offset / output_Fs * 1000000000.f - encfb_delay + decfb_delay * 0.5f; - xfade_delay_subframes = (int16_t)(xfade_start_ns / (FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES)); + output_Fs = (float) hDecoderConfig->output_Fs; + encfb_delay = IVAS_FB_ENC_DELAY_NS; + decfb_delay = IVAS_FB_DEC_DELAY_NS; + xfade_start_ns = hSpar->hFbMixer->cross_fade_start_offset / output_Fs * 1000000000.f - encfb_delay + decfb_delay * 0.5f; + xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); - i_hist = 4 - xfade_delay_subframes; - split_band = SPAR_DIRAC_SPLIT_START_BAND; + i_hist = 4 - xfade_delay_subframes; + split_band = SPAR_DIRAC_SPLIT_START_BAND; - if (split_band < IVAS_MAX_NUM_BANDS) - { - if (hSpar->i_subframe > 3) + if ( split_band < IVAS_MAX_NUM_BANDS ) { - weight = (float)(time_slot_idx % MAX_PARAM_SPATIAL_SUBFRAMES) / (float)MAX_PARAM_SPATIAL_SUBFRAMES; + if ( hSpar->i_subframe > 3 ) + { + weight = (float) ( time_slot_idx % MAX_PARAM_SPATIAL_SUBFRAMES ) / (float) MAX_PARAM_SPATIAL_SUBFRAMES; + } + else + { + weight = 0.0f; + } + *time_slot_idx0 = i_hist; + *time_slot_idx1 = i_hist + 1; } else { - weight = 0.0f; + /* determine cross-fade gain for current frame Parameters*/ + *time_slot_idx0 = hSpar->hFbMixer->cldfb_cross_fade_start; + *time_slot_idx1 = hSpar->hFbMixer->cldfb_cross_fade_end; + weight = *weight_lowfreq; } - *time_slot_idx0 = i_hist; - *time_slot_idx1 = i_hist + 1; - } - else - { - /* determine cross-fade gain for current frame Parameters*/ - *time_slot_idx0 = hSpar->hFbMixer->cldfb_cross_fade_start; - *time_slot_idx1 = hSpar->hFbMixer->cldfb_cross_fade_end; - weight = *weight_lowfreq; - } - return weight; + return weight; } +#endif /*-------------------------------------------------------------------* @@ -1849,11 +2017,69 @@ void ivas_spar_get_parameters_fx( ) { int16_t spar_band, out_ch, in_ch; - Word16 weight_fx, weight_20ms_fx; + Word16 weight_fx, weight_20ms_fx; + int16_t ts0, ts1, split_band; + + //weight = ivas_spar_get_cldfb_slot_gain(hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms); + weight_fx = ivas_spar_get_cldfb_slot_gain_fx( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms_fx); + + split_band = SPAR_DIRAC_SPLIT_START_BAND; + for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) + { + for ( out_ch = 0; out_ch < num_ch_out; out_ch++ ) + { + if ( split_band < IVAS_MAX_NUM_BANDS + /* 20ms cross-fade for Transport channels in all frequency bands */ + && ( 0 == ivas_is_res_channel( out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport ) ) /* sub-frame processing for missing channels in all frequency bands*/ + ) + { + for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) + { + if ( hSpar->i_subframe > 3 ) + { + + par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat(Mpy_32_16_1(hSpar->hMdDec->mixer_mat_prev_fx[ts0][out_ch][in_ch][spar_band], sub(MAX_WORD16, weight_fx)), + Mpy_32_16_1(hSpar->hMdDec->mixer_mat_prev_fx[ts1][out_ch][in_ch][spar_band], weight_fx)); + } + else + { + par_mat_fx[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band]; + } + + } + } + else + { + for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) + { + /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ + int16_t prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ + par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat(Mpy_32_16_1(hSpar->hMdDec->mixer_mat_prev_fx[prev_idx][out_ch][in_ch][spar_band], sub(MAX_WORD16, weight_20ms_fx)) + ,Mpy_32_16_1(hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band], weight_20ms_fx)); + + } + } + } + } + + return; +} +#else + +void ivas_spar_get_parameters( + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const int16_t ts, + const int16_t num_ch_out, + const int16_t num_ch_in, + const int16_t num_spar_bands, + float par_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]) +{ + int16_t spar_band, out_ch, in_ch; + float weight, weight_20ms; int16_t ts0, ts1, split_band; - //weight = ivas_spar_get_cldfb_slot_gain(hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms); - weight_fx = ivas_spar_get_cldfb_slot_gain_fx( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms_fx); + weight = ivas_spar_get_cldfb_slot_gain( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms ); split_band = SPAR_DIRAC_SPLIT_START_BAND; for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) @@ -1869,15 +2095,13 @@ void ivas_spar_get_parameters_fx( { if ( hSpar->i_subframe > 3 ) { - - par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat(Mpy_32_16_1(hSpar->hMdDec->mixer_mat_prev_fx[ts0][out_ch][in_ch][spar_band], sub(MAX_WORD16, weight_fx)), - Mpy_32_16_1(hSpar->hMdDec->mixer_mat_prev_fx[ts1][out_ch][in_ch][spar_band], weight_fx)); + par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight ) * hSpar->hMdDec->mixer_mat_prev[ts0][out_ch][in_ch][spar_band] + + weight * hSpar->hMdDec->mixer_mat_prev[ts1][out_ch][in_ch][spar_band]; } else { - par_mat_fx[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band]; + par_mat[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; } - } } else @@ -1886,9 +2110,7 @@ void ivas_spar_get_parameters_fx( { /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ int16_t prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ - par_mat_fx[out_ch][in_ch][spar_band] = L_add_sat(Mpy_32_16_1(hSpar->hMdDec->mixer_mat_prev_fx[prev_idx][out_ch][in_ch][spar_band], sub(MAX_WORD16, weight_20ms_fx)) - ,Mpy_32_16_1(hSpar->hMdDec->mixer_mat_fx[out_ch][in_ch][spar_band], weight_20ms_fx)); - + par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight_20ms ) * hSpar->hMdDec->mixer_mat_prev[prev_idx][out_ch][in_ch][spar_band] + weight_20ms * hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; } } } @@ -1897,58 +2119,6 @@ void ivas_spar_get_parameters_fx( return; } #endif -void ivas_spar_get_parameters( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const int16_t ts, - const int16_t num_ch_out, - const int16_t num_ch_in, - const int16_t num_spar_bands, - float par_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]) -{ - int16_t spar_band, out_ch, in_ch; - float weight, weight_20ms; - int16_t ts0, ts1, split_band; - - weight = ivas_spar_get_cldfb_slot_gain(hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms); - - split_band = SPAR_DIRAC_SPLIT_START_BAND; - for (spar_band = 0; spar_band < num_spar_bands; spar_band++) - { - for (out_ch = 0; out_ch < num_ch_out; out_ch++) - { - if (split_band < IVAS_MAX_NUM_BANDS - /* 20ms cross-fade for Transport channels in all frequency bands */ - && (0 == ivas_is_res_channel(out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport)) /* sub-frame processing for missing channels in all frequency bands*/ - ) - { - for (in_ch = 0; in_ch < num_ch_in; in_ch++) - { - if (hSpar->i_subframe > 3) - { - par_mat[out_ch][in_ch][spar_band] = (1.0f - weight) * hSpar->hMdDec->mixer_mat_prev[ts0][out_ch][in_ch][spar_band] + - weight * hSpar->hMdDec->mixer_mat_prev[ts1][out_ch][in_ch][spar_band]; - } - else - { - par_mat[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; - } - } - } - else - { - for (in_ch = 0; in_ch < num_ch_in; in_ch++) - { - /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ - int16_t prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ - par_mat[out_ch][in_ch][spar_band] = (1.0f - weight_20ms) * hSpar->hMdDec->mixer_mat_prev[prev_idx][out_ch][in_ch][spar_band] + weight_20ms * hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; - } - } - } - } - - return; -} /*-------------------------------------------------------------------* * ivas_spar_get_skip_mat() @@ -1956,6 +2126,7 @@ void ivas_spar_get_parameters( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_spar_get_skip_mat( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const int16_t num_ch_out, @@ -2017,7 +2188,7 @@ static void ivas_spar_get_skip_mat( return; } -#ifdef IVAS_FLOAT_FIXED +#else static void ivas_spar_get_skip_mat_fx( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const Word16 num_ch_out, @@ -2295,6 +2466,7 @@ static void ivas_spar_calc_smooth_facs( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_spar_dec_agc_pca( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output[], /* i/o: input/output audio channels */ @@ -2338,42 +2510,7 @@ void ivas_spar_dec_agc_pca( * AGC *---------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); -#ifdef DUMPS_ENABLED - dbgwrite_txt( &output[0][0], output_frame, "flt_ivas_agc_dec_process_output.txt", NULL ); -#endif // DUMPS_ENABLED -#else - Word32 *output_fx[20]; - FOR( Word16 i = 0; i < nchan_transport; i++ ) - { - output_fx[i] = malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ); - FOR( Word16 j = 0; j < output_frame; j++ ) - { - output_fx[i][j] = (Word32) ( output[i][j] * ONE_IN_Q14 ); - } - } - - ivas_agc_dec_process_fx( hSpar->hAgcDec, ( output_fx ), ( output_fx ), nchan_transport, output_frame ); - - FOR( Word16 i = 0; i < nchan_transport; i++ ) - { - FOR( Word16 j = 0; j < output_frame; j++ ) - { - output[i][j] = (float) output_fx[i][j] / ONE_IN_Q11; - } - } - -#ifdef DUMPS_ENABLED - dbgwrite_txt( &output[0][0], output_frame, "fix_ivas_agc_dec_process_output.txt", NULL ); -#endif // DUMPS_ENABLED - - FOR( Word16 i = 0; i < nchan_transport; i++ ) - { - free( output_fx[i] ); - } - -#endif // !IVAS_FLOAT_FIXED if ( hSpar->hPCA != NULL ) { @@ -2384,7 +2521,7 @@ void ivas_spar_dec_agc_pca( return; } -#ifdef IVAS_FLOAT_FIXED +#else void ivas_spar_dec_agc_pca_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Word32 *output[], /* i/o: input/output audio channels */ @@ -2447,7 +2584,7 @@ void ivas_spar_dec_agc_pca_fx( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void ivas_spar_dec_set_render_map( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nCldfbTs /* i : number of CLDFB time slots */ @@ -2477,7 +2614,7 @@ void ivas_spar_dec_set_render_map( return; } -#ifdef IVAS_FLOAT_FIXED +#else void ivas_spar_dec_set_render_map_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word16 nCldfbTs /* i : number of CLDFB time slots */ @@ -2509,6 +2646,7 @@ void ivas_spar_dec_set_render_map_fx( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_spar_dec_upmixer() * @@ -2533,7 +2671,7 @@ void ivas_spar_dec_set_render_params( return; } -#ifdef IVAS_FLOAT_FIXED +#else void ivas_spar_dec_set_render_params_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const Word16 n_cldfb_slots /* i : number of cldfb slots in this frame */ @@ -2559,7 +2697,7 @@ void ivas_spar_dec_set_render_params_fx( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void ivas_spar_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -2605,40 +2743,7 @@ void ivas_spar_dec_digest_tc( if ( hSpar->hTdDecorr ) { -#ifndef IVAS_FLOAT_FIXED ivas_td_decorr_process( hSpar->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); -#else - { - Word32 *pPcm_tmp_fx[MAX_SPAR_INTERNAL_CHANNELS]; - Word32 *p_tc_fx[MAX_SPAR_INTERNAL_CHANNELS]; - Word32 pcm_tmp_fx[MAX_SPAR_INTERNAL_CHANNELS][L_FRAME48k]; - Word32 tc_fx[MAX_SPAR_INTERNAL_CHANNELS][L_FRAME48k]; - Word32 i, j; - Word16 q_format = Q14; - - FOR( i = 0; i < nchan_internal; i++ ) - { - pPcm_tmp_fx[i] = pcm_tmp_fx[i]; - p_tc_fx[i] = tc_fx[i]; - } - FOR( j = 0; j < nSamplesToDecorr; j++ ) - { - p_tc_fx[0][j] = (Word32) ( p_tc[0][j] * ( 1 << q_format ) ); - } - ivas_td_decorr_process_fx( hSpar->hTdDecorr, p_tc_fx, pPcm_tmp_fx, nSamplesToDecorr, &q_format ); - - FOR( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) - { - FOR( j = 0; j < nSamplesToDecorr; j++ ) - { - pPcm_tmp[i][j] = ( pPcm_tmp_fx[i][j] ) / (float) ( 1 << q_format ); - } -#ifdef DUMPS_ENABLED - dbgwrite_txt( decorr_signal[i], nSamplesToDecorr, "fixed.txt", NULL ); -#endif - } - } -#endif if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) @@ -2671,7 +2776,7 @@ void ivas_spar_dec_digest_tc( return; } -#ifdef IVAS_FLOAT_FIXED +#else void ivas_spar_dec_digest_tc_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const Word16 nchan_transport, /* i : number of transport channels */ @@ -2756,6 +2861,7 @@ void ivas_spar_dec_digest_tc_fx( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_spar_dec_upmixer() * @@ -2816,41 +2922,8 @@ void ivas_spar_dec_upmixer( { if ( hSpar->hTdDecorr ) { -#ifndef IVAS_FLOAT_FIXED ivas_td_decorr_process( hSpar->hTdDecorr, output_f_local, pPcm_tmp, output_frame ); -#else - { - Word32 *output_f_local_fx[MAX_OUTPUT_CHANNELS]; - Word32 *pPcm_tmp_fx[MAX_OUTPUT_CHANNELS]; - Word32 arr_output_f_local_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 pcm_tmp_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 j; - Word16 q_format = Q14; - - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - pPcm_tmp_fx[i] = pcm_tmp_fx[i]; - output_f_local_fx[i] = arr_output_f_local_fx[i]; - } - - FOR( j = 0; j < output_frame; j++ ) - { - output_f_local_fx[0][j] = (Word32) ( output_f_local[0][j] * ( 1 << q_format ) ); - } - ivas_td_decorr_process_fx( hSpar->hTdDecorr, output_f_local_fx, pPcm_tmp_fx, output_frame, &q_format ); - FOR( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) - { - FOR( j = 0; j < output_frame; j++ ) - { - pPcm_tmp[i][j] = ( pPcm_tmp_fx[i][j] ) / (float) ( 1 << q_format ); - } -#ifdef DUMPS_ENABLED - dbgwrite_txt( decorr_signal[i], nSamplesToDecorr, "fixed.txt", NULL ); -#endif - } - } -#endif if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { for ( i = 0; i < nchan_internal - nchan_transport; i++ ) @@ -2877,116 +2950,12 @@ void ivas_spar_dec_upmixer( if ( st_ivas->hDirAC != 0 ) { -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_dec_set_md_map_fx( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); -#else ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); -#endif } for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { -#ifdef IVAS_FLOAT_FIXED1 -#if 1 /*Float to fixed conversion*/ - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - Word16 num_spar_bands = hSpar->hFbMixer->pFb->filterbank_num_bands; - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_out_dirac = hDecoderConfig->nchan_out; - - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - - for ( int i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } - Word16 q1 = 30, q2 = 30; - for ( int l = 0; l < numch_out; l++ ) - { - for ( int j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k] , q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed(hSpar->hMdDec->mixer_mat_prev[m][j][k][l] , q2 ); - } - } - } - } - for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); - } - } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } -#endif // - ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local, nchan_internal ); -#ifdef IVAS_FLOAT_FIXED /*Fixed to float */ - FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ - } - } - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); /*Rounding off*/ - } - } - } -#endif -#else ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); -#endif // IVAS_FLOAT_FIXED for ( n = 0; n < nchan_out; n++ ) { @@ -3017,13 +2986,7 @@ void ivas_spar_dec_upmixer( return; } - - -/*-------------------------------------------------------------------* - * ivas_spar_dec_upmixer_sf() - * - * IVAS SPAR upmixer - *-------------------------------------------------------------------*/ +#endif #ifdef IVAS_FLOAT_FIXED void ivas_spar_dec_upmixer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -3220,20 +3183,9 @@ void ivas_spar_dec_upmixer_sf_fx( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } - FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) +#endif +#if 1 + FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) { @@ -3244,18 +3196,9 @@ void ivas_spar_dec_upmixer_sf_fx( } } #endif - ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); - FOR ( i = 0; i < numch_out; i++ ) - { - FOR ( int j = 0; j < numch_in; j++ ) - { - FOR ( int k = 0; k < num_spar_bands; k++ ) - { - mixer_mat_fx[i][j][k] = floatToFixed( mixer_mat[i][j][k], q1 ); - hSpar->hMdDec->mixer_mat_prev2_fx[i][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat_prev2[i][j][k], q1 ); - } - } - } + floatToFixed_arr( hSpar->hFbMixer->cldfb_cross_fade, hSpar->hFbMixer->cldfb_cross_fade_fx, Q15, CLDFB_NO_COL_MAX ); + ivas_spar_get_parameters_fx( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat_fx ); + IF ( ( LT_32(hDecoderConfig->ivas_total_brate , IVAS_24k4) ) && ( ( EQ_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_HOA2) ) || ( EQ_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_HOA3) ) ) ) { FOR ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) @@ -3341,19 +3284,6 @@ void ivas_spar_dec_upmixer_sf_fx( hSpar->i_subframe = s_min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); } } -#if 1 /*TODO: To be removed when ivas_spar_get_parameters is integerated*/ - FOR( i = 0; i < numch_out; i++ ) - { - FOR( int j = 0; j < numch_in; j++ ) - { - FOR( int k = 0; k < num_spar_bands; k++ ) - { - mixer_mat[i][j][k] = fixedToFloat( mixer_mat_fx[i][j][k], q1 ); - hSpar->hMdDec->mixer_mat_prev2[i][j][k] = fixedToFloat( hSpar->hMdDec->mixer_mat_prev2_fx[i][j][k], q1 ); - } - } - } -#endif } #ifdef IVAS_FLOAT_FIXED /*Fixed to float */ @@ -3462,7 +3392,7 @@ void ivas_spar_dec_upmixer_sf_fx( return; } -#endif // IVAS_FLOAT_FIXED +#else void ivas_spar_dec_upmixer_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -3473,10 +3403,6 @@ void ivas_spar_dec_upmixer_sf( int16_t cldfb_band, num_cldfb_bands, numch_in, numch_out; float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; float *cldfb_in_ts_im[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; -#ifdef IVAS_FLOAT_FIXED - Word32 *cldfb_in_ts_re_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; - Word32 *cldfb_in_ts_im_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; -#endif int16_t i, b, ts, out_ch, in_ch; int16_t num_spar_bands, spar_band, nchan_transport; int16_t num_in_ingest, split_band; @@ -3484,10 +3410,6 @@ void ivas_spar_dec_upmixer_sf( float *p_tc[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; int16_t md_idx; float Pcm_tmp[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; -#ifdef IVAS_FLOAT_FIXED - Word32 *p_tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; - Word32 Pcm_tmp_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; -#endif int16_t numch_out_dirac; float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; int16_t b_skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; @@ -3513,6 +3435,7 @@ void ivas_spar_dec_upmixer_sf( floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } #endif // IVAS_FLOAT_FIXED + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { int16_t nchan_ism; @@ -3521,9 +3444,6 @@ void ivas_spar_dec_upmixer_sf( for ( i = 0; i < nchan_internal; i++ ) { -#ifdef IVAS_FLOAT_FIXED - p_tc_fx[i] = st_ivas->hTcBuffer->tc_fx[i + nchan_ism] + slot_idx_start * slot_size; -#endif // IVAS_FLOAT_FIXED p_tc[i] = st_ivas->hTcBuffer->tc[i + nchan_ism] + slot_idx_start * slot_size; } @@ -3531,9 +3451,6 @@ void ivas_spar_dec_upmixer_sf( { for ( i = 0; i < nchan_ism; i++ ) { -#ifdef IVAS_FLOAT_FIXED - p_tc_fx[i + nchan_internal] = st_ivas->hTcBuffer->tc_fx[i] + slot_idx_start * slot_size; -#endif // IVAS_FLOAT_FIXED p_tc[i + nchan_internal] = st_ivas->hTcBuffer->tc[i] + slot_idx_start * slot_size; } } @@ -3542,9 +3459,6 @@ void ivas_spar_dec_upmixer_sf( { for ( i = 0; i < nchan_internal; i++ ) { -#ifdef IVAS_FLOAT_FIXED - p_tc_fx[i] = st_ivas->hTcBuffer->tc_fx[i] + slot_idx_start * slot_size; -#endif // IVAS_FLOAT_FIXED p_tc[i] = st_ivas->hTcBuffer->tc[i] + slot_idx_start * slot_size; } } @@ -3584,10 +3498,6 @@ void ivas_spar_dec_upmixer_sf( { cldfb_in_ts_re[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands]; cldfb_in_ts_im[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; -#ifdef IVAS_FLOAT_FIXED - cldfb_in_ts_re_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands]; - cldfb_in_ts_im_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; -#endif } } } @@ -3599,10 +3509,6 @@ void ivas_spar_dec_upmixer_sf( { cldfb_in_ts_re[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands]; cldfb_in_ts_im[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; -#ifdef IVAS_FLOAT_FIXED - cldfb_in_ts_re_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands]; - cldfb_in_ts_im_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; -#endif } } } @@ -3615,49 +3521,7 @@ void ivas_spar_dec_upmixer_sf( /* apply parameters */ /* determine if we can skip certain data */ -#ifdef IVAS_FLOAT_FIXED - Word16 q1 = 31; - for (int l = 0; l < numch_out; l++) { - for (int j = 0; j < numch_in; j++) { - for (int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++) { - if (abs((Word32)hSpar->hMdDec->mixer_mat[l][j][k]) != 0) { - q1 = min(norm_l((Word32)(hSpar->hMdDec->mixer_mat[l][j][k])), q1); - } - } - } - } - for (int l = 0; l < numch_out; l++) { - for (int j = 0; j < numch_in; j++) { - for (int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++) { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = (Word32)(hSpar->hMdDec->mixer_mat[l][j][k] * (1 << q1)); - } - } - } - Word16 q2 = 31; - for (int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++) { - for (int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++) { - for (int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++) { - for (int l = 0; l < IVAS_MAX_NUM_BANDS; l++) { - if (abs((Word32)hSpar->hMdDec->mixer_mat_prev[m][j][k][l]) != 0) { - q2 = min(norm_l((Word32)hSpar->hMdDec->mixer_mat_prev[m][j][k][l]), q2); - } - } - } - } - } - for (int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++) { - for (int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++) { - for (int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++) { - for (int l = 0; l < IVAS_MAX_NUM_BANDS; l++) { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = (Word32) (hSpar->hMdDec->mixer_mat_prev[m][j][k][l] * (1 << q2)); - } - } - } - } - ivas_spar_get_skip_mat_fx( hSpar, numch_out, numch_in, num_spar_bands, b_skip_mat, num_md_sub_frames ); /* this can be precomputed based on bitrate and format*/ -#else ivas_spar_get_skip_mat( hSpar, numch_out, numch_in, num_spar_bands, b_skip_mat, num_md_sub_frames ); /* this can be precomputed based on bitrate and format*/ -#endif numch_out_dirac = hDecoderConfig->nchan_out; @@ -3676,12 +3540,7 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -#ifdef IVAS_FLOAT_FIXED - Word16 q_cldfb = 11; - cldfbAnalysis_ts_fx_fixed_q( &p_tc_fx[in_ch][ts * num_cldfb_bands], cldfb_in_ts_re_fx[in_ch][ts], cldfb_in_ts_im_fx[in_ch][ts], num_cldfb_bands, st_ivas->cldfbAnaDec[in_ch], &q_cldfb ); -#else cldfbAnalysis_ts_ivas( &p_tc[in_ch][ts * num_cldfb_bands], cldfb_in_ts_re[in_ch][ts], cldfb_in_ts_im[in_ch][ts], num_cldfb_bands, st_ivas->cldfbAnaDec[in_ch] ); -#endif // IVAS_FLOAT_FIXED } } @@ -3691,12 +3550,7 @@ void ivas_spar_dec_upmixer_sf( { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -#ifdef IVAS_FLOAT_FIXED - Word16 q_cldfb = 11; - cldfbAnalysis_ts_fx_fixed_q( &p_tc_fx[in_ch][ts * num_cldfb_bands], cldfb_in_ts_re_fx[in_ch][ts], cldfb_in_ts_im_fx[in_ch][ts], num_cldfb_bands, st_ivas->cldfbAnaDec[in_ch] ,&q_cldfb); -#else cldfbAnalysis_ts_ivas( &p_tc[in_ch][ts * num_cldfb_bands], cldfb_in_ts_re[in_ch][ts], cldfb_in_ts_im[in_ch][ts], num_cldfb_bands, st_ivas->cldfbAnaDec[in_ch] ); -#endif } } } @@ -3720,38 +3574,7 @@ void ivas_spar_dec_upmixer_sf( #endif if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) { -#ifdef IVAS_FLOAT_FIXED - //float2fix (to be cleaned) - Word16 q_cldfb = 31; - for (ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++) - { - Word16 q_ts_re = Q_factor_arrL(cldfb_in_ts_re[0][ts], CLDFB_NO_CHANNELS_MAX); - Word16 q_ts_im = Q_factor_arrL(cldfb_in_ts_im[0][ts], CLDFB_NO_CHANNELS_MAX); - q_cldfb = min(q_cldfb, min(q_ts_re, q_ts_im)); - } - for (ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++) - { - floatToFixed_arrL(cldfb_in_ts_re[0][ts], cldfb_in_ts_re_fx[0][ts], q_cldfb, CLDFB_NO_CHANNELS_MAX); - floatToFixed_arrL(cldfb_in_ts_im[0][ts], cldfb_in_ts_im_fx[0][ts], q_cldfb, CLDFB_NO_CHANNELS_MAX); - } - for (i = 0; i < IVAS_MAX_NUM_BANDS; i++) { - floatToFixed_arrL(hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1); - } - floatToFixed_arr(hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS); - //float2fix end - - ivas_spar_calc_smooth_facs_fx( cldfb_in_ts_re_fx[0], cldfb_in_ts_im_fx[0], q_cldfb, num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], - hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_buf_fx ); - - //fix2float (to be cleaned) - fixedToFloat_arr(hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS); - for (i = 0; i < IVAS_MAX_NUM_BANDS; i++) { - fixedToFloat_arrL(hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1); - } - //fix2float end -#else ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered], hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); -#endif } for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) @@ -3908,3 +3731,4 @@ void ivas_spar_dec_upmixer_sf( return; } +#endif // IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 4b92c2468..5ec2167a7 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -65,7 +65,11 @@ static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0 * Static functions declaration *------------------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void ivas_get_spar_matrices_fx( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t numch_out, const int16_t active_w_vlbr, const int16_t dyn_active_w_flag ); +#else static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t numch_out, const int16_t active_w_vlbr, const int16_t dyn_active_w_flag ); +#endif static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t strat, const int32_t ivas_total_brate ); @@ -73,7 +77,11 @@ static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_St static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type ); +#ifndef IVAS_FLOAT_FIXED static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, float ***mixer_mat, const int16_t bands, const int16_t num_ch ); +#else +static void ivas_mat_col_rearrange_fx( Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, Word32 ***mixer_mat, const int16_t bands, const int16_t num_ch ); +#endif static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands, const int16_t bfi, const int16_t num_md_sub_frames ); @@ -81,6 +89,9 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_ static void ivas_spar_dec_compute_ramp_down_post_matrix_fx(ivas_spar_md_dec_state_t *hMdDec, const Word16 num_bands, const Word16 bfi, const Word16 num_md_sub_frames); #endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED +static void ivas_spar_md_fill_invalid_bands_fx(ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const Word16 *valid_bands, Word16 *base_band_age, const Word16 num_bands, const Word16 num_channels, const Word16 num_md_sub_frames); +#endif static void ivas_spar_md_fill_invalid_bands( ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, const int16_t num_bands, const int16_t numch_out, const int16_t num_md_sub_frames ); static void ivas_spar_md_fill_invalid_bandcoeffs( ivas_band_coeffs_t *pBand_coeffs, ivas_band_coeffs_t *pBand_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, int16_t *first_valid_frame, const int16_t num_bands ); @@ -93,12 +104,20 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); +#ifdef IVAS_FLOAT_FIXED static ivas_error ivas_deindex_real_index_fx( const int16_t *index, const int16_t q_levels, const Word32 min_value, const Word32 max_value, Word32 *quant, const int16_t num_ch_dim2 ); +#endif +#ifdef IVAS_FLOAT_FIXED +static void ivas_spar_dec_parse_md_bs_fx( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode +); +#else static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode ); +#endif +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_spar_md_dec_matrix_open() * @@ -140,286 +159,269 @@ ivas_error ivas_spar_md_dec_matrix_open( } } -#ifdef IVAS_FLOAT_FIXED - if ( ( hMdDec->mixer_mat_fx = (Word32 ***) malloc( num_channels * sizeof( Word32 ** ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->mixer_mat_fx[i] = (Word32 **) malloc( num_channels * sizeof( Word32 * ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->mixer_mat_fx[i][j] = (Word32 *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( Word32 ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs.C_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } - hMdDec->mix_mat_dim_0_1 = num_channels; - hMdDec->mix_mat_dim_2 = num_md_sub_frames * IVAS_MAX_NUM_BANDS; -#endif -#ifdef IVAS_FLOAT_FIXED - if ( ( hMdDec->spar_coeffs.C_re_fx = (Word32 ***) malloc( num_channels * sizeof(Word32 ** ) ) ) == NULL ) + + if ( ( hMdDec->spar_coeffs.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->spar_coeffs.C_re_fx[i] = (Word32 **) malloc( num_channels * sizeof(Word32 * ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->spar_coeffs.C_re_fx[i][j] = (Word32 *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof(Word32) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs.P_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } - if ( ( hMdDec->spar_coeffs.P_re_fx = (Word32 ***) malloc( num_channels * sizeof(Word32 ** ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_prev.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->spar_coeffs.P_re_fx[i] = (Word32 **) malloc( num_channels * sizeof(Word32 * ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_prev.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->spar_coeffs.P_re_fx[i][j] = (Word32 *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof(Word32) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_prev.C_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } -#endif // IVAS_FLOAT_FIXED - if ( ( hMdDec->spar_coeffs.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + + if ( ( hMdDec->spar_coeffs_prev.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->spar_coeffs.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_prev.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->spar_coeffs.C_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_prev.P_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } - //Fix_memory - /*if ((hMdDec->spar_coeffs.C_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) + + if ( ( hMdDec->spar_coeffs_tar.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (i = 0; i < num_channels; i++) { - if ((hMdDec->spar_coeffs.C_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) + if ( ( hMdDec->spar_coeffs_tar.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (j = 0; j < num_channels; j++) { - if ((hMdDec->spar_coeffs.C_re_fx[i][j] = (Word32 *)malloc(num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) + if ( ( hMdDec->spar_coeffs_tar.C_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } } - }*/ - + } - if ( ( hMdDec->spar_coeffs.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_tar.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->spar_coeffs.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_tar.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->spar_coeffs.P_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs_tar.P_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } - //Fix memory - /*if ((hMdDec->spar_coeffs.P_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) - { - return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); - } for (i = 0; i < num_channels; i++) { - if ((hMdDec->spar_coeffs.P_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) - { - return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); - } for (j = 0; j < num_channels; j++) { - if ((hMdDec->spar_coeffs.P_re_fx[i][j] = (Word32 *)malloc(num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) { - return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); + hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0.0f; + } } } - }*/ - if ( ( hMdDec->spar_coeffs_prev.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + return IVAS_ERR_OK; } - for ( i = 0; i < num_channels; i++ ) + +#else +ivas_error ivas_spar_md_dec_matrix_open_fx( + 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 /* i : number of MD subframes */ +) { - if ( ( hMdDec->spar_coeffs_prev.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + int16_t i, j; + int16_t k; + if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * num_md_sub_frames * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); } - for ( j = 0; j < num_channels; j++ ) - { - if ( ( hMdDec->spar_coeffs_prev.C_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + if ( ( hMdDec->band_coeffs_prev = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); - } - } + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); } - - //Fix Memory -#ifdef IVAS_FLOAT_FIXED - if ((hMdDec->spar_coeffs_prev.C_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) + if ( ( hMdDec->mixer_mat_fx = (Word32 ***) malloc( num_channels * sizeof( Word32 ** ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (i = 0; i < num_channels; i++) { - if ((hMdDec->spar_coeffs_prev.C_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) + if ( ( hMdDec->mixer_mat_fx[i] = (Word32 **) malloc( num_channels * sizeof( Word32 * ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (j = 0; j < num_channels; j++) { - if ((hMdDec->spar_coeffs_prev.C_re_fx[i][j] = (Word32 *)malloc(IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) + if ( ( hMdDec->mixer_mat_fx[i][j] = (Word32 *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( Word32 ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } } } -#endif - if ( ( hMdDec->spar_coeffs_prev.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + hMdDec->mix_mat_dim_0_1 = num_channels; + hMdDec->mix_mat_dim_2 = num_md_sub_frames * IVAS_MAX_NUM_BANDS; + + if ( ( hMdDec->spar_coeffs.C_re_fx = (Word32 ***) malloc( num_channels * sizeof(Word32 ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->spar_coeffs_prev.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs.C_re_fx[i] = (Word32 **) malloc( num_channels * sizeof(Word32 * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->spar_coeffs_prev.P_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + if ( ( hMdDec->spar_coeffs.C_re_fx[i][j] = (Word32 *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof(Word32) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } -#ifdef IVAS_FLOAT_FIXED - //Fix Memory - if ((hMdDec->spar_coeffs_prev.P_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) + if ( ( hMdDec->spar_coeffs.P_re_fx = (Word32 ***) malloc( num_channels * sizeof(Word32 ** ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (i = 0; i < num_channels; i++) { - if ((hMdDec->spar_coeffs_prev.P_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) + if ( ( hMdDec->spar_coeffs.P_re_fx[i] = (Word32 **) malloc( num_channels * sizeof(Word32 * ) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (j = 0; j < num_channels; j++) { - if ((hMdDec->spar_coeffs_prev.P_re_fx[i][j] = (Word32 *)malloc(IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) + if ( ( hMdDec->spar_coeffs.P_re_fx[i][j] = (Word32 *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof(Word32) ) ) == NULL ) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } } } -#endif - if ( ( hMdDec->spar_coeffs_tar.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + if ((hMdDec->spar_coeffs_prev.C_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->spar_coeffs_tar.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + if ((hMdDec->spar_coeffs_prev.C_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->spar_coeffs_tar.C_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + if ((hMdDec->spar_coeffs_prev.C_re_fx[i][j] = (Word32 *)malloc(IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } -#ifdef IVAS_FLOAT_FIXED //Fix Memory - if ((hMdDec->spar_coeffs_tar.C_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) + if ((hMdDec->spar_coeffs_prev.P_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (i = 0; i < num_channels; i++) { - if ((hMdDec->spar_coeffs_tar.C_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) + if ((hMdDec->spar_coeffs_prev.P_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } for (j = 0; j < num_channels; j++) { - if ((hMdDec->spar_coeffs_tar.C_re_fx[i][j] = (Word32 *)malloc(IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) + if ((hMdDec->spar_coeffs_prev.P_re_fx[i][j] = (Word32 *)malloc(IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) { return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix"); } } } -#endif - - if ( ( hMdDec->spar_coeffs_tar.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + //Fix Memory + if ((hMdDec->spar_coeffs_tar.C_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( i = 0; i < num_channels; i++ ) { - if ( ( hMdDec->spar_coeffs_tar.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + if ((hMdDec->spar_coeffs_tar.C_re_fx[i] = (Word32 **)malloc(num_channels * sizeof(Word32 *))) == NULL) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } for ( j = 0; j < num_channels; j++ ) { - if ( ( hMdDec->spar_coeffs_tar.P_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + if ((hMdDec->spar_coeffs_tar.C_re_fx[i][j] = (Word32 *)malloc(IVAS_MAX_NUM_BANDS * sizeof(Word32))) == NULL) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } } } - -#ifdef IVAS_FLOAT_FIXED //Fix Memory if ((hMdDec->spar_coeffs_tar.P_re_fx = (Word32 ***)malloc(num_channels * sizeof(Word32 **))) == NULL) { @@ -439,7 +441,6 @@ ivas_error ivas_spar_md_dec_matrix_open( } } } -#endif for ( i = 0; i < num_channels; i++ ) { @@ -447,23 +448,17 @@ ivas_error ivas_spar_md_dec_matrix_open( { for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) { - hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0.0f; - hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0.0f; - hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0.0f; - hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0.0f; -#ifdef IVAS_FLOAT_FIXED hMdDec->spar_coeffs_prev.C_re_fx[i][j][k] = 0; hMdDec->spar_coeffs_prev.P_re_fx[i][j][k] = 0; hMdDec->spar_coeffs_tar.C_re_fx[i][j][k] = 0; hMdDec->spar_coeffs_tar.P_re_fx[i][j][k] = 0; -#endif } } } return IVAS_ERR_OK; } - +#endif /*------------------------------------------------------------------------- * ivas_get_spar_dec_md_num_subframes() @@ -560,7 +555,11 @@ ivas_error ivas_spar_md_dec_open( num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate, last_active_ivas_total_brate ); +#ifndef IVAS_FLOAT_FIXED if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_spar_md_dec_matrix_open_fx( hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -598,6 +597,7 @@ ivas_error ivas_spar_md_dec_open( * Deallocate SPAR MD decoder matrices *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_spar_md_dec_matrix_close( ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ const int16_t num_channels /* i : number of internal channels */ @@ -629,167 +629,169 @@ void ivas_spar_md_dec_matrix_close( free( hMdDecoder->mixer_mat ); } -#ifdef IVAS_FLOAT_FIXED - if ( hMdDecoder->mixer_mat_fx != NULL ) + if ( hMdDecoder->spar_coeffs.C_re != NULL ) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->mixer_mat_fx[i][j] ); + free( hMdDecoder->spar_coeffs.C_re[i][j] ); } - free( hMdDecoder->mixer_mat_fx[i] ); + free( hMdDecoder->spar_coeffs.C_re[i] ); } - free( hMdDecoder->mixer_mat_fx ); + free( hMdDecoder->spar_coeffs.C_re ); } -#endif -#ifdef IVAS_FLOAT_FIXED - if ( hMdDecoder->spar_coeffs.C_re_fx != NULL ) + + if ( hMdDecoder->spar_coeffs.P_re != NULL ) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->spar_coeffs.C_re_fx[i][j] ); + free( hMdDecoder->spar_coeffs.P_re[i][j] ); } - free( hMdDecoder->spar_coeffs.C_re_fx[i] ); + free( hMdDecoder->spar_coeffs.P_re[i] ); } - free( hMdDecoder->spar_coeffs.C_re_fx ); + free( hMdDecoder->spar_coeffs.P_re ); } - if ( hMdDecoder->spar_coeffs.P_re_fx != NULL ) + + if ( hMdDecoder->spar_coeffs_prev.C_re != NULL ) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->spar_coeffs.P_re_fx[i][j] ); + free( hMdDecoder->spar_coeffs_prev.C_re[i][j] ); } - free( hMdDecoder->spar_coeffs.P_re_fx[i] ); + free( hMdDecoder->spar_coeffs_prev.C_re[i] ); } - free( hMdDecoder->spar_coeffs.P_re_fx ); + free( hMdDecoder->spar_coeffs_prev.C_re ); } -#endif // IVAS_FLOAT_FIXED - if ( hMdDecoder->spar_coeffs.C_re != NULL ) + if ( hMdDecoder->spar_coeffs_prev.P_re != NULL ) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->spar_coeffs.C_re[i][j] ); + free( hMdDecoder->spar_coeffs_prev.P_re[i][j] ); } - free( hMdDecoder->spar_coeffs.C_re[i] ); + free( hMdDecoder->spar_coeffs_prev.P_re[i] ); } - free( hMdDecoder->spar_coeffs.C_re ); + free( hMdDecoder->spar_coeffs_prev.P_re ); } - /*if (hMdDecoder->spar_coeffs.C_re_fx != NULL) + + if ( hMdDecoder->spar_coeffs_tar.C_re != NULL ) { for (i = 0; i < num_channels; i++) { for (j = 0; j < num_channels; j++) { - free(hMdDecoder->spar_coeffs.C_re_fx[i][j]); + free( hMdDecoder->spar_coeffs_tar.C_re[i][j] ); + } + free( hMdDecoder->spar_coeffs_tar.C_re[i] ); } - free(hMdDecoder->spar_coeffs.C_re_fx[i]); + free( hMdDecoder->spar_coeffs_tar.C_re ); } - free(hMdDecoder->spar_coeffs.C_re_fx); - }*/ - if ( hMdDecoder->spar_coeffs.P_re != NULL ) + if ( hMdDecoder->spar_coeffs_tar.P_re != NULL ) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->spar_coeffs.P_re[i][j] ); + free( hMdDecoder->spar_coeffs_tar.P_re[i][j] ); } - free( hMdDecoder->spar_coeffs.P_re[i] ); + free( hMdDecoder->spar_coeffs_tar.P_re[i] ); } - free( hMdDecoder->spar_coeffs.P_re ); + free( hMdDecoder->spar_coeffs_tar.P_re ); } - /*if (hMdDecoder->spar_coeffs.P_re_fx != NULL) - { - for (i = 0; i < num_channels; i++) + return; +} + +#else +void ivas_spar_md_dec_matrix_close_fx( + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels /* i : number of internal channels */ +) { - for (j = 0; j < num_channels; j++) + int16_t i, j; + + if ( hMdDecoder->spar_md.band_coeffs != NULL ) { - free(hMdDecoder->spar_coeffs.P_re_fx[i][j]); + free( hMdDecoder->spar_md.band_coeffs ); + hMdDecoder->spar_md.band_coeffs = NULL; } - free(hMdDecoder->spar_coeffs.P_re_fx[i]); + if ( hMdDecoder->band_coeffs_prev != NULL ) + { + free( hMdDecoder->band_coeffs_prev ); + hMdDecoder->band_coeffs_prev = NULL; } - free(hMdDecoder->spar_coeffs.P_re_fx); - }*/ - if ( hMdDecoder->spar_coeffs_prev.C_re != NULL ) + if ( hMdDecoder->mixer_mat_fx != NULL ) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->spar_coeffs_prev.C_re[i][j] ); + free( hMdDecoder->mixer_mat_fx[i][j] ); } - free( hMdDecoder->spar_coeffs_prev.C_re[i] ); + free( hMdDecoder->mixer_mat_fx[i] ); } - free( hMdDecoder->spar_coeffs_prev.C_re ); + free( hMdDecoder->mixer_mat_fx ); } -#ifdef IVAS_FLOAT_FIXED - if (hMdDecoder->spar_coeffs_prev.C_re_fx != NULL) + if ( hMdDecoder->spar_coeffs.C_re_fx != NULL ) { for (i = 0; i < num_channels; i++) { for (j = 0; j < num_channels; j++) { - free(hMdDecoder->spar_coeffs_prev.C_re_fx[i][j]); + free( hMdDecoder->spar_coeffs.C_re_fx[i][j] ); } - free(hMdDecoder->spar_coeffs_prev.C_re_fx[i]); + free( hMdDecoder->spar_coeffs.C_re_fx[i] ); } - free(hMdDecoder->spar_coeffs_prev.C_re_fx); + free( hMdDecoder->spar_coeffs.C_re_fx ); } -#endif - - if ( hMdDecoder->spar_coeffs_prev.P_re != NULL ) + if ( hMdDecoder->spar_coeffs.P_re_fx != NULL ) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->spar_coeffs_prev.P_re[i][j] ); + free( hMdDecoder->spar_coeffs.P_re_fx[i][j] ); } - free( hMdDecoder->spar_coeffs_prev.P_re[i] ); + free( hMdDecoder->spar_coeffs.P_re_fx[i] ); } - free( hMdDecoder->spar_coeffs_prev.P_re ); + free( hMdDecoder->spar_coeffs.P_re_fx ); } -#ifdef IVAS_FLOAT_FIXED - if (hMdDecoder->spar_coeffs_prev.P_re_fx != NULL) + if (hMdDecoder->spar_coeffs_prev.C_re_fx != NULL) { for (i = 0; i < num_channels; i++) { for (j = 0; j < num_channels; j++) { - free(hMdDecoder->spar_coeffs_prev.P_re_fx[i][j]); + free(hMdDecoder->spar_coeffs_prev.C_re_fx[i][j]); } - free(hMdDecoder->spar_coeffs_prev.P_re_fx[i]); + free(hMdDecoder->spar_coeffs_prev.C_re_fx[i]); } - free(hMdDecoder->spar_coeffs_prev.P_re_fx); + free(hMdDecoder->spar_coeffs_prev.C_re_fx); } -#endif - if ( hMdDecoder->spar_coeffs_tar.C_re != NULL ) + if (hMdDecoder->spar_coeffs_prev.P_re_fx != NULL) { for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { - free( hMdDecoder->spar_coeffs_tar.C_re[i][j] ); + free(hMdDecoder->spar_coeffs_prev.P_re_fx[i][j]); } - free( hMdDecoder->spar_coeffs_tar.C_re[i] ); + free(hMdDecoder->spar_coeffs_prev.P_re_fx[i]); } - free( hMdDecoder->spar_coeffs_tar.C_re ); + free(hMdDecoder->spar_coeffs_prev.P_re_fx); } -#ifdef IVAS_FLOAT_FIXED if (hMdDecoder->spar_coeffs_tar.C_re_fx != NULL) { for (i = 0; i < num_channels; i++) @@ -802,21 +804,6 @@ void ivas_spar_md_dec_matrix_close( } free(hMdDecoder->spar_coeffs_tar.C_re_fx); } -#endif - - if ( hMdDecoder->spar_coeffs_tar.P_re != NULL ) - { - for ( i = 0; i < num_channels; i++ ) - { - for ( j = 0; j < num_channels; j++ ) - { - free( hMdDecoder->spar_coeffs_tar.P_re[i][j] ); - } - free( hMdDecoder->spar_coeffs_tar.P_re[i] ); - } - free( hMdDecoder->spar_coeffs_tar.P_re ); - } -#ifdef IVAS_FLOAT_FIXED if (hMdDecoder->spar_coeffs_tar.P_re_fx != NULL) { for (i = 0; i < num_channels; i++) @@ -829,11 +816,10 @@ void ivas_spar_md_dec_matrix_close( } free(hMdDecoder->spar_coeffs_tar.P_re_fx); } -#endif return; } - +#endif /*------------------------------------------------------------------------- * ivas_spar_md_dec_close() @@ -851,7 +837,11 @@ void ivas_spar_md_dec_close( hMdDecoder = *hMdDec; num_channels = hMdDecoder->spar_md_cfg.num_umx_chs; +#ifndef IVAS_FLOAT_FIXED ivas_spar_md_dec_matrix_close( hMdDecoder, num_channels ); +#else + ivas_spar_md_dec_matrix_close_fx( hMdDecoder, num_channels ); +#endif free( *hMdDec ); *hMdDec = NULL; @@ -865,6 +855,7 @@ Word32 pFC_16k[IVAS_MAX_NUM_BANDS] = { 66, 200, 333, 466, 600, 733, 866, 1133, 1 Word32 pFC_32k[IVAS_MAX_NUM_BANDS] = { 133, 400, 666, 933, 1200, 1466, 1733, 2266, 3466, 5333, 8133, 12933 }; Word32 pFC_48k[IVAS_MAX_NUM_BANDS] = { 199, 600, 1000, 1400, 1800, 2200, 2600, 3400, 5200, 8000, 12200, 19400 }; +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_spar_md_dec_init() * @@ -881,7 +872,6 @@ ivas_error ivas_spar_md_dec_init( int16_t i, j; int16_t nchan_transport; float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; - Word32 *pFC_fx=NULL, PR_minmax_fx[2]; ivas_error error; ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate, &hMdDec->spar_hoa_md_flag, &hMdDec->spar_hoa_dirac2spar_md_flag ); @@ -900,23 +890,117 @@ ivas_error ivas_spar_md_dec_init( pFC[i] = ivas_fb_fcs_12band_1ms[i] * hDecoderConfig->output_Fs * 0.5f; } - if (hDecoderConfig->output_Fs == 8000) + if ( ( error = ivas_spar_set_dec_config( hMdDec, nchan_transport, pFC ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( nchan_transport != 2 && ( ( hMdDec->spar_md_cfg.remix_unmix_order == 2 ) || ( hMdDec->spar_md_cfg.remix_unmix_order == 1 ) ) ) + { + return IVAS_ERR_INTERNAL; + } + + /* DTX quant init */ + PR_minmax[0] = hMdDec->spar_md_cfg.quant_strat[0].PR.min; + PR_minmax[1] = hMdDec->spar_md_cfg.quant_strat[0].PR.max; + ivas_spar_quant_dtx_init( &hMdDec->spar_md, PR_minmax ); + + ivas_spar_arith_coeffs_com_init( &hMdDec->arith_coeffs, &hMdDec->spar_md_cfg, hMdDec->table_idx, DEC ); + ivas_spar_huff_coeffs_com_init( &hMdDec->huff_coeffs, &hMdDec->spar_md_cfg, hMdDec->table_idx, DEC ); + + hMdDec->spar_md_cfg.prev_quant_idx = -1; + + /* initialize PLC state */ + set_s( hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); + set_s( hMdDec->base_band_age, 0, IVAS_MAX_NUM_BANDS ); + set_s( hMdDec->base_band_coeffs_age, 0, IVAS_MAX_NUM_BANDS ); + hMdDec->spar_plc_num_lost_frames = 0; + hMdDec->spar_plc_enable_fadeout_flag = 1; + hMdDec->dtx_md_smoothing_cntr = 1; + + ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeffs( hMdDec->band_coeffs_prev, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeff_idx( hMdDec->spar_md.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS ); + + hMdDec->spar_md.dtx_vad = 0; + hMdDec->td_decorr_flag = 1; + + set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); + set_f( hMdDec->spar_md.ref_pow_slow, 0.0f, IVAS_MAX_NUM_BANDS ); + + set_zero( hMdDec->smooth_fac, IVAS_MAX_NUM_BANDS ); + for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + set_zero( hMdDec->smooth_buf[i], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + + for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH; j++ ) + { + set_zero( hMdDec->mixer_mat_prev2[i][j], IVAS_MAX_NUM_BANDS ); + } + } + hMdDec->first_valid_frame = 1; + + return IVAS_ERR_OK; +} +#else +/*-----------------------------------------------------------------------------------------* +* Function ivas_spar_md_dec_init() +* +* SPAR MD decoder initialization +*-----------------------------------------------------------------------------------------*/ +ivas_error ivas_spar_md_dec_init( + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t sba_order /* i : SBA order */ +) +{ + int16_t i, j; + int16_t nchan_transport; + Word32 pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; + Word32 *pFC_fx=NULL, PR_minmax_fx[2]; + ivas_error error; + + ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate, &hMdDec->spar_hoa_md_flag, &hMdDec->spar_hoa_dirac2spar_md_flag ); + + ivas_sba_get_spar_hoa_ch_ind( num_channels, hDecoderConfig->ivas_total_brate, hMdDec->HOA_md_ind ); + + hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + + ivas_spar_set_bitrate_config_fx(&hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands, hMdDec->spar_hoa_dirac2spar_md_flag, 0, 0, 0 ); + + nchan_transport = hMdDec->spar_md_cfg.nchan_transport; + + + + /* get FB coefficients */ + FOR (i = 0; i < IVAS_MAX_NUM_BANDS; i++) + { + pFC[i] = L_shr(Mpy_32_32(ivas_fb_fcs_12band_1ms_fx[i], hDecoderConfig->output_Fs), 1); //Q0 + } + + IF (EQ_32 (hDecoderConfig->output_Fs, 8000)) { pFC_fx = pFC_8k; } - else if (hDecoderConfig->output_Fs == 12800) + ELSE IF(EQ_32(hDecoderConfig->output_Fs, 12800)) { pFC_fx = pFC_12k; } - else if (hDecoderConfig->output_Fs == 16000) + ELSE IF (EQ_32(hDecoderConfig->output_Fs, 16000)) { pFC_fx = pFC_16k; } - else if (hDecoderConfig->output_Fs == 32000) + ELSE IF (EQ_32(hDecoderConfig->output_Fs, 32000)) { pFC_fx = pFC_32k; } - else if (hDecoderConfig->output_Fs == 48000) + ELSE IF (EQ_32(hDecoderConfig->output_Fs, 48000)) { pFC_fx = pFC_48k; } @@ -940,11 +1024,8 @@ ivas_error ivas_spar_md_dec_init( } /* DTX quant init */ - PR_minmax[0] = hMdDec->spar_md_cfg.quant_strat[0].PR.min; PR_minmax_fx[0] = hMdDec->spar_md_cfg.quant_strat[0].PR.min_fx; - PR_minmax[1] = hMdDec->spar_md_cfg.quant_strat[0].PR.max; PR_minmax_fx[1] = hMdDec->spar_md_cfg.quant_strat[0].PR.max_fx; - ivas_spar_quant_dtx_init( &hMdDec->spar_md, PR_minmax ); ivas_spar_quant_dtx_init_fx( &hMdDec->spar_md, PR_minmax_fx ); ivas_spar_arith_coeffs_com_init( &hMdDec->arith_coeffs, &hMdDec->spar_md_cfg, hMdDec->table_idx, DEC ); @@ -960,8 +1041,13 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_plc_enable_fadeout_flag = 1; hMdDec->dtx_md_smoothing_cntr = 1; +#ifndef IVAS_FLOAT_FIXED ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeffs( hMdDec->band_coeffs_prev, IVAS_MAX_NUM_BANDS ); +#else + ivas_clear_band_coeffs_fx( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeffs_fx( hMdDec->band_coeffs_prev, IVAS_MAX_NUM_BANDS ); +#endif ivas_clear_band_coeff_idx( hMdDec->spar_md.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS ); @@ -969,20 +1055,21 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_md.dtx_vad = 0; hMdDec->td_decorr_flag = 1; - set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); + set32_fx( hMdDec->spar_md.en_ratio_slow_fx, 0, IVAS_MAX_NUM_BANDS ); - set_f( hMdDec->spar_md.ref_pow_slow, 0.0f, IVAS_MAX_NUM_BANDS ); set32_fx( hMdDec->spar_md.ref_pow_slow_fx, 0, IVAS_MAX_NUM_BANDS ); + set16_fx( hMdDec->smooth_fac_fx,0, IVAS_MAX_NUM_BANDS ); +#ifndef IVAS_FLOAT_FIXED + set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); + set_f( hMdDec->spar_md.ref_pow_slow, 0.0f, IVAS_MAX_NUM_BANDS ); set_zero( hMdDec->smooth_fac, IVAS_MAX_NUM_BANDS ); -#ifdef IVAS_FLOAT_FIXED - set16_fx( hMdDec->smooth_fac_fx,0, IVAS_MAX_NUM_BANDS ); #endif for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) { - set_zero( hMdDec->smooth_buf[i], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); -#ifdef IVAS_FLOAT_FIXED set32_fx(hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1); +#ifndef IVAS_FLOAT_FIXED + set_zero( hMdDec->smooth_buf[i], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); #endif } @@ -990,9 +1077,9 @@ ivas_error ivas_spar_md_dec_init( { for ( j = 0; j < IVAS_SPAR_MAX_CH; j++ ) { - set_zero( hMdDec->mixer_mat_prev2[i][j], IVAS_MAX_NUM_BANDS ); -#ifdef IVAS_FLOAT_FIXED set32_fx(hMdDec->mixer_mat_prev2_fx[i][j], 0, IVAS_MAX_NUM_BANDS); +#ifndef IVAS_FLOAT_FIXED + set_zero( hMdDec->mixer_mat_prev2[i][j], IVAS_MAX_NUM_BANDS ); #endif } } @@ -1001,6 +1088,8 @@ ivas_error ivas_spar_md_dec_init( return IVAS_ERR_OK; } +#endif + /*-----------------------------------------------------------------------------------------* * Function ivas_spar_set_dec_config() @@ -1120,12 +1209,12 @@ static ivas_error ivas_spar_set_dec_config( * * *-----------------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void ivas_dec_mono_sba_handling( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { - Word16 mono_flag, b, block; + int16_t mono_flag, b, block; mono_flag = 1; @@ -1136,11 +1225,6 @@ static void ivas_dec_mono_sba_handling( float azimuth = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth[block]; float elevation = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth[block]; float energy_ratio = st_ivas->hQMetaData->q_direction[0].band_data[0].energy_ratio[block]; -#ifdef IVAS_FLOAT_FIXED - Word32 azimuth_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; - Word32 elevation_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; - Word32 energy_ratio_fx = st_ivas->hQMetaData->q_direction[0].band_data[0].energy_ratio_fx[block]; -#endif if ( ( azimuth != 0.0f ) || ( elevation != 0.0f ) || @@ -1148,7 +1232,55 @@ static void ivas_dec_mono_sba_handling( { mono_flag = 0; } -#ifdef IVAS_FLOAT_FIXED + } + } + + /* Combine the SPAR prediction coefs flag with the azimuth, elevation and energy ratio flag.*/ + mono_flag = mono_flag && ivas_spar_chk_zero_coefs( st_ivas ); + + if ( mono_flag ) + { + /* Set Energy Ratio values to be zero */ + for ( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + set_zero( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + if ( st_ivas->hDirAC != NULL ) + { + for ( block = 0; block < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; ++block ) + { + /* Set directional Energy Ratio values to be zero */ + set_zero( st_ivas->hSpatParamRendCom->energy_ratio1[block], st_ivas->hSpatParamRendCom->num_freq_bands ); + if ( st_ivas->hQMetaData->no_directions == 2 ) + { + set_zero( st_ivas->hSpatParamRendCom->energy_ratio2[block], st_ivas->hSpatParamRendCom->num_freq_bands ); + } + /* Set Diffuseness values to be 1.0 */ + set_f( st_ivas->hSpatParamRendCom->diffuseness_vector[block], 1.0f, st_ivas->hSpatParamRendCom->num_freq_bands ); + } + } + } + + return; +} +#else +static void ivas_dec_mono_sba_handling_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + Word16 mono_flag, b, block; + + mono_flag = 1; + + FOR ( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + FOR( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + + Word32 azimuth_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; + Word32 elevation_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; + Word32 energy_ratio_fx = st_ivas->hQMetaData->q_direction[0].band_data[0].energy_ratio_fx[block]; + IF ( ( NE_32(azimuth_fx, 0) ) || (NE_32(elevation_fx, 0) ) || @@ -1156,7 +1288,6 @@ static void ivas_dec_mono_sba_handling( { mono_flag = 0; } -#endif } } @@ -1170,9 +1301,9 @@ static void ivas_dec_mono_sba_handling( for ( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) { set_zero( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio, MAX_PARAM_SPATIAL_SUBFRAMES ); -#ifdef IVAS_FLOAT_FIXED + set32_fx( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio_fx,0, MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif + } if ( st_ivas->hDirAC != NULL ) { @@ -1180,21 +1311,21 @@ static void ivas_dec_mono_sba_handling( { /* Set directional Energy Ratio values to be zero */ set_zero( st_ivas->hSpatParamRendCom->energy_ratio1[block], st_ivas->hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED + set32_fx( st_ivas->hSpatParamRendCom->energy_ratio1_fx[block],0, st_ivas->hSpatParamRendCom->num_freq_bands ); -#endif + if ( st_ivas->hQMetaData->no_directions == 2 ) { set_zero( st_ivas->hSpatParamRendCom->energy_ratio2[block], st_ivas->hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED + set32_fx( st_ivas->hSpatParamRendCom->energy_ratio2_fx[block],0, st_ivas->hSpatParamRendCom->num_freq_bands ); -#endif + } /* Set Diffuseness values to be 1.0 */ set_f( st_ivas->hSpatParamRendCom->diffuseness_vector[block], 1.0f, st_ivas->hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED + set32_fx( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[block], ONE_IN_Q30, st_ivas->hSpatParamRendCom->num_freq_bands ); -#endif + } } } @@ -1202,26 +1333,27 @@ static void ivas_dec_mono_sba_handling( return; } - +#endif +#ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* - * Function ivas_spar_md_dec_process() + * Function ivas_spar_md_dec_process_fx() * * SPAR Meta Data decoder process *-----------------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_md_dec_process( + +void ivas_spar_md_dec_process_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ - const int16_t num_bands_out, /* i : number of output bands */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ + const Word16 num_bands_out, /* i : number of output bands */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ ) { - int16_t j, k, b, bw, dtx_vad, nB, i_ts; + Word16 j, k, b, bw, dtx_vad, nB, i_ts; ivas_spar_md_dec_state_t *hMdDec; - int16_t num_md_chs; - int16_t num_md_sub_frames; - int16_t dyn_active_w_flag; - int16_t active_w_vlbr; + Word16 num_md_chs; + Word16 num_md_sub_frames; + Word16 dyn_active_w_flag; + Word16 active_w_vlbr; hMdDec = st_ivas->hSpar->hMdDec; @@ -1231,48 +1363,55 @@ 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, st_ivas->last_active_ivas_total_brate ); - if ( hMdDec->spar_md_cfg.nchan_transport > 1 && hMdDec->spar_md_cfg.nchan_transport <= 3 ) + test(); + IF ( GT_16(hMdDec->spar_md_cfg.nchan_transport , 1) && LE_16(hMdDec->spar_md_cfg.nchan_transport , 3) ) { - hMdDec->spar_md.res_ind = 0; - dyn_active_w_flag = get_next_indice( st0, 1 ); - if ( dyn_active_w_flag == 1 ) + hMdDec->spar_md.res_ind = 0; move16(); + dyn_active_w_flag = get_next_indice_fx( st0, 1 ); + IF ( EQ_16(dyn_active_w_flag , 1) ) { - if ( hMdDec->spar_md_cfg.nchan_transport == 2 ) + IF ( EQ_16(hMdDec->spar_md_cfg.nchan_transport , 2) ) { - hMdDec->spar_md.res_ind = get_next_indice( st0, 1 ); - hMdDec->spar_md.res_ind += hMdDec->spar_md_cfg.nchan_transport; + hMdDec->spar_md.res_ind = get_next_indice_fx( st0, 1 ); + move16(); + hMdDec->spar_md.res_ind = add(hMdDec->spar_md_cfg.nchan_transport, hMdDec->spar_md.res_ind); + move16(); } - else if ( hMdDec->spar_md_cfg.nchan_transport == 3 ) + ELSE IF ( EQ_16(hMdDec->spar_md_cfg.nchan_transport , 3) ) { hMdDec->spar_md.res_ind = remix_order_set[hMdDec->spar_md_cfg.remix_unmix_order][hMdDec->spar_md_cfg.nchan_transport]; + move16(); } } } else { dyn_active_w_flag = 0; - if ( hMdDec->spar_md_cfg.nchan_transport == FOA_CHANNELS ) + move16(); + IF ( EQ_16(hMdDec->spar_md_cfg.nchan_transport , FOA_CHANNELS) ) { - get_next_indice( st0, 1 ); + get_next_indice_fx( st0, 1 ); } } - for (int i = 0; i < IVAS_MAX_NUM_BANDS; i++) +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED + FOR (Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++) { - for (int ii = 0; ii < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; ii++) + FOR (Word16 ii = 0; ii < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; ii++) { - for (int jj = 0; jj < IVAS_SPAR_MAX_DMX_CHS - 1; jj++) + FOR (Word16 jj = 0; jj < IVAS_SPAR_MAX_DMX_CHS - 1; jj++) { hMdDec->spar_md.band_coeffs[i].C_re_fx[ii][jj] = (Word32)(hMdDec->spar_md.band_coeffs[i].C_re[ii][jj] * (1 << 22)); } } - for (int jj = 0; jj < IVAS_SPAR_MAX_DMX_CHS - 1; jj++) + FOR (Word16 jj = 0; jj < IVAS_SPAR_MAX_DMX_CHS - 1; jj++) { hMdDec->spar_md.band_coeffs[i].pred_re_fx[jj] = (Word32)(hMdDec->spar_md.band_coeffs[i].pred_re[jj] * (1 << 22)); hMdDec->spar_md.band_coeffs[i].P_re_fx[jj] = (Word32)(hMdDec->spar_md.band_coeffs[i].P_re[jj] * (1 << 22)); } } - ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, +#endif + ivas_spar_dec_parse_md_bs_fx( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hQMetaData->sba_inactive_mode ); @@ -1285,6 +1424,7 @@ void ivas_spar_md_dec_process( &hMdDec->base_band_coeffs_age[0], &hMdDec->first_valid_frame, nB ); +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED for (int i = 0; i < IVAS_MAX_NUM_BANDS; i++) { for (int ii = 0; ii < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; ii++) @@ -1300,16 +1440,18 @@ void ivas_spar_md_dec_process( hMdDec->spar_md.band_coeffs[i].P_re[jj] = (float)hMdDec->spar_md.band_coeffs[i].P_re_fx[jj] / (1 << 22); } } - ivas_dec_mono_sba_handling( st_ivas ); +#endif + ivas_dec_mono_sba_handling_fx( st_ivas ); /* SPAR to DirAC conversion */ - if ( hMdDec->spar_hoa_dirac2spar_md_flag == 1 ) + IF ( EQ_16(hMdDec->spar_hoa_dirac2spar_md_flag , 1) ) { - ivas_spar_to_dirac( st_ivas, hMdDec, dtx_vad, num_bands_out, bw, dyn_active_w_flag ); + ivas_spar_to_dirac_fx( st_ivas, hMdDec, dtx_vad, num_bands_out, bw, dyn_active_w_flag ); } /* set correct number of bands*/ nB = IVAS_MAX_NUM_BANDS; + move16(); /* expand DirAC MD to all time slots */ for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) @@ -1318,28 +1460,37 @@ void ivas_spar_md_dec_process( { for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re[j] = hMdDec->spar_md.band_coeffs[b].pred_re[j]; +#endif hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[j] = hMdDec->spar_md.band_coeffs[b].pred_re_fx[j]; + move32(); } for ( j = 0; j < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; j++ ) { for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) { +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re[j][k] = hMdDec->spar_md.band_coeffs[b].C_re[j][k]; +#endif hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[j][k] = hMdDec->spar_md.band_coeffs[b].C_re_fx[j][k]; + move32(); } } for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re[j] = hMdDec->spar_md.band_coeffs[b].P_re[j]; +#endif hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re_fx[j] = hMdDec->spar_md.band_coeffs[b].P_re_fx[j]; + move32(); } } } - ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, num_md_chs, active_w_vlbr, dyn_active_w_flag ); + ivas_get_spar_matrices_fx( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, num_md_chs, active_w_vlbr, dyn_active_w_flag ); #ifdef DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS { @@ -1352,15 +1503,20 @@ void ivas_spar_md_dec_process( fprintf( fid, "%.6f\n", hMdDec->mixer_mat[1][0][band] ); } #endif - ivas_spar_md_fill_invalid_bands( &hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, num_md_chs, num_md_sub_frames ); + ivas_spar_md_fill_invalid_bands_fx( &hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, num_md_chs, num_md_sub_frames ); hMdDec->dtx_md_smoothing_cntr = 1; return; } - #else +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_md_dec_process() + * + * SPAR Meta Data decoder process + *-----------------------------------------------------------------------------------------*/ + void ivas_spar_md_dec_process( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ @@ -1481,6 +1637,8 @@ void ivas_spar_md_dec_process( } #endif + +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_spar_chk_zero_coefs() * @@ -1530,6 +1688,7 @@ int16_t ivas_spar_chk_zero_coefs( return mono; } +#else Word16 ivas_spar_chk_zero_coefs_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ @@ -1574,6 +1733,7 @@ Word16 ivas_spar_chk_zero_coefs_fx( return mono; } +#endif /*-----------------------------------------------------------------------------------------* @@ -1663,7 +1823,7 @@ void ivas_spar_smooth_md_dtx_fx( return; } -#endif +#else 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 */ @@ -1732,6 +1892,7 @@ void ivas_spar_smooth_md_dtx( return; } +#endif /*-----------------------------------------------------------------------------------------* @@ -1805,7 +1966,7 @@ void ivas_spar_setup_md_smoothing_fx( return; } -#endif +#else 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 */ @@ -1865,6 +2026,7 @@ void ivas_spar_setup_md_smoothing( return; } +#endif /*-----------------------------------------------------------------------------------------* @@ -1933,7 +2095,7 @@ void ivas_spar_update_md_hist_fx( return; } -#endif +#else void ivas_spar_update_md_hist( ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */ ) @@ -1988,14 +2150,14 @@ void ivas_spar_update_md_hist( return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_get_spar_matrices() * * Get SPAR matrices *-----------------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, @@ -2048,10 +2210,6 @@ static void ivas_get_spar_matrices( { set_zero( &hMdDec->spar_coeffs.C_re[i][j][i_ts * IVAS_MAX_NUM_BANDS], IVAS_MAX_NUM_BANDS ); set_zero( &hMdDec->spar_coeffs.P_re[i][j][i_ts * IVAS_MAX_NUM_BANDS], IVAS_MAX_NUM_BANDS ); -#ifdef IVAS_FLOAT_FIXED - set32_fx(&hMdDec->spar_coeffs.C_re_fx[i][j][i_ts * IVAS_MAX_NUM_BANDS], 0, IVAS_MAX_NUM_BANDS); - set32_fx(&hMdDec->spar_coeffs.P_re_fx[i][j][i_ts * IVAS_MAX_NUM_BANDS], 0, IVAS_MAX_NUM_BANDS); -#endif } } num_bands = min( num_bands, nB ); @@ -2226,8 +2384,265 @@ static void ivas_get_spar_matrices( return; } +#else +static void ivas_get_spar_matrices_fx( + ivas_spar_md_dec_state_t *hMdDec, + const int16_t num_bands_out, + const int16_t n_ts, + const int16_t bw, + const int16_t dtx_vad, + const int16_t nB, + const int16_t numch_out, + const int16_t active_w_vlbr, + const int16_t dyn_active_w_flag ) +{ + Word16 num_bands, dmx_ch, split_band; + Word16 i, j, k, m, b, i_ts, active_w; + const Word16 *order; + Word32 active_w_dm_fac_fx, re_fx,re_fx1; + + num_bands = num_bands_out; + order = remix_order_set[hMdDec->spar_md_cfg.remix_unmix_order]; + + split_band = SPAR_DIRAC_SPLIT_START_BAND; + + //Dead code as SPAR_DIRAC_SPLIT_START_BAND = 8 and IVAS_MAX_NUM_BANDS = 12 + IF( GE_16( split_band, IVAS_MAX_NUM_BANDS ) ) + { + /*store previous 4x4 parameters for linear interpolation to current*/ + + FOR( i = 0; i < numch_out; i++ ) + { + FOR( j = 0; j < numch_out; j++ ) + { + FOR( b = 0; b < num_bands; b++ ) + { + hMdDec->mixer_mat_prev_fx[0][i][j][b] = hMdDec->mixer_mat_fx[i][j][b]; + move32(); + } + } + } + } + + IF( bw == IVAS_RED_BAND_FACT ) + { + num_bands = shl( num_bands, 1 ); + } + + active_w = EQ_16( dyn_active_w_flag, 1 ) || EQ_16( hMdDec->spar_md_cfg.active_w, 1 ); + active_w_dm_fac_fx = EQ_16( dtx_vad, 0 ) ? IVAS_ACTIVEW_DM_F_SCALE_DTX_FX : ( EQ_16( active_w_vlbr, 1 ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX : IVAS_ACTIVEW_DM_F_SCALE_FX ); + + move16(); + FOR( i_ts = 0; i_ts < n_ts; i_ts++ ) + { + FOR( i = 0; i < numch_out; i++ ) + { + FOR( j = 0; j < numch_out; j++ ) + { + + set32_fx( &hMdDec->spar_coeffs.C_re_fx[i][j][i_ts * IVAS_MAX_NUM_BANDS], 0, IVAS_MAX_NUM_BANDS ); + set32_fx( &hMdDec->spar_coeffs.P_re_fx[i][j][i_ts * IVAS_MAX_NUM_BANDS], 0, IVAS_MAX_NUM_BANDS ); + } + } + num_bands = min( num_bands, nB ); + + FOR( b = 0; b < num_bands; b++ ) + { + Word32 tmp_C1_re_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word32 tmp_C2_re_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word32 tmp_dm_re_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + dmx_ch = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bw * b]; + + FOR( j = 0; j < numch_out; j++ ) + { + set_zero_fx( tmp_C1_re_fx[j], numch_out ); + set_zero_fx( tmp_C2_re_fx[j], numch_out ); + set_zero_fx( tmp_dm_re_fx[j], numch_out ); + + tmp_C1_re_fx[j][j] = ONE_IN_Q22; + tmp_C2_re_fx[j][j] = ONE_IN_Q22; + tmp_dm_re_fx[j][j] = ONE_IN_Q22; + move32(); + move32(); + move32(); + } + + FOR( j = 1; j < numch_out; j++ ) + { + tmp_C1_re_fx[j][0] = hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[j - 1]; // Q.22 + move32(); + } + + IF( EQ_16( active_w, 1 ) ) + { + FOR( j = 1; j < numch_out; j++ ) + { + + tmp_C2_re_fx[0][j] = Mpy_32_32( active_w_dm_fac_fx, -hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re_fx[j - 1] ); // Q31 *Q22=Q22 + move32(); + } + re_fx = Mpy_32_32( tmp_C2_re_fx[0][1], tmp_C1_re_fx[1][0] ); // Q22 *Q22 =Q13 + re_fx1 = L_add( ONE_IN_Q13, re_fx ); // Q13+Q13 + + re_fx = Mpy_32_32( tmp_C2_re_fx[0][2], tmp_C1_re_fx[2][0] ); // Q22 *Q22 =Q13 + re_fx1 = L_add( re_fx1, re_fx ); // Q13+Q13 + + re_fx = Mpy_32_32( tmp_C2_re_fx[0][3], tmp_C1_re_fx[3][0] ); // Q22 *Q22 =Q13 + tmp_dm_re_fx[0][0] = L_shl(L_add( re_fx1, re_fx ), Q9); // (Q13+Q13) << Q9 = Q22; + move32(); + + if ( EQ_16( dyn_active_w_flag, 1 ) ) + { + tmp_dm_re_fx[0][0] =L_shl(Mpy_32_32( tmp_dm_re_fx[0][0], IVAS_SPAR_DYN_ACTIVEW_THRESH_FX ),Q9); // Q13 *Q31 =Q13 << Q9=Q.22 + move32(); + } + + tmp_dm_re_fx[0][1] = tmp_C2_re_fx[0][1]; + + tmp_dm_re_fx[0][2] = tmp_C2_re_fx[0][2]; + + tmp_dm_re_fx[0][3] = tmp_C2_re_fx[0][3]; + + tmp_dm_re_fx[1][0] = tmp_C1_re_fx[1][0]; + + tmp_dm_re_fx[2][0] = tmp_C1_re_fx[2][0]; + + tmp_dm_re_fx[3][0] = tmp_C1_re_fx[3][0]; + + IF( NE_16( hMdDec->spar_md_cfg.remix_unmix_order, 3 ) ) + { + ivas_mat_col_rearrange_fx( tmp_dm_re_fx, order, i_ts, hMdDec->mixer_mat_fx, b, numch_out ); + } + } + ELSE + { + IF( NE_16( hMdDec->spar_md_cfg.remix_unmix_order, 3 ) ) + { + + ivas_mat_col_rearrange_fx( tmp_C1_re_fx, order, i_ts, hMdDec->mixer_mat_fx, b, numch_out ); + } + } + + IF( GT_16( dmx_ch, 0 ) ) + { + Word32 tmpC_re_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + Word32 tmpP_re_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + + FOR( j = 0; j < numch_out; j++ ) + { + set32_fx( tmpC_re_fx[j], 0, numch_out ); + set32_fx( tmpP_re_fx[j], 0, numch_out ); + } + + FOR( j = 0; j < numch_out; j++ ) + { + set32_fx( tmpC_re_fx[j], 0, numch_out ); + } + + FOR( k = 0; k < dmx_ch; k++ ) + { + tmpC_re_fx[k][k] = ONE_IN_Q22; + move32(); + } + + FOR( j = dmx_ch; j < numch_out; j++ ) + { + FOR( k = 1; k < dmx_ch; k++ ) + { + tmpC_re_fx[j][k] = hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[j - dmx_ch][k - 1]; // Q22 + move32(); + } + } + + FOR( j = dmx_ch; j < numch_out; j++ ) + { + FOR( k = dmx_ch; k < numch_out; k++ ) + { + IF( EQ_16( sub( j, dmx_ch ), sub( k, dmx_ch ) ) ) + { + tmpP_re_fx[j][k] = hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re_fx[k - dmx_ch]; // Q22 + move32(); + } + ELSE + { + tmpP_re_fx[j][k] = 0; + move32(); + } + } + } + + + FOR( j = 1; j < numch_out; j++ ) + { + FOR( k = dmx_ch; k < numch_out; k++ ) + { + FOR( m = 0; m < numch_out; m++ ) + { + re_fx = Mpy_32_32( hMdDec->mixer_mat_fx[j][m][b + i_ts * IVAS_MAX_NUM_BANDS], tmpP_re_fx[m][k] ); // Q30*Q22 + re_fx = L_shl( re_fx, 1 ); + hMdDec->spar_coeffs.P_re_fx[j][k][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] = L_add( hMdDec->spar_coeffs.P_re_fx[j][k][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS], re_fx ); + move32(); + } + } + } + + + FOR( j = 0; j < numch_out; j++ ) + { + FOR( k = 0; k < dmx_ch; k++ ) + { + FOR( m = 0; m < numch_out; m++ ) + { + re_fx = Mpy_32_32( hMdDec->mixer_mat_fx[j][m][b + i_ts * IVAS_MAX_NUM_BANDS], tmpC_re_fx[m][k] ); // Q30* Q22 + re_fx = L_shl( re_fx, 1 ); + hMdDec->spar_coeffs.C_re_fx[j][k][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] = L_add( hMdDec->spar_coeffs.C_re_fx[j][k][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS], re_fx ); + move32(); + } + } + } + + hMdDec->spar_coeffs.C_re_fx[0][0][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] = + max( 0, hMdDec->spar_coeffs.C_re_fx[0][0][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] ); + } + } + + /* band mixing */ + IF( EQ_16( bw, IVAS_RED_BAND_FACT ) ) + { + FOR( b = 0; b < num_bands_out; b = b + bw ) + { + dmx_ch = hMdDec->spar_md_cfg.num_dmx_chans_per_band[b]; + move16(); + FOR( j = 0; j < numch_out; j++ ) + { + FOR( k = dmx_ch; k < numch_out; k++ ) + { + + hMdDec->spar_coeffs.P_re_fx[j][k][( b + 1 ) + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.P_re_fx[j][k][b + i_ts * IVAS_MAX_NUM_BANDS]; + move32(); + } + } + + FOR( j = 0; j < numch_out; j++ ) + { + FOR( k = 0; k < dmx_ch; k++ ) + { + + hMdDec->spar_coeffs.C_re_fx[j][k][( b + 1 ) + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.C_re_fx[j][k][b + i_ts * IVAS_MAX_NUM_BANDS]; + + move32(); + } + } + } + } + } + + return; +} +#endif +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_mat_col_rearrange() * @@ -2256,7 +2671,39 @@ static void ivas_mat_col_rearrange( return; } +#else +/*-----------------------------------------------------------------------------------------* +* Function ivas_mat_col_rearrange() +* +* reorders the input matrix based on order +*-----------------------------------------------------------------------------------------*/ + +static void ivas_mat_col_rearrange_fx( + Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + const Word16 order[IVAS_SPAR_MAX_CH], + const Word16 i_ts, + Word32 ***mixer_mat, + const Word16 bands, + const Word16 num_ch +) +{ + Word16 i, j, idx; + FOR( i = 0; i < num_ch; i++ ) + { + idx = order[i]; + move16(); + + FOR( j = 0; j < num_ch; j++ ) + { + mixer_mat[j][i][bands + i_ts * IVAS_MAX_NUM_BANDS] = L_shl_sat(in_re[j][idx], Q8); + move32(); + } + } + + return; +} +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_spar_dec_gen_umx_mat() @@ -2284,7 +2731,7 @@ void ivas_spar_dec_gen_umx_mat_fx( { FOR ( b = 0; b < num_bands_out; b++ ) { - hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS]; + hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = L_shl_sat(hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], Q8); move32(); } } @@ -2295,7 +2742,7 @@ void ivas_spar_dec_gen_umx_mat_fx( { FOR ( b = 0; b < num_bands_out; b++ ) { - hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS]; + hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = L_shl_sat(hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], Q8); move32(); } } @@ -2309,7 +2756,7 @@ void ivas_spar_dec_gen_umx_mat_fx( { FOR ( b = 0; b < num_bands_out; b++ ) { - hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS]; + hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = L_shl_sat(hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], Q8); move32(); } } @@ -2319,7 +2766,7 @@ void ivas_spar_dec_gen_umx_mat_fx( ivas_spar_dec_compute_ramp_down_post_matrix_fx( hMdDec, num_bands_out, bfi, num_md_sub_frames); return; } -#endif // IVAS_FLOAT_FIXED +#else // IVAS_FLOAT_FIXED void ivas_spar_dec_gen_umx_mat( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ @@ -2378,6 +2825,7 @@ void ivas_spar_dec_gen_umx_mat( return; } +#endif static void ivas_spar_md_band_upmix( ivas_band_coeffs_t *band_coeffs, @@ -2390,55 +2838,296 @@ static void ivas_spar_md_band_upmix( { int16_t i, ii, jj, b, idx, bw_fact; - bw_fact = *bands_bw / bw_final; - for ( i = *nB - 1; i >= 0; i-- ) + bw_fact = *bands_bw / bw_final; + for ( i = *nB - 1; i >= 0; i-- ) + { + + for ( b = bw_fact - 1; b >= 0; b-- ) + { + idx = i * bw_fact + b; + for ( ii = 0; ii < ndec + ndm - 1; ii++ ) + { +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED + band_coeffs[idx].pred_re[ii] = band_coeffs[i].pred_re[ii]; +#endif + band_coeffs[idx].pred_re_fx[ii] = band_coeffs[i].pred_re_fx[ii]; + } + for ( ii = 0; ii < ndec; ii++ ) + { + for ( jj = 0; jj < ndm - 1; jj++ ) + { +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED + band_coeffs[idx].C_re[ii][jj] = band_coeffs[i].C_re[ii][jj]; +#endif + band_coeffs[idx].C_re_fx[ii][jj] = band_coeffs[i].C_re_fx[ii][jj]; + } + } + for ( jj = 0; jj < ndec; jj++ ) + { +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED + band_coeffs[idx].P_re[jj] = band_coeffs[i].P_re[jj]; +#endif + band_coeffs[idx].P_re_fx[jj] = band_coeffs[i].P_re_fx[jj]; + } + valid_bands[idx] = valid_bands[i]; + } + } + *nB = ( *nB ) * ( *bands_bw ) / bw_final; + *bands_bw = bw_final; + + return; +} + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_dec_parse_md_bs() + * + * Parse SPAR MD bitstream + *-----------------------------------------------------------------------------------------*/ + +#ifndef IVAS_FLOAT_FIXED +static void ivas_spar_dec_parse_md_bs( + ivas_spar_md_dec_state_t *hMdDec, + Decoder_State *st0, + int16_t *nB, + int16_t *bands_bw, + int16_t *dtx_vad, + const int32_t ivas_total_brate, + const int16_t sba_inactive_mode +) +{ + int16_t i, j, k, num_bands; + int16_t ii, jj, ndec, ndm; + uint16_t qsi; + ivas_quant_strat_t qs; + int16_t strat, no_ec; + int16_t do_diff[IVAS_MAX_NUM_BANDS]; + float quant[IVAS_SPAR_MAX_C_COEFF]; + int16_t do_repeat[IVAS_MAX_NUM_BANDS]; + *dtx_vad = 1; + *bands_bw = 1; + qsi = 0; + num_bands = hMdDec->spar_md.num_bands; + + if ( ivas_total_brate > IVAS_SID_5k2 ) + { + if ( hMdDec->spar_md_cfg.quant_strat_bits > 0 ) + { + if ( ivas_total_brate >= BRATE_SPAR_Q_STRAT ) + { + /*only one bit written for quantization strategy to indicate either a fixed quantization strategy or dtx_vad==0 */ + qsi = get_next_indice( st0, 1 ); + if ( qsi == 1 ) + { + *dtx_vad = 0; + } + } + else + { + if ( sba_inactive_mode == 1 ) + { + *dtx_vad = 0; + qsi = hMdDec->spar_md_cfg.quant_strat_bits + 1; + } + else + { + qsi = get_next_indice( st0, hMdDec->spar_md_cfg.quant_strat_bits ); + } + } + } + else + { + qsi = 0; + } + } + else + { + *dtx_vad = 0; + } + + hMdDec->dtx_vad = *dtx_vad; + + if ( *dtx_vad == 0 ) + { + *nB = SPAR_DTX_BANDS; + *bands_bw = num_bands / *nB; + + for ( i = 0; i < *nB; i++ ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + hMdDec->spar_md.band_coeffs[i].pred_re[j] = 0; + hMdDec->spar_md.band_coeffs[i].P_re[j] = 0; + } + hMdDec->valid_bands[i] = 1; + } + + for ( i = 0; i < num_bands; i++ ) + { + for ( j = 0; j < ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ); j++ ) + { + for ( k = 0; k < ( IVAS_SPAR_MAX_DMX_CHS - 1 ); k++ ) + { + hMdDec->spar_md.band_coeffs[i].C_re[j][k] = 0; + } + } + } + + ivas_parse_parameter_bitstream_dtx( &hMdDec->spar_md, st0, *bands_bw, *nB, hMdDec->spar_md_cfg.num_dmx_chans_per_band, hMdDec->spar_md_cfg.num_decorr_per_band ); + + if ( *bands_bw != 1 ) + { + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[0]; + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[0]; + ivas_spar_md_band_upmix( + hMdDec->spar_md.band_coeffs, + nB, + bands_bw, + hMdDec->valid_bands, + 1, + ndec, + ndm ); + } + + return; + } + + qs = hMdDec->spar_md_cfg.quant_strat[qsi]; + + strat = get_next_indice( st0, 3 ); + + no_ec = 0; + + if ( strat < 2 ) + { + *bands_bw = strat + 1; + *nB = num_bands / *bands_bw; + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = 0; + do_repeat[i] = 0; + } + } + else if ( strat < 4 ) + { + *bands_bw = strat - 1; + *nB = num_bands / *bands_bw; + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = 0; + do_repeat[i] = 0; + } + no_ec = 1; + } + else if ( ivas_total_brate < IVAS_24k4 ) + { + *bands_bw = 2; + *nB = num_bands / *bands_bw; + + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = 0; + do_repeat[i] = ( ( strat % 2 ) == ( ( i + 1 ) % 2 ) ); + } + } + else + { + *bands_bw = 1; + *nB = num_bands; + + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = ( ( ( i + 1 ) & 3 ) != strat - 4 ); + do_repeat[i] = 0; + } + if ( hMdDec->spar_md_cfg.prev_quant_idx >= 0 ) + { + ivas_map_prior_coeffs_quant( &hMdDec->spar_md_prev, &hMdDec->spar_md_cfg, qsi, *nB ); + } + } + hMdDec->spar_md_cfg.prev_quant_idx = qsi; + + if ( no_ec == 0 ) + { + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, strat, ivas_total_brate ); + } + else + { + ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw ); + } + + for ( i = 0; i < *nB; i++ ) { + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[( *bands_bw ) * i]; + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[( *bands_bw ) * i]; - for ( b = bw_fact - 1; b >= 0; b-- ) + ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].pred_index_re, qs.PR.q_levels[0], qs.PR.min, qs.PR.max, hMdDec->spar_md.band_coeffs[i].pred_re, ndm + ndec - 1 ); + + j = 0; + for ( ii = 0; ii < ndec; ii++ ) { - idx = i * bw_fact + b; - for ( ii = 0; ii < ndec + ndm - 1; ii++ ) - { - band_coeffs[idx].pred_re[ii] = band_coeffs[i].pred_re[ii]; - band_coeffs[idx].pred_re_fx[ii] = band_coeffs[i].pred_re_fx[ii]; - } - for ( ii = 0; ii < ndec; ii++ ) + for ( jj = 0; jj < ndm - 1; jj++ ) { - for ( jj = 0; jj < ndm - 1; jj++ ) - { - band_coeffs[idx].C_re[ii][jj] = band_coeffs[i].C_re[ii][jj]; - band_coeffs[idx].C_re_fx[ii][jj] = band_coeffs[i].C_re_fx[ii][jj]; - } + quant[j] = hMdDec->spar_md.band_coeffs[i].C_re[ii][jj]; + j++; } - for ( jj = 0; jj < ndec; jj++ ) + } + + ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].drct_index_re, qs.C.q_levels[0], qs.C.min, qs.C.max, quant, ndec * ( ndm - 1 ) ); + + j = 0; + for ( ii = 0; ii < ndec; ii++ ) + { + for ( jj = 0; jj < ndm - 1; jj++ ) { - band_coeffs[idx].P_re[jj] = band_coeffs[i].P_re[jj]; - band_coeffs[idx].P_re_fx[jj] = band_coeffs[i].P_re_fx[jj]; + hMdDec->spar_md.band_coeffs[i].C_re[ii][jj] = quant[j]; + j++; } - valid_bands[idx] = valid_bands[i]; } + + ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].decd_index_re, qs.P_r.q_levels[0], qs.P_r.min, qs.P_r.max, hMdDec->spar_md.band_coeffs[i].P_re, ndm + ndec - 1 ); + + /* Store prior coefficient indices */ + for ( j = 0; j < ndm + ndec - 1; j++ ) + { + hMdDec->spar_md_prev.band_coeffs_idx[i].pred_index_re[j] = hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j]; + } + for ( j = 0; j < ndec * ( ndm - 1 ); j++ ) + { + hMdDec->spar_md_prev.band_coeffs_idx[i].drct_index_re[j] = hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j]; + } + for ( j = 0; j < ndec; j++ ) + { + hMdDec->spar_md_prev.band_coeffs_idx[i].decd_index_re[j] = hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j]; + } + hMdDec->valid_bands[i] |= ( do_diff[i] == 0 && do_repeat[i] == 0 ) ? 1 : 0; } - *nB = ( *nB ) * ( *bands_bw ) / bw_final; - *bands_bw = bw_final; - return; -} + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[0]; + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[0]; + if ( *bands_bw != 1 ) + { + ivas_spar_md_band_upmix( + hMdDec->spar_md.band_coeffs, + nB, + bands_bw, + hMdDec->valid_bands, + 1, + ndec, + ndm ); + } -/*-----------------------------------------------------------------------------------------* - * Function ivas_spar_dec_parse_md_bs() - * - * Parse SPAR MD bitstream - *-----------------------------------------------------------------------------------------*/ -static void ivas_spar_dec_parse_md_bs( + return; +} +#else +static void ivas_spar_dec_parse_md_bs_fx( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st0, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, - const int16_t sba_inactive_mode -) + const int16_t sba_inactive_mode) { int16_t i, j, k, num_bands; int16_t ii, jj, ndec, ndm; @@ -2446,7 +3135,7 @@ static void ivas_spar_dec_parse_md_bs( ivas_quant_strat_t qs; int16_t strat, no_ec; int16_t do_diff[IVAS_MAX_NUM_BANDS]; - float quant[IVAS_SPAR_MAX_C_COEFF]; + //float quant[IVAS_SPAR_MAX_C_COEFF]; Word32 quant_fx[IVAS_SPAR_MAX_C_COEFF]; int16_t do_repeat[IVAS_MAX_NUM_BANDS]; *dtx_vad = 1; @@ -2501,9 +3190,9 @@ static void ivas_spar_dec_parse_md_bs( { for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { - hMdDec->spar_md.band_coeffs[i].pred_re[j] = 0; + //hMdDec->spar_md.band_coeffs[i].pred_re[j] = 0; hMdDec->spar_md.band_coeffs[i].pred_re_fx[j] = 0; - hMdDec->spar_md.band_coeffs[i].P_re[j] = 0; + //hMdDec->spar_md.band_coeffs[i].P_re[j] = 0; hMdDec->spar_md.band_coeffs[i].P_re_fx[j] = 0; } hMdDec->valid_bands[i] = 1; @@ -2515,7 +3204,7 @@ static void ivas_spar_dec_parse_md_bs( { for ( k = 0; k < ( IVAS_SPAR_MAX_DMX_CHS - 1 ); k++ ) { - hMdDec->spar_md.band_coeffs[i].C_re[j][k] = 0; + //hMdDec->spar_md.band_coeffs[i].C_re[j][k] = 0; hMdDec->spar_md.band_coeffs[i].C_re_fx[j][k] = 0; } } @@ -2609,7 +3298,7 @@ static void ivas_spar_dec_parse_md_bs( ndec = hMdDec->spar_md_cfg.num_decorr_per_band[( *bands_bw ) * i]; ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[( *bands_bw ) * i]; - ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].pred_index_re, qs.PR.q_levels[0], qs.PR.min, qs.PR.max, hMdDec->spar_md.band_coeffs[i].pred_re, ndm + ndec - 1 ); + //ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].pred_index_re, qs.PR.q_levels[0], qs.PR.min, qs.PR.max, hMdDec->spar_md.band_coeffs[i].pred_re, ndm + ndec - 1 ); ivas_deindex_real_index_fx( hMdDec->spar_md.band_coeffs_idx[i].pred_index_re, qs.PR.q_levels[0], qs.PR.min_fx, qs.PR.max_fx, hMdDec->spar_md.band_coeffs[i].pred_re_fx, ndm + ndec - 1 ); j = 0; @@ -2617,13 +3306,13 @@ static void ivas_spar_dec_parse_md_bs( { for ( jj = 0; jj < ndm - 1; jj++ ) { - quant[j] = hMdDec->spar_md.band_coeffs[i].C_re[ii][jj]; + //quant[j] = hMdDec->spar_md.band_coeffs[i].C_re[ii][jj]; quant_fx[j] = hMdDec->spar_md.band_coeffs[i].C_re_fx[ii][jj]; j++; } } - ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].drct_index_re, qs.C.q_levels[0], qs.C.min, qs.C.max, quant, ndec * ( ndm - 1 ) ); + //ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].drct_index_re, qs.C.q_levels[0], qs.C.min, qs.C.max, quant, ndec * ( ndm - 1 ) ); ivas_deindex_real_index_fx( hMdDec->spar_md.band_coeffs_idx[i].drct_index_re, qs.C.q_levels[0], qs.C.min_fx, qs.C.max_fx, quant_fx, ndec * ( ndm - 1 ) ); j = 0; @@ -2631,13 +3320,13 @@ static void ivas_spar_dec_parse_md_bs( { for ( jj = 0; jj < ndm - 1; jj++ ) { - hMdDec->spar_md.band_coeffs[i].C_re[ii][jj] = quant[j]; + //hMdDec->spar_md.band_coeffs[i].C_re[ii][jj] = quant[j]; hMdDec->spar_md.band_coeffs[i].C_re_fx[ii][jj] = quant_fx[j]; j++; } } - ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].decd_index_re, qs.P_r.q_levels[0], qs.P_r.min, qs.P_r.max, hMdDec->spar_md.band_coeffs[i].P_re, ndm + ndec - 1 ); + //ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].decd_index_re, qs.P_r.q_levels[0], qs.P_r.min, qs.P_r.max, hMdDec->spar_md.band_coeffs[i].P_re, ndm + ndec - 1 ); ivas_deindex_real_index_fx( hMdDec->spar_md.band_coeffs_idx[i].decd_index_re, qs.P_r.q_levels[0], qs.P_r.min_fx, qs.P_r.max_fx, hMdDec->spar_md.band_coeffs[i].P_re_fx, ndm + ndec - 1 ); /* Store prior coefficient indices */ @@ -2673,6 +3362,7 @@ static void ivas_spar_dec_parse_md_bs( return; } +#endif /*-----------------------------------------------------------------------------------------* @@ -3048,6 +3738,92 @@ static void ivas_spar_get_plc_interp_weights_fx( return; } +#ifdef IVAS_FLOAT_FIXED +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_md_fill_invalid_bands_fx() + * + * Fill invalid bands in interpolation/extrapolation of valid bands + * when PLC is to be done with partial time differential coding + *-----------------------------------------------------------------------------------------*/ +static void ivas_spar_md_fill_invalid_bands_fx( + ivas_spar_dec_matrices_t *pSpar_coeffs, + ivas_spar_dec_matrices_t *pSpar_coeffs_prev, + const Word16 *valid_bands, + Word16 *base_band_age, + const Word16 num_bands, + const Word16 num_channels, + const Word16 num_md_sub_frames ) +{ + Word16 i, j, b, all_valid; + Word16 valid_band_idx[IVAS_MAX_NUM_BANDS], idx = -1; + Word16 last_valid_band_idx[IVAS_MAX_NUM_BANDS]; + Word16 w_fx = 0; + ivas_spar_plc_get_band_age( valid_bands, base_band_age, num_bands, + last_valid_band_idx, valid_band_idx, &all_valid, &idx ); + assert( idx > 0 ); /* some bands should be valid */ + + IF ( EQ_16(all_valid , 0) ) + { + FOR ( b = 0; b < num_bands; b++ ) + { + /* check against non zero in if and else if */ + + IF ( GT_16(base_band_age[b] , 3) ) /* old invalid bands */ + { + Word16 id0, id1; + ivas_spar_get_plc_interp_weights_fx( valid_band_idx, last_valid_band_idx[b], + idx, b, &w_fx, &id0, &id1); + FOR ( i = 0; i < num_channels; i++ ) + { + FOR ( j = 0; j < num_channels; j++ ) + { + pSpar_coeffs->C_re_fx[i][j][b] = L_add(Mpy_32_16_1(pSpar_coeffs->C_re_fx[i][j][id0], sub(MAX_WORD16, w_fx)), Mpy_32_16_1(pSpar_coeffs->C_re_fx[i][j][id1], w_fx)); + move32(); + pSpar_coeffs->P_re_fx[i][j][b] = L_add(Mpy_32_16_1(pSpar_coeffs->P_re_fx[i][j][id0], sub(MAX_WORD16, w_fx)), Mpy_32_16_1(pSpar_coeffs->P_re_fx[i][j][id1], w_fx)); + move32(); + } + } + } + ELSE /* young invalid bands */ + { + IF ( EQ_16(valid_bands[b] , 0) ) + { + FOR ( i = 0; i < num_channels; i++ ) + { + FOR ( j = 0; j < num_channels; j++ ) + { + pSpar_coeffs->C_re_fx[i][j][b] = pSpar_coeffs_prev->C_re_fx[i][j][b]; + move32(); + pSpar_coeffs->P_re_fx[i][j][b] = pSpar_coeffs_prev->P_re_fx[i][j][b]; + move32(); + } + } + } + } + + IF ( EQ_16(valid_bands[b] , 0) ) + { + Word16 i_ts; + FOR ( i = 0; i < num_channels; i++ ) + { + FOR ( j = 0; j < num_channels; j++ ) + { + FOR ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) + { + pSpar_coeffs->C_re_fx[i][j][add(b , i_ts * IVAS_MAX_NUM_BANDS)] = pSpar_coeffs->C_re_fx[i][j][b]; + move32(); + pSpar_coeffs->P_re_fx[i][j][add(b , i_ts * IVAS_MAX_NUM_BANDS)] = pSpar_coeffs->P_re_fx[i][j][b]; + move32(); + } + } + } + } + } + } + + return; +} +#else /*-----------------------------------------------------------------------------------------* * Function ivas_spar_md_fill_invalid_bands() * @@ -3067,7 +3843,6 @@ static void ivas_spar_md_fill_invalid_bands( int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], idx = -1; int16_t last_valid_band_idx[IVAS_MAX_NUM_BANDS]; float w = 0; - Word16 w_fx = 0; ivas_spar_plc_get_band_age( valid_bands, base_band_age, num_bands, last_valid_band_idx, valid_band_idx, &all_valid, &idx ); assert( idx > 0 ); /* some bands should be valid */ @@ -3077,24 +3852,17 @@ static void ivas_spar_md_fill_invalid_bands( for ( b = 0; b < num_bands; b++ ) { /* check against non zero in if and else if */ - if ( base_band_age[b] > 3 ) /* old invalid bands */ { int16_t id0, id1; ivas_spar_get_plc_interp_weights( valid_band_idx, last_valid_band_idx[b], idx, b, &w, &id0, &id1 ); - ivas_spar_get_plc_interp_weights_fx(valid_band_idx, last_valid_band_idx[b], - idx, b, &w_fx, &id0, &id1); for ( i = 0; i < num_channels; i++ ) { for ( j = 0; j < num_channels; j++ ) { pSpar_coeffs->C_re[i][j][b] = ( 1 - w ) * pSpar_coeffs->C_re[i][j][id0] + w * pSpar_coeffs->C_re[i][j][id1]; pSpar_coeffs->P_re[i][j][b] = ( 1 - w ) * pSpar_coeffs->P_re[i][j][id0] + w * pSpar_coeffs->P_re[i][j][id1]; -#ifdef IVAS_FLOAT_FIXED - pSpar_coeffs->C_re_fx[i][j][b] = L_add(Mpy_32_16_1(pSpar_coeffs->C_re_fx[i][j][id0], sub(MAX_WORD16, w_fx)), Mpy_32_16_1(pSpar_coeffs->C_re_fx[i][j][id1], w_fx)); - pSpar_coeffs->P_re_fx[i][j][b] = L_add(Mpy_32_16_1(pSpar_coeffs->P_re_fx[i][j][id0], sub(MAX_WORD16, w_fx)), Mpy_32_16_1(pSpar_coeffs->P_re_fx[i][j][id1], w_fx)); -#endif } } } @@ -3108,10 +3876,6 @@ static void ivas_spar_md_fill_invalid_bands( { pSpar_coeffs->C_re[i][j][b] = pSpar_coeffs_prev->C_re[i][j][b]; pSpar_coeffs->P_re[i][j][b] = pSpar_coeffs_prev->P_re[i][j][b]; -#ifdef IVAS_FLOAT_FIXED - pSpar_coeffs->C_re_fx[i][j][b] = pSpar_coeffs_prev->C_re_fx[i][j][b]; - pSpar_coeffs->P_re_fx[i][j][b] = pSpar_coeffs_prev->P_re_fx[i][j][b]; -#endif } } } @@ -3128,10 +3892,6 @@ static void ivas_spar_md_fill_invalid_bands( { pSpar_coeffs->C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->C_re[i][j][b]; pSpar_coeffs->P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->P_re[i][j][b]; -#ifdef IVAS_FLOAT_FIXED - pSpar_coeffs->C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->C_re_fx[i][j][b]; - pSpar_coeffs->P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->P_re_fx[i][j][b]; -#endif } } } @@ -3141,6 +3901,7 @@ static void ivas_spar_md_fill_invalid_bands( return; } +#endif static void ivas_spar_md_fill_invalid_bandcoeffs( ivas_band_coeffs_t *pBand_coeffs, @@ -3153,7 +3914,7 @@ static void ivas_spar_md_fill_invalid_bandcoeffs( int16_t j, k, b, all_valid; int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], idx = -1; int16_t last_valid_band_idx[IVAS_MAX_NUM_BANDS]; - float w = 0; + //float w = 0; Word16 w_fx = 0; ivas_spar_plc_get_band_age( valid_bands, base_band_age, num_bands, @@ -3169,14 +3930,14 @@ static void ivas_spar_md_fill_invalid_bandcoeffs( if ( ( base_band_age[b] > 3 ) || ( *first_valid_frame == 0 ) ) /* old invalid bands */ { int16_t id0, id1; - ivas_spar_get_plc_interp_weights( valid_band_idx, last_valid_band_idx[b], - idx, b, &w, &id0, &id1 ); + //ivas_spar_get_plc_interp_weights( valid_band_idx, last_valid_band_idx[b], + // idx, b, &w, &id0, &id1 ); ivas_spar_get_plc_interp_weights_fx(valid_band_idx, last_valid_band_idx[b], idx, b, &w_fx, &id0, &id1); for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { - pBand_coeffs[b].pred_re[j] = ( 1 - w ) * pBand_coeffs[id0].pred_re[j] + w * pBand_coeffs[id1].pred_re[j]; + //pBand_coeffs[b].pred_re[j] = ( 1 - w ) * pBand_coeffs[id0].pred_re[j] + w * pBand_coeffs[id1].pred_re[j]; pBand_coeffs[b].pred_re_fx[j] = L_add(Mpy_32_16_1(pBand_coeffs[id0].pred_re_fx[j], sub(MAX_WORD16, w_fx)), Mpy_32_16_1(pBand_coeffs[id1].pred_re_fx[j],w_fx)); } @@ -3184,14 +3945,14 @@ static void ivas_spar_md_fill_invalid_bandcoeffs( { for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) { - pBand_coeffs[b].C_re[j][k] = ( 1 - w ) * pBand_coeffs[id0].C_re[j][k] + w * pBand_coeffs[id1].C_re[j][k]; + // pBand_coeffs[b].C_re[j][k] = ( 1 - w ) * pBand_coeffs[id0].C_re[j][k] + w * pBand_coeffs[id1].C_re[j][k]; pBand_coeffs[b].C_re_fx[j][k] = L_add(Mpy_32_16_1(pBand_coeffs[id0].C_re_fx[j][k], sub(MAX_WORD16, w_fx)), Mpy_32_16_1(pBand_coeffs[id1].C_re_fx[j][k],w_fx)); } } for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { - pBand_coeffs[b].P_re[j] = ( 1 - w ) * pBand_coeffs[id0].P_re[j] + w * pBand_coeffs[id1].P_re[j]; + //pBand_coeffs[b].P_re[j] = ( 1 - w ) * pBand_coeffs[id0].P_re[j] + w * pBand_coeffs[id1].P_re[j]; pBand_coeffs[b].P_re_fx[j] = L_add(Mpy_32_16_1(pBand_coeffs[id0].P_re_fx[j], sub(MAX_WORD16, w_fx)), Mpy_32_16_1(pBand_coeffs[id1].P_re_fx[j], w_fx)); } } @@ -3201,7 +3962,7 @@ static void ivas_spar_md_fill_invalid_bandcoeffs( { for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { - pBand_coeffs[b].pred_re[j] = pBand_coeffs_prev[b].pred_re[j]; + //pBand_coeffs[b].pred_re[j] = pBand_coeffs_prev[b].pred_re[j]; pBand_coeffs[b].pred_re_fx[j] = pBand_coeffs_prev[b].pred_re_fx[j]; } @@ -3209,14 +3970,14 @@ static void ivas_spar_md_fill_invalid_bandcoeffs( { for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) { - pBand_coeffs[b].C_re[j][k] = pBand_coeffs_prev[b].C_re[j][k]; + //pBand_coeffs[b].C_re[j][k] = pBand_coeffs_prev[b].C_re[j][k]; pBand_coeffs[b].C_re_fx[j][k] = pBand_coeffs_prev[b].C_re_fx[j][k]; } } for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { - pBand_coeffs[b].P_re[j] = pBand_coeffs_prev[b].P_re[j]; + //pBand_coeffs[b].P_re[j] = pBand_coeffs_prev[b].P_re[j]; pBand_coeffs[b].P_re_fx[j] = pBand_coeffs_prev[b].P_re_fx[j]; } } @@ -3305,7 +4066,7 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix_fx( return; } -#endif // IVAS_FLOAT_FIXED +#else static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, @@ -3368,6 +4129,8 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix( return; } +#endif // IVAS_FLOAT_FIXED + /*-----------------------------------------------------------------------------------------* @@ -3409,7 +4172,9 @@ static void ivas_spar_unquant_dtx_indicies( idx = pSpar_md->band_coeffs_idx[b].pred_index_re[i]; ivas_deindex_real_index_fx(&idx, q_lvl, pr_min_max_fx[0], pr_min_max_fx[1], &val_fx, 1); pSpar_md->band_coeffs[b].pred_re_fx[i] = val_fx; +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED pSpar_md->band_coeffs[b].pred_re[i] = (float)val_fx / (1 << 22); +#endif } for ( i = 0; i < FOA_CHANNELS - ndm_per_band[bw * b]; i++ ) @@ -3423,7 +4188,9 @@ static void ivas_spar_unquant_dtx_indicies( idx = pSpar_md->band_coeffs_idx[b].decd_index_re[i]; ivas_deindex_real_index_fx(&idx, q_lvl, dtx_pd_real_min_max_fx[0], dtx_pd_real_min_max_fx[1], &val_fx, 1); pSpar_md->band_coeffs[b].P_re_fx[i] = val_fx; +#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED pSpar_md->band_coeffs[b].P_re[i] = (float)val_fx / (1 << 22); +#endif } } @@ -3667,6 +4434,7 @@ static void ivas_parse_parameter_bitstream_dtx( * Deindex real index *-----------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, @@ -3701,6 +4469,7 @@ static ivas_error ivas_deindex_real_index( return IVAS_ERR_OK; } +#else static ivas_error ivas_deindex_real_index_fx( const int16_t *index, @@ -3736,14 +4505,16 @@ static ivas_error ivas_deindex_real_index_fx( return IVAS_ERR_OK; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_spar_to_dirac() * * *-----------------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED + void ivas_spar_to_dirac( Decoder_Struct *st_ivas, ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ @@ -3757,26 +4528,18 @@ void ivas_spar_to_dirac( int16_t block, b; int16_t *band_grouping; float diffuseness[IVAS_MAX_NUM_BANDS]; - Word32 diffuseness_fx[IVAS_MAX_NUM_BANDS]; int16_t sba_order_internal; float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - Word32 ele_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t azi[IVAS_MAX_NUM_BANDS]; int16_t ele[IVAS_MAX_NUM_BANDS]; float dvx[IVAS_MAX_NUM_BANDS], dvy[IVAS_MAX_NUM_BANDS], dvz[IVAS_MAX_NUM_BANDS]; - Word32 dvx_fx[IVAS_MAX_NUM_BANDS], dvy_fx[IVAS_MAX_NUM_BANDS], dvz_fx[IVAS_MAX_NUM_BANDS]; float radius; - Word32 radius_fx; float en_ratio, res_pow; - Word32 en_ratio_fx, res_pow_fx; - Word32 res_pow_q; int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; float pred_re_20ms[IVAS_MAX_NUM_BANDS][IVAS_SPAR_MAX_CH - 1]; - Word32 pred_re_20ms_fx[IVAS_MAX_NUM_BANDS][IVAS_SPAR_MAX_CH - 1]; int16_t pred_idx; int16_t *dirac_to_spar_md_bands; int16_t enc_param_start_band; @@ -3805,204 +4568,70 @@ void ivas_spar_to_dirac( for ( band = start_band; band < end_band; band++ ) { float PR[3], Pd[3], dvnorm, g_pred; - Word32 PR_fx[3], Pd_fx[3], dvnorm_fx, g_pred_fx; - Word16 q_g_pred; - Word16 q_dvnorm; + PR[0] = hMdDec->spar_md.band_coeffs[band].pred_re[2]; - PR_fx[0] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[2]; PR[1] = hMdDec->spar_md.band_coeffs[band].pred_re[0]; - PR_fx[1] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[0]; PR[2] = hMdDec->spar_md.band_coeffs[band].pred_re[1]; - PR_fx[2] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[1]; g_pred = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; - g_pred_fx = Mpy_32_32(PR_fx[0], PR_fx[0]) + Mpy_32_32(PR_fx[1], PR_fx[1]) + Mpy_32_32(PR_fx[2], PR_fx[2]); - q_g_pred = 22 + 22 - 31; - q_g_pred = 31 - q_g_pred; - q_dvnorm = q_g_pred; if ( g_pred <= EPSILON ) { dvx[band] = 1.0f; dvy[band] = 0.0f; dvz[band] = 0.0f; - - azi[band] = 0; - ele[band] = 0; - q_g_pred = 0; - q_dvnorm = 0; } else { g_pred = sqrtf( g_pred ); dvnorm = 1.0f / g_pred; - dvnorm_fx = ISqrt32(g_pred_fx, &q_dvnorm); - g_pred_fx = Sqrt32(g_pred_fx, &q_g_pred); - if (q_g_pred < 0) - { - g_pred_fx = L_shr(g_pred_fx, (-1 * q_g_pred)); - q_g_pred = 0; - } - dvx[band] = PR[0] * dvnorm; dvy[band] = PR[1] * dvnorm; dvz[band] = PR[2] * dvnorm; - - dvx_fx[band] = Mpy_32_32(PR_fx[0], dvnorm_fx); - dvy_fx[band] = Mpy_32_32(PR_fx[1], dvnorm_fx); - dvz_fx[band] = Mpy_32_32(PR_fx[2], dvnorm_fx); - Word16 q_1 = (22) + (31 - q_dvnorm) - 31; - - Word32 temp = Mpy_32_32(dvx_fx[band], dvx_fx[band]) + Mpy_32_32(dvy_fx[band], dvy_fx[band] ); - Word16 q2 = q_1 + q_1 - 31; - Word16 q_temp = 31 - q2; - radius_fx = Sqrt32(temp, &q_temp); - radius = sqrtf(dvx[band] * dvx[band] + dvy[band] * dvy[band]); - - - Word16 check_azi_fx = BASOP_util_atan2(dvy_fx[band], dvx_fx[band],0); - Word32 check_azi_fx_32 = L_shl(check_azi_fx,16); - Word16 check_azi_fx_res; - if (check_azi_fx_32 < 0) - { - check_azi_fx_res = negate(divide3232(L_negate(check_azi_fx_32), 1686629760)); - } - else - { - check_azi_fx_res = divide3232(check_azi_fx_32, 1686629760); } - Word32 azi_intermediate = Mpy_32_16_1(DEGREE_180_Q_22, check_azi_fx_res); - azi_intermediate = azi_intermediate + ONE_IN_Q21; - //Word16 azi_res = L_shr_r(azi_intermediate, 22); - Word16 azi_res = extract_l(azi_intermediate / (1 << 22)); - - Word16 check_ele_fx = BASOP_util_atan2(dvz_fx[band], radius_fx, (9+ q_dvnorm)-q_temp); - Word32 check_ele_fx_32 = L_shl(check_ele_fx, 16); - Word16 check_ele_fx_res; - if (check_azi_fx_32 < 0) - { - check_ele_fx_res = negate(divide3232(L_negate(check_ele_fx_32), 1686629760)); - } - else - { - check_ele_fx_res = divide3232(check_ele_fx_32, 1686629760); - } - Word32 ele_intermediate = Mpy_32_16_1(DEGREE_180_Q_22, check_ele_fx_res); - ele_intermediate = ele_intermediate + ONE_IN_Q21; - //Word16 ele_res = L_shr_r(ele_intermediate, 22); - Word16 ele_res = extract_l(ele_intermediate/(1<<22)); - + radius = sqrtf( dvx[band] * dvx[band] + dvy[band] * dvy[band] ); azi[band] = (int16_t)(max(-180.0f, min(180.0f, atan2f(dvy[band], dvx[band]) / EVS_PI * 180.0f)) + 0.5f); - azi[band] = max(-180, min(180, azi_res)); ele[band] = (int16_t)(max(-90.0f, min(180.0f, atan2f(dvz[band], radius) / EVS_PI * 180.0f)) + 0.5f); - ele[band] = max(-90, min(180, ele_res)); - } - Word16 en_ratio_q = 0; if ( st_ivas->nchan_transport == 1 ) { float w_en_norm, f_scale; - Word32 w_en_norm_fx, f_scale_fx; - Word16 q_w_en_norm_fx; if ( active_w ) { if ( dtx_vad == 0 ) { f_scale = IVAS_ACTIVEW_DM_F_SCALE_DTX; - f_scale_fx = IVAS_ACTIVEW_DM_F_SCALE_DTX_FX; } else { f_scale = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE; - f_scale_fx = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX : IVAS_ACTIVEW_DM_F_SCALE_FX; } } else { f_scale = 0.0f; - f_scale_fx = 0; } w_en_norm = ( 1.0f - ( f_scale * g_pred * g_pred ) ); - Word32 temp_result = Mpy_32_32(Mpy_32_32(f_scale_fx, g_pred_fx), g_pred_fx); - temp_result = L_sub(L_shr(ONE_IN_Q31, q_g_pred), temp_result); w_en_norm *= w_en_norm; - w_en_norm_fx = Mpy_32_32(temp_result, temp_result); - q_w_en_norm_fx = q_g_pred + q_g_pred; + Pd[0] = hMdDec->spar_md.band_coeffs[band].P_re[1]; Pd[1] = hMdDec->spar_md.band_coeffs[band].P_re[0]; Pd[2] = hMdDec->spar_md.band_coeffs[band].P_re[2]; - Pd_fx[0] = hMdDec->spar_md.band_coeffs[band].P_re_fx[1]; - Pd_fx[1] = hMdDec->spar_md.band_coeffs[band].P_re_fx[0]; - Pd_fx[2] = hMdDec->spar_md.band_coeffs[band].P_re_fx[2]; en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; - en_ratio_fx = Mpy_32_32(PR_fx[0], PR_fx[0]) + Mpy_32_32(PR_fx[1], PR_fx[1]) + Mpy_32_32(PR_fx[2], PR_fx[2]); //22+22-31 = 13 - Word32 Pd_temp_res = Mpy_32_32(Pd_fx[0], Pd_fx[0]) + Mpy_32_32(Pd_fx[1], Pd_fx[1]) + Mpy_32_32(Pd_fx[2], Pd_fx[2]);//q = 22+22-31 = 13 res_pow = w_en_norm + en_ratio + ( Pd[0] * Pd[0] + Pd[1] * Pd[1] + Pd[2] * Pd[2] ); - res_pow_fx = L_shr(w_en_norm_fx, (31- q_w_en_norm_fx)-13) + en_ratio_fx + Pd_temp_res; - res_pow_q = 13; - res_pow_fx = L_shr(res_pow_fx, 1); res_pow *= 0.5f; hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; - hMdDec->spar_md.en_ratio_slow_fx[band] = Mpy_32_32(1610612736, hMdDec->spar_md.en_ratio_slow_fx[band]) + Mpy_32_32(536870912, en_ratio_fx); hMdDec->spar_md.ref_pow_slow[band] = 0.75f * hMdDec->spar_md.ref_pow_slow[band] + 0.25f * res_pow; - hMdDec->spar_md.ref_pow_slow_fx[band] = Mpy_32_32(1610612736, hMdDec->spar_md.ref_pow_slow_fx[band]) + Mpy_32_32(536870912, res_pow_fx); en_ratio = sqrtf( hMdDec->spar_md.en_ratio_slow[band] ) / ( hMdDec->spar_md.ref_pow_slow[band] + EPSILON ); - en_ratio_q = 31 - 13; - en_ratio_fx = Sqrt32(hMdDec->spar_md.en_ratio_slow_fx[band], &en_ratio_q); - if (en_ratio_q < 0) - { - en_ratio_fx = L_shr(en_ratio_fx, -1 * (en_ratio_q)); - en_ratio_q = 0; - } - Word32 en_ratio_fx_scaled = L_shr(en_ratio_fx, (31 - en_ratio_q - 13)); - if (en_ratio_fx_scaled > hMdDec->spar_md.ref_pow_slow_fx[band]) - { - diffuseness_fx[band] = 0; - } - else if(en_ratio_fx_scaled == 0) - { - diffuseness_fx[band] = ONE_IN_Q30; - } - else if (en_ratio_fx_scaled == hMdDec->spar_md.ref_pow_slow_fx[band]) - { - diffuseness_fx[band] = ONE_IN_Q30; - } - else - { - en_ratio_fx = divide3232(en_ratio_fx_scaled, (hMdDec->spar_md.ref_pow_slow_fx[band] + EPSILON_FX)); - en_ratio_fx = L_shl(en_ratio_fx, 15); - diffuseness_fx[band] = ONE_IN_Q30 - en_ratio_fx; - } - } else { en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; - en_ratio_fx = Mpy_32_32(PR_fx[0] , PR_fx[0]) + Mpy_32_32(PR_fx[1] , PR_fx[1])+ Mpy_32_32(PR_fx[2] , PR_fx[2]); hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; - hMdDec->spar_md.en_ratio_slow_fx[band] = Mpy_32_32(1610612736, hMdDec->spar_md.en_ratio_slow_fx[band]) + Mpy_32_32(536870912, en_ratio_fx); en_ratio = sqrtf( hMdDec->spar_md.en_ratio_slow[band] ); - en_ratio_q = 31 - 13; - en_ratio_fx = Sqrt32( hMdDec->spar_md.en_ratio_slow_fx[band], &en_ratio_q); - if (en_ratio_q < 0) - { - en_ratio_fx = L_shr(en_ratio_fx, -1 * (en_ratio_q)); - en_ratio_q = 0; - } - Word32 en_ratio_fx_scaled = L_shr(en_ratio_fx, 1); - if (en_ratio_fx_scaled > ONE_IN_Q30) - { - diffuseness_fx[band] = 0; - } - else - { - diffuseness_fx[band] = ONE_IN_Q30 - en_ratio_fx_scaled; - } - } diffuseness[band] = 1.0f - en_ratio; /*compute diffuseness*/ diffuseness[band] = ( ( diffuseness[band] < 1.0f ) ? ( ( diffuseness[band] < 0.0f ) ? 0.f : diffuseness[band] ) : 1.0f ); - diffuseness[band] = (float)diffuseness_fx[band] / (1 << 30); } for ( band = start_band; band < end_band; band++ ) @@ -4011,13 +4640,7 @@ void ivas_spar_to_dirac( tmp_write_idx_param_band = hDirAC->spar_to_dirac_write_idx; en_ratio = 1.0f - diffuseness[band]; - en_ratio_fx = ONE_IN_Q30 - diffuseness_fx[band]; - en_ratio = (float)en_ratio_fx / (1 << 30); - //cam delete the below function call masa_sq( 1.0f - en_ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); -#ifdef IVAS_FLOAT_FIXED - masa_sq_fx(ONE_IN_Q30 - en_ratio_fx, diffuseness_thresholds_fx, DIRAC_DIFFUSE_LEVELS ); -#endif qmf_band_start = band_grouping[band]; qmf_band_end = band_grouping[band + 1]; @@ -4035,9 +4658,6 @@ void ivas_spar_to_dirac( ele_dith = ele[band]; hSpatParamRendCom->energy_ratio1[block][b] = en_ratio; -#ifdef IVAS_FLOAT_FIXED - hSpatParamRendCom->energy_ratio1_fx[block][b] = en_ratio_fx; -#endif tmp_write_idx_band = tmp_write_idx_param_band; if ( hDirAC->hConfig->dec_param_estim == FALSE ) @@ -4045,9 +4665,6 @@ void ivas_spar_to_dirac( hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; -#ifdef IVAS_FLOAT_FIXED - hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; -#endif } else { @@ -4056,9 +4673,6 @@ void ivas_spar_to_dirac( hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; -#ifdef IVAS_FLOAT_FIXED - hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; -#endif tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } } @@ -4103,26 +4717,15 @@ void ivas_spar_to_dirac( } azi_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block]; ele_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].elevation[block]; -#ifdef IVAS_FLOAT_FIXED - azi_dirac_fx[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth_fx[block]; - ele_dirac_fx[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].elevation_fx[block]; -#endif } diffuseness[band] = 1.0f - st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio[0]; -#ifdef IVAS_FLOAT_FIXED - diffuseness_fx[band] = ONE_IN_Q30 - st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio_fx[0]; -#endif } /* DirAC MD averaged over 4 subframes and converted to SPAR format similar to encoder processing */ if ( hMdDec->spar_md_cfg.nchan_transport > 1 ) { -#ifdef IVAS_FLOAT_FIXED - ivas_get_spar_md_from_dirac_fx( 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, dyn_active_w_flag ); -#else 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, dyn_active_w_flag ); -#endif /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) @@ -4130,18 +4733,14 @@ void ivas_spar_to_dirac( for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) { pred_re_20ms[band][pred_idx] = hMdDec->spar_md.band_coeffs[band].pred_re[pred_idx]; - pred_re_20ms_fx[band][pred_idx] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[pred_idx]; } } } int16_t num_md_sub_frames; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); -#ifdef IVAS_FLOAT_FIXED - ivas_get_spar_md_from_dirac_fx( azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, 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, dyn_active_w_flag ); -#else ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, 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, dyn_active_w_flag ); -#endif + if ( st_ivas->hQMetaData->useLowerRes && dtx_vad ) { for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) @@ -4151,12 +4750,10 @@ void ivas_spar_to_dirac( 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]; - hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re_fx[i] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[i]; } 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]; - hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].P_re_fx[i] = hMdDec->spar_md.band_coeffs[band].P_re_fx[i]; } } } @@ -4173,7 +4770,6 @@ void ivas_spar_to_dirac( { /* use 20ms coefficients only for residual channels */ hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[pred_idx] = pred_re_20ms[band][pred_idx]; - hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re_fx[pred_idx] = pred_re_20ms_fx[band][pred_idx]; } } } @@ -4188,7 +4784,7 @@ void ivas_spar_to_dirac( } #else -void ivas_spar_to_dirac( +void ivas_spar_to_dirac_fx( Decoder_Struct *st_ivas, ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ @@ -4200,19 +4796,28 @@ void ivas_spar_to_dirac( int16_t start_band, end_band, band, qmf_band_start, qmf_band_end; int16_t block, b; int16_t *band_grouping; - float diffuseness[IVAS_MAX_NUM_BANDS]; + //float diffuseness[IVAS_MAX_NUM_BANDS]; + Word32 diffuseness_fx[IVAS_MAX_NUM_BANDS]; int16_t sba_order_internal; - float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + //float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + //float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 ele_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t azi[IVAS_MAX_NUM_BANDS]; int16_t ele[IVAS_MAX_NUM_BANDS]; - float dvx[IVAS_MAX_NUM_BANDS], dvy[IVAS_MAX_NUM_BANDS], dvz[IVAS_MAX_NUM_BANDS]; - float radius; - float en_ratio, res_pow; + //float dvx[IVAS_MAX_NUM_BANDS], dvy[IVAS_MAX_NUM_BANDS], dvz[IVAS_MAX_NUM_BANDS]; + Word32 dvx_q, dvy_q, dvz_q; + Word32 dvx_fx[IVAS_MAX_NUM_BANDS], dvy_fx[IVAS_MAX_NUM_BANDS], dvz_fx[IVAS_MAX_NUM_BANDS]; + //float radius; + Word32 radius_fx,radius_q; + //float en_ratio, res_pow; + Word32 en_ratio_fx, res_pow_fx; + Word32 en_ratio_q, res_pow_q; int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; - float pred_re_20ms[IVAS_MAX_NUM_BANDS][IVAS_SPAR_MAX_CH - 1]; + //float pred_re_20ms[IVAS_MAX_NUM_BANDS][IVAS_SPAR_MAX_CH - 1]; + Word32 pred_re_20ms_fx[IVAS_MAX_NUM_BANDS][IVAS_SPAR_MAX_CH - 1]; int16_t pred_idx; int16_t *dirac_to_spar_md_bands; int16_t enc_param_start_band; @@ -4240,71 +4845,207 @@ void ivas_spar_to_dirac( for (band = start_band; band < end_band; band++) { - float PR[3], Pd[3], dvnorm, g_pred; - - PR[0] = hMdDec->spar_md.band_coeffs[band].pred_re[2]; - PR[1] = hMdDec->spar_md.band_coeffs[band].pred_re[0]; - PR[2] = hMdDec->spar_md.band_coeffs[band].pred_re[1]; - g_pred = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; - if (g_pred <= EPSILON) - { - dvx[band] = 1.0f; - dvy[band] = 0.0f; - dvz[band] = 0.0f; + //float PR[3], Pd[3], dvnorm, g_pred; + Word32 PR_fx[3], Pd_fx[3], dvnorm_fx, g_pred_fx; + Word16 q_g_pred; + Word16 q_dvnorm; + //PR[0] = hMdDec->spar_md.band_coeffs[band].pred_re[2]; + PR_fx[0] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[2]; + //PR[1] = hMdDec->spar_md.band_coeffs[band].pred_re[0]; + PR_fx[1] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[0]; + //PR[2] = hMdDec->spar_md.band_coeffs[band].pred_re[1]; + PR_fx[2] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[1]; + //g_pred = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; + g_pred_fx = Mpy_32_32(PR_fx[0], PR_fx[0]) + Mpy_32_32(PR_fx[1], PR_fx[1]) + Mpy_32_32(PR_fx[2], PR_fx[2]); + q_g_pred = Q22 + Q22 - Q31; + q_dvnorm = Q31 - q_g_pred; + q_g_pred = q_dvnorm; + IF ( LE_32 (g_pred_fx, EPSILON_FIX ) ) + { + dvx_fx[band] = ONE_IN_Q22; + dvy_fx[band] = 0; + dvz_fx[band] = 0; + + azi[band] = 0; + ele[band] = 0; + q_g_pred = Q22; + q_dvnorm = Q22; } else { - g_pred = sqrtf(g_pred); - dvnorm = 1.0f / g_pred; - dvx[band] = PR[0] * dvnorm; + //g_pred = Sqrt32( g_pred, ); + //dvnorm = 1.0f / g_pred; + dvnorm_fx = ISqrt32(g_pred_fx, &q_dvnorm); + g_pred_fx = Sqrt32(g_pred_fx, &q_g_pred); + if (q_g_pred < 0) + { + g_pred_fx = L_shr(g_pred_fx, (-1 * q_g_pred)); + q_g_pred = 0; + } + + /*dvx[band] = PR[0] * dvnorm; dvy[band] = PR[1] * dvnorm; - dvz[band] = PR[2] * dvnorm; + dvz[band] = PR[2] * dvnorm;*/ + + dvx_fx[band] = Mpy_32_32(PR_fx[0], dvnorm_fx); + dvy_fx[band] = Mpy_32_32(PR_fx[1], dvnorm_fx); + dvz_fx[band] = Mpy_32_32(PR_fx[2], dvnorm_fx); + Word16 q_1 = (22) + (31 - q_dvnorm) - 31; + + Word32 temp = Mpy_32_32(dvx_fx[band], dvx_fx[band]) + Mpy_32_32(dvy_fx[band], dvy_fx[band] ); + Word16 q2 = q_1 + q_1 - 31; + Word16 q_temp = 31 - q2; + radius_fx = Sqrt32(temp, &q_temp); + //radius = sqrtf(dvx[band] * dvx[band] + dvy[band] * dvy[band]); + + + //float check_qzi = atan2f(dvy[band], dvx[band]); + Word16 check_azi_fx = BASOP_util_atan2(dvy_fx[band], dvx_fx[band],0); + Word32 check_azi_fx_32 = L_shl(check_azi_fx,16); + Word16 check_azi_fx_res; + IF (LT_32(check_azi_fx_32 ,0)) + { + check_azi_fx_res = negate(divide3232(L_negate(check_azi_fx_32), 1686629760)); + } + ELSE + { + check_azi_fx_res = divide3232(check_azi_fx_32, 1686629760); } - - radius = sqrtf(dvx[band] * dvx[band] + dvy[band] * dvy[band]); - azi[band] = (int16_t)(max(-180.0f, min(180.0f, atan2f(dvy[band], dvx[band]) / EVS_PI * 180.0f)) + 0.5f); - ele[band] = (int16_t)(max(-90.0f, min(180.0f, atan2f(dvz[band], radius) / EVS_PI * 180.0f)) + 0.5f); - + Word32 azi_intermediate = Mpy_32_16_1(DEGREE_180_Q_22, check_azi_fx_res); + azi_intermediate = azi_intermediate + ONE_IN_Q21; + //Word16 azi_res = L_shr_r(azi_intermediate, 22); + Word16 azi_res = extract_l(azi_intermediate / (1 << 22)); + + Word16 check_ele_fx = BASOP_util_atan2(dvz_fx[band], radius_fx, (9+ q_dvnorm)-q_temp); + Word32 check_ele_fx_32 = L_shl(check_ele_fx, 16); + Word16 check_ele_fx_res; + IF (LT_32(check_azi_fx_32 ,0)) + { + check_ele_fx_res = negate(divide3232(L_negate(check_ele_fx_32), 1686629760)); + } + else + { + check_ele_fx_res = divide3232(check_ele_fx_32, 1686629760); + } + Word32 ele_intermediate = Mpy_32_16_1(DEGREE_180_Q_22, check_ele_fx_res); + ele_intermediate = ele_intermediate + ONE_IN_Q21; + //Word16 ele_res = L_shr_r(ele_intermediate, 22); + Word16 ele_res = extract_l(ele_intermediate/(1<<22)); + + + + //azi[band] = (int16_t)(max(-180.0f, min(180.0f, atan2f(dvy[band], dvx[band]) / EVS_PI * 180.0f)) + 0.5f); + azi[band] = max(-180, min(180, azi_res)); + //ele[band] = (int16_t)(max(-90.0f, min(180.0f, atan2f(dvz[band], radius) / EVS_PI * 180.0f)) + 0.5f); + ele[band] = max(-90, min(180, ele_res)); + } + + Word16 en_ratio_q = 0; if (st_ivas->nchan_transport == 1) { - float w_en_norm, f_scale; + //float w_en_norm, f_scale; + Word32 w_en_norm_fx, f_scale_fx; + Word16 q_w_en_norm_fx; if (active_w) { if (dtx_vad == 0) { - f_scale = IVAS_ACTIVEW_DM_F_SCALE_DTX; + //f_scale = IVAS_ACTIVEW_DM_F_SCALE_DTX; + f_scale_fx = IVAS_ACTIVEW_DM_F_SCALE_DTX_FX; } else { - f_scale = (active_w_vlbr) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE; + //f_scale = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE; + f_scale_fx = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX : IVAS_ACTIVEW_DM_F_SCALE_FX; } } else { - f_scale = 0.0f; - } + //f_scale = 0.0f; + f_scale_fx = 0; + } + + //w_en_norm = ( 1.0f - ( f_scale * g_pred * g_pred ) ); + Word32 temp_result = Mpy_32_32(Mpy_32_32(f_scale_fx, g_pred_fx), g_pred_fx); + temp_result = L_sub(L_shr(ONE_IN_Q31, q_g_pred), temp_result); + //w_en_norm *= w_en_norm; + w_en_norm_fx = Mpy_32_32(temp_result, temp_result); + q_w_en_norm_fx = q_g_pred + q_g_pred; + //Pd[0] = hMdDec->spar_md.band_coeffs[band].P_re[1]; + //Pd[1] = hMdDec->spar_md.band_coeffs[band].P_re[0]; + //Pd[2] = hMdDec->spar_md.band_coeffs[band].P_re[2]; + Pd_fx[0] = hMdDec->spar_md.band_coeffs[band].P_re_fx[1]; + Pd_fx[1] = hMdDec->spar_md.band_coeffs[band].P_re_fx[0]; + Pd_fx[2] = hMdDec->spar_md.band_coeffs[band].P_re_fx[2]; + //en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; + en_ratio_fx = Mpy_32_32(PR_fx[0], PR_fx[0]) + Mpy_32_32(PR_fx[1], PR_fx[1]) + Mpy_32_32(PR_fx[2], PR_fx[2]); //22+22-31 = 13 + Word32 Pd_temp_res = Mpy_32_32(Pd_fx[0], Pd_fx[0]) + Mpy_32_32(Pd_fx[1], Pd_fx[1]) + Mpy_32_32(Pd_fx[2], Pd_fx[2]);//q = 22+22-31 = 13 + //res_pow = w_en_norm + en_ratio + ( Pd[0] * Pd[0] + Pd[1] * Pd[1] + Pd[2] * Pd[2] ); + res_pow_fx = L_shr(w_en_norm_fx, (31- q_w_en_norm_fx)-13) + en_ratio_fx + Pd_temp_res; + res_pow_q = 13; + res_pow_fx = L_shr(res_pow_fx, 1); + //res_pow *= 0.5f; + //hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; + hMdDec->spar_md.en_ratio_slow_fx[band] = Mpy_32_32(1610612736, hMdDec->spar_md.en_ratio_slow_fx[band]) + Mpy_32_32(536870912, en_ratio_fx); + //hMdDec->spar_md.ref_pow_slow[band] = 0.75f * hMdDec->spar_md.ref_pow_slow[band] + 0.25f * res_pow; + hMdDec->spar_md.ref_pow_slow_fx[band] = Mpy_32_32(1610612736, hMdDec->spar_md.ref_pow_slow_fx[band]) + Mpy_32_32(536870912, res_pow_fx); + //en_ratio = sqrtf( hMdDec->spar_md.en_ratio_slow[band] ) / ( hMdDec->spar_md.ref_pow_slow[band] + EPSILON ); + en_ratio_q = 31 - 13; + en_ratio_fx = Sqrt32(hMdDec->spar_md.en_ratio_slow_fx[band], &en_ratio_q); + if (en_ratio_q < 0) + { + en_ratio_fx = L_shr(en_ratio_fx, -1 * (en_ratio_q)); + en_ratio_q = 0; + } + Word32 en_ratio_fx_scaled = L_shr(en_ratio_fx, (31 - en_ratio_q - 13)); + if (en_ratio_fx_scaled > hMdDec->spar_md.ref_pow_slow_fx[band]) + { + diffuseness_fx[band] = 0; + } + else if(en_ratio_fx_scaled == 0) + { + diffuseness_fx[band] = ONE_IN_Q30; + } + else if (en_ratio_fx_scaled == hMdDec->spar_md.ref_pow_slow_fx[band]) + { + diffuseness_fx[band] = ONE_IN_Q30; + } + else + { + en_ratio_fx = divide3232(en_ratio_fx_scaled, (hMdDec->spar_md.ref_pow_slow_fx[band] + EPSILON_FX)); + en_ratio_fx = L_shl(en_ratio_fx, 15); + diffuseness_fx[band] = ONE_IN_Q30 - en_ratio_fx; + } - w_en_norm = (1.0f - (f_scale * g_pred * g_pred)); - w_en_norm *= w_en_norm; - - Pd[0] = hMdDec->spar_md.band_coeffs[band].P_re[1]; - Pd[1] = hMdDec->spar_md.band_coeffs[band].P_re[0]; - Pd[2] = hMdDec->spar_md.band_coeffs[band].P_re[2]; - en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; - res_pow = w_en_norm + en_ratio + (Pd[0] * Pd[0] + Pd[1] * Pd[1] + Pd[2] * Pd[2]); - res_pow *= 0.5f; - hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; - hMdDec->spar_md.ref_pow_slow[band] = 0.75f * hMdDec->spar_md.ref_pow_slow[band] + 0.25f * res_pow; - en_ratio = sqrtf(hMdDec->spar_md.en_ratio_slow[band]) / (hMdDec->spar_md.ref_pow_slow[band] + EPSILON); } else { - en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; - hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; - en_ratio = sqrtf(hMdDec->spar_md.en_ratio_slow[band]); + //en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; + en_ratio_fx = Mpy_32_32(PR_fx[0] , PR_fx[0]) + Mpy_32_32(PR_fx[1] , PR_fx[1])+ Mpy_32_32(PR_fx[2] , PR_fx[2]); + //hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; + hMdDec->spar_md.en_ratio_slow_fx[band] = Mpy_32_32(1610612736, hMdDec->spar_md.en_ratio_slow_fx[band]) + Mpy_32_32(536870912, en_ratio_fx); + //en_ratio = sqrtf( hMdDec->spar_md.en_ratio_slow[band] ); + en_ratio_q = 31 - 13; + en_ratio_fx = Sqrt32( hMdDec->spar_md.en_ratio_slow_fx[band], &en_ratio_q); + if (en_ratio_q < 0) + { + en_ratio_fx = L_shr(en_ratio_fx, -1 * (en_ratio_q)); + en_ratio_q = 0; } - diffuseness[band] = 1.0f - en_ratio; /*compute diffuseness*/ - diffuseness[band] = ((diffuseness[band] < 1.0f) ? ((diffuseness[band] < 0.0f) ? 0.f : diffuseness[band]) : 1.0f); + Word32 en_ratio_fx_scaled = L_shr(en_ratio_fx, 1); + if (en_ratio_fx_scaled > ONE_IN_Q30) + { + diffuseness_fx[band] = 0; + } + else + { + diffuseness_fx[band] = ONE_IN_Q30 - en_ratio_fx_scaled; + } + + } + //diffuseness[band] = 1.0f - en_ratio; /*compute diffuseness*/ + // diffuseness[band] = ( ( diffuseness[band] < 1.0f ) ? ( ( diffuseness[band] < 0.0f ) ? 0.f : diffuseness[band] ) : 1.0f ); + //diffuseness[band] = (float)diffuseness_fx[band] / (1 << 30); } for (band = start_band; band < end_band; band++) @@ -4312,8 +5053,14 @@ void ivas_spar_to_dirac( int16_t azi_dith, ele_dith; tmp_write_idx_param_band = hDirAC->spar_to_dirac_write_idx; - en_ratio = 1.0f - diffuseness[band]; - masa_sq(1.0f - en_ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS); + //en_ratio = 1.0f - diffuseness[band]; + en_ratio_fx = ONE_IN_Q30 - diffuseness_fx[band]; + //en_ratio = (float)en_ratio_fx / (1 << 30); + //cam delete the below function call + //masa_sq( 1.0f - en_ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); +//#ifdef IVAS_FLOAT_FIXED + masa_sq_fx(ONE_IN_Q30 - en_ratio_fx, diffuseness_thresholds_fx, DIRAC_DIFFUSE_LEVELS ); +//#endif qmf_band_start = band_grouping[band]; qmf_band_end = band_grouping[band + 1]; @@ -4330,14 +5077,19 @@ void ivas_spar_to_dirac( azi_dith = azi[band]; ele_dith = ele[band]; - hSpatParamRendCom->energy_ratio1[block][b] = en_ratio; + hSpatParamRendCom->energy_ratio1[block][b] = en_ratio_fx / ((float)ONE_IN_Q30); + + hSpatParamRendCom->energy_ratio1_fx[block][b] = en_ratio_fx; tmp_write_idx_band = tmp_write_idx_param_band; if (hDirAC->hConfig->dec_param_estim == FALSE) { hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; - hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness_fx[band] / ((float)ONE_IN_Q30); + + hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; + } else { @@ -4345,7 +5097,9 @@ void ivas_spar_to_dirac( { hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; - hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness_fx[band] / ((float)ONE_IN_Q30); + + hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; tmp_write_idx_band = (tmp_write_idx_band + 1) % hSpatParamRendCom->dirac_md_buffer_length; } } @@ -4384,36 +5138,56 @@ void ivas_spar_to_dirac( for (block = 0; block < num_subframes; block++) { - if (st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block] < 0.f) - { - st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block] += 360.f; - } - azi_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block]; - ele_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].elevation[block]; - } - - diffuseness[band] = 1.0f - st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio[0]; + //if ( st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block] < 0.f ) + //{ + // st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block] += 360.f; + //} + if ( st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth_fx[block] < 0 ) + { + st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth_fx[block] = + L_add(L_shl(360, 22), st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth_fx[block]); + } + //azi_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block]; + //ele_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].elevation[block]; +//#ifdef IVAS_FLOAT_FIXED + azi_dirac_fx[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth_fx[block]; + ele_dirac_fx[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].elevation_fx[block]; +//#endif + } + + //diffuseness[band] = 1.0f - st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio[0]; +//#ifdef IVAS_FLOAT_FIXED + diffuseness_fx[band] = ONE_IN_Q30 - st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio_fx[0]; +//#endif } /* DirAC MD averaged over 4 subframes and converted to SPAR format similar to encoder processing */ if (hMdDec->spar_md_cfg.nchan_transport > 1) { +#ifdef IVAS_FLOAT_FIXED + ivas_get_spar_md_from_dirac_fx( azi_dirac_fx, ele_dirac_fx, diffuseness_fx, 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, dyn_active_w_flag ); +#else 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, dyn_active_w_flag); +#endif /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ for (pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++) { for (band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++) { - pred_re_20ms[band][pred_idx] = hMdDec->spar_md.band_coeffs[band].pred_re[pred_idx]; + //pred_re_20ms[band][pred_idx] = hMdDec->spar_md.band_coeffs[band].pred_re[pred_idx]; + pred_re_20ms_fx[band][pred_idx] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[pred_idx]; } } } int16_t num_md_sub_frames; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes(sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate); - ivas_get_spar_md_from_dirac(azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, 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, dyn_active_w_flag); - +//#ifdef IVAS_FLOAT_FIXED + ivas_get_spar_md_from_dirac_fx( azi_dirac_fx, ele_dirac_fx, diffuseness_fx, num_md_sub_frames, 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, dyn_active_w_flag ); +//#else +// ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, 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, dyn_active_w_flag ); +//#endif if (st_ivas->hQMetaData->useLowerRes && dtx_vad) { for (band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++) @@ -4422,11 +5196,13 @@ void ivas_spar_to_dirac( { 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]; + //hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[i] = hMdDec->spar_md.band_coeffs[band].pred_re[i]; + hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re_fx[i] = hMdDec->spar_md.band_coeffs[band].pred_re_fx[i]; } 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]; + //hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].P_re[i] = hMdDec->spar_md.band_coeffs[band].P_re[i]; + hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].P_re_fx[i] = hMdDec->spar_md.band_coeffs[band].P_re_fx[i]; } } } @@ -4442,7 +5218,8 @@ void ivas_spar_to_dirac( if (ivas_is_res_channel(pred_idx + 1, hMdDec->spar_md_cfg.nchan_transport)) { /* use 20ms coefficients only for residual channels */ - hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[pred_idx] = pred_re_20ms[band][pred_idx]; + //hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[pred_idx] = pred_re_20ms[band][pred_idx]; + hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re_fx[pred_idx] = pred_re_20ms_fx[band][pred_idx]; } } } @@ -4455,5 +5232,5 @@ void ivas_spar_to_dirac( return; } +#endif -#endif \ No newline at end of file diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 7685ba8a2..589f269d1 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -930,9 +930,10 @@ typedef struct ivas_mc_paramupmix_dec_data_structure /* SPAR MD structure */ typedef struct ivas_spar_dec_matrices_t { +#ifndef IVAS_FLOAT_FIXED float ***C_re; float ***P_re; -#ifdef IVAS_FLOAT_FIXED +#else Word32 ***C_re_fx; Word32 ***P_re_fx; #endif // DEBUG @@ -953,8 +954,10 @@ typedef struct ivas_spar_md_dec_state_t int16_t num_decorr; int16_t td_decorr_flag; int16_t spar_plc_enable_fadeout_flag; +#ifndef IVAS_FLOAT_FIXED float ***mixer_mat; float mixer_mat_prev[MAX_PARAM_SPATIAL_SUBFRAMES + 1][IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; +#endif ivas_spar_md_com_cfg spar_md_cfg; ivas_arith_coeffs_t arith_coeffs; ivas_huff_coeffs_t huff_coeffs; @@ -963,13 +966,16 @@ typedef struct ivas_spar_md_dec_state_t int16_t spar_hoa_md_flag; int16_t spar_hoa_dirac2spar_md_flag; int16_t HOA_md_ind[IVAS_SPAR_MAX_CH]; + float smooth_buf[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; float smooth_fac[IVAS_MAX_NUM_BANDS]; #ifdef IVAS_FLOAT_FIXED Word32 smooth_buf_fx[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; Word16 smooth_fac_fx[IVAS_MAX_NUM_BANDS]; #endif +#ifndef IVAS_FLOAT_FIXED float mixer_mat_prev2[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; +#endif int16_t first_valid_frame; ivas_band_coeffs_t *band_coeffs_prev; int16_t base_band_coeffs_age[IVAS_MAX_NUM_BANDS]; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 5cdfcabad..dda58984b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1318,17 +1318,18 @@ static void ivas_dirac_dec_binaural_internal( } if (st_ivas->hSpar != NULL) { - floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q30, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); - for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) - { - for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) - { - floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - Q30, - st_ivas->hSpar->hMdDec->mix_mat_dim_2); - } - } + //floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q30, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); + //st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; + //for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) + //{ + // for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) + // { + // floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], + // &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], + // Q30, + // st_ivas->hSpar->hMdDec->mix_mat_dim_2); + // } + //} } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1357,17 +1358,18 @@ static void ivas_dirac_dec_binaural_internal( if (st_ivas->hSpar != NULL) { - fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q30, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); - for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) - { - for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) - { - fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - Q30, - st_ivas->hSpar->hMdDec->mix_mat_dim_2); - } - } + //fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q30, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); + //st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; + //for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) + //{ + // for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) + // { + // fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], + // &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], + // Q30, + // st_ivas->hSpar->hMdDec->mix_mat_dim_2); + // } + //} } FOR(Word16 cha = 0; cha < 6; cha++) FOR(slot = 0; slot < 4; slot++) diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 34b325877..5d7adc221 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -42,7 +42,6 @@ #include #include "wmc_auto.h" - /*-------------------------------------------------------------------* * ivas_sba_prototype_renderer() * @@ -408,4 +407,4 @@ void ivas_sba_prototype_renderer( return; } -#endif \ No newline at end of file +#endif -- GitLab From d54739f5163454c8e10a5a834355533b485586a0 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 29 Apr 2024 19:43:26 +0530 Subject: [PATCH 007/101] Restore float funcs, dirac dec and stat_dec struct cleanup --- lib_dec/acelp_core_dec.c | 4 +- lib_dec/ivas_binRenderer_internal.c | 2 +- lib_dec/ivas_core_dec.c | 15 +- lib_dec/ivas_corecoder_dec_reconfig.c | 4 +- lib_dec/ivas_cpe_dec_fx.c | 102 +--- lib_dec/ivas_dirac_dec.c | 650 +++++++++++++------------ lib_dec/ivas_init_dec.c | 28 +- lib_dec/ivas_ism_dec.c | 14 +- lib_dec/ivas_jbm_dec.c | 145 +----- lib_dec/ivas_mct_dec.c | 8 +- lib_dec/ivas_omasa_dec.c | 16 +- lib_dec/ivas_pca_dec.c | 3 +- lib_dec/ivas_sba_dec.c | 14 +- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 1 + lib_dec/ivas_sba_rendering_internal.c | 7 +- lib_dec/ivas_spar_decoder.c | 2 +- lib_dec/ivas_stat_dec.h | 18 +- lib_dec/ivas_stereo_dft_dec.c | 309 +++++++++++- lib_dec/ivas_stereo_dft_dec_fx.c | 21 +- lib_dec/ivas_stereo_icbwe_dec.c | 7 +- 20 files changed, 721 insertions(+), 649 deletions(-) diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 9146adea3..325bfc5b5 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -612,11 +612,11 @@ ivas_error acelp_core_dec( nb_bits = -1; } - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME ) { - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); } } diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index f5c63a08e..cd17505e1 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -2459,7 +2459,7 @@ void ivas_binRenderer_fx( /* memory reset for the binaural output */ FOR(chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++) { - FOR(k = 0; k < numTimeSlots; k++) + FOR(k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++) { set32_fx(Cldfb_RealBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); set32_fx(Cldfb_ImagBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 0ad040129..fd93643d2 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1162,7 +1162,7 @@ ivas_error ivas_core_dec( if ( hCPE->hStereoDft != NULL ) { - floatToFixed_arrL( hCPE->hStereoDft->hb_stefi_sig, hCPE->hStereoDft->hb_stefi_sig_fx, q, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); + //floatToFixed_arrL( hCPE->hStereoDft->hb_stefi_sig, hCPE->hStereoDft->hb_stefi_sig_fx, q, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); hCPE->hStereoDft->td_gain_fx[0] = 1; } Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); @@ -1171,19 +1171,6 @@ ivas_error ivas_core_dec( Scale_sig32(hb_synth_32_fx[0], L_FRAME48k, sub(Q11 , q)); Scale_sig32(hb_synth_32_fx[1], L_FRAME48k, sub(Q11 , q)); - if ( hCPE->hStereoDft != NULL ) - { - - fixedToFloat_arrL( hCPE->hStereoDft->hb_stefi_sig_fx, hCPE->hStereoDft->hb_stefi_sig, 16, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); - hCPE->hStereoDft->hb_nrg_subr[0] = (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] / ( 1u << hCPE->hStereoDft->Q_nrg_subr ); - hCPE->hStereoDft->hb_nrg_subr[1] = (float) hCPE->hStereoDft->hb_nrg_subr_fx[1] / ( 1u << hCPE->hStereoDft->Q_nrg_subr ); - hCPE->hStereoDft->hb_nrg[0] = (float) hCPE->hStereoDft->hb_nrg_fx[0] / ( 1u << ( hCPE->hStereoDft->Q_nrg_subr + 9 ) ); - - if ( hCPE->hStereoDft->td_gain_fx[0] == 0 ) - { - hCPE->hStereoDft->td_gain[0] = 0; - } - } } IF( EQ_16( st->element_mode, EVS_MONO ) ) diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 67f65d1af..bae8ece3c 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -864,7 +864,7 @@ ivas_error ivas_hp20_dec_reconfig_fx( return error; } -#endif +#else 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 */ @@ -941,7 +941,7 @@ ivas_error ivas_hp20_dec_reconfig( return error; } - +#endif /*-------------------------------------------------------------------* * ivas_cldfb_dec_reconfig() diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index d6b5c3d6d..373b15f1a 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -704,60 +704,13 @@ ivas_error ivas_cpe_dec_fx( scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] ) - { - l_hb_nrg_subr = hCPE->hStereoDft->hb_nrg_subr[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg_subr = 0; - if ( l_hb_nrg_subr > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg_subr / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg_subr = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg_subr[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - - - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - if ( l_hb_nrg < hCPE->hStereoDft->hb_nrg[ii] ) - { - l_hb_nrg = hCPE->hStereoDft->hb_nrg[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg = 0; - if ( l_hb_nrg > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } - floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); #endif stereo_dft_unify_dmx_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng->prev_sid_nodata ); #if 1 scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) ); hCPE->hStereoDft->q_res_cod_mem_fx = Q16; - - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr[0] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q15, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); #endif } ELSE @@ -777,60 +730,13 @@ ivas_error ivas_cpe_dec_fx( scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; - - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] ) - { - l_hb_nrg_subr = hCPE->hStereoDft->hb_nrg_subr[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg_subr = 0; - if ( l_hb_nrg_subr > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg_subr / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg_subr = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg_subr[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - - - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - if ( l_hb_nrg < hCPE->hStereoDft->hb_nrg[ii] ) - { - l_hb_nrg = hCPE->hStereoDft->hb_nrg[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg = 0; - if ( l_hb_nrg > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } - floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } #endif stereo_dft_dec_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); #if 1 { - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr[0] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[0] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q15, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) ); hCPE->hStereoDft->q_res_cod_mem_fx = Q16; @@ -901,8 +807,8 @@ ivas_error ivas_cpe_dec_fx( // Delete below IF( hCPE->hStereoDft != NULL ) { - Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); - floatToFixed_arrL( hCPE->hStereoDft->td_gain, hCPE->hStereoDft->td_gain_fx, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this. + //Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); + //floatToFixed_arrL( hCPE->hStereoDft->td_gain, hCPE->hStereoDft->td_gain_fx, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this. } //////Till here @@ -965,8 +871,8 @@ ivas_error ivas_cpe_dec_fx( // delete below IF( hCPE->hStereoDft != NULL ) { - Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); - fixedToFloat_arrL( hCPE->hStereoDft->td_gain_fx, hCPE->hStereoDft->td_gain, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this. + //Word16 q_td_gain = Q_factor_arr( hCPE->hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); + //fixedToFloat_arrL( hCPE->hStereoDft->td_gain_fx, hCPE->hStereoDft->td_gain, q_td_gain, STEREO_DFT_CORE_HIST_MAX ); // Checking this. } /*----------------------------------------------------------------* diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 23ad8c10c..0a00321e0 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3622,6 +3622,8 @@ void ivas_dirac_dec_render_sf_fx( Word32 pppQMfFrame_ts_im_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; set_zero_fx(surCohRatio_fx, CLDFB_NO_CHANNELS_MAX); Word16 q_cldfb, q_temp_cldfb = 0; //Word32 proto_frame_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; @@ -5304,39 +5306,63 @@ void ivas_dirac_dec_render_sf_fx( index_slot = slot_idx_start_cldfb_synth; #ifdef IVAS_FLOAT_FIXED - Word16 cldfb_re_q = Q6; // Q_factor_arrL((float *)Cldfb_RealBuffer, MAX_OUTPUT_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX); - Word16 cldfb_im_q = Q6; // Q_factor_arrL((float *)Cldfb_ImagBuffer, MAX_OUTPUT_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX); + //////////////////////////////////////////////// FLOAT TO FIXED ///////////////////////////////////////////// for (int idx1 = 0; idx1 < MAX_OUTPUT_CHANNELS; idx1++) { for (int idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++) { for (int idx3 = 0; idx3 < CLDFB_NO_CHANNELS_MAX; idx3++) { - Cldfb_RealBuffer_fx[idx1][idx2][idx3] = floatToFixed(Cldfb_RealBuffer[idx1][idx2][idx3], cldfb_re_q); - Cldfb_ImagBuffer_fx[idx1][idx2][idx3] = floatToFixed(Cldfb_ImagBuffer[idx1][idx2][idx3], cldfb_im_q); + Cldfb_RealBuffer_fx[idx1][idx2][idx3] = floatToFixed(Cldfb_RealBuffer[idx1][idx2][idx3], Q6); + Cldfb_ImagBuffer_fx[idx1][idx2][idx3] = floatToFixed(Cldfb_ImagBuffer[idx1][idx2][idx3], Q6); } } } -#endif - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + Word32 output_buf_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { -#ifdef IVAS_FLOAT_FIXED // Float to fixed - Word32 output_buf_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; for (i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) { floatToFixed_arrL(output_f[i], output_buf_fx[i], Q11, L_FRAME48k); } + } + else if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) + { + /* output_f not being used here. */ + } + else + { + Word16 outchannels = add(hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe); + + IF(hDirACRend->hOutSetup.separateChannelEnabled && (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || + (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found))) + { + outchannels = add(outchannels, 1); + } + + for (i = 0; i < outchannels; i++) + { + floatToFixed_arrL(output_f[i], output_buf_fx[i], Q11, L_FRAME48k); + } + } + ////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endif #ifdef IVAS_FLOAT_FIXED + IF( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { /* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */ - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + IF ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - int16_t in_ch; - for ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) + Word16 in_ch; + FOR ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) { Word16 j, k, j2, l; Word16 num_objects, nchan_out_woLFE, lfe_index; @@ -5427,124 +5453,33 @@ void ivas_dirac_dec_render_sf_fx( } } } -#else - /* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */ - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - int16_t in_ch; - for ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) - { - int16_t j, k, j2, l; - int16_t num_objects, nchan_out_woLFE, lfe_index; - int16_t az1, el1; - int16_t n_slots_to_render; - int16_t n_samples_to_render; - int16_t interp_offset; - - float gain, prev_gain; - - num_objects = st_ivas->nchan_ism; - nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; - n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; - n_samples_to_render = hSpatParamRendCom->num_freq_bands * n_slots_to_render; - interp_offset = st_ivas->hTcBuffer->n_samples_rendered; - - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) - { - ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx ); - - interp_offset = 0; - } - for ( i = 0; i < num_objects; i++ ) - { - /* Combined rotation: rotate the object positions depending the head and external orientations */ - if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) - { - rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &az1, &el1, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup ); - if ( st_ivas->hEFAPdata != NULL ) - { - efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], az1, el1, EFAP_MODE_EFAP ); - } - } - - lfe_index = 0; - for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ ) - { - if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[lfe_index] == j ) ) - { - ( lfe_index < ( st_ivas->hIntSetup.num_lfe - 1 ) ) ? ( lfe_index++, j2++ ) : j2++; - } - gain = st_ivas->hIsmRendererData->gains[i][j]; - prev_gain = st_ivas->hIsmRendererData->prev_gains[i][j]; - if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f ) - { - float *tc_re, *tc_im; - - float *w1, w2; - - w1 = &st_ivas->hIsmRendererData->interpolator[interp_offset]; - tc_re = pppQMfFrame_ts_re[nchan_transport + i][0]; - tc_im = pppQMfFrame_ts_im[nchan_transport + i][0]; - for ( k = 0; k < n_slots_to_render; k++ ) - { - float g; - w2 = 1.0f - *w1; - g = ( *w1 * gain + w2 * prev_gain ); - - for ( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ ) - { - Cldfb_RealBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_re++ ); - Cldfb_ImagBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_im++ ); - } - w1 += hSpatParamRendCom->num_freq_bands; - } - } - /* update here only in case of head rotation */ - if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) - { - st_ivas->hIsmRendererData->prev_gains[i][j] = gain; - } - } - } - } - } -#endif /* Perform binaural rendering */ - ivas_binRenderer( st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - hSpatParamRendCom->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + Word16 input_q = Q6; + ivas_binRenderer_fx( st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, + Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q ); -#ifdef IVAS_FLOAT_FIXED - Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; // cldfb_re_bin_q - Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; // cldfb_im_bin_q - - Word16 cldfb_re_bin_q, cldfb_im_bin_q; - cldfb_re_bin_q = Q6;//Q_factor_arrL( (float *)Cldfb_RealBuffer_Binaural, BINAURAL_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX ); - cldfb_im_bin_q = Q6;//Q_factor_arrL( (float *)Cldfb_ImagBuffer_Binaural, BINAURAL_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX ); - for (int idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++) + FOR ( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) { - for (int idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++) + FOR ( Word16 idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ ) { - for (int idx3 = 0; idx3 < CLDFB_NO_CHANNELS_MAX; idx3++) - { - Cldfb_RealBuffer_Binaural_fx[idx1][idx2][idx3] = float_to_fix(Cldfb_RealBuffer_Binaural[idx1][idx2][idx3], cldfb_re_bin_q); - Cldfb_ImagBuffer_Binaural_fx[idx1][idx2][idx3] = float_to_fix(Cldfb_ImagBuffer_Binaural[idx1][idx2][idx3], cldfb_im_bin_q); - - } + Scale_sig32(Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); + Scale_sig32(Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); } } -#endif /* Inverse CLDFB*/ - for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + FOR ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef IVAS_FLOAT_FIXED - Word32 *synth_fx = &output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands]; +#if 1 // TODOD: remove float to fixed st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q_factor_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); floatToFixed_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); +#endif + Word32 *synth_fx = &output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands]; Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -5553,19 +5488,10 @@ void ivas_dirac_dec_render_sf_fx( RealBuffer_fx[i] = Cldfb_RealBuffer_Binaural_fx[ch][i]; ImagBuffer_fx[i] = Cldfb_ImagBuffer_Binaural_fx[ch][i]; } - Word16 common_q = sub( s_min( cldfb_re_bin_q, cldfb_im_bin_q ), 1 ); // 1 guard bit. - FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) - { - scale_sig32( RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sub( common_q, cldfb_re_bin_q ) ); - scale_sig32( ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sub( common_q, cldfb_im_bin_q ) ); - } - cldfb_re_bin_q = common_q; - move16(); - cldfb_im_bin_q = common_q; - move16(); - scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( sub( common_q, 1 ), st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); - st_ivas->cldfbSynDec[ch]->Q_cldfb_state = sub( common_q, 1 ); + scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( Q6 - 1, st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); + st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q6 - 1; + move16(); cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); @@ -5577,67 +5503,31 @@ void ivas_dirac_dec_render_sf_fx( } Word16 synth_len = imult1616( no_col, no_channels ); - scale_sig32( synth_fx, synth_len, sub( Q11, sub( common_q, 1 ) ) ); - for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) - { - scale_sig32(RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sub( Q6, common_q ) ); - scale_sig32(ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sub( Q6, common_q ) ); - } - cldfb_re_bin_q = Q6; - cldfb_im_bin_q = Q6; + scale_sig32( synth_fx, synth_len, Q11 - ( Q6 - 1 ) ); - // Fixed to float +#if 1 // TODOD: remove Fixed to float fixedToFloat_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { fixedToFloat_arrL( Cldfb_RealBuffer_Binaural_fx[ch][i], Cldfb_RealBuffer_Binaural[ch][i], CLDFB_NO_CHANNELS_MAX, Q6 ); fixedToFloat_arrL( Cldfb_ImagBuffer_Binaural_fx[ch][i], Cldfb_ImagBuffer_Binaural[ch][i], CLDFB_NO_CHANNELS_MAX, Q6 ); } -#else - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) - { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; - } - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); #endif } -#ifdef IVAS_FLOAT_FIXED - for (i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) - { - fixedToFloat_arrL(output_buf_fx[i], output_f[i], Q11, index_slot * hSpatParamRendCom->num_freq_bands + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]); - } -#endif } - else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + ELSE IF( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { -#ifdef IVAS_FLOAT_FIXED for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - Copy32( Cldfb_RealBuffer_fx[ch][slot_idx], pppQMfFrame_ts_re_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); - Copy32( Cldfb_ImagBuffer_fx[ch][slot_idx], pppQMfFrame_ts_im_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); - scale_sig32( pppQMfFrame_ts_re_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, cldfb_re_q ) ); - scale_sig32( pppQMfFrame_ts_im_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, cldfb_im_q ) ); + Copy32( Cldfb_RealBuffer_fx[ch][slot_idx], pppQMfFrame_ts_re_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); // Q6 + Copy32( Cldfb_ImagBuffer_fx[ch][slot_idx], pppQMfFrame_ts_im_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); // Q6 } } -#else - for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) - { - for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); - } - } -#endif } - else + ELSE { -#ifdef IVAS_FLOAT_FIXED Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; Word16 outchannels; @@ -5649,7 +5539,7 @@ void ivas_dirac_dec_render_sf_fx( outchannels = add( hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe ); - if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || + IF ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || @@ -5658,39 +5548,9 @@ void ivas_dirac_dec_render_sf_fx( { outchannels = add(outchannels, 1); } -#else - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t outchannels; - - idx_in = 0; - idx_lfe = 0; - - outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; - - if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || - ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) - { - outchannels++; - } -#endif - -#ifdef IVAS_FLOAT_FIXED - // Float to fixed - Word32 output_buf_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - for (i = 0; i < outchannels; i++) - { - floatToFixed_arrL(output_f[i], output_buf_fx[i], Q11, L_FRAME48k); - } -#endif - if ( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { -#ifdef IVAS_FLOAT_FIXED Word32 tmp_separated_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; Word32 tmp_lfe_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; const Word16 subframe_start_sample = imult1616( index_slot, hSpatParamRendCom->num_freq_bands ); @@ -5737,106 +5597,26 @@ void ivas_dirac_dec_render_sf_fx( idx_in = add( idx_in, 1 ); } } -#else - float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - const int16_t subframe_start_sample = index_slot * hSpatParamRendCom->num_freq_bands; - const int16_t num_samples_subframe = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; - - /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ - mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); - mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); - for ( ch = 0; ch < outchannels; ch++ ) - { - if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) - { - /* Move the LFE channel to the correct place */ - mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - - if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) - { - /* Move the separated channel to the correct place. Thus, the separated channel is - * combined with the synthesized channels here when there is a matching channel. */ - mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } - else - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); - - if ( !st_ivas->hLsSetupCustom->separate_ch_found ) - { - /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel - * is combined with the synthesized channels here when there is no matching channel. */ - v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } - - idx_in++; - } - } -#endif } - else + ELSE { -#ifdef IVAS_FLOAT_FIXED FOR ( ch = 0; ch < outchannels; ch++ ) { -#if 1 // Float to fixed - Word16 tmp_idx_in = idx_in; - Word16 tmp_idx_lfe = idx_lfe; - IF((hDirACRend->hOutSetup.num_lfe > 0) && (EQ_16(hDirACRend->hOutSetup.index_lfe[idx_lfe], ch))) + IF ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) { IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) { - // Float to fixed - Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + tmp_idx_lfe; + FOR(i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + { + RealBuffer_fx[i] = Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; + ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; + } + Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe; + +#if 1 // TODO: remove float to fixed code st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); floatToFixed_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); - } - ELSE IF(st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled) - { - /* LFE has been synthesized in the time domain, do nothing. */ - } - ELSE - { - } - IF(LT_16(tmp_idx_lfe, sub(hDirACRend->hOutSetup.num_lfe, 1))) - { - tmp_idx_lfe = add(tmp_idx_lfe, 1); - } - } - ELSE IF((hDirACRend->hOutSetup.separateChannelEnabled) && EQ_16(hDirACRend->hOutSetup.separateChannelIndex, ch)) - { - /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated - * channel is combined with the synthesized channels here. */ - } - ELSE - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); - floatToFixed_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); - } #endif - IF ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) - { - IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) - { - FOR(i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) - { - RealBuffer_fx[i] = Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; - ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; - } - Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe; Word16 samplesToProcess = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; Word32 *p_out = &(output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands]); @@ -5854,6 +5634,9 @@ void ivas_dirac_dec_render_sf_fx( Word16 synth_len = imult1616(no_col, no_channels); scale_sig32(p_out, synth_len, (Q11 - (Q6 - 1))); +#if 1 // TODO: remove fixed to float code + fixedToFloat_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); +#endif } ELSE IF( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) { @@ -5876,6 +5659,11 @@ void ivas_dirac_dec_render_sf_fx( ELSE { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + +#if 1 // TODO: remove float to fixed code + st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); + floatToFixed_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); +#endif Word32 *p_out = &( output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ); Word16 samplesToProcess, out_len; FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) @@ -5906,53 +5694,203 @@ void ivas_dirac_dec_render_sf_fx( // Scaling output from Q6-1 to Q10 scale_sig32(p_out, out_len, (Q10 - (Q6 - 1))); +#if 1 /* TODO: remove fixed to float */ + fixedToFloat_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); +#endif idx_in = add( idx_in, 1 ); } -#if 1 // Fixed to float - IF((hDirACRend->hOutSetup.num_lfe > 0) && (EQ_16(hDirACRend->hOutSetup.index_lfe[idx_lfe], ch))) + } + } + } + + hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); + +#else + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + /* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */ + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + int16_t in_ch; + for ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) + { + int16_t j, k, j2, l; + int16_t num_objects, nchan_out_woLFE, lfe_index; + int16_t az1, el1; + int16_t n_slots_to_render; + int16_t n_samples_to_render; + int16_t interp_offset; + + float gain, prev_gain; + + num_objects = st_ivas->nchan_ism; + nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; + n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; + n_samples_to_render = hSpatParamRendCom->num_freq_bands * n_slots_to_render; + interp_offset = st_ivas->hTcBuffer->n_samples_rendered; + + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) { - IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx ); + + interp_offset = 0; + } + for ( i = 0; i < num_objects; i++ ) + { + /* Combined rotation: rotate the object positions depending the head and external orientations */ + if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) { - Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe; - // Fixed to float - fixedToFloat_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); - for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &az1, &el1, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup ); + if ( st_ivas->hEFAPdata != NULL ) { - fixedToFloat_arrL(Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i], Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i], CLDFB_NO_CHANNELS_MAX, Q6); - fixedToFloat_arrL(Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i], CLDFB_NO_CHANNELS_MAX, Q6); + efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], az1, el1, EFAP_MODE_EFAP ); } - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); } - ELSE IF(st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled) + + lfe_index = 0; + for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ ) { - /* LFE has been synthesized in the time domain, do nothing. */ + if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[lfe_index] == j ) ) + { + ( lfe_index < ( st_ivas->hIntSetup.num_lfe - 1 ) ) ? ( lfe_index++, j2++ ) : j2++; + } + gain = st_ivas->hIsmRendererData->gains[i][j]; + prev_gain = st_ivas->hIsmRendererData->prev_gains[i][j]; + if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f ) + { + float *tc_re, *tc_im; + float *w1, w2; + w1 = &st_ivas->hIsmRendererData->interpolator[interp_offset]; + tc_re = pppQMfFrame_ts_re[nchan_transport + i][0]; + tc_im = pppQMfFrame_ts_im[nchan_transport + i][0]; + for ( k = 0; k < n_slots_to_render; k++ ) + { + float g; + w2 = 1.0f - *w1; + g = ( *w1 * gain + w2 * prev_gain ); + + for ( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ ) + { + Cldfb_RealBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_re++ ); + Cldfb_ImagBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_im++ ); + } + w1 += hSpatParamRendCom->num_freq_bands; + } + } + /* update here only in case of head rotation */ + if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) + { + st_ivas->hIsmRendererData->prev_gains[i][j] = gain; + } } - ELSE + } + } + } + + /* Perform binaural rendering */ + ivas_binRenderer( st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + + /* Inverse CLDFB*/ + for (ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++) + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + { + RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; + } + cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + { + for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); + } + } + } + else + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t outchannels; + + idx_in = 0; + idx_lfe = 0; + + outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; + + if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || + ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + { + outchannels++; + } + + if ( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + const int16_t subframe_start_sample = index_slot * hSpatParamRendCom->num_freq_bands; + const int16_t num_samples_subframe = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; + + /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ + mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); + mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) + { + /* Move the LFE channel to the correct place */ + mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) { - // Float to fixed. - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); + idx_lfe++; } } - ELSE IF((hDirACRend->hOutSetup.separateChannelEnabled) && EQ_16(hDirACRend->hOutSetup.separateChannelIndex, ch)) + else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) { - /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated - * channel is combined with the synthesized channels here. */ + /* Move the separated channel to the correct place. Thus, the separated channel is + * combined with the synthesized channels here when there is a matching channel. */ + mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); } - ELSE + else { - // Fixed to float - fixedToFloat_arrL(st_ivas->cldfbSynDec[tmp_idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[tmp_idx_in]->cldfb_state, st_ivas->cldfbSynDec[tmp_idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[tmp_idx_in]->p_filter_length); - for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + } + cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); + + if ( !st_ivas->hLsSetupCustom->separate_ch_found ) { - fixedToFloat_arrL(Cldfb_RealBuffer_fx[tmp_idx_in][i], Cldfb_RealBuffer[tmp_idx_in][i], CLDFB_NO_CHANNELS_MAX, Q6); - fixedToFloat_arrL(Cldfb_ImagBuffer_fx[tmp_idx_in][i], Cldfb_ImagBuffer[tmp_idx_in][i], CLDFB_NO_CHANNELS_MAX, Q6); + /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel + * is combined with the synthesized channels here when there is no matching channel. */ + v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); } - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q10, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] + index_slot * hSpatParamRendCom->num_freq_bands); - tmp_idx_in++; + + idx_in++; } -#endif } -#else + } + else + { for ( ch = 0; ch < outchannels; ch++ ) { if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) @@ -5996,15 +5934,23 @@ void ivas_dirac_dec_render_sf_fx( idx_in++; } } -#endif } } + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe_idx]; hSpatParamRendCom->subframes_rendered++; +#endif #ifdef IVAS_FLOAT_FIXED - // Fixed to float - if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) + /////////////////////////////////////////////////////// FIXED TO FLOAT ////////////////////////////////////////////////////////////////////////////////////////// + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + { + for (i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) + { + fixedToFloat_arrL(output_buf_fx[i], output_f[i], Q11, index_slot * hSpatParamRendCom->num_freq_bands + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]); + } + } + else if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) { for (ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++) { @@ -6015,6 +5961,64 @@ void ivas_dirac_dec_render_sf_fx( } } } + else + { + Word16 outchannels = add(hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe); + + IF(hDirACRend->hOutSetup.separateChannelEnabled && (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || + hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || + (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found))) + { + outchannels = add(outchannels, 1); + } + if (!hDirACRend->hOutSetup.separateChannelEnabled || hDirACRend->hOutSetup.output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM) + { + Word16 tmp_lfe_idx = 0; + for (ch = 0; ch < outchannels; ch++) + { + //fixedToFloat_arrL(output_buf_fx[i], output_f[i], Q11, index_slot * hSpatParamRendCom->num_freq_bands + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]); + IF((hDirACRend->hOutSetup.num_lfe > 0) && (EQ_16(hDirACRend->hOutSetup.index_lfe[tmp_lfe_idx], ch))) + { + IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + { + // Fixed to float + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); + } + ELSE IF(st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled) + { + /* LFE has been synthesized in the time domain, do nothing. */ + } + ELSE + { + // Float to fixed. + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); + } + IF(LT_16(tmp_lfe_idx, sub(hDirACRend->hOutSetup.num_lfe, 1))) + { + tmp_lfe_idx = add(tmp_lfe_idx, 1); + } + } + ELSE IF((hDirACRend->hOutSetup.separateChannelEnabled) && EQ_16(hDirACRend->hOutSetup.separateChannelIndex, ch)) + { + /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated + * channel is combined with the synthesized channels here. */ + } + ELSE + { + // Fixed to float + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q10, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] + index_slot * hSpatParamRendCom->num_freq_bands); + } + } + } + else + { + /* NOTE: according to line coverage report this part is not being hit by any test case. Not adding fixed to float conversion here. */ + } + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endif pop_wmops(); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 53e5ce546..219d67aa7 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2133,10 +2133,11 @@ ivas_error ivas_init_decoder_fx( IF ( GT_16(n, 0 )) { - IF ( ( st_ivas->mem_hp20_out = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } + //IF ( ( st_ivas->mem_hp20_out = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) + //{ + // return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + //} + IF( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( n * sizeof(Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); @@ -2144,18 +2145,20 @@ ivas_error ivas_init_decoder_fx( } ELSE { - st_ivas->mem_hp20_out = NULL; + //st_ivas->mem_hp20_out = NULL; + st_ivas->mem_hp20_out_fx = NULL; } FOR ( i = 0; i < n; i++ ) { - IF ( ( st_ivas->mem_hp20_out[i] = (float *) malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } + //IF ( ( st_ivas->mem_hp20_out[i] = (float *) 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 ); - set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); IF((st_ivas->mem_hp20_out_fx[i] = (Word32 *)malloc((L_HP20_MEM + 2) * sizeof(Word32))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n")); @@ -3822,7 +3825,7 @@ void ivas_initialize_handles_dec( } st_ivas->bit_stream = NULL; - st_ivas->mem_hp20_out = NULL; + //st_ivas->mem_hp20_out = NULL; #ifdef IVAS_FLOAT_FIXED st_ivas->mem_hp20_out_fx = NULL; #endif // IVAS_FLOAT_FIXED @@ -3957,7 +3960,7 @@ void ivas_destroy_dec( free( st_ivas->mem_hp20_out_fx ); st_ivas->mem_hp20_out_fx = NULL; } -#endif +#else IF(st_ivas->mem_hp20_out != NULL) { FOR(i = 0; i < getNumChanSynthesis(st_ivas); i++) @@ -3968,6 +3971,7 @@ void ivas_destroy_dec( free(st_ivas->mem_hp20_out); st_ivas->mem_hp20_out = NULL; } +#endif /* ISM metadata handles */ ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 399e6508d..60f88277f 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -109,12 +109,6 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( { return error; } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; @@ -440,10 +434,10 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } - if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) - { - return error; - } + //if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) + //{ + // return error; + //} /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 86b499d06..a21e3c74a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -749,40 +749,7 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] ) - { - l_hb_nrg_subr = hCPE->hStereoDft->hb_nrg_subr[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg_subr = 0; - if ( l_hb_nrg_subr > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg_subr / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg_subr = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg_subr[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - if ( l_hb_nrg < hCPE->hStereoDft->hb_nrg[ii] ) - { - l_hb_nrg = hCPE->hStereoDft->hb_nrg[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg = 0; - if ( l_hb_nrg > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } + IF( hCPE->hStereoCng != NULL ) { floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); @@ -814,9 +781,6 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; - - floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - //floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) @@ -834,14 +798,6 @@ ivas_error ivas_jbm_dec_tc( } fixedToFloat_arrL( &hCPE->prev_synth_fx[0][0], &hCPE->prev_synth[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr[ii] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } IF( hCPE->hStereoCng != NULL ) { fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); @@ -870,8 +826,6 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; - - fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); } st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) @@ -1628,40 +1582,6 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] ) - { - l_hb_nrg_subr = hCPE->hStereoDft->hb_nrg_subr[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg_subr = 0; - if ( l_hb_nrg_subr > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg_subr / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg_subr = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg_subr[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - if ( l_hb_nrg < hCPE->hStereoDft->hb_nrg[ii] ) - { - l_hb_nrg = hCPE->hStereoDft->hb_nrg[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg = 0; - if ( l_hb_nrg > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } IF( hCPE->hStereoCng != NULL ) { @@ -1694,9 +1614,6 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; - - floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - //floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; #if 0 @@ -1723,14 +1640,6 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, negate( s ) ); } fixedToFloat_arrL( &hCPE->prev_synth_fx[0][0], &hCPE->prev_synth[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr[ii] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } IF( hCPE->hStereoCng != NULL ) { fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); @@ -1758,9 +1667,6 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; - - fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - //fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); } st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; FOR (int ii = 0; ii < CPE_CHANNELS; ii++) @@ -2767,41 +2673,6 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - if ( l_hb_nrg_subr < hCPE->hStereoDft->hb_nrg_subr[ii] ) - { - l_hb_nrg_subr = hCPE->hStereoDft->hb_nrg_subr[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg_subr = 0; - if ( l_hb_nrg_subr > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg_subr / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg_subr = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg_subr[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - if ( l_hb_nrg < hCPE->hStereoDft->hb_nrg[ii] ) - { - l_hb_nrg = hCPE->hStereoDft->hb_nrg[ii]; - } - } - hCPE->hStereoDft->q_hb_nrg = 0; - if ( l_hb_nrg > (float) MAX_32 ) - { - int quotient = (int) ceil( l_hb_nrg / (float) MAX_32 ); - hCPE->hStereoDft->q_hb_nrg = Q31 - norm_l( quotient ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_fx[ii] = (Word32) ( hCPE->hStereoDft->hb_nrg[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } - IF( hCPE->hStereoCng != NULL ) { floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); @@ -2834,7 +2705,7 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; - floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); + //floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); } IF( st_ivas->hSpar != NULL ) { @@ -2866,14 +2737,6 @@ ivas_error ivas_jbm_dec_tc( } fixedToFloat_arrL( &hCPE->prev_synth_fx[0][0], &hCPE->prev_synth[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_subr_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_subr_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg_subr[ii] = ( (float) hCPE->hStereoDft->hb_nrg_subr_fx[ii] / ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg_subr ) ) ); - } - for ( int ii = 0; ii < sizeof( hCPE->hStereoDft->hb_nrg_fx ) / sizeof( hCPE->hStereoDft->hb_nrg_fx[0] ); ii++ ) - { - hCPE->hStereoDft->hb_nrg[ii] = ( (float) hCPE->hStereoDft->hb_nrg_fx[ii] * ( (float) ( 1 << hCPE->hStereoDft->q_hb_nrg ) ) ); - } IF( hCPE->hStereoCng != NULL ) { fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); @@ -2902,7 +2765,7 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; - fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); + //fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); } IF( st_ivas->hSpar != NULL ) { @@ -2910,7 +2773,7 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) { - fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); + //fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); } #if 0 IF( st_ivas->hSpar != NULL ) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 2ed47f58f..3c5cd9a64 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -2180,10 +2180,10 @@ static ivas_error ivas_mc_dec_reconfig( } #endif // IVAS_FLOAT_FIXED /*To be removed later: Contains memory allocations for floating point buffers*/ - if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - { - return error; - } + //if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + //{ + // return error; + //} /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded separately after the allocation of the core coders diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 98af89d37..ba46a5eb7 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -493,10 +493,10 @@ ivas_error ivas_omasa_dec_config_fx( } #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED /* Float code to be removed. */ - IF( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - { - return error; - } + //IF( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + //{ + // return error; + //} #endif /* reconfigure core-coders for ISMs */ @@ -766,11 +766,17 @@ ivas_error ivas_omasa_dec_config( ivas_set_omasa_TC( st_ivas->ism_mode, st_ivas->nchan_ism, &st_ivas->nSCE, &st_ivas->nCPE ); /* re-configure hp20 memories */ +#ifdef IVAS_FLOAT_FIXED + IF ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) { return error; } - +#endif /* reconfigure core-coders for ISMs */ k = 0; while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) diff --git a/lib_dec/ivas_pca_dec.c b/lib_dec/ivas_pca_dec.c index 492cff90d..ffb10f8eb 100644 --- a/lib_dec/ivas_pca_dec.c +++ b/lib_dec/ivas_pca_dec.c @@ -42,7 +42,7 @@ /*-----------------------------------------------------------------------* * Local function definitions *-----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static int32_t ivas_bitstream_read_int32( Decoder_State *st0, const int16_t bits ) @@ -309,3 +309,4 @@ void ivas_pca_dec( return; } +#endif \ No newline at end of file diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index bc9814a9c..3d8c0efb5 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -764,10 +764,10 @@ ivas_error ivas_sba_dec_reconfigure( return error; } #endif // IVAS_FLOAT_FIXED - if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - { - return error; - } + //if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + //{ + // return error; + //} /*-----------------------------------------------------------------* * TD Decorrelator @@ -1267,7 +1267,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); } - ivas_pca_dec_init( hSpar->hPCA ); + //ivas_pca_dec_init( hSpar->hPCA ); #ifdef IVAS_FLOAT_FIXED ivas_pca_dec_init_fx(hSpar->hPCA); #endif @@ -1535,12 +1535,12 @@ ivas_error ivas_sba_dec_reconfigure_fx( { return error; } -#endif // IVAS_FLOAT_FIXED +#else if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) { return error; } - +#endif /*-----------------------------------------------------------------* * TD Decorrelator *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index b6929edf8..1aadd2881 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -731,6 +731,7 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( } hStereoDft->hb_nrg_subr_fx[0] = hb_nrg2; + hStereoDft->q_hb_nrg_subr = sub(shl(q_hb_synth, 1), 31); move32(); hb_nrg = L_add(hb_nrg, hb_nrg2); hb_nrg2 = EPSILON_FIX; diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 7ef0a5f8b..97adb9a73 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -653,7 +653,7 @@ void ivas_ism2sba_sf_fx( return; } #else // IVAS_FLOAT_FIXED - + void ivas_ism2sba_sf( float *buffer_in[], /* i : TC buffer */ float *buffer_out[], /* o : TD signal buffers */ @@ -686,13 +686,8 @@ void ivas_ism2sba_sf( g2 = hIsmRendererData->interpolator + offset; tc = buffer_in[i] + offset; out = buffer_tmp[j]; -#ifdef IVAS_FLOAT_FIXED - gain = fix_to_float(hIsmRendererData->gains_fx[i][j], Q30); - prev_gain = fix_to_float(hIsmRendererData->prev_gains_fx[i][j], Q30); -#else gain = hIsmRendererData->gains[i][j]; prev_gain = hIsmRendererData->prev_gains[i][j]; -#endif for ( k = 0; k < n_samples_to_render; k++ ) { g1 = 1.0f - *g2; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index af6840a9f..5f23d5dc7 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -381,7 +381,7 @@ ivas_error ivas_spar_dec_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); } - ivas_pca_dec_init( hSpar->hPCA ); + //ivas_pca_dec_init( hSpar->hPCA ); #ifdef IVAS_FLOAT_FIXED ivas_pca_dec_init_fx(hSpar->hPCA); #endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 589f269d1..adf8e5727 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -297,11 +297,19 @@ typedef struct stereo_dft_dec_data_struct float smooth_res_nrg[STEREO_DFT_BAND_MAX]; #endif int16_t core_hist[STEREO_DFT_CORE_HIST_MAX]; +#ifndef IVAS_FLOAT_FIXED float hb_stefi_sig[L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS )]; +#endif int16_t hb_stefi_delay; +#ifndef IVAS_FLOAT_FIXED float hb_nrg[STEREO_DFT_CORE_HIST_MAX]; +#endif +#ifndef IVAS_FLOAT_FIXED float hb_nrg_subr[STEREO_DFT_NBDIV]; +#endif +#ifndef IVAS_FLOAT_FIXED float td_gain[STEREO_DFT_CORE_HIST_MAX]; +#endif #ifdef IVAS_FLOAT_FIXED Word32 smooth_dmx_nrg_fx[STEREO_DFT_BAND_MAX]; /* Q(q_smoothed_nrg) */ Word32 smooth_res_nrg_fx[STEREO_DFT_BAND_MAX]; /* Q(q_smoothed_nrg) */ @@ -756,6 +764,7 @@ typedef struct ivas_dirac_dec_data_structure typedef struct dirac_output_synthesis_cov_state_structure { /* only pointer to local buffers */ +#ifndef IVAS_FLOAT_FIXED float *direct_power_factor; float *diffuse_power_factor; @@ -769,7 +778,7 @@ typedef struct dirac_output_synthesis_cov_state_structure float *proto_diffuse_buffer_f; /* Buffer for diffuse sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ float *proto_power; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ float *proto_power_diff; - +#endif float *cx_old[CLDFB_NO_CHANNELS_MAX]; float *cy_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_old[CLDFB_NO_CHANNELS_MAX]; @@ -1015,10 +1024,14 @@ typedef struct ivas_agc_dec_state_t /* PCA structure */ typedef struct { +#ifndef IVAS_FLOAT_FIXED float prev_ql[IVAS_PCA_INTERP]; float prev_qr[IVAS_PCA_INTERP]; +#endif int16_t prev_pca_bypass; +#ifndef IVAS_FLOAT_FIXED float mem_eigVec_interp[IVAS_PCA_LEN_INTERP_EIG_DEC]; +#endif /* parser output: */ int16_t pca_bypass; int32_t index[2]; @@ -1495,8 +1508,9 @@ typedef struct Decoder_Struct uint16_t *bit_stream; /* Pointer to bitstream buffer */ int16_t writeFECoffset; /* parameter for debugging JBM stuff */ - +#ifndef IVAS_FLOAT_FIXED float **mem_hp20_out; /* output signals HP filter memories */ +#endif IVAS_LIMITER_HANDLE hLimiter; /* Limiter handle */ float *p_output_f[MAX_OUTPUT_CHANNELS+MAX_NUM_OBJECTS]; /* floating-point output audio buffers */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 7ac9987ad..e57859e02 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -707,9 +707,9 @@ void stereo_dft_dec_reset( set_s( hStereoDft->core_hist, ACELP_CORE, STEREO_DFT_CORE_HIST_MAX ); - set_zero( hStereoDft->hb_stefi_sig, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); - set_zero( hStereoDft->hb_nrg, STEREO_DFT_CORE_HIST_MAX ); - set_zero( hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); + //set_zero( hStereoDft->hb_stefi_sig, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); + //set_zero( hStereoDft->hb_nrg, STEREO_DFT_CORE_HIST_MAX ); + //set_zero( hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); #ifdef IVAS_FLOAT_FIXED set32_fx(hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA(48000, STEREO_DFT_TD_STEFI_DELAY_NS)); @@ -1070,9 +1070,9 @@ void stereo_dft_dec_update( hStereoDft->core_hist[i] = hStereoDft->core_hist[i - 1]; } - mvr2r( hStereoDft->hb_stefi_sig + output_frame, hStereoDft->hb_stefi_sig, hStereoDft->hb_stefi_delay ); - mvr2r( hStereoDft->hb_nrg, hStereoDft->hb_nrg + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); - mvr2r( hStereoDft->td_gain, hStereoDft->td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); + //mvr2r( hStereoDft->hb_stefi_sig + output_frame, hStereoDft->hb_stefi_sig, hStereoDft->hb_stefi_delay ); + //mvr2r( hStereoDft->hb_nrg, hStereoDft->hb_nrg + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); + //mvr2r( hStereoDft->td_gain, hStereoDft->td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); #ifndef IVAS_FLOAT_FIXED if ( sba_dirac_stereo_flag ) @@ -3517,7 +3517,302 @@ void stereo_dft_generate_res_pred( * * * ---------------------------------------------------------------*/ +#if 1 +void stereo_dft_dec_smooth_parameters( + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + const int16_t prev_sid_nodata, /* i : Previous SID/No data indicator */ + const int16_t active_frame_counter, /* i : Active frame counter */ + const int32_t element_brate /* i : Element bitrate */ +) +{ + int16_t k_offset, k, k2, b, N_div; + float *pIpd, *pInterpol; + float *pgIpd; + float *pSideGain; + float diff_ipd; + int16_t nbands; + int16_t max_res_pred_ind; + + N_div = STEREO_DFT_NBDIV; + k_offset = STEREO_DFT_OFFSET; + + if ( hStereoDft->frame_sid_nodata || prev_sid_nodata ) + { + k = 1; + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + *( hStereoDft->side_gain + ( ( k + k_offset ) - 1 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b ); + } + + if ( hStereoDft->frame_sid_nodata ) + { + /* set new xfade target if new itd received */ + if ( hStereoDft->gipd[k + k_offset] != hStereoDft->ipd_xfade_target ) + { + if ( ( hStereoDft->gipd[k + k_offset] - hStereoDft->ipd_xfade_prev ) > EVS_PI ) + { + hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset] - 2 * EVS_PI; + hStereoDft->ipd_xfade_step = ( hStereoDft->ipd_xfade_target - hStereoDft->ipd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->ipd_xfade_counter ); + } + else if ( ( hStereoDft->ipd_xfade_prev - hStereoDft->gipd[k + k_offset] ) > EVS_PI ) + { + hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset] + 2 * EVS_PI; + hStereoDft->ipd_xfade_step = ( hStereoDft->ipd_xfade_target - hStereoDft->ipd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->ipd_xfade_counter ); + } + else + { + hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset]; + hStereoDft->ipd_xfade_step = ( hStereoDft->ipd_xfade_target - hStereoDft->ipd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->ipd_xfade_counter ); + } + } + + /* xfade */ + if ( hStereoDft->ipd_xfade_prev != hStereoDft->ipd_xfade_target && hStereoDft->ipd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE && hStereoDft->last_active_element_brate <= 24400 ) + { + hStereoDft->gipd[k + k_offset] = hStereoDft->ipd_xfade_prev + hStereoDft->ipd_xfade_step; + hStereoDft->ipd_xfade_prev = hStereoDft->gipd[k + k_offset]; + hStereoDft->ipd_xfade_counter++; + } + } + else + { + /* First active frame, "reset" everything if long enough active encoding, only triggered if STEREO_DFT_ITD_CNG_XFADE_RESET = -1 */ + if ( active_frame_counter > STEREO_DFT_ITD_CNG_XFADE_RESET ) + { + hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset]; + hStereoDft->ipd_xfade_prev = hStereoDft->gipd[k + k_offset]; + hStereoDft->ipd_xfade_counter = 0; + } + } + + for ( k2 = 1; k2 < hStereoDft->prm_res[k + k_offset]; k2++ ) + { + hStereoDft->gipd[( k + k_offset ) - k2] = hStereoDft->gipd[k + k_offset]; + } + + if ( hStereoDft->frame_sid_nodata ) + { + /* set new xfade target if new itd received */ + if ( hStereoDft->itd[k + k_offset] != hStereoDft->itd_xfade_target ) + { + hStereoDft->itd_xfade_target = hStereoDft->itd[k + k_offset]; + hStereoDft->itd_xfade_step = ( hStereoDft->itd_xfade_target - hStereoDft->itd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->itd_xfade_counter ); + } + + /* xfade */ + if ( hStereoDft->itd_xfade_prev != hStereoDft->itd_xfade_target && hStereoDft->itd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE && hStereoDft->last_active_element_brate <= 24400 ) + { + hStereoDft->itd[k + k_offset] = hStereoDft->itd_xfade_prev + hStereoDft->itd_xfade_step; + hStereoDft->itd_xfade_prev = hStereoDft->itd[k + k_offset]; + hStereoDft->itd_xfade_counter++; + } + } + else + { + /* First active frame, "reset" everything if long enough active encoding, only triggered if STEREO_DFT_ITD_CNG_XFADE_RESET = -1 */ + if ( active_frame_counter > STEREO_DFT_ITD_CNG_XFADE_RESET ) + { + hStereoDft->itd_xfade_target = hStereoDft->itd[k + k_offset]; + hStereoDft->itd_xfade_prev = hStereoDft->itd[k + k_offset]; + hStereoDft->itd_xfade_counter = 0; + } + hStereoDft->last_active_element_brate = element_brate; + } + for ( k2 = 1; k2 < hStereoDft->prm_res[k + k_offset]; k2++ ) + { + hStereoDft->itd[( k + k_offset ) - k2] = hStereoDft->itd[k + k_offset]; + } + + return; + } + + /* Active frame, "reset" everything "reset" everything if long enough active encoding */ + if ( active_frame_counter > STEREO_DFT_ITD_CNG_XFADE_RESET ) + { + hStereoDft->itd_xfade_counter = 0; + hStereoDft->itd_xfade_target = hStereoDft->itd[STEREO_DFT_NBDIV - 1]; + hStereoDft->itd_xfade_prev = hStereoDft->itd[STEREO_DFT_NBDIV - 1]; + hStereoDft->ipd_xfade_counter = 0; + hStereoDft->ipd_xfade_target = hStereoDft->gipd[STEREO_DFT_NBDIV - 1]; + hStereoDft->ipd_xfade_prev = hStereoDft->gipd[STEREO_DFT_NBDIV - 1]; + } + + hStereoDft->last_active_element_brate = element_brate; + + for ( k = hStereoDft->prm_res[k_offset] - 1; k < N_div; k += hStereoDft->prm_res[k + k_offset] ) + { + max_res_pred_ind = 0; + + if ( hStereoDft->reverb_flag == 1 ) + { + nbands = min( 10, hStereoDft->nbands_respred ); + + /*Shift 2 last bands residual prediction gains for SWB/FB*/ + if ( hStereoDft->band_res[k_offset] == STEREO_DFT_BAND_RES_HIGH ) + { + for ( b = hStereoDft->nbands_respred - 1; b >= nbands; b-- ) + { + hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] = + hStereoDft->res_gains_ind[1][b - STEREO_DFT_RES_PRED_BAND_MIN_RED + hStereoDft->res_pred_band_min + STEREO_DFT_BAND_MAX]; + hStereoDft->res_gains_ind[1][b - STEREO_DFT_RES_PRED_BAND_MIN_RED + hStereoDft->res_pred_band_min + STEREO_DFT_BAND_MAX] = 0; + } + } + + /* Get maximal index */ + for ( b = hStereoDft->res_pred_band_min; b < ( nbands - STEREO_DFT_RES_PRED_BAND_MIN_CONST ); b++ ) + { + if ( max_res_pred_ind < hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] ) + { + max_res_pred_ind = (int16_t) hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; + } + } + + /* predictive values */ + for ( ; b < nbands; b++ ) + { + assert( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] == 0 ); + hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] = max_res_pred_ind; + } + } + + for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->res_cod_band_max; b++ ) + { + float tmp; + int16_t tmps1, tmps2; + + hStereoDft->res_gains_ind[0][b] = hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; + /*stereo_dft_dequantize_res_gains_f(&hStereoDft->res_gains_ind[0][b], &hStereoDft->res_gains_ind[1][b+STEREO_DFT_BAND_MAX],hStereoDft->side_gain+(k+k_offset)*STEREO_DFT_BAND_MAX+b, hStereoDft->res_pred_gain+(k+k_offset)*STEREO_DFT_BAND_MAX+b, 1);*/ + tmps1 = (int16_t) ( hStereoDft->res_gains_ind[0][b] ); + tmps2 = (int16_t) ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] ); + stereo_dft_dequantize_res_gains( &tmps1, &tmps2, hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, 1 ); + + if ( hStereoDft->attackPresent ) + { + hStereoDft->res_gains_ind[1][b] = 0.8f * hStereoDft->res_gains_ind[1][b]; + } + else if ( hStereoDft->trans || ( hStereoDft->res_pred_mode[k] && ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] < 2.f ) ) ) + { + hStereoDft->res_gains_ind[1][b] = 0.6f * hStereoDft->res_gains_ind[1][b] + 0.4f * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; + } + else + { + hStereoDft->res_gains_ind[1][b] = dft_alpha_s2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_s2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; + } + + stereo_dft_dequantize_res_gains_f( &hStereoDft->res_gains_ind[0][b], &hStereoDft->res_gains_ind[1][b], &tmp, hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, 1 ); + } + + /* Smoothing of prediction gains between ftrames */ + for ( ; b < hStereoDft->nbands; b++ ) + { + if ( hStereoDft->attackPresent ) + { + hStereoDft->res_gains_ind[0][b] = hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; + hStereoDft->res_gains_ind[1][b] = 0.8f * hStereoDft->res_gains_ind[1][b]; + } + else if ( hStereoDft->trans || ( hStereoDft->res_pred_mode[k] && ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] < 2.f ) ) ) + { + hStereoDft->res_gains_ind[0][b] = hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; + + if ( hStereoDft->hConfig->band_res == STEREO_DFT_BAND_RES_LOW ) + { + hStereoDft->res_gains_ind[1][b] = dft_alpha_w_b2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_w_b2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; + } + else + { + hStereoDft->res_gains_ind[1][b] = dft_alpha_w[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_w[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; + } + } + else + { + if ( hStereoDft->hConfig->band_res == STEREO_DFT_BAND_RES_LOW ) + { + hStereoDft->res_gains_ind[0][b] = dft_alpha_s_b2[b] * hStereoDft->res_gains_ind[0][b] + ( 1 - dft_alpha_s_b2[b] ) * hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; + hStereoDft->res_gains_ind[1][b] = dft_alpha_s2_b2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_s2_b2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; + } + else + { + hStereoDft->res_gains_ind[0][b] = dft_alpha_s[b] * hStereoDft->res_gains_ind[0][b] + ( 1 - dft_alpha_s[b] ) * hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; + hStereoDft->res_gains_ind[1][b] = dft_alpha_s2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_s2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; + } + } + + if ( !hStereoDft->recovery_flg ) + { + stereo_dft_dequantize_res_gains_f( &hStereoDft->res_gains_ind[0][b], &hStereoDft->res_gains_ind[1][b], hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, 1 ); + } + } + + /* Smoothing of IPDs*/ + pgIpd = hStereoDft->gipd + ( k + k_offset ); + diff_ipd = pgIpd[0] - pgIpd[-hStereoDft->prm_res[k + k_offset]]; + if ( diff_ipd < -EVS_PI ) + { + pgIpd[0] += PI2; + } + else if ( diff_ipd > EVS_PI ) + { + pgIpd[0] -= PI2; + } + + if ( !hStereoDft->attackPresent ) + { + if ( hStereoDft->wasTransient ) + { + pgIpd[0] = 0.8f * pgIpd[0] + 0.2f * pgIpd[-hStereoDft->prm_res[k + k_offset]]; + } + else + { + pgIpd[0] = 0.5f * pgIpd[0] + 0.5f * pgIpd[-hStereoDft->prm_res[k + k_offset]]; + } + } + + + if ( !hStereoDft->attackPresent ) + { + pSideGain = hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX; + for ( b = 0; b < hStereoDft->res_cod_band_max; b++ ) + { + pSideGain[b] = dft_res_cod_alpha[b] * pSideGain[b] + ( 1 - dft_res_cod_alpha[b] ) * pSideGain[b - hStereoDft->prm_res[k + k_offset] * STEREO_DFT_BAND_MAX]; + } + } + + /*Interpolation between DFT slots*/ + for ( k2 = 1; k2 < hStereoDft->prm_res[k + k_offset]; k2++ ) + { + pInterpol = hStereoDft->gipd + ( ( k + k_offset ) - k2 ); + pIpd = hStereoDft->gipd + ( k + k_offset ); + if ( hStereoDft->attackPresent ) + { + *( pInterpol ) = *( pIpd ); + } + else + { + *( pInterpol ) = *( hStereoDft->gipd + ( k + k_offset - hStereoDft->prm_res[k + k_offset] ) ); + } + + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + *( hStereoDft->res_pred_gain + ( ( k + k_offset ) - k2 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->res_pred_gain + ( k + k_offset - hStereoDft->prm_res[k + k_offset] ) * STEREO_DFT_BAND_MAX + b ); + + if ( b < hStereoDft->res_cod_band_max || hStereoDft->attackPresent || hStereoDft->trans || ( hStereoDft->res_pred_mode[k] && ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] < 2.f ) ) ) + { + *( hStereoDft->side_gain + ( ( k + k_offset ) - k2 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b ); + } + else + { + *( hStereoDft->side_gain + ( ( k + k_offset ) - k2 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->side_gain + ( k + k_offset - hStereoDft->prm_res[k + k_offset] ) * STEREO_DFT_BAND_MAX + b ); + } + } + + hStereoDft->itd[( k + k_offset ) - k2] = hStereoDft->itd[k + k_offset]; + } /*end of interpolation*/ + } + + return; +} +#else void stereo_dft_dec_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ const int16_t prev_sid_nodata, /* i : Previous SID/No data indicator */ @@ -3820,7 +4115,7 @@ void stereo_dft_dec_smooth_parameters( return; } - +#endif /*--------------------------------------------------------------- * stereo_dft_adapt_sf_delay() diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 002582f22..14122fe14 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -2222,26 +2222,24 @@ static void stereo_dft_compute_td_stefi_params_fx( } wsum = L_shl(wsum, sub(Q16 , shift_g)); pred_g = BASOP_Util_Divide3232_Scale(pred_g, wsum, &q_div); - IF (GT_16(q_div, 16)) + IF (GT_16(sub(15, q_div), 15)) { - pred_g = L_shl(pred_g, 16); - q_pred_g = sub(q_div , 16); + pred_g = L_shl(pred_g, q_div); + q_pred_g = 15; } ELSE { - pred_g = L_shl(pred_g, q_div); - q_pred_g = 0; + q_pred_g = sub(15, q_div); } pred_gain_avg = BASOP_Util_Divide3232_Scale(pred_gain_avg, wsum, &q_div); - IF (GT_16(q_div, 16)) + IF (GT_16(sub(15, q_div), 15)) { - pred_gain_avg = L_shl(pred_gain_avg, 16); - q_pred_gain_avg = sub(q_div , 16); + pred_gain_avg = L_shl(pred_gain_avg, q_div); + q_pred_gain_avg = 15; } ELSE { - pred_gain_avg = L_shl(pred_gain_avg, q_div); - q_pred_gain_avg = 0; + q_pred_gain_avg = sub(15, q_div);; } nrg_DMX = hStereoDft->hb_nrg_fx[0]; nrg_pred_DMX = hStereoDft->hb_nrg_fx[1]; @@ -2277,9 +2275,8 @@ static void stereo_dft_compute_td_stefi_params_fx( } hStereoDft->td_gain_fx[0] = L_deposit_h((Word16)g2); + hStereoDft->q_td_gain[0] = add(16, q_pred_gain_avg); move32(); - if (q_pred_gain_avg != 0) - hStereoDft->q_td_gain[0] = q_pred_gain_avg; move16(); #ifdef DBG_TD_STEFI diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 7e0d1ab82..150df7e1d 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -645,6 +645,7 @@ void stereo_icBWE_dec_fx( hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg2_fx; move32(); + hStereoDft->q_hb_nrg_subr = sub(add(*Q_syn, synthRef_shift), 31); hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); hb_nrg2_fx = 0; move32(); @@ -660,6 +661,8 @@ void stereo_icBWE_dec_fx( hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); Copy32( synthRef_fx, hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame ); + + Scale_sig32(hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame, -5); } ELSE { @@ -669,7 +672,7 @@ void stereo_icBWE_dec_fx( move32(); hCPE->hStereoDft->hb_nrg_subr_fx[1] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[1], shl( hCPE->hStereoDft->NFFT / 2, 6 ) ) ); // 2 * (Qx + SynthRef_shift) - 40 move32(); - hCPE->hStereoDft->Q_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 40 ); + hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 40 ); hCPE->hStereoDft->hb_nrg_fx[0] = hb_nrg_fx; // 2 * (Qx + SynthRef_shift) - 31 move32(); hCPE->hStereoDft->td_gain_fx[0] = 0; @@ -2017,6 +2020,8 @@ void stereo_icBWE_decproc_fx( dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; move16(); + //Scale_sig32(hCPE->hStereoDft->td_gain_fx, STEREO_DFT_CORE_HIST_MAX, -12); + FOR( i = 0; i < dftOvlLen; i++ ) { win_in_fx = L_mult( win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )], win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )] ); /* Q31 */ -- GitLab From 23ab02e5312945500bb1644d0e220f925ebbd1a2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 29 Apr 2024 20:03:11 +0530 Subject: [PATCH 008/101] High MLD issue fix --- lib_com/ivas_pca_tools.c | 29 ++++++++++++++++------------- lib_dec/ivas_pca_dec_fx.c | 18 +++++++++--------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/lib_com/ivas_pca_tools.c b/lib_com/ivas_pca_tools.c index 9cf0732c7..b3f04d7ef 100644 --- a/lib_com/ivas_pca_tools.c +++ b/lib_com/ivas_pca_tools.c @@ -951,7 +951,7 @@ static void sp2cart_fx( q[3] = mult( getSinWord16( ph3 ), s1s2 ); // q15 q[2] = mult( getCosWord16( ph3 ), s1s2 ); // q15 q[1] = mult( getCosWord16( ph2 ), s1 ); // q15 - q[0] = getCosWord16( ph1 ); // q14 + q[0] = shl_sat(getCosWord16( ph1 ), 1); //q15 return; } @@ -975,12 +975,12 @@ static Word16 calc_n2_fx( const Word16 ph1 ) { Word16 n2; - Word16 temp = mult( 23040, getSinWord16( ph1 ) ); // q8 + Word32 temp = L_mult( 23040, getSinWord16( ph1 ) ); // q8 n2 = round_fx( temp ); - + n2 = shr(n2, 7); IF( EQ_16( s_and( n2, 1 ), 0 ) ) { - n2 = add( n2, ONE_IN_Q8 ); + n2 = add( n2, 1 ); } return n2; @@ -1015,19 +1015,21 @@ static Word16 calc_n3_fx( const Word16 ph2 ) { Word16 n3; - Word16 temp1 = mult( 23040, getSinWord16( ph1 ) ); // q7 + q15 - q15 - n3 = round_fx( mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15 + Word16 temp1 = mult( getSinWord16( ph2 ), getSinWord16( ph1 ) ); // q7 + q15 - q15 + n3 = round_fx( L_mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15 + + n3 = shr(n3, 8); IF( EQ_16( n3, 0 ) ) { - n3 = ONE_IN_Q7; + n3 = 1; move16(); } ELSE { IF( ( s_and( n3, 1 ) ) == 1 ) { - n3 = add( n3, ONE_IN_Q7 ); + n3 = add( n3, 1 ); } } @@ -1438,7 +1440,7 @@ void pca_dec_s3_fx( Word16 num_fx = 12868; d_fx = idiv1616( num_fx, n1 ); // Q12 - ph1_q_fx = mult( index1, d_fx ); // Q12 + ph1_q_fx = i_mult( index1, d_fx ); // Q12 n2 = calc_n2_fx( ph1_q_fx ); @@ -1467,8 +1469,8 @@ void pca_dec_s3_fx( num_fx = 12868; move16(); - d_fx = idiv1616( num_fx, n1 ); // Q12 - ph2_q_fx = mult( index2, d_fx ); // Q12 + d_fx = idiv1616( num_fx, sub(n2, 1) ); // Q12 + ph2_q_fx = i_mult( index2, d_fx ); // Q12 } j = L_sub(j, ivas_pca_offset_index2[index2 + get_pca_offset_n2_fx( index1 )]); @@ -1486,8 +1488,9 @@ void pca_dec_s3_fx( { num_fx = 6434; move16(); - d_fx = idiv1616( num_fx, n3 ); // Q11 - ph3_q_fx = mult( index3, d_fx ); // Q11 + d_fx = idiv1616( num_fx, n3 ); // Q10 + ph3_q_fx = round_fx(L_mult( index3, d_fx )); // Q10 + //ph3_q_fx = shl(ph3_q_fx, 2); } sp2cart_fx( ph1_q_fx, ph2_q_fx, ph3_q_fx, q_fx ); diff --git a/lib_dec/ivas_pca_dec_fx.c b/lib_dec/ivas_pca_dec_fx.c index e19b1bda9..ef53d89b3 100644 --- a/lib_dec/ivas_pca_dec_fx.c +++ b/lib_dec/ivas_pca_dec_fx.c @@ -246,10 +246,10 @@ void ivas_pca_dec_fx( } ELSE { - pca_dec_inv_transform_fx( hPCA, ql_fx, ql_fx, output_frame, n_channels, pcm_out_fx ); + pca_dec_inv_transform_fx( hPCA, ql_fx, qr_fx, output_frame, n_channels, pcm_out_fx ); } - pca_dec_update_dquat_fx( hPCA, ql_fx, ql_fx ); + pca_dec_update_dquat_fx( hPCA, ql_fx, qr_fx ); hPCA->prev_pca_bypass = add(hPCA->prev_pca_bypass, 1); move16(); @@ -276,7 +276,7 @@ void ivas_pca_dec_fx( IF( EQ_16(pca_bypass, PCA_MODE_INACTIVE )) { - pca_dec_reset_dquat_fx( ql_fx, ql_fx ); + pca_dec_reset_dquat_fx( ql_fx, qr_fx ); IF( GT_16(hPCA->prev_pca_bypass, 1 )) //&& (hPCA->pca_off_hangover == 0)) { @@ -285,10 +285,10 @@ void ivas_pca_dec_fx( } ELSE { - pca_dec_inv_transform_fx( hPCA, ql_fx, ql_fx, output_frame, n_channels, pcm_out_fx ); + pca_dec_inv_transform_fx( hPCA, ql_fx, qr_fx, output_frame, n_channels, pcm_out_fx ); } - pca_dec_update_dquat_fx( hPCA, ql_fx, ql_fx ); + pca_dec_update_dquat_fx( hPCA, ql_fx, qr_fx ); hPCA->prev_pca_bypass = add(hPCA->prev_pca_bypass , 1); hPCA->prev_pca_bypass = min( hPCA->prev_pca_bypass, 2 ); @@ -299,19 +299,19 @@ void ivas_pca_dec_fx( IF( !bfi ) { pca_dec_s3_fx( hPCA->index[0], ql_fx ); - pca_dec_s3_fx( hPCA->index[1], ql_fx ); + pca_dec_s3_fx( hPCA->index[1], qr_fx ); } ELSE { /* freeze */ // todo : check if update of prev_ql_fx is required Copy( hPCA->prev_ql_fx, ql_fx, IVAS_PCA_INTERP ); - Copy( hPCA->prev_qr_fx, ql_fx, IVAS_PCA_INTERP ); + Copy( hPCA->prev_qr_fx, qr_fx, IVAS_PCA_INTERP ); } - pca_dec_inv_transform_fx( hPCA, ql_fx, ql_fx, output_frame, n_channels, pcm_out_fx ); + pca_dec_inv_transform_fx( hPCA, ql_fx, qr_fx, output_frame, n_channels, pcm_out_fx ); /* update for next frame */ - pca_dec_update_dquat_fx( hPCA, ql_fx, ql_fx ); + pca_dec_update_dquat_fx( hPCA, ql_fx, qr_fx ); hPCA->prev_pca_bypass = 0; move16(); -- GitLab From d2b9cbd3e7ea6615c4a1783f093180f15d500ebb Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 30 Apr 2024 00:56:52 +0530 Subject: [PATCH 009/101] Floating point code restore --- lib_dec/core_switching_dec.c | 1443 +++++++++-------- lib_dec/ivas_mct_dec.c | 12 +- lib_dec/ivas_sba_dec.c | 119 +- lib_dec/ivas_spar_md_dec.c | 2768 ++++++++++++++++++++++++++++++++- lib_dec/ivas_stereo_dft_dec.c | 83 +- 5 files changed, 3562 insertions(+), 863 deletions(-) diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index c2a318b2e..e7238d971 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -175,6 +175,7 @@ ivas_error core_switching_pre_dec_ivas_fx( { st->last_core = HQ_CORE; move16(); + Copy32( st->hTcxDec->FBTCXdelayBuf_32, st->prev_synth_buffer32_fx, NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) ); //Copy_Scale_sig_32_16( st->hTcxDec->FBTCXdelayBuf_32, st->prev_synth_buffer_fx, NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), -11 ); //Q11 -> Q0 } @@ -700,496 +701,488 @@ ivas_error core_switching_pre_dec_ivas_fx( #endif // IVAS_FLOAT_FIXED #ifndef IVAS_FLOAT_FIXED ivas_error core_switching_pre_dec( - Decoder_State *st, /* i/o: decoder state structure */ - const int16_t output_frame, /* i : frame length */ - const int32_t last_core_brate_st0, /* i : channel 0 last core bitrate */ - const int16_t nchan_out, /* i : number of output channels */ - const int16_t last_element_mode, /* i : last_element_mode */ - const int32_t last_element_brate /* i : last element bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + const int16_t output_frame, /* i : frame length */ + const int32_t last_core_brate_st0, /* i : channel 0 last core bitrate */ + const int16_t nchan_out, /* i : number of output channels */ + const int16_t last_element_mode, /* i : last_element_mode */ + const int32_t last_element_brate /* i : last element bitrate */ ) { - int16_t i, oldLenClasBuff, newLenClasBuff; - ivas_error error; - float tmp; + int16_t i, oldLenClasBuff, newLenClasBuff; + ivas_error error; + float tmp; - error = IVAS_ERR_OK; + error = IVAS_ERR_OK; - /* Codec mode switching */ - if ( st->last_codec_mode == MODE2 || ( ( st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE ) && st->element_mode > EVS_MONO ) ) + /* Codec mode switching */ + if (st->last_codec_mode == MODE2 || ((st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE) && st->element_mode > EVS_MONO)) + { + mvr2r(st->mem_syn2, st->mem_syn1, M); + set_f(st->agc_mem2, 0, 2); + st->mem_deemph = st->syn_float[M]; + st->bpf_off = 1; + if (st->hBPF != NULL) { - mvr2r( st->mem_syn2, st->mem_syn1, M ); - set_f( st->agc_mem2, 0, 2 ); - st->mem_deemph = st->syn_float[M]; - st->bpf_off = 1; - if ( st->hBPF != NULL ) - { - set_f( st->hBPF->pst_old_syn, 0, NBPSF_PIT_MAX ); - st->hBPF->pst_mem_deemp_err = 0; - } - st->psf_lp_noise = st->lp_noise_float; + set_f(st->hBPF->pst_old_syn, 0, NBPSF_PIT_MAX); + st->hBPF->pst_mem_deemp_err = 0; + } + st->psf_lp_noise = st->lp_noise_float; - /* reset old HB synthesis buffer */ - if ( st->last_L_frame == L_FRAME ) - { - st->old_bwe_delay = NS2SA( st->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS ); - } - else - { - st->old_bwe_delay = NS2SA( st->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS ); - } - set_f( st->hb_prev_synth_buffer, 0, NS2SA( 48000, DELAY_BWE_TOTAL_NS ) ); + /* reset old HB synthesis buffer */ + if (st->last_L_frame == L_FRAME) + { + st->old_bwe_delay = NS2SA(st->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS); + } + else + { + st->old_bwe_delay = NS2SA(st->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS); + } + set_f(st->hb_prev_synth_buffer, 0, NS2SA(48000, DELAY_BWE_TOTAL_NS)); - if ( st->hBWE_TD != NULL && st->last_core != ACELP_CORE ) - { - /* reset BWE memories */ - set_f( st->hBWE_TD->old_bwe_exc, 0, PIT16k_MAX * 2 ); - st->hBWE_TD->bwe_non_lin_prev_scale = 0.0f; - } + if (st->hBWE_TD != NULL && st->last_core != ACELP_CORE) + { + /* reset BWE memories */ + set_f(st->hBWE_TD->old_bwe_exc, 0, PIT16k_MAX * 2); + st->hBWE_TD->bwe_non_lin_prev_scale = 0.0f; + } - /* reset upd_cnt */ - st->upd_cnt = MAX_UPD_CNT; + /* reset upd_cnt */ + st->upd_cnt = MAX_UPD_CNT; - st->igf = 0; + st->igf = 0; - if ( st->output_Fs >= 16000 && st->hBWE_zero != NULL ) - { - hf_synth_reset( st->hBWE_zero ); - } - - if ( st->hBWE_FD != NULL ) - { - set_f( st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); - } - - if ( st->hHQ_core != NULL ) - { - set_f( st->hHQ_core->prev_env, 0, SFM_N_WB ); - set_f( st->hHQ_core->prev_normq, 0, SFM_N_WB ); + if (st->output_Fs >= 16000 && st->hBWE_zero != NULL) + { + hf_synth_reset(st->hBWE_zero); + } - set_f( st->hHQ_core->last_ni_gain, 0, BANDS_MAX ); - set_f( st->hHQ_core->last_env, 0, BANDS_MAX ); - st->hHQ_core->last_max_pos_pulse = 0; + if (st->hBWE_FD != NULL) + { + set_f(st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA(16000, DELAY_FD_BWE_ENC_NS)); + } - if ( st->output_Fs > 16000 ) - { - set_f( st->hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE ); - } + if (st->hHQ_core != NULL) + { + set_f(st->hHQ_core->prev_env, 0, SFM_N_WB); + set_f(st->hHQ_core->prev_normq, 0, SFM_N_WB); - /* pre-echo */ - st->hHQ_core->pastpre = 0; - } + set_f(st->hHQ_core->last_ni_gain, 0, BANDS_MAX); + set_f(st->hHQ_core->last_env, 0, BANDS_MAX); + st->hHQ_core->last_max_pos_pulse = 0; - /* reset the GSC pre echo energy threshold in case of switching */ - if ( st->hGSCDec != NULL ) - { - st->hGSCDec->Last_frame_ener = (float) MAX_32; - } + if (st->output_Fs > 16000) + { + set_f(st->hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE); + } - if ( st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE ) - { - if ( st->element_mode == EVS_MONO ) - { - st->last_core = HQ_CORE; - mvr2r( st->hTcxDec->FBTCXdelayBuf_float, st->prev_synth_buffer, NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) ); - } + /* pre-echo */ + st->hHQ_core->pastpre = 0; + } - if ( st->hHQ_core != NULL ) - { - set_f( st->hHQ_core->last_ni_gain, 0, BANDS_MAX ); - set_f( st->hHQ_core->last_env, 0, BANDS_MAX ); - st->hHQ_core->last_max_pos_pulse = 0; + /* reset the GSC pre echo energy threshold in case of switching */ + if (st->hGSCDec != NULL) + { + st->hGSCDec->Last_frame_ener = (float)MAX_32; + } - set_s( st->hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM ); - st->hHQ_core->prev_frm_hfe2 = 0; - st->hHQ_core->prev_stab_hfe2 = 0; - } - } + if (st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE) + { + if (st->element_mode == EVS_MONO) + { + st->last_core = HQ_CORE; + mvr2r(st->hTcxDec->FBTCXdelayBuf_float, st->prev_synth_buffer, NS2SA(st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS)); + } - if ( st->prev_bfi != 0 ) - { - int16_t delay_comp; + if (st->hHQ_core != NULL) + { + set_f(st->hHQ_core->last_ni_gain, 0, BANDS_MAX); + set_f(st->hHQ_core->last_env, 0, BANDS_MAX); + st->hHQ_core->last_max_pos_pulse = 0; - /*switch off Hq Voicing as it was not updated in MODE2*/ - if ( st->hHQ_core != NULL ) - { - st->hHQ_core->oldHqVoicing = 0; - st->hHQ_core->HqVoicing = 0; - } + set_s(st->hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM); + st->hHQ_core->prev_frm_hfe2 = 0; + st->hHQ_core->prev_stab_hfe2 = 0; + } + } - delay_comp = NS2SA( st->output_Fs, DELAY_CLDFB_NS ); + if (st->prev_bfi != 0) + { + int16_t delay_comp; - if ( !st->last_con_tcx && st->last_core_bfi == ACELP_CORE && st->core == HQ_CORE ) - { - float *realBuffer[CLDFB_NO_COL_MAX_SWITCH], *imagBuffer[CLDFB_NO_COL_MAX_SWITCH]; - float realBufferTmp[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX], imagBufferTmp[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX]; + /*switch off Hq Voicing as it was not updated in MODE2*/ + if (st->hHQ_core != NULL) + { + st->hHQ_core->oldHqVoicing = 0; + st->hHQ_core->HqVoicing = 0; + } - for ( i = 0; i < CLDFB_NO_COL_MAX_SWITCH; i++ ) - { - set_f( realBufferTmp[i], 0, CLDFB_NO_CHANNELS_MAX ); - set_f( imagBufferTmp[i], 0, CLDFB_NO_CHANNELS_MAX ); - realBuffer[i] = realBufferTmp[i]; - imagBuffer[i] = imagBufferTmp[i]; - } + delay_comp = NS2SA(st->output_Fs, DELAY_CLDFB_NS); - /* CLDFB analysis of the synthesis at internal sampling rate */ - if ( ( error = cldfb_save_memory_ivas( st->cldfbAna ) ) != IVAS_ERR_OK ) - { - return error; - } + if (!st->last_con_tcx && st->last_core_bfi == ACELP_CORE && st->core == HQ_CORE) + { + float *realBuffer[CLDFB_NO_COL_MAX_SWITCH], *imagBuffer[CLDFB_NO_COL_MAX_SWITCH]; + float realBufferTmp[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX], imagBufferTmp[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX]; - cldfbAnalysis_ivas( st->hTcxDec->syn_Overl_float, realBuffer, imagBuffer, delay_comp, st->cldfbAna ); - cldfb_restore_memory_ivas( st->cldfbAna ); + for (i = 0; i < CLDFB_NO_COL_MAX_SWITCH; i++) + { + set_f(realBufferTmp[i], 0, CLDFB_NO_CHANNELS_MAX); + set_f(imagBufferTmp[i], 0, CLDFB_NO_CHANNELS_MAX); + realBuffer[i] = realBufferTmp[i]; + imagBuffer[i] = imagBufferTmp[i]; + } - /* CLDFB synthesis of the combined signal */ - if ( ( error = cldfb_save_memory_ivas( st->cldfbSyn ) ) != IVAS_ERR_OK ) - { - return error; - } + /* CLDFB analysis of the synthesis at internal sampling rate */ + if ((error = cldfb_save_memory_ivas(st->cldfbAna)) != IVAS_ERR_OK) + { + return error; + } - cldfbSynthesis_ivas( realBuffer, imagBuffer, st->hHQ_core->fer_samples, delay_comp, st->cldfbSyn ); - cldfb_restore_memory_ivas( st->cldfbSyn ); - } + cldfbAnalysis_ivas(st->hTcxDec->syn_Overl_float, realBuffer, imagBuffer, delay_comp, st->cldfbAna); + cldfb_restore_memory_ivas(st->cldfbAna); - if ( !st->last_con_tcx && st->last_core_bfi == ACELP_CORE && st->core == HQ_CORE ) - { - lerp_flt( st->hTcxDec->syn_Overl_float, st->hHQ_core->fer_samples + delay_comp, output_frame / 2, st->last_L_frame / 2 ); - /*Set to zero the remaining part*/ - set_f( st->hHQ_core->fer_samples + delay_comp + output_frame / 2, 0, ( output_frame / 2 ) - delay_comp ); - } + /* CLDFB synthesis of the combined signal */ + if ((error = cldfb_save_memory_ivas(st->cldfbSyn)) != IVAS_ERR_OK) + { + return error; } - st->use_acelp_preq = 0; - st->reset_mem_AR = 0; + cldfbSynthesis_ivas(realBuffer, imagBuffer, st->hHQ_core->fer_samples, delay_comp, st->cldfbSyn); + cldfb_restore_memory_ivas(st->cldfbSyn); + } + + if (!st->last_con_tcx && st->last_core_bfi == ACELP_CORE && st->core == HQ_CORE) + { + lerp_flt(st->hTcxDec->syn_Overl_float, st->hHQ_core->fer_samples + delay_comp, output_frame / 2, st->last_L_frame / 2); + /*Set to zero the remaining part*/ + set_f(st->hHQ_core->fer_samples + delay_comp + output_frame / 2, 0, (output_frame / 2) - delay_comp); + } } - /*FEC*/ - if ( st->L_frame <= L_FRAME16k ) + st->use_acelp_preq = 0; + st->reset_mem_AR = 0; + } + + /*FEC*/ + if (st->L_frame <= L_FRAME16k) + { + if (st->last_L_frame <= L_FRAME16k && st->core != HQ_CORE) { - if ( st->last_L_frame <= L_FRAME16k && st->core != HQ_CORE ) + if (st->L_frame != st->last_L_frame) + { + if (st->L_frame > st->last_L_frame) { - if ( st->L_frame != st->last_L_frame ) - { - if ( st->L_frame > st->last_L_frame ) - { - oldLenClasBuff = L_SYN_MEM_CLAS_ESTIM * st->last_L_frame / st->L_frame; - newLenClasBuff = L_SYN_MEM_CLAS_ESTIM; - } - else - { - oldLenClasBuff = L_SYN_MEM_CLAS_ESTIM; - newLenClasBuff = L_SYN_MEM_CLAS_ESTIM * st->L_frame / st->last_L_frame; - } - lerp_flt( &st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - oldLenClasBuff], &st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - newLenClasBuff], newLenClasBuff, oldLenClasBuff ); - } + oldLenClasBuff = L_SYN_MEM_CLAS_ESTIM * st->last_L_frame / st->L_frame; + newLenClasBuff = L_SYN_MEM_CLAS_ESTIM; } else { - set_zero( st->mem_syn_clas_estim, L_SYN_MEM_CLAS_ESTIM ); + oldLenClasBuff = L_SYN_MEM_CLAS_ESTIM; + newLenClasBuff = L_SYN_MEM_CLAS_ESTIM * st->L_frame / st->last_L_frame; } + lerp_flt(&st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - oldLenClasBuff], &st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - newLenClasBuff], newLenClasBuff, oldLenClasBuff); + } } - - /* Here we only handle cases where last_ppp and last_nelp not updated when coming from CodecB or other cores - within ACELP_CORE if switching from another bitarate to vbr, last_ppp and last_nelp is always updated in the previous frame */ - if ( st->core == ACELP_CORE && ( st->last_core != ACELP_CORE || st->last_codec_mode == MODE2 ) ) + else { - st->last_ppp_mode_dec = 0; - st->last_nelp_mode_dec = 0; + set_zero(st->mem_syn_clas_estim, L_SYN_MEM_CLAS_ESTIM); } + } - /* Handle state reset of stat_noise_uv_mod memory */ - if ( st->core == ACELP_CORE && ( st->last_core != ACELP_CORE || st->last_codec_mode == MODE2 || st->last_total_brate <= PPP_NELP_2k80 ) ) + /* Here we only handle cases where last_ppp and last_nelp not updated when coming from CodecB or other cores + within ACELP_CORE if switching from another bitarate to vbr, last_ppp and last_nelp is always updated in the previous frame */ + if (st->core == ACELP_CORE && (st->last_core != ACELP_CORE || st->last_codec_mode == MODE2)) + { + st->last_ppp_mode_dec = 0; + st->last_nelp_mode_dec = 0; + } + + /* Handle state reset of stat_noise_uv_mod memory */ + if (st->core == ACELP_CORE && (st->last_core != ACELP_CORE || st->last_codec_mode == MODE2 || st->last_total_brate <= PPP_NELP_2k80)) + { + st->act_count = 3; + st->uv_count = 0; + } + + if (((st->core == ACELP_CORE || st->core == AMR_WB_CORE) && st->last_core == HQ_CORE) || ((st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD || (st->element_mode == IVAS_CPE_MDCT && last_element_mode == IVAS_CPE_DFT)) && nchan_out == 2 && + st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA && (last_core_brate_st0 == FRAME_NO_DATA || last_core_brate_st0 == SID_2k40))) + { + if (st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD) { - st->act_count = 3; - st->uv_count = 0; + st->hPFstat->reset = 1; } - if ( ( ( st->core == ACELP_CORE || st->core == AMR_WB_CORE ) && st->last_core == HQ_CORE ) || ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD || ( st->element_mode == IVAS_CPE_MDCT && last_element_mode == IVAS_CPE_DFT ) ) && nchan_out == 2 && - st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA && ( last_core_brate_st0 == FRAME_NO_DATA || last_core_brate_st0 == SID_2k40 ) ) ) + if (st->L_frame == L_FRAME16k) { - if ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) - { - st->hPFstat->reset = 1; - } - - if ( st->L_frame == L_FRAME16k ) - { - mvr2r( TRWB2_Ave, st->lsf_old, M ); /* init of LSP */ - mvr2r( TRWB2_Ave, st->lsfoldbfi1, M ); - mvr2r( TRWB2_Ave, st->lsfoldbfi0, M ); - mvr2r( TRWB2_Ave, st->lsf_adaptive_mean, M ); - lsf2lsp( st->lsf_old, st->lsp_old, M, INT_FS_16k ); - } - else - { - mvr2r( TRWB_Ave, st->lsf_old, M ); /* init of LSP */ - mvr2r( TRWB_Ave, st->lsfoldbfi1, M ); - mvr2r( TRWB_Ave, st->lsfoldbfi0, M ); - mvr2r( TRWB_Ave, st->lsf_adaptive_mean, M ); - lsf2lsp( st->lsf_old, st->lsp_old, M, INT_FS_12k8 ); - } - - if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && nchan_out == 2 && st->core_brate > SID_2k40 && ( last_core_brate_st0 == FRAME_NO_DATA || last_core_brate_st0 == SID_2k40 ) && st->hTcxDec != NULL ) - { - /* Last frame was Stereo CNG and the synthesis memory is outdated -- reset */ - set_f( st->hTcxDec->old_syn_Overl_float, 0.0f, L_FRAME32k / 2 ); - set_f( st->hFdCngDec->hFdCngCom->olapBufferAna_flt, 0.0f, FFTLEN ); -#ifdef IVAS_FLOAT_FIXED - set16_fx( st->hFdCngDec->hFdCngCom->olapBufferAna_fx, 0, FFTLEN ); -#endif // IVAS_FLOAT_FIXED - } + mvr2r(TRWB2_Ave, st->lsf_old, M); /* init of LSP */ + mvr2r(TRWB2_Ave, st->lsfoldbfi1, M); + mvr2r(TRWB2_Ave, st->lsfoldbfi0, M); + mvr2r(TRWB2_Ave, st->lsf_adaptive_mean, M); + lsf2lsp(st->lsf_old, st->lsp_old, M, INT_FS_16k); + } + else + { + mvr2r(TRWB_Ave, st->lsf_old, M); /* init of LSP */ + mvr2r(TRWB_Ave, st->lsfoldbfi1, M); + mvr2r(TRWB_Ave, st->lsfoldbfi0, M); + mvr2r(TRWB_Ave, st->lsf_adaptive_mean, M); + lsf2lsp(st->lsf_old, st->lsp_old, M, INT_FS_12k8); + } - set_f( st->agc_mem2, 0, 2 ); - st->mem_deemph = 0; - if ( !st->last_con_tcx ) - { - set_f( st->mem_syn2, 0.0f, M ); - } - set_f( st->mem_syn1, 0.0f, M ); - if ( st->hBWE_TD != NULL ) - { - st->hBWE_TD->bwe_non_lin_prev_scale = 0.0f; - } + if ((st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD) && nchan_out == 2 && st->core_brate > SID_2k40 && (last_core_brate_st0 == FRAME_NO_DATA || last_core_brate_st0 == SID_2k40) && st->hTcxDec != NULL) + { + /* Last frame was Stereo CNG and the synthesis memory is outdated -- reset */ + set_f(st->hTcxDec->old_syn_Overl_float, 0.0f, L_FRAME32k / 2); + set_f(st->hFdCngDec->hFdCngCom->olapBufferAna_flt, 0.0f, FFTLEN); + } - /* Reset ACELP parameters */ - set_zero( st->mem_MA, M ); - if ( st->sr_core == INT_FS_16k ) - { - mvr2r( GEWB2_Ave, st->mem_AR, M ); - } - else - { - mvr2r( GEWB_Ave, st->mem_AR, M ); - } - st->tilt_code = 0.0f; - st->gc_threshold = 0.0f; - set_f( st->dispMem, 0, 8 ); + set_f(st->agc_mem2, 0, 2); + st->mem_deemph = 0; + if (!st->last_con_tcx) + { + set_f(st->mem_syn2, 0.0f, M); + } + set_f(st->mem_syn1, 0.0f, M); + if (st->hBWE_TD != NULL) + { + st->hBWE_TD->bwe_non_lin_prev_scale = 0.0f; + } - st->last_coder_type = GENERIC; + /* Reset ACELP parameters */ + set_zero(st->mem_MA, M); + if (st->sr_core == INT_FS_16k) + { + mvr2r(GEWB2_Ave, st->mem_AR, M); + } + else + { + mvr2r(GEWB_Ave, st->mem_AR, M); + } + st->tilt_code = 0.0f; + st->gc_threshold = 0.0f; + set_f(st->dispMem, 0, 8); - fer_energy( output_frame, UNVOICED_CLAS, st->previoussynth, -1, &st->enr_old, 1 ); - st->lp_gainp = 0.0f; - st->lp_gainc = (float) sqrt( st->lp_ener ); + st->last_coder_type = GENERIC; - st->last_voice_factor = 0; - st->Last_GSC_noisy_speech_flag = 0; + fer_energy(output_frame, UNVOICED_CLAS, st->previoussynth, -1, &st->enr_old, 1); + st->lp_gainp = 0.0f; + st->lp_gainc = (float)sqrt(st->lp_ener); - /* reset CLDFB memories */ - cldfb_reset_memory_ivas( st->cldfbAna ); - cldfb_reset_memory_ivas( st->cldfbBPF ); - cldfb_reset_memory_ivas( st->cldfbSyn ); + st->last_voice_factor = 0; + st->Last_GSC_noisy_speech_flag = 0; - /* reset TBE memories */ - if ( !st->last_con_tcx && !( ( st->last_core == HQ_CORE ) && st->element_mode > EVS_MONO ) ) - { - set_f( st->old_exc, 0, L_EXC_MEM_DEC ); - } - else if ( st->L_frame < L_FRAME16k ) - { - /* resample from 16kHz to 12.8kHZ */ - synth_mem_updt2_flt( st->L_frame, L_FRAME16k, st->old_exc, st->mem_syn_r_float, st->mem_syn2, NULL, DEC ); - } + /* reset CLDFB memories */ + cldfb_reset_memory_ivas(st->cldfbAna); + cldfb_reset_memory_ivas(st->cldfbBPF); + cldfb_reset_memory_ivas(st->cldfbSyn); - if ( st->hBWE_TD != NULL ) - { - set_f( st->hBWE_TD->old_bwe_exc, 0, PIT16k_MAX * 2 ); - } + /* reset TBE memories */ + if (!st->last_con_tcx && !((st->last_core == HQ_CORE) && st->element_mode > EVS_MONO)) + { + set_f(st->old_exc, 0, L_EXC_MEM_DEC); + } + else if (st->L_frame < L_FRAME16k) + { + /* resample from 16kHz to 12.8kHZ */ + synth_mem_updt2_flt(st->L_frame, L_FRAME16k, st->old_exc, st->mem_syn_r_float, st->mem_syn2, NULL, DEC); + } - if ( st->output_Fs >= 16000 && st->hBWE_zero != NULL ) - { - hf_synth_reset( st->hBWE_zero ); - } + if (st->hBWE_TD != NULL) + { + set_f(st->hBWE_TD->old_bwe_exc, 0, PIT16k_MAX * 2); + } - if ( st->hBWE_FD != NULL ) - { - set_f( st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); - } + if (st->output_Fs >= 16000 && st->hBWE_zero != NULL) + { + hf_synth_reset(st->hBWE_zero); } - if ( ( st->core == ACELP_CORE || st->core == AMR_WB_CORE ) && ( st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE ) ) + if (st->hBWE_FD != NULL) { - if ( st->hBWE_TD != NULL ) - { - st->hBWE_TD->bwe_non_lin_prev_scale = 0.0f; - set_f( st->hBWE_TD->old_bwe_exc, 0, PIT16k_MAX * 2 ); - } + set_f(st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA(16000, DELAY_FD_BWE_ENC_NS)); + } + } - st->tilt_code = 0.0f; - st->gc_threshold = 0.0f; - set_f( st->dispMem, 0, 8 ); + if ((st->core == ACELP_CORE || st->core == AMR_WB_CORE) && (st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE)) + { + if (st->hBWE_TD != NULL) + { + st->hBWE_TD->bwe_non_lin_prev_scale = 0.0f; + set_f(st->hBWE_TD->old_bwe_exc, 0, PIT16k_MAX * 2); + } - st->last_coder_type = GENERIC; + st->tilt_code = 0.0f; + st->gc_threshold = 0.0f; + set_f(st->dispMem, 0, 8); - fer_energy( output_frame, UNVOICED_CLAS, st->previoussynth, -1, &st->enr_old, 1 ); - st->lp_gainp = 0.0f; - st->lp_gainc = (float) sqrt( st->lp_ener ); + st->last_coder_type = GENERIC; - st->last_voice_factor = 0; - st->Last_GSC_noisy_speech_flag = 0; + fer_energy(output_frame, UNVOICED_CLAS, st->previoussynth, -1, &st->enr_old, 1); + st->lp_gainp = 0.0f; + st->lp_gainc = (float)sqrt(st->lp_ener); - if ( st->output_Fs >= 16000 && st->hBWE_zero != NULL ) - { - hf_synth_reset( st->hBWE_zero ); - } + st->last_voice_factor = 0; + st->Last_GSC_noisy_speech_flag = 0; - if ( st->hBWE_FD != NULL ) - { - set_f( st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); - } + if (st->output_Fs >= 16000 && st->hBWE_zero != NULL) + { + hf_synth_reset(st->hBWE_zero); + } - if ( nchan_out == 1 && st->element_mode == IVAS_CPE_DFT && st->element_brate <= IVAS_24k4 && last_element_brate > IVAS_24k4 ) - { - /* update cldbf state with previous frame TCX synthesis when going from a bitrate with residual coding to a bitrate without it */ - int16_t offset; - offset = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; - mvr2r( st->hTcxDec->old_synthFB + st->hTcxDec->old_synth_lenFB - offset, st->cldfbAna->cldfb_state, offset ); - } + if (st->hBWE_FD != NULL) + { + set_f(st->hBWE_FD->old_syn_12k8_16k, 0, NS2SA(16000, DELAY_FD_BWE_ENC_NS)); } - if ( st->core == HQ_CORE && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE || ( ( st->element_mode != EVS_MONO ) && ( st->last_core != HQ_CORE ) ) ) ) + if (nchan_out == 1 && st->element_mode == IVAS_CPE_DFT && st->element_brate <= IVAS_24k4 && last_element_brate > IVAS_24k4) { - set_f( st->hHQ_core->prev_env, 0, SFM_N_WB ); - set_f( st->hHQ_core->prev_normq, 0, SFM_N_WB ); + /* update cldbf state with previous frame TCX synthesis when going from a bitrate with residual coding to a bitrate without it */ + int16_t offset; + offset = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; + mvr2r(st->hTcxDec->old_synthFB + st->hTcxDec->old_synth_lenFB - offset, st->cldfbAna->cldfb_state, offset); + } + } - set_f( st->hHQ_core->last_ni_gain, 0, BANDS_MAX ); - set_f( st->hHQ_core->last_env, 0, BANDS_MAX ); - st->hHQ_core->last_max_pos_pulse = 0; + if (st->core == HQ_CORE && (st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE || ((st->element_mode != EVS_MONO) && (st->last_core != HQ_CORE)))) + { + set_f(st->hHQ_core->prev_env, 0, SFM_N_WB); + set_f(st->hHQ_core->prev_normq, 0, SFM_N_WB); - set_s( st->hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM ); - st->hHQ_core->prev_frm_hfe2 = 0; - st->hHQ_core->prev_stab_hfe2 = 0; - if ( st->output_Fs > 16000 ) - { - set_f( st->hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE ); - } + set_f(st->hHQ_core->last_ni_gain, 0, BANDS_MAX); + set_f(st->hHQ_core->last_env, 0, BANDS_MAX); + st->hHQ_core->last_max_pos_pulse = 0; - if ( st->element_mode != EVS_MONO ) - { - /* Estimate mem_env_delta to reinit env_stab */ - tmp = max( 0, ENV_STAB_EST1 + ( ENV_STAB_EST2 * st->stab_fac_smooth_lt ) + ( ENV_STAB_EST3 * st->log_energy_diff_lt ) ); - st->hHQ_core->mem_env_delta = (int16_t) min( MAX16B, (int32_t) ( tmp * ( 1 << 12 ) ) ); /* Convert to Q12 and handle saturation */ + set_s(st->hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM); + st->hHQ_core->prev_frm_hfe2 = 0; + st->hHQ_core->prev_stab_hfe2 = 0; + if (st->output_Fs > 16000) + { + set_f(st->hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE); + } - if ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE ) - { - set_f( st->hHQ_core->old_out, 0, output_frame ); - set_f( st->hHQ_core->old_outLB, 0, L_FRAME16k ); - } + if (st->element_mode != EVS_MONO) + { + /* Estimate mem_env_delta to reinit env_stab */ + tmp = max(0, ENV_STAB_EST1 + (ENV_STAB_EST2 * st->stab_fac_smooth_lt) + (ENV_STAB_EST3 * st->log_energy_diff_lt)); + st->hHQ_core->mem_env_delta = (int16_t)min(MAX16B, (int32_t)(tmp * (1 << 12))); /* Convert to Q12 and handle saturation */ - st->hHQ_core->no_att_hangover = 0; - st->hHQ_core->energy_lt = 300.0f; + if (st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE) + { + set_f(st->hHQ_core->old_out, 0, output_frame); + set_f(st->hHQ_core->old_outLB, 0, L_FRAME16k); + } - set_s( st->hHQ_core->old_is_transient, 0, 3 ); - set_f( st->hHQ_core->prev_noise_level, 0.0f, 2 ); - st->hHQ_core->prev_R = 0; - set_s( st->hHQ_core->mem_norm + 1, 39, SFM_N_ENV_STAB - 1 ); - st->hHQ_core->prev_hqswb_clas = HQ_NORMAL; - st->hHQ_core->prev_ni_ratio = 0.5f; - set_f( st->hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS ); - } - else - { - set_f( st->hHQ_core->old_out, 0, output_frame ); - set_f( st->hHQ_core->old_outLB, 0, L_FRAME16k ); - } - } + st->hHQ_core->no_att_hangover = 0; + st->hHQ_core->energy_lt = 300.0f; - /* handle switching cases where preecho_sb was not called in the last frame (memory not up to date) */ - if ( st->hHQ_core != NULL ) + set_s(st->hHQ_core->old_is_transient, 0, 3); + set_f(st->hHQ_core->prev_noise_level, 0.0f, 2); + st->hHQ_core->prev_R = 0; + set_s(st->hHQ_core->mem_norm + 1, 39, SFM_N_ENV_STAB - 1); + st->hHQ_core->prev_hqswb_clas = HQ_NORMAL; + st->hHQ_core->prev_ni_ratio = 0.5f; + set_f(st->hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS); + } + else { - st->hHQ_core->pastpre--; - if ( st->hHQ_core->pastpre <= 0 ) - { - reset_preecho_dec( st->hHQ_core ); - } + set_f(st->hHQ_core->old_out, 0, output_frame); + set_f(st->hHQ_core->old_outLB, 0, L_FRAME16k); } + } - if ( st->core_brate == FRAME_NO_DATA ) + /* handle switching cases where preecho_sb was not called in the last frame (memory not up to date) */ + if (st->hHQ_core != NULL) + { + st->hHQ_core->pastpre--; + if (st->hHQ_core->pastpre <= 0) { - st->VAD = 0; - st->m_frame_type = ZERO_FRAME; + reset_preecho_dec(st->hHQ_core); } - else if ( st->core_brate == SID_2k40 || st->core_brate == SID_1k75 ) + } + + if (st->core_brate == FRAME_NO_DATA) + { + st->VAD = 0; + st->m_frame_type = ZERO_FRAME; + } + else if (st->core_brate == SID_2k40 || st->core_brate == SID_1k75) + { + st->VAD = 0; + st->m_frame_type = SID_FRAME; + } + else + { + st->VAD = 1; + st->m_frame_type = ACTIVE_FRAME; + } + + /*switch on CNA on active frames*/ + if (st->element_mode == EVS_MONO) /* for IVAS modes, st->flag_cna is set earlier */ + { + if (st->VAD && ((st->core != AMR_WB_CORE && st->total_brate <= CNA_MAX_BRATE) || (st->core == AMR_WB_CORE && st->total_brate <= ACELP_8k85))) { - st->VAD = 0; - st->m_frame_type = SID_FRAME; + st->flag_cna = 1; } - else + else if (st->VAD || ((st->cng_type == FD_CNG) && (st->L_frame == L_FRAME16k))) { - st->VAD = 1; - st->m_frame_type = ACTIVE_FRAME; + st->flag_cna = 0; } + } - /*switch on CNA on active frames*/ - if ( st->element_mode == EVS_MONO ) /* for IVAS modes, st->flag_cna is set earlier */ - { - if ( st->VAD && ( ( st->core != AMR_WB_CORE && st->total_brate <= CNA_MAX_BRATE ) || ( st->core == AMR_WB_CORE && st->total_brate <= ACELP_8k85 ) ) ) - { - st->flag_cna = 1; - } - else if ( st->VAD || ( ( st->cng_type == FD_CNG ) && ( st->L_frame == L_FRAME16k ) ) ) - { - st->flag_cna = 0; - } - } + if (st->core == AMR_WB_CORE) + { + st->cng_type = LP_CNG; + } - if ( st->core == AMR_WB_CORE ) + /* Reconfigure CNG */ + if (st->hFdCngDec && ((st->last_L_frame != st->L_frame) || (st->hFdCngDec->hFdCngCom->frameSize != st->L_frame) || st->ini_frame == 0 || st->bwidth != st->last_bwidth)) + { + /* || st->last_core == AMR_WB_CORE || st->last_codec_mode == MODE2)){*/ + if (st->core != AMR_WB_CORE) { - st->cng_type = LP_CNG; + configureFdCngDec(st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode); } + else + { + configureFdCngDec(st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode); - /* Reconfigure CNG */ - if ( st->hFdCngDec && ( ( st->last_L_frame != st->L_frame ) || ( st->hFdCngDec->hFdCngCom->frameSize != st->L_frame ) || st->ini_frame == 0 || st->bwidth != st->last_bwidth ) ) + if (st->VAD) + { + st->hFdCngDec->hFdCngCom->CngBitrate = st->total_brate; + } + } + if (st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k) { - /* || st->last_core == AMR_WB_CORE || st->last_codec_mode == MODE2)){*/ - if ( st->core != AMR_WB_CORE ) + if (st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD) + { + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferAna_flt + st->last_L_frame, st->hFdCngDec->hFdCngCom->olapBufferAna_flt + st->L_frame, st->L_frame, st->last_L_frame); + } + + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->L_frame * 2, st->last_L_frame * 2); + + if (st->total_brate <= SID_2k40 && st->last_total_brate <= SID_2k40) + { + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->L_frame * 2, st->last_L_frame * 2); + + if (st->L_frame == L_FRAME) { - configureFdCngDec( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); - configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); + for (i = 0; i < st->L_frame * 2; i++) + { + st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] * 0.6250f; + } } else { - configureFdCngDec( st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode ); - configureFdCngDec_fx( st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode ); - - if ( st->VAD ) - { - st->hFdCngDec->hFdCngCom->CngBitrate = st->total_brate; - } - } - if ( st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k ) - { - if ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) - { - lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferAna_flt + st->last_L_frame, st->hFdCngDec->hFdCngCom->olapBufferAna_flt + st->L_frame, st->L_frame, st->last_L_frame ); -#ifdef IVAS_FLOAT_FIXED - lerp( st->hFdCngDec->hFdCngCom->olapBufferAna_fx + st->last_L_frame, st->hFdCngDec->hFdCngCom->olapBufferAna_fx + st->L_frame, st->L_frame, st->last_L_frame ); -#endif // IVAS_FLOAT_FIXED - } - - lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->L_frame * 2, st->last_L_frame * 2 ); - - if ( st->total_brate <= SID_2k40 && st->last_total_brate <= SID_2k40 ) - { - lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->L_frame * 2, st->last_L_frame * 2 ); - - if ( st->L_frame == L_FRAME ) - { - for ( i = 0; i < st->L_frame * 2; i++ ) - { - st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] * 0.6250f; - } - } - else - { - for ( i = 0; i < st->L_frame * 2; i++ ) - { - st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] * 1.6f; - } - } - } + for (i = 0; i < st->L_frame * 2; i++) + { + st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[i] * 1.6f; + } } } + } + } - return error; + return error; } #endif #ifndef IVAS_FLOAT_FIXED @@ -1199,402 +1192,376 @@ ivas_error core_switching_pre_dec( * Postprocessing for ACELP/HQ core switching *---------------------------------------------------------------------*/ ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t output_frame, /* i : frame length */ - const int16_t core_switching_flag, /* i : ACELP->HQ switching flag */ - const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - const int16_t nchan_out, /* i : number of output channels */ - const int16_t last_element_mode /* i : element mode of previous frame */ + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const int16_t output_frame, /* i : frame length */ + const int16_t core_switching_flag, /* i : ACELP->HQ switching flag */ + const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const int16_t nchan_out, /* i : number of output channels */ + const int16_t last_element_mode /* i : element mode of previous frame */ ) { - int16_t i, delay_comp, delta; -#ifdef IVAS_FLOAT_FIXED - Word32 synth_fx[960]; - //Word32 output_fx[1500]; -#endif - float tmpF; - float tmpDelta; - float synth_subfr_out[SWITCH_MAX_GAP], synth_subfr_bwe[SWITCH_MAX_GAP]; - float mem_synth[NS2SA( 16000, DELAY_CLDFB_NS ) + 2]; - int16_t nZeros; - int16_t offset; - ivas_error error; - - error = IVAS_ERR_OK; - - if ( st->core == ACELP_CORE && st->bfi && st->hHQ_core != NULL && !st->con_tcx ) - { - if ( ( error = acelp_core_switch_dec_bfi( st ) ) != IVAS_ERR_OK ) - { + int16_t i, delay_comp, delta; + float tmpF; + float tmpDelta; + float synth_subfr_out[SWITCH_MAX_GAP], synth_subfr_bwe[SWITCH_MAX_GAP]; + float mem_synth[NS2SA(16000, DELAY_CLDFB_NS) + 2]; + int16_t nZeros; + int16_t offset; + ivas_error error; + + error = IVAS_ERR_OK; + + if (st->core == ACELP_CORE && st->bfi && st->hHQ_core != NULL && !st->con_tcx) + { + if ((error = acelp_core_switch_dec_bfi(st)) != IVAS_ERR_OK) + { + return error; + } + } + + /* set multiplication factor according to the sampling rate */ + delta = 1; + if (output_frame == L_FRAME16k) + { + delta = 2; + } + else if (output_frame == L_FRAME32k) + { + delta = 4; + } + else if (output_frame == L_FRAME48k) + { + delta = 6; + } + + /* set delay compensation between HQ synthesis and ACELP synthesis */ + delay_comp = delta * HQ_DELAY_COMP; + + /* Core switching done in DFT domain afterward*/ + if ((st->element_mode != IVAS_CPE_DFT || use_cldfb_for_dft) && (!sba_dirac_stereo_flag || (sba_dirac_stereo_flag && st->core_brate == SID_2k40 && st->cng_type == FD_CNG))) + { + if (st->core == HQ_CORE || st->core == TCX_20_CORE || st->core == TCX_10_CORE || (st->core == ACELP_CORE && st->bfi == 1 && st->con_tcx == 1)) + { + st->use_acelp_preq = 0; + if (st->hBWE_FD != NULL) + { + st->hBWE_FD->mem_deemph_old_syn = 0.0f; + } + + if (st->element_mode == EVS_MONO && st->core == HQ_CORE) /* ACELP->HQ-CORE */ + { + if (core_switching_flag && st->last_L_frame == st->last_L_frame_ori && (st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE)) + { + if ((error = acelp_core_switch_dec(st, synth_subfr_out, synth_subfr_bwe, output_frame, core_switching_flag, mem_synth, nchan_out)) != IVAS_ERR_OK) + { return error; + } } - } - - /* set multiplication factor according to the sampling rate */ - delta = 1; - if ( output_frame == L_FRAME16k ) - { - delta = 2; - } - else if ( output_frame == L_FRAME32k ) - { - delta = 4; - } - else if ( output_frame == L_FRAME48k ) - { - delta = 6; - } - - /* set delay compensation between HQ synthesis and ACELP synthesis */ - delay_comp = delta * HQ_DELAY_COMP; - /* Core switching done in DFT domain afterward*/ - if ( ( st->element_mode != IVAS_CPE_DFT || use_cldfb_for_dft ) && ( !sba_dirac_stereo_flag || ( sba_dirac_stereo_flag && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) ) - { - if ( st->core == HQ_CORE || st->core == TCX_20_CORE || st->core == TCX_10_CORE || ( st->core == ACELP_CORE && st->bfi == 1 && st->con_tcx == 1 ) ) + if (core_switching_flag && st->last_core == HQ_CORE && st->prev_bfi) { - st->use_acelp_preq = 0; - if ( st->hBWE_FD != NULL ) - { - st->hBWE_FD->mem_deemph_old_syn = 0.0f; - } - - if ( st->element_mode == EVS_MONO && st->core == HQ_CORE ) /* ACELP->HQ-CORE */ - { - if ( core_switching_flag && st->last_L_frame == st->last_L_frame_ori && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) ) - { - if ( ( error = acelp_core_switch_dec( st, synth_subfr_out, synth_subfr_bwe, output_frame, core_switching_flag, mem_synth, nchan_out ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( core_switching_flag && st->last_core == HQ_CORE && st->prev_bfi ) - { - mvr2r( st->delay_buf_out, synth_subfr_out, delay_comp ); - } - } + mvr2r(st->delay_buf_out, synth_subfr_out, delay_comp); + } + } - /* delay HQ synthesis to synchronize with ACELP synthesis */ -#ifdef IVAS_FLOAT_FIXED - floatToFixed_arrL(synth, synth_fx, Q11, 960); - floatToFixed_arrL(st->delay_buf_out, st->delay_buf_out32_fx, Q11, 60); + /* delay HQ synthesis to synchronize with ACELP synthesis */ + delay_signal_float(synth, output_frame, st->delay_buf_out, delay_comp); - delay_signal_fx( synth_fx, output_frame, st->delay_buf_out32_fx, delay_comp ); + if (st->element_mode == EVS_MONO && st->core == HQ_CORE) /* ACELP->HQ-CORE */ + { + if (core_switching_flag && st->last_L_frame == st->last_L_frame_ori && (st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE)) + { + core_switching_OLA(mem_synth, st->last_L_frame, st->output_Fs, synth, synth_subfr_out, synth_subfr_bwe, output_frame, st->bwidth); + } + else if (core_switching_flag && st->last_core == HQ_CORE && st->prev_bfi) /* HQ | ACELP | TRANSITION with ACELP frame lost */ + { + /* Overlap between old->out[] (stocked in st->fer_samples[]) and good HQ frame on L/2 */ + nZeros = (int16_t)(NS2SA(st->output_Fs, N_ZERO_MDCT_NS)); + tmpDelta = 1.0f / (float)(output_frame >> 1); + for (i = 0; i < (output_frame >> 1); i++) + { + tmpF = (float)i * tmpDelta; + synth[i + delay_comp] = (1 - tmpF) * st->hHQ_core->fer_samples[i + nZeros] + synth[i + delay_comp] * tmpF; + } + } + else if ((!core_switching_flag && st->core == HQ_CORE && (st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE)) || /* ACELP | TRANSITION | HQ with TRANSITION lost */ + (core_switching_flag && st->prev_bfi && st->last_L_frame != st->last_L_frame_ori)) /* ACELP@12k8 | ACELP@16k | TRANSITION with ACELP@16k lost */ + { + /* Overlap between CELP estimation (BFI) and good HQ frame on L/2 */ + tmpDelta = 1.0f / (float)(output_frame >> 1); + for (i = 0; i < (output_frame >> 1); i++) + { + tmpF = (float)i * tmpDelta; + synth[i] = synth[i] * tmpF + (1 - tmpF) * st->hHQ_core->fer_samples[i]; + } + } + } + else if (((st->last_core == ACELP_CORE || st->last_core_bfi == ACELP_CORE) && !(st->prev_bfi == 1 && st->last_con_tcx == 1)) || st->last_core == AMR_WB_CORE) /*ACELP->TCX/HQ*/ + { + /* if this is first active MDCT-Stereo frame after a CNG frame and output format is mono DMX, this should only be done for the zero-th channel, the other one will simply be copied over after this function */ + if (((st->last_core_brate != SID_2k40 && st->last_core_brate != FRAME_NO_DATA) || (st->element_mode != IVAS_CPE_DFT && st->element_mode != IVAS_CPE_TD) || nchan_out == 1) && !(st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 && (nchan_out == 1 || last_element_mode == IVAS_CPE_DFT))) + { + core_switch_lb_upsamp(st, output); + } - fixedToFloat_arrL(synth_fx, synth, Q11, 960); - fixedToFloat_arrL(st->delay_buf_out32_fx, st->delay_buf_out, Q11, 60); -#else - delay_signal_float( synth, output_frame, st->delay_buf_out, delay_comp ); -#endif + mvr2r(st->previoussynth, synth, delay_comp); - if ( st->element_mode == EVS_MONO && st->core == HQ_CORE ) /* ACELP->HQ-CORE */ - { - if ( core_switching_flag && st->last_L_frame == st->last_L_frame_ori && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) ) - { - core_switching_OLA( mem_synth, st->last_L_frame, st->output_Fs, synth, synth_subfr_out, synth_subfr_bwe, output_frame, st->bwidth ); - } - else if ( core_switching_flag && st->last_core == HQ_CORE && st->prev_bfi ) /* HQ | ACELP | TRANSITION with ACELP frame lost */ - { - /* Overlap between old->out[] (stocked in st->fer_samples[]) and good HQ frame on L/2 */ - nZeros = (int16_t) ( NS2SA( st->output_Fs, N_ZERO_MDCT_NS ) ); - tmpDelta = 1.0f / (float) ( output_frame >> 1 ); - for ( i = 0; i < ( output_frame >> 1 ); i++ ) - { - tmpF = (float) i * tmpDelta; - synth[i + delay_comp] = ( 1 - tmpF ) * st->hHQ_core->fer_samples[i + nZeros] + synth[i + delay_comp] * tmpF; - } - } - else if ( ( !core_switching_flag && st->core == HQ_CORE && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) ) || /* ACELP | TRANSITION | HQ with TRANSITION lost */ - ( core_switching_flag && st->prev_bfi && st->last_L_frame != st->last_L_frame_ori ) ) /* ACELP@12k8 | ACELP@16k | TRANSITION with ACELP@16k lost */ - { - /* Overlap between CELP estimation (BFI) and good HQ frame on L/2 */ - tmpDelta = 1.0f / (float) ( output_frame >> 1 ); - for ( i = 0; i < ( output_frame >> 1 ); i++ ) - { - tmpF = (float) i * tmpDelta; - synth[i] = synth[i] * tmpF + ( 1 - tmpF ) * st->hHQ_core->fer_samples[i]; - } - } - } - else if ( ( ( st->last_core == ACELP_CORE || st->last_core_bfi == ACELP_CORE ) && !( st->prev_bfi == 1 && st->last_con_tcx == 1 ) ) || st->last_core == AMR_WB_CORE ) /*ACELP->TCX/HQ*/ - { - /* if this is first active MDCT-Stereo frame after a CNG frame and output format is mono DMX, this should only be done for the zero-th channel, the other one will simply be copied over after this function */ - if ( ( ( st->last_core_brate != SID_2k40 && st->last_core_brate != FRAME_NO_DATA ) || ( st->element_mode != IVAS_CPE_DFT && st->element_mode != IVAS_CPE_TD ) || nchan_out == 1 ) && !( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 && ( nchan_out == 1 || last_element_mode == IVAS_CPE_DFT ) ) ) - { - core_switch_lb_upsamp( st, output ); - } + /* Overlap between TCX-LB and TCX-FB*/ + tmpDelta = NS2SA(st->output_Fs, DELAY_BWE_TOTAL_NS); + for (i = 0; i < tmpDelta; i++) + { + synth[i + delay_comp] = (synth[i + delay_comp] * i + (tmpDelta - i) * st->previoussynth[i + delay_comp]) / tmpDelta; + } - mvr2r( st->previoussynth, synth, delay_comp ); + if ((st->element_mode == IVAS_CPE_MDCT || (ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */)) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40) + { + /* smooth transitions to avoid pops in car noise items */ + smoothTransitionDtxToTcx(synth, output_frame, delay_comp); + } - /* Overlap between TCX-LB and TCX-FB*/ - tmpDelta = NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS ); - for ( i = 0; i < tmpDelta; i++ ) - { - synth[i + delay_comp] = ( synth[i + delay_comp] * i + ( tmpDelta - i ) * st->previoussynth[i + delay_comp] ) / tmpDelta; - } + /* Reset memories of CLDFBs */ + if (st->cldfbAna != NULL) + { + if (st->cldfbAna->no_channels * st->cldfbAna->no_col != st->L_frame) + { + configureCldfb_ivas(st->cldfbAna, st->L_frame * FRAMES_PER_SEC); + configureCldfb_ivas(st->cldfbBPF, min(16000, st->L_frame * FRAMES_PER_SEC)); + } - if ( ( st->element_mode == IVAS_CPE_MDCT || ( ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) - { - /* smooth transitions to avoid pops in car noise items */ -#ifdef IVAS_FLOAT_FIXED + cldfb_reset_memory_ivas(st->cldfbAna); + cldfb_reset_memory_ivas(st->cldfbBPF); + } + cldfb_reset_memory_ivas(st->cldfbSyn); - for ( int lp = 0; lp < 960; lp++ ) - { - synth_fx[lp] = (Word32) ( synth[lp] * ( 1u << 4 ) ); - } - smoothTransitionDtxToTcx_fx( synth_fx, output_frame, delay_comp ); - for ( int lp = 0; lp < 2 * delay_comp; lp++ ) - { - synth[lp] = (float) synth_fx[lp] / ( 1u << 4 ); - } -#else - smoothTransitionDtxToTcx( synth, output_frame, delay_comp ); -#endif - } + /* Update memories for CLDFB ana for eventual next ACELP frame */ + if (st->cldfbAna != NULL) + { + delta = st->cldfbAna->no_channels; + offset = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; + for (i = 0; i < delta; i++) + { + st->cldfbAna->cldfb_state[offset - delta + i] = + output[st->L_frame - delta + i] * ((float)(i + 1)) / ((float)delta); + } + } + } + else if (st->element_mode != EVS_MONO) + { + /* Reset memories of CLDFBs */ + if (st->cldfbAna != NULL) + { + if (st->cldfbAna->no_channels * st->cldfbAna->no_col != st->L_frame) + { + configureCldfb_ivas(st->cldfbAna, st->L_frame * FRAMES_PER_SEC); + configureCldfb_ivas(st->cldfbBPF, min(16000, st->L_frame * FRAMES_PER_SEC)); + } - /* Reset memories of CLDFBs */ - if ( st->cldfbAna != NULL ) - { - if ( st->cldfbAna->no_channels * st->cldfbAna->no_col != st->L_frame ) - { - configureCldfb_ivas( st->cldfbAna, st->L_frame * FRAMES_PER_SEC ); - configureCldfb_ivas( st->cldfbBPF, min( 16000, st->L_frame * FRAMES_PER_SEC ) ); - } + cldfb_reset_memory_ivas(st->cldfbAna); + cldfb_reset_memory_ivas(st->cldfbBPF); + } - cldfb_reset_memory_ivas( st->cldfbAna ); - cldfb_reset_memory_ivas( st->cldfbBPF ); - } - cldfb_reset_memory_ivas( st->cldfbSyn ); + if (st->cldfbSyn != NULL) + { + cldfb_reset_memory_ivas(st->cldfbSyn); + } - /* Update memories for CLDFB ana for eventual next ACELP frame */ - if ( st->cldfbAna != NULL ) - { - delta = st->cldfbAna->no_channels; - offset = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; - for ( i = 0; i < delta; i++ ) - { - st->cldfbAna->cldfb_state[offset - delta + i] = - output[st->L_frame - delta + i] * ( (float) ( i + 1 ) ) / ( (float) delta ); - } - } - } - else if ( st->element_mode != EVS_MONO ) - { - /* Reset memories of CLDFBs */ - if ( st->cldfbAna != NULL ) - { - if ( st->cldfbAna->no_channels * st->cldfbAna->no_col != st->L_frame ) - { - configureCldfb_ivas( st->cldfbAna, st->L_frame * FRAMES_PER_SEC ); - configureCldfb_ivas( st->cldfbBPF, min( 16000, st->L_frame * FRAMES_PER_SEC ) ); - } + /* Update memories for CLDFB ana for eventual next ACELP frame */ + /* Analysis CLDF memory is fed with ramped signal for last slot */ + if (st->cldfbAna != NULL) + { + delta = st->cldfbAna->no_channels; + offset = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; + for (i = 0; i < delta; i++) + { + st->cldfbAna->cldfb_state[offset - delta + i] = + output[st->L_frame - delta + i] * ((float)(i + 1)) / ((float)delta); + } + } + } - cldfb_reset_memory_ivas( st->cldfbAna ); - cldfb_reset_memory_ivas( st->cldfbBPF ); - } + if (st->hBWE_TD != NULL) + { + st->hBWE_TD->bwe_non_lin_prev_scale = 0.0; + } - if ( st->cldfbSyn != NULL ) - { - cldfb_reset_memory_ivas( st->cldfbSyn ); - } + if (st->hHQ_core != NULL && !(inner_frame_tbl[st->bwidth] == L_FRAME16k && st->core_brate <= HQ_32k)) + { + set_f(st->hHQ_core->prev_env, 0, SFM_N_WB); + set_f(st->hHQ_core->prev_normq, 0, SFM_N_WB); + } - /* Update memories for CLDFB ana for eventual next ACELP frame */ - /* Analysis CLDF memory is fed with ramped signal for last slot */ - if ( st->cldfbAna != NULL ) - { - delta = st->cldfbAna->no_channels; - offset = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; - for ( i = 0; i < delta; i++ ) - { - st->cldfbAna->cldfb_state[offset - delta + i] = - output[st->L_frame - delta + i] * ( (float) ( i + 1 ) ) / ( (float) delta ); - } - } - } + mvr2r(synth, st->previoussynth, output_frame); - if ( st->hBWE_TD != NULL ) - { - st->hBWE_TD->bwe_non_lin_prev_scale = 0.0; - } + /*Set post-filtering flag to zero*/ + if (st->hBPF != NULL) + { + st->hPFstat->on = 0; + } +} + else + { + /* MDCT to ACELP transition */ + if (st->last_core == HQ_CORE || st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE) + { + nZeros = (int16_t)(NS2SA(st->output_Fs, N_ZERO_MDCT_NS)); + mvr2r(st->delay_buf_out, synth, delay_comp); /* copy the HQ/ACELP delay synchronization buffer at the beginning of ACELP frame */ - if ( st->hHQ_core != NULL && !( inner_frame_tbl[st->bwidth] == L_FRAME16k && st->core_brate <= HQ_32k ) ) - { - set_f( st->hHQ_core->prev_env, 0, SFM_N_WB ); - set_f( st->hHQ_core->prev_normq, 0, SFM_N_WB ); - } + if (st->prev_bfi && st->hHQ_core != NULL && st->hHQ_core->HqVoicing && st->last_core == HQ_CORE) + { + mvr2r(st->hHQ_core->fer_samples, st->hHQ_core->old_out + nZeros, NS2SA(st->output_Fs, 3000000)); + } - mvr2r( synth, st->previoussynth, output_frame ); + tmpF = 1.0f / (float)NS2SA(st->output_Fs, 3000000); - /*Set post-filtering flag to zero*/ - if ( st->hBPF != NULL ) - { - st->hPFstat->on = 0; - } + if (st->element_mode == IVAS_CPE_TD && st->hHQ_core == NULL) + { + for (i = 0; i < NS2SA(st->output_Fs, 3000000); i++) + { + synth[i + delay_comp] = (1 - tmpF * (float)i) * output_mem[i] + tmpF * (float)i * synth[i + delay_comp]; + } + } + else if (st->element_mode == IVAS_CPE_MDCT && st->core_brate <= SID_2k40 && st->prev_bfi) + { + for (i = 0; i < NS2SA(st->output_Fs, 3000000); i++) + { + synth[i + delay_comp] = (1 - tmpF * (float)i) * st->hHQ_core->old_out[i + nZeros] * st->hTcxDec->conceal_eof_gain_float + tmpF * (float)i * synth[i + delay_comp]; + } } else { - /* MDCT to ACELP transition */ - if ( st->last_core == HQ_CORE || st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE ) - { - nZeros = (int16_t) ( NS2SA( st->output_Fs, N_ZERO_MDCT_NS ) ); - mvr2r( st->delay_buf_out, synth, delay_comp ); /* copy the HQ/ACELP delay synchronization buffer at the beginning of ACELP frame */ - - if ( st->prev_bfi && st->hHQ_core != NULL && st->hHQ_core->HqVoicing && st->last_core == HQ_CORE ) - { - mvr2r( st->hHQ_core->fer_samples, st->hHQ_core->old_out + nZeros, NS2SA( st->output_Fs, 3000000 ) ); - } - - tmpF = 1.0f / (float) NS2SA( st->output_Fs, 3000000 ); - - if ( st->element_mode == IVAS_CPE_TD && st->hHQ_core == NULL ) - { - for ( i = 0; i < NS2SA( st->output_Fs, 3000000 ); i++ ) - { - synth[i + delay_comp] = ( 1 - tmpF * (float) i ) * output_mem[i] + tmpF * (float) i * synth[i + delay_comp]; - } - } - else if ( st->element_mode == IVAS_CPE_MDCT && st->core_brate <= SID_2k40 && st->prev_bfi ) - { - for ( i = 0; i < NS2SA( st->output_Fs, 3000000 ); i++ ) - { - synth[i + delay_comp] = ( 1 - tmpF * (float) i ) * st->hHQ_core->old_out[i + nZeros] * st->hTcxDec->conceal_eof_gain_float + tmpF * (float) i * synth[i + delay_comp]; - } - } - else - { - for ( i = 0; i < NS2SA( st->output_Fs, 3000000 ); i++ ) - { - synth[i + delay_comp] = ( 1 - tmpF * (float) i ) * st->hHQ_core->old_out[i + nZeros] + tmpF * (float) i * synth[i + delay_comp]; - } - } - } - - set_f( st->delay_buf_out, 0, HQ_DELTA_MAX * HQ_DELAY_COMP ); - if ( st->hHQ_core != NULL ) - { - st->hHQ_core->oldHqVoicing = 0; - } + for (i = 0; i < NS2SA(st->output_Fs, 3000000); i++) + { + synth[i + delay_comp] = (1 - tmpF * (float)i) * st->hHQ_core->old_out[i + nZeros] + tmpF * (float)i * synth[i + delay_comp]; + } } - } - else - { - /* memory update needed for DFT stereo -> TD stereo switching */ - mvr2r( synth + output_frame - delay_comp, st->delay_buf_out, delay_comp ); - } + } - /* reset SWB BWE buffers */ - if ( st->bws_cnt == 0 || ( st->bws_cnt > 0 && st->coder_type != INACTIVE && st->coder_type != AUDIO ) ) - { - st->attenu1 = 0.1f; + set_f(st->delay_buf_out, 0, HQ_DELTA_MAX * HQ_DELAY_COMP); + if (st->hHQ_core != NULL) + { + st->hHQ_core->oldHqVoicing = 0; + } } + } + else + { + /* memory update needed for DFT stereo -> TD stereo switching */ + mvr2r(synth + output_frame - delay_comp, st->delay_buf_out, delay_comp); + } - if ( st->hBWE_FD != NULL && - ( ( st->last_extl != SWB_BWE && st->extl == SWB_BWE ) || ( st->last_extl != FB_BWE && st->extl == FB_BWE ) || - ( ( st->last_core == HQ_CORE || st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE || st->last_extl == SWB_TBE ) && st->extl < 0 && st->core == ACELP_CORE ) || ( st->last_core == ACELP_CORE && st->core == ACELP_CORE && ( ( st->prev_coder_type != INACTIVE && st->coder_type != INACTIVE ) || ( st->prev_coder_type != AUDIO && st->coder_type == AUDIO ) ) && st->bws_cnt > 0 ) ) ) - { - set_f( st->hBWE_FD->old_wtda_swb, 0, output_frame ); - - if ( st->last_extl != WB_BWE ) - { - st->hBWE_FD->prev_mode = NORMAL; - } + /* reset SWB BWE buffers */ + if (st->bws_cnt == 0 || (st->bws_cnt > 0 && st->coder_type != INACTIVE && st->coder_type != AUDIO)) + { + st->attenu1 = 0.1f; + } - st->hBWE_FD->prev_Energy = 0.0f; - st->hBWE_FD->prev_L_swb_norm = 8; - st->hBWE_FD->prev_frica_flag = 0; - set_f( st->hBWE_FD->mem_imdct, 0, L_FRAME48k ); - st->hBWE_FD->prev_td_energy = 0.0f; - st->hBWE_FD->prev_weight = 0.2f; - st->hBWE_FD->prev_fb_ener_adjust = 0.0f; - } + if (st->hBWE_FD != NULL && + ((st->last_extl != SWB_BWE && st->extl == SWB_BWE) || (st->last_extl != FB_BWE && st->extl == FB_BWE) || + ((st->last_core == HQ_CORE || st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE || st->last_extl == SWB_TBE) && st->extl < 0 && st->core == ACELP_CORE) || (st->last_core == ACELP_CORE && st->core == ACELP_CORE && ((st->prev_coder_type != INACTIVE && st->coder_type != INACTIVE) || (st->prev_coder_type != AUDIO && st->coder_type == AUDIO)) && st->bws_cnt > 0))) + { + set_f(st->hBWE_FD->old_wtda_swb, 0, output_frame); - /* reset WB BWE buffers */ - if ( st->last_extl != WB_BWE && st->extl == WB_BWE && st->hBWE_FD != NULL ) + if (st->last_extl != WB_BWE) { - set_f( st->hBWE_FD->old_wtda_swb, 0, output_frame ); + st->hBWE_FD->prev_mode = NORMAL; + } - if ( st->last_extl != SWB_BWE && st->last_extl != FB_BWE ) - { - st->hBWE_FD->prev_mode = NORMAL; - } + st->hBWE_FD->prev_Energy = 0.0f; + st->hBWE_FD->prev_L_swb_norm = 8; + st->hBWE_FD->prev_frica_flag = 0; + set_f(st->hBWE_FD->mem_imdct, 0, L_FRAME48k); + st->hBWE_FD->prev_td_energy = 0.0f; + st->hBWE_FD->prev_weight = 0.2f; + st->hBWE_FD->prev_fb_ener_adjust = 0.0f; + } - st->hBWE_FD->prev_Energy_wb = 0.0f; - st->hBWE_FD->prev_L_swb_norm = 8; - set_f( st->hBWE_FD->mem_imdct, 0, L_FRAME48k ); - st->hBWE_FD->prev_flag = 0; - } + /* reset WB BWE buffers */ + if (st->last_extl != WB_BWE && st->extl == WB_BWE && st->hBWE_FD != NULL) + { + set_f(st->hBWE_FD->old_wtda_swb, 0, output_frame); - /* reset TBE buffers */ - if ( st->hBWE_TD != NULL ) + if (st->last_extl != SWB_BWE && st->last_extl != FB_BWE) { - /* reset SWB TBE buffers */ - if ( ( ( st->extl == SWB_TBE || st->extl == FB_TBE || st->extl == SWB_CNG ) && - ( st->L_frame != st->last_L_frame || ( st->last_extl != SWB_TBE && st->last_extl != FB_TBE && st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE ) || st->last_core == HQ_CORE ) ) || - ( st->bwidth < st->last_bwidth && st->last_extl != SWB_TBE ) || st->old_ppp_mode || ( ( st->prev_coder_type == AUDIO || st->prev_coder_type == INACTIVE ) && st->bws_cnt > 0 ) || ( st->bws_cnt == 0 && st->prev_bws_cnt == N_WS2N_FRAMES ) ) - { - swb_tbe_reset( st->hBWE_TD->mem_csfilt, st->hBWE_TD->mem_genSHBexc_filt_down_shb, st->hBWE_TD->state_lpc_syn, st->hBWE_TD->syn_overlap, st->hBWE_TD->state_syn_shbexc, &( st->hBWE_TD->tbe_demph ), &( st->hBWE_TD->tbe_premph ), st->hBWE_TD->mem_stp_swb, &( st->hBWE_TD->gain_prec_swb ) ); + st->hBWE_FD->prev_mode = NORMAL; + } - /* reset GainShape delay for SWB TBE FEC */ - set_f( st->hBWE_TD->GainShape_Delay, 0, NUM_SHB_SUBFR / 2 ); + st->hBWE_FD->prev_Energy_wb = 0.0f; + st->hBWE_FD->prev_L_swb_norm = 8; + set_f(st->hBWE_FD->mem_imdct, 0, L_FRAME48k); + st->hBWE_FD->prev_flag = 0; + } - swb_tbe_reset_synth( st->hBWE_TD->genSHBsynth_Hilbert_Mem, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local ); + /* reset TBE buffers */ + if (st->hBWE_TD != NULL) + { + /* reset SWB TBE buffers */ + if (((st->extl == SWB_TBE || st->extl == FB_TBE || st->extl == SWB_CNG) && + (st->L_frame != st->last_L_frame || (st->last_extl != SWB_TBE && st->last_extl != FB_TBE && st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE) || st->last_core == HQ_CORE)) || + (st->bwidth < st->last_bwidth && st->last_extl != SWB_TBE) || st->old_ppp_mode || ((st->prev_coder_type == AUDIO || st->prev_coder_type == INACTIVE) && st->bws_cnt > 0) || (st->bws_cnt == 0 && st->prev_bws_cnt == N_WS2N_FRAMES)) + { + swb_tbe_reset(st->hBWE_TD->mem_csfilt, st->hBWE_TD->mem_genSHBexc_filt_down_shb, st->hBWE_TD->state_lpc_syn, st->hBWE_TD->syn_overlap, st->hBWE_TD->state_syn_shbexc, &(st->hBWE_TD->tbe_demph), &(st->hBWE_TD->tbe_premph), st->hBWE_TD->mem_stp_swb, &(st->hBWE_TD->gain_prec_swb)); - if ( output_frame == L_FRAME16k ) - { - set_f( st->hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); /* reset in case that SWB TBE layer is transmitted, but the output is 16kHz sampled */ - } + /* reset GainShape delay for SWB TBE FEC */ + set_f(st->hBWE_TD->GainShape_Delay, 0, NUM_SHB_SUBFR / 2); - set_f( st->hBWE_TD->int_3_over_2_tbemem_dec, 0.0f, INTERP_3_2_MEM_LEN ); - st->hBWE_TD->prev_pow_exc16kWhtnd = 1.0f; - st->hBWE_TD->prev_mix_factor = 1.0f; - } - else if ( ( st->extl == SWB_TBE || st->extl == FB_TBE ) && ( ( st->element_mode == IVAS_CPE_TD && st->last_extl != SWB_TBE && st->last_extl != FB_TBE ) || ( st->element_mode != IVAS_CPE_TD && st->last_total_brate != st->total_brate ) || ( st->last_bwidth != st->bwidth ) || ( st->last_codec_mode != MODE1 ) || ( st->rf_flag != st->rf_flag_last ) ) ) - { - set_f( st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER ); - set_f( st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD ); - set_f( st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER ); - set_f( st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); - st->hBWE_TD->gain_prec_swb = 1.0f; - } - else if ( st->hBWE_TD != NULL && ( st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE ) ) - { - TBEreset_dec( st ); - } + swb_tbe_reset_synth(st->hBWE_TD->genSHBsynth_Hilbert_Mem, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local); - /* reset FB TBE buffers */ - if ( ( st->L_frame != st->last_L_frame || st->last_extl != FB_TBE ) && st->extl == FB_TBE ) - { - set_f( st->hBWE_TD->fb_state_lpc_syn, 0, LPC_SHB_ORDER ); - st->hBWE_TD->fb_tbe_demph = 0; - fb_tbe_reset_synth( st->hBWE_TD->fbbwe_hpf_mem, &st->hBWE_TD->prev_fbbwe_ratio ); - } + if (output_frame == L_FRAME16k) + { + set_f(st->hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1); /* reset in case that SWB TBE layer is transmitted, but the output is 16kHz sampled */ + } - /* reset WB TBE buffers */ - if ( st->last_extl != WB_TBE && st->extl == WB_TBE && st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE ) - { - wb_tbe_extras_reset( st->hBWE_TD->mem_genSHBexc_filt_down_wb2, st->hBWE_TD->mem_genSHBexc_filt_down_wb3 ); - wb_tbe_extras_reset_synth( st->hBWE_TD->state_lsyn_filt_shb, st->hBWE_TD->state_lsyn_filt_dwn_shb, st->hBWE_TD->mem_resamp_HB ); + set_f(st->hBWE_TD->int_3_over_2_tbemem_dec, 0.0f, INTERP_3_2_MEM_LEN); + st->hBWE_TD->prev_pow_exc16kWhtnd = 1.0f; + st->hBWE_TD->prev_mix_factor = 1.0f; + } + else if ((st->extl == SWB_TBE || st->extl == FB_TBE) && ((st->element_mode == IVAS_CPE_TD && st->last_extl != SWB_TBE && st->last_extl != FB_TBE) || (st->element_mode != IVAS_CPE_TD && st->last_total_brate != st->total_brate) || (st->last_bwidth != st->bwidth) || (st->last_codec_mode != MODE1) || (st->rf_flag != st->rf_flag_last))) + { + set_f(st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER); + set_f(st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD); + set_f(st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER); + set_f(st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER); + st->hBWE_TD->gain_prec_swb = 1.0f; + } + else if (st->hBWE_TD != NULL && (st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE)) + { + TBEreset_dec(st); + } - set_f( st->hBWE_TD->state_syn_shbexc, 0, L_SHB_LAHEAD / 4 ); - set_f( st->hBWE_TD->syn_overlap, 0, L_SHB_LAHEAD ); - set_f( st->hBWE_TD->mem_csfilt, 0, 2 ); - } + /* reset FB TBE buffers */ + if ((st->L_frame != st->last_L_frame || st->last_extl != FB_TBE) && st->extl == FB_TBE) + { + set_f(st->hBWE_TD->fb_state_lpc_syn, 0, LPC_SHB_ORDER); + st->hBWE_TD->fb_tbe_demph = 0; + fb_tbe_reset_synth(st->hBWE_TD->fbbwe_hpf_mem, &st->hBWE_TD->prev_fbbwe_ratio); } - /* Interp_3_2 CNG buffers reset */ - if ( st->hTdCngDec != NULL && st->output_Fs == 48000 && ( st->last_core_brate > SID_2k40 ) && ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->hTdCngDec != NULL ) + /* reset WB TBE buffers */ + if (st->last_extl != WB_TBE && st->extl == WB_TBE && st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE) { - set_f( st->hTdCngDec->interpol_3_2_cng_dec, 0.0f, INTERP_3_2_MEM_LEN ); + wb_tbe_extras_reset(st->hBWE_TD->mem_genSHBexc_filt_down_wb2, st->hBWE_TD->mem_genSHBexc_filt_down_wb3); + wb_tbe_extras_reset_synth(st->hBWE_TD->state_lsyn_filt_shb, st->hBWE_TD->state_lsyn_filt_dwn_shb, st->hBWE_TD->mem_resamp_HB); + + set_f(st->hBWE_TD->state_syn_shbexc, 0, L_SHB_LAHEAD / 4); + set_f(st->hBWE_TD->syn_overlap, 0, L_SHB_LAHEAD); + set_f(st->hBWE_TD->mem_csfilt, 0, 2); } + } - return error; + /* Interp_3_2 CNG buffers reset */ + if (st->hTdCngDec != NULL && st->output_Fs == 48000 && (st->last_core_brate > SID_2k40) && (st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40) && st->hTdCngDec != NULL) + { + set_f(st->hTdCngDec->interpol_3_2_cng_dec, 0.0f, INTERP_3_2_MEM_LEN); + } + + return error; } + #endif /*---------------------------------------------------------------------* * core_switching_hq_prepare_dec() diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 3c5cd9a64..390fc1ae4 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -2178,13 +2178,13 @@ static ivas_error ivas_mc_dec_reconfig( { return error; } -#endif // IVAS_FLOAT_FIXED +#else // IVAS_FLOAT_FIXED /*To be removed later: Contains memory allocations for floating point buffers*/ - //if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - //{ - // return error; - //} - + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded separately after the allocation of the core coders *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 3d8c0efb5..848c602fc 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -763,12 +763,12 @@ ivas_error ivas_sba_dec_reconfigure( { return error; } -#endif // IVAS_FLOAT_FIXED - //if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - //{ - // return error; - //} - +#else + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif /*-----------------------------------------------------------------* * TD Decorrelator *-----------------------------------------------------------------*/ @@ -2154,7 +2154,6 @@ ivas_error ivas_sba_dec_render( output_f_local[ch] = output_f[ch]; } - slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ @@ -2173,113 +2172,7 @@ ivas_error ivas_sba_dec_render( { int16_t n_samples_sf = slot_size * hSpar->subframe_nbslots[subframe_idx]; -#ifdef IVAS_FLOAT_FIXED1 -#if 1 /*Float to fixed conversion*/ - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - Word16 num_spar_bands = hSpar->hFbMixer->pFb->filterbank_num_bands; - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_out_dirac = hDecoderConfig->nchan_out; - - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - - for ( int i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } -#endif -#if 0 - Word16 q1 = 30, q2 = 30; - for ( int l = 0; l < numch_out; l++ ) - { - for ( int j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed(hSpar->hMdDec->mixer_mat[l][j][k] , q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l] , q2 ); - } - } - } - } -#endif -#if 1 - for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); - } - } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } -#endif // - ivas_spar_dec_upmixer_sf_fx( st_ivas, output_f_local_fx, nchan_internal ); -#ifdef IVAS_FLOAT_FIXED /*Fixed to float */ - FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ - } - } -#if 0 - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q7 ) ) ); /*Rounding off*/ - } - } - } -#endif -#else ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); -#endif // IVAS_FLOAT_FIXED for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] += n_samples_sf; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 5ec2167a7..b37c4720f 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -45,7 +45,7 @@ #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif // IVAS_FLOAT_FIXED - +#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------------------------* * Local constants @@ -1332,7 +1332,6 @@ static void ivas_dec_mono_sba_handling_fx( return; } - #endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* @@ -3510,7 +3509,6 @@ static void ivas_decode_arith_bs( return; } - /*-----------------------------------------------------------------------------------------* * Function ivas_fill_band_coeffs_idx() * @@ -3903,6 +3901,7 @@ static void ivas_spar_md_fill_invalid_bands( } #endif +#ifdef IVAS_FLOAT_FIXED static void ivas_spar_md_fill_invalid_bandcoeffs( ivas_band_coeffs_t *pBand_coeffs, ivas_band_coeffs_t *pBand_coeffs_prev, @@ -3991,7 +3990,87 @@ static void ivas_spar_md_fill_invalid_bandcoeffs( return; } +#else +static void ivas_spar_md_fill_invalid_bandcoeffs( + ivas_band_coeffs_t *pBand_coeffs, + ivas_band_coeffs_t *pBand_coeffs_prev, + const int16_t *valid_bands, + int16_t *base_band_age, + int16_t *first_valid_frame, + const int16_t num_bands ) +{ + int16_t j, k, b, all_valid; + int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], idx = -1; + int16_t last_valid_band_idx[IVAS_MAX_NUM_BANDS]; + float w = 0; + + ivas_spar_plc_get_band_age( valid_bands, base_band_age, num_bands, + last_valid_band_idx, valid_band_idx, &all_valid, &idx ); + + assert( idx > 0 ); /* some bands should be valid */ + + if ( all_valid == 0 ) + { + for ( b = 0; b < num_bands; b++ ) + { + /* check against non zero in if and else if */ + if ( ( base_band_age[b] > 3 ) || ( *first_valid_frame == 0 ) ) /* old invalid bands */ + { + int16_t id0, id1; + ivas_spar_get_plc_interp_weights( valid_band_idx, last_valid_band_idx[b], + idx, b, &w, &id0, &id1 ); + + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].pred_re[j] = ( 1 - w ) * pBand_coeffs[id0].pred_re[j] + w * pBand_coeffs[id1].pred_re[j]; + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; j++ ) + { + for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) + { + pBand_coeffs[b].C_re[j][k] = ( 1 - w ) * pBand_coeffs[id0].C_re[j][k] + w * pBand_coeffs[id1].C_re[j][k]; + } + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].P_re[j] = ( 1 - w ) * pBand_coeffs[id0].P_re[j] + w * pBand_coeffs[id1].P_re[j]; + } + } + else /* young invalid bands */ + { + if ( valid_bands[b] == 0 ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].pred_re[j] = pBand_coeffs_prev[b].pred_re[j]; + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; j++ ) + { + for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) + { + pBand_coeffs[b].C_re[j][k] = pBand_coeffs_prev[b].C_re[j][k]; + } + } + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].P_re[j] = pBand_coeffs_prev[b].P_re[j]; + } + } + } + } + } + else + { + *first_valid_frame = 1; + } + + return; +} +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_spar_dec_compute_ramp_down_post_matrix_fx() @@ -5234,3 +5313,2686 @@ void ivas_spar_to_dirac_fx( } #endif +#else + +/*------------------------------------------------------------------------------------------* + * Local constants + *------------------------------------------------------------------------------------------*/ + +#define IVAS_DEFAULT_DTX_CNG_RAMP ( 8 ) + +/* PLC constants */ +static const int16_t ivas_spar_dec_plc_num_frames_keep = 9; +static const int16_t ivas_spar_dec_plc_num_frames_fade_out = 9; +static const int16_t ivas_spar_dec_plc_per_frame_ramp_down_gain_dB = 3; +static const int16_t ivas_spar_dec_plc_max_num_frames_ramp_down = 33; +static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0, 0, 0, 0, 0, 0, 0 }; + + +/*------------------------------------------------------------------------------------------* + * Static functions declaration + *------------------------------------------------------------------------------------------*/ + +static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t numch_out, const int16_t active_w_vlbr, const int16_t dyn_active_w_flag ); + +static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t strat, const int32_t ivas_total_brate ); + +static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw ); + +static void ivas_fill_band_coeffs_idx( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, int16_t *pSymbol_re, ivas_cell_dim_t *pCell_dims, ivas_coeffs_type_t coeff_type ); + +static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, float ***mixer_mat, const int16_t bands, const int16_t num_ch ); + +static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands, const int16_t bfi, const int16_t num_md_sub_frames ); + +static void ivas_spar_md_fill_invalid_bands( ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, const int16_t num_bands, const int16_t numch_out, const int16_t num_md_sub_frames ); + +static void ivas_spar_md_fill_invalid_bandcoeffs( ivas_band_coeffs_t *pBand_coeffs, ivas_band_coeffs_t *pBand_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, int16_t *first_valid_frame, const int16_t num_bands ); +static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, const int16_t nchan_transport, float *pFC ); + +static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); + +static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); + +static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode +); + + +/*------------------------------------------------------------------------- + * ivas_spar_md_dec_matrix_open() + * + * Allocate and initialize SPAR MD decoder matrices + *------------------------------------------------------------------------*/ + +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 /* i : number of MD subframes */ +) +{ + int16_t i, j; + int16_t k; + if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * num_md_sub_frames * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); + } + if ( ( hMdDec->band_coeffs_prev = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); + } + if ( ( hMdDec->mixer_mat = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( i = 0; i < num_channels; i++ ) + { + if ( ( hMdDec->mixer_mat[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( j = 0; j < num_channels; j++ ) + { + if ( ( hMdDec->mixer_mat[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + } + } + + if ( ( hMdDec->spar_coeffs.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( i = 0; i < num_channels; i++ ) + { + if ( ( hMdDec->spar_coeffs.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( j = 0; j < num_channels; j++ ) + { + if ( ( hMdDec->spar_coeffs.C_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + } + } + + if ( ( hMdDec->spar_coeffs.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( i = 0; i < num_channels; i++ ) + { + if ( ( hMdDec->spar_coeffs.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( j = 0; j < num_channels; j++ ) + { + if ( ( hMdDec->spar_coeffs.P_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + } + } + + if ( ( hMdDec->spar_coeffs_prev.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( i = 0; i < num_channels; i++ ) + { + if ( ( hMdDec->spar_coeffs_prev.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( j = 0; j < num_channels; j++ ) + { + if ( ( hMdDec->spar_coeffs_prev.C_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + } + } + + if ( ( hMdDec->spar_coeffs_prev.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( i = 0; i < num_channels; i++ ) + { + if ( ( hMdDec->spar_coeffs_prev.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( j = 0; j < num_channels; j++ ) + { + if ( ( hMdDec->spar_coeffs_prev.P_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + } + } + + if ( ( hMdDec->spar_coeffs_tar.C_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( i = 0; i < num_channels; i++ ) + { + if ( ( hMdDec->spar_coeffs_tar.C_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( j = 0; j < num_channels; j++ ) + { + if ( ( hMdDec->spar_coeffs_tar.C_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + } + } + + if ( ( hMdDec->spar_coeffs_tar.P_re = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( i = 0; i < num_channels; i++ ) + { + if ( ( hMdDec->spar_coeffs_tar.P_re[i] = (float **) malloc( num_channels * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + for ( j = 0; j < num_channels; j++ ) + { + if ( ( hMdDec->spar_coeffs_tar.P_re[i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); + } + } + } + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_prev.C_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_prev.P_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_tar.C_re[i][j][k] = 0.0f; + hMdDec->spar_coeffs_tar.P_re[i][j][k] = 0.0f; + } + } + } + + 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, /* i : IVAS total bitrate */ + const int32_t ivas_last_active_brate /* i : IVAS last active bitrate */ +) +{ + int16_t num_subframes; + + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + if ( sba_order > SBA_FOA_ORDER ) + { + if ( ivas_total_brate >= IVAS_512k ) + { + num_subframes = 1; + } + } + + if ( ( ivas_total_brate <= IVAS_SID_5k2 && ivas_last_active_brate < IVAS_24k4 ) || ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate < IVAS_24k4 ) ) + { + + num_subframes = 1; + } + + return ( num_subframes ); +} + + +/*------------------------------------------------------------------------- + * ivas_spar_md_dec_open() + * + * Allocate and initialize SPAR MD decoder handle + *------------------------------------------------------------------------*/ + +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 */ + const int16_t sba_order, /* i : SBA order */ + const int16_t sid_format, /* i : SID format */ + const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */ +) +{ + ivas_spar_md_dec_state_t *hMdDec; + ivas_error error; + int16_t num_md_sub_frames; + + error = IVAS_ERR_OK; + + if ( ( hMdDec = (ivas_spar_md_dec_state_t *) malloc( sizeof( ivas_spar_md_dec_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD decoder" ); + } + + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate, last_active_ivas_total_brate ); + + if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) + { + if ( sid_format == SID_SBA_2TC ) + { + hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } + else + { + hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_24k4, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } + } + else + { + hMdDec->table_idx = ivas_get_spar_table_idx( hDecoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } + + if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) + { + return error; + } + + *hMdDec_out = hMdDec; + + return error; +} + + +/*------------------------------------------------------------------------- + * ivas_spar_md_dec_matrix_close() + * + * Deallocate SPAR MD decoder matrices + *------------------------------------------------------------------------*/ + +void ivas_spar_md_dec_matrix_close( + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels /* i : number of internal channels */ +) +{ + int16_t i, j; + + if ( hMdDecoder->spar_md.band_coeffs != NULL ) + { + free( hMdDecoder->spar_md.band_coeffs ); + hMdDecoder->spar_md.band_coeffs = NULL; + } + if ( hMdDecoder->band_coeffs_prev != NULL ) + { + free( hMdDecoder->band_coeffs_prev ); + hMdDecoder->band_coeffs_prev = NULL; + } + + if ( hMdDecoder->mixer_mat != NULL ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + free( hMdDecoder->mixer_mat[i][j] ); + } + free( hMdDecoder->mixer_mat[i] ); + } + free( hMdDecoder->mixer_mat ); + } + + if ( hMdDecoder->spar_coeffs.C_re != NULL ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + free( hMdDecoder->spar_coeffs.C_re[i][j] ); + } + free( hMdDecoder->spar_coeffs.C_re[i] ); + } + free( hMdDecoder->spar_coeffs.C_re ); + } + + if ( hMdDecoder->spar_coeffs.P_re != NULL ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + free( hMdDecoder->spar_coeffs.P_re[i][j] ); + } + free( hMdDecoder->spar_coeffs.P_re[i] ); + } + free( hMdDecoder->spar_coeffs.P_re ); + } + + if ( hMdDecoder->spar_coeffs_prev.C_re != NULL ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + free( hMdDecoder->spar_coeffs_prev.C_re[i][j] ); + } + free( hMdDecoder->spar_coeffs_prev.C_re[i] ); + } + free( hMdDecoder->spar_coeffs_prev.C_re ); + } + + if ( hMdDecoder->spar_coeffs_prev.P_re != NULL ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + free( hMdDecoder->spar_coeffs_prev.P_re[i][j] ); + } + free( hMdDecoder->spar_coeffs_prev.P_re[i] ); + } + free( hMdDecoder->spar_coeffs_prev.P_re ); + } + + if ( hMdDecoder->spar_coeffs_tar.C_re != NULL ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + free( hMdDecoder->spar_coeffs_tar.C_re[i][j] ); + } + free( hMdDecoder->spar_coeffs_tar.C_re[i] ); + } + free( hMdDecoder->spar_coeffs_tar.C_re ); + } + + if ( hMdDecoder->spar_coeffs_tar.P_re != NULL ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + free( hMdDecoder->spar_coeffs_tar.P_re[i][j] ); + } + free( hMdDecoder->spar_coeffs_tar.P_re[i] ); + } + free( hMdDecoder->spar_coeffs_tar.P_re ); + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_spar_md_dec_close() + * + * Deallocate SPAR MD decoder handle + *------------------------------------------------------------------------*/ + +void ivas_spar_md_dec_close( + ivas_spar_md_dec_state_t **hMdDec /* i/o: SPAR MD decoder handle */ +) +{ + ivas_spar_md_dec_state_t *hMdDecoder; + int16_t num_channels; + + hMdDecoder = *hMdDec; + num_channels = hMdDecoder->spar_md_cfg.num_umx_chs; + + ivas_spar_md_dec_matrix_close( hMdDecoder, num_channels ); + + free( *hMdDec ); + *hMdDec = NULL; + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_md_dec_init() + * + * SPAR MD decoder initialization + *-----------------------------------------------------------------------------------------*/ + +ivas_error ivas_spar_md_dec_init( + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t sba_order /* i : SBA order */ +) +{ + int16_t i, j; + int16_t nchan_transport; + float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; + ivas_error error; + + ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate, &hMdDec->spar_hoa_md_flag, &hMdDec->spar_hoa_dirac2spar_md_flag ); + + ivas_sba_get_spar_hoa_ch_ind( num_channels, hDecoderConfig->ivas_total_brate, hMdDec->HOA_md_ind ); + + hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + + ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands, hMdDec->spar_hoa_dirac2spar_md_flag, 0, 0, 0 ); + + nchan_transport = hMdDec->spar_md_cfg.nchan_transport; + + /* get FB coefficients */ + for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + pFC[i] = ivas_fb_fcs_12band_1ms[i] * hDecoderConfig->output_Fs * 0.5f; + } + + if ( ( error = ivas_spar_set_dec_config( hMdDec, nchan_transport, pFC ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( nchan_transport != 2 && ( ( hMdDec->spar_md_cfg.remix_unmix_order == 2 ) || ( hMdDec->spar_md_cfg.remix_unmix_order == 1 ) ) ) + { + return IVAS_ERR_INTERNAL; + } + + /* DTX quant init */ + PR_minmax[0] = hMdDec->spar_md_cfg.quant_strat[0].PR.min; + PR_minmax[1] = hMdDec->spar_md_cfg.quant_strat[0].PR.max; + ivas_spar_quant_dtx_init( &hMdDec->spar_md, PR_minmax ); + + ivas_spar_arith_coeffs_com_init( &hMdDec->arith_coeffs, &hMdDec->spar_md_cfg, hMdDec->table_idx, DEC ); + ivas_spar_huff_coeffs_com_init( &hMdDec->huff_coeffs, &hMdDec->spar_md_cfg, hMdDec->table_idx, DEC ); + + hMdDec->spar_md_cfg.prev_quant_idx = -1; + + /* initialize PLC state */ + set_s( hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); + set_s( hMdDec->base_band_age, 0, IVAS_MAX_NUM_BANDS ); + set_s( hMdDec->base_band_coeffs_age, 0, IVAS_MAX_NUM_BANDS ); + hMdDec->spar_plc_num_lost_frames = 0; + hMdDec->spar_plc_enable_fadeout_flag = 1; + hMdDec->dtx_md_smoothing_cntr = 1; + + ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeffs( hMdDec->band_coeffs_prev, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeff_idx( hMdDec->spar_md.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); + ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS ); + + hMdDec->spar_md.dtx_vad = 0; + hMdDec->td_decorr_flag = 1; + + set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); + set_f( hMdDec->spar_md.ref_pow_slow, 0.0f, IVAS_MAX_NUM_BANDS ); + + set_zero( hMdDec->smooth_fac, IVAS_MAX_NUM_BANDS ); + for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + set_zero( hMdDec->smooth_buf[i], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + + for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH; j++ ) + { + set_zero( hMdDec->mixer_mat_prev2[i][j], IVAS_MAX_NUM_BANDS ); + } + } + hMdDec->first_valid_frame = 1; + + return IVAS_ERR_OK; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_set_dec_config() + * + * Set configuration for SPAR MD decoder + *-----------------------------------------------------------------------------------------*/ + +static ivas_error ivas_spar_set_dec_config( + ivas_spar_md_dec_state_t *hMdDec, + const int16_t nchan_transport, + float *pFC ) +{ + int16_t i, j, nchan, dmx_ch; + + for ( i = 0; i < nchan_transport; i++ ) + { + hMdDec->spar_md_cfg.max_freq_per_chan[i] = ivas_spar_br_table_consts[hMdDec->table_idx].fpcs; + } + + nchan = ivas_sba_get_nchan_metadata( ivas_spar_br_table_consts[hMdDec->table_idx].sba_order, ivas_spar_br_table_consts[hMdDec->table_idx].ivas_total_brate ); + + switch ( nchan ) + { + case 4: /* FOA_CHANNELS */ + hMdDec->num_decorr = IVAS_TD_DECORR_OUT_3CH; + break; + case 9: /* IVAS_HOA_2_CH */ + hMdDec->num_decorr = IVAS_TD_DECORR_OUT_5CH; + break; + case 6: /* IVAS_HOA_2_CH */ + hMdDec->num_decorr = IVAS_TD_DECORR_OUT_2CH; + break; + case 8: /* IVAS_HOA_3_CH */ + hMdDec->num_decorr = IVAS_TD_DECORR_OUT_4CH; + break; + } + + hMdDec->spar_md_cfg.num_umx_chs = nchan; + + dmx_ch = 0; + for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + dmx_ch = 0; + for ( j = 0; j < nchan_transport; j++ ) + { + if ( pFC[i] < hMdDec->spar_md_cfg.max_freq_per_chan[j] ) + { + dmx_ch += 1; + } + } + + hMdDec->spar_md_cfg.num_dmx_chans_per_band[i] = hMdDec->spar_md_cfg.nchan_transport; + hMdDec->spar_md_cfg.num_decorr_per_band[i] = nchan - hMdDec->spar_md_cfg.nchan_transport; + } + + hMdDec->spar_md_cfg.nchan_transport = dmx_ch; + + return IVAS_ERR_OK; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_dec_mono_sba_handling() + * + * + *-----------------------------------------------------------------------------------------*/ + +static void ivas_dec_mono_sba_handling( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + int16_t mono_flag, b, block; + + mono_flag = 1; + + for ( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + float azimuth = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth[block]; + float elevation = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth[block]; + float energy_ratio = st_ivas->hQMetaData->q_direction[0].band_data[0].energy_ratio[block]; + if ( + ( azimuth != 0.0f ) || + ( elevation != 0.0f ) || + ( energy_ratio > 0.15f ) ) /* 0.15f is just above the lowest quantised value. */ + { + mono_flag = 0; + } + } + } + + /* Combine the SPAR prediction coefs flag with the azimuth, elevation and energy ratio flag.*/ + mono_flag = mono_flag && ivas_spar_chk_zero_coefs( st_ivas ); + + if ( mono_flag ) + { + /* Set Energy Ratio values to be zero */ + for ( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + set_zero( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + if ( st_ivas->hDirAC != NULL ) + { + for ( block = 0; block < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; ++block ) + { + /* Set directional Energy Ratio values to be zero */ + set_zero( st_ivas->hSpatParamRendCom->energy_ratio1[block], st_ivas->hSpatParamRendCom->num_freq_bands ); + if ( st_ivas->hQMetaData->no_directions == 2 ) + { + set_zero( st_ivas->hSpatParamRendCom->energy_ratio2[block], st_ivas->hSpatParamRendCom->num_freq_bands ); + } + /* Set Diffuseness values to be 1.0 */ + set_f( st_ivas->hSpatParamRendCom->diffuseness_vector[block], 1.0f, st_ivas->hSpatParamRendCom->num_freq_bands ); + } + } + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_md_dec_process() + * + * SPAR Meta Data decoder process + *-----------------------------------------------------------------------------------------*/ + +void ivas_spar_md_dec_process( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ +) +{ + int16_t j, k, b, bw, dtx_vad, nB, i_ts; + ivas_spar_md_dec_state_t *hMdDec; + int16_t num_md_chs; + int16_t num_md_sub_frames; + int16_t dyn_active_w_flag; + int16_t active_w_vlbr; + + hMdDec = st_ivas->hSpar->hMdDec; + + active_w_vlbr = ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; + + num_md_chs = ivas_sba_get_nchan_metadata( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); + + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + + if ( hMdDec->spar_md_cfg.nchan_transport > 1 && hMdDec->spar_md_cfg.nchan_transport <= 3 ) + { + hMdDec->spar_md.res_ind = 0; + dyn_active_w_flag = get_next_indice( st0, 1 ); + if ( dyn_active_w_flag == 1 ) + { + if ( hMdDec->spar_md_cfg.nchan_transport == 2 ) + { + hMdDec->spar_md.res_ind = get_next_indice( st0, 1 ); + hMdDec->spar_md.res_ind += hMdDec->spar_md_cfg.nchan_transport; + } + else if ( hMdDec->spar_md_cfg.nchan_transport == 3 ) + { + hMdDec->spar_md.res_ind = remix_order_set[hMdDec->spar_md_cfg.remix_unmix_order][hMdDec->spar_md_cfg.nchan_transport]; + } + } + } + else + { + dyn_active_w_flag = 0; + if ( hMdDec->spar_md_cfg.nchan_transport == FOA_CHANNELS ) + { + get_next_indice( st0, 1 ); + } + } + + ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, + st_ivas->hQMetaData->sba_inactive_mode + ); + + assert( nB == hMdDec->spar_md.num_bands ); + assert( bw == 1 ); + ivas_spar_md_fill_invalid_bandcoeffs( + hMdDec->spar_md.band_coeffs, + hMdDec->band_coeffs_prev, + &hMdDec->valid_bands[0], + &hMdDec->base_band_coeffs_age[0], + &hMdDec->first_valid_frame, + nB ); + + ivas_dec_mono_sba_handling( st_ivas ); + + /* SPAR to DirAC conversion */ + if ( hMdDec->spar_hoa_dirac2spar_md_flag == 1 ) + { + ivas_spar_to_dirac( st_ivas, hMdDec, dtx_vad, num_bands_out, bw, dyn_active_w_flag ); + } + + /* set correct number of bands*/ + nB = IVAS_MAX_NUM_BANDS; + + /* expand DirAC MD to all time slots */ + for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) + { + for ( b = 0; b < hMdDec->spar_md.num_bands; b++ ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re[j] = hMdDec->spar_md.band_coeffs[b].pred_re[j]; + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; j++ ) + { + for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) + { + hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re[j][k] = hMdDec->spar_md.band_coeffs[b].C_re[j][k]; + } + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re[j] = hMdDec->spar_md.band_coeffs[b].P_re[j]; + } + } + } + + ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, num_md_chs, active_w_vlbr, dyn_active_w_flag ); + +#ifdef DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS + { + static FILE *fid = 0; + int16_t band = 9; + if ( !fid ) + { + fid = fopen( "pred_coeffs_dec.txt", "wt" ); + } + fprintf( fid, "%.6f\n", hMdDec->mixer_mat[1][0][band] ); + } +#endif + ivas_spar_md_fill_invalid_bands( &hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, num_md_chs, num_md_sub_frames ); + + + hMdDec->dtx_md_smoothing_cntr = 1; + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_chk_zero_coefs() + * + * Check for zeroed SPAR coefficients + *-----------------------------------------------------------------------------------------*/ + +int16_t ivas_spar_chk_zero_coefs( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + int16_t j, k, b; + ivas_spar_md_dec_state_t *hMdDec; + int16_t mono = 1; + int16_t ndec, ndm; + + hMdDec = st_ivas->hSpar->hMdDec; + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[0]; + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[0]; + + for ( b = 0; b < min( hMdDec->spar_md.num_bands, SPAR_DIRAC_SPLIT_START_BAND ); b++ ) + { + for ( j = 0; j < ndm + ndec - 1; j++ ) + { + if ( hMdDec->spar_md.band_coeffs[b].pred_re[j] != 0.0f ) + { + mono = 0; + } + } + for ( j = 0; j < ndec; j++ ) + { + for ( k = 0; k < ndm - 1; k++ ) + { + if ( hMdDec->spar_md.band_coeffs[b].C_re[j][k] != 0.0f ) + { + mono = 0; + } + } + } + for ( j = 0; j < ndec; j++ ) + { + if ( hMdDec->spar_md.band_coeffs[b].P_re[j] != 0.0f ) + { + mono = 0; + } + } + } + + return mono; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_smooth_md_dtx() + * + * Smooth MD during no data frame during DTX + *-----------------------------------------------------------------------------------------*/ + +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 */ +) +{ + int16_t j, k, b, dmx_ch; + float ramp, tar, prev, new_val; + + ramp = (float) hMdDec->dtx_md_smoothing_cntr / IVAS_DEFAULT_DTX_CNG_RAMP; + + for ( b = 0; b < num_bands_out; b++ ) + { + dmx_ch = hMdDec->spar_md_cfg.num_dmx_chans_per_band[b]; + + for ( j = 1; j < FOA_CHANNELS; j++ ) + { + for ( k = dmx_ch; k < FOA_CHANNELS; k++ ) + { + prev = hMdDec->spar_coeffs_prev.P_re[j][k][b]; + tar = hMdDec->spar_coeffs_tar.P_re[j][k][b]; + new_val = prev + ( ramp * ( tar - prev ) ); + hMdDec->spar_coeffs.P_re[j][k][b] = new_val; + } + } + + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + for ( k = 0; k < dmx_ch; k++ ) + { + prev = hMdDec->spar_coeffs_prev.C_re[j][k][b]; + tar = hMdDec->spar_coeffs_tar.C_re[j][k][b]; + new_val = prev + ( ramp * ( tar - prev ) ); + hMdDec->spar_coeffs.C_re[j][k][b] = new_val; + } + } + } + + /* expand MD to all time slots */ + for ( int16_t i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) + { + for ( b = 0; b < num_bands_out; b++ ) + { + dmx_ch = hMdDec->spar_md_cfg.num_dmx_chans_per_band[b]; + + for ( j = 1; j < FOA_CHANNELS; j++ ) + { + for ( k = dmx_ch; k < FOA_CHANNELS; k++ ) + + { + hMdDec->spar_coeffs.P_re[j][k][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.P_re[j][k][b]; + } + } + + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + for ( k = 0; k < dmx_ch; k++ ) + { + hMdDec->spar_coeffs.C_re[j][k][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.C_re[j][k][b]; + } + } + } + } + + hMdDec->dtx_md_smoothing_cntr = min( hMdDec->dtx_md_smoothing_cntr + 1, IVAS_DEFAULT_DTX_CNG_RAMP ); + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_setup_md_smoothing() + * + * Set up smoothing of SPAR MD when SID update frame is received + *-----------------------------------------------------------------------------------------*/ + +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 */ +) +{ + /* copy the coeffs */ + int16_t num_channels, i, j, k; + + num_channels = hMdDec->spar_md_cfg.num_umx_chs; + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_prev.C_re[i][j][k] = hMdDec->spar_coeffs_tar.C_re[i][j][k]; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_prev.P_re[i][j][k] = hMdDec->spar_coeffs_tar.P_re[i][j][k]; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_tar.C_re[i][j][k] = hMdDec->spar_coeffs.C_re[i][j][k]; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_tar.P_re[i][j][k] = hMdDec->spar_coeffs.P_re[i][j][k]; + } + } + } + + ivas_spar_smooth_md_dtx( hMdDec, num_bands_out, num_md_sub_frames ); + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_update_md_hist() + * + * Update previous and target MD + *-----------------------------------------------------------------------------------------*/ + +void ivas_spar_update_md_hist( + ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */ +) +{ + int16_t num_channels, i, j, k; + + num_channels = hMdDec->spar_md_cfg.num_umx_chs; + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_prev.C_re[i][j][k] = hMdDec->spar_coeffs.C_re[i][j][k]; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_prev.P_re[i][j][k] = hMdDec->spar_coeffs.P_re[i][j][k]; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_tar.C_re[i][j][k] = hMdDec->spar_coeffs.C_re[i][j][k]; + } + } + } + + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMdDec->spar_coeffs_tar.P_re[i][j][k] = hMdDec->spar_coeffs.P_re[i][j][k]; + } + } + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_get_spar_matrices() + * + * Get SPAR matrices + *-----------------------------------------------------------------------------------------*/ + +static void ivas_get_spar_matrices( + ivas_spar_md_dec_state_t *hMdDec, + const int16_t num_bands_out, + const int16_t n_ts, + const int16_t bw, + const int16_t dtx_vad, + const int16_t nB, + const int16_t numch_out, + const int16_t active_w_vlbr, + const int16_t dyn_active_w_flag ) +{ + int16_t num_bands, dmx_ch, split_band; + int16_t i, j, k, m, b, i_ts, active_w; + const int16_t *order; + float active_w_dm_fac, re; + + + num_bands = num_bands_out; + order = remix_order_set[hMdDec->spar_md_cfg.remix_unmix_order]; + + split_band = SPAR_DIRAC_SPLIT_START_BAND; + if ( split_band >= IVAS_MAX_NUM_BANDS ) + { + /*store previous 4x4 parameters for linear interpolation to current*/ + for ( i = 0; i < numch_out; i++ ) + { + for ( j = 0; j < numch_out; j++ ) + { + for ( b = 0; b < num_bands; b++ ) + { + hMdDec->mixer_mat_prev[0][i][j][b] = hMdDec->mixer_mat[i][j][b]; + } + } + } + } + + if ( bw == IVAS_RED_BAND_FACT ) + { + num_bands = num_bands >> 1; + } + + active_w = ( dyn_active_w_flag == 1 ) || ( hMdDec->spar_md_cfg.active_w == 1 ); + active_w_dm_fac = ( dtx_vad == 0 ) ? IVAS_ACTIVEW_DM_F_SCALE_DTX : ( ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE ); + + for ( i_ts = 0; i_ts < n_ts; i_ts++ ) + { + for ( i = 0; i < numch_out; i++ ) + { + for ( j = 0; j < numch_out; j++ ) + { + set_zero( &hMdDec->spar_coeffs.C_re[i][j][i_ts * IVAS_MAX_NUM_BANDS], IVAS_MAX_NUM_BANDS ); + set_zero( &hMdDec->spar_coeffs.P_re[i][j][i_ts * IVAS_MAX_NUM_BANDS], IVAS_MAX_NUM_BANDS ); + } + } + num_bands = min( num_bands, nB ); + + for ( b = 0; b < num_bands; b++ ) + { + float tmp_C1_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float tmp_C2_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float tmp_dm_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + + dmx_ch = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bw * b]; + + for ( j = 0; j < numch_out; j++ ) + { + set_zero( tmp_C1_re[j], numch_out ); + set_zero( tmp_C2_re[j], numch_out ); + set_zero( tmp_dm_re[j], numch_out ); + + tmp_C1_re[j][j] = 1.0f; + tmp_C2_re[j][j] = 1.0f; + tmp_dm_re[j][j] = 1.0f; + } + + for ( j = 1; j < numch_out; j++ ) + { + tmp_C1_re[j][0] = hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re[j - 1]; + } + + if ( active_w == 1 ) + { + for ( j = 1; j < numch_out; j++ ) + { + tmp_C2_re[0][j] = active_w_dm_fac * -hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].pred_re[j - 1]; + } + + IVAS_RMULT_FLOAT( tmp_C2_re[0][1], tmp_C1_re[1][0], re ); + tmp_dm_re[0][0] = 1 + re; + + IVAS_RMULT_FLOAT( tmp_C2_re[0][2], tmp_C1_re[2][0], re ); + tmp_dm_re[0][0] += re; + + IVAS_RMULT_FLOAT( tmp_C2_re[0][3], tmp_C1_re[3][0], re ); + tmp_dm_re[0][0] += re; + + if ( dyn_active_w_flag == 1 ) + { + tmp_dm_re[0][0] *= IVAS_SPAR_DYN_ACTIVEW_THRESH; + } + + tmp_dm_re[0][1] = tmp_C2_re[0][1]; + + tmp_dm_re[0][2] = tmp_C2_re[0][2]; + + tmp_dm_re[0][3] = tmp_C2_re[0][3]; + + tmp_dm_re[1][0] = tmp_C1_re[1][0]; + + tmp_dm_re[2][0] = tmp_C1_re[2][0]; + + tmp_dm_re[3][0] = tmp_C1_re[3][0]; + + if ( hMdDec->spar_md_cfg.remix_unmix_order != 3 ) + { + ivas_mat_col_rearrange( tmp_dm_re, order, i_ts, hMdDec->mixer_mat, b, numch_out ); + } + } + else + { + if ( hMdDec->spar_md_cfg.remix_unmix_order != 3 ) + { + ivas_mat_col_rearrange( tmp_C1_re, order, i_ts, hMdDec->mixer_mat, b, numch_out ); + } + } + + if ( dmx_ch > 0 ) + { + float tmpC_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float tmpP_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + + for ( j = 0; j < numch_out; j++ ) + { + set_zero( tmpC_re[j], numch_out ); + set_zero( tmpP_re[j], numch_out ); + } + + for ( j = 0; j < numch_out; j++ ) + { + set_zero( tmpC_re[j], numch_out ); + } + + for ( k = 0; k < dmx_ch; k++ ) + { + tmpC_re[k][k] = 1; + } + + for ( j = dmx_ch; j < numch_out; j++ ) + { + for ( k = 1; k < dmx_ch; k++ ) + { + tmpC_re[j][k] = hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re[j - dmx_ch][k - 1]; + } + } + + for ( j = dmx_ch; j < numch_out; j++ ) + { + for ( k = dmx_ch; k < numch_out; k++ ) + { + if ( ( j - dmx_ch ) == ( k - dmx_ch ) ) + { + tmpP_re[j][k] = hMdDec->spar_md.band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].P_re[k - dmx_ch]; + } + else + { + tmpP_re[j][k] = 0; + } + } + } + + for ( j = 1; j < numch_out; j++ ) + { + for ( k = dmx_ch; k < numch_out; k++ ) + { + for ( m = 0; m < numch_out; m++ ) + { + IVAS_RMULT_FLOAT( hMdDec->mixer_mat[j][m][b + i_ts * IVAS_MAX_NUM_BANDS], tmpP_re[m][k], re ); + hMdDec->spar_coeffs.P_re[j][k][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] += re; + } + } + } + + for ( j = 0; j < numch_out; j++ ) + { + for ( k = 0; k < dmx_ch; k++ ) + { + for ( m = 0; m < numch_out; m++ ) + { + IVAS_RMULT_FLOAT( hMdDec->mixer_mat[j][m][b + i_ts * IVAS_MAX_NUM_BANDS], tmpC_re[m][k], re ); + hMdDec->spar_coeffs.C_re[j][k][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] += re; + } + } + } + + hMdDec->spar_coeffs.C_re[0][0][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] = + max( 0, hMdDec->spar_coeffs.C_re[0][0][( b * bw ) + i_ts * IVAS_MAX_NUM_BANDS] ); + } + } + + /* band mixing */ + if ( bw == IVAS_RED_BAND_FACT ) + { + for ( b = 0; b < num_bands_out; b = b + bw ) + { + dmx_ch = hMdDec->spar_md_cfg.num_dmx_chans_per_band[b]; + for ( j = 0; j < numch_out; j++ ) + { + for ( k = dmx_ch; k < numch_out; k++ ) + { + hMdDec->spar_coeffs.P_re[j][k][( b + 1 ) + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.P_re[j][k][b + i_ts * IVAS_MAX_NUM_BANDS]; + } + } + + for ( j = 0; j < numch_out; j++ ) + { + for ( k = 0; k < dmx_ch; k++ ) + { + hMdDec->spar_coeffs.C_re[j][k][( b + 1 ) + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.C_re[j][k][b + i_ts * IVAS_MAX_NUM_BANDS]; + } + } + } + } + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_mat_col_rearrange() + * + * reorders the input matrix based on order + *-----------------------------------------------------------------------------------------*/ + +static void ivas_mat_col_rearrange( + float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + const int16_t order[IVAS_SPAR_MAX_CH], + const int16_t i_ts, + float ***mixer_mat, + const int16_t bands, + const int16_t num_ch ) +{ + int16_t i, j, idx; + + for ( i = 0; i < num_ch; i++ ) + { + idx = order[i]; + + for ( j = 0; j < num_ch; j++ ) + { + mixer_mat[j][i][bands + i_ts * IVAS_MAX_NUM_BANDS] = in_re[j][idx]; + } + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_dec_gen_umx_mat() + * + * generates upmix matrix + *-----------------------------------------------------------------------------------------*/ + +void ivas_spar_dec_gen_umx_mat( + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t bfi, /* i : bad frame indicator */ + const int16_t num_md_sub_frames ) +{ + int16_t i, j, b, i_ts, num_out_ch; + + num_out_ch = hMdDec->spar_md_cfg.num_umx_chs; + + for ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) + { + if ( hMdDec->td_decorr_flag == 1 ) + { + for ( i = 0; i < num_out_ch; i++ ) + { + for ( j = 0; j < nchan_transport; j++ ) + { + for ( b = 0; b < num_bands_out; b++ ) + { + hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS]; + } + } + } + + for ( i = 0; i < num_out_ch; i++ ) + { + for ( j = nchan_transport; j < num_out_ch; j++ ) + { + for ( b = 0; b < num_bands_out; b++ ) + { + hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS]; + } + } + } + } + else + { + for ( i = 0; i < num_out_ch; i++ ) + { + for ( j = 0; j < nchan_transport; j++ ) + { + for ( b = 0; b < num_bands_out; b++ ) + { + hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS]; + } + } + } + } + + } + + ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi, num_md_sub_frames ); + + return; +} + +static void ivas_spar_md_band_upmix( + ivas_band_coeffs_t *band_coeffs, + int16_t *nB, + int16_t *bands_bw, + int16_t *valid_bands, + int16_t bw_final, + int16_t ndec, + int16_t ndm ) +{ + int16_t i, ii, jj, b, idx, bw_fact; + + bw_fact = *bands_bw / bw_final; + for ( i = *nB - 1; i >= 0; i-- ) + { + + for ( b = bw_fact - 1; b >= 0; b-- ) + { + idx = i * bw_fact + b; + for ( ii = 0; ii < ndec + ndm - 1; ii++ ) + { + band_coeffs[idx].pred_re[ii] = band_coeffs[i].pred_re[ii]; + } + for ( ii = 0; ii < ndec; ii++ ) + { + for ( jj = 0; jj < ndm - 1; jj++ ) + { + band_coeffs[idx].C_re[ii][jj] = band_coeffs[i].C_re[ii][jj]; + } + } + for ( jj = 0; jj < ndec; jj++ ) + { + band_coeffs[idx].P_re[jj] = band_coeffs[i].P_re[jj]; + } + valid_bands[idx] = valid_bands[i]; + } + } + *nB = ( *nB ) * ( *bands_bw ) / bw_final; + *bands_bw = bw_final; + + return; +} + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_dec_parse_md_bs() + * + * Parse SPAR MD bitstream + *-----------------------------------------------------------------------------------------*/ + +static void ivas_spar_dec_parse_md_bs( + ivas_spar_md_dec_state_t *hMdDec, + Decoder_State *st0, + int16_t *nB, + int16_t *bands_bw, + int16_t *dtx_vad, + const int32_t ivas_total_brate, + const int16_t sba_inactive_mode +) +{ + int16_t i, j, k, num_bands; + int16_t ii, jj, ndec, ndm; + uint16_t qsi; + ivas_quant_strat_t qs; + int16_t strat, no_ec; + int16_t do_diff[IVAS_MAX_NUM_BANDS]; + float quant[IVAS_SPAR_MAX_C_COEFF]; + int16_t do_repeat[IVAS_MAX_NUM_BANDS]; + *dtx_vad = 1; + *bands_bw = 1; + qsi = 0; + num_bands = hMdDec->spar_md.num_bands; + + if ( ivas_total_brate > IVAS_SID_5k2 ) + { + if ( hMdDec->spar_md_cfg.quant_strat_bits > 0 ) + { + if ( ivas_total_brate >= BRATE_SPAR_Q_STRAT ) + { + /*only one bit written for quantization strategy to indicate either a fixed quantization strategy or dtx_vad==0 */ + qsi = get_next_indice( st0, 1 ); + if ( qsi == 1 ) + { + *dtx_vad = 0; + } + } + else + { + if ( sba_inactive_mode == 1 ) + { + *dtx_vad = 0; + qsi = hMdDec->spar_md_cfg.quant_strat_bits + 1; + } + else + { + qsi = get_next_indice( st0, hMdDec->spar_md_cfg.quant_strat_bits ); + } + } + } + else + { + qsi = 0; + } + } + else + { + *dtx_vad = 0; + } + + hMdDec->dtx_vad = *dtx_vad; + + if ( *dtx_vad == 0 ) + { + *nB = SPAR_DTX_BANDS; + *bands_bw = num_bands / *nB; + + for ( i = 0; i < *nB; i++ ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + hMdDec->spar_md.band_coeffs[i].pred_re[j] = 0; + hMdDec->spar_md.band_coeffs[i].P_re[j] = 0; + } + hMdDec->valid_bands[i] = 1; + } + + for ( i = 0; i < num_bands; i++ ) + { + for ( j = 0; j < ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ); j++ ) + { + for ( k = 0; k < ( IVAS_SPAR_MAX_DMX_CHS - 1 ); k++ ) + { + hMdDec->spar_md.band_coeffs[i].C_re[j][k] = 0; + } + } + } + + ivas_parse_parameter_bitstream_dtx( &hMdDec->spar_md, st0, *bands_bw, *nB, hMdDec->spar_md_cfg.num_dmx_chans_per_band, hMdDec->spar_md_cfg.num_decorr_per_band ); + + if ( *bands_bw != 1 ) + { + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[0]; + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[0]; + ivas_spar_md_band_upmix( + hMdDec->spar_md.band_coeffs, + nB, + bands_bw, + hMdDec->valid_bands, + 1, + ndec, + ndm ); + } + + return; + } + + qs = hMdDec->spar_md_cfg.quant_strat[qsi]; + + strat = get_next_indice( st0, 3 ); + + no_ec = 0; + + if ( strat < 2 ) + { + *bands_bw = strat + 1; + *nB = num_bands / *bands_bw; + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = 0; + do_repeat[i] = 0; + } + } + else if ( strat < 4 ) + { + *bands_bw = strat - 1; + *nB = num_bands / *bands_bw; + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = 0; + do_repeat[i] = 0; + } + no_ec = 1; + } + else if ( ivas_total_brate < IVAS_24k4 ) + { + *bands_bw = 2; + *nB = num_bands / *bands_bw; + + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = 0; + do_repeat[i] = ( ( strat % 2 ) == ( ( i + 1 ) % 2 ) ); + } + } + else + { + *bands_bw = 1; + *nB = num_bands; + + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = ( ( ( i + 1 ) & 3 ) != strat - 4 ); + do_repeat[i] = 0; + } + if ( hMdDec->spar_md_cfg.prev_quant_idx >= 0 ) + { + ivas_map_prior_coeffs_quant( &hMdDec->spar_md_prev, &hMdDec->spar_md_cfg, qsi, *nB ); + } + } + hMdDec->spar_md_cfg.prev_quant_idx = qsi; + + if ( no_ec == 0 ) + { + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, strat, ivas_total_brate ); + } + else + { + ivas_decode_huffman_bs( hMdDec, st0, qsi, *nB, *bands_bw ); + } + + for ( i = 0; i < *nB; i++ ) + { + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[( *bands_bw ) * i]; + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[( *bands_bw ) * i]; + + ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].pred_index_re, qs.PR.q_levels[0], qs.PR.min, qs.PR.max, hMdDec->spar_md.band_coeffs[i].pred_re, ndm + ndec - 1 ); + + j = 0; + for ( ii = 0; ii < ndec; ii++ ) + { + for ( jj = 0; jj < ndm - 1; jj++ ) + { + quant[j] = hMdDec->spar_md.band_coeffs[i].C_re[ii][jj]; + j++; + } + } + + ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].drct_index_re, qs.C.q_levels[0], qs.C.min, qs.C.max, quant, ndec * ( ndm - 1 ) ); + + j = 0; + for ( ii = 0; ii < ndec; ii++ ) + { + for ( jj = 0; jj < ndm - 1; jj++ ) + { + hMdDec->spar_md.band_coeffs[i].C_re[ii][jj] = quant[j]; + j++; + } + } + + ivas_deindex_real_index( hMdDec->spar_md.band_coeffs_idx[i].decd_index_re, qs.P_r.q_levels[0], qs.P_r.min, qs.P_r.max, hMdDec->spar_md.band_coeffs[i].P_re, ndm + ndec - 1 ); + + /* Store prior coefficient indices */ + for ( j = 0; j < ndm + ndec - 1; j++ ) + { + hMdDec->spar_md_prev.band_coeffs_idx[i].pred_index_re[j] = hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j]; + } + for ( j = 0; j < ndec * ( ndm - 1 ); j++ ) + { + hMdDec->spar_md_prev.band_coeffs_idx[i].drct_index_re[j] = hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j]; + } + for ( j = 0; j < ndec; j++ ) + { + hMdDec->spar_md_prev.band_coeffs_idx[i].decd_index_re[j] = hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j]; + } + hMdDec->valid_bands[i] |= ( do_diff[i] == 0 && do_repeat[i] == 0 ) ? 1 : 0; + } + + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[0]; + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[0]; + if ( *bands_bw != 1 ) + { + ivas_spar_md_band_upmix( + hMdDec->spar_md.band_coeffs, + nB, + bands_bw, + hMdDec->valid_bands, + 1, + ndec, + ndm ); + } + + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_decode_arith_bs() + * + * Decode bitstream with arith decoder + *-----------------------------------------------------------------------------------------*/ + +static void ivas_decode_arith_bs( + ivas_spar_md_dec_state_t *hMdDec, + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ + const uint16_t qsi, + const int16_t nB, + const int16_t bands_bw, + int16_t *pDo_diff, + const int16_t strat, + const int32_t ivas_total_brate ) +{ + int16_t i, ndm, ndec; + int16_t j; + ivas_cell_dim_t pred_cell_dims[IVAS_MAX_NUM_BANDS]; + ivas_cell_dim_t drct_cell_dims[IVAS_MAX_NUM_BANDS]; + ivas_cell_dim_t decd_cell_dims[IVAS_MAX_NUM_BANDS]; + ivas_cell_dim_t decx_cell_dims[IVAS_MAX_NUM_BANDS]; + int16_t symbol_arr_re[IVAS_MAX_INPUT_LEN]; + int16_t symbol_arr_old_re[IVAS_MAX_INPUT_LEN]; + int16_t any_diff; + + for ( i = 0; i < nB; i++ ) + { + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i]; + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; + if ( ( ivas_total_brate < IVAS_24k4 ) && ( strat > 3 ) && ( ( ( i % 2 == 1 ) && ( strat % 2 == 0 ) ) || ( ( i % 2 == 0 ) && ( strat % 2 == 1 ) ) ) ) + { + pred_cell_dims[i].dim1 = 0; + pred_cell_dims[i].dim2 = 0; + drct_cell_dims[i].dim1 = 0; + drct_cell_dims[i].dim2 = 0; + decd_cell_dims[i].dim1 = 0; + decd_cell_dims[i].dim2 = 0; + decx_cell_dims[i].dim1 = 0; + decx_cell_dims[i].dim2 = 0; + } + else + { + pred_cell_dims[i].dim1 = ndm + ndec - 1; + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) + { + if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + { + pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); + } + } + pred_cell_dims[i].dim2 = 1; + drct_cell_dims[i].dim1 = ndec; + drct_cell_dims[i].dim2 = ndm - 1; + decd_cell_dims[i].dim1 = ndec; + decd_cell_dims[i].dim2 = 1; + decx_cell_dims[i].dim1 = ( ndec * ( ndec - 1 ) ) >> 1; + decx_cell_dims[i].dim2 = 1; + } + } + + any_diff = 0; + for ( i = 0; i < nB; i++ ) + { + if ( pDo_diff[i] != 0 ) + { + any_diff = 1; + break; + } + } + + if ( any_diff == 1 ) + { + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) + { + for ( i = 0; i < nB; i++ ) + { + if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + { + for ( j = 0; j < pred_cell_dims[i].dim1; j++ ) + { + hMdDec->spar_md_prev.band_coeffs_idx_mapped[i].pred_index_re[j] = + hMdDec->spar_md_prev.band_coeffs_idx_mapped[i].pred_index_re[j + ( FOA_CHANNELS - 1 )]; + } + } + } + } + + 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 ); + } + + ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.pred_arith_re[qsi], &hMdDec->arith_coeffs.pred_arith_re_diff[qsi], + st0, pred_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); + + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF ); + + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) + { + for ( i = 0; i < nB; i++ ) + { + if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + { + for ( j = pred_cell_dims[i].dim1 - 1; j >= 0; j-- ) + { + hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j + ( FOA_CHANNELS - 1 )] = + hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j]; + } + for ( j = 0; j < FOA_CHANNELS - 1; j++ ) + { + hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] = 0; + } + } + } + } + + if ( any_diff == 1 ) + { + ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, drct_cell_dims, DRCT_COEFF ); + } + + ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.drct_arith_re[qsi], &hMdDec->arith_coeffs.drct_arith_re_diff[qsi], + st0, drct_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); + + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, drct_cell_dims, DRCT_COEFF ); + + if ( any_diff == 1 ) + { + ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decd_cell_dims, DECD_COEFF ); + } + + ivas_arith_decode_cmplx_cell_array( &hMdDec->arith_coeffs.decd_arith_re[qsi], &hMdDec->arith_coeffs.decd_arith_re_diff[qsi], + st0, decd_cell_dims, pDo_diff, nB, symbol_arr_re, symbol_arr_old_re ); + + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF ); + + if ( any_diff == 1 ) + { + ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF ); + } + + ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF ); + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_fill_band_coeffs_idx() + * + * Copy pred band coeffs to arr + *-----------------------------------------------------------------------------------------*/ + +static void ivas_fill_band_coeffs_idx( + ivas_band_coeffs_ind_t *pBands_idx, + const int16_t nB, + int16_t *pSymbol_re, + ivas_cell_dim_t *pCell_dims, + const ivas_coeffs_type_t coeff_type ) +{ + int16_t i, len; + int16_t *pPtr_idx = NULL; + + for ( i = 0; i < nB; i++ ) + { + switch ( coeff_type ) + { + case PRED_COEFF: + { + pPtr_idx = pBands_idx[i].pred_index_re; + break; + } + case DRCT_COEFF: + { + pPtr_idx = pBands_idx[i].drct_index_re; + break; + } + case DECD_COEFF: + { + pPtr_idx = pBands_idx[i].decd_index_re; + break; + } + case DECX_COEFF: + { + break; + } + + default: + assert( !"unsupported config!" ); + } + + if ( coeff_type != DECX_COEFF ) + { + len = pCell_dims[i].dim1 * pCell_dims[i].dim2; + mvs2s( pSymbol_re, pPtr_idx, len ); + pSymbol_re += len; + } + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_decode_huffman_bs() + * + * Decode bitstream with huffman decoder + *-----------------------------------------------------------------------------------------*/ + +static void ivas_decode_huffman_bs( + ivas_spar_md_dec_state_t *hMdDec, + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ + const uint16_t qsi, + const int16_t nB, + const int16_t bands_bw ) +{ + int16_t i, j; + int16_t ndm, ndec; + int16_t pred_dim, drct_dim, decd_dim, pred_offset; + + for ( i = 0; i < nB; i++ ) + { + ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i]; + ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; + + pred_dim = ndec + ndm - 1; + drct_dim = ndec * ( ndm - 1 ); + decd_dim = ndec; + pred_offset = 0; + + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) + { + if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + { + pred_offset = FOA_CHANNELS - 1; + } + } + + 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] ); + } + + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) + { + if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + { + for ( j = 0; j < pred_offset; j++ ) + { + hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] = 0; + } + } + } + + for ( j = 0; j < drct_dim; j++ ) + { + ivas_huffman_decode( &hMdDec->huff_coeffs.drct_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] ); + } + + for ( j = 0; j < decd_dim; j++ ) + { + ivas_huffman_decode( &hMdDec->huff_coeffs.decd_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] ); + } + } + + return; +} + +static void ivas_spar_plc_get_band_age( + const int16_t *valid_bands, + int16_t *base_band_age, + const int16_t num_bands, + int16_t last_valid_band_idx[IVAS_MAX_NUM_BANDS], + int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], + int16_t *all_valid, + int16_t *b_idx ) +{ + int16_t b, idx; + + set_s( valid_band_idx, 0, IVAS_MAX_NUM_BANDS ); + set_s( last_valid_band_idx, 0, IVAS_MAX_NUM_BANDS ); + idx = -1; + *all_valid = 1; + for ( b = 0; b < num_bands; b++ ) + { + if ( valid_bands[b] != 0 ) + { + base_band_age[b] = 0; /* reset band age */ + idx++; + valid_band_idx[idx] = b; + } + else + { + base_band_age[b] += 1; /* increment the age of invalid bands */ + + if ( base_band_age[b] > 3 ) + { + last_valid_band_idx[b] = idx; + } + *all_valid = 0; + } + } + *b_idx = idx; + + return; +} + +static void ivas_spar_get_plc_interp_weights( + int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], + int16_t last_valid_band_idx, + int16_t idx, + int16_t b, + float *w, + int16_t *id0, + int16_t *id1 ) +{ + if ( last_valid_band_idx < 0 ) /* Extrapolation */ + { + *id1 = valid_band_idx[0]; + *id0 = 0; + *w = 1; + } + else if ( last_valid_band_idx == idx ) /* Extrapolation */ + { + *id1 = valid_band_idx[last_valid_band_idx]; + *id0 = valid_band_idx[last_valid_band_idx]; + *w = 0; + } + else /* Interpolation */ + { + *id0 = valid_band_idx[last_valid_band_idx]; + *id1 = valid_band_idx[last_valid_band_idx + 1]; + *w = ( (float) ( b - *id0 ) ) / ( *id1 - *id0 ); + } + return; +} + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_md_fill_invalid_bands() + * + * Fill invalid bands in interpolation/extrapolation of valid bands + * when PLC is to be done with partial time differential coding + *-----------------------------------------------------------------------------------------*/ +static void ivas_spar_md_fill_invalid_bands( + ivas_spar_dec_matrices_t *pSpar_coeffs, + ivas_spar_dec_matrices_t *pSpar_coeffs_prev, + const int16_t *valid_bands, + int16_t *base_band_age, + const int16_t num_bands, + const int16_t num_channels, + const int16_t num_md_sub_frames ) +{ + int16_t i, j, b, all_valid; + int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], idx = -1; + int16_t last_valid_band_idx[IVAS_MAX_NUM_BANDS]; + float w = 0; + ivas_spar_plc_get_band_age( valid_bands, base_band_age, num_bands, + last_valid_band_idx, valid_band_idx, &all_valid, &idx ); + assert( idx > 0 ); /* some bands should be valid */ + + if ( all_valid == 0 ) + { + for ( b = 0; b < num_bands; b++ ) + { + /* check against non zero in if and else if */ + if ( base_band_age[b] > 3 ) /* old invalid bands */ + { + int16_t id0, id1; + ivas_spar_get_plc_interp_weights( valid_band_idx, last_valid_band_idx[b], + idx, b, &w, &id0, &id1 ); + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + pSpar_coeffs->C_re[i][j][b] = ( 1 - w ) * pSpar_coeffs->C_re[i][j][id0] + w * pSpar_coeffs->C_re[i][j][id1]; + pSpar_coeffs->P_re[i][j][b] = ( 1 - w ) * pSpar_coeffs->P_re[i][j][id0] + w * pSpar_coeffs->P_re[i][j][id1]; + } + } + } + else /* young invalid bands */ + { + if ( valid_bands[b] == 0 ) + { + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + pSpar_coeffs->C_re[i][j][b] = pSpar_coeffs_prev->C_re[i][j][b]; + pSpar_coeffs->P_re[i][j][b] = pSpar_coeffs_prev->P_re[i][j][b]; + } + } + } + } + + if ( valid_bands[b] == 0 ) + { + int16_t i_ts; + for ( i = 0; i < num_channels; i++ ) + { + for ( j = 0; j < num_channels; j++ ) + { + for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) + { + pSpar_coeffs->C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->C_re[i][j][b]; + pSpar_coeffs->P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->P_re[i][j][b]; + } + } + } + } + } + } + + return; +} + +static void ivas_spar_md_fill_invalid_bandcoeffs( + ivas_band_coeffs_t *pBand_coeffs, + ivas_band_coeffs_t *pBand_coeffs_prev, + const int16_t *valid_bands, + int16_t *base_band_age, + int16_t *first_valid_frame, + const int16_t num_bands ) +{ + int16_t j, k, b, all_valid; + int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], idx = -1; + int16_t last_valid_band_idx[IVAS_MAX_NUM_BANDS]; + float w = 0; + + ivas_spar_plc_get_band_age( valid_bands, base_band_age, num_bands, + last_valid_band_idx, valid_band_idx, &all_valid, &idx ); + + assert( idx > 0 ); /* some bands should be valid */ + + if ( all_valid == 0 ) + { + for ( b = 0; b < num_bands; b++ ) + { + /* check against non zero in if and else if */ + if ( ( base_band_age[b] > 3 ) || ( *first_valid_frame == 0 ) ) /* old invalid bands */ + { + int16_t id0, id1; + ivas_spar_get_plc_interp_weights( valid_band_idx, last_valid_band_idx[b], + idx, b, &w, &id0, &id1 ); + + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].pred_re[j] = ( 1 - w ) * pBand_coeffs[id0].pred_re[j] + w * pBand_coeffs[id1].pred_re[j]; + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; j++ ) + { + for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) + { + pBand_coeffs[b].C_re[j][k] = ( 1 - w ) * pBand_coeffs[id0].C_re[j][k] + w * pBand_coeffs[id1].C_re[j][k]; + } + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].P_re[j] = ( 1 - w ) * pBand_coeffs[id0].P_re[j] + w * pBand_coeffs[id1].P_re[j]; + } + } + else /* young invalid bands */ + { + if ( valid_bands[b] == 0 ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].pred_re[j] = pBand_coeffs_prev[b].pred_re[j]; + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; j++ ) + { + for ( k = 0; k < IVAS_SPAR_MAX_DMX_CHS - 1; k++ ) + { + pBand_coeffs[b].C_re[j][k] = pBand_coeffs_prev[b].C_re[j][k]; + } + } + + for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) + { + pBand_coeffs[b].P_re[j] = pBand_coeffs_prev[b].P_re[j]; + } + } + } + } + } + else + { + *first_valid_frame = 1; + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_dec_compute_ramp_down_post_matrix() + * + * + *-----------------------------------------------------------------------------------------*/ + +static void ivas_spar_dec_compute_ramp_down_post_matrix( + ivas_spar_md_dec_state_t *hMdDec, + const int16_t num_bands_out, + const int16_t bfi, + const int16_t num_md_sub_frames ) +{ + int16_t num_in_ch, num_out_ch, i, j, b; + + num_in_ch = hMdDec->spar_md_cfg.num_umx_chs; + num_out_ch = hMdDec->spar_md_cfg.num_umx_chs; + + if ( bfi == 0 ) + { + hMdDec->spar_plc_num_lost_frames = 0; + } + else + { + if ( hMdDec->td_decorr_flag == 0 ) + { + assert( 0 ); + } + + hMdDec->spar_plc_num_lost_frames += 1; + hMdDec->spar_plc_num_lost_frames = min( hMdDec->spar_plc_num_lost_frames, 100 ); + + if ( hMdDec->spar_plc_num_lost_frames > ivas_spar_dec_plc_num_frames_keep ) + { + int16_t num_fade_frames; + int16_t gain_dB; + float gain; + float post_matrix[IVAS_SPAR_MAX_CH]; + + num_fade_frames = max( hMdDec->spar_plc_num_lost_frames - ivas_spar_dec_plc_num_frames_keep, 0 ); + gain_dB = -min( num_fade_frames, ivas_spar_dec_plc_max_num_frames_ramp_down ) * ivas_spar_dec_plc_per_frame_ramp_down_gain_dB; + gain = powf( 10, ( ( (float) gain_dB ) / 20 ) ); + + for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) + { + post_matrix[i] = 1 + min( ( (float) num_fade_frames ) / ivas_spar_dec_plc_num_frames_fade_out, 1 ) * ( ivas_spar_dec_plc_spatial_target[i] - 1 ); + post_matrix[i] *= gain; + } + + /* apply the post matrix */ + for ( int16_t i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) + { + for ( i = 0; i < num_out_ch; i++ ) + { + for ( j = 0; j < num_in_ch; j++ ) + { + for ( b = 0; b < num_bands_out; b++ ) + { + hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] *= post_matrix[i]; + } + } + } + } + } + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_unquant_dtx_indicies() + * + * Unquantize SPAR MD DYX indices + *-----------------------------------------------------------------------------------------*/ + +static void ivas_spar_unquant_dtx_indicies( + ivas_spar_md_t *pSpar_md, + const int16_t nB, + const int16_t bw, + int16_t *ndm_per_band ) +{ + int16_t i, b; + int16_t q_lvl; + float val; + int16_t idx; + float pr_min_max[2]; + + pr_min_max[0] = pSpar_md->min_max[0]; + pr_min_max[1] = pSpar_md->min_max[1]; + + for ( b = 0; b < nB; b++ ) + { + for ( i = 0; i < FOA_CHANNELS - 1; i++ ) + { + q_lvl = dtx_pr_real_q_levels[ndm_per_band[bw * b] - 1][i]; + idx = pSpar_md->band_coeffs_idx[b].pred_index_re[i]; + ivas_deindex_real_index( &idx, q_lvl, pr_min_max[0], pr_min_max[1], &val, 1 ); + pSpar_md->band_coeffs[b].pred_re[i] = val; + } + + for ( i = 0; i < FOA_CHANNELS - ndm_per_band[bw * b]; i++ ) + { + q_lvl = dtx_pd_real_q_levels[ndm_per_band[bw * b] - 1][i]; + idx = pSpar_md->band_coeffs_idx[b].decd_index_re[i]; + ivas_deindex_real_index( &idx, q_lvl, dtx_pd_real_min_max[0], dtx_pd_real_min_max[1], &val, 1 ); + pSpar_md->band_coeffs[b].P_re[i] = val; + } + } + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_parse_parameter_bitstream_dtx() + * + * parse DTX bitstream parameters + *-----------------------------------------------------------------------------------------*/ + +static void ivas_parse_parameter_bitstream_dtx( + ivas_spar_md_t *pSpar_md, + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ + const int16_t bw, + const int16_t num_bands, + int16_t *num_dmx_per_band, + int16_t *num_dec_per_band ) +{ + int16_t i, j, ndec, ndm; + float val; + int16_t idx; + float pr_min_max[2]; + int16_t pr_q_lvls, pr, pd, pd_q_lvls, pr_pd_bits; + int16_t zero_pad_bits, sid_bits_len; + + sid_bits_len = st0->next_bit_pos; + pr_min_max[0] = pSpar_md->min_max[0]; + pr_min_max[1] = pSpar_md->min_max[1]; + + for ( i = 0; i < num_bands; i++ ) + { + ndec = num_dec_per_band[bw * i]; + ndm = num_dmx_per_band[bw * i]; + + for ( j = 0; j < FOA_CHANNELS - 1; j++ ) + { + int16_t pr_idx_1, pr_idx_2, pd_idx_1, pd_idx_2; + uint16_t value; + + pr_idx_1 = pr_pr_idx_pairs[ndm - 1][j][0]; + pr_idx_2 = pr_pr_idx_pairs[ndm - 1][j][1]; + pd_idx_1 = pr_pd_idx_pairs[ndm - 1][j][0]; + pd_idx_2 = pr_pd_idx_pairs[ndm - 1][j][1]; + + if ( pr_idx_1 != 0 || pd_idx_1 != 0 || pr_idx_2 != 0 || pd_idx_2 != 0 ) + { + pr_q_lvls = dtx_pr_real_q_levels[ndm - 1][pd_idx_1 - 1]; + + if ( ( j + 1 ) > ndec ) + { + pd_q_lvls = 1; + } + else + { + pd_q_lvls = dtx_pd_real_q_levels[ndm - 1][pd_idx_2 - 1]; + } + + pr_pd_bits = ivas_get_bits_to_encode( pd_q_lvls * pr_q_lvls ); + + value = get_next_indice( st0, pr_pd_bits ); + + pr = (int16_t) floor( value / pd_q_lvls ); + pd = value - pr * pd_q_lvls; + val = dtx_pd_real_min_max[0]; + ivas_quantise_real_values( &val, pd_q_lvls, dtx_pd_real_min_max[0], dtx_pd_real_min_max[1], &idx, &val, 1 ); + pd = pd + idx; + + val = pr_min_max[0]; + ivas_quantise_real_values( &val, pr_q_lvls, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); + pr = pr + idx; + + if ( ( j + 1 ) <= ndec ) + { + pSpar_md->band_coeffs_idx[i].decd_index_re[pd_idx_2 - 1] = pd; + } + + pSpar_md->band_coeffs_idx[i].pred_index_re[pd_idx_1 - 1] = pr; + } + } + } + + sid_bits_len = st0->next_bit_pos - sid_bits_len; + zero_pad_bits = ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - sid_bits_len; + assert( zero_pad_bits >= 0 ); + if ( num_dmx_per_band[0] == 2 ) + { + zero_pad_bits -= 1; + } + + for ( j = 0; j < zero_pad_bits; j++ ) + { + get_next_indice( st0, 1 ); + } + + ivas_spar_unquant_dtx_indicies( pSpar_md, num_bands, bw, num_dmx_per_band ); + + return; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_deindex_real_index() + * + * Deindex real index + *-----------------------------------------------------------------------------------------*/ + +static ivas_error ivas_deindex_real_index( + const int16_t *index, + const int16_t q_levels, + const float min_value, + const float max_value, + float *quant, + const int16_t dim ) +{ + int16_t i; + float q_step; + + if ( q_levels == 0 ) + { + return IVAS_ERR_INTERNAL; + } + + if ( q_levels == 1 ) + { + for ( i = 0; i < dim; i++ ) + { + quant[i] = 0; + } + } + else + { + q_step = ( max_value - min_value ) / ( q_levels - 1 ); + for ( i = 0; i < dim; i++ ) + { + quant[i] = index[i] * q_step; + } + } + + return IVAS_ERR_OK; +} + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_to_dirac() + * + * + *-----------------------------------------------------------------------------------------*/ + +void ivas_spar_to_dirac( + Decoder_Struct *st_ivas, + 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 dyn_active_w_flag ) +{ + DIRAC_DEC_HANDLE hDirAC; + int16_t start_band, end_band, band, qmf_band_start, qmf_band_end; + int16_t block, b; + int16_t *band_grouping; + float diffuseness[IVAS_MAX_NUM_BANDS]; + int16_t sba_order_internal; + float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t azi[IVAS_MAX_NUM_BANDS]; + int16_t ele[IVAS_MAX_NUM_BANDS]; + float dvx[IVAS_MAX_NUM_BANDS], dvy[IVAS_MAX_NUM_BANDS], dvz[IVAS_MAX_NUM_BANDS]; + float radius; + float en_ratio, res_pow; + int16_t num_slots_in_subfr; + int16_t tmp_write_idx_param_band; + int16_t tmp_write_idx_band; + float pred_re_20ms[IVAS_MAX_NUM_BANDS][IVAS_SPAR_MAX_CH - 1]; + int16_t pred_idx; + int16_t *dirac_to_spar_md_bands; + int16_t enc_param_start_band; + int16_t active_w_vlbr; + int16_t i, num_subframes; + int16_t active_w; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + active_w = ( dyn_active_w_flag == 1 ) || ( hMdDec->spar_md_cfg.active_w == 1 ); + sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); + start_band = 0; + end_band = min( num_bands_out, SPAR_DIRAC_SPLIT_START_BAND ) / bw; + + hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + + dirac_to_spar_md_bands = st_ivas->hSpar->dirac_to_spar_md_bands; + enc_param_start_band = st_ivas->hSpar->enc_param_start_band / bw; + active_w_vlbr = ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; + + if ( hDirAC != NULL && ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ) == 0 ) + { + band_grouping = hDirAC->band_grouping; + num_slots_in_subfr = st_ivas->hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; + + for ( band = start_band; band < end_band; band++ ) + { + float PR[3], Pd[3], dvnorm, g_pred; + + PR[0] = hMdDec->spar_md.band_coeffs[band].pred_re[2]; + PR[1] = hMdDec->spar_md.band_coeffs[band].pred_re[0]; + PR[2] = hMdDec->spar_md.band_coeffs[band].pred_re[1]; + g_pred = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; + if ( g_pred <= EPSILON ) + { + dvx[band] = 1.0f; + dvy[band] = 0.0f; + dvz[band] = 0.0f; + } + else + { + g_pred = sqrtf( g_pred ); + dvnorm = 1.0f / g_pred; + dvx[band] = PR[0] * dvnorm; + dvy[band] = PR[1] * dvnorm; + dvz[band] = PR[2] * dvnorm; + } + + radius = sqrtf( dvx[band] * dvx[band] + dvy[band] * dvy[band] ); + azi[band] = (int16_t) ( max( -180.0f, min( 180.0f, atan2f( dvy[band], dvx[band] ) / EVS_PI * 180.0f ) ) + 0.5f ); + ele[band] = (int16_t) ( max( -90.0f, min( 180.0f, atan2f( dvz[band], radius ) / EVS_PI * 180.0f ) ) + 0.5f ); + + if ( st_ivas->nchan_transport == 1 ) + { + float w_en_norm, f_scale; + if ( active_w ) + { + if ( dtx_vad == 0 ) + { + f_scale = IVAS_ACTIVEW_DM_F_SCALE_DTX; + } + else + { + f_scale = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE; + } + } + else + { + f_scale = 0.0f; + } + + w_en_norm = ( 1.0f - ( f_scale * g_pred * g_pred ) ); + w_en_norm *= w_en_norm; + + Pd[0] = hMdDec->spar_md.band_coeffs[band].P_re[1]; + Pd[1] = hMdDec->spar_md.band_coeffs[band].P_re[0]; + Pd[2] = hMdDec->spar_md.band_coeffs[band].P_re[2]; + en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; + res_pow = w_en_norm + en_ratio + ( Pd[0] * Pd[0] + Pd[1] * Pd[1] + Pd[2] * Pd[2] ); + res_pow *= 0.5f; + hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; + hMdDec->spar_md.ref_pow_slow[band] = 0.75f * hMdDec->spar_md.ref_pow_slow[band] + 0.25f * res_pow; + en_ratio = sqrtf( hMdDec->spar_md.en_ratio_slow[band] ) / ( hMdDec->spar_md.ref_pow_slow[band] + EPSILON ); + } + else + { + en_ratio = PR[0] * PR[0] + PR[1] * PR[1] + PR[2] * PR[2]; + hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; + en_ratio = sqrtf( hMdDec->spar_md.en_ratio_slow[band] ); + } + diffuseness[band] = 1.0f - en_ratio; /*compute diffuseness*/ + diffuseness[band] = ( ( diffuseness[band] < 1.0f ) ? ( ( diffuseness[band] < 0.0f ) ? 0.f : diffuseness[band] ) : 1.0f ); + } + + for ( band = start_band; band < end_band; band++ ) + { + int16_t azi_dith, ele_dith; + tmp_write_idx_param_band = hDirAC->spar_to_dirac_write_idx; + + en_ratio = 1.0f - diffuseness[band]; + masa_sq( 1.0f - en_ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + + qmf_band_start = band_grouping[band]; + qmf_band_end = band_grouping[band + 1]; + + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + int16_t ts_start, ts_end, ts; + + ts_start = DirAC_block_grouping[block]; + ts_end = DirAC_block_grouping[block + 1]; + for ( b = qmf_band_start; b < qmf_band_end; b++ ) + { + + azi_dith = azi[band]; + ele_dith = ele[band]; + + hSpatParamRendCom->energy_ratio1[block][b] = en_ratio; + tmp_write_idx_band = tmp_write_idx_param_band; + + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + } + else + { + for ( ts = ts_start; ts < ts_end; ts++ ) + { + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; + hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness[band]; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; + } + } + } + tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % hSpatParamRendCom->dirac_md_buffer_length; + } + } + + /* update buffer write index */ + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; + } + else + { + hDirAC->spar_to_dirac_write_idx = ( hDirAC->spar_to_dirac_write_idx + CLDFB_NO_COL_MAX ) % hSpatParamRendCom->dirac_md_buffer_length; + } + } + else + { + band = end_band; + } + + /*read DirAC metadata, convert DirAC to SPAR*/ + for ( ; band < num_bands_out / bw; band++ ) + { + int16_t dirac_band_idx; + + dirac_band_idx = dirac_to_spar_md_bands[band] - enc_param_start_band; + + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + if ( st_ivas->hQMetaData->useLowerRes ) + { + num_subframes = 1; + } + + for ( block = 0; block < num_subframes; block++ ) + { + if ( st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block] < 0.f ) + { + st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block] += 360.f; + } + azi_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block]; + ele_dirac[band][block] = st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].elevation[block]; + } + + diffuseness[band] = 1.0f - st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio[0]; + } + + /* 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, dyn_active_w_flag ); + + /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ + for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) + { + for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) + { + pred_re_20ms[band][pred_idx] = hMdDec->spar_md.band_coeffs[band].pred_re[pred_idx]; + } + } + } + + int16_t num_md_sub_frames; + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_md_sub_frames, 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, dyn_active_w_flag ); + + if ( st_ivas->hQMetaData->useLowerRes && dtx_vad ) + { + for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) + { + for ( block = 1; block < num_md_sub_frames; block++ ) + { + 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 ( 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]; + } + } + } + } + + /* expand DirAC TC 20ms MD for residual channels to all subframes*/ + for ( block = 0; block < num_md_sub_frames; block++ ) + { + for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) + { + for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ + { + if ( ivas_is_res_channel( pred_idx + 1, hMdDec->spar_md_cfg.nchan_transport ) ) + { + /* use 20ms coefficients only for residual channels */ + hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[pred_idx] = pred_re_20ms[band][pred_idx]; + } + } + } + } + + for ( b = end_band * bw; b < num_bands_out; b++ ) + { + hMdDec->valid_bands[b] = 1; + } + + return; +} +#endif \ No newline at end of file diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index e57859e02..680b25b0d 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -996,7 +996,7 @@ void stereo_dft_dec_reset( * * Update DFT memories for new frame *-------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_update( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ const int16_t output_frame, /* i : output frame length */ @@ -1102,7 +1102,81 @@ void stereo_dft_dec_update( return; } +#else + +void stereo_dft_dec_update( + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + const int16_t output_frame, /* i : output frame length */ + const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +) +{ + int16_t b, i, k_offset; + + /* Initialization */ + k_offset = STEREO_DFT_OFFSET; /*Add an offset*/ + + /* Update parameters */ + for (i = 0; i < k_offset * STEREO_DFT_BAND_MAX; i++) + { + hStereoDft->side_gain[i] = hStereoDft->side_gain[STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX + i]; + hStereoDft->res_pred_gain[i] = hStereoDft->res_pred_gain[STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX + i]; + } + + for (i = 0; i < k_offset; i++) + { + hStereoDft->gipd[i] = hStereoDft->gipd[STEREO_DFT_NBDIV + i]; + } + + /* Update configuration memories */ + for (i = 0; i < k_offset; i++) + { + hStereoDft->band_res[i] = hStereoDft->band_res[i + STEREO_DFT_NBDIV]; + hStereoDft->prm_res[i] = hStereoDft->prm_res[i + STEREO_DFT_NBDIV]; + hStereoDft->itd[i] = hStereoDft->itd[STEREO_DFT_NBDIV + i]; + hStereoDft->res_cod_mode[i] = hStereoDft->res_cod_mode[i + STEREO_DFT_NBDIV]; + hStereoDft->res_pred_mode[i] = hStereoDft->res_pred_mode[i + STEREO_DFT_NBDIV]; + } + /* Load new configurations */ + set_s(hStereoDft->band_res + k_offset, hStereoDft->hConfig->band_res, STEREO_DFT_NBDIV); + set_s(hStereoDft->prm_res + k_offset, hStereoDft->hConfig->prm_res, STEREO_DFT_NBDIV); + set_s(hStereoDft->res_pred_mode + k_offset, hStereoDft->hConfig->res_pred_mode, STEREO_DFT_NBDIV); + set_s(hStereoDft->res_cod_mode + k_offset, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_NBDIV); + + /*Update attack info*/ + if (hStereoDft->attackPresent) + { + hStereoDft->wasTransient = 1; + } + else if (hStereoDft->wasTransient) + { + hStereoDft->wasTransient = 0; + } + + for (i = STEREO_DFT_CORE_HIST_MAX - 1; i > 0; i--) + { + hStereoDft->core_hist[i] = hStereoDft->core_hist[i - 1]; + } + + mvr2r(hStereoDft->hb_stefi_sig + output_frame, hStereoDft->hb_stefi_sig, hStereoDft->hb_stefi_delay); + mvr2r(hStereoDft->hb_nrg, hStereoDft->hb_nrg + 1, STEREO_DFT_CORE_HIST_MAX - 1); + mvr2r(hStereoDft->td_gain, hStereoDft->td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1); + + if (sba_dirac_stereo_flag) + { + /* buffer update, push back by 2 because of 2 subframes */ + for (b = 0; b < hStereoDft->nbands; b++) + { + for (i = SBA_DIRAC_NRG_SMOOTH_LONG; i > 1; i--) + { + hStereoDft->smooth_buf[b][i] = hStereoDft->smooth_buf[b][i - 2]; + } + } + } + + return; +} +#endif /*------------------------------------------------------------------------- * stereo_dft_dec_destroy() @@ -3510,13 +3584,14 @@ void stereo_dft_generate_res_pred( pop_wmops(); return; } - +#endif /*--------------------------------------------------------------- * stereo_dft_dec_smooth_parameters() * * * ---------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED #if 1 void stereo_dft_dec_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ @@ -4116,7 +4191,9 @@ void stereo_dft_dec_smooth_parameters( return; } #endif +#endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * stereo_dft_adapt_sf_delay() * @@ -4203,4 +4280,4 @@ static void stereo_dft_adapt_sf_delay( return; } -#endif +#endif \ No newline at end of file -- GitLab From 479270d0f45aa0e7e7789959a3b87261ed4e6473 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 3 May 2024 16:38:26 +0530 Subject: [PATCH 010/101] ivas_mc_dec_reconfig conversion, ivas_cpe and ivas_jbm cleanup [x] TonalMDCTConceal_INSTANCE structure cleanup [x] ivas_cpe and ivas_jbm cleanup [x] ivas_mc_dec_reconfig, ivas_lfe_plc converted to fixed point --- Workspace_msvc/lib_dec.vcxproj | 1 + lib_com/float_to_fix_ops.c | 24 +- lib_com/ivas_cnst.h | 8 +- lib_com/ivas_mdct_imdct_fx.c | 22 +- lib_com/ivas_prot.h | 13 +- lib_com/ivas_prot_fx.h | 8 +- lib_com/ivas_rom_com.c | 22 +- lib_com/ivas_rom_com.h | 6 +- lib_com/modif_fs_fx.c | 2 +- lib_dec/acelp_core_dec_ivas_fx.c | 27 +- lib_dec/cng_dec_fx.c | 3 - lib_dec/core_dec_init.c | 4 +- lib_dec/core_dec_init_fx.c | 6 +- lib_dec/core_switching_dec.c | 4 +- lib_dec/core_switching_dec_fx.c | 7 +- lib_dec/init_dec_fx.c | 6 - lib_dec/ivas_binRenderer_internal.c | 3 +- lib_dec/ivas_core_dec.c | 86 +- lib_dec/ivas_corecoder_dec_reconfig.c | 34 +- lib_dec/ivas_cpe_dec_fx.c | 70 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 24 +- lib_dec/ivas_init_dec.c | 162 +- lib_dec/ivas_ism_dec.c | 49 +- lib_dec/ivas_jbm_dec.c | 1420 ++---------------- lib_dec/ivas_lfe_dec.c | 3 +- lib_dec/ivas_lfe_dec_fx.c | 21 +- lib_dec/ivas_lfe_plc.c | 3 +- lib_dec/ivas_lfe_plc_fx.c | 990 ++++++++++++ lib_dec/ivas_ls_custom_dec.c | 5 +- lib_dec/ivas_mc_param_dec.c | 786 +++++++++- lib_dec/ivas_mct_dec.c | 895 ++++++++++- lib_dec/ivas_mdct_core_dec.c | 10 +- lib_dec/ivas_mono_dmx_renderer.c | 9 +- lib_dec/ivas_omasa_dec.c | 5 +- lib_dec/ivas_osba_dec.c | 6 +- lib_dec/ivas_out_setup_conversion.c | 132 +- lib_dec/ivas_post_proc.c | 11 + lib_dec/ivas_sba_dec.c | 4 +- lib_dec/ivas_sba_rendering_internal.c | 93 +- lib_dec/ivas_sce_dec_fx.c | 94 +- lib_dec/ivas_spar_decoder.c | 94 +- lib_dec/ivas_spar_md_dec.c | 8 +- lib_dec/ivas_stat_dec.h | 64 +- lib_dec/ivas_stereo_cng_dec.c | 14 +- lib_dec/ivas_stereo_dft_dec.c | 577 +------ lib_dec/ivas_stereo_dft_dec_fx.c | 193 ++- lib_dec/ivas_stereo_switching_dec.c | 8 +- lib_dec/ivas_tcx_core_dec.c | 16 +- lib_dec/stat_dec.h | 35 +- lib_dec/swb_tbe_dec.c | 246 +-- lib_dec/swb_tbe_dec_fx.c | 67 +- lib_dec/tonalMDCTconcealment.c | 8 +- lib_dec/tonalMDCTconcealment_fx.c | 12 +- lib_rend/ivas_crend.c | 6 + lib_rend/ivas_dirac_ana.c | 23 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 7 +- lib_rend/ivas_orient_trk.c | 20 +- lib_rend/ivas_prot_rend.h | 6 + lib_rend/ivas_reverb.c | 60 +- lib_rend/ivas_rom_rend.c | 4 +- lib_rend/ivas_rom_rend.h | 3 +- lib_rend/ivas_rotation.c | 58 +- lib_rend/ivas_stat_rend.h | 115 +- lib_rend/lib_rend.c | 77 +- 64 files changed, 3476 insertions(+), 3323 deletions(-) create mode 100644 lib_dec/ivas_lfe_plc_fx.c diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index f51c45ee2..d6e4a7c67 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -297,6 +297,7 @@ + diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 3620d6fe7..736b2f38a 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -694,10 +694,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( } //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 ); - if ( st->hTonalMDCTConc != NULL ) - { - floatToFixed_arr( st->hTonalMDCTConc->secondLastPcmOut_float, st->hTonalMDCTConc->secondLastPcmOut, 0, st->hTonalMDCTConc->nSamples ); - } + //if ( st->hTonalMDCTConc != NULL ) + //{ + // floatToFixed_arr( st->hTonalMDCTConc->secondLastPcmOut_float, st->hTonalMDCTConc->secondLastPcmOut, 0, st->hTonalMDCTConc->nSamples ); + //} st->Q_syn = 0; @@ -721,10 +721,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); - if ( !st->tcxonly ) - { - floatToFixed_arr( st->p_bpf_noise_buf_float, st->p_bpf_noise_buf, 0, L_FRAME_16k ); - } + //if ( !st->tcxonly ) + //{ + // floatToFixed_arr( st->p_bpf_noise_buf_float, st->p_bpf_noise_buf, 0, L_FRAME_16k ); + //} st->mem_error = st->hBPF->pst_mem_deemp_err_fx; @@ -829,10 +829,10 @@ void fixed_to_float_stereo_tcx_core_dec( //fixedToFloat_arr( hTcxDec->old_synthFB_fx, hTcxDec->old_synthFB, 0, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) + hTcxDec->old_synth_lenFB ); - if ( !st->tcxonly ) - { - fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - } + //if ( !st->tcxonly ) + //{ + // fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); + //} st->hBPF->pst_mem_deemp_err_fx = (Word16)st->mem_error; /*=================================*/ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index f3bbf79d2..2e36dc469 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1046,15 +1046,15 @@ typedef enum /* Common SPAR metadata constants */ #define IVAS_ACTIVEW_DM_F_SCALE 0.5f -#define IVAS_ACTIVEW_DM_F_SCALE_FX IVAS_ACTIVEW_DM_F_SCALE * ONE_IN_Q31 +#define IVAS_ACTIVEW_DM_F_SCALE_FX (1073741824) /* 0.5f in Q31 */ #define IVAS_ACTIVEW_DM_F_SCALE_DTX 0.25f -#define IVAS_ACTIVEW_DM_F_SCALE_DTX_FX IVAS_ACTIVEW_DM_F_SCALE_DTX * ONE_IN_Q31 +#define IVAS_ACTIVEW_DM_F_SCALE_DTX_FX (536870912) /* 0.25f in Q31 */ #define IVAS_ACTIVEW_DM_F_SCALE_VLBR 0.25f -#define IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX IVAS_ACTIVEW_DM_F_SCALE_VLBR * ONE_IN_Q31 +#define IVAS_ACTIVEW_DM_F_SCALE_VLBR_FX (536870912) /* 0.25f in Q31 */ #define IVAS_SPAR_FOA_DFLT_FREQ_PER_CHAN 24000 #define IVAS_SPAR_DYN_ACTIVEW_THRESH (0.0039f) -#define IVAS_SPAR_DYN_ACTIVEW_THRESH_FX IVAS_SPAR_DYN_ACTIVEW_THRESH * ONE_IN_Q31 +#define IVAS_SPAR_DYN_ACTIVEW_THRESH_FX (8375186) /* 0.0039f in Q31 */ #define IVAS_SPAR_SIDE_CH_DYN_ACTIVEW_THRESH (32.0f) #define MAX_QUANT_STRATS 3 diff --git a/lib_com/ivas_mdct_imdct_fx.c b/lib_com/ivas_mdct_imdct_fx.c index d9c8a58ec..a9c7370fa 100644 --- a/lib_com/ivas_mdct_imdct_fx.c +++ b/lib_com/ivas_mdct_imdct_fx.c @@ -71,10 +71,12 @@ void ivas_tda_fx( Word16 i; Word16 len_by_2 = shr(length, 1); - FOR ( i = 0; i < len_by_2; i++ ) + FOR( i = 0; i < len_by_2; i++ ) { - pOut[i] = L_sub(pIn[len_by_2 + i], pIn[len_by_2 - i - 1]); - pOut[len_by_2 + i] = L_add(pIn[length * 2 - i - 1], pIn[length + i]); + pOut[i] = L_sub( pIn[add( len_by_2, i )], pIn[sub( sub( len_by_2, i ), 1 )] ); + move32(); + pOut[add( len_by_2, i )] = L_add( pIn[sub( sub( i_mult( length, 2 ), i ), 1 )], pIn[add( length, i )] ); + move32(); } return; @@ -105,23 +107,23 @@ void ivas_dct_windowing_fx( Copy32( pTemp_lfe, ( pOut_buf + fade_len + zero_pad_len ), dct_len ); - set32_fx(pOut_buf, 0, zero_pad_len); + set32_fx( pOut_buf, 0, zero_pad_len ); Copy32( ( pOut_buf + full_len - fade_len ), pBuffer_prev, fade_len ); - FOR ( i = 0; i < fade_len; i++ ) + FOR( i = 0; i < fade_len; i++ ) { - pOut_buf[zero_pad_len + i] = Mult_32_32(pOut_buf[zero_pad_len + i], pWindow_coeffs[i]); + pOut_buf[add( zero_pad_len, i )] = Mult_32_32( pOut_buf[add( zero_pad_len, i )], pWindow_coeffs[i] ); } - rem_len = full_len - ( zero_pad_len * 3 + fade_len ); + rem_len = sub( full_len, ( add( i_mult( zero_pad_len, 3 ), fade_len ) ) ); - FOR ( i = 0; i < rem_len; i++ ) + FOR( i = 0; i < rem_len; i++ ) { - pOut_buf[zero_pad_len * 3 + fade_len + i] = Mult_32_32(pOut_buf[zero_pad_len * 3 + fade_len + i], pWindow_coeffs[fade_len - i - 1]); + pOut_buf[add( add( i_mult( zero_pad_len, 3 ), fade_len ), i )] = Mult_32_32( pOut_buf[add( add( i_mult( zero_pad_len, 3 ), fade_len ), i )], pWindow_coeffs[sub( sub( fade_len, i ), 1 )] ); } - set32_fx(&pOut_buf[full_len], 0, frame_len - full_len); + set32_fx( &pOut_buf[full_len], 0, sub( frame_len, full_len ) ); return; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c3a997af0..52fd2480c 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4127,8 +4127,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ Word16 numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ - const Word16 numCldfbSyntheses_old, /* i : number of CLDFB synthesis instances in previous frame */ - const Word16 Q_cldfbSynDec + const Word16 numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ ); #endif // IVAS_FLOAT_FIXED @@ -4630,6 +4629,11 @@ void ivas_param_mc_enc( float *data_f[], /* i/o: input/transport MC data */ const int16_t input_frame /* i : input frame length */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_param_mc_dec_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif // IVAS_FLOAT_FIXED ivas_error ivas_param_mc_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -4644,6 +4648,11 @@ ivas_error ivas_param_mc_dec_reconfig_fx( ivas_error ivas_param_mc_dec_reconfig( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_dec_close_fx( + PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ +); +#endif // IVAS_FLOAT_FIXED void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC /* i/o: Parametric MC decoder handle */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index c5f92d81c..cdd3f2c3f 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -150,7 +150,6 @@ ivas_error ivas_omasa_ism_metadata_dec_fx( ivas_error ivas_omasa_dec_config_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - Word16 Q_cldfbSynDec, /* i : Q factor for cldfb state */ Word16 *num_src, Word16 SrcInd[MAX_NUM_TDREND_CHANNELS], Word16 *data /* o : output synthesis signal */ @@ -819,6 +818,13 @@ void ivas_lfe_dec_fx( Word32 output_lfe_ch[] /* o : output LFE synthesis */ ); +void ivas_lfe_tdplc_fx( + LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ + const Word32 *prevsynth, /* i : previous frame synthesis */ + Word32 *ytda, /* o : output time-domain buffer */ + const Word16 output_frame /* i : output frame length */ +); + void ivas_lfe_dec_close_fx( LFE_DEC_HANDLE *hLFE /* i/o: LFE decoder handle */ ); diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 9b5c18ccb..39fb8cd23 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -3950,6 +3950,26 @@ const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f }; const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 }; +#ifdef IVAS_FLOAT_FIXED +//Q31 +const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2] = { + 171798691, 172140039, 173163845, 174869403, 177255533, 180320587, 184062447, 188478526, + 193565772, 199320670, 205739242, 212817053, 220549212, 228930373, 237954746, 247616094, + 257907739, 268822570, 280353042, 292491188, 305228618, 318556530, 332465713, 346946555, + 361989047, 377582794, 393717019, 410380572, 427561937, 445249239, 463430255, 482092421, + 501222838, 520808286, 540835229, 561289828, 582157945, 603425159, 625076772, 647097821, + 669473086, 692187106, 715224182, 738568392, 762203605, 786113486, 810281510, 834690976, + 859325014, 884166600, 909198565, 934403610, 959764316, 985263157, 1010882509, 1036604668, + 1062411858, 1088286242, 1114209939, 1140165034, 1166133589, 1192097656, 1218039293, 1243940572, + 1269783591, 1295550491, 1321223465, 1346784770, 1372216740, 1397501800, 1422622476, 1447561406, + 1472301355, 1496825225, 1521116069, 1545157098, 1568931699, 1592423440, 1615616087, 1638493611, + 1661040202, 1683240277, 1705078494, 1726539762, 1747609248, 1768272390, 1788514910, 1808322817, + 1827682422, 1846580346, 1865003529, 1882939237, 1900375077, 1917298998, 1933699304, 1949564660, + 1964884103, 1979647046, 1993843284, 2007463009, 2020496806, 2032935668, 2044771000, 2055994621, + 2066598775, 2076576133, 2085919801, 2094623320, 2102680676, 2110086301, 2116835076, 2122922337, + 2128343877, 2133095950, 2137175272, 2140579023, 2143304850, 2145350871, 2146715671, 2147398307 +}; +#else const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = { 0.08000000000000002, 0.08015895227847719, 0.08063569926248770, 0.08142991147368656, 0.08254104003450596, 0.08396831704748331, 0.08571075612595230, 0.08776715307573196, @@ -3968,7 +3988,7 @@ const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = 0.96233504613317988, 0.96698111571154954, 0.97133209998031445, 0.97538499198789563, 0.97913699079334116, 0.98258550340204664, 0.98572814655776630, 0.98856274838967395, 0.99108734991333569, 0.99330020638455863, 0.99519978850517732, 0.99678478347994692, 0.99805409592381300, 0.99900684861892730, 0.99964238312089115, 0.99996026021380402 }; - +#endif /*------------------------------------------------------------------------------------------* * MDFT/iMDFT ROM tables diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index dff83ec21..360d5095a 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -451,9 +451,11 @@ extern const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; extern const float ivas_lfe_lpf_delay[2]; extern const Word16 ivas_lfe_lpf_delay_Q15[2]; - +#ifdef IVAS_FLOAT_FIXED +extern const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2]; +#else extern const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2]; - +#endif extern const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_sin_twiddle_320[IVAS_320_PT_LEN >> 1]; diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 8cd86a314..be45576b7 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -221,7 +221,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */ } /* interpolation */ - datastep = shr(div_s(shl(fac_den,8), shl(fac_num,11)),12); + datastep = shr(div_s(shl(fac_den,7), shl(fac_num,10)),12); /* equivalent to 'datastep = fac_den % fac_num' */ temp_n = i_mult2(datastep,fac_num); /*Q0*/ fracstep = sub(fac_den,temp_n); diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 13a5425e2..5c76a407c 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1519,6 +1519,7 @@ ivas_error acelp_core_dec_ivas_fx( IF(st->p_bpf_noise_buf_32) { Copy32(bpf_error_signal_fx, st->p_bpf_noise_buf_32, st->L_frame); + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( Q11, sub( st->Q_syn, 1 ) ) ); } for (i = 0; i < L_FRAME16k; i++) @@ -1618,7 +1619,7 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); Scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_imag); } - Scale_sig32( st->cldfbSynHB->cldfb_state_fx, (Q_real - 1) - Q10, st->cldfbSynHB->p_filter_length); // (Q_real-1) + Scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, ( Q_real - 1 ) - Q10 ); // (Q_real-1) Scale_sig32(save_hb_synth_fx, L_FRAME48k, Q_real - 1); FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) @@ -1638,7 +1639,7 @@ ivas_error acelp_core_dec_ivas_fx( cldfbSynthesis_ivas_fx(realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, st->cldfbSynHB); Scale_sig32(save_hb_synth_fx, L_FRAME48k, -(Q_real - 1)); //Q0 - Scale_sig32(st->cldfbSynHB->cldfb_state_fx, Q10 - (Q_real - 1), st->cldfbSynHB->p_filter_length); // Q10 + Scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, Q10 - ( Q_real - 1 ) ); // Q10 /* restore lowband */ FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) @@ -1760,10 +1761,12 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32(synth_fx, L_FRAME48k, -(Q_real - 1)); Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q10 - (Q_real - 1)); - if (st->p_bpf_noise_buf_float) + if (st->p_bpf_noise_buf_32) { Copy_Scale_sig_16_32(bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1); //Q_syn-1 Copy32(bpf_error_signal_fx, st->p_bpf_noise_buf_32, st->L_frame); + + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( Q11, sub( st->Q_syn, 1 ) ) ); } set_l(synth_fx, 0, output_frame); @@ -1831,9 +1834,9 @@ ivas_error acelp_core_dec_ivas_fx( if (!st->ppp_mode_dec && (st->idchan == 0 || st->element_mode != IVAS_CPE_TD || (st->idchan == 1 && st->element_mode == IVAS_CPE_TD && st->tdm_LRTD_flag))) { - Copy_Scale_sig_16_32(st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, 2 * st->Q_exc); + Copy_Scale_sig_16_32( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( 2 * st->Q_exc - ( st->prev_Q_bwe_exc - 16 ) ) ); non_linearity_ivas_fx( bwe_exc_fx, bwe_exc_extended_fx + NL_BUFF_OFFSET, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, st->Q_exc, st->coder_type, voice_factors_fx, st->L_frame ); - Copy_Scale_sig_32_16(bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, -(2 * st->Q_exc)); + Copy_Scale_sig_32_16( bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, -( 2 * st->Q_exc - ( st->prev_Q_bwe_exc - 16 ) ) ); } if ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) @@ -1909,11 +1912,6 @@ void acelp_decoder_state_float2fix(Decoder_State *st/*, STEREO_CNG_DEC_HANDLE hS st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = Q31 - 4; floatToFixed_arrL(st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, Q31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN); } - - /*TD_BWE_DEC_HANDLE*/ - if (st->hBWE_TD) { - floatToFixed_arr(st->hBWE_TD->old_bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended_fx, 0, NL_BUFF_OFFSET); - } } void acelp_decoder_state_fix2float(Decoder_State *st) { @@ -1929,10 +1927,6 @@ void acelp_decoder_state_fix2float(Decoder_State *st) { fixedToFloat_arrL(st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q10, st->cldfbSynHB->p_filter_length); fixedToFloat_arrL(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q10, st->cldfbSyn->p_filter_length); - IF(st->p_bpf_noise_buf_32) { - fixedToFloat_arrL(st->p_bpf_noise_buf_32, st->p_bpf_noise_buf_float, st->Q_syn-1, st->L_frame); - } - //FdCng if ( st->hFdCngDec ) { @@ -1959,11 +1953,6 @@ void acelp_decoder_state_fix2float(Decoder_State *st) { } } } - - /*TD_BWE_DEC_HANDLE*/ - if (st->hBWE_TD) { - fixedToFloat_arr(st->hBWE_TD->old_bwe_exc_extended_fx, st->hBWE_TD->old_bwe_exc_extended, 0, NL_BUFF_OFFSET); - } } static void rescale_fdCngDec(HANDLE_FD_CNG_DEC hFdCngDec, Word16 Exp_diff) { diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index 3617fa5d0..abb6fd166 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -1324,9 +1324,6 @@ static void shb_CNG_decod_ivas_fx( } ResetSHBbuffer_Dec_fx( st ); -#if 1 // TODO: To be removed later - ResetSHBbuffer_Dec( st->hBWE_TD, st->extl ); -#endif return; } #endif diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 662e4bc38..c5001197f 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -678,7 +678,6 @@ void open_decoder_LPD( { st->hBPF->pst_mem_deemp_err = 0.0f; } -#endif if (st->tcxonly) { st->p_bpf_noise_buf_float = NULL; @@ -689,6 +688,7 @@ void open_decoder_LPD( st->p_bpf_noise_buf_float = st->bpf_noise_buf_float; } +#endif if (bwidth == SWB && (total_brate == ACELP_16k40 || total_brate == ACELP_24k40) && st->element_mode == EVS_MONO) { @@ -729,7 +729,9 @@ void open_decoder_LPD( { st->hTonalMDCTConc->nScaleFactors = 0; st->hTonalMDCTConc->nSamples = 0; +#ifndef IVAS_FLOAT_FIXED st->hTonalMDCTConc->lastPcmOut_float = 0x0; +#endif st->hTonalMDCTConc->lastBlockData.tonalConcealmentActive = 0; st->hTonalMDCTConc->lastBlockData.nSamples = 0; diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index dd8502b67..d720137be 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1771,13 +1771,11 @@ void open_decoder_LPD_ivas_fx( IF( st->tcxonly ) { st->p_bpf_noise_buf = NULL; - st->p_bpf_noise_buf_float = NULL; /*To be removed later:Pointer initializations */ st->p_bpf_noise_buf_32 = NULL; } ELSE { st->p_bpf_noise_buf = st->bpf_noise_buf; - st->p_bpf_noise_buf_float = st->bpf_noise_buf_float; /*To be removed later:Pointer initializations */ st->p_bpf_noise_buf_32 = st->bpf_noise_buf_32; } IF( EQ_16( bwidth, SWB ) && ( EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && EQ_16( st->element_mode, EVS_MONO ) ) @@ -1833,10 +1831,12 @@ void open_decoder_LPD_ivas_fx( st->hTonalMDCTConc->nScaleFactors = 0; st->hTonalMDCTConc->nSamples = 0; st->hTonalMDCTConc->lastPcmOut = 0x0; +#ifndef IVAS_FLOAT_FIXED //----------To be removed later: pointer initializations st->hTonalMDCTConc->lastPcmOut_float = 0x0; //---------- st->hTonalMDCTConc->lastPcmOut_float = 0x0; +#endif st->hTonalMDCTConc->lastBlockData.tonalConcealmentActive = 0; st->hTonalMDCTConc->lastBlockData.nSamples = 0; TonalMDCTConceal_Init_ivas_fx( st->hTonalMDCTConc, st->hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); @@ -1848,11 +1848,11 @@ void open_decoder_LPD_ivas_fx( st->hTonalMDCTConc->last_block_nrg_flt = 0.0f; st->hTonalMDCTConc->curr_noise_nrg_flt = 0.0f; st->hTonalMDCTConc->faded_signal_nrg_flt = 0.0f; -#endif // #ifndef IVAS_FLOAT_FIXED st->hTonalMDCTConc->secondLastPcmOut_float = &st->hTonalMDCTConc->timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2 - imult1616( 3, shr( s_min( L_FRAME_MAX, st->hTcxDec->L_frameTCX ), 1 ) )]; st->hTonalMDCTConc->lastPcmOut_float = &st->hTonalMDCTConc->timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2 - s_min( L_FRAME_MAX, st->hTcxDec->L_frameTCX )]; //---------------To be removed later assert( sizeof( *st->hTonalMDCTConc->pTCI ) <= ( st->hTonalMDCTConc->lastPcmOut_float - st->hTonalMDCTConc->timeDataBuffer_float ) * sizeof( st->hTonalMDCTConc->timeDataBuffer_float[0] ) ); +#endif // #ifndef IVAS_FLOAT_FIXED } st->last_tns_active = 0; diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index e7238d971..ef01cc2bd 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -682,14 +682,14 @@ ivas_error core_switching_pre_dec_ivas_fx( { FOR( i = 0; i < shl(st->L_frame,1); i++ ) { - st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i] = Mult_32_16( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i], (Word16) floatToFixed( 0.6250f, 15 ) ); + st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i] = Mult_32_16( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i], (Word16) 20480 /* 0.6250f in Q15 */ ); } } ELSE { FOR( i = 0; i < shl(st->L_frame ,1); i++ ) { - st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i] = Mult_32_16( L_shl( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i], 1 ), (Word16) floatToFixed( 1.6f, 14 ) ); + st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i] = Mult_32_16( L_shl( st->hFdCngDec->hFdCngCom->olapBufferSynth_fx[i], 1 ), (Word16) 26214 /* 1.6f in Q14 */ ); } } } diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 4b2713f41..d82aaea62 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1492,9 +1492,9 @@ ivas_error core_switching_post_dec_fx( wb_tbe_extras_reset_fx(hBWE_TD->mem_genSHBexc_filt_down_wb2_fx, hBWE_TD->mem_genSHBexc_filt_down_wb3_fx ); wb_tbe_extras_reset_synth_fx(hBWE_TD->state_lsyn_filt_shb_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx, hBWE_TD->state_32and48k_WB_upsample_fx, hBWE_TD->mem_resamp_HB_fx ); - set16_fx(hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD / 4 ); - set16_fx(hBWE_TD->syn_overlap_fx, 0, L_SHB_LAHEAD ); - set32_fx(hBWE_TD->mem_csfilt_fx, 0, 2 ); + set16_fx( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD / 4 ); + set16_fx( hBWE_TD->syn_overlap_fx, 0, L_SHB_LAHEAD ); + set32_fx( hBWE_TD->mem_csfilt_fx, 0, 2 ); } return error; @@ -2070,6 +2070,7 @@ ivas_error core_switching_post_dec_ivas_fx( set16_fx( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD / 4 ); set16_fx( hBWE_TD->syn_overlap_fx, 0, L_SHB_LAHEAD ); + set32_fx( hBWE_TD->syn_overlap_fx_32, 0, L_SHB_LAHEAD ); set32_fx( hBWE_TD->mem_csfilt_fx, 0, 2 ); } } diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index e43ef4bed..c5cf8a7bc 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1415,9 +1415,6 @@ ivas_error init_decoder_ivas_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n")); } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - td_bwe_dec_init(st_fx->hBWE_TD, st_fx->extl, st_fx->output_Fs); -#endif td_bwe_dec_init_ivas_fx(st_fx, st_fx->hBWE_TD, st_fx->output_Fs); } ELSE @@ -1823,9 +1820,6 @@ ivas_error init_decoder_ivas_fx( { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TonalMDCTConcealment\n")); } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - set_zero(st_fx->hTonalMDCTConc->timeDataBuffer_float, ( 3 * L_FRAME_MAX ) / 2); -#endif } ELSE { diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index cd17505e1..04c22da10 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1979,9 +1979,10 @@ void ivas_binRenderer_close( IF( ( *hBinRenderer )->hReverb != NULL ) { - ivas_binaural_reverb_close( &( ( *hBinRenderer )->hReverb ) ); #ifdef IVAS_FLOAT_FIXED ivas_binaural_reverb_close_fx( &( ( *hBinRenderer )->hReverb ) ); +#else + ivas_binaural_reverb_close( &( ( *hBinRenderer )->hReverb ) ); #endif } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index fd93643d2..25e7078cb 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -328,7 +328,6 @@ ivas_error ivas_core_dec( IF( sba_dirac_stereo_flag && hSCE && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) { - floatToFixed_arrL( hSCE->save_hb_synth, hSCE->save_hb_synth_fx, Q11, output_frame ); save_hb_synth_32_fx = hSCE->save_hb_synth_fx; } ELSE @@ -507,7 +506,7 @@ ivas_error ivas_core_dec( if ( save_hb_synth_32_fx ) { Copy_Scale_sig_16_32( save_hb_synth_16_fx, save_hb_synth_32_fx, output_frame, Q11 ); - fixedToFloat_arrL( hSCE->save_hb_synth_fx, hSCE->save_hb_synth, negate( Q11 ), output_frame ); + hSCE->q_save_hb_synth_fx = Q11; } Copy_Scale_sig_16_32(old_syn_12k8_16k_fx_16, old_syn_12k8_16k_fx[n],L_FRAME16k,Q11 - (-1)); @@ -618,17 +617,8 @@ ivas_error ivas_core_dec( IF( st->hHQ_core ) floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->Q_syn, L_FRAME32k ); - if ( !st->tcxonly ) - { - floatToFixed_arr( st->p_bpf_noise_buf_float, st->p_bpf_noise_buf, 0, L_FRAME_16k ); - } - IF( st->hHQ_core ) floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); - IF( st->hTonalMDCTConc ) - floatToFixed_arr( st->hTonalMDCTConc->lastPcmOut_float, st->hTonalMDCTConc->lastPcmOut, 0, s_min( 960, st->hTonalMDCTConc->nSamples ) ); - IF( st->hTonalMDCTConc ) - floatToFixed_arr( st->hTonalMDCTConc->secondLastPcmOut_float, st->hTonalMDCTConc->secondLastPcmOut, 0, s_min( 960, st->hTonalMDCTConc->nSamples ) / 2 ); if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) { st->hTcxDec->conLastFrameLevel_e = 0; @@ -643,26 +633,26 @@ ivas_error ivas_core_dec( st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; } - IF( st_ivas->hLsSetUpConversion ) - f2me_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); - IF( st_ivas->hLsSetUpConversion ) - f2me_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion ) + //f2me_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion ) + //f2me_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); FOR( Word16 chOutIdx = 0; chOutIdx < st_ivas->hDecoderConfig->nchan_out; chOutIdx++ ) { FOR( Word16 chInIdx = 0; chInIdx < s_min( st_ivas->nchan_transport, 16 ); chInIdx++ ) { - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxMtx_fx[chInIdx] ) - st_ivas->hLsSetUpConversion->dmxMtx_fx[chInIdx][chOutIdx] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx], 30 ); /*Q30*/ + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxMtx_fx[chInIdx] ) + //st_ivas->hLsSetUpConversion->dmxMtx_fx[chInIdx][chOutIdx] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx], 30 ); /*Q30*/ } } #endif stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx ); #if 1 // Fix to float conversion - IF( st_ivas->hLsSetUpConversion ) - me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - IF( st_ivas->hLsSetUpConversion ) - me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion ) + //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion ) + //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); FOR( ch = 0; ch < 2; ch++ ) { @@ -701,20 +691,10 @@ ivas_error ivas_core_dec( st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); } - if ( !st->tcxonly ) - { - fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - } - for ( int p = 0; p < 960; p++ ) { st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); } - - IF( st->hTonalMDCTConc && st->hTonalMDCTConc->lastPcmOut_float ) - fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, s_min( 960, st->hTonalMDCTConc->nSamples ) ); - IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) - fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, s_min( 480, st->hTonalMDCTConc->nSamples / 2 ) ); } Scale_sig(synth_16_fx[0],L_FRAME48k,e_sig - 15); @@ -802,10 +782,6 @@ ivas_error ivas_core_dec( #ifdef IVAS_FLOAT_FIXED /*cldfb struct*/ - IF(st->hBWE_TD != NULL) - { - floatToFixed_arr(st->hBWE_TD->old_bwe_exc_extended, st->hBWE_TD->old_bwe_exc_extended_fx, st->prev_Q_bwe_exc - 16, NL_BUFF_OFFSET); - } /*------------------fix-to-fix-start---------------------*/ /*core_switching_post_dec*/ Q_synth = 0; @@ -841,7 +817,6 @@ ivas_error ivas_core_dec( /*size of synth is choosen as delay comp to start with*/ /*-------------------cldfb-start-------------------------*/ - floatToFixed_arrL(st->bpf_noise_buf_float, st->bpf_noise_buf_32, 11, L_FRAME_16k); if (st->cldfbAna != NULL) { floatToFixed_arrL(st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, 10, st->cldfbAna->cldfb_size); @@ -859,9 +834,6 @@ ivas_error ivas_core_dec( Word16 q_audio, old_syn_fx; old_syn_fx = Q11; q_audio = Q12; - if (hSCE != NULL) { - if(hSCE->save_synth != NULL)floatToFixed_arrL(hSCE->save_synth, hSCE->save_synth_fx, Q11, output_frame); - } #endif test(); test(); test(); test(); IF ( EQ_16(st->last_core, ACELP_CORE) && (EQ_16(st->core, TCX_20_CORE) || EQ_16(st->core, TCX_10_CORE) || EQ_16(st->core, HQ_CORE) ) && st->hBWE_TD != NULL ) @@ -904,7 +876,8 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && NE_16(st->element_mode, IVAS_CPE_MDCT) && !(EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG))) { - Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); + //Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); + Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, hSCE->q_save_synth_fx - Q_synth); } IF ( ( error = core_switching_post_dec_ivas_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE, &Q_synth ) ) != IVAS_ERR_OK ) @@ -916,7 +889,8 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && hSCE && EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG)) { - Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); + //Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); + Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, hSCE->q_save_synth_fx - Q_synth); } /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */ @@ -935,9 +909,6 @@ ivas_error ivas_core_dec( Scale_sig32(output_32_fx[n], L_FRAME48k, Q11 - Q4); #ifdef IVAS_FLOAT_FIXED - if (hSCE != NULL) { - if (hSCE->save_synth != NULL)fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11, output_frame); - } /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ @@ -977,7 +948,6 @@ ivas_error ivas_core_dec( st->hBWE_FD->prev_L_swb_norm = st->hBWE_FD->prev_L_swb_norm; st->hBWE_FD->prev_flag = st->hBWE_FD->prev_flag; } - #endif /*---------------------------------------------------------------------* * WB TBE decoding @@ -1002,11 +972,6 @@ ivas_error ivas_core_dec( Copy_Scale_sig_32_16(output_32_fx[n], output_16_fx[n], L_FRAME48k, negate(Q11)); Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, negate(Q11)); - - IF( hBWE_TD != NULL ) - { - floatToFixed_arr( hBWE_TD->old_bwe_exc_extended, hBWE_TD->old_bwe_exc_extended_fx, st->prev_Q_bwe_exc - 16, NL_BUFF_OFFSET ); - } #endif test(); test(); @@ -1145,13 +1110,6 @@ ivas_error ivas_core_dec( Copy_Scale_sig_16_32(st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, -(st->prev_Q_bwe_syn2 - Q11)); } -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - - IF(hBWE_TD != NULL) - { - fixedToFloat_arr(hBWE_TD->old_bwe_exc_extended_fx, hBWE_TD->old_bwe_exc_extended, st->prev_Q_bwe_exc - 16, NL_BUFF_OFFSET); - } -#endif /*-------------------------------------------------------------------* * Inter-channel BWE decoding *-------------------------------------------------------------------*/ @@ -1372,13 +1330,6 @@ ivas_error ivas_core_dec( hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] * (1 << 11)); } } - if (hCPE->hCoreCoder[ch_ind]->p_bpf_noise_buf_float != NULL) - { - FOR(int ind = 0; ind < L_FRAME16k; ind++) - { - hCPE->hCoreCoder[ch_ind]->p_bpf_noise_buf_32[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->p_bpf_noise_buf_float[ind] * (1 << 11)); - } - } } } } @@ -1517,13 +1468,6 @@ ivas_error ivas_core_dec( hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] = (float) hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] / (float) ( 1 << 11 ); } } - if ( hCPE->hCoreCoder[ch_ind]->p_bpf_noise_buf_float != NULL ) - { - FOR( int ind = 0; ind < L_FRAME16k; ind++ ) - { - hCPE->hCoreCoder[ch_ind]->p_bpf_noise_buf_float[ind] = (float) hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[ind] / (float) ( 1 << 11 ); - } - } } } } diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index bae8ece3c..aa32ce707 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -122,13 +122,6 @@ ivas_error ivas_corecoder_dec_reconfig_fx( if ( st_ivas->hSCE[0] != NULL ) { -#if 1 /*TODO:To be removed later*/ - free( st_ivas->hSCE[0]->save_synth ); - st_ivas->hSCE[0]->save_synth = NULL; - - free( st_ivas->hSCE[0]->save_hb_synth ); - st_ivas->hSCE[0]->save_hb_synth = NULL; -#endif free( st_ivas->hSCE[0]->save_synth_fx ); st_ivas->hSCE[0]->save_synth_fx = NULL; @@ -400,33 +393,20 @@ ivas_error ivas_corecoder_dec_reconfig_fx( 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 */ st_ivas->hCPE[0]->hCoreCoder[1] = NULL; - IF( st_ivas->hSCE[0]->save_synth == NULL ) + IF( st_ivas->hSCE[0]->save_synth_fx == NULL ) { -#if 1 /*TODO: To be removed later*/ - IF( ( st_ivas->hSCE[0]->save_synth = (float *) malloc( sizeof( float ) * output_frame ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for stereo output\n" ) ); - } - set_zero( st_ivas->hSCE[0]->save_synth, output_frame ); -#endif IF( ( st_ivas->hSCE[0]->save_synth_fx = (Word32 *) malloc( sizeof( *( st_ivas->hSCE[0]->save_synth_fx ) ) * output_frame ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for stereo output\n" ) ); } set32_fx( st_ivas->hSCE[0]->save_synth_fx, 0, output_frame ); st_ivas->hSCE[0]->q_save_synth_fx = 0; + //st_ivas->hSCE[0]->q_save_synth_fx = Q11; move16(); } - IF( st_ivas->hSCE[0]->save_hb_synth == NULL ) + IF( st_ivas->hSCE[0]->save_hb_synth_fx == NULL ) { -#if 1 /*TODO: To be removed later*/ - IF( ( st_ivas->hSCE[0]->save_hb_synth = (float *) malloc( sizeof( float ) * output_frame ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate HB memory for stereo output\n" ) ); - } - set_zero( st_ivas->hSCE[0]->save_hb_synth, output_frame ); -#endif IF( ( st_ivas->hSCE[0]->save_hb_synth_fx = (Word32 *) malloc( sizeof( *( st_ivas->hSCE[0]->save_hb_synth_fx ) ) * output_frame ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate HB memory for stereo output\n" ) ); @@ -953,8 +933,8 @@ ivas_error ivas_cldfb_dec_reconfig_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ Word16 numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ - const Word16 numCldfbSyntheses_old, /* i : number of CLDFB synthesis instances in previous frame */ - const Word16 Q_cldfbSynDec ) + const Word16 numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ +) { Word16 i, numCldfbAnalyses, numCldfbSyntheses; DECODER_CONFIG_HANDLE hDecoderConfig; @@ -974,7 +954,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* resample CLDFB analysis instances */ FOR( i = 0; i < min( numCldfbAnalyses, numCldfbAnalyses_old ); i++ ) { - IF( EQ_32( L_mult0( extract_l(L_mult0( st_ivas->cldfbAnaDec[i]->no_channels, st_ivas->cldfbAnaDec[i]->no_col )), FRAMES_PER_SEC ), hDecoderConfig->output_Fs ) ) + IF( NE_32( L_mult0( extract_l(L_mult0( st_ivas->cldfbAnaDec[i]->no_channels, st_ivas->cldfbAnaDec[i]->no_col )), FRAMES_PER_SEC ), hDecoderConfig->output_Fs ) ) { resampleCldfb_ivas_fx( st_ivas->cldfbAnaDec[i], hDecoderConfig->output_Fs ); } @@ -1027,7 +1007,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( FOR( i = 0; i < st_ivas->cldfbAnaDec[0]->cldfb_state_length; i++ ) st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i], 16 ); // Scaling down from 27 to 11 FOR( i = 0; i < st_ivas->cldfbSynDec[0]->cldfb_state_length; i++ ) - st_ivas->cldfbSynDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbSynDec[0]->cldfb_state_fx[i], 21- Q_cldfbSynDec); // Scaling down from 21 to Q_cldfbSynDec + st_ivas->cldfbSynDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbSynDec[0]->cldfb_state_fx[i], 21 - 11); // Scaling down from 21 to 11 } return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 373b15f1a..bf2c88053 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -303,10 +303,7 @@ ivas_error ivas_cpe_dec_fx( IF( !st_ivas->bfi ) { /* Update DFT Stereo memories */ - stereo_dft_dec_update( hCPE->hStereoDft, output_frame, 0 ); -#ifdef IVAS_FLOAT_FIXED stereo_dft_dec_update_fx( hCPE->hStereoDft, output_frame, 0 ); -#endif IF( EQ_16( (Word16) st_ivas->ivas_format, MASA_FORMAT ) && LE_32( ivas_total_brate, IVAS_SID_5k2 ) ) { @@ -367,18 +364,7 @@ ivas_error ivas_cpe_dec_fx( } } -#ifdef IVAS_FLOAT_FIXED -#if 1 - Word16 Q_coh = 13; - floatToFixed_arr( hCPE->hStereoCng->coh, hCPE->hStereoCng->coh_fx, Q_coh, 14 ); -#endif stereo_dft_dec_read_BS_fx( ivas_total_brate, hCPE->element_brate, &sts[0]->total_brate, sts[1], hCPE->hStereoDft, sts[0]->bwidth, output_frame, res_buf_fx, &nb_bits, hCPE->hStereoCng->coh_fx, st_ivas->ivas_format ); -#if 1 /*Fixed To Float changes*/ - fixedToFloat_arr( hCPE->hStereoCng->coh_fx, hCPE->hStereoCng->coh, Q_coh, 14 ); /*Q-13*/ -#endif -#else - stereo_dft_dec_read_BS( ivas_total_brate, hCPE->element_brate, &sts[0]->total_brate, sts[1], hCPE->hStereoDft, sts[0]->bwidth, output_frame, res_buf, &nb_bits, hCPE->hStereoCng->coh, st_ivas->ivas_format ); -#endif } /* subtract metadata bitbudget */ @@ -670,8 +656,6 @@ ivas_error ivas_cpe_dec_fx( Word16 q_dft; q_dft = hCPE->hStereoDft->q_dft; - floatToFixed_arr(&hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - floatToFixed_arr(&hCPE->hStereoCng->coh[0], &hCPE->hStereoCng->coh_fx[0], Q15, sizeof(hCPE->hStereoCng->coh_fx) / sizeof(hCPE->hStereoCng->coh_fx[0]) ); //TODO : To check this hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel = Q31 - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp; @@ -682,15 +666,12 @@ ivas_error ivas_cpe_dec_fx( &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[0], hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel, FFTCLDFBLEN ); - fixedToFloat_arr( &hCPE->hStereoCng->coh_fx[0], &hCPE->hStereoCng->coh[0], Q15, sizeof( hCPE->hStereoCng->coh_fx ) / sizeof( hCPE->hStereoCng->coh_fx[0] ) ); - fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } /* decoding */ IF( EQ_16( hCPE->nchan_out, 1 ) ) { #if 1 - float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; @@ -703,19 +684,15 @@ ivas_error ivas_cpe_dec_fx( scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; - - floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); #endif stereo_dft_unify_dmx_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng->prev_sid_nodata ); #if 1 scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) ); hCPE->hStereoDft->q_res_cod_mem_fx = Q16; - fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); #endif } ELSE { - float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; #if 1 { IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) @@ -730,17 +707,12 @@ ivas_error ivas_cpe_dec_fx( scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft; - floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } #endif stereo_dft_dec_fx( hCPE->hStereoDft, sts[0], DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); #if 1 - { - fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - - scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) ); - hCPE->hStereoDft->q_res_cod_mem_fx = Q16; - } + scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q16, hCPE->hStereoDft->q_res_cod_mem_fx ) ); + hCPE->hStereoDft->q_res_cod_mem_fx = Q16; #endif } @@ -821,28 +793,7 @@ ivas_error ivas_cpe_dec_fx( IF( !st_ivas->sba_dirac_stereo_flag ) { - // Delete below - Word16 output_q = OUTPUT_Q; - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - FOR( Word32 k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->prev_synth_fx[n][k] = (Word32) ( hCPE->prev_synth[n][k] * ( 1 << output_q ) ); - } - } - // till here - synchro_synthesis_fx( ivas_total_brate, hCPE, output, output_frame, 0 ); - - // delete the below - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - FOR( Word32 k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << output_q ); - } - } - // till here } test(); @@ -987,14 +938,6 @@ ivas_error create_cpe_dec( hCPE->nchan_out = 1; } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - //set_f( hCPE->prev_hb_synth[n], 0, NS2SA( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); - set_f( hCPE->prev_synth[n], 0, NS2SA( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ) ); - } -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR( n = 0; n < CPE_CHANNELS; n++ ) { set32_fx( hCPE->prev_hb_synth_fx[n], 0, NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); @@ -1105,10 +1048,17 @@ ivas_error create_cpe_dec( IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) || ( st_ivas->sba_dirac_stereo_flag && EQ_16( hCPE->cpe_id, 0 ) ) ) { +#ifdef IVAS_FLOAT_FIXED + IF( ( error = stereo_dft_dec_create_fx( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } +#else IF( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { return error; } +#endif } /*-----------------------------------------------------------------* @@ -1229,7 +1179,7 @@ ivas_error create_cpe_dec( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Stereo CNG\n" ) ); } - stereo_cng_init_dec( hCPE->hStereoCng, &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->frameSize ); + stereo_cng_init_dec_fx( hCPE->hStereoCng, &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->frameSize ); } st_ivas->hCPE[cpe_id] = hCPE; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 2d3686cfa..c6d48cc4d 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -158,29 +158,29 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( set16_fx(h_dirac_output_synthesis_state->cx_old_e, 0, CLDFB_NO_CHANNELS_MAX); set16_fx(h_dirac_output_synthesis_state->cy_old_e, 0, CLDFB_NO_CHANNELS_MAX); - if ((h_dirac_output_synthesis_state->mixing_matrix_res_exp = (Word16 *)malloc(nchan_out * nchan_out * sizeof(Word16))) == NULL) + if ((h_dirac_output_synthesis_state->mixing_matrix_res_exp = (Word16 *)malloc(CLDFB_NO_CHANNELS_MAX * sizeof(Word16))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n")); } - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_exp, 0, nchan_out * nchan_out); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_exp, 0, CLDFB_NO_CHANNELS_MAX); - if ((h_dirac_output_synthesis_state->mixing_matrix_res_old_exp = (Word16 *)malloc(nchan_out * nchan_out * sizeof(Word16))) == NULL) + if ((h_dirac_output_synthesis_state->mixing_matrix_res_old_exp = (Word16 *)malloc(CLDFB_NO_CHANNELS_MAX * sizeof(Word16))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n")); } - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_old_exp, 0, nchan_out * nchan_out); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_old_exp, 0, CLDFB_NO_CHANNELS_MAX); - if ((h_dirac_output_synthesis_state->mixing_matrix_exp = (Word16 *)malloc(nchan_out * nchan_out * sizeof(Word16))) == NULL) + if ((h_dirac_output_synthesis_state->mixing_matrix_exp = (Word16 *)malloc(CLDFB_NO_CHANNELS_MAX * sizeof(Word16))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n")); } - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_exp, 0, nchan_out * nchan_out); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_exp, 0, CLDFB_NO_CHANNELS_MAX); - if ((h_dirac_output_synthesis_state->mixing_matrix_old_exp = (Word16 *)malloc(nchan_out * nchan_out * sizeof(Word16))) == NULL) + if ((h_dirac_output_synthesis_state->mixing_matrix_old_exp = (Word16 *)malloc(CLDFB_NO_CHANNELS_MAX * sizeof(Word16))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n")); } - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_old_exp, 0, nchan_out * nchan_out); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_old_exp, 0, CLDFB_NO_CHANNELS_MAX); /*-----------------------------------------------------------------* * prepare processing parameters @@ -474,10 +474,10 @@ void ivas_dirac_dec_output_synthesis_cov_init_fx( } - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_old_exp, 0, nchan_out * nchan_in); - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_exp, 0, nchan_out * nchan_in); - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_old_exp, 0, nchan_out * nchan_out); - set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_exp, 0, nchan_out * nchan_out); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_old_exp, 0, CLDFB_NO_CHANNELS_MAX); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_exp, 0, CLDFB_NO_CHANNELS_MAX); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_old_exp, 0, CLDFB_NO_CHANNELS_MAX); + set16_fx(h_dirac_output_synthesis_state->mixing_matrix_res_exp, 0, CLDFB_NO_CHANNELS_MAX); #if 1/*TODO: To be removed :Floating point initializations*/ FOR ( idx = 0; idx < n_param_bands; idx++ ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 219d67aa7..4f8a83419 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -238,7 +238,7 @@ ivas_error ivas_dec_setup( DECODER_CONFIG_HANDLE hDecoderConfig=NULL; Word16 numch_out_dirac=0; SPAR_DEC_HANDLE hSpar = NULL; - Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + Word16 numch_in, numch_out, num_md_sub_frames; IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) @@ -271,31 +271,6 @@ ivas_error ivas_dec_setup( numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( int j = 0; j < numch_in; j++ ) - { - for ( int n = 0; n < num_md_sub_frames * IVAS_MAX_NUM_BANDS; n++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][n] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][n], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for (int n = 0; n < IVAS_MAX_SPAR_FB_MIXER_IN_CH; n++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][n][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][n][l], q2 ); - } - } - } - } -#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -356,21 +331,6 @@ ivas_error ivas_dec_setup( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ((float)(st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i]) / (1LL << (Q11))); /*Rounding off*/ } } -#if 0 - FOR(int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++) - { - FOR(int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++) - { - FOR(int n = 0; n < IVAS_MAX_SPAR_FB_MIXER_IN_CH; n++) - { - FOR(int l = 0; l < IVAS_MAX_NUM_BANDS; l++) - { - hSpar->hMdDec->mixer_mat_prev[m][j][n][l] = ((float)hSpar->hMdDec->mixer_mat_prev_fx[m][j][n][l] / (1 << q2)); - } - } - } - } -#endif // fix2float (to be cleaned) IF((LT_32(hDecoderConfig->ivas_total_brate, IVAS_24k4)) && ((EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2)) || (EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3)))) { @@ -437,7 +397,7 @@ ivas_error ivas_dec_setup( } //////////////////////////////////////////////////////////////// - IF( ( error = ivas_omasa_dec_config_fx( st_ivas, nSamplesRendered, Q_cldfbSynDec, &num_src, SrcInd, data ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_omasa_dec_config_fx( st_ivas, nSamplesRendered, &num_src, SrcInd, data ) ) != IVAS_ERR_OK ) { return error; } @@ -578,7 +538,7 @@ ivas_error ivas_dec_setup( } //////////////////////////////////////////////////////////////// - IF( ( error = ivas_omasa_dec_config_fx( st_ivas, nSamplesRendered, Q_cldfbSynDec, &num_src, SrcInd, data ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_omasa_dec_config_fx( st_ivas, nSamplesRendered, &num_src, SrcInd, data ) ) != IVAS_ERR_OK ) { return error; } @@ -1206,7 +1166,7 @@ ivas_error ivas_init_decoder_front( { set_zero((st_ivas->hLsSetupCustom)->ls_azimuth, MAX_OUTPUT_CHANNELS ); set_zero((st_ivas->hLsSetupCustom)->ls_elevation, MAX_OUTPUT_CHANNELS ); - set_f( ( st_ivas->hLsSetupCustom )->separate_ch_gains, 0.0f, MAX_OUTPUT_CHANNELS ); + //set_f( ( st_ivas->hLsSetupCustom )->separate_ch_gains, 0.0f, MAX_OUTPUT_CHANNELS ); } ELSE #else @@ -1221,13 +1181,13 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Head-Tracking handle *--------------------------------------------------------------------*/ - IF ( st_ivas->hDecoderConfig->Opt_Headrotation ) +#ifdef IVAS_FLOAT_FIXED + IF( st_ivas->hDecoderConfig->Opt_Headrotation ) { - IF ( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_headTrack_open_fx( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) { return error; } -#ifdef IVAS_FLOAT_FIXED error = ivas_orient_trk_SetTrackingType_fx( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ); IF( ( error ) != IVAS_ERR_OK ) { @@ -1235,7 +1195,13 @@ ivas_error ivas_init_decoder_front( } } #else - IF ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ) ) != IVAS_ERR_OK ) + IF( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + IF( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + IF( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ) ) != IVAS_ERR_OK ) { return error; } @@ -2003,11 +1969,62 @@ ivas_error ivas_init_decoder_fx( return error; } } - +#ifdef IVAS_FLOAT_FIXED + IF( ( error = ivas_param_mc_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1/*Fixed to float conversions*/ + PARAM_MC_DEC_HANDLE hParamMC; + hParamMC = st_ivas->hParamMC; + Word16 nchan_out_transport, nchan_out_cov; + MC_LS_SETUP mc_ls_setup; + Word16 nchan_transport; + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); + nchan_transport = st_ivas->nchan_transport; + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else + { + nchan_out_cov = nchan_out_transport; + } + if ( hParamMC ) + { + fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); + fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + fixedToFloat_arr( hParamMC->h_output_synthesis_params.interpolator_fx, hParamMC->h_output_synthesis_params.interpolator, 15, DEFAULT_JBM_CLDFB_TIMESLOTS ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); + FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); + } + //if ( st_ivas->hLsSetUpConversion ) + //{ + // for ( k = 0; k < nchan_transport; k++ ) + // { + // for ( i = 0; i < nchan_out_cov; i++ ) + // { + // st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); + // } + // } + //} + fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); + //if ( hParamMC->ls_conv_dmx_matrix ) + // fixedToFloat_arrL( hParamMC->ls_conv_dmx_matrix_fx, hParamMC->ls_conv_dmx_matrix, Q30, nchan_out_transport * nchan_out_cov ); + if ( hParamMC->hoa_encoder_fx ) + fixedToFloat_arrL( hParamMC->hoa_encoder_fx, hParamMC->hoa_encoder, Q29, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); + } +#endif // 1 +#else IF ( ( error = ivas_param_mc_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } +#endif FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { @@ -2063,7 +2080,26 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->hVBAPdata == NULL ) { /* Distribute signal to all channels if VBAP is not properly initialized. */ - set_f( st_ivas->hLsSetupCustom->separate_ch_gains, inv_sqrt( st_ivas->hLsSetupCustom->num_spk ), st_ivas->hLsSetupCustom->num_spk ); + Word16 inv_sqr, sqr, exp = 15, exp_sqr; + IF(EQ_16(st_ivas->hLsSetupCustom->num_spk, 1)) + { + inv_sqr = 32767; + } + ELSE + { + sqr = Sqrt16(st_ivas->hLsSetupCustom->num_spk, &exp); + inv_sqr = BASOP_Util_Divide1616_Scale(32767, sqr, &exp_sqr); + exp_sqr = sub(exp_sqr, exp); + IF(LT_16(exp, 0)) + { + inv_sqr = shr(inv_sqr, exp); + } + ELSE + { + inv_sqr = shl(inv_sqr, exp); + } + } + set16_fx( st_ivas->hLsSetupCustom->separate_ch_gains_fx, inv_sqr, st_ivas->hLsSetupCustom->num_spk ); } ELSE { @@ -2133,11 +2169,6 @@ ivas_error ivas_init_decoder_fx( IF ( GT_16(n, 0 )) { - //IF ( ( st_ivas->mem_hp20_out = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) - //{ - // return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - //} - IF( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( n * sizeof(Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); @@ -2145,26 +2176,17 @@ ivas_error ivas_init_decoder_fx( } ELSE { - //st_ivas->mem_hp20_out = NULL; - st_ivas->mem_hp20_out_fx = NULL; } FOR ( i = 0; i < n; i++ ) { - //IF ( ( st_ivas->mem_hp20_out[i] = (float *) 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 ); - - IF((st_ivas->mem_hp20_out_fx[i] = (Word32 *)malloc((L_HP20_MEM + 2) * sizeof(Word32))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n")); - } - - set32_fx(st_ivas->mem_hp20_out_fx[i], 0, L_HP20_MEM + 2); + IF((st_ivas->mem_hp20_out_fx[i] = (Word32 *)malloc((L_HP20_MEM + 2) * sizeof(Word32))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n")); + } + + set32_fx(st_ivas->mem_hp20_out_fx[i], 0, L_HP20_MEM + 2); } /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 60f88277f..57fa0c8ce 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -294,8 +294,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( * CLDFB instances *-----------------------------------------------------------------*/ - Word16 Q_cldfbSynDec = Q21; - IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ,Q_cldfbSynDec) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { return error; } @@ -501,7 +500,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + Word16 numch_in, numch_out, num_md_sub_frames; ; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) @@ -509,32 +508,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - hSpar->hMdDec->Q_mixer_mat = q1; -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( int j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif + hSpar->hMdDec->Q_mixer_mat = Q30; for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -587,21 +561,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } -#if 0 - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -860,7 +819,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); } #endif - IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ,Q_cldfbSynDec) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index a21e3c74a..e63c61572 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -427,7 +427,7 @@ ivas_error ivas_jbm_dec_tc( #if 1 // Float to fix Word16 ch, nCPE, cpe_id; - Word16 k, l; + Word16 l; nCPE = st_ivas->nCPE; move16(); @@ -500,21 +500,12 @@ ivas_error ivas_jbm_dec_tc( { st = hCPE->hCoreCoder[n]; sts = hCPE->hCoreCoder; - IF( st->hTonalMDCTConc && st->hTonalMDCTConc->lastPcmOut_float ) - fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); - IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) - fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); for ( int p = 0; p < 640; p++ ) { st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); } - if ( !st->tcxonly ) - { - fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - } - /*-------------------cldfb-start-------------------------*/ if ( sts[n]->cldfbAna != NULL ) @@ -555,14 +546,6 @@ ivas_error ivas_jbm_dec_tc( /*------------------reset-code-end-----------------------*/ } - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); - } - } } @@ -586,10 +569,10 @@ ivas_error ivas_jbm_dec_tc( } } - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) + //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) + //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); #endif // Fix to float #endif @@ -604,8 +587,6 @@ ivas_error ivas_jbm_dec_tc( IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) ) { #ifdef IVAS_FLOAT_FIXED - - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); #if 1 /*Float to Fixed changes */ FOR( i = 0; i < st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; i++ ) { @@ -616,87 +597,11 @@ ivas_error ivas_jbm_dec_tc( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - Word16 b, i_ts, num_out_ch; + Word16 num_out_ch; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx ), ( p_output_fx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -704,31 +609,14 @@ ivas_error ivas_jbm_dec_tc( { ivas_pca_dec_fx( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, p_output_fx ); } - ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, num_md_sub_frames ); - -#if 0 /*Fixed to float changes */ - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - st_ivas->hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], st_ivas->hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif + ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes(st_ivas->sba_order, ivas_total_brate, st_ivas->last_active_ivas_total_brate)); #endif } #ifdef IVAS_FLOAT_FIXED { Word16 q; - float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; float max_val = 0.0; int i_max_val_op; hCPE = st_ivas->hCPE[0]; @@ -749,11 +637,6 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; } - - IF( hCPE->hStereoCng != NULL ) - { - floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - } q = hCPE->hStereoDft->q_dft; scale_sig32(hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub(hCPE->hStereoDft->q_dft, Q11)); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -761,20 +644,11 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); } - if ( hSCE != NULL ) - { - floatToFixed_arrL( &hSCE->save_hb_synth[0], &hSCE->save_hb_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - hSCE->q_save_hb_synth_fx = q; - floatToFixed_arrL( &hSCE->save_synth[0], &hSCE->save_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - hSCE->q_save_synth_fx = q; - } IF( hCPE->hCoreCoder[0] != NULL ) { floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], q, L_FRAME32k ); hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], q, L_FRAME48k ); - IF( ( hCPE->hCoreCoder[0] != NULL ) && ( hCPE->hCoreCoder[0]->p_bpf_noise_buf_32 != NULL ) ) - floatToFixed_arrL( &hCPE->hCoreCoder[0]->p_bpf_noise_buf_float[0], &hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[0], q, L_FRAME16k ); } IF( hCPE->hStereoDft != NULL ) { @@ -782,13 +656,21 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; } + + IF( hSCE != NULL ) + { + Scale_sig32( &hSCE->save_hb_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_hb_synth_fx ); + hSCE->q_save_hb_synth_fx = hCPE->hStereoDft->q_dft; + Scale_sig32( &hSCE->save_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); + hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; + } st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } - floatToFixed_arrL( &hCPE->prev_synth[0][0], &hCPE->prev_synth_fx[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); + Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, st_ivas->ivas_format == MC_FORMAT ); @@ -796,12 +678,7 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } - - fixedToFloat_arrL( &hCPE->prev_synth_fx[0][0], &hCPE->prev_synth[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - IF( hCPE->hStereoCng != NULL ) - { - fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - } + Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); scale_sig32(hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub(Q11, hCPE->hStereoDft->q_dft)); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -809,17 +686,11 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); } - if ( hSCE != NULL ) - { - fixedToFloat_arrL( &hSCE->save_synth_fx[0], &hSCE->save_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - fixedToFloat_arrL( &hSCE->save_hb_synth_fx[0], &hSCE->save_hb_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - } + IF( hCPE->hCoreCoder[0] != NULL ) { fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], q, L_FRAME32k ); fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], q, L_FRAME48k ); - IF( hCPE->hCoreCoder[0]->p_bpf_noise_buf_32 != NULL ) - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[0], &hCPE->hCoreCoder[0]->p_bpf_noise_buf_float[0], q, L_FRAME16k ); } IF( hCPE->hStereoDft != NULL ) { @@ -867,105 +738,14 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[ch], output_frame, sub( Q_p_output, Q11 ) ); } - Word16 b, i_ts, num_out_ch; + Word16 num_out_ch; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, p_output_fx, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #if 1 /*Fixed to float changes */ -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif FOR( Word16 c = 0; c < nchan_transport; c++ ) { Scale_sig32( p_output_fx[c], output_frame, 11 ); @@ -1258,7 +1038,7 @@ ivas_error ivas_jbm_dec_tc( #ifdef IVAS_FLOAT_FIXED #if 1 // Float to fix Word16 ch, nCPE, cpe_id; - Word16 k, l; + Word16 l; nCPE = st_ivas->nCPE; move16(); @@ -1331,33 +1111,12 @@ ivas_error ivas_jbm_dec_tc( { st = hCPE->hCoreCoder[n]; sts = hCPE->hCoreCoder; - //IF( st->hTcxDec ) - //st->hTcxDec->CngLevelBackgroundTrace_bfi = me2f_16( st->hTcxDec->conCngLevelBackgroundTrace, st->hTcxDec->conCngLevelBackgroundTrace_e ); - IF( st->hTonalMDCTConc && st->hTonalMDCTConc->lastPcmOut_float ) - fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); - IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) - fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); - - //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); - for ( int p = 0; p < st->L_frame / 2; p++ ) - { - //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); - } for ( int p = 0; p < 640; p++ ) { st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); } - if ( !st->tcxonly ) - { - fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - } - - //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); - /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ @@ -1397,14 +1156,6 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; } } - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); - } - } } @@ -1428,10 +1179,10 @@ ivas_error ivas_jbm_dec_tc( } } - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) + //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) + //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); #endif // Fix to float #endif @@ -1444,94 +1195,17 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( p_output_fx[i + sba_ch_idx], output_frame, sub( Q14, Q11 ) ); } #ifdef IVAS_FLOAT_FIXED - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); #if 1 /*Float to Fixed changes */ SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 num_bands_out, nchan_transport; num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - Word16 b, i_ts, num_out_ch; + Word16 num_out_ch; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -1545,26 +1219,10 @@ ivas_error ivas_jbm_dec_tc( #else ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); #endif -#if 0 /* Fixed to float changes*/ - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - st_ivas->hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], st_ivas->hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #endif #ifdef IVAS_FLOAT_FIXED { Word16 q; - float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; s = 0; @@ -1583,10 +1241,6 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; } - IF( hCPE->hStereoCng != NULL ) - { - floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - } q = hCPE->hStereoDft->q_dft; scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -1594,20 +1248,11 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); } - if ( hSCE != NULL ) - { - floatToFixed_arrL( &hSCE->save_hb_synth[0], &hSCE->save_hb_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - hSCE->q_save_hb_synth_fx = q; - floatToFixed_arrL( &hSCE->save_synth[0], &hSCE->save_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - hSCE->q_save_synth_fx = q; - } IF( hCPE->hCoreCoder[0] != NULL ) { floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], q, L_FRAME32k ); hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], q, L_FRAME48k ); - IF( ( hCPE->hCoreCoder[0] != NULL ) && ( hCPE->hCoreCoder[0]->p_bpf_noise_buf_32 != NULL ) ) - floatToFixed_arrL( &hCPE->hCoreCoder[0]->p_bpf_noise_buf_float[0], &hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[0], q, L_FRAME16k ); } IF( hCPE->hStereoDft != NULL ) { @@ -1616,51 +1261,39 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; } st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30; -#if 0 - for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) + + IF( hSCE != NULL ) { - for ( int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++ ) - { - floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - Q31, - st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); - } + Scale_sig32( &hSCE->save_hb_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_hb_synth_fx ); + hSCE->q_save_hb_synth_fx = hCPE->hStereoDft->q_dft; + Scale_sig32( &hSCE->save_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); + hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; } -#endif FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } - floatToFixed_arrL( &hCPE->prev_synth[0][0], &hCPE->prev_synth_fx[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - ivas_sba_dirac_stereo_dec_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0 ); - FOR( i = 0; i < 2; i++ ) - { - Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, negate( s ) ); - } - fixedToFloat_arrL( &hCPE->prev_synth_fx[0][0], &hCPE->prev_synth[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - IF( hCPE->hStereoCng != NULL ) + Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0]), hCPE->q_prev_synth_fx - 11); + ivas_sba_dirac_stereo_dec_fx(st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0); + FOR(i = 0; i < 2; i++) { - fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); + Scale_sig32(p_output_fx[sba_ch_idx + i], L_FRAME48k, negate(s)); } + + Scale_sig32(&hCPE->prev_synth_fx[0][0], sizeof(hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) { scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); } - if ( hSCE != NULL ) - { - fixedToFloat_arrL( &hSCE->save_synth_fx[0], &hSCE->save_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - fixedToFloat_arrL( &hSCE->save_hb_synth_fx[0], &hSCE->save_hb_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - } + IF( hCPE->hCoreCoder[0] != NULL ) { fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], q, L_FRAME32k ); fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], q, L_FRAME48k ); - IF( hCPE->hCoreCoder[0]->p_bpf_noise_buf_32 != NULL ) - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[0], &hCPE->hCoreCoder[0]->p_bpf_noise_buf_float[0], q, L_FRAME16k ); } IF( hCPE->hStereoDft != NULL ) { @@ -1703,104 +1336,13 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[sba_ch_idx + ch], output_frame, sub( Q_p_output, Q11 ) ); } - Word16 b, i_ts, num_out_ch; + Word16 num_out_ch; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, &p_output_fx[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); -#if 0 /*Fixed to float changes */ - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #if 1 FOR( Word16 c = 0; c < nchan_transport; c++ ) { @@ -1867,7 +1409,7 @@ ivas_error ivas_jbm_dec_tc( #if 1 // Float to fix Word16 ch, nCPE, cpe_id; - Word16 q_output = 11, l, k; + Word16 l; nCPE = st_ivas->nCPE; move16(); @@ -1940,21 +1482,12 @@ ivas_error ivas_jbm_dec_tc( { st = hCPE->hCoreCoder[n]; sts = hCPE->hCoreCoder; - IF( st->hTonalMDCTConc && st->hTonalMDCTConc->lastPcmOut_float ) - fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); - IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) - fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); for ( int p = 0; p < 640; p++ ) { st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); } - if ( !st->tcxonly ) - { - fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - } - /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ @@ -1995,13 +1528,6 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; } } - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); - } - } } @@ -2025,10 +1551,10 @@ ivas_error ivas_jbm_dec_tc( } } - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) + //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) + //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); #endif // Fix to float #endif @@ -2087,8 +1613,7 @@ ivas_error ivas_jbm_dec_tc( #if 1 // Float to fix Word16 ch, nCPE, cpe_id; - Word16 q_output = 11; - Word16 k, l; + Word16 l; nCPE = st_ivas->nCPE; move16(); @@ -2160,19 +1685,11 @@ ivas_error ivas_jbm_dec_tc( { st = hCPE->hCoreCoder[n]; sts = hCPE->hCoreCoder; - IF( st->hTonalMDCTConc && st->hTonalMDCTConc->lastPcmOut_float ) - fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); - IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) - fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); for ( int p = 0; p < 640; p++ ) { st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); } - if ( !st->tcxonly ) - { - fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - } /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ if ( sts[n]->cldfbAna != NULL ) @@ -2211,13 +1728,6 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; } } - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); - } - } } @@ -2241,10 +1751,10 @@ ivas_error ivas_jbm_dec_tc( } } - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) + //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) + //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); #endif // Fix to float #endif @@ -2312,8 +1822,7 @@ ivas_error ivas_jbm_dec_tc( #if 1 // Float to fix Word16 ch, nCPE, cpe_id; - Word16 q_output = 11; - Word16 k, l; + Word16 l; nCPE = st_ivas->nCPE; move16(); @@ -2386,19 +1895,11 @@ ivas_error ivas_jbm_dec_tc( { st = hCPE->hCoreCoder[n]; sts = hCPE->hCoreCoder; - IF( st->hTonalMDCTConc && st->hTonalMDCTConc->lastPcmOut_float ) - fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); - IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) - fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); for ( int p = 0; p < 640; p++ ) { st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); } - if ( !st->tcxonly ) - { - fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - } /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ @@ -2438,14 +1939,6 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; } } - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); - } - } } @@ -2469,10 +1962,10 @@ ivas_error ivas_jbm_dec_tc( } } - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) + //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); + //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) + //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); #endif // Fix to float #endif @@ -2651,7 +2144,6 @@ ivas_error ivas_jbm_dec_tc( { #ifdef IVAS_FLOAT_FIXED Word16 q; - float l_hb_nrg = 0.0, l_hb_nrg_subr = 0.0; float max_val = 0.0; int i_max_val_op; hCPE = st_ivas->hCPE[0]; @@ -2673,10 +2165,6 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; } - IF( hCPE->hStereoCng != NULL ) - { - floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - } q = hCPE->hStereoDft->q_dft; scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -2684,80 +2172,55 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); } - if ( hSCE != NULL ) - { - floatToFixed_arrL( &hSCE->save_hb_synth[0], &hSCE->save_hb_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - hSCE->q_save_hb_synth_fx = q; - floatToFixed_arrL( &hSCE->save_synth[0], &hSCE->save_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - hSCE->q_save_synth_fx = q; - } + IF( hCPE->hCoreCoder[0] != NULL ) { floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], q, L_FRAME32k ); hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], q, L_FRAME48k ); - IF( ( hCPE->hCoreCoder[0] != NULL ) && ( hCPE->hCoreCoder[0]->p_bpf_noise_buf_32 != NULL ) ) - floatToFixed_arrL( &hCPE->hCoreCoder[0]->p_bpf_noise_buf_float[0], &hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[0], q, L_FRAME16k ); } IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; - - //floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); } IF( st_ivas->hSpar != NULL ) { - //floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; -#if 0 - for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) - { - for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) - { - floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - Q31, - st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); - } - } -#endif + } + + IF( hSCE != NULL ) + { + Scale_sig32( &hSCE->save_hb_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_hb_synth_fx ); + hSCE->q_save_hb_synth_fx = hCPE->hStereoDft->q_dft; + Scale_sig32( &hSCE->save_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); + hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; } FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } - floatToFixed_arrL( &hCPE->prev_synth[0][0], &hCPE->prev_synth_fx[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, 1 ); - FOR( i = 0; i < 2; i++ ) + Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0]), hCPE->q_prev_synth_fx - 11); + ivas_sba_dirac_stereo_dec_fx(st_ivas, p_output_fx, output_frame, 1); + FOR(i = 0; i < 2; i++) { - Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); + Scale_sig32(p_output_fx[i], L_FRAME48k, negate(s)); } + Scale_sig32(&hCPE->prev_synth_fx[0][0], sizeof(hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); - fixedToFloat_arrL( &hCPE->prev_synth_fx[0][0], &hCPE->prev_synth[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); - IF( hCPE->hStereoCng != NULL ) - { - fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); - } scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) { scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); } - if ( hSCE != NULL ) - { - fixedToFloat_arrL( &hSCE->save_synth_fx[0], &hSCE->save_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - fixedToFloat_arrL( &hSCE->save_hb_synth_fx[0], &hSCE->save_hb_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); - } + IF( hCPE->hCoreCoder[0] != NULL ) { fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], q, L_FRAME32k ); fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], q, L_FRAME48k ); - IF( hCPE->hCoreCoder[0]->p_bpf_noise_buf_32 != NULL ) - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->p_bpf_noise_buf_32[0], &hCPE->hCoreCoder[0]->p_bpf_noise_buf_float[0], q, L_FRAME16k ); } IF( hCPE->hStereoDft != NULL ) { @@ -2769,28 +2232,7 @@ ivas_error ivas_jbm_dec_tc( } IF( st_ivas->hSpar != NULL ) { - //fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; - for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) - { - //fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); - } -#if 0 - IF( st_ivas->hSpar != NULL ) - { - fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); - for ( int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++ ) - { - for ( int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++ ) - { - fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - Q31, - st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); - } - } - } -#endif FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); @@ -3050,6 +2492,7 @@ ivas_error ivas_jbm_dec_tc( { set_f( p_output[n], 0.0f, output_frame ); } + } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -3159,7 +2602,6 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hCPE[0]->element_brate = ivas_total_brate; } - /* core-decoding of transport channels */ if ( st_ivas->nSCE == 1 ) { @@ -3778,7 +3220,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; + Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { @@ -3786,85 +3228,8 @@ void ivas_jbm_dec_feed_tc_to_renderer( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3937,22 +3302,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) { -#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR(i_ts = 0; i_ts < num_md_sub_frames; i_ts++) - { - FOR(i = 0; i < num_out_ch; i++) - { - FOR(j = 0; j < num_in_ch; j++) - { - FOR(b = 0; b < num_bands_out; b++) - { - st_ivas->hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat(st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], st_ivas->hSpar->hMdDec->Q_mixer_mat); - } - } - } - } -#endif - IF(hSpar->hMdDec->td_decorr_flag && !(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM))) { Word16 ch_sba_idx = 0; @@ -4033,7 +3382,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; + Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { @@ -4041,85 +3390,8 @@ void ivas_jbm_dec_feed_tc_to_renderer( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4191,22 +3463,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - st_ivas->hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], st_ivas->hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { Word16 ch_sba_idx = 0; @@ -4263,93 +3519,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( { ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; + Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; - hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + hSpar->hMdDec->Q_mixer_mat = 31; + num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4421,22 +3600,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - st_ivas->hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], st_ivas->hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { Word16 ch_sba_idx = 0; @@ -4495,7 +3658,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); } #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; + Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { @@ -4503,85 +3666,8 @@ void ivas_jbm_dec_feed_tc_to_renderer( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4653,22 +3739,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - st_ivas->hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], st_ivas->hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { Word16 ch_sba_idx = 0; @@ -4803,10 +3873,10 @@ void ivas_jbm_dec_feed_tc_to_renderer( } f2me_buf(st_ivas->hParamMC->h_output_synthesis_params.proto_matrix, st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_fx, &st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_e, nchan_out_cov * nchan_transport); - IF (st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV) - { - f2me_buf(st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, &st_ivas->hParamMC->ls_conv_dmx_e, nchan_out_cov * nchan_out_transport); - } + //IF (st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV) + //{ + // f2me_buf(st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, &st_ivas->hParamMC->ls_conv_dmx_e, nchan_out_cov * nchan_out_transport); + //} floatToFixed_arr(st_ivas->hParamMC->icld_q, st_ivas->hParamMC->icld_q_fx, 8, st_ivas->hParamMC->hMetadataPMC->num_parameter_bands * st_ivas->hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe); @@ -4850,7 +3920,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( { #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; + Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { @@ -4858,85 +3928,8 @@ void ivas_jbm_dec_feed_tc_to_renderer( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min( hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -5008,22 +4001,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { -#if 0 - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - st_ivas->hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], st_ivas->hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { Word16 ch_sba_idx = 0; @@ -5361,7 +4338,7 @@ ivas_error ivas_jbm_dec_render( { FOR( j = 0; j < st_ivas->nchan_transport; j++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); + //st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); } } ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc_fx, p_output_fx ); @@ -5694,45 +4671,16 @@ ivas_error ivas_jbm_dec_render( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } - Word16 q1 = 30, q2 = 30; hSpar->hMdDec->Q_mixer_mat = 30; -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -5775,21 +4723,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } -#if 0 - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -5854,45 +4787,16 @@ ivas_error ivas_jbm_dec_render( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } - Word16 q1 = 30, q2 = 30; hSpar->hMdDec->Q_mixer_mat = 30; -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -5949,21 +4853,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } -#if 0 - FOR( Word16 m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -6099,45 +4988,16 @@ ivas_error ivas_jbm_dec_render( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } - Word16 q1 = 30, q2 = 30; hSpar->hMdDec->Q_mixer_mat = 30; -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -6180,21 +5040,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } -#if 0 - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -6233,45 +5078,16 @@ ivas_error ivas_jbm_dec_render( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } - Word16 q1 = 30, q2 = 30; hSpar->hMdDec->Q_mixer_mat = 30; -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -6314,21 +5130,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } -#if 0 - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -6367,45 +5168,15 @@ ivas_error ivas_jbm_dec_render( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } - Word16 q1 = 30, q2 = 30; -#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - hSpar->hMdDec->Q_mixer_mat = 30; - for ( int l = 0; l < numch_out; l++ ) - { - for ( j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( Word16 m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -6448,21 +5219,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } -#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR( Word16 m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); @@ -6566,7 +5322,7 @@ ivas_error ivas_jbm_dec_render( { FOR( j = 0; j < st_ivas->nchan_transport; j++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); + //st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); } } ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc_fx, p_output_fx ); @@ -6698,7 +5454,7 @@ ivas_error ivas_jbm_dec_render( { FOR( j = 0; j < MC_PARAMUPMIX_MAX_INPUT_CHANS; j++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); + //st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); } } ivas_ls_setup_conversion_fx( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, *nSamplesRendered, p_output_fx, p_output_fx ); diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c index b6b88e0e4..a7c0fe222 100644 --- a/lib_dec/ivas_lfe_dec.c +++ b/lib_dec/ivas_lfe_dec.c @@ -47,7 +47,7 @@ /* Delay handling of LFE: overall_lfe_delay = max(11.5, BLOCK_OFFSET_MS); */ #define BLOCK_OFFSET_MS 12 - +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_lfe_dec_delay_adjust() * @@ -472,3 +472,4 @@ void ivas_lfe_dec_close( return; } #endif +#endif \ No newline at end of file diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index 4efe4a477..ecda2cb2e 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -352,27 +352,8 @@ void ivas_lfe_dec_fx( { /* note: in BFI branch, buffer 't_audio' is in time-domain ('wtda' signal) */ hLFE->bfi_count++; -#ifdef IVAS_FLOAT_FIXED_TBD - ivas_lfe_tdplc_fx( hLFE, hLFE->prevsynth_buf, t_audio, output_frame ); -#else - float t_audio_flt[L_FRAME48k]; - FOR( int k = 0; k < 240; k++ ) - { - - hLFE->prevsynth_buf[k] = (float) hLFE->prevsynth_buf_fx[k] / ONE_IN_Q9; - } - - ivas_lfe_tdplc( hLFE, hLFE->prevsynth_buf, t_audio_flt, output_frame ); - FOR( int k = 0; k < 960; k++ ) - { - if ( k < 240 ) - { - hLFE->prevsynth_buf_fx[k] = (Word32) ( hLFE->prevsynth_buf[k] * ONE_IN_Q9 ); - } - t_audio[k] = (Word32) ( t_audio_flt[k] * ONE_IN_Q9 ); - } -#endif // IVAS_FLOAT_FIXED_TBD + ivas_lfe_tdplc_fx( hLFE, hLFE->prevsynth_buf_fx, t_audio, output_frame ); ivas_itda_fx( t_audio, out, dct_len ); ivas_lfe_dec_windowing_fx( hLFE, out ); diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c index 1844ca8ee..6fe8d5939 100644 --- a/lib_dec/ivas_lfe_plc.c +++ b/lib_dec/ivas_lfe_plc.c @@ -54,7 +54,7 @@ #define MAX_LEN_LP 960 #define EPS_STOP 1e-5 - +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------------------------* * Static function declarations * @@ -535,3 +535,4 @@ void ivas_lfe_tdplc( return; } +#endif \ No newline at end of file diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c new file mode 100644 index 000000000..279749caa --- /dev/null +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -0,0 +1,990 @@ +/****************************************************************************************************** + + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include "prot.h" +#include "prot_fx1.h" +#include "prot_fx2.h" +#include "ivas_prot.h" +#include "ivas_rom_com.h" +#include +#include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" +#endif + +/*------------------------------------------------------------------------------------------* + * Local constants + *------------------------------------------------------------------------------------------*/ + +#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) +#define LFE_PLC_LPCORD ( 20 ) +#define LFE_PLC_MAXITER ( 10 ) +#define POW_THR ( 1.0e-8f ) +#define LFE_PLC_RECLEN_48K ( ( IVAS_LFE_NUM_COEFFS_IN_SUBGRP + 1 ) * L_FRAME48k / IVAS_LFE_NUM_COEFFS_IN_SUBGRP + LFE_PLC_FDEL ) +#define LFE_PLC_RECLEN ( ( LFE_PLC_RECLEN_48K / LFE_PLC_DSF ) ) +#define LFE_PLC_MUTE_THR ( 10 ) +#define LFE_PLC_BURST_ATT ( pow( pow( 10.0, -3.0 / 20.0 ), 1.0 / ( LFE_PLC_FS * 0.02 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ + +#define MAX_LEN_LP 960 + +#define EPS_STOP 1e-5 +#ifdef IVAS_FLOAT_FIXED +#define POW_THR_Q50 ( 11258999 ) +#define EPS_STOP_Q31 ( 21475 ) +#define LFE_PLC_BURST_ATT_Q31 ( 2124429696 ) + +/*------------------------------------------------------------------------------------------* + * Static function declarations + * + * Note (DLB): the local double precision functions defined below are replica of corresponding + * float functions defined in tools.c, lpc_tools.c and syn_filt.c. + * Double precision arithmetic is required for proper functioning of the lfe_plc. + *------------------------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------* + * autocorr_fx() + * + * Compute autocorrelations of input signal + *---------------------------------------------------------------------*/ + +static void d_autocorr_fx( + const Word32 *x_fx, /* i : input signal */ + Word16 x_q_fx, + Word32 *r_fx, /* o : autocorrelations vector */ + Word16 *r_q_fx, + const Word16 m, /* i : order of LP filter */ + const Word16 len, /* i : window size */ + const UWord32 *wind_fx, /* i : window */ + const Word16 rev_flag, /* i : flag to reverse window */ + const Word16 sym_flag, /* i : symmetric window flag */ + const Word16 no_thr /* i : flag to avoid thresholding */ +) +{ + Word16 i, j; + Word32 t_fx[MAX_LEN_LP]; + Word64 s_fx; + Word32 temp; + Word16 tmp_q, exp1, exp2; + + /* Windowing of signal */ + IF( EQ_16( rev_flag, 1 ) ) + { + /* time reversed window */ + FOR( i = 0; i < len; i++ ) + { + t_fx[i] = Mpy_32_32( x_fx[i], wind_fx[sub( sub( len, i ), 1 )] ); // Q = x_q_fx + move32(); + } + } + ELSE IF( EQ_16( sym_flag, 1 ) ) + { + /* symmetric window of even length */ + FOR( i = 0; i < len / 2; i++ ) + { + t_fx[i] = Mpy_32_32( x_fx[i], wind_fx[i] ); // Q = x_q_fx + move32(); + } + + FOR( ; i < len; i++ ) + { + t_fx[i] = Mpy_32_32( x_fx[i], wind_fx[sub( sub( len, 1 ), i )] ); // Q = x_q_fx + move32(); + } + } + ELSE /* assymetric window */ + { + FOR( i = 0; i < len; i++ ) + { + t_fx[i] = Mpy_32_32( x_fx[i], wind_fx[i] ); // Q = x_q_fx + move32(); + } + } + + /* Compute r[1] to r[m] */ + FOR( i = 0; i <= m; i++ ) + { + exp1 = norm_l( t_fx[0] ); + exp2 = norm_l( t_fx[i] ); + s_fx = W_deposit32_l( Mpy_32_32( L_shl( t_fx[0], exp1 ), L_shl( t_fx[i], exp2 ) ) ); + r_q_fx[i] = sub( add( add( x_q_fx, exp1 ), add( x_q_fx, exp2 ) ), 31 ); + move16(); + FOR( j = 1; j < sub( len, i ); j++ ) + { + exp1 = norm_l( t_fx[j] ); + exp2 = norm_l( t_fx[add( i, j )] ); + temp = Mpy_32_32( L_shl( t_fx[j], exp1 ), L_shl( t_fx[add( i, j )], exp2 ) ); + tmp_q = sub( add( add( x_q_fx, exp1 ), add( x_q_fx, exp2 ) ), 31 ); + + IF( LT_16( tmp_q, r_q_fx[i] ) ) + { + s_fx = W_add( W_shr( s_fx, sub( r_q_fx[i], tmp_q ) ), W_deposit32_l( temp ) ); + r_q_fx[i] = tmp_q; + move16(); + } + ELSE + { + s_fx = W_add( s_fx, W_shr( temp, sub( tmp_q, r_q_fx[i] ) ) ); + } + } + exp1 = W_norm( s_fx ); + r_fx[i] = W_extract_h( W_shl( s_fx, exp1 ) ); + move32(); + r_q_fx[i] = sub( add( r_q_fx[i], exp1 ), 32 ); + move16(); + } + + // 2097152000 = 1000 in Q21 + IF( LT_16( r_q_fx[0], Q21 ) ) + { + IF( L_and( LT_32( r_fx[0], L_shr( 2097152000, sub( Q21, r_q_fx[0] ) ) ), EQ_16( no_thr, 0 ) ) ) + { + r_fx[0] = 2097152000; + move32(); + r_q_fx[0] = Q21; + move16(); + } + } + ELSE + { + IF( L_and( LT_32( L_shr( r_fx[0], sub( r_q_fx[0], Q21 ) ), 2097152000 ), EQ_16( no_thr, 0 ) ) ) + { + r_fx[0] = 2097152000; + move32(); + r_q_fx[0] = Q21; + move16(); + } + } + + return; +} + +/*---------------------------------------------------------------------* + * lev_dur_fx() + * + * Wiener-Levinson-Durbin algorithm to compute LP parameters from the autocorrelations + * of input signal + *---------------------------------------------------------------------*/ + +/*! r: energy of prediction error */ +static Word16 d_lev_dur_fx( + Word32 *a_fx, /* o : LP coefficients (a[0] = 1.0) */ + Word16 *a_q_fx, + Word32 *r_fx, /* i : vector of autocorrelations */ + Word16 *r_q_fx, + const Word16 m, /* i : order of LP filter */ + Word32 *epsP_fx, /* o : prediction error energy */ + Word16 *epsP_q_fx ) +{ + Word16 i, j, l; + Word16 flag = 0; + Word32 buf_fx[TCXLTP_LTP_ORDER]; + Word16 rc_q_fx[TCXLTP_LTP_ORDER]; + Word32 *rc_fx; /* reflection coefficients 0,...,m-1 */ + Word32 temp1, temp2, err_fx, at_fx, s, a_tmp; + Word16 temp_q1, temp_q2, s_q_fx, err_q_fx, exp1, exp2; + Word64 s_fx; + + rc_fx = &buf_fx[0]; + rc_fx[0] = BASOP_Util_Divide3232_Scale_cadence( -r_fx[1], r_fx[0], &temp_q2 ); + move32(); + rc_q_fx[0] = add( sub( r_q_fx[1], r_q_fx[0] ), sub( 31, temp_q2 ) ); + move16(); + + a_fx[0] = ONE_IN_Q30; + move32(); + a_q_fx[0] = 30; + move16(); + a_fx[1] = rc_fx[0]; + move32(); + a_q_fx[1] = rc_q_fx[0]; + move32(); + + temp1 = Mpy_32_32( r_fx[1], rc_fx[0] ); + temp_q1 = sub( add( r_q_fx[1], rc_q_fx[0] ), 31 ); + + IF( LT_16( temp_q1, r_q_fx[0] ) ) + { + err_fx = L_add( L_shr( r_fx[0], sub( r_q_fx[0], temp_q1 ) ), temp1 ); + err_q_fx = temp_q1; + move16(); + } + ELSE + { + err_fx = L_add( r_fx[0], L_shr( temp1, sub( temp_q1, r_q_fx[0] ) ) ); + err_q_fx = r_q_fx[0]; + move16(); + } + + IF( epsP_fx != NULL ) + { + epsP_fx[0] = r_fx[0]; + move32(); + epsP_q_fx[0] = r_q_fx[0]; + move16(); + epsP_fx[1] = err_fx; + move32(); + epsP_q_fx[1] = err_q_fx; + move16(); + } + + FOR( i = 2; i <= m; i++ ) + { + s_fx = 0; + move64(); + + FOR( j = 0; j < i; j++ ) + { + exp1 = norm_l( r_fx[i - j] ); + exp2 = norm_l( a_fx[j] ); + temp1 = Mpy_32_32( L_shl( r_fx[i - j], exp1 ), L_shl( a_fx[j], exp2 ) ); + temp_q1 = sub( add( add( r_q_fx[i - j], exp1 ), add( a_q_fx[j], exp2 ) ), 31 ); + + IF( EQ_16( j, 0 ) ) + { + s_fx = W_deposit32_l( temp1 ); + s_q_fx = temp_q1; + move16(); + } + ELSE + { + IF( LT_16( temp_q1, s_q_fx ) ) + { + s_fx = W_add( W_shr( s_fx, sub( s_q_fx, temp_q1 ) ), W_deposit32_l( temp1 ) ); + s_q_fx = temp_q1; + move16(); + } + ELSE + { + s_fx = W_add( s_fx, W_shr( W_deposit32_l( temp1 ), sub( temp_q1, s_q_fx ) ) ); + } + } + } + exp1 = W_norm( s_fx ); + s = W_extract_h( W_shl( s_fx, exp1 ) ); + s_q_fx = sub( add( s_q_fx, exp1 ), 32 ); + + rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( -s, err_fx, &temp_q2 ), 1 ); + move32(); + rc_q_fx[i - 1] = sub( add( sub( s_q_fx, err_q_fx ), sub( 31, temp_q2 ) ), 1 ); + move16(); + + IF( LT_16( rc_q_fx[i - 1], 31 ) ) + { + + IF( GT_32( abs( rc_fx[i - 1] ), L_shr( 2146302532, sub( 31, rc_q_fx[i - 1] ) ) ) ) // 2146302532 = 0.99945f in Q31 + { + flag = 1; /* Test for unstable filter. If unstable keep old A(z) */ + move16(); + } + } + ELSE + { + IF( GT_32( abs( L_shr( rc_fx[i - 1], sub( rc_q_fx[i - 1], 31 ) ) ), 2146302532 ) ) // 2146302532 = 0.00045f in Q31 + { + flag = 1; /* Test for unstable filter. If unstable keep old A(z) */ + move16(); + } + } + + FOR( j = 1; j <= i / 2; j++ ) + { + l = sub( i, j ); + exp1 = sub( norm_l( rc_fx[sub( i, 1 )] ), 1 ); + exp2 = sub( norm_l( a_fx[l] ), 1 ); + rc_fx[sub( i, 1 )] = L_shl( rc_fx[sub( i, 1 )], exp1 ); + move32(); + rc_q_fx[sub( i, 1 )] = add( rc_q_fx[sub( i, 1 )], exp1 ); + move16(); + a_fx[l] = L_shl( a_fx[l], exp2 ); + move32(); + a_q_fx[l] = add( a_q_fx[l], exp2 ); + move16(); + + exp2 = sub( norm_l( a_fx[j] ), 1 ); + a_fx[j] = L_shl( a_fx[j], exp2 ); + move32(); + a_q_fx[j] = add( a_q_fx[j], exp2 ); + move16(); + + temp2 = Mpy_32_32( rc_fx[sub( i, 1 )], a_fx[l] ); + temp_q2 = sub( add( rc_q_fx[sub( i, 1 )], a_q_fx[l] ), 31 ); + + IF( LT_16( temp_q2, a_q_fx[j] ) ) + { + at_fx = L_add( L_shr( a_fx[j], sub( a_q_fx[j], temp_q2 ) ), temp2 ); + temp_q1 = temp_q2; + move16(); + } + ELSE + { + at_fx = L_add( a_fx[j], L_shr( temp2, sub( temp_q2, a_q_fx[j] ) ) ); + temp_q1 = a_q_fx[j]; + move16(); + } + + temp2 = Mpy_32_32( rc_fx[sub( i, 1 )], a_fx[j] ); + temp_q2 = sub( add( rc_q_fx[sub( i, 1 )], a_q_fx[j] ), 31 ); + + IF( LT_16( temp_q2, a_q_fx[l] ) ) + { + a_fx[l] = L_add( L_shr( a_fx[l], sub( a_q_fx[l], temp_q2 ) ), temp2 ); + move32(); + a_q_fx[l] = temp_q2; + move16(); + } + ELSE + { + a_fx[l] = L_add( a_fx[l], L_shr( temp2, sub( temp_q2, a_q_fx[l] ) ) ); + move16(); + } + a_fx[j] = at_fx; + move32(); + a_q_fx[j] = temp_q1; + move16(); + } + a_fx[i] = rc_fx[sub( i, 1 )]; + move32(); + a_q_fx[i] = rc_q_fx[sub( i, 1 )]; + move16(); + + exp1 = sub( norm_l( rc_fx[sub( i, 1 )] ), 1 ); + exp2 = norm_l( s ); + temp1 = Mpy_32_32( L_shl( rc_fx[sub( i, 1 )], exp1 ), L_shl( s, exp2 ) ); + temp_q1 = sub( add( add( rc_q_fx[sub( i, 1 )], exp1 ), add( s_q_fx, exp2 ) ), 31 ); + + IF( LT_16( temp_q1, err_q_fx ) ) + { + err_fx = L_add( L_shr( err_fx, sub( err_q_fx, temp_q1 ) ), temp1 ); + err_q_fx = temp_q1; + move16(); + } + ELSE + { + err_fx = L_add( err_fx, L_shr( temp1, sub( temp_q1, err_q_fx ) ) ); + } + + IF( LE_32( err_fx, 0 ) ) + { + err_fx = 21474836; // 0.01 in Q31 + move32(); + err_q_fx = Q31; + move16(); + } + IF( epsP_fx != NULL ) + { + epsP_fx[i] = err_fx; + move32(); + epsP_q_fx[i] = err_q_fx; + move16(); + } + } + + return ( flag ); +} + +/*-------------------------------------------------------------------* + * a2rc_fx() + * + * Convert from LPC to reflection coeff + *-------------------------------------------------------------------*/ + +static Word16 d_a2rc_fx( + const Word32 *a_fx, /* i : LPC coefficients */ + Word16 *a_q_fx, + Word32 *refl_fx, /* o : Reflection co-efficients */ + const Word16 lpcorder /* i : LPC order */ +) +{ + Word16 m, j, n; + Word32 ff_fx[LFE_PLC_LPCORD]; + Word32 km_fx, denom_fx, temp1, temp2, temp; + Word16 ff_q_fx[LFE_PLC_LPCORD], temp_q1, temp_q2, denom_q_fx, km_q_fx, temp_q; + Word16 exp1, exp2; + + FOR( m = 0; m < lpcorder; m++ ) + { + ff_fx[m] = -a_fx[m]; + move32(); + ff_q_fx[m] = a_q_fx[m]; + move32(); + } + + /* Initialization */ + FOR( m = sub( lpcorder, 1 ); m >= 0; m-- ) + { + km_fx = ff_fx[m]; + move32(); + km_q_fx = ff_q_fx[m]; + move16(); + IF( GE_64( W_shr( abs( km_fx ), sub( ff_q_fx[m], Q30 ) ), W_deposit32_l( ONE_IN_Q30 ) ) ) + { + FOR( j = 0; j < lpcorder; j++ ) + { + refl_fx[j] = 0; + move32(); + } + return 0; + } + + refl_fx[m] = -km_fx; + move32(); + + exp1 = norm_l( km_fx ); + temp1 = Mpy_32_32( L_shl( km_fx, exp1 ), L_shl( km_fx, exp1 ) ); + temp_q1 = sub( add( add( km_q_fx, exp1 ), add( km_q_fx, exp1 ) ), 31 ); + temp1 = L_sub( ONE_IN_Q30, L_shr( temp1, sub( temp_q1, 30 ) ) ); + denom_fx = L_deposit_l( BASOP_Util_Divide3232_Scale( ONE_IN_Q30, temp1, &temp_q1 ) ); + denom_q_fx = sub( 15, temp_q1 ); + + FOR( j = 0; j < m / 2; j++ ) + { + n = sub( sub( m, 1 ), j ); + + exp1 = norm_l( denom_fx ); + exp2 = sub( norm_l( ff_fx[j] ), 1 ); + temp1 = Mpy_32_32( L_shl( denom_fx, exp1 ), L_shl( ff_fx[j], exp2 ) ); + temp_q1 = sub( add( add( denom_q_fx, exp1 ), add( ff_q_fx[j], exp2 ) ), 31 ); + + exp2 = sub( norm_l( ff_fx[n] ), 1 ); + temp2 = Mpy_32_32( L_shl( denom_fx, exp1 ), L_shl( ff_fx[n], exp2 ) ); + temp_q2 = sub( add( add( denom_q_fx, exp1 ), add( ff_q_fx[n], exp2 ) ), 31 ); + + exp1 = norm_l( km_fx ); + exp2 = sub( norm_l( temp2 ), 1 ); + temp = Mpy_32_32( L_shl( km_fx, exp1 ), L_shl( temp2, exp2 ) ); + temp_q = sub( add( add( km_q_fx, exp1 ), add( temp_q2, exp2 ) ), 31 ); + + IF( LT_16( temp_q, temp_q1 ) ) + { + ff_fx[j] = L_add( L_shr( temp1, sub( temp_q1, temp_q ) ), temp ); + move32(); + ff_q_fx[j] = temp_q; + move16(); + } + ELSE + { + ff_fx[j] = L_add( temp1, L_shr( temp, sub( temp_q, temp_q1 ) ) ); + move32(); + ff_q_fx[j] = temp_q1; + move16(); + } + + exp1 = norm_l( km_fx ); + exp2 = sub( norm_l( temp1 ), 1 ); + temp = Mpy_32_32( L_shl( km_fx, exp1 ), L_shl( temp1, exp2 ) ); + temp_q = sub( add( add( km_q_fx, exp1 ), add( temp_q1, exp2 ) ), 31 ); + + IF( LT_16( temp_q, temp_q2 ) ) + { + ff_fx[n] = L_add( L_shr( temp2, sub( temp_q2, temp_q ) ), temp ); + move32(); + ff_q_fx[n] = temp_q; + move16(); + } + ELSE + { + ff_fx[n] = L_add( temp2, L_shr( temp, sub( temp_q, temp_q2 ) ) ); + move32(); + ff_q_fx[n] = temp_q2; + move16(); + } + } + + IF( m & 1 ) + { + exp1 = norm_l( denom_fx ); + exp2 = sub( norm_l( ff_fx[j] ), 1 ); + temp1 = Mpy_32_32( L_shl( denom_fx, exp1 ), L_shl( ff_fx[j], exp2 ) ); + temp_q1 = sub( add( add( denom_q_fx, exp1 ), add( ff_q_fx[j], exp2 ) ), 31 ); + + exp1 = norm_l( km_fx ); + exp2 = sub( norm_l( temp1 ), 1 ); + temp = Mpy_32_32( L_shl( km_fx, exp1 ), L_shl( temp1, exp2 ) ); + temp_q = sub( add( add( km_q_fx, exp1 ), add( temp_q1, exp2 ) ), 31 ); + + IF( LT_16( temp_q, temp_q1 ) ) + { + ff_fx[j] = L_add( L_shr( temp1, sub( temp_q1, temp_q ) ), temp ); + move32(); + ff_q_fx[j] = temp_q; + move16(); + } + ELSE + { + ff_fx[j] = L_add( temp1, L_shr( temp, sub( temp_q, temp_q1 ) ) ); + move32(); + ff_q_fx[j] = temp_q1; + move16(); + } + } + } + + return 1; +} + +static void d_syn_filt_fx( + const Word32 *a_fx, /* i : LP filter coefficients */ + Word16 *a_q_fx, + const Word16 m, /* i : order of LP filter */ + const Word32 *x_fx, /* i : input signal */ + Word32 *y_fx, /* o : output signal */ + Word16 *y_q_fx, + const Word16 l, /* i : size of filtering */ + const Word32 *mem_fx, /* i : initial filter states */ + Word16 mem_q_fx ) +{ + Word16 i, j; + Word32 buf_fx[LFE_PLC_LPCORD + LFE_PLC_RECLEN]; /* temporary synthesis buffer */ + Word32 s_fx, *yy_fx, temp; + Word16 yy_q_fx[LFE_PLC_LPCORD + LFE_PLC_RECLEN], exp1, exp2, s_q_fx, temp_q; + + yy_fx = &buf_fx[0]; + + /*------------------------------------------------------------------* + * copy initial filter states into synthesis buffer and do synthesis + *------------------------------------------------------------------*/ + FOR( i = 0; i < m; i++ ) + { + *yy_fx++ = mem_fx[i]; + move32(); + yy_q_fx[i] = mem_q_fx; + move16(); + } + + /*-----------------------------------------------------------------------* + * Do the filtering + *-----------------------------------------------------------------------*/ + + FOR( i = 0; i < l; i++ ) + { + s_fx = x_fx[i]; + move32(); + s_q_fx = Q31; + move16(); + FOR( j = 1; j <= m; j++ ) + { + exp1 = sub( norm_l( a_fx[j] ), 1 ); + exp2 = sub( norm_l( yy_fx[i - j] ), 1 ); + IF( GT_16( j, i ) ) + { + temp_q = mem_q_fx; + move16(); + } + ELSE + { + temp_q = yy_q_fx[sub( i, j )]; + move16(); + } + temp = Mpy_32_32( L_shl( a_fx[j], exp1 ), L_shl( yy_fx[sub( i, j )], exp2 ) ); + temp_q = sub( add( add( a_q_fx[j], exp1 ), add( temp_q, exp2 ) ), 31 ); + + IF( LT_16( s_q_fx, temp_q ) ) + { + s_fx = L_sub( s_fx, L_shr( temp, sub( temp_q, s_q_fx ) ) ); + } + ELSE + { + s_fx = L_sub( L_shr( s_fx, sub( s_q_fx, temp_q ) ), temp ); + s_q_fx = temp_q; + move16(); + } + } + yy_fx[i] = s_fx; + move32(); + yy_q_fx[i] = s_q_fx; + move16(); + y_fx[i] = L_shr( s_fx, sub( s_q_fx, Q5 ) ); + move32(); + } + *y_q_fx = Q5; + move16(); + + return; +} + +/*-----------------------------------------------------------------------------------------* + * Function check_stab_fx() + * + * LPC filter stability check applying given sharpening value delta + *-----------------------------------------------------------------------------------------*/ + +static Word16 check_stab_fx( + Word32 *a_fx, + Word16 *a_q_fx, + Word32 delta_fx, + Word16 delta_q_fx ) +{ + Word16 i; + Word16 stable; + + Word32 amod_fx[LFE_PLC_LPCORD], refl_fx[LFE_PLC_LPCORD]; + Word16 fac_q_fx, fac1_q_fx, amod_q_fx[LFE_PLC_LPCORD]; + Word16 exp1, exp2; + Word32 fac_fx, fac1_fx; + + exp1 = norm_l( delta_fx ); + delta_fx = L_shl( delta_fx, exp1 ); + delta_q_fx = add( delta_q_fx, exp1 ); + + IF( LT_16( delta_q_fx, 29 ) ) + { + fac_fx = L_add( L_shr( ONE_IN_Q29, sub( 29, delta_q_fx ) ), delta_fx ); + fac_q_fx = delta_q_fx; + move16(); + } + ELSE + { + fac_fx = L_add( ONE_IN_Q29, L_shr( delta_fx, sub( delta_q_fx, 29 ) ) ); + fac_q_fx = Q29; + move16(); + } + fac1_fx = fac_fx; + move32(); + fac1_q_fx = fac_q_fx; + move16(); + + FOR( i = 0; i < LFE_PLC_LPCORD; i++ ) + { + exp1 = norm_l( a_fx[i] ); + exp2 = norm_l( fac_fx ); + amod_fx[i] = Mpy_32_32( L_shl( a_fx[i], exp1 ), L_shl( fac_fx, exp2 ) ); + move32(); + amod_q_fx[i] = sub( add( add( a_q_fx[i], exp1 ), add( fac_q_fx, exp2 ) ), 31 ); + move16(); + + exp1 = norm_l( fac_fx ); + exp2 = norm_l( fac1_fx ); + fac_fx = Mpy_32_32( L_shl( fac_fx, exp1 ), L_shl( fac1_fx, exp2 ) ); + fac_q_fx = sub( add( add( fac_q_fx, exp1 ), add( fac1_q_fx, exp2 ) ), 31 ); + } + stable = d_a2rc_fx( amod_fx, amod_q_fx, refl_fx, LFE_PLC_LPCORD ); + + return stable; +} + +/*-----------------------------------------------------------------------------------------* + * Function find_max_delta_fx() + * + * Find maximum LPC filter sharpening by iteration to get a filter that is almost instable + *-----------------------------------------------------------------------------------------*/ + +static Word32 find_max_delta_fx( + Word32 *a_fx, + Word16 *a_q_fx, + Word16 *delta_q_fx ) +{ + Word16 stable; + Word16 eps_q_fx, fac_q_fx, exp1, exp2; + Word32 delta_fx, fac_fx, eps_fx, temp; + + delta_fx = 0; + move32(); + eps_fx = 21474836; // 0.01 in Q31 + move32(); + fac_fx = 1073741824; // 2 in Q29 + move32(); + eps_q_fx = Q31; + move16(); + fac_q_fx = Q29; + move16(); + + stable = FALSE; + move16(); + + WHILE( check_stab_fx( a_fx, a_q_fx, eps_fx, eps_q_fx ) ) + { + exp1 = norm_l( eps_fx ); + exp2 = norm_l( fac_fx ); + eps_fx = Mpy_32_32( L_shl( eps_fx, exp1 ), L_shl( fac_fx, exp2 ) ); + eps_q_fx = sub( add( add( eps_q_fx, exp1 ), add( fac_q_fx, exp2 ) ), 31 ); + stable = TRUE; + move16(); + } + fac_fx = 1073741824; // 0.5 in Q31 + move32(); + fac_q_fx = Q31; + move16(); + + IF( stable ) + { + exp1 = norm_l( eps_fx ); + exp2 = norm_l( fac_fx ); + eps_fx = Mpy_32_32( L_shl( eps_fx, exp1 ), L_shl( fac_fx, exp2 ) ); + eps_q_fx = sub( add( add( eps_q_fx, exp1 ), add( fac_q_fx, exp2 ) ), 31 ); + } + + WHILE( !stable ) + { + exp1 = norm_l( eps_fx ); + exp2 = norm_l( fac_fx ); + eps_fx = Mpy_32_32( L_shl( eps_fx, exp1 ), L_shl( fac_fx, exp2 ) ); + eps_q_fx = sub( add( add( eps_q_fx, exp1 ), add( fac_q_fx, exp2 ) ), 31 ); + + stable = check_stab_fx( a_fx, a_q_fx, eps_fx, eps_q_fx ); + } + + /* must be stable with current eps */ + *delta_q_fx = sub( norm_l( eps_fx ), 1 ); + delta_fx = L_shl( eps_fx, *delta_q_fx ); + *delta_q_fx = add( eps_q_fx, *delta_q_fx ); + + exp1 = norm_l( eps_fx ); + exp2 = norm_l( fac_fx ); + eps_fx = Mpy_32_32( L_shl( eps_fx, exp1 ), L_shl( fac_fx, exp2 ) ); + eps_q_fx = sub( add( add( eps_q_fx, exp1 ), add( fac_q_fx, exp2 ) ), 31 ); + + WHILE( 1 ) + { + IF( LT_16( *delta_q_fx, eps_q_fx ) ) + { + delta_fx = L_add( delta_fx, L_shr( eps_fx, sub( eps_q_fx, *delta_q_fx ) ) ); + } + ELSE + { + delta_fx = L_add( L_shr( delta_fx, sub( *delta_q_fx, eps_q_fx ) ), eps_fx ); + *delta_q_fx = eps_q_fx; + move16(); + } + stable = check_stab_fx( a_fx, a_q_fx, delta_fx, *delta_q_fx ); + + IF( !stable ) + { + temp = abs( eps_fx ); + IF( GT_32( L_shr( temp, sub( eps_q_fx, 31 ) ), EPS_STOP_Q31 ) ) + { + exp1 = norm_l( -temp ); + exp2 = norm_l( fac_fx ); + eps_fx = Mpy_32_32( L_shl( -temp, exp1 ), L_shl( fac_fx, exp2 ) ); + eps_q_fx = sub( add( add( eps_q_fx, exp1 ), add( fac_q_fx, exp2 ) ), 31 ); + } + ELSE + { + eps_fx = -abs( eps_fx ); + } + } + ELSE + { + temp = abs( eps_fx ); + IF( LT_32( L_shr( temp, sub( eps_q_fx, 31 ) ), EPS_STOP_Q31 ) ) + { + BREAK; + } + + exp1 = norm_l( temp ); + exp1 = norm_l( fac_fx ); + eps_fx = Mpy_32_32( L_shl( temp, exp1 ), L_shl( fac_fx, exp2 ) ); + eps_q_fx = sub( add( add( eps_q_fx, exp1 ), add( fac_q_fx, exp2 ) ), 31 ); + } + } + + return delta_fx; +} + +/*-----------------------------------------------------------------------------------------* + * Function recover_samples_fx() + * + * recover lost samples by extrapolation of signal buffer + *-----------------------------------------------------------------------------------------*/ + +static void recover_samples_fx( + const Word16 bfi_count, + const Word32 *outbuf_fx, + Word16 outbuf_q_fx, + Word32 *rec_frame_fx, + Word16 *rec_frame_q_fx ) +{ + Word16 i; + Word32 d_outbuf_fx[LFE_PLC_BUFLEN], d_a_fx[LFE_PLC_LPCORD + 1], d_pee_fx[LFE_PLC_LPCORD + 1]; + Word16 d_r_q_fx[LFE_PLC_LPCORD + 1], d_a_q_fx[LFE_PLC_LPCORD + 1], d_pee_q_fx[LFE_PLC_LPCORD + 1]; + Word32 d_r_fx[LFE_PLC_LPCORD + 1], zeroes_fx[LFE_PLC_RECLEN]; + Word32 delta_fx, fac_fx, att_fx, temp; + Word16 delta_q_fx, fac_q_fx, att_q_fx, temp_q, exp1, exp2; + + Copy32( outbuf_fx, d_outbuf_fx, LFE_PLC_BUFLEN ); + + d_autocorr_fx( d_outbuf_fx, outbuf_q_fx, d_r_fx, d_r_q_fx, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, d_hamm_lfe_plc_fx, 0, 1, 1 ); + + IF( LT_64( W_shr( d_r_fx[0], sub( d_r_q_fx[0], Q19 ) ), W_deposit32_l( Mpy_32_32( POW_THR_Q50, LFE_PLC_BUFLEN ) ) ) ) + { + set_zero_fx( rec_frame_fx, LFE_PLC_RECLEN ); + return; + } + + d_lev_dur_fx( d_a_fx, d_a_q_fx, d_r_fx, d_r_q_fx, LFE_PLC_LPCORD, d_pee_fx, d_pee_q_fx ); + + delta_fx = find_max_delta_fx( d_a_fx + 1, d_a_q_fx + 1, &delta_q_fx ); + + IF( LT_16( delta_q_fx, Q29 ) ) + { + fac_fx = L_add( L_shr( ONE_IN_Q29, sub( Q29, delta_q_fx ) ), delta_fx ); + fac_q_fx = delta_q_fx; + move16(); + } + ELSE + { + fac_fx = L_add( ONE_IN_Q29, L_shr( delta_fx, sub( delta_q_fx, Q29 ) ) ); + fac_q_fx = Q29; + move16(); + } + att_fx = ONE_IN_Q30; + move32(); + att_q_fx = Q30; + move16(); + + IF( GE_16( bfi_count, LFE_PLC_MUTE_THR ) ) + { + att_fx = LFE_PLC_BURST_ATT_Q31; + move32(); + fac_fx = Mpy_32_32( fac_fx, att_fx ); + fac_q_fx = sub( add( fac_q_fx, att_q_fx ), 31 ); + } + + FOR( i = 1; i <= LFE_PLC_LPCORD; i++ ) + { + d_a_fx[i] = Mpy_32_32( d_a_fx[i], fac_fx ); + move32(); + d_a_q_fx[i] = sub( add( d_a_q_fx[i], fac_q_fx ), 31 ); + move16(); + IF( LT_16( delta_q_fx, Q30 ) ) + { + temp = L_add( L_shr( ONE_IN_Q30, sub( Q30, delta_q_fx ) ), delta_fx ); + temp_q = delta_q_fx; + move16(); + } + ELSE + { + temp = L_add( ONE_IN_Q30, L_shr( delta_fx, sub( delta_q_fx, Q30 ) ) ); + temp_q = Q30; + move16(); + } + exp1 = norm_l( att_fx ); + exp2 = norm_l( temp ); + temp = Mpy_32_32( L_shl( att_fx, exp1 ), L_shl( temp, exp2 ) ); + temp_q = sub( add( add( att_q_fx, exp1 ), add( temp_q, exp2 ) ), 31 ); + + exp1 = norm_l( fac_fx ); + exp2 = norm_l( temp ); + fac_fx = Mpy_32_32( L_shl( fac_fx, exp1 ), L_shl( temp, exp2 ) ); + fac_q_fx = sub( add( add( fac_q_fx, exp1 ), add( temp_q, exp2 ) ), 31 ); + } + + set_zero_fx( zeroes_fx, LFE_PLC_RECLEN ); + + d_syn_filt_fx( d_a_fx, d_a_q_fx, LFE_PLC_LPCORD, zeroes_fx, rec_frame_fx, rec_frame_q_fx, LFE_PLC_RECLEN, outbuf_fx + LFE_PLC_BUFLEN - LFE_PLC_LPCORD, outbuf_q_fx ); + + return; +} + +/*-----------------------------------------------------------------------------------------* + * Function ivas_lfe_tdplc_fx() + * + * MDCT interface recover lost samples by extrapolation of signal buffer + *-----------------------------------------------------------------------------------------*/ + +void ivas_lfe_tdplc_fx( + LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ + const Word32 *prevsynth, /* i : previous frame synthesis */ + Word32 *ytda, /* o : output time-domain buffer */ + const Word16 output_frame /* i : output frame length */ +) +{ + Word32 rec_frame_us_fx[LFE_PLC_RECLEN_48K], input_tda_fx[L_FRAME48k]; + Word32 rec_frame_fx[LFE_PLC_RECLEN], prevsynth_fx[LFE_PLC_BUFLEN]; + Word16 rec_frame_us_16_fx[LFE_PLC_RECLEN_48K], mem_fx[2 * LFE_PLC_FDEL / LFE_PLC_DSF], rec_frame_16_fx[LFE_PLC_RECLEN]; + Word16 prevsynth_16_fx[LFE_PLC_BUFLEN]; + const Word32 *pWindow_coeffs_fx; + Word32 output_Fs; + Word16 i, fade_len, full_len, dct_len, zero_pad_len, plc_fdel, rec_frame_len; + Word16 fdel_dsf_ratio, prevsynth_q_fx, rec_frame_q, temp, temp_q, idx, exp; + + output_Fs = L_mult0( output_frame, FRAMES_PER_SEC ); + fade_len = hLFE->pWindow_state->fade_len; + move16(); + full_len = hLFE->pWindow_state->full_len; + move16(); + dct_len = hLFE->pWindow_state->dct_len; + move16(); + zero_pad_len = hLFE->pWindow_state->zero_pad_len; + move16(); + pWindow_coeffs_fx = hLFE->pWindow_state->pWindow_coeffs_fx; + + temp = BASOP_Util_Divide3232_Scale( Mpy_32_32( L_shl( LFE_PLC_FDEL, 22 ), L_shl( output_Fs, 9 ) ), 48000, &temp_q ); + plc_fdel = shr( temp, sub( 15, temp_q ) ); + + temp = BASOP_Util_Divide3232_Scale( output_Fs, 48000, &temp_q ); + rec_frame_len = shl( mult( LFE_PLC_RECLEN_48K, temp ), temp_q ); + + Copy32( prevsynth, prevsynth_fx, LFE_PLC_BUFLEN ); + exp = L_norm_arr( prevsynth_fx, LFE_PLC_BUFLEN ); + scale_sig32( prevsynth_fx, LFE_PLC_BUFLEN, exp ); + prevsynth_q_fx = add( Q9, exp ); + move16(); + + recover_samples_fx( hLFE->bfi_count, prevsynth_fx, prevsynth_q_fx, rec_frame_fx, &rec_frame_q ); + + fdel_dsf_ratio = shl( div_l( LFE_PLC_FDEL, LFE_PLC_DSF ), 1 ); + set_s( mem_fx, 0, shl( fdel_dsf_ratio, 1 ) ); + + Copy_Scale_sig_32_16( prevsynth_fx, prevsynth_16_fx, LFE_PLC_BUFLEN, -16 ); // Q5 = Q21 - Q16 + Copy_Scale_sig_32_16( rec_frame_fx, rec_frame_16_fx, LFE_PLC_RECLEN, 0 ); // Q5 + + modify_Fs_fx( prevsynth_16_fx + LFE_PLC_BUFLEN - LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FDEL / LFE_PLC_DSF, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0 ); + modify_Fs_fx( rec_frame_16_fx, LFE_PLC_RECLEN, LFE_PLC_FS, rec_frame_us_16_fx, 48000, mem_fx, 0 ); + /*samples are generated with 48k sampling rate + and then converted to required sampling rate by simple decimation + as signal is already bandlimited*/ + + /*decimation to correct sampling rate*/ + IF( NE_32( output_Fs, 48000 ) ) + { + FOR( i = 0; i < rec_frame_len; i++ ) + { + idx = BASOP_Util_Divide3232_Scale( Mpy_32_32( L_shl( i, 16 ), L_shl( 44100, 15 ) ), output_Fs, &temp_q ); + idx = shr( idx, add( sub( 15, temp_q ), 1 ) ); + rec_frame_us_16_fx[i] = rec_frame_us_16_fx[idx]; + move16(); + } + } + + Copy_Scale_sig_16_32( rec_frame_us_16_fx, rec_frame_us_fx, LFE_PLC_RECLEN_48K, 5 ); // Q10 = rec_frame_q + 5 + + FOR( i = 0; i < 2; i++ ) + { + ivas_dct_windowing_fx( fade_len, full_len, dct_len, zero_pad_len, pWindow_coeffs_fx, output_frame, input_tda_fx, rec_frame_us_fx + plc_fdel, rec_frame_us_fx + add( add( plc_fdel, fade_len ), i_mult( i, dct_len ) ) ); + ivas_tda_fx( input_tda_fx, ytda + i * dct_len, dct_len ); + } + + return; +} +#endif \ No newline at end of file diff --git a/lib_dec/ivas_ls_custom_dec.c b/lib_dec/ivas_ls_custom_dec.c index f7c24d8f5..7c35700f2 100644 --- a/lib_dec/ivas_ls_custom_dec.c +++ b/lib_dec/ivas_ls_custom_dec.c @@ -45,7 +45,7 @@ * * Allocate Custom LS layout handle *-----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_ls_custom_open( LSSETUP_CUSTOM_HANDLE *hLsSetupCustom /* o : Custom loudspeaker setup handle */ ) @@ -70,8 +70,7 @@ ivas_error ivas_ls_custom_open( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_ls_custom_open_fx( LSSETUP_CUSTOM_HANDLE *hLsSetupCustom /* o : Custom loudspeaker setup handle */ ) diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 43326c559..55373068d 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -79,6 +79,7 @@ typedef struct parameter_band_mapping_struct *-----------------------------------------------------------------------*/ static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); +static void ivas_param_mc_dec_init_fx( PARAM_MC_DEC_HANDLE hParamMC, const Word16 nchan_in, const Word16 nchan_out ); static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); #ifdef IVAS_FLOAT_FIXED @@ -108,9 +109,9 @@ static void ivas_param_mc_get_mixing_matrices_fx( const Word16 nX, /* i : number of transport channels */ const Word16 nY_cov /* i : number of covariance synthesis output channels */ ); - +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); - +#endif static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); #ifdef IVAS_FLOAT_FIXED @@ -126,21 +127,466 @@ static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, const ui static void ivas_param_mc_get_param_band_mapping( const int16_t n_target_bands, const int16_t *target_band_grouping, const int16_t n_source_bands, const int16_t *source_band_grouping, PARAM_MC_PARAMETER_BAND_MAPPING *parameter_band_mapping ); -static void ivas_param_mc_bs_decode_parameter_values( uint16_t bit_buffer[], int16_t *bit_pos, const int16_t max_bits, int16_t *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const int16_t map_size_wo_lfe, const int16_t map_size, const int16_t num_lfe_bands, const int16_t band_step, const int16_t num_param_bands, float *value_buffer ); +static void ivas_param_mc_bs_decode_parameter_values( uint16_t bit_buffer[], int16_t *bit_pos, const int16_t max_bits, int16_t *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const int16_t map_size_wo_lfe, const int16_t map_size, const int16_t num_lfe_bands, const int16_t band_step, const int16_t num_param_bands, float *value_buffer ); + +#ifdef IVAS_FLOAT_FIXED +static void ivas_param_mc_bs_decode_parameter_values_fx(UWord16 bit_buffer[], Word16 *bit_pos, const Word16 max_bits, Word16 *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const Word16 map_size_wo_lfe, const Word16 map_size, const Word16 num_lfe_bands, const Word16 band_step, const Word16 num_param_bands, Word16 *value_buffer); +static void ivas_param_mc_dequantize_cov_fx(PARAM_MC_DEC_HANDLE hParamMC, Word16 *ild_q_fx, Word16 *icc_q_fx, const Word16 param_band_index, const Word16 nY_cov, const PARAM_MC_SYNTHESIS_CONF synth_conf, const Word16 nY_int, const Word16 nX, Word32 *Cx_state_fx, Word16 Cx_state_e, Word32 *Cproto_fx, Word16 Cproto_e, Word32 *Cy_state_fx, Word16 *Cy_state_e); +static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, Word16 Q_proto_mtx); +static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Word32 *mixing_matrix[], Word16 *mixing_matrix_fx, Word32 *mixing_matrix_res[], Word16 *mixing_matrix_res_exp, const UWord16 nX, const UWord16 nY ); +#endif + +/*------------------------------------------------------------------------- + * ivas_param_mc_dec_open() + * + * Open Parametric MC decoder handle + *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_param_mc_dec_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + Word16 k, nchan_transport; + PARAM_MC_DEC_HANDLE hParamMC; +#ifndef FIX_901_PARAMMC_DEAD_CODE + IVAS_OUTPUT_SETUP hTransportSetup; +#endif + Word16 nchan_out_transport; + Word16 nchan_out_cov; + Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 proto_mtx_norm_fx; + Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 max_param_band_residual; + UWord16 config_index; + MC_LS_SETUP mc_ls_setup; + AUDIO_CONFIG output_config; + Word32 output_Fs, ivas_total_brate; + ivas_error error; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hParamMC = (PARAM_MC_DEC_HANDLE) malloc( sizeof( PARAM_MC_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( ( hParamMC->hMetadataPMC = (HANDLE_IVAS_PARAM_MC_METADATA) malloc( sizeof( IVAS_PARAM_MC_METADATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC metadata \n" ) ); + } + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + output_config = st_ivas->hDecoderConfig->output_config; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef FIX_901_PARAMMC_DEAD_CODE + hTransportSetup = st_ivas->hTransSetup; +#endif + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + hParamMC->hoa_encoder_fx = NULL; +#if 1/*TODO: To be removed later(floating pointer initialization)*/ + hParamMC->hoa_encoder = NULL; +#endif + + /* determine the synthesis config */ + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD || st_ivas->transport_config == output_config ) + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_DIRECT; + } + else if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_MONO_STEREO; + } + else if ( st_ivas->transport_config != output_config ) + { + if ( ( output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && nchan_out_transport > audioCfg2channels( output_config ) ) || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && nchan_out_transport > st_ivas->hOutSetup.nchan_out_woLFE ) ) + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_COV; + /* need to reset the intern config */ + st_ivas->intern_config = output_config; + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hLsSetupCustom->num_spk; +#if 1/*TODO: To be removed later*/ + st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; + st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; +#endif + st_ivas->hIntSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; + st_ivas->hIntSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; + } + } + else + { + hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_CLDFB; + } + } + +#if 0/*TODO: To be removed later*/ + hParamMC->ls_conv_dmx_matrix = NULL; +#endif + hParamMC->ls_conv_dmx_matrix_fx = NULL; + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else + { + nchan_out_cov = nchan_out_transport; + } + + st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); + config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_brate ); + nchan_transport = st_ivas->nchan_transport; + + switch ( nchan_transport ) + { + case 4: + case 3: + st_ivas->nCPE = 2; + st_ivas->nSCE = 0; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + break; + case 2: + st_ivas->nCPE = 1; + st_ivas->nSCE = 0; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + + break; + } + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; + set_s( hParamMC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hParamMC->subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hParamMC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + + hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; +#ifndef FIX_901_PARAMMC_DEAD_CODE + ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); +#else + ivas_param_mc_metadata_open( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); +#endif + + /* init arrays for quantized parameters */ + + if ( ( hParamMC->icc_q_fx = (Word16 *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( Word16 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q_fx = (Word16 *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( Word16 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + set16_fx( hParamMC->icld_q_fx, PARAM_MC_DEFAULT_MIN_ILD_FX, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + set16_fx( hParamMC->icc_q_fx, 0, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); + +#if 1/*TODO: To be removed later(floating point initialization)*/ + if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + + param_mc_set_num_synth_bands( output_Fs, hParamMC ); + + /* Band Grouping */ + if ( hParamMC->hMetadataPMC->num_parameter_bands == 20 ) + { + mvs2s( param_mc_band_grouping_20, hParamMC->band_grouping, 20 + 1 ); + } + else if ( hParamMC->hMetadataPMC->num_parameter_bands == 14 ) + { + mvs2s( param_mc_band_grouping_14, hParamMC->band_grouping, 14 + 1 ); + } + else if ( hParamMC->hMetadataPMC->num_parameter_bands == 10 ) + { + mvs2s( param_mc_band_grouping_10, hParamMC->band_grouping, 10 + 1 ); + } + else + { + assert( 0 && "nbands must be 20, 14, or 10!" ); + } + + /* set max parameter band for abs cov */ + k = 0; + while ( hParamMC->band_grouping[k] <= PARAM_MC_MAX_BAND_ABS_COV_DEC ) + { + hParamMC->max_param_band_abs_cov = ( k++ ); + } + + /*-----------------------------------------------------------------* + * open sub-modules + *-----------------------------------------------------------------*/ + + /* prototype signal computation */ + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB || hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { +#if 0/*TODO: To be removed later (floating point malloc)*/ + if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + IF( ( hParamMC->ls_conv_dmx_matrix_fx = (Word32 *) malloc( nchan_out_transport * nchan_out_cov * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + for ( k = 0; k < nchan_out_transport; k++ ) + { + Copy32( st_ivas->hLsSetUpConversion->dmxMtx_fx[k], &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov], nchan_out_cov );/*Q30*/ + } + + /* convert ParamMC parameter bands to SFB */ + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + st_ivas->hLsSetUpConversion->sfbCnt = hParamMC->num_param_bands_synth; + for ( k = 0; k <= hParamMC->num_param_bands_synth; k++ ) + { + st_ivas->hLsSetUpConversion->sfbOffset[k] = PARAM_MC_BAND_TO_MDCT_BAND_RATIO * hParamMC->band_grouping[k]; + } + } + else + { + /* close the ls conversion handle immediately, it was only needed to get the DMX matrix in case of DMX in the covariance domain */ + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } + } + } + if ( ( hParamMC->proto_matrix_int_fx = (Word32 *) malloc( nchan_out_transport * nchan_transport * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, hParamMC->proto_matrix_int_fx, nchan_transport * nchan_out_transport );/*Q31*/ + + if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, -4 ); /*Q.26*/ + matrix_product_fx( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_cov, nchan_out_transport, 0, ivas_param_mc_conf[config_index].dmx_fac_fx, nchan_out_transport, nchan_transport, 0, proto_matrix_fx );/*Q.26*/ + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, 4 ); /*Q.26*/ + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + proto_mtx_norm_fx = ONE_IN_Q26;/*Q26*/ + for ( k = 0; k < nchan_transport * nchan_out_cov; k++ ) + { + proto_mtx_norm_fx = L_max(L_abs(proto_mtx_norm_fx), L_abs( proto_matrix_fx[k] ) );/*Q.26*/ + } + proto_mtx_norm_fx = divide3232(ONE_IN_Q26 , proto_mtx_norm_fx);/*Q15*/ + + /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ + for ( k = 0; k < nchan_transport; k++ ) + { + for ( int16_t i = 0; i < nchan_out_cov; i++ ) + { + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl(Mult_32_16(proto_matrix_fx[k * nchan_out_cov + i] , extract_l(proto_mtx_norm_fx)),4);/*Q.30*/ + } + } + } + } + else + { + Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, proto_matrix_fx, nchan_out_transport * nchan_transport );/*Q.31*/ + Scale_sig32( proto_matrix_fx, nchan_out_transport * nchan_transport, -5);/*Scaling down to 26*/ + } + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + hParamMC->num_outputs_diff = 0; + hParamMC->diff_proto_info = NULL; + hParamMC->h_output_synthesis_params.use_onset_filters = 0; + hParamMC->max_band_decorr = 0; + hParamMC->h_freq_domain_decorr_ap_params = NULL; + hParamMC->h_freq_domain_decorr_ap_state = NULL; + } + else + { + hParamMC->num_outputs_diff = nchan_out_cov; + if ( ( hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( ( error = param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ,Q26) ) != IVAS_ERR_OK ) + { + return error; + } + + /* decorrelation */ + hParamMC->h_freq_domain_decorr_ap_params = NULL; + hParamMC->h_freq_domain_decorr_ap_state = NULL; + + ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, hParamMC->num_freq_bands ); + + IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hParamMC->h_freq_domain_decorr_ap_params ), &( hParamMC->h_freq_domain_decorr_ap_state ), hParamMC->num_freq_bands, hParamMC->num_outputs_diff, hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, frequency_axis_fx, nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + hParamMC->h_output_synthesis_params.use_onset_filters = 0; + hParamMC->max_band_decorr = hParamMC->h_freq_domain_decorr_ap_params->max_band_decorr; + } + hParamMC->max_band_energy_compensation = hParamMC->band_grouping[hParamMC->hMetadataPMC->nbands_coded]; + max_param_band_residual = 0; + + for ( k = hParamMC->hMetadataPMC->num_parameter_bands; k >= 0; k-- ) + { + if ( hParamMC->band_grouping[k] <= hParamMC->max_band_decorr ) + { + max_param_band_residual = k; + assert( hParamMC->band_grouping[k] == hParamMC->max_band_decorr ); + break; + } + } + + /* output synthesis */ + if ( ( error = ivas_dirac_dec_output_synthesis_cov_open_fx( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix_fx ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_param_mc_dec_compute_interpolator_fx( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator_fx ); + + /* Head or external rotation */ + if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) + { +#if 1/*TODO : To be removed later*/ + IF ( ( hParamMC->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + IF ( ( hParamMC->hoa_encoder_fx = (Word32 *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof(Word32) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + compute_hoa_encoder_mtx_fx( st_ivas->hTransSetup.ls_azimuth_fx, st_ivas->hTransSetup.ls_elevation_fx, hParamMC->hoa_encoder_fx, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); + } + + /*-----------------------------------------------------------------* + * memory allocation + *-----------------------------------------------------------------*/ + + IF ( GT_16(hParamMC->max_band_decorr , 0) ) + { +#if 1/*TODO: To be removed later(floating point malloc)*/ + IF ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + IF ( ( hParamMC->proto_frame_dec_f = (float *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } +#endif + IF ( ( hParamMC->proto_frame_f_fx = (Word32 *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + IF ( ( hParamMC->proto_frame_dec_f_fx = (Word32 *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + } + ELSE + { +#if 1/*TODO: To be removed later*/ + hParamMC->proto_frame_f = NULL; + hParamMC->proto_frame_dec_f = NULL; +#endif + hParamMC->proto_frame_f_fx = NULL; + hParamMC->proto_frame_dec_f_fx = NULL; + } + + ivas_param_mc_dec_init_fx( hParamMC, nchan_transport, nchan_out_cov ); + + IF ( hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) + { + Word16 n_cldfb_slots; + + n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; + IF ( st_ivas->hDecoderConfig->Opt_tsm ) + { + n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; + } + + IF( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set32_fx( hParamMC->Cldfb_RealBuffer_tc_fx, 0, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + IF( ( hParamMC->Cldfb_ImagBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set32_fx( hParamMC->Cldfb_ImagBuffer_tc_fx, 0, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + +#if 1/*TODO: To be removed later(floating point malloc)*/ + if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + if ( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); + } + set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); +#endif -#ifdef IVAS_FLOAT_FIXED -static void ivas_param_mc_bs_decode_parameter_values_fx(UWord16 bit_buffer[], Word16 *bit_pos, const Word16 max_bits, Word16 *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const Word16 map_size_wo_lfe, const Word16 map_size, const Word16 num_lfe_bands, const Word16 band_step, const Word16 num_param_bands, Word16 *value_buffer); -static void ivas_param_mc_dequantize_cov_fx(PARAM_MC_DEC_HANDLE hParamMC, Word16 *ild_q_fx, Word16 *icc_q_fx, const Word16 param_band_index, const Word16 nY_cov, const PARAM_MC_SYNTHESIS_CONF synth_conf, const Word16 nY_int, const Word16 nX, Word32 *Cx_state_fx, Word16 Cx_state_e, Word32 *Cproto_fx, Word16 Cproto_e, Word32 *Cy_state_fx, Word16 *Cy_state_e); -static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info); -static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Word32 *mixing_matrix[], Word16 *mixing_matrix_fx, Word32 *mixing_matrix_res[], Word16 *mixing_matrix_res_exp, const UWord16 nX, const UWord16 nY ); + IF ( st_ivas->hTcBuffer == NULL ) + { + IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + ELSE + { + hParamMC->Cldfb_RealBuffer_tc_fx = NULL; + hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; +#if 1/*TODO: To be removed later*/ + hParamMC->Cldfb_RealBuffer_tc = NULL; + hParamMC->Cldfb_ImagBuffer_tc = NULL; #endif + } -/*------------------------------------------------------------------------- - * ivas_param_mc_dec_open() - * - * Open Parametric MC decoder handle - *-------------------------------------------------------------------------*/ + hParamMC->subframes_rendered = 0; + hParamMC->slots_rendered = 0; + st_ivas->hParamMC = hParamMC; + return error; +} +#else ivas_error ivas_param_mc_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -220,9 +666,9 @@ ivas_error ivas_param_mc_dec_open( hParamMC->synthesis_conf = PARAM_MC_SYNTH_LS_CONV_CLDFB; } } - +#ifndef IVAS_FLOAT_FIXED hParamMC->ls_conv_dmx_matrix = NULL; -#ifdef IVAS_FLOAT_FIXED +#else hParamMC->ls_conv_dmx_matrix_fx = NULL; #endif // IVAS_FLOAT_FIXED @@ -346,12 +792,13 @@ ivas_error ivas_param_mc_dec_open( /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { +#ifndef IVAS_FLOAT_FIXED if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - IF ( ( hParamMC->ls_conv_dmx_matrix_fx = (Word32 *) malloc( nchan_out_transport * nchan_out_cov * sizeof( Word32 ) ) ) == NULL ) +#else + IF ( ( hParamMC->ls_conv_dmx_matrix_fx = (Word32 *) malloc( nchan_out_transport * nchan_out_cov * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } @@ -359,7 +806,14 @@ ivas_error ivas_param_mc_dec_open( for ( k = 0; k < nchan_out_transport; k++ ) { +#ifdef IVAS_FLOAT_FIXED +#if 1 //To be removed when hParamMC->ls_conv_dmx_matrix is removed + +#endif + Copy32( st_ivas->hLsSetUpConversion->dmxMtx_fx[k], &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov], nchan_out_cov ); +#else mvr2r( st_ivas->hLsSetUpConversion->dmxMtx[k], &hParamMC->ls_conv_dmx_matrix[k * nchan_out_cov], nchan_out_cov ); +#endif } /* convert ParamMC parameter bands to SFB */ @@ -492,12 +946,12 @@ ivas_error ivas_param_mc_dec_open( /* output synthesis */ #ifdef IVAS_FLOAT_FIXED - floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q30, nchan_out_transport * nchan_transport); + floatToFixed_arrL( proto_matrix, proto_matrix_fx, Q26, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); if ( ( error = ivas_dirac_dec_output_synthesis_cov_open_fx( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix_fx ) ) != IVAS_ERR_OK ) { return error; } - fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 30, nchan_transport * nchan_out_cov ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, Q26, nchan_transport * nchan_out_cov ); #else if ( ( error = ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), &( hParamMC->h_output_synthesis_cov_state ), hParamMC->max_band_decorr, PARAM_MC_MAX_NSLOTS, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual, nchan_transport, nchan_out_cov, proto_matrix ) ) != IVAS_ERR_OK ) @@ -613,7 +1067,7 @@ ivas_error ivas_param_mc_dec_open( return error; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_get_param_band_mapping() @@ -952,11 +1406,11 @@ ivas_error ivas_param_mc_dec_reconfig_fx( } /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ -#if 1/*To be removed later*/ +#if 0/*To be removed later*/ free( hParamMC->ls_conv_dmx_matrix ); #endif free( hParamMC->ls_conv_dmx_matrix_fx ); -#if 1 +#if 0 IF ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); @@ -969,7 +1423,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( FOR ( k = 0; k < nchan_out_transport; k++ ) { Copy32( st_ivas->hLsSetUpConversion->dmxMtx_fx[k], &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov], nchan_out_cov ); - Scale_sig32( &hParamMC->ls_conv_dmx_matrix_fx[k * nchan_out_cov],nchan_out_cov,1 ); } } /* convert ParamMC parameter bands to SFB */ @@ -1004,26 +1457,27 @@ ivas_error ivas_param_mc_dec_reconfig_fx( IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_COV) || EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) { + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, -4 ); matrix_product_fx( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_cov, nchan_out_transport, 0, ivas_param_mc_conf[config_index].dmx_fac_fx, nchan_out_transport, nchan_transport, 0, - proto_matrix_fx ); + proto_matrix_fx /*Q26*/); + Scale_sig32( hParamMC->ls_conv_dmx_matrix_fx, nchan_out_transport * nchan_out_cov, 4 ); IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) { - proto_mtx_norm_fx = MAX_32; + proto_mtx_norm_fx = ONE_IN_Q26; FOR ( k = 0; k < nchan_transport * nchan_out_cov; k++ ) { proto_mtx_norm_fx = L_max(L_abs( proto_mtx_norm_fx ), L_abs( proto_matrix_fx[k] ) ); } - proto_mtx_norm_fx = divide3232(1 , proto_mtx_norm_fx);/*Q15*/ + proto_mtx_norm_fx = divide3232(ONE_IN_Q26 , proto_mtx_norm_fx);/*Q15*/ /* transfer flattened proto_matrix to 2D in hLsSetupConversion->dmxMtx */ FOR ( k = 0; k < nchan_transport; k++ ) { FOR ( Word16 i = 0; i < nchan_out_cov; i++ ) { - st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shr(Mpy_32_16_1(proto_matrix_fx[k * nchan_out_cov + i] , (Word16)proto_mtx_norm_fx),1); - st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); + st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i] = L_shl(Mpy_32_16_1(proto_matrix_fx[k * nchan_out_cov + i] , (Word16)proto_mtx_norm_fx),4); } } } @@ -1031,6 +1485,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( ELSE { Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, proto_matrix_fx, nchan_out_transport * nchan_transport ); + Scale_sig32( proto_matrix_fx, nchan_out_transport * nchan_transport, -5 ); } IF ( NE_16(nchan_transport_old , nchan_transport) && NE_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) @@ -1084,7 +1539,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } - IF ( ( param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ) ) != IVAS_ERR_OK ) + IF ( ( param_mc_get_diff_proto_info_fx( proto_matrix_fx, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ,Q26) ) != IVAS_ERR_OK ) { return error; } @@ -1293,7 +1748,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( } return error; } -#endif // IVAS_FLOAT_FIXED +#else // IVAS_FLOAT_FIXED ivas_error ivas_param_mc_dec_reconfig( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -1810,7 +2265,7 @@ ivas_error ivas_param_mc_dec_reconfig( } return error; } - +#endif /*------------------------------------------------------------------------- * param_mc_get_num_cldfb_syntheses() @@ -1855,7 +2310,173 @@ int16_t param_mc_get_num_cldfb_syntheses( * * Close Parametric MC memories *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_dec_close_fx( + PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ +) +{ + UWord16 i; + PARAM_MC_DEC_HANDLE hParamMC; + + IF( hParamMC_out == NULL || *hParamMC_out == NULL ) + { + return; + } + + hParamMC = *hParamMC_out; + + /* close sub-modules */ + ivas_dirac_dec_output_synthesis_cov_close_fx( &hParamMC->h_output_synthesis_params, &hParamMC->h_output_synthesis_cov_state ); + + IF( hParamMC->h_freq_domain_decorr_ap_params != NULL || hParamMC->h_freq_domain_decorr_ap_state != NULL ) + { + ivas_dirac_dec_decorr_close( &hParamMC->h_freq_domain_decorr_ap_params, &hParamMC->h_freq_domain_decorr_ap_state ); + } + + /* parameter decoding */ + IF( hParamMC->hMetadataPMC != NULL ) + { +#ifndef FIX_901_PARAMMC_DEAD_CODE + ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); +#endif + free( hParamMC->hMetadataPMC ); + hParamMC->hMetadataPMC = NULL; + } + IF( hParamMC->icc_q_fx != NULL ) + { + free( hParamMC->icc_q_fx ); + hParamMC->icc_q_fx = NULL; + } + + IF( hParamMC->icld_q_fx != NULL ) + { + free( hParamMC->icld_q_fx ); + hParamMC->icld_q_fx = NULL; + } + /* diffuse prototype info */ + IF( hParamMC->diff_proto_info ) + { + FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + free( hParamMC->diff_proto_info->source_chan_idx[i] ); + hParamMC->diff_proto_info->source_chan_idx[i] = NULL; + + free( hParamMC->diff_proto_info->proto_fac_fx[i] ); + hParamMC->diff_proto_info->proto_fac_fx[i] = NULL; + } + + free( hParamMC->diff_proto_info->source_chan_idx ); + hParamMC->diff_proto_info->source_chan_idx = NULL; + + free( hParamMC->diff_proto_info->proto_fac_fx ); + hParamMC->diff_proto_info->proto_fac_fx = NULL; + + free( hParamMC->diff_proto_info->proto_index_diff ); + hParamMC->diff_proto_info->proto_index_diff = NULL; + + free( hParamMC->diff_proto_info->num_source_chan_diff ); + hParamMC->diff_proto_info->num_source_chan_diff = NULL; + + free( hParamMC->diff_proto_info ); + hParamMC->diff_proto_info = NULL; + } + /* States */ + /* free prototype signal buffers */ + IF( hParamMC->proto_frame_f_fx != NULL ) + { + free( hParamMC->proto_frame_f_fx ); + hParamMC->proto_frame_f_fx = NULL; + } + + IF( hParamMC->proto_frame_dec_f_fx != NULL ) + { + free( hParamMC->proto_frame_dec_f_fx); + hParamMC->proto_frame_dec_f_fx = NULL; + } + IF( hParamMC->ls_conv_dmx_matrix_fx != NULL ) + { + free( hParamMC->ls_conv_dmx_matrix_fx ); + hParamMC->ls_conv_dmx_matrix_fx = NULL; + } + + IF( hParamMC->proto_matrix_int_fx != NULL ) + { + free( hParamMC->proto_matrix_int_fx ); + hParamMC->proto_matrix_int_fx = NULL; + } + + IF( hParamMC->hoa_encoder_fx != NULL ) + { + free( hParamMC->hoa_encoder_fx ); + hParamMC->hoa_encoder_fx = NULL; + } + IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) + { + free( hParamMC->Cldfb_RealBuffer_tc_fx ); + hParamMC->Cldfb_RealBuffer_tc_fx = NULL; + } + IF( hParamMC->Cldfb_ImagBuffer_tc_fx != NULL ) + { + free( hParamMC->Cldfb_ImagBuffer_tc_fx ); + hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; + } +#if 1 /*TODO: To be removed later(Floating point memory dealloc)------------------------------- */ + + IF( hParamMC->icc_q != NULL ) + { + free( hParamMC->icc_q ); + hParamMC->icc_q = NULL; + } + + IF( hParamMC->icld_q != NULL ) + { + free( hParamMC->icld_q ); + hParamMC->icld_q = NULL; + } + IF( hParamMC->diff_proto_info ) + { + FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + free( hParamMC->diff_proto_info->proto_fac[i] ); + hParamMC->diff_proto_info->proto_fac[i] = NULL; + } + free( hParamMC->diff_proto_info->proto_fac ); + hParamMC->diff_proto_info->proto_fac = NULL; + } + IF( hParamMC->proto_frame_f != NULL ) + { + free( hParamMC->proto_frame_f ); + hParamMC->proto_frame_f = NULL; + } + IF( hParamMC->proto_frame_dec_f != NULL ) + { + free( hParamMC->proto_frame_dec_f ); + hParamMC->proto_frame_dec_f = NULL; + } + //IF( hParamMC->ls_conv_dmx_matrix != NULL ) + //{ + // free( hParamMC->ls_conv_dmx_matrix ); + // hParamMC->ls_conv_dmx_matrix = NULL; + //} + IF( hParamMC->Cldfb_RealBuffer_tc != NULL ) + { + free( hParamMC->Cldfb_RealBuffer_tc ); + hParamMC->Cldfb_RealBuffer_tc = NULL; + } + IF( hParamMC->Cldfb_ImagBuffer_tc != NULL ) + { + free( hParamMC->Cldfb_ImagBuffer_tc ); + hParamMC->Cldfb_ImagBuffer_tc = NULL; + } +#endif /***********************************ends here************************************************/ + + free( *hParamMC_out ); + *hParamMC_out = NULL; + + return; +} +#endif void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ ) @@ -1958,13 +2579,13 @@ void ivas_param_mc_dec_close( free( hParamMC->proto_frame_dec_f ); hParamMC->proto_frame_dec_f = NULL; } - +#ifndef IVAS_FLOAT_FIXED if ( hParamMC->ls_conv_dmx_matrix != NULL ) { free( hParamMC->ls_conv_dmx_matrix ); hParamMC->ls_conv_dmx_matrix = NULL; } -#ifdef IVAS_FLOAT_FIXED +#else if ( hParamMC->ls_conv_dmx_matrix_fx != NULL ) { free( hParamMC->ls_conv_dmx_matrix_fx ); @@ -2008,7 +2629,6 @@ void ivas_param_mc_dec_close( return; } - /*------------------------------------------------------------------------- * ivas_param_mc_dec_read_BS() * @@ -2469,7 +3089,7 @@ void ivas_param_mc_dec_digest_tc_fx( return; } -#endif +#else void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -2703,7 +3323,7 @@ void ivas_param_mc_dec_digest_tc( return; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_dec() @@ -2897,10 +3517,6 @@ void ivas_param_mc_dec_render( { #ifdef IVAS_FLOAT_FIXED #if 1 - IF( ( hParamMC->hoa_encoder_fx = (Word32 *) malloc(st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( Word32 ) ) ) == NULL ) - { - assert( 0 ); - } Word16 Q_hoa_encoder = 31; floatToFixed_arrL(hParamMC->hoa_encoder, hParamMC->hoa_encoder_fx, Q_hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); @@ -2915,10 +3531,6 @@ void ivas_param_mc_dec_render( fixedToFloat_arrL( &Cldfb_ImagBuffer_fx[0][0][0], &Cldfb_ImagBuffer[0][0][0], Q_Cldfb_ImagBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); fixedToFloat_arrL( &Cldfb_RealBuffer_fx[0][0][0], &Cldfb_RealBuffer[0][0][0], Q_Cldfb_RealBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); - IF(hParamMC->hoa_encoder_fx) - { - free(hParamMC->hoa_encoder_fx); - } #endif // IVAS_FLOAT_FIXED #else ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); @@ -3507,7 +4119,7 @@ void ivas_param_mc_dec_render( * * Parametric MC decoding process *------------------------------------------------------------------------*/ - +#if 0 //NO Calling location void ivas_param_mc_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -3541,14 +4153,72 @@ void ivas_param_mc_dec( pop_wmops(); return; } - +#endif /*------------------------------------------------------------------------- * param_mc_dec_init() * * Parametric MC decoding initialization *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void ivas_param_mc_dec_init_fx( + PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ + const Word16 nchan_transport, /* i : number of input (transport) channels */ + const Word16 nchan_cov ) /* i : number of cov synthesis channels */ +{ + Word16 k; + UWord16 max_param_band_residual; + Word16 len; + + /*-----------------------------------------------------------------* + * init sub-modules + *-----------------------------------------------------------------*/ + + /* decorrelation */ + IF ( GT_16(hParamMC->max_band_decorr , 0) ) + { + len = hParamMC->diff_proto_info->num_protos_diff * hParamMC->h_freq_domain_decorr_ap_params->h_onset_detection_power_params.max_band_decorr; + + /* init onsetDetectionPower */ + set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx, len ); + set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx, len ); +#if 1/*Floating point intialization: to be removed later*/ + set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1, len ); + set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2, len ); +#endif + } + + max_param_band_residual = 0; + + /* output synthesis */ + FOR ( k = hParamMC->hMetadataPMC->num_parameter_bands; k >= 0; k-- ) + { + IF ( LE_16(hParamMC->band_grouping[k] , hParamMC->max_band_decorr) ) + { + max_param_band_residual = k; + break; + } + } + + ivas_dirac_dec_output_synthesis_cov_init_fx( &( hParamMC->h_output_synthesis_cov_state ), nchan_transport, nchan_cov, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual ); + + /*-----------------------------------------------------------------* + * init proto frames + *-----------------------------------------------------------------*/ + + IF ( GT_16(hParamMC->max_band_decorr , 0) ) + { +#if 1/*TODO: To be removed later*/ + set_zero( hParamMC->proto_frame_f, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); + set_zero( hParamMC->proto_frame_dec_f, 2 * nchan_cov * hParamMC->num_freq_bands ); +#endif + set_zero_fx( hParamMC->proto_frame_f_fx, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); + set32_fx( hParamMC->proto_frame_dec_f_fx, 0, 2 * nchan_cov * hParamMC->num_freq_bands ); + } + return; +} +#endif // IVAS_FLOAT_FIXED static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ const int16_t nchan_transport, /* i : number of input (transport) channels */ @@ -4167,10 +4837,10 @@ static void ivas_param_mc_get_mixing_matrices( set32_fx( Cy_state_fx, 0, matSize ); Cy_state_e = 0; - if ( synth_config == PARAM_MC_SYNTH_LS_CONV_COV ) - { - f2me_buf( hParamMC->ls_conv_dmx_matrix, hParamMC->ls_conv_dmx_matrix_fx, &hParamMC->ls_conv_dmx_e, nY_cov * nY_intern ); - } + //if ( synth_config == PARAM_MC_SYNTH_LS_CONV_COV ) + //{ + // f2me_buf( hParamMC->ls_conv_dmx_matrix, hParamMC->ls_conv_dmx_matrix_fx, &hParamMC->ls_conv_dmx_e, nY_cov * nY_intern ); + //} floatToFixed_arr( hParamMC->icld_q, icld_q_fx, 8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); for ( int lp = 0; lp < hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; lp++ ) @@ -4806,7 +5476,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( return; } -#endif +#else @@ -4980,7 +5650,7 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( return; } - +#endif /*------------------------------------------------------------------------- * param_mc_update_mixing_matrices() * @@ -5053,7 +5723,7 @@ static void param_mc_update_mixing_matrices_fx( * * generate the target covariance matrix *------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ float *ild_q, /* i : sequence of dequantized ILD values */ @@ -5216,7 +5886,7 @@ static void ivas_param_mc_dequantize_cov( return; } -#ifdef IVAS_FLOAT_FIXED +#else /*------------------------------------------------------------------------- * ivas_param_mc_dequantize_cov_fx() @@ -5447,7 +6117,7 @@ static void ivas_param_mc_dequantize_cov_fx( set32_fx( target_ch_ener_fx, 0, MAX_CICP_CHANNELS ); set16_fx( target_ch_ener_e, 0, MAX_CICP_CHANNELS ); set32_fx( dmx_ch_ener_fx, 0, MAX_CICP_CHANNELS ); - set16_fx( ls_conv_dmx_matrix_e, hParamMC->ls_conv_dmx_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); + set16_fx( ls_conv_dmx_matrix_e, 1, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); matrix_product_mant_exp( hParamMC->ls_conv_dmx_matrix_fx, ls_conv_dmx_matrix_e, nY_cov, nY_int, 0, Cy_state_int_fx, Cy_state_int_e, nY_int, nY_int, 0, @@ -5658,8 +6328,8 @@ static ivas_error param_mc_get_diff_proto_info_fx( const Word32 *proto_mtx, /* i : protoype matrix for the synthesis */ const UWord16 nchan_transport, /* i : number of transport channels */ const UWord16 nchan_out_cov, /* i : number if output channels of the covariance synthesis */ - PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info /* o : generated diffuse prototype info */ -) + PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, /* o : generated diffuse prototype info */ + Word16 Q_proto_mtx ) { #if FLT_ENABLE float proto_fac[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -5727,7 +6397,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( #if FLT_ENABLE if ( diff < 0.1f ) #else - if ( LT_64( diff_fx * 10, 2147483648 ) ) + if ( LT_64( diff_fx * 10, L_shl_sat(1, Q_proto_mtx)) ) #endif { found = 1; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 390fc1ae4..9f79b6a6f 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1352,26 +1352,848 @@ ivas_error ivas_mc_dec_config( { if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { +#ifdef IVAS_FLOAT_FIXED +#if 1 /*TODO: To be removed(Float to fixed conversion)*/ + DECODER_TC_BUFFER_HANDLE hTcBuffer; + hTcBuffer = st_ivas->hTcBuffer; + RENDERER_TYPE renderer_type_old; + renderer_type_old = st_ivas->renderer_type; + IF( st_ivas->hCombinedOrientationData ) + FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) + { + FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) + { + st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); + } + } + SPAR_DEC_HANDLE hSpar; + hSpar = st_ivas->hSpar; + Word16 nchan_transport_old = st_ivas->nchan_transport; + uint16_t nchan_internal; + Word32 ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + DECODER_CONFIG_HANDLE hDecoderConfig; + hDecoderConfig = st_ivas->hDecoderConfig; + + Word16 n_tc; + n_tc = st_ivas->hTcBuffer->nchan_transport_internal; + for ( int ch = 0; ch < n_tc; ch++ ) + { + floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); + } + Word16 cx_e = 0, cy_e = 0, mmo_e = 0, mmro_e = 0; + PARAM_MC_DEC_HANDLE hParamMC; + hParamMC = st_ivas->hParamMC; + Word16 nchan_out_transport, nchan_out_cov; + MC_LS_SETUP mc_ls_setup; + Word16 nchan_transport; + if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + if ( st_ivas->hParamMC ) + { + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else + { + nchan_out_cov = nchan_out_transport; + } + floatToFixed_arr( hParamMC->icc_q, hParamMC->icc_q_fx, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); + floatToFixed_arr( hParamMC->icld_q, hParamMC->icld_q_fx, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + Word32 max_cx_old_fx, max_cy_old_fx, max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; + float max_cx_old = hParamMC->h_output_synthesis_cov_state.cx_old[0][0], max_cy_old = hParamMC->h_output_synthesis_cov_state.cy_old[0][0], max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; + for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + { + for ( int j = 0; j < nchan_transport_old * nchan_transport_old; j++ ) + max_cx_old = max( max_cx_old, hParamMC->h_output_synthesis_cov_state.cx_old[i][j] ); + for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) + max_cy_old = max( max_cy_old, hParamMC->h_output_synthesis_cov_state.cy_old[i][j] ); + for ( int j = 0; j < nchan_transport_old * nchan_out_cov; j++ ) + max_mix_matrix_old = max( max_mix_matrix_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i][j] ); + } + } + /*IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) + floatToFixed_arr32( st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) );*/ + for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) + { + for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) + max_mix_matrix_res_old = max( max_mix_matrix_res_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i][j] ); + } + } + f2me( max_cx_old, &max_cx_old_fx, &cx_e ); + f2me( max_cy_old, &max_cy_old_fx, &cy_e ); + f2me( max_mix_matrix_old, &max_mix_matrix_old_fx, &mmo_e ); + f2me( max_mix_matrix_res_old, &max_mix_matrix_res_old_fx, &mmro_e ); + if ( mmo_e < 0 ) + mmo_e = 0; + if ( mmro_e < 0 ) + mmro_e = 0; + for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + { + + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); + } + } + for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) + { + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); + } + } + floatToFixed_arrL( hParamMC->proto_matrix_int, hParamMC->proto_matrix_int_fx, Q31, nchan_out_transport * nchan_transport ); + FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + if ( hParamMC->diff_proto_info ) + floatToFixed_arrL( hParamMC->diff_proto_info->proto_fac[i], hParamMC->diff_proto_info->proto_fac_fx[i], Q26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); + } + } + } + if ( st_ivas->hRenderConfig ) + FOR( Word16 i = 0; i < 4; i++ ) + { + st_ivas->hRenderConfig->directivity_fx[i * 3] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3], 6 ); + st_ivas->hRenderConfig->directivity_fx[i * 3 + 1] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 1], 6 ); + st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 2], 15 ); + } +#endif + if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1 + if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + hParamMC = st_ivas->hParamMC; + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); + nchan_transport = st_ivas->nchan_transport; + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else + { + nchan_out_cov = nchan_out_transport; + } + if ( hParamMC ) + { + //if ( st_ivas->hLsSetUpConversion ) + //{ + // for ( Word16 k = 0; k < nchan_transport; k++ ) + // { + // for ( int16_t i = 0; i < nchan_out_cov; i++ ) + // { + // st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); + // } + // } + //} + fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); + fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); + IF( hParamMC->diff_proto_info ) + FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); + } + fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); + /*IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) + fixedToFloat_arrL( st_ivas->hParamMC->ls_conv_dmx_matrix_fx, st_ivas->hParamMC->ls_conv_dmx_matrix, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) );*/ + if ( last_mc_mode == MC_MODE_PARAMMC ) + { + for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + { + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); + } + } + for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) + { + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); + } + } + } + if ( hParamMC->hoa_encoder_fx ) + fixedToFloat_arrL( hParamMC->hoa_encoder_fx, hParamMC->hoa_encoder, Q29, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); + } + } +#endif +#else if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif // IVAS_FLOAT_FIXED + } + } + + st_ivas->transport_config = signaled_config; + } + + return IVAS_ERR_OK; +} + + +/*------------------------------------------------------------------------- + * ivas_mc_dec_reconfig() + * + * reconfigure the MC format decoder + *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_mc_dec_reconfig( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + UWord16 *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ + Word16 *data /* o : output synthesis signal */ +) +{ + Word16 nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; + Word16 numCldfbAnalyses_old, numCldfbSyntheses_old; + Word32 new_brate_SCE, new_brate_CPE, ivas_total_brate; + RENDERER_TYPE renderer_type_old; + Decoder_State *st; + ivas_error error; + MC_MODE mc_mode, last_mc_mode; + TC_BUFFER_MODE tc_buffer_mode_new; + Word16 tc_nchan_tc_new; + Word16 tc_nchan_allocate_new; + Word16 tc_granularity_new; + AUDIO_CONFIG intern_config_old; + IVAS_OUTPUT_SETUP hIntSetupOld; + Word16 nchan_out_buff_old, nchan_out_buff; + + error = IVAS_ERR_OK; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + nchan_transport_old = st_ivas->nchan_transport; + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ + + /* temporally set the current mc_mode back to the previous one to make sure the following call to + ivas_init_dec_get_num_cldfb_instances() returns the correct counts */ + mc_mode = st_ivas->mc_mode; + st_ivas->mc_mode = last_mc_mode; + ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + + st_ivas->mc_mode = mc_mode; + + nSCE_old = st_ivas->nSCE; + nCPE_old = st_ivas->nCPE; + sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag; + + /* special handling needed for the hp20 buffers for McMASA */ + IF ( EQ_16(last_mc_mode , MC_MODE_MCMASA) ) + { + nchan_hp20_old = getNumChanSynthesis( st_ivas ); + } + ELSE + { + nchan_hp20_old = nchan_transport_old; + } + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + + /* save old IntSetup, might be needed for JBM flushing...*/ + intern_config_old = st_ivas->intern_config; + hIntSetupOld = st_ivas->hIntSetup; + tc_granularity_new = 1; + + /* renderer might have changed, reselect */ + renderer_type_old = st_ivas->renderer_type; + ivas_renderer_select( st_ivas ); + + /* side effect of the renderer selection can be a changed internal config */ + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + + /* transfer subframe info from DirAC or ParamMC to central tc buffer */ + IF ( EQ_16(last_mc_mode , MC_MODE_PARAMMC) ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hParamMC->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hParamMC->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; + Copy( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + ELSE IF ( EQ_16(last_mc_mode , MC_MODE_MCMASA) && st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + + /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv + render what still fits in the new granularity */ + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); + IF ( LT_16(tc_granularity_new , st_ivas->hTcBuffer->n_samples_granularity) ) + { + IF ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ + ELSE IF ( GT_16(tc_granularity_new , st_ivas->hTcBuffer->n_samples_granularity) ) + { + IF ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) + { + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); + st_ivas->nSCE = 0; + st_ivas->nCPE = st_ivas->nchan_transport / 2; + + IF ( NE_16(last_mc_mode , MC_MODE_MCT) ) + { + /*De-allocate handles for other MC modes*/ + IF ( st_ivas->hParamMC != NULL ) + { + ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); + + /* remove ls conversion if it was allocated by ParamMC */ + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } + + IF ( EQ_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) + { + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); + ivas_ls_setup_conversion_close_fx( &( st_ivas->hLsSetUpConversion ) ); + } + + /* De-allocate McMasa-related handles */ + ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); + + ivas_qmetadata_close( &st_ivas->hQMetaData ); + IF ( st_ivas->hDirAC != NULL ) + { + ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); + vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); + } + + /* init LS conversion if the renderer type asks for it */ + IF ( EQ_16(st_ivas->renderer_type , RENDERER_MC) && st_ivas->hLsSetUpConversion == NULL ) + { + if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) + { + st_ivas->nSCE = 0; + st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + + IF ( NE_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) + { + /*De-allocate handles for other MC modes*/ + IF ( st_ivas->hParamMC != NULL ) + { + ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); + + /* remove ls conversion if it was allocated by ParamMC */ + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } + + ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); + + /* init LS conversion if the renderer type asks for it */ + IF ( ( EQ_16(st_ivas->renderer_type , RENDERER_MC) ) && st_ivas->hLsSetUpConversion == NULL ) + { + IF ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) ) + { + IF ( NE_16(last_mc_mode , MC_MODE_PARAMMC) ) + { + /* remove old ls conversion for MCT if open, gets reopened correctly within ivas_param_mc_dec_open when needed */ + IF ( EQ_16(renderer_type_old , RENDERER_MC) && st_ivas->hLsSetUpConversion != NULL ) + { + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } + + IF ( ( error = ivas_param_mc_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + } + ELSE + { + IF ( ( error = ivas_param_mc_dec_reconfig_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* De-allocate McMasa-related handles */ + ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); + + IF ( st_ivas->hDirAC != NULL ) + { + ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); + vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); + } + + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) ) + { + IF ( st_ivas->hMCT != NULL && LE_16(st_ivas->nchan_transport , CPE_CHANNELS) ) + { + ivas_mct_dec_close( &st_ivas->hMCT ); + } + } + ELSE IF ( EQ_16(last_mc_mode , MC_MODE_PARAMUPMIX) ) + { + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); + } + + /* LFE handle */ + ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) + { + ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); + + IF ( NE_16(last_mc_mode , MC_MODE_MCMASA) ) + { + IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_mcmasa_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* LS conversion */ + IF ( st_ivas->hLsSetUpConversion != NULL ) + { + ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); + } + + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); + + IF ( st_ivas->hParamMC != NULL ) + { + ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); + st_ivas->hParamMC = NULL; + } + + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) ) + { + ivas_mct_dec_close( &st_ivas->hMCT ); + } + + /* LFE handle */ + ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); + } + + IF ( NE_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) + { + IF ( EQ_16(st_ivas->nchan_transport , 1) ) + { + st_ivas->element_mode_init = IVAS_SCE; + } + ELSE + { + st_ivas->element_mode_init = IVAS_CPE_MDCT; + } + } + + /*-----------------------------------------------------------------* + * Reconfigure core coder + *-----------------------------------------------------------------*/ + + /* special case: MCT->ParamMC with more than 2 TC, CPE 1 stays, but has the wrong mct_chan_mode in channel 1 + and might have IGF static memory not allocated and the bit stream index list not set, + set correct mct_chan_mode and init missing static mem (IGF, HQ) and some config (TNS) do it here since it is _very_ MC specific */ + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && GT_16(st_ivas->nchan_transport , CPE_CHANNELS) ) + { + st = st_ivas->hCPE[1]->hCoreCoder[1]; + + IF ( st_ivas->nchan_transport == 3 ) + { + st->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + } + ELSE + { + st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; + } + + IF ( st->hIGFDec == NULL ) + { + IF ( ( st->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for IGF\n" ) ); + } + + st->igf = 0; + init_igf_dec( st->hIGFDec ); +#if 1 /*TODO: To be removed later(floating point initialization)*/ +#if ( defined EVS_FLOAT ) || !( defined IVAS_FLOAT_FIXED ) + st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; + st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; + set_f( st->hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX ); +#endif + FOR( Word16 l = 0; l < IGF_START_MX; l++ ) + st->hIGFDec->infoTCXNoiseBuf[l] = (uint8_t) st->hIGFDec->infoTCXNoise_evs[l]; +#endif + } + + IF ( st->hHQ_core == NULL ) + { + IF ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) ); + } + + /* HQ core initialization */ +#if 1/*TODO: To be removed later*/ + HQ_core_dec_init_flt( st->hHQ_core ); +#endif + HQ_core_dec_init_fx( st->hHQ_core ); + } + + /* check if we have a doubly used hTxcCfg, if so, allocate a distint one for the old MCT LFE channel */ + IF ( st->hTcxCfg == st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg ) + { + IF ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) ); + } + } + + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode ); + } + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) + { + uint8_t separateChannelEnabled; + int16_t separateChannelIndex; + ivas_mcmasa_set_separate_channel_mode_fx( &separateChannelEnabled, &separateChannelIndex, ivas_total_brate ); + ivas_mcmasa_split_brate_fx( separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) ) + { + new_brate_SCE = 0; + new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) + { + new_brate_SCE = 0; + new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; + } + ELSE + { + new_brate_SCE = 0; /* ivas_total_brate / st_ivas->nchan_transport;*/ + new_brate_CPE = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; + } + + IF( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE ) ) != IVAS_ERR_OK ) + { + return error; + } + IF ( EQ_16(last_mc_mode , MC_MODE_MCT) && EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && GT_16(st_ivas->nchan_transport , CPE_CHANNELS) ) + { + st = st_ivas->hCPE[1]->hCoreCoder[1]; + + /* TCX-LTP */ + IF ( st->hTcxLtpDec == NULL ) + { + IF ( ( st->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); + } + tcxltp_dec_init_fx( st->hTcxLtpDec, 0, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core ); + } + } + + /*-----------------------------------------------------------------* + * re-configure HP20 memories + *-----------------------------------------------------------------*/ + IF ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } + /*-----------------------------------------------------------------* + * Allocate the LFE handle that is coded separately after the allocation of the core coders + *-----------------------------------------------------------------*/ + + IF ( ( EQ_16(st_ivas->mc_mode , MC_MODE_MCT) || EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) && st_ivas->hLFE == NULL ) + { + Word32 binauralization_delay_ns = st_ivas->binaural_latency_ns; + IF ( st_ivas->hBinRenderer != NULL ) + { + IF ( st_ivas->hBinRenderer->render_lfe ) + { + /* Account for filterbank delay */ + binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS; + } + else + { + binauralization_delay_ns = 0; + } + } + + IF( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) + { + return error; + } + + set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); + set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); + } + + /*-----------------------------------------------------------------* + * Reconfigure renderers + *-----------------------------------------------------------------*/ + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_MCMASA) ) + { + IF ( ( NE_16(st_ivas->renderer_type , RENDERER_DISABLE) ) && ( NE_16(st_ivas->renderer_type , RENDERER_MCMASA_MONO_STEREO) ) ) + { + IF ( st_ivas->hDirAC != NULL ) + { + /* reconfigure existing DirAC dec */ + IF ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + /* init a new DirAC dec */ + IF ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) { return error; } } } + ELSE IF ( EQ_16(st_ivas->renderer_type , RENDERER_DISABLE) && st_ivas->hDirAC != NULL ) + { + ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); + vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); + } + } - st_ivas->transport_config = signaled_config; + IF ( NE_16(renderer_type_old , st_ivas->renderer_type) ) + { + AUDIO_CONFIG output_config; + + output_config = st_ivas->hDecoderConfig->output_config; + + /* binaural renderers*/ + IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL) || EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) || EQ_16(output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) + { + /* remove unneeded binaural renderers */ + IF ( st_ivas->hBinRenderer != NULL && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) + { + ivas_binRenderer_close( &st_ivas->hBinRenderer ); + } + + IF ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV_ROOM) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) || NE_16(st_ivas->hIntSetup.output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) ) ) + { + + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); + } + + IF ( st_ivas->hBinRendererTd != NULL && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) ) ) + { + ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; + } + + IF ( st_ivas->hDiracDecBin != NULL ) + { + IF ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) && NE_16(st_ivas->renderer_type , RENDERER_STEREO_PARAMETRIC) ) + { + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + } + } + + /* init necessary new renderers */ + IF ( st_ivas->hBinRenderer == NULL && ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) + { + IF ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->hBinRendererTd == NULL && EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) ) + { + IF( ( error = ivas_td_binaural_open_fx( st_ivas, &st_ivas->SrcInd[0], &st_ivas->num_src ) ) != IVAS_ERR_OK ) + { + return error; + } + IF ( EQ_16(st_ivas->hIntSetup.output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) + { + IF ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); + } + + st_ivas->hCrendWrapper->hCrend = NULL; + st_ivas->hCrendWrapper->hHrtfCrend = NULL; + IF ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); + } + } + } + ELSE IF ( st_ivas->hCrendWrapper == NULL && ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV_ROOM) ) ) + { + IF ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; + } + } + /* mono/stereo */ + ELSE IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_MONO) || EQ_16(output_config , IVAS_AUDIO_CONFIG_STEREO) ) + { + /* nothing should happen here... */ + } + /* LS */ + ELSE IF ( EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1) || EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1_2) || EQ_16(output_config , IVAS_AUDIO_CONFIG_5_1_4) || EQ_16(output_config , IVAS_AUDIO_CONFIG_7_1) || EQ_16(output_config , IVAS_AUDIO_CONFIG_7_1_4) || EQ_16(output_config , IVAS_AUDIO_CONFIG_LS_CUSTOM) ) + { + } } + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ - return IVAS_ERR_OK; -} + IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } + /*-----------------------------------------------------------------* + * JBM TC buffers + *-----------------------------------------------------------------*/ -/*------------------------------------------------------------------------- - * ivas_mc_dec_reconfig() - * - * reconfigure the MC format decoder - *-------------------------------------------------------------------------*/ + { + Word16 tc_nchan_full_new; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + + hTcBuffer = st_ivas->hTcBuffer; + tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); + tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); + tc_nchan_allocate_new = tc_nchan_tc_new; + tc_nchan_full_new = tc_nchan_tc_new; + + IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(st_ivas->renderer_type , RENDERER_STEREO_PARAMETRIC) ) + { + tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; + tc_nchan_full_new = tc_nchan_allocate_new; + } + + IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMMC) && NE_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) && NE_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) ) + { + tc_nchan_full_new = 0; + } + ELSE IF ( EQ_16(st_ivas->mc_mode , MC_MODE_PARAMUPMIX) ) + { + tc_nchan_allocate_new = MC_PARAMUPMIX_MAX_INPUT_CHANS; + tc_buffer_mode_new = TC_BUFFER_MODE_RENDERER; + IF ( EQ_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) || EQ_16(st_ivas->hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) ) + { + tc_buffer_mode_new = TC_BUFFER_MODE_BUFFER; + tc_nchan_tc_new = st_ivas->hDecoderConfig->nchan_out; + tc_nchan_allocate_new = tc_nchan_tc_new; + } + tc_nchan_full_new = tc_nchan_allocate_new; + } + + /* reconfigure buffer */ + IF ( NE_16(hTcBuffer->tc_buffer_mode , tc_buffer_mode_new) || NE_16(hTcBuffer->nchan_transport_jbm , tc_nchan_tc_new) || + NE_16(hTcBuffer->nchan_buffer_full , tc_nchan_full_new) || NE_16(hTcBuffer->nchan_transport_internal , tc_nchan_allocate_new) || + NE_16(tc_granularity_new , hTcBuffer->n_samples_granularity) ) + { + IF ( ( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ + IF ( st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + ELSE IF ( st_ivas->hParamMC != NULL ) + { + st_ivas->hParamMC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hParamMC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hParamMC->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hParamMC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + } + + + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + + nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); + + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1/*TODO: To be removed later*/ + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + return error; +} +#else static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -1499,7 +2321,7 @@ static ivas_error ivas_mc_dec_reconfig( nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in = 0, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + Word16 numch_in = 0, numch_out, num_md_sub_frames; ; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) @@ -1508,31 +2330,7 @@ static ivas_error ivas_mc_dec_reconfig( numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); hSpar->hMdDec->Q_mixer_mat = 30; -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( int j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif + for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -1585,21 +2383,7 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } -#if 0 - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif + // fix2float (to be cleaned) IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) { @@ -1804,15 +2588,15 @@ static ivas_error ivas_mc_dec_reconfig( { for ( Word16 k = 0; k < nchan_out_transport; k++ ) { - floatToFixed_arr32( st_ivas->hLsSetUpConversion->dmxMtx[k], st_ivas->hLsSetUpConversion->dmxMtx_fx[k], Q30, nchan_out_cov ); + //floatToFixed_arr32( st_ivas->hLsSetUpConversion->dmxMtx[k], st_ivas->hLsSetUpConversion->dmxMtx_fx[k], Q30, nchan_out_cov ); } } if ( st_ivas->hParamMC ) { floatToFixed_arr( hParamMC->icc_q, hParamMC->icc_q_fx, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); floatToFixed_arr( hParamMC->icld_q, hParamMC->icld_q_fx, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - if ( hParamMC->ls_conv_dmx_matrix ) - floatToFixed_arr32( hParamMC->ls_conv_dmx_matrix, hParamMC->ls_conv_dmx_matrix_fx, Q31, nchan_out_cov * nchan_out_transport ); + //if ( hParamMC->ls_conv_dmx_matrix ) + // floatToFixed_arr32( hParamMC->ls_conv_dmx_matrix, hParamMC->ls_conv_dmx_matrix_fx, Q31, nchan_out_cov * nchan_out_transport ); Word32 max_cx_old_fx, max_cy_old_fx, max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; float max_cx_old = hParamMC->h_output_synthesis_cov_state.cx_old[0][0], max_cy_old = hParamMC->h_output_synthesis_cov_state.cy_old[0][0], max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) @@ -1906,13 +2690,13 @@ static ivas_error ivas_mc_dec_reconfig( { for ( int16_t i = 0; i < nchan_out_cov; i++ ) { - st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); + //st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); } } } fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); - if ( hParamMC->ls_conv_dmx_matrix ) - fixedToFloat_arrL( hParamMC->ls_conv_dmx_matrix_fx, hParamMC->ls_conv_dmx_matrix, Q31, nchan_out_transport * nchan_out_cov ); + //if ( hParamMC->ls_conv_dmx_matrix ) + // fixedToFloat_arrL( hParamMC->ls_conv_dmx_matrix_fx, hParamMC->ls_conv_dmx_matrix, Q31, nchan_out_transport * nchan_out_cov ); } #endif #else @@ -2639,3 +3423,4 @@ static ivas_error ivas_mc_dec_reconfig( return error; } +#endif // IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index fa0aa44a1..9cc2cd5b0 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -1982,9 +1982,17 @@ void ivas_mdct_core_reconstruct_fx( /* Postfiltering */ Word16 x_fx_16[1200]; Copy_Scale_sig_32_16(x_fx[ch][0], x_fx_16, st->L_frame, sub(0, q_x)); + IF( st->p_bpf_noise_buf_32 ) + { + Copy_Scale_sig_32_16( st->p_bpf_noise_buf_32, st->p_bpf_noise_buf, st->L_frame, negate( Q11 ) ); + } post_decoder_ivas_fx( st, synth_buf_fx, pit_gain_fx[ch], pitch[ch], x_fx_16, st->p_bpf_noise_buf ); - + + IF( st->p_bpf_noise_buf_32 ) + { + Copy_Scale_sig_16_32_no_sat( st->p_bpf_noise_buf, st->p_bpf_noise_buf_32, st->L_frame, Q11 ); + } IF ( signal_outFB_fx[ch] != NULL ) { Copy_Scale_sig( synthFB_fx, signal_outFB_fx[ch], st->hTcxDec->L_frameTCX, sub(sub(15, e_sig), q_syn) ); diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 91e65b52c..75d42d5ec 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -72,8 +72,6 @@ ivas_error ivas_mono_dmx_renderer_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for downmixing\n" ) ); } - hDownmix->inputEnergy = 0; // float - hDownmix->protoEnergy = 0; // float hDownmix->inputEnergy_fx = 0; hDownmix->protoEnergy_fx = 0; hDownmix->Q_inputEner = 0; @@ -146,7 +144,7 @@ void ivas_mono_dmx_renderer_close( * * Downmix process *------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void ivas_mono_downmix_render_passive( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: synthesized core-coder transport channels/mono output */ @@ -205,10 +203,7 @@ void ivas_mono_downmix_render_passive( return; } - -#ifdef IVAS_FLOAT_FIXED - - +#else void ivas_mono_downmix_render_passive_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *output_f_fx[], /* i/o: synthesized core-coder transport channels/mono output */ diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index ba46a5eb7..8635457e6 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -277,7 +277,6 @@ void ivas_omasa_data_close( ivas_error ivas_omasa_dec_config_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - Word16 Q_cldfbSynDec, /* i : Q factor for cldfb state */ Word16 *num_src, Word16 SrcInd[MAX_NUM_TDREND_CHANNELS], Word16 *data /* o : output synthesis signal */ @@ -349,7 +348,7 @@ ivas_error ivas_omasa_dec_config_fx( DECODER_CONFIG_HANDLE hDecoderConfig = NULL; Word16 numch_out_dirac = 0; SPAR_DEC_HANDLE hSpar = NULL; - Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; + Word16 numch_in, numch_out, num_md_sub_frames; IF(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC)) { IF(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) && NE_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC)) @@ -667,7 +666,7 @@ ivas_error ivas_omasa_dec_config_fx( * CLDFB instances *-----------------------------------------------------------------*/ - IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old, Q_cldfbSynDec ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index f8616e486..7a6d7e05e 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -343,20 +343,16 @@ ivas_error ivas_osba_render_sf_fx( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - Word16 numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - Word16 num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - for ( int i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } - Word16 q1 = 30, q2 = 30; - hSpar->hMdDec->Q_mixer_mat = 30; + hSpar->hMdDec->Q_mixer_mat = Q30; for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( int i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index cee1062b1..e6c2a6f63 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -344,8 +344,7 @@ static void get_custom_ls_conversion_matrix_fx( return; } -#endif - +#else static void get_custom_ls_conversion_matrix( const EFAP_HANDLE hEFAPdata, /* i : EFAP handle */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : Transport channel configuration handle */ @@ -417,7 +416,7 @@ static void get_custom_ls_conversion_matrix( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error get_ls_conversion_matrix_fx( @@ -444,7 +443,7 @@ static ivas_error get_ls_conversion_matrix_fx( FOR( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; i++ ) { test(); - IF( ( EQ_32( input_config, ls_conversion_mapping[i].input_config ) ) && ( EQ_32( output_config, ls_conversion_mapping[i].output_config ) ) ) + IF( ( EQ_32( input_config, ls_conversion_mapping_fx[i].input_config ) ) && ( EQ_32( output_config, ls_conversion_mapping_fx[i].output_config ) ) ) { /* Special handling for MONO and STEREO downmix */ test(); @@ -513,7 +512,7 @@ static ivas_error get_ls_conversion_matrix_fx( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "The conversion matrix between these formats is not defined!\n" ); } -#endif +#else static ivas_error get_ls_conversion_matrix( LSSETUP_CONVERSION_HANDLE hLsSetUpConversion, const AUDIO_CONFIG input_config, @@ -598,7 +597,7 @@ static ivas_error get_ls_conversion_matrix( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "The conversion matrix between these formats is not defined!\n" ); } - +#endif /*------------------------------------------------------------------------- * ivas_ls_setup_conversion_open() * @@ -661,26 +660,28 @@ ivas_error ivas_ls_setup_conversion_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); } set32_fx( hLsSetUpConversion->targetEnergyPrev_fx[chIdx], 0, hLsSetUpConversion->sfbCnt ); + hLsSetUpConversion->te_prev_exp = 0; set32_fx( hLsSetUpConversion->dmxEnergyPrev_fx[chIdx], 0, hLsSetUpConversion->sfbCnt ); + hLsSetUpConversion->dmx_prev_exp = 0; /* TODO: remove the floating point dependency */ - IF( ( hLsSetUpConversion->targetEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); - } - IF( ( hLsSetUpConversion->dmxEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); - } - set_f( hLsSetUpConversion->targetEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); - set_f( hLsSetUpConversion->dmxEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); + //IF( ( hLsSetUpConversion->targetEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) + //{ + // return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + //} + //IF( ( hLsSetUpConversion->dmxEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) + //{ + // return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + //} + //set_f( hLsSetUpConversion->targetEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); + //set_f( hLsSetUpConversion->dmxEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); } FOR( ; chIdx < MAX_CICP_CHANNELS; chIdx++ ) { hLsSetUpConversion->targetEnergyPrev_fx[chIdx] = NULL; hLsSetUpConversion->dmxEnergyPrev_fx[chIdx] = NULL; /* TODO: remove the floating point dependency */ - hLsSetUpConversion->targetEnergyPrev[chIdx] = NULL; - hLsSetUpConversion->dmxEnergyPrev[chIdx] = NULL; + //hLsSetUpConversion->targetEnergyPrev[chIdx] = NULL; + //hLsSetUpConversion->dmxEnergyPrev[chIdx] = NULL; } } ELSE @@ -714,28 +715,28 @@ ivas_error ivas_ls_setup_conversion_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); } /* TODO: remove the floating point dependency */ - IF( ( hLsSetUpConversion->targetEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); - } - IF( ( hLsSetUpConversion->dmxEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); - } + //IF( ( hLsSetUpConversion->targetEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) + //{ + // return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + //} + //IF( ( hLsSetUpConversion->dmxEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) + //{ + // return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + //} FOR( chIdx = 1; chIdx < MAX_CICP_CHANNELS; chIdx++ ) { hLsSetUpConversion->targetEnergyPrev_fx[chIdx] = NULL; hLsSetUpConversion->dmxEnergyPrev_fx[chIdx] = NULL; /* TODO: remove the floating point dependency */ - hLsSetUpConversion->targetEnergyPrev[chIdx] = NULL; - hLsSetUpConversion->dmxEnergyPrev[chIdx] = NULL; + //hLsSetUpConversion->targetEnergyPrev[chIdx] = NULL; + //hLsSetUpConversion->dmxEnergyPrev[chIdx] = NULL; } set32_fx( hLsSetUpConversion->targetEnergyPrev_fx[0], 0, MAX_SFB + 2 ); set32_fx( hLsSetUpConversion->dmxEnergyPrev_fx[0], 0, MAX_SFB + 2 ); /* TODO: remove the floating point dependency */ - set_f( hLsSetUpConversion->targetEnergyPrev[0], 0.0f, MAX_SFB + 2 ); - set_f( hLsSetUpConversion->dmxEnergyPrev[0], 0.0f, MAX_SFB + 2 ); + //set_f( hLsSetUpConversion->targetEnergyPrev[0], 0.0f, MAX_SFB + 2 ); + //set_f( hLsSetUpConversion->dmxEnergyPrev[0], 0.0f, MAX_SFB + 2 ); } /* Initialize the DMX conversion matrix */ @@ -750,18 +751,18 @@ ivas_error ivas_ls_setup_conversion_open_fx( /* TODO: remove the floating point dependency */ /* Allocate memory depending on the number of output channels */ - IF( ( hLsSetUpConversion->dmxMtx[chIdx] = (float *) malloc( outChannels * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR temp dmx matrix \n" ) ); - } - set_zero( hLsSetUpConversion->dmxMtx[chIdx], outChannels ); + //IF( ( hLsSetUpConversion->dmxMtx[chIdx] = (float *) malloc( outChannels * sizeof( float ) ) ) == NULL ) + //{ + // return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR temp dmx matrix \n" ) ); + //} + //set_zero( hLsSetUpConversion->dmxMtx[chIdx], outChannels ); } FOR( ; chIdx < MAX_CICP_CHANNELS; chIdx++ ) { hLsSetUpConversion->dmxMtx_fx[chIdx] = NULL; /* TODO: remove the floating point dependency */ - hLsSetUpConversion->dmxMtx[chIdx] = NULL; + //hLsSetUpConversion->dmxMtx[chIdx] = NULL; } IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) @@ -792,7 +793,7 @@ ivas_error ivas_ls_setup_conversion_open_fx( { FOR( Word16 j = 0; j < outChannels; ++j ) { - hLsSetUpConversion->dmxMtx[i][j] = fix_to_float( hLsSetUpConversion->dmxMtx_fx[i][j], Q30 ); + //hLsSetUpConversion->dmxMtx[i][j] = fix_to_float( hLsSetUpConversion->dmxMtx_fx[i][j], Q30 ); } } @@ -800,7 +801,7 @@ ivas_error ivas_ls_setup_conversion_open_fx( return IVAS_ERR_OK; } -#endif +#else ivas_error ivas_ls_setup_conversion_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -939,7 +940,7 @@ ivas_error ivas_ls_setup_conversion_open( return IVAS_ERR_OK; } - +#endif /*------------------------------------------------------------------------- * ivas_ls_setup_conversion_close() @@ -980,23 +981,23 @@ void ivas_ls_setup_conversion_close_fx( } /* TODO: remove the floating point dependency */ - IF( ( *hLsSetUpConversion )->dmxMtx[idx] != NULL ) - { - free( ( *hLsSetUpConversion )->dmxMtx[idx] ); - ( *hLsSetUpConversion )->dmxMtx[idx] = NULL; - } + //IF( ( *hLsSetUpConversion )->dmxMtx[idx] != NULL ) + //{ + // free( ( *hLsSetUpConversion )->dmxMtx[idx] ); + // ( *hLsSetUpConversion )->dmxMtx[idx] = NULL; + //} - IF( ( *hLsSetUpConversion )->targetEnergyPrev[idx] != NULL ) - { - free( ( *hLsSetUpConversion )->targetEnergyPrev[idx] ); - ( *hLsSetUpConversion )->targetEnergyPrev[idx] = NULL; - } + //IF( ( *hLsSetUpConversion )->targetEnergyPrev[idx] != NULL ) + //{ + // free( ( *hLsSetUpConversion )->targetEnergyPrev[idx] ); + // ( *hLsSetUpConversion )->targetEnergyPrev[idx] = NULL; + //} - IF( ( *hLsSetUpConversion )->dmxEnergyPrev[idx] != NULL ) - { - free( ( *hLsSetUpConversion )->dmxEnergyPrev[idx] ); - ( *hLsSetUpConversion )->dmxEnergyPrev[idx] = NULL; - } + //IF( ( *hLsSetUpConversion )->dmxEnergyPrev[idx] != NULL ) + //{ + // free( ( *hLsSetUpConversion )->dmxEnergyPrev[idx] ); + // ( *hLsSetUpConversion )->dmxEnergyPrev[idx] = NULL; + //} } free( *hLsSetUpConversion ); @@ -1004,7 +1005,7 @@ void ivas_ls_setup_conversion_close_fx( return; } -#endif +#else void ivas_ls_setup_conversion_close( LSSETUP_CONVERSION_HANDLE *hLsSetUpConversion /* i/o: LS converter handle */ @@ -1043,7 +1044,7 @@ void ivas_ls_setup_conversion_close( return; } - +#endif /*------------------------------------------------------------------------- * ivas_ls_setup_conversion() @@ -1112,7 +1113,7 @@ void ivas_ls_setup_conversion_fx( return; } -#endif +#else void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ @@ -1170,7 +1171,7 @@ void ivas_ls_setup_conversion( return; } - +#endif /*------------------------------------------------------------------------- * ivas_ls_setup_conversion_process_mdct() @@ -1392,6 +1393,8 @@ void ivas_ls_setup_conversion_process_mdct_fx( move32(); hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx] = dmxEnergy[bandIdx]; move32(); + hLsSetUpConversion->te_prev_exp = 31; + hLsSetUpConversion->dmx_prev_exp = 31; } FOR( i = 0; i < inChannels; ++i ) @@ -1478,7 +1481,7 @@ void ivas_ls_setup_conversion_process_mdct_fx( pop_wmops(); return; } -#endif +#else void ivas_ls_setup_conversion_process_mdct( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[] /* i/o: output synthesis signal */ @@ -1711,7 +1714,7 @@ void ivas_ls_setup_conversion_process_mdct( pop_wmops(); return; } - +#endif /*------------------------------------------------------------------------- * ivas_ls_setup_conversion_process_mdct_param_mc() @@ -2057,7 +2060,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx( } return; } -#endif // IVAS_FLOAT_FIXED +#else void ivas_ls_setup_conversion_process_mdct_param_mc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -2426,7 +2429,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( return; } - +#endif /*------------------------------------------------------------------------- * ivas_ls_setup_conversion_process_param_mc() @@ -2570,6 +2573,8 @@ void ivas_lssetupconversion_process_param_mc_fx( move32(); hLsSetUpConversion->dmxEnergyPrev_fx[chOutIdx][bandIdx] = dmxEnergy[chOutIdx][bandIdx]; move32(); + hLsSetUpConversion->te_prev_exp = 31; + hLsSetUpConversion->dmx_prev_exp = 31; } } } @@ -2605,7 +2610,7 @@ void ivas_lssetupconversion_process_param_mc_fx( pop_wmops(); return; } -#endif +#else void ivas_lssetupconversion_process_param_mc( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ @@ -2729,3 +2734,4 @@ void ivas_lssetupconversion_process_param_mc( pop_wmops(); return; } +#endif \ No newline at end of file diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index dd20c4303..8a50efab3 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -36,6 +36,7 @@ #include "cnst.h" #include "rom_com.h" #include "prot.h" +#include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot.h" #include "ivas_prot_fx.h" @@ -319,6 +320,11 @@ void stereo_dft_dec_core_switching_fx( st->last_core = st->last_core_bfi; } + IF( st->p_bpf_noise_buf_32 ) + { + Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, sub( *q, Q11 ) ); + } + IF( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE || ( st->bfi == 1 && st->core == ACELP_CORE && st->con_tcx == 1 ) ) { IF( ( ( st->last_core != ACELP_CORE || ( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) && st->last_core != AMR_WB_CORE ) || ( sba_dirac_stereo_dtx_flag && st->cng_type == FD_CNG ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ @@ -692,6 +698,11 @@ void stereo_dft_dec_core_switching_fx( } } + IF( st->p_bpf_noise_buf_32 ) + { + Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, negate( sub( *q, Q11 ) ) ); + } + return; } #else diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 848c602fc..dcf1bcdbf 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1044,10 +1044,8 @@ ivas_error ivas_sba_dec_reconfigure_fx( hSpar = st_ivas->hSpar; uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; - ; + Word16 numch_in = 0, numch_out; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) { diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 97adb9a73..a779b98b1 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -986,104 +986,13 @@ void ivas_sba_mix_matrix_determiner( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; #ifdef IVAS_FLOAT_FIXED #if 1 /*Float to fixed changes */ - Word16 j, b, i_ts, num_out_ch; + Word16 num_out_ch; num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - Word16 Q_C_re_fx = 31, Q_P_re_fx = 31; hSpar->hMdDec->Q_mixer_mat = 31; Word16 num_in_ch; num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#if 0 - FOR ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->Q_mixer_mat = s_min(hSpar->hMdDec->Q_mixer_mat, Q_factor_L( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR ( i = 0; i < num_out_ch; i++ ) - { - FOR ( j = 0; j < nchan_transport; j++ ) - { - FOR ( b = 0; b < num_bands_out; b++ ) - { - Q_C_re_fx = s_min( Q_C_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - FOR ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR ( i = 0; i < num_out_ch; i++ ) - { - FOR ( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR ( b = 0; b < num_bands_out; b++ ) - { - Q_P_re_fx = s_min( Q_P_re_fx, Q_factor_L( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] ) ); - } - } - } - } - hSpar->hMdDec->Q_mixer_mat = s_min(hSpar->hMdDec->Q_mixer_mat, s_min( Q_C_re_fx, Q_P_re_fx ) ); - FOR ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR ( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < nchan_transport; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = nchan_transport; j < num_out_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #endif ivas_spar_dec_gen_umx_mat_fx( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, num_md_sub_frames); -#if 0 /*Fixed to float changes */ - FOR( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) - { - FOR( i = 0; i < num_out_ch; i++ ) - { - FOR( j = 0; j < num_in_ch; j++ ) - { - FOR( b = 0; b < num_bands_out; b++ ) - { - hSpar->hMdDec->mixer_mat[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = fixedToFloat( hSpar->hMdDec->mixer_mat_fx[i][j][b + i_ts * IVAS_MAX_NUM_BANDS], hSpar->hMdDec->Q_mixer_mat ); - } - } - } - } -#endif #else ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, num_md_sub_frames ); #endif // IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index aea3b567c..8d3ff8518 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -45,9 +45,6 @@ #include "ivas_rom_com.h" #include "wmc_auto.h" -/* NOTE: Temporary macro for computation happening in floating point. This macro and code active under this is to be removed once the intermediate conversions to float are not required */ -#define IVAS_FLOAT_FIXED_TO_BE_REMOVED - /*--------------------------------------------------------------------------* * ivas_sce_dec() * @@ -240,33 +237,17 @@ ivas_error ivas_sce_dec_fx( * Decoder *----------------------------------------------------------------*/ #ifndef TO_BE_REMOVED_CONVERSION - //Word16 k; - - //{ - // sts = hCPE->hCoreCoder; - //} - - //core_coding_part will go in this loop, once the things are done - /* for (k = 0; k < n_channels; k++) - {*/ if (st->hTcxDec != NULL) { floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, 0, L_FRAME48k); floatToFixed_arr(st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, 0, L_FRAME32k); floatToFixed_arrL(st->hHQ_core->old_outLB, st->hHQ_core->old_outLB_fx, 11, L_FRAME32k); - //sts[k]->hTcxDec->conceal_eof_gain32 = floatToFixed( sts[k]->hTcxDec->conceal_eof_gain_float, 15 ); } - /*}*/ IF(st->hFdCngDec != NULL && (st->element_mode == IVAS_CPE_MDCT && st->total_brate == SID_2k40)) { - //FOR(Word16 ch = 0; ch < CPE_CHANNELS; ++ch) - { f2me_buf(st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, &st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, st->hFdCngDec->hFdCngCom->stopBand - st->hFdCngDec->hFdCngCom->startBand); - //floatToFixed_arr(st->hFdCngDec->hFdCngCom->A_cng_flt, st->hFdCngDec->hFdCngCom->A_cng, Q14, M + 1); - } } - #endif set32_fx(output[0], 0, L_FRAME48k); @@ -278,12 +259,8 @@ ivas_error ivas_sce_dec_fx( IF( st_ivas->sba_dirac_stereo_flag && ( GT_32( st->core_brate, SID_2k40 ) || EQ_16( st->cng_type, LP_CNG ) ) ) { /* skip addition of ACELP BWE for now, will be done after upmix */ -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - mvr2r( outputHB_flt[0], hSCE->save_hb_synth, output_frame ); -#else Copy32( outputHB[0], hSCE->save_hb_synth_fx, output_frame ); - fixedToFloat_arrL(hSCE->save_hb_synth_fx, hSCE->save_hb_synth,Q11,output_frame); -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED + hSCE->q_save_hb_synth_fx = Q11; } ELSE IF( !st_ivas->sba_dirac_stereo_flag ) { @@ -360,9 +337,6 @@ ivas_error create_sce_dec( hSCE->sce_id = sce_id; hSCE->element_brate = element_brate; -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - //set_f( hSCE->prev_hb_synth, 0.0f, NS2SA( st_ivas->hDecoderConfig->output_Fs, L_sub( IVAS_DEC_DELAY_NS, DELAY_BWE_TOTAL_NS ) ) ); -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED set32_fx( hSCE->prev_hb_synth_fx, 0, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, L_sub( IVAS_DEC_DELAY_NS, DELAY_BWE_TOTAL_NS ) ) ); /*-----------------------------------------------------------------* @@ -408,14 +382,6 @@ ivas_error create_sce_dec( } } -//#ifndef IVAS_FLOAT_FIXED -// IF( ( error = init_decoder_ivas_fx( st, 0, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) -//#else -// IF( ( error = init_decoder_fx( st, EVS_MONO ) ) != IVAS_ERR_OK ) -//#endif -// { -// return error; -// } IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { @@ -437,76 +403,34 @@ ivas_error create_sce_dec( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX/TD CNG\n" ) ); } -#ifdef IVAS_FLOAT_FIXED td_cng_dec_init_ivas_fx( st ); -#else - td_cng_dec_init( st ); -#endif // IVAS_FLOAT_FIXED } /*-----------------------------------------------------------------* * Synthesis buffers: allocate and initialize *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( st_ivas->sba_dirac_stereo_flag ) { - - IF( ( hSCE->save_synth = (float *) malloc( sizeof( float ) * output_frame ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for stereo output\n" ) ); - } - set_zero( hSCE->save_synth, output_frame ); - - IF( ( hSCE->save_hb_synth = (float *) malloc( sizeof( float ) * output_frame ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate HB memory for stereo output\n" ) ); - } - set_zero( hSCE->save_hb_synth, output_frame ); -#ifdef IVAS_FLOAT_FIXED IF( ( hSCE->save_synth_fx = (Word32 *) malloc( sizeof( *(hSCE->save_synth_fx) ) * output_frame ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for stereo output\n" ) ); } set_zero_fx( hSCE->save_synth_fx, output_frame ); + hSCE->q_save_synth_fx = 0; IF( ( hSCE->save_hb_synth_fx = (Word32 *) malloc( sizeof( *(hSCE->save_hb_synth_fx) ) * output_frame ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate HB memory for stereo output\n" ) ); } set_zero_fx( hSCE->save_hb_synth_fx, output_frame ); -#endif - } - ELSE - { - hSCE->save_synth = NULL; - hSCE->save_hb_synth = NULL; -#ifdef IVAS_FLOAT_FIXED - hSCE->save_synth_fx = NULL; - hSCE->save_hb_synth_fx = NULL; -#endif - } -#else - IF( st_ivas->sba_dirac_stereo_flag ) - { - IF( ( hSCE->save_synth_fx = (Word32 *) malloc( sizeof( Word32 ) * output_frame ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for stereo output\n" ) ); - } - set32_fx( hSCE->save_synth_fx, 0, output_frame ); - - IF( ( hSCE->save_hb_synth_fx = (Word32 *) malloc( sizeof( Word32 ) * output_frame ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate HB memory for stereo output\n" ) ); - } - set32_fx( hSCE->save_hb_synth_fx, 0, output_frame ); + hSCE->q_save_hb_synth_fx = 0; } ELSE { hSCE->save_synth_fx = NULL; hSCE->save_hb_synth_fx = NULL; } -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED hSCE->hCoreCoder[0] = st; st_ivas->hSCE[sce_id] = hSCE; @@ -537,18 +461,6 @@ void destroy_sce_dec( st = NULL; } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( hSCE->save_synth != NULL ) - { - free( hSCE->save_synth ); - hSCE->save_synth = NULL; - } - IF( hSCE->save_hb_synth != NULL ) - { - free( hSCE->save_hb_synth ); - hSCE->save_hb_synth = NULL; - } -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( hSCE->save_synth_fx != NULL ) { free( hSCE->save_synth_fx ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 5f23d5dc7..ef3222b47 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -591,9 +591,9 @@ ivas_error ivas_spar_dec_fx( { Word32 tmp = 0; tmp = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); - if (GT_32(L_abs(sub(tmp, q_direction->band_data[j].elevation_fx[k])), 1 << Q5)) + if ( GT_32( L_abs( L_sub( tmp, q_direction->band_data[j].elevation_fx[k] ) ), 1 << Q5 ) ) { - assert(0); + assert( 0 ); } q_direction->band_data[j].elevation_fx[k] = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); q_direction->band_data[j].azimuth_fx[k] = (Word32) ( q_direction->band_data[j].azimuth[k] * ( 1 << 22 ) ); @@ -1549,10 +1549,6 @@ static ivas_error ivas_spar_dec_MD_fx( * Initialization *---------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - Word16 i, j, k; -#endif - sba_order = s_min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); bfi = st_ivas->bfi; move16(); @@ -1591,7 +1587,6 @@ static ivas_error ivas_spar_dec_MD_fx( move16(); } -// From here TBD IF( ( error = ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) { return error; @@ -1605,27 +1600,6 @@ static ivas_error ivas_spar_dec_MD_fx( ivas_spar_md_dec_process_fx( st_ivas, st0, num_bands_out, sba_order ); -// Till here TBD -#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - // float to fix - Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - FOR( i = 0; i < num_channels_tmp; i++ ) - { - FOR( j = 0; j < num_channels_tmp; j++ ) - { - FOR( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->spar_coeffs_prev.C_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_prev.P_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.C_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.P_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][k], Q22 ); - } - } - } -#endif - /*---------------------------------------------------------------------* * read PCA bits *---------------------------------------------------------------------*/ @@ -1666,76 +1640,17 @@ static ivas_error ivas_spar_dec_MD_fx( { ivas_spar_update_md_hist_fx( hSpar->hMdDec ); } - -#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - // fix to float - Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - FOR( i = 0; i < num_channels_tmp; i++ ) - { - FOR( j = 0; j < num_channels_tmp; j++ ) - { - FOR( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_prev.C_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_prev.P_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_tar.C_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_tar.P_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.C_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.P_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][k], Q22 ); - } - } - } -#endif } ELSE { -#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - // float to fix - Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - FOR( i = 0; i < num_channels_tmp; i++ ) - { - FOR( j = 0; j < num_channels_tmp; j++ ) - { - FOR( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->spar_coeffs_prev.C_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_prev.P_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.C_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.P_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs.C_re[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][k] = floatToFixed( hSpar->hMdDec->spar_coeffs.P_re[i][j][k], Q22 ); - } - } - } -#endif - IF( !bfi ) { ivas_spar_smooth_md_dtx_fx( hSpar->hMdDec, num_bands_out, num_md_sub_frames ); } set_s( hSpar->hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); -#if 0 //ndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - Word16 num_channels_tmp = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - FOR( i = 0; i < num_channels_tmp; i++ ) - { - FOR( j = 0; j < num_channels_tmp; j++ ) - { - FOR( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->spar_coeffs_prev.C_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_prev.C_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_prev.P_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_prev.P_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.C_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_tar.C_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs_tar.P_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs_tar.P_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.C_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs.C_re_fx[i][j][k], Q22 ); - hSpar->hMdDec->spar_coeffs.P_re[i][j][k] = fixedToFloat( hSpar->hMdDec->spar_coeffs.P_re_fx[i][j][k], Q22 ); - } - } - } -#endif } - pop_wmops(); return IVAS_ERR_OK; } @@ -2999,7 +2914,6 @@ void ivas_spar_dec_upmixer_sf_fx( float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; float *cldfb_in_ts_im[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; float Pcm_tmp[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; - float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_output[MAX_OUTPUT_CHANNELS]; /*---------------------------------------------------------------------------*/ @@ -3020,7 +2934,7 @@ void ivas_spar_dec_upmixer_sf_fx( DECODER_CONFIG_HANDLE hDecoderConfig; SPAR_DEC_HANDLE hSpar; Word16 num_md_sub_frames; - Word16 q1 = 30,q2=30; + Word16 q1 = 30; push_wmops( "ivas_spar_dec_upmixer_sf" ); hSpar = st_ivas->hSpar; hDecoderConfig = st_ivas->hDecoderConfig; @@ -3185,7 +3099,7 @@ void ivas_spar_dec_upmixer_sf_fx( } #endif #if 1 - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) { diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index b37c4720f..858b542ce 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -962,7 +962,7 @@ ivas_error ivas_spar_md_dec_init( { int16_t i, j; int16_t nchan_transport; - Word32 pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; + Word32 pFC[IVAS_MAX_NUM_BANDS]; Word32 *pFC_fx=NULL, PR_minmax_fx[2]; ivas_error error; @@ -4885,13 +4885,12 @@ void ivas_spar_to_dirac_fx( int16_t azi[IVAS_MAX_NUM_BANDS]; int16_t ele[IVAS_MAX_NUM_BANDS]; //float dvx[IVAS_MAX_NUM_BANDS], dvy[IVAS_MAX_NUM_BANDS], dvz[IVAS_MAX_NUM_BANDS]; - Word32 dvx_q, dvy_q, dvz_q; Word32 dvx_fx[IVAS_MAX_NUM_BANDS], dvy_fx[IVAS_MAX_NUM_BANDS], dvz_fx[IVAS_MAX_NUM_BANDS]; //float radius; - Word32 radius_fx,radius_q; + Word32 radius_fx; //float en_ratio, res_pow; Word32 en_ratio_fx, res_pow_fx; - Word32 en_ratio_q, res_pow_q; + Word16 en_ratio_q, res_pow_q; int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; @@ -5019,7 +5018,6 @@ void ivas_spar_to_dirac_fx( ele[band] = max(-90, min(180, ele_res)); } - Word16 en_ratio_q = 0; if (st_ivas->nchan_transport == 1) { //float w_en_norm, f_scale; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index adf8e5727..33b101cb6 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -99,7 +99,6 @@ typedef struct stereo_dft_dec_data_struct int16_t dft_trigo_step; #ifdef IVAS_FLOAT_FIXED - Word32 ONE_NFFT; /* Size of DFT */ const Word16 *dft_trigo_fx; /* Q15 */ const Word16 *dft_trigo_12k8_fx; /* Q15 */ const Word16 *dft_trigo_16k_fx; /* Q15 */ @@ -416,45 +415,46 @@ typedef struct stereo_dft_dmx_out_data_structure typedef struct stereo_dec_cng { +#ifndef IVAS_FLOAT_FIXED float coh[STEREO_DFT_BAND_MAX + 1]; /* coherence */ float cm[STEREO_DFT_BAND_MAX]; /* cm */ -#ifdef IVAS_FLOAT_FIXED - Word16 cm_fx[STEREO_DFT_BAND_MAX]; /* cm */ - Word16 coh_fx[STEREO_DFT_BAND_MAX + 1]; /* coherence */ +#else + Word16 cm_fx[STEREO_DFT_BAND_MAX]; /* cm */ /* Q15 */ + Word16 coh_fx[STEREO_DFT_BAND_MAX + 1]; /* coherence */ /* Q15 */ #endif - int16_t first_SID; /* first SID indicator */ - int16_t first_SID_after_TD; /* first SID after TD-stereo indicator */ - int16_t prev_sid_nodata; /* previous frame SID/FRAME_NO_DATA indicator */ - int16_t last_tdm_idx; /* last tdm index */ + int16_t first_SID; /* first SID indicator */ + int16_t first_SID_after_TD; /* first SID after TD-stereo indicator */ + int16_t prev_sid_nodata; /* previous frame SID/FRAME_NO_DATA indicator */ + int16_t last_tdm_idx; /* last tdm index */ #ifndef IVAS_FLOAT_FIXED - float c_LR_LT; /* left right cross correlation */ + float c_LR_LT; /* left right cross correlation */ #else - Word32 c_LR_LT_fx; /* left right cross correlation */ /* Q31 */ + Word32 c_LR_LT_fx; /* left right cross correlation */ /* Q31 */ #endif - int16_t active_frame_counter; /* counter for active frames */ - int16_t xfade_frame_counter; /* xfade counter */ - int16_t xfade_length; /* number of frames to perform xfade */ - int16_t nr_dft_frames; /* dft frame counter */ - int16_t nr_corr_frames; /* correlation frame counter */ - int16_t nr_sid_frames; /* SID frame counter */ - int16_t last_act_element_mode; /* Element mode of last active frame */ + int16_t active_frame_counter; /* counter for active frames */ + int16_t xfade_frame_counter; /* xfade counter */ + int16_t xfade_length; /* number of frames to perform xfade */ + int16_t nr_dft_frames; /* dft frame counter */ + int16_t nr_corr_frames; /* correlation frame counter */ + int16_t nr_sid_frames; /* SID frame counter */ + int16_t last_act_element_mode; /* Element mode of last active frame */ #ifndef IVAS_FLOAT_FIXED - float olapBufferSynth22[FFTLEN]; /* overlap buffer for secondary channel CNA */ + float olapBufferSynth22[FFTLEN]; /* overlap buffer for secondary channel CNA */ #endif - Word16 olapBufferSynth22_fx[FFTLEN]; /* overlap buffer for secondary channel CNA */ - Word32 olapBufferSynth22_32fx[FFTLEN]; /* overlap buffer for secondary channel CNA */ - int16_t flag_cna_fade; /* flag enabling CNA fade out */ + Word16 olapBufferSynth22_fx[FFTLEN]; /* overlap buffer for secondary channel CNA */ + Word32 olapBufferSynth22_32fx[FFTLEN]; /* overlap buffer for secondary channel CNA */ + int16_t flag_cna_fade; /* flag enabling CNA fade out */ #ifndef IVAS_FLOAT_FIXED - float maskingNoiseS[L_FRAME16k]; /* masking noise (CNA) for secondary channel */ + float maskingNoiseS[L_FRAME16k]; /* masking noise (CNA) for secondary channel */ #endif - Word16 maskingNoiseS_fx[L_FRAME16k]; /* masking noise (CNA) for secondary channel */ - int16_t enableSecCNA; /* flag enabling secondary channel CNA */ + Word16 maskingNoiseS_fx[L_FRAME16k]; /* masking noise (CNA) for secondary channel */ + int16_t enableSecCNA; /* flag enabling secondary channel CNA */ #ifndef IVAS_FLOAT_FIXED - float c_PS_LT; /* long term cross-correlation between primary and secondary channel */ + float c_PS_LT; /* long term cross-correlation between primary and secondary channel */ #endif - Word16 c_PS_LT_fx; /* long term cross-correlation between primary and secondary channel */ // Assumed Q15 for initialization. Can be modified later if reqd. - const int16_t *frameSize; /* Frame size in samples */ - const int16_t *fftlen; /* FFT length used for the decomposition */ + Word16 c_PS_LT_fx; /* long term cross-correlation between primary and secondary channel */ // Assumed Q15 for initialization. Can be modified later if reqd. + const int16_t *frameSize; /* Frame size in samples */ + const int16_t *fftlen; /* FFT length used for the decomposition */ } STEREO_CNG_DEC, *STEREO_CNG_DEC_HANDLE; @@ -871,7 +871,9 @@ typedef struct ivas_param_mc_dec_data_structure Word16 *icld_q_fx; #endif int16_t max_param_band_abs_cov; +#ifndef IVAS_FLOAT_FIXED float *ls_conv_dmx_matrix; +#endif float *proto_matrix_int; #ifdef IVAS_FLOAT_FIXED Word32 *proto_frame_f_fx; @@ -1092,9 +1094,9 @@ typedef struct sce_dec_data_structure DEC_CORE_HANDLE hCoreCoder[1]; #ifndef IVAS_FLOAT_FIXED float prev_hb_synth[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* HB synthesis synchro buffer */ -#endif float *save_synth; float *save_hb_synth; +#endif #ifdef IVAS_FLOAT_FIXED Word32 prev_hb_synth_fx[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* HB synthesis synchro buffer */ @@ -1142,8 +1144,8 @@ typedef struct cpe_dec_data_structure #ifndef IVAS_FLOAT_FIXED float prev_hb_synth[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float *prev_synth_chs[CPE_CHANNELS]; -#endif float prev_synth[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS )]; +#endif /* DFT stereo I/O channel buffer memories that need to be updated for TD->DFT stereo switching */ #ifndef IVAS_FLOAT_FIXED @@ -1590,6 +1592,8 @@ typedef struct Decoder_Struct Word32 **mem_hp20_out_fx; Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* floating-point output audio buffers */ Word16 p_out_len;/*Stores the total no of channels for which memory is allocated to p_output_fx*/ + Word16 num_src; + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; #endif } Decoder_Struct; diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 6036f72d0..b549879e0 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -2325,12 +2325,15 @@ void stereo_cna_update_params_fx( return; } #endif + + /*------------------------------------------------------------------- * stereo_cng_init_dec() * * Initialized stereo CNG *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void stereo_cng_init_dec( STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: stereo CNG decoder structure */ const int16_t *frameSize /* i : pointer to frameSize of channel 0 to be used for channel 1 */ @@ -2348,18 +2351,16 @@ void stereo_cng_init_dec( hStereoCng->nr_corr_frames = 0; hStereoCng->nr_sid_frames = 0; hStereoCng->flag_cna_fade = 0; -#ifndef IVAS_FLOAT_FIXED set_f( hStereoCng->olapBufferSynth22, 0.0f, FFTLEN ); set_zero( hStereoCng->maskingNoiseS, L_FRAME16k ); hStereoCng->c_PS_LT = 0.5f; -#endif hStereoCng->enableSecCNA = 0; hStereoCng->frameSize = frameSize; hStereoCng->last_act_element_mode = IVAS_CPE_DFT; return; } -#ifdef IVAS_FLOAT_FIXED +#else void stereo_cng_init_dec_fx( STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: stereo CNG decoder structure */ const Word16 *frameSize /* i : pointer to frameSize of channel 0 to be used for channel 1 */ @@ -2397,13 +2398,6 @@ void stereo_cng_init_dec_fx( hStereoCng->last_act_element_mode = IVAS_CPE_DFT; move16(); -#if 1 - //set_f( hStereoCng->olapBufferSynth22, 0.0f, FFTLEN ); - set_f( hStereoCng->coh, 0.5f, STEREO_DFT_BAND_MAX + 1 ); - set_zero( hStereoCng->cm, STEREO_DFT_BAND_MAX ); - //hStereoCng->c_PS_LT = 0.5f; -#endif - return; } #endif diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 680b25b0d..711269dc5 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -251,62 +251,8 @@ void stereo_dft_dequantize_itd( * Create DFT stereo handle *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error stereo_dft_dec_create( -#ifdef IVAS_FLOAT_FIXED - STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word32 element_brate, /* i : element bitrate */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - const Word16 nchan_transport /* i : number of transport channels */ -) -{ - STEREO_DFT_DEC_DATA_HANDLE hStereoDft_loc; - Word16 tmpS; - - IF ( *hStereoDft != NULL ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: DFT Stereo memory already allocated\n" ); - } - - IF ( ( hStereoDft_loc = (STEREO_DFT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_DFT_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT Stereo\n" ) ); - } - - IF ( ( hStereoDft_loc->hConfig = (STEREO_DFT_CONFIG_DATA_HANDLE) malloc( sizeof( STEREO_DFT_CONFIG_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT Stereo Config\n" ) ); - } - - IF ( ( hStereoDft_loc->hBpf = (BPF_DEC_HANDLE) malloc( sizeof( BPF_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for BPF handle\n" ) ); - } - - IF ( ( hStereoDft_loc->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); - } - - hStereoDft_loc->hConfig->force_mono_transmission = 0; - move16(); - - IF ( sba_dirac_stereo_flag ) - { - ivas_sba_dirac_stereo_config( hStereoDft_loc->hConfig ); - } - ELSE - { - stereo_dft_config( hStereoDft_loc->hConfig, element_brate, &tmpS, &tmpS ); - } - - stereo_dft_dec_open( hStereoDft_loc, output_Fs, nchan_transport ); - - *hStereoDft = hStereoDft_loc; - - return IVAS_ERR_OK; -} -#else STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ const int32_t element_brate, /* i : element bitrate */ const int32_t output_Fs, /* i : output sampling rate */ @@ -368,102 +314,7 @@ ivas_error stereo_dft_dec_create( * Open DFT decoder stereo handle *-------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_dec_open( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word16 nchan_transport /* i : number of transport channels */ -) -{ - /*Sizes*/ - hStereoDft->N = (Word16) ( STEREO_DFT_HOP_MAX * output_Fs / 48000 ); - - /*Init. DFT sizes*/ - hStereoDft->NFFT = (Word16) ( STEREO_DFT32MS_N_MAX * output_Fs / 48000 ); - - SWITCH (output_Fs) - { - case 48000: - hStereoDft->ONE_NFFT = (Word32) ( 0x00222222 ); - BREAK; - case 32000: - hStereoDft->ONE_NFFT = (Word32) ( 0x00333333 ); - BREAK; - case 16000: - hStereoDft->ONE_NFFT = (Word32) ( 0x00666666 ); - BREAK; - case 8000: - hStereoDft->ONE_NFFT = (Word32) ( 0x00CCCCCC ); - BREAK; - default: - assert(0); - } - hStereoDft->dft_trigo_8k_fx = dft_trigo_32k_fx; - hStereoDft->dft_trigo_12k8_fx = dft_trigo_12k8_fx; - hStereoDft->dft_trigo_16k_fx = dft_trigo_32k_fx; - - hStereoDft->dft32ms_ovl = (Word16) ( ( STEREO_DFT32MS_OVL_MAX * output_Fs ) / 48000 ); - hStereoDft->win232ms_8k_fx = dft_win232ms_8k_fx; - hStereoDft->win232ms_12k8_fx = dft_win232ms_12k8_fx; - hStereoDft->win232ms_16k_fx = dft_win232ms_16k_fx; - - hStereoDft->dft32ms_ovl2 = (Word16) ( ( STEREO_DFT32MS_OVL2_MAX * output_Fs ) / 48000 ); - hStereoDft->win32ms_8k_fx = dft_win232ms_8k_fx + 1; - hStereoDft->win32ms_12k8_fx = dft_win232ms_12k8_fx + 1; - hStereoDft->win32ms_16k_fx = dft_win232ms_16k_fx + 1; - - - IF ( EQ_32( output_Fs, 16000 ) ) - { - hStereoDft->dft_trigo_fx = dft_trigo_32k_fx; - hStereoDft->dft_trigo_step = STEREO_DFT_TRIGO_SRATE_16k_STEP; - hStereoDft->win232ms_fx = dft_win232ms_16k_fx; - hStereoDft->win32ms_fx = dft_win232ms_16k_fx + 1; - } - ELSE IF ( EQ_32( output_Fs, 32000 ) ) - { - hStereoDft->dft_trigo_fx = dft_trigo_32k_fx; - hStereoDft->dft_trigo_step = STEREO_DFT_TRIGO_SRATE_32k_STEP; - hStereoDft->win232ms_fx = dft_win232ms_32k_fx; - hStereoDft->win32ms_fx = dft_win232ms_32k_fx + 1; - } - ELSE - { - assert( EQ_32( output_Fs, 48000 ) ); - - hStereoDft->dft_trigo_fx = dft_trigo_48k_fx; - hStereoDft->dft_trigo_step = STEREO_DFT_TRIGO_SRATE_48k_STEP; - hStereoDft->win232ms_fx = dft_win232ms_48k_fx; - hStereoDft->win32ms_fx = dft_win232ms_48k_fx + 1; - } - - hStereoDft->win_8k_fx = dft_win_8k_fx; - - /*Bands: find the number of bands, Nyquist freq. is not taken into account*/ - set_s( hStereoDft->band_res, hStereoDft->hConfig->band_res, STEREO_DFT_DEC_DFT_NB ); - - hStereoDft->nbands = stereo_dft_band_config_fx( hStereoDft->band_limits, hStereoDft->band_res[0], hStereoDft->NFFT, DEC ); - hStereoDft->hb_stefi_delay = NS2SA( output_Fs, STEREO_DFT_TD_STEFI_DELAY_NS ); - - IF ( GT_16( nchan_transport, 2 ) ) - { - hStereoDft->min_smooth_gains_fx = min_smooth_gains2_fx; - hStereoDft->max_smooth_gains_fx = max_smooth_gains2_fx; - } - ELSE - { - hStereoDft->min_smooth_gains_fx = min_smooth_gains1_fx; - hStereoDft->max_smooth_gains_fx = max_smooth_gains1_fx; - } - hStereoDft->q_hb_stefi_sig_fx = Q31; - hStereoDft->q_ap_fade_mem_fx = Q31; - - /* reset DFT stereo memories */ - stereo_dft_dec_reset( hStereoDft ); - - return; -} -#else +#ifndef IVAS_FLOAT_FIXED void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ const int32_t output_Fs, /* i : output sampling rate */ @@ -546,324 +397,7 @@ void stereo_dft_dec_open( * Reset DFT stereo memories *------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_dec_reset( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ -) -{ - int16_t i; - int16_t j, b; - - /*Configuration*/ - set_s( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); - - /* SIDE_GAIN */ - set_s( hStereoDft->side_gain_index, 15, STEREO_DFT_BAND_MAX ); - set_s( hStereoDft->side_gain_index_previous, 15, STEREO_DFT_BAND_MAX ); - - /*residual prediction*/ - set_s( hStereoDft->res_pred_mode, hStereoDft->hConfig->res_pred_mode, STEREO_DFT_DEC_DFT_NB ); - for ( i = 0; i < STEREO_DFT_PAST_MAX; i++ ) - { -#ifndef IVAS_FLOAT_FIXED - set_zero( hStereoDft->DFT_past_DMX[i], STEREO_DFT32MS_N_32k ); - set_zero( hStereoDft->past_res_pred_gain[i], STEREO_DFT_BAND_MAX ); -#else - set32_fx( hStereoDft->DFT_past_DMX_fx[i], 0, STEREO_DFT_BAND_MAX ); - set32_fx( hStereoDft->past_res_pred_gain_fx[i], 0, STEREO_DFT_BAND_MAX ); -#endif - } - -#ifdef IVAS_FLOAT_FIXED - FOR ( i = 0; i < STEREO_DFT_PAST_MAX; i++ ) - { - set_val_Word32( hStereoDft->DFT_past_DMX_fx[i], 0, STEREO_DFT32MS_N_32k ); - set_val_Word32( hStereoDft->past_res_pred_gain_fx[i], 0, STEREO_DFT_BAND_MAX ); - hStereoDft->q_DFT_past_DMX_fx[i] = 0; - } -#endif - - hStereoDft->past_DMX_pos = 0; - - set_s( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); - -#ifndef IVAS_FLOAT_FIXED - for ( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) - { - hStereoDft->res_gains_ind[0][i] = 15.f; - } - - set_zero( hStereoDft->res_gains_ind[1], STEREO_DFT_BAND_MAX ); -#else - FOR( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) - { - hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ - } - - set_val_Word32( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); -#endif - - /*residual coding*/ - set_s( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); - hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->hConfig->res_cod_mode]; -#ifndef IVAS_FLOAT_FIXED - set_zero( hStereoDft->res_cod_mem, STEREO_DFT_OVL_8k ); -#else - set_l( hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); - hStereoDft->q_res_cod_mem_fx = Q16; -#endif - - hStereoDft->res_pred_band_min = max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); - -#ifndef IVAS_FLOAT_FIXED - hStereoDft->stab_fac_smooth_res = 0.f; -#else - hStereoDft->stab_fac_smooth_res_fx = 0; -#endif -#ifdef IVAS_FLOAT_FIXED - bass_psfilter_init_fx(hStereoDft->hBpf); -#endif - tcxltp_dec_init( hStereoDft->hTcxLtpDec, 0, MODE1, IVAS_CPE_DFT, PIT_MAX, 12800 ); - - hStereoDft->reverb_flag = 0; - -#ifndef IVAS_FLOAT_FIXED - hStereoDft->bpf_error_signal_last = 0.0f; - hStereoDft->bpf_error_ratio_mem = 1.0f; - hStereoDft->res_hb_nrg_mem = 0.0f; -#else - hStereoDft->res_hb_nrg_mem_fx = 0; - hStereoDft->bpf_error_signal_last_fx = 0; - hStereoDft->bpf_error_ratio_mem_fx = ONE_IN_Q13; -#endif // IVAS_FLOAT_FIXED - - /*reset parameters*/ -#ifndef IVAS_FLOAT_FIXED - set_zero( hStereoDft->side_gain, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); - set_zero( hStereoDft->gipd, STEREO_DFT_DEC_DFT_NB ); - set_zero( hStereoDft->itd, STEREO_DFT_DEC_DFT_NB ); - set_zero( hStereoDft->res_pred_gain, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); -#else - set32_fx( hStereoDft->side_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); - set32_fx( hStereoDft->gipd_fx, 0, STEREO_DFT_DEC_DFT_NB ); - set32_fx( hStereoDft->itd_fx, 0, STEREO_DFT_DEC_DFT_NB ); - set32_fx( hStereoDft->res_pred_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); -#endif - -#ifdef IVAS_FLOAT_FIXED - /*reset parameters*/ - set_val_Word32( hStereoDft->side_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); - set_val_Word32( hStereoDft->gipd_fx, 0, STEREO_DFT_DEC_DFT_NB ); - set_val_Word32( hStereoDft->itd_fx, 0, STEREO_DFT_DEC_DFT_NB ); - set_val_Word32( hStereoDft->res_pred_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); -#endif - - hStereoDft->wasTransient = 0; - hStereoDft->attackPresent = 0; - -#ifndef IVAS_FLOAT_FIXED - hStereoDft->lt_pred_gain = 0.0f; - hStereoDft->lt_pred_gain_variation = 0.0f; - hStereoDft->lt_var_mean_ratio = STEREO_DFT_RES_RATIO_LIMIT; - hStereoDft->stefi_short_gain = 1.0f; - hStereoDft->stefi_long_gain = 0.0f; -#else - hStereoDft->lt_pred_gain_fx = 0; - hStereoDft->lt_pred_gain_variation_fx = 0; - hStereoDft->lt_var_mean_ratio_fx = STEREO_DFT_RES_RATIO_LIMIT_FX; - hStereoDft->stefi_short_gain_fx = MAX_16; - hStereoDft->stefi_long_gain_fx = 0; - hStereoDft->q_lt_pred_gain = 0; -#endif - -#ifdef IVAS_FLOAT_FIXED - set_val_Word16( hStereoDft->g_state_fx, 0, STEREO_DFT_BAND_MAX ); - init_basic_allpass_fx( &hStereoDft->ap1, dft_ap_gains_fx[0], dft_ap_delays[0] ); - init_basic_allpass_fx( &hStereoDft->ap2, dft_ap_gains_fx[1], dft_ap_delays[1] ); - init_basic_allpass_fx( &hStereoDft->ap3, dft_ap_gains_fx[2], dft_ap_delays[2] ); -#else - set_zero( hStereoDft->g_state, STEREO_DFT_BAND_MAX ); - init_basic_allpass( &hStereoDft->ap1, dft_ap_gains[0], dft_ap_delays[0] ); - init_basic_allpass( &hStereoDft->ap2, dft_ap_gains[1], dft_ap_delays[1] ); - init_basic_allpass( &hStereoDft->ap3, dft_ap_gains[2], dft_ap_delays[2] ); -#endif - -#ifdef IVAS_FLOAT_FIXED - set32_fx( hStereoDft->ap_delay_mem_fx, 0, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - set32_fx( hStereoDft->ap_fade_mem_fx, 0, STEREO_DFT_ALLPASS_FADELEN_16k ); - hStereoDft->q_ap_delay_mem_fx = Q11; -#else - set_zero( hStereoDft->ap_delay_mem, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - set_zero( hStereoDft->ap_fade_mem, STEREO_DFT_ALLPASS_FADELEN_16k ); -#endif - hStereoDft->ap_wasTransient = 0; -#ifdef IVAS_FLOAT_FIXED - set32_fx( hStereoDft->smooth_dmx_nrg_fx, 0, STEREO_DFT_BAND_MAX ); - set32_fx( hStereoDft->smooth_res_nrg_fx, 0, STEREO_DFT_BAND_MAX ); -#else - set_zero(hStereoDft->smooth_dmx_nrg, STEREO_DFT_BAND_MAX); - set_zero(hStereoDft->smooth_res_nrg, STEREO_DFT_BAND_MAX); -#endif - - set_s( hStereoDft->core_hist, ACELP_CORE, STEREO_DFT_CORE_HIST_MAX ); - - //set_zero( hStereoDft->hb_stefi_sig, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); - //set_zero( hStereoDft->hb_nrg, STEREO_DFT_CORE_HIST_MAX ); - //set_zero( hStereoDft->td_gain, STEREO_DFT_CORE_HIST_MAX ); - -#ifdef IVAS_FLOAT_FIXED - set32_fx(hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA(48000, STEREO_DFT_TD_STEFI_DELAY_NS)); - set32_fx(hStereoDft->td_gain_fx, 0, STEREO_DFT_CORE_HIST_MAX); -#endif - - /* PLC parameters */ -#ifdef IVAS_FLOAT_FIXED - set32_fx( hStereoDft->res_mem_fx, 0, STEREO_DFT_RES_BW_MAX ); -#else - set_zero( hStereoDft->res_mem, STEREO_DFT_RES_BW_MAX ); -#endif - hStereoDft->time_offs = 0; -#ifdef IVAS_FLOAT_FIXED - hStereoDft->past_dmx_nrg_fx = 0; - hStereoDft->sg_mean_fx = 0; -#else - hStereoDft->past_dmx_nrg = 0; - hStereoDft->sg_mean = 0.0f; -#endif - hStereoDft->sg_mem_corrupt = 0; - hStereoDft->recovery_flg = 0; - #ifndef IVAS_FLOAT_FIXED - for ( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) - { - set_zero( hStereoDft->smooth_buf[i], SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - set_zero( hStereoDft->smooth_fac[0], SBA_DIRAC_STEREO_NUM_BANDS ); - set_zero( hStereoDft->smooth_fac[1], SBA_DIRAC_STEREO_NUM_BANDS ); -#else - FOR( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) - { - set32_fx( hStereoDft->smooth_buf_fx[i], 0, SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - hStereoDft->q_smooth_buf_fx = Q7; - set16_fx( hStereoDft->smooth_fac_fx[0], 0, SBA_DIRAC_STEREO_NUM_BANDS ); - set16_fx( hStereoDft->smooth_fac_fx[1], 0, SBA_DIRAC_STEREO_NUM_BANDS ); -#endif - -#ifdef IVAS_FLOAT_FIXED - hStereoDft->itd_xfade_target_fx = 0; - hStereoDft->itd_xfade_step_fx = 0; -#else - hStereoDft->itd_xfade_target = 0.0f; - hStereoDft->itd_xfade_step = 0.0f; -#endif - hStereoDft->itd_xfade_counter = 0; -#ifdef IVAS_FLOAT_FIXED - hStereoDft->itd_xfade_prev_fx = 0; -#else - hStereoDft->itd_xfade_prev = 0.0f; -#endif - hStereoDft->last_active_element_brate = 0; -#ifdef IVAS_FLOAT_FIXED - hStereoDft->ipd_xfade_target_fx = 0; - hStereoDft->ipd_xfade_step_fx = 0; -#else - hStereoDft->ipd_xfade_target = 0.0f; - hStereoDft->ipd_xfade_step = 0.0f; -#endif - hStereoDft->ipd_xfade_counter = 0; -#ifdef IVAS_FLOAT_FIXED - hStereoDft->ipd_xfade_prev_fx = 0; -#else - hStereoDft->ipd_xfade_prev = 0.0f; -#endif - -#ifdef IVAS_FLOAT_FIXED - FOR( b = 0; b < hStereoDft->nbands; b++ ) - { - FOR( i = 0; i < 2; i++ ) - { - FOR( j = 0; j < 4; j++ ) - { - hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; - } - } - } -#else - for ( b = 0; b < hStereoDft->nbands; b++ ) - { - for ( i = 0; i < 2; i++ ) - { - for ( j = 0; j < 4; j++ ) - { - hStereoDft->mixer_mat_smooth[i][j][b] = 0.0f; - } - } - } -#endif - hStereoDft->first_frame = 1; -#ifdef IVAS_FLOAT_FIXED - hStereoDft->g_L_prev_fx = 0; - hStereoDft->g_R_prev_fx = 0; -#else - hStereoDft->g_L_prev = 0.f; - hStereoDft->g_R_prev = 0.f; -#endif - -#ifdef IVAS_FLOAT_FIXED - set_val_Word32( hStereoDft->ap_delay_mem_fx, 0, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - set_val_Word32( hStereoDft->ap_fade_mem_fx, 0, STEREO_DFT_ALLPASS_FADELEN_16k ); - set_val_Word32( hStereoDft->smooth_dmx_nrg_fx, 0, STEREO_DFT_BAND_MAX ); - set_val_Word32( hStereoDft->smooth_res_nrg_fx, 0, STEREO_DFT_BAND_MAX ); - - set_s( hStereoDft->core_hist, ACELP_CORE, STEREO_DFT_CORE_HIST_MAX ); - - set_val_Word32( hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); - set_val_Word32( hStereoDft->hb_nrg_fx, 0, STEREO_DFT_CORE_HIST_MAX ); - set_val_Word32( hStereoDft->td_gain_fx, 0, STEREO_DFT_CORE_HIST_MAX ); - set_val_Word32( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); - - /* PLC parameters */ - set_val_Word32( hStereoDft->res_mem_fx, 0, STEREO_DFT_RES_BW_MAX ); - hStereoDft->past_dmx_nrg_fx = 0; - hStereoDft->sg_mean_fx = 0; - hStereoDft->q_dft = 0; - hStereoDft->q_smoothed_nrg = 0; - - FOR ( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) - { - set_val_Word32( hStereoDft->smooth_buf_fx[i], 0, SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - hStereoDft->q_smooth_buf_fx = Q7; - set_val_Word16( hStereoDft->smooth_fac_fx[0], 0, SBA_DIRAC_STEREO_NUM_BANDS ); - set_val_Word16( hStereoDft->smooth_fac_fx[1], 0, SBA_DIRAC_STEREO_NUM_BANDS ); - - hStereoDft->itd_xfade_target_fx = 0; - hStereoDft->itd_xfade_step_fx = 0; - hStereoDft->itd_xfade_prev_fx = 0; - hStereoDft->ipd_xfade_target_fx = 0; - hStereoDft->ipd_xfade_step_fx = 0; - hStereoDft->ipd_xfade_prev_fx = 0; - - FOR ( b = 0; b < hStereoDft->nbands; b++ ) - { - FOR ( i = 0; i < 2; i++ ) - { - FOR ( j = 0; j < 4; j++ ) - { - hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; - } - } - } - hStereoDft->g_L_prev_fx = 0; - hStereoDft->g_R_prev_fx = 0; -#endif - - return; -} - -#else - void stereo_dft_dec_reset( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ ) @@ -996,114 +530,7 @@ void stereo_dft_dec_reset( * * Update DFT memories for new frame *-------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_dec_update( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const int16_t output_frame, /* i : output frame length */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ -) -{ - int16_t b, i, k_offset; - - /* Initialization */ - k_offset = STEREO_DFT_OFFSET; /*Add an offset*/ - - /* Update parameters */ -#ifndef IVAS_FLOAT_FIXED - for ( i = 0; i < k_offset * STEREO_DFT_BAND_MAX; i++ ) - { - hStereoDft->side_gain[i] = hStereoDft->side_gain[STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX + i]; - hStereoDft->res_pred_gain[i] = hStereoDft->res_pred_gain[STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX + i]; - } -#else - FOR( i = 0; i < k_offset * STEREO_DFT_BAND_MAX; i++ ) - { - hStereoDft->side_gain_fx[i] = hStereoDft->side_gain_fx[STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX + i]; - hStereoDft->res_pred_gain_fx[i] = hStereoDft->res_pred_gain_fx[STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX + i]; - } -#endif - -#ifndef IVAS_FLOAT_FIXED - for ( i = 0; i < k_offset; i++ ) - { - hStereoDft->gipd[i] = hStereoDft->gipd[STEREO_DFT_NBDIV + i]; - } -#else - FOR(i = 0; i < k_offset; i++) - { - hStereoDft->gipd_fx[i] = hStereoDft->gipd_fx[STEREO_DFT_NBDIV + i]; - } -#endif - - /* Update configuration memories */ - for ( i = 0; i < k_offset; i++ ) - { - hStereoDft->band_res[i] = hStereoDft->band_res[i + STEREO_DFT_NBDIV]; - hStereoDft->prm_res[i] = hStereoDft->prm_res[i + STEREO_DFT_NBDIV]; -#ifndef IVAS_FLOAT_FIXED - hStereoDft->itd[i] = hStereoDft->itd[STEREO_DFT_NBDIV + i]; -#else - hStereoDft->itd_fx[i] = hStereoDft->itd_fx[STEREO_DFT_NBDIV + i]; -#endif - hStereoDft->res_cod_mode[i] = hStereoDft->res_cod_mode[i + STEREO_DFT_NBDIV]; - hStereoDft->res_pred_mode[i] = hStereoDft->res_pred_mode[i + STEREO_DFT_NBDIV]; - } - - /* Load new configurations */ - set_s( hStereoDft->band_res + k_offset, hStereoDft->hConfig->band_res, STEREO_DFT_NBDIV ); - set_s( hStereoDft->prm_res + k_offset, hStereoDft->hConfig->prm_res, STEREO_DFT_NBDIV ); - set_s( hStereoDft->res_pred_mode + k_offset, hStereoDft->hConfig->res_pred_mode, STEREO_DFT_NBDIV ); - set_s( hStereoDft->res_cod_mode + k_offset, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_NBDIV ); - - /*Update attack info*/ - if ( hStereoDft->attackPresent ) - { - hStereoDft->wasTransient = 1; - } - else if ( hStereoDft->wasTransient ) - { - hStereoDft->wasTransient = 0; - } - - for ( i = STEREO_DFT_CORE_HIST_MAX - 1; i > 0; i-- ) - { - hStereoDft->core_hist[i] = hStereoDft->core_hist[i - 1]; - } - - //mvr2r( hStereoDft->hb_stefi_sig + output_frame, hStereoDft->hb_stefi_sig, hStereoDft->hb_stefi_delay ); - //mvr2r( hStereoDft->hb_nrg, hStereoDft->hb_nrg + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); - //mvr2r( hStereoDft->td_gain, hStereoDft->td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); - #ifndef IVAS_FLOAT_FIXED - if ( sba_dirac_stereo_flag ) - { - /* buffer update, push back by 2 because of 2 subframes */ - for ( b = 0; b < hStereoDft->nbands; b++ ) - { - for ( i = SBA_DIRAC_NRG_SMOOTH_LONG; i > 1; i-- ) - { - hStereoDft->smooth_buf[b][i] = hStereoDft->smooth_buf[b][i - 2]; - } - } - } -#else - IF( sba_dirac_stereo_flag ) - { - /* buffer update, push back by 2 because of 2 subframes */ - FOR( b = 0; b < hStereoDft->nbands; b++ ) - { - FOR( i = SBA_DIRAC_NRG_SMOOTH_LONG; i > 1; i-- ) - { - hStereoDft->smooth_buf_fx[b][i] = hStereoDft->smooth_buf_fx[b][i - 2]; - } - } - } -#endif - - return; -} -#else - void stereo_dft_dec_update( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ const int16_t output_frame, /* i : output frame length */ diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 14122fe14..7b3acb1ce 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -107,11 +107,12 @@ void stereo_dft_dec_reset_fx( /*residual prediction*/ set_s( hStereoDft->res_pred_mode, hStereoDft->hConfig->res_pred_mode, STEREO_DFT_DEC_DFT_NB ); - FOR ( i = 0; i < STEREO_DFT_PAST_MAX; i++ ) + FOR( i = 0; i < STEREO_DFT_PAST_MAX; i++ ) { - set_val_Word32( hStereoDft->DFT_past_DMX_fx[i], 0, STEREO_DFT32MS_N_32k ); - set_val_Word32( hStereoDft->past_res_pred_gain_fx[i], 0, STEREO_DFT_BAND_MAX ); + set32_fx( hStereoDft->DFT_past_DMX_fx[i], 0, STEREO_DFT32MS_N_32k ); + set32_fx( hStereoDft->past_res_pred_gain_fx[i], 0, STEREO_DFT_BAND_MAX ); hStereoDft->q_DFT_past_DMX_fx[i] = 0; + move16(); } hStereoDft->past_DMX_pos = 0; @@ -119,28 +120,28 @@ void stereo_dft_dec_reset_fx( set_s( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); - FOR ( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) + FOR( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) { - hStereoDft->res_gains_ind_fx[0][i] = (Word32)0x3C000000; + hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } - set_val_Word32( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); + set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); /*residual coding*/ set_s( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->hConfig->res_cod_mode]; - set_val_Word32( hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); + set32_fx( hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); hStereoDft->q_res_cod_mem_fx = Q16; + move16(); hStereoDft->res_pred_band_min = s_max( STEREO_DFT_RES_PRED_BAND_MIN, hStereoDft->res_cod_band_max ); move32(); hStereoDft->stab_fac_smooth_res_fx = 0; move16(); -#ifndef IVAS_FLOAT_FIXED - bass_psfilter_init( hStereoDft->hBpf ); -#endif + bass_psfilter_init_fx( hStereoDft->hBpf ); + tcxltp_dec_init( hStereoDft->hTcxLtpDec, 0, MODE1, IVAS_CPE_DFT, PIT_MAX, 12800 ); hStereoDft->reverb_flag = 0; @@ -154,10 +155,10 @@ void stereo_dft_dec_reset_fx( move16(); /*reset parameters*/ - set_val_Word32( hStereoDft->side_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); - set_val_Word32( hStereoDft->gipd_fx, 0, STEREO_DFT_DEC_DFT_NB ); - set_val_Word32( hStereoDft->itd_fx, 0, STEREO_DFT_DEC_DFT_NB ); - set_val_Word32( hStereoDft->res_pred_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); + set32_fx( hStereoDft->side_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); + set32_fx( hStereoDft->gipd_fx, 0, STEREO_DFT_DEC_DFT_NB ); + set32_fx( hStereoDft->itd_fx, 0, STEREO_DFT_DEC_DFT_NB ); + set32_fx( hStereoDft->res_pred_gain_fx, 0, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX ); hStereoDft->wasTransient = 0; move16(); @@ -165,36 +166,47 @@ void stereo_dft_dec_reset_fx( move16(); hStereoDft->lt_pred_gain_fx = 0; + move32(); hStereoDft->lt_pred_gain_variation_fx = 0; + move32(); hStereoDft->lt_var_mean_ratio_fx = STEREO_DFT_RES_RATIO_LIMIT_FX; + move32(); hStereoDft->stefi_short_gain_fx = MAX_16; + move16(); hStereoDft->stefi_long_gain_fx = 0; + move16(); hStereoDft->q_lt_pred_gain = 0; + move16(); - set_val_Word16( &hStereoDft->g_state_fx[0], 0, STEREO_DFT_BAND_MAX ); + set16_fx( &hStereoDft->g_state_fx[0], 0, STEREO_DFT_BAND_MAX ); init_basic_allpass_fx( &hStereoDft->ap1, dft_ap_gains_fx[0], dft_ap_delays[0] ); init_basic_allpass_fx( &hStereoDft->ap2, dft_ap_gains_fx[1], dft_ap_delays[1] ); init_basic_allpass_fx( &hStereoDft->ap3, dft_ap_gains_fx[2], dft_ap_delays[2] ); - set_val_Word32( hStereoDft->ap_delay_mem_fx, 0, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - set_val_Word32( hStereoDft->ap_fade_mem_fx, 0, STEREO_DFT_ALLPASS_FADELEN_16k ); + set32_fx( hStereoDft->ap_delay_mem_fx, 0, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); + set32_fx( hStereoDft->ap_fade_mem_fx, 0, STEREO_DFT_ALLPASS_FADELEN_16k ); hStereoDft->q_ap_delay_mem_fx = Q11; move16(); hStereoDft->ap_wasTransient = 0; move16(); - set_val_Word32( hStereoDft->smooth_dmx_nrg_fx, 0, STEREO_DFT_BAND_MAX ); - set_val_Word32( hStereoDft->smooth_res_nrg_fx, 0, STEREO_DFT_BAND_MAX ); + set32_fx( hStereoDft->smooth_dmx_nrg_fx, 0, STEREO_DFT_BAND_MAX ); + set32_fx( hStereoDft->smooth_res_nrg_fx, 0, STEREO_DFT_BAND_MAX ); + hStereoDft->q_smoothed_nrg = 0; + move16(); set_s( hStereoDft->core_hist, ACELP_CORE, STEREO_DFT_CORE_HIST_MAX ); - set_val_Word32( hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); - set_val_Word32( hStereoDft->hb_nrg_fx, 0, STEREO_DFT_CORE_HIST_MAX ); - set_val_Word32( hStereoDft->td_gain_fx, 0, STEREO_DFT_CORE_HIST_MAX ); - set_val_Word32( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); + set32_fx( hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); + set32_fx( hStereoDft->hb_nrg_fx, 0, STEREO_DFT_CORE_HIST_MAX ); + set32_fx( hStereoDft->td_gain_fx, 0, STEREO_DFT_CORE_HIST_MAX ); + set32_fx( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); + + hStereoDft->q_dft = 0; + move16(); /* PLC parameters */ - set_val_Word32( hStereoDft->res_mem_fx, 0, STEREO_DFT_RES_BW_MAX ); + set32_fx( hStereoDft->res_mem_fx, 0, STEREO_DFT_RES_BW_MAX ); hStereoDft->time_offs = 0; move16(); hStereoDft->past_dmx_nrg_fx = 0; @@ -206,37 +218,51 @@ void stereo_dft_dec_reset_fx( hStereoDft->recovery_flg = 0; move16(); - FOR ( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) + FOR( i = 0; i < SBA_DIRAC_STEREO_NUM_BANDS; i++ ) { - set_val_Word32( hStereoDft->smooth_buf_fx[i], 0, SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + set32_fx( hStereoDft->smooth_buf_fx[i], 0, SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); } hStereoDft->q_smooth_buf_fx = Q7; - set_val_Word16( hStereoDft->smooth_fac_fx[0], 0, SBA_DIRAC_STEREO_NUM_BANDS ); - set_val_Word16( hStereoDft->smooth_fac_fx[1], 0, SBA_DIRAC_STEREO_NUM_BANDS ); + move16(); + set16_fx( hStereoDft->smooth_fac_fx[0], 0, SBA_DIRAC_STEREO_NUM_BANDS ); + set16_fx( hStereoDft->smooth_fac_fx[1], 0, SBA_DIRAC_STEREO_NUM_BANDS ); - hStereoDft->itd_xfade_target_fx = 0; move32(); - hStereoDft->itd_xfade_step_fx = 0; move32(); - hStereoDft->itd_xfade_counter = 0; move16(); - hStereoDft->itd_xfade_prev_fx = 0; move32(); - hStereoDft->last_active_element_brate = 0; move32(); - hStereoDft->ipd_xfade_target_fx = 0; move32(); - hStereoDft->ipd_xfade_step_fx = 0; move32(); - hStereoDft->ipd_xfade_counter = 0; move16(); - hStereoDft->ipd_xfade_prev_fx = 0; move32(); + hStereoDft->itd_xfade_target_fx = 0; + move32(); + hStereoDft->itd_xfade_step_fx = 0; + move32(); + hStereoDft->itd_xfade_counter = 0; + move16(); + hStereoDft->itd_xfade_prev_fx = 0; + move32(); + hStereoDft->last_active_element_brate = 0; + move32(); + hStereoDft->ipd_xfade_target_fx = 0; + move32(); + hStereoDft->ipd_xfade_step_fx = 0; + move32(); + hStereoDft->ipd_xfade_counter = 0; + move16(); + hStereoDft->ipd_xfade_prev_fx = 0; + move32(); - FOR ( b = 0; b < hStereoDft->nbands; b++ ) + FOR( b = 0; b < hStereoDft->nbands; b++ ) { - FOR ( i = 0; i < 2; i++ ) + FOR( i = 0; i < 2; i++ ) { - FOR ( j = 0; j < 4; j++ ) + FOR( j = 0; j < 4; j++ ) { - hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; move32(); + hStereoDft->mixer_mat_smooth_fx[i][j][b] = 0; + move32(); } } } - hStereoDft->first_frame = 1; move16(); - hStereoDft->g_L_prev_fx = 0; move32(); - hStereoDft->g_R_prev_fx = 0; move32(); + hStereoDft->first_frame = 1; + move16(); + hStereoDft->g_L_prev_fx = 0; + move32(); + hStereoDft->g_R_prev_fx = 0; + move32(); return; } @@ -249,41 +275,43 @@ void stereo_dft_dec_reset_fx( static void stereo_dft_dec_open_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word16 nchan_transport /* i : number of transport channels */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word16 nchan_transport /* i : number of transport channels */ ) { /*Sizes*/ - hStereoDft->N = (int16_t) ( STEREO_DFT_HOP_MAX * output_Fs / 48000 ); + hStereoDft->N = extract_l( STEREO_DFT_HOP_MAX * output_Fs / 48000 ); /*Init. DFT sizes*/ - hStereoDft->NFFT = (int16_t) ( STEREO_DFT32MS_N_MAX * output_Fs / 48000 ); + hStereoDft->NFFT = extract_l( STEREO_DFT32MS_N_MAX * output_Fs / 48000 ); hStereoDft->dft_trigo_8k_fx = dft_trigo_32k_fx; hStereoDft->dft_trigo_12k8_fx = dft_trigo_12k8_fx; hStereoDft->dft_trigo_16k_fx = dft_trigo_32k_fx; - hStereoDft->dft32ms_ovl = (int16_t) ( ( STEREO_DFT32MS_OVL_MAX * output_Fs ) / 48000 ); + hStereoDft->dft32ms_ovl = extract_l( ( STEREO_DFT32MS_OVL_MAX * output_Fs ) / 48000 ); hStereoDft->win232ms_8k_fx = dft_win232ms_8k_fx; hStereoDft->win232ms_12k8_fx = dft_win232ms_12k8_fx; hStereoDft->win232ms_16k_fx = dft_win232ms_16k_fx; - hStereoDft->dft32ms_ovl2 = (int16_t) ( ( STEREO_DFT32MS_OVL2_MAX * output_Fs ) / 48000 ); + hStereoDft->dft32ms_ovl2 = extract_l( ( STEREO_DFT32MS_OVL2_MAX * output_Fs ) / 48000 ); hStereoDft->win32ms_8k_fx = dft_win232ms_8k_fx + 1; hStereoDft->win32ms_12k8_fx = dft_win232ms_12k8_fx + 1; hStereoDft->win32ms_16k_fx = dft_win232ms_16k_fx + 1; - IF ( EQ_32(output_Fs , 16000) ) + IF( EQ_32( output_Fs, 16000 ) ) { hStereoDft->dft_trigo_fx = dft_trigo_32k_fx; hStereoDft->dft_trigo_step = STEREO_DFT_TRIGO_SRATE_16k_STEP; + move16(); hStereoDft->win232ms_fx = dft_win232ms_16k_fx; hStereoDft->win32ms_fx = dft_win232ms_16k_fx + 1; } - ELSE IF ( EQ_32(output_Fs , 32000) ) + ELSE IF( EQ_32( output_Fs, 32000 ) ) { hStereoDft->dft_trigo_fx = dft_trigo_32k_fx; hStereoDft->dft_trigo_step = STEREO_DFT_TRIGO_SRATE_32k_STEP; + move16(); hStereoDft->win232ms_fx = dft_win232ms_32k_fx; hStereoDft->win32ms_fx = dft_win232ms_32k_fx + 1; } @@ -292,6 +320,7 @@ static void stereo_dft_dec_open_fx( assert( output_Fs == 48000 ); hStereoDft->dft_trigo_fx = dft_trigo_48k_fx; hStereoDft->dft_trigo_step = STEREO_DFT_TRIGO_SRATE_48k_STEP; + move16(); hStereoDft->win232ms_fx = dft_win232ms_48k_fx; hStereoDft->win32ms_fx = dft_win232ms_48k_fx + 1; } @@ -304,7 +333,7 @@ static void stereo_dft_dec_open_fx( hStereoDft->nbands = stereo_dft_band_config( hStereoDft->band_limits, hStereoDft->band_res[0], hStereoDft->NFFT, DEC ); hStereoDft->hb_stefi_delay = NS2SA( output_Fs, STEREO_DFT_TD_STEFI_DELAY_NS ); - IF ( GT_16(nchan_transport , 2) ) + IF( GT_16( nchan_transport, 2 ) ) { hStereoDft->min_smooth_gains_fx = min_smooth_gains2_fx; hStereoDft->max_smooth_gains_fx = max_smooth_gains2_fx; @@ -315,7 +344,9 @@ static void stereo_dft_dec_open_fx( hStereoDft->max_smooth_gains_fx = max_smooth_gains1_fx; } hStereoDft->q_hb_stefi_sig_fx = Q31; + move16(); hStereoDft->q_ap_fade_mem_fx = Q31; + move16(); /* reset DFT stereo memories */ stereo_dft_dec_reset_fx( hStereoDft ); @@ -332,36 +363,36 @@ static void stereo_dft_dec_open_fx( ivas_error stereo_dft_dec_create_fx( STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word32 element_brate, /* i : element bitrate */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ - const Word16 nchan_transport /* i : number of transport channels */ + const Word32 element_brate, /* i : element bitrate */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const Word16 nchan_transport /* i : number of transport channels */ ) { STEREO_DFT_DEC_DATA_HANDLE hStereoDft_loc; Word16 tmpS; - IF ( *hStereoDft != NULL ) + IF( *hStereoDft != NULL ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: DFT Stereo memory already allocated\n" ); } - IF ( ( hStereoDft_loc = (STEREO_DFT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_DFT_DEC_DATA ) ) ) == NULL ) + IF( ( hStereoDft_loc = (STEREO_DFT_DEC_DATA_HANDLE) malloc( sizeof( STEREO_DFT_DEC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT Stereo\n" ) ); } - IF ( ( hStereoDft_loc->hConfig = (STEREO_DFT_CONFIG_DATA_HANDLE) malloc( sizeof( STEREO_DFT_CONFIG_DATA ) ) ) == NULL ) + IF( ( hStereoDft_loc->hConfig = (STEREO_DFT_CONFIG_DATA_HANDLE) malloc( sizeof( STEREO_DFT_CONFIG_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT Stereo Config\n" ) ); } - IF ( ( hStereoDft_loc->hBpf = (BPF_DEC_HANDLE) malloc( sizeof( BPF_DEC_DATA ) ) ) == NULL ) + IF( ( hStereoDft_loc->hBpf = (BPF_DEC_HANDLE) malloc( sizeof( BPF_DEC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for BPF handle\n" ) ); } - IF ( ( hStereoDft_loc->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) + IF( ( hStereoDft_loc->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } @@ -369,7 +400,7 @@ ivas_error stereo_dft_dec_create_fx( hStereoDft_loc->hConfig->force_mono_transmission = 0; move16(); - IF ( sba_dirac_stereo_flag ) + IF( sba_dirac_stereo_flag ) { ivas_sba_dirac_stereo_config( hStereoDft_loc->hConfig ); } @@ -380,10 +411,6 @@ ivas_error stereo_dft_dec_create_fx( stereo_dft_dec_open_fx( hStereoDft_loc, output_Fs, nchan_transport ); -#if 1 // TODO: To be removed later - stereo_dft_dec_open( hStereoDft_loc, output_Fs, nchan_transport ); -#endif - *hStereoDft = hStereoDft_loc; return IVAS_ERR_OK; @@ -504,8 +531,8 @@ static void stereo_dft_dequantize_res_gains_f_fx( void stereo_dft_dec_update_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const Word16 output_frame, /* i : output frame length */ - const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + const Word16 output_frame, /* i : output frame length */ + const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ) { Word16 b, i, k_offset; @@ -514,7 +541,7 @@ void stereo_dft_dec_update_fx( k_offset = STEREO_DFT_OFFSET; /*Add an offset*/ move16(); /* Update parameters */ - FOR ( i = 0; i < k_offset * STEREO_DFT_BAND_MAX; i++ ) + FOR( i = 0; i < k_offset * STEREO_DFT_BAND_MAX; i++ ) { hStereoDft->side_gain_fx[i] = hStereoDft->side_gain_fx[STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX + i]; move32(); @@ -522,14 +549,14 @@ void stereo_dft_dec_update_fx( move32(); } - FOR ( i = 0; i < k_offset; i++ ) + FOR( i = 0; i < k_offset; i++ ) { hStereoDft->gipd_fx[i] = hStereoDft->gipd_fx[STEREO_DFT_NBDIV + i]; move32(); } /* Update configuration memories */ - FOR ( i = 0; i < k_offset; i++ ) + FOR( i = 0; i < k_offset; i++ ) { hStereoDft->band_res[i] = hStereoDft->band_res[i + STEREO_DFT_NBDIV]; move16(); @@ -550,18 +577,18 @@ void stereo_dft_dec_update_fx( set_s( hStereoDft->res_cod_mode + k_offset, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_NBDIV ); /*Update attack info*/ - IF ( hStereoDft->attackPresent ) + IF( hStereoDft->attackPresent ) { hStereoDft->wasTransient = 1; move16(); } - ELSE IF ( hStereoDft->wasTransient ) + ELSE IF( hStereoDft->wasTransient ) { hStereoDft->wasTransient = 0; move16(); } - FOR ( i = STEREO_DFT_CORE_HIST_MAX - 1; i > 0; i-- ) + FOR( i = STEREO_DFT_CORE_HIST_MAX - 1; i > 0; i-- ) { hStereoDft->core_hist[i] = hStereoDft->core_hist[i - 1]; move16(); @@ -570,14 +597,14 @@ void stereo_dft_dec_update_fx( Copy32( hStereoDft->hb_stefi_sig_fx + output_frame, hStereoDft->hb_stefi_sig_fx, hStereoDft->hb_stefi_delay ); Copy32( hStereoDft->hb_nrg_fx, hStereoDft->hb_nrg_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); Copy32( hStereoDft->td_gain_fx, hStereoDft->td_gain_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); - Copy32( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1); + Copy32( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); - IF ( sba_dirac_stereo_flag ) + IF( sba_dirac_stereo_flag ) { /* buffer update, push back by 2 because of 2 subframes */ - FOR ( b = 0; b < hStereoDft->nbands; b++ ) + FOR( b = 0; b < hStereoDft->nbands; b++ ) { - FOR ( i = SBA_DIRAC_NRG_SMOOTH_LONG; i > 1; i-- ) + FOR( i = SBA_DIRAC_NRG_SMOOTH_LONG; i > 1; i-- ) { hStereoDft->smooth_buf_fx[b][i] = hStereoDft->smooth_buf_fx[b][i - 2]; move32(); @@ -3098,10 +3125,10 @@ void stereo_dft_dec_sid_coh_fx( FOR( i = 0; i < b; i++ ) { - pred_fx = add( pred_fx, shl(mult( ( *pptr_fx++ ), cohBandq_fx[i] ), 2) ); /*q-13*/ + pred_fx = add( pred_fx, shl( mult( ( *pptr_fx++ ), cohBandq_fx[i] ), 2 ) ); /*q-13*/ } /* Weighted intra/inter-frame prediction */ - pred_fx = add( mult( alpha_fx, pred_fx ), mult( sub( 32767, alpha_fx ), coh_fx[b] ) ); /*q-13*/ + pred_fx = add( mult( alpha_fx, pred_fx ), mult( sub( 32767, alpha_fx ), shr( coh_fx[b], 2 ) ) ); /*q-13*/ /* Read residual index from bitstream */ IF( LT_16( *nb_bits, nr_of_sid_stereo_bits ) ) /* If the bit limit is reached, res_index = 0 is assumed for remaining indices */ @@ -3131,9 +3158,9 @@ void stereo_dft_dec_sid_coh_fx( cohBandq_fx[b] = 0; move16(); } - coh_fx[b] = cohBandq_fx[b]; /* Update memory for next frame */ - pred_fx = 0; + coh_fx[b] = shl_sat( cohBandq_fx[b], 2 ); /* Update memory for next frame */ move16(); + pred_fx = 0; move16(); } diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index b11233337..78f8b26dd 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -1540,10 +1540,6 @@ ivas_error stereo_memory_dec_fx( td_bwe_dec_init_ivas_fx( st, st->hBWE_TD, st->output_Fs ); -#if 1 // TODO: To be removed later - td_bwe_dec_init( st->hBWE_TD, -1, st->output_Fs ); -#endif - st->prev_Q_bwe_exc = 31; st->prev_Qx = 0; st->prev_ener_fx_Q = 31; @@ -1782,9 +1778,7 @@ ivas_error stereo_memory_dec_fx( } td_bwe_dec_init_ivas_fx( st, st->hBWE_TD, st->output_Fs ); -#if 1 // TODO: To be removed later - td_bwe_dec_init( st->hBWE_TD, -1, st->output_Fs ); -#endif + st->prev_Q_bwe_exc = 31; st->prev_Qx = 0; st->prev_ener_fx_Q = 31; diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 83db7194b..21745b288 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -338,8 +338,6 @@ void stereo_tcx_core_dec_fx( IF( st->tcxonly ) { st->p_bpf_noise_buf_32 = NULL; - // To be removed - st->p_bpf_noise_buf_float = NULL; } ELSE { @@ -347,8 +345,6 @@ void stereo_tcx_core_dec_fx( st->p_bpf_noise_buf = st->bpf_noise_buf; set_s( pitch, L_SUBFR, st->nb_subfr ); set16_fx( pit_gain_fx, 0, st->nb_subfr ); - // To be removed - st->p_bpf_noise_buf_float = st->bpf_noise_buf_float; } /* Initialize pointers */ @@ -657,9 +653,6 @@ void stereo_tcx_core_dec_fx( IF( !bfi && st->hTonalMDCTConc != NULL ) { TonalMDCTConceal_SaveTimeSignal( st->hTonalMDCTConc, synthFB_fx, hTcxDec->L_frameTCX ); - // To be removed - fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); - fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); } decoder_tcx_post_fx( st, synth_fx, synthFB_fx, Aq_fx, bfi ); @@ -775,8 +768,17 @@ void stereo_tcx_core_dec_fx( st->last_is_cng = 0; /* Postfiltering */ + IF( st->p_bpf_noise_buf_32 ) + { + Copy_Scale_sig_32_16( st->p_bpf_noise_buf_32, st->p_bpf_noise_buf, st->L_frame, negate( Q11 ) ); + } + post_decoder( st, synth_buf_fx, pit_gain_fx, pitch, signal_out_fx, st->p_bpf_noise_buf ); + IF( st->p_bpf_noise_buf_32 ) + { + Copy_Scale_sig_16_32_no_sat( st->p_bpf_noise_buf, st->p_bpf_noise_buf_32, st->L_frame, Q11 ); + } IF( signal_outFB_fx ) { Copy( synthFB_fx, signal_outFB_fx, hTcxDec->L_frameTCX ); diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index f9fb1e649..105e33499 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -395,25 +395,25 @@ typedef struct tonalmdctconceal blockData lastBlockData; blockData secondLastBlockData; - Float32 scaleFactorsBuffers_float[2][FDNS_NPTS]; /* Contains also global gain. If it can not be stored in 16 bits with global gain included, then store global gain separately. */ Word16 scaleFactorsBuffers[2][FDNS_NPTS]; /* Contains also global gain. */ Word16 scaleFactorsBuffers_exp[2][FDNS_NPTS]; - Float32 spectralDataBuffers_float[2][L_FRAME_MAX]; /* 16 bits is enough, because it is stored before applying scale factors. Take care that power spectrum is also stored here. */ Word16 spectralDataBuffers[2][L_FRAME_MAX]; /* 16 bits is enough, because it is stored before applying scale factors. Take care that power spectrum is also stored here. */ - Float32 timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2]; Word16 timeDataBuffer[(3 * L_FRAME_MAX) / 2]; /* 16 bits are enough for the TD signal */ - +#ifndef IVAS_FLOAT_FIXED + Float32 scaleFactorsBuffers_float[2][FDNS_NPTS]; /* Contains also global gain. If it can not be stored in 16 bits with global gain included, then store global gain separately. */ + Float32 spectralDataBuffers_float[2][L_FRAME_MAX]; /* 16 bits is enough, because it is stored before applying scale factors. Take care that power spectrum is also stored here. */ + Float32 timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2]; Float32 *lastPcmOut_float; + Float32 *secondLastPcmOut_float; +#endif Word16 * lastPcmOut; - Float32 *secondLastPcmOut_float; Word16 * secondLastPcmOut; - float *secondLastPowerSpectrum_float; Word16 * secondLastPowerSpectrum; Word16 secondLastPowerSpectrum_exp; @@ -421,6 +421,7 @@ typedef struct tonalmdctconceal //Word16 scaleFactorsBackground[FDNS_NPTS]; Word32 scaleFactorsBackground_fx[FDNS_NPTS]; #ifndef IVAS_FLOAT_FIXED + float *secondLastPowerSpectrum_float; float scaleFactorsBackground_flt[FDNS_NPTS]; float scf_fadeout_flt; #endif @@ -451,8 +452,9 @@ typedef struct tonalmdctconceal //Memory ovelap issue #endif TonalComponentsInfo *pTCI; +#ifndef IVAS_FLOAT_FIXED TonalComponentsInfo pTCI1; - +#endif } TonalMDCTConceal_INSTANCE, *TonalMDCTConcealPtr; @@ -1655,7 +1657,9 @@ typedef struct td_bwe_dec_structure #endif Word32 bwe_non_lin_prev_scale_fx; +#ifndef IVAS_FLOAT_FIXED float old_bwe_exc_extended[NL_BUFF_OFFSET]; +#endif Word16 old_bwe_exc_extended_fx[NL_BUFF_OFFSET]; @@ -1686,19 +1690,27 @@ typedef struct td_bwe_dec_structure Word16 genSHBsynth_state_lsyn_filt_shb_local_fx[2 * ALLPASSSECTIONS_STEEP]; Word32 genSHBsynth_state_lsyn_filt_shb_local_fx_32[2 * ALLPASSSECTIONS_STEEP]; +#ifndef IVAS_FLOAT_FIXED float state_lsyn_filt_shb[2 * ALLPASSSECTIONS_STEEP]; +#endif Word16 state_lsyn_filt_shb_fx[2 * ALLPASSSECTIONS_STEEP]; Word32 state_lsyn_filt_shb_fx_32[2 * ALLPASSSECTIONS_STEEP]; +#ifndef IVAS_FLOAT_FIXED float state_lsyn_filt_dwn_shb[2 * ALLPASSSECTIONS_STEEP]; +#endif Word16 state_lsyn_filt_dwn_shb_fx[2 * ALLPASSSECTIONS_STEEP]; Word32 state_lsyn_filt_dwn_shb_fx_32[2 * ALLPASSSECTIONS_STEEP]; +#ifndef IVAS_FLOAT_FIXED float mem_resamp_HB[INTERP_3_1_MEM_LEN]; +#endif Word16 mem_resamp_HB_fx[INTERP_3_1_MEM_LEN]; Word32 mem_resamp_HB_fx_32[INTERP_3_1_MEM_LEN]; +#ifndef IVAS_FLOAT_FIXED float mem_resamp_HB_32k[2 * ALLPASSSECTIONS_STEEP + 1]; +#endif Word16 mem_resamp_HB_32k_fx[2 * ALLPASSSECTIONS_STEEP + 1]; Word32 mem_resamp_HB_32k_fx_32[2 * ALLPASSSECTIONS_STEEP + 1]; @@ -1867,11 +1879,15 @@ typedef struct td_bwe_dec_structure #endif Word16 old_core_synth_fx[L_FRAME16k]; +#ifndef IVAS_FLOAT_FIXED float old_tbe_synth[L_SHB_TRANSITION_LENGTH]; +#endif Word16 old_tbe_synth_fx[L_SHB_TRANSITION_LENGTH]; Word32 old_tbe_synth_fx_32[L_SHB_TRANSITION_LENGTH]; +#ifndef IVAS_FLOAT_FIXED float int_3_over_2_tbemem_dec[INTERP_3_2_MEM_LEN]; +#endif Word16 int_3_over_2_tbemem_dec_fx[INTERP_3_2_MEM_LEN]; Word32 int_3_over_2_tbemem_dec_fx_32[INTERP_3_2_MEM_LEN]; @@ -2976,11 +2992,12 @@ typedef struct Decoder_State int16_t rate_switching_reset; - float bpf_noise_buf_float[L_FRAME16k]; Word16 bpf_noise_buf[L_FRAME_16k]; Word32 bpf_noise_buf_32[L_FRAME_16k]; - +#ifndef IVAS_FLOAT_FIXED + float bpf_noise_buf_float[L_FRAME16k]; float *p_bpf_noise_buf_float; +#endif Word16 *p_bpf_noise_buf; Word32 *p_bpf_noise_buf_32; diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index cbdffc62b..c9516a549 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -65,13 +65,13 @@ static void Dequant_mirror_point( const float lsf_q[], const int16_t m_idx, floa * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ResetSHBbuffer_Dec( TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ const int16_t extl /* i : BWE extension layer */ ) { int16_t i; -#ifndef IVAS_FLOAT_FIXED float f; float inc; @@ -104,50 +104,11 @@ void ResetSHBbuffer_Dec( set_f(hBWE_TD->mem_genSHBexc_filt_down_shb, 0.0f, (2 * ALLPASSSECTIONS_STEEP + 1)); set_f(hBWE_TD->mem_genSHBexc_filt_down_wb2, 0.0f, (2 * ALLPASSSECTIONS_STEEP + 1)); set_f(hBWE_TD->mem_genSHBexc_filt_down_wb3, 0.0f, (2 * ALLPASSSECTIONS_STEEP + 1)); -#endif -#ifdef IVAS_FLOAT_FIXED - Word16 f_fx; - Word16 inc_fx; - IF( extl != WB_TBE ) - { - f_fx = 1489; - move16(); /* Q15 */ - inc_fx = 1489; - move16(); /* Q15 */ - } - ELSE - { - f_fx = 5461; - move16();/* Q15 */ - inc_fx = 5461; - move16(); /* Q15 */ - } - - /* states for the filters used in generating SHB excitation from WB excitation*/ - set_val_Word32( hBWE_TD->mem_csfilt_fx, 0, 2 ); - - /* states for the filters used in generating SHB signal from SHB excitation*/ - set_val_Word16( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD ); - set_val_Word16( hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER ); - - IF ( extl == FB_TBE ) - { - set_val_Word16( hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER ); - hBWE_TD->fb_tbe_demph_fx = 0; - fb_tbe_reset_synth_fx( hBWE_TD->fbbwe_hpf_mem_fx, hBWE_TD->fbbwe_hpf_mem_fx_Q, &hBWE_TD->prev_fbbwe_ratio_fx ); - } - - /* states for the filters used in generating SHB signal from SHB excitation in wideband*/ - set_val_Word16( hBWE_TD->mem_genSHBexc_filt_down_shb_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); - set_val_Word16( hBWE_TD->mem_genSHBexc_filt_down_wb2_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); - set_val_Word16( hBWE_TD->mem_genSHBexc_filt_down_wb3_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); -#endif set_f( hBWE_TD->state_lsyn_filt_shb, 0, 2 * ALLPASSSECTIONS_STEEP ); set_f( hBWE_TD->state_lsyn_filt_dwn_shb, 0, 2 * ALLPASSSECTIONS_STEEP ); set_f( hBWE_TD->mem_resamp_HB, 0, INTERP_3_1_MEM_LEN ); -#ifndef IVAS_FLOAT_FIXED /* States for the local synthesis filters */ set_f( hBWE_TD->syn_overlap, 0, L_SHB_LAHEAD ); @@ -184,57 +145,14 @@ void ResetSHBbuffer_Dec( hBWE_TD->prev_mix_factor = 1.0f; set_f(hBWE_TD->old_core_synth, 0, L_FRAME16k); -#endif -#ifdef IVAS_FLOAT_FIXED - IF( extl != WB_TBE ) - { - FOR( i = 0; i < LPC_SHB_ORDER; i++ ) - { - hBWE_TD->lsp_prevfrm_fx[i] = f_fx; - move16(); /*Q15*/ - f_fx = add( f_fx, inc_fx ); - move16(); - } - } - ELSE - { - FOR( i = 0; i < LPC_SHB_ORDER_WB; i++ ) - { - hBWE_TD->lsp_prevfrm_fx[i] = f_fx; - move16();/*Q15*/ - f_fx = add( f_fx, inc_fx ); - move16(); - } - FOR( ; ilsp_prevfrm_fx[i] = 0; - move16(); - } - } - - hBWE_TD->GainFrame_prevfrm_fx = 0; - hBWE_TD->GainAttn_fx = 32767; - hBWE_TD->tbe_demph_fx = 0; - hBWE_TD->tbe_premph_fx = 0; - set_val_Word16( hBWE_TD->mem_stp_swb_fx, 0, LPC_SHB_ORDER ); - hBWE_TD->gain_prec_swb_fx = 16384; - set_val_Word16( hBWE_TD->GainShape_Delay_fx, 0, NUM_SHB_SUBFR / 2 ); - hBWE_TD->prev_pow_exc16kWhtnd_fx32 = 1; /* Q0 1.f */ - hBWE_TD->prev_mix_factor_fx = 32767; /*Q15 1.f*/ - set16_fx( hBWE_TD->old_core_synth_fx, 0, L_FRAME16k ); -#endif set_f( hBWE_TD->old_tbe_synth, 0, L_SHB_TRANSITION_LENGTH ); -#ifndef IVAS_FLOAT_FIXED hBWE_TD->tilt_swb_fec = 0.0f; -#endif -#ifdef IVAS_FLOAT_FIXED - hBWE_TD->tilt_swb_fec_fx = 0; -#endif return; } -#ifndef IVAS_FLOAT_FIXED + + /*-------------------------------------------------------------------* * wb_tbe_dec() * @@ -4744,56 +4662,33 @@ void TBEreset_dec( * * Initialize TD BWE state structure at the decoder *-------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void td_bwe_dec_init( TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ const int16_t extl, /* i : BWE extension layer */ const int32_t output_Fs /* i : output sampling rate */ ) - { int16_t i; /* init. SHB buffers */; -#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->old_bwe_exc, 0.0f, ( PIT16k_MAX * 2 ) ); -#endif -#ifdef IVAS_FLOAT_FIXED - set_val_Word16( hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); -#endif hBWE_TD->bwe_seed[0] = 23; /* 1; */ hBWE_TD->bwe_seed[1] = 59; /* 10000; */ set_f( hBWE_TD->old_bwe_exc_extended, 0.0f, NL_BUFF_OFFSET ); -#ifndef IVAS_FLOAT_FIXED hBWE_TD->bwe_non_lin_prev_scale = 0; - set_f(hBWE_TD->genSHBsynth_Hilbert_Mem, 0.0f, HILBERT_MEM_SIZE); - set_f(hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local, 0.0f, 2 * ALLPASSSECTIONS_STEEP); -#endif -#ifdef IVAS_FLOAT_FIXED - hBWE_TD->bwe_non_lin_prev_scale_fx = 0; - - set32_fx( hBWE_TD->genSHBsynth_Hilbert_Mem_fx, 0, HILBERT_MEM_SIZE ); - set16_fx( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, 0, 2 * ALLPASSSECTIONS_STEEP ); - set32_fx( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP ); -#endif + set_f( hBWE_TD->genSHBsynth_Hilbert_Mem, 0.0f, HILBERT_MEM_SIZE ); + set_f( hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local, 0.0f, 2 * ALLPASSSECTIONS_STEEP ); hBWE_TD->syn_dm_phase = 0; -#ifndef IVAS_FLOAT_FIXED hBWE_TD->prev_fbbwe_ratio = 1.0f; hBWE_TD->prev_wb_bwe_frame_pow = 0.001f; hBWE_TD->prev_swb_bwe_frame_pow = 0.001f; -#endif -#ifdef IVAS_FLOAT_FIXED - hBWE_TD->prev_fbbwe_ratio_fx = 32767/*1.0f Q15*/; - hBWE_TD->prev_wb_bwe_frame_pow_fx = 4194l/*0.001f Q22*/; - hBWE_TD->prev_swb_bwe_frame_pow_fx = 4194l/*0.001f Q22*/; -#endif /* reset SHB buffers */ ResetSHBbuffer_Dec( hBWE_TD, extl ); -#ifndef IVAS_FLOAT_FIXED if ( output_Fs == 48000 ) { set_f( hBWE_TD->fbbwe_hpf_mem[0], 0, 4 ); @@ -4801,41 +4696,17 @@ void td_bwe_dec_init( set_f( hBWE_TD->fbbwe_hpf_mem[2], 0, 4 ); set_f( hBWE_TD->fbbwe_hpf_mem[3], 0, 4 ); } -#endif -#ifdef IVAS_FLOAT_FIXED - IF(EQ_32(output_Fs, 48000)) - { - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[0], 0, 4); - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[1], 0, 4); - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[2], 0, 4); - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[3], 0, 4); - set16_fx(hBWE_TD->fbbwe_hpf_mem_fx_Q, 0, 4); - } -#endif set_f( hBWE_TD->mem_resamp_HB, 0, INTERP_3_1_MEM_LEN ); - set32_fx( hBWE_TD->mem_resamp_HB_fx_32, 0, INTERP_3_1_MEM_LEN ); set_f( hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); - set32_fx( hBWE_TD->mem_resamp_HB_32k_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); -#ifndef IVAS_FLOAT_FIXED hBWE_TD->tilt_mem = 0.0f; set_f( hBWE_TD->prev_lsf_diff, 0.5f, LPC_SHB_ORDER - 2 ); hBWE_TD->prev_tilt_para = 0.0f; set_f( hBWE_TD->cur_sub_Aq, 0.0f, M + 1 ); -#endif -#ifdef IVAS_FLOAT_FIXED - hBWE_TD->tilt_mem_fx = 0; - set16_fx(hBWE_TD->prev_lsf_diff_fx, 16384, LPC_SHB_ORDER - 2); - hBWE_TD->prev_tilt_para_fx = 0; - set16_fx(hBWE_TD->cur_sub_Aq_fx, 0, M + 1); -#endif - - set_f( hBWE_TD->int_3_over_2_tbemem_dec, 0.0f, INTERP_3_2_MEM_LEN ); /* TD BWE post-processing */ -#ifndef IVAS_FLOAT_FIXED hBWE_TD->ptr_mem_stp_swb = hBWE_TD->mem_stp_swb + LPC_SHB_ORDER - 1; set_f( hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); @@ -4850,114 +4721,15 @@ void td_bwe_dec_init( hBWE_TD->prev_res_shb_gshape = 0.125f; hBWE_TD->prev_mixFactors = 0.5f; hBWE_TD->prev_GainShape = 0.0f; - - set_f(hBWE_TD->fb_state_lpc_syn, 0, LPC_SHB_ORDER); + set_f( hBWE_TD->fb_state_lpc_syn, 0, LPC_SHB_ORDER ); hBWE_TD->fb_tbe_demph = 0.0f; - set_f(hBWE_TD->old_hb_synth, 0, L_FRAME48k); + + set_f( hBWE_TD->old_hb_synth, 0, L_FRAME48k ); hBWE_TD->GainFrame_prevfrm = 0.0f; hBWE_TD->prev_ener = 0.0f; -#endif -#ifdef IVAS_FLOAT_FIXED - hBWE_TD->ptr_mem_stp_swb_fx = hBWE_TD->mem_stp_swb_fx + LPC_SHB_ORDER - 1; - set16_fx( hBWE_TD->mem_zero_swb_fx, 0, LPC_SHB_ORDER ); - - FOR(i = 0; i < LPC_SHB_ORDER; i++) - { - hBWE_TD->swb_lsp_prev_interp_fx[i] = swb_lsp_prev_interp_init[i]; - move16(); - } - - hBWE_TD->prev1_shb_ener_sf_fx = 32767; - hBWE_TD->prev2_shb_ener_sf_fx = 32767; - hBWE_TD->prev3_shb_ener_sf_fx = 32767; - hBWE_TD->prev_res_shb_gshape_fx = 8192; - hBWE_TD->prev_mixFactors_fx = 16384; - hBWE_TD->prev_GainShape_fx = 0; - - set16_fx( hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER ); - hBWE_TD->fb_tbe_demph_fx = 0; - set16_fx( hBWE_TD->old_hb_synth_fx, 0, L_FRAME48k ); - - hBWE_TD->GainFrame_prevfrm_fx = 0; - - hBWE_TD->prev_ener_fx = 0; -#endif return; } - -#else - -void td_bwe_dec_init( - TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const int16_t extl, /* i : BWE extension layer */ - const int32_t output_Fs /* i : output sampling rate */ -) -{ - int16_t i; - - /* init. SHB buffers */; - set_f(hBWE_TD->old_bwe_exc, 0.0f, (PIT16k_MAX * 2)); - hBWE_TD->bwe_seed[0] = 23; /* 1; */ - hBWE_TD->bwe_seed[1] = 59; /* 10000; */ - set_f(hBWE_TD->old_bwe_exc_extended, 0.0f, NL_BUFF_OFFSET); - hBWE_TD->bwe_non_lin_prev_scale = 0; - - set_f(hBWE_TD->genSHBsynth_Hilbert_Mem, 0.0f, HILBERT_MEM_SIZE); - set_f(hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local, 0.0f, 2 * ALLPASSSECTIONS_STEEP); - - hBWE_TD->syn_dm_phase = 0; - hBWE_TD->prev_fbbwe_ratio = 1.0f; - hBWE_TD->prev_wb_bwe_frame_pow = 0.001f; - hBWE_TD->prev_swb_bwe_frame_pow = 0.001f; - - /* reset SHB buffers */ - ResetSHBbuffer_Dec(hBWE_TD, extl); - - if (output_Fs == 48000) - { - set_f(hBWE_TD->fbbwe_hpf_mem[0], 0, 4); - set_f(hBWE_TD->fbbwe_hpf_mem[1], 0, 4); - set_f(hBWE_TD->fbbwe_hpf_mem[2], 0, 4); - set_f(hBWE_TD->fbbwe_hpf_mem[3], 0, 4); - } - - set_f(hBWE_TD->mem_resamp_HB, 0, INTERP_3_1_MEM_LEN); - set_f(hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1); - - hBWE_TD->tilt_mem = 0.0f; - set_f(hBWE_TD->prev_lsf_diff, 0.5f, LPC_SHB_ORDER - 2); - hBWE_TD->prev_tilt_para = 0.0f; - set_f(hBWE_TD->cur_sub_Aq, 0.0f, M + 1); - set_f(hBWE_TD->int_3_over_2_tbemem_dec, 0.0f, INTERP_3_2_MEM_LEN); - - /* TD BWE post-processing */ - hBWE_TD->ptr_mem_stp_swb = hBWE_TD->mem_stp_swb + LPC_SHB_ORDER - 1; - set_f(hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER); - - for (i = 0; i < LPC_SHB_ORDER; i++) - { - hBWE_TD->swb_lsp_prev_interp[i] = (float)cos((float)i * EVS_PI / (float) 10.0f); - } - - hBWE_TD->prev1_shb_ener_sf = 1.0f; - hBWE_TD->prev2_shb_ener_sf = 1.0f; - hBWE_TD->prev3_shb_ener_sf = 1.0f; - hBWE_TD->prev_res_shb_gshape = 0.125f; - hBWE_TD->prev_mixFactors = 0.5f; - hBWE_TD->prev_GainShape = 0.0f; - set_f(hBWE_TD->fb_state_lpc_syn, 0, LPC_SHB_ORDER); - hBWE_TD->fb_tbe_demph = 0.0f; - - set_f(hBWE_TD->old_hb_synth, 0, L_FRAME48k); - - hBWE_TD->GainFrame_prevfrm = 0.0f; - - hBWE_TD->prev_ener = 0.0f; - - return; -} - #endif \ No newline at end of file diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 2f9f66ac5..6f7ef267f 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -520,7 +520,8 @@ void ResetSHBbuffer_Dec_fx( Decoder_State* st_fx /* i/o: SHB encoder structure * set16_fx(hBWE_TD->state_32and48k_WB_upsample_fx, 0, 2 * ALLPASSSECTIONS_STEEP ); /* States for the local synthesis filters */ - set16_fx(hBWE_TD->syn_overlap_fx, 0, L_SHB_LAHEAD ); + set16_fx( hBWE_TD->syn_overlap_fx, 0, L_SHB_LAHEAD ); + set32_fx( hBWE_TD->syn_overlap_fx_32, 0, L_SHB_LAHEAD ); /* States for FEC */ @@ -4950,6 +4951,7 @@ void TBEreset_dec_ivas_fx( set16_fx( hBWE_TD->state_lpc_syn_fx, 0, 10 ); set16_fx( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD / 4 ); set16_fx( hBWE_TD->syn_overlap_fx, 0, L_SHB_LAHEAD ); + set32_fx( hBWE_TD->syn_overlap_fx_32, 0, L_SHB_LAHEAD ); set32_fx( hBWE_TD->mem_csfilt_fx, 0, 2 ); } ELSE IF( EQ_16( st->bwidth, SWB ) || EQ_16( st->bwidth, FB ) ) @@ -4993,66 +4995,71 @@ void TBEreset_dec_ivas_fx( #ifdef IVAS_FLOAT_FIXED void td_bwe_dec_init_ivas_fx( - Decoder_State* st_fx, /* i/o: SHB decoder structure */ + Decoder_State *st_fx, /* i/o: SHB decoder structure */ TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ - const Word32 output_Fs /* i : output sampling rate */ + const Word32 output_Fs /* i : output sampling rate */ ) { - int16_t i; + Word16 i; /* init. SHB buffers */; - InitSWBdecBuffer_ivas_fx(st_fx); + InitSWBdecBuffer_ivas_fx( st_fx ); /* reset SHB buffers */ - ResetSHBbuffer_Dec_fx(st_fx); - IF(EQ_32(output_Fs, 48000)) + ResetSHBbuffer_Dec_fx( st_fx ); + IF( EQ_32( output_Fs, 48000 ) ) { - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[0], 0, 4); - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[1], 0, 4); - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[2], 0, 4); - set32_fx(hBWE_TD->fbbwe_hpf_mem_fx[3], 0, 4); - set16_fx(hBWE_TD->fbbwe_hpf_mem_fx_Q, 0, 4); + set32_fx( hBWE_TD->fbbwe_hpf_mem_fx[0], 0, 4 ); + set32_fx( hBWE_TD->fbbwe_hpf_mem_fx[1], 0, 4 ); + set32_fx( hBWE_TD->fbbwe_hpf_mem_fx[2], 0, 4 ); + set32_fx( hBWE_TD->fbbwe_hpf_mem_fx[3], 0, 4 ); + set16_fx( hBWE_TD->fbbwe_hpf_mem_fx_Q, 0, 4 ); } - set16_fx(hBWE_TD->mem_resamp_HB_fx, 0, INTERP_3_1_MEM_LEN); - set16_fx(hBWE_TD->mem_resamp_HB_32k_fx, 0, 2 * ALLPASSSECTIONS_STEEP + 1); - set16_fx(hBWE_TD->mem_resamp_HB_32k_fx, 0, 2 * ALLPASSSECTIONS_STEEP + 1); - set32_fx(hBWE_TD->mem_resamp_HB_32k_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP + 1); + set16_fx( hBWE_TD->mem_resamp_HB_fx, 0, INTERP_3_1_MEM_LEN ); + set32_fx( hBWE_TD->mem_resamp_HB_fx_32, 0, INTERP_3_1_MEM_LEN ); + set16_fx( hBWE_TD->mem_resamp_HB_32k_fx, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); + set32_fx( hBWE_TD->mem_resamp_HB_32k_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); hBWE_TD->tilt_mem_fx = 0; move16(); - set16_fx(hBWE_TD->prev_lsf_diff_fx, 16384, LPC_SHB_ORDER - 2); + set16_fx( hBWE_TD->prev_lsf_diff_fx, 16384, LPC_SHB_ORDER - 2 ); hBWE_TD->prev_tilt_para_fx = 0; move16(); - set16_fx(hBWE_TD->cur_sub_Aq_fx, 0, M + 1); - set16_fx(hBWE_TD->int_3_over_2_tbemem_dec_fx, 0, INTERP_3_2_MEM_LEN); - set32_fx(hBWE_TD->int_3_over_2_tbemem_dec_fx_32, 0, INTERP_3_2_MEM_LEN); + set16_fx( hBWE_TD->cur_sub_Aq_fx, 0, M + 1 ); + set16_fx( hBWE_TD->int_3_over_2_tbemem_dec_fx, 0, INTERP_3_2_MEM_LEN ); + set32_fx( hBWE_TD->int_3_over_2_tbemem_dec_fx_32, 0, INTERP_3_2_MEM_LEN ); /* TD BWE post-processing */ hBWE_TD->ptr_mem_stp_swb_fx = hBWE_TD->mem_stp_swb_fx + LPC_SHB_ORDER - 1; - set16_fx(hBWE_TD->mem_zero_swb_fx, 0, LPC_SHB_ORDER); + set16_fx( hBWE_TD->mem_zero_swb_fx, 0, LPC_SHB_ORDER ); - FOR(i = 0; i < LPC_SHB_ORDER; i++) + FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { hBWE_TD->swb_lsp_prev_interp_fx[i] = swb_lsp_prev_interp_init[i]; move16(); } - hBWE_TD->prev1_shb_ener_sf_fx = 32767; /* Q15*/ move16(); - hBWE_TD->prev2_shb_ener_sf_fx = 32767; /* Q15*/ move16(); - hBWE_TD->prev3_shb_ener_sf_fx = 32767; /* Q15*/ move16(); - hBWE_TD->prev_res_shb_gshape_fx = 8192; /* 0.125 in Q14*/ move16(); - hBWE_TD->prev_mixFactors_fx = 16384; /* 0.5 in Q15*/ move16(); + hBWE_TD->prev1_shb_ener_sf_fx = 32767; /* Q15*/ + move16(); + hBWE_TD->prev2_shb_ener_sf_fx = 32767; /* Q15*/ + move16(); + hBWE_TD->prev3_shb_ener_sf_fx = 32767; /* Q15*/ + move16(); + hBWE_TD->prev_res_shb_gshape_fx = 8192; /* 0.125 in Q14*/ + move16(); + hBWE_TD->prev_mixFactors_fx = 16384; /* 0.5 in Q15*/ + move16(); hBWE_TD->prev_GainShape_fx = 0; move16(); st_fx->prev_Q_bwe_exc_fb = 51; move16(); - set16_fx(hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER); + set16_fx( hBWE_TD->fb_state_lpc_syn_fx, 0, LPC_SHB_ORDER ); hBWE_TD->fb_tbe_demph_fx = 0; move16(); - set16_fx(hBWE_TD->old_hb_synth_fx, 0, L_FRAME48k); + set16_fx( hBWE_TD->old_hb_synth_fx, 0, L_FRAME48k ); - hBWE_TD->prev_ener_fx = L_deposit_l(0); + hBWE_TD->prev_ener_fx = L_deposit_l( 0 ); return; } diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 98b367a4b..a3b0db6a0 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -84,9 +84,9 @@ ivas_error TonalMDCTConceal_Init_ivas( hTonalMDCTConc->lastBlockData.blockIsConcealed = 0; hTonalMDCTConc->secondLastBlockData.blockIsConcealed = 0; - hTonalMDCTConc->pTCI = (TonalComponentsInfo *) hTonalMDCTConc->timeDataBuffer_float; #ifndef IVAS_FLOAT_FIXED + hTonalMDCTConc->pTCI = (TonalComponentsInfo *) hTonalMDCTConc->timeDataBuffer_float; hTonalMDCTConc->lastPitchLag_float = 0; #endif // #ifndef IVAS_FLOAT_FIXED @@ -112,7 +112,6 @@ ivas_error TonalMDCTConceal_Init_ivas( hTonalMDCTConc->last_block_nrg_flt = 0.0f; hTonalMDCTConc->curr_noise_nrg_flt = 0.0f; hTonalMDCTConc->faded_signal_nrg_flt = 0.0f; -#endif /* Offset the pointer to the end of buffer, so that pTCI is not destroyed when new time samples are stored in lastPcmOut */ /* just the second half of the second last pcm output is needed */ @@ -122,6 +121,7 @@ ivas_error TonalMDCTConceal_Init_ivas( /* If the second last frame was lost and concealed with tonal PLC, we reuse saved TonalComponentsInfo and don't update pcm buffers */ assert( sizeof( *hTonalMDCTConc->pTCI ) <= ( hTonalMDCTConc->lastPcmOut_float - hTonalMDCTConc->timeDataBuffer_float) * sizeof( hTonalMDCTConc->timeDataBuffer_float[0] ) ); +#endif return IVAS_ERR_OK; } @@ -1032,7 +1032,7 @@ void TonalMDCTConceal_Apply_ivas( return; } #endif - +#ifndef IVAS_FLOAT_FIXED void TonalMDCTConceal_SaveTimeSignal_ivas( TonalMDCTConcealPtr hTonalMDCTConc, float *timeSignal, @@ -1052,7 +1052,7 @@ void TonalMDCTConceal_SaveTimeSignal_ivas( return; } - +#endif #ifdef IVAS_FLOAT_FIXED void TonalMdctConceal_create_concealment_noise_ivas_fx( diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index e79dcd83c..5f29ce870 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -178,9 +178,9 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( move16(); hTonalMDCTConc->secondLastBlockData.blockIsConcealed = 0; move16(); - //hTonalMDCTConc->pTCI = (TonalComponentsInfo_fix *) hTonalMDCTConc->timeDataBuffer; + hTonalMDCTConc->pTCI = (TonalComponentsInfo *) hTonalMDCTConc->timeDataBuffer; - hTonalMDCTConc->pTCI = &hTonalMDCTConc->pTCI1; + //hTonalMDCTConc->pTCI = &hTonalMDCTConc->pTCI1; move16(); hTonalMDCTConc->lastPitchLag = L_deposit_l( 0 ); @@ -229,13 +229,7 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->secondLastPcmOut = &hTonalMDCTConc->timeDataBuffer[sub( ( 3 * L_FRAME_MAX ) / 2, imult1616(3 , shr(s_min( L_FRAME_MAX, nSamples ),1 ) ) )]; hTonalMDCTConc->lastPcmOut = &hTonalMDCTConc->timeDataBuffer[sub( ( 3 * L_FRAME_MAX ) / 2, s_min( L_FRAME_MAX, nSamples ) )]; /* If the second last frame was lost, we reuse saved TonalComponentsInfo and don't update pcm buffers */ -#if 1 - // TO do enable when only fix code is present currently disabled due to float array in structure - //assert( sizeof( *hTonalMDCTConc->pTCI ) <= ( hTonalMDCTConc->lastPcmOut - hTonalMDCTConc->timeDataBuffer ) * sizeof( hTonalMDCTConc->timeDataBuffer[0] ) ); - - /* TODO: remove float code*/ - assert( sizeof( *hTonalMDCTConc->pTCI ) <= ( hTonalMDCTConc->lastPcmOut_float - hTonalMDCTConc->timeDataBuffer_float ) * sizeof( hTonalMDCTConc->timeDataBuffer_float[0] ) ); -#endif + assert( sizeof( *hTonalMDCTConc->pTCI ) <= ( hTonalMDCTConc->lastPcmOut - hTonalMDCTConc->timeDataBuffer ) * sizeof( hTonalMDCTConc->timeDataBuffer[0] ) ); return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 4245124f7..6a5c50f8d 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2967,6 +2967,12 @@ void ivas_rend_closeCrend( hCrend->lfe_delay_line = NULL; } + if ( hCrend->lfe_delay_line_fx != NULL ) + { + free( hCrend->lfe_delay_line_fx); + hCrend->lfe_delay_line_fx = NULL; + } + if ( hCrend->freq_buffer_re_diffuse != NULL ) { free( hCrend->freq_buffer_re_diffuse ); diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index 631fd5f55..c9f493c2c 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -114,7 +114,7 @@ ivas_error ivas_dirac_ana_open( return error; } } - +#ifndef IVAS_FLOAT_FIXED /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { @@ -132,7 +132,7 @@ ivas_error ivas_dirac_ana_open( set_zero( hDirAC->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); } } -#ifdef IVAS_FLOAT_FIXED +#else for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { if ( ( hDirAC->direction_vector_m_fx[i] = (Word32 **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word32 * ) ) ) == NULL ) @@ -150,6 +150,7 @@ ivas_error ivas_dirac_ana_open( } } #endif +#ifndef IVAS_FLOAT_FIXED for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) @@ -161,7 +162,7 @@ ivas_error ivas_dirac_ana_open( set_zero( hDirAC->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); } } -#ifdef IVAS_FLOAT_FIXED +#else for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) @@ -175,7 +176,7 @@ ivas_error ivas_dirac_ana_open( } set_val_Word32( hDirAC->buffer_energy_fx, 0, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); #endif - set_zero( hDirAC->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); + //set_zero( hDirAC->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); hDirAC->index_buffer_intensity = 0; @@ -220,34 +221,36 @@ void ivas_dirac_ana_close( for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { +#ifndef IVAS_FLOAT_FIXED for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { free( ( *hDirAC )->direction_vector_m[i][j] ); ( *hDirAC )->direction_vector_m[i][j] = NULL; } -#ifdef IVAS_FLOAT_FIXED + free( ( *hDirAC )->direction_vector_m[i] ); + ( *hDirAC )->direction_vector_m[i] = NULL; +#else for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { free( ( *hDirAC )->direction_vector_m_fx[i][j] ); ( *hDirAC )->direction_vector_m_fx[i][j] = NULL; } + free( ( *hDirAC )->direction_vector_m_fx[i] ); + ( *hDirAC )->direction_vector_m_fx[i] = NULL; #endif +#ifndef IVAS_FLOAT_FIXED for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { free( ( *hDirAC )->buffer_intensity_real[i][j] ); ( *hDirAC )->buffer_intensity_real[i][j] = NULL; } -#ifdef IVAS_FLOAT_FIXED +#else for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { free( ( *hDirAC )->buffer_intensity_real_fx[i][j] ); ( *hDirAC )->buffer_intensity_real_fx[i][j] = NULL; } - free( ( *hDirAC )->direction_vector_m_fx[i] ); - ( *hDirAC )->direction_vector_m_fx[i] = NULL; #endif - free( ( *hDirAC )->direction_vector_m[i] ); - ( *hDirAC )->direction_vector_m[i] = NULL; } free( ( *hDirAC )->hMasaOut ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index dda58984b..2e3ea1d4b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -236,7 +236,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) { +#ifdef IVAS_FLOAT_FIXED + ivas_binaural_reverb_close_fx( &( hDiracDecBin->hReverb ) ); +#else ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); +#endif } if ( hDiracDecBin->hReverb == NULL ) @@ -532,8 +536,9 @@ void ivas_dirac_dec_close_binaural_data( IF ((*hBinaural)->hReverb != NULL) { +#ifdef IVAS_FLOAT_FIXED ivas_binaural_reverb_close_fx(&((*hBinaural)->hReverb)); -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#else ivas_binaural_reverb_close(&((*hBinaural)->hReverb)); #endif } diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 0f8aa9633..add5bd875 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -906,6 +906,7 @@ static void VectorRotationToQuaternion_fx( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_orient_trk_Init( ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { @@ -937,8 +938,7 @@ ivas_error ivas_orient_trk_Init( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_orient_trk_Init_fx( ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { @@ -957,8 +957,11 @@ ivas_error ivas_orient_trk_Init_fx( /* configuration parameters */ pOTR->centerAdaptationRate_fx = C_ADP_RATE_Q31; + move32(); pOTR->offCenterAdaptationRate_fx = OFF_C_ADP_RATE_Q31; + move32(); pOTR->adaptationAngle_fx = PI_OVER_4_Q29; /* Excursion angle relative to center at which maximum adaptation rate shall be applied */ + move32(); /* initial adaptivity filter coefficient, will be auto-adapted */ // pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ @@ -1299,6 +1302,7 @@ ivas_error ivas_orient_trk_SetReferenceVector_fx( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_orient_trk_Process( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION absRot, /* i : absolute head rotation */ @@ -1388,8 +1392,7 @@ ivas_error ivas_orient_trk_Process( return result; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_orient_trk_Process_fx( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION absRot, /* i : absolute head rotation */ @@ -1442,7 +1445,7 @@ ivas_error ivas_orient_trk_Process_fx( Word16 scale_e; Word32 div; - div = L_deposit_h( BASOP_Util_Divide3232_Scale( PI2_C_ADP_RATE_Q31, updateRate_fx, &scale_e ) ); + div = L_deposit_h( BASOP_Util_Divide3232_Scale( pOTR->centerAdaptationRate_fx, updateRate_fx, &scale_e ) ); scale_e = scale_e - 8; // e+e1-e2// // here div value is less so we can use sandwitch rule of sine// @@ -1463,7 +1466,7 @@ ivas_error ivas_orient_trk_Process_fx( QuaternionProduct_fx( pOTR->trkRot, absRot, &pOTR->trkRot ); angle_fx = QuaternionAngle_fx( absRot, pOTR->trkRot ); // Q29 Word16 result_e = 0; - Word16 temp_result = BASOP_Util_Divide3232_Scale( angle_fx, PI_OVER_4_Q29, &result_e ); + Word16 temp_result = BASOP_Util_Divide3232_Scale( angle_fx, pOTR->adaptationAngle_fx, &result_e ); relativeOrientationRate_fx = L_deposit_h( temp_result ); Word32 one_fx; Word16 temp = result_e; @@ -1474,8 +1477,7 @@ ivas_error ivas_orient_trk_Process_fx( } /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ - // rateRange_fx = L_sub(pOTR1_fx->offCenterAdaptationRate_fx, pOTR1_fx->centerAdaptationRate_fx); - rateRange_fx = L_sub( OFF_C_ADP_RATE_Q31, C_ADP_RATE_Q31 ); // repalce this with above line once calling functions are converted// + rateRange_fx = L_sub( pOTR->offCenterAdaptationRate_fx, pOTR->centerAdaptationRate_fx ); /* 'if' assumed to perform comparison to 0 */ IF( GT_32( 0, rateRange_fx ) ) { @@ -1495,7 +1497,7 @@ ivas_error ivas_orient_trk_Process_fx( temp_diff = 31 - q_cutoff_prod; cutoff_prod = L_shl( cutoff_prod, temp_diff ); /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ - cutoffFrequency_fx = L_add( C_ADP_RATE_Q31, cutoff_prod ); + cutoffFrequency_fx = L_add( pOTR->centerAdaptationRate_fx, cutoff_prod ); cutoff_prod = Mpy_32_32( cutoffFrequency_fx, PI2_C_Q28 ); q_cutoff_prod = 31 + 28 - 31; temp_result = BASOP_Util_Divide3232_Scale( cutoff_prod, updateRate_fx, &result_e ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index bb95f0b38..866bd05a5 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -2120,9 +2120,15 @@ ivas_error ivas_er_process( * Rotation Prototypes *-----------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_headTrack_open_fx( + HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ +); +#else ivas_error ivas_headTrack_open( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ ); +#endif void ivas_headTrack_close( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index cbf9fe390..d95009101 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -223,19 +223,20 @@ static uint16_t binRend_rand( return (uint16_t) ( hReverb->binRend_RandNext / 65536 ) % 32768; } -#ifdef IVAS_FLOAT_FIXED + /*------------------------------------------------------------------------- * ivas_binaural_reverb_setPreDelay() * * *------------------------------------------------------------------------*/ -static void ivas_binaural_reverb_setPreDelay( +#ifdef IVAS_FLOAT_FIXED +static void ivas_binaural_reverb_setPreDelay_fx( REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ const Word16 delaySamples /* i : reverb pre-delay in CLDFB slots */ ) { - IF ( LT_16( delaySamples, 1 ) ) + IF( LT_16( delaySamples, 1 ) ) { hReverb->preDelayBufferLength = 1; move16(); @@ -243,7 +244,7 @@ static void ivas_binaural_reverb_setPreDelay( return; } - IF ( GT_16( delaySamples, REVERB_PREDELAY_MAX ) ) + IF( GT_16( delaySamples, REVERB_PREDELAY_MAX ) ) { hReverb->preDelayBufferLength = REVERB_PREDELAY_MAX; move16(); @@ -257,12 +258,6 @@ static void ivas_binaural_reverb_setPreDelay( return; } #else -/*------------------------------------------------------------------------- - * ivas_binaural_reverb_setPreDelay() - * - * - *------------------------------------------------------------------------*/ - static void ivas_binaural_reverb_setPreDelay( REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ const int16_t delaySamples /* i : reverb pre-delay in CLDFB slots */ @@ -288,6 +283,7 @@ static void ivas_binaural_reverb_setPreDelay( } #endif + /*------------------------------------------------------------------------- * ivas_binaural_reverb_setReverbTimes() * @@ -3778,11 +3774,12 @@ static ivas_error ivas_binaural_reverb_open( for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) { +#ifndef IVAS_FLOAT_FIXED set_f( hReverb->preDelayBufferReal[k], 0.0f, hReverb->numBins ); set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); -#ifdef IVAS_FLOAT_FIXED - set_l( hReverb->preDelayBufferReal_fx[k], 0, hReverb->numBins ); - set_l( hReverb->preDelayBufferImag_fx[k], 0, hReverb->numBins ); +#else + set32_fx( hReverb->preDelayBufferReal_fx[k], 0, hReverb->numBins ); + set32_fx( hReverb->preDelayBufferImag_fx[k], 0, hReverb->numBins ); #endif } @@ -3792,6 +3789,7 @@ static ivas_error ivas_binaural_reverb_open( hReverb->loopBufLengthMax[bin] = (int16_t) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); len = hReverb->loopBufLengthMax[bin] + hReverb->blockSize; +#ifndef IVAS_FLOAT_FIXED if ( ( hReverb->loopBufReal[bin] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); @@ -3803,7 +3801,7 @@ static ivas_error ivas_binaural_reverb_open( } set_f( hReverb->loopBufReal[bin], 0.0f, len ); set_f( hReverb->loopBufImag[bin], 0.0f, len ); -#ifdef IVAS_FLOAT_FIXED +#else if ( ( hReverb->loopBufReal_fx[bin] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); @@ -3813,8 +3811,8 @@ static ivas_error ivas_binaural_reverb_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } - set_l( hReverb->loopBufReal_fx[bin], 0, len ); - set_l( hReverb->loopBufImag_fx[bin], 0, len ); + set32_fx( hReverb->loopBufReal_fx[bin], 0, len ); + set32_fx( hReverb->loopBufImag_fx[bin], 0, len ); #endif /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long @@ -3867,8 +3865,8 @@ static ivas_error ivas_binaural_reverb_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } - set_l( hReverb->outputBufferReal_fx[bin][chIdx], 0, len ); - set_l( hReverb->outputBufferImag_fx[bin][chIdx], 0, len ); + set32_fx( hReverb->outputBufferReal_fx[bin][chIdx], 0, len ); + set32_fx( hReverb->outputBufferImag_fx[bin][chIdx], 0, len ); #else if ( ( hReverb->outputBufferReal[bin][chIdx] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) { @@ -3895,20 +3893,17 @@ static ivas_error ivas_binaural_reverb_open( } ivas_binaural_reverb_setReverbTimes_fx( hReverb, sampling_rate, revTimes_fx, revEnes_fx ); - FOR( bin = 0; bin < hReverb->numBins; bin++) - { - hReverb->binauralCoherenceDirectGains[bin] = (float)hReverb->binauralCoherenceDirectGains_fx[bin] / ONE_IN_Q31; - hReverb->binauralCoherenceCrossmixGains[bin] = (float)hReverb->binauralCoherenceCrossmixGains_fx[bin] / ONE_IN_Q31; - hReverb->loopAttenuationFactor[bin] = (float)hReverb->loopAttenuationFactor_fx[bin] / ONE_IN_Q31; - hReverb->reverbEqGains[bin] = (float)hReverb->reverbEqGains_fx[bin] / ONE_IN_Q31; - } free(revTimes_fx); free(revEnes_fx); #else ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, revTimes, revEnes ); #endif +#ifdef IVAS_FLOAT_FIXED + ivas_binaural_reverb_setPreDelay_fx( hReverb, preDelay ); +#else ivas_binaural_reverb_setPreDelay( hReverb, preDelay ); +#endif return IVAS_ERR_OK; } @@ -4023,6 +4018,7 @@ void ivas_binaural_reverb_close_fx( { Word16 bin, chIdx; + test(); IF( hReverb == NULL || *hReverb == NULL ) { return; @@ -4033,7 +4029,6 @@ void ivas_binaural_reverb_close_fx( FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { free( ( *hReverb )->tapPhaseShiftType[bin][chIdx] ); - free( ( *hReverb )->tapPointersReal_fx[bin][chIdx] ); free( ( *hReverb )->tapPointersImag_fx[bin][chIdx] ); free( ( *hReverb )->outputBufferReal_fx[bin][chIdx] ); @@ -4048,27 +4043,25 @@ void ivas_binaural_reverb_close_fx( return; } -#endif +#else void ivas_binaural_reverb_close( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ) { - Word16 bin, chIdx; + int16_t bin, chIdx; - IF( hReverb == NULL || *hReverb == NULL ) + if ( hReverb == NULL || *hReverb == NULL ) { return; } - FOR( bin = 0; bin < ( *hReverb )->numBins; bin++ ) + for ( bin = 0; bin < ( *hReverb )->numBins; bin++ ) { - FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { free( ( *hReverb )->tapPhaseShiftType[bin][chIdx] ); -#ifndef IVAS_FLOAT_FIXED free( ( *hReverb )->tapPointersReal[bin][chIdx] ); free( ( *hReverb )->tapPointersImag[bin][chIdx] ); -#endif free( ( *hReverb )->outputBufferReal[bin][chIdx] ); free( ( *hReverb )->outputBufferImag[bin][chIdx] ); } @@ -4081,3 +4074,4 @@ void ivas_binaural_reverb_close( return; } +#endif diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index bff2bd7ce..eaba2d206 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -1513,7 +1513,7 @@ const float ls_conversion_cicpX_stereo[12][2] = {0.849999964f, 0.000000000f}, {0.000000000f, 0.849999964f} }; - +#ifndef IVAS_FLOAT_FIXED const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp6[] = { /* First row indicates the number of non-zero elements and the number of matrix columns */ @@ -1828,5 +1828,5 @@ const LS_CONVERSION_MAPPING ls_conversion_mapping[LS_SETUP_CONVERSION_NUM_MAPPIN {IVAS_AUDIO_CONFIG_5_1_4, IVAS_AUDIO_CONFIG_7_1_4, ls_conversion_cicp16_cicp19}, }; - +#endif /* clang-format on */ diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index 6c2831c63..7ffcb441e 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -186,8 +186,9 @@ extern const Word32 ls_conversion_cicpX_stereo_fx[12][2]; #endif /* Mapping table of input config : output config with corresponding matrix */ +#ifndef IVAS_FLOAT_FIXED extern const LS_CONVERSION_MAPPING ls_conversion_mapping[]; -#ifdef IVAS_FLOAT_FIXED +#else extern const LS_CONVERSION_MAPPING_FX ls_conversion_mapping_fx[]; #endif diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 7d36ca793..ca299c1e1 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -108,41 +108,80 @@ static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IV * Allocate and initialize Head-Tracking handle *-----------------------------------------------------------------------*/ -ivas_error ivas_headTrack_open( +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_headTrack_open_fx( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ ) { - int16_t i; + Word16 i; ivas_error error; /* Allocate Head-Tracking handle */ - if ( ( *hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL ) + IF( ( *hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for head-tracking memory\n" ) ); } /* Initialization */ - ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f; + ( *hHeadTrackData )->lrSwitchInterpVal_fx = 0; + move32(); ( *hHeadTrackData )->lrSwitchedCurrent = 0; + move32(); ( *hHeadTrackData )->lrSwitchedNext = 0; - if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + move32(); + IF( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); } -#ifdef IVAS_FLOAT_FIXED - - if ( ( error = ivas_orient_trk_Init_fx( ( *hHeadTrackData )->OrientationTracker ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_orient_trk_Init_fx( ( *hHeadTrackData )->OrientationTracker ) ) != IVAS_ERR_OK ) { return error; } + /* Initialise Rmat_prev to I, Rmat will be computed later */ + FOR( i = 0; i < 3; i++ ) + { + set32_fx( ( *hHeadTrackData )->Rmat_prev_fx[i], 0, 3 ); + ( *hHeadTrackData )->Rmat_prev_fx[i][i] = ONE_IN_Q31; + move32(); + } + + + set32_fx( ( *hHeadTrackData )->chEneIIR_fx[0], 0, MASA_FREQUENCY_BANDS ); + set32_fx( ( *hHeadTrackData )->chEneIIR_fx[1], 0, MASA_FREQUENCY_BANDS ); + set32_fx( ( *hHeadTrackData )->procChEneIIR_fx[0], 0, MASA_FREQUENCY_BANDS ); + set32_fx( ( *hHeadTrackData )->procChEneIIR_fx[1], 0, MASA_FREQUENCY_BANDS ); + + return IVAS_ERR_OK; +} #else +ivas_error ivas_headTrack_open( + HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ +) +{ + int16_t i; + ivas_error error; + + /* Allocate Head-Tracking handle */ + if ( ( *hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for head-tracking memory\n" ) ); + } + + /* Initialization */ + ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f; + ( *hHeadTrackData )->lrSwitchedCurrent = 0; + ( *hHeadTrackData )->lrSwitchedNext = 0; + if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); + } + if ( ( error = ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ) ) != IVAS_ERR_OK ) { return error; } -#endif /* Initialise Rmat_prev to I, Rmat will be computed later */ for ( i = 0; i < 3; i++ ) @@ -159,6 +198,7 @@ ivas_error ivas_headTrack_open( return IVAS_ERR_OK; } +#endif /*-----------------------------------------------------------------------* diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index f8e577f69..d266aecfe 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -731,14 +731,13 @@ typedef struct vbap_data_structure /* Binaural reverberator structure */ typedef struct ivas_binaural_reverb_struct { +#ifndef IVAS_FLOAT_FIXED float *loopBufReal[CLDFB_NO_CHANNELS_MAX]; float *loopBufImag[CLDFB_NO_CHANNELS_MAX]; float preDelayBufferReal[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; float preDelayBufferImag[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; -#ifndef IVAS_FLOAT_FIXED float **tapPointersReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; float **tapPointersImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; -#endif float binauralCoherenceCrossmixGains[CLDFB_NO_CHANNELS_MAX]; float binauralCoherenceDirectGains[CLDFB_NO_CHANNELS_MAX]; @@ -747,8 +746,7 @@ typedef struct ivas_binaural_reverb_struct float *outputBufferReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; float *outputBufferImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - -#ifdef IVAS_FLOAT_FIXED +#else Word32 *loopBufReal_fx[CLDFB_NO_CHANNELS_MAX]; Word32 *loopBufImag_fx[CLDFB_NO_CHANNELS_MAX]; Word32 preDelayBufferReal_fx[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; @@ -756,28 +754,28 @@ typedef struct ivas_binaural_reverb_struct Word32 **tapPointersReal_fx[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; Word32 **tapPointersImag_fx[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - Word32 binauralCoherenceCrossmixGains_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 binauralCoherenceDirectGains_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 reverbEqGains_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 loopAttenuationFactor_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 binauralCoherenceCrossmixGains_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ + Word32 binauralCoherenceDirectGains_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ + Word32 reverbEqGains_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ + Word32 loopAttenuationFactor_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ Word32 *outputBufferReal_fx[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; Word32 *outputBufferImag_fx[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; #endif - int16_t numBins; + Word16 numBins; - int16_t useBinauralCoherence; - int16_t loopBufLength[CLDFB_NO_CHANNELS_MAX]; - int16_t loopBufLengthMax[CLDFB_NO_CHANNELS_MAX]; - int16_t preDelayBufferIndex; - int16_t preDelayBufferLength; + Word16 useBinauralCoherence; + Word16 loopBufLength[CLDFB_NO_CHANNELS_MAX]; + Word16 loopBufLengthMax[CLDFB_NO_CHANNELS_MAX]; + Word16 preDelayBufferIndex; + Word16 preDelayBufferLength; - int16_t taps[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - int16_t *tapPhaseShiftType[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + Word16 taps[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + Word16 *tapPhaseShiftType[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - int16_t blockSize; - uint32_t binRend_RandNext; - int16_t highestBinauralCoherenceBin; + Word16 blockSize; + UWord32 binRend_RandNext; + Word16 highestBinauralCoherenceBin; #ifndef IVAS_FLOAT_FIXED float dmxmtx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; @@ -995,67 +993,71 @@ typedef struct EFAP typedef struct ivas_orient_trk_state_t { IVAS_HEAD_ORIENT_TRK_T orientation_tracking; +#ifndef IVAS_FLOAT_FIXED float centerAdaptationRate; float offCenterAdaptationRate; float adaptationAngle; +#endif float alpha; - IVAS_QUATERNION absAvgRot; /* average absolute orientation */ - IVAS_QUATERNION refRot; /* reference orientation */ - IVAS_QUATERNION trkRot; /* tracked rotation */ - #ifdef IVAS_FLOAT_FIXED - Word32 centerAdaptationRate_fx; - Word32 offCenterAdaptationRate_fx; - Word32 adaptationAngle_fx; + Word32 centerAdaptationRate_fx; /* Q31 */ + Word32 offCenterAdaptationRate_fx; /* Q31 */ + Word32 adaptationAngle_fx; /* Q29 */ +#endif Word32 alpha_fx; -#endif + IVAS_QUATERNION absAvgRot; /* average absolute orientation */ + IVAS_QUATERNION refRot; /* reference orientation */ + IVAS_QUATERNION trkRot; /* tracked rotation */ } ivas_orient_trk_state_t; /*----------------------------------------------------------------------------------* * Head rotation data structure *----------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED + typedef struct { Word8 headRotEnabled; IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; #ifdef IVAS_FLOAT_FIXED - Word32 crossfade_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; -#endif - float crossfade[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - ivas_orient_trk_state_t *hOrientationTracker; - -} IVAS_REND_HeadRotData; + Word32 crossfade_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; /* Q31 */ #else -typedef struct -{ - int8_t headRotEnabled; - IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES]; - IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; float crossfade[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; +#endif ivas_orient_trk_state_t *hOrientationTracker; } IVAS_REND_HeadRotData; -#endif + typedef struct ivas_binaural_head_track_struct { IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifndef IVAS_FLOAT_FIXED float Rmat[3][3]; float Rmat_prev[3][3]; +#else + Word32 Rmat_fx[3][3]; + Word32 Rmat_prev_fx[3][3]; +#endif - uint8_t lrSwitchedNext; - uint8_t lrSwitchedCurrent; + UWord8 lrSwitchedNext; + UWord8 lrSwitchedCurrent; +#ifndef IVAS_FLOAT_FIXED float lrSwitchInterpVal; float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ float procChEneIIR[2][MASA_FREQUENCY_BANDS]; +#else + Word32 lrSwitchInterpVal_fx; - int16_t shd_rot_max_order; + Word32 chEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ + Word32 procChEneIIR_fx[2][MASA_FREQUENCY_BANDS]; +#endif + + Word16 shd_rot_max_order; ivas_orient_trk_state_t *OrientationTracker; } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; @@ -2066,12 +2068,21 @@ typedef struct typedef struct ivas_LS_setupconversion_struct { +#ifndef IVAS_FLOAT_FIXED float *dmxMtx[MAX_OUTPUT_CHANNELS]; +#else Word32 *dmxMtx_fx[MAX_OUTPUT_CHANNELS]; // Q30 +#endif +#ifndef IVAS_FLOAT_FIXED float *targetEnergyPrev[MAX_OUTPUT_CHANNELS]; +#else Word32 *targetEnergyPrev_fx[MAX_OUTPUT_CHANNELS]; +#endif +#ifndef IVAS_FLOAT_FIXED float *dmxEnergyPrev[MAX_OUTPUT_CHANNELS]; +#else Word32 *dmxEnergyPrev_fx[MAX_OUTPUT_CHANNELS]; +#endif int16_t sfbOffset[MAX_SFB + 2]; int16_t sfbCnt; #ifdef IVAS_FLOAT_FIXED @@ -2094,7 +2105,7 @@ typedef struct ivas_LS_setupconversion_mapping_fx AUDIO_CONFIG output_config; const LS_CONVERSION_MATRIX_FX *conversion_matrix_fx; } LS_CONVERSION_MAPPING_FX; -#endif +#else typedef struct ivas_LS_setupconversion_matrix { @@ -2108,17 +2119,17 @@ typedef struct ivas_LS_setupconversion_mapping AUDIO_CONFIG output_config; const LS_CONVERSION_MATRIX *conversion_matrix; } LS_CONVERSION_MAPPING; - +#endif typedef struct ivas_mono_downmix_renderer_struct { +#ifndef IVAS_FLOAT_FIXED float inputEnergy; float protoEnergy; -#ifdef IVAS_FLOAT_FIXED +#else Word32 inputEnergy_fx; Word16 Q_inputEner; Word32 protoEnergy_fx; Word16 Q_protoEner; - #endif } MONO_DOWNMIX_RENDERER_STRUCT, *MONO_DOWNMIX_RENDERER_HANDLE; @@ -2139,7 +2150,6 @@ typedef struct ivas_LS_setup_custom Word16 num_lfe; /* number of LFE channels */ Word16 lfe_idx[MAX_OUTPUT_CHANNELS]; /* index for LFE channel insertion */ Word16 separate_ch_found; /* flag to indicate if a center channel was found */ - float separate_ch_gains[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */ Word16 separate_ch_gains_fx[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */ } LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; @@ -2288,17 +2298,26 @@ typedef struct ivas_dirac_ana_data_structure HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[DIRAC_MAX_ANA_CHANS]; /* DirAC parameter estimation */ +#ifndef IVAS_FLOAT_FIXED float **direction_vector_m[DIRAC_NUM_DIMS]; /* Average direction vector */ +#else Word32 **direction_vector_m_fx[DIRAC_NUM_DIMS]; /* Average direction vector */ +#endif int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; int16_t block_grouping[5]; /* diffuseness */ int16_t index_buffer_intensity; +#ifndef IVAS_FLOAT_FIXED float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; +#else Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; +#endif +#ifndef IVAS_FLOAT_FIXED float buffer_energy[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; +#else Word32 buffer_energy_fx[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; +#endif MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8ecc530fe..dbbdbd13f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -464,6 +464,32 @@ static void freeMcLfeDelayBuffer( return; } +#ifdef IVAS_FLOAT_FIXED +static IVAS_QUATERNION quaternionInit_fx( + void ) +{ + IVAS_QUATERNION q; + q.w_fx = ONE_IN_Q29; + move32(); + q.x_fx = q.y_fx = q.z_fx = 0; + move32(); + move32(); + move32(); + + q.w_qfact = q.x_qfact = q.y_qfact = q.z_qfact = Q29; + move16(); + move16(); + move16(); + move16(); + +#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED + q.w = 1.0f; + q.x = q.y = q.z = 0.0f; +#endif + + return q; +} +#else static IVAS_QUATERNION quaternionInit( void ) { @@ -472,6 +498,8 @@ static IVAS_QUATERNION quaternionInit( q.x = q.y = q.z = 0.0f; return q; } +#endif + #ifdef IVAS_FLOAT_FIXED static Word32 *getSmplPtr_fx( IVAS_REND_AudioBuffer buffer, @@ -1090,7 +1118,7 @@ static LSSETUP_CUSTOM_STRUCT defaultCustomLs( ls.num_lfe = 0; set_s( ls.lfe_idx, 0, MAX_OUTPUT_CHANNELS ); ls.separate_ch_found = 0; - set_f( ls.separate_ch_gains, 0, MAX_OUTPUT_CHANNELS ); + set_val_Word16( ls.separate_ch_gains_fx, 0, MAX_OUTPUT_CHANNELS ); return ls; } @@ -1742,12 +1770,11 @@ static ivas_error getEfapGains( } #ifdef IVAS_FLOAT_FIXED -static ivas_error initHeadRotation( +static ivas_error initHeadRotation_fx( IVAS_REND_HANDLE hIvasRend ) { Word16 i, crossfade_len; Word32 tmp_fx; - float tmp; ivas_error error; /* Head rotation is enabled by default */ @@ -1755,19 +1782,20 @@ static ivas_error initHeadRotation( /* Initialize 5ms crossfade */ crossfade_len = L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES; - tmp = 1.f / ( crossfade_len - 1 ); + move16(); tmp_fx = Q31_BY_SUB_FRAME_240; + move16(); - for ( i = 0; i < crossfade_len; i++ ) + FOR( i = 0; i < crossfade_len; i++ ) { - hIvasRend->headRotData.crossfade[i] = i * tmp; hIvasRend->headRotData.crossfade_fx[i] = UL_Mpy_32_32( i, tmp_fx ); + move32(); } /* Initialize with unit quaternions */ FOR( i = 0; i < hIvasRend->num_subframes; ++i ) { - hIvasRend->headRotData.headPositions[i] = quaternionInit(); + hIvasRend->headRotData.headPositions[i] = quaternionInit_fx(); } @@ -1776,17 +1804,10 @@ static ivas_error initHeadRotation( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); } -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_orient_trk_Init_fx( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) { return error; } -#else - IF( ( error = ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif return IVAS_ERR_OK; } @@ -2240,7 +2261,7 @@ static void copyLsConversionMatrixToPanMatrix_fx( return; } -#endif +#else static void copyLsConversionMatrixToPanMatrix( const LS_CONVERSION_MATRIX *lsConvMatrix, @@ -2265,7 +2286,7 @@ static void copyLsConversionMatrixToPanMatrix( return; } - +#endif static void setZeroPanMatrix( pan_matrix panMatrix ) { @@ -2373,7 +2394,7 @@ static ivas_error initMcPanGainsWithConversionMapping_fx( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Missing multichannel conversion mapping" ); } -#endif +#else static ivas_error initMcPanGainsWithConversionMapping( input_mc *inputMc, @@ -2408,6 +2429,7 @@ static ivas_error initMcPanGainsWithConversionMapping( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Missing multichannel conversion mapping" ); } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithEfap_fx( input_mc *inputMc, @@ -4620,7 +4642,7 @@ ivas_error IVAS_REND_Open( } /* Initialize headrotation data */ - if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) + IF( ( error = initHeadRotation_fx( hIvasRend ) ) != IVAS_ERR_OK ) { return error; } @@ -6742,6 +6764,8 @@ static void renderBufferChannel( return; } + +#ifndef IVAS_FLOAT_FIXED static ivas_error chooseCrossfade( const IVAS_REND_HeadRotData *headRotData, const float **pCrossfade ) @@ -6750,17 +6774,19 @@ static ivas_error chooseCrossfade( return IVAS_ERR_OK; } -#ifdef IVAS_FLOAT_FIXED +#else static ivas_error chooseCrossfade_fx( const IVAS_REND_HeadRotData *headRotData, const Word32 **pCrossfade ) { *pCrossfade = headRotData->crossfade_fx; + move32(); return IVAS_ERR_OK; } - #endif + + #ifdef IVAS_FLOAT_FIXED static ivas_error rotateFrameMc_fx( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ @@ -6917,8 +6943,7 @@ static ivas_error rotateFrameMc_fx( pop_wmops(); return IVAS_ERR_OK; } -#endif - +#else static ivas_error rotateFrameMc( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ AUDIO_CONFIG inConfig, /* i : Input Audio config */ @@ -7061,9 +7086,10 @@ static ivas_error rotateFrameMc( pop_wmops(); return IVAS_ERR_OK; } +#endif -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED static ivas_error rotateFrameSba_fx( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ const AUDIO_CONFIG inConfig, /* i : Input Audio config */ @@ -7298,6 +7324,7 @@ static ivas_error rotateFrameSba( #endif + static ivas_error renderIsmToBinaural( const input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -11266,7 +11293,11 @@ static void freeMasaExtRenderer( if ( hMasaExtRend->hReverb != NULL ) { +#ifdef IVAS_FLOAT_FIXED + ivas_binaural_reverb_close_fx( &hMasaExtRend->hReverb ); +#else ivas_binaural_reverb_close( &hMasaExtRend->hReverb ); +#endif } if ( hMasaExtRend->hHrtfParambin != NULL ) -- GitLab From 87d67fd32147aff81409714d52b3b4f16bb6cef3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sun, 5 May 2024 12:12:40 +0530 Subject: [PATCH 011/101] ivas_param_mc_dec_render fixed conversion [x] mc2sba function integration [x] param_mc_protosignal_computation in fixed [x] dirac_dec_decorr_process in fixed --- lib_com/ivas_prot.h | 18 + lib_dec/ivas_dirac_output_synthesis_cov.c | 175 ++++++- lib_dec/ivas_jbm_dec.c | 57 ++- lib_dec/ivas_mc_param_dec.c | 271 +++++++++- lib_dec/ivas_sba_rendering_internal.c | 4 +- lib_dec/ivas_stat_dec.h | 10 +- lib_rend/ivas_dirac_decorr_dec.c | 1 + lib_rend/ivas_orient_trk.c | 15 +- lib_rend/ivas_render_config.c | 33 ++ lib_rend/ivas_rotation.c | 36 ++ lib_rend/ivas_stat_rend.h | 3 +- lib_rend/lib_rend.c | 584 ++++++++++++++++++---- lib_rend/lib_rend.h | 7 + 13 files changed, 1073 insertions(+), 141 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 52fd2480c..4341c8900 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4985,6 +4985,24 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( + Word32 *Cldfb_RealBuffer_in_fx, + Word32 *Cldfb_ImagBuffer_in_fx, + Word32 Cldfb_RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ + Word32 Cldfb_ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ + Word32 *mixing_matrix_fx[], /* i : parameter band wise mixing matrices (direct part) */ + Word16 *mixing_matrix_e, /* i : parameter band wise mixing matrices (direct part) */ + Word32 *mixing_matrix_res_fx[], /* i : parameter band wise mixing matrices (residual part) */ + Word16 *mixing_matrix_res_e, /* i : parameter band wise mixing matrices (residual part) */ + const UWord16 slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const UWord16 slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const Word16 nX, /* i : number of input channels */ + const Word16 nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ +); +#endif + int16_t computeMixingMatricesISM( const int16_t num_inputs, const int16_t num_responses, diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index c6d48cc4d..a4b34f908 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -146,7 +146,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx] = NULL; } - if ((h_dirac_output_synthesis_state->cx_old_e = (Word16 *)malloc(CLDFB_NO_CHANNELS_MAX * sizeof(Word16))) == NULL) + if ((h_dirac_output_synthesis_state->cx_old_e = (Word16 *)malloc(CLDFB_NO_CHANNELS_MAX * sizeof(Word16))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n")); } @@ -155,8 +155,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n")); } - set16_fx(h_dirac_output_synthesis_state->cx_old_e, 0, CLDFB_NO_CHANNELS_MAX); - set16_fx(h_dirac_output_synthesis_state->cy_old_e, 0, CLDFB_NO_CHANNELS_MAX); + set16_fx(h_dirac_output_synthesis_state->cx_old_e, 0, CLDFB_NO_CHANNELS_MAX); + set16_fx(h_dirac_output_synthesis_state->cy_old_e, 0, CLDFB_NO_CHANNELS_MAX); if ((h_dirac_output_synthesis_state->mixing_matrix_res_exp = (Word16 *)malloc(CLDFB_NO_CHANNELS_MAX * sizeof(Word16))) == NULL) { @@ -1136,7 +1136,176 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( return; } +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( + Word32 *Cldfb_RealBuffer_in_fx, + Word32 *Cldfb_ImagBuffer_in_fx, + Word32 Cldfb_RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ + Word32 Cldfb_ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ + Word32 *mixing_matrix_fx[], /* i : parameter band wise mixing matrices (direct part) */ + Word16 *mixing_matrix_e, /* i : parameter band wise mixing matrices (direct part) */ + Word32 *mixing_matrix_res_fx[], /* i : parameter band wise mixing matrices (residual part) */ + Word16 *mixing_matrix_res_e, /* i : parameter band wise mixing matrices (residual part) */ + const UWord16 slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const UWord16 slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const Word16 nX, /* i : number of input channels */ + const Word16 nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ +) +{ + Word16 param_band_idx, band, ch_idx; + Word16 have_residual; + Word16 brange[2]; + DIRAC_OUTPUT_SYNTHESIS_COV_STATE h_synthesis_state = hParamMC->h_output_synthesis_cov_state; + + Word32 mixing_matrix_smooth_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word16 mixing_matrix_smooth_e; + Word32 mixing_matrix_res_smooth_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word16 mixing_matrix_res_smooth_e; + Word32 mixing_matrix_buffer_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word16 mixing_matrix_buffer_e; + Word32 input_f_real_fx[PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 input_f_imag_fx[PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 output_f_real_fx[MAX_CICP_CHANNELS]; + Word32 output_f_imag_fx[MAX_CICP_CHANNELS]; + Word16 output_f_real_e; + Word16 output_f_imag_e; + Word32 diff_f_real_fx[MAX_CICP_CHANNELS]; + Word32 diff_f_imag_fx[MAX_CICP_CHANNELS]; + Word16 diff_f_real_e; + Word16 diff_f_imag_e; + + set_zero_fx( input_f_real_fx, PARAM_MC_MAX_TRANSPORT_CHANS ); + set_zero_fx( input_f_imag_fx, PARAM_MC_MAX_TRANSPORT_CHANS ); + set_zero_fx( output_f_real_fx, MAX_CICP_CHANNELS ); + set_zero_fx( output_f_imag_fx, MAX_CICP_CHANNELS ); + set_zero_fx( diff_f_real_fx, MAX_CICP_CHANNELS ); + set_zero_fx( diff_f_imag_fx, MAX_CICP_CHANNELS ); + + FOR ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) + { + /* final mixing */ + have_residual = 0; + move16(); + brange[0] = hParamMC->band_grouping[param_band_idx]; + move16(); + brange[1] = hParamMC->band_grouping[param_band_idx + 1]; + move16(); + + IF ( brange[0] < hParamMC->h_output_synthesis_params.max_band_decorr ) + { + have_residual = 1; + move16(); + } + + v_multc_fixed(mixing_matrix_fx[param_band_idx], L_deposit_h(hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot]), mixing_matrix_smooth_fx, nY * nX); + mixing_matrix_smooth_e = mixing_matrix_e[param_band_idx]; // interpolator is W16 + move16(); + + v_multc_fixed(h_synthesis_state.mixing_matrix_old_fx[param_band_idx], L_sub( ONE_IN_Q31, L_deposit_h(hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot] ) ), mixing_matrix_buffer_fx, nY * nX); + mixing_matrix_buffer_e = h_synthesis_state.mixing_matrix_old_exp[param_band_idx]; // interpolator is W16 + + v_add_fixed_me(mixing_matrix_smooth_fx, mixing_matrix_smooth_e, mixing_matrix_buffer_fx, mixing_matrix_buffer_e, mixing_matrix_smooth_fx, &mixing_matrix_smooth_e, nY * nX, 0); + + IF ( have_residual ) + { + /* residual mixing matrix interpolation*/ + + v_multc_fixed(mixing_matrix_res_fx[param_band_idx], L_deposit_h(hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot]), mixing_matrix_res_smooth_fx, nY * nY ); + mixing_matrix_res_smooth_e = mixing_matrix_res_e[param_band_idx] ; // interpolator is W16 + + set_zero_fx(mixing_matrix_buffer_fx, nY * nY); + v_multc_fixed(h_synthesis_state.mixing_matrix_res_old_fx[param_band_idx], L_sub( ONE_IN_Q31, L_deposit_h( hParamMC->h_output_synthesis_params.interpolator_fx[slot_idx_tot]) ), mixing_matrix_buffer_fx, nY * nY); + mixing_matrix_buffer_e = h_synthesis_state.mixing_matrix_res_old_exp[param_band_idx]; // interpolator is W16 + + + v_add_fixed_me(mixing_matrix_res_smooth_fx, mixing_matrix_res_smooth_e, mixing_matrix_buffer_fx, mixing_matrix_buffer_e, mixing_matrix_res_smooth_fx, &mixing_matrix_res_smooth_e, nY * nY, 0); + } + + + + FOR ( band = brange[0]; band < brange[1]; band++ ) + { + assert( band >= 0 ); + IF ( have_residual ) + { + /* collect diffuse prototypes */ + assert( band < hParamMC->h_output_synthesis_params.max_band_decorr ); + FOR ( ch_idx = 0; ch_idx < nY; ch_idx++ ) + { + diff_f_real_fx[ch_idx] = Cldfb_RealBuffer_fx[ch_idx][slot_idx_sfr][band]; // Q6 + move32(); + diff_f_imag_fx[ch_idx] = Cldfb_ImagBuffer_fx[ch_idx][slot_idx_sfr][band]; + move32(); + } + + /* apply residual mixing */ + + matrix_product_fx( mixing_matrix_res_smooth_fx, nY, nY, 0, diff_f_real_fx, nY, 1, 0, output_f_real_fx ); + output_f_real_e = add( mixing_matrix_res_smooth_e, 25 ); + scale_sig32(output_f_real_fx, nY, 6 - (31 - output_f_real_e) ); + + + matrix_product_fx(mixing_matrix_res_smooth_fx, nY, nY, 0, diff_f_imag_fx, nY, 1, 0, output_f_imag_fx); + output_f_imag_e = mixing_matrix_res_smooth_e + 25; + scale_sig32(output_f_imag_fx, nY, 6 - (31 - output_f_imag_e) ); + + FOR ( ch_idx = 0; ch_idx < nY; ch_idx++ ) + { + Cldfb_RealBuffer_fx[ch_idx][slot_idx_sfr][band] = output_f_real_fx[ch_idx]; // Q6 + move32(); + Cldfb_ImagBuffer_fx[ch_idx][slot_idx_sfr][band] = output_f_imag_fx[ch_idx]; + move32(); + } + } + ELSE + { + FOR ( ch_idx = 0; ch_idx < nY; ch_idx++ ) + { + Cldfb_RealBuffer_fx[ch_idx][slot_idx_sfr][band] = 0; + move32(); + Cldfb_ImagBuffer_fx[ch_idx][slot_idx_sfr][band] = 0; + move32(); + } + } + + /* collect input signals, still in cldfb buffers */ + FOR ( ch_idx = 0; ch_idx < nX; ch_idx++ ) + { + + input_f_real_fx[ch_idx] = Cldfb_RealBuffer_in_fx[ch_idx * hParamMC->num_freq_bands + band]; // Q6 + move32(); + input_f_imag_fx[ch_idx] = Cldfb_ImagBuffer_in_fx[ch_idx * hParamMC->num_freq_bands + band]; + move32(); + + } + + /* apply mixing matrix */ + + matrix_product_fx(mixing_matrix_smooth_fx, nY, nX, 0, input_f_real_fx, nX, 1, 0, output_f_real_fx); + output_f_real_e = add( mixing_matrix_smooth_e, 25 ); + scale_sig32(output_f_real_fx, MAX_CICP_CHANNELS, sub( 6, sub(31, output_f_real_e) ) ); + + + matrix_product_fx(mixing_matrix_smooth_fx, nY, nX, 0, input_f_imag_fx, nX, 1, 0, output_f_imag_fx); + output_f_imag_e = add( mixing_matrix_smooth_e, 25 ); + scale_sig32(output_f_imag_fx, MAX_CICP_CHANNELS, sub( 6, sub( 31, output_f_imag_e ) ) ); + + /* collect output */ + FOR ( ch_idx = 0; ch_idx < nY; ch_idx++ ) + { + Cldfb_RealBuffer_fx[ch_idx][slot_idx_sfr][band] = L_add(Cldfb_RealBuffer_fx[ch_idx][slot_idx_sfr][band], output_f_real_fx[ch_idx] ); + Cldfb_ImagBuffer_fx[ch_idx][slot_idx_sfr][band] = L_add(Cldfb_ImagBuffer_fx[ch_idx][slot_idx_sfr][band], output_f_imag_fx[ch_idx] ); + + } + } + } + + return; +} + +#endif /*-------------------------------------------------------------------* * computeMixingMatrices() * diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index e63c61572..2e860b00d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -4442,21 +4442,16 @@ ivas_error ivas_jbm_dec_render( { /* Convert CICP19 -> Ambisonics */ #if 1 - Word16 Q_in_buffer_td = 31; FOR( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) { - Q_in_buffer_td = s_min( Q_in_buffer_td, Q_factor_arrL( p_output[i], *nSamplesRendered ) ); - } - FOR( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) - { - floatToFixed_arrL( p_output[i], p_output_fx[i], Q_in_buffer_td, *nSamplesRendered ); + floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, *nSamplesRendered ); } #endif ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); #if 1 FOR( i = 0; i < ( st_ivas->hOutSetup.ambisonics_order + 1 ) * ( st_ivas->hOutSetup.ambisonics_order + 1 ); i++ ) { - fixedToFloat_arrL( p_output_fx[i], p_output[i], Q_in_buffer_td - 3, *nSamplesRendered ); + fixedToFloat_arrL( p_output_fx[i], p_output[i], Q11, *nSamplesRendered ); } #endif } @@ -5263,7 +5258,17 @@ ivas_error ivas_jbm_dec_render( if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) ) { crendInPlaceRotation = TRUE; +#ifdef IVAS_FLOAT_FIXED + ivas_mc2sba_fx( st_ivas->hTransSetup, p_tc_fx, p_output_fx, *nSamplesRendered, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE_FX ); +#if 1 + FOR( i = 0; i < ( st_ivas->hIntSetup.ambisonics_order + 1 ) * ( st_ivas->hIntSetup.ambisonics_order + 1 ); i++ ) + { + fixedToFloat_arrL( p_output_fx[i], p_output[i], Q11, *nSamplesRendered ); + } +#endif +#else ivas_mc2sba( st_ivas->hTransSetup, p_tc, p_output, *nSamplesRendered, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); +#endif // IVAS_FLOAT_FIXED } } @@ -5334,7 +5339,17 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { +#ifdef IVAS_FLOAT_FIXED + ivas_mc2sba_fx( st_ivas->hIntSetup, p_tc_fx, p_output_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); +#if 1 + FOR( i = 0; i < ( st_ivas->hOutSetup.ambisonics_order + 1 ) * ( st_ivas->hOutSetup.ambisonics_order + 1 ); i++ ) + { + fixedToFloat_arrL( p_output_fx[i], p_output[i], Q11, *nSamplesRendered ); + } +#endif +#else ivas_mc2sba( st_ivas->hIntSetup, p_tc, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { @@ -5465,7 +5480,21 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { +#ifdef IVAS_FLOAT_FIXED + FOR( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) + { + floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, *nSamplesRendered ); + } + ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); +#if 1 + FOR( i = 0; i < ( st_ivas->hOutSetup.ambisonics_order + 1 ) * ( st_ivas->hOutSetup.ambisonics_order + 1 ); i++ ) + { + fixedToFloat_arrL( p_output_fx[i], p_output[i], Q11, *nSamplesRendered ); + } +#endif +#else ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { @@ -5514,7 +5543,21 @@ ivas_error ivas_jbm_dec_render( mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); } +#ifdef IVAS_FLOAT_FIXED + FOR( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) + { + floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, *nSamplesRendered ); + } + ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); +#if 1 + FOR( i = 0; i < ( st_ivas->hOutSetup.ambisonics_order + 1 ) * ( st_ivas->hOutSetup.ambisonics_order + 1 ); i++ ) + { + fixedToFloat_arrL( p_output_fx[i], p_output[i], Q11, *nSamplesRendered ); + } +#endif +#else ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif } else if ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_5_1_2 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1 ) ) { diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 55373068d..f8a225606 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -134,6 +134,10 @@ static void ivas_param_mc_bs_decode_parameter_values_fx(UWord16 bit_buffer[], Wo static void ivas_param_mc_dequantize_cov_fx(PARAM_MC_DEC_HANDLE hParamMC, Word16 *ild_q_fx, Word16 *icc_q_fx, const Word16 param_band_index, const Word16 nY_cov, const PARAM_MC_SYNTHESIS_CONF synth_conf, const Word16 nY_int, const Word16 nX, Word32 *Cx_state_fx, Word16 Cx_state_e, Word32 *Cproto_fx, Word16 Cproto_e, Word32 *Cy_state_fx, Word16 *Cy_state_e); static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, Word16 Q_proto_mtx); static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, Word32 *mixing_matrix[], Word16 *mixing_matrix_fx, Word32 *mixing_matrix_res[], Word16 *mixing_matrix_res_exp, const UWord16 nX, const UWord16 nY ); + +//static ivas_error param_mc_get_diff_proto_info_fx(const Word32 *proto_mtx, const UWord16 nchan_transport, const UWord16 nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info); + +static void param_mc_protoSignalComputation_fx(Word32 *RealBuffer_fx, Word32 *ImagBuffer_fx, Word32 *proto_frame_f_fx, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands/*, Word16 RealBuffer_fx_e, Word16 ImagBuffer_fx_e, Word16 *common_e*/); #endif /*------------------------------------------------------------------------- @@ -511,6 +515,7 @@ ivas_error ivas_param_mc_dec_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } + hParamMC->proto_frame_f_len = 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands; IF ( ( hParamMC->proto_frame_dec_f_fx = (Word32 *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); @@ -549,6 +554,8 @@ ivas_error ivas_param_mc_dec_open_fx( } set32_fx( hParamMC->Cldfb_ImagBuffer_tc_fx, 0, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + hParamMC->sz = n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands; + #if 1/*TODO: To be removed later(floating point malloc)*/ if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) { @@ -798,7 +805,7 @@ ivas_error ivas_param_mc_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } #else - IF ( ( hParamMC->ls_conv_dmx_matrix_fx = (Word32 *) malloc( nchan_out_transport * nchan_out_cov * sizeof( Word32 ) ) ) == NULL ) + IF ( ( hParamMC->ls_conv_dmx_matrix_fx = (Word32 *) malloc( nchan_out_transport * nchan_out_cov * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } @@ -978,6 +985,14 @@ ivas_error ivas_param_mc_dec_open( if ( hParamMC->max_band_decorr > 0 ) { +#ifdef IVAS_FLOAT_FIXED + IF ((hParamMC->proto_frame_f_fx = (Word32 *)malloc(2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof(Word32))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n")); + } + hParamMC->proto_frame_f_len = 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands; + hParamMC->proto_frame_dec_f_len = 2 * nchan_out_cov * hParamMC->num_freq_bands; +#endif if ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); @@ -988,18 +1003,28 @@ ivas_error ivas_param_mc_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } #ifdef IVAS_FLOAT_FIXED + hParamMC->proto_frame_f_len = 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands; + hParamMC->proto_frame_dec_f_len = 2 * nchan_out_cov * hParamMC->num_freq_bands; if ((hParamMC->proto_frame_dec_f_fx = (Word32 *)malloc(2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof(Word32))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n")); } + + if ( ( hParamMC->proto_frame_f_fx = (Word32 *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + #endif } else { hParamMC->proto_frame_f = NULL; hParamMC->proto_frame_dec_f = NULL; + #ifdef IVAS_FLOAT_FIXED hParamMC->proto_frame_dec_f_fx = NULL; + hParamMC->proto_frame_f_fx = NULL; #endif } @@ -1021,6 +1046,7 @@ ivas_error ivas_param_mc_dec_open( set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); #ifdef IVAS_FLOAT_FIXED + hParamMC->sz = n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands; IF ( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); @@ -1058,6 +1084,11 @@ ivas_error ivas_param_mc_dec_open( { hParamMC->Cldfb_RealBuffer_tc = NULL; hParamMC->Cldfb_ImagBuffer_tc = NULL; + +#ifdef IVAS_FLOAT_FIXED + hParamMC->Cldfb_RealBuffer_tc_fx = NULL; + hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; +#endif } hParamMC->subframes_rendered = 0; @@ -1645,12 +1676,14 @@ ivas_error ivas_param_mc_dec_reconfig_fx( IF ( GT_16(hParamMC->max_band_decorr , 0) && NE_16(nchan_transport_old , nchan_transport) ) { -#if 1 /*To be removed later:floating point memory alocations*/ +#ifdef IVAS_FLOAT_FIXED /*To be removed later:floating point memory alocations*/ free( hParamMC->proto_frame_f ); + hParamMC->proto_frame_f_len = 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands; IF ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } + set_zero( hParamMC->proto_frame_f, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); #endif free( hParamMC->proto_frame_f_fx ); @@ -2212,6 +2245,16 @@ ivas_error ivas_param_mc_dec_reconfig( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } set_zero( hParamMC->proto_frame_f, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); + +#ifdef IVAS_FLOAT_FIXED + free(hParamMC->proto_frame_f_fx); + hParamMC->proto_frame_f_len = 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands; + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n")); + } + + set_zero_fx(hParamMC->proto_frame_f_fx, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands); +#endif } @@ -2248,6 +2291,7 @@ ivas_error ivas_param_mc_dec_reconfig( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); } set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); + } else { @@ -2261,6 +2305,7 @@ ivas_error ivas_param_mc_dec_reconfig( free( hParamMC->Cldfb_ImagBuffer_tc ); hParamMC->Cldfb_ImagBuffer_tc = NULL; } + } } return error; @@ -2572,6 +2617,11 @@ void ivas_param_mc_dec_close( { free( hParamMC->proto_frame_f ); hParamMC->proto_frame_f = NULL; + +#ifdef IVAS_FLOAT_FIXED + free(hParamMC->proto_frame_f_fx); + hParamMC->proto_frame_f_fx = NULL; +#endif } if ( hParamMC->proto_frame_dec_f != NULL ) @@ -3358,11 +3408,16 @@ void ivas_param_mc_dec_render( for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++) { p_output_f_fx[i] = output_f_fx[i]; } + #endif float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; /*Decorrelator*/ float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; + +#ifdef IVAS_FLOAT_FIXED + Word32 onset_filter_fx[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; +#endif /* format converter */ int16_t channel_active[MAX_OUTPUT_CHANNELS]; uint16_t nband_synth, nbands_to_zero; @@ -3459,16 +3514,61 @@ void ivas_param_mc_dec_render( /*-----------------------------------------------------------------* * protoype signal computation *-----------------------------------------------------------------*/ + +#ifdef IVAS_FLOAT_FIXED + + floatToFixed_arrL(hParamMC->Cldfb_RealBuffer_tc, hParamMC->Cldfb_RealBuffer_tc_fx, Q12, hParamMC->sz); + + floatToFixed_arrL(hParamMC->Cldfb_ImagBuffer_tc, hParamMC->Cldfb_ImagBuffer_tc_fx, Q12, hParamMC->sz); + + FOR(Word16 x = 0; x < hParamMC->diff_proto_info->num_protos_diff; x++) + { + Word16 num_source_ch = hParamMC->diff_proto_info->num_source_chan_diff[x]; + move16(); + + floatToFixed_arrL(hParamMC->diff_proto_info->proto_fac[x], hParamMC->diff_proto_info->proto_fac_fx[x], Q30, num_source_ch); + } + + param_mc_protoSignalComputation_fx(&hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + hParamMC->proto_frame_f_fx, hParamMC->diff_proto_info, + hParamMC->num_freq_bands); + + fixedToFloat_arrL(hParamMC->proto_frame_f_fx, hParamMC->proto_frame_f, Q11, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands); + +#else param_mc_protoSignalComputation( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], hParamMC->proto_frame_f, hParamMC->diff_proto_info, hParamMC->num_freq_bands ); +#endif /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ - /* decorrelate prototype frame */ + +#ifdef IVAS_FLOAT_FIXED + Word16 tmp_e; + f2me_buf(hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer, hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_fx, &tmp_e, hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_len ); + hParamMC->h_freq_domain_decorr_ap_state->q_decorr_buffer = 31 - tmp_e; + ivas_dirac_dec_decorr_process_fx( hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + nchan_transport, + hParamMC->proto_frame_f_fx, + 11, + hParamMC->diff_proto_info->num_protos_diff, + hParamMC->diff_proto_info->proto_index_diff, + hParamMC->proto_frame_dec_f_fx,//output + &hParamMC->exp_proto_frame_dec_f, + onset_filter_fx, + hParamMC->h_freq_domain_decorr_ap_params, + hParamMC->h_freq_domain_decorr_ap_state ); + fixedToFloat_arrL32(onset_filter_fx, onset_filter, 31, MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX); + fixedToFloat_arrL32(hParamMC->proto_frame_dec_f_fx, hParamMC->proto_frame_dec_f, 11, nchan_out_cov * 2 * hParamMC->num_freq_bands); +#else ivas_dirac_dec_decorr_process( hParamMC->num_freq_bands, hParamMC->num_outputs_diff, hParamMC->diff_proto_info->num_protos_diff, @@ -3481,11 +3581,12 @@ void ivas_param_mc_dec_render( onset_filter, hParamMC->h_freq_domain_decorr_ap_params, hParamMC->h_freq_domain_decorr_ap_state ); +#endif /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ /* memory for the decorrelated signal */ #ifdef IVAS_FLOAT_FIXED - f2me_buf(hParamMC->proto_frame_dec_f, hParamMC->proto_frame_dec_f_fx, &hParamMC->exp_proto_frame_dec_f, nchan_out_cov * 2 * hParamMC->num_freq_bands); + //f2me_buf(hParamMC->proto_frame_dec_f, hParamMC->proto_frame_dec_f_fx, &hParamMC->exp_proto_frame_dec_f, nchan_out_cov * 2 * hParamMC->num_freq_bands); ivas_param_mc_dec_copy_diffuse_proto(hParamMC, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nchan_out_cov, slot_idx); FOR(int k = 0; k < nchan_out_cov; k++) { @@ -3504,11 +3605,70 @@ void ivas_param_mc_dec_render( * output synthesis *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED + Word16 j, k; + + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + FOR ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + { + Cldfb_RealBuffer_fx[i][j][k] = (Word32) (floatToFixed( Cldfb_RealBuffer[i][j][k], 6 ) ); + Cldfb_ImagBuffer_fx[i][j][k] = (Word32) (floatToFixed(Cldfb_ImagBuffer[i][j][k], 6 ) ); + } + } + } + + Word16 length = nchan_transport; + FOR (Word16 i = 0; i < 16 * nchan_transport * hParamMC->num_freq_bands; i++) + { + st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[i] = + floatToFixed(st_ivas->hParamMC->Cldfb_RealBuffer_tc[i], 6); + st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[i] = + floatToFixed(st_ivas->hParamMC->Cldfb_ImagBuffer_tc[i], 6); + } + + FOR(Word16 param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++) { + + + f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport * nchan_out_cov); + + IF(hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr) { + f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_out_cov * nchan_out_cov); + + f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[param_band_idx], nchan_out_cov * nchan_out_cov); + } + } + + floatToFixed_arr16(hParamMC->h_output_synthesis_params.interpolator, hParamMC->h_output_synthesis_params.interpolator_fx, 15, DEFAULT_JBM_CLDFB_TIMESLOTS); + + + ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( + &hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, slot_idx, slot_idx + slot_idx_start, + nchan_transport, nchan_out_cov, hParamMC ); + + + FOR (i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + FOR (j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++) + { + FOR (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) + { + Cldfb_RealBuffer[i][j][k] = ((float)Cldfb_RealBuffer_fx[i][j][k] / ( 1 << 6)); + Cldfb_ImagBuffer[i][j][k] = ((float)Cldfb_ImagBuffer_fx[i][j][k] / ( 1 << 6)); + } + } + } + +#else ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], Cldfb_RealBuffer, Cldfb_ImagBuffer, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, nchan_transport, nchan_out_cov, hParamMC ); +#endif if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { @@ -3795,7 +3955,17 @@ void ivas_param_mc_dec_render( #endif if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { +#ifdef IVAS_FLOAT_FIXED + ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_f_fx, p_output_f_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); +#if 1 + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + fixedToFloat_arrL(output_f_fx[i], output_f[i], Q11 , *nSamplesRendered ); + } +#endif +#else ivas_mc2sba( st_ivas->hIntSetup, output_f, output_f, hParamMC->num_freq_bands * slots_to_render, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif // IVAS_FLOAT_FIXED } /* update */ @@ -3825,6 +3995,8 @@ void ivas_param_mc_dec_render( } hParamMC->subframes_rendered = last_sf; *nSamplesAvailableNext = ( hParamMC->num_slots - hParamMC->slots_rendered ) * NS2SA( output_Fs, CLDFB_SLOT_NS ); + //fclose(fp1); + //fclose(fp); pop_wmops(); return; @@ -4141,9 +4313,6 @@ void ivas_param_mc_dec( nSamplesAsked = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); ivas_param_mc_dec_digest_tc( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS, output_f ); -#ifdef IVAS_FLOAT_FIXED - me2f_buf_16(st_ivas->hParamMC->h_output_synthesis_params.interpolator_fx, 0, st_ivas->hParamMC->h_output_synthesis_params.interpolator, DEFAULT_JBM_CLDFB_TIMESLOTS ); -#endif ivas_param_mc_dec_render( st_ivas, nSamplesAsked, &nSamplesRendered, &nSamplesAvailableNext, output_f ); /* set handle pointers back to NULL */ @@ -4324,6 +4493,71 @@ static void param_mc_protoSignalComputation( return; } +#ifdef IVAS_FLOAT_FIXED +static void param_mc_protoSignalComputation_fx( + Word32 *RealBuffer_fx, /* i : CLDFB samples of the transport channels (real part) */ + Word32 *ImagBuffer_fx, /* i : CLDFB samples of the transport channels (imaginary part) */ + Word32 *proto_frame_f_fx, /* o : interleaved complex prototype CLDFB samples */ + const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, /* i : prototype generation information */ + const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ +) +{ + Word16 band; + Word16 proto_ch_idx, source_ch_cnt; + + Word32 *p_proto_frame_fx; + Word32 *p_real_buffer_fx; // Q12 + Word32 *p_imag_buffer_fx; // Q12 + + Word16 proto_frame_f_q[ MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS * 120]; + + set32_fx(proto_frame_f_fx, 0, 2 * num_freq_bands * diff_proto_info->num_protos_diff); + + + FOR (proto_ch_idx = 0; proto_ch_idx < diff_proto_info->num_protos_diff; proto_ch_idx++) + { + Word16 num_source_ch = diff_proto_info->num_source_chan_diff[proto_ch_idx]; + move16(); + + FOR (source_ch_cnt = 0; source_ch_cnt < num_source_ch; source_ch_cnt++) + { + + Word32 fac_fx = diff_proto_info->proto_fac_fx[proto_ch_idx][source_ch_cnt]; + move32(); + + Word16 source_ch_idx = diff_proto_info->source_chan_idx[proto_ch_idx][source_ch_cnt]; + move16(); + + p_proto_frame_fx = &proto_frame_f_fx[proto_ch_idx * num_freq_bands * 2]; + p_real_buffer_fx = &RealBuffer_fx[source_ch_idx * num_freq_bands]; + p_imag_buffer_fx = &ImagBuffer_fx[source_ch_idx * num_freq_bands]; + + Word16 i = shl(imult1616(proto_ch_idx, num_freq_bands), 1); + move16(); + + FOR (band = 0; band < num_freq_bands; band++) + { + + Word32 tmp_x = Mpy_32_32(fac_fx, (*(p_real_buffer_fx++))); // Q(30 + 12 - 31) :: Q11 + + *(p_proto_frame_fx) = L_add(*(p_proto_frame_fx), tmp_x); + move32(); + p_proto_frame_fx++; + + tmp_x = Mpy_32_32(fac_fx, (*(p_imag_buffer_fx++))); // Q(30 + 12 - 31) :: Q11 + + *(p_proto_frame_fx) = L_add(*(p_proto_frame_fx), tmp_x); + move32(); + p_proto_frame_fx++; + + } + } + } + + return; +} +#endif + /*------------------------------------------------------------------------- * ivas_param_mc_dec_compute_diffuse_proto() * @@ -4679,7 +4913,7 @@ static void remove_lfe_from_cy_fx( FOR ( ch_idx2 = lfe_indices[lfe_idx2] + 1; ch_idx2 < lfe_indices[lfe_idx2 + 1]; ch_idx2++ ) { *( ptrCy_out++ ) = *( ptrCy++ ); - move32(); + move32(); } ptrCy++; } @@ -4872,7 +5106,7 @@ static void ivas_param_mc_get_mixing_matrices( synth_config, nY_intern, nX, Cx_state, Cproto, Cy_state ); - //dbgwrite2_txt(Cy_state_fx,nY_intern*nY_intern,"../cy_state.txt"); + //dbgwrite2_txt(Cy_state_fx,nY_intern*nY_intern,"../cy_state.txt"); #endif /* Smoothing: Sum over two buffers */ @@ -5770,7 +6004,7 @@ static void ivas_param_mc_dequantize_cov( } Nrqq[h_ild_mapping->ild_index[k]] = powf( 10.0f, ild_q[k] / 10.0f ) * hParamMC->hMetadataPMC->ild_factors[k] * ref_ener; } - //dbgwrite2_txt(Nrqq,size,"../nrqq.txt"); + //dbgwrite2_txt(Nrqq,size,"../nrqq.txt"); /* estimate ICCs from estimated Cproto */ for ( k = 0; k < nY_int; k++ ) @@ -6045,8 +6279,8 @@ static void ivas_param_mc_dequantize_cov_fx( #endif } - test(); - test(); + test(); + test(); IF( GE_16(param_band_index , PARAM_MC_MAX_BAND_LFE) || EQ_16(hParamMC->hMetadataPMC->lfe_on,0) ) { FOR( k = 0; k < nY_int; k++ ) @@ -6583,6 +6817,12 @@ static ivas_error param_mc_get_diff_proto_info( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } +#ifdef IVAS_FLOAT_FIXED + IF ((p_diff_proto_info->proto_fac_fx = (Word32 **)malloc(p_diff_proto_info->num_protos_diff * sizeof(Word32 *))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n")); + } +#endif #ifdef IVAS_FLOAT_FIXED if ( ( p_diff_proto_info->proto_fac_fx = (Word32 **) malloc( p_diff_proto_info->num_protos_diff * sizeof(Word32 * ) ) ) == NULL ) @@ -6609,6 +6849,13 @@ static ivas_error param_mc_get_diff_proto_info( } #endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED + IF ((p_diff_proto_info->proto_fac_fx[cur_diff_proto] = (Word32 *)malloc(max_num_src_chan * sizeof(Word32))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n")); + } +#endif + proto_fac_ptr = proto_fac + cur_diff_proto; for ( cur_transport_ch = 0; cur_transport_ch < nchan_transport; cur_transport_ch++ ) { diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index a779b98b1..5b479f344 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -234,7 +234,7 @@ void ivas_mc2sba_fx( /* Add LFE to omni W with gain*/ FOR( k = 0; k < output_frame; k++ ) { - buffer_tmp_fx[0][k] = L_add( buffer_tmp_fx[0][k], L_shr( Mult_32_16( in_buffer_td_fx[i][k], gain_lfe_fx ), 2 ) ); /*Q+14-15-2==Q-3*/ + buffer_tmp_fx[0][k] = L_add( buffer_tmp_fx[0][k], L_shl( Mult_32_16( in_buffer_td_fx[i][k], gain_lfe_fx ), 1 ) ); /*Q+14-15+1==Q*/ } } @@ -259,7 +259,7 @@ void ivas_mc2sba_fx( { FOR( k = 0; k < output_frame; k++ ) { - buffer_tmp_fx[j][k] = L_add( buffer_tmp_fx[j][k], L_shr( Mult_32_32( in_buffer_td_fx[i][k], gains_fx[j] ), 1 ) ); /*Q+29-31-1==Q-3*/ + buffer_tmp_fx[j][k] = L_add( buffer_tmp_fx[j][k], L_shl( Mult_32_32( in_buffer_td_fx[i][k], gains_fx[j] ), 2 ) ); /*Q+29-31+2==Q*/ } } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 33b101cb6..5cf0a60b8 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -828,10 +828,11 @@ typedef struct ivas_param_mc_dec_data_structure float *Cldfb_RealBuffer_tc; float *Cldfb_ImagBuffer_tc; #ifdef IVAS_FLOAT_FIXED - Word32 *Cldfb_RealBuffer_tc_fx; + Word32 *Cldfb_RealBuffer_tc_fx; // Q12 Word16 Cldfb_RealBuffer_tc_e; - Word32 *Cldfb_ImagBuffer_tc_fx; + Word32 *Cldfb_ImagBuffer_tc_fx; // Q12 Word16 Cldfb_ImagBuffer_tc_e; + Word16 sz; #endif int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t nb_subframes; @@ -858,6 +859,10 @@ typedef struct ivas_param_mc_dec_data_structure #ifdef IVAS_FLOAT_FIXED Word32 *proto_frame_dec_f_fx; Word16 exp_proto_frame_dec_f; + + Word32 *proto_frame_f_fx; // Q11 + Word16 proto_frame_f_len; + Word16 proto_frame_dec_f_len; #endif DIRAC_OUTPUT_SYNTHESIS_COV_STATE h_output_synthesis_cov_state; @@ -876,7 +881,6 @@ typedef struct ivas_param_mc_dec_data_structure #endif float *proto_matrix_int; #ifdef IVAS_FLOAT_FIXED - Word32 *proto_frame_f_fx; Word16 q_proto_frame_f; Word32 *ls_conv_dmx_matrix_fx; Word16 ls_conv_dmx_e; diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index f50aeb074..ce125f9a1 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -594,6 +594,7 @@ ivas_error ivas_dirac_dec_decorr_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } + freq_domain_decorr_ap_state->decorr_buffer_len = 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr; set32_fx( freq_domain_decorr_ap_state->decorr_buffer_fx, 0, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); freq_domain_decorr_ap_state->q_decorr_buffer = Q31; diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index add5bd875..0e92bf6b3 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -990,6 +990,7 @@ ivas_error ivas_orient_trk_Init_fx( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ @@ -1004,14 +1005,13 @@ ivas_error ivas_orient_trk_SetTrackingType( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_orient_trk_SetTrackingType_fx( - ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ ) { - IF ( pOTR == NULL ) + IF( pOTR == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -1145,6 +1145,7 @@ ivas_error ivas_orient_trk_GetMainOrientation_fx( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_orient_trk_GetTrackedRotation( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION *pRotation /* i/o: processed rotation */ @@ -1159,14 +1160,14 @@ ivas_error ivas_orient_trk_GetTrackedRotation( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_orient_trk_GetTrackedRotation_fx( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION *pRotation /* i/o: processed rotation */ ) { - IF ( pOTR == NULL || pRotation == NULL ) + test(); + IF( pOTR == NULL || pRotation == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 31bada63e..fb788fa4e 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -55,6 +55,20 @@ * Allocates the renderer configuration structure *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_render_config_open( + RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ +) +{ + /* Allocate HR filter set for headphones configuration */ + IF( ( *hRenderConfig = (RENDER_CONFIG_HANDLE) malloc( sizeof( RENDER_CONFIG_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer configuration!" ); + } + + return IVAS_ERR_OK; +} +#else ivas_error ivas_render_config_open( RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ ) @@ -67,6 +81,7 @@ ivas_error ivas_render_config_open( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -75,6 +90,23 @@ ivas_error ivas_render_config_open( * Deallocates the renderer configuration structure *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_render_config_close( + RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ +) +{ + test(); + IF( hRenderConfig == NULL || *hRenderConfig == NULL ) + { + return; + } + + free( *hRenderConfig ); + *hRenderConfig = NULL; + + return; +} +#else void ivas_render_config_close( RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ ) @@ -89,6 +121,7 @@ void ivas_render_config_close( return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index ca299c1e1..93b32afa1 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1634,6 +1634,23 @@ ivas_error ivas_external_orientation_open( * Deallocate external orientation handle *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_external_orientation_close( + EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* i/o: external orientation handle */ +) +{ + test(); + IF( hExtOrientationData == NULL || *hExtOrientationData == NULL ) + { + return; + } + + free( ( *hExtOrientationData ) ); + *hExtOrientationData = NULL; + + return; +} +#else void ivas_external_orientation_close( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* i/o: external orientation handle */ ) @@ -1648,6 +1665,7 @@ void ivas_external_orientation_close( return; } +#endif /*-----------------------------------------------------------------------* @@ -1771,6 +1789,23 @@ ivas_error ivas_combined_orientation_open( * Deallocate combined orientation handle *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_combined_orientation_close( + COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* i/o: combined orientation handle */ +) +{ + test(); + IF( hCombinedOrientationData == NULL || *hCombinedOrientationData == NULL ) + { + return; + } + + free( ( *hCombinedOrientationData ) ); + *hCombinedOrientationData = NULL; + + return; +} +#else void ivas_combined_orientation_close( COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* i/o: combined orientation handle */ ) @@ -1785,6 +1820,7 @@ void ivas_combined_orientation_close( return; } +#endif /*------------------------------------------------------------------------- diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index d266aecfe..d3348f9dd 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -191,6 +191,7 @@ typedef struct dirac_decorr_state_structure #ifdef IVAS_FLOAT_FIXED Word32 *decorr_buffer_fx; Word16 q_decorr_buffer; + Word16 decorr_buffer_len; Word32 *direct_energy_smooth_fx; Word16 q_direct_energy_smooth; Word32 *reverb_energy_smooth_fx; @@ -1823,7 +1824,7 @@ typedef struct ivas_binaural_td_rendering_struct typedef struct { - int32_t binaural_latency_ns; + Word32 binaural_latency_ns; BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; TDREND_HRFILT_FiltSet_t *hHrtfTD; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index dbbdbd13f..3b93eaf6e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -767,9 +767,9 @@ static ivas_error validateOutputAudioConfig( * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED IVAS_REND_AudioConfigType getAudioConfigType( const AUDIO_CONFIG config ) -#ifdef IVAS_FLOAT_FIXED { IVAS_REND_AudioConfigType type; @@ -818,6 +818,8 @@ IVAS_REND_AudioConfigType getAudioConfigType( return type; } #else +IVAS_REND_AudioConfigType getAudioConfigType( + const AUDIO_CONFIG config) { IVAS_REND_AudioConfigType type; @@ -938,6 +940,7 @@ ivas_error getAudioConfigNumChannels( case IVAS_AUDIO_CONFIG_OBA: case IVAS_AUDIO_CONFIG_MASA1: *numChannels = 1; + move16(); BREAK; case IVAS_AUDIO_CONFIG_STEREO: case IVAS_AUDIO_CONFIG_BINAURAL: @@ -945,28 +948,36 @@ ivas_error getAudioConfigNumChannels( case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: case IVAS_AUDIO_CONFIG_MASA2: *numChannels = 2; + move16(); BREAK; case IVAS_AUDIO_CONFIG_FOA: *numChannels = 4; + move16(); BREAK; case IVAS_AUDIO_CONFIG_5_1: *numChannels = 6; + move16(); BREAK; case IVAS_AUDIO_CONFIG_7_1: case IVAS_AUDIO_CONFIG_5_1_2: *numChannels = 8; + move16(); BREAK; case IVAS_AUDIO_CONFIG_HOA2: *numChannels = 9; + move16(); BREAK; case IVAS_AUDIO_CONFIG_5_1_4: *numChannels = 10; + move16(); BREAK; case IVAS_AUDIO_CONFIG_7_1_4: *numChannels = 12; + move16(); BREAK; case IVAS_AUDIO_CONFIG_HOA3: *numChannels = 16; + move16(); BREAK; default: return IVAS_ERR_NUM_CHANNELS_UNKNOWN; @@ -1142,6 +1153,8 @@ static LSSETUP_CUSTOM_STRUCT defaultCustomLs( return ls; } #endif + + #ifdef IVAS_FLOAT_FIXED static ivas_error getSpeakerAzimuths_fx( AUDIO_CONFIG config, @@ -1285,17 +1298,20 @@ static ivas_error getAmbisonicsOrder_fx( AUDIO_CONFIG config, Word16 *order ) { - switch ( config ) + SWITCH ( config ) { case IVAS_AUDIO_CONFIG_FOA: *order = 1; - break; + move16(); + BREAK; case IVAS_AUDIO_CONFIG_HOA2: *order = 2; - break; + move16(); + BREAK; case IVAS_AUDIO_CONFIG_HOA3: *order = 3; - break; + move16(); + BREAK; default: return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported audio config" ); } @@ -1658,12 +1674,12 @@ static ivas_error getEfapGains_fx( IF( EQ_32( efapWrapper.speakerConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { numChannels = add( efapWrapper.pCustomLsSetup->num_spk, efapWrapper.pCustomLsSetup->num_lfe ); - move16(); readPtr = tmpPanGains; - move16(); lfeCount = 0; + move16(); FOR( i = 0; i < numChannels; ++i ) { + test(); IF( LT_16( lfeCount, efapWrapper.pCustomLsSetup->num_lfe ) && EQ_16( i, efapWrapper.pCustomLsSetup->lfe_idx[lfeCount] ) ) { panGains[i] = 0; @@ -1686,7 +1702,6 @@ static ivas_error getEfapGains_fx( } readPtr = tmpPanGains; - move32(); FOR( i = 0; i < numChannels; ++i ) { @@ -1850,6 +1865,21 @@ static ivas_error initHeadRotation( return IVAS_ERR_OK; } #endif + + +#ifdef IVAS_FLOAT_FIXED +static void closeHeadRotation( + IVAS_REND_HANDLE hIvasRend ) +{ + test(); + IF( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) + { + free( hIvasRend->headRotData.hOrientationTracker ); + } + + return; +} +#else static void closeHeadRotation( IVAS_REND_HANDLE hIvasRend ) { @@ -1860,6 +1890,7 @@ static void closeHeadRotation( return; } +#endif static void initRotMatrix( @@ -2020,19 +2051,51 @@ static rendering_context getRendCtx( } +#ifdef IVAS_FLOAT_FIXED static TDREND_WRAPPER defaultTdRendWrapper( void ) { TDREND_WRAPPER w; w.binaural_latency_ns = 0; + move32(); w.hBinRendererTd = NULL; w.hHrtfTD = NULL; return w; } +#else +static TDREND_WRAPPER defaultTdRendWrapper( + void ) +{ + TDREND_WRAPPER w; + w.binaural_latency_ns = 0; + w.hBinRendererTd = NULL; + w.hHrtfTD = NULL; + return w; +} +#endif + + +#ifdef IVAS_FLOAT_FIXED +static bool isIoConfigPairSupported( + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig ) +{ + /* Rendering mono or stereo to binaural is not supported */ + test(); + test(); + IF( ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_STEREO ) ) && EQ_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) + { + return false; + } + + /* If not returned so far, config pair is supported */ + return true; +} +#else static bool isIoConfigPairSupported( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig ) @@ -2046,6 +2109,7 @@ static bool isIoConfigPairSupported( /* If not returned so far, config pair is supported */ return true; } +#endif static ivas_error initIsmMasaRendering( @@ -2320,9 +2384,10 @@ static void fillIdentityPanMatrix_fx( { Word16 i; - FOR( i = 0; i < min( MAX_INPUT_CHANNELS, MAX_OUTPUT_CHANNELS ); ++i ) + FOR( i = 0; i < s_min( MAX_INPUT_CHANNELS, MAX_OUTPUT_CHANNELS ); ++i ) { panMatrix[i][i] = ONE_IN_Q31; + move32(); } return; @@ -2369,12 +2434,15 @@ static ivas_error initMcPanGainsWithConversionMapping_fx( Word16 i; ivasConfigIn = inputMc->base.inConfig; + move32(); ivasConfigOut = outConfig; + move32(); /* Find conversion mapping for current I/O config pair. * Stay with default panning matrix if conversion_matrix is NULL */ FOR( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i ) { + test(); IF( EQ_32( ls_conversion_mapping_fx[i].input_config, ivasConfigIn ) && EQ_32( ls_conversion_mapping_fx[i].output_config, ivasConfigOut ) ) { /* Mapping found with valid matrix - copy */ @@ -2459,6 +2527,7 @@ static ivas_error initMcPanGainsWithEfap_fx( } inLfeChIdx = LFE_CHANNEL; + move16(); } ELSE { @@ -2491,6 +2560,8 @@ static ivas_error initMcPanGainsWithEfap_fx( ++outChIdx; } + test(); + test(); IF( NE_32( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GE_16( inLfeChIdx, 0 ) ) { inputMc->panGains_fx[inLfeChIdx][LFE_CHANNEL] = ONE_IN_Q31; @@ -2668,6 +2739,7 @@ static ivas_error initMcPanGainsWithMonoOut_fx( /* ls_conversion_cicpX_stereo contains gains for side speakers. * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; + test(); IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_4 ) ) { skipSideSpeakers = true; @@ -2676,6 +2748,7 @@ static ivas_error initMcPanGainsWithMonoOut_fx( move16(); FOR( writeIdx = 0; writeIdx < numInChannels; ++writeIdx ) { + test(); IF( ( skipSideSpeakers ) && EQ_16( readIdx, 4 ) ) { /* Skip gains for side speakers in lookup table */ @@ -2770,6 +2843,7 @@ static ivas_error initMcPanGainsWithStereoLookup_fx( /* ls_conversion_cicpX_stereo contains gains for side speakers. * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; + test(); IF( EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_5_1_4 ) ) { skipSideSpeakers = true; @@ -2859,35 +2933,37 @@ static bool configsAreEqual( Word16 i; /* Both input and output are custom LS - compare structs */ - IF ( EQ_16(configA , IVAS_AUDIO_CONFIG_LS_CUSTOM) && EQ_16(configB , IVAS_AUDIO_CONFIG_LS_CUSTOM) ) + test(); + IF( EQ_16( configA, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16( configB, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - IF ( NE_16(customLsA.num_spk , customLsB.num_spk) ) + IF( NE_16( customLsA.num_spk, customLsB.num_spk ) ) { return false; } - IF ( NE_16(customLsA.num_lfe , customLsB.num_lfe )) + IF( NE_16( customLsA.num_lfe, customLsB.num_lfe ) ) { return false; } - IF ( NE_16(customLsA.is_planar_setup , customLsB.is_planar_setup) ) + IF( NE_16( customLsA.is_planar_setup, customLsB.is_planar_setup ) ) { return false; } - FOR ( i = 0; i < customLsA.num_spk; ++i ) + FOR( i = 0; i < customLsA.num_spk; ++i ) { /* Compare to nearest degree (hence the int16_t cast) */ - IF ( NE_32(customLsA.ls_azimuth_fx[i] , customLsB.ls_azimuth_fx[i]) || - NE_32(customLsA.ls_elevation_fx[i] , customLsB.ls_elevation_fx[i] )) + test(); + IF( NE_32( customLsA.ls_azimuth_fx[i], customLsB.ls_azimuth_fx[i] ) || + NE_32( customLsA.ls_elevation_fx[i], customLsB.ls_elevation_fx[i] ) ) { return false; } } - FOR ( i = 0; i < customLsA.num_lfe; ++i ) + FOR( i = 0; i < customLsA.num_lfe; ++i ) { - IF ( NE_16(customLsA.lfe_idx[i] , customLsB.lfe_idx[i]) ) + IF( NE_16( customLsA.lfe_idx[i], customLsB.lfe_idx[i] ) ) { return false; } @@ -2960,31 +3036,29 @@ static ivas_error updateLfePanGainsForMcOut( error = IVAS_ERR_OK; /* If panning is not required, simply return */ - IF ( !inputMc->lfeRouting.pan_lfe ) + IF( !inputMc->lfeRouting.pan_lfe ) { return error; } numLfeIn = getNumLfeChannels( inputMc ); - move16(); - IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_LS_CUSTOM) ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { numOutChannels = add( inputMc->base.ctx.pCustomLsOut->num_spk, inputMc->base.ctx.pCustomLsOut->num_lfe ); - move16(); } ELSE { - IF ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) + IF( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) { return error; } } - FOR ( i = 0; i < numLfeIn; i++ ) + FOR( i = 0; i < numLfeIn; i++ ) { /* panning gains */ - IF ( ( error = getEfapGains_fx( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth_fx, inputMc->lfeRouting.lfeOutputElevation_fx, inputMc->lfeRouting.lfePanMtx_fx[i] ) ) != IVAS_ERR_OK ) + IF( ( error = getEfapGains_fx( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth_fx, inputMc->lfeRouting.lfeOutputElevation_fx, inputMc->lfeRouting.lfePanMtx_fx[i] ) ) != IVAS_ERR_OK ) { return error; } @@ -3127,17 +3201,20 @@ static ivas_error updateMcPanGainsForMcOut( +-----------+-------------+---------------+-----------+--------------------+ */ - IF ( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) + test(); + test(); + IF( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) { error = initMcPanGainsWithIdentMatrix( inputMc ); } - ELSE IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_LS_CUSTOM) || - EQ_16(inputMc->base.inConfig , IVAS_AUDIO_CONFIG_MONO) || - EQ_16(inputMc->base.inConfig , IVAS_AUDIO_CONFIG_LS_CUSTOM )) + ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) || + EQ_16( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) || + EQ_16( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - IF ( EQ_16(inputMc->base.inConfig , IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) + test(); + IF( EQ_16( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) { - inputMc->panGains_fx[0][0] = EQ_32(inputMc->nonDiegeticPanGain_fx , ONE_IN_Q31 ) ? ONE_IN_Q31 : L_add( L_shr( inputMc->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 ); + inputMc->panGains_fx[0][0] = EQ_32( inputMc->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ? ONE_IN_Q31 : L_add( L_shr( inputMc->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 ); move32(); inputMc->panGains_fx[0][1] = L_sub( ONE_IN_Q31, inputMc->panGains_fx[0][0] ); move32(); @@ -3148,11 +3225,11 @@ static ivas_error updateMcPanGainsForMcOut( error = initMcPanGainsWithEfap_fx( inputMc, outConfig ); } } - ELSE IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_MONO) ) + ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MONO ) ) { error = initMcPanGainsWithMonoOut_fx( inputMc ); } - ELSE IF( EQ_16(outConfig , IVAS_AUDIO_CONFIG_STEREO) ) + ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_STEREO ) ) { error = initMcPanGainsWithStereoLookup_fx( inputMc ); } @@ -3162,7 +3239,7 @@ static ivas_error updateMcPanGainsForMcOut( } /* check for errors from above block */ - IF ( error != IVAS_ERR_OK ) + IF( error != IVAS_ERR_OK ) { return error; } @@ -3268,14 +3345,14 @@ static ivas_error updateMcPanGainsForAmbiOut( } ch_in = 0; move16(); - FOR ( ch_out = 0; ch_in < numNonLfeInChannels; ++ch_out ) + FOR( ch_out = 0; ch_in < numNonLfeInChannels; ++ch_out ) { - IF ( EQ_16(ch_in , LFE_CHANNEL )) + IF( EQ_16( ch_in, LFE_CHANNEL ) ) { ++ch_out; } ivas_dirac_dec_get_response_fixed( (Word16) L_shr( spkAzi_fx[ch_in], 22 ), (Word16) L_shr( spkEle_fx[ch_in], 22 ), inputMc->panGains_fx[ch_out], outAmbiOrder ); - FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { Word32 temp = inputMc->panGains_fx[ch_out][i]; move32(); @@ -3296,11 +3373,11 @@ static ivas_error updateMcPanGainsForAmbiOut( move32(); ch_in = 0; move16(); - FOR ( ch_out = 0; ch_in < numNonLfeInChannels; ++ch_out ) + FOR( ch_out = 0; ch_in < numNonLfeInChannels; ++ch_out ) { - FOR ( lfeIdx = 0; lfeIdx < inputMc->customLsInput.num_lfe; ++lfeIdx ) + FOR( lfeIdx = 0; lfeIdx < inputMc->customLsInput.num_lfe; ++lfeIdx ) { - IF ( EQ_16(inputMc->customLsInput.lfe_idx[lfeIdx] , ch_in )) + IF( EQ_16( inputMc->customLsInput.lfe_idx[lfeIdx], ch_in ) ) { ++ch_out; BREAK; @@ -3308,7 +3385,7 @@ static ivas_error updateMcPanGainsForAmbiOut( } ivas_dirac_dec_get_response_fixed( (Word16) L_shr( spkAzi_fx[ch_in], 22 ), (Word16) L_shr( spkEle_fx[ch_in], 22 ), inputMc->panGains_fx[ch_out], outAmbiOrder ); - FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { Word32 temp = inputMc->panGains_fx[ch_out][i]; move32(); @@ -3321,7 +3398,7 @@ static ivas_error updateMcPanGainsForAmbiOut( } /* update LFE panning */ - IF ( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) + IF( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -3411,7 +3488,7 @@ static ivas_error updateMcPanGains( setZeroPanMatrix_fx( inputMc->panGains_fx ); error = IVAS_ERR_OK; - SWITCH ( getAudioConfigType( outConfig ) ) + SWITCH( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: error = updateMcPanGainsForMcOut( inputMc, outConfig ); @@ -3439,23 +3516,23 @@ static ivas_error updateMcPanGains( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } /* Check error here to keep switch statement more compact */ - IF ( error != IVAS_ERR_OK ) + IF( error != IVAS_ERR_OK ) { return error; } /* Copy LFE routing to pan gains array */ - IF (EQ_16( inputMc->base.inConfig , IVAS_AUDIO_CONFIG_LS_CUSTOM )) + IF( EQ_16( inputMc->base.inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { - FOR ( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) + FOR( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) { - mvr2r_Word32( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->panGains_fx[inputMc->customLsInput.lfe_idx[i]], IVAS_MAX_OUTPUT_CHANNELS ); + Copy32( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->panGains_fx[inputMc->customLsInput.lfe_idx[i]], IVAS_MAX_OUTPUT_CHANNELS ); } } ELSE { /* For code simplicity, always copy LFE gains. If config has no LFE, gains will be zero anyway. */ - mvr2r_Word32( inputMc->lfeRouting.lfePanMtx_fx[0], inputMc->panGains_fx[LFE_CHANNEL], IVAS_MAX_OUTPUT_CHANNELS ); + Copy32( inputMc->lfeRouting.lfePanMtx_fx[0], inputMc->panGains_fx[LFE_CHANNEL], IVAS_MAX_OUTPUT_CHANNELS ); } return IVAS_ERR_OK; @@ -3731,14 +3808,15 @@ static lfe_routing defaultLfeRouting( /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ - FOR ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) + FOR( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) { set_val_Word32( routing.lfePanMtx_fx[i], 0, IVAS_MAX_OUTPUT_CHANNELS ); } routing.pan_lfe = false; routing.lfeInputGain_fx = ONE_IN_Q31; + move32(); - SWITCH ( inConfig ) + SWITCH( inConfig ) { case IVAS_AUDIO_CONFIG_5_1: case IVAS_AUDIO_CONFIG_5_1_2: @@ -3757,7 +3835,7 @@ static lfe_routing defaultLfeRouting( move16(); } - SWITCH ( outConfig ) + SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_5_1: case IVAS_AUDIO_CONFIG_5_1_2: @@ -3768,7 +3846,7 @@ static lfe_routing defaultLfeRouting( move32(); BREAK; case IVAS_AUDIO_CONFIG_LS_CUSTOM: - FOR ( i = 0; i < routing.numLfeChannels && i < customLsOut.num_lfe; ++i ) + FOR( i = 0; i < routing.numLfeChannels && i < customLsOut.num_lfe; ++i ) { routing.lfePanMtx_fx[i][customLsOut.lfe_idx[i]] = ONE_IN_Q31; move32(); @@ -4922,6 +5000,38 @@ static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( } #endif + +#ifdef IVAS_FLOAT_FIXED +static ivas_error validateCustomLsLayout_fx( + const IVAS_CUSTOM_LS_DATA layout ) +{ + Word16 i; + + /* Negative number of speakers or LFEs makes no sense */ + test(); + IF( LT_16( layout.num_spk, 0 ) || LT_16( layout.num_lfe, 0 ) ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } + + /* There must be at least one speaker or LFE in the layout */ + IF( LE_16( add( layout.num_spk, layout.num_lfe ), 0 ) ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } + + /* LFE indices must be positive */ + FOR( i = 0; i < layout.num_lfe; ++i ) + { + IF( LT_16( layout.lfe_idx[i], 0 ) ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } + } + + return IVAS_ERR_OK; +} +#else static ivas_error validateCustomLsLayout( const IVAS_CUSTOM_LS_DATA layout ) { @@ -4950,6 +5060,7 @@ static ivas_error validateCustomLsLayout( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -4979,10 +5090,17 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } +#ifdef IVAS_FLOAT_FIXED + IF( ( error = validateCustomLsLayout_fx( layout ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) { return error; } +#endif hIvasRend->customLsOut = makeCustomLsSetup( layout ); @@ -5057,6 +5175,7 @@ ivas_error IVAS_REND_NumOutChannels( ivas_error error; /* Validate function arguments */ + test(); IF( hIvasRend == NULL || numOutChannels == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -5066,7 +5185,7 @@ ivas_error IVAS_REND_NumOutChannels( SWITCH( hIvasRend->outputConfig ) { case IVAS_AUDIO_CONFIG_LS_CUSTOM: - *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; + *numOutChannels = add( hIvasRend->customLsOut.num_spk, hIvasRend->customLsOut.num_lfe ); BREAK; default: IF( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) @@ -5115,6 +5234,18 @@ ivas_error IVAS_REND_NumOutChannels( } #endif + +#ifdef IVAS_FLOAT_FIXED +static IVAS_REND_InputId makeInputId( + AUDIO_CONFIG config, + const Word32 inputIndex ) +{ + /* Put config type in second byte (from LSB), put index + 1 in first byte + * + * Index is incremented here so that a valid ID can never be 0. */ + return (IVAS_REND_InputId) UL_or( UL_lshl( ( (UWord32) getAudioConfigType( config ) ), 8 ), L_add( inputIndex, 1 ) ); +} +#else static IVAS_REND_InputId makeInputId( AUDIO_CONFIG config, const int32_t inputIndex ) @@ -5124,8 +5255,75 @@ static IVAS_REND_InputId makeInputId( * Index is incremented here so that a valid ID can never be 0. */ return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); } +#endif + + +#ifdef IVAS_FLOAT_FIXED +static ivas_error getInputById( + IVAS_REND_HANDLE hIvasRend, + IVAS_REND_InputId inputId, + void **ppInput ) +{ + Word32 inputIndex; + IVAS_REND_AudioConfigType configType; + input_base *pInputBase; + + /* Reverse makeInputId() */ + inputIndex = L_sub( L_and( inputId, 0xFF ), 1 ); + configType = L_shr( L_and( inputId, 0xFF00 ), 8 ); + /* Validate values derived from input ID */ + IF( LT_32( inputIndex, 0 ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + SWITCH( configType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + IF( GT_32( inputIndex, RENDERER_MAX_ISM_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsIsm[inputIndex].base; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + IF( GT_32( inputIndex, RENDERER_MAX_MC_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMc[inputIndex].base; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + IF( GT_32( inputIndex, RENDERER_MAX_SBA_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsSba[inputIndex].base; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + IF( GT_32( inputIndex, RENDERER_MAX_MASA_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMasa[inputIndex].base; + BREAK; + default: + return IVAS_ERR_INVALID_INPUT_ID; + } + + /* Ensure input ID matches and that input is active */ + test(); + IF( NE_32( pInputBase->id, inputId ) || EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + + /* Validation done, set value via output parameter */ + *ppInput = pInputBase; + return IVAS_ERR_OK; +} +#else static ivas_error getInputById( IVAS_REND_HANDLE hIvasRend, IVAS_REND_InputId inputId, @@ -5189,8 +5387,75 @@ static ivas_error getInputById( return IVAS_ERR_OK; } +#endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error getConstInputById( + IVAS_REND_CONST_HANDLE hIvasRend, + const IVAS_REND_InputId inputId, + const void **ppInput ) +{ + Word32 inputIndex; + IVAS_REND_AudioConfigType configType; + const input_base *pInputBase; + + /* Reverse makeInputId() */ + inputIndex = L_sub( L_and( inputId, 0xFF ), 1 ); + configType = L_shr( L_and( inputId, 0xFF00 ), 8 ); + + /* Validate values derived from input ID */ + IF( LT_32( inputIndex, 0 ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + SWITCH( configType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + IF( GT_32( inputIndex, RENDERER_MAX_ISM_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsIsm[inputIndex].base; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + IF( GT_32( inputIndex, RENDERER_MAX_MC_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMc[inputIndex].base; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + IF( GT_32( inputIndex, RENDERER_MAX_SBA_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsSba[inputIndex].base; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + IF( GT_32( inputIndex, RENDERER_MAX_MASA_INPUTS ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMasa[inputIndex].base; + BREAK; + default: + return IVAS_ERR_INVALID_INPUT_ID; + } + + /* Ensure input ID matches and that input is active */ + test(); + IF( NE_32( pInputBase->id, inputId ) || EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + + /* Validation done, set value via output parameter */ + *ppInput = pInputBase; + + return IVAS_ERR_OK; +} +#else static ivas_error getConstInputById( IVAS_REND_CONST_HANDLE hIvasRend, const IVAS_REND_InputId inputId, @@ -5254,6 +5519,7 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } +#endif static ivas_error findFreeInputSlot( @@ -5393,10 +5659,17 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef IVAS_FLOAT_FIXED + IF( ( error = validateCustomLsLayout_fx( layout ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) { return error; } +#endif if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputMc ) ) != IVAS_ERR_OK ) { @@ -5942,6 +6215,41 @@ ivas_error IVAS_REND_FeedInputAudio( * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_FeedInputObjectMetadata( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_ISM_METADATA objectPosition /* i : object position struct */ +) +{ + input_base *inputBase; + input_ism *inputIsm; + ivas_error error; + + /* Validate function arguments */ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( NE_32( inputBase->inConfig, IVAS_AUDIO_CONFIG_OBA ) ) + { + /* Object metadata should only be fed for object inputs */ + return IVAS_ERR_METADATA_NOT_EXPECTED; + } + + inputIsm = (input_ism *) inputBase; + inputIsm->previousPos = inputIsm->currentPos; + inputIsm->currentPos = objectPosition; + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_FeedInputObjectMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -5975,6 +6283,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -6009,6 +6318,41 @@ ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_FeedInputMasaMetadata( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + IVAS_MASA_METADATA_HANDLE masaMetadata /* i : MASA metadata frame */ +) +{ + ivas_error error; + input_base *inputBase; + input_masa *inputMasa; + + /* Validate function arguments */ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( NE_32( getAudioConfigType( inputBase->inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) + { + /* MASA metadata should only be fed for MASA inputs */ + return IVAS_ERR_METADATA_NOT_EXPECTED; + } + + inputMasa = (input_masa *) inputBase; + inputMasa->masaMetadata = *masaMetadata; + inputMasa->metadataHasBeenFed = true; + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_FeedInputMasaMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -6042,6 +6386,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -6297,19 +6642,23 @@ ivas_error IVAS_REND_DisableHeadRotation( * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ ) { -#ifdef IVAS_FLOAT_FIXED - ivas_error ret; - ret = ivas_orient_trk_SetTrackingType_fx( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); - return ret; + return ivas_orient_trk_SetTrackingType_fx( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); +} #else +ivas_error IVAS_REND_SetOrientationTrackingMode( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ +) +{ return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); -#endif } +#endif /*-------------------------------------------------------------------* @@ -6366,7 +6715,8 @@ ivas_error IVAS_REND_SetReferenceRotation( * * *-------------------------------------------------------------------*/ -// ToDo: not used + +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetMainOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for main orientation */ @@ -6379,40 +6729,14 @@ ivas_error IVAS_REND_GetMainOrientation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef IVAS_FLOAT_FIXED - Word16 q_fact = hIvasRend->headRotData.hOrientationTracker->refRot.w_qfact = hIvasRend->headRotData.hOrientationTracker->refRot.x_qfact = - hIvasRend->headRotData.hOrientationTracker->refRot.y_qfact = hIvasRend->headRotData.hOrientationTracker->refRot.z_qfact = Q29; - hIvasRend->headRotData.hOrientationTracker->refRot.w_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->refRot.w, q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.x_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->refRot.x, q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.y_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->refRot.y, q_fact ); - hIvasRend->headRotData.hOrientationTracker->refRot.z_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->refRot.z, q_fact ); - - - hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->absAvgRot.w, Q29 ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->absAvgRot.x, Q29 ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->absAvgRot.y, Q29 ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->absAvgRot.z, Q29 ); - hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_qfact = hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_qfact = - hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_qfact = hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_qfact = Q29; - - error = ivas_orient_trk_GetMainOrientation_fx( hIvasRend->headRotData.hOrientationTracker, pOrientation ); - pOrientation->w = fix_to_float( pOrientation->w_fx, pOrientation->w_qfact ); - pOrientation->x = fix_to_float( pOrientation->x_fx, pOrientation->x_qfact ); - pOrientation->y = fix_to_float( pOrientation->y_fx, pOrientation->y_qfact ); - pOrientation->z = fix_to_float( pOrientation->z_fx, pOrientation->z_qfact ); - IF( error != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_orient_trk_GetMainOrientation( hIvasRend->headRotData.hOrientationTracker, pOrientation ) ) != IVAS_ERR_OK ) { return error; } -#endif return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -6420,7 +6744,8 @@ ivas_error IVAS_REND_GetMainOrientation( * * *-------------------------------------------------------------------*/ -// ToDo: not used + +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetTrackedRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer processed rotation */ @@ -6433,31 +6758,14 @@ ivas_error IVAS_REND_GetTrackedRotation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef IVAS_FLOAT_FIXED - hIvasRend->headRotData.hOrientationTracker->trkRot.w_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->trkRot.w, Q29 ); - hIvasRend->headRotData.hOrientationTracker->trkRot.x_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->trkRot.x, Q29 ); - hIvasRend->headRotData.hOrientationTracker->trkRot.y_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->trkRot.y, Q29 ); - hIvasRend->headRotData.hOrientationTracker->trkRot.z_fx = (Word32) float_to_fix( hIvasRend->headRotData.hOrientationTracker->trkRot.z, Q29 ); - hIvasRend->headRotData.hOrientationTracker->trkRot.w_qfact = hIvasRend->headRotData.hOrientationTracker->trkRot.x_qfact = - hIvasRend->headRotData.hOrientationTracker->trkRot.y_qfact = hIvasRend->headRotData.hOrientationTracker->trkRot.z_qfact = Q29; - error = ivas_orient_trk_GetTrackedRotation_fx( hIvasRend->headRotData.hOrientationTracker, pRotation ); - pRotation->w = fix_to_float( pRotation->w_fx, pRotation->w_qfact ); - pRotation->x = fix_to_float( pRotation->x_fx, pRotation->x_qfact ); - pRotation->y = fix_to_float( pRotation->y_fx, pRotation->y_qfact ); - pRotation->z = fix_to_float( pRotation->z_fx, pRotation->z_qfact ); - IF( error != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_orient_trk_GetTrackedRotation( hIvasRend->headRotData.hOrientationTracker, pRotation ) ) != IVAS_ERR_OK ) { return error; } -#endif return IVAS_ERR_OK; } +#endif /*---------------------------------------------------------------------* @@ -6546,7 +6854,8 @@ ivas_error IVAS_REND_CombineHeadAndExternalOrientation( * * *---------------------------------------------------------------------*/ -// ToDo: not used + +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetCombinedOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer processed orientation */ @@ -6569,6 +6878,7 @@ ivas_error IVAS_REND_GetCombinedOrientation( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -7352,6 +7662,14 @@ static ivas_error renderIsmToBinaural( } +#ifdef IVAS_FLOAT_FIXED +static Word16 getNumSubframesInBuffer( + const IVAS_REND_AudioBuffer *buffer, + const Word32 sampleRate ) +{ + return extract_l( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); +} +#else static int16_t getNumSubframesInBuffer( const IVAS_REND_AudioBuffer *buffer, const int32_t sampleRate ) @@ -7360,6 +7678,8 @@ static int16_t getNumSubframesInBuffer( return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); } +#endif + #ifdef IVAS_FLOAT_FIXED static ivas_error renderIsmToBinauralRoom( @@ -10024,6 +10344,39 @@ static ivas_error renderActiveInputsMasa( * Get metadata of the estimated MASA frame *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_GetMasaMetadata( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to analyzed MASA metadata */ + const IVAS_REND_AudioConfigType inputType /* i : Input type */ +) +{ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + /* Get the metadata handle */ + IF( EQ_32( inputType, IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) ) + { + *hMasaExtOutMeta = hIvasRend->inputsIsm->hOMasa->hMasaOut; + } + ELSE IF( EQ_32( inputType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + { + *hMasaExtOutMeta = hIvasRend->inputsMc->hMcMasa->hMasaOut; + } + ELSE IF( EQ_32( inputType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) + { + *hMasaExtOutMeta = hIvasRend->inputsSba->hDirAC->hMasaOut; + } + ELSE + { + return IVAS_ERR_NOT_SUPPORTED_OPTION; + } + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_GetMasaMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to analyzed MASA metadata */ @@ -10055,6 +10408,7 @@ ivas_error IVAS_REND_GetMasaMetadata( return IVAS_ERR_OK; } +#endif /*---------------------------------------------------------------------* @@ -10145,6 +10499,23 @@ ivas_error IVAS_REND_MergeMasaMetadata( * Set the total number of objects to the first object data *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetTotalNumberOfObjects( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const UWord16 total_num_objects /* i : total number of objects */ +) +{ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + hIvasRend->inputsIsm[0].total_num_objects = total_num_objects; + move16(); + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_SetTotalNumberOfObjects( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const uint16_t total_num_objects /* i : total number of objects */ @@ -10159,6 +10530,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( return IVAS_ERR_OK; } +#endif /*---------------------------------------------------------------------* diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index a5fb7b313..4c9728612 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -325,10 +325,17 @@ ivas_error IVAS_REND_MergeMasaMetadata( const IVAS_REND_AudioConfigType inputType2 /* i : Input type 2 */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetTotalNumberOfObjects( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const UWord16 total_num_objects /* i : total number of objects */ +); +#else ivas_error IVAS_REND_SetTotalNumberOfObjects( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const uint16_t total_num_objects /* i : total number of objects */ ); +#endif ivas_error IVAS_REND_SetIsmMetadataDelay( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ -- GitLab From 2091dc8a30082d43539d803ffc6e1428b9bad1e1 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sun, 5 May 2024 13:49:19 +0530 Subject: [PATCH 012/101] Fixed changes corresponding to float updates provided [x] Orient_track updates fixed implementation. [x] Fixed implementation for read_surround_coherence_hr --- lib_com/ivas_cnst.h | 4 + lib_com/mslvq_com.c | 4 + lib_com/options.h | 7 ++ lib_dec/ivas_qmetadata_dec.c | 89 ++++++---------- lib_dec/ivas_stereo_dft_dec.c | 8 ++ lib_enc/ivas_qmetadata_enc.c | 8 +- lib_rend/ivas_orient_trk.c | 191 +++++++++++++++++++++++----------- lib_rend/ivas_rotation.c | 68 ++++++++++-- lib_rend/ivas_stat_rend.h | 2 + 9 files changed, 252 insertions(+), 129 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 2e36dc469..dae981352 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1187,6 +1187,10 @@ enum #define MASA_MAXIMUM_DIRECTIONS 2 #define MASA_MAX_TRANSPORT_CHANNELS 2 +#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP +#define MASA_SUR_COH_THRESHOLD 1e-7f +#define MASA_SUR_COH_PRECISION 1e7f +#endif #define MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS 5 diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index 39a1c4c69..77fb370a7 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -919,7 +919,11 @@ void deindex_lvq_SHB( /* find idx_leader */ i = 1; +#ifdef NONBE_FIX_1054_NEGATIVE_LVQ_INDEX + while ( index > table_no_cv[i] ) +#else while ( index >= table_no_cv[i] ) +#endif { i++; } diff --git a/lib_com/options.h b/lib_com/options.h index ab10c15b7..366354dc8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -68,6 +68,12 @@ /* #################### End DEBUGGING switches ############################ */ +/* ################### Start FIXES switches ########################### */ + +#define NON_BE_FIX_1048_THRESHOLD_COH_BASOP /* Nokia: Fix 1048 replace comparison with 0 with comparison to threshold, to align with BASOP*/ +#define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ + +/* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ @@ -94,6 +100,7 @@ #define BE_FIX_832_ASAN_ERROR_EFAP_OSBA /* FhG: issue #832: fix ASAN error caused by re-allocating EFAP memories in OSBA*/ #define NONBE_FIX_819_DOUBLE_PREC_COMB_FORMATS /* VA: issue 820: Double precision arithmetic in combined formats */ #define NONBE_FIX_849_OMASA_BFI_CRASH /* VA: issue 849: fix OMASA 2TC and FEC crashes */ +#define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Quaternion slerp changes*/ #define IVAS_FLOAT_FIXED #define ISM_DISABLE #define FIX_TMP_714 diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 369ca37b0..9242d0672 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -7940,6 +7940,9 @@ static int16_t read_surround_coherence_hr( IVAS_QDIRECTION *q_direction; int16_t min_index; int16_t d, idx; +#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP + int32_t int_error_ratio_surr; +#endif coding_subbands = hQMetaData->q_direction[0].cfg.nbands; q_direction = hQMetaData->q_direction; @@ -7963,6 +7966,11 @@ static int16_t read_surround_coherence_hr( error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; } +#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP + int_error_ratio_surr = (int32_t)(MASA_SUR_COH_PRECISION * error_ratio_surr); + error_ratio_surr = (float)(int_error_ratio_surr * MASA_SUR_COH_THRESHOLD); +#endif + if ( error_ratio_surr <= 0 ) { error_ratio_surr = 0; @@ -8087,7 +8095,7 @@ static Word16 read_surround_coherence_hr_fx( Word16 coding_subbands; Word16 no_cv_vec[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 bit_pos; - Word32 error_ratio_surr_fx; + Word64 error_ratio_surr_fx; Word16 idx_ER[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 bits_sur_coherence, bits_GR; Word16 j, k, sf; @@ -8096,6 +8104,7 @@ static Word16 read_surround_coherence_hr_fx( IVAS_QDIRECTION *q_direction; Word16 min_index; Word16 d, idx; + Word32 int_error_ratio_surr; coding_subbands = hQMetaData->q_direction[0].cfg.nbands; q_direction = hQMetaData->q_direction; @@ -8105,63 +8114,24 @@ static Word16 read_surround_coherence_hr_fx( FOR( sf = 0; sf < hQMetaData->q_direction[0].cfg.nblocks; sf++ ) { d = 0; -#ifdef IVAS_FLOAT_FIXED_TBD - FOR( j = 0; j < coding_subbands; j++ ) - { - error_ratio_surr_fx = 1 << *q; - if ( hQMetaData->no_directions == 2 ) - { - d += hQMetaData->twoDirBands[j]; - idx = max( d - 1, 0 ); - error_ratio_surr_fx = L_sub( - L_sub( 1 << *q, q_direction[0].band_data[j].energy_ratio_fx[sf] ), - q_direction[1].band_data[idx].energy_ratio_fx[sf] * hQMetaData->twoDirBands[j] ); - } - ELSE - { - error_ratio_surr_fx = L_sub( 1 << *q, q_direction[0].band_data[j].energy_ratio_fx[sf] ); - } - if ( error_ratio_surr_fx <= 53667 ) // Assuming max error of 10^(-4) in q = 29 => 10^(-4) * 2^(29) - { - error_ratio_surr_fx = 0; - no_cv_vec[j] = 1; - idx_ER[j] = 0; - } - ELSE - { - idx_ER[j] = 7; // masa_sq( error_ratio_surr, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); - no_cv_vec[j] = idx_cb_sur_coh_masa[idx_ER[j]] + 2; - } - } -#else - /* NOTE: This block gives incorrect output with fixed point resulting in failures in pytest */ - /* TODO: Remove the intermediate conversion from fixed to float below */ - float tmp; - float energy_ratio_j_sf; - float energy_ratio_idx_sf; FOR( j = 0; j < coding_subbands; j++ ) { - energy_ratio_j_sf = (float) energy_ratio[0][j][sf] / ( ONE_IN_Q62 ); - - tmp = 1.0f; - IF( hQMetaData->no_directions == 2 ) + error_ratio_surr_fx = ONE_IN_Q62; + IF( EQ_32( hQMetaData->no_directions, 2 ) ) { - d += hQMetaData->twoDirBands[j]; - idx = max( d - 1, 0 ); - - energy_ratio_idx_sf = (float) energy_ratio[1][idx][sf] / ( ONE_IN_Q62 ); - - tmp = 1.0f - energy_ratio_j_sf - energy_ratio_idx_sf * hQMetaData->twoDirBands[j]; + d = add( d, hQMetaData->twoDirBands[j] ); + idx = s_max( sub( d, 1 ), 0 ); + error_ratio_surr_fx = W_sub( + W_sub( ONE_IN_Q62, energy_ratio[0][j][sf] ), + energy_ratio[1][idx][sf] * hQMetaData->twoDirBands[j] ); } ELSE { - tmp = 1.0f - energy_ratio_j_sf; + error_ratio_surr_fx = W_sub( ONE_IN_Q62, energy_ratio[0][j][sf] ); } - error_ratio_surr_fx = (Word32) ( tmp * ONE_IN_Q30 ); - - IF( error_ratio_surr_fx <= 0 ) + IF( LE_64( error_ratio_surr_fx, ( 461168601842 ) ) ) // 1e-7 in Q62 { error_ratio_surr_fx = 0; no_cv_vec[j] = 1; @@ -8173,9 +8143,8 @@ static Word16 read_surround_coherence_hr_fx( no_cv_vec[j] = idx_cb_sur_coh_masa[idx_ER[j]] + 2; } } -#endif // !IVAS_FLOAT_FIXED_TBD - IF( sum_s( no_cv_vec, coding_subbands ) == coding_subbands ) + IF( EQ_16( sum_s( no_cv_vec, coding_subbands ), coding_subbands ) ) { /* surround coherence is zero */ FOR( j = 0; j < coding_subbands; j++ ) @@ -8193,29 +8162,29 @@ static Word16 read_surround_coherence_hr_fx( { /* read how the surround coherence is encoded */ byteBuffer = bitstream[bit_pos--]; - bits_sur_coherence += 1; + bits_sur_coherence = add( bits_sur_coherence, 1 ); IF( byteBuffer & 1 ) { /* GR decoding */ /* read GR order */ byteBuffer = bitstream[bit_pos--]; - bits_sur_coherence += 1; + bits_sur_coherence = add( bits_sur_coherence, 1 ); /* read min index */ bits_GR = bit_pos; min_index = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, MASA_MAX_NO_CV_SUR_COH, 0 ); - bits_sur_coherence += bits_GR - bit_pos; + bits_sur_coherence = add( bits_sur_coherence, sub( bits_GR, bit_pos ) ); /* read GR data */ FOR( j = 0; j < coding_subbands; j++ ) { bits_GR = bit_pos; /* decoding for min removed */ - IF( no_cv_vec[j] > 1 ) + IF( GT_16( no_cv_vec[j], 1 ) ) { idx_sur_coh[j] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, no_cv_vec[j] - min_index, ( byteBuffer & 1 ) ); - bits_sur_coherence += bits_GR - bit_pos; + bits_sur_coherence = add( bits_sur_coherence, sub( bits_GR, bit_pos ) ); } ELSE { @@ -8225,9 +8194,9 @@ static Word16 read_surround_coherence_hr_fx( FOR( j = 0; j < coding_subbands; j++ ) { - IF( no_cv_vec[j] > 1 ) + IF( GT_16( no_cv_vec[j], 1 ) ) { - hQMetaData->surcoh_band_data[j].sur_coherence_index = idx_sur_coh[j] + min_index; + hQMetaData->surcoh_band_data[j].sur_coherence_index = L_add( (Word32) idx_sur_coh[j], L_deposit_l( min_index ) ); hQMetaData->surcoh_band_data[j].surround_coherence[sf] = sur_coherence_cb_masa[idx_cb_sur_coh_masa[idx_ER[j]] * MASA_MAX_NO_CV_SUR_COH + hQMetaData->surcoh_band_data[j].sur_coherence_index]; } ELSE @@ -8253,7 +8222,7 @@ static Word16 read_surround_coherence_hr_fx( /* deindex surround coherence */ FOR( j = 0; j < coding_subbands; j++ ) { - IF( no_cv_vec[j] > 1 ) + IF( GT_16( no_cv_vec[j], 1 ) ) { hQMetaData->surcoh_band_data[j].surround_coherence[sf] = sur_coherence_cb_masa[idx_cb_sur_coh_masa[idx_ER[j]] * MASA_MAX_NO_CV_SUR_COH + hQMetaData->surcoh_band_data[j].sur_coherence_index]; } @@ -8267,7 +8236,7 @@ static Word16 read_surround_coherence_hr_fx( } /* Replace return value with the actual read bits. bits_sur_coherence might show wrong count at this point. */ - bits_sur_coherence = *p_bit_pos - bit_pos; + bits_sur_coherence = sub( *p_bit_pos, bit_pos ); *p_bit_pos = bit_pos; return bits_sur_coherence; diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 711269dc5..c75400362 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -3049,7 +3049,11 @@ void stereo_dft_dec_smooth_parameters( if ( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ +#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO + if ( hStereoDft->ipd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) +#else if ( hStereoDft->gipd[k + k_offset] != hStereoDft->ipd_xfade_target ) +#endif { if ( ( hStereoDft->gipd[k + k_offset] - hStereoDft->ipd_xfade_prev ) > EVS_PI ) { @@ -3095,7 +3099,11 @@ void stereo_dft_dec_smooth_parameters( if ( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ +#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO + if ( hStereoDft->itd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) +#else if ( hStereoDft->itd[k + k_offset] != hStereoDft->itd_xfade_target ) +#endif { hStereoDft->itd_xfade_target = hStereoDft->itd[k + k_offset]; hStereoDft->itd_xfade_step = ( hStereoDft->itd_xfade_target - hStereoDft->itd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->itd_xfade_counter ); diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 5e1c4597e..5ca49dbbf 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -4515,6 +4515,9 @@ static int16_t encode_surround_coherence_hr( int16_t max_val = 0, nbits_max; int16_t no_cv_shift[MASA_MAXIMUM_CODING_SUBBANDS], min_idx; int16_t idx16; +#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP + int32_t int_error_ratio_surr; +#endif coding_subbands = hQMetaData->q_direction[0].cfg.nbands; all_coherence_zero = hQMetaData->all_coherence_zero; @@ -4544,7 +4547,10 @@ static int16_t encode_surround_coherence_hr( { error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; } - +#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP + int_error_ratio_surr = (int32_t) ( MASA_SUR_COH_PRECISION * error_ratio_surr ); + error_ratio_surr = (float) ( int_error_ratio_surr * MASA_SUR_COH_THRESHOLD ); +#endif if ( error_ratio_surr <= 0 ) { diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 0e92bf6b3..a6d08f15b 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -49,6 +49,10 @@ *------------------------------------------------------------------------------------------*/ #define OTR_UPDATE_RATE (float) FRAMES_PER_SEC /* rate of the Process() calls [Hz]; 1x per IVAS frame */ +#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION +#define COS_ONE_TENTH_DEGREE ( 0.999998476913288f ) +#endif +#define COS_ONE_TENTH_DEGREE_FX 2147480320 //Q31 /*------------------------------------------------------------------------------------------* @@ -298,21 +302,21 @@ static void QuaternionDivision_fx( IVAS_QUATERNION *const r, Word16 den_e ) { - float den = me2f( d, den_e ); - IVAS_QUATERNION q_flt; - Word16 e_temp; - q_flt.w = me2f( q.w_fx, 31 - q.w_qfact ); - q_flt.x = me2f( q.x_fx, 31 - q.x_qfact ); - q_flt.y = me2f( q.y_fx, 31 - q.y_qfact ); - q_flt.z = me2f( q.z_fx, 31 - q.z_qfact ); - f2me( ( q_flt.w / den ), &r->w_fx, &e_temp ); - r->w_qfact = 31 - e_temp; - f2me( ( q_flt.x / den ), &r->x_fx, &e_temp ); - r->x_qfact = 31 - e_temp; - f2me( ( q_flt.y / den ), &r->y_fx, &e_temp ); - r->y_qfact = 31 - e_temp; - f2me( ( q_flt.z / den ), &r->z_fx, &e_temp ); - r->z_qfact = 31 - e_temp; + Word16 scale_e, result_e = 0; + r->w_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.w_fx), d, &scale_e)); + result_e = scale_e + ((31 - q.w_qfact) - den_e); // e+e1-e2// + r->w_qfact = 31 - result_e; + r->x_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.x_fx), d, &scale_e)); + result_e = scale_e + ((31 - q.x_qfact) - den_e); + r->x_qfact = 31 - result_e; + r->y_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.y_fx), d, &scale_e)); + result_e = scale_e + ((31 - q.y_qfact) - den_e); + r->y_qfact = 31 - result_e; + r->z_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.z_fx), d, &scale_e)); + result_e = scale_e + ((31 - q.z_qfact) - den_e); + r->z_qfact = 31 - result_e; + + } #endif @@ -355,85 +359,156 @@ static void QuaternionNormalize_fx( * Computes a spherical linear interpolation between two quaternions *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void QuaternionSlerp( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, const float t, IVAS_QUATERNION *const r ) { - float angle, denom, s, s2; +#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION + IVAS_QUATERNION r1, r2; + float phi, sinPhi, cosPhi, s1, s2; - s = QuaternionDotProduct( q1, q2 ); + QuaternionNormalize( q1, &r1 ); + QuaternionNormalize( q2, &r2 ); + + cosPhi = QuaternionDotProduct( r1, r2 ); - if ( fabsf( s ) >= 1.0f ) + if ( cosPhi < 0 ) { + cosPhi = -cosPhi; + r2.w = -r2.w; + r2.x = -r2.x; + r2.y = -r2.y; + r2.z = -r2.z; + } - *r = q2; - return; + /* Angle less than one degree, use linear interpolation */ + if ( cosPhi >= COS_ONE_TENTH_DEGREE ) + { + r->w = r1.w + t * ( r2.w - r1.w ); + r->x = r1.x + t * ( r2.x - r1.x ); + r->y = r1.y + t * ( r2.y - r1.y ); + r->z = r1.z + t * ( r2.z - r1.z ); } + else + { + phi = acosf( cosPhi ); + sinPhi = sinf( phi ); - angle = acosf( s ); - denom = sinf( angle ); + s1 = sinf( ( 1 - t ) * phi ); + s2 = sinf( t * phi ); - s = sinf( ( 1 - t ) * angle ); - s2 = sinf( t * angle ); - r->x = ( q1.x * s + q2.x * s2 ) / denom; + r->w = ( s1 * r1.w + s2 * r2.w ) / sinPhi; + r->x = ( s1 * r1.x + s2 * r2.x ) / sinPhi; + r->y = ( s1 * r1.y + s2 * r2.y ) / sinPhi; + r->z = ( s1 * r1.z + s2 * r2.z ) / sinPhi; + } +#else + float angle, denom, s, s2; + + s = QuaternionDotProduct( q1, q2 ); r->y = ( q1.y * s + q2.y * s2 ) / denom; r->z = ( q1.z * s + q2.z * s2 ) / denom; r->w = ( q1.w * s + q2.w * s2 ) / denom; +#endif QuaternionNormalize( *r, r ); return; } -#ifdef IVAS_FLOAT_FIXED +#else void QuaternionSlerp_fx( const IVAS_QUATERNION q1_fx, const IVAS_QUATERNION q2_fx, const Word32 t_fx, IVAS_QUATERNION *const r_fx ) { - float angle, denom, s, s2; - float t = me2f( t_fx, 1 ); - IVAS_QUATERNION q1, q2; + IVAS_QUATERNION r1, r2; + Word32 sinPhi, cosPhi, temp_32; + Word16 q_min, sin_e, phi, s1, s2, temp_16, e_div; + + QuaternionNormalize_fx( q1_fx, &r1 ); + QuaternionNormalize_fx( q2_fx, &r2 ); + Word16 q_dot = 0; - Word32 s_fx = QuaternionDotProduct_fx( q1_fx, q2_fx, &q_dot ); - s = me2f( s_fx, 31 - q_dot ); + cosPhi = QuaternionDotProduct_fx( r1, r2, &q_dot ); + + q_min = s_min( s_min( r1.w_qfact, r1.x_qfact ), s_min( r1.y_qfact, r1.z_qfact ) ); + q_min = s_min( q_min, s_min( s_min( r1.w_qfact, r1.x_qfact ), s_min( r1.y_qfact, r1.z_qfact ) ) ); + r1.w_fx = L_shr( r1.w_fx, sub( r1.w_qfact, q_min ) ); + r1.x_fx = L_shr( r1.x_fx, sub( r1.x_qfact, q_min ) ); + r1.y_fx = L_shr( r1.y_fx, sub( r1.y_qfact, q_min ) ); + r1.z_fx = L_shr( r1.z_fx, sub( r1.z_qfact, q_min ) ); + r2.w_fx = L_shr( r2.w_fx, sub( r2.w_qfact, q_min ) ); + r2.x_fx = L_shr( r2.x_fx, sub( r2.x_qfact, q_min ) ); + r2.y_fx = L_shr( r2.y_fx, sub( r2.y_qfact, q_min ) ); + r2.z_fx = L_shr( r2.z_fx, sub( r2.z_qfact, q_min ) ); + r1.w_qfact = r1.x_qfact = r1.y_qfact = r1.z_qfact = r2.w_qfact = r2.x_qfact = r2.y_qfact = r2.z_qfact = q_min; + + IF( LT_32( cosPhi, 0 ) ) + { + cosPhi = L_negate( cosPhi ); + r2.w_fx = L_negate( r2.w_fx ); + r2.x_fx = L_negate( r2.x_fx ); + r2.y_fx = L_negate( r2.y_fx ); + r2.z_fx = L_negate( r2.z_fx ); + } - if ( fabsf( s ) >= 1.0f ) + /* Angle less than one degree, use linear interpolation */ + IF( GE_32( cosPhi, L_shr( COS_ONE_TENTH_DEGREE_FX, sub( 31, q_dot ) ) ) ) { - *r_fx = q2_fx; - return; + r_fx->w_fx = L_add( L_shr( r1.w_fx, 1 ), Mpy_32_32( L_sub( r2.w_fx, r1.w_fx ), t_fx ) ); // q_min-1 + r_fx->x_fx = L_add( L_shr( r1.x_fx, 1 ), Mpy_32_32( L_sub( r2.x_fx, r1.x_fx ), t_fx ) ); // q_min-1 + r_fx->y_fx = L_add( L_shr( r1.y_fx, 1 ), Mpy_32_32( L_sub( r2.y_fx, r1.y_fx ), t_fx ) ); // q_min-1 + r_fx->z_fx = L_add( L_shr( r1.z_fx, 1 ), Mpy_32_32( L_sub( r2.z_fx, r1.z_fx ), t_fx ) ); // q_min-1 + + r2.w_qfact = r2.x_qfact = r2.y_qfact = r2.z_qfact = sub( q_min, 1 ); } + ELSE + { + temp_32 = L_sub( L_shr( ONE_IN_Q31, sub( 62, 2 * q_dot ) ), ( Mpy_32_32( cosPhi, cosPhi ) ) ); + sin_e = sub( 62, 2 * q_dot ); + sinPhi = Sqrt32( temp_32, &sin_e ); - angle = acosf( s ); - denom = sinf( angle ); - - s = sinf( ( 1 - t ) * angle ); - s2 = sinf( t * angle ); - q1.w = me2f( q1_fx.w_fx, 31 - q1_fx.w_qfact ); - q1.x = me2f( q1_fx.x_fx, 31 - q1_fx.x_qfact ); - q1.y = me2f( q1_fx.y_fx, 31 - q1_fx.y_qfact ); - q1.z = me2f( q1_fx.z_fx, 31 - q1_fx.z_qfact ); - q2.w = me2f( q2_fx.w_fx, 31 - q2_fx.w_qfact ); - q2.x = me2f( q2_fx.x_fx, 31 - q2_fx.x_qfact ); - q2.y = me2f( q2_fx.y_fx, 31 - q2_fx.y_qfact ); - q2.z = me2f( q2_fx.z_fx, 31 - q2_fx.z_qfact ); - r_fx->x = ( q1.x * s + q2.x * s2 ) / denom; - r_fx->y = ( q1.y * s + q2.y * s2 ) / denom; - r_fx->z = ( q1.z * s + q2.z * s2 ) / denom; - r_fx->w = ( q1.w * s + q2.w * s2 ) / denom; - - r_fx->w_fx = float_to_fix(r_fx->w, Q29 ); - r_fx->x_fx = float_to_fix(r_fx->x, Q29 ); - r_fx->y_fx = float_to_fix(r_fx->y, Q29 ); - r_fx->z_fx = float_to_fix(r_fx->z, Q29 ); - r_fx->w_qfact = r_fx->x_qfact = r_fx->y_qfact = r_fx->z_qfact = Q29; - QuaternionNormalize_fx( *r_fx, r_fx ); + phi = BASOP_util_atan2( sinPhi, cosPhi, sub( sin_e, sub( 31, q_dot ) ) ); // Q13 + temp_32 = L_shl(Mpy_32_16_1( L_sub( ONE_IN_Q30, t_fx ), phi ),1); // Q29 + + temp_16 = extract_h( temp_32 ); // Q13 + s1 = getSineWord16R2( mult( temp_16, 20860 ) ); // Q15 + + temp_32 = L_shl(Mpy_32_16_1( t_fx, phi ),1); // Q29 + temp_16 = extract_h( temp_32 ); // Q13 + s2 = getSineWord16R2( mult( temp_16, 20860 ) ); // Q15 + + temp_32 = L_add( Mpy_32_16_1( r1.w_fx, s1 ), Mpy_32_16_1( r2.w_fx, s2 ) ); // q_min + r_fx->w_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + e_div = e_div + ( 31 - q_min - sin_e ); + r_fx->w_qfact = 31 - e_div; + + temp_32 = L_add( Mpy_32_16_1( r1.x_fx, s1 ), Mpy_32_16_1( r2.x_fx, s2 ) ); // q_min + r_fx->x_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + e_div = e_div + ( 31 - q_min - sin_e ); + r_fx->x_qfact = 31 - e_div; + + temp_32 = L_add( Mpy_32_16_1( r1.y_fx, s1 ), Mpy_32_16_1( r2.y_fx, s2 ) ); // q_min + r_fx->y_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + e_div = e_div + ( 31 - q_min - sin_e ); + r_fx->y_qfact = 31 - e_div; + + temp_32 = L_add( Mpy_32_16_1( r1.z_fx, s1 ), Mpy_32_16_1( r2.z_fx, s2 ) ); // q_min + r_fx->z_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + e_div = e_div + ( 31 - q_min - sin_e ); + r_fx->z_qfact = 31 - e_div; + } + + QuaternionNormalize_fx(*r_fx, r_fx); return; + } #endif diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 93b32afa1..fcd93b3ac 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1689,21 +1689,21 @@ ivas_error ivas_combined_orientation_open( identity.x = identity.y = identity.z = 0.0f; origo.x = origo.y = origo.z = 0.0f; #ifdef IVAS_FLOAT_FIXED - identity.w_fx = ONE_IN_Q30; - identity.w_qfact = 1; + identity.w_fx = ONE_IN_Q31; + identity.w_qfact = 31; identity.x_fx = 0; - identity.x_qfact = 1; + identity.x_qfact = 31; identity.y_fx = 0; - identity.y_qfact = 1; + identity.y_qfact = 31; identity.z_fx = 0; - identity.z_qfact = 1; + identity.z_qfact = 31; origo.x_fx = 0; - origo.x_qfact = 0; + origo.x_qfact = 31; origo.y_fx = 0; - origo.y_qfact = 0; + origo.y_qfact = 31; origo.z_fx = 0; - origo.z_qfact = 0; + origo.z_qfact = 31; #endif /* Allocate handle */ @@ -1980,7 +1980,31 @@ ivas_error combine_external_and_head_orientations( if ( hCombinedOrientationData->isInterpolationOngoing == true && hCombinedOrientationData->interpolationCoefficient <= 1.0f && are_orientations_same( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == true ) { /* Continue interpolation */ - QuaternionSlerp( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i] ); +#ifdef IVAS_FLOAT_FIXED + hCombinedOrientationData->interpolationCoefficient_fx = float_to_fix(hCombinedOrientationData->interpolationCoefficient, Q30); + hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.w, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.x, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.y, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.z, Q29); + + hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.w, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.x, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.y, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.z, Q29); + + hCombinedOrientationData->Quaternions_ext_interpolation_start.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.z_qfact = Q29; + hCombinedOrientationData->Quaternions_ext_interpolation_target.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.z_qfact = Q29; + + QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); + + hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].w_qfact); + hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].x_qfact); + hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].y_qfact); + hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].z_qfact); + +#else + QuaternionSlerp(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); +#endif hCombinedOrientationData->interpolationCoefficient += hCombinedOrientationData->interpolationIncrement; } else @@ -2231,7 +2255,31 @@ static void external_target_interpolation( /* Interpolate */ hCombinedOrientationData->isInterpolationOngoing = TRUE; - QuaternionSlerp( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i] ); +#ifdef IVAS_FLOAT_FIXED + hCombinedOrientationData->interpolationCoefficient_fx = float_to_fix(hCombinedOrientationData->interpolationCoefficient, Q30); + hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.w, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.x, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.y, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.z, Q29); + + hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.w, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.x, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.y, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.z, Q29); + + hCombinedOrientationData->Quaternions_ext_interpolation_start.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.z_qfact = Q29; + hCombinedOrientationData->Quaternions_ext_interpolation_target.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.z_qfact = Q29; + + QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); + + hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].w_qfact); + hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].x_qfact); + hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].y_qfact); + hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].z_qfact); + +#else + QuaternionSlerp(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); +#endif hCombinedOrientationData->interpolationCoefficient += hCombinedOrientationData->interpolationIncrement; } else diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index d3348f9dd..677ca58fe 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1104,6 +1104,8 @@ typedef struct ivas_combined_orientation_struct float procChEneIIR[2][MASA_FREQUENCY_BANDS]; #ifdef IVAS_FLOAT_FIXED Word32 lrSwitchInterpVal_fx; + Word32 interpolationCoefficient_fx; + Word32 interpolationIncrement_Fx; Word32 chEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ Word16 q_chEneIIR; Word32 procChEneIIR_fx[2][MASA_FREQUENCY_BANDS]; -- GitLab From 28865c3034ee39867fd83698cbd6349c3709d92d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sun, 5 May 2024 13:52:09 +0530 Subject: [PATCH 013/101] Change to using REFERENCE_BRANCH: "ivas-float-update" as reference We recently had two fixes that needed fixes in the float reference to keep the interoperability. There are currently two updates related to #738 and #739 to create floating point that is better suited for BASOP conversion, which also would go into the float reference. To avoid creating new tags for each of these updates, the idea is to use the branch as reference instead. --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de4488489..02e28fa0e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: TESTV_DIR: "/usr/local/testv" LTV_DIR: "/usr/local/ltv" EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" - REFERENCE_TAG: "20231128_Update_Ittiam" + REFERENCE_BRANCH: "ivas-float-update" BUILD_OUTPUT: "build_output.txt" SCRIPTS_DIR: "/usr/local/scripts" EXIT_CODE_NON_BE: 123 @@ -92,7 +92,8 @@ stages: .setup-codec: &setup-codec - current_commit_sha=$(git rev-parse HEAD) ### build reference binaries - - git checkout $REFERENCE_TAG + - git checkout $REFERENCE_BRANCH + - git pull - make clean - make -j - mv ./IVAS_cod ./IVAS_cod_ref -- GitLab From a38ca793b8b75c85359babde6911a31645faa5da Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 6 May 2024 13:31:08 +0530 Subject: [PATCH 014/101] Few renderer functions conv to fixed point, cleanup of float dependencies [x] chol2x2 fixed point implementation [x] efap functions cleanup [x] ivas_rotation.c and lib_rend.c intermediate float conversions cleanup [x] Fix for high MLD for EVS non-diegetic panning and OMASA case. --- apps/renderer.c | 108 +- lib_com/fft_fx.c | 18 + lib_com/ivas_prot.h | 7 +- lib_com/prot_fx2.h | 2 + lib_dec/ivas_binRenderer_internal.c | 201 ++- lib_dec/ivas_dirac_dec.c | 236 +++- lib_dec/ivas_init_dec.c | 91 +- lib_dec/ivas_ism_dec.c | 3 - lib_dec/ivas_ism_param_dec.c | 211 ++- lib_dec/ivas_ism_renderer.c | 4 +- lib_dec/ivas_mct_dec.c | 2 +- lib_dec/ivas_objectRenderer_internal.c | 415 +++--- lib_dec/ivas_osba_dec.c | 50 +- lib_dec/ivas_out_setup_conversion.c | 8 +- lib_dec/ivas_sba_dec.c | 10 +- lib_dec/lib_dec_fx.c | 17 +- lib_rend/ivas_allrad_dec.c | 6 +- lib_rend/ivas_dirac_ana.c | 472 ++++--- lib_rend/ivas_dirac_dec_binaural_functions.c | 253 +++- lib_rend/ivas_dirac_output_synthesis_dec.c | 511 ++++++- lib_rend/ivas_dirac_rend.c | 443 +++++- lib_rend/ivas_efap.c | 1279 ++++++++++++------ lib_rend/ivas_hrtf.c | 118 ++ lib_rend/ivas_objectRenderer.c | 128 +- lib_rend/ivas_objectRenderer_hrFilt.c | 124 +- lib_rend/ivas_objectRenderer_mix.c | 160 +-- lib_rend/ivas_objectRenderer_sources.c | 236 ++-- lib_rend/ivas_orient_trk.c | 13 +- lib_rend/ivas_prot_rend.h | 145 +- lib_rend/ivas_rotation.c | 32 +- lib_rend/ivas_stat_rend.h | 81 +- lib_rend/lib_rend.c | 968 ++++++++++++- lib_rend/lib_rend.h | 30 +- lib_util/hrtf_file_reader.c | 10 +- 34 files changed, 4894 insertions(+), 1498 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index bbc4213a1..bafeec725 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -643,6 +643,7 @@ int main( #ifdef IVAS_FLOAT_FIXED Word32 *outInt32Buffer; Word32 *inInt32Buffer; + Word32 gain_fx; #endif float *outFloatBuffer; IVAS_REND_AudioBuffer inBuffer; @@ -933,7 +934,9 @@ int main( } IVAS_REND_LfePanMtx lfePanMatrix; - +#ifdef IVAS_FLOAT_FIXED + IVAS_REND_LfePanMtx_fx lfePanMatrix_fx; +#endif /* parse input LFE panning matrix */ if ( args.lfeCustomRoutingEnabled && !isEmptyString( args.inLfePanningMatrixFile ) ) { @@ -968,17 +971,33 @@ int main( for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { +#ifndef IVAS_FLOAT_FIXED if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.multiChannelBuses[i].audioConfig, &mcIds[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } - if ( ( error = IVAS_REND_SetInputGain( hIvasRend, mcIds[i], args.inputGainGlobal * dBToLin( args.inConfig.multiChannelBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) + if ((error = IVAS_REND_SetInputGain(hIvasRend, mcIds[i], args.inputGainGlobal * dBToLin(args.inConfig.multiChannelBuses[i].gain_dB))) != IVAS_ERR_OK) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } +#else + IF( ( error = IVAS_REND_AddInput_fx( hIvasRend, args.inConfig.multiChannelBuses[i].audioConfig, &mcIds[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + + gain_fx = (Word32) ( ( args.inputGainGlobal * dBToLin( args.inConfig.multiChannelBuses[i].gain_dB ) ) * ( 1u << 30 ) ); + + IF ((error = IVAS_REND_SetInputGain_fx(hIvasRend, mcIds[i], gain_fx)) != IVAS_ERR_OK) { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } +#endif if ( args.inConfig.multiChannelBuses[i].audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { @@ -998,7 +1017,16 @@ int main( args.lfePanningEnabled = false; } +#ifdef IVAS_FLOAT_FIXED + FOR( Word16 k = 0; k < IVAS_MAX_OUTPUT_CHANNELS; k++ ) + { + ( *lfePanMatrix_fx )[k] = (Word32) ( ( *lfePanMatrix )[k] * ( 1u << 31 ) ); + } + + IF ( ( error = IVAS_REND_SetInputLfeMtx_fx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx_fx *) &lfePanMatrix_fx ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_SetInputLfeMtx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx *) &lfePanMatrix ) ) != IVAS_ERR_OK ) +#endif // IVAS_FLOAT_FIXED { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1007,7 +1035,12 @@ int main( /* set panning gains for input LFE */ else if ( args.lfePanningEnabled ) { +#ifdef IVAS_FLOAT_FIXED + Word32 inputGain = (Word32) ( args.lfeConfigGain * ( 1u << 31 ) ); + IF( ( error = IVAS_REND_SetInputLfePos_fx( hIvasRend, mcIds[i], inputGain, (Word16) args.lfeConfigAzimuth, (Word16) args.lfeConfigElevation ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_SetInputLfePos( hIvasRend, mcIds[i], args.lfeConfigGain, args.lfeConfigAzimuth, args.lfeConfigElevation ) ) != IVAS_ERR_OK ) +#endif // IVAS_FLOAT_FIXED { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1027,7 +1060,16 @@ int main( exit( -1 ); } +#ifdef IVAS_FLOAT_FIXED + FOR( Word16 k = 0; k < IVAS_MAX_OUTPUT_CHANNELS; k++ ) + { + ( *lfePanMatrix_fx )[k] = (Word32) ( ( *lfePanMatrix )[k] * ( 1u << 31 ) ); + } + + if ( ( error = IVAS_REND_SetInputLfeMtx_fx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx_fx *) &lfePanMatrix_fx ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_SetInputLfeMtx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx *) &lfePanMatrix ) ) != IVAS_ERR_OK ) +#endif // IVAS_FLOAT_FIXED { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1036,7 +1078,12 @@ int main( /* set position based gains */ else { +#ifdef IVAS_FLOAT_FIXED + Word32 inputGain = (Word32) ( lfeRoutingConfigs[i]->lfe_gain_dB * ( 1u << 31 ) ); + IF( ( error = IVAS_REND_SetInputLfePos_fx( hIvasRend, mcIds[i], inputGain, (Word16) lfeRoutingConfigs[i]->lfe_azi, (Word16) lfeRoutingConfigs[i]->lfe_ele ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_SetInputLfePos( hIvasRend, mcIds[i], lfeRoutingConfigs[i]->lfe_gain_dB, lfeRoutingConfigs[i]->lfe_azi, lfeRoutingConfigs[i]->lfe_ele ) ) != IVAS_ERR_OK ) +#endif // IVAS_FLOAT_FIXED { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1046,6 +1093,7 @@ int main( } } +#ifndef IVAS_FLOAT_FIXED for ( i = 0; i < args.inConfig.numAudioObjects; ++i ) { if ( ( error = IVAS_REND_AddInput( hIvasRend, IVAS_AUDIO_CONFIG_OBA, &ismIds[i] ) ) != IVAS_ERR_OK ) @@ -1082,7 +1130,6 @@ int main( } } - for ( i = 0; i < args.inConfig.numMasaBuses; ++i ) { if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.masaBuses[i].audioConfig, &masaIds[i] ) ) != IVAS_ERR_OK ) @@ -1097,6 +1144,61 @@ int main( exit( -1 ); } } +#else + FOR ( i = 0; i < args.inConfig.numAudioObjects; ++i ) + { + IF( ( error = IVAS_REND_AddInput_fx( hIvasRend, IVAS_AUDIO_CONFIG_OBA, &ismIds[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + + gain_fx = (Word32) ( args.inputGainGlobal * dBToLin( args.inConfig.audioObjects[i].gain_dB ) * ( 1u << 30 ) ); + IF( ( error = IVAS_REND_SetInputGain_fx( hIvasRend, ismIds[i], gain_fx) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + + /* With MASA output, all objects are handled at once, so add only one input having all objects in it */ + IF ( EQ_32(args.outConfig.audioConfig, IVAS_AUDIO_CONFIG_MASA1) || EQ_32(args.outConfig.audioConfig, IVAS_AUDIO_CONFIG_MASA2) ) + { + BREAK; + } + } + + FOR ( i = 0; i < args.inConfig.numAmbisonicsBuses; ++i ) + { + IF( ( error = IVAS_REND_AddInput_fx( hIvasRend, args.inConfig.ambisonicsBuses[i].audioConfig, &sbaIds[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + + gain_fx = (Word32) ( args.inputGainGlobal * dBToLin( args.inConfig.ambisonicsBuses[i].gain_dB ) * ( 1u << 30 ) ); + IF ( ( error = IVAS_REND_SetInputGain_fx( hIvasRend, sbaIds[i], gain_fx ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } + + FOR ( i = 0; i < args.inConfig.numMasaBuses; ++i ) + { + IF( ( error = IVAS_REND_AddInput_fx( hIvasRend, args.inConfig.masaBuses[i].audioConfig, &masaIds[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + + gain_fx = (Word32) ( ( args.inputGainGlobal * dBToLin( args.inConfig.masaBuses[i].gain_dB ) ) * ( 1u << 30 ) ); + IF ( ( error = IVAS_REND_SetInputGain_fx( hIvasRend, masaIds[i], gain_fx) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } +#endif // !IVAS_FLOAT_FIXED const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds ); diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index f8fb4c139..d9f565bef 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -5467,6 +5467,24 @@ Word16 L_norm_arr( Word32 *arr, Word16 size ) return q; } +Word16 get_min_scalefactor( Word32 x, Word32 y ) +{ + Word16 scf = Q31; + IF( EQ_32( x, 0 ) && EQ_32( y, 0 ) ) + { + return 0; + } + IF( NE_32( x, 0 ) ) + { + scf = s_min( scf, norm_l( x ) ); + } + IF( NE_32( y, 0 ) ) + { + scf = s_min( scf, norm_l( y ) ); + } + return scf; +} + #if 0 /* Functions are already in fixed point and available in fft.c file */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4341c8900..0361dacfa 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -6451,10 +6451,15 @@ void ivas_spar_param_to_masa_param_mapping_fx( /*---------------------------------------------------------------------------------* * Binaural FastConv Renderer Prototypes *-----------------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_binRenderer_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#else ivas_error ivas_binRenderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#endif void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index a7e85e021..88ece4c55 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -4254,6 +4254,8 @@ Word16 find_guarded_bits_fx(Word32 n); Word16 L_norm_arr(Word32* arr, Word16 size); +Word16 get_min_scalefactor( Word32 x, Word32 y ); + void edct2_fx_ivas( const Word16 n, const Word16 isgn, diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 04c22da10..e360e599e 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -46,6 +46,7 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_rom_com_fx.h" #include "debug.h" #define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) #define float_to_fixQ29( n ) float_to_fix( n, Q29 ) @@ -1601,8 +1602,8 @@ static void ivas_binaural_obtain_DMX_fx( * * Open fastconv binaural renderer handle *-------------------------------------------------------------------------*/ - -ivas_error ivas_binRenderer_open( +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_binRenderer_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { @@ -1683,7 +1684,7 @@ ivas_error ivas_binRenderer_open( IF( st_ivas->hoa_dec_mtx == NULL ) { - IF( ( error = ivas_sba_get_hoa_dec_matrix( out_setup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_sba_get_hoa_dec_matrix_fx( out_setup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } @@ -1746,11 +1747,7 @@ ivas_error ivas_binRenderer_open( { FOR( k = 0; k < hBinRenderer->nInChannels; k++ ) { -#ifndef IVAS_FLOAT_FIXED - hBinRenderer->hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; -#else hBinRenderer->hReverb->dmxmtx_fx[chIdx][k] = dmxmtx_table_fx[chIdx][k]; -#endif } } } @@ -1767,17 +1764,13 @@ ivas_error ivas_binRenderer_open( { FOR( k = 0; k < 11; k++ ) { -#ifndef IVAS_FLOAT_FIXED - ivas_dirac_dec_get_response( (int16_t) ls_azimuth_CICP19[k], (int16_t) ls_elevation_CICP19[k], hBinRenderer->hReverb->foa_enc[k], 1 ); -#else - ivas_dirac_dec_get_response_fixed( (int16_t) ls_azimuth_CICP19[k], (int16_t) ls_elevation_CICP19[k], hBinRenderer->hReverb->foa_enc_fx[k], 1 ); + ivas_dirac_dec_get_response_fixed( (Word16) L_shr_r( ls_azimuth_CICP19_fx[k], 22 ), (Word16) L_shr_r( ls_elevation_CICP19_fx[k], 22 ), hBinRenderer->hReverb->foa_enc_fx[k], 1 ); // Q29: hBinRenderer->hReverb->foa_enc_fx[k] -#endif } } ELSE IF( st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { - IF( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -1792,7 +1785,189 @@ ivas_error ivas_binRenderer_open( return error; } +#else +ivas_error ivas_binRenderer_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + BINAURAL_RENDERER_HANDLE hBinRenderer; + int16_t convBand, chIdx, k; + ivas_error error; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hBinRenderer = (BINAURAL_RENDERER_HANDLE) malloc( sizeof( BINAURAL_RENDERER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Renderer\n" ) ); + } + + hBinRenderer->hInputSetup = &st_ivas->hIntSetup; + + /* Define of head rotation has to be done in binRendeder in CLDFB*/ + hBinRenderer->rotInCldfb = 0; + if ( st_ivas->ivas_format == MC_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) + { + hBinRenderer->rotInCldfb = 1; + } + + + /* Declare some common variables needed for renderer */ + /* Which format used for binaural rendering (needed for late reverb) ? MC or SBA */ + if ( st_ivas->hIntSetup.is_loudspeaker_setup ) + { + hBinRenderer->ivas_format = MC_FORMAT; + } + else + { + hBinRenderer->ivas_format = SBA_FORMAT; + } + hBinRenderer->max_band = (int16_t) ( ( BINAURAL_MAXBANDS * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + convBand = hBinRenderer->max_band; + + hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ + + if ( convBand > BINAURAL_CONVBANDS ) + { + hBinRenderer->conv_band = BINAURAL_CONVBANDS; + } + else + { + hBinRenderer->conv_band = convBand; + } + + /*LFE rendering switched off by default*/ + hBinRenderer->render_lfe = 0; + + if ( st_ivas->ivas_format != ISM_FORMAT && st_ivas->hIntSetup.is_loudspeaker_setup ) + { + hBinRenderer->render_lfe = 1; + } + + /* Load HRTF tables */ + if ( ( error = ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && ( st_ivas->hIntSetup.is_loudspeaker_setup == 0 ) ) + { + IVAS_OUTPUT_SETUP out_setup; + + /* Allocate memories and buffers needed for convolutional module in CICP19 */ + if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, IVAS_AUDIO_CONFIG_7_1_4, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_output_init( &out_setup, IVAS_AUDIO_CONFIG_7_1_4 ); + + if ( st_ivas->hoa_dec_mtx == NULL ) + { + if ( ( error = ivas_sba_get_hoa_dec_matrix( out_setup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx; + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + } + else + { + /* Allocate memories and buffers needed for convolutional module */ + if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + if ( hBinRenderer->ivas_format == MC_FORMAT ) + { + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); + } + else + { + if ( hBinRenderer->nInChannels == 16 ) + { + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); + } + else if ( hBinRenderer->nInChannels == 9 ) + { + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s * 1000000000.f ); + } + else if ( hBinRenderer->nInChannels == 4 ) + { + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s * 1000000000.f ); + } + else + { + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + } + } + else + { + /* same value for MC or HOA both use MC BRIR*/ + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + } + } + + /* Allocate memories needed for reverb module */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + if ( ( error = ivas_binaural_reverb_open_fastconv( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* initialize the dmx matrix */ + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < hBinRenderer->nInChannels; k++ ) + { + hBinRenderer->hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; + } + } + } + else + { + hBinRenderer->hReverb = NULL; + } + + hBinRenderer->hEFAPdata = NULL; + + if ( hBinRenderer->hReverb != NULL ) + { + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) + { + for ( k = 0; k < 11; k++ ) + { + ivas_dirac_dec_get_response( (int16_t) ls_azimuth_CICP19[k], (int16_t) ls_elevation_CICP19[k], hBinRenderer->hReverb->foa_enc[k], 1 ); + } + } + else if ( st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) + { + if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + /* Copy handles to bin renderer handle*/ + hBinRenderer->hEFAPdata = st_ivas->hEFAPdata; + } + } + + /* Copy the handles to main handle */ + st_ivas->hBinRenderer = hBinRenderer; + + return error; +} +#endif /*------------------------------------------------------------------------- * ivas_binRenderer_convModuleClose() diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 0a00321e0..425d5ef1e 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -709,7 +709,7 @@ static ivas_error ivas_dirac_rend_config_fx( free( st_ivas->hoa_dec_mtx ); st_ivas->hoa_dec_mtx = NULL; } - IF( ( error = ivas_sba_get_hoa_dec_matrix( hDirACRend->hOutSetup, &st_ivas->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &st_ivas->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } @@ -5062,6 +5062,236 @@ void ivas_dirac_dec_render_sf_fx( } /*Compute PSDs*/ +#ifdef IVAS_FLOAT_FIXED +#if 1 // TO BE REMOVED + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + + Word16 num_channels_dir = hDirACRend->num_outputs_dir; + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + { + num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE; + } + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) + { + IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) + { + IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) + { + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + } + } + + if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + } + else if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) + { + IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) + { + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + } + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + floatToFixed_arrL32( reference_power, reference_power_fix, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands * (min( 4, nchan_transport ) + 1)); + } + else + { + + } + } + + if ( h_dirac_output_synthesis_params->use_onset_filters && (hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD)) + { + h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, h_dirac_output_synthesis_params->max_band_decorr ); + + h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); + + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + floatToFixed_arrL(hDirACRend->stack_mem.onset_filter, p_onset_filter_fx, Q30, ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ? hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands : 2 * hSpatParamRendCom->num_freq_bands ); + } + + if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD) + { + h_dirac_output_synthesis_state->direct_power_factor_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->direct_responses_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_q, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->direct_responses_square_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->direct_responses_square_q, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); + } +#endif + IF ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) + { + ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fix, + DirAC_mem.reference_power_q, + p_onset_filter_fx, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector_fx[md_idx], + hSpatParamRendCom->q_diffuseness_vector, + hSpatParamRendCom, + hDirACRend, + st_ivas->hCombinedOrientationData->shd_rot_max_order, + p_Rmat_fx, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); + } + ELSE + { + ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fix, + DirAC_mem.reference_power_q, + p_onset_filter_fx, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector_fx[md_idx], + hSpatParamRendCom->q_diffuseness_vector, + hSpatParamRendCom, + hDirACRend, + 0, + 0, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); + } + +#if 1 + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) + { + IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + + IF( hodirac_flag ) + { + fixedToFloat_arrL( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + ELSE + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + } + if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL(h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_q, 2*hSpatParamRendCom->num_freq_bands); + fixedToFloat_arrL(h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_q, 2*hSpatParamRendCom->num_freq_bands); + } + else + { + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 -hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); + } + } + } + else if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + + IF( hodirac_flag ) + { + fixedToFloat_arrL( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + ELSE + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->diffuse_power_factor_q ); + } + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, (num_channels_dir) * hSpatParamRendCom->num_freq_bands ); + } + else + { + + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); + } + + } + } + + if ( h_dirac_output_synthesis_params->use_onset_filters && (hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD)) + { + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); + } + + if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD) + { + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + } +#endif +#else if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) { ivas_dirac_dec_output_synthesis_process_slot( reference_power, @@ -5098,7 +5328,7 @@ void ivas_dirac_dec_render_sf_fx( hodirac_flag, hDirAC->hConfig->dec_param_estim ); } - +#endif if ( hDirAC->hConfig->dec_param_estim ) { float fac = 1.0f / (float) hSpatParamRendCom->subframe_nbslots[subframe_idx]; @@ -5405,7 +5635,7 @@ void ivas_dirac_dec_render_sf_fx( { const Word32 azi_fx = L_shl( az1, Q22 ); // Q0 -> Q22 const Word32 ele_fx = L_shl( el1, Q22 ); // Q0 -> Q22 - efap_determine_gains_fixed( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azi_fx, ele_fx, EFAP_MODE_EFAP ); + efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azi_fx, ele_fx, EFAP_MODE_EFAP ); } } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4f8a83419..389641099 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -431,9 +431,6 @@ ivas_error ivas_dec_setup( Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; - Src_p->SrcSpatial_p->DistAtten.RefDist = 1.0f; - Src_p->SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ - Src_p->SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); @@ -572,9 +569,6 @@ ivas_error ivas_dec_setup( Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; - Src_p->SrcSpatial_p->DistAtten.RefDist = 1.0f; - Src_p->SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ - Src_p->SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); @@ -1237,24 +1231,44 @@ ivas_error ivas_init_decoder_front( IF ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) { - IF ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) +#ifdef IVAS_FLOAT_FIXED + IF( ( error = ivas_HRTF_binary_open_fx( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( ( error = ivas_HRTF_CRend_binary_open_fx( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = ivas_HRTF_CRend_binary_open( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = ivas_HRTF_CRend_binary_open( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + IF ( ( error = ivas_HRTF_fastconv_binary_open( &st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = ivas_HRTF_parambin_binary_open( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#ifdef IVAS_FLOAT_FIXED + IF( ( error = ivas_HRTF_parambin_binary_open_fx( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } +#else + if ( ( error = ivas_HRTF_parambin_binary_open( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif } /*-------------------------------------------------------------------* @@ -1467,7 +1481,11 @@ ivas_error ivas_init_decoder_fx( /* init EFAP for custom LS output and set hTransSetup */ IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hOutSetup.ls_azimuth, st_ivas->hOutSetup.ls_elevation, st_ivas->hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + /*float2fix block: to be removed*/ + floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_azimuth, (Word32 *) st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); + floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_elevation, (Word32 *) st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); + /*float2fix block end*/ + IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hOutSetup.ls_azimuth_fx, st_ivas->hOutSetup.ls_elevation_fx, st_ivas->hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -1540,7 +1558,11 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { - IF ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + /*float2fix block: to be removed*/ + floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + /*float2fix end*/ + IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } @@ -1693,7 +1715,11 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { - IF ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + /*float2fix block: to be removed*/ + floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + /*float2fix end*/ + IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } @@ -1889,7 +1915,11 @@ ivas_error ivas_init_decoder_fx( /* init EFAP for custom LS setup */ IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + /*float2fix block: to be removed*/ + floatToFixed_arrL(st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_azimuth_fx, Q22, st_ivas->hLsSetupCustom->num_spk); + floatToFixed_arrL(st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->ls_elevation_fx, Q22, st_ivas->hLsSetupCustom->num_spk); + /*float2fix block end*/ + IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth_fx, st_ivas->hLsSetupCustom->ls_elevation_fx, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -1924,7 +1954,11 @@ ivas_error ivas_init_decoder_fx( /* init EFAP for custom LS setup */ IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + /*float2fix block: to be removed*/ + floatToFixed_arrL(st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_azimuth_fx, Q22, st_ivas->hLsSetupCustom->num_spk); + floatToFixed_arrL(st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->ls_elevation_fx, Q22, st_ivas->hLsSetupCustom->num_spk); + /*float2fix block end*/ + IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth_fx, st_ivas->hLsSetupCustom->ls_elevation_fx, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -1964,7 +1998,11 @@ ivas_error ivas_init_decoder_fx( /* init EFAP for custom LS setup */ IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + /*float2fix block: to be removed*/ + floatToFixed_arrL(st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_azimuth_fx, Q22, st_ivas->hLsSetupCustom->num_spk); + floatToFixed_arrL(st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->ls_elevation_fx, Q22, st_ivas->hLsSetupCustom->num_spk); + /*float2fix block end*/ + IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth_fx, st_ivas->hLsSetupCustom->ls_elevation_fx, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -2195,8 +2233,7 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - - IF ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_binRenderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -2261,7 +2298,7 @@ ivas_error ivas_init_decoder_fx( { IF ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { - IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -4124,20 +4161,36 @@ void ivas_destroy_dec( #ifdef IVAS_FLOAT_FIXED BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); #endif +#ifdef IVAS_FLOAT_FIXED + ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD ); +#else ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); +#endif } /* CRend binaural renderer handle */ +#ifdef IVAS_FLOAT_FIXED + ivas_HRTF_CRend_binary_close_fx( &st_ivas->hSetOfHRTF ); +#else ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); +#endif /* Fastconv HRTF memories */ ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv ); +#ifdef IVAS_FLOAT_FIXED + /* Fastconv HRTF filters */ + ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv ); + + /* Parametric binauralizer HRTF filters */ + ivas_HRTF_parambin_binary_close_fx( &st_ivas->hHrtfParambin ); +#else /* Fastconv HRTF filters */ ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); /* Parametric binauralizer HRTF filters */ - ivas_HRTF_parambin_binary_close( &st_ivas->hHrtfParambin ); + ivas_HRTF_parambin_binary_close(&st_ivas->hHrtfParambin); +#endif /* Config. Renderer */ ivas_render_config_close( &( st_ivas->hRenderConfig ) ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 57fa0c8ce..2028e6cf8 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -657,9 +657,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; - Src_p->SrcSpatial_p->DistAtten.RefDist = 1.0f; - Src_p->SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ - Src_p->SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index e17a48831..eb6e5a174 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -865,7 +865,7 @@ static void ivas_param_ism_update_mixing_matrix( * * Open Param ISM handle *-------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED ivas_error ivas_param_ism_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -981,7 +981,7 @@ ivas_error ivas_param_ism_dec_open( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) { /* Initialize efap handle */ - if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), hOutSetup.ls_azimuth, hOutSetup.ls_elevation, hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + if ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -1118,7 +1118,210 @@ ivas_error ivas_param_ism_dec_open( pop_wmops(); return error; } +#else +ivas_error ivas_param_ism_dec_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t i; + PARAM_ISM_DEC_HANDLE hParamIsmDec; + IVAS_OUTPUT_SETUP hOutSetup; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + AUDIO_CONFIG output_config; + int32_t output_Fs; + ivas_error error; + + error = IVAS_ERR_OK; + + push_wmops( "ivas_param_ism_dec_open" ); + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hParamIsmDec = (PARAM_ISM_DEC_HANDLE) malloc( sizeof( PARAM_ISM_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM\n" ) ); + } + + if ( ( hSpatParamRendCom = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + /* Assign memory to Param Object handle */ + if ( ( hParamIsmDec->hParamIsm = (PARAM_ISM_CONFIG_HANDLE) malloc( sizeof( PARAM_ISM_CONFIG_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM\n" ) ); + } + + if ( ( hParamIsmDec->hParamIsmRendering = (PARAM_ISM_RENDERING_HANDLE) malloc( sizeof( PARAM_ISM_RENDERING_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM Rendering handle\n" ) ); + } + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + output_config = st_ivas->hDecoderConfig->output_config; + + ivas_param_ism_config( hParamIsmDec->hParamIsm, st_ivas->nchan_ism ); + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + hSpatParamRendCom->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + set_s( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hSpatParamRendCom->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hSpatParamRendCom->subframes_rendered = 0; + hSpatParamRendCom->slots_rendered = 0; + hSpatParamRendCom->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + hSpatParamRendCom->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + + hParamIsmDec->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; + + for ( i = 0; i < ( hParamIsmDec->hParamIsm->nbands + 1 ); i++ ) + { + hParamIsmDec->hParamIsm->band_grouping[i] = Param_ISM_band_grouping[i]; + + if ( hParamIsmDec->hParamIsm->band_grouping[i] > hSpatParamRendCom->num_freq_bands ) + { + hParamIsmDec->hParamIsm->band_grouping[i] = hSpatParamRendCom->num_freq_bands; + } + } + + /*-----------------------------------------------------------------* + * output setup + *-----------------------------------------------------------------*/ + + /* hIntSetup and hOutSetup differs only for Binaural rendering */ + if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + /* nchan_out is essential for memory initialization for CLDFB Synthesis */ + st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->nchan_ism; + st_ivas->hIntSetup.is_loudspeaker_setup = 1; + } + + hOutSetup = st_ivas->hIntSetup; + + if ( !( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) + { + /* Initialize Param ISM Rendering handle */ + if ( st_ivas->hDecoderConfig->Opt_tsm ) + { + if ( ( error = ivas_param_ism_rendering_init( hParamIsmDec->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, MAX_JBM_CLDFB_TIMESLOTS, output_config ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( ( error = ivas_param_ism_rendering_init( hParamIsmDec->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, CLDFB_NO_COL_MAX, output_config ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + if ( !( output_config == IVAS_AUDIO_CONFIG_EXTERNAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || + output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) + { + /* Initialize efap handle */ + if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), hOutSetup.ls_azimuth, hOutSetup.ls_elevation, hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Azi and Ele values are transmitted once per frame per object */ + set_zero( hParamIsmDec->azimuth_values, MAX_NUM_OBJECTS ); + set_zero( hParamIsmDec->elevation_values, MAX_NUM_OBJECTS ); + + hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + hSpatParamRendCom->dirac_bs_md_write_idx = 0; + hSpatParamRendCom->dirac_read_idx = 0; + + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + st_ivas->hISMDTX.dtx_flag = 0; + + st_ivas->hParamIsmDec = hParamIsmDec; + st_ivas->hSpatParamRendCom = hSpatParamRendCom; + + + if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) + { + int16_t nchan_transport = st_ivas->nchan_transport; + int16_t nchan_full = 0; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + nchan_full = nchan_transport; + hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + } + else + { + int16_t n_slots_to_alloc; + if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) + { + n_slots_to_alloc = MAX_JBM_CLDFB_TIMESLOTS; + } + else + { + n_slots_to_alloc = CLDFB_SLOTS_PER_SUBFRAME * MAX_PARAM_SPATIAL_SUBFRAMES; + } + if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); + } + set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); + + if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); + } + set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); + } + + if ( st_ivas->hTcBuffer == NULL ) + { + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else + { + hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + if ( st_ivas->hTcBuffer == NULL ) + { + int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + pop_wmops(); + return error; +} +#endif /*-------------------------------------------------------------------------* * ivas_param_ism_dec_close() @@ -1649,7 +1852,7 @@ void ivas_ism_dec_digest_tc_fx( { azimuth_fx = L_shl( azimuth_fx, Q22 ); elevation_fx = L_shl( elevation_fx, Q22 ); - efap_determine_gains_fixed( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); + efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); } } ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || @@ -1877,7 +2080,7 @@ void ivas_param_ism_dec_digest_tc( #ifdef IVAS_FLOAT_FIXED FOR( i = 0; i < st_ivas->nchan_ism; i++ ) { - efap_determine_gains_fixed( st_ivas->hEFAPdata, direct_response_fx[i], hParamIsmDec->azimuth_values_fx[i], hParamIsmDec->elevation_values_fx[i], EFAP_MODE_EFAP ); + efap_determine_gains_fx( st_ivas->hEFAPdata, direct_response_fx[i], hParamIsmDec->azimuth_values_fx[i], hParamIsmDec->elevation_values_fx[i], EFAP_MODE_EFAP ); } FOR( i = 0; i < st_ivas->nchan_ism; i++ ) diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 0e7d2deaa..1b45dbe78 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -129,7 +129,7 @@ ivas_error ivas_ism_renderer_open_fx( IF ( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth != NULL && st_ivas->hIntSetup.ls_elevation != NULL && st_ivas->hEFAPdata == NULL ) { - IF ( ( error = efap_init_data_fixed( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -433,7 +433,7 @@ void ivas_ism_render_sf_fx( IF ( st_ivas->hEFAPdata != NULL ) { - efap_determine_gains_fixed( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], L_shl(azimuth, 22), L_shl(elevation, 22), EFAP_MODE_EFAP ); + efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], L_shl(azimuth, 22), L_shl(elevation, 22), EFAP_MODE_EFAP ); } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 9f79b6a6f..9aa0a7109 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -2054,7 +2054,7 @@ static ivas_error ivas_mc_dec_reconfig( /* init necessary new renderers */ IF ( st_ivas->hBinRenderer == NULL && ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) { - IF ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_binRenderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 235e1cfad..1c9ec0308 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -130,213 +130,6 @@ ivas_error ivas_td_binaural_renderer( * and renders the current frame. *---------------------------------------------------------------------*/ -ivas_error ivas_td_binaural_renderer_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ - const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ -) -{ - int16_t first_sf, last_sf, subframe_idx; - float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - float *p_reverb_signal[BINAURAL_CHANNELS]; - float *output_f_local[BINAURAL_CHANNELS]; - float *tc_local[MAX_TRANSPORT_CHANNELS]; - int16_t ch, slot_size, slots_to_render, output_frame; - ivas_error error; - - int16_t ism_md_subframe_update_jbm; - int16_t c_indx, nS; - int16_t nchan_ism_internal, nchan_ism, ch_offset; - - /* Set the number of ISMs */ - if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) - { - nchan_ism_internal = st_ivas->nchan_ism; - nchan_ism = st_ivas->nchan_ism; - ch_offset = 2; - } - else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - nchan_ism_internal = st_ivas->nchan_ism; - nchan_ism = st_ivas->nchan_ism; - ch_offset = 0; - } - else - { - nchan_ism_internal = st_ivas->hTcBuffer->nchan_transport_internal; - nchan_ism = st_ivas->nchan_transport; - ch_offset = 0; - } - - /* Number of subframes to delay metadata to sync with audio */ - if ( st_ivas->hDecoderConfig->Opt_delay_comp ) - { - ism_md_subframe_update_jbm = max( 0, st_ivas->hTcBuffer->nb_subframes - 3 ); - } - else - { - ism_md_subframe_update_jbm = st_ivas->hTcBuffer->nb_subframes - 2; - } - - if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) - { - ism_md_subframe_update_jbm = max( 0, st_ivas->hTcBuffer->nb_subframes - 2 ); - } - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - p_reverb_signal[ch] = reverb_signal[ch]; - } - - for ( ch = 0; ch < nchan_ism_internal; ch++ ) - { - tc_local[ch] = st_ivas->hTcBuffer->tc[ch + ch_offset] + st_ivas->hTcBuffer->n_samples_rendered; - } - - for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) - { - output_f_local[ch] = output[ch]; - } - - slot_size = st_ivas->hTcBuffer->n_samples_granularity; - - /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_granularity / slot_size ); - first_sf = st_ivas->hTcBuffer->subframes_rendered; - last_sf = first_sf; - st_ivas->hTcBuffer->slots_rendered += slots_to_render; - - while ( slots_to_render > 0 ) - { - slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; - last_sf++; - } - - for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) - { - output_frame = st_ivas->hTcBuffer->subframe_nbslots[subframe_idx] * st_ivas->hTcBuffer->n_samples_granularity; - - /* Update object position(s) */ - c_indx = 0; - - for ( nS = 0; nS < nchan_ism; nS++ ) - { - if ( !( st_ivas->ivas_format == MC_FORMAT && nS == LFE_CHANNEL ) ) /* Skip LFE for MC */ - { - st_ivas->hBinRendererTd->Sources[c_indx]->InputFrame_p = tc_local[nS]; - st_ivas->hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; - c_indx++; - } - } - if ( subframe_idx == ism_md_subframe_update_jbm ) - { - if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* Update the listener's location/orientation */ - if ( ( error = TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, - ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] : 0, - ( st_ivas->hCombinedOrientationData != NULL ) ? &st_ivas->hCombinedOrientationData->Quaternions[st_ivas->hCombinedOrientationData->subframe_idx] : NULL, - ( st_ivas->hCombinedOrientationData != NULL ) ? &st_ivas->hCombinedOrientationData->listenerPos[st_ivas->hCombinedOrientationData->subframe_idx] : NULL ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { -#ifdef IVAS_FLOAT_FIXED - Word16 i,j,exp; - Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; - Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; - Word32 *pcm_out_fx[BINAURAL_CHANNELS]; - Word16 nchan_transport = audioCfg2channels( st_ivas->transport_config ); - REVERB_HANDLE hReverb = st_ivas->hReverb; - exp = Q7; - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - pcm_in_fx[i] = pcm_in_buff[i]; - } - for ( i = 0; i < nchan_transport; i++ ) - { - - for ( j = 0; j < ( ( 0 + 1 ) * hReverb->full_block_size ); j++ ) - { - - pcm_in_fx[i][j] = (Word32) float_to_fixed( tc_local[i][j], exp ); - } - } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - pcm_out_fx[i] = pcm_out_buff[i]; - } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - - for ( j = 0; j < ( hReverb->full_block_size ); j++ ) - { - pcm_out_fx[i][0 * hReverb->full_block_size + j] = (Word32) float_to_fixed( p_reverb_signal[i][0 * hReverb->full_block_size + j], ( exp ) ); - } - } - - if ( ( error = ivas_reverb_process_fx( st_ivas->hReverb, st_ivas->transport_config, 0, pcm_in_fx, pcm_out_fx, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_process( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local, p_reverb_signal, 0 ) ) != IVAS_ERR_OK ) -#endif - { - return error; - } -#ifdef IVAS_FLOAT_FIXED - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - - for ( j = 0; j < ( hReverb->full_block_size ); j++ ) - { - - p_reverb_signal[i][0 * hReverb->full_block_size + j] = fixed_to_float( pcm_out_fx[i][0 * hReverb->full_block_size + j], ( exp - 2 ) ); - } - } -#endif - } - - /* Render subframe */ - /* ism_md_subframe_update_jbm != subframe_idx: trigger update only for ism_md_subframe_update_jbm == subframe_idx, - where then the two TDREND_GetMix()-arguments subframe_idx and ism_md_subframe_update are equal, and we want to enforce the update inside TDREND_GetMix to use subframe_idx == 0 */ - if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0, ism_md_subframe_update_jbm != subframe_idx ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - /* add reverb to rendered signals */ - v_add( reverb_signal[0], output_f_local[0], output_f_local[0], output_frame ); - v_add( reverb_signal[1], output_f_local[1], output_f_local[1], output_frame ); - } - - - for ( ch = 0; ch < nchan_ism_internal; ch++ ) - { - tc_local[ch] += output_frame; - } - - for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) - { - output_f_local[ch] += output_frame; - } - - /* update combined orientation access index */ - ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, output_frame ); - } - - st_ivas->hTcBuffer->subframes_rendered = last_sf; - - return IVAS_ERR_OK; -} - #ifdef IVAS_FLOAT_FIXED ivas_error ivas_td_binaural_renderer_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -362,16 +155,16 @@ ivas_error ivas_td_binaural_renderer_sf_fx( Word16 enableCombinedOrientation; /* Set the number of ISMs */ - IF ( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) + IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { nchan_ism_internal = st_ivas->nchan_ism; move16(); nchan_ism = st_ivas->nchan_ism; move16(); ch_offset = 2; - move16(); + move16(); } - ELSE IF ( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) + ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { nchan_ism_internal = st_ivas->nchan_ism; move16(); @@ -383,7 +176,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx( ELSE { nchan_ism_internal = st_ivas->hTcBuffer->nchan_transport_internal; - move16(); + move16(); nchan_ism = st_ivas->nchan_transport; move16(); ch_offset = 0; @@ -424,24 +217,24 @@ ivas_error ivas_td_binaural_renderer_sf_fx( /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ tmp = 0; - IF(n_samples_granularity != 0) + IF( n_samples_granularity != 0 ) { - tmp = idiv1616(n_samples_granularity, slot_size); + tmp = idiv1616( n_samples_granularity, slot_size ); } slots_to_render = s_min( sub( st_ivas->hTcBuffer->num_slots, st_ivas->hTcBuffer->slots_rendered ), tmp ); first_sf = st_ivas->hTcBuffer->subframes_rendered; move16(); last_sf = first_sf; move16(); - st_ivas->hTcBuffer->slots_rendered = add(st_ivas->hTcBuffer->slots_rendered, slots_to_render); + st_ivas->hTcBuffer->slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, slots_to_render ); WHILE( slots_to_render > 0 ) { - slots_to_render = sub(slots_to_render, st_ivas->hTcBuffer->subframe_nbslots[last_sf]); - last_sf = add(last_sf, 1); + slots_to_render = sub( slots_to_render, st_ivas->hTcBuffer->subframe_nbslots[last_sf] ); + last_sf = add( last_sf, 1 ); } - FOR ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { output_frame = i_mult( st_ivas->hTcBuffer->subframe_nbslots[subframe_idx], st_ivas->hTcBuffer->n_samples_granularity ); @@ -457,13 +250,13 @@ ivas_error ivas_td_binaural_renderer_sf_fx( st_ivas->hBinRendererTd->Sources[c_indx]->InputFrame_p_q = q_factor; st_ivas->hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; move16(); - c_indx = add(c_indx, 1); + c_indx = add( c_indx, 1 ); } } - IF ( EQ_16( subframe_idx, ism_md_subframe_update_jbm ) ) + IF( EQ_16( subframe_idx, ism_md_subframe_update_jbm ) ) { - IF ( ( error = TDREND_Update_object_positions_fx( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK ) + IF( ( error = TDREND_Update_object_positions_fx( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK ) { return error; } @@ -478,9 +271,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx( /* Shifting w_fx, x_fx, y_fx, z_fx to a common Q-factor if they are not having the same Q-factor */ Word16 min_q; - IF ( !( EQ_16( tmp_Quaternion_fx->w_qfact, tmp_Quaternion_fx->x_qfact ) - && EQ_16( tmp_Quaternion_fx->x_qfact, tmp_Quaternion_fx->y_qfact ) - && EQ_16( tmp_Quaternion_fx->y_qfact, tmp_Quaternion_fx->z_qfact ) ) ) + IF( !( EQ_16( tmp_Quaternion_fx->w_qfact, tmp_Quaternion_fx->x_qfact ) && EQ_16( tmp_Quaternion_fx->x_qfact, tmp_Quaternion_fx->y_qfact ) && EQ_16( tmp_Quaternion_fx->y_qfact, tmp_Quaternion_fx->z_qfact ) ) ) { min_q = MAX16B; move16(); @@ -526,17 +317,17 @@ ivas_error ivas_td_binaural_renderer_sf_fx( move16(); } - IF ( ( error = TDREND_Update_listener_orientation_fx( st_ivas->hBinRendererTd, - enableCombinedOrientation, - tmp_Quaternion_fx, - tmp_vector_fx ) ) != IVAS_ERR_OK ) + IF( ( error = TDREND_Update_listener_orientation_fx( st_ivas->hBinRendererTd, + enableCombinedOrientation, + tmp_Quaternion_fx, + tmp_vector_fx ) ) != IVAS_ERR_OK ) { return error; } - IF ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + IF( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - IF ( ( error = ivas_reverb_process_fx( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local_fx, p_reverb_signal_fx, 0 ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_reverb_process_fx( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local_fx, p_reverb_signal_fx, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -545,24 +336,24 @@ ivas_error ivas_td_binaural_renderer_sf_fx( /* Render subframe */ /* ism_md_subframe_update_jbm != subframe_idx: trigger update only for ism_md_subframe_update_jbm == subframe_idx, where then the two TDREND_GetMix()-arguments subframe_idx and ism_md_subframe_update are equal, and we want to enforce the update inside TDREND_GetMix to use subframe_idx == 0 */ - IF ( ( error = TDREND_GetMix_fx( st_ivas->hBinRendererTd, output_fx_local, output_frame, 0, ism_md_subframe_update_jbm != subframe_idx ) ) != IVAS_ERR_OK ) + IF( ( error = TDREND_GetMix_fx( st_ivas->hBinRendererTd, output_fx_local, output_frame, 0, ism_md_subframe_update_jbm != subframe_idx ) ) != IVAS_ERR_OK ) { return error; } - IF ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + IF( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { /* add reverb to rendered signals */ v_add_32( reverb_signal_fx[0], output_fx_local[0], output_fx_local[0], output_frame ); v_add_32( reverb_signal_fx[1], output_fx_local[1], output_fx_local[1], output_frame ); } - FOR ( ch = 0; ch < nchan_ism_internal; ch++ ) + FOR( ch = 0; ch < nchan_ism_internal; ch++ ) { tc_local_fx[ch] += output_frame; } - FOR ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { output_fx_local[ch] += output_frame; } @@ -576,4 +367,162 @@ ivas_error ivas_td_binaural_renderer_sf_fx( return IVAS_ERR_OK; } +#else +ivas_error ivas_td_binaural_renderer_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ +) +{ + int16_t first_sf, last_sf, subframe_idx; + float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float *p_reverb_signal[BINAURAL_CHANNELS]; + float *output_f_local[BINAURAL_CHANNELS]; + float *tc_local[MAX_TRANSPORT_CHANNELS]; + int16_t ch, slot_size, slots_to_render, output_frame; + ivas_error error; + + int16_t ism_md_subframe_update_jbm; + int16_t c_indx, nS; + int16_t nchan_ism_internal, nchan_ism, ch_offset; + + /* Set the number of ISMs */ + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + nchan_ism_internal = st_ivas->nchan_ism; + nchan_ism = st_ivas->nchan_ism; + ch_offset = 2; + } + else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + nchan_ism_internal = st_ivas->nchan_ism; + nchan_ism = st_ivas->nchan_ism; + ch_offset = 0; + } + else + { + nchan_ism_internal = st_ivas->hTcBuffer->nchan_transport_internal; + nchan_ism = st_ivas->nchan_transport; + ch_offset = 0; + } + + /* Number of subframes to delay metadata to sync with audio */ + if ( st_ivas->hDecoderConfig->Opt_delay_comp ) + { + ism_md_subframe_update_jbm = max( 0, st_ivas->hTcBuffer->nb_subframes - 3 ); + } + else + { + ism_md_subframe_update_jbm = st_ivas->hTcBuffer->nb_subframes - 2; + } + + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + ism_md_subframe_update_jbm = max( 0, st_ivas->hTcBuffer->nb_subframes - 2 ); + } + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + p_reverb_signal[ch] = reverb_signal[ch]; + } + + for ( ch = 0; ch < nchan_ism_internal; ch++ ) + { + tc_local[ch] = st_ivas->hTcBuffer->tc[ch + ch_offset] + st_ivas->hTcBuffer->n_samples_rendered; + } + + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + output_f_local[ch] = output[ch]; + } + + slot_size = st_ivas->hTcBuffer->n_samples_granularity; + + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_granularity / slot_size ); + first_sf = st_ivas->hTcBuffer->subframes_rendered; + last_sf = first_sf; + st_ivas->hTcBuffer->slots_rendered += slots_to_render; + + while ( slots_to_render > 0 ) + { + slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; + } + + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + output_frame = st_ivas->hTcBuffer->subframe_nbslots[subframe_idx] * st_ivas->hTcBuffer->n_samples_granularity; + + /* Update object position(s) */ + c_indx = 0; + + for ( nS = 0; nS < nchan_ism; nS++ ) + { + if ( !( st_ivas->ivas_format == MC_FORMAT && nS == LFE_CHANNEL ) ) /* Skip LFE for MC */ + { + st_ivas->hBinRendererTd->Sources[c_indx]->InputFrame_p = tc_local[nS]; + st_ivas->hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; + c_indx++; + } + } + if ( subframe_idx == ism_md_subframe_update_jbm ) + { + if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Update the listener's location/orientation */ + if ( ( error = TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, + ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] : 0, + ( st_ivas->hCombinedOrientationData != NULL ) ? &st_ivas->hCombinedOrientationData->Quaternions[st_ivas->hCombinedOrientationData->subframe_idx] : NULL, + ( st_ivas->hCombinedOrientationData != NULL ) ? &st_ivas->hCombinedOrientationData->listenerPos[st_ivas->hCombinedOrientationData->subframe_idx] : NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + if ( ( error = ivas_reverb_process( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local, p_reverb_signal, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Render subframe */ + /* ism_md_subframe_update_jbm != subframe_idx: trigger update only for ism_md_subframe_update_jbm == subframe_idx, + where then the two TDREND_GetMix()-arguments subframe_idx and ism_md_subframe_update are equal, and we want to enforce the update inside TDREND_GetMix to use subframe_idx == 0 */ + if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0, ism_md_subframe_update_jbm != subframe_idx ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + /* add reverb to rendered signals */ + v_add( reverb_signal[0], output_f_local[0], output_f_local[0], output_frame ); + v_add( reverb_signal[1], output_f_local[1], output_f_local[1], output_frame ); + } + + + for ( ch = 0; ch < nchan_ism_internal; ch++ ) + { + tc_local[ch] += output_frame; + } + + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + output_f_local[ch] += output_frame; + } + + /* update combined orientation access index */ + ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, output_frame ); + } + + st_ivas->hTcBuffer->subframes_rendered = last_sf; + + return IVAS_ERR_OK; +} #endif diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 7a6d7e05e..15fd1f788 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -139,15 +139,16 @@ void ivas_osba_data_close( * * Binaural rendering in JBM OSBA format *--------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED ivas_error ivas_osba_dirac_td_binaural_jbm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *output_fx[], /* o : rendered time signal */ - const Word16 q_factor, /* i : q_factor of rendered time signal */ - Word16 out_len/*Store the length of values in each channel*/ + Word32 *output_fx[], /* o : rendered time signal */ + const Word16 q_factor, /* i : q_factor of rendered time signal */ + Word16 out_len /*Store the length of values in each channel*/ ) { Word16 n; @@ -156,7 +157,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( Word32 *p_sepobj_fx[BINAURAL_CHANNELS]; int16_t channel_offset; - FOR ( n = 0; n < BINAURAL_CHANNELS; n++ ) + FOR( n = 0; n < BINAURAL_CHANNELS; n++ ) { p_sepobj_fx[n] = &output_separated_objects_fx[n][0]; } @@ -164,29 +165,27 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( channel_offset = st_ivas->nchan_ism; move16(); - IF ( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_fx[channel_offset], out_len) ) != IVAS_ERR_OK ) + IF( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_fx[channel_offset], out_len ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_sepobj_fx, q_factor, *nSamplesRendered ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_sepobj_fx, q_factor, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; } - FOR ( n = 0; n < BINAURAL_CHANNELS; n++ ) + FOR( n = 0; n < BINAURAL_CHANNELS; n++ ) { Word16 i; - FOR ( i = 0; i < nSamplesAsked; i++ ) + FOR( i = 0; i < nSamplesAsked; i++ ) { - output_fx[n][i] = L_add(L_shr(output_fx[channel_offset + n][i],1) , L_shr(p_sepobj_fx[n][i],1)); + output_fx[n][i] = L_add( L_shr( output_fx[channel_offset + n][i], 1 ), L_shr( p_sepobj_fx[n][i], 1 ) ); } } return IVAS_ERR_OK; } - -#endif // IVAS_FLOAT_FIXED - +#else ivas_error ivas_osba_dirac_td_binaural_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -208,33 +207,10 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( channel_offset = st_ivas->nchan_ism; -#ifndef IVAS_FLOAT_FIXED if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f[channel_offset] ) ) != IVAS_ERR_OK ) { return error; } -#else - { - Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 *output_f_fx[MAX_OUTPUT_CHANNELS]; - for (int i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - output_f_fx[i] = &output_fx[0][0]; - } - for ( n = 0; n < channel_offset; n++ ) - { - floatToFixed_arr32( output_f[n], output_fx[n], Q8, 960 ); - } - if ((error = ivas_sba_dec_render_fx(st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, &output_f_fx[channel_offset], 960)) != IVAS_ERR_OK) - { - return error; - } - for ( n = 0; n < channel_offset; n++ ) - { - fixedToFloat_arrL( output_fx[n], output_f[n], Q8, 960 ); - } - } -#endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) { @@ -249,9 +225,9 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; } } - return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------------* diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index e6c2a6f63..f2960375f 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -271,7 +271,7 @@ static void get_custom_ls_conversion_matrix_fx( Word32 dmxCoeff_LFE; /* TODO: remove the floating point dependency */ - float tmp_gains[MAX_OUTPUT_CHANNELS]; + Word32 tmp_gains[MAX_OUTPUT_CHANNELS]; lfe_in_idx = -1; move16(); @@ -324,7 +324,8 @@ static void get_custom_ls_conversion_matrix_fx( ELSE IF( NE_16( lfe_out_idx, ch_in ) ) { /* Set the values of hLsSetUpConversion->dmxMtx to EFAP gains, skipping LFE */ - efap_determine_gains( hEFAPdata, tmp_gains, hTransSetup.ls_azimuth[ch_in_woLFE], hTransSetup.ls_elevation[ch_in_woLFE], EFAP_MODE_EFAP ); + /*angles float2fix conversion: to be removed*/ + efap_determine_gains_fx( hEFAPdata, tmp_gains, L_shl((Word32)hTransSetup.ls_azimuth[ch_in_woLFE], Q22), L_shl((Word32)hTransSetup.ls_elevation[ch_in_woLFE], Q22), EFAP_MODE_EFAP ); FOR( ( ch_out = 0, ch_out_woLFE = 0 ); ch_out < nchan_out; ( ch_out++, ch_out_woLFE++ ) ) { @@ -334,8 +335,7 @@ static void get_custom_ls_conversion_matrix_fx( } ELSE { - // Currently efap_determine_gains returns float tmp_gains. - hLsSetUpConversion->dmxMtx_fx[ch_in][ch_out] = float_to_fix( tmp_gains[ch_out_woLFE], Q30 ); + hLsSetUpConversion->dmxMtx_fx[ch_in][ch_out] = tmp_gains[ch_out_woLFE]; move32(); } } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index dcf1bcdbf..b27b05f87 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1314,8 +1314,16 @@ ivas_error ivas_sba_dec_reconfigure_fx( if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { + /*float2fix block: to be removed*/ + if (st_ivas->hIntSetup.ls_azimuth && st_ivas->hIntSetup.ls_azimuth_fx) { + floatToFixed_arrL((float *)st_ivas->hIntSetup.ls_azimuth, (Word32 *)st_ivas->hIntSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.nchan_out_woLFE); + } + if (st_ivas->hIntSetup.ls_elevation && st_ivas->hIntSetup.ls_elevation_fx) { + floatToFixed_arrL((float *)st_ivas->hIntSetup.ls_elevation, (Word32 *)st_ivas->hIntSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.nchan_out_woLFE); + } + /*float2fix block end*/ /* open fastconv binaural renderer */ - if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binRenderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 9c42a0bf6..92d4479b2 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1448,9 +1448,9 @@ ivas_error IVAS_DEC_FeedHeadTrackData( /* Move head-tracking data to the decoder handle */ /* check for Euler angle signaling */ - IF( orientation.w == -3.0f ) + IF( EQ_32( orientation.w_fx, -1610612736 /* -3.0f in Q29 */ ) ) { - Euler2Quat( deg2rad( orientation.x ), deg2rad( orientation.y ), deg2rad( orientation.z ), &orientation ); + Euler2Quat_fx( deg2rad_fx( orientation.x_fx ), deg2rad_fx( orientation.y_fx ), deg2rad_fx( orientation.z_fx ), &orientation ); } #ifdef IVAS_FLOAT_FIXED @@ -2939,6 +2939,12 @@ static ivas_error evs_dec_main( } st_ivas->BER_detect = hCoreCoder[0]->BER_detect; +#ifdef IVAS_FLOAT_FIXED + FOR( Word16 i = 0; i < nOutSamples; i++ ) + { + p_output[0][i] = output_16[i]; + } +#endif IF( EQ_16( st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) { mixer_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; @@ -2946,12 +2952,7 @@ static ivas_error evs_dec_main( v_multc( p_output[0], mixer_rigth, p_output[1], nOutSamples ); v_multc( p_output[0], mixer_left, p_output[0], nOutSamples ); } -#ifdef IVAS_FLOAT_FIXED - FOR( Word16 i = 0; i < nOutSamples; i++ ) - { - p_output[0][i] = output_16[i]; - } -#endif + IF( !st_ivas->hDecoderConfig->Opt_tsm ) { ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); diff --git a/lib_rend/ivas_allrad_dec.c b/lib_rend/ivas_allrad_dec.c index 9900e16c6..e72dcf82e 100644 --- a/lib_rend/ivas_allrad_dec.c +++ b/lib_rend/ivas_allrad_dec.c @@ -162,7 +162,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( } #else #define TEMP_VAL 1963413621 // Q37 (1.f / num_td) -ivas_error ivas_sba_get_hoa_dec_matrix( +ivas_error ivas_sba_get_hoa_dec_matrix_fx( const IVAS_OUTPUT_SETUP hOutSetup, /* i : target output setup */ Word32 **hoa_dec_mtx, /* o : ALLRAD decoder matrix */ const Word16 ambisonics_order /* i : Ambisonics order */ @@ -213,7 +213,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( ELSE IF( hOutSetup.is_loudspeaker_setup ) { /* init EFIP */ - IF( ( error = efap_init_data( &( hEFAP ), hOutSetup.ls_azimuth, hOutSetup.ls_elevation, num_spk, EFAP_MODE_EFIP ) ) != IVAS_ERR_OK ) + IF( ( error = efap_init_data_fx( &( hEFAP ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, num_spk, EFAP_MODE_EFIP ) ) != IVAS_ERR_OK ) { return error; } @@ -239,7 +239,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( } /* t-design to real LS panning gains */ - efap_determine_gains_fixed( hEFAP, G_td_int, t_design_azi[i], t_design_ele[i], EFAP_MODE_EFIP ); // G_td_int Q30 + efap_determine_gains_fx( hEFAP, G_td_int, t_design_azi[i], t_design_ele[i], EFAP_MODE_EFIP ); // G_td_int Q30 p_dec_mtx = *hoa_dec_mtx; FOR( j = 0; j < num_spk; j++ ) diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index c9f493c2c..a7f86d310 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -49,13 +49,12 @@ * Local function prototypes *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -static void ivas_dirac_param_est_ana( DIRAC_ANA_HANDLE hDirAC, Word32 data_f[][L_FRAME48k], Word32 elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const Word16 input_frame ); +static void ivas_dirac_param_est_ana_fx( DIRAC_ANA_HANDLE hDirAC, Word32 data_f[][L_FRAME48k], Word32 elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const Word16 input_frame ); static void ivas_dirac_dmx_fx( Word32 data_in_fx[][L_FRAME48k], const Word16 input_frame, const Word16 nchan_transport ); - #else static void ivas_dirac_param_est_ana( DIRAC_ANA_HANDLE hDirAC, float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const int16_t input_frame ); -#endif static void ivas_dirac_dmx( float data_in_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport ); +#endif @@ -65,6 +64,113 @@ static void ivas_dirac_dmx( float data_in_f[][L_FRAME48k], const int16_t input_f * Allocate and initialize DIRAC handle *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_dirac_ana_open_fx( + DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ + Word32 input_Fs /* i : Sampling frequency */ +) +{ + Word16 i, j; + DIRAC_ANA_HANDLE hDirAC; + Word16 numAnalysisChannels; + Word16 maxBin; + ivas_error error; + + error = IVAS_ERR_OK; + + IF( ( hDirAC = (DIRAC_ANA_HANDLE) malloc( sizeof( DIRAC_ANA_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DIRAC\n" ) ); + } + + numAnalysisChannels = FOA_CHANNELS; + move16(); + + /* Determine the number of bands */ + hDirAC->nbands = MASA_FREQUENCY_BANDS; + move16(); + + /* Determine band grouping */ + Copy( MASA_band_grouping_24, hDirAC->band_grouping, 24 + 1 ); + + // maxBin = (int16_t) ( input_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + Word32 n_input_Fs = L_shl( input_Fs, 1 ); + Word32 val = L_add( Mpy_32_16_1( n_input_Fs, 41 /* INV_CLDFB_BANDWIDTH in Q15 */ ), 1 ); + val = L_shr( val, 1 ); + maxBin = extract_l( val ); + FOR( i = 1; i < hDirAC->nbands + 1; i++ ) + { + IF( GE_16( hDirAC->band_grouping[i], maxBin ) ) + { + hDirAC->band_grouping[i] = maxBin; + move16(); + hDirAC->nbands = i; + move16(); + BREAK; + } + } + + /* Determine block grouping */ + Copy( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); + + /* open/initialize CLDFB */ + hDirAC->num_Cldfb_instances = numAnalysisChannels; + move16(); + FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) + { + IF( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + IF( ( hDirAC->direction_vector_m_fx[i] = (Word32 **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + + FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + IF( ( hDirAC->direction_vector_m_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + set32_fx( hDirAC->direction_vector_m_fx[i][j], 0, MASA_FREQUENCY_BANDS ); + } + } + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + IF( ( hDirAC->buffer_intensity_real_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + set32_fx( hDirAC->buffer_intensity_real_fx[i][j], 0, MASA_FREQUENCY_BANDS ); + } + } + set32_fx( hDirAC->buffer_energy_fx, 0, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); + + hDirAC->index_buffer_intensity = 0; + move16(); + + IF( ( hDirAC->hMasaOut = (MASA_DECODER_EXT_OUT_META_HANDLE) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + + IF( ( hDirAC->sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + generate_gridEq_fx( hDirAC->sph_grid16 ); + + ( *hDirACPtr ) = hDirAC; + + return error; +} +#else ivas_error ivas_dirac_ana_open( DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ int32_t input_Fs /* i : Sampling frequency */ @@ -114,7 +220,7 @@ ivas_error ivas_dirac_ana_open( return error; } } -#ifndef IVAS_FLOAT_FIXED + /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { @@ -132,25 +238,7 @@ ivas_error ivas_dirac_ana_open( set_zero( hDirAC->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); } } -#else - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - if ( ( hDirAC->direction_vector_m_fx[i] = (Word32 **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - if ( ( hDirAC->direction_vector_m_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - set_val_Word32( hDirAC->direction_vector_m_fx[i][j], 0, MASA_FREQUENCY_BANDS ); - } - } -#endif -#ifndef IVAS_FLOAT_FIXED for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) @@ -162,21 +250,8 @@ ivas_error ivas_dirac_ana_open( set_zero( hDirAC->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); } } -#else - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) - { - if ( ( hDirAC->buffer_intensity_real_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - set_val_Word32( hDirAC->buffer_intensity_real_fx[i][j], 0, MASA_FREQUENCY_BANDS ); - } - } - set_val_Word32( hDirAC->buffer_energy_fx, 0, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); -#endif - //set_zero( hDirAC->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); + + set_zero( hDirAC->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); hDirAC->index_buffer_intensity = 0; @@ -195,6 +270,7 @@ ivas_error ivas_dirac_ana_open( return error; } +#endif /*--------------------------------------------------------------------------* @@ -203,6 +279,52 @@ ivas_error ivas_dirac_ana_open( * Close DIRAC handle *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_ana_close_fx( + DIRAC_ANA_HANDLE( *hDirAC ) /* i/o: analysis DIRAC handle */ +) +{ + Word16 i, j; + + test(); + IF( hDirAC == NULL || *hDirAC == NULL ) + { + return; + } + + FOR( i = 0; i < ( *hDirAC )->num_Cldfb_instances; i++ ) + { + deleteCldfb_ivas_fx( &( ( *hDirAC )->cldfbAnaEnc[i] ) ); + } + + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + free( ( *hDirAC )->direction_vector_m_fx[i][j] ); + ( *hDirAC )->direction_vector_m_fx[i][j] = NULL; + } + free( ( *hDirAC )->direction_vector_m_fx[i] ); + ( *hDirAC )->direction_vector_m_fx[i] = NULL; + + FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hDirAC )->buffer_intensity_real_fx[i][j] ); + ( *hDirAC )->buffer_intensity_real_fx[i][j] = NULL; + } + } + + free( ( *hDirAC )->hMasaOut ); + ( *hDirAC )->hMasaOut = NULL; + free( ( *hDirAC )->sph_grid16 ); + ( *hDirAC )->sph_grid16 = NULL; + + free( ( *hDirAC ) ); + ( *hDirAC ) = NULL; + + return; +} +#else void ivas_dirac_ana_close( DIRAC_ANA_HANDLE( *hDirAC ) /* i/o: analysis DIRAC handle */ ) @@ -221,36 +343,20 @@ void ivas_dirac_ana_close( for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { -#ifndef IVAS_FLOAT_FIXED for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { free( ( *hDirAC )->direction_vector_m[i][j] ); ( *hDirAC )->direction_vector_m[i][j] = NULL; } - free( ( *hDirAC )->direction_vector_m[i] ); - ( *hDirAC )->direction_vector_m[i] = NULL; -#else - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - free( ( *hDirAC )->direction_vector_m_fx[i][j] ); - ( *hDirAC )->direction_vector_m_fx[i][j] = NULL; - } - free( ( *hDirAC )->direction_vector_m_fx[i] ); - ( *hDirAC )->direction_vector_m_fx[i] = NULL; -#endif -#ifndef IVAS_FLOAT_FIXED + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { free( ( *hDirAC )->buffer_intensity_real[i][j] ); ( *hDirAC )->buffer_intensity_real[i][j] = NULL; } -#else - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) - { - free( ( *hDirAC )->buffer_intensity_real_fx[i][j] ); - ( *hDirAC )->buffer_intensity_real_fx[i][j] = NULL; - } -#endif + + free( ( *hDirAC )->direction_vector_m[i] ); + ( *hDirAC )->direction_vector_m[i] = NULL; } free( ( *hDirAC )->hMasaOut ); @@ -263,7 +369,8 @@ void ivas_dirac_ana_close( return; } -#ifdef IVAS_FLOAT_FIXED +#endif + /*--------------------------------------------------------------------------* * ivas_dirac_ana() @@ -271,11 +378,12 @@ void ivas_dirac_ana_close( * DIRAC analysis function *--------------------------------------------------------------------------*/ -void ivas_dirac_ana( - DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_ana_fx( + DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ Word32 data_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ const Word16 input_frame, /* i : Input frame size */ - const Word16 nchan_transport /* i : Number of transport channels */ + const Word16 nchan_transport /* i : Number of transport channels */ ) { Word32 elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; @@ -284,24 +392,21 @@ void ivas_dirac_ana( Word32 spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 energyRatio_q, surroundingCoherence_q = 0, spreadCoherence_q = 0; + move16(); + move16(); /* Estimate MASA parameters from the SBA signals */ - ivas_dirac_param_est_ana( hDirAC, data_fx, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame ); + ivas_dirac_param_est_ana_fx( hDirAC, data_fx, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame ); energyRatio_q = 30; + move16(); /* Create MASA metadata buffer from the estimated values */ ivas_create_masa_out_meta_fx( hDirAC->hMasaOut, hDirAC->sph_grid16, nchan_transport, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, energyRatio_q, spreadCoherence_q, surroundingCoherence_q ); /* Downmix */ - ivas_dirac_dmx_fx( data_fx, input_frame, nchan_transport );//output Q of data_fx is same as that of input - + ivas_dirac_dmx_fx( data_fx, input_frame, nchan_transport ); // output Q of data_fx is same as that of input + return; } #else -/*--------------------------------------------------------------------------* - * ivas_dirac_ana() - * - * DIRAC analysis function - *--------------------------------------------------------------------------*/ - void ivas_dirac_ana( DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -327,16 +432,16 @@ void ivas_dirac_ana( return; } - #endif -#ifdef IVAS_FLOAT_FIXED + /*--------------------------------------------------------------------------* * Local functions *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED /* Estimate MASA parameters from the SBA signals */ -static void ivas_dirac_param_est_ana( +static void ivas_dirac_param_est_ana_fx( DIRAC_ANA_HANDLE hDirAC, Word32 data_fx[][L_FRAME48k], Word32 elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], @@ -378,235 +483,276 @@ static void ivas_dirac_param_est_ana( tmp = shr( tmp, negate( add( 1, tmp_e ) ) ); l_ts = tmp; numAnalysisChannels = FOA_CHANNELS; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + /* do processing over all CLDFB time slots */ - FOR ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + FOR( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) { mrange[0] = hDirAC->block_grouping[block_m_idx]; + move16(); mrange[1] = hDirAC->block_grouping[block_m_idx + 1]; + move16(); - FOR ( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) + FOR( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) { hDirAC->direction_vector_m_fx[0][block_m_idx][band_m_idx] = 0; + move32(); hDirAC->direction_vector_m_fx[1][block_m_idx][band_m_idx] = 0; + move32(); hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx] = 0; + move32(); } /* Need to initialize renormalization_factors, and variables to be normalized */ - set_val_Word32( renormalization_factor_diff_fx, 0, hDirAC->nbands ); - set_val_Word32( diffuseness_m_fx, 0, hDirAC->nbands ); - set_val_Word32( hDirAC->energy_fx[block_m_idx], 0, MASA_FREQUENCY_BANDS ); - set_val_Word32( hDirAC->energy_fx[block_m_idx], 0, MASA_FREQUENCY_BANDS ); + set32_fx( renormalization_factor_diff_fx, 0, hDirAC->nbands ); + set32_fx( diffuseness_m_fx, 0, hDirAC->nbands ); + set32_fx( hDirAC->energy_fx[block_m_idx], 0, MASA_FREQUENCY_BANDS ); + set32_fx( hDirAC->energy_fx[block_m_idx], 0, MASA_FREQUENCY_BANDS ); - FOR ( ts = mrange[0]; ts < mrange[1]; ts++ ) + FOR( ts = mrange[0]; ts < mrange[1]; ts++ ) { - FOR ( i = 0; i < numAnalysisChannels; i++ ) + FOR( i = 0; i < numAnalysisChannels; i++ ) { - io_q = Q7;// Input Q of data_fx + io_q = Q7; // Input Q of data_fx + move16(); cldfbAnalysis_ts_fx_fixed_q( &( data_fx[i][l_ts * ts] ), Foa_RealBuffer_fx[i], Foa_ImagBuffer_fx[i], l_ts, hDirAC->cldfbAnaEnc[i], &io_q ); } scale_fact = getScaleFactor32( (const Word32 *) Foa_RealBuffer_fx, FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ); - scale_fact = min( getScaleFactor32( (const Word32 *) Foa_ImagBuffer_fx, FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ), scale_fact ); - FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + scale_fact = s_min( getScaleFactor32( (const Word32 *) Foa_ImagBuffer_fx, FOA_CHANNELS * CLDFB_NO_CHANNELS_MAX ), scale_fact ); + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - FOR ( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - Foa_RealBuffer_fx[i][j] = L_shl( Foa_RealBuffer_fx[i][j], ( scale_fact - Q3 ) ); // Q( scale_fact + Q1 ) - Foa_ImagBuffer_fx[i][j] = L_shl( Foa_ImagBuffer_fx[i][j], ( scale_fact - Q3 ) ); // Q( scale_fact + Q1 ) + Foa_RealBuffer_fx[i][j] = L_shl( Foa_RealBuffer_fx[i][j], sub( scale_fact, Q3 ) ); // Q( scale_fact + Q1 ) + move32(); + Foa_ImagBuffer_fx[i][j] = L_shl( Foa_ImagBuffer_fx[i][j], sub( scale_fact, Q3 ) ); // Q( scale_fact + Q1 ) + move32(); } } /* Compute omni energy for metadata processing */ - FOR ( band_m_idx = 0; band_m_idx < num_freq_bands; band_m_idx++ ) + FOR( band_m_idx = 0; band_m_idx < num_freq_bands; band_m_idx++ ) { brange[0] = hDirAC->band_grouping[band_m_idx]; + move16(); brange[1] = hDirAC->band_grouping[band_m_idx + 1]; - FOR ( j = brange[0]; j < brange[1]; j++ ) + move16(); + FOR( j = brange[0]; j < brange[1]; j++ ) { hDirAC->energy_fx[block_m_idx][band_m_idx] = ( L_add( hDirAC->energy_fx[block_m_idx][band_m_idx], L_add( Mpy_32_32( Foa_RealBuffer_fx[0][j], Foa_RealBuffer_fx[0][j] ), Mpy_32_32( Foa_ImagBuffer_fx[0][j], Foa_ImagBuffer_fx[0][j] ) ) ) ); // 2*( scale_fact + Q1 )-31 + move32(); } } /* Direction estimation */ computeIntensityVector_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); // 2 * ( scale_fact + Q1 ) - 31 - exp = ( 2 * ( scale_fact - Q1 ) - 31 ); + exp = sub( shl( sub( scale_fact, Q1 ), 1 ), 31 ); computeDirectionVectors_fx( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], &exp ); /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); //( 2 * ( scale_fact - Q1 ) - 31 - 1 ); // computeReferencePower_ana( hDirAC->band_grouping, Foa_RealBuffer, Foa_ImagBuffer, reference_power[ts], num_freq_bands ); - exp2 = ( 2 * ( scale_fact ) - 31 ); + exp2 = sub( shl( scale_fact, 1 ), 31 ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ - hDirAC->index_buffer_intensity = ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + hDirAC->index_buffer_intensity = add( ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ index = hDirAC->index_buffer_intensity; + move16(); Word16 guard_bits = find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ); scale_fact2 = getScaleFactor32( (const Word32 *) intensity_real_fx, DIRAC_NUM_DIMS * MASA_FREQUENCY_BANDS ); - IF ( guard_bits > scale_fact2 ) + IF( GT_16( guard_bits, scale_fact2 ) ) { - FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - FOR ( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - intensity_real_fx[i][j] = L_shr( intensity_real_fx[i][j], guard_bits - scale_fact2 ); + intensity_real_fx[i][j] = L_shr( intensity_real_fx[i][j], sub( guard_bits, scale_fact2 ) ); + move32(); } } - q_factor_intensity = 2 * ( scale_fact - 1 ) - 31 - ( guard_bits - scale_fact2 ); + q_factor_intensity = sub( sub( shl( sub( scale_fact, 1 ), 1 ), 31 ), sub( guard_bits, scale_fact2 ) ); } ELSE { - FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - FOR ( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - intensity_real_fx[i][j] = L_shl( intensity_real_fx[i][j], scale_fact2 - guard_bits ); + intensity_real_fx[i][j] = L_shl( intensity_real_fx[i][j], sub( scale_fact2, guard_bits ) ); + move32(); } } - q_factor_intensity = 2 * ( scale_fact - 1 ) - 31 + scale_fact2 - guard_bits; + q_factor_intensity = add( sub( shl( sub( scale_fact, 1 ), 1 ), 31 ), sub( scale_fact2, guard_bits ) ); } scale_fact2 = getScaleFactor32( reference_power_fx[ts], MASA_FREQUENCY_BANDS ); - IF ( guard_bits > scale_fact2 ) + IF( GT_16( guard_bits, scale_fact2 ) ) { - FOR ( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - reference_power_fx[ts][j] = L_shr( reference_power_fx[ts][j], guard_bits - scale_fact2 ); + reference_power_fx[ts][j] = L_shr( reference_power_fx[ts][j], sub( guard_bits, scale_fact2 ) ); + move32(); } - q_factor_energy = 2 * ( scale_fact ) - 31 - ( guard_bits - scale_fact2 ); + q_factor_energy = sub( sub( shl( scale_fact, 1 ), 31 ), sub( guard_bits, scale_fact2 ) ); } ELSE { - FOR ( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - reference_power_fx[ts][j] = L_shl( reference_power_fx[ts][j], scale_fact2 - guard_bits ); + reference_power_fx[ts][j] = L_shl( reference_power_fx[ts][j], sub( scale_fact2, guard_bits ) ); + move32(); } - q_factor_energy = 2 * ( scale_fact ) - 31 + scale_fact2 - guard_bits; + q_factor_energy = add( sub( shl( scale_fact, 1 ), 31 ), sub( scale_fact2, guard_bits ) ); } - IF ( q_factor_intensity_old != 0 ) + IF( NE_16( q_factor_intensity_old, 0 ) ) { - IF ( q_factor_intensity_old < q_factor_intensity ) + IF( LT_16( q_factor_intensity_old, q_factor_intensity ) ) { - FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - FOR ( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - intensity_real_fx[i][j] = L_shr( intensity_real_fx[i][j], q_factor_intensity - q_factor_intensity_old ); + intensity_real_fx[i][j] = L_shr( intensity_real_fx[i][j], sub( q_factor_intensity, q_factor_intensity_old ) ); + move32(); } } q_factor_intensity = q_factor_intensity_old; + move16(); } ELSE { FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - FOR ( j = 0; j < index - 1; j++ ) + FOR( j = 0; j < index - 1; j++ ) { /* only real part needed */ - FOR ( Word16 k = 0; k < num_freq_bands; k++ ) + FOR( Word16 k = 0; k < num_freq_bands; k++ ) { - hDirAC->buffer_intensity_real_fx[i][j][k] = L_shr( hDirAC->buffer_intensity_real_fx[i][j][k], q_factor_intensity_old - q_factor_intensity ); + hDirAC->buffer_intensity_real_fx[i][j][k] = L_shr( hDirAC->buffer_intensity_real_fx[i][j][k], sub( q_factor_intensity_old, q_factor_intensity ) ); + move32(); } } } } } - IF ( q_factor_energy_old != 0 ) + IF( NE_16( q_factor_energy_old, 0 ) ) { - IF ( q_factor_energy_old < q_factor_energy ) + IF( LT_16( q_factor_energy_old, q_factor_energy ) ) { - FOR ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { - reference_power_fx[ts][j] = L_shr( reference_power_fx[ts][j], q_factor_energy - q_factor_energy_old ); + reference_power_fx[ts][j] = L_shr( reference_power_fx[ts][j], sub( q_factor_energy, q_factor_energy_old ) ); + move32(); } q_factor_energy = q_factor_energy_old; + move16(); } ELSE { - FOR ( i = 0; i < index - 1; i++ ) + FOR( i = 0; i < index - 1; i++ ) { - FOR ( j = 0; j < num_freq_bands; j++ ) + FOR( j = 0; j < num_freq_bands; j++ ) { - FOR ( Word16 k = 0; k < num_freq_bands; k++ ) + FOR( Word16 k = 0; k < num_freq_bands; k++ ) { - hDirAC->buffer_energy_fx[i * j + k] = L_shr( hDirAC->buffer_energy_fx[i * j + k], q_factor_energy_old - q_factor_energy_old ); + hDirAC->buffer_energy_fx[i * j + k] = L_shr( hDirAC->buffer_energy_fx[i * j + k], sub( q_factor_energy_old, q_factor_energy_old ) ); + move32(); } } } } } - FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { /* only real part needed */ - mvr2r_Word32( intensity_real_fx[i], &( hDirAC->buffer_intensity_real_fx[i][index - 1][0] ), num_freq_bands ); + Copy32( intensity_real_fx[i], &( hDirAC->buffer_intensity_real_fx[i][index - 1][0] ), num_freq_bands ); } - mvr2r_Word32( reference_power_fx[ts], &( hDirAC->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); + Copy32( reference_power_fx[ts], &( hDirAC->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); computeDiffuseness_fx( hDirAC->buffer_intensity_real_fx, hDirAC->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, q_factor_intensity, q_factor_energy, diffuseness_vector_exp ); q_factor_intensity_old = q_factor_intensity; + move16(); q_factor_energy_old = q_factor_energy; - FOR ( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + move16(); + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { - IF ( diffuseness_vector_exp[j] < 10 ) + IF( LT_16( diffuseness_vector_exp[j], 10 ) ) { diffuseness_vector_fx[j] = 0; + move16(); } } - FOR ( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) + FOR( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) { - norm_tmp_fx = Mpy_32_32( reference_power_fx[ts][band_m_idx], ( L_sub( ONE_IN_Q30, L_shr( diffuseness_vector_fx[band_m_idx], 30 - diffuseness_vector_exp[band_m_idx] ) ) ) ); // q_factor_energy-1 - - hDirAC->direction_vector_m_fx[0][block_m_idx][band_m_idx] = L_add( Mpy_32_32( norm_tmp_fx, direction_vector_fx[0][band_m_idx] ), hDirAC->direction_vector_m_fx[0][block_m_idx][band_m_idx] ); // Q (q_factor_energy + exp -32) - hDirAC->direction_vector_m_fx[1][block_m_idx][band_m_idx] = L_add( Mpy_32_32( norm_tmp_fx, direction_vector_fx[1][band_m_idx] ), hDirAC->direction_vector_m_fx[1][block_m_idx][band_m_idx] ); // Q (q_factor_energy + exp -32) - hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx] = L_add( Mpy_32_32( norm_tmp_fx, direction_vector_fx[2][band_m_idx] ), hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx] ); // Q (q_factor_energy + exp -32) - - diffuseness_m_fx[band_m_idx] = L_add( diffuseness_m_fx[band_m_idx], Mpy_32_32( reference_power_fx[ts][band_m_idx], L_shr( diffuseness_vector_fx[band_m_idx], 30 - diffuseness_vector_exp[band_m_idx] ) ) ); // Qq_factor_energy-1 - renormalization_factor_diff_fx[band_m_idx] = L_add( renormalization_factor_diff_fx[band_m_idx], reference_power_fx[ts][band_m_idx] ); // Qq_factor_energy + norm_tmp_fx = Mpy_32_32( reference_power_fx[ts][band_m_idx], ( L_sub( ONE_IN_Q30, L_shr( diffuseness_vector_fx[band_m_idx], sub( 30, diffuseness_vector_exp[band_m_idx] ) ) ) ) ); // q_factor_energy-1 + + hDirAC->direction_vector_m_fx[0][block_m_idx][band_m_idx] = L_add( Mpy_32_32( norm_tmp_fx, direction_vector_fx[0][band_m_idx] ), hDirAC->direction_vector_m_fx[0][block_m_idx][band_m_idx] ); // Q (q_factor_energy + exp -32) + move32(); + hDirAC->direction_vector_m_fx[1][block_m_idx][band_m_idx] = L_add( Mpy_32_32( norm_tmp_fx, direction_vector_fx[1][band_m_idx] ), hDirAC->direction_vector_m_fx[1][block_m_idx][band_m_idx] ); // Q (q_factor_energy + exp -32) + move32(); + hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx] = L_add( Mpy_32_32( norm_tmp_fx, direction_vector_fx[2][band_m_idx] ), hDirAC->direction_vector_m_fx[2][block_m_idx][band_m_idx] ); // Q (q_factor_energy + exp -32) + move32(); + + diffuseness_m_fx[band_m_idx] = L_add( diffuseness_m_fx[band_m_idx], Mpy_32_32( reference_power_fx[ts][band_m_idx], L_shr( diffuseness_vector_fx[band_m_idx], sub( 30, diffuseness_vector_exp[band_m_idx] ) ) ) ); // Qq_factor_energy-1 + move32(); + renormalization_factor_diff_fx[band_m_idx] = L_add( renormalization_factor_diff_fx[band_m_idx], reference_power_fx[ts][band_m_idx] ); // Qq_factor_energy + move32(); } } - FOR ( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) + FOR( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) { - FOR ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + FOR( d = 0; d < DIRAC_NUM_DIMS; d++ ) { dir_v[d] = hDirAC->direction_vector_m_fx[d][block_m_idx][band_m_idx]; + move32(); } - dir_q = q_factor_energy + exp - 32; + dir_q = add( q_factor_energy, sub( exp, 32 ) ); ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( dir_v, dir_q, &azimuth_m_values[block_m_idx][band_m_idx], &elevation_m_values[block_m_idx][band_m_idx] ); } /* Determine energy ratios */ - FOR ( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) + FOR( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) { - IF ( renormalization_factor_diff_fx[band_m_idx] > EPSILON_FX ) + IF( GT_32( renormalization_factor_diff_fx[band_m_idx], EPSILON_FX ) ) { diffuseness_m_fx[band_m_idx] = BASOP_Util_Divide3232_Scale( diffuseness_m_fx[band_m_idx], renormalization_factor_diff_fx[band_m_idx], &exp_div ); + move32(); } ELSE { diffuseness_m_fx[band_m_idx] = 0; + move32(); } - exp_div = 30 - exp_div; - energyRatio[block_m_idx][band_m_idx] = L_sub( L_shl( 1, 30 ), L_shl( diffuseness_m_fx[band_m_idx], 30 - exp_div ) ); // Q30 + exp_div = sub( 30, exp_div ); + energyRatio[block_m_idx][band_m_idx] = L_sub( L_shl( 1, 30 ), L_shl( diffuseness_m_fx[band_m_idx], sub( 30, exp_div ) ) ); // Q30 + move32(); } - FOR ( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) + FOR( band_m_idx = 0; band_m_idx < hDirAC->nbands; band_m_idx++ ) { spreadCoherence[block_m_idx][band_m_idx] = 0; + move32(); surroundingCoherence[block_m_idx][band_m_idx] = 0; + move32(); } } return; } #else -/*--------------------------------------------------------------------------* - * Local functions - *--------------------------------------------------------------------------*/ - /* Estimate MASA parameters from the SBA signals */ static void ivas_dirac_param_est_ana( DIRAC_ANA_HANDLE hDirAC, @@ -743,35 +889,36 @@ static void ivas_dirac_param_est_ana( return; } - #endif + + #ifdef IVAS_FLOAT_FIXED /* Compute downmix */ static void ivas_dirac_dmx_fx( - Word32 data_in_f[][L_FRAME48k], + Word32 data_in_fx[][L_FRAME48k], const Word16 input_frame, - const Word16 nchan_transport) + const Word16 nchan_transport ) { Word16 i; - Word32 data_out_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; + Word32 data_out_fx[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; - if ( nchan_transport == 2 ) + IF( EQ_16( nchan_transport, 2 ) ) { - v_add_fx( data_in_f[0], data_in_f[1], data_out_f[0], input_frame ); - v_multc_fixed( data_out_f[0], ONE_IN_Q30, data_out_f[0], input_frame ); // ONE_IN_Q30 = 0.5* ONE_IN_Q31 + v_add_fx( data_in_fx[0], data_in_fx[1], data_out_fx[0], input_frame ); + v_multc_fixed( data_out_fx[0], ONE_IN_Q30, data_out_fx[0], input_frame ); // ONE_IN_Q30 = 0.5* ONE_IN_Q31 - v_sub_fixed( data_in_f[0], data_in_f[1], data_out_f[1], input_frame,0 ); - v_multc_fixed( data_out_f[1], ONE_IN_Q30, data_out_f[1], input_frame ); + v_sub_fixed( data_in_fx[0], data_in_fx[1], data_out_fx[1], input_frame, 0 ); + v_multc_fixed( data_out_fx[1], ONE_IN_Q30, data_out_fx[1], input_frame ); - for ( i = 0; i < nchan_transport; i++ ) + FOR( i = 0; i < nchan_transport; i++ ) { - mvr2r_Word32( data_out_f[i], data_in_f[i], input_frame ); + Copy32( data_out_fx[i], data_in_fx[i], input_frame ); } } /* output Q is same as input Q*/ return; } -#endif +#else /* Compute downmix */ static void ivas_dirac_dmx( float data_in_f[][L_FRAME48k], @@ -797,3 +944,4 @@ static void ivas_dirac_dmx( return; } +#endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 2e3ea1d4b..9968120a2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1485,7 +1485,7 @@ static void ivas_dirac_dec_binaural_internal( } FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - FOR( slot = 0; slot < 4; slot++ ) + FOR( slot = 0; slot < numInChannels; slot++ ) { q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxRe[ch][slot], nBins ) ); q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxIm[ch][slot], nBins ) ); @@ -1510,7 +1510,7 @@ static void ivas_dirac_dec_binaural_internal( } FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - FOR( slot = 0; slot < 4; slot++ ) + FOR( slot = 0; slot < numInChannels; slot++ ) { floatToFixed_arr16( hDiracDecBin->processMtxRe[ch][slot], hDiracDecBin->processMtxRe_fx[ch][slot], q_mat, nBins ); floatToFixed_arr16( hDiracDecBin->processMtxIm[ch][slot], hDiracDecBin->processMtxIm_fx[ch][slot], q_mat, nBins ); @@ -3462,7 +3462,220 @@ static void matrixTransp2Mul( return; } +#ifdef IVAS_FLOAT_FIXED +static void chol2x2_fx( + const Word32 E1, + const Word32 E2, + Word16 q_E, + const Word32 Cre, + const Word32 Cim, + Word16 q_C, + Word32 outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + Word32 outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + Word16 *q_out ) +{ + Word16 chA, chB; + Word32 sqrtVal_fx, temp; + Word16 exp, q_re1, q_re2, q_re3, q_im, q_tmp; + Word32 e1, e2, c_re, c_im; + Word16 q_e, q_c; + + exp = sub( get_min_scalefactor( E1, E2 ), 1 ); + e1 = L_shl( E1, exp ); + e2 = L_shl( E2, exp ); + q_e = add( q_E, exp ); + + exp = sub( get_min_scalefactor( Cre, Cim ), 1 ); + c_re = L_shl( Cre, exp ); + c_im = L_shl( Cim, exp ); + q_c = add( q_C, exp ); + + + FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + FOR( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + outRe[chA][chB] = 0; + move32(); + outIm[chA][chB] = 0; + move32(); + } + } + + IF( GT_32( e1, e2 ) ) /* Perform Cholesky decomposition according to louder channel first */ + { + exp = sub( 31, q_e ); + outRe[0][0] = Sqrt32( e1, &exp ); + move32(); + q_re1 = sub( 31, exp ); + + // 4611686 = 1e-12 in Q62 + IF( EQ_32( outRe[0][0], 0 ) ) + { + outRe[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); + move32(); + q_re2 = add( sub( 31, exp ), sub( q_c, 62 ) ); + + outIm[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_im, 4611686, &exp ); + move32(); + q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); + } + ELSE + { + outRe[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[0][0], &exp ); + move32(); + q_re2 = add( sub( 31, exp ), sub( q_c, q_re1 ) ); + + outIm[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_im, outRe[0][0], &exp ); + move32(); + q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); + } + IF( EQ_32( outRe[1][0], 0 ) ) + { + q_re2 = Q31; + move16(); + } + IF( EQ_32( outIm[1][0], 0 ) ) + { + q_im = Q31; + move16(); + } + + temp = Madd_32_32( Mpy_32_32( c_re, c_re ), c_im, c_im ); + q_tmp = sub( add( q_c, q_c ), 31 ); + + // 4611686 = Q62 + IF( EQ_32( e1, 0 ) ) + { + temp = BASOP_Util_Divide3232_Scale_cadence( temp, 4611686, &exp ); + q_tmp = add( sub( 31, exp ), sub( q_tmp, 62 ) ); + } + ELSE + { + temp = BASOP_Util_Divide3232_Scale_cadence( temp, e1, &exp ); + q_tmp = add( sub( 31, exp ), sub( q_tmp, q_e ) ); + } + IF( EQ_32( temp, 0 ) ) + { + q_tmp = Q31; + move16(); + } + + IF( LT_16( q_e, q_tmp ) ) + { + sqrtVal_fx = L_sub( e2, L_shr( temp, sub( q_tmp, q_e ) ) ); + q_tmp = q_e; + move16(); + } + ELSE + { + sqrtVal_fx = L_sub( L_shr( e2, sub( q_e, q_tmp ) ), temp ); + } + + exp = sub( 31, q_tmp ); + outRe[1][1] = Sqrt32( L_max( 0, sqrtVal_fx ), &exp ); + move32(); + q_re3 = sub( 31, exp ); + + *q_out = s_min( s_min( q_re1, q_re2 ), s_min( q_re3, q_im ) ); + outRe[0][0] = L_shr( outRe[0][0], sub( q_re1, *q_out ) ); + move32(); + outRe[1][0] = L_shr( outRe[1][0], sub( q_re2, *q_out ) ); + move32(); + outIm[1][0] = L_shr( outIm[1][0], sub( q_im, *q_out ) ); + move32(); + outRe[1][1] = L_shr( outRe[1][1], sub( q_re3, *q_out ) ); + move32(); + } + ELSE + { + exp = sub( 31, q_e ); + outRe[1][1] = Sqrt32( e2, &exp ); + move32(); + q_re1 = sub( 31, exp ); + + // 4611686 = Q62 + IF( EQ_32( outRe[1][1], 0 ) ) + { + outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); + move32(); + q_re2 = add( sub( 31, exp ), sub( q_c, 62 ) ); + + outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, 4611686, &exp ); + move32(); + q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); + } + ELSE + { + outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[1][1], &exp ); + move32(); + q_re2 = add( sub( 31, exp ), sub( q_c, q_re1 ) ); + + outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, outRe[1][1], &exp ); + move32(); + q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); + } + IF( EQ_32( outRe[0][1], 0 ) ) + { + q_re2 = Q31; + move16(); + } + IF( EQ_32( outIm[0][1], 0 ) ) + { + q_im = Q31; + move16(); + } + + temp = Madd_32_32( Mpy_32_32( c_re, c_re ), c_im, c_im ); + q_tmp = sub( add( q_c, q_c ), 31 ); + + // 4611686 = 1e-12 in Q62 + IF( EQ_32( e2, 0 ) ) + { + temp = BASOP_Util_Divide3232_Scale_cadence( temp, 4611686, &exp ); + q_tmp = add( sub( 31, exp ), sub( q_tmp, 62 ) ); + } + ELSE + { + temp = BASOP_Util_Divide3232_Scale_cadence( temp, e2, &exp ); + q_tmp = add( sub( 31, exp ), sub( q_tmp, q_e ) ); + } + IF( EQ_32( temp, 0 ) ) + { + q_tmp = Q31; + move16(); + } + IF( LT_16( q_e, q_tmp ) ) + { + sqrtVal_fx = L_sub( e1, L_shr( temp, sub( q_tmp, q_e ) ) ); + q_tmp = q_e; + move16(); + } + ELSE + { + sqrtVal_fx = L_sub( L_shr( e1, sub( q_e, q_tmp ) ), temp ); + } + + exp = sub( 31, q_tmp ); + outRe[0][0] = Sqrt32( L_max( 0, sqrtVal_fx ), &exp ); + move32(); + q_re3 = sub( 31, exp ); + + *q_out = s_min( s_min( q_re1, q_re2 ), s_min( q_re3, q_im ) ); + outRe[1][1] = L_shr( outRe[1][1], sub( q_re1, *q_out ) ); + move32(); + outRe[0][1] = L_shr( outRe[0][1], sub( q_re2, *q_out ) ); + move32(); + outIm[0][1] = L_shr( outIm[0][1], sub( q_im, *q_out ) ); + move32(); + outRe[0][0] = L_shr( outRe[0][0], sub( q_re3, *q_out ) ); + move32(); + } + + return; +} +#else static void chol2x2( const float E1, const float E2, @@ -3502,7 +3715,7 @@ static void chol2x2( return; } - +#endif static void formulate2x2MixingMatrix( float Ein1, @@ -3540,7 +3753,12 @@ static void formulate2x2MixingMatrix( float Ghat[BINAURAL_CHANNELS]; float GhatQ[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float Pre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Pim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - +#ifdef IVAS_FLOAT_FIXED + Word32 E_out1, E_out2, Cout_re, Cout_im; + Word32 KyRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], KyIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + Word16 q_eout, q_cout, q_ky = 0; + Word16 exp1 = 0, exp2 = 0; +#endif /* Normalize energy values */ maxEne = Ein1; maxEne = max( maxEne, Ein2 ); @@ -3557,8 +3775,29 @@ static void formulate2x2MixingMatrix( CoutIm *= maxEneDiv; /* Cholesky decomposition of target / output covariance matrix */ +#ifdef IVAS_FLOAT_FIXED + /////////////// to be removed //////////////////////////// + f2me( Eout1, &E_out1, &exp1 ); + f2me( Eout2, &E_out2, &exp2 ); + q_eout = sub( 31, s_max( exp1, exp2 ) ); + E_out1 = L_shr( E_out1, sub( sub( 31, exp1 ), q_eout ) ); + E_out2 = L_shr( E_out2, sub( sub( 31, exp2 ), q_eout ) ); + f2me( CoutRe, &Cout_re, &exp1 ); + f2me( CoutIm, &Cout_im, &exp2 ); + q_cout = sub( 31, s_max( exp1, exp2 ) ); + Cout_re = L_shr( Cout_re, sub( sub( 31, exp1 ), q_cout ) ); + Cout_im = L_shr( Cout_im, sub( sub( 31, exp2 ), q_cout ) ); + ///////////////////////////////////////////////////////// + + chol2x2_fx( E_out1, E_out2, q_eout, Cout_re, Cout_im, q_cout, KyRe_fx, KyIm_fx, &q_ky ); + + ///////////////// to be removed ///////////////////////// + fixedToFloat_arrL32( KyRe_fx[0], KyRe[0], q_ky, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); + fixedToFloat_arrL32( KyIm_fx[0], KyIm[0], q_ky, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); + ///////////////////////////////////////////////////////// +#else chol2x2( Eout1, Eout2, CoutRe, CoutIm, KyRe, KyIm ); - +#endif /* Eigendecomposition of input covariance matrix */ eig2x2( Ein1, Ein2, CinRe, CinIm, Uxre, Uxim, Sx ); @@ -4673,7 +4912,7 @@ static void ivas_masa_ext_rend_parambin_internal( } FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - FOR( slot = 0; slot < 4; slot++ ) + FOR( slot = 0; slot < numInChannels; slot++ ) { q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxRe[ch][slot], nBins ) ); q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxIm[ch][slot], nBins ) ); @@ -4697,7 +4936,7 @@ static void ivas_masa_ext_rend_parambin_internal( } FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - FOR( slot = 0; slot < 4; slot++ ) + FOR( slot = 0; slot < numInChannels; slot++ ) { floatToFixed_arr16( hDiracDecBin->processMtxRe[ch][slot], hDiracDecBin->processMtxRe_fx[ch][slot], q_mat, nBins ); floatToFixed_arr16( hDiracDecBin->processMtxIm[ch][slot], hDiracDecBin->processMtxIm_fx[ch][slot], q_mat, nBins ); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 2cbe69b21..d8cbc1f26 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -521,7 +521,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( return IVAS_ERR_OK; } -#endif +#else ivas_error ivas_dirac_dec_output_synthesis_open( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ @@ -783,7 +783,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open( return IVAS_ERR_OK; } - +#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_output_synthesis_init() * @@ -1303,7 +1303,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); h_dirac_output_synthesis_state->onset_filter = onset; - /*-----------------------------------------------------------------* * processing *-----------------------------------------------------------------*/ @@ -1592,8 +1591,482 @@ void ivas_dirac_dec_output_synthesis_process_slot( return; } +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_dec_output_synthesis_process_slot_fx( + const Word32 *reference_power, /* i : Estimated power */ + const Word16 q_reference_power, /* i : Estimated power */ + const Word32 *onset, /* i : onset filter */ + const Word16 *azimuth, + const Word16 *elevation, + const Word32 *diffuseness, + Word16 q_diffuseness, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const Word16 sh_rot_max_order, + const Word32 *p_Rmat, /* i : rotation matrix */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ + const Word16 nchan_transport, /* i : number of transport channels*/ + const Word16 md_idx, + const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const Word16 dec_param_estim ) +{ + Word16 num_freq_bands, num_channels_dir; + Word16 num_freq_bands_diff, num_channels_diff; + Word16 ch_idx; + Word32 aux_buf[CLDFB_NO_CHANNELS_MAX]; + Word16 diff_start_band; + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + Word16 q_onset; + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + + h_dirac_output_synthesis_state->onset_filter_fx = onset; + + /*-----------------------------------------------------------------* + * processing + *-----------------------------------------------------------------*/ + + /* collect some often used parameters */ + num_freq_bands = hSpatParamRendCom->num_freq_bands; + num_channels_dir = hDirACRend->num_outputs_dir; + num_channels_diff = hDirACRend->num_outputs_diff; + num_freq_bands_diff = h_dirac_output_synthesis_params->max_band_decorr; + + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS )) + { + num_channels_dir = hOutSetup.nchan_out_woLFE; move16(); + } + + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD) && hodirac_flag ) + { + ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, + hDirACRend, + hVBAPdata, + NULL, + NULL, + azimuth, + elevation, + md_idx, + NULL, + 0, + 2, + p_Rmat, + hodirac_flag ); + { + + IF(h_dirac_output_synthesis_state->direct_responses_square_fx){ + Scale_sig32(h_dirac_output_synthesis_state->direct_responses_square_fx, num_channels_dir * num_freq_bands, sub(31, h_dirac_output_synthesis_state->direct_responses_square_q)); + h_dirac_output_synthesis_state->direct_responses_square_q = 31; + } + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ), sub(31, h_dirac_output_synthesis_state->direct_responses_q)); + IF( hodirac_flag ) + { + Scale_sig32( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ), sub(31, h_dirac_output_synthesis_state->direct_responses_q)); + } + h_dirac_output_synthesis_state->direct_responses_q = 31; + } + } + + IF ( EQ_16(dec_param_estim, FALSE) && hodirac_flag ) + { + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + v_multc_fixed( hSpatParamRendCom->energy_ratio1_fx[md_idx], L_negate(MAX_32), aux_buf, num_freq_bands ); + v_addc_fixed( aux_buf, ONE_IN_Q30, aux_buf, num_freq_bands ); + Copy32( hSpatParamRendCom->energy_ratio1_fx[md_idx], + h_dirac_output_synthesis_state->direct_power_factor_fx, + num_freq_bands ); + Copy32( aux_buf, + h_dirac_output_synthesis_state->diffuse_power_factor_fx, + num_freq_bands ); + + v_multc_fixed( hSpatParamRendCom->energy_ratio2_fx[md_idx], L_negate(MAX_32), aux_buf, num_freq_bands ); + v_addc_fixed( aux_buf, ONE_IN_Q30, aux_buf, num_freq_bands ); + Copy32( hSpatParamRendCom->energy_ratio2_fx[md_idx], + &h_dirac_output_synthesis_state->direct_power_factor_fx[hSpatParamRendCom->num_freq_bands], + num_freq_bands ); + Copy32( aux_buf, + &h_dirac_output_synthesis_state->diffuse_power_factor_fx[hSpatParamRendCom->num_freq_bands], + num_freq_bands ); + + h_dirac_output_synthesis_state->diffuse_power_factor_q = 30; + h_dirac_output_synthesis_state->direct_power_factor_q = 30; + + } + ELSE + { + ivas_dirac_dec_compute_gain_factors_fx( num_freq_bands, + hSpatParamRendCom->diffuseness_vector_fx[md_idx], + h_dirac_output_synthesis_state->direct_power_factor_fx, + h_dirac_output_synthesis_state->diffuse_power_factor_fx, + h_dirac_output_synthesis_state->direct_power_factor_q, + h_dirac_output_synthesis_state->diffuse_power_factor_q); + } + } + ELSE IF ( EQ_16(dec_param_estim, TRUE )) + { + /* compute direct responses */ + ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, + hDirACRend, + hVBAPdata, + NULL, + NULL, + azimuth, + elevation, + md_idx, + NULL, + 0, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); + + { + IF(h_dirac_output_synthesis_state->direct_responses_square_fx){ + Scale_sig32(h_dirac_output_synthesis_state->direct_responses_square_fx, num_channels_dir * num_freq_bands, sub(31, h_dirac_output_synthesis_state->direct_responses_square_q)); + h_dirac_output_synthesis_state->direct_responses_square_q = 31; + } + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ), sub(31, h_dirac_output_synthesis_state->direct_responses_q)); + IF( hodirac_flag ) + { + Scale_sig32( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ), sub(31, h_dirac_output_synthesis_state->direct_responses_q)); + } + h_dirac_output_synthesis_state->direct_responses_q = 31; + } + + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + ivas_dirac_dec_compute_gain_factors_fx( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_state->direct_power_factor_fx, + h_dirac_output_synthesis_state->diffuse_power_factor_fx, + &h_dirac_output_synthesis_state->direct_power_factor_q, + &h_dirac_output_synthesis_state->diffuse_power_factor_q + ); + h_dirac_output_synthesis_state->direct_power_factor_q = sub(31, h_dirac_output_synthesis_state->direct_power_factor_q); + h_dirac_output_synthesis_state->diffuse_power_factor_q = sub(31, h_dirac_output_synthesis_state->diffuse_power_factor_q); + + v_multc_fixed( h_dirac_output_synthesis_state->direct_power_factor_fx, + ONE_IN_Q29, + h_dirac_output_synthesis_state->direct_power_factor_fx, + num_freq_bands ); + v_multc_fixed( h_dirac_output_synthesis_state->diffuse_power_factor_fx, + ONE_IN_Q29, + h_dirac_output_synthesis_state->diffuse_power_factor_fx, + num_freq_bands ); + + /*Direct gain*/ + + Word16 *Q_temp_cy_cross_dir_smooth_fx = (Word16*)malloc(num_freq_bands * num_channels_dir * sizeof(Word16)); + + FOR(Word16 kk = 0 ; kk < num_freq_bands * num_channels_dir; kk++) + { + Q_temp_cy_cross_dir_smooth_fx[kk] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; move16(); + } + + FOR ( ch_idx = 0; ch_idx < s_min( 4, nchan_transport ); ch_idx++ ) + { + Word16 k, temp = 0; + IF ( NE_16(ch_idx, 0 )) + { + Word32 a, b, c; + Word16 b_exp, sqr_exp, q_diff_aab, q_diff_c; + Word32 mpy_a_a_b, mpy_diff_c, mpy_diff_aab; + Word32 sqr_inp, sqr; + + /*Directonal sound gain nrg compensation*/ + FOR ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses_fx[add(i_mult(ch_idx, num_freq_bands), k)];// Q = h_dirac_output_synthesis_state->q_direct_responses + IF(EQ_32(reference_power[k + num_freq_bands], 0)) + { + b = 0; + b_exp = 0; + } + ELSE + { + b = BASOP_Util_Divide3232_Scale(reference_power[k + num_freq_bands], L_add(reference_power[k + ( ch_idx + 1 ) * num_freq_bands], EPSILON_FX), &b_exp); + } + c = L_add(ONE_IN_Q29, Mpy_32_16_1( L_sub(h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29) , 5461)); /*Diffuseness modellling nrg compensation*/ /* 1.0 / 6.0 = 5461 in Q15*/ + + mpy_a_a_b = Mpy_32_32(a, Mpy_32_16_1(a, b)); //Q = (h_dirac_output_synthesis_state->q_direct_responses + (31 - b_exp) - 31) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 + mpy_diff_aab = Mpy_32_32(L_sub(L_shl(1, q_diffuseness), diffuseness[k]), mpy_a_a_b); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 + mpy_diff_c = Mpy_32_32(diffuseness[k], c); // Q = q_diffuseness - 2 + + q_diff_aab = (h_dirac_output_synthesis_state->direct_responses_q + (31 - b_exp) - 31) + (h_dirac_output_synthesis_state->direct_responses_q) - 31 + q_diffuseness - 31; + q_diff_c = sub(q_diffuseness, 2); + + IF(NE_32(mpy_diff_c, 0) && NE_32(mpy_diff_aab, 0)) + { + sqr_inp = BASOP_Util_Add_Mant32Exp(mpy_diff_c, sub(31, q_diff_c), mpy_diff_aab, sub(31, q_diff_aab), &sqr_exp); + } + ELSE + { + IF(EQ_32(mpy_diff_c, 0)) + { + sqr_inp = mpy_diff_aab; + sqr_exp = sub(31, q_diff_aab); + } + ELSE + { + sqr_inp = mpy_diff_c; + sqr_exp = sub(31, q_diff_c); + } + } + sqr = Sqrt32(sqr_inp, &sqr_exp); + sqr = L_shr(sqr, 2); + IF(NE_32(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], 0)) + { + IF(LT_16(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_shr(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sub(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub(31, sqr_exp))); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31, sqr_exp); + } + ELSE + { + sqr = L_shr(sqr, sub(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; + } + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + } + ELSE + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31 , sqr_exp); + } + } + FOR ( ; k < num_freq_bands; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses_fx[add(i_mult(ch_idx, num_freq_bands), k)];// Q = h_dirac_output_synthesis_state->q_direct_responses + IF(EQ_32(reference_power[k + num_freq_bands], 0)) + { + b = 0; + b_exp = 0; + } + ELSE + { + IF(EQ_32(reference_power[k + ( ch_idx + 1 ) * num_freq_bands], 0)) + { + b = MAXVAL_WORD16; + b_exp = 40; + } + ELSE + { + b = BASOP_Util_Divide3232_Scale(reference_power[k + num_freq_bands], reference_power[k + ( ch_idx + 1 ) * num_freq_bands], &b_exp); + } + } + c = L_add(ONE_IN_Q29, Mpy_32_16_1( L_sub(h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29) , 5461)); /*Diffuseness modellling nrg compensation*/ /* 1.0 / 6.0 = 5461 in Q15*/ + + mpy_a_a_b = Mpy_32_32(a, Mpy_32_16_1(a, b)); //Q = (h_dirac_output_synthesis_state->q_direct_responses + (31 - b_exp) - 31) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 + mpy_diff_aab = Mpy_32_32(L_sub(L_shl(1, q_diffuseness), diffuseness[k]), mpy_a_a_b); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 + mpy_diff_c = Mpy_32_32(diffuseness[k], c); // Q = q_diffuseness - 2 + + q_diff_aab = (h_dirac_output_synthesis_state->direct_responses_q + (31 - b_exp) - 31) + (h_dirac_output_synthesis_state->direct_responses_q) - 31 + q_diffuseness - 31; + q_diff_c = sub(q_diffuseness, 2); + + IF(NE_32(mpy_diff_c, 0) && NE_32(mpy_diff_aab, 0)) + { + sqr_inp = BASOP_Util_Add_Mant32Exp(mpy_diff_c, sub(31, q_diff_c), mpy_diff_aab, sub(31, q_diff_aab), &sqr_exp); + } + ELSE + { + IF(EQ_32(mpy_diff_c, 0)) + { + sqr_inp = mpy_diff_aab; + sqr_exp = sub(31, q_diff_aab); + } + ELSE + { + sqr_inp = mpy_diff_c; + sqr_exp = sub(31, q_diff_c); + } + } + sqr = Sqrt32(sqr_inp, &sqr_exp); + sqr = L_shr(sqr, 2); + IF(NE_32(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], 0)) + { + IF(LT_16(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_shr(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sub(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub(31, sqr_exp))); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31, sqr_exp); + } + ELSE + { + sqr = L_shr(sqr, sub(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; + } + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + } + ELSE + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31 , sqr_exp); + } + } + } + ELSE + { + Word32 sqr_inp, mpy_diff, sqr; + Word16 sqr_exp; + /*Diffuseness modellling nrg compensation*/ + FOR ( k = 0; k < num_freq_bands_diff; k++ ) + { + mpy_diff = Mpy_32_32(diffuseness[k] ,L_sub(h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29));//Q = q_diff - 1 + sqr_inp = L_add(L_shl(1, sub(q_diffuseness, 1)) , mpy_diff); + sqr_exp = sub(31 , sub(q_diffuseness, 1)); + sqr = Sqrt32(sqr_inp, &sqr_exp); + sqr = L_shr(sqr, 2); + IF(NE_32(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], 0)) + { + IF(LT_16(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_shr(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sub(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub(31, sqr_exp))); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31, sqr_exp); + } + ELSE + { + sqr = L_shr(sqr, sub(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; + } + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + } + ELSE + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31 , sqr_exp); + } + } + FOR ( ; k < num_freq_bands; k++ ) + { + mpy_diff = Mpy_32_32(diffuseness[k] ,L_sub(h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29));//Q = q_diff - 1 + sqr_inp = L_add(L_shl(1, sub(q_diffuseness, 1)) , mpy_diff); + sqr_exp = sub(31 , sub(q_diffuseness, 1)); + sqr = Sqrt32(sqr_inp, &sqr_exp); + sqr = L_shr(sqr, 2); + IF(NE_32(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], 0)) + { + IF(LT_16(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_shr(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sub(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, sub(31, sqr_exp))); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31, sqr_exp); + } + ELSE + { + sqr = L_shr(sqr, sub(sub(31, sqr_exp), h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; + } + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + } + ELSE + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = L_add(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)], sqr); + Q_temp_cy_cross_dir_smooth_fx[L_add(i_mult(ch_idx, num_freq_bands), k)] = sub(31 , sqr_exp); + } + } + } + } + Word16 temp = MAX_16; + FOR(Word16 kk = 0 ; kk < num_freq_bands * num_channels_dir; kk++) + { + temp = s_min(Q_temp_cy_cross_dir_smooth_fx[kk], temp); + } + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp; move16(); + FOR(Word16 kk = 0 ; kk < num_freq_bands * num_channels_dir; kk++) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk] = L_shl(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk], sub(temp, Q_temp_cy_cross_dir_smooth_fx[kk])); + } + free(Q_temp_cy_cross_dir_smooth_fx); + /*Directional gain (panning)*/ + Word16 temp_q = sub(add(h_dirac_output_synthesis_state->direct_power_factor_q, h_dirac_output_synthesis_state->direct_responses_q), 31); + IF(LT_16(temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)) + { + FOR(Word16 kk = 0 ; kk < num_freq_bands * num_channels_dir; kk++) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk] = L_shl(h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk], sub(temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)); + } + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; + } + FOR ( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) + { + v_mult_fixed( h_dirac_output_synthesis_state->direct_power_factor_fx, + &h_dirac_output_synthesis_state->direct_responses_fx[i_mult(ch_idx, num_freq_bands)], + aux_buf, + num_freq_bands ); + + IF(NE_16(temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)) + { + Scale_sig32(aux_buf, num_freq_bands, sub(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q)); + } + + v_add_fixed( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], + num_freq_bands, 0); // Todo:Hdrm + } + + /*Diffuse gain*/ + FOR ( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc_fixed( h_dirac_output_synthesis_state->diffuse_power_factor_fx, + hDirACRend->diffuse_response_function_fx[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add_fixed( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], + num_freq_bands_diff, 0); // Todo:Hdrm + } + + return; + } + ELSE + { + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors_fx( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor_fx, + h_dirac_output_synthesis_state->diffuse_power_factor_fx ); + + Scale_sig32(h_dirac_output_synthesis_state->direct_power_factor_fx, num_freq_bands, 2); + Scale_sig32(h_dirac_output_synthesis_state->diffuse_power_factor_fx, num_freq_bands, 2); + h_dirac_output_synthesis_state->diffuse_power_factor_q = 31; + h_dirac_output_synthesis_state->direct_power_factor_q = 31; + } + } + + diff_start_band = 0; move16(); + IF ( h_dirac_output_synthesis_params->use_onset_filters ) + { + computeTargetPSDs_diffuse_with_onsets_fx( num_channels_dir, + num_freq_bands, h_dirac_output_synthesis_params->max_band_decorr, + hDirACRend->proto_index_diff, + h_dirac_output_synthesis_state->diffuse_power_factor_fx, + reference_power, + &q_reference_power, + h_dirac_output_synthesis_state->diffuse_responses_square_fx, + onset, + h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, + &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); + + diff_start_band = h_dirac_output_synthesis_params->max_band_decorr; move16(); + } + + /* process other PSDs only slot wise for 4 transport channels */ + IF ( EQ_16(dec_param_estim, TRUE )) + { + computeTargetPSDs_direct_fx( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor_fx, reference_power, &q_reference_power, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); + + computeTargetPSDs_diffuse_fx( num_channels_dir, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, reference_power, &q_reference_power, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); + } + + return; +} +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx() @@ -2023,10 +2496,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( // ((p_gains_dir_q - 1, p_proto_dir_q - 1) >> 1) -> (p_gains_dir_q + p_proto_dir_q - 32) output_real[l * num_channels_dir + ch_idx] = L_add( - Mpy_32_32( gs1, ( L_add( Mpy_32_32( (Word32) ( 1.772454e+00f * ONE_IN_Q30 ), ( *p_proto ) ), - Mpy_32_32( (Word32) ( 1.023327e+00f * ONE_IN_Q30 ), ( *p_proto2 ) ) ) ) ), /* s1 */ - Mpy_32_32( gs2, ( L_sub( Mpy_32_32( (Word32) ( 1.772454e+00f * ONE_IN_Q30 ), ( *p_proto ) ), - Mpy_32_32( (Word32) ( 1.023327e+00f * ONE_IN_Q30 ), ( *p_proto2 ) ) ) ) ) ); /* s2 */ + Mpy_32_32( gs1, ( L_add( Mpy_32_32( (Word32) ( 1903158016 ), ( *p_proto ) ), + Mpy_32_32( (Word32) ( 1098788992 ), ( *p_proto2 ) ) ) ) ), /* s1 */ + Mpy_32_32( gs2, ( L_sub( Mpy_32_32( (Word32) ( 1903158016 ), ( *p_proto ) ), + Mpy_32_32( (Word32) ( 1098788992 ), ( *p_proto2 ) ) ) ) ) ); /* s2 */ move32(); p_proto++; p_proto2++; @@ -2034,10 +2507,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( // ((p_gains_dir_q - 1, p_proto_dir_q - 1) >> 1) -> (p_gains_dir_q + p_proto_dir_q - 32) output_imag[l * num_channels_dir + ch_idx] = L_add( - Mpy_32_32( gs1, ( L_add( Mpy_32_32( (Word32) ( 1.772454e+00f * ONE_IN_Q30 ), ( *p_proto ) ), - Mpy_32_32( (Word32) ( 1.023327e+00f * ONE_IN_Q30 ), ( *p_proto2 ) ) ) ) ), - Mpy_32_32( gs2, ( L_sub( Mpy_32_32( (Word32) ( 1.772454e+00f * ONE_IN_Q30 ), ( *p_proto ) ), - Mpy_32_32( (Word32) ( 1.023327e+00f * ONE_IN_Q30 ), ( *p_proto2 ) ) ) ) ) ); + Mpy_32_32( gs1, ( L_add( Mpy_32_32( (Word32) ( 1903158016 ), ( *p_proto ) ), + Mpy_32_32( (Word32) ( 1098788992 ), ( *p_proto2 ) ) ) ) ), + Mpy_32_32( gs2, ( L_sub( Mpy_32_32( (Word32) ( 1903158016 ), ( *p_proto ) ), + Mpy_32_32( (Word32) ( 1098788992 ), ( *p_proto2 ) ) ) ) ) ); move32(); p_proto++; p_proto2++; @@ -4826,7 +5299,7 @@ static void computeTargetPSDs_direct_fx( return; } -#endif +#else static void computeTargetPSDs_direct( @@ -4862,7 +5335,7 @@ static void computeTargetPSDs_direct( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_direct_subframe_fx( @@ -4966,7 +5439,7 @@ static void computeTargetPSDs_diffuse_fx( return; } -#endif +#else static void computeTargetPSDs_diffuse( @@ -4997,7 +5470,7 @@ static void computeTargetPSDs_diffuse( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_diffuse_subframe_fx( @@ -5103,7 +5576,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( return; } -#endif +#else static void computeTargetPSDs_diffuse_with_onsets( @@ -5145,7 +5618,7 @@ static void computeTargetPSDs_diffuse_with_onsets( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeAlphaSynthesis_fx(Word16 *alpha_synthesis_fx, const Word16 averaging_length_ms, const Word16 maxAlpha_fx, Word16 *numAlphas, const Word16 slot_size, const Word16 num_freq_bands, Word16 *frequency_axis_fx, const Word32 output_Fs) { @@ -5202,7 +5675,7 @@ static void computeAlphaSynthesis_fx(Word16 *alpha_synthesis_fx, const Word16 av return; } -#endif +#else static void computeAlphaSynthesis( float *alpha_synthesis, @@ -5245,7 +5718,7 @@ static void computeAlphaSynthesis( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void spreadCoherencePanningHoa_fx( const Word16 azimuth, diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index e551b2205..85ef5378c 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1627,7 +1627,7 @@ ivas_error ivas_dirac_alloc_mem( #ifdef IVAS_FLOAT_FIXED hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx = hDirAC_mem->cy_cross_dir_smooth_fx; hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx = hDirAC_mem->cy_auto_diff_smooth_fx; - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = 0; + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = 31; move16(); hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = 0; move16(); @@ -5815,7 +5815,410 @@ static void ivas_masa_ext_dirac_render_sf( return; } +#ifdef IVAS_FLOAT_FIXED +static void ivas_masa_ext_dirac_render_sf_fx( + MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: IVAS decoder structure */ + Word32 *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +) +{ + int16_t i, ch, idx_in, idx_lfe; + DIRAC_REND_HANDLE hDirACRend; + Word32 dirEne; + Word32 surCohEner; + Word16 surCohRatio[CLDFB_NO_CHANNELS_MAX]; + Word16 surCohRatio_exp; + Word16 subframe_idx; + Word16 slot_idx, index_slot; + Word16 slot_idx_start, slot_idx_start_cldfb_synth, md_idx; + Word16 nchan_transport, q_cldfb; + Word16 masa_band_mapping[MASA_FREQUENCY_BANDS + 1]; + + /* CLDFB: last output channels reserved to LFT for CICPx */ + Word32 Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + + /* local copies of azi, ele, diffuseness */ + Word16 azimuth[CLDFB_NO_CHANNELS_MAX]; + Word16 elevation[CLDFB_NO_CHANNELS_MAX]; + Word32 diffuseness_vector[CLDFB_NO_CHANNELS_MAX]; + + DIRAC_DEC_STACK_MEM DirAC_mem; + Word32 *reference_power, *reference_power_smooth; + Word16 q_reference_power; + Word32 *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; + uint16_t coherence_flag; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + push_wmops( "ivas_masa_ext_dirac_render_sf" ); + + /* Initialize aux buffers */ + hDirACRend = hMasaExtRend->hDirACRend; + hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; + nchan_transport = hMasaExtRend->nchan_input; + move16(); + DirAC_mem = hDirACRend->stack_mem; + + reference_power = DirAC_mem.reference_power_fx; move32(); + reference_power_smooth = ( DirAC_mem.reference_power_fx == NULL ) ? NULL : DirAC_mem.reference_power_fx + hSpatParamRendCom->num_freq_bands; + onset_filter = DirAC_mem.onset_filter_fx; + onset_filter_subframe = ( DirAC_mem.onset_filter_fx == NULL ) ? NULL : DirAC_mem.onset_filter_fx + hSpatParamRendCom->num_freq_bands; + coherence_flag = 1; /* There is always coherence assumed for ext rend of MASA */ + move16(); + /* Construct default MASA band mapping */ + FOR ( i = 0; i < MASA_FREQUENCY_BANDS + 1; i++ ) + { + masa_band_mapping[i] = i; move16(); + } + + /* Subframe loop */ + slot_idx_start = hSpatParamRendCom->slots_rendered; move16(); + slot_idx_start_cldfb_synth = 0; move16(); + + subframe_idx = hSpatParamRendCom->subframes_rendered; move16(); + md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; move16(); + + /* copy parameters into local buffers*/ + Copy( hSpatParamRendCom->azimuth[hSpatParamRendCom->render_to_md_map[subframe_idx]], azimuth, hSpatParamRendCom->num_freq_bands ); + Copy( hSpatParamRendCom->elevation[hSpatParamRendCom->render_to_md_map[subframe_idx]], elevation, hSpatParamRendCom->num_freq_bands ); + Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + + IF ( NE_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + set32_fx( reference_power_smooth, 0, hSpatParamRendCom->num_freq_bands ); + } + ELSE + { + set32_fx( onset_filter_subframe, 0, hSpatParamRendCom->num_freq_bands ); + } + + /* compute response */ + IF ( NE_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + ivas_dirac_dec_compute_power_factors_fx( hSpatParamRendCom->num_freq_bands, + diffuseness_vector, + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx ); + + IF ( coherence_flag ) + { + FOR ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + dirEne = hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i]; move32(); + surCohEner = Mpy_32_16_1(hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]); //Q.31 + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i] = L_sub(hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], surCohEner); + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i] = L_add(hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], surCohEner); + + surCohRatio[i] = BASOP_Util_Divide3232_Scale( surCohEner, L_add( L_add(1, dirEne), surCohEner ), &surCohRatio_exp); + } + } + ELSE + { + set16_fx( surCohRatio, 0, hSpatParamRendCom->num_freq_bands ); + } + } + ELSE + { + ivas_dirac_dec_compute_gain_factors_fx( hSpatParamRendCom->num_freq_bands, + hSpatParamRendCom->diffuseness_vector_fx[md_idx], + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, + &hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, + &hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q + ); + + IF ( coherence_flag ) + { + FOR ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + surCohRatio[i] = hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]; move16(); + } + } + ELSE + { + set16_fx( surCohRatio, 0, hSpatParamRendCom->num_freq_bands ); + } + } + + ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, + hDirACRend, + hMasaExtRend->hVBAPdata, + masa_band_mapping, + NULL, + azimuth, + elevation, + md_idx, + surCohRatio, + surCohRatio_exp, + 0, + NULL, + 0 ); + + + FOR ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + index_slot = add(slot_idx_start, slot_idx); + md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; move16(); + + /* CLDFB Analysis*/ + FOR ( ch = 0; ch < nchan_transport; ch++ ) + { + cldfbAnalysis_ts_fx( &( output_f[ch][hSpatParamRendCom->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hSpatParamRendCom->num_freq_bands, + hMasaExtRend->cldfbAnaRend[ch], q_cldfb); + } + + + IF ( EQ_16(nchan_transport, 1 )) + { + /* Need to set second CLDFB channel to zero as further processing assumes CNA content in it */ + set16_fx( Cldfb_RealBuffer[1][0], 0, hSpatParamRendCom->num_freq_bands ); + set16_fx( Cldfb_ImagBuffer[1][0], 0, hSpatParamRendCom->num_freq_bands ); + } + + /*-----------------------------------------------------------------* + * prototype signal computation + *-----------------------------------------------------------------*/ + + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + protoSignalComputation_shd_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + reference_power, q_reference_power, slot_idx, nchan_transport, + hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + 0, q_cldfb); + } + ELSE IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO )) + { + protoSignalComputation2_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power, q_reference_power, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect, q_cldfb); + } + ELSE + { + SWITCH ( nchan_transport ) + { + case 2: + protoSignalComputation2_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f_fx, + hDirACRend->proto_frame_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power, + q_reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + hDirACRend->hOutSetup.is_loudspeaker_setup, + slot_idx, + hSpatParamRendCom->num_freq_bands, + hDirACRend->masa_stereo_type_detect, q_cldfb); + BREAK; + case 1: + protoSignalComputation1_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirACRend->proto_frame_f_fx, + hDirACRend->proto_frame_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power, + q_reference_power, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + slot_idx, + hDirACRend->num_protos_diff, + hSpatParamRendCom->num_freq_bands, q_cldfb); + BREAK; + default: + return; + } + } + + /*-----------------------------------------------------------------* + * frequency domain decorrelation + *-----------------------------------------------------------------*/ + + IF ( EQ_16(hDirACRend->proto_signal_decorr_on, 1 )) + { + /* decorrelate prototype frame */ + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + ivas_dirac_dec_decorr_process_fx( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + i_mult(i_mult(slot_idx, hSpatParamRendCom->num_freq_bands), shl( hDirACRend->num_outputs_diff, 1)), + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + add (i_mult(i_mult(slot_idx, hSpatParamRendCom->num_freq_bands), shl(hDirACRend->num_outputs_diff, 1)) , shl(i_mult(hSpatParamRendCom->num_freq_bands, s_min( 4, nchan_transport )), 1)), + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + onset_filter, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); + + v_multc_fixed( onset_filter, ONE_IN_Q28, onset_filter, hSpatParamRendCom->num_freq_bands ); /*0.25 in Q31 = Q28*/ + v_add_fixed( onset_filter, onset_filter_subframe, onset_filter_subframe, hSpatParamRendCom->num_freq_bands, 1); + p_onset_filter = onset_filter_subframe; + } + ELSE + { + ivas_dirac_dec_decorr_process_fx( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->proto_frame_f_fx, + hDirACRend->proto_frame_f_q, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + DirAC_mem.frame_dec_f_fx, + DirAC_mem.frame_dec_f_q, + onset_filter, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); + + hDirACRend->proto_frame_dec_f_fx = DirAC_mem.frame_dec_f_fx; + p_onset_filter = onset_filter; + } + } + ELSE + { + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + set32_fx( onset_filter_subframe, MAX_32, hSpatParamRendCom->num_freq_bands ); + p_onset_filter = onset_filter_subframe; + } + ELSE + { + /* no frequency domain decorrelation: use prototype frame */ + hDirACRend->proto_frame_dec_f_fx = hDirACRend->proto_frame_f_fx; + p_onset_filter = NULL; + } + } + + /*-----------------------------------------------------------------* + * output synthesis + *-----------------------------------------------------------------*/ + test(); + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS) || EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD )) + { + /* Compute diffuse prototypes */ + ivas_dirac_dec_compute_diffuse_proto_fx( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); + } + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector_fx[md_idx], + hSpatParamRendCom, + hDirACRend, + 0, + 0, + hMasaExtRend->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + 0, + 0 ); + + IF ( NE_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + v_add_fixed( reference_power, reference_power_smooth, reference_power_smooth, hSpatParamRendCom->num_freq_bands, 1); + } + } + + ivas_dirac_dec_output_synthesis_get_interpolator_fx( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) + { + ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hSpatParamRendCom, + hDirACRend, + nchan_transport, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + p_onset_filter, + diffuseness_vector, + 0, + 0, + &hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, + &hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev + ); + } + ELSE + { + ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hSpatParamRendCom, + hDirACRend, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + diffuseness_vector, + reference_power_smooth, + 1.0f, + 0 ); + } + + /*-----------------------------------------------------------------* + * CLDFB synthesis (and binaural rendering) + *-----------------------------------------------------------------*/ + + index_slot = slot_idx_start_cldfb_synth; move16(); + + { + Word32 *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word16 outchannels; + + idx_in = 0; move16(); + idx_lfe = 0; move16(); + + outchannels = add(hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe); + + /* Note here that compared to decoder path, there is no separate channel ever for MASA ext rend path */ + + FOR ( ch = 0; ch < outchannels; ch++ ) + { + IF ( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ) && ( EQ_16(hDirACRend->hOutSetup.index_lfe[idx_lfe], ch )) ) + { + /* No LFE for MASA rendering */ + set32_fx( &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), 0, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); + + IF ( LT_16(idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) )) + { + idx_lfe++; + } + } + ELSE + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + FOR ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + } + cldfbSynthesis_ivas_fx( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], hMasaExtRend->cldfbSynRend[idx_in] ); + idx_in++; + } + } + } + hSpatParamRendCom->slots_rendered = add(hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->slots_rendered); + hSpatParamRendCom->subframes_rendered++; + + pop_wmops(); + + return; +} +#endif void ivas_masa_ext_dirac_render( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ float *output_f[], /* i/o: input/output signals in time domain */ @@ -5852,3 +6255,41 @@ void ivas_masa_ext_dirac_render( return; } +#ifdef IVAS_FLOAT_FIXED +void ivas_masa_ext_dirac_render_fx( + MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ + Word32 *output_f[], /* i/o: input/output signals in time domain */ + const Word16 num_subframes /* i : number of subframes to render */ +) +{ + Word16 subframe_idx; + Word32 *output_f_local[MAX_OUTPUT_CHANNELS]; + Word16 n, n_samples_sf; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; + + n_samples_sf = i_mult(JBM_CLDFB_SLOTS_IN_SUBFRAME, hSpatParamRendCom->slot_size); + + FOR ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) + { + output_f_local[n] = output_f[n]; + } + + hSpatParamRendCom->subframes_rendered = hSpatParamRendCom->dirac_read_idx; + + FOR ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) + { + hSpatParamRendCom->slots_rendered = 0; + ivas_masa_ext_dirac_render_sf_fx( hMasaExtRend, output_f_local ); + FOR ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) + { + output_f_local[n] += n_samples_sf; + } + + hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; + } + + return; +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 03d3403b0..be1678638 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -68,23 +68,26 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static ivas_error poly_init( EFAP *efap, const int16_t efip_flag ); #ifndef IVAS_FLOAT_FIXED +static ivas_error poly_init(EFAP *efap, const int16_t efip_flag); static ivas_error sphere_triangulation( const int16_t numSpk, EFAP_VERTEX_DATA *vtxData, EFAP_POLYSET_DATA *polyData, float ***dmTranspose, int16_t *numTot, const int16_t efip_flag ); static void initial_polyeder( EFAP_VERTEX_DATA *vtxData, EFAP_LS_TRIANGLE *triArray, int16_t *numTri, int16_t *vtxInHull ); static void add_ghost_speakers( EFAP_VERTEX *vertexArray, int16_t *numVtx, const int16_t efip_flag ); static void add_vertex_to_convex_hull( const EFAP_VERTEX_DATA *vtxData, const int16_t vtxIdx, int16_t *vtxInHull, EFAP_LS_TRIANGLE *triArray, int16_t *szTri ); +static void sort_vertices(const EFAP_VERTEX *vertexArray, const int16_t *numVtx, int16_t *order); +static void visible_edges(const EFAP_LS_TRIANGLE *triArray, const int16_t *visible, const int16_t numSurface, int16_t *numEdges, int16_t *edges); #else -static ivas_error sphere_triangulation( const int16_t numSpk, EFAP_VERTEX_DATA *vtxData, EFAP_POLYSET_DATA *polyData, Word32 ***dmTranspose, int16_t *numTot, const int16_t efip_flag ); -static void initial_polyeder_fixed( EFAP_VERTEX_DATA *vtxData, EFAP_LS_TRIANGLE *triArray, Word16 *numTri, Word16 *vtxInHull ); -static void add_ghost_speakers_fixed( EFAP_VERTEX *vertexArray, Word16 *numVtx, const Word16 efip_flag ); -static void add_vertex_to_convex_hull_fixed( const EFAP_VERTEX_DATA *vtxData, const Word16 vtxIdx, Word16 *vtxInHull, EFAP_LS_TRIANGLE *triArray, Word16 *szTri ); +static ivas_error poly_init_fx(EFAP *efap, const Word16 efip_flag); +static ivas_error sphere_triangulation_fx( const Word16 numSpk, EFAP_VERTEX_DATA *vtxData, EFAP_POLYSET_DATA *polyData, Word32 ***dmTranspose, Word16 *numTot, const Word16 efip_flag ); +static void initial_polyeder_fx( EFAP_VERTEX_DATA *vtxData, EFAP_LS_TRIANGLE *triArray, Word16 *numTri, Word16 *vtxInHull ); +static void add_ghost_speakers_fx( EFAP_VERTEX *vertexArray, Word16 *numVtx, const Word16 efip_flag ); +static void add_vertex_to_convex_hull_fx( const EFAP_VERTEX_DATA *vtxData, const Word16 vtxIdx, Word16 *vtxInHull, EFAP_LS_TRIANGLE *triArray, Word16 *szTri ); +static void sort_vertices_fx(const EFAP_VERTEX *vertexArray, const Word16 *numVtx, Word16 *order); +static void visible_edges_fx(const EFAP_LS_TRIANGLE *triArray, const Word16 *visible, const Word16 numSurface, Word16 *numEdges, Word16 *edges); #endif -static void sort_vertices( const EFAP_VERTEX *vertexArray, const int16_t *numVtx, int16_t *order ); -static void visible_edges( const EFAP_LS_TRIANGLE *triArray, const Word16 *visible, const Word16 numSurface, Word16 *numEdges, Word16 *edges ); #ifndef IVAS_FLOAT_FIXED static void flip_plane( const EFAP_VERTEX *vtxArray, int16_t *surface, const float centroid[3] ); @@ -94,12 +97,12 @@ static void efap_panning( const float azi, const float ele, const EFAP_POLYSET_D static void get_poly_gains( const float azi, const float ele, const float aziPoly[EFAP_MAX_CHAN_NUM], const float elePoly[EFAP_MAX_CHAN_NUM], const int16_t numChan, float *buffer ); static float get_tri_gain( const float A[2], const float B[2], const float C[2], const float P_minus_A[2] ); #else -static void flip_plane_fixed( const EFAP_VERTEX *vtxArray, Word16 *surface, const Word32 centroid[3] ); -static void remap_ghosts_fixed( EFAP_VERTEX *vtxArray, EFAP_LS_TRIANGLE *triArray, Word16 numSpk, Word16 *numVertex, Word16 numTri, Word32 **downmixMatrix ); -static void vertex_init_fixed( const Word32 *aziSpk, const Word32 *eleSpk, EFAP_VERTEX_DATA *efapVtxData ); -static void efap_panning_fixed( const Word32 azi, const Word32 ele, const EFAP_POLYSET_DATA *polyData, Word32 *bufferL ); -static void get_poly_gains_fixed( const Word32 azi, const Word32 ele, const Word32 aziPoly[EFAP_MAX_CHAN_NUM], const Word32 elePoly[EFAP_MAX_CHAN_NUM], const Word16 numChan, Word32 *buffer ); -static Word32 get_tri_gain_fixed( const Word32 A[2], const Word32 B[2], const Word32 C[2], const Word32 P_minus_A[2] ); +static void flip_plane_fx( const EFAP_VERTEX *vtxArray, Word16 *surface, const Word32 centroid[3] ); +static void remap_ghosts_fx( EFAP_VERTEX *vtxArray, EFAP_LS_TRIANGLE *triArray, Word16 numSpk, Word16 *numVertex, Word16 numTri, Word32 **downmixMatrix ); +static void vertex_init_fx( const Word32 *aziSpk, const Word32 *eleSpk, EFAP_VERTEX_DATA *efapVtxData ); +static void efap_panning_fx( const Word32 azi, const Word32 ele, const EFAP_POLYSET_DATA *polyData, Word32 *bufferL ); +static void get_poly_gains_fx( const Word32 azi, const Word32 ele, const Word32 aziPoly[EFAP_MAX_CHAN_NUM], const Word32 elePoly[EFAP_MAX_CHAN_NUM], const Word16 numChan, Word32 *buffer ); +static Word32 get_tri_gain_fx( const Word32 A[2], const Word32 B[2], const Word32 C[2], const Word32 P_minus_A[2] ); #endif /*-----------------------------------------------------------------------* @@ -108,37 +111,43 @@ static Word32 get_tri_gain_fixed( const Word32 A[2], const Word32 B[2], const Wo #ifndef IVAS_FLOAT_FIXED static void add_vertex( EFAP_VERTEX *vtxArray, const float azi, const float ele, const int16_t pos, const EFAP_VTX_DMX_TYPE ); +static void efap_sort_s(int16_t *x, int16_t *idx, const int16_t len); #else -static void add_vertex_fixed( EFAP_VERTEX *vtxArray, const Word32 azi, const Word32 ele, const Word16 pos, const EFAP_VTX_DMX_TYPE ); +static void add_vertex_fx( EFAP_VERTEX *vtxArray, const Word32 azi, const Word32 ele, const Word16 pos, const EFAP_VTX_DMX_TYPE ); +static void efap_sort_s_fx(Word16 *x, Word16 *idx, const Word16 len); #endif -static void efap_sort_s( int16_t *x, int16_t *idx, const int16_t len ); #ifndef IVAS_FLOAT_FIXED static float vertex_distance( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE tri, const int16_t vtxIdx ); static float point_plane_distance( const float P1[3], const float P2[3], const float P3[3], const float X[3] ); static float point_poly_distance( const EFAP_POLYSET poly, const float X[3] ); 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); +static void remove_vertex(EFAP_VERTEX *vtxArray, const int16_t idx, const int16_t L); +static int16_t get_neighbours(const EFAP_LS_TRIANGLE *triArray, const int16_t vtxIdx, const int16_t numTri, int16_t *neighbours); #else -static Word32 vertex_distance_fixed( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE tri, const Word16 vtxIdx ); -static Word32 point_plane_distance_fixed( const Word32 P1[3], const Word32 P2[3], const Word32 P3[3], const Word32 X[3] ); -static Word32 point_poly_distance_fixed( const EFAP_POLYSET poly, const Word32 X[3] ); -static void efap_crossp_fixed( const Word32 *v1, const Word32 *v2, Word32 *v ); +static Word32 vertex_distance_fx( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE tri, const Word16 vtxIdx ); +static Word32 point_plane_distance_fx( const Word32 P1[3], const Word32 P2[3], const Word32 P3[3], const Word32 X[3] ); +static Word32 point_poly_distance_fx( const EFAP_POLYSET poly, const Word32 X[3] ); +static void efap_crossp_fx( const Word32 *v1, const Word32 *v2, Word32 *v ); +static Word16 find_int_in_tri_fx(const EFAP_LS_TRIANGLE *tri, const Word16 n, const Word16 r, Word16 *pos); +static void remove_vertex_fx(EFAP_VERTEX *vtxArray, const Word16 idx, const Word16 L); +static Word16 get_neighbours_fx(const EFAP_LS_TRIANGLE *triArray, const Word16 vtxIdx, const Word16 numTri, Word16 *neighbours); #endif -static int16_t find_int_in_tri( const EFAP_LS_TRIANGLE *tri, const int16_t n, const int16_t r, int16_t *pos ); -static void remove_vertex( EFAP_VERTEX *vtxArray, const int16_t idx, const int16_t L ); -static int16_t get_neighbours( const EFAP_LS_TRIANGLE *triArray, const int16_t vtxIdx, const int16_t numTri, int16_t *neighbours ); #ifndef IVAS_FLOAT_FIXED static void matrix_times_row( float mat[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF], const float *vec, const int16_t L, float *out ); +static void tri_to_poly(const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, const int16_t numVtx, const int16_t numTri, int16_t sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM], int16_t *outLengthPS, int16_t outLengthSorted[EFAP_MAX_POLY_SET]); +static int16_t compare_poly(int16_t *old, int16_t lenOld, int16_t *new, int16_t lenNew); #else -static void matrix_times_row_fixed( Word32 mat[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF], const Word32 *vec, const Word16 L, Word32 *out ); +static void matrix_times_row_fx( Word32 mat[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF], const Word32 *vec, const Word16 L, Word32 *out ); +static void tri_to_poly_fx(const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, const Word16 numVtx, const Word16 numTri, Word16 sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM], Word16 *outLengthPS, Word16 outLengthSorted[EFAP_MAX_POLY_SET]); +static Word16 compare_poly_fx(Word16 *old, Word16 lenOld, Word16 *new, Word16 lenNew); #endif -static void tri_to_poly( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, const int16_t numVtx, const int16_t numTri, int16_t sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM], int16_t *outLengthPS, int16_t outLengthSorted[EFAP_MAX_POLY_SET] ); -static int16_t compare_poly( int16_t *old, int16_t lenOld, int16_t *new, int16_t lenNew ); #ifndef IVAS_FLOAT_FIXED static void sort_channels_vertex( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, int16_t channels[EFAP_MAX_CHAN_NUM], const int16_t lengthChannels, int16_t idxTri ); @@ -148,34 +157,33 @@ 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] ); static void sph2cart( const float azi, const float ele, float *pos ); #else -static void sort_channels_vertex_fixed( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, Word16 channels[EFAP_MAX_CHAN_NUM], const Word16 lengthChannels, Word16 idxTri ); +static void sort_channels_vertex_fx( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGLE *triArray, Word16 channels[EFAP_MAX_CHAN_NUM], const Word16 lengthChannels, Word16 idxTri ); static Word32 efap_lmodl( const Word32 x, const Word32 y ); -static Word16 get_poly_num_fixed( const Word32 P[2], const EFAP_POLYSET_DATA *polyData ); -static Word16 in_poly_fixed( const Word32 P[2], const EFAP_POLYSET poly ); -static Word16 in_tri_fixed( Word32 A[2], Word32 B[2], Word32 C[2], Word32 P_minus_A[2] ); -static void sph2cart_fixed( const Word32 azi, const Word32 ele, Word32 *pos ); +static Word16 get_poly_num_fx( const Word32 P[2], const EFAP_POLYSET_DATA *polyData ); +static Word16 in_poly_fx( const Word32 P[2], const EFAP_POLYSET poly ); +static Word16 in_tri_fx( Word32 A[2], Word32 B[2], Word32 C[2], Word32 P_minus_A[2] ); +static void sph2cart_fx( const Word32 azi, const Word32 ele, Word32 *pos ); #endif /*-----------------------------------------------------------------------* * Global function definitions *-----------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* - * efap_init_data() + * efap_init_data_fx() * * Wrap the internal functions to initialize the EFAP data structure *-------------------------------------------------------------------------*/ -ivas_error efap_init_data( +ivas_error efap_init_data_fx( EFAP_HANDLE *hEFAPdata, /* i/o: handle for EFAP data structure that will be initialized */ - const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ - const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ - const int16_t num_speaker_nodes, /* i : number of speaker nodes in the set */ - const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ + const Word32 *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) (Q22) */ + const Word32 *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) (Q22) */ + const Word16 num_speaker_nodes, /* i : number of speaker nodes in the set */ + const Word16 efap_mode /* i : indicates whether EFAP or EFIP is used */ ) { -#ifndef IVAS_FLOAT_FIXED /* Handle instance declaration */ EFAP *efap; ivas_error error; @@ -183,7 +191,7 @@ ivas_error efap_init_data( error = IVAS_ERR_OK; /* Basic init checks */ - if ( !speaker_node_azi_deg || !speaker_node_ele_deg ) + IF( !speaker_node_azi_deg || !speaker_node_ele_deg ) { hEFAPdata = NULL; return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "EFAP requires arrays of speaker azimuths and elevations" ); @@ -194,29 +202,29 @@ ivas_error efap_init_data( *-----------------------------------------------------------------*/ /* Memory Allocations for efap */ - if ( ( efap = (EFAP *) malloc( sizeof( EFAP ) ) ) == NULL ) + IF( ( efap = (EFAP *) malloc( sizeof( EFAP ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP handle\n" ) ); } /* Memory Allocation and update for aziSpk & eleSpk arrays*/ - if ( ( efap->aziSpk = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + IF( ( efap->aziSpk = (Word32 *) malloc( num_speaker_nodes * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP speaker azimuths\n" ) ); } - if ( ( efap->eleSpk = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + IF( ( efap->eleSpk = (Word32 *) malloc( num_speaker_nodes * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP speaker elevations\n" ) ); } /* Memory Allocation for vertexArray */ - if ( ( efap->vtxData.vertexArray = (EFAP_VERTEX *) malloc( ( num_speaker_nodes + EFAP_MAX_GHOST_LS ) * sizeof( EFAP_VERTEX ) ) ) == NULL ) + IF( ( efap->vtxData.vertexArray = (EFAP_VERTEX *) malloc( ( num_speaker_nodes + EFAP_MAX_GHOST_LS ) * sizeof( EFAP_VERTEX ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP Vertex Array\n" ) ); } /* Memory allocation for the tmp buffer short */ - if ( ( efap->bufferShort = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + IF( ( efap->bufferShort_fx = (Word32 *) malloc( num_speaker_nodes * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); } @@ -231,50 +239,39 @@ ivas_error efap_init_data( efap->vtxData.numVtx = num_speaker_nodes; /* Loudspeaker configuration */ - mvr2r( speaker_node_azi_deg, efap->aziSpk, num_speaker_nodes ); - mvr2r( speaker_node_ele_deg, efap->eleSpk, num_speaker_nodes ); + mvl2l( speaker_node_azi_deg, efap->aziSpk, num_speaker_nodes ); + mvl2l( speaker_node_ele_deg, efap->eleSpk, num_speaker_nodes ); /* Initialization of the vertex */ - vertex_init( efap->aziSpk, efap->eleSpk, &efap->vtxData ); + vertex_init_fx( efap->aziSpk, efap->eleSpk, &efap->vtxData ); /* Initialization of polygons and ghost LS */ - if ( ( error = poly_init( efap, efap_mode ) ) != IVAS_ERR_OK ) + IF( ( error = poly_init_fx( efap, efap_mode ) ) != IVAS_ERR_OK ) { return error; } /* Memory allocation for the tmp buffer long */ - if ( ( efap->bufferLong = (float *) malloc( efap->vtxData.numVtx * sizeof( float ) ) ) == NULL ) + IF( ( efap->bufferLong_fx = (Word32 *) malloc( efap->vtxData.numVtx * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferL\n" ) ); } *hEFAPdata = efap; return error; -#else - /* Following conversion should be removed once all inputs are converted to Word32 azi and ele angles */ - Word32 azi_inp[MAX_OUTPUT_CHANNELS], ele_inp[MAX_OUTPUT_CHANNELS]; - FOR( int spk_idx = 0; spk_idx < num_speaker_nodes; spk_idx++ ) - { - azi_inp[spk_idx] = (Word32) ( speaker_node_azi_deg[spk_idx] * Q22_1 ); - ele_inp[spk_idx] = (Word32) ( speaker_node_ele_deg[spk_idx] * Q22_1 ); - } - return efap_init_data_fixed( hEFAPdata, azi_inp, ele_inp, num_speaker_nodes, efap_mode ); -#endif } -#ifdef IVAS_FLOAT_FIXED -/*-------------------------------------------------------------------------* - * efap_init_data_fixed() - * - * Wrap the internal functions to initialize the EFAP data structure - *-------------------------------------------------------------------------*/ - -ivas_error efap_init_data_fixed( +#else + /*-------------------------------------------------------------------------* + * efap_init_data() + * + * Wrap the internal functions to initialize the EFAP data structure + *-------------------------------------------------------------------------*/ +ivas_error efap_init_data( EFAP_HANDLE *hEFAPdata, /* i/o: handle for EFAP data structure that will be initialized */ - const Word32 *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) (Q22) */ - const Word32 *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) (Q22) */ - const Word16 num_speaker_nodes, /* i : number of speaker nodes in the set */ - const Word16 efap_mode /* i : indicates whether EFAP or EFIP is used */ + const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ + const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ + const int16_t num_speaker_nodes, /* i : number of speaker nodes in the set */ + const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ ) { /* Handle instance declaration */ @@ -284,7 +281,7 @@ ivas_error efap_init_data_fixed( error = IVAS_ERR_OK; /* Basic init checks */ - IF( !speaker_node_azi_deg || !speaker_node_ele_deg ) + if ( !speaker_node_azi_deg || !speaker_node_ele_deg ) { hEFAPdata = NULL; return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "EFAP requires arrays of speaker azimuths and elevations" ); @@ -295,29 +292,29 @@ ivas_error efap_init_data_fixed( *-----------------------------------------------------------------*/ /* Memory Allocations for efap */ - IF( ( efap = (EFAP *) malloc( sizeof( EFAP ) ) ) == NULL ) + if ( ( efap = (EFAP *) malloc( sizeof( EFAP ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP handle\n" ) ); } /* Memory Allocation and update for aziSpk & eleSpk arrays*/ - IF( ( efap->aziSpk = (Word32 *) malloc( num_speaker_nodes * sizeof( Word32 ) ) ) == NULL ) + if ( ( efap->aziSpk = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP speaker azimuths\n" ) ); } - IF( ( efap->eleSpk = (Word32 *) malloc( num_speaker_nodes * sizeof( Word32 ) ) ) == NULL ) + if ( ( efap->eleSpk = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP speaker elevations\n" ) ); } /* Memory Allocation for vertexArray */ - IF( ( efap->vtxData.vertexArray = (EFAP_VERTEX *) malloc( ( num_speaker_nodes + EFAP_MAX_GHOST_LS ) * sizeof( EFAP_VERTEX ) ) ) == NULL ) + if ( ( efap->vtxData.vertexArray = (EFAP_VERTEX *) malloc( ( num_speaker_nodes + EFAP_MAX_GHOST_LS ) * sizeof( EFAP_VERTEX ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP Vertex Array\n" ) ); } /* Memory allocation for the tmp buffer short */ - IF( ( efap->bufferShort_fx = (Word32 *) malloc( num_speaker_nodes * sizeof( Word32 ) ) ) == NULL ) + if ( ( efap->bufferShort = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); } @@ -332,20 +329,20 @@ ivas_error efap_init_data_fixed( efap->vtxData.numVtx = num_speaker_nodes; /* Loudspeaker configuration */ - mvl2l( speaker_node_azi_deg, efap->aziSpk, num_speaker_nodes ); - mvl2l( speaker_node_ele_deg, efap->eleSpk, num_speaker_nodes ); + mvr2r( speaker_node_azi_deg, efap->aziSpk, num_speaker_nodes ); + mvr2r( speaker_node_ele_deg, efap->eleSpk, num_speaker_nodes ); /* Initialization of the vertex */ - vertex_init_fixed( efap->aziSpk, efap->eleSpk, &efap->vtxData ); + vertex_init( efap->aziSpk, efap->eleSpk, &efap->vtxData ); /* Initialization of polygons and ghost LS */ - IF( ( error = poly_init( efap, efap_mode ) ) != IVAS_ERR_OK ) + if ( ( error = poly_init( efap, efap_mode ) ) != IVAS_ERR_OK ) { return error; } /* Memory allocation for the tmp buffer long */ - IF( ( efap->bufferLong_fx = (Word32 *) malloc( efap->vtxData.numVtx * sizeof( Word32 ) ) ) == NULL ) + if ( ( efap->bufferLong = (float *) malloc( efap->vtxData.numVtx * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferL\n" ) ); } @@ -355,102 +352,16 @@ ivas_error efap_init_data_fixed( } #endif -/*-------------------------------------------------------------------------* - * efap_determine_gains() - * - * Obtain amplitude panning gains for all speaker nodes based on the - * given direction - *-------------------------------------------------------------------------*/ - -void efap_determine_gains( - EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - float *gains, /* o : gain vector for speaker nodes for given direction */ - const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ - const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ - const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ -) -{ -#ifndef IVAS_FLOAT_FIXED - int16_t i, j; - float azi_wrap, ele_wrap; - float normBuffer; - - /* Resetting bufferShort and bufferLong */ - set_zero( hEFAPdata->bufferShort, hEFAPdata->numSpk ); - set_zero( hEFAPdata->bufferLong, hEFAPdata->vtxData.numVtx ); - - /* Wrap angles to correct range */ - panning_wrap_angles( azi_deg, ele_deg, &azi_wrap, &ele_wrap ); - - /* Panning */ - efap_panning( azi_wrap, ele_wrap, &hEFAPdata->polyData, hEFAPdata->bufferLong ); - - if ( efap_mode == EFAP_MODE_EFAP ) - { - normBuffer = 0.f; - for ( j = 0; j < hEFAPdata->numSpk; ++j ) - { - hEFAPdata->bufferShort[j] = 0.f; - /* Multiplying by the downmixMatrix */ - for ( i = 0; i < hEFAPdata->vtxData.numVtx; ++i ) - { - hEFAPdata->bufferShort[j] += hEFAPdata->bufferLong[i] * hEFAPdata->dmTranspose[i][j]; - } - normBuffer = normBuffer + hEFAPdata->bufferShort[j] * hEFAPdata->bufferShort[j]; - } - normBuffer = inv_sqrt( normBuffer ); - - for ( j = 0; j < hEFAPdata->numSpk; ++j ) - { - hEFAPdata->bufferShort[j] *= normBuffer; - } - } - else - { - normBuffer = 0.f; - for ( j = 0; j < hEFAPdata->numSpk; ++j ) - { - hEFAPdata->bufferShort[j] = 0.f; - /* Multiplying by the downmixMatrix */ - for ( i = 0; i < hEFAPdata->vtxData.numVtx; ++i ) - { - hEFAPdata->bufferShort[j] += hEFAPdata->bufferLong[i] * hEFAPdata->dmTranspose[i][j]; - } - normBuffer = normBuffer + hEFAPdata->bufferShort[j]; - } - normBuffer = 1.f / normBuffer; - - for ( j = 0; j < hEFAPdata->numSpk; ++j ) - { - hEFAPdata->bufferShort[j] = sqrtf( hEFAPdata->bufferShort[j] * normBuffer ); - } - } - - /* Copy gains to output */ - mvr2r( hEFAPdata->bufferShort, gains, hEFAPdata->numSpk ); - - return; -#else - /* block to be removed once efap_determine_gains_fixed() is integrated into all calling places */ - const Word32 azi_fx = (Word32) ( azi_deg * Q22_1 ); - const Word32 ele_fx = (Word32) ( ele_deg * Q22_1 ); - Word32 gains_fx[MAX_OUTPUT_CHANNELS]; - efap_determine_gains_fixed( hEFAPdata, gains_fx, azi_fx, ele_fx, efap_mode ); - FOR( Word32 i = 0; i < hEFAPdata->numSpk; i++ ) - { - gains[i] = ( (float) gains_fx[i] ) / L_shl( 1, Q30 ); - } -#endif -} #ifdef IVAS_FLOAT_FIXED + /*-------------------------------------------------------------------------* - * efap_determine_gains_fixed() + * efap_determine_gains_fx() * * Obtain amplitude panning gains for all speaker nodes based on the * given direction *-------------------------------------------------------------------------*/ -void efap_determine_gains_fixed( +void efap_determine_gains_fx( EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ Word32 *gains, /* o : gain vector for speaker nodes for given direction */ const Word32 azi_deg, @@ -473,9 +384,9 @@ void efap_determine_gains_fixed( panning_wrap_angles_fixed( azi_deg, ele_deg, &azi_wrap_int, &ele_wrap_int ); /* Panning */ - efap_panning_fixed( azi_wrap_int, ele_wrap_int, &hEFAPdata->polyData, hEFAPdata->bufferLong_fx ); + efap_panning_fx( azi_wrap_int, ele_wrap_int, &hEFAPdata->polyData, hEFAPdata->bufferLong_fx ); - IF( efap_mode == EFAP_MODE_EFAP ) + IF( EQ_16( efap_mode, EFAP_MODE_EFAP ) ) { normBuffer = 0; FOR( j = 0; j < hEFAPdata->numSpk; ++j ) @@ -517,7 +428,7 @@ void efap_determine_gains_fixed( { Word16 exp_temp = exp + 1; hEFAPdata->bufferShort_fx[j] = Sqrt32( Mpy_32_16_1( hEFAPdata->bufferShort_fx[j], (Word16) normBuffer ), &exp_temp ); - hEFAPdata->bufferShort_fx[j] = L_shl( hEFAPdata->bufferShort_fx[j], exp_temp - 1 ); // Q30 + hEFAPdata->bufferShort_fx[j] = L_shl( hEFAPdata->bufferShort_fx[j], sub( exp_temp, 1 ) ); // Q30 } } @@ -526,6 +437,82 @@ void efap_determine_gains_fixed( return; } +#else + +/*-------------------------------------------------------------------------* + * efap_determine_gains() + * + * Obtain amplitude panning gains for all speaker nodes based on the + * given direction + *-------------------------------------------------------------------------*/ +void efap_determine_gains( + EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + float *gains, /* o : gain vector for speaker nodes for given direction */ + const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ + const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ + const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ +) +{ + int16_t i, j; + float azi_wrap, ele_wrap; + float normBuffer; + + /* Resetting bufferShort and bufferLong */ + set_zero( hEFAPdata->bufferShort, hEFAPdata->numSpk ); + set_zero( hEFAPdata->bufferLong, hEFAPdata->vtxData.numVtx ); + + /* Wrap angles to correct range */ + panning_wrap_angles( azi_deg, ele_deg, &azi_wrap, &ele_wrap ); + + /* Panning */ + efap_panning( azi_wrap, ele_wrap, &hEFAPdata->polyData, hEFAPdata->bufferLong ); + + if ( efap_mode == EFAP_MODE_EFAP ) + { + normBuffer = 0.f; + for ( j = 0; j < hEFAPdata->numSpk; ++j ) + { + hEFAPdata->bufferShort[j] = 0.f; + /* Multiplying by the downmixMatrix */ + for ( i = 0; i < hEFAPdata->vtxData.numVtx; ++i ) + { + hEFAPdata->bufferShort[j] += hEFAPdata->bufferLong[i] * hEFAPdata->dmTranspose[i][j]; + } + normBuffer = normBuffer + hEFAPdata->bufferShort[j] * hEFAPdata->bufferShort[j]; + } + normBuffer = inv_sqrt( normBuffer ); + + for ( j = 0; j < hEFAPdata->numSpk; ++j ) + { + hEFAPdata->bufferShort[j] *= normBuffer; + } + } + else + { + normBuffer = 0.f; + for ( j = 0; j < hEFAPdata->numSpk; ++j ) + { + hEFAPdata->bufferShort[j] = 0.f; + /* Multiplying by the downmixMatrix */ + for ( i = 0; i < hEFAPdata->vtxData.numVtx; ++i ) + { + hEFAPdata->bufferShort[j] += hEFAPdata->bufferLong[i] * hEFAPdata->dmTranspose[i][j]; + } + normBuffer = normBuffer + hEFAPdata->bufferShort[j]; + } + normBuffer = 1.f / normBuffer; + + for ( j = 0; j < hEFAPdata->numSpk; ++j ) + { + hEFAPdata->bufferShort[j] = sqrtf( hEFAPdata->bufferShort[j] * normBuffer ); + } + } + + /* Copy gains to output */ + mvr2r( hEFAPdata->bufferShort, gains, hEFAPdata->numSpk ); + + return; +} #endif /*-------------------------------------------------------------------------* * efap_free_data() @@ -643,21 +630,17 @@ void efap_free_data( * Main function for the Efap initialization whose purpose is to initialize * the different polygons and to add the ghost speakers *-------------------------------------------------------------------------*/ - -static ivas_error poly_init( +#ifdef IVAS_FLOAT_FIXED +static ivas_error poly_init_fx( EFAP *efap, /* i/o: A pointer to a handle to efap instance */ - const int16_t efip_flag /* i : flag to indicate whether initialization is for EFIP (used for ALLRAD) */ + const Word16 efip_flag /* i : flag to indicate whether initialization is for EFIP (used for ALLRAD) */ ) { int16_t n, m, j; int16_t finalLength, lengthTri2PolyPS; int16_t lengthTri2PolySorted[EFAP_MAX_POLY_SET]; int16_t sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM]; -#ifndef IVAS_FLOAT_FIXED - float tmpMax, tmpMin; -#else Word32 tmpMax, tmpMin; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -671,11 +654,7 @@ static ivas_error poly_init( } /* Computing the different ghost vertex, the downmix matrix and the triangle array */ -#ifndef IVAS_FLOAT_FIXED - IF( ( error = sphere_triangulation( efap->numSpk, &efap->vtxData, &efap->polyData, &efap->dmTranspose, &efap->numTot, efip_flag ) ) != IVAS_ERR_OK ) -#else - IF( ( error = sphere_triangulation( efap->numSpk, &efap->vtxData, &efap->polyData, &efap->dmTranspose_fx, &efap->numTot, efip_flag ) ) != IVAS_ERR_OK ) -#endif + IF( ( error = sphere_triangulation_fx( efap->numSpk, &efap->vtxData, &efap->polyData, &efap->dmTranspose_fx, &efap->numTot, efip_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -683,20 +662,15 @@ static ivas_error poly_init( /* set isNaN for ghost loudspeakers */ FOR( n = 0; n < efap->vtxData.numVtx; ++n ) { -#ifndef IVAS_FLOAT_FIXED - IF( efap->vtxData.vertexArray[n].ele > 90.0 - 1e-6 || - efap->vtxData.vertexArray[n].ele < 1e-6 - 90.0 ) -#else IF( GT_32( efap->vtxData.vertexArray[n].ele, L_sub( Q22_90_DEG, 4 ) ) || LT_32( efap->vtxData.vertexArray[n].ele, L_sub( 4, Q22_90_DEG ) ) ) -#endif { efap->vtxData.vertexArray[n].isNaN = 1; } } /* Converting the triangle to polygon structure */ - tri_to_poly( efap->vtxData.vertexArray, efap->polyData.triArray, efap->vtxData.numVtx, efap->polyData.numTri, sortedChan, &lengthTri2PolyPS, lengthTri2PolySorted ); + tri_to_poly_fx( efap->vtxData.vertexArray, efap->polyData.triArray, efap->vtxData.numVtx, efap->polyData.numTri, sortedChan, &lengthTri2PolyPS, lengthTri2PolySorted ); /* Completing the polyData Structure */ finalLength = -1; @@ -717,32 +691,115 @@ static ivas_error poly_init( efap->polyData.polysetArray[m].numChan = lengthTri2PolySorted[n]; /* In case tmpMax - tmpMin > 180, wrap polygon azimuth */ -#ifndef IVAS_FLOAT_FIXED + maximum_l( efap->polyData.polysetArray[m].polyAzi, lengthTri2PolySorted[n], &tmpMax ); + minimum_l( efap->polyData.polysetArray[m].polyAzi, lengthTri2PolySorted[n], &tmpMin ); + + IF( GT_32( L_sub( tmpMax, tmpMin ), Q22_180_DEG ) /*180 in Q22*/ ) + { + FOR( j = 0; j < lengthTri2PolySorted[n]; ++j ) + { + assert( ( m + 2 < EFAP_MAX_POLY_SET ) && "EFAP: maximum polygons exceeded!" ); + + /* add two new polygons with azimuths wrapped to differing bounds */ + efap->polyData.polysetArray[m + 1].polyAzi[j] = efap_lmodl( efap->polyData.polysetArray[m].polyAzi[j], Q22_360_DEG ); + efap->polyData.polysetArray[m + 2].polyAzi[j] = L_sub( efap->polyData.polysetArray[m + 1].polyAzi[j], Q22_360_DEG ); + + /* Copy the rest of the fields */ + efap->polyData.polysetArray[m + 1].chan[j] = efap->polyData.polysetArray[m].chan[j]; + efap->polyData.polysetArray[m + 1].polyEle[j] = efap->polyData.polysetArray[m].polyEle[j]; + efap->polyData.polysetArray[m + 1].isNaN[j] = efap->polyData.polysetArray[m].isNaN[j]; + efap->polyData.polysetArray[m + 1].numChan = lengthTri2PolySorted[n]; + + efap->polyData.polysetArray[m + 2].chan[j] = efap->polyData.polysetArray[m].chan[j]; + efap->polyData.polysetArray[m + 2].polyEle[j] = efap->polyData.polysetArray[m].polyEle[j]; + efap->polyData.polysetArray[m + 2].isNaN[j] = efap->polyData.polysetArray[m].isNaN[j]; + efap->polyData.polysetArray[m + 2].numChan = lengthTri2PolySorted[n]; + } + finalLength = add( finalLength, 2 ); + } + finalLength = add( finalLength, 1 ); + } + finalLength = add( finalLength, 1 ); + + /* Updating the number of polygons */ + efap->polyData.numPoly = finalLength; + + + return error; +} +#else +static ivas_error poly_init( + EFAP *efap, /* i/o: A pointer to a handle to efap instance */ + const int16_t efip_flag /* i : flag to indicate whether initialization is for EFIP (used for ALLRAD) */ +) +{ + int16_t n, m, j; + int16_t finalLength, lengthTri2PolyPS; + int16_t lengthTri2PolySorted[EFAP_MAX_POLY_SET]; + int16_t sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM]; + float tmpMax, tmpMin; + ivas_error error; + + error = IVAS_ERR_OK; + + /* Safety Check */ + assert( efap != NULL && "EFAP: efap == NULL" ); + + for ( n = 0; n < EFAP_MAX_POLY_SET; n++ ) + { + set_s( sortedChan[n], 0, EFAP_MAX_CHAN_NUM ); + } + + /* Computing the different ghost vertex, the downmix matrix and the triangle array */ + if ( ( error = sphere_triangulation( efap->numSpk, &efap->vtxData, &efap->polyData, &efap->dmTranspose, &efap->numTot, efip_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* set isNaN for ghost loudspeakers */ + for ( n = 0; n < efap->vtxData.numVtx; ++n ) + { + if ( efap->vtxData.vertexArray[n].ele > 90.0 - 1e-6 || + efap->vtxData.vertexArray[n].ele < 1e-6 - 90.0 ) + { + efap->vtxData.vertexArray[n].isNaN = 1; + } + } + + /* Converting the triangle to polygon structure */ + tri_to_poly( efap->vtxData.vertexArray, efap->polyData.triArray, efap->vtxData.numVtx, efap->polyData.numTri, sortedChan, &lengthTri2PolyPS, lengthTri2PolySorted ); + + /* Completing the polyData Structure */ + finalLength = -1; + + for ( n = 0; n < lengthTri2PolyPS; ++n ) + { + m = finalLength + 1; + + /* Complete the fields of the polygon */ + for ( j = 0; j < lengthTri2PolySorted[n]; ++j ) + { + efap->polyData.polysetArray[m].chan[j] = sortedChan[n][j]; + efap->polyData.polysetArray[m].polyAzi[j] = efap->vtxData.vertexArray[sortedChan[n][j]].azi; + efap->polyData.polysetArray[m].polyEle[j] = efap->vtxData.vertexArray[sortedChan[n][j]].ele; + efap->polyData.polysetArray[m].isNaN[j] = efap->vtxData.vertexArray[sortedChan[n][j]].isNaN; + } + + efap->polyData.polysetArray[m].numChan = lengthTri2PolySorted[n]; + + /* In case tmpMax - tmpMin > 180, wrap polygon azimuth */ maximum( efap->polyData.polysetArray[m].polyAzi, lengthTri2PolySorted[n], &tmpMax ); minimum( efap->polyData.polysetArray[m].polyAzi, lengthTri2PolySorted[n], &tmpMin ); -#else - maximum_l( efap->polyData.polysetArray[m].polyAzi, lengthTri2PolySorted[n], &tmpMax ); - minimum_l( efap->polyData.polysetArray[m].polyAzi, lengthTri2PolySorted[n], &tmpMin ); -#endif -#ifndef IVAS_FLOAT_FIXED if ( ( tmpMax - tmpMin ) > 180 ) -#else - IF( GT_32( L_sub( tmpMax, tmpMin ), Q22_180_DEG ) /*180 in Q22*/ ) -#endif { - FOR( j = 0; j < lengthTri2PolySorted[n]; ++j ) + for ( j = 0; j < lengthTri2PolySorted[n]; ++j ) { assert( ( m + 2 < EFAP_MAX_POLY_SET ) && "EFAP: maximum polygons exceeded!" ); /* add two new polygons with azimuths wrapped to differing bounds */ -#ifndef IVAS_FLOAT_FIXED efap->polyData.polysetArray[m + 1].polyAzi[j] = efap_fmodf( efap->polyData.polysetArray[m].polyAzi[j], 360 ); efap->polyData.polysetArray[m + 2].polyAzi[j] = efap->polyData.polysetArray[m + 1].polyAzi[j] - 360; -#else - efap->polyData.polysetArray[m + 1].polyAzi[j] = efap_lmodl( efap->polyData.polysetArray[m].polyAzi[j], Q22_360_DEG ); - efap->polyData.polysetArray[m + 2].polyAzi[j] = L_sub( efap->polyData.polysetArray[m + 1].polyAzi[j], Q22_360_DEG ); -#endif /* Copy the rest of the fields */ efap->polyData.polysetArray[m + 1].chan[j] = efap->polyData.polysetArray[m].chan[j]; @@ -767,24 +824,20 @@ static ivas_error poly_init( return error; } - +#endif /*-------------------------------------------------------------------------* * sphere_triangulation() * * *-------------------------------------------------------------------------*/ - -static ivas_error sphere_triangulation( - const int16_t numSpk, /* i : Number of speakers */ +#ifdef IVAS_FLOAT_FIXED +static ivas_error sphere_triangulation_fx( + const Word16 numSpk, /* i : Number of speakers */ EFAP_VERTEX_DATA *vtxData, /* i/o: Vertex data structure */ EFAP_POLYSET_DATA *polyData, /* o : Polygon data structure */ -#ifndef IVAS_FLOAT_FIXED - float ***dmTranspose, /* o : Transpose of the downmix matrix */ -#else Word32 ***dmTranspose_fx, /* o : Transpose of the downmix matrix */ -#endif - int16_t *numTot, /* o : Number of speakers (real + ghost) */ + Word16 *numTot, /* o : Number of speakers (real + ghost) */ const int16_t efip_flag /* i : flag to indicate whether initialization is for EFIP (used for ALLRAD) */ ) { @@ -795,11 +848,7 @@ static ivas_error sphere_triangulation( set_s( vtxInHull, 0, EFAP_MAX_SIZE_TMP_BUFF ); /* Add Imaginary Speakers */ -#ifndef IVAS_FLOAT_FIXED - add_ghost_speakers( vtxData->vertexArray, &vtxData->numVtx, efip_flag ); -#else - add_ghost_speakers_fixed( vtxData->vertexArray, &vtxData->numVtx, efip_flag ); -#endif + add_ghost_speakers_fx( vtxData->vertexArray, &vtxData->numVtx, efip_flag ); /* Sort the vertices according to their index */ IF( ( vtxData->vtxOrder = (int16_t *) malloc( vtxData->numVtx * sizeof( int16_t ) ) ) == NULL ) @@ -807,33 +856,21 @@ static ivas_error sphere_triangulation( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP Vertex Order\n" ) ); } - sort_vertices( vtxData->vertexArray, &vtxData->numVtx, vtxData->vtxOrder ); + sort_vertices_fx( vtxData->vertexArray, &vtxData->numVtx, vtxData->vtxOrder ); /* Computing the initial Polyeder */ -#ifndef IVAS_FLOAT_FIXED - initial_polyeder( vtxData, polyData->triArray, &polyData->numTri, &vtxInHull[0] ); -#else - initial_polyeder_fixed( vtxData, polyData->triArray, &polyData->numTri, &vtxInHull[0] ); -#endif + initial_polyeder_fx( vtxData, polyData->triArray, &polyData->numTri, &vtxInHull[0] ); /* Add the vertex to the convex hull */ FOR( i = 0; i < vtxData->numVtx; ++i ) { -#ifndef IVAS_FLOAT_FIXED - add_vertex_to_convex_hull( vtxData, vtxData->vtxOrder[i], &vtxInHull[0], polyData->triArray, &polyData->numTri ); -#else - add_vertex_to_convex_hull_fixed( vtxData, vtxData->vtxOrder[i], &vtxInHull[0], polyData->triArray, &polyData->numTri ); -#endif + add_vertex_to_convex_hull_fx( vtxData, vtxData->vtxOrder[i], &vtxInHull[0], polyData->triArray, &polyData->numTri ); } assert( polyData->numTri != 0 && "EFAP: failed to construct convex hull!" ); /* Allocate the DM matrix transpose */ -#ifndef IVAS_FLOAT_FIXED - IF( ( p_dmTranspose = malloc( vtxData->numVtx * sizeof( float * ) ) ) == NULL ) -#else IF( ( p_dmTranspose = malloc( vtxData->numVtx * sizeof( Word32 * ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "EFAP: can not allocate memory for dmTranspose\n" ) ); } @@ -843,30 +880,80 @@ static ivas_error sphere_triangulation( FOR( i = 0; i < vtxData->numVtx; i++ ) { -#ifndef IVAS_FLOAT_FIXED - IF( ( p_dmTranspose[i] = malloc( numSpk * sizeof( float ) ) ) == NULL ) -#else IF( ( p_dmTranspose[i] = malloc( numSpk * sizeof( Word32 ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "EFAP: can not allocate memory for dmTranspose\n" ) ); } } -#ifndef IVAS_FLOAT_FIXED - *dmTranspose = (float **) p_dmTranspose; -#else *dmTranspose_fx = (Word32 **) p_dmTranspose; -#endif /* Remap Ghosts */ -#ifndef IVAS_FLOAT_FIXED - remap_ghosts( vtxData->vertexArray, polyData->triArray, numSpk, &vtxData->numVtx, polyData->numTri, *dmTranspose ); + remap_ghosts_fx( vtxData->vertexArray, polyData->triArray, numSpk, &vtxData->numVtx, polyData->numTri, *dmTranspose_fx ); + + return IVAS_ERR_OK; +} #else - remap_ghosts_fixed( vtxData->vertexArray, polyData->triArray, numSpk, &vtxData->numVtx, polyData->numTri, *dmTranspose_fx ); -#endif +static ivas_error sphere_triangulation( + const int16_t numSpk, /* i : Number of speakers */ + EFAP_VERTEX_DATA *vtxData, /* i/o: Vertex data structure */ + EFAP_POLYSET_DATA *polyData, /* o : Polygon data structure */ + float ***dmTranspose, /* o : Transpose of the downmix matrix */ + int16_t *numTot, /* o : Number of speakers (real + ghost) */ + const int16_t efip_flag /* i : flag to indicate whether initialization is for EFIP (used for ALLRAD) */ +) +{ + int16_t i; + void **p_dmTranspose; + int16_t vtxInHull[EFAP_MAX_SIZE_TMP_BUFF]; + + set_s( vtxInHull, 0, EFAP_MAX_SIZE_TMP_BUFF ); + + /* Add Imaginary Speakers */ + add_ghost_speakers( vtxData->vertexArray, &vtxData->numVtx, efip_flag ); + + /* Sort the vertices according to their index */ + if ( ( vtxData->vtxOrder = (int16_t *) malloc( vtxData->numVtx * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP Vertex Order\n" ) ); + } + + sort_vertices( vtxData->vertexArray, &vtxData->numVtx, vtxData->vtxOrder ); + + /* Computing the initial Polyeder */ + initial_polyeder( vtxData, polyData->triArray, &polyData->numTri, &vtxInHull[0] ); + + /* Add the vertex to the convex hull */ + for ( i = 0; i < vtxData->numVtx; ++i ) + { + add_vertex_to_convex_hull( vtxData, vtxData->vtxOrder[i], &vtxInHull[0], polyData->triArray, &polyData->numTri ); + } + + assert( polyData->numTri != 0 && "EFAP: failed to construct convex hull!" ); + + /* Allocate the DM matrix transpose */ + if ( ( p_dmTranspose = malloc( vtxData->numVtx * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "EFAP: can not allocate memory for dmTranspose\n" ) ); + } + + /* Store the value of numVtx to be used for freeing later (numVtx will change after remap_ghosts() ) */ + *numTot = vtxData->numVtx; + + for ( i = 0; i < vtxData->numVtx; i++ ) + { + if ( ( p_dmTranspose[i] = malloc( numSpk * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "EFAP: can not allocate memory for dmTranspose\n" ) ); + } + } + *dmTranspose = (float **) p_dmTranspose; + + /* Remap Ghosts */ + remap_ghosts( vtxData->vertexArray, polyData->triArray, numSpk, &vtxData->numVtx, polyData->numTri, *dmTranspose ); return IVAS_ERR_OK; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* @@ -1001,7 +1088,7 @@ static void initial_polyeder( * *-------------------------------------------------------------------------*/ -static void initial_polyeder_fixed( +static void initial_polyeder_fx( EFAP_VERTEX_DATA *vtxData, /* i : Vertex data structure */ EFAP_LS_TRIANGLE *triArray, /* o : Triangle array structure */ Word16 *numTri, /* o : Size of triangle array */ @@ -1050,7 +1137,7 @@ static void initial_polyeder_fixed( WHILE( LT_16( tetrahedron[2], numVtx ) ) { v_sub_fixed( vtxData->vertexArray[tetrahedron[2]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp2, 3, 1 ); - efap_crossp_fixed( tmp1, tmp2, tmpCross ); // tmpCross Q29 + efap_crossp_fx( tmp1, tmp2, tmpCross ); // tmpCross Q29 FOR( i = 0; i < 3; i++ ) { tmp = L_add( tmp, Mpy_32_32( tmpCross[i], tmpCross[i] ) ); // tmp Q27 @@ -1059,7 +1146,7 @@ static void initial_polyeder_fixed( { break; } - tetrahedron[2]++; + tetrahedron[2] = add( tetrahedron[2], 1 ); } assert( tetrahedron[2] < numVtx && "EFAP: convex hull construction failed, vertices are colinear!" ); @@ -1073,7 +1160,7 @@ static void initial_polyeder_fixed( { break; } - tetrahedron[3]++; + tetrahedron[3] = add( tetrahedron[3], 1 ); } assert( tetrahedron[3] < numVtx && "EFAP: convex hull construction failed, vertices are coplanar!" ); @@ -1095,25 +1182,25 @@ static void initial_polyeder_fixed( tmpSurface[0] = tetrahedron[0]; tmpSurface[1] = tetrahedron[1]; tmpSurface[2] = tetrahedron[2]; - flip_plane_fixed( vtxData->vertexArray, tmpSurface, centroid ); + flip_plane_fx( vtxData->vertexArray, tmpSurface, centroid ); mvs2s( tmpSurface, triArray[0].LS, 3 ); tmpSurface[0] = tetrahedron[0]; tmpSurface[1] = tetrahedron[1]; tmpSurface[2] = tetrahedron[3]; - flip_plane_fixed( vtxData->vertexArray, tmpSurface, centroid ); + flip_plane_fx( vtxData->vertexArray, tmpSurface, centroid ); mvs2s( tmpSurface, triArray[1].LS, 3 ); tmpSurface[0] = tetrahedron[0]; tmpSurface[1] = tetrahedron[2]; tmpSurface[2] = tetrahedron[3]; - flip_plane_fixed( vtxData->vertexArray, tmpSurface, centroid ); + flip_plane_fx( vtxData->vertexArray, tmpSurface, centroid ); mvs2s( tmpSurface, triArray[2].LS, 3 ); tmpSurface[0] = tetrahedron[1]; tmpSurface[1] = tetrahedron[2]; tmpSurface[2] = tetrahedron[3]; - flip_plane_fixed( vtxData->vertexArray, tmpSurface, centroid ); + flip_plane_fx( vtxData->vertexArray, tmpSurface, centroid ); mvs2s( tmpSurface, triArray[3].LS, 3 ); /* set numTri */ @@ -1288,12 +1375,12 @@ static void add_ghost_speakers( } #else /*-------------------------------------------------------------------------* - * add_ghost_speakers_fixed() + * add_ghost_speakers_fx() * * *-------------------------------------------------------------------------*/ -static void add_ghost_speakers_fixed( +static void add_ghost_speakers_fx( EFAP_VERTEX *vertexArray, /* i/o: Vertex array */ Word16 *numVtx, /* i/o: Size of vertex array */ const Word16 efip_flag /* i : flag to indicate whether initialization is for EFIP (used for ALLRAD) */ @@ -1342,7 +1429,7 @@ static void add_ghost_speakers_fixed( vtxDmxType = EFAP_DMX_AMPLITUDE; } } - add_vertex_fixed( vertexArray, 0, Q22_90_DEG, numVertex + a, vtxDmxType ); + add_vertex_fx( vertexArray, 0, Q22_90_DEG, numVertex + a, vtxDmxType ); ++lengthVertGhst; ++a; } @@ -1363,7 +1450,7 @@ static void add_ghost_speakers_fixed( } } - add_vertex_fixed( vertexArray, 0, -Q22_90_DEG, numVertex + a, vtxDmxType ); + add_vertex_fx( vertexArray, 0, -Q22_90_DEG, numVertex + a, vtxDmxType ); ++lengthVertGhst; ++a; @@ -1384,16 +1471,16 @@ static void add_ghost_speakers_fixed( lengthHorGhst = 0; IF( EQ_16( k, 0 ) ) /* no speakers found: add a triangle of ghost speakers */ { - add_vertex_fixed( vertexArray, 0, 0, numVertex + a, EFAP_DMX_INTENSITY ); - add_vertex_fixed( vertexArray, Q22_120_DEG, 0, numVertex + a + 1, EFAP_DMX_INTENSITY ); - add_vertex_fixed( vertexArray, Q22_240_DEG, 0, numVertex + a + 2, EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, 0, 0, numVertex + a, EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, Q22_120_DEG, 0, numVertex + a + 1, EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, Q22_240_DEG, 0, numVertex + a + 2, EFAP_DMX_INTENSITY ); a += 3; lengthHorGhst += 3; } ELSE IF( EQ_16( k, 1 ) ) /* only one speaker found: add two ghost speakers to complete a triangle */ { - add_vertex_fixed( vertexArray, L_add( tmpAzi[0], Q22_120_DEG ), 0, numVertex + a, EFAP_DMX_INTENSITY ); - add_vertex_fixed( vertexArray, L_add( tmpAzi[0], Q22_240_DEG ), 0, numVertex + a + 1, EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, L_add( tmpAzi[0], Q22_120_DEG ), 0, numVertex + a, EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, L_add( tmpAzi[0], Q22_240_DEG ), 0, numVertex + a + 1, EFAP_DMX_INTENSITY ); a += 2; lengthHorGhst += 2; } @@ -1434,7 +1521,7 @@ static void add_ghost_speakers_fixed( { newAzi = L_add( tmpAzi[i], L_shl( ( j + 1 ) * newDiff, Q22 ) ); - add_vertex_fixed( vertexArray, newAzi, 0, numVertex + a, EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, newAzi, 0, numVertex + a, EFAP_DMX_INTENSITY ); ++a; IF( GT_16( j, 0 ) ) @@ -1445,7 +1532,7 @@ static void add_ghost_speakers_fixed( } } } - *numVtx = numVertex + lengthHorGhst + lengthVertGhst; + *numVtx = add( add( numVertex, lengthHorGhst ), lengthVertGhst ); return; } @@ -1457,6 +1544,28 @@ static void add_ghost_speakers_fixed( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void sort_vertices_fx( + const EFAP_VERTEX *vertexArray, /* i : Vertex array */ + const Word16 *numVtx, /* i : Size of vertex array */ + Word16 *order /* o : Original index positions */ +) +{ + Word16 tmpIdx[EFAP_MAX_SIZE_TMP_BUFF]; + Word16 i; + + /* Initializing tmpIdx */ + FOR( i = 0; i < *numVtx; ++i ) + { + tmpIdx[i] = vertexArray[i].idx; + } + + /* Sorting indexes */ + efap_sort_s_fx( tmpIdx, order, *numVtx ); + + return; +} +#else static void sort_vertices( const EFAP_VERTEX *vertexArray, /* i : Vertex array */ const int16_t *numVtx, /* i : Size of vertex array */ @@ -1467,7 +1576,7 @@ static void sort_vertices( int16_t i; /* Initializing tmpIdx */ - FOR( i = 0; i < *numVtx; ++i ) + for ( i = 0; i < *numVtx; ++i ) { tmpIdx[i] = vertexArray[i].idx; } @@ -1477,7 +1586,7 @@ static void sort_vertices( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* * add_vertex_to_convex_hull() @@ -1575,12 +1684,12 @@ static void add_vertex_to_convex_hull( } #else /*-------------------------------------------------------------------------* - * add_vertex_to_convex_hull_fixed() + * add_vertex_to_convex_hull_fx() * * *-------------------------------------------------------------------------*/ -static void add_vertex_to_convex_hull_fixed( +static void add_vertex_to_convex_hull_fx( const EFAP_VERTEX_DATA *vtxData, /* i : Vertex data structure */ const Word16 vtxIdx, /* i : Vertex to be added to the hull */ Word16 *vtxInHull, /* i/o: Array indicating whether the vertex is part of the hull */ @@ -1612,7 +1721,7 @@ static void add_vertex_to_convex_hull_fixed( { IF( vtxInHull[i] ) { - numHullVtx++; + numHullVtx = L_add( numHullVtx, 1 ); centroid[0] = L_add( centroid[0], L_shr( vtxData->vertexArray[i].pos[0], Q4 ) ); centroid[1] = L_add( centroid[1], L_shr( vtxData->vertexArray[i].pos[1], Q4 ) ); centroid[2] = L_add( centroid[2], L_shr( vtxData->vertexArray[i].pos[2], Q4 ) ); @@ -1634,7 +1743,7 @@ static void add_vertex_to_convex_hull_fixed( FOR( i = 0; i < *szTri; ++i ) { - tmpDist = vertex_distance_fixed( vtxData->vertexArray, triArray[i], vtxIdx ); // Q28 + tmpDist = vertex_distance_fx( vtxData->vertexArray, triArray[i], vtxIdx ); // Q28 IF( GT_32( tmpDist, threshold ) ) { visible[k] = i; @@ -1647,7 +1756,7 @@ static void add_vertex_to_convex_hull_fixed( } } - visible_edges( triArray, visible, k, numEdges, edges ); + visible_edges_fx( triArray, visible, k, numEdges, edges ); FOR( i = 0; i < numEdges[0]; i += 2 ) { @@ -1655,7 +1764,7 @@ static void add_vertex_to_convex_hull_fixed( surface[1] = edges[i + 1]; surface[2] = vtxIdx; - flip_plane_fixed( vtxData->vertexArray, surface, centroid ); + flip_plane_fx( vtxData->vertexArray, surface, centroid ); mvs2s( surface, triArrayNew[l].LS, 3 ); ++l; @@ -1679,8 +1788,8 @@ static void add_vertex_to_convex_hull_fixed( * * *-------------------------------------------------------------------------*/ - -static void visible_edges( +#ifdef IVAS_FLOAT_FIXED +static void visible_edges_fx( const EFAP_LS_TRIANGLE *triArray, /* i : Triangle array */ const Word16 *visible, /* i : Visible surface flag */ const Word16 numSurface, /* i : Number of surfaces */ @@ -1688,17 +1797,13 @@ static void visible_edges( Word16 *edges /* i/o: Array of edges */ ) { - int16_t maxVertex; - int16_t i, j, k; - int16_t a, b; - int16_t tmpSurface[4]; - int16_t counter[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; - int16_t counterTranspose[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; -#ifndef IVAS_FLOAT_FIXED - float tmpMax[EFAP_MAX_SIZE_TMP_BUFF]; -#else + Word16 maxVertex; + Word16 i, j, k; + Word16 a, b; + Word16 tmpSurface[4]; + Word16 counter[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; + Word16 counterTranspose[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; Word16 tmpMax[EFAP_MAX_SIZE_TMP_BUFF]; -#endif /* Set counter and counterTranspose to 0 */ FOR( i = 0; i < EFAP_MAX_SIZE_TMP_BUFF; i++ ) @@ -1710,28 +1815,16 @@ static void visible_edges( /* Finding the max vertex */ FOR( i = 0; i < numSurface; ++i ) { -#ifndef IVAS_FLOAT_FIXED - tmpMax[i] = (float) triArray[visible[i]].LS[0]; -#else tmpMax[i] = triArray[visible[i]].LS[0]; -#endif FOR( j = 1; j < 3; ++j ) { IF( tmpMax[i] < triArray[visible[i]].LS[j] ) { -#ifndef IVAS_FLOAT_FIXED - tmpMax[i] = (float) triArray[visible[i]].LS[j]; -#else tmpMax[i] = triArray[visible[i]].LS[j]; -#endif } } } -#ifndef IVAS_FLOAT_FIXED - maxVertex = (int16_t) tmpMax[maximum( tmpMax, numSurface, NULL )]; -#else maxVertex = tmpMax[maximum_s( tmpMax, numSurface, NULL )]; -#endif FOR( i = 0; i < numSurface; ++i ) { tmpSurface[0] = triArray[visible[i]].LS[0]; @@ -1743,7 +1836,7 @@ static void visible_edges( { a = tmpSurface[j]; b = tmpSurface[j + 1]; - counter[a][b] = counter[a][b] + 1; + counter[a][b] = add(counter[a][b], 1); counterTranspose[b][a] = counter[a][b]; } } @@ -1752,7 +1845,7 @@ static void visible_edges( { FOR( j = 0; j < maxVertex + 1; ++j ) { - counter[i][j] = counterTranspose[i][j] + counterTranspose[j][i]; + counter[i][j] = add(counterTranspose[i][j], counterTranspose[j][i]); } } @@ -1777,7 +1870,90 @@ static void visible_edges( return; } +#else +static void visible_edges( + const EFAP_LS_TRIANGLE *triArray, /* i : Triangle array */ + const int16_t *visible, /* i : Visible surface flag */ + const int16_t numSurface, /* i : Number of surfaces */ + int16_t *numEdges, /* i/o: Number of edges */ + int16_t *edges /* i/o: Array of edges */ +) +{ + int16_t maxVertex; + int16_t i, j, k; + int16_t a, b; + int16_t tmpSurface[4]; + int16_t counter[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; + int16_t counterTranspose[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; + float tmpMax[EFAP_MAX_SIZE_TMP_BUFF]; + + /* Set counter and counterTranspose to 0 */ + for ( i = 0; i < EFAP_MAX_SIZE_TMP_BUFF; i++ ) + { + set_s( counter[i], 0, EFAP_MAX_SIZE_TMP_BUFF ); + set_s( counterTranspose[i], 0, EFAP_MAX_SIZE_TMP_BUFF ); + } + + /* Finding the max vertex */ + for ( i = 0; i < numSurface; ++i ) + { + tmpMax[i] = (float) triArray[visible[i]].LS[0]; + for ( j = 1; j < 3; ++j ) + { + if ( tmpMax[i] < triArray[visible[i]].LS[j] ) + { + tmpMax[i] = (float) triArray[visible[i]].LS[j]; + } + } + } + maxVertex = (int16_t) tmpMax[maximum( tmpMax, numSurface, NULL )]; + + for ( i = 0; i < numSurface; ++i ) + { + tmpSurface[0] = triArray[visible[i]].LS[0]; + tmpSurface[1] = triArray[visible[i]].LS[1]; + tmpSurface[2] = triArray[visible[i]].LS[2]; + tmpSurface[3] = triArray[visible[i]].LS[0]; + + for ( j = 0; j < 3; ++j ) + { + a = tmpSurface[j]; + b = tmpSurface[j + 1]; + counter[a][b] = counter[a][b] + 1; + counterTranspose[b][a] = counter[a][b]; + } + } + + for ( i = 0; i < maxVertex + 1; ++i ) + { + for ( j = 0; j < maxVertex + 1; ++j ) + { + counter[i][j] = counterTranspose[i][j] + counterTranspose[j][i]; + } + } + + /* Finding the edges */ + k = 0; + + for ( a = 0; a < maxVertex; ++a ) + { + for ( b = a + 1; b < maxVertex + 1; ++b ) + { + if ( counter[a][b] == 1 ) + { + edges[k] = a; + edges[k + 1] = b; + k += 2; + } + } + } + + /* Outputs */ + *numEdges = k; + return; +} +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* * flip_plane() @@ -1816,16 +1992,16 @@ static void flip_plane( * \ *-------------------------------------------------------------------------*/ -static void flip_plane_fixed( +static void flip_plane_fx( const EFAP_VERTEX *vtxArray, /* i : Vertex array */ Word16 *surface, /* i/o: Surface/vertices to be flipped */ const Word32 centroid[3] /* i : Centroid of convex hull from which to orient the planes outward */ ) { - int16_t tmp; + Word16 tmp; Word32 dist; - dist = point_plane_distance_fixed( + dist = point_plane_distance_fx( vtxArray[surface[0]].pos, vtxArray[surface[1]].pos, vtxArray[surface[2]].pos, @@ -1995,12 +2171,12 @@ static void remap_ghosts( } #else /*-------------------------------------------------------------------------* - * remap_ghosts_fixed() + * remap_ghosts_fx() * * *-------------------------------------------------------------------------*/ -static void remap_ghosts_fixed( +static void remap_ghosts_fx( EFAP_VERTEX *vtxArray, /* i/o: Vertex array */ EFAP_LS_TRIANGLE *triArray, /* i/o: Triangle array */ Word16 numSpk, /* i : Number of speakers */ @@ -2032,9 +2208,9 @@ static void remap_ghosts_fixed( FOR( g = numVtx - 1; g > numSpk - 1; --g ) { /* find(triangle_mat == ghost, 1, 'first') */ - IF( EQ_16( find_int_in_tri( triArray, g, numTri, posFound ), 0 ) ) + IF( EQ_16(find_int_in_tri_fx( triArray, g, numTri, posFound ), 0 ) ) { - remove_vertex( vtxArray, g, numVtx ); + remove_vertex_fx( vtxArray, g, numVtx ); --numVtx; FOR( i = 0; i < numTri; ++i ) { @@ -2042,7 +2218,7 @@ static void remap_ghosts_fixed( { IF( GT_16( triArray[i].LS[j], g ) ) { - triArray[i].LS[j] = g - 1; + triArray[i].LS[j] = sub( g, 1 ); } } } @@ -2054,7 +2230,7 @@ static void remap_ghosts_fixed( } /* Final number of LS (real + ghosts) */ - numTot = numSpk + numGhst; + numTot = add(numSpk, numGhst); /* Initializing tmpMat as the identity matrix */ FOR( i = 0; i < numTot; ++i ) @@ -2069,7 +2245,7 @@ static void remap_ghosts_fixed( /* Generate initial sound energy distribution matrix */ FOR( i = numSpk; i < numTot; ++i ) { - tmpL = get_neighbours( triArray, i, numTri, neighbours ); + tmpL = get_neighbours_fx( triArray, i, numTri, neighbours ); /* Initializing the column to 0 */ FOR( j = 0; j < numTot; ++j ) @@ -2100,14 +2276,14 @@ static void remap_ghosts_fixed( { mvl2l( tmpNewMat[i], tmpVec, numTot ); - tmpDist = sum_l( &tmpVec[numSpk], numTot - numSpk ); + tmpDist = sum_l( &tmpVec[numSpk], sub( numTot, numSpk ) ); WHILE( GT_32( tmpDist, thresh ) ) { - matrix_times_row_fixed( tmpMat, tmpVec, numTot, tmpVec2 ); + matrix_times_row_fx( tmpMat, tmpVec, numTot, tmpVec2 ); mvl2l( tmpVec2, tmpVec, numTot ); set_l( tmpVec2, 0, numTot ); - tmpDist = sum_l( &tmpVec[numSpk], numTot - numSpk ); + tmpDist = sum_l( &tmpVec[numSpk], sub( numTot, numSpk ) ); } mvl2l( tmpVec, tmpNewMat[i], numTot ); } @@ -2136,10 +2312,10 @@ static void remap_ghosts_fixed( { case EFAP_DMX_NONE: downmixMatrixTranspose[j][i] = 0; - break; + BREAK; case EFAP_DMX_AMPLITUDE: downmixMatrixTranspose[j][i] = tmpNewMat[j][i]; - break; + BREAK; case EFAP_DMX_INTENSITY: default: IF( EQ_32( tmpNewMat[j][i], 0 ) || EQ_32( tmpNewMat[j][i], 0x7fffffff ) ) @@ -2153,7 +2329,7 @@ static void remap_ghosts_fixed( tmp_sqrt = L_shl( tmp_sqrt, exp ); downmixMatrixTranspose[j][i] = tmp_sqrt; } - break; + BREAK; } } } @@ -2190,12 +2366,12 @@ static void vertex_init( } #else /*-------------------------------------------------------------------------* - * vertex_init_fixed() + * vertex_init_fx() * * Initialize the vertex structures *-------------------------------------------------------------------------*/ -static void vertex_init_fixed( +static void vertex_init_fx( const Word32 *aziSpk, /* i : Azimuths of the LS setup */ const Word32 *eleSpk, /* i : Elevations of the LS setup */ EFAP_VERTEX_DATA *efapVtxData /* i/o: Vertex data structure that will be updated */ @@ -2206,7 +2382,7 @@ static void vertex_init_fixed( /* Main Processing */ FOR( i = 0; i < efapVtxData->numVtx; i++ ) { - add_vertex_fixed( efapVtxData->vertexArray, aziSpk[i], eleSpk[i], i, EFAP_DMX_INTENSITY ); + add_vertex_fx( efapVtxData->vertexArray, aziSpk[i], eleSpk[i], i, EFAP_DMX_INTENSITY ); } return; @@ -2280,12 +2456,12 @@ static void efap_panning( } #else /*-------------------------------------------------------------------------* - * efap_panning_fixed() + * efap_panning_fx() * * Compute the gain without applying the downmix Matrix and the norm of the array *-------------------------------------------------------------------------*/ -static void efap_panning_fixed( +static void efap_panning_fx( const Word32 azi, /* i : Value of the azimuth */ const Word32 ele, /* i : Value of the elevation */ const EFAP_POLYSET_DATA *polyData, /* i : Polygon data */ @@ -2306,7 +2482,7 @@ static void efap_panning_fixed( P[1] = ele; /* Finding in which polygon the point is */ - polyIdx = get_poly_num_fixed( P, polyData ); + polyIdx = get_poly_num_fx( P, polyData ); assert( polyIdx != -1 && "EFAP: polygon not found!" ); @@ -2327,7 +2503,7 @@ static void efap_panning_fixed( } /* Computing the gain for the polygon */ - get_poly_gains_fixed( P[0], P[1], aziPoly, elePoly, numChan, tmpBuff ); + get_poly_gains_fx( P[0], P[1], aziPoly, elePoly, numChan, tmpBuff ); /* Computing the norm of the tmp buffer */ normTmpBuff = dotp_fixed( tmpBuff, tmpBuff, numChan ); @@ -2401,12 +2577,12 @@ static void get_poly_gains( } #else /*-------------------------------------------------------------------------* - * get_poly_gains_fixed() + * get_poly_gains_fx() * * Compute the gain for a precise polygon *-------------------------------------------------------------------------*/ -static void get_poly_gains_fixed( +static void get_poly_gains_fx( const Word32 azi, /* i : Value of the azimuth */ const Word32 ele, /* i : Value of the elevation */ const Word32 aziPoly[EFAP_MAX_CHAN_NUM], /* i : Azimuths of the considered polygons */ @@ -2443,9 +2619,9 @@ static void get_poly_gains_fixed( C[0] = aziPoly[idx2 - 1]; C[1] = elePoly[idx2 - 1]; - IF( in_tri_fixed( A, B, C, P_minus_A ) ) + IF( in_tri_fx( A, B, C, P_minus_A ) ) { - buffer[i - 1] = L_shl_sat( get_tri_gain_fixed( A, B, C, P_minus_A ), Q12 ); + buffer[i - 1] = L_shl_sat( get_tri_gain_fx( A, B, C, P_minus_A ), Q12 ); break; } } @@ -2496,12 +2672,12 @@ static float get_tri_gain( } #else /*-------------------------------------------------------------------------* - * get_tri_gain_fixed() + * get_tri_gain_fx() * * Compute the value of the gain for a given triangle *-------------------------------------------------------------------------*/ -static Word32 get_tri_gain_fixed( +static Word32 get_tri_gain_fx( const Word32 A[2], /* i : Coordinate of one apex of the triangle */ const Word32 B[2], /* i : Coordinate of one apex of the triangle */ const Word32 C[2], /* i : Coordinate of one apex of the triangle */ @@ -2593,12 +2769,12 @@ static void add_vertex( } #else /*-------------------------------------------------------------------------* - * add_vertex_fixed() + * add_vertex_fx() * * Add a vertex to the vertex array *-------------------------------------------------------------------------*/ -static void add_vertex_fixed( +static void add_vertex_fx( EFAP_VERTEX *vtxArray, /* i/o: Handle to the vertex array that will be updated */ const Word32 azi, /* i : Azimuth of the vertex */ const Word32 ele, /* i : Elevation of the vertex */ @@ -2613,14 +2789,14 @@ static void add_vertex_fixed( /* Updating the vertex array */ - tmp = efap_lmodl( Q22_180_DEG - azi, Q22_360_DEG ); + tmp = efap_lmodl( L_sub( Q22_180_DEG, azi ), Q22_360_DEG ); vtxArray[pos].azi = L_sub( Q22_180_DEG, tmp ); tmp = ( ( Q22_180_DEG < ele ) ? Q22_180_DEG : ele ); vtxArray[pos].ele = ( ( -Q22_180_DEG > tmp ) ? -Q22_180_DEG : tmp ); /* Converting spherical coordinates to cartesians, assuming radius = 1 */ - sph2cart_fixed( vtxArray[pos].azi, vtxArray[pos].ele, &vtxArray[pos].pos[0] ); + sph2cart_fx( vtxArray[pos].azi, vtxArray[pos].ele, &vtxArray[pos].pos[0] ); /* Computing the index defined by idx = idxAziTmp + 181 * idxEleTmp */ @@ -2634,7 +2810,7 @@ static void add_vertex_fixed( idxEleTmp = L_sub( Q22_90_DEG, idxEleTmp ); /* Final Idx */ - vtxArray[pos].idx = (Word16) idxAziTmp + 181 * (Word16) ( idxEleTmp >> Q22 ); + vtxArray[pos].idx = add( (Word16) idxAziTmp, i_mult( 181, (Word16) L_shr( idxEleTmp, Q22 ) ) ); /* Setting the nan flag to 0 */ vtxArray[pos].isNaN = 0; @@ -2653,6 +2829,37 @@ static void add_vertex_fixed( * (modified version of sort() to return an index array) *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void efap_sort_s_fx( + Word16 *x, /* i/o: Vector to be sorted */ + Word16 *idx, /* o : Original index positions */ + const Word16 len /* i : vector length */ +) +{ + Word16 i, j; + Word16 tempr, tempi; + + FOR( i = 0; i < len; i++ ) + { + idx[i] = i; + } + + FOR( i = len - 2; i >= 0; i-- ) + { + tempr = x[i]; + tempi = idx[i]; + FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) + { + x[j - 1] = x[j]; + idx[j - 1] = idx[j]; + } + x[j - 1] = tempr; + idx[j - 1] = tempi; + } + + return; +} +#else static void efap_sort_s( int16_t *x, /* i/o: Vector to be sorted */ int16_t *idx, /* o : Original index positions */ @@ -2662,16 +2869,16 @@ static void efap_sort_s( int16_t i, j; int16_t tempr, tempi; - FOR( i = 0; i < len; i++ ) + for ( i = 0; i < len; i++ ) { idx[i] = i; } - FOR( i = len - 2; i >= 0; i-- ) + for ( i = len - 2; i >= 0; i-- ) { tempr = x[i]; tempi = idx[i]; - FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) + for ( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) { x[j - 1] = x[j]; idx[j - 1] = idx[j]; @@ -2682,7 +2889,7 @@ static void efap_sort_s( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* * vertex_distance() @@ -2718,7 +2925,7 @@ static float vertex_distance( * Compute the signed distance between a vertex and a hull surface *-------------------------------------------------------------------------*/ -static Word32 vertex_distance_fixed( +static Word32 vertex_distance_fx( const EFAP_VERTEX *vtxArray, /* i : The considered vertex */ const EFAP_LS_TRIANGLE tri, /* i : The considered triangle */ const Word16 vtxIdx /* i : Index of the considered vertex */ @@ -2737,7 +2944,7 @@ static Word32 vertex_distance_fixed( P[i] = vtxArray[vtxIdx].pos[i]; } - return point_plane_distance_fixed( A, B, C, P ); + return point_plane_distance_fx( A, B, C, P ); } #endif @@ -2762,23 +2969,23 @@ static float point_poly_distance( } #else /*-------------------------------------------------------------------------* - * point_poly_distance_fixed() + * point_poly_distance_fx() * * Compute the signed distance between a point and polygon *-------------------------------------------------------------------------*/ -static Word32 point_poly_distance_fixed( +static Word32 point_poly_distance_fx( const EFAP_POLYSET poly, /* i : The polygon which forms a plane */ const Word32 X[3] /* i : Cartesian coordinates of the point of interest */ ) { Word32 P1[3], P2[3], P3[3]; - sph2cart_fixed( poly.polyAzi[0], poly.polyEle[0], &P1[0] ); - sph2cart_fixed( poly.polyAzi[1], poly.polyEle[1], &P2[0] ); - sph2cart_fixed( poly.polyAzi[2], poly.polyEle[2], &P3[0] ); + sph2cart_fx( poly.polyAzi[0], poly.polyEle[0], &P1[0] ); + sph2cart_fx( poly.polyAzi[1], poly.polyEle[1], &P2[0] ); + sph2cart_fx( poly.polyAzi[2], poly.polyEle[2], &P3[0] ); - return point_plane_distance_fixed( P1, P2, P3, X ); + return point_plane_distance_fx( P1, P2, P3, X ); } #endif @@ -2828,12 +3035,12 @@ static float point_plane_distance( } #else /*-------------------------------------------------------------------------* - * point_plane_distance_fixed() + * point_plane_distance_fx() * * Compute the signed distance between a point and a given plane *-------------------------------------------------------------------------*/ -static Word32 point_plane_distance_fixed( // returns output in Q28 +static Word32 point_plane_distance_fx( // returns output in Q28 const Word32 P1[3], /* i : First point of the triangle that defines the planes */ const Word32 P2[3], /* i : Second point of the triangle */ const Word32 P3[3], /* i : Third point of the triangle */ @@ -2859,7 +3066,7 @@ static Word32 point_plane_distance_fixed( // returns output in Q28 v_sub_fixed( P1, P3, tmpCross2, 3, 1 ); /* resultCross = cross(P1-P2,P1-P3) */ - efap_crossp_fixed( tmpCross1, tmpCross2, resultCross ); // Q29 + efap_crossp_fx( tmpCross1, tmpCross2, resultCross ); // Q29 /* Dot Product */ tmpNorm = dotp_fixed( resultCross, resultCross, 3 ); // Q27 @@ -2893,12 +3100,12 @@ static void efap_crossp( } #else /*-------------------------------------------------------------------------* - * efap_crossp_fixed() + * efap_crossp_fx() * * Compute the cross product between column vectors of float of size 3x1 *-------------------------------------------------------------------------*/ -static void efap_crossp_fixed( +static void efap_crossp_fx( const Word32 *v1, /* i : First float vector */ const Word32 *v2, /* i : Second float vector */ Word32 *v /* o : Output vector */ @@ -2917,7 +3124,33 @@ static void efap_crossp_fixed( * * Find an integer in triangle array of integers *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word16 find_int_in_tri_fx( + const EFAP_LS_TRIANGLE *tri, /* i : Triangle array */ + const Word16 n, /* i : The integer to find */ + const Word16 r, /* i : Number of rows */ + Word16 *pos /* o : Position of the integer */ +) +{ + Word16 i, j; + + /* Find the first element equal to n */ + FOR( i = 0; i < r; ++i ) + { + FOR( j = 0; j < 3; ++j ) + { + IF( EQ_16( tri[i].LS[j], n ) ) + { + pos[0] = i; + pos[1] = j; + return 1; + } + } + } + return 0; +} +#else static int16_t find_int_in_tri( const EFAP_LS_TRIANGLE *tri, /* i : Triangle array */ const int16_t n, /* i : The integer to find */ @@ -2928,11 +3161,11 @@ static int16_t find_int_in_tri( int16_t i, j; /* Find the first element equal to n */ - FOR( i = 0; i < r; ++i ) + for ( i = 0; i < r; ++i ) { - FOR( j = 0; j < 3; ++j ) + for ( j = 0; j < 3; ++j ) { - IF( EQ_16( tri[i].LS[j], n ) ) + if ( tri[i].LS[j] == n ) { pos[0] = i; pos[1] = j; @@ -2943,6 +3176,7 @@ static int16_t find_int_in_tri( return 0; } +#endif /*-------------------------------------------------------------------------* @@ -2950,7 +3184,29 @@ static int16_t find_int_in_tri( * * Remove a vertex from a vertex structure *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void remove_vertex_fx( + EFAP_VERTEX *vtxArray, /* i : Vertex array */ + const Word16 idx, /* i : Index of the vertex to remove */ + const Word16 L /* i : Length of the Vertex array */ +) +{ + Word16 i; + + assert( idx < L && "EFAP: index out of bounds" ); + + /* Shift all vertex of one position, so vtxArray[i] will be vtxArray[i+1] and so on */ + FOR( i = idx; i < L - 1; ++i ) + { + add_vertex_fx( vtxArray, vtxArray[i + 1].azi, vtxArray[i + 1].ele, i, EFAP_DMX_INTENSITY ); + } + + /* The last vertex is set to 0 */ + add_vertex_fx( vtxArray, 0, 0, sub( L, 1 ), EFAP_DMX_INTENSITY ); + return; +} +#else static void remove_vertex( EFAP_VERTEX *vtxArray, /* i : Vertex array */ const int16_t idx, /* i : Index of the vertex to remove */ @@ -2962,32 +3218,86 @@ static void remove_vertex( assert( idx < L && "EFAP: index out of bounds" ); /* Shift all vertex of one position, so vtxArray[i] will be vtxArray[i+1] and so on */ - FOR( i = idx; i < L - 1; ++i ) + for ( i = idx; i < L - 1; ++i ) { -#ifndef IVAS_FLOAT_FIXED add_vertex( vtxArray, vtxArray[i + 1].azi, vtxArray[i + 1].ele, i, EFAP_DMX_INTENSITY ); -#else - add_vertex_fixed( vtxArray, vtxArray[i + 1].azi, vtxArray[i + 1].ele, i, EFAP_DMX_INTENSITY ); -#endif } /* The last vertex is set to 0 */ -#ifndef IVAS_FLOAT_FIXED add_vertex( vtxArray, 0, 0, L - 1, EFAP_DMX_INTENSITY ); -#else - add_vertex_fixed( vtxArray, 0, 0, L - 1, EFAP_DMX_INTENSITY ); -#endif return; } - +#endif /*-------------------------------------------------------------------------* * get_neighbours() * * Returns the neighbouring triangles of a vertex *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word16 get_neighbours_fx( + const EFAP_LS_TRIANGLE *triArray, /* i : Triangle array */ + const Word16 vtxIdx, /* i : Index of the vertex */ + const Word16 numTri, /* i : Number of Triangles */ + Word16 *neighbours /* o : Output vector */ +) +{ + Word16 i, j, k; + Word16 tmpPos[2]; + Word16 tmpNeighbours[EFAP_MAX_SIZE_TMP_BUFF]; + Word16 dummy[EFAP_MAX_SIZE_TMP_BUFF]; + EFAP_LS_TRIANGLE tmpTriArray[EFAP_MAX_POLY_SET]; + + /* Processing */ + FOR( i = 0; i < numTri; ++i ) + { + mvs2s( triArray[i].LS, tmpTriArray[i].LS, 3 ); + } + + k = 0; + WHILE( 1 ) + { + IF( EQ_16(find_int_in_tri_fx( tmpTriArray, vtxIdx, numTri, tmpPos ), 0 ) ) + { + BREAK; + } + ELSE + { + tmpNeighbours[k] = tmpTriArray[tmpPos[0]].LS[0]; + tmpNeighbours[k + 1] = tmpTriArray[tmpPos[0]].LS[1]; + tmpNeighbours[k + 2] = tmpTriArray[tmpPos[0]].LS[2]; + k += 3; + tmpTriArray[tmpPos[0]].LS[tmpPos[1]] = -1; + } + + IF( GT_16( k, i_mult( 3, numTri ) ) ) + { + BREAK; + } + } + + /* Sorting the neighbours vector */ + efap_sort_s_fx( tmpNeighbours, dummy, k ); + + /* Creating the output vector, by eliminating redundancies and also deleting the indice == vtxIdx*/ + neighbours[0] = tmpNeighbours[0]; + j = 1; + FOR( i = 1; i < k; ++i ) + { + IF( NE_16( tmpNeighbours[i], tmpNeighbours[i - 1] ) && + NE_16( tmpNeighbours[i], vtxIdx ) ) + { + neighbours[j] = tmpNeighbours[i]; + ++j; + } + } + + /* Output, length of neighbours */ + return j; +} +#else static int16_t get_neighbours( const EFAP_LS_TRIANGLE *triArray, /* i : Triangle array */ const int16_t vtxIdx, /* i : Index of the vertex */ @@ -3002,19 +3312,19 @@ static int16_t get_neighbours( EFAP_LS_TRIANGLE tmpTriArray[EFAP_MAX_POLY_SET]; /* Processing */ - FOR( i = 0; i < numTri; ++i ) + for ( i = 0; i < numTri; ++i ) { mvs2s( triArray[i].LS, tmpTriArray[i].LS, 3 ); } k = 0; - WHILE( 1 ) + while ( 1 ) { - IF( EQ_16( find_int_in_tri( tmpTriArray, vtxIdx, numTri, tmpPos ), 0 ) ) + if ( find_int_in_tri( tmpTriArray, vtxIdx, numTri, tmpPos ) == 0 ) { break; } - ELSE + else { tmpNeighbours[k] = tmpTriArray[tmpPos[0]].LS[0]; tmpNeighbours[k + 1] = tmpTriArray[tmpPos[0]].LS[1]; @@ -3023,7 +3333,7 @@ static int16_t get_neighbours( tmpTriArray[tmpPos[0]].LS[tmpPos[1]] = -1; } - IF( GT_16( k, 3 * numTri ) ) + if ( k > 3 * numTri ) { break; } @@ -3036,10 +3346,10 @@ static int16_t get_neighbours( neighbours[0] = tmpNeighbours[0]; j = 1; - FOR( i = 1; i < k; ++i ) + for ( i = 1; i < k; ++i ) { - IF( NE_16( tmpNeighbours[i], tmpNeighbours[i - 1] ) && - NE_16( tmpNeighbours[i], vtxIdx ) ) + if ( ( tmpNeighbours[i] != tmpNeighbours[i - 1] ) && + ( tmpNeighbours[i] != vtxIdx ) ) { neighbours[j] = tmpNeighbours[i]; ++j; @@ -3049,6 +3359,7 @@ static int16_t get_neighbours( /* Output, length of neighbours */ return j; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* @@ -3078,12 +3389,12 @@ static void matrix_times_row( } #else /*-------------------------------------------------------------------------* - * matrix_times_row_fixed() + * matrix_times_row_fx() * * Computes the product of a matrix and a row vector *-------------------------------------------------------------------------*/ -static void matrix_times_row_fixed( +static void matrix_times_row_fx( Word32 mat[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF], /* i : The input matrix */ const Word32 *vec, /* i : The input row vector */ const Word16 L, /* i : Row length */ @@ -3109,7 +3420,98 @@ static void matrix_times_row_fixed( * * Combines triangles of a surface in order to create polygons *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void tri_to_poly_fx( + const EFAP_VERTEX *vtxArray, /* i : Vertex array */ + const EFAP_LS_TRIANGLE *triArray, /* i : Triangle array */ + const Word16 numVtx, /* i : Number of vertices */ + const Word16 numTri, /* i : Number of triangles */ + Word16 sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM], /* o : The matrix that will contain the sorted channels */ + Word16 *outLengthPS, /* o : The length of the sorted channels */ + Word16 outLengthSorted[EFAP_MAX_POLY_SET] /* o : The number of channels for each poly (i.e. outLengthSorted[i] = length(sortedChan[i]) */ +) +{ + Word16 i, j; + Word16 lenPoly; + Word16 lenPolySet; + Word16 found; + Word16 replaceIdx; + + Word16 poly[EFAP_MAX_CHAN_NUM]; + + Word16 sortedLengths[EFAP_MAX_POLY_SET]; + Word16 sortedTri[EFAP_MAX_POLY_SET]; + + Word32 dist; + lenPolySet = 0; + /* Sorting the polygons */ + FOR( i = 0; i < numTri; ++i ) + { + /* search for coplanar vertices and add them to the polygon */ + lenPoly = 0; + FOR( j = 0; j < numVtx; ++j ) + { + dist = L_abs( point_plane_distance_fx( + vtxArray[triArray[i].LS[0]].pos, + vtxArray[triArray[i].LS[1]].pos, + vtxArray[triArray[i].LS[2]].pos, + vtxArray[j].pos ) ); // Q28 + + IF( LT_32( dist, 268435 ) /* 1e-3f in Q28 */ ) + { + assert( lenPoly < EFAP_MAX_CHAN_NUM && "EFAP: exceeded max polygon vertices!" ); + poly[lenPoly] = j; + ++lenPoly; + } + } + + /* search existing polygons to determine whether the new one already exists/is a subset or is a superset */ + found = 0; + replaceIdx = -1; + FOR( j = 0; j < lenPolySet; ++j ) + { + found = compare_poly_fx( sortedChan[j], sortedLengths[j], poly, lenPoly ); + + IF( GT_16( found, 0 ) ) + { + BREAK; + } + ELSE IF( LT_16( found, 0 ) ) + { + replaceIdx = j; + } + } + + IF( EQ_16( found, 0 ) ) + { + /* append new poly */ + mvs2s( poly, sortedChan[lenPolySet], lenPoly ); + sortedTri[lenPolySet] = i; + sortedLengths[lenPolySet] = lenPoly; + ++lenPolySet; + } + ELSE IF( EQ_16( found, -1 ) ) + { + /* replace with superset */ + mvs2s( poly, sortedChan[replaceIdx], lenPoly ); + sortedTri[replaceIdx] = i; + sortedLengths[replaceIdx] = lenPoly; + } + } + + /* Sorting the vertex */ + FOR( i = 0; i < lenPolySet; ++i ) + { + sort_channels_vertex_fx( vtxArray, triArray, sortedChan[i], sortedLengths[i], sortedTri[i] ); + } + + /* Output */ + *outLengthPS = lenPolySet; + mvs2s( sortedLengths, outLengthSorted, EFAP_MAX_POLY_SET ); + return; +} +#else static void tri_to_poly( const EFAP_VERTEX *vtxArray, /* i : Vertex array */ const EFAP_LS_TRIANGLE *triArray, /* i : Triangle array */ @@ -3131,39 +3533,23 @@ static void tri_to_poly( int16_t sortedLengths[EFAP_MAX_POLY_SET]; int16_t sortedTri[EFAP_MAX_POLY_SET]; -#ifndef IVAS_FLOAT_FIXED float dist; -#else - Word32 dist; -#endif lenPolySet = 0; /* Sorting the polygons */ - FOR( i = 0; i < numTri; ++i ) + for ( i = 0; i < numTri; ++i ) { /* search for coplanar vertices and add them to the polygon */ lenPoly = 0; - FOR( j = 0; j < numVtx; ++j ) + for ( j = 0; j < numVtx; ++j ) { -#ifndef IVAS_FLOAT_FIXED dist = fabsf( point_plane_distance( vtxArray[triArray[i].LS[0]].pos, vtxArray[triArray[i].LS[1]].pos, vtxArray[triArray[i].LS[2]].pos, vtxArray[j].pos ) ); -#else - dist = L_abs( point_plane_distance_fixed( - vtxArray[triArray[i].LS[0]].pos, - vtxArray[triArray[i].LS[1]].pos, - vtxArray[triArray[i].LS[2]].pos, - vtxArray[j].pos ) ); // Q28 -#endif -#ifndef IVAS_FLOAT_FIXED - IF( dist < 1e-3f ) -#else - IF( LT_32( dist, 268435 ) /* 1e-3f in Q28 */ ) -#endif + if ( dist < 1e-3f ) { assert( lenPoly < EFAP_MAX_CHAN_NUM && "EFAP: exceeded max polygon vertices!" ); poly[lenPoly] = j; @@ -3174,21 +3560,21 @@ static void tri_to_poly( /* search existing polygons to determine whether the new one already exists/is a subset or is a superset */ found = 0; replaceIdx = -1; - FOR( j = 0; j < lenPolySet; ++j ) + for ( j = 0; j < lenPolySet; ++j ) { found = compare_poly( sortedChan[j], sortedLengths[j], poly, lenPoly ); - IF( GT_16( found, 0 ) ) + if ( found > 0 ) { break; } - ELSE IF( LT_16( found, 0 ) ) + else if ( found < 0 ) { replaceIdx = j; } } - IF( EQ_16( found, 0 ) ) + if ( found == 0 ) { /* append new poly */ mvs2s( poly, sortedChan[lenPolySet], lenPoly ); @@ -3196,7 +3582,7 @@ static void tri_to_poly( sortedLengths[lenPolySet] = lenPoly; ++lenPolySet; } - ELSE IF( EQ_16( found, -1 ) ) + else if ( found == -1 ) { /* replace with superset */ mvs2s( poly, sortedChan[replaceIdx], lenPoly ); @@ -3206,28 +3592,66 @@ static void tri_to_poly( } /* Sorting the vertex */ - FOR( i = 0; i < lenPolySet; ++i ) + for ( i = 0; i < lenPolySet; ++i ) { -#ifndef IVAS_FLOAT_FIXED sort_channels_vertex( vtxArray, triArray, sortedChan[i], sortedLengths[i], sortedTri[i] ); -#else - sort_channels_vertex_fixed( vtxArray, triArray, sortedChan[i], sortedLengths[i], sortedTri[i] ); -#endif } /* Output */ *outLengthPS = lenPolySet; mvs2s( sortedLengths, outLengthSorted, EFAP_MAX_POLY_SET ); + return; } - +#endif /*-------------------------------------------------------------------------* * compare_poly() * * Compares a newly created polygon with an existing one *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word16 compare_poly_fx( + Word16 *old, /* i : Existing polygon */ + Word16 lenOld, /* i : Length of existing polygon */ + Word16 *new, /* i : New polygon */ + Word16 lenNew /* i : Length of new polygon */ +) +{ + Word16 i, j; + Word16 count; + + count = 0; + + FOR( i = 0; i < lenOld; ++i ) + { + FOR( j = count; j < lenNew; ++j ) + { + IF( EQ_16( old[i], new[j] ) ) + { + count = add( count, 1 ); + BREAK; + } + } + } + IF( EQ_16( count, lenOld ) && LT_16( lenOld, lenNew ) ) + { + /* new polygon is a superset */ + return -1; + } + ELSE IF( EQ_16( count, lenNew ) && GE_16( lenOld, lenNew ) ) + { + /* found as subset or identical */ + return 1; + } + ELSE + { + /* not found */ + return 0; + } +} +#else static int16_t compare_poly( int16_t *old, /* i : Existing polygon */ int16_t lenOld, /* i : Length of existing polygon */ @@ -3240,11 +3664,11 @@ static int16_t compare_poly( count = 0; - FOR( i = 0; i < lenOld; ++i ) + for ( i = 0; i < lenOld; ++i ) { - FOR( j = count; j < lenNew; ++j ) + for ( j = count; j < lenNew; ++j ) { - IF( old[i] == new[j] ) + if ( old[i] == new[j] ) { ++count; break; @@ -3252,22 +3676,23 @@ static int16_t compare_poly( } } - IF( count == lenOld && lenOld < lenNew ) + if ( count == lenOld && lenOld < lenNew ) { /* new polygon is a superset */ return -1; } - ELSE IF( count == lenNew && lenOld >= lenNew ) + else if ( count == lenNew && lenOld >= lenNew ) { /* found as subset or identical */ return 1; } - ELSE + else { /* not found */ return 0; } } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* @@ -3367,7 +3792,7 @@ static void sort_channels_vertex( * Sort the channels of a polygon set according to the vertex azimuth *-------------------------------------------------------------------------*/ -static void sort_channels_vertex_fixed( +static void sort_channels_vertex_fx( const EFAP_VERTEX *vtxArray, /* i : Vertex array */ const EFAP_LS_TRIANGLE *triArray, /* i : Triangle array */ Word16 channels[EFAP_MAX_CHAN_NUM], /* o : Channels array to be modified */ @@ -3414,7 +3839,7 @@ static void sort_channels_vertex_fixed( FOR( i = 0; i < 3; i++ ) { - tmpV2[i] = L_shl( tmpV2[i], Q2 + ( 2 * exp1 ) ); + tmpV2[i] = L_shl( tmpV2[i], add( Q2, shl( exp1, 1 ) ) ); } v_sub_fixed( tmpV1, tmpV2, tmpV3, 3, 0 ); // tmpV3 Q30 @@ -3443,7 +3868,7 @@ static void sort_channels_vertex_fixed( y = dotp_fixed( P, V, 3 ); // y Q29 - exp2 // Executing azi[i] = atan2f( y, x ); - azi[i] = L_shl( (Word32) BASOP_util_atan2( y, x, exp2 - exp1 ), Q16 ); // azi 2Q29 + azi[i] = L_shl( (Word32) BASOP_util_atan2( y, x, sub( exp2, exp1 ) ), Q16 ); // azi 2Q29 } /* Sorting the azi vec */ @@ -3563,7 +3988,7 @@ static int16_t get_poly_num( * Returns the index of the polygon in which the coordinate is *-------------------------------------------------------------------------*/ -static Word16 get_poly_num_fixed( +static Word16 get_poly_num_fx( const Word32 P[2], /* i : Azimuth and elevation of the point */ const EFAP_POLYSET_DATA *polyData /* i : Polyset struct */ ) @@ -3578,15 +4003,15 @@ static Word16 get_poly_num_fixed( num_poly = 0; - sph2cart_fixed( P[0], P[1], &pos[0] ); + sph2cart_fx( P[0], P[1], &pos[0] ); /* Filter the polygon list with a fast 2d check */ FOR( i = 0; i < polyData->numPoly; ++i ) { - IF( in_poly_fixed( P, polyData->polysetArray[i] ) ) + IF( in_poly_fx( P, polyData->polysetArray[i] ) ) { /* select only polygons which are visible from the point */ - dist_tmp = point_poly_distance_fixed( polyData->polysetArray[i], pos ); + dist_tmp = point_poly_distance_fx( polyData->polysetArray[i], pos ); IF( EQ_32( dist_tmp, 0 ) ) { return i; @@ -3692,12 +4117,12 @@ static int16_t in_poly( } #else /*-------------------------------------------------------------------------* - * in_poly_fixed() + * in_poly_fx() * * Determines if a given point is within a polygon or not *-------------------------------------------------------------------------*/ -static Word16 in_poly_fixed( /* Angles are in Q22 */ +static Word16 in_poly_fx( /* Angles are in Q22 */ const Word32 P[2], /* i : Azimuth and elevation of the point */ const EFAP_POLYSET poly /* i : Polyset struct */ ) @@ -3730,7 +4155,7 @@ static Word16 in_poly_fixed( /* Angles are in Q22 */ v_sub_fixed( P, A, P_minus_A, 2, 0 ); /* Precalculate value of (P-A) */ - FOR( n = 1; n < numVertices - 1; ++n ) + FOR( n = 1; n < sub( numVertices, 1 ); ++n ) { IF( poly.isNaN[n] ) { @@ -3752,7 +4177,7 @@ static Word16 in_poly_fixed( /* Angles are in Q22 */ } C[1] = poly.polyEle[n + 1]; - IF( in_tri_fixed( A, B, C, P_minus_A ) ) + IF( in_tri_fx( A, B, C, P_minus_A ) ) { return 1; } @@ -3822,12 +4247,12 @@ static int16_t in_tri( } #else /*-------------------------------------------------------------------------* - * in_tri_fixed() + * in_tri_fx() * * Determines if a given point is within a triangle or not *-------------------------------------------------------------------------*/ -static Word16 in_tri_fixed( +static Word16 in_tri_fx( Word32 A[2], /* i : Coordinate of one apex of the triangle */ Word32 B[2], /* i : Coordinate of one apex of the triangle */ Word32 C[2], /* i : Coordinate of one apex of the triangle */ @@ -3859,7 +4284,7 @@ static Word16 in_tri_fixed( return 0; } - invFactor_w64 = ( ( (Word64) 0x7FFFFFFFFFFFFFFF ) / ( (Word64) invFactor ) ) >> Q19; // Q31 + invFactor_w64 = W_shr( ( (Word64) 0x7FFFFFFFFFFFFFFF ) / ( (Word64) invFactor ), Q19 ); // Q31 invFactor = (Word32) invFactor_w64; Word16 invFactor_exp = norm_l( invFactor ); @@ -3950,12 +4375,12 @@ static void sph2cart( } #else /*-------------------------------------------------------------------------* - * sph2cart_fixed() + * sph2cart_fx() * * Converts a vertex position to cartesian coordinates *-------------------------------------------------------------------------*/ -static void sph2cart_fixed( +static void sph2cart_fx( const Word32 azi, /* i : Azimuth in degrees (Q22) */ const Word32 ele, /* i : Elevation in degrees (Q22) */ Word32 *pos /* o : Cartesian coordinates vector (x, y, z) */ diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 6e85d16f5..2b8619284 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -44,6 +44,20 @@ * Allocate HRTF binary handle *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_HRTF_binary_open_fx( + TDREND_HRFILT_FiltSet_t **hHrtfTD ) +{ + /* Allocate HR filter set for headphones configuration */ + *hHrtfTD = (TDREND_HRFILT_FiltSet_t *) malloc( sizeof( TDREND_HRFILT_FiltSet_t ) ); + IF( *hHrtfTD == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary!" ); + } + + return IVAS_ERR_OK; +} +#else ivas_error ivas_HRTF_binary_open( TDREND_HRFILT_FiltSet_t **hHrtfTD ) { @@ -56,6 +70,7 @@ ivas_error ivas_HRTF_binary_open( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -64,6 +79,22 @@ ivas_error ivas_HRTF_binary_open( * Close HRTF binary handle *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_HRTF_binary_close_fx( + TDREND_HRFILT_FiltSet_t **hHrtfTD ) +{ + test(); + IF( hHrtfTD == NULL || *hHrtfTD == NULL ) + { + return; + } + + free( *hHrtfTD ); + *hHrtfTD = NULL; + + return; +} +#else void ivas_HRTF_binary_close( TDREND_HRFILT_FiltSet_t **hHrtfTD ) { @@ -77,6 +108,7 @@ void ivas_HRTF_binary_close( return; } +#endif /*-----------------------------------------------------------------------* @@ -85,6 +117,26 @@ void ivas_HRTF_binary_close( * Allocate HRTF binary handle *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_HRTF_CRend_binary_open_fx( + HRTFS_CREND **hSetOfHRTF ) +{ + /* Allocate HR filter set for headphones configuration */ + *hSetOfHRTF = (HRTFS_CREND *) malloc( sizeof( HRTFS_CREND ) ); + IF( *hSetOfHRTF == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for set of HRTF binary!" ); + } + + ( *hSetOfHRTF )->hHRTF_hrir_combined = NULL; + ( *hSetOfHRTF )->hHRTF_hrir_hoa3 = NULL; + ( *hSetOfHRTF )->hHRTF_hrir_hoa2 = NULL; + ( *hSetOfHRTF )->hHRTF_hrir_foa = NULL; + ( *hSetOfHRTF )->hHRTF_brir_combined = NULL; + + return IVAS_ERR_OK; +} +#else ivas_error ivas_HRTF_CRend_binary_open( HRTFS_CREND **hSetOfHRTF ) { @@ -103,6 +155,7 @@ ivas_error ivas_HRTF_CRend_binary_open( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -111,6 +164,22 @@ ivas_error ivas_HRTF_CRend_binary_open( * Close HRTF CRend binary handle *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_HRTF_CRend_binary_close_fx( + HRTFS_CREND **hSetOfHRTF ) +{ + test(); + IF( hSetOfHRTF == NULL || *hSetOfHRTF == NULL ) + { + return; + } + + free( *hSetOfHRTF ); + *hSetOfHRTF = NULL; + + return; +} +#else void ivas_HRTF_CRend_binary_close( HRTFS_CREND **hSetOfHRTF ) { @@ -124,6 +193,7 @@ void ivas_HRTF_CRend_binary_close( return; } +#endif /*-----------------------------------------------------------------------* @@ -153,6 +223,22 @@ ivas_error ivas_HRTF_fastconv_binary_open( * Close HRTF binary handle for FASTCONV renderer *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_HRTF_fastconv_binary_close_fx( + HRTFS_FASTCONV **hHrtfFastConv ) +{ + test(); + IF( hHrtfFastConv == NULL || *hHrtfFastConv == NULL ) + { + return; + } + + free( *hHrtfFastConv ); + *hHrtfFastConv = NULL; + + return; +} +#else void ivas_HRTF_fastconv_binary_close( HRTFS_FASTCONV **hHrtfFastConv ) { @@ -166,6 +252,7 @@ void ivas_HRTF_fastconv_binary_close( return; } +#endif /*-----------------------------------------------------------------------* @@ -174,6 +261,19 @@ void ivas_HRTF_fastconv_binary_close( * Allocate HRTF binary handle for parametric binauralizer *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_HRTF_parambin_binary_open_fx( + HRTFS_PARAMBIN **hHrtfParambin ) +{ + *hHrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ); + IF( *hHrtfParambin == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for parametric binauralizer HRTF tables!" ); + } + + return IVAS_ERR_OK; +} +#else ivas_error ivas_HRTF_parambin_binary_open( HRTFS_PARAMBIN **hHrtfParambin ) { @@ -185,6 +285,7 @@ ivas_error ivas_HRTF_parambin_binary_open( return IVAS_ERR_OK; } +#endif /*-----------------------------------------------------------------------* @@ -193,6 +294,22 @@ ivas_error ivas_HRTF_parambin_binary_open( * Close HRTF binary handle for parametric binauralizer *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_HRTF_parambin_binary_close_fx( + HRTFS_PARAMBIN **hHrtfParambin ) +{ + test(); + IF( hHrtfParambin == NULL || *hHrtfParambin == NULL ) + { + return; + } + + free( *hHrtfParambin ); + *hHrtfParambin = NULL; + + return; +} +#else void ivas_HRTF_parambin_binary_close( HRTFS_PARAMBIN **hHrtfParambin ) { @@ -206,3 +323,4 @@ void ivas_HRTF_parambin_binary_close( return; } +#endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 553b60a05..9ee54f329 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -807,148 +807,146 @@ ivas_error ivas_td_binaural_renderer_unwrap( * Render one 5 ms subframe from the mixer *---------------------------------------------------------------------*/ -ivas_error TDREND_GetMix( +#ifdef IVAS_FLOAT_FIXED +ivas_error TDREND_GetMix_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ - const int16_t subframe_length, /* i/o: subframe length */ - const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ - const int16_t ism_md_subframe_update /* i : Number of subframes to delay ism metadata to sync with audio */ + Word32 *output[], /* i/o: ISM object synth / rendered output in 0,1 */ + const Word16 subframe_length, /* i/o: subframe length */ + const Word16 subframe_idx, /* i : Subframe index to 5 ms subframe */ + const Word16 ism_md_subframe_update /* i : Number of subframes to delay ism metadata to sync with audio */ ) { - int16_t i; + Word16 i; TDREND_SRC_t *Src_p; TDREND_SRC_SPATIAL_t *SrcSpatial_p; TDREND_SRC_REND_t *SrcRend_p; ivas_error error; - float output_buf[2][L_SPATIAL_SUBFR_48k]; /* Temp buffer for left/right rendered signal */ - float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; - float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; - int16_t intp_count; - int16_t subframe_update_flag; + Word32 output_buf[2][L_SPATIAL_SUBFR_48k]; /* Temp buffer for left/right rendered signal */ + Word32 hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; + Word32 hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; + Word16 intp_count; + Word16 subframe_update_flag; + Word16 hrf_left_delta_e = 0, hrf_right_delta_e = 0; - subframe_update_flag = subframe_idx == ism_md_subframe_update; + subframe_update_flag = (Word16)EQ_16( subframe_idx, ism_md_subframe_update ); error = IVAS_ERR_OK; /* Clear the output buffer to accumulate rendered sources */ - set_f( output_buf[0], 0.0f, subframe_length ); - set_f( output_buf[1], 0.0f, subframe_length ); - + set32_fx( output_buf[0], 0, subframe_length ); + set32_fx( output_buf[1], 0, subframe_length ); /* Clear interpolation buffers and counter */ - set_f( hrf_left_delta, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - set_f( hrf_right_delta, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); + set32_fx( hrf_left_delta, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); + set32_fx( hrf_right_delta, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); + intp_count = 0; + move16(); /* Create the mix */ /* Loop through the source list and render each source */ - for ( i = 0; i < hBinRendererTd->NumOfSrcs; i++ ) + FOR( i = 0; i < hBinRendererTd->NumOfSrcs; i++ ) { Src_p = hBinRendererTd->Sources[i]; SrcSpatial_p = Src_p->SrcSpatial_p; SrcRend_p = Src_p->SrcRend_p; /* Update rendering params if needed */ - if ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) + test(); test(); + IF ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) { - TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, - Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_update_flag ); + TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( hBinRendererTd, SrcRend_p, SrcSpatial_p, + Src_p->hrf_left_prev_fx, &Src_p->hrf_left_prev_e, Src_p->hrf_right_prev_fx, &Src_p->hrf_right_prev_e, + hrf_left_delta, &hrf_left_delta_e, hrf_right_delta, &hrf_right_delta_e, + &intp_count, &Src_p->filterlength, &Src_p->itd, + &Src_p->Gain_fx, + Src_p, subframe_update_flag ); } /* Render source if needed */ - if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) ) + IF ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) ) { - error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length ); + error = TDREND_REND_RenderSourceHRFilt_fx( Src_p, hrf_left_delta, &hrf_left_delta_e, + hrf_right_delta, &hrf_right_delta_e, intp_count, output_buf, subframe_length ); } } + /* Populate output variable */ - mvr2r( output_buf[0], output[0] + subframe_idx * subframe_length, subframe_length ); /* Left */ - mvr2r( output_buf[1], output[1] + subframe_idx * subframe_length, subframe_length ); /* Right */ + Copy32( output_buf[0], output[0] + imult1616(subframe_idx, subframe_length), subframe_length ); /* Left */ + Copy32( output_buf[1], output[1] + imult1616(subframe_idx, subframe_length), subframe_length ); /* Right */ /* Clear the PoseUpdated and Source position update flags */ - TDREND_Clear_Update_flags( hBinRendererTd ); + TDREND_Clear_Update_flags_fx( hBinRendererTd ); return error; } - - -#ifdef IVAS_FLOAT_FIXED -ivas_error TDREND_GetMix_fx( +#else +ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - Word32 *output[], /* i/o: ISM object synth / rendered output in 0,1 */ - const Word16 subframe_length, /* i/o: subframe length */ - const Word16 subframe_idx, /* i : Subframe index to 5 ms subframe */ - const Word16 ism_md_subframe_update /* i : Number of subframes to delay ism metadata to sync with audio */ + float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ + const int16_t subframe_length, /* i/o: subframe length */ + const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ + const int16_t ism_md_subframe_update /* i : Number of subframes to delay ism metadata to sync with audio */ ) { - Word16 i; + int16_t i; TDREND_SRC_t *Src_p; TDREND_SRC_SPATIAL_t *SrcSpatial_p; TDREND_SRC_REND_t *SrcRend_p; ivas_error error; - Word32 output_buf[2][L_SPATIAL_SUBFR_48k]; /* Temp buffer for left/right rendered signal */ - Word32 hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; - Word32 hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; - Word16 intp_count; - Word16 subframe_update_flag; - Word16 hrf_left_delta_e = 0, hrf_right_delta_e = 0; + float output_buf[2][L_SPATIAL_SUBFR_48k]; /* Temp buffer for left/right rendered signal */ + float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; + float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; + int16_t intp_count; + int16_t subframe_update_flag; - subframe_update_flag = (Word16)EQ_16( subframe_idx, ism_md_subframe_update ); + subframe_update_flag = subframe_idx == ism_md_subframe_update; error = IVAS_ERR_OK; /* Clear the output buffer to accumulate rendered sources */ - set32_fx( output_buf[0], 0, subframe_length ); - set32_fx( output_buf[1], 0, subframe_length ); - /* Clear interpolation buffers and counter */ - set32_fx( hrf_left_delta, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - set32_fx( hrf_right_delta, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); + set_f( output_buf[0], 0.0f, subframe_length ); + set_f( output_buf[1], 0.0f, subframe_length ); + /* Clear interpolation buffers and counter */ + set_f( hrf_left_delta, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); + set_f( hrf_right_delta, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); intp_count = 0; - move16(); /* Create the mix */ /* Loop through the source list and render each source */ - FOR( i = 0; i < hBinRendererTd->NumOfSrcs; i++ ) + for ( i = 0; i < hBinRendererTd->NumOfSrcs; i++ ) { Src_p = hBinRendererTd->Sources[i]; SrcSpatial_p = Src_p->SrcSpatial_p; SrcRend_p = Src_p->SrcRend_p; /* Update rendering params if needed */ - test(); test(); - IF ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) + if ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) { - TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( hBinRendererTd, SrcRend_p, SrcSpatial_p, - Src_p->hrf_left_prev_fx, &Src_p->hrf_left_prev_e, Src_p->hrf_right_prev_fx, &Src_p->hrf_right_prev_e, - hrf_left_delta, &hrf_left_delta_e, hrf_right_delta, &hrf_right_delta_e, - &intp_count, &Src_p->filterlength, &Src_p->itd, - &Src_p->Gain_fx, - Src_p, subframe_update_flag ); + TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, + Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_update_flag ); } /* Render source if needed */ - IF ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) ) + if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) ) { - error = TDREND_REND_RenderSourceHRFilt_fx( Src_p, hrf_left_delta, &hrf_left_delta_e, - hrf_right_delta, &hrf_right_delta_e, intp_count, output_buf, subframe_length ); + error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length ); } } - /* Populate output variable */ - Copy32( output_buf[0], output[0] + imult1616(subframe_idx, subframe_length), subframe_length ); /* Left */ - Copy32( output_buf[1], output[1] + imult1616(subframe_idx, subframe_length), subframe_length ); /* Right */ + mvr2r( output_buf[0], output[0] + subframe_idx * subframe_length, subframe_length ); /* Left */ + mvr2r( output_buf[1], output[1] + subframe_idx * subframe_length, subframe_length ); /* Right */ /* Clear the PoseUpdated and Source position update flags */ - TDREND_Clear_Update_flags_fx( hBinRendererTd ); + TDREND_Clear_Update_flags( hBinRendererTd ); return error; } #endif - /*---------------------------------------------------------------------* * TDREND_Clear_Update_flags() * diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 3fdbe47f0..720816ea7 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -46,14 +46,14 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void getPeriodicBSplineSampVec( float *BfVec, int16_t *AzIdx, const int16_t NumBFs, const float t, int16_t *num_az_idx, const float knot_interval, const float azimKSeq_0, const int16_t azimSegSamples, const float *azimBsShape, const int16_t subSampFactor ); static void getStandardBSplineSampVec( float *BfVec, int16_t *NzIdx, int16_t *num_idx, const int16_t NumBFs, const float t, const float *KSeq, const int16_t SegSamples, const int16_t *BsLen, const int16_t *BsStart, const float *BsShape ); static void GenerateFilter( const float elev, float azim, ModelParams_t *model, ModelEval_t *modelEval ); static void GenerateITD( const float elev, float azim, ModelParamsITD_t *model, ModelEval_t *modelEval ); static void SkipSmallest_ValueIndex( int16_t *use_inds, const ValueIndex_t *VI, const int16_t N, const int16_t n_smallest ); - -#ifdef IVAS_FLOAT_FIXED -static Word32 round_fixed(Word32 n, Word16 q); +#else +static Word32 round_fixed( Word32 n, Word16 q ); static void getPeriodicBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *AzIdx, const Word16 NumBFs, const Word32 t_fx, Word16 *num_az_idx, const Word32 knot_interval_fx, const Word32 azimKSeq_0_fx, const Word16 azimSegSamples, const Word32 *azimBsShape_fx, const Word16 subSampFactor ); static void getStandardBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *NzIdx, Word16 *num_idx, const Word16 NumBFs, const Word32 t_fx, const Word32 *KSeq_fx, const Word16 SegSamples, const Word16 *BsLen, const Word16 *BsStart, const Word32 *BsShape_fx ); static void GenerateFilter_fx( const Word32 elev, Word32 azim, ModelParams_t *model, ModelEval_t *modelEval ); @@ -67,6 +67,7 @@ static void SkipSmallest_ValueIndex_fx( Word16 *use_inds, const ValueIndex_t *VI * Renders each object using the HR filters --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error TDREND_REND_RenderSourceHRFilt( TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ const float *hrf_left_delta, /* i : Left filter interpolation delta */ @@ -91,21 +92,20 @@ ivas_error TDREND_REND_RenderSourceHRFilt( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error TDREND_REND_RenderSourceHRFilt_fx( - TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ - Word32 *hrf_left_delta_fx, /* i/o: Left filter interpolation delta */ - Word16 *hrf_left_delta_e, /* i/o: Left filter interpolation delta exp */ - Word32 *hrf_right_delta_fx, /* i/o: Right filter interpolation delta */ - Word16 *hrf_right_delta_e, /* i/o: Right filter interpolation delta exp */ - const Word16 intp_count, /* i : Interpolation count */ - Word32 output_buf_fx[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ - const Word16 subframe_length /* i : Subframe length in use */ + TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ + Word32 *hrf_left_delta_fx, /* i/o: Left filter interpolation delta */ + Word16 *hrf_left_delta_e, /* i/o: Left filter interpolation delta exp */ + Word32 *hrf_right_delta_fx, /* i/o: Right filter interpolation delta */ + Word16 *hrf_right_delta_e, /* i/o: Right filter interpolation delta exp */ + const Word16 intp_count, /* i : Interpolation count */ + Word32 output_buf_fx[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ + const Word16 subframe_length /* i : Subframe length in use */ ) { - Word32 LeftOutputFrame_fx[L_SPATIAL_SUBFR_48k]; // will have same Q as Src_p->InputFrame_p_fx - Word32 RightOutputFrame_fx[L_SPATIAL_SUBFR_48k]; // will have same Q as Src_p->InputFrame_p_fx + Word32 LeftOutputFrame_fx[L_SPATIAL_SUBFR_48k]; // will have same Q as Src_p->InputFrame_p_fx + Word32 RightOutputFrame_fx[L_SPATIAL_SUBFR_48k]; // will have same Q as Src_p->InputFrame_p_fx Word16 left_filter_e; Word16 right_filter_e; @@ -131,18 +131,19 @@ ivas_error TDREND_REND_RenderSourceHRFilt_fx( TDREND_firfilt_fx( LeftOutputFrame_fx, Src_p->hrf_left_prev_fx, left_filter_e, hrf_left_delta_fx, intp_count, Src_p->mem_hrf_left_fx, subframe_length, Src_p->filterlength, Src_p->Gain_fx, Src_p->prevGain_fx ); TDREND_firfilt_fx( RightOutputFrame_fx, Src_p->hrf_right_prev_fx, right_filter_e, hrf_right_delta_fx, intp_count, Src_p->mem_hrf_right_fx, subframe_length, Src_p->filterlength, Src_p->Gain_fx, Src_p->prevGain_fx ); - + Src_p->prevGain_fx = Src_p->Gain_fx; move16(); /* Copy to accumulative output frame */ - v_add_32( LeftOutputFrame_fx, output_buf_fx[0], output_buf_fx[0], subframe_length ); // Same Q as Src_p->InputFrame_p_fx - v_add_32( RightOutputFrame_fx, output_buf_fx[1], output_buf_fx[1], subframe_length ); // Same Q as Src_p->InputFrame_p_fx + v_add_32( LeftOutputFrame_fx, output_buf_fx[0], output_buf_fx[0], subframe_length ); // Same Q as Src_p->InputFrame_p_fx + v_add_32( RightOutputFrame_fx, output_buf_fx[1], output_buf_fx[1], subframe_length ); // Same Q as Src_p->InputFrame_p_fx return IVAS_ERR_OK; } #endif + /*-------------------------------------------------------------------* * GetFilterFromAngle() * @@ -150,6 +151,7 @@ ivas_error TDREND_REND_RenderSourceHRFilt_fx( * This version uses the HR filter model. --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ @@ -179,8 +181,7 @@ void GetFilterFromAngle( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void GetFilterFromAngle_fx( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const Word32 Elev_fx, /* i : Elevation, degrees Q22 */ @@ -203,7 +204,7 @@ void GetFilterFromAngle_fx( move16(); /* 4. Evaluate the ITD */ - IF ( HrFiltSet_p->ModelParams.UseItdModel ) + IF( HrFiltSet_p->ModelParams.UseItdModel ) { GenerateITD_fx( Elev_fx, Azim_fx, &HrFiltSet_p->ModelParamsITD, &HrFiltSet_p->ModelEval ); *itd = extract_l( HrFiltSet_p->ModelEval.itdMod_fx ); @@ -218,9 +219,9 @@ void GetFilterFromAngle_fx( } #endif -static Word32 round_fixed( /* o : Output value Q0 */ - Word32 num, /* i : Input value */ - Word16 q /* i : Input q-factor */ +static Word32 round_fixed( /* o : Output value Q0 */ + Word32 num, /* i : Input value */ + Word16 q /* i : Input q-factor */ ) { Word32 half = L_shl( 1, ( q - 1 ) ); @@ -252,6 +253,7 @@ static Word32 round_fixed( /* o : Output value Q0 */ * Generate an HR filter using the B Spline model. --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void GenerateFilter( const float elev, /* i : Elevation angle, degrees */ float azim, /* i : Azimuth angle, degrees */ @@ -365,7 +367,7 @@ static void GenerateFilter( return; } -#ifdef IVAS_FLOAT_FIXED +#else static void GenerateFilter_fx( const Word32 elev, /* i : Elevation angle, degrees Q22 */ Word32 azim, /* i : Azimuth angle, degrees Q22 */ @@ -439,7 +441,6 @@ static void GenerateFilter_fx( FOR( i = 0; i < num_az_idx[p]; i++ ) { modelEval->BM_fx[qp + i] = L_shl( Mpy_32_32( modelEval->elevBfVec_fx[p], modelEval->azimBfVec_fx[p][i] ), Q30 - ( Q30 * 2 - 31 ) ); // Q30 - modelEval->BM[qp + i] = fix_to_float( modelEval->BM_fx[qp + i], Q30 ); BM_idx[qp + i] = model->azim_start_idx[EvIdx[p]] + AzIdx[p][i]; } qp = add( qp, num_az_idx[p] ); @@ -543,15 +544,16 @@ static void GenerateFilter_fx( return; } - #endif + /*-------------------------------------------------------------------* * GenerateITD() * * Generates an ITD value from the B Spline model. --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void GenerateITD( const float elev, /* i : Elevation angle, degrees */ float azim, /* i : Azimuth angle, degrees */ @@ -664,8 +666,7 @@ static void GenerateITD( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void GenerateITD_fx( const Word32 elev_fx, /* i : Elevation angle, degrees Q22 */ Word32 azim_fx, /* i : Azimuth angle, degrees Q22 */ @@ -826,6 +827,7 @@ static void GenerateITD_fx( * Obtain a periodic sampled B Spline basis vector. --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void getPeriodicBSplineSampVec( float *BfVec, /* i/o: values for non-zero basis functions */ int16_t *AzIdx, /* i/o: indices of non-zero basis functions */ @@ -865,8 +867,7 @@ static void getPeriodicBSplineSampVec( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void getPeriodicBSplineSampVec_fx( Word32 *BfVec_fx, /* o : values for non-zero basis functions Q30 */ Word16 *AzIdx, /* o : indices of non-zero basis functions */ @@ -884,7 +885,7 @@ static void getPeriodicBSplineSampVec_fx( Word32 tmp32; Word16 tmp_e1, tmp_e2; Word16 SegSamples; - + SegSamples = 0; move16(); IF( azimSegSamples != 0 ) @@ -893,19 +894,19 @@ static void getPeriodicBSplineSampVec_fx( } /* index of closest sample point */ - IF(knot_interval_fx == 0) + IF( knot_interval_fx == 0 ) { d0 = 0; move16(); } ELSE { - tmp32 = L_deposit_h(BASOP_Util_Divide3216_Scale(knot_interval_fx, SegSamples, &tmp_e1)); - tmp_e1 = add(tmp_e1, sub(9, 15)); - tmp32 = L_deposit_h(BASOP_Util_Divide3232_Scale(L_sub(t_fx, azimKSeq_0_fx), tmp32, &tmp_e2)); - tmp_e2 = add(tmp_e2, sub(9, tmp_e1)); - tmp32 = L_shr(tmp32, sub(9, tmp_e2)); // Q22 (assuming tmp32 will be in range of Q22) - d0 = extract_l(round_fixed(tmp32, Q22)); + tmp32 = L_deposit_h( BASOP_Util_Divide3216_Scale( knot_interval_fx, SegSamples, &tmp_e1 ) ); + tmp_e1 = add( tmp_e1, sub( 9, 15 ) ); + tmp32 = L_deposit_h( BASOP_Util_Divide3232_Scale( L_sub( t_fx, azimKSeq_0_fx ), tmp32, &tmp_e2 ) ); + tmp_e2 = add( tmp_e2, sub( 9, tmp_e1 ) ); + tmp32 = L_shr( tmp32, sub( 9, tmp_e2 ) ); // Q22 (assuming tmp32 will be in range of Q22) + d0 = extract_l( round_fixed( tmp32, Q22 ) ); } /* find segment */ @@ -921,14 +922,14 @@ static void getPeriodicBSplineSampVec_fx( IF( d0 % SegSamples == 0 ) { - *num_az_idx = sub(*num_az_idx, 1); /* on the knot points, the last basis function is zero */ + *num_az_idx = sub( *num_az_idx, 1 ); /* on the knot points, the last basis function is zero */ } FOR( i = 0; i < *num_az_idx; i++ ) { d = d0 - ( i + nI - 1 ) * SegSamples; /* offset of knot_interval */ - d = sub(d0, imult1616(sub(add(i, nI), 1), SegSamples)); - BfVec_fx[i] = azimBsShape_fx[abs_s(d) * subSampFactor]; + d = sub( d0, imult1616( sub( add( i, nI ), 1 ), SegSamples ) ); + BfVec_fx[i] = azimBsShape_fx[abs_s( d ) * subSampFactor]; AzIdx[i] = add( nI, i ) % NumBFs; } @@ -942,6 +943,7 @@ static void getPeriodicBSplineSampVec_fx( * Obtain a sampled B Spline basis vector. --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void getStandardBSplineSampVec( float *BfVec, /* i/o: values for non-zero basis functions */ int16_t *NzIdx, /* i/o: indices of non-zero basis functions */ @@ -993,8 +995,7 @@ static void getStandardBSplineSampVec( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void getStandardBSplineSampVec_fx( Word32 *BfVec_fx, /* o : values for non-zero basis functions Q30 */ Word16 *NzIdx, /* o : indices of non-zero basis functions */ @@ -1077,16 +1078,16 @@ void HRTF_model_precalc( { Word16 sec_length; Word16 i; - sec_length = mult(model->K,10923); /*10923 == 2 ^ 15 / 3*/ - FOR ( i = 0; i < HRTF_MODEL_N_SECTIONS; i++ ) + sec_length = mult( model->K, 10923 ); /*10923 == 2 ^ 15 / 3*/ + FOR( i = 0; i < HRTF_MODEL_N_SECTIONS; i++ ) { - model->iSecFirst[i] = imult1616(i , sec_length); + model->iSecFirst[i] = imult1616( i, sec_length ); } - FOR ( i = 0; i < HRTF_MODEL_N_SECTIONS - 1; i++ ) + FOR( i = 0; i < HRTF_MODEL_N_SECTIONS - 1; i++ ) { - model->iSecLast[i] = sub(imult1616(add( i , 1 ) , sec_length) , 1); + model->iSecLast[i] = sub( imult1616( add( i, 1 ), sec_length ), 1 ); } - model->iSecLast[HRTF_MODEL_N_SECTIONS - 1] = sub(model->K , 1); /* Final section is longer if (K % nSec) > 0 */ + model->iSecLast[HRTF_MODEL_N_SECTIONS - 1] = sub( model->K, 1 ); /* Final section is longer if (K % nSec) > 0 */ maximum_fx( model->azimDim3, model->elevDim3, &model->azimDim3Max ); return; } @@ -1167,8 +1168,13 @@ void BSplineModelEvalDealloc( free( model->azimKSeq ); if ( modelEval != NULL ) { +#ifdef IVAS_FLOAT_FIXED + free( modelEval->hrfModL_fx ); + free( modelEval->hrfModR_fx ); +#else free( modelEval->hrfModL ); free( modelEval->hrfModR ); +#endif } } @@ -1183,6 +1189,7 @@ void BSplineModelEvalDealloc( * unordered (i.e. skip the n_smallest values, return the remainder). --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void SkipSmallest_ValueIndex( int16_t *use_inds, /* i/o: List of indices to use */ const ValueIndex_t *VI, /* i : List of value-index items */ @@ -1254,11 +1261,10 @@ static void SkipSmallest_ValueIndex( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void SkipSmallest_ValueIndex_fx( Word16 *use_inds, /* i/o: List of indices to use */ - const ValueIndex_t *VI, /* i : List of value-index items */ + const ValueIndex_t *VI, /* i : List of value-index items */ const Word16 N, /* i : Length of list */ const Word16 n_smallest /* i : Number of items to skip */ ) @@ -1273,7 +1279,7 @@ static void SkipSmallest_ValueIndex_fx( move32(); candidate_max_i = 0; move16(); - FOR ( j = 0; j < n_smallest; j++ ) + FOR( j = 0; j < n_smallest; j++ ) { skip_inds[j] = j; move16(); @@ -1289,9 +1295,9 @@ static void SkipSmallest_ValueIndex_fx( /* Look in the remainder of the list for smaller values */ FOR( i = n_smallest; i < N; i++ ) { - FOR ( j = 0; j < n_smallest; j++ ) + FOR( j = 0; j < n_smallest; j++ ) { - IF ( LT_32( VI[i].val_fx, VI[skip_inds[j]].val_fx ) ) + IF( LT_32( VI[i].val_fx, VI[skip_inds[j]].val_fx ) ) { /* Found a smaller value, so it goes into the list, replacing candidate_max. */ skip_inds[candidate_max_i] = i; @@ -1299,9 +1305,9 @@ static void SkipSmallest_ValueIndex_fx( candidate_max = VI[i].val_fx; move32(); /* Update candidate_max */ - FOR ( k = 0; k < n_smallest; k++ ) + FOR( k = 0; k < n_smallest; k++ ) { - IF ( GT_32( VI[skip_inds[k]].val_fx, candidate_max ) ) + IF( GT_32( VI[skip_inds[k]].val_fx, candidate_max ) ) { candidate_max = VI[skip_inds[k]].val_fx; move32(); @@ -1334,7 +1340,7 @@ static void SkipSmallest_ValueIndex_fx( { use_inds[k] = j; move16(); - k = add(k, 1); + k = add( k, 1 ); } } diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 3926c985b..1889939a1 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -638,59 +638,41 @@ ivas_error TDREND_MIX_AddSrc( #ifdef IVAS_FLOAT_FIXED static ivas_error BSplineModelEvalAlloc_fx( - ModelParams_t *model, /* i : Model parameters */ - ModelEval_t *modelEval /* i/o: Model evaluation structure */ -) -{ - IF((modelEval->hrfModL_fx = (Word32 *)malloc(model->K * sizeof(Word32))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n")); - } - - IF((modelEval->hrfModR_fx = (Word32 *)malloc(model->K * sizeof(Word32))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n")); - } - /*To be removed later: floating pointer memory allocation*/ - IF((modelEval->hrfModL = (float *)malloc(model->K * sizeof(float))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n")); - } - IF((modelEval->hrfModR = (float *)malloc(model->K * sizeof(float))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n")); - } - /*---------------------------------------------ends-here*/ - return IVAS_ERR_OK; -} -#endif -static ivas_error BSplineModelEvalAlloc( ModelParams_t *model, /* i : Model parameters */ ModelEval_t *modelEval /* i/o: Model evaluation structure */ ) { - if ( ( modelEval->hrfModL = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) + IF( ( modelEval->hrfModL_fx = (Word32 *) malloc( model->K * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } - if ( ( modelEval->hrfModR = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) + IF( ( modelEval->hrfModR_fx = (Word32 *) malloc( model->K * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - IF ( ( modelEval->hrfModL_fx = (Word32 *) malloc( model->K * sizeof(Word32) ) ) == NULL ) + + return IVAS_ERR_OK; +} +#else +static ivas_error BSplineModelEvalAlloc( + ModelParams_t *model, /* i : Model parameters */ + ModelEval_t *modelEval /* i/o: Model evaluation structure */ +) +{ + if ( ( modelEval->hrfModL = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } - IF ( ( modelEval->hrfModR_fx = (Word32 *) malloc( model->K * sizeof(Word32) ) ) == NULL ) + + if ( ( modelEval->hrfModR = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } -#endif // DEBUG return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -1050,7 +1032,7 @@ static ivas_error DefaultBSplineModel_fx( return IVAS_ERR_OK; } -#endif +#else static ivas_error DefaultBSplineModel( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* o : Loaded HR filter set */ const int32_t output_Fs /* i : Output sampling rate */ @@ -1114,26 +1096,13 @@ static ivas_error DefaultBSplineModel( /* float parameters */ model->elevKSeq = (const float *) defaultHRIR_rom_elevKSeq; model->elevBsShape = (const float *) defaultHRIR_rom_elevBsShape; -#ifdef IVAS_FLOAT_FIXED - model->elevKSeq_fx = defaultHRIR_rom_elevKSeq_fx; - model->elevBsShape_fx = defaultHRIR_rom_elevBsShape_fx; -#endif if ( ( model->azimBsShape = (const float **) malloc( model->num_unique_azim_splines * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - IF ( ( model->azimBsShape_fx = (const Word32 **) malloc( model->num_unique_azim_splines * sizeof(Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); - } -#endif // IVAS_FLOAT_FIXED model->azimBsShape[0] = (const float *) defaultHRIR_rom_azimBsShape; -#ifdef IVAS_FLOAT_FIXED - model->azimBsShape_fx[0] = defaultHRIR_rom_azimBsShape_fx; -#endif if ( ( model->azimKSeq = (float **) malloc( 18 * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); @@ -1146,30 +1115,10 @@ static ivas_error DefaultBSplineModel( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - IF ( ( model->azimKSeq_fx = (Word32 **) malloc( 18 * sizeof(Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); - } - IF ( ( model->azimKSeq_fx[0] = (Word32 *) malloc( 2 * sizeof(Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); - } - IF ( ( model->azimKSeq_fx[model->elevDim3 - 1] = (Word32 *) malloc( 2 * sizeof(Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); - } -#endif // IVAS_FLOAT_FIXED model->azimKSeq[0][0] = 0.0f; model->azimKSeq[model->elevDim3 - 1][0] = 0.0f; model->azimKSeq[0][1] = 360.0f; model->azimKSeq[model->elevDim3 - 1][1] = 360.0f; -#ifdef IVAS_FLOAT_FIXED - model->azimKSeq_fx[0][0] = 0; - model->azimKSeq_fx[model->elevDim3 - 1][0] = 0; - model->azimKSeq_fx[0][1] = 360<azimKSeq_fx[model->elevDim3 - 1][1] = 360<elevDim3 - 1; i++ ) { @@ -1177,22 +1126,10 @@ static ivas_error DefaultBSplineModel( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - IF ( ( model->azimKSeq_fx[i] = (Word32 *) malloc( model->azimDim2[i] * sizeof(Word32 * ) ) ) == NULL ) /* azimDim2[i] = 91, i=2..15 */ - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); - } -#endif for ( j = 0; j < model->azimDim2[i]; j++ ) { model->azimKSeq[i][j] = (float) defaultHRIR_rom_azimSegSamples[0] * j; } -#ifdef IVAS_FLOAT_FIXED - FOR ( j = 0; j < model->azimDim2[i]; j++ ) - { - model->azimKSeq_fx[i][j] = L_shl(L_mult0(defaultHRIR_rom_azimSegSamples[0], j), Q22); - } -#endif } switch ( output_Fs ) @@ -1202,27 +1139,10 @@ static ivas_error DefaultBSplineModel( model->AlphaR = (const float *) defaultHRIR_rom_AlphaR48; model->EL = (const float *) defaultHRIR_rom_EL48; model->ER = (const float *) defaultHRIR_rom_ER48; -#ifdef IVAS_FLOAT_FIXED - model->AlphaL_fx = (const Word32 *)defaultHRIR_rom_AlphaL48_fx; - model->AlphaL_e = 1; - move16(); - model->AlphaR_fx = (const Word32 *)defaultHRIR_rom_AlphaR48_fx; - model->AlphaR_e = 1; - move16(); - model->EL_fx = (const Word32 *)defaultHRIR_rom_EL48_fx; - model->EL_e = 3; - move16(); - model->ER_fx = (const Word32 *)defaultHRIR_rom_ER48_fx; - model->ER_e = 3; - move16(); -#endif model->K = 128; if ( HrFiltSet_p->ModelParams.UseItdModel ) { modelITD->resamp_factor = 1.0f; -#ifdef IVAS_FLOAT_FIXED - modelITD->resamp_factor_fx = ONE_IN_Q14; -#endif } break; case 32000: @@ -1230,27 +1150,10 @@ static ivas_error DefaultBSplineModel( model->AlphaR = (const float *) defaultHRIR_rom_AlphaR32; model->EL = (const float *) defaultHRIR_rom_EL32; model->ER = (const float *) defaultHRIR_rom_ER32; -#ifdef IVAS_FLOAT_FIXED - model->AlphaL_fx = (const Word32 *)defaultHRIR_rom_AlphaL32_fx; - model->AlphaL_e = 1; - move16(); - model->AlphaR_fx = (const Word32 *)defaultHRIR_rom_AlphaR32_fx; - model->AlphaR_e = 1; - move16(); - model->EL_fx = (const Word32 *)defaultHRIR_rom_EL32_fx; - model->EL_e = 3; - move16(); - model->ER_fx = (const Word32 *)defaultHRIR_rom_ER32_fx; - model->ER_e = 3; - move16(); -#endif model->K = 86; if ( HrFiltSet_p->ModelParams.UseItdModel ) { modelITD->resamp_factor = RESAMPLE_FACTOR_32_48; -#ifdef IVAS_FLOAT_FIXED - modelITD->resamp_factor_fx = RESAMPLE_FACTOR_32_48_FX; -#endif } break; case 16000: @@ -1258,27 +1161,10 @@ static ivas_error DefaultBSplineModel( model->AlphaR = (const float *) defaultHRIR_rom_AlphaR16; model->EL = (const float *) defaultHRIR_rom_EL16; model->ER = (const float *) defaultHRIR_rom_ER16; -#ifdef IVAS_FLOAT_FIXED - model->AlphaL_fx = (const Word32 *)defaultHRIR_rom_AlphaL16_fx; - model->AlphaL_e = 1; - move16(); - model->AlphaR_fx = (const Word32 *)defaultHRIR_rom_AlphaR16_fx; - model->AlphaR_e = 1; - move16(); - model->EL_fx = (const Word32 *)defaultHRIR_rom_EL16_fx; - model->EL_e = 3; - move16(); - model->ER_fx = (const Word32 *)defaultHRIR_rom_ER16_fx; - model->ER_e = 3; - move16(); -#endif model->K = 43; if ( HrFiltSet_p->ModelParams.UseItdModel ) { modelITD->resamp_factor = RESAMPLE_FACTOR_16_48; -#ifdef IVAS_FLOAT_FIXED - modelITD->resamp_factor_fx = RESAMPLE_FACTOR_16_48_FX; -#endif } break; default: @@ -1301,9 +1187,6 @@ static ivas_error DefaultBSplineModel( modelITD->elevBsStart[3] = 21; modelITD->elevKSeq = defaultHRIR_rom_ITD_elevKSeq; -#ifdef IVAS_FLOAT_FIXED - modelITD->elevKSeq_fx = defaultHRIR_rom_ITD_elevKSeq_fx; -#endif modelITD->azimBsLen[0] = 11; modelITD->azimBsLen[1] = 21; @@ -1317,19 +1200,9 @@ static ivas_error DefaultBSplineModel( modelITD->azimSegSamples = 10; modelITD->azimKSeq = defaultHRIR_rom_ITD_azimKSeq; -#ifdef IVAS_FLOAT_FIXED - modelITD->azimKSeq_fx = defaultHRIR_rom_ITD_azimKSeq_fx; -#endif modelITD->W = (const float *) defaultHRIR_rom_ITD_W; modelITD->azimBsShape = (const float *) defaultHRIR_rom_ITD_azimBsShape; modelITD->elevBsShape = (const float *) defaultHRIR_rom_ITD_elevBsShape; -#ifdef IVAS_FLOAT_FIXED - modelITD->W_fx = (const Word32 *)defaultHRIR_rom_ITD_W_fx;//Q25 - modelITD->W_e = 6; - move16(); - modelITD->azimBsShape_fx = defaultHRIR_rom_ITD_azimBsShape_fx; - modelITD->elevBsShape_fx = defaultHRIR_rom_ITD_elevBsShape_fx; -#endif HRTF_model_precalc( model ); @@ -1344,3 +1217,4 @@ static ivas_error DefaultBSplineModel( return IVAS_ERR_OK; } +#endif diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 130a1faa6..39347f1bf 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -399,6 +399,7 @@ static void TDREND_SRC_REND_Init( * Update the HR filter due to spatial change. --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ @@ -522,8 +523,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ @@ -562,17 +562,18 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( *filterlength = s_min( HrFiltSet_p->FiltLength, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - IF ( SrcSpatial_p->PosType == TDREND_POSTYPE_ABSOLUTE ) + IF( SrcSpatial_p->PosType == TDREND_POSTYPE_ABSOLUTE ) { /* Absolute position */ TDREND_SPATIAL_VecMapToNewCoordSystem_fx( SrcSpatial_p->Pos_p_fx, Listener_p->Pos_fx, Listener_p->Front_fx, Listener_p->Up_fx, Listener_p->Right_fx, ListRelPos, ListRelPosAbs ); ListRelPos_e = 62 - Q25 - Q30; // output q of above function is Q25 + Q30 - 31. so exp will be 62 - Q25 - Q30. move16(); - ListRelDist = TDREND_SPATIAL_VecNorm_fx( ListRelPos, ListRelPos_e, &ListRelDist_e); + ListRelDist = TDREND_SPATIAL_VecNorm_fx( ListRelPos, ListRelPos_e, &ListRelDist_e ); /* 2. Evaluate the Elevation and Azimuth angles */ - test(); test(); + test(); + test(); IF( ( ListRelPos[0] == 0 ) && ( ListRelPos[1] == 0 ) && ( ListRelPos[2] == 0 ) ) { Elev = 0; @@ -603,7 +604,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( /* Directional gain */ *SrcRend_p->DirGain_p_fx = ONE_IN_Q14; move16(); - IF ( SrcSpatial_p->DirAttenEnabled ) + IF( SrcSpatial_p->DirAttenEnabled ) { *SrcRend_p->DirGain_p_fx = TDREND_SRC_SPATIAL_GetDirGain_fx( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p_fx, ListRelPosAbs, 6 ); } @@ -611,128 +612,126 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( /* Distance gain */ *SrcRend_p->DistGain_p_fx = ONE_IN_Q14; move16(); - IF ( hBinRendererTd->UseCommonDistAttenModel ) + IF( hBinRendererTd->UseCommonDistAttenModel ) { - IF ( hBinRendererTd->DistAttenEnabled ) + IF( hBinRendererTd->DistAttenEnabled ) { SrcSpatial_p->DistAtten.DistAttenModel = hBinRendererTd->DistAttenModel; *SrcRend_p->DistGain_p_fx = TDREND_SRC_SPATIAL_GetDistGain_fx( &SrcSpatial_p->DistAtten, ListRelDist, ListRelDist_e ); } } - ELSE - { - IF ( SrcSpatial_p->DistAttenEnabled ) - { - *SrcRend_p->DistGain_p_fx = TDREND_SRC_SPATIAL_GetDistGain_fx( &SrcSpatial_p->DistAtten, ListRelDist, ListRelDist_e ); - } - } + ELSE{ + IF( SrcSpatial_p->DistAttenEnabled ){ + *SrcRend_p->DistGain_p_fx = TDREND_SRC_SPATIAL_GetDistGain_fx( &SrcSpatial_p->DistAtten, ListRelDist, ListRelDist_e ); + } +} - /* Update total gains */ - *Gain = extract_h( L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ) ); +/* Update total gains */ +*Gain = extract_h( L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ) ); - /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ +/* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ - elev_delta = L_sub( Elev, Src_p->elev_prev_fx ); - azim_delta = L_sub( Azim, Src_p->azim_prev_fx ); +elev_delta = L_sub( Elev, Src_p->elev_prev_fx ); +azim_delta = L_sub( Azim, Src_p->azim_prev_fx ); - Src_p->elev_prev_fx = Elev; - move32(); - Src_p->azim_prev_fx = Azim; - move32(); +Src_p->elev_prev_fx = Elev; +move32(); +Src_p->azim_prev_fx = Azim; +move32(); - /* map to -180:180 range */ - IF( GT_32( azim_delta, DEG_180_IN_Q22 ) ) - { - azim_delta = L_sub( azim_delta, DEG_360_IN_Q22 ); - } - ELSE IF( LT_32( azim_delta, -DEG_180_IN_Q22 ) ) - { - azim_delta = L_add( azim_delta, DEG_360_IN_Q22 ); - } - Word16 tmp1 = extract_l( Mpy_32_32( L_abs( azim_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 - Word16 tmp2 = extract_l( Mpy_32_32( L_abs( elev_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 - *intp_count = s_min( MAX_INTERPOLATION_STEPS, s_max( tmp1, tmp2 ) ); - } - ELSE /* TDREND_POSTYPE_NON_DIEGETIC */ - { - *itd = 0; - move16(); - *Gain = ONE_IN_Q14; - move16(); - set32_fx( hrf_left, 0, *filterlength ); - set32_fx( hrf_right, 0, *filterlength ); - hrf_left[0] = L_shr( L_add( SrcSpatial_p->Pos_p_fx[1], ONE_IN_Q25 ), 1 ); // Q25 - move32(); - hrf_right[0] = L_sub( ONE_IN_Q25, hrf_left[0] ); // Q25 - move32(); - hrf_left_e = 6; - move16(); - hrf_right_e = 6; - move16(); - *intp_count = MAX_INTERPOLATION_STEPS; - move16(); - Src_p->elev_prev_fx = 0; - move16(); - Src_p->azim_prev_fx = DEG_360_IN_Q22; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ - move16(); - } +/* map to -180:180 range */ +IF( GT_32( azim_delta, DEG_180_IN_Q22 ) ) +{ + azim_delta = L_sub( azim_delta, DEG_360_IN_Q22 ); +} +ELSE IF( LT_32( azim_delta, -DEG_180_IN_Q22 ) ) +{ + azim_delta = L_add( azim_delta, DEG_360_IN_Q22 ); +} +Word16 tmp1 = extract_l( Mpy_32_32( L_abs( azim_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 +Word16 tmp2 = extract_l( Mpy_32_32( L_abs( elev_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 +*intp_count = s_min( MAX_INTERPOLATION_STEPS, s_max( tmp1, tmp2 ) ); +} +ELSE /* TDREND_POSTYPE_NON_DIEGETIC */ +{ + *itd = 0; + move16(); + *Gain = ONE_IN_Q14; + move16(); + set32_fx( hrf_left, 0, *filterlength ); + set32_fx( hrf_right, 0, *filterlength ); + hrf_left[0] = L_shr( L_add( SrcSpatial_p->Pos_p_fx[1], ONE_IN_Q25 ), 1 ); // Q25 + move32(); + hrf_right[0] = L_sub( ONE_IN_Q25, hrf_left[0] ); // Q25 + move32(); + hrf_left_e = 6; + move16(); + hrf_right_e = 6; + move16(); + *intp_count = MAX_INTERPOLATION_STEPS; + move16(); + Src_p->elev_prev_fx = 0; + move16(); + Src_p->azim_prev_fx = DEG_360_IN_Q22; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ + move16(); +} - test(); - IF ( ( *intp_count > 0 ) && subframe_update_flag ) +test(); +IF( ( *intp_count > 0 ) && subframe_update_flag ) +{ + /* Set deltas for interpolation */ + Word16 tmp_e; + tmp_e = s_max( *hrf_left_prev_e, hrf_left_e ); + FOR( Word16 i = 0; i < *filterlength; i++ ) { - /* Set deltas for interpolation */ - Word16 tmp_e; - tmp_e = s_max( *hrf_left_prev_e, hrf_left_e ); - FOR( Word16 i = 0; i < *filterlength; i++ ) - { - hrf_left[i] = L_shr( hrf_left[i], sub( tmp_e, hrf_left_e ) ); - hrf_left_prev[i] = L_shr( hrf_left_prev[i], sub( tmp_e, *hrf_left_prev_e ) ); - } - *hrf_left_prev_e = tmp_e; - move16(); - hrf_left_e = tmp_e; - move16(); - v_sub_32( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); - *hrf_left_delta_e = tmp_e; - move16(); + hrf_left[i] = L_shr( hrf_left[i], sub( tmp_e, hrf_left_e ) ); + hrf_left_prev[i] = L_shr( hrf_left_prev[i], sub( tmp_e, *hrf_left_prev_e ) ); + } + *hrf_left_prev_e = tmp_e; + move16(); + hrf_left_e = tmp_e; + move16(); + v_sub_32( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); + *hrf_left_delta_e = tmp_e; + move16(); - Word32 fac = L_deposit_h( div_s( 1, *intp_count ) ); - v_multc_fixed( hrf_left_delta, fac, hrf_left_delta, *filterlength ); + Word32 fac = L_deposit_h( div_s( 1, *intp_count ) ); + v_multc_fixed( hrf_left_delta, fac, hrf_left_delta, *filterlength ); - tmp_e = s_max( *hrf_right_prev_e, hrf_right_e ); - FOR( Word16 i = 0; i < *filterlength; i++ ) - { - hrf_right[i] = L_shr( hrf_right[i], sub( tmp_e, hrf_right_e ) ); - hrf_right_prev[i] = L_shr( hrf_right_prev[i], sub( tmp_e, *hrf_right_prev_e ) ); - } - *hrf_right_prev_e = tmp_e; - move16(); - hrf_right_e = tmp_e; - move16(); - v_sub_32( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); - *hrf_right_delta_e = tmp_e; - move16(); - - v_multc_fixed( hrf_right_delta, fac, hrf_right_delta, *filterlength ); - } - ELSE + tmp_e = s_max( *hrf_right_prev_e, hrf_right_e ); + FOR( Word16 i = 0; i < *filterlength; i++ ) { - /* No interpolation, just set the new filters and reset deltas */ - Copy32( hrf_left, hrf_left_prev, *filterlength ); - *hrf_left_prev_e = hrf_left_e; - move16(); - Copy32( hrf_right, hrf_right_prev, *filterlength ); - *hrf_right_prev_e = hrf_right_e; - move16(); - set32_fx( hrf_left_delta, 0, *filterlength ); - set32_fx( hrf_right_delta, 0, *filterlength ); - *hrf_left_delta_e = 0; - move16(); - *hrf_right_delta_e = 0; - move16(); + hrf_right[i] = L_shr( hrf_right[i], sub( tmp_e, hrf_right_e ) ); + hrf_right_prev[i] = L_shr( hrf_right_prev[i], sub( tmp_e, *hrf_right_prev_e ) ); } + *hrf_right_prev_e = tmp_e; + move16(); + hrf_right_e = tmp_e; + move16(); + v_sub_32( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); + *hrf_right_delta_e = tmp_e; + move16(); - return; + v_multc_fixed( hrf_right_delta, fac, hrf_right_delta, *filterlength ); +} +ELSE +{ + /* No interpolation, just set the new filters and reset deltas */ + Copy32( hrf_left, hrf_left_prev, *filterlength ); + *hrf_left_prev_e = hrf_left_e; + move16(); + Copy32( hrf_right, hrf_right_prev, *filterlength ); + *hrf_right_prev_e = hrf_right_e; + move16(); + set32_fx( hrf_left_delta, 0, *filterlength ); + set32_fx( hrf_right_delta, 0, *filterlength ); + *hrf_left_delta_e = 0; + move16(); + *hrf_right_delta_e = 0; + move16(); +} + +return; } #endif @@ -847,7 +846,7 @@ static void TDREND_SRC_SPATIAL_Init_fx( move32(); SrcSpatial_p->DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ move32(); - SrcSpatial_p->DistAtten.RollOffFactor_fx = ONE_IN_Q14; + SrcSpatial_p->DistAtten.RollOffFactor_fx = ONE_IN_Q30; move16(); return; @@ -898,15 +897,16 @@ static void TDREND_SRC_SPATIAL_Init( /* Source distance attenuation */ SrcSpatial_p->DistAttenEnabled = FALSE; SrcSpatial_p->DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; +#ifndef IVAS_FLOAT_FIXED SrcSpatial_p->DistAtten.RefDist = 1.0f; SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; -#ifdef IVAS_FLOAT_FIXED +#else SrcSpatial_p->DistAtten.RefDist_fx = ONE_IN_Q30; move32(); SrcSpatial_p->DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ move32(); - SrcSpatial_p->DistAtten.RollOffFactor_fx = ONE_IN_Q14; + SrcSpatial_p->DistAtten.RollOffFactor_fx = ONE_IN_Q30; move16(); #endif @@ -1098,6 +1098,7 @@ static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( /* o : Directional Gain Output --------------------------------------------------------------------*/ /*! r: Gain value */ +#ifndef IVAS_FLOAT_FIXED static float TDREND_SRC_SPATIAL_GetDistGain( const TDREND_DistAtten_t *DistAtten_p, /* i : Distance attenuation parameters */ const float Dist /* i : Distance value */ @@ -1132,8 +1133,7 @@ static float TDREND_SRC_SPATIAL_GetDistGain( return DistGain; } - -#ifdef IVAS_FLOAT_FIXED +#else static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( /* o : Distance gain Q14 */ const TDREND_DistAtten_t *DistAtten_p, /* i : Distance attenuation parameters */ const Word32 Dist_fx, /* i : Distance value */ @@ -1161,7 +1161,7 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( /* o : Distance gain { case TDREND_DIST_ATTEN_MODEL_INV_DIST: tmp32 = BASOP_Util_Add_Mant32Exp( Dist2_fx, Dist2_e, L_negate( DistAtten_p->RefDist_fx ), 1, &tmp_e ); // exp: tmp_e - tmp32 = Mpy_32_32( tmp32, DistAtten_p->RefDist_fx ); // exp: 1 + tmp_e + tmp32 = Mpy_32_32( tmp32, DistAtten_p->RollOffFactor_fx ); // exp: 1 + tmp_e tmp32 = BASOP_Util_Add_Mant32Exp( DistAtten_p->RefDist_fx, 1, tmp32, add( 1, tmp_e ), &tmp_e ); // exp: tmp_e DistGain_fx = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, tmp32, &DistGain_e ); DistGain_e = add( DistGain_e, sub( 1, tmp_e ) ); @@ -1185,7 +1185,7 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( /* o : Distance gain move16(); } tmp32 = BASOP_Util_Add_Mant32Exp( Dist2_fx, Dist2_e, L_negate( DistAtten_p->RefDist_fx ), 1, &tmp_e ); // exp: tmp_e - tmp32 = Mpy_32_32( tmp32, DistAtten_p->RefDist_fx ); // exp: 1 + tmp_e + tmp32 = Mpy_32_32( tmp32, DistAtten_p->RollOffFactor_fx ); // exp: 1 + tmp_e tmp32 = BASOP_Util_Add_Mant32Exp( DistAtten_p->RefDist_fx, 1, tmp32, add( 1, tmp_e ), &tmp_e ); // exp: tmp_e DistGain_fx = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, tmp32, &DistGain_e ); DistGain_e = add( DistGain_e, sub( 1, tmp_e ) ); @@ -1193,7 +1193,7 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( /* o : Distance gain BREAK; } - DistGain_fx = shr( DistGain_fx, 1 - DistGain_e ); // Reducing it to Q14 + DistGain_fx = shr( DistGain_fx, 1 - DistGain_e ); // Reducing it to Q14 return DistGain_fx; } diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index a6d08f15b..21873782f 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -1115,16 +1115,15 @@ ivas_error ivas_orient_trk_SetReferenceRotation_fx( } /* check for Euler angle signaling */ - // This part is not covered in code coverage for test streams// - /* if ( refRot.w == -3.0f ) - { - Euler2Quat( deg2rad( refRot.x ), deg2rad( refRot.y ), deg2rad( refRot.z ), &pOTR->refRot ); - }*/ + IF( EQ_32( refRot.w_fx, -1610612736 /* -3.0f in Q29 */ ) ) + { + Euler2Quat_fx( deg2rad_fx( refRot.x_fx ), deg2rad_fx( refRot.y_fx ), deg2rad_fx( refRot.z_fx ), &pOTR->refRot ); + } pOTR->refRot = refRot; return IVAS_ERR_OK; } -#endif +#else ivas_error ivas_orient_trk_SetReferenceRotation( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ @@ -1148,7 +1147,7 @@ ivas_error ivas_orient_trk_SetReferenceRotation( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------* * ivas_orient_trk_GetMainOrientation() diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 866bd05a5..ec03c0ead 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -212,41 +212,43 @@ void ivas_td_decorr_APD_iir_filter_fx( * Amplitude Panning EFAP prototypes *----------------------------------------------------------------------------------*/ -ivas_error efap_init_data( - EFAP_HANDLE *hEFAPdata, /* i/o: handle for EFAP data structure that will be initialized */ - const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ - const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ - const int16_t num_speaker_nodes, /* i : number of speaker nodes in the set */ - const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ -); #ifdef IVAS_FLOAT_FIXED -ivas_error efap_init_data_fixed( +ivas_error efap_init_data_fx( EFAP_HANDLE *hEFAPdata, /* i/o: handle for EFAP data structure that will be initialized */ const Word32 *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ const Word32 *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ const Word16 num_speaker_nodes, /* i : number of speaker nodes in the set */ const Word16 efap_mode /* i : indicates whether EFAP or EFIP is used */ ); +#else +ivas_error efap_init_data( + EFAP_HANDLE *hEFAPdata, /* i/o: handle for EFAP data structure that will be initialized */ + const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ + const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ + const int16_t num_speaker_nodes, /* i : number of speaker nodes in the set */ + const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ +); #endif void efap_free_data( EFAP_HANDLE *hEFAPdata /* i/o: EFAP handle to be freed */ ); -void efap_determine_gains( - EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - float *gains, /* o : gain vector for speaker nodes for given direction */ - const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ - const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ - const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ -); #ifdef IVAS_FLOAT_FIXED -void efap_determine_gains_fixed( +void efap_determine_gains_fx( EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ Word32 *gains, /* o : gain vector for speaker nodes for given direction */ const Word32 azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ const Word32 ele_deg, /* i : elevation in degrees for panning direction (positive up) */ const Word16 efap_mode /* i : indicates whether EFAP or EFIP is used */ ); +#else +void efap_determine_gains( + EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + float *gains, /* o : gain vector for speaker nodes for given direction */ + const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ + const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ + const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ +); #endif /*----------------------------------------------------------------------------------* * Amplitude Panning VBAP prototypes @@ -319,7 +321,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( const Word16 ambisonics_order /* i : Ambisonics order */ ); #else -ivas_error ivas_sba_get_hoa_dec_matrix( +ivas_error ivas_sba_get_hoa_dec_matrix_fx( const IVAS_OUTPUT_SETUP hOutSetup, /* i : target output setup */ Word32 **hoa_dec_mtx, /* o : ALLRAD decoder matrix */ const Word16 ambisonics_order /* i : Ambisonics order */ @@ -812,7 +814,26 @@ void ivas_dirac_dec_output_synthesis_close_fx( void ivas_dirac_dec_output_synthesis_close( DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ ); - +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_dec_output_synthesis_process_slot_fx( + const Word32 *reference_power, /* i : Estimated power */ + const Word16 q_reference_power, /* i : Estimated power */ + const Word32 *onset, /* i : onset filter */ + const Word16 *azimuth, + const Word16 *elevation, + const Word32 *diffuseness, + Word16 q_diffuseness, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const Word16 sh_rot_max_order, + const Word32 *p_Rmat, /* i : rotation matrix */ + const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ + const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ + const Word16 nchan_transport, /* i : number of transport channels*/ + const Word16 md_idx, + const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const Word16 dec_param_estim); +#endif void ivas_dirac_dec_output_synthesis_process_slot( const float *reference_power, /* i : Estimated power */ const float *onset, /* i : onset filter */ @@ -1027,10 +1048,25 @@ void ivas_masa_ext_dirac_render( const int16_t num_subframes /* i : number of subframes to render */ ); +void ivas_masa_ext_dirac_render_fx( + MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ + Word32 *output_f[], /* i/o: input/output signals in time domain */ + const Word16 num_subframes /* i : number of subframes to render */ +); + /*----------------------------------------------------------------------------------* * HRTF *----------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_HRTF_binary_open_fx( + TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ +); + +void ivas_HRTF_binary_close_fx( + TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ +); +#else ivas_error ivas_HRTF_binary_open( TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ ); @@ -1038,11 +1074,33 @@ ivas_error ivas_HRTF_binary_open( void ivas_HRTF_binary_close( TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ ); +#endif ivas_error ivas_HRTF_fastconv_binary_open( HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_HRTF_fastconv_binary_close_fx( + HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ +); + +ivas_error ivas_HRTF_parambin_binary_open_fx( + HRTFS_PARAMBIN **hHrtfParambin /* i/o: Parametric binauralizer HRTF structure */ +); + +void ivas_HRTF_parambin_binary_close_fx( + HRTFS_PARAMBIN **hHrtfParambin /* i/o: Parametric binauralizer HRTF structure */ +); + +ivas_error ivas_HRTF_CRend_binary_open_fx( + HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ +); + +void ivas_HRTF_CRend_binary_close_fx( + HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ +); +#else void ivas_HRTF_fastconv_binary_close( HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ ); @@ -1062,6 +1120,7 @@ ivas_error ivas_HRTF_CRend_binary_open( void ivas_HRTF_CRend_binary_close( HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ ); +#endif /*----------------------------------------------------------------------------------* @@ -1197,6 +1256,7 @@ void BSplineModelEvalDealloc( /* ----- Object renderer - hrfilt ----- */ +#ifndef IVAS_FLOAT_FIXED void GetFilterFromAngle( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const float Elev, /* i : Elevation, degrees */ @@ -1206,8 +1266,7 @@ void GetFilterFromAngle( float *RightFilter, /* o : Right HR filter */ int16_t *itd /* o : ITD value */ ); - -#ifdef IVAS_FLOAT_FIXED +#else void GetFilterFromAngle_fx( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ const Word32 Elev_fx, /* i : Elevation, degrees Q22 */ @@ -1225,14 +1284,6 @@ void HRTF_model_precalc( ModelParams_t *model /* i/o: HRTF Model parameters */ ); -ivas_error TDREND_REND_RenderSourceHRFilt( - TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ - const float *hrf_left_delta, /* i : Left filter interpolation delta */ - const float *hrf_right_delta, /* i : Right filter interpolation delta */ - const int16_t intp_count, /* i : Interpolation count */ - float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ - const int16_t subframe_length /* i : Subframe length in use */ -); #ifdef IVAS_FLOAT_FIXED ivas_error TDREND_REND_RenderSourceHRFilt_fx( TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ @@ -1244,6 +1295,15 @@ ivas_error TDREND_REND_RenderSourceHRFilt_fx( Word32 output_buf_fx[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ const Word16 subframe_length /* i : Subframe length in use */ ); +#else +ivas_error TDREND_REND_RenderSourceHRFilt( + TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ + const float *hrf_left_delta, /* i : Left filter interpolation delta */ + const float *hrf_right_delta, /* i : Right filter interpolation delta */ + const int16_t intp_count, /* i : Interpolation count */ + float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ + const int16_t subframe_length /* i : Subframe length in use */ +); #endif /* ----- Object renderer - sources ----- */ @@ -1299,6 +1359,7 @@ ivas_error TDREND_MIX_SRC_SetPlayState( ); #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ @@ -1314,7 +1375,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( TDREND_SRC_t *Src_p, const int16_t subframe_update_flag /* i : Flag to determine update subframe idx */ ); -#ifdef IVAS_FLOAT_FIXED +#else void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ @@ -2140,7 +2201,14 @@ void Euler2Quat( const float roll, /* i : roll (z) */ IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ); - +#ifdef IVAS_FLOAT_FIXED +void Euler2Quat_fx( + const Word32 yaw, /* i : yaw (x) Q22 */ + const Word32 pitch, /* i : pitch (y) Q22 */ + const Word32 roll, /* i : roll (z) Q22 */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ +); +#endif float deg2rad( float degrees ); @@ -2583,12 +2651,20 @@ void ivas_create_masa_out_meta( float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : Estimated surround coherence */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_dirac_ana_open_fx( + DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ + Word32 input_Fs +); +#else ivas_error ivas_dirac_ana_open( DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ int32_t input_Fs ); +#endif + #ifdef IVAS_FLOAT_FIXED -void ivas_dirac_ana( +void ivas_dirac_ana_fx( DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ Word32 data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ const Word16 input_frame, /* i : Input frame size */ @@ -2602,9 +2678,16 @@ void ivas_dirac_ana( const int16_t nchan_transport /* i : Number of transport channels */ ); #endif + +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_ana_close_fx( + DIRAC_ANA_HANDLE ( *hDirAC ) /* i/o: analysis DIRAC handle */ +); +#else void ivas_dirac_ana_close( DIRAC_ANA_HANDLE ( *hDirAC ) /* i/o: analysis DIRAC handle */ ); +#endif void ivas_prerend_merge_masa_metadata( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index fcd93b3ac..7a9db2c79 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -318,7 +318,7 @@ void QuatToRotMat( return; } - +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * Euler2Quat() * @@ -345,6 +345,29 @@ void Euler2Quat( return; } +#else + +void Euler2Quat_fx( + const Word32 yaw, /* i : yaw (x) */ + const Word32 pitch, /* i : pitch (y) */ + const Word32 roll, /* i : roll (z) */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ +) +{ + Word16 cr = getCosWord16( extract_l( L_shr_r( roll, 10 ) ) ); + Word16 sr = getSinWord16( extract_l( L_shr_r( roll, 10 ) ) ); + Word16 cp = getCosWord16( extract_l( L_shr_r( pitch, 10 ) ) ); + Word16 sp = getSinWord16( extract_l( L_shr_r( pitch, 10 ) ) ); + Word16 cy = getCosWord16( extract_l( L_shr_r( yaw, 10 ) ) ); + Word16 sy = getSinWord16( extract_l( L_shr_r( yaw, 10 ) ) ); + quat->w_fx = L_shr_r( L_add( Mpy_32_16_1( L_mult0( cr, cp ), cy ), Mpy_32_16_1( L_mult0( sr, sp ), sy ) ), 5 ); + quat->x_fx = L_shr_r( L_sub( Mpy_32_16_1( L_mult0( sr, cp ), cy ), Mpy_32_16_1( L_mult0( cr, sp ), sy ) ), 5 ); + quat->y_fx = L_shr_r( L_add( Mpy_32_16_1( L_mult0( sr, cp ), sy ), Mpy_32_16_1( L_mult0( cr, sp ), cy ) ), 5 ); + quat->z_fx = L_shr_r( L_sub( Mpy_32_16_1( L_mult0( cr, cp ), sy ), Mpy_32_16_1( L_mult0( sr, sp ), cy ) ), 5 ); + + return; +} +#endif /*------------------------------------------------------------------------- @@ -965,7 +988,7 @@ void rotateFrame_sd( { azimuth_fx = (Word32) azimuth * ONE_IN_Q22; elevation_fx = (Word32) elevation * ONE_IN_Q22; - efap_determine_gains_fixed( hEFAPdata, tmp_gains_fx, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); + efap_determine_gains_fx( hEFAPdata, tmp_gains_fx, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); FOR( ch_out = 0; ch_out < nchan; ch_out++ ) @@ -990,7 +1013,7 @@ void rotateFrame_sd( azimuth_fx = (Word32) azimuth * ONE_IN_Q22; elevation_fx = (Word32) elevation * ONE_IN_Q22; - efap_determine_gains_fixed( hEFAPdata, tmp_gains_fx, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); + efap_determine_gains_fx( hEFAPdata, tmp_gains_fx, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); FOR( ch_out = 0; ch_out < nchan; ch_out++ ) { @@ -1528,7 +1551,7 @@ void rotateFrame_sd_cldfb_fixed( IF( hEFAPdata != NULL && ( hOutputSetup->ls_azimuth[n] != azimuth || hOutputSetup->ls_elevation[n] != elevation ) ) { // efap_determine_gains( hEFAPdata, gains[n], azimuth, elevation, EFAP_MODE_EFAP ); - efap_determine_gains_fixed( hEFAPdata, gains_fx[n], L_shl( azimuth, Q22 ), L_shl( elevation, Q22 ), EFAP_MODE_EFAP ); + efap_determine_gains_fx( hEFAPdata, gains_fx[n], L_shl( azimuth, Q22 ), L_shl( elevation, Q22 ), EFAP_MODE_EFAP ); } ELSE { @@ -1633,7 +1656,6 @@ ivas_error ivas_external_orientation_open( * * Deallocate external orientation handle *-----------------------------------------------------------------------*/ - #ifdef IVAS_FLOAT_FIXED void ivas_external_orientation_close( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* i/o: external orientation handle */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 677ca58fe..ece1d6785 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1165,57 +1165,43 @@ typedef struct ivas_combined_orientation_struct typedef struct _IVAS_RENDER_CONFIG RENDER_CONFIG_DATA; typedef struct _IVAS_RENDER_CONFIG *RENDER_CONFIG_HANDLE; -#ifdef IVAS_FLOAT_FIXED -typedef struct ivas_rev_delay_line_t -{ - //float *pBuffer; - Word32 *pBuffer_fx; - UWord16 MaxDelay; - Word16 Delay; - UWord16 BufferPos; - Word16 Gain_fx; -} ivas_rev_delay_line_t; -#else typedef struct ivas_rev_delay_line_t { +#ifndef IVAS_FLOAT_FIXED float *pBuffer; +#else + Word32 *pBuffer_fx; +#endif uint16_t MaxDelay; int16_t Delay; uint16_t BufferPos; +#ifndef IVAS_FLOAT_FIXED float Gain; +#else + Word16 Gain_fx; +#endif } ivas_rev_delay_line_t; -#endif -#ifdef IVAS_FLOAT_FIXED -typedef struct ivas_rev_iir_filter_t -{ - uint16_t MaxTaps; - uint16_t nr_taps; - uint16_t isFIR; - //float Output; - Word32 Output_fx; - float CoefA[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - Word32 CoefA_fx[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - float CoefB[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - Word32 CoefB_fx[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - // float pBuffer[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - Word32 pBuffer_fx[IVAS_REV_MAX_IIR_FILTER_LENGTH]; -} ivas_rev_iir_filter_t; -#else typedef struct ivas_rev_iir_filter_t { uint16_t MaxTaps; uint16_t nr_taps; uint16_t isFIR; +#ifndef IVAS_FLOAT_FIXED float Output; float CoefA[IVAS_REV_MAX_IIR_FILTER_LENGTH]; float CoefB[IVAS_REV_MAX_IIR_FILTER_LENGTH]; float pBuffer[IVAS_REV_MAX_IIR_FILTER_LENGTH]; +#else + Word32 Output_fx; + Word32 CoefA_fx[IVAS_REV_MAX_IIR_FILTER_LENGTH]; /* Q30 */ + Word32 CoefB_fx[IVAS_REV_MAX_IIR_FILTER_LENGTH]; /* Q30 */ + Word32 pBuffer_fx[IVAS_REV_MAX_IIR_FILTER_LENGTH]; +#endif } ivas_rev_iir_filter_t; -#endif typedef float rv_fftwf_type_complex[2]; /* complex type of fftwf library */ #ifdef IVAS_FLOAT_FIXED @@ -1600,36 +1586,34 @@ typedef struct /* Shared memory for use when evaluating BSpline HR filter model*/ typedef struct { -#ifdef IVAS_FLOAT_FIXED - Word32 *hrfModL_fx; - Word32 *hrfModR_fx; - Word16 hrfModL_e; - Word16 hrfModR_e; -#endif +#ifndef IVAS_FLOAT_FIXED float BM[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; -#ifdef IVAS_FLOAT_FIXED +#else Word32 BM_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; // Q30 #endif ValueIndex_t BMEnergiesL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; ValueIndex_t BMEnergiesR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; int16_t UseIndsL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; int16_t UseIndsR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; +#ifndef IVAS_FLOAT_FIXED float *hrfModL; float *hrfModR; -#ifdef IVAS_FLOAT_FIXED - Word32 elevBfVec_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 - Word32 azimBfVec_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS][HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 -#endif float elevBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS]; float azimBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS][HRTF_MODEL_BSPLINE_NUM_COEFFS]; float BM_ITD[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; float elevBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; float azimBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; float itdMod; -#ifdef IVAS_FLOAT_FIXED - Word32 BM_ITD_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; // Q30 - Word32 elevBfVecITD_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 - Word32 azimBfVecITD_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 +#else + Word32 *hrfModL_fx; + Word32 *hrfModR_fx; + Word16 hrfModL_e; + Word16 hrfModR_e; + Word32 elevBfVec_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 + Word32 azimBfVec_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS][HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 + Word32 BM_ITD_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; // Q30 + Word32 elevBfVecITD_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 + Word32 azimBfVecITD_fx[HRTF_MODEL_BSPLINE_NUM_COEFFS]; // Q30 Word32 itdMod_fx; #endif @@ -1693,13 +1677,14 @@ typedef struct TDREND_HRFILT_FiltSet_struct typedef struct { TDREND_DistAttenModel_t DistAttenModel; +#ifndef IVAS_FLOAT_FIXED float RefDist; float MaxDist; float RollOffFactor; -#ifdef IVAS_FLOAT_FIXED - Word32 RefDist_fx; - Word32 MaxDist_fx; - Word32 RollOffFactor_fx; // Q30 +#else + Word32 RefDist_fx; /* Q30 */ + Word32 MaxDist_fx; /* Q27 */ + Word32 RollOffFactor_fx; /* Q30 */ #endif // IVAS_FLOAT_FIXED } TDREND_DistAtten_t; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3b93eaf6e..98730d630 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -190,13 +190,13 @@ typedef struct { Word16 numLfeChannels; bool pan_lfe; - float lfeInputGain; + //float lfeInputGain; Word32 lfeInputGain_fx; - float lfeOutputAzimuth; + //float lfeOutputAzimuth; Word16 lfeOutputAzimuth_fx; - float lfeOutputElevation; + //float lfeOutputElevation; Word16 lfeOutputElevation_fx; - IVAS_REND_LfePanMtx lfePanMtx; + //IVAS_REND_LfePanMtx lfePanMtx; IVAS_REND_LfePanMtx_fx lfePanMtx_fx; } lfe_routing; #else @@ -1586,7 +1586,84 @@ static ivas_error getMcConfigValues( return IVAS_ERR_OK; } +#ifdef IVAS_FLOAT_FIXED +static ivas_error initEfap( + EFAP_WRAPPER *pEfapWrapper, + AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) +{ + ivas_error error; + const float *azimuths; + const float *elevations; + /*To be replaced with pointers*/ + Word32 azimuths_fx[MAX_OUTPUT_CHANNELS]; + Word32 elevations_fx[MAX_OUTPUT_CHANNELS]; + int16_t numNonLfeChannels; + + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; + } + else + { + pEfapWrapper->speakerConfig = outConfig; + } + pEfapWrapper->pCustomLsSetup = pCustomLsOut; + + /* If re-initializing, free existing EFAP handle. */ + if ( pEfapWrapper->hEfap != NULL ) + { + efap_free_data( &pEfapWrapper->hEfap ); + } + + /* Only initialize EFAP handle if output config is channel-based */ + if ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + pEfapWrapper->hEfap = NULL; + return IVAS_ERR_OK; + } + + if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + /*float2fix block: to be removed*/ + floatToFixed_arrL( (float *) pCustomLsOut->ls_azimuth, (Word32 *) pCustomLsOut->ls_azimuth_fx, Q22, pCustomLsOut->num_spk ); + floatToFixed_arrL( (float *) pCustomLsOut->ls_elevation, (Word32 *) pCustomLsOut->ls_elevation_fx, Q22, pCustomLsOut->num_spk ); + /*float2fix block end*/ + if ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth_fx, pCustomLsOut->ls_elevation_fx, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*float2fix block: to be removed*/ + floatToFixed_arrL( (float *) azimuths, azimuths_fx, Q22, numNonLfeChannels ); + floatToFixed_arrL( (float *) elevations, elevations_fx, Q22, numNonLfeChannels ); + /*float2fix block end*/ + if ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths_fx, elevations_fx, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + return IVAS_ERR_OK; +} +#else static ivas_error initEfap( EFAP_WRAPPER *pEfapWrapper, AUDIO_CONFIG outConfig, @@ -1652,6 +1729,7 @@ static ivas_error initEfap( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error getEfapGains_fx( @@ -1668,7 +1746,7 @@ static ivas_error getEfapGains_fx( ivas_error error; /* EFAP returns an array of gains only for non-LFE speakers */ - efap_determine_gains_fixed( efapWrapper.hEfap, tmpPanGains, azi, ele, EFAP_MODE_EFAP ); + efap_determine_gains_fx( efapWrapper.hEfap, tmpPanGains, azi, ele, EFAP_MODE_EFAP ); /* Now copy to buffer that includes LFE channels */ IF( EQ_32( efapWrapper.speakerConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) @@ -1722,6 +1800,74 @@ static ivas_error getEfapGains_fx( return IVAS_ERR_OK; } #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error getEfapGains( + EFAP_WRAPPER efapWrapper, + const float azi, + const float ele, + pan_vector panGains ) +{ + pan_vector tmpPanGains; /* tmp pan gain buffer without LFE channels */ + pan_vector_fx tmpPanGains_fx; /* tmp pan gain buffer without LFE channels */ + float *readPtr; + int16_t i; + int16_t lfeCount; + int16_t numChannels; + ivas_error error; + + /* EFAP returns an array of gains only for non-LFE speakers */ + efap_determine_gains_fx( efapWrapper.hEfap, tmpPanGains_fx, floatToFixed( azi, Q22 ), floatToFixed( ele, Q22 ), EFAP_MODE_EFAP ); + /* float2fix to be removed */ + + /*fix2float: to be removed*/ + fixedToFloat_arrL(tmpPanGains_fx, tmpPanGains, Q30, efapWrapper.hEfap->numSpk); + + /* Now copy to buffer that includes LFE channels */ + if ( efapWrapper.speakerConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + numChannels = efapWrapper.pCustomLsSetup->num_spk + efapWrapper.pCustomLsSetup->num_lfe; + readPtr = tmpPanGains; + + for ( i = 0, lfeCount = 0; i < numChannels; ++i ) + { + if ( lfeCount < efapWrapper.pCustomLsSetup->num_lfe && i == efapWrapper.pCustomLsSetup->lfe_idx[lfeCount] ) + { + panGains[i] = 0.0f; + ++lfeCount; + } + else + { + panGains[i] = *readPtr; + ++readPtr; + } + } + } + else + { + if ( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + + readPtr = tmpPanGains; + + for ( i = 0; i < numChannels; ++i ) + { + if ( i == LFE_CHANNEL ) + { + panGains[i] = 0.0f; + } + else + { + panGains[i] = *readPtr; + ++readPtr; + } + } + } + + return IVAS_ERR_OK; +} +#else static ivas_error getEfapGains( EFAP_WRAPPER efapWrapper, const float azi, @@ -1783,6 +1929,7 @@ static ivas_error getEfapGains( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error initHeadRotation_fx( @@ -4135,7 +4282,7 @@ static void clearInputMc( return; } #endif - +#ifdef IVAS_FLOAT_FIXED static ivas_error initSbaPanGainsForMcOut( input_sba *inputSba, const AUDIO_CONFIG outConfig, @@ -4187,7 +4334,7 @@ static ivas_error initSbaPanGainsForMcOut( /* obtain and copy over HOA decoding matrix */ tmpDecMtx = NULL; - if ( ( error = ivas_sba_get_hoa_dec_matrix( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) { return error; } @@ -4213,6 +4360,77 @@ static ivas_error initSbaPanGainsForMcOut( return IVAS_ERR_OK; } +#else +static ivas_error initSbaPanGainsForMcOut( + input_sba *inputSba, + const AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) +{ + int16_t ambiOrderIn; + int16_t chInIdx, chOutIdx; + float *tmpDecMtx, *readPtr; + IVAS_OUTPUT_SETUP hOutSetup; + ivas_error error; + + if ( ( error = getAmbisonicsOrder( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + assert( !"Invalid configuration" ); + return IVAS_ERR_WRONG_PARAMS; + } + + switch ( outConfig ) + { + case IVAS_AUDIO_CONFIG_MONO: + hOutSetup.ls_azimuth = ls_azimuth_CICP1; + hOutSetup.ls_elevation = ls_elevation_CICP1; + ivas_output_init( &hOutSetup, outConfig ); + break; + case IVAS_AUDIO_CONFIG_STEREO: + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1_4: + ivas_output_init( &hOutSetup, outConfig ); + break; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); + break; + default: + assert( !"Invalid speaker config" ); + return IVAS_ERR_WRONG_PARAMS; + } + + /* obtain and copy over HOA decoding matrix */ + tmpDecMtx = NULL; + if ( ( error = ivas_sba_get_hoa_dec_matrix( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + { + return error; + } + + readPtr = &tmpDecMtx[0]; + for ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) + { + for ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) + { + if ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) + { + continue; /* nothing to be rendered to LFE */ + } + inputSba->hoaDecMtx[chInIdx][chOutIdx] = *readPtr++; + } + } + + free( tmpDecMtx ); + + return IVAS_ERR_OK; +} +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error initSbaPanGainsForSbaOut( @@ -4423,6 +4641,7 @@ static ivas_error updateSbaPanGains( } #endif + static ivas_error initSbaMasaRendering( input_sba *inputSba, int32_t inSampleRate ) @@ -4431,14 +4650,22 @@ static ivas_error initSbaMasaRendering( ivas_rend_closeCrend( &inputSba->crendWrapper ); +#ifdef IVAS_FLOAT_FIXED + IF ( ( error = ivas_dirac_ana_open_fx( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { return error; } +#endif return IVAS_ERR_OK; } + #ifdef IVAS_FLOAT_FIXED static ivas_error setRendInputActiveSba( void *input, @@ -4559,7 +4786,7 @@ static void clearInputSba( /* Free input's internal handles */ ivas_rend_closeCrend( &inputSba->crendWrapper ); - ivas_dirac_ana_close( &( inputSba->hDirAC ) ); + ivas_dirac_ana_close_fx( &( inputSba->hDirAC ) ); return; } @@ -5521,7 +5748,7 @@ static ivas_error getConstInputById( } #endif - +#ifndef IVAS_FLOAT_FIXED static ivas_error findFreeInputSlot( const void *inputs, const int32_t inputStructSize, @@ -5562,6 +5789,48 @@ static ivas_error findFreeInputSlot( return IVAS_ERR_OK; } +#else +static ivas_error findFreeInputSlot_fx( + const void *inputs, + const Word32 inputStructSize, + const Word32 maxInputs, + Word32 *inputIndex ) +{ + /* Using a void pointer and a separately provided size is a hack for this function + to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). + Assumptions: + - input_base is always the first member in the input struct + - provided size is correct + */ + + Word32 i; + bool canAddInput; + const UWord8 *pByte; + const input_base *pInputBase; + + canAddInput = false; + + /* Find first unused input in array */ + FOR( ( i = 0, pByte = inputs ); i < maxInputs; ( ++i, pByte += inputStructSize ) ) + { + pInputBase = (const input_base *) pByte; + + IF( EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + *inputIndex = i; + canAddInput = true; + BREAK; + } + } + + IF ( !canAddInput ) + { + return IVAS_ERR_TOO_MANY_INPUTS; + } + + return IVAS_ERR_OK; +} +#endif /*-------------------------------------------------------------------* @@ -5569,7 +5838,7 @@ static ivas_error findFreeInputSlot( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_AddInput( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ @@ -5635,10 +5904,77 @@ ivas_error IVAS_REND_AddInput( return IVAS_ERR_OK; } - - -/*-------------------------------------------------------------------* - * IVAS_REND_ConfigureCustomInputLoudspeakerLayout() +#else +ivas_error IVAS_REND_AddInput_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ + IVAS_REND_InputId *inputId /* o : ID of the new input */ +) +{ + ivas_error error; + Word32 maxNumInputsOfType; + void *inputsArray; + Word32 inputStructSize; + ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); + Word32 inputIndex; + + /* Validate function arguments */ + IF ( hIvasRend == NULL || inputId == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + + SWITCH ( getAudioConfigType( inConfig ) ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; + inputsArray = hIvasRend->inputsIsm; + inputStructSize = sizeof( *hIvasRend->inputsIsm ); + activateInput = setRendInputActiveIsm; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; + inputsArray = hIvasRend->inputsMc; + inputStructSize = sizeof( *hIvasRend->inputsMc ); + activateInput = setRendInputActiveMc; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; + inputsArray = hIvasRend->inputsSba; + inputStructSize = sizeof( *hIvasRend->inputsSba ); + activateInput = setRendInputActiveSba; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; + inputsArray = hIvasRend->inputsMasa; + inputStructSize = sizeof( *hIvasRend->inputsMasa ); + activateInput = setRendInputActiveMasa; + BREAK; + default: + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + + /* Find first free input in array corresponding to input type */ + IF ( ( error = findFreeInputSlot_fx( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) + { + return error; + } + + *inputId = makeInputId( inConfig, inputIndex ); + + IF ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} +#endif + + +/*-------------------------------------------------------------------* + * IVAS_REND_ConfigureCustomInputLoudspeakerLayout() * * * Note: this will reset any custom LFE routing set for the input @@ -5716,7 +6052,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_SetInputGain( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -5741,14 +6077,39 @@ ivas_error IVAS_REND_SetInputGain( return IVAS_ERR_OK; } +#else +ivas_error IVAS_REND_SetInputGain_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const Word32 gain /* i : linear gain (not in dB) */ +) +{ + input_base *inputBase; + ivas_error error; + + /* Validate function arguments */ + IF ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + { + return error; + } + inputBase->gain_fx = gain; + + return IVAS_ERR_OK; +} +#endif /*-------------------------------------------------------------------* * IVAS_REND_SetInputLfeMtx() * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_SetInputLfeMtx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -5791,6 +6152,50 @@ ivas_error IVAS_REND_SetInputLfeMtx( return IVAS_ERR_OK; } +#else +ivas_error IVAS_REND_SetInputLfeMtx_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_REND_LfePanMtx_fx *lfePanMtx /* i : LFE panning matrix */ +) +{ + Word16 i; + input_base *pInputBase; + input_mc *pInputMc; + ivas_error error; + + /* Validate function arguments */ + IF ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + /* Custom LFE panning matrix only makes sense with channel-based input */ + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + pInputMc = (input_mc *) pInputBase; + + /* copy LFE panning matrix */ + FOR ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; i++ ) + { + Copy32( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); + } + + IF ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} +#endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -5799,12 +6204,12 @@ ivas_error IVAS_REND_SetInputLfeMtx( * *-------------------------------------------------------------------*/ -ivas_error IVAS_REND_SetInputLfePos( +ivas_error IVAS_REND_SetInputLfePos_fx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ - const float inputGain, /* i : Input gain to be applied to the LFE channel(s) */ - const float outputAzimuth, /* i : Output azimuth position */ - const float outputElevation /* i : Output elevation position */ + const Word32 inputGain, /* i : Input gain to be applied to the LFE channel(s) */ + const Word16 outputAzimuth, /* i : Output azimuth position */ + const Word16 outputElevation /* i : Output elevation position */ ) { input_base *pInputBase; @@ -5812,17 +6217,17 @@ ivas_error IVAS_REND_SetInputLfePos( ivas_error error; /* Validate function arguments */ - if ( hIvasRend == NULL ) + IF ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + IF ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) { return error; } - if ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { /* Custom LFE routing only makes sense with channel-based input */ return IVAS_ERR_INVALID_INPUT_FORMAT; @@ -5830,14 +6235,11 @@ ivas_error IVAS_REND_SetInputLfePos( pInputMc = (input_mc *) pInputBase; pInputMc->lfeRouting.pan_lfe = true; - pInputMc->lfeRouting.lfeInputGain = inputGain; - pInputMc->lfeRouting.lfeInputGain_fx = ( inputGain == 1.0f ) ? ONE_IN_Q31 : (Word32) (inputGain * ( ONE_IN_Q31 )); - pInputMc->lfeRouting.lfeOutputAzimuth = outputAzimuth; + pInputMc->lfeRouting.lfeInputGain_fx = inputGain; // Q31 pInputMc->lfeRouting.lfeOutputAzimuth_fx = (Word16) ( outputAzimuth ); // Q0 - pInputMc->lfeRouting.lfeOutputElevation = outputElevation; pInputMc->lfeRouting.lfeOutputElevation_fx = (Word16) ( outputElevation ); // Q0 - if ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + IF ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -5941,7 +6343,7 @@ ivas_error IVAS_REND_RemoveInput( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetInputNumChannels( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -5969,14 +6371,42 @@ ivas_error IVAS_REND_GetInputNumChannels( return IVAS_ERR_OK; } +#else +ivas_error IVAS_REND_GetInputNumChannels( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + Word16 *numChannels /* o : number of channels of the input */ +) +{ + ivas_error error; + const input_base *pInput; + + /* Validate function arguments */ + IF ( hIvasRend == NULL || numChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF( ( error = getConstInputById( hIvasRend, inputId, (const void **) &pInput ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = getRendInputNumChannels( pInput, numChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + return IVAS_ERR_OK; +} +#endif /*-------------------------------------------------------------------* * IVAS_REND_GetNumAllObjects() * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetNumAllObjects( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ int16_t *numChannels /* o : number of all objects */ @@ -5994,7 +6424,25 @@ ivas_error IVAS_REND_GetNumAllObjects( return IVAS_ERR_OK; } +#else +ivas_error IVAS_REND_GetNumAllObjects( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + Word16 *numChannels /* o : number of all objects */ +) +{ + IF ( hIvasRend == NULL || numChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) + { + *numChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; + } + return IVAS_ERR_OK; +} +#endif /*-------------------------------------------------------------------* * IVAS_REND_GetDelay() @@ -6566,22 +7014,32 @@ ivas_error IVAS_REND_SetHeadRotation( } } +#ifdef IVAS_FLOAT_FIXED /* check for Euler angle signaling */ - if ( headRot.w == -3.0f ) + IF( EQ_32( headRot.w_fx, -1610612736 /* -3.0f in Q29 */ ) ) { - Euler2Quat( deg2rad( headRot.x ), deg2rad( headRot.y ), deg2rad( headRot.z ), &rotQuat ); + Euler2Quat_fx( deg2rad_fx( headRot.x_fx ), deg2rad_fx( headRot.y_fx ), deg2rad_fx( headRot.z_fx ), &rotQuat ); } - else + ELSE { rotQuat = headRot; } -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) { return error; } #else + /* check for Euler angle signaling */ + if ( headRot.w == -3.0f ) + { + Euler2Quat( deg2rad( headRot.x ), deg2rad( headRot.y ), deg2rad( headRot.z ), &rotQuat ); + } + else + { + rotQuat = headRot; + } + if ( ( error = ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) { return error; @@ -7202,7 +7660,7 @@ static ivas_error rotateFrameMc_fx( IF( hEFAPdata != NULL && ( NE_32( ls_azimuth[ch_in_woLFE], azimuth_fx ) || NE_32( ls_elevation[ch_in_woLFE], elevation_fx ) ) ) { - efap_determine_gains_fixed( hEFAPdata, tmp_gains, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); + efap_determine_gains_fx( hEFAPdata, tmp_gains, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); FOR( ch_out = 0; ch_out < nchan; ch_out++ ) { @@ -8268,6 +8726,10 @@ static ivas_error renderInputIsm( } ismInput->base.numNewSamplesPerChannel = 0; +#ifdef IVAS_FLOAT_FIXED + ismInput->base.gain = fix_to_float(ismInput->base.gain_fx, 30); +#endif // IVAS_FLOAT_FIXED + /* Apply input gain to new audio */ v_multc( inAudio.data, ismInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); @@ -9238,6 +9700,8 @@ static ivas_error renderInputMc( return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } mcInput->base.numNewSamplesPerChannel = 0; + /* To be removed */ + mcInput->base.gain = fix_to_float( mcInput->base.gain_fx, Q30 ); /* Apply input gain to new audio */ v_multc( inAudio.data, mcInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); @@ -9869,7 +10333,7 @@ static void renderSbaToMasa( push_wmops( "renderMcToMasa" ); copyBufferTo2dArray_fx( sbaInput->base.inputBuffer, tmpRendBuffer ); - ivas_dirac_ana( sbaInput->hDirAC, tmpRendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels ); + ivas_dirac_ana_fx( sbaInput->hDirAC, tmpRendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels ); accumulate2dArrayToBuffer_fx( tmpRendBuffer, &outAudio ); pop_wmops(); @@ -10246,6 +10710,10 @@ static ivas_error renderInputMasa( } masaInput->base.numNewSamplesPerChannel = 0; +#ifdef IVAS_FLOAT_FIXED + masaInput->base.gain = fix_to_float( masaInput->base.gain_fx, Q30 ); +#endif // IVAS_FLOAT_FIXED + /* Apply input gain to new audio */ v_multc( inAudio.data, masaInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); @@ -10869,7 +11337,7 @@ void IVAS_REND_Close( return; } - +#ifdef IVAS_FLOAT_FIXED static ivas_error ivas_masa_ext_rend_dirac_rend_init( input_masa *inputMasa ) { @@ -11210,7 +11678,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - if ( ( error = ivas_sba_get_hoa_dec_matrix( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } @@ -11319,46 +11787,407 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( return error; } - -static ivas_error ivas_masa_ext_rend_parambin_init( - input_masa *inputMasa /* i/o: MASA external renderer structure */ -) +#else +static ivas_error ivas_masa_ext_rend_dirac_rend_init( + input_masa *inputMasa ) { - DIRAC_DEC_BIN_HANDLE hDiracDecBin; - HRTFS_PARAMBIN_HANDLE hHrtfParambin; - int16_t nBins; + int16_t nchan_out_woLFE; + int16_t nchan_transport; + uint16_t i, j, k; + float ls_azimuth[MAX_OUTPUT_CHANNELS]; + float ls_elevation[MAX_OUTPUT_CHANNELS]; int32_t output_Fs; - RENDERER_TYPE renderer_type; - int16_t j, k, bin; - float binCenterFreq, tmpFloat; ivas_error error; - float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + DIRAC_REND_HANDLE hDirACRend; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; error = IVAS_ERR_OK; - hHrtfParambin = inputMasa->hMasaExtRend->hHrtfParambin; - - /* Set common variables and defaults */ + hDirACRend = NULL; output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); - nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands; - renderer_type = inputMasa->hMasaExtRend->renderer_type; - hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; + hSpatParamRendCom = inputMasa->hMasaExtRend->hSpatParamRendCom; - /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ - if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hDirACRend = (DIRAC_REND_HANDLE) malloc( sizeof( DIRAC_REND_DATA ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC renderer\n" ) ); } - hDiracDecBin->hTdDecorr = NULL; - hDiracDecBin->hReverb = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; - hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ - hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ + nchan_transport = inputMasa->base.inConfig == IVAS_AUDIO_CONFIG_MASA2 ? 2 : 1; - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + /*-----------------------------------------------------------------* + * output setup: for parametric binaural renderer, use output setup, otherwise internal setup + *-----------------------------------------------------------------*/ + + ivas_output_init( &hDirACRend->hOutSetup, *inputMasa->base.ctx.pOutConfig ); + + if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + /* Copy from ivas_ls_custom_setup */ + hDirACRend->hOutSetup.nchan_out_woLFE = inputMasa->base.ctx.pCustomLsOut->num_spk; + hDirACRend->hOutSetup.ls_azimuth = inputMasa->base.ctx.pCustomLsOut->ls_azimuth; + hDirACRend->hOutSetup.ls_elevation = inputMasa->base.ctx.pCustomLsOut->ls_elevation; + + hDirACRend->hOutSetup.num_lfe = inputMasa->base.ctx.pCustomLsOut->num_lfe; + hDirACRend->hOutSetup.index_lfe[0] = inputMasa->base.ctx.pCustomLsOut->lfe_idx[0]; + + hDirACRend->hOutSetup.is_loudspeaker_setup = TRUE; + hDirACRend->hOutSetup.is_planar_setup = (int8_t) inputMasa->base.ctx.pCustomLsOut->is_planar_setup; + } + + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; + + if ( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) + { + mvr2r( hDirACRend->hOutSetup.ls_azimuth, ls_azimuth, nchan_out_woLFE ); + mvr2r( hDirACRend->hOutSetup.ls_elevation, ls_elevation, nchan_out_woLFE ); + } + + if ( hDirACRend->hOutSetup.ambisonics_order == -1 ) + { + hDirACRend->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; /* Order 3 is used by default in DirAC for SHD processing */ + if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_MONO || hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_STEREO ) + { + hDirACRend->hOutSetup.ambisonics_order = SBA_FOA_ORDER; + } + } + else if ( hDirACRend->hOutSetup.ambisonics_order >= SBA_FOA_ORDER ) + { + mvr2r( ls_azimuth_4d4, ls_azimuth, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); + mvr2r( ls_elevation_4d4, ls_elevation, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); + } + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_MONO ) + { + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_MONO; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; + nchan_out_woLFE = 1; + } + else if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + { + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; + hDirACRend->panningConf = DIRAC_PANNING_VBAP; + } + else if ( !hDirACRend->hOutSetup.is_loudspeaker_setup && nchan_transport > 1 ) + { + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; + } + else + { + hDirACRend->synthesisConf = DIRAC_SYNTHESIS_GAIN_SHD; + hDirACRend->panningConf = DIRAC_PANNING_HOA3; + } + + if ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); + + ivas_dirac_dec_get_frequency_axis( hDirACRend->frequency_axis, output_Fs, hSpatParamRendCom->num_freq_bands ); + + if ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 && nchan_transport == 2 ) + { + if ( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + ivas_masa_init_stereotype_detection( hDirACRend->masa_stereo_type_detect ); + } + else + { + hDirACRend->masa_stereo_type_detect = NULL; + } + + hSpatParamRendCom->numIsmDirections = 0; + + /*-----------------------------------------------------------------* + * (re)configure sub-modules + *-----------------------------------------------------------------*/ + + /* prototype signal computation */ + /* allocate output setup related arrays */ + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + { + /* Directional and diffuses components in output LS format */ + hDirACRend->num_outputs_diff = nchan_out_woLFE; + hDirACRend->num_outputs_dir = nchan_out_woLFE; + } + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + /* Directional and diffuses components in SHD */ + /* Diffuseness components up to 1st order */ + hDirACRend->num_outputs_diff = ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ); + hDirACRend->num_outputs_dir = ivas_sba_get_nchan( hDirACRend->hOutSetup.ambisonics_order, 0 ); + } + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + { + hDirACRend->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; + hDirACRend->num_outputs_dir = nchan_out_woLFE; + } + else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) + { + hDirACRend->num_outputs_diff = 1; /* There is one output channel in mono */ + hDirACRend->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ + } + else + { + assert( 0 && "DirAC: not existing synthesis methods!" ); + } + + if ( ( hDirACRend->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirACRend->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + set_s( hDirACRend->proto_index_dir, 0, hDirACRend->num_outputs_dir ); + set_s( hDirACRend->proto_index_diff, 0, hDirACRend->num_outputs_diff ); + + hDirACRend->sba_map_tc = sba_map_tc; + + if ( nchan_transport == 1 ) + { + hDirACRend->num_protos_ambi = 1; + hDirACRend->num_protos_dir = 1; + hDirACRend->num_protos_diff = 1; + } + else if ( nchan_transport == 2 ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_diff = 1; + hDirACRend->num_protos_dir = 2; + hDirACRend->proto_index_dir[1] = 1; + } + else if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_MONO ) + { + /* Following the foa rendering for code compatibility */ + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_dir = 2; + hDirACRend->num_protos_diff = 3; + hDirACRend->proto_index_dir[0] = 0; + hDirACRend->proto_index_diff[0] = 0; + } + else + { + hDirACRend->num_protos_ambi = 2; + hDirACRend->num_protos_diff = 3; + + for ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) + { + if ( ls_azimuth[k] > 0.0f ) + { + hDirACRend->proto_index_diff[k] = 1; + } + else if ( ls_azimuth[k] < 0.0f ) + { + hDirACRend->proto_index_diff[k] = 2; + } + else + { + hDirACRend->proto_index_diff[k] = 0; + } + } + + if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + { + hDirACRend->num_protos_dir = 3; + mvs2s( hDirACRend->proto_index_diff, hDirACRend->proto_index_dir, nchan_out_woLFE ); + } + else + { + hDirACRend->num_protos_dir = 2; + hDirACRend->proto_index_dir[1] = 1; + } + } + } + + /* direct/diffuse responses */ + if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) + { + initDiffuseResponses( hDirACRend->diffuse_response_function, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, + hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); + } + else + { + initDiffuseResponses( hDirACRend->diffuse_response_function, hDirACRend->num_outputs_dir, IVAS_AUDIO_CONFIG_FOA, + hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); + } + + hDirACRend->hoa_encoder = NULL; + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + { + if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); + compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirACRend->hoa_encoder, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); + } + + /* VBAP */ + inputMasa->hMasaExtRend->hVBAPdata = NULL; + + if ( hDirACRend->panningConf == DIRAC_PANNING_VBAP ) + { + if ( ( error = vbap_init_data( &( inputMasa->hMasaExtRend->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE, MASA_FORMAT ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* HOA panning/dec */ + hDirACRend->hoa_decoder = NULL; + if ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 ) + { + if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + { + if ( ( error = ivas_sba_get_hoa_dec_matrix( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + { + return error; + } + + hDirACRend->hoa_decoder = inputMasa->hMasaExtRend->hoa_dec_mtx; + } + } + + /* decorrelation */ + hDirACRend->proto_signal_decorr_on = 1; + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) + { + hDirACRend->proto_signal_decorr_on = 0; + } + + if ( hDirACRend->proto_signal_decorr_on ) + { + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), + &( hDirACRend->h_freq_domain_decorr_ap_state ), + hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + hDirACRend->frequency_axis, + nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* output synthesis */ + if ( ( ivas_dirac_dec_output_synthesis_open( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + hDirACRend->h_output_synthesis_psd_params.use_onset_filters = 0; + } + + /*-----------------------------------------------------------------* + * memory allocation + *-----------------------------------------------------------------*/ + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + hDirACRend->proto_frame_f = NULL; + } + else + { + if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + } + + + hDirACRend->buffer_energy = NULL; + + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + hDirACRend->buffer_intensity_real[i][j] = NULL; + } + } + + /* output synthesis */ + ivas_dirac_dec_output_synthesis_init( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, 0 ); + + /* Allocate stack memory */ + if ( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + inputMasa->hMasaExtRend->hDirACRend = hDirACRend; + + return error; +} +#endif + +static ivas_error ivas_masa_ext_rend_parambin_init( + input_masa *inputMasa /* i/o: MASA external renderer structure */ +) +{ + DIRAC_DEC_BIN_HANDLE hDiracDecBin; + HRTFS_PARAMBIN_HANDLE hHrtfParambin; + int16_t nBins; + int32_t output_Fs; + RENDERER_TYPE renderer_type; + int16_t j, k, bin; + float binCenterFreq, tmpFloat; + ivas_error error; + float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + + error = IVAS_ERR_OK; + + hHrtfParambin = inputMasa->hMasaExtRend->hHrtfParambin; + + /* Set common variables and defaults */ + output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); + nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands; + renderer_type = inputMasa->hMasaExtRend->renderer_type; + + hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; + + /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); + } + + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ + hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ + + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { @@ -11672,10 +12501,17 @@ static void freeMasaExtRenderer( #endif } +#ifdef IVAS_FLOAT_FIXED + IF( hMasaExtRend->hHrtfParambin != NULL ) + { + ivas_HRTF_parambin_binary_close_fx( &hMasaExtRend->hHrtfParambin ); + } +#else if ( hMasaExtRend->hHrtfParambin != NULL ) { ivas_HRTF_parambin_binary_close( &hMasaExtRend->hHrtfParambin ); } +#endif if ( hMasaExtRend->hVBAPdata != NULL ) { diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 4c9728612..135392215 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -160,7 +160,13 @@ ivas_error IVAS_REND_AddInput( const IVAS_AUDIO_CONFIG inConfig, /* i : audio config for a new input */ IVAS_REND_InputId *inputId /* o : ID of the new input */ ); - +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_AddInput_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_AUDIO_CONFIG inConfig, /* i : audio config for a new input */ + IVAS_REND_InputId *inputId /* o : ID of the new input */ +); +#endif /* Note: this will reset any custom LFE routing set for the input */ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ @@ -173,7 +179,19 @@ ivas_error IVAS_REND_SetInputGain( const IVAS_REND_InputId inputId, /* i : ID of the input */ const float gain /* i : linear gain (not in dB) */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetInputGain_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const Word32 gain /* i : linear gain (not in dB) */ +); +ivas_error IVAS_REND_SetInputLfeMtx_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_REND_LfePanMtx_fx *lfePanMtx /* i : LFE panning matrix */ +); +#endif // IVAS_FLOAT_FIXED ivas_error IVAS_REND_SetInputLfeMtx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -187,7 +205,15 @@ ivas_error IVAS_REND_SetInputLfePos( const float outputAzimuth, /* i : Output azimuth position */ const float outputElevation /* i : Output elevation position */ ); - +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetInputLfePos_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const Word32 inputGain, /* i : Input gain to be applied to the LFE channel(s) */ + const Word16 outputAzimuth, /* i : Output azimuth position */ + const Word16 outputElevation /* i : Output elevation position */ +); +#endif // IVAS_FLOAT_FIXED ivas_error IVAS_REND_RemoveInput( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId /* i : ID of the input */ diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 31be09232..29bd4a8b0 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -549,10 +549,10 @@ static ivas_error LoadBSplineBinary( HRTF_energy_sections_precalc( model ); HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K; +#ifndef IVAS_FLOAT_FIXED HrFiltSet_p->ModelEval.hrfModL = (float *) malloc( model->K * sizeof( float ) ); HrFiltSet_p->ModelEval.hrfModR = (float *) malloc( model->K * sizeof( float ) ); - -#ifdef IVAS_FLOAT_FIXED +#else HrFiltSet_p->ModelEval.hrfModL_fx = (Word32 *) malloc( model->K * sizeof( Word32 ) ); HrFiltSet_p->ModelEval.hrfModR_fx = (Word32 *) malloc( model->K * sizeof( Word32 ) ); #endif @@ -884,9 +884,13 @@ ivas_error dealloc_HRTF_binary( free( hHrtf->ModelParams.EL_dyn_fx ); free( hHrtf->ModelParams.ER_dyn_fx ); #endif - +#ifdef IVAS_FLOAT_FIXED + free( hHrtf->ModelEval.hrfModL_fx ); + free( hHrtf->ModelEval.hrfModR_fx ); +#else free( hHrtf->ModelEval.hrfModL ); free( hHrtf->ModelEval.hrfModR ); +#endif for ( i = 0; i < 3; i++ ) { -- GitLab From d18c367e89b9d439e12394a2f6cd8e535b3aa3a2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 6 May 2024 14:36:12 +0530 Subject: [PATCH 015/101] Fix for idiv1616 BASOP zero numerator case --- lib_rend/ivas_dirac_output_synthesis_dec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index d8cbc1f26..43a0cb5e8 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -3675,7 +3675,14 @@ static void ivas_dirac_dec_get_response_split_order_fx( tmp = BASOP_util_atan2( dv_r_1, dv_r_0, 0 ); // Q13 index_azimuth = shr( mult( tmp, _180_OVER_PI_Q9 ), 7 ); // Q0; - tmp = idiv1616( add( index_azimuth, 180 ), 360 ); + IF(EQ_16(index_azimuth, -180)) + { + tmp = 0; move16(); + } + ELSE + { + tmp = idiv1616( add( index_azimuth, 180 ), 360 ); + } index_azimuth = sub( add( index_azimuth, 180 ), i_mult( tmp, 360 ) ); // index_azimuth = (index_azimuth + 180) % 360 temp = L_add( Mpy_32_32( dv_r_0, dv_r_0 ), Mpy_32_32( dv_r_1, dv_r_1 ) ); // Q21 -- GitLab From 7a150faf6f24b807aa11e55eae6ef344d949b829 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 6 May 2024 15:14:12 +0530 Subject: [PATCH 016/101] Fixes for few of the issues reported in ASAN test --- lib_com/ivas_prot.h | 12 ++++- lib_dec/ivas_dirac_dec.c | 4 +- lib_dec/ivas_init_dec.c | 13 ++++- lib_dec/ivas_mc_param_dec.c | 81 +++++++++++----------------- lib_dec/ivas_osba_dec.c | 84 ++++++++++++++++++++++++++++-- lib_dec/ivas_sba_dec.c | 6 +-- lib_dec/ivas_stereo_dft_dec_fx.c | 3 +- lib_rend/ivas_objectRenderer_mix.c | 5 ++ 8 files changed, 143 insertions(+), 65 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 0361dacfa..a5b76f8d4 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4652,11 +4652,11 @@ ivas_error ivas_param_mc_dec_reconfig( void ivas_param_mc_dec_close_fx( PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ ); -#endif // IVAS_FLOAT_FIXED - +#else void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC /* i/o: Parametric MC decoder handle */ ); +#endif // IVAS_FLOAT_FIXED void ivas_param_mc_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ @@ -6996,6 +6996,9 @@ ivas_error ivas_osba_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); #ifdef IVAS_FLOAT_FIXED +ivas_error ivas_osba_data_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +); ivas_error ivas_osba_dirac_td_binaural_jbm_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -7047,6 +7050,11 @@ ivas_error ivas_osba_render_sf( float *output_f[] /* o : rendered time signal */ ); #endif +#ifdef IVAS_FLOAT_FIXED +void ivas_osba_data_close_fx( + SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ +); +#endif void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 425d5ef1e..2594011d3 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -732,7 +732,7 @@ static ivas_error ivas_dirac_rend_config_fx( hDirACRend->proto_signal_decorr_on = 0; } - IF( ( EQ_16( flag_config, DIRAC_OPEN && hDirACRend->proto_signal_decorr_on ) ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( hDirACRend->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) + IF( ( EQ_16( flag_config, DIRAC_OPEN) && hDirACRend->proto_signal_decorr_on ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( hDirACRend->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { #ifdef IVAS_FLOAT_FIXED FOR( int ii = 0; ii < st_ivas->hSpatParamRendCom->num_freq_bands; ii++ ) @@ -3631,7 +3631,7 @@ void ivas_dirac_dec_render_sf_fx( Word32 proto_direct_buffer_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; Word32 proto_power_smooth_fx[2 * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; Word32 reference_power_fix[5 * CLDFB_NO_CHANNELS_MAX]; - Word32 onset_filter_subframe_fix[2 * MAX_OUTPUT_CHANNELS]; + Word32 onset_filter_subframe_fix[2 * CLDFB_NO_CHANNELS_MAX]; Word32 proto_diffuse_buffer_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; //set_zero_fx( &proto_frame_f_fx[0], 2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &proto_direct_buffer_f_fx[0], 2 * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 389641099..c27587e1b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1812,7 +1812,7 @@ ivas_error ivas_init_decoder_fx( return error; } - IF ( ( error = ivas_osba_data_open( st_ivas ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_osba_data_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -4089,7 +4089,11 @@ void ivas_destroy_dec( ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); /* Parametric MC handle */ +#ifdef IVAS_FLOAT_FIXED + ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); +#else ivas_param_mc_dec_close( &st_ivas->hParamMC ); +#endif /* EFAP handle */ efap_free_data( &st_ivas->hEFAPdata ); @@ -4133,7 +4137,11 @@ void ivas_destroy_dec( ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); /* OSBA structure */ +#ifdef IVAS_FLOAT_FIXED + ivas_osba_data_close_fx( &st_ivas->hSbaIsmData ); +#else ivas_osba_data_close( &st_ivas->hSbaIsmData ); +#endif /* OMASA structure */ ivas_omasa_data_close( &st_ivas->hMasaIsmData ); @@ -4150,9 +4158,10 @@ void ivas_destroy_dec( /* Time Domain binaural renderer handle */ IF ( st_ivas->hBinRendererTd != NULL ) { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); +#else + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); #endif } ELSE IF ( st_ivas->hHrtfTD != NULL ) diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index f8a225606..aae13ac70 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -49,6 +49,7 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED #endif #define INV_EPSILON_MANT 214748365 @@ -303,6 +304,8 @@ ivas_error ivas_param_mc_dec_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } + set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); + set_f( hParamMC->icc_q, 0, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); #endif param_mc_set_num_synth_bands( output_Fs, hParamMC ); @@ -1336,7 +1339,8 @@ ivas_error ivas_param_mc_dec_reconfig_fx( Word16 *ild_q_old_fx = hParamMC->icld_q_fx; Word16 *icc_q_old_fx = hParamMC->icc_q_fx; #if 1/*To be removed later*/ - + free( hParamMC->icc_q ); + free( hParamMC->icld_q ); /* init arrays for the quantized parameters */ IF ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) { @@ -2409,7 +2413,16 @@ void ivas_param_mc_dec_close_fx( free( hParamMC->diff_proto_info->proto_fac_fx[i] ); hParamMC->diff_proto_info->proto_fac_fx[i] = NULL; } +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED /*TODO: To be removed later(Floating point memory dealloc)------------------------------- */ + FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + free( hParamMC->diff_proto_info->proto_fac[i] ); + hParamMC->diff_proto_info->proto_fac[i] = NULL; + } + free( hParamMC->diff_proto_info->proto_fac ); + hParamMC->diff_proto_info->proto_fac = NULL; +#endif /***********************************ends here************************************************/ free( hParamMC->diff_proto_info->source_chan_idx ); hParamMC->diff_proto_info->source_chan_idx = NULL; @@ -2466,7 +2479,13 @@ void ivas_param_mc_dec_close_fx( free( hParamMC->Cldfb_ImagBuffer_tc_fx ); hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; } -#if 1 /*TODO: To be removed later(Floating point memory dealloc)------------------------------- */ +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED /*TODO: To be removed later(Floating point memory dealloc)------------------------------- */ + + IF( hParamMC->proto_matrix_int != NULL ) + { + free( hParamMC->proto_matrix_int ); + hParamMC->proto_matrix_int = NULL; + } IF( hParamMC->icc_q != NULL ) { @@ -2479,16 +2498,6 @@ void ivas_param_mc_dec_close_fx( free( hParamMC->icld_q ); hParamMC->icld_q = NULL; } - IF( hParamMC->diff_proto_info ) - { - FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - free( hParamMC->diff_proto_info->proto_fac[i] ); - hParamMC->diff_proto_info->proto_fac[i] = NULL; - } - free( hParamMC->diff_proto_info->proto_fac ); - hParamMC->diff_proto_info->proto_fac = NULL; - } IF( hParamMC->proto_frame_f != NULL ) { free( hParamMC->proto_frame_f ); @@ -2504,6 +2513,11 @@ void ivas_param_mc_dec_close_fx( // free( hParamMC->ls_conv_dmx_matrix ); // hParamMC->ls_conv_dmx_matrix = NULL; //} + IF( hParamMC->hoa_encoder != NULL ) + { + free( hParamMC->hoa_encoder ); + hParamMC->hoa_encoder = NULL; + } IF( hParamMC->Cldfb_RealBuffer_tc != NULL ) { free( hParamMC->Cldfb_RealBuffer_tc ); @@ -2521,7 +2535,7 @@ void ivas_param_mc_dec_close_fx( return; } -#endif +#else void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ ) @@ -2537,11 +2551,7 @@ void ivas_param_mc_dec_close( hParamMC = *hParamMC_out; /* close sub-modules */ -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_dec_output_synthesis_cov_close_fx( &hParamMC->h_output_synthesis_params, &hParamMC->h_output_synthesis_cov_state ); -#else ivas_dirac_dec_output_synthesis_cov_close( &hParamMC->h_output_synthesis_params, &hParamMC->h_output_synthesis_cov_state ); -#endif if ( hParamMC->h_freq_domain_decorr_ap_params != NULL || hParamMC->h_freq_domain_decorr_ap_state != NULL ) { @@ -2563,26 +2573,13 @@ void ivas_param_mc_dec_close( free( hParamMC->icc_q ); hParamMC->icc_q = NULL; } -#ifdef IVAS_FLOAT_FIXED - if ( hParamMC->icc_q_fx != NULL ) - { - free( hParamMC->icc_q_fx ); - hParamMC->icc_q_fx = NULL; - } -#endif if ( hParamMC->icld_q != NULL ) { free( hParamMC->icld_q ); hParamMC->icld_q = NULL; } -#ifdef IVAS_FLOAT_FIXED - if ( hParamMC->icld_q_fx != NULL ) - { - free( hParamMC->icld_q_fx ); - hParamMC->icld_q_fx = NULL; - } -#endif + /* diffuse prototype info */ if ( hParamMC->diff_proto_info ) { @@ -2617,11 +2614,6 @@ void ivas_param_mc_dec_close( { free( hParamMC->proto_frame_f ); hParamMC->proto_frame_f = NULL; - -#ifdef IVAS_FLOAT_FIXED - free(hParamMC->proto_frame_f_fx); - hParamMC->proto_frame_f_fx = NULL; -#endif } if ( hParamMC->proto_frame_dec_f != NULL ) @@ -2629,32 +2621,18 @@ void ivas_param_mc_dec_close( free( hParamMC->proto_frame_dec_f ); hParamMC->proto_frame_dec_f = NULL; } -#ifndef IVAS_FLOAT_FIXED + if ( hParamMC->ls_conv_dmx_matrix != NULL ) { free( hParamMC->ls_conv_dmx_matrix ); hParamMC->ls_conv_dmx_matrix = NULL; } -#else - if ( hParamMC->ls_conv_dmx_matrix_fx != NULL ) - { - free( hParamMC->ls_conv_dmx_matrix_fx ); - hParamMC->ls_conv_dmx_matrix_fx = NULL; - } -#endif if ( hParamMC->proto_matrix_int != NULL ) { free( hParamMC->proto_matrix_int ); hParamMC->proto_matrix_int = NULL; } -#ifdef IVAS_FLOAT_FIXED - if ( hParamMC->proto_matrix_int_fx != NULL ) - { - free( hParamMC->proto_matrix_int_fx ); - hParamMC->proto_matrix_int_fx = NULL; - } -#endif if ( hParamMC->hoa_encoder != NULL ) { @@ -2678,6 +2656,7 @@ void ivas_param_mc_dec_close( return; } +#endif /*------------------------------------------------------------------------- * ivas_param_mc_dec_read_BS() diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 15fd1f788..09bef1197 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -43,6 +43,7 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "math.h" // temporary (for fabs) +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED #endif // IVAS_FLOAT_FIXED @@ -67,38 +68,73 @@ ivas_error ivas_osba_data_open( hSbaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; hSbaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES ); + if ( ( hSbaIsmData->delayBuffer = (float **) malloc( hSbaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) ); + } + + for ( i = 0; i < hSbaIsmData->delayBuffer_nchan; i++ ) + { + if ( ( hSbaIsmData->delayBuffer[i] = (float *) malloc( hSbaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) ); + } + set_zero( hSbaIsmData->delayBuffer[i], hSbaIsmData->delayBuffer_size ); + } + + st_ivas->hSbaIsmData = hSbaIsmData; + + return IVAS_ERR_OK; +} + #ifdef IVAS_FLOAT_FIXED +ivas_error ivas_osba_data_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + SBA_ISM_DATA_HANDLE hSbaIsmData; + int16_t i; + + if ( ( hSbaIsmData = (SBA_ISM_DATA_HANDLE) malloc( sizeof( SBA_ISM_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OSBA data\n" ) ); + } + + hSbaIsmData->delayBuffer_nchan = st_ivas->nchan_ism; + hSbaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES ); + if ( ( hSbaIsmData->delayBuffer_fx = (Word32 **) malloc( hSbaIsmData->delayBuffer_nchan * sizeof(Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) ); } -#endif +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED if ( ( hSbaIsmData->delayBuffer = (float **) malloc( hSbaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) ); } +#endif for ( i = 0; i < hSbaIsmData->delayBuffer_nchan; i++ ) { -#ifdef IVAS_FLOAT_FIXED if ( ( hSbaIsmData->delayBuffer_fx[i] = (Word32 *) malloc( hSbaIsmData->delayBuffer_size * sizeof(Word32) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) ); } set_zero_fx( hSbaIsmData->delayBuffer_fx[i], hSbaIsmData->delayBuffer_size ); -#endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED if ( ( hSbaIsmData->delayBuffer[i] = (float *) malloc( hSbaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) ); } set_zero( hSbaIsmData->delayBuffer[i], hSbaIsmData->delayBuffer_size ); +#endif // IVAS_FLOAT_FIXED } st_ivas->hSbaIsmData = hSbaIsmData; return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------* * ivas_osba_data_close() @@ -133,6 +169,46 @@ void ivas_osba_data_close( return; } +#ifdef IVAS_FLOAT_FIXED +void ivas_osba_data_close_fx( + SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ +) +{ + int16_t i; + + if ( hSbaIsmData == NULL || *hSbaIsmData == NULL ) + { + return; + } + + if ( ( *hSbaIsmData )->delayBuffer_fx != NULL ) + { + for ( i = 0; i < ( *hSbaIsmData )->delayBuffer_nchan; i++ ) + { + free( ( *hSbaIsmData )->delayBuffer_fx[i] ); + } + free( ( *hSbaIsmData )->delayBuffer_fx ); + ( *hSbaIsmData )->delayBuffer_fx = NULL; + } + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + if ( ( *hSbaIsmData )->delayBuffer != NULL ) + { + for ( i = 0; i < ( *hSbaIsmData )->delayBuffer_nchan; i++ ) + { + free( ( *hSbaIsmData )->delayBuffer[i] ); + } + free( ( *hSbaIsmData )->delayBuffer ); + ( *hSbaIsmData )->delayBuffer = NULL; + } +#endif + + free( *hSbaIsmData ); + *hSbaIsmData = NULL; + + return; +} +#endif /*--------------------------------------------------------------------------* * ivas_osba_dirac_td_binaural_jbm() diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index b27b05f87..2d2779d81 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1486,7 +1486,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( } /* Allocate memory for OSBA delay buffer */ - if ( ( error = ivas_osba_data_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_osba_data_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1498,14 +1498,14 @@ ivas_error ivas_sba_dec_reconfigure_fx( /* ISM renderer handle */ ivas_ism_renderer_close( &st_ivas->hIsmRendererData ); ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); - ivas_osba_data_close( &st_ivas->hSbaIsmData ); + ivas_osba_data_close_fx( &st_ivas->hSbaIsmData ); /* Time Domain binaural renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) { if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); st_ivas->hHrtfTD = NULL; } } diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 7b3acb1ce..c76c8ce0e 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -488,7 +488,8 @@ static void stereo_dft_dequantize_res_gains_f_fx( ij = (Word16)L_min( fi < ONE_IN_Q25 ? i1 : i1 + 1, 15 ); /* interpolate values from table */ - IF ( LT_32(i1, L_shl(15, Q26)) ) + // IF ( LT_32(i1, L_shl(15, Q26)) ) + IF ( LT_16(i1, 15) ) { gout[i] = Madd_32_32( Mpy_32_32(L_sub(MAX_32, L_shl(fi , Q5)), dft_res_gains_q_fx[( i1 << 3 ) + ji][0]), dft_res_gains_q_fx[( ( i1 + 1 ) << 3 ) + ji][0], L_shl(fi, Q5) ); move32(); diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 1889939a1..cfb3ec5dd 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -43,6 +43,8 @@ #include "prot_fx2.h" #endif // IVAS_FLOAT_FIXED +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED + /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -211,6 +213,9 @@ void TDREND_MIX_Dealloc_fx( { IF ( EQ_16(hBinRendererTd->HrFiltSet_p->FilterMethod , TDREND_HRFILT_Method_BSplineModel) ) { +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + BSplineModelEvalDealloc( &hBinRendererTd->HrFiltSet_p->ModelParams, &hBinRendererTd->HrFiltSet_p->ModelEval ); +#endif BSplineModelEvalDealloc_fx( &hBinRendererTd->HrFiltSet_p->ModelParams, &hBinRendererTd->HrFiltSet_p->ModelEval ); } ELSE -- GitLab From 5231a99d6906b5ffd06f26939cd45705953b11a1 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 6 May 2024 21:26:48 +0530 Subject: [PATCH 017/101] Update for cleaned up structure element --- lib_rend/ivas_objectRenderer_hrFilt.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 720816ea7..b1272616c 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -1168,10 +1168,7 @@ void BSplineModelEvalDealloc( free( model->azimKSeq ); if ( modelEval != NULL ) { -#ifdef IVAS_FLOAT_FIXED - free( modelEval->hrfModL_fx ); - free( modelEval->hrfModR_fx ); -#else +#ifndef IVAS_FLOAT_FIXED free( modelEval->hrfModL ); free( modelEval->hrfModR ); #endif -- GitLab From 8fdad991b4b0c53b78407a8ac8daba4dae08f982 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 7 May 2024 11:17:06 +0530 Subject: [PATCH 018/101] Quaternion and vector functions simplified fixed implementation --- lib_com/common_api_types.h | 4 +- lib_dec/ivas_objectRenderer_internal.c | 40 +-- lib_dec/lib_dec.h | 5 + lib_dec/lib_dec_fx.c | 56 +-- lib_rend/ivas_objectRenderer.c | 13 +- lib_rend/ivas_orient_trk.c | 477 +++++++++---------------- lib_rend/ivas_rotation.c | 63 ++-- lib_rend/lib_rend.c | 20 +- 8 files changed, 250 insertions(+), 428 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 9de8aae05..d61457a11 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -134,7 +134,7 @@ typedef struct float w, x, y, z; #ifdef IVAS_FLOAT_FIXED Word32 w_fx, x_fx, y_fx, z_fx; - Word16 w_qfact, x_qfact, y_qfact, z_qfact; + Word16 q_fact; #endif } IVAS_QUATERNION; @@ -145,7 +145,7 @@ typedef struct float x, y, z; #ifdef IVAS_FLOAT_FIXED Word32 x_fx, y_fx, z_fx; - Word16 x_qfact, y_qfact, z_qfact; + Word16 q_fact; #endif } IVAS_VECTOR3; diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 1c9ec0308..ce8e3c6f3 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -269,45 +269,13 @@ ivas_error ivas_td_binaural_renderer_sf_fx( tmp_vector_fx = &st_ivas->hCombinedOrientationData->listenerPos[st_ivas->hCombinedOrientationData->subframe_idx]; enableCombinedOrientation = st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx]; - /* Shifting w_fx, x_fx, y_fx, z_fx to a common Q-factor if they are not having the same Q-factor */ - Word16 min_q; - IF( !( EQ_16( tmp_Quaternion_fx->w_qfact, tmp_Quaternion_fx->x_qfact ) && EQ_16( tmp_Quaternion_fx->x_qfact, tmp_Quaternion_fx->y_qfact ) && EQ_16( tmp_Quaternion_fx->y_qfact, tmp_Quaternion_fx->z_qfact ) ) ) - { - min_q = MAX16B; - move16(); - min_q = s_min( min_q, tmp_Quaternion_fx->w_qfact ); - min_q = s_min( min_q, tmp_Quaternion_fx->x_qfact ); - min_q = s_min( min_q, tmp_Quaternion_fx->y_qfact ); - min_q = s_min( min_q, tmp_Quaternion_fx->z_qfact ); - tmp_Quaternion_fx->w_fx = L_shr( tmp_Quaternion_fx->w_fx, sub( tmp_Quaternion_fx->w_qfact, min_q ) ); - tmp_Quaternion_fx->x_fx = L_shr( tmp_Quaternion_fx->x_fx, sub( tmp_Quaternion_fx->x_qfact, min_q ) ); - tmp_Quaternion_fx->y_fx = L_shr( tmp_Quaternion_fx->y_fx, sub( tmp_Quaternion_fx->y_qfact, min_q ) ); - tmp_Quaternion_fx->z_fx = L_shr( tmp_Quaternion_fx->z_fx, sub( tmp_Quaternion_fx->z_qfact, min_q ) ); - tmp_Quaternion_fx->w_qfact = min_q; - move16(); - tmp_Quaternion_fx->x_qfact = min_q; - move16(); - tmp_Quaternion_fx->y_qfact = min_q; - move16(); - tmp_Quaternion_fx->z_qfact = min_q; - move16(); - } - /* Shifting x_fx, y_fx, z_fx to the same Q-factor as Listener_p->Pos_q (usually Q25) */ Word16 pos_q = st_ivas->hBinRendererTd->Listener_p->Pos_q; move16(); - IF( NE_16( tmp_vector_fx->x_qfact, pos_q ) || NE_16( tmp_vector_fx->z_qfact, pos_q ) || NE_16( tmp_vector_fx->y_qfact, pos_q ) ) - { - tmp_vector_fx->x_fx = L_shr( tmp_vector_fx->x_fx, sub( tmp_vector_fx->x_qfact, pos_q ) ); - tmp_vector_fx->y_fx = L_shr( tmp_vector_fx->y_fx, sub( tmp_vector_fx->y_qfact, pos_q ) ); - tmp_vector_fx->z_fx = L_shr( tmp_vector_fx->z_fx, sub( tmp_vector_fx->z_qfact, pos_q ) ); - tmp_vector_fx->x_qfact = pos_q; - move16(); - tmp_vector_fx->y_qfact = pos_q; - move16(); - tmp_vector_fx->z_qfact = pos_q; - move16(); - } + tmp_vector_fx->x_fx = L_shr( tmp_vector_fx->x_fx, sub( tmp_vector_fx->q_fact, pos_q ) ); + tmp_vector_fx->y_fx = L_shr( tmp_vector_fx->y_fx, sub( tmp_vector_fx->q_fact, pos_q ) ); + tmp_vector_fx->z_fx = L_shr( tmp_vector_fx->z_fx, sub( tmp_vector_fx->q_fact, pos_q ) ); + tmp_vector_fx->q_fact = pos_q; } ELSE { diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index a8c740841..02aedd958 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -496,8 +496,13 @@ ivas_error IVAS_DEC_FeedRefRotData( /*! r: error code */ ivas_error IVAS_DEC_FeedRefVectorData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifndef IVAS_FLOAT_FIXED const IVAS_VECTOR3 listenerPos, /* i : Listener position */ const IVAS_VECTOR3 refPos /* i : Reference position */ +#else + IVAS_VECTOR3 listenerPos, /* i : Listener position */ + IVAS_VECTOR3 refPos /* i : Reference position */ +#endif ); /*! r: error code */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 92d4479b2..e5e73a07e 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1472,9 +1472,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->Pos[subframe_idx].x_fx = Pos.x_fx; hHeadTrackData->Pos[subframe_idx].y_fx = Pos.y_fx; hHeadTrackData->Pos[subframe_idx].z_fx = Pos.z_fx; - hHeadTrackData->Pos[subframe_idx].x_qfact = Pos.x_qfact; - hHeadTrackData->Pos[subframe_idx].y_qfact = Pos.y_qfact; - hHeadTrackData->Pos[subframe_idx].z_qfact = Pos.z_qfact; + hHeadTrackData->Pos[subframe_idx].q_fact = Pos.q_fact; #endif hIvasDec->updateOrientation = true; @@ -1523,9 +1521,14 @@ ivas_error IVAS_DEC_FeedRefRotData( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedRefVectorData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifndef IVAS_FLOAT_FIXED const IVAS_VECTOR3 listenerPos, /* i : Listener position */ const IVAS_VECTOR3 refPos /* i : Reference position */ +#else + IVAS_VECTOR3 listenerPos, /* i : Listener position */ + IVAS_VECTOR3 refPos /* i : Reference position */ +#endif ) { ivas_orient_trk_state_t *pOtr; @@ -1540,20 +1543,19 @@ ivas_error IVAS_DEC_FeedRefVectorData( hIvasDec->updateOrientation = true; #ifdef IVAS_FLOAT_FIXED - IVAS_VECTOR3 listenerPos_fx, refPos_fx; - listenerPos_fx.x_qfact = listenerPos_fx.y_qfact = listenerPos_fx.z_qfact = Q27; - refPos_fx.x_qfact = refPos_fx.y_qfact = refPos_fx.z_qfact = Q27; - listenerPos_fx.x_fx = float_to_fix( listenerPos.x, listenerPos_fx.x_qfact ); - listenerPos_fx.y_fx = float_to_fix( listenerPos.y, listenerPos_fx.y_qfact ); - listenerPos_fx.z_fx = float_to_fix( listenerPos.z, listenerPos_fx.z_qfact ); - refPos_fx.x_fx = float_to_fix( refPos.x, refPos_fx.x_qfact ); - refPos_fx.y_fx = float_to_fix( refPos.y, refPos_fx.y_qfact ); - refPos_fx.z_fx = float_to_fix( refPos.z, refPos_fx.z_qfact ); - ivas_error error_fx = ivas_orient_trk_SetReferenceVector_fx(pOtr, listenerPos_fx, refPos_fx ); - pOtr->refRot.w = me2f(pOtr->refRot.w_fx, 31- pOtr->refRot.w_qfact ); - pOtr->refRot.x = me2f(pOtr->refRot.x_fx, 31 - pOtr->refRot.x_qfact ); - pOtr->refRot.y = me2f(pOtr->refRot.y_fx, 31- pOtr->refRot.y_qfact ); - pOtr->refRot.z = me2f(pOtr->refRot.z_fx, 31 - pOtr->refRot.z_qfact ); + listenerPos.q_fact = Q27; + refPos.q_fact = Q27; + listenerPos.x_fx = float_to_fix( listenerPos.x, listenerPos.q_fact ); + listenerPos.y_fx = float_to_fix( listenerPos.y, listenerPos.q_fact ); + listenerPos.z_fx = float_to_fix( listenerPos.z, listenerPos.q_fact ); + refPos.x_fx = float_to_fix( refPos.x, refPos.q_fact ); + refPos.y_fx = float_to_fix( refPos.y, refPos.q_fact ); + refPos.z_fx = float_to_fix( refPos.z, refPos.q_fact ); + ivas_error error_fx = ivas_orient_trk_SetReferenceVector_fx( pOtr, listenerPos, refPos ); + pOtr->refRot.w = me2f( pOtr->refRot.w_fx, 31 - pOtr->refRot.q_fact ); + pOtr->refRot.x = me2f( pOtr->refRot.x_fx, 31 - pOtr->refRot.q_fact ); + pOtr->refRot.y = me2f( pOtr->refRot.y_fx, 31 - pOtr->refRot.q_fact ); + pOtr->refRot.z = me2f( pOtr->refRot.z_fx, 31 - pOtr->refRot.q_fact ); return error_fx; #else return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos ); @@ -1593,21 +1595,21 @@ ivas_error IVAS_DEC_FeedExternalOrientationData( #ifdef IVAS_FLOAT_FIXED IVAS_QUATERNION orientation_fx = { 0 }; - orientation_fx.w_qfact = orientation_fx.x_qfact = orientation_fx.y_qfact = orientation_fx.z_qfact = Q29; - orientation_fx.w_fx = float_to_fix(orientation.w, orientation_fx.w_qfact); - orientation_fx.x_fx = float_to_fix(orientation.x, orientation_fx.x_qfact); - orientation_fx.y_fx = float_to_fix(orientation.y, orientation_fx.y_qfact); - orientation_fx.z_fx = float_to_fix(orientation.z, orientation_fx.z_qfact); + orientation_fx.q_fact = Q29; + orientation_fx.w_fx = float_to_fix(orientation.w, orientation_fx.q_fact); + orientation_fx.x_fx = float_to_fix(orientation.x, orientation_fx.q_fact); + orientation_fx.y_fx = float_to_fix(orientation.y, orientation_fx.q_fact); + orientation_fx.z_fx = float_to_fix(orientation.z, orientation_fx.q_fact); /* Move external orientation data to the decoder handle (invert orientations) */ QuaternionInverse_fx(orientation_fx, &hExternalOrientationData->Quaternions[subframe_idx]); hExternalOrientationData->Quaternions[subframe_idx].w = me2f(hExternalOrientationData->Quaternions[subframe_idx].w_fx, - 31 - hExternalOrientationData->Quaternions[subframe_idx].w_qfact); + 31 - hExternalOrientationData->Quaternions[subframe_idx].q_fact); hExternalOrientationData->Quaternions[subframe_idx].x = me2f(hExternalOrientationData->Quaternions[subframe_idx].x_fx, - 31 - hExternalOrientationData->Quaternions[subframe_idx].x_qfact); + 31 - hExternalOrientationData->Quaternions[subframe_idx].q_fact); hExternalOrientationData->Quaternions[subframe_idx].y = me2f(hExternalOrientationData->Quaternions[subframe_idx].y_fx, - 31 - hExternalOrientationData->Quaternions[subframe_idx].y_qfact); + 31 - hExternalOrientationData->Quaternions[subframe_idx].q_fact); hExternalOrientationData->Quaternions[subframe_idx].z = me2f(hExternalOrientationData->Quaternions[subframe_idx].z_fx, - 31 - hExternalOrientationData->Quaternions[subframe_idx].z_qfact); + 31 - hExternalOrientationData->Quaternions[subframe_idx].q_fact); #else /* Move external orientation data to the decoder handle (invert orientations) */ QuaternionInverse( orientation, &hExternalOrientationData->Quaternions[subframe_idx] ); diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 9ee54f329..f8e2a9a17 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -649,13 +649,13 @@ ivas_error ivas_td_binaural_renderer_unwrap( tmp_Quaternions->x_fx = float_to_fix(tmp_Quaternions->x, quat_q); tmp_Quaternions->y_fx = float_to_fix(tmp_Quaternions->y, quat_q); tmp_Quaternions->z_fx = float_to_fix(tmp_Quaternions->z, quat_q); - tmp_Quaternions->w_qfact = tmp_Quaternions->x_qfact = tmp_Quaternions->y_qfact = tmp_Quaternions->z_qfact = quat_q; + tmp_Quaternions->q_fact = quat_q; Word16 pos_q = Q25; tmp_Pos->x_fx = (Word32)float_to_fix(tmp_Pos->x, pos_q); tmp_Pos->y_fx = (Word32)float_to_fix(tmp_Pos->y, pos_q); tmp_Pos->z_fx = (Word32)float_to_fix(tmp_Pos->z, pos_q); - tmp_Pos->x_qfact = tmp_Pos->y_qfact = tmp_Pos->z_qfact = pos_q; + tmp_Pos->q_fact= pos_q; for (int i = 0; i < 3; i++) { hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(hBinRendererTd->Listener_p->Front[i], Q30); @@ -1218,10 +1218,7 @@ ivas_error TDREND_Update_listener_orientation_fx( { Word16 Rmat_q; - assert(headPosition_fx->w_qfact == headPosition_fx->x_qfact - && headPosition_fx->x_qfact == headPosition_fx->y_qfact - && headPosition_fx->y_qfact == headPosition_fx->z_qfact); - headPosition_q = headPosition_fx->w_qfact; // Assuming Q is same for w, x, y and z + headPosition_q = headPosition_fx->q_fact; move16(); /* Obtain head rotation matrix */ @@ -1242,10 +1239,6 @@ ivas_error TDREND_Update_listener_orientation_fx( IF ( Pos_fx != NULL ) { - // Assuming Q is same for x, y and z - assert((*Pos_fx).x_qfact == (*Pos_fx).y_qfact && (*Pos_fx).y_qfact == (*Pos_fx).z_qfact ); - assert((*Pos_fx).x_qfact == hBinRendererTd->Listener_p->Pos_q ); - /* Input position */ Pos_p_fx[0] = ( *Pos_fx ).x_fx; Pos_p_fx[1] = ( *Pos_fx ).y_fx; diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 21873782f..b570c8216 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -84,7 +84,7 @@ static IVAS_QUATERNION IdentityQuaternion_fx( q.w_fx = ONE_IN_Q31; q.x_fx = q.y_fx = q.z_fx = 0; - q.w_qfact = q.x_qfact = q.y_qfact = q.z_qfact = Q31; + q.q_fact = Q31; return q; } @@ -119,90 +119,15 @@ void QuaternionProduct_fx( IVAS_QUATERNION *const r ) { IVAS_QUATERNION tmp; - Word64 mul[4] = { 0 }; - Word16 q_min, q_fact[4] = { 0 }; - mul[0] = W_mult0_32_32( q1.w_fx, q2.w_fx ); - q_fact[0] = q1.w_qfact + q2.w_qfact; - mul[1] = W_mult0_32_32( q1.x_fx, q2.x_fx ); - q_fact[1] = q1.x_qfact + q2.x_qfact; - mul[2] = W_mult0_32_32( q1.y_fx, q2.y_fx ); - q_fact[2] = q1.y_qfact + q2.y_qfact; - mul[3] = W_mult0_32_32( q1.z_fx, q2.z_fx ); - q_fact[3] = q1.z_qfact + q2.z_qfact; - q_min = q_fact[0]; - for ( int i = 0; i < 4; i++ ) - { - q_min = s_min( q_min, q_fact[i] ); - } - mul[2] = W_add( ( W_shr( mul[2], ( sub( q_fact[2], q_min ) ) ) ), ( W_shr( mul[3], ( sub( q_fact[3], q_min ) ) ) ) ); - q_fact[2] = q_min; - mul[1] = W_add( ( W_shr( mul[1], ( sub( q_fact[1], q_min ) ) ) ), ( W_shr( mul[2], ( sub( q_fact[2], q_min ) ) ) ) ); - q_fact[1] = q_min; - tmp.w_fx = W_extract_h( W_sub( ( W_shr( mul[0], ( sub( q_fact[0], q_min ) ) ) ), ( W_shr( mul[1], ( sub( q_fact[1], q_min ) ) ) ) ) ); - tmp.w_qfact = q_min - 32; - - mul[0] = W_mult0_32_32( q1.w_fx, q2.x_fx ); - q_fact[0] = q1.w_qfact + q2.x_qfact; - mul[1] = W_mult0_32_32( q1.x_fx, q2.w_fx ); - q_fact[1] = q1.x_qfact + q2.w_qfact; - mul[2] = W_mult0_32_32( q1.y_fx, q2.z_fx ); - q_fact[2] = q1.y_qfact + q2.z_qfact; - mul[3] = W_mult0_32_32( q1.z_fx, q2.y_fx ); - q_fact[3] = q1.z_qfact + q2.y_qfact; - q_min = q_fact[0]; - for ( int i = 0; i < 4; i++ ) - { - q_min = s_min( q_min, q_fact[i] ); - } - mul[1] = W_add( ( W_shr( mul[0], ( sub( q_fact[0], q_min ) ) ) ), ( W_shr( mul[1], ( sub( q_fact[1], q_min ) ) ) ) ); - q_fact[1] = q_min; - mul[2] = W_add( ( W_shr( mul[1], ( sub( q_fact[1], q_min ) ) ) ), ( W_shr( mul[2], ( sub( q_fact[2], q_min ) ) ) ) ); - q_fact[2] = q_min; - tmp.x_fx = W_extract_h( W_sub( ( W_shr( mul[2], ( sub( q_fact[2], q_min ) ) ) ), ( W_shr( mul[3], ( sub( q_fact[3], q_min ) ) ) ) ) ); - tmp.x_qfact = q_min - 32; - - mul[0] = W_mult0_32_32( q1.w_fx, q2.y_fx ); - q_fact[0] = q1.w_qfact + q2.y_qfact; - mul[1] = W_mult0_32_32( q1.x_fx, q2.z_fx ); - q_fact[1] = q1.x_qfact + q2.z_qfact; - mul[2] = W_mult0_32_32( q1.y_fx, q2.w_fx ); - q_fact[2] = q1.y_qfact + q2.w_qfact; - mul[3] = W_mult0_32_32( q1.z_fx, q2.x_fx ); - q_fact[3] = q1.z_qfact + q2.x_qfact; - q_min = q_fact[0]; - for ( int i = 0; i < 4; i++ ) - { - q_min = s_min( q_min, q_fact[i] ); - } - mul[2] = W_add( ( W_shr( mul[0], ( sub( q_fact[0], q_min ) ) ) ), ( W_shr( mul[2], ( sub( q_fact[2], q_min ) ) ) ) ); - q_fact[2] = q_min; - mul[3] = W_add( ( W_shr( mul[2], ( sub( q_fact[2], q_min ) ) ) ), ( W_shr( mul[3], ( sub( q_fact[3], q_min ) ) ) ) ); - q_fact[3] = q_min; - tmp.y_fx = W_extract_h( W_sub( ( W_shr( mul[3], ( sub( q_fact[3], q_min ) ) ) ), ( W_shr( mul[1], ( sub( q_fact[1], q_min ) ) ) ) ) ); - tmp.y_qfact = q_min - 32; - - mul[0] = W_mult0_32_32( q1.w_fx, q2.z_fx ); - q_fact[0] = q1.w_qfact + q2.z_qfact; - mul[1] = W_mult0_32_32( q1.x_fx, q2.y_fx ); - q_fact[1] = q1.x_qfact + q2.y_qfact; - mul[2] = W_mult0_32_32( q1.y_fx, q2.x_fx ); - q_fact[2] = q1.y_qfact + q2.x_qfact; - mul[3] = W_mult0_32_32( q1.z_fx, q2.w_fx ); - q_fact[3] = q1.z_qfact + q2.w_qfact; - q_min = q_fact[0]; - for ( int i = 0; i < 4; i++ ) - { - q_min = s_min( q_min, q_fact[i] ); - } - mul[1] = W_add( ( W_shr( mul[0], ( sub( q_fact[0], q_min ) ) ) ), ( W_shr( mul[1], ( sub( q_fact[1], q_min ) ) ) ) ); - q_fact[1] = q_min; - mul[3] = W_add( ( W_shr( mul[1], ( sub( q_fact[1], q_min ) ) ) ), ( W_shr( mul[3], ( sub( q_fact[3], q_min ) ) ) ) ); - q_fact[3] = q_min; - tmp.z_fx = W_extract_h( W_sub( ( W_shr( mul[3], ( sub( q_fact[3], q_min ) ) ) ), ( W_shr( mul[2], ( sub( q_fact[2], q_min ) ) ) ) ) ); - tmp.z_qfact = q_min - 32; - *r = tmp; + //once verify// + tmp.w_fx = L_sub( ( L_sub( Mpy_32_32( q1.w_fx, q2.w_fx ), Mpy_32_32( q1.x_fx, q2.x_fx ) ) ), ( L_add( Mpy_32_32( q1.y_fx, q2.y_fx ), Mpy_32_32( q1.z_fx, q2.z_fx ) ) ) ); + tmp.x_fx = L_add( ( L_add( Mpy_32_32( q1.w_fx, q2.x_fx ), Mpy_32_32( q1.x_fx, q2.w_fx ) ) ), ( L_sub( Mpy_32_32( q1.y_fx, q2.z_fx ), Mpy_32_32( q1.z_fx, q2.y_fx ) ) ) ); + tmp.y_fx = L_add( ( L_sub( Mpy_32_32( q1.w_fx, q2.y_fx ), Mpy_32_32( q1.x_fx, q2.z_fx ) ) ), ( L_add( Mpy_32_32( q1.y_fx, q2.w_fx ), Mpy_32_32( q1.z_fx, q2.x_fx ) ) ) ); + tmp.z_fx = L_sub( ( L_add( Mpy_32_32( q1.w_fx, q2.z_fx ), Mpy_32_32( q1.x_fx, q2.y_fx ) ) ), ( L_sub( Mpy_32_32( q1.y_fx, q2.x_fx ), Mpy_32_32( q1.z_fx, q2.w_fx ) ) ) ); + tmp.q_fact = sub(add(q1.q_fact, q2.q_fact), 31); + *r = tmp; return; } #endif @@ -226,51 +151,12 @@ static Word32 QuaternionDotProduct_fx( const IVAS_QUATERNION q2, Word16 *q_fact ) { - Word32 a[4], b[4] = { 0 }; - Word64 mult_res[4] = { 0 }; - Word16 a_q[4], b_q[4], mult_res_q[4] = { 0 }; + Word32 result = 0; - Word16 result_q = 0; - a[0] = q1.w_fx; - a_q[0] = q1.w_qfact; - a[1] = q1.x_fx; - a_q[1] = q1.x_qfact; - a[2] = q1.y_fx; - a_q[2] = q1.y_qfact; - a[3] = q1.z_fx; - a_q[3] = q1.z_qfact; - b[0] = q2.w_fx; - b_q[0] = q2.w_qfact; - b[1] = q2.x_fx; - b_q[1] = q2.x_qfact; - b[2] = q2.y_fx; - b_q[2] = q2.y_qfact; - b[3] = q2.z_fx; - b_q[3] = q2.z_qfact; - - for ( int i = 0; i < 4; i++ ) - { - mult_res[i] = W_mult0_32_32( a[i], b[i] ); - // mult_res_e[i] = ( 31 - ( a_q[i] + b_q[i] - 31 ) ); - mult_res_q[i] = a_q[i] + b_q[i]; - } - for ( int j = 0; j < 3; j++ ) - { - IF( GT_16( mult_res_q[j], mult_res_q[j + 1] ) ) - { - mult_res[j] = W_shr( mult_res[j], ( mult_res_q[j] - mult_res_q[j + 1] ) ); - result_q = mult_res_q[j + 1]; - } - ELSE - { - mult_res[j + 1] = W_shr( mult_res[j + 1], ( mult_res_q[j + 1] - mult_res_q[j] ) ); - result_q = mult_res_q[j]; - } - mult_res[j + 1] = W_add( mult_res[j], mult_res[j + 1] ); - mult_res_q[j + 1] = result_q; - } - result = W_extract_h( mult_res[3] ); - *q_fact = result_q - 32; + + result = L_add( ( L_add( Mpy_32_32( q1.x_fx, q2.x_fx ), Mpy_32_32( q1.y_fx, q2.y_fx ) ) ), ( L_add( Mpy_32_32( q1.z_fx, q2.z_fx ), Mpy_32_32( q1.w_fx, q2.w_fx ) ) ) ); + + *q_fact = sub( add( q1.q_fact, q2.q_fact ), 31 ); return result; } @@ -302,21 +188,31 @@ static void QuaternionDivision_fx( IVAS_QUATERNION *const r, Word16 den_e ) { - Word16 scale_e, result_e = 0; - r->w_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.w_fx), d, &scale_e)); - result_e = scale_e + ((31 - q.w_qfact) - den_e); // e+e1-e2// - r->w_qfact = 31 - result_e; - r->x_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.x_fx), d, &scale_e)); - result_e = scale_e + ((31 - q.x_qfact) - den_e); - r->x_qfact = 31 - result_e; - r->y_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.y_fx), d, &scale_e)); - result_e = scale_e + ((31 - q.y_qfact) - den_e); - r->y_qfact = 31 - result_e; - r->z_fx = L_deposit_h(BASOP_Util_Divide3232_Scale((q.z_fx), d, &scale_e)); - result_e = scale_e + ((31 - q.z_qfact) - den_e); - r->z_qfact = 31 - result_e; + Word16 scale_e, result_e = 0, w_q, x_q, y_q, z_q, result_q; + + r->w_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.w_fx ), d, &scale_e ); + result_e = scale_e + ( ( 31 - q.q_fact ) - den_e ); // e+e1-e2// + w_q = 31 - result_e; + + r->x_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.x_fx ), d, &scale_e ); + result_e = scale_e + ( ( 31 - q.q_fact ) - den_e ); + x_q = 31 - result_e; + + r->y_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.y_fx ), d, &scale_e ); + result_e = scale_e + ( ( 31 - q.q_fact ) - den_e ); + y_q = 31 - result_e; + r->z_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.z_fx ), d, &scale_e ); + result_e = scale_e + ( ( 31 - q.q_fact ) - den_e ); + z_q = 31 - result_e; + result_q = sub(s_min( s_min( w_q, x_q ), s_min( y_q, z_q ) ), 1); //gaurdbits// + + r->w_fx = L_shr( r->w_fx, sub( w_q, result_q ) ); + r->x_fx = L_shr( r->x_fx, sub( x_q, result_q ) ); + r->y_fx = L_shr( r->y_fx, sub( y_q, result_q ) ); + r->z_fx = L_shr( r->z_fx, sub( z_q, result_q ) ); + r->q_fact = result_q; } #endif @@ -433,20 +329,19 @@ void QuaternionSlerp_fx( QuaternionNormalize_fx( q1_fx, &r1 ); QuaternionNormalize_fx( q2_fx, &r2 ); - Word16 q_dot = 0; + Word16 w_qfact, x_qfact, y_qfact, z_qfact, q_result, q_dot = 0; cosPhi = QuaternionDotProduct_fx( r1, r2, &q_dot ); - q_min = s_min( s_min( r1.w_qfact, r1.x_qfact ), s_min( r1.y_qfact, r1.z_qfact ) ); - q_min = s_min( q_min, s_min( s_min( r1.w_qfact, r1.x_qfact ), s_min( r1.y_qfact, r1.z_qfact ) ) ); - r1.w_fx = L_shr( r1.w_fx, sub( r1.w_qfact, q_min ) ); - r1.x_fx = L_shr( r1.x_fx, sub( r1.x_qfact, q_min ) ); - r1.y_fx = L_shr( r1.y_fx, sub( r1.y_qfact, q_min ) ); - r1.z_fx = L_shr( r1.z_fx, sub( r1.z_qfact, q_min ) ); - r2.w_fx = L_shr( r2.w_fx, sub( r2.w_qfact, q_min ) ); - r2.x_fx = L_shr( r2.x_fx, sub( r2.x_qfact, q_min ) ); - r2.y_fx = L_shr( r2.y_fx, sub( r2.y_qfact, q_min ) ); - r2.z_fx = L_shr( r2.z_fx, sub( r2.z_qfact, q_min ) ); - r1.w_qfact = r1.x_qfact = r1.y_qfact = r1.z_qfact = r2.w_qfact = r2.x_qfact = r2.y_qfact = r2.z_qfact = q_min; + q_min = s_min( r1.q_fact, r2.q_fact ); + r1.w_fx = L_shr( r1.w_fx, sub( r1.q_fact, q_min ) ); + r1.x_fx = L_shr( r1.x_fx, sub( r1.q_fact, q_min ) ); + r1.y_fx = L_shr( r1.y_fx, sub( r1.q_fact, q_min ) ); + r1.z_fx = L_shr( r1.z_fx, sub( r1.q_fact, q_min ) ); + r2.w_fx = L_shr( r2.w_fx, sub( r2.q_fact, q_min ) ); + r2.x_fx = L_shr( r2.x_fx, sub( r2.q_fact, q_min ) ); + r2.y_fx = L_shr( r2.y_fx, sub( r2.q_fact, q_min ) ); + r2.z_fx = L_shr( r2.z_fx, sub( r2.q_fact, q_min ) ); + r1.q_fact = r2.q_fact = q_min; IF( LT_32( cosPhi, 0 ) ) { @@ -466,7 +361,7 @@ void QuaternionSlerp_fx( r_fx->y_fx = L_add( L_shr( r1.y_fx, 1 ), Mpy_32_32( L_sub( r2.y_fx, r1.y_fx ), t_fx ) ); // q_min-1 r_fx->z_fx = L_add( L_shr( r1.z_fx, 1 ), Mpy_32_32( L_sub( r2.z_fx, r1.z_fx ), t_fx ) ); // q_min-1 - r2.w_qfact = r2.x_qfact = r2.y_qfact = r2.z_qfact = sub( q_min, 1 ); + r_fx->q_fact = sub( q_min, 1 ); } ELSE { @@ -476,39 +371,45 @@ void QuaternionSlerp_fx( phi = BASOP_util_atan2( sinPhi, cosPhi, sub( sin_e, sub( 31, q_dot ) ) ); // Q13 - temp_32 = L_shl(Mpy_32_16_1( L_sub( ONE_IN_Q30, t_fx ), phi ),1); // Q29 + temp_32 = L_shl( Mpy_32_16_1( L_sub( ONE_IN_Q30, t_fx ), phi ), 1 ); // Q29 temp_16 = extract_h( temp_32 ); // Q13 s1 = getSineWord16R2( mult( temp_16, 20860 ) ); // Q15 - temp_32 = L_shl(Mpy_32_16_1( t_fx, phi ),1); // Q29 + temp_32 = L_shl( Mpy_32_16_1( t_fx, phi ), 1 ); // Q29 temp_16 = extract_h( temp_32 ); // Q13 s2 = getSineWord16R2( mult( temp_16, 20860 ) ); // Q15 temp_32 = L_add( Mpy_32_16_1( r1.w_fx, s1 ), Mpy_32_16_1( r2.w_fx, s2 ) ); // q_min - r_fx->w_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + r_fx->w_fx = BASOP_Util_Divide3232_Scale_cadence( temp_32, sinPhi, &e_div ); e_div = e_div + ( 31 - q_min - sin_e ); - r_fx->w_qfact = 31 - e_div; + w_qfact = 31 - e_div; temp_32 = L_add( Mpy_32_16_1( r1.x_fx, s1 ), Mpy_32_16_1( r2.x_fx, s2 ) ); // q_min - r_fx->x_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + r_fx->x_fx = BASOP_Util_Divide3232_Scale_cadence( temp_32, sinPhi, &e_div ); e_div = e_div + ( 31 - q_min - sin_e ); - r_fx->x_qfact = 31 - e_div; + x_qfact = 31 - e_div; temp_32 = L_add( Mpy_32_16_1( r1.y_fx, s1 ), Mpy_32_16_1( r2.y_fx, s2 ) ); // q_min - r_fx->y_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + r_fx->y_fx = BASOP_Util_Divide3232_Scale_cadence( temp_32, sinPhi, &e_div ); e_div = e_div + ( 31 - q_min - sin_e ); - r_fx->y_qfact = 31 - e_div; + y_qfact = 31 - e_div; temp_32 = L_add( Mpy_32_16_1( r1.z_fx, s1 ), Mpy_32_16_1( r2.z_fx, s2 ) ); // q_min - r_fx->z_fx = L_deposit_h(BASOP_Util_Divide3232_Scale( temp_32, sinPhi, &e_div )); + r_fx->z_fx = BASOP_Util_Divide3232_Scale_cadence( temp_32, sinPhi, &e_div ); e_div = e_div + ( 31 - q_min - sin_e ); - r_fx->z_qfact = 31 - e_div; + z_qfact = 31 - e_div; + + q_result = s_min( s_min( w_qfact, x_qfact ), s_min( y_qfact, z_qfact ) ); + r_fx->w_fx = L_shr( r_fx->w_fx, sub( w_qfact, q_result ) ); + r_fx->x_fx = L_shr( r_fx->x_fx, sub( x_qfact, q_result ) ); + r_fx->y_fx = L_shr( r_fx->y_fx, sub( y_qfact, q_result ) ); + r_fx->z_fx = L_shr( r_fx->z_fx, sub( z_qfact, q_result ) ); + r_fx->q_fact = q_result; } - QuaternionNormalize_fx(*r_fx, r_fx); + QuaternionNormalize_fx( *r_fx, r_fx ); return; - } #endif @@ -539,10 +440,8 @@ static void QuaternionConjugate_fx( r->x_fx = L_negate( q.x_fx ); r->y_fx = L_negate( q.y_fx ); r->z_fx = L_negate( q.z_fx ); - r->w_qfact = q.w_qfact; - r->x_qfact = q.x_qfact; - r->y_qfact = q.y_qfact; - r->z_qfact = q.z_qfact; + r->q_fact = q.q_fact; + return; } #endif @@ -577,38 +476,33 @@ static Word32 QuaternionAngle_fx( QuaternionConjugate_fx( q1, &q12 ); QuaternionProduct_fx( q12, q2, &q12 ); // q12:Q25, q2:Q29, q1: Q27// - Word16 sign_bit = ( L_shr( q12.w_fx, 31 ) ) & ( 1 ); - IF( NE_16( sign_bit, 1 ) ) + + IF( LT_32( q12.w_fx, 0 ) ) { Word32 temp = 0; Word16 q_dot, result_e = 0; temp = q12.w_fx; q12.w_fx = 0; Word32 result = 0; - q12.x_fx = L_shl( q12.x_fx, ( 31 - q12.x_qfact ) ); // Q31 - q12.y_fx = L_shl( q12.y_fx, ( 31 - q12.y_qfact ) ); - q12.z_fx = L_shl( q12.z_fx, ( 31 - q12.z_qfact ) ); result = QuaternionDotProduct_fx( q12, q12, &q_dot ); - q_dot = Q31; - q12.x_fx = L_shr( q12.x_fx, ( 31 - q12.x_qfact ) ); // original Q - q12.y_fx = L_shr( q12.y_fx, ( 31 - q12.y_qfact ) ); - q12.z_fx = L_shr( q12.z_fx, ( 31 - q12.z_qfact ) ); + result_e = sub( 31, q_dot ); result = Sqrt32( result, &result_e ); q12.w_fx = temp; + // Converting numerator to same Q as denominator// IF( GT_32( 0, result_e ) ) { - result = L_shr( L_shr( result, -1 * ( result_e ) ), ( 31 - q12.x_qfact ) ); // Q25 + result = L_shr( L_shr( result, -1 * ( result_e ) ), sub( 31, q12.q_fact ) ); // Q25 } ELSE { - IF( GT_32( result_e, ( 31 - q12.x_qfact ) ) ) + IF( GT_32( result_e, ( 31 - q12.q_fact ) ) ) { - result = L_shl( result, ( result_e - ( 31 - q12.x_qfact ) ) ); + result = L_shl( result, ( result_e - ( 31 - q12.q_fact ) ) ); } ELSE { - result = L_shr( result, ( ( 31 - q12.x_qfact ) - result_e ) ); + result = L_shr( result, ( ( 31 - q12.q_fact ) - result_e ) ); } } IF( GT_32( q12.w_fx, result ) ) @@ -691,15 +585,21 @@ static IVAS_VECTOR3 VectorSubtract_fx( const IVAS_VECTOR3 p2 ) { IVAS_VECTOR3 result; - Word16 e_result = 0; - result.x_fx = BASOP_Util_Add_Mant32Exp( p1.x_fx, ( 31 - p1.x_qfact ), ( L_negate( p2.x_fx ) ), ( 31 - p2.x_qfact ), &e_result ); - result.x_qfact = 31 - e_result; + Word16 e_result = 0, x_qfact, y_qfact, z_qfact, q_result; + result.x_fx = BASOP_Util_Add_Mant32Exp( p1.x_fx, ( 31 - p1.q_fact ), ( L_negate( p2.x_fx ) ), ( 31 - p2.q_fact ), &e_result ); + x_qfact = sub( 31, e_result ); + + result.y_fx = BASOP_Util_Add_Mant32Exp( p1.y_fx, ( 31 - p1.q_fact ), ( L_negate( p2.y_fx ) ), ( 31 - p2.q_fact ), &e_result ); + y_qfact = sub( 31, e_result ); - result.y_fx = BASOP_Util_Add_Mant32Exp( p1.y_fx, ( 31 - p1.y_qfact ), ( L_negate( p2.y_fx ) ), ( 31 - p2.y_qfact ), &e_result ); - result.y_qfact = 31 - e_result; + result.z_fx = BASOP_Util_Add_Mant32Exp( p1.z_fx, ( 31 - p1.q_fact ), ( L_negate( p2.z_fx ) ), ( 31 - p2.q_fact ), &e_result ); + z_qfact = sub( 31, e_result ); - result.z_fx = BASOP_Util_Add_Mant32Exp( p1.z_fx, ( 31 - p1.z_qfact ), ( L_negate( p2.z_fx ) ), ( 31 - p2.z_qfact ), &e_result ); - result.z_qfact = 31 - e_result; + q_result = sub(s_min( s_min( x_qfact, y_qfact ), z_qfact ), 1); //guardbit// + result.x_fx = L_shr( result.x_fx, sub( x_qfact, q_result ) ); + result.y_fx = L_shr( result.y_fx, sub( y_qfact, q_result ) ); + result.z_fx = L_shr( result.z_fx, sub( z_qfact, q_result ) ); + result.q_fact = q_result; return result; } @@ -730,30 +630,11 @@ static IVAS_VECTOR3 VectorCrossProduct_fx( const IVAS_VECTOR3 p2 ) { IVAS_VECTOR3 result_fx; - Word32 mul1, mul2; - Word16 e_result = 0, q_mul1, q_mul2; - mul1 = Mpy_32_32( p1.y_fx, p2.z_fx ); - mul2 = Mpy_32_32( p1.z_fx, p2.y_fx ); - q_mul1 = p1.y_qfact + p2.z_qfact - 31; - q_mul2 = p1.z_qfact + p2.y_qfact - 31; - - result_fx.x_fx = BASOP_Util_Add_Mant32Exp( mul1, ( 31 - q_mul1 ), ( L_negate( mul2 ) ), ( 31 - q_mul2 ), &e_result ); - result_fx.x_qfact = 31 - e_result; - - mul1 = Mpy_32_32( p1.z_fx, p2.x_fx ); - mul2 = Mpy_32_32( p1.x_fx, p2.z_fx ); - q_mul1 = p1.z_qfact + p2.x_qfact - 31; - q_mul2 = p1.x_qfact + p2.z_qfact - 31; - result_fx.y_fx = BASOP_Util_Add_Mant32Exp( mul1, ( 31 - q_mul1 ), ( L_negate( mul2 ) ), ( 31 - q_mul2 ), &e_result ); - result_fx.y_qfact = 31 - e_result; - - - mul1 = Mpy_32_32( p1.x_fx, p2.y_fx ); - mul2 = Mpy_32_32( p1.y_fx, p2.x_fx ); - q_mul1 = p1.x_qfact + p2.y_qfact - 31; - q_mul2 = p1.y_qfact + p2.x_qfact - 31; - result_fx.z_fx = BASOP_Util_Add_Mant32Exp( mul1, ( 31 - q_mul1 ), ( L_negate( mul2 ) ), ( 31 - q_mul2 ), &e_result ); - result_fx.z_qfact = 31 - e_result; + + result_fx.x_fx = L_sub( Mpy_32_32( p1.y_fx, p2.z_fx ), Mpy_32_32( p1.z_fx, p2.y_fx ) ); + result_fx.y_fx = L_sub( Mpy_32_32( p1.z_fx, p2.x_fx ), Mpy_32_32( p1.x_fx, p2.z_fx ) ); + result_fx.z_fx = L_sub( Mpy_32_32( p1.x_fx, p2.y_fx ), Mpy_32_32( p1.y_fx, p2.x_fx ) ); + result_fx.q_fact = sub(add(p1.q_fact, p2.q_fact), 31); return result_fx; } @@ -778,25 +659,10 @@ static Word32 VectorDotProduct_fx( const IVAS_VECTOR3 p2, Word16 *q_fact ) { - Word32 mul[3] = { 0 }; Word32 result_fx = 0; - Word16 mul_q[3], q_min = 0; - mul[0] = Mpy_32_32( p1.x_fx, p2.x_fx ); - mul_q[0] = p1.x_qfact + p2.x_qfact - 31; - mul[1] = Mpy_32_32( p1.y_fx, p2.y_fx ); - mul_q[1] = p1.y_qfact + p2.y_qfact - 31; - mul[2] = Mpy_32_32( p1.z_fx, p2.z_fx ); - mul_q[2] = p1.z_qfact + p2.z_qfact - 31; - q_min = mul_q[0]; - FOR ( int i = 0; i < 3; i++ ) - { - q_min = s_min( q_min, mul_q[i] ); - } - FOR ( int j = 0; j < 3; j++ ) - { - result_fx = L_add( result_fx, L_shr( mul[j], ( sub( mul_q[j], q_min ) ) ) ); - } - *q_fact = q_min; + + result_fx = L_add( L_add( Mpy_32_32( p1.x_fx, p2.x_fx ), Mpy_32_32( p1.y_fx, p2.y_fx ) ), Mpy_32_32( p1.z_fx, p2.z_fx ) ); + *q_fact = sub(add(p1.q_fact, p2.q_fact), 31); return result_fx; } @@ -819,21 +685,10 @@ static Word32 VectorLength_fx( IVAS_VECTOR3 p, Word16 *q_fact ) { - Word32 mul[3] = { 0 }; Word32 result_fx = 0; - Word16 result_e = 0, q[3] = { 0 }; - mul[0] = Mpy_32_32( p.x_fx, p.x_fx ); - q[0] = 2 * p.x_qfact - 31; - mul[1] = Mpy_32_32( p.y_fx, p.y_fx ); - q[1] = 2 * p.y_qfact - 31; - mul[2] = Mpy_32_32( p.z_fx, p.z_fx ); - q[2] = 2 * p.z_qfact - 31; - FOR ( int j = 0; j < 3; j++ ) - { - result_fx = BASOP_Util_Add_Mant32Exp( result_fx, result_e, mul[j], 31 - q[j], &result_e ); - } - result_fx = Sqrt32( result_fx, &result_e ); - *q_fact = 31 - result_e; + result_fx = L_add(L_add(Mpy_32_32(p.x_fx, p.x_fx), Mpy_32_32(p.y_fx, p.y_fx)), Mpy_32_32(p.z_fx, p.z_fx)); + + *q_fact = sub(add(p.q_fact, p.q_fact), 31); return result_fx; } #endif @@ -864,19 +719,23 @@ static IVAS_VECTOR3 VectorNormalize_fx( { IVAS_VECTOR3 result_fx; Word32 length_fx; - Word16 q_len, scale = 0; + Word16 q_len, scale = 0, x_qfact, y_qfact, z_qfact, q_result; length_fx = VectorLength_fx( p, &q_len ); - Word16 div; - - div = BASOP_Util_Divide3232_Scale( p.x_fx, length_fx, &scale ); - result_fx.x_fx = L_deposit_h( div ); - result_fx.x_qfact = ( 31 - ( scale + ( q_len - p.x_qfact ) ) ); // e+(e1-e2)// - div = BASOP_Util_Divide3232_Scale( p.y_fx, length_fx, &scale ); - result_fx.y_fx = L_deposit_h( div ); - result_fx.y_qfact = ( 31 - ( scale + ( q_len - p.y_qfact ) ) ); - div = BASOP_Util_Divide3232_Scale( p.z_fx, length_fx, &scale ); - result_fx.z_fx = L_deposit_h( div ); - result_fx.z_qfact = ( 31 - ( scale + ( q_len - p.z_qfact ) ) ); + + result_fx.x_fx = BASOP_Util_Divide3232_Scale_cadence( p.x_fx, length_fx, &scale ); + x_qfact = ( 31 - ( scale + ( q_len - p.q_fact) ) ); // e+(e1-e2)// + + result_fx.y_fx = BASOP_Util_Divide3232_Scale_cadence( p.y_fx, length_fx, &scale ); + y_qfact = ( 31 - ( scale + ( q_len - p.q_fact) ) ); + + result_fx.z_fx = BASOP_Util_Divide3232_Scale_cadence( p.z_fx, length_fx, &scale ); + z_qfact = ( 31 - ( scale + ( q_len - p.q_fact) ) ); + + q_result = s_min(s_min(x_qfact, y_qfact), z_qfact); + result_fx.x_fx = L_shr(result_fx.x_fx, sub(x_qfact, q_result)); + result_fx.y_fx = L_shr(result_fx.y_fx, sub(y_qfact, q_result)); + result_fx.z_fx = L_shr(result_fx.z_fx, sub(z_qfact, q_result)); + result_fx.q_fact = q_result; return result_fx; } @@ -931,15 +790,16 @@ static void VectorRotationToQuaternion_fx( { IVAS_VECTOR3 cross_product_fx, p1_normalized_fx = { 0 }, p2_normalized_fx = { 0 }; Word32 dot_product_fx; - Word16 q_dot; + Word16 q_dot, e_add, q_result; p1_normalized_fx = VectorNormalize_fx( p1 ); p2_normalized_fx = VectorNormalize_fx( p2 ); cross_product_fx = VectorCrossProduct_fx( p1_normalized_fx, p2_normalized_fx ); dot_product_fx = VectorDotProduct_fx( p1_normalized_fx, p2_normalized_fx, &q_dot ); + // dot & cross product are same q// Word32 comp_fx = 0; - Word16 comp_e, check_flag, result_e = 0; + Word16 comp_e, check_flag; f2me( -0.999999f, &comp_fx, &comp_e ); IF( GT_32( dot_product_fx, 0 ) ) { @@ -947,7 +807,7 @@ static void VectorRotationToQuaternion_fx( } ELSE { - check_flag = BASOP_Util_Cmp_Mant32Exp( comp_fx, comp_e, dot_product_fx, 31 - q_dot ); + check_flag = BASOP_Util_Cmp_Mant32Exp( comp_fx, comp_e, dot_product_fx, sub( 31, q_dot ) ); } IF( EQ_16( check_flag, 1 ) ) { @@ -955,19 +815,22 @@ static void VectorRotationToQuaternion_fx( r->x_fx = 0; r->y_fx = 0; r->z_fx = ONE_IN_Q31; - r->w_qfact = r->x_qfact = r->y_qfact = r->z_qfact = Q31; + r->q_fact = Q31; } ELSE { /* all regular cases */ r->x_fx = cross_product_fx.x_fx; - r->x_qfact = cross_product_fx.x_qfact; r->y_fx = cross_product_fx.y_fx; - r->y_qfact = cross_product_fx.y_qfact; r->z_fx = cross_product_fx.z_fx; - r->z_qfact = cross_product_fx.z_qfact; - r->w_fx = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, dot_product_fx, 31 - q_dot, &result_e ); - r->w_qfact = 31 - result_e; + r->w_fx = BASOP_Util_Add_Mant32Exp( dot_product_fx, sub( 31, q_dot ), ONE_IN_Q31, 0, &e_add ); + q_result = sub(s_min( sub( 31, e_add ), q_dot ),1);//gaurd bits// + r->x_fx = L_shr( r->x_fx, sub( q_dot, q_result ) ); + r->y_fx = L_shr( r->y_fx, sub( q_dot, q_result ) ); + r->z_fx = L_shr( r->z_fx, sub( q_dot, q_result ) ); + r->w_fx = L_shr( r->w_fx, sub( sub( 31, e_add ), q_result ) ); + + r->q_fact = q_result; } QuaternionNormalize_fx( *r, r ); @@ -1025,10 +888,9 @@ ivas_error ivas_orient_trk_Init_fx( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - identity_fx.w_fx = float_to_fix( 1.0, Q30 ); - identity_fx.w_qfact = Q30; - identity_fx.x_fx = identity_fx.y_fx = identity_fx.z_fx = float_to_fix( 0.0, Q31 ); - identity_fx.x_qfact = identity_fx.y_qfact = identity_fx.z_qfact = Q31; + identity_fx.w_fx = ONE_IN_Q31; + identity_fx.x_fx = identity_fx.y_fx = identity_fx.z_fx = 0; + identity_fx.q_fact = Q31; /* configuration parameters */ pOTR->centerAdaptationRate_fx = C_ADP_RATE_Q31; @@ -1050,10 +912,10 @@ ivas_error ivas_orient_trk_Init_fx( /* set safe default tracking mode */ pOTR->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; pOTR->alpha = me2f(pOTR->alpha_fx, 0 ); - pOTR->refRot.w = pOTR->absAvgRot.w = pOTR->trkRot.w = fix_to_float(pOTR->trkRot.w_fx, pOTR->trkRot.w_qfact ); - pOTR->refRot.x = pOTR->absAvgRot.x = pOTR->trkRot.x = fix_to_float(pOTR->trkRot.x_fx, pOTR->trkRot.x_qfact ); - pOTR->refRot.y = pOTR->absAvgRot.y = pOTR->trkRot.y = fix_to_float(pOTR->trkRot.y_fx, pOTR->trkRot.y_qfact ); - pOTR->refRot.z = pOTR->absAvgRot.z = pOTR->trkRot.z = fix_to_float(pOTR->trkRot.z_fx, pOTR->trkRot.z_qfact ); + pOTR->refRot.w = pOTR->absAvgRot.w = pOTR->trkRot.w = fix_to_float(pOTR->trkRot.w_fx, pOTR->trkRot.q_fact); + pOTR->refRot.x = pOTR->absAvgRot.x = pOTR->trkRot.x = fix_to_float(pOTR->trkRot.x_fx, pOTR->trkRot.q_fact); + pOTR->refRot.y = pOTR->absAvgRot.y = pOTR->trkRot.y = fix_to_float(pOTR->trkRot.y_fx, pOTR->trkRot.q_fact); + pOTR->refRot.z = pOTR->absAvgRot.z = pOTR->trkRot.z = fix_to_float(pOTR->trkRot.z_fx, pOTR->trkRot.q_fact); return IVAS_ERR_OK; } @@ -1322,12 +1184,12 @@ ivas_error ivas_orient_trk_SetReferenceVector_fx( Word32 acousticFrontVectorLength; Word16 acousticFrontVector_q; - IF ( pOTR == NULL ) + IF( pOTR == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - SWITCH ( pOTR->orientation_tracking ) + SWITCH( pOTR->orientation_tracking ) { case IVAS_HEAD_ORIENT_TRK_NONE: case IVAS_HEAD_ORIENT_TRK_REF: @@ -1338,22 +1200,25 @@ ivas_error ivas_orient_trk_SetReferenceVector_fx( case IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV: /* ignore the height difference between listener position and reference position */ listenerPosLevel.z_fx = refPosLevel.z_fx = listenerPos.z_fx; - listenerPosLevel.z_qfact = refPosLevel.z_qfact = listenerPos.z_qfact; listenerPosLevel.x_fx = listenerPos.x_fx; - listenerPosLevel.x_qfact = listenerPos.x_qfact; listenerPosLevel.y_fx = listenerPos.y_fx; - listenerPosLevel.y_qfact = listenerPos.y_qfact; + listenerPosLevel.q_fact = listenerPos.q_fact; + refPosLevel.x_fx = refPos.x_fx; - refPosLevel.x_qfact = refPos.x_qfact; refPosLevel.y_fx = refPos.y_fx; - refPosLevel.y_qfact = refPos.y_qfact; + Word16 q_min = s_min( listenerPos.q_fact, refPos.q_fact ); + refPosLevel.x_fx = L_shr( refPosLevel.x_fx, sub( refPos.q_fact, q_min ) ); + refPosLevel.y_fx = L_shr( refPosLevel.y_fx, sub( refPos.q_fact, q_min ) ); + refPosLevel.z_fx = L_shr( refPosLevel.z_fx, sub( listenerPos.q_fact, q_min ) ); + refPosLevel.q_fact = q_min; + acousticFrontVector = VectorSubtract_fx( listenerPosLevel, refPosLevel ); BREAK; default: return IVAS_ERR_WRONG_PARAMS; } - acousticFrontVectorLength = VectorLength_fx( acousticFrontVector, &acousticFrontVector_q ); + acousticFrontVectorLength = VectorLength_fx( acousticFrontVector, &acousticFrontVector.q_fact ); /* if the length is zero, the user has entered insensible listener and reference positions */ IF( LE_32( acousticFrontVectorLength, 0 ) ) { @@ -1363,7 +1228,7 @@ ivas_error ivas_orient_trk_SetReferenceVector_fx( ivasForwardVector.x_fx = L_negate( ONE_IN_Q31 ); ivasForwardVector.y_fx = 0; ivasForwardVector.z_fx = 0; - ivasForwardVector.x_qfact = ivasForwardVector.y_qfact = ivasForwardVector.z_qfact = Q31; + ivasForwardVector.q_fact = Q31; VectorRotationToQuaternion_fx( ivasForwardVector, acousticFrontVector, &pOTR->refRot ); return IVAS_ERR_OK; @@ -1483,22 +1348,22 @@ ivas_error ivas_orient_trk_Process_fx( Word32 cutoffFrequency_fx, cutoff_prod; Word16 q_cutoff_prod = 0; Word32 alpha_fx = float_to_fix( alpha, Q30 ); - pOTR->refRot.w_qfact = pOTR->refRot.x_qfact = pOTR->refRot.y_qfact = pOTR->refRot.z_qfact = Q29; - absRot.w_qfact = absRot.x_qfact = absRot.y_qfact = absRot.z_qfact = Q29; - pOTR->absAvgRot.w_qfact = pOTR->absAvgRot.x_qfact = pOTR->absAvgRot.y_qfact = pOTR->absAvgRot.z_qfact = Q29; + pOTR->refRot.q_fact = pOTR->refRot.q_fact = pOTR->refRot.q_fact = pOTR->refRot.q_fact = Q29; + absRot.q_fact = absRot.q_fact = absRot.q_fact = absRot.q_fact = Q29; + pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = Q29; updateRate_fx = float_to_fix( updateRate, Q23 ); // value is 200// - absRot.w_fx = float_to_fix( absRot.w, absRot.w_qfact ); - absRot.x_fx = float_to_fix( absRot.x, absRot.x_qfact ); - absRot.y_fx = float_to_fix( absRot.y, absRot.y_qfact ); - absRot.z_fx = float_to_fix( absRot.z, absRot.z_qfact ); - pOTR->refRot.w_fx = float_to_fix( pOTR->refRot.w, pOTR->refRot.w_qfact ); - pOTR->refRot.x_fx = float_to_fix( pOTR->refRot.x, pOTR->refRot.x_qfact ); - pOTR->refRot.y_fx = float_to_fix( pOTR->refRot.y, pOTR->refRot.y_qfact ); - pOTR->refRot.z_fx = float_to_fix( pOTR->refRot.z, pOTR->refRot.z_qfact ); - pOTR->absAvgRot.w_fx = float_to_fix( pOTR->absAvgRot.w, pOTR->absAvgRot.w_qfact ); - pOTR->absAvgRot.x_fx = float_to_fix( pOTR->absAvgRot.x, pOTR->absAvgRot.x_qfact ); - pOTR->absAvgRot.y_fx = float_to_fix( pOTR->absAvgRot.y, pOTR->absAvgRot.y_qfact ); - pOTR->absAvgRot.z_fx = float_to_fix( pOTR->absAvgRot.z, pOTR->absAvgRot.z_qfact ); + absRot.w_fx = float_to_fix( absRot.w, absRot.q_fact); + absRot.x_fx = float_to_fix( absRot.x, absRot.q_fact); + absRot.y_fx = float_to_fix( absRot.y, absRot.q_fact); + absRot.z_fx = float_to_fix( absRot.z, absRot.q_fact); + pOTR->refRot.w_fx = float_to_fix( pOTR->refRot.w, pOTR->refRot.q_fact); + pOTR->refRot.x_fx = float_to_fix( pOTR->refRot.x, pOTR->refRot.q_fact); + pOTR->refRot.y_fx = float_to_fix( pOTR->refRot.y, pOTR->refRot.q_fact); + pOTR->refRot.z_fx = float_to_fix( pOTR->refRot.z, pOTR->refRot.q_fact); + pOTR->absAvgRot.w_fx = float_to_fix( pOTR->absAvgRot.w, pOTR->absAvgRot.q_fact); + pOTR->absAvgRot.x_fx = float_to_fix( pOTR->absAvgRot.x, pOTR->absAvgRot.q_fact); + pOTR->absAvgRot.y_fx = float_to_fix( pOTR->absAvgRot.y, pOTR->absAvgRot.q_fact); + pOTR->absAvgRot.z_fx = float_to_fix( pOTR->absAvgRot.z, pOTR->absAvgRot.q_fact); IF ( pOTR == NULL || pTrkRot == NULL ) { @@ -1587,14 +1452,14 @@ ivas_error ivas_orient_trk_Process_fx( IF ( result == IVAS_ERR_OK ) { - pOTR->trkRot.w = me2f( pOTR->trkRot.w_fx, 31 - pOTR->trkRot.w_qfact ); - pOTR->trkRot.x = me2f( pOTR->trkRot.x_fx, 31 - pOTR->trkRot.x_qfact ); - pOTR->trkRot.y = me2f( pOTR->trkRot.y_fx, 31 - pOTR->trkRot.y_qfact ); - pOTR->trkRot.z = me2f( pOTR->trkRot.z_fx, 31 - pOTR->trkRot.z_qfact ); - pOTR->absAvgRot.w = me2f( pOTR->absAvgRot.w_fx, 31 - pOTR->absAvgRot.w_qfact ); - pOTR->absAvgRot.x = me2f( pOTR->absAvgRot.x_fx, 31 - pOTR->absAvgRot.x_qfact ); - pOTR->absAvgRot.y = me2f( pOTR->absAvgRot.y_fx, 31 - pOTR->absAvgRot.y_qfact ); - pOTR->absAvgRot.z = me2f( pOTR->absAvgRot.z_fx, 31 - pOTR->absAvgRot.z_qfact ); + pOTR->trkRot.w = me2f( pOTR->trkRot.w_fx, 31 - pOTR->trkRot.q_fact ); + pOTR->trkRot.x = me2f( pOTR->trkRot.x_fx, 31 - pOTR->trkRot.q_fact); + pOTR->trkRot.y = me2f( pOTR->trkRot.y_fx, 31 - pOTR->trkRot.q_fact); + pOTR->trkRot.z = me2f( pOTR->trkRot.z_fx, 31 - pOTR->trkRot.q_fact); + pOTR->absAvgRot.w = me2f( pOTR->absAvgRot.w_fx, 31 - pOTR->absAvgRot.q_fact); + pOTR->absAvgRot.x = me2f( pOTR->absAvgRot.x_fx, 31 - pOTR->absAvgRot.q_fact); + pOTR->absAvgRot.y = me2f( pOTR->absAvgRot.y_fx, 31 - pOTR->absAvgRot.q_fact); + pOTR->absAvgRot.z = me2f( pOTR->absAvgRot.z_fx, 31 - pOTR->absAvgRot.q_fact); *pTrkRot = pOTR->trkRot; } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 7a9db2c79..0073b9b85 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1712,20 +1712,15 @@ ivas_error ivas_combined_orientation_open( origo.x = origo.y = origo.z = 0.0f; #ifdef IVAS_FLOAT_FIXED identity.w_fx = ONE_IN_Q31; - identity.w_qfact = 31; identity.x_fx = 0; - identity.x_qfact = 31; identity.y_fx = 0; - identity.y_qfact = 31; identity.z_fx = 0; - identity.z_qfact = 31; + identity.q_fact = 31; origo.x_fx = 0; - origo.x_qfact = 31; origo.y_fx = 0; - origo.y_qfact = 31; origo.z_fx = 0; - origo.z_qfact = 31; + origo.q_fact = 31; #endif /* Allocate handle */ @@ -2014,15 +2009,15 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.y, Q29); hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.z, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.z_qfact = Q29; - hCombinedOrientationData->Quaternions_ext_interpolation_target.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.z_qfact = Q29; + hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact = Q29; + hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; - QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); + QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i]); - hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].w_qfact); - hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].x_qfact); - hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].y_qfact); - hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].z_qfact); + hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].q_fact); #else QuaternionSlerp(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); @@ -2199,14 +2194,11 @@ ivas_error combine_external_and_head_orientations( for (i = 0; i < hCombinedOrientationData->num_subframes; i++) { - hCombinedOrientationData->Quaternions[i].w_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].w); - hCombinedOrientationData->Quaternions[i].w_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].w, hCombinedOrientationData->Quaternions[i].w_qfact); - hCombinedOrientationData->Quaternions[i].x_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].x); - hCombinedOrientationData->Quaternions[i].x_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].x, hCombinedOrientationData->Quaternions[i].x_qfact); - hCombinedOrientationData->Quaternions[i].y_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].y); - hCombinedOrientationData->Quaternions[i].y_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].y, hCombinedOrientationData->Quaternions[i].y_qfact); - hCombinedOrientationData->Quaternions[i].z_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].z); - hCombinedOrientationData->Quaternions[i].z_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].z, hCombinedOrientationData->Quaternions[i].z_qfact); + hCombinedOrientationData->Quaternions[i].q_fact = s_min(s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].w), Q_factor_L(hCombinedOrientationData->Quaternions[i].x)), s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].y), Q_factor_L(hCombinedOrientationData->Quaternions[i].z))); + hCombinedOrientationData->Quaternions[i].w_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].w, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].x_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].x, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].y_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].y, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].z_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].z, hCombinedOrientationData->Quaternions[i].q_fact); } #endif return IVAS_ERR_OK; @@ -2289,15 +2281,15 @@ static void external_target_interpolation( hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.y, Q29); hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.z, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_start.z_qfact = Q29; - hCombinedOrientationData->Quaternions_ext_interpolation_target.w_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.x_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.y_qfact = hCombinedOrientationData->Quaternions_ext_interpolation_target.z_qfact = Q29; + hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact = Q29; + hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; - QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); + QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i]); - hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].w_qfact); - hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].x_qfact); - hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].y_qfact); - hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].z_qfact); + hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].q_fact); #else QuaternionSlerp(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); @@ -2314,14 +2306,11 @@ static void external_target_interpolation( } #ifdef IVAS_FLOAT_FIXED /* Updating the fixed point values which will be used later */ - hCombinedOrientationData->Quaternions[i].w_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].w); - hCombinedOrientationData->Quaternions[i].w_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].w, hCombinedOrientationData->Quaternions[i].w_qfact); - hCombinedOrientationData->Quaternions[i].x_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].x); - hCombinedOrientationData->Quaternions[i].x_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].x, hCombinedOrientationData->Quaternions[i].x_qfact); - hCombinedOrientationData->Quaternions[i].y_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].y); - hCombinedOrientationData->Quaternions[i].y_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].y, hCombinedOrientationData->Quaternions[i].y_qfact); - hCombinedOrientationData->Quaternions[i].z_qfact = Q_factor_L(hCombinedOrientationData->Quaternions[i].z); - hCombinedOrientationData->Quaternions[i].z_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].z, hCombinedOrientationData->Quaternions[i].z_qfact); + hCombinedOrientationData->Quaternions[i].q_fact = s_min(s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].w), Q_factor_L(hCombinedOrientationData->Quaternions[i].x)), s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].y), Q_factor_L(hCombinedOrientationData->Quaternions[i].z))); + hCombinedOrientationData->Quaternions[i].w_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].w, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].x_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].x, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].y_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].y, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->Quaternions[i].z_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].z, hCombinedOrientationData->Quaternions[i].q_fact); #endif return; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 98730d630..c49d837e5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -476,7 +476,7 @@ static IVAS_QUATERNION quaternionInit_fx( move32(); move32(); - q.w_qfact = q.x_qfact = q.y_qfact = q.z_qfact = Q29; + q.q_fact = Q29; move16(); move16(); move16(); @@ -7141,16 +7141,16 @@ ivas_error IVAS_REND_SetReferenceRotation( #ifdef IVAS_FLOAT_FIXED IVAS_QUATERNION refRot_fx; - refRot_fx.w_qfact = refRot_fx.x_qfact = refRot_fx.y_qfact = refRot_fx.z_qfact = Q29; - refRot_fx.w_fx = (Word32) float_to_fix( refRot.w, refRot_fx.w_qfact ); - refRot_fx.x_fx = (Word32) float_to_fix( refRot.x, refRot_fx.x_qfact ); - refRot_fx.y_fx = (Word32) float_to_fix( refRot.y, refRot_fx.y_qfact ); - refRot_fx.z_fx = (Word32) float_to_fix( refRot.z, refRot_fx.z_qfact ); + refRot_fx.q_fact = Q29; + refRot_fx.w_fx = (Word32) float_to_fix( refRot.w, refRot_fx.q_fact); + refRot_fx.x_fx = (Word32) float_to_fix( refRot.x, refRot_fx.q_fact); + refRot_fx.y_fx = (Word32) float_to_fix( refRot.y, refRot_fx.q_fact); + refRot_fx.z_fx = (Word32) float_to_fix( refRot.z, refRot_fx.q_fact); error = ivas_orient_trk_SetReferenceRotation_fx( hIvasRend->headRotData.hOrientationTracker, refRot_fx ); - hIvasRend->headRotData.hOrientationTracker->refRot.w = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.w_qfact ); - hIvasRend->headRotData.hOrientationTracker->refRot.x = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.x_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.x_qfact ); - hIvasRend->headRotData.hOrientationTracker->refRot.y = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.y_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.y_qfact ); - hIvasRend->headRotData.hOrientationTracker->refRot.z = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.z_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.z_qfact ); + hIvasRend->headRotData.hOrientationTracker->refRot.w = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->refRot.x = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.x_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->refRot.y = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.y_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->refRot.z = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.z_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); if ( error != IVAS_ERR_OK ) { -- GitLab From a98a038a4c4c39cb7ecd6bfd635cb46646a86423 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 8 May 2024 11:02:12 +0530 Subject: [PATCH 019/101] Fixes for few high MLD issues and float code cleanup [x] lib_rend.c cleanup [x] Integration of ivas_dirac_dec_decorr_process fixed function [x] Few warnings fixes --- apps/renderer.c | 4 + lib_com/ivas_prot.h | 15 +- lib_dec/ivas_binRenderer_internal.c | 6 - lib_dec/ivas_dirac_dec.c | 68 +++- lib_dec/ivas_dirac_output_synthesis_cov.c | 4 +- lib_dec/ivas_init_dec.c | 96 +++-- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_jbm_dec.c | 60 +-- lib_dec/ivas_lfe_plc_fx.c | 5 +- lib_dec/ivas_masa_dec.c | 380 ++----------------- lib_dec/ivas_mc_param_dec.c | 9 +- lib_dec/ivas_qmetadata_dec.c | 3 +- lib_rend/ivas_crend.c | 311 ++------------- lib_rend/ivas_dirac_dec_binaural_functions.c | 4 +- lib_rend/ivas_dirac_decorr_dec.c | 13 + lib_rend/ivas_dirac_onsets_dec.c | 1 + lib_rend/ivas_dirac_output_synthesis_dec.c | 191 +++++++++- lib_rend/ivas_dirac_rend.c | 8 +- lib_rend/ivas_orient_trk.c | 1 - lib_rend/ivas_stat_rend.h | 78 ++-- lib_rend/lib_rend.c | 122 ++++-- lib_rend/lib_rend.h | 7 + lib_util/hrtf_file_reader.c | 209 ++++------ lib_util/rotation_file_reader.c | 16 + 24 files changed, 648 insertions(+), 965 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index bafeec725..af75bcb68 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1549,7 +1549,11 @@ int main( { if ( args.delayCompensationEnabled ) { +#ifdef IVAS_FLOAT_FIXED + IF( IVAS_REND_GetDelay_fx( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) +#else if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) +#endif // IVAS_FLOAT_FIXED { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); exit( -1 ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a5b76f8d4..0444bac65 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -6170,7 +6170,7 @@ void ivas_clear_band_coeff_idx( /*----------------------------------------------------------------------------------* * MASA prototypes *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_masa_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); @@ -6178,6 +6178,7 @@ ivas_error ivas_masa_dec_open( void ivas_masa_dec_close( MASA_DECODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); +#endif ivas_error ivas_masa_decode( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ @@ -6828,7 +6829,15 @@ void ivas_mono_stereo_downmix_mcmasa( float *output_f[], /* i/o: synthesized core-coder transport channels/mono or stereo output */ int16_t output_frame /* i : output frame length per channel */ ); - +#ifdef IVAS_FLOAT_FIXED +void ivas_lfe_synth_with_filters_fx( + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ + Word32 *data_f[], /* o : output signals */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 separateChannelIndex, /* i : separate channel index */ + const Word16 lfeChannelIndex /* i : LFE channel index */ +); +#else void ivas_lfe_synth_with_filters( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ float *data_f[], /* o : output signals */ @@ -6836,7 +6845,7 @@ void ivas_lfe_synth_with_filters( const int16_t separateChannelIndex, /* i : separate channel index */ const int16_t lfeChannelIndex /* i : LFE channel index */ ); - +#endif /*----------------------------------------------------------------------------------* * LFE encoder low pass filter prototypes diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index e360e599e..80c0d9d1a 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -2309,12 +2309,6 @@ void ivas_binaural_add_LFE_fx( Word32 *output_fx[] /* o : synthesized core-coder transport channels/DirAC output */ ) { -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - IF( st_ivas->hCrendWrapper != NULL ) - { - st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe_fx = (Word16)(st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe * ( ONE_IN_Q14 )); - } -#endif Word16 render_lfe, idx_lfe; Word16 gain_fx; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 2594011d3..18ca3e140 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3626,6 +3626,7 @@ void ivas_dirac_dec_render_sf_fx( Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; set_zero_fx(surCohRatio_fx, CLDFB_NO_CHANNELS_MAX); Word16 q_cldfb, q_temp_cldfb = 0; + Word16 proto_length = 0; //Word32 proto_frame_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; Word32 proto_direct_buffer_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; @@ -3750,15 +3751,6 @@ void ivas_dirac_dec_render_sf_fx( floatToFixed_arrL32( st_ivas->cldfbAnaDec[1]->cldfb_state, st_ivas->cldfbAnaDec[1]->cldfb_state_fx, Q11, ( st_ivas->cldfbAnaDec[1]->p_filter_length - st_ivas->cldfbAnaDec[1]->no_channels ) ); } - IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && !hDirACRend->hOutSetup.separateChannelEnabled && !( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16( hDirACRend->hOutSetup.num_lfe, 0 ) ) ) - { - st_ivas->hMasa->hMasaLfeSynth->transportEneSmooth_fx = floatToFixed_32( st_ivas->hMasa->hMasaLfeSynth->transportEneSmooth, st_ivas->hMasa->hMasaLfeSynth->transportEneSmooth_q ); - st_ivas->hMasa->hMasaLfeSynth->protoLfeEneSmooth_fx = floatToFixed_32( st_ivas->hMasa->hMasaLfeSynth->protoLfeEneSmooth, st_ivas->hMasa->hMasaLfeSynth->protoLfeEneSmooth_q ); - f2me( st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth, &st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth_fx, &st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth_q ); - st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth_q = sub( 31, st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth_q ); - st_ivas->hMasa->hMasaLfeSynth->targetEneTransSmooth_fx = floatToFixed_32( st_ivas->hMasa->hMasaLfeSynth->targetEneTransSmooth, st_ivas->hMasa->hMasaLfeSynth->targetEneTransSmooth_q ); - } - IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); @@ -4325,10 +4317,6 @@ void ivas_dirac_dec_render_sf_fx( } fixedToFloat_arrL32( Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][slot_idx], Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][slot_idx], Q6, CLDFB_NO_CHANNELS_MAX ); fixedToFloat_arrL32( Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][slot_idx], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][slot_idx], Q6, CLDFB_NO_CHANNELS_MAX ); - st_ivas->hMasa->hMasaLfeSynth->transportEneSmooth = fixedToFloat_32( st_ivas->hMasa->hMasaLfeSynth->transportEneSmooth_fx, st_ivas->hMasa->hMasaLfeSynth->transportEneSmooth_q ); - st_ivas->hMasa->hMasaLfeSynth->protoLfeEneSmooth = fixedToFloat_32( st_ivas->hMasa->hMasaLfeSynth->protoLfeEneSmooth_fx, st_ivas->hMasa->hMasaLfeSynth->protoLfeEneSmooth_q ); - st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth = me2f( st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth_fx, sub( 31, st_ivas->hMasa->hMasaLfeSynth->targetEneLfeSmooth_q ) ); - st_ivas->hMasa->hMasaLfeSynth->targetEneTransSmooth = fixedToFloat_32( st_ivas->hMasa->hMasaLfeSynth->targetEneTransSmooth_fx, st_ivas->hMasa->hMasaLfeSynth->targetEneTransSmooth_q ); } IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) @@ -4353,6 +4341,7 @@ void ivas_dirac_dec_render_sf_fx( fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); fixedToFloat_arrL32( &proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + proto_length = i_mult(6, hSpatParamRendCom->num_freq_bands); fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); IF( hDirACRend->masa_stereo_type_detect ) { @@ -4371,6 +4360,7 @@ void ivas_dirac_dec_render_sf_fx( fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); fixedToFloat_arrL32( &proto_direct_buffer_f_fx[offset], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f[offset], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); + proto_length = i_mult(2, i_mult(hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff)); fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); BREAK; case 2: @@ -4389,12 +4379,14 @@ void ivas_dirac_dec_render_sf_fx( } } fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + proto_length = i_mult(6, hSpatParamRendCom->num_freq_bands); fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); BREAK; case 1: fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); fixedToFloat_arrL32( &proto_direct_buffer_f_fx[i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ) ); + proto_length = i_mult(2, i_mult(hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff)); fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); BREAK; } @@ -4942,12 +4934,32 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ - + Word16 scale = 0, temp_len = 0; if ( hDirACRend->proto_signal_decorr_on == 1 ) { /* decorrelate prototype frame */ if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { +#ifdef IVAS_FLOAT_FIXED + ivas_dirac_dec_decorr_process_fx(hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + &proto_diffuse_buffer_f_fx [slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff], + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + &proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min(4, nchan_transport)], + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + onset_filter_fx, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state); + + + fixedToFloat_arrL(onset_filter_fx, onset_filter, Q31, hSpatParamRendCom->num_freq_bands ); + +#else ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, @@ -4960,6 +4972,7 @@ void ivas_dirac_dec_render_sf_fx( onset_filter, hDirACRend->h_freq_domain_decorr_ap_params, hDirACRend->h_freq_domain_decorr_ap_state ); +#endif v_multc( onset_filter, 0.25f, onset_filter, hSpatParamRendCom->num_freq_bands ); v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); @@ -4970,8 +4983,31 @@ void ivas_dirac_dec_render_sf_fx( p_onset_filter_fx = onset_filter_subframe_fx; #endif } - else + ELSE { +#ifdef IVAS_FLOAT_FIXED + scale = L_norm_arr(hDirACRend->proto_frame_f_fx, proto_length); + Scale_sig32(hDirACRend->proto_frame_f_fx, proto_length, scale); + hDirACRend->proto_frame_f_q = add(hDirACRend->proto_frame_f_q, scale); + ivas_dirac_dec_decorr_process_fx(hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->proto_frame_f_fx, + hDirACRend->proto_frame_f_q, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + DirAC_mem.frame_dec_f_fx, + &DirAC_mem.frame_dec_f_q, + onset_filter_fx, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state); + + temp_len = DirAC_mem.frame_dec_f_len; + fixedToFloat_arrL(onset_filter_fx, onset_filter, Q31, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff); + me2f_buf(DirAC_mem.frame_dec_f_fx, 31- DirAC_mem.frame_dec_f_q , DirAC_mem.frame_dec_f , temp_len); +#else ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, @@ -4984,9 +5020,11 @@ void ivas_dirac_dec_render_sf_fx( onset_filter, hDirACRend->h_freq_domain_decorr_ap_params, hDirACRend->h_freq_domain_decorr_ap_state ); +#endif hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; p_onset_filter = onset_filter; + #ifdef IVAS_FLOAT_FIXED hDirACRend->proto_frame_dec_f_fx = DirAC_mem.frame_dec_f_fx; hDirACRend->proto_frame_dec_f_q = DirAC_mem.frame_dec_f_q; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index a4b34f908..e558dda69 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -1161,7 +1161,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( Word32 mixing_matrix_smooth_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 mixing_matrix_smooth_e; Word32 mixing_matrix_res_smooth_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word16 mixing_matrix_res_smooth_e; + Word16 mixing_matrix_res_smooth_e = 0; Word32 mixing_matrix_buffer_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; Word16 mixing_matrix_buffer_e; Word32 input_f_real_fx[PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -1172,8 +1172,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( Word16 output_f_imag_e; Word32 diff_f_real_fx[MAX_CICP_CHANNELS]; Word32 diff_f_imag_fx[MAX_CICP_CHANNELS]; - Word16 diff_f_real_e; - Word16 diff_f_imag_e; set_zero_fx( input_f_real_fx, PARAM_MC_MAX_TRANSPORT_CHANS ); set_zero_fx( input_f_imag_fx, PARAM_MC_MAX_TRANSPORT_CHANS ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index c27587e1b..80173b9fa 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -72,15 +72,6 @@ ivas_error ivas_dec_setup( { #ifdef IVAS_FLOAT_FIXED/*TODO:To be removed later*/ RENDER_CONFIG_DATA *hRendCfg = st_ivas->hRenderConfig; - HRTFS_CREND_HANDLE hSetOfHRTF = st_ivas->hSetOfHRTF; - IF( hSetOfHRTF ) - { - hSetOfHRTF->hHRTF_brir_combined->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_brir_combined->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_foa->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_foa->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_combined->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_combined->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_hoa3->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa3->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_hoa2->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa2->latency_s, 31 ); - } IF( hRendCfg ) { hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); @@ -875,14 +866,6 @@ ivas_error ivas_dec_setup( st->total_brate = ACELP_8k00; /* only temporary initialization - this is needed for get_next_indice() in the frame following NO_DATA frame */ } -#ifdef IVAS_FLOAT_FIXED/*Cleanup changes: fixed to float*/ - IF( st_ivas->hCrendWrapper != NULL ) - { - st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); - st_ivas->hCrendWrapper->hHrtfCrend->latency_s = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->latency_s_fx, 31 ); - fixedToFloat_arr( st_ivas->hCrendWrapper->hHrtfCrend->inv_diffuse_weight_fx, st_ivas->hCrendWrapper->hHrtfCrend->inv_diffuse_weight, 15, 16 ); - } -#endif return error; } @@ -2257,10 +2240,81 @@ ivas_error ivas_init_decoder_fx( } ELSE IF ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { +#ifdef IVAS_FLOAT_FIXED +#if 1 /*Cleanup changes: float to fixed */ + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + FOR( i = 0; i < 4; i++ ) + { + st_ivas->hRenderConfig->directivity_fx[i * 3] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3], 6 ); + st_ivas->hRenderConfig->directivity_fx[i * 3 + 1] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 1], 6 ); + st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 2], 15 ); + } +#endif + IF( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float + st_ivas->hBinRendererTd->Gain = 1.0f; /*1.0f Q15*/ + fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); + fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); + fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); + fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Up_fx, st_ivas->hBinRendererTd->Listener_p->Up, Q30, 3 ); + fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Right_fx, st_ivas->hBinRendererTd->Listener_p->Right, Q30, 3 ); + TDREND_DirAtten_t *DirAtten_p = st_ivas->hBinRendererTd->DirAtten_p; + DirAtten_p->ConeInnerAngle = fix_to_float( DirAtten_p->ConeInnerAngle_fx, Q22 ); + DirAtten_p->ConeOuterAngle = fix_to_float( DirAtten_p->ConeOuterAngle_fx, Q22 ); + DirAtten_p->ConeOuterGain = fix_to_float( DirAtten_p->ConeOuterGain_fx, Q30 ); + Word16 nchan_rend = num_src; + IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p->SrcSpatial_p != NULL ) + { + Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; + Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; + Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; + FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) + { + fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); + fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); + } + } + FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) + { + Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; + Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; + } + set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); + set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); + set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); + set_f( Src_p->hrf_left_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); + set_f( Src_p->hrf_right_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); + Src_p->hrf_left_prev[0] = 1; + Src_p->hrf_right_prev[0] = 1; + Src_p->azim_prev = 0.0f; + Src_p->elev_prev = 0.0f; + Src_p->Gain = 1.0f; + Src_p->prevGain = 1.0f; + TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; + fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); + fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->DirAtten.ConeInnerAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeInnerAngle_fx, Q22 ); + SrcSpatial_p->DirAtten.ConeOuterAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterAngle_fx, Q22 ); + SrcSpatial_p->DirAtten.ConeOuterGain = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterGain_fx, Q30 ); + } +#endif +#else IF ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } +#endif IF ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { @@ -2310,14 +2364,6 @@ ivas_error ivas_init_decoder_fx( return error; } -#if 1 /*Cleanup changes: fixed to float*/ - IF(st_ivas->hCrendWrapper!=NULL && st_ivas->hCrendWrapper->hHrtfCrend != NULL ) - { - st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); - st_ivas->hCrendWrapper->hHrtfCrend->latency_s = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->latency_s_fx, 31 ); - fixedToFloat_arr( st_ivas->hCrendWrapper->hHrtfCrend->inv_diffuse_weight_fx, st_ivas->hCrendWrapper->hHrtfCrend->inv_diffuse_weight, 15, 16 ); - } -#endif st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; IF ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 95f26554d..2bc91f30d 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1028,7 +1028,7 @@ ivas_error ivas_ism_metadata_dec_fx( pitch_fx = ism_dequant_meta_fx( idx_angle2, ism_elevation_borders_fx, (Word32)(ISM_Q_STEP * (1<<22)), (Word32)(ISM_Q_STEP_BORDER * (1<<22)), 1 << ISM_ELEVATION_NBITS ); idx_radius = decode_radius_fx( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); - radius_fx = usdequant_fx( idx_radius, (Word16)(ISM_RADIUS_MIN * (1 << 9)) , (Word16)(ISM_RADIUS_DELTA * (1 << 9)) ); + radius_fx = usdequant_fx( idx_radius, (Word16)(ISM_RADIUS_MIN * (1 << 9)) , (Word16)(ISM_RADIUS_DELTA * (1 << (9 - 1))) ); IF ( *ism_extmeta_active == 1 ) { hIsmMetaData->yaw_fx = yaw_fx; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2e860b00d..08bcdc2fe 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -314,15 +314,6 @@ ivas_error ivas_jbm_dec_tc( st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; #ifdef IVAS_FLOAT_FIXED - // Float to fix conversion starts here. - IF( st_ivas->hMasa->hMasaLfeSynth != NULL ) - { - FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j] = float_to_fix16( st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j], Q14 ); - } - } - // Float to fix conversion ends here. IF( ( error = ivas_masa_decode_fx( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) @@ -350,13 +341,6 @@ ivas_error ivas_jbm_dec_tc( } } st_ivas->hMasa->data.dir_decode_quality = fix16_to_float( st_ivas->hMasa->data.dir_decode_quality_fx, Q14 ); - IF( st_ivas->hMasa->hMasaLfeSynth != NULL ) - { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j] = fix16_to_float( st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j], Q14 ); - } - } IF( st_ivas->hSpatParamRendCom != NULL ) { FOR( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) @@ -829,13 +813,6 @@ ivas_error ivas_jbm_dec_tc( ELSE tmp_nchan_ism = st_ivas->nchan_ism; ///////////////////////////////////// Float to fix conversion starts here. /////////////////////////////////// - IF( st_ivas->hMasa->hMasaLfeSynth != NULL ) - { - FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j] = float_to_fix16( st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j], Q14 ); - } - } FOR( n = 0; n < tmp_nchan_ism; n++ ) { @@ -936,13 +913,6 @@ ivas_error ivas_jbm_dec_tc( } } st_ivas->hMasa->data.dir_decode_quality = fix16_to_float( st_ivas->hMasa->data.dir_decode_quality_fx, Q14 ); - IF( st_ivas->hMasa->hMasaLfeSynth != NULL ) - { - FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j] = fix16_to_float( st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j], Q14 ); - } - } IF( st_ivas->hSpatParamRendCom != NULL ) { FOR( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) @@ -2004,15 +1974,6 @@ ivas_error ivas_jbm_dec_tc( /* read McMASA parameters from the bitstream */ #ifdef IVAS_FLOAT_FIXED - // Float to fix conversion starts here. - IF( st_ivas->hMasa->hMasaLfeSynth != NULL ) - { - FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j] = float_to_fix16( st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j], Q14 ); - } - } - // Float to fix conversion ends here. IF( ( error = ivas_masa_decode_fx( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { @@ -2039,13 +2000,6 @@ ivas_error ivas_jbm_dec_tc( } } st_ivas->hMasa->data.dir_decode_quality = fix16_to_float( st_ivas->hMasa->data.dir_decode_quality_fx, Q14 ); - IF( st_ivas->hMasa->hMasaLfeSynth != NULL ) - { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j] = fix16_to_float( st_ivas->hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j], Q14 ); - } - } IF( st_ivas->hSpatParamRendCom != NULL ) { FOR( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) @@ -2088,28 +2042,18 @@ ivas_error ivas_jbm_dec_tc( return error; } #endif // IVAS_FLOAT_FIXED -#if 1 - FOR( i = 0; i < 12; i++ ) - { - fixedToFloat_arrL( p_output_fx[i], p_output[i], Q11, output_frame ); - } /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */ IF( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) { - ivas_lfe_synth_with_filters( st_ivas->hMasa->hMasaLfeSynth, p_output, output_frame, n, LFE_CHANNEL ); + ivas_lfe_synth_with_filters_fx( st_ivas->hMasa->hMasaLfeSynth, p_output_fx, output_frame, n, LFE_CHANNEL ); } ELSE IF( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) { /* Delay the separated channel to sync with the DirAC rendering */ - delay_signal_float( p_output[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); - } - FOR( i = 0; i < 12; i++ ) - { - floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, output_frame ); + delay_signal_fx(p_output_fx[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); } -#endif } ELSE { diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 279749caa..1fc1c04f4 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -211,10 +211,13 @@ static Word16 d_lev_dur_fx( Word32 buf_fx[TCXLTP_LTP_ORDER]; Word16 rc_q_fx[TCXLTP_LTP_ORDER]; Word32 *rc_fx; /* reflection coefficients 0,...,m-1 */ - Word32 temp1, temp2, err_fx, at_fx, s, a_tmp; + Word32 temp1, temp2, err_fx, at_fx, s; Word16 temp_q1, temp_q2, s_q_fx, err_q_fx, exp1, exp2; Word64 s_fx; + s_q_fx = 0; + move16(); + rc_fx = &buf_fx[0]; rc_fx[0] = BASOP_Util_Divide3232_Scale_cadence( -r_fx[1], r_fx[0], &temp_q2 ); move32(); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 2aba53751..b37dd203f 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -83,9 +83,9 @@ static void restore_lowbitrate_masa( IVAS_QMETADATA_HANDLE hQMetaData, const int static void restore_lowbitrate_masa_fx( IVAS_QMETADATA_HANDLE hQMetaData, const Word16 low_bitrate_mode, const Word16 numCodingBands ); #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error init_lfe_synth_data( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); - -#ifdef IVAS_FLOAT_FIXED +#else static ivas_error init_lfe_synth_data_fx( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); #endif @@ -93,9 +93,10 @@ static void compute_foa_cov_matrix( float foaCov[FOA_CHANNELS][FOA_CHANNELS], fl #ifdef IVAS_FLOAT_FIXED static void compute_foa_cov_matrix_fx(Word32 foaCov_fx[FOA_CHANNELS][FOA_CHANNELS], Word32 inCov_fx[FOA_CHANNELS][FOA_CHANNELS], Word32 mixMtx_fx[FOA_CHANNELS][FOA_CHANNELS]); #endif -static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, uint16_t *bitstream, int16_t *index, const int32_t ivas_total_brate ); -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED +static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, uint16_t *bitstream, int16_t *index, const int32_t ivas_total_brate ); +#else static Word16 decode_lfe_to_total_energy_ratio_fx( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, uint16_t *bitstream, int16_t *index, const int32_t ivas_total_brate ); #endif @@ -327,27 +328,11 @@ ivas_error ivas_masa_decode( if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { -#ifdef IVAS_FLOAT_FIXED - for ( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j] = float_to_fix16( hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j], Q14 ); - } - *nb_bits_read = add( *nb_bits_read, decode_lfe_to_total_energy_ratio_fx( hMasa->hMasaLfeSynth, st->bit_stream, &st->next_bit_pos, ivas_total_brate ) ); - for ( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j] = fix16_to_float( hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j], Q14 ); - } -#else *nb_bits_read += decode_lfe_to_total_energy_ratio( hMasa->hMasaLfeSynth, st->bit_stream, &st->next_bit_pos, ivas_total_brate ); -#endif } /* Once we know incoming configuration, we can config decoder further based on bitrate etc. */ -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_masa_dec_config_fx( st_ivas ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_masa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -379,40 +364,9 @@ ivas_error ivas_masa_decode( { if ( st_ivas->hDirAC != NULL ) { -#ifdef IVAS_FLOAT_FIXED - *nb_bits_read += ivas_decode_masaism_metadata_fx( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, st_ivas->hSpatParamRendCom->dirac_md_buffer_length ); - FOR(Word32 dir = 0; dir < MAX_PARAM_SPATIAL_SUBFRAMES; dir++) - { - FOR(Word16 sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; ++sf) - { - Word16 meta_write_index = (add(st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, sf)) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; - FOR(Word32 b = 0; b < MASA_FREQUENCY_BANDS; ++b) - { - st_ivas->hMasaIsmData->energy_ratio_ism[dir][meta_write_index][b] = fix_to_float(st_ivas->hMasaIsmData->energy_ratio_ism_fx[dir][meta_write_index][b], Q30); - } - } - } - FOR(Word32 n = 0; n < st_ivas->nchan_ism; n++) - { - st_ivas->hMasaIsmData->q_azimuth_old_fx[n] = float_to_fix(st_ivas->hMasaIsmData->q_azimuth_old[n], Q22); - } - - //FOR(Word32 k = 0; k < (nblocks != 1 ? nblocks : MAX_PARAM_SPATIAL_SUBFRAMES); k++) - //FOR(Word32 k = 0; k < ( hQMetaData->q_direction->cfg.nblocks != 1 ? hQMetaData->q_direction->cfg.nblocks : MAX_PARAM_SPATIAL_SUBFRAMES); k++) - FOR(Word32 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++) - { - //FOR(Word32 j = 0; j < (hQMetaData->q_direction->cfg.nbands != 1 ? hQMetaData->q_direction->cfg.nbands : MASA_FREQUENCY_BANDS); j++) - FOR(Word32 j = 0; j < MASA_FREQUENCY_BANDS; j++) - { - st_ivas->hMasaIsmData->masa_to_total_energy_ratio[k][j] = fix_to_float(st_ivas->hMasaIsmData->masa_to_total_energy_ratio_fx[k][j], Q30); - } - } - -#else *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, st_ivas->hSpatParamRendCom->dirac_md_buffer_length ); -#endif + for ( obj = 0; obj <= st_ivas->nchan_ism; obj++ ) { if ( st_ivas->hMasaIsmData->idx_separated_ism == obj ) @@ -431,38 +385,8 @@ ivas_error ivas_masa_decode( } else { -#ifdef IVAS_FLOAT_FIXED - *nb_bits_read += ivas_decode_masaism_metadata_fx( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, - st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); - FOR(Word32 dir = 0; dir < MAX_PARAM_SPATIAL_SUBFRAMES; dir++) - { - FOR(Word32 sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; ++sf) - { - FOR(Word32 b = 0; b < MASA_FREQUENCY_BANDS; ++b) - { - st_ivas->hMasaIsmData->energy_ratio_ism[dir][sf][b] = fix_to_float(st_ivas->hMasaIsmData->energy_ratio_ism_fx[dir][sf][b], Q30); - } - } - } - FOR(Word32 n = 0; n < st_ivas->nchan_ism; n++) - { - st_ivas->hMasaIsmData->q_azimuth_old_fx[n] = float_to_fix(st_ivas->hMasaIsmData->q_azimuth_old[n], Q22); - } - - //FOR(Word32 k = 0; k < (nblocks != 1 ? nblocks : MAX_PARAM_SPATIAL_SUBFRAMES); k++) - //FOR(Word32 k = 0; k < ( hQMetaData->q_direction->cfg.nblocks != 1 ? hQMetaData->q_direction->cfg.nblocks : MAX_PARAM_SPATIAL_SUBFRAMES); k++) - FOR(Word32 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++) - { - //FOR(Word32 j = 0; j < (hQMetaData->q_direction->cfg.nbands != 1 ? hQMetaData->q_direction->cfg.nbands : MASA_FREQUENCY_BANDS); j++) - FOR(Word32 j = 0; j < MASA_FREQUENCY_BANDS; j++) - { - st_ivas->hMasaIsmData->masa_to_total_energy_ratio[k][j] = fix_to_float(st_ivas->hMasaIsmData->masa_to_total_energy_ratio_fx[k][j], Q30); - } - } -#else *nb_bits_read += ivas_decode_masaism_metadata( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos, st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif } } } @@ -472,23 +396,7 @@ ivas_error ivas_masa_decode( { masa_total_brate = calculate_cpe_brate_MASA_ISM( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); } -#ifdef IVAS_FLOAT_FIXED - // To do remove this code - for ( int d = 0; d < hQMetaData->no_directions; d++ ) - { - IVAS_QDIRECTION *q_direction; - q_direction = &hQMetaData->q_direction[d]; - int nbands = hQMetaData->q_direction[0].cfg.nbands; - FOR( Word16 j = 0; j < nbands; j++ ) - { - FOR( Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) - { - q_direction->band_data[j].elevation_fx[k] = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); - q_direction->band_data[j].azimuth_fx[k] = (Word32) ( q_direction->band_data[j].azimuth[k] * ( 1 << 22 ) ); - } - } - } -#endif + if ( masa_total_brate >= IVAS_384k ) { if ( masa_total_brate >= IVAS_512k ) @@ -504,53 +412,17 @@ ivas_error ivas_masa_decode( { *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos, 0 ); } -#ifdef IVAS_FLOAT_FIXED - // To do remove this code - for ( int d = 0; d < hQMetaData->no_directions; d++ ) - { - IVAS_QDIRECTION *q_direction; - q_direction = &hQMetaData->q_direction[d]; - int nbands = hQMetaData->q_direction[0].cfg.nbands; - FOR( Word16 j = 0; j < nbands; j++ ) - { - FOR( Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) - { - q_direction->band_data[j].elevation[k] = ( (float) q_direction->band_data[j].elevation_fx[k] / ( 1 << 22 ) ); - q_direction->band_data[j].azimuth[k] = ( (float) q_direction->band_data[j].azimuth_fx[k] / ( 1 << 22 ) ); - q_direction->band_data[j].energy_ratio[k] = ( (float) q_direction->band_data[j].energy_ratio_fx[k] / ( 1 << 30 ) ); - } - } - } -#endif if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { /* Modify spatial metadata based on the MASA-to-total energy ratios */ -#ifdef IVAS_FLOAT_FIXED - ivas_omasa_modify_masa_energy_ratios_fx( hQMetaData, st_ivas->hMasaIsmData->masa_to_total_energy_ratio_fx ); - for (int k = 0; k < hQMetaData->no_directions; k++) - { - for (int j = 0; j < hQMetaData->q_direction[0].cfg.nbands; j++) - { - for (int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++) - { - hQMetaData->q_direction[k].band_data[j].energy_ratio[m] = fix_to_float(hQMetaData->q_direction[k].band_data[j].energy_ratio_fx[m], Q30); - } - } - } -#else ivas_omasa_modify_masa_energy_ratios( hQMetaData, st_ivas->hMasaIsmData->masa_to_total_energy_ratio ); -#endif } /* Get direction decoding quality. EC 1 and 2 are handled by the default value. */ if ( hQMetaData->ec_flag == 2 ) { -#ifndef IVAS_FLOAT_FIXED hMasa->data.dir_decode_quality = hQMetaData->dir_comp_ratio; -#else - hMasa->data.dir_decode_quality = (float)hQMetaData->dir_comp_ratio_fx/(1<<15); -#endif } hMasa->config.coherencePresent = !hQMetaData->all_coherence_zero; @@ -575,20 +447,12 @@ ivas_error ivas_masa_decode( if ( hQMetaData->q_direction == NULL ) { /* replicate ivas_masa_dec_config() in case that first good received frame is SID frame */ -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_masa_dec_config_fx( st_ivas ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_masa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef IVAS_FLOAT_FIXED - ivas_masa_set_elements_fx( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, 0 ); -#else ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, 0 ); -#endif hQMetaData->metadata_max_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; @@ -614,43 +478,7 @@ ivas_error ivas_masa_decode( } tmp_elem_mode = -1; -#ifdef IVAS_FLOAT_FIXED - for (int d = 0; d < hQMetaData->no_directions; d++) - { - IVAS_QDIRECTION *q_direction; - q_direction = &hQMetaData->q_direction[d]; - int nbands = hQMetaData->q_direction[0].cfg.nbands; - FOR(Word16 j = 0; j < nbands; j++) - { - FOR(Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++) - { - q_direction->band_data[j].elevation_fx[k] = (Word32)(q_direction->band_data[j].elevation[k] * (1 << 22)); - q_direction->band_data[j].azimuth_fx[k] = (Word32)(q_direction->band_data[j].azimuth[k] * (1 << 22)); - q_direction->band_data[j].energy_ratio_fx[k] = (Word32)(q_direction->band_data[j].energy_ratio[k] * (1 << 30)); - } - } - } -#endif *nb_bits_read += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), st_ivas->nchan_transport, &tmp_elem_mode, ivas_format ); -#ifdef IVAS_FLOAT_FIXED - for (int d = 0; d < hQMetaData->no_directions; d++) - { - IVAS_QDIRECTION *q_direction; - q_direction = &hQMetaData->q_direction[d]; - int nbands = hQMetaData->q_direction[0].cfg.nbands; - FOR(Word16 j = 0; j < nbands; j++) - { - FOR(Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++) - { - - q_direction->band_data[j].elevation[k] = ((float)q_direction->band_data[j].elevation_fx[k] / (1 << 22)); - q_direction->band_data[j].azimuth[k] = ((float)q_direction->band_data[j].azimuth_fx[k] / (1 << 22)); - q_direction->band_data[j].energy_ratio[k] = ((float)q_direction->band_data[j].energy_ratio_fx[k] / (1 << 30)); - - } - } - } -#endif if ( st_ivas->nchan_transport == 2 ) { assert( st_ivas->nCPE > 0 ); @@ -662,11 +490,7 @@ ivas_error ivas_masa_decode( { if ( hQMetaData->q_direction == NULL ) { -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_masa_dec_config_fx( st_ivas ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_masa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -676,68 +500,14 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { dirac_bs_md_write_idx = st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx; /* Store the write-index for this frame */ - -#ifdef IVAS_FLOAT_FIXED - for (int d = 0; d < hQMetaData->no_directions; d++) - { - IVAS_QDIRECTION *q_direction; - q_direction = &hQMetaData->q_direction[d]; - int nbands = hQMetaData->q_direction[0].cfg.nbands; - //int nblocks = hQMetaData->q_direction[0].cfg.nblocks; - FOR(Word16 j = 0; j < nbands; j++) - { - FOR(Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++) - { - q_direction->band_data[j].elevation_fx[k] = (Word32)(q_direction->band_data[j].elevation[k] * (1 << 22)); - q_direction->band_data[j].azimuth_fx[k] = (Word32)(q_direction->band_data[j].azimuth[k] * (1 << 22)); - q_direction->band_data[j].energy_ratio_fx[k] = (Word32)(q_direction->band_data[j].energy_ratio[k] * (1 << 30)); - } - } - } - - for ( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++) { - for ( int j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++) { - st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j] = float_to_fix(st_ivas->hSpatParamRendCom->diffuseness_vector[i][j], 30); - st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j] = float_to_fix(st_ivas->hSpatParamRendCom->energy_ratio1[i][j], 30); - IF(hQMetaData->no_directions == 2) - { - st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j] = float_to_fix(st_ivas->hSpatParamRendCom->energy_ratio2[i][j], 30); - st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j] = float_to_fix16(st_ivas->hSpatParamRendCom->spreadCoherence2[i][j], 15); - } - st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j] = float_to_fix16(st_ivas->hSpatParamRendCom->surroundingCoherence[i][j], 15); - st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j] = float_to_fix16(st_ivas->hSpatParamRendCom->spreadCoherence[i][j], 15); - } - } - - ivas_qmetadata_to_dirac_fx(hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->hSpatParamRendCom, ivas_total_brate, ivas_format, 0, 0); - - for ( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++) { - for ( int j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++) { - st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30); - st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30); - IF(hQMetaData->no_directions == 2) - { - st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30); - st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15); - } - st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15); - st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15); - } - } -#else - ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->hSpatParamRendCom, ivas_total_brate, ivas_format, 0, 0); -#endif + ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->hSpatParamRendCom, ivas_total_brate, ivas_format, 0, 0 ); } if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { if ( hQMetaData->q_direction == NULL ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_masa_dec_config_fx( st_ivas ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_masa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1453,7 +1223,7 @@ ivas_error ivas_masa_decode_fx( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_masa_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) @@ -1560,7 +1330,7 @@ ivas_error ivas_masa_dec_open( return error; } -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_masa_dec_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) @@ -1685,7 +1455,7 @@ ivas_error ivas_masa_dec_open_fx( * * close MASA decoder *-----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void ivas_masa_dec_close( MASA_DECODER_HANDLE *hMasa_out /* i/o: MASA metadata structure */ ) @@ -1744,7 +1514,7 @@ void ivas_masa_dec_close( return; } -#ifdef IVAS_FLOAT_FIXED +#else void ivas_masa_dec_close_fx( MASA_DECODER_HANDLE *hMasa_out /* i/o: MASA metadata structure */ ) @@ -1773,28 +1543,6 @@ void ivas_masa_dec_close_fx( IF ( hMasa->hMasaLfeSynth != NULL ) { -#if 1 /* TODO: Remove float free */ - IF ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer != NULL ) - { - free( hMasa->hMasaLfeSynth->lfeSynthRingBuffer ); - hMasa->hMasaLfeSynth->lfeSynthRingBuffer = NULL; - } - IF ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 != NULL ) - { - free( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 ); - hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = NULL; - } - IF ( hMasa->hMasaLfeSynth->delayBuffer_syncLp != NULL ) - { - free( hMasa->hMasaLfeSynth->delayBuffer_syncLp ); - hMasa->hMasaLfeSynth->delayBuffer_syncLp = NULL; - } - IF ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC != NULL ) - { - free( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC ); - hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = NULL; - } -#endif IF ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx != NULL ) { free( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx ); @@ -2419,6 +2167,7 @@ static void restore_lowbitrate_masa_fx( #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error init_lfe_synth_data( Decoder_Struct *st_ivas, /* i : IVAS decoder struct */ MASA_DECODER_HANDLE hMasa /* i/o: MASA decoder structure */ @@ -2534,8 +2283,7 @@ static ivas_error init_lfe_synth_data( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else static ivas_error init_lfe_synth_data_fx( Decoder_Struct *st_ivas, /* i : IVAS decoder struct */ MASA_DECODER_HANDLE hMasa /* i/o: MASA decoder structure */ @@ -2554,13 +2302,6 @@ static ivas_error init_lfe_synth_data_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } -#if 1 /* TODO: remove float code. */ - hMasa->hMasaLfeSynth->transportEneSmooth = 0.0f; - hMasa->hMasaLfeSynth->protoLfeEneSmooth = 0.0f; - hMasa->hMasaLfeSynth->targetEneLfeSmooth = 0.0f; - hMasa->hMasaLfeSynth->targetEneTransSmooth = 0.0f; -#endif - hMasa->hMasaLfeSynth->transportEneSmooth_fx = 0; move32(); hMasa->hMasaLfeSynth->transportEneSmooth_q = Q31; @@ -2578,9 +2319,6 @@ static ivas_error init_lfe_synth_data_fx( hMasa->hMasaLfeSynth->targetEneTransSmooth_q = Q31; move16(); -#if 1 /* TODO: remove float code. */ - set_zero( hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio, MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif set16_fx( hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); hMasa->hMasaLfeSynth->lfeGainPrevIndex = 0; move16(); @@ -2605,25 +2343,15 @@ static ivas_error init_lfe_synth_data_fx( tmp = BASOP_Util_Divide3232_Scale(output_Fs, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &tmp_e); bufferSize = shr(tmp, sub(15, tmp_e)); // Q0 -#if 1 /* TODO: remove float code. */ - IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer = ( float * )malloc( bufferSize * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - set_zero( hMasa->hMasaLfeSynth->lfeSynthRingBuffer, bufferSize ); -#endif - IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx = ( Word16 * )malloc( bufferSize * sizeof( Word16 ) ) ) == NULL) + IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx = ( Word32 * )malloc( bufferSize * sizeof( Word32 ) ) ) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n")); } - set16_fx( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx, 0, bufferSize ); + set32_fx( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx, 0, bufferSize ); hMasa->hMasaLfeSynth->ringBufferLoPointer = 0; move16(); hMasa->hMasaLfeSynth->ringBufferHiPointer = shr(bufferSize, 1); -#if 1 /* TODO: remove float code. */ - hMasa->hMasaLfeSynth->lowpassSum = 0.0f; -#endif hMasa->hMasaLfeSynth->lowpassSum_fx = 0; move16(); hMasa->hMasaLfeSynth->ringBufferSize = bufferSize; @@ -2633,70 +2361,43 @@ static ivas_error init_lfe_synth_data_fx( * Moving average lowpass filter with the crossover of 240 Hz. */ bufferSize = shr( bufferSize, 1 ); -#if 1 /* TODO: remove float code. */ - IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - set_zero( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2, bufferSize ); -#endif - IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx = (Word16 *) malloc( bufferSize * sizeof( Word16 ) ) ) == NULL ) + IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } - set16_fx( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx, 0, bufferSize ); + set32_fx( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx, 0, bufferSize ); hMasa->hMasaLfeSynth->ringBufferLoPointer2 = 0; -#if 1 /* TODO: remove float code. */ - hMasa->hMasaLfeSynth->lowpassSum2 = 0.0f; -#endif - hMasa->hMasaLfeSynth->lowpassSum2_fx = 0; move16(); + hMasa->hMasaLfeSynth->lowpassSum2_fx = 0; + move32(); hMasa->hMasaLfeSynth->ringBufferSize2 = bufferSize; move16(); /* Delay buffer for matching the delay of the lowpass filter */ bufferSize = shr(bufferSize, 1); /* The delay of the moving average lowpass filter is bufferSize / 2 */ -#if 1 /* TODO: remove float code. */ - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncLp = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } - set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncLp, bufferSize ); -#endif - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx = (Word16 *) malloc( bufferSize * sizeof( Word16 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - set16_fx( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx, 0, bufferSize ); + set32_fx( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx, 0, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncLp_size = bufferSize; move16(); /* Delay buffer for syncing with DirAC rendering */ bufferSize = sub(sub(NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ), shr(hMasa->hMasaLfeSynth->ringBufferSize, 1)), shr(hMasa->hMasaLfeSynth->ringBufferSize2, 1)); -#if 1 /* TODO: remove float code. */ - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, bufferSize ); -#endif - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word16 *) malloc( bufferSize * sizeof( Word16 ) ) ) == NULL ) + IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } - set16_fx( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, 0, bufferSize ); + set32_fx( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, 0, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size = bufferSize; move16(); /* Interpolation between slots */ -#if 1 /* TODO: remove float code. */ - hMasa->hMasaLfeSynth->lfeGainPrev = 0.0f; - hMasa->hMasaLfeSynth->transportGainPrev = 1.0f; -#endif hMasa->hMasaLfeSynth->lfeGainPrev_fx = 0; move16(); - hMasa->hMasaLfeSynth->transportGainPrev_fx = ONE_IN_Q14; + hMasa->hMasaLfeSynth->transportGainPrev_fx = ONE_IN_Q15; move16(); tmp = BASOP_Util_Divide3232_Scale(output_Fs, FRAMES_PER_SEC * CLDFB_NO_COL_MAX, &tmp_e); @@ -2705,10 +2406,6 @@ static ivas_error init_lfe_synth_data_fx( FOR ( i = 0; i < slot_size; i++ ) { hMasa->hMasaLfeSynth->interpolator_fx[i] = div_s( add( i, 1 ), slot_size ); -#if 1 - /* TODO: remove float code */ - hMasa->hMasaLfeSynth->interpolator[i] = fix16_to_float(hMasa->hMasaLfeSynth->interpolator_fx[i], Q15); -#endif } } ELSE IF ( st_ivas->hOutSetup.separateChannelEnabled && EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16(st_ivas->hOutSetup.num_lfe, 0) ) @@ -2717,38 +2414,20 @@ static ivas_error init_lfe_synth_data_fx( /* Delay buffer for syncing with DirAC rendering */ bufferSize = NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ); -#if 1 /* TODO: remove float code. */ - if ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); - } - set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, bufferSize ); -#endif - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word16 *) malloc( bufferSize * sizeof( Word16 ) ) ) == NULL ) + IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } - set16_fx( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, 0, bufferSize ); + set32_fx( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, 0, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size = bufferSize; move16(); -#if 1 /* TODO: remove float code. */ - hMasa->hMasaLfeSynth->lfeSynthRingBuffer = NULL; - hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = NULL; - hMasa->hMasaLfeSynth->delayBuffer_syncLp = NULL; -#endif hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx = NULL; hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx = NULL; hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx = NULL; } ELSE { -#if 1 /* TODO: remove float code. */ - hMasa->hMasaLfeSynth->lfeSynthRingBuffer = NULL; - hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = NULL; - hMasa->hMasaLfeSynth->delayBuffer_syncLp = NULL; - hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = NULL; -#endif hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx = NULL; hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx = NULL; hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx = NULL; @@ -2759,7 +2438,9 @@ static ivas_error init_lfe_synth_data_fx( } #endif + /*! r: Number of bits read */ +#ifndef IVAS_FLOAT_FIXED static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: McMASA LFE structure */ uint16_t *bitstream, /* i : bitstream */ @@ -2875,8 +2556,7 @@ static int16_t decode_lfe_to_total_energy_ratio( return lfeBitsRead; } - -#ifdef IVAS_FLOAT_FIXED +#else static Word16 decode_lfe_to_total_energy_ratio_fx( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: McMASA LFE structure */ UWord16 *bitstream, /* i : bitstream */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index aae13ac70..313c478d5 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1602,6 +1602,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( /* init onsetDetectionPower */ set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx, len ); set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx, len ); + hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector = Q31; #if 1/*To be removed later*/ set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1, len ); set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2, len ); @@ -3599,8 +3600,7 @@ void ivas_param_mc_dec_render( } } - Word16 length = nchan_transport; - FOR (Word16 i = 0; i < 16 * nchan_transport * hParamMC->num_freq_bands; i++) + FOR ( i = 0; i < 16 * nchan_transport * hParamMC->num_freq_bands; i++) { st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[i] = floatToFixed(st_ivas->hParamMC->Cldfb_RealBuffer_tc[i], 6); @@ -4330,6 +4330,7 @@ static void ivas_param_mc_dec_init_fx( /* init onsetDetectionPower */ set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx, len ); set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx, len ); + hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector = Q31; #if 1/*Floating point intialization: to be removed later*/ set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1, len ); set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2, len ); @@ -4488,8 +4489,6 @@ static void param_mc_protoSignalComputation_fx( Word32 *p_real_buffer_fx; // Q12 Word32 *p_imag_buffer_fx; // Q12 - Word16 proto_frame_f_q[ MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS * 120]; - set32_fx(proto_frame_f_fx, 0, 2 * num_freq_bands * diff_proto_info->num_protos_diff); @@ -4511,8 +4510,6 @@ static void param_mc_protoSignalComputation_fx( p_real_buffer_fx = &RealBuffer_fx[source_ch_idx * num_freq_bands]; p_imag_buffer_fx = &ImagBuffer_fx[source_ch_idx * num_freq_bands]; - Word16 i = shl(imult1616(proto_ch_idx, num_freq_bands), 1); - move16(); FOR (band = 0; band < num_freq_bands; band++) { diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 9242d0672..f7094db3d 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -8104,7 +8104,6 @@ static Word16 read_surround_coherence_hr_fx( IVAS_QDIRECTION *q_direction; Word16 min_index; Word16 d, idx; - Word32 int_error_ratio_surr; coding_subbands = hQMetaData->q_direction[0].cfg.nbands; q_direction = hQMetaData->q_direction; @@ -8196,7 +8195,7 @@ static Word16 read_surround_coherence_hr_fx( { IF( GT_16( no_cv_vec[j], 1 ) ) { - hQMetaData->surcoh_band_data[j].sur_coherence_index = L_add( (Word32) idx_sur_coh[j], L_deposit_l( min_index ) ); + hQMetaData->surcoh_band_data[j].sur_coherence_index = (UWord16) L_add( (Word32) idx_sur_coh[j], L_deposit_l( min_index ) ); hQMetaData->surcoh_band_data[j].surround_coherence[sf] = sur_coherence_cb_masa[idx_cb_sur_coh_masa[idx_ER[j]] * MASA_MAX_NO_CV_SUR_COH + hQMetaData->surcoh_band_data[j].sur_coherence_index]; } ELSE diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 6a5c50f8d..91db00884 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -68,10 +68,6 @@ ivas_error ivas_hrtf_init( return IVAS_ERR_WRONG_PARAMS; } -#if 1 /*To be removed later: Floating point initialization*/ - hHrtf->latency_s = 0; - hHrtf->gain_lfe = 0; -#endif hHrtf->latency_s_fx = 0; hHrtf->gain_lfe_fx = 0; hHrtf->max_num_ir = 0; @@ -85,17 +81,10 @@ ivas_error ivas_hrtf_init( FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { -#if 1 /*To be removed later: Floating point initialization*/ - hHrtf->inv_diffuse_weight[i] = 0; -#endif hHrtf->inv_diffuse_weight_fx[i] = 0; move16(); FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { -#if 1 /*To be removed later: Floating point memory allocation*/ - hHrtf->pOut_to_bin_re[i][j] = NULL; - hHrtf->pOut_to_bin_im[i][j] = NULL; -#endif hHrtf->num_iterations[i][j] = 0; move16(); hHrtf->pIndex_frequency_max[i][j] = NULL; @@ -106,10 +95,6 @@ ivas_error ivas_hrtf_init( FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { -#if 1 /*To be removed later: Floating point memory allocations*/ - hHrtf->pOut_to_bin_diffuse_re[j] = NULL; - hHrtf->pOut_to_bin_diffuse_im[j] = NULL; -#endif hHrtf->num_iterations_diffuse[j] = 0; move16(); hHrtf->pIndex_frequency_max_diffuse[j] = NULL; @@ -340,10 +325,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[j]; -#if 1 // To be removed later:Floating pointer initialization - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz_fx[j]; } @@ -351,10 +333,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; -#if 1 // To be removed later:Floating pointer initialization - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz_fx[j]; } @@ -388,10 +367,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[j]; -#if 1 /*To be removed later: Floating pointer intializations*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz_fx[j]; } @@ -399,10 +375,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; -#if 1 /*To be removed later: Floating pointer intializations*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz_fx[j]; } @@ -436,10 +409,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[j]; -#if 1 /*To be removed later: Floating pointer intializations*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz_fx[j]; } @@ -447,10 +417,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; -#if 1 /*To be removed later: Floating pointer intializations*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz_fx[j]; } @@ -511,10 +478,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_48kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[tmp][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_48kHz[tmp][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_BRIR_coeff_im_48kHz_fx[tmp][j]; } @@ -522,10 +486,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_48kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[tmp][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_48kHz[tmp][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_HRIR_coeff_im_48kHz_fx[tmp][j]; } @@ -553,10 +514,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_32kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[tmp][j]; -#if 1 /*To be removed later: Floating pointer intializations*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_32kHz[tmp][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_BRIR_coeff_im_32kHz_fx[tmp][j]; } @@ -564,10 +522,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_32kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[tmp][j]; -#if 1 /*To be removed later: Floating pointer intializations*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_32kHz[tmp][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_HRIR_coeff_im_32kHz_fx[tmp][j]; } @@ -595,10 +550,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_16kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[tmp][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_16kHz[tmp][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_BRIR_coeff_im_16kHz_fx[tmp][j]; } @@ -606,10 +558,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_16kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[tmp][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_16kHz[tmp][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_HRIR_coeff_im_16kHz_fx[tmp][j]; } @@ -647,10 +596,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz[i][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[i][j]; move32(); @@ -663,10 +609,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz_fx[j]; move32(); @@ -693,10 +636,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz[i][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[i][j]; move32(); @@ -710,10 +650,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz_fx[j]; move32(); @@ -740,10 +677,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz[i][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[i][j]; move32(); @@ -757,10 +691,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz_fx[j]; move32(); @@ -794,10 +725,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_48kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_48kHz[i][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[i][j]; move32(); @@ -810,10 +738,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz_fx[j]; move32(); @@ -840,10 +765,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_32kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_32kHz[i][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[i][j]; move32(); @@ -857,10 +779,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz_fx[j]; move32(); @@ -887,10 +806,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_16kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_16kHz[i][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[i][j]; move32(); @@ -904,10 +820,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[j]; move32(); @@ -941,10 +854,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_48kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_48kHz[i][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_FOA_HRIR_coeff_im_48kHz_fx[i][j]; move32(); @@ -957,10 +867,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz_fx[j]; move32(); @@ -987,10 +894,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_32kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_32kHz[i][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_FOA_HRIR_coeff_im_32kHz_fx[i][j]; move32(); @@ -1004,10 +908,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz_fx[j]; move32(); @@ -1034,10 +935,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_16kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_16kHz[i][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_FOA_HRIR_coeff_im_16kHz_fx[i][j]; move32(); @@ -1051,10 +949,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz_fx[j]; move32(); @@ -1108,10 +1003,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_brir_combined->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_brir_combined->pIndex_frequency_max_diffuse[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_im[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_im_fx[j]; } @@ -1119,10 +1011,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_combined->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_combined->pIndex_frequency_max_diffuse[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_im[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_im_fx[j]; } @@ -1176,10 +1065,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_brir_combined->num_iterations[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_brir_combined->pIndex_frequency_max[tmp][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_re[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_im[tmp][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_re_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_im_fx[tmp][j]; } @@ -1187,10 +1073,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_combined->num_iterations[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pIndex_frequency_max[tmp][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_re[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_im[tmp][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_re_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_im_fx[tmp][j]; } @@ -1221,10 +1104,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->num_iterations[i][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pIndex_frequency_max[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_re[i][j]; - hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_im[i][j]; -#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_im_fx[i][j]; move32(); @@ -1237,10 +1117,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa3->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pIndex_frequency_max_diffuse[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_im[j]; -#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_im_fx[j]; move32(); @@ -1267,10 +1144,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->num_iterations[i][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pIndex_frequency_max[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_re[i][j]; - hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_im[i][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_im_fx[i][j]; move32(); @@ -1283,10 +1157,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa2->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pIndex_frequency_max_diffuse[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_im[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_im_fx[j]; move32(); @@ -1313,10 +1184,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_foa->num_iterations[i][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pIndex_frequency_max[i][j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_re[i][j]; - hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_im[i][j]; -#endif + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_im_fx[i][j]; move32(); @@ -1329,10 +1197,7 @@ static ivas_error ivas_rend_initCrend_fx( { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_foa->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_foa->pIndex_frequency_max_diffuse[j]; -#if 1 /*To be removed later: Floating pointer initialization*/ - hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_im[j]; -#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_im_fx[j]; move32(); @@ -1353,7 +1218,7 @@ static ivas_error ivas_rend_initCrend_fx( return IVAS_ERR_OK; } -#endif +#else /*------------------------------------------------------------------------- * initCrend_from_rom() * @@ -2094,7 +1959,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERR_OK; } - +#endif /*------------------------------------------------------------------------- * ivas_shoebox_data_init() * @@ -2568,36 +2433,21 @@ ivas_error ivas_rend_initCrendWrapper( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); } -#if 1//To be removed later:floating pointer initialization - hCrend->lfe_delay_line = NULL; -#endif hCrend->lfe_delay_line_fx = NULL; FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { -#if 1//To be removed later:floating pointer initialization - hCrend->freq_buffer_re[i] = NULL; - hCrend->freq_buffer_im[i] = NULL; -#endif hCrend->freq_buffer_re_fx[i] = NULL; hCrend->freq_buffer_im_fx[i] = NULL; } FOR ( i = 0; i < BINAURAL_CHANNELS; i++ ) { -#if 1//To be removed later:floating pointer initialization - hCrend->prev_out_buffer[i] = NULL; -#endif hCrend->prev_out_buffer_fx[i] = NULL; } #if 1 - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; hCrend->hTrack = NULL; - hCrend->m_fYaw = 0; - hCrend->m_fPitch = 0; - hCrend->m_fRoll = 0; #endif hCrend->freq_buffer_re_diffuse_fx = NULL; hCrend->freq_buffer_im_diffuse_fx = NULL; @@ -2731,19 +2581,6 @@ ivas_error ivas_rend_openCrend( FOR ( i = 0; i < hHrtf->max_num_ir; i++ ) { -#if 1/*TODO: Floating point memory allocation:To be removed later*/ - IF ( ( hCrend->freq_buffer_re[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_zero( hCrend->freq_buffer_re[i], max_total_ir_len ); - IF ( ( hCrend->freq_buffer_im[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_zero( hCrend->freq_buffer_im[i], max_total_ir_len ); -#endif - IF ( ( hCrend->freq_buffer_re_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * max_total_ir_len ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); @@ -2758,13 +2595,6 @@ ivas_error ivas_rend_openCrend( FOR ( i = 0; i < BINAURAL_CHANNELS; i++ ) { -#if 1/*TODO: Floating point memory allocation:To be removed later*/ - IF ( ( hCrend->prev_out_buffer[i] = (float *) malloc( sizeof( float ) * subframe_length ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_zero( hCrend->prev_out_buffer[i], subframe_length ); -#endif IF ( ( hCrend->prev_out_buffer_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * subframe_length ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); @@ -2776,18 +2606,6 @@ ivas_error ivas_rend_openCrend( IF ( GT_16(max_total_ir_len , 0) ) { -#if 1/*TODO: Floating point memory allocation:To be removed later*/ - if ( ( hCrend->freq_buffer_re_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_zero( hCrend->freq_buffer_re_diffuse, max_total_ir_len ); - if ( ( hCrend->freq_buffer_im_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_zero( hCrend->freq_buffer_im_diffuse, max_total_ir_len ); -#endif // IF ( ( hCrend->freq_buffer_re_diffuse_fx = (Word32 *) malloc( sizeof( Word32 ) * max_total_ir_len ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); @@ -2801,10 +2619,6 @@ ivas_error ivas_rend_openCrend( } ELSE { -#if 1/*TODO: Floating point memory allocation:To be removed later*/ - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; -#endif // hCrend->freq_buffer_re_diffuse_fx = NULL; hCrend->freq_buffer_im_diffuse_fx = NULL; } @@ -2812,13 +2626,6 @@ ivas_error ivas_rend_openCrend( max_total_ir_len = add(extract_l(L_shr(L_add(L_shl(Mult_32_32(hHrtf->latency_s_fx , output_Fs),1) , 1) ,1)) , subframe_length);/*(int16_t) ( hHrtf->latency_s * output_Fs + 0.5f ) + subframe_length;*/ IF ( GT_16(max_total_ir_len , 0) ) { -#if 1/*TODO: Floating point memory allocation:To be removed later*/ - IF ( ( hCrend->lfe_delay_line = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_zero( hCrend->lfe_delay_line, max_total_ir_len ); -#endif IF ( ( hCrend->lfe_delay_line_fx = (Word32 *) malloc( sizeof(Word32) * max_total_ir_len ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); @@ -2827,9 +2634,6 @@ ivas_error ivas_rend_openCrend( } ELSE { -#if 1/*TODO: Floating point memory allocation:To be removed later*/ - hCrend->lfe_delay_line = NULL; -#endif hCrend->lfe_delay_line_fx = NULL; } @@ -2918,16 +2722,6 @@ void ivas_rend_closeCrend( { for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { - if ( hCrend->freq_buffer_re[i] != NULL ) - { - free( hCrend->freq_buffer_re[i] ); - hCrend->freq_buffer_re[i] = NULL; - } - if ( hCrend->freq_buffer_im[i] != NULL ) - { - free( hCrend->freq_buffer_im[i] ); - hCrend->freq_buffer_im[i] = NULL; - } if ( hCrend->freq_buffer_re_fx[i] != NULL ) { free( hCrend->freq_buffer_re_fx[i] ); @@ -2942,11 +2736,6 @@ void ivas_rend_closeCrend( for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { - if ( hCrend->prev_out_buffer[i] != NULL ) - { - free( hCrend->prev_out_buffer[i] ); - hCrend->prev_out_buffer[i] = NULL; - } if ( hCrend->prev_out_buffer_fx[i] != NULL ) { free( hCrend->prev_out_buffer_fx[i] ); @@ -2961,11 +2750,6 @@ void ivas_rend_closeCrend( hCrend->lfe_delay_line_fx = NULL; } #endif - if ( hCrend->lfe_delay_line != NULL ) - { - free( hCrend->lfe_delay_line ); - hCrend->lfe_delay_line = NULL; - } if ( hCrend->lfe_delay_line_fx != NULL ) { @@ -2973,17 +2757,6 @@ void ivas_rend_closeCrend( hCrend->lfe_delay_line_fx = NULL; } - if ( hCrend->freq_buffer_re_diffuse != NULL ) - { - free( hCrend->freq_buffer_re_diffuse ); - hCrend->freq_buffer_re_diffuse = NULL; - } - - if ( hCrend->freq_buffer_im_diffuse != NULL ) - { - free( hCrend->freq_buffer_im_diffuse ); - hCrend->freq_buffer_im_diffuse = NULL; - } if ( hCrend->freq_buffer_re_diffuse_fx != NULL ) { free( hCrend->freq_buffer_re_diffuse_fx ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 9968120a2..79ba4ba4d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -4950,8 +4950,8 @@ static void ivas_masa_ext_rend_parambin_internal( FOR( slot = 0; slot < 4; slot++ ) FOR( Word16 ind = 0; ind < 60; ind++ ) { - Cldfb_RealBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_RealBuffer_in[cha][slot][ind], Q6 ); - Cldfb_ImagBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_ImagBuffer_in[cha][slot][ind], Q6 ); + Cldfb_RealBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_RealBuffer_in[cha][slot][ind], Q6 ); + Cldfb_ImagBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_ImagBuffer_in[cha][slot][ind], Q6 ); } ivas_dirac_dec_binaural_process_output_fx(hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat); diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index ce125f9a1..b1e24ca06 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -254,6 +254,10 @@ ivas_error ivas_dirac_dec_decorr_open( freq_domain_decorr_ap_params->pre_delay = NULL; freq_domain_decorr_ap_params->filter_length = NULL; +#ifdef IVAS_FLOAT_FIXED + freq_domain_decorr_ap_state->decorr_buffer_fx = NULL; +#endif + if (num_outputs_diff > 0) { buffer_size_decorr = (ap_pre_delay[split_band_index_start] + ap_filter_length[split_band_index_start]); @@ -263,6 +267,15 @@ ivas_error ivas_dirac_dec_decorr_open( } set_f(freq_domain_decorr_ap_state->decorr_buffer, 0.0f, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr); +#ifdef IVAS_FLOAT_FIXED + IF((freq_domain_decorr_ap_state->decorr_buffer_fx = (Word32 *)malloc(sizeof(Word32) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr)) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + } + set32_fx(freq_domain_decorr_ap_state->decorr_buffer_fx, 0, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr); + freq_domain_decorr_ap_state->q_decorr_buffer = Q31; +#endif + if ((freq_domain_decorr_ap_params->filter_coeff_num_real = (float *)malloc(sizeof(float) * (ap_filter_length[split_band_index_start] + 1) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff)) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index 9a9dfe43d..b9f8ddee9 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -203,6 +203,7 @@ ivas_error ivas_dirac_dec_onset_detection_open( /* init to zero */ set32_fx(dirac_onset_detection_state->onset_detector_1_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr); set32_fx(dirac_onset_detection_state->onset_detector_2_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr); + dirac_onset_detection_state->q_onset_detector = Q31; #endif /*to be cleand up*/ IF((dirac_onset_detection_state->onset_detector_1 = (float *)malloc(sizeof(float) * num_protos_diff * dirac_onset_detection_params->max_band_decorr)) == NULL) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 43a0cb5e8..ca6c7b02f 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1618,8 +1618,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Word16 diff_start_band; DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - Word16 q_onset; - h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); @@ -1703,8 +1701,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( hSpatParamRendCom->diffuseness_vector_fx[md_idx], h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_fx, - h_dirac_output_synthesis_state->direct_power_factor_q, - h_dirac_output_synthesis_state->diffuse_power_factor_q); + &h_dirac_output_synthesis_state->direct_power_factor_q, + &h_dirac_output_synthesis_state->diffuse_power_factor_q); } } ELSE IF ( EQ_16(dec_param_estim, TRUE )) @@ -1769,11 +1767,11 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( FOR ( ch_idx = 0; ch_idx < s_min( 4, nchan_transport ); ch_idx++ ) { - Word16 k, temp = 0; + Word16 k; IF ( NE_16(ch_idx, 0 )) { - Word32 a, b, c; - Word16 b_exp, sqr_exp, q_diff_aab, q_diff_c; + Word32 a, c; + Word16 b, b_exp, sqr_exp, q_diff_aab, q_diff_c; Word32 mpy_a_a_b, mpy_diff_c, mpy_diff_aab; Word32 sqr_inp, sqr; @@ -3674,7 +3672,6 @@ static void ivas_dirac_dec_get_response_split_order_fx( tmp = BASOP_util_atan2( dv_r_1, dv_r_0, 0 ); // Q13 index_azimuth = shr( mult( tmp, _180_OVER_PI_Q9 ), 7 ); // Q0; - IF(EQ_16(index_azimuth, -180)) { tmp = 0; move16(); @@ -5146,7 +5143,183 @@ void ivas_dirac_dec_compute_power_factors_fx( * * *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_lfe_synth_with_filters_fx( + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ + Word32 *data_fx[], /* o : output signals (Q11) */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 separateChannelIndex, /* i : separate channel index */ + const Word16 lfeChannelIndex /* i : LFE channel index */ +) +{ + Word16 lowpassCoef_fx; + Word16 lowpassCoef_fx_exp; + Word16 i, j; + Word32 lowPassSignal_fx[L_FRAME48k]; + Word32 highPassSignal_fx[L_FRAME48k]; + int16_t slot_index; + int16_t subframe_index; + int16_t slotSize; + Word32 transportEne_fx, targetEneLfe_fx, targetEneTrans_fx; + int16_t mrange[2]; + Word16 lfeGain_fx; + Word16 lfeGain_fx_exp; + Word16 transportGain_fx; + Word16 transportGain_fx_exp; + int16_t delay; + + /* Delay the separated channel to sync the LFE synthesis with the DirAC rendering */ + delay = hMasaLfeSynth->delayBuffer_syncDirAC_size; + move16(); + delay_signal_fx( data_fx[separateChannelIndex], output_frame, hMasaLfeSynth->delayBuffer_syncDirAC_fx, delay ); + + /* Filterbank for dividing the separated channel to LFE frequencies and higher frequencies */ + lowpassCoef_fx_exp = 15; + move16(); + lowpassCoef_fx = Inv16( hMasaLfeSynth->ringBufferSize, &lowpassCoef_fx_exp ); + FOR( i = 0; i < output_frame; i++ ) + { + hMasaLfeSynth->lowpassSum_fx = L_add( hMasaLfeSynth->lowpassSum_fx, L_shl( Mpy_32_16_1( L_sub( data_fx[separateChannelIndex][i], hMasaLfeSynth->lfeSynthRingBuffer_fx[hMasaLfeSynth->ringBufferLoPointer] ), lowpassCoef_fx ), lowpassCoef_fx_exp ) ); // Q11 + lowPassSignal_fx[i] = hMasaLfeSynth->lowpassSum_fx; // Q11 + move32(); + highPassSignal_fx[i] = L_sub( hMasaLfeSynth->lfeSynthRingBuffer_fx[hMasaLfeSynth->ringBufferHiPointer], lowPassSignal_fx[i] ); // Q11 + move32(); + hMasaLfeSynth->lfeSynthRingBuffer_fx[hMasaLfeSynth->ringBufferLoPointer] = data_fx[separateChannelIndex][i]; // Q11 + move32(); + + hMasaLfeSynth->ringBufferLoPointer--; + IF( LT_16( hMasaLfeSynth->ringBufferLoPointer, 0 ) ) + { + hMasaLfeSynth->ringBufferLoPointer = sub( hMasaLfeSynth->ringBufferSize, 1 ); + } + + hMasaLfeSynth->ringBufferHiPointer--; + IF( LT_16( hMasaLfeSynth->ringBufferHiPointer, 0 ) ) + { + hMasaLfeSynth->ringBufferHiPointer = sub( hMasaLfeSynth->ringBufferSize, 1 ); + } + } + + /* Synthesize the LFE signal */ + slotSize = shr_r( output_frame, 4 ); // output_frame / CLDFB_NO_COL_MAX + FOR( slot_index = 0; slot_index < CLDFB_NO_COL_MAX; slot_index++ ) + { + subframe_index = shr( slot_index, 4 ); + + mrange[0] = i_mult( slot_index, slotSize ); + move16(); + mrange[1] = i_mult( add( slot_index, 1 ), slotSize ); + move16(); + + transportEne_fx = 0; + move32(); + Word64 W_tmp = 0; + move64(); + FOR( i = mrange[0]; i < mrange[1]; i++ ) + { + W_tmp = W_add( W_tmp, W_mult0_32_32( lowPassSignal_fx[i], lowPassSignal_fx[i] ) ); // Q22 + } + + Word16 tmp_shift = W_norm( W_tmp ); + move16(); + + W_tmp = W_shl( W_tmp, tmp_shift ); + move64(); + + Word16 tmp_q = Q22 + tmp_shift - 32; + move16(); + Word16 tmp_exp; + + transportEne_fx = W_extract_h( W_tmp ); /* Q22 + tmp_shift - 32 */ + targetEneLfe_fx = W_extract_l( W_shr( W_mult0_32_32( transportEne_fx, hMasaLfeSynth->lfeToTotalEnergyRatio_fx[subframe_index] ), Q14 ) ); /* Q22 + tmp_shift - 32 */ + targetEneTrans_fx = W_extract_l( W_shr( W_mult0_32_32( transportEne_fx, s_max( sub( ONE_IN_Q14, hMasaLfeSynth->lfeToTotalEnergyRatio_fx[subframe_index] ), 168 ) ), Q14 ) ); /* Q22 + tmp_shift - 32 */ + + hMasaLfeSynth->transportEneSmooth_fx = Mpy_32_16_1( hMasaLfeSynth->transportEneSmooth_fx, MCMASA_LFE_SYNTH_ALPHA_Q15 ); /* transportEneSmooth_q */ + hMasaLfeSynth->targetEneLfeSmooth_fx = Mpy_32_16_1( hMasaLfeSynth->targetEneLfeSmooth_fx, MCMASA_LFE_SYNTH_ALPHA_Q15 ); /* targetEneLfeSmooth_q */ + hMasaLfeSynth->targetEneTransSmooth_fx = Mpy_32_16_1( hMasaLfeSynth->targetEneTransSmooth_fx, MCMASA_LFE_SYNTH_ALPHA_Q15 ); /* targetEneTransSmooth_q */ + hMasaLfeSynth->transportEneSmooth_fx = BASOP_Util_Add_Mant32Exp( hMasaLfeSynth->transportEneSmooth_fx, ( Q31 - hMasaLfeSynth->transportEneSmooth_q ), transportEne_fx, ( Q31 - tmp_q ), &tmp_exp ); /* Q31 - tmp_exp */ + hMasaLfeSynth->transportEneSmooth_q = sub( Q31, tmp_exp ); + hMasaLfeSynth->targetEneLfeSmooth_fx = BASOP_Util_Add_Mant32Exp( hMasaLfeSynth->targetEneLfeSmooth_fx, ( Q31 - hMasaLfeSynth->targetEneLfeSmooth_q ), targetEneLfe_fx, ( Q31 - tmp_q ), &tmp_exp ); /* Q31 - tmp_exp */ + hMasaLfeSynth->targetEneLfeSmooth_q = sub( Q31, tmp_exp ); + hMasaLfeSynth->targetEneTransSmooth_fx = BASOP_Util_Add_Mant32Exp( hMasaLfeSynth->targetEneTransSmooth_fx, ( Q31 - hMasaLfeSynth->targetEneTransSmooth_q ), targetEneTrans_fx, ( Q31 - tmp_q ), &tmp_exp ); /* Q31 - tmp_exp */ + hMasaLfeSynth->targetEneTransSmooth_q = sub( Q31, tmp_exp ); + + IF( BASOP_Util_Cmp_Mant32Exp( hMasaLfeSynth->targetEneLfeSmooth_fx, ( Q31 - hMasaLfeSynth->targetEneLfeSmooth_q ), /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, ( Q31 - hMasaLfeSynth->transportEneSmooth_q ) ) == 1 ) + { + lfeGain_fx = MAX_16; + move16(); + } + ELSE + { + lfeGain_fx = BASOP_Util_Divide3232_Scale( hMasaLfeSynth->targetEneLfeSmooth_fx, /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, &lfeGain_fx_exp ); + lfeGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneLfeSmooth_q ), lfeGain_fx_exp ); + lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp ); + lfeGain_fx = shl_r( lfeGain_fx, lfeGain_fx_exp ); // Q15 + } + IF( BASOP_Util_Cmp_Mant32Exp( hMasaLfeSynth->targetEneTransSmooth_fx, ( Q31 - hMasaLfeSynth->targetEneTransSmooth_q ), /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, ( Q31 - hMasaLfeSynth->transportEneSmooth_q ) ) == 1 ) + { + transportGain_fx = MAX_16; + move16(); + } + ELSE + { + transportGain_fx = BASOP_Util_Divide3232_Scale( hMasaLfeSynth->targetEneTransSmooth_fx, /*EPSILON + */ hMasaLfeSynth->transportEneSmooth_fx, &transportGain_fx_exp ); + transportGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneTransSmooth_q ), transportGain_fx_exp ); + transportGain_fx = Sqrt16( transportGain_fx, &transportGain_fx_exp ); + transportGain_fx = shl_r( transportGain_fx, transportGain_fx_exp ); // Q15 + } + j = 0; + FOR( i = mrange[0]; i < mrange[1]; i++ ) + { + Word32 L_tmp1 = L_mult( transportGain_fx, hMasaLfeSynth->interpolator_fx[j] ); // Q31 + Word32 L_tmp2 = L_mult( hMasaLfeSynth->transportGainPrev_fx, sub( MAX_16, hMasaLfeSynth->interpolator_fx[j] ) ); // Q31 + data_fx[separateChannelIndex][i] = L_add( Mpy_32_32( L_add( L_tmp1, L_tmp2 ), lowPassSignal_fx[i] ), highPassSignal_fx[i] ); + move32(); + Word32 L_tmp3 = L_mult( lfeGain_fx, hMasaLfeSynth->interpolator_fx[j] ); // Q31 + Word32 L_tmp4 = L_mult( hMasaLfeSynth->lfeGainPrev_fx, sub( MAX_16, hMasaLfeSynth->interpolator_fx[j] ) ); + data_fx[lfeChannelIndex][i] = Mpy_32_32( L_add( L_tmp3, L_tmp4 ), lowPassSignal_fx[i] ); + move32(); + j++; + } + + hMasaLfeSynth->lfeGainPrev_fx = lfeGain_fx; + move16(); + hMasaLfeSynth->transportGainPrev_fx = transportGain_fx; + move16(); + } + + /* Lowpass filter for removing remaining mid and high frequencies from the LFE signal */ + lowpassCoef_fx_exp = 15; + move16(); + lowpassCoef_fx = Inv16( hMasaLfeSynth->ringBufferSize2, &lowpassCoef_fx_exp ); + FOR( i = 0; i < output_frame; i++ ) + { + hMasaLfeSynth->lowpassSum2_fx = L_add( hMasaLfeSynth->lowpassSum2_fx, + L_shl_r( L_sub( Mpy_32_16_1( data_fx[lfeChannelIndex][i], lowpassCoef_fx ), + Mpy_32_16_1( hMasaLfeSynth->lfeSynthRingBuffer2_fx[hMasaLfeSynth->ringBufferLoPointer2], lowpassCoef_fx ) ), + lowpassCoef_fx_exp ) ); + hMasaLfeSynth->lfeSynthRingBuffer2_fx[hMasaLfeSynth->ringBufferLoPointer2] = data_fx[lfeChannelIndex][i]; + move32(); + + hMasaLfeSynth->ringBufferLoPointer2--; + IF( LT_16( hMasaLfeSynth->ringBufferLoPointer2, 0 ) ) + { + hMasaLfeSynth->ringBufferLoPointer2 = sub( hMasaLfeSynth->ringBufferSize2, 1 ); + } + + data_fx[lfeChannelIndex][i] = hMasaLfeSynth->lowpassSum2_fx; + move32(); + } + + /* Delay the separated channel to match the delay of the lowpass filter */ + delay = hMasaLfeSynth->delayBuffer_syncLp_size; + move16(); + delay_signal_fx( data_fx[separateChannelIndex], output_frame, hMasaLfeSynth->delayBuffer_syncLp_fx, delay ); + + return; +} +#else void ivas_lfe_synth_with_filters( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ float *data_f[], /* o : output signals */ @@ -5255,7 +5428,7 @@ void ivas_lfe_synth_with_filters( return; } - +#endif /*------------------------------------------------------------------------- * Local functions diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 85ef5378c..3e2acd873 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -5815,7 +5815,7 @@ static void ivas_masa_ext_dirac_render_sf( return; } -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED_u //Currently disabled static void ivas_masa_ext_dirac_render_sf_fx( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: IVAS decoder structure */ Word32 *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -5986,9 +5986,9 @@ static void ivas_masa_ext_dirac_render_sf_fx( { protoSignalComputation_shd_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, reference_power, q_reference_power, slot_idx, nchan_transport, hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands, @@ -6255,7 +6255,7 @@ void ivas_masa_ext_dirac_render( return; } -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED_u //Currently disabled void ivas_masa_ext_dirac_render_fx( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ Word32 *output_f[], /* i/o: input/output signals in time domain */ diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index b570c8216..0cbdbdb7f 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -1182,7 +1182,6 @@ ivas_error ivas_orient_trk_SetReferenceVector_fx( IVAS_VECTOR3 acousticFrontVector, ivasForwardVector; IVAS_VECTOR3 listenerPosLevel, refPosLevel; Word32 acousticFrontVectorLength; - Word16 acousticFrontVector_q; IF( pOTR == NULL ) { diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index ece1d6785..807dce497 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -450,7 +450,7 @@ typedef struct dirac_output_synthesis_state_structure Word16 q_cy_cross_dir_smooth_prev; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ Word16 q_cy_auto_diff_smooth_prev; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ - const Word16 *onset_filter_fx; + const Word32 *onset_filter_fx; /* Temporal smoothing memories */ Word16 *reference_power_smooth_prev_fx; @@ -527,68 +527,77 @@ typedef struct /* McMASA LFE synthesis structure */ typedef struct ivas_mcmasa_lfe_synth_struct { +#ifndef IVAS_FLOAT_FIXED float lfeToTotalEnergyRatio[MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef IVAS_FLOAT_FIXED - Word16 lfeToTotalEnergyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; // Q14 +#else + Word16 lfeToTotalEnergyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Q14 */ #endif int16_t lfeGainPrevIndex; +#ifndef IVAS_FLOAT_FIXED float transportEneSmooth; float protoLfeEneSmooth; float targetEneLfeSmooth; float targetEneTransSmooth; -#ifdef IVAS_FLOAT_FIXED - Word32 transportEneSmooth_fx; +#else + Word32 transportEneSmooth_fx; /* transportEneSmooth_q */ Word16 transportEneSmooth_q; - Word32 protoLfeEneSmooth_fx; + Word32 protoLfeEneSmooth_fx; /* protoLfeEneSmooth_q */ Word16 protoLfeEneSmooth_q; - Word32 targetEneLfeSmooth_fx; + Word32 targetEneLfeSmooth_fx; /* targetEneLfeSmooth_q */ Word16 targetEneLfeSmooth_q; - Word32 targetEneTransSmooth_fx; + Word32 targetEneTransSmooth_fx; /* targetEneTransSmooth_q */ Word16 targetEneTransSmooth_q; #endif +#ifndef IVAS_FLOAT_FIXED float *lfeSynthRingBuffer; -#ifdef IVAS_FLOAT_FIXED - Word16 *lfeSynthRingBuffer_fx; +#else + Word32 *lfeSynthRingBuffer_fx; /* Q11 */ #endif int16_t ringBufferLoPointer; int16_t ringBufferHiPointer; +#ifndef IVAS_FLOAT_FIXED float lowpassSum; -#ifdef IVAS_FLOAT_FIXED - Word16 lowpassSum_fx; +#else + Word32 lowpassSum_fx; /* Q11 */ #endif int16_t ringBufferSize; +#ifndef IVAS_FLOAT_FIXED float *lfeSynthRingBuffer2; -#ifdef IVAS_FLOAT_FIXED - Word16 *lfeSynthRingBuffer2_fx; +#else + Word32 *lfeSynthRingBuffer2_fx; /* Q11 */ #endif int16_t ringBufferLoPointer2; +#ifndef IVAS_FLOAT_FIXED float lowpassSum2; -#ifdef IVAS_FLOAT_FIXED - Word16 lowpassSum2_fx; +#else + Word32 lowpassSum2_fx; /* Q11 */ #endif int16_t ringBufferSize2; +#ifndef IVAS_FLOAT_FIXED float *delayBuffer_syncLp; -#ifdef IVAS_FLOAT_FIXED - Word16 *delayBuffer_syncLp_fx; +#else + Word32 *delayBuffer_syncLp_fx; /* Q11 */ #endif int16_t delayBuffer_syncLp_size; +#ifndef IVAS_FLOAT_FIXED float *delayBuffer_syncDirAC; -#ifdef IVAS_FLOAT_FIXED - Word16 *delayBuffer_syncDirAC_fx; +#else + Word32 *delayBuffer_syncDirAC_fx; /* Q11 */ #endif int16_t delayBuffer_syncDirAC_size; +#ifndef IVAS_FLOAT_FIXED float lfeGainPrev; float transportGainPrev; float interpolator[CLDFB_NO_CHANNELS_MAX]; -#ifdef IVAS_FLOAT_FIXED - Word16 lfeGainPrev_fx; - Word16 transportGainPrev_fx; /* Q14 */ - Word16 interpolator_fx[CLDFB_NO_CHANNELS_MAX]; /* Q15 */ +#else + Word16 lfeGainPrev_fx; /* Q15 */ + Word16 transportGainPrev_fx; /* Q15 */ + Word16 interpolator_fx[CLDFB_NO_CHANNELS_MAX]; /* Q15 */ #endif } MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; @@ -1824,15 +1833,10 @@ typedef struct #ifdef IVAS_FLOAT_FIXED typedef struct ivas_hrtfs_structure { - float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; Word32 *pOut_to_bin_re_fx[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_im[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; Word32 *pOut_to_bin_im_fx[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS]; Word32 *pOut_to_bin_diffuse_re_fx[BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS]; Word32 *pOut_to_bin_diffuse_im_fx[BINAURAL_CHANNELS]; - float latency_s; UWord16 num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; UWord16 num_iterations_diffuse[BINAURAL_CHANNELS]; UWord16 *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; @@ -1840,14 +1844,9 @@ typedef struct ivas_hrtfs_structure UWord16 index_frequency_max_diffuse; Word16 max_num_ir; Word16 max_num_iterations; - float inv_diffuse_weight[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ Word16 inv_diffuse_weight_fx[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ - float gain_lfe; - -#ifdef IVAS_FLOAT_FIXED Word32 latency_s_fx; Word16 gain_lfe_fx; -#endif } HRTFS_DATA, *HRTFS_HANDLE; #else typedef struct ivas_hrtfs_structure @@ -1873,26 +1872,15 @@ typedef struct ivas_hrtfs_structure /* Main Crend structure */ typedef struct ivas_crend_state_t { - float *freq_buffer_re[MAX_INTERN_CHANNELS]; Word32 *freq_buffer_re_fx[MAX_INTERN_CHANNELS]; - float *freq_buffer_im[MAX_INTERN_CHANNELS]; Word32 *freq_buffer_im_fx[MAX_INTERN_CHANNELS]; - float *freq_buffer_re_diffuse; Word32 *freq_buffer_re_diffuse_fx; - float *freq_buffer_im_diffuse; Word32 *freq_buffer_im_diffuse_fx; - float *prev_out_buffer[BINAURAL_CHANNELS]; Word32 *prev_out_buffer_fx[BINAURAL_CHANNELS]; - float *lfe_delay_line; Word32 *lfe_delay_line_fx; -#ifdef IVAS_FLOAT_FIXED Word32 m_fYaw_fx; Word32 m_fPitch_fx; Word32 m_fRoll_fx; -#endif // IVAS_FLOAT_FIXED - float m_fYaw; - float m_fPitch; - float m_fRoll; ivas_orient_trk_state_t *hTrack; REVERB_HANDLE hReverb; Word16 delay_line_rw_index; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c49d837e5..5f5f80b40 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1519,7 +1519,7 @@ static ivas_error getMcConfigValues_fx( return IVAS_ERR_OK; } -#endif +#else static ivas_error getMcConfigValues( AUDIO_CONFIG inConfig, const LSSETUP_CUSTOM_STRUCT *pInCustomLs, @@ -1585,7 +1585,7 @@ static ivas_error getMcConfigValues( return IVAS_ERR_OK; } - +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error initEfap( EFAP_WRAPPER *pEfapWrapper, @@ -2358,14 +2358,6 @@ static ivas_error setRendInputActiveIsm( { return error; } -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: fixed to float*/ - IF(inputIsm->crendWrapper && inputIsm->crendWrapper->hHrtfCrend != NULL ) - { - inputIsm->crendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( inputIsm->crendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); - inputIsm->crendWrapper->hHrtfCrend->latency_s = fixedToFloat( inputIsm->crendWrapper->hHrtfCrend->latency_s_fx, 31 ); - fixedToFloat_arr( inputIsm->crendWrapper->hHrtfCrend->inv_diffuse_weight_fx, inputIsm->crendWrapper->hHrtfCrend->inv_diffuse_weight, 15, 16 ); - } -#endif } else if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) { @@ -2539,7 +2531,7 @@ static void fillIdentityPanMatrix_fx( return; } -#endif +#else /* Note: this only sets non-zero elements, call setZeroPanMatrix() to init first. */ static void fillIdentityPanMatrix( pan_matrix panMatrix ) @@ -2553,7 +2545,7 @@ static void fillIdentityPanMatrix( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithIdentMatrix( input_mc *inputMc ) @@ -3881,15 +3873,6 @@ static ivas_error initMcBinauralRendering( { return error; } -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: fixed to float*/ - IF(inputMc->crendWrapper && inputMc->crendWrapper->hHrtfCrend != NULL ) - - { - inputMc->crendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( inputMc->crendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); - inputMc->crendWrapper->hHrtfCrend->latency_s = fixedToFloat( inputMc->crendWrapper->hHrtfCrend->latency_s_fx, 31 ); - fixedToFloat_arr( inputMc->crendWrapper->hHrtfCrend->inv_diffuse_weight_fx, inputMc->crendWrapper->hHrtfCrend->inv_diffuse_weight, 15, 16 ); - } -#endif } /* Initialise the EFAP handle for rotation on input layout */ @@ -4562,14 +4545,6 @@ static ivas_error updateSbaPanGains( return error; } -#if 1 /*Cleanup changes: fixed to float*/ - IF( inputSba->crendWrapper != NULL && inputSba->crendWrapper->hHrtfCrend != NULL) - { - inputSba->crendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( inputSba->crendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); - inputSba->crendWrapper->hHrtfCrend->latency_s = fixedToFloat( inputSba->crendWrapper->hHrtfCrend->latency_s_fx, 31 ); - fixedToFloat_arr( inputSba->crendWrapper->hHrtfCrend->inv_diffuse_weight_fx, inputSba->crendWrapper->hHrtfCrend->inv_diffuse_weight, 15, 16 ); - } -#endif return IVAS_ERR_OK; } #else @@ -6449,7 +6424,7 @@ ivas_error IVAS_REND_GetNumAllObjects( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error IVAS_REND_GetDelay( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ int16_t *nSamples, /* o : Renderer delay in samples */ @@ -6519,6 +6494,81 @@ ivas_error IVAS_REND_GetDelay( return IVAS_ERR_OK; } +#else +ivas_error IVAS_REND_GetDelay_fx( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ + Word16 *nSamples, /* o : Renderer delay in samples */ + Word32 *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ +) +{ + /* TODO tmu : this function only returns the maximum delay across all inputs + * Ideally each input has its own delay buffer and everything is aligned (binaural and LFE filtering delays are nonuniform) + */ + Word16 i; + Word32 latency_ns; + Word32 max_latency_ns; + + Word32 timescale_by_ns[7] = { 0, 17180, 34360, 0, 68719, 0, 103079 }; + + /* Validate function arguments */ + IF ( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + *timeScale = hIvasRend->sampleRateOut; + assert( *timeScale == 8000 || *timeScale == 16000 || *timeScale == 32000 || *timeScale == 48000 ); + *nSamples = 0; + max_latency_ns = 0; + + /* Compute the maximum delay across all inputs */ + FOR ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) + { + IF ( NE_32(hIvasRend->inputsIsm[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) + { + latency_ns = L_max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, + hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } + + FOR ( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) + { + IF ( NE_32(hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) + { + latency_ns = L_max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, + hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } + + FOR ( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) + { + IF ( NE_32(hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) + { + { + latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } + } + + + FOR ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) + { + IF ( NE_32(hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) + { + latency_ns = (Word32) ( IVAS_FB_DEC_DELAY_NS ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } + + //*nSamples = (Word16) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); + *nSamples = extract_l( Mpy_32_32_r( max_latency_ns, timescale_by_ns[*timeScale / 8000] ) ); + + return IVAS_ERR_OK; +} +#endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -11075,21 +11125,25 @@ static ivas_error getSamplesInternal( FOR ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) { - numMasaInputs += hIvasRend->inputsMasa[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + //numMasaInputs += hIvasRend->inputsMasa[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + numMasaInputs = EQ_32( L_add( numMasaInputs, hIvasRend->inputsMasa[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; } FOR ( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) { - numOtherInputs += hIvasRend->inputsMc[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + //numOtherInputs += hIvasRend->inputsMc[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsMc[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; } FOR ( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) { - numOtherInputs += hIvasRend->inputsSba[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + //numOtherInputs += hIvasRend->inputsSba[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsSba[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; } /* For ISM, we check only first as all ISMs are handled together via OMASA when merging to MASA. */ - numOtherInputs += hIvasRend->inputsIsm[0].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + //numOtherInputs += hIvasRend->inputsIsm[0].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsIsm[0].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; test(); IF ( EQ_16(numMasaInputs , 0) || EQ_16(numOtherInputs , 0) ) { diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 135392215..9f5695c48 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -230,6 +230,13 @@ ivas_error IVAS_REND_GetDelay( int16_t *nSamples, /* o : Renderer delay in samples */ int32_t *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_GetDelay_fx( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ + Word16 *nSamples, /* o : Renderer delay in samples */ + Word32 *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ +); +#endif // IVAS_FLOAT_FIXED /* Functions to be called during rendering */ diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 29bd4a8b0..f35783a9b 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -918,8 +918,7 @@ static ivas_error create_HRTF_from_rawdata( uint16_t max_total_num_fsamp_per_iteration, max_total_num_fsamp_per_iteration_diff; uint32_t mem_size; char *hrtf_data_rptr; - float *pOut_to_bin_wptr; - //Word32 *pOut_to_bin_wptr_fx; + Word32 *pOut_to_bin_wptr_fx; ivas_error error; if ( *hHRTF == NULL ) @@ -942,31 +941,32 @@ static ivas_error create_HRTF_from_rawdata( hrtf_data_rptr = hrtf_data; /* latency_s */ - ( *hHRTF )->latency_s = *( (float *) ( hrtf_data_rptr ) ); + //( *hHRTF )->latency_s = *( (float *) ( hrtf_data_rptr ) ); + ( *hHRTF )->latency_s_fx = (Word32) ( *( (float *) ( hrtf_data_rptr ) ) * ONE_IN_Q31 ); hrtf_data_rptr += sizeof( float ); /* max_num_ir */ - ( *hHRTF )->max_num_ir = *( (uint16_t *) ( hrtf_data_rptr ) ); - hrtf_data_rptr += sizeof( uint16_t ); + ( *hHRTF )->max_num_ir = *( (UWord16 *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( UWord16 ); /* BINAURAL_CHANNELS */ - if ( BINAURAL_CHANNELS != *( (int16_t *) ( hrtf_data_rptr ) ) ) + if ( BINAURAL_CHANNELS != *( (Word16 *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file format not compliant (BINAURAL_CHANNELS)" ); } - hrtf_data_rptr += sizeof( uint16_t ); + hrtf_data_rptr += sizeof( UWord16 ); /* max_num_iterations */ - ( *hHRTF )->max_num_iterations = *( (int16_t *) ( hrtf_data_rptr ) ); - hrtf_data_rptr += sizeof( int16_t ); + ( *hHRTF )->max_num_iterations = *( (Word16 *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( Word16 ); /* num_iterations */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - ( *hHRTF )->num_iterations[i][j] = *( (uint16_t *) ( hrtf_data_rptr ) ); - hrtf_data_rptr += sizeof( uint16_t ); + ( *hHRTF )->num_iterations[i][j] = *( (UWord16 *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( UWord16 ); } } @@ -975,8 +975,8 @@ static ivas_error create_HRTF_from_rawdata( { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - mem_size = ( *hHRTF )->max_num_iterations * sizeof( uint16_t ); - ( *hHRTF )->pIndex_frequency_max[i][j] = (uint16_t *) malloc( mem_size ); + mem_size = ( *hHRTF )->max_num_iterations * sizeof( UWord16 ); + ( *hHRTF )->pIndex_frequency_max[i][j] = (UWord16 *) malloc( mem_size ); if ( ( *hHRTF )->pIndex_frequency_max[i][j] == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max" ); @@ -987,23 +987,23 @@ static ivas_error create_HRTF_from_rawdata( } /* max_num_iterations_diffuse */ - max_num_iterations_diffuse = *( (int16_t *) ( hrtf_data_rptr ) ); - hrtf_data_rptr += sizeof( int16_t ); + max_num_iterations_diffuse = *( (Word16 *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( Word16 ); if ( max_num_iterations_diffuse != 0 ) { /* num_iterations_diffuse */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - ( *hHRTF )->num_iterations_diffuse[j] = *( (uint16_t *) ( hrtf_data_rptr ) ); - hrtf_data_rptr += sizeof( uint16_t ); + ( *hHRTF )->num_iterations_diffuse[j] = *( (UWord16 *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( UWord16 ); } /* pIndex_frequency_max_diffuse (the size depends on num_iterations_diffuse) */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - mem_size = ( *hHRTF )->num_iterations_diffuse[j] * sizeof( uint16_t ); - ( *hHRTF )->pIndex_frequency_max_diffuse[j] = (uint16_t *) malloc( mem_size ); + mem_size = ( *hHRTF )->num_iterations_diffuse[j] * sizeof( UWord16 ); + ( *hHRTF )->pIndex_frequency_max_diffuse[j] = (UWord16 *) malloc( mem_size ); if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max_diffuse" ); @@ -1014,20 +1014,20 @@ static ivas_error create_HRTF_from_rawdata( } /* index_frequency_max_diffuse */ - ( *hHRTF )->index_frequency_max_diffuse = *( (uint16_t *) ( hrtf_data_rptr ) ); - hrtf_data_rptr += sizeof( uint16_t ); + ( *hHRTF )->index_frequency_max_diffuse = *( (UWord16 *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( UWord16 ); /* inv_diffuse_weight */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { - ( *hHRTF )->inv_diffuse_weight[i] = *( (float *) ( hrtf_data_rptr ) ); + //( *hHRTF )->inv_diffuse_weight[i] = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->inv_diffuse_weight_fx[i] = ( Word16 ) (* ( (float *) ( hrtf_data_rptr ) ) * ONE_IN_Q15); hrtf_data_rptr += sizeof( float ); } /* max_total_num_fsamp_per_iteration */ - max_total_num_fsamp_per_iteration = *( (uint16_t *) ( hrtf_data_rptr ) ); - hrtf_data_rptr += sizeof( uint16_t ); + max_total_num_fsamp_per_iteration = *( (UWord16 *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( UWord16 ); /* coeff_re (the size depends on pIndex_frequency_max) */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) @@ -1035,12 +1035,6 @@ static ivas_error create_HRTF_from_rawdata( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = max_total_num_fsamp_per_iteration * sizeof( float ); - ( *hHRTF )->pOut_to_bin_re[i][j] = (float *) malloc( mem_size ); - if ( ( *hHRTF )->pOut_to_bin_re[i][j] == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_re" ); - } - memset( ( *hHRTF )->pOut_to_bin_re[i][j], 0x00, mem_size ); ( *hHRTF )->pOut_to_bin_re_fx[i][j] = (Word32 *) malloc( mem_size ); if ( ( *hHRTF )->pOut_to_bin_re_fx[i][j] == NULL ) { @@ -1048,81 +1042,60 @@ static ivas_error create_HRTF_from_rawdata( } memset( ( *hHRTF )->pOut_to_bin_re_fx[i][j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_re[i][j]; - // pOut_to_bin_wptr_fx = ( *hHRTF )->pOut_to_bin_re_fx[i][j]; + pOut_to_bin_wptr_fx = ( *hHRTF )->pOut_to_bin_re_fx[i][j]; for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ ) { mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( float ); - memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); - /* for ( Word16 l = 0; l < mem_size ;l++) + //memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); + for ( Word16 l = 0; l < (*hHRTF)->pIndex_frequency_max[i][j][k]; l++ ) { - pOut_to_bin_wptr_fx[l] = hrtf_data_rptr[l] * ONE_IN_Q29; - }*/ - hrtf_data_rptr += mem_size; - pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max[i][j][k]; - // pOut_to_bin_wptr_fx += ( *hHRTF )->pIndex_frequency_max[i][j][k]; + float *tmp, temp_buf[1]; + tmp = temp_buf; + memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); + pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); + pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); + hrtf_data_rptr += sizeof( float ); + } + //hrtf_data_rptr += mem_size; + pOut_to_bin_wptr_fx += ( *hHRTF )->pIndex_frequency_max[i][j][k]; } - /*for ( k = 0; k < 240; k++ ) - { - ( *hHRTF )->pOut_to_bin_re_fx[i][j][k] = ( *hHRTF )->pOut_to_bin_re[i][j][k] * ONE_IN_Q29; - }*/ } } mem_size = max_total_num_fsamp_per_iteration * sizeof( float ); - for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) - { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; (UWord32) k < mem_size / 4; k++ ) - { - ( *hHRTF )->pOut_to_bin_re_fx[i][j][k] =(Word32) (( *hHRTF )->pOut_to_bin_re[i][j][k] * ONE_IN_Q29); - } - } - - - } + /* coeff_im (the size depends on pIndex_frequency_max) */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = max_total_num_fsamp_per_iteration * sizeof( float ); - ( *hHRTF )->pOut_to_bin_im[i][j] = (float *) malloc( mem_size ); - if ( ( *hHRTF )->pOut_to_bin_im[i][j] == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_im" ); - } - memset( ( *hHRTF )->pOut_to_bin_im[i][j], 0x00, mem_size ); ( *hHRTF )->pOut_to_bin_im_fx[i][j] = (Word32 *) malloc( mem_size ); if ( ( *hHRTF )->pOut_to_bin_im_fx[i][j] == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_im" ); } memset( ( *hHRTF )->pOut_to_bin_im_fx[i][j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_im[i][j]; + pOut_to_bin_wptr_fx = ( *hHRTF )->pOut_to_bin_im_fx[i][j]; for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ ) { mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( float ); - memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); - hrtf_data_rptr += mem_size; - pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max[i][j][k]; + //memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); + for (Word16 l = 0; l < (*hHRTF)->pIndex_frequency_max[i][j][k]; l++) + { + float *tmp, temp_buf[1]; + tmp = temp_buf; + memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); + pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); + pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); + hrtf_data_rptr += sizeof( float ); + } + //hrtf_data_rptr += mem_size; + pOut_to_bin_wptr_fx += ( *hHRTF )->pIndex_frequency_max[i][j][k]; } } } mem_size = max_total_num_fsamp_per_iteration * sizeof( float ); - for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) - { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; (UWord32) k < mem_size / 4; k++ ) - { - // ( *hHRTF )->pOut_to_bin_re_fx[i][j][k] = ( *hHRTF )->pOut_to_bin_re[i][j][k] * ONE_IN_Q29; - ( *hHRTF )->pOut_to_bin_im_fx[i][j][k] = (Word32) (( *hHRTF )->pOut_to_bin_im[i][j][k] * ONE_IN_Q29); - } - } - - - } + /* max_total_num_fsamp_per_iteration_diff */ max_total_num_fsamp_per_iteration_diff = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); @@ -1133,12 +1106,6 @@ static ivas_error create_HRTF_from_rawdata( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float ); - ( *hHRTF )->pOut_to_bin_diffuse_re[j] = (float *) malloc( mem_size ); - if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_re" ); - } - memset( ( *hHRTF )->pOut_to_bin_diffuse_re[j], 0x00, mem_size ); ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j] = (Word32 *) malloc( mem_size ); if ( ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j] == NULL ) @@ -1146,34 +1113,30 @@ static ivas_error create_HRTF_from_rawdata( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_re" ); } memset( ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_re[j]; + pOut_to_bin_wptr_fx = ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j]; for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ ) { mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( float ); - memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); - hrtf_data_rptr += mem_size; - pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; + //memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); + for (Word16 l = 0; l < (*hHRTF)->pIndex_frequency_max_diffuse[j][k]; l++) + { + float *tmp, temp_buf[1]; + tmp = temp_buf; + memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); + pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); + pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); + hrtf_data_rptr += sizeof( float ); + } + //hrtf_data_rptr += mem_size; + pOut_to_bin_wptr_fx += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; } } mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float ); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; (UWord32) k < mem_size / 4; k++ ) - { - ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j][k] = (Word32) (( *hHRTF )->pOut_to_bin_diffuse_re[j][k] * ONE_IN_Q31); - // ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j][k] = ( *hHRTF )->pOut_to_bin_diffuse_im[j][k] * ONE_IN_Q31; - } - } + /* coeff_diffuse_im : The size depends on pIndex_frequency_max_diffuse */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float ); - ( *hHRTF )->pOut_to_bin_diffuse_im[j] = (float *) malloc( mem_size ); - if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_im" ); - } - memset( ( *hHRTF )->pOut_to_bin_diffuse_im[j], 0x00, mem_size ); ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j] = (Word32 *) malloc( mem_size ); if ( ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j] == NULL ) @@ -1181,25 +1144,25 @@ static ivas_error create_HRTF_from_rawdata( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_im" ); } memset( ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j], 0x00, mem_size ); - pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_im[j]; + pOut_to_bin_wptr_fx = ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j]; for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ ) { mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( float ); - memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); - hrtf_data_rptr += mem_size; - pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; + //memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size ); + for ( Word16 l = 0; l < (*hHRTF)->pIndex_frequency_max_diffuse[j][k]; l++ ) + { + float *tmp, temp_buf[1]; + tmp = temp_buf; + memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); + pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); + pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); + hrtf_data_rptr += sizeof( float ); + } + //hrtf_data_rptr += mem_size; + pOut_to_bin_wptr_fx += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; } } mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float ); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; (UWord32) k < mem_size / 4; k++ ) - { - //( *hHRTF )->pOut_to_bin_diffuse_re_fx[j][k] = ( *hHRTF )->pOut_to_bin_diffuse_re[j][k] * ONE_IN_Q31; - ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j][k] = (Word32) (( *hHRTF )->pOut_to_bin_diffuse_im[j][k] * ONE_IN_Q31); - } - } - } return IVAS_ERR_OK; @@ -2079,14 +2042,6 @@ static ivas_error destroy_HRTF( { free( ( *hHRTF )->pIndex_frequency_max[i][j] ); } - if ( ( *hHRTF )->pOut_to_bin_re[i][j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_re[i][j] ); - } - if ( ( *hHRTF )->pOut_to_bin_im[i][j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_im[i][j] ); - } if ( ( *hHRTF )->pOut_to_bin_re_fx[i][j] != NULL ) { free( ( *hHRTF )->pOut_to_bin_re_fx[i][j] ); @@ -2103,14 +2058,6 @@ static ivas_error destroy_HRTF( { free( ( *hHRTF )->pIndex_frequency_max_diffuse[j] ); } - if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_diffuse_re[j] ); - } - if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_diffuse_im[j] ); - } if ( ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j] != NULL ) { free( ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j] ); diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index b52e9acf4..cd548002a 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -35,6 +35,9 @@ #include #include #include "prot.h" +#ifdef IVAS_FLOAT_FIXED +#include "prot_fx2.h" +#endif struct RotFileReader @@ -124,11 +127,24 @@ ivas_error HeadRotationFileReading( pQuaternion->x = x; pQuaternion->y = y; pQuaternion->z = z; +#ifdef IVAS_FLOAT_FIXED + pQuaternion->w_fx = floatToFixed_32(w, Q31); + pQuaternion->x_fx = floatToFixed_32(x, Q31); + pQuaternion->y_fx = floatToFixed_32(y, Q31); + pQuaternion->z_fx = floatToFixed_32(z, Q31); + pQuaternion->q_fact = Q31; +#endif if ( pPos != NULL ) { pPos->x = posx; pPos->y = posy; pPos->z = posz; +#ifdef IVAS_FLOAT_FIXED + pPos->x_fx = floatToFixed_32(posx, Q25); + pPos->y_fx = floatToFixed_32(posy, Q25); + pPos->z_fx = floatToFixed_32(posz, Q25); + pPos->q_fact = Q25; +#endif } return IVAS_ERR_OK; -- GitLab From e6e72aa8a890469d9deb6f0e2c3bcf763b8989cc Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 3 May 2024 21:53:08 +0530 Subject: [PATCH 020/101] alternative to qmetadata penalty calculation --- lib_com/ivas_qmetadata_com.c | 34 ++++++++++++++++++++++++++++++++++ lib_com/options.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index b7fcd9f66..ac89ed19d 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -526,9 +526,14 @@ ivas_error only_reduce_bits_direction_fx( Word16 *bits_dir0; Word16 bits_sph_idx_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef FIX_QMETADATA_PENALTY + Word32 penalty[MASA_MAXIMUM_CODING_SUBBANDS]; + Word16 tmp; +#else Word16 penalty[MASA_MAXIMUM_CODING_SUBBANDS]; Word16 shift, tmp, tmp_e, flag; Word32 tmp_32; +#endif FOR( j = 0; j < coding_subbands; j++ ) { FOR( k = 0; k < no_subframes; k++ ) @@ -612,6 +617,34 @@ ivas_error only_reduce_bits_direction_fx( } ELSE { +#ifdef FIX_QMETADATA_PENALTY + FOR( j = 0; j < coding_subbands; j++ ) + { + penalty[j] = 1; + move32(); + FOR( k = 0; k < coding_subbands; k++ ) + { + IF( NE_16(k, j) ) + { + penalty[j] = L_shr( W_extract_l( W_mult_32_16( penalty[j], bits_sph_idx_orig[k][0] ) ), 1 ); + } + } + + tmp = sub( bits_sph_idx_orig[j][0], q_direction->band_data[j].bits_sph_idx[0] ); + FOR( k = 1; k < no_subframes; k++ ) + { + tmp = add( tmp, sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ) ; + } + + penalty[j] = L_shr(W_extract_l( W_mult_32_16( penalty[j], tmp )), 1); + } + sort_desc_ind_32_fx( penalty, coding_subbands, ind_order ); + for ( j = 0; j < coding_subbands; j++ ) + { + printf( "%d ", ind_order[j] ); + } + printf( "\n" ); +#else FOR( j = 0; j < coding_subbands; j++ ) { penalty[j] = 0; @@ -669,6 +702,7 @@ ivas_error only_reduce_bits_direction_fx( } } sort_desc_ind_16_fx( penalty, coding_subbands, ind_order ); +#endif } *reduce_bits_out = negate( reduce_bits ); diff --git a/lib_com/options.h b/lib_com/options.h index 366354dc8..b7a13d5bd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -121,6 +121,8 @@ #define FIX_ISSUE_723_INFO_TCX_NOISE /*FhG: Issue 723: fix for IGF that introduces wrong noise filling behavion*/ +#define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ + /* ##################### End NON-BE switches ########################### */ #define FIX_740_HQ_CORE_OVA // Proposed fix to solve overlap and add issue for HQ_CORE #define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues -- GitLab From 3a1c7461f37a8a961b353dfe430d5c717894ca04 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 8 May 2024 09:24:02 +0200 Subject: [PATCH 021/101] Add fix for issue 737 under FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR --- lib_com/options.h | 1 + lib_dec/acelp_core_dec_ivas_fx.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 366354dc8..743eae304 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -125,6 +125,7 @@ #define FIX_740_HQ_CORE_OVA // Proposed fix to solve overlap and add issue for HQ_CORE #define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues #define FIX_SATURATION_725 // Propose fix for saturation in AVQ +#define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 5c76a407c..078ec95e4 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -788,6 +788,9 @@ ivas_error acelp_core_dec_ivas_fx( preemph_fx( old_exc_s_fx, st->preemph_fac, L_FRAME16k, &tmpF_fx ); Copy(old_exc_s_fx + st->L_frame - M, st->mem_syn2_fx, M ); Residu3_fx( Aq_fx, old_exc_s_fx, old_exc_fx + L_EXC_MEM_DEC - st->L_frame, st->L_frame, 0 ); +#ifdef FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR + Scale_sig( old_exc_fx + L_EXC_MEM_DEC - st->L_frame, st->L_frame, st->Q_exc ); +#endif } if ( st->last_core != ACELP_CORE && st->element_mode > EVS_MONO ) -- GitLab From c5f570062655365dc1abd9f97d2fc667ad5083be Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 8 May 2024 13:32:07 +0530 Subject: [PATCH 022/101] fix the penalty calculation update --- lib_com/ivas_qmetadata_com.c | 51 +++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index ac89ed19d..538d74c71 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -618,32 +618,51 @@ ivas_error only_reduce_bits_direction_fx( ELSE { #ifdef FIX_QMETADATA_PENALTY + + Word16 m, sorted, index1, index2; + FOR( j = 0; j < coding_subbands; j++ ) { - penalty[j] = 1; - move32(); - FOR( k = 0; k < coding_subbands; k++ ) + ind_order[j] = j; + move16(); + } + sorted = 0; + move16(); + FOR( m = coding_subbands - 1; m && !sorted; m-- ) + { + sorted = 1; + move16(); + FOR( j = 0; j < m; j++ ) { - IF( NE_16(k, j) ) + index1 = ind_order[j]; + index2 = ind_order[j + 1]; + tmp = 0; + move16(); + FOR( k = 0; k < no_subframes; k++ ) { - penalty[j] = L_shr( W_extract_l( W_mult_32_16( penalty[j], bits_sph_idx_orig[k][0] ) ), 1 ); + tmp = add( tmp, sub( bits_sph_idx_orig[index1][k], q_direction->band_data[index1].bits_sph_idx[k] ) ); } + penalty[0] = L_shr( W_extract_l( W_mult_32_16( tmp, bits_sph_idx_orig[index2][0] ) ), 1 ); + tmp = 0; + move16(); + FOR( k = 0; k < no_subframes; k++ ) + { + tmp = add( tmp, sub( bits_sph_idx_orig[index2][k], q_direction->band_data[index2].bits_sph_idx[k] ) ); } - - tmp = sub( bits_sph_idx_orig[j][0], q_direction->band_data[j].bits_sph_idx[0] ); - FOR( k = 1; k < no_subframes; k++ ) + penalty[1] = L_shr( W_extract_l( W_mult_32_16( tmp, bits_sph_idx_orig[index1][0] ) ), 1 ); + IF( LT_32( penalty[0], penalty[1] ) ) { - tmp = add( tmp, sub( bits_sph_idx_orig[j][k], q_direction->band_data[j].bits_sph_idx[k] ) ) ; + sorted = 0; + move16(); + ind_order[j] = index2; + move16(); + ind_order[j + 1] = index1; + move16(); } - - penalty[j] = L_shr(W_extract_l( W_mult_32_16( penalty[j], tmp )), 1); } - sort_desc_ind_32_fx( penalty, coding_subbands, ind_order ); - for ( j = 0; j < coding_subbands; j++ ) - { - printf( "%d ", ind_order[j] ); } - printf( "\n" ); + + #else FOR( j = 0; j < coding_subbands; j++ ) { -- GitLab From 2c7a0d77bbb21170a6534555e4cceac92466e205 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 9 May 2024 15:58:07 +0530 Subject: [PATCH 023/101] ivas dirac dec rend functions conversion, efap and reverb cleanup [x] Converted ivas_dirac_dec_output_synthesis_process_subframe_psd_ls() and it's subfunctions [x] getEfapGains_fx integrated [x] ivas reverb cleanup and basop changes [x] Fix for High MLD issues for [SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM IR out, HR, reference vector tracking, in level exo] --- lib_com/cnst.h | 2 +- lib_com/float_to_fix_ops.c | 41 ++ lib_com/prot_fx2.h | 2 + lib_dec/dec_tcx_fx.c | 4 +- lib_dec/ivas_binRenderer_internal.c | 117 +++- lib_dec/ivas_dirac_dec.c | 192 ++++++ lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_dec.c | 4 +- lib_rend/ivas_crend.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 43 ++ lib_rend/ivas_dirac_output_synthesis_dec.c | 680 ++++++++++++++++++- lib_rend/ivas_dirac_rend.c | 15 +- lib_rend/ivas_orient_trk.c | 4 +- lib_rend/ivas_prot_rend.h | 20 +- lib_rend/ivas_reverb.c | 395 ++++++++--- lib_rend/ivas_reverb_filter_design.c | 2 +- lib_rend/ivas_stat_rend.h | 19 +- lib_rend/lib_rend.c | 199 +++--- 18 files changed, 1509 insertions(+), 234 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index eec60bbd2..7816c19e0 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -2717,7 +2717,7 @@ enum #define LG10 24660 /* 10*log10(2) in Q13 */ #define LG10_s3_0 16440 /* 10*log10(2)/1.55 = 1.00343331 in Q14 */ #define LOG2_10 27213 /* log base 2 of 10 in Q12 */ -#define INV_LOG10_2_Q31 646456993 /* inverse log base 10 of 2 in Q31 */ +#define LOG10_2_Q31 646456993 /* inverse log base 10 of 2 in Q31 */ #define MU_MA_FX 10923 /* original prediction factor for the AMR WB tables (Q15) */ #define E_MIN_FXQ15 115 /* Q15*/ diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 736b2f38a..3de3c441a 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -248,6 +248,47 @@ Word16 L_get_q_buf( float *ptr_flt, Word16 length ) return sub( norm_l( (Word32) ftemp ), 0 ); } } + +Word16 L_get_q1( float f ) +{ + if ( fabsf( f ) >= 0.f && fabsf( f ) < 1.f ) + { + return Q31; + } + else if ( fabsf( f ) > (float) INT_MAX ) + { + return sub( sub( W_norm( (Word64) f ), 32 ), 0 ); + } + else + { + return sub( norm_l( (Word32) f ), 0 ); + } +} + +Word16 L_get_q_buf1( float *ptr_flt, Word16 length ) +{ + Word16 k; + float ftemp = 0.0; + + for ( k = 0; k < length; k++ ) + { + if ( fabsf( ptr_flt[k] ) > ftemp ) + ftemp = fabsf( ptr_flt[k] ); + } + + if ( ftemp >= 0.f && ftemp < 1.f ) + { + return Q31; + } + else if ( ftemp > (float) INT_MAX ) + { + return sub( sub( W_norm( (Word64) ftemp ), 32 ), 0 ); + } + else + { + return sub( norm_l( (Word32) ftemp ), 0 ); + } +} #endif #ifdef IVAS_FLOAT_FIXED diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 88ece4c55..5ce69999b 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -132,8 +132,10 @@ void fix2f(Word32 *var_fix, float *var_flt, Word32 expo); #ifdef IVAS_FLOAT_FIXED // Get max Q factor for a float value before sat in 32-bit Word16 L_get_q( float f ); +Word16 L_get_q1( float f ); // Get max Q factor for a float buffer before sat in 32-bit Word16 L_get_q_buf( float *ptr_flt, Word16 length ); +Word16 L_get_q_buf1( float *ptr_flt, Word16 length ); #endif Word32 Mult_32_16( diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 45e907d8d..2c596d0af 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3662,8 +3662,8 @@ void decoder_tcx_ivas_fx( Scale_sig( st->hTcxDec->syn_Overl_TDACFB, 480, -( st->Q_syn + 2 ) ); // Scaling to Q-2 Scale_sig( st->hTcxDec->syn_OverlFB, 480, -( st->Q_syn + 2 ) ); // Scaling to Q-2 Scale_sig( st->hTcxDec->old_syn_Overl, 320, -( st->Q_syn + 1 + 0 ) ); // Scaling to Q-2 - Scale_sig( st->hHQ_core->old_out_LB_fx, 640, -( st->hHQ_core->Q_old_wtda + 2 ) ); // Scaling to Q-2 - Scale_sig( st->hHQ_core->old_out_fx, 960, -( st->hHQ_core->Q_old_wtda + 2 ) ); // Scaling to Q-2 + Scale_sig( st->hHQ_core->old_out_LB_fx, 640, -( st->Q_syn + 2 ) ); // Scaling to Q-2 + Scale_sig( st->hHQ_core->old_out_fx, 960, -( st->Q_syn + 2 ) ); // Scaling to Q-2 Copy_Scale_sig_16_32_no_sat( st->old_Aq_12_8_fx, st->old_Aq_12_8_fx_32, M + 1, ( 28 - ( 15 - norm_s( st->old_Aq_12_8_fx[0] - 1 ) ) ) ); diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 80c0d9d1a..085e0fba2 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1211,7 +1211,7 @@ ivas_error ivas_allocate_binaural_hrtf( * * *-------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static ivas_error ivas_binaural_hrtf_open( HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */ const AUDIO_CONFIG input_config, /* i : output configuration */ @@ -1326,7 +1326,122 @@ static ivas_error ivas_binaural_hrtf_open( return IVAS_ERR_OK; } +#else +static ivas_error ivas_binaural_hrtf_open( + HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */ + const AUDIO_CONFIG input_config, /* i : output configuration */ + const RENDERER_TYPE renderer_type /* i : renderer type */ +) +{ + int16_t i, j; + ivas_error error; + + if ( hHrtfFastConv != NULL && *hHrtfFastConv != NULL ) + { + /* Tables already loaded from file */ + return IVAS_ERR_OK; + } + else + { + /* Initialise tables from ROM */ + HRTFS_FASTCONV *HrtfFastConv; + + if ( ( HrtfFastConv = (HRTFS_FASTCONV *) malloc( sizeof( HRTFS_FASTCONV ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for FastConv HRTF tables" ); + } + + ivas_init_binaural_hrtf( HrtfFastConv ); + if ( input_config == IVAS_AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; + } + if ( input_config == IVAS_AUDIO_CONFIG_HOA2 ) + { + HrtfFastConv->FASTCONV_HOA2_latency_s = FASTCONV_HOA2_latency_s; + } + if ( input_config == IVAS_AUDIO_CONFIG_HOA3 ) + { + HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; + } + if ( input_config == IVAS_AUDIO_CONFIG_FOA ) + { + HrtfFastConv->FASTCONV_FOA_latency_s = FASTCONV_FOA_latency_s; + } + if ( input_config == IVAS_AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; + } + + HrtfFastConv->allocate_init_flag = 1; + + if ( ( error = ivas_allocate_binaural_hrtf( HrtfFastConv, input_config, BINAURAL_INPUT_AUDIO_CONFIG_INVALID, renderer_type, HrtfFastConv->allocate_init_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + HrtfFastConv->leftHRIRReal[i][j] = leftHRIRReal[i][j]; + HrtfFastConv->leftHRIRImag[i][j] = leftHRIRImag[i][j]; + HrtfFastConv->rightHRIRReal[i][j] = rightHRIRReal[i][j]; + HrtfFastConv->rightHRIRImag[i][j] = rightHRIRImag[i][j]; + } + } + else if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + HrtfFastConv->leftBRIRReal[i][j] = leftBRIRReal[i][j]; + HrtfFastConv->leftBRIRImag[i][j] = leftBRIRImag[i][j]; + HrtfFastConv->rightBRIRReal[i][j] = rightBRIRReal[i][j]; + HrtfFastConv->rightBRIRImag[i][j] = rightBRIRImag[i][j]; + } + } + if ( input_config == IVAS_AUDIO_CONFIG_HOA3 ) + { + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { + HrtfFastConv->leftHRIRReal_HOA3[i][j] = leftHRIRReal_HOA3[i][j]; + HrtfFastConv->leftHRIRImag_HOA3[i][j] = leftHRIRImag_HOA3[i][j]; + HrtfFastConv->rightHRIRReal_HOA3[i][j] = rightHRIRReal_HOA3[i][j]; + HrtfFastConv->rightHRIRImag_HOA3[i][j] = rightHRIRImag_HOA3[i][j]; + } + } + if ( input_config == IVAS_AUDIO_CONFIG_HOA2 ) + { + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { + HrtfFastConv->leftHRIRReal_HOA2[i][j] = leftHRIRReal_HOA2[i][j]; + HrtfFastConv->leftHRIRImag_HOA2[i][j] = leftHRIRImag_HOA2[i][j]; + HrtfFastConv->rightHRIRReal_HOA2[i][j] = rightHRIRReal_HOA2[i][j]; + HrtfFastConv->rightHRIRImag_HOA2[i][j] = rightHRIRImag_HOA2[i][j]; + } + } + if ( input_config == IVAS_AUDIO_CONFIG_FOA ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + HrtfFastConv->leftHRIRReal_FOA[i][j] = leftHRIRReal_FOA[i][j]; + HrtfFastConv->leftHRIRImag_FOA[i][j] = leftHRIRImag_FOA[i][j]; + HrtfFastConv->rightHRIRReal_FOA[i][j] = rightHRIRReal_FOA[i][j]; + HrtfFastConv->rightHRIRImag_FOA[i][j] = rightHRIRImag_FOA[i][j]; + } + } + } + mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); + mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); + + *hHrtfFastConv = HrtfFastConv; + } + + return IVAS_ERR_OK; +} +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------* * ivas_binaural_obtain_DMX() diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 18ca3e140..1d6922e89 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5547,7 +5547,28 @@ void ivas_dirac_dec_render_sf_fx( } else { +#ifdef IVAS_FLOAT_FIXED + Word16 q_reference_power_smooth; + Word16 size, size_ho, q_Cldfb; + size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; + size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; +#endif /* Determine encoding quality based additional smoothing factor */ +#ifdef IVAS_FLOAT_FIXED + float qualityBasedSmFactor = 1.0f; + Word32 qualityBasedSmFactor_fx = ONE_IN_Q31; + move32(); + + IF( st_ivas->hMasa != NULL ) + { + st_ivas->hMasa->data.dir_decode_quality_fx = float_to_fix16( st_ivas->hMasa->data.dir_decode_quality, Q15 ); + + qualityBasedSmFactor_fx = L_deposit_h( st_ivas->hMasa->data.dir_decode_quality_fx ); // Q31 + qualityBasedSmFactor_fx = Mpy_32_32( qualityBasedSmFactor_fx, qualityBasedSmFactor_fx ); // (Q31, Q31) -> Q31 + } + + qualityBasedSmFactor = fixedToFloat( qualityBasedSmFactor_fx, Q31 ); +#else float qualityBasedSmFactor = 1.0f; if ( st_ivas->hMasa != NULL ) @@ -5555,7 +5576,133 @@ void ivas_dirac_dec_render_sf_fx( qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; qualityBasedSmFactor *= qualityBasedSmFactor; } +#endif + +#ifdef IVAS_FLOAT_FIXED + FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + { + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + floatToFixed_arrL( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer_fx[ch][slot_idx], + Q6, + hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], + Q6, + hSpatParamRendCom->num_freq_bands ); + } + } + + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); + + hDirACRend->h_output_synthesis_psd_state.direct_responses_q = Q31; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); + + hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q = Q31; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); + + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q31; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); + + hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q = Q31; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square, hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q, hDirACRend->num_outputs_dir ); + + floatToFixed_arrL( diffuseness_vector, diffuseness_vector_fx, Q31, hSpatParamRendCom->num_freq_bands ); // Q31 + + q_reference_power_smooth = L_get_q_buf( reference_power_smooth, hSpatParamRendCom->num_freq_bands ); + q_reference_power_smooth = s_min( q_reference_power_smooth, L_get_q_buf( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hSpatParamRendCom->num_freq_bands ) ); + floatToFixed_arrL( reference_power_smooth, reference_power_smooth_fx, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + IF( hDirACRend->masa_stereo_type_detect != NULL ) + { + hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->target_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->target_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); + + hDirACRend->masa_stereo_type_detect->q_subtract_power_y = s_min( L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y ), + L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth ) ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ) ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + { + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, + L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ) ); + } + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + { + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + } + + hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = Q26; + hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + floatToFixed_arrL( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f[i_mult( i_mult( slot_idx, 2 ), + i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ) )], + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ) ), + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + 2 * hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + } + IF( hDirACRend->proto_signal_decorr_on ) + { + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + floatToFixed_arrL( &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f[i_mult( i_mult( slot_idx, 2 ), + i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) )], + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + + i_mult( i_mult( slot_idx, 2 ), i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) ), + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + 2 * hDirACRend->hOutSetup.nchan_out_woLFE * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); + } + } +#endif + +#ifdef IVAS_FLOAT_FIXED + ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Cldfb_RealBuffer_fx, + Cldfb_ImagBuffer_fx, + hSpatParamRendCom, + hDirACRend, + hSpatParamRendCom->subframe_nbslots[subframe_idx], + diffuseness_vector_fx, + reference_power_smooth_fx, + &q_reference_power_smooth, + qualityBasedSmFactor_fx, + hDirAC->hConfig->enc_param_start_band, + &q_Cldfb ); +#else ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, Cldfb_ImagBuffer, hSpatParamRendCom, @@ -5565,6 +5712,51 @@ void ivas_dirac_dec_render_sf_fx( reference_power_smooth, qualityBasedSmFactor, hDirAC->hConfig->enc_param_start_band ); +#endif + +#ifdef IVAS_FLOAT_FIXED + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); + + IF( hDirACRend->masa_stereo_type_detect != NULL ) + { + hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx, Q21 ); + + hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + } + + FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + { + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + fixedToFloat_arrL( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer[ch][slot_idx], + q_Cldfb, + hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], + q_Cldfb, + hSpatParamRendCom->num_freq_bands ); + } + } +#endif } /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 80173b9fa..9e5afa24b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2318,7 +2318,7 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - IF ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 2028e6cf8..d162c9366 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -199,7 +199,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( } IF ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - IF ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL,st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL,st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -690,7 +690,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL,st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL,st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 91db00884..69b758d40 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2639,7 +2639,7 @@ ivas_error ivas_rend_openCrend( IF ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - IF ( ( error = ivas_reverb_open( &( hCrend->hReverb ), inConfig, ( *pCrend )->hHrtfCrend,NULL, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_reverb_open_fx( &( hCrend->hReverb ), inConfig, ( *pCrend )->hHrtfCrend,NULL, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 79ba4ba4d..a7870d075 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -625,6 +625,7 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx( } #endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED ivas_error ivas_dirac_dec_binaural_copy_hrtfs( HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ) @@ -654,6 +655,9 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( } } + mvl2l( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX ); + mvl2l( parametricReverberationEneCorrections_fx, hrtfParambin->parametricReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX ); + mvr2r( parametricReverberationTimes, hrtfParambin->parametricReverberationTimes, CLDFB_NO_CHANNELS_MAX ); mvr2r( parametricReverberationEneCorrections, hrtfParambin->parametricReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); mvr2r( parametricEarlyPartEneCorrection, hrtfParambin->parametricEarlyPartEneCorrection, CLDFB_NO_CHANNELS_MAX ); @@ -663,7 +667,46 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( return IVAS_ERR_OK; } +#else +ivas_error ivas_dirac_dec_binaural_copy_hrtfs( + HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ +) +{ + int16_t i, j; + if ( hHrtfParambin != NULL && *hHrtfParambin != NULL ) + { + /* Tables already loaded from file */ + return IVAS_ERR_OK; + } + else + { + /* Initialise tables from ROM */ + HRTFS_PARAMBIN *hrtfParambin; + + if ( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for parametric binauralizer HRTF tables" ); + } + + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + mvr2r( hrtfShCoeffsRe[i][j], hrtfParambin->hrtfShCoeffsRe[i][j], HRTF_NUM_BINS ); + mvr2r( hrtfShCoeffsIm[i][j], hrtfParambin->hrtfShCoeffsIm[i][j], HRTF_NUM_BINS ); + } + } + mvr2r( parametricReverberationTimes, hrtfParambin->parametricReverberationTimes, CLDFB_NO_CHANNELS_MAX ); + mvr2r( parametricReverberationEneCorrections, hrtfParambin->parametricReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); + mvr2r( parametricEarlyPartEneCorrection, hrtfParambin->parametricEarlyPartEneCorrection, CLDFB_NO_CHANNELS_MAX ); + + *hHrtfParambin = hrtfParambin; + } + + return IVAS_ERR_OK; +} +#endif /*------------------------------------------------------------------------- * void ivas_dirac_dec_binaural_render() diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index ca6c7b02f..ebfc55f97 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -59,6 +59,7 @@ #define DIRAC_ALPHA_MAX_FAST 0.12f #define DIRAC_ALPHA_MAX_FAST_Q15 3932 #define DIRECTION_SMOOTHNESS_ALPHA 0.01f +#define DIRECTION_SMOOTHNESS_ALPHA_Q31 (Word32)(0.01f * ONE_IN_Q31) /*------------------------------------------------------------------------- @@ -68,11 +69,11 @@ #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_direct_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word32 *direct_power_factor, const Word32 *reference_power, const Word16 *q_reference_power, const Word32 *direct_responses, const Word32 *direct_responses_square, Word32 *cy_auto_dir_smooth, Word16 *q_cy_auto_dir_smooth, Word32 *cy_cross_dir_smooth, Word16 *q_cy_cross_dir_smooth ); -static void computeTargetPSDs_direct_subframe_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word32 *direct_power_factor, const Word32 *reference_power, const Word32 *direct_responses, const Word32 *direct_responses_square, Word32 *cy_auto_dir_smooth, Word32 *cy_cross_dir_smooth ); +static void computeTargetPSDs_direct_subframe_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word32 *direct_power_factor, const Word32 *reference_power, const Word16 *q_reference_power, const Word32 *direct_responses, const Word32 *direct_responses_square, Word32 *cy_auto_dir_smooth, Word16 *q_cy_auto_dir_smooth, Word32 *cy_cross_dir_smooth, Word16 *q_cy_cross_dir_smooth ); static void computeTargetPSDs_diffuse_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word16 start_band, const Word32 *diffuse_power_factor, const Word32 *reference_power, const Word16 *q_reference_power, const Word32 *diffuse_responses_square, Word32 *cy_auto_diff_smooth, Word16 *q_cy_auto_diff_smooth ); -static void computeTargetPSDs_diffuse_subframe_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word16 start_band, const Word32 *diffuse_power_factor, const Word32 *reference_power, const Word32 *diffuse_responses_square, Word32 *cy_auto_diff_smooth ); +static void computeTargetPSDs_diffuse_subframe_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word16 start_band, const Word32 *diffuse_power_factor, const Word32 *reference_power, const Word16 *q_reference_power, const Word32 *diffuse_responses_square, Word32 *cy_auto_diff_smooth, Word16 *q_cy_auto_diff_smooth ); static void computeTargetPSDs_diffuse_with_onsets_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word16 num_decorr_freq_bands, const Word16 *proto_frame_diff_index, const Word32 *diffuse_power_factor, const Word32 *reference_power, const Word16 *q_reference_power, const Word32 *diffuse_responses_square, const Word32 *onset_filter, Word32 *cy_auto_diff_smooth, Word16 *q_cy_auto_diff_smooth ); #endif @@ -193,9 +194,9 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - IF ((dirac_output_synthesis_state->proto_power_smooth_prev_fx = (Word16 *)malloc(hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir * sizeof(Word16))) == NULL) + IF( ( dirac_output_synthesis_state->proto_power_smooth_prev_fx = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir * sizeof( Word32 ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } IF ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) @@ -205,9 +206,9 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - IF ((dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx = (Word16 *)malloc(dirac_output_synthesis_params->max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE * sizeof(Word16))) == NULL) + IF( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx = (Word32 *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( Word32 ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } ELSE @@ -392,16 +393,16 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } Copy(temp_alpha_synthesis_fx, dirac_output_synthesis_params->alpha_synthesis_fast_fx, dirac_output_synthesis_params->numAlphasFast); - IF((dirac_output_synthesis_state->reference_power_smooth_prev_fx = (Word16 *)malloc(hSpatParamRendCom->num_freq_bands * sizeof(Word16))) == NULL) + IF( ( dirac_output_synthesis_state->reference_power_smooth_prev_fx = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - IF((dirac_output_synthesis_state->direction_smoothness_prev_fx = (Word16 *)malloc(hSpatParamRendCom->num_freq_bands * sizeof(Word16))) == NULL) + IF( ( dirac_output_synthesis_state->direction_smoothness_prev_fx = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - set16_fx(dirac_output_synthesis_state->reference_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands); - set16_fx(dirac_output_synthesis_state->direction_smoothness_prev_fx, 0, hSpatParamRendCom->num_freq_bands); + set32_fx( dirac_output_synthesis_state->reference_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); + set32_fx( dirac_output_synthesis_state->direction_smoothness_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); /*TODO : remove float code*/ if ((dirac_output_synthesis_params->alpha_synthesis_fast = (float *)malloc(dirac_output_synthesis_params->numAlphasFast * sizeof(float))) == NULL) @@ -962,9 +963,9 @@ void ivas_dirac_dec_output_synthesis_init_fx( } h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev = 0; - IF (h_dirac_output_synthesis_state->proto_power_smooth_prev_fx != NULL) + IF( h_dirac_output_synthesis_state->proto_power_smooth_prev_fx != NULL ) { - set16_fx(h_dirac_output_synthesis_state->proto_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir); + set32_fx( h_dirac_output_synthesis_state->proto_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir ); } set32_fx( h_dirac_output_synthesis_state->gains_dir_prev_fx, 0, size ); h_dirac_output_synthesis_state->gains_dir_prev_q = 0; @@ -979,9 +980,9 @@ void ivas_dirac_dec_output_synthesis_init_fx( } h_dirac_output_synthesis_state->gains_diff_prev_q = 0; - IF (h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx != NULL) + IF( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx != NULL ) { - set16_fx(h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx, 0, h_dirac_output_synthesis_params->max_band_decorr * nchan_out_woLFE); + set32_fx( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx, 0, h_dirac_output_synthesis_params->max_band_decorr * nchan_out_woLFE ); } #endif @@ -3163,6 +3164,624 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( } +#ifdef IVAS_FLOAT_FIXED +/*------------------------------------------------------------------------- + * ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx() + * + * + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( + Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const Word16 nbslots, /* i : number of slots to process */ + Word32 *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ + Word32 *reference_power_smooth, + Word16 *q_reference_power_smooth, + Word32 qualityBasedSmFactor, + const Word16 enc_param_start_band, + Word16 *q_Cldfb ) +{ + Word16 buf_idx, num_freq_bands; + Word16 diff_start_band; + Word16 k, l; + Word16 nchan_out_woLFE; + Word32 *p_power_smooth_prev, *p_power_diff_smooth_prev; + Word32 *p_gain_1, *p_gain_2; + Word32 *p_power_smooth_diff, *p_power_smooth; + Word32 *p_gains_dir, *p_gains_diff; + Word32 g, g1, g2; + Word32 *p_cy_auto_dir_smooth, *p_cy_auto_dir_smooth_prev; + Word32 *p_cy_cross_dir_smooth, *p_cy_cross_dir_smooth_prev; + Word32 *p_cy_auto_diff_smooth, *p_cy_auto_diff_smooth_prev; + Word32 gains_dir[CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; + Word32 gains_diff[CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + Word16 *proto_direct_index, num_protos_dir; + Word32 target_power_y, target_power_y1; + Word16 q_target_power_y, q_target_power_y1; + Word32 subtract_power_y; + Word32 subtract_target_ratio; + Word32 subtract_target_ratio_db; + Word32 a, b; + UWord16 nchan_target_psds; + Word32 alpha[CLDFB_NO_CHANNELS_MAX]; + Word16 *alpha_synthesis; + Word16 *alpha_synthesis_fast; + Word16 alphaMaxBin; + Word16 alphaMaxBinFast; + Word32 L_tmp; + Word16 exp_arr[CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; + Word16 exp = 0, exp1, tmp, q_com, q_tmp, min_exp; + move16(); + + push_wmops( "dirac_out_synth_sfr" ); + + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + + /* collect some often used parameters */ + proto_direct_index = hDirACRend->proto_index_dir; + move16(); + num_protos_dir = hDirACRend->num_protos_dir; + move16(); + nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; + move16(); + num_freq_bands = hSpatParamRendCom->num_freq_bands; + move16(); + + /*-----------------------------------------------------------------* + * compute target PSDs + *-----------------------------------------------------------------*/ + + IF( EQ_16( enc_param_start_band, 0 ) ) + { + diff_start_band = EQ_16( h_dirac_output_synthesis_params->use_onset_filters, 1 ) ? h_dirac_output_synthesis_params->max_band_decorr : 0; + move16(); + + IF( EQ_32( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) + { + nchan_target_psds = 2; + move16(); + } + ELSE + { + nchan_target_psds = nchan_out_woLFE; + move16(); + } + + computeTargetPSDs_direct_subframe_fx( nchan_target_psds, num_freq_bands, + h_dirac_output_synthesis_state->direct_power_factor_fx, + reference_power_smooth, + q_reference_power_smooth, + h_dirac_output_synthesis_state->direct_responses_fx, + h_dirac_output_synthesis_state->direct_responses_square_fx, + h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, + &h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, + &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); + + // Scale cy_auto_diff_smooth_fx if required + IF( NE_32( diff_start_band, 0 ) ) + { + q_com = s_min( *q_reference_power_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); + scale_sig32( reference_power_smooth, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); + scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, + i_mult( num_freq_bands, nchan_target_psds ), + sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ); + *q_reference_power_smooth = q_com; + move16(); + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; + move16(); + } + + computeTargetPSDs_diffuse_subframe_fx( nchan_target_psds, num_freq_bands, diff_start_band, + h_dirac_output_synthesis_state->diffuse_power_factor_fx, + reference_power_smooth, + q_reference_power_smooth, + h_dirac_output_synthesis_state->diffuse_responses_square_fx, + h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, + &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); + } + + /*-----------------------------------------------------------------* + * compute variables for stereo transport signal type detection + *-----------------------------------------------------------------*/ + + IF( hDirACRend->masa_stereo_type_detect != NULL ) + { + MASA_STEREO_TYPE_DETECT *masa_stereo_type_detect = hDirACRend->masa_stereo_type_detect; + + p_cy_auto_dir_smooth = h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx; // q_cy_auto_dir_smooth + p_cy_auto_diff_smooth = h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx; // q_cy_auto_diff_smooth + q_com = s_min( h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); + + IF( EQ_32( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) + { + exp = sub( Q31, Q31 ); + exp1 = 0; + move16(); + tmp = BASOP_Util_Divide3232_Scale( L_shl( p_cy_auto_dir_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth ) ), + ( L_add( Sqrt32( h_dirac_output_synthesis_state->direct_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) + &exp1 ); + target_power_y = L_shl( L_deposit_l( tmp ), exp1 ); // Q15 + (q_com - (31 - exp)) + q_target_power_y = add( Q15, sub( q_com, sub( Q31, exp ) ) ); + + exp = sub( Q31, Q31 ); + exp1 = 0; + move16(); + tmp = BASOP_Util_Divide3232_Scale( L_shl( p_cy_auto_diff_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ), + ( L_add( Sqrt32( h_dirac_output_synthesis_state->diffuse_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) + &exp1 ); + target_power_y1 = L_shl( L_deposit_l( tmp ), exp1 ); // Q15 + (q_com - (31 - exp)) + q_target_power_y1 = add( Q15, sub( q_com, sub( Q31, exp ) ) ); + + target_power_y = L_add( target_power_y, target_power_y1 ); + exp = q_target_power_y; + move16(); + } + ELSE + { + target_power_y = L_add( + L_shl( p_cy_auto_dir_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth ) ), + L_shl( p_cy_auto_diff_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ) ); // q_com + exp = q_com; + move16(); + } + + subtract_power_y = masa_stereo_type_detect->subtract_power_y_fx; // q_subtract_power_y + move32(); + + a = (Word32) ( 0.0004f * ONE_IN_Q31 ); /* Temporal smoothing coefficient */ + b = L_sub( ONE_IN_Q31, a ); /* Temporal smoothing coefficient */ + + q_com = s_min( exp, masa_stereo_type_detect->q_target_power_y_smooth ); + target_power_y = L_shl( target_power_y, sub( q_com, exp ) ); + masa_stereo_type_detect->target_power_y_smooth_fx = L_shl( masa_stereo_type_detect->target_power_y_smooth_fx, + sub( q_com, masa_stereo_type_detect->q_target_power_y_smooth ) ); + masa_stereo_type_detect->target_power_y_smooth_fx = + L_add( Mpy_32_32( a, target_power_y ), + Mpy_32_32( b, masa_stereo_type_detect->target_power_y_smooth_fx ) ); //(Q31, q_com) -> q_com + masa_stereo_type_detect->q_target_power_y_smooth = q_com; + move16(); + + masa_stereo_type_detect->subtract_power_y_smooth_fx = + L_add( Mpy_32_32( a, subtract_power_y ), + Mpy_32_32( b, masa_stereo_type_detect->subtract_power_y_smooth_fx ) ); //(Q31, q_subtract_power_y) -> q_subtract_power_y + + exp = 0; + move16(); + tmp = BASOP_Util_Divide3232_Scale( masa_stereo_type_detect->subtract_power_y_smooth_fx, + L_add( masa_stereo_type_detect->target_power_y_smooth_fx, EPSILON_FX ), + &exp ); + exp = add( sub( Q15, exp ), sub( masa_stereo_type_detect->q_subtract_power_y, q_com ) ); + subtract_target_ratio = L_shl( L_deposit_l( tmp ), sub( Q15, exp ) ); // Q15 + + L_tmp = BASOP_Util_Log2( subtract_target_ratio ); // Q25 + L_tmp = L_add( L_tmp, L_shl( L_sub( Q31, Q15 ), Q25 ) ); // Q25 + subtract_target_ratio_db = Mpy_32_32( (Word32) ( 10.0f * ONE_IN_Q27 ), + Mpy_32_32( L_tmp, LOG10_2_Q31 ) ); // (Q27, (Q25, Q31)) -> (Q27, Q25) -> Q21 + + masa_stereo_type_detect->subtract_target_ratio_db_fx = subtract_target_ratio_db; // Q21 + move32(); + masa_stereo_type_detect->subtract_power_y_fx = 0; + move32(); + } + + /*-----------------------------------------------------------------* + * compute smoothing coefficients + *-----------------------------------------------------------------*/ + + alpha_synthesis = h_dirac_output_synthesis_params->alpha_synthesis_fx; // Q15 + alpha_synthesis_fast = h_dirac_output_synthesis_params->alpha_synthesis_fast_fx; // Q15 + alphaMaxBin = sub( h_dirac_output_synthesis_params->numAlphas, 1 ); + alphaMaxBinFast = sub( h_dirac_output_synthesis_params->numAlphasFast, 1 ); + + FOR( l = 0; l < num_freq_bands; l++ ) + { + Word32 instDirectionSmoothness, weightedDirectionSmoothness, smoothedDirectionSmoothness; + Word32 currWeight, prevWeight, sumWeight; + Word16 indexFast, indexSlow; + Word32 alpha_quality_based = (Word32) ( 0.02f * ONE_IN_Q31 ); + move32(); + + indexSlow = s_min( l, alphaMaxBin ); + indexFast = s_min( l, alphaMaxBinFast ); + + /* Estimate the smoothness of the directions based on the diffuseness parameter */ + instDirectionSmoothness = L_sub( ONE_IN_Q31, diffuseness_vector[l] ); // Q31 + instDirectionSmoothness = L_min( L_max( instDirectionSmoothness, 0 ), ONE_IN_Q31 ); // Q31 + + /* Average the direction smoothness parameter over time */ + currWeight = Mpy_32_32( DIRECTION_SMOOTHNESS_ALPHA_Q31, + reference_power_smooth[l] ); //(Q31, q_reference_power_smooth) -> q_reference_power_smooth + prevWeight = Mpy_32_32( L_sub( ONE_IN_Q31, DIRECTION_SMOOTHNESS_ALPHA_Q31 ), + h_dirac_output_synthesis_state->reference_power_smooth_prev_fx[l] ); //(Q31, q_reference_power_smooth) -> q_reference_power_smooth + + weightedDirectionSmoothness = + L_add( Mpy_32_32( currWeight, instDirectionSmoothness ), + Mpy_32_32( prevWeight, h_dirac_output_synthesis_state->direction_smoothness_prev_fx[l] ) ); //(q_reference_power_smooth, Q31) -> q_reference_power_smooth + sumWeight = L_add( currWeight, prevWeight ); // q_reference_power_smooth + + exp = 0; + move16(); + tmp = BASOP_Util_Divide3232_Scale( weightedDirectionSmoothness, L_add( sumWeight, EPSILON_FX ), &exp ); + smoothedDirectionSmoothness = L_shl_sat( L_deposit_l( tmp ), add( sub( Q31, Q15 ), exp ) ); // Q31 + + h_dirac_output_synthesis_state->direction_smoothness_prev_fx[l] = smoothedDirectionSmoothness; // Q31 + move32(); + h_dirac_output_synthesis_state->reference_power_smooth_prev_fx[l] = sumWeight; // q_reference_power_smooth + move32(); + + /* Determine smoothing parameter for rendering. The smoother the directions, the less smoothing is required (i.e., faster smoothing can be used). */ + alpha[l] = + L_add( Mpy_32_16_1( smoothedDirectionSmoothness, alpha_synthesis_fast[indexFast] ), + Mpy_32_16_1( L_sub( ONE_IN_Q31, smoothedDirectionSmoothness ), alpha_synthesis[indexSlow] ) ); //(Q31, Q15) -> Q31 + move32(); + + /* Adjust smoothing parameter based on encoding quality */ + alpha[l] = + L_add( Mpy_32_32( qualityBasedSmFactor, alpha[l] ), + Mpy_32_32( L_sub( ONE_IN_Q31, qualityBasedSmFactor ), alpha_quality_based ) ); //(Q31, Q31) -> Q31 + move32(); + } + + /*-----------------------------------------------------------------* + * compute gains + *-----------------------------------------------------------------*/ + + /*Direct normalization gains on reduced number of protos*/ + p_power_smooth_prev = h_dirac_output_synthesis_state->proto_power_smooth_prev_fx; + p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; + set16_fx( exp_arr, 0, i_mult( num_protos_dir, num_freq_bands ) ); + + FOR( k = 0; k < num_protos_dir; k++ ) + { + FOR( l = 0; l < num_freq_bands; l++ ) + { + g1 = alpha[l]; // Q31 + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + *p_power_smooth_prev = L_add( EPSILON_FX, Mpy_32_32( g2, ( *p_power_smooth_prev ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth + move32(); + *( p_power_smooth_prev ) = L_add( *( p_power_smooth_prev ), Mpy_32_32( g1, ( *p_power_smooth ) ) ); //(Q31, q_proto_power_smooth) -> q_proto_power_smooth + move32(); + + IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) + { + p_power_smooth_prev++; + L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, 4612, &exp ); // 1e-15 in Q62 is 4612 + exp_arr[add( i_mult( k, num_freq_bands ), l )] = exp; + move16(); + + *( p_power_smooth++ ) = L_tmp; + move32(); + } + ELSE + { + L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); + exp_arr[add( i_mult( k, num_freq_bands ), l )] = exp; + move16(); + + *( p_power_smooth++ ) = L_tmp; + move32(); + } + } + } + + // Move proto_power_smooth_fx to common Q-factor + min_exp = 0; + move16(); + q_tmp = Q31; + move16(); + + FOR( k = 0; k < num_protos_dir; k++ ) + { + FOR( l = 0; l < num_freq_bands; l++ ) + { + IF( GT_16( exp_arr[add( i_mult( k, num_freq_bands ), l )], min_exp ) ) + { + min_exp = exp_arr[add( i_mult( k, num_freq_bands ), l )]; + move16(); + } + } + } + + p_power_smooth_prev = h_dirac_output_synthesis_state->proto_power_smooth_prev_fx; + p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx; + + FOR( k = 0; k < num_protos_dir; k++ ) + { + FOR( l = 0; l < num_freq_bands; l++ ) + { + *( p_power_smooth++ ) = L_shr( *p_power_smooth, sub( min_exp, exp_arr[add( i_mult( k, num_freq_bands ), l )] ) ); + move32(); + IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) + { + q_tmp = add( sub( Q31, min_exp ), sub( Q31, 62 ) ); + } + ELSE + { + q_tmp = add( sub( Q31, min_exp ), sub( Q31, h_dirac_output_synthesis_state->proto_power_smooth_q ) ); + } + } + } + + // Update the Q-factor + h_dirac_output_synthesis_state->proto_power_smooth_prev_q = h_dirac_output_synthesis_state->proto_power_smooth_q; + h_dirac_output_synthesis_state->proto_power_smooth_q = q_tmp; + + /*Direct gains and diffuse gains on number of output channels*/ + p_power_diff_smooth_prev = h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx; + p_power_smooth_diff = h_dirac_output_synthesis_state->proto_power_diff_smooth_fx; + + p_gains_diff = gains_diff; + p_gains_dir = gains_dir; + + p_cy_auto_dir_smooth = h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx; + p_cy_auto_dir_smooth_prev = h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev_fx; + q_com = s_min( h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth_prev ); + scale_sig32( p_cy_auto_dir_smooth, imult1616( nchan_out_woLFE, num_freq_bands ), sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth ) ); + scale_sig32( p_cy_auto_dir_smooth_prev, imult1616( nchan_out_woLFE, num_freq_bands ), sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth_prev ) ); + h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = h_dirac_output_synthesis_state->q_cy_auto_dir_smooth_prev = q_com; + + p_cy_cross_dir_smooth = h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx; + p_cy_cross_dir_smooth_prev = h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev_fx; + q_com = s_min( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth_prev ); + scale_sig32( p_cy_cross_dir_smooth, imult1616( nchan_out_woLFE, num_freq_bands ), sub( q_com, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); + scale_sig32( p_cy_cross_dir_smooth_prev, imult1616( nchan_out_woLFE, num_freq_bands ), sub( q_com, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth_prev ) ); + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth_prev = q_com; + + p_cy_auto_diff_smooth = h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx; + p_cy_auto_diff_smooth_prev = h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev_fx; + q_com = s_min( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev ); + scale_sig32( p_cy_auto_diff_smooth, imult1616( nchan_out_woLFE, num_freq_bands ), sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ); + scale_sig32( p_cy_auto_diff_smooth_prev, imult1616( nchan_out_woLFE, num_freq_bands ), sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev ) ); + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev = q_com; + + FOR( k = 0; k < nchan_out_woLFE; k++ ) + { + Word32 power_smooth_temp; + p_power_smooth = h_dirac_output_synthesis_state->proto_power_smooth_fx + i_mult( proto_direct_index[k], num_freq_bands ); // q_proto_power_smooth + FOR( l = 0; l < h_dirac_output_synthesis_params->max_band_decorr; l++ ) + { + /*Direct*/ + g1 = alpha[l]; // Q31 + move32(); + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + *( p_cy_auto_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_dir_smooth++ ) ) ), + Mpy_32_32( g2, ( *( p_cy_auto_dir_smooth_prev ) ) ) ); // (Q31, q_cy_auto_dir_smooth_prev) -> q_cy_auto_dir_smooth_prev + move32(); + *( p_cy_cross_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_cross_dir_smooth++ ) ) ), + Mpy_32_32( g2, ( *( p_cy_cross_dir_smooth_prev ) ) ) ); // (Q31, q_cy_cross_dir_smooth_prev) -> q_cy_cross_dir_smooth_prev + move32(); + + power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) ); + L_tmp = Mpy_32_32( power_smooth_temp, ( *( p_cy_auto_dir_smooth_prev++ ) ) ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_dir_smooth_prev - 31 + exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ), + h_dirac_output_synthesis_state->q_cy_auto_dir_smooth_prev ), + Q31 ) ); + p_power_smooth++; + + *( p_gains_dir ) = Sqrt32( L_tmp, &exp ); // (Q31 - exp) + move32(); + *( p_gains_dir ) = L_shl_sat( *( p_gains_dir ), sub( h_dirac_output_synthesis_state->gains_dir_prev_q, sub( Q31, exp ) ) ); // gains_dir_prev_q + move32(); + + IF( LT_32( *( p_gains_dir ), 0 ) ) + { + *( p_gains_dir ) = 0; + move32(); + } + ELSE IF( GT_32( *( p_gains_dir ), (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_dir_prev_q ) ) ) ) + { + *( p_gains_dir ) = (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_dir_prev_q ) ); + move32(); + } + + IF( LT_32( *( p_cy_cross_dir_smooth_prev++ ), 0 ) ) + { + *( p_gains_dir ) = L_negate( *( p_gains_dir ) ); + } + p_gains_dir++; + + /*diffuse*/ + *p_power_diff_smooth_prev = L_add( L_add( Mpy_32_32( g1, ( *( p_power_smooth_diff++ ) ) ), + Mpy_32_32( g2, ( *( p_power_diff_smooth_prev ) ) ) ), + EPSILLON_FX ); // (Q31, q_power_diff_smooth_prev) -> q_power_diff_smooth_prev + *( p_cy_auto_diff_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_diff_smooth++ ) ) ), + Mpy_32_32( g2, ( *( p_cy_auto_diff_smooth_prev ) ) ) ); // (Q31, q_cy_auto_diff_smooth_prev) -> q_cy_auto_diff_smooth_prev + + exp = 0; + move16(); + L_tmp = BASOP_Util_Divide3232_Scale_cadence( *( p_cy_auto_diff_smooth_prev++ ), ( *( p_power_diff_smooth_prev++ ) ), &exp ); // (Q31 - exp) + (q_a - q_b) + exp = sub( Q31, add( sub( Q31, exp ), sub( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev, h_dirac_output_synthesis_state->proto_power_diff_smooth_q ) ) ); + + *( p_gains_diff ) = Sqrt32( L_tmp, &exp ); // (31 - exp) + move32(); + *( p_gains_diff ) = L_shl_sat( *( p_gains_diff ), sub( h_dirac_output_synthesis_state->gains_diff_prev_q, sub( Q31, exp ) ) ); // gains_diff_prev_q + move32(); + + IF( LT_32( *( p_gains_diff ), 0 ) ) + { + *( p_gains_diff ) = 0; + move32(); + } + ELSE IF( GT_32( *( p_gains_diff ), (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_diff_prev_q ) ) ) ) + { + *( p_gains_diff ) = (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_diff_prev_q ) ); + move32(); + } + p_gains_diff++; + } + + /*Only direct prototype*/ + FOR( ; l < num_freq_bands; l++ ) + { + /*Direct*/ + g1 = alpha[l]; // Q31 + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + *( p_cy_auto_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_dir_smooth++ ) ) ), + Mpy_32_32( g2, ( *( p_cy_auto_dir_smooth_prev ) ) ) ); // (Q31, q_cy_auto_dir_smooth_prev) -> q_cy_auto_dir_smooth_prev + move32(); + *( p_cy_cross_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_cross_dir_smooth++ ) ) ), + Mpy_32_32( g2, ( *( p_cy_cross_dir_smooth_prev ) ) ) ); // (Q31, q_cy_cross_dir_smooth_prev) -> q_cy_cross_dir_smooth_prev + move32(); + + power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) ); + L_tmp = Mpy_32_32( power_smooth_temp, ( *( p_cy_auto_dir_smooth_prev++ ) ) ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_dir_smooth_prev - 31 + exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ), + h_dirac_output_synthesis_state->q_cy_auto_dir_smooth_prev ), + Q31 ) ); + + *( p_gains_dir ) = Sqrt32( L_tmp, &exp ); // (Q31 - exp) + move32(); + *( p_gains_dir ) = L_shl_sat( *( p_gains_dir ), sub( h_dirac_output_synthesis_state->gains_dir_prev_q, sub( Q31, exp ) ) ); // gains_dir_prev_q + move32(); + + IF( LT_32( *( p_gains_dir ), 0 ) ) + { + *( p_gains_dir ) = 0; + move32(); + } + ELSE IF( GT_32( *( p_gains_dir ), (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_dir_prev_q ) ) ) ) + { + *( p_gains_dir ) = (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_dir_prev_q ) ); + move32(); + } + + IF( LT_32( *( p_cy_cross_dir_smooth_prev++ ), 0 ) ) + { + *( p_gains_dir ) = L_negate( *( p_gains_dir ) ); + } + p_gains_dir++; + + /*diffuse*/ + *( p_cy_auto_diff_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_diff_smooth++ ) ) ), + Mpy_32_32( g2, ( *( p_cy_auto_diff_smooth_prev ) ) ) ); // (Q31, q_cy_auto_diff_smooth_prev) -> q_cy_auto_diff_smooth_prev + move32(); + + power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) ); + L_tmp = Mpy_32_32( power_smooth_temp, ( *( p_cy_auto_diff_smooth_prev++ ) ) ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_diff_smooth_prev - 31 + exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ), + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev ), + Q31 ) ); + p_power_smooth++; + + *( p_gains_diff ) = Sqrt32( L_tmp, &exp ); + move32(); + *( p_gains_diff ) = L_shl_sat( *( p_gains_diff ), sub( h_dirac_output_synthesis_state->gains_diff_prev_q, sub( Q31, exp ) ) ); // gains_diff_prev_q + move32(); + + IF( LT_32( *( p_gains_diff ), 0 ) ) + { + *( p_gains_diff ) = 0; + move32(); + } + ELSE IF( GT_32( *( p_gains_diff ), (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_diff_prev_q ) ) ) ) + { + *( p_gains_diff ) = (Word32) ( DIRAC_GAIN_LIMIT * L_shl( 1U, h_dirac_output_synthesis_state->gains_diff_prev_q ) ); + move32(); + } + p_gains_diff++; + } + } + + /*-----------------------------------------------------------------* + * gain interpolation and output streams + *-----------------------------------------------------------------*/ + + FOR( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) + { + g1 = L_deposit_h( h_dirac_output_synthesis_params->interpolator_fx[buf_idx] ); // Q15 -> Q31 + g2 = L_sub( ONE_IN_Q31, g1 ); // Q31 + + /*Direct stream*/ + p_gain_1 = gains_dir; + p_gain_2 = h_dirac_output_synthesis_state->gains_dir_prev_fx; // gains_dir_prev_q + FOR( k = 0; k < nchan_out_woLFE; k++ ) + { + p_power_smooth = h_dirac_output_synthesis_state->proto_direct_buffer_f_fx + + shl( i_mult( buf_idx, i_mult( num_freq_bands, num_protos_dir ) ), Q1 ) + + shl( i_mult( proto_direct_index[k], num_freq_bands ), Q1 ); + FOR( l = 0; l < num_freq_bands; l++ ) + { + g = L_add( Mpy_32_32( g1, *( p_gain_1++ ) ), Mpy_32_32( g2, *( p_gain_2++ ) ) ); // (Q31, gains_dir_prev_q) -> gains_dir_prev_q + RealBuffer[k][buf_idx][l] = Mpy_32_32( g, ( *( p_power_smooth++ ) ) ); // (gains_dir_prev_q, q_proto_direct_buffer) -> gains_dir_prev_q + q_proto_direct_buffer - 31 + move32(); + ImagBuffer[k][buf_idx][l] = Mpy_32_32( g, ( *( p_power_smooth++ ) ) ); // (gains_dir_prev_q, q_proto_direct_buffer) -> gains_dir_prev_q + q_proto_direct_buffer - 31 + move32(); + } + } + + /*Diffuse stream*/ + IF( NE_16( h_dirac_output_synthesis_params->max_band_decorr, 0 ) ) + { + p_power_smooth_diff = h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx + + shl( i_mult( buf_idx, i_mult( h_dirac_output_synthesis_params->max_band_decorr, nchan_out_woLFE ) ), Q1 ); + } + p_gain_1 = gains_diff; + p_gain_2 = h_dirac_output_synthesis_state->gains_diff_prev_fx; // gains_diff_prev_q + FOR( k = 0; k < nchan_out_woLFE; k++ ) + { + FOR( l = 0; l < h_dirac_output_synthesis_params->max_band_decorr; l++ ) + { + g = L_add( Mpy_32_32( g1, *( p_gain_1++ ) ), Mpy_32_32( g2, *( p_gain_2++ ) ) ); // (Q31, gains_diff_prev_q) -> gains_diff_prev_q + RealBuffer[k][buf_idx][l] = L_add( L_shr( RealBuffer[k][buf_idx][l], Q1 ), + L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 + move32(); + ImagBuffer[k][buf_idx][l] = L_add( L_shr( ImagBuffer[k][buf_idx][l], Q1 ), + L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 + move32(); + } + + /*Direct proto*/ + p_power_smooth = h_dirac_output_synthesis_state->proto_direct_buffer_f_fx + + shl( i_mult( buf_idx, i_mult( num_freq_bands, num_protos_dir ) ), Q1 ) + + shl( i_mult( proto_direct_index[k], num_freq_bands ), Q1 ) + + shl( h_dirac_output_synthesis_params->max_band_decorr, Q1 ); + FOR( ; l < num_freq_bands; l++ ) + { + g = L_add( Mpy_32_32( g1, *( p_gain_1++ ) ), Mpy_32_32( g2, *( p_gain_2++ ) ) ); // (Q31, gains_diff_prev_q) -> gains_diff_prev_q + RealBuffer[k][buf_idx][l] = L_add( L_shr( RealBuffer[k][buf_idx][l], Q1 ), + L_shr( Mpy_32_32( g, ( *( p_power_smooth++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 + move32(); + ImagBuffer[k][buf_idx][l] = L_add( L_shr( ImagBuffer[k][buf_idx][l], Q1 ), + L_shr( Mpy_32_32( g, ( *( p_power_smooth++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 + move32(); + } + } + } + *q_Cldfb = sub( sub( add( h_dirac_output_synthesis_state->proto_direct_buffer_f_q, h_dirac_output_synthesis_state->gains_dir_prev_q ), Q31 ), Q1 ); + + /*-----------------------------------------------------------------* + * update buffers + *-----------------------------------------------------------------*/ + + /* store estimates for next synthesis block */ + mvl2l( gains_dir, h_dirac_output_synthesis_state->gains_dir_prev_fx, num_freq_bands * nchan_out_woLFE ); + mvl2l( gains_diff, h_dirac_output_synthesis_state->gains_diff_prev_fx, num_freq_bands * nchan_out_woLFE ); + + /* reset values */ + set_zero_fx( h_dirac_output_synthesis_state->proto_power_smooth_fx, num_freq_bands * num_protos_dir ); + IF( h_dirac_output_synthesis_state->proto_power_diff_smooth_fx != NULL ) + { + set_zero_fx( h_dirac_output_synthesis_state->proto_power_diff_smooth_fx, h_dirac_output_synthesis_params->max_band_decorr * nchan_out_woLFE ); + } + + set_zero_fx( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, num_freq_bands * nchan_out_woLFE ); + set_zero_fx( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, num_freq_bands * nchan_out_woLFE ); + set_zero_fx( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, num_freq_bands * nchan_out_woLFE ); + + pop_wmops(); + + return; +} +#endif + + /*------------------------------------------------------------------------- * ivas_dirac_dec_output_synthesis_process_subframe_psd_ls() * @@ -5523,10 +6142,13 @@ static void computeTargetPSDs_direct_subframe_fx( const Word16 num_freq_bands, const Word32 *direct_power_factor, const Word32 *reference_power, + const Word16 *q_reference_power, const Word32 *direct_responses, const Word32 *direct_responses_square, Word32 *cy_auto_dir_smooth, - Word32 *cy_cross_dir_smooth ) + Word16 *q_cy_auto_dir_smooth, + Word32 *cy_cross_dir_smooth, + Word16 *q_cy_cross_dir_smooth ) { Word16 ch_idx, cur_idx; @@ -5534,17 +6156,22 @@ static void computeTargetPSDs_direct_subframe_fx( Word32 direct_power[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ /* estimate direct and diffuse power */ - v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); + v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_mult_fixed( direct_power, &direct_responses_square[cur_idx], &cy_auto_dir_smooth[cur_idx], num_freq_bands ); - v_mult_fixed( direct_power, &direct_responses[cur_idx], &cy_cross_dir_smooth[cur_idx], num_freq_bands ); + v_mult_fixed( direct_power, &direct_responses_square[cur_idx], &cy_auto_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power + v_mult_fixed( direct_power, &direct_responses[cur_idx], &cy_cross_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power } + *q_cy_auto_dir_smooth = *q_reference_power; + move16(); + *q_cy_cross_dir_smooth = *q_reference_power; + move16(); + return; } #endif @@ -5607,7 +6234,7 @@ static void computeTargetPSDs_diffuse_fx( { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, num_freq_bands - start_band ); // (q_cy_auto_diff_smooth, Q31) -> q_cy_auto_diff_smooth + v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, num_freq_bands - start_band ); // (q_reference_power, Q31) -> q_reference_power Scale_sig32( aux_buffer_res, num_freq_bands - start_band, sub( *q_cy_auto_diff_smooth, *q_reference_power ) ); // q_cy_auto_diff_smooth Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, negate( Q1 ) ); // (q_cy_auto_diff_smooth - Q1) v_add_fixed( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], num_freq_bands - start_band, Q1 ); // (q_cy_auto_diff_smooth - Q1) @@ -5659,23 +6286,28 @@ static void computeTargetPSDs_diffuse_subframe_fx( const Word16 start_band, const Word32 *diffuse_power_factor, const Word32 *reference_power, + const Word16 *q_reference_power, const Word32 *diffuse_responses_square, - Word32 *cy_auto_diff_smooth ) + Word32 *cy_auto_diff_smooth, + Word16 *q_cy_auto_diff_smooth ) { Word16 ch_idx, cur_idx; Word32 diffuse_power[CLDFB_NO_CHANNELS_MAX]; /* segment auxiliary buffer; size: num_freq_bands. */ /* estimate direct and diffuse power */ - v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); + v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], &cy_auto_diff_smooth[cur_idx + start_band], num_freq_bands - start_band ); + v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], &cy_auto_diff_smooth[cur_idx + start_band], num_freq_bands - start_band ); // (q_reference_power, Q31) -> q_reference_power } + *q_cy_auto_diff_smooth = *q_reference_power; + move16(); + return; } #endif diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 3e2acd873..10c54d1fe 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1513,6 +1513,13 @@ ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero( hDirAC_mem->proto_power_smooth, size ); +#ifdef IVAS_FLOAT_FIXED + if ( ( hDirAC_mem->proto_power_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero_fx( hDirAC_mem->proto_power_smooth_fx, size ); +#endif if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) { @@ -1524,7 +1531,7 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } - set32_fx( hDirAC_mem->proto_power_diff_smooth_fx, 0, size ); + set_zero_fx( hDirAC_mem->proto_power_diff_smooth_fx, size ); hDirAC_mem->proto_power_diff_smooth_len = size; hDirAC_mem->proto_power_diff_smooth_q = 31; #endif @@ -3514,7 +3521,7 @@ void protoSignalComputation2_fx( temp = BASOP_Util_Log2( temp ); IF( NE_32( temp, MIN_32 ) ) { - temp = Mpy_32_32( L_add( L_shl( exp, Q25 ), temp ), INV_LOG10_2_Q31 ); // Q25 + temp = Mpy_32_32( L_add( L_shl( exp, Q25 ), temp ), LOG10_2_Q31 ); // Q25 } // 20480 = 10 in Q11 lr_total_bb_ratio_fx = Mpy_32_16_1( temp, 20480 ); // Q21 @@ -3572,7 +3579,7 @@ void protoSignalComputation2_fx( temp = BASOP_Util_Log2( temp ); IF( NE_32( temp, MIN_32 ) ) { - temp = Mpy_32_32( L_add( L_shl( exp, Q25 ), temp ), INV_LOG10_2_Q31 ); // Q25 + temp = Mpy_32_32( L_add( L_shl( exp, Q25 ), temp ), LOG10_2_Q31 ); // Q25 } // 20480 = 10 in Q11 lr_total_hi_ratio_fx = Mpy_32_16_1( temp, 20480 ); // Q21 @@ -3582,7 +3589,7 @@ void protoSignalComputation2_fx( temp = BASOP_Util_Log2( min_sum_total_ratio_fx ); IF( NE_32( temp, MIN_32 ) ) { - temp = Mpy_32_32( L_add( L_shl( exp, Q25 ), temp ), INV_LOG10_2_Q31 ); // Q25 + temp = Mpy_32_32( L_add( L_shl( exp, Q25 ), temp ), LOG10_2_Q31 ); // Q25 } // 20480 = 10 in Q11 min_sum_total_ratio_db_fx = Mpy_32_16_1( temp, 20480 ); // Q21 diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 0cbdbdb7f..42e7d9509 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -1208,7 +1208,7 @@ ivas_error ivas_orient_trk_SetReferenceVector_fx( Word16 q_min = s_min( listenerPos.q_fact, refPos.q_fact ); refPosLevel.x_fx = L_shr( refPosLevel.x_fx, sub( refPos.q_fact, q_min ) ); refPosLevel.y_fx = L_shr( refPosLevel.y_fx, sub( refPos.q_fact, q_min ) ); - refPosLevel.z_fx = L_shr( refPosLevel.z_fx, sub( listenerPos.q_fact, q_min ) ); + refPosLevel.z_fx = L_shr( refPosLevel.z_fx, sub( refPos.q_fact, q_min ) ); refPosLevel.q_fact = q_min; acousticFrontVector = VectorSubtract_fx( listenerPosLevel, refPosLevel ); @@ -1217,7 +1217,9 @@ ivas_error ivas_orient_trk_SetReferenceVector_fx( return IVAS_ERR_WRONG_PARAMS; } + Word16 accoustic_q = acousticFrontVector.q_fact; acousticFrontVectorLength = VectorLength_fx( acousticFrontVector, &acousticFrontVector.q_fact ); + acousticFrontVector.q_fact = accoustic_q; /* if the length is zero, the user has entered insensible listener and reference positions */ IF( LE_32( acousticFrontVectorLength, 0 ) ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ec03c0ead..bc6836520 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -882,6 +882,22 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( const int16_t dec_param_estim /* i : flag to indicate parameter estimation mode */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( + Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ + const Word16 nbslots, /* i : number of slots to process */ + Word32 *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ + Word32 *reference_power_smooth, + Word16 *q_reference_power_smooth, + Word32 qualityBasedSmFactor, + const Word16 enc_param_start_band, + Word16 *q_Cldfb +); +#endif + 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 */ @@ -1724,13 +1740,13 @@ void ivas_binaural_reverb_processSubframe_fx( #endif #ifdef IVAS_FLOAT_FIXED -ivas_error ivas_reverb_open( +ivas_error ivas_reverb_open_fx( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ const Word32 *lr_energy_and_iac_fx[], /* i : precomuputed lr energies and iac */ RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ - const int32_t output_Fs /* i : output sampling rate */ + const Word32 output_Fs /* i : output sampling rate */ ); #else ivas_error ivas_reverb_open( diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index d95009101..6d4513085 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -52,13 +52,13 @@ static Word16 wrap_rad_fixed( { Word32 L_tmp = angle; /* Wrap azimuth value */ - while(L_tmp > EVS_PI_FX ) + WHILE( GT_32( L_tmp, EVS_PI_FX ) ) { - L_tmp -= EVS_2PI_FX; + L_tmp = L_sub( L_tmp, EVS_2PI_FX ); } - while (L_tmp <= -EVS_PI_FX) + WHILE( LE_32( L_tmp, -EVS_PI_FX ) ) { - L_tmp += EVS_2PI_FX; + L_tmp = L_add( L_tmp, EVS_2PI_FX ); } return extract_l(L_tmp); @@ -130,15 +130,15 @@ typedef struct ivas_reverb_params_t /* Currently this is fixed to 2. */ /* Mix [S][L] matrix from feedback loops to outputs. */ Word16 pLoop_extract_matrix_fx[MAX_NR_OUTPUTS * IVAS_REV_MAX_NR_BRANCHES]; /* Mix [S][L] matrix from feedback loops to outputs. */ /* In Matlab: [S x L] - Currently S=2, later may be more than 2 for speaker playback. */ Word16 t60_filter_order; /* Filter order (length of vector) */ - float pT60_filter_coeff[MAX_NR_OUTPUTS * IVAS_REV_MAX_NR_BRANCHES * IVAS_REV_MAX_IIR_FILTER_LENGTH]; /* Filters [][] in feedback loops, controlling T60. */ + //float pT60_filter_coeff[MAX_NR_OUTPUTS * IVAS_REV_MAX_NR_BRANCHES * IVAS_REV_MAX_IIR_FILTER_LENGTH]; /* Filters [][] in feedback loops, controlling T60. */ #ifdef IVAS_FLOAT_FIXED Word16 pT60_filter_coeff_fx[MAX_NR_OUTPUTS * IVAS_REV_MAX_NR_BRANCHES * IVAS_REV_MAX_IIR_FILTER_LENGTH]; #endif /* In Matlab: IIR: [(2 * L) x ( + 1)] (odd: b-vector, even: a-vector) */ /* In Matlab: FIR: [L x ] */ - float *pFc; /* Center frequencies for FFT filter design */ - float *pRt60; /* RT60 values at these frequencies */ - float *pDsr; /* DSR values at these frequencies */ + //float *pFc; /* Center frequencies for FFT filter design */ + //float *pRt60; /* RT60 values at these frequencies */ + //float *pDsr; /* DSR values at these frequencies */ #ifdef IVAS_FLOAT_FIXED Word32 *pFc_fx; /* Center frequencies for FFT filter design */ Word32 *pRt60_fx; /* RT60 values at these frequencies */ @@ -146,12 +146,12 @@ typedef struct ivas_reverb_params_t Word32 *pDsr_fx; /* DSR values at these frequencies */ Word16 *pDsr_e; /* DSR values at these frequencies */ #endif - float *pHrtf_avg_pwr_response_l; /* The HRTF set's average left ear power response */ - float *pHrtf_avg_pwr_response_r; /* The HRTF set's average right ear power response */ - float *pHrtf_inter_aural_coherence; /* The HRTF set's inter-aural coherence for diffuse sound */ - const float *pHrtf_avg_pwr_response_l_const; /* The HRTF set's average left ear power response */ - const float *pHrtf_avg_pwr_response_r_const; /* The HRTF set's average right ear power response */ - const float *pHrtf_inter_aural_coherence_const; /* The HRTF set's inter-aural coherence for diffuse sound */ + // float *pHrtf_avg_pwr_response_l; /* The HRTF set's average left ear power response */ + // float *pHrtf_avg_pwr_response_r; /* The HRTF set's average right ear power response */ + // float *pHrtf_inter_aural_coherence; /* The HRTF set's inter-aural coherence for diffuse sound */ + // const float *pHrtf_avg_pwr_response_l_const; /* The HRTF set's average left ear power response */ + // const float *pHrtf_avg_pwr_response_r_const; /* The HRTF set's average right ear power response */ + // const float *pHrtf_inter_aural_coherence_const; /* The HRTF set's inter-aural coherence for diffuse sound */ #ifdef IVAS_FLOAT_FIXED Word32 *pHrtf_avg_pwr_response_l_fx; /* The HRTF set's average left ear power response */ @@ -392,7 +392,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( const Word32 *revEnes_fx /* i : spectrum for reverberated sound at each CLDFB bin */ ) { - int16_t bin, ch, tap, sample; + Word16 bin, ch, tap, sample; Word32 binCenterFreq_fx, diffuseFieldICC_fx, tmpVal_fx, attenuationFactorPerSample_fx, L_tmp; Word32 intendedEnergy_fx, actualizedEnergy_fx, energyBuildup_fx, currentEnergy_fx, attenuationFactorPerSampleSq_fx; @@ -596,11 +596,11 @@ static ivas_error compute_feedback_matrix_fx( u = MATRIX_CONSTANT; pFeedbackMatrix[0] = u; - for ( x = 1; x < n; x += x ) + FOR( x = 1; x < n; x += x ) { - for ( i = 0; i < x; i++ ) + FOR( i = 0; i < x; i++ ) { - for ( j = 0; j < x; j++ ) + FOR( j = 0; j < x; j++ ) { pFeedbackMatrix[( i + x ) * n + j] = pFeedbackMatrix[i * n + j]; pFeedbackMatrix[i * n + j + x] = pFeedbackMatrix[i * n + j]; @@ -628,7 +628,7 @@ static void compute_2_out_extract_matrix_fx( Word16 i; ff = 1; - for ( i = 0; i < n; i++ ) + FOR( i = 0; i < n; i++ ) { pExtractMatrix[i] = 1; pExtractMatrix[i + n] = ff; @@ -744,7 +744,7 @@ static void compute_2_out_extract_matrix( * Set all jot reverb parameters that are independent of the input reverb configuration *-----------------------------------------------------------------------------------------*/ -static ivas_error set_base_config( +static ivas_error set_base_config_fx( ivas_reverb_params_t *pParams, const Word32 output_Fs ) { @@ -934,7 +934,7 @@ static void calc_predelay_fx( move16(); return; } -#endif +#else static void calc_predelay( ivas_reverb_params_t *pParams, float acoustic_predelay_sec, @@ -961,7 +961,7 @@ static void calc_predelay( return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function compute_t60_coeffs() @@ -1039,7 +1039,7 @@ static ivas_error compute_t60_coeffs_fx( } len = ( pParams->t60_filter_order + 1 ) >> 1; /* == floor( (order+1) / 2) */ - for ( loop_idx = 0; loop_idx < pParams->nr_loops; loop_idx++ ) + FOR ( loop_idx = 0; loop_idx < pParams->nr_loops; loop_idx++ ) { pParams->pLoop_delays[loop_idx] -= len; } @@ -1171,7 +1171,7 @@ static void calc_low_shelf_first_order_filter_fx( Word16 gain_fx; gain_fx = BASOP_Util_Divide1616_Scale(lin_gain_lf, lin_gain_hf, &gain_exp); - IF ( gain_fx < 16384) + IF( LT_16( gain_fx, 16384 ) ) { tmp = mult(tan_val, gain_fx); @@ -1376,12 +1376,12 @@ static ivas_error calc_jot_t60_coeffs_fx( FOR ( f_idx = 0; f_idx < nrFrequencies; f_idx++ ) { - IF ( ( pFrequencies_fx[f_idx] >= ref_lf_min_norm_fx ) && ( pFrequencies_fx[f_idx] <= ref_lf_max_norm_fx ) ) + IF( GE_16( pFrequencies_fx[f_idx], ref_lf_min_norm_fx ) && LE_16( pFrequencies_fx[f_idx], ref_lf_max_norm_fx ) ) { L_tmpl = L_add( L_tmpl, pH_dB_fx[f_idx] ); n_points_lf++; } - IF ( ( pFrequencies_fx[f_idx] >= ref_hf_min_norm_fx ) && ( pFrequencies_fx[f_idx] <= ref_hf_max_norm_fx ) ) + IF( GE_16( pFrequencies_fx[f_idx], ref_hf_min_norm_fx ) && LE_16( pFrequencies_fx[f_idx], ref_hf_max_norm_fx ) ) { L_tmph = L_add(L_tmph, pH_dB_fx[f_idx]); n_points_hf++; @@ -1421,7 +1421,7 @@ static ivas_error calc_jot_t60_coeffs_fx( tmp_fx = BASOP_Util_Cmp_Mant32Exp(L_deposit_h(tmp1), e, minval_fx, minval_e); - IF (tmp_fx == -1) + IF( EQ_16( tmp_fx, -1 ) ) { minval_fx = L_deposit_h(tmp1); minval_e = e; @@ -1450,7 +1450,43 @@ static ivas_error calc_jot_t60_coeffs_fx( * * Set the number of branches (feedback loops) and Initializes the memory structure (pointers to data) *-----------------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static ivas_error initialize_reverb_filters_fx( + REVERB_HANDLE hReverb ) +{ + ivas_error error; + + error = IVAS_ERR_OK; + + /* init correlation and coloration filters */ + IF( ( error = ivas_reverb_t2f_f2t_init( &hReverb->fft_filter_ols, hReverb->fft_size, hReverb->fft_subblock_size ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_correl_0, hReverb->fft_size ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_correl_1, hReverb->fft_size ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_color_0, hReverb->fft_size ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_color_1, hReverb->fft_size ) ) != IVAS_ERR_OK ) + { + return error; + } + return error; +} +#else static ivas_error initialize_reverb_filters( REVERB_HANDLE hReverb ) { @@ -1486,7 +1522,7 @@ static ivas_error initialize_reverb_filters( return error; } - +#endif /*-----------------------------------------------------------------------------------------* * Function set_t60_filter() @@ -1547,12 +1583,12 @@ static ivas_error set_t60_filter( * Sets Delay of feedback branch in number of samples *-----------------------------------------------------------------------------------------*/ -static ivas_error set_feedback_delay( +static ivas_error set_feedback_delay_fx( REVERB_HANDLE hReverb, const UWord16 branch, const Word16 fb_delay ) { - if ( branch >= hReverb->nr_of_branches ) + IF( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } @@ -1596,12 +1632,12 @@ static ivas_error set_feedback_gain_fx( const Word32 *pGain ) { UWord16 gain_idx; - if ( branch >= hReverb->nr_of_branches ) + IF( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } - for ( gain_idx = 0; gain_idx < hReverb->nr_of_branches; gain_idx++ ) + FOR( gain_idx = 0; gain_idx < hReverb->nr_of_branches; gain_idx++ ) { hReverb->gain_matrix_fx[branch][gain_idx] = pGain[gain_idx]; } @@ -1614,7 +1650,7 @@ static ivas_error set_feedback_gain_fx( * Sets correlation filter complex gains *-----------------------------------------------------------------------------------------*/ -static ivas_error set_correl_fft_filter( +static ivas_error set_correl_fft_filter_fx( REVERB_HANDLE hReverb, const UWord16 channel, rv_fftwf_type_complex_fx *pSpectrum ) @@ -1643,7 +1679,7 @@ static ivas_error set_correl_fft_filter( * Sets coloration filter complex gains *-----------------------------------------------------------------------------------------*/ -static ivas_error set_color_fft_filter( +static ivas_error set_color_fft_filter_fx( REVERB_HANDLE hReverb, const UWord16 channel, rv_fftwf_type_complex_fx *pSpectrum ) @@ -1657,7 +1693,7 @@ static ivas_error set_color_fft_filter( { ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR_fx( pSpectrum, hReverb->fft_filter_color_0.fft_spectrum_fx, hReverb->fft_filter_color_0.fft_size ); } - else + ELSE { ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR_fx( pSpectrum, hReverb->fft_filter_color_1.fft_spectrum_fx, hReverb->fft_filter_color_1.fft_size ); } @@ -1751,7 +1787,7 @@ static ivas_error set_color_fft_filter( #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* - * Function set_mixer_level() + * Function set_mixer_level_fx() * * Sets Mixer level: to mix 2 output channels from 8 feedback branches *-----------------------------------------------------------------------------------------*/ @@ -1762,12 +1798,12 @@ static ivas_error set_mixer_level_fx( const Word16 level[] ) { uint16_t branch_idx; - if ( channel >= BINAURAL_CHANNELS ) + IF ( channel >= BINAURAL_CHANNELS ) { return IVAS_ERR_INTERNAL; } - for ( branch_idx = 0; branch_idx < hReverb->nr_of_branches; branch_idx++ ) + FOR ( branch_idx = 0; branch_idx < hReverb->nr_of_branches; branch_idx++ ) { hReverb->mixer_fx[channel][branch_idx] = level[branch_idx]; } @@ -1775,19 +1811,19 @@ static ivas_error set_mixer_level_fx( return IVAS_ERR_OK; } /*-----------------------------------------------------------------------------------------* - * Function clear_buffers() + * Function clear_buffers_fx() * * Clears buffers of delay lines and filters *-----------------------------------------------------------------------------------------*/ -static void clear_buffers( +static void clear_buffers_fx( REVERB_HANDLE hReverb ) { Word16 branch_idx; ivas_rev_iir_filter_t *iirFilter; ivas_rev_delay_line_t *delay_line; - for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) + FOR ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { delay_line = &( hReverb->delay_line[branch_idx] ); set_val_Word32( delay_line->pBuffer_fx, 0, delay_line->MaxDelay ); @@ -1803,32 +1839,32 @@ static void clear_buffers( } /*-----------------------------------------------------------------------------------------* - * Function set_fft_and_datablock_sizes() + * Function set_fft_and_datablock_sizes_fx() * * Sets frame size and fft-filter related sizes *-----------------------------------------------------------------------------------------*/ -static void set_fft_and_datablock_sizes( +static void set_fft_and_datablock_sizes_fx( REVERB_HANDLE hReverb, const Word16 subframe_len ) { hReverb->full_block_size = subframe_len; - if ( subframe_len == L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES ) + IF( EQ_16( subframe_len, 240 /*L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES*/ ) ) { hReverb->fft_size = IVAS_REVERB_FFT_SIZE_48K; hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_48K; } - else if ( subframe_len == L_FRAME32k / MAX_PARAM_SPATIAL_SUBFRAMES ) + ELSE IF( EQ_16( subframe_len, 160 /*L_FRAME32k / MAX_PARAM_SPATIAL_SUBFRAMES*/ ) ) { hReverb->fft_size = IVAS_REVERB_FFT_SIZE_32K; hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_32K; } - else if ( subframe_len == L_FRAME16k / MAX_PARAM_SPATIAL_SUBFRAMES ) + ELSE IF( EQ_16( subframe_len, 80 /*L_FRAME16k / MAX_PARAM_SPATIAL_SUBFRAMES*/ ) ) { hReverb->fft_size = IVAS_REVERB_FFT_SIZE_16K; hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_16K; } - else + ELSE { assert( 0 ); /* unsupported block size */ } @@ -1975,7 +2011,7 @@ static void set_reverb_acoustic_data_fx( move16(); FOR ( iter_idx = 0; iter_idx < hHrtf->num_iterations[hrtf_idx][nr_out_ch] - 1; iter_idx++ ) { - offset += hHrtf->pIndex_frequency_max[hrtf_idx][nr_out_ch][iter_idx]; + offset = add( offset, hHrtf->pIndex_frequency_max[hrtf_idx][nr_out_ch][iter_idx] ); } IF ( EQ_16( nr_out_ch, 0 ) ) @@ -2023,7 +2059,8 @@ static void set_reverb_acoustic_data_fx( // 23 in Q26 tmp_flag = BASOP_Util_Cmp_Mant32Exp(L_deposit_h(exp_argument_fx), exp_argument_e, 1543503872, 5 ); - IF(tmp_flag > 0) { + IF( GT_16( tmp_flag, 0 ) ) + { exp_argument_fx = 23552; move16(); exp_argument_e = 5; @@ -2031,9 +2068,11 @@ static void set_reverb_acoustic_data_fx( } tmp_flag = BASOP_Util_Cmp_Mant32Exp(L_deposit_h(exp_argument_fx), exp_argument_e, 0, 31); - IF(tmp_flag < 0) { + IF( LT_16( tmp_flag, 0 ) ) + { tmp_flag = BASOP_Util_Cmp_Mant32Exp(L_deposit_h(negate( exp_argument_fx) ), exp_argument_e, 1543503872, 5); - IF (tmp_flag < 0) { + IF( LT_16( tmp_flag, 0 ) ) + { exp_argument_fx = -23552; move16(); exp_argument_e = 5; @@ -2044,7 +2083,7 @@ static void set_reverb_acoustic_data_fx( Word16 tmp_exp; /* expf(exp_argument) -> pow(2, log2(e) * exp_argument) */ tmp = mult(23637, exp_argument_fx); // exp_argument_e + 1 - tmp_exp = exp_argument_e + 1; + tmp_exp = add( exp_argument_e, 1 ); L_tmp = BASOP_util_Pow2(L_deposit_h(tmp), tmp_exp, &pow_exp); L_tmp = Mpy_32_32( L_tmp, pDsr_fx[bin_idx] ); tmp_exp = tmp_exp + pDsr_e[bin_idx]; @@ -2136,12 +2175,12 @@ static void set_reverb_acoustic_data( #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* - * Function setup_FDN_branches() + * Function setup_FDN_branches_fx() * * Sets up feedback delay network system *-----------------------------------------------------------------------------------------*/ -static ivas_error setup_FDN_branches( +static ivas_error setup_FDN_branches_fx( REVERB_HANDLE hReverb, ivas_reverb_params_t *pParams ) { @@ -2158,7 +2197,7 @@ static ivas_error setup_FDN_branches( hReverb->mixer_fx[0][branch_idx] = 0; hReverb->mixer_fx[1][branch_idx] = 0; } - clear_buffers( hReverb ); + clear_buffers_fx( hReverb ); nr_coefs = add(pParams->t60_filter_order , 1); IF ( LT_16(IVAS_REV_MAX_IIR_FILTER_LENGTH , nr_coefs) ) @@ -2177,7 +2216,7 @@ static ivas_error setup_FDN_branches( return error; } - IF ( ( error = set_feedback_delay( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) + IF ( ( error = set_feedback_delay_fx( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) { return error; } @@ -2265,18 +2304,18 @@ static ivas_error setup_FDN_branches( #endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- - * ivas_reverb_open() + * ivas_reverb_open_fx() * * Allocate and initialize Crend reverberation handle *------------------------------------------------------------------------*/ -ivas_error ivas_reverb_open( +ivas_error ivas_reverb_open_fx( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ const Word32 *lr_energy_and_iac_fx[], /* i : precomuputed lr energies and iac */ RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ - const int32_t output_Fs /* i : output sampling rate */ + const Word32 output_Fs /* i : output sampling rate */ ) { ivas_error error; @@ -2304,7 +2343,7 @@ ivas_error ivas_reverb_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Reverberator " ); } - IF ( ( error = set_base_config( ¶ms, output_Fs ) ) != IVAS_ERR_OK ) + IF ( ( error = set_base_config_fx( ¶ms, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -2325,7 +2364,7 @@ ivas_error ivas_reverb_open( } pState->nr_of_branches = IVAS_REV_MAX_NR_BRANCHES; - set_fft_and_datablock_sizes( pState, subframe_len ); + set_fft_and_datablock_sizes_fx( pState, subframe_len ); nr_fc_fft_filter = add( extract_l( L_shr( pState->fft_size, 1 ) ), 1 ); /* === 'Control logic': compute the reverb processing parameters from the === */ @@ -2430,7 +2469,7 @@ ivas_error ivas_reverb_open( pState->do_corr_filter = params.do_corr_filter; /* clear & init jot reverb fft filters */ - IF ( ( error = initialize_reverb_filters( pState ) ) != IVAS_ERR_OK ) + IF ( ( error = initialize_reverb_filters_fx( pState ) ) != IVAS_ERR_OK ) { return error; } @@ -2471,12 +2510,12 @@ ivas_error ivas_reverb_open( pFft_wf_filter_ch1_fx[i][1] = L_shl( pFft_wf_filter_ch1_fx[i][1], 31 - q_pFft_wf_filter_ch1_fx ); } /* Copying the computed FFT correlation filters to the fft_filter components */ - IF ( ( error = set_correl_fft_filter( pState, 0, pFft_wf_filter_ch0_fx ) ) != IVAS_ERR_OK ) + IF ( ( error = set_correl_fft_filter_fx( pState, 0, pFft_wf_filter_ch0_fx ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = set_correl_fft_filter( pState, 1, pFft_wf_filter_ch1_fx ) ) != IVAS_ERR_OK ) + IF ( ( error = set_correl_fft_filter_fx( pState, 1, pFft_wf_filter_ch1_fx ) ) != IVAS_ERR_OK ) { return error; } @@ -2500,12 +2539,12 @@ ivas_error ivas_reverb_open( Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ /* Copying the computed FFT colorations filters to the fft_filter components */ - IF ( ( error = set_color_fft_filter( pState, 0, pFft_wf_filter_ch0_fx ) ) != IVAS_ERR_OK ) + IF ( ( error = set_color_fft_filter_fx( pState, 0, pFft_wf_filter_ch0_fx ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = set_color_fft_filter( pState, 1, pFft_wf_filter_ch1_fx ) ) != IVAS_ERR_OK ) + IF ( ( error = set_color_fft_filter_fx( pState, 1, pFft_wf_filter_ch1_fx ) ) != IVAS_ERR_OK ) { return error; } @@ -2514,7 +2553,7 @@ ivas_error ivas_reverb_open( ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer_fx, params.pre_delay, predelay_bf_len ); /* set up feedback delay network */ - IF ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) + IF ( ( error = setup_FDN_branches_fx( pState, ¶ms ) ) != IVAS_ERR_OK ) { return error; } @@ -2803,14 +2842,14 @@ static void post_fft_filter_fx( Word32 *buffer_R_fx ) { - if ( hReverb->do_corr_filter ) + IF( hReverb->do_corr_filter ) { ivas_reverb_t2f_f2t_in_fx( &hReverb->fft_filter_ols, input_L_fx, input_R_fx, buffer_L_fx, buffer_R_fx ); ivas_reverb_fft_filter_ComplexMul_fx( &hReverb->fft_filter_correl_0, buffer_L_fx ); ivas_reverb_fft_filter_ComplexMul_fx( &hReverb->fft_filter_correl_1, buffer_R_fx ); ivas_reverb_fft_filter_CrossMix_fx( buffer_L_fx, buffer_R_fx, hReverb->fft_filter_correl_0.fft_size ); } - else + ELSE { ivas_reverb_t2f_f2t_in_fx( &hReverb->fft_filter_ols, input_L_fx, input_R_fx, buffer_L_fx, buffer_R_fx ); } @@ -2881,23 +2920,23 @@ static void reverb_block_fx( pFFT_buf[0] = &FFT_buf_1[0]; pFFT_buf[1] = &FFT_buf_2[0]; - for ( branch_idx = 0; branch_idx < nr_branches; branch_idx++ ) + FOR( branch_idx = 0; branch_idx < nr_branches; branch_idx++ ) { ppOutput_fx[branch_idx] = (Word32 *) Output_fx + branch_idx * inner_bsize; } - for ( k = 0; k < bsize; k += inner_bsize ) + FOR( k = 0; k < bsize; k += inner_bsize ) { Word32 *pO0 = &pOut0_fx[k]; Word32 *pO1 = &pOut1_fx[k]; - for ( i = 0; i < inner_bsize; i++ ) + FOR( i = 0; i < inner_bsize; i++ ) { pO0[i] = 0; pO1[i] = 0; } /* feedback network: */ - for ( i = 0; i < nr_branches; i++ ) + FOR( i = 0; i < nr_branches; i++ ) { Word32 *pOutput_i_fx = &ppOutput_fx[i][0]; Word16 mixer_0_i = hReverb->mixer_fx[0][i]; @@ -2905,27 +2944,27 @@ static void reverb_block_fx( /* output and feedback are same, get sample from delay line ... */ ivas_rev_delay_line_get_sample_blk_fx( &( hReverb->delay_line[i] ), inner_bsize, pTemp_fx ); ivas_reverb_iir_filt_2taps_feed_blk_fx( &( hReverb->t60[i] ), inner_bsize, pTemp_fx, ppOutput_fx[i] ); - for ( ns = 0; ns < inner_bsize; ns++ ) + FOR( ns = 0; ns < inner_bsize; ns++ ) { pO0[ns] = L_add( pOutput_i_fx[ns] * mixer_0_i, pO0[ns] ); /* mixer ch 0 */ pO1[ns] = L_add( pOutput_i_fx[ns] * mixer_1_i, pO1[ns] ); /* mixer ch 1 */ } } - for ( i = 0; i < nr_branches; i++ ) + FOR( i = 0; i < nr_branches; i++ ) { Word32 *pIn = &pInput_fx[k]; - for ( ns = 0; ns < inner_bsize; ns++ ) + FOR( ns = 0; ns < inner_bsize; ns++ ) { pFeedback_input_fx[ns] = pIn[ns] >> 3; // to make the Qfactor similar to pOutput } - for ( j = 0; j < nr_branches; j++ ) + FOR( j = 0; j < nr_branches; j++ ) { Word32 gain_matrix_j_i = hReverb->gain_matrix_fx[j][i]; Word32 *pOutput = &ppOutput_fx[j][0]; - for ( ns = 0; ns < inner_bsize; ns++ ) + FOR( ns = 0; ns < inner_bsize; ns++ ) { pFeedback_input_fx[ns] = ( L_add( Mpy_32_32( gain_matrix_j_i, pOutput[ns] ), pFeedback_input_fx[ns] ) ); } @@ -2938,13 +2977,13 @@ static void reverb_block_fx( Word16 r_shift; r_shift = find_guarded_bits_fx( hReverb->fft_filter_ols.fft_size ); // Applying guard bits for the DoRTFT inside the post_fft_filter function - for ( k = 0; k < hReverb->fft_filter_ols.block_size; k++ ) + FOR( k = 0; k < hReverb->fft_filter_ols.block_size; k++ ) { pOut0_fx[k] = (Word32) pOut0_fx[k] >> ( r_shift ); pOut1_fx[k] = (Word32) pOut1_fx[k] >> ( r_shift ); } /* Applying FFT filter to each sub-frame */ - for ( blk_idx = 0; blk_idx < hReverb->num_fft_subblocks; blk_idx++ ) + FOR( blk_idx = 0; blk_idx < hReverb->num_fft_subblocks; blk_idx++ ) { start_sample_idx = blk_idx * hReverb->fft_subblock_size; post_fft_filter_fx( hReverb, pOut0_fx + start_sample_idx, pOut1_fx + start_sample_idx, pFFT_buf[0], pFFT_buf[1] ); @@ -3061,7 +3100,7 @@ static ivas_error downmix_input_block_fx( { Word16 i, s, nchan_transport; Word32 dmx_gain_fx = hReverb->dmx_gain_fx; - switch ( input_audio_config ) + SWITCH( input_audio_config ) { case IVAS_AUDIO_CONFIG_STEREO: case IVAS_AUDIO_CONFIG_5_1: @@ -3075,31 +3114,31 @@ static ivas_error downmix_input_block_fx( case IVAS_AUDIO_CONFIG_ISM4: { nchan_transport = audioCfg2channels( input_audio_config ); - for ( s = 0; s < hReverb->full_block_size; s++ ) + FOR( s = 0; s < hReverb->full_block_size; s++ ) { Word32 temp = pcm_in[0][input_offset + s]; - for ( i = 1; i < nchan_transport; i++ ) + FOR( i = 1; i < nchan_transport; i++ ) { temp = L_add( temp, pcm_in[i][input_offset + s] ); } pPcm_out[s] = Mpy_32_32( dmx_gain_fx, L_shl_sat( temp, 7 ) ) << 1; } - break; + BREAK; } case IVAS_AUDIO_CONFIG_MONO: /* ~'ZOA_1' */ case IVAS_AUDIO_CONFIG_FOA: case IVAS_AUDIO_CONFIG_HOA2: case IVAS_AUDIO_CONFIG_HOA3: { - for ( s = 0; s < hReverb->full_block_size; s++ ) + FOR( s = 0; s < hReverb->full_block_size; s++ ) { pPcm_out[s] = Mpy_32_32( dmx_gain_fx, L_shl_sat( pcm_in[0][input_offset + s], 8 ) ); } - break; + BREAK; } default: return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported input format for reverb" ); - break; + BREAK; } return IVAS_ERR_OK; @@ -3179,32 +3218,32 @@ static void predelay_block_fx( { UWord16 i, idx, n_samples, blk_size; UWord16 max_blk_size = (UWord16) hReverb->predelay_line.Delay; - if ( max_blk_size < 2 ) + IF( max_blk_size < 2 ) { - if ( max_blk_size == 0 ) /* zero-length delay line: just copy the data from input to output */ + IF( max_blk_size == 0 ) /* zero-length delay line: just copy the data from input to output */ { - for ( i = 0; i < hReverb->full_block_size; i++ ) + FOR( i = 0; i < hReverb->full_block_size; i++ ) { pOutput[i] = pInput[i]; } } - else /* 1-sample length delay line: feed the data sample-by-sample */ + ELSE /* 1-sample length delay line: feed the data sample-by-sample */ { - for ( i = 0; i < hReverb->full_block_size; i++ ) + FOR( i = 0; i < hReverb->full_block_size; i++ ) { pOutput[i] = ivas_rev_delay_line_get_sample_fx( &( hReverb->predelay_line ) ); ivas_rev_delay_line_feed_sample_fx( &( hReverb->predelay_line ), pInput[i] ); } } } - else /* multiple-sample length delay line: use block processing */ + ELSE /* multiple-sample length delay line: use block processing */ { idx = 0; n_samples = hReverb->full_block_size; - while ( n_samples > 0 ) + WHILE( n_samples > 0 ) { blk_size = n_samples; - if ( blk_size > max_blk_size ) + IF( blk_size > max_blk_size ) { blk_size = max_blk_size; } @@ -3287,7 +3326,7 @@ static void mix_output_block_fx( { UWord16 i; - for ( i = 0; i < hReverb->full_block_size; i++ ) + FOR( i = 0; i < hReverb->full_block_size; i++ ) { pOutL[i] = L_add( pInL[i], ( ( pOutL[i] ) >> 2 ) ); pOutR[i] = L_add( pInR[i], ( ( pOutR[i] ) >> 2 ) ); @@ -3339,7 +3378,7 @@ ivas_error ivas_reverb_process_fx( Word32 tmp0_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp1_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp2_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; ivas_error error; - if ( ( error = downmix_input_block_fx( hReverb, pcm_in_fx, input_audio_config, tmp1_fx, i_ts * hReverb->full_block_size ) ) != IVAS_ERR_OK ) + IF( ( error = downmix_input_block_fx( hReverb, pcm_in_fx, input_audio_config, tmp1_fx, i_ts * hReverb->full_block_size ) ) != IVAS_ERR_OK ) { return error; } @@ -3348,11 +3387,11 @@ ivas_error ivas_reverb_process_fx( reverb_block_fx( hReverb, tmp0_fx, tmp1_fx, tmp2_fx ); - if ( mix_signals ) + IF( mix_signals ) { mix_output_block_fx( hReverb, tmp1_fx, tmp2_fx, &pcm_out_fx[0][i_ts * hReverb->full_block_size], &pcm_out_fx[1][i_ts * hReverb->full_block_size] ); } - else + ELSE { mvr2r_Word32( tmp1_fx, &pcm_out_fx[0][i_ts * hReverb->full_block_size], hReverb->full_block_size ); mvr2r_Word32( tmp2_fx, &pcm_out_fx[1][i_ts * hReverb->full_block_size], hReverb->full_block_size ); @@ -3744,6 +3783,120 @@ void ivas_binaural_reverb_processSubframe_fx( * * Allocate and initialize binaural room reverberator handle *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_binaural_reverb_open_fx( + REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ + const Word16 numBins, /* i : number of CLDFB bins */ + const Word16 numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + const Word32 sampling_rate, /* i : sampling rate */ + const Word32 *revTimes_fx, /* i : reverberation times T60 for each CLDFB bin in seconds */ + const Word32 *revEnes_fx, /* i : spectrum for reverberated sound at each CLDFB bin */ + const Word16 preDelay /* i : reverb pre-delay in CLDFB slots */ +) +{ + int16_t bin, chIdx, k, len; + REVERB_STRUCT_HANDLE hReverb; + + if ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) malloc( sizeof( REVERB_STRUCT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + hReverb = *hReverbPr; + + hReverb->useBinauralCoherence = 1; + hReverb->preDelayBufferLength = 1; + hReverb->preDelayBufferIndex = 0; + + hReverb->numBins = numBins; + hReverb->blockSize = numCldfbSlotsPerFrame; + + for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) + { + set32_fx( hReverb->preDelayBufferReal_fx[k], 0, hReverb->numBins ); + set32_fx( hReverb->preDelayBufferImag_fx[k], 0, hReverb->numBins ); + } + + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Loop Buffer */ + hReverb->loopBufLengthMax[bin] = (int16_t) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); + + len = hReverb->loopBufLengthMax[bin] + hReverb->blockSize; + + if ( ( hReverb->loopBufReal_fx[bin] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + if ( ( hReverb->loopBufImag_fx[bin] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + set32_fx( hReverb->loopBufReal_fx[bin], 0, len ); + set32_fx( hReverb->loopBufImag_fx[bin], 0, len ); + + /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long + * but not excessively long loops to generate reverberation. */ + /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ + //hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); + Word32 L_tmp_BufLength = L_shl( L_shr( Mpy_32_32( revTimes_fx[bin], 1258291200 /*150.0 in Q23*/ ), 23 ), 23 ); + L_tmp_BufLength = L_add( Mpy_32_32( 1556925644 /*1.45 in Q30*/, L_tmp_BufLength ), ONE_IN_Q22 ); + hReverb->loopBufLength[bin] = (Word16) L_shr( L_tmp_BufLength, 22 ); + hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); + + /* Sparse Filter Tap Locations */ + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + len = hReverb->loopBufLength[bin]; + + if ( ( hReverb->tapPhaseShiftType[bin][chIdx] = (int16_t *) malloc( len * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + set_s( hReverb->tapPhaseShiftType[bin][chIdx], 0, len ); + + if ( ( hReverb->tapPointersReal_fx[bin][chIdx] = (Word32 **) malloc( len * sizeof( Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + if ( ( hReverb->tapPointersImag_fx[bin][chIdx] = (Word32 **) malloc( len * sizeof( Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + len = hReverb->blockSize; + if ( ( hReverb->outputBufferReal_fx[bin][chIdx] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + if ( ( hReverb->outputBufferImag_fx[bin][chIdx] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + set32_fx( hReverb->outputBufferReal_fx[bin][chIdx], 0, len ); + set32_fx( hReverb->outputBufferImag_fx[bin][chIdx], 0, len ); + } + } + + /*Word32 *revTimes_fx = (Word32 *)malloc(sizeof(Word32) * hReverb->numBins); + Word32 *revEnes_fx = (Word32 *)malloc(sizeof(Word32) * hReverb->numBins); + FOR(int i = 0; i < hReverb->numBins; i++) { + revTimes_fx[i] = (Word32)(revTimes[i] * ONE_IN_Q31); + revEnes_fx[i] = (Word32)(revEnes[i] * ONE_IN_Q31); + }*/ + ivas_binaural_reverb_setReverbTimes_fx( hReverb, sampling_rate, revTimes_fx, revEnes_fx ); + + /*free(revTimes_fx); + free(revEnes_fx);*/ + + ivas_binaural_reverb_setPreDelay_fx( hReverb, preDelay ); + + return IVAS_ERR_OK; +} +#endif static ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ @@ -3962,7 +4115,49 @@ ivas_error ivas_binaural_reverb_open_fastconv( * * Allocate and initialize binaural room reverberator handle for ParamBin *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_binaural_reverb_open_parambin( + REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ + const int16_t numBins, /* i : number of CLDFB bins */ + const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ + const int32_t sampling_rate, /* i : sampling rate */ + const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ +) +{ + ivas_error error; + const Word32 *revTimes; + const Word32 *revEne; + Word32 t60[CLDFB_NO_CHANNELS_MAX]; + Word32 ene[CLDFB_NO_CHANNELS_MAX]; + int16_t preDelay; + + error = IVAS_ERR_OK; + + if ( ( roomAcoustics != NULL ) && roomAcoustics->override ) + { + revTimes = t60; + revEne = ene; + /* Todo Philips: This needs a suitable function for ParamBin here. */ + // if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, internal_config, false, sampling_rate, t60, ene ) ) != IVAS_ERR_OK ) + // { + // return error; + // } + //preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); + preDelay = (Word16) L_shr_r(Mpy_32_32(1677721600 /*800 in Q21*/, roomAcoustics->acousticPreDelay_fx /*Q27*/ ), Q17); + } + else + { + revTimes = hHrtfParambin->parametricReverberationTimes_fx; + revEne = hHrtfParambin->parametricReverberationEneCorrections_fx; + preDelay = 10; + } + + error = ivas_binaural_reverb_open_fx( hReverbPr, numBins, numCldfbSlotsPerFrame, sampling_rate, revTimes, revEne, preDelay ); + return error; +} +#else ivas_error ivas_binaural_reverb_open_parambin( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ @@ -4003,7 +4198,7 @@ ivas_error ivas_binaural_reverb_open_parambin( return error; } - +#endif /*------------------------------------------------------------------------- * ivas_binaural_reverb_close() diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index e76cadc37..57dc79860 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -1152,7 +1152,7 @@ void ivas_reverb_calc_color_levels_fx( H_filter = L_add(L_shr(L_add(L_shr(Mpy_32_32(coefB[0], coefB[0]), 1), L_shr(Mpy_32_32(coefB[1], coefB[1]), 1)), 2), L_shr(Mpy_32_32(coefB[0], Mpy_32_32(coefB[1], L_shl(cos_w, 15))), 1)); //q = 28 H_filter = BASOP_Util_Divide3232_Scale(H_filter, L_add(ONE_IN_Q28, L_shr(L_add(L_shr(Mpy_32_32(coefA[1], coefA[1]), 2), Mpy_32_32(coefA[1], L_shl(cos_w, 15))), 1)), &temp); H_filter = Sqrt32(L_shl(H_filter, 16), &temp); - T60_est = BASOP_Util_Divide3232_Scale(L_shl(i_mult(-3, pLoop_delays[loop_idx]), 2), Mpy_32_32(Mpy_32_32(L_add(BASOP_Util_Log2(H_filter), L_shl(temp, 25)), INV_LOG10_2_Q31), L_shl(output_Fs, 8)), &temp);//conversion of log2 to log10. + T60_est = BASOP_Util_Divide3232_Scale(L_shl(i_mult(-3, pLoop_delays[loop_idx]), 2), Mpy_32_32(Mpy_32_32(L_add(BASOP_Util_Log2(H_filter), L_shl(temp, 25)), LOG10_2_Q31), L_shl(output_Fs, 8)), &temp);//conversion of log2 to log10. T60_est = L_shl(T60_est, 16); t60[freq_idx] = BASOP_Util_Add_Mant32Exp(T60_est, temp, t60[freq_idx], t60_e[freq_idx], &result_e); t60_e[freq_idx] = result_e; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 807dce497..2684fe020 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -410,14 +410,14 @@ typedef struct dirac_output_synthesis_state_structure Word32 *proto_power_smooth_fx; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ Word16 proto_power_smooth_q; - Word16 *proto_power_smooth_prev_fx; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ + Word32 *proto_power_smooth_prev_fx; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ + Word16 proto_power_smooth_prev_q; Word32 *proto_power_diff_smooth_fx; + Word32 *proto_power_diff_smooth_prev_fx; Word16 proto_power_diff_smooth_q; Word16 proto_power_diff_smooth_len; - Word16 *proto_power_diff_smooth_prev_fx; - /* only pointer to local buffers */ Word32 *proto_direct_buffer_f_fx; /* Buffer for direct sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ Word16 proto_direct_buffer_f_q; @@ -453,8 +453,8 @@ typedef struct dirac_output_synthesis_state_structure const Word32 *onset_filter_fx; /* Temporal smoothing memories */ - Word16 *reference_power_smooth_prev_fx; - Word16 *direction_smoothness_prev_fx; + Word32 *reference_power_smooth_prev_fx; + Word32 *direction_smoothness_prev_fx; // Q31 #endif } DIRAC_OUTPUT_SYNTHESIS_STATE; @@ -509,14 +509,17 @@ typedef struct Word16 q_total_power; Word32 subtract_power_y_fx; + Word32 subtract_power_y_smooth_fx; + Word32 target_power_y_smooth_fx; + Word16 q_subtract_power_y; - Word16 subtract_power_y_smooth_fx; - Word16 target_power_y_smooth_fx; + Word16 q_subtract_power_y_smooth; + Word16 q_target_power_y_smooth; Word32 lr_total_bb_ratio_db_fx; Word32 lr_total_hi_ratio_db_fx; Word32 min_sum_total_ratio_db_fx; - Word32 subtract_target_ratio_db_fx; + Word32 subtract_target_ratio_db_fx; // Q21 #endif int16_t counter; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5f5f80b40..83fd23f69 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -156,6 +156,9 @@ typedef struct CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; +#ifdef IVAS_FLOAT_FIXED + pan_vector_fx prev_pan_gains_fx; +#endif pan_vector prev_pan_gains; int8_t firstFrameRendered; float *bufferData; @@ -1799,74 +1802,6 @@ static ivas_error getEfapGains_fx( return IVAS_ERR_OK; } -#endif -#ifdef IVAS_FLOAT_FIXED -static ivas_error getEfapGains( - EFAP_WRAPPER efapWrapper, - const float azi, - const float ele, - pan_vector panGains ) -{ - pan_vector tmpPanGains; /* tmp pan gain buffer without LFE channels */ - pan_vector_fx tmpPanGains_fx; /* tmp pan gain buffer without LFE channels */ - float *readPtr; - int16_t i; - int16_t lfeCount; - int16_t numChannels; - ivas_error error; - - /* EFAP returns an array of gains only for non-LFE speakers */ - efap_determine_gains_fx( efapWrapper.hEfap, tmpPanGains_fx, floatToFixed( azi, Q22 ), floatToFixed( ele, Q22 ), EFAP_MODE_EFAP ); - /* float2fix to be removed */ - - /*fix2float: to be removed*/ - fixedToFloat_arrL(tmpPanGains_fx, tmpPanGains, Q30, efapWrapper.hEfap->numSpk); - - /* Now copy to buffer that includes LFE channels */ - if ( efapWrapper.speakerConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - numChannels = efapWrapper.pCustomLsSetup->num_spk + efapWrapper.pCustomLsSetup->num_lfe; - readPtr = tmpPanGains; - - for ( i = 0, lfeCount = 0; i < numChannels; ++i ) - { - if ( lfeCount < efapWrapper.pCustomLsSetup->num_lfe && i == efapWrapper.pCustomLsSetup->lfe_idx[lfeCount] ) - { - panGains[i] = 0.0f; - ++lfeCount; - } - else - { - panGains[i] = *readPtr; - ++readPtr; - } - } - } - else - { - if ( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - - readPtr = tmpPanGains; - - for ( i = 0; i < numChannels; ++i ) - { - if ( i == LFE_CHANNEL ) - { - panGains[i] = 0.0f; - } - else - { - panGains[i] = *readPtr; - ++readPtr; - } - } - } - - return IVAS_ERR_OK; -} #else static ivas_error getEfapGains( EFAP_WRAPPER efapWrapper, @@ -2387,7 +2322,7 @@ static ivas_error setRendInputActiveIsm( hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); #endif - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL,inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL,inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -2713,7 +2648,7 @@ static ivas_error initMcPanGainsWithEfap_fx( } return IVAS_ERR_OK; } -#endif +#else static ivas_error initMcPanGainsWithEfap( input_mc *inputMc, const AUDIO_CONFIG outConfig ) @@ -2779,7 +2714,7 @@ static ivas_error initMcPanGainsWithEfap( return IVAS_ERR_OK; } - +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error getRendInputNumChannels( const void *rendInput, @@ -3817,7 +3752,7 @@ static ivas_error initMcBinauralRendering( hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); #endif - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL,inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL,inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -8203,6 +8138,7 @@ static ivas_error renderIsmToBinauralRoom( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; pan_vector currentPanGains; + pan_vector_fx currentPanGains_fx; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_ISM_METADATA rotatedPosPrev; IVAS_ISM_METADATA rotatedPos; @@ -8287,21 +8223,30 @@ static ivas_error renderIsmToBinauralRoom( position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &rotatedPos, &rotatedPosPrev ); /* set previous gains if this is the first frame */ - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, rotatedPosPrev.azimuth, rotatedPosPrev.elevation, ismInput->prev_pan_gains ) ) != IVAS_ERR_OK ) + /*float2fix to be removed*/ + Word32 azimuth_fx_tmp = floatToFixed(rotatedPosPrev.azimuth, Q22); + Word32 elevation_fx_tmp = floatToFixed(rotatedPosPrev.elevation, Q22); + if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, azimuth_fx_tmp, elevation_fx_tmp, ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) { return error; } - + /* fix2float to be removed */ + fixedToFloat_arrL(ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS); /* compute gains only if position changed */ if ( position_changed ) { - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - rotatedPos.azimuth, - rotatedPos.elevation, - currentPanGains ) ) != IVAS_ERR_OK ) + /*float2fix to be removed*/ + azimuth_fx_tmp = floatToFixed(rotatedPos.azimuth, Q22); + elevation_fx_tmp = floatToFixed(rotatedPos.elevation, Q22); + if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + azimuth_fx_tmp, + elevation_fx_tmp, + currentPanGains_fx ) ) != IVAS_ERR_OK ) { return error; } + /* fix2float to be removed */ + fixedToFloat_arrL(currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS); } /* intermediate rendering to 7_1_4 */ @@ -8587,13 +8532,14 @@ static ivas_error renderIsmToBinauralReverb( return IVAS_ERR_OK; } - +#ifdef IVAS_FLOAT_FIXED static ivas_error renderIsmToMc( input_ism *ismInput, const IVAS_REND_AudioBuffer outAudio ) { int8_t position_changed; pan_vector currentPanGains; + pan_vector_fx currentPanGains_fx; ivas_error error; push_wmops( "renderIsmToMc" ); @@ -8610,23 +8556,104 @@ static ivas_error renderIsmToMc( { set_zero( currentPanGains, MAX_OUTPUT_CHANNELS ); -#ifdef IVAS_FLOAT_FIXED Word16 gains_fx[2]; ivas_ism_get_stereo_gains_fx( (Word16) ismInput->currentPos.azimuth, (Word16) ismInput->currentPos.elevation, &gains_fx[0], &gains_fx[1] ); currentPanGains[0] = (float) gains_fx[0] / 32768.f; currentPanGains[1] = (float) gains_fx[1] / 32768.f; -#else - ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, ¤tPanGains[0], ¤tPanGains[1] ); -#endif set_zero( ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); -#ifdef IVAS_FLOAT_FIXED ivas_ism_get_stereo_gains_fx( (Word16) ismInput->previousPos.azimuth, (Word16) ismInput->previousPos.elevation, &gains_fx[0], &gains_fx[1] ); ismInput->prev_pan_gains[0] = (float) gains_fx[0] / 32768.f; ismInput->prev_pan_gains[1] = (float) gains_fx[1] / 32768.f; + } + } + else + { + /* compute gains only if position changed */ + if ( position_changed ) + { + // TODO tmu review when #215 is resolved + /*float2fix to be removed*/ + Word32 azimuth_fx_tmp = (int16_t)floorf(ismInput->currentPos.azimuth + 0.5f); + azimuth_fx_tmp = azimuth_fx_tmp << 22; + Word32 elevation_fx_tmp = (int16_t)floorf(ismInput->currentPos.elevation + 0.5f); + elevation_fx_tmp = elevation_fx_tmp << 22; + if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + azimuth_fx_tmp, + elevation_fx_tmp, + currentPanGains_fx ) ) != IVAS_ERR_OK ) + { + return error; + } + /* fix2float to be removed */ + fixedToFloat_arrL(currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS); + } + + /* set previous gains if this is the first frame */ + if ( !ismInput->firstFrameRendered ) + { + // TODO tmu review when #215 is resolved + /*float2fix to be removed*/ + Word32 azimuth_fx_tmp = (int16_t)floorf(ismInput->previousPos.azimuth + 0.5f); + azimuth_fx_tmp = azimuth_fx_tmp << 22; + Word32 elevation_fx_tmp = (int16_t)floorf(ismInput->previousPos.elevation + 0.5f); + elevation_fx_tmp = elevation_fx_tmp << 22; + if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + azimuth_fx_tmp, + elevation_fx_tmp, + ismInput->prev_pan_gains_fx) ) != IVAS_ERR_OK ) + { + return error; + } + /* fix2float to be removed */ + fixedToFloat_arrL(ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS); + } + } + + /* Assume num channels in audio buffer to be 1. + * This should have been validated in IVAS_REND_FeedInputAudio() */ + renderBufferChannelLerp( ismInput->base.inputBuffer, 0, + position_changed ? currentPanGains : ismInput->prev_pan_gains, + position_changed ? ismInput->prev_pan_gains : NULL, + outAudio ); + + if ( position_changed ) + { + mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); + } + + pop_wmops(); + + return IVAS_ERR_OK; +} #else +static ivas_error renderIsmToMc( + input_ism *ismInput, + const IVAS_REND_AudioBuffer outAudio ) +{ + int8_t position_changed; + pan_vector currentPanGains; + ivas_error error; + + push_wmops( "renderIsmToMc" ); + + position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); + if ( *ismInput->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_STEREO ) + { + if ( ismInput->nonDiegeticPan ) + { + ismInput->prev_pan_gains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; + ismInput->prev_pan_gains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; + } + else + { + set_zero( currentPanGains, MAX_OUTPUT_CHANNELS ); + + ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, ¤tPanGains[0], ¤tPanGains[1] ); + + set_zero( ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); + ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &ismInput->prev_pan_gains[0], &ismInput->prev_pan_gains[1] ); -#endif } } else @@ -8674,7 +8701,7 @@ static ivas_error renderIsmToMc( return IVAS_ERR_OK; } - +#endif static ivas_error renderIsmToSba( input_ism *ismInput, -- GitLab From ff56c65d671ba1bce5fdc6cf1199b98c04726e72 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 9 May 2024 19:20:03 +0530 Subject: [PATCH 024/101] Fix for crash due to hrtf file reading --- lib_rend/ivas_reverb.c | 2 +- lib_util/hrtf_file_reader.c | 69 ++++++++++++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 6d4513085..be4a8c063 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -3841,7 +3841,7 @@ static ivas_error ivas_binaural_reverb_open_fx( /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ //hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); Word32 L_tmp_BufLength = L_shl( L_shr( Mpy_32_32( revTimes_fx[bin], 1258291200 /*150.0 in Q23*/ ), 23 ), 23 ); - L_tmp_BufLength = L_add( Mpy_32_32( 1556925644 /*1.45 in Q30*/, L_tmp_BufLength ), ONE_IN_Q22 ); + L_tmp_BufLength = L_add( Mpy_32_32( 1556925645 /*1.45 in Q30*/, L_tmp_BufLength ), ONE_IN_Q22 ); hReverb->loopBufLength[bin] = (Word16) L_shr( L_tmp_BufLength, 22 ); hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index f35783a9b..219a52c60 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1766,7 +1766,7 @@ ivas_error load_fastconv_HRTF_from_binary( * * *---------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static ivas_error create_parambin_HRTF_from_rawdata( HRTFS_PARAMBIN_HANDLE *hHRTF, /* i/o: Parametric binauralizer HRTF handle */ char *hrtf_data /* i : pointer to binary file */ @@ -1820,16 +1820,83 @@ static ivas_error create_parambin_HRTF_from_rawdata( memcpy( ( *hHRTF )->parametricReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + /*adding conversion as file reading is done in float*/ + floatToFixed_arrL( ( *hHRTF )->parametricReverberationTimes, ( *hHRTF )->parametricReverberationTimes_fx, Q31, CLDFB_NO_CHANNELS_MAX ); memcpy( ( *hHRTF )->parametricReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + /*adding conversion as file reading is done in float*/ + floatToFixed_arrL( ( *hHRTF )->parametricReverberationEneCorrections, ( *hHRTF )->parametricReverberationEneCorrections_fx, Q31, CLDFB_NO_CHANNELS_MAX ); memcpy( ( *hHRTF )->parametricEarlyPartEneCorrection, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); return IVAS_ERR_OK; } +#else +static ivas_error create_parambin_HRTF_from_rawdata( + HRTFS_PARAMBIN_HANDLE *hHRTF, /* i/o: Parametric binauralizer HRTF handle */ + char *hrtf_data /* i : pointer to binary file */ +) +{ + int16_t i, j; + char *hrtf_data_rptr; + uint32_t data_size_tmp; + + hrtf_data_rptr = hrtf_data; + /* HRTF_SH_CHANNELS */ + if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + /* HRTF_NUM_BINS */ + if ( HRTF_NUM_BINS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_NUM_BINS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + /* HRTF */ + data_size_tmp = HRTF_NUM_BINS * sizeof( float ); + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->hrtfShCoeffsRe[i][j], hrtf_data_rptr, data_size_tmp ); + hrtf_data_rptr += data_size_tmp; + } + } + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->hrtfShCoeffsIm[i][j], hrtf_data_rptr, data_size_tmp ); + hrtf_data_rptr += data_size_tmp; + } + } + + /* Reverb Parameters */ + if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + memcpy( ( *hHRTF )->parametricReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + + memcpy( ( *hHRTF )->parametricReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + + memcpy( ( *hHRTF )->parametricEarlyPartEneCorrection, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + + return IVAS_ERR_OK; +} +#endif /*---------------------------------------------------------------------* * load_parambin_HRTF_from_binary() -- GitLab From 18d64dd6cc02b3c83d723065197552a30be578d1 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 9 May 2024 22:00:57 +0530 Subject: [PATCH 025/101] Renderer functions conversion, cleanup and few MSAN error fixes [x] Conversions related to ivas_mcmasa_ana.c added [x] ivas dirac dec binaural functions converted, integrated and cleaned up. [x] ivas_param_mc_dec_render clean up [x] ivas_reflections.c file clean up [x] Few MSAN issue fixes. --- lib_com/ivas_dirac_com.c | 57 + lib_com/ivas_prot.h | 21 + lib_com/ivas_prot_fx.h | 6 + lib_com/ivas_qmetadata_com.c | 2 +- lib_com/ivas_spar_com.c | 11 + lib_com/ivas_tools.c | 16 + lib_com/options.h | 3 + lib_com/tools_fx.c | 2 + lib_dec/ivas_dirac_dec.c | 29 + lib_dec/ivas_init_dec.c | 38 +- lib_dec/ivas_ism_dec.c | 12 - lib_dec/ivas_jbm_dec.c | 169 + lib_dec/ivas_mc_param_dec.c | 1131 ++--- lib_dec/ivas_mdct_core_dec.c | 10 + lib_rend/ivas_dirac_dec_binaural_functions.c | 4503 +++++++++++------- lib_rend/ivas_mcmasa_ana.c | 1476 +++++- lib_rend/ivas_objectRenderer_mix.c | 3 +- lib_rend/ivas_objectRenderer_sources.c | 6 +- lib_rend/ivas_prot_rend.h | 10 + lib_rend/ivas_reflections.c | 373 +- lib_rend/ivas_rom_binauralRenderer.c | 2 +- lib_rend/ivas_rom_rend.c | 21 + lib_rend/ivas_rom_rend.h | 4 + lib_rend/ivas_stat_rend.h | 68 +- lib_rend/lib_rend.c | 82 + 25 files changed, 5562 insertions(+), 2493 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 180e27ddb..d3057e3e8 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -898,6 +898,63 @@ ivas_error ivas_dirac_sba_config( #ifdef IVAS_FLOAT_FIXED +void computeDirectionVectors_fixed( + Word32 *intensity_real_x, + Word32 *intensity_real_y, + Word32 *intensity_real_z, + const Word16 enc_param_start_band, + const Word16 num_frequency_bands, + Word32 *direction_vector_x,/*Q30*/ + Word32 *direction_vector_y,/*Q30*/ + Word32 *direction_vector_z,/*Q30*/ + Word16 i_e /*Exponent of all the intensity buffers*/) +{ + Word16 i; + Word32 intensityNorm; + Word16 intensityNorm_e; + Word32 temp1; + Word16 exp1; + Word16 norm_x, norm_y, norm_z; + Word32 scaled_x, scaled_y, scaled_z; + Word16 e_x, e_y, e_z; + for ( i = enc_param_start_band; i < enc_param_start_band + num_frequency_bands; ++i ) + { + norm_x = norm_l( *intensity_real_x ); + norm_y = norm_l( *intensity_real_y); + norm_z = norm_l( *intensity_real_z ); + scaled_x = L_shl( *intensity_real_x, norm_x ); + scaled_y = L_shl( *intensity_real_y, norm_y); + scaled_z = L_shl( *intensity_real_z, norm_z); + e_x = i_e - norm_x; + e_y = i_e - norm_y; + e_z = i_e - norm_z; + temp1 = BASOP_Util_Add_Mant32Exp( Mult_32_32( scaled_x, scaled_x ), 2*e_x, Mult_32_32( scaled_y, scaled_y ), 2*e_y, &exp1 ); + intensityNorm = BASOP_Util_Add_Mant32Exp( temp1, exp1, Mult_32_32( scaled_z, scaled_z ), 2 * e_z, &intensityNorm_e); + + IF ( LE_32(intensityNorm , EPSILON_FX) ) + { + intensityNorm = L_shl(1, intensityNorm_e); + *( direction_vector_x++ ) = ONE_IN_Q30; + *( direction_vector_y++ ) = 0; + *( direction_vector_z++ ) = 0; + intensity_real_x++; + intensity_real_y++; + intensity_real_z++; + } + ELSE + { + intensityNorm = ISqrt32( intensityNorm, &intensityNorm_e ); /*Q31-intensityNorm_e*/ + *( direction_vector_x++ ) = L_shl(Mult_32_32(scaled_x , intensityNorm),e_x+ intensityNorm_e-1);/*Q30*/ + intensity_real_x++; + *( direction_vector_y++ ) = L_shl(Mult_32_32( scaled_y, intensityNorm ), e_y+ intensityNorm_e-1);/*Q30*/ + intensity_real_y++; + *( direction_vector_z++ ) = L_shl(Mult_32_32(scaled_z, intensityNorm), e_z + intensityNorm_e-1);/*Q30*/ + intensity_real_z++; + } + } + + return; +} /*------------------------------------------------------------------------- * computeDirectionVectors() * diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 0444bac65..b1a94cf24 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4421,6 +4421,16 @@ void computeDiffuseness_mdft( float *diffuseness ); #ifdef IVAS_FLOAT_FIXED +void computeDirectionVectors_fixed( + Word32 *intensity_real_x, + Word32 *intensity_real_y, + Word32 *intensity_real_z, + const Word16 enc_param_start_band, + const Word16 num_frequency_bands, + Word32 *direction_vector_x,/*Q30*/ + Word32 *direction_vector_y,/*Q30*/ + Word32 *direction_vector_z,/*Q30*/ + Word16 i_e /*Exponent of all the intensity buffers*/); void computeDirectionVectors_fx( Word32 *intensity_real_x, Word32 *intensity_real_y, @@ -4677,6 +4687,17 @@ void ivas_param_mc_dec_digest_tc_fx( Word32 *transport_channels_f_fx[], Word16 transport_f_e ); +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_dec_render_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *output_f_fx[], /* o : rendered time signal */ + Word16 channel_active_fx[MAX_OUTPUT_CHANNELS] +); +#endif + void ivas_param_mc_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index cdd3f2c3f..c32713fb4 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1054,6 +1054,12 @@ void v_multc_acc_32_16( Word32 y[], /* o : Output vector that contains y + c*x */ const Word16 N /* i : Vector length */ ); +void v_multc_acc_32_32( + const Word32 x[], /* i : Input vector */ + const Word32 c, /* i : Constant */ + Word32 y[], /* o : Output vector that contains y + c*x */ + const Word16 N /* i : Vector length */ +); void ivas_mono_stereo_downmix_mcmasa_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index 538d74c71..12bc2f9e9 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -1219,7 +1219,7 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( Word32 L_tmp; Word16 e_tmp; L_tmp = L_add( Mpy_32_32( dv[0], dv[0] ), Mpy_32_32( dv[1], dv[1] ) ); /* 2 * dv_q - 31 */ - e_tmp = shl( sub( 31, dv_q ), 2 ); + e_tmp = shl( sub( 31, dv_q ), 1 ); L_tmp = Sqrt32( L_tmp, &e_tmp ); *el = L_mult0( BASOP_util_atan2( dv[2], L_tmp, 31 - dv_q - e_tmp ), 29335 ); /* Q22 */ *az = L_mult0( BASOP_util_atan2( dv[1], dv[0], 0 ), 29335 ); /* Q22 */ diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index d7ccff598..d9994bc39 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -3002,6 +3002,16 @@ void ivas_compute_spar_params_fx( Word16 q_tmp = hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_C_re_fx; IF( NE_16(ndm, 1 )) { +#ifdef MSAN_FIX + FOR( i = 0; i < num_ch - ndm; i++ ) + { + FOR( int j = 0; j < ndm - 1; j++ ) + { + hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr( hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub( q_tmp, 22 ) ); + move32(); + } + } +#else for (i = 0; i < IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS; i++) { for (int j = 0; j < IVAS_SPAR_MAX_DMX_CHS - 1; j++) @@ -3009,6 +3019,7 @@ void ivas_compute_spar_params_fx( hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j] = L_shr(hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].C_re_fx[i][j], sub(q_tmp, 22)); } } +#endif hSparMd->band_coeffs[b + i_ts * IVAS_MAX_NUM_BANDS].q_C_re_fx = Q22; } diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index ac837f747..9d5dd4419 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -2082,6 +2082,22 @@ void v_multc_acc_32_16( return; } +void v_multc_acc_32_32( + const Word32 x[], /* i : Input vector */ + const Word32 c, /* i : Constant */ + Word32 y[], /* o : Output vector that contains y + c*x */ + const Word16 N /* i : Vector length */ +) +{ + Word16 i; + + FOR( i = 0; i < N; i++ ) + { + y[i] = L_add( y[i], Mpy_32_32( x[i], c ) ); + } + + return; +} #endif /*---------------------------------------------------------------------* diff --git a/lib_com/options.h b/lib_com/options.h index 8b1da2222..677bbe613 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -102,6 +102,9 @@ #define NONBE_FIX_849_OMASA_BFI_CRASH /* VA: issue 849: fix OMASA 2TC and FEC crashes */ #define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Quaternion slerp changes*/ #define IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED +#define MSAN_FIX +#endif #define ISM_DISABLE #define FIX_TMP_714 #define BASOP_NOGLOB_TMP_715 diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 3e2376151..955338c2b 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -64,6 +64,8 @@ Word32 float_to_fix( float number, Word32 Q ) assert( Q >= 0 ); if (number == 1.0f && Q == Q31) return ONE_IN_Q31; + if(isnan(number)) + number = 0; assert( fabs( number ) < pow( 2, 31 - Q ) ); Word32 ret = (Word32) ( number * ( (UWord32) 1 << Q ) ); return ret; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 1d6922e89..cfe4ce0cc 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5411,6 +5411,17 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { +#ifdef MSAN_FIX + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + } +#else FOR( ch = 0; ch < hDirACRend->num_outputs_dir; ch++ ) { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) @@ -5423,6 +5434,7 @@ void ivas_dirac_dec_render_sf_fx( hSpatParamRendCom->num_freq_bands ); } } +#endif } hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = Q26; @@ -5767,6 +5779,20 @@ void ivas_dirac_dec_render_sf_fx( #ifdef IVAS_FLOAT_FIXED //////////////////////////////////////////////// FLOAT TO FIXED ///////////////////////////////////////////// +#ifdef MSAN_FIX + Word16 idx1, idx2, idx3; + for ( idx1 = 0; idx1 < hDirACRend->hOutSetup.nchan_out_woLFE; idx1++ ) + { + for ( idx2 = 0; idx2 < hSpatParamRendCom->subframe_nbslots[subframe_idx]; idx2++ ) + { + for ( idx3 = 0; idx3 < hSpatParamRendCom->num_freq_bands; idx3++ ) + { + Cldfb_RealBuffer_fx[idx1][idx2][idx3] = floatToFixed( Cldfb_RealBuffer[idx1][idx2][idx3], Q6 ); + Cldfb_ImagBuffer_fx[idx1][idx2][idx3] = floatToFixed( Cldfb_ImagBuffer[idx1][idx2][idx3], Q6 ); + } + } + } +#else for (int idx1 = 0; idx1 < MAX_OUTPUT_CHANNELS; idx1++) { for (int idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++) @@ -5779,15 +5805,18 @@ void ivas_dirac_dec_render_sf_fx( } } } +#endif Word32 output_buf_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { // Float to fixed +#ifndef MSAN_FIX for (i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) { floatToFixed_arrL(output_f[i], output_buf_fx[i], Q11, L_FRAME48k); } +#endif } else if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 9e5afa24b..5f244108e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -399,7 +399,6 @@ ivas_error ivas_dec_setup( // Cleanup changes for ivas_td_binaural_open: fixed to float IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { - st_ivas->hBinRendererTd->Gain = 1.0f; /*1.0f Q15*/ fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); @@ -433,17 +432,6 @@ ivas_error ivas_dec_setup( Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; } - set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); - set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->hrf_left_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - set_f( Src_p->hrf_right_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - Src_p->hrf_left_prev[0] = 1; - Src_p->hrf_right_prev[0] = 1; - Src_p->azim_prev = 0.0f; - Src_p->elev_prev = 0.0f; - Src_p->Gain = 1.0f; - Src_p->prevGain = 1.0f; TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); @@ -537,7 +525,6 @@ ivas_error ivas_dec_setup( // Cleanup changes for ivas_td_binaural_open: fixed to float IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { - st_ivas->hBinRendererTd->Gain = 1.0f; /*1.0f Q15*/ fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); @@ -571,17 +558,6 @@ ivas_error ivas_dec_setup( Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; } - set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); - set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->hrf_left_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - set_f( Src_p->hrf_right_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - Src_p->hrf_left_prev[0] = 1; - Src_p->hrf_right_prev[0] = 1; - Src_p->azim_prev = 0.0f; - Src_p->elev_prev = 0.0f; - Src_p->Gain = 1.0f; - Src_p->prevGain = 1.0f; TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); @@ -2256,7 +2232,6 @@ ivas_error ivas_init_decoder_fx( return error; } #if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float - st_ivas->hBinRendererTd->Gain = 1.0f; /*1.0f Q15*/ fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); @@ -2290,17 +2265,6 @@ ivas_error ivas_init_decoder_fx( Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; } - set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); - set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->hrf_left_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - set_f( Src_p->hrf_right_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - Src_p->hrf_left_prev[0] = 1; - Src_p->hrf_right_prev[0] = 1; - Src_p->azim_prev = 0.0f; - Src_p->elev_prev = 0.0f; - Src_p->Gain = 1.0f; - Src_p->prevGain = 1.0f; TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); @@ -2522,11 +2486,13 @@ ivas_error ivas_init_decoder_fx( IF( st_ivas->cldfbAnaDec[i] ) floatToFixed_arrL( st_ivas->cldfbAnaDec[i]->cldfb_state, st_ivas->cldfbAnaDec[i]->cldfb_state_fx, 11, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); } +#ifndef MSAN_FIX IF( st_ivas->hSpar ) { st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_factor_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, 16 ); floatToFixed_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q, 16 ); } +#endif IF( st_ivas->cldfbSynDec[0] ) { floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index d162c9366..22d7484c4 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -634,7 +634,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } #if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float - st_ivas->hBinRendererTd->Gain = 1.0f; /*1.0f Q15*/ fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); @@ -668,17 +667,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; } - set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); - set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->hrf_left_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - set_f( Src_p->hrf_right_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - Src_p->hrf_left_prev[0] = 1; - Src_p->hrf_right_prev[0] = 1; - Src_p->azim_prev = 0.0f; - Src_p->elev_prev = 0.0f; - Src_p->Gain = 1.0f; - Src_p->prevGain = 1.0f; TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 08bcdc2fe..7aa01f581 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -4615,7 +4615,11 @@ ivas_error ivas_jbm_dec_render( hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; +#ifdef MSAN_FIX + for ( i = 0; i < st_ivas->hTcBuffer->nchan_transport_internal; i++ ) +#else for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) +#endif { floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); } @@ -5464,7 +5468,172 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { +#ifdef IVAS_FLOAT_FIXED +#if 1//ftf changes + int16_t channel_active_fx[MAX_OUTPUT_CHANNELS]; + uint16_t nchan_out_init; + Word16 nchan_out_cov; + Word16 nchan_out_cldfb = 0; + + set_s(channel_active_fx, 0, MAX_CICP_CHANNELS ); + Word16 nchan_transport_tmp = st_ivas->nchan_transport; + output_Fs = st_ivas->hDecoderConfig->output_Fs; + Word16 nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + nchan_out_init = nchan_out_transport; + + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + { + nchan_out_cldfb = BINAURAL_CHANNELS; + set_s(channel_active_fx, 1, BINAURAL_CHANNELS); + nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + } + else if (st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB) + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else if (st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + nchan_out_cldfb = nchan_out_cov; + set_s(channel_active_fx, 1, nchan_out_cov); + } + else + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = nchan_out_transport; + set_s(channel_active_fx, 1, nchan_out_cov); + } + + FOR( i = 0; i < nchan_out_cldfb; ++i ) + { + floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, L_FRAME48k ); + } + + //ftf for ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx + FOR( i = 0; i < 16 * nchan_transport_tmp * st_ivas->hParamMC->num_freq_bands; i++) + { + st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[i] = floatToFixed(st_ivas->hParamMC->Cldfb_RealBuffer_tc[i], Q6); + st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[i] = floatToFixed(st_ivas->hParamMC->Cldfb_ImagBuffer_tc[i], Q6); + } + //ftf changes + if (st_ivas->hParamMC->max_band_decorr > 0) + { + //ftf for param_mc_protoSignalComputation_fx + FOR(Word16 x = 0; x < st_ivas->hParamMC->diff_proto_info->num_protos_diff; x++) + { + Word16 num_source_ch = st_ivas->hParamMC->diff_proto_info->num_source_chan_diff[x]; + move16(); + + floatToFixed_arrL(st_ivas->hParamMC->diff_proto_info->proto_fac[x], st_ivas->hParamMC->diff_proto_info->proto_fac_fx[x], Q30, num_source_ch); + } + + //ftf for ivas_dirac_dec_decorr_process_fx + Word16 tmp_e; + f2me_buf(st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer, st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_fx, &tmp_e, st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_len); + st_ivas->hParamMC->h_freq_domain_decorr_ap_state->q_decorr_buffer = 31 - tmp_e; + } + + FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) { + + + f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport * nchan_out_cov); + + IF(st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr) { + f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_out_cov * nchan_out_cov); + f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[param_band_idx], nchan_out_cov * nchan_out_cov); + } + } + + floatToFixed_arr16(st_ivas->hParamMC->h_output_synthesis_params.interpolator, st_ivas->hParamMC->h_output_synthesis_params.interpolator_fx, 15, DEFAULT_JBM_CLDFB_TIMESLOTS); + if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM)) + { + if (st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV) + { + Word16 Q_hoa_encoder = 31; + floatToFixed_arrL(st_ivas->hParamMC->hoa_encoder, st_ivas->hParamMC->hoa_encoder_fx, Q_hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS); + } + } + //ftf for ivas_binRenderer_fx + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + { + if (st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hBinRenderer->rotInCldfb) + { + if (st_ivas->hBinRenderer->hInputSetup->is_loudspeaker_setup == 0) + { + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i][j] = (Word32)floatToFixed(st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][i][j], 30); + } + } + } + } + } + /* CLDFB synthesis */ + for (int ch = 0; ch < nchan_out_cldfb; ch++) + { + if (channel_active_fx[ch]) + { + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) + { + st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbSynDec[ch]->cldfb_state[i] * (1LL << (5))); + } + } + } + + if (st_ivas->hParamMC->slots_rendered == st_ivas->hParamMC->num_slots) + { + FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { + f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport_tmp * nchan_out_cov); + IF(st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr) { + f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_transport_tmp * nchan_out_cov); + } + } + } +#endif + ivas_param_mc_dec_render_fx(st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, channel_active_fx); +#if 1//ftf changes + if (st_ivas->hParamMC->max_band_decorr > 0) + { + // ftf for param_mc_protoSignalComputation_fx + fixedToFloat_arrL(st_ivas->hParamMC->proto_frame_f_fx, st_ivas->hParamMC->proto_frame_f, Q11, 2 * st_ivas->hParamMC->diff_proto_info->num_protos_diff * st_ivas->hParamMC->num_freq_bands); + + // ftf for ivas_dirac_dec_decorr_process_fx + fixedToFloat_arrL32(st_ivas->hParamMC->proto_frame_dec_f_fx, st_ivas->hParamMC->proto_frame_dec_f, Q11, nchan_out_cov * 2 * st_ivas->hParamMC->num_freq_bands); + } + for (int ch = 0; ch < nchan_out_cldfb; ch++) + { + if (channel_active_fx[ch]) { + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) + { + st_ivas->cldfbSynDec[ch]->cldfb_state[i] = ((float)st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] / (1LL << (5))); + } + } + fixedToFloat_arrL(p_output_fx[ch], p_output[ch], Q11, *nSamplesRendered); + } + if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) + { + FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + fixedToFloat_arrL(p_output_fx[i], p_output[i], Q11, *nSamplesRendered); + } + } + if (st_ivas->hParamMC->slots_rendered == st_ivas->hParamMC->num_slots) + { + FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { + IF(st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr) { + mvr2r(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], nchan_transport_tmp * nchan_out_cov); + } + mvr2r(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[param_band_idx], nchan_transport_tmp * nchan_out_cov); + } + } +#endif + +#else ivas_param_mc_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); +#endif } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 313c478d5..f38bbff23 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -3361,6 +3361,359 @@ void ivas_param_mc_dec_digest_tc( * Parametric MC decoding process *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_dec_render_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + Word32 *output_f_fx[], /* o : rendered time signal */ + Word16 channel_active_fx[MAX_OUTPUT_CHANNELS] +) +{ + PARAM_MC_DEC_HANDLE hParamMC; + Word16 i, ch; + Word16 subframe_idx; + Word16 slot_idx, slot_idx_start, slot_idx_start_cldfb_synth, first_sf, last_sf, slots_to_render; + Word16 nchan_transport, nchan_out_transport, nchan_out_cldfb; + Word16 nchan_out_cov; + + /*CLDFB*/ + Word32 Cldfb_RealBuffer_fx[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_fx[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 *p_output_f_fx[MAX_OUTPUT_CHANNELS]; + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_output_f_fx[i] = output_f_fx[i]; + } + /*Decorrelator*/ + Word32 onset_filter_fx[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; + + Word16 tmp_q = Q6; + /* format converter */ + Word16 channel_active[MAX_OUTPUT_CHANNELS]; + UWord16 nband_synth, nbands_to_zero; + UWord16 nchan_out_init; + UWord32 output_Fs; + + hParamMC = st_ivas->hParamMC; + assert( hParamMC ); + + push_wmops( "param_mc_dec_render" ); + + set_s( channel_active, 0, MAX_CICP_CHANNELS ); + nchan_transport = st_ivas->nchan_transport; + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + nchan_out_init = nchan_out_transport; + output_Fs = st_ivas->hDecoderConfig->output_Fs; + IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV )|| EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) + { + nchan_out_cldfb = BINAURAL_CHANNELS; + set_s( channel_active, 1, nchan_out_cldfb ); + IF ( st_ivas->hCombinedOrientationData ) + { + nchan_out_init = MAX_INTERN_CHANNELS; + } + nchan_out_cov = add(st_ivas->hTransSetup.nchan_out_woLFE , st_ivas->hTransSetup.num_lfe); + } + ELSE IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_CLDFB )) + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = add(st_ivas->hOutSetup.nchan_out_woLFE , st_ivas->hOutSetup.num_lfe); + } + ELSE IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_COV )|| EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_MONO_STEREO) ) + { + nchan_out_cov = add(st_ivas->hOutSetup.nchan_out_woLFE , st_ivas->hOutSetup.num_lfe); + nchan_out_cldfb = nchan_out_cov; + set_s( channel_active, 1, nchan_out_cov ); + } + ELSE + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = nchan_out_transport; + set_s( channel_active, 1, nchan_out_cov ); + } + + /* set everything to zero that will not be decoded */ + nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; + nbands_to_zero = sub(hParamMC->num_freq_bands , nband_synth); + FOR ( ch = 0; ch < nchan_out_init; ch++ ) + { + FOR ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) + { + set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); + set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); + } + } + + /* loop FOR synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( sub(hParamMC->num_slots , hParamMC->slots_rendered), nSamplesAsked / NS2SA( output_Fs, CLDFB_SLOT_NS ) ); + *nSamplesRendered = slots_to_render * NS2SA( output_Fs, CLDFB_SLOT_NS ); + Word16 j, k; + first_sf = hParamMC->subframes_rendered; + last_sf = first_sf; + WHILE ( GT_16(slots_to_render , 0 )) + { + slots_to_render = sub(slots_to_render, hParamMC->subframe_nbslots[last_sf]); + last_sf = add(last_sf, 1); + } + IF ( EQ_16(st_ivas->renderer_type , RENDERER_SBA_LINEAR_ENC )) + { + FOR ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + slots_to_render = add(slots_to_render, hParamMC->subframe_nbslots[subframe_idx]); + } + } + slot_idx_start = hParamMC->slots_rendered; + slot_idx_start_cldfb_synth = 0; + + FOR ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++, hParamMC->slots_rendered++ ) + { + IF ( GT_16(hParamMC->max_band_decorr , 0 )) + { + /*-----------------------------------------------------------------* + * protoype signal computation + *-----------------------------------------------------------------*/ + param_mc_protoSignalComputation_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + hParamMC->proto_frame_f_fx, hParamMC->diff_proto_info, + hParamMC->num_freq_bands ); + Scale_sig32(hParamMC->proto_frame_f_fx, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands, Q11 - Q5); + /*-----------------------------------------------------------------* + * frequency domain decorrelation + *-----------------------------------------------------------------*/ + /* decorrelate prototype frame */ + + ivas_dirac_dec_decorr_process_fx( hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + nchan_transport, + hParamMC->proto_frame_f_fx, + 11, + hParamMC->diff_proto_info->num_protos_diff, + hParamMC->diff_proto_info->proto_index_diff, + hParamMC->proto_frame_dec_f_fx, // output + &hParamMC->exp_proto_frame_dec_f, + onset_filter_fx, + hParamMC->h_freq_domain_decorr_ap_params, + hParamMC->h_freq_domain_decorr_ap_state ); + + /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ + /* memory FOR the decorrelated signal */ + ivas_param_mc_dec_copy_diffuse_proto( hParamMC, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nchan_out_cov, slot_idx ); + + FOR( k = 0; k < nchan_out_cov; k++ ) + { + FOR( int l = 0; l < hParamMC->h_output_synthesis_params.max_band_decorr; l++ ) + { + Cldfb_RealBuffer_fx[k][slot_idx][l] = L_shl( Cldfb_RealBuffer_fx[k][slot_idx][l], 6 - ( 31 - hParamMC->exp_proto_frame_dec_f ) ); + Cldfb_ImagBuffer_fx[k][slot_idx][l] = L_shl( Cldfb_ImagBuffer_fx[k][slot_idx][l], 6 - ( 31 - hParamMC->exp_proto_frame_dec_f ) ); + } + } + } + + /*-----------------------------------------------------------------* + * output synthesis + *-----------------------------------------------------------------*/ + ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( + &hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, slot_idx, slot_idx + slot_idx_start, + nchan_transport, nchan_out_cov, hParamMC ); + + IF ( ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV ) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) + { + IF ( st_ivas->hCombinedOrientationData && EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) ) + { + Word16 Q_Cldfb_ImagBuffer, Q_Cldfb_RealBuffer; + Q_Cldfb_ImagBuffer = sub(Q6 , 5); /*max value =MAX_INTERN_CHANNELS(=16)*Cldfb_ImagBuffer_fx*/ + Q_Cldfb_RealBuffer = sub(Q6 , 5); + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + Scale_sig32( Cldfb_RealBuffer_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub(Q_Cldfb_ImagBuffer , Q6 )); + Scale_sig32( Cldfb_ImagBuffer_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub(Q_Cldfb_RealBuffer , Q6 )); + } + } + ivas_param_mc_mc2sba_cldfb_fx( st_ivas->hTransSetup, hParamMC->hoa_encoder_fx, slot_idx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nband_synth, GAIN_LFE_FX ); + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + Scale_sig32( Cldfb_RealBuffer_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub(Q6 , Q_Cldfb_ImagBuffer) ); + Scale_sig32( Cldfb_ImagBuffer_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub(Q6 , Q_Cldfb_RealBuffer) ); + } + } + } + ELSE + { + /* remove LFE */ + UWord16 idx_out; + UWord16 idx_lfe; + IVAS_OUTPUT_SETUP hLsSetup; + + hLsSetup = st_ivas->hTransSetup; + /* If LFE should be rendered, add it to other channels before removing */ + IF ( st_ivas->hBinRenderer->render_lfe ) + { + Word16 tmp_exp = 0; + Word16 tmp = BASOP_Util_Divide1616_Scale( GAIN_LFE_FX, hLsSetup.nchan_out_woLFE, &tmp_exp ); + tmp_exp = tmp_exp + ( 1 - 15 ); + FOR ( idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++ ) + { + /* Copy just the first band of LFE*/ + v_multc_fixed_16( Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], tmp, Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + v_multc_fixed_16( Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], tmp, Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + + Scale_sig32( Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1, tmp_exp ); + Scale_sig32( Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1, tmp_exp ); + FOR ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) + { + IF ( hLsSetup.index_lfe[idx_lfe] != ch ) + { + v_add_fixed( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer_fx[ch][slot_idx], 1, 0 ); + v_add_fixed( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], 1, 0 ); + } + } + } + } + + idx_out = 0; + idx_lfe = 0; + + FOR ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) + { + IF ( (GT_16( hLsSetup.num_lfe , 0 )) && ( EQ_16(hLsSetup.index_lfe[idx_lfe] , ch )) ) + { + IF ( LT_16(idx_lfe , ( sub(hLsSetup.num_lfe , 1) )) ) + { + idx_lfe = add(idx_lfe, 1); + } + } + ELSE IF ( NE_16(ch , idx_out) ) + { + Copy32( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer_fx[idx_out][slot_idx], nband_synth ); + Copy32( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[idx_out][slot_idx], nband_synth ); + idx_out = add(idx_out, 1); + } + ELSE + { + idx_out = add(idx_out, 1); + } + } + } + } + } + + IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV ) || EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) + { + Word16 input_q = 6; + /* Implement binaural rendering */ + ivas_binRenderer_fx( st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + hParamMC->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, + Cldfb_RealBuffer_fx, + Cldfb_ImagBuffer_fx, &input_q ); + + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + FOR ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + { + Cldfb_RealBuffer_fx[i][j][k] = L_shl( Cldfb_RealBuffer_fx[i][j][k], sub(Q6 , input_q) ); + Cldfb_ImagBuffer_fx[i][j][k] = L_shl( Cldfb_ImagBuffer_fx[i][j][k], sub(Q6 , input_q) ); + } + } + } + + FOR ( int idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) + { + FOR ( int idx2 = 0; idx2 < hParamMC->subframe_nbslots[subframe_idx]; idx2++ ) + { + Scale_sig32( Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, sub(Q6 , input_q )); + Scale_sig32( Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, sub(Q6 , input_q )); + } + } + /* update combined orientation access index */ + ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); + } + ELSE IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_CLDFB )) + { + /* format conversion*/ + ivas_lssetupconversion_process_param_mc_fx( st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, channel_active ); + } + + + /* CLDFB synthesis */ + FOR ( ch = 0; ch < nchan_out_cldfb; ch++ ) + { + Word32 *RealBuffer_fx[16]; + Word32 *ImagBuffer_fx[16]; + + IF ( channel_active[ch] ) + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands FOR 48kHz */ + FOR ( i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++ ) + { + IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV )|| EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) + { + RealBuffer_fx[i] = Cldfb_RealBuffer_Binaural_fx[ch][i]; + ImagBuffer_fx[i] = Cldfb_ImagBuffer_Binaural_fx[ch][i]; + } + ELSE + { + RealBuffer_fx[i] = Cldfb_RealBuffer_fx[ch][i]; + ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[ch][i]; + } + } + + Word16 len = slot_idx_start_cldfb_synth * hParamMC->num_freq_bands + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]; + scale_sig32( output_f_fx[ch], len, 5 - 11 ); + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + + scale_sig32( output_f_fx[ch], len, 11 - 5 ); + } + ELSE + { + set32_fx( &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), 0, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); + } + } + slot_idx_start = add(slot_idx_start, hParamMC->subframe_nbslots[subframe_idx]); + slot_idx_start_cldfb_synth = add(slot_idx_start_cldfb_synth, hParamMC->subframe_nbslots[subframe_idx]); + } + IF ( EQ_16(st_ivas->renderer_type , RENDERER_SBA_LINEAR_ENC )) + { + ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_f_fx, p_output_f_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); + } + + /* update */ + + IF ( EQ_16(hParamMC->slots_rendered , hParamMC->num_slots) ) + { + hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; + param_mc_update_mixing_matrices_fx( hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_transport, nchan_out_cov ); + } + + + hParamMC->subframes_rendered = last_sf; + *nSamplesAvailableNext = ( hParamMC->num_slots - hParamMC->slots_rendered ) * NS2SA( output_Fs, CLDFB_SLOT_NS ); + + for (int i = 0; i < MAX_OUTPUT_CHANNELS; i++) { + channel_active_fx[i] = channel_active[i]; + } + pop_wmops(); + + return; +} +#endif + void ivas_param_mc_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -3376,8 +3729,7 @@ void ivas_param_mc_dec_render( int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; int16_t nchan_out_cov; /*CLDFB*/ - float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + #ifdef IVAS_FLOAT_FIXED Word32 Cldfb_RealBuffer_fx[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_fx[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; @@ -3385,19 +3737,25 @@ void ivas_param_mc_dec_render( Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 output_f_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 *p_output_f_fx[MAX_OUTPUT_CHANNELS]; - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++) { + for (i = 0; i < MAX_OUTPUT_CHANNELS; i++) { p_output_f_fx[i] = output_f_fx[i]; } - #endif + float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + for ( i = 0; i < MAX_INTERN_CHANNELS; i++) { + for (int j = 0; j < PARAM_MC_MAX_NSLOTS_IN_SUBFRAME; j++) { + for (int k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) { + Cldfb_RealBuffer[i][j][k] = 0; + Cldfb_ImagBuffer[i][j][k] = 0; + + } + } + } /*Decorrelator*/ float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; - -#ifdef IVAS_FLOAT_FIXED - Word32 onset_filter_fx[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; -#endif /* format converter */ int16_t channel_active[MAX_OUTPUT_CHANNELS]; uint16_t nband_synth, nbands_to_zero; @@ -3405,91 +3763,93 @@ void ivas_param_mc_dec_render( uint32_t output_Fs; hParamMC = st_ivas->hParamMC; - assert( hParamMC ); + assert(hParamMC); - push_wmops( "param_mc_dec_render" ); + push_wmops("param_mc_dec_render"); - set_s( channel_active, 0, MAX_CICP_CHANNELS ); + set_s(channel_active, 0, MAX_CICP_CHANNELS); nchan_transport = st_ivas->nchan_transport; nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; nchan_out_init = nchan_out_transport; output_Fs = st_ivas->hDecoderConfig->output_Fs; - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { nchan_out_cldfb = BINAURAL_CHANNELS; - set_s( channel_active, 1, nchan_out_cldfb ); - if ( st_ivas->hCombinedOrientationData ) + set_s(channel_active, 1, nchan_out_cldfb); + if (st_ivas->hCombinedOrientationData) { nchan_out_init = MAX_INTERN_CHANNELS; } nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) + else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB) { nchan_out_cov = nchan_out_transport; nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO) { nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; nchan_out_cldfb = nchan_out_cov; - set_s( channel_active, 1, nchan_out_cov ); + set_s(channel_active, 1, nchan_out_cov); } else { nchan_out_cov = nchan_out_transport; nchan_out_cldfb = nchan_out_transport; - set_s( channel_active, 1, nchan_out_cov ); + set_s(channel_active, 1, nchan_out_cov); } /* set everything to zero that will not be decoded */ nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; nbands_to_zero = hParamMC->num_freq_bands - nband_synth; - for ( ch = 0; ch < nchan_out_init; ch++ ) + for (ch = 0; ch < nchan_out_init; ch++) { - for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) + for (slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++) { - set_zero( &( Cldfb_RealBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); - set_zero( &( Cldfb_ImagBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); + set_zero(&(Cldfb_RealBuffer[ch][slot_idx][nband_synth]), nbands_to_zero); + set_zero(&(Cldfb_ImagBuffer[ch][slot_idx][nband_synth]), nbands_to_zero); #ifdef IVAS_FLOAT_FIXED - set32_fx(&(Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth]), 0,nbands_to_zero); - set32_fx(&(Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth]), 0,nbands_to_zero); + set32_fx(&(Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth]), 0, nbands_to_zero); + set32_fx(&(Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth]), 0, nbands_to_zero); #endif } } /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min( hParamMC->num_slots - hParamMC->slots_rendered, nSamplesAsked / NS2SA( output_Fs, CLDFB_SLOT_NS ) ); - *nSamplesRendered = slots_to_render * NS2SA( output_Fs, CLDFB_SLOT_NS ); + slots_to_render = min(hParamMC->num_slots - hParamMC->slots_rendered, nSamplesAsked / NS2SA(output_Fs, CLDFB_SLOT_NS)); + *nSamplesRendered = slots_to_render * NS2SA(output_Fs, CLDFB_SLOT_NS); first_sf = hParamMC->subframes_rendered; last_sf = first_sf; - while ( slots_to_render > 0 ) + while (slots_to_render > 0) { slots_to_render -= hParamMC->subframe_nbslots[last_sf]; last_sf++; } - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) { - for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) { slots_to_render += hParamMC->subframe_nbslots[subframe_idx]; } } slot_idx_start = hParamMC->slots_rendered; slot_idx_start_cldfb_synth = 0; - for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) { Word16 len = slot_idx_start_cldfb_synth * hParamMC->num_freq_bands + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]; - for ( i = 0; i < nchan_out_cldfb; i++) +#ifdef IVAS_FLOAT_FIXED + for (i = 0; i < nchan_out_cldfb; i++) { floatToFixed_arrL(output_f[i], output_f_fx[i], Q11, len); } +#endif - for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++, hParamMC->slots_rendered++ ) + for (slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++, hParamMC->slots_rendered++) { - if ( hParamMC->max_band_decorr > 0 ) + if (hParamMC->max_band_decorr > 0) { /*-----------------------------------------------------------------* * protoype signal computation @@ -3497,76 +3857,54 @@ void ivas_param_mc_dec_render( #ifdef IVAS_FLOAT_FIXED - floatToFixed_arrL(hParamMC->Cldfb_RealBuffer_tc, hParamMC->Cldfb_RealBuffer_tc_fx, Q12, hParamMC->sz); + floatToFixed_arrL(hParamMC->Cldfb_RealBuffer_tc, hParamMC->Cldfb_RealBuffer_tc_fx, Q12, hParamMC->sz); - floatToFixed_arrL(hParamMC->Cldfb_ImagBuffer_tc, hParamMC->Cldfb_ImagBuffer_tc_fx, Q12, hParamMC->sz); + floatToFixed_arrL(hParamMC->Cldfb_ImagBuffer_tc, hParamMC->Cldfb_ImagBuffer_tc_fx, Q12, hParamMC->sz); - FOR(Word16 x = 0; x < hParamMC->diff_proto_info->num_protos_diff; x++) - { - Word16 num_source_ch = hParamMC->diff_proto_info->num_source_chan_diff[x]; - move16(); + FOR(Word16 x = 0; x < hParamMC->diff_proto_info->num_protos_diff; x++) + { + Word16 num_source_ch = hParamMC->diff_proto_info->num_source_chan_diff[x]; + move16(); - floatToFixed_arrL(hParamMC->diff_proto_info->proto_fac[x], hParamMC->diff_proto_info->proto_fac_fx[x], Q30, num_source_ch); - } + floatToFixed_arrL(hParamMC->diff_proto_info->proto_fac[x], hParamMC->diff_proto_info->proto_fac_fx[x], Q30, num_source_ch); + } - param_mc_protoSignalComputation_fx(&hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - hParamMC->proto_frame_f_fx, hParamMC->diff_proto_info, - hParamMC->num_freq_bands); + param_mc_protoSignalComputation_fx(&hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + hParamMC->proto_frame_f_fx, hParamMC->diff_proto_info, + hParamMC->num_freq_bands); - fixedToFloat_arrL(hParamMC->proto_frame_f_fx, hParamMC->proto_frame_f, Q11, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands); + fixedToFloat_arrL(hParamMC->proto_frame_f_fx, hParamMC->proto_frame_f, Q11, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands); #else - param_mc_protoSignalComputation( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - hParamMC->proto_frame_f, hParamMC->diff_proto_info, - hParamMC->num_freq_bands ); + param_mc_protoSignalComputation(&hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + hParamMC->proto_frame_f, hParamMC->diff_proto_info, + hParamMC->num_freq_bands); #endif /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ - /* decorrelate prototype frame */ -#ifdef IVAS_FLOAT_FIXED - Word16 tmp_e; - f2me_buf(hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer, hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_fx, &tmp_e, hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_len ); - hParamMC->h_freq_domain_decorr_ap_state->q_decorr_buffer = 31 - tmp_e; - ivas_dirac_dec_decorr_process_fx( hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - nchan_transport, - hParamMC->proto_frame_f_fx, - 11, - hParamMC->diff_proto_info->num_protos_diff, - hParamMC->diff_proto_info->proto_index_diff, - hParamMC->proto_frame_dec_f_fx,//output - &hParamMC->exp_proto_frame_dec_f, - onset_filter_fx, - hParamMC->h_freq_domain_decorr_ap_params, - hParamMC->h_freq_domain_decorr_ap_state ); - fixedToFloat_arrL32(onset_filter_fx, onset_filter, 31, MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX); - fixedToFloat_arrL32(hParamMC->proto_frame_dec_f_fx, hParamMC->proto_frame_dec_f, 11, nchan_out_cov * 2 * hParamMC->num_freq_bands); -#else - ivas_dirac_dec_decorr_process( hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - nchan_transport, - hParamMC->proto_frame_f, - hParamMC->diff_proto_info->num_protos_diff, - hParamMC->diff_proto_info->proto_index_diff, - hParamMC->proto_frame_dec_f,//output - onset_filter, - hParamMC->h_freq_domain_decorr_ap_params, - hParamMC->h_freq_domain_decorr_ap_state ); -#endif + /* decorrelate prototype frame */ + ivas_dirac_dec_decorr_process(hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + nchan_transport, + hParamMC->proto_frame_f, + hParamMC->diff_proto_info->num_protos_diff, + hParamMC->diff_proto_info->proto_index_diff, + hParamMC->proto_frame_dec_f,//output + onset_filter, + hParamMC->h_freq_domain_decorr_ap_params, + hParamMC->h_freq_domain_decorr_ap_state); /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ /* memory for the decorrelated signal */ #ifdef IVAS_FLOAT_FIXED - //f2me_buf(hParamMC->proto_frame_dec_f, hParamMC->proto_frame_dec_f_fx, &hParamMC->exp_proto_frame_dec_f, nchan_out_cov * 2 * hParamMC->num_freq_bands); + f2me_buf(hParamMC->proto_frame_dec_f, hParamMC->proto_frame_dec_f_fx, &hParamMC->exp_proto_frame_dec_f, nchan_out_cov * 2 * hParamMC->num_freq_bands); ivas_param_mc_dec_copy_diffuse_proto(hParamMC, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nchan_out_cov, slot_idx); FOR(int k = 0; k < nchan_out_cov; k++) { @@ -3575,9 +3913,9 @@ void ivas_param_mc_dec_render( Cldfb_RealBuffer[k][slot_idx][l] = me2f(Cldfb_RealBuffer_fx[k][slot_idx][l], hParamMC->exp_proto_frame_dec_f); Cldfb_ImagBuffer[k][slot_idx][l] = me2f(Cldfb_ImagBuffer_fx[k][slot_idx][l], hParamMC->exp_proto_frame_dec_f); } - } + } #else - ivas_param_mc_dec_copy_diffuse_proto( hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx ); + ivas_param_mc_dec_copy_diffuse_proto(hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx); #endif } @@ -3585,94 +3923,36 @@ void ivas_param_mc_dec_render( * output synthesis *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - Word16 j, k; + ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot(&hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + Cldfb_RealBuffer, Cldfb_ImagBuffer, + hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, + nchan_transport, nchan_out_cov, hParamMC); - FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - FOR ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) - { - Cldfb_RealBuffer_fx[i][j][k] = (Word32) (floatToFixed( Cldfb_RealBuffer[i][j][k], 6 ) ); - Cldfb_ImagBuffer_fx[i][j][k] = (Word32) (floatToFixed(Cldfb_ImagBuffer[i][j][k], 6 ) ); - } - } - } - - FOR ( i = 0; i < 16 * nchan_transport * hParamMC->num_freq_bands; i++) - { - st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[i] = - floatToFixed(st_ivas->hParamMC->Cldfb_RealBuffer_tc[i], 6); - st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[i] = - floatToFixed(st_ivas->hParamMC->Cldfb_ImagBuffer_tc[i], 6); - } - - FOR(Word16 param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++) { - - - f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport * nchan_out_cov); - - IF(hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr) { - f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_out_cov * nchan_out_cov); - - f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[param_band_idx], nchan_out_cov * nchan_out_cov); - } - } - - floatToFixed_arr16(hParamMC->h_output_synthesis_params.interpolator, hParamMC->h_output_synthesis_params.interpolator_fx, 15, DEFAULT_JBM_CLDFB_TIMESLOTS); - - - ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( - &hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, slot_idx, slot_idx + slot_idx_start, - nchan_transport, nchan_out_cov, hParamMC ); - - - FOR (i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - FOR (j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++) - { - FOR (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) - { - Cldfb_RealBuffer[i][j][k] = ((float)Cldfb_RealBuffer_fx[i][j][k] / ( 1 << 6)); - Cldfb_ImagBuffer[i][j][k] = ((float)Cldfb_ImagBuffer_fx[i][j][k] / ( 1 << 6)); - } - } - } - -#else - ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - Cldfb_RealBuffer, Cldfb_ImagBuffer, - hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, - nchan_transport, nchan_out_cov, hParamMC ); -#endif - - if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) + if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM)) { if ( - st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV) { #ifdef IVAS_FLOAT_FIXED #if 1 Word16 Q_hoa_encoder = 31; - floatToFixed_arrL(hParamMC->hoa_encoder, hParamMC->hoa_encoder_fx, Q_hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); + floatToFixed_arrL(hParamMC->hoa_encoder, hParamMC->hoa_encoder_fx, Q_hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS); Word16 Q_Cldfb_ImagBuffer, Q_Cldfb_RealBuffer; - Q_Cldfb_ImagBuffer = Q_factor_arrL( &Cldfb_ImagBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ) - 5;/*max value =MAX_INTERN_CHANNELS(=16)*Cldfb_ImagBuffer_fx*/ - Q_Cldfb_RealBuffer = Q_factor_arrL( &Cldfb_RealBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ) - 5; - floatToFixed_arrL( &Cldfb_ImagBuffer[0][0][0], &Cldfb_ImagBuffer_fx[0][0][0], Q_Cldfb_ImagBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); - floatToFixed_arrL( &Cldfb_RealBuffer[0][0][0], &Cldfb_RealBuffer_fx[0][0][0], Q_Cldfb_RealBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); + Q_Cldfb_ImagBuffer = Q_factor_arrL(&Cldfb_ImagBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX) - 5;/*max value =MAX_INTERN_CHANNELS(=16)*Cldfb_ImagBuffer_fx*/ + Q_Cldfb_RealBuffer = Q_factor_arrL(&Cldfb_RealBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX) - 5; + floatToFixed_arrL(&Cldfb_ImagBuffer[0][0][0], &Cldfb_ImagBuffer_fx[0][0][0], Q_Cldfb_ImagBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); + floatToFixed_arrL(&Cldfb_RealBuffer[0][0][0], &Cldfb_RealBuffer_fx[0][0][0], Q_Cldfb_RealBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); #endif - ivas_param_mc_mc2sba_cldfb_fx( st_ivas->hTransSetup, hParamMC->hoa_encoder_fx, slot_idx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nband_synth, GAIN_LFE_FX ); + ivas_param_mc_mc2sba_cldfb_fx(st_ivas->hTransSetup, hParamMC->hoa_encoder_fx, slot_idx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nband_synth, GAIN_LFE_FX); #if 1 - fixedToFloat_arrL( &Cldfb_ImagBuffer_fx[0][0][0], &Cldfb_ImagBuffer[0][0][0], Q_Cldfb_ImagBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); - fixedToFloat_arrL( &Cldfb_RealBuffer_fx[0][0][0], &Cldfb_RealBuffer[0][0][0], Q_Cldfb_RealBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); + fixedToFloat_arrL(&Cldfb_ImagBuffer_fx[0][0][0], &Cldfb_ImagBuffer[0][0][0], Q_Cldfb_ImagBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); + fixedToFloat_arrL(&Cldfb_RealBuffer_fx[0][0][0], &Cldfb_RealBuffer[0][0][0], Q_Cldfb_RealBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); #endif // IVAS_FLOAT_FIXED #else - ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); + ivas_param_mc_mc2sba_cldfb(st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE); #endif // IVAS_FLOAT_FIXED } @@ -3684,43 +3964,41 @@ void ivas_param_mc_dec_render( IVAS_OUTPUT_SETUP hLsSetup; hLsSetup = st_ivas->hTransSetup; - /* If LFE should be rendered, add it to other channels before removing */ - if ( st_ivas->hBinRenderer->render_lfe ) + if (st_ivas->hBinRenderer->render_lfe) { - for ( idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++ ) + for (idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++) { /* Copy just the first band of LFE*/ - v_multc( Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); - v_multc( Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + v_multc(Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], (GAIN_LFE / hLsSetup.nchan_out_woLFE), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1); + v_multc(Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], (GAIN_LFE / hLsSetup.nchan_out_woLFE), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1); - for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) + for (ch = 0; ch < (hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe); ch++) { - if ( hLsSetup.index_lfe[idx_lfe] != ch ) + if (hLsSetup.index_lfe[idx_lfe] != ch) { - v_add( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1 ); - v_add( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1 ); + v_add(Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1); + v_add(Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1); } } } } - idx_out = 0; idx_lfe = 0; - for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) + for (ch = 0; ch < (hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe); ch++) { - if ( ( hLsSetup.num_lfe > 0 ) && ( hLsSetup.index_lfe[idx_lfe] == ch ) ) + if ((hLsSetup.num_lfe > 0) && (hLsSetup.index_lfe[idx_lfe] == ch)) { - if ( idx_lfe < ( hLsSetup.num_lfe - 1 ) ) + if (idx_lfe < (hLsSetup.num_lfe - 1)) { idx_lfe++; } } - else if ( ch != idx_out ) + else if (ch != idx_out) { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth ); + mvr2r(Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth); + mvr2r(Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth); idx_out++; } else @@ -3732,31 +4010,31 @@ void ivas_param_mc_dec_render( } } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { #ifdef IVAS_FLOAT_FIXED Word16 j, k; - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + for (i = 0; i < MAX_OUTPUT_CHANNELS; i++) { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + for (j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++) { - for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + for (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) { - Cldfb_RealBuffer_fx[i][j][k] = (Word32) floatToFixed( Cldfb_RealBuffer[i][j][k], Q6 ); - Cldfb_ImagBuffer_fx[i][j][k] = (Word32) floatToFixed( Cldfb_ImagBuffer[i][j][k], Q6 ); + Cldfb_RealBuffer_fx[i][j][k] = (Word32)floatToFixed(Cldfb_RealBuffer[i][j][k], Q6); + Cldfb_ImagBuffer_fx[i][j][k] = (Word32)floatToFixed(Cldfb_ImagBuffer[i][j][k], Q6); } } } - if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hBinRenderer->rotInCldfb ) + if (st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hBinRenderer->rotInCldfb) { - if ( st_ivas->hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) + if (st_ivas->hBinRenderer->hInputSetup->is_loudspeaker_setup == 0) { - for ( i = 0; i < 3; i++ ) + for (i = 0; i < 3; i++) { - for ( j = 0; j < 3; j++ ) + for (j = 0; j < 3; j++) { - st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i][j] = (Word32) floatToFixed( st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][i][j], 30 ); + st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i][j] = (Word32)floatToFixed(st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][i][j], 30); } } } @@ -3764,103 +4042,103 @@ void ivas_param_mc_dec_render( Word16 input_q = 6; /* Implement binaural rendering */ - ivas_binRenderer_fx( st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - hParamMC->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, - Cldfb_RealBuffer_fx, - Cldfb_ImagBuffer_fx, &input_q ); + ivas_binRenderer_fx(st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + hParamMC->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, + Cldfb_RealBuffer_fx, + Cldfb_ImagBuffer_fx, &input_q); /* fixed to float */ - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + for (i = 0; i < MAX_OUTPUT_CHANNELS; i++) { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + for (j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++) { - for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + for (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) { - Cldfb_RealBuffer[i][j][k] = fixedToFloat( Cldfb_RealBuffer_fx[i][j][k], input_q ); - Cldfb_ImagBuffer[i][j][k] = fixedToFloat( Cldfb_ImagBuffer_fx[i][j][k], input_q ); + Cldfb_RealBuffer[i][j][k] = fixedToFloat(Cldfb_RealBuffer_fx[i][j][k], input_q); + Cldfb_ImagBuffer[i][j][k] = fixedToFloat(Cldfb_ImagBuffer_fx[i][j][k], input_q); } } } - for ( int idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) + for (int idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++) { - for ( int idx2 = 0; idx2 < hParamMC->subframe_nbslots[subframe_idx]; idx2++ ) + for (int idx2 = 0; idx2 < hParamMC->subframe_nbslots[subframe_idx]; idx2++) { - Scale_sig32( Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6 - input_q ); - Scale_sig32( Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6 - input_q ); + Scale_sig32(Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6 - input_q); + Scale_sig32(Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6 - input_q); } } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + for (i = 0; i < BINAURAL_CHANNELS; i++) { - for ( j = 0; j < hParamMC->subframe_nbslots[subframe_idx]; j++ ) + for (j = 0; j < hParamMC->subframe_nbslots[subframe_idx]; j++) { - for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + for (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) { - Cldfb_RealBuffer_Binaural[i][j][k] = fix_to_float( Cldfb_RealBuffer_Binaural_fx[i][j][k], Q6 ); - Cldfb_ImagBuffer_Binaural[i][j][k] = fix_to_float( Cldfb_ImagBuffer_Binaural_fx[i][j][k], Q6 ); + Cldfb_RealBuffer_Binaural[i][j][k] = fix_to_float(Cldfb_RealBuffer_Binaural_fx[i][j][k], Q6); + Cldfb_ImagBuffer_Binaural[i][j][k] = fix_to_float(Cldfb_ImagBuffer_Binaural_fx[i][j][k], Q6); } } } #else - ivas_binRenderer( st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - hParamMC->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + ivas_binRenderer(st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + hParamMC->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer); #endif /* update combined orientation access index */ - ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); + ivas_combined_orientation_update_index(st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) + else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB) { /* format conversion*/ #ifdef IVAS_FLOAT_FIXED Word16 inChannels = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; Word16 num_timeslots = hParamMC->subframe_nbslots[subframe_idx]; Word16 j; - FOR( i = 0; i < inChannels; ++i ) + FOR(i = 0; i < inChannels; ++i) { - FOR( j = 0; j < num_timeslots; ++j ) + FOR(j = 0; j < num_timeslots; ++j) { - floatToFixed_arrL( Cldfb_RealBuffer[i][j], Cldfb_RealBuffer_fx[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt ); - floatToFixed_arrL( Cldfb_ImagBuffer[i][j], Cldfb_ImagBuffer_fx[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt ); + floatToFixed_arrL(Cldfb_RealBuffer[i][j], Cldfb_RealBuffer_fx[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); + floatToFixed_arrL(Cldfb_ImagBuffer[i][j], Cldfb_ImagBuffer_fx[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); } } - ivas_lssetupconversion_process_param_mc_fx( st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, channel_active ); - FOR( i = 0; i < inChannels; ++i ) + ivas_lssetupconversion_process_param_mc_fx(st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, channel_active); + FOR(i = 0; i < inChannels; ++i) { - FOR( j = 0; j < num_timeslots; ++j ) + FOR(j = 0; j < num_timeslots; ++j) { - fixedToFloat_arrL( Cldfb_RealBuffer_fx[i][j], Cldfb_RealBuffer[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt ); - fixedToFloat_arrL( Cldfb_ImagBuffer_fx[i][j], Cldfb_ImagBuffer[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt ); + fixedToFloat_arrL(Cldfb_RealBuffer_fx[i][j], Cldfb_RealBuffer[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); + fixedToFloat_arrL(Cldfb_ImagBuffer_fx[i][j], Cldfb_ImagBuffer[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); } } #else - ivas_lssetupconversion_process_param_mc( st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active ); + ivas_lssetupconversion_process_param_mc(st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active); #endif } /* CLDFB synthesis */ #ifdef IVAS_FLOAT_FIXED - - floatToFixed_arrL( &Cldfb_ImagBuffer[0][0][0], &Cldfb_ImagBuffer_fx[0][0][0], Q6, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); - floatToFixed_arrL( &Cldfb_RealBuffer[0][0][0], &Cldfb_RealBuffer_fx[0][0][0], Q6, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX ); + + floatToFixed_arrL(&Cldfb_ImagBuffer[0][0][0], &Cldfb_ImagBuffer_fx[0][0][0], Q6, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); + floatToFixed_arrL(&Cldfb_RealBuffer[0][0][0], &Cldfb_RealBuffer_fx[0][0][0], Q6, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); /* CLDFB synthesis */ - for ( ch = 0; ch < nchan_out_cldfb; ch++ ) + for (ch = 0; ch < nchan_out_cldfb; ch++) { Word32 *RealBuffer_fx[16]; Word32 *ImagBuffer_fx[16]; - if ( channel_active[ch] ) + if (channel_active[ch]) { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++ ) + for (i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++) { - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { RealBuffer_fx[i] = Cldfb_RealBuffer_Binaural_fx[ch][i]; ImagBuffer_fx[i] = Cldfb_ImagBuffer_Binaural_fx[ch][i]; @@ -3872,43 +4150,43 @@ void ivas_param_mc_dec_render( } } - for ( i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++ ) + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) { - st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbSynDec[ch]->cldfb_state[i] * ( 1LL << ( 5 ) ) ); + st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbSynDec[ch]->cldfb_state[i] * (1LL << (5))); } - scale_sig32( output_f_fx[ch], len, 5 - 11 ); + scale_sig32(output_f_fx[ch], len, 5 - 11); - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis_ivas_fx(RealBuffer_fx, ImagBuffer_fx, &(output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch]); - scale_sig32( output_f_fx[ch], len, 11 - 5 ); - for ( i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++ ) + scale_sig32(output_f_fx[ch], len, 11 - 5); + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) { - st_ivas->cldfbSynDec[ch]->cldfb_state[i] = ( (float) st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] / ( 1LL << ( 5 ) ) ); + st_ivas->cldfbSynDec[ch]->cldfb_state[i] = ((float)st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] / (1LL << (5))); } - fixedToFloat_arrL( output_f_fx[ch], output_f[ch], Q11, len ); + fixedToFloat_arrL(output_f_fx[ch], output_f[ch], Q11, len); } else { - set32_fx( &( output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), 0, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); - fixedToFloat_arrL( output_f_fx[ch], output_f[ch], Q11, len ); + set32_fx(&(output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), 0, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); + fixedToFloat_arrL(output_f_fx[ch], output_f[ch], Q11, len); } } slot_idx_start += hParamMC->subframe_nbslots[subframe_idx]; slot_idx_start_cldfb_synth += hParamMC->subframe_nbslots[subframe_idx]; } #else - for ( ch = 0; ch < nchan_out_cldfb; ch++ ) + for (ch = 0; ch < nchan_out_cldfb; ch++) { float *RealBuffer[16]; float *ImagBuffer[16]; - if ( channel_active[ch] ) + if (channel_active[ch]) { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++ ) + for (i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++) { - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; @@ -3920,351 +4198,77 @@ void ivas_param_mc_dec_render( } } - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis_ivas(RealBuffer, ImagBuffer, &(output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch]); } else { - set_f( &( output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); + set_f(&(output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); } } slot_idx_start += hParamMC->subframe_nbslots[subframe_idx]; slot_idx_start_cldfb_synth += hParamMC->subframe_nbslots[subframe_idx]; - } -#endif - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) - { -#ifdef IVAS_FLOAT_FIXED - ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_f_fx, p_output_f_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); -#if 1 - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - fixedToFloat_arrL(output_f_fx[i], output_f[i], Q11 , *nSamplesRendered ); - } +} #endif -#else - ivas_mc2sba( st_ivas->hIntSetup, output_f, output_f, hParamMC->num_freq_bands * slots_to_render, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif // IVAS_FLOAT_FIXED - } - /* update */ - if ( hParamMC->slots_rendered == hParamMC->num_slots ) - { - hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; #ifdef IVAS_FLOAT_FIXED + if (hParamMC->slots_rendered == hParamMC->num_slots) + { FOR(Word16 param_band_idx = 0; param_band_idx < hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport * nchan_out_cov); IF(hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr) { f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_transport * nchan_out_cov); } } - - param_mc_update_mixing_matrices_fx(hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_transport, nchan_out_cov); - - FOR(Word16 param_band_idx = 0; param_band_idx < hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { - IF( hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr) { - mvr2r(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], nchan_transport * nchan_out_cov ); - } - mvr2r(hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[param_band_idx], nchan_transport * nchan_out_cov); - } - -#else - param_mc_update_mixing_matrices( hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_transport, nchan_out_cov ); -#endif } - hParamMC->subframes_rendered = last_sf; - *nSamplesAvailableNext = ( hParamMC->num_slots - hParamMC->slots_rendered ) * NS2SA( output_Fs, CLDFB_SLOT_NS ); - //fclose(fp1); - //fclose(fp); - pop_wmops(); - - return; -} - +#endif -#else -void ivas_param_mc_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ - uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ - uint16_t *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ - float *output_f[] /* o : rendered time signal */ -) -{ - PARAM_MC_DEC_HANDLE hParamMC; - int16_t i, ch; - int16_t subframe_idx; - int16_t slot_idx, slot_idx_start, slot_idx_start_cldfb_synth, first_sf, last_sf, slots_to_render; - int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; - int16_t nchan_out_cov; - /*CLDFB*/ - float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - /*Decorrelator*/ - float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; - /* format converter */ - int16_t channel_active[MAX_OUTPUT_CHANNELS]; - uint16_t nband_synth, nbands_to_zero; - uint16_t nchan_out_init; - uint32_t output_Fs; - - hParamMC = st_ivas->hParamMC; - assert(hParamMC); - - push_wmops("param_mc_dec_render"); - - set_s(channel_active, 0, MAX_CICP_CHANNELS); - nchan_transport = st_ivas->nchan_transport; - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - nchan_out_init = nchan_out_transport; - output_Fs = st_ivas->hDecoderConfig->output_Fs; - - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) - { - nchan_out_cldfb = BINAURAL_CHANNELS; - set_s(channel_active, 1, nchan_out_cldfb); - if (st_ivas->hCombinedOrientationData) + if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) { - nchan_out_init = MAX_INTERN_CHANNELS; +#ifdef IVAS_FLOAT_FIXED + ivas_mc2sba_fx(st_ivas->hIntSetup, p_output_f_fx, p_output_f_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0); +#else + ivas_mc2sba(st_ivas->hIntSetup, output_f, output_f, hParamMC->num_freq_bands * slots_to_render, st_ivas->hOutSetup.ambisonics_order, 0.f); +#endif // IVAS_FLOAT_FIXED } - nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - } - else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB) - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - } - else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - nchan_out_cldfb = nchan_out_cov; - set_s(channel_active, 1, nchan_out_cov); - } - else - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = nchan_out_transport; - set_s(channel_active, 1, nchan_out_cov); - } - /* set everything to zero that will not be decoded */ - nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; - nbands_to_zero = hParamMC->num_freq_bands - nband_synth; - for (ch = 0; ch < nchan_out_init; ch++) - { - for (slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++) - { - set_zero(&(Cldfb_RealBuffer[ch][slot_idx][nband_synth]), nbands_to_zero); - set_zero(&(Cldfb_ImagBuffer[ch][slot_idx][nband_synth]), nbands_to_zero); - } - } + /* update */ - /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min(hParamMC->num_slots - hParamMC->slots_rendered, nSamplesAsked / NS2SA(output_Fs, CLDFB_SLOT_NS)); - *nSamplesRendered = slots_to_render * NS2SA(output_Fs, CLDFB_SLOT_NS); - first_sf = hParamMC->subframes_rendered; - last_sf = first_sf; - while (slots_to_render > 0) - { - slots_to_render -= hParamMC->subframe_nbslots[last_sf]; - last_sf++; - } - if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) - { - for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) + if (hParamMC->slots_rendered == hParamMC->num_slots) { - slots_to_render += hParamMC->subframe_nbslots[subframe_idx]; - } - } - slot_idx_start = hParamMC->slots_rendered; - slot_idx_start_cldfb_synth = 0; - for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) - { - for (slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++, hParamMC->slots_rendered++) - { - - if (hParamMC->max_band_decorr > 0) - { - /*-----------------------------------------------------------------* - * protoype signal computation - *-----------------------------------------------------------------*/ - - param_mc_protoSignalComputation(&hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - hParamMC->proto_frame_f, hParamMC->diff_proto_info, - hParamMC->num_freq_bands); - - /*-----------------------------------------------------------------* - * frequency domain decorrelation - *-----------------------------------------------------------------*/ - - /* decorrelate prototype frame */ - ivas_dirac_dec_decorr_process(hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - nchan_transport, - hParamMC->proto_frame_f, - hParamMC->diff_proto_info->num_protos_diff, - hParamMC->diff_proto_info->proto_index_diff, - hParamMC->proto_frame_dec_f, - onset_filter, - hParamMC->h_freq_domain_decorr_ap_params, - hParamMC->h_freq_domain_decorr_ap_state); - - /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ - /* memory for the decorrelated signal */ - ivas_param_mc_dec_copy_diffuse_proto(hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx); - } - - /*-----------------------------------------------------------------* - * output synthesis - *-----------------------------------------------------------------*/ - - ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot(&hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - Cldfb_RealBuffer, Cldfb_ImagBuffer, - hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, - nchan_transport, nchan_out_cov, hParamMC); - - if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM)) - { - if ( - st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV) - { - ivas_param_mc_mc2sba_cldfb(st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE); - } - else - { - /* remove LFE */ - uint16_t idx_out; - uint16_t idx_lfe; - IVAS_OUTPUT_SETUP hLsSetup; - - hLsSetup = st_ivas->hTransSetup; - - /* If LFE should be rendered, add it to other channels before removing */ - if (st_ivas->hBinRenderer->render_lfe) - { - for (idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++) - { - /* Copy just the first band of LFE*/ - v_multc(Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], (GAIN_LFE / hLsSetup.nchan_out_woLFE), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1); - v_multc(Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], (GAIN_LFE / hLsSetup.nchan_out_woLFE), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1); - - for (ch = 0; ch < (hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe); ch++) - { - if (hLsSetup.index_lfe[idx_lfe] != ch) - { - v_add(Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1); - v_add(Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1); - } - } - } - } - - idx_out = 0; - idx_lfe = 0; - - for (ch = 0; ch < (hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe); ch++) - { - if ((hLsSetup.num_lfe > 0) && (hLsSetup.index_lfe[idx_lfe] == ch)) - { - if (idx_lfe < (hLsSetup.num_lfe - 1)) - { - idx_lfe++; - } - } - else if (ch != idx_out) - { - mvr2r(Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth); - mvr2r(Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth); - idx_out++; - } - else - { - idx_out++; - } - } - } - } +#ifdef IVAS_FLOAT_FIXED + hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; + param_mc_update_mixing_matrices_fx(hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_transport, nchan_out_cov); +#else + param_mc_update_mixing_matrices(hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_transport, nchan_out_cov); +#endif } - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) - { - - ivas_binRenderer(st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - hParamMC->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer); - - - /* update combined orientation access index */ - ivas_combined_orientation_update_index(st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); - } - else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB) +#ifdef IVAS_FLOAT_FIXED +if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) +{ + FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) { - /* format conversion*/ - ivas_lssetupconversion_process_param_mc(st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active); + fixedToFloat_arrL(output_f_fx[i], output_f[i], Q11, *nSamplesRendered); } - - /* CLDFB synthesis */ - for (ch = 0; ch < nchan_out_cldfb; ch++) - { - float *RealBuffer[16]; - float *ImagBuffer[16]; - - if (channel_active[ch]) - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for (i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++) - { - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) - { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; - } - else - { - RealBuffer[i] = Cldfb_RealBuffer[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[ch][i]; - } - } - - cldfbSynthesis_ivas(RealBuffer, ImagBuffer, &(output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch]); - } - else - { - set_f(&(output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); - } +} +if (hParamMC->slots_rendered == hParamMC->num_slots) +{ + FOR(Word16 param_band_idx = 0; param_band_idx < hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { + IF(hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr) { + mvr2r(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], nchan_transport * nchan_out_cov); + } + mvr2r(hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[param_band_idx], nchan_transport * nchan_out_cov); } - slot_idx_start += hParamMC->subframe_nbslots[subframe_idx]; - slot_idx_start_cldfb_synth += hParamMC->subframe_nbslots[subframe_idx]; - } - - if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) - { - ivas_mc2sba(st_ivas->hIntSetup, output_f, output_f, hParamMC->num_freq_bands * slots_to_render, st_ivas->hOutSetup.ambisonics_order, 0.f); - } - - /* update */ - if (hParamMC->slots_rendered == hParamMC->num_slots) - { - hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; - param_mc_update_mixing_matrices(hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_transport, nchan_out_cov); - } - hParamMC->subframes_rendered = last_sf; - *nSamplesAvailableNext = (hParamMC->num_slots - hParamMC->slots_rendered) * NS2SA(output_Fs, CLDFB_SLOT_NS); - pop_wmops(); - - return; } +#endif +hParamMC->subframes_rendered = last_sf; +*nSamplesAvailableNext = (hParamMC->num_slots - hParamMC->slots_rendered) * NS2SA(output_Fs, CLDFB_SLOT_NS); +pop_wmops(); +return; +} -#endif /*------------------------------------------------------------------------- * ivas_param_mc_dec() * @@ -4510,17 +4514,16 @@ static void param_mc_protoSignalComputation_fx( p_real_buffer_fx = &RealBuffer_fx[source_ch_idx * num_freq_bands]; p_imag_buffer_fx = &ImagBuffer_fx[source_ch_idx * num_freq_bands]; - FOR (band = 0; band < num_freq_bands; band++) { - Word32 tmp_x = Mpy_32_32(fac_fx, (*(p_real_buffer_fx++))); // Q(30 + 12 - 31) :: Q11 + Word32 tmp_x = Mpy_32_32(fac_fx, (*(p_real_buffer_fx++))); // Q(30 + 6 - 31) :: Q5 *(p_proto_frame_fx) = L_add(*(p_proto_frame_fx), tmp_x); move32(); p_proto_frame_fx++; - tmp_x = Mpy_32_32(fac_fx, (*(p_imag_buffer_fx++))); // Q(30 + 12 - 31) :: Q11 + tmp_x = Mpy_32_32(fac_fx, (*(p_imag_buffer_fx++))); // Q(30 + 6 - 31) :: Q5 *(p_proto_frame_fx) = L_add(*(p_proto_frame_fx), tmp_x); move32(); diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 9cc2cd5b0..7aa9de8ce 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -1862,8 +1862,13 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig(st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub(q_win, st->Q_syn)); Scale_sig(st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub(q_win, st->Q_syn)); Scale_sig(st->hHQ_core->old_out_fx, L_FRAME48k, sub(q_win, st->Q_syn)); +#ifdef MSAN_FIX + Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); + Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); +#else Scale_sig(synth_buf_fx, 3136, sub(q_win, q_syn)); Scale_sig(synth_bufFB_fx, 3136, sub(q_win, q_syn)); +#endif Scale_sig(st->syn, M + 1, q_win - st->Q_syn); FOR( k = 0; k < nSubframes[ch]; k++ ) { @@ -1899,8 +1904,13 @@ void ivas_mdct_core_reconstruct_fx( Scale_sig(st->hTcxDec->syn_Overl_TDACFB, shr(L_FRAME_MAX, 1), sub(-1 - st->Q_syn, q_win)); Scale_sig(st->hTcxDec->syn_Overl_TDAC, shr(L_FRAME32k, 1), sub(-1 - st->Q_syn, q_win)); Scale_sig(st->hTcxDec->old_syn_Overl, shr(L_FRAME32k, 1), sub(-1 - st->Q_syn, q_win)); +#ifdef MSAN_FIX + Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub(q_syn, q_win) ); + Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub(q_syn, q_win) ); +#else Scale_sig(synth_buf_fx, 3136, sub(q_syn, q_win)); Scale_sig(synth_bufFB_fx, 3136, sub(q_syn, q_win)); +#endif Scale_sig(st->syn, M + 1, st->Q_syn + 2); Scale_sig(st->hTcxDec->syn_OverlFB, shr(L_FRAME_MAX, 1), sub(st->Q_syn, q_win)); Scale_sig(st->hTcxDec->syn_Overl, shr(L_FRAME32k, 1), sub(st->Q_syn, q_win)); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index a7870d075..d3ce9ff94 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1,32 +1,32 @@ /****************************************************************************************************** - (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ @@ -40,6 +40,7 @@ #include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_binauralRenderer.h" +#include "ivas_rom_binaural_crend_head.h" #include "ivas_rom_rend.h" #include "ivas_rom_com.h" #ifdef IVAS_FLOAT_FIXED @@ -49,7 +50,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED -Word16 slot_fx[4] = {32767, 16384, 10922 ,8192}; +Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 }; #endif #define IVAS_FLOAT_FIXED_TO_BE_REMOVED @@ -64,7 +65,7 @@ Word16 slot_fx[4] = {32767, 16384, 10922 ,8192}; #define STEREO_PREPROCESS_IIR_FACTOR ( 0.9f ) #ifdef IVAS_FLOAT_FIXED -#define STEREO_PREPROCESS_IIR_FACTOR_Q15 (29491 ) +#define STEREO_PREPROCESS_IIR_FACTOR_Q15 ( 29491 ) #endif /* powf(0.95f, 4.0f) for sub-frame smoothing instead of CLDFB slot */ #define ADAPT_HTPROTO_IIR_FAC 0.81450625f @@ -77,10 +78,10 @@ Word16 slot_fx[4] = {32767, 16384, 10922 ,8192}; #define TWO_POINT_FIVE_IN_Q13 20480 // Q13 #define ADAPT_HTPROTO_IIR_FAC_FX 26689 // Q15 #define LOG_10_BASE_2_Q29 1783446528 // Q29 -#define TAN_30_FX 17157 //Q15 -#define INV_TAN30_FX 28377 //Q14 +#define TAN_30_FX 17157 // Q15 +#define INV_TAN30_FX 28377 // Q14 #endif -#define ADAPT_HTPROTO_ROT_LIM_1 0.8f +#define ADAPT_HTPROTO_ROT_LIM_1 0.8f #define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */ @@ -90,6 +91,10 @@ typedef struct hrtfGainCache int16_t ele; float shVec[HRTF_SH_CHANNELS]; +#ifdef IVAS_FLOAT_FIXED + Word32 shVec_fx[HRTF_SH_CHANNELS]; +#endif + } PARAMBIN_HRTF_GAIN_CACHE; typedef struct parambin_rend_config_data @@ -100,6 +105,9 @@ typedef struct parambin_rend_config_data int32_t ivas_total_brate; int16_t nchan_transport; float qualityBasedSmFactor; +#ifdef IVAS_FLOAT_FIXED + Word32 qualityBasedSmFactor_fx; +#endif int16_t processReverb; ISM_MODE ism_mode; } PARAMBIN_REND_CONFIG, *PARAMBIN_REND_CONFIG_HANDLE; @@ -114,19 +122,23 @@ static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); #ifdef IVAS_FLOAT_FIXED -static void ivas_dirac_dec_decorrelate_slot_fx(DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX], Word32 decIm[][CLDFB_NO_CHANNELS_MAX]); +static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX], Word32 decIm[][CLDFB_NO_CHANNELS_MAX] ); #endif +#ifdef IVAS_FLOAT_FIXED +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 Rmat_fx[3][3], const Word16 subframe, const Word16 isHeadtracked, const MASA_ISM_DATA_HANDLE hMasaIsmData, Word16 q ); +#else static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const MASA_ISM_DATA_HANDLE hMasaIsmData ); +#endif static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, float Rmat[3][3], const int16_t subframe, const int16_t isHeadtracked, const int16_t nchanSeparateChannels, const MASA_ISM_DATA_HANDLE hMasaIsmData ); #ifdef IVAS_FLOAT_FIXED -static void ivas_dirac_dec_binaural_process_output_fx(DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], Word32 *output_fx[], Word16 *q_out, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 q_inp, const Word16 max_band_decorr, const Word16 numInChannels, const Word16 processReverb, const Word16 subframe, const Word16 q_mat); +static void ivas_dirac_dec_binaural_process_output_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], Word32 *output_fx[], Word16 *q_out, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 q_inp, const Word16 max_band_decorr, const Word16 numInChannels, const Word16 processReverb, const Word16 subframe, const Word16 q_mat ); -static void adaptTransportSignalsHeadtracked_fx(COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word16 q_inp, const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3]); +static void adaptTransportSignalsHeadtracked_fx( COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word16 q_inp, const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3] ); -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx(COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3]); +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3] ); #endif static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); @@ -137,8 +149,16 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( COM static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); +#ifdef IVAS_FLOAT_FIXED +static void hrtfShGetHrtf_fx( const Word16 bin, const Word16 aziDeg, const Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 useCachedValue ); +#endif + static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t useCachedValue ); +#ifdef IVAS_FLOAT_FIXED +static void getDirectPartGains_fx( const Word16 bin, Word16 aziDeg, Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, const UWord8 renderStereoOutputInsteadOfBinaural, Word32 Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 isHeadtracked ); +#endif + static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t isHeadtracked ); static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); @@ -168,136 +188,136 @@ ivas_error ivas_dirac_dec_init_binaural_data( float frequency_axis[CLDFB_NO_CHANNELS_MAX]; hDiracDecBin = st_ivas->hDiracDecBin; - if ( hDiracDecBin == NULL ) + if ( hDiracDecBin == NULL ) + { + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) { - if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); - } - - hDiracDecBin->hTdDecorr = NULL; - hDiracDecBin->hReverb = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); } - output_Fs = st_ivas->hDecoderConfig->output_Fs; - nBins = st_ivas->hSpatParamRendCom->num_freq_bands; - renderer_type = st_ivas->renderer_type; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) - { - set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); - } - - for ( k = 0; k < BINAURAL_CHANNELS; k++ ) - { - set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); - } - set_zero( hDiracDecBin->ChEnePrev[j], nBins ); - set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); - } - set_zero( hDiracDecBin->ChCrossRePrev, nBins ); - set_zero( hDiracDecBin->ChCrossImPrev, nBins ); - set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); - set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + } + output_Fs = st_ivas->hDecoderConfig->output_Fs; + nBins = st_ivas->hSpatParamRendCom->num_freq_bands; + renderer_type = st_ivas->renderer_type; - for ( bin = 0; bin < nBins; bin++ ) + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { - binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); - /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); } - for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) + for ( k = 0; k < BINAURAL_CHANNELS; k++ ) { - hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; - hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; - hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); } + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + } + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - } - else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ - { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); - /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ - if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || - ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) - { + for ( bin = 0; bin < nBins; bin++ ) + { + binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); + /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ + tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + } + + for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) + { + hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; + hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; + hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; + } + + if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + } + else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + { + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + + /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ + if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || + ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) + { #ifdef IVAS_FLOAT_FIXED - ivas_binaural_reverb_close_fx( &( hDiracDecBin->hReverb ) ); + ivas_binaural_reverb_close_fx( &( hDiracDecBin->hReverb ) ); #else - ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); + ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); #endif - } + } if ( hDiracDecBin->hReverb == NULL ) + { + /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { - /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } } - else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; - } - else /* Not valid renderer type for this renderer */ - { - assert( false ); - } + } + else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + } + else /* Not valid renderer type for this renderer */ + { + assert( false ); + } - hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ - if ( hDiracDecBin->hTdDecorr == NULL ) - { - hDiracDecBin->useTdDecorr = 0; - } + if ( hDiracDecBin->hTdDecorr == NULL ) + { + hDiracDecBin->useTdDecorr = 0; + } - if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) - { - ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); - } + if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) + { + ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); + } - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) - { - ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) + { + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } - hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); st_ivas->hDiracDecBin = hDiracDecBin; @@ -341,9 +361,9 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( ivas_error error; hDiracDecBin = st_ivas->hDiracDecBin; - IF ( hDiracDecBin == NULL ) + IF( hDiracDecBin == NULL ) { - IF ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + IF( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); } @@ -360,25 +380,25 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( move16(); renderer_type = st_ivas->renderer_type; - FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - FOR ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) + FOR( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { -#if 1 /* todo: remove float */ +#if 1 /* todo: remove float */ set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); - set_zero(hDiracDecBin->processMtxRePrev[j][k], nBins); - set_zero(hDiracDecBin->processMtxImPrev[j][k], nBins); + set_zero( hDiracDecBin->processMtxRePrev[j][k], nBins ); + set_zero( hDiracDecBin->processMtxImPrev[j][k], nBins ); #endif - set16_fx(hDiracDecBin->processMtxRe_fx[j][k], 0, nBins); - set16_fx(hDiracDecBin->processMtxIm_fx[j][k], 0, nBins); - set16_fx(hDiracDecBin->processMtxRePrev_fx[j][k], 0, nBins); - set16_fx(hDiracDecBin->processMtxImPrev_fx[j][k], 0, nBins); + set16_fx( hDiracDecBin->processMtxRe_fx[j][k], 0, nBins ); + set16_fx( hDiracDecBin->processMtxIm_fx[j][k], 0, nBins ); + set16_fx( hDiracDecBin->processMtxRePrev_fx[j][k], 0, nBins ); + set16_fx( hDiracDecBin->processMtxImPrev_fx[j][k], 0, nBins ); } - FOR ( k = 0; k < BINAURAL_CHANNELS; k++ ) + FOR( k = 0; k < BINAURAL_CHANNELS; k++ ) { -#if 1 /* todo: remove float */ +#if 1 /* todo: remove float */ set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); #endif @@ -398,7 +418,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( #endif hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - FOR ( bin = 0; bin < nBins; bin++ ) + FOR( bin = 0; bin < nBins; bin++ ) { float binCenterFreq, tmpFloat; binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); @@ -430,7 +450,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( ivas_binaural_reverb_close_fx( &( hDiracDecBin->hReverb ) ); } - if ( hDiracDecBin->hReverb == NULL ) + if ( hDiracDecBin->hReverb == NULL ) { /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -462,30 +482,29 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); } - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) - { - Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; - ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); + if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) + { + Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; + ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); - IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis_fx, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - + IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis_fx, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; } + } hDiracDecBin->reqularizationFactor_fx = configure_reqularization_factor_fx( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -509,7 +528,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ } - IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK ) { return error; } @@ -529,27 +548,27 @@ void ivas_dirac_dec_close_binaural_data( ) { - IF (hBinaural == NULL || *hBinaural == NULL) + IF( hBinaural == NULL || *hBinaural == NULL ) { return; } - IF ((*hBinaural)->hReverb != NULL) + IF( ( *hBinaural )->hReverb != NULL ) { #ifdef IVAS_FLOAT_FIXED - ivas_binaural_reverb_close_fx(&((*hBinaural)->hReverb)); + ivas_binaural_reverb_close_fx( &( ( *hBinaural )->hReverb ) ); #else - ivas_binaural_reverb_close(&((*hBinaural)->hReverb)); + ivas_binaural_reverb_close( &( ( *hBinaural )->hReverb ) ); #endif } - ivas_td_decorr_dec_close(&((*hBinaural)->hTdDecorr)); - IF ((*hBinaural)->h_freq_domain_decorr_ap_params != NULL) + ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); + IF( ( *hBinaural )->h_freq_domain_decorr_ap_params != NULL ) { - ivas_dirac_dec_decorr_close(&(*hBinaural)->h_freq_domain_decorr_ap_params, &(*hBinaural)->h_freq_domain_decorr_ap_state); + ivas_dirac_dec_decorr_close( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); } - free(*hBinaural); + free( *hBinaural ); *hBinaural = NULL; return; @@ -560,18 +579,18 @@ void ivas_dirac_dec_close_binaural_data( ) { - IF ( hBinaural == NULL || *hBinaural == NULL ) + IF( hBinaural == NULL || *hBinaural == NULL ) { return; } - IF ( ( *hBinaural )->hReverb != NULL ) + IF( ( *hBinaural )->hReverb != NULL ) { ivas_binaural_reverb_close( &( ( *hBinaural )->hReverb ) ); } ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); - IF ( ( *hBinaural )->h_freq_domain_decorr_ap_params != NULL ) + IF( ( *hBinaural )->h_freq_domain_decorr_ap_params != NULL ) { ivas_dirac_dec_decorr_close( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); } @@ -594,7 +613,7 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx( ) { Word16 i, j; - IF ( hHrtfParambin != NULL && *hHrtfParambin != NULL ) + IF( hHrtfParambin != NULL && *hHrtfParambin != NULL ) { /* Tables already loaded from file */ return IVAS_ERR_OK; @@ -603,13 +622,13 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx( { /* Initialise tables from ROM */ HRTFS_PARAMBIN *hrtfParambin; - IF ( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) + IF( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for parametric binauralizer HRTF tables" ); } - FOR ( i = 0; i < BINAURAL_CHANNELS; i++ ) + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) { - FOR ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + FOR( j = 0; j < HRTF_SH_CHANNELS; j++ ) { Copy( hrtfShCoeffsRe_fx[i][j], hrtfParambin->hrtfShCoeffsRe_fx[i][j], HRTF_NUM_BINS ); Copy( hrtfShCoeffsIm_fx[i][j], hrtfParambin->hrtfShCoeffsIm_fx[i][j], HRTF_NUM_BINS ); @@ -791,15 +810,15 @@ void ivas_dirac_dec_binaural_render( *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void ivas_dirac_dec_binaural_sba_gain_fx( - Word32 *output[], /* i/o: synthesized core-coder transport channels/DirAC output */ + Word32 *output[], /* i/o: synthesized core-coder transport channels/DirAC output */ const Word16 nchan_remapped, /* i : num channels after remapping of TCs */ const Word16 output_frame /* i : output frame length */ ) { Word16 n; - Word16 gain;/*Q-14*/ + Word16 gain; /*Q-14*/ - IF ( EQ_16(nchan_remapped , 1) ) + IF( EQ_16( nchan_remapped, 1 ) ) { gain = 23681; move16(); @@ -810,7 +829,7 @@ void ivas_dirac_dec_binaural_sba_gain_fx( move16(); } - FOR ( n = 0; n < nchan_remapped; n++ ) + FOR( n = 0; n < nchan_remapped; n++ ) { v_multc_fixed_16( output[n], gain, output[n], output_frame ); } @@ -863,10 +882,12 @@ static void ivas_dirac_dec_binaural_internal( int16_t slot, ch, numInChannels; float Cldfb_RealBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - for (int i = 0; i < 6; i++) { - for (int j = 0; j < 4; j++) { - set_zero(Cldfb_RealBuffer_in[i][j], 60); - set_zero(Cldfb_ImagBuffer_in[i][j], 60); + for ( int i = 0; i < 6; i++ ) + { + for ( int j = 0; j < 4; j++ ) + { + set_zero( Cldfb_RealBuffer_in[i][j], 60 ); + set_zero( Cldfb_ImagBuffer_in[i][j], 60 ); } } int16_t nchanSeparateChannels; @@ -1068,7 +1089,6 @@ static void ivas_dirac_dec_binaural_internal( } - nchanSeparateChannels = 0; if ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) { @@ -1099,77 +1119,71 @@ static void ivas_dirac_dec_binaural_internal( const int16_t nchan_transport, const int16_t subframe ) { - - //////////////////////////////////////////////////////////////////////////// +#if 1 double maxim = 0; Word16 q_input = 11; - IF(st_ivas->hTcBuffer->tc[nchan_transport]) - FOR(Word16 ind = 0; ind < st_ivas->cldfbAnaDec[1]->no_channels * st_ivas->cldfbAnaDec[1]->no_col; ind++) + IF( st_ivas->hTcBuffer->tc[nchan_transport] ) + FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[1]->no_channels * st_ivas->cldfbAnaDec[1]->no_col; ind++ ) { - st_ivas->hTcBuffer->tc_fx[nchan_transport][ind] = (Word32)(st_ivas->hTcBuffer->tc[nchan_transport][ind] * (1 << q_input)); + st_ivas->hTcBuffer->tc_fx[nchan_transport][ind] = (Word32) ( st_ivas->hTcBuffer->tc[nchan_transport][ind] * ( 1 << q_input ) ); } - FOR(Word16 cha = 0; cha < 3 + max(1, st_ivas->nchan_ism); cha++) { - FOR(Word16 ind = 0; ind < st_ivas->hTcBuffer->n_samples_available; ind++) IF(st_ivas->hTcBuffer->tc[cha]) + FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) + { + FOR( Word16 ind = 0; ind < st_ivas->hTcBuffer->n_samples_available; ind++ ) + IF( st_ivas->hTcBuffer->tc[cha] ) { - st_ivas->hTcBuffer->tc_fx[cha][ind] = (Word32)(st_ivas->hTcBuffer->tc[cha][ind] * (1 << q_input)); + st_ivas->hTcBuffer->tc_fx[cha][ind] = (Word32) ( st_ivas->hTcBuffer->tc[cha][ind] * ( 1 << q_input ) ); } } - FOR(Word16 cha = 0; cha < 3 + max(1, st_ivas->nchan_ism); cha++) { - IF(st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state) - FOR(Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++) + FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) + { + IF( st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state ) + FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++ ) { - st_ivas->cldfbAnaDec[cha]->cldfb_state_fx[ind] = (Word32)(st_ivas->cldfbAnaDec[cha]->cldfb_state[ind] * (1 << q_input)); + st_ivas->cldfbAnaDec[cha]->cldfb_state_fx[ind] = (Word32) ( st_ivas->cldfbAnaDec[cha]->cldfb_state[ind] * ( 1 << q_input ) ); } } - //IF(st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] && st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt >= (1 << 0)) assert(0); - //IF(st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0]) st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->likelihood_noisy_speech = (Word16)(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt * (32767)); st_ivas->cldfbAnaDec[1]->q_scale = 15; - IF(abs_s((Word16)st_ivas->cldfbAnaDec[1]->scale_flt) != 0) - st_ivas->cldfbAnaDec[1]->q_scale = norm_s((Word16)st_ivas->cldfbAnaDec[1]->scale_flt); - st_ivas->cldfbAnaDec[1]->scale = (Word16)(st_ivas->cldfbAnaDec[1]->scale_flt * (1 << st_ivas->cldfbAnaDec[1]->q_scale)); + IF( abs_s( (Word16) st_ivas->cldfbAnaDec[1]->scale_flt ) != 0 ) + st_ivas->cldfbAnaDec[1]->q_scale = norm_s( (Word16) st_ivas->cldfbAnaDec[1]->scale_flt ); + st_ivas->cldfbAnaDec[1]->scale = (Word16) ( st_ivas->cldfbAnaDec[1]->scale_flt * ( 1 << st_ivas->cldfbAnaDec[1]->q_scale ) ); maxim = 0; - IF(st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0]) - FOR(Word16 ind = 0; ind < FFTCLDFBLEN; ind++) + IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] ) + FOR( Word16 ind = 0; ind < FFTCLDFBLEN; ind++ ) { - maxim = fmax(maxim, fabs(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind])); + maxim = fmax( maxim, fabs( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] ) ); } - IF(st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0]) + IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] ) st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 0; - IF(st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] && L_abs((Word32)maxim)!=0) st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - norm_l((Word32)maxim); - IF(st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0]) - FOR(Word16 ind = 0; ind < FFTCLDFBLEN; ind++) + IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] && L_abs( (Word32) maxim ) != 0 ) + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - norm_l( (Word32) maxim ); + IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] ) + FOR( Word16 ind = 0; ind < FFTCLDFBLEN; ind++ ) { - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32)(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * (1<<(31 - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp))); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32) ( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * ( 1 << ( 31 - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); } Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME] = { 0 }; - FOR(Word16 ind = 0; ind < 6; ind++) + FOR( Word16 ind = 0; ind < 6; ind++ ) { - FOR(Word16 ind2 = 0; ind2 < 4; ind2++) + FOR( Word16 ind2 = 0; ind2 < 4; ind2++ ) { q_cldfb[ind][ind2] = q_input; } } - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + IF(st_ivas->hMasa) + { + st_ivas->hMasa->data.dir_decode_quality_fx = float_to_fix16(st_ivas->hMasa->data.dir_decode_quality, 14); + } +#endif DIRAC_DEC_BIN_HANDLE hDiracDecBin; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; PARAMBIN_REND_CONFIG config_data; Word16 slot, ch, numInChannels; - float Cldfb_RealBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_RealBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - for (int i = 0; i < 6; i++) { - for (int j = 0; j < 4; j++) { - set_zero(Cldfb_RealBuffer_in[i][j], 60); - set_zero(Cldfb_ImagBuffer_in[i][j], 60); - set32_fx(Cldfb_RealBuffer_in_fx[i][j], 0, 60); - set32_fx(Cldfb_ImagBuffer_in_fx[i][j], 0, 60); - } - } Word16 nchanSeparateChannels; Word32 Rmat_fx[3][3]; - float Rmat[3][3]; Word16 max_band_decorr; DIFFUSE_DISTRIBUTION_DATA diffuseDistData; Word16 nBins, offsetSamples; @@ -1190,9 +1204,11 @@ static void ivas_dirac_dec_binaural_internal( config_data.nchan_transport = st_ivas->nchan_transport; move16(); config_data.qualityBasedSmFactor = st_ivas->hMasa != NULL ? st_ivas->hMasa->data.dir_decode_quality : 1.0f; + config_data.qualityBasedSmFactor_fx = st_ivas->hMasa != NULL ? L_shl_sat(st_ivas->hMasa->data.dir_decode_quality_fx, 17) : ONE_IN_Q31; + move32(); config_data.processReverb = st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; move16(); - IF ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + IF( st_ivas->ivas_format == MASA_ISM_FORMAT ) { config_data.ism_mode = st_ivas->ism_mode; } @@ -1203,55 +1219,44 @@ static void ivas_dirac_dec_binaural_internal( /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; - IF ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + IF( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) { - numInChannels = add(numInChannels, 1); + numInChannels = add( numInChannels, 1 ); } - ELSE IF ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + ELSE IF( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { - numInChannels = add(numInChannels, st_ivas->nchan_ism); + numInChannels = add( numInChannels, st_ivas->nchan_ism ); } - Rmat_fx[0][0] = ONE_IN_Q31; - move32(); + Rmat_fx[0][0] = ONE_IN_Q30; Rmat_fx[0][1] = 0; - move32(); Rmat_fx[0][2] = 0; - move32(); + move32(); move32(); move32(); Rmat_fx[1][0] = 0; - move32(); - Rmat_fx[1][1] = ONE_IN_Q31; - move32(); + Rmat_fx[1][1] = ONE_IN_Q30; Rmat_fx[1][2] = 0; - move32(); + move32(); move32(); move32(); Rmat_fx[2][0] = 0; - move32(); Rmat_fx[2][1] = 0; - move32(); - Rmat_fx[2][2] = ONE_IN_Q31; - move32(); - - - Rmat[0][0] = 1.0f; - Rmat[0][1] = 0.0f; - Rmat[0][2] = 0.0f; - - Rmat[1][0] = 0.0f; - Rmat[1][1] = 1.0f; - Rmat[1][2] = 0.0f; - - Rmat[2][0] = 0.0f; - Rmat[2][1] = 0.0f; - Rmat[2][2] = 1.0f; + Rmat_fx[2][2] = ONE_IN_Q30; + move32(); move32(); move32(); + FOR ( i = 0; i < 6; i++ ) + { + FOR ( j = 0; j < 4; j++ ) + { + set32_fx( Cldfb_RealBuffer_in_fx[i][j], 0, 60 ); + set32_fx( Cldfb_ImagBuffer_in_fx[i][j], 0, 60 ); + } + } /* CLDFB Analysis of input */ - FOR ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { - FOR ( ch = 0; ch < numInChannels; ch++ ) + FOR( ch = 0; ch < numInChannels; ch++ ) { - IF ( ch == 0 || nchan_transport == 2 ) + IF( ch == 0 || nchan_transport == 2 ) { q_cldfb[ch][slot] = q_input; move16(); @@ -1261,7 +1266,7 @@ static void ivas_dirac_dec_binaural_internal( Cldfb_ImagBuffer_in_fx[ch][slot], nBins, st_ivas->cldfbAnaDec[ch], &q_cldfb[ch][slot] ); } - ELSE IF ( config_data.nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ + ELSE IF( config_data.nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ { /* At mono input duplicate the channel to dual-mono */ mvl2l( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); @@ -1272,55 +1277,55 @@ static void ivas_dirac_dec_binaural_internal( ELSE /* when nchan_transport == 1 and ch == 1 */ { /* CNA and HB FD-CNG*/ - IF ( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) + IF( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) { Word16 numCoreBands, b; Word16 slotInFrame; numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; move16(); - slotInFrame = add(hSpatParamRendCom->slots_rendered, slot); + slotInFrame = add( hSpatParamRendCom->slots_rendered, slot ); generate_masking_noise_dirac_ivas_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], - st_ivas->hTcBuffer->tc_fx[nchan_transport], - Cldfb_RealBuffer_in_fx[2][slot], Cldfb_ImagBuffer_in_fx[2][slot], - slotInFrame, - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, - ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag, - 11, &q_cldfb[2][slot] ); + st_ivas->cldfbAnaDec[1], + st_ivas->hTcBuffer->tc_fx[nchan_transport], + Cldfb_RealBuffer_in_fx[2][slot], Cldfb_ImagBuffer_in_fx[2][slot], + slotInFrame, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag, + 11, &q_cldfb[2][slot] ); generate_masking_noise_dirac_ivas_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ - NULL, - Cldfb_RealBuffer_in_fx[1][slot], Cldfb_ImagBuffer_in_fx[1][slot], - slotInFrame, - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, - ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag, - 0, &q_cldfb[1][slot] ); + st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ + NULL, + Cldfb_RealBuffer_in_fx[1][slot], Cldfb_ImagBuffer_in_fx[1][slot], + slotInFrame, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag, + 0, &q_cldfb[1][slot] ); /* LB: Copy first channel + LB-CNG to first and second channels with same scaling (dual-mono)*/ - FOR ( b = 0; b < numCoreBands; b++ ) + FOR( b = 0; b < numCoreBands; b++ ) { - Cldfb_RealBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add(L_shr(Cldfb_RealBuffer_in_fx[0][slot][b], q_cldfb[0][slot] - q_input + 5), L_shr(Cldfb_RealBuffer_in_fx[2][slot][b], q_cldfb[2][slot] - q_input + 5)), 23170/* INV_SQRT2 in Q15*/ ); + Cldfb_RealBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add( L_shr( Cldfb_RealBuffer_in_fx[0][slot][b], q_cldfb[0][slot] - q_input + 5 ), L_shr( Cldfb_RealBuffer_in_fx[2][slot][b], q_cldfb[2][slot] - q_input + 5 ) ), 23170 /* INV_SQRT2 in Q15*/ ); Cldfb_RealBuffer_in_fx[1][slot][b] = Cldfb_RealBuffer_in_fx[0][slot][b]; move32(); - Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add(L_shr(Cldfb_ImagBuffer_in_fx[0][slot][b], q_cldfb[0][slot] - q_input + 5), L_shr(Cldfb_ImagBuffer_in_fx[2][slot][b], q_cldfb[2][slot] - q_input + 5)), 23170 ); + Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1( L_add( L_shr( Cldfb_ImagBuffer_in_fx[0][slot][b], q_cldfb[0][slot] - q_input + 5 ), L_shr( Cldfb_ImagBuffer_in_fx[2][slot][b], q_cldfb[2][slot] - q_input + 5 ) ), 23170 ); Cldfb_ImagBuffer_in_fx[1][slot][b] = Cldfb_ImagBuffer_in_fx[0][slot][b]; move32(); } q_cldfb[1][slot] = q_input - 5; q_cldfb[0][slot] = q_input - 5; /* HB: Copy first channel to second channel and add HB-CNGs with different scalings*/ - FOR ( ; b < nBins; b++ ) + FOR( ; b < nBins; b++ ) { - Cldfb_RealBuffer_in_fx[0][slot][b] = Mpy_32_16_1(Cldfb_RealBuffer_in_fx[0][slot][b], 23170); - Cldfb_RealBuffer_in_fx[1][slot][b] = L_add(L_add(Cldfb_RealBuffer_in_fx[0][slot][b], L_shr(Cldfb_RealBuffer_in_fx[1][slot][b], 1)), Cldfb_RealBuffer_in_fx[0][slot][b]); - Cldfb_RealBuffer_in_fx[0][slot][b] = L_add(Cldfb_RealBuffer_in_fx[0][slot][b], L_shr(Cldfb_RealBuffer_in_fx[2][slot][b], 1)); + Cldfb_RealBuffer_in_fx[0][slot][b] = Mpy_32_16_1( Cldfb_RealBuffer_in_fx[0][slot][b], 23170 ); + Cldfb_RealBuffer_in_fx[1][slot][b] = L_add( L_add( Cldfb_RealBuffer_in_fx[0][slot][b], L_shr( Cldfb_RealBuffer_in_fx[1][slot][b], 1 ) ), Cldfb_RealBuffer_in_fx[0][slot][b] ); + Cldfb_RealBuffer_in_fx[0][slot][b] = L_add( Cldfb_RealBuffer_in_fx[0][slot][b], L_shr( Cldfb_RealBuffer_in_fx[2][slot][b], 1 ) ); - Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1(Cldfb_ImagBuffer_in_fx[0][slot][b], 23170); - Cldfb_ImagBuffer_in_fx[1][slot][b] = L_add(Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr(Cldfb_ImagBuffer_in_fx[1][slot][b], 1)); - Cldfb_ImagBuffer_in_fx[0][slot][b] = L_add(Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr(Cldfb_ImagBuffer_in_fx[2][slot][b], 1)); + Cldfb_ImagBuffer_in_fx[0][slot][b] = Mpy_32_16_1( Cldfb_ImagBuffer_in_fx[0][slot][b], 23170 ); + Cldfb_ImagBuffer_in_fx[1][slot][b] = L_add( Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr( Cldfb_ImagBuffer_in_fx[1][slot][b], 1 ) ); + Cldfb_ImagBuffer_in_fx[0][slot][b] = L_add( Cldfb_ImagBuffer_in_fx[0][slot][b], L_shr( Cldfb_ImagBuffer_in_fx[2][slot][b], 1 ) ); } } ELSE @@ -1338,9 +1343,9 @@ static void ivas_dirac_dec_binaural_internal( } } - IF ( hDiracDecBin->useTdDecorr ) + IF( hDiracDecBin->useTdDecorr ) { - FOR ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) + FOR( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { q_cldfb[ch][slot] = q_input; cldfbAnalysis_ts_fx_fixed_q( @@ -1348,8 +1353,8 @@ static void ivas_dirac_dec_binaural_internal( Cldfb_RealBuffer_in_fx[ch][slot], Cldfb_ImagBuffer_in_fx[ch][slot], nBins, st_ivas->cldfbAnaDec[ch], &q_cldfb[ch][slot] ); - IF ( config_data.nchan_transport == 1 && - ( config_data.ivas_format == SBA_FORMAT || config_data.ivas_format == SBA_ISM_FORMAT ) ) + IF( config_data.nchan_transport == 1 && + ( config_data.ivas_format == SBA_FORMAT || config_data.ivas_format == SBA_ISM_FORMAT ) ) { v_multc_fixed_16( Cldfb_RealBuffer_in_fx[ch][slot], 23170, Cldfb_RealBuffer_in_fx[ch][slot], nBins ); v_multc_fixed_16( Cldfb_ImagBuffer_in_fx[ch][slot], 23170, Cldfb_ImagBuffer_in_fx[ch][slot], nBins ); @@ -1358,160 +1363,193 @@ static void ivas_dirac_dec_binaural_internal( } } - ////////////////////////////////////////////////////////////////////////////////////////////// - FOR(Word16 cha = 0; cha < 3 + max(1, st_ivas->nchan_ism); cha++) IF(st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state) - FOR(Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++) - { - st_ivas->cldfbAnaDec[cha]->cldfb_state[ind] = (float)(st_ivas->cldfbAnaDec[cha]->cldfb_state_fx[ind]) / (float)(1 << q_input); - } - if (st_ivas->hSpar != NULL) - { - //floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q30, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); - //st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - //for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) - //{ - // for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) - // { - // floatToFixed_arrL(&st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - // &st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - // Q30, - // st_ivas->hSpar->hMdDec->mix_mat_dim_2); - // } - //} - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - if ( config_data.ivas_format == SBA_FORMAT || config_data.ivas_format == SBA_ISM_FORMAT ) + IF ( config_data.ivas_format == SBA_FORMAT || config_data.ivas_format == SBA_ISM_FORMAT ) { hDiracDecBin->hDiffuseDist = &diffuseDistData; ivas_spar_param_to_masa_param_mapping_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_cldfb, subframe ); ivas_sba_prototype_renderer_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_cldfb, subframe ); } - - //////////////////to be deletede from here - if (st_ivas->hDiracDecBin != NULL) - { - DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; - IF(hDiffuseDist != NULL) - { - fixedToFloat_arrL(hDiffuseDist->diffuseRatioX_fx, hDiffuseDist->diffuseRatioX, Q31, CLDFB_NO_CHANNELS_MAX); - fixedToFloat_arrL(hDiffuseDist->diffuseRatioY_fx, hDiffuseDist->diffuseRatioY, Q31, CLDFB_NO_CHANNELS_MAX); - fixedToFloat_arrL(hDiffuseDist->diffuseRatioZ_fx, hDiffuseDist->diffuseRatioZ, Q31, CLDFB_NO_CHANNELS_MAX); - } - } - - - if (st_ivas->hSpar != NULL) - { - //fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q30, sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx) / sizeof(st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0])); - //st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - //for (int ii = 0; ii < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; ii++) - //{ - // for (int jj = 0; jj < st_ivas->hSpar->hMdDec->mix_mat_dim_0_1; jj++) - // { - // fixedToFloat_arrL(&st_ivas->hSpar->hMdDec->mixer_mat_fx[ii][jj][0], - // &st_ivas->hSpar->hMdDec->mixer_mat[ii][jj][0], - // Q30, - // st_ivas->hSpar->hMdDec->mix_mat_dim_2); - // } - //} - } - - FOR(Word16 cha = 0; cha < 6; cha++) FOR(slot = 0; slot < 4; slot++) - FOR(Word16 ind = 0; ind < 60; ind++) + Word16 q_inp = Q6; + FOR( Word16 cha = 0; cha < 6; cha++ ) { - Cldfb_RealBuffer_in[cha][slot][ind] = (float)Cldfb_RealBuffer_in_fx[cha][slot][ind] / (float)(1 << (q_cldfb[cha][slot])); - Cldfb_ImagBuffer_in[cha][slot][ind] = (float)Cldfb_ImagBuffer_in_fx[cha][slot][ind] / (float)(1 << (q_cldfb[cha][slot])); + FOR( slot = 0; slot < 4; slot++ ) + { + scale_sig32(Cldfb_RealBuffer_in_fx[cha][slot], 60, sub(q_inp, q_cldfb[cha][slot])); + scale_sig32(Cldfb_ImagBuffer_in_fx[cha][slot], 60, sub(q_inp, q_cldfb[cha][slot])); + } } - - //////////////////to be deletedeto here - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) + IF( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 && st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) { - ivas_omasa_preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, subframe ); + /* Un-tested function. No test-case is hitting.*/ + ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, &q_inp, nBins, subframe ); } IF( hCombinedOrientationData ) { - FOR( i = 0; i < 3; i++ ) + FOR( i = 0; i < 3; i++ ) { - FOR( j = 0; j < 3; j++ ) + FOR( j = 0; j < 3; j++ ) { -#ifdef IVAS_FLOAT_FIXED - Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// -#endif - Rmat[i][j] = hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][i][j]; + Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// } } IF( EQ_16( nchan_transport, 2 ) ) { -#ifdef IVAS_FLOAT_FIXED - Word16 q_inp = Q6; - FOR( Word16 cha = 0; cha < 2; cha++ ) - FOR( slot = 0; slot < 4; slot++ ) - FOR( Word16 ind = 0; ind < 60; ind++ ) - { - Cldfb_RealBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_RealBuffer_in[cha][slot][ind], q_inp ); - Cldfb_ImagBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_ImagBuffer_in[cha][slot][ind], q_inp ); - } adaptTransportSignalsHeadtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); - FOR( Word16 cha = 0; cha < 2; cha++ ) - FOR( slot = 0; slot < 4; slot++ ) - FOR( Word16 ind = 0; ind < 60; ind++ ) - { - Cldfb_RealBuffer_in[cha][slot][ind] = fix_to_float( Cldfb_RealBuffer_in_fx[cha][slot][ind], q_inp ); - Cldfb_ImagBuffer_in[cha][slot][ind] = fix_to_float( Cldfb_ImagBuffer_in_fx[cha][slot][ind], q_inp ); - } -#else - adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); -#endif } } - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData ); +#if 1 + Word16 q_earlyPartEneCorrection = Q_factor_arrL( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); + hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; + floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); - if ( config_data.ivas_format == ISM_FORMAT ) + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { - max_band_decorr = 0; + f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); + f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); + f2me( hDiracDecBin->ChCrossReOutPrev[j], &hDiracDecBin->ChCrossReOutPrev_fx[j], &hDiracDecBin->ChCrossReOutPrev_e[j] ); + f2me( hDiracDecBin->ChCrossImOutPrev[j], &hDiracDecBin->ChCrossImOutPrev_fx[j], &hDiracDecBin->ChCrossImOutPrev_e[j] ); + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + f2me( hDiracDecBin->ChEnePrev[i][j], &hDiracDecBin->ChEnePrev_fx[i][j], &hDiracDecBin->ChEnePrev_e[i][j] ); + f2me( hDiracDecBin->ChEneOutPrev[i][j], &hDiracDecBin->ChEneOutPrev_fx[i][j], &hDiracDecBin->ChEneOutPrev_e[i][j] ); + } } - else if ( hDiracDecBin->useTdDecorr ) + FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) + { + IF( hSpatParamRendCom->energy_ratio1 ) + floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[i], hSpatParamRendCom->energy_ratio1_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); + IF( hSpatParamRendCom->energy_ratio2 ) + floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[i], hSpatParamRendCom->energy_ratio2_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); + } + IF( st_ivas->hMasaIsmData ) + FOR( i = 0; i < 4; i++ ) + { + FOR( j = 0; j < 6; j++ ) + { + floatToFixed_arrL32( st_ivas->hMasaIsmData->energy_ratio_ism[i][j], st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][j], Q30, 60 ); + } + } + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, 31, hSpatParamRendCom->num_freq_bands ); + IF( hDiracDecBin->hDiffuseDist ) + { + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceX, hDiracDecBin->diffuseFieldCoherenceX_fx, 31, 9 ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceY, hDiracDecBin->diffuseFieldCoherenceY_fx, 31, 9 ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceZ, hDiracDecBin->diffuseFieldCoherenceZ_fx, 31, 9 ); + } +#endif + Word16 shift = 31; + Word32 Cldfb_RealBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Cldfb_ImagBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + FOR( i = 0; i < 2; i++ ) + { + FOR( j = 0; j < 4; j++ ) + { + shift = s_min(shift, getScaleFactor32(Cldfb_RealBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); + shift = s_min(shift, getScaleFactor32(Cldfb_ImagBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); + } + } + + Word16 q = q_inp + shift; + + FOR( i = 0; i < 2; i++ ) + { + FOR( j = 0; j < 4; j++ ) + { + FOR( Word16 k = 0; k < 60; k++ ) + { + Cldfb_RealBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_RealBuffer_in_fx[i][j][k], shift ); + Cldfb_ImagBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_ImagBuffer_in_fx[i][j][k], shift ); + } + } + } + + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_inTmp_fx, Cldfb_ImagBuffer_inTmp_fx, Rmat_fx, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, st_ivas->hMasaIsmData, q ); + + IF ( config_data.ivas_format == ISM_FORMAT ) + { + max_band_decorr = 0; + move16(); + } + ELSE IF ( hDiracDecBin->useTdDecorr ) { max_band_decorr = CLDFB_NO_CHANNELS_MAX; + move16(); } - else + ELSE { max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; + move16(); } - nchanSeparateChannels = 0; - if ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) + move16(); + IF ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) { nchanSeparateChannels = 1; + move16(); } - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + ELSE IF ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { - nchanSeparateChannels = (uint8_t) st_ivas->nchan_ism; + nchanSeparateChannels = (UWord8) st_ivas->nchan_ism; + move16(); + } + +#if 1 + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + { + hDiracDecBin->ChEnePrev[i][j] = me2f( hDiracDecBin->ChEnePrev_fx[i][j], hDiracDecBin->ChEnePrev_e[i][j] ); + hDiracDecBin->ChEne[i][j] = me2f( hDiracDecBin->ChEne_fx[i][j], hDiracDecBin->ChEne_e[i][j] ); + hDiracDecBin->ChEneOut[i][j] = me2f( hDiracDecBin->ChEneOut_fx[i][j], hDiracDecBin->ChEneOut_e[i][j] ); + hDiracDecBin->ChEneOutPrev[i][j] = me2f( hDiracDecBin->ChEneOutPrev_fx[i][j], hDiracDecBin->ChEneOutPrev_e[i][j] ); + } + } + + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + { + hDiracDecBin->ChCrossRePrev[j] = me2f( hDiracDecBin->ChCrossRePrev_fx[j], hDiracDecBin->ChCrossRePrev_e[j] ); + hDiracDecBin->ChCrossImPrev[j] = me2f( hDiracDecBin->ChCrossImPrev_fx[j], hDiracDecBin->ChCrossImPrev_e[j] ); + hDiracDecBin->ChCrossRe[j] = me2f( hDiracDecBin->ChCrossRe_fx[j], hDiracDecBin->ChCrossRe_e[j] ); + hDiracDecBin->ChCrossIm[j] = me2f( hDiracDecBin->ChCrossIm_fx[j], hDiracDecBin->ChCrossIm_e[j] ); + hDiracDecBin->ChCrossReOut[j] = me2f( hDiracDecBin->ChCrossReOut_fx[j], hDiracDecBin->ChCrossReOut_e[j] ); + hDiracDecBin->ChCrossImOut[j] = me2f( hDiracDecBin->ChCrossImOut_fx[j], hDiracDecBin->ChCrossImOut_e[j] ); + hDiracDecBin->ChCrossReOutPrev[j] = me2f( hDiracDecBin->ChCrossReOutPrev_fx[j], hDiracDecBin->ChCrossReOutPrev_e[j] ); + hDiracDecBin->ChCrossImOutPrev[j] = me2f( hDiracDecBin->ChCrossImOutPrev_fx[j], hDiracDecBin->ChCrossImOutPrev_e[j] ); } + fixedToFloat_arrL( hDiracDecBin->frameMeanDiffuseness_fx, hDiracDecBin->frameMeanDiffuseness, 29, CLDFB_NO_CHANNELS_MAX ); + FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) + IF( st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state ) + FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++ ) + { + st_ivas->cldfbAnaDec[cha]->cldfb_state[ind] = (float) ( st_ivas->cldfbAnaDec[cha]->cldfb_state_fx[ind] ) / (float) ( 1 << q_input ); + } +#endif + + //TODO: To be removed once below function is fixed + float Rmat[3][3]; + for(i=0;i<3;i++) + { + fixedToFloat_arrL32(Rmat_fx[i], Rmat[i], Q30, 3); + } ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData ); -#ifdef IVAS_FLOAT_FIXED +#if 1 Word32 *output_fx[MAX_OUTPUT_CHANNELS]; Word32 output_fx_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word16 q_out; Word16 q_mat = 15; - Word16 q_inp = Q6; + q_inp = Q6; FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { output_fx[ch] = output_fx_buff[ch]; @@ -1536,11 +1574,7 @@ static void ivas_dirac_dec_binaural_internal( q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxImPrev[ch][slot], nBins ) ); } } - q_mat = sub(q_mat, 1) ; //guardbits// - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - output_fx[ch] = output_fx_buff[ch]; - } + q_mat = sub( q_mat, 1 ); // guardbits// FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { FOR( slot = 0; slot < BINAURAL_CHANNELS; slot++ ) @@ -1563,27 +1597,21 @@ static void ivas_dirac_dec_binaural_internal( floatToFixed_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->cldfb_state_fx, Q11, st_ivas->cldfbSynDec[ch]->p_filter_length ); st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q11; } - FOR( Word16 cha = 0; cha < 6; cha++ ) - FOR( slot = 0; slot < 4; slot++ ) - FOR( Word16 ind = 0; ind < 60; ind++ ) - { - Cldfb_RealBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_RealBuffer_in[cha][slot][ind], q_inp); - Cldfb_ImagBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_ImagBuffer_in[cha][slot][ind], q_inp); - } - ivas_dirac_dec_binaural_process_output_fx(hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat); +#endif + ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); + + hDiracDecBin->hDiffuseDist = NULL; + + hSpatParamRendCom->slots_rendered = add(hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe]); + hSpatParamRendCom->subframes_rendered = add(hSpatParamRendCom->subframes_rendered, 1); +#if 1 FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { fixedToFloat_arrL32( output_fx[ch], output_f[ch], q_out, imult1616( nBins, hSpatParamRendCom->subframe_nbslots[subframe] ) ); fixedToFloat_arrL32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); } -#else - ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); #endif - hDiracDecBin->hDiffuseDist = NULL; - - hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; - hSpatParamRendCom->subframes_rendered++; return; } @@ -1667,8 +1695,8 @@ static void ivas_dirac_dec_decorrelate_slot_fx( offset = imult1616( imult1616( num_freq_bands, BINAURAL_CHANNELS ), ch ); FOR( bin = 0; bin < num_freq_bands; bin++ ) { - protoFrame_fx[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; - protoFrame_fx[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; + protoFrame_fx[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; + protoFrame_fx[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; } } @@ -1698,11 +1726,12 @@ static void ivas_dirac_dec_decorrelate_slot_fx( decIm[ch][bin] = decorrelatedFrameInterleaved_fx[( bin * BINAURAL_CHANNELS ) + offset + 1]; } } - //q_decorrelatedFrameInterleaved will be same as q_inp/q_protoFrame // + // q_decorrelatedFrameInterleaved will be same as q_inp/q_protoFrame // return; } #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, @@ -2170,915 +2199,1179 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric return; } - -static void ivas_dirac_dec_binaural_determine_processing_matrices( +#else +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, PARAMBIN_REND_CONFIG_HANDLE hConfig, - const int16_t max_band_decorr, - float Rmat[3][3], - const int16_t subframe, - const int16_t isHeadtracked, - const int16_t nchanSeparateChannels, - const MASA_ISM_DATA_HANDLE hMasaIsmData ) + Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + Word32 Rmat_fx[3][3], + const Word16 subframe, + const Word16 isHeadtracked, + const MASA_ISM_DATA_HANDLE hMasaIsmData, + Word16 q) { - int16_t chA, chB, bin; - int16_t separateCenterChannelRendering; - int16_t nBins; - int16_t dirac_read_idx; - PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_NUM_OBJECTS]; - int16_t idx; - ISM_MODE ism_mode; + Word16 ch, slot, bin; + Word16 separateCenterChannelRendering; + Word16 nBins, idx, shift; + Word32 frameMeanDiffusenessEneWeight_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 IIReneLimiterFactor_fx; // Q26 + Word32 qualityBasedSmFactor_fx; + Word32 lowBitRateEQ_fx[CLDFB_NO_CHANNELS_MAX]; + UWord8 applyLowBitRateEQ; + Word16 dirac_read_idx; + Word32 subFrameTotalEne_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 q_subFrameTotalEne; + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_GAIN_CACHE_SIZE]; IVAS_FORMAT ivas_format; MC_MODE mc_mode; - int32_t ivas_total_brate; - int16_t nchan_transport; + Word32 ivas_total_brate; + Word16 nchan_transport; + Word16 gainCacheBaseIndex; + Word16 q_earlyPartEneCorrection; + q_earlyPartEneCorrection = hDiracDecBin->q_earlyPartEneCorrection; + separateCenterChannelRendering = hConfig->separateCenterChannelRendering; + move16(); ivas_format = hConfig->ivas_format; - separateCenterChannelRendering = nchanSeparateChannels > 0; mc_mode = hConfig->mc_mode; ivas_total_brate = hConfig->ivas_total_brate; + move32(); nchan_transport = hConfig->nchan_transport; + move16(); + qualityBasedSmFactor_fx = hConfig->qualityBasedSmFactor_fx; + qualityBasedSmFactor_fx = Mpy_32_32( qualityBasedSmFactor_fx, qualityBasedSmFactor_fx ); + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ + move16(); - ism_mode = hConfig->ism_mode; + set32_fx( hDiracDecBin->ChCrossRe_fx, 0, nBins ); + set32_fx( hDiracDecBin->ChCrossIm_fx, 0, nBins ); + set32_fx( hDiracDecBin->ChCrossReOut_fx, 0, nBins ); + set32_fx( hDiracDecBin->ChCrossImOut_fx, 0, nBins ); - dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + set16_fx( hDiracDecBin->ChCrossRe_e, 0, nBins ); + set16_fx( hDiracDecBin->ChCrossIm_e, 0, nBins ); + set16_fx( hDiracDecBin->ChCrossReOut_e, 0, nBins ); + set16_fx( hDiracDecBin->ChCrossImOut_e, 0, nBins ); + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set32_fx( hDiracDecBin->ChEne_fx[ch], 0, nBins ); + set32_fx( hDiracDecBin->ChEneOut_fx[ch], 0, nBins ); - for ( idx = 0; idx < MAX_NUM_OBJECTS; idx++ ) + set16_fx( hDiracDecBin->ChEne_e[ch], 0, nBins ); + set16_fx( hDiracDecBin->ChEneOut_e[ch], 0, nBins ); + } + set32_fx( hDiracDecBin->frameMeanDiffuseness_fx, 0, nBins ); + + set32_fx( frameMeanDiffusenessEneWeight_fx, 0, CLDFB_NO_CHANNELS_MAX ); + + FOR( idx = 0; idx < MAX_GAIN_CACHE_SIZE; idx++ ) { gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ + move16(); } - for ( bin = 0; bin < nBins; bin++ ) + /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ + applyLowBitRateEQ = 0; + IF( ( ivas_format == MASA_FORMAT || ivas_format == MC_FORMAT ) && LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) { - float tmpMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain; - float CxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], CxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* Input covariance matrix */ - float realizedOutputEne, targetOutputEne, missingOutputEne; - float CrEneL, CrEneR; /* Cr = residual decorrelated sound covariance matrix */ - float CrCrossRe, CrCrossIm; - float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* M = mixing matrix; Mdec = residual decorrelated signal mixing matrix */ - float prototypeMtx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] = { { 1.0f, 0.05f }, { 0.05f, 1.0f } }; /* Prototype matrix determines a reference signal in mixing matrix determination */ - - CrEneL = 0.0f; - CrEneR = 0.0f; - - /* Formulate main processing matrix M */ - formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], - hDiracDecBin->ChCrossRe[bin], hDiracDecBin->ChCrossIm[bin], - hDiracDecBin->ChEneOut[0][bin], hDiracDecBin->ChEneOut[1][bin], - hDiracDecBin->ChCrossReOut[bin], hDiracDecBin->ChCrossImOut[bin], - prototypeMtx, Mre, Mim, -#ifdef IVAS_FLOAT_FIXED - fix16_to_float(hDiracDecBin->reqularizationFactor_fx,Q14) ); -#else - hDiracDecBin->reqularizationFactor ); -#endif - - /* Load estimated covariance matrix to the [2][2] matrix form */ - CxRe[0][0] = hDiracDecBin->ChEne[0][bin]; - CxRe[1][1] = hDiracDecBin->ChEne[1][bin]; - CxRe[1][0] = hDiracDecBin->ChCrossRe[bin]; - CxRe[0][1] = hDiracDecBin->ChCrossRe[bin]; - CxIm[0][0] = 0.0f; - CxIm[1][1] = 0.0f; - CxIm[1][0] = hDiracDecBin->ChCrossIm[bin]; - CxIm[0][1] = -hDiracDecBin->ChCrossIm[bin]; - - /* Make matrix multiplication M*Cx*M' to determine resulting covariance matrix of processing input with M */ - matrixMul( Mre, Mim, CxRe, CxIm, tmpMtxRe, tmpMtxIm ); - matrixTransp2Mul( tmpMtxRe, tmpMtxIm, Mre, Mim, resultMtxRe, resultMtxIm ); - - /* When below the frequency limit where decorrelation is applied, we inject the decorrelated - * residual (or missing) signal component. The procedure is active when there are not enough independent - * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ - if ( bin < max_band_decorr ) + applyLowBitRateEQ = 1; + IF( EQ_32( ivas_total_brate, IVAS_16k4 ) ) { - float decorrelationReductionFactor; - - /* Subtract the resulting covariance matrix from the target covariance matrix to determine - * what signal component is missing. The result is the target covariance matrix for the residual signal, i.e., - * a residual covariance matrix. */ - CrEneL = max( 0.0f, hDiracDecBin->ChEneOut[0][bin] - resultMtxRe[0][0] ); - CrEneR = max( 0.0f, hDiracDecBin->ChEneOut[1][bin] - resultMtxRe[1][1] ); - CrCrossRe = hDiracDecBin->ChCrossReOut[bin] - resultMtxRe[1][0]; - CrCrossIm = hDiracDecBin->ChCrossImOut[bin] - resultMtxIm[1][0]; - - /* The amount of the decorrelated sound is further controlled based on the spatial metadata, - * by determining an energy-suppressed residual covariance matrix that is a control parameter - * that guides the processing of the decorrelated sound to a residual signal. - * The procedure improves quality in e.g. double-talk 2-direction rendering situations.*/ - if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - decorrelationReductionFactor = 1.0f; - } - else if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) || ( ivas_format == MASA_FORMAT && nchan_transport == 1 ) ) - { - decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ) ); - } - else if ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && nchan_transport == 1 ) + FOR( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { - decorrelationReductionFactor = 1.0f; + lowBitRateEQ_fx[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = L_add( L_shr( lowBitRateBinauralEQ_fx[bin], 1 ), ONE_IN_Q30 ); // Q31 } - else + } + ELSE + { + FOR( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) { - decorrelationReductionFactor = fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ); + lowBitRateEQ_fx[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ_fx[bin]; // Q31 + move32(); } - CrEneL *= decorrelationReductionFactor; - CrEneR *= decorrelationReductionFactor; - CrCrossRe *= decorrelationReductionFactor; - CrCrossIm *= decorrelationReductionFactor; - - /* Determine a residual mixing matrix Mdec for processing the decorrelated signal to obtain - * the residual signal (that has the residual covariance matrix) */ - formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], - 0.0f, 0.0f, /* Decorrelated signal has ideally no cross-terms */ - CrEneL, CrEneR, - CrCrossRe, CrCrossIm, - prototypeMtx, MdecRe, MdecIm, 0.2f ); } - else + } + + /* Formulate input and target covariance matrices for this subframe */ + set32_fx( subFrameTotalEne_fx, 0, CLDFB_NO_CHANNELS_MAX ); + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + move16(); + + /* Calculate input covariance matrix */ + FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + { + FOR( bin = 0; bin < nBins; bin++ ) { - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + hDiracDecBin->ChCrossRe_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossRe_fx[bin], hDiracDecBin->ChCrossRe_e[bin], + L_add( L_shr( Mpy_32_32( inRe_fx[0][slot][bin], inRe_fx[1][slot][bin] ), 1 ), L_shr( Mpy_32_32( inIm_fx[0][slot][bin], inIm_fx[1][slot][bin] ), 1 ) ), sub( 63, shl( q, 1 ) ), &hDiracDecBin->ChCrossRe_e[bin] ); + hDiracDecBin->ChCrossIm_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossIm_fx[bin], hDiracDecBin->ChCrossIm_e[bin], + L_sub( L_shr( Mpy_32_32( inRe_fx[0][slot][bin], inIm_fx[1][slot][bin] ), 1 ), L_shr( Mpy_32_32( inIm_fx[0][slot][bin], inRe_fx[1][slot][bin] ), 1 ) ), sub( 63, shl( q, 1 ) ), &hDiracDecBin->ChCrossIm_e[bin] ); + + inRe_fx[0][slot][bin] = L_shr( inRe_fx[0][slot][bin], 2 ); + inRe_fx[1][slot][bin] = L_shr( inRe_fx[1][slot][bin], 2 ); + inIm_fx[0][slot][bin] = L_shr( inIm_fx[0][slot][bin], 2 ); + inIm_fx[1][slot][bin] = L_shr( inIm_fx[1][slot][bin], 2 ); + + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - set_zero( MdecRe[chA], BINAURAL_CHANNELS ); - set_zero( MdecIm[chA], BINAURAL_CHANNELS ); + Word32 instEne_fx; + + instEne_fx = Mpy_32_32( inRe_fx[ch][slot][bin], inRe_fx[ch][slot][bin] ); // 2q - 31 + instEne_fx = L_add( instEne_fx, Mpy_32_32( inIm_fx[ch][slot][bin], inIm_fx[ch][slot][bin] ) ); // 2q - 31 + hDiracDecBin->ChEne_fx[ch][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEne_fx[ch][bin], hDiracDecBin->ChEne_e[ch][bin], instEne_fx, sub( 66, shl( q, 1 ) ), &hDiracDecBin->ChEne_e[ch][bin] ); + subFrameTotalEne_fx[bin] = L_add( subFrameTotalEne_fx[bin], instEne_fx ); // 2q - 31 } } + } - /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ - realizedOutputEne = CrEneL + CrEneR + resultMtxRe[0][0] + resultMtxRe[1][1]; - targetOutputEne = hDiracDecBin->ChEneOut[0][bin] + hDiracDecBin->ChEneOut[1][bin]; - missingOutputEne = fmaxf( 0.0f, targetOutputEne - realizedOutputEne ); + q = sub( q, 2 ); + q_subFrameTotalEne = sub( shl( q, 1 ), 31 ); - gain = sqrtf( ( resultMtxRe[0][0] + resultMtxRe[1][1] + missingOutputEne ) / - fmaxf( 1e-12f, resultMtxRe[0][0] + resultMtxRe[1][1] ) ); - gain = fminf( 4.0f, gain ); + /* Apply EQ at low bit rates */ + IF( NE_16( applyLowBitRateEQ, 0 ) ) + { + Word16 lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + FOR( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - Mre[chA][chB] *= gain; - Mim[chA][chB] *= gain; - } + subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[bin] ); // 2q -31 + } + FOR( ; bin < nBins; bin++ ) + { + subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[lastEqBin] ); // 2q -31 } + } - /* Store processing matrices */ - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + IF( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && nchan_transport == 2 ) + { + Word32 tempRe, tempIm; + Word32 subFrameSumEne_fx[CLDFB_NO_CHANNELS_MAX]; + + scale_sig32( subFrameTotalEne_fx, nBins, -2 ); + q_subFrameTotalEne = sub( q_subFrameTotalEne, 1 ); + + set32_fx( subFrameSumEne_fx, 0, CLDFB_NO_CHANNELS_MAX ); + FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + FOR( bin = 0; bin < nBins; bin++ ) { - hDiracDecBin->processMtxRePrev[chA][chB][bin] = hDiracDecBin->processMtxRe[chA][chB][bin]; - hDiracDecBin->processMtxImPrev[chA][chB][bin] = hDiracDecBin->processMtxIm[chA][chB][bin]; - hDiracDecBin->processMtxDecRePrev[chA][chB][bin] = hDiracDecBin->processMtxDecRe[chA][chB][bin]; - hDiracDecBin->processMtxDecImPrev[chA][chB][bin] = hDiracDecBin->processMtxDecIm[chA][chB][bin]; - - hDiracDecBin->processMtxRe[chA][chB][bin] = Mre[chA][chB]; - hDiracDecBin->processMtxIm[chA][chB][bin] = Mim[chA][chB]; - hDiracDecBin->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; - hDiracDecBin->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; + tempRe = L_add( inRe_fx[0][slot][bin], inRe_fx[1][slot][bin] ); // q + tempIm = L_add( inIm_fx[0][slot][bin], inIm_fx[1][slot][bin] ); // q + subFrameSumEne_fx[bin] = L_add( subFrameSumEne_fx[bin], L_add( L_shr( Mpy_32_32( tempRe, tempRe ), 1 ), L_shr( Mpy_32_32( tempIm, tempIm ), 1 ) ) ); // 2q -31 } } - - if ( separateCenterChannelRendering ) + FOR( bin = 0; bin < nBins; bin++ ) { - /* The rendering of the separate center channel in masa + mono mode. - * The center channel is processed with a gain factor 0.8414f to match the loudness of different processing paths */ - float lRealp, lImagp, rRealp, rImagp; - float gainFactor; - int16_t aziDeg = 0; - int16_t eleDeg = 0; - uint8_t instantChange = 0; + subFrameTotalEne_fx[bin] = L_max( subFrameTotalEne_fx[bin], subFrameSumEne_fx[bin] ); // 2q -31 + } + } - if ( ivas_format == MASA_ISM_FORMAT ) + /* Determine target covariance matrix containing target binaural properties */ + FOR( bin = 0; bin < nBins; bin++ ) + { + Word32 diffuseness_fx = ONE_IN_Q30; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + Word32 diffusenessValForDecorrelationReduction_fx = ONE_IN_Q30; + Word32 diffEneValForDecorrelationReduction_fx; + Word16 q_diffEneValForDecorrelationReduction; + Word16 surCoh_fx = 0, spreadCoh_fx = 0; /* Default values if spreadSurroundCoherenceApplied == false */ + Word32 diffEne_fx, dirEne_fx, meanEnePerCh_fx; + Word16 q_meanEnePerCh; + Word16 q_diffEne, q_dirEne; + Word16 dirIndex; + + /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. + * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the + * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match + * the early spectrum of the BRIR data, using the spectral correction data in + * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ + meanEnePerCh_fx = Mpy_32_32( hDiracDecBin->earlyPartEneCorrection_fx[bin], subFrameTotalEne_fx[bin] ); // Q( 2q - 31 ) + q_meanEnePerCh = sub(add(q_earlyPartEneCorrection, q_subFrameTotalEne), 30); + /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + FOR( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) + { + Word16 aziDeg, eleDeg; + Word32 lRealp_fx, lImagp_fx, rRealp_fx, rImagp_fx; + Word32 lRealpTmp_fx, lImagpTmp_fx, rRealpTmp_fx, rImagpTmp_fx; + Word32 hrtfEne_fx[BINAURAL_CHANNELS], hrtfCrossRe_fx, hrtfCrossIm_fx, ratio_fx; + UWord8 isIsmDirection = 0; + + IF( EQ_16( dirIndex, 0 ) ) /* For first of the two simultaneous directions */ { - gainFactor = 0.7943f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); + aziDeg = hSpatParamRendCom->azimuth[dirac_read_idx][bin]; + move16(); + eleDeg = hSpatParamRendCom->elevation[dirac_read_idx][bin]; + move16(); + ratio_fx = hSpatParamRendCom->energy_ratio1_fx[dirac_read_idx][bin]; + move32(); + spreadCoh_fx = hSpatParamRendCom->spreadCoherence_fx[dirac_read_idx][bin]; + move16(); + gainCacheBaseIndex = 0; + move16(); } - else + ELSE IF( ivas_format != MASA_ISM_FORMAT || ( ivas_format == MASA_ISM_FORMAT && LT_16( dirIndex, hSpatParamRendCom->numParametricDirections ) ) ) /* For second of the two simultaneous directions */ { - gainFactor = 0.8414f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); + IF( LT_32( ( ratio_fx = hSpatParamRendCom->energy_ratio2_fx[dirac_read_idx][bin] ), 10737418 /* 0.01 in Q30 */ ) ) + { + /* This touches only MASA path where second direction always has smaller ratio and + * for non-2dir it is zero. As the whole direction contribution is multiplied with + * the ratio, a very small ratio does not contribute any energy to output. Thus, + * it is better to save complexity. */ + continue; + } + aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; + move16(); + eleDeg = hSpatParamRendCom->elevation2[dirac_read_idx][bin]; + move16(); + spreadCoh_fx = hSpatParamRendCom->spreadCoherence2_fx[dirac_read_idx][bin]; + move16(); + gainCacheBaseIndex = 3; + move16(); } - - for ( chB = 0; chB < nchanSeparateChannels; chB++ ) + ELSE /* For object directions of MASA_ISM_FORMAT */ { - if ( ivas_format == MASA_ISM_FORMAT ) + isIsmDirection = 1; + move16(); + UWord16 ismDirIndex; + ismDirIndex = sub(dirIndex, hSpatParamRendCom->numParametricDirections); + assert( hMasaIsmData != NULL && "hMasaIsmData should not be NULL if we use it" ); + IF( hMasaIsmData->ism_is_edited[ismDirIndex] ) { - if ( ism_mode == ISM_MASA_MODE_DISC ) - { - aziDeg = hMasaIsmData->azimuth_ism[chB][dirac_read_idx]; - eleDeg = hMasaIsmData->elevation_ism[chB][dirac_read_idx]; - } - else - { - aziDeg = hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; - eleDeg = hMasaIsmData->elevation_separated_ism[dirac_read_idx]; - instantChange = 1; - } + aziDeg = hMasaIsmData->azimuth_ism_edited[ismDirIndex]; + move16(); + eleDeg = hMasaIsmData->elevation_ism_edited[ismDirIndex]; + move16(); + } + ELSE + { + aziDeg = hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx]; + move16(); + eleDeg = hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx]; + move16(); } + ratio_fx = hMasaIsmData->energy_ratio_ism_fx[ismDirIndex][dirac_read_idx][bin]; + move32(); + spreadCoh_fx = 0; + move16(); + gainCacheBaseIndex = add( 6, ismDirIndex ); + } - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + diffuseness_fx = L_sub( diffuseness_fx, ratio_fx ); /* diffuseness = 1 - ratio1 - ratio2 */ + + IF( LT_32( diffuseness_fx, 0 ) ) + { + diffuseness_fx = 0; + move32(); + } + IF( isIsmDirection ) + { + /* Objects cause lesser decorrelation reduction, to avoid removing all decorrelation when only objects are present */ + diffusenessValForDecorrelationReduction_fx = L_sub( diffusenessValForDecorrelationReduction_fx, L_shr( ratio_fx, 1 ) ); + } + ELSE + { + diffusenessValForDecorrelationReduction_fx = L_sub( diffusenessValForDecorrelationReduction_fx, ratio_fx ); + } + + IF( separateCenterChannelRendering ) + { + /* In masa + mono rendering mode, the center directions originate from phantom sources, so the + * spread coherence is increased */ + Word16 azi_scaled, ele_scaled; + Word32 doaVectorX_fx, num, den; + Word16 e = 0, spatialAngleDeg_fx, altSpreadCoh_fx; + + azi_scaled = i_mult( aziDeg, 91 ); + ele_scaled = i_mult( eleDeg, 91 ); + doaVectorX_fx = L_mult( getCosWord16R2( azi_scaled ), getCosWord16R2( ele_scaled ) ); + num = Sqrt32( L_sub( ONE_IN_Q31, Mpy_32_32( doaVectorX_fx, doaVectorX_fx ) ), &e ); + den = doaVectorX_fx; + spatialAngleDeg_fx = BASOP_util_atan2( num, den, e ); // Q13 + Word16 numr, num_e = 0, denr, den_e; + num_e = norm_s( spatialAngleDeg_fx ) - 1; + numr = shl( spatialAngleDeg_fx, num_e ); + denr = 17157; + move16(); + den_e = 4; + move16(); + altSpreadCoh_fx = sub( 32767, shl_sat( div_s( numr, denr ), sub( den_e, num_e ) ) ); // 4289 = pi/6 in Q13 + spreadCoh_fx = s_max( spreadCoh_fx, altSpreadCoh_fx ); + } + + getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex], isHeadtracked ); + + Word16 q_lr = Q28; + move16(); + IF( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + /* Synthesizing spread coherence is not needed for stereo loudspeaker output, + * as directional sound is reproduced with two loudspeakers in any case */ + spreadCoh_fx = 0; + move32(); + } + + IF( spreadCoh_fx > 0 ) + { + Word32 centerMul_fx, sidesMul_fx; + Word32 hrtfEneCenter_fx, hrtfEneSides_fx, hrtfEneRealized_fx; + Word16 eneCorrectionFactor_fx, eneCorrectionFactor_e; + Word16 w1_fx, w2_fx, w3_fx, eq_fx; + + hrtfEneCenter_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q25 + L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q25 + L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q25 + Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q25 + + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. + * The following formulas determine the gains for these sources. + * spreadCoh = 0: Only panning + * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) + * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ + IF( LT_16( spreadCoh_fx, 16384 ) ) { - hDiracDecBin->processMtxRePrev[chA][chB + 2][bin] = hDiracDecBin->processMtxRe[chA][chB + 2][bin]; - hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; + /* 0.0f < spreadCoh < 0.5f */ + sidesMul_fx = L_mult0( spreadCoh_fx, 9459 ); /* 2*sqrt(1/3) in Q13 = 9459 */ // Q28 + centerMul_fx = L_add( L_sub( ONE_IN_Q28, L_shl( spreadCoh_fx, 14 ) ), sidesMul_fx ); // Q28 + } + ELSE + { + /* 0.5f <= spreadCoh < 1.0f */ + // centerMul = 2.0f - ( 2.0f * spreadCoh ); + centerMul_fx = L_shl( sub( 32767, spreadCoh_fx ), 14 ); // Q28 + sidesMul_fx = Isqrt( L_add( L_shr( centerMul_fx, 22 ), L_shl( 2, Q6 ) ) ); // Q28 + centerMul_fx = L_shl( Mpy_32_32( centerMul_fx, sidesMul_fx ), 3 ); // Q28 } - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); + /* Apply the gain for the center source of the three coherent sources */ + lRealp_fx = Mpy_32_32( lRealp_fx, centerMul_fx ); // Q25 + lImagp_fx = Mpy_32_32( lImagp_fx, centerMul_fx ); // Q25 + rRealp_fx = Mpy_32_32( rRealp_fx, centerMul_fx ); // Q25 + rImagp_fx = Mpy_32_32( rImagp_fx, centerMul_fx ); // Q25 - hDiracDecBin->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; - hDiracDecBin->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; - hDiracDecBin->processMtxRe[1][chB + 2][bin] = rRealp * gainFactor; - hDiracDecBin->processMtxIm[1][chB + 2][bin] = rImagp * gainFactor; + /* Apply the gain for the left source of the three coherent sources */ + getDirectPartGains_fx( bin, aziDeg + 30, eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); - if ( instantChange ) + hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 + L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 + L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 + Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ); // Q25 + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 + lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 + rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 + rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 + + /* Apply the gain for the right source of the three coherent sources. + * -30 degrees to 330 wrapping due to internal functions. */ + + getDirectPartGains_fx( bin, aziDeg + 330, eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); + + hrtfEneSides_fx = L_add( hrtfEneSides_fx, + L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ), // Q25 + L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ), // Q25 + L_add( Mpy_32_32( rRealpTmp_fx, rRealpTmp_fx ), // Q25 + Mpy_32_32( rImagpTmp_fx, rImagpTmp_fx ) ) ) ) ); // Q25 + lRealp_fx = L_add( lRealp_fx, Mpy_32_32( sidesMul_fx, lRealpTmp_fx ) ); // Q25 + lImagp_fx = L_add( lImagp_fx, Mpy_32_32( sidesMul_fx, lImagpTmp_fx ) ); // Q25 + rRealp_fx = L_add( rRealp_fx, Mpy_32_32( sidesMul_fx, rRealpTmp_fx ) ); // Q25 + rImagp_fx = L_add( rImagp_fx, Mpy_32_32( sidesMul_fx, rImagpTmp_fx ) ); // Q25 + + /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ + hrtfEneRealized_fx = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), // Q19 + L_add( Mpy_32_32( lImagp_fx, lImagp_fx ), // Q19 + L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), // Q19 + Mpy_32_32( rImagp_fx, rImagp_fx ) ) ) ); // Q19 + + eneCorrectionFactor_fx = BASOP_Util_Divide3232_Scale( L_add( Mpy_32_32( hrtfEneSides_fx, Mpy_32_32( sidesMul_fx, sidesMul_fx ) ), + Mpy_32_32( hrtfEneCenter_fx, Mpy_32_32( centerMul_fx, centerMul_fx ) ) ), + L_max( 1, hrtfEneRealized_fx ), &eneCorrectionFactor_e ); + + /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ + IF( LT_16( spreadCoh_fx, 16384 ) ) { - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + w1_fx = sub( 32767, shl( spreadCoh_fx, 1 ) ); + w2_fx = shl( spreadCoh_fx, 1 ); + w3_fx = 0; + move16(); + } + ELSE + { + w1_fx = 0; + move16(); + w2_fx = shl( sub( 32767, spreadCoh_fx ), 1 ); + w3_fx = shl( sub( spreadCoh_fx, 16384 ), 1 ); + } + + IF( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + { + idx = s_min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + + /* Apply the target spectrum to the eneCorrectionFactor */ + IF( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ { - hDiracDecBin->processMtxRePrev[chA][chB + 2][bin] = hDiracDecBin->processMtxRe[chA][chB + 2][bin]; - hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; + eneCorrectionFactor_fx = mult_r( eneCorrectionFactor_fx, add( mult_r( w1_fx, 8192 ), shr( mult_r( add( w2_fx, w3_fx ), spreadCohEne1_fx[idx] ), 1 ) ) ); + eneCorrectionFactor_e = add( eneCorrectionFactor_e, 2 ); } + ELSE + { + eneCorrectionFactor_fx = mult_r( eneCorrectionFactor_fx, add( mult_r( w1_fx, 4096 ), add( shr( mult_r( w2_fx, spreadCohEne05_fx[idx] ), 1 ), shr( mult_r( w3_fx, spreadCohEne1_fx[idx] ), 2 ) ) ) ); + eneCorrectionFactor_e = add( eneCorrectionFactor_e, 3 ); + } + } + + /* Equalize the spread coherent combined HRTFs */ + Word16 tmp, tmp_e; + tmp_e = eneCorrectionFactor_e; + tmp = Sqrt16( eneCorrectionFactor_fx, &tmp_e ); + IF( shr( tmp, sub( 15, tmp_e ) ) >= 4 ) + { + eq_fx = 32767; // Q13 + move16(); } + ELSE + { + eq_fx = shl( tmp, sub( tmp_e, 2 ) ); // Q13 + } + + lRealp_fx = Mpy_32_16_1( lRealp_fx, eq_fx ); // Q23 + lImagp_fx = Mpy_32_16_1( lImagp_fx, eq_fx ); // Q23 + rRealp_fx = Mpy_32_16_1( rRealp_fx, eq_fx ); // Q23 + rImagp_fx = Mpy_32_16_1( rImagp_fx, eq_fx ); // Q23 + q_lr = Q23; + move16(); } - } - } - return; -} + hrtfEne_fx[0] = L_add( Mpy_32_32( lRealp_fx, lRealp_fx ), Mpy_32_32( lImagp_fx, lImagp_fx ) ); // Q( 2*q_lr - 31 ) + hrtfEne_fx[1] = L_add( Mpy_32_32( rRealp_fx, rRealp_fx ), Mpy_32_32( rImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) + hrtfCrossRe_fx = L_add( Mpy_32_32( lRealp_fx, rRealp_fx ), Mpy_32_32( lImagp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) + hrtfCrossIm_fx = L_add( Mpy_32_32( -lImagp_fx, rRealp_fx ), Mpy_32_32( lRealp_fx, rImagp_fx ) ); // Q( 2*q_lr - 31 ) + /* Add direct part (1 or 2) covariance matrix */ + dirEne_fx = Mpy_32_32( ratio_fx, meanEnePerCh_fx ); // Q(q_meanEnePerCh - 1) + shift = norm_l( dirEne_fx ); + dirEne_fx = L_shl( dirEne_fx, shift ); + q_dirEne = add( sub( q_meanEnePerCh, 1 ), shift ); -#ifdef IVAS_FLOAT_FIXED -static void ivas_dirac_dec_binaural_process_output_fx( - DIRAC_DEC_BIN_HANDLE hDiracDecBin, - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, - HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], - Word32 *output_fx[], - Word16 *q_out, - Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const Word16 q_input, - const Word16 max_band_decorr, - const Word16 numInChannels, - const Word16 processReverb, - const Word16 subframe, - const Word16 q_mat) -{ - Word16 slot, bin, chA, chB; - Word16 nBins; - Word16 offsetSamples; - Word16 nSlots; + hDiracDecBin->ChEneOut_fx[0][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_e[0][bin], Mpy_32_32( dirEne_fx, hrtfEne_fx[0] ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChEneOut_e[0][bin] ); /* Dir ene part*/ + hDiracDecBin->ChEneOut_fx[1][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[1][bin], hDiracDecBin->ChEneOut_e[1][bin], Mpy_32_32( dirEne_fx, hrtfEne_fx[1] ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChEneOut_e[1][bin] ); + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( dirEne_fx, hrtfCrossRe_fx ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChCrossReOut_e[bin] ); /* Dir cross re */ + hDiracDecBin->ChCrossImOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->ChCrossImOut_e[bin], Mpy_32_32( dirEne_fx, hrtfCrossIm_fx ), sub( 31, q_dirEne + shl( q_lr, 1 ) - 62 ), &hDiracDecBin->ChCrossImOut_e[bin] ); /* Dir cross im */ + } - nBins = hSpatParamRendCom->num_freq_bands; - offsetSamples = 0; - nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; + /* Add diffuse / ambient part covariance matrix */ + diffuseness_fx = L_max( 0, diffuseness_fx ); // Q30 + diffEne_fx = Mpy_32_32( diffuseness_fx, meanEnePerCh_fx ); // Q(2q - 32) + shift = norm_l( diffEne_fx ); + diffEne_fx = L_shl( diffEne_fx, shift ); + q_diffEne = add( shift, sub( q_meanEnePerCh, 1 ) ); - Word32 decSlotRe_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - Word32 outSlotRe_fx[CLDFB_NO_CHANNELS_MAX], outSlotIm_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 reverbRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 reverbIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word16 q_inp[6][CLDFB_SLOTS_PER_SUBFRAME]; - Word16 interpVal_fx; - Word32 *decSlotRePointer_fx; - Word32 *decSlotImPointer_fx; - Word16 q_inp_mix, q_reverb = 31; + surCoh_fx = hSpatParamRendCom->surroundingCoherence_fx[dirac_read_idx][bin]; // Q15 + move16(); + diffusenessValForDecorrelationReduction_fx = L_max( 0, diffusenessValForDecorrelationReduction_fx ); // Q30 + diffEneValForDecorrelationReduction_fx = Mpy_32_32( diffusenessValForDecorrelationReduction_fx, meanEnePerCh_fx ); // Q(2q - 32) + q_diffEneValForDecorrelationReduction = sub( shl( q, 1 ), 32 ); - IF( processReverb ) - { - /* Process second / room effect part of binaural output when needed */ - ivas_binaural_reverb_processSubframe_fx( hDiracDecBin->hReverb, numInChannels, nSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx ); - } + IF( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) ) + { + IF( !hDiracDecBin->renderStereoOutputInsteadOfBinaural ) + { + Word32 spectrumModVal; - // scaling input and reverb to same q// - // input scaling is to maintain precision in ivas_dirac_dec_decorrelate_slot fn// - Word16 shift = s_min( L_norm_arr( cldfbSynDec[0]->cldfb_state_fx, cldfbSynDec[0]->p_filter_length ), L_norm_arr( cldfbSynDec[1]->cldfb_state_fx, cldfbSynDec[1]->p_filter_length ) ); - q_inp_mix = 31; - FOR( Word16 i = 0; i < 6; i++ ) - { - FOR( Word16 j = 0; j < nSlots; j++ ) + idx = s_min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + spectrumModVal = L_add( L_sub( ONE_IN_Q28, L_shl( surCoh_fx, 14 ) ), L_mult( surCoh_fx, surCohEne_fx[idx] ) ); // Q29 + diffEne_fx = Mpy_32_32( diffEne_fx, spectrumModVal ); // Q-2 + q_diffEne = sub( q_diffEne, 2 ); + /* Modify also the value for decorrelation reduction */ + diffEneValForDecorrelationReduction_fx = Mpy_32_32( diffEneValForDecorrelationReduction_fx, spectrumModVal ); // Q-2 + q_diffEneValForDecorrelationReduction = sub( q_diffEneValForDecorrelationReduction, 2 ); + } + } + hDiracDecBin->ChEneOut_fx[0][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[0][bin], hDiracDecBin->ChEneOut_e[0][bin], diffEne_fx, sub( 31, q_diffEne ), &hDiracDecBin->ChEneOut_e[0][bin] ); /* Diff ene part*/ + hDiracDecBin->ChEneOut_fx[1][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[1][bin], hDiracDecBin->ChEneOut_e[1][bin], diffEne_fx, sub( 31, q_diffEne ), &hDiracDecBin->ChEneOut_e[1][bin] ); + + IF( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { - q_inp[i][j] = s_min( L_norm_arr( inRe_fx[i][j], nBins ), L_norm_arr( inIm_fx[i][j], nBins ) ); - IF( ( processReverb ) && ( i < 2 ) ) + /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_16_1( diffEne_fx, surCoh_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); + } + ELSE /* When rendering binaural, ambience has frequency dependent ICC. */ + { + IF( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && LT_16( bin, BINAURAL_COHERENCE_DIFFERENCE_BINS ) ) { - q_reverb = s_min( L_norm_arr( reverbRe_fx[i][j], CLDFB_NO_CHANNELS_MAX ), L_norm_arr( reverbIm_fx[i][j], CLDFB_NO_CHANNELS_MAX ) ); - q_inp[i][j] = s_min( q_reverb, q_inp[i][j] ); + Word32 diffuseFieldCoherence_fx; + diffuseFieldCoherence_fx = L_add( L_add( Mpy_32_32( hDiracDecBin->hDiffuseDist->diffuseRatioX_fx[bin], hDiracDecBin->diffuseFieldCoherenceX_fx[bin] ), Mpy_32_32( hDiracDecBin->hDiffuseDist->diffuseRatioY_fx[bin], hDiracDecBin->diffuseFieldCoherenceY_fx[bin] ) ), Mpy_32_32( hDiracDecBin->hDiffuseDist->diffuseRatioZ_fx[bin], hDiracDecBin->diffuseFieldCoherenceZ_fx[bin] ) ); + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( L_add( Mpy_32_16_1( diffuseFieldCoherence_fx, sub( 32767, surCoh_fx ) ), L_shl( surCoh_fx, 16 ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); + } + ELSE + { + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( L_add( Mpy_32_16_1( hDiracDecBin->diffuseFieldCoherence_fx[bin], sub( 32767, surCoh_fx ) ), L_shl( surCoh_fx, 16 ) ), diffEne_fx ), sub( 31, q_diffEne ), &hDiracDecBin->ChCrossReOut_e[bin] ); } - q_inp_mix = s_min( q_inp[i][j], q_inp_mix ); } + + /* Store parameters for formulating average diffuseness over frame */ + hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_add( hDiracDecBin->frameMeanDiffuseness_fx[bin], L_shl( diffEneValForDecorrelationReduction_fx, sub( q_meanEnePerCh, q_diffEneValForDecorrelationReduction ) ) ); // Q(q_meanEnePerCh) + frameMeanDiffusenessEneWeight_fx[bin] = L_add( frameMeanDiffusenessEneWeight_fx[bin], meanEnePerCh_fx ); } - - q_inp_mix = sub( q_inp_mix, 3 ); // gaurded bits// - Word16 cldfb_state_shift = sub( add( add( q_inp_mix, q_mat ), sub( q_input, 16 ) ), cldfbSynDec[0]->Q_cldfb_state ); - IF( GT_16( cldfb_state_shift, shift ) ) + /* Formulate average diffuseness over frame */ + Word16 e; + FOR( bin = 0; bin < nBins; bin++ ) { - q_inp_mix = q_inp_mix + shift - cldfb_state_shift; - cldfb_state_shift = shift; + e = 0; + move16(); + hDiracDecBin->frameMeanDiffuseness_fx[bin] = BASOP_Util_Divide3232_Scale( hDiracDecBin->frameMeanDiffuseness_fx[bin], L_max( EPSILLON_FX, frameMeanDiffusenessEneWeight_fx[bin] ), &e ); + hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( hDiracDecBin->frameMeanDiffuseness_fx[bin], 14 + e ); // Q29 } - FOR( Word16 i = 0; i < 6; i++ ) + /* Temporal IIR-type smoothing of covariance matrices. Also apply encoding quality based smoothing factor. */ + IF( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) { - FOR( Word16 j = 0; j < nSlots; j++ ) - { - - scale_sig32(inRe_fx[i][j], nBins, q_inp_mix); - scale_sig32(inIm_fx[i][j], nBins, q_inp_mix); - IF( processReverb && ( i < 2 ) ) - { - scale_sig32( reverbRe_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub( add( q_inp_mix, q_mat ), 15 ) ); - scale_sig32( reverbIm_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub( add( q_inp_mix, q_mat ), 15 ) ); - } - } + IIReneLimiterFactor_fx = L_add( L_shl( 16, Q26 ), L_sub( L_shl( 1, Q26 ), L_shr( qualityBasedSmFactor_fx, 5 ) ) ); // Q26 + } + ELSE + { + IIReneLimiterFactor_fx = L_add( L_shl( 8, Q26 ), L_sub( L_shl( 1, Q26 ), L_shr( qualityBasedSmFactor_fx, 5 ) ) ); // Q26 } - // scaling cldfb states to q_result-1// - scale_sig32( cldfbSynDec[0]->cldfb_state_fx, cldfbSynDec[0]->p_filter_length, cldfb_state_shift ); - scale_sig32( cldfbSynDec[1]->cldfb_state_fx, cldfbSynDec[1]->p_filter_length, cldfb_state_shift ); - - q_inp_mix = add( q_inp_mix, q_input ); - - interpVal_fx = 0; - Word16 q_result = sub( add( q_inp_mix, q_mat ), 15 ); // setting it prior// - cldfbSynDec[0]->Q_cldfb_state = sub( q_result, 1 ); - cldfbSynDec[1]->Q_cldfb_state = sub( q_result, 1 ); - - FOR( slot = 0; slot < nSlots; slot++ ) + FOR( bin = 0; bin < nBins; bin++ ) { - IF( NE_16( slot, sub( nSlots, 1 ) ) ) + Word32 IIReneLimiter_fx; + + /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that + * the energy history (IIR) must not be more than double of the current frame energy. This provides more + * robust performance at energy offsets when compared to typical IIR averaging. */ + Word16 num_e, den_e; + Word32 num, den; + num = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEne_fx[0][bin], hDiracDecBin->ChEne_e[0][bin], hDiracDecBin->ChEne_fx[1][bin], hDiracDecBin->ChEne_e[1][bin], &num_e ); + num = Mpy_32_32( num, IIReneLimiterFactor_fx ); + den_e = 0; + move16(); + den = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEnePrev_fx[0][bin], hDiracDecBin->ChEnePrev_e[0][bin], hDiracDecBin->ChEnePrev_fx[1][bin], hDiracDecBin->ChEnePrev_e[1][bin], &den_e ); + den = L_max( 1, den ); + IIReneLimiter_fx = BASOP_Util_Divide3232_Scale_cadence( num, den, &e ); + e = add( sub( num_e, den_e ), add( 5, e ) ); + IF( L_shr_sat( IIReneLimiter_fx, 31 - e ) > 0 ) { - interpVal_fx = add( interpVal_fx, slot_fx[nSlots - 1] ); + IIReneLimiter_fx = ONE_IN_Q31; } ELSE { - interpVal_fx = 32767; - } - IF( !hDiracDecBin->useTdDecorr && (GT_16(max_band_decorr , 0)) ) - { - ivas_dirac_dec_decorrelate_slot_fx( hDiracDecBin, nBins, slot, inRe_fx, inIm_fx, q_inp_mix, decSlotRe_fx, decSlotIm_fx ); + IIReneLimiter_fx = L_shl( IIReneLimiter_fx, e ); } - FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - Word32 *outSlotRePr_fx, *outSlotImPr_fx; /* Pointers needed for function call compatibility */ - - set_zero_fx( outSlotRe_fx, CLDFB_NO_CHANNELS_MAX ); - set_zero_fx( outSlotIm_fx, CLDFB_NO_CHANNELS_MAX ); - - /* Processing of the first / HRTF part of the binaural output. */ - FOR( chB = 0; chB < numInChannels; chB++ ) - { - IF( LT_16( chB, BINAURAL_CHANNELS ) ) - { - /* Decorrelator signal for TD decorrelation is stored in two input channels above the two normal inputs. - * It should be noted that TD decorrelation is used only in cases where numInChannels is 2. If this - * changes, additional adjustments are required. When using CLDFB decorrelator, we simply assign the - * pointers to buffers. */ - IF( hDiracDecBin->useTdDecorr ) - { - decSlotRePointer_fx = inRe_fx[chB + 2][slot]; - decSlotImPointer_fx = inIm_fx[chB + 2][slot]; - } - ELSE - { - decSlotRePointer_fx = decSlotRe_fx[chB]; - decSlotImPointer_fx = decSlotIm_fx[chB]; - } - } - ELSE - { - decSlotRePointer_fx = NULL; /* below these pointers are used only for chB < 2 */ - decSlotImPointer_fx = NULL; - } - - - FOR( bin = 0; bin < nBins; bin++ ) - { - Word16 gain; - - /* Mixing using the formulated processing matrix M */ - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ) ); // Q11 - - outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ) ); // Q11 - - // interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; - outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - - - /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ - IF( bin < max_band_decorr && chB < 2 ) - { - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); - // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; - outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - - - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ) ); - outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - } - } - } + hDiracDecBin->ChCrossRe_fx[bin] = Mpy_32_32( hDiracDecBin->ChCrossRe_fx[bin], qualityBasedSmFactor_fx ); + hDiracDecBin->ChCrossIm_fx[bin] = Mpy_32_32( hDiracDecBin->ChCrossIm_fx[bin], qualityBasedSmFactor_fx ); + hDiracDecBin->ChCrossReOut_fx[bin] = Mpy_32_32( hDiracDecBin->ChCrossReOut_fx[bin], qualityBasedSmFactor_fx ); + hDiracDecBin->ChCrossImOut_fx[bin] = Mpy_32_32( hDiracDecBin->ChCrossImOut_fx[bin], qualityBasedSmFactor_fx ); + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne_fx[ch][bin] = Mpy_32_32( hDiracDecBin->ChEne_fx[ch][bin], qualityBasedSmFactor_fx ); + hDiracDecBin->ChEneOut_fx[ch][bin] = Mpy_32_32( hDiracDecBin->ChEneOut_fx[ch][bin], qualityBasedSmFactor_fx ); + } - IF( processReverb ) - { - /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ - v_add_fx( outSlotRe_fx, reverbRe_fx[chA][slot], outSlotRe_fx, CLDFB_NO_CHANNELS_MAX ); - v_add_fx( outSlotIm_fx, reverbIm_fx[chA][slot], outSlotIm_fx, CLDFB_NO_CHANNELS_MAX ); - } + hDiracDecBin->ChCrossRe_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossRe_fx[bin], hDiracDecBin->ChCrossRe_e[bin], Mpy_32_32( hDiracDecBin->ChCrossRePrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossRePrev_e[bin], &hDiracDecBin->ChCrossRe_e[bin] ); + hDiracDecBin->ChCrossIm_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossIm_fx[bin], hDiracDecBin->ChCrossIm_e[bin], Mpy_32_32( hDiracDecBin->ChCrossImPrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossImPrev_e[bin], &hDiracDecBin->ChCrossIm_e[bin] ); + hDiracDecBin->ChCrossReOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossReOut_fx[bin], hDiracDecBin->ChCrossReOut_e[bin], Mpy_32_32( hDiracDecBin->ChCrossReOutPrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossReOutPrev_e[bin], &hDiracDecBin->ChCrossReOut_e[bin] ); + hDiracDecBin->ChCrossImOut_fx[bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChCrossImOut_fx[bin], hDiracDecBin->ChCrossImOut_e[bin], Mpy_32_32( hDiracDecBin->ChCrossImOutPrev_fx[bin], IIReneLimiter_fx ), hDiracDecBin->ChCrossImOutPrev_e[bin], &hDiracDecBin->ChCrossImOut_e[bin] ); + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEne_fx[ch][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEne_fx[ch][bin], hDiracDecBin->ChEne_e[ch][bin], Mpy_32_32( hDiracDecBin->ChEnePrev_fx[ch][bin], IIReneLimiter_fx ), hDiracDecBin->ChEnePrev_e[ch][bin], &hDiracDecBin->ChEne_e[ch][bin] ); + hDiracDecBin->ChEneOut_fx[ch][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEneOut_fx[ch][bin], hDiracDecBin->ChEneOut_e[ch][bin], Mpy_32_32( hDiracDecBin->ChEneOutPrev_fx[ch][bin], IIReneLimiter_fx ), hDiracDecBin->ChEneOutPrev_e[ch][bin], &hDiracDecBin->ChEneOut_e[ch][bin] ); + } - outSlotRePr_fx = &( outSlotRe_fx[0] ); - outSlotImPr_fx = &( outSlotIm_fx[0] ); + /* Store energy values and coefficients for next round */ + hDiracDecBin->ChCrossRePrev_fx[bin] = hDiracDecBin->ChCrossRe_fx[bin]; + move32(); + hDiracDecBin->ChCrossImPrev_fx[bin] = hDiracDecBin->ChCrossIm_fx[bin]; + move32(); + hDiracDecBin->ChCrossReOutPrev_fx[bin] = hDiracDecBin->ChCrossReOut_fx[bin]; + move32(); + hDiracDecBin->ChCrossImOutPrev_fx[bin] = hDiracDecBin->ChCrossImOut_fx[bin]; + move32(); + hDiracDecBin->ChCrossRePrev_e[bin] = hDiracDecBin->ChCrossRe_e[bin]; + move16(); + hDiracDecBin->ChCrossImPrev_e[bin] = hDiracDecBin->ChCrossIm_e[bin]; + move16(); + hDiracDecBin->ChCrossReOutPrev_e[bin] = hDiracDecBin->ChCrossReOut_e[bin]; + move16(); + hDiracDecBin->ChCrossImOutPrev_e[bin] = hDiracDecBin->ChCrossImOut_e[bin]; + move16(); - cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); - cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + hDiracDecBin->ChEnePrev_fx[ch][bin] = hDiracDecBin->ChEne_fx[ch][bin]; + move32(); + hDiracDecBin->ChEneOutPrev_fx[ch][bin] = hDiracDecBin->ChEneOut_fx[ch][bin]; + move32(); + hDiracDecBin->ChEnePrev_e[ch][bin] = hDiracDecBin->ChEne_e[ch][bin]; + move16(); + hDiracDecBin->ChEneOutPrev_e[ch][bin] = hDiracDecBin->ChEneOut_e[ch][bin]; + move16(); } } - *q_out = sub( q_result, 1 ); + return; } +#endif -#else -static void ivas_dirac_dec_binaural_process_output( +static void ivas_dirac_dec_binaural_determine_processing_matrices( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, - HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], - float *output_f[], - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + PARAMBIN_REND_CONFIG_HANDLE hConfig, const int16_t max_band_decorr, - const int16_t numInChannels, - const int16_t processReverb, - const int16_t subframe ) + float Rmat[3][3], + const int16_t subframe, + const int16_t isHeadtracked, + const int16_t nchanSeparateChannels, + const MASA_ISM_DATA_HANDLE hMasaIsmData ) { - int16_t slot, bin, chA, chB; + int16_t chA, chB, bin; + int16_t separateCenterChannelRendering; int16_t nBins; - float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; - float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float interpVal; - float *decSlotRePointer; - float *decSlotImPointer; - int16_t offsetSamples; - int16_t nSlots; + int16_t dirac_read_idx; + PARAMBIN_HRTF_GAIN_CACHE gainCache[MAX_NUM_OBJECTS]; + int16_t idx; + ISM_MODE ism_mode; + IVAS_FORMAT ivas_format; + MC_MODE mc_mode; + int32_t ivas_total_brate; + int16_t nchan_transport; - nBins = hSpatParamRendCom->num_freq_bands; - offsetSamples = 0; - nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; + ivas_format = hConfig->ivas_format; + separateCenterChannelRendering = nchanSeparateChannels > 0; + mc_mode = hConfig->mc_mode; + ivas_total_brate = hConfig->ivas_total_brate; + nchan_transport = hConfig->nchan_transport; + nBins = hSpatParamRendCom->num_freq_bands; /* Actually bins */ - if ( processReverb ) + ism_mode = hConfig->ism_mode; + + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + + for ( idx = 0; idx < MAX_NUM_OBJECTS; idx++ ) { - /* Process second / room effect part of binaural output when needed */ - ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); + gainCache[idx].azi = -1000; /* Use -1000 as value for uninitialized cache. */ } - interpVal = 0.0f; - for ( slot = 0; slot < nSlots; slot++ ) + for ( bin = 0; bin < nBins; bin++ ) { - interpVal += 1.0f / (float) nSlots; - if ( !hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) - { - ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); - } + float tmpMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain; + float CxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], CxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* Input covariance matrix */ + float realizedOutputEne, targetOutputEne, missingOutputEne; + float CrEneL, CrEneR; /* Cr = residual decorrelated sound covariance matrix */ + float CrCrossRe, CrCrossIm; + float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* M = mixing matrix; Mdec = residual decorrelated signal mixing matrix */ + float prototypeMtx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] = { { 1.0f, 0.05f }, { 0.05f, 1.0f } }; /* Prototype matrix determines a reference signal in mixing matrix determination */ - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - float *outSlotRePr, *outSlotImPr; /* Pointers needed for function call compatibility */ + CrEneL = 0.0f; + CrEneR = 0.0f; - set_zero( outSlotRe, CLDFB_NO_CHANNELS_MAX ); - set_zero( outSlotIm, CLDFB_NO_CHANNELS_MAX ); + /* Formulate main processing matrix M */ + formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], + hDiracDecBin->ChCrossRe[bin], hDiracDecBin->ChCrossIm[bin], + hDiracDecBin->ChEneOut[0][bin], hDiracDecBin->ChEneOut[1][bin], + hDiracDecBin->ChCrossReOut[bin], hDiracDecBin->ChCrossImOut[bin], + prototypeMtx, Mre, Mim, +#ifdef IVAS_FLOAT_FIXED + fix16_to_float( hDiracDecBin->reqularizationFactor_fx, Q14 ) ); +#else + hDiracDecBin->reqularizationFactor ); +#endif - /* Processing of the first / HRTF part of the binaural output. */ - for ( chB = 0; chB < numInChannels; chB++ ) - { - if ( chB < BINAURAL_CHANNELS ) - { - /* Decorrelator signal for TD decorrelation is stored in two input channels above the two normal inputs. - * It should be noted that TD decorrelation is used only in cases where numInChannels is 2. If this - * changes, additional adjustments are required. When using CLDFB decorrelator, we simply assign the - * pointers to buffers. */ - if ( hDiracDecBin->useTdDecorr ) - { - decSlotRePointer = inRe[chB + 2][slot]; - decSlotImPointer = inIm[chB + 2][slot]; - } - else - { - decSlotRePointer = decSlotRe[chB]; - decSlotImPointer = decSlotIm[chB]; - } - } - else - { - decSlotRePointer = NULL; /* below these pointers are used only for chB < 2 */ - decSlotImPointer = NULL; - } + /* Load estimated covariance matrix to the [2][2] matrix form */ + CxRe[0][0] = hDiracDecBin->ChEne[0][bin]; + CxRe[1][1] = hDiracDecBin->ChEne[1][bin]; + CxRe[1][0] = hDiracDecBin->ChCrossRe[bin]; + CxRe[0][1] = hDiracDecBin->ChCrossRe[bin]; + CxIm[0][0] = 0.0f; + CxIm[1][1] = 0.0f; + CxIm[1][0] = hDiracDecBin->ChCrossIm[bin]; + CxIm[0][1] = -hDiracDecBin->ChCrossIm[bin]; + /* Make matrix multiplication M*Cx*M' to determine resulting covariance matrix of processing input with M */ + matrixMul( Mre, Mim, CxRe, CxIm, tmpMtxRe, tmpMtxIm ); + matrixTransp2Mul( tmpMtxRe, tmpMtxIm, Mre, Mim, resultMtxRe, resultMtxIm ); - for ( bin = 0; bin < nBins; bin++ ) - { - float gain; + /* When below the frequency limit where decorrelation is applied, we inject the decorrelated + * residual (or missing) signal component. The procedure is active when there are not enough independent + * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ + if ( bin < max_band_decorr ) + { + float decorrelationReductionFactor; - /* Mixing using the formulated processing matrix M */ - gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxRePrev[chA][chB][bin] + - interpVal * hDiracDecBin->processMtxRe[chA][chB][bin]; - outSlotRe[bin] += gain * inRe[chB][slot][bin]; - outSlotIm[bin] += gain * inIm[chB][slot][bin]; + /* Subtract the resulting covariance matrix from the target covariance matrix to determine + * what signal component is missing. The result is the target covariance matrix for the residual signal, i.e., + * a residual covariance matrix. */ + CrEneL = max( 0.0f, hDiracDecBin->ChEneOut[0][bin] - resultMtxRe[0][0] ); + CrEneR = max( 0.0f, hDiracDecBin->ChEneOut[1][bin] - resultMtxRe[1][1] ); + CrCrossRe = hDiracDecBin->ChCrossReOut[bin] - resultMtxRe[1][0]; + CrCrossIm = hDiracDecBin->ChCrossImOut[bin] - resultMtxIm[1][0]; - gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxImPrev[chA][chB][bin] + - interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; - outSlotRe[bin] -= gain * inIm[chB][slot][bin]; - outSlotIm[bin] += gain * inRe[chB][slot][bin]; + /* The amount of the decorrelated sound is further controlled based on the spatial metadata, + * by determining an energy-suppressed residual covariance matrix that is a control parameter + * that guides the processing of the decorrelated sound to a residual signal. + * The procedure improves quality in e.g. double-talk 2-direction rendering situations.*/ + if ( ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + decorrelationReductionFactor = 1.0f; + } + else if ( ( ivas_format == MC_FORMAT && mc_mode == MC_MODE_MCMASA ) || ( ivas_format == MASA_FORMAT && nchan_transport == 1 ) ) + { + decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ) ); + } + else if ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && nchan_transport == 1 ) + { + decorrelationReductionFactor = 1.0f; + } + else + { + decorrelationReductionFactor = fmaxf( 0.0f, hDiracDecBin->frameMeanDiffuseness[bin] ); + } + CrEneL *= decorrelationReductionFactor; + CrEneR *= decorrelationReductionFactor; + CrCrossRe *= decorrelationReductionFactor; + CrCrossIm *= decorrelationReductionFactor; - /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ - if ( bin < max_band_decorr && chB < 2 ) - { - gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecRePrev[chA][chB][bin] + - interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; - outSlotRe[bin] += gain * decSlotRePointer[bin]; - outSlotIm[bin] += gain * decSlotImPointer[bin]; + /* Determine a residual mixing matrix Mdec for processing the decorrelated signal to obtain + * the residual signal (that has the residual covariance matrix) */ + formulate2x2MixingMatrix( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin], + 0.0f, 0.0f, /* Decorrelated signal has ideally no cross-terms */ + CrEneL, CrEneR, + CrCrossRe, CrCrossIm, + prototypeMtx, MdecRe, MdecIm, 0.2f ); + } + else + { + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + set_zero( MdecRe[chA], BINAURAL_CHANNELS ); + set_zero( MdecIm[chA], BINAURAL_CHANNELS ); + } + } - gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecImPrev[chA][chB][bin] + - interpVal * hDiracDecBin->processMtxDecIm[chA][chB][bin]; - outSlotRe[bin] -= gain * decSlotImPointer[bin]; - outSlotIm[bin] += gain * decSlotRePointer[bin]; - } - } + /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ + realizedOutputEne = CrEneL + CrEneR + resultMtxRe[0][0] + resultMtxRe[1][1]; + targetOutputEne = hDiracDecBin->ChEneOut[0][bin] + hDiracDecBin->ChEneOut[1][bin]; + missingOutputEne = fmaxf( 0.0f, targetOutputEne - realizedOutputEne ); + + gain = sqrtf( ( resultMtxRe[0][0] + resultMtxRe[1][1] + missingOutputEne ) / + fmaxf( 1e-12f, resultMtxRe[0][0] + resultMtxRe[1][1] ) ); + gain = fminf( 4.0f, gain ); + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + Mre[chA][chB] *= gain; + Mim[chA][chB] *= gain; } + } - if ( processReverb ) + /* Store processing matrices */ + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) { - /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ - v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); - v_add( outSlotIm, reverbIm[chA][slot], outSlotIm, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->processMtxRePrev[chA][chB][bin] = hDiracDecBin->processMtxRe[chA][chB][bin]; + hDiracDecBin->processMtxImPrev[chA][chB][bin] = hDiracDecBin->processMtxIm[chA][chB][bin]; + hDiracDecBin->processMtxDecRePrev[chA][chB][bin] = hDiracDecBin->processMtxDecRe[chA][chB][bin]; + hDiracDecBin->processMtxDecImPrev[chA][chB][bin] = hDiracDecBin->processMtxDecIm[chA][chB][bin]; + + hDiracDecBin->processMtxRe[chA][chB][bin] = Mre[chA][chB]; + hDiracDecBin->processMtxIm[chA][chB][bin] = Mim[chA][chB]; + hDiracDecBin->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; + hDiracDecBin->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; } + } - outSlotRePr = &( outSlotRe[0] ); - outSlotImPr = &( outSlotIm[0] ); + if ( separateCenterChannelRendering ) + { + /* The rendering of the separate center channel in masa + mono mode. + * The center channel is processed with a gain factor 0.8414f to match the loudness of different processing paths */ + float lRealp, lImagp, rRealp, rImagp; + float gainFactor; + int16_t aziDeg = 0; + int16_t eleDeg = 0; + uint8_t instantChange = 0; - /* Inverse filter bank */ - cldfbSynthesis_ivas( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); + if ( ivas_format == MASA_ISM_FORMAT ) + { + gainFactor = 0.7943f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); + } + else + { + gainFactor = 0.8414f * sqrtf( hDiracDecBin->earlyPartEneCorrection[bin] ); + } + + for ( chB = 0; chB < nchanSeparateChannels; chB++ ) + { + if ( ivas_format == MASA_ISM_FORMAT ) + { + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + aziDeg = hMasaIsmData->azimuth_ism[chB][dirac_read_idx]; + eleDeg = hMasaIsmData->elevation_ism[chB][dirac_read_idx]; + } + else + { + aziDeg = hMasaIsmData->azimuth_separated_ism[dirac_read_idx]; + eleDeg = hMasaIsmData->elevation_separated_ism[dirac_read_idx]; + instantChange = 1; + } + } + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + hDiracDecBin->processMtxRePrev[chA][chB + 2][bin] = hDiracDecBin->processMtxRe[chA][chB + 2][bin]; + hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); + + hDiracDecBin->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; + hDiracDecBin->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; + hDiracDecBin->processMtxRe[1][chB + 2][bin] = rRealp * gainFactor; + hDiracDecBin->processMtxIm[1][chB + 2][bin] = rImagp * gainFactor; + + if ( instantChange ) + { + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + hDiracDecBin->processMtxRePrev[chA][chB + 2][bin] = hDiracDecBin->processMtxRe[chA][chB + 2][bin]; + hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; + } + } + } } } return; } -#endif + #ifdef IVAS_FLOAT_FIXED -static void adaptTransportSignalsHeadtracked_fx( - COMBINED_ORIENTATION_HANDLE hHeadTrackData, +static void ivas_dirac_dec_binaural_process_output_fx( + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], + Word32 *output_fx[], + Word16 *q_out, Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - Word16 q_inp, - const Word16 nBins, - const Word16 nSlots, - Word32 Rmat[3][3] ) + const Word16 q_input, + const Word16 max_band_decorr, + const Word16 numInChannels, + const Word16 processReverb, + const Word16 subframe, + const Word16 q_mat ) { - Word16 slot, ch, bin, louderCh; - Word32 mono_factor_ILD, mono_factor; - Word32 y_val, mono_factor_rotation, ene_proc, ene_target, ILD; - Word16 max_band; - Word32 eqVal; - Word16 band_idx, bin_lo, bin_hi, norm, shift = 31; - Word16 q_chEneIIR = 0, q_procChEneIIR = 0; - Word32 temp_div; - Word16 e_div; + Word16 slot, bin, chA, chB; + Word16 nBins; + Word16 offsetSamples; + Word16 nSlots; + nBins = hSpatParamRendCom->num_freq_bands; + offsetSamples = 0; + nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; + + Word32 decSlotRe_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 outSlotRe_fx[CLDFB_NO_CHANNELS_MAX], outSlotIm_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 reverbRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 reverbIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word16 q_inp[6][CLDFB_SLOTS_PER_SUBFRAME]; + Word16 interpVal_fx; + Word32 *decSlotRePointer_fx; + Word32 *decSlotImPointer_fx; + Word16 q_inp_mix, q_reverb = 31; + + + IF( processReverb ) + { + /* Process second / room effect part of binaural output when needed */ + ivas_binaural_reverb_processSubframe_fx( hDiracDecBin->hReverb, numInChannels, nSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx ); + } + + // scaling input and reverb to same q// + // input scaling is to maintain precision in ivas_dirac_dec_decorrelate_slot fn// + Word16 shift = s_min( L_norm_arr( cldfbSynDec[0]->cldfb_state_fx, cldfbSynDec[0]->p_filter_length ), L_norm_arr( cldfbSynDec[1]->cldfb_state_fx, cldfbSynDec[1]->p_filter_length ) ); + q_inp_mix = 31; FOR( Word16 i = 0; i < 6; i++ ) { FOR( Word16 j = 0; j < nSlots; j++ ) { - norm = s_min( L_norm_arr( inRe_fx[i][j], nBins ), L_norm_arr( inIm_fx[i][j], nBins ) ); - shift = s_min( norm, shift ); + q_inp[i][j] = s_min( L_norm_arr( inRe_fx[i][j], nBins ), L_norm_arr( inIm_fx[i][j], nBins ) ); + IF( ( processReverb ) && ( i < 2 ) ) + { + q_reverb = s_min( L_norm_arr( reverbRe_fx[i][j], CLDFB_NO_CHANNELS_MAX ), L_norm_arr( reverbIm_fx[i][j], CLDFB_NO_CHANNELS_MAX ) ); + q_inp[i][j] = s_min( q_reverb, q_inp[i][j] ); + } + q_inp_mix = s_min( q_inp[i][j], q_inp_mix ); } } - /* Determine head-orientation-based mono factor. - Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ - - y_val = L_sub( ONE_IN_Q30, L_abs( Rmat[1][1] ) ); // Q30 - mono_factor_rotation = Mpy_32_16_1( L_sub( y_val, ADAPT_HTPROTO_ROT_LIM_0_FX ), TWO_POINT_FIVE_IN_Q13 ); // Q28 - mono_factor_rotation = L_max( 0, L_min( ONE_IN_Q28, mono_factor_rotation ) ); + q_inp_mix = sub( q_inp_mix, 3 ); // gaurded bits// - IF( EQ_32( mono_factor_rotation, ONE_IN_Q28 ) ) + Word16 cldfb_state_shift = sub( add( add( q_inp_mix, q_mat ), sub( q_input, 16 ) ), cldfbSynDec[0]->Q_cldfb_state ); + IF( GT_16( cldfb_state_shift, shift ) ) { - mono_factor_rotation = ONE_IN_Q31; + q_inp_mix = q_inp_mix + shift - cldfb_state_shift; + cldfb_state_shift = shift; } - ELSE + + FOR( Word16 i = 0; i < 6; i++ ) { - mono_factor_rotation = L_shl( mono_factor_rotation, 3 ); // Q31 + FOR( Word16 j = 0; j < nSlots; j++ ) + { + + scale_sig32( inRe_fx[i][j], nBins, q_inp_mix ); + scale_sig32( inIm_fx[i][j], nBins, q_inp_mix ); + IF( processReverb && ( i < 2 ) ) + { + scale_sig32( reverbRe_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub( add( q_inp_mix, q_mat ), 15 ) ); + scale_sig32( reverbIm_fx[i][j], CLDFB_NO_CHANNELS_MAX, sub( add( q_inp_mix, q_mat ), 15 ) ); + } + } } - /* Adapt transport signals in frequency bands */ - /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ + // scaling cldfb states to q_result-1// + scale_sig32( cldfbSynDec[0]->cldfb_state_fx, cldfbSynDec[0]->p_filter_length, cldfb_state_shift ); + scale_sig32( cldfbSynDec[1]->cldfb_state_fx, cldfbSynDec[1]->p_filter_length, cldfb_state_shift ); - max_band = 0; - WHILE( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) - { - max_band = add( max_band, 1 ); - } - - shift = sub( shift, 5 ); - // 5 is gaurded bits needed// - Word32 re, img, temp; - Word16 q_temp = 2 * ( q_inp + shift ) - 31; - FOR( band_idx = 0; band_idx < max_band; band_idx++ ) - { - Word32 ch_nrg[2]; /* storage for input signal channel energies */ - bin_lo = MASA_band_grouping_24[band_idx]; - bin_hi = s_min( MASA_band_grouping_24[band_idx + 1], (Word16) nBins ); - - FOR( ch = 0; ch < 2; ch++ ) - { - ch_nrg[ch] = 0; - FOR( slot = 0; slot < nSlots; slot++ ) - { - FOR( bin = bin_lo; bin < bin_hi; bin++ ) - { - re = L_shl( inRe_fx[ch][slot][bin], shift ); - img = L_shl( inIm_fx[ch][slot][bin], shift ); - - ch_nrg[ch] = L_add( ch_nrg[ch], ( L_add( Mpy_32_32( re, re ), Mpy_32_32( img, img ) ) ) ); // 2(q_inp +shift) -31 - } - } - hHeadTrackData->chEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->chEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); - temp = Mpy_32_16_1( ch_nrg[ch], sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); - IF( LT_16( hHeadTrackData->q_chEneIIR, q_temp ) ) - { - hHeadTrackData->chEneIIR_fx[ch][band_idx] = L_add( L_shr( temp, sub( q_temp, hHeadTrackData->q_chEneIIR ) ), hHeadTrackData->chEneIIR_fx[ch][band_idx] ); - } - ELSE - { - hHeadTrackData->chEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->chEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_chEneIIR, q_temp ) ), temp ); - } + q_inp_mix = add( q_inp_mix, q_input ); - hHeadTrackData->chEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->chEneIIR_fx[ch][band_idx], s_min( hHeadTrackData->q_chEneIIR, q_temp ) ); - } - q_chEneIIR = s_min( hHeadTrackData->q_chEneIIR, q_temp ); - /* Determine ILD */ + interpVal_fx = 0; + Word16 q_result = sub( add( q_inp_mix, q_mat ), 15 ); // setting it prior// + cldfbSynDec[0]->Q_cldfb_state = sub( q_result, 1 ); + cldfbSynDec[1]->Q_cldfb_state = sub( q_result, 1 ); - IF( EQ_32( L_max( 1, hHeadTrackData->chEneIIR_fx[0][band_idx] ), L_max( 1, hHeadTrackData->chEneIIR_fx[1][band_idx] ) ) ) + FOR( slot = 0; slot < nSlots; slot++ ) + { + IF( NE_16( slot, sub( nSlots, 1 ) ) ) { - ILD = 0; + interpVal_fx = add( interpVal_fx, slot_fx[nSlots - 1] ); } ELSE { - temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( L_max( 1, hHeadTrackData->chEneIIR_fx[0][band_idx] ), L_max( 1, hHeadTrackData->chEneIIR_fx[1][band_idx] ), &e_div ) ); - - temp = BASOP_Util_Log2( temp_div ); // Q25 - IF( GE_16( e_div, 0 ) ) - temp = L_add( temp, L_shl( e_div, 25 ) ); // Q25 - ELSE - temp = L_sub( temp, L_shl( abs( e_div ), 25 ) ); // Q25 - - temp = Mpy_32_32( temp, 646462464 ); // logx base 10 = 0.30103* logx base 2// - ILD = L_abs( Mpy_32_16_1( temp, 20480 ) ); // Q21 - } - IF( GT_32( hHeadTrackData->chEneIIR_fx[1][band_idx], hHeadTrackData->chEneIIR_fx[0][band_idx] ) ) - { - louderCh = 1; + interpVal_fx = 32767; } - ELSE + IF( !hDiracDecBin->useTdDecorr && ( GT_16( max_band_decorr, 0 ) ) ) { - louderCh = 0; + ivas_dirac_dec_decorrelate_slot_fx( hDiracDecBin, nBins, slot, inRe_fx, inIm_fx, q_inp_mix, decSlotRe_fx, decSlotIm_fx ); } - /* Determine ILD-based mono factor */ - mono_factor_ILD = Mpy_32_16_1( L_sub( ILD, ONE_IN_Q21 ), 10911 ); // Q23 - - mono_factor_ILD = L_max( 0, L_min( ONE_IN_Q21, mono_factor_ILD ) ); - - IF( EQ_32( mono_factor_ILD, ONE_IN_Q21 ) ) - mono_factor_ILD = ONE_IN_Q31; - ELSE - mono_factor_ILD = L_shl( mono_factor_ILD, 10 ); // Q31 + FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + Word32 *outSlotRePr_fx, *outSlotImPr_fx; /* Pointers needed for function call compatibility */ - /* Combine mono factors */ - mono_factor = Mpy_32_32( mono_factor_ILD, mono_factor_rotation ); // Q31 + set_zero_fx( outSlotRe_fx, CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( outSlotIm_fx, CLDFB_NO_CHANNELS_MAX ); - /* Mix original audio and sum signal according to determined mono factor */ - FOR( ch = 0; ch < 2; ch++ ) - { - IF( NE_16( ch, louderCh ) ) + /* Processing of the first / HRTF part of the binaural output. */ + FOR( chB = 0; chB < numInChannels; chB++ ) { - Word32 band_nrg = 0; - - FOR( slot = 0; slot < nSlots; slot++ ) + IF( LT_16( chB, BINAURAL_CHANNELS ) ) { - FOR( bin = bin_lo; bin < bin_hi; bin++ ) + /* Decorrelator signal for TD decorrelation is stored in two input channels above the two normal inputs. + * It should be noted that TD decorrelation is used only in cases where numInChannels is 2. If this + * changes, additional adjustments are required. When using CLDFB decorrelator, we simply assign the + * pointers to buffers. */ + IF( hDiracDecBin->useTdDecorr ) { - /* mono sum signal with the computed weight + rest from the original channel */ - inRe_fx[ch][slot][bin] = L_add( ( Mpy_32_32( mono_factor, L_add( inRe_fx[0][slot][bin], inRe_fx[1][slot][bin] ) ) ), ( Mpy_32_32( L_sub( ONE_IN_Q31, mono_factor ), inRe_fx[ch][slot][bin] ) ) ); - inIm_fx[ch][slot][bin] = L_add( ( Mpy_32_32( mono_factor, L_add( inIm_fx[0][slot][bin], inIm_fx[1][slot][bin] ) ) ), ( Mpy_32_32( L_sub( ONE_IN_Q31, mono_factor ), inIm_fx[ch][slot][bin] ) ) ); - re = L_shl( inRe_fx[ch][slot][bin], shift ); - img = L_shl( inIm_fx[ch][slot][bin], shift ); - band_nrg = L_add( band_nrg, ( L_add( Mpy_32_32( re, re ), Mpy_32_32( img, img ) ) ) ); // 2(q_inp +shift) -31 + decSlotRePointer_fx = inRe_fx[chB + 2][slot]; + decSlotImPointer_fx = inIm_fx[chB + 2][slot]; + } + ELSE + { + decSlotRePointer_fx = decSlotRe_fx[chB]; + decSlotImPointer_fx = decSlotIm_fx[chB]; } - } - hHeadTrackData->procChEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->procChEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); - - hHeadTrackData->procChEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->procChEneIIR_fx[ch][band_idx], hHeadTrackData->q_procChEneIIR ); - - if ( ( ch == 0 && band_idx == 1 ) || ( ch == 1 && band_idx == 0 ) ) - ch = ch; - - temp = Mpy_32_16_1( band_nrg, sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); - IF( LT_16( hHeadTrackData->q_procChEneIIR, q_temp ) ) - { - hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( temp, sub( q_temp, hHeadTrackData->q_procChEneIIR ) ), hHeadTrackData->procChEneIIR_fx[ch][band_idx] ); } ELSE { - hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->procChEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_procChEneIIR, q_temp ) ), temp ); + decSlotRePointer_fx = NULL; /* below these pointers are used only for chB < 2 */ + decSlotImPointer_fx = NULL; } - } - ELSE - { - /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ - hHeadTrackData->procChEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->procChEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); - temp = Mpy_32_16_1( ch_nrg[ch], sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); - IF( LT_16( hHeadTrackData->q_procChEneIIR, q_temp ) ) - { - hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( temp, sub( q_temp, hHeadTrackData->q_procChEneIIR ) ), hHeadTrackData->procChEneIIR_fx[ch][band_idx] ); - } - ELSE + + FOR( bin = 0; bin < nBins; bin++ ) { - hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->procChEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_procChEneIIR, q_temp ) ), temp ); - } - } + Word16 gain; - hHeadTrackData->procChEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->procChEneIIR_fx[ch][band_idx], s_min( hHeadTrackData->q_procChEneIIR, q_temp ) ); - } + /* Mixing using the formulated processing matrix M */ + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ) ); // Q11 - q_procChEneIIR = s_min( hHeadTrackData->q_procChEneIIR, q_temp ); + outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - /* Equalize */ - ene_target = L_add( hHeadTrackData->chEneIIR_fx[0][band_idx], hHeadTrackData->chEneIIR_fx[1][band_idx] ); // q_chEneIIR// + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ) ); // Q11 - ene_proc = L_add( hHeadTrackData->procChEneIIR_fx[0][band_idx], hHeadTrackData->procChEneIIR_fx[1][band_idx] ); // q_procChEneIIR// + // interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; + outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( ene_target, L_max( 1, ene_proc ), &e_div ) ); - e_div = e_div + ( q_procChEneIIR - q_chEneIIR ); - eqVal = Sqrt32( temp_div, &e_div ); + /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ + IF( bin < max_band_decorr && chB < 2 ) + { + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); + // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; + outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp( 1073741824, 3, eqVal, e_div ); - IF( EQ_16( comp_flag, -1 ) ) - eqVal = 1073741824; // 4inQ28 - ELSE - { - eqVal = L_shl( eqVal, sub( e_div, 3 ) ); // Q28 - } - FOR( slot = 0; slot < nSlots; slot++ ) - { - FOR( ch = 0; ch < 2; ch++ ) - { - FOR( bin = bin_lo; bin < bin_hi; bin++ ) - { - if ( ( ch == 0 && slot == 0 ) ) - { - if ( bin == 1 ) - bin = bin; + gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ) ); + outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result + outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result } + } + } - Word16 temp_shift = s_min( norm_l( inRe_fx[ch][slot][bin] ), norm_l( inIm_fx[ch][slot][bin] ) ); - re = L_shl( inRe_fx[ch][slot][bin], temp_shift ); - img = L_shl( inIm_fx[ch][slot][bin], temp_shift ); - re = L_shr( Mpy_32_32( re, eqVal ), sub( temp_shift, 3 ) ); - img = L_shr( Mpy_32_32( img, eqVal ), sub( temp_shift, 3 ) ); - inRe_fx[ch][slot][bin] = re; // q_inp - inIm_fx[ch][slot][bin] = img; // q_inp - } + IF( processReverb ) + { + /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ + v_add_fx( outSlotRe_fx, reverbRe_fx[chA][slot], outSlotRe_fx, CLDFB_NO_CHANNELS_MAX ); + v_add_fx( outSlotIm_fx, reverbIm_fx[chA][slot], outSlotIm_fx, CLDFB_NO_CHANNELS_MAX ); } - } - } - hHeadTrackData->q_chEneIIR = q_chEneIIR; - hHeadTrackData->q_procChEneIIR = q_procChEneIIR; + outSlotRePr_fx = &( outSlotRe_fx[0] ); + outSlotImPr_fx = &( outSlotIm_fx[0] ); + + cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); + cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 ); + } + } + *q_out = sub( q_result, 1 ); return; } #else -static void adaptTransportSignalsHeadtracked( - COMBINED_ORIENTATION_HANDLE hHeadTrackData, +static void ivas_dirac_dec_binaural_process_output( + DIRAC_DEC_BIN_HANDLE hDiracDecBin, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], + float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const int16_t nBins, - const int16_t nSlots, - float Rmat[3][3] ) + const int16_t max_band_decorr, + const int16_t numInChannels, + const int16_t processReverb, + const int16_t subframe ) { - int16_t slot, ch, bin, louderCh; - float ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val, ene_proc, ene_target; - int16_t max_band; - float eqVal; - int16_t band_idx, bin_lo, bin_hi; - - /* Determine head-orientation-based mono factor. - Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ - y_val = 1.0f - fabsf( Rmat[1][1] ); - mono_factor_rotation = ( y_val - ADAPT_HTPROTO_ROT_LIM_0 ) / ( ADAPT_HTPROTO_ROT_LIM_1 - ADAPT_HTPROTO_ROT_LIM_0 ); - mono_factor_rotation = fmaxf( 0.0f, fminf( 1.0f, mono_factor_rotation ) ); + int16_t slot, bin, chA, chB; + int16_t nBins; + float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; + float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float interpVal; + float *decSlotRePointer; + float *decSlotImPointer; + int16_t offsetSamples; + int16_t nSlots; - /* Adapt transport signals in frequency bands */ - /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ + nBins = hSpatParamRendCom->num_freq_bands; + offsetSamples = 0; + nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; - max_band = 0; - while ( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) + if ( processReverb ) { - max_band++; + /* Process second / room effect part of binaural output when needed */ + ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); } - for ( band_idx = 0; band_idx < max_band; band_idx++ ) + interpVal = 0.0f; + for ( slot = 0; slot < nSlots; slot++ ) { - float ch_nrg[2]; /* storage for input signal channel energies */ - bin_lo = MASA_band_grouping_24[band_idx]; - bin_hi = min( MASA_band_grouping_24[band_idx + 1], (int16_t) nBins ); - for ( ch = 0; ch < 2; ch++ ) + interpVal += 1.0f / (float) nSlots; + if ( !hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { - ch_nrg[ch] = 0.0f; - for ( slot = 0; slot < nSlots; slot++ ) - { - for ( bin = bin_lo; bin < bin_hi; bin++ ) - { - ch_nrg[ch] += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); - } - } - hHeadTrackData->chEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; - hHeadTrackData->chEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); } - /* Determine ILD */ - ILD = fabsf( 10.0f * log10f( fmaxf( 1e-12f, hHeadTrackData->chEneIIR[0][band_idx] ) / fmaxf( 1e-12f, hHeadTrackData->chEneIIR[1][band_idx] ) ) ); - if ( hHeadTrackData->chEneIIR[1][band_idx] > hHeadTrackData->chEneIIR[0][band_idx] ) - { - louderCh = 1; - } - else + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) { - louderCh = 0; - } - - /* Determine ILD-based mono factor */ - mono_factor_ILD = ( ILD - ADAPT_HTPROTO_ILD_LIM_DB0 ) / ( ADAPT_HTPROTO_ILD_LIM_DB1 - ADAPT_HTPROTO_ILD_LIM_DB0 ); - mono_factor_ILD = fmaxf( 0.0f, fminf( 1.0f, mono_factor_ILD ) ); + float *outSlotRePr, *outSlotImPr; /* Pointers needed for function call compatibility */ - /* Combine mono factors */ - mono_factor = mono_factor_ILD * mono_factor_rotation; + set_zero( outSlotRe, CLDFB_NO_CHANNELS_MAX ); + set_zero( outSlotIm, CLDFB_NO_CHANNELS_MAX ); - /* Mix original audio and sum signal according to determined mono factor */ - for ( ch = 0; ch < 2; ch++ ) - { - if ( ch != louderCh ) + /* Processing of the first / HRTF part of the binaural output. */ + for ( chB = 0; chB < numInChannels; chB++ ) { - float band_nrg = 0.0f; + if ( chB < BINAURAL_CHANNELS ) + { + /* Decorrelator signal for TD decorrelation is stored in two input channels above the two normal inputs. + * It should be noted that TD decorrelation is used only in cases where numInChannels is 2. If this + * changes, additional adjustments are required. When using CLDFB decorrelator, we simply assign the + * pointers to buffers. */ + if ( hDiracDecBin->useTdDecorr ) + { + decSlotRePointer = inRe[chB + 2][slot]; + decSlotImPointer = inIm[chB + 2][slot]; + } + else + { + decSlotRePointer = decSlotRe[chB]; + decSlotImPointer = decSlotIm[chB]; + } + } + else + { + decSlotRePointer = NULL; /* below these pointers are used only for chB < 2 */ + decSlotImPointer = NULL; + } - for ( slot = 0; slot < nSlots; slot++ ) + + for ( bin = 0; bin < nBins; bin++ ) { - for ( bin = bin_lo; bin < bin_hi; bin++ ) + float gain; + + /* Mixing using the formulated processing matrix M */ + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxRePrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxRe[chA][chB][bin]; + outSlotRe[bin] += gain * inRe[chB][slot][bin]; + outSlotIm[bin] += gain * inIm[chB][slot][bin]; + + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxImPrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; + outSlotRe[bin] -= gain * inIm[chB][slot][bin]; + outSlotIm[bin] += gain * inRe[chB][slot][bin]; + + /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ + if ( bin < max_band_decorr && chB < 2 ) { - /* mono sum signal with the computed weight + rest from the original channel */ - inRe[ch][slot][bin] = mono_factor * ( inRe[0][slot][bin] + inRe[1][slot][bin] ) + ( 1.0f - mono_factor ) * inRe[ch][slot][bin]; - inIm[ch][slot][bin] = mono_factor * ( inIm[0][slot][bin] + inIm[1][slot][bin] ) + ( 1.0f - mono_factor ) * inIm[ch][slot][bin]; - band_nrg += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecRePrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; + outSlotRe[bin] += gain * decSlotRePointer[bin]; + outSlotIm[bin] += gain * decSlotImPointer[bin]; + + gain = ( 1.0f - interpVal ) * hDiracDecBin->processMtxDecImPrev[chA][chB][bin] + + interpVal * hDiracDecBin->processMtxDecIm[chA][chB][bin]; + outSlotRe[bin] -= gain * decSlotImPointer[bin]; + outSlotIm[bin] += gain * decSlotRePointer[bin]; } } - hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; - hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * band_nrg; } - else + + if ( processReverb ) { - /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ - hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; - hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ + v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); + v_add( outSlotIm, reverbIm[chA][slot], outSlotIm, CLDFB_NO_CHANNELS_MAX ); } - } - /* Equalize */ - ene_target = hHeadTrackData->chEneIIR[0][band_idx] + hHeadTrackData->chEneIIR[1][band_idx]; - ene_proc = hHeadTrackData->procChEneIIR[0][band_idx] + hHeadTrackData->procChEneIIR[1][band_idx]; - eqVal = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); + outSlotRePr = &( outSlotRe[0] ); + outSlotImPr = &( outSlotIm[0] ); - for ( slot = 0; slot < nSlots; slot++ ) - { - for ( ch = 0; ch < 2; ch++ ) - { - for ( bin = bin_lo; bin < bin_hi; bin++ ) - { - inRe[ch][slot][bin] *= eqVal; - inIm[ch][slot][bin] *= eqVal; - } - } + /* Inverse filter bank */ + cldfbSynthesis_ivas( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, cldfbSynDec[chA] ); } } @@ -3087,34 +3380,26 @@ static void adaptTransportSignalsHeadtracked( #endif #ifdef IVAS_FLOAT_FIXED -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( +static void adaptTransportSignalsHeadtracked_fx( COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + Word16 q_inp, const Word16 nBins, const Word16 nSlots, - Word32 Rmat_fx[3][3] ) + Word32 Rmat[3][3] ) { - Word16 slot, bin, ch; - Word32 tmpVal; - Word16 norm, e_div, shift = 31; - Word32 Re, Im, temp_div; - - /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ - IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedNext, (Word16) hHeadTrackData->lrSwitchedCurrent ) ) - { - Word32 thresholdDotProduct = 182536112; // 0.17 in Q30// /* Corresponds to 10-degree switching threshold */ - IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedCurrent, 0 ) && ( LT_32( Rmat_fx[1][1], L_negate( thresholdDotProduct ) ) ) ) - { - hHeadTrackData->lrSwitchedNext = 1; - } - IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedCurrent, 1 ) && ( GT_32( Rmat_fx[1][1], thresholdDotProduct ) ) ) - { - hHeadTrackData->lrSwitchedNext = 0; - } - } + Word16 slot, ch, bin, louderCh; + Word32 mono_factor_ILD, mono_factor; + Word32 y_val, mono_factor_rotation, ene_proc, ene_target, ILD; + Word16 max_band; + Word32 eqVal; + Word16 band_idx, bin_lo, bin_hi, norm, shift = 31; + Word16 q_chEneIIR = 0, q_procChEneIIR = 0; + Word32 temp_div; + Word16 e_div; - FOR( Word16 i = 0; i < 2; i++ ) + FOR( Word16 i = 0; i < 6; i++ ) { FOR( Word16 j = 0; j < nSlots; j++ ) { @@ -3123,116 +3408,217 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( } } - shift = sub( shift, 3 ); // guard bits// - /* When currently in interpolation */ - IF( NE_16( (Word16) hHeadTrackData->lrSwitchedNext, (Word16) hHeadTrackData->lrSwitchedCurrent ) ) - { - FOR( slot = 0; slot < nSlots; slot++ ) - { - Word32 switchOrderFactor, origOrderFactor; - Word16 e_switchOrderFactor, e_origOrderFactor; + /* Determine head-orientation-based mono factor. + Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ - hHeadTrackData->lrSwitchInterpVal_fx = L_add( hHeadTrackData->lrSwitchInterpVal_fx, 2684354 ); /* Corresponds to 0.5 seconds interpolation time */ // Q14 + y_val = L_sub( ONE_IN_Q30, L_abs( Rmat[1][1] ) ); // Q30 + mono_factor_rotation = Mpy_32_16_1( L_sub( y_val, ADAPT_HTPROTO_ROT_LIM_0_FX ), TWO_POINT_FIVE_IN_Q13 ); // Q28 + mono_factor_rotation = L_max( 0, L_min( ONE_IN_Q28, mono_factor_rotation ) ); - IF( GT_32( hHeadTrackData->lrSwitchInterpVal_fx, 1072668096 ) ) - { - /* Stop interpolation, reset values */ - hHeadTrackData->lrSwitchInterpVal_fx = 0; - hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; - } + IF( EQ_32( mono_factor_rotation, ONE_IN_Q28 ) ) + { + mono_factor_rotation = ONE_IN_Q31; + } + ELSE + { + mono_factor_rotation = L_shl( mono_factor_rotation, 3 ); // Q31 + } - /* Gains for determining portion of switched channel order and original channel order */ - tmpVal = Mpy_32_16_1( hHeadTrackData->lrSwitchInterpVal_fx, (Word16) hHeadTrackData->lrSwitchedNext ); // Q15 - tmpVal = L_add( tmpVal, Mpy_32_16_1( L_sub( ONE_IN_Q30, hHeadTrackData->lrSwitchInterpVal_fx ), (Word16) hHeadTrackData->lrSwitchedCurrent ) ); // Q15 + /* Adapt transport signals in frequency bands */ + /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ - e_switchOrderFactor = 0; - e_origOrderFactor = 0; - IF( EQ_32( tmpVal, 32768 ) ) - tmpVal = ONE_IN_Q31; - ELSE - tmpVal = L_shl( tmpVal, 16 ); // Q31 - switchOrderFactor = Sqrt32( tmpVal, &e_switchOrderFactor ); - switchOrderFactor = L_shl( switchOrderFactor, e_switchOrderFactor ); // Q31 - origOrderFactor = Sqrt32( L_sub( ONE_IN_Q31, tmpVal ), &e_origOrderFactor ); // Q31 - origOrderFactor = L_shl( origOrderFactor, e_origOrderFactor ); - FOR( bin = 0; bin < nBins; bin++ ) - { - /* determine original order (1) signals and switched order (2) signals */ - Word32 re1[BINAURAL_CHANNELS], re2[BINAURAL_CHANNELS], im1[BINAURAL_CHANNELS], im2[BINAURAL_CHANNELS]; + max_band = 0; + WHILE( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) + { + max_band = add( max_band, 1 ); + } - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - re1[ch] = Mpy_32_32( inRe_fx[ch][slot][bin], origOrderFactor ); // q_inp - re2[ch] = Mpy_32_32( inRe_fx[1 - ch][slot][bin], switchOrderFactor ); // q_inp - im1[ch] = Mpy_32_32( inIm_fx[ch][slot][bin], origOrderFactor ); // q_inp - im2[ch] = Mpy_32_32( inIm_fx[1 - ch][slot][bin], switchOrderFactor ); // q_inp - } + shift = sub( shift, 5 ); + // 5 is gaurded bits needed// + Word32 re, img, temp; + Word16 q_temp = 2 * ( q_inp + shift ) - 31; + FOR( band_idx = 0; band_idx < max_band; band_idx++ ) + { + Word32 ch_nrg[2]; /* storage for input signal channel energies */ + bin_lo = MASA_band_grouping_24[band_idx]; + bin_hi = s_min( MASA_band_grouping_24[band_idx + 1], (Word16) nBins ); - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + FOR( ch = 0; ch < 2; ch++ ) + { + ch_nrg[ch] = 0; + FOR( slot = 0; slot < nSlots; slot++ ) + { + FOR( bin = bin_lo; bin < bin_hi; bin++ ) { - Word32 eneRef, ene, eq; - - re1[ch] = L_shl( re1[ch], shift ); // q_inp+shift// - re2[ch] = L_shl( re2[ch], shift ); // q_inp+shift// - im1[ch] = L_shl( im1[ch], shift ); // q_inp+shift// - im2[ch] = L_shl( im2[ch], shift ); // q_inp+shift// + re = L_shl( inRe_fx[ch][slot][bin], shift ); + img = L_shl( inIm_fx[ch][slot][bin], shift ); - /* Interpolate / mix original and switched order signals */ - Re = L_add( re1[ch], re2[ch] ); // q_inp+shift// - Im = L_add( im1[ch], im2[ch] ); // q_inp+shift// + ch_nrg[ch] = L_add( ch_nrg[ch], ( L_add( Mpy_32_32( re, re ), Mpy_32_32( img, img ) ) ) ); // 2(q_inp +shift) -31 + } + } + hHeadTrackData->chEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->chEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); + temp = Mpy_32_16_1( ch_nrg[ch], sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); + IF( LT_16( hHeadTrackData->q_chEneIIR, q_temp ) ) + { + hHeadTrackData->chEneIIR_fx[ch][band_idx] = L_add( L_shr( temp, sub( q_temp, hHeadTrackData->q_chEneIIR ) ), hHeadTrackData->chEneIIR_fx[ch][band_idx] ); + } + ELSE + { + hHeadTrackData->chEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->chEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_chEneIIR, q_temp ) ), temp ); + } - /* Equalize interpolated signals to preserve energy per bin */ + hHeadTrackData->chEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->chEneIIR_fx[ch][band_idx], s_min( hHeadTrackData->q_chEneIIR, q_temp ) ); + } + q_chEneIIR = s_min( hHeadTrackData->q_chEneIIR, q_temp ); + /* Determine ILD */ - eneRef = L_add( ( L_add( Mpy_32_32( re1[ch], re1[ch] ), Mpy_32_32( re2[ch], re2[ch] ) ) ), ( L_add( Mpy_32_32( im1[ch], im1[ch] ), Mpy_32_32( im2[ch], im2[ch] ) ) ) ); // 2*(q_inp+shift) -31// - ene = L_add( Mpy_32_32( Re, Re ), Mpy_32_32( Im, Im ) ); // 2*(q_inp+shift) -31// + IF( EQ_32( L_max( 1, hHeadTrackData->chEneIIR_fx[0][band_idx] ), L_max( 1, hHeadTrackData->chEneIIR_fx[1][band_idx] ) ) ) + { + ILD = 0; + } + ELSE + { + temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( L_max( 1, hHeadTrackData->chEneIIR_fx[0][band_idx] ), L_max( 1, hHeadTrackData->chEneIIR_fx[1][band_idx] ), &e_div ) ); - temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( eneRef, L_max( 1, ene ), &e_div ) ); + temp = BASOP_Util_Log2( temp_div ); // Q25 + IF( GE_16( e_div, 0 ) ) + temp = L_add( temp, L_shl( e_div, 25 ) ); // Q25 + ELSE + temp = L_sub( temp, L_shl( abs( e_div ), 25 ) ); // Q25 - eq = Sqrt32( temp_div, &e_div ); + temp = Mpy_32_32( temp, 646462464 ); // logx base 10 = 0.30103* logx base 2// + ILD = L_abs( Mpy_32_16_1( temp, 20480 ) ); // Q21 + } + IF( GT_32( hHeadTrackData->chEneIIR_fx[1][band_idx], hHeadTrackData->chEneIIR_fx[0][band_idx] ) ) + { + louderCh = 1; + } + ELSE + { + louderCh = 0; + } - Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp( 1073741824, 3, eq, e_div ); - IF( EQ_16( comp_flag, -1 ) ) - eq = 1073741824; // 4inQ28 - ELSE + /* Determine ILD-based mono factor */ + mono_factor_ILD = Mpy_32_16_1( L_sub( ILD, ONE_IN_Q21 ), 10911 ); // Q23 + + mono_factor_ILD = L_max( 0, L_min( ONE_IN_Q21, mono_factor_ILD ) ); + + IF( EQ_32( mono_factor_ILD, ONE_IN_Q21 ) ) + mono_factor_ILD = ONE_IN_Q31; + ELSE + mono_factor_ILD = L_shl( mono_factor_ILD, 10 ); // Q31 + + /* Combine mono factors */ + mono_factor = Mpy_32_32( mono_factor_ILD, mono_factor_rotation ); // Q31 + + /* Mix original audio and sum signal according to determined mono factor */ + FOR( ch = 0; ch < 2; ch++ ) + { + IF( NE_16( ch, louderCh ) ) + { + Word32 band_nrg = 0; + + FOR( slot = 0; slot < nSlots; slot++ ) + { + FOR( bin = bin_lo; bin < bin_hi; bin++ ) { - eq = L_shl( eq, sub( e_div, 3 ) ); // Q28 + /* mono sum signal with the computed weight + rest from the original channel */ + inRe_fx[ch][slot][bin] = L_add( ( Mpy_32_32( mono_factor, L_add( inRe_fx[0][slot][bin], inRe_fx[1][slot][bin] ) ) ), ( Mpy_32_32( L_sub( ONE_IN_Q31, mono_factor ), inRe_fx[ch][slot][bin] ) ) ); + inIm_fx[ch][slot][bin] = L_add( ( Mpy_32_32( mono_factor, L_add( inIm_fx[0][slot][bin], inIm_fx[1][slot][bin] ) ) ), ( Mpy_32_32( L_sub( ONE_IN_Q31, mono_factor ), inIm_fx[ch][slot][bin] ) ) ); + re = L_shl( inRe_fx[ch][slot][bin], shift ); + img = L_shl( inIm_fx[ch][slot][bin], shift ); + band_nrg = L_add( band_nrg, ( L_add( Mpy_32_32( re, re ), Mpy_32_32( img, img ) ) ) ); // 2(q_inp +shift) -31 } + } + hHeadTrackData->procChEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->procChEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); - Re = L_shr( Mpy_32_32( Re, eq ), sub( shift, 3 ) ); // q_inp - Im = L_shr( Mpy_32_32( Im, eq ), sub( shift, 3 ) ); // q_inp + hHeadTrackData->procChEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->procChEneIIR_fx[ch][band_idx], hHeadTrackData->q_procChEneIIR ); - inRe_fx[ch][slot][bin] = Re; - inIm_fx[ch][slot][bin] = Im; + if ( ( ch == 0 && band_idx == 1 ) || ( ch == 1 && band_idx == 0 ) ) + ch = ch; + + temp = Mpy_32_16_1( band_nrg, sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); + IF( LT_16( hHeadTrackData->q_procChEneIIR, q_temp ) ) + { + hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( temp, sub( q_temp, hHeadTrackData->q_procChEneIIR ) ), hHeadTrackData->procChEneIIR_fx[ch][band_idx] ); + } + ELSE + { + hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->procChEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_procChEneIIR, q_temp ) ), temp ); + } + } + ELSE + { + /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ + hHeadTrackData->procChEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->procChEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); + + temp = Mpy_32_16_1( ch_nrg[ch], sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); + IF( LT_16( hHeadTrackData->q_procChEneIIR, q_temp ) ) + { + hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( temp, sub( q_temp, hHeadTrackData->q_procChEneIIR ) ), hHeadTrackData->procChEneIIR_fx[ch][band_idx] ); + } + ELSE + { + hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->procChEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_procChEneIIR, q_temp ) ), temp ); } } + + hHeadTrackData->procChEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->procChEneIIR_fx[ch][band_idx], s_min( hHeadTrackData->q_procChEneIIR, q_temp ) ); } - } - ELSE - { - /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ - IF( hHeadTrackData->lrSwitchedCurrent == 1 ) + + q_procChEneIIR = s_min( hHeadTrackData->q_procChEneIIR, q_temp ); + + /* Equalize */ + ene_target = L_add( hHeadTrackData->chEneIIR_fx[0][band_idx], hHeadTrackData->chEneIIR_fx[1][band_idx] ); // q_chEneIIR// + + ene_proc = L_add( hHeadTrackData->procChEneIIR_fx[0][band_idx], hHeadTrackData->procChEneIIR_fx[1][band_idx] ); // q_procChEneIIR// + + temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( ene_target, L_max( 1, ene_proc ), &e_div ) ); + e_div = e_div + ( q_procChEneIIR - q_chEneIIR ); + + eqVal = Sqrt32( temp_div, &e_div ); + + Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp( 1073741824, 3, eqVal, e_div ); + IF( EQ_16( comp_flag, -1 ) ) + eqVal = 1073741824; // 4inQ28 + ELSE { - FOR( slot = 0; slot < nSlots; slot++ ) + eqVal = L_shl( eqVal, sub( e_div, 3 ) ); // Q28 + } + + FOR( slot = 0; slot < nSlots; slot++ ) + { + FOR( ch = 0; ch < 2; ch++ ) { - FOR( bin = 0; bin < nBins; bin++ ) + FOR( bin = bin_lo; bin < bin_hi; bin++ ) { - tmpVal = inRe_fx[0][slot][bin]; - inRe_fx[0][slot][bin] = inRe_fx[1][slot][bin]; - inRe_fx[1][slot][bin] = tmpVal; - tmpVal = inIm_fx[0][slot][bin]; - inIm_fx[0][slot][bin] = inIm_fx[1][slot][bin]; - inIm_fx[1][slot][bin] = tmpVal; + if ( ( ch == 0 && slot == 0 ) ) + { + if ( bin == 1 ) + bin = bin; + } + + Word16 temp_shift = s_min( norm_l( inRe_fx[ch][slot][bin] ), norm_l( inIm_fx[ch][slot][bin] ) ); + re = L_shl( inRe_fx[ch][slot][bin], temp_shift ); + img = L_shl( inIm_fx[ch][slot][bin], temp_shift ); + + re = L_shr( Mpy_32_32( re, eqVal ), sub( temp_shift, 3 ) ); + img = L_shr( Mpy_32_32( img, eqVal ), sub( temp_shift, 3 ) ); + inRe_fx[ch][slot][bin] = re; // q_inp + inIm_fx[ch][slot][bin] = img; // q_inp } } } } + + hHeadTrackData->q_chEneIIR = q_chEneIIR; + hHeadTrackData->q_procChEneIIR = q_procChEneIIR; return; } -#endif - -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( +#else +static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -3240,54 +3626,316 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( const int16_t nSlots, float Rmat[3][3] ) { - int16_t slot, bin, ch; - float tmpVal; + int16_t slot, ch, bin, louderCh; + float ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val, ene_proc, ene_target; + int16_t max_band; + float eqVal; + int16_t band_idx, bin_lo, bin_hi; - /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ - if ( hHeadTrackData->lrSwitchedNext == hHeadTrackData->lrSwitchedCurrent ) + /* Determine head-orientation-based mono factor. + Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ + y_val = 1.0f - fabsf( Rmat[1][1] ); + mono_factor_rotation = ( y_val - ADAPT_HTPROTO_ROT_LIM_0 ) / ( ADAPT_HTPROTO_ROT_LIM_1 - ADAPT_HTPROTO_ROT_LIM_0 ); + mono_factor_rotation = fmaxf( 0.0f, fminf( 1.0f, mono_factor_rotation ) ); + + /* Adapt transport signals in frequency bands */ + /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ + + max_band = 0; + while ( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) { - float thresholdDotProduct = 0.17f; /* Corresponds to 10-degree switching threshold */ - if ( ( hHeadTrackData->lrSwitchedCurrent == 0 ) && ( Rmat[1][1] < -thresholdDotProduct ) ) - { - hHeadTrackData->lrSwitchedNext = 1; - } - if ( ( hHeadTrackData->lrSwitchedCurrent == 1 ) && ( Rmat[1][1] > thresholdDotProduct ) ) - { - hHeadTrackData->lrSwitchedNext = 0; - } + max_band++; } - /* When currently in interpolation */ - if ( hHeadTrackData->lrSwitchedNext != hHeadTrackData->lrSwitchedCurrent ) + for ( band_idx = 0; band_idx < max_band; band_idx++ ) { - for ( slot = 0; slot < nSlots; slot++ ) + float ch_nrg[2]; /* storage for input signal channel energies */ + bin_lo = MASA_band_grouping_24[band_idx]; + bin_hi = min( MASA_band_grouping_24[band_idx + 1], (int16_t) nBins ); + for ( ch = 0; ch < 2; ch++ ) { - float switchOrderFactor, origOrderFactor; - - hHeadTrackData->lrSwitchInterpVal += 0.0025f; /* Corresponds to 0.5 seconds interpolation time */ - - if ( hHeadTrackData->lrSwitchInterpVal > 0.999f ) + ch_nrg[ch] = 0.0f; + for ( slot = 0; slot < nSlots; slot++ ) { - /* Stop interpolation, reset values */ - hHeadTrackData->lrSwitchInterpVal = 0.0f; - hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + ch_nrg[ch] += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } } + hHeadTrackData->chEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->chEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } - /* Gains for determining portion of switched channel order and original channel order */ - tmpVal = (float) hHeadTrackData->lrSwitchedNext * hHeadTrackData->lrSwitchInterpVal; - tmpVal += (float) hHeadTrackData->lrSwitchedCurrent * ( 1.0f - hHeadTrackData->lrSwitchInterpVal ); - switchOrderFactor = sqrtf( tmpVal ); - origOrderFactor = sqrtf( 1.0f - tmpVal ); + /* Determine ILD */ + ILD = fabsf( 10.0f * log10f( fmaxf( 1e-12f, hHeadTrackData->chEneIIR[0][band_idx] ) / fmaxf( 1e-12f, hHeadTrackData->chEneIIR[1][band_idx] ) ) ); + if ( hHeadTrackData->chEneIIR[1][band_idx] > hHeadTrackData->chEneIIR[0][band_idx] ) + { + louderCh = 1; + } + else + { + louderCh = 0; + } - for ( bin = 0; bin < nBins; bin++ ) - { - /* determine original order (1) signals and switched order (2) signals */ - float re1[BINAURAL_CHANNELS], re2[BINAURAL_CHANNELS], im1[BINAURAL_CHANNELS], im2[BINAURAL_CHANNELS]; + /* Determine ILD-based mono factor */ + mono_factor_ILD = ( ILD - ADAPT_HTPROTO_ILD_LIM_DB0 ) / ( ADAPT_HTPROTO_ILD_LIM_DB1 - ADAPT_HTPROTO_ILD_LIM_DB0 ); + mono_factor_ILD = fmaxf( 0.0f, fminf( 1.0f, mono_factor_ILD ) ); - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - re1[ch] = inRe[ch][slot][bin] * origOrderFactor; - re2[ch] = inRe[1 - ch][slot][bin] * switchOrderFactor; + /* Combine mono factors */ + mono_factor = mono_factor_ILD * mono_factor_rotation; + + /* Mix original audio and sum signal according to determined mono factor */ + for ( ch = 0; ch < 2; ch++ ) + { + if ( ch != louderCh ) + { + float band_nrg = 0.0f; + + for ( slot = 0; slot < nSlots; slot++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + /* mono sum signal with the computed weight + rest from the original channel */ + inRe[ch][slot][bin] = mono_factor * ( inRe[0][slot][bin] + inRe[1][slot][bin] ) + ( 1.0f - mono_factor ) * inRe[ch][slot][bin]; + inIm[ch][slot][bin] = mono_factor * ( inIm[0][slot][bin] + inIm[1][slot][bin] ) + ( 1.0f - mono_factor ) * inIm[ch][slot][bin]; + band_nrg += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } + } + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * band_nrg; + } + else + { + /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } + } + + /* Equalize */ + ene_target = hHeadTrackData->chEneIIR[0][band_idx] + hHeadTrackData->chEneIIR[1][band_idx]; + ene_proc = hHeadTrackData->procChEneIIR[0][band_idx] + hHeadTrackData->procChEneIIR[1][band_idx]; + eqVal = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); + + for ( slot = 0; slot < nSlots; slot++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + inRe[ch][slot][bin] *= eqVal; + inIm[ch][slot][bin] *= eqVal; + } + } + } + } + + return; +} +#endif + +#ifdef IVAS_FLOAT_FIXED +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( + COMBINED_ORIENTATION_HANDLE hHeadTrackData, + Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const Word16 nBins, + const Word16 nSlots, + Word32 Rmat_fx[3][3] ) +{ + Word16 slot, bin, ch; + Word32 tmpVal; + Word16 norm, e_div, shift = 31; + Word32 Re, Im, temp_div; + + /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ + IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedNext, (Word16) hHeadTrackData->lrSwitchedCurrent ) ) + { + Word32 thresholdDotProduct = 182536112; // 0.17 in Q30// /* Corresponds to 10-degree switching threshold */ + IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedCurrent, 0 ) && ( LT_32( Rmat_fx[1][1], L_negate( thresholdDotProduct ) ) ) ) + { + hHeadTrackData->lrSwitchedNext = 1; + } + IF( EQ_16( (Word16) hHeadTrackData->lrSwitchedCurrent, 1 ) && ( GT_32( Rmat_fx[1][1], thresholdDotProduct ) ) ) + { + hHeadTrackData->lrSwitchedNext = 0; + } + } + + FOR( Word16 i = 0; i < 2; i++ ) + { + FOR( Word16 j = 0; j < nSlots; j++ ) + { + norm = s_min( L_norm_arr( inRe_fx[i][j], nBins ), L_norm_arr( inIm_fx[i][j], nBins ) ); + shift = s_min( norm, shift ); + } + } + + shift = sub( shift, 3 ); // guard bits// + /* When currently in interpolation */ + IF( NE_16( (Word16) hHeadTrackData->lrSwitchedNext, (Word16) hHeadTrackData->lrSwitchedCurrent ) ) + { + FOR( slot = 0; slot < nSlots; slot++ ) + { + Word32 switchOrderFactor, origOrderFactor; + Word16 e_switchOrderFactor, e_origOrderFactor; + + hHeadTrackData->lrSwitchInterpVal_fx = L_add( hHeadTrackData->lrSwitchInterpVal_fx, 2684354 ); /* Corresponds to 0.5 seconds interpolation time */ // Q14 + + IF( GT_32( hHeadTrackData->lrSwitchInterpVal_fx, 1072668096 ) ) + { + /* Stop interpolation, reset values */ + hHeadTrackData->lrSwitchInterpVal_fx = 0; + hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; + } + + /* Gains for determining portion of switched channel order and original channel order */ + tmpVal = Mpy_32_16_1( hHeadTrackData->lrSwitchInterpVal_fx, (Word16) hHeadTrackData->lrSwitchedNext ); // Q15 + tmpVal = L_add( tmpVal, Mpy_32_16_1( L_sub( ONE_IN_Q30, hHeadTrackData->lrSwitchInterpVal_fx ), (Word16) hHeadTrackData->lrSwitchedCurrent ) ); // Q15 + + e_switchOrderFactor = 0; + e_origOrderFactor = 0; + IF( EQ_32( tmpVal, 32768 ) ) + tmpVal = ONE_IN_Q31; + ELSE + tmpVal = L_shl( tmpVal, 16 ); // Q31 + switchOrderFactor = Sqrt32( tmpVal, &e_switchOrderFactor ); + switchOrderFactor = L_shl( switchOrderFactor, e_switchOrderFactor ); // Q31 + origOrderFactor = Sqrt32( L_sub( ONE_IN_Q31, tmpVal ), &e_origOrderFactor ); // Q31 + origOrderFactor = L_shl( origOrderFactor, e_origOrderFactor ); + FOR( bin = 0; bin < nBins; bin++ ) + { + /* determine original order (1) signals and switched order (2) signals */ + Word32 re1[BINAURAL_CHANNELS], re2[BINAURAL_CHANNELS], im1[BINAURAL_CHANNELS], im2[BINAURAL_CHANNELS]; + + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + re1[ch] = Mpy_32_32( inRe_fx[ch][slot][bin], origOrderFactor ); // q_inp + re2[ch] = Mpy_32_32( inRe_fx[1 - ch][slot][bin], switchOrderFactor ); // q_inp + im1[ch] = Mpy_32_32( inIm_fx[ch][slot][bin], origOrderFactor ); // q_inp + im2[ch] = Mpy_32_32( inIm_fx[1 - ch][slot][bin], switchOrderFactor ); // q_inp + } + + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + Word32 eneRef, ene, eq; + + re1[ch] = L_shl( re1[ch], shift ); // q_inp+shift// + re2[ch] = L_shl( re2[ch], shift ); // q_inp+shift// + im1[ch] = L_shl( im1[ch], shift ); // q_inp+shift// + im2[ch] = L_shl( im2[ch], shift ); // q_inp+shift// + + /* Interpolate / mix original and switched order signals */ + Re = L_add( re1[ch], re2[ch] ); // q_inp+shift// + Im = L_add( im1[ch], im2[ch] ); // q_inp+shift// + + /* Equalize interpolated signals to preserve energy per bin */ + + eneRef = L_add( ( L_add( Mpy_32_32( re1[ch], re1[ch] ), Mpy_32_32( re2[ch], re2[ch] ) ) ), ( L_add( Mpy_32_32( im1[ch], im1[ch] ), Mpy_32_32( im2[ch], im2[ch] ) ) ) ); // 2*(q_inp+shift) -31// + ene = L_add( Mpy_32_32( Re, Re ), Mpy_32_32( Im, Im ) ); // 2*(q_inp+shift) -31// + + temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( eneRef, L_max( 1, ene ), &e_div ) ); + + eq = Sqrt32( temp_div, &e_div ); + + Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp( 1073741824, 3, eq, e_div ); + IF( EQ_16( comp_flag, -1 ) ) + eq = 1073741824; // 4inQ28 + ELSE + { + eq = L_shl( eq, sub( e_div, 3 ) ); // Q28 + } + + Re = L_shr( Mpy_32_32( Re, eq ), sub( shift, 3 ) ); // q_inp + Im = L_shr( Mpy_32_32( Im, eq ), sub( shift, 3 ) ); // q_inp + + inRe_fx[ch][slot][bin] = Re; + inIm_fx[ch][slot][bin] = Im; + } + } + } + } + ELSE + { + /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ + IF( hHeadTrackData->lrSwitchedCurrent == 1 ) + { + FOR( slot = 0; slot < nSlots; slot++ ) + { + FOR( bin = 0; bin < nBins; bin++ ) + { + tmpVal = inRe_fx[0][slot][bin]; + inRe_fx[0][slot][bin] = inRe_fx[1][slot][bin]; + inRe_fx[1][slot][bin] = tmpVal; + tmpVal = inIm_fx[0][slot][bin]; + inIm_fx[0][slot][bin] = inIm_fx[1][slot][bin]; + inIm_fx[1][slot][bin] = tmpVal; + } + } + } + } + + return; +} + +#endif + +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( + COMBINED_ORIENTATION_HANDLE hHeadTrackData, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t nBins, + const int16_t nSlots, + float Rmat[3][3] ) +{ + int16_t slot, bin, ch; + float tmpVal; + + /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ + if ( hHeadTrackData->lrSwitchedNext == hHeadTrackData->lrSwitchedCurrent ) + { + float thresholdDotProduct = 0.17f; /* Corresponds to 10-degree switching threshold */ + if ( ( hHeadTrackData->lrSwitchedCurrent == 0 ) && ( Rmat[1][1] < -thresholdDotProduct ) ) + { + hHeadTrackData->lrSwitchedNext = 1; + } + if ( ( hHeadTrackData->lrSwitchedCurrent == 1 ) && ( Rmat[1][1] > thresholdDotProduct ) ) + { + hHeadTrackData->lrSwitchedNext = 0; + } + } + + /* When currently in interpolation */ + if ( hHeadTrackData->lrSwitchedNext != hHeadTrackData->lrSwitchedCurrent ) + { + for ( slot = 0; slot < nSlots; slot++ ) + { + float switchOrderFactor, origOrderFactor; + + hHeadTrackData->lrSwitchInterpVal += 0.0025f; /* Corresponds to 0.5 seconds interpolation time */ + + if ( hHeadTrackData->lrSwitchInterpVal > 0.999f ) + { + /* Stop interpolation, reset values */ + hHeadTrackData->lrSwitchInterpVal = 0.0f; + hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; + } + + /* Gains for determining portion of switched channel order and original channel order */ + tmpVal = (float) hHeadTrackData->lrSwitchedNext * hHeadTrackData->lrSwitchInterpVal; + tmpVal += (float) hHeadTrackData->lrSwitchedCurrent * ( 1.0f - hHeadTrackData->lrSwitchInterpVal ); + switchOrderFactor = sqrtf( tmpVal ); + origOrderFactor = sqrtf( 1.0f - tmpVal ); + + for ( bin = 0; bin < nBins; bin++ ) + { + /* determine original order (1) signals and switched order (2) signals */ + float re1[BINAURAL_CHANNELS], re2[BINAURAL_CHANNELS], im1[BINAURAL_CHANNELS], im2[BINAURAL_CHANNELS]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + re1[ch] = inRe[ch][slot][bin] * origOrderFactor; + re2[ch] = inRe[1 - ch][slot][bin] * switchOrderFactor; im1[ch] = inIm[ch][slot][bin] * origOrderFactor; im2[ch] = inIm[1 - ch][slot][bin] * switchOrderFactor; } @@ -3775,14 +4423,14 @@ static void formulate2x2MixingMatrix( const float regularizationFactor ) { /* - This function implements a 2x2 solution for an optimized spatial audio rendering algorithm - Vilkamo, J., Bäckström, T. and Kuntz, A., 2013. - "Optimized covariance domain framework for time–frequency processing of spatial audio." - Journal of the Audio Engineering Society, 61(6), pp.403-411. - - The result of the formulas below are the same as those in the publication, however, some - derivation details differ for as simple as possible 2x2 formulattion - */ + This function implements a 2x2 solution for an optimized spatial audio rendering algorithm + Vilkamo, J., Bäckström, T. and Kuntz, A., 2013. + "Optimized covariance domain framework for time–frequency processing of spatial audio." + Journal of the Audio Engineering Society, 61(6), pp.403-411. + + The result of the formulas below are the same as those in the publication, however, some + derivation details differ for as simple as possible 2x2 formulattion + */ int16_t chA, chB; float maxEne, maxEneDiv; float KyRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], KyIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; @@ -3876,7 +4524,7 @@ static void formulate2x2MixingMatrix( matrixMul( tmpRe, tmpIm, Kxre, Kxim, Are, Aim ); /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx - For matrix A that is P = A(A'A)^0.5 + For matrix A that is P = A(A'A)^0.5 */ matrixTransp1Mul( Are, Aim, Are, Aim, tmpRe, tmpIm ); @@ -3916,6 +4564,145 @@ static void formulate2x2MixingMatrix( } +#ifdef IVAS_FLOAT_FIXED +static void getDirectPartGains_fx( + const Word16 bin, + Word16 aziDeg, + Word16 eleDeg, + Word32 *lRealp, + Word32 *lImagp, + Word32 *rRealp, + Word32 *rImagp, + const UWord8 renderStereoOutputInsteadOfBinaural, + Word32 Rmat[3][3], + PARAMBIN_HRTF_GAIN_CACHE *gainCache, + const Word16 isHeadtracked ) +{ + // float aziRad, eleRad; + Word32 y, mappedX; + Word16 aziRadMapped, A, A2, A3; + const Word16 LsAngleRad = 17157; // Q15 + Word32 *ptr_sin, *ptr_cos; + Word32 sin_val, cos_val; + Word16 e_mappedX; + + ptr_sin = &sine_table_Q31[180]; // sin[x] = sine_table_Q31[180 + x] + ptr_cos = cosine_table_Q31; + + IF( renderStereoOutputInsteadOfBinaural ) /* In stereo (i.e. non-binaural) rendering mode */ + { + /* Convert azi and ele to an azi value of the cone of confusion */ + + // y = ( sinf( aziRad ) * cosf( eleRad ) ); + + IF( GT_16( abs_s( eleDeg ), 180 ) ) + { + // cos(180 + x) = -cos(x) + cos_val = -ptr_cos[sub( abs_s( eleDeg ), 180 )]; // Q31 + } + ELSE + { + cos_val = ptr_cos[abs_s( eleDeg )]; // Q31 + } + + IF( GT_16( aziDeg, 180 ) ) + { + // sin(180 + x) = -sin(x) + sin_val = -ptr_sin[sub( aziDeg, 180 )]; // Q31 + } + ELSE IF( LT_16( aziDeg, -180 ) ) + { + // sin(-(180 + x)) = sin(180 + x) = sinx + sin_val = ptr_sin[sub( abs_s( aziDeg ), 180 )]; // Q31 + } + ELSE + { + sin_val = ptr_sin[aziDeg]; // Q31 + } + + y = Mpy_32_32( sin_val, cos_val ); // Q31 + e_mappedX = 0; + mappedX = Sqrt32( L_max( 0, L_sub( ONE_IN_Q31, Mpy_32_32( y, y ) ) ), &e_mappedX ); + + aziRadMapped = BASOP_util_atan2( y, mappedX, negate(e_mappedX) ); // Q13 + + /* Determine the real valued amplitude panning gains */ + *lImagp = 0; + *rImagp = 0; + IF( GE_16( aziRadMapped, shr( LsAngleRad, 2 ) ) ) + { /* Left side */ + *lRealp = ONE_IN_Q31; + *rRealp = 0; + } + ELSE IF( LE_16( aziRadMapped, negate(shr( LsAngleRad, 2 )) ) ) + { /* Right side */ + *lRealp = 0; + *rRealp = ONE_IN_Q31; + } + ELSE /* Tangent panning law */ + { + Word16 e_div, div, e_a, e_a3, temp_16_1, temp_16_2, e_num, e_den; + div = BASOP_Util_Divide3232_Scale( y, mappedX, &e_div ); + e_div = e_div - e_mappedX; + + A = mult( div, INV_TAN30_FX ); + e_a = e_div + 1; + + e_num = BASOP_Util_Add_MantExp( A, e_a, -32767, 0, &temp_16_1 ); + e_den = BASOP_Util_Add_MantExp( A, e_a, 32767, 0, &temp_16_2 ); + IF( LE_16( temp_16_2, 0 ) ) + { + temp_16_2 = 32; + e_den = 0; + } + A2 = BASOP_Util_Divide1616_Scale( temp_16_1, temp_16_2, &e_div ); + e_div = e_div + sub( e_num, e_den ); + + e_den = BASOP_Util_Add_MantExp( mult( A2, A2 ), add( e_div, e_div ), 32767, 0, &temp_16_2 ); + A3 = BASOP_Util_Divide1616_Scale( 32767, temp_16_2, &e_a3 ); + e_a3 = e_a3 - e_den; + // A3 = 1.0f / ( A2 * A2 + 1.0f ); // Q15 + Word32 temp_32 = L_shr( L_deposit_h( A3 ), sub( 0, e_a3 ) ); + Word16 temp_e = 0; + e_a3 = 0; + *lRealp = Sqrt32( temp_32, &e_a3 ); + *rRealp = Sqrt32( L_sub( ONE_IN_Q31, temp_32 ), &temp_e ); + *lRealp = L_shr( *lRealp, sub( 0, e_a3 ) ); // Q31 + *rRealp = L_shr( *rRealp, sub( 0, temp_e ) ); // Q31 + } + + /* Scaling to have the same expected gain as for the HRTF rendering */ + *lRealp = Mpy_32_32( *lRealp, SQRT2_FIXED ); // Q30 + *rRealp = Mpy_32_32( *rRealp, SQRT2_FIXED ); // Q30 + + *lRealp = L_shr( *lRealp, 2 ); // Q28 + *rRealp = L_shr( *rRealp, 2 ); // Q28 + } + ELSE /* In regular binaural rendering mode */ + { + IF( EQ_16( aziDeg, gainCache->azi ) && EQ_16( eleDeg, gainCache->ele ) ) + { + hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE ); + } + ELSE + { + gainCache->azi = aziDeg; + gainCache->ele = eleDeg; + IF( isHeadtracked ) + { + // Word32 aziDeg_32, eleDeg_32; + rotateAziEle_fx( aziDeg, eleDeg, &aziDeg, &eleDeg, Rmat, 0 ); // need to be chnaged + // eleDeg = L_shr(eleDeg_32, 22); + // aziDeg = L_shr(aziDeg_32, 22); + } + hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE ); + } + } + + return; +} +#endif + static void getDirectPartGains( const int16_t bin, int16_t aziDeg, @@ -3990,6 +4777,65 @@ static void getDirectPartGains( } +#ifdef IVAS_FLOAT_FIXED +static void hrtfShGetHrtf_fx( + const Word16 bin, + const Word16 aziDeg, + const Word16 eleDeg, + Word32 *lRealp, + Word32 *lImagp, + Word32 *rRealp, + Word32 *rImagp, + PARAMBIN_HRTF_GAIN_CACHE *gainCache, + const Word16 useCachedValue ) +{ + Word16 k; + + *lRealp = 0; + *lImagp = 0; + *rRealp = 0; + *rImagp = 0; + + IF( useCachedValue ) + { + Word32 *shVec; + shVec = gainCache->shVec_fx; + + FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) + { + + *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ), 1 ) ); // Q28 + *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) ); // Q28 + *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28 + *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 + } + } + ELSE + { + Word32 shVec[HRTF_SH_CHANNELS]; + + ivas_dirac_dec_get_response_fixed( aziDeg, + eleDeg, + shVec, + HRTF_SH_ORDER ); + + FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) + { + + *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ), 1 ) ); // Q28 + *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) ); // Q28 + *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28 + + *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 + + gainCache->shVec_fx[k] = shVec[k]; // Q29 + } + } + + return; +} +#endif + static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, @@ -4117,31 +4963,31 @@ float configure_reqularization_factor( #ifdef IVAS_FLOAT_FIXED Word16 configure_reqularization_factor_fx( const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ) { Word16 reqularizationFactor; reqularizationFactor = 16384; /* Default value */ move16(); - IF ( EQ_32( ivas_format, MASA_FORMAT ) ) + IF( EQ_32( ivas_format, MASA_FORMAT ) ) { - IF ( GE_32( ivas_total_brate, IVAS_160k ) ) + IF( GE_32( ivas_total_brate, IVAS_160k ) ) { reqularizationFactor = 6553; move16(); } - ELSE IF ( EQ_32( ivas_total_brate, IVAS_128k ) ) + ELSE IF( EQ_32( ivas_total_brate, IVAS_128k ) ) { reqularizationFactor = 8192; move16(); } - ELSE IF ( EQ_32( ivas_total_brate, IVAS_96k ) ) + ELSE IF( EQ_32( ivas_total_brate, IVAS_96k ) ) { reqularizationFactor = 9830; move16(); } - ELSE IF ( GE_32( ivas_total_brate, IVAS_64k ) ) + ELSE IF( GE_32( ivas_total_brate, IVAS_64k ) ) { reqularizationFactor = 13107; move16(); @@ -4153,24 +4999,24 @@ Word16 configure_reqularization_factor_fx( } } - IF ( EQ_32( ivas_format, MC_FORMAT ) ) /* This is always McMASA for parametric binauralizer. */ + IF( EQ_32( ivas_format, MC_FORMAT ) ) /* This is always McMASA for parametric binauralizer. */ { - IF ( GE_32( ivas_total_brate, IVAS_96k ) ) + IF( GE_32( ivas_total_brate, IVAS_96k ) ) { reqularizationFactor = 6553; move16(); } - ELSE IF ( GE_32( ivas_total_brate, IVAS_80k ) ) + ELSE IF( GE_32( ivas_total_brate, IVAS_80k ) ) { reqularizationFactor = 8192; move16(); } - ELSE IF ( GE_32( ivas_total_brate, IVAS_64k ) ) + ELSE IF( GE_32( ivas_total_brate, IVAS_64k ) ) { reqularizationFactor = 11468; move16(); } - ELSE IF ( GE_32( ivas_total_brate, IVAS_48k ) ) + ELSE IF( GE_32( ivas_total_brate, IVAS_48k ) ) { reqularizationFactor = 13107; move16(); @@ -4477,325 +5323,702 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( move32(); } } - - /* IIR average the energy measures and determine and apply energy-preserving equalizer */ - hMasaIsmData->preprocEneTarget_fx[bin] = Mpy_32_16_1( hMasaIsmData->preprocEneTarget_fx[bin], STEREO_PREPROCESS_IIR_FACTOR_Q15 ); - move32(); - hMasaIsmData->preprocEneRealized_fx[bin] = Mpy_32_16_1( hMasaIsmData->preprocEneRealized_fx[bin], STEREO_PREPROCESS_IIR_FACTOR_Q15 ); - move32(); - FOR( ch = 0; ch < 2; ch++ ) + + /* IIR average the energy measures and determine and apply energy-preserving equalizer */ + hMasaIsmData->preprocEneTarget_fx[bin] = Mpy_32_16_1( hMasaIsmData->preprocEneTarget_fx[bin], STEREO_PREPROCESS_IIR_FACTOR_Q15 ); + move32(); + hMasaIsmData->preprocEneRealized_fx[bin] = Mpy_32_16_1( hMasaIsmData->preprocEneRealized_fx[bin], STEREO_PREPROCESS_IIR_FACTOR_Q15 ); + move32(); + FOR( ch = 0; ch < 2; ch++ ) + { + hMasaIsmData->preprocEneTarget_fx[bin] = L_add( hMasaIsmData->preprocEneTarget_fx[bin], Madd_32_32( Mpy_32_32( inRe_fx[ch][slot][bin], inRe_fx[ch][slot][bin] ), inIm_fx[ch][slot][bin], inIm_fx[ch][slot][bin] ) ); // Q= *cldfb_buf_q + *cldfb_buf_q - 31 = -19 + move32(); + hMasaIsmData->preprocEneRealized_fx[bin] = L_add( hMasaIsmData->preprocEneRealized_fx[bin], Madd_32_32( Mpy_32_32( outSlotRe_fx[ch], outSlotRe_fx[ch] ), outSlotIm_fx[ch], outSlotIm_fx[ch] ) ); // Q= *cldfb_buf_q + *cldfb_buf_q - 31 = -19 + move32(); + } + temp1 = BASOP_Util_Divide3232_Scale( hMasaIsmData->preprocEneTarget_fx[bin], L_max( EPSILON_FX, hMasaIsmData->preprocEneRealized_fx[bin] ), &eqVal_q_fx ); + eqVal_fx = Sqrt16( temp1, &eqVal_q_fx ); + temp1 = shl( 4, Q12 ); + IF( LT_16( eqVal_q_fx, Q12 ) ) + { + IF( GT_16( eqVal_fx, shr( temp1, sub( Q12, eqVal_q_fx ) ) ) ) + { + eqVal_fx = temp1; + move16(); + eqVal_q_fx = Q12; + move16(); + } + } + ELSE + { + IF( GT_16( shr( eqVal_fx, sub( eqVal_q_fx, Q12 ) ), temp1 ) ) + { + eqVal_fx = temp1; + move16(); + } + } + + FOR( ch = 0; ch < 2; ch++ ) + { + inRe_fx[ch][slot][bin] = Mpy_32_16_1( outSlotRe_fx[ch], eqVal_fx ); + move32(); + inIm_fx[ch][slot][bin] = Mpy_32_16_1( outSlotIm_fx[ch], eqVal_fx ); + move32(); + } + *cldfb_buf_q = sub( add( *cldfb_buf_q, eqVal_q_fx ), 15 ); + } + } + + return; +} +#endif +/*-------------------------------------------------------------------* + * ivas_omasa_preProcessStereoTransportsForMovedObjects() + * + * + *-------------------------------------------------------------------*/ + +void ivas_omasa_preProcessStereoTransportsForMovedObjects( + Decoder_Struct *st_ivas, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t nBins, + const int16_t subframe ) +{ + int16_t bin, ch, inCh, outCh, ismDirIndex, slot; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + MASA_ISM_DATA_HANDLE hMasaIsmData; + uint8_t enableCentering; + int16_t dirac_read_idx; + int16_t nSlots; + + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + hMasaIsmData = st_ivas->hMasaIsmData; + + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) + { + enableCentering = 0; + } + else + { + enableCentering = 1; + } + + /* Bypass processing until first object is moved */ + if ( hMasaIsmData->objectsMoved == 0 ) + { + for ( ismDirIndex = 0; ismDirIndex < hSpatParamRendCom->numIsmDirections; ismDirIndex++ ) + { + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) + { + hMasaIsmData->objectsMoved = 1; + } + } + if ( hMasaIsmData->objectsMoved == 0 ) + { + /* No objects have moved so far */ + return; + } + } + + /* Perform object-movement based processing */ + nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; + dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + + for ( bin = 0; bin < nBins; bin++ ) + { + float ismPreprocMtxNew[2][2]; + float ismPreprocMtxIncrement[2][2]; + float eneMove[2]; + float enePreserve[2]; + float ismRatioAcc; + float subframeEne; + float normEnes[2]; + float remainderNormEne; + + set_zero( ismPreprocMtxNew[0], 2 ); + set_zero( ismPreprocMtxNew[1], 2 ); + set_zero( ismPreprocMtxIncrement[0], 2 ); + set_zero( ismPreprocMtxIncrement[1], 2 ); + set_zero( eneMove, 2 ); + set_zero( enePreserve, 2 ); + ismRatioAcc = 0.0f; + subframeEne = 0.0f; + set_zero( normEnes, 2 ); + + /* Determine transport normalized energies and subframe energy */ + for ( slot = 0; slot < nSlots; slot++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + normEnes[ch] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; + normEnes[ch] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; + } + } + subframeEne = normEnes[0] + normEnes[1]; + normEnes[0] /= fmaxf( 1e-12f, subframeEne ); + normEnes[1] /= fmaxf( 1e-12f, subframeEne ); + + /* For each ismDir, formulate a mix-matrix that moves object audio signals between + * left and right channels when needed. Make a combined matrix by a ratio-weighted sum */ + for ( ismDirIndex = 0; ismDirIndex < hSpatParamRendCom->numIsmDirections; ismDirIndex++ ) + { + float panGainsOut[2]; + float panGainsIn[2]; +#ifdef IVAS_FLOAT_FIXED + Word16 panGainsOut_fx[2]; + Word16 panGainsIn_fx[2]; +#endif + float ratio_float; + float panEnesOut[2]; + float panEnesIn[2]; + float centeringFactor; + + ratio_float = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; + + ismRatioAcc += ratio_float; + + /* Get input and output panning gains */ +#ifdef IVAS_FLOAT_FIXED + ivas_get_stereo_panning_gains_fx( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], + hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], + panGainsIn_fx ); + panGainsIn[0] = (float) panGainsIn_fx[0] / 32767; + panGainsIn[1] = (float) panGainsIn_fx[1] / 32767; +#else + ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], + hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], + panGainsIn ); +#endif + + if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) + { +#ifdef IVAS_FLOAT_FIXED + ivas_get_stereo_panning_gains_fx( hMasaIsmData->azimuth_ism_edited[ismDirIndex], + hMasaIsmData->elevation_ism_edited[ismDirIndex], + panGainsOut_fx ); + panGainsOut[0] = (float) panGainsOut_fx[0] / 32767; + panGainsOut[1] = (float) panGainsOut_fx[1] / 32767; +#else + ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism_edited[ismDirIndex], + hMasaIsmData->elevation_ism_edited[ismDirIndex], + panGainsOut ); +#endif + } + else + { + /* When not edited, input and output pan gains are the same */ + for ( ch = 0; ch < 2; ch++ ) + { + panGainsOut[ch] = panGainsIn[ch]; + } + } + + /* Determine pan enes */ + for ( ch = 0; ch < 2; ch++ ) + { + panEnesOut[ch] = panGainsOut[ch] * panGainsOut[ch]; + panEnesIn[ch] = panGainsIn[ch] * panGainsIn[ch]; + } + + if ( enableCentering ) + { + centeringFactor = fmaxf( 0.0f, 2.0f * fabsf( panEnesIn[0] - panEnesOut[0] ) - 1.0f ); + for ( ch = 0; ch < 2; ch++ ) + { + panEnesOut[ch] *= ( 1.0f - centeringFactor ); + panEnesOut[ch] += 0.5f * centeringFactor; + } + } + + for ( ch = 0; ch < 2; ch++ ) + { + float eneMoveThis; + float enePreserveThis; + eneMoveThis = fmaxf( 0.0f, panEnesIn[ch] - panEnesOut[ch] ); + enePreserveThis = panEnesIn[ch] - eneMoveThis; + + eneMove[ch] += ratio_float * eneMoveThis; + enePreserve[ch] += ratio_float * enePreserveThis; + + /* Subtract object parts from normEnes */ + normEnes[ch] -= panEnesIn[ch] * ratio_float; + } + } + + /* Any remaining (non-object) energy is set to be preserved at both channels */ + remainderNormEne = fmaxf( 0.0f, ( 1.0f - ismRatioAcc ) - normEnes[0] - normEnes[1] ); + for ( ch = 0; ch < 2; ch++ ) + { + enePreserve[ch] += fmaxf( 0.0f, normEnes[ch] + remainderNormEne / 2.0f ); + } + + /* Temporally average energy moving and preserving, and generate the transport signal preprocessing matrix */ + for ( ch = 0; ch < 2; ch++ ) + { + float normVal; + hMasaIsmData->eneMoveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->eneMoveIIR[ch][bin] += eneMove[ch] * subframeEne; + hMasaIsmData->enePreserveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->enePreserveIIR[ch][bin] += enePreserve[ch] * subframeEne; + normVal = fmaxf( EPSILON, hMasaIsmData->eneMoveIIR[ch][bin] + hMasaIsmData->enePreserveIIR[ch][bin] ); + ismPreprocMtxNew[ch][ch] = sqrtf( hMasaIsmData->enePreserveIIR[ch][bin] / normVal ); + ismPreprocMtxNew[1 - ch][ch] = sqrtf( hMasaIsmData->eneMoveIIR[ch][bin] / normVal ); + } + + /* Get increment value for temporal interpolation */ + for ( inCh = 0; inCh < 2; inCh++ ) + { + for ( outCh = 0; outCh < 2; outCh++ ) + { + ismPreprocMtxIncrement[outCh][inCh] = ( ismPreprocMtxNew[outCh][inCh] - hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] ) / (float) nSlots; + } + } + + /* Mix signals */ + for ( slot = 0; slot < nSlots; slot++ ) + { + float eqVal; + float outSlotRe[2]; + float outSlotIm[2]; + + set_zero( outSlotRe, 2 ); + set_zero( outSlotIm, 2 ); + + for ( outCh = 0; outCh < 2; outCh++ ) + { + for ( inCh = 0; inCh < 2; inCh++ ) + { + hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] += ismPreprocMtxIncrement[outCh][inCh]; + outSlotRe[outCh] += inRe[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; + outSlotIm[outCh] += inIm[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; + } + } + + /* IIR average the energy measures and determine and apply energy-preserving equalizer */ + hMasaIsmData->preprocEneTarget[bin] *= STEREO_PREPROCESS_IIR_FACTOR; + hMasaIsmData->preprocEneRealized[bin] *= STEREO_PREPROCESS_IIR_FACTOR; + for ( ch = 0; ch < 2; ch++ ) + { + hMasaIsmData->preprocEneTarget[bin] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; + hMasaIsmData->preprocEneTarget[bin] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; + hMasaIsmData->preprocEneRealized[bin] += outSlotRe[ch] * outSlotRe[ch]; + hMasaIsmData->preprocEneRealized[bin] += outSlotIm[ch] * outSlotIm[ch]; + } + eqVal = fminf( 4.0f, sqrtf( hMasaIsmData->preprocEneTarget[bin] / fmaxf( 1e-12f, hMasaIsmData->preprocEneRealized[bin] ) ) ); + for ( ch = 0; ch < 2; ch++ ) + { + inRe[ch][slot][bin] = outSlotRe[ch] * eqVal; + inIm[ch][slot][bin] = outSlotIm[ch] * eqVal; + } + } + } + + return; +} + +#ifndef IVAS_FLOAT_FIXED +static void ivas_masa_ext_rend_parambin_internal( + MASA_EXT_REND_HANDLE hMasaExtRend, + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, + float *output_f[], + const int16_t subframe ) +{ + DIRAC_DEC_BIN_HANDLE hDiracDecBin; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + PARAMBIN_REND_CONFIG config_data; + int16_t slot, ch, numInChannels; + float Cldfb_RealBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Rmat[3][3]; + int16_t max_band_decorr; + int16_t nBins; + int16_t i, j; + int16_t nchan_transport; + +#ifdef IVAS_FLOAT_FIXED + Word32 *output_fx[MAX_OUTPUT_CHANNELS]; + Word32 output_fx_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word32 Cldfb_RealBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 Rmat_fx[3][3]; +#endif + + hDiracDecBin = hMasaExtRend->hDiracDecBin; + assert( hDiracDecBin ); + hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; + nBins = hSpatParamRendCom->num_freq_bands; + + /* Setup internal config. MASA EXT renderer is quite strict. */ + config_data.separateCenterChannelRendering = 0; + config_data.ivas_format = MASA_FORMAT; + config_data.mc_mode = MC_MODE_NONE; + config_data.ivas_total_brate = IVAS_512k; /* Maximum bitrate set for external renderer */ + config_data.nchan_transport = hMasaExtRend->nchan_input; + config_data.qualityBasedSmFactor = 1.0f; + config_data.processReverb = hMasaExtRend->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; + config_data.ism_mode = ISM_MODE_NONE; + + /* Set nchan_transport to number of transport channels in MASA input */ + nchan_transport = hMasaExtRend->nchan_input; + + /* The input channel number at this processing function (not nchan_transport) */ + numInChannels = BINAURAL_CHANNELS; +#ifdef IVAS_FLOAT_FIXED + Rmat_fx[0][0] = ONE_IN_Q31; + move32(); + Rmat_fx[0][1] = 0; + move32(); + Rmat_fx[0][2] = 0; + move32(); + + Rmat_fx[1][0] = 0; + move32(); + Rmat_fx[1][1] = ONE_IN_Q31; + move32(); + Rmat_fx[1][2] = 0; + move32(); + + Rmat_fx[2][0] = 0; + move32(); + Rmat_fx[2][1] = 0; + move32(); + Rmat_fx[2][2] = ONE_IN_Q31; + move32(); +#endif + Rmat[0][0] = 1.0f; + Rmat[0][1] = 0.0f; + Rmat[0][2] = 0.0f; + + Rmat[1][0] = 0.0f; + Rmat[1][1] = 1.0f; + Rmat[1][2] = 0.0f; + + Rmat[2][0] = 0.0f; + Rmat[2][1] = 0.0f; + Rmat[2][2] = 1.0f; + + /* CLDFB Analysis of input */ + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + { + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch == 0 || nchan_transport == 2 ) + { + cldfbAnalysis_ts_ivas( + &( output_f[ch][nBins * slot] ), + Cldfb_RealBuffer_in[ch][slot], + Cldfb_ImagBuffer_in[ch][slot], + nBins, hMasaExtRend->cldfbAnaRend[ch] ); + } + else /* when nchan_transport == 1 and ch == 1 */ { - hMasaIsmData->preprocEneTarget_fx[bin] = L_add( hMasaIsmData->preprocEneTarget_fx[bin], Madd_32_32( Mpy_32_32( inRe_fx[ch][slot][bin], inRe_fx[ch][slot][bin] ), inIm_fx[ch][slot][bin], inIm_fx[ch][slot][bin] ) ); // Q= *cldfb_buf_q + *cldfb_buf_q - 31 = -19 - move32(); - hMasaIsmData->preprocEneRealized_fx[bin] = L_add( hMasaIsmData->preprocEneRealized_fx[bin], Madd_32_32( Mpy_32_32( outSlotRe_fx[ch], outSlotRe_fx[ch] ), outSlotIm_fx[ch], outSlotIm_fx[ch] ) ); // Q= *cldfb_buf_q + *cldfb_buf_q - 31 = -19 - move32(); + /* At mono input duplicate the channel to dual-mono, and apply gain + correction to ensure same overall level as in stereo mode */ + v_multc( Cldfb_RealBuffer_in[0][slot], INV_SQRT_2, Cldfb_RealBuffer_in[0][slot], nBins ); + v_multc( Cldfb_ImagBuffer_in[0][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[0][slot], nBins ); + + mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); + mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); } - temp1 = BASOP_Util_Divide3232_Scale( hMasaIsmData->preprocEneTarget_fx[bin], L_max( EPSILON_FX, hMasaIsmData->preprocEneRealized_fx[bin] ), &eqVal_q_fx ); - eqVal_fx = Sqrt16( temp1, &eqVal_q_fx ); - temp1 = shl( 4, Q12 ); - IF( LT_16( eqVal_q_fx, Q12 ) ) + } + } + + Word16 q_inp = Q6; + if ( hCombinedOrientationData ) + { + for ( i = 0; i < 3; i++ ) + { + for ( j = 0; j < 3; j++ ) { - IF( GT_16( eqVal_fx, shr( temp1, sub( Q12, eqVal_q_fx ) ) ) ) - { - eqVal_fx = temp1; - move16(); - eqVal_q_fx = Q12; - move16(); - } +#ifdef IVAS_FLOAT_FIXED + Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// +#endif + Rmat[i][j] = hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][i][j]; } - ELSE + } + + IF( EQ_16( nchan_transport, 2 ) ) + { +#ifdef IVAS_FLOAT_FIXED + FOR( Word16 cha = 0; cha < 2; cha++ ) + FOR( slot = 0; slot < 4; slot++ ) + FOR( Word16 ind = 0; ind < 60; ind++ ) { - IF( GT_16( shr( eqVal_fx, sub( eqVal_q_fx, Q12 ) ), temp1 ) ) - { - eqVal_fx = temp1; - move16(); - } + Cldfb_RealBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_RealBuffer_in[cha][slot][ind], q_inp ); + Cldfb_ImagBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_ImagBuffer_in[cha][slot][ind], q_inp ); } + adaptTransportSignalsHeadtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); - FOR( ch = 0; ch < 2; ch++ ) + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); + FOR( Word16 cha = 0; cha < 2; cha++ ) + FOR( slot = 0; slot < 4; slot++ ) + FOR( Word16 ind = 0; ind < 60; ind++ ) { - inRe_fx[ch][slot][bin] = Mpy_32_16_1( outSlotRe_fx[ch], eqVal_fx ); - move32(); - inIm_fx[ch][slot][bin] = Mpy_32_16_1( outSlotIm_fx[ch], eqVal_fx ); - move32(); + Cldfb_RealBuffer_in[cha][slot][ind] = fix_to_float( Cldfb_RealBuffer_in_fx[cha][slot][ind], q_inp ); + Cldfb_ImagBuffer_in[cha][slot][ind] = fix_to_float( Cldfb_ImagBuffer_in_fx[cha][slot][ind], q_inp ); } - *cldfb_buf_q = sub( add( *cldfb_buf_q, eqVal_q_fx ), 15 ); - } - } +#else + adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); - return; -} + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); #endif -/*-------------------------------------------------------------------* - * ivas_omasa_preProcessStereoTransportsForMovedObjects() - * - * - *-------------------------------------------------------------------*/ - -void ivas_omasa_preProcessStereoTransportsForMovedObjects( - Decoder_Struct *st_ivas, - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const int16_t nBins, - const int16_t subframe ) -{ - int16_t bin, ch, inCh, outCh, ismDirIndex, slot; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - MASA_ISM_DATA_HANDLE hMasaIsmData; - uint8_t enableCentering; - int16_t dirac_read_idx; - int16_t nSlots; - - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - hMasaIsmData = st_ivas->hMasaIsmData; + } + } - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) +#ifdef IVAS_FLOAT_FIXED +#if 1 + Word16 q_earlyPartEneCorrection = Q_factor_arrL( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); + hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; + floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { - enableCentering = 0; + f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); + f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); + f2me( hDiracDecBin->ChCrossReOutPrev[j], &hDiracDecBin->ChCrossReOutPrev_fx[j], &hDiracDecBin->ChCrossReOutPrev_e[j] ); + f2me( hDiracDecBin->ChCrossImOutPrev[j], &hDiracDecBin->ChCrossImOutPrev_fx[j], &hDiracDecBin->ChCrossImOutPrev_e[j] ); + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + f2me( hDiracDecBin->ChEnePrev[i][j], &hDiracDecBin->ChEnePrev_fx[i][j], &hDiracDecBin->ChEnePrev_e[i][j] ); + f2me( hDiracDecBin->ChEneOutPrev[i][j], &hDiracDecBin->ChEneOutPrev_fx[i][j], &hDiracDecBin->ChEneOutPrev_e[i][j] ); + } } - else + FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) { - enableCentering = 1; + IF( hSpatParamRendCom->energy_ratio1 ) + floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[i], hSpatParamRendCom->energy_ratio1_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); + IF( hSpatParamRendCom->energy_ratio2 ) + floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[i], hSpatParamRendCom->energy_ratio2_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); } - - /* Bypass processing until first object is moved */ - if ( hMasaIsmData->objectsMoved == 0 ) + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, 31, hSpatParamRendCom->num_freq_bands ); + IF( hDiracDecBin->hDiffuseDist ) { - for ( ismDirIndex = 0; ismDirIndex < hSpatParamRendCom->numIsmDirections; ismDirIndex++ ) - { - if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) - { - hMasaIsmData->objectsMoved = 1; - } - } - if ( hMasaIsmData->objectsMoved == 0 ) + floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioX, hDiracDecBin->hDiffuseDist->diffuseRatioX_fx, 31, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceX, hDiracDecBin->diffuseFieldCoherenceX_fx, 31, 9 ); + floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioY, hDiracDecBin->hDiffuseDist->diffuseRatioY_fx, 31, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceY, hDiracDecBin->diffuseFieldCoherenceY_fx, 31, 9 ); + floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioZ, hDiracDecBin->hDiffuseDist->diffuseRatioZ_fx, 31, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceZ, hDiracDecBin->diffuseFieldCoherenceZ_fx, 31, 9 ); + } + config_data.qualityBasedSmFactor_fx = (Word32) ( config_data.qualityBasedSmFactor * ONE_IN_Q31 ); +#endif + Word16 shift = 31; + Word32 Cldfb_RealBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Cldfb_ImagBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + FOR( i = 0; i < 2; i++ ) + { + FOR( j = 0; j < 4; j++ ) { - /* No objects have moved so far */ - return; + shift = s_min(shift, getScaleFactor32(Cldfb_RealBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); + shift = s_min(shift, getScaleFactor32(Cldfb_ImagBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); } } - /* Perform object-movement based processing */ - nSlots = hSpatParamRendCom->subframe_nbslots[subframe]; - dirac_read_idx = hSpatParamRendCom->render_to_md_map[subframe]; + Word16 q = q_inp + shift; - for ( bin = 0; bin < nBins; bin++ ) + FOR( i = 0; i < 2; i++ ) { - float ismPreprocMtxNew[2][2]; - float ismPreprocMtxIncrement[2][2]; - float eneMove[2]; - float enePreserve[2]; - float ismRatioAcc; - float subframeEne; - float normEnes[2]; - float remainderNormEne; - - set_zero( ismPreprocMtxNew[0], 2 ); - set_zero( ismPreprocMtxNew[1], 2 ); - set_zero( ismPreprocMtxIncrement[0], 2 ); - set_zero( ismPreprocMtxIncrement[1], 2 ); - set_zero( eneMove, 2 ); - set_zero( enePreserve, 2 ); - ismRatioAcc = 0.0f; - subframeEne = 0.0f; - set_zero( normEnes, 2 ); - - /* Determine transport normalized energies and subframe energy */ - for ( slot = 0; slot < nSlots; slot++ ) + FOR( j = 0; j < 4; j++ ) { - for ( ch = 0; ch < 2; ch++ ) + FOR( Word16 k = 0; k < 60; k++ ) { - normEnes[ch] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; - normEnes[ch] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; + Cldfb_RealBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_RealBuffer_in_fx[i][j][k], shift ); + Cldfb_ImagBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_ImagBuffer_in_fx[i][j][k], shift ); } } - subframeEne = normEnes[0] + normEnes[1]; - normEnes[0] /= fmaxf( 1e-12f, subframeEne ); - normEnes[1] /= fmaxf( 1e-12f, subframeEne ); + } - /* For each ismDir, formulate a mix-matrix that moves object audio signals between - * left and right channels when needed. Make a combined matrix by a ratio-weighted sum */ - for ( ismDirIndex = 0; ismDirIndex < hSpatParamRendCom->numIsmDirections; ismDirIndex++ ) + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL, q ); +#if 1 + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) { - float panGainsOut[2]; - float panGainsIn[2]; -#ifdef IVAS_FLOAT_FIXED - Word16 panGainsOut_fx[2]; - Word16 panGainsIn_fx[2]; -#endif - float ratio_float; - float panEnesOut[2]; - float panEnesIn[2]; - float centeringFactor; - - ratio_float = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; + hDiracDecBin->ChEnePrev[i][j] = me2f( hDiracDecBin->ChEnePrev_fx[i][j], hDiracDecBin->ChEnePrev_e[i][j] ); + hDiracDecBin->ChEne[i][j] = me2f( hDiracDecBin->ChEne_fx[i][j], hDiracDecBin->ChEne_e[i][j] ); + hDiracDecBin->ChEneOut[i][j] = me2f( hDiracDecBin->ChEneOut_fx[i][j], hDiracDecBin->ChEneOut_e[i][j] ); + hDiracDecBin->ChEneOutPrev[i][j] = me2f( hDiracDecBin->ChEneOutPrev_fx[i][j], hDiracDecBin->ChEneOutPrev_e[i][j] ); + } + } - ismRatioAcc += ratio_float; + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + { + hDiracDecBin->ChCrossRePrev[j] = me2f( hDiracDecBin->ChCrossRePrev_fx[j], hDiracDecBin->ChCrossRePrev_e[j] ); + hDiracDecBin->ChCrossImPrev[j] = me2f( hDiracDecBin->ChCrossImPrev_fx[j], hDiracDecBin->ChCrossImPrev_e[j] ); + hDiracDecBin->ChCrossRe[j] = me2f( hDiracDecBin->ChCrossRe_fx[j], hDiracDecBin->ChCrossRe_e[j] ); + hDiracDecBin->ChCrossIm[j] = me2f( hDiracDecBin->ChCrossIm_fx[j], hDiracDecBin->ChCrossIm_e[j] ); + hDiracDecBin->ChCrossReOut[j] = me2f( hDiracDecBin->ChCrossReOut_fx[j], hDiracDecBin->ChCrossReOut_e[j] ); + hDiracDecBin->ChCrossImOut[j] = me2f( hDiracDecBin->ChCrossImOut_fx[j], hDiracDecBin->ChCrossImOut_e[j] ); + hDiracDecBin->ChCrossReOutPrev[j] = me2f( hDiracDecBin->ChCrossReOutPrev_fx[j], hDiracDecBin->ChCrossReOutPrev_e[j] ); + hDiracDecBin->ChCrossImOutPrev[j] = me2f( hDiracDecBin->ChCrossImOutPrev_fx[j], hDiracDecBin->ChCrossImOutPrev_e[j] ); + } + fixedToFloat_arrL( hDiracDecBin->frameMeanDiffuseness_fx, hDiracDecBin->frameMeanDiffuseness, 29, CLDFB_NO_CHANNELS_MAX ); - /* Get input and output panning gains */ -#ifdef IVAS_FLOAT_FIXED - ivas_get_stereo_panning_gains_fx( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], - hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], - panGainsIn_fx ); - panGainsIn[0] = (float) panGainsIn_fx[0] / 32767; - panGainsIn[1] = (float) panGainsIn_fx[1] / 32767; -#else - ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], - hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], - panGainsIn ); #endif - if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) - { -#ifdef IVAS_FLOAT_FIXED - ivas_get_stereo_panning_gains_fx( hMasaIsmData->azimuth_ism_edited[ismDirIndex], - hMasaIsmData->elevation_ism_edited[ismDirIndex], - panGainsOut_fx ); - panGainsOut[0] = (float) panGainsOut_fx[0] / 32767; - panGainsOut[1] = (float) panGainsOut_fx[1] / 32767; #else - ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism_edited[ismDirIndex], - hMasaIsmData->elevation_ism_edited[ismDirIndex], - panGainsOut ); + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL ); #endif - } - else - { - /* When not edited, input and output pan gains are the same */ - for ( ch = 0; ch < 2; ch++ ) - { - panGainsOut[ch] = panGainsIn[ch]; - } - } + /* Always using CLDFB decorrelation in MASA EXT renderer */ + max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; - /* Determine pan enes */ - for ( ch = 0; ch < 2; ch++ ) - { - panEnesOut[ch] = panGainsOut[ch] * panGainsOut[ch]; - panEnesIn[ch] = panGainsIn[ch] * panGainsIn[ch]; - } - if ( enableCentering ) - { - centeringFactor = fmaxf( 0.0f, 2.0f * fabsf( panEnesIn[0] - panEnesOut[0] ) - 1.0f ); - for ( ch = 0; ch < 2; ch++ ) - { - panEnesOut[ch] *= ( 1.0f - centeringFactor ); - panEnesOut[ch] += 0.5f * centeringFactor; - } - } + ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, + 0, NULL ); - for ( ch = 0; ch < 2; ch++ ) - { - float eneMoveThis; - float enePreserveThis; - eneMoveThis = fmaxf( 0.0f, panEnesIn[ch] - panEnesOut[ch] ); - enePreserveThis = panEnesIn[ch] - eneMoveThis; - eneMove[ch] += ratio_float * eneMoveThis; - enePreserve[ch] += ratio_float * enePreserveThis; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /* Subtract object parts from normEnes */ - normEnes[ch] -= panEnesIn[ch] * ratio_float; - } +#ifdef IVAS_FLOAT_FIXED + Word16 q_out; + Word16 q_mat = 15; + q_inp = Q6; + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + output_fx[ch] = output_fx_buff[ch]; + } + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + FOR( slot = 0; slot < BINAURAL_CHANNELS; slot++ ) + { + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecRe[ch][slot], nBins ) ); + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecIm[ch][slot], nBins ) ); + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecRePrev[ch][slot], nBins ) ); + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecImPrev[ch][slot], nBins ) ); } - - /* Any remaining (non-object) energy is set to be preserved at both channels */ - remainderNormEne = fmaxf( 0.0f, ( 1.0f - ismRatioAcc ) - normEnes[0] - normEnes[1] ); - for ( ch = 0; ch < 2; ch++ ) + } + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + FOR( slot = 0; slot < numInChannels; slot++ ) { - enePreserve[ch] += fmaxf( 0.0f, normEnes[ch] + remainderNormEne / 2.0f ); + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxRe[ch][slot], nBins ) ); + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxIm[ch][slot], nBins ) ); + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxRePrev[ch][slot], nBins ) ); + q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxImPrev[ch][slot], nBins ) ); } - - /* Temporally average energy moving and preserving, and generate the transport signal preprocessing matrix */ - for ( ch = 0; ch < 2; ch++ ) + } + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + output_fx[ch] = output_fx_buff[ch]; + } + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + FOR( slot = 0; slot < BINAURAL_CHANNELS; slot++ ) { - float normVal; - hMasaIsmData->eneMoveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; - hMasaIsmData->eneMoveIIR[ch][bin] += eneMove[ch] * subframeEne; - hMasaIsmData->enePreserveIIR[ch][bin] *= STEREO_PREPROCESS_IIR_FACTOR; - hMasaIsmData->enePreserveIIR[ch][bin] += enePreserve[ch] * subframeEne; - normVal = fmaxf( EPSILON, hMasaIsmData->eneMoveIIR[ch][bin] + hMasaIsmData->enePreserveIIR[ch][bin] ); - ismPreprocMtxNew[ch][ch] = sqrtf( hMasaIsmData->enePreserveIIR[ch][bin] / normVal ); - ismPreprocMtxNew[1 - ch][ch] = sqrtf( hMasaIsmData->eneMoveIIR[ch][bin] / normVal ); + floatToFixed_arr16( hDiracDecBin->processMtxDecRe[ch][slot], hDiracDecBin->processMtxDecRe_fx[ch][slot], q_mat, nBins ); + floatToFixed_arr16( hDiracDecBin->processMtxDecIm[ch][slot], hDiracDecBin->processMtxDecIm_fx[ch][slot], q_mat, nBins ); + floatToFixed_arr16( hDiracDecBin->processMtxDecRePrev[ch][slot], hDiracDecBin->processMtxDecRePrev_fx[ch][slot], q_mat, nBins ); + floatToFixed_arr16( hDiracDecBin->processMtxDecImPrev[ch][slot], hDiracDecBin->processMtxDecImPrev_fx[ch][slot], q_mat, nBins ); } - - /* Get increment value for temporal interpolation */ - for ( inCh = 0; inCh < 2; inCh++ ) + } + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + FOR( slot = 0; slot < numInChannels; slot++ ) { - for ( outCh = 0; outCh < 2; outCh++ ) - { - ismPreprocMtxIncrement[outCh][inCh] = ( ismPreprocMtxNew[outCh][inCh] - hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] ) / (float) nSlots; - } + floatToFixed_arr16( hDiracDecBin->processMtxRe[ch][slot], hDiracDecBin->processMtxRe_fx[ch][slot], q_mat, nBins ); + floatToFixed_arr16( hDiracDecBin->processMtxIm[ch][slot], hDiracDecBin->processMtxIm_fx[ch][slot], q_mat, nBins ); + floatToFixed_arr16( hDiracDecBin->processMtxRePrev[ch][slot], hDiracDecBin->processMtxRePrev_fx[ch][slot], q_mat, nBins ); + floatToFixed_arr16( hDiracDecBin->processMtxImPrev[ch][slot], hDiracDecBin->processMtxImPrev_fx[ch][slot], q_mat, nBins ); } + floatToFixed_arrL( hMasaExtRend->cldfbSynRend[ch]->cldfb_state, hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx, Q11, hMasaExtRend->cldfbSynRend[ch]->p_filter_length ); + hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state = Q11; + } + FOR( Word16 cha = 0; cha < 6; cha++ ) + FOR( slot = 0; slot < 4; slot++ ) + FOR( Word16 ind = 0; ind < 60; ind++ ) + { + Cldfb_RealBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_RealBuffer_in[cha][slot][ind], Q6 ); + Cldfb_ImagBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_ImagBuffer_in[cha][slot][ind], Q6 ); + } + ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); - /* Mix signals */ - for ( slot = 0; slot < nSlots; slot++ ) - { - float eqVal; - float outSlotRe[2]; - float outSlotIm[2]; + FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + fixedToFloat_arrL32( output_fx[ch], output_f[ch], q_out, nBins * hSpatParamRendCom->subframe_nbslots[subframe] ); + fixedToFloat_arrL32( hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx, hMasaExtRend->cldfbSynRend[ch]->cldfb_state, hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state, hMasaExtRend->cldfbSynRend[ch]->p_filter_length ); + } +#else + ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); +#endif + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - set_zero( outSlotRe, 2 ); - set_zero( outSlotIm, 2 ); - for ( outCh = 0; outCh < 2; outCh++ ) - { - for ( inCh = 0; inCh < 2; inCh++ ) - { - hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin] += ismPreprocMtxIncrement[outCh][inCh]; - outSlotRe[outCh] += inRe[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; - outSlotIm[outCh] += inIm[inCh][slot][bin] * hMasaIsmData->ismPreprocMatrix[outCh][inCh][bin]; - } - } + hDiracDecBin->hDiffuseDist = NULL; - /* IIR average the energy measures and determine and apply energy-preserving equalizer */ - hMasaIsmData->preprocEneTarget[bin] *= STEREO_PREPROCESS_IIR_FACTOR; - hMasaIsmData->preprocEneRealized[bin] *= STEREO_PREPROCESS_IIR_FACTOR; - for ( ch = 0; ch < 2; ch++ ) - { - hMasaIsmData->preprocEneTarget[bin] += inRe[ch][slot][bin] * inRe[ch][slot][bin]; - hMasaIsmData->preprocEneTarget[bin] += inIm[ch][slot][bin] * inIm[ch][slot][bin]; - hMasaIsmData->preprocEneRealized[bin] += outSlotRe[ch] * outSlotRe[ch]; - hMasaIsmData->preprocEneRealized[bin] += outSlotIm[ch] * outSlotIm[ch]; - } - eqVal = fminf( 4.0f, sqrtf( hMasaIsmData->preprocEneTarget[bin] / fmaxf( 1e-12f, hMasaIsmData->preprocEneRealized[bin] ) ) ); - for ( ch = 0; ch < 2; ch++ ) - { - inRe[ch][slot][bin] = outSlotRe[ch] * eqVal; - inIm[ch][slot][bin] = outSlotIm[ch] * eqVal; - } - } - } + hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; + hSpatParamRendCom->subframes_rendered++; return; -} - + } +#else static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], - const int16_t subframe ) + const Word16 subframe ) { + DIRAC_DEC_BIN_HANDLE hDiracDecBin; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; PARAMBIN_REND_CONFIG config_data; - int16_t slot, ch, numInChannels; - float Cldfb_RealBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_in[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Rmat[3][3]; - int16_t max_band_decorr; - int16_t nBins; - int16_t i, j; - int16_t nchan_transport; + Word16 slot, ch, numInChannels; + Word16 max_band_decorr; + Word16 nBins; + Word16 i, j; + Word16 nchan_transport; -#ifdef IVAS_FLOAT_FIXED +#if 1 + hDiracDecBin = hMasaExtRend->hDiracDecBin; + hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; Word32 *output_fx[MAX_OUTPUT_CHANNELS]; Word32 output_fx_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word16 q_earlyPartEneCorrection = Q_factor_arrL( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); + hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; + floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + { + f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); + f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); + f2me( hDiracDecBin->ChCrossReOutPrev[j], &hDiracDecBin->ChCrossReOutPrev_fx[j], &hDiracDecBin->ChCrossReOutPrev_e[j] ); + f2me( hDiracDecBin->ChCrossImOutPrev[j], &hDiracDecBin->ChCrossImOutPrev_fx[j], &hDiracDecBin->ChCrossImOutPrev_e[j] ); + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + f2me( hDiracDecBin->ChEnePrev[i][j], &hDiracDecBin->ChEnePrev_fx[i][j], &hDiracDecBin->ChEnePrev_e[i][j] ); + f2me( hDiracDecBin->ChEneOutPrev[i][j], &hDiracDecBin->ChEneOutPrev_fx[i][j], &hDiracDecBin->ChEneOutPrev_e[i][j] ); + } + } + FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) + { + IF( hSpatParamRendCom->energy_ratio1 ) + floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[i], hSpatParamRendCom->energy_ratio1_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); + IF( hSpatParamRendCom->energy_ratio2 ) + floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[i], hSpatParamRendCom->energy_ratio2_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); + } + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, 31, hSpatParamRendCom->num_freq_bands ); + IF( hDiracDecBin->hDiffuseDist ) + { + floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioX, hDiracDecBin->hDiffuseDist->diffuseRatioX_fx, 31, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceX, hDiracDecBin->diffuseFieldCoherenceX_fx, 31, 9 ); + floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioY, hDiracDecBin->hDiffuseDist->diffuseRatioY_fx, 31, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceY, hDiracDecBin->diffuseFieldCoherenceY_fx, 31, 9 ); + floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioZ, hDiracDecBin->hDiffuseDist->diffuseRatioZ_fx, 31, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceZ, hDiracDecBin->diffuseFieldCoherenceZ_fx, 31, 9 ); + } + FOR( ch = 0; ch < 2; ch++) + { + output_fx[ch] = output_fx_buff[ch]; + floatToFixed_arrL32(output_f[ch], output_fx[ch], Q11, L_FRAME48k); + floatToFixed_arrL32(hMasaExtRend->cldfbAnaRend[ch]->cldfb_state, hMasaExtRend->cldfbAnaRend[ch]->cldfb_state_fx, Q11, hMasaExtRend->cldfbAnaRend[ch]->p_filter_length - hMasaExtRend->cldfbAnaRend[ch]->no_channels); + } +#endif + Word32 Cldfb_RealBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Rmat_fx[3][3]; -#endif hDiracDecBin = hMasaExtRend->hDiracDecBin; assert( hDiracDecBin ); @@ -4804,141 +6027,163 @@ static void ivas_masa_ext_rend_parambin_internal( /* Setup internal config. MASA EXT renderer is quite strict. */ config_data.separateCenterChannelRendering = 0; + move16(); config_data.ivas_format = MASA_FORMAT; config_data.mc_mode = MC_MODE_NONE; config_data.ivas_total_brate = IVAS_512k; /* Maximum bitrate set for external renderer */ + move32(); config_data.nchan_transport = hMasaExtRend->nchan_input; + move16(); config_data.qualityBasedSmFactor = 1.0f; + config_data.qualityBasedSmFactor_fx = ONE_IN_Q31; + move32(); config_data.processReverb = hMasaExtRend->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; + move16(); config_data.ism_mode = ISM_MODE_NONE; /* Set nchan_transport to number of transport channels in MASA input */ nchan_transport = hMasaExtRend->nchan_input; + move16(); /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; -#ifdef IVAS_FLOAT_FIXED - Rmat_fx[0][0] = ONE_IN_Q31; - move32(); + move16(); + + Rmat_fx[0][0] = ONE_IN_Q30; Rmat_fx[0][1] = 0; - move32(); Rmat_fx[0][2] = 0; - move32(); + move32(); move32(); move32(); Rmat_fx[1][0] = 0; - move32(); - Rmat_fx[1][1] = ONE_IN_Q31; - move32(); + Rmat_fx[1][1] = ONE_IN_Q30; Rmat_fx[1][2] = 0; - move32(); + move32(); move32(); move32(); Rmat_fx[2][0] = 0; - move32(); Rmat_fx[2][1] = 0; - move32(); - Rmat_fx[2][2] = ONE_IN_Q31; - move32(); -#endif - Rmat[0][0] = 1.0f; - Rmat[0][1] = 0.0f; - Rmat[0][2] = 0.0f; - - Rmat[1][0] = 0.0f; - Rmat[1][1] = 1.0f; - Rmat[1][2] = 0.0f; - - Rmat[2][0] = 0.0f; - Rmat[2][1] = 0.0f; - Rmat[2][2] = 1.0f; + Rmat_fx[2][2] = ONE_IN_Q30; + move32(); move32(); move32(); /* CLDFB Analysis of input */ - for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) + + Word16 q_cldfb = Q11; + FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { - for ( ch = 0; ch < numInChannels; ch++ ) + FOR( ch = 0; ch < numInChannels; ch++ ) { - if ( ch == 0 || nchan_transport == 2 ) + IF( EQ_16(ch, 0) || EQ_16(nchan_transport, 2) ) { - cldfbAnalysis_ts_ivas( - &( output_f[ch][nBins * slot] ), - Cldfb_RealBuffer_in[ch][slot], - Cldfb_ImagBuffer_in[ch][slot], - nBins, hMasaExtRend->cldfbAnaRend[ch] ); + cldfbAnalysis_ts_fx_fixed_q( + &( output_fx[ch][nBins * slot] ), + Cldfb_RealBuffer_in_fx[ch][slot], + Cldfb_ImagBuffer_in_fx[ch][slot], + nBins, hMasaExtRend->cldfbAnaRend[ch], &q_cldfb); } - else /* when nchan_transport == 1 and ch == 1 */ + ELSE /* when nchan_transport == 1 and ch == 1 */ { /* At mono input duplicate the channel to dual-mono, and apply gain correction to ensure same overall level as in stereo mode */ - v_multc( Cldfb_RealBuffer_in[0][slot], INV_SQRT_2, Cldfb_RealBuffer_in[0][slot], nBins ); - v_multc( Cldfb_ImagBuffer_in[0][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[0][slot], nBins ); + v_multc_fixed( Cldfb_RealBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); + v_multc_fixed( Cldfb_ImagBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); - mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); - mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); + mvl2l( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); + mvl2l( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); } } } - - if ( hCombinedOrientationData ) + Word16 q_inp = Q6; + IF ( hCombinedOrientationData ) { - for ( i = 0; i < 3; i++ ) + FOR ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) + FOR ( j = 0; j < 3; j++ ) { -#ifdef IVAS_FLOAT_FIXED - Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// -#endif - Rmat[i][j] = hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][i][j]; + Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// } } - IF(EQ_16(nchan_transport, 2)) + IF( EQ_16( nchan_transport, 2 ) ) { -#ifdef IVAS_FLOAT_FIXED - Word16 q_inp = Q6; - FOR(Word16 cha = 0; cha < 2; cha++) - FOR(slot = 0; slot < 4; slot++) - FOR(Word16 ind = 0; ind < 60; ind++) - { - Cldfb_RealBuffer_in_fx[cha][slot][ind] = float_to_fix(Cldfb_RealBuffer_in[cha][slot][ind], q_inp); - Cldfb_ImagBuffer_in_fx[cha][slot][ind] = float_to_fix(Cldfb_ImagBuffer_in[cha][slot][ind], q_inp); - } - adaptTransportSignalsHeadtracked_fx(hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx); - - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx(hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx); - FOR(Word16 cha = 0; cha < 2; cha++) - FOR(slot = 0; slot < 4; slot++) - FOR(Word16 ind = 0; ind < 60; ind++) - { - Cldfb_RealBuffer_in[cha][slot][ind] = fix_to_float(Cldfb_RealBuffer_in_fx[cha][slot][ind], q_inp); - Cldfb_ImagBuffer_in[cha][slot][ind] = fix_to_float(Cldfb_ImagBuffer_in_fx[cha][slot][ind], q_inp); - } -#else - adaptTransportSignalsHeadtracked(hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat); + adaptTransportSignalsHeadtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); + } + } - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked(hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat); -#endif + Word16 shift = 31; + Word32 Cldfb_RealBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Cldfb_ImagBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + FOR( i = 0; i < 2; i++ ) + { + FOR( j = 0; j < 4; j++ ) + { + shift = s_min(shift, getScaleFactor32(Cldfb_RealBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); + shift = s_min(shift, getScaleFactor32(Cldfb_ImagBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); } } + Word16 q = q_inp + shift; - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL ); + FOR( i = 0; i < 2; i++ ) + { + FOR( j = 0; j < 4; j++ ) + { + FOR( Word16 k = 0; k < 60; k++ ) + { + Cldfb_RealBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_RealBuffer_in_fx[i][j][k], shift ); + Cldfb_ImagBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_ImagBuffer_in_fx[i][j][k], shift ); + } + } + } + + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_inTmp_fx, Cldfb_ImagBuffer_inTmp_fx, Rmat_fx, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL, q ); /* Always using CLDFB decorrelation in MASA EXT renderer */ max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; +#if 1 + FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + { + hDiracDecBin->ChEnePrev[i][j] = me2f( hDiracDecBin->ChEnePrev_fx[i][j], hDiracDecBin->ChEnePrev_e[i][j] ); + hDiracDecBin->ChEne[i][j] = me2f( hDiracDecBin->ChEne_fx[i][j], hDiracDecBin->ChEne_e[i][j] ); + hDiracDecBin->ChEneOut[i][j] = me2f( hDiracDecBin->ChEneOut_fx[i][j], hDiracDecBin->ChEneOut_e[i][j] ); + hDiracDecBin->ChEneOutPrev[i][j] = me2f( hDiracDecBin->ChEneOutPrev_fx[i][j], hDiracDecBin->ChEneOutPrev_e[i][j] ); + } + } + FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + { + hDiracDecBin->ChCrossRePrev[j] = me2f( hDiracDecBin->ChCrossRePrev_fx[j], hDiracDecBin->ChCrossRePrev_e[j] ); + hDiracDecBin->ChCrossImPrev[j] = me2f( hDiracDecBin->ChCrossImPrev_fx[j], hDiracDecBin->ChCrossImPrev_e[j] ); + hDiracDecBin->ChCrossRe[j] = me2f( hDiracDecBin->ChCrossRe_fx[j], hDiracDecBin->ChCrossRe_e[j] ); + hDiracDecBin->ChCrossIm[j] = me2f( hDiracDecBin->ChCrossIm_fx[j], hDiracDecBin->ChCrossIm_e[j] ); + hDiracDecBin->ChCrossReOut[j] = me2f( hDiracDecBin->ChCrossReOut_fx[j], hDiracDecBin->ChCrossReOut_e[j] ); + hDiracDecBin->ChCrossImOut[j] = me2f( hDiracDecBin->ChCrossImOut_fx[j], hDiracDecBin->ChCrossImOut_e[j] ); + hDiracDecBin->ChCrossReOutPrev[j] = me2f( hDiracDecBin->ChCrossReOutPrev_fx[j], hDiracDecBin->ChCrossReOutPrev_e[j] ); + hDiracDecBin->ChCrossImOutPrev[j] = me2f( hDiracDecBin->ChCrossImOutPrev_fx[j], hDiracDecBin->ChCrossImOutPrev_e[j] ); + } + fixedToFloat_arrL( hDiracDecBin->frameMeanDiffuseness_fx, hDiracDecBin->frameMeanDiffuseness, 29, CLDFB_NO_CHANNELS_MAX ); - - ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, - 0, NULL ); + FOR( ch = 0; ch < 2; ch++) + { + fixedToFloat_arrL32(hMasaExtRend->cldfbAnaRend[ch]->cldfb_state_fx, hMasaExtRend->cldfbAnaRend[ch]->cldfb_state, Q11, hMasaExtRend->cldfbAnaRend[ch]->p_filter_length - hMasaExtRend->cldfbAnaRend[ch]->no_channels); + } +#endif - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + float Rmat[3][3]; + for ( i = 0; i < 3; i++) // TODO: To be removed + { + fixedToFloat_arrL32(Rmat_fx[i], Rmat[i], Q30, 3); + } + ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, + 0, NULL ); -#ifdef IVAS_FLOAT_FIXED +#if 1 Word16 q_out; Word16 q_mat = 15; - Word16 q_inp = Q6; + q_inp = Q6; FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { output_fx[ch] = output_fx_buff[ch]; @@ -4964,10 +6209,6 @@ static void ivas_masa_ext_rend_parambin_internal( } } FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - output_fx[ch] = output_fx_buff[ch]; - } - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { FOR( slot = 0; slot < BINAURAL_CHANNELS; slot++ ) { @@ -4989,40 +6230,34 @@ static void ivas_masa_ext_rend_parambin_internal( floatToFixed_arrL( hMasaExtRend->cldfbSynRend[ch]->cldfb_state, hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx, Q11, hMasaExtRend->cldfbSynRend[ch]->p_filter_length ); hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state = Q11; } - FOR( Word16 cha = 0; cha < 6; cha++ ) - FOR( slot = 0; slot < 4; slot++ ) - FOR( Word16 ind = 0; ind < 60; ind++ ) - { - Cldfb_RealBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_RealBuffer_in[cha][slot][ind], Q6 ); - Cldfb_ImagBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_ImagBuffer_in[cha][slot][ind], Q6 ); - } - ivas_dirac_dec_binaural_process_output_fx(hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat); +#endif //Float to fix ends + + ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); + + + hDiracDecBin->hDiffuseDist = NULL; + + hSpatParamRendCom->slots_rendered = add(hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe]); + hSpatParamRendCom->subframes_rendered = add(hSpatParamRendCom->subframes_rendered, 1); +#if 1// Fix to float FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { fixedToFloat_arrL32( output_fx[ch], output_f[ch], q_out, nBins * hSpatParamRendCom->subframe_nbslots[subframe] ); fixedToFloat_arrL32( hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx, hMasaExtRend->cldfbSynRend[ch]->cldfb_state, hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state, hMasaExtRend->cldfbSynRend[ch]->p_filter_length ); } -#else - ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); #endif - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - hDiracDecBin->hDiffuseDist = NULL; - - hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe]; - hSpatParamRendCom->subframes_rendered++; return; } +#endif void ivas_masa_ext_rend_parambin_render( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA ext rend structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t num_subframes ) /* i : number of subframes to render */ + const int16_t num_subframes ) /* i : number of subframes to render */ { int16_t subframe; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index f5107381b..468a7ce8f 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -42,13 +42,20 @@ #include "ivas_rom_com.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" +#ifdef IVAS_FLOAT_FIXED +#include "prot_fx1.h" +#include "prot_fx2.h" +#include "ivas_rom_com_fx.h" +#endif // IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * Local constants *------------------------------------------------------------------------*/ #define NEAR_HORIZONTAL_PLANE_ELEVATION 17.5f +#define NEAR_HORIZONTAL_PLANE_ELEVATION_FX 73400320/*Q22*/ #define VERTICAL_ENERGY_RATIO_OFFSET 0.15f +#define VERTICAL_ENERGY_RATIO_OFFSET_FX 4915/*Q15*/ /*------------------------------------------------------------------------- @@ -60,7 +67,27 @@ typedef struct { float xr[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; float xi[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; +#ifdef IVAS_FLOAT_FIXED + Word32 xr_fx[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; + Word32 xi_fx[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; + Word16 xr_e[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS];/*Stores exponent for xr_fx*/ + Word16 xi_e[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS];/*Stores exponent for xi_fx*/ +#endif // IVAS_FLOAT_FIXED } CovarianceMatrix; +#ifdef IVAS_FLOAT_FIXED +void ivas_mcmasa_param_est_ana_fx( + MCMASA_ANA_HANDLE hMcMasa, /* i : McMASA analyzer structure */ + Word32 data_fx[][L_FRAME48k], /* i : Audio frame in MC-format */ + Word32 elevation_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated elevation */ + Word32 azimuth_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated azimuth */ + Word32 energyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated direct-to-total ratio */ + Word32 spreadCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated spread coherence */ + Word32 surroundingCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated surround coherence */ + Word16 q_data, + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_inp /* i : Number of input channels */ +); +#endif // IVAS_FLOAT_FIXED void ivas_mcmasa_param_est_ana( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); @@ -69,6 +96,35 @@ static void ivas_mcmasa_dmx( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAME48 static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], const int16_t freq, const int16_t N, CovarianceMatrix *COVls ); static void computeVerticalDiffuseness( float **buffer_intensity, const float *buffer_energy, const int16_t num_freq_bands, float *diffuseness ); +#ifdef IVAS_FLOAT_FIXED +static void computeVerticalDiffuseness_fx( + Word32 **buffer_intensity, /* i : Intensity vectors */ + const Word32 *buffer_energy, /* i : Energy */ + const Word16 num_freq_bands, /* i : Number of frequency bands */ + Word32 *diffuseness, /* o : Estimated diffuseness */ + Word16 *buffer_intensity_e, + Word16 *buffer_energy_e ); +static void compute_cov_mtx_fx( + Word32 sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, real, s[ch][freq] */ + Word32 si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, imag, s[ch][freq] */ + const Word16 freq, /* i : Freq to process */ + const Word16 N, /* i : Number of channels */ + CovarianceMatrix *COVls, /* o : Output matrix, contains upper part of cov mtx */ + Word16 shift); +static void computeEvenLayout_fx( + const Word32 *ls_azimuth, + Word32 *ls_azimuth_even, + const Word16 numChannels ); + +static void ivas_mcmasa_dmx_fx( + MCMASA_ANA_HANDLE hMcMasa, + Word32 data_f_fx[][L_FRAME48k], + Word16 data_e, + const Word16 input_frame, + const Word16 nchan_transport, + const Word16 nchan_inp ); + +#endif // IVAS_FLOAT_FIXED static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, const int16_t numChannels ); @@ -79,6 +135,279 @@ static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, * *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_mcmasa_ana_open( + MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ + const AUDIO_CONFIG inConfig, /* i : Input config */ + Word32 input_Fs /* i : Sampling frequency */ +) +{ + Word32 ls_azimuth_fx[MCMASA_MAX_ANA_CHANS]; + Word32 ls_elevation_fx[MCMASA_MAX_ANA_CHANS]; + Word32 ls_azimuth_even_fx[MCMASA_MAX_ANA_CHANS]; + Word32 left_min_fx, right_min_fx, azi_diff_fx; + Word16 i, j; + MCMASA_ANA_HANDLE hMcMasa; + Word16 nchan_inp; + Word16 numAnalysisChannels; + Word16 maxBin, input_frame; + ivas_error error; + + error = IVAS_ERR_OK; + + IF ( ( hMcMasa = (MCMASA_ANA_HANDLE) malloc( sizeof( MCMASA_ANA_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + + IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_5_1) ) + { + nchan_inp = 6; + Copy32( ls_azimuth_CICP6_fx, ls_azimuth_fx, nchan_inp - 1 ); + Copy32( ls_elevation_CICP6_fx, ls_elevation_fx, nchan_inp - 1 ); + hMcMasa->numHorizontalChannels = 5; + hMcMasa->isHorizontalSetup = 1; + } + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_7_1) ) + { + nchan_inp = 8; + Copy32( ls_azimuth_CICP12_fx, ls_azimuth_fx, nchan_inp - 1 ); + Copy32( ls_elevation_CICP12_fx, ls_elevation_fx, nchan_inp - 1 ); + hMcMasa->numHorizontalChannels = 7; + hMcMasa->isHorizontalSetup = 1; + } + ELSE IF( EQ_16(inConfig , IVAS_AUDIO_CONFIG_5_1_2) ) + { + nchan_inp = 8; + Copy32( ls_azimuth_CICP14_fx, ls_azimuth_fx, nchan_inp - 1 ); + Copy32( ls_elevation_CICP14_fx, ls_elevation_fx, nchan_inp - 1 ); + hMcMasa->numHorizontalChannels = 5; + hMcMasa->isHorizontalSetup = 0; + } + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_5_1_4) ) + { + nchan_inp = 10; + Copy32( ls_azimuth_CICP16_fx, ls_azimuth_fx, nchan_inp - 1 ); + Copy32( ls_elevation_CICP16_fx, ls_elevation_fx, nchan_inp - 1 ); + hMcMasa->numHorizontalChannels = 5; + hMcMasa->isHorizontalSetup = 0; + } + ELSE + { + nchan_inp = 12; + Copy32( ls_azimuth_CICP19_fx, ls_azimuth_fx, nchan_inp - 1 ); + Copy32( ls_elevation_CICP19_fx, ls_elevation_fx, nchan_inp - 1 ); + hMcMasa->numHorizontalChannels = 7; + hMcMasa->isHorizontalSetup = 0; + } + + numAnalysisChannels = sub(nchan_inp , 1); + + /* Determine the number of bands */ + hMcMasa->nbands = MASA_FREQUENCY_BANDS; + + /* Determine band grouping */ + Copy( MASA_band_grouping_24, hMcMasa->band_grouping, 24 + 1 ); + + maxBin = extract_l(W_extract_h(W_add(W_mult_32_32(input_Fs , INV_CLDFB_BANDWIDTH_Q31) , ONE_IN_Q31/*0.5f in Q31*/) )); + FOR ( i = 1; i < hMcMasa->nbands + 1; i++ ) + { + IF ( GE_16(hMcMasa->band_grouping[i] , maxBin) ) + { + hMcMasa->band_grouping[i] = maxBin; + hMcMasa->nbands = i; + break; + } + } + + /* Determine block grouping */ + Copy( DirAC_block_grouping, hMcMasa->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); + + /* open/initialize CLDFB */ + hMcMasa->num_Cldfb_instances = numAnalysisChannels; + FOR ( i = 0; i < hMcMasa->num_Cldfb_instances; i++ ) + { + IF ( ( error = openCldfb_ivas( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* intensity 3-dim */ + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { +#if 1/*TODO: To be removed later*/ + if ( ( hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + if ( ( hMcMasa->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + set_zero( hMcMasa->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); + } +#endif + IF( ( hMcMasa->direction_vector_m_fx[i] = (Word32 **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + IF ( ( hMcMasa->direction_vector_m_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + set_zero_fx( hMcMasa->direction_vector_m_fx[i][j], MASA_FREQUENCY_BANDS ); + } + IF( ( hMcMasa->direction_vector_e[i] = (Word16 **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word16 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + + FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + IF( ( hMcMasa->direction_vector_e[i][j] = (Word16 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word16 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + set16_fx( hMcMasa->direction_vector_e[i][j],0, MASA_FREQUENCY_BANDS ); + } + } + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { +#if 1/*TODO: To be removed later*/ + if ( ( hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + set_zero( hMcMasa->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); +#endif + IF ( ( hMcMasa->buffer_intensity_real_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof(Word32) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + set_zero_fx( hMcMasa->buffer_intensity_real_fx[i][j], MASA_FREQUENCY_BANDS ); + } + } + set16_fx( hMcMasa->buffer_intensity_real_q, 31, DIRAC_NO_COL_AVG_DIFF); + + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { +#if 1/*TODO: To be removed later*/ + if ( ( hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + set_zero( hMcMasa->buffer_intensity_real_vert[j], MASA_FREQUENCY_BANDS ); +#endif + IF ( ( hMcMasa->buffer_intensity_real_vert_fx[j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof(Word32) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + set_zero_fx( hMcMasa->buffer_intensity_real_vert_fx[j], MASA_FREQUENCY_BANDS ); + } + + set16_fx(hMcMasa->buffer_intensity_real_vert_q, 31, DIRAC_NO_COL_AVG_DIFF ); +#if 1/*TODO: To be removed later*/ + set_zero( hMcMasa->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); +#endif + set_zero_fx( hMcMasa->buffer_energy_fx, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); + set16_fx(hMcMasa->buffer_energy_q, 31, DIRAC_NO_COL_AVG_DIFF ); + + computeEvenLayout_fx( ls_azimuth_fx, ls_azimuth_even_fx, hMcMasa->numHorizontalChannels ); + + IF ( !hMcMasa->isHorizontalSetup ) + { + computeEvenLayout_fx( &ls_azimuth_fx[hMcMasa->numHorizontalChannels], &ls_azimuth_even_fx[hMcMasa->numHorizontalChannels], sub(numAnalysisChannels , hMcMasa->numHorizontalChannels) ); + } + + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + hMcMasa->chnlToFoaMtx_fx[0][i] = ONE_IN_Q31; + hMcMasa->chnlToFoaMtx_fx[1][i] = L_mult( getSineWord16R2( extract_l( L_shr( Mult_32_16( ls_azimuth_fx[i], 91 /*32767/360*/ ), 7 ) ) ), getCosWord16R2( extract_l( L_shr( Mult_32_16( ls_elevation_fx[i], 91 ), 7 ) ) ) ); + hMcMasa->chnlToFoaMtx_fx[2][i] = L_shl( getSineWord16R2( extract_l( L_shr( Mult_32_16( ls_elevation_fx[i], 91 ), 7 ) ) ), 16 ); + hMcMasa->chnlToFoaMtx_fx[3][i] = L_mult( getCosWord16R2( extract_l( L_shr( Mult_32_16( ls_azimuth_fx[i], 91 ), 7 ) ) ), getCosWord16R2( extract_l( L_shr( Mult_32_16( ls_elevation_fx[i], 91 ), 7 ) ) ) ); + + hMcMasa->chnlToFoaEvenMtx_fx[0][i] = ONE_IN_Q31; + hMcMasa->chnlToFoaEvenMtx_fx[1][i] = L_shl( getSineWord16R2( extract_l( L_shr( Mult_32_16( ls_azimuth_even_fx[i], 91 ), 7 ) ) ), 16 ); + hMcMasa->chnlToFoaEvenMtx_fx[2][i] = 0; + hMcMasa->chnlToFoaEvenMtx_fx[3][i] = L_shl( getCosWord16R2( extract_l( L_shr( Mult_32_16( ls_azimuth_even_fx[i], 91 ), 7 ) ) ), 16 ); + } + + Copy32( ls_azimuth_fx, hMcMasa->ls_azimuth_fx, numAnalysisChannels ); + + FOR ( i = 0; i < hMcMasa->numHorizontalChannels; i++ ) + { + left_min_fx = L_shl(360,22); + right_min_fx = L_shl(-360,22); + + FOR ( j = 0; j < hMcMasa->numHorizontalChannels; j++ ) + { + azi_diff_fx = L_sub(ls_azimuth_fx[j] , ls_azimuth_fx[i]); + + IF ( GT_32(azi_diff_fx , (180<<22)) ) + { + azi_diff_fx = L_sub(azi_diff_fx,360<<22); + } + ELSE IF ( LT_32(azi_diff_fx , -(180<<22)) ) + { + azi_diff_fx = L_add(azi_diff_fx,360<<22); + } + + IF( LT_32( azi_diff_fx, left_min_fx ) && GT_32( azi_diff_fx, 0 ) ) + { + hMcMasa->leftNearest[i] = j; + left_min_fx = azi_diff_fx; + } + + IF( GT_32( azi_diff_fx, right_min_fx ) && LT_32( azi_diff_fx , 0 ) ) + { + hMcMasa->rightNearest[i] = j; + right_min_fx = azi_diff_fx; + } + } + } + +#if 1/*TODO: To be removed later(floating point initialization)*/ + hMcMasa->prevMultiChEne = 0.0f; + hMcMasa->prevDownmixEne = 0.0f; + hMcMasa->prevEQ = 1.0f; +#endif + hMcMasa->prevMultiChEne_fx = 0; + hMcMasa->prevDownmixEne_fx = 0; + hMcMasa->prevEQ_fx = 32767; + input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); + FOR ( i = 0; i < input_frame; i++ ) + { + hMcMasa->interpolator_fx[i] = div_s( i, input_frame ); + } + + hMcMasa->index_buffer_intensity = 0; + + IF ( ( hMcMasa->hMasaOut = (MASA_DECODER_EXT_OUT_META_HANDLE) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + + IF ( ( hMcMasa->sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + generate_gridEq_fx( hMcMasa->sph_grid16 ); + + ( *hMcMasaPtr ) = hMcMasa; + + return error; +} + +#else ivas_error ivas_mcmasa_ana_open( MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ const AUDIO_CONFIG inConfig, /* i : Input config */ @@ -297,7 +626,7 @@ ivas_error ivas_mcmasa_ana_open( return error; } - +#endif // IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * ivas_mcmasa_ana_close() @@ -305,106 +634,777 @@ ivas_error ivas_mcmasa_ana_open( * *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_mcmasa_ana_close( + MCMASA_ANA_HANDLE *hMcMasa /* i/o: analysis McMASA handle */ +) +{ + Word16 i, j; + + IF ( hMcMasa == NULL || *hMcMasa == NULL ) + { + return; + } + + FOR ( i = 0; i < ( *hMcMasa )->num_Cldfb_instances; i++ ) + { + deleteCldfb_ivas( &( ( *hMcMasa )->cldfbAnaEnc[i] ) ); + } + + /* intensity 3-dim */ + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + free( ( *hMcMasa )->direction_vector_m_fx[i][j] ); + ( *hMcMasa )->direction_vector_m_fx[i][j] = NULL; + } + + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hMcMasa )->buffer_intensity_real_fx[i][j] ); + ( *hMcMasa )->buffer_intensity_real_fx[i][j] = NULL; + } + + free( ( *hMcMasa )->direction_vector_m_fx[i] ); + ( *hMcMasa )->direction_vector_m_fx[i] = NULL; + } + + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hMcMasa )->buffer_intensity_real_vert_fx[j] ); + ( *hMcMasa )->buffer_intensity_real_vert_fx[j] = NULL; + } +#if 1/*TODO: To be removed later( freeing float buffer)*/ + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + free( ( *hMcMasa )->direction_vector_m[i][j] ); + ( *hMcMasa )->direction_vector_m[i][j] = NULL; + } + + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hMcMasa )->buffer_intensity_real[i][j] ); + ( *hMcMasa )->buffer_intensity_real[i][j] = NULL; + } + + free( ( *hMcMasa )->direction_vector_m[i] ); + ( *hMcMasa )->direction_vector_m[i] = NULL; + } + + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hMcMasa )->buffer_intensity_real_vert[j] ); + ( *hMcMasa )->buffer_intensity_real_vert[j] = NULL; + } +#endif + + free( ( *hMcMasa )->hMasaOut ); + ( *hMcMasa )->hMasaOut = NULL; + free( ( *hMcMasa )->sph_grid16 ); + ( *hMcMasa )->sph_grid16 = NULL; + + free( ( *hMcMasa ) ); + ( *hMcMasa ) = NULL; + + return; +} +#else void ivas_mcmasa_ana_close( MCMASA_ANA_HANDLE *hMcMasa /* i/o: analysis McMASA handle */ ) { int16_t i, j; - if ( hMcMasa == NULL || *hMcMasa == NULL ) - { - return; - } + if ( hMcMasa == NULL || *hMcMasa == NULL ) + { + return; + } + + for ( i = 0; i < ( *hMcMasa )->num_Cldfb_instances; i++ ) + { + deleteCldfb_ivas( &( ( *hMcMasa )->cldfbAnaEnc[i] ) ); + } + + /* intensity 3-dim */ + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + free( ( *hMcMasa )->direction_vector_m[i][j] ); + ( *hMcMasa )->direction_vector_m[i][j] = NULL; + } + + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hMcMasa )->buffer_intensity_real[i][j] ); + ( *hMcMasa )->buffer_intensity_real[i][j] = NULL; + } + + free( ( *hMcMasa )->direction_vector_m[i] ); + ( *hMcMasa )->direction_vector_m[i] = NULL; + } + + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hMcMasa )->buffer_intensity_real_vert[j] ); + ( *hMcMasa )->buffer_intensity_real_vert[j] = NULL; + } + + free( ( *hMcMasa )->hMasaOut ); + ( *hMcMasa )->hMasaOut = NULL; + free( ( *hMcMasa )->sph_grid16 ); + ( *hMcMasa )->sph_grid16 = NULL; + + free( ( *hMcMasa ) ); + ( *hMcMasa ) = NULL; + + return; +} +#endif // IVAS_FLOAT_FIXED + + +/*--------------------------------------------------------------------------* + * ivas_mcmasa_ana() + * + * Multichannel MASA analysis + *--------------------------------------------------------------------------*/ + +#ifdef IVAS_FLOAT_FIXED +void ivas_mcmasa_ana_fx( + MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ + Word32 data[][L_FRAME48k], /* i/o: Input / transport audio signals */ + Word16 q_data, + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_inp /* i : Number of input channels */ +) +{ + Word16 i; + + Word32 elevation_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 azimuth_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 energyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 spreadCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 surroundingCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + /* Sum center and LFE, move surround channels */ + v_add_32( data[2], data[3], data[2], input_frame ); + FOR ( i = 4; i < nchan_inp; i++ ) + { + Copy32( data[i], data[i - 1], input_frame ); + } + + /* Analysis */ + ivas_mcmasa_param_est_ana_fx( hMcMasa, data, elevation_m_values_fx, azimuth_m_values_fx, energyRatio_fx, spreadCoherence_fx, surroundingCoherence_fx, q_data, input_frame, nchan_inp ); + + /* Create MASA metadata buffer from the estimated values */ + ivas_create_masa_out_meta_fx( hMcMasa->hMasaOut, hMcMasa->sph_grid16, nchan_transport, elevation_m_values_fx, azimuth_m_values_fx, energyRatio_fx, spreadCoherence_fx, surroundingCoherence_fx, Q31, Q31, Q31 ); + + /* Downmix */ + + ivas_mcmasa_dmx_fx( hMcMasa, data, 31 - q_data, input_frame, nchan_transport, nchan_inp ); + + + return; +} +#endif +void ivas_mcmasa_ana( + MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ + float data_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_inp /* i : Number of input channels */ +) +{ + int16_t i; + float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + + + /* Sum center and LFE, move surround channels */ + v_add( data_f[2], data_f[3], data_f[2], input_frame ); + for ( i = 4; i < nchan_inp; i++ ) + { + mvr2r( data_f[i], data_f[i - 1], input_frame ); + } + + /* Analysis */ + ivas_mcmasa_param_est_ana( hMcMasa, data_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, nchan_inp ); + + /* Create MASA metadata buffer from the estimated values */ + ivas_create_masa_out_meta( hMcMasa->hMasaOut, hMcMasa->sph_grid16, nchan_transport, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence ); + + /* Downmix */ + ivas_mcmasa_dmx( hMcMasa, data_f, input_frame, nchan_transport, nchan_inp ); + + return; +} + + +/*--------------------------------------------------------------------------* + * Local functions + *--------------------------------------------------------------------------*/ + +/* Estimate metadata parameters for McMASA */ +#ifdef IVAS_FLOAT_FIXED +void ivas_mcmasa_param_est_ana_fx( + MCMASA_ANA_HANDLE hMcMasa, /* i : McMASA analyzer structure */ + Word32 data_fx[][L_FRAME48k], /* i : Audio frame in MC-format */ + Word32 elevation_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated elevation */ + Word32 azimuth_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated azimuth */ + Word32 energyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated direct-to-total ratio */ + Word32 spreadCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated spread coherence */ + Word32 surroundingCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated surround coherence */ + Word16 q_data, + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_inp /* i : Number of input channels */ +) +{ + Word16 cohPanCoh_e; + Word16 tempLsEnergyRelation_e; + Word16 q_vdv[MASA_FREQUENCY_BANDS]; + Word16 out_exp[MASA_FREQUENCY_BANDS]; + Word32 reference_power_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + Word32 dir_v_fx[DIRAC_NUM_DIMS]; + Word32 Chnl_RealBuffer_fx[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; + Word32 Chnl_ImagBuffer_fx[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX]; + Word32 Foa_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 Foa_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 FoaEven_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 FoaEven_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 intensity_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; + Word32 intensity_even_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; + Word32 direction_vector_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; + Word32 diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; + Word32 vertical_diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; + Word32 diffuseness_m_fx[MASA_FREQUENCY_BANDS]; + Word16 diffuseness_e[MASA_FREQUENCY_BANDS]; + Word32 coherentEnergyRatio_fx[MASA_FREQUENCY_BANDS]; + Word32 renormalization_factor_diff_fx[MASA_FREQUENCY_BANDS]; + Word16 renormalization_factor_diff_e[MASA_FREQUENCY_BANDS]; + Word32 norm_tmp_fx; + Word32 absCOVls_fx[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; + Word16 absCOVls_e[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; + Word32 lsEnergy_fx[MCMASA_MAX_ANA_CHANS]; + Word16 lsEnergy_e[MCMASA_MAX_ANA_CHANS]; + Word32 lsEnergySum_fx, maxEne_fx; + Word16 lsEnergySum_e = 0; + Word16 maxEne_e; + Word32 angleDist_fx, minAngleDist_fx; + Word32 currentAzi_fx; + Word32 lsEnergyRelation_fx; + Word16 lsEnergyRelation_e; + Word32 tempLsEnergyRelation_fx; + Word32 stereoness_fx, cohwideness_fx, spreadCoh_fx; + Word32 stereoRatio_fx, cohPanRatio_fx; + Word16 stereoness_e; + Word32 stereoCoh_fx, cohPanCoh_fx, cohRatio_fx; + Word32 surrCoh_fx, tempCoh_fx, tempCoh2_fx; + Word16 surrCoh_e; + Word16 stereoCoh_e; + Word16 tempCoh_e; + Word16 tempCoh2_e; + Word16 ts, i, j, d; + Word16 num_freq_bins, num_freq_bands, index; + Word16 l_ts; + Word16 band_m_idx, block_m_idx; + Word16 mrange[2], brange[2]; + CovarianceMatrix COVls[MASA_FREQUENCY_BANDS]; + Word16 loudestCh; + Word16 i1, i2, i3; + Word16 numAnalysisChannels; + Word16 spreadCoh_e; + num_freq_bins = hMcMasa->cldfbAnaEnc[0]->no_channels; + num_freq_bands = hMcMasa->nbands; + l_ts = input_frame / CLDFB_NO_COL_MAX; + numAnalysisChannels = sub(nchan_inp , 1); + + set16_fx( q_vdv, 31, MASA_FREQUENCY_BANDS ); + set16_fx( out_exp, 30, MASA_FREQUENCY_BANDS ); + /* do processing over all CLDFB time slots */ + FOR ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + mrange[0] = hMcMasa->block_grouping[block_m_idx]; + mrange[1] = hMcMasa->block_grouping[block_m_idx + 1]; + + FOR ( band_m_idx = 0; band_m_idx < hMcMasa->nbands; band_m_idx++ ) + { + hMcMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx] = 0; + hMcMasa->direction_vector_m_fx[1][block_m_idx][band_m_idx] = 0; + hMcMasa->direction_vector_m_fx[2][block_m_idx][band_m_idx] = 0; + hMcMasa->direction_vector_e[0][block_m_idx][band_m_idx] = 0; + hMcMasa->direction_vector_e[1][block_m_idx][band_m_idx] = 0; + hMcMasa->direction_vector_e[2][block_m_idx][band_m_idx] = 0; + } + + /* Need to initialize renormalization_factors, and variables to be normalized */ + set_zero_fx( renormalization_factor_diff_fx, hMcMasa->nbands ); + set16_fx( renormalization_factor_diff_e,0, hMcMasa->nbands ); + set_zero_fx( diffuseness_m_fx, hMcMasa->nbands ); + set16_fx( diffuseness_e, 0,hMcMasa->nbands ); + set_zero_fx( hMcMasa->energy_fx[block_m_idx], MASA_FREQUENCY_BANDS ); + set16_fx( hMcMasa->energy_e[block_m_idx], 0,MASA_FREQUENCY_BANDS ); + /* Reset variable */ + FOR ( i = 0; i < hMcMasa->nbands; i++ ) + { + FOR ( j = 0; j < numAnalysisChannels; j++ ) + { + set_zero_fx( COVls[i].xr_fx[j], numAnalysisChannels ); + set_zero_fx( COVls[i].xi_fx[j], numAnalysisChannels ); + set16_fx( COVls[i].xr_e[j],0, numAnalysisChannels ); + set16_fx( COVls[i].xi_e[j],0, numAnalysisChannels ); + } + } + + FOR ( ts = mrange[0]; ts < mrange[1]; ts++ ) + { + Word16 cr_q=MAX_16, ci_q= MAX_16,sf,c_e; + Word16 inp_q= q_data; + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + inp_q = q_data; + cldfbAnalysis_ts_fx_fixed_q( &( data_fx[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hMcMasa->cldfbAnaEnc[i], &inp_q); + cr_q = s_min(cr_q,getScaleFactor32( Chnl_ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX )); + ci_q = s_min( ci_q, getScaleFactor32(Chnl_RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX ) ); + } + sf = sub(s_min( cr_q, ci_q ) , 4); + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + scale_sig32( Chnl_RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sf); + scale_sig32( Chnl_ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sf); + } + inp_q = add(inp_q, sf ); + c_e = sub(31 , inp_q); + hMcMasa->chnlToFoaMtx_e = c_e; + /* Compute channel-based energy for metadata processing */ + FOR ( band_m_idx = 0; band_m_idx < num_freq_bands; band_m_idx++ ) + { + brange[0] = hMcMasa->band_grouping[band_m_idx]; + brange[1] = hMcMasa->band_grouping[band_m_idx + 1]; + FOR ( j = brange[0]; j < brange[1]; j++ ) + { + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + Word32 temp = L_add( Mult_32_32( Chnl_RealBuffer_fx[i][j], Chnl_RealBuffer_fx[i][j] ), Mult_32_32( Chnl_ImagBuffer_fx[i][j], Chnl_ImagBuffer_fx[i][j] ) ); + hMcMasa->energy_fx[block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp(hMcMasa->energy_fx[block_m_idx][band_m_idx], hMcMasa->energy_e[block_m_idx][band_m_idx], temp, (c_e) * 2, &hMcMasa->energy_e[block_m_idx][band_m_idx]); + } + } + } + + /* Compute covariance matrix */ + FOR ( i = 0; i < num_freq_bands; i++ ) + { + brange[0] = hMcMasa->band_grouping[i]; + brange[1] = hMcMasa->band_grouping[i + 1]; + FOR ( j = brange[0]; j < brange[1]; j++ ) + { + compute_cov_mtx_fx( Chnl_RealBuffer_fx, Chnl_ImagBuffer_fx, j, numAnalysisChannels, &( COVls[i] ), c_e); + } + } + + /* Compute standard FOA */ + /* W */ + v_add_32( Chnl_RealBuffer_fx[0], Chnl_RealBuffer_fx[1], Foa_RealBuffer_fx[0], num_freq_bins );/*q*/ + v_add_32( Chnl_ImagBuffer_fx[0], Chnl_ImagBuffer_fx[1], Foa_ImagBuffer_fx[0], num_freq_bins );/*q*/ + FOR ( i = 2; i < numAnalysisChannels; i++ ) + { + v_add_32( Chnl_RealBuffer_fx[i], Foa_RealBuffer_fx[0], Foa_RealBuffer_fx[0], num_freq_bins );/*q*/ + v_add_32( Chnl_ImagBuffer_fx[i], Foa_ImagBuffer_fx[0], Foa_ImagBuffer_fx[0], num_freq_bins );/*q*/ + } + + /* Y */ + v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_RealBuffer_fx[1], num_freq_bins );/*q*/ + v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[1][0], Foa_ImagBuffer_fx[1], num_freq_bins );/*q*/ + FOR ( i = 1; i < numAnalysisChannels; i++ ) + { + v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[1][i], Foa_RealBuffer_fx[1], num_freq_bins );/*q*/ + v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[1][i], Foa_ImagBuffer_fx[1], num_freq_bins );/*q*/ + } + /* Z */ + IF ( hMcMasa->isHorizontalSetup ) + { + /* Set zero for horizontal setups */ + set_zero_fx( Foa_RealBuffer_fx[2], num_freq_bins ); + set_zero_fx( Foa_ImagBuffer_fx[2], num_freq_bins ); + } + ELSE + { + v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_RealBuffer_fx[2], num_freq_bins );/*q*/ + v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[2][0], Foa_ImagBuffer_fx[2], num_freq_bins );/*q*/ + FOR ( i = 1; i < numAnalysisChannels; i++ ) + { + v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[2][i], Foa_RealBuffer_fx[2], num_freq_bins );/*q*/ + v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[2][i], Foa_ImagBuffer_fx[2], num_freq_bins );/*q*/ + } + } + /* X */ + v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_RealBuffer_fx[3], num_freq_bins );/*q*/ + v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaMtx_fx[3][0], Foa_ImagBuffer_fx[3], num_freq_bins );/*q*/ + FOR ( i = 1; i < numAnalysisChannels; i++ ) + { + v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[3][i], Foa_RealBuffer_fx[3], num_freq_bins );/*q*/ + v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hMcMasa->chnlToFoaMtx_fx[3][i], Foa_ImagBuffer_fx[3], num_freq_bins );/*q*/ + } + + /* Compute even FOA */ + /* W */ + Copy32( Foa_RealBuffer_fx[0], FoaEven_RealBuffer_fx[0], num_freq_bins ); + Copy32( Foa_ImagBuffer_fx[0], FoaEven_ImagBuffer_fx[0], num_freq_bins ); + + /* Y */ + v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_RealBuffer_fx[1], num_freq_bins );/*q*/ + v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[1][0], FoaEven_ImagBuffer_fx[1], num_freq_bins );/*q*/ + FOR ( i = 1; i < numAnalysisChannels; i++ ) + { + v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[1][i], FoaEven_RealBuffer_fx[1], num_freq_bins );/*q*/ + v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[1][i], FoaEven_ImagBuffer_fx[1], num_freq_bins );/*q*/ + } + + /* Z (even setups are handled as horizontal) */ + set_zero_fx( FoaEven_RealBuffer_fx[2], num_freq_bins ); + set_zero_fx( FoaEven_ImagBuffer_fx[2], num_freq_bins ); + + /* X */ + v_multc_fixed( Chnl_RealBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_RealBuffer_fx[3], num_freq_bins ); + v_multc_fixed( Chnl_ImagBuffer_fx[0], hMcMasa->chnlToFoaEvenMtx_fx[3][0], FoaEven_ImagBuffer_fx[3], num_freq_bins ); + FOR ( i = 1; i < numAnalysisChannels; i++ ) + { + v_multc_acc_32_32( Chnl_RealBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[3][i], FoaEven_RealBuffer_fx[3], num_freq_bins ); + v_multc_acc_32_32( Chnl_ImagBuffer_fx[i], hMcMasa->chnlToFoaEvenMtx_fx[3][i], FoaEven_ImagBuffer_fx[3], num_freq_bins ); + } + + /* Direction estimation */ + computeIntensityVector_ana_fx( hMcMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); /*2+q-31*/ + + computeDirectionVectors_fixed( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2],2*c_e );/*Q30*/ + + /* Power and intensity estimation for diffuseness */ + computeIntensityVector_ana_fx( hMcMasa->band_grouping, FoaEven_RealBuffer_fx, FoaEven_ImagBuffer_fx, num_freq_bands, intensity_even_real_fx );/*2*(q)-31*/ + computeReferencePower_ana_fx( hMcMasa->band_grouping, FoaEven_RealBuffer_fx, FoaEven_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands );/*2*q-30*/ + + /* Fill buffers of length "averaging_length" time slots for intensity and energy */ + hMcMasa->index_buffer_intensity = ( hMcMasa->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + index = hMcMasa->index_buffer_intensity; + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + /* only real part needed */ + Copy32( intensity_even_real_fx[i], &( hMcMasa->buffer_intensity_real_fx[i][index - 1][0] ), num_freq_bands ); + } + hMcMasa->buffer_intensity_real_q[index - 1] = 2 * inp_q - 31; + Copy32( reference_power_fx[ts], &( hMcMasa->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); + hMcMasa->buffer_energy_q[index - 1] = 2 * inp_q - 30; + computeDiffuseness_fixed( hMcMasa->buffer_intensity_real_fx, hMcMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx ,hMcMasa->buffer_intensity_real_q, hMcMasa->buffer_energy_q,out_exp); + /* Compute vertical diffuseness, and tune original diffuseness if needed */ + IF ( !hMcMasa->isHorizontalSetup ) + { + Copy32( intensity_real_fx[2], &( hMcMasa->buffer_intensity_real_vert_fx[index - 1][0] ), num_freq_bands ); + hMcMasa->buffer_intensity_real_vert_q[index - 1] = 2 * inp_q - 31; + computeVerticalDiffuseness_fx( hMcMasa->buffer_intensity_real_vert_fx, hMcMasa->buffer_energy_fx, num_freq_bands, vertical_diffuseness_vector_fx , hMcMasa->buffer_intensity_real_vert_q, hMcMasa->buffer_energy_q); + v_min_fx( diffuseness_vector_fx,out_exp, vertical_diffuseness_vector_fx,q_vdv, diffuseness_vector_fx,out_exp, num_freq_bands ); + } + FOR ( band_m_idx = 0; band_m_idx < hMcMasa->nbands; band_m_idx++ ) + { + norm_tmp_fx = L_shl( Mult_32_32( reference_power_fx[ts][band_m_idx], L_sub( ONE_IN_Q30, diffuseness_vector_fx[band_m_idx] ) ), 1 ); /*2q-30*/ + hMcMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hMcMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx], hMcMasa->direction_vector_e[0][block_m_idx][band_m_idx], Mult_32_32( norm_tmp_fx, direction_vector_fx[0][band_m_idx] ), 2 * c_e, &hMcMasa->direction_vector_e[0][block_m_idx][band_m_idx] ); + hMcMasa->direction_vector_m_fx[1][block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hMcMasa->direction_vector_m_fx[1][block_m_idx][band_m_idx], hMcMasa->direction_vector_e[1][block_m_idx][band_m_idx], Mult_32_32( norm_tmp_fx, direction_vector_fx[1][band_m_idx] ), 2 * c_e, &hMcMasa->direction_vector_e[1][block_m_idx][band_m_idx] ); + hMcMasa->direction_vector_m_fx[2][block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( hMcMasa->direction_vector_m_fx[2][block_m_idx][band_m_idx], hMcMasa->direction_vector_e[2][block_m_idx][band_m_idx], Mult_32_32( norm_tmp_fx, direction_vector_fx[2][band_m_idx] ), 2 * c_e, &hMcMasa->direction_vector_e[2][block_m_idx][band_m_idx] ); + diffuseness_m_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( diffuseness_m_fx[band_m_idx], diffuseness_e[band_m_idx], L_shl( Mult_32_32( reference_power_fx[ts][band_m_idx], diffuseness_vector_fx[band_m_idx] ), 1 ), 2 * c_e - 1, &diffuseness_e[band_m_idx]); + renormalization_factor_diff_fx[band_m_idx] = BASOP_Util_Add_Mant32Exp( renormalization_factor_diff_fx[band_m_idx], renormalization_factor_diff_e[band_m_idx], reference_power_fx[ts][band_m_idx], 2 * c_e - 1, &renormalization_factor_diff_e[band_m_idx]); + } + } + FOR ( band_m_idx = 0; band_m_idx < hMcMasa->nbands; band_m_idx++ ) + { + Word16 max_e=MIN_16; + FOR ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + { + max_e = s_max( max_e, hMcMasa->direction_vector_e[d][block_m_idx][band_m_idx]); + } + max_e =add(max_e,1);/*1 as guard bit to prevent overflow*/ + FOR ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + { + dir_v_fx[d] = L_shr(hMcMasa->direction_vector_m_fx[d][block_m_idx][band_m_idx], max_e-hMcMasa->direction_vector_e[d][block_m_idx][band_m_idx]); + } + Word16 div_q = sub(31, max_e); + ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( dir_v_fx,div_q, &azimuth_m_values_fx[block_m_idx][band_m_idx], &elevation_m_values_fx[block_m_idx][band_m_idx] ); + elevation_m_values_fx[block_m_idx][band_m_idx] = L_add( elevation_m_values_fx[block_m_idx][band_m_idx], L_shr( elevation_m_values_fx[block_m_idx][band_m_idx], 5 ) ); + } + + /* Coherence processing */ + FOR ( band_m_idx = 0; band_m_idx < hMcMasa->nbands; band_m_idx++ ) + { + /* Compute absolute values */ + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + FOR ( j = i; j < numAnalysisChannels; j++ ) + { + Word32 temp=BASOP_Util_Add_Mant32Exp(Mult_32_32(COVls[band_m_idx].xr_fx[i][j] , COVls[band_m_idx].xr_fx[i][j]), 2*COVls[band_m_idx].xr_e[i][j],Mult_32_32(COVls[band_m_idx].xi_fx[i][j] , COVls[band_m_idx].xi_fx[i][j]),2* COVls[band_m_idx].xi_e[i][j],&absCOVls_e[i][j]); + absCOVls_fx[i][j] = Sqrt32(temp, &absCOVls_e[i][j]); + } + lsEnergy_fx[i] = absCOVls_fx[i][i]; + lsEnergy_e[i] = absCOVls_e[i][i]; + } + + /* Find loudest channel */ + maxEne_fx = lsEnergy_fx[0]; + maxEne_e = lsEnergy_e[0]; + loudestCh = 0; + FOR ( i = 1; i < numAnalysisChannels; i++ ) + { + IF (EQ_16(BASOP_Util_Cmp_Mant32Exp( lsEnergy_fx[i] , lsEnergy_e[i] , maxEne_fx, maxEne_e),1) ) + { + maxEne_fx = lsEnergy_fx[i]; + maxEne_e = lsEnergy_e[i]; + loudestCh = i; + } + } + + /* Compute surrounding coherence */ + surrCoh_fx = ONE_IN_Q31; + surrCoh_e = 0; + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + IF ( NE_16(i , loudestCh) ) + { + IF ( LT_16(i , loudestCh) ) + { + i1 = i; + i2 = loudestCh; + } + ELSE + { + i1 = loudestCh; + i2 = i; + } + Word16 temp_exp= lsEnergy_e[i1]+ lsEnergy_e[i2]; + Word32 temp = Sqrt32(L_add(Mult_32_32(lsEnergy_fx[i1] , lsEnergy_fx[i2]), EPSILON_FX),&temp_exp); + tempCoh_e = 0; + tempCoh_fx = L_shl(BASOP_Util_Divide3232_Scale(absCOVls_fx[i1][i2] , temp,&tempCoh_e),16); + tempCoh_e = absCOVls_e[i1][i2] - temp_exp + tempCoh_e; + IF ( NE_16(BASOP_Util_Cmp_Mant32Exp( surrCoh_fx, surrCoh_e, tempCoh_fx, tempCoh_e ) , -1) ) + { + surrCoh_fx = tempCoh_fx; + surrCoh_e = tempCoh_e; + } + } + } + surrCoh_fx = L_shl( surrCoh_fx, surrCoh_e ); + surrCoh_e = 0; + surrCoh_fx = Mult_32_32(surrCoh_fx , surrCoh_fx); + surrCoh_fx = ( LT_32(surrCoh_fx , ONE_IN_Q31)) ? surrCoh_fx : ONE_IN_Q31; + surrCoh_fx = ( GT_32(surrCoh_fx , 0) ) ? surrCoh_fx : 0; + /* Compute spread coherence */ + IF ( LT_32(elevation_m_values_fx[block_m_idx][band_m_idx] , NEAR_HORIZONTAL_PLANE_ELEVATION_FX) ) /* Computed only near horizontal plane */ + { + minAngleDist_fx = 754974720;/*Q22*/ + i1 = 0; + currentAzi_fx = azimuth_m_values_fx[block_m_idx][band_m_idx]; + FOR ( i = 0; i < hMcMasa->numHorizontalChannels; i++ ) + { + angleDist_fx = L_abs( L_sub(currentAzi_fx , hMcMasa->ls_azimuth_fx[i]) ); + IF ( GT_32(angleDist_fx , 754974720/*180.0f Q.22*/)) + { + angleDist_fx = L_abs( L_sub(angleDist_fx , 1509949440) ); + } + IF ( LT_32(angleDist_fx , minAngleDist_fx) ) + { + minAngleDist_fx = angleDist_fx; + i1 = i; + } + } + i2 = hMcMasa->leftNearest[i1]; + i3 = hMcMasa->rightNearest[i1]; + Word16 temp_e= add(lsEnergy_e[i2], lsEnergy_e[i3]); + Word32 temp = Sqrt32( Mult_32_32(lsEnergy_fx[i2] , lsEnergy_fx[i3]) + EPSILON_FX ,&temp_e); + IF ( LT_16(i2 , i3 )) + { + stereoCoh_fx = BASOP_Util_Divide3232_Scale(absCOVls_fx[i2][i3] , temp,&stereoCoh_e); + stereoCoh_e = add(sub(absCOVls_e[i2][i3] , temp_e) , stereoCoh_e); + } + ELSE + { + stereoCoh_fx = BASOP_Util_Divide3232_Scale(absCOVls_fx[i3][i2], temp, &stereoCoh_e ); + stereoCoh_e = add(sub(absCOVls_e[i3][i2] , temp_e) , stereoCoh_e); + } + stereoCoh_fx = L_shl( stereoCoh_fx, 16 ); + Word32 temp1, temp2; + Word16 temp1_e, temp2_e; + temp1 = BASOP_Util_Add_Mant32Exp( lsEnergy_fx[i2], lsEnergy_e[i2], lsEnergy_fx[i3], lsEnergy_e[i3], &temp1_e ); + temp2 = BASOP_Util_Add_Mant32Exp( temp1, temp1_e, lsEnergy_fx[i1], lsEnergy_e[i1], &temp2_e ); + temp2 = L_add( temp2, EPSILON_FX ); + lsEnergyRelation_fx = BASOP_Util_Divide3232_Scale( temp1, temp2, &lsEnergyRelation_e ); + lsEnergyRelation_e = add(lsEnergyRelation_e,sub(temp1_e , temp2_e)); + lsEnergyRelation_fx = L_shl(lsEnergyRelation_fx, 16+lsEnergyRelation_e ); + stereoness_fx = Mult_32_32(stereoCoh_fx , lsEnergyRelation_fx); + stereoness_e = stereoCoh_e; + IF ( LT_16(i1 , i2) ) + { + temp_e = add(lsEnergy_e[i1] , lsEnergy_e[i2]); + tempCoh_fx = BASOP_Util_Divide3232_Scale(absCOVls_fx[i1][i2] , ( Sqrt32( L_add(Mult_32_32(lsEnergy_fx[i1] , lsEnergy_fx[i2]) , EPSILON_FX ),&temp_e) ), &tempCoh_e); + tempCoh_e = add(tempCoh_e,sub(absCOVls_e[i1][i2] , temp_e)); + } + ELSE + { + temp_e = add(lsEnergy_e[i1] , lsEnergy_e[i2]); + tempCoh_fx = BASOP_Util_Divide3232_Scale( absCOVls_fx[i2][i1], ( Sqrt32( L_add( Mult_32_32( lsEnergy_fx[i1], lsEnergy_fx[i2] ), EPSILON_FX ), &temp_e ) ), &tempCoh_e ); + tempCoh_e = add(tempCoh_e,sub(absCOVls_e[i2][i1] , temp_e)); + } + tempCoh_fx = L_shl( tempCoh_fx, 16 ); + IF ( LT_16(i1 , i3) ) + { + temp_e = lsEnergy_e[i1] + lsEnergy_e[i3]; + tempCoh2_fx = BASOP_Util_Divide3232_Scale( absCOVls_fx[i1][i3], ( Sqrt32( L_add( Mult_32_32( lsEnergy_fx[i1], lsEnergy_fx[i3] ), EPSILON_FX ), &temp_e ) ), &tempCoh2_e ); + tempCoh2_e = add(tempCoh2_e,sub(absCOVls_e[i1][i3] , temp_e)); + } + ELSE + { + temp_e = lsEnergy_e[i1] + lsEnergy_e[i3]; + tempCoh2_fx = BASOP_Util_Divide3232_Scale( absCOVls_fx[i3][i1], ( Sqrt32( L_add( Mult_32_32( lsEnergy_fx[i1], lsEnergy_fx[i3] ), EPSILON_FX ), &temp_e ) ), &tempCoh2_e ); + tempCoh2_e = add(tempCoh2_e,sub(absCOVls_e[i3][i1] , temp_e)); + } + tempCoh2_fx = L_shl( tempCoh2_fx, 16 ); + IF ( EQ_16(BASOP_Util_Cmp_Mant32Exp( tempCoh_fx, tempCoh_e, tempCoh2_fx, tempCoh2_e ) , -1) ) + { + cohPanCoh_fx = tempCoh_fx; + cohPanCoh_e = tempCoh_e; + } + ELSE + { + cohPanCoh_fx = tempCoh2_fx; + cohPanCoh_e = tempCoh2_e; + } + cohPanCoh_fx = L_shl( cohPanCoh_fx, cohPanCoh_e );/*Q31*/ + cohPanCoh_e = 0; + lsEnergyRelation_fx = BASOP_Util_Divide3232_Scale(lsEnergy_fx[i2] , L_add( lsEnergy_fx[i1] , EPSILON_FX ), &lsEnergyRelation_e); + lsEnergyRelation_e += lsEnergy_e[i2] - lsEnergy_e[i1]; + tempLsEnergyRelation_fx = BASOP_Util_Divide3232_Scale(lsEnergy_fx[i1] , L_add( lsEnergy_fx[i2] , EPSILON_FX ), &tempLsEnergyRelation_e); + tempLsEnergyRelation_e += lsEnergy_e[i1] - lsEnergy_e[i2]; + IF ( NE_16(BASOP_Util_Cmp_Mant32Exp( lsEnergyRelation_fx, lsEnergyRelation_e, tempLsEnergyRelation_fx, tempLsEnergyRelation_e ),-1) ) + { + lsEnergyRelation_fx = tempLsEnergyRelation_fx; + lsEnergyRelation_e = tempLsEnergyRelation_e; + } + tempLsEnergyRelation_fx = BASOP_Util_Divide3232_Scale( lsEnergy_fx[i3], L_add( lsEnergy_fx[i1], EPSILON_FX ), &tempLsEnergyRelation_e ); + tempLsEnergyRelation_e = add(tempLsEnergyRelation_e,sub(lsEnergy_e[i3] , lsEnergy_e[i1])); + IF ( NE_16(BASOP_Util_Cmp_Mant32Exp( lsEnergyRelation_fx, lsEnergyRelation_e, tempLsEnergyRelation_fx, tempLsEnergyRelation_e ) , -1) ) + { + lsEnergyRelation_fx = tempLsEnergyRelation_fx; + lsEnergyRelation_e = tempLsEnergyRelation_e; + } + tempLsEnergyRelation_fx = BASOP_Util_Divide3232_Scale(lsEnergy_fx[i1] , ( lsEnergy_fx[i3] + EPSILON_FX ), &tempLsEnergyRelation_e); + tempLsEnergyRelation_e = add(tempLsEnergyRelation_e,sub(lsEnergy_e[i1] , lsEnergy_e[i3])); + IF ( NE_16(BASOP_Util_Cmp_Mant32Exp( lsEnergyRelation_fx, lsEnergyRelation_e, tempLsEnergyRelation_fx, tempLsEnergyRelation_e ) , -1) ) + { + lsEnergyRelation_fx = tempLsEnergyRelation_fx; + lsEnergyRelation_e = tempLsEnergyRelation_e; + } + lsEnergyRelation_fx = L_shl( lsEnergyRelation_fx,16+ lsEnergyRelation_e );/*Q31*/ + cohwideness_fx = Mult_32_32(cohPanCoh_fx , lsEnergyRelation_fx);/*cohPanCoh_e*/ + + IF (EQ_16(BASOP_Util_Cmp_Mant32Exp( cohwideness_fx , cohPanCoh_e, stereoness_fx, stereoness_e),1) ) + { + spreadCoh_fx = cohwideness_fx; + spreadCoh_e = cohPanCoh_e; + } + ELSE + { + spreadCoh_fx = stereoness_fx; + spreadCoh_e = stereoness_e; + } + IF ( LT_16(spreadCoh_e , 0) ) + { + spreadCoh_fx = L_shl( spreadCoh_fx, spreadCoh_e ); + spreadCoh_e = 0; + } + IF ( GT_32( spreadCoh_fx, L_shl_sat( 1, 31 - spreadCoh_e - 1 /*0.5f with exp=spreadCoh_e*/) ) ) + { + IF (EQ_16(BASOP_Util_Cmp_Mant32Exp(cohwideness_fx , cohPanCoh_e, stereoness_fx, stereoness_e),1) ) + { - for ( i = 0; i < ( *hMcMasa )->num_Cldfb_instances; i++ ) - { - deleteCldfb_ivas( &( ( *hMcMasa )->cldfbAnaEnc[i] ) ); - } + tempCoh_fx = BASOP_Util_Add_Mant32Exp(stereoness_fx , stereoness_e, -L_sub( cohwideness_fx , L_shl(1, 31-cohPanCoh_e-1) ), cohPanCoh_e,&tempCoh_e); + IF ( LT_16(tempCoh_e , 0) ) + { + tempCoh_fx = L_shl( tempCoh_fx, tempCoh_e ); + tempCoh_e = 0; + } + spreadCoh_fx = GT_32( tempCoh_fx , L_shl_sat(1,31- tempCoh_e-1) ) ? tempCoh_fx : L_shl_sat(1, 31 - tempCoh_e - 1); + spreadCoh_e = tempCoh_e; + } + } + IF ( LT_16(spreadCoh_e , 0) ) + { + spreadCoh_fx = L_shl( spreadCoh_fx, spreadCoh_e ); + spreadCoh_e = 0; + } + spreadCoh_fx = ( LT_32(spreadCoh_fx , L_shl_sat(1,31- spreadCoh_e))) ? spreadCoh_fx : L_shl_sat(1,31- spreadCoh_e); + spreadCoh_fx = ( spreadCoh_fx > 0 ) ? spreadCoh_fx : 0; + spreadCoh_fx = L_shl( spreadCoh_fx, spreadCoh_e );/*Q31*/ + /* Compute energy ratio tuning parameter */ + lsEnergySum_fx = 0; + lsEnergySum_e = 0; + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + lsEnergySum_fx = BASOP_Util_Add_Mant32Exp(lsEnergy_fx[i],lsEnergy_e[i], lsEnergySum_fx, lsEnergySum_e,&lsEnergySum_e); + } + lsEnergySum_fx = L_add_sat(lsEnergySum_fx,EPSILON_FX); + lsEnergyRelation_fx = BASOP_Util_Divide3232_Scale(temp1, lsEnergySum_fx, &lsEnergyRelation_e ); + lsEnergyRelation_e = add(lsEnergyRelation_e,sub(temp1_e , lsEnergySum_e)); + lsEnergyRelation_fx = L_shl(lsEnergyRelation_fx,16+lsEnergyRelation_e ); + stereoRatio_fx = L_sub(Mult_32_32(L_shl_sat(stereoCoh_fx, stereoCoh_e), lsEnergyRelation_fx) ,surrCoh_fx); + + lsEnergyRelation_fx = BASOP_Util_Divide3232_Scale( temp2, lsEnergySum_fx, &lsEnergyRelation_e ); + lsEnergyRelation_e = add(lsEnergyRelation_e,sub(temp2_e , lsEnergySum_e)); + lsEnergyRelation_fx = L_shl( lsEnergyRelation_fx, 16 + lsEnergyRelation_e ); + cohPanRatio_fx = L_sub( Mult_32_32( cohPanCoh_fx, lsEnergyRelation_fx ), surrCoh_fx ); + + cohRatio_fx = GT_32( stereoRatio_fx , cohPanRatio_fx ) ? stereoRatio_fx : cohPanRatio_fx;/*Q31*/ + cohRatio_fx = ( LT_32(cohRatio_fx , ONE_IN_Q31) ) ? cohRatio_fx : ONE_IN_Q31; + cohRatio_fx = ( GT_32(cohRatio_fx , 0) ) ? cohRatio_fx : 0; + } + ELSE /* Otherwise, set spread coherence to zero */ + { + spreadCoh_fx = 0; + cohRatio_fx = 0; + lsEnergySum_fx = 0; + FOR ( i = 0; i < numAnalysisChannels; i++ ) + { + lsEnergySum_fx = BASOP_Util_Add_Mant32Exp( lsEnergy_fx[i], lsEnergy_e[i], lsEnergySum_fx, lsEnergySum_e, &lsEnergySum_e ); + } + lsEnergySum_fx =L_add_sat(lsEnergySum_fx, EPSILON_FX); + } - /* intensity 3-dim */ - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - free( ( *hMcMasa )->direction_vector_m[i][j] ); - ( *hMcMasa )->direction_vector_m[i][j] = NULL; + /* Store values */ + spreadCoherence_fx[block_m_idx][band_m_idx] = spreadCoh_fx;/*Q31*/ + surroundingCoherence_fx[block_m_idx][band_m_idx] = surrCoh_fx;/*Q31*/ + coherentEnergyRatio_fx[band_m_idx] = cohRatio_fx;/*Q31*/ } - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + /* Determine energy ratios */ + FOR ( band_m_idx = 0; band_m_idx < hMcMasa->nbands; band_m_idx++ ) { - free( ( *hMcMasa )->buffer_intensity_real[i][j] ); - ( *hMcMasa )->buffer_intensity_real[i][j] = NULL; - } - - free( ( *hMcMasa )->direction_vector_m[i] ); - ( *hMcMasa )->direction_vector_m[i] = NULL; - } - - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) - { - free( ( *hMcMasa )->buffer_intensity_real_vert[j] ); - ( *hMcMasa )->buffer_intensity_real_vert[j] = NULL; - } - - free( ( *hMcMasa )->hMasaOut ); - ( *hMcMasa )->hMasaOut = NULL; - free( ( *hMcMasa )->sph_grid16 ); - ( *hMcMasa )->sph_grid16 = NULL; - - free( ( *hMcMasa ) ); - ( *hMcMasa ) = NULL; - - return; -} - - -/*--------------------------------------------------------------------------* - * ivas_mcmasa_ana() - * - * Multichannel MASA analysis - *--------------------------------------------------------------------------*/ - -void ivas_mcmasa_ana( - MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ - float data_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const int16_t nchan_inp /* i : Number of input channels */ -) -{ - int16_t i; - float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - + Word16 diffuseness_m_e; + IF ( GT_32(renormalization_factor_diff_fx[band_m_idx] , EPSILON_FX) ) + { + diffuseness_m_fx[band_m_idx] =BASOP_Util_Divide3232_Scale(diffuseness_m_fx[band_m_idx], renormalization_factor_diff_fx[band_m_idx], &diffuseness_m_e); + diffuseness_m_e = add(diffuseness_m_e,sub(diffuseness_e[band_m_idx] , renormalization_factor_diff_e[band_m_idx])); + diffuseness_m_fx[band_m_idx] = L_shl_sat( diffuseness_m_fx[band_m_idx], 16+diffuseness_m_e ); + } + ELSE + { + diffuseness_m_fx[band_m_idx] = 0; + } - /* Sum center and LFE, move surround channels */ - v_add( data_f[2], data_f[3], data_f[2], input_frame ); - for ( i = 4; i < nchan_inp; i++ ) - { - mvr2r( data_f[i], data_f[i - 1], input_frame ); + energyRatio_fx[block_m_idx][band_m_idx] = L_sub(ONE_IN_Q31 , diffuseness_m_fx[band_m_idx]); + energyRatio_fx[block_m_idx][band_m_idx] = GT_32( energyRatio_fx[block_m_idx][band_m_idx] , coherentEnergyRatio_fx[band_m_idx] ) ? energyRatio_fx[block_m_idx][band_m_idx] : coherentEnergyRatio_fx[band_m_idx]; + } } - - /* Analysis */ - ivas_mcmasa_param_est_ana( hMcMasa, data_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, nchan_inp ); - - /* Create MASA metadata buffer from the estimated values */ - ivas_create_masa_out_meta( hMcMasa->hMasaOut, hMcMasa->sph_grid16, nchan_transport, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence ); - - /* Downmix */ - ivas_mcmasa_dmx( hMcMasa, data_f, input_frame, nchan_transport, nchan_inp ); - return; } - - -/*--------------------------------------------------------------------------* - * Local functions - *--------------------------------------------------------------------------*/ - -/* Estimate metadata parameters for McMASA */ +#endif // IVAS_FLOAT_FIXED void ivas_mcmasa_param_est_ana( MCMASA_ANA_HANDLE hMcMasa, /* i : McMASA analyzer structure */ float data_f[][L_FRAME48k], /* i : Audio frame in MC-format */ @@ -901,6 +1901,174 @@ static void ivas_mcmasa_dmx( } +#ifdef IVAS_FLOAT_FIXED +static void ivas_mcmasa_dmx_fx( + MCMASA_ANA_HANDLE hMcMasa, + Word32 data_f_fx[][L_FRAME48k], + Word16 data_e, + const Word16 input_frame, + const Word16 nchan_transport, + const Word16 nchan_inp ) +{ + int16_t i, j; + int16_t numAnalysisChannels; + + Word32 dmx_c_fx; + Word32 multiChEne_fx, downmixEne_fx; + Word32 prevEQ_fx, currEQ_fx, instEQ_fx; + Word32 alpha_fx, L_tmp, L_tmp1; + Word16 multiChEne_e, scale, downmixEne_e = 0, prevEQ_e, tmp, currEQ_e, instEQ_e; + + numAnalysisChannels = nchan_inp - 1; + + multiChEne_fx = 0; + multiChEne_e = 0; + + FOR ( j = 0; j < numAnalysisChannels; j++ ) + { + FOR ( i = 0; i < input_frame; i++ ) + { + L_tmp1 = BASOP_Util_Add_Mant32Exp(data_f_fx[j][i], data_e, 0, 0, &scale); + L_tmp = Mpy_32_32(L_tmp1, L_tmp1); // data_e + data_e + multiChEne_fx = BASOP_Util_Add_Mant32Exp(L_tmp, scale + scale, multiChEne_fx, multiChEne_e, &scale); + multiChEne_e = scale; + } + } + + IF ( nchan_transport == 2 ) + { + Word16 numSideChannels; /* Channels other than left, right, center */ + Word16 leftIndex, rightIndex; + + numSideChannels = numAnalysisChannels / 2 - 1; + FOR ( j = 0; j < numSideChannels; j++ ) + { + leftIndex = j * 2 + 3; + rightIndex = j * 2 + 4; + + FOR ( i = 0; i < input_frame; i++ ) + { + data_f_fx[0][i] = L_add(data_f_fx[0][i], data_f_fx[leftIndex][i] ); + data_f_fx[1][i] = L_add(data_f_fx[1][i] , data_f_fx[rightIndex][i] ); + + } + } + + FOR ( i = 0; i < input_frame; i++ ) + { + dmx_c_fx = (Word32) W_shr(W_mult_32_32(INV_SQRT2_FX, data_f_fx[2][i]), 32 ); + + data_f_fx[0][i] = L_add( dmx_c_fx, data_f_fx[0][i] ); + data_f_fx[1][i] = L_add( dmx_c_fx, data_f_fx[1][i] ); + + } + } + ELSE IF ( nchan_transport == 1 ) + { + FOR ( i = 0; i < input_frame; i++ ) + { + FOR ( j = 1; j < numAnalysisChannels; j++ ) + { + data_f_fx[0][i] = L_add( data_f_fx[0][i], data_f_fx[j][i] ); + } + } + } + + downmixEne_fx = 0; + + FOR ( j = 0; j < nchan_transport; j++ ) + { + FOR ( i = 0; i < input_frame; i++ ) + { + L_tmp1 = BASOP_Util_Add_Mant32Exp(data_f_fx[j][i], data_e, 0, 0, &scale); + L_tmp = Mpy_32_32(L_tmp1, L_tmp1); // data_e + data_e + downmixEne_fx = BASOP_Util_Add_Mant32Exp(L_tmp, scale + scale, downmixEne_fx, downmixEne_e, &downmixEne_e); + } + } + + alpha_fx = 214748364; // Q31 + + L_tmp = Mpy_32_32(alpha_fx, multiChEne_fx); + L_tmp1 = Mpy_32_32( 1932735284, hMcMasa->prevMultiChEne_fx ); + hMcMasa->prevMultiChEne_fx = BASOP_Util_Add_Mant32Exp(L_tmp, multiChEne_e, L_tmp1, hMcMasa->prevMultiChEne_e, &hMcMasa->prevMultiChEne_e ); + + + L_tmp = Mpy_32_32(alpha_fx, downmixEne_fx); + L_tmp1 = Mpy_32_32(1932735284, hMcMasa->prevDownmixEne_fx); + hMcMasa->prevDownmixEne_fx = BASOP_Util_Add_Mant32Exp(L_tmp, downmixEne_e, L_tmp1, hMcMasa->prevDownmixEne_e, &hMcMasa->prevDownmixEne_e); + + prevEQ_fx = hMcMasa->prevEQ_fx; + prevEQ_e = hMcMasa->prevEQ_e; + + tmp = BASOP_Util_Divide3232_Scale(hMcMasa->prevMultiChEne_fx, L_add(hMcMasa->prevDownmixEne_fx, EPSILON_FX), &scale); + currEQ_e = scale + ( hMcMasa->prevMultiChEne_e - hMcMasa->prevDownmixEne_e); + currEQ_fx = Sqrt32(L_deposit_h(tmp), &currEQ_e); + + hMcMasa->prevEQ_fx = currEQ_fx; + hMcMasa->prevEQ_e = currEQ_e; + + FOR ( i = 0; i < input_frame; i++ ) + { + L_tmp = Mpy_32_32(L_deposit_h(hMcMasa->interpolator_fx[i]), currEQ_fx); + L_tmp1 = L_sub(1073741824, L_lshr( L_deposit_h(hMcMasa->interpolator_fx[i]), 1 ) ); + L_tmp1 = Mpy_32_32( L_tmp1, prevEQ_fx ); + instEQ_fx = BASOP_Util_Add_Mant32Exp(L_tmp, currEQ_e, L_tmp1, prevEQ_e + 1, &instEQ_e); + + FOR ( j = 0; j < nchan_transport; j++ ) + { + data_f_fx[j][i] = Mpy_32_32( instEQ_fx, data_f_fx[j][i] ); + + data_f_fx[j][i] = L_shl(data_f_fx[j][i], instEQ_e); + } + } + + return; +} + +#endif + +#ifdef IVAS_FLOAT_FIXED +/* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ +static void compute_cov_mtx_fx( + Word32 sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, real, s[ch][freq] */ + Word32 si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, imag, s[ch][freq] */ + const Word16 freq, /* i : Freq to process */ + const Word16 N, /* i : Number of channels */ + CovarianceMatrix *COVls, /* o : Output matrix, contains upper part of cov mtx */ + Word16 inp_exp/*Stores exponent for temp*/ +) +{ + Word16 i, j; + Word32 a, b, c, d; + Word32 temp; + Word16 norm_a,norm_b,norm_c, norm_d; + Word16 shift; + FOR ( i = 0; i < N; i++ ) + { + a = sr[i][freq]; + b = si[i][freq]; + norm_a = norm_l( a ); + norm_b = norm_l( b ); + a = L_shl( a, norm_a);/*inp_exp-norm_a*/ + b = L_shl( b, norm_b);/*inp_exp-norm_b*/ + FOR ( j = i; j < N; j++ ) + { + c = sr[j][freq]; + d = si[j][freq]; + norm_c= norm_l( c ); + norm_d = norm_l( d ); + c = L_shl( c, norm_c );/*inp_exp-norm_c*/ + d = L_shl( d, norm_d );/*inp_exp-norm_d*/ + temp = BASOP_Util_Add_Mant32Exp( Mult_32_32( a, c ), 2*inp_exp - norm_a-norm_c, Mult_32_32( b, d ), 2 * inp_exp - norm_b - norm_d,&shift);/*exp=inp_exp-norm_ab+inp_exp-norm_cd*/ + COVls->xr_fx[i][j] = BASOP_Util_Add_Mant32Exp( COVls->xr_fx[i][j], COVls->xr_e[i][j], temp,shift,&COVls->xr_e[i][j]); + temp = BASOP_Util_Add_Mant32Exp(Mult_32_32( b, c ), 2 * inp_exp - norm_b - norm_c,-Mult_32_32( a, d ), 2 * inp_exp - norm_a - norm_d, &shift); + COVls->xi_fx[i][j] = BASOP_Util_Add_Mant32Exp( COVls->xi_fx[i][j], COVls->xi_e[i][j], temp, shift,&COVls->xi_e[i][j]); + } + } + + return; +} +#endif /* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, real, s[ch][freq] */ @@ -934,6 +2102,80 @@ static void compute_cov_mtx( * * *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void computeVerticalDiffuseness_fx( + Word32 **buffer_intensity, /* i : Intensity vectors */ + const Word32 *buffer_energy, /* i : Energy */ + const Word16 num_freq_bands, /* i : Number of frequency bands */ + Word32 *diffuseness , /* o : Estimated diffuseness */ + Word16 *buffer_intensity_q, + Word16 *buffer_energy_q +) +{ + Word32 intensity_slow[MASA_FREQUENCY_BANDS]; + Word32 intensity_slow_abs[MASA_FREQUENCY_BANDS]; + Word32 energy_slow[MASA_FREQUENCY_BANDS]; + Word16 i, k; + Word32 tmp = 0; + const Word32 *p_tmp_c; + Word16 intensity_slow_e[MASA_FREQUENCY_BANDS], energy_slow_e[MASA_FREQUENCY_BANDS]; + + /* Set variables to zero */ + set32_fx( intensity_slow, 0, MASA_FREQUENCY_BANDS ); + set32_fx( energy_slow, 0, MASA_FREQUENCY_BANDS ); + set16_fx(intensity_slow_e, 0, MASA_FREQUENCY_BANDS ); + set16_fx(energy_slow_e, 0, MASA_FREQUENCY_BANDS ); + + FOR ( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) + { + /* Energy slow */ + p_tmp_c = buffer_energy + i * num_freq_bands; + FOR ( k = 0; k < num_freq_bands; k++ ) + { + energy_slow[k] = BASOP_Util_Add_Mant32Exp( energy_slow[k], energy_slow_e[k],*( p_tmp_c ), 31-buffer_energy_q[i],&energy_slow_e[k]);/*q=min_q*/ + p_tmp_c++; + } + + /* Intensity slow */ + FOR ( k = 0; k < num_freq_bands; k++ ) + { + intensity_slow[k] = BASOP_Util_Add_Mant32Exp(intensity_slow[k], intensity_slow_e[k], buffer_intensity[i][k],31- buffer_intensity_q[i],&intensity_slow_e[k]);/*q=min_q*/ + } + } + + /* Compute absolute value */ + FOR ( k = 0; k < num_freq_bands; k++ ) + { + intensity_slow_abs[k] = L_abs( intensity_slow[k] );/*min_q*/ + } + + /* Compute Diffuseness */ + FOR( i = 0; i < num_freq_bands; ++i ) + { + Word16 tmp_e1, tmp_e2; + tmp = BASOP_Util_Divide3232_Scale( intensity_slow_abs[i], ( energy_slow[i] + EPSILON_FX_SMALL), &tmp_e1 ); + tmp_e1 += intensity_slow_e[i] - energy_slow_e[i]; + tmp = BASOP_Util_Divide3232_Scale( tmp - L_shr( VERTICAL_ENERGY_RATIO_OFFSET_FX, tmp_e1 ), ONE_IN_Q15 - VERTICAL_ENERGY_RATIO_OFFSET_FX, &tmp_e2 ); /* Tuned to avoid effect due to ambience of vertically un-even setups */ + tmp_e2 += tmp_e1; + tmp = L_sub( L_shl( 1, 15 - tmp_e2 ), tmp ); + IF( tmp < 0 ) + { + tmp = 0; + } + ELSE IF( tmp >= L_shl( 1, 15 - tmp_e2 ) ) + { + tmp = ONE_IN_Q31; + } + ELSE + { + tmp = L_shl( tmp, 16 + tmp_e2 ); + } + diffuseness[i] = tmp; + } + + return; +} +#endif // IVAS_FLOAT_FIXED static void computeVerticalDiffuseness( float **buffer_intensity, /* i : Intensity vectors */ @@ -987,6 +2229,68 @@ static void computeVerticalDiffuseness( return; } +#ifdef IVAS_FLOAT_FIXED +static void computeEvenLayout_fx( + const Word32 *ls_azimuth, + Word32 *ls_azimuth_even, + const Word16 numChannels ) +{ + Word16 i; + Word16 j; + Word32 ls_azimuth_temp[MCMASA_MAX_ANA_CHANS]; + Word32 ls_azimuth_even_ordered[MCMASA_MAX_ANA_CHANS]; + Word16 ls_azimuth_order[MCMASA_MAX_ANA_CHANS]; + Word32 smallestAzimuth; + Word16 smallestAzimuthIndex; + Word32 lsSpacing; + UWord8 oddLayout; + Word32 startAzimuth; + Word16 numChannelsHalf; + + lsSpacing = L_shl(L_mult0(360 , div_s(1,numChannels)),6);/*Q.21*/ + oddLayout = numChannels % 2; + numChannelsHalf = shr(numChannels , 1); + + Copy32( ls_azimuth, ls_azimuth_temp, numChannels ); + Scale_sig32( ls_azimuth_temp, numChannels, -1 );/*Q.21*/ + FOR ( i = 0; i < numChannels; i++ ) + { + smallestAzimuth = L_shl(1000,21);/*Q21*/ + smallestAzimuthIndex = 0; + FOR ( j = 0; j < numChannels; j++ ) + { + IF ( LT_32(ls_azimuth_temp[j] , smallestAzimuth) ) + { + smallestAzimuth = ls_azimuth_temp[j]; + smallestAzimuthIndex = j; + } + } + ls_azimuth_order[i] = smallestAzimuthIndex; + ls_azimuth_temp[smallestAzimuthIndex] = L_shl(1000, 21); + } + + IF ( oddLayout ) + { + startAzimuth = W_extract_l(W_mult0_32_32(-lsSpacing , shl( numChannelsHalf ,1)));/*Q.22*/ + } + ELSE + { + startAzimuth = W_extract_l(W_mult0_32_32(-lsSpacing , sub(shl(numChannelsHalf,1) , 1 )));/*Q.22*/ + } + + FOR ( i = 0; i < numChannels; i++ ) + { + ls_azimuth_even_ordered[i] = W_extract_l(W_add(W_mult_32_16(lsSpacing,i) , startAzimuth));/*Q.22*/ + } + + FOR ( i = 0; i < numChannels; i++ ) + { + ls_azimuth_even[ls_azimuth_order[i]] = L_shl(L_shr(L_add(ls_azimuth_even_ordered[i],ONE_IN_Q21),22),22);/*((a+2^21)/2^22)*2^22*/ + } + + return; +} +#endif // IVAS_FLOAT_FIXED static void computeEvenLayout( const float *ls_azimuth, diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index cfb3ec5dd..5696571f9 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -396,9 +396,10 @@ ivas_error TDREND_MIX_Init( { ivas_error error; - hBinRendererTd->Gain = 1.0f; #ifdef IVAS_FLOAT_FIXED hBinRendererTd->Gain_fx = ONE_IN_Q14; +#else + hBinRendererTd->Gain = 1.0f; #endif /* Init source list */ diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 39347f1bf..1b566cb9f 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -1360,15 +1360,16 @@ void TDREND_SRC_Init( Src_p->itd = 0; Src_p->previtd = 0; Src_p->filterlength = 1; /* Init to unit impulse of length 1 */ +#ifndef IVAS_FLOAT_FIXED set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); +#endif #ifdef IVAS_FLOAT_FIXED set32_fx( Src_p->mem_itd_fx, 0, ITD_MEM_LEN ); set32_fx( Src_p->mem_hrf_left_fx, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); set32_fx( Src_p->mem_hrf_right_fx, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); -#endif - +#else set_f( Src_p->hrf_left_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); set_f( Src_p->hrf_right_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); Src_p->hrf_left_prev[0] = 1; @@ -1377,6 +1378,7 @@ void TDREND_SRC_Init( Src_p->elev_prev = 0.0f; Src_p->Gain = 1; Src_p->prevGain = 1.0f; +#endif #ifdef IVAS_FLOAT_FIXED set32_fx(Src_p->hrf_left_prev_fx, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH); set32_fx(Src_p->hrf_right_prev_fx, 0, SFX_SPAT_BIN_MAX_FILTER_LENGTH); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index bc6836520..7e20e2671 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -2578,6 +2578,16 @@ ivas_error ivas_mcmasa_ana_open( const AUDIO_CONFIG inConfig, /* i : Input config */ int32_t input_Fs /* i : Sampling frequency */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_mcmasa_ana_fx( + MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ + Word32 data[][L_FRAME48k], /* i/o: Input / transport audio signals */ + Word16 q_data, + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_inp /* i : Number of input channels */ +); +#endif // IVAS_FLOAT_FIXED void ivas_mcmasa_ana( MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index dcb41e6aa..2805751e3 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -138,7 +138,7 @@ ivas_error ivas_er_init( const AUDIO_CONFIG inConfig ) { ivas_error error; - uint8_t i; + UWord8 i; /* Set to defaults for shoebox */ reflections->is_ready = 0; @@ -152,15 +152,6 @@ ivas_error ivas_er_init( move16(); move32(); - -#if 0 -// Commenting this code as the values are initialized in below loop. -// This initialization is redundant. - reflections->user_origin[0] = 0.0f; - reflections->user_origin[1] = 0.0f; - reflections->user_origin[2] = ER_LIST_HEIGHT; -#endif - /* Store scene origin if present */ FOR( i = 0; i < 3; i++ ) @@ -173,13 +164,13 @@ ivas_error ivas_er_init( ivas_shoebox_init( &reflections->shoebox_lib, &reflections->shoebox_lib.cal ); /* Set mode */ - IF( ( error = ivas_er_set_reflections_mode( reflections, inConfig ) ) != IVAS_ERR_OK ) + IF( NE_32 ( ( error = ivas_er_set_reflections_mode( reflections, inConfig ) ), IVAS_ERR_OK ) ) { return error; } /* Compute the static reflections (first frame) */ - IF( ( error = ivas_er_compute_reflections( reflections ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_er_compute_reflections( reflections ) ), IVAS_ERR_OK ) ) { return error; } @@ -190,7 +181,7 @@ ivas_error ivas_er_init( } set_s( (int16_t *) reflections->closest_ch_idx, 0, reflections->n_total_reflections ); - IF( ( error = getAudioConfigNumChannels( reflections->audio_config, &( reflections->nchan_out ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( reflections->audio_config, &( reflections->nchan_out ) ) ), IVAS_ERR_OK ) ) { return error; } @@ -203,6 +194,7 @@ ivas_error ivas_er_init( /* Update flag to indicate that reflection module is ready to process */ reflections->is_ready = 1; + move16(); return error; } @@ -215,6 +207,165 @@ ivas_error ivas_er_init( Function sets the ER source positions based on the audio config *-----------------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_er_set_reflections_mode( + er_struct_t *reflections, + const AUDIO_CONFIG inConfig ) +{ + ivas_error error; + UWord16 ch; + error = IVAS_ERR_OK; + + IF ( EQ_32( reflections->audio_config, inConfig ) ) + { + return error; + } + + reflections->is_ready = 0; + move16(); + reflections->audio_config = inConfig; + + SWITCH ( reflections->audio_config ) + { + case IVAS_AUDIO_CONFIG_MONO: + reflections->shoebox_data.n_sources = 1; + reflections->n_LC_sources = 1; + reflections->LC_mixing = LC_mixing_5_1; + move16(); + move16(); + move16(); + + reflections->source_positions_fx[0] = 0; + reflections->source_positions_fx[1] = 0; + reflections->source_positions_fx[2] = ER_RADIUS_FX; + move32(); + move32(); + move32(); + BREAK; + case IVAS_AUDIO_CONFIG_STEREO: + reflections->shoebox_data.n_sources = 2; + reflections->n_LC_sources = 2; + reflections->LC_mixing = LC_mixing_5_1; + move16(); + move16(); + move16(); + + FOR ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) + { + reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP2_idx[ch]; + reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP2_idx[ch]; + reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; + move32(); + move32(); + move32(); + } + BREAK; + case IVAS_AUDIO_CONFIG_5_1: + reflections->shoebox_data.n_sources = 5; + reflections->n_LC_sources = 3; + reflections->LC_mixing = LC_mixing_5_1; + move16(); + move16(); + move16(); + + FOR ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) + { + reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP6_idx[ch]; + reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP6_idx[ch]; + reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; + move32(); + move32(); + move32(); + } + BREAK; + case IVAS_AUDIO_CONFIG_7_1: + reflections->shoebox_data.n_sources = 7; + reflections->n_LC_sources = 5; + reflections->LC_mixing = LC_mixing_7_1; + move16(); + move16(); + move16(); + FOR ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) + { + reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP12_idx[ch]; + reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP12_idx[ch]; + reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; + move32(); + move32(); + move32(); + } + BREAK; + case IVAS_AUDIO_CONFIG_5_1_2: + reflections->shoebox_data.n_sources = 7; + reflections->n_LC_sources = 5; + reflections->LC_mixing = LC_mixing_5_1_2; + move16(); + move16(); + move16(); + FOR ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) + { + reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP14_idx[ch]; + reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP14_idx[ch]; + reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; + move32(); + move32(); + move32(); + } + BREAK; + case IVAS_AUDIO_CONFIG_5_1_4: + reflections->shoebox_data.n_sources = 9; + reflections->n_LC_sources = 5; + reflections->LC_mixing = LC_mixing_5_1_4; + move16(); + move16(); + move16(); + FOR ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) + { + reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP16_idx[ch]; + reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP16_idx[ch]; + reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; + move32(); + move32(); + move32(); + } + BREAK; + case IVAS_AUDIO_CONFIG_7_1_4: + reflections->shoebox_data.n_sources = 11; + reflections->n_LC_sources = 5; + reflections->LC_mixing = LC_mixing_7_1_4; + move16(); + move16(); + move16(); + FOR ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) + { + reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP19_idx[ch]; + reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP19_idx[ch]; + reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; + move32(); + move32(); + move32(); + } + BREAK; + case IVAS_AUDIO_CONFIG_HOA3: + reflections->use_er = 0; + move16(); + BREAK; + case IVAS_AUDIO_CONFIG_HOA2: + reflections->use_er = 0; + move16(); + BREAK; + case IVAS_AUDIO_CONFIG_FOA: + reflections->use_er = 0; + move16(); + BREAK; + default: + reflections->audio_config = IVAS_AUDIO_CONFIG_INVALID; + return IVAS_ERROR( IVAS_ERR_INVALID_ER_PARAM, "Unsupported reflections mode" ); + } + + return error; +} +#else ivas_error ivas_er_set_reflections_mode( er_struct_t *reflections, const AUDIO_CONFIG inConfig ) @@ -237,15 +388,11 @@ ivas_error ivas_er_set_reflections_mode( reflections->shoebox_data.n_sources = 1; reflections->n_LC_sources = 1; reflections->LC_mixing = LC_mixing_5_1; -#ifndef IVAS_FLOAT_FIXED + reflections->source_positions[0] = 0; reflections->source_positions[1] = 0; reflections->source_positions[2] = ER_RADIUS; -#else - reflections->source_positions_fx[0] = 0; - reflections->source_positions_fx[1] = 0; - reflections->source_positions_fx[2] = ER_RADIUS_FX; -#endif + break; case IVAS_AUDIO_CONFIG_STEREO: reflections->shoebox_data.n_sources = 2; @@ -253,17 +400,9 @@ ivas_error ivas_er_set_reflections_mode( reflections->LC_mixing = LC_mixing_5_1; for ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) { -#ifndef IVAS_FLOAT_FIXED reflections->source_positions[3 * ch] = deg2rad( ls_azimuth_CICP2[ch] ); reflections->source_positions[1 + ( 3 * ch )] = deg2rad( ls_elevation_CICP2[ch] ); reflections->source_positions[2 + ( 3 * ch )] = ER_RADIUS; - -#else - reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP2_idx[ch]; - reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP2_idx[ch]; - reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; - -#endif } break; case IVAS_AUDIO_CONFIG_5_1: @@ -272,15 +411,9 @@ ivas_error ivas_er_set_reflections_mode( reflections->LC_mixing = LC_mixing_5_1; for ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) { -#ifndef IVAS_FLOAT_FIXED reflections->source_positions[3 * ch] = deg2rad( ls_azimuth_CICP6[ch] ); reflections->source_positions[1 + ( 3 * ch )] = deg2rad( ls_elevation_CICP6[ch] ); reflections->source_positions[2 + ( 3 * ch )] = ER_RADIUS; -#else - reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP6_idx[ch]; - reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP6_idx[ch]; - reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; -#endif } break; case IVAS_AUDIO_CONFIG_7_1: @@ -289,15 +422,9 @@ ivas_error ivas_er_set_reflections_mode( reflections->LC_mixing = LC_mixing_7_1; for ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) { -#ifndef IVAS_FLOAT_FIXED reflections->source_positions[3 * ch] = deg2rad( ls_azimuth_CICP12[ch] ); reflections->source_positions[1 + ( 3 * ch )] = deg2rad( ls_elevation_CICP12[ch] ); reflections->source_positions[2 + ( 3 * ch )] = ER_RADIUS; -#else - reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP12_idx[ch]; - reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP12_idx[ch]; - reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; -#endif } break; case IVAS_AUDIO_CONFIG_5_1_2: @@ -306,15 +433,9 @@ ivas_error ivas_er_set_reflections_mode( reflections->LC_mixing = LC_mixing_5_1_2; for ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) { -#ifndef IVAS_FLOAT_FIXED reflections->source_positions[3 * ch] = deg2rad( ls_azimuth_CICP14[ch] ); reflections->source_positions[1 + ( 3 * ch )] = deg2rad( ls_elevation_CICP14[ch] ); reflections->source_positions[2 + ( 3 * ch )] = ER_RADIUS; -#else - reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP14_idx[ch]; - reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP14_idx[ch]; - reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; -#endif } break; case IVAS_AUDIO_CONFIG_5_1_4: @@ -323,15 +444,9 @@ ivas_error ivas_er_set_reflections_mode( reflections->LC_mixing = LC_mixing_5_1_4; for ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) { -#ifndef IVAS_FLOAT_FIXED reflections->source_positions[3 * ch] = deg2rad( ls_azimuth_CICP16[ch] ); reflections->source_positions[1 + ( 3 * ch )] = deg2rad( ls_elevation_CICP16[ch] ); reflections->source_positions[2 + ( 3 * ch )] = ER_RADIUS; -#else - reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP16_idx[ch]; - reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP16_idx[ch]; - reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; -#endif } break; case IVAS_AUDIO_CONFIG_7_1_4: @@ -340,15 +455,9 @@ ivas_error ivas_er_set_reflections_mode( reflections->LC_mixing = LC_mixing_7_1_4; for ( ch = 0; ch < reflections->shoebox_data.n_sources; ch++ ) { -#ifndef IVAS_FLOAT_FIXED reflections->source_positions[3 * ch] = deg2rad( ls_azimuth_CICP19[ch] ); reflections->source_positions[1 + ( 3 * ch )] = deg2rad( ls_elevation_CICP19[ch] ); reflections->source_positions[2 + ( 3 * ch )] = ER_RADIUS; -#else - reflections->source_positions_fx[3 * ch] = ls_azimuth_CICP19_idx[ch]; - reflections->source_positions_fx[1 + ( 3 * ch )] = ls_elevation_CICP19_idx[ch]; - reflections->source_positions_fx[2 + ( 3 * ch )] = ER_RADIUS_FX; -#endif } break; case IVAS_AUDIO_CONFIG_HOA3: @@ -368,6 +477,8 @@ ivas_error ivas_er_set_reflections_mode( return error; } +#endif + /*-----------------------------------------------------------------------------------------* Function ivas_er_encoder_init() @@ -449,12 +560,16 @@ ivas_error ivas_er_encoder_init( ivas_error error = IVAS_ERR_OK; Word16 i, j, src_idx; Word16 min_index_fx = 0; + move16(); Word32 rad_el_angle, rad_az_angle, tmp_data_fx, p_x_src_fx, p_y_src_fx, p_z_src_fx; Word16 el_angle_cos, az_angle_cos, el_angle_sin, az_angle_sin; Word32 p_x_fx, p_y_fx, p_z_fx, tmp_fx, tmp_data, dist_fx, min_dist_fx = 0; + move32(); Word32 *src_pos_ptr_fx; Word16 q_format, tmp16, min_qformat = 0; + move16(); + IF( reflections == NULL ) @@ -535,12 +650,12 @@ ivas_error ivas_er_encoder_init( tmp_fx = L_mac( tmp_fx, tmp16, tmp16 ); // Q.27 q_format = Q31 - Q27; dist_fx = Sqrt32( tmp_fx, &q_format ); - if ( EQ_32( dist_fx, 0 ) ) + IF ( EQ_32( dist_fx, 0 ) ) { q_format = 0; move16(); } - if ( LE_16( q_format, 0 ) ) + IF ( LE_16( q_format, 0 ) ) { dist_fx = L_shl( dist_fx, q_format ); // Q31 q_format = 0; @@ -556,13 +671,13 @@ ivas_error ivas_er_encoder_init( move16(); move16(); } - else + ELSE { - if ( LE_16( q_format, min_qformat ) ) + IF ( LE_16( q_format, min_qformat ) ) { - if ( EQ_16( q_format, min_qformat ) ) + IF ( EQ_16( q_format, min_qformat ) ) { - if ( LT_32( dist_fx, min_dist_fx ) ) + IF ( LT_32( dist_fx, min_dist_fx ) ) { min_dist_fx = dist_fx; min_index_fx = j; @@ -570,7 +685,7 @@ ivas_error ivas_er_encoder_init( move16(); } } - else + ELSE { min_dist_fx = dist_fx; min_index_fx = j; @@ -584,7 +699,7 @@ ivas_error ivas_er_encoder_init( } } - reflections->closest_ch_idx[i] = (uint16_t) min_index_fx; + reflections->closest_ch_idx[i] = (UWord16) min_index_fx; move16(); } } @@ -605,46 +720,25 @@ ivas_error ivas_er_compute_reflections( er_struct_t *reflections ) { ivas_error error = IVAS_ERR_OK; - uint16_t circ_len, i, j; -#ifndef IVAS_FLOAT_FIXED - float tmp; -#else + UWord16 circ_len, i, j; UWord32 tmp_fx, tmp_fx1; UWord16 tmp_fx_hi, tmp_fx_lo; -#endif reflections->is_ready = 0; + move16(); /* Disabled case */ - if ( reflections->audio_config == IVAS_AUDIO_CONFIG_INVALID ) + IF ( EQ_32( reflections->audio_config, IVAS_AUDIO_CONFIG_INVALID ) ) { return error; } /* Run shoebox with current reflection parameters */ -#ifndef IVAS_FLOAT_FIXED - ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), reflections->shoebox_lib.cal.list_orig, - reflections->source_positions, reflections->is_cartesian, reflections->is_relative ); -#else ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), reflections->shoebox_lib.cal.list_orig_fx, reflections->source_positions_fx, reflections->is_cartesian, reflections->is_relative ); -#endif - /* Convert reflection times in seconds to samples and keep track of max */ circ_len = 0; -#ifndef IVAS_FLOAT_FIXED - - for ( i = 0; i < reflections->shoebox_data.n_sources; i++ ) - { - for ( j = 0; j < reflections->shoebox_data.n_ref; j++ ) - { - tmp = reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )]; - tmp = roundf( tmp * reflections->output_Fs ); - reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )] = tmp; - circ_len = ( (uint16_t) tmp > circ_len ) ? (uint16_t) tmp : circ_len; - } - } -#else + move16(); FOR( i = 0; i < reflections->shoebox_data.n_sources; i++ ) { @@ -657,94 +751,63 @@ ivas_error ivas_er_compute_reflections( tmp_fx1 = (UWord32) L_add( tmp_fx1, 0x20 ); tmp_fx1 = L_shr( tmp_fx1, 6 ); reflections->shoebox_data.times.data_fx[j + ( i * reflections->shoebox_data.n_ref )] = tmp_fx1; - circ_len = ( (uint16_t) tmp_fx1 > circ_len ) ? (uint16_t) tmp_fx1 : circ_len; + circ_len = ( (UWord16) tmp_fx1 > circ_len ) ? (UWord16) tmp_fx1 : circ_len; } } -#endif - /* If max delay is less than max frame size, use max frame size to compute circ buffer length */ - circ_len = ( circ_len > (uint16_t) reflections->max_frame_size ) ? circ_len : (uint16_t) reflections->max_frame_size; - circ_len += (uint16_t) reflections->max_frame_size; + circ_len = ( circ_len > (UWord16) reflections->max_frame_size ) ? circ_len : (UWord16) reflections->max_frame_size; + circ_len += (UWord16) reflections->max_frame_size; /* If circ buffers exist and size is the same, reset memory to all zeros */ /* If size is different, reallocate circ buffers */ /* Otherwise allocate new circ buffers */ -#ifdef IVAS_FLOAT_FIXED - for ( i = 0; i < 150; i++ ) + + FOR ( i = 0; i < 150; i++ ) { reflections->shoebox_data.gains.data_fx[i] = L_shl( reflections->shoebox_data.gains.data_fx[i], 9 ); } - if ( reflections->circ_buffers ) + IF ( reflections->circ_buffers ) { - if ( reflections->circ_len == circ_len ) + IF ( reflections->circ_len == circ_len ) { /* circ buffers exist and size is the same */ set32_fx( reflections->circ_buffers, 0, reflections->shoebox_data.n_sources * reflections->circ_len ); } - else + ELSE { /* circ buffers exist but size is different */ reflections->circ_len = circ_len; + move16(); free( reflections->circ_buffers ); - if ( ( reflections->circ_buffers = (Word32 *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( Word32 ) ) ) == NULL ) + IF ( ( reflections->circ_buffers = (Word32 *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( Word32 ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections buffers" ); } set32_fx( reflections->circ_buffers, 0, reflections->shoebox_data.n_sources * reflections->circ_len ); } } - else + ELSE { /* circ buffers do not exist */ reflections->circ_len = circ_len; - if ( ( reflections->circ_buffers = (Word32 *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( Word32 ) ) ) == NULL ) + move16(); + IF ( ( reflections->circ_buffers = (Word32 *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( Word32 ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections buffers" ); } set32_fx( reflections->circ_buffers, 0, reflections->shoebox_data.n_sources * reflections->circ_len ); } -#else - if ( reflections->circ_buffers ) - { - if ( reflections->circ_len == circ_len ) - { - /* circ buffers exist and size is the same */ - set_f( reflections->circ_buffers, 0.0f, reflections->shoebox_data.n_sources * reflections->circ_len ); - } - else - { - /* circ buffers exist but size is different */ - reflections->circ_len = circ_len; - free( reflections->circ_buffers ); - if ( ( reflections->circ_buffers = (float *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections buffers" ); - } - set_f( reflections->circ_buffers, 0.0f, reflections->shoebox_data.n_sources * reflections->circ_len ); - } - } - else - { - /* circ buffers do not exist */ - reflections->circ_len = circ_len; - if ( ( reflections->circ_buffers = (float *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections buffers" ); - } - set_f( reflections->circ_buffers, 0.0f, reflections->shoebox_data.n_sources * reflections->circ_len ); - } -#endif /* Initialize circular buffer insertion point */ - reflections->circ_insert = reflections->circ_len - (uint16_t) reflections->max_frame_size; + reflections->circ_insert = reflections->circ_len - (UWord16) reflections->max_frame_size; /* Get total reflections number */ reflections->n_total_reflections = reflections->shoebox_data.n_sources * reflections->shoebox_data.n_ref; /* Check that reflection buffers were allocated */ - if ( error != IVAS_ERR_OK ) + IF ( NE_32( error, IVAS_ERR_OK ) ) { return error; } @@ -866,40 +929,44 @@ ivas_error ivas_er_process( Word32 *buffer_ch; Word32 temp; - if ( !reflections ) + IF ( !reflections ) { return IVAS_ERR_INIT_ERROR; } /* should not arrive here if reflections are disabled but in case it does just do nothing */ - if ( reflections->use_er != 1 ) + IF ( reflections->use_er != 1 ) { return error; } /* Ensure all reflection memory is allocated */ - if ( !reflections->circ_buffers || !reflections->is_ready ) + IF ( !reflections->circ_buffers || !reflections->is_ready ) { return IVAS_ERR_INIT_ERROR; } subframe_offset = subframe_idx * subframe_size; + move16(); n_ref = reflections->shoebox_data.n_ref; + move16(); /* If low complexity ER are requested only compute ER for n_LC_sources */ - if ( reflections->lowComplexity ) + IF ( reflections->lowComplexity ) { n_ref_sources = reflections->n_LC_sources; + move16(); } - else + ELSE { n_ref_sources = reflections->shoebox_data.n_sources; + move16(); } /* Channel case, copy input into buffers panning for LC mode and skipping LFE */ - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF ( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { /* Loop through all input sources filling circular buffers */ - for ( i = 0; i < reflections->shoebox_data.n_sources; i++ ) + FOR ( i = 0; i < reflections->shoebox_data.n_sources; i++ ) { /* Pull correct circular buffer depending on complexity mode */ buf_ch_idx = ( reflections->lowComplexity == 1 ) ? reflections->LC_mixing[i] : i; @@ -910,18 +977,18 @@ ivas_error ivas_er_process( samp_idx = reflections->circ_insert; /* If less than number of reflection sources, overwrite buffer */ - if ( i == buf_ch_idx ) + IF ( i == buf_ch_idx ) { - for ( j = 0; j < subframe_size; j++ ) + FOR ( j = 0; j < subframe_size; j++ ) { buffer_ch[samp_idx++] = io[in_ch_idx][j + subframe_offset]; samp_idx = samp_idx % reflections->circ_len; } } /* Accumulate with buffer for low complexity mixed sources */ - else + ELSE { - for ( j = 0; j < subframe_size; j++ ) + FOR ( j = 0; j < subframe_size; j++ ) { buffer_ch[samp_idx] = L_add( io[in_ch_idx][j + subframe_offset], buffer_ch[samp_idx] ); samp_idx++; @@ -930,19 +997,19 @@ ivas_error ivas_er_process( } } } - else + ELSE { return IVAS_ERR_INVALID_INPUT_FORMAT; } /* Loop through sources retrieve reflections from circ buffers */ - for ( i = 0; i < n_ref_sources; i++ ) + FOR ( i = 0; i < n_ref_sources; i++ ) { /* Access correct row of input circ buffer */ buffer_ch = &( reflections->circ_buffers[i * reflections->circ_len] ); /* Loop through reflections */ - for ( j = 0; j < n_ref; j++ ) + FOR ( j = 0; j < n_ref; j++ ) { ref_no = j + ( i * n_ref ); ref_gain = (Word32) reflections->shoebox_data.gains.data_fx[ref_no]; @@ -952,13 +1019,13 @@ ivas_error ivas_er_process( /* Determine start idx of reflection in circ buffer based on current insert idx and reflection delay */ samp_idx = (Word16) reflections->circ_insert - ref_delay; - if ( samp_idx < 0 ) + IF ( LT_16( samp_idx, 0 ) ) { - samp_idx = (Word16) reflections->circ_len + samp_idx; + samp_idx = add( (Word16) reflections->circ_len, samp_idx ); } /* Pull reflection from circ buffer and apply gain */ - for ( k = 0; k < subframe_size; k++ ) + FOR ( k = 0; k < subframe_size; k++ ) { temp = Mpy_32_32( buffer_ch[samp_idx], ref_gain ); io[ref_out_idx][k + subframe_offset] = L_add( temp, io[ref_out_idx][k + subframe_offset] ); diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 310968d99..5330ecbcb 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -10895,7 +10895,7 @@ const float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]= } }; #ifdef IVAS_FLOAT_FIXED -const int hrtfShCoeffsIm_fx[2][16][60]/*Q-14*/ = +const Word16 hrtfShCoeffsIm_fx[2][16][60]/*Q-14*/ = { { { diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index eaba2d206..4b00e46d0 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -269,21 +269,42 @@ const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = 3.0903f, 2.0053f, 1.0860f, 0.8072f, 0.7079f }; +const Word16 surCohEne_fx[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = +{ + 25315, 16427, 8896, 6612, 5799 +}; + const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = { 2.3988f, 1.7783f, 1.1220f, 1.1220f, 1.1220f }; +const Word16 spreadCohEne05_fx[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = /* Q13 */ +{ + 19650, 14567, 9191, 9191, 9191 +}; + const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = { 1.5975f, 1.1220f, 1.1220f, 1.1220f, 1.1220f }; +const Word16 spreadCohEne1_fx[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = /* Q14 */ +{ + 26173, 18382, 18382, 18382, 18382 +}; + const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS] = { 0.979f, 0.893f, 0.762f, 0.615f, 0.52f, 0.48f, 0.477f, 0.477f, 0.48f, 0.501f, 0.546f, 0.602f, 0.652f, 0.664f, 0.652f, 0.639f, 0.635f }; +const Word32 lowBitRateBinauralEQ_fx[LOW_BIT_RATE_BINAURAL_EQ_BINS] = +{ + 2102386432, 1917702912, 1636382592, 1320702464, 1116691456, 1030792128, 1024349696, 1024349696, 1030792128, + 1075889280, 1172526080, 1292785152, 1400159360, 1425929088, 1400159360, 1372242048, 1363652096 +}; + const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS] = { 0.047421f, 0.19773f, 0.22582f, 0.10637f, 0.0087111f, 0.012028f, 0.031972f, 0.019668f, 0.0079928f diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index 7ffcb441e..04730ad97 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -85,11 +85,15 @@ extern const int16_t channelIndex_CICP19[11]; /* These are equalization values for spread and surround coherent sounds, approximating the spectrum * for such sounds at anechoic multichannel listening. */ extern const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; +extern const Word16 surCohEne_fx[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; extern const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; +extern const Word16 spreadCohEne05_fx[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; extern const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; +extern const Word16 spreadCohEne1_fx[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; /* Values for low-bit-rate equalization */ extern const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS]; +extern const Word32 lowBitRateBinauralEQ_fx[LOW_BIT_RATE_BINAURAL_EQ_BINS]; /* Diffuse field binaural coherence directional adjustment values */ extern const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS]; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2684fe020..3ad19a9a9 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -848,6 +848,8 @@ typedef struct ivas_dirac_dec_binaural_data_structure float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; #ifdef IVAS_FLOAT_FIXED + Word32 earlyPartEneCorrection_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 q_earlyPartEneCorrection; Word16 processMtxRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; Word16 processMtxIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; Word16 processMtxDecRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; @@ -856,6 +858,38 @@ typedef struct ivas_dirac_dec_binaural_data_structure Word16 processMtxImPrev_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; Word16 processMtxDecRePrev_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word16 processMtxDecImPrev_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + + Word32 ChEnePrev_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossRePrev_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossImPrev_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChEne_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossRe_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossIm_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossReOut_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossImOut_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChEneOut_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 ChEneOutPrev_fx[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 frameMeanDiffuseness_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossReOutPrev_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 ChCrossImOutPrev_fx[CLDFB_NO_CHANNELS_MAX]; + + Word16 ChEnePrev_e[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossRePrev_e[CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossImPrev_e[CLDFB_NO_CHANNELS_MAX]; + Word16 ChEne_e[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossRe_e[CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossIm_e[CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossReOut_e[CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossImOut_e[CLDFB_NO_CHANNELS_MAX]; + Word16 ChEneOut_e[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word16 ChEneOutPrev_e[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossReOutPrev_e[CLDFB_NO_CHANNELS_MAX]; + Word16 ChCrossImOutPrev_e[CLDFB_NO_CHANNELS_MAX]; + + Word32 diffuseFieldCoherence_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 diffuseFieldCoherenceX_fx[BINAURAL_COHERENCE_DIFFERENCE_BINS]; + Word32 diffuseFieldCoherenceY_fx[BINAURAL_COHERENCE_DIFFERENCE_BINS]; + Word32 diffuseFieldCoherenceZ_fx[BINAURAL_COHERENCE_DIFFERENCE_BINS]; #endif uint16_t useTdDecorr; ivas_td_decorr_state_t *hTdDecorr; @@ -1785,16 +1819,17 @@ typedef struct Word32 elev_prev_fx; Word16 Gain_fx; // Q14 Word16 prevGain_fx; // Q14 -#endif // IVAS_FLOAT_FIXED +#else float mem_itd[ITD_MEM_LEN]; + float azim_prev; float hrf_left_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; - float azim_prev; float elev_prev; float mem_hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; float Gain; float prevGain; +#endif // IVAS_FLOAT_FIXED } TDREND_SRC_t; @@ -1809,9 +1844,10 @@ typedef struct ivas_binaural_td_rendering_struct TDREND_SRC_t *Sources[MAX_NUM_TDREND_CHANNELS]; #ifdef IVAS_FLOAT_FIXED Word16 Gain_fx; /* Q14 */ +#else + float Gain; /* Mixer gain */ #endif // IVAS_FLOAT_FIXED - float Gain; /* Mixer gain */ TDREND_MIX_Listener_t *Listener_p; /* The virtual listener */ TDREND_HRFILT_FiltSet_t *HrFiltSet_p; /* HR filter set */ @@ -2197,7 +2233,33 @@ typedef struct ivas_mcmasa_ana_data_structure HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MCMASA_MAX_ANA_CHANS]; /* DirAC parameter estimation */ +#ifdef IVAS_FLOAT_FIXED + Word32 **direction_vector_m_fx[DIRAC_NUM_DIMS]; /* Average direction vector */ + Word16 **direction_vector_e[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Average direction vector */ +#endif // IVAS_FLOAT_FIXED float **direction_vector_m[DIRAC_NUM_DIMS]; /* Average direction vector */ +#ifdef IVAS_FLOAT_FIXED + Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; + Word16 buffer_intensity_real_q[DIRAC_NO_COL_AVG_DIFF]; + Word32 *buffer_intensity_real_vert_fx[DIRAC_NO_COL_AVG_DIFF]; + Word16 buffer_intensity_real_vert_q[DIRAC_NO_COL_AVG_DIFF]; + Word32 buffer_energy_fx[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; + Word16 buffer_energy_q[DIRAC_NO_COL_AVG_DIFF]; + Word32 chnlToFoaMtx_fx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; + Word32 chnlToFoaEvenMtx_fx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; + Word32 ls_azimuth_fx[MCMASA_MAX_ANA_CHANS]; + Word32 prevMultiChEne_fx; + Word32 prevDownmixEne_fx; + Word32 prevEQ_fx; + Word16 interpolator_fx[L_FRAME48k]; + Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 chnlToFoaMtx_e; + Word16 prevMultiChEne_e; + Word16 prevDownmixEne_e; + Word16 prevEQ_e; + Word16 interpolator_e; +#endif // IVAS_FLOAT_FIXED int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; int16_t block_grouping[5]; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 83fd23f69..d4bd50556 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3858,6 +3858,24 @@ static ivas_error initMcMasaRendering( { return error; } +#ifdef IVAS_FLOAT_FIXED +#if 1 /*Fixed to float conversion for ivas_mcmasa_ana_open (to be removed later)*/ + MCMASA_ANA_HANDLE hMcMasa = inputMc->hMcMasa; + Word16 i, j; + fixedToFloat_arrL( hMcMasa->ls_azimuth_fx, hMcMasa->ls_azimuth, Q22, MCMASA_MAX_ANA_CHANS); + FOR ( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) + { + FOR ( j = 0; j < FOA_CHANNELS; j++ ) + { + hMcMasa->chnlToFoaMtx[j][i] = fixedToFloat( hMcMasa->chnlToFoaMtx_fx[j][i], Q31 ); + } + } + FOR( i = 0; i < (inSampleRate/FRAMES_PER_SEC); i++ ) + { + hMcMasa->interpolator[i] = fixedToFloat( hMcMasa->interpolator_fx[i], Q15 ); + } +#endif +#endif // IVAS_FLOAT_FIXED return IVAS_ERR_OK; } @@ -9751,7 +9769,71 @@ static void renderMcToMasa( push_wmops( "renderMcToMasa" ); copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); +#ifdef IVAS_FLOAT_FIXED + Word32 tmpRendBuffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer_fx ); +#if 1 /*TODO: To be removed later: Float to fixed */ + /*From here: Cleanup changes for ivas_mcmasa_param_est_ana_fx*/ + MCMASA_ANA_HANDLE hMcMasa = mcInput->hMcMasa; + Word16 i, nchan_inp = mcInput->base.inputBuffer.config.numChannels; + Word16 q_data = *( outAudio.pq_fact ); + FOR ( i = 0; i < nchan_inp - 1; i++ ) + { + floatToFixed_arrL( hMcMasa->cldfbAnaEnc[i]->cldfb_state, hMcMasa->cldfbAnaEnc[i]->cldfb_state_fx, q_data, hMcMasa->cldfbAnaEnc[i]->p_filter_length - hMcMasa->cldfbAnaEnc[i]->no_channels ); + } + /*From here: Cleanup changes for ivas_mcmasa_dmx_fx*/ + f2me( hMcMasa->prevMultiChEne, &hMcMasa->prevMultiChEne_fx, &hMcMasa->prevMultiChEne_e ); + f2me( hMcMasa->prevDownmixEne, &hMcMasa->prevDownmixEne_fx, &hMcMasa->prevDownmixEne_e ); + f2me( hMcMasa->prevEQ, &hMcMasa->prevEQ_fx, &hMcMasa->prevEQ_e ); + floatToFixed_arr( hMcMasa->interpolator, hMcMasa->interpolator_fx, 15, L_FRAME48k ); +#endif + ivas_mcmasa_ana_fx( mcInput->hMcMasa, tmpRendBuffer_fx, *( outAudio.pq_fact ), mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); +#if 1 /*TODO: To be removed later(fixed to float)*/ + /*From here : Cleanup changes for ivas_mcmasa_param_est_ana_fx*/ + FOR ( i = 0; i < nchan_inp - 1; i++ ) + { + fixedToFloat_arrL( hMcMasa->cldfbAnaEnc[i]->cldfb_state_fx, hMcMasa->cldfbAnaEnc[i]->cldfb_state, q_data, hMcMasa->cldfbAnaEnc[i]->p_filter_length - hMcMasa->cldfbAnaEnc[i]->no_channels ); + } + FOR ( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + FOR ( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + { + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + hMcMasa->direction_vector_m[i][j][k] = me2f( hMcMasa->direction_vector_m_fx[i][j][k], hMcMasa->direction_vector_e[i][j][k] ); + } + hMcMasa->energy[j][k] = me2f( hMcMasa->energy_fx[j][k], hMcMasa->energy_e[j][k] ); + } + } + FOR ( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) + { + FOR ( int j = 0; j < DIRAC_NUM_DIMS; j++ ) + { + FOR ( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + hMcMasa->buffer_intensity_real[j][i][k] = fixedToFloat( hMcMasa->buffer_intensity_real_fx[j][i][k], hMcMasa->buffer_intensity_real_q[i] ); + } + FOR ( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + { + hMcMasa->buffer_intensity_real_vert[i][j] = fixedToFloat( hMcMasa->buffer_intensity_real_vert_fx[i][j], hMcMasa->buffer_intensity_real_vert_q[i] ); + } + FOR ( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + { + hMcMasa->buffer_energy[i * j + j] = fixedToFloat( hMcMasa->buffer_energy_fx[i * j + j], hMcMasa->buffer_energy_q[i] ); + } + } + /*From here : cleanup changes for ivas_mcmasa_dmx_fx*/ + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + fixedToFloat_arrL( tmpRendBuffer_fx[i], tmpRendBuffer[i], q_data, L_FRAME48k ); + } + + hMcMasa->prevMultiChEne = me2f( hMcMasa->prevMultiChEne_fx, hMcMasa->prevMultiChEne_e ); + hMcMasa->prevDownmixEne = me2f( hMcMasa->prevDownmixEne_fx, hMcMasa->prevDownmixEne_e ); + hMcMasa->prevEQ = me2f( hMcMasa->prevEQ_fx, hMcMasa->prevEQ_e ); +#endif +#else ivas_mcmasa_ana( mcInput->hMcMasa, tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); +#endif // IVAS_FLOAT_FIXED accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); -- GitLab From fa151856ce9001b9ba74c82a8cb237cab9daa98b Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 9 May 2024 14:48:25 -0400 Subject: [PATCH 026/101] Propose fix for the last problem of 736, related to icBWE --- lib_com/options.h | 2 ++ lib_dec/ivas_stereo_icbwe_dec.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 677bbe613..99aea9efd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -131,6 +131,8 @@ #define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues #define FIX_SATURATION_725 // Propose fix for saturation in AVQ #define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ +#define FIX_736_BWE_SECT_C // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 150df7e1d..ac5e223af 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -916,7 +916,11 @@ void stereo_icBWE_dec_fx( L_nlExc16k = L_deposit_l( hStereoICBWE->nlExc16k_fx[k] ); // prev_q_bwe_exc - 16 L_mixExc16k = L_deposit_l( hStereoICBWE->mixExc16k_fx[k] ); // Q_exc L_nlExc16k = L_shl( L_nlExc16k, 18 - ( st->prev_Q_bwe_exc - 16 ) ); // Q18 +#ifndef FIX_736_BWE_SECT_C L_mixExc16k = L_shl( L_mixExc16k, 18 - st->Q_exc ); // Q18 +#else + L_mixExc16k = L_shl( L_mixExc16k, 18 - ( st->prev_Q_bwe_exc - 25 ) ); // Q18 +#endif excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q18 move32(); k++; @@ -2028,9 +2032,15 @@ void stereo_icBWE_decproc_fx( win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ gain0_fx = Mpy_32_32( win_in_fx, hCPE->hStereoDft->td_gain_fx[0] ); /* Q --> q_td_gain[0] */ +#ifdef FIX_736_BWE_SECT_C + gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ + gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ + gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ +#else gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ +#endif tmp_fx = L_add_sat( gain0_fx, gain1_fx ); /* Q --> q_output */ output[0][i] = L_add_sat( output[0][i], tmp_fx ); @@ -2040,7 +2050,11 @@ void stereo_icBWE_decproc_fx( } FOR( i = dftOvlLen; i < output_frame; i++ ) { +#ifdef FIX_736_BWE_SECT_C + tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ +#else tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ +#endif output[0][i] = L_add_sat( output[0][i], tmp_fx ); move32(); output[1][i] = L_sub_sat( output[1][i], tmp_fx ); -- GitLab From c25ddaffbace94670c3f950c700d73397a9862cc Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 10 May 2024 10:46:03 -0400 Subject: [PATCH 027/101] fix missing subfr for low rate acelp decoder, issue 734 --- lib_com/options.h | 2 ++ lib_dec/ivas_td_low_rate_dec.c | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 677bbe613..f4c2ab85a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -131,6 +131,8 @@ #define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues #define FIX_SATURATION_725 // Propose fix for saturation in AVQ #define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ + +#define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index 4b8ed6467..b0e9ce6b9 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -610,6 +610,12 @@ void decod_gen_2sbfr_ivas_fx( /*----------------------------------------------------------------------* * Find the total excitation *----------------------------------------------------------------------*/ +#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP /* Don't need the if/else as here L_frame==L_FRAME all the time */ + + Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[i_subfr], ( bwe_exc != NULL ) ? &bwe_exc[i_subfr * HIBND_ACB_L_FAC] : NULL, st->hGSCDec->last_exc_dct_in_fx, + 2 * L_SUBFR, 2 * L_SUBFR * HIBND_ACB_L_FAC, gain_code, &( st->Q_exc ), st->Q_subfr, exc2, i_subfr, st->coder_type ); + +#else IF(EQ_16(st->L_frame, L_FRAME)) { @@ -621,26 +627,34 @@ void decod_gen_2sbfr_ivas_fx( Rescale_exc(st->hMusicPF->dct_post_old_exc_fx, &exc[i_subfr], (bwe_exc != NULL) ? &bwe_exc[i_subfr * 2] : NULL, st->hGSCDec->last_exc_dct_in_fx, L_SUBFR, L_SUBFR * 2, gain_code, &(st->Q_exc), st->Q_subfr, exc2, i_subfr, st->coder_type); } - +#endif Word16 gain_code16 = round_fx(L_shl(gain_code, st->Q_exc)); /*Q_exc*/ - +#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP + Acelp_dec_total_exc( exc, exc2, gain_code16, gain_pit, i_subfr, code, 2 * L_SUBFR ); +#else Acelp_dec_total_exc(exc, exc2, gain_code16, gain_pit, i_subfr, code, L_SUBFR); - +#endif /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ - +#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP + prep_tbe_exc_ivas_fx( L_frame, 2 * L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); +#else // prep_tbe_exc(L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, T0, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag); // prep_tbe_exc_fx(L_frame, /*L_SUBFR,*/ i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, Q_exc, T0, T0_frac, GENERIC, st->core_brate/*, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag*/); prep_tbe_exc_ivas_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); - +#endif voice_factors[i_subfr / L_SUBFR + 1] = voice_factors[i_subfr / L_SUBFR]; /*----------------------------------------------------------------* * Excitation enhancements (update of total excitation signal) * called twice because adapting it to double the subfr length would need lot of modifications *----------------------------------------------------------------*/ +#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP + enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code, exc2 + i_subfr, gain_pit, &st->dm_fx, st->Q_exc ); + enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code + L_SUBFR, exc2 + i_subfr + L_SUBFR, gain_pit, &st->dm_fx, st->Q_exc ); +#else // enhancer(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code, exc2 + i_subfr, gain_pit, st->dispMem); // enhancer_fx(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code, exc2 + i_subfr, gain_pit, st->dispMem); enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code, exc2, gain_pit, &st->dm_fx, st->Q_exc); @@ -648,7 +662,7 @@ void decod_gen_2sbfr_ivas_fx( // enhancer(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code + L_SUBFR, exc2 + i_subfr + L_SUBFR, gain_pit, st->dispMem); // enhancer_fx(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code + L_SUBFR, exc2 + i_subfr + L_SUBFR, gain_pit, st->dispMem); enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code + L_SUBFR, exc2 + L_SUBFR, gain_pit, &st->dm_fx, st->Q_exc); - +#endif p_Aq += 2 * ( M + 1 ); pt_pitch++; -- GitLab From 57ed999b236faa24fb9ad06c14989da11b505fe8 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 10 May 2024 11:49:56 -0400 Subject: [PATCH 028/101] small fix to previous commit to correct a crash --- lib_dec/ivas_td_low_rate_dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index b0e9ce6b9..2282cc30f 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -650,10 +650,10 @@ void decod_gen_2sbfr_ivas_fx( * Excitation enhancements (update of total excitation signal) * called twice because adapting it to double the subfr length would need lot of modifications *----------------------------------------------------------------*/ -#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP - enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code, exc2 + i_subfr, gain_pit, &st->dm_fx, st->Q_exc ); +#if 1//def FIX_734_MISSING_SUBFR_LOW_RATE_ACELP + enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code, exc2 , gain_pit, &st->dm_fx, st->Q_exc ); - enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code + L_SUBFR, exc2 + i_subfr + L_SUBFR, gain_pit, &st->dm_fx, st->Q_exc ); + enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code + L_SUBFR, exc2 + L_SUBFR, gain_pit, &st->dm_fx, st->Q_exc ); #else // enhancer(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code, exc2 + i_subfr, gain_pit, st->dispMem); // enhancer_fx(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code, exc2 + i_subfr, gain_pit, st->dispMem); -- GitLab From 01c17c8c390cfdace90d8da90a9e3a41c867875b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 11 May 2024 10:46:53 +0530 Subject: [PATCH 029/101] Renderer crash fix, some float code cleanup --- lib_com/ivas_cnst.h | 2 + lib_com/ivas_ism_com.c | 6 +- lib_com/ivas_prot.h | 23 +- lib_com/ivas_prot_fx.h | 7 + lib_dec/ivas_agc_dec_fx.c | 2 +- lib_dec/ivas_binRenderer_internal.c | 625 +- lib_dec/ivas_dirac_dec.c | 4 +- lib_dec/ivas_init_dec.c | 2 - lib_dec/ivas_ism_metadata_dec.c | 576 +- lib_dec/ivas_jbm_dec.c | 9 +- lib_dec/ivas_masa_dec.c | 1414 +- lib_dec/ivas_mc_param_dec.c | 385 +- lib_dec/ivas_mct_dec.c | 4 - lib_dec/ivas_stat_dec.h | 7 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 12 +- lib_rend/ivas_hrtf.c | 6 +- lib_rend/ivas_prot_rend.h | 12 + lib_rend/ivas_reverb.c | 56 +- lib_rend/ivas_rom_binauralRenderer.c | 46893 +++++++++++++++++ lib_rend/ivas_rom_binauralRenderer.h | 27 + lib_rend/ivas_sba_rendering.c | 10 +- lib_rend/ivas_stat_rend.h | 35 + lib_util/hrtf_file_reader.c | 296 +- 23 files changed, 49128 insertions(+), 1285 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index dae981352..acbce6db6 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -352,7 +352,9 @@ typedef enum #define ISM_RADIUS_NBITS 6 #define ISM_RADIUS_MIN 0.0f +#define ISM_RADIUS_MIN_Q9 0 #define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ +#define ISM_RADIUS_DELTA_Q8 64 #define ISM_EXTENDED_METADATA_BRATE IVAS_64k #define ISM_METADATA_IS_NDP_BITS 1 #define ISM_EXTENDED_METADATA_BITS 1 diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 873e7c609..7f4db1398 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -1043,14 +1043,18 @@ ISM_MODE ivas_ism_mode_select( ) { ISM_MODE ism_mode = ISM_MODE_NONE; + move32(); - IF ( GT_16( nchan_inp, 2 ) && LE_32( ivas_total_brate, ACELP_32k ) ) + test(); + IF( GT_16( nchan_inp, 2 ) && LE_32( ivas_total_brate, ACELP_32k ) ) { ism_mode = ISM_MODE_PARAM; + move32(); } ELSE { ism_mode = ISM_MODE_DISC; + move32(); } return ism_mode; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b1a94cf24..c801a195b 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4668,12 +4668,14 @@ void ivas_param_mc_dec_close( ); #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void ivas_param_mc_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Decoder_State *st, /* i/o: decoder state structure */ PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder ParamMC handle */ int16_t *nb_bits /* o : number of bits written */ ); +#endif void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -6445,7 +6447,6 @@ void update_bits_next_block( const int16_t max_i, /* i : max number of subands */ const int16_t max_k /* i : max number of subframe */ ); -#endif void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -6453,6 +6454,7 @@ void ivas_masa_prerender( const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_remapped /* i : number of transports used in core */ ); +#endif void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ @@ -6490,11 +6492,24 @@ void ivas_binRenderer_close( void ivas_binaural_hrtf_close( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ ); - +#ifdef IVAS_FLOAT_FIXED +void ivas_init_binaural_hrtf_fx( + HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ +); +#else void ivas_init_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ ); - +#endif +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_allocate_binaural_hrtf_fx( + HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ + const AUDIO_CONFIG input_config, /* i : input audio configuration */ + const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const Word16 allocate_init_flag /* i : Memory allocation flag */ +); +#else ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ const AUDIO_CONFIG input_config, /* i : input audio configuration */ @@ -6502,7 +6517,7 @@ ivas_error ivas_allocate_binaural_hrtf( const RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t allocate_init_flag /* i : Memory allocation flag */ ); - +#endif void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index c32713fb4..4bbd60e31 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2164,4 +2164,11 @@ ivas_error ivas_spar_dec_open_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); + +void ivas_param_mc_dec_read_BS_fx( + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder ParamMC handle */ + Word16 *nb_bits /* o : number of bits written */ +); #endif diff --git a/lib_dec/ivas_agc_dec_fx.c b/lib_dec/ivas_agc_dec_fx.c index eea0759b0..6043e082c 100644 --- a/lib_dec/ivas_agc_dec_fx.c +++ b/lib_dec/ivas_agc_dec_fx.c @@ -155,7 +155,7 @@ void ivas_spar_agc_dec_close_fx( hAgc = *hAgcDec; free( hAgc->agc_com.winFunc_fx ); - hAgc->agc_com.winFunc = NULL; + hAgc->agc_com.winFunc_fx = NULL; free( hAgc->gain_state ); hAgc->gain_state = NULL; diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 085e0fba2..11edbc665 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -445,29 +445,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } - - FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) - { - IF( ( hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - } } @@ -612,7 +589,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } #else - Word32 idx; IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { /* set the memories to zero */ @@ -621,13 +597,10 @@ static ivas_error ivas_binRenderer_convModuleOpen( set_s( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTapsArray[bandIdx] ); IF( isLoudspeaker ) { - FOR( idx = 0; idx < hBinRenConvModule->numTapsArray[bandIdx]; idx++ ) - { - hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftBRIRReal[bandIdx][tmp][idx] ); - hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftBRIRImag[bandIdx][tmp][idx] ); - hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightBRIRReal[bandIdx][tmp][idx] ); - hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightBRIRImag[bandIdx][tmp][idx] ); - } + hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftBRIRReal_fx[bandIdx][tmp]; + hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftBRIRImag_fx[bandIdx][tmp]; + hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightBRIRReal_fx[bandIdx][tmp]; + hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightBRIRImag_fx[bandIdx][tmp]; } } ELSE @@ -638,48 +611,36 @@ static ivas_error ivas_binRenderer_convModuleOpen( set_s( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTaps ); IF( isLoudspeaker ) { - FOR( idx = 0; idx < hBinRenConvModule->numTapsArray[bandIdx]; idx++ ) - { - hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRReal[bandIdx][tmp][idx] ); - hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRImag[bandIdx][tmp][idx] ); - hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRReal[bandIdx][tmp][idx] ); - hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRImag[bandIdx][tmp][idx] ); - } + hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_fx[bandIdx][tmp]; + hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_fx[bandIdx][tmp]; + hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_fx[bandIdx][tmp]; + hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_fx[bandIdx][tmp]; } ELSE { IF( input_config == IVAS_AUDIO_CONFIG_HOA3 ) { /* HOA3 filter coefficients */ - FOR( idx = 0; idx < hBinRenConvModule->numTapsArray[bandIdx]; idx++ ) - { - hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRReal_HOA3[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRImag_HOA3[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRReal_HOA3[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRImag_HOA3[bandIdx][chIdx][idx] ); - } + hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA3_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA3_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA3_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA3_fx[bandIdx][chIdx]; } ELSE IF( input_config == IVAS_AUDIO_CONFIG_HOA2 ) { /* HOA2 filter coefficients */ - FOR( idx = 0; idx < hBinRenConvModule->numTapsArray[bandIdx]; idx++ ) - { - hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRReal_HOA2[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRImag_HOA2[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRReal_HOA2[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRImag_HOA2[bandIdx][chIdx][idx] ); - } + hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA2_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA2_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA2_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA2_fx[bandIdx][chIdx]; } ELSE IF( input_config == IVAS_AUDIO_CONFIG_FOA ) { /* FOA filter coefficients */ - FOR( idx = 0; idx < hBinRenConvModule->numTapsArray[bandIdx]; idx++ ) - { - hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRReal_FOA[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->leftHRIRImag_FOA[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRReal_FOA[bandIdx][chIdx][idx] ); - hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx][idx] = (Word32) float_to_fixQ29( hHrtf->rightHRIRImag_FOA[bandIdx][chIdx][idx] ); - } + hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_FOA_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_FOA_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_FOA_fx[bandIdx][chIdx]; + hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_FOA_fx[bandIdx][chIdx]; } ELSE { @@ -958,7 +919,74 @@ static ivas_error ivas_binRenderer_convModuleOpen( * * initialize memory for HrtfFastConv structure elements *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_init_binaural_hrtf_fx( + HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ +) +{ + Word16 i; + + HrtfFastConv->leftHRIRReal_HOA3 = NULL; + HrtfFastConv->leftHRIRImag_HOA3 = NULL; + HrtfFastConv->rightHRIRReal_HOA3 = NULL; + HrtfFastConv->rightHRIRImag_HOA3 = NULL; + HrtfFastConv->leftHRIRReal_HOA3_fx = NULL; + HrtfFastConv->leftHRIRImag_HOA3_fx = NULL; + HrtfFastConv->rightHRIRReal_HOA3_fx = NULL; + HrtfFastConv->rightHRIRImag_HOA3_fx = NULL; + HrtfFastConv->FASTCONV_HOA3_latency_s = 0x00; + + HrtfFastConv->leftHRIRReal = NULL; + HrtfFastConv->leftHRIRImag = NULL; + HrtfFastConv->rightHRIRReal = NULL; + HrtfFastConv->rightHRIRImag = NULL; + HrtfFastConv->leftHRIRReal_fx = NULL; + HrtfFastConv->leftHRIRImag_fx = NULL; + HrtfFastConv->rightHRIRReal_fx = NULL; + HrtfFastConv->rightHRIRImag_fx = NULL; + HrtfFastConv->FASTCONV_HRIR_latency_s = 0x00; + + HrtfFastConv->leftBRIRReal = NULL; + HrtfFastConv->leftBRIRImag = NULL; + HrtfFastConv->rightBRIRReal = NULL; + HrtfFastConv->rightBRIRImag = NULL; + HrtfFastConv->leftBRIRReal_fx = NULL; + HrtfFastConv->leftBRIRImag_fx = NULL; + HrtfFastConv->rightBRIRReal_fx = NULL; + HrtfFastConv->rightBRIRImag_fx = NULL; + HrtfFastConv->FASTCONV_BRIR_latency_s = 0x00; + HrtfFastConv->leftHRIRReal_HOA2 = NULL; + HrtfFastConv->leftHRIRImag_HOA2 = NULL; + HrtfFastConv->rightHRIRReal_HOA2 = NULL; + HrtfFastConv->rightHRIRImag_HOA2 = NULL; + HrtfFastConv->leftHRIRReal_HOA2_fx = NULL; + HrtfFastConv->leftHRIRImag_HOA2_fx = NULL; + HrtfFastConv->rightHRIRReal_HOA2_fx = NULL; + HrtfFastConv->rightHRIRImag_HOA2_fx = NULL; + HrtfFastConv->FASTCONV_HOA2_latency_s = 0x00; + + HrtfFastConv->leftHRIRReal_FOA = NULL; + HrtfFastConv->leftHRIRImag_FOA = NULL; + HrtfFastConv->rightHRIRReal_FOA = NULL; + HrtfFastConv->rightHRIRImag_FOA = NULL; + HrtfFastConv->leftHRIRReal_FOA_fx = NULL; + HrtfFastConv->leftHRIRImag_FOA_fx = NULL; + HrtfFastConv->rightHRIRReal_FOA_fx = NULL; + HrtfFastConv->rightHRIRImag_FOA_fx = NULL; + HrtfFastConv->FASTCONV_FOA_latency_s = 0x00; + + HrtfFastConv->allocate_init_flag = 0x00; + + FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + HrtfFastConv->fastconvReverberationTimes[i] = 0x00; + HrtfFastConv->fastconvReverberationEneCorrections[i] = 0x00; + } + + return; +} +#else void ivas_init_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ ) @@ -999,38 +1027,38 @@ void ivas_init_binaural_hrtf( FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { - HrtfFastConv->fastconvReverberationEneCorrections[i] = 0x00; + HrtfFastConv->fastconvReverberationTimes[i] = 0x00; HrtfFastConv->fastconvReverberationEneCorrections[i] = 0x00; } return; } - +#endif /*-------------------------------------------------------------------------* * ivas_alloc_pppMem() * * Allocate memory for tripple pointer elements *-------------------------------------------------------------------------*/ - -static ivas_error ivas_alloc_pppMem( - float ****pppMem, +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_alloc_pppMem_fx( + Word32 ****pppMem, const Word16 dim1, const Word16 dim2, const Word16 dim3, const Word16 allocate_init_flag ) { Word16 i, j; - float ***localMem = NULL; + Word32 ***localMem = NULL; - IF( ( localMem = (float ***) malloc( dim1 * sizeof( float ** ) ) ) == NULL ) + IF( ( localMem = (Word32 ***) malloc( dim1 * sizeof(Word32 ** ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); } FOR( i = 0; i < dim1; i++ ) { - IF( ( localMem[i] = (float **) malloc( dim2 * sizeof( float * ) ) ) == NULL ) + IF( ( localMem[i] = (Word32 **) malloc( dim2 * sizeof(Word32 * ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); } @@ -1038,7 +1066,45 @@ static ivas_error ivas_alloc_pppMem( { FOR( j = 0; j < dim2; j++ ) { - IF( ( localMem[i][j] = (float *) malloc( dim3 * sizeof( float ) ) ) == NULL ) + IF( ( localMem[i][j] = (Word32 *) malloc( dim3 * sizeof(Word32) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); + } + } + } + } + + *pppMem = localMem; + + return IVAS_ERR_OK; +} +#endif +static ivas_error ivas_alloc_pppMem( + float ****pppMem, + const int16_t dim1, + const int16_t dim2, + const int16_t dim3, + const int16_t allocate_init_flag ) +{ + int16_t i, j; + float ***localMem = NULL; + + if ( ( localMem = (float ***) malloc( dim1 * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); + } + + for ( i = 0; i < dim1; i++ ) + { + if ( ( localMem[i] = (float **) malloc( dim2 * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); + } + if ( allocate_init_flag == 0 ) + { + for ( j = 0; j < dim2; j++ ) + { + if ( ( localMem[i][j] = (float *) malloc( dim3 * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" ); } @@ -1057,8 +1123,8 @@ static ivas_error ivas_alloc_pppMem( * * Allocate memory for HrtfFastConv structure elements *-------------------------------------------------------------------------*/ - -ivas_error ivas_allocate_binaural_hrtf( +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_allocate_binaural_hrtf_fx( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ const AUDIO_CONFIG input_config, /* i : input audio configuration */ const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ @@ -1068,6 +1134,29 @@ ivas_error ivas_allocate_binaural_hrtf( { IF( input_config == IVAS_AUDIO_CONFIG_HOA3 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { + IF( ( HrtfFastConv->leftHRIRReal_HOA3_fx != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA3_fx != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA3_fx != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA3_fx != NULL ) ) + { + return IVAS_ERR_OK; + } + ELSE + { + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftHRIRReal_HOA3_fx, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftHRIRImag_HOA3_fx, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightHRIRReal_HOA3_fx, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightHRIRImag_HOA3_fx, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3"); + } + } IF( ( HrtfFastConv->leftHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA3 != NULL ) ) { return IVAS_ERR_OK; @@ -1095,6 +1184,29 @@ ivas_error ivas_allocate_binaural_hrtf( IF( input_config == IVAS_AUDIO_CONFIG_HOA2 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { + IF( ( HrtfFastConv->leftHRIRReal_HOA2_fx != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2_fx != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2_fx != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2_fx != NULL ) ) + { + return IVAS_ERR_OK; + } + ELSE + { + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftHRIRReal_HOA2_fx, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftHRIRImag_HOA2_fx, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightHRIRReal_HOA2_fx, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightHRIRImag_HOA2_fx, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2"); + } + } IF( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) { return IVAS_ERR_OK; @@ -1122,6 +1234,29 @@ ivas_error ivas_allocate_binaural_hrtf( IF( input_config == IVAS_AUDIO_CONFIG_FOA || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { + IF( ( HrtfFastConv->leftHRIRReal_FOA_fx != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA_fx != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA_fx != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA_fx != NULL ) ) + { + return IVAS_ERR_OK; + } + ELSE + { + IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->leftHRIRReal_FOA_fx, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); + } + IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->leftHRIRImag_FOA_fx, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); + } + IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->rightHRIRReal_FOA_fx, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); + } + IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->rightHRIRImag_FOA_fx, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + } + } IF( ( HrtfFastConv->leftHRIRReal_FOA != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA != NULL ) ) { return IVAS_ERR_OK; @@ -1149,13 +1284,35 @@ ivas_error ivas_allocate_binaural_hrtf( IF( renderer_type == RENDERER_BINAURAL_FASTCONV || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { + IF( ( HrtfFastConv->leftHRIRReal_fx != NULL ) && ( HrtfFastConv->leftHRIRImag_fx != NULL ) && ( HrtfFastConv->rightHRIRReal_fx != NULL ) && ( HrtfFastConv->rightHRIRImag_fx != NULL ) ) + { + return IVAS_ERR_OK; + } + ELSE + { + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftHRIRReal_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftHRIRImag_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightHRIRReal_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightHRIRImag_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag"); + } + } IF( ( HrtfFastConv->leftHRIRReal != NULL ) && ( HrtfFastConv->leftHRIRImag != NULL ) && ( HrtfFastConv->rightHRIRReal != NULL ) && ( HrtfFastConv->rightHRIRImag != NULL ) ) { return IVAS_ERR_OK; } ELSE { - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); @@ -1177,6 +1334,29 @@ ivas_error ivas_allocate_binaural_hrtf( IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { + IF( ( HrtfFastConv->leftBRIRReal_fx != NULL ) && ( HrtfFastConv->leftBRIRImag_fx != NULL ) && ( HrtfFastConv->rightBRIRReal_fx != NULL ) && ( HrtfFastConv->rightBRIRImag_fx != NULL ) ) + { + return IVAS_ERR_OK; + } + ELSE + { + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftBRIRReal_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->leftBRIRImag_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightBRIRReal_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal"); + } + IF(IVAS_ERR_OK != ivas_alloc_pppMem_fx(&HrtfFastConv->rightBRIRImag_fx, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag)) + { + return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag"); + } + } IF( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) { return IVAS_ERR_OK; @@ -1204,7 +1384,154 @@ ivas_error ivas_allocate_binaural_hrtf( return IVAS_ERR_OK; } +#else +ivas_error ivas_allocate_binaural_hrtf( + HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ + const AUDIO_CONFIG input_config, /* i : input audio configuration */ + const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const int16_t allocate_init_flag /* i : Memory allocation flag */ +) +{ + if ( input_config == IVAS_AUDIO_CONFIG_HOA3 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA3 != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); + } + } + } + if ( input_config == IVAS_AUDIO_CONFIG_HOA2 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) + { + if ( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); + } + } + } + + if ( input_config == IVAS_AUDIO_CONFIG_FOA || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) + { + if ( ( HrtfFastConv->leftHRIRReal_FOA != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); + } + } + } + + if ( renderer_type == RENDERER_BINAURAL_FASTCONV || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + { + if ( ( HrtfFastConv->leftHRIRReal != NULL ) && ( HrtfFastConv->leftHRIRImag != NULL ) && ( HrtfFastConv->rightHRIRReal != NULL ) && ( HrtfFastConv->rightHRIRImag != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); + } + } + } + + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + { + if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) + { + return IVAS_ERR_OK; + } + else + { + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); + } + if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); + } + } + } + + return IVAS_ERR_OK; +} +#endif /*-------------------------------------------------------------------------* * ivas_binaural_HRTF_open() @@ -1212,7 +1539,7 @@ ivas_error ivas_allocate_binaural_hrtf( * *-------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -static ivas_error ivas_binaural_hrtf_open( +static ivas_error ivas_binaural_hrtf_open_fx( HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */ const AUDIO_CONFIG input_config, /* i : output configuration */ const RENDERER_TYPE renderer_type /* i : renderer type */ @@ -1236,7 +1563,7 @@ static ivas_error ivas_binaural_hrtf_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for FastConv HRTF tables" ); } - ivas_init_binaural_hrtf( HrtfFastConv ); + ivas_init_binaural_hrtf_fx( HrtfFastConv ); IF( input_config == IVAS_AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV ) { @@ -1261,7 +1588,7 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->allocate_init_flag = 1; - IF( ( error = ivas_allocate_binaural_hrtf( HrtfFastConv, input_config, BINAURAL_INPUT_AUDIO_CONFIG_INVALID, renderer_type, HrtfFastConv->allocate_init_flag ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_allocate_binaural_hrtf_fx( HrtfFastConv, input_config, BINAURAL_INPUT_AUDIO_CONFIG_INVALID, renderer_type, HrtfFastConv->allocate_init_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -1271,6 +1598,11 @@ static ivas_error ivas_binaural_hrtf_open( { FOR( j = 0; j < HRTF_LS_CHANNELS; j++ ) { + HrtfFastConv->leftHRIRReal_fx[i][j] = leftHRIRReal_fx[i][j]; + HrtfFastConv->leftHRIRImag_fx[i][j] = leftHRIRImag_fx[i][j]; + HrtfFastConv->rightHRIRReal_fx[i][j] = rightHRIRReal_fx[i][j]; + HrtfFastConv->rightHRIRImag_fx[i][j] = rightHRIRImag_fx[i][j]; + HrtfFastConv->leftHRIRReal[i][j] = leftHRIRReal[i][j]; HrtfFastConv->leftHRIRImag[i][j] = leftHRIRImag[i][j]; HrtfFastConv->rightHRIRReal[i][j] = rightHRIRReal[i][j]; @@ -1281,6 +1613,11 @@ static ivas_error ivas_binaural_hrtf_open( { FOR( j = 0; j < HRTF_LS_CHANNELS; j++ ) { + HrtfFastConv->leftBRIRReal_fx[i][j] = leftBRIRReal_fx[i][j]; + HrtfFastConv->leftBRIRImag_fx[i][j] = leftBRIRImag_fx[i][j]; + HrtfFastConv->rightBRIRReal_fx[i][j] = rightBRIRReal_fx[i][j]; + HrtfFastConv->rightBRIRImag_fx[i][j] = rightBRIRImag_fx[i][j]; + HrtfFastConv->leftBRIRReal[i][j] = leftBRIRReal[i][j]; HrtfFastConv->leftBRIRImag[i][j] = leftBRIRImag[i][j]; HrtfFastConv->rightBRIRReal[i][j] = rightBRIRReal[i][j]; @@ -1291,6 +1628,11 @@ static ivas_error ivas_binaural_hrtf_open( { FOR( j = 0; j < HOA3_CHANNELS; j++ ) { + HrtfFastConv->leftHRIRReal_HOA3_fx[i][j] = leftHRIRReal_HOA3_fx[i][j]; + HrtfFastConv->leftHRIRImag_HOA3_fx[i][j] = leftHRIRImag_HOA3_fx[i][j]; + HrtfFastConv->rightHRIRReal_HOA3_fx[i][j] = rightHRIRReal_HOA3_fx[i][j]; + HrtfFastConv->rightHRIRImag_HOA3_fx[i][j] = rightHRIRImag_HOA3_fx[i][j]; + HrtfFastConv->leftHRIRReal_HOA3[i][j] = leftHRIRReal_HOA3[i][j]; HrtfFastConv->leftHRIRImag_HOA3[i][j] = leftHRIRImag_HOA3[i][j]; HrtfFastConv->rightHRIRReal_HOA3[i][j] = rightHRIRReal_HOA3[i][j]; @@ -1301,6 +1643,11 @@ static ivas_error ivas_binaural_hrtf_open( { FOR( j = 0; j < HOA2_CHANNELS; j++ ) { + HrtfFastConv->leftHRIRReal_HOA2_fx[i][j] = leftHRIRReal_HOA2_fx[i][j]; + HrtfFastConv->leftHRIRImag_HOA2_fx[i][j] = leftHRIRImag_HOA2_fx[i][j]; + HrtfFastConv->rightHRIRReal_HOA2_fx[i][j] = rightHRIRReal_HOA2_fx[i][j]; + HrtfFastConv->rightHRIRImag_HOA2_fx[i][j] = rightHRIRImag_HOA2_fx[i][j]; + HrtfFastConv->leftHRIRReal_HOA2[i][j] = leftHRIRReal_HOA2[i][j]; HrtfFastConv->leftHRIRImag_HOA2[i][j] = leftHRIRImag_HOA2[i][j]; HrtfFastConv->rightHRIRReal_HOA2[i][j] = rightHRIRReal_HOA2[i][j]; @@ -1311,6 +1658,11 @@ static ivas_error ivas_binaural_hrtf_open( { FOR( j = 0; j < FOA_CHANNELS; j++ ) { + HrtfFastConv->leftHRIRReal_FOA_fx[i][j] = leftHRIRReal_FOA_fx[i][j]; + HrtfFastConv->leftHRIRImag_FOA_fx[i][j] = leftHRIRImag_FOA_fx[i][j]; + HrtfFastConv->rightHRIRReal_FOA_fx[i][j] = rightHRIRReal_FOA_fx[i][j]; + HrtfFastConv->rightHRIRImag_FOA_fx[i][j] = rightHRIRImag_FOA_fx[i][j]; + HrtfFastConv->leftHRIRReal_FOA[i][j] = leftHRIRReal_FOA[i][j]; HrtfFastConv->leftHRIRImag_FOA[i][j] = leftHRIRImag_FOA[i][j]; HrtfFastConv->rightHRIRReal_FOA[i][j] = rightHRIRReal_FOA[i][j]; @@ -1318,6 +1670,9 @@ static ivas_error ivas_binaural_hrtf_open( } } } + mvl2l(fastconvReverberationTimes_fx, HrtfFastConv->fastconvReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX); + mvl2l(fastconvReverberationEneCorrections_fx, HrtfFastConv->fastconvReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX); + mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); @@ -1780,7 +2135,7 @@ ivas_error ivas_binRenderer_open_fx( } /* Load HRTF tables */ - IF( ( error = ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_binaural_hrtf_open_fx( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type ) ) != IVAS_ERR_OK ) { return error; } @@ -1852,7 +2207,7 @@ ivas_error ivas_binRenderer_open_fx( /* Allocate memories needed for reverb module */ IF( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - IF( ( error = ivas_binaural_reverb_open_fastconv( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_binaural_reverb_open_fastconv_fx( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) { return error; } @@ -2167,21 +2522,6 @@ static void ivas_binRenderer_convModuleClose( FOR( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) { - FOR( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) - { - free( hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] ); - hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = NULL; - - free( hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] ); - hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = NULL; - - free( hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] ); - hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = NULL; - - free( hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] ); - hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = NULL; - } - free( hBinRenConvModule->filterTapsLeftReal_fx[bandIdx] ); hBinRenConvModule->filterTapsLeftReal_fx[bandIdx] = NULL; @@ -2288,9 +2628,9 @@ void ivas_binRenderer_close( * * Free fastconv binaural renderer hrtf memories *------------------------------------------------------------------------*/ - -static void ivas_free_pppHrtfMem( - float ****ppppHRIR, +#ifdef IVAS_FLOAT_FIXED +static void ivas_free_pppHrtfMem_fx( + Word32 ****ppppHRIR, const Word16 dim, const Word16 alloc_init ) { @@ -2317,6 +2657,35 @@ static void ivas_free_pppHrtfMem( return; } +#endif +static void ivas_free_pppHrtfMem( + float ****ppppHRIR, + const int16_t dim, + const int16_t alloc_init ) +{ + int16_t i, j; + + if ( *ppppHRIR != NULL ) + { + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + if ( alloc_init == 0 ) + { + for ( j = 0; j < dim; j++ ) + { + free( ( *ppppHRIR )[i][j] ); + ( *ppppHRIR )[i][j] = NULL; + } + } + free( ( *ppppHRIR )[i] ); + ( *ppppHRIR )[i] = NULL; + } + free( *ppppHRIR ); + *ppppHRIR = NULL; + } + + return; +} /*------------------------------------------------------------------------- @@ -2324,7 +2693,7 @@ static void ivas_free_pppHrtfMem( * * Close fastconv binaural renderer hrtf memories *------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void ivas_binaural_hrtf_close( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ ) @@ -2338,6 +2707,31 @@ void ivas_binaural_hrtf_close( allocate_init_flag = ( *hHrtfFastConv )->allocate_init_flag; + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRReal_fx, HRTF_LS_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRImag_fx, HRTF_LS_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRReal_fx, HRTF_LS_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRImag_fx, HRTF_LS_CHANNELS, allocate_init_flag); + + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftBRIRReal_fx, HRTF_LS_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftBRIRImag_fx, HRTF_LS_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightBRIRReal_fx, HRTF_LS_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightBRIRImag_fx, HRTF_LS_CHANNELS, allocate_init_flag); + + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRReal_HOA3_fx, HOA3_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRImag_HOA3_fx, HOA3_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRReal_HOA3_fx, HOA3_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRImag_HOA3_fx, HOA3_CHANNELS, allocate_init_flag); + + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRReal_HOA2_fx, HOA2_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRImag_HOA2_fx, HOA2_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRReal_HOA2_fx, HOA2_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRImag_HOA2_fx, HOA2_CHANNELS, allocate_init_flag); + + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRReal_FOA_fx, FOA_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->leftHRIRImag_FOA_fx, FOA_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRReal_FOA_fx, FOA_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRImag_FOA_fx, FOA_CHANNELS, allocate_init_flag); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); @@ -2365,7 +2759,48 @@ void ivas_binaural_hrtf_close( return; } +#else +void ivas_binaural_hrtf_close( + HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */ +) +{ + int16_t allocate_init_flag; + + if ( hHrtfFastConv == NULL || *hHrtfFastConv == NULL ) + { + return; + } + + allocate_init_flag = ( *hHrtfFastConv )->allocate_init_flag; + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA3, HOA3_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA3, HOA3_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA3, HOA3_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA3, HOA3_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA2, HOA2_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA2, HOA2_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA2, HOA2_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA2, HOA2_CHANNELS, allocate_init_flag ); + + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_FOA, FOA_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_FOA, FOA_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_FOA, FOA_CHANNELS, allocate_init_flag ); + ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_FOA, FOA_CHANNELS, allocate_init_flag ); + return; +} +#endif /*-------------------------------------------------------------------------* * ivas_binaural_add_LFE() diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index cfe4ce0cc..8ca1cca1b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5951,9 +5951,9 @@ void ivas_dirac_dec_render_sf_fx( Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q ); - FOR ( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) + FOR ( idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) { - FOR ( Word16 idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ ) + FOR ( idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ ) { Scale_sig32(Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); Scale_sig32(Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5f244108e..6591023f2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1991,8 +1991,6 @@ ivas_error ivas_init_decoder_fx( } if ( hParamMC ) { - fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); fixedToFloat_arr( hParamMC->h_output_synthesis_params.interpolator_fx, hParamMC->h_output_synthesis_params.interpolator, 15, DEFAULT_JBM_CLDFB_TIMESLOTS ); fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 2bc91f30d..67998d4ba 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -52,8 +52,8 @@ * Local functions *-----------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -static void decode_angle_indices_fx( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, const int16_t non_diegetic_flag, int16_t *flag_abs_azimuth ); -static int16_t decode_radius_fx( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius ); +static void decode_angle_indices_fx( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, const Word16 non_diegetic_flag, Word16 *flag_abs_azimuth ); +static Word16 decode_radius_fx( DEC_CORE_HANDLE st0, Word16 *last_radius_idx, Word16 *flag_abs_radius ); #else static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, const int16_t non_diegetic_flag, int16_t *flag_abs_azimuth ); static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius ); @@ -77,8 +77,8 @@ static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int * * Smooth the metadata evolution *-------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void ism_metadata_smooth( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int32_t ism_total_brate, /* i : ISms total bitrate */ @@ -139,63 +139,65 @@ static void ism_metadata_smooth( return; } - #else static void ism_metadata_smooth_fx( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const Word32 ism_total_brate, /* i : ISms total bitrate */ - const Word16 nchan_ism /* i : number of objects */ + const Word32 ism_total_brate, /* i : ISms total bitrate */ + const Word16 nchan_ism /* i : number of objects */ ) { ISM_METADATA_HANDLE hIsmMetaData; Word16 ch; Word32 diff_fx; - FOR ( ch = 0; ch < nchan_ism; ch++ ) + FOR( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; /* smooth azimuth */ - diff_fx = hIsmMetaData->last_true_azimuth_fx - hIsmMetaData->last_azimuth_fx; + diff_fx = L_sub( hIsmMetaData->last_true_azimuth_fx, hIsmMetaData->last_azimuth_fx ); - IF ( diff_fx > ISM_AZIMUTH_MAX_FX ) + IF( GT_32( diff_fx, ISM_AZIMUTH_MAX_FX ) ) { - diff_fx = L_sub(diff_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX )); - hIsmMetaData->last_azimuth_fx = L_add(hIsmMetaData->last_azimuth_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX )); + diff_fx = L_sub( diff_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX ) ); + hIsmMetaData->last_azimuth_fx = L_add( hIsmMetaData->last_azimuth_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX ) ); } - ELSE IF ( diff_fx < ISM_AZIMUTH_MIN_FX ) + ELSE IF( LT_32( diff_fx, ISM_AZIMUTH_MIN_FX ) ) { - diff_fx = L_add(diff_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX )); + diff_fx = L_add( diff_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX ) ); } - IF ( ism_total_brate > IVAS_SID_5k2 && L_abs( diff_fx ) > L_shl(IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_AZIMUTH, 22) ) + test(); + IF( GT_32( ism_total_brate, IVAS_SID_5k2 ) && GT_32( L_abs( diff_fx ), L_shl( IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_AZIMUTH, Q22 ) ) ) { /* skip the smoothing */ } - ELSE IF ( L_abs( diff_fx ) > L_shl(CNG_MD_MAX_DIFF_AZIMUTH , 22) ) + ELSE IF( GT_32( L_abs( diff_fx ), L_shl( CNG_MD_MAX_DIFF_AZIMUTH, Q22 ) ) ) { - hIsmMetaData->azimuth_fx = L_add(hIsmMetaData->last_azimuth_fx, (diff_fx >= 0 ? 1 : -1) * L_shl( CNG_MD_MAX_DIFF_AZIMUTH, 22 )); + hIsmMetaData->azimuth_fx = L_add( hIsmMetaData->last_azimuth_fx, ( GE_32( diff_fx, 0 ) ? 1 : -1 ) * L_shl( CNG_MD_MAX_DIFF_AZIMUTH, Q22 ) ); } - ELSE IF ( diff_fx != 0 ) + ELSE IF( NE_32( diff_fx, 0 ) ) { hIsmMetaData->azimuth_fx = hIsmMetaData->last_true_azimuth_fx; + move32(); } - IF ( hIsmMetaData->azimuth_fx > ISM_AZIMUTH_MAX_FX ) + IF( GT_32( hIsmMetaData->azimuth_fx, ISM_AZIMUTH_MAX_FX ) ) { - hIsmMetaData->azimuth_fx = L_sub(hIsmMetaData->azimuth_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX )); + hIsmMetaData->azimuth_fx = L_sub( hIsmMetaData->azimuth_fx, ( ISM_AZIMUTH_MAX_FX - ISM_AZIMUTH_MIN_FX ) ); } /* smooth elevation */ - diff_fx = hIsmMetaData->last_true_elevation_fx - hIsmMetaData->last_elevation_fx; + diff_fx = L_sub( hIsmMetaData->last_true_elevation_fx, hIsmMetaData->last_elevation_fx ); - IF ( ism_total_brate > IVAS_SID_5k2 && diff_fx > L_shl(IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_ELEVATION, 22) ) + test(); + IF( GT_32( ism_total_brate, IVAS_SID_5k2 ) && GT_32( diff_fx, L_shl( IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_ELEVATION, Q22 ) ) ) { /* skip the smoothing */ } - ELSE IF ( L_abs( diff_fx ) > L_shl(CNG_MD_MAX_DIFF_ELEVATION, 22) ) + ELSE IF( GT_32( L_abs( diff_fx ), L_shl( CNG_MD_MAX_DIFF_ELEVATION, Q22 ) ) ) { - hIsmMetaData->elevation_fx = hIsmMetaData->last_elevation_fx + ( diff_fx >= 0 ? 1 : -1 ) * L_shl(CNG_MD_MAX_DIFF_ELEVATION, 22); + hIsmMetaData->elevation_fx = L_add( hIsmMetaData->last_elevation_fx, ( GE_32( diff_fx, 0 ) ? 1 : -1 ) * L_shl( CNG_MD_MAX_DIFF_ELEVATION, Q22 ) ); } } @@ -209,6 +211,7 @@ static void ism_metadata_smooth_fx( * * decode and dequantize ISM metadata *-------------------------------------------------------------------------*/ + #ifndef IVAS_FLOAT_FIXED ivas_error ivas_ism_metadata_dec( const int32_t ism_total_brate, /* i : ISM total bitrate */ @@ -457,11 +460,7 @@ ivas_error ivas_ism_metadata_dec( if ( hIsmMetaData->non_diegetic_flag ) { /* Panning gain decoding */ -#ifdef IVAS_FLOAT_FIXED - decode_angle_indices_fx( st0, &( hIsmMetaData->position_angle ), hIsmMetaData->non_diegetic_flag, &flag_abs_position ); -#else decode_angle_indices( st0, &( hIsmMetaData->position_angle ), hIsmMetaData->non_diegetic_flag, &flag_abs_position ); -#endif idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; idx_angle2 = 1 << ( ISM_ELEVATION_NBITS - 1 ); @@ -475,11 +474,7 @@ ivas_error ivas_ism_metadata_dec( } else { -#ifdef IVAS_FLOAT_FIXED - decode_angle_indices_fx( st0, &( hIsmMetaData->position_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_position ); -#else decode_angle_indices( st0, &( hIsmMetaData->position_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_position ); -#endif idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; idx_angle2 = hIsmMetaData->position_angle.last_angle2_idx; @@ -497,21 +492,13 @@ ivas_error ivas_ism_metadata_dec( /* radius/raw/pitch dequantization */ if ( ism_extmeta_bitstream ) { -#ifdef IVAS_FLOAT_FIXED - decode_angle_indices_fx( st0, &( hIsmMetaData->orientation_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_orientation ); -#else decode_angle_indices( st0, &( hIsmMetaData->orientation_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_orientation ); -#endif idx_angle1 = hIsmMetaData->orientation_angle.last_angle1_idx; idx_angle2 = hIsmMetaData->orientation_angle.last_angle2_idx; yaw = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); pitch = ism_dequant_meta( idx_angle2, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#ifdef IVAS_FLOAT_FIXED - idx_radius = decode_radius_fx( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); -#else idx_radius = decode_radius( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); -#endif radius = usdequant( idx_radius, ISM_RADIUS_MIN, ISM_RADIUS_DELTA ); if ( *ism_extmeta_active == 1 ) { @@ -540,14 +527,6 @@ ivas_error ivas_ism_metadata_dec( { nb_bits_metadata[ch] = st0->next_bit_pos - nb_bits_start; } -#ifdef IVAS_FLOAT_FIXED - /* This is done here to update the fixed point values which will be required later during rendering */ - hIsmMetaData->azimuth_fx = float_to_fix(hIsmMetaData->azimuth, Q22); - hIsmMetaData->elevation_fx = float_to_fix(hIsmMetaData->elevation, Q22); - hIsmMetaData->yaw_fx = float_to_fix(hIsmMetaData->yaw, Q22); - hIsmMetaData->pitch_fx = float_to_fix(hIsmMetaData->pitch, Q22); - hIsmMetaData->radius_fx = float_to_fix16(hIsmMetaData->radius, Q9); -#endif } if ( ism_mode == ISM_MODE_PARAM ) @@ -665,11 +644,7 @@ ivas_error ivas_ism_metadata_dec( } } -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_ism_config_fx( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, masa_ism_flag ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, masa_ism_flag ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -740,22 +715,21 @@ ivas_error ivas_ism_metadata_dec( return IVAS_ERR_OK; } - #else ivas_error ivas_ism_metadata_dec_fx( - const Word32 ism_total_brate, /* i : ISM total bitrate */ - const Word16 nchan_ism, /* i : number of ISM channels */ - Word16 *nchan_transport, /* o : number of transport channels */ + const Word32 ism_total_brate, /* i : ISM total bitrate */ + const Word16 nchan_ism, /* i : number of ISM channels */ + Word16 *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ - const Word16 bfi, /* i : bfi flag */ - Word16 nb_bits_metadata[], /* o : number of metadata bits */ + const Word16 bfi, /* i : bfi flag */ + Word16 nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ - Word16 *ism_extmeta_active, /* i/o: Extended metadata active in renderer */ - Word16 *ism_extmeta_cnt, /* i/o: Number of change frames observed */ - DEC_CORE_HANDLE st0) /* i : core-coder handle */ + Word16 *ism_extmeta_active, /* i/o: Extended metadata active in renderer */ + Word16 *ism_extmeta_cnt, /* i/o: Number of change frames observed */ + DEC_CORE_HANDLE st0 ) /* i : core-coder handle */ { Word16 ch, nb_bits_start = 0, last_bit_pos; Word16 idx_radius; @@ -778,205 +752,251 @@ ivas_error ivas_ism_metadata_dec_fx( Word16 ism_imp[MAX_NUM_OBJECTS]; Word16 nbands, nblocks; Word16 md_diff_flag[MAX_NUM_OBJECTS]; - ivas_error error; + ivas_error error; + move16(); push_wmops( "ism_meta_dec" ); /* initialization */ ism_metadata_flag_global = 0; + move16(); nchan_transport_prev = *nchan_transport; + move16(); - last_bit_pos = (Word16) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 ); + last_bit_pos = extract_l( L_sub( ( ism_total_brate / FRAMES_PER_SEC ), 1 ) ); bstr_orig = st0->bit_stream; + move16(); next_bit_pos_orig = st0->next_bit_pos; + move16(); st0->next_bit_pos = 0; + move16(); ism_extmeta_bitstream = 0; + move16(); non_diegetic_flag_global = 0; - set_s( null_metadata_flag, 0, nchan_ism ); - set_s( lowrate_metadata_flag, 0, nchan_ism ); + move16(); + set16_fx( null_metadata_flag, 0, nchan_ism ); + set16_fx( lowrate_metadata_flag, 0, nchan_ism ); /* reverse the bitstream for easier reading of indices */ - FOR ( i = 0; i < s_min( MAX_BITS_ISM_METADATA, last_bit_pos ); i++ ) + FOR( i = 0; i < s_min( MAX_BITS_ISM_METADATA, last_bit_pos ); i++ ) { bstr_meta[i] = st0->bit_stream[last_bit_pos - i]; + move16(); } st0->bit_stream = bstr_meta; st0->total_brate = ism_total_brate; /* needed for BER detection in get_next_indice() */ + move32(); - IF ( !bfi ) + IF( !bfi ) { /*----------------------------------------------------------------* * Read ISM common signaling *----------------------------------------------------------------*/ - IF ( ism_mode == ISM_SBA_MODE_DISC ) + test(); + IF( EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) { /* number of objects was read in ivas_dec_setup() */ - st0->next_bit_pos = add(st0->next_bit_pos, NO_BITS_MASA_ISM_NO_OBJ); + st0->next_bit_pos = add( st0->next_bit_pos, NO_BITS_MASA_ISM_NO_OBJ ); } - ELSE IF ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) + ELSE IF( NE_32( ism_mode, ISM_MASA_MODE_DISC ) && NE_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { /* number of objects was read in ivas_dec_setup() */ - st0->next_bit_pos = add(st0->next_bit_pos, nchan_ism); + st0->next_bit_pos = add( st0->next_bit_pos, nchan_ism ); ism_mode = ivas_ism_mode_select( nchan_ism, ism_total_brate ); } - IF ( ism_mode == ISM_MODE_PARAM ) + IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { *nchan_transport = MAX_PARAM_ISM_WAVE; + move16(); } - ELSE IF ( ism_mode == ISM_MODE_DISC ) + ELSE IF( EQ_32( ism_mode, ISM_MODE_DISC ) ) { *nchan_transport = nchan_ism; + move16(); } - IF ( *nchan_transport != nchan_transport_prev ) + IF( NE_32( *nchan_transport, nchan_transport_prev ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); } /* read extended metadata presence flag */ - IF ( ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_SBA_MODE_DISC ) && ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) + test(); + test(); + IF( ( EQ_32( ism_mode, ISM_MODE_DISC ) || EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) && GE_32( ism_total_brate, ISM_EXTENDED_METADATA_BRATE ) ) { ism_extmeta_bitstream = get_next_indice_fx( st0, ISM_EXTENDED_METADATA_BITS ); /* read global non-diegetic object flag */ - IF ( ism_extmeta_bitstream ) + IF( ism_extmeta_bitstream ) { non_diegetic_flag_global = get_next_indice_fx( st0, ISM_METADATA_IS_NDP_BITS ); } } /* Apply hysteresis in case rate switching causes fluctuation in presence of extended metadata */ - IF ( *ism_extmeta_active == -1 || *ism_extmeta_active == ism_extmeta_bitstream ) /* If first frame or bitstream matches internal state */ + test(); + IF( EQ_16( *ism_extmeta_active, -1 ) || EQ_16( *ism_extmeta_active, ism_extmeta_bitstream ) ) /* If first frame or bitstream matches internal state */ { *ism_extmeta_active = ism_extmeta_bitstream; + move16(); *ism_extmeta_cnt = 0; + move16(); } ELSE { ( *ism_extmeta_cnt )++; - IF ( *ism_extmeta_cnt == ISM_METADATA_RS_MAX_FRAMES ) /* ISM_METADATA_RS_MAX_FRAMES change frames observed - update state */ + IF( EQ_16( *ism_extmeta_cnt, ISM_METADATA_RS_MAX_FRAMES ) ) /* ISM_METADATA_RS_MAX_FRAMES change frames observed - update state */ { *ism_extmeta_active = ism_extmeta_bitstream; + move16(); *ism_extmeta_cnt = 0; + move16(); } } /* Read ISM metadata flags (one per object) */ - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + FOR( ch = 0; ch < *nchan_transport; ch++ ) { - IF ( ism_mode == ISM_SBA_MODE_DISC ) + test(); + IF( EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) { ism_imp[ch] = get_next_indice_fx( st0, 1 ); + move16(); } - ELSE IF ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + ELSE IF( EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { /* ISM importance flag is already read in ivas_masa_decode() */ ism_imp[ch] = hIsmMeta[ch]->ism_imp; + move16(); } ELSE { ism_imp[ch] = get_next_indice_fx( st0, ISM_METADATA_FLAG_BITS ); + move16(); } - IF ( ism_imp[ch] > ISM_NO_META ) + IF( GT_16( ism_imp[ch], ISM_NO_META ) ) { hIsmMeta[ch]->ism_metadata_flag = 1; + move16(); } ELSE { hIsmMeta[ch]->ism_metadata_flag = 0; + move16(); } - ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; + ism_metadata_flag_global = s_or( ism_metadata_flag_global, hIsmMeta[ch]->ism_metadata_flag ); } - FOR ( ; ch < nchan_ism; ch++ ) + FOR( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->ism_metadata_flag = 1; - ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; + move16(); + ism_metadata_flag_global = s_or( ism_metadata_flag_global, hIsmMeta[ch]->ism_metadata_flag ); } /* read ISM_NO_META class signalling */ - IF ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_SBA_MODE_DISC ) + test(); + IF( EQ_32( ism_mode, ISM_MODE_DISC ) || EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) { - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + FOR( ch = 0; ch < *nchan_transport; ch++ ) { - IF ( ism_imp[ch] == ISM_NO_META ) + IF( EQ_16( ism_imp[ch], ISM_NO_META ) ) { /* low-rate ISM_NO_META frame */ - IF ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + test(); + IF( EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { null_metadata_flag[ch] = hIsmMeta[ch]->ism_md_null_flag; + move16(); } ELSE { null_metadata_flag[ch] = get_next_indice_fx( st0, ISM_METADATA_INACTIVE_FLAG_BITS ); + move16(); } } } - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + FOR( ch = 0; ch < *nchan_transport; ch++ ) { - IF ( ism_imp[ch] == ISM_NO_META ) + IF( EQ_16( ism_imp[ch], ISM_NO_META ) ) { - IF ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + test(); + IF( EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { lowrate_metadata_flag[ch] = hIsmMeta[ch]->ism_md_lowrate_flag; + move16(); - IF ( null_metadata_flag[ch] == 0 ) + IF( EQ_16( null_metadata_flag[ch], 0 ) ) { - ism_metadata_flag_global |= lowrate_metadata_flag[ch]; + ism_metadata_flag_global = s_or( ism_metadata_flag_global, lowrate_metadata_flag[ch] ); } } - ELSE IF ( ism_mode != ISM_SBA_MODE_DISC ) + ELSE IF( NE_32( ism_mode, ISM_SBA_MODE_DISC ) ) { - IF ( null_metadata_flag[ch] ) + IF( null_metadata_flag[ch] ) { /* read the true ISM class */ ism_imp[ch] = get_next_indice_fx( st0, ISM_METADATA_FLAG_BITS ); + move16(); } ELSE { /* read presence of MD in low-rate ISM_NO_META frame flag */ lowrate_metadata_flag[ch] = get_next_indice_fx( st0, ISM_METADATA_INACTIVE_FLAG_BITS ); + move16(); - ism_metadata_flag_global |= lowrate_metadata_flag[ch]; + ism_metadata_flag_global = s_or( ism_metadata_flag_global, lowrate_metadata_flag[ch] ); } } } } } - IF ( ism_metadata_flag_global ) + IF( ism_metadata_flag_global ) { /*----------------------------------------------------------------* * Metadata decoding and dequantization, loop over all objects *----------------------------------------------------------------*/ Word16 total_bits_metadata = 0, bits_metadata_ism = 0; + move16(); + move16(); Word16 nb_bits_objcod_read; - IF ( ism_mode == ISM_MODE_PARAM ) + IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { nb_bits_start = st0->next_bit_pos; + move16(); } - FOR ( ch = 0; ch < nchan_ism; ch++ ) + FOR( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; - IF ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_SBA_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + test(); + test(); + test(); + IF( EQ_32( ism_mode, ISM_MODE_DISC ) || EQ_32( ism_mode, ISM_SBA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { nb_bits_start = st0->next_bit_pos; + move16(); } flag_abs_position = 0; + move16(); flag_abs_orientation = 0; + move16(); flag_abs_radius = 0; + move16(); - IF ( hIsmMeta[ch]->ism_metadata_flag || lowrate_metadata_flag[ch] ) + test(); + IF( hIsmMeta[ch]->ism_metadata_flag || lowrate_metadata_flag[ch] ) { - IF ( non_diegetic_flag_global ) + IF( non_diegetic_flag_global ) { /* read non-diegetic flag for each object */ hIsmMetaData->non_diegetic_flag = get_next_indice_fx( st0, ISM_METADATA_IS_NDP_BITS ); @@ -984,232 +1004,288 @@ ivas_error ivas_ism_metadata_dec_fx( ELSE { hIsmMetaData->non_diegetic_flag = 0; + move16(); } - IF ( hIsmMetaData->non_diegetic_flag ) + IF( hIsmMetaData->non_diegetic_flag ) { /* Panning gain decoding */ decode_angle_indices_fx( st0, &( hIsmMetaData->position_angle ), hIsmMetaData->non_diegetic_flag, &flag_abs_position ); idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; - idx_angle2 = 1 << ( ISM_ELEVATION_NBITS - 1 ); + move16(); + idx_angle2 = shl( 1, ( ISM_ELEVATION_NBITS - 1 ) ); /* Panning gain dequantization */ - hIsmMetaData->azimuth_fx = ism_dequant_meta_fx( idx_angle1, ism_azimuth_borders_fx, (Word32)(ISM_Q_STEP * (1<<22)), (Word32)(ISM_Q_STEP_BORDER * (1<<22)), 1 << ISM_AZIMUTH_NBITS ); + hIsmMetaData->azimuth_fx = ism_dequant_meta_fx( idx_angle1, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, shl( 1, ISM_AZIMUTH_NBITS ) ); hIsmMetaData->elevation_fx = 0; + move32(); /* save for smoothing metadata evolution */ hIsmMetaData->last_true_azimuth_fx = hIsmMetaData->azimuth_fx; + move32(); hIsmMetaData->last_true_elevation_fx = hIsmMetaData->elevation_fx; + move32(); } ELSE { decode_angle_indices_fx( st0, &( hIsmMetaData->position_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_position ); idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; + move16(); idx_angle2 = hIsmMetaData->position_angle.last_angle2_idx; + move16(); /* Azimuth/Elevation dequantization */ - IF ( ism_mode == ISM_MODE_PARAM ) + IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { hParamIsm->azi_index[ch] = idx_angle1; + move16(); hParamIsm->ele_index[ch] = idx_angle2; + move16(); } ELSE /* ISM_MODE_DISC */ { - hIsmMetaData->azimuth_fx = ism_dequant_meta_fx( idx_angle1, ism_azimuth_borders_fx, (Word32)(ISM_Q_STEP * (1<<22)), (Word32)(ISM_Q_STEP_BORDER * (1<<22)), 1 << ISM_AZIMUTH_NBITS ); - hIsmMetaData->elevation_fx = ism_dequant_meta_fx( idx_angle2, ism_elevation_borders_fx, (Word32)(ISM_Q_STEP * (1<<22)), (Word32)(ISM_Q_STEP_BORDER * (1<<22)), 1 << ISM_ELEVATION_NBITS ); + hIsmMetaData->azimuth_fx = ism_dequant_meta_fx( idx_angle1, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, shl( 1, ISM_AZIMUTH_NBITS ) ); + hIsmMetaData->elevation_fx = ism_dequant_meta_fx( idx_angle2, ism_elevation_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, shl( 1, ISM_ELEVATION_NBITS ) ); /* radius/raw/pitch dequantization */ - IF ( ism_extmeta_bitstream ) + IF( ism_extmeta_bitstream ) { decode_angle_indices_fx( st0, &( hIsmMetaData->orientation_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_orientation ); idx_angle1 = hIsmMetaData->orientation_angle.last_angle1_idx; + move16(); idx_angle2 = hIsmMetaData->orientation_angle.last_angle2_idx; - yaw_fx = ism_dequant_meta_fx( idx_angle1, ism_azimuth_borders_fx, (Word32)(ISM_Q_STEP * (1<<22)), (Word32)(ISM_Q_STEP_BORDER * (1<<22)), 1 << ISM_AZIMUTH_NBITS ); - pitch_fx = ism_dequant_meta_fx( idx_angle2, ism_elevation_borders_fx, (Word32)(ISM_Q_STEP * (1<<22)), (Word32)(ISM_Q_STEP_BORDER * (1<<22)), 1 << ISM_ELEVATION_NBITS ); + move16(); + yaw_fx = ism_dequant_meta_fx( idx_angle1, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, shl( 1, ISM_AZIMUTH_NBITS ) ); + pitch_fx = ism_dequant_meta_fx( idx_angle2, ism_elevation_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, shl( 1, ISM_ELEVATION_NBITS ) ); idx_radius = decode_radius_fx( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); - radius_fx = usdequant_fx( idx_radius, (Word16)(ISM_RADIUS_MIN * (1 << 9)) , (Word16)(ISM_RADIUS_DELTA * (1 << (9 - 1))) ); - IF ( *ism_extmeta_active == 1 ) + radius_fx = usdequant_fx( idx_radius, ISM_RADIUS_MIN_Q9, ISM_RADIUS_DELTA_Q8 ); + IF( EQ_16( *ism_extmeta_active, 1 ) ) { hIsmMetaData->yaw_fx = yaw_fx; + move32(); hIsmMetaData->pitch_fx = pitch_fx; + move32(); hIsmMetaData->radius_fx = radius_fx; + move16(); } } ELSE { - IF ( *ism_extmeta_active == 0 ) + IF( EQ_16( *ism_extmeta_active, 0 ) ) { hIsmMetaData->yaw_fx = 0; + move32(); hIsmMetaData->pitch_fx = 0; - hIsmMetaData->radius_fx = 1 << 9; + move32(); + hIsmMetaData->radius_fx = 512; /* 1.0f in Q9 */ + move16(); } } } /* save for smoothing metadata evolution */ hIsmMetaData->last_true_azimuth_fx = hIsmMetaData->azimuth_fx; + move32(); hIsmMetaData->last_true_elevation_fx = hIsmMetaData->elevation_fx; + move32(); } } /* save number of metadata bits read */ - IF ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_SBA_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + test(); + test(); + test(); + IF( EQ_32( ism_mode, ISM_MODE_DISC ) || EQ_32( ism_mode, ISM_SBA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { - nb_bits_metadata[ch] = st0->next_bit_pos - nb_bits_start; + nb_bits_metadata[ch] = sub( st0->next_bit_pos, nb_bits_start ); + move16(); } } - IF ( ism_mode == ISM_MODE_PARAM ) + IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { hParamIsm->flag_noisy_speech = get_next_indice_fx( st0, 1 ); /* Loop over multiwave to read the object indices from bitstream */ - FOR ( ch = 0; ch < MAX_PARAM_ISM_WAVE; ch++ ) + FOR( ch = 0; ch < MAX_PARAM_ISM_WAVE; ch++ ) { - FOR ( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) + FOR( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) { - FOR ( nblocks = 0; nblocks < hParamIsm->nblocks[nbands]; nblocks++ ) + FOR( nblocks = 0; nblocks < hParamIsm->nblocks[nbands]; nblocks++ ) { hParamIsm->obj_indices[nbands][nblocks][ch] = get_next_indice_fx( st0, PARAM_ISM_OBJ_IND_NBITS ); + move16(); } } } /* Loop over all bands to read power ratio's from bitstream */ - FOR ( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) + FOR( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) { - FOR ( nblocks = 0; nblocks < hParamIsm->nblocks[nbands]; nblocks++ ) + FOR( nblocks = 0; nblocks < hParamIsm->nblocks[nbands]; nblocks++ ) { hParamIsm->power_ratios_idx[nbands][nblocks] = get_next_indice_fx( st0, PARAM_ISM_POW_RATIO_NBITS ); + move16(); } } /* save number of metadata bits read */ - total_bits_metadata = st0->next_bit_pos - nb_bits_start; + total_bits_metadata = sub( st0->next_bit_pos, nb_bits_start ); /* bits per ISM*/ - bits_metadata_ism = (Word16) ( total_bits_metadata / *nchan_transport ); + bits_metadata_ism = extract_l( total_bits_metadata / *nchan_transport ); nb_bits_objcod_read = 0; - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + move16(); + FOR( ch = 0; ch < *nchan_transport; ch++ ) { - IF ( ch == *nchan_transport - 1 ) + IF( EQ_16( ch, sub( *nchan_transport, 1 ) ) ) { - nb_bits_metadata[ch] = total_bits_metadata - nb_bits_objcod_read; + nb_bits_metadata[ch] = sub( total_bits_metadata, nb_bits_objcod_read ); + move16(); } ELSE { nb_bits_metadata[ch] = bits_metadata_ism; - nb_bits_objcod_read += bits_metadata_ism; + move16(); + nb_bits_objcod_read = add( nb_bits_objcod_read, bits_metadata_ism ); } } } } ELSE { - set_s( nb_bits_metadata, 0, *nchan_transport ); + set16_fx( nb_bits_metadata, 0, *nchan_transport ); } } ELSE /* BFI */ { - FOR ( ch = 0; ch < nchan_ism; ch++ ) + FOR( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; + move16(); } - set_s( nb_bits_metadata, 0, *nchan_transport ); + set16_fx( nb_bits_metadata, 0, *nchan_transport ); - IF ( ism_mode == ISM_MODE_PARAM ) + IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { - FOR ( ch = 0; ch < nchan_ism; ch++ ) + FOR( ch = 0; ch < nchan_ism; ch++ ) { - hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; - hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; + hParamIsm->azi_index[ch] = add( hParamIsm->azi_index[ch], i_mult2( hParamIsm->last_az_sgn[ch], hParamIsm->last_az_diff[ch] ) ); + move16(); + hParamIsm->ele_index[ch] = add( hParamIsm->ele_index[ch], i_mult2( hParamIsm->last_el_sgn[ch], hParamIsm->last_el_diff[ch] ) ); + move16(); hIsmMeta[ch]->position_angle.last_angle1_idx = hParamIsm->azi_index[ch]; + move16(); hIsmMeta[ch]->position_angle.last_angle2_idx = hParamIsm->ele_index[ch]; + move16(); } } } - IF ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) + IF( LT_16( hISMDTX.ism_dtx_hangover_cnt, IVAS_ISM_DTX_HO_MAX ) ) { ism_metadata_smooth_fx( hIsmMeta, ism_total_brate, nchan_ism ); - hISMDTX.ism_dtx_hangover_cnt += 1; + hISMDTX.ism_dtx_hangover_cnt = add( hISMDTX.ism_dtx_hangover_cnt, 1 ); } - IF ( ism_mode == ISM_SBA_MODE_DISC ) + IF( EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) { /* set the bitstream pointer to its original position */ nb_bits_metadata[0] = st0->next_bit_pos; + move16(); st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; + move16(); /* updates*/ - set_s( md_diff_flag, 1, nchan_ism ); + set16_fx( md_diff_flag, 1, nchan_ism ); - update_last_metadata( nchan_ism, hIsmMeta, md_diff_flag ); + update_last_metadata_fx( nchan_ism, hIsmMeta, md_diff_flag ); pop_wmops(); return IVAS_ERR_OK; } - IF ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + test(); + IF( EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { ism_metadata_flag_global = 1; + move16(); } /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ - IF ( !bfi ) + IF( !bfi ) { Word16 masa_ism_flag = 0; - IF ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + move16(); + test(); + IF( EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { masa_ism_flag = 1; + move16(); - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + FOR( ch = 0; ch < *nchan_transport; ch++ ) { element_brate[ch] = hSCE[ch]->element_brate; + move32(); } } - IF ( ( error = ivas_ism_config_fx( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, masa_ism_flag ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_ism_config_fx( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, masa_ism_flag ) ) != IVAS_ERR_OK ) { return error; } - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + FOR( ch = 0; ch < *nchan_transport; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; + move16(); hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; - IF ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) + move16(); + test(); + test(); + IF( EQ_32( ism_mode, ISM_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { - IF ( ism_imp[ch] == ISM_NO_META && ( ( total_brate[ch] < ACELP_8k00 && element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) || - ( total_brate[ch] <= ACELP_16k_LOW_LIMIT && element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) ) ) + test(); + test(); + test(); + test(); + IF( EQ_16( ism_imp[ch], ISM_NO_META ) && ( ( LT_32( total_brate[ch], ACELP_8k00 ) && LT_32( element_brate[ch], SCE_CORE_16k_LOW_LIMIT ) ) || + ( LE_32( total_brate[ch], ACELP_16k_LOW_LIMIT ) && GE_32( element_brate[ch], SCE_CORE_16k_LOW_LIMIT ) ) ) ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; + move16(); } } - IF ( ism_mode != ISM_MASA_MODE_DISC && ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) + test(); + IF( NE_32( ism_mode, ISM_MASA_MODE_DISC ) && NE_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { hSCE[ch]->element_brate = element_brate[ch]; + move32(); } hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; + move32(); } - FOR ( ; ch < nchan_ism; ch++ ) + FOR( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; + move16(); } } ELSE { - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + FOR( ch = 0; ch < *nchan_transport; ch++ ) { hSCE[ch]->element_brate = hSCE[ch]->last_element_brate; + move32(); hSCE[ch]->hCoreCoder[0]->total_brate = hSCE[ch]->hCoreCoder[0]->last_total_brate; + move32(); } } @@ -1220,9 +1296,10 @@ ivas_error ivas_ism_metadata_dec_fx( /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; + move16(); /* set bitstream pointers for each ISM */ - FOR ( ch = 1; ch < *nchan_transport; ch++ ) + FOR( ch = 1; ch < *nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->bit_stream = hSCE[ch - 1]->hCoreCoder[0]->bit_stream + ( hSCE[ch - 1]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC ); } @@ -1231,13 +1308,14 @@ ivas_error ivas_ism_metadata_dec_fx( * Updates *----------------------------------------------------------------*/ - set_s( md_diff_flag, 1, nchan_ism ); + set16_fx( md_diff_flag, 1, nchan_ism ); update_last_metadata_fx( nchan_ism, hIsmMeta, md_diff_flag ); - FOR ( ch = 0; ch < *nchan_transport; ch++ ) + FOR( ch = 0; ch < *nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->cng_ism_flag = 0; + move16(); } pop_wmops(); @@ -1246,6 +1324,7 @@ ivas_error ivas_ism_metadata_dec_fx( } #endif + /*------------------------------------------------------------------------- * ivas_ism_metadata_dec_create() * @@ -1254,7 +1333,7 @@ ivas_error ivas_ism_metadata_dec_fx( #ifdef IVAS_FLOAT_FIXED ivas_error ivas_ism_metadata_dec_create_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word16 n_ISms, /* i : number of objects */ Word32 element_brate_tmp[] /* o : element bitrate per object */ ) @@ -1360,17 +1439,10 @@ ivas_error ivas_ism_metadata_dec_create( if ( element_brate_tmp != NULL ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK ) { return error; } -#endif } st_ivas->hISMDTX.ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; @@ -1379,6 +1451,7 @@ ivas_error ivas_ism_metadata_dec_create( } #endif + /*------------------------------------------------------------------------- * decode_angle_indices() * @@ -1389,8 +1462,8 @@ ivas_error ivas_ism_metadata_dec_create( static void decode_angle_indices_fx( DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ - const Word16 non_diegetic_flag, /* i : Non diegetic flag */ - Word16 *flag_abs_angle1 /* o : Azimuth/yaw encoding mode */ + const Word16 non_diegetic_flag, /* i : Non diegetic flag */ + Word16 *flag_abs_angle1 /* o : Azimuth/yaw encoding mode */ ) { Word16 idx_angle1, nbits_diff_angle1, diff, sgn; @@ -1401,126 +1474,144 @@ static void decode_angle_indices_fx( *----------------------------------------------------------------*/ /* Decode azimuth/yaw index */ - IF ( get_next_indice_fx( st0, 1 ) == 1 ) /* azimuth_abs_flag */ + IF( EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) /* azimuth_abs_flag */ { idx_angle1 = get_next_indice_fx( st0, ISM_AZIMUTH_NBITS ); *flag_abs_angle1 = 1; + move16(); } ELSE { diff = 0; + move16(); sgn = 1; + move16(); - IF ( get_next_indice_fx( st0, 1 ) == 0 ) + IF( EQ_16( get_next_indice_fx( st0, 1 ), 0 ) ) { nbits_diff_angle1 = 1; + move16(); } ELSE { nbits_diff_angle1 = 1; + move16(); - IF ( get_next_indice_fx( st0, 1 ) == 1 ) /* negative sign */ + IF( EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) /* negative sign */ { sgn = -1; + move16(); } nbits_diff_angle1++; /* read until the stop bit */ - WHILE ( ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) && ( get_next_indice_fx( st0, 1 ) == 1 ) ) + WHILE( LT_16( nbits_diff_angle1, sub( ISM_AZIMUTH_NBITS, 1 ) ) && EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) { diff++; nbits_diff_angle1++; } - IF ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) + IF( LT_16( nbits_diff_angle1, sub( ISM_AZIMUTH_NBITS, 1 ) ) ) { /* count stop bit */ nbits_diff_angle1++; } } - idx_angle1 = angle->last_angle1_idx + sgn * diff; + idx_angle1 = add( angle->last_angle1_idx, i_mult2( sgn, diff ) ); } /* azimuth/yaw is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - IF ( idx_angle1 > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + IF( GT_16( idx_angle1, sub( shl( 1, ISM_AZIMUTH_NBITS ), 1 ) ) ) { - idx_angle1 -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ + idx_angle1 = sub( idx_angle1, sub( shl( 1, ISM_AZIMUTH_NBITS ), 1 ) ); /* +180° -> -180° */ } - ELSE IF ( idx_angle1 < 0 ) + ELSE IF( LT_16( idx_angle1, 0 ) ) { - idx_angle1 += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ + idx_angle1 = add( idx_angle1, sub( shl( 1, ISM_AZIMUTH_NBITS ), 1 ) ); /* -180° -> +180° */ } /* +180° == -180° */ - IF ( idx_angle1 == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + IF( EQ_16( idx_angle1, sub( shl( 1, ISM_AZIMUTH_NBITS ), 1 ) ) ) { idx_angle1 = 0; + move16(); } /* sanity check in case of FER or BER */ - IF ( idx_angle1 < 0 || idx_angle1 > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + test(); + IF( LT_16( idx_angle1, 0 ) || GT_16( idx_angle1, sub( shl( 1, ISM_AZIMUTH_NBITS ), 1 ) ) ) { idx_angle1 = angle->last_angle1_idx; + move16(); } /*----------------------------------------------------------------* * Elevation/pitch decoding and dequantization *----------------------------------------------------------------*/ - IF ( non_diegetic_flag == 0 ) + IF( EQ_16( non_diegetic_flag, 0 ) ) { /* Decode elevation/pitch index */ - IF ( *flag_abs_angle1 == 0 && get_next_indice_fx( st0, 1 ) == 1 ) /* elevation_abs_flag */ + test(); + IF( EQ_16( *flag_abs_angle1, 0 ) && EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) /* elevation_abs_flag */ { idx_angle2 = get_next_indice_fx( st0, ISM_ELEVATION_NBITS ); } ELSE { diff = 0; + move16(); sgn = 1; + move16(); - IF ( get_next_indice_fx( st0, 1 ) == 0 ) + IF( EQ_16( get_next_indice_fx( st0, 1 ), 0 ) ) { nbits_diff_angle2 = 1; + move16(); } ELSE { nbits_diff_angle2 = 1; + move16(); - IF ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + IF( EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) /* negative sign */ { sgn = -1; + move16(); } - nbits_diff_angle2 = add(nbits_diff_angle2, 1); + nbits_diff_angle2 = add( nbits_diff_angle2, 1 ); /* read until the stop bit */ - WHILE ( ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + WHILE( LT_16( nbits_diff_angle2, ISM_ELEVATION_NBITS ) && EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) { - diff = add(diff, 1); - nbits_diff_angle2 = add(nbits_diff_angle2, 1); + diff = add( diff, 1 ); + nbits_diff_angle2 = add( nbits_diff_angle2, 1 ); } - IF ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) + IF( LT_16( nbits_diff_angle2, ISM_ELEVATION_NBITS ) ) { /* count stop bit */ - nbits_diff_angle2 = add(nbits_diff_angle2, 1); + nbits_diff_angle2 = add( nbits_diff_angle2, 1 ); } } - idx_angle2 = add(angle->last_angle2_idx, sgn * diff); + idx_angle2 = add( angle->last_angle2_idx, sgn * diff ); } /* sanity check in case of FER or BER */ - IF ( idx_angle2 < 0 || idx_angle2 > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) + test(); + IF( LT_16( idx_angle2, 0 ) || GT_16( idx_angle2, sub( shl( 1, ISM_ELEVATION_NBITS ), 1 ) ) ) { idx_angle2 = angle->last_angle2_idx; + move16(); } } ELSE { idx_angle2 = angle->last_angle2_idx; /* second MD parameter is not transmitted for non-diegetic object */ + move16(); } /*----------------------------------------------------------------* @@ -1528,7 +1619,9 @@ static void decode_angle_indices_fx( *----------------------------------------------------------------*/ angle->last_angle2_idx = idx_angle2; + move16(); angle->last_angle1_idx = idx_angle1; + move16(); return; } @@ -1681,6 +1774,7 @@ static void decode_angle_indices( } #endif + /*------------------------------------------------------------------------- * decode_radius() * @@ -1689,7 +1783,7 @@ static void decode_angle_indices( #ifdef IVAS_FLOAT_FIXED static Word16 decode_radius_fx( - DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ + DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ Word16 *last_radius_idx, /* i/o: last radius index */ Word16 *flag_abs_radius /* o : Radius encoding mode */ ) @@ -1697,55 +1791,64 @@ static Word16 decode_radius_fx( Word16 idx_radius, nbits_diff_radius, diff, sgn; /* Decode radius index */ - IF ( get_next_indice_fx( st0, 1 ) == 1 ) /* elevation_abs_flag */ + IF( EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) /* elevation_abs_flag */ { *flag_abs_radius = 1; + move16(); idx_radius = get_next_indice_fx( st0, ISM_RADIUS_NBITS ); } ELSE { diff = 0; + move16(); sgn = 1; + move16(); - IF ( get_next_indice_fx( st0, 1 ) == 0 ) + IF( EQ_16( get_next_indice_fx( st0, 1 ), 0 ) ) { nbits_diff_radius = 1; + move16(); } ELSE { nbits_diff_radius = 1; + move16(); - IF ( get_next_indice_fx( st0, 1 ) == 1 ) /* negative sign */ + IF( EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) /* negative sign */ { sgn = -1; + move16(); } nbits_diff_radius++; /* read until the stop bit */ - WHILE ( ( nbits_diff_radius < ISM_RADIUS_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + WHILE( LT_16( nbits_diff_radius, ISM_RADIUS_NBITS ) && EQ_16( get_next_indice_fx( st0, 1 ), 1 ) ) { diff++; nbits_diff_radius++; } - IF ( nbits_diff_radius < ISM_RADIUS_NBITS ) + IF( LT_16( nbits_diff_radius, ISM_RADIUS_NBITS ) ) { /* count stop bit */ nbits_diff_radius++; } } - idx_radius = *last_radius_idx + sgn * diff; + idx_radius = add( *last_radius_idx, i_mult2( sgn, diff ) ); } /* sanity check in case of FER or BER */ - IF ( idx_radius < 0 || idx_radius > ( 1 << ISM_RADIUS_NBITS ) - 1 ) + test(); + IF( LT_16( idx_radius, 0 ) || GT_16( idx_radius, sub( shl( 1, ISM_RADIUS_NBITS ), 1 ) ) ) { idx_radius = *last_radius_idx; + move16(); } /* Final updates */ *last_radius_idx = idx_radius; + move16(); return idx_radius; } @@ -1812,13 +1915,15 @@ static int16_t decode_radius( return idx_radius; } #endif -#ifndef IVAS_FLOAT_FIXED + + /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_dec() * * Decode ISM metadata in SID frame *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_ism_metadata_sid_dec( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE decoder structure */ const int32_t ism_total_brate, /* i : ISM total bitrate */ @@ -1982,19 +2087,18 @@ void ivas_ism_metadata_sid_dec( return; } -#endif -#ifdef IVAS_FLOAT_FIXED +#else void ivas_ism_metadata_sid_dec_fx( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE decoder structure */ - const Word32 ism_total_brate, /* i : ISM total bitrate */ - const Word16 bfi, /* i : bfi flag */ - const Word16 nchan_ism, /* i : number of objects */ - const Word16 nchan_transport, /* i : number of transport channels*/ + const Word32 ism_total_brate, /* i : ISM total bitrate */ + const Word16 bfi, /* i : bfi flag */ + const Word16 nchan_ism, /* i : number of objects */ + const Word16 nchan_transport, /* i : number of transport channels*/ const ISM_MODE ism_mode, /* i : ISM mode */ - Word16 *flag_noisy_speech, /* o : noisy speech flag */ - Word16 *sce_id_dtx, /* o : SCE DTX ID */ + Word16 *flag_noisy_speech, /* o : noisy speech flag */ + Word16 *sce_id_dtx, /* o : SCE DTX ID */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - Word16 nb_bits_metadata[] /* o : number of metadata bits */ + Word16 nb_bits_metadata[] /* o : number of metadata bits */ ) { Word16 i, ch, last_bit_pos; @@ -2008,7 +2112,7 @@ void ivas_ism_metadata_sid_dec_fx( Word16 next_bit_pos_orig; UWord16 bstr_meta[IVAS_SID_5k2 / FRAMES_PER_SEC], *bstr_orig; - IF ( ism_total_brate == FRAME_NO_DATA ) + IF( EQ_32( ism_total_brate, FRAME_NO_DATA ) ) { ism_metadata_smooth_fx( hIsmMeta, ism_total_brate, nchan_ism ); @@ -2018,20 +2122,24 @@ void ivas_ism_metadata_sid_dec_fx( /* initialization */ st0 = hSCE[0]->hCoreCoder[0]; - last_bit_pos = (Word16) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); + last_bit_pos = extract_l( L_sub( ism_total_brate / FRAMES_PER_SEC, L_add( 1, SID_FORMAT_NBITS ) ) ); bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; + move16(); st0->next_bit_pos = 0; + move16(); /* reverse the bitstream for easier reading of indices */ - FOR ( i = 0; i < min( MAX_BITS_ISM_METADATA, last_bit_pos ); i++ ) + FOR( i = 0; i < s_min( MAX_BITS_ISM_METADATA, last_bit_pos ); i++ ) { bstr_meta[i] = st0->bit_stream[last_bit_pos - i]; + move16(); } st0->bit_stream = bstr_meta; st0->total_brate = ism_total_brate; /* needed for BER detection in get_next_indice() */ + move32(); - IF ( !bfi ) + IF( !bfi ) { /*----------------------------------------------------------------* * ISm common signaling @@ -2039,12 +2147,13 @@ void ivas_ism_metadata_sid_dec_fx( /* number of objects was already read in ivas_ism_get_dtx_dec() */ /* update the position in the bitstream */ - st0->next_bit_pos += nchan_ism; + st0->next_bit_pos = add( st0->next_bit_pos, nchan_ism ); /* read SID metadata flag( one per object ) */ - FOR ( ch = 0; ch < nchan_ism; ch++ ) + FOR( ch = 0; ch < nchan_ism; ch++ ) { md_diff_flag[ch] = get_next_indice_fx( st0, 1 ); + move16(); } /*----------------------------------------------------------------* @@ -2058,35 +2167,39 @@ void ivas_ism_metadata_sid_dec_fx( *----------------------------------------------------------------*/ *flag_noisy_speech = 0; + move16(); *sce_id_dtx = 0; + move16(); /* read ISM mode flag to explicitly signal number of spatial parameters */ - IF ( nchan_ism > 2 ) + IF( GT_16( nchan_ism, 2 ) ) { idx = get_next_indice_fx( st0, 1 ); - ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + ism_mode_bstr = (ISM_MODE) add( idx, 1 ); /* note: ISM mode was already read and used for configuration in in ivas_ism_dtx_dec() */ - IF ( ism_mode_bstr == ISM_MODE_PARAM ) + IF( EQ_32( ism_mode_bstr, ISM_MODE_PARAM ) ) { /* read noisy speech flag */ *flag_noisy_speech = get_next_indice_fx( st0, 1 ); nBits_sce_id = 1; + move16(); } } - IF ( nchan_transport > 1 ) + IF( GT_16( nchan_transport, 1 ) ) { /* read sce id */ *sce_id_dtx = get_next_indice_fx( st0, nBits_sce_id ); /* decode the coherence */ - FOR ( ch = 0; ch < nchan_transport; ch++ ) + FOR( ch = 0; ch < nchan_transport; ch++ ) { - IF ( ch == *sce_id_dtx ) + IF( EQ_16( ch, *sce_id_dtx ) ) { hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx = 32767; - continue; + move16(); + CONTINUE; } idx = get_next_indice_fx( st0, nBits_coh ); @@ -2094,19 +2207,20 @@ void ivas_ism_metadata_sid_dec_fx( } } - IF ( ism_mode == ISM_MODE_PARAM ) + IF( EQ_32( ism_mode, ISM_MODE_PARAM ) ) { hSCE[*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx = hSCE[!*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx; + move16(); } /*----------------------------------------------------------------* * Metadata decoding and dequantization, loop over all objects *----------------------------------------------------------------*/ - FOR ( ch = 0; ch < nchan_ism; ch++ ) + FOR( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; - IF ( md_diff_flag[ch] == 1 ) + IF( EQ_16( md_diff_flag[ch], 1 ) ) { /* Azimuth decoding */ idx_azimuth = get_next_indice_fx( st0, nBits_azimuth ); @@ -2117,29 +2231,33 @@ void ivas_ism_metadata_sid_dec_fx( hIsmMetaData->elevation_fx = ism_dequant_meta_fx( idx_elevation, ism_elevation_borders_fx, q_step_fx, q_step_border_fx, 1 << nBits_elevation ); /* update last indexes to correspond to active frames coding */ - IF ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + IF( GT_16( nBits_azimuth, ISM_AZIMUTH_NBITS ) ) { - hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->position_angle.last_angle2_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + hIsmMetaData->position_angle.last_angle1_idx = shr( idx_azimuth, sub( nBits_azimuth, ISM_AZIMUTH_NBITS ) ); + hIsmMetaData->position_angle.last_angle2_idx = shr( idx_elevation, sub( nBits_elevation, ISM_ELEVATION_NBITS ) ); } ELSE { - hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + hIsmMetaData->position_angle.last_angle1_idx = shl( idx_azimuth, sub( ISM_AZIMUTH_NBITS, nBits_azimuth ) ); + hIsmMetaData->position_angle.last_angle2_idx = shl( idx_elevation, sub( ISM_ELEVATION_NBITS, nBits_elevation ) ); } /* save for smoothing metadata evolution */ hIsmMetaData->last_true_azimuth_fx = hIsmMetaData->azimuth_fx; + move32(); hIsmMetaData->last_true_elevation_fx = hIsmMetaData->elevation_fx; + move32(); } } /* take into account padding bits as metadata bits to keep later bitrate checks valid */ nb_bits_metadata[*sce_id_dtx] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + move16(); /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; + move16(); } /* smooth the metadata evolution */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 7aa01f581..f0cb016a4 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1770,7 +1770,7 @@ ivas_error ivas_jbm_dec_tc( ELSE IF( st_ivas->mc_mode == MC_MODE_PARAMMC ) { /* read Parametric MC parameters from the bitstream */ - ivas_param_mc_dec_read_BS( ivas_total_brate, st, st_ivas->hParamMC, &nb_bits_metadata[0] ); + ivas_param_mc_dec_read_BS_fx( ivas_total_brate, st, st_ivas->hParamMC, &nb_bits_metadata[0] ); IF( EQ_16( st_ivas->nCPE, 1 ) ) { @@ -3822,13 +3822,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( // f2me_buf(st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, &st_ivas->hParamMC->ls_conv_dmx_e, nchan_out_cov * nchan_out_transport); //} - floatToFixed_arr(st_ivas->hParamMC->icld_q, st_ivas->hParamMC->icld_q_fx, 8, st_ivas->hParamMC->hMetadataPMC->num_parameter_bands * st_ivas->hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe); - - FOR(Word16 lp = 0; lp < st_ivas->hParamMC->hMetadataPMC->num_parameter_bands * st_ivas->hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; lp++) - { - st_ivas->hParamMC->icc_q_fx[lp] = (Word16)(st_ivas->hParamMC->icc_q[lp] * 32767); - } - FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) { f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], nchan_transport * nchan_transport); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b37dd203f..006a9240a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -61,68 +61,55 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static Word16 rint_fx( Word32 num ); - +#ifndef IVAS_FLOAT_FIXED static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); -#ifdef IVAS_FLOAT_FIXED -static void index_16bits_fx( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); -#endif static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const int16_t nchan_transport ); -#ifdef IVAS_FLOAT_FIXED -static void create_masa_ext_out_meta_fx( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const Word16 nchan_transport ); -#endif static void replicate_subframes( IVAS_QMETADATA_HANDLE hQMetaData ); -#ifdef IVAS_FLOAT_FIXED -static void replicate_subframes_fx( IVAS_QMETADATA_HANDLE hQMetaData ); -#endif static void restore_lowbitrate_masa( IVAS_QMETADATA_HANDLE hQMetaData, const int16_t low_bitrate_mode, const int16_t numCodingBands ); -#ifdef IVAS_FLOAT_FIXED -static void restore_lowbitrate_masa_fx( IVAS_QMETADATA_HANDLE hQMetaData, const Word16 low_bitrate_mode, const Word16 numCodingBands ); -#endif -#ifndef IVAS_FLOAT_FIXED static ivas_error init_lfe_synth_data( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); -#else -static ivas_error init_lfe_synth_data_fx( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); -#endif static void compute_foa_cov_matrix( float foaCov[FOA_CHANNELS][FOA_CHANNELS], float inCov[FOA_CHANNELS][FOA_CHANNELS], float mixMtx[FOA_CHANNELS][FOA_CHANNELS] ); -#ifdef IVAS_FLOAT_FIXED -static void compute_foa_cov_matrix_fx(Word32 foaCov_fx[FOA_CHANNELS][FOA_CHANNELS], Word32 inCov_fx[FOA_CHANNELS][FOA_CHANNELS], Word32 mixMtx_fx[FOA_CHANNELS][FOA_CHANNELS]); -#endif -#ifndef IVAS_FLOAT_FIXED static int16_t decode_lfe_to_total_energy_ratio( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, uint16_t *bitstream, int16_t *index, const int32_t ivas_total_brate ); -#else -static Word16 decode_lfe_to_total_energy_ratio_fx( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, uint16_t *bitstream, int16_t *index, const int32_t ivas_total_brate ); -#endif static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas ); -#ifdef IVAS_FLOAT_FIXED +static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp, const int16_t dirac_bs_md_write_idx, const int16_t dirac_md_buffer_length ); + +static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, const int16_t nchan_ism, const int16_t K ); + +static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t nbands, const int16_t nblocks, const int16_t idx_separated_object ); + +static void read_ism_ratio_index( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], uint16_t *bit_stream, int16_t *next_bit_pos, float *masa_to_total_energy_ratio, const int16_t idx_sep_obj, int16_t *num_zeros ); +#else +static Word16 rint_fx( Word32 num ); + +static void index_16bits_fx( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); + +static void create_masa_ext_out_meta_fx( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const Word16 nchan_transport ); + +static void replicate_subframes_fx( IVAS_QMETADATA_HANDLE hQMetaData ); + +static void restore_lowbitrate_masa_fx( IVAS_QMETADATA_HANDLE hQMetaData, const Word16 low_bitrate_mode, const Word16 numCodingBands ); + +static ivas_error init_lfe_synth_data_fx( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); + +static void compute_foa_cov_matrix_fx( Word32 foaCov_fx[FOA_CHANNELS][FOA_CHANNELS], Word32 inCov_fx[FOA_CHANNELS][FOA_CHANNELS], Word32 mixMtx_fx[FOA_CHANNELS][FOA_CHANNELS] ); + +static Word16 decode_lfe_to_total_energy_ratio_fx( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, uint16_t *bitstream, int16_t *index, const int32_t ivas_total_brate ); + static ivas_error ivas_masa_dec_config_fx( Decoder_Struct *st_ivas ); -#endif -static int16_t ivas_decode_masaism_metadata( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const int16_t nchan_ism, uint16_t *bit_stream, int16_t *next_bit_pos, const int16_t idx_separated_object, const int16_t ism_imp, const int16_t dirac_bs_md_write_idx, const int16_t dirac_md_buffer_length ); -#ifdef IVAS_FLOAT_FIXED static Word16 ivas_decode_masaism_metadata_fx( IVAS_QMETADATA_HANDLE hQMetaData, MASA_DECODER_HANDLE hMasa, MASA_ISM_DATA_HANDLE hMasaIsmData, const Word16 nchan_ism, UWord16 *bit_stream, Word16 *next_bit_pos, const Word16 idx_separated_object, const Word16 ism_imp, const Word16 dirac_bs_md_write_idx, const Word16 dirac_md_buffer_length ); -#endif -static void decode_index_slice( int16_t index, int16_t *ratio_idx_ism, const int16_t nchan_ism, const int16_t K ); -#ifdef IVAS_FLOAT_FIXED static void decode_index_slice_fx( Word16 index, Word16 *ratio_idx_ism, const Word16 nchan_ism, const Word16 K ); -#endif -static void decode_ism_ratios( uint16_t *bit_stream, int16_t *next_bit_pos, float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t nbands, const int16_t nblocks, const int16_t idx_separated_object ); -#ifdef IVAS_FLOAT_FIXED static void decode_ism_ratios_fx( UWord16 *bit_stream, Word16 *next_bit_pos, const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 nbands, const Word16 nblocks, const Word16 idx_separated_object ); -#endif -static void read_ism_ratio_index( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const int16_t nchan_ism, const int16_t numCodingBands, const int16_t sf, int16_t ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], uint16_t *bit_stream, int16_t *next_bit_pos, float *masa_to_total_energy_ratio, const int16_t idx_sep_obj, int16_t *num_zeros ); -#ifdef IVAS_FLOAT_FIXED static void read_ism_ratio_index_fx( Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 numCodingBands, const Word16 sf, Word16 ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], UWord16 *bit_stream, Word16 *next_bit_pos, const Word32 *masa_to_total_energy_ratio_fx, const Word16 idx_sep_obj, Word16 *num_zeros ); #endif @@ -635,6 +622,7 @@ ivas_error ivas_masa_decode_fx( low_bitrate_mode = -1; /* This means that LBR mode is not used. */ move16(); + test(); test(); test(); IF( st_ivas->hOutSetup.separateChannelEnabled || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) @@ -651,6 +639,7 @@ ivas_error ivas_masa_decode_fx( hMasa = st_ivas->hMasa; hQMetaData = st_ivas->hQMetaData; ivas_format = st_ivas->ivas_format; + move32(); hMasa->data.dir_decode_quality_fx = ONE_IN_Q14; /* Set to default of max quality */ move16(); @@ -670,22 +659,21 @@ ivas_error ivas_masa_decode_fx( IF( EQ_32( masa_brate, IVAS_SID_5k2 ) ) { - // st->next_bit_pos = (int16_t) ( ( masa_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); st->next_bit_pos = sub( sub( tmp, 1 ), SID_FORMAT_NBITS ); } ELSE { - // st->next_bit_pos = (int16_t) ( ( masa_brate / FRAMES_PER_SEC ) - 1 ); st->next_bit_pos = sub( tmp, 1 ); } + test(); + test(); test(); test(); test(); IF( EQ_16( st->bfi, 0 ) && GT_32( ivas_total_brate, IVAS_SID_5k2 ) ) { test(); - // IF ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) IF( NE_16( ivas_format, MC_FORMAT ) || NE_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { IF( NE_16( ivas_format, MASA_ISM_FORMAT ) ) @@ -696,6 +684,7 @@ ivas_error ivas_masa_decode_fx( *nb_bits_read = add( *nb_bits_read, MASA_TRANSP_BITS ); } + test(); IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) && NE_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) { /* the number of objects was read */ @@ -707,8 +696,9 @@ ivas_error ivas_masa_decode_fx( /* read index of separated object */ /* nchan_ism should be > 1*/ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, 1 ); - st_ivas->hMasaIsmData->idx_separated_ism = 2 * byteBuffer + st->bit_stream[( st->next_bit_pos )--]; + st_ivas->hMasaIsmData->idx_separated_ism = extract_l( L_add( L_shl( byteBuffer, 1 ), st->bit_stream[( st->next_bit_pos )--] ) ); *nb_bits_read = add( *nb_bits_read, 1 ); } ELSE @@ -726,6 +716,7 @@ ivas_error ivas_masa_decode_fx( FOR( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) { byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, 1 ); ism_imp = add( shl( ism_imp, 1 ), (Word16) byteBuffer ); } @@ -740,6 +731,7 @@ ivas_error ivas_masa_decode_fx( FOR( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) { byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, 1 ); ism_imp = add( shl( ism_imp, 1 ), (Word16) byteBuffer ); } @@ -755,8 +747,10 @@ ivas_error ivas_masa_decode_fx( { /* read flags */ st_ivas->hIsmMetaData[0]->ism_md_null_flag = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, ISM_METADATA_MD_FLAG_BITS ); st_ivas->hIsmMetaData[0]->ism_md_lowrate_flag = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, ISM_METADATA_INACTIVE_FLAG_BITS ); } } @@ -769,6 +763,7 @@ ivas_error ivas_masa_decode_fx( FOR( i = 0; i < ISM_METADATA_FLAG_BITS; i++ ) { byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, 1 ); ism_imp = add( shl( ism_imp, 1 ), (Word16) byteBuffer ); } @@ -784,13 +779,16 @@ ivas_error ivas_masa_decode_fx( { /* read flags */ st_ivas->hIsmMetaData[ch]->ism_md_null_flag = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, ISM_METADATA_MD_FLAG_BITS ); st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, ISM_METADATA_INACTIVE_FLAG_BITS ); } } st_ivas->flag_omasa_brate = 0; move16(); + test(); IF( GE_16( st_ivas->nchan_ism, 3 ) && EQ_32( ivas_total_brate, IVAS_128k ) ) { st_ivas->flag_omasa_brate = st->bit_stream[( st->next_bit_pos )--]; @@ -802,7 +800,8 @@ ivas_error ivas_masa_decode_fx( /* read the MASA_ISM_FORMAT bit */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; - IF( byteBuffer == 1 ) + move16(); + IF( EQ_32( byteBuffer, 1 ) ) { hMasa->config.input_ivas_format = MASA_ISM_FORMAT; } @@ -810,14 +809,16 @@ ivas_error ivas_masa_decode_fx( { hMasa->config.input_ivas_format = MASA_FORMAT; } - move16(); + move32(); /* reserved bit */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, MASA_HEADER_BITS ); /* read number of directions */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, 1 ); hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 ); } @@ -826,11 +827,12 @@ ivas_error ivas_masa_decode_fx( hMasa->config.numberOfDirections = 1; } - // IF ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + test(); IF( NE_16( ivas_format, MC_FORMAT ) || NE_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { /* read subframe mode */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, 1 ); hMasa->config.joinedSubframes = (uint8_t) byteBuffer; } @@ -851,10 +853,12 @@ ivas_error ivas_masa_decode_fx( } /* If we are under metadata bit budget limit and joined subframes is not signalled, then read LBR mode. */ - IF( hMasa->config.max_metadata_bits < MINIMUM_BIT_BUDGET_NORMAL_META && hMasa->config.joinedSubframes == FALSE ) + test(); + IF( LT_32( hMasa->config.max_metadata_bits, MINIMUM_BIT_BUDGET_NORMAL_META ) && EQ_16( hMasa->config.joinedSubframes, FALSE ) ) { /* read low bitrate mode */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; + move16(); *nb_bits_read = add( *nb_bits_read, 1 ); low_bitrate_mode = byteBuffer; move16(); @@ -910,6 +914,7 @@ ivas_error ivas_masa_decode_fx( masa_total_brate = ivas_total_brate; move32(); + test(); IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { masa_total_brate = calculate_cpe_brate_MASA_ISM_fx( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); @@ -994,6 +999,7 @@ ivas_error ivas_masa_decode_fx( hQMetaData->q_direction->cfg.nblocks = 4; move16(); + test(); IF( EQ_16( ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { hQMetaData->q_direction->cfg.mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); @@ -1064,6 +1070,7 @@ ivas_error ivas_masa_decode_fx( { st_ivas->hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] = L_sub( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b], st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][meta_write_index][b] ); + move32(); } } } @@ -1075,6 +1082,7 @@ ivas_error ivas_masa_decode_fx( FOR( b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++ ) { st_ivas->hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] = L_max( 0, st_ivas->hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] ); + move32(); } } } @@ -1088,6 +1096,8 @@ ivas_error ivas_masa_decode_fx( Word32 cpe_brate; cpe_brate = calculate_cpe_brate_MASA_ISM_fx( st_ivas->ism_mode, ivas_total_brate, st_ivas->nchan_ism ); + test(); + test(); IF( EQ_16( st_ivas->nCPE, 1 ) && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) { IF( LT_32( cpe_brate, MASA_STEREO_MIN_BITRATE ) ) @@ -1110,6 +1120,8 @@ ivas_error ivas_masa_decode_fx( } ELSE { + test(); + test(); test(); IF( EQ_16( ivas_format, MASA_FORMAT ) && EQ_16( st_ivas->nCPE, 1 ) && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) { @@ -1132,6 +1144,7 @@ ivas_error ivas_masa_decode_fx( } } + test(); IF( EQ_16( ivas_format, MASA_FORMAT ) && EQ_16( st_ivas->nCPE, 1 ) ) { st_ivas->hCPE[0]->hCoreCoder[0]->masa_sid_format = 0; @@ -1157,62 +1170,6 @@ ivas_error ivas_masa_decode_fx( create_masa_ext_out_meta_fx( hMasa, hQMetaData, st_ivas->nchan_transport ); } -#if 0 /* fix to float */ - if ( st_ivas->hSpatParamRendCom != NULL ) - { - for ( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - for ( int j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++ ) - { - st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - IF( hQMetaData->no_directions == 2 ) - { - st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15 ); - } - st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15 ); - st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15 ); - } - } - } - for ( int d = 0; d < max( hMasa->config.numberOfDirections, hQMetaData->no_directions ); d++ ) - { - FOR( Word16 j = 0; j < max( hMasa->config.numCodingBands, hQMetaData->q_direction[0].cfg.nbands ); j++ ) - { - FOR( Word16 k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) - { - - hQMetaData->q_direction[d].band_data[j].elevation[k] = fix_to_float( hQMetaData->q_direction[d].band_data[j].elevation_fx[k], Q22 ); - hQMetaData->q_direction[d].band_data[j].azimuth[k] = fix_to_float( hQMetaData->q_direction[d].band_data[j].azimuth_fx[k], Q22 ); - hQMetaData->q_direction[d].band_data[j].energy_ratio[k] = fix_to_float( hQMetaData->q_direction[d].band_data[j].energy_ratio_fx[k], Q30 ); - } - } - } - hMasa->data.dir_decode_quality = fix16_to_float( hMasa->data.dir_decode_quality_fx, Q14 ); - if ( hMasa->hMasaLfeSynth != NULL ) - { - for ( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio[j] = fix16_to_float( hMasa->hMasaLfeSynth->lfeToTotalEnergyRatio_fx[j], Q14 ); - } - } - IF( st_ivas->hSpatParamRendCom != NULL ) - { - FOR( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) - { - FOR( Word16 block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - Word16 meta_write_index = add( dirac_bs_md_write_idx, block ) % st_ivas->hSpatParamRendCom->dirac_md_buffer_length; - FOR( Word16 b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++ ) - { - st_ivas->hMasaIsmData->energy_ratio_ism[i][meta_write_index][b] = fix_to_float( st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][meta_write_index][b], Q30 ); - } - } - } - } -#endif - return error /* *nb_bits_read*/; } #endif @@ -1223,6 +1180,7 @@ ivas_error ivas_masa_decode_fx( * * *-------------------------------------------------------------------*/ + #ifndef IVAS_FLOAT_FIXED ivas_error ivas_masa_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ @@ -1317,11 +1275,7 @@ ivas_error ivas_masa_dec_open( nchan_to_allocate++; } -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1329,7 +1283,6 @@ ivas_error ivas_masa_dec_open( return error; } - #else ivas_error ivas_masa_dec_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ @@ -1342,7 +1295,7 @@ ivas_error ivas_masa_dec_open_fx( error = IVAS_ERR_OK; - IF ( ( hMasa = (MASA_DECODER_HANDLE) malloc( sizeof( MASA_DECODER ) ) ) == NULL ) + IF( ( hMasa = (MASA_DECODER_HANDLE) malloc( sizeof( MASA_DECODER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } @@ -1350,12 +1303,15 @@ ivas_error ivas_masa_dec_open_fx( ism_total_brate = 0; move32(); - test(); test(); test(); test(); - IF ( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && GT_16( st_ivas->nSCE, 0 ) && ( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) ) + test(); + test(); + test(); + test(); + IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && GT_16( st_ivas->nSCE, 0 ) && ( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) ) { - FOR ( i = 0; i < st_ivas->nSCE; i++ ) + FOR( i = 0; i < st_ivas->nSCE; i++ ) { - ism_total_brate = L_add(ism_total_brate, st_ivas->hSCE[i]->element_brate); + ism_total_brate = L_add( ism_total_brate, st_ivas->hSCE[i]->element_brate ); } } @@ -1367,16 +1323,16 @@ ivas_error ivas_masa_dec_open_fx( hMasa->config.joinedSubframes = FALSE; /* Create spherical grid only for external output */ - IF ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { - IF ( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + IF( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } generate_gridEq_fx( hMasa->data.sph_grid16 ); - IF ( ( hMasa->data.extOutMeta = (MASA_DECODER_EXT_OUT_META *) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) + IF( ( hMasa->data.extOutMeta = (MASA_DECODER_EXT_OUT_META *) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } @@ -1387,7 +1343,7 @@ ivas_error ivas_masa_dec_open_fx( hMasa->data.extOutMeta = NULL; } - IF ( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) + IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { error = init_lfe_synth_data_fx( st_ivas, hMasa ); } @@ -1399,8 +1355,11 @@ ivas_error ivas_masa_dec_open_fx( st_ivas->hMasa = hMasa; /* allocate transport channels*/ - test(); test(); test(); test(); - IF ( st_ivas->hTcBuffer == NULL && NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) && NE_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) + test(); + test(); + test(); + test(); + IF( st_ivas->hTcBuffer == NULL && NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) && NE_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { Word16 nchan_to_allocate, nchan_transport; TC_BUFFER_MODE buffer_mode; @@ -1410,12 +1369,12 @@ ivas_error ivas_masa_dec_open_fx( test(); test(); test(); - IF ( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) ) + IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) ) { buffer_mode = TC_BUFFER_MODE_BUFFER; move16(); } - ELSE IF ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) { buffer_mode = TC_BUFFER_MODE_BUFFER; move16(); @@ -1427,20 +1386,20 @@ ivas_error ivas_masa_dec_open_fx( test(); test(); - IF ( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) + IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) { nchan_transport = 1; move16(); nchan_to_allocate = 1; move16(); } - ELSE IF ( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( st_ivas->renderer_type, RENDERER_DIRAC ) ) + ELSE IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( st_ivas->renderer_type, RENDERER_DIRAC ) ) { /* addtl channel for CNG */ nchan_to_allocate = add( nchan_to_allocate, 1 ); } - IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1450,11 +1409,13 @@ ivas_error ivas_masa_dec_open_fx( } #endif + /*-----------------------------------------------------------------------* * ivas_masa_dec_close() * * close MASA decoder *-----------------------------------------------------------------------*/ + #ifndef IVAS_FLOAT_FIXED void ivas_masa_dec_close( MASA_DECODER_HANDLE *hMasa_out /* i/o: MASA metadata structure */ @@ -1513,7 +1474,6 @@ void ivas_masa_dec_close( return; } - #else void ivas_masa_dec_close_fx( MASA_DECODER_HANDLE *hMasa_out /* i/o: MASA metadata structure */ @@ -1521,7 +1481,8 @@ void ivas_masa_dec_close_fx( { MASA_DECODER_HANDLE hMasa; - IF ( hMasa_out == NULL || *hMasa_out == NULL ) + test(); + IF( hMasa_out == NULL || *hMasa_out == NULL ) { return; } @@ -1529,36 +1490,36 @@ void ivas_masa_dec_close_fx( hMasa = *hMasa_out; /* Free spherical grid memory if in use */ - IF ( hMasa->data.sph_grid16 != NULL ) + IF( hMasa->data.sph_grid16 != NULL ) { free( hMasa->data.sph_grid16 ); hMasa->data.sph_grid16 = NULL; } - IF ( hMasa->data.extOutMeta != NULL ) + IF( hMasa->data.extOutMeta != NULL ) { free( hMasa->data.extOutMeta ); hMasa->data.extOutMeta = NULL; } - IF ( hMasa->hMasaLfeSynth != NULL ) + IF( hMasa->hMasaLfeSynth != NULL ) { - IF ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx != NULL ) + IF( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx != NULL ) { free( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx ); hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx = NULL; } - IF ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx != NULL ) + IF( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx != NULL ) { free( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx ); hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx = NULL; } - IF ( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx != NULL ) + IF( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx != NULL ) { free( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx ); hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx = NULL; } - IF ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx != NULL ) + IF( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx != NULL ) { free( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx ); hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = NULL; @@ -1574,12 +1535,14 @@ void ivas_masa_dec_close_fx( } #endif + /*-------------------------------------------------------------------* * ivas_masa_dec_config() * * Frame-by-frame configuration of MASA decoder *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static ivas_error ivas_masa_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) @@ -1679,8 +1642,7 @@ static ivas_error ivas_masa_dec_config( return error; } - -#ifdef IVAS_FLOAT_FIXED +#else static ivas_error ivas_masa_dec_config_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) @@ -1696,24 +1658,25 @@ static ivas_error ivas_masa_dec_config_fx( hMasa = st_ivas->hMasa; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + move32(); ism_total_brate = 0; - move16(); + move32(); test(); test(); test(); test(); - IF ( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && GT_16( st_ivas->nSCE, 0 ) && ( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) ) + IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && GT_16( st_ivas->nSCE, 0 ) && ( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) ) { - FOR ( i = 0; i < st_ivas->nSCE; i++ ) + FOR( i = 0; i < st_ivas->nSCE; i++ ) { - ism_total_brate = L_add(ism_total_brate, st_ivas->hSCE[i]->element_brate); + ism_total_brate = L_add( ism_total_brate, st_ivas->hSCE[i]->element_brate ); } } ivas_masa_set_elements_fx( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); - IF ( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) + IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { ivas_masa_set_coding_config_fx( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hCPE[0]->element_brate, st_ivas->nchan_transport, MC_MODE_NONE ); } @@ -1724,14 +1687,14 @@ static ivas_error ivas_masa_dec_config_fx( test(); test(); - IF ( ( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_512k ) ) + IF( ( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_512k ) ) { hMasa->config.mergeRatiosOverSubframes = 0; /* initialize spherical grid */ - IF ( hMasa->data.sph_grid16 == NULL ) + IF( hMasa->data.sph_grid16 == NULL ) { - IF ( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + IF( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA data handle\n" ) ); } @@ -1746,7 +1709,7 @@ static ivas_error ivas_masa_dec_config_fx( move16(); /* TODO: use fixed version of this function call */ - IF ( ( error = ivas_qmetadata_allocate_memory( st_ivas->hQMetaData, hMasa->config.numCodingBands, hMasa->config.numberOfDirections, hMasa->config.useCoherence ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_qmetadata_allocate_memory( st_ivas->hQMetaData, hMasa->config.numCodingBands, hMasa->config.numberOfDirections, hMasa->config.useCoherence ) ) != IVAS_ERR_OK ) { return error; } @@ -1755,35 +1718,38 @@ static ivas_error ivas_masa_dec_config_fx( st_ivas->hQMetaData->useLowerRes = 0; move16(); - FOR ( i = 0; i < st_ivas->hQMetaData->no_directions; i++ ) + FOR( i = 0; i < st_ivas->hQMetaData->no_directions; i++ ) { st_ivas->hQMetaData->q_direction[i].cfg.nbands = hMasa->config.numCodingBands; - st_ivas->hQMetaData->q_direction[i].cfg.nblocks = hMasa->config.joinedSubframes == TRUE ? 1 : 4; + move16(); + st_ivas->hQMetaData->q_direction[i].cfg.nblocks = EQ_16( hMasa->config.joinedSubframes, TRUE ) ? 1 : 4; + move16(); test(); - IF ( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) + IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { st_ivas->hQMetaData->q_direction[i].cfg.mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); } ELSE { st_ivas->hQMetaData->q_direction[i].cfg.mc_ls_setup = MC_LS_SETUP_INVALID; + move32(); } } ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); /* Find maximum band usable */ - maxBin = (Word16) Mpy_32_32( st_ivas->hDecoderConfig->output_Fs, INV_CLDFB_BANDWIDTH_Q31 ); + maxBin = extract_l( Mpy_32_32( st_ivas->hDecoderConfig->output_Fs, INV_CLDFB_BANDWIDTH_Q31 ) ); maxBand = 0; move16(); - WHILE ( maxBand <= MASA_FREQUENCY_BANDS && LE_16( MASA_band_grouping_24[maxBand], maxBin ) ) + WHILE( LE_16( maxBand, MASA_FREQUENCY_BANDS ) && LE_16( MASA_band_grouping_24[maxBand], maxBin ) ) { maxBand++; } maxBand--; - IF ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ masa_sample_rate_band_correction_fx( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, maxBand, 0, hMasa->data.extOutMeta ); @@ -1795,10 +1761,10 @@ static ivas_error ivas_masa_dec_config_fx( return error; } - #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_masa_prerender() * @@ -1829,8 +1795,7 @@ void ivas_masa_prerender( return; } - -#ifdef IVAS_FLOAT_FIXED +#else /*-------------------------------------------------------------------* * ivas_masa_prerender_fx() * @@ -1838,11 +1803,11 @@ void ivas_masa_prerender( *-------------------------------------------------------------------*/ void ivas_masa_prerender_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output_fx[], /* i/o: synthesized core-coder transport channels */ - Word16 *q_shift, /* o : specifies how much the Q-factor of output has changed by. */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nchan_remapped /* i : number of transports used in core */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output_fx[], /* i/o: synthesized core-coder transport channels */ + Word16 *q_shift, /* o : specifies how much the Q-factor of output has changed by. */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nchan_remapped /* i : number of transports used in core */ ) { *q_shift = 0; @@ -1850,19 +1815,19 @@ void ivas_masa_prerender_fx( test(); test(); - IF ( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) && EQ_16( st_ivas->nchan_transport, 2 ) && EQ_16( nchan_remapped, 1) ) + IF( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) && EQ_16( st_ivas->nchan_transport, 2 ) && EQ_16( nchan_remapped, 1 ) ) { - IF ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { Copy32( output_fx[0], output_fx[1], output_frame ); /* Copy mono signal to stereo output channels */ } ELSE { test(); - IF ( EQ_16( st_ivas->renderer_type, RENDERER_DIRAC ) || EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) ) + IF( EQ_16( st_ivas->renderer_type, RENDERER_DIRAC ) || EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) ) { - v_multc_fixed( output_fx[0], SQRT2_FIXED, output_fx[0], output_frame ); /* q + 30 - 31 = q - 1*//* Gain transport signal when transmitting mono with cpe in order to match loudness */ - *q_shift = -1; /* Q has decreased by 1. */ + v_multc_fixed( output_fx[0], SQRT2_FIXED, output_fx[0], output_frame ); /* q + 30 - 31 = q - 1*/ /* Gain transport signal when transmitting mono with cpe in order to match loudness */ + *q_shift = -1; /* Q has decreased by 1. */ move16(); } } @@ -1877,6 +1842,7 @@ void ivas_masa_prerender_fx( * Local functions *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ) @@ -1898,8 +1864,7 @@ static void index_16bits( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void index_16bits_fx( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ) @@ -1926,6 +1891,7 @@ static void index_16bits_fx( /* Replicate subframe data when there is only one subframe sent */ +#ifndef IVAS_FLOAT_FIXED static void replicate_subframes( IVAS_QMETADATA_HANDLE hQMetaData ) { @@ -1941,18 +1907,9 @@ static void replicate_subframes( for ( dir = 0; dir < ndirs; dir++ ) { hQMetaData->q_direction[dir].band_data[band].azimuth[sf] = hQMetaData->q_direction[dir].band_data[band].azimuth[0]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[dir].band_data[band].azimuth_fx[sf] = hQMetaData->q_direction[dir].band_data[band].azimuth_fx[0]; -#endif hQMetaData->q_direction[dir].band_data[band].elevation[sf] = hQMetaData->q_direction[dir].band_data[band].elevation[0]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[dir].band_data[band].elevation_fx[sf] = hQMetaData->q_direction[dir].band_data[band].elevation_fx[0]; -#endif hQMetaData->q_direction[dir].band_data[band].spherical_index[sf] = hQMetaData->q_direction[dir].band_data[band].spherical_index[0]; hQMetaData->q_direction[dir].band_data[band].energy_ratio[sf] = hQMetaData->q_direction[dir].band_data[band].energy_ratio[0]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[dir].band_data[band].energy_ratio_fx[sf] = hQMetaData->q_direction[dir].band_data[band].energy_ratio_fx[0]; -#endif if ( hQMetaData->q_direction[dir].coherence_band_data != NULL ) { @@ -1969,9 +1926,7 @@ static void replicate_subframes( return; } - -#ifdef IVAS_FLOAT_FIXED -/* Replicate subframe data when there is only one subframe sent */ +#else static void replicate_subframes_fx( IVAS_QMETADATA_HANDLE hQMetaData ) { @@ -2014,6 +1969,8 @@ static void replicate_subframes_fx( } #endif + +#ifndef IVAS_FLOAT_FIXED static void restore_lowbitrate_masa( IVAS_QMETADATA_HANDLE hQMetaData, const int16_t low_bitrate_mode, @@ -2029,20 +1986,10 @@ static void restore_lowbitrate_masa( { for ( band = 0; band < numCodingBands; band++ ) { - hQMetaData->q_direction[0].band_data[band].azimuth[sf] = hQMetaData->q_direction[0].band_data[band].azimuth[0]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = hQMetaData->q_direction[0].band_data[band].azimuth_fx[0]; -#endif hQMetaData->q_direction[0].band_data[band].elevation[sf] = hQMetaData->q_direction[0].band_data[band].elevation[0]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = hQMetaData->q_direction[0].band_data[band].elevation_fx[0]; -#endif hQMetaData->q_direction[0].band_data[band].spherical_index[sf] = hQMetaData->q_direction[0].band_data[band].spherical_index[0]; hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = hQMetaData->q_direction[0].band_data[band].energy_ratio[0]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[sf] = hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[0]; -#endif if ( hQMetaData->q_direction[0].coherence_band_data != NULL ) { hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[0]; @@ -2064,18 +2011,9 @@ static void restore_lowbitrate_masa( for ( band = 1; band < numCodingBands; band++ ) { hQMetaData->q_direction[0].band_data[band].azimuth[sf] = hQMetaData->q_direction[0].band_data[0].azimuth[sf]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = hQMetaData->q_direction[0].band_data[0].azimuth_fx[sf]; -#endif hQMetaData->q_direction[0].band_data[band].elevation[sf] = hQMetaData->q_direction[0].band_data[0].elevation[sf]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = hQMetaData->q_direction[0].band_data[0].elevation_fx[sf]; -#endif hQMetaData->q_direction[0].band_data[band].spherical_index[sf] = hQMetaData->q_direction[0].band_data[0].spherical_index[sf]; hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = hQMetaData->q_direction[0].band_data[0].energy_ratio[sf]; -#ifdef IVAS_FLOAT_FIXED - hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[sf] = hQMetaData->q_direction[0].band_data[0].energy_ratio_fx[sf]; -#endif if ( hQMetaData->q_direction[0].coherence_band_data != NULL ) { hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hQMetaData->q_direction[0].coherence_band_data[0].spread_coherence[sf]; @@ -2091,8 +2029,7 @@ static void restore_lowbitrate_masa( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void restore_lowbitrate_masa_fx( IVAS_QMETADATA_HANDLE hQMetaData, const Word16 low_bitrate_mode, @@ -2297,7 +2234,7 @@ static ivas_error init_lfe_synth_data_fx( output_config = st_ivas->hDecoderConfig->output_config; move32(); - IF ( ( hMasa->hMasaLfeSynth = (MCMASA_LFE_SYNTH_DATA_HANDLE) malloc( sizeof( MCMASA_LFE_SYNTH_DATA ) ) ) == NULL ) + IF( ( hMasa->hMasaLfeSynth = (MCMASA_LFE_SYNTH_DATA_HANDLE) malloc( sizeof( MCMASA_LFE_SYNTH_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } @@ -2323,15 +2260,24 @@ static ivas_error init_lfe_synth_data_fx( hMasa->hMasaLfeSynth->lfeGainPrevIndex = 0; move16(); - test(); test(); test(); test(); test(); - test(); test(); test(); test(); test(); test(); - IF ( st_ivas->hOutSetup.separateChannelEnabled && - ( EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || - EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA3 ) || - ( EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GT_16( st_ivas->hOutSetup.num_lfe, 0 ) ) ) ) + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + IF( st_ivas->hOutSetup.separateChannelEnabled && + ( EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1 ) || + EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || + EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || + EQ_16( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || + EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA3 ) || + ( EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GT_16( st_ivas->hOutSetup.num_lfe, 0 ) ) ) ) { Word16 bufferSize; Word16 i; @@ -2340,18 +2286,18 @@ static ivas_error init_lfe_synth_data_fx( /* Ring buffer for the filterbank of the LFE synthesis. * The filterbank is using moving average lowpass filter with the crossover of 120 Hz. */ - tmp = BASOP_Util_Divide3232_Scale(output_Fs, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &tmp_e); - bufferSize = shr(tmp, sub(15, tmp_e)); // Q0 + tmp = BASOP_Util_Divide3232_Scale( output_Fs, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &tmp_e ); + bufferSize = shr( tmp, sub( 15, tmp_e ) ); // Q0 - IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx = ( Word32 * )malloc( bufferSize * sizeof( Word32 ) ) ) == NULL) + IF( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } set32_fx( hMasa->hMasaLfeSynth->lfeSynthRingBuffer_fx, 0, bufferSize ); hMasa->hMasaLfeSynth->ringBufferLoPointer = 0; move16(); - hMasa->hMasaLfeSynth->ringBufferHiPointer = shr(bufferSize, 1); + hMasa->hMasaLfeSynth->ringBufferHiPointer = shr( bufferSize, 1 ); hMasa->hMasaLfeSynth->lowpassSum_fx = 0; move16(); hMasa->hMasaLfeSynth->ringBufferSize = bufferSize; @@ -2361,7 +2307,7 @@ static ivas_error init_lfe_synth_data_fx( * Moving average lowpass filter with the crossover of 240 Hz. */ bufferSize = shr( bufferSize, 1 ); - IF ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) + IF( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } @@ -2375,8 +2321,8 @@ static ivas_error init_lfe_synth_data_fx( move16(); /* Delay buffer for matching the delay of the lowpass filter */ - bufferSize = shr(bufferSize, 1); /* The delay of the moving average lowpass filter is bufferSize / 2 */ - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) + bufferSize = shr( bufferSize, 1 ); /* The delay of the moving average lowpass filter is bufferSize / 2 */ + IF( ( hMasa->hMasaLfeSynth->delayBuffer_syncLp_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } @@ -2385,8 +2331,8 @@ static ivas_error init_lfe_synth_data_fx( move16(); /* Delay buffer for syncing with DirAC rendering */ - bufferSize = sub(sub(NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ), shr(hMasa->hMasaLfeSynth->ringBufferSize, 1)), shr(hMasa->hMasaLfeSynth->ringBufferSize2, 1)); - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) + bufferSize = sub( sub( NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ), shr( hMasa->hMasaLfeSynth->ringBufferSize, 1 ) ), shr( hMasa->hMasaLfeSynth->ringBufferSize2, 1 ) ); + IF( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } @@ -2400,21 +2346,21 @@ static ivas_error init_lfe_synth_data_fx( hMasa->hMasaLfeSynth->transportGainPrev_fx = ONE_IN_Q15; move16(); - tmp = BASOP_Util_Divide3232_Scale(output_Fs, FRAMES_PER_SEC * CLDFB_NO_COL_MAX, &tmp_e); - slot_size = shr(tmp, sub(15, tmp_e)); // Q0 + tmp = BASOP_Util_Divide3232_Scale( output_Fs, FRAMES_PER_SEC * CLDFB_NO_COL_MAX, &tmp_e ); + slot_size = shr( tmp, sub( 15, tmp_e ) ); // Q0 - FOR ( i = 0; i < slot_size; i++ ) + FOR( i = 0; i < slot_size; i++ ) { hMasa->hMasaLfeSynth->interpolator_fx[i] = div_s( add( i, 1 ), slot_size ); } } - ELSE IF ( st_ivas->hOutSetup.separateChannelEnabled && EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16(st_ivas->hOutSetup.num_lfe, 0) ) + ELSE IF( st_ivas->hOutSetup.separateChannelEnabled && EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16( st_ivas->hOutSetup.num_lfe, 0 ) ) { Word16 bufferSize; /* Delay buffer for syncing with DirAC rendering */ bufferSize = NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ); - IF ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) + IF( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx = (Word32 *) malloc( bufferSize * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } @@ -2459,9 +2405,9 @@ static int16_t decode_lfe_to_total_energy_ratio( lfeBitsRead = 0; byteBuffer = bitstream[( *index )--]; lfeBitsRead += 1; - lfeToTotalEnergyRatioIndices[0] = byteBuffer; /* First LFE index */ + lfeToTotalEnergyRatioIndices[0] = byteBuffer; /* First LFE index */ - if ( ivas_total_brate == IVAS_13k2 ) /* 1-bit adaptive LFE gain quantizer at 13.2 kbps */ + if ( ivas_total_brate == IVAS_13k2 ) /* 1-bit adaptive LFE gain quantizer at 13.2 kbps */ { lfeToTotalEnergyRatioTemp = hMasaLfeSynth->lfeToTotalEnergyRatio[3]; /* Take memory from the last subframe */ if ( lfeToTotalEnergyRatioIndices[0] == 1 ) @@ -2710,11 +2656,12 @@ static Word16 decode_lfe_to_total_energy_ratio_fx( * * Reconfigure IVAS MASA decoder *-------------------------------------------------------------------*/ + #ifndef IVAS_FLOAT_FIXED ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t n, tmp, num_bits; @@ -2731,12 +2678,12 @@ ivas_error ivas_masa_dec_reconfigure( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; - if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity ) - { - mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; - } + if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity ) + { + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + } ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); @@ -2747,11 +2694,7 @@ ivas_error ivas_masa_dec_reconfigure( ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin == NULL ) ) { /* init a new DirAC dec */ -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2787,11 +2730,7 @@ ivas_error ivas_masa_dec_reconfigure( if ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2817,11 +2756,7 @@ ivas_error ivas_masa_dec_reconfigure( if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2833,11 +2768,7 @@ ivas_error ivas_masa_dec_reconfigure( if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin != NULL ) ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2847,12 +2778,8 @@ ivas_error ivas_masa_dec_reconfigure( if ( st_ivas->hDiracDecBin != NULL ) { - /* regularization factor is bitrate-dependent */ -#ifdef IVAS_FLOAT_FIXED - st_ivas->hDiracDecBin->reqularizationFactor_fx = configure_reqularization_factor_fx( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); -#else + /* regularization factor is bitrate-dependent */ st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); -#endif } if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) /* note: switching within OMASA is handled in ivas_omasa_dec_config() */ @@ -2891,11 +2818,7 @@ ivas_error ivas_masa_dec_reconfigure( } } -#ifdef IVAS_FLOAT_FIXED - ivas_masa_set_elements_fx( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); -#else ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); -#endif if ( st_ivas->ivas_format == MASA_FORMAT ) { @@ -2939,183 +2862,10 @@ ivas_error ivas_masa_dec_reconfigure( { if ( n_samples_granularity < st_ivas->hTcBuffer->n_samples_granularity ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*Float to fixed conversion*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; - if ( st_ivas->hIsmRendererData ) - { - FOR( Word16 ind1 = 0; ind1 < st_ivas->hIsmRendererData->interpolator_len; ind1++ ) - { - st_ivas->hIsmRendererData->interpolator_fx[ind1] = (Word16) L_min( 32767, floatToFixed( st_ivas->hIsmRendererData->interpolator_fx[ind1], 15 ) ); - } - } - FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) - { - if ( st_ivas->hIsmMetaData[ind1] ) - { - st_ivas->hIsmMetaData[ind1]->azimuth_fx = (Word32) ( st_ivas->hIsmMetaData[ind1]->azimuth * ( 1 << 22 ) ); - st_ivas->hIsmMetaData[ind1]->elevation_fx = (Word32) ( st_ivas->hIsmMetaData[ind1]->elevation * ( 1 << 22 ) ); - } - } - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } + return error; } - if ( st_ivas->hSbaIsmData ) - { - for ( Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++ ) - { - floatToFixed_arr32( st_ivas->hSbaIsmData->delayBuffer[ch_idx], st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], Q11, st_ivas->hSbaIsmData->delayBuffer_size ); - } - } - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in = 0, numch_out, num_md_sub_frames, q1 = 30, q2 = 30; - ; - Word16 numch_out_dirac = hDecoderConfig->nchan_out; - IF( hSpar ) - { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - hSpar->hMdDec->Q_mixer_mat = 30; -#if 0 - for ( int l = 0; l < numch_out; l++ ) - { - for ( int j = 0; j < numch_in; j++ ) - { - for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - { - hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - } - } - } - for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - } - } - } - } -#endif - for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); - } - } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] = float_to_fix( st_ivas->cldfbSynDec[out_ch]->cldfb_state[i], Q11 ); - } - } - } - } - Word16 n_tc; - if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for (int ch = 0; ch < n_tc; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } -#endif - if ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 /*Fixed to float */ - if ( hTcBuffer->tc_buffer ) - fixedToFloat_arrL( hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len ); - IF( hSpar ) - { - FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); - } - } -#if 0 - FOR( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - { - FOR( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - { - FOR( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - { - FOR( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - { - hSpar->hMdDec->mixer_mat_prev[m][j][k][l] = ( (float) hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] / ( 1 << q2 ) ); - } - } - } - } -#endif - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); /*Rounding off*/ - } - } - } - } - FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) - { - if ( st_ivas->hIsmMetaData[ind1] ) - { - st_ivas->hIsmMetaData[ind1]->azimuth = (float) ( st_ivas->hIsmMetaData[ind1]->azimuth_fx ) / (float) ( 1 << 22 ); - st_ivas->hIsmMetaData[ind1]->elevation = (float) ( st_ivas->hIsmMetaData[ind1]->elevation_fx ) / (float) ( 1 << 22 ); - } - } -#endif -#else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED } } } @@ -3154,8 +2904,6 @@ ivas_error ivas_masa_dec_reconfigure( return error; } - - #else /*-------------------------------------------------------------------* * ivas_masa_dec_reconfigure_fx() @@ -3186,6 +2934,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; move32(); + test(); IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) ) { Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); @@ -3200,6 +2949,9 @@ ivas_error ivas_masa_dec_reconfigure_fx( /* renderer might have changed, reselect */ ivas_renderer_select( st_ivas ); + test(); + test(); + test(); test(); test(); test(); @@ -3217,17 +2969,10 @@ ivas_error ivas_masa_dec_reconfigure_fx( IF( st_ivas->hDirAC != NULL ) { /* close all unnecessary parametric decoding and rendering */ -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_dec_close_binaural_data(&st_ivas->hDiracDecBin); - ivas_dirac_rend_close_fx(&(st_ivas->hDirACRend)); - ivas_spat_hSpatParamRendCom_close_fx(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close_fx(&(st_ivas->hDirAC)); -#else ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); - ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); -#endif + ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); } } /* possible reconfigure is done later */ @@ -3271,6 +3016,9 @@ ivas_error ivas_masa_dec_reconfigure_fx( tmp = shr( tmp, negate( add( 1, tmp_e ) ) ); num_bits = add( num_bits, tmp ); + test(); + test(); + test(); IF( ( EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) && st_ivas->hDiracDecBin != NULL ) { IF( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) @@ -3322,6 +3070,8 @@ ivas_error ivas_masa_dec_reconfigure_fx( st_ivas->hCPE[cpe_id]->nchan_out = 1; move16(); + test(); + test(); test(); test(); test(); @@ -3338,6 +3088,8 @@ ivas_error ivas_masa_dec_reconfigure_fx( st_ivas->hCPE[cpe_id]->nchan_out = CPE_CHANNELS; move16(); + test(); + test(); test(); test(); test(); @@ -3431,13 +3183,11 @@ ivas_error ivas_masa_dec_reconfigure_fx( { IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { - tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS + 2; - move16(); + tc_nchan_to_allocate = add( shl( BINAURAL_CHANNELS, 1 ), 2 ); } ELSE { - tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; - move16(); + tc_nchan_to_allocate = shl( BINAURAL_CHANNELS, 1 ); } test(); test(); @@ -3457,18 +3207,10 @@ ivas_error ivas_masa_dec_reconfigure_fx( { IF( LT_16( n_samples_granularity, st_ivas->hTcBuffer->n_samples_granularity ) ) { -#ifdef IVAS_FLOAT_FIXED - IF( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } -#else - IF( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } } } @@ -3488,6 +3230,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( } } + test(); IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) ) { Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); @@ -3502,9 +3245,9 @@ ivas_error ivas_masa_dec_reconfigure_fx( IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { Word16 granularityMultiplier = idiv1616( st_ivas->hTcBuffer->n_samples_granularity, st_ivas->hSpatParamRendCom->slot_size ); - FOR ( n = 0; n < MAX_JBM_SUBFRAMES_5MS; n++ ) + FOR( n = 0; n < MAX_JBM_SUBFRAMES_5MS; n++ ) { - st_ivas->hSpatParamRendCom->subframe_nbslots[n] = i_mult(st_ivas->hTcBuffer->subframe_nbslots[n], granularityMultiplier); + st_ivas->hSpatParamRendCom->subframe_nbslots[n] = i_mult( st_ivas->hTcBuffer->subframe_nbslots[n], granularityMultiplier ); move16(); } } @@ -3514,27 +3257,14 @@ ivas_error ivas_masa_dec_reconfigure_fx( } #endif -#ifdef IVAS_FLOAT_FIXED + /*-------------------------------------------------------------------* * ivas_spar_param_to_masa_param_mapping() * * Determine MASA metadata from the SPAR metadata *-------------------------------------------------------------------*/ -void fixedToFloat_arrL_check (Word32 *i, float *f, Word16 Q, Word16 l) -{ - for (int j = 0; j < l; j++) - { - float check = f[j]; - f[j] = fixedToFloat(i[j], Q); - float per = (check - f[j]) / check; - per = per * 100; - if (per > 5) - { - per = per; - } - } -} +#ifdef IVAS_FLOAT_FIXED void ivas_spar_param_to_masa_param_mapping_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -3588,12 +3318,17 @@ void ivas_spar_param_to_masa_param_mapping_fx( hDirAC = st_ivas->hDirAC; hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSpatParamRendCom->numParametricDirections = 1; + move16(); hSpatParamRendCom->numSimultaneousDirections = 1; + move16(); hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; nchan_transport = st_ivas->nchan_transport; + move16(); band_grouping = hDirAC->band_grouping; + move16(); hSpar = st_ivas->hSpar; dirac_write_idx = hSpatParamRendCom->render_to_md_map[subframe]; + move16(); /* Init arrays */ FOR( i = 0; i < FOA_CHANNELS; i++ ) @@ -3603,8 +3338,9 @@ void ivas_spar_param_to_masa_param_mapping_fx( /* Delay the SPAR mixing matrices to have them synced with the audio */ slot_idx_start = hSpar->slots_rendered; + move16(); slot_fac_fx = BASOP_Util_Divide3232_Scale( 1, hSpar->subframe_nbslots[subframe], &q_slot_fac ); - IF( q_slot_fac < 0 ) + IF( LT_16( q_slot_fac, 0 ) ) { slot_fac_fx = shr( slot_fac_fx, -1 * q_slot_fac ); } @@ -3612,9 +3348,9 @@ void ivas_spar_param_to_masa_param_mapping_fx( { sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; - IF( ( sf < SPAR_META_DELAY_SUBFRAMES ) ) + IF( LT_16( sf, SPAR_META_DELAY_SUBFRAMES ) ) { - mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; + mixer_mat_index = add( sf, add( sub( MAX_PARAM_SPATIAL_SUBFRAMES, SPAR_META_DELAY_SUBFRAMES ), 1 ) ); FOR( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { FOR( i = 0; i < FOA_CHANNELS; i++ ) @@ -3622,6 +3358,7 @@ void ivas_spar_param_to_masa_param_mapping_fx( FOR( j = 0; j < FOA_CHANNELS; j++ ) { mixer_mat_sf_bands_real_fx[band][i][j] = L_shl( Mpy_32_16_1( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[mixer_mat_index][i][j][band], slot_fac_fx ), 1 ); // 30//making q to 31 + move32(); } } } @@ -3636,6 +3373,7 @@ void ivas_spar_param_to_masa_param_mapping_fx( FOR( j = 0; j < FOA_CHANNELS; j++ ) { mixer_mat_sf_bands_real_fx[band][i][j] = L_shl( Mpy_32_16_1( st_ivas->hSpar->hMdDec->mixer_mat_fx[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS], slot_fac_fx ), 1 ); // 30//making q to 31 + move32(); } } } @@ -3644,10 +3382,13 @@ void ivas_spar_param_to_masa_param_mapping_fx( /* Map the mixing matrices from the frequency bands to frequency bins */ bin = 0; + move16(); FOR( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { band_start = band_grouping[band]; + move16(); band_end = band_grouping[band + 1]; + move16(); FOR( bin = band_start; bin < band_end; bin++ ) { FOR( i = 0; i < FOA_CHANNELS; i++ ) @@ -3655,16 +3396,18 @@ void ivas_spar_param_to_masa_param_mapping_fx( FOR( j = 0; j < FOA_CHANNELS; j++ ) { mixer_mat_sf_bins_real_fx[bin][i][j] = mixer_mat_sf_bands_real_fx[band][i][j]; // 31+q_slot_fac + move32(); } } } } nBins = bin; + move16(); /* Determine MASA metadata */ /* Determine transport signal energies and cross correlations when more than 1 TC */ - IF( nchan_transport == 2 ) + IF( EQ_16( nchan_transport, 2 ) ) { FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { @@ -3672,12 +3415,12 @@ void ivas_spar_param_to_masa_param_mapping_fx( { FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - instEne_fx = ( (Word64) L_shr_sat( inRe_fx[ch][slot][bin], (Word16) ( q_cldfb[ch][slot] - common_q ) ) * L_shr_sat( inRe_fx[ch][slot][bin], (Word16) ( q_cldfb[ch][slot] - common_q ) ) ); - instEne_fx += ( (Word64) L_shr_sat( inIm_fx[ch][slot][bin], (Word16) ( q_cldfb[ch][slot] - common_q ) ) * L_shr_sat( inIm_fx[ch][slot][bin], (Word16) ( q_cldfb[ch][slot] - common_q ) ) ); - transportSignalEnergies_64[ch][bin] += instEne_fx; + instEne_fx = (Word64) L_shr_sat( inRe_fx[ch][slot][bin], sub( q_cldfb[ch][slot], common_q ) ) * L_shr_sat( inRe_fx[ch][slot][bin], sub( q_cldfb[ch][slot], common_q ) ); + instEne_fx = W_add( instEne_fx, (Word64) L_shr_sat( inIm_fx[ch][slot][bin], sub( q_cldfb[ch][slot], common_q ) ) * L_shr_sat( inIm_fx[ch][slot][bin], sub( q_cldfb[ch][slot], common_q ) ) ); + transportSignalEnergies_64[ch][bin] = W_add( transportSignalEnergies_64[ch][bin], instEne_fx ); } - transportSignalCrossCorrelation_64[bin] += (Word64) L_shr_sat( inRe_fx[0][slot][bin], (Word16) ( q_cldfb[0][slot] - common_q ) ) * L_shr_sat( inRe_fx[1][slot][bin], (Word16) ( q_cldfb[0][slot] - common_q ) ); - transportSignalCrossCorrelation_64[bin] += (Word64) L_shr_sat( inIm_fx[0][slot][bin], (Word16) ( q_cldfb[0][slot] - common_q ) ) * L_shr_sat( inIm_fx[1][slot][bin], (Word16) ( q_cldfb[0][slot] - common_q ) ); + transportSignalCrossCorrelation_64[bin] = W_add( transportSignalCrossCorrelation_64[bin], (Word64) L_shr_sat( inRe_fx[0][slot][bin], sub( q_cldfb[0][slot], common_q ) ) * L_shr_sat( inRe_fx[1][slot][bin], sub( q_cldfb[0][slot], common_q ) ) ); + transportSignalCrossCorrelation_64[bin] = W_add( transportSignalCrossCorrelation_64[bin], (Word64) L_shr_sat( inIm_fx[0][slot][bin], sub( q_cldfb[0][slot], common_q ) ) * L_shr_sat( inIm_fx[1][slot][bin], sub( q_cldfb[0][slot], common_q ) ) ); } } @@ -3686,27 +3429,29 @@ void ivas_spar_param_to_masa_param_mapping_fx( { FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - transportSignalEnergies_max = transportSignalEnergies_max > transportSignalEnergies_64[ch][bin] ? transportSignalEnergies_max : transportSignalEnergies_64[ch][bin]; + transportSignalEnergies_max = GT_64( transportSignalEnergies_max, transportSignalEnergies_64[ch][bin] ) ? transportSignalEnergies_max : transportSignalEnergies_64[ch][bin]; } - transportSignalCrossCorrelation_max = transportSignalCrossCorrelation_max > transportSignalCrossCorrelation_64[bin] ? transportSignalCrossCorrelation_max : transportSignalCrossCorrelation_64[bin]; + transportSignalCrossCorrelation_max = GT_64( transportSignalCrossCorrelation_max, transportSignalCrossCorrelation_64[bin] ) ? transportSignalCrossCorrelation_max : transportSignalCrossCorrelation_64[bin]; } - max_common_val = transportSignalEnergies_max > transportSignalCrossCorrelation_max ? transportSignalEnergies_max : transportSignalCrossCorrelation_max; + max_common_val = GT_64( transportSignalEnergies_max, transportSignalCrossCorrelation_max ) ? transportSignalEnergies_max : transportSignalCrossCorrelation_max; - IF( max_common_val != 0 ) + IF( NE_64( max_common_val, 0 ) ) { headroom_left_max_common = W_norm( max_common_val ); - IF( headroom_left_max_common > 32 ) + IF( GT_16( headroom_left_max_common, 32 ) ) { FOR( bin = 0; bin < nBins; bin++ ) { FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - transportSignalEnergies_32[ch][bin] = (Word32) transportSignalEnergies_64[ch][bin]; + transportSignalEnergies_32[ch][bin] = W_extract_l( transportSignalEnergies_64[ch][bin] ); + move32(); } - transportSignalCrossCorrelation_32[bin] = (Word32) transportSignalCrossCorrelation_64[bin]; + transportSignalCrossCorrelation_32[bin] = W_extract_l( transportSignalCrossCorrelation_64[bin] ); + move32(); } - q_max_common = ( 2 * common_q ); + q_max_common = shl( common_q, 1 ); } ELSE { @@ -3714,11 +3459,13 @@ void ivas_spar_param_to_masa_param_mapping_fx( { FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - transportSignalEnergies_32[ch][bin] = (Word32) W_shr( transportSignalEnergies_64[ch][bin], 32 - headroom_left_max_common ); + transportSignalEnergies_32[ch][bin] = W_extract_l( W_shr( transportSignalEnergies_64[ch][bin], sub( 32, headroom_left_max_common ) ) ); + move32(); } - transportSignalCrossCorrelation_32[bin] = (Word32) W_shr( transportSignalCrossCorrelation_64[bin], 32 - headroom_left_max_common ); + transportSignalCrossCorrelation_32[bin] = W_extract_l( W_shr( transportSignalCrossCorrelation_64[bin], sub( 32, headroom_left_max_common ) ) ); + move32(); } - q_max_common = ( 2 * common_q ) - ( 32 - headroom_left_max_common ); + q_max_common = sub( shl( common_q, 1 ), sub( 32, headroom_left_max_common ) ); } } ELSE @@ -3728,10 +3475,13 @@ void ivas_spar_param_to_masa_param_mapping_fx( FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { transportSignalEnergies_32[ch][bin] = 0; + move32(); } transportSignalCrossCorrelation_32[bin] = 0; + move32(); } q_max_common = 31; + move16(); } } @@ -3746,37 +3496,51 @@ void ivas_spar_param_to_masa_param_mapping_fx( FOR( bin = 0; bin < nBins; bin++ ) { /* Set the energy of the first transport signal */ - IF( nchan_transport == 1 ) + IF( EQ_16( nchan_transport, 1 ) ) { inCovarianceMtx_fx[0][0] = ONE_IN_Q31; /* In case of 1TC, fixed value can be used */ - q_inCovarianceMtx = 31; /* In case of 1TC, fixed value can be used */ + move32(); + q_inCovarianceMtx = 31; /* In case of 1TC, fixed value can be used */ + move16(); } ELSE { inCovarianceMtx_fx[0][0] = transportSignalEnergies_32[0][bin]; /* In case of 2TC, use actual energies */ - q_inCovarianceMtx = q_max_common; /* In case of 1TC, fixed value can be used */ + move32(); + q_inCovarianceMtx = q_max_common; /* In case of 1TC, fixed value can be used */ + move16(); } /* Decorrelated channels assumed to have the same energy as the source channel */ inCovarianceMtx_fx[1][1] = inCovarianceMtx_fx[0][0]; + move32(); inCovarianceMtx_fx[2][2] = inCovarianceMtx_fx[0][0]; + move32(); inCovarianceMtx_fx[3][3] = inCovarianceMtx_fx[0][0]; + move32(); /* In case residuals were transmitted, use their actual energies and cross correlations */ - IF( nchan_transport == 2 ) + IF( EQ_16( nchan_transport, 2 ) ) { inCovarianceMtx_fx[1][1] = transportSignalEnergies_32[1][bin]; + move32(); inCovarianceMtx_fx[0][1] = transportSignalCrossCorrelation_32[bin]; + move32(); inCovarianceMtx_fx[1][0] = inCovarianceMtx_fx[0][1]; + move32(); q_inCovarianceMtx = q_max_common; + move16(); } compute_foa_cov_matrix_fx( foaCovarianceMtx_fx, inCovarianceMtx_fx, mixer_mat_sf_bins_real_fx[bin] ); Iy_fx = foaCovarianceMtx_fx[0][1]; /* Intensity in Y direction */ + move32(); Iz_fx = foaCovarianceMtx_fx[0][2]; /* Intensity in Z direction */ + move32(); Ix_fx = foaCovarianceMtx_fx[0][3]; /* Intensity in X direction */ + move32(); Word64 I1 = (Word64) Ix_fx * Ix_fx; Word64 I2 = (Word64) Iy_fx * Iy_fx; @@ -3789,65 +3553,72 @@ void ivas_spar_param_to_masa_param_mapping_fx( Word16 headroom_left_I_res = W_norm( I_res ); Word16 q_I_res; - IF( headroom_left_I_res < 32 ) + IF( LT_16( headroom_left_I_res, 32 ) ) { - I_res = W_shr( I_res, (Word16) ( 32 - headroom_left_I_res ) ); - q_I_res = (Word16) ( 31 - ( ( 2 * q_inCovarianceMtx ) - ( 32 - headroom_left_I_res ) ) ); + I_res = W_shr( I_res, sub( 32, headroom_left_I_res ) ); + q_I_res = sub( 31, sub( shl( q_inCovarianceMtx, 1 ), sub( 32, headroom_left_I_res ) ) ); } ELSE { - q_I_res = 31 - ( 2 * q_inCovarianceMtx ); + q_I_res = sub( 31, shl( q_inCovarianceMtx, 1 ) ); } I_fx = Sqrt32( (Word32) I_res, &q_I_res ); - IF( q_I_res < 0 ) + IF( LT_16( q_I_res, 0 ) ) { I_fx = L_shr( I_fx, -1 * q_I_res ); q_I_res = 0; + move16(); } azi_q = 0; + move16(); azi_fx = BASOP_util_atan2( Iy_fx, Ix_fx, azi_q ); /* Azimuth */ Word64 I_ele_x = (Word64) Ix_fx * Ix_fx; Word64 I_ele_y = (Word64) Iy_fx * Iy_fx; Word64 I_ele = W_add( I_ele_x, I_ele_y ); Word16 headroom_left_I_ele = W_norm( I_ele ); - ele_q; - IF( headroom_left_I_ele < 32 ) + IF( LT_16( headroom_left_I_ele, 32 ) ) { - I_ele = W_shr( I_ele, (Word16) ( 32 - headroom_left_I_ele ) ); - ele_q = (Word16) ( 31 - ( ( 2 * q_inCovarianceMtx ) - ( 32 - headroom_left_I_ele ) ) ); + I_ele = W_shr( I_ele, sub( 32, headroom_left_I_ele ) ); + ele_q = sub( 31, sub( shl( q_inCovarianceMtx, 1 ), sub( 32, headroom_left_I_ele ) ) ); } ELSE { - ele_q = 31 - ( 2 * q_inCovarianceMtx ); + ele_q = sub( 31, shl( q_inCovarianceMtx, 1 ) ); } I_ele = Sqrt32( (Word32) I_ele, &ele_q ); - IF( ele_q < 0 ) + IF( LT_16( ele_q, 0 ) ) { - I_ele = L_shr( (Word32) I_ele, -1 * ele_q ); + I_ele = W_shr( I_ele, -1 * ele_q ); ele_q = 0; + move16(); } - ele_fx = BASOP_util_atan2( Iz_fx, (Word32) I_ele, ( 31 - q_inCovarianceMtx ) - ( ele_q ) ); + ele_fx = BASOP_util_atan2( Iz_fx, (Word32) I_ele, sub( sub( 31, q_inCovarianceMtx ), ele_q ) ); - num_q = 31 - q_I_res; + num_q = sub( 31, q_I_res ); denom_q = q_inCovarianceMtx; + move16(); res_q = 0; - E_fx = E_fx > 0 ? E_fx : 1; + move16(); + E_fx = GT_32( E_fx, 0 ) ? E_fx : 1; ratio_float_fx = BASOP_Util_Divide3232_Scale( I_fx, E_fx, &res_q ); - res_q = res_q - ( num_q - denom_q ); - IF( res_q < 0 ) + res_q = sub( res_q, sub( num_q, denom_q ) ); + IF( LT_16( res_q, 0 ) ) { ratio_float_fx = L_shr( ratio_float_fx, -1 * res_q ); res_q = 0; + move16(); } ratio_float_fx_Q15 = L_shl( ratio_float_fx, res_q ); max_ratio_1_Q15 = MAX_WORD16; - IF( ratio_float_fx_Q15 > max_ratio_1_Q15 ) + move32(); + IF( GT_32( ratio_float_fx_Q15, max_ratio_1_Q15 ) ) { ratio_float_fx_Q15 = max_ratio_1_Q15; + move32(); } azi_val = (Word64) azi_fx * ONE_BY_PI_OVER_180_Q25; - IF( azi_val < 0 ) + IF( LT_64( azi_val, 0 ) ) { azi_val = W_shr( -1 * azi_val, 13 + 25 ); azi_val = -1 * azi_val; @@ -3857,7 +3628,7 @@ void ivas_spar_param_to_masa_param_mapping_fx( azi_val = W_shr( azi_val, 13 + 25 ); } ele_val = (Word64) ele_fx * ONE_BY_PI_OVER_180_Q25; - IF( ele_val < 0 ) + IF( LT_64( ele_val, 0 ) ) { ele_val = W_shr( -1 * ele_val, 13 + 25 ); ele_val = -1 * ele_val; @@ -3868,12 +3639,18 @@ void ivas_spar_param_to_masa_param_mapping_fx( } hSpatParamRendCom->azimuth[dirac_write_idx][bin] = (Word16) azi_val; + move16(); hSpatParamRendCom->elevation[dirac_write_idx][bin] = (Word16) ele_val; + move16(); hSpatParamRendCom->energy_ratio1_fx[dirac_write_idx][bin] = L_deposit_h( (Word16) ratio_float_fx_Q15 ); + move32(); hSpatParamRendCom->diffuseness_vector_fx[dirac_write_idx][bin] = L_deposit_h( sub( 32767, (Word16) ratio_float_fx_Q15 ) ); + move32(); hSpatParamRendCom->spreadCoherence_fx[dirac_write_idx][bin] = 0; + move16(); hSpatParamRendCom->surroundingCoherence_fx[dirac_write_idx][bin] = 0; + move16(); // Tobe deleted @@ -3887,13 +3664,13 @@ void ivas_spar_param_to_masa_param_mapping_fx( /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ IF( hDiffuseDist != NULL ) { - IF( nchan_transport == 1 ) + IF( EQ_16( nchan_transport, 1 ) ) { diffuseGainY_fx = L_abs( mixer_mat_sf_bins_real_fx[bin][1][1] ); diffuseGainX_fx = L_abs( mixer_mat_sf_bins_real_fx[bin][3][2] ); diffuseGainZ_fx = L_abs( mixer_mat_sf_bins_real_fx[bin][2][3] ); } - ELSE IF( nchan_transport == 2 ) + ELSE IF( EQ_16( nchan_transport, 2 ) ) { diffuseGainY_fx = L_abs( Mpy_32_32( mixer_mat_sf_bins_real_fx[bin][1][1], transportSignalEnergies_32[1][bin] ) ); diffuseGainX_fx = L_add_sat( L_abs( Mpy_32_32( mixer_mat_sf_bins_real_fx[bin][3][2], transportSignalEnergies_32[0][bin] ) ), L_abs( Mpy_32_32( mixer_mat_sf_bins_real_fx[bin][3][1], transportSignalEnergies_32[1][bin] ) ) ); @@ -3902,16 +3679,22 @@ void ivas_spar_param_to_masa_param_mapping_fx( ELSE { diffuseGainY_fx = ONE_IN_Q31; + move32(); diffuseGainX_fx = ONE_IN_Q31; + move32(); diffuseGainZ_fx = ONE_IN_Q31; + move32(); } diffuseGainSum_fx = L_add_sat( L_add_sat( diffuseGainY_fx, diffuseGainX_fx ), diffuseGainZ_fx ); - IF( diffuseGainSum_fx == 0 ) + IF( EQ_32( diffuseGainSum_fx, 0 ) ) { hDiffuseDist->diffuseRatioX_fx[bin] = 715827904; + move32(); hDiffuseDist->diffuseRatioY_fx[bin] = 715827904; + move32(); hDiffuseDist->diffuseRatioZ_fx[bin] = 715827904; + move32(); } ELSE { @@ -3919,39 +3702,42 @@ void ivas_spar_param_to_masa_param_mapping_fx( Word16 intermediate_results; intermediate_results = BASOP_Util_Divide3232_Scale( diffuseGainX_fx, diffuseGainSum_fx + EPSILON_FX_SMALL, &temp_q ); // saturating value to less than 1 - IF( temp_q <= 0 ) + IF( LE_16( temp_q, 0 ) ) { - intermediate_results = shr( (Word16) intermediate_results, -1 * temp_q ); + intermediate_results = shr( intermediate_results, -1 * temp_q ); } ELSE { - intermediate_results = shl_sat( (Word16) intermediate_results, temp_q ); + intermediate_results = shl_sat( intermediate_results, temp_q ); } hDiffuseDist->diffuseRatioX_fx[bin] = L_deposit_h( intermediate_results ); + move32(); intermediate_results = BASOP_Util_Divide3232_Scale( diffuseGainY_fx, diffuseGainSum_fx + EPSILON_FX_SMALL, &temp_q ); // saturating value to less than 1 - IF( temp_q <= 0 ) + IF( LE_16( temp_q, 0 ) ) { - intermediate_results = shr( (Word16) intermediate_results, -1 * temp_q ); + intermediate_results = shr( intermediate_results, -1 * temp_q ); } ELSE { - intermediate_results = shl_sat( (Word16) intermediate_results, temp_q ); + intermediate_results = shl_sat( intermediate_results, temp_q ); } hDiffuseDist->diffuseRatioY_fx[bin] = L_deposit_h( intermediate_results ); + move32(); intermediate_results = BASOP_Util_Divide3232_Scale( diffuseGainZ_fx, diffuseGainSum_fx + EPSILON_FX_SMALL, &temp_q ); // saturating value to less than 1 - IF( temp_q <= 0 ) + IF( LE_16( temp_q, 0 ) ) { - intermediate_results = shr( (Word16) intermediate_results, -1 * temp_q ); + intermediate_results = shr( intermediate_results, -1 * temp_q ); } ELSE { - intermediate_results = shl_sat( (Word16) intermediate_results, temp_q ); + intermediate_results = shl_sat( intermediate_results, temp_q ); } hDiffuseDist->diffuseRatioZ_fx[bin] = L_deposit_h( intermediate_results ); + move32(); } } } @@ -3960,228 +3746,230 @@ void ivas_spar_param_to_masa_param_mapping_fx( } #else void ivas_spar_param_to_masa_param_mapping( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ - const int16_t subframe /* i : Subframe to map */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ + const int16_t subframe /* i : Subframe to map */ ) { - int16_t i, j, band, bin, slot, ch, nBins, nchan_transport; - int16_t mixer_mat_index; - int16_t dirac_write_idx; - DIRAC_DEC_HANDLE hDirAC; - DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; - float mixer_mat_sf_bands_real[SPAR_DIRAC_SPLIT_START_BAND][FOA_CHANNELS][FOA_CHANNELS]; - float mixer_mat_sf_bins_real[CLDFB_NO_CHANNELS_MAX][FOA_CHANNELS][FOA_CHANNELS]; - int16_t *band_grouping; - int16_t band_start, band_end; - float transportSignalEnergies[2][CLDFB_NO_CHANNELS_MAX]; - float transportSignalCrossCorrelation[CLDFB_NO_CHANNELS_MAX]; - float instEne; - float inCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; - float foaCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; - float Iy, Iz, Ix, E, azi, ele, I, ratio_float; - float diffuseGainX, diffuseGainY, diffuseGainZ, diffuseGainSum; - int16_t slot_idx, slot_idx_start, sf; - SPAR_DEC_HANDLE hSpar; - float slot_fac; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - - /* Set values */ - hDirAC = st_ivas->hDirAC; - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - hSpatParamRendCom->numParametricDirections = 1; - hSpatParamRendCom->numSimultaneousDirections = 1; - hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; - nchan_transport = st_ivas->nchan_transport; - band_grouping = hDirAC->band_grouping; - hSpar = st_ivas->hSpar; - dirac_write_idx = hSpatParamRendCom->render_to_md_map[subframe]; - - /* Init arrays */ - for (i = 0; i < FOA_CHANNELS; i++) - { - set_zero(inCovarianceMtx[i], FOA_CHANNELS); - } - - /* Delay the SPAR mixing matrices to have them synced with the audio */ - slot_idx_start = hSpar->slots_rendered; - slot_fac = 1.0f / (float)hSpar->subframe_nbslots[subframe]; - - for (slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe]; slot_idx++) - { - sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; - - if ((sf < SPAR_META_DELAY_SUBFRAMES)) - { - mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; - for (band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++) - { - for (i = 0; i < FOA_CHANNELS; i++) - { - for (j = 0; j < FOA_CHANNELS; j++) - { - mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; - } - } - } + int16_t i, j, band, bin, slot, ch, nBins, nchan_transport; + int16_t mixer_mat_index; + int16_t dirac_write_idx; + DIRAC_DEC_HANDLE hDirAC; + DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; + float mixer_mat_sf_bands_real[SPAR_DIRAC_SPLIT_START_BAND][FOA_CHANNELS][FOA_CHANNELS]; + float mixer_mat_sf_bins_real[CLDFB_NO_CHANNELS_MAX][FOA_CHANNELS][FOA_CHANNELS]; + int16_t *band_grouping; + int16_t band_start, band_end; + float transportSignalEnergies[2][CLDFB_NO_CHANNELS_MAX]; + float transportSignalCrossCorrelation[CLDFB_NO_CHANNELS_MAX]; + float instEne; + float inCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; + float foaCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; + float Iy, Iz, Ix, E, azi, ele, I, ratio; + float diffuseGainX, diffuseGainY, diffuseGainZ, diffuseGainSum; + int16_t slot_idx, slot_idx_start, sf; + SPAR_DEC_HANDLE hSpar; + float slot_fac; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + /* Set values */ + hDirAC = st_ivas->hDirAC; + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + hSpatParamRendCom->numParametricDirections = 1; + hSpatParamRendCom->numSimultaneousDirections = 1; + hDiffuseDist = st_ivas->hDiracDecBin->hDiffuseDist; + nchan_transport = st_ivas->nchan_transport; + band_grouping = hDirAC->band_grouping; + hSpar = st_ivas->hSpar; + dirac_write_idx = hSpatParamRendCom->render_to_md_map[subframe]; + + /* Init arrays */ + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + set_zero( inCovarianceMtx[i], FOA_CHANNELS ); } - else + + /* Delay the SPAR mixing matrices to have them synced with the audio */ + slot_idx_start = hSpar->slots_rendered; + slot_fac = 1.0f / (float) hSpar->subframe_nbslots[subframe]; + + for ( slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe]; slot_idx++ ) { - mixer_mat_index = (ivas_get_spar_dec_md_num_subframes(st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate) == 1) ? 0 : (sf - SPAR_META_DELAY_SUBFRAMES); - for (band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++) - { - for (i = 0; i < FOA_CHANNELS; i++) + sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; + + if ( ( sf < SPAR_META_DELAY_SUBFRAMES ) ) + { + mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; + } + } + } + } + else { - for (j = 0; j < FOA_CHANNELS; j++) - { - mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; - } + mixer_mat_index = ( ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) == 1 ) ? 0 : ( sf - SPAR_META_DELAY_SUBFRAMES ); + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; + } + } + } } - } } - } - /* Map the mixing matrices from the frequency bands to frequency bins */ - bin = 0; - for (band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++) - { - band_start = band_grouping[band]; - band_end = band_grouping[band + 1]; - for (bin = band_start; bin < band_end; bin++) + /* Map the mixing matrices from the frequency bands to frequency bins */ + bin = 0; + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { - for (i = 0; i < FOA_CHANNELS; i++) - { - for (j = 0; j < FOA_CHANNELS; j++) + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + for ( bin = band_start; bin < band_end; bin++ ) { - mixer_mat_sf_bins_real[bin][i][j] = mixer_mat_sf_bands_real[band][i][j]; + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bins_real[bin][i][j] = mixer_mat_sf_bands_real[band][i][j]; + } + } } - } } - } - nBins = bin; - - /* Determine MASA metadata */ - /* Determine transport signal energies and cross correlations when more than 1 TC */ - if (nchan_transport == 2) - { - set_zero(transportSignalEnergies[0], nBins); - set_zero(transportSignalEnergies[1], nBins); - set_zero(transportSignalCrossCorrelation, nBins); + nBins = bin; - for (slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++) + /* Determine MASA metadata */ + /* Determine transport signal energies and cross correlations when more than 1 TC */ + if ( nchan_transport == 2 ) { - for (bin = 0; bin < nBins; bin++) - { - for (ch = 0; ch < BINAURAL_CHANNELS; ch++) + set_zero( transportSignalEnergies[0], nBins ); + set_zero( transportSignalEnergies[1], nBins ); + set_zero( transportSignalCrossCorrelation, nBins ); + + for ( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { - instEne = (inRe[ch][slot][bin] * inRe[ch][slot][bin]); - instEne += (inIm[ch][slot][bin] * inIm[ch][slot][bin]); - transportSignalEnergies[ch][bin] += instEne; + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); + instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + transportSignalEnergies[ch][bin] += instEne; + } + transportSignalCrossCorrelation[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + transportSignalCrossCorrelation[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + } } - transportSignalCrossCorrelation[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; - transportSignalCrossCorrelation[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; - } } - } - - if (hDiffuseDist != NULL) - { - set_zero(hDiffuseDist->diffuseRatioX, CLDFB_NO_CHANNELS_MAX); - set_zero(hDiffuseDist->diffuseRatioY, CLDFB_NO_CHANNELS_MAX); - set_zero(hDiffuseDist->diffuseRatioZ, CLDFB_NO_CHANNELS_MAX); - } - for (bin = 0; bin < nBins; bin++) - { - /* Set the energy of the first transport signal */ - if (nchan_transport == 1) + if ( hDiffuseDist != NULL ) { - inCovarianceMtx[0][0] = 1.0f; /* In case of 1TC, fixed value can be used */ + set_zero( hDiffuseDist->diffuseRatioX, CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioY, CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioZ, CLDFB_NO_CHANNELS_MAX ); } - else + + for ( bin = 0; bin < nBins; bin++ ) { - inCovarianceMtx[0][0] = transportSignalEnergies[0][bin]; /* In case of 2TC, use actual energies */ - } - - /* Decorrelated channels assumed to have the same energy as the source channel */ - inCovarianceMtx[1][1] = inCovarianceMtx[0][0]; - inCovarianceMtx[2][2] = inCovarianceMtx[0][0]; - inCovarianceMtx[3][3] = inCovarianceMtx[0][0]; - - /* In case residuals were transmitted, use their actual energies and cross correlations */ - if (nchan_transport == 2) - { - inCovarianceMtx[1][1] = transportSignalEnergies[1][bin]; - inCovarianceMtx[0][1] = transportSignalCrossCorrelation[bin]; - inCovarianceMtx[1][0] = inCovarianceMtx[0][1]; - } - - compute_foa_cov_matrix(foaCovarianceMtx, inCovarianceMtx, mixer_mat_sf_bins_real[bin]); - - /* Estimate MASA metadata */ - Iy = foaCovarianceMtx[0][1]; /* Intensity in Y direction */ - Iz = foaCovarianceMtx[0][2]; /* Intensity in Z direction */ - Ix = foaCovarianceMtx[0][3]; /* Intensity in X direction */ - I = sqrtf(Ix * Ix + Iy * Iy + Iz * Iz); /* Intensity vector length */ - E = (foaCovarianceMtx[0][0] + foaCovarianceMtx[1][1] + foaCovarianceMtx[2][2] + foaCovarianceMtx[3][3]) / 2.0f; /* Overall energy */ - azi = atan2f(Iy, Ix); /* Azimuth */ - ele = atan2f(Iz, sqrtf(Ix * Ix + Iy * Iy)); /* Elevation */ - ratio_float = I / fmaxf(1e-12f, E); /* Energy ratio */ - ratio_float = fmaxf(0.0f, fminf(1.0f, ratio_float)); - - hSpatParamRendCom->azimuth[dirac_write_idx][bin] = (int16_t)roundf(azi / PI_OVER_180); - hSpatParamRendCom->elevation[dirac_write_idx][bin] = (int16_t)roundf(ele / PI_OVER_180); - hSpatParamRendCom->energy_ratio1[dirac_write_idx][bin] = ratio_float; - hSpatParamRendCom->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio_float; - - hSpatParamRendCom->spreadCoherence[dirac_write_idx][bin] = 0.0f; - hSpatParamRendCom->surroundingCoherence[dirac_write_idx][bin] = 0.0f; - - /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ - if (hDiffuseDist != NULL) - { - if (nchan_transport == 1) - { - diffuseGainY = fabsf(mixer_mat_sf_bins_real[bin][1][1]); - diffuseGainX = fabsf(mixer_mat_sf_bins_real[bin][3][2]); - diffuseGainZ = fabsf(mixer_mat_sf_bins_real[bin][2][3]); - } - else if (nchan_transport == 2) - { - diffuseGainY = fabsf(mixer_mat_sf_bins_real[bin][1][1] * transportSignalEnergies[1][bin]); - diffuseGainX = fabsf(mixer_mat_sf_bins_real[bin][3][2] * transportSignalEnergies[0][bin]) + fabsf(mixer_mat_sf_bins_real[bin][3][1] * transportSignalEnergies[1][bin]); - diffuseGainZ = fabsf(mixer_mat_sf_bins_real[bin][2][3] * transportSignalEnergies[0][bin]) + fabsf(mixer_mat_sf_bins_real[bin][2][1] * transportSignalEnergies[1][bin]); - } - else - { - diffuseGainY = 1.0f; - diffuseGainX = 1.0f; - diffuseGainZ = 1.0f; - } - - diffuseGainSum = diffuseGainY + diffuseGainX + diffuseGainZ; - - if (diffuseGainSum == 0.0f) - { - hDiffuseDist->diffuseRatioX[bin] = 1.0f / 3.0f; - hDiffuseDist->diffuseRatioY[bin] = 1.0f / 3.0f; - hDiffuseDist->diffuseRatioZ[bin] = 1.0f / 3.0f; - } - else - { - hDiffuseDist->diffuseRatioX[bin] = diffuseGainX / (diffuseGainSum + EPSILON); - hDiffuseDist->diffuseRatioY[bin] = diffuseGainY / (diffuseGainSum + EPSILON); - hDiffuseDist->diffuseRatioZ[bin] = diffuseGainZ / (diffuseGainSum + EPSILON); - } - } - } - - return; + /* Set the energy of the first transport signal */ + if ( nchan_transport == 1 ) + { + inCovarianceMtx[0][0] = 1.0f; /* In case of 1TC, fixed value can be used */ + } + else + { + inCovarianceMtx[0][0] = transportSignalEnergies[0][bin]; /* In case of 2TC, use actual energies */ + } + + /* Decorrelated channels assumed to have the same energy as the source channel */ + inCovarianceMtx[1][1] = inCovarianceMtx[0][0]; + inCovarianceMtx[2][2] = inCovarianceMtx[0][0]; + inCovarianceMtx[3][3] = inCovarianceMtx[0][0]; + + /* In case residuals were transmitted, use their actual energies and cross correlations */ + if ( nchan_transport == 2 ) + { + inCovarianceMtx[1][1] = transportSignalEnergies[1][bin]; + inCovarianceMtx[0][1] = transportSignalCrossCorrelation[bin]; + inCovarianceMtx[1][0] = inCovarianceMtx[0][1]; + } + + compute_foa_cov_matrix( foaCovarianceMtx, inCovarianceMtx, mixer_mat_sf_bins_real[bin] ); + + /* Estimate MASA metadata */ + Iy = foaCovarianceMtx[0][1]; /* Intensity in Y direction */ + Iz = foaCovarianceMtx[0][2]; /* Intensity in Z direction */ + Ix = foaCovarianceMtx[0][3]; /* Intensity in X direction */ + I = sqrtf( Ix * Ix + Iy * Iy + Iz * Iz ); /* Intensity vector length */ + E = ( foaCovarianceMtx[0][0] + foaCovarianceMtx[1][1] + foaCovarianceMtx[2][2] + foaCovarianceMtx[3][3] ) / 2.0f; /* Overall energy */ + azi = atan2f( Iy, Ix ); /* Azimuth */ + ele = atan2f( Iz, sqrtf( Ix * Ix + Iy * Iy ) ); /* Elevation */ + ratio = I / fmaxf( 1e-12f, E ); /* Energy ratio */ + ratio = fmaxf( 0.0f, fminf( 1.0f, ratio ) ); + + hSpatParamRendCom->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); + hSpatParamRendCom->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); + hSpatParamRendCom->energy_ratio1[dirac_write_idx][bin] = ratio; + hSpatParamRendCom->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; + + hSpatParamRendCom->spreadCoherence[dirac_write_idx][bin] = 0.0f; + hSpatParamRendCom->surroundingCoherence[dirac_write_idx][bin] = 0.0f; + + /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ + if ( hDiffuseDist != NULL ) + { + if ( nchan_transport == 1 ) + { + diffuseGainY = fabsf( mixer_mat_sf_bins_real[bin][1][1] ); + diffuseGainX = fabsf( mixer_mat_sf_bins_real[bin][3][2] ); + diffuseGainZ = fabsf( mixer_mat_sf_bins_real[bin][2][3] ); + } + else if ( nchan_transport == 2 ) + { + diffuseGainY = fabsf( mixer_mat_sf_bins_real[bin][1][1] * transportSignalEnergies[1][bin] ); + diffuseGainX = fabsf( mixer_mat_sf_bins_real[bin][3][2] * transportSignalEnergies[0][bin] ) + fabsf( mixer_mat_sf_bins_real[bin][3][1] * transportSignalEnergies[1][bin] ); + diffuseGainZ = fabsf( mixer_mat_sf_bins_real[bin][2][3] * transportSignalEnergies[0][bin] ) + fabsf( mixer_mat_sf_bins_real[bin][2][1] * transportSignalEnergies[1][bin] ); + } + else + { + diffuseGainY = 1.0f; + diffuseGainX = 1.0f; + diffuseGainZ = 1.0f; + } + + diffuseGainSum = diffuseGainY + diffuseGainX + diffuseGainZ; + + if ( diffuseGainSum == 0.0f ) + { + hDiffuseDist->diffuseRatioX[bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioY[bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioZ[bin] = 1.0f / 3.0f; + } + else + { + hDiffuseDist->diffuseRatioX[bin] = diffuseGainX / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioY[bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioZ[bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); + } + } + } + + return; } #endif -#ifdef IVAS_FLOAT_FIXED + + /* Estimate FOA properties: foaCov = mixMtx * inCov * mixMtx' */ +#ifdef IVAS_FLOAT_FIXED static void compute_foa_cov_matrix_fx( Word32 foaCov_fx[FOA_CHANNELS][FOA_CHANNELS], /* o : Estimated FOA covariance matrix */ Word32 inCov_fx[FOA_CHANNELS][FOA_CHANNELS], /* i : Input covariance matrix */ @@ -4196,9 +3984,11 @@ static void compute_foa_cov_matrix_fx( FOR( j = 0; j < FOA_CHANNELS; j++ ) { tmpMtx_fx[i][j] = 0; + move32(); FOR( k = 0; k < FOA_CHANNELS; k++ ) { tmpMtx_fx[i][j] = L_add_sat( tmpMtx_fx[i][j], Mpy_32_32( mixMtx_fx[i][k], inCov_fx[k][j] ) ); + move32(); } } } @@ -4209,56 +3999,59 @@ static void compute_foa_cov_matrix_fx( FOR( j = 0; j < FOA_CHANNELS; j++ ) { foaCov_fx[i][j] = 0; + move32(); FOR( k = 0; k < FOA_CHANNELS; k++ ) { foaCov_fx[i][j] = L_add_sat( foaCov_fx[i][j], Mpy_32_32( tmpMtx_fx[i][k], mixMtx_fx[j][k] ) ); + move32(); } } } return; } - #else static void compute_foa_cov_matrix( - float foaCov[FOA_CHANNELS][FOA_CHANNELS], /* o : Estimated FOA covariance matrix */ - float inCov[FOA_CHANNELS][FOA_CHANNELS], /* i : Input covariance matrix */ - float mixMtx[FOA_CHANNELS][FOA_CHANNELS] /* i : Mixing matrix */ + float foaCov[FOA_CHANNELS][FOA_CHANNELS], /* o : Estimated FOA covariance matrix */ + float inCov[FOA_CHANNELS][FOA_CHANNELS], /* i : Input covariance matrix */ + float mixMtx[FOA_CHANNELS][FOA_CHANNELS] /* i : Mixing matrix */ ) { - float tmpMtx[FOA_CHANNELS][FOA_CHANNELS]; - int16_t i, j, k; + float tmpMtx[FOA_CHANNELS][FOA_CHANNELS]; + int16_t i, j, k; - /* tmpMtx = mixMtx * inCov */ - for (i = 0; i < FOA_CHANNELS; i++) - { - for (j = 0; j < FOA_CHANNELS; j++) + /* tmpMtx = mixMtx * inCov */ + for ( i = 0; i < FOA_CHANNELS; i++ ) { - tmpMtx[i][j] = 0.0f; - for (k = 0; k < FOA_CHANNELS; k++) - { - tmpMtx[i][j] += mixMtx[i][k] * inCov[k][j]; - } + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + tmpMtx[i][j] = 0.0f; + for ( k = 0; k < FOA_CHANNELS; k++ ) + { + tmpMtx[i][j] += mixMtx[i][k] * inCov[k][j]; + } + } } - } - /* foaCov = inCov * mixMtx' */ - for (i = 0; i < FOA_CHANNELS; i++) - { - for (j = 0; j < FOA_CHANNELS; j++) + /* foaCov = inCov * mixMtx' */ + for ( i = 0; i < FOA_CHANNELS; i++ ) { - foaCov[i][j] = 0.0f; - for (k = 0; k < FOA_CHANNELS; k++) - { - foaCov[i][j] += tmpMtx[i][k] * mixMtx[j][k]; - } + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + foaCov[i][j] = 0.0f; + for ( k = 0; k < FOA_CHANNELS; k++ ) + { + foaCov[i][j] += tmpMtx[i][k] * mixMtx[j][k]; + } + } } - } - return; + return; } - #endif + + +#ifndef IVAS_FLOAT_FIXED static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, @@ -4390,8 +4183,7 @@ static void create_masa_ext_out_meta( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void create_masa_ext_out_meta_fx( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, @@ -4529,6 +4321,8 @@ static void create_masa_ext_out_meta_fx( } #endif + +#ifndef IVAS_FLOAT_FIXED static void decode_index_slice( int16_t index, /* i : index to decode */ int16_t *ratio_idx_ism, /* o : decodec array of integers */ @@ -4580,7 +4374,7 @@ static void decode_index_slice( return; } -#ifdef IVAS_FLOAT_FIXED +#else static void decode_index_slice_fx( Word16 index, /* i : index to decode */ Word16 *ratio_idx_ism, /* o : decodec array of integers */ @@ -4591,12 +4385,12 @@ static void decode_index_slice_fx( Word16 i, j, sum, elem; Word16 base[MAX_NUM_OBJECTS]; - SWITCH ( nchan_ism ) + SWITCH( nchan_ism ) { case 2: ratio_idx_ism[0] = index; move16(); - ratio_idx_ism[1] = sub(K, ratio_idx_ism[0]); + ratio_idx_ism[1] = sub( K, ratio_idx_ism[0] ); move16(); BREAK; case 3: @@ -4604,41 +4398,41 @@ static void decode_index_slice_fx( { j = 0; move16(); - WHILE ( GE_16( index, 0) ) + WHILE( GE_16( index, 0 ) ) { - IF ( valid_ratio_index_fx( j, K, nchan_ism - 1 ) ) + IF( valid_ratio_index_fx( j, K, nchan_ism - 1 ) ) { - index = sub(index, 1); + index = sub( index, 1 ); } - j = add(j, 1); + j = add( j, 1 ); } - j = sub(j,1); + j = sub( j, 1 ); base[0] = 1; move16(); - FOR ( i = 1; i < sub(nchan_ism, 1); i++ ) + FOR( i = 1; i < sub( nchan_ism, 1 ); i++ ) { - base[i] = i_mult(base[i - 1], 10); + base[i] = i_mult( base[i - 1], 10 ); move16(); } sum = 0; move16(); - FOR ( i = sub(nchan_ism, 2); i >= 0; i-- ) + FOR( i = sub( nchan_ism, 2 ); i >= 0; i-- ) { - IF(EQ_16(j, 0)) + IF( EQ_16( j, 0 ) ) { elem = 0; move16(); } ELSE { - elem = idiv1616(j, base[i]); + elem = idiv1616( j, base[i] ); } - ratio_idx_ism[sub(sub(nchan_ism, i), 2)] = elem; + ratio_idx_ism[sub( sub( nchan_ism, i ), 2 )] = elem; move16(); - sum = add(sum, elem); - j = sub(j, i_mult(elem, base[i])); + sum = add( sum, elem ); + j = sub( j, i_mult( elem, base[i] ) ); } - ratio_idx_ism[nchan_ism - 1] = sub(K, sum); + ratio_idx_ism[nchan_ism - 1] = sub( K, sum ); move16(); } @@ -4651,6 +4445,7 @@ static void decode_index_slice_fx( #endif +#ifndef IVAS_FLOAT_FIXED static void read_ism_ratio_index( int16_t ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM read ratio indexes */ const int16_t nchan_ism, /* i : number of objects */ @@ -4920,8 +4715,7 @@ static void read_ism_ratio_index( return; } } - -#ifdef IVAS_FLOAT_FIXED +#else static void read_ism_ratio_index_fx( Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM read ratio indexes */ const Word16 nchan_ism, /* i : number of objects */ @@ -4962,7 +4756,6 @@ static void read_ism_ratio_index_fx( no_levels_ratio_ism = sub( shl( 1, PARAM_ISM_POW_RATIO_NBITS ), 1 ); move16(); - test(); WHILE( ( LT_16( b_signif, numCodingBands ) ) && ( GE_32( masa_to_total_energy_ratio_fx[b_signif], MASA2TOTAL_THR_Q30 ) ) ) { /* distribute evenly the objects */ @@ -5244,6 +5037,8 @@ static void read_ism_ratio_index_fx( } #endif + +#ifndef IVAS_FLOAT_FIXED static void decode_ism_ratios( uint16_t *bit_stream, /* i : bitstream */ int16_t *next_bit_pos, /* i/o: position in bitstream */ @@ -5318,17 +5113,16 @@ static void decode_ism_ratios( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void decode_ism_ratios_fx( - UWord16 *bit_stream, /* i : bitstream */ - Word16 *next_bit_pos, /* i/o: position in bitstream */ + UWord16 *bit_stream, /* i : bitstream */ + Word16 *next_bit_pos, /* i/o: position in bitstream */ const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : masa_to_total energy ratios */ - Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM ratios */ - const Word16 n_ism, /* i : number of objects */ - const Word16 nbands, /* i : number of subbands */ - const Word16 numSf, /* i : number of subframes */ - const Word16 idx_separated_object /* i : index of separated object */ + Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM ratios */ + const Word16 n_ism, /* i : number of objects */ + const Word16 nbands, /* i : number of subbands */ + const Word16 numSf, /* i : number of subframes */ + const Word16 idx_separated_object /* i : index of separated object */ ) { Word16 sf, band; @@ -5340,14 +5134,14 @@ static void decode_ism_ratios_fx( move16(); /* hQMetaData->q_direction->cfg.nblocks; */ - FOR ( sf = 0; sf < numSf; sf++ ) + FOR( sf = 0; sf < numSf; sf++ ) { /* read ism ratio indexes */ read_ism_ratio_index_fx( ratio_ism_idx, n_ism, nbands, sf, ratio_ism_idx_prev_sf, bit_stream, next_bit_pos, masa_to_total_energy_ratio_fx[sf], idx_separated_object, &num_zeros ); /* save previous subframe index values */ - IF ( LT_16( sf, sub( numSf, 1 ) ) ) + IF( LT_16( sf, sub( numSf, 1 ) ) ) { - FOR ( band = 0; band < nbands; band++ ) + FOR( band = 0; band < nbands; band++ ) { Copy( ratio_ism_idx[band], ratio_ism_idx_prev_sf[band], n_ism ); } @@ -5356,16 +5150,16 @@ static void decode_ism_ratios_fx( /* reconstructed values */ FOR( band = 0; band < nbands; band++ ) { - reconstruct_ism_ratios_fx( ratio_ism_idx[band], n_ism, STEP_PARAM_ISM_POW_RATIO_NBITS_Q15, ratio_ism[sf][band]); + reconstruct_ism_ratios_fx( ratio_ism_idx[band], n_ism, STEP_PARAM_ISM_POW_RATIO_NBITS_Q15, ratio_ism[sf][band] ); } test(); - IF ( GT_16( n_ism, 2 ) && ( EQ_16( idx_separated_object, sub(n_ism, 1)) ) ) + IF( GT_16( n_ism, 2 ) && ( EQ_16( idx_separated_object, sub( n_ism, 1 ) ) ) ) { /* rotate */ - FOR ( band = 0; band < nbands; band++ ) + FOR( band = 0; band < nbands; band++ ) { - IF ( LT_32( masa_to_total_energy_ratio_fx[sf][band], MASA2TOTAL_THR_Q30 ) ) + IF( LT_32( masa_to_total_energy_ratio_fx[sf][band], MASA2TOTAL_THR_Q30 ) ) { tmp32_fx = ratio_ism[sf][band][n_ism - 1]; move32(); @@ -5377,22 +5171,22 @@ static void decode_ism_ratios_fx( } } - IF ( EQ_16( nbands, 1) ) + IF( EQ_16( nbands, 1 ) ) { - FOR ( band = 1; band < 5; band++ ) + FOR( band = 1; band < 5; band++ ) { Copy32( ratio_ism[sf][0], ratio_ism[sf][band], n_ism ); } } } - IF ( EQ_16( numSf, 1 ) ) + IF( EQ_16( numSf, 1 ) ) { - FOR ( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + FOR( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - FOR ( band = 0; band < nbands; band++ ) + FOR( band = 0; band < nbands; band++ ) { - Copy32(ratio_ism[0][band], ratio_ism[sf][band], n_ism ); + Copy32( ratio_ism[0][band], ratio_ism[sf][band], n_ism ); } } } @@ -5432,24 +5226,7 @@ static int16_t ivas_decode_masaism_metadata( nblocks = hQMetaData->q_direction->cfg.nblocks; /* Read MASA-to-total energy ratios */ -#ifdef IVAS_FLOAT_FIXED - ivas_omasa_decode_masa_to_total_fx( bit_stream, next_bit_pos, hMasaIsmData->masa_to_total_energy_ratio_fx, nbands, nblocks ); - - FOR( int k = 0; k < (nblocks != 1 ? nblocks : MAX_PARAM_SPATIAL_SUBFRAMES); k++ ) - { - FOR( int j = 0; j < (nbands != 1 ? nbands : MASA_FREQUENCY_BANDS); j++ ) - { - hMasaIsmData->masa_to_total_energy_ratio[k][j] = (float) hMasaIsmData->masa_to_total_energy_ratio_fx[k][j] / (float) ( 1u << 30 ); - } - } -#else ivas_omasa_decode_masa_to_total( bit_stream, next_bit_pos, hMasaIsmData->masa_to_total_energy_ratio, nbands, nblocks ); -#endif - /*FOR(int i = 0; i < nblocks; i++) { - FOR(int j = 0; j masa_to_total_energy_ratio[i][j]); - } - }*/ if ( nchan_ism > 1 ) { /* read ISM ratios */ @@ -5468,6 +5245,7 @@ static int16_t ivas_decode_masaism_metadata( /* read ISM metadata */ calculate_nbits_meta( nchan_ism, energy_ratio_ism, hMasaIsmData->masa_to_total_energy_ratio, nblocks, nbands, bits_ism, idx_separated_object, ism_imp ); + for ( obj = 0; obj < nchan_ism; obj++ ) { index = 0; @@ -5485,8 +5263,8 @@ static int16_t ivas_decode_masaism_metadata( { index = ( index << 1 ) + bit_stream[( *next_bit_pos )--]; } - deindex_spherical_component( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); + if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) { delta_phi = 180.0f / (float) ( no_phi_masa[bits_ism[obj] - 1][idx_el] ); /* 360/2*/ @@ -5681,7 +5459,9 @@ static Word16 ivas_decode_masaism_metadata_fx( deindex_spherical_component_fx( index, &azimuth, &elevation, &idx_az, &idx_el, bits_ism[obj], MC_LS_SETUP_INVALID ); hMasaIsmData->q_azimuth_old_fx[obj] = azimuth; + move32(); hMasaIsmData->q_elevation_old_fx[obj] = elevation; + move32(); } FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) @@ -5746,6 +5526,7 @@ static Word16 ivas_decode_masaism_metadata_fx( } #endif +#ifdef IVAS_FLOAT_FIXED /* Fixed point implementation of rint(). */ @@ -5770,3 +5551,4 @@ static Word16 rint_fx( /* returns in Q0 */ } return res; } +#endif diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index f38bbff23..8a9b8a517 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -128,7 +128,9 @@ static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, const ui static void ivas_param_mc_get_param_band_mapping( const int16_t n_target_bands, const int16_t *target_band_grouping, const int16_t n_source_bands, const int16_t *source_band_grouping, PARAM_MC_PARAMETER_BAND_MAPPING *parameter_band_mapping ); +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_bs_decode_parameter_values( uint16_t bit_buffer[], int16_t *bit_pos, const int16_t max_bits, int16_t *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const int16_t map_size_wo_lfe, const int16_t map_size, const int16_t num_lfe_bands, const int16_t band_step, const int16_t num_param_bands, float *value_buffer ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_param_mc_bs_decode_parameter_values_fx(UWord16 bit_buffer[], Word16 *bit_pos, const Word16 max_bits, Word16 *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const Word16 map_size_wo_lfe, const Word16 map_size, const Word16 num_lfe_bands, const Word16 band_step, const Word16 num_param_bands, Word16 *value_buffer); @@ -295,19 +297,6 @@ ivas_error ivas_param_mc_dec_open_fx( set16_fx( hParamMC->icld_q_fx, PARAM_MC_DEFAULT_MIN_ILD_FX, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); set16_fx( hParamMC->icc_q_fx, 0, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); -#if 1/*TODO: To be removed later(floating point initialization)*/ - if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - set_f( hParamMC->icc_q, 0, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); -#endif - param_mc_set_num_synth_bands( output_Fs, hParamMC ); /* Band Grouping */ @@ -1338,21 +1327,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { Word16 *ild_q_old_fx = hParamMC->icld_q_fx; Word16 *icc_q_old_fx = hParamMC->icc_q_fx; -#if 1/*To be removed later*/ - free( hParamMC->icc_q ); - free( hParamMC->icld_q ); - /* init arrays for the quantized parameters */ - IF ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - IF ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } - set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - set_f( hParamMC->icc_q, 0.0f, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); -#endif IF ( ( hParamMC->icc_q_fx = (Word16 *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof(Word16) ) ) == NULL ) { @@ -2488,17 +2462,6 @@ void ivas_param_mc_dec_close_fx( hParamMC->proto_matrix_int = NULL; } - IF( hParamMC->icc_q != NULL ) - { - free( hParamMC->icc_q ); - hParamMC->icc_q = NULL; - } - - IF( hParamMC->icld_q != NULL ) - { - free( hParamMC->icld_q ); - hParamMC->icld_q = NULL; - } IF( hParamMC->proto_frame_f != NULL ) { free( hParamMC->proto_frame_f ); @@ -2665,6 +2628,234 @@ void ivas_param_mc_dec_close( * Read the Parametric MC metadata *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_dec_read_BS_fx( + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder ParamMC handle */ + Word16 *nb_bits /* o : number of bits written */ +) +{ + Word16 param_frame_idx; + Word16 band_step; + UWord16 bit_buffer[PARAM_MC_MAX_BITS]; + Word16 bits_to_copy; + Word16 bit_pos; + Word16 num_lfe_bands; + Word16 num_param_bands; + Word16 metadata_bit_pos; + Word16 i, j, k; +#ifndef FIX_901_PARAMMC_DEAD_CODE + int16_t l; +#endif + Word16 icc_map_size; + Word16 icc_map_size_wo_lfe; + Word16 ild_map_size; + Word16 ild_map_size_wo_lfe; + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC; + + push_wmops( "param_mc_read_bs" ); + + /* Inits */ + *nb_bits = 0; + move16(); + hMetadataPMC = hParamMC->hMetadataPMC; + icc_map_size = hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; + move16(); + icc_map_size_wo_lfe = hMetadataPMC->icc_mapping_conf->icc_map_size_wo_lfe; + move16(); + ild_map_size = hMetadataPMC->ild_mapping_conf->ild_map_size_lfe; + move16(); + ild_map_size_wo_lfe = hMetadataPMC->ild_mapping_conf->ild_map_size_wo_lfe; + move16(); + + IF( !st->bfi ) + { + metadata_bit_pos = extract_l( ivas_total_brate / FRAMES_PER_SEC - 1 ); + bits_to_copy = s_min( extract_l( ivas_total_brate / FRAMES_PER_SEC ), PARAM_MC_MAX_BITS ); + + /* copy and reverse metadata */ + FOR( bit_pos = 0; bit_pos < bits_to_copy; bit_pos++ ) + { + bit_buffer[bit_pos] = st->bit_stream[metadata_bit_pos--]; + move16(); + } + + bit_pos = 0; + move16(); + + /* read reserved bit */ + hMetadataPMC->lfe_on = bit_buffer[bit_pos++]; + move16(); + + /* get coded bwidth */ + { + Word16 pos; + Word16 bw = 0; + move16(); + FOR( pos = 0; pos < 2; pos++ ) + { + bw = add( bw, extract_l( L_shl( bit_buffer[bit_pos++], pos ) ) ); + } + hMetadataPMC->coded_bwidth = bw; + move16(); + } + + /* set tables if coded band width differs from last frame */ + IF( NE_16( hMetadataPMC->coded_bwidth, hMetadataPMC->last_coded_bwidth ) ) + { + ivas_param_mc_set_coded_bands( hMetadataPMC ); + param_mc_set_num_synth_bands( st->output_Fs, hParamMC ); + hParamMC->max_band_energy_compensation = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; + move16(); + } + + param_frame_idx = bit_buffer[bit_pos++]; + move16(); + hMetadataPMC->param_frame_idx = param_frame_idx; + move16(); + num_param_bands = hMetadataPMC->nbands_in_param_frame[param_frame_idx]; + move16(); + + hMetadataPMC->bAttackPresent = bit_buffer[bit_pos++]; + move16(); + hMetadataPMC->attackIndex = 0; + move16(); + band_step = 1; + move16(); + num_lfe_bands = 0; + move16(); + + IF( hMetadataPMC->bAttackPresent ) + { + FOR( i = 2; i >= 0; i-- ) + { + hMetadataPMC->attackIndex = add( hMetadataPMC->attackIndex, extract_l( L_shl( bit_buffer[bit_pos++], i ) ) ); + } + + band_step = PARAM_MC_TRANSIENT_BAND_STEP; + move16(); + num_lfe_bands = add( PARAM_MC_MAX_BAND_LFE / band_step, ( PARAM_MC_MAX_BAND_LFE % band_step ) ? 1 : 0 ); + num_param_bands = add( hMetadataPMC->nbands_coded / band_step, ( ( hMetadataPMC->nbands_coded % band_step ) ? 1 : 0 ) ); + } + ELSE + { + FOR( j = 0; j < PARAM_MC_MAX_BAND_LFE; j += band_step ) + { + IF( EQ_16( param_frame_idx, hMetadataPMC->coding_band_mapping[j] ) ) + { + /* LFE ICC is always the last ICC in coding band 0 */ + num_lfe_bands++; + } + } + } + + IF( !hMetadataPMC->lfe_on ) + { + num_lfe_bands = 0; + move16(); + } + +#ifndef FIX_901_PARAMMC_DEAD_CODE + if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) + { + int16_t icc_mapping_index[PARAM_MC_SZ_ICC_MAP]; + + k = 0; + for ( i = 0; i < hMetadataPMC->icc_map_size_full - 1; i++ ) + { + if ( bit_buffer[bit_pos++] == 1 ) + { + icc_mapping_index[k++] = i; + } + } + + /* last one is always C/LFE */ + icc_mapping_index[k] = hMetadataPMC->icc_map_size_full - 1; + + /* save icc mapping of the previous frame*/ + /* build icc map for the current frame */ + for ( k = 0; k < icc_map_size; k++ ) + { + hMetadataPMC->icc_mapping[param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; + hMetadataPMC->icc_mapping[param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; + } + + if ( hMetadataPMC->bAttackPresent ) + { + for ( k = 0; k < icc_map_size; k++ ) + { + for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) + { + hMetadataPMC->icc_mapping[l][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; + hMetadataPMC->icc_mapping[l][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; + } + } + } + else + { + for ( k = 0; k < icc_map_size; k++ ) + { + hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; + hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; + } + } + } + else + { + if ( hMetadataPMC->bAttackPresent ) + { + for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) + { + ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[param_frame_idx] ); + } + } + else + { + ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx] ); + } + } + +#endif + ivas_param_mc_bs_decode_parameter_values_fx( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->icc_coding, + icc_map_size_wo_lfe, icc_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icc_q_fx ); + + IF( !st->BER_detect ) + { + ivas_param_mc_bs_decode_parameter_values_fx( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->ild_coding, + ild_map_size_wo_lfe, ild_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icld_q_fx ); + } + /* set LFE ILD and ICC to zero above PARAM_MC_MAX_BAND_LFE for attack frames */ + IF( hMetadataPMC->bAttackPresent ) + { + FOR( k = PARAM_MC_MAX_BAND_LFE; k < band_step * num_lfe_bands; k++ ) + { + hParamMC->icc_q_fx[( k + 1 ) * icc_map_size - 1] = 32767; /* 1.0f in Q15 */ + move16(); + hParamMC->icld_q_fx[( k + 1 ) * ild_map_size - 1] = PARAM_MC_DEFAULT_MIN_ILD_FX; /* -92.0f in Q8 */ + move16(); + } + } + + *nb_bits = bit_pos; + move16(); + + } /* if ( !st->bfi ) */ + + IF( st->bfi ) + { + /* for PLC, use the saved ILDs and ICCs from the past and set the transient flag and transient position to zero */ + hMetadataPMC->bAttackPresent = 0; + move16(); + hMetadataPMC->attackIndex = 0; + move16(); + } + + pop_wmops(); + + return; +} +#else void ivas_param_mc_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Decoder_State *st, /* i/o: decoder state structure */ @@ -2833,26 +3024,12 @@ void ivas_param_mc_dec_read_BS( } #endif -#ifdef IVAS_FLOAT_FIXED - floatToFixed_arr16( hParamMC->icc_q, hParamMC->icc_q_fx, Q15, hMetadataPMC->nbands_coded * icc_map_size ); - ivas_param_mc_bs_decode_parameter_values_fx( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->icc_coding, - icc_map_size_wo_lfe, icc_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icc_q_fx ); - fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hMetadataPMC->nbands_coded*icc_map_size ); -#else ivas_param_mc_bs_decode_parameter_values( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->icc_coding, icc_map_size_wo_lfe, icc_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icc_q ); -#endif // IVAS_FLOAT_FIXED if ( !st->BER_detect ) { -#ifdef IVAS_FLOAT_FIXED - floatToFixed_arr16( hParamMC->icld_q, hParamMC->icld_q_fx, Q8, hMetadataPMC->nbands_coded * ild_map_size ); - ivas_param_mc_bs_decode_parameter_values_fx( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->ild_coding, - ild_map_size_wo_lfe, ild_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icld_q_fx ); - fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hMetadataPMC->nbands_coded*ild_map_size); -#else ivas_param_mc_bs_decode_parameter_values( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->ild_coding, ild_map_size_wo_lfe, ild_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icld_q ); -#endif // IVAS_FLOAT_FIXED } /* set LFE ILD and ICC to zero above PARAM_MC_MAX_BAND_LFE for attack frames */ if ( hMetadataPMC->bAttackPresent ) @@ -2879,6 +3056,7 @@ void ivas_param_mc_dec_read_BS( return; } +#endif /*------------------------------------------------------------------------- @@ -3390,7 +3568,6 @@ void ivas_param_mc_dec_render_fx( /*Decorrelator*/ Word32 onset_filter_fx[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; - Word16 tmp_q = Q6; /* format converter */ Word16 channel_active[MAX_OUTPUT_CHANNELS]; UWord16 nband_synth, nbands_to_zero; @@ -3705,7 +3882,8 @@ void ivas_param_mc_dec_render_fx( hParamMC->subframes_rendered = last_sf; *nSamplesAvailableNext = ( hParamMC->num_slots - hParamMC->slots_rendered ) * NS2SA( output_Fs, CLDFB_SLOT_NS ); - for (int i = 0; i < MAX_OUTPUT_CHANNELS; i++) { + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { channel_active_fx[i] = channel_active[i]; } pop_wmops(); @@ -5055,12 +5233,6 @@ static void ivas_param_mc_get_mixing_matrices( // f2me_buf( hParamMC->ls_conv_dmx_matrix, hParamMC->ls_conv_dmx_matrix_fx, &hParamMC->ls_conv_dmx_e, nY_cov * nY_intern ); //} - floatToFixed_arr( hParamMC->icld_q, icld_q_fx, 8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - for ( int lp = 0; lp < hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; lp++ ) - { - icc_q_fx[lp] = (Word16)(hParamMC->icc_q[lp] * 32767); - } - ivas_param_mc_dequantize_cov_fx( hParamMC, icld_q_fx + param_band_idx * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe, icc_q_fx + param_band_idx * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe, @@ -6440,42 +6612,42 @@ static void ivas_param_mc_dequantize_cov_fx( #ifdef IVAS_FLOAT_FIXED static void param_mc_set_num_synth_bands( - const Word32 output_Fs, /* i : output sampling frequency */ + const Word32 output_Fs, /* i : output sampling frequency */ PARAM_MC_DEC_HANDLE hParamMC /* i/o: Parametric MC handle */ ) { UWord16 max_param_band_synth; const UWord16 *param_mc_bands_coded; - SWITCH ( hParamMC->hMetadataPMC->num_parameter_bands ) + SWITCH( hParamMC->hMetadataPMC->num_parameter_bands ) { case 20: - param_mc_bands_coded = (UWord16*)param_mc_bands_coded_20; + param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_20; BREAK; case 10: - param_mc_bands_coded = (UWord16*)param_mc_bands_coded_10; + param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_10; BREAK; case 14: default: - param_mc_bands_coded = (UWord16*)param_mc_bands_coded_14; + param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_14; BREAK; } move16(); - SWITCH ( output_Fs ) + SWITCH( output_Fs ) { case 8000: max_param_band_synth = param_mc_bands_coded[NB]; - break; + BREAK; case 16000: max_param_band_synth = param_mc_bands_coded[WB]; - break; + BREAK; case 32000: max_param_band_synth = param_mc_bands_coded[SWB]; - break; + BREAK; case 48000: default: max_param_band_synth = param_mc_bands_coded[FB]; - break; + BREAK; } move16(); hParamMC->num_param_bands_synth = s_min( hParamMC->hMetadataPMC->nbands_coded, max_param_band_synth ); @@ -6857,20 +7029,21 @@ static ivas_error param_mc_get_diff_proto_info( * * reads and decodes a sequence of Parametric MC parameters from the bitstream *-------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED static void ivas_param_mc_bs_decode_parameter_values_fx( - UWord16 bit_buffer[], /* i : bitstream buffer */ - Word16 *bit_pos, /* i/o: current bitstream buffer position */ - const Word16 max_bits, /* i : maximum available bits in the buffer */ - Word16 *BER_detect, /* i/o: bit error detection flag */ + UWord16 bit_buffer[], /* i : bitstream buffer */ + Word16 *bit_pos, /* i/o: current bitstream buffer position */ + const Word16 max_bits, /* i : maximum available bits in the buffer */ + Word16 *BER_detect, /* i/o: bit error detection flag */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, /* i : Parametric MC metadata information */ HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, /* i : Parametric MC parameter quantization and coding tables */ - const Word16 map_size_wo_lfe, /* i : number of parameters per band (w/o LFEs) */ - const Word16 map_size, /* i : number of parameters per band (total) */ - const Word16 num_lfe_bands, /* i : number of parameter bands with coded LFE */ - const Word16 band_step, /* i : parameter band step */ - const Word16 num_param_bands, /* i : number of parameter bands to decode */ - Word16 *value_buffer /* o : output buffer for decoded parameter values */ + const Word16 map_size_wo_lfe, /* i : number of parameters per band (w/o LFEs) */ + const Word16 map_size, /* i : number of parameters per band (total) */ + const Word16 num_lfe_bands, /* i : number of parameter bands with coded LFE */ + const Word16 band_step, /* i : parameter band step */ + const Word16 num_param_bands, /* i : number of parameter bands to decode */ + Word16 *value_buffer /* o : output buffer for decoded parameter values */ ) { Word16 range_coding; @@ -6889,30 +7062,30 @@ static void ivas_param_mc_bs_decode_parameter_values_fx( range_coding = bit_buffer[( *bit_pos )++]; /* Decoding the sequence */ - n_lfe_idx = sub(map_size , map_size_wo_lfe); - sz_seq = add(imult1616(num_param_bands , map_size_wo_lfe ) , imult1616(num_lfe_bands , n_lfe_idx)); + n_lfe_idx = sub( map_size, map_size_wo_lfe ); + sz_seq = add( imult1616( num_param_bands, map_size_wo_lfe ), imult1616( num_lfe_bands, n_lfe_idx ) ); set_s( idx, 0, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); set16_fx( dequant_ordered_fx, 0, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); set16_fx( dequant_seq_fx, 0, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); - IF ( range_coding ) + IF( range_coding ) { delta_coding = bit_buffer[( *bit_pos )++]; - IF ( delta_coding ) + IF( delta_coding ) { - idx_prev = sub(add(shr(hParamCodingInfo->quantizer_size , 1) , hParamCodingInfo->quantizer_size % 2) , 1); - sz_alphabet = sub(shl(hParamCodingInfo->quantizer_size,1) , 1); - idx_offset = sub(hParamCodingInfo->quantizer_size , 1); + idx_prev = sub( add( shr( hParamCodingInfo->quantizer_size, 1 ), hParamCodingInfo->quantizer_size % 2 ), 1 ); + sz_alphabet = sub( shl( hParamCodingInfo->quantizer_size, 1 ), 1 ); + idx_offset = sub( hParamCodingInfo->quantizer_size, 1 ); /* read range coded delta ICC indices */ - *bit_pos = add(*bit_pos,ivas_param_mc_range_decoder_LC( &bit_buffer[*bit_pos], delta_idx, BER_detect, sz_seq, sz_alphabet, - hParamCodingInfo->cum_freq_delta, hParamCodingInfo->sym_freq_delta, PARAM_MC_RANGE_CODER_TOT_SHIFT, max_bits - *bit_pos )); + *bit_pos = add( *bit_pos, ivas_param_mc_range_decoder_LC( &bit_buffer[*bit_pos], delta_idx, BER_detect, sz_seq, sz_alphabet, + hParamCodingInfo->cum_freq_delta, hParamCodingInfo->sym_freq_delta, PARAM_MC_RANGE_CODER_TOT_SHIFT, max_bits - *bit_pos ) ); /* delta index to absolute index */ - FOR ( j = 0; j < sz_seq; j++ ) + FOR( j = 0; j < sz_seq; j++ ) { - idx[j] = add(idx_prev , sub(delta_idx[j] , idx_offset)); + idx[j] = add( idx_prev, sub( delta_idx[j], idx_offset ) ); idx_prev = idx[j]; } } @@ -6920,12 +7093,12 @@ static void ivas_param_mc_bs_decode_parameter_values_fx( { /* read range coded absolute ICC indices */ sz_alphabet = hParamCodingInfo->quantizer_size; - *bit_pos = add(*bit_pos,ivas_param_mc_range_decoder_LC( &bit_buffer[*bit_pos], idx, BER_detect, sz_seq, sz_alphabet, - hParamCodingInfo->cum_freq, hParamCodingInfo->sym_freq, PARAM_MC_RANGE_CODER_TOT_SHIFT, max_bits - *bit_pos )); + *bit_pos = add( *bit_pos, ivas_param_mc_range_decoder_LC( &bit_buffer[*bit_pos], idx, BER_detect, sz_seq, sz_alphabet, + hParamCodingInfo->cum_freq, hParamCodingInfo->sym_freq, PARAM_MC_RANGE_CODER_TOT_SHIFT, max_bits - *bit_pos ) ); } /* dequantize */ - FOR ( j = 0; j < sz_seq; j++ ) + FOR( j = 0; j < sz_seq; j++ ) { dequant_seq_fx[j] = hParamCodingInfo->quantizer_fx[idx[j]]; } @@ -6934,38 +7107,38 @@ static void ivas_param_mc_bs_decode_parameter_values_fx( { set16_fx( dequant_seq_fx, 0, PARAM_MC_MAX_PARAMETER_BANDS * PARAM_MC_MAX_VAL_MAP_SIZE ); /* read uniformly coded ICCs */ - *bit_pos = add(*bit_pos,ivas_param_mc_uniform_decoder_fx( dequant_seq_fx, sz_seq, hParamCodingInfo->quantizer_fx, hParamCodingInfo->uni_bits, &bit_buffer[*bit_pos] )); + *bit_pos = add( *bit_pos, ivas_param_mc_uniform_decoder_fx( dequant_seq_fx, sz_seq, hParamCodingInfo->quantizer_fx, hParamCodingInfo->uni_bits, &bit_buffer[*bit_pos] ) ); } /* reorder from sequential to parameter-band-wise */ k = 0; - FOR ( j = 0; j < map_size_wo_lfe; ++j ) + FOR( j = 0; j < map_size_wo_lfe; ++j ) { - FOR ( i = 0; i < num_param_bands; ++i ) + FOR( i = 0; i < num_param_bands; ++i ) { dequant_ordered_fx[j + i * map_size] = dequant_seq_fx[k++]; } } - FOR ( i = 0; i < num_lfe_bands; i++ ) + FOR( i = 0; i < num_lfe_bands; i++ ) { - FOR ( j = 0; j < n_lfe_idx; j++ ) + FOR( j = 0; j < n_lfe_idx; j++ ) { dequant_ordered_fx[map_size - n_lfe_idx + j + i * map_size] = dequant_seq_fx[k++]; } } - IF ( !( *BER_detect ) ) + IF( !( *BER_detect ) ) { j = 0; - FOR ( k = 0; k < hMetadataPMC->nbands_coded; k += band_step ) + FOR( k = 0; k < hMetadataPMC->nbands_coded; k += band_step ) { - IF ( hMetadataPMC->bAttackPresent || EQ_16(hMetadataPMC->param_frame_idx , hMetadataPMC->coding_band_mapping[k]) ) + IF( hMetadataPMC->bAttackPresent || EQ_16( hMetadataPMC->param_frame_idx, hMetadataPMC->coding_band_mapping[k] ) ) { Copy( dequant_ordered_fx + j * map_size, value_buffer + k * map_size, map_size ); j++; } - IF ( hMetadataPMC->bAttackPresent && k + 1 < hMetadataPMC->nbands_coded ) + IF( hMetadataPMC->bAttackPresent && k + 1 < hMetadataPMC->nbands_coded ) { Copy( value_buffer + k * map_size, value_buffer + ( k + 1 ) * map_size, map_size ); } @@ -6974,8 +7147,7 @@ static void ivas_param_mc_bs_decode_parameter_values_fx( return; } -#endif // IVAS_FLOAT_FIXED - +#else static void ivas_param_mc_bs_decode_parameter_values( uint16_t bit_buffer[], /* i : bitstream buffer */ int16_t *bit_pos, /* i/o: current bitstream buffer position */ @@ -7094,3 +7266,4 @@ static void ivas_param_mc_bs_decode_parameter_values( return; } +#endif diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 9aa0a7109..37f986184 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1402,8 +1402,6 @@ ivas_error ivas_mc_dec_config( { nchan_out_cov = nchan_out_transport; } - floatToFixed_arr( hParamMC->icc_q, hParamMC->icc_q_fx, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - floatToFixed_arr( hParamMC->icld_q, hParamMC->icld_q_fx, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); Word32 max_cx_old_fx, max_cy_old_fx, max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; float max_cx_old = hParamMC->h_output_synthesis_cov_state.cx_old[0][0], max_cy_old = hParamMC->h_output_synthesis_cov_state.cy_old[0][0], max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) @@ -1501,8 +1499,6 @@ ivas_error ivas_mc_dec_config( // } // } //} - fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); IF( hParamMC->diff_proto_info ) FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 5cf0a60b8..2b6fbddfa 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -869,11 +869,12 @@ typedef struct ivas_param_mc_dec_data_structure DIRAC_OUTPUT_SYNTHESIS_PARAMS h_output_synthesis_params; int16_t max_band_energy_compensation; HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC; +#ifndef IVAS_FLOAT_FIXED float *icc_q; /* ICC parameters*/ float *icld_q; -#ifdef IVAS_FLOAT_FIXED - Word16 *icc_q_fx; /* ICC parameters*/ - Word16 *icld_q_fx; +#else + Word16 *icc_q_fx; /* ICC parameters*/ /* Q15 */ + Word16 *icld_q_fx; /* Q8 */ #endif int16_t max_param_band_abs_cov; #ifndef IVAS_FLOAT_FIXED diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index d3ce9ff94..0fbaf4ec2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1367,6 +1367,14 @@ static void ivas_dirac_dec_binaural_internal( { hDiracDecBin->hDiffuseDist = &diffuseDistData; ivas_spar_param_to_masa_param_mapping_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_cldfb, subframe ); +#ifndef INTER_FLT_2_FIX + floatToFixed_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, Q15, CLDFB_NO_COL_MAX ); + + FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) + { + floatToFixed_arrL(st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band[idx], st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band_fx[idx], Q31, IVAS_MAX_NUM_FB_BANDS ); + } +#endif ivas_sba_prototype_renderer_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_cldfb, subframe ); } @@ -5724,7 +5732,6 @@ static void ivas_masa_ext_rend_parambin_internal( } } - Word16 q_inp = Q6; if ( hCombinedOrientationData ) { for ( i = 0; i < 3; i++ ) @@ -5741,6 +5748,7 @@ static void ivas_masa_ext_rend_parambin_internal( IF( EQ_16( nchan_transport, 2 ) ) { #ifdef IVAS_FLOAT_FIXED + Word16 q_inp = Q6; FOR( Word16 cha = 0; cha < 2; cha++ ) FOR( slot = 0; slot < 4; slot++ ) FOR( Word16 ind = 0; ind < 60; ind++ ) @@ -6012,6 +6020,7 @@ static void ivas_masa_ext_rend_parambin_internal( { output_fx[ch] = output_fx_buff[ch]; floatToFixed_arrL32(output_f[ch], output_fx[ch], Q11, L_FRAME48k); + IF(hMasaExtRend->cldfbAnaRend[ch]) floatToFixed_arrL32(hMasaExtRend->cldfbAnaRend[ch]->cldfb_state, hMasaExtRend->cldfbAnaRend[ch]->cldfb_state_fx, Q11, hMasaExtRend->cldfbAnaRend[ch]->p_filter_length - hMasaExtRend->cldfbAnaRend[ch]->no_channels); } #endif @@ -6166,6 +6175,7 @@ static void ivas_masa_ext_rend_parambin_internal( FOR( ch = 0; ch < 2; ch++) { + IF(hMasaExtRend->cldfbAnaRend[ch]) fixedToFloat_arrL32(hMasaExtRend->cldfbAnaRend[ch]->cldfb_state_fx, hMasaExtRend->cldfbAnaRend[ch]->cldfb_state, Q11, hMasaExtRend->cldfbAnaRend[ch]->p_filter_length - hMasaExtRend->cldfbAnaRend[ch]->no_channels); } #endif diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 2b8619284..f01ea233f 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -210,9 +210,11 @@ ivas_error ivas_HRTF_fastconv_binary_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FASTCONV HRTF tables!" ); } - +#ifdef IVAS_FLOAT_FIXED + ivas_init_binaural_hrtf_fx( *hHrtfFastConv ); +#else ivas_init_binaural_hrtf( *hHrtfFastConv ); - +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7e20e2671..b4d9a1da1 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1689,6 +1689,17 @@ ivas_error ivas_rend_crendProcessSubframe( * Reverberator *----------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_binaural_reverb_open_fastconv_fx( + REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ + const Word16 numBins, /* i : number of CLDFB bins */ + const Word16 numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ + const AUDIO_CONFIG internal_config, /* i : internal audio config for FastConv */ + const Word32 sampling_rate, /* i : sampling rate */ + const HRTFS_FASTCONV_HANDLE hHrtfFastConv /* i : FastConv HRTF handle */ +); +#else ivas_error ivas_binaural_reverb_open_fastconv( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ @@ -1698,6 +1709,7 @@ ivas_error ivas_binaural_reverb_open_fastconv( const int32_t sampling_rate, /* i : sampling rate */ const HRTFS_FASTCONV_HANDLE hHrtfFastConv /* i : FastConv HRTF handle */ ); +#endif ivas_error ivas_binaural_reverb_open_parambin( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index be4a8c063..4a2e6b7ce 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -3896,7 +3896,7 @@ static ivas_error ivas_binaural_reverb_open_fx( return IVAS_ERR_OK; } -#endif +#else static ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ @@ -4060,14 +4060,60 @@ static ivas_error ivas_binaural_reverb_open( return IVAS_ERR_OK; } - +#endif /*------------------------------------------------------------------------- * ivas_binaural_reverb_open_fastconv() * * Allocate and initialize binaural room reverberator handle for FastConv *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_binaural_reverb_open_fastconv_fx( + REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ + const Word16 numBins, /* i : number of CLDFB bins */ + const Word16 numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ + const AUDIO_CONFIG internal_config, /* i : internal audio config for FastConv */ + const Word32 sampling_rate, /* i : sampling rate */ + const HRTFS_FASTCONV_HANDLE hHrtfFastConv /* i : FastConv HRTF handle */ +) +{ + ivas_error error; + const Word32 *revTimes; + const Word32 *revEne; + Word32 t60[CLDFB_NO_CHANNELS_MAX]; + Word32 ene[CLDFB_NO_CHANNELS_MAX]; + Word16 preDelay; + error = IVAS_ERR_OK; + + IF ( ( roomAcoustics != NULL ) && roomAcoustics->override ) + { + /* THIS PART IS YET TO BE CONVERTED AS REVERB_UTILS.C IS NOT INVOKED IN GPROF */ + float t60_flt[CLDFB_NO_CHANNELS_MAX]; + float ene_flt[CLDFB_NO_CHANNELS_MAX]; + revTimes = t60; + revEne = ene; + if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, internal_config, false, sampling_rate, t60_flt, ene_flt) ) != IVAS_ERR_OK ) + { + return error; + } + preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); + floatToFixed_arrL(t60_flt, t60, Q31, CLDFB_NO_CHANNELS_MAX); + floatToFixed_arrL(ene_flt, ene, Q31, CLDFB_NO_CHANNELS_MAX); + } + ELSE + { + revTimes = hHrtfFastConv->fastconvReverberationTimes_fx; + revEne = hHrtfFastConv->fastconvReverberationEneCorrections_fx; + preDelay = 10; + } + + error = ivas_binaural_reverb_open_fx( hReverbPr, numBins, numCldfbSlotsPerFrame, sampling_rate, revTimes, revEne, preDelay ); + + return error; +} +#else ivas_error ivas_binaural_reverb_open_fastconv( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ @@ -4108,7 +4154,7 @@ ivas_error ivas_binaural_reverb_open_fastconv( return error; } - +#endif /*------------------------------------------------------------------------- * ivas_binaural_reverb_open_parambin() @@ -4134,7 +4180,7 @@ ivas_error ivas_binaural_reverb_open_parambin( error = IVAS_ERR_OK; - if ( ( roomAcoustics != NULL ) && roomAcoustics->override ) + IF ( ( roomAcoustics != NULL ) && roomAcoustics->override ) { revTimes = t60; revEne = ene; @@ -4146,7 +4192,7 @@ ivas_error ivas_binaural_reverb_open_parambin( //preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); preDelay = (Word16) L_shr_r(Mpy_32_32(1677721600 /*800 in Q21*/, roomAcoustics->acousticPreDelay_fx /*Q27*/ ), Q17); } - else + ELSE { revTimes = hHrtfParambin->parametricReverberationTimes_fx; revEne = hHrtfParambin->parametricReverberationEneCorrections_fx; diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 5330ecbcb..9bd2b542d 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -54,6 +54,910 @@ const float FASTCONV_HOA3_latency_s = 0.000020833f; +const Word32 leftHRIRReal_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { 189679184, 304322592, 107436456, }, + { 242399360, -302261536, 44863616, }, + { 11860552, 60100016, -1683090, }, + { 25304336, 104153, -207232, }, + { 21139292, -19353660, -8217883, }, + { 7248831, -2365453, 9037148, }, + { -26986890, 31329638, 9359807, }, + { -7344931, 43398496, -10575820, }, + { -19937238, 13084081, 28024662, }, + { 26909044, -42307040, -10624675, }, + { -2450816, 4110284, -718333, }, + { 5272609, -27694486, -1728188, }, + { -2057826, -12568685, -1696512, }, + { 4153234, -22881976, 5524939, }, + { 7628936, -1821066, -681826, }, + { -3011309, 570694, 995359, } + }, + { + { 5991480, -273394528, -70961448, }, + { 76770392, -439989344, 50001472, }, + { 1802813, 41517840, -4589173, }, + { 2413235, 12974559, 13751412, }, + { 11226508, 30864708, 13184476, }, + { 11241003, 13223667, 12262132, }, + { -26838176, -61006788, -28770912, }, + { 5379447, 112868520, 14491220, }, + { -50776712, -218518816, -55487220, }, + { 20914344, 47507172, 31159450, }, + { 1543504, 8399345, -417686, }, + { 11120744, 56255480, 37819336, }, + { -4721243, 1569811, 5162014, }, + { 2341294, -30473866, 3795677, }, + { 5437429, 39253852, 18807662, }, + { -3028489, -3227668, -131533, } + }, + { + { -103299336, -110683456, -102613208, }, + { -149763360, 126817496, -135879344, }, + { -1404454, 36626408, 381178, }, + { -23609436, 57801132, 3221226, }, + { -12256763, 65424164, 4438312, }, + { 4104915, 56324736, -8615704, }, + { 4727149, -149730608, 3177739, }, + { 8160438, 96794064, 20379620, }, + { -20394116, -285178304, -28841780, }, + { -28674812, 217949728, -35490388, }, + { 2268280, 26517128, -10790032, }, + { -17635672, 217100928, -30644592, }, + { -10921565, 13795972, 1620276, }, + { 214212, -26433914, 2987150, }, + { -10144176, 91749632, -2559801, }, + { -7639136, 26703960, -14314589, } + }, + { + { -33778308, 274702336, 33510408, }, + { -88140248, 585712192, 58195196, }, + { 4900021, 34997540, -1655173, }, + { -9982041, 43882756, -413927, }, + { -11105712, 50252728, 6448357, }, + { 443455, 63618128, -804233, }, + { 13956496, -165173168, -12775917, }, + { -4399121, 29312078, -5219459, }, + { 21663278, -239384304, -30239790, }, + { -16560857, 380443360, 43821016, }, + { 1107565, 18220326, -13462038, }, + { -14711874, 246313696, -17947058, }, + { -11474542, -3762928, -5577015, }, + { -1122060, -16861504, 4379793, }, + { -15287399, 38154880, -25150792, }, + { -4081293, 62483720, 1358820, } + }, + { + { 61600032, 37331856, 91757144, }, + { 56944824, 351084576, 99906848, }, + { 17413408, 12843026, 1846836, }, + { 26146150, 75161392, -28630788, }, + { 4660040, 135259792, -38225208, }, + { -2360622, 64597920, 166430, }, + { 13772886, -174139984, -3468723, }, + { -2582349, 33209760, -4078608, }, + { 52569864, -344211040, 8208220, }, + { 6097243, 299348480, 76846632, }, + { 2537252, -8970576, 233002, }, + { 7102266, 89445912, 49996640, }, + { -3978750, 6330782, -11567958, }, + { -2896956, -18562312, 6148783, }, + { 5714454, 6291590, -11762305, }, + { 2909304, 16636556, 23424214, } + }, + { + { 35767952, -48289928, 51695836, }, + { 122719024, 248484800, 12538620, }, + { 16426639, 29774324, 5659157, }, + { 56310780, 181175136, -1972464, }, + { 39025684, 217555120, -20864952, }, + { 2611340, 43738872, -11940546, }, + { 13994614, -115656488, 29881698, }, + { 8351564, 18503256, -14416595, }, + { 43786656, -177021376, 90108952, }, + { 2380486, 120777704, -14774687, }, + { 458488, -9656160, 627602, }, + { -9182103, 11922292, 14430553, }, + { 9099425, 37925100, -2336999, }, + { -3535295, -46244988, -2520609, }, + { 31896574, 57557392, 2627983, }, + { 3047279, -31762356, 1707250, } + }, + { + { -133453760, 248134224, -24065238, }, + { 49510236, 309569984, 16902306, }, + { -9960029, 63480152, -102005, }, + { 12905303, 103205376, 40805412, }, + { 39440148, 59966872, 45799920, }, + { 24383604, 28147068, -7584912, }, + { 2330557, -47321948, -1519345, }, + { 31236760, -36228588, 1898912, }, + { -60579440, 97428112, -7415261, }, + { 27457726, 30667678, 19580220, }, + { -1240172, -5094368, -1571958, }, + { -19764902, 37777996, 7081328, }, + { 13549548, 1037772, 12015708, }, + { 6334540, -37628744, -9266929, }, + { 42618424, -2711198, 22687628, }, + { 14770929, -17062294, -7906498, } + }, + { + { -316071488, 37549824, -63453848, }, + { -180852480, -46988552, -71499392, }, + { -49294412, 119185, -16876538, }, + { -128887672, -112254336, -14310831, }, + { -57196080, -112747184, -3730716, }, + { 46474768, 41647224, -7485055, }, + { 19670950, -6565932, 11464878, }, + { 32199906, -13280576, 9488120, }, + { -115142168, 14012331, -24771224, }, + { 8647380, -44480828, -6425271, }, + { -1937030, 11526618, 4697084, }, + { -24869472, -5836324, -8390219, }, + { -4409858, -42788076, -1603633, }, + { 28117540, 15736760, 7562364, }, + { 10062035, -60990148, 5612986, }, + { 31954556, 17682380, 2305324, } + }, + { + { -361012928, -107035952, 1838246, }, + { -339260544, -74138648, -23380192, }, + { -70194800, -31168040, -679679, }, + { -243166560, -1868311, -30283814, }, + { -153038816, 16125455, -30584462, }, + { 59203440, -6156299, 9015673, }, + { 35418448, 3013993, 2372970, }, + { -1691680, 25706990, 1106491, }, + { -87555056, -70230768, 971736, }, + { -10498511, -13577465, -12486544, }, + { -10082973, 18462454, 3297461, }, + { -1347009, -24953224, -4918812, }, + { -22036940, -12890807, -9094593, }, + { 35231080, 14661945, 5639829, }, + { -39492224, 21459268, -15654619, }, + { 33756296, 3649112, 6452652, } + }, + { + { -291765184, 31956168, 34410204, }, + { -375867072, 43094628, 22290880, }, + { -83209624, -4979478, 9856950, }, + { -254651840, 67848136, -1629403, }, + { -175750064, 61229052, -7963406, }, + { 38247220, -31672162, 2454574, }, + { 47128676, 67109, -594316, }, + { -50551764, -20916490, -6397891, }, + { -10248329, 29680372, 20811800, }, + { -12695386, 21452288, 1926293, }, + { -23096724, -7217156, -4312147, }, + { 41781980, 24153822, 5424007, }, + { -21937082, 11606612, 1177358, }, + { 24022288, -16567299, -4268661, }, + { -66468376, 30025580, -6706592, }, + { 13777718, -18653580, 1938641, } + }, + { + { -180420832, 15508053, 16914118, }, + { -315297312, -4876399, 22964654, }, + { -97981624, 13826037, 4172561, }, + { -176048032, -34457984, 18804440, }, + { -125448480, -36109936, 16757889, }, + { -3931506, 16374563, -7987029, }, + { 46259484, 3149285, -1439888, }, + { -84816480, -9487046, -4279935, }, + { 55625196, 20936354, 10554882, }, + { -4123706, -2500208, 8121783, }, + { -29963840, -9622337, -1771674, }, + { 77292232, 7432978, 4481262, }, + { -9511205, -2664490, 3375308, }, + { 4716948, -6528351, -3870839, }, + { -65016140, -18563922, 10410464, }, + { -17283486, 16813186, -5451387, } + }, + { + { -82274392, -4493610, -4998268, }, + { -215839824, 63351, 6945499, }, + { -107246944, -3540664, 659278, }, + { -69171520, 2429878, 10962367, }, + { -49844168, -5693516, 11807402, }, + { -41827076, 13609141, -1554241, }, + { 30812096, -4552129, -1991791, }, + { -88808648, 12234751, 4199405, }, + { 79944376, -20038170, -7359964, }, + { 6064494, -9715753, 3017752, }, + { -29600914, 4624069, 3562139, }, + { 86208584, -8352101, -3291556, }, + { 7969312, -1806034, 34360, }, + { -14738717, -891206, 2032593, }, + { -52577916, -17246978, 7355132, }, + { -40023188, 11195906, -3377992, } + }, + { + { -11520176, -16800838, -8475044, }, + { -121099824, -8950175, -2939905, }, + { -96168616, -3455301, 530965, }, + { 16582869, -2209761, -542240, }, + { 12630425, 2364380, -1235340, }, + { -61056720, -850404, 7627325, }, + { 3321620, 1947768, -172872, }, + { -70016016, 70867, 4503273, }, + { 71465032, -759672, -10794327, }, + { 14083735, 3701188, -3001109, }, + { -25223270, 6362994, 1888712, }, + { 66658428, 2034741, -3216931, }, + { 21100638, -2749316, -1918777, }, + { -33149632, 10821707, -206695, }, + { -39621612, 8810052, -4913980, }, + { -47799764, -4650376, 3549791, } + }, + { + { 42451456, 21299280, -1612760, }, + { -41670848, 17740900, -3934190, }, + { -48837536, 14950781, 521302, }, + { 65235720, -1077500, -5389647, }, + { 51329692, 3191161, -4767414, }, + { -53909892, -8493298, 3687766, }, + { -32504312, -6902013, 2399813, }, + { -41712184, 894964, -538482, }, + { 49881752, 9771587, -2830920, }, + { 21916682, 7760469, -2321967, }, + { -16160888, 1179505, -1459752, }, + { 23418310, -9116068, -65498, }, + { 22019224, 804770, -699543, }, + { -47476032, 4873714, -712428, }, + { -27396522, 13417478, -4742181, }, + { -48884780, -6140193, 2001455, } + }, + { + { 88989040, -11040213, 2617783, }, + { 27049704, -19992536, -533650, }, + { 37626060, -19404662, -939524, }, + { 90464360, -9076340, -4810900, }, + { 75970992, -7735236, -3192771, }, + { -12238509, -5801964, -3783329, }, + { -67951216, 8986682, 2831457, }, + { -14402636, -9207873, -1178969, }, + { 24434068, 2305861, 3216394, }, + { 29472066, -4461934, 941672, }, + { -1956895, -5533529, -1078574, }, + { -30696132, 7948374, 2563022, }, + { 5944235, 5713380, -133144, }, + { -58457188, -2496450, 4172024, }, + { -21294448, -10089415, 2979634, }, + { -49573588, -411780, -426812, } + }, + { + { 128727688, 3776350, 1412507, }, + { 85088672, 12749610, 1985349, }, + { 145171504, 23826868, -3697967, }, + { 111840408, 8870181, -1000191, }, + { 101389680, 9131637, -709207, }, + { 58888832, 21438330, -5841156, }, + { -87093344, -6423661, 1226213, }, + { 4442607, 5873905, 1722282, }, + { -4634270, -12062416, 2022393, }, + { 33332704, -2255395, 806917, }, + { 13388487, 5470178, 262530, }, + { -77616504, -11276437, 3949223, }, + { -24839944, -5436355, 712428, }, + { -68098856, -10958609, 2998961, }, + { -26676042, -6561100, 5107253, }, + { -54116588, -608275, 588947, } + }, + { + { 160432064, -3110093, -737124, }, + { 127650720, -4705674, 1635309, }, + { 241246704, -25421912, -2492155, }, + { 134621984, -2611877, -1050656, }, + { 131793216, -5808407, -472983, }, + { 134059888, -26525718, -2126546, }, + { -73410656, -4699231, -995896, }, + { 13879724, 1817308, 2222109, }, + { -35398048, 12080132, -1765232, }, + { 30884572, 4506495, -1458678, }, + { 24806658, -2606508, 1139777, }, + { -98636608, 8537858, 754304, }, + { -61230664, 6629282, 2826089, }, + { -69490424, 5415954, -2579665, }, + { -38364796, 12315282, 798864, }, + { -63967632, 4951561, 297963, } + }, + { + { 185763248, 4479114, -1353452, }, + { 153832304, -309238, -257698, }, + { 290788064, 7578470, 1229434, }, + { 153667488, 5258651, -2077154, }, + { 161042480, 5226439, -1700270, }, + { 176488800, 10183367, 3265249, }, + { -20143396, 18489298, -1172526, }, + { 22658100, -1901060, 338229, }, + { -62093952, -2499671, -2667712, }, + { 20965346, -1632625, -2285460, }, + { 30292404, 601295, 1700270, }, + { -77775952, 10266582, -1833414, }, + { -89274120, -9709847, 2138357, }, + { -54588496, 11563126, -2695629, }, + { -42026256, -3581466, -3647501, }, + { -75187160, -2548526, -672162, } + }, + { + { 208514224, -5304822, -991601, }, + { 169719920, -48318, -2152316, }, + { 275570464, 19114216, 161061, }, + { 159189200, -3106335, -143345, }, + { 178980944, -3876745, -1544578, }, + { 158604560, 22049288, 1932735, }, + { 61370252, -22639846, 114890, }, + { 43689480, -3373697, -1739462, }, + { -80673984, -3013993, 260382, }, + { 2893734, 114890, -209380, }, + { 34706020, 1522029, 1552631, }, + { -14364518, -24151138, 210453, }, + { -91525752, -1062468, -83752, }, + { -27262304, -13845901, 1780801, }, + { -25509422, -13974213, -2544231, }, + { -82675440, -2627446, 635118, } + }, + { + { 231195936, 5265630, -641561, }, + { 184304032, 5625334, -2100776, }, + { 208716624, -26603564, -4437238, }, + { 143026176, -9013526, 463856, }, + { 176169360, -4109210, -1348620, }, + { 83453896, -32672890, -5035849, }, + { 144423648, 14431627, -525060, }, + { 85177792, 13616120, -2009508, }, + { -92251600, 1479616, 3518652, }, + { -23432804, -5090610, 2103460, }, + { 48676476, -792421, -562641, }, + { 71161168, 19383724, 1622424, }, + { -57096760, 12967580, -226023, }, + { -279710, 5210332, 4049081, }, + { 10645613, 19659676, 3597035, }, + { -83698176, 1516124, 2621541, } + }, + { + { 253110480, -4453881, -644245, }, + { 202792784, -9002251, 316754, }, + { 126104536, 14142790, -4711579, }, + { 106415864, 15707232, -2575370, }, + { 149847648, 8284455, -1737314, }, + { -18028662, 17587892, -6094022, }, + { 199054016, -3391951, -3665755, }, + { 142919872, -15989626, -756988, }, + { -99546064, 6783901, 2951716, }, + { -53973244, 10205916, 1722819, }, + { 81119584, -5608154, -3808562, }, + { 147441392, -6831146, -2094333, }, + { 7497939, -16030429, -641561, }, + { 17021492, 5471789, 1440425, }, + { 55233280, -5935108, 5962489, }, + { -77189688, 3450469, 1087701, } + }, + { + { 271380192, 3393561, -754304, }, + { 225036960, 5210332, 2160369, }, + { 61864172, -3352759, -230854, }, + { 59377384, -7401840, -3531537, }, + { 106045960, -8349417, -395137, }, + { -111889800, -4412542, 1377611, }, + { 204785120, -613107, -4148939, }, + { 199535584, 8651675, -1597191, }, + { -102982040, -9226127, -2387465, }, + { -79090216, -8512088, -667331, }, + { 128752920, 15685757, -4660577, }, + { 186985152, 4001836, -5465883, }, + { 80273472, 16455093, -1806571, }, + { 26085484, -3606162, -2874944, }, + { 100301448, -5814849, -549756, }, + { -62251792, 960999, -2479270, } + }, + { + { 283445824, -2472291, -425739, }, + { 250145872, 394063, 347892, }, + { 31551366, 1824824, 2136746, }, + { 11241540, 1342177, 860067, }, + { 55291800, 12691628, 486942, }, + { -177572208, 8174934, 7242389, }, + { 157573760, 6961068, 1270774, }, + { 233900160, -4170950, -3251290, }, + { -101713416, -5664525, -4573604, }, + { -89047560, -841814, -1887638, }, + { 172231408, -18637474, -468688, }, + { 174405200, -2156074, -1228361, }, + { 133267464, -12697534, -599685, }, + { 36203888, -8750996, -2057826, }, + { 146519056, -4073240, -8343511, }, + { -41135048, -11688753, -1687385, } + }, + { + { 288816672, 65498, -69256, }, + { 279945440, 3285650, -3053185, }, + { 31862752, 1466195, 632971, }, + { -34104188, -8149164, 4543002, }, + { 9822053, -10109816, -583042, }, + { -205254336, -11177652, 4417374, }, + { 71791992, -27465242, 4102768, }, + { 229422656, -2577517, -2360085, }, + { -101560944, 13728326, 1846836, }, + { -82175608, 9631464, 331786, }, + { 185142624, 451508, 3894999, }, + { 109586088, -19167366, 4055523, }, + { 144640544, -3027415, 1314797, }, + { 52999360, 7438884, 1590212, }, + { 190781904, 21658446, -6819871, }, + { -23318988, 8011725, 2361158, } + }, + { + { 289866272, 1352915, -431107, }, + { 315025120, -12282533, -3040837, }, + { 47494284, -6703907, -4832, }, + { -71863928, 13118978, 2914672, }, + { -20838644, 2469606, -643708, }, + { -190062496, -3092377, -1194538, }, + { -19047644, 33006286, -2068027, }, + { 179018528, 16397111, -1230508, }, + { -115382688, 5246840, 7004018, }, + { -67956048, -5418638, 2936684, }, + { 153785056, 24093692, 775242, }, + { 14096620, 36050344, 586800, }, + { 111691696, 18995566, -474594, }, + { 75546328, -217433, 713501, }, + { 214077280, -14137959, 1343251, }, + { -18821620, 4057670, 3177739, } + }, + { + { 291103744, 370978, -772557, }, + { 348790528, 12458090, 287226, }, + { 58636504, 3210488, 1225139, }, + { -92223152, -5486821, -352187, }, + { -35514012, 2880313, 1367410, }, + { -136765712, 22014392, -1087701, }, + { -74584256, -4656819, -6522445, }, + { 90864864, -23682450, -1395328, }, + { -146371408, -21838298, 2491081, }, + { -59137940, -3469260, 1843615, }, + { 91215976, -23076860, -5398774, }, + { -71293232, -19409494, -4901632, }, + { 54820964, -17020418, -3295851, }, + { 101421896, 2614561, -2597918, }, + { 191872288, -16305306, 3377455, }, + { -27441620, -11033234, -479963, } + }, + { + { 296270592, -2617246, -364535, }, + { 370586944, -2314987, 2156074, }, + { 51345796, 5406827, 1508070, }, + { -86875376, -7421704, -424128, }, + { -40845676, 1283122, 2312840, }, + { -65692060, -21493626, 2470143, }, + { -77312632, -19687594, -1716913, }, + { -13135084, 21265456, -473520, }, + { -178148272, 11236171, -3562139, }, + { -60837676, 4228396, -497679, }, + { 25942676, 4966593, -4297115, }, + { -111659488, -8442832, -2335389, }, + { 3730716, 5009006, -2279554, }, + { 125576792, -7951595, -2874944, }, + { 119798984, 29526826, -1306744, }, + { -37692632, 1173600, -2627983, } + }, + { + { 306039520, 2916283, 55298, }, + { 375466048, -7729868, -229244, }, + { 26038776, -9740449, 701153, }, + { -57603564, 12832289, 1970853, }, + { -44336948, -3262028, 929324, }, + { -3132105, 10383083, 3685619, }, + { -45856828, 19236622, 5332739, }, + { -108694344, -19291920, 162672, }, + { -189576096, 8080444, -2288681, }, + { -69859256, -2285460, -953483, }, + { -23221814, -1700270, 803159, }, + { -101647920, 16965658, 4098473, }, + { -21590264, 2845953, 823560, }, + { 137975280, 4347581, -857920, }, + { 19513648, -26326002, -4456566, }, + { -37789808, 6197638, -426276, } + }, + { + { 318587776, -3032784, 149250, }, + { 369527168, 3953518, -2932926, }, + { -4318590, 9765682, -648003, }, + { -16476031, -8249022, 2439005, }, + { -49333604, 2521146, -493384, }, + { 34719440, 4065724, 518080, }, + { -16206522, 1155883, 5816460, }, + { -177921168, 8576513, 460635, }, + { -173933296, -13509820, 2663417, }, + { -79901960, -100932, 41876, }, + { -54387708, 3276523, 2781528, }, + { -61901216, -9036611, 5770826, }, + { -17591112, -6221797, 2840047, }, + { 128530120, 4281009, 378494, }, + { -77983184, 12730820, -2652679, }, + { -24894168, -6537477, 1983738, } + }, + { + { 331023328, 1572495, -158377, }, + { 363240416, 2485176, -2062658, }, + { -23373748, -2558727, -1784559, }, + { 23740432, 7432978, 1649268, }, + { -54683524, 3455838, 938450, }, + { 49672908, -3960497, -3744675, }, + { -12600360, -14341433, -257161, }, + { -215045792, 570157, 2612951, }, + { -140426640, 7584912, 4264903, }, + { -85427440, 1476932, 1599875, }, + { -74498896, -4804995, 2248952, }, + { -18589156, -258235, 1464047, }, + { 6771553, 3172370, 1788317, }, + { 94353992, -13314935, -484258, }, + { -151179632, -4474282, 2142115, }, + { -3787088, 1398012, 1156957, } + }, + { + { 341009120, -1515587, -616328, }, + { 361957824, -4287451, 532039, }, + { -22019224, -7435126, -636192, }, + { 56237228, -2128156, 529892, }, + { -57777512, 2005750, 2416993, }, + { 54333484, -2007360, -4508105, }, + { -34668440, 11482595, -5185100, }, + { -226664752, -2289755, 4807142, }, + { -102528920, -1979980, 1407676, }, + { -83640728, 810138, 1657857, }, + { -90878288, 4764193, 1228898, }, + { 12435004, -1063541, -3004867, }, + { 39201240, -5504001, -520765, }, + { 43192340, 13027173, -1552094, }, + { -195225056, 2522220, 5649493, }, + { 19146428, -3657165, -924492, } + }, + { + { 347595456, 1677185, -417686, }, + { 364211072, -656056, 1167694, }, + { -4296578, 10086731, 2272038, }, + { 82555176, 3663607, -807991, }, + { -54913304, -3373160, 198105, }, + { 57903676, 8464307, -1361505, }, + { -68560024, -1516124, -4011500, }, + { -222998464, -2698850, 3826816, }, + { -67095444, 6439230, -712428, }, + { -72852312, 1525250, 280247, }, + { -105808128, -4806069, 281857, }, + { 26526792, 4527433, -2848637, }, + { 68737728, 4700305, -1606855, }, + { -10790032, -9171366, -679679, }, + { -214334432, -5647345, 5347771, }, + { 39519068, 7033009, -117575, } + }, + { + { 350730784, -349503, -70867, }, + { 366636672, 1081258, -66572, }, + { 17701708, -3133716, 3336653, }, + { 108880104, -4415764, -1509681, }, + { -41920492, -3178813, -2012729, }, + { 59764468, -2437394, 1982664, }, + { -104399920, 922881, 396211, }, + { -208644144, -919123, 1145146, }, + { -34493956, -6276558, -525060, }, + { -52565568, -5551245, -316217, }, + { -117002960, 1362042, -101469, }, + { 23087060, -638876, -347892, }, + { 86126976, -3460133, -1624035, }, + { -55188184, 6024766, 777926, }, + { -210987040, 2057289, 2257542, }, + { 54660976, -2545305, 1357747, } + }, + { + { 351696096, -266288, -39192, }, + { 367900992, 301721, -442382, }, + { 34761856, -4679367, 199179, }, + { 138656576, 8657580, -1464047, }, + { -20651814, 10691784, -737661, }, + { 54502600, -6995965, 925565, }, + { -141045120, -5858873, 3105798, }, + { -183038080, 5861020, -58519, }, + { -2747169, 6265284, -612570, }, + { -25756382, 8061654, 273804, }, + { -122231008, 829466, 453119, }, + { 3658775, -5697811, 901406, }, + { 84907208, -1595044, -946503, }, + { -83002392, -2358474, 1876364, }, + { -183580864, 6935299, 32212, }, + { 66104380, -1711008, 297427, } + }, + { + { 352811168, 619549, -377957, }, + { 368510880, -630286, 12885, }, + { 47033648, -1253594, -2666638, }, + { 169054752, -8256001, -413391, }, + { -831613, -6984154, 2095944, }, + { 41806676, 5986648, -1675037, }, + { -178983632, 11828877, 2625836, }, + { -146943712, -10399190, 165356, }, + { 29367376, -6104759, -1154273, }, + { 1778117, -6456410, 1106491, }, + { -122834992, -752693, 854699, }, + { -26137024, 9786620, 279173, }, + { 62861140, 6782827, -481036, }, + { -93098784, 931471, 2050847, }, + { -133093520, -16054051, 366146, }, + { 79614200, -497142, -1923072, } + }, + { + { 356286336, 1079111, -706522, }, + { 370377568, -118112, 59056, }, + { 58491548, 7219303, -1080721, }, + { 192554656, 5204964, 554588, }, + { 7168301, -2298344, 2442763, }, + { 26358214, -807991, -1415729, }, + { -213923200, -11788075, -175557, }, + { -105548824, 10618233, 1021665, }, + { 59586228, 7743289, -1002338, }, + { 24626268, 2447058, 846109, }, + { -122507496, 52076, 792421, }, + { -56819732, -8184060, -1071058, }, + { 23933706, -11563663, -741956, }, + { -88090856, 888521, 1012002, }, + { -67978592, 17484812, 1989107, }, + { 99579352, 7204271, -2246268, } + }, + { + { 362722880, -2591476, -450435, }, + { 375905728, -1128503, -363998, }, + { 69048576, -3528316, 1149441, }, + { 203336096, 1549946, 347892, }, + { 2265595, 6801618, 430034, }, + { 12047383, 350577, 466541, }, + { -237117088, 1186485, -1096290, }, + { -67009008, -7736847, 1520955, }, + { 82461224, -4238059, -362388, }, + { 41384696, -653372, -377420, }, + { -124182536, -389231, 1152662, }, + { -79066592, 1724966, -1180042, }, + { -22692460, 11189464, -1503239, }, + { -71790912, -5228586, 567473, }, + { -1692217, -11481521, 1993939, }, + { 123079264, -8227547, -708133, } + }, + { + { 370373824, 2542084, 98247, }, + { 386556192, 3310883, -375273, }, + { 76104136, -1887638, 447750, }, + { 202242496, -3654480, -919660, }, + { -5905580, -2692945, -868657, }, + { 347355, -2221035, 1225676, }, + { -243896160, 5133023, 1224603, }, + { -37273872, 2496987, 845035, }, + { 92828200, 244813, -382252, }, + { 54846732, 2807835, -863288, }, + { -127560528, -631360, 1960116, }, + { -89395984, 3245922, 675384, }, + { -66122096, -5112622, -521839, }, + { -49948860, 4191888, 396211, }, + { 54602992, 4352413, -951335, }, + { 140605952, 3172907, 141197, } + }, + { + { 376587552, -702764, 275415, }, + { 401500000, -3802657, -158377, }, + { 78745008, 1107565, -1109712, }, + { 196230608, 2150168, -1660542, }, + { -5272073, -1649804, -909459, }, + { -8028368, 2726767, 667331, }, + { -238401280, -2830920, 2775623, }, + { -16224239, -919660, -752693, }, + { 89822800, 3003256, -701690, }, + { 68125696, -3136937, -624381, }, + { -128559648, 3267933, 1184337, }, + { -91821032, -606664, 2059974, }, + { -99711960, 4389457, 1236414, }, + { -28915330, -4508642, -1611, }, + { 96751120, -6563247, -3388192, }, + { 143558752, 1979980, -37581, } + }, + { + { 379933888, -866510, -223875, }, + { 418189152, 3509525, -179315, }, + { 78002512, 1551557, -689342, }, + { 193020128, 2717641, -788663, }, + { 10403485, 8171712, -40802, }, + { -11798812, -491774, 142808, }, + { -228333888, -441308, 1696512, }, + { 1134408, 3786014, -1302986, }, + { 77307264, -3585761, -798327, }, + { 82289424, 4401805, -170725, }, + { -120315992, 1399623, -513785, }, + { -92718680, -3023120, 1060320, }, + { -122189136, -4933307, 1023276, }, + { -13180181, 3692598, 535797, }, + { 124550296, 8669928, -1908576, }, + { 130201936, -6466610, -628139, } + }, + { + { 381073120, 535260, -813359, }, + { 433806208, -2840047, -312996, }, + { 75059384, 233539, 439160, }, + { 196453952, -3342558, 932545, }, + { 38315940, -9525164, 1642825, }, + { -9557376, -1625108, 333397, }, + { -218855968, -242129, 93952, }, + { 18570902, -4182761, -1089848, }, + { 61713312, 3343632, -601295, }, + { 96362960, -3289945, 426812, }, + { -98379448, -8465381, -415001, }, + { -95044944, 1895691, -373662, }, + { -134432480, 727460, 594853, }, + { -4395362, 85362, 781684, }, + { 136693232, -743029, -285615, }, + { 106566728, 7488276, -1481227, } + }, + { + { 381620192, 1278290, -573915, }, + { 446254624, 1850594, -471373, }, + { 70897024, -4185983, -520228, }, + { 205557136, -587337, 381715, }, + { 69342248, 4027606, 1483374, }, + { -1697049, 411780, -237834, }, + { -210835120, 3384971, 437550, }, + { 35998804, 6389301, -175557, }, + { 48716740, -2058900, -534723, }, + { 108493024, 300648, -104690, }, + { -65671124, 11233487, 1360968, }, + { -97958544, 1491427, 138513, }, + { -139136000, 694174, 1178432, }, + { 346282, -1947231, -251792, }, + { 133537512, -3973382, -887985, }, + { 82236816, -4588099, -1869921, } + }, + { + { 382351936, -1075352, 183073, }, + { 454615840, -816581, -748398, }, + { 66729832, 1833414, -2317672, }, + { 218169312, -1402844, -1505386, }, + { 96211024, -1338419, -772020, }, + { 9361418, -2212982, -1392106, }, + { -202981232, -1261110, 1223529, }, + { 50014896, -2319819, 700617, }, + { 41347652, -806380, 40802, }, + { 118474528, -668404, -1267552, }, + { -30713312, -5957120, 1932198, }, + { -99469296, -617938, 1403381, }, + { -139440944, -980863, 1854889, }, + { 6510634, 270583, -1832340, }, + { 119157424, 5541045, -1895691, }, + { 63735704, -129923, -788127, } + }, + { + { 383144384, -444529, 292595, }, + { 459259776, 1583769, -524523, }, + { 62185756, 3074660, -1435593, }, + { 231434320, 4502200, -1624035, }, + { 117318104, 4323959, -1771674, }, + { 19376208, 4671851, -766652, }, + { -192852624, 653909, 485331, }, + { 57789860, -828929, 118112, }, + { 38961260, -403727, 383863, }, + { 127578784, 3790846, -962073, }, + { -832687, 1974611, 172872, }, + { -97513472, -1676111, 812823, }, + { -137204880, -2003065, 1231045, }, + { 17623324, 6783901, -1333587, }, + { 99434400, -2160369, -1452236, }, + { 50520088, -871342, 569620, } + }, + { + { 384296480, 776852, -302795, }, + { 460956832, -68719, -89121, }, + { 53318796, 558883, 696322, }, + { 240763520, -4166118, -34360, }, + { 133587440, -4829691, -685584, }, + { 22540526, -171262, 424665, }, + { -177651120, -3570192, -296353, }, + { 61066920, 1590749, -952409, }, + { 39507256, -175557, 85362, }, + { 136151008, -2514167, 131533, }, + { 22209812, -2669859, -1468342, }, + { -89513024, -2073932, -286152, }, + { -132348344, -680752, -26307, }, + { 31038654, -5706401, 867047, }, + { 79264160, 2407866, 130997, }, + { 37860672, 2688113, 896574, } + }, + { + { 386752128, 849867, -627065, }, + { 460907424, -860067, -301185, }, + { 36146980, -8155069, 146566, }, + { 241739008, -2721936, 404264, }, + { 145550544, 1211181, -214212, }, + { 15294379, -6343130, -619549, }, + { -156943472, 6531572, 106837, }, + { 64532956, 837519, -1495186, }, + { 41670848, 206695, -30602, }, + { 143601152, -547071, -244276, }, + { 40169756, 4733591, -1357210, }, + { -74599288, 5961415, 316754, }, + { -124122408, 5115306, 801011, }, + { 40080636, -530965, 1106491, }, + { 61127048, -4632122, 347892, }, + { 22113176, -5246840, 465467, } + }, + { + { 391063200, -2029909, -237297, }, + { 461126464, 344134, -667331, }, + { 11589969, 8358007, -1996086, }, + { 233550128, 6007586, -1385127, }, + { 153602528, 243739, -1096290, }, + { -543313, 5778342, -2461016, }, + { -133317392, -5993627, 959925, }, + { 72045928, -3372086, -1061931, }, + { 44400300, 733903, -638876, }, + { 149664576, 162135, -1471563, }, + { 55261732, -5041755, 13422, }, + { -55586004, -4656282, 1148367, }, + { -113788176, -3487514, 2371896, }, + { 41438380, 2802466, -167504, }, + { 46727632, 3631932, -506269, }, + { 2968896, 5842230, -533113, } + }, + { + { 396734720, 1250372, 73014, }, + { 462726880, -500364, -1276142, }, + { -15785079, -1756105, -1324997, }, + { 219574304, -1741072, -1924145, }, + { 157631744, 1241782, -1465658, }, + { -20402168, -221191, -1504849, }, + { -110699560, 1782411, 261993, }, + { 83441016, 3263102, -599148, }, + { 47146928, 1730335, -814970, }, + { 153455424, 3345243, -1052267, }, + { 68853160, 576599, 130460, }, + { -36815924, 1578401, 375810, }, + { -102973992, -1618129, 1462436, }, + { 36476084, -3029563, -1205275, }, + { 36621576, -526134, -565325, }, + { -16523813, -1292248, -19327, } + }, + { + { 402814240, 31139, -442919, }, + { 465080000, -938987, -1842541, }, + { -41941968, -2105071, 3216394, }, + { 203479440, -2962454, 1204202, }, + { 157027232, -5337034, 1045288, }, + { -40497784, -2864743, 2887292, }, + { -91681984, -1256815, -1701344, }, + { 95501816, -3160022, -364535, }, + { 49006112, -3105798, 643171, }, + { 153419984, -6674916, 2768107, }, + { 82031728, 2663954, -2726767, }, + { -21534966, -1419487, -1041530, }, + { -92152280, 4112968, -2525978, }, + { 28469190, -468688, -843424, }, + { 29191282, -1108102, 650151, }, + { -33352032, 449361, 2191507, } + }, + { + { 408395008, 100395, -1385127, }, + { 466746432, 2885144, -1062468, }, + { -63879048, -1842541, 7820599, }, + { 187858656, 2120103, 6287832, }, + { 152399936, 4620848, 6424198, }, + { -57353384, -2039036, 6954089, }, + { -77235864, 4152697, -2153926, }, + { 105173008, 2572686, 300648, }, + { 49308908, 1588601, 2649995, }, + { 149810064, 3342022, 8390219, }, + { 95026152, -714038, -6820408, }, + { -11529840, 3498251, -875100, }, + { -82806432, 520228, -6441377, }, + { 19945828, 4118337, 2282238, }, + { 22079354, 539555, 2406256, }, + { -46061912, -2879239, 3273302, } + }, +}; + const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -958,6 +1862,910 @@ const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_ } }; +const Word32 leftHRIRImag_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { -102715752, 295527040, -88424248, }, + { -96281896, 56815440, 11869679, }, + { -8760123, 37118180, -14165876, }, + { -16805134, 23917600, -6433324, }, + { -6374269, -26807576, 12249784, }, + { 1127429, -13645648, 4787278, }, + { 4656282, 38743288, -16459388, }, + { 5360119, -24749212, 7655779, }, + { -9627169, 107434848, -38639672, }, + { -5340792, -41006200, 19219442, }, + { 268435, 7092602, -3980898, }, + { -2935073, -9185324, 4246112, }, + { -741419, -13098040, 6208912, }, + { 931471, -9216463, 4911295, }, + { -3754875, -8075076, 3953518, }, + { -147103, 2249489, -787590, } + }, + { + { -177186736, 179125376, -115792320, }, + { -239960896, -299077888, -104825120, }, + { -9208410, 46498388, -8622147, }, + { -28982440, 16567299, -3951907, }, + { -16998944, -27056684, 16417512, }, + { 7049115, 40280352, 29566554, }, + { 19155554, 43337292, -20049982, }, + { 6044093, -23644868, 7273527, }, + { 2528662, 81792824, -53621592, }, + { -29154238, -116467704, -7671349, }, + { 7763691, 48617956, 14192719, }, + { -10481331, -30494268, -1056025, }, + { -6800544, -35405564, -2618320, }, + { -5965173, -47450800, -11907260, }, + { -10130217, -13799730, 3756486, }, + { 438624, 4456029, 349503, } + }, + { + { -51999168, -317713760, 45510012, }, + { -132898096, -545737344, -39643620, }, + { -308164, 25183540, -2346663, }, + { -10490458, 16738024, -7422241, }, + { -20291572, 66797480, -22439594, }, + { -3951370, 103472744, 4090420, }, + { 38857104, -86104968, 33058364, }, + { -1992328, 11780558, -2269353, }, + { 60647084, -194886288, 50082004, }, + { -30465276, -48754860, -39180840, }, + { 3276523, 72164576, 4759898, }, + { -2859375, -54574540, 8997420, }, + { -1475858, -48667348, 3673808, }, + { -47782, -96552472, 8617315, }, + { 973884, -46942380, 19906100, }, + { 2827699, -5764920, 3810710, } + }, + { + { 34120832, -220877824, 40671192, }, + { 49936512, -199888848, 41771240, }, + { 3815542, 29523606, -4461934, }, + { 18192408, 43142408, -7209103, }, + { 7750269, 111525808, -8528194, }, + { -7198365, 69175280, -11199127, }, + { 13021804, -200965808, -12485470, }, + { -1145683, 12852153, 373662, }, + { 31666258, -357677888, -27057220, }, + { -7707856, -32124208, -42369316, }, + { -4867272, 29853244, -13622026, }, + { -4420595, -104069208, -21484500, }, + { 5786395, -47440600, 2157147, }, + { 3860102, -75734768, 17977660, }, + { 8563091, -98140536, -7536057, }, + { -2442226, -55461448, -19271518, } + }, + { + { 10460393, -181682480, 44848048, }, + { 108469400, -340663936, 99499360, }, + { 4267587, -36406292, 25516938, }, + { 26082262, -82588464, 40497784, }, + { 29406030, -4441533, 31512176, }, + { 13383655, -11658152, 22476638, }, + { -14169097, -91462400, -56171728, }, + { 7954280, -922881, 2018635, }, + { -27049704, -254546064, -60070488, }, + { 27341762, -175464448, 20010252, }, + { -3204046, 10685342, -5061619, }, + { -1270237, -125430760, -10515154, }, + { 7642358, -40255656, -4295504, }, + { -2068027, 463856, -14248554, }, + { 13204877, -75227960, -24315958, }, + { 3937948, -75275744, -8985608, } + }, + { + { -109123848, -363628576, 19850266, }, + { -9291625, -471410240, 91331408, }, + { -23200876, -97610112, 6461242, }, + { -36034776, -107364520, 42067596, }, + { -1789928, -2889439, 32729262, }, + { 20062330, -51043540, 1501628, }, + { -3835943, 12977244, -8718247, }, + { 13856101, 18894098, 5616744, }, + { -66184372, -170432352, 3189550, }, + { 38536596, -82056424, 61956512, }, + { -4857071, 3991635, -8170639, }, + { 4960687, -70343512, 20109574, }, + { 5545877, -7403987, 10499048, }, + { 9702868, 27723478, -3980898, }, + { 12382928, 13322989, 15064598, }, + { 12425877, -38941932, 6793028, } + }, + { + { -195198208, -105714176, -71322760, }, + { -215174640, 32808718, -78798688, }, + { -47779364, -19037980, -21328808, }, + { -133198744, 112761144, -23626616, }, + { -73338176, 144662544, -7880191, }, + { 21403432, -30356828, -10085120, }, + { 6622303, -32783486, 7916699, }, + { 880468, 11415486, 10504953, }, + { -88258896, -64644088, -35305168, }, + { 2688650, 66810364, 1264331, }, + { -3269007, -19416474, 1700807, }, + { 4816806, -14665166, -4730370, }, + { -14203457, 39763880, -4204236, }, + { 19469086, -13660680, 9423158, }, + { -25116432, 59262496, 6179921, }, + { 8930311, -33924872, 1862942, } + }, + { + { -75185016, 178007072, 17114908, }, + { -224526400, 173874768, -14468671, }, + { -35714800, 41899016, 1722819, }, + { -147797872, 57060788, -37157908, }, + { -110517560, 32109712, -40170292, }, + { 13028246, 9739375, 8776229, }, + { 11642583, -30146376, 6591701, }, + { -34980900, -38170448, -902480, }, + { -13600014, 85681376, 7280507, }, + { -15824270, 18907520, -12783433, }, + { -6081674, -16430934, 4125853, }, + { 29388314, 10895795, 162135, }, + { -25477210, 14954002, -10593000, }, + { 11839614, -21398600, 6806987, }, + { -62463320, -21545704, -17193828, }, + { -3930432, -23349052, 8411693, } + }, + { + { 124779536, -22646826, 48507360, }, + { -77259480, -69186552, 43811888, }, + { -10337449, -4553202, 13614509, }, + { -42608224, -104795592, 4864051, }, + { -49625664, -88771072, -3922379, }, + { -20056424, 35947804, 5018133, }, + { 1079111, -107911, -3783866, }, + { -63607928, -75699, -8749922, }, + { 70587248, -13620952, 24923158, }, + { -7115687, -30103962, 4275640, }, + { -10963441, 7543573, -4325569, }, + { 55031952, -24158654, 6695854, }, + { -15417322, -20169704, 1402307, }, + { -11427834, 19712826, -4295504, }, + { -59354836, -50075560, -6753836, }, + { -32708324, 12753905, -102005, } + }, + { + { 286679936, -42412804, 9840844, }, + { 116902568, -6942278, 25850872, }, + { 13852343, -19517406, 3364570, }, + { 110133696, 32694902, 25050396, }, + { 60822104, 43612172, 22499724, }, + { -56594248, -16292958, -8150238, }, + { -18313740, -4286378, -1090922, }, + { -58529128, 17256104, -2695629, }, + { 99918120, -48497696, 5523865, }, + { 9865540, -2490007, 9789841, }, + { -6185290, 13204877, -2734284, }, + { 57276072, -23256712, 6016713, }, + { 1996623, 1510218, 5279052, }, + { -33033130, 7542500, -4423280, }, + { -24627342, 22221624, 13475460, }, + { -56947508, -13872207, -4949413, } + }, + { + { 369951296, 11637214, -19057844, }, + { 275144736, 7006166, -4369593, }, + { 43432856, -7104413, -4556961, }, + { 223252400, 22448720, 7514046, }, + { 149661888, 27103392, 11121818, }, + { -66699232, -26035018, -1901060, }, + { -45021996, 6493454, -987306, }, + { -21727166, -23222888, 5068062, }, + { 68480032, 28010702, -14796162, }, + { 20506858, 13718662, 1280974, }, + { 7138236, -9458592, 3651796, }, + { 26306674, 18474264, -4527970, }, + { 12858595, 8259759, 213138, }, + { -42810624, -7886097, 3251290, }, + { 8556112, 19741280, 7248294, }, + { -62429496, -17578228, -3010772, } + }, + { + { 393655232, 18198314, -15280957, }, + { 366834752, 10258529, -13111461, }, + { 89055072, 13213467, -2873870, }, + { 262732272, -14457397, -9764071, }, + { 184219200, -16023449, -8928700, }, + { -46308336, 9028021, 7953743, }, + { -69313792, 40265, 445603, }, + { 25310780, -430034, 4767951, }, + { 12801150, 2143189, -12394202, }, + { 22710176, -4475356, -5142687, }, + { 21137144, -7526394, 1753420, }, + { -20363514, -2947958, -3504693, }, + { 10953777, -259309, -2443300, }, + { -43550432, -8719320, 2104534, }, + { 27887760, -11151346, -7304129, }, + { -48897128, 11552388, 5156108, } + }, + { + { 393587584, -16003585, -1691143, }, + { 407478592, -13923747, -8107825, }, + { 150810256, -17078400, -2028298, }, + { 246486560, 4512400, -10222022, }, + { 178807536, -2159295, -9586367, }, + { -6522445, 5173288, 2015413, }, + { -84209816, 1737314, 2623688, }, + { 61722976, 1511292, -2246268, }, + { -34659848, -12631499, 715649, }, + { 21009906, -8139500, -2964601, }, + { 33974264, -1009854, -2833605, }, + { -64991980, 3661997, 1915555, }, + { -3665755, 1257889, -104153, }, + { -37127844, -5294084, -829466, }, + { 37775312, -15984795, -6041409, }, + { -32945620, 7146826, 3170223, } + }, + { + { 389030080, -645856, 3390877, }, + { 422571104, 10395968, -1673427, }, + { 215616480, 13672492, -2324651, }, + { 210861424, 412854, -4902705, }, + { 159334160, 3248606, -3352222, }, + { 43313136, 6364605, -6125160, }, + { -83583288, -2106145, 1627793, }, + { 81618872, 6060736, -3098819, }, + { -65605088, -4659503, 7262790, }, + { 17300128, 3033321, 1637993, }, + { 46225124, 6788733, -1626182, }, + { -92247304, -4304631, 3346317, }, + { -26742076, -5826660, 1142461, }, + { -24902758, 7871065, 2764348, }, + { 40583684, 10146860, 3660923, }, + { -22914724, -646393, -1450088, } + }, + { + { 381346400, 8778376, 318901, }, + { 423162720, 911607, 1009317, }, + { 256772480, -5362267, -3470871, }, + { 181759264, -3532611, 468688, }, + { 143814832, -2244657, 301185, }, + { 86775520, -16913582, -5376762, }, + { -60142428, -4284767, -837519, }, + { 86478096, -3433290, 421444, }, + { -85866056, 12759811, 3310883, }, + { 9114457, 6254010, 1319629, }, + { 54241680, -2934537, 525597, }, + { -90273232, -1603633, 2403571, }, + { -48776332, 4350265, 1156957, }, + { -10286447, 5401458, 1887638, }, + { 36567888, 9317932, 4653060, }, + { -18476412, -3271691, -350577, } + }, + { + { 368989216, -5534602, -2714419, }, + { 410308960, -8353175, -446677, }, + { 249583776, -1581622, -1770063, }, + { 160193696, -6912750, 1336272, }, + { 132391296, -3189013, 680215, }, + { 98816464, 7694434, 409633, }, + { -12958453, 11945378, -2587181, }, + { 82759184, -5604933, 719407, }, + { -97562864, -6251325, -1469953, }, + { -4041564, -5899138, -1145146, }, + { 55416352, -1132261, 874026, }, + { -55714316, 4063039, -931471, }, + { -58292368, 212064, 1797981, }, + { 9628780, -887448, -3663070, }, + { 33955476, -9705552, -1395328, }, + { -17141752, -2013803, 310848, } + }, + { + { 354289152, 1707786, -2571075, }, + { 388501792, 8374113, -2523830, }, + { 184855392, 18489298, 1823214, }, + { 135551856, 5879274, -466541, }, + { 114764744, 6063420, -659814, }, + { 60275572, 12415677, 4552129, }, + { 46445776, -17685602, -2125472, }, + { 81105088, 2907693, -1739999, }, + { -98579160, -4654134, -1602560, }, + { -20057498, 1689533, -1277216, }, + { 51474648, 2972117, 359704, }, + { 5354214, -17738752, -3388729, }, + { -46520940, -505196, 658741, }, + { 37961068, -15249281, -3142842, }, + { 44451836, -3827890, -4762045, }, + { -13396540, -1116692, -637803, } + }, + { + { 340785792, -648540, -1286880, }, + { 367042528, -4130148, -3242164, }, + { 77211704, -35029752, 872952, }, + { 100708928, -5694590, 889595, }, + { 83269752, -6628745, -448824, }, + { -25592100, -34553012, 2397129, }, + { 94690608, 10888816, -446677, }, + { 89442160, 3150359, -2889976, }, + { -88895624, 9186398, 1739999, }, + { -36222680, 879931, 1087701, }, + { 48532592, -2396592, -495532, }, + { 74482784, 21537114, -996969, }, + { -9998684, 8573292, -2022393, }, + { 66636956, 12024298, 1883880, }, + { 71037688, 16143708, -2165201, }, + { -2926483, 5681705, 247497, } + }, + { + { 329444928, 1310502, -534723, }, + { 353794720, -2165201, -1990717, }, + { -35852776, 28246390, -2888366, }, + { 55373404, 13240310, 1661079, }, + { 37164352, 11212549, 545461, }, + { -127722128, 30776126, -3580392, }, + { 106435192, 4369593, -664646, }, + { 105386152, -7526394, -2194192, }, + { -73596952, -3322694, 3643743, }, + { -49728204, 2808372, 2727841, }, + { 53045532, 820339, -2132988, }, + { 122394760, -6372121, 637803, }, + { 44829796, -17051558, -1961190, }, + { 82841328, 1896228, 2768643, }, + { 103471664, -14290430, 3080565, }, + { 13754096, -4429722, 1447941, } + }, + { + { 318065408, -2289755, -362388, }, + { 349757984, 4101157, 578210, }, + { -113754360, -4496294, -1942399, }, + { 8507793, -14286135, -691490, }, + { -16632261, -13100724, 366146, }, + { -202864720, -2484639, -2860448, }, + { 68579888, -16773458, -2518998, }, + { 115998480, 4524748, -450972, }, + { -57802208, -2226941, 1721745, }, + { -55953760, -4285304, 1493038, }, + { 64990908, 3839164, -3566434, }, + { 125006096, -11333882, -2152852, }, + { 97701920, 11058467, -1133871, }, + { 83138216, -8892193, -703838, }, + { 125751272, -3743064, 3295314, }, + { 33724084, -200790, -140123, } + }, + { + { 303769600, 3554622, -392453, }, + { 350124128, 987306, 1495722, }, + { -137944144, -8970576, 2792266, }, + { -26552024, 2578054, -1378685, }, + { -65428460, 7725573, 780073, }, + { -224844752, -13725105, 4529043, }, + { -12483322, 17953500, -1854889, }, + { 103481872, 7759932, -520228, }, + { -43051680, 3295314, -2524367, }, + { -48843440, -154619, -881542, }, + { 73293616, -6476274, -2489471, }, + { 76880992, 14780593, -3942780, }, + { 123941480, -2439542, -1432372, }, + { 75282184, 4989142, -3872987, }, + { 130074160, 13528610, -3344169, }, + { 54148264, -2907693, -2643552, } + }, + { + { 285796256, -3981972, -291521, }, + { 350552544, -5566278, -934155, }, + { -118486872, 7196218, 3931506, }, + { -41846404, 7055021, 2590939, }, + { -97731440, -5333276, 1343788, }, + { -194669936, 10606959, 7839926, }, + { -113775832, -16637630, 2842195, }, + { 56706992, -15079093, -1974611, }, + { -29278256, 8361765, -3295851, }, + { -26415122, 8336532, -1655173, }, + { 59804736, 1544578, 1472637, }, + { -8213588, -12548284, 590021, }, + { 108378128, -5355288, -51540, }, + { 70177080, 6913287, -2084133, }, + { 118951264, -5292474, -8668318, }, + { 71132176, 9405978, -1124745, } + }, + { + { 266198848, 4580583, -198105, }, + { 350230976, 1767379, -3656628, }, + { -80328776, -6408091, 1429150, }, + { -38255272, -1089848, 5014911, }, + { -107569064, 468151, 574989, }, + { -127891240, -5308043, 2437931, }, + { -204628880, 22431004, 4451197, }, + { -21296058, 14463839, 33823, }, + { -19694036, -12688944, 2639258, }, + { 4931696, -13265006, 676457, }, + { 12508555, 14493367, 4561256, }, + { -104526616, 20976620, 5231270, }, + { 52614960, 17870822, 1361505, }, + { 70737040, -3554622, 1427003, }, + { 93311384, -9984188, -3721589, }, + { 78050296, -3340948, 2378338, } + }, + { + { 248731760, -3841312, -413391, }, + { 347933152, 4990215, -2474975, }, + { -48056924, 5582384, 192737, }, + { -17847736, -1597191, 1737314, }, + { -95645160, 7235410, 721018, }, + { -41769632, 15646566, -4005057, }, + { -254933696, -15661061, -967978, }, + { -116530512, -22162568, 2592013, }, + { -19997904, -4423280, 6172405, }, + { 32169842, 5239323, 2809446, }, + { -61610232, -30427696, 1196685, }, + { -179832432, -24736864, 1607928, }, + { -22802518, -23575612, -494995, }, + { 71613208, -3980898, 626528, }, + { 43881144, -3936338, 5649493, }, + { 71671728, -8278550, 1923609, } + }, + { + { 236869056, 1332514, -442382, }, + { 337984384, -1898912, 1230508, }, + { -36775656, -474057, 851477, }, + { 20679730, -7783555, -1839320, }, + { -70426728, -8507793, 2003602, }, + { 44932336, -25403120, -3211025, }, + { -247928592, -11966853, -4479651, }, + { -206551424, 20236276, 1881733, }, + { -25847114, 15595563, 737661, }, + { 45509472, 4691715, 1045288, }, + { -135022496, 19324132, -4323422, }, + { -203965856, 22549, -3609920, }, + { -85994912, 11100880, -2160906, }, + { 66792648, 5742908, -2680060, }, + { -36132488, 30173756, 5865852, }, + { 59363428, 8577050, -1539209, } + }, + { + { 231336064, 232465, -187905, }, + { 314608512, -9227200, 2216740, }, + { -47083580, -6296422, 1185411, }, + { 75150656, 17259326, -1380832, }, + { -43449500, 4299263, 2225330, }, + { 109668768, 16653736, 1604170, }, + { -196255840, 30693446, 824097, }, + { -266336288, -7691213, 1482838, }, + { -19513648, -40802, -5159330, }, + { 46906948, -3625489, -1585380, }, + { -178553600, 5398237, -2368675, }, + { -168658528, 26050588, -896038, }, + { -113106352, 3360275, -834297, }, + { 52196200, 1465658, -2229625, }, + { -130574520, -31559420, -607201, }, + { 54207856, 810138, -3128347, } + }, + { + { 229698608, -639413, 103079, }, + { 280268096, 14671608, -709743, }, + { -66435628, 8568460, -228170, }, + { 134516768, -15690052, 752156, }, + { -22232362, 897111, 233539, }, + { 135112160, 6288369, 1469416, }, + { -139269680, -16405701, 7248294, }, + { -280978368, -4770635, 2736431, }, + { 12651363, -20282446, -2835215, }, + { 45940044, -1393180, -1640141, }, + { -184659968, -12319577, 4322885, }, + { -97737352, -26691612, 5443334, }, + { -101278552, -13482439, 2464238, }, + { 23606750, 4308389, 1158567, }, + { -205791216, 10285910, -2576981, }, + { 63715304, -10809896, -556198, } + }, + { + { 228049344, -766115, 147103, }, + { 246180544, -7079180, -2858301, }, + { -76775224, -832687, -1352915, }, + { 183658704, 7169911, 1001801, }, + { -6696391, 2782602, -1196148, }, + { 122947200, -12901545, -2642479, }, + { -114430280, -11481521, 4749160, }, + { -251979824, 10114111, 2804614, }, + { 64481956, 19887846, 2881386, }, + { 50970524, 4954782, 78383, }, + { -167591776, 1422708, 5360656, }, + { -30406220, 4449586, 4957466, }, + { -66963908, 7187628, 3494493, }, + { -20111722, -12416214, 1946157, }, + { -235634256, 7168301, 1110786, }, + { 83446384, 6468221, 2186138, } + }, + { + { 223257776, 2434173, -358630, }, + { 222571648, -1423782, -1270774, }, + { -66901096, -5757941, -1224603, }, + { 213205392, -363462, -601295, }, + { 7517804, -5701032, 143345, }, + { 91403880, 10115722, -4810364, }, + { -129454608, 18477486, -2522220, }, + { -192888048, -18012020, 2818572, }, + { 116327040, -5597953, 3251827, }, + { 64936684, -4624069, 1325534, }, + { -144151984, -967441, 1925756, }, + { 7003481, 5485210, -1249299, }, + { -32142998, -2110440, 637803, }, + { -70955008, 14260902, 665720, }, + { -216462592, -14950781, 4974646, }, + { 102517112, 1085016, 637266, } + }, + { + { 214601264, -2141578, -664646, }, + { 210639152, 2856690, 1705639, }, + { -39098696, 12422119, 195421, }, + { 224401296, -1705102, -2122251, }, + { 23874650, 3256122, 1199370, }, + { 59892244, -667331, -3594888, }, + { -164760848, -9598715, -5667210, }, + { -122378112, 14896557, 3575560, }, + { 153078544, -1903207, -1206886, }, + { 86211264, 2884071, 637803, }, + { -122694328, 2251637, 253940, }, + { 11296301, -5420249, -4977867, }, + { -11534135, 192200, -1800665, }, + { -114549464, -8192650, -90194, }, + { -162886096, 13973139, 6212134, }, + { 113876224, -239981, -1750736, } + }, + { + { 203155712, 2066953, -350577, }, + { 204104896, 4072703, 1747515, }, + { -6510634, -9341554, 2334315, }, + { 225802000, 472983, -2469606, }, + { 44047572, -288837, -622770, }, + { 37247568, -4226785, 686658, }, + { -195934800, -5150203, -1933272, }, + { -55822764, -6788196, 1361505, }, + { 173047984, -2663954, -3274913, }, + { 111873696, -4126927, -835371, }, + { -104021424, -2258079, -476205, }, + { -6830072, -1428077, -2796024, }, + { -11289322, 1420024, -2125472, }, + { -137739072, 110595, 669478, }, + { -94089312, -7212324, 3067144, }, + { 116191752, -2365453, -1021665, } + }, + { + { 190689024, -2371359, 25233, }, + { 197546480, -3785477, -316217, }, + { 16255377, -399969, 1974074, }, + { 225470752, 848256, -2200097, }, + { 67733784, 5657546, -2481417, }, + { 19403588, -2711198, 3480534, }, + { -212375392, 4522601, 3687230, }, + { 2371896, 7086696, -2202245, }, + { 181697520, 2357400, -2130841, }, + { 138478336, 6050535, -1375463, }, + { -84387520, 5470715, -548682, }, + { -35806068, -4025995, 1049583, }, + { -31158914, -4240207, -985695, }, + { -135325296, 6150930, 2264522, }, + { -20935818, 10323491, -1573032, }, + { 111204760, -1440425, 493921, } + }, + { + { 179225232, 2760053, -17717, }, + { 190236448, 1275605, -811749, }, + { 24045912, 6411850, -1258962, }, + { 225514768, -2793339, -1294396, }, + { 90458992, -10246718, -591095, }, + { -167504, 10723460, 1471026, }, + { -217126704, 2069101, 4703526, }, + { 54550916, -13069585, -2480881, }, + { 184158000, -1075352, -1227824, }, + { 161489696, -6567005, -497142, }, + { -61848064, -6723235, 358093, }, + { -67046588, 7152195, 1881733, }, + { -66924716, 8096014, 238371, }, + { -111702976, -5281736, 2227478, }, + { 53031036, -16231755, -3055332, }, + { 102903120, 5515812, -529355, } + }, + { + { 170537584, -1824824, -342524, }, + { 183614688, -394063, -205622, }, + { 22137336, -1753420, -3557307, }, + { 221629984, 302795, -28454, }, + { 103760504, 3090229, 2041720, }, + { -20645370, -6936909, -1555852, }, + { -213660128, -3447248, 2346663, }, + { 100076496, 9751723, -1311576, }, + { 182113600, -1058710, -1208496, }, + { 176058768, 1651952, 193810, }, + { -38847980, 4515621, 702227, }, + { -92197376, -7477001, 769873, }, + { -110912696, -10102300, 789737, }, + { -75545256, 8342974, 1235877, }, + { 122212760, 16909824, -2013266, }, + { 96241088, -2203855, -2356327, } + }, + { + { 165191424, 577673, -507343, }, + { 179486688, 921807, -26307, }, + { 18013092, -6145562, -1138703, }, + { 208220544, 3984119, 584116, }, + { 103398656, 5571110, 1526324, }, + { -36229660, -1289564, -903017, }, + { -200551888, 775242, -777926, }, + { 134781984, -8606041, -266288, }, + { 173686336, 821413, -890132, }, + { 180358560, 1727651, -304406, }, + { -18604724, -3582003, 486405, }, + { -104140072, 1828582, -615254, }, + { -152703264, 9380209, 613107, }, + { -36066452, -5236639, -74088, }, + { 176816832, -12213276, -252866, }, + { 92410520, -2876554, -1875290, } + }, + { + { 161907920, 635655, -172872, }, + { 178636272, -357556, -479963, }, + { 12662100, -326954, 1681480, }, + { 184686816, -8484171, 18254, }, + { 95561952, -7052873, -1110786, }, + { -44053480, 1843078, 1413581, }, + { -174144816, 10176388, -1409823, }, + { 154284352, 120796, -38118, }, + { 156079104, -4118874, -20401, }, + { 177165248, -3488587, -1398549, }, + { -1976759, 2449742, 335007, }, + { -99716792, 5302137, -265214, }, + { -181908512, -4544613, 263067, }, + { -349503, 7743826, -988916, }, + { 206934208, -265214, -577136, }, + { 85982024, 1734093, 284542, } + }, + { + { 158032784, 541166, 315143, }, + { 180236160, -1362042, -498753, }, + { 3595425, 5788006, 567473, }, + { 157179168, 7753490, -1189706, }, + { 92995704, -1237488, -2185602, }, + { -45439144, 1014686, 1642288, }, + { -136143488, -13908178, 1192390, }, + { 158649648, 1945620, -955630, }, + { 128903776, 7742753, -26844, }, + { 171800832, -121333, -1593433, }, + { 13741211, -3517578, 564788, }, + { -83028696, -7720741, 1414655, }, + { -192142336, -2512556, 985695, }, + { 26982596, -4926865, -543850, }, + { 209874112, 5954436, -2946348, }, + { 68932080, 5796595, 1089848, } + }, + { + { 151386864, -2404645, 253940, }, + { 181588528, 503585, -170188, }, + { -8827768, -4410932, -1240172, }, + { 134659040, -2888903, -1367410, }, + { 104213624, 6438693, -1145146, }, + { -42312944, -794569, 366683, }, + { -95989296, 7403987, 2324114, }, + { 153781312, -4433480, -2048163, }, + { 96725344, -7683697, -385473, }, + { 167803840, 656056, -716723, }, + { 32862406, 1418413, -206695, }, + { -63042604, 3702799, 2165201, }, + { -183988880, 5443334, 2400350, }, + { 42643656, 1428077, -680752, }, + { 191339712, -6039798, -4101694, }, + { 38693360, -9665287, 308701, } + }, + { + { 142047456, 3342022, -296890, }, + { 179505472, 1129576, -209380, }, + { -22232362, 354335, -740345, }, + { 122268056, -1197759, -267899, }, + { 127089696, -8201777, -76773, }, + { -35804996, -1121523, -504659, }, + { -62621160, -1944010, 459562, }, + { 147204096, -1213328, -2026688, }, + { 66827544, 5657546, -360777, }, + { 164881648, -201327, -209917, }, + { 58692340, -5550709, -1727651, }, + { -47042776, 1225139, 587874, }, + { -163863744, -2279554, 1731946, }, + { 47356848, -1014686, -275952, }, + { 159833984, 1132261, -1580011, }, + { 1237488, 9800042, -374736, } + }, + { + { 131995080, -2185602, -686121, }, + { 172193296, -2389613, -385473, }, + { -34882112, -1754494, 548682, }, + { 118775712, 1829656, 1057099, }, + { 151923200, 6539625, 869194, }, + { -26918170, 2971044, -383326, }, + { -38384660, 2454037, -1380295, }, + { 142515600, 503048, -854162, }, + { 45397804, -2553895, 5906, }, + { 161184224, -705985, 71941, }, + { 90267864, 9992241, -1291711, }, + { -35852776, 878858, -1010391, }, + { -138178768, 5908265, 526134, }, + { 44611288, -2708514, -45634, }, + { 120780920, -8893267, 904628, }, + { -33002528, -6796786, -682900, } + }, + { + { 123259656, 386547, -297427, }, + { 159658960, 3253975, -445603, }, + { -46336256, 4461934, -53687, }, + { 118589952, 2868501, 408022, }, + { 167935376, 1099512, 287226, }, + { -18038862, -1049046, -440771, }, + { -20253992, -5125507, -966368, }, + { 137852352, -726923, -92342, }, + { 34689912, 804770, 202937, }, + { 155091264, 3265249, -384400, }, + { 120252640, -8320963, 351114, }, + { -26051124, -3993783, -417149, }, + { -111731424, -5927055, 835908, }, + { 39908300, 2525441, -925029, }, + { 78502336, 11174968, 89121, }, + { -55575268, 1717987, -388695, } + }, + { + { 116317912, -416075, 415538, }, + { 143268832, -3914863, -501437, }, + { -56534656, -2570538, -1308354, }, + { 116717344, -2132988, -1386738, }, + { 170748576, -4256850, -1899986, }, + { -12721693, 376883, -1067836, }, + { -4331475, 3602941, 61203, }, + { 130119792, -2341294, 446677, }, + { 32933272, 1725503, 509491, }, + { 146960896, -2652679, -1264868, }, + { 139780240, 676994, 488016, }, + { -14691473, 3594888, 795643, }, + { -87946968, 4322885, 1036698, }, + { 38193532, -301721, -1729261, }, + { 39508868, -8189966, -799401, }, + { -65048352, 2486249, 899259, } + }, + { + { 110479440, 2017024, 375810, }, + { 125087704, 3195993, -301185, }, + { -66401268, -1813013, -260382, }, + { 110462800, -526670, -1109712, }, + { 163715024, 1055488, -2429341, }, + { -14014478, -1299228, -401579, }, + { 11800960, -1622424, -513785, }, + { 118221120, 5338645, -335007, }, + { 35818416, -648540, 755914, }, + { 138514304, -256087, -814970, }, + { 145208544, 4230006, -1448478, }, + { -764504, -854162, 260382, }, + { -67583992, -1777043, 284005, }, + { 40011380, -4359929, -912144, }, + { 9163850, 2971581, -146029, }, + { -67017060, -1034013, 2039036, } + }, + { + { 105450576, -1956358, -323733, }, + { 106948440, -3267396, 158377, }, + { -78411072, -905701, 2007897, }, + { 97738424, -1114544, 679679, }, + { 151885616, 370441, -593242, }, + { -23703924, -2260227, 975494, }, + { 29065118, 3977677, -1253594, }, + { 105585328, -3322694, -1251446, }, + { 39151312, -676457, 128312, }, + { 130260456, -290447, 506269, }, + { 140068016, -2144263, -2621541, }, + { 15606837, 2944737, -1053341, }, + { -49851148, 2172180, -1049046, }, + { 40941240, 2907156, 1347546, }, + { -10340671, -733366, 1454383, }, + { -68507952, -2381023, 1583232, } + }, + { + { 101561480, 300648, -568546, }, + { 89951112, 4433480, -75699, }, + { -93799400, 7416872, 1560684, }, + { 78182904, 6487011, 1120450, }, + { 137742816, 3635690, 416612, }, + { -40410812, 7388955, 376347, }, + { 45799920, -4907000, -733366, }, + { 96689912, 514859, -1169305, }, + { 41371808, -478352, -199716, }, + { 121325312, 3826816, 365072, }, + { 130160056, 69256, -1712618, }, + { 32813550, -5970005, -579284, }, + { -33693480, -6060199, -606127, }, + { 35114580, 5337571, 1307818, }, + { -20415590, 2937758, 1492501, }, + { -71973992, 2348810, 609885, } + }, + { + { 98599568, 495532, -88047, }, + { 75073344, -2914672, -547608, }, + { -108793136, -4763656, -343061, }, + { 55084568, -7936026, -375810, }, + { 122353952, -4451197, -281320, }, + { -58283780, -4212826, -855235, }, + { 58262840, 2534031, -28991, }, + { 92815320, 1783485, -290984, }, + { 42135240, -676457, -319975, }, + { 111458696, -2683818, -582505, }, + { 119100520, -385473, -188442, }, + { 46731928, 2570001, 293668, }, + { -20077898, 2864743, 571231, }, + { 22313966, -5775121, -535797, }, + { -23293218, -1050120, 282931, }, + { -75310104, -1711545, -76236, } + }, + { + { 95407864, 774168, 247497, }, + { 62201328, 2433099, -663036, }, + { -117396488, -2913599, 489089, }, + { 34339336, 1861868, -654446, }, + { 106500160, 2358474, -437013, }, + { -70891656, -2207613, 473520, }, + { 63357212, 2029372, -622770, }, + { 91015728, -407485, 495532, }, + { 41493680, -763430, -267899, }, + { 100730408, -11811, -16106, }, + { 107888504, 3798362, 7516, }, + { 53526568, 1596654, -488553, }, + { -10588168, 2075543, -592706, }, + { 7605314, 3099893, -1168768, }, + { -21086678, -2073396, 204548, }, + { -74581032, -2846490, 326418, } + }, + { + { 90771448, -2081449, -117575, }, + { 49592376, -1717987, -501437, }, + { -116706608, 5574331, 3620121, }, + { 20064476, 2241973, 1702955, }, + { 90603944, -127775, 1071594, }, + { -75449152, 3895535, 3524021, }, + { 60686276, -2705830, -1933809, }, + { 86734184, -1172526, 712428, }, + { 39661340, 1410897, 824634, }, + { 88941792, 665183, 2068564, }, + { 96333432, -5178657, -1554778, }, + { 52489868, -1941325, -1625108, }, + { -5063230, -2674154, -3305514, }, + { -4338454, 185220, -432718, }, + { -16717623, 2758443, 1214402, }, + { -67415952, 3813394, 1714766, } + }, + { + { 84129280, 1676648, -499290, }, + { 35509180, 853088, 664646, }, + { -106909256, -1200443, 4897874, }, + { 13125957, 48855, 3714610, }, + { 76045616, 1665911, 3042984, }, + { -71664752, 399432, 4633196, }, + { 52086680, -175557, -1498944, }, + { 77734080, 1599875, 1329292, }, + { 36881956, 878858, 1655710, }, + { 77481744, 3317325, 3355980, }, + { 83693880, 1409286, -2289218, }, + { 45268420, 208306, -1228361, }, + { -3515968, -1600412, -4469987, }, + { -11599633, -2076080, 1337346, }, + { -12450573, -971736, 2001992, }, + { -54461260, -667867, 1289564, } + }, + { + { 75215616, -398358, 100395, }, + { 19555522, -3034395, 2166811, }, + { -88683560, -1553704, 2289755, }, + { 13752485, -4630512, 2234457, }, + { 65350612, -8352638, 1596654, }, + { -59645284, -3656628, 1658931, }, + { 39149164, -894964, 359167, }, + { 64903936, -2723546, 2352568, }, + { 34983044, -2870112, 938987, }, + { 69646112, -9290014, 470836, }, + { 67845448, 2728378, 355945, }, + { 34161096, -1496796, 13422, }, + { -7281044, 4550518, -2243047, }, + { -14781130, -1541356, 2099165, }, + { -7865696, 2147, 2094333, }, + { -36711768, 1573569, -861678, } + }, +}; + const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -1862,6 +3670,910 @@ const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_ } }; +const Word32 rightHRIRReal_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { 189679184, 304322592, 107436456, }, + { -242399360, 302261536, -44863616, }, + { 11860552, 60100016, -1683090, }, + { 25304336, 104153, -207232, }, + { -21139292, 19353660, 8217883, }, + { -7248831, 2365453, -9037148, }, + { -26986890, 31329638, 9359807, }, + { -7344931, 43398496, -10575820, }, + { -19937238, 13084081, 28024662, }, + { -26909044, 42307040, 10624675, }, + { 2450816, -4110284, 718333, }, + { -5272609, 27694486, 1728188, }, + { -2057826, -12568685, -1696512, }, + { 4153234, -22881976, 5524939, }, + { 7628936, -1821066, -681826, }, + { -3011309, 570694, 995359, } + }, + { + { 5991480, -273394528, -70961448, }, + { -76770392, 439989344, -50001472, }, + { 1802813, 41517840, -4589173, }, + { 2413235, 12974559, 13751412, }, + { -11226508, -30864708, -13184476, }, + { -11241003, -13223667, -12262132, }, + { -26838176, -61006788, -28770912, }, + { 5379447, 112868520, 14491220, }, + { -50776712, -218518816, -55487220, }, + { -20914344, -47507172, -31159450, }, + { -1543504, -8399345, 417686, }, + { -11120744, -56255480, -37819336, }, + { -4721243, 1569811, 5162014, }, + { 2341294, -30473866, 3795677, }, + { 5437429, 39253852, 18807662, }, + { -3028489, -3227668, -131533, } + }, + { + { -103299336, -110683456, -102613208, }, + { 149763360, -126817496, 135879344, }, + { -1404454, 36626408, 381178, }, + { -23609436, 57801132, 3221226, }, + { 12256763, -65424164, -4438312, }, + { -4104915, -56324736, 8615704, }, + { 4727149, -149730608, 3177739, }, + { 8160438, 96794064, 20379620, }, + { -20394116, -285178304, -28841780, }, + { 28674812, -217949728, 35490388, }, + { -2268280, -26517128, 10790032, }, + { 17635672, -217100928, 30644592, }, + { -10921565, 13795972, 1620276, }, + { 214212, -26433914, 2987150, }, + { -10144176, 91749632, -2559801, }, + { -7639136, 26703960, -14314589, } + }, + { + { -33778308, 274702336, 33510408, }, + { 88140248, -585712192, -58195196, }, + { 4900021, 34997540, -1655173, }, + { -9982041, 43882756, -413927, }, + { 11105712, -50252728, -6448357, }, + { -443455, -63618128, 804233, }, + { 13956496, -165173168, -12775917, }, + { -4399121, 29312078, -5219459, }, + { 21663278, -239384304, -30239790, }, + { 16560857, -380443360, -43821016, }, + { -1107565, -18220326, 13462038, }, + { 14711874, -246313696, 17947058, }, + { -11474542, -3762928, -5577015, }, + { -1122060, -16861504, 4379793, }, + { -15287399, 38154880, -25150792, }, + { -4081293, 62483720, 1358820, } + }, + { + { 61600032, 37331856, 91757144, }, + { -56944824, -351084576, -99906848, }, + { 17413408, 12843026, 1846836, }, + { 26146150, 75161392, -28630788, }, + { -4660040, -135259792, 38225208, }, + { 2360622, -64597920, -166430, }, + { 13772886, -174139984, -3468723, }, + { -2582349, 33209760, -4078608, }, + { 52569864, -344211040, 8208220, }, + { -6097243, -299348480, -76846632, }, + { -2537252, 8970576, -233002, }, + { -7102266, -89445912, -49996640, }, + { -3978750, 6330782, -11567958, }, + { -2896956, -18562312, 6148783, }, + { 5714454, 6291590, -11762305, }, + { 2909304, 16636556, 23424214, } + }, + { + { 35767952, -48289928, 51695836, }, + { -122719024, -248484800, -12538620, }, + { 16426639, 29774324, 5659157, }, + { 56310780, 181175136, -1972464, }, + { -39025684, -217555120, 20864952, }, + { -2611340, -43738872, 11940546, }, + { 13994614, -115656488, 29881698, }, + { 8351564, 18503256, -14416595, }, + { 43786656, -177021376, 90108952, }, + { -2380486, -120777704, 14774687, }, + { -458488, 9656160, -627602, }, + { 9182103, -11922292, -14430553, }, + { 9099425, 37925100, -2336999, }, + { -3535295, -46244988, -2520609, }, + { 31896574, 57557392, 2627983, }, + { 3047279, -31762356, 1707250, } + }, + { + { -133453760, 248134224, -24065238, }, + { -49510236, -309569984, -16902306, }, + { -9960029, 63480152, -102005, }, + { 12905303, 103205376, 40805412, }, + { -39440148, -59966872, -45799920, }, + { -24383604, -28147068, 7584912, }, + { 2330557, -47321948, -1519345, }, + { 31236760, -36228588, 1898912, }, + { -60579440, 97428112, -7415261, }, + { -27457726, -30667678, -19580220, }, + { 1240172, 5094368, 1571958, }, + { 19764902, -37777996, -7081328, }, + { 13549548, 1037772, 12015708, }, + { 6334540, -37628744, -9266929, }, + { 42618424, -2711198, 22687628, }, + { 14770929, -17062294, -7906498, } + }, + { + { -316071488, 37549824, -63453848, }, + { 180852480, 46988552, 71499392, }, + { -49294412, 119185, -16876538, }, + { -128887672, -112254336, -14310831, }, + { 57196080, 112747184, 3730716, }, + { -46474768, -41647224, 7485055, }, + { 19670950, -6565932, 11464878, }, + { 32199906, -13280576, 9488120, }, + { -115142168, 14012331, -24771224, }, + { -8647380, 44480828, 6425271, }, + { 1937030, -11526618, -4697084, }, + { 24869472, 5836324, 8390219, }, + { -4409858, -42788076, -1603633, }, + { 28117540, 15736760, 7562364, }, + { 10062035, -60990148, 5612986, }, + { 31954556, 17682380, 2305324, } + }, + { + { -361012928, -107035952, 1838246, }, + { 339260544, 74138648, 23380192, }, + { -70194800, -31168040, -679679, }, + { -243166560, -1868311, -30283814, }, + { 153038816, -16125455, 30584462, }, + { -59203440, 6156299, -9015673, }, + { 35418448, 3013993, 2372970, }, + { -1691680, 25706990, 1106491, }, + { -87555056, -70230768, 971736, }, + { 10498511, 13577465, 12486544, }, + { 10082973, -18462454, -3297461, }, + { 1347009, 24953224, 4918812, }, + { -22036940, -12890807, -9094593, }, + { 35231080, 14661945, 5639829, }, + { -39492224, 21459268, -15654619, }, + { 33756296, 3649112, 6452652, } + }, + { + { -291765184, 31956168, 34410204, }, + { 375867072, -43094628, -22290880, }, + { -83209624, -4979478, 9856950, }, + { -254651840, 67848136, -1629403, }, + { 175750064, -61229052, 7963406, }, + { -38247220, 31672162, -2454574, }, + { 47128676, 67109, -594316, }, + { -50551764, -20916490, -6397891, }, + { -10248329, 29680372, 20811800, }, + { 12695386, -21452288, -1926293, }, + { 23096724, 7217156, 4312147, }, + { -41781980, -24153822, -5424007, }, + { -21937082, 11606612, 1177358, }, + { 24022288, -16567299, -4268661, }, + { -66468376, 30025580, -6706592, }, + { 13777718, -18653580, 1938641, } + }, + { + { -180420832, 15508053, 16914118, }, + { 315297312, 4876399, -22964654, }, + { -97981624, 13826037, 4172561, }, + { -176048032, -34457984, 18804440, }, + { 125448480, 36109936, -16757889, }, + { 3931506, -16374563, 7987029, }, + { 46259484, 3149285, -1439888, }, + { -84816480, -9487046, -4279935, }, + { 55625196, 20936354, 10554882, }, + { 4123706, 2500208, -8121783, }, + { 29963840, 9622337, 1771674, }, + { -77292232, -7432978, -4481262, }, + { -9511205, -2664490, 3375308, }, + { 4716948, -6528351, -3870839, }, + { -65016140, -18563922, 10410464, }, + { -17283486, 16813186, -5451387, } + }, + { + { -82274392, -4493610, -4998268, }, + { 215839824, -63351, -6945499, }, + { -107246944, -3540664, 659278, }, + { -69171520, 2429878, 10962367, }, + { 49844168, 5693516, -11807402, }, + { 41827076, -13609141, 1554241, }, + { 30812096, -4552129, -1991791, }, + { -88808648, 12234751, 4199405, }, + { 79944376, -20038170, -7359964, }, + { -6064494, 9715753, -3017752, }, + { 29600914, -4624069, -3562139, }, + { -86208584, 8352101, 3291556, }, + { 7969312, -1806034, 34360, }, + { -14738717, -891206, 2032593, }, + { -52577916, -17246978, 7355132, }, + { -40023188, 11195906, -3377992, } + }, + { + { -11520176, -16800838, -8475044, }, + { 121099824, 8950175, 2939905, }, + { -96168616, -3455301, 530965, }, + { 16582869, -2209761, -542240, }, + { -12630425, -2364380, 1235340, }, + { 61056720, 850404, -7627325, }, + { 3321620, 1947768, -172872, }, + { -70016016, 70867, 4503273, }, + { 71465032, -759672, -10794327, }, + { -14083735, -3701188, 3001109, }, + { 25223270, -6362994, -1888712, }, + { -66658428, -2034741, 3216931, }, + { 21100638, -2749316, -1918777, }, + { -33149632, 10821707, -206695, }, + { -39621612, 8810052, -4913980, }, + { -47799764, -4650376, 3549791, } + }, + { + { 42451456, 21299280, -1612760, }, + { 41670848, -17740900, 3934190, }, + { -48837536, 14950781, 521302, }, + { 65235720, -1077500, -5389647, }, + { -51329692, -3191161, 4767414, }, + { 53909892, 8493298, -3687766, }, + { -32504312, -6902013, 2399813, }, + { -41712184, 894964, -538482, }, + { 49881752, 9771587, -2830920, }, + { -21916682, -7760469, 2321967, }, + { 16160888, -1179505, 1459752, }, + { -23418310, 9116068, 65498, }, + { 22019224, 804770, -699543, }, + { -47476032, 4873714, -712428, }, + { -27396522, 13417478, -4742181, }, + { -48884780, -6140193, 2001455, } + }, + { + { 88989040, -11040213, 2617783, }, + { -27049704, 19992536, 533650, }, + { 37626060, -19404662, -939524, }, + { 90464360, -9076340, -4810900, }, + { -75970992, 7735236, 3192771, }, + { 12238509, 5801964, 3783329, }, + { -67951216, 8986682, 2831457, }, + { -14402636, -9207873, -1178969, }, + { 24434068, 2305861, 3216394, }, + { -29472066, 4461934, -941672, }, + { 1956895, 5533529, 1078574, }, + { 30696132, -7948374, -2563022, }, + { 5944235, 5713380, -133144, }, + { -58457188, -2496450, 4172024, }, + { -21294448, -10089415, 2979634, }, + { -49573588, -411780, -426812, } + }, + { + { 128727688, 3776350, 1412507, }, + { -85088672, -12749610, -1985349, }, + { 145171504, 23826868, -3697967, }, + { 111840408, 8870181, -1000191, }, + { -101389680, -9131637, 709207, }, + { -58888832, -21438330, 5841156, }, + { -87093344, -6423661, 1226213, }, + { 4442607, 5873905, 1722282, }, + { -4634270, -12062416, 2022393, }, + { -33332704, 2255395, -806917, }, + { -13388487, -5470178, -262530, }, + { 77616504, 11276437, -3949223, }, + { -24839944, -5436355, 712428, }, + { -68098856, -10958609, 2998961, }, + { -26676042, -6561100, 5107253, }, + { -54116588, -608275, 588947, } + }, + { + { 160432064, -3110093, -737124, }, + { -127650720, 4705674, -1635309, }, + { 241246704, -25421912, -2492155, }, + { 134621984, -2611877, -1050656, }, + { -131793216, 5808407, 472983, }, + { -134059888, 26525718, 2126546, }, + { -73410656, -4699231, -995896, }, + { 13879724, 1817308, 2222109, }, + { -35398048, 12080132, -1765232, }, + { -30884572, -4506495, 1458678, }, + { -24806658, 2606508, -1139777, }, + { 98636608, -8537858, -754304, }, + { -61230664, 6629282, 2826089, }, + { -69490424, 5415954, -2579665, }, + { -38364796, 12315282, 798864, }, + { -63967632, 4951561, 297963, } + }, + { + { 185763248, 4479114, -1353452, }, + { -153832304, 309238, 257698, }, + { 290788064, 7578470, 1229434, }, + { 153667488, 5258651, -2077154, }, + { -161042480, -5226439, 1700270, }, + { -176488800, -10183367, -3265249, }, + { -20143396, 18489298, -1172526, }, + { 22658100, -1901060, 338229, }, + { -62093952, -2499671, -2667712, }, + { -20965346, 1632625, 2285460, }, + { -30292404, -601295, -1700270, }, + { 77775952, -10266582, 1833414, }, + { -89274120, -9709847, 2138357, }, + { -54588496, 11563126, -2695629, }, + { -42026256, -3581466, -3647501, }, + { -75187160, -2548526, -672162, } + }, + { + { 208514224, -5304822, -991601, }, + { -169719920, 48318, 2152316, }, + { 275570464, 19114216, 161061, }, + { 159189200, -3106335, -143345, }, + { -178980944, 3876745, 1544578, }, + { -158604560, -22049288, -1932735, }, + { 61370252, -22639846, 114890, }, + { 43689480, -3373697, -1739462, }, + { -80673984, -3013993, 260382, }, + { -2893734, -114890, 209380, }, + { -34706020, -1522029, -1552631, }, + { 14364518, 24151138, -210453, }, + { -91525752, -1062468, -83752, }, + { -27262304, -13845901, 1780801, }, + { -25509422, -13974213, -2544231, }, + { -82675440, -2627446, 635118, } + }, + { + { 231195936, 5265630, -641561, }, + { -184304032, -5625334, 2100776, }, + { 208716624, -26603564, -4437238, }, + { 143026176, -9013526, 463856, }, + { -176169360, 4109210, 1348620, }, + { -83453896, 32672890, 5035849, }, + { 144423648, 14431627, -525060, }, + { 85177792, 13616120, -2009508, }, + { -92251600, 1479616, 3518652, }, + { 23432804, 5090610, -2103460, }, + { -48676476, 792421, 562641, }, + { -71161168, -19383724, -1622424, }, + { -57096760, 12967580, -226023, }, + { -279710, 5210332, 4049081, }, + { 10645613, 19659676, 3597035, }, + { -83698176, 1516124, 2621541, } + }, + { + { 253110480, -4453881, -644245, }, + { -202792784, 9002251, -316754, }, + { 126104536, 14142790, -4711579, }, + { 106415864, 15707232, -2575370, }, + { -149847648, -8284455, 1737314, }, + { 18028662, -17587892, 6094022, }, + { 199054016, -3391951, -3665755, }, + { 142919872, -15989626, -756988, }, + { -99546064, 6783901, 2951716, }, + { 53973244, -10205916, -1722819, }, + { -81119584, 5608154, 3808562, }, + { -147441392, 6831146, 2094333, }, + { 7497939, -16030429, -641561, }, + { 17021492, 5471789, 1440425, }, + { 55233280, -5935108, 5962489, }, + { -77189688, 3450469, 1087701, } + }, + { + { 271380192, 3393561, -754304, }, + { -225036960, -5210332, -2160369, }, + { 61864172, -3352759, -230854, }, + { 59377384, -7401840, -3531537, }, + { -106045960, 8349417, 395137, }, + { 111889800, 4412542, -1377611, }, + { 204785120, -613107, -4148939, }, + { 199535584, 8651675, -1597191, }, + { -102982040, -9226127, -2387465, }, + { 79090216, 8512088, 667331, }, + { -128752920, -15685757, 4660577, }, + { -186985152, -4001836, 5465883, }, + { 80273472, 16455093, -1806571, }, + { 26085484, -3606162, -2874944, }, + { 100301448, -5814849, -549756, }, + { -62251792, 960999, -2479270, } + }, + { + { 283445824, -2472291, -425739, }, + { -250145872, -394063, -347892, }, + { 31551366, 1824824, 2136746, }, + { 11241540, 1342177, 860067, }, + { -55291800, -12691628, -486942, }, + { 177572208, -8174934, -7242389, }, + { 157573760, 6961068, 1270774, }, + { 233900160, -4170950, -3251290, }, + { -101713416, -5664525, -4573604, }, + { 89047560, 841814, 1887638, }, + { -172231408, 18637474, 468688, }, + { -174405200, 2156074, 1228361, }, + { 133267464, -12697534, -599685, }, + { 36203888, -8750996, -2057826, }, + { 146519056, -4073240, -8343511, }, + { -41135048, -11688753, -1687385, } + }, + { + { 288816672, 65498, -69256, }, + { -279945440, -3285650, 3053185, }, + { 31862752, 1466195, 632971, }, + { -34104188, -8149164, 4543002, }, + { -9822053, 10109816, 583042, }, + { 205254336, 11177652, -4417374, }, + { 71791992, -27465242, 4102768, }, + { 229422656, -2577517, -2360085, }, + { -101560944, 13728326, 1846836, }, + { 82175608, -9631464, -331786, }, + { -185142624, -451508, -3894999, }, + { -109586088, 19167366, -4055523, }, + { 144640544, -3027415, 1314797, }, + { 52999360, 7438884, 1590212, }, + { 190781904, 21658446, -6819871, }, + { -23318988, 8011725, 2361158, } + }, + { + { 289866272, 1352915, -431107, }, + { -315025120, 12282533, 3040837, }, + { 47494284, -6703907, -4832, }, + { -71863928, 13118978, 2914672, }, + { 20838644, -2469606, 643708, }, + { 190062496, 3092377, 1194538, }, + { -19047644, 33006286, -2068027, }, + { 179018528, 16397111, -1230508, }, + { -115382688, 5246840, 7004018, }, + { 67956048, 5418638, -2936684, }, + { -153785056, -24093692, -775242, }, + { -14096620, -36050344, -586800, }, + { 111691696, 18995566, -474594, }, + { 75546328, -217433, 713501, }, + { 214077280, -14137959, 1343251, }, + { -18821620, 4057670, 3177739, } + }, + { + { 291103744, 370978, -772557, }, + { -348790528, -12458090, -287226, }, + { 58636504, 3210488, 1225139, }, + { -92223152, -5486821, -352187, }, + { 35514012, -2880313, -1367410, }, + { 136765712, -22014392, 1087701, }, + { -74584256, -4656819, -6522445, }, + { 90864864, -23682450, -1395328, }, + { -146371408, -21838298, 2491081, }, + { 59137940, 3469260, -1843615, }, + { -91215976, 23076860, 5398774, }, + { 71293232, 19409494, 4901632, }, + { 54820964, -17020418, -3295851, }, + { 101421896, 2614561, -2597918, }, + { 191872288, -16305306, 3377455, }, + { -27441620, -11033234, -479963, } + }, + { + { 296270592, -2617246, -364535, }, + { -370586944, 2314987, -2156074, }, + { 51345796, 5406827, 1508070, }, + { -86875376, -7421704, -424128, }, + { 40845676, -1283122, -2312840, }, + { 65692060, 21493626, -2470143, }, + { -77312632, -19687594, -1716913, }, + { -13135084, 21265456, -473520, }, + { -178148272, 11236171, -3562139, }, + { 60837676, -4228396, 497679, }, + { -25942676, -4966593, 4297115, }, + { 111659488, 8442832, 2335389, }, + { 3730716, 5009006, -2279554, }, + { 125576792, -7951595, -2874944, }, + { 119798984, 29526826, -1306744, }, + { -37692632, 1173600, -2627983, } + }, + { + { 306039520, 2916283, 55298, }, + { -375466048, 7729868, 229244, }, + { 26038776, -9740449, 701153, }, + { -57603564, 12832289, 1970853, }, + { 44336948, 3262028, -929324, }, + { 3132105, -10383083, -3685619, }, + { -45856828, 19236622, 5332739, }, + { -108694344, -19291920, 162672, }, + { -189576096, 8080444, -2288681, }, + { 69859256, 2285460, 953483, }, + { 23221814, 1700270, -803159, }, + { 101647920, -16965658, -4098473, }, + { -21590264, 2845953, 823560, }, + { 137975280, 4347581, -857920, }, + { 19513648, -26326002, -4456566, }, + { -37789808, 6197638, -426276, } + }, + { + { 318587776, -3032784, 149250, }, + { -369527168, -3953518, 2932926, }, + { -4318590, 9765682, -648003, }, + { -16476031, -8249022, 2439005, }, + { 49333604, -2521146, 493384, }, + { -34719440, -4065724, -518080, }, + { -16206522, 1155883, 5816460, }, + { -177921168, 8576513, 460635, }, + { -173933296, -13509820, 2663417, }, + { 79901960, 100932, -41876, }, + { 54387708, -3276523, -2781528, }, + { 61901216, 9036611, -5770826, }, + { -17591112, -6221797, 2840047, }, + { 128530120, 4281009, 378494, }, + { -77983184, 12730820, -2652679, }, + { -24894168, -6537477, 1983738, } + }, + { + { 331023328, 1572495, -158377, }, + { -363240416, -2485176, 2062658, }, + { -23373748, -2558727, -1784559, }, + { 23740432, 7432978, 1649268, }, + { 54683524, -3455838, -938450, }, + { -49672908, 3960497, 3744675, }, + { -12600360, -14341433, -257161, }, + { -215045792, 570157, 2612951, }, + { -140426640, 7584912, 4264903, }, + { 85427440, -1476932, -1599875, }, + { 74498896, 4804995, -2248952, }, + { 18589156, 258235, -1464047, }, + { 6771553, 3172370, 1788317, }, + { 94353992, -13314935, -484258, }, + { -151179632, -4474282, 2142115, }, + { -3787088, 1398012, 1156957, } + }, + { + { 341009120, -1515587, -616328, }, + { -361957824, 4287451, -532039, }, + { -22019224, -7435126, -636192, }, + { 56237228, -2128156, 529892, }, + { 57777512, -2005750, -2416993, }, + { -54333484, 2007360, 4508105, }, + { -34668440, 11482595, -5185100, }, + { -226664752, -2289755, 4807142, }, + { -102528920, -1979980, 1407676, }, + { 83640728, -810138, -1657857, }, + { 90878288, -4764193, -1228898, }, + { -12435004, 1063541, 3004867, }, + { 39201240, -5504001, -520765, }, + { 43192340, 13027173, -1552094, }, + { -195225056, 2522220, 5649493, }, + { 19146428, -3657165, -924492, } + }, + { + { 347595456, 1677185, -417686, }, + { -364211072, 656056, -1167694, }, + { -4296578, 10086731, 2272038, }, + { 82555176, 3663607, -807991, }, + { 54913304, 3373160, -198105, }, + { -57903676, -8464307, 1361505, }, + { -68560024, -1516124, -4011500, }, + { -222998464, -2698850, 3826816, }, + { -67095444, 6439230, -712428, }, + { 72852312, -1525250, -280247, }, + { 105808128, 4806069, -281857, }, + { -26526792, -4527433, 2848637, }, + { 68737728, 4700305, -1606855, }, + { -10790032, -9171366, -679679, }, + { -214334432, -5647345, 5347771, }, + { 39519068, 7033009, -117575, } + }, + { + { 350730784, -349503, -70867, }, + { -366636672, -1081258, 66572, }, + { 17701708, -3133716, 3336653, }, + { 108880104, -4415764, -1509681, }, + { 41920492, 3178813, 2012729, }, + { -59764468, 2437394, -1982664, }, + { -104399920, 922881, 396211, }, + { -208644144, -919123, 1145146, }, + { -34493956, -6276558, -525060, }, + { 52565568, 5551245, 316217, }, + { 117002960, -1362042, 101469, }, + { -23087060, 638876, 347892, }, + { 86126976, -3460133, -1624035, }, + { -55188184, 6024766, 777926, }, + { -210987040, 2057289, 2257542, }, + { 54660976, -2545305, 1357747, } + }, + { + { 351696096, -266288, -39192, }, + { -367900992, -301721, 442382, }, + { 34761856, -4679367, 199179, }, + { 138656576, 8657580, -1464047, }, + { 20651814, -10691784, 737661, }, + { -54502600, 6995965, -925565, }, + { -141045120, -5858873, 3105798, }, + { -183038080, 5861020, -58519, }, + { -2747169, 6265284, -612570, }, + { 25756382, -8061654, -273804, }, + { 122231008, -829466, -453119, }, + { -3658775, 5697811, -901406, }, + { 84907208, -1595044, -946503, }, + { -83002392, -2358474, 1876364, }, + { -183580864, 6935299, 32212, }, + { 66104380, -1711008, 297427, } + }, + { + { 352811168, 619549, -377957, }, + { -368510880, 630286, -12885, }, + { 47033648, -1253594, -2666638, }, + { 169054752, -8256001, -413391, }, + { 831613, 6984154, -2095944, }, + { -41806676, -5986648, 1675037, }, + { -178983632, 11828877, 2625836, }, + { -146943712, -10399190, 165356, }, + { 29367376, -6104759, -1154273, }, + { -1778117, 6456410, -1106491, }, + { 122834992, 752693, -854699, }, + { 26137024, -9786620, -279173, }, + { 62861140, 6782827, -481036, }, + { -93098784, 931471, 2050847, }, + { -133093520, -16054051, 366146, }, + { 79614200, -497142, -1923072, } + }, + { + { 356286336, 1079111, -706522, }, + { -370377568, 118112, -59056, }, + { 58491548, 7219303, -1080721, }, + { 192554656, 5204964, 554588, }, + { -7168301, 2298344, -2442763, }, + { -26358214, 807991, 1415729, }, + { -213923200, -11788075, -175557, }, + { -105548824, 10618233, 1021665, }, + { 59586228, 7743289, -1002338, }, + { -24626268, -2447058, -846109, }, + { 122507496, -52076, -792421, }, + { 56819732, 8184060, 1071058, }, + { 23933706, -11563663, -741956, }, + { -88090856, 888521, 1012002, }, + { -67978592, 17484812, 1989107, }, + { 99579352, 7204271, -2246268, } + }, + { + { 362722880, -2591476, -450435, }, + { -375905728, 1128503, 363998, }, + { 69048576, -3528316, 1149441, }, + { 203336096, 1549946, 347892, }, + { -2265595, -6801618, -430034, }, + { -12047383, -350577, -466541, }, + { -237117088, 1186485, -1096290, }, + { -67009008, -7736847, 1520955, }, + { 82461224, -4238059, -362388, }, + { -41384696, 653372, 377420, }, + { 124182536, 389231, -1152662, }, + { 79066592, -1724966, 1180042, }, + { -22692460, 11189464, -1503239, }, + { -71790912, -5228586, 567473, }, + { -1692217, -11481521, 1993939, }, + { 123079264, -8227547, -708133, } + }, + { + { 370373824, 2542084, 98247, }, + { -386556192, -3310883, 375273, }, + { 76104136, -1887638, 447750, }, + { 202242496, -3654480, -919660, }, + { 5905580, 2692945, 868657, }, + { -347355, 2221035, -1225676, }, + { -243896160, 5133023, 1224603, }, + { -37273872, 2496987, 845035, }, + { 92828200, 244813, -382252, }, + { -54846732, -2807835, 863288, }, + { 127560528, 631360, -1960116, }, + { 89395984, -3245922, -675384, }, + { -66122096, -5112622, -521839, }, + { -49948860, 4191888, 396211, }, + { 54602992, 4352413, -951335, }, + { 140605952, 3172907, 141197, } + }, + { + { 376587552, -702764, 275415, }, + { -401500000, 3802657, 158377, }, + { 78745008, 1107565, -1109712, }, + { 196230608, 2150168, -1660542, }, + { 5272073, 1649804, 909459, }, + { 8028368, -2726767, -667331, }, + { -238401280, -2830920, 2775623, }, + { -16224239, -919660, -752693, }, + { 89822800, 3003256, -701690, }, + { -68125696, 3136937, 624381, }, + { 128559648, -3267933, -1184337, }, + { 91821032, 606664, -2059974, }, + { -99711960, 4389457, 1236414, }, + { -28915330, -4508642, -1611, }, + { 96751120, -6563247, -3388192, }, + { 143558752, 1979980, -37581, } + }, + { + { 379933888, -866510, -223875, }, + { -418189152, -3509525, 179315, }, + { 78002512, 1551557, -689342, }, + { 193020128, 2717641, -788663, }, + { -10403485, -8171712, 40802, }, + { 11798812, 491774, -142808, }, + { -228333888, -441308, 1696512, }, + { 1134408, 3786014, -1302986, }, + { 77307264, -3585761, -798327, }, + { -82289424, -4401805, 170725, }, + { 120315992, -1399623, 513785, }, + { 92718680, 3023120, -1060320, }, + { -122189136, -4933307, 1023276, }, + { -13180181, 3692598, 535797, }, + { 124550296, 8669928, -1908576, }, + { 130201936, -6466610, -628139, } + }, + { + { 381073120, 535260, -813359, }, + { -433806208, 2840047, 312996, }, + { 75059384, 233539, 439160, }, + { 196453952, -3342558, 932545, }, + { -38315940, 9525164, -1642825, }, + { 9557376, 1625108, -333397, }, + { -218855968, -242129, 93952, }, + { 18570902, -4182761, -1089848, }, + { 61713312, 3343632, -601295, }, + { -96362960, 3289945, -426812, }, + { 98379448, 8465381, 415001, }, + { 95044944, -1895691, 373662, }, + { -134432480, 727460, 594853, }, + { -4395362, 85362, 781684, }, + { 136693232, -743029, -285615, }, + { 106566728, 7488276, -1481227, } + }, + { + { 381620192, 1278290, -573915, }, + { -446254624, -1850594, 471373, }, + { 70897024, -4185983, -520228, }, + { 205557136, -587337, 381715, }, + { -69342248, -4027606, -1483374, }, + { 1697049, -411780, 237834, }, + { -210835120, 3384971, 437550, }, + { 35998804, 6389301, -175557, }, + { 48716740, -2058900, -534723, }, + { -108493024, -300648, 104690, }, + { 65671124, -11233487, -1360968, }, + { 97958544, -1491427, -138513, }, + { -139136000, 694174, 1178432, }, + { 346282, -1947231, -251792, }, + { 133537512, -3973382, -887985, }, + { 82236816, -4588099, -1869921, } + }, + { + { 382351936, -1075352, 183073, }, + { -454615840, 816581, 748398, }, + { 66729832, 1833414, -2317672, }, + { 218169312, -1402844, -1505386, }, + { -96211024, 1338419, 772020, }, + { -9361418, 2212982, 1392106, }, + { -202981232, -1261110, 1223529, }, + { 50014896, -2319819, 700617, }, + { 41347652, -806380, 40802, }, + { -118474528, 668404, 1267552, }, + { 30713312, 5957120, -1932198, }, + { 99469296, 617938, -1403381, }, + { -139440944, -980863, 1854889, }, + { 6510634, 270583, -1832340, }, + { 119157424, 5541045, -1895691, }, + { 63735704, -129923, -788127, } + }, + { + { 383144384, -444529, 292595, }, + { -459259776, -1583769, 524523, }, + { 62185756, 3074660, -1435593, }, + { 231434320, 4502200, -1624035, }, + { -117318104, -4323959, 1771674, }, + { -19376208, -4671851, 766652, }, + { -192852624, 653909, 485331, }, + { 57789860, -828929, 118112, }, + { 38961260, -403727, 383863, }, + { -127578784, -3790846, 962073, }, + { 832687, -1974611, -172872, }, + { 97513472, 1676111, -812823, }, + { -137204880, -2003065, 1231045, }, + { 17623324, 6783901, -1333587, }, + { 99434400, -2160369, -1452236, }, + { 50520088, -871342, 569620, } + }, + { + { 384296480, 776852, -302795, }, + { -460956832, 68719, 89121, }, + { 53318796, 558883, 696322, }, + { 240763520, -4166118, -34360, }, + { -133587440, 4829691, 685584, }, + { -22540526, 171262, -424665, }, + { -177651120, -3570192, -296353, }, + { 61066920, 1590749, -952409, }, + { 39507256, -175557, 85362, }, + { -136151008, 2514167, -131533, }, + { -22209812, 2669859, 1468342, }, + { 89513024, 2073932, 286152, }, + { -132348344, -680752, -26307, }, + { 31038654, -5706401, 867047, }, + { 79264160, 2407866, 130997, }, + { 37860672, 2688113, 896574, } + }, + { + { 386752128, 849867, -627065, }, + { -460907424, 860067, 301185, }, + { 36146980, -8155069, 146566, }, + { 241739008, -2721936, 404264, }, + { -145550544, -1211181, 214212, }, + { -15294379, 6343130, 619549, }, + { -156943472, 6531572, 106837, }, + { 64532956, 837519, -1495186, }, + { 41670848, 206695, -30602, }, + { -143601152, 547071, 244276, }, + { -40169756, -4733591, 1357210, }, + { 74599288, -5961415, -316754, }, + { -124122408, 5115306, 801011, }, + { 40080636, -530965, 1106491, }, + { 61127048, -4632122, 347892, }, + { 22113176, -5246840, 465467, } + }, + { + { 391063200, -2029909, -237297, }, + { -461126464, -344134, 667331, }, + { 11589969, 8358007, -1996086, }, + { 233550128, 6007586, -1385127, }, + { -153602528, -243739, 1096290, }, + { 543313, -5778342, 2461016, }, + { -133317392, -5993627, 959925, }, + { 72045928, -3372086, -1061931, }, + { 44400300, 733903, -638876, }, + { -149664576, -162135, 1471563, }, + { -55261732, 5041755, -13422, }, + { 55586004, 4656282, -1148367, }, + { -113788176, -3487514, 2371896, }, + { 41438380, 2802466, -167504, }, + { 46727632, 3631932, -506269, }, + { 2968896, 5842230, -533113, } + }, + { + { 396734720, 1250372, 73014, }, + { -462726880, 500364, 1276142, }, + { -15785079, -1756105, -1324997, }, + { 219574304, -1741072, -1924145, }, + { -157631744, -1241782, 1465658, }, + { 20402168, 221191, 1504849, }, + { -110699560, 1782411, 261993, }, + { 83441016, 3263102, -599148, }, + { 47146928, 1730335, -814970, }, + { -153455424, -3345243, 1052267, }, + { -68853160, -576599, -130460, }, + { 36815924, -1578401, -375810, }, + { -102973992, -1618129, 1462436, }, + { 36476084, -3029563, -1205275, }, + { 36621576, -526134, -565325, }, + { -16523813, -1292248, -19327, } + }, + { + { 402814240, 31139, -442919, }, + { -465080000, 938987, 1842541, }, + { -41941968, -2105071, 3216394, }, + { 203479440, -2962454, 1204202, }, + { -157027232, 5337034, -1045288, }, + { 40497784, 2864743, -2887292, }, + { -91681984, -1256815, -1701344, }, + { 95501816, -3160022, -364535, }, + { 49006112, -3105798, 643171, }, + { -153419984, 6674916, -2768107, }, + { -82031728, -2663954, 2726767, }, + { 21534966, 1419487, 1041530, }, + { -92152280, 4112968, -2525978, }, + { 28469190, -468688, -843424, }, + { 29191282, -1108102, 650151, }, + { -33352032, 449361, 2191507, } + }, + { + { 408395008, 100395, -1385127, }, + { -466746432, -2885144, 1062468, }, + { -63879048, -1842541, 7820599, }, + { 187858656, 2120103, 6287832, }, + { -152399936, -4620848, -6424198, }, + { 57353384, 2039036, -6954089, }, + { -77235864, 4152697, -2153926, }, + { 105173008, 2572686, 300648, }, + { 49308908, 1588601, 2649995, }, + { -149810064, -3342022, -8390219, }, + { -95026152, 714038, 6820408, }, + { 11529840, -3498251, 875100, }, + { -82806432, 520228, -6441377, }, + { 19945828, 4118337, 2282238, }, + { 22079354, 539555, 2406256, }, + { -46061912, -2879239, 3273302, } + }, +}; + const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -2766,6 +5478,910 @@ const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS } }; +const Word32 rightHRIRImag_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { -102715752, 295527040, -88424248, }, + { 96281896, -56815440, -11869679, }, + { -8760123, 37118180, -14165876, }, + { -16805134, 23917600, -6433324, }, + { 6374269, 26807576, -12249784, }, + { -1127429, 13645648, -4787278, }, + { 4656282, 38743288, -16459388, }, + { 5360119, -24749212, 7655779, }, + { -9627169, 107434848, -38639672, }, + { 5340792, 41006200, -19219442, }, + { -268435, -7092602, 3980898, }, + { 2935073, 9185324, -4246112, }, + { -741419, -13098040, 6208912, }, + { 931471, -9216463, 4911295, }, + { -3754875, -8075076, 3953518, }, + { -147103, 2249489, -787590, } + }, + { + { -177186736, 179125376, -115792320, }, + { 239960896, 299077888, 104825120, }, + { -9208410, 46498388, -8622147, }, + { -28982440, 16567299, -3951907, }, + { 16998944, 27056684, -16417512, }, + { -7049115, -40280352, -29566554, }, + { 19155554, 43337292, -20049982, }, + { 6044093, -23644868, 7273527, }, + { 2528662, 81792824, -53621592, }, + { 29154238, 116467704, 7671349, }, + { -7763691, -48617956, -14192719, }, + { 10481331, 30494268, 1056025, }, + { -6800544, -35405564, -2618320, }, + { -5965173, -47450800, -11907260, }, + { -10130217, -13799730, 3756486, }, + { 438624, 4456029, 349503, } + }, + { + { -51999168, -317713760, 45510012, }, + { 132898096, 545737344, 39643620, }, + { -308164, 25183540, -2346663, }, + { -10490458, 16738024, -7422241, }, + { 20291572, -66797480, 22439594, }, + { 3951370, -103472744, -4090420, }, + { 38857104, -86104968, 33058364, }, + { -1992328, 11780558, -2269353, }, + { 60647084, -194886288, 50082004, }, + { 30465276, 48754860, 39180840, }, + { -3276523, -72164576, -4759898, }, + { 2859375, 54574540, -8997420, }, + { -1475858, -48667348, 3673808, }, + { -47782, -96552472, 8617315, }, + { 973884, -46942380, 19906100, }, + { 2827699, -5764920, 3810710, } + }, + { + { 34120832, -220877824, 40671192, }, + { -49936512, 199888848, -41771240, }, + { 3815542, 29523606, -4461934, }, + { 18192408, 43142408, -7209103, }, + { -7750269, -111525808, 8528194, }, + { 7198365, -69175280, 11199127, }, + { 13021804, -200965808, -12485470, }, + { -1145683, 12852153, 373662, }, + { 31666258, -357677888, -27057220, }, + { 7707856, 32124208, 42369316, }, + { 4867272, -29853244, 13622026, }, + { 4420595, 104069208, 21484500, }, + { 5786395, -47440600, 2157147, }, + { 3860102, -75734768, 17977660, }, + { 8563091, -98140536, -7536057, }, + { -2442226, -55461448, -19271518, } + }, + { + { 10460393, -181682480, 44848048, }, + { -108469400, 340663936, -99499360, }, + { 4267587, -36406292, 25516938, }, + { 26082262, -82588464, 40497784, }, + { -29406030, 4441533, -31512176, }, + { -13383655, 11658152, -22476638, }, + { -14169097, -91462400, -56171728, }, + { 7954280, -922881, 2018635, }, + { -27049704, -254546064, -60070488, }, + { -27341762, 175464448, -20010252, }, + { 3204046, -10685342, 5061619, }, + { 1270237, 125430760, 10515154, }, + { 7642358, -40255656, -4295504, }, + { -2068027, 463856, -14248554, }, + { 13204877, -75227960, -24315958, }, + { 3937948, -75275744, -8985608, } + }, + { + { -109123848, -363628576, 19850266, }, + { 9291625, 471410240, -91331408, }, + { -23200876, -97610112, 6461242, }, + { -36034776, -107364520, 42067596, }, + { 1789928, 2889439, -32729262, }, + { -20062330, 51043540, -1501628, }, + { -3835943, 12977244, -8718247, }, + { 13856101, 18894098, 5616744, }, + { -66184372, -170432352, 3189550, }, + { -38536596, 82056424, -61956512, }, + { 4857071, -3991635, 8170639, }, + { -4960687, 70343512, -20109574, }, + { 5545877, -7403987, 10499048, }, + { 9702868, 27723478, -3980898, }, + { 12382928, 13322989, 15064598, }, + { 12425877, -38941932, 6793028, } + }, + { + { -195198208, -105714176, -71322760, }, + { 215174640, -32808718, 78798688, }, + { -47779364, -19037980, -21328808, }, + { -133198744, 112761144, -23626616, }, + { 73338176, -144662544, 7880191, }, + { -21403432, 30356828, 10085120, }, + { 6622303, -32783486, 7916699, }, + { 880468, 11415486, 10504953, }, + { -88258896, -64644088, -35305168, }, + { -2688650, -66810364, -1264331, }, + { 3269007, 19416474, -1700807, }, + { -4816806, 14665166, 4730370, }, + { -14203457, 39763880, -4204236, }, + { 19469086, -13660680, 9423158, }, + { -25116432, 59262496, 6179921, }, + { 8930311, -33924872, 1862942, } + }, + { + { -75185016, 178007072, 17114908, }, + { 224526400, -173874768, 14468671, }, + { -35714800, 41899016, 1722819, }, + { -147797872, 57060788, -37157908, }, + { 110517560, -32109712, 40170292, }, + { -13028246, -9739375, -8776229, }, + { 11642583, -30146376, 6591701, }, + { -34980900, -38170448, -902480, }, + { -13600014, 85681376, 7280507, }, + { 15824270, -18907520, 12783433, }, + { 6081674, 16430934, -4125853, }, + { -29388314, -10895795, -162135, }, + { -25477210, 14954002, -10593000, }, + { 11839614, -21398600, 6806987, }, + { -62463320, -21545704, -17193828, }, + { -3930432, -23349052, 8411693, } + }, + { + { 124779536, -22646826, 48507360, }, + { 77259480, 69186552, -43811888, }, + { -10337449, -4553202, 13614509, }, + { -42608224, -104795592, 4864051, }, + { 49625664, 88771072, 3922379, }, + { 20056424, -35947804, -5018133, }, + { 1079111, -107911, -3783866, }, + { -63607928, -75699, -8749922, }, + { 70587248, -13620952, 24923158, }, + { 7115687, 30103962, -4275640, }, + { 10963441, -7543573, 4325569, }, + { -55031952, 24158654, -6695854, }, + { -15417322, -20169704, 1402307, }, + { -11427834, 19712826, -4295504, }, + { -59354836, -50075560, -6753836, }, + { -32708324, 12753905, -102005, } + }, + { + { 286679936, -42412804, 9840844, }, + { -116902568, 6942278, -25850872, }, + { 13852343, -19517406, 3364570, }, + { 110133696, 32694902, 25050396, }, + { -60822104, -43612172, -22499724, }, + { 56594248, 16292958, 8150238, }, + { -18313740, -4286378, -1090922, }, + { -58529128, 17256104, -2695629, }, + { 99918120, -48497696, 5523865, }, + { -9865540, 2490007, -9789841, }, + { 6185290, -13204877, 2734284, }, + { -57276072, 23256712, -6016713, }, + { 1996623, 1510218, 5279052, }, + { -33033130, 7542500, -4423280, }, + { -24627342, 22221624, 13475460, }, + { -56947508, -13872207, -4949413, } + }, + { + { 369951296, 11637214, -19057844, }, + { -275144736, -7006166, 4369593, }, + { 43432856, -7104413, -4556961, }, + { 223252400, 22448720, 7514046, }, + { -149661888, -27103392, -11121818, }, + { 66699232, 26035018, 1901060, }, + { -45021996, 6493454, -987306, }, + { -21727166, -23222888, 5068062, }, + { 68480032, 28010702, -14796162, }, + { -20506858, -13718662, -1280974, }, + { -7138236, 9458592, -3651796, }, + { -26306674, -18474264, 4527970, }, + { 12858595, 8259759, 213138, }, + { -42810624, -7886097, 3251290, }, + { 8556112, 19741280, 7248294, }, + { -62429496, -17578228, -3010772, } + }, + { + { 393655232, 18198314, -15280957, }, + { -366834752, -10258529, 13111461, }, + { 89055072, 13213467, -2873870, }, + { 262732272, -14457397, -9764071, }, + { -184219200, 16023449, 8928700, }, + { 46308336, -9028021, -7953743, }, + { -69313792, 40265, 445603, }, + { 25310780, -430034, 4767951, }, + { 12801150, 2143189, -12394202, }, + { -22710176, 4475356, 5142687, }, + { -21137144, 7526394, -1753420, }, + { 20363514, 2947958, 3504693, }, + { 10953777, -259309, -2443300, }, + { -43550432, -8719320, 2104534, }, + { 27887760, -11151346, -7304129, }, + { -48897128, 11552388, 5156108, } + }, + { + { 393587584, -16003585, -1691143, }, + { -407478592, 13923747, 8107825, }, + { 150810256, -17078400, -2028298, }, + { 246486560, 4512400, -10222022, }, + { -178807536, 2159295, 9586367, }, + { 6522445, -5173288, -2015413, }, + { -84209816, 1737314, 2623688, }, + { 61722976, 1511292, -2246268, }, + { -34659848, -12631499, 715649, }, + { -21009906, 8139500, 2964601, }, + { -33974264, 1009854, 2833605, }, + { 64991980, -3661997, -1915555, }, + { -3665755, 1257889, -104153, }, + { -37127844, -5294084, -829466, }, + { 37775312, -15984795, -6041409, }, + { -32945620, 7146826, 3170223, } + }, + { + { 389030080, -645856, 3390877, }, + { -422571104, -10395968, 1673427, }, + { 215616480, 13672492, -2324651, }, + { 210861424, 412854, -4902705, }, + { -159334160, -3248606, 3352222, }, + { -43313136, -6364605, 6125160, }, + { -83583288, -2106145, 1627793, }, + { 81618872, 6060736, -3098819, }, + { -65605088, -4659503, 7262790, }, + { -17300128, -3033321, -1637993, }, + { -46225124, -6788733, 1626182, }, + { 92247304, 4304631, -3346317, }, + { -26742076, -5826660, 1142461, }, + { -24902758, 7871065, 2764348, }, + { 40583684, 10146860, 3660923, }, + { -22914724, -646393, -1450088, } + }, + { + { 381346400, 8778376, 318901, }, + { -423162720, -911607, -1009317, }, + { 256772480, -5362267, -3470871, }, + { 181759264, -3532611, 468688, }, + { -143814832, 2244657, -301185, }, + { -86775520, 16913582, 5376762, }, + { -60142428, -4284767, -837519, }, + { 86478096, -3433290, 421444, }, + { -85866056, 12759811, 3310883, }, + { -9114457, -6254010, -1319629, }, + { -54241680, 2934537, -525597, }, + { 90273232, 1603633, -2403571, }, + { -48776332, 4350265, 1156957, }, + { -10286447, 5401458, 1887638, }, + { 36567888, 9317932, 4653060, }, + { -18476412, -3271691, -350577, } + }, + { + { 368989216, -5534602, -2714419, }, + { -410308960, 8353175, 446677, }, + { 249583776, -1581622, -1770063, }, + { 160193696, -6912750, 1336272, }, + { -132391296, 3189013, -680215, }, + { -98816464, -7694434, -409633, }, + { -12958453, 11945378, -2587181, }, + { 82759184, -5604933, 719407, }, + { -97562864, -6251325, -1469953, }, + { 4041564, 5899138, 1145146, }, + { -55416352, 1132261, -874026, }, + { 55714316, -4063039, 931471, }, + { -58292368, 212064, 1797981, }, + { 9628780, -887448, -3663070, }, + { 33955476, -9705552, -1395328, }, + { -17141752, -2013803, 310848, } + }, + { + { 354289152, 1707786, -2571075, }, + { -388501792, -8374113, 2523830, }, + { 184855392, 18489298, 1823214, }, + { 135551856, 5879274, -466541, }, + { -114764744, -6063420, 659814, }, + { -60275572, -12415677, -4552129, }, + { 46445776, -17685602, -2125472, }, + { 81105088, 2907693, -1739999, }, + { -98579160, -4654134, -1602560, }, + { 20057498, -1689533, 1277216, }, + { -51474648, -2972117, -359704, }, + { -5354214, 17738752, 3388729, }, + { -46520940, -505196, 658741, }, + { 37961068, -15249281, -3142842, }, + { 44451836, -3827890, -4762045, }, + { -13396540, -1116692, -637803, } + }, + { + { 340785792, -648540, -1286880, }, + { -367042528, 4130148, 3242164, }, + { 77211704, -35029752, 872952, }, + { 100708928, -5694590, 889595, }, + { -83269752, 6628745, 448824, }, + { 25592100, 34553012, -2397129, }, + { 94690608, 10888816, -446677, }, + { 89442160, 3150359, -2889976, }, + { -88895624, 9186398, 1739999, }, + { 36222680, -879931, -1087701, }, + { -48532592, 2396592, 495532, }, + { -74482784, -21537114, 996969, }, + { -9998684, 8573292, -2022393, }, + { 66636956, 12024298, 1883880, }, + { 71037688, 16143708, -2165201, }, + { -2926483, 5681705, 247497, } + }, + { + { 329444928, 1310502, -534723, }, + { -353794720, 2165201, 1990717, }, + { -35852776, 28246390, -2888366, }, + { 55373404, 13240310, 1661079, }, + { -37164352, -11212549, -545461, }, + { 127722128, -30776126, 3580392, }, + { 106435192, 4369593, -664646, }, + { 105386152, -7526394, -2194192, }, + { -73596952, -3322694, 3643743, }, + { 49728204, -2808372, -2727841, }, + { -53045532, -820339, 2132988, }, + { -122394760, 6372121, -637803, }, + { 44829796, -17051558, -1961190, }, + { 82841328, 1896228, 2768643, }, + { 103471664, -14290430, 3080565, }, + { 13754096, -4429722, 1447941, } + }, + { + { 318065408, -2289755, -362388, }, + { -349757984, -4101157, -578210, }, + { -113754360, -4496294, -1942399, }, + { 8507793, -14286135, -691490, }, + { 16632261, 13100724, -366146, }, + { 202864720, 2484639, 2860448, }, + { 68579888, -16773458, -2518998, }, + { 115998480, 4524748, -450972, }, + { -57802208, -2226941, 1721745, }, + { 55953760, 4285304, -1493038, }, + { -64990908, -3839164, 3566434, }, + { -125006096, 11333882, 2152852, }, + { 97701920, 11058467, -1133871, }, + { 83138216, -8892193, -703838, }, + { 125751272, -3743064, 3295314, }, + { 33724084, -200790, -140123, } + }, + { + { 303769600, 3554622, -392453, }, + { -350124128, -987306, -1495722, }, + { -137944144, -8970576, 2792266, }, + { -26552024, 2578054, -1378685, }, + { 65428460, -7725573, -780073, }, + { 224844752, 13725105, -4529043, }, + { -12483322, 17953500, -1854889, }, + { 103481872, 7759932, -520228, }, + { -43051680, 3295314, -2524367, }, + { 48843440, 154619, 881542, }, + { -73293616, 6476274, 2489471, }, + { -76880992, -14780593, 3942780, }, + { 123941480, -2439542, -1432372, }, + { 75282184, 4989142, -3872987, }, + { 130074160, 13528610, -3344169, }, + { 54148264, -2907693, -2643552, } + }, + { + { 285796256, -3981972, -291521, }, + { -350552544, 5566278, 934155, }, + { -118486872, 7196218, 3931506, }, + { -41846404, 7055021, 2590939, }, + { 97731440, 5333276, -1343788, }, + { 194669936, -10606959, -7839926, }, + { -113775832, -16637630, 2842195, }, + { 56706992, -15079093, -1974611, }, + { -29278256, 8361765, -3295851, }, + { 26415122, -8336532, 1655173, }, + { -59804736, -1544578, -1472637, }, + { 8213588, 12548284, -590021, }, + { 108378128, -5355288, -51540, }, + { 70177080, 6913287, -2084133, }, + { 118951264, -5292474, -8668318, }, + { 71132176, 9405978, -1124745, } + }, + { + { 266198848, 4580583, -198105, }, + { -350230976, -1767379, 3656628, }, + { -80328776, -6408091, 1429150, }, + { -38255272, -1089848, 5014911, }, + { 107569064, -468151, -574989, }, + { 127891240, 5308043, -2437931, }, + { -204628880, 22431004, 4451197, }, + { -21296058, 14463839, 33823, }, + { -19694036, -12688944, 2639258, }, + { -4931696, 13265006, -676457, }, + { -12508555, -14493367, -4561256, }, + { 104526616, -20976620, -5231270, }, + { 52614960, 17870822, 1361505, }, + { 70737040, -3554622, 1427003, }, + { 93311384, -9984188, -3721589, }, + { 78050296, -3340948, 2378338, } + }, + { + { 248731760, -3841312, -413391, }, + { -347933152, -4990215, 2474975, }, + { -48056924, 5582384, 192737, }, + { -17847736, -1597191, 1737314, }, + { 95645160, -7235410, -721018, }, + { 41769632, -15646566, 4005057, }, + { -254933696, -15661061, -967978, }, + { -116530512, -22162568, 2592013, }, + { -19997904, -4423280, 6172405, }, + { -32169842, -5239323, -2809446, }, + { 61610232, 30427696, -1196685, }, + { 179832432, 24736864, -1607928, }, + { -22802518, -23575612, -494995, }, + { 71613208, -3980898, 626528, }, + { 43881144, -3936338, 5649493, }, + { 71671728, -8278550, 1923609, } + }, + { + { 236869056, 1332514, -442382, }, + { -337984384, 1898912, -1230508, }, + { -36775656, -474057, 851477, }, + { 20679730, -7783555, -1839320, }, + { 70426728, 8507793, -2003602, }, + { -44932336, 25403120, 3211025, }, + { -247928592, -11966853, -4479651, }, + { -206551424, 20236276, 1881733, }, + { -25847114, 15595563, 737661, }, + { -45509472, -4691715, -1045288, }, + { 135022496, -19324132, 4323422, }, + { 203965856, -22549, 3609920, }, + { -85994912, 11100880, -2160906, }, + { 66792648, 5742908, -2680060, }, + { -36132488, 30173756, 5865852, }, + { 59363428, 8577050, -1539209, } + }, + { + { 231336064, 232465, -187905, }, + { -314608512, 9227200, -2216740, }, + { -47083580, -6296422, 1185411, }, + { 75150656, 17259326, -1380832, }, + { 43449500, -4299263, -2225330, }, + { -109668768, -16653736, -1604170, }, + { -196255840, 30693446, 824097, }, + { -266336288, -7691213, 1482838, }, + { -19513648, -40802, -5159330, }, + { -46906948, 3625489, 1585380, }, + { 178553600, -5398237, 2368675, }, + { 168658528, -26050588, 896038, }, + { -113106352, 3360275, -834297, }, + { 52196200, 1465658, -2229625, }, + { -130574520, -31559420, -607201, }, + { 54207856, 810138, -3128347, } + }, + { + { 229698608, -639413, 103079, }, + { -280268096, -14671608, 709743, }, + { -66435628, 8568460, -228170, }, + { 134516768, -15690052, 752156, }, + { 22232362, -897111, -233539, }, + { -135112160, -6288369, -1469416, }, + { -139269680, -16405701, 7248294, }, + { -280978368, -4770635, 2736431, }, + { 12651363, -20282446, -2835215, }, + { -45940044, 1393180, 1640141, }, + { 184659968, 12319577, -4322885, }, + { 97737352, 26691612, -5443334, }, + { -101278552, -13482439, 2464238, }, + { 23606750, 4308389, 1158567, }, + { -205791216, 10285910, -2576981, }, + { 63715304, -10809896, -556198, } + }, + { + { 228049344, -766115, 147103, }, + { -246180544, 7079180, 2858301, }, + { -76775224, -832687, -1352915, }, + { 183658704, 7169911, 1001801, }, + { 6696391, -2782602, 1196148, }, + { -122947200, 12901545, 2642479, }, + { -114430280, -11481521, 4749160, }, + { -251979824, 10114111, 2804614, }, + { 64481956, 19887846, 2881386, }, + { -50970524, -4954782, -78383, }, + { 167591776, -1422708, -5360656, }, + { 30406220, -4449586, -4957466, }, + { -66963908, 7187628, 3494493, }, + { -20111722, -12416214, 1946157, }, + { -235634256, 7168301, 1110786, }, + { 83446384, 6468221, 2186138, } + }, + { + { 223257776, 2434173, -358630, }, + { -222571648, 1423782, 1270774, }, + { -66901096, -5757941, -1224603, }, + { 213205392, -363462, -601295, }, + { -7517804, 5701032, -143345, }, + { -91403880, -10115722, 4810364, }, + { -129454608, 18477486, -2522220, }, + { -192888048, -18012020, 2818572, }, + { 116327040, -5597953, 3251827, }, + { -64936684, 4624069, -1325534, }, + { 144151984, 967441, -1925756, }, + { -7003481, -5485210, 1249299, }, + { -32142998, -2110440, 637803, }, + { -70955008, 14260902, 665720, }, + { -216462592, -14950781, 4974646, }, + { 102517112, 1085016, 637266, } + }, + { + { 214601264, -2141578, -664646, }, + { -210639152, -2856690, -1705639, }, + { -39098696, 12422119, 195421, }, + { 224401296, -1705102, -2122251, }, + { -23874650, -3256122, -1199370, }, + { -59892244, 667331, 3594888, }, + { -164760848, -9598715, -5667210, }, + { -122378112, 14896557, 3575560, }, + { 153078544, -1903207, -1206886, }, + { -86211264, -2884071, -637803, }, + { 122694328, -2251637, -253940, }, + { -11296301, 5420249, 4977867, }, + { -11534135, 192200, -1800665, }, + { -114549464, -8192650, -90194, }, + { -162886096, 13973139, 6212134, }, + { 113876224, -239981, -1750736, } + }, + { + { 203155712, 2066953, -350577, }, + { -204104896, -4072703, -1747515, }, + { -6510634, -9341554, 2334315, }, + { 225802000, 472983, -2469606, }, + { -44047572, 288837, 622770, }, + { -37247568, 4226785, -686658, }, + { -195934800, -5150203, -1933272, }, + { -55822764, -6788196, 1361505, }, + { 173047984, -2663954, -3274913, }, + { -111873696, 4126927, 835371, }, + { 104021424, 2258079, 476205, }, + { 6830072, 1428077, 2796024, }, + { -11289322, 1420024, -2125472, }, + { -137739072, 110595, 669478, }, + { -94089312, -7212324, 3067144, }, + { 116191752, -2365453, -1021665, } + }, + { + { 190689024, -2371359, 25233, }, + { -197546480, 3785477, 316217, }, + { 16255377, -399969, 1974074, }, + { 225470752, 848256, -2200097, }, + { -67733784, -5657546, 2481417, }, + { -19403588, 2711198, -3480534, }, + { -212375392, 4522601, 3687230, }, + { 2371896, 7086696, -2202245, }, + { 181697520, 2357400, -2130841, }, + { -138478336, -6050535, 1375463, }, + { 84387520, -5470715, 548682, }, + { 35806068, 4025995, -1049583, }, + { -31158914, -4240207, -985695, }, + { -135325296, 6150930, 2264522, }, + { -20935818, 10323491, -1573032, }, + { 111204760, -1440425, 493921, } + }, + { + { 179225232, 2760053, -17717, }, + { -190236448, -1275605, 811749, }, + { 24045912, 6411850, -1258962, }, + { 225514768, -2793339, -1294396, }, + { -90458992, 10246718, 591095, }, + { 167504, -10723460, -1471026, }, + { -217126704, 2069101, 4703526, }, + { 54550916, -13069585, -2480881, }, + { 184158000, -1075352, -1227824, }, + { -161489696, 6567005, 497142, }, + { 61848064, 6723235, -358093, }, + { 67046588, -7152195, -1881733, }, + { -66924716, 8096014, 238371, }, + { -111702976, -5281736, 2227478, }, + { 53031036, -16231755, -3055332, }, + { 102903120, 5515812, -529355, } + }, + { + { 170537584, -1824824, -342524, }, + { -183614688, 394063, 205622, }, + { 22137336, -1753420, -3557307, }, + { 221629984, 302795, -28454, }, + { -103760504, -3090229, -2041720, }, + { 20645370, 6936909, 1555852, }, + { -213660128, -3447248, 2346663, }, + { 100076496, 9751723, -1311576, }, + { 182113600, -1058710, -1208496, }, + { -176058768, -1651952, -193810, }, + { 38847980, -4515621, -702227, }, + { 92197376, 7477001, -769873, }, + { -110912696, -10102300, 789737, }, + { -75545256, 8342974, 1235877, }, + { 122212760, 16909824, -2013266, }, + { 96241088, -2203855, -2356327, } + }, + { + { 165191424, 577673, -507343, }, + { -179486688, -921807, 26307, }, + { 18013092, -6145562, -1138703, }, + { 208220544, 3984119, 584116, }, + { -103398656, -5571110, -1526324, }, + { 36229660, 1289564, 903017, }, + { -200551888, 775242, -777926, }, + { 134781984, -8606041, -266288, }, + { 173686336, 821413, -890132, }, + { -180358560, -1727651, 304406, }, + { 18604724, 3582003, -486405, }, + { 104140072, -1828582, 615254, }, + { -152703264, 9380209, 613107, }, + { -36066452, -5236639, -74088, }, + { 176816832, -12213276, -252866, }, + { 92410520, -2876554, -1875290, } + }, + { + { 161907920, 635655, -172872, }, + { -178636272, 357556, 479963, }, + { 12662100, -326954, 1681480, }, + { 184686816, -8484171, 18254, }, + { -95561952, 7052873, 1110786, }, + { 44053480, -1843078, -1413581, }, + { -174144816, 10176388, -1409823, }, + { 154284352, 120796, -38118, }, + { 156079104, -4118874, -20401, }, + { -177165248, 3488587, 1398549, }, + { 1976759, -2449742, -335007, }, + { 99716792, -5302137, 265214, }, + { -181908512, -4544613, 263067, }, + { -349503, 7743826, -988916, }, + { 206934208, -265214, -577136, }, + { 85982024, 1734093, 284542, } + }, + { + { 158032784, 541166, 315143, }, + { -180236160, 1362042, 498753, }, + { 3595425, 5788006, 567473, }, + { 157179168, 7753490, -1189706, }, + { -92995704, 1237488, 2185602, }, + { 45439144, -1014686, -1642288, }, + { -136143488, -13908178, 1192390, }, + { 158649648, 1945620, -955630, }, + { 128903776, 7742753, -26844, }, + { -171800832, 121333, 1593433, }, + { -13741211, 3517578, -564788, }, + { 83028696, 7720741, -1414655, }, + { -192142336, -2512556, 985695, }, + { 26982596, -4926865, -543850, }, + { 209874112, 5954436, -2946348, }, + { 68932080, 5796595, 1089848, } + }, + { + { 151386864, -2404645, 253940, }, + { -181588528, -503585, 170188, }, + { -8827768, -4410932, -1240172, }, + { 134659040, -2888903, -1367410, }, + { -104213624, -6438693, 1145146, }, + { 42312944, 794569, -366683, }, + { -95989296, 7403987, 2324114, }, + { 153781312, -4433480, -2048163, }, + { 96725344, -7683697, -385473, }, + { -167803840, -656056, 716723, }, + { -32862406, -1418413, 206695, }, + { 63042604, -3702799, -2165201, }, + { -183988880, 5443334, 2400350, }, + { 42643656, 1428077, -680752, }, + { 191339712, -6039798, -4101694, }, + { 38693360, -9665287, 308701, } + }, + { + { 142047456, 3342022, -296890, }, + { -179505472, -1129576, 209380, }, + { -22232362, 354335, -740345, }, + { 122268056, -1197759, -267899, }, + { -127089696, 8201777, 76773, }, + { 35804996, 1121523, 504659, }, + { -62621160, -1944010, 459562, }, + { 147204096, -1213328, -2026688, }, + { 66827544, 5657546, -360777, }, + { -164881648, 201327, 209917, }, + { -58692340, 5550709, 1727651, }, + { 47042776, -1225139, -587874, }, + { -163863744, -2279554, 1731946, }, + { 47356848, -1014686, -275952, }, + { 159833984, 1132261, -1580011, }, + { 1237488, 9800042, -374736, } + }, + { + { 131995080, -2185602, -686121, }, + { -172193296, 2389613, 385473, }, + { -34882112, -1754494, 548682, }, + { 118775712, 1829656, 1057099, }, + { -151923200, -6539625, -869194, }, + { 26918170, -2971044, 383326, }, + { -38384660, 2454037, -1380295, }, + { 142515600, 503048, -854162, }, + { 45397804, -2553895, 5906, }, + { -161184224, 705985, -71941, }, + { -90267864, -9992241, 1291711, }, + { 35852776, -878858, 1010391, }, + { -138178768, 5908265, 526134, }, + { 44611288, -2708514, -45634, }, + { 120780920, -8893267, 904628, }, + { -33002528, -6796786, -682900, } + }, + { + { 123259656, 386547, -297427, }, + { -159658960, -3253975, 445603, }, + { -46336256, 4461934, -53687, }, + { 118589952, 2868501, 408022, }, + { -167935376, -1099512, -287226, }, + { 18038862, 1049046, 440771, }, + { -20253992, -5125507, -966368, }, + { 137852352, -726923, -92342, }, + { 34689912, 804770, 202937, }, + { -155091264, -3265249, 384400, }, + { -120252640, 8320963, -351114, }, + { 26051124, 3993783, 417149, }, + { -111731424, -5927055, 835908, }, + { 39908300, 2525441, -925029, }, + { 78502336, 11174968, 89121, }, + { -55575268, 1717987, -388695, } + }, + { + { 116317912, -416075, 415538, }, + { -143268832, 3914863, 501437, }, + { -56534656, -2570538, -1308354, }, + { 116717344, -2132988, -1386738, }, + { -170748576, 4256850, 1899986, }, + { 12721693, -376883, 1067836, }, + { -4331475, 3602941, 61203, }, + { 130119792, -2341294, 446677, }, + { 32933272, 1725503, 509491, }, + { -146960896, 2652679, 1264868, }, + { -139780240, -676994, -488016, }, + { 14691473, -3594888, -795643, }, + { -87946968, 4322885, 1036698, }, + { 38193532, -301721, -1729261, }, + { 39508868, -8189966, -799401, }, + { -65048352, 2486249, 899259, } + }, + { + { 110479440, 2017024, 375810, }, + { -125087704, -3195993, 301185, }, + { -66401268, -1813013, -260382, }, + { 110462800, -526670, -1109712, }, + { -163715024, -1055488, 2429341, }, + { 14014478, 1299228, 401579, }, + { 11800960, -1622424, -513785, }, + { 118221120, 5338645, -335007, }, + { 35818416, -648540, 755914, }, + { -138514304, 256087, 814970, }, + { -145208544, -4230006, 1448478, }, + { 764504, 854162, -260382, }, + { -67583992, -1777043, 284005, }, + { 40011380, -4359929, -912144, }, + { 9163850, 2971581, -146029, }, + { -67017060, -1034013, 2039036, } + }, + { + { 105450576, -1956358, -323733, }, + { -106948440, 3267396, -158377, }, + { -78411072, -905701, 2007897, }, + { 97738424, -1114544, 679679, }, + { -151885616, -370441, 593242, }, + { 23703924, 2260227, -975494, }, + { 29065118, 3977677, -1253594, }, + { 105585328, -3322694, -1251446, }, + { 39151312, -676457, 128312, }, + { -130260456, 290447, -506269, }, + { -140068016, 2144263, 2621541, }, + { -15606837, -2944737, 1053341, }, + { -49851148, 2172180, -1049046, }, + { 40941240, 2907156, 1347546, }, + { -10340671, -733366, 1454383, }, + { -68507952, -2381023, 1583232, } + }, + { + { 101561480, 300648, -568546, }, + { -89951112, -4433480, 75699, }, + { -93799400, 7416872, 1560684, }, + { 78182904, 6487011, 1120450, }, + { -137742816, -3635690, -416612, }, + { 40410812, -7388955, -376347, }, + { 45799920, -4907000, -733366, }, + { 96689912, 514859, -1169305, }, + { 41371808, -478352, -199716, }, + { -121325312, -3826816, -365072, }, + { -130160056, -69256, 1712618, }, + { -32813550, 5970005, 579284, }, + { -33693480, -6060199, -606127, }, + { 35114580, 5337571, 1307818, }, + { -20415590, 2937758, 1492501, }, + { -71973992, 2348810, 609885, } + }, + { + { 98599568, 495532, -88047, }, + { -75073344, 2914672, 547608, }, + { -108793136, -4763656, -343061, }, + { 55084568, -7936026, -375810, }, + { -122353952, 4451197, 281320, }, + { 58283780, 4212826, 855235, }, + { 58262840, 2534031, -28991, }, + { 92815320, 1783485, -290984, }, + { 42135240, -676457, -319975, }, + { -111458696, 2683818, 582505, }, + { -119100520, 385473, 188442, }, + { -46731928, -2570001, -293668, }, + { -20077898, 2864743, 571231, }, + { 22313966, -5775121, -535797, }, + { -23293218, -1050120, 282931, }, + { -75310104, -1711545, -76236, } + }, + { + { 95407864, 774168, 247497, }, + { -62201328, -2433099, 663036, }, + { -117396488, -2913599, 489089, }, + { 34339336, 1861868, -654446, }, + { -106500160, -2358474, 437013, }, + { 70891656, 2207613, -473520, }, + { 63357212, 2029372, -622770, }, + { 91015728, -407485, 495532, }, + { 41493680, -763430, -267899, }, + { -100730408, 11811, 16106, }, + { -107888504, -3798362, -7516, }, + { -53526568, -1596654, 488553, }, + { -10588168, 2075543, -592706, }, + { 7605314, 3099893, -1168768, }, + { -21086678, -2073396, 204548, }, + { -74581032, -2846490, 326418, } + }, + { + { 90771448, -2081449, -117575, }, + { -49592376, 1717987, 501437, }, + { -116706608, 5574331, 3620121, }, + { 20064476, 2241973, 1702955, }, + { -90603944, 127775, -1071594, }, + { 75449152, -3895535, -3524021, }, + { 60686276, -2705830, -1933809, }, + { 86734184, -1172526, 712428, }, + { 39661340, 1410897, 824634, }, + { -88941792, -665183, -2068564, }, + { -96333432, 5178657, 1554778, }, + { -52489868, 1941325, 1625108, }, + { -5063230, -2674154, -3305514, }, + { -4338454, 185220, -432718, }, + { -16717623, 2758443, 1214402, }, + { -67415952, 3813394, 1714766, } + }, + { + { 84129280, 1676648, -499290, }, + { -35509180, -853088, -664646, }, + { -106909256, -1200443, 4897874, }, + { 13125957, 48855, 3714610, }, + { -76045616, -1665911, -3042984, }, + { 71664752, -399432, -4633196, }, + { 52086680, -175557, -1498944, }, + { 77734080, 1599875, 1329292, }, + { 36881956, 878858, 1655710, }, + { -77481744, -3317325, -3355980, }, + { -83693880, -1409286, 2289218, }, + { -45268420, -208306, 1228361, }, + { -3515968, -1600412, -4469987, }, + { -11599633, -2076080, 1337346, }, + { -12450573, -971736, 2001992, }, + { -54461260, -667867, 1289564, } + }, + { + { 75215616, -398358, 100395, }, + { -19555522, 3034395, -2166811, }, + { -88683560, -1553704, 2289755, }, + { 13752485, -4630512, 2234457, }, + { -65350612, 8352638, -1596654, }, + { 59645284, 3656628, -1658931, }, + { 39149164, -894964, 359167, }, + { 64903936, -2723546, 2352568, }, + { 34983044, -2870112, 938987, }, + { -69646112, 9290014, -470836, }, + { -67845448, -2728378, -355945, }, + { -34161096, 1496796, -13422, }, + { -7281044, 4550518, -2243047, }, + { -14781130, -1541356, 2099165, }, + { -7865696, 2147, 2094333, }, + { -36711768, 1573569, -861678, } + }, +}; + const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -3673,6 +7289,560 @@ const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS const float FASTCONV_HOA2_latency_s = 0.000020833f; +const Word32 leftHRIRReal_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { 9749039, 528896224, 129120672, }, + { 41363756, -13267691, 139807088, }, + { 318364, 71011376, 4832, }, + { 4946192, 29243896, 2285460, }, + { 21379810, -23943906, -862215, }, + { 5953899, -15082851, 6302328, }, + { -30930744, 44672492, 2427730, }, + { 5499706, 15232638, -5888937, }, + { -57767848, 97858144, 28123982, }, + }, + { + { -81891064, -177112640, -130106368, }, + { -112628000, -683750720, -60143500, }, + { -6127308, 43266964, -7260642, }, + { -18372260, 7399692, 4738423, }, + { -6642167, 7949985, 20505784, }, + { 1736777, 44741748, 36746668, }, + { 1779190, -17669496, -35038880, }, + { 1783485, 40972376, 4261145, }, + { -8154533, -118214144, -70245800, }, + }, + { + { -12397960, -300077568, -81048184, }, + { -145049632, -316735584, -192968592, }, + { -1750199, 52096344, -8036958, }, + { -31417148, 57874148, -7852811, }, + { -45173928, 93462784, -3615289, }, + { -19227494, 151273584, -3310346, }, + { 62551368, -165313824, 10894185, }, + { -7194607, 46335716, 6969122, }, + { 112488416, -297701888, -26124676, }, + }, + { + { 140419120, 163395056, 61220464, }, + { 134698768, 418562272, 37772088, }, + { 12770012, 47600584, -16543677, }, + { 1829119, 44066900, -22123914, }, + { -33349348, 25675314, -30729954, }, + { -13965623, 83586504, -35370128, }, + { 68233608, -88068304, 41433548, }, + { -11814381, 19326816, -3059091, }, + { 176067360, -24274618, 67555000, }, + }, + { + { 193003488, 110340392, 58983324, }, + { 400174976, 27615030, 115993112, }, + { 35544612, -41037340, 13286481, }, + { 77038832, -66177928, 4207994, }, + { 52810916, -74782896, -8038032, }, + { 35016868, -65575024, 16007343, }, + { -10479720, 87943752, -12978317, }, + { 4599910, -13000866, 7131793, }, + { 59668372, 167397968, 11380053, }, + }, + { + { 88669064, -136434464, -13708462, }, + { 418985344, -219153392, 13563507, }, + { 23226110, -44473848, 13935021, }, + { 115305912, -11606612, 14061723, }, + { 143302128, 39595840, 14180908, }, + { 59085864, -36939404, 20780126, }, + { -87146496, 9683541, -25189446, }, + { 25008520, -13014288, 2070174, }, + { -136447888, -56905632, -32251446, }, + }, + { + { -95292440, 37550900, -37873020, }, + { 206629808, 110094504, -59848220, }, + { -19184546, 36173288, -7810935, }, + { 67421856, 33315524, 4643397, }, + { 158025808, 25906168, 14119168, }, + { 48429516, 45377940, -8228084, }, + { -113663088, -53688164, 4163434, }, + { 42060616, -12084964, -2563022, }, + { -283383008, -24645060, -13195213, }, + }, + { + { -248765584, 30539902, -11682848, }, + { -81042808, 14250165, -36664524, }, + { -54503672, 436476, -13678397, }, + { -51027432, -48062296, -1750736, }, + { 72271416, -56135760, 543850, }, + { 31731756, 13630079, -15043123, }, + { -97211216, -3755949, 17327508, }, + { 44042744, -1282048, 987843, }, + { -314783520, 26202522, 8887361, }, + }, + { + { -318032128, -23928874, 15863999, }, + { -309716544, -19851338, 11929272, }, + { -64207612, -32423782, -834834, }, + { -181705568, 34351684, -7874823, }, + { -67236640, 50014356, -11543261, }, + { 24249922, -23637352, 232465, }, + { -61846456, 13557064, 2641405, }, + { 22053046, 4669167, 2681670, }, + { -235416288, -29829084, 11263552, }, + }, + { + { -321614656, -7707319, 17708688, }, + { -441777120, -23812372, 24769076, }, + { -63085552, 4299799, 10666551, }, + { -257657776, 10072235, -4187056, }, + { -182311168, -965831, -9856950, }, + { 15317464, -2199023, 7827578, }, + { -19076098, 8660265, -5299453, }, + { -16952772, -20622286, 530428, }, + { -101074536, 27609660, 8037495, }, + }, + { + { -299877312, 14833206, 4658429, }, + { -501736992, 30001958, 10576894, }, + { -77060304, 21843666, 5098126, }, + { -255281040, -25045028, 6628745, }, + { -224941392, -25129854, 4932233, }, + { -10722923, 24297704, 745714, }, + { 21924198, -14825690, -2221035, }, + { -55880744, 8342974, -3590593, }, + { 24230058, -11106785, 2217814, }, + }, + { + { -273169056, 1380832, -3224447, }, + { -518796608, -5689758, 501974, }, + { -107435384, -11543261, -1205275, }, + { -200896560, 11400454, 8522826, }, + { -205748256, 6176163, 10351408, }, + { -54589572, -4134980, -2393908, }, + { 52939232, 5274220, -91268, }, + { -76335528, 8250096, -39192, }, + { 108715824, 4263829, -4214437, }, + }, + { + { -241493120, -13797582, -1484985, }, + { -506164576, -10208600, 1411971, }, + { -135031088, 2689187, -19864, }, + { -132891120, -9751186, 4269735, }, + { -159797472, -4487704, 4820027, }, + { -104600168, 5526013, 3636227, }, + { 68510096, -2899103, -59056, }, + { -75732088, -3214783, 3774203, }, + { 153326032, -4451197, -6740415, }, + }, + { + { -201953664, 13988172, 2484102, }, + { -468066080, 11743514, 3473555, }, + { -135009072, 6645925, 2597918, }, + { -76960984, 1656247, 299037, }, + { -114370144, 4749160, 1355599, }, + { -142927920, -12561169, 4122095, }, + { 65720516, -3194919, 500901, }, + { -61929132, -2405182, 1045288, }, + { 170837152, 9755481, -3670587, }, + }, + { + { -157771872, -7571491, 2987150, }, + { -409905760, -14218489, 3198140, }, + { -89839440, -11615202, 2513093, }, + { -38160248, -4485557, -2508798, }, + { -80043160, -2543695, -238908, }, + { -144927232, 1413044, 105227, }, + { 47504484, 7495792, 11811, }, + { -43118788, -5166309, -1449552, }, + { 169407472, 267362, 73551, }, + }, + { + { -114906480, 5610838, 980863, }, + { -342850592, 13112535, 2252174, }, + { -257698, 17945448, -1500554, }, + { -6269579, 9542880, -1308891, }, + { -49730352, 6022081, -804770, }, + { -96365104, 14963666, -2623151, }, + { 26508002, -3325915, 172872, }, + { -27319214, 7948911, 848256, }, + { 152526096, -7221988, -119722, }, + }, + { + { -76454176, -6929930, -69256, }, + { -279726400, -11549704, 1301375, }, + { 114208552, -28898688, -3926137, }, + { 26892938, -5211406, -841277, }, + { -12193949, -7994545, -1019518, }, + { -7168301, -27730456, -2589865, }, + { 18780818, -313533, 1094143, }, + { -20258824, -345208, 3060164, }, + { 125984272, 8527658, -1406065, }, + }, + { + { -41962904, 7059316, 128849, }, + { -228333344, 8655970, 1010928, }, + { 219166272, 28090696, -1050656, }, + { 62499828, 7261179, -2414309, }, + { 36138928, 10872173, -2019708, }, + { 89954328, 27792196, 466541, }, + { 36580772, 5089000, 663036, }, + { -18362596, -4509179, 2020245, }, + { 97064112, -6015639, -1931662, }, + }, + { + { -8992588, -6510634, 267362, }, + { -190033520, -4474819, 350577, }, + { 278282752, -5998459, 1591285, }, + { 95040112, -10720775, -1452236, }, + { 88483840, -14305462, -1738388, }, + { 153659440, -6827925, 2048699, }, + { 83558592, -11030550, -993211, }, + { -8813273, 2103460, -952409, }, + { 71897216, 1779190, -978179, }, + }, + { + { 24793772, 6630893, -18254, }, + { -160462656, 4852776, -434865, }, + { 274668512, -17280800, -1229971, }, + { 113483776, 2928631, 500901, }, + { 129502928, 8119099, -592169, }, + { 157575904, -15821586, -1637993, }, + { 150618064, 16231755, -2345052, }, + { 22151294, 10189273, -2437931, }, + { 53149148, 1124208, 1559073, }, + }, + { + { 59917480, -7263864, -350040, }, + { -132440688, -8647917, 547608, }, + { 222252208, 20497194, -5111011, }, + { 109086800, 9399536, -1176284, }, + { 144204064, 1976759, -942208, }, + { 105299712, 19787452, -5240397, }, + { 215895664, -14326937, -2713883, }, + { 77865072, -19022410, -732829, }, + { 40236328, 4224101, 2659659, }, + }, + { + { 94547264, 7210713, -514322, }, + { -99481104, 9044127, 2510945, }, + { 154022352, -10442139, -4019553, }, + { 82563768, -8490077, -3492345, }, + { 128416840, -6362457, -1036161, }, + { 22603340, -12644921, -2655901, }, + { 252400736, 6924561, -1945620, }, + { 145012592, 13919989, -82678, }, + { 31737660, -10970420, -1664837, }, + }, + { + { 125645512, -7259569, -85899, }, + { -56863756, -4744328, 1486596, }, + { 99314136, 4427575, -335007, }, + { 41075992, 3167539, -968515, }, + { 89500672, 12156905, -797253, }, + { -60453812, 10972568, 2783139, }, + { 242034288, 3270618, 1074816, }, + { 200968496, -7325604, -2245731, }, + { 27202176, -1326071, -5287642, }, + }, + { + { 150700208, 4634807, 561030, }, + { -1191853, 8886824, -2146410, }, + { 70675296, -2062658, 1005022, }, + { -8423505, -8847096, 2709588, }, + { 41706816, -12612171, -1906429, }, + { -119930520, -13067438, 3780645, }, + { 186179856, -22568980, 1925219, }, + { 224940864, 2801929, -3001645, }, + { 21487184, 13031468, 194347, }, + }, + { + { 169636176, -1192927, 61203, }, + { 66094176, -19737522, -2557653, }, + { 63994476, -1108102, 530428, }, + { -57278220, 13596256, 2472291, }, + { -166430, 4035659, -1475321, }, + { -140860976, 5550172, 35970, }, + { 109537232, 28074054, -2848100, }, + { 204103296, 8996883, -2008434, }, + { 1818919, 4411469, 6263673, }, + }, + { + { 185916256, 1898376, -1018981, }, + { 133667976, 19608674, 745714, }, + { 64880312, 1573569, 387621, }, + { -92978528, -8923868, 155156, }, + { -29435022, -97174, 1298154, }, + { -120988152, 12420509, -1513976, }, + { 49056580, -7981660, -5492190, }, + { 139661056, -18445274, -1324997, }, + { -36724656, -22808960, 2743947, }, + }, + { + { 203936864, -5097053, -1052804, }, + { 185728880, -7454453, 2333778, }, + { 58489400, 863825, 1222455, }, + { -104674256, -2811593, -115964, }, + { -48657148, 3922916, 2414309, }, + { -75116832, -19784230, 1840930, }, + { 26552024, -8952859, -2214593, }, + { 48134772, 21822728, -685047, }, + { -79321064, 15090904, -3412889, }, + }, + { + { 225228624, 6438156, -157303, }, + { 214688240, -3755412, -329102, }, + { 38261716, -7221451, 1816234, }, + { -90862184, 8681203, 1593433, }, + { -62400508, -5262409, 942745, }, + { -28787556, 9220758, 4382478, }, + { 34985728, 13614509, 2888903, }, + { -46410880, -20306068, -564251, }, + { -104572792, 3867618, -2895345, }, + }, + { + { 247859344, -4959614, 399432, }, + { 227028208, 1579474, -3234110, }, + { 9644886, 10700911, 573378, }, + { -60634200, -7675107, 1981591, }, + { -72839960, 2655364, -490163, }, + { -729608, 4192962, 1942936, }, + { 48766132, -369367, 4420595, }, + { -121884192, 11087995, -140660, }, + { -103912440, -11213086, 2019172, }, + }, + { + { 268726976, 2394444, -181999, }, + { 235657344, 4387846, -2889439, }, + { -13455596, -6493991, -1464047, }, + { -25911538, 8749385, 2221035, }, + { -79648024, 3604551, 1035087, }, + { 8626979, -6051072, -2256469, }, + { 45754824, -10596758, 946503, }, + { -166654400, -1146756, 1919850, }, + { -84939960, 6331319, 4582730, }, + }, + { + { 286211264, -2729452, -953483, }, + { 248872416, -8239358, -294742, }, + { -18828062, -4189741, -1525787, }, + { 4614406, -1637456, 1565516, }, + { -82404856, 1227824, 2612951, }, + { 11445014, 180926, -4145717, }, + { 21737904, 12543452, -3052111, }, + { -182342832, -2155000, 4099010, }, + { -60702920, 1326608, 2131378, }, + }, + { + { 300383040, 3500935, -717796, }, + { 266191872, 3493956, 970663, }, + { -5042829, 10755135, 1197222, }, + { 30651570, 2687576, -321586, }, + { -79362408, -2752537, 858457, }, + { 18897856, 9425306, -1945083, }, + { -14038101, -5513665, -3498788, }, + { -178168672, -1279363, 3287261, }, + { -37468756, 3229816, -508954, }, + }, + { + { 311666464, -2198487, -265214, }, + { 283031360, -1918777, 70330, }, + { 18464064, -6590091, 3395172, }, + { 58261768, -4366908, -1492501, }, + { -66921496, -2005750, -1306744, }, + { 31464394, -7336341, 1821066, }, + { -51994876, 2715493, -710817, }, + { -161833296, -2287607, 964220, }, + { -14486388, -4322885, -715649, }, + }, + { + { 320947872, 1425929, -280247, }, + { 296547616, 1778653, -544387, }, + { 40380208, -2829847, 1201517, }, + { 91574608, 9750650, -1528472, }, + { -45061724, 9525701, -755377, }, + { 41256384, -2624225, 1612223, }, + { -89262840, -4065724, 2160369, }, + { -137527536, 5949067, 293668, }, + { 10603201, 5882495, -712428, }, + }, + { + { 329596320, -1290101, -507343, }, + { 306918912, -2180233, -387621, }, + { 56913684, -266288, -2163590, }, + { 127935800, -9903658, -440771, }, + { -20552492, -7883413, 1342714, }, + { 43283608, 3977677, -1141388, }, + { -126284920, 9459129, 2925410, }, + { -109121696, -6815576, 498753, }, + { 38045356, -5915244, -879931, }, + }, + { + { 338755872, 1985349, -662499, }, + { 316944416, 1728188, -217970, }, + { 70156144, 6400038, -1461900, }, + { 158782800, 7256347, 613643, }, + { -2733747, 1930588, 1903207, }, + { 38901128, 146029, -1503239, }, + { -160943168, -12184822, 650151, }, + { -80698680, 6174553, 687195, }, + { 63547800, 6309844, -729608, }, + }, + { + { 348667584, -2622078, -528281, }, + { 330204608, -2903398, -394600, }, + { 80498424, -3464428, 624918, }, + { 176407184, -212064, 684510, }, + { 4530117, 2791192, 780610, }, + { 31255550, -34360, 15569, }, + { -186284000, 3796214, -1058710, }, + { -56010132, -4271882, 649077, }, + { 80058728, -2265595, -424128, }, + }, + { + { 358330208, 2345589, -273267, }, + { 348918848, 4343823, -594853, }, + { 86404544, -1669669, 192200, }, + { 179864640, -3940633, -735513, }, + { 5645735, -2221572, -545461, }, + { 22848690, -2136746, 548682, }, + { -196971488, 3864397, 570157, }, + { -36806796, 2615098, 387621, }, + { 82155208, -1394791, -471373, }, + }, + { + { 366297888, -1524177, -97711, }, + { 372433248, -5732171, -681826, }, + { 87542704, 938987, -1042066, }, + { 175921328, 2347200, -1906429, }, + { 9195525, -777926, -1210107, }, + { 15777025, 1827509, 136365, }, + { -195313632, -2768643, 2332167, }, + { -22068616, -1083942, -295816, }, + { 69850128, 4421669, -359704, }, + }, + { + { 371749280, 51003, -288300, }, + { 397624864, 6229850, -351650, }, + { 84823456, 1105954, -449361, }, + { 173494128, 2942590, -1049583, }, + { 21438330, 6756521, -438624, }, + { 11614665, -5369, 123480, }, + { -188027232, -225486, 1703491, }, + { -8943196, 3022583, -632434, }, + { 48287780, -6484864, -573915, }, + }, + { + { 375091296, 123480, -765041, }, + { 420282944, -3861713, -207769, }, + { 79324824, 1246077, 565862, }, + { 177637696, -3994320, 930934, }, + { 42110008, -7602629, 1375463, }, + { 11107859, -586800, 499290, }, + { -180578672, 130997, 265751, }, + { 4147328, -2578054, -663572, }, + { 25565792, 4443681, -760746, }, + }, + { + { 377552320, 1293322, -671089, }, + { 437537440, 1720134, -741956, }, + { 72594072, -5038534, -627602, }, + { 187999840, -449898, 470836, }, + { 65652872, 2403034, 1189706, }, + { 13804562, -1540283, -333397, }, + { -174902880, 2426657, 401579, }, + { 16455093, 4543002, -142808, }, + { 8400419, -1613297, -322659, }, + }, + { + { 379801824, -1159104, -98784, }, + { 449000192, -762357, -1505923, }, + { 66756140, 1897302, -2478733, }, + { 202493216, -1679332, -1592359, }, + { 87476672, -1024350, -1014686, }, + { 18439368, -616328, -1715839, }, + { -170510208, -614717, 1108638, }, + { 25653302, -1463510, 585726, }, + { -814970, -1081258, 744103, }, + }, + { + { 381884864, 102005, 62277, }, + { 456018144, 2931852, -1144609, }, + { 61858268, 3501472, -1437203, }, + { 218079648, 5225365, -1717987, }, + { 106423384, 4740570, -1769527, }, + { 22399866, 3916473, -964757, }, + { -165222560, -275415, 569620, }, + { 30270930, -994285, 135291, }, + { -3977677, -1443109, 878321, }, + }, + { + { 384165504, 471373, -382252, }, + { 459639360, -1001264, -163209, }, + { 53535156, 277025, 810675, }, + { 229669088, -4628364, -55298, }, + { 121935192, -5230734, -398358, }, + { 20921322, 307627, 477815, }, + { -155960992, -2059974, -151398, }, + { 32400696, 1212255, -745177, }, + { -3812857, 365609, 27380, }, + }, + { + { 387472608, 773094, -761820, }, + { 460596576, -1338956, -388158, }, + { 37011880, -8176544, 218506, }, + { 232414640, -2472828, 367757, }, + { 132566312, 363998, 61740, }, + { 10568841, -6884296, -514322, }, + { -141396224, 5043366, 133144, }, + { 35882304, 890132, -1221381, }, + { -1747515, 906775, -19864, }, + }, + { + { 392298016, -2099165, -467078, }, + { 460876832, 654983, -1044751, }, + { 12603045, 8705899, -2084670, }, + { 225417056, 5970542, -1477469, }, + { 137805104, 1513976, -1142461, }, + { -7254737, 6248641, -2473364, }, + { -123040072, -5198521, 973884, }, + { 43224012, -3112778, -925029, }, + { 770410, 405874, -242129, }, + }, + { + { 398138112, 1664837, -5906, }, + { 462098752, -161061, -1531693, }, + { -15297063, -1983201, -1540283, }, + { 212177296, -1755568, -2101313, }, + { 138299024, 763430, -1508607, }, + { -28484760, -306016, -1535451, }, + { -104152424, 1582159, 476741, }, + { 53592600, 3449396, -330712, }, + { 2964601, 1447941, -306016, }, + }, + { + { 404148384, -311922, -176094, }, + { 464220992, -1423782, -1687922, }, + { -42546484, -2144799, 3101503, }, + { 196518384, -3173444, 1027034, }, + { 134805600, -4870493, 1206886, }, + { -49714248, -2751464, 2964601, }, + { -87270512, -921807, -1372779, }, + { 64223720, -2987150, 277025, }, + { 4530654, -2358474, 919123, }, + }, + { + { 409720000, -462783, -1084479, }, + { 466352928, 2785286, -731755, }, + { -65998616, -1939178, 7927436, }, + { 181019984, 2525978, 6302328, }, + { 129010616, 4121021, 6409165, }, + { -67529768, -2459406, 6993818, }, + { -73590504, 3739306, -1999844, }, + { 73398304, 1053341, 575526, }, + { 5841693, 808528, 2232309, }, + }, +}; + const float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -4227,6 +8397,560 @@ const float leftHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_ } }; +const Word32 leftHRIRImag_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { -36158792, 332589920, -120427664, }, + { -74782896, 414234016, -138564768, }, + { -1993402, 15385110, -4536559, }, + { -12910672, 37127308, -11034308, }, + { -13785771, -13972065, 10325638, }, + { -5334350, -5939403, 4061429, }, + { 18512920, 23427972, -15831786, }, + { 3295314, -46312096, 20517058, }, + { 24953760, 133811320, -62957780, }, + }, + { + { 6790344, 394416512, -99059128, }, + { -59612536, 289198400, -180918512, }, + { -1410360, -11168526, -15667504, }, + { -16600585, 2608119, -22172232, }, + { -27442156, -41982232, 5173288, }, + { -8725226, -15491410, 4438849, }, + { 45414448, 82660944, -348966, }, + { -9163313, -111122616, -6783901, }, + { 88319024, 252158064, -29414620, }, + }, + { + { 119840864, -172064448, 92515208, }, + { 175912736, -498648928, 68749008, }, + { 10392747, -39891656, -8267812, }, + { 18903224, -44296144, -11482058, }, + { -1028108, 10605348, -22429930, }, + { 5090610, -2387465, -3582003, }, + { 21121038, 29187524, 28092308, }, + { -8322036, -78509320, -20295332, }, + { 75277352, 6205154, 71450536, }, + }, + { + { 84888952, -211159920, 71064528, }, + { 293597536, -167443600, 152749440, }, + { 16649441, 19593640, 12747463, }, + { 57636852, 42297376, 10699837, }, + { 63173064, 90405304, -7914014, }, + { 33967284, 71368936, 15578920, }, + { -59171228, -125028112, -14110578, }, + { 14133127, -4103305, 8483097, }, + { -83939768, -238660064, 3744138, }, + }, + { + { -84856208, 160208720, -34959960, }, + { 96670048, 340704192, -7391102, }, + { -6153078, 38164004, 9969156, }, + { 40164924, 26005490, 17468706, }, + { 94673424, -9172976, 21439402, }, + { 38052336, 47195784, 23022098, }, + { -105601432, -51099912, -31717796, }, + { 23212688, 3580392, 1049583, }, + { -236426672, 242666, -52827024, }, + }, + { + { -241306288, 23081692, -47294568, }, + { -241835648, -76635640, -87011208, }, + { -44483512, -43661564, -12531641, }, + { -49227304, -61918932, 1545115, }, + { 32010928, -61011620, 12165495, }, + { 1369558, -61596812, -11496017, }, + { -72386304, 68689408, 8167954, }, + { 21155936, -1467805, -432718, }, + { -245244240, 94062472, -9156333, }, + }, + { + { -279724256, -83891984, 187905, }, + { -487956064, -96942784, -27740120, }, + { -58395448, -28610388, -14624901, }, + { -154616144, 24776592, -8514773, }, + { -93974960, 58441620, -6685654, }, + { -32097364, -23796804, -18185966, }, + { -4830765, -6265821, 21151104, }, + { 2374043, -548145, 2821257, }, + { -121094456, -55359980, 19837918, }, + }, + { + { -199590352, 46742664, 28198070, }, + { -542467776, 70228080, 36100812, }, + { -38022272, 34528316, 4661114, }, + { -204685792, -340913, -7135015, }, + { -201704016, -17952964, -12763569, }, + { -43963284, 32239098, 4910222, }, + { 53434760, -29083372, 1289564, }, + { -29628296, -16311749, 2477659, }, + { 61041148, 25417616, 12723304, }, + }, + { + { -71485976, 3439732, 18509162, }, + { -449389952, 750546, 36375688, }, + { -10520522, -7513509, 13849659, }, + { -164350688, -39578124, -1079111, }, + { -224162400, -27566710, -6024766, }, + { -51943336, 8273181, 13044889, }, + { 88907968, -7683160, -11099806, }, + { -59125056, 6847252, -629750, }, + { 213081920, -12068321, 914291, }, + }, + { + { 40884868, -8075076, -3076807, }, + { -300000768, -8685498, 6082211, }, + { 957241, -27275726, 4496831, }, + { -53774600, 43806520, 8965744, }, + { -154083568, 52445308, 9099962, }, + { -69969312, -27617176, 1512902, }, + { 104226512, 15185931, -3274913, }, + { -69255272, -3904662, -2665027, }, + { 282055872, -6979859, -5660230, }, + }, + { + { 122261072, -14564234, -10473278, }, + { -150754960, -24950538, -8772471, }, + { 3320010, 4095788, -5724655, }, + { 66658428, -11882027, 7962333, }, + { -44114684, -12880607, 12540231, }, + { -90301152, 203474, -4349728, }, + { 99475200, 3833258, 1317481, }, + { -53058952, -18649822, -327491, }, + { 271441408, 13378286, -8655433, }, + }, + { + { 185318720, 23846196, -4557497, }, + { -15679852, 37565396, -4328254, }, + { 21893596, 13773960, -2983392, }, + { 150678720, 46171, -1040993, }, + { 48956720, -813896, 947577, }, + { -95590400, 9763534, 1977296, }, + { 79202416, -6300180, 253403, }, + { -18629420, 9327058, 4054449, }, + { 217019872, -10098542, -7290707, }, + }, + { + { 240183168, -16076599, 1266479, }, + { 105487080, -26186416, 283468, }, + { 70551816, -16828218, 678605, }, + { 189024736, -49392, -4967130, }, + { 105314744, -5423470, -4425964, }, + { -74048992, -757525, 2923262, }, + { 50586124, 7173133, 416612, }, + { 16224239, 1275605, 724239, }, + { 151719184, 2614025, -1576790, }, + }, + { + { 286097440, 4743792, 1162862, }, + { 210780352, 18678812, -364535, }, + { 145435648, 16265578, -83752, }, + { 195911168, -2299418, -5272073, }, + { 130978784, 1410360, -3964255, }, + { -19889456, 9549323, -2411087, }, + { 22510998, -8150774, -128312, }, + { 42030012, 3780645, -2588255, }, + { 89983856, -10215043, 2976949, }, + }, + { + { 319378048, -1308891, -1722282, }, + { 293717792, -12847321, -1720134, }, + { 224754560, -12506408, -3513820, }, + { 192708208, -6009196, -2883534, }, + { 143904496, -4290673, -3185792, }, + { 58067420, -21905944, -4212826, }, + { 7643431, 352724, -487479, }, + { 56253336, -7172059, -274341, }, + { 34664680, 15397458, 1792075, }, + }, + { + { 340915712, 3598109, -2687576, }, + { 349467520, 7507603, -2401961, }, + { 278644064, 11220065, -4716948, }, + { 190083440, 34897, -506806, }, + { 157392304, 4962298, -2032593, }, + { 131253128, 19497540, -2294050, }, + { 14569066, 4827007, 163746, }, + { 60362544, -1574642, 1777043, }, + { -10620380, -9889162, -326418, }, + }, + { + { 355079968, -3677566, -1744294, }, + { 381102656, -4260071, -2215130, }, + { 281619392, -1296006, -1116692, }, + { 185217248, 2087354, -1416802, }, + { 170087152, -3240553, -1831804, }, + { 165204304, -6737730, 682900, }, + { 41253696, -6271189, -472446, }, + { 62204012, 4499515, -101469, }, + { -42043436, 3895535, -408559, }, + }, + { + { 366027840, 2317672, -1134945, }, + { 397606592, 1345399, -2006824, }, + { 223802160, -20542828, 1700807, }, + { 171571600, -425202, -704912, }, + { 171730512, 1431298, -1205275, }, + { 138801536, -16011638, 1830193, }, + { 75993000, 6881612, -2061047, }, + { 72658496, 653909, -2717104, }, + { -58964532, 883153, 773631, }, + }, + { + { 375740384, -1729261, -1239098, }, + { 409371584, -2474438, -2047626, }, + { 121028960, 34863860, -778463, }, + { 143039056, 6924024, 1210644, }, + { 151491552, 5535676, 226560, }, + { 58364848, 31437014, -1287953, }, + { 100377680, -5044439, -2580739, }, + { 95764888, -8861591, -3254512, }, + { -64630132, -1622961, 2194728, }, + }, + { + { 383609824, 1746441, -1296006, }, + { 424501696, 6113886, -1065689, }, + { 11184632, -24941948, -3841848, }, + { 99827928, -15702937, 8590, }, + { 106059384, -15424838, -74088, }, + { -42509976, -23139674, -3684545, }, + { 95006288, -2285996, -1535988, }, + { 122857000, 11319923, -1122060, }, + { -64195804, -1420560, 2232309, }, + }, + { + { 387407136, -675384, -1110786, }, + { 446154208, -5822902, 92879, }, + { -67740760, 4913980, -1846299, }, + { 51632488, 11216307, -2097018, }, + { 45219028, 14675366, -887448, }, + { -123440048, 5479842, -469762, }, + { 48671644, 12622372, 137439, }, + { 134595152, 173409, 71404, }, + { -62093952, 6441377, -1045288, }, + }, + { + { 385254816, -637803, -812286, }, + { 473090112, 2037425, -1216550, }, + { -99903624, 4727149, 2258616, }, + { 11749957, 366146, 526134, }, + { -13227962, -10634339, -147103, }, + { -159256848, 3637301, 4543539, }, + { -32711544, -19771882, 2049236, }, + { 113054816, -12186970, -1802276, }, + { -60602524, 2531346, -3322157, }, + }, + { + { 377351520, 2255932, -482647, }, + { 501648416, -3520263, -4013647, }, + { -94568200, -5376226, 3605625, }, + { -11883638, 1945620, 3943854, }, + { -54005992, 6682969, 72478, }, + { -146007408, -3005403, 4282620, }, + { -125467272, 25107306, 1941325, }, + { 54234700, 12469901, -1246077, }, + { -62698468, -10954851, 1609002, }, + }, + { + { 366280192, -4061965, -805843, }, + { 525283616, 9440875, -3562675, }, + { -73869144, 2709588, 2083059, }, + { -15278272, -3664681, 2474438, }, + { -69738456, 3156801, 746787, }, + { -94421632, 8872329, -543850, }, + { -197179808, -18215494, -1489817, }, + { -32488206, -20340428, 1323387, }, + { -73730096, -3738769, 6418292, }, + }, + { + { 356168224, 2472828, -1493038, }, + { 533570240, -4927401, 20401, }, + { -58116276, -1755568, 771484, }, + { 5287105, -4551055, -365609, }, + { -63846300, -6586333, 2798171, }, + { -23891292, -20171314, -2127083, }, + { -223493984, -3424163, -3262028, }, + { -127029024, 21662742, 1534377, }, + { -90670520, 17609366, 2166811, }, + }, + { + { 349922272, 618475, -1319092, }, + { 518373568, -8857833, 1140851, }, + { -56720948, -883690, 1331977, }, + { 48408040, 13831405, -606664, }, + { -47076064, 2146947, 2979097, }, + { 40385040, 19214610, 1528472, }, + { -205683296, 20291572, 840740, }, + { -203235712, -13549011, 1227824, }, + { -96553552, -4800163, -4361540, }, + }, + { + { 346649504, -1439888, -318364, }, + { 483399104, 15989626, -1763621, }, + { -66776004, 6590091, 978179, }, + { 103736880, -14713484, 507343, }, + { -28132036, 848256, 367220, }, + { 75919456, 1214402, 2411087, }, + { -171571056, -12617003, 5709622, }, + { -240693728, 845035, 2171106, }, + { -76186280, -17254494, -3004330, }, + }, + { + { 342597184, -1294933, 166430, }, + { 443682464, -9204115, -4066260, }, + { -75551160, -3277060, -437550, }, + { 156191856, 10443750, 1022202, }, + { -9059697, 4929549, -889058, }, + { 78208672, -9521942, -970126, }, + { -153513408, -5825587, 4600984, }, + { -233576432, 5917928, 2312303, }, + { -33381560, 19739132, 3035468, }, + }, + { + { 334624672, 3918621, -566936, }, + { 413670304, -577136, -2447595, }, + { -70139504, -1757715, -1557999, }, + { 193998848, -3168612, 186831, }, + { 10993506, -6357089, 403727, }, + { 61479236, 9741523, -4020090, }, + { -164081168, 14096083, -239444, }, + { -189978208, -16337519, 2595771, }, + { 13108777, -5794448, 4198331, }, + }, + { + { 322606816, -3232500, -1260573, }, + { 396880736, 2692408, 843424, }, + { -46797428, 11288785, -991601, }, + { 214848752, 153545, -1243930, }, + { 32719598, 4962835, 1389959, }, + { 44736380, 1035087, -4147328, }, + { -192954096, -10519986, -3456375, }, + { -127260952, 14543833, 3575024, }, + { 47788492, -2278480, -68719, }, + }, + { + { 308399040, 1808181, -802085, }, + { 386778464, 3155727, 1571958, }, + { -13718662, -11858405, 1543504, }, + { 224974688, 794569, -2326799, }, + { 56534116, -457414, -206695, }, + { 37853156, -7458211, -425739, }, + { -221009888, -892279, -2015950, }, + { -63788316, -7458748, 1576790, }, + { 68279776, -1187559, -2947421, }, + }, + { + { 293636704, -2662343, -128312, }, + { 375935808, -5361193, -153008, }, + { 14427869, 3656628, 2450816, }, + { 232371696, 2226941, -2764348, }, + { 82602960, 5332202, -2313377, }, + { 36209260, 2982318, 2959233, }, + { -236805168, 4200478, 2068027, }, + { -9079561, 6485938, -1704028, }, + { 79947592, 3765076, -2320893, }, + }, + { + { 279406944, 3427384, -205085, }, + { 362203712, 3554086, -1072668, }, + { 28135258, 5444945, -106300, }, + { 240036064, -4869419, -1695975, }, + { 108520400, -9707163, -1090922, }, + { 30004104, 7593502, 1940788, }, + { -240686752, -710817, 3923990, }, + { 35410396, -11063299, -1749125, }, + { 87226488, -2617246, -1141924, }, + }, + { + { 266644992, -2608656, -476205, }, + { 347585248, -2545305, -769873, }, + { 28486370, -4051228, -3284576, }, + { 243368416, 2174864, -173946, }, + { 127333968, 4950487, 1104880, }, + { 16089484, -7972533, -1418950, }, + { -236118512, -1354525, 3016678, }, + { 69019048, 5398774, -811212, }, + { 90053120, 663572, -781684, }, + }, + { + { 255541424, 1991791, -520765, }, + { 335333856, 1934346, -435939, }, + { 22628572, -4581657, -1842541, }, + { 235510240, 2966749, 518080, }, + { 133714680, 2567317, 1082332, }, + { -433255, 551903, -1525250, }, + { -223574528, 2010582, 192737, }, + { 91384560, -5077188, -465467, }, + { 84883048, 1163399, -483721, }, + }, + { + { 245329600, -1373853, -308164, }, + { 327304960, -1559610, -599685, }, + { 13842680, -357556, 1105954, }, + { 214584080, -8028905, 86436, }, + { 130002752, -5317707, -677531, }, + { -14326937, 83752, 653909, }, + { -200260368, 7125888, -1465658, }, + { 103070624, -522375, -449898, }, + { 68426880, -4463008, 12348, }, + }, + { + { 234616880, 2107218, -43487, }, + { 322709344, 124554, -736587, }, + { 1589138, 5553930, 565862, }, + { 186385472, 9103183, -1245004, }, + { 125093072, 1516660, -1810866, }, + { -23804320, 2353642, 1084479, }, + { -166164768, -13082470, 473520, }, + { 106302048, -217433, -797790, }, + { 41465760, 7704098, -18254, }, + }, + { + { 222323072, -2915746, -19864, }, + { 318206080, -789200, -656056, }, + { -13198435, -4537096, -923955, }, + { 161084352, -4031901, -1812476, }, + { 127196528, 2785823, -1559073, }, + { -28687698, -1585380, 195958, }, + { -128549984, 8349954, 2117956, }, + { 105128448, -2126546, -1066763, }, + { 10321343, -6656126, -12885, }, + }, + { + { 208615696, 3557844, -220654, }, + { 309694528, 1555852, -404264, }, + { -28428388, 894427, -419296, }, + { 145905952, -1242856, -609885, }, + { 137842144, -5847598, -500901, }, + { -29700236, -334471, -172336, }, + { -96008088, -2522757, 846645, }, + { 103137200, -988379, -1157494, }, + { -16428787, 5519570, 15569, }, + }, + { + { 194701072, -3233574, -540629, }, + { 294416256, -4551055, -296890, }, + { -42549168, -2559801, 639950, }, + { 140792256, 2094333, 1074816, }, + { 151768576, 4850629, 831613, }, + { -28312962, 867583, 33286, }, + { -71958416, 2250026, -940061, }, + { 101641472, 158377, -641024, }, + { -32029182, -1188095, -28454, }, + }, + { + { 182000320, 1571421, -382252, }, + { 272313280, 6266358, -755914, }, + { -54702852, 4699768, -196495, }, + { 140131904, 2928631, 517544, }, + { 161241664, 1787243, 353798, }, + { -26629334, 1044751, -400506, }, + { -54589572, -4306242, -817118, }, + { 99131064, -478352, -254477, }, + { -34484292, -2201171, 446140, }, + }, + { + { 170964928, -1386738, 183610, }, + { 245976000, -6084895, -1145683, }, + { -64347736, -2036351, -1435056, }, + { 138324256, -2430415, -1476395, }, + { 162479680, -3643206, -1773822, }, + { -26885958, -612033, -1231582, }, + { -40347996, 3263638, 82678, }, + { 94091456, -1321776, 241592, }, + { -27213450, 3658775, 1133871, }, + }, + { + { 161127840, 2494839, 230318, }, + { 218601488, 4053912, -659814, }, + { -72627896, -2632815, -189515, }, + { 132085816, -731218, -1257352, }, + { 157013264, 20401, -2114198, }, + { -31015032, -1607392, -375810, }, + { -26279832, -1437203, -290984, }, + { 86541440, 3720516, -263067, }, + { -16163573, -1236951, 1034550, }, + }, + { + { 152307600, -2508261, -267899, }, + { 192162736, -4103841, 425202, }, + { -82927768, -598074, 2172180, }, + { 118860000, -1208496, 657667, }, + { 147158464, 732829, -167504, }, + { -40805412, -1704565, 1273458, }, + { -10628433, 3490735, -980863, }, + { 79426832, -1911261, -1018981, }, + { -5949067, -68183, -201327, }, + }, + { + { 144696368, 1319092, -537408, }, + { 167141872, 6891812, 175557, }, + { -97344896, 7576323, 1618129, }, + { 98060008, 6953015, 1093069, }, + { 133613752, 4267050, 679679, }, + { -55868396, 7104413, 654446, }, + { 5866926, -4824859, -618475, }, + { 75897976, -449898, -956167, }, + { 2306934, -2581275, -422517, }, + }, + { + { 138049920, -252866, -158377, }, + { 144453168, -4816269, -712428, }, + { -112335944, -5070746, -423591, }, + { 73207184, -8397735, -449361, }, + { 117530168, -5335960, -373125, }, + { -71457520, -3936338, -759672, }, + { 20044612, 3259343, 43487, }, + { 76154064, 2106682, -241592, }, + { 8460549, 700080, -55835, }, + }, + { + { 131315400, 1210644, 288300, }, + { 124574992, 3322157, -743566, }, + { -121577640, -2782602, 380105, }, + { 50560892, 2275796, -740345, }, + { 101227008, 2015950, -554588, }, + { -81823424, -2728915, 527207, }, + { 28654412, 806917, -407485, }, + { 77313704, -1054951, 514859, }, + { 12657805, -1239098, -40802, }, + }, + { + { 123408904, -2617783, 91268, }, + { 106087304, -2538326, -300648, }, + { -121654952, 5787469, 3679713, }, + { 34478388, 2088965, 1676111, }, + { 86537688, 592706, 1213865, }, + { -84390736, 4424353, 3697967, }, + { 30545270, -1830730, -1678795, }, + { 75919992, -574989, 882616, }, + { 15829639, 1928977, 729071, }, + }, + { + { 113971256, 2760590, -429497, }, + { 87232400, 2210298, 769336, }, + { -112382112, -1367410, 5208722, }, + { 25873420, 69256, 3870839, }, + { 75094280, 1138703, 3105261, }, + { -78730512, 127238, 4860829, }, + { 26732414, -753230, -1465121, }, + { 70934608, 1698660, 1145146, }, + { 18898392, -81604, 1235340, }, + }, + { + { 102863928, -1541356, -380105, }, + { 67243080, -4695473, 1672890, }, + { -94158568, -1594507, 2707977, }, + { 24968256, -4831838, 2573759, }, + { 68827928, -7074885, 1530082, }, + { -64571076, -3093450, 1923609, }, + { 18269718, -35970, 229244, }, + { 63774896, -2209761, 1298691, }, + { 23650238, -587337, 591632, }, + }, +}; + const float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -4781,6 +9505,560 @@ const float leftHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_ } }; +const Word32 rightHRIRReal_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { 9749039, 528896224, 129120672, }, + { -41363756, 13267691, -139807088, }, + { 318364, 71011376, 4832, }, + { 4946192, 29243896, 2285460, }, + { -21379810, 23943906, 862215, }, + { -5953899, 15082851, -6302328, }, + { -30930744, 44672492, 2427730, }, + { 5499706, 15232638, -5888937, }, + { -57767848, 97858144, 28123982, }, + }, + { + { -81891064, -177112640, -130106368, }, + { 112628000, 683750720, 60143500, }, + { -6127308, 43266964, -7260642, }, + { -18372260, 7399692, 4738423, }, + { 6642167, -7949985, -20505784, }, + { -1736777, -44741748, -36746668, }, + { 1779190, -17669496, -35038880, }, + { 1783485, 40972376, 4261145, }, + { -8154533, -118214144, -70245800, }, + }, + { + { -12397960, -300077568, -81048184, }, + { 145049632, 316735584, 192968592, }, + { -1750199, 52096344, -8036958, }, + { -31417148, 57874148, -7852811, }, + { 45173928, -93462784, 3615289, }, + { 19227494, -151273584, 3310346, }, + { 62551368, -165313824, 10894185, }, + { -7194607, 46335716, 6969122, }, + { 112488416, -297701888, -26124676, }, + }, + { + { 140419120, 163395056, 61220464, }, + { -134698768, -418562272, -37772088, }, + { 12770012, 47600584, -16543677, }, + { 1829119, 44066900, -22123914, }, + { 33349348, -25675314, 30729954, }, + { 13965623, -83586504, 35370128, }, + { 68233608, -88068304, 41433548, }, + { -11814381, 19326816, -3059091, }, + { 176067360, -24274618, 67555000, }, + }, + { + { 193003488, 110340392, 58983324, }, + { -400174976, -27615030, -115993112, }, + { 35544612, -41037340, 13286481, }, + { 77038832, -66177928, 4207994, }, + { -52810916, 74782896, 8038032, }, + { -35016868, 65575024, -16007343, }, + { -10479720, 87943752, -12978317, }, + { 4599910, -13000866, 7131793, }, + { 59668372, 167397968, 11380053, }, + }, + { + { 88669064, -136434464, -13708462, }, + { -418985344, 219153392, -13563507, }, + { 23226110, -44473848, 13935021, }, + { 115305912, -11606612, 14061723, }, + { -143302128, -39595840, -14180908, }, + { -59085864, 36939404, -20780126, }, + { -87146496, 9683541, -25189446, }, + { 25008520, -13014288, 2070174, }, + { -136447888, -56905632, -32251446, }, + }, + { + { -95292440, 37550900, -37873020, }, + { -206629808, -110094504, 59848220, }, + { -19184546, 36173288, -7810935, }, + { 67421856, 33315524, 4643397, }, + { -158025808, -25906168, -14119168, }, + { -48429516, -45377940, 8228084, }, + { -113663088, -53688164, 4163434, }, + { 42060616, -12084964, -2563022, }, + { -283383008, -24645060, -13195213, }, + }, + { + { -248765584, 30539902, -11682848, }, + { 81042808, -14250165, 36664524, }, + { -54503672, 436476, -13678397, }, + { -51027432, -48062296, -1750736, }, + { -72271416, 56135760, -543850, }, + { -31731756, -13630079, 15043123, }, + { -97211216, -3755949, 17327508, }, + { 44042744, -1282048, 987843, }, + { -314783520, 26202522, 8887361, }, + }, + { + { -318032128, -23928874, 15863999, }, + { 309716544, 19851338, -11929272, }, + { -64207612, -32423782, -834834, }, + { -181705568, 34351684, -7874823, }, + { 67236640, -50014356, 11543261, }, + { -24249922, 23637352, -232465, }, + { -61846456, 13557064, 2641405, }, + { 22053046, 4669167, 2681670, }, + { -235416288, -29829084, 11263552, }, + }, + { + { -321614656, -7707319, 17708688, }, + { 441777120, 23812372, -24769076, }, + { -63085552, 4299799, 10666551, }, + { -257657776, 10072235, -4187056, }, + { 182311168, 965831, 9856950, }, + { -15317464, 2199023, -7827578, }, + { -19076098, 8660265, -5299453, }, + { -16952772, -20622286, 530428, }, + { -101074536, 27609660, 8037495, }, + }, + { + { -299877312, 14833206, 4658429, }, + { 501736992, -30001958, -10576894, }, + { -77060304, 21843666, 5098126, }, + { -255281040, -25045028, 6628745, }, + { 224941392, 25129854, -4932233, }, + { 10722923, -24297704, -745714, }, + { 21924198, -14825690, -2221035, }, + { -55880744, 8342974, -3590593, }, + { 24230058, -11106785, 2217814, }, + }, + { + { -273169056, 1380832, -3224447, }, + { 518796608, 5689758, -501974, }, + { -107435384, -11543261, -1205275, }, + { -200896560, 11400454, 8522826, }, + { 205748256, -6176163, -10351408, }, + { 54589572, 4134980, 2393908, }, + { 52939232, 5274220, -91268, }, + { -76335528, 8250096, -39192, }, + { 108715824, 4263829, -4214437, }, + }, + { + { -241493120, -13797582, -1484985, }, + { 506164576, 10208600, -1411971, }, + { -135031088, 2689187, -19864, }, + { -132891120, -9751186, 4269735, }, + { 159797472, 4487704, -4820027, }, + { 104600168, -5526013, -3636227, }, + { 68510096, -2899103, -59056, }, + { -75732088, -3214783, 3774203, }, + { 153326032, -4451197, -6740415, }, + }, + { + { -201953664, 13988172, 2484102, }, + { 468066080, -11743514, -3473555, }, + { -135009072, 6645925, 2597918, }, + { -76960984, 1656247, 299037, }, + { 114370144, -4749160, -1355599, }, + { 142927920, 12561169, -4122095, }, + { 65720516, -3194919, 500901, }, + { -61929132, -2405182, 1045288, }, + { 170837152, 9755481, -3670587, }, + }, + { + { -157771872, -7571491, 2987150, }, + { 409905760, 14218489, -3198140, }, + { -89839440, -11615202, 2513093, }, + { -38160248, -4485557, -2508798, }, + { 80043160, 2543695, 238908, }, + { 144927232, -1413044, -105227, }, + { 47504484, 7495792, 11811, }, + { -43118788, -5166309, -1449552, }, + { 169407472, 267362, 73551, }, + }, + { + { -114906480, 5610838, 980863, }, + { 342850592, -13112535, -2252174, }, + { -257698, 17945448, -1500554, }, + { -6269579, 9542880, -1308891, }, + { 49730352, -6022081, 804770, }, + { 96365104, -14963666, 2623151, }, + { 26508002, -3325915, 172872, }, + { -27319214, 7948911, 848256, }, + { 152526096, -7221988, -119722, }, + }, + { + { -76454176, -6929930, -69256, }, + { 279726400, 11549704, -1301375, }, + { 114208552, -28898688, -3926137, }, + { 26892938, -5211406, -841277, }, + { 12193949, 7994545, 1019518, }, + { 7168301, 27730456, 2589865, }, + { 18780818, -313533, 1094143, }, + { -20258824, -345208, 3060164, }, + { 125984272, 8527658, -1406065, }, + }, + { + { -41962904, 7059316, 128849, }, + { 228333344, -8655970, -1010928, }, + { 219166272, 28090696, -1050656, }, + { 62499828, 7261179, -2414309, }, + { -36138928, -10872173, 2019708, }, + { -89954328, -27792196, -466541, }, + { 36580772, 5089000, 663036, }, + { -18362596, -4509179, 2020245, }, + { 97064112, -6015639, -1931662, }, + }, + { + { -8992588, -6510634, 267362, }, + { 190033520, 4474819, -350577, }, + { 278282752, -5998459, 1591285, }, + { 95040112, -10720775, -1452236, }, + { -88483840, 14305462, 1738388, }, + { -153659440, 6827925, -2048699, }, + { 83558592, -11030550, -993211, }, + { -8813273, 2103460, -952409, }, + { 71897216, 1779190, -978179, }, + }, + { + { 24793772, 6630893, -18254, }, + { 160462656, -4852776, 434865, }, + { 274668512, -17280800, -1229971, }, + { 113483776, 2928631, 500901, }, + { -129502928, -8119099, 592169, }, + { -157575904, 15821586, 1637993, }, + { 150618064, 16231755, -2345052, }, + { 22151294, 10189273, -2437931, }, + { 53149148, 1124208, 1559073, }, + }, + { + { 59917480, -7263864, -350040, }, + { 132440688, 8647917, -547608, }, + { 222252208, 20497194, -5111011, }, + { 109086800, 9399536, -1176284, }, + { -144204064, -1976759, 942208, }, + { -105299712, -19787452, 5240397, }, + { 215895664, -14326937, -2713883, }, + { 77865072, -19022410, -732829, }, + { 40236328, 4224101, 2659659, }, + }, + { + { 94547264, 7210713, -514322, }, + { 99481104, -9044127, -2510945, }, + { 154022352, -10442139, -4019553, }, + { 82563768, -8490077, -3492345, }, + { -128416840, 6362457, 1036161, }, + { -22603340, 12644921, 2655901, }, + { 252400736, 6924561, -1945620, }, + { 145012592, 13919989, -82678, }, + { 31737660, -10970420, -1664837, }, + }, + { + { 125645512, -7259569, -85899, }, + { 56863756, 4744328, -1486596, }, + { 99314136, 4427575, -335007, }, + { 41075992, 3167539, -968515, }, + { -89500672, -12156905, 797253, }, + { 60453812, -10972568, -2783139, }, + { 242034288, 3270618, 1074816, }, + { 200968496, -7325604, -2245731, }, + { 27202176, -1326071, -5287642, }, + }, + { + { 150700208, 4634807, 561030, }, + { 1191853, -8886824, 2146410, }, + { 70675296, -2062658, 1005022, }, + { -8423505, -8847096, 2709588, }, + { -41706816, 12612171, 1906429, }, + { 119930520, 13067438, -3780645, }, + { 186179856, -22568980, 1925219, }, + { 224940864, 2801929, -3001645, }, + { 21487184, 13031468, 194347, }, + }, + { + { 169636176, -1192927, 61203, }, + { -66094176, 19737522, 2557653, }, + { 63994476, -1108102, 530428, }, + { -57278220, 13596256, 2472291, }, + { 166430, -4035659, 1475321, }, + { 140860976, -5550172, -35970, }, + { 109537232, 28074054, -2848100, }, + { 204103296, 8996883, -2008434, }, + { 1818919, 4411469, 6263673, }, + }, + { + { 185916256, 1898376, -1018981, }, + { -133667976, -19608674, -745714, }, + { 64880312, 1573569, 387621, }, + { -92978528, -8923868, 155156, }, + { 29435022, 97174, -1298154, }, + { 120988152, -12420509, 1513976, }, + { 49056580, -7981660, -5492190, }, + { 139661056, -18445274, -1324997, }, + { -36724656, -22808960, 2743947, }, + }, + { + { 203936864, -5097053, -1052804, }, + { -185728880, 7454453, -2333778, }, + { 58489400, 863825, 1222455, }, + { -104674256, -2811593, -115964, }, + { 48657148, -3922916, -2414309, }, + { 75116832, 19784230, -1840930, }, + { 26552024, -8952859, -2214593, }, + { 48134772, 21822728, -685047, }, + { -79321064, 15090904, -3412889, }, + }, + { + { 225228624, 6438156, -157303, }, + { -214688240, 3755412, 329102, }, + { 38261716, -7221451, 1816234, }, + { -90862184, 8681203, 1593433, }, + { 62400508, 5262409, -942745, }, + { 28787556, -9220758, -4382478, }, + { 34985728, 13614509, 2888903, }, + { -46410880, -20306068, -564251, }, + { -104572792, 3867618, -2895345, }, + }, + { + { 247859344, -4959614, 399432, }, + { -227028208, -1579474, 3234110, }, + { 9644886, 10700911, 573378, }, + { -60634200, -7675107, 1981591, }, + { 72839960, -2655364, 490163, }, + { 729608, -4192962, -1942936, }, + { 48766132, -369367, 4420595, }, + { -121884192, 11087995, -140660, }, + { -103912440, -11213086, 2019172, }, + }, + { + { 268726976, 2394444, -181999, }, + { -235657344, -4387846, 2889439, }, + { -13455596, -6493991, -1464047, }, + { -25911538, 8749385, 2221035, }, + { 79648024, -3604551, -1035087, }, + { -8626979, 6051072, 2256469, }, + { 45754824, -10596758, 946503, }, + { -166654400, -1146756, 1919850, }, + { -84939960, 6331319, 4582730, }, + }, + { + { 286211264, -2729452, -953483, }, + { -248872416, 8239358, 294742, }, + { -18828062, -4189741, -1525787, }, + { 4614406, -1637456, 1565516, }, + { 82404856, -1227824, -2612951, }, + { -11445014, -180926, 4145717, }, + { 21737904, 12543452, -3052111, }, + { -182342832, -2155000, 4099010, }, + { -60702920, 1326608, 2131378, }, + }, + { + { 300383040, 3500935, -717796, }, + { -266191872, -3493956, -970663, }, + { -5042829, 10755135, 1197222, }, + { 30651570, 2687576, -321586, }, + { 79362408, 2752537, -858457, }, + { -18897856, -9425306, 1945083, }, + { -14038101, -5513665, -3498788, }, + { -178168672, -1279363, 3287261, }, + { -37468756, 3229816, -508954, }, + }, + { + { 311666464, -2198487, -265214, }, + { -283031360, 1918777, -70330, }, + { 18464064, -6590091, 3395172, }, + { 58261768, -4366908, -1492501, }, + { 66921496, 2005750, 1306744, }, + { -31464394, 7336341, -1821066, }, + { -51994876, 2715493, -710817, }, + { -161833296, -2287607, 964220, }, + { -14486388, -4322885, -715649, }, + }, + { + { 320947872, 1425929, -280247, }, + { -296547616, -1778653, 544387, }, + { 40380208, -2829847, 1201517, }, + { 91574608, 9750650, -1528472, }, + { 45061724, -9525701, 755377, }, + { -41256384, 2624225, -1612223, }, + { -89262840, -4065724, 2160369, }, + { -137527536, 5949067, 293668, }, + { 10603201, 5882495, -712428, }, + }, + { + { 329596320, -1290101, -507343, }, + { -306918912, 2180233, 387621, }, + { 56913684, -266288, -2163590, }, + { 127935800, -9903658, -440771, }, + { 20552492, 7883413, -1342714, }, + { -43283608, -3977677, 1141388, }, + { -126284920, 9459129, 2925410, }, + { -109121696, -6815576, 498753, }, + { 38045356, -5915244, -879931, }, + }, + { + { 338755872, 1985349, -662499, }, + { -316944416, -1728188, 217970, }, + { 70156144, 6400038, -1461900, }, + { 158782800, 7256347, 613643, }, + { 2733747, -1930588, -1903207, }, + { -38901128, -146029, 1503239, }, + { -160943168, -12184822, 650151, }, + { -80698680, 6174553, 687195, }, + { 63547800, 6309844, -729608, }, + }, + { + { 348667584, -2622078, -528281, }, + { -330204608, 2903398, 394600, }, + { 80498424, -3464428, 624918, }, + { 176407184, -212064, 684510, }, + { -4530117, -2791192, -780610, }, + { -31255550, 34360, -15569, }, + { -186284000, 3796214, -1058710, }, + { -56010132, -4271882, 649077, }, + { 80058728, -2265595, -424128, }, + }, + { + { 358330208, 2345589, -273267, }, + { -348918848, -4343823, 594853, }, + { 86404544, -1669669, 192200, }, + { 179864640, -3940633, -735513, }, + { -5645735, 2221572, 545461, }, + { -22848690, 2136746, -548682, }, + { -196971488, 3864397, 570157, }, + { -36806796, 2615098, 387621, }, + { 82155208, -1394791, -471373, }, + }, + { + { 366297888, -1524177, -97711, }, + { -372433248, 5732171, 681826, }, + { 87542704, 938987, -1042066, }, + { 175921328, 2347200, -1906429, }, + { -9195525, 777926, 1210107, }, + { -15777025, -1827509, -136365, }, + { -195313632, -2768643, 2332167, }, + { -22068616, -1083942, -295816, }, + { 69850128, 4421669, -359704, }, + }, + { + { 371749280, 51003, -288300, }, + { -397624864, -6229850, 351650, }, + { 84823456, 1105954, -449361, }, + { 173494128, 2942590, -1049583, }, + { -21438330, -6756521, 438624, }, + { -11614665, 5369, -123480, }, + { -188027232, -225486, 1703491, }, + { -8943196, 3022583, -632434, }, + { 48287780, -6484864, -573915, }, + }, + { + { 375091296, 123480, -765041, }, + { -420282944, 3861713, 207769, }, + { 79324824, 1246077, 565862, }, + { 177637696, -3994320, 930934, }, + { -42110008, 7602629, -1375463, }, + { -11107859, 586800, -499290, }, + { -180578672, 130997, 265751, }, + { 4147328, -2578054, -663572, }, + { 25565792, 4443681, -760746, }, + }, + { + { 377552320, 1293322, -671089, }, + { -437537440, -1720134, 741956, }, + { 72594072, -5038534, -627602, }, + { 187999840, -449898, 470836, }, + { -65652872, -2403034, -1189706, }, + { -13804562, 1540283, 333397, }, + { -174902880, 2426657, 401579, }, + { 16455093, 4543002, -142808, }, + { 8400419, -1613297, -322659, }, + }, + { + { 379801824, -1159104, -98784, }, + { -449000192, 762357, 1505923, }, + { 66756140, 1897302, -2478733, }, + { 202493216, -1679332, -1592359, }, + { -87476672, 1024350, 1014686, }, + { -18439368, 616328, 1715839, }, + { -170510208, -614717, 1108638, }, + { 25653302, -1463510, 585726, }, + { -814970, -1081258, 744103, }, + }, + { + { 381884864, 102005, 62277, }, + { -456018144, -2931852, 1144609, }, + { 61858268, 3501472, -1437203, }, + { 218079648, 5225365, -1717987, }, + { -106423384, -4740570, 1769527, }, + { -22399866, -3916473, 964757, }, + { -165222560, -275415, 569620, }, + { 30270930, -994285, 135291, }, + { -3977677, -1443109, 878321, }, + }, + { + { 384165504, 471373, -382252, }, + { -459639360, 1001264, 163209, }, + { 53535156, 277025, 810675, }, + { 229669088, -4628364, -55298, }, + { -121935192, 5230734, 398358, }, + { -20921322, -307627, -477815, }, + { -155960992, -2059974, -151398, }, + { 32400696, 1212255, -745177, }, + { -3812857, 365609, 27380, }, + }, + { + { 387472608, 773094, -761820, }, + { -460596576, 1338956, 388158, }, + { 37011880, -8176544, 218506, }, + { 232414640, -2472828, 367757, }, + { -132566312, -363998, -61740, }, + { -10568841, 6884296, 514322, }, + { -141396224, 5043366, 133144, }, + { 35882304, 890132, -1221381, }, + { -1747515, 906775, -19864, }, + }, + { + { 392298016, -2099165, -467078, }, + { -460876832, -654983, 1044751, }, + { 12603045, 8705899, -2084670, }, + { 225417056, 5970542, -1477469, }, + { -137805104, -1513976, 1142461, }, + { 7254737, -6248641, 2473364, }, + { -123040072, -5198521, 973884, }, + { 43224012, -3112778, -925029, }, + { 770410, 405874, -242129, }, + }, + { + { 398138112, 1664837, -5906, }, + { -462098752, 161061, 1531693, }, + { -15297063, -1983201, -1540283, }, + { 212177296, -1755568, -2101313, }, + { -138299024, -763430, 1508607, }, + { 28484760, 306016, 1535451, }, + { -104152424, 1582159, 476741, }, + { 53592600, 3449396, -330712, }, + { 2964601, 1447941, -306016, }, + }, + { + { 404148384, -311922, -176094, }, + { -464220992, 1423782, 1687922, }, + { -42546484, -2144799, 3101503, }, + { 196518384, -3173444, 1027034, }, + { -134805600, 4870493, -1206886, }, + { 49714248, 2751464, -2964601, }, + { -87270512, -921807, -1372779, }, + { 64223720, -2987150, 277025, }, + { 4530654, -2358474, 919123, }, + }, + { + { 409720000, -462783, -1084479, }, + { -466352928, -2785286, 731755, }, + { -65998616, -1939178, 7927436, }, + { 181019984, 2525978, 6302328, }, + { -129010616, -4121021, -6409165, }, + { 67529768, 2459406, -6993818, }, + { -73590504, 3739306, -1999844, }, + { 73398304, 1053341, 575526, }, + { 5841693, 808528, 2232309, }, + }, +}; + const float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -5335,6 +10613,560 @@ const float rightHRIRReal_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS } }; +const Word32 rightHRIRImag_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { -36158792, 332589920, -120427664, }, + { 74782896, -414234016, 138564768, }, + { -1993402, 15385110, -4536559, }, + { -12910672, 37127308, -11034308, }, + { 13785771, 13972065, -10325638, }, + { 5334350, 5939403, -4061429, }, + { 18512920, 23427972, -15831786, }, + { 3295314, -46312096, 20517058, }, + { 24953760, 133811320, -62957780, }, + }, + { + { 6790344, 394416512, -99059128, }, + { 59612536, -289198400, 180918512, }, + { -1410360, -11168526, -15667504, }, + { -16600585, 2608119, -22172232, }, + { 27442156, 41982232, -5173288, }, + { 8725226, 15491410, -4438849, }, + { 45414448, 82660944, -348966, }, + { -9163313, -111122616, -6783901, }, + { 88319024, 252158064, -29414620, }, + }, + { + { 119840864, -172064448, 92515208, }, + { -175912736, 498648928, -68749008, }, + { 10392747, -39891656, -8267812, }, + { 18903224, -44296144, -11482058, }, + { 1028108, -10605348, 22429930, }, + { -5090610, 2387465, 3582003, }, + { 21121038, 29187524, 28092308, }, + { -8322036, -78509320, -20295332, }, + { 75277352, 6205154, 71450536, }, + }, + { + { 84888952, -211159920, 71064528, }, + { -293597536, 167443600, -152749440, }, + { 16649441, 19593640, 12747463, }, + { 57636852, 42297376, 10699837, }, + { -63173064, -90405304, 7914014, }, + { -33967284, -71368936, -15578920, }, + { -59171228, -125028112, -14110578, }, + { 14133127, -4103305, 8483097, }, + { -83939768, -238660064, 3744138, }, + }, + { + { -84856208, 160208720, -34959960, }, + { -96670048, -340704192, 7391102, }, + { -6153078, 38164004, 9969156, }, + { 40164924, 26005490, 17468706, }, + { -94673424, 9172976, -21439402, }, + { -38052336, -47195784, -23022098, }, + { -105601432, -51099912, -31717796, }, + { 23212688, 3580392, 1049583, }, + { -236426672, 242666, -52827024, }, + }, + { + { -241306288, 23081692, -47294568, }, + { 241835648, 76635640, 87011208, }, + { -44483512, -43661564, -12531641, }, + { -49227304, -61918932, 1545115, }, + { -32010928, 61011620, -12165495, }, + { -1369558, 61596812, 11496017, }, + { -72386304, 68689408, 8167954, }, + { 21155936, -1467805, -432718, }, + { -245244240, 94062472, -9156333, }, + }, + { + { -279724256, -83891984, 187905, }, + { 487956064, 96942784, 27740120, }, + { -58395448, -28610388, -14624901, }, + { -154616144, 24776592, -8514773, }, + { 93974960, -58441620, 6685654, }, + { 32097364, 23796804, 18185966, }, + { -4830765, -6265821, 21151104, }, + { 2374043, -548145, 2821257, }, + { -121094456, -55359980, 19837918, }, + }, + { + { -199590352, 46742664, 28198070, }, + { 542467776, -70228080, -36100812, }, + { -38022272, 34528316, 4661114, }, + { -204685792, -340913, -7135015, }, + { 201704016, 17952964, 12763569, }, + { 43963284, -32239098, -4910222, }, + { 53434760, -29083372, 1289564, }, + { -29628296, -16311749, 2477659, }, + { 61041148, 25417616, 12723304, }, + }, + { + { -71485976, 3439732, 18509162, }, + { 449389952, -750546, -36375688, }, + { -10520522, -7513509, 13849659, }, + { -164350688, -39578124, -1079111, }, + { 224162400, 27566710, 6024766, }, + { 51943336, -8273181, -13044889, }, + { 88907968, -7683160, -11099806, }, + { -59125056, 6847252, -629750, }, + { 213081920, -12068321, 914291, }, + }, + { + { 40884868, -8075076, -3076807, }, + { 300000768, 8685498, -6082211, }, + { 957241, -27275726, 4496831, }, + { -53774600, 43806520, 8965744, }, + { 154083568, -52445308, -9099962, }, + { 69969312, 27617176, -1512902, }, + { 104226512, 15185931, -3274913, }, + { -69255272, -3904662, -2665027, }, + { 282055872, -6979859, -5660230, }, + }, + { + { 122261072, -14564234, -10473278, }, + { 150754960, 24950538, 8772471, }, + { 3320010, 4095788, -5724655, }, + { 66658428, -11882027, 7962333, }, + { 44114684, 12880607, -12540231, }, + { 90301152, -203474, 4349728, }, + { 99475200, 3833258, 1317481, }, + { -53058952, -18649822, -327491, }, + { 271441408, 13378286, -8655433, }, + }, + { + { 185318720, 23846196, -4557497, }, + { 15679852, -37565396, 4328254, }, + { 21893596, 13773960, -2983392, }, + { 150678720, 46171, -1040993, }, + { -48956720, 813896, -947577, }, + { 95590400, -9763534, -1977296, }, + { 79202416, -6300180, 253403, }, + { -18629420, 9327058, 4054449, }, + { 217019872, -10098542, -7290707, }, + }, + { + { 240183168, -16076599, 1266479, }, + { -105487080, 26186416, -283468, }, + { 70551816, -16828218, 678605, }, + { 189024736, -49392, -4967130, }, + { -105314744, 5423470, 4425964, }, + { 74048992, 757525, -2923262, }, + { 50586124, 7173133, 416612, }, + { 16224239, 1275605, 724239, }, + { 151719184, 2614025, -1576790, }, + }, + { + { 286097440, 4743792, 1162862, }, + { -210780352, -18678812, 364535, }, + { 145435648, 16265578, -83752, }, + { 195911168, -2299418, -5272073, }, + { -130978784, -1410360, 3964255, }, + { 19889456, -9549323, 2411087, }, + { 22510998, -8150774, -128312, }, + { 42030012, 3780645, -2588255, }, + { 89983856, -10215043, 2976949, }, + }, + { + { 319378048, -1308891, -1722282, }, + { -293717792, 12847321, 1720134, }, + { 224754560, -12506408, -3513820, }, + { 192708208, -6009196, -2883534, }, + { -143904496, 4290673, 3185792, }, + { -58067420, 21905944, 4212826, }, + { 7643431, 352724, -487479, }, + { 56253336, -7172059, -274341, }, + { 34664680, 15397458, 1792075, }, + }, + { + { 340915712, 3598109, -2687576, }, + { -349467520, -7507603, 2401961, }, + { 278644064, 11220065, -4716948, }, + { 190083440, 34897, -506806, }, + { -157392304, -4962298, 2032593, }, + { -131253128, -19497540, 2294050, }, + { 14569066, 4827007, 163746, }, + { 60362544, -1574642, 1777043, }, + { -10620380, -9889162, -326418, }, + }, + { + { 355079968, -3677566, -1744294, }, + { -381102656, 4260071, 2215130, }, + { 281619392, -1296006, -1116692, }, + { 185217248, 2087354, -1416802, }, + { -170087152, 3240553, 1831804, }, + { -165204304, 6737730, -682900, }, + { 41253696, -6271189, -472446, }, + { 62204012, 4499515, -101469, }, + { -42043436, 3895535, -408559, }, + }, + { + { 366027840, 2317672, -1134945, }, + { -397606592, -1345399, 2006824, }, + { 223802160, -20542828, 1700807, }, + { 171571600, -425202, -704912, }, + { -171730512, -1431298, 1205275, }, + { -138801536, 16011638, -1830193, }, + { 75993000, 6881612, -2061047, }, + { 72658496, 653909, -2717104, }, + { -58964532, 883153, 773631, }, + }, + { + { 375740384, -1729261, -1239098, }, + { -409371584, 2474438, 2047626, }, + { 121028960, 34863860, -778463, }, + { 143039056, 6924024, 1210644, }, + { -151491552, -5535676, -226560, }, + { -58364848, -31437014, 1287953, }, + { 100377680, -5044439, -2580739, }, + { 95764888, -8861591, -3254512, }, + { -64630132, -1622961, 2194728, }, + }, + { + { 383609824, 1746441, -1296006, }, + { -424501696, -6113886, 1065689, }, + { 11184632, -24941948, -3841848, }, + { 99827928, -15702937, 8590, }, + { -106059384, 15424838, 74088, }, + { 42509976, 23139674, 3684545, }, + { 95006288, -2285996, -1535988, }, + { 122857000, 11319923, -1122060, }, + { -64195804, -1420560, 2232309, }, + }, + { + { 387407136, -675384, -1110786, }, + { -446154208, 5822902, -92879, }, + { -67740760, 4913980, -1846299, }, + { 51632488, 11216307, -2097018, }, + { -45219028, -14675366, 887448, }, + { 123440048, -5479842, 469762, }, + { 48671644, 12622372, 137439, }, + { 134595152, 173409, 71404, }, + { -62093952, 6441377, -1045288, }, + }, + { + { 385254816, -637803, -812286, }, + { -473090112, -2037425, 1216550, }, + { -99903624, 4727149, 2258616, }, + { 11749957, 366146, 526134, }, + { 13227962, 10634339, 147103, }, + { 159256848, -3637301, -4543539, }, + { -32711544, -19771882, 2049236, }, + { 113054816, -12186970, -1802276, }, + { -60602524, 2531346, -3322157, }, + }, + { + { 377351520, 2255932, -482647, }, + { -501648416, 3520263, 4013647, }, + { -94568200, -5376226, 3605625, }, + { -11883638, 1945620, 3943854, }, + { 54005992, -6682969, -72478, }, + { 146007408, 3005403, -4282620, }, + { -125467272, 25107306, 1941325, }, + { 54234700, 12469901, -1246077, }, + { -62698468, -10954851, 1609002, }, + }, + { + { 366280192, -4061965, -805843, }, + { -525283616, -9440875, 3562675, }, + { -73869144, 2709588, 2083059, }, + { -15278272, -3664681, 2474438, }, + { 69738456, -3156801, -746787, }, + { 94421632, -8872329, 543850, }, + { -197179808, -18215494, -1489817, }, + { -32488206, -20340428, 1323387, }, + { -73730096, -3738769, 6418292, }, + }, + { + { 356168224, 2472828, -1493038, }, + { -533570240, 4927401, -20401, }, + { -58116276, -1755568, 771484, }, + { 5287105, -4551055, -365609, }, + { 63846300, 6586333, -2798171, }, + { 23891292, 20171314, 2127083, }, + { -223493984, -3424163, -3262028, }, + { -127029024, 21662742, 1534377, }, + { -90670520, 17609366, 2166811, }, + }, + { + { 349922272, 618475, -1319092, }, + { -518373568, 8857833, -1140851, }, + { -56720948, -883690, 1331977, }, + { 48408040, 13831405, -606664, }, + { 47076064, -2146947, -2979097, }, + { -40385040, -19214610, -1528472, }, + { -205683296, 20291572, 840740, }, + { -203235712, -13549011, 1227824, }, + { -96553552, -4800163, -4361540, }, + }, + { + { 346649504, -1439888, -318364, }, + { -483399104, -15989626, 1763621, }, + { -66776004, 6590091, 978179, }, + { 103736880, -14713484, 507343, }, + { 28132036, -848256, -367220, }, + { -75919456, -1214402, -2411087, }, + { -171571056, -12617003, 5709622, }, + { -240693728, 845035, 2171106, }, + { -76186280, -17254494, -3004330, }, + }, + { + { 342597184, -1294933, 166430, }, + { -443682464, 9204115, 4066260, }, + { -75551160, -3277060, -437550, }, + { 156191856, 10443750, 1022202, }, + { 9059697, -4929549, 889058, }, + { -78208672, 9521942, 970126, }, + { -153513408, -5825587, 4600984, }, + { -233576432, 5917928, 2312303, }, + { -33381560, 19739132, 3035468, }, + }, + { + { 334624672, 3918621, -566936, }, + { -413670304, 577136, 2447595, }, + { -70139504, -1757715, -1557999, }, + { 193998848, -3168612, 186831, }, + { -10993506, 6357089, -403727, }, + { -61479236, -9741523, 4020090, }, + { -164081168, 14096083, -239444, }, + { -189978208, -16337519, 2595771, }, + { 13108777, -5794448, 4198331, }, + }, + { + { 322606816, -3232500, -1260573, }, + { -396880736, -2692408, -843424, }, + { -46797428, 11288785, -991601, }, + { 214848752, 153545, -1243930, }, + { -32719598, -4962835, -1389959, }, + { -44736380, -1035087, 4147328, }, + { -192954096, -10519986, -3456375, }, + { -127260952, 14543833, 3575024, }, + { 47788492, -2278480, -68719, }, + }, + { + { 308399040, 1808181, -802085, }, + { -386778464, -3155727, -1571958, }, + { -13718662, -11858405, 1543504, }, + { 224974688, 794569, -2326799, }, + { -56534116, 457414, 206695, }, + { -37853156, 7458211, 425739, }, + { -221009888, -892279, -2015950, }, + { -63788316, -7458748, 1576790, }, + { 68279776, -1187559, -2947421, }, + }, + { + { 293636704, -2662343, -128312, }, + { -375935808, 5361193, 153008, }, + { 14427869, 3656628, 2450816, }, + { 232371696, 2226941, -2764348, }, + { -82602960, -5332202, 2313377, }, + { -36209260, -2982318, -2959233, }, + { -236805168, 4200478, 2068027, }, + { -9079561, 6485938, -1704028, }, + { 79947592, 3765076, -2320893, }, + }, + { + { 279406944, 3427384, -205085, }, + { -362203712, -3554086, 1072668, }, + { 28135258, 5444945, -106300, }, + { 240036064, -4869419, -1695975, }, + { -108520400, 9707163, 1090922, }, + { -30004104, -7593502, -1940788, }, + { -240686752, -710817, 3923990, }, + { 35410396, -11063299, -1749125, }, + { 87226488, -2617246, -1141924, }, + }, + { + { 266644992, -2608656, -476205, }, + { -347585248, 2545305, 769873, }, + { 28486370, -4051228, -3284576, }, + { 243368416, 2174864, -173946, }, + { -127333968, -4950487, -1104880, }, + { -16089484, 7972533, 1418950, }, + { -236118512, -1354525, 3016678, }, + { 69019048, 5398774, -811212, }, + { 90053120, 663572, -781684, }, + }, + { + { 255541424, 1991791, -520765, }, + { -335333856, -1934346, 435939, }, + { 22628572, -4581657, -1842541, }, + { 235510240, 2966749, 518080, }, + { -133714680, -2567317, -1082332, }, + { 433255, -551903, 1525250, }, + { -223574528, 2010582, 192737, }, + { 91384560, -5077188, -465467, }, + { 84883048, 1163399, -483721, }, + }, + { + { 245329600, -1373853, -308164, }, + { -327304960, 1559610, 599685, }, + { 13842680, -357556, 1105954, }, + { 214584080, -8028905, 86436, }, + { -130002752, 5317707, 677531, }, + { 14326937, -83752, -653909, }, + { -200260368, 7125888, -1465658, }, + { 103070624, -522375, -449898, }, + { 68426880, -4463008, 12348, }, + }, + { + { 234616880, 2107218, -43487, }, + { -322709344, -124554, 736587, }, + { 1589138, 5553930, 565862, }, + { 186385472, 9103183, -1245004, }, + { -125093072, -1516660, 1810866, }, + { 23804320, -2353642, -1084479, }, + { -166164768, -13082470, 473520, }, + { 106302048, -217433, -797790, }, + { 41465760, 7704098, -18254, }, + }, + { + { 222323072, -2915746, -19864, }, + { -318206080, 789200, 656056, }, + { -13198435, -4537096, -923955, }, + { 161084352, -4031901, -1812476, }, + { -127196528, -2785823, 1559073, }, + { 28687698, 1585380, -195958, }, + { -128549984, 8349954, 2117956, }, + { 105128448, -2126546, -1066763, }, + { 10321343, -6656126, -12885, }, + }, + { + { 208615696, 3557844, -220654, }, + { -309694528, -1555852, 404264, }, + { -28428388, 894427, -419296, }, + { 145905952, -1242856, -609885, }, + { -137842144, 5847598, 500901, }, + { 29700236, 334471, 172336, }, + { -96008088, -2522757, 846645, }, + { 103137200, -988379, -1157494, }, + { -16428787, 5519570, 15569, }, + }, + { + { 194701072, -3233574, -540629, }, + { -294416256, 4551055, 296890, }, + { -42549168, -2559801, 639950, }, + { 140792256, 2094333, 1074816, }, + { -151768576, -4850629, -831613, }, + { 28312962, -867583, -33286, }, + { -71958416, 2250026, -940061, }, + { 101641472, 158377, -641024, }, + { -32029182, -1188095, -28454, }, + }, + { + { 182000320, 1571421, -382252, }, + { -272313280, -6266358, 755914, }, + { -54702852, 4699768, -196495, }, + { 140131904, 2928631, 517544, }, + { -161241664, -1787243, -353798, }, + { 26629334, -1044751, 400506, }, + { -54589572, -4306242, -817118, }, + { 99131064, -478352, -254477, }, + { -34484292, -2201171, 446140, }, + }, + { + { 170964928, -1386738, 183610, }, + { -245976000, 6084895, 1145683, }, + { -64347736, -2036351, -1435056, }, + { 138324256, -2430415, -1476395, }, + { -162479680, 3643206, 1773822, }, + { 26885958, 612033, 1231582, }, + { -40347996, 3263638, 82678, }, + { 94091456, -1321776, 241592, }, + { -27213450, 3658775, 1133871, }, + }, + { + { 161127840, 2494839, 230318, }, + { -218601488, -4053912, 659814, }, + { -72627896, -2632815, -189515, }, + { 132085816, -731218, -1257352, }, + { -157013264, -20401, 2114198, }, + { 31015032, 1607392, 375810, }, + { -26279832, -1437203, -290984, }, + { 86541440, 3720516, -263067, }, + { -16163573, -1236951, 1034550, }, + }, + { + { 152307600, -2508261, -267899, }, + { -192162736, 4103841, -425202, }, + { -82927768, -598074, 2172180, }, + { 118860000, -1208496, 657667, }, + { -147158464, -732829, 167504, }, + { 40805412, 1704565, -1273458, }, + { -10628433, 3490735, -980863, }, + { 79426832, -1911261, -1018981, }, + { -5949067, -68183, -201327, }, + }, + { + { 144696368, 1319092, -537408, }, + { -167141872, -6891812, -175557, }, + { -97344896, 7576323, 1618129, }, + { 98060008, 6953015, 1093069, }, + { -133613752, -4267050, -679679, }, + { 55868396, -7104413, -654446, }, + { 5866926, -4824859, -618475, }, + { 75897976, -449898, -956167, }, + { 2306934, -2581275, -422517, }, + }, + { + { 138049920, -252866, -158377, }, + { -144453168, 4816269, 712428, }, + { -112335944, -5070746, -423591, }, + { 73207184, -8397735, -449361, }, + { -117530168, 5335960, 373125, }, + { 71457520, 3936338, 759672, }, + { 20044612, 3259343, 43487, }, + { 76154064, 2106682, -241592, }, + { 8460549, 700080, -55835, }, + }, + { + { 131315400, 1210644, 288300, }, + { -124574992, -3322157, 743566, }, + { -121577640, -2782602, 380105, }, + { 50560892, 2275796, -740345, }, + { -101227008, -2015950, 554588, }, + { 81823424, 2728915, -527207, }, + { 28654412, 806917, -407485, }, + { 77313704, -1054951, 514859, }, + { 12657805, -1239098, -40802, }, + }, + { + { 123408904, -2617783, 91268, }, + { -106087304, 2538326, 300648, }, + { -121654952, 5787469, 3679713, }, + { 34478388, 2088965, 1676111, }, + { -86537688, -592706, -1213865, }, + { 84390736, -4424353, -3697967, }, + { 30545270, -1830730, -1678795, }, + { 75919992, -574989, 882616, }, + { 15829639, 1928977, 729071, }, + }, + { + { 113971256, 2760590, -429497, }, + { -87232400, -2210298, -769336, }, + { -112382112, -1367410, 5208722, }, + { 25873420, 69256, 3870839, }, + { -75094280, -1138703, -3105261, }, + { 78730512, -127238, -4860829, }, + { 26732414, -753230, -1465121, }, + { 70934608, 1698660, 1145146, }, + { 18898392, -81604, 1235340, }, + }, + { + { 102863928, -1541356, -380105, }, + { -67243080, 4695473, -1672890, }, + { -94158568, -1594507, 2707977, }, + { 24968256, -4831838, 2573759, }, + { -68827928, 7074885, -1530082, }, + { 64571076, 3093450, -1923609, }, + { 18269718, -35970, 229244, }, + { 63774896, -2209761, 1298691, }, + { 23650238, -587337, 591632, }, + }, +}; + const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -5892,6 +11724,310 @@ const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS const float FASTCONV_FOA_latency_s = 0.000020833f; +const Word32 leftHRIRReal_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { 97523672, 405096480, 117391120, }, + { 168510352, -226681936, 72761040, }, + { 7752416, 62658204, -7288023, }, + { 23083838, 10139344, -8373576, }, + }, + { + { -91860224, -231391360, -85269600, }, + { -87150256, -545616512, 29677688, }, + { -4872641, 57707180, -5408975, }, + { -1218160, 32580012, 7697655, }, + }, + { + { -171940960, -134628432, -89749248, }, + { -368214528, 37159520, -138843408, }, + { -11674258, 43248712, 5395016, }, + { -37626060, 48839148, 9722195, }, + }, + { + { -48351668, 213029312, 16819628, }, + { -294134400, 328650368, -34809100, }, + { -7545721, 5860483, -10766409, }, + { -56161528, -5217849, -7862475, }, + }, + { + { 166833712, -29396904, 57186952, }, + { 41763724, -163917424, 77779176, }, + { 26105884, -27028766, -4032438, }, + { -19192598, -26607860, -4379256, }, + }, + { + { 316903104, -63921460, 13246753, }, + { 380145408, -47550120, 50608136, }, + { 64360084, 26156350, 7871065, }, + { 64651068, 31446140, 2492692, }, + }, + { + { 342714240, 40063992, -23562728, }, + { 562947776, 70490080, -20235738, }, + { 76979232, 18240190, 7850664, }, + { 157704224, -9568113, -242129, }, + }, + { + { 279815520, -2827162, -22232898, }, + { 587650304, 112743, -39622684, }, + { 58521076, -19127636, -1853278, }, + { 218817312, 18382996, -1549946, }, + }, + { + { 194067568, -7948911, -5098663, }, + { 529768096, -24970940, -15723875, }, + { 31035970, 14948634, -8168491, }, + { 219732144, 7948374, 3088082, }, + }, + { + { 123001424, -5282810, 5087926, }, + { 450608096, 378494, 4850092, }, + { 19481434, 16145856, -5490579, }, + { 157347744, -37542848, -2373506, }, + }, + { + { 67425616, 16203301, 3928821, }, + { 369236192, 28034862, 4899484, }, + { 28122372, -10347650, 1939715, }, + { 66008816, 19518478, -7190849, }, + }, + { + { 16583942, -16200617, -446677, }, + { 285353856, -26029112, -2506114, }, + { 36405752, -2548526, 1474248, }, + { -13980119, -5101348, -2355790, }, + }, + { + { -33802468, 10267119, -1898912, }, + { 201879040, 14075145, -3394635, }, + { 22816476, 7213935, -933082, }, + { -64834140, 4773320, 1056562, }, + }, + { + { -80765248, -6639483, -563714, }, + { 125787248, -11312944, -415538, }, + { -24745454, -13758928, -980863, }, + { -87778392, 4248260, 3027952, }, + }, + { + { -120569936, 5925445, 841277, }, + { 63367948, 11264625, 626528, }, + { -102320616, 17017734, 638340, }, + { -97495760, 4630512, 3665218, }, + }, + { + { -152345168, -6521908, 893890, }, + { 16718697, -7630010, 377957, }, + { -190588640, -18248242, 2711735, }, + { -108214384, -6749541, 830539, }, + }, + { + { -177624272, 5427765, 150861, }, + { -17577154, 5733782, 326418, }, + { -263011456, 15330349, 2882997, }, + { -121832120, 1862405, 221191, }, + }, + { + { -198991744, -3744138, -146566, }, + { -45709188, -5207111, 259846, }, + { -295502880, -4590247, 1115618, }, + { -133506912, -1175747, 1578937, }, + }, + { + { -219550144, 3167539, 266825, }, + { -72961832, 5575942, 307627, }, + { -277467232, -11616276, 259846, }, + { -136396880, 1964411, 1173063, }, + }, + { + { -241995632, -4554813, 776315, }, + { -102694280, -7847442, -87510, }, + { -219062128, 21616034, 1965484, }, + { -124360240, 4155918, 24159, }, + }, + { + { -267135696, 6463389, 639413, }, + { -136286832, 8490613, -1046361, }, + { -147398976, -16639777, 3440269, }, + { -95881920, -11134166, 1088774, }, + }, + { + { -292788992, -5709086, 300111, }, + { -174024560, -6152541, -881005, }, + { -90929824, 4872104, 1822677, }, + { -56544856, 7351911, 1556926, }, + }, + { + { -315248448, 4444755, 176094, }, + { -216430912, 5672578, 1190243, }, + { -63613836, 1815161, -973884, }, + { -14734959, -4429722, -980863, }, + }, + { + { -331795360, -2286533, 193810, }, + { -263258944, -11120744, 2431488, }, + { -60858612, -1745367, -1487132, }, + { 22258132, 7237557, -2788508, }, + }, + { + { -342355616, 841277, 440234, }, + { -309661760, 12847858, 1188095, }, + { -67215168, 2202781, -774705, }, + { 46283104, -5788006, -2136209, }, + }, + { + { -349583488, -577673, 766652, }, + { -346501312, -7875360, -385473, }, + { -66369056, 1041530, -863288, }, + { 49858664, 1305133, -173946, }, + }, + { + { -356901056, 1767379, 918049, }, + { -366997440, 160524, -299037, }, + { -49406084, -6653441, -853088, }, + { 30276836, 9475235, 200790, }, + }, + { + { -366345152, -3576634, 425202, }, + { -372272192, 4114579, 1374390, }, + { -19810000, 8818642, -529892, }, + { -6595459, -12531641, -1695438, }, + }, + { + { -377341856, 2646237, -90731, }, + { -370839296, -1026497, 2412698, }, + { 9653476, -7412040, -16106, }, + { -47739100, 6718403, -1707786, }, + }, + { + { -387915552, -1152125, 230854, }, + { -371675744, -3176665, 1544041, }, + { 25164214, 1859184, 654983, }, + { -82804288, -5714991, -727997, }, + }, + { + { -396796992, 1392643, 666794, }, + { -378056992, 4689031, -171262, }, + { 19768660, 6249178, 256624, }, + { -108289544, 1178432, 206695, }, + }, + { + { -403633504, -1648194, 535797, }, + { -387308864, -1229434, -613107, }, + { -2716030, -9990631, -1557463, }, + { -127641056, -3103114, 1093069, }, + }, + { + { -408498112, 863288, 293132, }, + { -395626080, 571231, 122407, }, + { -31068720, 5430986, -2434173, }, + { -147066656, 3565360, 1324461, }, + }, + { + { -411884672, -142271, 401579, }, + { -401592320, -314606, 565325, }, + { -54940148, 1724429, 31675, }, + { -169158896, -6089190, 1395864, }, + }, + { + { -414639904, 598074, 517544, }, + { -406241088, 1180579, 527744, }, + { -71434432, 2633889, 2132988, }, + { -191106720, 6543920, 594316, }, + }, + { + { -417352160, -893353, 362925, }, + { -411894336, -1373316, 320512, }, + { -82008640, -5202279, 586263, }, + { -206321104, -3711389, -562104, }, + }, + { + { -419996256, 636729, 215285, }, + { -420462816, 2209761, 267899, }, + { -86930136, -235686, -577673, }, + { -209848880, -3002182, -424665, }, + }, + { + { -422230720, -221728, 270583, }, + { -432432352, -2306398, 485868, }, + { -86706800, 3112778, 707059, }, + { -203022560, 5057324, 1082869, }, + }, + { + { -423848832, 489089, 251792, }, + { -446671776, 3304977, 759672, }, + { -83068424, 68183, 1319092, }, + { -192733440, -1730872, 1611150, }, + }, + { + { -424760992, 63351, 202937, }, + { -460961664, -3841848, 443455, }, + { -76892800, -1149441, -119722, }, + { -185762160, -2057289, 271120, }, + }, + { + { -425047680, -271657, 370441, }, + { -472584928, 1830193, 166430, }, + { -68005976, -2961380, -936303, }, + { -184923568, 1370095, -1126355, }, + }, + { + { -425072928, -341987, 346819, }, + { -479999104, 78920, 590021, }, + { -57284128, 6429566, 824634, }, + { -189367248, 2083059, -15032, }, + }, + { + { -424990784, 175020, 139050, }, + { -483562304, -411243, 1259499, }, + { -47154984, -1808718, 2434710, }, + { -197468640, 1500017, 1709934, }, + }, + { + { -424858176, 115964, 77846, }, + { -484666112, -1862405, 847719, }, + { -38233800, -2864743, 878321, }, + { -206326464, -4465156, 1128503, }, + }, + { + { -424940832, -514859, 297427, }, + { -483952096, 216359, -72478, }, + { -27022860, -1696512, -1106491, }, + { -210888800, 2183991, -452582, }, + }, + { + { -425639840, -178778, 540092, }, + { -481676288, 1781875, 128849, }, + { -10166724, 7968775, -143345, }, + { -207172576, 4294968, -323196, }, + }, + { + { -427088864, 1015760, 356482, }, + { -479221184, -1410897, 833761, }, + { 11272679, -7029251, 1931125, }, + { -195597648, -5826123, 1405528, }, + }, + { + { -428821344, -734976, -3221, }, + { -477736736, 622233, 1392643, }, + { 33686504, 441845, 1117228, }, + { -180261920, 1124745, 1406602, }, + }, + { + { -430334784, -178241, -29528, }, + { -476999616, 1311039, 1312649, }, + { 54553600, 3033321, -3351148, }, + { -164809712, 2705830, -1767379, }, + }, + { + { -431378464, 1071594, 520228, }, + { -476083168, -2218351, 50466, }, + { 72254768, 1032403, -7908646, }, + { -151465776, -1608465, -6150930, }, + }, +}; + const float leftHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -6196,6 +12332,310 @@ const float leftHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SB } }; +const Word32 leftHRIRImag_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { -91827472, 317236480, -98863704, }, + { -131005096, 193167232, -34935264, }, + { -8050380, 19192062, -6576669, }, + { -16915192, 18672370, -5312338, }, + }, + { + { -122729224, 256856768, -107804752, }, + { -251478928, -99211600, -118276424, }, + { -11542188, 14916958, -6755984, }, + { -32386738, 16429324, -1395328, }, + }, + { + { 54239532, -244900640, 44591424, }, + { -23413478, -467581824, -29682518, }, + { 997506, 14816027, -8756365, }, + { -15600932, 18149458, -2875481, }, + }, + { + { 220117072, -45366664, 74753368, }, + { 362508672, 117097448, 109974784, }, + { 21830246, 27549530, -9684614, }, + { 34092912, 30310658, -8868571, }, + }, + { + { 223175088, 142300320, 1409823, }, + { 544197568, 179799680, 43528956, }, + { 34919156, -21948894, 6631430, }, + { 97193496, -32147830, 2729989, }, + }, + { + { 79654464, -59800976, -39559332, }, + { 454156832, -134717024, -48993228, }, + { 13752485, -32286342, 6853694, }, + { 122940752, -17619566, 1726040, }, + }, + { + { -104061688, -7630010, -21617644, }, + { 216328368, 10750840, -49867256, }, + { -31508954, 22065932, -4387309, }, + { 86880744, 8264591, -2589865, }, + }, + { + { -240973440, 13051332, 6510097, }, + { -22812182, 23365696, -3999688, }, + { -69285336, -7475391, -7755637, }, + { -2561948, -22775674, 3018825, }, + }, + { + { -312108832, 8353712, 14778982, }, + { -195600864, 15555298, 20933134, }, + { -81934016, -17370458, -3028489, }, + { -117253144, 40628244, -170188, }, + }, + { + { -344269024, -17826262, 7607998, }, + { -309629568, -41896868, 13034689, }, + { -77344848, 11716671, 5335423, }, + { -210388432, -14371497, -5011690, }, + }, + { + { -364532672, 11803644, 40265, }, + { -389468160, 26263726, -153008, }, + { -82385528, 12043088, 4489852, }, + { -249460832, -14286672, 965831, }, + }, + { + { -380773536, -935766, -1196148, }, + { -445324224, -4230543, -1495722, }, + { -111708344, -12504260, 124554, }, + { -239833664, 7385197, 5639829, }, + }, + { + { -389682912, -2850785, 1179505, }, + { -477684128, -1794223, 2923799, }, + { -159179008, 11199664, 247497, }, + { -206065008, -8614631, 4379256, }, + }, + { + { -389125632, 2067490, 2549600, }, + { -488572384, -1506997, 3925600, }, + { -205428816, -7463580, 1919314, }, + { -171335376, 2811593, 2982855, }, + }, + { + { -381444096, -631360, 1968169, }, + { -484414880, -1114007, 2336462, }, + { -226298608, 986232, 2987150, }, + { -148377168, 3444564, -363998, }, + }, + { + { -370938080, 1025960, 766652, }, + { -474210560, 2183454, 1662152, }, + { -205100800, 6620155, 2010045, }, + { -132984000, 4664872, -1546725, }, + }, + { + { -360993088, -2371896, 439697, }, + { -466023808, -693100, 1343788, }, + { -139791520, -16778290, -210453, }, + { -115541064, -5763309, 226023, }, + }, + { + { -353560640, 1990717, 912681, }, + { -463320128, -323733, 1133335, }, + { -45342508, 24715926, -1067836, }, + { -90984048, 4257923, 55298, }, + }, + { + { -348975232, -579284, 1252520, }, + { -465747872, 1912871, 869731, }, + { 50002548, -22956064, 155693, }, + { -59099824, -6874095, -1229434, }, + }, + { + { -345565024, -584116, 925029, }, + { -471061824, -1830730, 382789, }, + { 116765128, 9101573, 934155, }, + { -25054692, 10072235, -651224, }, + }, + { + { -340056736, -837519, 359167, }, + { -476513184, -745714, 787590, }, + { 139741600, 5599027, -766115, }, + { 1874216, -4294968, 311922, }, + }, + { + { -329512032, 3326452, 347892, }, + { -479915360, 2155537, 2514703, }, + { 125933272, -9092983, -2538863, }, + { 13040594, -4439386, -1731409, }, + }, + { + { -313767776, -4133906, 525597, }, + { -479220096, 1701344, 2884608, }, + { 97017944, 6705518, -2516851, }, + { 5670968, 1434519, -2862596, }, + }, + { + { -295445440, 4591320, 667331, }, + { -470126592, -565325, 970663, }, + { 75033616, -697395, -1292248, }, + { -19925428, -3649112, -606127, }, + }, + { + { -278323008, -3292629, 802622, }, + { -447673024, -5935645, -395674, }, + { 71051104, -2177012, -416612, }, + { -61827664, 9865003, 1088774, }, + }, + { + { -265061760, 1615982, 630286, }, + { -412387200, 11010149, -35433, }, + { 81976432, 4446365, -627602, }, + { -112587200, -13473312, 853625, }, + }, + { + { -255525856, -602369, 188979, }, + { -371971552, -11827803, 1505386, }, + { 95436856, -5326297, 31675, }, + { -160003632, 10853919, -83215, }, + }, + { + { -247385824, 1291175, -201863, }, + { -337248896, 4990752, 2053531, }, + { 96728568, -2098092, 571231, }, + { -192391984, -3604015, -186294, }, + }, + { + { -238005072, -3346853, 132070, }, + { -314504352, 184684, 539018, }, + { 78651048, 6275484, 510564, }, + { -205117440, -2432562, 940061, }, + }, + { + { -226535360, 2879776, 651761, }, + { -301594208, -433792, -1168231, }, + { 45513232, -11270531, 24159, }, + { -202783120, 3430605, 2116345, }, + }, + { + { -213762128, -1999307, 403190, }, + { -291736736, -3833258, -1039919, }, + { 9752260, 9126806, -1229971, }, + { -194716640, -1034550, 2008434, }, + }, + { + { -200588400, 2588255, 24159, }, + { -280100576, 4541391, 303332, }, + { -15143518, -1603633, -1153199, }, + { -187583232, 324807, 1420560, }, + }, + { + { -187805504, -2961917, 123480, }, + { -266554256, -3057480, 780610, }, + { -23128936, -5175973, 1080184, }, + { -181926224, 722628, 860067, }, + }, + { + { -176120496, 2148021, 235686, }, + { -253305904, 2241436, 539555, }, + { -17506286, 2914135, 2852932, }, + { -173383536, 683437, -49392, }, + }, + { + { -165675680, -1682554, 77846, }, + { -242489552, -1381906, 229244, }, + { -5524402, 2670396, 750546, }, + { -157129760, -4080756, -759672, }, + }, + { + { -156013072, 1801202, -73014, }, + { -234474608, 1538135, 200790, }, + { 9308268, 3935801, -1162862, }, + { -132938904, 8243653, -340913, }, + }, + { + { -146564688, -2241436, 11274, }, + { -227799696, -1290101, 381715, }, + { 25715042, -6164352, 228707, }, + { -106540424, -7786239, 1059246, }, + }, + { + { -137148512, 1853278, 86973, }, + { -220042992, 1846836, 517007, }, + { 41445896, 2162516, 934692, }, + { -86086712, 1642825, 1195612, }, + }, + { + { -127902512, -1851131, 9127, }, + { -208989888, -1779727, 242129, }, + { 55510304, -83215, -464393, }, + { -75707392, 1755568, -283468, }, + }, + { + { -119002272, 2083059, 107374, }, + { -193420624, 4080219, -36507, }, + { 68245960, 3600793, -1138166, }, + { -73431056, -808528, -1282048, }, + }, + { + { -110767744, -1299765, 119185, }, + { -173817856, -5373004, 339839, }, + { 79296904, -5206037, 417149, }, + { -74193416, -2953327, -99321, }, + }, + { + { -103295040, 1255741, -75699, }, + { -152354304, 4845797, 751619, }, + { 87356952, 671089, 1484985, }, + { -73872904, 734976, 1438814, }, + }, + { + { -96434360, -1574642, -77846, }, + { -131264936, -2705293, 316217, }, + { 92803504, 3612068, -277562, }, + { -69830264, 1721745, 538482, }, + }, + { + { -90215248, 1533840, 112743, }, + { -111481784, 2989834, -623844, }, + { 98670968, 573915, -2318746, }, + { -59650116, 1540820, -1165010, }, + }, + { + { -84677968, -1045288, 243739, }, + { -92820688, -5504001, -319975, }, + { 106743360, -6097780, -1290638, }, + { -43329776, -6536940, -955630, }, + }, + { + { -79586280, 331786, 13959, }, + { -75807784, 3888556, 570694, }, + { 113984672, 2543158, 522375, }, + { -25049860, 5942624, 534723, }, + }, + { + { -74304008, -947577, -310848, }, + { -60786672, -2461553, 690953, }, + { 115839024, 4283156, -547071, }, + { -10739566, 200790, 307627, }, + }, + { + { -68309304, 1848447, -228707, }, + { -46586972, 1466731, 171262, }, + { 110702784, -5914707, -3579318, }, + { -3607773, -3080029, -1977833, }, + }, + { + { -61599496, -2068027, 153545, }, + { -31771484, -1588064, -951335, }, + { 99163816, 1153199, -4716411, }, + { -3590593, 390842, -3318936, }, + }, + { + { -54124640, 1265942, 319438, }, + { -15888158, 4613869, -1487132, }, + { 81348832, 1777043, -2140504, }, + { -10306311, 3014530, -1531693, }, + }, +}; + const float leftHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -6500,6 +12940,310 @@ const float leftHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SB } }; +const Word32 rightHRIRReal_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { 97523672, 405096480, 117391120, }, + { -168510352, 226681936, -72761040, }, + { 7752416, 62658204, -7288023, }, + { 23083838, 10139344, -8373576, }, + }, + { + { -91860224, -231391360, -85269600, }, + { 87150256, 545616512, -29677688, }, + { -4872641, 57707180, -5408975, }, + { -1218160, 32580012, 7697655, }, + }, + { + { -171940960, -134628432, -89749248, }, + { 368214528, -37159520, 138843408, }, + { -11674258, 43248712, 5395016, }, + { -37626060, 48839148, 9722195, }, + }, + { + { -48351668, 213029312, 16819628, }, + { 294134400, -328650368, 34809100, }, + { -7545721, 5860483, -10766409, }, + { -56161528, -5217849, -7862475, }, + }, + { + { 166833712, -29396904, 57186952, }, + { -41763724, 163917424, -77779176, }, + { 26105884, -27028766, -4032438, }, + { -19192598, -26607860, -4379256, }, + }, + { + { 316903104, -63921460, 13246753, }, + { -380145408, 47550120, -50608136, }, + { 64360084, 26156350, 7871065, }, + { 64651068, 31446140, 2492692, }, + }, + { + { 342714240, 40063992, -23562728, }, + { -562947776, -70490080, 20235738, }, + { 76979232, 18240190, 7850664, }, + { 157704224, -9568113, -242129, }, + }, + { + { 279815520, -2827162, -22232898, }, + { -587650304, -112743, 39622684, }, + { 58521076, -19127636, -1853278, }, + { 218817312, 18382996, -1549946, }, + }, + { + { 194067568, -7948911, -5098663, }, + { -529768096, 24970940, 15723875, }, + { 31035970, 14948634, -8168491, }, + { 219732144, 7948374, 3088082, }, + }, + { + { 123001424, -5282810, 5087926, }, + { -450608096, -378494, -4850092, }, + { 19481434, 16145856, -5490579, }, + { 157347744, -37542848, -2373506, }, + }, + { + { 67425616, 16203301, 3928821, }, + { -369236192, -28034862, -4899484, }, + { 28122372, -10347650, 1939715, }, + { 66008816, 19518478, -7190849, }, + }, + { + { 16583942, -16200617, -446677, }, + { -285353856, 26029112, 2506114, }, + { 36405752, -2548526, 1474248, }, + { -13980119, -5101348, -2355790, }, + }, + { + { -33802468, 10267119, -1898912, }, + { -201879040, -14075145, 3394635, }, + { 22816476, 7213935, -933082, }, + { -64834140, 4773320, 1056562, }, + }, + { + { -80765248, -6639483, -563714, }, + { -125787248, 11312944, 415538, }, + { -24745454, -13758928, -980863, }, + { -87778392, 4248260, 3027952, }, + }, + { + { -120569936, 5925445, 841277, }, + { -63367948, -11264625, -626528, }, + { -102320616, 17017734, 638340, }, + { -97495760, 4630512, 3665218, }, + }, + { + { -152345168, -6521908, 893890, }, + { -16718697, 7630010, -377957, }, + { -190588640, -18248242, 2711735, }, + { -108214384, -6749541, 830539, }, + }, + { + { -177624272, 5427765, 150861, }, + { 17577154, -5733782, -326418, }, + { -263011456, 15330349, 2882997, }, + { -121832120, 1862405, 221191, }, + }, + { + { -198991744, -3744138, -146566, }, + { 45709188, 5207111, -259846, }, + { -295502880, -4590247, 1115618, }, + { -133506912, -1175747, 1578937, }, + }, + { + { -219550144, 3167539, 266825, }, + { 72961832, -5575942, -307627, }, + { -277467232, -11616276, 259846, }, + { -136396880, 1964411, 1173063, }, + }, + { + { -241995632, -4554813, 776315, }, + { 102694280, 7847442, 87510, }, + { -219062128, 21616034, 1965484, }, + { -124360240, 4155918, 24159, }, + }, + { + { -267135696, 6463389, 639413, }, + { 136286832, -8490613, 1046361, }, + { -147398976, -16639777, 3440269, }, + { -95881920, -11134166, 1088774, }, + }, + { + { -292788992, -5709086, 300111, }, + { 174024560, 6152541, 881005, }, + { -90929824, 4872104, 1822677, }, + { -56544856, 7351911, 1556926, }, + }, + { + { -315248448, 4444755, 176094, }, + { 216430912, -5672578, -1190243, }, + { -63613836, 1815161, -973884, }, + { -14734959, -4429722, -980863, }, + }, + { + { -331795360, -2286533, 193810, }, + { 263258944, 11120744, -2431488, }, + { -60858612, -1745367, -1487132, }, + { 22258132, 7237557, -2788508, }, + }, + { + { -342355616, 841277, 440234, }, + { 309661760, -12847858, -1188095, }, + { -67215168, 2202781, -774705, }, + { 46283104, -5788006, -2136209, }, + }, + { + { -349583488, -577673, 766652, }, + { 346501312, 7875360, 385473, }, + { -66369056, 1041530, -863288, }, + { 49858664, 1305133, -173946, }, + }, + { + { -356901056, 1767379, 918049, }, + { 366997440, -160524, 299037, }, + { -49406084, -6653441, -853088, }, + { 30276836, 9475235, 200790, }, + }, + { + { -366345152, -3576634, 425202, }, + { 372272192, -4114579, -1374390, }, + { -19810000, 8818642, -529892, }, + { -6595459, -12531641, -1695438, }, + }, + { + { -377341856, 2646237, -90731, }, + { 370839296, 1026497, -2412698, }, + { 9653476, -7412040, -16106, }, + { -47739100, 6718403, -1707786, }, + }, + { + { -387915552, -1152125, 230854, }, + { 371675744, 3176665, -1544041, }, + { 25164214, 1859184, 654983, }, + { -82804288, -5714991, -727997, }, + }, + { + { -396796992, 1392643, 666794, }, + { 378056992, -4689031, 171262, }, + { 19768660, 6249178, 256624, }, + { -108289544, 1178432, 206695, }, + }, + { + { -403633504, -1648194, 535797, }, + { 387308864, 1229434, 613107, }, + { -2716030, -9990631, -1557463, }, + { -127641056, -3103114, 1093069, }, + }, + { + { -408498112, 863288, 293132, }, + { 395626080, -571231, -122407, }, + { -31068720, 5430986, -2434173, }, + { -147066656, 3565360, 1324461, }, + }, + { + { -411884672, -142271, 401579, }, + { 401592320, 314606, -565325, }, + { -54940148, 1724429, 31675, }, + { -169158896, -6089190, 1395864, }, + }, + { + { -414639904, 598074, 517544, }, + { 406241088, -1180579, -527744, }, + { -71434432, 2633889, 2132988, }, + { -191106720, 6543920, 594316, }, + }, + { + { -417352160, -893353, 362925, }, + { 411894336, 1373316, -320512, }, + { -82008640, -5202279, 586263, }, + { -206321104, -3711389, -562104, }, + }, + { + { -419996256, 636729, 215285, }, + { 420462816, -2209761, -267899, }, + { -86930136, -235686, -577673, }, + { -209848880, -3002182, -424665, }, + }, + { + { -422230720, -221728, 270583, }, + { 432432352, 2306398, -485868, }, + { -86706800, 3112778, 707059, }, + { -203022560, 5057324, 1082869, }, + }, + { + { -423848832, 489089, 251792, }, + { 446671776, -3304977, -759672, }, + { -83068424, 68183, 1319092, }, + { -192733440, -1730872, 1611150, }, + }, + { + { -424760992, 63351, 202937, }, + { 460961664, 3841848, -443455, }, + { -76892800, -1149441, -119722, }, + { -185762160, -2057289, 271120, }, + }, + { + { -425047680, -271657, 370441, }, + { 472584928, -1830193, -166430, }, + { -68005976, -2961380, -936303, }, + { -184923568, 1370095, -1126355, }, + }, + { + { -425072928, -341987, 346819, }, + { 479999104, -78920, -590021, }, + { -57284128, 6429566, 824634, }, + { -189367248, 2083059, -15032, }, + }, + { + { -424990784, 175020, 139050, }, + { 483562304, 411243, -1259499, }, + { -47154984, -1808718, 2434710, }, + { -197468640, 1500017, 1709934, }, + }, + { + { -424858176, 115964, 77846, }, + { 484666112, 1862405, -847719, }, + { -38233800, -2864743, 878321, }, + { -206326464, -4465156, 1128503, }, + }, + { + { -424940832, -514859, 297427, }, + { 483952096, -216359, 72478, }, + { -27022860, -1696512, -1106491, }, + { -210888800, 2183991, -452582, }, + }, + { + { -425639840, -178778, 540092, }, + { 481676288, -1781875, -128849, }, + { -10166724, 7968775, -143345, }, + { -207172576, 4294968, -323196, }, + }, + { + { -427088864, 1015760, 356482, }, + { 479221184, 1410897, -833761, }, + { 11272679, -7029251, 1931125, }, + { -195597648, -5826123, 1405528, }, + }, + { + { -428821344, -734976, -3221, }, + { 477736736, -622233, -1392643, }, + { 33686504, 441845, 1117228, }, + { -180261920, 1124745, 1406602, }, + }, + { + { -430334784, -178241, -29528, }, + { 476999616, -1311039, -1312649, }, + { 54553600, 3033321, -3351148, }, + { -164809712, 2705830, -1767379, }, + }, + { + { -431378464, 1071594, 520228, }, + { 476083168, 2218351, -50466, }, + { 72254768, 1032403, -7908646, }, + { -151465776, -1608465, -6150930, }, + }, +}; + const float rightHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -6804,6 +13548,310 @@ const float rightHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_S } }; +const Word32 rightHRIRImag_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= +{ + { + { -91827472, 317236480, -98863704, }, + { 131005096, -193167232, 34935264, }, + { -8050380, 19192062, -6576669, }, + { -16915192, 18672370, -5312338, }, + }, + { + { -122729224, 256856768, -107804752, }, + { 251478928, 99211600, 118276424, }, + { -11542188, 14916958, -6755984, }, + { -32386738, 16429324, -1395328, }, + }, + { + { 54239532, -244900640, 44591424, }, + { 23413478, 467581824, 29682518, }, + { 997506, 14816027, -8756365, }, + { -15600932, 18149458, -2875481, }, + }, + { + { 220117072, -45366664, 74753368, }, + { -362508672, -117097448, -109974784, }, + { 21830246, 27549530, -9684614, }, + { 34092912, 30310658, -8868571, }, + }, + { + { 223175088, 142300320, 1409823, }, + { -544197568, -179799680, -43528956, }, + { 34919156, -21948894, 6631430, }, + { 97193496, -32147830, 2729989, }, + }, + { + { 79654464, -59800976, -39559332, }, + { -454156832, 134717024, 48993228, }, + { 13752485, -32286342, 6853694, }, + { 122940752, -17619566, 1726040, }, + }, + { + { -104061688, -7630010, -21617644, }, + { -216328368, -10750840, 49867256, }, + { -31508954, 22065932, -4387309, }, + { 86880744, 8264591, -2589865, }, + }, + { + { -240973440, 13051332, 6510097, }, + { 22812182, -23365696, 3999688, }, + { -69285336, -7475391, -7755637, }, + { -2561948, -22775674, 3018825, }, + }, + { + { -312108832, 8353712, 14778982, }, + { 195600864, -15555298, -20933134, }, + { -81934016, -17370458, -3028489, }, + { -117253144, 40628244, -170188, }, + }, + { + { -344269024, -17826262, 7607998, }, + { 309629568, 41896868, -13034689, }, + { -77344848, 11716671, 5335423, }, + { -210388432, -14371497, -5011690, }, + }, + { + { -364532672, 11803644, 40265, }, + { 389468160, -26263726, 153008, }, + { -82385528, 12043088, 4489852, }, + { -249460832, -14286672, 965831, }, + }, + { + { -380773536, -935766, -1196148, }, + { 445324224, 4230543, 1495722, }, + { -111708344, -12504260, 124554, }, + { -239833664, 7385197, 5639829, }, + }, + { + { -389682912, -2850785, 1179505, }, + { 477684128, 1794223, -2923799, }, + { -159179008, 11199664, 247497, }, + { -206065008, -8614631, 4379256, }, + }, + { + { -389125632, 2067490, 2549600, }, + { 488572384, 1506997, -3925600, }, + { -205428816, -7463580, 1919314, }, + { -171335376, 2811593, 2982855, }, + }, + { + { -381444096, -631360, 1968169, }, + { 484414880, 1114007, -2336462, }, + { -226298608, 986232, 2987150, }, + { -148377168, 3444564, -363998, }, + }, + { + { -370938080, 1025960, 766652, }, + { 474210560, -2183454, -1662152, }, + { -205100800, 6620155, 2010045, }, + { -132984000, 4664872, -1546725, }, + }, + { + { -360993088, -2371896, 439697, }, + { 466023808, 693100, -1343788, }, + { -139791520, -16778290, -210453, }, + { -115541064, -5763309, 226023, }, + }, + { + { -353560640, 1990717, 912681, }, + { 463320128, 323733, -1133335, }, + { -45342508, 24715926, -1067836, }, + { -90984048, 4257923, 55298, }, + }, + { + { -348975232, -579284, 1252520, }, + { 465747872, -1912871, -869731, }, + { 50002548, -22956064, 155693, }, + { -59099824, -6874095, -1229434, }, + }, + { + { -345565024, -584116, 925029, }, + { 471061824, 1830730, -382789, }, + { 116765128, 9101573, 934155, }, + { -25054692, 10072235, -651224, }, + }, + { + { -340056736, -837519, 359167, }, + { 476513184, 745714, -787590, }, + { 139741600, 5599027, -766115, }, + { 1874216, -4294968, 311922, }, + }, + { + { -329512032, 3326452, 347892, }, + { 479915360, -2155537, -2514703, }, + { 125933272, -9092983, -2538863, }, + { 13040594, -4439386, -1731409, }, + }, + { + { -313767776, -4133906, 525597, }, + { 479220096, -1701344, -2884608, }, + { 97017944, 6705518, -2516851, }, + { 5670968, 1434519, -2862596, }, + }, + { + { -295445440, 4591320, 667331, }, + { 470126592, 565325, -970663, }, + { 75033616, -697395, -1292248, }, + { -19925428, -3649112, -606127, }, + }, + { + { -278323008, -3292629, 802622, }, + { 447673024, 5935645, 395674, }, + { 71051104, -2177012, -416612, }, + { -61827664, 9865003, 1088774, }, + }, + { + { -265061760, 1615982, 630286, }, + { 412387200, -11010149, 35433, }, + { 81976432, 4446365, -627602, }, + { -112587200, -13473312, 853625, }, + }, + { + { -255525856, -602369, 188979, }, + { 371971552, 11827803, -1505386, }, + { 95436856, -5326297, 31675, }, + { -160003632, 10853919, -83215, }, + }, + { + { -247385824, 1291175, -201863, }, + { 337248896, -4990752, -2053531, }, + { 96728568, -2098092, 571231, }, + { -192391984, -3604015, -186294, }, + }, + { + { -238005072, -3346853, 132070, }, + { 314504352, -184684, -539018, }, + { 78651048, 6275484, 510564, }, + { -205117440, -2432562, 940061, }, + }, + { + { -226535360, 2879776, 651761, }, + { 301594208, 433792, 1168231, }, + { 45513232, -11270531, 24159, }, + { -202783120, 3430605, 2116345, }, + }, + { + { -213762128, -1999307, 403190, }, + { 291736736, 3833258, 1039919, }, + { 9752260, 9126806, -1229971, }, + { -194716640, -1034550, 2008434, }, + }, + { + { -200588400, 2588255, 24159, }, + { 280100576, -4541391, -303332, }, + { -15143518, -1603633, -1153199, }, + { -187583232, 324807, 1420560, }, + }, + { + { -187805504, -2961917, 123480, }, + { 266554256, 3057480, -780610, }, + { -23128936, -5175973, 1080184, }, + { -181926224, 722628, 860067, }, + }, + { + { -176120496, 2148021, 235686, }, + { 253305904, -2241436, -539555, }, + { -17506286, 2914135, 2852932, }, + { -173383536, 683437, -49392, }, + }, + { + { -165675680, -1682554, 77846, }, + { 242489552, 1381906, -229244, }, + { -5524402, 2670396, 750546, }, + { -157129760, -4080756, -759672, }, + }, + { + { -156013072, 1801202, -73014, }, + { 234474608, -1538135, -200790, }, + { 9308268, 3935801, -1162862, }, + { -132938904, 8243653, -340913, }, + }, + { + { -146564688, -2241436, 11274, }, + { 227799696, 1290101, -381715, }, + { 25715042, -6164352, 228707, }, + { -106540424, -7786239, 1059246, }, + }, + { + { -137148512, 1853278, 86973, }, + { 220042992, -1846836, -517007, }, + { 41445896, 2162516, 934692, }, + { -86086712, 1642825, 1195612, }, + }, + { + { -127902512, -1851131, 9127, }, + { 208989888, 1779727, -242129, }, + { 55510304, -83215, -464393, }, + { -75707392, 1755568, -283468, }, + }, + { + { -119002272, 2083059, 107374, }, + { 193420624, -4080219, 36507, }, + { 68245960, 3600793, -1138166, }, + { -73431056, -808528, -1282048, }, + }, + { + { -110767744, -1299765, 119185, }, + { 173817856, 5373004, -339839, }, + { 79296904, -5206037, 417149, }, + { -74193416, -2953327, -99321, }, + }, + { + { -103295040, 1255741, -75699, }, + { 152354304, -4845797, -751619, }, + { 87356952, 671089, 1484985, }, + { -73872904, 734976, 1438814, }, + }, + { + { -96434360, -1574642, -77846, }, + { 131264936, 2705293, -316217, }, + { 92803504, 3612068, -277562, }, + { -69830264, 1721745, 538482, }, + }, + { + { -90215248, 1533840, 112743, }, + { 111481784, -2989834, 623844, }, + { 98670968, 573915, -2318746, }, + { -59650116, 1540820, -1165010, }, + }, + { + { -84677968, -1045288, 243739, }, + { 92820688, 5504001, 319975, }, + { 106743360, -6097780, -1290638, }, + { -43329776, -6536940, -955630, }, + }, + { + { -79586280, 331786, 13959, }, + { 75807784, -3888556, -570694, }, + { 113984672, 2543158, 522375, }, + { -25049860, 5942624, 534723, }, + }, + { + { -74304008, -947577, -310848, }, + { 60786672, 2461553, -690953, }, + { 115839024, 4283156, -547071, }, + { -10739566, 200790, 307627, }, + }, + { + { -68309304, 1848447, -228707, }, + { 46586972, -1466731, -171262, }, + { 110702784, -5914707, -3579318, }, + { -3607773, -3080029, -1977833, }, + }, + { + { -61599496, -2068027, 153545, }, + { 31771484, 1588064, 951335, }, + { 99163816, 1153199, -4716411, }, + { -3590593, 390842, -3318936, }, + }, + { + { -54124640, 1265942, 319438, }, + { 15888158, -4613869, 1487132, }, + { 81348832, 1777043, -2140504, }, + { -10306311, 3014530, -1531693, }, + }, +}; + const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { { @@ -7110,6 +14158,860 @@ const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_S const float FASTCONV_HRIR_latency_s = 0.000666667f; +const Word32 leftHRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= +{ + { + { 625042304, -38326140, 24910274, }, + { 335878240, 171201152, 7902740, }, + { 537386304, 24339580, 36527624, }, + { 610952640, -82900920, -32977296, }, + { 162773888, 291606816, 80030808, }, + { 672814144, -110260936, -35019552, }, + { 45806900, 473868032, 110131016, }, + { 704516928, -118449832, -48664128, }, + { 31259846, 506221504, 91921424, }, + { 555327488, 63325536, 28055264, }, + { 365311136, 194221648, 26628798, }, + { 616197376, -46350752, 6811282, }, + { 134318128, 374452416, 114475376, }, + { 584630400, -49424872, -314606, }, + { 269210176, 195440880, 39850856, }, + }, + { + { 615573504, -83027624, 23161684, }, + { 153939680, -135309728, -82342040, }, + { 509388480, -61414812, 27712740, }, + { 678085120, 133931576, 33365990, }, + { -32580012, -194236672, -63221920, }, + { 725016256, 115785872, 39330088, }, + { -56443924, -209270128, -145981104, }, + { 738054144, 93220656, 26321708, }, + { -50629612, -88218632, -142844176, }, + { 558783296, -111704584, -44579076, }, + { 235484464, -10732050, -31916976, }, + { 626338304, -79976048, -6355478, }, + { -55024972, -244054000, -73130944, }, + { 589115456, -29078540, 8979703, }, + { 53143240, -92013232, -23232014, }, + }, + { + { 613705728, 190158608, -87268368, }, + { -47502340, -225702144, 1009317, }, + { 500094176, 66390532, -18193482, }, + { 707738112, 53812184, 55165632, }, + { -160684384, -74954160, -65988952, }, + { 728532736, 116576688, 32762010, }, + { -24977920, -437184192, -53591528, }, + { 726640256, 153417312, 2280628, }, + { 6060199, -491625056, 15927886, }, + { 619300480, -227791104, -7439957, }, + { 68508488, -8391829, -511638, }, + { 642141120, 15699179, -49628348, }, + { -149295744, -68784976, -106736376, }, + { 583061120, 57918708, -26482768, }, + { -174591488, 17845590, -8568997, }, + }, + { + { 711792064, 274690016, -82055352, }, + { -246570320, -252771712, 25805774, }, + { 569176064, 166868064, -9373229, }, + { 639823424, -91681448, 10991895, }, + { -120591408, 45267880, -33620468, }, + { 661089408, -61773976, -25802552, }, + { 45526652, 26081726, 112846504, }, + { 689595136, 6112812, -45711872, }, + { 39781060, -244305248, 111033496, }, + { 685362944, -63247152, 47053516, }, + { -118973816, -45193256, 16270947, }, + { 687694592, 133942848, -11167989, }, + { -50758996, 267372992, -9620727, }, + { 595376448, 97235912, -13216688, }, + { -268843488, -18899466, -7071664, }, + }, + { + { 862057920, -196809360, 76299024, }, + { -363332768, -48200808, -38664368, }, + { 680975680, -66029752, 62313532, }, + { 517202656, 39182988, -13852343, }, + { 42142756, -224898448, 23900956, }, + { 578456384, -10711112, -26575110, }, + { 16899086, 240396304, 28621662, }, + { 675961792, -76532024, -7255274, }, + { -31825708, 272278368, -90252832, }, + { 694145088, 78392816, -15985868, }, + { -275402432, 19490024, 19011136, }, + { 699485376, 22428320, 29043106, }, + { 104157792, -106337488, 88669600, }, + { 594321984, 26122528, 13720810, }, + { -167101616, -96108480, -3835943, }, + }, + { + { 893755328, -228144912, 63108100, }, + { -278544192, 77761992, 6783364, }, + { 720438336, -255192992, -13665512, }, + { 399979552, 6000070, -7042136, }, + { 156205280, -23141820, 77895672, }, + { 512157120, 10667088, -5974837, }, + { -31854698, -64270964, -75585520, }, + { 667064256, 27399744, 34042448, }, + { -14828375, 393006144, -40407588, }, + { 722442496, 111037256, 533113, }, + { -356493568, -38231652, 11823508, }, + { 626011904, -82572360, -625992, }, + { 115784800, -171748224, 61668752, }, + { 536772128, -35543540, -3380139, }, + { 45074072, 72021768, 15156940, }, + }, + { + { 848944832, 184383488, -79126184, }, + { -73698416, 41248328, -20535312, }, + { 734158656, -104955576, -76299024, }, + { 328131200, -52250424, 26017302, }, + { 83268144, 220971232, 1210644, }, + { 478818528, -4858145, 3739306, }, + { -17207786, -185924832, -29459180, }, + { 647532864, 87085832, 14063334, }, + { 37145560, 13910862, 105687336, }, + { 766663488, 87857848, 5260261, }, + { -334238656, -15821586, -947040, }, + { 512291360, 14954002, -14906221, }, + { -16082505, 188711200, -38655244, }, + { 441034624, 10546829, -3133716, }, + { 202894256, -21919902, 18131742, }, + }, + { + { 900337344, 202598976, -76710264, }, + { 182968832, 166872896, -25620554, }, + { 774260736, 183863248, 31660888, }, + { 287297888, -74439840, 22798760, }, + { -58633820, -30077656, -56673168, }, + { 481663936, 8292508, 8747238, }, + { 24970940, 68754376, 57749056, }, + { 644221504, -19704236, -26892400, }, + { -9427453, -322418912, -27601070, }, + { 828069184, 40436044, -29763586, }, + { -206094544, 45814416, -1173063, }, + { 412233120, -1234803, -1341104, }, + { -114652008, 22880364, -75015360, }, + { 329985568, -20840256, 6089727, }, + { 209146112, -50087908, 9846749, }, + }, + { + { 1047088896, -194659728, 43730284, }, + { 366514784, -87303264, 40976672, }, + { 742656192, 139103248, 52795884, }, + { 272615008, 16188805, -11766063, }, + { -114707304, -54439248, -33390686, }, + { 510879904, 21948356, -520765, }, + { 17126718, 143042272, 28806346, }, + { 699449920, -91850024, -6042482, }, + { -24763170, -206299632, -69475392, }, + { 919253440, -104362336, 10414759, }, + { -14831059, -71486512, 9839770, }, + { 358785984, 5443334, 4399657, }, + { -63852204, -181701280, -10722923, }, + { 235267568, 42878804, -1713155, }, + { 77541336, 88224000, -13798119, }, + }, + { + { 1123982208, -105683040, 55635932, }, + { 328002368, -158853120, 19053012, }, + { 635256832, -136615936, -37422052, }, + { 308759840, 62324808, 1898912, }, + { -54308788, 119649200, 13070659, }, + { 567933696, 23300734, -9535901, }, + { -19162534, -72129144, -44424996, }, + { 789915904, 13496935, 18928458, }, + { 20692616, 124913752, 58988692, }, + { 959227776, -50255412, 22593138, }, + { 169172320, 1418413, 5950677, }, + { 362694944, -3298535, -1773285, }, + { 54667956, 60081760, 48018808, }, + { 193888240, 11763915, -7717520, }, + { -84051976, -10931766, -20318954, }, + }, + { + { 1061163456, 129533528, -23348516, }, + { 115933512, 54171348, -20616916, }, + { 550549824, -101550208, -32472638, }, + { 375784928, -266288, 15702937, }, + { 45247480, -22406844, 44503916, }, + { 652130624, -41226856, 1646046, }, + { -17834314, -101530880, -31956704, }, + { 872475392, 27085674, -3548180, }, + { 8262444, 212076896, 22017076, }, + { 921522816, 53132504, -10414222, }, + { 293410688, -7770670, -11642046, }, + { 410655776, -33762736, -339302, }, + { 94559608, 61743376, 34906272, }, + { 215555280, -39306468, 7264401, }, + { -169639392, -46001784, 9142912, }, + }, + { + { 933114368, 22093848, -32720672, }, + { -121721520, -43738336, -8097624, }, + { 494997664, 19759534, 23136452, }, + { 444172096, -36144296, -12401718, }, + { 75576392, -114045880, 3667365, }, + { 733825792, -1081258, 2262374, }, + { 14139032, 87575992, 32541356, }, + { 939120896, 32734094, -12346420, }, + { -19392852, 7123204, -55031952, }, + { 852432896, -9301289, -18699750, }, + { 337437312, 5166309, -13647259, }, + { 472952672, 23739894, 11385958, }, + { 25549150, -84922776, 491237, }, + { 268112256, -3453154, 10877542, }, + { -152883648, -14016626, 17564806, }, + }, + { + { 808061568, 12100533, -4268661, }, + { -269692256, 7937100, -2384781, }, + { 423107424, 58875412, 14115947, }, + { 507483136, -62690416, -14868640, }, + { 38092064, 6757594, -32236950, }, + { 786537344, -938987, -7950522, }, + { 18486612, 77123120, 34720516, }, + { 974787392, -12577812, 1095217, }, + { 1819992, -147699632, 6068252, }, + { 789703808, -11702712, -6681896, }, + { 289339072, -1104880, -3964792, }, + { 519936384, 28106802, 3049427, }, + { -67787472, 68001680, -30844308, }, + { 320355168, 12771085, -5028870, }, + { -55746528, 10052908, -11537356, }, + }, + { + { 710308672, -16774532, -5884105, }, + { -264577504, 33274186, 2607582, }, + { 337924256, -31025770, -6185827, }, + { 532032096, 22328462, 13090523, }, + { -10758893, 44742820, -5711233, }, + { 795033344, 9193914, -5691369, }, + { -10329396, -93899256, -23986856, }, + { 953060224, -46311020, -9642738, }, + { 13652090, -58238144, 38045896, }, + { 745974592, 75162, 3201898, }, + { 153929488, -34870840, 5812165, }, + { 552490112, -8643085, -15971373, }, + { -79250736, 42124504, -40099424, }, + { 359595072, 18285286, -9487583, }, + { 79966920, 67082556, -16285442, }, + }, + { + { 634855232, -24634858, 3785477, }, + { -141451520, -45782204, 6092411, }, + { 254404336, 7821136, -4571456, }, + { 477775936, 54230404, 9673877, }, + { -45016088, -10459319, 21311628, }, + { 744544960, 14347875, 413927, }, + { -18442052, -56763900, -35335768, }, + { 872367424, 952409, -17485886, }, + { -5615670, 84819160, -16463683, }, + { 706909760, 23321672, -1428077, }, + { -37825776, 60159608, 3164854, }, + { 584314176, -42927660, -8116415, }, + { 5742372, -135769280, 3150359, }, + { 369367712, -11576011, -375810, }, + { 172647488, -49075908, 8621610, }, + }, + { + { 538955072, -13040594, 24205362, }, + { 15072651, 50944216, 13710072, }, + { 187226752, -5189394, 2030446, }, + { 367362496, -49736796, -9050570, }, + { -50834696, -49825380, 8231305, }, + { 638520448, -28745680, 1804423, }, + { 5716602, 87666192, 13341242, }, + { 736861248, 15118285, 10206453, }, + { -9424232, 56697328, -25742424, }, + { 649502144, -17821430, -9939091, }, + { -219684352, -36769752, -482110, }, + { 598292672, 6328635, 7124277, }, + { 81932408, 45398880, 53095460, }, + { 334426016, -10021232, 5326833, }, + { 149414400, -23850490, 21712134, }, + }, + { + { 397379488, 104956656, 5082557, }, + { 125673968, 17753784, 9321690, }, + { 149467008, 2914135, 4262755, }, + { 257603008, 8898098, -11051488, }, + { -20718922, 27423366, -28011776, }, + { 506127552, 32068374, 2290828, }, + { 20265266, 5883569, 42024644, }, + { 544590016, 78309064, 19809462, }, + { 7227893, -67430448, 20556250, }, + { 556742656, -2592550, -1637993, }, + { -321714528, 9211631, 1069984, }, + { 567954112, 30062086, 1427540, }, + { 52476984, 129614056, 30575336, }, + { 260188048, 30055108, 3881577, }, + { 18473192, 89390080, 6312528, }, + }, + { + { 258143104, -34475704, -23410792, }, + { 162220384, -35226784, -14843944, }, + { 143663440, 850404, 3514357, }, + { 196611248, 29874718, 7045894, }, + { 39367672, 96164856, -16363289, }, + { 391071808, -25950730, 772557, }, + { -3548180, -142337904, -8863739, }, + { 343604896, -82419352, -5340792, }, + { 7097434, -70594232, 19371376, }, + { 416423392, -35428112, 9055402, }, + { -306525920, 20317880, 2103997, }, + { 494898880, -19892678, -4767951, }, + { -42094436, -123787936, -41830296, }, + { 171719776, -38439956, -6002754, }, + { -125548336, -57329760, -18460306, }, + }, + { + { 186234608, -56275344, -2545842, }, + { 149700544, -15543487, -19137300, }, + { 165364288, -8795019, 3685619, }, + { 207906480, -11742977, 21865142, }, + { 74812960, -56720412, 33527588, }, + { 342108096, -9793599, 3819837, }, + { -22778896, -28792388, -50524920, }, + { 224280512, -4655745, -12516608, }, + { -10169946, 55358908, -28482612, }, + { 240936384, 58211304, 3536906, }, + { -185469568, -39997420, 2193118, }, + { 395104256, 23114440, -3353296, }, + { -74164424, -86611776, -47780436, }, + { 105167104, -6638409, -7066295, }, + { -173409840, -28682866, -19873350, }, + }, + { + { 179931744, 12965433, 22897544, }, + { 105323872, 22173842, 1312113, }, + { 207433504, 2630131, 1804423, }, + { 303123744, -13679471, 8104604, }, + { 30630634, -85687280, 33305860, }, + { 392402720, 24051816, 9910100, }, + { 6169721, 159945648, 18145700, }, + { 236913616, 52297132, 6293201, }, + { -2450279, 113075216, -6314676, }, + { 74994424, -41807748, -5413270, }, + { -14849313, 42407432, 1881733, }, + { 288295936, -18919330, -2345052, }, + { -10800769, 124163744, 16718697, }, + { 77771656, 19129784, 6313065, }, + { -94409288, 83413632, 5292474, }, + }, + { + { 207316464, 32352914, 8996346, }, + { 28367722, 11352135, 17681306, }, + { 260098928, -1567663, -5674726, }, + { 493192160, -18697604, -19944218, }, + { -55946780, 123041688, -25584584, }, + { 544934720, -18092012, 1531693, }, + { 20092930, 83791056, 44481364, }, + { 367152064, -42682312, 18682570, }, + { 11063836, 15476378, 30881352, }, + { -38214472, 3738769, -4303021, }, + { 133796288, -29187524, 2644626, }, + { 197532528, -1098438, 5455146, }, + { 52898964, 14692009, 39791260, }, + { 79354888, 1855963, 11523934, }, + { 39827768, -23616414, 17642652, }, + }, + { + { 255391104, -3300682, -12565464, }, + { -69984344, -64994668, 7815230, }, + { 309282752, 20043538, -7486665, }, + { 754250496, 88805968, -26157962, }, + { -81857248, 52066816, -46926276, }, + { 773598784, 38256884, -16646756, }, + { -7791071, -102232032, -24181202, }, + { 563862080, 4434554, 3325915, }, + { -3101503, -88045216, -9091372, }, + { -87747256, 15495168, 6041945, }, + { 207639120, -3164317, 795643, }, + { 138111120, -15164993, 10856067, }, + { 46018964, -69473240, 9407052, }, + { 103952704, -7817378, 4638565, }, + { 130414000, -16855600, 1413581, }, + }, + { + { 314552672, -41536092, -8077223, }, + { -153698624, 52211768, -22286586, }, + { 332848704, -26689464, 4923107, }, + { 993195648, -101502424, -251792, }, + { -13014288, -137779872, 9877351, }, + { 1013642368, -73787000, -18562312, }, + { -14167486, -78821240, -29317446, }, + { 768001344, -13456669, -25697326, }, + { -8565239, -48564804, -23686208, }, + { -99047848, 2668785, 10101763, }, + { 197247984, 20113332, -4068945, }, + { 126544232, 16342887, 2228014, }, + { -9654550, 48223892, -18820546, }, + { 158825200, -2674154, -4586488, }, + { 130527280, 6726993, -6411313, }, + }, + { + { 357153376, 23606214, 8338142, }, + { -173407152, 80022760, -10335839, }, + { 311526848, -16561931, 13072807, }, + { 1076533504, -11509975, 15732465, }, + { 60987460, -6754373, 41550588, }, + { 1159097344, 47392816, -2072859, }, + { 5602785, 54272280, 18927920, }, + { 918634432, 72778760, -22099754, }, + { 6779606, 63433444, 19216220, }, + { -104071352, -11424076, 4241280, }, + { 133954128, -19498078, -5927592, }, + { 182078704, 12781823, -7573101, }, + { -46579456, 18314278, -20225000, }, + { 249549952, 27696634, -7901666, }, + { 50426136, -12663711, 3757560, }, + }, + { + { 354743360, 22876606, 8448201, }, + { -125086088, -64300492, 37410240, }, + { 263105408, 37308772, 4003983, }, + { 935057856, 98520104, -1078037, }, + { 59869696, 90144920, 3503083, }, + { 1110528256, 38748660, 6838125, }, + { 9542880, 47780436, 17816598, }, + { 936150912, -29707216, 10800769, }, + { 4467303, 80529024, 12106976, }, + { -115432080, 2697776, 1560684, }, + { 60918204, 12298639, -4695473, }, + { 298056224, -43240656, -7306813, }, + { -27349278, -44630616, -2356327, }, + { 360583456, -39258684, -2423972, }, + { -58851788, 43766252, 4701916, }, + }, + { + { 311553696, -29218662, -2420751, }, + { -43643848, -73751568, 23637890, }, + { 249098976, -7734699, -6087043, }, + { 627708416, -90942712, -14872935, }, + { 5525476, -15845208, -22711788, }, + { 851950272, -100369088, 317828, }, + { -1866700, -29127394, -9088151, }, + { 758959936, -100101728, 13643500, }, + { -7909719, -9968619, -22215718, }, + { -129383744, -5531381, 2185602, }, + { 6927246, -2215666, -2097018, }, + { 428251712, 44209172, 894964, }, + { 18997714, 28491202, 12160663, }, + { 449487648, 13390634, 525060, }, + { -125575184, -25443386, -8341900, }, + }, + { + { 261459888, 8723615, -6206228, }, + { 70837968, 58482960, -45040248, }, + { 325033472, -26867168, -9676561, }, + { 283930080, 67042292, -12214887, }, + { -40947680, -31508954, -4011500, }, + { 471827392, 110132624, -9797894, }, + { -7194607, -11471858, -12919262, }, + { 422992000, 129837400, -14223321, }, + { -559956, -64124936, -1170916, }, + { -133630928, 3575024, -60666, }, + { -25354802, -2267743, 1309428, }, + { 506878624, -6169184, 4694936, }, + { 39726300, 7045894, 15430207, }, + { 474422624, 6671158, -2348273, }, + { -102008696, -30327300, -11685532, }, + }, + { + { 240484880, 14042396, -132607, }, + { 217952944, 121817624, -52187072, }, + { 494514496, 60224568, -7513509, }, + { 20397336, -24781962, -4145180, }, + { -48454212, -5237176, 7024419, }, + { 108569792, -68455336, -13811004, }, + { -1296543, 28807420, 542777, }, + { 50323596, -54717348, -17939542, }, + { 7339562, -6582038, 20469814, }, + { -115864792, 11620034, -204548, }, + { -52311628, -2201708, 4130685, }, + { 491351776, -30665530, -1449552, }, + { 14101451, -45034880, 3508452, }, + { 420662528, -21121576, -2969433, }, + { -7735773, 56921200, 1196685, }, + }, + { + { 270012256, -23244364, 9095667, }, + { 302108544, -145636432, 25764972, }, + { 695182848, -53615688, -2393908, }, + { -111943488, -11172821, 7976291, }, + { -17125108, 6622840, -6611029, }, + { -130551976, 1461900, -3079492, }, + { 6505802, -8606578, 12640626, }, + { -250304256, 20928302, 3484292, }, + { -2710661, 67228048, -7895224, }, + { -75185016, -18063558, 3986804, }, + { -89183920, 11238319, 4881767, }, + { 386935200, 44014288, -10276783, }, + { -25879862, 31284004, -15047955, }, + { 302272832, 38888780, -4435091, }, + { 83388400, -25720412, 13156559, }, + }, + { + { 357181280, 13597866, 10020159, }, + { 186142272, -78747152, 69059320, }, + { 826062336, 10807748, -4036733, }, + { -136869872, 11004243, 16057272, }, + { 30802432, 40938556, -4883915, }, + { -225224320, 22747758, 14950781, }, + { 2662343, -36271000, 3084860, }, + { -434281856, -19651086, 14351096, }, + { -5504001, 47386376, -15182709, }, + { -19873888, 9534291, 5590437, }, + { -132748848, -15060303, 3321620, }, + { 232506976, -29129542, -11449846, }, + { -32341104, 26803818, -15712064, }, + { 154529696, -33919504, -7061463, }, + { 104971688, -25116432, 9660992, }, + }, + { + { 504227008, -10380936, -2932926, }, + { -114229488, 228196448, 14908368, }, + { 808694016, 22711788, -7024956, }, + { -107239424, 5180805, 11981348, }, + { 52182780, -21744882, 14767171, }, + { -224969856, -5100811, 21272974, }, + { -5783711, 8522826, -12138651, }, + { -503597248, 4022774, 13465796, }, + { 5198521, -30551176, 14821932, }, + { 44385804, -1563368, 157303, }, + { -158316784, 4875325, 1993939, }, + { 67911488, 13307956, -1172526, }, + { -302258, -49360448, 4401805, }, + { 13918378, 13386339, -2522220, }, + { 51097224, 43914968, -3702799, }, + }, + { + { 701803008, 31803160, -19734838, }, + { -376732512, -105936976, -52158084, }, + { 622177024, -62460100, -6384469, }, + { -59612000, -13386876, -1971927, }, + { 20867636, -43538084, 14351096, }, + { -186044032, -19776714, 9260486, }, + { -2908230, 31246960, -3704946, }, + { -485769920, 526134, 8494372, }, + { 2085744, -53198000, 5521718, }, + { 117180664, 9884330, -6997039, }, + { -134485088, 9373229, 1622961, }, + { -86978456, -23970750, 8986145, }, + { 28893318, 8454106, 18998250, }, + { -101843336, -9178345, 6937983, }, + { -27663884, -22535156, -12045236, }, + }, + { + { 904283328, -64888364, -21122112, }, + { -372928800, -118043416, -44813688, }, + { 301261344, 95022392, -11047193, }, + { -6813966, -10190884, -11519102, }, + { -33595772, 58286464, -11398306, }, + { -133000104, 10397042, -9189083, }, + { 4401268, -8411157, 9586904, }, + { -414447712, -6669011, -659278, }, + { -5110474, -309238, -14335527, }, + { 192929392, -26497264, -6411850, }, + { -45639932, -19439022, -1628866, }, + { -223085440, 39593692, 6857989, }, + { 20511154, 46442556, 7100118, }, + { -191062688, 25187836, 7979513, }, + { -72546832, -16858820, -6147709, }, + }, + { + { 1020359680, 49040472, -3064996, }, + { -97977864, 172937392, 5498095, }, + { -83678848, -74016784, -12161737, }, + { 36763848, 26569204, -6542309, }, + { -51643760, 16670916, -23394150, }, + { -73004784, 22681186, -14823006, }, + { 3170760, -21297132, 4604205, }, + { -324642624, 17212082, -8062728, }, + { 271657, 39352100, 1069984, }, + { 250592544, 19866908, 323733, }, + { 91595544, 28620588, -8014409, }, + { -325997696, -26555782, -1130113, }, + { -10849624, -29150480, -13490492, }, + { -250334320, -19998978, 541703, }, + { -62478888, 26125212, 6773164, }, + }, + { + { 950758144, 45088028, 7181722, }, + { 230774496, -94694368, 33468532, }, + { -466968160, 41601052, 4842039, }, + { 38146824, -9856413, 4327717, }, + { -12726525, -71256728, 816044, }, + { -34454764, -30524332, -4786741, }, + { -3117073, 13539348, -7080791, }, + { -263279888, -25294674, -5777805, }, + { 4219806, 10428181, 11727945, }, + { 262986752, 8453033, 1917703, }, + { 224959120, -37230388, -9239548, }, + { -382932832, -1334124, -1830193, }, + { -24196772, -24077586, -11637214, }, + { -273468608, -2460480, -2448131, }, + { -19270982, -700617, 7786239, }, + }, + { + { 662759616, -123762704, -7464117, }, + { 372294208, -19914690, 33813740, }, + { -810661120, -51490752, 24456618, }, + { -34016676, -30839476, 7538205, }, + { 35114580, 11368242, 20448340, }, + { -70069704, -1327145, 8199093, }, + { -3339874, 17280800, -5366562, }, + { -282629248, 8960376, 7567196, }, + { -1795296, -34127272, -5259188, }, + { 219165200, -27831388, -4094178, }, + { 282418784, 23540716, 503048, }, + { -400790240, 10691784, 3843459, }, + { -8269960, 26900454, 3402688, }, + { -267513104, 12243878, 891743, }, + { 25067576, -6487011, -2902324, }, + }, + { + { 221894656, 116763520, -22308598, }, + { 242817056, 136962208, 7746511, }, + { -1080360960, 71046816, 23397908, }, + { -178594944, 59281288, -1345399, }, + { 40003864, 38815232, 8348343, }, + { -215943984, 54989540, 10739029, }, + { 2113124, -13751948, 5187247, }, + { -410339552, 47098076, 15241765, }, + { -3170760, -24517820, -8753680, }, + { 131049656, 24807732, -8782671, }, + { 210557552, 27944668, 10531797, }, + { -405466400, -171799, 6650220, }, + { 13361643, -3181497, 8449811, }, + { -255399696, -5711770, 3862786, }, + { 50663436, -10238665, -5988795, }, + }, + { + { -262315664, -71206264, -12941273, }, + { -31068720, -130587944, -33651604, }, + { -1221106432, -40506372, 7044820, }, + { -352367712, -35716948, -6782827, }, + { 5936719, -27122718, -7492034, }, + { -448329088, -80601504, 1251983, }, + { 3185792, -11842835, 5377299, }, + { -610926336, -79132624, 5086315, }, + { 3089692, 21311628, 8769786, }, + { 18001282, -15389405, -5661841, }, + { 21592948, -75939320, 6671695, }, + { -422662912, -11905649, 4202626, }, + { 17416630, -10782515, 4671851, }, + { -262331776, -7301445, 3401077, }, + { 46805480, 9417253, 2310156, }, + }, + { + { -707435904, 51271172, 11145977, }, + { -226603008, -18327162, -38191388, }, + { -1183006336, -31270046, -1832877, }, + { -500287456, 8203388, 2072859, }, + { -28250684, 2456721, -9917616, }, + { -683104320, 48995376, -4758287, }, + { -1089848, 12928925, -2975339, }, + { -786317248, 39530880, -5663988, }, + { 1455994, 33645164, 3847754, }, + { -111193480, 20921322, 501437, }, + { -192634112, 63155348, -4294431, }, + { -461840512, 15453292, 817654, }, + { 2214593, 16510391, -981400, }, + { -300300896, 16017544, 1114544, }, + { 13194140, 15024869, 6694244, }, + }, + { + { -1078223616, -68621232, 23726474, }, + { -224664912, 108171432, 4175782, }, + { -973332992, 83570936, 3840775, }, + { -591696192, -11749957, 9123047, }, + { -30763776, 19509352, -3448859, }, + { -830735232, -6813429, 331786, }, + { -3073049, 4521527, -5551782, }, + { -840708736, 18293340, -2704756, }, + { -3465502, -2225867, -9803263, }, + { -260984768, -36910412, 1418950, }, + { -311184352, -5189394, -6243809, }, + { -515333248, -12192875, -68719, }, + { -14047227, -9365176, -6448894, }, + { -362049088, -16235513, 537, }, + { -30389042, -25724706, 301185, }, + }, + { + { -1362811904, 77688440, 13334263, }, + { -85414552, -51876764, 32028108, }, + { -671621760, -84929760, 12796318, }, + { -624009344, 13232257, 3234110, }, + { -3631395, -17330730, 3491809, }, + { -855872064, -12947179, 4281546, }, + { 216896, -15168214, 1034550, }, + { -747763456, -48717276, 4341138, }, + { 352724, -30451318, 1169305, }, + { -439059488, 42351060, -1467805, }, + { -265382800, -39658116, -1537061, }, + { -567934784, 5772973, 1864553, }, + { -12868259, -11892764, -6317897, }, + { -427521056, 10568304, 1278290, }, + { -51245404, 6357626, -6984691, }, + }, + { + { -1546537216, -24615532, 2499134, }, + { 57335128, -21424908, 14519674, }, + { -387294912, 44589276, 12475806, }, + { -614494912, 9084930, -2698850, }, + { 22578106, 1583232, 3779034, }, + { -790453312, 28467044, 3361349, }, + { 3117073, 118112, 6264747, }, + { -561839168, 52027624, 6072010, }, + { 2966749, -11570642, 8281234, }, + { -644597312, -28553480, 3214783, }, + { -83245592, 55242408, -1686848, }, + { -603926656, 3766150, 6805376, }, + { 3478387, 23061826, 2260227, }, + { -473488992, -205085, 5046587, }, + { -31689880, 19377282, -6148246, }, + }, + { + { -1607233664, -59374164, 24469502, }, + { 120469000, 22543210, -11138461, }, + { -194259760, -6671695, 2132988, }, + { -591490560, -34621196, 7472170, }, + { 24184424, -1061394, 4543539, }, + { -702711936, -44425532, 11446625, }, + { 248571, 18603650, -70867, }, + { -377655392, -42054172, 6758131, }, + { -1819456, 23494544, -5267778, }, + { -852840896, 11351062, 22712324, }, + { 128841504, -56617868, -2202245, }, + { -604490880, -11200201, 13851806, }, + { 14465987, -4428648, 10028749, }, + { -478025024, -8836358, 10008348, }, + { 11824582, -26652956, 1130113, }, + }, + { + { -1516199168, 58139900, 60329796, }, + { 99128920, 3651796, -10679973, }, + { -95059440, -290984, -6617471, }, + { -570893504, 23903640, 28049358, }, + { 3212636, -14644765, 6335077, }, + { -640622272, 31571768, 31884226, }, + { -3208341, -1371168, -7168838, }, + { -266206912, 23772644, 13987635, }, + { -1759863, 24443732, -4776004, }, + { -995970176, -21615496, 41095320, }, + { 247099664, 32651416, 7637526, }, + { -542421632, 7269232, 14501957, }, + { 6749004, -25076704, 4926328, }, + { -421268096, 9819369, 10045929, }, + { 41754600, 11839077, 8631811, }, + }, + { + { -1227817856, 31887448, 36262944, }, + { 31780610, 2109366, 4351876, }, + { -41796476, -6394670, -8111583, }, + { -526691296, 30912490, 26707180, }, + { -21230560, 42835856, -9363566, }, + { -582211840, 34218004, 32887102, }, + { -296353, -21707302, -4295, }, + { -226947680, 16712255, 18204756, }, + { 2781528, -8465917, 8039642, }, + { -966141632, 51030652, 20940114, }, + { 205733232, 29428580, 19158776, }, + { -389149280, -6488085, -1595044, }, + { -9344238, 25553444, -10163503, }, + { -290937312, -11132555, -1483911, }, + { 33305324, 17487496, 9344238, }, + }, + { + { -702422016, -12524662, -63307816, }, + { -34587372, -31123480, 4677757, }, + { 13409962, 10168335, -9574019, }, + { -395849408, -55143620, -19904490, }, + { -22231288, 18446348, -21504902, }, + { -443376992, -79262008, -21980568, }, + { 3506841, 831613, 8366060, }, + { -192801616, -61860412, -7623030, }, + { -288837, -30697206, -807991, }, + { -676510528, -4662724, -44772348, }, + { 45564236, -99012952, 7204808, }, + { -144633568, 41230076, -25599616, }, + { -11819750, 21961778, -11959873, }, + { -98791224, 36429376, -16961362, }, + { -3271691, -40654548, -3177202, }, + }, + { + { -2837900, -263309408, -104393472, }, + { -62903556, 22214108, -11652783, }, + { 83321288, -27225260, -9924059, }, + { -140510384, -68141264, -63327684, }, + { 8424041, -95043328, 15469935, }, + { -159801776, -62714576, -81861536, }, + { -774705, 31915902, -3386582, }, + { -88226680, 2919504, -50476604, }, + { -2260227, -16823386, -6184753, }, + { -164298608, -202133504, -72149544, }, + { -109439528, 88497264, -31301184, }, + { 129524936, -112725712, -21399674, }, + { 3622805, -46176268, 10753524, }, + { 102797360, -79412872, -12246026, }, + { -31066036, 12406013, -17940078, }, + }, + { + { 621364224, 460767840, 43075300, }, + { -39567924, 46573552, -9427453, }, + { 141969600, 41977936, 2921115, }, + { 173183280, 253221616, -8589398, }, + { 22793392, -57216480, 28717226, }, + { 208237728, 318084736, -17783848, }, + { -2685428, 21849036, -7056632, }, + { 94066224, 175970720, -26878980, }, + { 2145336, 14760192, 6643778, }, + { 354849664, 357099680, 32628330, }, + { -143160928, 64352032, -39194796, }, + { 317177952, 112315008, 26720066, }, + { 10445897, -34724272, 13976360, }, + { 230905488, 66931696, 18525804, }, + { -21392158, 55930676, -4970888, }, + }, + { + { 821677696, 19742890, 188074464, }, + { 8250096, -53528716, 19508816, }, + { 149194272, -2103460, 19142132, }, + { 366368768, -121583544, 100727720, }, + { -2042257, 85702848, -23702314, }, + { 447949504, -178254032, 129330056, }, + { 2202245, -13095355, 6751689, }, + { 249170912, -161775312, 71844600, }, + { -533650, 32718524, -1122597, }, + { 576970880, -17979806, 144182048, }, + { -50550692, -170051712, 27342298, }, + { 317480224, 68158448, 50017040, }, + { -1150514, 37701760, -12638478, }, + { 223188512, 53187800, 29809758, }, + { 7964480, -27748710, 20958366, }, + }, + { + { 468054272, -778914880, -37406480, }, + { 25666188, -61740156, 13222057, }, + { 90884192, -81121728, 2451353, }, + { 283284224, -362074880, 32602560, }, + { -7944079, 107862200, -10186052, }, + { 350218624, -463973504, 48184700, }, + { 53150, -31307628, -1322850, }, + { 226416176, -237868704, 52872120, }, + { -569083, 32280438, -673236, }, + { 362591328, -576002368, -16647293, }, + { 40658308, -44644036, 57304528, }, + { 145049104, -242396672, -31521302, }, + { -3433826, 53061100, -4096862, }, + { 100901128, -152861648, -22567906, }, + { 13876502, -64969972, 4359929, }, + }, +}; + const float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= { { @@ -7964,6 +15866,860 @@ const float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= } }; +const Word32 leftHRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= +{ + { + { 5232344, 17252346, -539555, }, + { -135520176, 194871264, -54369992, }, + { -22220550, 117874840, -40396316, }, + { 11720966, -108904264, 36866924, }, + { -107257680, 255896304, -73097656, }, + { 11458436, -134486704, 49912352, }, + { -50680076, 336556864, -124497144, }, + { 8897562, -128660576, 50126028, }, + { -43055436, 307590528, -120338008, }, + { 10245644, 73467024, -31177704, }, + { -119941256, 172604528, -50995756, }, + { -908386, -22171694, 13412646, }, + { -103657424, 351444832, -110692048, }, + { -13219372, -29753386, 17103634, }, + { -139419472, 198506944, -49185964, }, + }, + { + { 30917858, -50915228, -27016954, }, + { -305028032, 178966992, -27285390, }, + { -31333398, 17824652, -79691504, }, + { -27201102, -118149720, 33646236, }, + { -180582976, 181514448, -78655344, }, + { -25593174, -154673584, 44513576, }, + { -32651416, 465500896, -72493680, }, + { -21735756, -183458992, 31233540, }, + { -8945343, 553823680, -21647708, }, + { 46176804, 103967736, -27739584, }, + { -271011904, 228043440, 6618008, }, + { -21784610, -92931280, -13600551, }, + { -154800288, 253057328, -131308960, }, + { -57660472, -99732360, -5020280, }, + { -288599264, 110345760, -48391932, }, + }, + { + { 99568616, -139327136, -15360414, }, + { -324153536, 9072045, 47385836, }, + { 46054396, -314262752, 41872708, }, + { -148029808, 81420232, -18759344, }, + { -52845276, -129020816, 7718056, }, + { -120695560, 51905752, -15993921, }, + { 49320720, -72422272, 121334976, }, + { -86364816, 64855080, -57959508, }, + { 48910012, 135625936, 140061024, }, + { 79715664, -68266896, 35842040, }, + { -347903616, 196710576, 28915330, }, + { -46603616, -98206040, -14537391, }, + { 3573950, -296180416, 41096932, }, + { -100602096, -66857072, -14718853, }, + { -211719872, -73775728, 8290361, }, + }, + { + { 158430064, 109539384, 60192356, }, + { -238983248, -109216184, -20186346, }, + { 99478424, -106365936, 113992192, }, + { -268344720, -942208, -20194936, }, + { 108341624, 68608344, 33007898, }, + { -190794256, 31733902, -4362613, }, + { 17487496, -307243712, 28120224, }, + { -105947176, 126534568, -27926952, }, + { -23633058, -389901440, -67944776, }, + { 47435768, -191150208, -8434779, }, + { -342148384, 121005872, -7304666, }, + { -92741232, -11922829, 27136140, }, + { 137140448, -296890, 113191712, }, + { -144703888, 2766496, 20560008, }, + { -370978, 66400196, 11968463, }, + }, + { + { 108209552, 185416416, 46416248, }, + { -18681498, -206867632, -19592568, }, + { 32727650, 247064240, -21903796, }, + { -329999520, -24774446, -2032593, }, + { 156707248, -9570261, 57924076, }, + { -212032336, -13562970, 13310641, }, + { -37249716, 38208564, -89804544, }, + { -104133096, -3824132, 22079890, }, + { -28955596, -346057312, -82060720, }, + { 9917616, -101770864, -34786552, }, + { -226855872, 54367844, 4613332, }, + { -200631344, 115047680, -3089155, }, + { 88293256, 239106192, 33024004, }, + { -231136352, 84634480, 1288490, }, + { 199597872, -60316912, 18438832, }, + }, + { + { -18214956, -250354720, -92994632, }, + { 223436016, -51390356, -4157528, }, + { -57046828, 54381264, -80257904, }, + { -314948864, 58884000, 23173496, }, + { 29657286, -269596704, -5538361, }, + { -186629744, 5942088, 11245298, }, + { -15848966, 209089216, -23430120, }, + { -111910744, -61173756, 839666, }, + { 37234144, 136140800, 105880608, }, + { 6058052, -12533251, 5679021, }, + { -54005456, 101106752, -8387535, }, + { -303604800, 5211943, -23613730, }, + { -62708672, -138673760, -66732516, }, + { -322043104, 10297721, -10102300, }, + { 244338000, -47463684, 16740709, }, + }, + { + { -54721104, -251287792, -88000656, }, + { 351504416, -67618888, -30714384, }, + { -113102056, -200841264, 31799938, }, + { -261045968, 42209328, 19190988, }, + { -118671560, 776852, -75185552, }, + { -135094976, 1285269, 3442416, }, + { 28601798, -63060856, 69197832, }, + { -105192872, 9150428, -24213416, }, + { 2437394, 384751776, 6705518, }, + { -12818330, 46677168, -22034792, }, + { 144857440, -12532715, 753767, }, + { -339585888, -34845068, 849867, }, + { -123130808, -83513488, -70629128, }, + { -376464608, 1576253, 6109591, }, + { 117476480, 73857872, -443992, }, + }, + { + { -10631655, 188114192, 68762424, }, + { 326040096, 49028664, 22428320, }, + { -210201600, -159242352, 61620432, }, + { -201035072, -18813568, -14765024, }, + { -114390552, 143538880, -20566988, }, + { -80505400, 2159295, -3675955, }, + { 16927540, -165660640, 29322278, }, + { -70205536, 60418916, -11065983, }, + { -32559610, 127769912, -91239064, }, + { -37865504, 94677184, -2071785, }, + { 297682560, 66001300, 1824287, }, + { -309382048, 12906377, 11574400, }, + { -28137942, 205611360, 12385075, }, + { -382446432, -11492796, 1540283, }, + { -73100344, -77344304, -18161806, }, + }, + { + { -77725488, 196784128, 67276368, }, + { 108923056, 190376032, 10649908, }, + { -352566336, 153094112, -37377488, }, + { -127077344, -64507724, -8101382, }, + { -4843650, -76424112, 31541702, }, + { -34963720, -2215666, -9452686, }, + { -22453552, 70792872, -51737176, }, + { -33504504, -29388314, 15022185, }, + { 17081622, -231734960, 49876920, }, + { -114809848, 67806256, 22993644, }, + { 356293312, 44757856, 889595, }, + { -239530320, 944893, 752156, }, + { 90251760, -22021908, 66466768, }, + { -332159872, -19122806, -6287296, }, + { -192860672, -19954954, -18575196, }, + }, + { + { -277781312, -167457552, -35618700, }, + { -169595904, -62544388, -30911954, }, + { -434085376, 112163608, -35138740, }, + { -58242976, 19576460, 13532368, }, + { 88578872, 6706592, 41794864, }, + { -3717294, 35752920, -918049, }, + { -17199734, 127037080, -28944858, }, + { -43709884, -68236832, -158377, }, + { 16502875, -232059760, 46335716, }, + { -259441792, -90892784, -12786118, }, + { 302439776, -23015120, -15345918, }, + { -164977216, 30413738, -1911797, }, + { 86459840, -128010424, 25755846, }, + { -245588384, 51877300, 4899484, }, + { -172616352, 74084968, 11601244, }, + }, + { + { -479058496, -34588984, -41318660, }, + { -325007168, -33243584, -8560407, }, + { -453216224, -58082452, 32525250, }, + { -30136712, 55057184, -7392176, }, + { 79122960, 135242608, -1163399, }, + { -6920803, 18053896, 5795522, }, + { 16492674, -71891848, 38566120, }, + { -104778408, -209380, -16012175, }, + { -21474300, 47109884, -60942900, }, + { -397912064, -312996, -21223044, }, + { 171231216, 24038932, -9402757, }, + { -118827248, -10425496, 7212861, }, + { -13937706, 81356880, -24482388, }, + { -170254656, 3934727, 10257993, }, + { -55324548, -9509058, 19807852, }, + }, + { + { -601780224, 43026984, 9757629, }, + { -299565376, 35366372, 8828842, }, + { -474717888, -72621992, 25129854, }, + { -41837812, 31529354, -16467441, }, + { 1726577, -15290620, -40343164, }, + { -61786864, -31823560, -5519570, }, + { 18072148, -81266688, 33348810, }, + { -201226192, 67109, 2428804, }, + { -2217814, 185003568, -5108327, }, + { -490028928, 20321100, 1631014, }, + { -2594697, -20058034, 2413235, }, + { -118403656, -31147102, 808528, }, + { -87570088, -6750078, -36289788, }, + { -139467248, -25146496, -6270653, }, + { 75520560, -19526532, -10375030, }, + }, + { + { -655855488, 25572236, 16110422, }, + { -132337072, -58881316, 8665097, }, + { -501111008, 30430380, -9394704, }, + { -91855928, -22336514, 14292041, }, + { -49204756, -74647608, -5505075, }, + { -155968512, 5469641, -3663607, }, + { -12157442, 97756680, -27805618, }, + { -336846240, 58492624, 1365800, }, + { 16540993, 44654240, 46456512, }, + { -548054464, 10231149, 11157251, }, + { -176553760, 33840048, 11727945, }, + { -150341040, 24950002, -15178414, }, + { -58025544, -70031592, -23076322, }, + { -148966640, -8432095, -10384694, }, + { 161219120, -49005040, -15503221, }, + }, + { + { -677316864, 14061186, 9455907, }, + { 70368744, 40104256, 7168301, }, + { -505640608, 25171730, -6891275, }, + { -189773664, -74050072, 12053289, }, + { -53633940, 6905234, 24492588, }, + { -274234208, -24685324, 5230197, }, + { -18511310, 73076184, -34952980, }, + { -492537184, -25987774, -7692287, }, + { -4431870, -109918952, -13494250, }, + { -599594048, -23166516, 4469451, }, + { -306285408, -42193220, 5999533, }, + { -191659696, 30705258, -6935836, }, + { 38758320, 112756312, 18760418, }, + { -190430256, 6300180, 2592550, }, + { 155024704, 18436684, 11340861, }, + }, + { + { -703675648, 6285148, 19589346, }, + { 201780240, -15927349, 6103149, }, + { -480631552, -14164802, 4212289, }, + { -289732576, 36455684, -11339787, }, + { -26402774, 37356016, 6506339, }, + { -392567520, 29936458, 4489852, }, + { 8114267, -85212688, 19082002, }, + { -637229248, -15723875, 13287555, }, + { -11103027, -59286116, -30707406, }, + { -666988032, 24908662, -3487514, }, + { -342789920, -1901597, -1787243, }, + { -247421792, 2945811, 11980811, }, + { 87287160, 509491, 50570020, }, + { -257889696, 23130010, 7347616, }, + { 45361296, 54193360, 18922016, }, + }, + { + { -745239104, -65278672, 3823058, }, + { 218355600, -34307660, 480499, }, + { -427974176, 13306882, 4248797, }, + { -328094688, 20603494, -9194451, }, + { 16760573, -17125108, -23188528, }, + { -472696032, -13945222, 2480344, }, + { 18897320, -29428580, 37408092, }, + { -753866624, -50825568, 22191022, }, + { 6292664, 70817032, 18086644, }, + { -752061120, 3488587, 2753074, }, + { -262117552, 39137352, 463856, }, + { -333270144, -49004504, 5350456, }, + { 26259430, -141933104, 14274324, }, + { -328640160, -23949274, 2633352, }, + { -102069360, -82435456, -2142115, }, + }, + { + { -754358400, 10646150, -22409528, }, + { 144449952, 51578264, -16460999, }, + { -357978016, -12630962, 2121714, }, + { -285058048, -47072840, 8100845, }, + { 55548960, -74437152, -11065983, }, + { -484483040, -2369211, 765041, }, + { -3855270, 108625088, -8880919, }, + { -806595392, 50464792, -6066105, }, + { 8435316, 56591564, 22964116, }, + { -842413824, 19781008, 13151727, }, + { -92471184, -44889924, 1385664, }, + { -431250688, 22603876, -4613332, }, + { -65707096, 88061328, -49775988, }, + { -372310304, 17492864, -4533875, }, + { -180423520, 15318001, -21953188, }, + }, + { + { -684178112, 95209224, -2731062, }, + { 44034688, 8211441, -15715822, }, + { -287447136, 12063489, 279173, }, + { -179376624, 21377126, 15723875, }, + { 54791972, 38640212, 32280438, }, + { -417241056, 28506234, 754841, }, + { -22044994, 1953673, -47797080, }, + { -744435968, 54001160, -14835891, }, + { -8842264, -70665632, -25028922, }, + { -913782720, -34616364, 5817533, }, + { 101118560, 45958296, 417686, }, + { -510893888, -4614943, -121870, }, + { -69034616, 108603080, -42297912, }, + { -367728128, 21326660, -4706211, }, + { -127882648, 64976412, -14567455, }, + }, + { + { -564688896, -35052840, 25179782, }, + { -42392400, -21832930, 8923331, }, + { -228388112, -6603512, -1784559, }, + { -45775760, 11540040, -2239826, }, + { -7439420, 99392520, 24076512, }, + { -287786976, -36048736, 3089155, }, + { 4673998, -168884560, 13025562, }, + { -578127296, -82212656, 6925098, }, + { -4969814, -100874824, -13440026, }, + { -928045824, -1262184, -3357591, }, + { 243358208, -19028316, -324270, }, + { -554744960, 3474092, 3419331, }, + { 15159624, -137618272, 30216706, }, + { -317898976, -36552856, 7756711, }, + { 15227807, -86528024, 12173011, }, + }, + { + { -456805216, -32255742, 6639483, }, + { -112510424, -23877870, 18947786, }, + { -189299072, 1576253, -5324686, }, + { 84136264, 11220602, -24946780, }, + { -75048112, -87878256, -31089658, }, + { -142671296, 12062953, -4116726, }, + { 22120156, -68032816, 49400712, }, + { -386223872, 31193810, 14438069, }, + { 10969883, 14823006, 30617748, }, + { -868519680, 35133368, -316217, }, + { 284063232, -5093295, -1347546, }, + { -553373760, 14804752, 6683506, }, + { 68075232, -55910812, 46515568, }, + { -251979296, 713501, 10266582, }, + { 136529488, 2549063, 20943334, }, + }, + { + { -378490784, -996969, -17370996, }, + { -156559072, 38678864, 4654134, }, + { -177369808, -8266739, -4779225, }, + { 164008688, -47361140, -20721606, }, + { -63569812, -68194416, -41852308, }, + { -41226856, -7129109, -16905528, }, + { -7510824, 127864400, -22777822, }, + { -250573216, 15700790, -3388192, }, + { -351650, 98158256, -1477469, }, + { -758244288, -43934296, 9135932, }, + { 221876944, 31637802, -2272038, }, + { -509314400, -7141457, 8430484, }, + { 32112934, 97078608, -2900177, }, + { -189582544, 6276558, -1442035, }, + { 150665312, 52821120, -552440, }, + }, + { + { -328674528, 40242232, -8975945, }, + { -151924800, -20779588, -18118856, }, + { -197082096, 10024454, 5124433, }, + { 121245856, 23868208, 8290361, }, + { 23447300, 142530640, 18077518, }, + { -43131672, 14383309, -12541841, }, + { -17070348, 82138032, -36723044, }, + { -222328448, -24732570, -24415816, }, + { -10189273, 27262842, -28318866, }, + { -643103680, 13499619, 10624138, }, + { 98813240, -37815576, -5346161, }, + { -433130816, -2343979, -1904281, }, + { -32130650, -23995982, -29850560, }, + { -130950328, 6957310, -9563818, }, + { 66393216, -25447144, -11730629, }, + }, + { + { -316999200, -14724222, 9760850, }, + { -82459080, -81389632, -9319542, }, + { -243403856, 21904334, 10335302, }, + { -99811816, 84763328, 21679384, }, + { 80673984, 31187906, 46925204, }, + { -198692160, 24356222, 7185481, }, + { 6947647, -79027400, 22248468, }, + { -320020704, -14198088, -14484777, }, + { 5288716, -85655072, 15171972, }, + { -556219712, 2996277, 857383, }, + { -23347980, 18650358, -4894652, }, + { -335211456, -24299852, -10462540, }, + { -50790672, -43757664, -17422534, }, + { -80444200, -19557134, -8613020, }, + { -48816600, 7784092, 60666, }, + }, + { + { -347980928, -34109556, 8020315, }, + { 28313498, 68919728, 29562796, }, + { -287355328, -37504728, -2088965, }, + { -463089824, -142948320, 688269, }, + { 43435004, -117633784, -2157147, }, + { -511685216, -97947264, 14437533, }, + { 11658152, -67379984, 22993108, }, + { -545768448, -23956790, 19153406, }, + { 6668474, -75892608, 18337362, }, + { -496568000, 10121090, -3943854, }, + { -100530152, -2284386, -539555, }, + { -244320288, 33477122, -5918465, }, + { -11123428, 53504556, 7702487, }, + { -58093192, 16689706, -701690, }, + { -125293856, -21958020, 3791383, }, + }, + { + { -396235424, 28530394, -5670968, }, + { 121521808, 72422816, 14588393, }, + { -282284032, -7220914, -12603045, }, + { -828566848, 74083352, -14059575, }, + { -29173566, 10940355, -32751274, }, + { -900029696, 114861920, 3750043, }, + { -3834869, 36973764, -14339822, }, + { -871949760, 122431264, 20877836, }, + { -7813620, 29796872, -22095460, }, + { -446641152, -12294881, -1540820, }, + { -124764504, -6745246, 2953864, }, + { -208990432, -14132590, 3662533, }, + { 35043712, -7324530, 17977122, }, + { -93645320, 16217797, 3842922, }, + { -118506736, 918586, -7269769, }, + }, + { + { -419816416, 8409546, -7485055, }, + { 177756880, -53181360, -43604120, }, + { -214271616, 35051228, -9516574, }, + { -1052510208, -350577, -2594160, }, + { -58577984, 59515360, -5730023, }, + { -1222012160, -62816044, -4646081, }, + { -8056822, 27921046, -14477261, }, + { -1199319168, -109910896, -8547522, }, + { -2239289, 70632888, -5808944, }, + { -391830400, 9975598, -1738388, }, + { -115676888, 8247948, 5041755, }, + { -266380320, -31537408, 6293738, }, + { 37157372, -27774480, 10413685, }, + { -199360032, -39514236, 302795, }, + { -31960462, 46750720, -7976828, }, + }, + { + { -396419040, -24897388, 826781, }, + { 199287552, -94219232, -37252936, }, + { -130629816, -32934882, -3066070, }, + { -1081162496, -33790120, 10034117, }, + { -33716568, -9487583, 13584982, }, + { -1362517120, -8376260, -2020782, }, + { 79457, -27114128, 4269735, }, + { -1395718912, -11603928, -10591926, }, + { 7618198, -1657857, 21300890, }, + { -326496960, -19525996, -1824824, }, + { -99994888, -1045288, 5325760, }, + { -410237024, 55961812, -733366, }, + { -1633698, 41486164, -4496294, }, + { -351074912, 34980900, -888521, }, + { 73531984, -48038136, 6064494, }, + }, + { + { -333237920, 21934934, 6692096, }, + { 136010880, 91286848, 39137352, }, + { -113062864, 3367791, 2892124, }, + { -955450368, 55922084, 16620987, }, + { 12907987, -13196824, -686121, }, + { -1298857728, 66461936, 10081362, }, + { 6760816, 1138703, 12552042, }, + { -1401256192, 60880624, 15841450, }, + { -1005559, -65381212, -3132642, }, + { -258166192, 19531900, 1465658, }, + { -90000504, -4531728, 3397856, }, + { -588642432, -44282724, -6445672, }, + { -35472136, -13742822, -16918950, }, + { -504519072, -33069100, 473520, }, + { 120281096, -2138357, 13868986, }, + }, + { + { -254524592, -2734284, 2728378, }, + { -61631708, 124418760, 64017560, }, + { -230375600, 51568600, 2342905, }, + { -770130560, -32261646, 16159814, }, + { 46897820, -24514062, -4051228, }, + { -1104524928, -65782256, 21886616, }, + { 2195265, 32971390, 1871532, }, + { -1255872000, -36322540, 23219666, }, + { -6711960, -24285356, -18641232, }, + { -201167680, -5025649, 1708860, }, + { -76220104, 3022046, 135828, }, + { -739942336, 13878650, -3015604, }, + { -25882010, -39599060, -10532870, }, + { -617759616, 16445430, 190589, }, + { 77534360, 47942036, 4677220, }, + }, + { + { -187215472, -7235410, -10152766, }, + { -302229856, -201453824, -6583648, }, + { -488476288, -75664976, -1499481, }, + { -608733248, 6152541, 4904316, }, + { 40810244, 9884867, 11841762, }, + { -889736320, 22035866, 17557826, }, + { -6236293, -10264972, -12664785, }, + { -1036020224, 34490196, 10843182, }, + { 4205310, 55413132, 12076374, }, + { -163429408, -4794794, -3781182, }, + { -38071128, 9797894, -2145336, }, + { -828692992, 8045548, 7798050, }, + { 13130789, 43269112, 10496363, }, + { -667675776, 8978092, 4118337, }, + { -14405857, -42557220, -9413495, }, + }, + { + { -160387504, -1212255, -19085760, }, + { -372883168, 9153112, -65391952, }, + { -823048896, 74214888, 928250, }, + { -502844576, 3480534, -8838506, }, + { -5722507, 47615080, 8771397, }, + { -725349632, 5845988, -944893, }, + { -2830920, -35772244, -3490735, }, + { -809384448, -33443836, 322123, }, + { 3865471, 58133992, 10559177, }, + { -145547856, -523986, -8354249, }, + { 35654672, -20708722, -2545305, }, + { -854448832, -1685238, 14260902, }, + { 33141042, 9367324, 18559090, }, + { -659427776, -14470282, 10415833, }, + { -82688320, 1826435, -12265353, }, + }, + { + { -216790624, 7305740, -11348914, }, + { -163187280, 201135472, -33787432, }, + { -1140422784, -67091148, 2142115, }, + { -447214016, 13685913, -13014288, }, + { -49104360, -39777304, -14513768, }, + { -622485696, 1927367, -16253230, }, + { 5139465, 7147900, 11028939, }, + { -621990720, 24934970, -7023882, }, + { -5451387, -9884330, -15425375, }, + { -151061520, 8894877, -4932770, }, + { 130730216, 20885352, -3863860, }, + { -831482048, -8508330, 7725036, }, + { 12105365, -50302120, 1881196, }, + { -613759936, 203474, 8196945, }, + { -83483960, 32781338, -2046015, }, + }, + { + { -404893024, 25424058, 9195525, }, + { 185291872, -169782208, 30771830, }, + { -1356832256, 19707458, 4005057, }, + { -434513248, -21893058, -2569464, }, + { -41713260, -31788126, -19857244, }, + { -568107648, -28803124, -13408351, }, + { 3011309, 25533580, 4052839, }, + { -497736256, -24537686, -8870718, }, + { -689342, -44617196, -1606855, }, + { -191575936, 2828236, 2968896, }, + { 208048208, -13804562, -6235219, }, + { -767861248, -8555038, -2246268, }, + { -20891258, 22090090, -17161078, }, + { -545730880, -3384971, -1339493, }, + { -29853244, -30506078, 9749039, }, + }, + { + { -739606272, -100307352, 17949206, }, + { 398036096, -5266167, 44648868, }, + { -1428731648, 29643864, 17725330, }, + { -470966240, -4185983, 9080098, }, + { 10814728, 70556112, 6454262, }, + { -565363712, 21619792, 3001109, }, + { -3702262, -11188927, -8196408, }, + { -451304960, 16711181, -1861868, }, + { 4640176, -5299453, 12935905, }, + { -275544704, -30096446, 4315906, }, + { 219822864, 5193689, -3836480, }, + { -670961920, 34142844, -2099702, }, + { -24570972, 37352256, -10452877, }, + { -462515904, 25297894, -3964255, }, + { 29928406, -4066260, 7910793, }, + }, + { + { -1158839040, 133191232, 3401077, }, + { 320299872, 114648784, 17737678, }, + { -1360001408, -29389388, 28477780, }, + { -553707200, 34342020, 9373766, }, + { 48848812, 1812476, 23652922, }, + { -629009216, 16498043, 14461692, }, + { -3304977, -18860812, -5110474, }, + { -484815360, 2575370, 9782862, }, + { -1039919, 36833104, -3190087, }, + { -390961216, 37847788, -1415192, }, + { 135019280, 15649787, 5561983, }, + { -562095808, -33288144, 4657355, }, + { 581968, -30288646, 8622147, }, + { -378714656, -26498338, 1365800, }, + { 58433032, 15504295, -4299263, }, + }, + { + { -1534202624, -69030864, -7241315, }, + { 29576218, -145640736, -14351096, }, + { -1168657408, 18329310, 17115982, }, + { -649110784, -39743480, 20401, }, + { 31003222, -59195388, 4426501, }, + { -744678592, -49221400, 11759620, }, + { 2608119, 14380624, 6142340, }, + { -568391680, -36477156, 13024488, }, + { -3774740, 17121888, -10470057, }, + { -508062944, -21304648, -3766150, }, + { -33743412, -50315540, 11559368, }, + { -469737888, 12621298, 6405407, }, + { 20067698, -9561134, 10832444, }, + { -315902368, 10422812, 4415227, }, + { 50327888, 2709051, -6794102, }, + }, + { + { -1751132288, -13207024, 7250442, }, + { -246708288, 73049880, -39247412, }, + { -862555584, -51076288, -4444218, }, + { -702395712, 1078574, -4603131, }, + { -14945949, 21788370, -14555107, }, + { -849413504, 41333156, -40802, }, + { 3284039, 15173046, 5415417, }, + { -631552384, 39072392, 281857, }, + { 2523830, -29244432, 7238094, }, + { -601198784, 3279745, 1770063, }, + { -217172336, 63978908, 4052839, }, + { -408027264, 255014, 2056753, }, + { 14478335, 20039780, 1262184, }, + { -285526752, 3602941, 2639258, }, + { 17275970, -4272419, 2461016, }, + }, + { + { -1774035712, 41514616, 28337658, }, + { -311022208, 84281752, -26998702, }, + { -463400128, 103843184, -11556683, }, + { -673888960, 36447628, 4330401, }, + { -38556460, 16538308, -10299332, }, + { -860121984, 13616120, -5515275, }, + { -1606318, -12928388, -4128537, }, + { -589480512, 21443698, -10248329, }, + { 2370822, -30808338, 6453725, }, + { -663360384, -3179350, 8325257, }, + { -313834336, -20128902, -7716983, }, + { -367748000, 2401424, -1614371, }, + { -5477694, -12163884, -4982162, }, + { -279149792, -5903970, -234076, }, + { -24133958, -15887621, 5986111, }, + }, + { + { -1633565056, -29656750, 29936996, }, + { -153765200, -139129024, 20012936, }, + { -41030360, -112123344, -2557653, }, + { -567753856, -29372744, 10521059, }, + { -22300008, -26103200, 1022739, }, + { -733468224, -61831424, 1477469, }, + { -3102040, -8038568, -5382668, }, + { -406942240, -78030968, -4046933, }, + { -3411815, 11391864, -9660992, }, + { -699962112, 10571525, 8303246, }, + { -254887520, -47447576, -7445326, }, + { -326485152, -11907797, -1275068, }, + { -17091822, -501974, -6423661, }, + { -272977376, -2227478, -886374, }, + { -50830400, 18388366, -1570347, }, + }, + { + { -1375184640, 31143344, 11145977, }, + { 61715460, 32014150, 39172788, }, + { 300763136, 64285460, 5029407, }, + { -418000160, 20066088, 2936684, }, + { 12705050, 14372571, 7395934, }, + { -501899136, 63888176, 6962142, }, + { 612570, 13727252, 1901060, }, + { -136055440, 77131168, 5029407, }, + { -515933, 32912334, -1219234, }, + { -712420736, -4226785, 4772783, }, + { -62121332, 72037336, 844498, }, + { -264470672, 20142322, 1314260, }, + { -8580271, 16182900, -2963528, }, + { -242160992, 13138842, 776852, }, + { -42459508, 6663642, -7353521, }, + }, + { + { -1027720192, -77440408, -3391414, }, + { 173917728, 60976724, 8347806, }, + { 483799072, -339839, 655519, }, + { -260935904, -33547452, -3558381, }, + { 30398168, 9349607, 5104569, }, + { -247261808, -51369956, 4529043, }, + { 3087008, 1705102, 5864778, }, + { 119048440, -45323180, 4776004, }, + { 3295314, 5176510, 9279277, }, + { -688588480, -17838610, 6984154, }, + { 158658240, -48439180, 2936684, }, + { -172061760, -25860534, 3860102, }, + { 9170292, -17559974, 4941360, }, + { -172681840, -21907018, 2871723, }, + { -2390149, -26675506, -3151432, }, + }, + { + { -607247168, 129044440, 7869991, }, + { 148426560, -44091060, -21153788, }, + { 504355872, -35570920, -10821707, }, + { -122338920, 43845172, 3470334, }, + { 16774532, -11637751, 798864, }, + { -42919072, 41804528, 5733782, }, + { 70330, -16952772, -434865, }, + { 271430656, 12314208, 1133335, }, + { -1134945, -27432492, -3331284, }, + { -601181056, 36340256, 16134582, }, + { 284485760, 14280229, 1416802, }, + { -46436648, 27926414, 4838281, }, + { 14782741, -4701916, 8718784, }, + { -63385664, 26146688, 3585761, }, + { 38227892, 19090592, 4918275, }, + }, + { + { -131955888, -102776416, 23400592, }, + { 50165220, -2446521, -14534706, }, + { 429276064, 26648124, -16449725, }, + { -5843840, -23798414, 13560285, }, + { -10225243, 10250476, 235149, }, + { 91384016, -18622442, 12086575, }, + { -3149285, 965831, -6698002, }, + { 302248128, 11066520, 1255204, }, + { -2464238, -18131742, -6780680, }, + { -411309696, -33869576, 17572322, }, + { 248285616, 21774410, 6012418, }, + { 112084152, -22398254, 80531, }, + { 2075543, 25417080, 1172526, }, + { 76741400, -22457310, -71941, }, + { 45845556, 5286568, 8261370, }, + }, + { + { 373993952, 17577690, -7036230, }, + { -42478836, 3827353, 5222144, }, + { 342384608, -4961761, -11625940, }, + { 114021184, -14768782, 3609383, }, + { -25247966, -19390166, -7270306, }, + { 199094288, -22322018, 2608656, }, + { -331249, 19904490, -118112, }, + { 266570896, -30332670, -670015, }, + { 2378338, 17207250, 6906308, }, + { -89402432, 24081882, -7893613, }, + { 78420200, -62676456, 9542880, }, + { 293430016, 18987514, -13280576, }, + { -12401181, -14681809, -10343892, }, + { 228244768, 18317498, -9505836, }, + { 15437186, -26183194, 3886946, }, + }, + { + { 865165312, -25497610, -74502112, }, + { -84415968, 16539382, 6498823, }, + { 288153120, -2291902, -5586142, }, + { 269447456, 15268609, -30878668, }, + { -14707042, -15683610, -13768591, }, + { 343504512, 29538100, -36380520, }, + { 3339874, -1758252, 7729868, }, + { 247785248, 36953360, -18047990, }, + { 854162, 28677496, 2340757, }, + { 336332992, -61252676, -49850076, }, + { -113531552, 79529376, -3664681, }, + { 461719200, -34638376, -24414204, }, + { -10072235, -23138600, -8646306, }, + { 356392640, -25852482, -16559783, }, + { -24495272, 27974196, -6864969, }, + }, + { + { 1228776704, 177195312, -76141720, }, + { -67956584, -5862094, -7258495, }, + { 257796816, 5892159, -2051384, }, + { 447683776, 69246144, -48252348, }, + { 14698452, 70069168, 11866995, }, + { 530176128, 71143448, -61755188, }, + { 3221, -25773562, -967441, }, + { 289620928, 16216186, -37874096, }, + { -2878165, 2015413, -8126078, }, + { 735616256, 161502048, -48373680, }, + { -202235520, -27891518, -27511950, }, + { 549467520, 55591908, -11610370, }, + { 6163815, 36712844, 10152229, }, + { 412312032, 35161288, -6841883, }, + { -37738804, 3149822, -14293651, }, + }, + { + { 1281082496, -211401504, 48896056, }, + { -14148159, -41238128, -6071473, }, + { 215368448, -6750078, 6689412, }, + { 560569984, -152013392, 4828080, }, + { 24906516, 30822296, 27560268, }, + { 662074560, -195179424, 1111323, }, + { -3439732, -5625334, -8611946, }, + { 355079968, -117149528, -9849434, }, + { 1498407, -29228326, 4475893, }, + { 905934208, -173703504, 37728068, }, + { -138740864, -89582280, -22839026, }, + { 489035168, -18500572, 24653112, }, + { 11938935, 25028386, 14175540, }, + { 355331232, -2408940, 16406238, }, + { -13491566, -49535468, -1341640, }, + }, + { + { 894766784, -193518336, 137400832, }, + { 35444756, 40083320, 15843061, }, + { 135316704, -25804700, 14344654, }, + { 490654912, 5720360, 78753056, }, + { -4183298, -105033960, -19880330, }, + { 589552960, 32260036, 101505648, }, + { 1813550, 32169842, 6186364, }, + { 345121568, 67742912, 59600724, }, + { 810138, -33732136, 2275796, }, + { 704745088, -125802280, 102349072, }, + { 6849399, 137312256, 30303142, }, + { 274665856, -114824880, 32450088, }, + { -2047089, -48783312, -11823508, }, + { 192652368, -84133040, 18580028, }, + { 19188840, 24214488, 20062866, }, + }, + { + { 204740016, 647619328, -38720204, }, + { 39803072, 51194400, 12788802, }, + { 30276298, 68772624, -49929, }, + { 214110032, 314792640, 22679038, }, + { -16612934, -90500864, -22324704, }, + { 262058496, 396546272, 36606544, }, + { 1224066, 38911328, 2881923, }, + { 187617600, 208635008, 42795056, }, + { -1625645, -15795816, -4760971, }, + { 215489776, 484327904, -23882166, }, + { 94519344, 41808284, 52547316, }, + { 5176510, 190813584, -29558502, }, + { -7446937, -47923244, -10260140, }, + { 1622424, 120248880, -21247204, }, + { 20531018, 61265560, 6198712, }, + }, + { + { -328660576, -106819056, -240462336, }, + { 6014565, -55379308, -21743808, }, + { -49900540, -34383896, -26082800, }, + { -92435216, -211497072, -125123672, }, + { 251792, 29870960, 22744000, }, + { -116375896, -290485824, -160718208, }, + { -1044214, 21117280, -3644280, }, + { -39702140, -239503488, -88157424, }, + { 306553, -1584306, 1057636, }, + { -207131248, -121513752, -184537568, }, + { 55978456, -186956704, -25972204, }, + { -152331216, 24865176, -69481296, }, + { 48318, 9571335, 11224897, }, + { -104797200, 22180822, -42998528, }, + { -513249, -18034568, -19814832, }, + }, +}; + const float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= { { @@ -8818,6 +17574,859 @@ const float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= } }; +const Word32 rightHRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= +{ + { + { 335878240, 171201152, 7902740, }, + { 625042304, -38326140, 24910274, }, + { 537386304, 24339580, 36527624, }, + { 162773888, 291606816, 80030808, }, + { 610952640, -82900920, -32977296, }, + { 45806900, 473868032, 110131016, }, + { 672814144, -110260936, -35019552, }, + { 31259846, 506221504, 91921424, }, + { 704516928, -118449832, -48664128, }, + { 365311136, 194221648, 26628798, }, + { 555327488, 63325536, 28055264, }, + { 134318128, 374452416, 114475376, }, + { 616197376, -46350752, 6811282, }, + { 269210176, 195440880, 39850856, }, + { 584630400, -49424872, -314606, }, + }, + { + { 153939680, -135309728, -82342040, }, + { 615573504, -83027624, 23161684, }, + { 509388480, -61414812, 27712740, }, + { -32580012, -194236672, -63221920, }, + { 678085120, 133931576, 33365990, }, + { -56443924, -209270128, -145981104, }, + { 725016256, 115785872, 39330088, }, + { -50629612, -88218632, -142844176, }, + { 738054144, 93220656, 26321708, }, + { 235484464, -10732050, -31916976, }, + { 558783296, -111704584, -44579076, }, + { -55024972, -244054000, -73130944, }, + { 626338304, -79976048, -6355478, }, + { 53143240, -92013232, -23232014, }, + { 589115456, -29078540, 8979703, }, + }, + { + { -47502340, -225702144, 1009317, }, + { 613705728, 190158608, -87268368, }, + { 500094176, 66390532, -18193482, }, + { -160684384, -74954160, -65988952, }, + { 707738112, 53812184, 55165632, }, + { -24977920, -437184192, -53591528, }, + { 728532736, 116576688, 32762010, }, + { 6060199, -491625056, 15927886, }, + { 726640256, 153417312, 2280628, }, + { 68508488, -8391829, -511638, }, + { 619300480, -227791104, -7439957, }, + { -149295744, -68784976, -106736376, }, + { 642141120, 15699179, -49628348, }, + { -174591488, 17845590, -8568997, }, + { 583061120, 57918708, -26482768, }, + }, + { + { -246570320, -252771712, 25805774, }, + { 711792064, 274690016, -82055352, }, + { 569176064, 166868064, -9373229, }, + { -120591408, 45267880, -33620468, }, + { 639823424, -91681448, 10991895, }, + { 45526652, 26081726, 112846504, }, + { 661089408, -61773976, -25802552, }, + { 39781060, -244305248, 111033496, }, + { 689595136, 6112812, -45711872, }, + { -118973816, -45193256, 16270947, }, + { 685362944, -63247152, 47053516, }, + { -50758996, 267372992, -9620727, }, + { 687694592, 133942848, -11167989, }, + { -268843488, -18899466, -7071664, }, + { 595376448, 97235912, -13216688, }, + }, + { + { -363332768, -48200808, -38664368, }, + { 862057920, -196809360, 76299024, }, + { 680975680, -66029752, 62313532, }, + { 42142756, -224898448, 23900956, }, + { 517202656, 39182988, -13852343, }, + { 16899086, 240396304, 28621662, }, + { 578456384, -10711112, -26575110, }, + { -31825708, 272278368, -90252832, }, + { 675961792, -76532024, -7255274, }, + { -275402432, 19490024, 19011136, }, + { 694145088, 78392816, -15985868, }, + { 104157792, -106337488, 88669600, }, + { 699485376, 22428320, 29043106, }, + { -167101616, -96108480, -3835943, }, + { 594321984, 26122528, 13720810, }, + }, + { + { -278544192, 77761992, 6783364, }, + { 893755328, -228144912, 63108100, }, + { 720438336, -255192992, -13665512, }, + { 156205280, -23141820, 77895672, }, + { 399979552, 6000070, -7042136, }, + { -31854698, -64270964, -75585520, }, + { 512157120, 10667088, -5974837, }, + { -14828375, 393006144, -40407588, }, + { 667064256, 27399744, 34042448, }, + { -356493568, -38231652, 11823508, }, + { 722442496, 111037256, 533113, }, + { 115784800, -171748224, 61668752, }, + { 626011904, -82572360, -625992, }, + { 45074072, 72021768, 15156940, }, + { 536772128, -35543540, -3380139, }, + }, + { + { -73698416, 41248328, -20535312, }, + { 848944832, 184383488, -79126184, }, + { 734158656, -104955576, -76299024, }, + { 83268144, 220971232, 1210644, }, + { 328131200, -52250424, 26017302, }, + { -17207786, -185924832, -29459180, }, + { 478818528, -4858145, 3739306, }, + { 37145560, 13910862, 105687336, }, + { 647532864, 87085832, 14063334, }, + { -334238656, -15821586, -947040, }, + { 766663488, 87857848, 5260261, }, + { -16082505, 188711200, -38655244, }, + { 512291360, 14954002, -14906221, }, + { 202894256, -21919902, 18131742, }, + { 441034624, 10546829, -3133716, }, + }, + { + { 182968832, 166872896, -25620554, }, + { 900337344, 202598976, -76710264, }, + { 774260736, 183863248, 31660888, }, + { -58633820, -30077656, -56673168, }, + { 287297888, -74439840, 22798760, }, + { 24970940, 68754376, 57749056, }, + { 481663936, 8292508, 8747238, }, + { -9427453, -322418912, -27601070, }, + { 644221504, -19704236, -26892400, }, + { -206094544, 45814416, -1173063, }, + { 828069184, 40436044, -29763586, }, + { -114652008, 22880364, -75015360, }, + { 412233120, -1234803, -1341104, }, + { 209146112, -50087908, 9846749, }, + { 329985568, -20840256, 6089727, }, + }, + { + { 366514784, -87303264, 40976672, }, + { 1047088896, -194659728, 43730284, }, + { 742656192, 139103248, 52795884, }, + { -114707304, -54439248, -33390686, }, + { 272615008, 16188805, -11766063, }, + { 17126718, 143042272, 28806346, }, + { 510879904, 21948356, -520765, }, + { -24763170, -206299632, -69475392, }, + { 699449920, -91850024, -6042482, }, + { -14831059, -71486512, 9839770, }, + { 919253440, -104362336, 10414759, }, + { -63852204, -181701280, -10722923, }, + { 358785984, 5443334, 4399657, }, + { 77541336, 88224000, -13798119, }, + { 235267568, 42878804, -1713155, }, + }, + { + { 328002368, -158853120, 19053012, }, + { 1123982208, -105683040, 55635932, }, + { 635256832, -136615936, -37422052, }, + { -54308788, 119649200, 13070659, }, + { 308759840, 62324808, 1898912, }, + { -19162534, -72129144, -44424996, }, + { 567933696, 23300734, -9535901, }, + { 20692616, 124913752, 58988692, }, + { 789915904, 13496935, 18928458, }, + { 169172320, 1418413, 5950677, }, + { 959227776, -50255412, 22593138, }, + { 54667956, 60081760, 48018808, }, + { 362694944, -3298535, -1773285, }, + { -84051976, -10931766, -20318954, }, + { 193888240, 11763915, -7717520, }, + }, + { + { 115933512, 54171348, -20616916, }, + { 1061163456, 129533528, -23348516, }, + { 550549824, -101550208, -32472638, }, + { 45247480, -22406844, 44503916, }, + { 375784928, -266288, 15702937, }, + { -17834314, -101530880, -31956704, }, + { 652130624, -41226856, 1646046, }, + { 8262444, 212076896, 22017076, }, + { 872475392, 27085674, -3548180, }, + { 293410688, -7770670, -11642046, }, + { 921522816, 53132504, -10414222, }, + { 94559608, 61743376, 34906272, }, + { 410655776, -33762736, -339302, }, + { -169639392, -46001784, 9142912, }, + { 215555280, -39306468, 7264401, }, + }, + { + { -121721520, -43738336, -8097624, }, + { 933114368, 22093848, -32720672, }, + { 494997664, 19759534, 23136452, }, + { 75576392, -114045880, 3667365, }, + { 444172096, -36144296, -12401718, }, + { 14139032, 87575992, 32541356, }, + { 733825792, -1081258, 2262374, }, + { -19392852, 7123204, -55031952, }, + { 939120896, 32734094, -12346420, }, + { 337437312, 5166309, -13647259, }, + { 852432896, -9301289, -18699750, }, + { 25549150, -84922776, 491237, }, + { 472952672, 23739894, 11385958, }, + { -152883648, -14016626, 17564806, }, + { 268112256, -3453154, 10877542, }, + }, + { + { -269692256, 7937100, -2384781, }, + { 808061568, 12100533, -4268661, }, + { 423107424, 58875412, 14115947, }, + { 38092064, 6757594, -32236950, }, + { 507483136, -62690416, -14868640, }, + { 18486612, 77123120, 34720516, }, + { 786537344, -938987, -7950522, }, + { 1819992, -147699632, 6068252, }, + { 974787392, -12577812, 1095217, }, + { 289339072, -1104880, -3964792, }, + { 789703808, -11702712, -6681896, }, + { -67787472, 68001680, -30844308, }, + { 519936384, 28106802, 3049427, }, + { -55746528, 10052908, -11537356, }, + { 320355168, 12771085, -5028870, }, + }, + { + { -264577504, 33274186, 2607582, }, + { 710308672, -16774532, -5884105, }, + { 337924256, -31025770, -6185827, }, + { -10758893, 44742820, -5711233, }, + { 532032096, 22328462, 13090523, }, + { -10329396, -93899256, -23986856, }, + { 795033344, 9193914, -5691369, }, + { 13652090, -58238144, 38045896, }, + { 953060224, -46311020, -9642738, }, + { 153929488, -34870840, 5812165, }, + { 745974592, 75162, 3201898, }, + { -79250736, 42124504, -40099424, }, + { 552490112, -8643085, -15971373, }, + { 79966920, 67082556, -16285442, }, + { 359595072, 18285286, -9487583, }, + }, + { + { -141451520, -45782204, 6092411, }, + { 634855232, -24634858, 3785477, }, + { 254404336, 7821136, -4571456, }, + { -45016088, -10459319, 21311628, }, + { 477775936, 54230404, 9673877, }, + { -18442052, -56763900, -35335768, }, + { 744544960, 14347875, 413927, }, + { -5615670, 84819160, -16463683, }, + { 872367424, 952409, -17485886, }, + { -37825776, 60159608, 3164854, }, + { 706909760, 23321672, -1428077, }, + { 5742372, -135769280, 3150359, }, + { 584314176, -42927660, -8116415, }, + { 172647488, -49075908, 8621610, }, + { 369367712, -11576011, -375810, }, + }, + { + { 15072651, 50944216, 13710072, }, + { 538955072, -13040594, 24205362, }, + { 187226752, -5189394, 2030446, }, + { -50834696, -49825380, 8231305, }, + { 367362496, -49736796, -9050570, }, + { 5716602, 87666192, 13341242, }, + { 638520448, -28745680, 1804423, }, + { -9424232, 56697328, -25742424, }, + { 736861248, 15118285, 10206453, }, + { -219684352, -36769752, -482110, }, + { 649502144, -17821430, -9939091, }, + { 81932408, 45398880, 53095460, }, + { 598292672, 6328635, 7124277, }, + { 149414400, -23850490, 21712134, }, + { 334426016, -10021232, 5326833, }, + }, + { + { 125673968, 17753784, 9321690, }, + { 397379488, 104956656, 5082557, }, + { 149467008, 2914135, 4262755, }, + { -20718922, 27423366, -28011776, }, + { 257603008, 8898098, -11051488, }, + { 20265266, 5883569, 42024644, }, + { 506127552, 32068374, 2290828, }, + { 7227893, -67430448, 20556250, }, + { 544590016, 78309064, 19809462, }, + { -321714528, 9211631, 1069984, }, + { 556742656, -2592550, -1637993, }, + { 52476984, 129614056, 30575336, }, + { 567954112, 30062086, 1427540, }, + { 18473192, 89390080, 6312528, }, + { 260188048, 30055108, 3881577, }, + }, + { + { 162220384, -35226784, -14843944, }, + { 258143104, -34475704, -23410792, }, + { 143663440, 850404, 3514357, }, + { 39367672, 96164856, -16363289, }, + { 196611248, 29874718, 7045894, }, + { -3548180, -142337904, -8863739, }, + { 391071808, -25950730, 772557, }, + { 7097434, -70594232, 19371376, }, + { 343604896, -82419352, -5340792, }, + { -306525920, 20317880, 2103997, }, + { 416423392, -35428112, 9055402, }, + { -42094436, -123787936, -41830296, }, + { 494898880, -19892678, -4767951, }, + { -125548336, -57329760, -18460306, }, + { 171719776, -38439956, -6002754, }, + }, + { + { 149700544, -15543487, -19137300, }, + { 186234608, -56275344, -2545842, }, + { 165364288, -8795019, 3685619, }, + { 74812960, -56720412, 33527588, }, + { 207906480, -11742977, 21865142, }, + { -22778896, -28792388, -50524920, }, + { 342108096, -9793599, 3819837, }, + { -10169946, 55358908, -28482612, }, + { 224280512, -4655745, -12516608, }, + { -185469568, -39997420, 2193118, }, + { 240936384, 58211304, 3536906, }, + { -74164424, -86611776, -47780436, }, + { 395104256, 23114440, -3353296, }, + { -173409840, -28682866, -19873350, }, + { 105167104, -6638409, -7066295, }, + }, + { + { 105323872, 22173842, 1312113, }, + { 179931744, 12965433, 22897544, }, + { 207433504, 2630131, 1804423, }, + { 30630634, -85687280, 33305860, }, + { 303123744, -13679471, 8104604, }, + { 6169721, 159945648, 18145700, }, + { 392402720, 24051816, 9910100, }, + { -2450279, 113075216, -6314676, }, + { 236913616, 52297132, 6293201, }, + { -14849313, 42407432, 1881733, }, + { 74994424, -41807748, -5413270, }, + { -10800769, 124163744, 16718697, }, + { 288295936, -18919330, -2345052, }, + { -94409288, 83413632, 5292474, }, + { 77771656, 19129784, 6313065, }, + }, + { + { 28367722, 11352135, 17681306, }, + { 207316464, 32352914, 8996346, }, + { 260098928, -1567663, -5674726, }, + { -55946780, 123041688, -25584584, }, + { 493192160, -18697604, -19944218, }, + { 20092930, 83791056, 44481364, }, + { 544934720, -18092012, 1531693, }, + { 11063836, 15476378, 30881352, }, + { 367152064, -42682312, 18682570, }, + { 133796288, -29187524, 2644626, }, + { -38214472, 3738769, -4303021, }, + { 52898964, 14692009, 39791260, }, + { 197532528, -1098438, 5455146, }, + { 39827768, -23616414, 17642652, }, + { 79354888, 1855963, 11523934, }, + }, + { + { -69984344, -64994668, 7815230, }, + { 255391104, -3300682, -12565464, }, + { 309282752, 20043538, -7486665, }, + { -81857248, 52066816, -46926276, }, + { 754250496, 88805968, -26157962, }, + { -7791071, -102232032, -24181202, }, + { 773598784, 38256884, -16646756, }, + { -3101503, -88045216, -9091372, }, + { 563862080, 4434554, 3325915, }, + { 207639120, -3164317, 795643, }, + { -87747256, 15495168, 6041945, }, + { 46018964, -69473240, 9407052, }, + { 138111120, -15164993, 10856067, }, + { 130414000, -16855600, 1413581, }, + { 103952704, -7817378, 4638565, }, + }, + { + { -153698624, 52211768, -22286586, }, + { 314552672, -41536092, -8077223, }, + { 332848704, -26689464, 4923107, }, + { -13014288, -137779872, 9877351, }, + { 993195648, -101502424, -251792, }, + { -14167486, -78821240, -29317446, }, + { 1013642368, -73787000, -18562312, }, + { -8565239, -48564804, -23686208, }, + { 768001344, -13456669, -25697326, }, + { 197247984, 20113332, -4068945, }, + { -99047848, 2668785, 10101763, }, + { -9654550, 48223892, -18820546, }, + { 126544232, 16342887, 2228014, }, + { 130527280, 6726993, -6411313, }, + { 158825200, -2674154, -4586488, }, + }, + { + { -173407152, 80022760, -10335839, }, + { 357153376, 23606214, 8338142, }, + { 311526848, -16561931, 13072807, }, + { 60987460, -6754373, 41550588, }, + { 1076533504, -11509975, 15732465, }, + { 5602785, 54272280, 18927920, }, + { 1159097344, 47392816, -2072859, }, + { 6779606, 63433444, 19216220, }, + { 918634432, 72778760, -22099754, }, + { 133954128, -19498078, -5927592, }, + { -104071352, -11424076, 4241280, }, + { -46579456, 18314278, -20225000, }, + { 182078704, 12781823, -7573101, }, + { 50426136, -12663711, 3757560, }, + { 249549952, 27696634, -7901666, }, + }, + { + { -125086088, -64300492, 37410240, }, + { 354743360, 22876606, 8448201, }, + { 263105408, 37308772, 4003983, }, + { 59869696, 90144920, 3503083, }, + { 935057856, 98520104, -1078037, }, + { 9542880, 47780436, 17816598, }, + { 1110528256, 38748660, 6838125, }, + { 4467303, 80529024, 12106976, }, + { 936150912, -29707216, 10800769, }, + { 60918204, 12298639, -4695473, }, + { -115432080, 2697776, 1560684, }, + { -27349278, -44630616, -2356327, }, + { 298056224, -43240656, -7306813, }, + { -58851788, 43766252, 4701916, }, + { 360583456, -39258684, -2423972, }, + }, + { + { -43643848, -73751568, 23637890, }, + { 311553696, -29218662, -2420751, }, + { 249098976, -7734699, -6087043, }, + { 5525476, -15845208, -22711788, }, + { 627708416, -90942712, -14872935, }, + { -1866700, -29127394, -9088151, }, + { 851950272, -100369088, 317828, }, + { -7909719, -9968619, -22215718, }, + { 758959936, -100101728, 13643500, }, + { 6927246, -2215666, -2097018, }, + { -129383744, -5531381, 2185602, }, + { 18997714, 28491202, 12160663, }, + { 428251712, 44209172, 894964, }, + { -125575184, -25443386, -8341900, }, + { 449487648, 13390634, 525060, }, + }, + { + { 70837968, 58482960, -45040248, }, + { 261459888, 8723615, -6206228, }, + { 325033472, -26867168, -9676561, }, + { -40947680, -31508954, -4011500, }, + { 283930080, 67042292, -12214887, }, + { -7194607, -11471858, -12919262, }, + { 471827392, 110132624, -9797894, }, + { -559956, -64124936, -1170916, }, + { 422992000, 129837400, -14223321, }, + { -25354802, -2267743, 1309428, }, + { -133630928, 3575024, -60666, }, + { 39726300, 7045894, 15430207, }, + { 506878624, -6169184, 4694936, }, + { -102008696, -30327300, -11685532, }, + { 474422624, 6671158, -2348273, }, + }, + { + { 217952944, 121817624, -52187072, }, + { 240484880, 14042396, -132607, }, + { 494514496, 60224568, -7513509, }, + { -48454212, -5237176, 7024419, }, + { 20397336, -24781962, -4145180, }, + { -1296543, 28807420, 542777, }, + { 108569792, -68455336, -13811004, }, + { 7339562, -6582038, 20469814, }, + { 50323596, -54717348, -17939542, }, + { -52311628, -2201708, 4130685, }, + { -115864792, 11620034, -204548, }, + { 14101451, -45034880, 3508452, }, + { 491351776, -30665530, -1449552, }, + { -7735773, 56921200, 1196685, }, + { 420662528, -21121576, -2969433, }, + }, + { + { 302108544, -145636432, 25764972, }, + { 270012256, -23244364, 9095667, }, + { 695182848, -53615688, -2393908, }, + { -17125108, 6622840, -6611029, }, + { -111943488, -11172821, 7976291, }, + { 6505802, -8606578, 12640626, }, + { -130551976, 1461900, -3079492, }, + { -2710661, 67228048, -7895224, }, + { -250304256, 20928302, 3484292, }, + { -89183920, 11238319, 4881767, }, + { -75185016, -18063558, 3986804, }, + { -25879862, 31284004, -15047955, }, + { 386935200, 44014288, -10276783, }, + { 83388400, -25720412, 13156559, }, + { 302272832, 38888780, -4435091, }, + }, + { + { 186142272, -78747152, 69059320, }, + { 357181280, 13597866, 10020159, }, + { 826062336, 10807748, -4036733, }, + { 30802432, 40938556, -4883915, }, + { -136869872, 11004243, 16057272, }, + { 2662343, -36271000, 3084860, }, + { -225224320, 22747758, 14950781, }, + { -5504001, 47386376, -15182709, }, + { -434281856, -19651086, 14351096, }, + { -132748848, -15060303, 3321620, }, + { -19873888, 9534291, 5590437, }, + { -32341104, 26803818, -15712064, }, + { 232506976, -29129542, -11449846, }, + { 104971688, -25116432, 9660992, }, + { 154529696, -33919504, -7061463, }, + }, + { + { -114229488, 228196448, 14908368, }, + { 504227008, -10380936, -2932926, }, + { 808694016, 22711788, -7024956, }, + { 52182780, -21744882, 14767171, }, + { -107239424, 5180805, 11981348, }, + { -5783711, 8522826, -12138651, }, + { -224969856, -5100811, 21272974, }, + { 5198521, -30551176, 14821932, }, + { -503597248, 4022774, 13465796, }, + { -158316784, 4875325, 1993939, }, + { 44385804, -1563368, 157303, }, + { -302258, -49360448, 4401805, }, + { 67911488, 13307956, -1172526, }, + { 51097224, 43914968, -3702799, }, + { 13918378, 13386339, -2522220, }, + }, + { + { -376732512, -105936976, -52158084, }, + { 701803008, 31803160, -19734838, }, + { 622177024, -62460100, -6384469, }, + { 20867636, -43538084, 14351096, }, + { -59612000, -13386876, -1971927, }, + { -2908230, 31246960, -3704946, }, + { -186044032, -19776714, 9260486, }, + { 2085744, -53198000, 5521718, }, + { -485769920, 526134, 8494372, }, + { -134485088, 9373229, 1622961, }, + { 117180664, 9884330, -6997039, }, + { 28893318, 8454106, 18998250, }, + { -86978456, -23970750, 8986145, }, + { -27663884, -22535156, -12045236, }, + { -101843336, -9178345, 6937983, }, + }, + { + { -372928800, -118043416, -44813688, }, + { 904283328, -64888364, -21122112, }, + { 301261344, 95022392, -11047193, }, + { -33595772, 58286464, -11398306, }, + { -6813966, -10190884, -11519102, }, + { 4401268, -8411157, 9586904, }, + { -133000104, 10397042, -9189083, }, + { -5110474, -309238, -14335527, }, + { -414447712, -6669011, -659278, }, + { -45639932, -19439022, -1628866, }, + { 192929392, -26497264, -6411850, }, + { 20511154, 46442556, 7100118, }, + { -223085440, 39593692, 6857989, }, + { -72546832, -16858820, -6147709, }, + { -191062688, 25187836, 7979513, }, + }, + { + { -97977864, 172937392, 5498095, }, + { 1020359680, 49040472, -3064996, }, + { -83678848, -74016784, -12161737, }, + { -51643760, 16670916, -23394150, }, + { 36763848, 26569204, -6542309, }, + { 3170760, -21297132, 4604205, }, + { -73004784, 22681186, -14823006, }, + { 271657, 39352100, 1069984, }, + { -324642624, 17212082, -8062728, }, + { 91595544, 28620588, -8014409, }, + { 250592544, 19866908, 323733, }, + { -10849624, -29150480, -13490492, }, + { -325997696, -26555782, -1130113, }, + { -62478888, 26125212, 6773164, }, + { -250334320, -19998978, 541703, }, + }, + { + { 230774496, -94694368, 33468532, }, + { 950758144, 45088028, 7181722, }, + { -466968160, 41601052, 4842039, }, + { -12726525, -71256728, 816044, }, + { 38146824, -9856413, 4327717, }, + { -3117073, 13539348, -7080791, }, + { -34454764, -30524332, -4786741, }, + { 4219806, 10428181, 11727945, }, + { -263279888, -25294674, -5777805, }, + { 224959120, -37230388, -9239548, }, + { 262986752, 8453033, 1917703, }, + { -24196772, -24077586, -11637214, }, + { -382932832, -1334124, -1830193, }, + { -19270982, -700617, 7786239, }, + { -273468608, -2460480, -2448131, }, + }, + { + { 372294208, -19914690, 33813740, }, + { 662759616, -123762704, -7464117, }, + { -810661120, -51490752, 24456618, }, + { 35114580, 11368242, 20448340, }, + { -34016676, -30839476, 7538205, }, + { -3339874, 17280800, -5366562, }, + { -70069704, -1327145, 8199093, }, + { -1795296, -34127272, -5259188, }, + { -282629248, 8960376, 7567196, }, + { 282418784, 23540716, 503048, }, + { 219165200, -27831388, -4094178, }, + { -8269960, 26900454, 3402688, }, + { -400790240, 10691784, 3843459, }, + { 25067576, -6487011, -2902324, }, + { -267513104, 12243878, 891743, }, + }, + { + { 242817056, 136962208, 7746511, }, + { 221894656, 116763520, -22308598, }, + { -1080360960, 71046816, 23397908, }, + { 40003864, 38815232, 8348343, }, + { -178594944, 59281288, -1345399, }, + { 2113124, -13751948, 5187247, }, + { -215943984, 54989540, 10739029, }, + { -3170760, -24517820, -8753680, }, + { -410339552, 47098076, 15241765, }, + { 210557552, 27944668, 10531797, }, + { 131049656, 24807732, -8782671, }, + { 13361643, -3181497, 8449811, }, + { -405466400, -171799, 6650220, }, + { 50663436, -10238665, -5988795, }, + { -255399696, -5711770, 3862786, }, + }, + { + { -31068720, -130587944, -33651604, }, + { -262315664, -71206264, -12941273, }, + { -1221106432, -40506372, 7044820, }, + { 5936719, -27122718, -7492034, }, + { -352367712, -35716948, -6782827, }, + { 3185792, -11842835, 5377299, }, + { -448329088, -80601504, 1251983, }, + { 3089692, 21311628, 8769786, }, + { -610926336, -79132624, 5086315, }, + { 21592948, -75939320, 6671695, }, + { 18001282, -15389405, -5661841, }, + { 17416630, -10782515, 4671851, }, + { -422662912, -11905649, 4202626, }, + { 46805480, 9417253, 2310156, }, + { -262331776, -7301445, 3401077, }, + }, + { + { -226603008, -18327162, -38191388, }, + { -707435904, 51271172, 11145977, }, + { -1183006336, -31270046, -1832877, }, + { -28250684, 2456721, -9917616, }, + { -500287456, 8203388, 2072859, }, + { -1089848, 12928925, -2975339, }, + { -683104320, 48995376, -4758287, }, + { 1455994, 33645164, 3847754, }, + { -786317248, 39530880, -5663988, }, + { -192634112, 63155348, -4294431, }, + { -111193480, 20921322, 501437, }, + { 2214593, 16510391, -981400, }, + { -461840512, 15453292, 817654, }, + { 13194140, 15024869, 6694244, }, + { -300300896, 16017544, 1114544, }, + }, + { + { -224664912, 108171432, 4175782, }, + { -1078223616, -68621232, 23726474, }, + { -973332992, 83570936, 3840775, }, + { -30763776, 19509352, -3448859, }, + { -591696192, -11749957, 9123047, }, + { -3073049, 4521527, -5551782, }, + { -830735232, -6813429, 331786, }, + { -3465502, -2225867, -9803263, }, + { -840708736, 18293340, -2704756, }, + { -311184352, -5189394, -6243809, }, + { -260984768, -36910412, 1418950, }, + { -14047227, -9365176, -6448894, }, + { -515333248, -12192875, -68719, }, + { -30389042, -25724706, 301185, }, + { -362049088, -16235513, 537, }, + }, + { + { -85414552, -51876764, 32028108, }, + { -1362811904, 77688440, 13334263, }, + { -671621760, -84929760, 12796318, }, + { -3631395, -17330730, 3491809, }, + { -624009344, 13232257, 3234110, }, + { 216896, -15168214, 1034550, }, + { -855872064, -12947179, 4281546, }, + { 352724, -30451318, 1169305, }, + { -747763456, -48717276, 4341138, }, + { -265382800, -39658116, -1537061, }, + { -439059488, 42351060, -1467805, }, + { -12868259, -11892764, -6317897, }, + { -567934784, 5772973, 1864553, }, + { -51245404, 6357626, -6984691, }, + { -427521056, 10568304, 1278290, }, + }, + { + { 57335128, -21424908, 14519674, }, + { -1546537216, -24615532, 2499134, }, + { -387294912, 44589276, 12475806, }, + { 22578106, 1583232, 3779034, }, + { -614494912, 9084930, -2698850, }, + { 3117073, 118112, 6264747, }, + { -790453312, 28467044, 3361349, }, + { 2966749, -11570642, 8281234, }, + { -561839168, 52027624, 6072010, }, + { -83245592, 55242408, -1686848, }, + { -644597312, -28553480, 3214783, }, + { 3478387, 23061826, 2260227, }, + { -603926656, 3766150, 6805376, }, + { -31689880, 19377282, -6148246, }, + { -473488992, -205085, 5046587, }, + }, + { + { 120469000, 22543210, -11138461, }, + { -1607233664, -59374164, 24469502, }, + { -194259760, -6671695, 2132988, }, + { 24184424, -1061394, 4543539, }, + { -591490560, -34621196, 7472170, }, + { 248571, 18603650, -70867, }, + { -702711936, -44425532, 11446625, }, + { -1819456, 23494544, -5267778, }, + { -377655392, -42054172, 6758131, }, + { 128841504, -56617868, -2202245, }, + { -852840896, 11351062, 22712324, }, + { 14465987, -4428648, 10028749, }, + { -604490880, -11200201, 13851806, }, + { 11824582, -26652956, 1130113, }, + { -478025024, -8836358, 10008348, }, + }, + { + { 99128920, 3651796, -10679973, }, + { -1516199168, 58139900, 60329796, }, + { -95059440, -290984, -6617471, }, + { 3212636, -14644765, 6335077, }, + { -570893504, 23903640, 28049358, }, + { -3208341, -1371168, -7168838, }, + { -640622272, 31571768, 31884226, }, + { -1759863, 24443732, -4776004, }, + { -266206912, 23772644, 13987635, }, + { 247099664, 32651416, 7637526, }, + { -995970176, -21615496, 41095320, }, + { 6749004, -25076704, 4926328, }, + { -542421632, 7269232, 14501957, }, + { 41754600, 11839077, 8631811, }, + { -421268096, 9819369, 10045929, }, + }, + { + { 31780610, 2109366, 4351876, }, + { -1227817856, 31887448, 36262944, }, + { -41796476, -6394670, -8111583, }, + { -21230560, 42835856, -9363566, }, + { -526691296, 30912490, 26707180, }, + { -296353, -21707302, -4295, }, + { -582211840, 34218004, 32887102, }, + { 2781528, -8465917, 8039642, }, + { -226947680, 16712255, 18204756, }, + { 205733232, 29428580, 19158776, }, + { -966141632, 51030652, 20940114, }, + { -9344238, 25553444, -10163503, }, + { -389149280, -6488085, -1595044, }, + { 33305324, 17487496, 9344238, }, + { -290937312, -11132555, -1483911, }, + }, + { + { -34587372, -31123480, 4677757, }, + { -702422016, -12524662, -63307816, }, + { 13409962, 10168335, -9574019, }, + { -22231288, 18446348, -21504902, }, + { -395849408, -55143620, -19904490, }, + { 3506841, 831613, 8366060, }, + { -443376992, -79262008, -21980568, }, + { -288837, -30697206, -807991, }, + { -192801616, -61860412, -7623030, }, + { 45564236, -99012952, 7204808, }, + { -676510528, -4662724, -44772348, }, + { -11819750, 21961778, -11959873, }, + { -144633568, 41230076, -25599616, }, + { -3271691, -40654548, -3177202, }, + { -98791224, 36429376, -16961362, }, + }, + { + { -62903556, 22214108, -11652783, }, + { -2837900, -263309408, -104393472, }, + { 83321288, -27225260, -9924059, }, + { 8424041, -95043328, 15469935, }, + { -140510384, -68141264, -63327684, }, + { -774705, 31915902, -3386582, }, + { -159801776, -62714576, -81861536, }, + { -2260227, -16823386, -6184753, }, + { -88226680, 2919504, -50476604, }, + { -109439528, 88497264, -31301184, }, + { -164298608, -202133504, -72149544, }, + { 3622805, -46176268, 10753524, }, + { 129524936, -112725712, -21399674, }, + { -31066036, 12406013, -17940078, }, + { 102797360, -79412872, -12246026, }, + }, + { + { -39567924, 46573552, -9427453, }, + { 621364224, 460767840, 43075300, }, + { 141969600, 41977936, 2921115, }, + { 22793392, -57216480, 28717226, }, + { 173183280, 253221616, -8589398, }, + { -2685428, 21849036, -7056632, }, + { 208237728, 318084736, -17783848, }, + { 2145336, 14760192, 6643778, }, + { 94066224, 175970720, -26878980, }, + { -143160928, 64352032, -39194796, }, + { 354849664, 357099680, 32628330, }, + { 10445897, -34724272, 13976360, }, + { 317177952, 112315008, 26720066, }, + { -21392158, 55930676, -4970888, }, + { 230905488, 66931696, 18525804, }, + }, + { + { 8250096, -53528716, 19508816, }, + { 821677696, 19742890, 188074464, }, + { 149194272, -2103460, 19142132, }, + { -2042257, 85702848, -23702314, }, + { 366368768, -121583544, 100727720, }, + { 2202245, -13095355, 6751689, }, + { 447949504, -178254032, 129330056, }, + { -533650, 32718524, -1122597, }, + { 249170912, -161775312, 71844600, }, + { -50550692, -170051712, 27342298, }, + { 576970880, -17979806, 144182048, }, + { -1150514, 37701760, -12638478, }, + { 317480224, 68158448, 50017040, }, + { 7964480, -27748710, 20958366, }, + { 223188512, 53187800, 29809758, }, + }, + { + { 25666188, -61740156, 13222057, }, + { 468054272, -778914880, -37406480, }, + { 90884192, -81121728, 2451353, }, + { -7944079, 107862200, -10186052, }, + { 283284224, -362074880, 32602560, }, + { 53150, -31307628, -1322850, }, + { 350218624, -463973504, 48184700, }, + { -569083, 32280438, -673236, }, + { 226416176, -237868704, 52872120, }, + { 40658308, -44644036, 57304528, }, + { 362591328, -576002368, -16647293, }, + { -3433826, 53061100, -4096862, }, + { 145049104, -242396672, -31521302, }, + { 13876502, -64969972, 4359929, }, + { 100901128, -152861648, -22567906, }, + }, +}; const float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= { { @@ -9672,6 +19281,861 @@ const float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= } }; +const Word32 rightHRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= +{ + { + { -135520176, 194871264, -54369992, }, + { 5232344, 17252346, -539555, }, + { -22220550, 117874840, -40396316, }, + { -107257680, 255896304, -73097656, }, + { 11720966, -108904264, 36866924, }, + { -50680076, 336556864, -124497144, }, + { 11458436, -134486704, 49912352, }, + { -43055436, 307590528, -120338008, }, + { 8897562, -128660576, 50126028, }, + { -119941256, 172604528, -50995756, }, + { 10245644, 73467024, -31177704, }, + { -103657424, 351444832, -110692048, }, + { -908386, -22171694, 13412646, }, + { -139419472, 198506944, -49185964, }, + { -13219372, -29753386, 17103634, }, + }, + { + { -305028032, 178966992, -27285390, }, + { 30917858, -50915228, -27016954, }, + { -31333398, 17824652, -79691504, }, + { -180582976, 181514448, -78655344, }, + { -27201102, -118149720, 33646236, }, + { -32651416, 465500896, -72493680, }, + { -25593174, -154673584, 44513576, }, + { -8945343, 553823680, -21647708, }, + { -21735756, -183458992, 31233540, }, + { -271011904, 228043440, 6618008, }, + { 46176804, 103967736, -27739584, }, + { -154800288, 253057328, -131308960, }, + { -21784610, -92931280, -13600551, }, + { -288599264, 110345760, -48391932, }, + { -57660472, -99732360, -5020280, }, + }, + { + { -324153536, 9072045, 47385836, }, + { 99568616, -139327136, -15360414, }, + { 46054396, -314262752, 41872708, }, + { -52845276, -129020816, 7718056, }, + { -148029808, 81420232, -18759344, }, + { 49320720, -72422272, 121334976, }, + { -120695560, 51905752, -15993921, }, + { 48910012, 135625936, 140061024, }, + { -86364816, 64855080, -57959508, }, + { -347903616, 196710576, 28915330, }, + { 79715664, -68266896, 35842040, }, + { 3573950, -296180416, 41096932, }, + { -46603616, -98206040, -14537391, }, + { -211719872, -73775728, 8290361, }, + { -100602096, -66857072, -14718853, }, + }, + { + { -238983248, -109216184, -20186346, }, + { 158430064, 109539384, 60192356, }, + { 99478424, -106365936, 113992192, }, + { 108341624, 68608344, 33007898, }, + { -268344720, -942208, -20194936, }, + { 17487496, -307243712, 28120224, }, + { -190794256, 31733902, -4362613, }, + { -23633058, -389901440, -67944776, }, + { -105947176, 126534568, -27926952, }, + { -342148384, 121005872, -7304666, }, + { 47435768, -191150208, -8434779, }, + { 137140448, -296890, 113191712, }, + { -92741232, -11922829, 27136140, }, + { -370978, 66400196, 11968463, }, + { -144703888, 2766496, 20560008, }, + }, + { + { -18681498, -206867632, -19592568, }, + { 108209552, 185416416, 46416248, }, + { 32727650, 247064240, -21903796, }, + { 156707248, -9570261, 57924076, }, + { -329999520, -24774446, -2032593, }, + { -37249716, 38208564, -89804544, }, + { -212032336, -13562970, 13310641, }, + { -28955596, -346057312, -82060720, }, + { -104133096, -3824132, 22079890, }, + { -226855872, 54367844, 4613332, }, + { 9917616, -101770864, -34786552, }, + { 88293256, 239106192, 33024004, }, + { -200631344, 115047680, -3089155, }, + { 199597872, -60316912, 18438832, }, + { -231136352, 84634480, 1288490, }, + }, + { + { 223436016, -51390356, -4157528, }, + { -18214956, -250354720, -92994632, }, + { -57046828, 54381264, -80257904, }, + { 29657286, -269596704, -5538361, }, + { -314948864, 58884000, 23173496, }, + { -15848966, 209089216, -23430120, }, + { -186629744, 5942088, 11245298, }, + { 37234144, 136140800, 105880608, }, + { -111910744, -61173756, 839666, }, + { -54005456, 101106752, -8387535, }, + { 6058052, -12533251, 5679021, }, + { -62708672, -138673760, -66732516, }, + { -303604800, 5211943, -23613730, }, + { 244338000, -47463684, 16740709, }, + { -322043104, 10297721, -10102300, }, + }, + { + { 351504416, -67618888, -30714384, }, + { -54721104, -251287792, -88000656, }, + { -113102056, -200841264, 31799938, }, + { -118671560, 776852, -75185552, }, + { -261045968, 42209328, 19190988, }, + { 28601798, -63060856, 69197832, }, + { -135094976, 1285269, 3442416, }, + { 2437394, 384751776, 6705518, }, + { -105192872, 9150428, -24213416, }, + { 144857440, -12532715, 753767, }, + { -12818330, 46677168, -22034792, }, + { -123130808, -83513488, -70629128, }, + { -339585888, -34845068, 849867, }, + { 117476480, 73857872, -443992, }, + { -376464608, 1576253, 6109591, }, + }, + { + { 326040096, 49028664, 22428320, }, + { -10631655, 188114192, 68762424, }, + { -210201600, -159242352, 61620432, }, + { -114390552, 143538880, -20566988, }, + { -201035072, -18813568, -14765024, }, + { 16927540, -165660640, 29322278, }, + { -80505400, 2159295, -3675955, }, + { -32559610, 127769912, -91239064, }, + { -70205536, 60418916, -11065983, }, + { 297682560, 66001300, 1824287, }, + { -37865504, 94677184, -2071785, }, + { -28137942, 205611360, 12385075, }, + { -309382048, 12906377, 11574400, }, + { -73100344, -77344304, -18161806, }, + { -382446432, -11492796, 1540283, }, + }, + { + { 108923056, 190376032, 10649908, }, + { -77725488, 196784128, 67276368, }, + { -352566336, 153094112, -37377488, }, + { -4843650, -76424112, 31541702, }, + { -127077344, -64507724, -8101382, }, + { -22453552, 70792872, -51737176, }, + { -34963720, -2215666, -9452686, }, + { 17081622, -231734960, 49876920, }, + { -33504504, -29388314, 15022185, }, + { 356293312, 44757856, 889595, }, + { -114809848, 67806256, 22993644, }, + { 90251760, -22021908, 66466768, }, + { -239530320, 944893, 752156, }, + { -192860672, -19954954, -18575196, }, + { -332159872, -19122806, -6287296, }, + }, + { + { -169595904, -62544388, -30911954, }, + { -277781312, -167457552, -35618700, }, + { -434085376, 112163608, -35138740, }, + { 88578872, 6706592, 41794864, }, + { -58242976, 19576460, 13532368, }, + { -17199734, 127037080, -28944858, }, + { -3717294, 35752920, -918049, }, + { 16502875, -232059760, 46335716, }, + { -43709884, -68236832, -158377, }, + { 302439776, -23015120, -15345918, }, + { -259441792, -90892784, -12786118, }, + { 86459840, -128010424, 25755846, }, + { -164977216, 30413738, -1911797, }, + { -172616352, 74084968, 11601244, }, + { -245588384, 51877300, 4899484, }, + }, + { + { -325007168, -33243584, -8560407, }, + { -479058496, -34588984, -41318660, }, + { -453216224, -58082452, 32525250, }, + { 79122960, 135242608, -1163399, }, + { -30136712, 55057184, -7392176, }, + { 16492674, -71891848, 38566120, }, + { -6920803, 18053896, 5795522, }, + { -21474300, 47109884, -60942900, }, + { -104778408, -209380, -16012175, }, + { 171231216, 24038932, -9402757, }, + { -397912064, -312996, -21223044, }, + { -13937706, 81356880, -24482388, }, + { -118827248, -10425496, 7212861, }, + { -55324548, -9509058, 19807852, }, + { -170254656, 3934727, 10257993, }, + }, + { + { -299565376, 35366372, 8828842, }, + { -601780224, 43026984, 9757629, }, + { -474717888, -72621992, 25129854, }, + { 1726577, -15290620, -40343164, }, + { -41837812, 31529354, -16467441, }, + { 18072148, -81266688, 33348810, }, + { -61786864, -31823560, -5519570, }, + { -2217814, 185003568, -5108327, }, + { -201226192, 67109, 2428804, }, + { -2594697, -20058034, 2413235, }, + { -490028928, 20321100, 1631014, }, + { -87570088, -6750078, -36289788, }, + { -118403656, -31147102, 808528, }, + { 75520560, -19526532, -10375030, }, + { -139467248, -25146496, -6270653, }, + }, + { + { -132337072, -58881316, 8665097, }, + { -655855488, 25572236, 16110422, }, + { -501111008, 30430380, -9394704, }, + { -49204756, -74647608, -5505075, }, + { -91855928, -22336514, 14292041, }, + { -12157442, 97756680, -27805618, }, + { -155968512, 5469641, -3663607, }, + { 16540993, 44654240, 46456512, }, + { -336846240, 58492624, 1365800, }, + { -176553760, 33840048, 11727945, }, + { -548054464, 10231149, 11157251, }, + { -58025544, -70031592, -23076322, }, + { -150341040, 24950002, -15178414, }, + { 161219120, -49005040, -15503221, }, + { -148966640, -8432095, -10384694, }, + }, + { + { 70368744, 40104256, 7168301, }, + { -677316864, 14061186, 9455907, }, + { -505640608, 25171730, -6891275, }, + { -53633940, 6905234, 24492588, }, + { -189773664, -74050072, 12053289, }, + { -18511310, 73076184, -34952980, }, + { -274234208, -24685324, 5230197, }, + { -4431870, -109918952, -13494250, }, + { -492537184, -25987774, -7692287, }, + { -306285408, -42193220, 5999533, }, + { -599594048, -23166516, 4469451, }, + { 38758320, 112756312, 18760418, }, + { -191659696, 30705258, -6935836, }, + { 155024704, 18436684, 11340861, }, + { -190430256, 6300180, 2592550, }, + }, + { + { 201780240, -15927349, 6103149, }, + { -703675648, 6285148, 19589346, }, + { -480631552, -14164802, 4212289, }, + { -26402774, 37356016, 6506339, }, + { -289732576, 36455684, -11339787, }, + { 8114267, -85212688, 19082002, }, + { -392567520, 29936458, 4489852, }, + { -11103027, -59286116, -30707406, }, + { -637229248, -15723875, 13287555, }, + { -342789920, -1901597, -1787243, }, + { -666988032, 24908662, -3487514, }, + { 87287160, 509491, 50570020, }, + { -247421792, 2945811, 11980811, }, + { 45361296, 54193360, 18922016, }, + { -257889696, 23130010, 7347616, }, + }, + { + { 218355600, -34307660, 480499, }, + { -745239104, -65278672, 3823058, }, + { -427974176, 13306882, 4248797, }, + { 16760573, -17125108, -23188528, }, + { -328094688, 20603494, -9194451, }, + { 18897320, -29428580, 37408092, }, + { -472696032, -13945222, 2480344, }, + { 6292664, 70817032, 18086644, }, + { -753866624, -50825568, 22191022, }, + { -262117552, 39137352, 463856, }, + { -752061120, 3488587, 2753074, }, + { 26259430, -141933104, 14274324, }, + { -333270144, -49004504, 5350456, }, + { -102069360, -82435456, -2142115, }, + { -328640160, -23949274, 2633352, }, + }, + { + { 144449952, 51578264, -16460999, }, + { -754358400, 10646150, -22409528, }, + { -357978016, -12630962, 2121714, }, + { 55548960, -74437152, -11065983, }, + { -285058048, -47072840, 8100845, }, + { -3855270, 108625088, -8880919, }, + + { -484483040, -2369211, 765041, }, + { 8435316, 56591564, 22964116, }, + { -806595392, 50464792, -6066105, }, + { -92471184, -44889924, 1385664, }, + { -842413824, 19781008, 13151727, }, + { -65707096, 88061328, -49775988, }, + { -431250688, 22603876, -4613332, }, + { -180423520, 15318001, -21953188, }, + { -372310304, 17492864, -4533875, }, + }, + { + { 44034688, 8211441, -15715822, }, + { -684178112, 95209224, -2731062, }, + { -287447136, 12063489, 279173, }, + { 54791972, 38640212, 32280438, }, + { -179376624, 21377126, 15723875, }, + { -22044994, 1953673, -47797080, }, + { -417241056, 28506234, 754841, }, + { -8842264, -70665632, -25028922, }, + { -744435968, 54001160, -14835891, }, + { 101118560, 45958296, 417686, }, + { -913782720, -34616364, 5817533, }, + { -69034616, 108603080, -42297912, }, + { -510893888, -4614943, -121870, }, + { -127882648, 64976412, -14567455, }, + { -367728128, 21326660, -4706211, }, + }, + { + { -42392400, -21832930, 8923331, }, + { -564688896, -35052840, 25179782, }, + { -228388112, -6603512, -1784559, }, + { -7439420, 99392520, 24076512, }, + { -45775760, 11540040, -2239826, }, + { 4673998, -168884560, 13025562, }, + { -287786976, -36048736, 3089155, }, + { -4969814, -100874824, -13440026, }, + { -578127296, -82212656, 6925098, }, + { 243358208, -19028316, -324270, }, + { -928045824, -1262184, -3357591, }, + { 15159624, -137618272, 30216706, }, + { -554744960, 3474092, 3419331, }, + { 15227807, -86528024, 12173011, }, + { -317898976, -36552856, 7756711, }, + }, + { + { -112510424, -23877870, 18947786, }, + { -456805216, -32255742, 6639483, }, + { -189299072, 1576253, -5324686, }, + { -75048112, -87878256, -31089658, }, + { 84136264, 11220602, -24946780, }, + { 22120156, -68032816, 49400712, }, + { -142671296, 12062953, -4116726, }, + { 10969883, 14823006, 30617748, }, + { -386223872, 31193810, 14438069, }, + { 284063232, -5093295, -1347546, }, + { -868519680, 35133368, -316217, }, + { 68075232, -55910812, 46515568, }, + { -553373760, 14804752, 6683506, }, + { 136529488, 2549063, 20943334, }, + { -251979296, 713501, 10266582, }, + }, + { + { -156559072, 38678864, 4654134, }, + { -378490784, -996969, -17370996, }, + { -177369808, -8266739, -4779225, }, + { -63569812, -68194416, -41852308, }, + { 164008688, -47361140, -20721606, }, + { -7510824, 127864400, -22777822, }, + { -41226856, -7129109, -16905528, }, + { -351650, 98158256, -1477469, }, + { -250573216, 15700790, -3388192, }, + { 221876944, 31637802, -2272038, }, + { -758244288, -43934296, 9135932, }, + { 32112934, 97078608, -2900177, }, + { -509314400, -7141457, 8430484, }, + { 150665312, 52821120, -552440, }, + { -189582544, 6276558, -1442035, }, + }, + { + { -151924800, -20779588, -18118856, }, + { -328674528, 40242232, -8975945, }, + { -197082096, 10024454, 5124433, }, + { 23447300, 142530640, 18077518, }, + { 121245856, 23868208, 8290361, }, + { -17070348, 82138032, -36723044, }, + { -43131672, 14383309, -12541841, }, + { -10189273, 27262842, -28318866, }, + { -222328448, -24732570, -24415816, }, + { 98813240, -37815576, -5346161, }, + { -643103680, 13499619, 10624138, }, + { -32130650, -23995982, -29850560, }, + { -433130816, -2343979, -1904281, }, + { 66393216, -25447144, -11730629, }, + { -130950328, 6957310, -9563818, }, + }, + { + { -82459080, -81389632, -9319542, }, + { -316999200, -14724222, 9760850, }, + { -243403856, 21904334, 10335302, }, + { 80673984, 31187906, 46925204, }, + { -99811816, 84763328, 21679384, }, + { 6947647, -79027400, 22248468, }, + { -198692160, 24356222, 7185481, }, + { 5288716, -85655072, 15171972, }, + { -320020704, -14198088, -14484777, }, + { -23347980, 18650358, -4894652, }, + { -556219712, 2996277, 857383, }, + { -50790672, -43757664, -17422534, }, + { -335211456, -24299852, -10462540, }, + { -48816600, 7784092, 60666, }, + { -80444200, -19557134, -8613020, }, + }, + { + { 28313498, 68919728, 29562796, }, + { -347980928, -34109556, 8020315, }, + { -287355328, -37504728, -2088965, }, + { 43435004, -117633784, -2157147, }, + { -463089824, -142948320, 688269, }, + { 11658152, -67379984, 22993108, }, + { -511685216, -97947264, 14437533, }, + { 6668474, -75892608, 18337362, }, + { -545768448, -23956790, 19153406, }, + { -100530152, -2284386, -539555, }, + { -496568000, 10121090, -3943854, }, + { -11123428, 53504556, 7702487, }, + { -244320288, 33477122, -5918465, }, + { -125293856, -21958020, 3791383, }, + { -58093192, 16689706, -701690, }, + }, + { + { 121521808, 72422816, 14588393, }, + { -396235424, 28530394, -5670968, }, + { -282284032, -7220914, -12603045, }, + { -29173566, 10940355, -32751274, }, + { -828566848, 74083352, -14059575, }, + { -3834869, 36973764, -14339822, }, + { -900029696, 114861920, 3750043, }, + { -7813620, 29796872, -22095460, }, + { -871949760, 122431264, 20877836, }, + { -124764504, -6745246, 2953864, }, + { -446641152, -12294881, -1540820, }, + { 35043712, -7324530, 17977122, }, + { -208990432, -14132590, 3662533, }, + { -118506736, 918586, -7269769, }, + { -93645320, 16217797, 3842922, }, + }, + { + { 177756880, -53181360, -43604120, }, + { -419816416, 8409546, -7485055, }, + { -214271616, 35051228, -9516574, }, + { -58577984, 59515360, -5730023, }, + { -1052510208, -350577, -2594160, }, + { -8056822, 27921046, -14477261, }, + { -1222012160, -62816044, -4646081, }, + { -2239289, 70632888, -5808944, }, + { -1199319168, -109910896, -8547522, }, + { -115676888, 8247948, 5041755, }, + { -391830400, 9975598, -1738388, }, + { 37157372, -27774480, 10413685, }, + { -266380320, -31537408, 6293738, }, + { -31960462, 46750720, -7976828, }, + { -199360032, -39514236, 302795, }, + }, + { + { 199287552, -94219232, -37252936, }, + { -396419040, -24897388, 826781, }, + { -130629816, -32934882, -3066070, }, + { -33716568, -9487583, 13584982, }, + { -1081162496, -33790120, 10034117, }, + { 79457, -27114128, 4269735, }, + { -1362517120, -8376260, -2020782, }, + { 7618198, -1657857, 21300890, }, + { -1395718912, -11603928, -10591926, }, + { -99994888, -1045288, 5325760, }, + { -326496960, -19525996, -1824824, }, + { -1633698, 41486164, -4496294, }, + { -410237024, 55961812, -733366, }, + { 73531984, -48038136, 6064494, }, + { -351074912, 34980900, -888521, }, + }, + { + { 136010880, 91286848, 39137352, }, + { -333237920, 21934934, 6692096, }, + { -113062864, 3367791, 2892124, }, + { 12907987, -13196824, -686121, }, + { -955450368, 55922084, 16620987, }, + { 6760816, 1138703, 12552042, }, + { -1298857728, 66461936, 10081362, }, + { -1005559, -65381212, -3132642, }, + { -1401256192, 60880624, 15841450, }, + { -90000504, -4531728, 3397856, }, + { -258166192, 19531900, 1465658, }, + { -35472136, -13742822, -16918950, }, + { -588642432, -44282724, -6445672, }, + { 120281096, -2138357, 13868986, }, + { -504519072, -33069100, 473520, }, + }, + { + { -61631708, 124418760, 64017560, }, + { -254524592, -2734284, 2728378, }, + { -230375600, 51568600, 2342905, }, + { 46897820, -24514062, -4051228, }, + { -770130560, -32261646, 16159814, }, + { 2195265, 32971390, 1871532, }, + { -1104524928, -65782256, 21886616, }, + { -6711960, -24285356, -18641232, }, + { -1255872000, -36322540, 23219666, }, + { -76220104, 3022046, 135828, }, + { -201167680, -5025649, 1708860, }, + { -25882010, -39599060, -10532870, }, + { -739942336, 13878650, -3015604, }, + { 77534360, 47942036, 4677220, }, + { -617759616, 16445430, 190589, }, + }, + { + { -302229856, -201453824, -6583648, }, + { -187215472, -7235410, -10152766, }, + { -488476288, -75664976, -1499481, }, + { 40810244, 9884867, 11841762, }, + { -608733248, 6152541, 4904316, }, + { -6236293, -10264972, -12664785, }, + { -889736320, 22035866, 17557826, }, + { 4205310, 55413132, 12076374, }, + { -1036020224, 34490196, 10843182, }, + { -38071128, 9797894, -2145336, }, + { -163429408, -4794794, -3781182, }, + { 13130789, 43269112, 10496363, }, + { -828692992, 8045548, 7798050, }, + { -14405857, -42557220, -9413495, }, + { -667675776, 8978092, 4118337, }, + }, + { + { -372883168, 9153112, -65391952, }, + { -160387504, -1212255, -19085760, }, + { -823048896, 74214888, 928250, }, + { -5722507, 47615080, 8771397, }, + { -502844576, 3480534, -8838506, }, + { -2830920, -35772244, -3490735, }, + { -725349632, 5845988, -944893, }, + { 3865471, 58133992, 10559177, }, + { -809384448, -33443836, 322123, }, + { 35654672, -20708722, -2545305, }, + { -145547856, -523986, -8354249, }, + { 33141042, 9367324, 18559090, }, + { -854448832, -1685238, 14260902, }, + { -82688320, 1826435, -12265353, }, + { -659427776, -14470282, 10415833, }, + }, + { + { -163187280, 201135472, -33787432, }, + { -216790624, 7305740, -11348914, }, + { -1140422784, -67091148, 2142115, }, + { -49104360, -39777304, -14513768, }, + { -447214016, 13685913, -13014288, }, + { 5139465, 7147900, 11028939, }, + { -622485696, 1927367, -16253230, }, + { -5451387, -9884330, -15425375, }, + { -621990720, 24934970, -7023882, }, + { 130730216, 20885352, -3863860, }, + { -151061520, 8894877, -4932770, }, + { 12105365, -50302120, 1881196, }, + { -831482048, -8508330, 7725036, }, + { -83483960, 32781338, -2046015, }, + { -613759936, 203474, 8196945, }, + }, + { + { 185291872, -169782208, 30771830, }, + { -404893024, 25424058, 9195525, }, + { -1356832256, 19707458, 4005057, }, + { -41713260, -31788126, -19857244, }, + { -434513248, -21893058, -2569464, }, + { 3011309, 25533580, 4052839, }, + { -568107648, -28803124, -13408351, }, + { -689342, -44617196, -1606855, }, + { -497736256, -24537686, -8870718, }, + { 208048208, -13804562, -6235219, }, + { -191575936, 2828236, 2968896, }, + { -20891258, 22090090, -17161078, }, + { -767861248, -8555038, -2246268, }, + { -29853244, -30506078, 9749039, }, + { -545730880, -3384971, -1339493, }, + }, + { + { 398036096, -5266167, 44648868, }, + { -739606272, -100307352, 17949206, }, + { -1428731648, 29643864, 17725330, }, + { 10814728, 70556112, 6454262, }, + { -470966240, -4185983, 9080098, }, + { -3702262, -11188927, -8196408, }, + { -565363712, 21619792, 3001109, }, + { 4640176, -5299453, 12935905, }, + { -451304960, 16711181, -1861868, }, + { 219822864, 5193689, -3836480, }, + { -275544704, -30096446, 4315906, }, + { -24570972, 37352256, -10452877, }, + { -670961920, 34142844, -2099702, }, + { 29928406, -4066260, 7910793, }, + { -462515904, 25297894, -3964255, }, + }, + { + { 320299872, 114648784, 17737678, }, + { -1158839040, 133191232, 3401077, }, + { -1360001408, -29389388, 28477780, }, + { 48848812, 1812476, 23652922, }, + { -553707200, 34342020, 9373766, }, + { -3304977, -18860812, -5110474, }, + { -629009216, 16498043, 14461692, }, + { -1039919, 36833104, -3190087, }, + { -484815360, 2575370, 9782862, }, + { 135019280, 15649787, 5561983, }, + { -390961216, 37847788, -1415192, }, + { 581968, -30288646, 8622147, }, + { -562095808, -33288144, 4657355, }, + { 58433032, 15504295, -4299263, }, + { -378714656, -26498338, 1365800, }, + }, + { + { 29576218, -145640736, -14351096, }, + { -1534202624, -69030864, -7241315, }, + { -1168657408, 18329310, 17115982, }, + { 31003222, -59195388, 4426501, }, + { -649110784, -39743480, 20401, }, + { 2608119, 14380624, 6142340, }, + { -744678592, -49221400, 11759620, }, + { -3774740, 17121888, -10470057, }, + { -568391680, -36477156, 13024488, }, + { -33743412, -50315540, 11559368, }, + { -508062944, -21304648, -3766150, }, + { 20067698, -9561134, 10832444, }, + { -469737888, 12621298, 6405407, }, + { 50327888, 2709051, -6794102, }, + { -315902368, 10422812, 4415227, }, + }, + { + { -246708288, 73049880, -39247412, }, + { -1751132288, -13207024, 7250442, }, + { -862555584, -51076288, -4444218, }, + { -14945949, 21788370, -14555107, }, + { -702395712, 1078574, -4603131, }, + { 3284039, 15173046, 5415417, }, + { -849413504, 41333156, -40802, }, + { 2523830, -29244432, 7238094, }, + { -631552384, 39072392, 281857, }, + { -217172336, 63978908, 4052839, }, + { -601198784, 3279745, 1770063, }, + { 14478335, 20039780, 1262184, }, + { -408027264, 255014, 2056753, }, + { 17275970, -4272419, 2461016, }, + { -285526752, 3602941, 2639258, }, + }, + { + { -311022208, 84281752, -26998702, }, + { -1774035712, 41514616, 28337658, }, + { -463400128, 103843184, -11556683, }, + { -38556460, 16538308, -10299332, }, + { -673888960, 36447628, 4330401, }, + { -1606318, -12928388, -4128537, }, + { -860121984, 13616120, -5515275, }, + { 2370822, -30808338, 6453725, }, + { -589480512, 21443698, -10248329, }, + { -313834336, -20128902, -7716983, }, + { -663360384, -3179350, 8325257, }, + { -5477694, -12163884, -4982162, }, + { -367748000, 2401424, -1614371, }, + { -24133958, -15887621, 5986111, }, + { -279149792, -5903970, -234076, }, + }, + { + { -153765200, -139129024, 20012936, }, + { -1633565056, -29656750, 29936996, }, + { -41030360, -112123344, -2557653, }, + { -22300008, -26103200, 1022739, }, + { -567753856, -29372744, 10521059, }, + { -3102040, -8038568, -5382668, }, + { -733468224, -61831424, 1477469, }, + { -3411815, 11391864, -9660992, }, + { -406942240, -78030968, -4046933, }, + { -254887520, -47447576, -7445326, }, + { -699962112, 10571525, 8303246, }, + { -17091822, -501974, -6423661, }, + { -326485152, -11907797, -1275068, }, + { -50830400, 18388366, -1570347, }, + { -272977376, -2227478, -886374, }, + }, + { + { 61715460, 32014150, 39172788, }, + { -1375184640, 31143344, 11145977, }, + { 300763136, 64285460, 5029407, }, + { 12705050, 14372571, 7395934, }, + { -418000160, 20066088, 2936684, }, + { 612570, 13727252, 1901060, }, + { -501899136, 63888176, 6962142, }, + { -515933, 32912334, -1219234, }, + { -136055440, 77131168, 5029407, }, + { -62121332, 72037336, 844498, }, + { -712420736, -4226785, 4772783, }, + { -8580271, 16182900, -2963528, }, + { -264470672, 20142322, 1314260, }, + { -42459508, 6663642, -7353521, }, + { -242160992, 13138842, 776852, }, + }, + { + { 173917728, 60976724, 8347806, }, + { -1027720192, -77440408, -3391414, }, + { 483799072, -339839, 655519, }, + { 30398168, 9349607, 5104569, }, + { -260935904, -33547452, -3558381, }, + { 3087008, 1705102, 5864778, }, + { -247261808, -51369956, 4529043, }, + { 3295314, 5176510, 9279277, }, + { 119048440, -45323180, 4776004, }, + { 158658240, -48439180, 2936684, }, + { -688588480, -17838610, 6984154, }, + { 9170292, -17559974, 4941360, }, + { -172061760, -25860534, 3860102, }, + { -2390149, -26675506, -3151432, }, + { -172681840, -21907018, 2871723, }, + }, + { + { 148426560, -44091060, -21153788, }, + { -607247168, 129044440, 7869991, }, + { 504355872, -35570920, -10821707, }, + { 16774532, -11637751, 798864, }, + { -122338920, 43845172, 3470334, }, + { 70330, -16952772, -434865, }, + { -42919072, 41804528, 5733782, }, + { -1134945, -27432492, -3331284, }, + { 271430656, 12314208, 1133335, }, + { 284485760, 14280229, 1416802, }, + { -601181056, 36340256, 16134582, }, + { 14782741, -4701916, 8718784, }, + { -46436648, 27926414, 4838281, }, + { 38227892, 19090592, 4918275, }, + { -63385664, 26146688, 3585761, }, + }, + { + { 50165220, -2446521, -14534706, }, + { -131955888, -102776416, 23400592, }, + { 429276064, 26648124, -16449725, }, + { -10225243, 10250476, 235149, }, + { -5843840, -23798414, 13560285, }, + { -3149285, 965831, -6698002, }, + { 91384016, -18622442, 12086575, }, + { -2464238, -18131742, -6780680, }, + { 302248128, 11066520, 1255204, }, + { 248285616, 21774410, 6012418, }, + { -411309696, -33869576, 17572322, }, + { 2075543, 25417080, 1172526, }, + { 112084152, -22398254, 80531, }, + { 45845556, 5286568, 8261370, }, + { 76741400, -22457310, -71941, }, + }, + { + { -42478836, 3827353, 5222144, }, + { 373993952, 17577690, -7036230, }, + { 342384608, -4961761, -11625940, }, + { -25247966, -19390166, -7270306, }, + { 114021184, -14768782, 3609383, }, + { -331249, 19904490, -118112, }, + { 199094288, -22322018, 2608656, }, + { 2378338, 17207250, 6906308, }, + { 266570896, -30332670, -670015, }, + { 78420200, -62676456, 9542880, }, + { -89402432, 24081882, -7893613, }, + { -12401181, -14681809, -10343892, }, + { 293430016, 18987514, -13280576, }, + { 15437186, -26183194, 3886946, }, + { 228244768, 18317498, -9505836, }, + }, + { + { -84415968, 16539382, 6498823, }, + { 865165312, -25497610, -74502112, }, + { 288153120, -2291902, -5586142, }, + { -14707042, -15683610, -13768591, }, + { 269447456, 15268609, -30878668, }, + { 3339874, -1758252, 7729868, }, + { 343504512, 29538100, -36380520, }, + { 854162, 28677496, 2340757, }, + { 247785248, 36953360, -18047990, }, + { -113531552, 79529376, -3664681, }, + { 336332992, -61252676, -49850076, }, + { -10072235, -23138600, -8646306, }, + { 461719200, -34638376, -24414204, }, + { -24495272, 27974196, -6864969, }, + { 356392640, -25852482, -16559783, }, + }, + { + { -67956584, -5862094, -7258495, }, + { 1228776704, 177195312, -76141720, }, + { 257796816, 5892159, -2051384, }, + { 14698452, 70069168, 11866995, }, + { 447683776, 69246144, -48252348, }, + { 3221, -25773562, -967441, }, + { 530176128, 71143448, -61755188, }, + { -2878165, 2015413, -8126078, }, + { 289620928, 16216186, -37874096, }, + { -202235520, -27891518, -27511950, }, + { 735616256, 161502048, -48373680, }, + { 6163815, 36712844, 10152229, }, + { 549467520, 55591908, -11610370, }, + { -37738804, 3149822, -14293651, }, + { 412312032, 35161288, -6841883, }, + }, + { + { -14148159, -41238128, -6071473, }, + { 1281082496, -211401504, 48896056, }, + { 215368448, -6750078, 6689412, }, + { 24906516, 30822296, 27560268, }, + { 560569984, -152013392, 4828080, }, + { -3439732, -5625334, -8611946, }, + { 662074560, -195179424, 1111323, }, + { 1498407, -29228326, 4475893, }, + { 355079968, -117149528, -9849434, }, + { -138740864, -89582280, -22839026, }, + { 905934208, -173703504, 37728068, }, + { 11938935, 25028386, 14175540, }, + { 489035168, -18500572, 24653112, }, + { -13491566, -49535468, -1341640, }, + { 355331232, -2408940, 16406238, }, + }, + { + { 35444756, 40083320, 15843061, }, + { 894766784, -193518336, 137400832, }, + { 135316704, -25804700, 14344654, }, + { -4183298, -105033960, -19880330, }, + { 490654912, 5720360, 78753056, }, + { 1813550, 32169842, 6186364, }, + { 589552960, 32260036, 101505648, }, + { 810138, -33732136, 2275796, }, + { 345121568, 67742912, 59600724, }, + { 6849399, 137312256, 30303142, }, + { 704745088, -125802280, 102349072, }, + { -2047089, -48783312, -11823508, }, + { 274665856, -114824880, 32450088, }, + { 19188840, 24214488, 20062866, }, + { 192652368, -84133040, 18580028, }, + }, + { + { 39803072, 51194400, 12788802, }, + { 204740016, 647619328, -38720204, }, + { 30276298, 68772624, -49929, }, + { -16612934, -90500864, -22324704, }, + { 214110032, 314792640, 22679038, }, + { 1224066, 38911328, 2881923, }, + { 262058496, 396546272, 36606544, }, + { -1625645, -15795816, -4760971, }, + { 187617600, 208635008, 42795056, }, + { 94519344, 41808284, 52547316, }, + { 215489776, 484327904, -23882166, }, + { -7446937, -47923244, -10260140, }, + { 5176510, 190813584, -29558502, }, + { 20531018, 61265560, 6198712, }, + { 1622424, 120248880, -21247204, }, + }, + { + { 6014565, -55379308, -21743808, }, + { -328660576, -106819056, -240462336, }, + { -49900540, -34383896, -26082800, }, + { 251792, 29870960, 22744000, }, + { -92435216, -211497072, -125123672, }, + { -1044214, 21117280, -3644280, }, + { -116375896, -290485824, -160718208, }, + { 306553, -1584306, 1057636, }, + { -39702140, -239503488, -88157424, }, + { 55978456, -186956704, -25972204, }, + { -207131248, -121513752, -184537568, }, + { 48318, 9571335, 11224897, }, + { -152331216, 24865176, -69481296, }, + { -513249, -18034568, -19814832, }, + { -104797200, 22180822, -42998528, }, + }, +}; + const float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= { { @@ -11268,6 +21732,9110 @@ const float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]= /* Binaural rendering data set based on BRIRs */ /* Tables derived from Mozart IIS BRIRs.*/ const float FASTCONV_BRIR_latency_s = 0.000937500f; +const Word32 leftBRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= +{ + { + { + 955630, -56401512, 71553080, -7202124, 14854681, -289910, -25734370, -24148454, -9604084, 7688529, + 3944928, 16365973, 24145770, 3041911, -18577344, 10116259, 1116692, 18020072, -8924405, -17782776, + 2440078, -3891777, -11002096, -6689949, -1865090, -3699041, 1784022, 14807973, -2104534, 9245454, + 3911105, -4662724, -8611409, 6744173, 8320963, 872415, -13594645, -4185446, 14039174, 11704860, + 9465571, -18884972, -12775917, -2767570, 3891777, 3892851, 1280437, -3608310, -660351, -7697119, + -4881767, -1100049, 6172405, 3729105, -2437931, 4495757, 11756399, 6304475, 1001264, 3349001, + -1078037, -3046743, -1759326, -3722663, -3763465, -4314295, -9758166, -10887205, -4013110, 4864588, + 3716757, 4247723, 7022272, 863825, 7347616, 4841502, 3462818, 1126355, 208306, -2952253, + -451508, -1532230, -2476049, -4361003, -3837017, -731218, -1354525, -2653753, -1578937, 2069101, + 2981244, 1188095, -620086, -981937, -645856, 2829847, + }, + { + -1311576, -44833016, 52809308, 20124070, -7298223, 7428683, -20112794, -26019448, -15743739, 7221451, + 3786014, 9812927, 23059680, 8296266, -4772246, -9333501, -3495030, 22775674, 6451578, -15588047, + -3861713, -3238405, -14569603, 4369056, -18870476, 1163399, -4538707, 4942434, 7320772, 16517907, + 7077033, -9692131, -2573222, 6464463, 15781320, -7569880, -9329743, -1761474, 1338956, 8577587, + 4078608, -13250511, -4842576, 1410897, -4496831, -6114423, 10885595, 2915746, -3623879, -9056475, + -1188632, 920734, -630286, 769336, 3739843, 3173444, 8007967, 3762391, 6295885, 2049236, + 2841121, -3790309, -4130685, 468151, -3692061, -9145059, -7194070, -9555228, -2115808, -1827509, + 1188632, 5782100, 3993783, 4580046, 6547141, 7119445, 4317516, 6382859, -9127, -4071629, + -1392106, -4250944, -3717831, -4915590, -4575751, -470836, -1989107, -2849711, -287763, 2491618, + 2900177, 2003065, -734439, 3603478, -714575, -537, + }, + { + 846645, -51560008, 65578780, -3467649, 11985643, -14496, -34191696, -10616085, 6696928, -16768626, + 3975529, 12719009, 17405892, 421981, 7388955, 8446590, -11999602, 5041218, 5821828, -4824322, + 4554813, 7254737, -16798690, -12226161, -17508434, -12820477, -18455474, 12651900, 17714592, 31745178, + -1173063, 2865280, 8354249, -6429566, -4991289, -2551211, 3945464, -6769942, -3623879, -2477123, + 17372068, -1060320, -9668508, -6466610, 227633, 5158793, 355945, -9684614, -14144938, -3158412, + 2430415, 4786204, 4989142, 4218195, 7206955, -497142, -4730907, 8289287, 16455630, 9026948, + -95026, -4500052, -7610145, -1175747, -2637110, -12382391, -5749888, -10532870, -6753836, -8295193, + -1273458, 5917391, 7514582, 8136279, 8282308, 6990596, 10880226, 4264366, 3420405, -731755, + -3424700, -5625871, -5663452, -2662343, -3533148, -6499360, -3908957, 668404, 4457639, 2295123, + -1757715, 917512, -1787243, -1447404, -3212636, -1024887, + }, + { + -3221, -14889041, 41400264, -24458766, 17313014, -4783520, -15139760, -12379169, -14835891, -15014132, + 22133578, 12795781, 29772714, 780073, -1830193, -7704635, -15730318, 7419019, 479426, 2147484, + 6044630, -15578920, -20714628, 21677236, 10593000, -19315542, -18246094, 18170396, 14378477, -641561, + -7690676, 4871567, 3986267, -6784438, -1041530, 6685117, 1952063, -1824824, 2739652, -4158065, + 3786014, 2329483, -10746008, 3197066, -2314451, -6073621, -227096, 6054294, 3076270, -6460168, + 2093797, 4477504, -7090991, 421444, 3288334, -1559610, 5998996, 1897839, 899796, 1254667, + -2653216, -1816234, 543313, -1127429, -1208496, -3417183, -1496259, -2777770, -1161252, -2347737, + 3996467, 3113851, 4970888, 3305514, 434329, 954557, -2626373, 940598, -2228014, -49929, + -1999307, -625992, 574452, -1304596, 1120450, -1971390, -1712618, -198105, 354872, 1163936, + -645856, -1143535, 1695975, 1965484, 1514513, 1279900, + }, + { + -83215, -37740416, 48824116, 17595944, -16422881, 11187853, -15471009, -16932908, -20108500, -14439143, + 20119774, 12538620, 27537720, 1609539, -1927904, -1859184, -14825153, 7864622, 14259291, -16841104, + 2458869, -14470282, -9630927, 11508365, 10256382, -27176942, 4635881, 15280420, 11556146, 3828963, + -15209016, 304943, 2483565, -3546569, 2515777, -1784022, -4479114, 17565342, -913217, -1464584, + 460635, -5113696, -7748121, 4641249, 942745, -1860258, -14445049, 2402497, 9538585, 4505421, + -926639, -2628520, -1157494, 3940096, -2921115, 1206886, -111132, 4532264, 3532611, -2791192, + -3420942, -2048699, 3889630, 3206193, -3846680, -3086471, -6444062, -245350, -1256278, -1326608, + 247497, 4518306, 4786741, 3178813, 3710315, -198642, 2398202, -1359894, 564788, -6035503, + -1075352, -654983, 771484, -1928977, -659278, -391916, -413391, -2914672, 226023, 1316408, + 229781, -285078, -147103, 1852742, 3003256, 2175938, + }, + { + 429497, -18229988, 51657184, -36218924, 24843702, -6630893, -25108378, -11571179, -11758547, 6728603, + -10676215, 15838229, 37663640, 20347408, 4346507, 2557116, -40708236, -12735652, 8860518, 13119514, + -22288732, -19586662, 4494684, 21735756, -1844689, 17537962, -7939784, -13899588, -1504849, 1108102, + -1074816, 20643224, 9296994, -2589329, -23380728, 2994129, 3588445, 5702643, -377420, -6110128, + -19216758, 12066711, 5181341, -503585, -7817378, 3932043, 3316789, 1403917, 3202972, 7062537, + 688269, 1873143, 3183108, 1159104, -3831111, -8195335, -12437688, -2912525, 756451, 1042066, + -3373697, 324807, -927176, 6636798, 3493419, 4437238, -3259880, 1663763, 2587181, 5145908, + 2611340, 5506148, -2988224, -1916092, -2033667, -3062312, -4067334, -4774930, -4763119, -2268280, + -1965484, 3067144, 4863514, 4336843, 3530463, -683974, -5199595, -2287070, 1170916, 1711545, + 2158221, 2997350, 2338073, -262530, -448287, -668941, + }, + { + -1526861, -33169496, 43344808, 21916682, -18523120, 12035035, -13185550, -20113868, -16994112, -9774272, + 5463736, 755377, 28490128, 36409512, 6133750, -6323266, -24343874, -16369194, 4869419, 15558519, + -10058813, -26201448, -10751377, 19796578, 17725866, 1058173, -11373073, 4848481, 3506841, -11630235, + 690416, 24461986, 4437775, -12823699, -14641544, 2276333, 2867965, 4917738, -603980, -12462384, + -5184026, 11302743, 4664335, -10024991, -815507, 6053757, 1127429, 366683, -1631551, 3871913, + 10836202, -1217623, 7317551, -2661269, -6754910, -8462696, -3441880, -6065568, 546535, -7093139, + -736050, -612033, 8959839, 4692789, 5025649, 719407, -38118, -3905199, 2468533, 2549063, + 3538516, 4129611, 681826, 526670, -5638219, -4138738, -446140, -4017942, -3112778, -2551748, + -449361, 1946694, 3329137, 1299228, 1998234, -455267, -2357400, -1557463, 437550, 3346853, + 1443109, 2259153, 788663, -2113661, -382789, -316754, + }, + { + 750009, -24122146, 57381300, -35054988, 20176682, -5215164, -15900506, -12277164, -19737522, -1633161, + -4049617, 36446020, 29082834, 4054986, -6757594, -2123325, -16394427, 26415122, -11003706, -23857470, + -13677860, -4743255, -7586523, -6018860, 37881612, 16131360, -12305618, -16450798, 5511517, 1006633, + 5833103, 6218039, 2221035, 11902965, -6686191, -13548474, 2235531, 1147293, -7121056, -7100655, + -5648419, -7016366, 4626217, 15558519, -5508833, -541703, 132607, 14230837, -674847, 2589865, + 1608465, 7885023, 5064840, 289910, -8781598, -9659381, -10472741, -14414984, -2544231, 1030255, + -1374390, 5420786, 2848637, 1905892, 4624069, 10380936, 6924561, -4703526, 132607, 4153770, + 5338645, 3786551, -556735, -7385733, -4364224, -3168075, -7790534, -7292318, -1952063, -1578401, + 1205275, 3726958, 5583995, 4036196, 1322313, -370441, -1847373, -2174327, 1073205, 4316442, + 3537979, 3555696, 641024, -2540473, -2753074, -1714229, + }, + { + -1874216, -29564408, 40481676, 19535122, -17163226, 17681844, -19085760, -21491480, -17167522, -4613869, + -2410014, 11465952, 29816200, 23623930, -7425999, 9899363, -14923938, -2356327, 3783866, -13794898, + -18100066, -3794604, -10102300, -13139379, 35639640, 26870390, -9924059, -32071594, 8880919, 3996467, + 19249506, 3389803, -80531, 4794794, -18520972, -2269890, 7998840, -6386617, -5887327, -9145596, + -1483374, 4617090, -599148, 6725382, 22012, 477278, 1571421, 2169495, 9607305, 1828046, + -7843147, 13845901, 9213779, -2003602, -7400766, -10539313, -8092256, -17858474, -3020973, 2206003, + -2686502, 4949950, 4315906, 6871411, 6625524, 4543539, 4168266, -3417183, -1662689, 3568044, + 6945499, 1603633, 1685238, -4859219, -7092065, -3569118, -3990562, -7015292, -2710124, 1207423, + 2381023, 3413962, -9127, 4974109, 352187, -2240899, -2711735, -326954, 3468186, 7126425, + 1637993, 1350230, 1037235, -3871913, -4494147, 10737, + }, + { + 1593433, -34591668, 53500796, 3851512, -4761508, -40943924, 20738250, -3905736, -347355, -7060390, + -15420543, 23711440, 4525822, -11809013, 9135932, -4775467, 15676094, -107374, 6274947, -3478924, + 18503256, -14930380, -4929012, -3094524, -33978024, 1962800, -1926293, 9983651, 33286, 16101832, + -16172162, 6118181, 2520072, -1665911, 13992467, 5567888, -4168803, 739808, 11567958, 9804337, + -6375342, -18939196, -12025908, -11606075, 11212012, -2457258, 15775415, 4415764, -2222646, -12043088, + -5688148, -2718714, 2859375, 4567698, 2790655, 5479842, 1500017, -1793686, -2020782, -4501126, + 3966939, 5257040, 4871030, 2639258, 1095754, -3595961, -7502771, -1962800, -6242198, -2481954, + -3056406, -1401770, -1094680, 2836289, 4232691, 3797288, 5218922, 3291556, 3126736, 165893, + 1950452, -2179159, -3988414, 1372779, -190589, -3409667, -1212791, -3323768, -4752382, -676457, + 1213328, -1684164, 2152316, 1478006, 927713, -963683, + }, + { + 849330, -40848896, 61627412, 4379256, -12181064, -35042100, 6587406, 8983461, 9312026, -20839182, + -4743792, 25668336, 2234457, -5073967, -1600949, 10459319, 185220, -7437810, 13970992, -10514080, + 15386183, -9263708, -25761214, 358630, -23902030, 6389838, 11165841, 9736691, 12190191, 14259291, + -1418950, -238371, -5638755, -8369818, 6783364, -3712462, -2825552, 941135, -2219424, -9336185, + 158914, -8436390, -1947231, 8473434, 12742631, 5592585, 14663555, -4271882, -12898324, -5235029, + -19659140, -2596308, 7956427, 13619878, 8919036, 6744710, -5397700, 2310156, -12255689, -849867, + -6550899, 8961449, 3752728, 2012729, -4468914, -8303783, -725313, 590558, 746251, 1833414, + 111132, 913217, -3850438, 985158, 5361730, 5450314, 1447941, -2041720, 2993592, -551366, + 578747, -4333085, -5713380, -2801393, -599148, -2465311, -1998770, 2749316, 119722, 3831648, + 3362423, 2167348, 2656437, -754841, -2534031, -912681, + }, + { + -3398393, -11048803, 41757284, -7365332, -16236050, -30749818, 31039728, -4917738, -5291937, -3270081, + -28123982, 23676544, 1997697, 29744260, 16588774, -10045392, -18864570, 2202245, -12756053, -10382010, + 6517613, 5865852, -4013647, 9783399, -17023102, 21246666, -3074660, 12327630, -27824946, -957241, + 7638063, 8919036, -299037, 4124242, -7197292, -12458090, -6103686, -2087891, 14046154, -6683506, + -2073932, 16040629, 9929428, -4022237, 10180146, 3019362, 1205812, -3857418, -3636227, 86973, + -11580306, -8217346, -6092948, -5848672, -3990025, -8492761, 2646774, 7793755, 7849590, 16182900, + 4663798, -1902134, -3831648, -1664300, -577673, -1951526, 468688, 7399692, 3216931, -386547, + 571768, -2568927, 1585380, -3343632, -6716255, -4909685, -6404333, -3952444, -1707786, 2229088, + 362388, 2727304, 2890513, 6395743, 2614025, 4796405, 5669357, 3487514, -2095944, 576063, + -2179696, -5226975, -5710696, -4687957, -4366371, -1383516, + }, + { + 29528, -44947908, 61915712, 12115566, -12628814, -20714628, -6650757, 19307488, -13297219, -1597191, + -44937704, 32720672, 11861626, 6560563, 32029718, 4384088, -17361868, -21849572, 9412958, -19053548, + 9121437, -1537598, 5192079, 945430, -12446278, 6073084, 8098161, 302258, -4421132, -11719355, + 10740639, 8796630, 12267500, -589484, -17199196, -15394773, -7385197, 3603478, -1011465, -1729798, + 13524852, 15502684, 5885179, -9271761, 7295002, 3152506, 4947266, 2002529, -1640678, -151398, + -10290205, -12147241, -14680198, -4065187, -3605088, -4036733, 9809705, 2471754, 6360847, 8842801, + 4236449, 2621004, -3433290, 884226, 2703682, -3403225, 892279, 5160403, 6687264, -4771172, + -1549410, 726923, -1240172, -3084860, -9038222, -4702453, -4214437, -4740034, -378494, 1117228, + 3194382, 3299609, 4878546, 2765422, 5793374, 4018479, 3326452, 1392643, 455267, -763967, + -2488397, -1197222, -5405217, -5071820, -4126390, -3290482, + }, + { + -2760053, -14543833, 43907452, -5901285, -7776039, -38376068, 32312650, -13619878, -1338956, 1401233, + -22995254, 16763257, 22550188, 7672422, -13998372, 12149926, -7812546, -13275207, 1649804, 12042551, + -3478924, 13375065, -11092827, -5349382, -1777580, 1404454, -7504919, -7371775, 3707631, -451508, + -7431904, 1879585, 3214246, 3359738, -2794413, 20146618, -2887292, 5125507, 10362682, 4229469, + -4213363, -17395154, -14405857, 8089571, -9727564, 3231963, 11468100, 4889821, -397284, 3156264, + -12018392, -2040110, -10309532, -8879308, 6991670, 8815957, 5019206, 3175055, 333397, 2032593, + -4130685, 1874216, 4569845, 6032819, -1329292, -3257733, -4106526, -6415608, -2876018, 1657857, + -106300, 4438849, -1909650, -804233, -1865626, -286689, -1013075, -1095217, 4155381, 4021700, + 1359894, 2034204, 1367410, -533113, -1873680, 522375, -2135673, -1770063, -1871532, -2578054, + 445603, -1636919, -27380, 708133, 33823, 284005, + }, + { + 1373853, -38042672, 56327424, 1605781, -472983, -27903328, 2189360, 6993818, -18913962, 11134166, + -17874044, 8638253, 10264435, 18843096, -15911780, 16057272, -3711926, -7901129, -5448703, 840203, + 13704167, 6318434, -12747463, -9862319, -13860933, 3795141, 2682744, 3577171, 3865471, 1516660, + -9586904, 13465259, -2474975, -10101763, -1691680, 13561896, -151934, 5605469, 4309463, 4927401, + -8294119, -8853538, -7393250, -279173, 3113315, 945967, 9955197, 3187940, 4620848, -8117488, + -16232292, -2612951, 4219269, -4006131, 4005594, 4014721, 3100430, 3945464, 1385127, -4629438, + -903554, 2616709, 1367410, 723702, 3362423, -3689377, 3052111, 1139777, -8177618, 196495, + -340376, -777926, -2470143, 80531, 991064, -806380, -2093797, 520228, 4050691, 2697776, + 2427194, 162135, -255014, 2372970, 1640141, -1500554, -2754148, -4945118, -3174518, 1598802, + -158914, 828929, 1123134, -500364, -751619, 294205, + }, + }, + { + { + -3608846, -103232224, -7816304, 22453552, 30351998, -5068599, -5549098, 1506997, -5217849, -359167, + 4461934, 3011846, 1022202, 3081102, 667867, 15144592, -5418638, 7482370, -7442642, -4961761, + 5898601, 858457, -6945499, 1809255, 13787382, 11055783, 330176, 11804181, 1428077, 8237211, + 4001836, 638340, -8912594, 4115653, 3964792, 5600101, 625455, -2366527, 6468221, 4332012, + 11641509, 2997887, 2764348, -4411469, 341987, 5669357, 3309272, -2096481, 297427, -2401424, + 758062, 124554, 2091649, 779000, -2553358, -3812857, 329102, -1327682, -3158412, 618475, + -2338073, -1026497, 916976, -1852742, 1625645, 653909, -960462, -1508070, -1023276, 3594351, + -966368, -1376537, 3215857, -1653562, 413391, 278636, 3443490, 334471, 1876901, 516470, + 456877, 654446, 695785, 30065, -652835, 1331977, 68183, -554588, 25770, 1450088, + 2750390, 1630477, -969589, -1425929, -1313723, 2123861, + }, + { + 2412161, -5752572, 53693532, 23626078, 6101001, 3279208, -9045201, -1270774, 469762, 8352638, + 3594888, -4044786, 4073777, 2970507, 311385, -16589848, -15625628, 6380174, -3463354, -7988103, + 3226057, -6164352, -12742094, 17654464, -7660074, -5208722, -7278896, 6918119, 4780836, 2203855, + 2295660, -1457605, 7328288, -4587562, 7152731, -6226629, -4775467, 3340948, -4161287, -4369056, + -967978, -1444183, 4031901, 3473555, -2749853, -3055332, 7412040, -628676, -2860985, -756451, + 6953552, 401579, -3544959, -1493575, -3676492, -3024731, 4941897, -1450625, 1922535, 514322, + 5224291, 376883, -2319282, -1053341, -144955, -3727495, -2296734, -3489124, 208843, -3084324, + -1426466, 2228551, -1041530, -1101122, 1356136, 644245, -3024194, 1533840, 1090385, 158914, + 792421, -2693481, 829466, 1578401, -579821, -52613, -966905, 751082, 1000191, -1114544, + -420370, 1970853, -809064, 2061584, -1107565, 290984, + }, + { + -1280974, -55959664, 35691180, 19917374, 28632400, 94489, -12852153, -3586298, 2353105, 15569, + 13412109, -1483374, 1015760, -3226057, 3391414, -3170223, -7722351, 12865038, 12896176, 2004676, + -784368, 3453691, -7835631, -825171, -2155000, 5752035, -5617817, 3215320, -7728794, 6078453, + -9371619, 923418, 2565169, -2400887, -3504157, -6050535, -1368484, -3797288, 3176128, -5833640, + 8746164, -2472828, -4480725, -1622424, 1515587, 1688996, -5327907, -1743757, 2561411, 2560874, + 2510409, 2752537, 976568, -973347, 7300371, 1187559, -6031745, 1124208, 3889630, 1371705, + -175020, 419296, -636729, 5130876, 4334159, -4732517, -173409, -1327145, 2886218, -3702799, + -3788161, -1008780, 1260573, 3202435, 2545842, -1496796, 2226941, -30065, 2617783, -444529, + -1396401, -1016834, -689342, -257698, 285078, 377957, 67646, -436476, 1125281, 748935, + -1943473, 155693, -1414655, 117575, 618475, 1708860, + }, + { + 952409, -80412528, -21235928, -17369384, 28725278, 4229469, -633508, 4485557, -4653597, -29805462, + -121870, -535260, 10148471, -5505075, -11087995, -8692477, 2212982, 11460583, -1889786, -3393561, + 2461553, -10461467, -10151155, 11399917, 4350265, -6658273, -9059697, 716723, -2457258, 1728188, + -3469797, -1705639, 3383897, -4119948, -3297998, 6304475, 5325760, 2892661, 4305705, -4735739, + -484794, -3512210, -8844948, 5364414, 2762738, 3695283, 2447595, 2234457, 3473555, -155156, + 6830072, 9108015, -867047, 3804267, 4305168, -2059974, 971736, 214748, 343597, 39192, + -3382824, 344134, 4984847, 580894, 564251, -3164854, -1694365, -622233, 3389266, 326418, + 3908957, 574452, 1131724, 648540, -1051193, 1800665, -17717, 2429341, -1606855, 1079647, + 845572, 1224603, 449361, -1131724, 814970, -1110786, 1224066, 1028645, -1724429, -1891933, + -1699733, -1691143, -196495, -357556, 158377, 1564442, + }, + { + 398358, -17474074, 38814156, 13526999, -12416214, -2067490, -3679713, -862752, -7592429, -2185065, + 21000780, -145492, 13270912, 5106716, -8755828, -14613089, -9073655, 1485522, 2933463, -12185896, + -3099893, -9373229, 10138807, 4716411, -3070902, -14459007, 11177116, 5273683, 7058779, 4327717, + -9452686, 734976, 3411278, -6149857, -4815195, -869731, 4038880, 10506027, -6701760, -2192581, + 5222144, 4726075, 1091995, -528281, -5803038, 3283503, -9820980, -2783139, 1427540, 2941516, + 3887482, 543850, 4137664, 7333657, -113817, -934692, -4135517, 1575179, 645319, 812286, + 3167539, -1389422, 1125818, 2633889, -405874, 2649995, -1934883, 1466195, -1291711, -3158949, + -2770791, -884763, -1438814, -1924145, 1796907, -384400, 2800856, -481036, 2009508, -2243047, + -489626, -635118, 1427540, -2147, 394600, -902480, 1029182, -1564979, -497679, 1222992, + 462783, 642635, -530428, -392453, 500901, 68183, + }, + { + 955630, -110530448, -32946158, -21823802, 40638444, 4989142, -5651640, 5108327, -7684234, 4206921, + 4596689, 6036040, -12902619, -6771016, -2412698, 2203855, -11133629, 7967701, 9437654, 2867965, + -13264470, -4049617, -12266963, -961536, -7042673, 10784663, -6791954, -15152108, -2068564, 6988449, + -3672734, 7232188, -3449933, 3567507, -6725919, 9970767, 9443022, 597000, -3349001, -3728569, + -12716861, 9658308, 1828582, 1523640, -1343251, 2868501, -3893388, -4117800, 424665, 4472672, + -4081830, -368293, 7478612, 5977521, 1452773, 1789928, 2285996, 4026532, 1463510, -1265942, + -4681515, 3081102, -1369021, 4303557, 1200980, -1339493, -3838627, 2719251, 1122597, 1344862, + 160524, 28991, -4490389, 781147, -324270, -584116, 840203, -1279363, -2629594, 261456, + -114354, 18790, -105764, -318901, 499827, -6979, -2842195, 831076, 812823, -526134, + 758599, 1946694, 1960116, -156766, 475131, 1781875, + }, + { + 2129767, 15836618, 60158532, 10005126, -14842870, -1238561, -5565204, -1147293, -878858, -3143379, + 6581501, 3985193, 8755291, 3813931, -14707042, -8743480, -13142600, -15482283, -4939750, 6463389, + -1216550, -5111548, -6667400, 5066988, -6051609, -13630616, 1966021, 14614163, -6454799, -8797167, + -2161979, 8516383, -5114769, -3762928, 2614025, 4486094, -4921496, -576599, 1013612, -2888903, + -224949, 3601330, -3576634, -9708774, 1582159, 6767795, 4714264, 1410360, -6336151, -1443646, + 6234145, -2426120, 7276749, 1488743, 363998, -115427, 1169305, -6497749, 2225330, -3146064, + -439697, -2156611, 1025423, -1451699, 4110821, 1692217, 2428804, -2771328, -1611, 2053531, + 775242, 1799591, 1985886, 3544422, -579821, 2254858, 2692408, -363462, 541703, -2326799, + -111669, 2452426, 1621350, -216359, 803696, -1451699, -1671279, -1619740, -1224066, 273804, + -1092532, 131533, 259846, -919123, -448824, 597000, + }, + { + -485331, -113216408, -30855582, -19718732, 30333744, -2593087, -2568927, -1943473, -8646843, 5921686, + 131533, 11369315, -2492155, 7175280, -11780558, -9247601, -10125922, 12890271, -8807367, -6951405, + -5269388, -8079371, 4155918, 3914326, 9517111, -2924336, -7107097, -10012643, 287763, -3171297, + 3751654, -882616, -1438277, 4760971, -4773320, -2667712, 1594507, 2123325, -5879810, -7968238, + -6306086, -7832947, -5340255, 2979097, -8580808, 1196148, 685047, 6550362, -9331353, 0, + 3220152, -2218351, -5305895, -801548, -5117991, -2455111, 1791538, 1368484, 4099010, -1621887, + -1116692, 2785286, -3098819, -932008, -492311, 504659, 2691871, -1851131, -482647, -1763084, + 791348, 3633006, 861141, -1556389, 1386201, -661962, 230854, 690416, 750009, 1259499, + 949725, -861141, -634581, -817118, -542240, 629213, 316754, 310848, 672699, 1017370, + 327491, 1838246, 1989107, 780073, 60666, -483721, + }, + { + 2094870, 25104620, 65843996, 9574556, -13515188, 1946694, -14127221, -3082176, -1728188, -1318555, + 157840, 3252901, 3789235, 5878737, -6725382, -1892470, -14003741, -8594766, 6660958, 7762617, + -2854543, 8069170, 3131568, -26506390, -1184874, 6294275, 3324305, -12418361, 10960757, 3600256, + 3589519, 1232119, -2177549, -1875290, -5760088, 332323, 8134668, -659814, -2993055, -3530463, + -1300838, 1289027, -295816, 1957431, -3899830, 3555696, 5394479, 279710, 1972464, -1059246, + -5532992, 7728794, 240518, -504122, 473520, -3379066, 2658585, -1239098, 1132798, 955630, + -2047626, 1286880, -3072512, 208843, 912144, -1613834, 1692754, 154619, 1129040, 344134, + 1941862, -3163780, -184147, 1832340, 1668058, 2367601, -3221, -1956358, 855772, 249108, + 435402, 478889, -2753074, 2719251, -1070521, 549219, 2039036, 1250372, 772020, 2095944, + -1063004, 806917, 1325534, -1868311, -587874, 2816962, + }, + { + -3263638, -94205272, -3779034, 4383551, 24987046, 4616553, 45722076, -16037408, -1414655, 2871186, + -7677254, 15254650, 3180960, -12287901, -14781667, -11457899, 8864812, 3423089, 2820720, -13726715, + 12467216, -9880035, 4190278, 17049410, -3636227, 6756521, -4368519, 9407589, 1548336, 17828946, + -8489540, 4153770, 8993125, 8058970, 4044249, -3546032, -4835060, 69256, 370441, -1218697, + -10812043, -16675747, -4291746, -8531416, 2841658, 331786, 10377178, -2595234, -600759, -2967286, + 5894843, 149787, 8717710, 2946348, -8047158, -1001801, -967978, -1201517, 2507187, 181462, + 5743445, 5478768, 3320010, 450435, -602369, 981937, -3692598, -2219424, -2064269, 824634, + -409096, 2080375, 2808909, 470299, 693100, -738734, 480499, 429497, 1414655, -1028645, + 438624, 1852742, 627602, 3433826, 3024731, 1548873, 1783485, 1993939, -695248, 970663, + 1431298, -1937567, -661425, -1043677, 1513439, 1635846, + }, + { + -1304596, -43919260, 44362180, 4839355, 748935, -7063611, 12983149, -17871358, 6551436, 280784, + -2444373, 11738682, 20938, 7121056, 2958696, 2675228, -1970316, -11294690, 12103755, 896038, + 21547850, -3113315, -5194763, 18633178, -6969122, 5951214, 3994857, 2076080, -8838506, -5643587, + -9209484, -2832531, -6557878, -3186329, 13431436, 3382287, -7245610, -4873178, -3807489, -594316, + 10167798, -6660421, -4045322, 4366371, 12227235, 779000, 3129958, -5634997, -6073621, 1481764, + -5748277, 179315, -1297080, 4764193, 3081639, 762357, -10152766, 2643552, -4519380, 3145527, + -4590783, 3320010, -1587527, 309775, -2617783, -4082367, 1216550, 4020626, 2005213, 884763, + -2051921, -2290291, -2777233, 1588064, -1257352, -693637, -876710, -4562866, 1669669, 780610, + 967978, -1428614, 703301, 1538135, 415538, -2833605, -3796214, 1183800, -1520955, 323733, + 1447404, 792421, 2884071, 923418, -320512, 849867, + }, + { + 10470057, -51960516, -23640036, -14092861, 12464532, 8300025, 23744726, -7282654, 7803419, 15278272, + -36216236, -8474507, 2005750, 7727720, -19069118, -992137, 9869835, 23678154, 4810900, -497142, + 11349451, 9425306, -5792837, 9421011, -13159780, 13979582, -8884677, 11370389, -8437463, 11059541, + -3805878, -6633040, -6331856, 13300977, 5643050, -3421478, 7133941, -371515, 3093450, -8210904, + -4999879, 4933307, 4554813, -8357470, 701153, 1920924, 4473209, -3684545, -2863133, 4970888, + 1325534, 74088, -1527398, 443455, 3381750, 34360, 1807108, -626528, 1298154, 7126425, + -159988, -5899675, -4446902, 1396938, 2831994, 693100, -2563022, 1972464, 406948, 164283, + 1173600, -2821794, 671626, -1520418, -1697586, -1013075, -1515050, -212601, -1009854, 1401233, + -241592, 2456721, 969052, 1566589, -2265595, -145492, 641024, 834297, -762894, 1591285, + -1413581, -1607392, -31139, 592706, -797790, 770410, + }, + { + 77309, -32812476, 46692200, 12045773, 5170067, -11101954, -21934398, -9675488, -14898168, 9487046, + -16544751, 18429704, -6990060, 12071542, 15193447, -3026341, -6673306, -8230231, 6424734, -6864969, + 9753871, -3529390, 12613782, -3230889, -3999152, 11515881, 10923712, 16062104, 6564858, -9119826, + 463320, -10068477, -229244, -10175851, -8902930, -3481608, -610422, 5247377, -5215701, -9019968, + -1610076, 8303246, 7896298, -828929, 4471061, 3604551, 5678484, 3043521, 389768, 725313, + 1233193, 1495722, -10142565, -4060892, -2551211, -1545651, 599148, -5753109, -304943, 2065342, + -1120987, 308701, -1837709, 2193655, 4184372, -583042, 2738579, -969052, -15569, -3516505, + 523449, -669478, -10201, 2818036, -4332549, -4156455, -1438814, -1984275, -395674, -928250, + 1796907, 1537598, 711891, -3792993, -1609002, -2175938, -1064615, -867047, -301185, -632434, + -1578401, 2728378, -613643, -936840, 918586, 437550, + }, + { + 8372502, -59508920, -21007222, -10066330, 21373368, 4319664, 28239946, -10634339, 30606474, 25651692, + -13760538, 15524696, 1267015, 4730907, 8428336, 23728084, 726923, -3373697, 3645890, 4316979, + -8088497, 6185290, -8622147, 5866389, 2389613, -7499013, -5548561, 3797825, 6227703, 1354525, + -4554276, -1582159, -6886443, -1650878, -9174050, 9041980, -6833293, 3572339, 7062000, -7361037, + -6268505, -4708895, -4014721, 8443906, -1185948, 3361886, -15032, 339302, 1267015, 3125663, + -2495376, 9060234, -3109020, -8138963, -2886218, 3447785, 4442607, 1665374, -285615, -658741, + -3150896, 1282585, 126702, 482647, -5046587, -2418604, 459025, 2187749, 4265977, 1268626, + -629750, 6334540, -1290101, 921271, -1443646, -1814624, -503585, -1933272, 622770, -887985, + -2561948, -1293859, -1552631, -4182761, -2559264, 1872606, -1008244, 730681, 384400, -1610613, + 213675, -1551020, -632434, 1200443, 927713, -287226, + }, + { + -2407866, -59391880, 27748174, -278636, 9949292, -9721658, -4369056, -9340480, -14596983, 15402290, + -5167383, 3488050, -8710194, 18867792, 18862422, 13421773, -16690780, -4814122, -5119064, -5949604, + 12754979, 15676631, -7359427, 5538361, -1888175, 2858838, 3172370, 1533303, 2752537, 913217, + -23975582, 5137318, 611496, 3141769, 3770981, 5995775, 4731980, 2910914, -7021198, 330712, + -2050847, 294205, 932008, -1668058, 1144072, 332860, 3322157, -4852240, 3135863, 2798171, + -3762391, 2465848, 6757594, -224949, 5913633, 4366908, 2710124, 6220724, 5842766, 181999, + -948114, -2986613, -315680, 2483028, 6344741, -2269890, 775778, 1420560, -3023120, 1044751, + -439160, 471910, 1524713, 738198, 195958, -3796214, -5374615, 918586, 2571612, -47245, + 2205466, 1269163, -1514513, 2489471, 3140158, 2640868, 3201361, -284005, -2253247, 1406065, + -174483, -70867, 563714, 111669, -555661, 1799591, + }, + }, + { + { + 6043019, -64106680, -70795560, 69796440, -4854924, -8654896, 48855, 7141457, -9306657, -4489315, + 3810173, 2935073, -6767258, 7310035, 10820633, 2839510, 1719061, -774168, 3064996, -44560, + -2487323, 1902671, -6157910, 7858180, 17987324, 7971460, -4834523, 12410308, 7736847, -726386, + 3311957, 9917079, -5487895, -3129958, 7228430, 2113124, 1827509, -1424855, 2461553, 5774047, + 6043556, 10124849, 2005750, -1198833, 165893, 4068945, 830002, -404264, -2221035, 2538863, + 4090420, -660888, -657130, -2649458, 677531, -4536023, -4317516, -808528, -1492501, -2125472, + -2452963, 1731946, 1036698, -3786551, 3583613, -1129576, 1057099, 2189897, -917512, 3117610, + -889595, -3753265, 2110440, 533650, -2965675, 2774549, 1460826, -371515, 1029182, -67646, + -44560, 2303176, 1882269, 1563905, -365072, 1437740, 365609, -1625645, 1003949, 2059437, + 1287953, 1652489, -1361505, -1446867, -78920, 737661, + }, + { + -825707, 57592292, -3376918, 17819282, 11344082, -1757179, -5005248, 8939974, -115964, 6402186, + 4958540, -7959112, -4693326, 5594732, 718870, -17723720, -758599, -6763500, -8768713, 729608, + 6565395, -543313, -11820287, 4440996, 7493108, -13039521, 758599, 3424163, 10334228, -13929116, + 6255620, -9290551, 19190988, -10530723, -109522, 797253, -6204081, 1204738, -2641405, -2754148, + -2234457, 3625489, -3183108, 12203076, -3811784, -471910, 2471217, -1829119, -663572, 3871913, + 3146064, -661962, -506806, 196495, -4462471, -6027987, 4858682, -3416647, -537945, 3772055, + 2447058, 1280974, -2297808, -481036, -1796907, 1364189, -669478, -1149441, -1443646, -3357054, + -140123, -1262184, -468688, -2331630, -155156, -925565, -1554778, -652298, 352724, 2183454, + -57445, -2463701, 2887829, 1765768, -218506, 220117, 329102, 1591285, 443992, -2396055, + -977105, 1652489, 506269, 107911, 932008, -241055, + }, + { + -46171, 19914690, -42325828, 44809392, 13641353, -7347079, -1909113, -3744675, -10588168, 18205292, + -451508, -391916, 579284, -772020, -6265821, -5505075, 10188736, 4351339, 12099460, 6803765, + -367757, -8901857, 290447, -556735, 7306813, -1165547, -9127879, 4189204, -8742943, -57445, + 345208, -5793374, 2067490, 4901632, -13394929, -3638911, 3013993, -7365332, 2857764, -2527588, + 237297, 4389994, 312996, -268972, -7610682, 839666, -1571958, -2833605, 7699803, 2855617, + 3915400, -5616744, 3824669, 2375654, 2799245, 255014, -2192044, 750009, -143345, -140660, + -111669, 2486249, 1446330, 5308043, 2725694, 1006096, -2287607, 2057289, 1274532, -2216203, + -1680943, -2455648, -1782411, 3464428, 1005022, -3627100, 2006824, -523986, 1997697, 690953, + -1156420, -1107028, 1838783, -1882806, 1266479, 2899640, -943282, -185220, -70867, 1502702, + -2643016, -1220308, 1071058, -820339, 1829119, 1391033, + }, + { + -3240553, -138196480, 21638582, 15132780, 93416, 257698, 2153389, 6693170, -527744, -13149579, + -18536006, 5398774, -9016210, 2876554, -4941897, -17526150, 13278965, -2603824, 8862128, -10551661, + -793495, -3103114, -2103997, 5532992, 1026497, -2782065, 646393, -6059662, -3284039, -1673964, + -574989, -5737540, -1957431, 478352, 625992, 998043, 2784213, 6206765, 5434744, -3370476, + 1595580, -10020159, 798864, 86973, 6475200, 4000225, 2434173, 281857, -1123134, 3989488, + 9838696, 5201743, -465467, 3144990, 3256122, 832150, -1445257, -2656974, 3899830, 1217623, + -4595078, 348429, 4885526, -1164473, 3299609, -2920041, -1319629, -2956548, 4422206, 1916092, + 2520609, 1669669, 277562, -643171, 378494, 1731409, 1341640, 926102, -850404, 33823, + 1830193, 1064615, -468151, 581968, -901406, 290447, 1409286, 139050, -792421, -2236067, + -1218697, -2063732, 469225, -682900, -1683627, 2077690, + }, + { + -635655, 28030030, -4787278, 275952, 2809446, -3928285, 2180770, 959388, -4092567, 7539278, + 4516695, 2870112, 6573985, 5997385, -5480379, -5060009, -8486319, -9501541, -5504001, -3234110, + -5799280, -3948149, 14774687, 1249299, -12250857, -4397510, 2717104, 2151779, 10481331, -1338956, + 6920803, -9919764, 9705552, -14175003, 1381369, -3617973, 10951630, 1991254, -3288871, -2028835, + 3107409, 6665253, 5602248, -5981279, -5427765, 2438468, -6322729, -2621004, 2780455, 144418, + -119185, 599685, 10971494, 4103305, 941135, -839666, -5658620, 72478, 634581, 3029026, + 2640331, -1249299, 451508, 1375463, 3263638, -2381023, 145492, 866510, 252329, -921271, + -3776887, -3224447, -1943473, -1416266, -244813, 1593433, 995359, 1723893, 697932, 181999, + -2101850, -10201, 127238, 307090, 360777, 922344, -667867, 49929, -710817, 1384590, + -231391, 962073, -985158, -265751, -4832, -576599, + }, + { + -5352066, -178341008, 18553184, 36218924, -9794673, 3006477, 1192390, 6875169, -1848447, -2981244, + 9152038, 1577327, -21088826, -14695767, 2327872, -9474698, -1450088, 17266306, 5862631, 907849, + -8510478, 609349, -13677323, -3146064, -1947768, 954020, -5451387, -7602092, -2932389, -390305, + 2736431, 4852776, -1911797, -3580929, 3652870, 324807, 13499082, -3600793, 222265, -6336151, + -645319, -4564477, 7472170, -1990717, 1088774, 2469606, -2935073, -482110, 1149978, 1436667, + -6501507, 1053878, 8319889, 2819646, 2171643, 1250372, 7151658, 3038689, 1942936, -1793149, + -2361695, 952409, -472983, 4170413, 213138, -3434900, 464930, -1746978, 2704219, -1803349, + 2143189, -4041564, -1073205, 750009, -1751273, -84289, 1692754, -1024887, -1114007, -1117765, + 1991791, 25770, -485331, -2016487, -611496, 698469, -2740189, 3419868, -798327, -162672, + 282931, 1008244, 1990181, -191126, 748935, 2534031, + }, + { + 505732, 43532176, 31410706, -14201846, 9379672, -2557653, -5898064, 2621004, 5476084, -2522220, + -1848447, 6633040, 7226283, -6944425, -7693360, -8854612, -17990008, -7288560, -8233989, 5216238, + 5412733, -938450, -9285182, 14983530, -18221936, -11333345, 7590281, 2913599, -5219459, -6527277, + -5544266, 12575664, -6220724, -4394826, 8633421, 2891050, -3405372, -3515968, -1630477, 5967320, + -1745904, -2461553, -2923262, -2750390, 1257889, 1235877, 7416335, 1130650, -8098698, 1614908, + 1065689, 4435091, 674847, 3321084, 805843, 1072668, 1128503, -5778342, 124554, -1205275, + 1373316, -1698660, -4395362, 976031, 1460289, 2221035, 2492692, 1068373, -1417876, 3992709, + -676457, -1443646, 3129421, 3114388, -489089, 5249524, -995896, 255014, 2528125, -1417876, + -15032, 1646046, 2120103, -882079, 708670, -2216740, -1103807, -1293322, 171262, -553514, + -1584306, -696858, -925565, 518617, -553514, 1559073, + }, + { + -2411624, -167409232, 1087701, 38270844, -11051488, -12924093, -3639985, 1688996, 2785823, 4868883, + -2125472, -4271882, 6618008, 6861211, -16528108, -9155797, 7074348, -2963528, 4593468, -4566624, + -9003862, -5295695, 6873559, 2376728, -3350075, -3825742, 237297, -7787313, -5430450, -610422, + 256087, -4984847, 5137318, 2801393, -5122822, -1644436, -3279745, 6568616, -4901632, -5980742, + -12277164, -1778653, -2174864, -6626061, -4545686, 63888, 4526896, 857920, -7904888, -3583077, + 3097745, -5880347, 2828236, -6864969, -1809792, 423591, -513249, 7728257, 4194573, -1740536, + -2687576, -842887, -1541356, -4541391, 2321967, -1257352, -1217623, 1648194, -636192, -3056406, + -1535988, 2197950, 1372779, 1498407, 1115618, 1771674, 666257, 841814, 985695, 2144263, + -326954, -1330903, -1225139, -512175, -214212, -246961, 1031329, 892279, -62814, 133144, + 399969, 1117228, 2509872, 250182, 865973, 549756, + }, + { + 1627793, 35930084, 47619376, -9475772, 7186017, -2797098, -6171868, -1315334, -475668, -2955474, + 4623533, -4149475, 3521873, -2818036, 4665945, -15448460, -1651952, -10280004, 8085813, 7682086, + 2370285, 8300561, 7623567, -22017612, -12101070, -1569274, 1308354, 1483374, 6548215, 1268089, + -1660005, -4760435, 4703526, -12725451, 7685307, 5514738, 3722126, -555125, -3779034, 19327, + -4287988, 247497, -1198833, -686658, 849330, 3546032, 2308545, 402116, 2086817, -3921842, + -1630477, 3525631, 13422, 811749, 370441, -2228014, 1649804, 5740761, -894964, -388695, + 1563905, -1543504, -4543002, 354335, 260919, -1373316, 1770600, 1277216, 121870, 597000, + 494458, -2889976, -1910187, 3060701, 1519882, 4342749, 835371, -642098, 1275605, -2236604, + 1229971, 24696, -2103460, 1319092, -341987, 478889, 2007897, 2135673, -381178, 419833, + -486405, 574989, 486405, -1516660, 675921, 3187403, + }, + { + 2649458, -117022288, 5672578, 722628, 16624745, 26971858, 35260072, -23047332, 40265, -4355634, + 5094368, 4824322, 364535, 1290638, -19675246, -449361, -6027987, 10659035, -4140885, -6568079, + 2503966, -5331128, -1334661, 9524627, 18268106, 3739306, -6830609, 12685723, 13334263, -2775623, + 1849520, -2918967, 6903623, 17296370, -9009768, -5241471, -383326, 4668630, -8388608, 208843, + -16546362, -11379516, -5926518, 1612223, -4636417, 3444027, 2872796, 176094, -110059, -2214593, + 11409044, -2215130, 9559523, 884226, -10035191, -2222646, -2725157, -1582159, 8973260, 890132, + 1737314, 7091528, 1159641, 1532767, -2957085, 2980707, -1054415, -2731062, 785979, -2646237, + 1627256, -517007, 5611912, -1991254, 1990717, -1289564, -1893544, 2035278, -139050, 928250, + -1969779, 4495757, -1903744, 5511517, 3248069, 2123861, 876710, 3474629, -720481, 1621887, + 1130650, -1597728, -1267015, -1081795, 1891933, 1469416, + }, + { + 182536, 1384590, 536334, 3888019, -8990977, 3884798, 21963390, -15024332, -12039330, 17225504, + -672699, -12273406, 7572564, 8241506, 6691559, -13831405, 1008244, 14966350, -7894150, 6423124, + 18478024, -4495757, 7373922, 8949101, 2152852, 722628, 4794794, -3577708, -1184337, -3071975, + -17761838, 517007, -15247134, 3128347, 10332618, 9731859, -7978439, -9262634, -3629247, 4366371, + 7357816, -6112812, -5490579, 5298916, 8902393, 2204392, 571768, -8278550, -1268089, -3875134, + 3921842, 119185, -5471789, 4508105, 694174, -27917, -6150930, -4989679, 1360431, 818728, + 2901251, -4488241, -891206, 494995, -6315750, 4013647, 586263, 2291365, 1706713, 710280, + -2251637, -4131222, -512175, 3955128, -4677220, -2513630, -210990, -1127966, -1204202, 674310, + 413391, -467615, 3891240, 1979980, -2574833, -897648, -1830193, -289910, 516470, -871342, + -689879, 1407676, 2547989, 493921, 173946, 312459, + }, + { + -16466905, -55472724, 5712307, -12472048, 10007811, 38982732, -14485851, -4619774, 6554120, -933082, + -9547712, -12702366, 9294846, -4795331, -32320702, 10569378, 23639500, 15422154, 7853348, 5675263, + 8748312, 2717641, -5953899, 4359392, 6645925, -4410932, -1462973, 4880157, -2610266, 8136816, + -1250909, -8701067, -1774358, 11791833, 2426657, 6451041, 7108708, -1437203, -266825, -7942469, + -3551938, 1716376, 816581, -2465848, -4601521, 2347737, 5405753, -2994129, 5369, -88047, + 2142652, 2645163, 197032, 1718524, 2122251, 1135482, 7301445, -3087008, 1117765, 2182917, + -1225676, -7949985, -1134408, 2759517, 1044751, 2592550, -3839164, 1092532, -1248225, 1034013, + 207769, -643171, -2353642, -588411, 2490544, -2876554, -325881, 268972, -588411, 500364, + 3110630, 1382443, -1810329, 1032940, -2059437, -1452236, 228707, 100932, 998580, 426812, + -1676111, 141734, 1461363, 190589, 755377, -43487, + }, + { + -156766, 24595668, -14724222, 12851079, 7106024, -12699145, -10214506, -16578037, -7326678, -667331, + 3235184, 5109938, -13132936, 22534620, -5306432, -5339181, -3058017, 21334714, -15519327, -3597572, + 7798587, -6481106, 26596048, -10619844, 4167192, 5345087, 2281702, 22631256, 9607305, -5025112, + -5209796, -19196894, 203474, -6746857, -7268159, 1022202, -4719632, 3328600, -3515968, -834834, + -9080635, 5892695, 907849, 10632728, -472446, 6615324, 2253247, 4923107, 891743, -1423782, + -1484985, 3832722, -3567507, -4375498, -5739687, 1516660, -4820027, -4005057, -641024, -562104, + -2397129, 1466195, -722628, 3201898, 3542811, 436476, 1953136, -923418, -4478041, -595390, + 648003, -160524, -2597382, 4352950, -1946694, -4983236, -112206, -3718368, 1302986, -179315, + 792958, 775242, 561030, -2534031, -3493419, -3835406, -2223719, -685047, -511101, 1373316, + -1378685, 2743410, -644782, -328565, 1341104, 310311, + }, + { + -12941273, -73660296, 5891085, -8218420, 13671955, 35088272, -5046050, 1278827, 23912230, 16773995, + -1375463, 13080323, -9847823, 9853192, 23427436, 21769578, -2120640, -7126425, 15808701, -1105417, + 605054, -14010720, -2161442, 9725953, 998043, -758599, -286152, 5637682, -4108136, -2298344, + 2172717, 1886028, -10172630, 542240, -8941585, -1626719, 3118683, 3325379, 1633698, -8078297, + -8130910, -4361003, 2872260, 1948305, 5151814, 2556579, -1871532, 2545842, 5425618, -6132677, + 6739341, 2157684, 996969, -942745, -6080063, -347892, 6453189, -2352032, 4364224, -1345399, + -2491081, 554588, -4417374, 460098, -3364033, -3292629, 3840238, 3949223, 5763846, -1936493, + -1975685, 5970542, -820876, 503585, -26307, -2046552, -557272, -1280437, -127775, -1521492, + -2777770, -552977, -1430761, -5114233, -2028298, 538482, 1045288, 742493, -981400, -869731, + -348966, 2163590, -2102387, 695785, 772557, 187368, + }, + { + 1104344, -27430882, -17577154, 7247758, -3838090, -5990943, 9140227, -7703024, -5720360, -1101122, + 4491462, -1957431, -977642, -10303090, 62797252, -11200738, -3979287, -5840619, -4023311, 1027034, + -4477504, 30012694, -6815040, 7525320, -3961034, 5836324, -4818417, 5458367, 7078643, -1068910, + -24263344, 5137318, -4430259, 6424198, 11887933, -4487167, 14073534, -8446053, -8886824, 1415192, + 1388885, 496069, 7432978, -308164, 107374, -1630477, 930934, -1133871, -3574487, 6906308, + -1468879, -1639067, 3863323, 5312338, 3329674, 4348655, 4718559, 2205466, 4739497, 5924371, + -1498944, -8489540, 1382443, 2840047, 3922916, 1879585, -234076, -3624953, 3945464, -781684, + -3200825, 1690607, 4231080, -2085744, 1639604, -2040646, -8680666, -901406, 2103460, 3542274, + -1572495, 4539781, -1886564, 746251, 3160559, 3520263, 1782411, 2885144, -2004676, 950262, + 376347, 90194, -1473174, 1695975, -668941, 1016834, + }, + }, + { + { + -5580237, -1123134, 7883950, 48636208, -21001316, -867583, 6155225, 232465, -9314173, 2343979, + 4431333, 3946538, -5533529, -2787971, 4573604, -66035, -8470749, 2303713, 19322520, -6112812, + -4037269, 4604742, -1548873, 10656888, 7014219, -128312, -7050726, 4125853, -754304, 431107, + 1658394, 4385162, -3128347, -3947075, 6504191, -2436857, -5587216, -2301029, 2148558, 3805341, + 2150705, 3471944, -2257542, -991601, -4100083, 37581, 1479079, 302258, -383863, 3630858, + 4558034, -2697776, -2077690, 443455, 1258425, -3556770, -1695975, 1806571, 93952, -779537, + -421981, 2001455, 632971, -1328219, 3563749, -162672, -1124745, -368293, -1499481, 1243393, + 397821, -2436320, 1891396, 685584, -1901060, 2094333, -3306588, -2651606, 1686848, -453656, + -1207960, -542777, 699543, 1655710, 1296006, 927176, -460098, -1505386, 393526, 243739, + -1568200, -657130, -1347546, 302795, 536871, -804770, + }, + { + -1407676, 45065480, -16638166, -13638132, -14268955, 1729798, -2289218, 3485366, -1409823, 9403831, + 642098, -7870528, -5976984, -714575, 4294431, -34897, 14617921, 1475321, -416075, 8972187, + 14626511, 10851772, -1653562, 2135673, 11511049, -3296924, -6132140, -10415833, 8432631, -13402445, + 942745, -15581604, 8850317, -16712255, -5666673, 2260764, 466004, 3407520, -2226404, -328565, + -3226057, 6648610, -1369021, 9892383, 2058363, 2047089, -2659122, -979253, -1908039, 1639604, + 2302103, -674847, 1468879, 863288, 664109, -2403034, 2020245, -2061047, 2803540, 2454574, + -1800128, -476741, -2643552, 2379949, -72478, 2086817, 843424, -5369, 371515, -1012002, + 1051730, 476741, -599685, -2442226, -917512, -1502702, 544387, 1414118, -1122060, -1906966, + 570157, 1341104, 2003065, 584116, 784905, 340913, 1012539, 1464047, 377420, -1002875, + -271657, -219043, -1077500, -1119376, 823560, 489626, + }, + { + 1024350, 75613440, -12023224, -2294050, -18450642, -2206003, 5165772, 5546951, -8269423, 10694469, + -4769025, -4914517, -7421167, -159451, -3281892, 2527588, 11564736, -2209224, 387621, 1400159, + 5056250, -1786170, -1893007, -7520488, 5860483, -7716983, -11616276, 2348810, -9831180, -3965866, + 999117, -3866008, -4960151, -230318, -10477036, -822486, 7496866, -1520955, 3123515, 322123, + 46708, 3628711, 2538863, -2538326, -10142565, -273267, 4025995, 774168, 4123706, 960462, + 2433099, -5641977, 3785477, 1902134, 171262, -1351304, -416612, 1284732, 1633698, 2658048, + -317828, 3137474, 2010582, 3302830, 909996, 398358, -1127966, 3819837, 1038308, -1360431, + 1227824, -657667, -2498597, 2517388, 796716, -1400696, 2476049, -1620276, 1357210, 2407866, + -1956358, -1055488, 1745904, -2281165, -593779, 1007707, -1349157, -384936, -204548, 1799591, + -577673, 284542, 1415192, -645856, 1034550, -41876, + }, + { + 5288179, -154425552, -1940252, 30995168, 4930623, -4924180, 3680250, 3307125, 2174327, 4851166, + -9786083, 1971390, -8790724, 4435091, -202937, -12971875, 6714108, -1589675, 11576011, -12164421, + 1092532, 1425392, 4815195, 10146323, -454193, 3590056, 9750650, 5530844, 5268851, 1116155, + 1038845, -4502737, 578210, 3614752, -1596117, -5927592, -2521683, 3858491, 6651831, -1280974, + 7834557, -3913789, 5009543, -2179159, 2666638, -1760937, -3463891, -2749853, -1530619, -110595, + 1866700, 523986, -3147674, -1494112, -2531346, -690416, 1240709, -2180770, 2441689, 2314987, + 638876, -4244502, -1739999, -2880313, 3089155, 115964, 2008971, -1287953, 1067299, -716186, + 1564442, 1971390, 2849711, 464930, -73551, 864899, 19327, -1907502, -1480153, -237297, + 314606, 46708, -595927, 542240, -996969, 585726, 1600949, 332323, 1133335, 454193, + 347892, -1345935, 723165, -183073, -2300492, 918586, + }, + { + 259309, 47843788, 8533563, -4469987, 1637993, -2551748, 1142461, 4971425, -1661616, 4014184, + -5127654, -4642860, 585726, 3207267, -4494147, -541166, -4427575, -8473434, 4470524, 4404489, + 3558381, -4349728, 4052839, 2083059, -6237903, 3508988, 2386391, -4023848, 3112241, -11778411, + 3625489, -4329327, 14307610, -6175626, 3527779, -10550587, -166430, -3970161, -105227, 457414, + -2501282, 5916318, 4483946, -7068443, -7503845, 3256122, 192737, -419833, -503048, -3452617, + -224412, -3893388, 371515, -1729798, 1073742, 3083250, -809064, 3013993, 396211, -89121, + -402653, -3914326, -2748242, -1774895, 1861868, -4206921, -310311, 1564442, 3705483, 2771328, + -1928440, 1500554, 1695438, -336618, 671626, 227096, -2369748, 265214, -1065152, -878321, + -2135136, 1818382, 473520, -781684, -950262, 964757, -789200, 584116, 328565, 102005, + -1407676, 1375463, -325344, -108985, -950262, -1387811, + }, + { + 8839580, -168851264, 14162655, 63670204, 1480690, -7216619, 2728378, 15695421, 1055488, -5820218, + -1726577, 4419522, 230318, -7284802, -3466576, -9909563, -10934987, -3102577, 3849901, 14871324, + 4512937, 7500624, -3944391, 6177237, -2879239, -2192044, 2976412, 1762010, 620086, 3482682, + -99321, -4755066, -6258841, -5257577, 1077500, -3065533, 7869991, -3888019, 639950, -5231807, + 4981625, -1946157, 6698002, 757525, 1555852, -2583423, 727460, 7850664, 5712844, 5958194, + -3278134, -1608465, -621160, -5947993, 1282585, -50466, -2952253, -5415954, -201327, 1688996, + 1085553, -169114, -1540820, 4373888, 358630, -4434554, 1387274, -2173254, 2420751, 217970, + -214212, -5638219, -1154273, -593779, -1684701, -2148021, -100395, -831613, 46171, 619012, + 1909650, 2020782, 3022583, -1393717, -144418, 627602, -3042984, 1238024, -2393371, 415001, + 9127, 215822, 944356, -841814, -63888, 1245541, + }, + { + -2001992, -9344775, -17547088, -10288057, 7628399, -2590402, -2787971, -1685238, 484794, 2377265, + 2032593, 3523484, 6793565, -10364830, -5282273, 785979, -4330401, 10135049, 7559680, 15401216, + 10908143, 5261872, 469225, 22019224, -10349797, -4401805, 6665789, -728534, -2379412, 3100967, + 4056060, 7071127, -6314676, 605054, 1719598, -438087, -597537, -3310883, -912681, 2948495, + -6094559, 594316, 252866, 5225365, 4839355, -3306588, 1779727, 797253, -3073049, 6994891, + 2163590, 1103807, -5753109, -2741800, -2667712, -347355, 2716567, -2072322, 1677185, 778463, + 2467996, -2629057, -6250788, 404264, 835371, 854162, 1949915, 2138357, -467615, 4386772, + -1285269, -4734665, -454193, 513249, -322659, 3924526, -3111167, -709207, 1312113, 193810, + 2136746, 1083942, -261456, -1561221, -366683, -2267206, 2099702, 1142998, 607738, 525597, + 442382, -635655, -293132, 1541893, 217970, 1362578, + }, + { + 5106716, -155342528, 14409615, 58158688, -1643362, -9759776, -913217, 4684736, 8438000, 5291937, + -9948218, -3788698, 10312216, 3459596, 2989834, 12700218, 3854733, -5487358, 14439143, 5193153, + 488016, -2331094, 3548717, -4881231, -3352222, -824097, 4048007, -3395172, -3500935, 2660195, + -2985539, -5784247, 6077379, -511101, -6487548, -973347, -6470368, 1245541, -3672734, 983548, + -3408594, 1880659, 129386, -849330, 1821066, 381715, 2285460, -455267, -3420405, -2026151, + 3216931, -4788889, 7963406, -1951526, -2549063, 244276, 162135, 5970542, 474594, -2602750, + -873489, -78920, 328028, -4378719, -1762010, -3267933, -2188823, -707596, 202400, -2525978, + -2103460, 208306, -404264, 372588, 303332, 203474, -427349, 1059783, 548145, 2509335, + -310848, 586263, 179315, 88584, 845572, 590021, 1721745, -258772, -442919, 216359, + 437013, 213675, 417149, -1348083, -1035624, 471910, + }, + { + -2297808, -35518844, -18936510, -8089571, 8660802, 639413, -2272575, 2049773, 2415919, -1067836, + 4008815, -9450539, 3056406, 803696, 6163278, -6401112, 4874788, -6835978, 1421634, 9620190, + 4207994, 2905546, 5750961, -17559974, 3876745, -3215857, -2073932, -670552, 508954, -8988830, + -3765613, 4239133, 4256313, -11220065, 3508988, -3722126, -249108, 2643016, -643171, -2528125, + -6578816, -4272419, -536871, 1058173, 1624035, 3558381, -1182190, -1347009, 2280628, -2004139, + 387621, 1248225, -605590, -497679, 301721, -3926137, -2487323, 4259534, -132607, -380105, + 2608119, -495532, -2457258, 1178432, 920197, 198642, 2409477, 299574, -2700998, 149250, + 1042066, -391916, 228707, 241055, -1583769, 2323041, -16106, 528818, 2499671, -1853278, + 1640678, 2740726, 792958, 506269, -1229434, -471910, -679679, 1118839, 356482, -329639, + -1109712, 466541, -763967, -918586, 387621, 743029, + }, + { + -2330020, -108627776, 11405286, -1995549, 7025493, -6475200, 5696201, -14897094, -957778, -12432320, + -8301098, -2168959, 1474784, 16939352, 2749316, 2895345, -3278134, 1933272, -12819404, -6365679, + 280784, -2782065, -5810554, 2294586, 6771553, 375273, -6433324, 4459250, 3579855, -16373489, + -445066, 1047435, -5345624, -822486, -11328513, -2175938, 3423089, -1680943, -14807973, 4946192, + -3959423, -1916629, 217433, 11978664, -6214281, -3885335, -682900, -2953327, -5162551, -5465883, + 4439386, -5515275, 3818763, -1687922, -3292629, -2147484, -1723893, -121333, 6345278, 878321, + 1976759, 5166846, -562641, 2050847, -775778, -37581, -1808181, 1009854, 2740189, -379568, + 1422171, -1505923, 2224793, -4267050, 2039573, -1081795, -1305133, 5099200, 2309082, 1480690, + -1024887, 3269544, -5826660, 3719442, 2655364, 628139, -886911, 242129, -2440078, -565862, + -645856, 415538, 1403917, -847182, -453119, -1448478, + }, + { + 302258, 47582868, 23283554, -12269111, -14366129, -4854924, 17277042, -4396436, -12868796, -1030255, + -6917045, -4640176, 13140452, 5979132, -16908212, -21921514, 7231115, 17324824, -8587250, -1075352, + 11536282, -4189204, -3089692, -7046431, -3489124, -4295504, -7356205, -3184718, 8293045, 1656784, + -11090679, 1262720, -18966038, 5645198, -1963337, -1423245, -445066, -3059091, -452582, -1538672, + 2447595, -799938, -1722819, 4176319, 3595961, -1593433, 2641405, -6226092, -2531883, -3528853, + 5328981, 1063541, -4232154, 3222299, -1398012, 2815351, -3147674, -6886980, -1328756, -2213519, + 1913408, -2738042, 1871532, 3023120, -1963337, 4701916, 831613, -1129040, -3053722, -524523, + 826244, 522912, 544924, 2741800, -4196720, 339839, 2789045, 4919885, 838592, -355409, + 542240, -1273995, 1268089, 3359201, 2311229, 2423435, -1389959, 252866, 2317135, 1752884, + 165356, 414464, -475131, -1311576, 253403, 201327, + }, + { + 18649284, -36027260, -11380590, -9975598, 1591285, 5653251, -33064268, -3752728, 4507568, 3874061, + 10314364, -579284, 14125611, 7300371, -11055246, 15545634, 6929393, -2354716, 5433671, 1941325, + -2395518, -2779381, 526670, 11882564, 10935524, 215285, -755377, -2811593, -1532230, 5479842, + 4201015, 3362423, 3534758, 3596498, -5523328, 5702643, 2815888, 1853815, 4413616, -1924145, + -3320010, 903554, -1924682, -6294275, -4056597, 2754148, 2451353, -1439351, 4583804, 1304596, + -4224101, -4461398, -577673, 1519345, 6253473, 3927748, 3773129, -4190814, 3455838, 3300146, + -270583, -3652333, 1715839, 3564823, 280784, 4089883, -2332704, 2788508, 2589865, -122943, + -812823, 1668058, -2729989, -979789, 2674691, -1325534, 889595, 1626182, 766115, -156766, + 2146410, -193274, -4174708, -925029, -1283122, 641561, 604517, -1373853, 1182190, 151934, + -1202054, 1028645, 177167, 323733, 2636573, -1350230, + }, + { + -309775, 51508468, -3123515, 5962489, 3328063, -3793530, 1098975, -6655052, 573915, -2846490, + 2707977, -1261647, -4935455, 31899796, -20039780, -18744848, -5115306, 19807316, -11359115, 2491081, + 9315247, -10278930, 15655156, -17559436, 2446521, 1119376, -11853036, 76773, 511638, -637803, + -239981, -8305930, 9068823, 12053289, 6619082, 7365332, -6483790, -7821136, -13160854, -395674, + -2099702, 681826, -4830228, 10033580, -4409858, 676994, -3682935, 557809, 601832, 564788, + -3002719, 1931662, -1295470, -949725, -1151051, 3071439, -1891396, -2813204, -3325379, 319975, + -3618510, -178778, -1579474, -1580011, 694711, 2325188, 1326071, -1032403, -3264175, -960999, + -36507, 1146219, -3951907, 3787624, -20401, -4559645, 1302986, -1277216, 1662689, 84289, + 2462627, 2556579, 1114544, 189515, -220654, -558883, -1510218, 1215476, 767189, 1522029, + -964757, -526134, -3875134, -1654636, 955093, -271120, + }, + { + 14489072, -62824636, -12155831, -12476343, 1893007, -251256, -27172110, -644782, 1166621, 1511292, + -5588826, 14911053, -12731357, -268972, 10906533, 5854041, 8814347, 5618891, 9686762, -8505646, + 1978906, -11049877, 706522, 10814728, 4934381, 1847373, -2423972, 9083319, 1831804, -298500, + -1088237, 4459250, 1887101, 11442330, -5356361, -7654706, 633508, 846645, -1037772, -5337034, + -6135361, 2532420, 1549410, -663572, 6736656, 5049808, 6556268, 3513820, 944893, -5537824, + 11789148, 3036542, 4166655, 5380521, 2564632, 2645163, 6045167, -5341866, 4174171, 800475, + -4409321, -1874216, -2309619, 573378, -1212791, -635118, 1628866, -565325, 1708323, -1709397, + -2449742, 5796595, -1939178, -945430, 386547, 50466, 952946, -995359, 1075889, 811212, + -1879585, -964220, 864362, -889058, -297963, 547608, -80531, -1082332, 81068, 746787, + -273804, 2827699, -728534, 1381906, 331249, -822486, + }, + { + -343061, 16943110, 9826348, 6995428, -3531000, 2289755, 13439490, -4114579, 4097399, 3203509, + 6150930, -4856535, -789200, -19245748, 47896400, 418759, 25931938, 12869870, 8022999, 9087614, + -18212808, 14219563, -7045357, 3505767, -7062537, 10437307, 1217623, 10853919, -2304250, -3385508, + -18143552, 1496259, -5369, 8312909, 7293928, -1672353, 10641318, -11121818, -3334505, 818191, + -5049271, -2239289, 11081552, 6257231, 3525631, 564251, 826781, -1131724, -3150896, -210453, + -4556424, -1314260, -3555696, 867583, -344134, -663036, 134755, -4023848, 862752, 1507534, + -1188632, -6374805, -3353833, -1533840, 1921461, 2355790, 2309082, -1506997, 3866008, -1630477, + -4528506, 1836099, 2595771, -3771518, -2231236, -1093069, -5104032, -2398202, -1697049, 2609730, + -1612223, 4832912, 274878, -304406, -97711, 1267015, -1044214, 1794223, -539555, 574989, + -255014, 184684, -1313186, 2856690, 568546, 2210835, + }, + }, + { + { + 3358665, 41445360, 745177, -14806900, 21341692, 6475737, 1285806, -4821101, -8631811, 2261837, + 5295158, 1830730, -1499481, -2285996, -4004520, 8824010, -11261941, 5379984, 4575751, -13863081, + 10123238, 1299765, 6484327, 9695889, 3599183, -6009196, -3377455, -2344515, -3105261, 2927557, + 10606422, -1738925, -5442261, 54224, 4498978, 2369211, -11208791, 2577517, 689342, 311922, + 741956, 692027, -1195075, 1307818, -3664144, -4475356, 2946885, -2401424, 6097780, -919123, + 2073396, 1946694, -2732136, 605590, 1012002, -1221918, -1872606, 3379066, -740345, 1654099, + -305480, 2408940, -192200, 401579, -257161, 2079838, -5246303, -1930588, -101469, 733366, + 1993939, -1833414, 204011, 1420560, 1020055, 626528, -3180423, -1483374, 668404, -2022393, + 171799, -2330557, 2637647, 111669, 1286880, -402116, -221728, -961536, 357556, -740345, + -1020055, -1511292, -900333, 495532, 432718, -1614371, + }, + { + 1781875, -12859669, 29088202, -25977572, -11693585, 335544, 2014877, -203474, -2689723, 7455527, + -1044214, -4296041, 4210679, -12995497, 4689031, 5512591, 4221953, 2529199, 15090368, 6987375, + 4556424, 13790603, 4830765, 670015, -326418, 5251135, -6210523, -8384313, 2348273, -3877819, + -7975755, -9563818, -3572339, -6389838, -2215130, 3293166, -2608656, 1761474, -530428, 997506, + -6016176, 4922033, 6538014, 169651, 5858873, 3132105, -1699196, -3306051, -1235340, 226023, + -2102923, 3777961, 1365263, 3325915, 252866, -952946, -1694902, 1647657, 2781528, -229244, + -865436, 2194728, -3999688, 1248762, 1213328, -1015223, 1942399, 1312113, -1190780, 486942, + 2371359, -376347, -1821603, -385473, -833224, -1462973, 28991, 2687576, 170188, -3925063, + 1657321, 2888903, -194884, -27917, 334471, -344134, 1554241, 1129576, 799938, -802085, + -450435, -667867, -568009, -169651, -1104880, 120259, + }, + { + -661962, 83619256, -11442330, -39215200, 12374338, -2245731, 5437966, 4395362, -5590437, 2358474, + -3707631, -9755481, -2259153, -1910187, -2192044, 7823283, 5782637, 7824357, -5817533, -1625108, + 2508798, 7205882, -12069395, -5310727, 2818572, -9854266, -5144834, -4101157, -230854, -2003065, + -6898255, 1593970, -4415227, -9203578, -2980707, 789200, 8840653, -319975, -390842, 1340030, + 2404108, 476741, 1786170, -3179887, -2521146, -2801393, 3641596, -1959579, -434865, 3288334, + 905164, 1074, -1868848, 3711389, -486942, -1325534, 3460133, -1649268, 2464774, 3300682, + 947040, 4097399, 446677, -947040, 4537096, -1741072, 856309, 3041374, -1756105, -752693, + 1498407, 2514703, -5114769, 2151779, -1237488, 2868501, 663036, 1494649, -1036161, 3693672, + -2651606, 674847, -525060, -1481227, -1336809, -239981, -558883, -1030255, 768262, 493384, + 1080184, 708670, -416075, 1174137, -740345, 582505, + }, + { + -6277632, -132227544, -3623342, 43730284, -3595961, -4878546, -528281, -1273995, -747324, 13734769, + -6146635, -6441377, 861141, -2933463, -1654099, 1483374, -1406065, 2815351, 5409512, -1446330, + -4392678, -449898, 6030134, 12524662, -6014565, 6160057, 7909719, 10733123, 7369627, 1862405, + -2864743, 5260798, -4515621, -2373506, -1093606, -8824010, 7289633, -881542, 4981625, 1772748, + 3576634, 4964982, 549756, 1235340, -1211718, -10474351, 3634616, -3547106, 1407676, 198642, + -2080375, -200790, -2150705, -3382824, -4295504, 979253, -962610, -75162, 1465121, -957778, + 6794102, -4409858, -6713571, 164283, -445066, 2622078, 3819837, -1750736, -1231045, -138513, + -1071058, 3371549, 3896609, -507880, 980326, 312459, -852551, -1712081, -1676648, 801011, + -826781, 631360, 372588, -1519882, -429497, 967978, -533650, 548682, 1482301, 2884071, + -904091, -605590, 1157494, -1069447, -998580, 215285, + }, + { + 281320, 37402724, 17882634, -5386963, -2141578, -184684, -398895, 4208531, -877784, 2753074, + -2965675, -5557151, -4142496, -2632278, -6444599, 204548, 7814156, -12488154, 5116380, 8832063, + 2147484, 639950, -4929012, -5658083, 9268539, 809601, -2844879, -1946157, 608812, -15928960, + 2517388, 7178501, 3460133, 4494147, 4310537, -13616120, -3213173, -5859409, -1966558, 10151155, + -9613211, 7141994, -636729, -3694209, -6050535, 3098819, 1915019, -3277060, 617938, -1176821, + -3033858, -5024575, -799401, -1758789, -226560, 5490579, -599685, 1476932, 2626373, -1494649, + -1520418, -3845070, -2419140, -97711, -296353, -4083977, -2837900, 3992709, 2108829, 1756105, + -478889, 2459943, 2598992, -245350, 993748, -341450, -1922535, -5906, -1726577, -1278290, + -610959, 1636919, -1457068, 1150514, -1528472, 322123, -340376, 309238, 280247, 338229, + -504659, 342524, 372052, -430570, 337692, -1771137, + }, + { + -9718437, -123653720, 2782065, 62712964, 2007360, -3588982, -3010235, 11143830, 1813550, 1425392, + -7137699, 3391414, 9423158, -3211562, -10256919, -1899986, -13490492, -10776073, 2793876, 23838142, + 2441689, 612033, 3800509, 7888781, 5633924, -6734509, 917512, 5302674, 3630858, -2567854, + 3818226, -5125507, -9994389, -2036888, -4412542, 2073396, 190589, 1117765, 423591, -3291019, + 4343823, -233539, 540092, 3143379, -636192, 2847027, 1948305, 7809325, 5302137, 4073240, + 2355790, -3570729, -5655935, -3391414, 1685238, -922881, -5982353, -6103149, -2663954, 4260071, + 1814087, 1076426, -525597, 819802, 1192927, -3176128, 501974, 137439, 722628, 2192044, + -1453846, -4071092, -2729452, -139050, 147640, -3119220, -2188286, -746787, 310311, 1064615, + 1262184, 1610613, 2465848, 813896, 267899, 470836, -1350230, -2534568, -268435, -102005, + 673773, 453656, -1197759, 309238, -894964, 716186, + }, + { + 406948, -25714506, -17838610, 2356327, -4298726, 1993939, -2018635, -1209033, -4104915, -559420, + 8071854, -3611531, 5528160, -4341138, -5879274, -8618389, 1861332, 16190953, 11252814, 12919262, + 5783174, 9134322, 12697534, 3146601, 6912750, -5226975, -460635, -4016331, 10463077, 5080410, + -1604170, 1770063, -97711, 7358353, -9583146, 3317862, -3071439, -1280974, 5978595, -6382859, + -6076305, -542240, 5733245, 5687074, -2338073, 1562294, 184684, -2348810, 2907693, 6700149, + 142808, -3448859, -2204929, -417686, -5598490, -1405528, 3135326, 1633161, -1772748, 1368484, + 1803349, -3841312, -1887101, -1364189, 1983738, -113817, 3008625, 684510, 1622961, 765578, + 1422708, -3639448, -2616172, -1168231, 2055142, 516470, -1247688, 41339, -830539, 394063, + 1898912, 2815351, -2776696, -282931, -2481417, 151934, 1570347, 943819, 971200, 591632, + 788127, -650688, 563714, -140660, 1045825, 397284, + }, + { + -5845988, -124948648, 13674102, 46074800, 5691369, 1279900, -10353019, 4950487, 10102300, 4163971, + -10801843, -4137664, 12138651, -187368, 14730664, 9879499, -13614509, 11825656, 7239168, 9444633, + -3990562, 868657, -3526168, -3116536, -2388539, 2592550, 3252901, -327491, -584116, -3163780, + -3475702, -46708, 5021354, -2316061, -6335614, 1085016, -615254, -8928700, 1035624, -944893, + 816581, -4377646, 303332, 4358855, 4935455, -960999, -3474092, -1349694, 2670933, -2913062, + 247497, 1296006, 1656247, 1625645, -346819, 547608, 419296, 509491, -760746, -653909, + 1478543, -3309272, 246961, 1187559, -4696010, -858993, -2000918, -3679176, 1410897, -2343979, + -782221, -1985349, 1214402, 179315, -785979, -275952, 130460, 1415192, -249108, 1071594, + 314069, 1540820, 887448, 882079, 270583, -928787, 3042448, -612033, -368830, -628139, + 1133335, 645319, 365609, -1844152, -2250563, 602906, + }, + { + -1359894, -25210384, -42520176, 4947803, 354335, 2462627, -2866891, 2709051, 664646, 713501, + 3054796, -7429220, -5867999, 7212324, 4478577, 16079821, -13908178, -4055523, 2767570, 6654515, + 5213554, -4742181, -660351, -9738301, 15287399, -9989020, -2332704, 2536715, -2364380, -12172474, + -723165, 3830037, -2783676, 1081795, -6444062, 2073932, -2891050, -4217121, 3897146, -4520453, + -1495722, -8157217, 1650878, 2138357, 2477123, 840203, 1801739, 445603, -971736, 1376000, + 417686, -2535641, 2913599, -1282585, 833224, -5254356, -330712, -745714, -818728, 1372779, + 1917166, -659814, 2273648, -2656974, 1727114, 3369939, 45634, 535797, -4300336, 644782, + 974421, 533650, 1132261, -564251, -2344515, 611496, -641561, 1020592, 1484985, 605054, + 1797444, 1627793, 1173600, 776852, 574989, -2104534, -587337, 1289564, 1105417, -313533, + -1695975, 1059783, -1708860, -292058, 869194, 155693, + }, + { + 4374961, -53333832, -38752952, -2828236, 279710, 2722473, -18733036, -8246337, -5542119, -4410395, + -12113955, 4227322, 3421478, 9465034, 10684268, -14937896, 7587597, -4813048, -1433982, 595927, + -10933913, 6358699, -3090766, 2796561, 2108829, -9240085, -232465, 1953136, -4070555, -11829951, + -2882997, 5856725, -8445516, -4087198, -8203925, -2934537, 5326297, -8544301, -2644089, 797790, + -3448322, -1872606, 2124935, 7900056, -1407676, -2237141, -2710124, -3904125, -7985418, -881005, + -1045288, 1890323, -2124935, -10426570, 7574712, -3653944, 1241782, -2232846, 5876052, 1642825, + 32212, 6680822, -3215857, 2946348, 156766, -3737695, 2126546, 4091493, -2724620, 2732136, + 1565516, -3042448, 543850, -753767, 132070, 809064, -1074816, 1885491, 2840584, 3132642, + 1809792, -1709934, -3771518, 3592740, 2216203, -397284, 2010045, -4702453, -899796, -807454, + -1235877, 197032, 2843805, -250719, -1729798, -1565516, + }, + { + 445066, 62946504, 7030862, -14821395, -2178622, -6072010, 4540318, 2470680, -7496866, -5434744, + -4169876, 1740536, 7380365, 499827, -25276956, 1893007, 2101313, 4820564, -2781528, -396211, + 33286, 10134512, -14282914, -9805947, 1688459, -10482941, -5600638, 1674500, 6419903, -4490925, + -4780299, -4594542, -9065602, 484258, -6647536, -4644471, 3798899, -1668058, 1658394, -355945, + -6344741, 2681133, 5378910, 1705102, -3199751, 4172561, 1826972, -6934225, -1445257, -2661269, + 5464809, -2170569, -2902861, 313533, 3066070, -711354, -1686312, -3674882, -1104880, -4061965, + -886911, 1703491, 4235375, -1860795, 2300492, 363462, 685584, -1101122, -573378, -2816962, + 571768, 1941325, -664646, 450435, -1545651, 4115653, 1695975, 2764885, 1865090, 717260, + -1036698, -347892, -994822, 2728378, 3450469, 4406100, -1543504, 55298, 946503, 1773822, + 1232119, -504659, -1023813, -877784, 903017, -1407676, + }, + { + -17597018, -31893354, 20425790, 3861713, -2332167, -18909130, -12247636, -2574296, -4063576, 5870147, + 22516902, -5696737, 7556458, 3741454, 17390860, 9228274, -1547799, -5116917, 8491687, 3401614, + -11300596, -2262374, 11927124, 3631932, 7057168, 8889509, -3491272, -7230578, 2117419, 1258962, + 1974074, 12311524, 3582003, -122407, -10569378, 12351252, -959388, 2923262, 2582349, -1016834, + -4014721, -2192581, 1846299, -6163815, -5785858, 7499013, -5199595, 2732673, 4913443, 405874, + -4888210, -2782602, 359167, -2734284, 8242579, 19327, 1711008, -3069291, 5508833, 4158602, + -1420024, 674310, 3947612, 762894, -2427194, 5461051, -2464774, 4869956, 3126199, -3587372, + 1498407, 1842541, -1599875, 345208, -840740, -348429, 2664490, 1560684, -1477469, 600759, + 2597918, -2987150, -190589, -2831994, -129386, 755914, 1319629, -117575, 1279900, -1326608, + -550830, 578210, 479426, -363998, 2026688, -1153736, + }, + { + 855772, 35038880, 10974178, 6101538, -3037079, -618475, 2011655, 2450816, -1271310, -5852967, + 999654, -661962, 8049306, 13871134, -9575630, -13502840, -4079682, 10421738, -11244224, -3278134, + 18411988, 444529, -4735202, -12050604, 4459250, 3207804, -13155485, -11399917, 250719, 11018739, + -12589623, 6671158, 2704756, 17748416, 8076149, 1149978, -6285148, -10488847, -3259880, 1342177, + 12348, -6941204, 759136, -1589675, 3062849, -189515, -4426501, 775242, -1925756, 2468533, + -6817724, 1068373, 556198, 670015, 3130494, -4607426, 5406827, -5494874, -1087701, 1926293, + -3706020, -4322348, -1549410, 1707250, -1894618, -16643, 4642860, -2203855, -2168959, 389768, + -1559073, 662499, -411780, 813359, -609349, -4738960, 4476430, -1052804, 175557, 988916, + 802622, 3680250, -295279, 3148748, 280784, -733903, -2146947, 3966402, -1098975, -233002, + 1668595, -1661616, -3492882, -3816079, 885837, -594853, + }, + { + -13685913, -59331752, 22281216, -5616207, -10701985, -8348880, -14110578, -6646999, -8588861, -30602, + -8908836, 12920872, -6344741, -7691213, 10653666, 335007, 13135621, 4803921, 4440460, -3177739, + 1166621, -6994891, -8177618, 16373489, 2903398, 1805497, 3715147, 2171643, -248571, 1190780, + -1853815, 5412196, 3685082, 7421704, 5298916, -5840082, -4784594, 906238, -914828, -4389457, + -4236449, 6613176, 2022930, -5393942, 4714801, 5366025, 9015673, 5763846, -6790344, 5377836, + 5564667, -197032, 6764574, -937377, 9164386, 4321274, 2927020, -935766, 673773, 288837, + -3320547, -5019743, -503585, -729608, 2336999, -1317481, -49929, -945967, -1431298, 2068564, + -1430224, 1021129, -1285269, 1989644, -1504849, 2090039, -2204929, 2127620, 416612, 2056216, + -1496259, -1352915, -784905, 2218351, -591632, -475668, 958851, -2059974, 504122, 545461, + 43487, 229781, 1893007, 1335198, -33823, -1895154, + }, + { + 1270774, 48639968, -17685602, 9039832, 4757213, -2509335, 3039763, 8082592, 2617783, 4611721, + 4147328, -4211216, -5896453, 24463596, -7516730, 18651970, 15097347, 21662204, 460098, -1141924, + -449361, -2019172, 264677, 5668820, -11071352, 11163157, 5770826, 3868155, 4418448, -3258807, + -19270982, 3101503, -317291, 10475962, -511638, 5130339, 2458332, -11278584, 1351841, 2876018, + -7458211, -767725, 10244034, 3440269, 5239860, 5632313, -5450851, 2345052, 1809792, -3336116, + -6158446, 734976, -6674916, -2161979, 271120, -234613, 2387465, -5321465, 719944, -3459596, + 1790465, -3963718, -5577015, -601295, 1373316, 4290673, 295279, 3024731, -2392297, 1627256, + -4376572, 233002, 734976, 922881, -5485210, -618475, -581968, -4218195, -2233383, 1448478, + 846645, 1335198, 1620276, 872952, -535797, -701153, -355409, 23622, 224949, 622233, + -1304060, 951872, 852551, 695785, 1152662, 1522029, + }, + }, + { + { + -2916820, 107800992, 51271172, -41676752, -863288, 295816, 259309, -10057203, -9799505, 801548, + 3963181, 6990596, 1890859, -1534377, -8939438, 8262980, -16124381, 2141041, 3326452, -13269301, + 5778879, -2894271, 490700, 8286603, 4214974, -9178882, -6331856, -3675418, 1148904, 8873939, + 7419556, -3870303, 1420024, 7847979, 2291365, 4649302, -1557463, 5777805, -4410395, -2996277, + -315143, 1551557, -163746, -80531, -2922725, -1722282, 4816269, -2956548, 6185827, -2241973, + 241592, 4507568, 1210107, 3012920, 1472100, -429497, 424128, 2470680, -3373697, 964220, + -3456912, 908386, -1835025, -3027415, -614717, 3437585, -1902134, -387621, 599685, 1093606, + 1395864, -807991, -1025960, -28454, 1546188, 428423, -1643362, -685047, 117575, -962073, + 859530, -2616172, 1591822, 74625, 478352, -625992, 310311, -760746, -355409, -1974611, + -234076, -905701, -813359, -412854, -558883, 37044, + }, + { + -417149, -55297168, 4265440, -1946157, 9483288, -3519189, -3835943, -510564, -2210835, -1890323, + -5158256, -6119792, 5136244, -9782325, 6226092, -501437, -6021008, -8810052, 2694018, 2948495, + 3330747, 4233227, -6412923, 301721, 2244121, 6182606, -1023276, -109522, 1705639, -2660195, + -2542084, -857383, -24696, -4052839, 2727304, 5502927, -3172907, 5804112, 402653, -1631014, + -3599720, 2397129, 4156455, -6383395, 2741800, 1219234, -1262720, -1834488, -4595615, -3893925, + -2981244, 4370129, 2982855, 5159867, -1071058, -3678103, -2963528, 2410551, 2743410, -2665564, + -2411624, 4693863, -2807835, -676457, -134755, -3050501, 424128, 1161789, 1561221, 2191507, + 1646583, -999117, -1099512, 980326, 1194001, -330712, -902480, 895501, 346819, -2863670, + 561567, -3221, -2397666, -165893, 1181116, 638340, 1369021, 728534, -98247, -892816, + -750546, -350577, 394600, -144418, -697932, 533113, + }, + { + 648003, 54657216, -27606440, -40739376, 18991272, -1089848, 3633542, 5311801, -4984847, -4727686, + -1892470, -8044474, -2066953, -5657009, -6869264, 4503810, 11351062, 17301202, -9540196, -6916508, + -6527814, 2381023, -8207683, -5522791, 7130720, 7325067, 6957310, -973884, 2392297, 2304787, + -3133716, 6038187, -3781719, -6695317, -657130, -391379, 4519380, -1592359, -150324, -450972, + 1602560, -2699387, 4414690, 2186675, -1751273, -6021544, 133681, -4032974, -719944, -581968, + -1878511, 5655935, 493921, 1133871, 3951370, 905701, 2178622, -1865626, 3504693, 5109401, + 972810, 1942399, -265214, -53687, 4567161, -971200, -1214939, -965294, -2806224, -1388885, + -2007897, 1112933, -3477313, 1636919, -3244848, -342524, -2107755, 3517578, -795106, 1512902, + -2178085, 2859375, -26844, -981937, -308164, -967978, -1413581, -988916, 1260036, 78920, + 1355062, 1197759, -284005, 1534377, -454730, 907312, + }, + { + 7413651, -82941728, 16804596, 38582764, -2313914, -1641751, 1611, -2000918, -5486821, 6384469, + -6876243, -1597728, 2760590, -4417374, -3115999, 4031901, 5014911, 1037772, 149787, 4866198, + 126702, 158914, 3280281, 1449552, -7846369, 6039798, 4525285, 8338679, 8209293, 5305359, + 35433, 6193343, -4176319, -625992, -1493038, -7136625, 9097814, -2729452, -2259153, -5530844, + -1590212, 2921115, 146566, 3508988, 290984, -5814312, 7856032, 2020245, 2763812, 2072322, + 1181653, 190052, -1346472, -1526861, -3692598, -649614, -2695092, 1205275, 181999, -5730023, + 3610457, -1368484, -3360275, 1462973, -3131568, -44560, 2189897, -1001801, 279710, 288837, + -1963874, 704375, 795643, -676457, 566936, 1479079, 378494, 607201, -124017, 989453, + -1402844, -389231, -1072131, -1803349, 336081, 609885, -2006287, -1715839, -710280, 1396938, + -121870, 390305, 911607, -1212791, -760209, 598074, + }, + { + 40802, -8419210, -18143552, 1045288, 491774, -1368484, -876173, 4902705, -1624035, -2025077, + -4102768, -2706366, 4101694, 915902, -10259066, -2000918, 6811282, -13655312, -2214593, -1561758, + 92879, 1228361, -12552579, -13429826, 9272834, -3264175, -5994164, 2377265, 5516886, -6438156, + 7018514, 4679904, 983548, 6442, 169651, -11913166, 382252, -1176821, -1561221, 3468186, + -6924024, 7405061, -3667365, 212064, -834834, 1059246, -419296, -2136209, 1083942, -301185, + 132607, 1398549, 448824, -5575405, -4825933, 2805151, 290984, -629213, 1644436, -3555159, + -2748779, -3307125, -910533, 2092723, 654446, -483721, -1089311, 337155, -3053185, -271120, + -985158, 670015, 1824824, -1838246, -1510218, -1373316, 249108, 3030636, 1112933, 1745904, + 1273458, 967441, -2461016, 3448859, -696322, -1475858, -477278, 257161, 731755, 1338956, + 1110786, 1138703, 773094, -892816, 1391033, 620623, + }, + { + 10924786, -80743240, -856309, 46406048, -262530, -9127, -6504728, 2474438, 6848862, 6036577, + 636729, 7953206, 7963406, 9017821, 2553358, 1860258, -10566156, -5950141, -1877438, 9928354, + -3773666, -5415954, 3926674, 4413079, 3757023, 4097399, 4053912, 1759863, -676994, -6704444, + 6274411, 3902515, -3695283, 46708, 2035815, 7681012, 984084, -216359, 2572686, -2089502, + 664646, 750009, -366683, 238371, 617938, 3306588, 3760781, 6473590, 1186485, 3126199, + -537408, -5107253, -1721745, 2653216, 2087891, -848256, -1600949, -2144799, -3100430, 995896, + 1955821, 2899640, 2213519, 554588, 67109, -2588792, 318364, 502511, -367757, 1175747, + -313533, 762894, 1657321, 71404, 439160, -1242319, -772020, 129386, -150324, 501974, + -1160715, -1200980, 1099512, 436476, 820339, 2080375, -91268, -1891396, -433792, -1764158, + 453656, 1399623, -471910, 961536, -666794, -165893, + }, + { + 1117228, -7979513, 2522757, 6463389, -4166655, 2902861, 317828, 3281355, -1847373, -3355443, + 2007897, -7158637, 5235029, 2393371, -4151623, -6818261, 1948841, 71941, -2581275, 4398047, + -5218922, -5002027, 2493766, -166967, 11471858, -6186364, 1303523, -970126, 2413235, 4592931, + 506806, 2625836, 2361695, 13086765, 2121714, 620623, -5582384, -19327, 3470334, -5708549, + -1371705, -2142652, -3153043, -1842004, -5475547, 3146601, 452582, -2094870, 1199907, 1050656, + 144418, -3614215, 192737, 2146410, -1875290, -767725, 2044404, 2522757, -4008815, 1146756, + 3089692, -1972464, 1328756, -857383, -332323, -3407520, 547608, -1652489, -502511, -2784750, + 675921, -168577, -111132, -113280, 1514513, 214748, 834297, 449361, 183073, 137976, + 639413, 2804077, -2492155, 779537, -2494302, -775778, -191663, 549756, 285078, -685584, + -767189, -998580, 669478, -1155346, -801011, -112206, + }, + { + 6838125, -97974112, 13422847, 31324270, -151398, 4628364, -10538239, -241055, -293132, -4109747, + 819265, 2764348, -492848, -7592966, 2426657, -1503775, -21356188, 4702453, -1339493, 6247030, + -6971269, -7504382, -1354525, 4429185, -3284576, 195421, 694174, 4822712, 5385889, -545461, + -1455457, 3641059, 5181878, 581968, -150861, 3527779, 3484292, -4232154, 1371168, -6597070, + -4271345, -7020124, -2552821, -582505, 338229, -3813931, -5771899, -4321811, 1053878, 150324, + -593242, -1209033, -2456185, 412317, -652298, -912144, -2064269, -757525, 948114, -1024887, + 4997732, -259846, 1011465, 3656628, -2966212, 2047626, -521839, -1630477, 2749853, -2937758, + 2050847, -177167, 1134945, 1803886, -236223, -1240172, 1381369, 3051574, -1852205, -1982664, + -663036, 1669669, 1241782, 655519, 550293, -1187559, 1561758, -550830, 622233, -759136, + 897111, 565862, 412317, -818728, -1085553, 119722, + }, + { + 2578591, 30327300, -948114, 6719477, 1137630, 1310502, -2878165, 3393561, 4062502, 1701344, + -1297080, -10256919, -4294968, 7585986, 451508, 8010114, -19254876, -6041409, -1242856, 5138392, + 7309498, -4284230, 3907347, -5696737, 11937325, -16265041, -4146254, 5996311, -6695317, -9436043, + 2841121, 4962835, -5579700, -840203, -6098317, 1629403, -5035849, -1678259, 2570538, -5961952, + 4147328, -3143916, 6242735, -1117765, -966368, 5560909, 5346698, 5675263, 1517734, 1234803, + 388695, -830539, 4746476, -1278290, 941135, -5071283, -1182727, -126702, -194884, 2152852, + 771484, -1531156, 2374043, -3584150, 1138166, 2281165, -1621350, -62277, -4251481, -283468, + 129386, -417686, 119185, 933619, -30065, 901406, -457414, 2226941, 1707250, 346282, + 646929, 581968, 117038, 421981, 1352915, -816581, 199716, 1352915, 1411434, 602369, + -1448478, 1577327, 324807, 153008, 1381369, 1086090, + }, + { + -7584912, -12648679, 3073049, -1243930, -9298604, -10339060, -11609297, 9945534, 9017821, 5571110, + -6490770, 2536715, -6051072, -14862734, -9389335, -10009958, 12486007, -1872069, 18069464, 10988137, + -4108136, 11247982, -3773666, 4939750, -2414309, -6083821, 4271345, -5019206, -4434017, -3178813, + -2978560, 3195993, -6234682, 3653944, 2811056, -4249334, 4596689, -3113315, 551366, -1333587, + -5287642, 4153234, 2071785, -3815542, 1211181, 2077690, -4686883, -591095, -2179159, 2811056, + 394063, 710817, 1818919, -3591667, 9257265, -79457, 4646081, -4043712, 2681670, -1339493, + -5025112, 4270808, -3006477, -137976, -1738388, 122943, 4481262, 3849365, -1705102, 861141, + -198642, -1918777, 2389076, 1960653, 1074816, 1306207, -801011, -589484, 1140314, 2976949, + 1118302, -1593970, -2514703, 991064, -91268, -2044941, 3020973, -2697776, 1281511, 620623, + -878321, 661962, 2449742, 359704, -242666, -1115618, + }, + { + -302258, 32506996, -13065827, -2285460, 12066711, -6499896, -3013457, 21219822, 14478872, 6271189, + 652298, 873489, 3286187, 2135673, -14936823, 4901095, -803159, -8014409, -2915746, -2366527, + -16565152, 3376381, -126165, -2498060, -4734128, -3529390, 641561, -4320200, 3789235, -5444945, + -4886599, 343061, -3894999, 5207648, -831076, -7034620, -1273995, -3095061, 1473174, 5452461, + -6482180, -3937411, 2866354, -2423972, -5934571, 7991861, 5844377, -4831838, 2586644, 3101503, + 5418638, -3748433, -1325534, -4376035, -1694902, -3168612, 2159295, -1394254, -937377, -1890323, + 1496796, -158914, -1171989, -5230197, 674847, -446140, 675384, 640487, -482647, -1541893, + 2782065, -538482, -3750580, 548682, -852551, 1092532, -1271310, -965294, 419833, 178241, + -1221381, 118648, -2356863, -1243393, 330712, 2110977, -2456185, -96637, -935766, -76773, + 1883880, -1092532, -1034013, -196495, -414464, -2630131, + }, + { + 16723529, -31288836, -13479218, 11572789, 5316633, 4074313, 6750615, -4735739, -4016868, 10848551, + 12616466, -17177722, -181999, 1014149, 17685064, -1554778, 2251100, -5112085, 6383932, 15850040, + -5012227, -939524, 10437307, -2018098, -3088082, 4724464, 1840930, -1249836, -1068910, 142808, + 3190624, 7675644, -405874, 304943, -5610301, 12074227, -7218230, -1159104, -3607236, -6702834, + -1359357, -806380, 36507, -5017596, -4481262, 6784975, -4188667, -3991635, -1729798, -652835, + -265214, 2581812, -1714766, -2571075, 8711267, -4366908, -1439351, -2618856, 4904853, 1876364, + 1845225, 4298189, 6097780, 1404454, -5717139, 2791729, -3073049, 526670, -1014686, -1717987, + 4616553, 1086627, -1291711, 3427384, 168577, -448824, 1506997, -3047816, -2291902, 869194, + 2083596, -1453310, 2966212, 108985, 2703145, 1012539, 1949915, 1096290, 112743, -1490354, + 800475, 696858, 784368, 186294, 527207, -1010928, + }, + { + -371515, -622233, -18211736, -190589, 930934, 7208029, 5252745, -1466195, -1127429, -1192390, + 1065689, 544387, 767189, 2914135, 673236, 1974074, -5026723, -958851, -6666863, -1692217, + 26963804, 1431835, -5077188, 6187974, 9123584, 6742562, -7267622, -12684112, -1831267, 12684649, + -2985539, 4452808, -8733816, 9414568, 5660767, 4151623, -1852205, -1983201, 5003637, 5413270, + -1673427, -9217537, -1985349, -7318625, 2039036, -1127429, 1007170, 4072703, -5497558, 3573950, + -3061775, 882616, -1193464, -2871186, 1862405, -1173063, 6984691, -3118683, 1171452, 1404454, + -2524904, -1541356, 1311039, 4105452, 798327, -340376, 3685619, -2570001, -260919, 660888, + -1010391, 1562294, 2246805, -1251983, -1342177, -2595771, 5171678, -1301375, -1391033, -106300, + -1875827, -1943473, 88584, 2838974, -2666101, -961536, 868657, 6038187, -1009854, -1967095, + -246961, -977105, -462246, -2026688, 853088, 828929, + }, + { + 13450227, -46428596, -188979, -1386738, -2246268, 9640591, 1516660, -3279745, -9610526, -5715528, + -9709310, 18945638, 503048, -9895605, 3765076, -1855426, 12399571, -11753715, -6653441, 1882269, + 3761318, -2935610, -12145094, 3760244, 2984466, 6655052, 6208375, -1925756, -3332358, 281320, + -11012296, -7298223, -1417876, 3233574, 8476118, 656056, -115964, 978716, -1277753, 2302103, + 4050154, 5832029, 925029, 18254, 3665755, -1491964, 2864743, 2344515, -5237176, 9452686, + 4940286, -4660577, -2536715, -7424925, 5173825, 2670396, -751619, -3874597, 335544, -2360085, + -3161633, -2529199, -1431298, -3066607, 1323387, -2759517, -509491, 113817, -214748, 4817343, + -1253594, -1127966, -410706, 3055869, -2049236, 2062658, -1285269, 3190624, -568009, 1242319, + -2480344, -1029718, -258235, 1658931, -1837709, -2366527, 1613834, 202400, -261456, -1015760, + -1731946, -1183800, 930397, 433255, 980863, 21475, + }, + { + -1522029, 44431436, -13776108, 5807333, 6426882, 1796370, -1517197, 1987496, -3917547, -1555852, + 162135, 3995393, 1242856, 5611912, -52787296, 5076652, -4063039, 5655935, -4281009, 1450625, + 8773008, -2193655, 3360275, 7594576, -4335233, 9825275, -929324, -2563022, 11356430, 8853538, + -8375186, 3609383, -1927904, 8450885, -8054138, 4631049, 5641440, -4829691, -493921, 4130685, + 1598265, 3277597, 1633698, -7661685, 544387, 6220187, -8312909, 114354, 4201015, 552440, + -1916092, 5661304, -3359738, 47245, 980863, -2141041, 5447629, -1519882, 3577708, -1719061, + 3965329, 1176284, 560493, 5073967, 1457068, 2333778, -1422708, 3823595, 681289, 3896072, + -2076080, 737661, 1204738, 4250407, -1797981, 1617055, 895501, -2791729, -1189706, -334471, + -236223, -344671, 403190, 2025614, 2244121, -1083942, -379031, -207769, -2643016, -2488397, + -1268089, 1513439, 1431298, 1014149, 107911, -1216550, + }, + }, + { + { + 3725347, 151852864, -7415798, -49403936, 12467753, -8353175, 5320391, -7014756, -5769215, -10161893, + 497142, 8489540, 7516730, 888521, -9994389, 4800700, -5044976, -813896, -8276939, 11805254, + -6483790, -9843528, -1766842, 5170067, 6560563, -5349382, -7494718, 2854543, 510027, 12013024, + -2450816, 3411278, 264141, 3609383, 2486249, 5745593, 4810364, -1075352, -2426657, -4806606, + -2875481, 5694590, 1839320, -2442763, -1569811, 647466, 3173981, 934155, 43487, -778463, + 210990, 4693326, 407485, 950262, 807991, 697932, 1245541, -1692217, -643171, -597537, + -3481071, -180926, -28454, -2942053, -855772, 1936493, 1174674, 297963, 773094, 780073, + 635655, 280784, -622233, -1538135, 558883, -257161, -70330, 169651, -265751, -814433, + -637803, -149250, -349503, 1784022, -568546, -141734, 272194, -463320, -125091, -1665911, + -376347, -803696, -53150, -621697, -1924145, 1284732, + }, + { + -512712, -41254772, -11320460, 14525043, 3586835, -3112778, -327491, 988916, -2554969, -5945846, + -7625715, -2208150, 3393561, -7066832, 3883724, -220117, -1915019, -7182796, -4933307, 8498130, + 1420024, -8375723, -1597728, -1921998, 8535711, 1818382, 3792456, -484794, -1976759, -1048509, + 1526324, -985158, -1156957, -489626, -797790, 7478612, -2606508, 3359201, 1609539, -7165616, + 3842922, 1933272, 111132, -2538326, 1017370, -1127429, -4046396, -1681480, -1858110, -2511482, + -44560, 1125281, 1787243, 1961726, -455803, -3485366, -539018, 1195612, -996432, -367757, + 1065152, 1401770, -1467805, -3038689, 450435, -457951, -25233, 585726, 2215130, -514859, + 2402497, -1688459, 348429, 77309, 667331, 190589, -648540, -34360, -118112, -919123, + -74088, -1347009, -2807835, 709743, 1309428, 1302986, -59593, 1866163, -986769, 168577, + -543850, -972273, 649077, -1636919, 67109, 382252, + }, + { + -2159295, -18403398, 28989418, -19910932, 5834713, 1030255, 4808216, -3478924, -1743220, 3124052, + -7895224, -7151658, 4152697, -8655433, 2988224, -9228811, 11862700, 13424994, -2065879, -3796751, + -7421704, -4645544, -1328219, -2727304, 298500, 10648298, 7728257, 5251135, -2880313, 3993246, + 251792, 3020973, -9394167, 2266669, -2241436, 588411, -2381023, -5020817, 7373385, 148176, + 3776887, -6551436, 6682969, -1352915, 1336272, -1724966, -7092065, -2619930, 3189550, -2542621, + 1607928, 1918777, 4070019, -2086280, 3565360, 4533338, -1313186, -276489, 1046898, 3791919, + 466541, 1577327, 904091, 1305670, 1131187, 2926483, -2818572, -1365263, -1502165, -1694902, + -2004676, -753767, 220654, -2225867, -2757906, 761283, -2612414, 1992865, -47245, -683437, + -405338, 1579474, 1699733, -1504312, -784905, 39728, -589484, -1029182, 1030792, -29528, + -320512, 1746978, 321049, 410706, 899796, 922881, + }, + { + -9699110, -43346956, 12327630, 29901026, -2193118, 2097555, -6758668, 1082332, -6198712, 3780645, + -9800042, 7177964, 1542967, -5090073, -4747013, 543850, 18644990, -4753992, 2013266, 3596498, + 115427, -3992709, 7990250, -3722663, 1304596, -2355790, 3640522, 11347840, 694174, 7516193, + 6547678, -649614, -4653597, 1726577, -1739462, -712428, 2976412, 1120450, -5463736, -1934346, + -802085, -4103841, 3742527, 341450, -2937758, 2971044, 3587372, 4392141, 512712, 3403762, + 1830730, 2537789, -2173790, -975494, -2762738, -107374, -2593624, 841814, -3294777, -710280, + -2713346, 1772748, 716723, -2250026, -2588792, 1062468, -797253, 921271, -557272, -782758, + 202937, 599148, -381178, 625455, -1738388, 2943126, -1319092, 2425583, -344134, 602906, + -673773, -475131, -1508070, -1034013, 251256, 569083, -1847373, -1684701, -1114544, 219043, + -671089, 1260573, 1008244, -2350958, -164819, 872415, + }, + { + -982474, -34000036, 1091995, 2455111, -2472828, -1199370, 1427540, 4465156, -1706713, -4683662, + 817118, -7792145, 2736431, -1154273, 6053220, -14380087, 3892314, -6036577, -12287901, 538482, + -391379, -1067836, -10605348, 2258616, -4136054, -2109366, -2491081, 4244502, 623844, 4275640, + 2946885, 496606, 4115653, -4474282, -3634079, -4340602, 3567507, -2740726, -3275986, -2007897, + 2676302, -2931852, 675921, -1411434, 867583, 1865626, -2353105, -2647847, 341987, 837519, + 1687922, 3711389, 2286533, -8127689, -2848637, -455803, 2418067, -3716221, 2266132, -4297652, + -1058710, -119722, -3210488, 1922535, -153545, -457951, 2697776, -2328409, -3071439, 231928, + -1002875, -1126355, 265214, -558883, -639413, -1674500, 432718, 2049773, 1466731, 2241436, + 3157875, -1039919, -1334124, 2590939, 523449, -2716030, 396748, -340376, 654446, 881542, + 2510409, 369904, 1457605, -1374390, 671089, 848793, + }, + { + -14061186, -30544734, -20122458, 45425184, -3114388, 3477313, -414464, 338766, 5948530, -2033130, + 5565741, 11616276, 7416335, -915902, 9391483, -4252018, -3406983, -389768, -2805688, 3321620, + -5235029, -4723391, 2145336, 4337917, 5547487, 6075768, -1098438, -231928, 387084, -5293547, + 4904316, 3539053, 1367410, -4727149, 8500277, 1051193, 3684545, -1226213, 4322885, -2327336, + -91805, -295816, -293132, 3128884, 823560, 3070365, 4311611, 1140851, 3401077, 1275068, + -1779190, -949188, 17180, 4168266, -2544231, 1289564, 121333, -854162, -4050691, -702227, + 3240016, 2682744, 627065, 2553358, -1301375, -2037962, -373662, 242666, 1240172, -1927904, + 375810, 1508070, 1644436, -278099, 1184874, -296890, 418222, -585726, -243203, 1588601, + -1355599, -2290291, 499827, 474057, 774168, 1949378, 358093, -1023276, -942745, -2190970, + 1115618, 512175, 354335, 892279, -316754, -441845, + }, + { + -380641, 1848447, 7288023, -934692, 850404, 1234266, 1894618, 1247688, 906238, 173946, + -2402497, -1598265, -1866700, 11895986, -14882062, 2221035, 1673964, -4900558, -567473, -9171366, + -2360085, 384400, -1584843, 3907883, 2429878, 605590, -484258, 5739150, -2485176, 702227, + 1563905, -459025, 8448201, 7982734, 8090108, -4973572, -2068564, -2967823, -193810, -2968896, + 3313567, -1896765, -6641630, -2633352, -6290517, 2733210, 1326071, -266825, 485331, -3746822, + -1154273, 889058, -2221035, 877247, 839666, 756988, 2647847, 558883, -1571421, -540629, + 1028645, -417686, -609349, 917512, -805843, -370978, -1551557, -2737505, -1508070, -187905, + -2608119, 1817308, 465467, 322123, 797253, -508954, 1251446, 913754, 1611687, -1964948, + 1130113, 893353, -31675, -1105417, -15032, -1506460, -1083406, 660888, -224949, -132070, + -2641405, 832150, -337155, -535797, -1623498, 490700, + }, + { + -10873247, -67457832, -4970888, 28981902, 6393596, 4166118, -3425773, -5793911, -2839510, -901943, + 9901510, -4018479, -2541010, -2675228, -1176284, -14544370, -11366631, 1395328, -4580046, 2097555, + 558883, -9413495, 2472828, 1997160, -4510253, -770947, -1660005, 6158446, 7195681, 2147484, + 1059783, -939524, -2532420, 2259153, 6536940, 3788161, 3369402, -2624225, -1961726, -5594195, + -4602058, -3329137, -3845606, -1563905, -3667902, -2695092, -1549410, -3485366, -3157338, -1467805, + 1280974, -4508105, 437550, -1164473, -1881196, 165356, -1347546, -2257005, 2543695, -1934346, + 4095251, 2805151, -416075, 372588, 1806034, 1417876, -2378875, 2034741, 1321776, -3709778, + 143881, 190589, 2527588, 1832340, -1148367, -1813013, 3855270, 2410014, -2049236, -2200634, + 307627, 1246077, -981937, 1042066, 667331, 685584, -1129576, 461709, 814433, -749472, + -386010, 680215, 893353, -804770, 513785, -664646, + }, + { + 817118, 23875724, 17569638, 3994857, 3549791, -377957, -2434710, 3758097, 6791954, -2390149, + -2426120, -4881231, 976031, 971200, -4012036, -3008088, -7033546, -1286880, -2465311, 820876, + 8701067, 989453, 2229088, 3812857, -6551973, -11631845, -3499325, 2607582, -3479461, -8833674, + 238371, 6682432, -6730214, -3112241, 2141578, -245887, -6582038, -311922, -2616709, 3571802, + -3157338, -2376728, 8212515, -4392678, -2659122, 8089034, 1596117, 9381819, 2231773, -1575179, + 973884, 3266860, 839666, -554051, -531502, -1722282, -482647, 64425, -1373853, 3550327, + 341987, -964757, -1684164, -969052, 2323041, 68183, -927713, -33286, -2906082, -1665374, + 690416, -791348, -324807, 2644626, 259309, 1677185, -584116, 2590402, 860067, -277562, + 522375, 173946, -383326, 896574, -17180, -150861, 1098975, 929860, 1349694, 28991, + -1286880, 217433, 2225330, 455803, 1025960, 224949, + }, + { + 9667971, -18764712, -6197638, 4876936, -12139188, -9232569, 12132209, -3087545, 11878269, -5073430, + -528281, 8045011, -10391673, -16935056, -18538152, 7585986, -969589, -6731288, 20167018, 3446175, + 13596256, 3345780, 4817343, 2099165, -374199, -1537061, -1925219, -3046743, -9737228, 6982006, + -4258997, -3709241, 2462627, 4022237, 2223719, -7334731, 2564632, -777926, 2574296, -67109, + -6949257, 2580202, 4938676, -8790187, 1738388, 563714, -867047, 1245541, -2380486, 1825361, + 652835, 5572183, 613643, -624918, 3414499, 774705, 3350075, -1481227, -1128503, -690953, + -570694, 2118493, -2350421, -4496831, 28991, 1966021, 3867618, 1063541, 1316408, 562104, + -2123325, -208843, 2449205, 4295, 2344515, 787590, 1778117, -2719788, -169114, 2570001, + 981400, -1410360, -1101659, 239444, -736050, -1302449, 1753420, 602369, -94489, 845572, + -440234, 908922, -474057, 925029, 1188095, -1644436, + }, + { + -1637993, 2137820, 5357972, 6243272, 6973953, 319975, -6897181, 20410758, 10465225, 8145943, + 5669894, -2741800, 2665027, -1170379, -3305514, 521839, -2101313, -14817100, 4027069, -11528766, + -4465692, -3935264, -738198, 9000641, -7534983, 1776506, 2984466, -5590974, -4722854, -3365644, + 4524211, -4244502, -2000381, 1283658, 472983, -5109938, -3839164, 607738, 1902134, 6216965, + -4775467, -4907000, 747324, -3121368, -82141, 6257231, -2040110, 877247, 5515275, 1059246, + 3848828, -2976412, 163209, -2975339, -943282, -4672925, 479963, -2096481, 5688684, -3956202, + 2235531, -4596689, -3307125, 912144, -5364951, 863825, 241055, -10201, 1956358, -977642, + 1706713, -1169842, -4663261, 507880, 209380, -1499481, 1494649, -2200634, -3151969, 1487132, + -402653, -1359357, 1031866, -1336272, -838592, -759136, 50466, -1190780, -385473, -1573569, + 1706713, -1249299, -394600, -774705, -451508, -1133871, + }, + { + -15919833, 992674, 1547799, 1680406, -8126615, 16358457, 3307662, -484794, 3165928, -1546188, + 2954938, 112743, 2836289, -10004589, -425202, 2374043, 8454106, 4763119, 3965866, 13692893, + -2634426, -957778, 1162862, 2907693, -5425081, -146566, 1723893, 3597572, 1267015, -676457, + 2863133, 2413235, -2197413, -923418, 8318278, 3701725, -3963718, -5705327, -1755031, -4176856, + 2674154, -5996311, -2869575, -2975339, 813359, -5042829, 5612449, -8195335, -4351876, 1376537, + 739271, 811749, -2172180, 2631741, 5672578, -3507378, -1185411, -847719, 1356673, -2018098, + 4031901, 3944391, 4721243, 2586107, -3535832, 720481, 1047972, -2710124, -1045288, -1730872, + 3405909, 1380295, -395137, 812286, 559420, 514322, 1386201, -4216584, -387621, 222801, + 1879585, -728534, 2907156, -268972, 1908576, 637266, 913217, 2208150, 118648, -475668, + -347355, 736587, 309775, 1409823, -621160, 623307, + }, + { + -947040, -22508312, -1984812, -7035157, 10076530, 2004139, 3407520, -3323768, -1658394, 1941325, + 3457986, 4128001, 4079682, -14492830, 10942503, -2011655, -3076807, -3806952, -1657857, 1299765, + 13284334, -734976, -2891587, 13502840, 3085934, 4108673, -5308580, -236760, -470299, 5714454, + 9725953, -10741176, -4421132, 5005248, 2932926, 208306, 6545530, 485868, 5223217, -64425, + -8565775, -7934415, 1509144, -4062502, 151934, -4038880, 5218386, 3460133, -4344897, -2885681, + 3862786, 2131378, -787053, -2872260, -3623342, 6534256, 287763, -603980, 471910, 1510218, + 734976, -4223564, 3946001, 1515050, 2870649, -1697586, 2223183, 1170379, -1238561, -2157147, + 1053341, 1487669, 2616709, -1429687, -607201, -2336462, 2542621, -1468342, 163746, -1820529, + -3758, -3446711, -955630, 2767033, -1339493, -2666638, 2419677, 3715147, -493921, -770410, + -1016297, -468688, -748398, -416612, -84289, 1731946, + }, + { + -14136885, -11653320, -10477036, 14267881, -2300492, 6045704, 12283606, -9763534, 397284, -3045669, + -2020245, -546535, 8810052, 4972499, -2390149, -1667521, 8759586, -14609868, -5739150, 886911, + 2811056, -654983, -2170032, -6958384, 6459631, 4831838, 7731478, -8744553, -1447404, -5120675, + -12234751, -7009387, 7424388, -1732482, 195958, -1900523, 4368519, 2771328, -712428, 2424509, + 2617783, -1804960, 6034966, 4464082, 1393717, 648540, 1032940, 2506650, 2069637, 1928977, + 1891933, 180926, -8631811, -3074123, 1931125, 693100, -1812476, -1183800, 1203665, -6425808, + -1036698, -2280628, -699006, -1683090, -3138011, 169114, -723702, 1727114, 1023276, 4312684, + -410706, -1240709, -919123, 2585034, -1411434, -1053341, 2037962, 2558727, -1702418, 1127429, + -1714766, 5906, 195421, -1103270, -1818382, -953483, 710280, 1371705, -1421634, -483184, + -1976222, -528818, -312459, 332323, 390842, 2775623, + }, + { + -322659, 22283900, 4957466, -2974265, 9268003, -1408212, 6158983, -2139431, -6279779, 4522601, + -12085501, 10910291, 3661460, -2728915, -29188060, -11814918, -2316598, 463856, 2931852, -5390184, + 7779260, -3100430, 7244536, 1365263, 9326521, -1031329, 3772592, -3944928, 13762149, 3832185, + -3536906, 3674345, -1183800, 928250, 3877282, -250719, -1461900, 5011153, -2258079, 2040646, + 2030446, 5214091, -2274722, -3924526, -492311, -1225139, -4039417, 1120987, 1478543, 939524, + 2143726, 2566780, -2598455, 744640, 2434710, -820876, 4732517, 1306207, 1245541, 513249, + 20938, 3825742, 2702608, 3546032, 2071248, 853625, 59593, 2051921, 936840, 3210488, + -1572495, 1676111, 2806224, 1025960, -242129, 1010928, 1108638, -1894618, -1043140, -835908, + 817654, -1701344, 686121, 734439, 3496104, -1876901, 1803349, -1242856, -3440269, -2703145, + 649077, 1700807, 1158567, 1013075, 323196, -2011118, + }, + }, + { + { + -2363843, 127644280, -21640730, -59046672, 10511932, -6772627, 3824669, -6783901, -4228932, -3855270, + 13273060, 12599287, 8771934, 4127464, -7676181, 4419522, 6990060, 7339026, -1647657, 7989176, + -6266894, -6469295, -7913477, -4484483, -71404, -999654, -2435783, 416075, -6673843, 2706366, + -7052873, 5308580, -1869385, -3087008, -6337224, -3440806, 3998078, 156766, -1036698, -2649458, + 1814624, 7135552, 4225174, 527207, -1001801, -1678795, 738734, 3874061, -983548, -2113124, + 1318555, 2762738, -4824859, -4663798, -3289945, -1120987, -1657857, -5303748, -2643016, -1986959, + -3458523, -1601486, 1080721, -393526, -277562, 1595580, 3151969, 1544578, 148713, -247497, + -535797, -1027034, -898722, -1236951, -379031, 52613, 608812, 129923, 140660, -230318, + 191663, -536334, -1933272, 1688459, 169651, -373125, -130460, 41339, 776315, -541703, + 686658, 372588, 96637, -527207, -1570884, 411780, + }, + { + -92879, -9542344, 10978473, 28873454, 9984725, 1800665, 627602, -45634, 674847, 1899449, + -317291, -4271882, -1260036, -5971079, 3044595, 3290482, 1813550, 2361158, 5918465, 10356240, + 1438814, -3610994, 7155416, -1807108, 8241506, 1392643, -682900, -5034776, -5912560, -2263985, + 5842230, 10453414, 74088, -4477504, -8081518, 3952981, -6660421, -4058744, 3008625, -2230699, + 8382166, -949725, -3958886, -706522, 1051193, -2363843, -2639794, 4109210, -688805, -1132261, + 1561221, -1765768, -2749316, -2132988, 2078227, -1147293, 1650341, 1090922, -2014877, 755914, + 293132, 466541, -536334, -3113851, -107911, 466004, 969052, -221728, 517544, -2289755, + 1019518, -713501, 337692, -1973538, -1799591, -1287953, -1323924, 201863, -210453, -495532, + 1086627, 28991, -1116692, 1030792, 322123, -617938, -1461900, 763967, -1167157, 209380, + 714575, 452582, 657130, -1159104, 833761, 82678, + }, + { + 3495567, -60686816, -8715562, 671089, 15889768, -4807679, 1144072, -2735894, 1602560, 7284265, + 600222, -747861, 5192616, 43487, 6510097, -7209103, 13816373, 13723494, 3911105, -898185, + -6806987, -7066832, 447750, 764504, 309238, 1337882, -1404454, 4671851, -2059974, 5734855, + 3761855, 2818036, -9149891, 2120103, -3883187, 608275, -3307125, -9549860, 6410239, -252866, + 2656974, -4794257, 9060770, -432181, 762894, 1377074, -4653597, -2067490, 3090229, 2072859, + 5734318, -2234457, 1027571, -1535451, -329102, 260919, -4037806, -18254, -650688, 508417, + -3104725, -1396938, 823560, 1698123, -154619, 1966558, -2765422, -95026, 1038845, 1836099, + -107374, -1459215, 1142461, -954557, -664646, 1278290, -3314104, -1390496, -1187022, -1008780, + -2168959, -479963, 1246614, -1212255, -164819, 494995, -1037235, -1461900, 329639, -458488, + -1072668, 1226213, -175020, 282931, 2222646, 1360431, + }, + { + 11849278, -7276749, 9550934, 22057342, -2717104, -1436130, -5410048, 6349036, -4189741, 1388885, + -10057740, 11446625, 5627481, 6884833, 721018, -4493073, 17662516, 3361886, 2762201, -7875897, + 88584, -3911642, 3730716, -819802, 5916318, -157303, -2951180, 5776194, -737124, -1650878, + 3920232, 1165547, 828929, 2007360, 527744, 3848828, 3493956, 7029788, 460098, -1187022, + -4457103, -6463926, 1795296, -5662378, -3490198, 6451041, 595390, 1057636, 784905, -1246614, + -1185948, 2843268, -2011118, 1003412, 3109556, 4823785, -311922, -603980, -952409, 2623151, + -4664872, 34897, 1044751, -2032593, -3690451, -1249836, -731755, 1950452, 544387, -3221, + 1538135, 1235877, -411243, 1149441, -1117765, 1460826, -2962991, 1970316, 269509, -484794, + -416075, 319438, -1074279, 1172526, 715112, 322659, -701153, -255014, -572841, -407485, + -978179, 759672, 787053, -1931125, 235149, 1436667, + }, + { + 1080184, -35730908, -223338, 6977711, 2303713, -1213865, -415001, -3817152, -7734163, -7190312, + 1675037, -8407398, -638876, 6767258, 21582210, -15021111, 4726075, 6820945, -10211822, -1090385, + -260382, 3137474, -4406637, 9102109, -3456912, 4738423, 3822521, 2702071, -2939368, -1619740, + -3540127, -845572, 3419331, -3176128, -468688, -1490891, 2408940, 3233574, -1599875, -4706211, + 1345399, -2982855, -2280628, -5311801, -1590212, 2107755, 1107565, 281320, -634045, -1298691, + 1261110, 4930086, 4553739, -5302137, 425739, 2336462, 3904125, -3457449, 3758097, -1042603, + 1582159, 1883343, -2687039, -2686502, -2890513, -916976, 2996814, -963683, -1307818, -1443646, + -2806761, -850940, 1677185, 2086817, 1935420, -1031329, -675384, 810138, 1143535, 2082522, + 2057289, -1176284, -483721, 1512365, 466004, -3011309, -339302, -205622, 677531, 81068, + 1132261, -1374390, 987843, -617402, -413391, -56371, + }, + { + 15705622, 14900315, -10428717, 48681308, -9069360, 2302639, -1160715, 695248, 600222, -11821361, + -2857764, 9804337, 3742527, -5326833, 4227322, -8363912, 4869419, 5135707, -8988293, -4384625, + -6612639, -2242510, 3724274, 4469987, 5040681, -332323, -6576669, 2974802, 1819456, -6065568, + -1554241, 1148904, 2688113, -7599408, 11335492, -836982, 572304, 916976, 166967, -4323959, + -438624, -609349, 2214593, 2519535, -32749, 3031173, 5872294, 1715303, 1005022, -619549, + 37044, 793495, -1905355, 1804423, -4709432, 926639, -1152662, -1362042, -2836289, -2796561, + -1461363, 1591285, -928787, 862215, -977642, -106837, 71941, -1544578, 1403917, -2052994, + -976568, 418759, -1020592, -1346472, 1069984, 684510, 3080029, 775242, 1605244, 2263985, + 767189, 337692, 686658, -788127, -434865, 73551, 551366, 487479, -449898, -1334124, + 257161, -326418, 572304, 849867, 665183, 835908, + }, + { + -567473, 6839199, 6897181, -5145908, 286689, 824634, 744103, 122943, 235149, -791885, + -307627, -3696356, -2601677, 21616570, -7307350, 6205691, 5497558, 1443646, 1802276, 202937, + 10230612, 4265440, -7683697, -887448, -5829345, -2185065, 6237903, 10902774, -559956, -4815195, + -6721087, -5666136, 7228967, 128312, 1377074, -3337727, 1100049, -4847945, -1705102, -117038, + 2560338, 1781875, -418759, 2223719, -4548371, -506269, -2227478, -3991098, -1022739, -2625836, + 586263, 4454418, -3442953, -886911, -781147, -2130304, -481036, -1808181, -1431835, -1201517, + 118112, -1506460, -3031173, 147640, -105227, 1292248, -1513976, -2155000, -664646, 2712809, + -2195802, 1389422, 1103807, -73551, -226560, -1017907, 207769, -2333778, -44023, -1650878, + 731755, 421981, 970126, -795106, 881542, -921807, -595390, 1018444, 127775, 581968, + -1408212, 1101659, -754304, 897648, -774168, -112206, + }, + { + 16920560, -35576288, 4833986, 40130564, -2227478, -5578626, -3039763, 290447, 151934, 749472, + -8053, 774168, 13193603, 4603131, 7262253, -13267691, -6658273, 1752347, -1488206, -1399623, + 3671660, 212601, 1573032, -5971079, -4217658, 1567663, 1950452, 5745056, 7007239, 3346853, + -1370095, -6444599, -7325604, -2930778, 7188165, 3793530, -89121, -1727114, -406948, -1232656, + -233539, -618475, 304406, 2910377, -2963528, -1735167, 1106491, -447213, -487479, -2298881, + 1771674, -3369402, 4225711, -1270774, -1695438, 941672, -214212, -1529008, 1208496, -2989297, + 1744294, 1200443, -2353105, -2854006, 1334661, -390305, -354872, 2852932, -187368, -2210835, + -1642288, -2361158, -397821, -660888, 267362, 1002338, 3182034, 415001, -1270774, -1348620, + -208306, 778463, -2538326, -1251983, -718870, 1023813, -913754, 489089, -60130, -1162862, + -369367, -199179, -424128, -1235877, 957241, 335544, + }, + { + -2582886, -15503758, -7168301, -3925063, -1329829, -1907502, -3394098, 1573569, 599685, -3716757, + 3592740, -238908, 2079301, 10083509, -399969, 1332514, 9493488, 12712029, 1715839, 415538, + 7949448, 3782793, 2243584, 5107253, -4691715, -10545755, -8753143, -2187749, 1260036, -3486440, + 3302293, 6077379, -9277666, -6352794, 849867, 580894, -5005785, 1983201, -1320703, 4365298, + -2310693, -6678674, 1367947, -5760088, -7143605, 3032247, 671089, 5393405, -1672890, -1340030, + 2450279, 1707786, -180926, -2295660, -1643899, 2790118, 2435247, -645856, -3522410, 2115272, + 834297, -2144263, -1812476, 2429341, 3882114, 496069, 260382, 1387811, -1316408, -749472, + -109522, -1591822, 989453, 2660195, -674847, 1173063, -1151588, 1530082, -1227287, -2353105, + -448824, -444529, -211527, 540629, -2252710, -2227478, -799401, -531502, 213138, -1216550, + -1950452, -303332, 1171452, -806380, -659814, -737124, + }, + { + -10428717, -26589068, 13351443, 8613557, -3744675, 12291123, 29135984, -9050033, 2892661, -10228465, + -3468723, 924492, -6022618, -2827162, -11477763, 3081102, -4326643, -9174050, 3833795, -252329, + 14821395, -2640868, 4318590, -3242700, -2109366, -7495792, -8016557, -2288144, -2065879, 11141682, + -6309844, -3004867, -693637, -155693, 2264522, -898185, 6342593, 2451353, 5911486, 7031935, + -6427956, -6015102, 2541547, -7376070, -4218195, -6879464, 1278290, 5222680, -601295, -345208, + 2250026, 10400263, -753230, -2605972, 1152125, 256087, 3044595, 1855426, 821413, -336618, + 7516, -5906, -3789772, -2680060, 1321776, -762894, 363998, -2178622, -1145146, -1277753, + -2430415, 614180, 1296543, -1677722, 628676, -1008780, 491237, -2501819, -398895, 1824824, + 401043, -504659, -888521, 606664, -721555, -3837017, 135828, 1808718, -1103807, -695248, + -255551, 964757, -1664837, -676457, 835908, -1366337, + }, + { + 3234647, -8856223, -9630927, 900869, -3187940, -3311420, 2543158, 6711424, -14931454, -7878581, + -2641942, -4695473, 6927246, 3047816, -6795712, -855772, 2101850, -9521942, 2541547, -2340220, + 16653199, 8618389, -603443, 8659191, 1587527, 8318278, 4560182, -2858301, -2219961, -3567507, + 6636262, -2015413, -2697776, -598611, 3106872, 2545305, 6877854, 5313412, -2013266, 882616, + -2580739, -3458523, -1323387, -623844, 3221762, 3727495, -4430796, 5602785, -1611, -8385924, + 1727114, 2280628, 4080219, 1894081, 4818954, 2590402, 4147865, -1410360, 6460705, -2893734, + 1967095, -4613332, -1458678, 1412507, -5425081, 1695975, -3167002, -4505421, 570694, -459025, + 867583, 368293, -2857227, 616865, -104153, -1865626, 1133871, -440771, -3220689, 575526, + -83215, -1819992, 1444720, -433255, -1454920, -988379, 622233, -1471026, -636192, -1797981, + 1517197, -751619, 147103, -181462, 221191, 799938, + }, + { + 10313827, 45134200, -3615826, -3078418, -13245142, -17444010, -14390288, 4370666, 5020817, -8417062, + -3542811, 3066070, 520765, -27486716, -14261439, 297427, 960462, 254477, -7300371, 1238561, + -8610873, -1550483, -956167, -613107, -8581882, -10888816, -8488466, -434865, 3996467, -2047626, + 2217277, 3036005, 3303367, 2872260, 6597607, 4304094, 3783866, -387621, -3114388, -6376416, + 5389647, -8383240, -2211908, 967441, 1742146, -3687230, 10251013, -4529580, 8053, 985695, + -8893267, -3381213, 1223529, 3728569, 1724966, -5388574, 340913, -774705, -1881196, -3026878, + -208843, -265214, 1233729, 384400, -909459, 3555696, 1708860, -3989488, -460098, -2953327, + 665720, 688805, -2383707, -2281165, -2159832, 746251, 2170569, -3430068, 1362578, 1256278, + 352724, -3599720, -621160, -768799, 67646, -1270774, -120796, 774705, -6442, 191126, + -276489, 292595, -335544, 1315871, -935229, 1057099, + }, + { + 1440962, -23886460, -7018514, -7219840, 11009075, -3327526, -899259, 693637, 1684164, -1395328, + -2050310, 6978785, -951335, -31817118, 5048734, 3508988, 7477001, 1909650, -5216238, -2922188, + 341987, -5157719, -9738838, 501974, -1309428, -8735963, -11126650, 4463545, 2194728, 8526047, + 14522895, -9008694, -194347, 367220, 2055679, 1045288, 1169305, -3502009, -1998234, -10319733, + -6506876, -1953136, 3820374, -1817308, -92879, -5748814, -725313, -3055332, -2638184, -1795833, + 3788698, 1727114, 751082, 1880659, 187905, 4529043, -1859721, -2051921, -1675037, 3838627, + 3467112, -2572686, 2796561, -340913, 4000762, -599685, -1039382, -54224, -321586, -2396055, + -2988224, -300111, 1442035, -617938, 802085, -1449015, 1594507, -1429150, -720481, -1569811, + 1766842, -556735, 442919, 2761127, -1578401, -2199560, 1652489, 1267015, -385473, 888521, + 1465121, 1039919, -1268626, 174483, -675384, 627065, + }, + { + 12159589, 32499480, 1376000, 17656074, 1067299, 1076963, 7223062, 3196530, 13938779, -5342403, + -2302103, -9853729, 5685463, -1279900, -15586973, 6254546, 9647033, -13940390, 251792, -2951180, + -6196564, -3261491, 3308199, -2683281, 9754408, -1134408, 3105798, -2720325, -2649995, -10558103, + -5209796, -2171106, 4188667, -1123671, -540092, -5026186, -2127620, -4817343, -3808026, 27917, + -3546569, -3141232, 6562173, 5615670, 1591822, -49929, 1067299, -75699, -4741644, -5369246, + 1591285, 4976257, -2671470, -1293859, -3133179, -207232, 654446, -941135, 4015795, -2366527, + 4352413, 479963, 1327145, 2701535, -1508070, 2442763, 1216013, 1612760, -802085, 1316408, + -1357210, -892279, -1097901, 1081258, -340913, 816581, 3056406, 1689533, -345208, 2711735, + -1918240, -1117765, -797790, -738734, -668941, 222265, -221728, 552977, -1110786, 294742, + -1205812, -1046898, -791885, 748935, -1047972, 1379758, + }, + { + 2301566, 17746804, 270046, -4286378, 570157, -6452652, 10662256, -2595771, -8275328, 2201171, + -8444443, 12979928, 1660005, 23677080, 37985228, -2976949, -1038308, -5433134, -3001645, -1617592, + -1719061, -7850664, 3245922, 3707094, 14679124, -8590, 9740449, -2249489, -1874753, -607201, + 1610076, 2705830, 2789045, 3360812, 12666395, -5108864, -5597953, 9736154, -2993055, -22012, + -760209, 3474629, -121870, -852014, 1897302, -3686693, -2141041, -948114, -6866579, -2595234, + 1450625, -4827007, -5427228, 2119566, 1318555, 200790, 3294240, 1967632, 3231963, 1216013, + -3223910, 586800, 387621, -142808, 3221, -517544, -3364570, -1748052, -1509681, 2254321, + -797790, 1101659, -2851858, -3587908, 292595, 1401770, 2184528, 126702, -627602, -1983201, + 836445, 1271847, 1541893, -1734093, 532576, -1685775, 1459752, -2219961, -1514513, 111669, + 1262184, 985158, 527744, -100395, 624918, -841814, + }, + }, + { + { + -870268, 87214680, 15567109, -48448840, 2786897, 2233920, -4189204, -6790880, -3788698, -1385127, + 7592429, 12568685, 13850733, -4987531, 2647311, -2080375, 7320235, 6718940, 9084930, -5076115, + 801548, -6430640, -8850854, -3103651, -4985384, 1605244, 4351339, -7723425, -4629438, 308701, + -1280974, 258235, -4463008, -3364033, -6131066, -3409667, 3067144, 1755568, 404801, -6130529, + 4379256, -1149978, 6132140, 1403917, 5159867, -2292439, -1942936, 3270081, 610422, -319438, + -3017215, 4580583, -3528853, -7297150, -2218351, 361314, -4133906, -4089883, -3714610, -3565360, + 49392, -1131187, -1378685, -394600, -1270774, 1626182, 3754875, -915902, 105227, 230854, + 46708, -1723893, -906775, 228170, -1925756, -70867, 1057636, 1090385, -1214402, 220654, + 638876, -671626, -846645, 348429, 161061, 683974, -1631551, -960462, 2385854, -923955, + 946503, 701153, -65498, 59593, -872952, -1127429, + }, + { + 997506, 21963390, -10499048, 25032680, 6158446, 641561, 3398930, -2733210, -690953, 1734630, + -3623879, 360777, 4052839, -4181151, 1211718, -2880849, -2653753, 5898064, 16948478, 2601140, + 4029753, 6423661, 4546760, -5639829, 2418604, 5481452, -6163815, -476205, -3715147, 994285, + -1964948, 13140452, -1143535, -5405217, -6599754, 1690607, 1848983, -6585259, -1928440, 4632659, + 3821447, -1562294, -4608500, 4111358, -4196720, -301185, -1981591, 5853504, -2027225, -2020245, + 603443, -1820529, 1078037, -6409702, 4649839, -680752, 3437048, 716723, -3919695, 3360812, + 504122, 311385, -3549791, -1146219, 535797, -147103, 669478, 180926, -2686502, 492848, + 185757, -79994, 376347, -1171989, -2917357, -833224, -1123671, -778463, 1893007, -1020055, + -75699, 1106491, 476205, -890669, -530428, -342524, -769336, -1387274, 595927, -231391, + 1089311, 351114, 513249, 386010, 279173, -1582696, + }, + { + -2472828, -68286224, 8141111, 25946972, -13168907, -628676, -6312528, -1481227, 6426345, -3213709, + -1552094, 13375065, -230318, 10672457, -312996, -4733054, 14894410, 4020090, 12874701, -3211562, + -7817914, -6598144, 4863514, -2508798, 2181844, 1743220, -4810364, -1135482, 2220498, 7457674, + -3359738, 8197482, -8105677, -2738579, -2542621, -4181151, 3062849, -6965900, 584116, 2757906, + -1222992, 2035278, 3532074, 1847373, 161061, -142271, -1192390, -439697, -1052267, 2608656, + 791885, 1339493, -2139968, 1468879, -2302103, -543313, -1349694, -1891396, 1411434, -2700461, + -565862, -2002529, 3252901, -559956, 103079, 675384, -1505923, 436476, 6442, 2595234, + -28454, -597000, 1480690, -1969243, 620623, 935766, -798864, -2806224, -1404454, 600759, + -2832531, -942745, 748935, 91805, -592706, -634581, -1233729, -1217623, -386547, 1030255, + -756451, 210990, 367220, -937377, 2419677, 403727, + }, + { + -11299522, 22217866, 11862700, 25817048, -7056632, -3822521, -1523640, 1634235, 3711926, -5565741, + -8653285, 15908559, -321049, 4167192, 9921374, -7815230, 14669998, -1150514, -1815697, -6599218, + 2876554, 3364570, -2408940, 3731790, 1397475, -1531156, 1820529, 1410360, 6037651, -7736310, + 3950296, -2039573, 10740103, -467615, -2225330, 6282464, 1639604, 3402151, 2762738, 1496259, + -6483790, -4500052, -1610076, -5107790, 1545651, 1605781, 2163053, -1140851, 2155537, -3956202, + -1451699, 203474, 1187559, -1398549, 3246995, 5111548, 4522064, -4895726, 2605972, 877784, + -911070, -3059627, 235149, -1102733, -3134253, -2058900, 1035624, 925565, 2710661, -2003065, + 2482491, 323733, 700080, 1219771, 274341, -261456, -3061238, 860604, 1133335, -1395864, + 1079647, -128849, -2017561, 1835562, 1025960, 1075889, -257161, -790274, -368293, -734976, + -437550, 392990, 594853, -379031, -1231045, 2542084, + }, + { + 164283, -29047938, -2076617, 6350646, 3074660, -493921, -1585380, -11111080, -2611877, -4547834, + -423054, -9606768, -1356136, 6962142, 21621402, -9988483, -5881958, 17926120, -9825811, -4981089, + 3073586, 5024575, -4832375, 5177583, 6992207, -1555315, -5550172, 7999914, -2641405, -8575439, + 947040, 5381594, -7765301, 4935455, -270583, 3547643, -5760625, 8186745, -2089502, -163746, + -4173635, 2965138, -7766375, -5895380, -74088, 3252901, 3426310, -1458141, -1487669, 488016, + 1323924, 3473018, 216896, 1282585, -1144072, 3866008, 3249143, -1887638, 1026497, 847719, + 1270774, 988916, 249108, -5973763, -1597191, -2902861, 5149129, -3267396, 1673964, -2389613, + -2657511, -11811, 1545115, 2847563, 870805, 52076, -1271847, 1087701, 1634772, 289910, + 1460289, -319438, -1008244, 860067, 376883, -1115618, -1997697, -19864, 1613834, -413391, + 123480, -1069984, 599148, 630286, -1479079, 541703, + }, + { + -11760694, 50627464, -2930242, 41247792, -547608, -2482491, -376347, 4585952, -11037529, -1178432, + -9999758, 11664057, 1268089, -4060892, -104690, -3750043, 4385162, -2780455, -6140730, -5308580, + -4024384, 1469953, 4722317, 4285841, 2275796, -92342, -4048544, 3714073, -4937602, 1420560, + -3659312, -1073742, 6758131, -8953396, 6605660, 3415036, -3786551, 3787088, -3940096, -1167694, + 2051921, -2689723, 3400540, 2223183, -1344325, 3999152, 6310381, 1663226, -1792612, -497679, + 1833414, -1358820, -2100776, -844498, -476741, -151934, -2568927, -1637993, -3117610, -707596, + -3864397, 2158221, 884226, -1806034, -484258, -492311, 1584306, -12885, -653909, -206158, + -2907156, 766115, -2105071, -858457, 619012, -200253, 4697084, 271657, 2108829, 813359, + 1461900, 1351841, 427349, -750546, 105227, -1248762, 654983, 1802813, -925565, -923955, + 489089, -706522, 676994, 784368, 808528, 975494, + }, + { + 1611, 15441481, -9411884, -3137474, 811212, 1340030, -912681, 788663, -925565, -3685082, + 6175089, -10560788, 5749888, 3707094, 714575, 7466264, -5816997, 16810502, 61740, 6502044, + 11133629, 1921461, -5773510, -944356, -9088688, 2732673, 5425618, 2435783, 3030636, -4301947, + -1407676, -5487358, 2763275, 1734630, -3277597, -3735011, 754841, -3580392, 985158, -768262, + -4318590, 6912213, 3366718, -1000727, 222801, -2709051, -5137318, -1314797, -1708323, 521302, + -268972, 3320547, -3478387, -1365800, -3192235, -2144799, 1717450, -2205466, -1341104, -3685082, + 2182380, -1475858, -2458332, -1034550, -67109, 2513630, -2647311, 682900, -2726767, 3308199, + -407485, 85362, 1991791, -1954210, -656056, -363998, -915902, -1950989, -38655, -994822, + 2124935, -1722819, 1953136, 63351, -821413, 217970, 340376, 259846, 563714, -129386, + 149250, 224412, -446677, 245887, -387084, 228707, + }, + { + -20530480, 12527883, 7493108, 41967200, -850404, -1520418, -12817793, 7834021, 1539209, -1264331, + -16048682, 7550553, 23056996, -4939750, 11444477, -6802692, -1741609, -2070711, 3985730, 1224066, + 565862, 1732482, -855772, -9330816, 630823, -4235375, 10358924, 4253628, -1447941, 7836705, + -1082332, -8680666, 1640678, -5938866, 3264712, 2678986, -3406983, -222801, 935766, 848256, + 99321, -2515240, 3235721, 2311229, -1393717, -4686346, 1704028, -1094680, 3306588, -3930432, + 1603633, -1384590, 4399121, -1080184, -776852, 1692217, 2392297, -5213017, 1529008, -1054951, + 569083, -2321430, 413927, -4514548, 959388, -1525250, 4025458, 966905, -3457986, 1220308, + -1198296, -2193655, -3498251, 68183, 1379758, 1285269, 818191, 304406, -616865, -450435, + -570694, 621160, -2605972, -1334124, -849867, 26844, 1115618, -744640, -563178, 452045, + -712965, -267362, -705985, -2001992, 861141, 724239, + }, + { + -259309, -26332982, -8648990, -8605504, 1113470, -326418, -2428267, 2629594, -7893076, 405338, + 3260954, 4277251, 1778653, 3894999, 7548942, 22163104, -1257889, 2442763, 5741835, 7384660, + 3046206, 4021163, 226023, 2628520, -1911797, -1002338, -9119289, -6129455, 5694053, -1620276, + -3062849, 6393596, -2398202, -2828773, -5854041, -6062883, 2203855, 2151779, -2457795, 2773475, + -5650030, -2939368, 231391, -2377265, -4580046, -5153961, 5786395, 2630668, -1684701, -369904, + 3854196, -337692, 85362, -4049617, -2375654, 3959423, 1110786, -2000918, -1765232, 4400194, + -799401, -2595771, -750009, 2737505, 3276523, -1099512, -39192, 4516158, -2294586, -2313377, + -1137630, -957241, 3296388, 461172, -1220308, 440234, 663036, -925029, -658204, -1957968, + -809064, 32749, -732829, 202400, -1942399, -1255741, -1515587, -360777, -609885, -1307818, + -2035815, 1221918, -955630, -176094, -1737851, 143345, + }, + { + 11231339, -40130564, -3810173, 9766219, 15793132, 7310571, 8593156, -3550327, -1366873, -4594542, + -5636071, -15223512, -1787243, 5492190, 3384434, -8644695, -6547141, 3336653, -4945655, -2439542, + 9739375, -2703682, 6597607, -3347927, -8968429, -3189550, -10143639, 177704, 3175055, 1301375, + -2110977, 3257196, -5734855, 111132, -628676, 7780334, -230854, 4462471, 7180112, 3222299, + 1219234, -8096014, -5545340, 1995012, -3232500, -12000139, 663036, 1779727, 2170032, 4998268, + -2442226, 10676752, -927713, -3349001, -569083, 2048699, 2337536, 1918777, 14496, 1343251, + -2058363, 3206193, -2430952, -2710124, 1711008, -1424319, -1750199, -1231582, -2067490, -1512902, + -2840584, 2267206, -2927557, -159988, 1118839, 1568200, -2865280, -1320166, 960462, 1433445, + 2079301, -2196876, -2851322, 2924336, -675921, -3736622, 1821066, -686658, -1585380, -709207, + -228707, 44023, -69793, -1174674, -191126, 558883, + }, + { + -2763275, -17200808, 12770548, -4380330, -5608154, -11532524, 14397804, 3408057, -18065170, -10989748, + -3586298, -1693828, 1944010, 6658810, -10513006, 6642167, 1816771, -1122060, -5252745, 2132451, + 9644886, 6372658, 6446746, 4683662, 8855686, 4240207, -1991254, -1148904, 1938641, -226023, + -2251637, 6018323, -1401770, -12250857, 3608310, 5218922, 7991324, 7545721, -9127, -3752191, + 1411971, -5055714, -5588290, 6005975, -2268817, 4029216, -3952444, 6742562, -711354, -3956202, + -2509872, 3661997, 2642479, 5705864, 2962454, 6778532, 54224, 1574642, 2885681, -597000, + 1807108, -5181341, -970663, 979789, -1937567, 219043, -1675037, -5461588, -806917, 1773822, + -1711008, 1924145, -1319092, -819802, -440771, 1249836, -1094143, 1053878, -2780991, -1216550, + 517007, 919660, -2277407, -120259, 44023, 61740, -902480, -290984, -1874216, -310848, + 63351, -311922, 83215, -658204, 38118, 639413, + }, + { + 2195802, 62867584, -13495861, 7122130, -5264556, -49113488, 218506, 613107, 6105833, -3226594, + -19768660, 14983530, 3469797, -26698054, -18896782, 4270271, -11725261, 257698, 3224984, -9191230, + -9457518, -3828963, 249645, 1311039, -1697049, -9670119, -6042482, -10955925, 7071664, 257698, + -4730370, 4494684, 8049306, 3278134, 3017215, 5991480, -199179, -2357400, -805306, -3519189, + -459025, -1302449, -57982, 558346, -2603824, 4270808, 4705674, -3777424, 3857418, -1333051, + -8205535, -6277095, 1377611, 4716411, -785979, -4602058, -448287, 3746822, -4611185, 345745, + -3533684, -406411, 1091995, 477815, -801011, 3795141, -1821066, -3088618, 1287953, -649077, + -1015760, 220654, -1717987, -2076080, -4976257, 2210298, 1089848, -748398, -705448, 2677375, + -1687922, -3241090, -1663763, 56908, 89657, -941672, -200790, 102005, -370978, 943282, + -632434, 456340, -23085, -814433, 383863, 474594, + }, + { + -303332, -22381612, 38655, -5877663, -1008780, 4791036, -6616397, 7948911, -2207613, 3528316, + -7271380, 7093139, -12714177, -25643102, 13115220, 7004018, 4345970, 287763, -6347962, 6899865, + -10169946, -11647951, 2036351, -5116380, -8388608, -2736431, -8813273, -5987722, 15868294, 323196, + 14584098, -4556961, 2345589, 430570, 949188, 1805497, 1756642, -4374424, -7973607, -7482907, + -3656628, 974958, -1730335, 961536, -2122788, -2783139, -2090575, -6240588, 4035122, -1865626, + 1231582, -2774549, 2967823, 1962800, 4947266, -3503083, 2443837, -639413, -2285460, 7215008, + -358630, -3849901, 2578591, 1722819, -658204, 1257889, -666257, -2497524, -102542, 2442226, + -5587753, 394600, -621697, 1491964, 54761, 849867, -1219771, -413927, -3257196, 2317672, + 286152, 1217623, 257161, 2790118, -2300492, 760746, 248571, 1084479, 482110, 191126, + 2292439, 344134, -2113661, -368293, -250182, 868657, + }, + { + -4783520, 53465364, 9924596, 10215580, 1756105, -1898912, -2229625, 13473849, 8095477, -6375342, + -1115618, -17853642, 3265249, 8977555, -20145544, -3783329, 5137855, -28991, 200790, -6193880, + -11556146, 722091, 3279745, -1398549, 7509214, 5108864, -3165391, 5439039, -47782, -14692546, + -5881958, 1270237, -889058, 5042292, -8590, -3063386, -10184978, -5759015, -3138011, -850940, + -5982353, 5718749, 1566589, 7365332, -2266132, 1451699, 3856881, -2364916, -7588671, -3590593, + -71941, 3069291, 4313758, -3120294, -1816234, -4246112, 3910031, -1421097, 3997541, 585189, + 2645700, 321049, 603443, 3318399, 986769, 2562485, -1350767, 1352378, -148713, 972810, + -2674691, 529355, 287226, -2313914, 508954, 2108829, 3240016, -828392, 1214402, 2239826, + -697395, -2844879, -2684892, 1749662, 55298, 1175747, -1792075, 792958, -61740, 811749, + -565325, -1874753, -1611150, 1145146, -644782, -583579, + }, + { + -2646237, 21931176, -44023, -1585380, -3630858, -1787243, 6892886, -3412352, -3628174, -6932614, + 7099044, 3216394, 4334696, -23105314, 84049824, 7576323, -6302865, 7916699, -17535814, 1960653, + -8795556, -3354906, -7590818, 14457934, 2218351, 9772124, 3937948, 7126425, -4895189, 456877, + 144955, -3373697, 8230231, -1431298, 14392972, -9288941, 4883915, 5978595, -2850785, -1425929, + 1383516, -314606, 4543002, -3129421, 2345589, -1289564, -1599339, 2322504, -9366787, -6290517, + 4320200, -6965900, -5795522, 3333968, -617402, 310311, 395137, 3482145, 3848828, 1939178, + -3044595, 748398, -3474092, -384936, -661962, -96637, -4080756, -20938, -1946157, 1513976, + 1082869, -1168768, -1981054, -2783676, -748935, 2119566, 1319092, -358093, -129386, -982474, + 1037235, -118648, -1004486, 132607, -1409823, -554588, 577136, -1556926, -1915019, 2698313, + -135828, -195958, 1173600, 63888, 81604, 234076, + }, + }, + { + { + 3034931, 82389280, 2923262, -7816304, 29253560, 287226, -3659312, -4083440, -3837553, -2675765, + 5233418, 7412577, 2135136, -6324340, 1398549, -5138392, -4886599, -755914, 6649683, -4905927, + 5509370, -1412507, -219043, 8103530, 2694555, -488016, 3537979, -4178466, 2906619, 1286880, + -2733210, -4153770, -4907537, -2794950, -7850664, -3262565, 65498, 3757023, 2544231, -5247377, + 2057289, -6932614, 5818607, 5440113, 8352101, 811749, -1757715, 1512902, 3084860, 3312494, + -198642, 3736085, 1277753, -991064, -1273458, -899796, -3684008, -417686, -1819456, -1133335, + -1835025, -3110630, -2943126, -2665564, -4291746, -4015258, 1112933, -2287607, -1147293, -1018444, + -715649, 289373, -442382, -945967, -2254858, -922881, -22549, 1488743, 332323, 2224793, + 1838783, 790274, -637803, 558883, -485331, 825707, -503585, -723702, 2548526, -381178, + 745177, 276489, 258772, 683974, -473520, -1459215, + }, + { + -677531, 41180148, 8926553, -11986180, -20994338, 2313377, 2544231, -5867462, -2924873, 1495186, + 3322157, 3391951, 659278, -5562520, -1231582, -5632313, -5294621, -3425237, 1964411, -9676024, + 9940165, 7993471, -1693291, 1615982, 9942849, 6776922, -7890929, 2843805, -462246, 1394254, + -5941551, 12402255, 2293513, -3043521, 1755568, 5284958, 4938139, -1613297, -1367947, 1928977, + 1444720, 1687922, -3508988, -147640, -9890236, -979789, 1819456, 4396973, -4914517, -2537252, + 2918430, -8590, 7445863, -438087, 3317862, -2314451, 2560338, -10201, -6832756, 882616, + 4130148, 2654827, -2416993, -2236067, -2142652, 297427, -93952, 763430, -3228205, -71941, + 232465, -681826, 598074, 876173, -1194538, 291521, -740345, -942745, 3962107, 532576, + -1256815, -195421, 329639, -1817308, -915902, -37581, -663572, -544387, 1498944, -1454383, + -653909, -88584, 883153, 814970, -86973, -1832340, + }, + { + -496606, -78569448, -1372779, 53767084, 5677410, -2093260, -8383240, -7268696, 564251, -6489696, + 4276714, 19036368, 1409823, 6726993, -6624987, -3224447, 14682346, 3838627, 14650133, -1054951, + -5369246, -7124814, -205622, -4010963, 6999723, 1472637, -8220031, -1469416, 3820910, 3246995, + -9982578, 11899744, -338766, -2243584, -4743792, -1209570, 5765994, -11042898, -6545530, 2330557, + -45097, -185220, -3600256, -1963874, -3067144, 290984, 2387465, -4735739, -8227010, -1604170, + -4359929, 231928, 416075, 980326, -2896956, 379568, 630823, 1510755, 6577743, -1318018, + 2777233, 4249334, 4715874, -1555852, 1131724, -926639, -1483911, 2451890, -420370, 813359, + -1470489, 122407, 2729452, -696322, 472446, 951872, 1793686, 1205275, 1195612, 2207613, + -1002875, -140123, -1088237, -705985, 277562, 563714, -143345, -781684, 372588, 1883343, + 178241, -943819, 176094, -815507, 2044404, 715649, + }, + { + 6525129, 41894184, 5248450, 36357436, 177167, -3074123, 2104534, 399969, 1785633, -6139119, + -12028056, 3590593, -3463891, 1363652, -3046206, -18587008, 3356517, -13723494, -7256347, -4747550, + 7754027, 4895189, -2706366, 494995, 5262409, -1445257, -2328409, -5889474, 5671505, 596464, + 387621, -5052492, 11672647, -2784213, -303332, 5458367, -3040300, -3142842, -3676492, 3437585, + -723165, -2709051, -2733747, -2242510, 2169495, -2306934, 2195802, 1288490, -426276, -4742718, + -916439, -1595580, 2297271, -1061394, 1271310, 2001455, 3491272, -626528, -123480, -1673964, + 4391067, 1432909, 1393180, -44560, 1881733, 827855, 2161979, -1125818, 1639604, -412854, + 608812, -1679332, -57445, -978716, -801011, 1149441, -644245, 217970, -401579, -641024, + 2725157, 761283, -1952600, 351114, 133144, 28991, 263067, 430570, 191126, 900333, + 925029, 927713, 827318, 1025423, -419833, 1118302, + }, + { + -1551020, -25347286, 326418, -1586454, -2001992, 12885, -1668058, -7806103, 1669132, 1567663, + 5110474, -8040179, -4084514, -1090385, 21724482, 1680943, -11515344, 7809861, -4374424, -11843909, + -8508330, 5148592, -10133438, -4880157, 1115618, -13124346, -3673808, 16049756, 677531, -7983808, + 4042101, 9744207, -8410620, 7187091, 3837553, 2498597, -6717329, 4728759, 4430259, 9075803, + -6559489, -2026688, -3351685, 71941, 1240709, 2726231, 4917201, 1907502, 2550674, 3016141, + -1526861, -1500017, -762357, 6011344, -383863, 1859184, 2043868, -609885, 1479079, 2100239, + 2061047, -983548, 2008434, -31139, 3045132, -1755031, 1768990, -6184216, 563178, -741419, + -1218697, -2006287, 264141, 1256278, -1510218, -651761, -1931662, -79457, 2486249, 196495, + -253403, -1074279, -1274532, 932545, 55835, -275952, -934155, -330712, 1501091, 9664, + -144955, 398895, 1752347, 933619, -927176, 744103, + }, + { + 2048699, 64054604, 1413044, 42819752, -110059, -3811247, -615791, 11398306, -11469173, -608275, + -15646029, 2909304, 881005, 2884071, 4573604, -7962870, 1496796, 146566, -232465, -4389994, + -3907347, 7057168, 8119636, -1823751, 1643362, 1644436, -2056753, 2916820, -5619965, 4071629, + 1542967, -30602, 5443871, -3444027, 4232154, 2613488, -5992016, 265214, -388158, 3313031, + 5433671, 332860, 1992328, -1447941, -4148939, 2364916, 3113315, 1533840, 868657, 2250026, + 2004139, -6530498, -4217121, -2078227, -635118, 148176, 1414118, 807991, -2024003, 2440615, + -849867, 739271, 1958505, 679142, -1723356, -2201708, 3267396, 2307471, 20401, 1080721, + -680215, 2649458, -1810329, -2044404, 153545, -488553, 2516314, 505732, 2437394, 290447, + -151934, -711891, -1205812, -723702, 279710, -1452773, 661962, 1919314, -463320, -342524, + 1923072, -588411, 1087701, 1379221, -304406, 58519, + }, + { + 552977, 17011828, -6918656, -3478924, -1281511, 1642825, -924492, 1714229, -346282, -3060701, + 4316979, -11050414, -601832, -6454262, -5847061, -2508798, -15429133, 13615046, 4356708, 6468221, + 3235184, -6555731, -3616899, -3325379, -9951439, 2496987, 6688338, -1789928, 3565360, 2135673, + -5007395, -4667019, -8126078, -6044630, 664646, -3134253, 918586, -3364033, 3926674, 2009508, + -978716, 5784247, 347892, -3404835, -2014340, 351650, 1881733, 5276904, -332323, -2157684, + -3558917, -758599, -1428614, 1509681, -121870, -2040110, 4096862, 1454920, -3049427, -3231963, + 3725347, 452582, -783295, -1512365, -1838783, 828929, 341450, 2623151, -2168959, 2063195, + -1285806, 1119913, 1634235, -2326799, 1339493, 688269, 938450, 1156957, 2472291, 544387, + 3024731, -323733, 1211181, -852014, 127238, 1549946, 799401, -1666984, -1621350, -565862, + -553514, -320512, -931471, -220654, -197569, 586800, + }, + { + 17542258, 61333208, 10848014, 30108258, -22590992, 2408940, -28755880, -3603478, 2084133, -5695127, + -7450695, 4494147, 13788993, -5696201, 10823854, 2342905, 256087, -7027640, 4604205, 8555038, + 245350, -1297617, 5105643, -3562675, -5266704, -7017977, 3185255, 2335389, -1172526, 5365488, + -3305514, -7618198, 8262980, -4321811, 1779190, 3308199, -4279398, -2486786, 2607045, -367220, + -3223910, -3905736, 3173981, 3001645, -3750043, -7110855, -1086627, -2568391, 5289789, -5030481, + -480499, 1217623, 3959960, 4215511, 2911451, 586800, 4852240, -3689377, 2646774, 1675574, + 1851131, -2208687, 2859911, -3411278, -41339, -2271501, 337692, -547071, -3229279, 490163, + 1762547, 1033477, -1394791, 1398012, 2136746, 765578, -1671279, -1918240, -792958, 1454920, + -214212, 179315, -423054, 735513, -426812, -477815, -244813, -1686848, 308164, 2404645, + 857383, -836982, -803696, -1272384, 365609, -1249299, + }, + { + 2316598, -1928977, 3804267, -2222109, 6912213, 676457, -206158, 3682935, -5472862, 1806034, + -2091112, -2014877, -8714489, -112206, 15744813, 24502252, 10756209, 9182640, 3821447, 9595494, + 3808562, 5792301, 2306398, 2750927, 2565169, 12703440, 1124208, -821949, 9445707, 2392297, + 2132451, 11214696, -4243965, -8830453, -10566156, -10969346, 2554432, 8153459, -1251983, 3726958, + 3748970, 1880659, -3214246, 2248416, 2350421, -6860674, 82678, 95026, -93952, 2210835, + 3383361, -1846836, -1476395, -1525250, -2224793, -896574, -593242, -1195612, 1788317, 5209796, + -2097018, -1397475, -1193464, -2174327, -2811056, -4424890, -3189550, 2352568, -1971927, -2049236, + -1894081, -479426, 3041374, -1044214, -438624, 332323, 688269, -1508070, -736587, -1234803, + 122407, -20401, -291521, 903017, -1084479, 66035, -391916, 1219234, 1336272, 445066, + -1143535, 1203665, -1804960, 427886, -694711, 1245004, + }, + { + -12380243, -65915936, -1963874, 2170569, 11618423, -11657615, -10644540, 1628330, -1531693, -6036040, + -2596845, -9243843, 2997350, 8368744, 6898255, -4610111, -1251983, 5682779, -11808476, -14755897, + 4021163, -234076, 4996121, 5623186, -7037304, 2016487, -4682588, 2405719, 4559108, -814433, + 2975339, 2822867, -6215892, 839666, -2021856, 4830228, -5259725, 733366, 337155, 652298, + 8668318, -1309965, -2270964, 5205501, 766115, -5701569, 649614, -1242319, 6389301, 7134478, + -5993090, 3550327, -2375117, -1424319, -1896228, -641561, 1628866, 585726, -377957, 1925219, + -5714454, 2627983, -1249836, 1717987, 4089346, 1948841, 305480, -1660542, -2065342, 271657, + -63351, 3469260, -1918777, 1050656, -53687, 1282048, -1941862, -67109, 411243, 1343251, + 2948495, -1490891, -1169842, 3789772, 2024540, 286152, 3759170, -649614, -685584, -850940, + 99321, 258772, 435939, 408022, 308164, 1337882, + }, + { + 1465658, -24387898, 14615237, 335544, -2288681, 272730, 15400142, 5828808, -7358353, -1796370, + 7315940, -1345399, -7843147, 1520418, -7669201, 9350144, 5291937, 9634685, 1872069, 6500970, + -1562294, -1840930, 12934294, 5035313, 3810710, 2068564, -6825240, -2535641, 6219650, -6531572, + -11352672, 3199751, -1422171, -8706972, 4667019, 5710696, 5641977, 1174674, -6031208, -8730058, + 1649804, -3380676, -5638755, 7052873, -3338263, 5222144, -4008815, 112206, 1534377, 3618510, + 286152, 579821, -1113470, 3226594, -504659, 1157494, -3165928, 809601, 1316944, 16106, + 5275294, 895501, 564251, 2859911, 2499671, -180926, -624918, -441845, 904628, 435402, + -1593970, 3294240, -587337, -1545115, -589484, 305480, -1290638, 1353452, -1889249, 1101659, + 958851, 506269, -2132451, -863288, -750546, 187368, -1479616, -502511, -1212255, 433792, + -223875, -879931, -1476932, -1783485, 34360, -183610, + }, + { + -15560667, 36120140, -9958955, 6309844, -6789807, -38044284, 14199162, -5011690, 1857037, 12360916, + -16395501, 10892574, 3064459, -13527536, -7842611, 14670535, -9453760, -6875706, 2184528, -5664525, + 660351, 3212636, 7090991, 5206574, 4679367, -688805, 4992363, -7541963, 5626407, -644245, + -5440650, 7770133, 513785, -2178085, -4004520, -3425237, -8106214, -3732327, 2651606, -1665374, + 1693828, 4445291, 1783485, -237834, -4226248, 53150, -1748589, -3695283, 6820945, 4355097, + 1239098, -5244155, -2521146, 5031018, -2166274, -3664681, 1919314, 3457986, -4662187, 5465346, + -1559073, -1748589, -1766305, 331249, 460098, 895501, -6340446, -2622078, 4281009, 2962991, + 41339, -848256, 1510218, 1102733, -4864588, 1241246, -1886564, -1039919, -391379, 1235340, + -2328946, -645319, 724239, -967978, 918586, 1269163, -1094680, -1214939, -88047, 808528, + -514859, 1492501, -118112, -2844342, -276489, 226560, + }, + { + -1260573, -20422570, 5372467, -3667365, -4539781, 2282775, -9561134, 942208, 648003, 9058086, + -6875706, 6162741, 8573828, -6135898, 2816425, 1933272, -6180995, -6553047, -6231998, 12065100, + -6851010, -10011032, 13194140, 4359392, 2472828, 10411001, -2477659, -6762426, 15797427, -3921842, + 4607963, -1693828, 9401683, 1790465, -214212, 4686346, 1574106, -401043, -6469832, -428423, + -614180, -78920, 1660542, 4566087, -495532, -2109903, -1037235, -5587753, -1777043, -3677566, + 1502702, -4386236, 1956358, 1097901, 6184216, -1133871, 5449240, -2080912, -2632278, 1655710, + -3627100, -900333, 1107565, -1549410, -3988414, -409633, 104690, -606664, 813359, 2034204, + -2967286, 1129576, -1770600, 352187, 60130, 2384244, -425202, -64961, -1450088, 3427384, + -461709, 904091, 356482, 2382096, -3427384, -348429, -1113470, -214748, 51003, -760209, + 223875, -735513, -1632625, 368293, 312459, 1051730, + }, + { + -5970005, 36843840, -16521665, -1808181, -2466385, -4424890, -3818763, 4080219, -8294656, -5633924, + 7170985, 6419903, 10078678, 9131637, -14598057, -15296526, -545461, -5856725, -9419400, -5840619, + -10817949, -1233193, 1901597, 3256122, 10506027, -4925791, -3876745, 17686676, 7617662, -4509179, + 3499325, -619549, -7641284, 4183298, 5774047, 516470, -10079751, -2093797, 642635, 3399467, + -1453310, 6950868, -1950989, 7619272, -1642288, -1728724, -1181116, -2915209, -1135482, 2761127, + -5361730, -4689568, 7234336, -851477, 1829119, 265751, 3933116, -2385854, 1349694, 1748589, + 1187022, -2511482, 469225, 682900, -1389422, 530428, -4223564, -1203665, -710280, -146566, + -3076807, -772557, 511101, -949725, -521302, -331249, 1524177, -512712, -901943, -442919, + -587337, -2683818, -2238215, 3514894, 1318018, 1844689, -1811403, 1167694, 35433, 373662, + 325344, -1489280, -1858110, 147640, -675384, -246961, + }, + { + 2535105, 15714212, -16253230, -6390375, 1688459, -2909304, 1631014, -1177358, 958851, -2308545, + 5034776, -5628018, 2665027, -37454800, 31453656, -3528853, -4276177, 16106664, -24432458, -22029424, + -19118510, -668941, -10004589, 5687074, 233539, 3989488, -12054899, 7275675, 5637682, 5935108, + 184147, 1813550, 10424422, -1379221, 3979824, -8384850, 16776142, 4093641, -2413772, -455803, + -6624987, -4513474, 7034620, -4050691, 928787, 3287798, 2591476, 8671539, -526670, -7340099, + -1903744, -5699422, -3603478, 3754875, 1129040, -1264868, -2180770, 755914, 3360275, 3055869, + -2830920, -1605244, -1416266, 4160750, -1065152, 2593087, -3396246, -430034, -316754, 1898376, + 1200980, -1187559, 2069101, -48318, -1594507, 38118, 251792, 347355, 183073, -1281511, + 185757, -2027761, -2339684, 416075, -1264868, -787053, 127238, 671626, -665720, 1917166, + -1378148, -756451, 238371, 784905, 52613, -56908, + }, + }, + { + { + -4759361, 131479152, -26678190, 34133716, -11597485, 2794950, -2996277, 2653753, -5050345, 7352447, + -10465762, 10237055, -1646046, -950262, -4553739, 883690, -5589900, -450972, -3383897, -254477, + 7552700, -1522566, 6227703, 1896228, 7995082, -3245922, 3495030, 956167, 4426501, -2374580, + -4751845, -4737349, -6329171, 2946348, -7367480, 266288, -3648038, 4294968, -2505040, -2414845, + 1960653, -2310693, 5969468, 4794794, 817654, 4913980, 239444, -151934, 3010235, 2952253, + 2202245, -61740, 2782602, -1009854, 658741, -161598, -688805, -854162, -2310693, 1033477, + -5853504, -665183, -3406983, -2708514, -3512210, -4017942, -144955, -2259153, 217970, -1010928, + -1515587, 77309, -1029718, -801548, -2612951, 50466, -1746441, 1626719, 673773, 2702071, + 1219771, 1100585, -543313, 1011465, -1069447, 858457, 170725, -324270, 1435056, 1058710, + 380105, -41339, 400506, 179315, -1008244, -377957, + }, + { + -593779, 47003584, 2055679, -40236864, 6259378, 2479270, -1389422, 77846, -1706713, -3628174, + 1347009, 3103651, 2534031, -3025805, -1319629, -9074729, -1171452, -929324, -7213935, -5964099, + 17179332, -1427540, -3738769, 14106820, 4651987, -566936, -8252780, 3211562, 7370164, -6563784, + 457414, 5832029, 3404299, 2826089, 6853157, 5181341, 660351, 90731, -2554969, 498753, + 1279900, 2393908, -6190659, -4855461, -499827, -3110630, 6482717, -5418101, -2126546, -3554622, + 2463701, 1826435, 6292664, 279710, 3564823, -2425046, 68183, -85362, -3693672, -3191698, + 4693863, 2564096, -501974, -3855807, -2760053, 4012036, -3780108, 1177895, -76773, -2601140, + -180926, -1157494, 1861332, 932545, -935766, -726386, 744103, -1181653, 1865090, 1751810, + -362388, -389768, -747324, -1765232, 106837, -430034, -90731, 887448, -2147, -622233, + -1932735, 306553, 353798, 44560, -328565, -846645, + }, + { + 3326989, -88806504, 1459215, 45683420, 13360570, -2618856, -4001836, -6660958, -923955, -6760279, + -4303021, 29256244, 360240, -1334124, 5716602, -12021077, 13571023, 2728378, 20247012, 8590, + -8624294, -8203925, -1935957, -2124935, 4692252, 5318244, -2390686, -371515, -807454, -5068599, + -1276142, 13377213, 96637, -1755031, -6889665, 5258114, -5814312, -4514548, -9170829, 1732482, + 397284, -2196876, -1311576, -1359357, -4473209, -1614371, 3318936, -6783901, -4318590, -2775623, + -3293166, -2802466, 4986994, -2778844, -206158, -4596152, 3555696, 1656247, 5142687, 1183800, + 4356171, 5837935, 2205466, -708133, 1977833, -503585, -1915555, 2660732, 469225, -374199, + -1884954, 952946, 714575, 535797, -1350230, 3508452, 283468, 786516, 936303, 1124745, + -330176, 1451162, -2127620, 323196, 1883880, -623844, 567473, -851477, 2506114, -276489, + 772020, -1210107, 373662, 162135, 1058173, 1025960, + }, + { + 1775432, 49378164, 2850785, 45544908, -7512972, -2193118, 1663763, 2423972, 2527052, -10917270, + -6402723, -2754148, 5535139, -4002373, -14220100, -5980205, -1869385, -15057618, -8616778, 4670240, + 3944928, -4252018, 1666984, 2439542, 1880659, -1418413, 8463770, -12906914, 1751810, 6445136, + -3497177, -830002, 6260989, 1302449, 1406602, 619012, -668941, -4778688, -550830, -823560, + 1868311, -3022583, -4583804, 3943317, -1918240, 861141, -2535105, 3184718, -718333, 174483, + -2769180, -2338073, 521839, 2350958, -1635846, 2744484, 1675037, 5548561, -6616934, -333934, + 4175782, 731218, -430570, 1562294, 3779034, 1631551, -593242, 1105954, -502511, 144955, + -299574, -331249, -1112933, -2730526, -83752, 817654, 177704, 1916629, -2258616, 308701, + 2816962, -665720, 52613, -1368484, 500364, -727460, 1241246, 1563905, -734439, 154619, + 1051730, 1825898, -963683, 1328219, 668941, -236223, + }, + { + 2034204, -19025094, -10309532, -7266011, 2719788, 359167, -3712462, -1292785, -414464, 3876208, + -649077, -3802120, -545461, -1889786, 30527554, -6555731, 4393215, -23632520, 4425427, -4236985, + -13437342, -6803765, -1409823, -2852932, -396748, -13429289, 5510443, 10292889, 568546, -1433445, + 6661495, 2873870, -5512054, 4770635, 2376728, -4092030, 4205310, -7223598, 6556268, 7274064, + -122943, -7051800, -138513, 1308354, -2213519, 3547106, 7571491, 1129040, 2914135, 2966212, + -4570382, 3701188, -1722819, 4362613, 102542, -642098, 1965484, 1413044, 1275068, 2064806, + 1184337, 471373, 211527, 2481417, 624918, 371515, -1182190, -4258997, 872415, -2330557, + 1335198, -799938, -2335925, -391916, -677531, -764504, -1091459, -1251446, 868657, 2333778, + -811212, -1496259, -199716, -834834, 670552, -941135, 762894, 732829, -357019, 502511, + 79994, 907312, 1969243, -103616, -4295, -274341, + }, + { + 10661183, 49352396, -2836826, 44430364, 5128191, -1362042, -417686, -1566053, 6930467, -3789772, + -1654636, -5631239, -7717520, 10700911, 1761474, -15520401, 1222455, 13699872, -198642, -8287140, + -5394479, 5559835, 4888747, 4757750, 3093987, -2247342, 1312113, -8553427, 2513093, 4686346, + 3483755, 4778151, 269509, 1330366, 98247, 2661269, -337155, -8649527, 2441689, 7029788, + 1948305, 2532957, 966905, -3586298, -1902671, 5155572, 1379758, 1745367, 1255204, 55298, + 1243930, -5721434, -2738042, -3390877, 1088774, -1388348, 3114388, -205085, 450972, 590558, + 2955474, -2723009, 1299765, 2871186, -2602213, -766652, 2084670, 2689187, -368830, 343597, + -1103807, 2714956, -717796, -383863, -922881, 1144609, 220654, 2202781, 1432372, 67109, + -322123, -351114, -1313186, -1163399, -532576, 89121, -251256, 936303, 500901, -838592, + 2262374, 162135, 1002875, 858457, -452045, -469225, + }, + { + 58519, -1496259, 13545253, -1839857, -1397475, -1924682, 44560, 1773822, 246961, 2919504, + -6418829, -4237522, 1814087, -9456981, -4961761, -10382547, -14219563, 14048838, 5398237, 7668127, + 2675228, -15925739, -2644089, -14939507, 4326106, -1549410, 7281044, 9835475, -7240241, 8091719, + -8855686, -3712999, -7750806, -4043175, 4512400, -8071318, -2370285, 678068, 2903398, 2863133, + 2577517, -2213519, -4511327, 5458367, -3830574, -1899986, 6007586, 1320703, 1635846, -940598, + -1903207, -4651987, 2847027, 987843, 1002875, -2674154, 2456721, 2199023, -4106526, 233002, + 724776, 4177393, 505196, -2118493, -1345935, -1094143, 2072322, -1013612, 3229816, -1165547, + -781684, 1970853, -2126009, -217970, 2478733, -298500, 2895882, 867583, 1542430, 151398, + 3365107, 1278827, -1101659, 250719, 1410897, 560493, -267362, -505732, -1561221, 195421, + -2335389, -59056, -1228898, 692027, -689342, 1218160, + }, + { + -6482717, 103470592, -12831752, 13959181, -2494302, 4186519, -17912698, -11582990, -3798362, -12546673, + 18860812, 851477, -6660421, 10098542, -2267206, -3376918, 2100776, 7228430, 1717450, 4654134, + 267362, -5956583, 2477123, 5201206, -12931073, 4875862, -678605, 1200980, 2064806, -751082, + -4703526, -3277597, 4975183, -2582886, 2408940, 49929, 1436130, -5395016, 3581466, -496069, + -3911642, -4326106, -914291, 4825933, -6779606, -429497, -3663607, -1633161, -1242856, -1704028, + 517007, 3397319, -1748052, 5046050, 5218386, -1014149, 4475356, 529892, 1422708, 1770063, + 1746441, 157840, -911070, 901406, -718333, -2780991, -242129, -1270237, -1299765, -3025268, + 3071439, 1425392, -387084, 780610, 1257889, 728534, -432718, -2342368, -73014, 386547, + 1534377, -350040, 290984, -448824, -143881, -220654, -1651415, -822486, 881005, 2092186, + 1065152, -2649458, 471910, -260919, 1012002, -1239098, + }, + { + -142271, 21223580, -6332930, 5667210, 1903207, -1664837, 1933272, -177167, 279173, -435939, + 797790, -3534221, -9808095, -2352568, 17333414, 12769475, 16013249, 6484864, 2510409, 14542759, + 3110630, 368293, 6849399, -1037235, 6019397, 9819906, 7231651, 53150, 3311420, -5559835, + 4559108, 15551540, -4808753, -9354976, -2688113, -16522202, 2926483, 5808407, -1704028, 1857037, + 7737921, 6240588, -6062883, 2458332, -3823595, 3824669, -5173288, -2100239, 440234, 5546414, + 2352568, -549756, -5028333, 2678449, -2485176, -891743, -198642, -594853, 4495220, -1518808, + -98247, 1471026, -2584497, -3299072, -3258807, -5259188, -2459406, -403727, -1754494, 376347, + -1439888, -1782948, 3584150, -1599339, 1540820, 1056025, -228707, -1446867, 561567, -1297080, + -102542, 975494, -994822, -6979, 159451, 638876, -727997, 1958505, 1186485, -1026497, + -227096, 834297, -1166621, -177167, 308701, 729608, + }, + { + 12808129, -96911640, 137439, -3785477, -331249, -9513353, -10602664, 27614492, -6117107, -21078088, + -1169842, 149787, 5624797, 5138392, -1883343, 2735357, 2397129, -6292127, -11603928, -4532264, + 3206730, -4358318, 879395, 16087874, -6837588, 588947, -2331630, -548682, 8334384, -4618701, + 5843303, -1290101, -5507222, -1742146, 4350802, -1771137, -1196148, -2266132, 1725503, -974958, + 4296578, -692027, -1971390, 3710315, 1189169, -2997350, 993211, 654983, 5338108, 827318, + 2858838, -6413997, 1082869, 3251290, -397821, -6978248, 3562139, 3120294, -4522601, 3596498, + -7341173, 5083631, -681826, 2478733, -1186485, 7529078, 112743, -155156, -3342022, 425739, + 757525, 2611877, 1047435, 323196, -2363843, 977105, 232465, -408559, -210990, -143881, + 3453691, 159451, -273804, 1920387, 2168422, 2510409, 2102387, -794569, 556198, -1479079, + 378494, 1117765, -121333, 290984, 792421, -215822, + }, + { + -1029182, -36887328, 21726092, 2032056, -415538, 23702850, -10733123, 508954, 11304354, -1118839, + 4613869, 1564442, -20398410, -1712618, 9046275, 3474629, 4770635, 13164612, 6169721, 3023120, + -7298223, 1803349, 6561637, 7522635, 9719511, -4702989, -6119255, 970126, 3359738, -5191542, + -6944425, -75162, -2409477, -4878546, 11240466, -1305670, 6074158, -505732, -4693863, -5071820, + 1034013, -3280818, -4097936, 1213328, 1829119, -1545115, 2626373, -6697465, 2571075, 5520644, + 1096290, -2692945, 811212, 1100049, 911070, -4384088, 3082713, 193274, -1799054, 733366, + 368830, 5013838, 2200634, 2324651, 2589865, -1855963, -1947231, 3251290, -64961, -618475, + 637266, 731218, -427886, -1807644, -386010, -535260, -415001, 168041, -2194728, 2222646, + 818191, -241592, -21475, -1615982, -126165, -294742, -2039573, -1755568, 392990, 735513, + -1210644, 733903, -3249680, -72478, -420907, -187905, + }, + { + 20421496, -36117992, 27560806, -3325379, -18095234, 9335111, -17328046, -5388574, 79457, 24402394, + -12008729, 1707786, -8382703, 7281044, -9695352, 5719286, 9954660, -16107738, 359704, -7123204, + 13419625, -3359738, 10420128, 3733400, 831076, 3995393, 4505958, -3568044, -908922, 12539157, + -10594074, -1867774, 4648765, 1833414, -9443022, -1989107, -7711614, -594316, 866510, -5347235, + 3599720, 6929930, -838592, -1540820, -1279900, -3541738, -7155953, -307090, 6728603, 1012002, + 5786395, 683437, -8910983, 3821447, -1158567, 6979, 447213, 3446711, -1728188, 1390496, + 1059246, -649614, -5133560, 467615, 3812857, 381715, -6176163, -1132261, 1982664, 2995203, + 1504849, -1530082, 315143, 991064, -2201708, -900869, -201327, -748935, -1942936, 1347546, + -1442572, -164819, 2703682, -2183991, 503048, 2812130, -2597918, -1769527, 1063004, 203474, + 921807, -397284, 414464, -1823751, -1395328, 193274, + }, + { + 1894081, -27148488, 10708964, -6549825, -2856690, -187368, -9230958, -1266479, 709207, 7682623, + 4284230, -1570884, -8945880, 14079440, -11211475, 6474663, -5543192, -8912057, -5499706, 10568841, + 1331440, 461709, -6710350, 10302553, 6502581, 9275519, 5895380, -7142531, 9873593, 6207302, + -6998649, 5859946, -806380, 2811056, 688805, 3929358, 3830037, 5124433, -9729712, -482647, + 591632, 724239, 913754, 2502892, 1222992, -3112241, -3947612, 1639604, -7498476, -2489471, + -897648, -46171, 1174137, 1086627, 3289945, 823560, 2057826, -1592896, -998580, -1449015, + -287226, -877784, -2976949, 786516, -264677, -4033511, 1318018, 1323924, 1788854, -3071975, + -227633, 207232, 928787, -2237141, 564251, 1286880, 130460, -247497, 500901, 2083596, + 63888, -1192390, 1683627, 374199, -2982318, -1296006, -138513, -1642825, -45634, 43487, + -2223719, 549756, -549756, 720481, 1236414, -1395864, + }, + { + 15196668, 7199439, -19578072, -4466229, 1941862, 7711614, -9517648, 1324461, -13415330, 6562710, + -1062468, 5977521, 12163884, -5436355, 13100187, -5552319, -9740986, -7044820, -2610803, -2175938, + -7186017, -6946573, -710280, 7924215, -2214056, -4765803, 6818261, 5978058, 8701604, 7890392, + 284005, -6492917, -7930657, 6290517, 12663174, -11487964, -5894843, 5110474, 2586644, -2884608, + 6096706, 1626182, 2455648, 770410, 4663261, 1045825, -5041218, -8486855, 4545686, 731218, + -521839, -9370545, 2805688, 1826972, 3092377, 4581120, -3371013, 2706903, -3775276, 3118146, + -730144, -457414, 392990, -403190, 856846, -2455648, -2101850, -1999844, 1509144, -1540820, + -2299955, -2622615, 657667, 2021856, -1173063, -1472100, -650688, 68719, -835908, -594316, + 480499, -1982664, -1252520, -98247, 2308545, 1624571, -846109, 653372, -253940, 1221381, + -1186485, -336618, -1167694, -661425, 126702, 585726, + }, + { + -3483219, 12208445, -6128382, -11111080, 8310762, -1604707, -2711735, 1655710, -2769180, 3579318, + -6337761, 712965, 296890, 12571906, -50443856, 13675176, -6359773, 8789651, -21750252, -22841172, + -8391829, -10327786, -2711735, 6979, 3234647, 3289945, -12995497, 7042673, 5153961, 11940546, + -5722507, 8650064, 5320928, 3964792, -4063039, -7634305, 14930917, 4468914, -3971234, -616328, + -5555004, -1529008, 857920, -1693828, 1750199, 1989644, 80531, 9249749, 98247, -1715839, + -9074192, -3594888, 3003793, 1537598, -362925, -3933653, 1842541, 775778, 810675, 2552821, + -620623, -4918812, 855235, 5094368, -110059, 2127083, -2543158, 352187, -2574833, 898722, + 1752884, -458488, 3052111, 759672, -1817308, -1412507, -207232, 960462, -337692, -920197, + 874563, -2242510, -1848983, 122407, -371515, 30602, -1973538, 2484639, -801011, 122407, + -307627, -424665, -114890, 1715839, -1278290, -615254, + }, + }, + { + { + 8476118, 194603360, 18064096, 67243080, 9599789, 8686571, 561030, 3219615, -7808788, 6730751, + -6866042, 16627429, 5761699, 5461051, -2617246, 3245385, 6285148, 4706748, -4914517, -4014721, + 4510253, 1301912, 9800042, -209917, 9234717, -6313602, 3430605, 8946417, 7012071, -11133629, + -8965207, -1865090, -5369246, 6415071, -2419677, 2234457, -9662066, -1611687, -1372242, -2342368, + 7231651, 6444062, 2768643, -4987531, -4657355, 5884105, 840740, 631897, 2797098, 488553, + 653372, 200253, 1566589, -2318209, 3256659, 2872796, 1573032, 2400887, 665720, 629213, + -6664179, 1989644, -426276, 452582, -687195, -1602560, 1177358, -820339, -746787, -1495722, + -3209414, -2847027, -1347546, -1121523, -2116882, 432181, -3304977, 285078, -432181, 185757, + -818728, 474594, -303869, 651761, -463320, 886374, 142808, 112206, 56371, -66035, + -138513, -122943, 736587, -19864, -423591, 946503, + }, + { + 1418950, 33784748, -10628433, -22093312, 20374252, 1516124, -3325379, 5361193, -491774, -3902515, + -285078, 1960116, 4491999, 3833258, 315143, 2838437, 12889734, -4117263, -3748433, -239981, + 4476430, -6922951, 6176163, 15568183, 4237522, 590021, -8464307, -3612068, 1647120, 788127, + 7592966, 4512400, -4405026, 2394444, 11387032, -889058, -5878200, -1733556, -3585761, 3241627, + 209917, -1617055, -4226785, -2391223, -1636919, -4677757, 7910793, -2108829, 1146219, -5993627, + -470299, -574989, -727460, -5367636, 4481262, -3586298, -1876901, 119185, -1341640, -5559835, + -748935, 887448, 745177, -1146219, -111669, 4881231, -2967823, 1739462, 3105261, -1520418, + -2306934, -2553358, 1661616, -275415, -2564096, -413391, 963683, -2918967, -343597, 455803, + -823560, -421981, 340913, -595927, 801548, -798864, 551366, 3186329, -788663, -1239635, + -1003949, 117575, -121870, -1076963, -696858, -435939, + }, + { + -5030481, -80250392, 15880642, 2712809, -17063368, 410169, 3005940, -1869385, 5893232, -798864, + -1931125, 32806570, -12492986, -9113384, 3787088, -15680926, 11302743, -1240709, 13240847, -3073049, + 279710, -1435593, -1699733, -7357816, -1051730, 5757941, 1791001, 5860483, 2588792, -1433445, + -1716913, 3413962, -1861868, -5002563, -2209224, 9410273, -8631274, -605590, -8062728, 2371359, + 3674882, -2387465, -956704, 2862596, -3015604, -1280437, 5472325, -454730, 3710315, 3614215, + 1680943, -2446521, 4989679, -4421132, -17180, -4066260, 2768107, -306016, 3034395, 569620, + 3316789, 1586990, -2016487, 2113124, 5271536, -762894, -3082713, 2299418, 924492, 693637, + -1427003, -1168231, -994822, 2371359, 163746, 2051384, -2241436, -741419, -451508, -570157, + -1336272, 1526861, 336618, 1382980, 1535988, -253403, 453119, -1519882, 833761, -2239289, + 472983, -471373, 34897, 190052, 796180, 1101122, + }, + { + -10524280, 24904368, -8654359, 53585624, 4032438, -2851858, 1184874, 2516314, 7224135, 505196, + -14880988, -10585484, 7522099, -2057826, -6056978, 13614509, 12313134, 1621350, 12329240, 8151848, + 3372623, 4846871, 2159832, 1865090, 9361418, -3243774, -2453500, -12987444, -813896, 325881, + -1777580, 2710124, 693100, -1247688, 8360154, 5111548, 1940252, 1769527, 8311299, 4981089, + 5222680, 777926, -3839164, 1144609, -1657857, 343597, -7454990, -1698660, -2536715, 650151, + -2359011, -194884, 132070, 3561602, -229781, 1926830, 876173, 3486977, -6928856, -1015760, + 508954, -1070521, -3273302, -1894618, 681826, 2540473, -2713883, 33286, 134218, -64425, + -1451162, 713501, 533650, -2661806, 742493, 261456, -1504312, 1915555, -996969, 1054415, + 180926, -2289218, 957241, -1373316, -104690, -1460826, -364535, 459562, -824097, -948114, + 43487, 1709934, -1385127, -1213865, -1395328, -741956, + }, + { + -1954747, -3105261, 8837432, -8919573, 1020592, 1003949, -1895691, 2419677, -359167, 2240362, + 2112587, 5065377, 940061, -6100464, 45679124, -2369748, 341450, -31918586, -8032126, -536334, + -4545149, -1347009, 1376000, 2252710, 4238059, -6550362, 14773614, 9419400, 7092065, 11047193, + 7221451, -1886564, -4643934, 1496259, -5077188, -9548786, 4249334, -7161858, 3370476, -649614, + -3295314, -6529424, 153008, 1967095, -5140002, -782221, 5622112, -1528472, -2027761, -603443, + -2938295, 6755984, -1000727, 2405719, -692564, -308164, 428423, 3875134, 4961224, 2014877, + 477278, 1504849, -750009, -1202591, -2484102, 387621, -1313186, -4393752, 475668, -1796907, + 3483755, 2820720, -1277216, -839666, 241592, 293668, 699543, -1371705, -1512365, -543850, + -1697586, -1431835, 319438, -89657, 1564979, -1161252, 290447, 955093, -358630, 600759, + 745177, 231391, 464393, -223338, 937377, -446677, + }, + { + -22309134, 10002442, 8775155, 47809964, -1345399, 216359, 10704132, 8706972, 17191144, -5887864, + -2855080, -566936, -9655086, 364535, 3076807, -4218195, 2539400, 9695352, -2370285, -7415798, + -4006668, 372052, -3303367, -1586454, 1837709, 3253438, 1772211, -6190122, 10351408, 7252589, + 2530273, 4753992, 77309, -837519, -4138738, 938450, 6691022, -3998078, -966905, 946503, + -4034048, -819265, 2397666, 105227, 2818572, 8676908, 352187, 2887829, 4382478, -2552284, + 33823, -326418, 282931, -4569845, -1095217, -285078, 4110821, 580357, -493384, 277562, + 1557463, -4115653, -904628, -226560, -1704028, -1490354, -3127810, -296353, -1685775, -194347, + -1442035, 1537061, -278636, 1098438, -179315, 1206349, -1530082, 366683, 1091995, 619549, + 565325, 925029, 66572, -413927, -1154273, -263067, -549219, 140660, 1054415, -73551, + 1108102, -772557, 752156, 354335, -493384, -505732, + }, + { + -357019, -17834852, 2681670, -184147, 442382, -3127273, 1037235, 5417565, 4081830, 2157147, + -6560026, 2084133, 6187974, -662499, 5850819, -7697655, -16232292, 4032974, -6474127, -1242856, + 6056441, -14778982, -9631464, -8848706, 20140176, 2799782, 1775969, 8270497, -280784, 8185134, + -8087424, 2470680, 1184337, 2943126, 7365869, -624381, -1198296, 1971390, 4552666, 1592359, + -2600603, -2520072, -4698158, 4784057, -1966558, -1772211, 907312, 1536525, 2534568, 1039919, + 4416300, -4612795, 1991254, 4855461, 3788698, -2409477, -692564, 2336999, -2224793, 1143535, + 1431835, 3976603, 1435593, 2050847, 2422362, 386010, 1621887, -1242319, 4673998, -397821, + -472983, -129386, -4243428, -1950452, 604517, -1622424, 1068910, -1223529, 482647, 13422, + 1144609, -494995, -1120450, 386547, -326418, -204011, -66035, 633508, 387084, 545998, + -1552094, 1490354, -1464047, 751619, -564251, 460098, + }, + { + -11401528, 101722008, 5282273, -809601, -19916300, 9881109, -11502996, -8265128, 985695, -7133404, + 28235116, 8227547, -4060355, 11402064, -1175747, 7478075, 8450885, 7001334, 2092186, 1930051, + -2968896, -14352170, -1919314, 11909407, -3956739, 7511898, 2520609, 1648194, 1365263, 2133525, + -3634616, -4418448, -337692, -3426310, 6491843, -3939559, 2527588, -5263483, 2852932, 2768643, + 1028108, 999654, -1095217, 1954747, -5522791, 370978, -802622, 265214, -6846715, -1310502, + 2619393, 4028143, -3928285, -691490, 3257196, -2010045, 2578054, -883690, 305480, 3352759, + 5903970, 2308545, -3766150, 1407139, 1652489, -2309082, -1619740, -1450625, -829466, -3188476, + 472983, -275952, -571768, -1432909, 33286, 2100239, 635118, -3408057, 148713, 782221, + 828392, -529355, 1582159, 639413, -768262, -1650341, -2110977, 365609, 1708323, 288837, + -154619, -1167694, 2256469, 1144072, 1298154, -1646583, + }, + { + -1877975, 8194798, -10692321, 6910603, 152471, -2831994, 2433099, 3773129, 4540854, -3111704, + 5309654, 2062121, -7677254, -11201275, -6204617, -6395743, -2072859, 4185446, 7074885, 5781563, + -234613, 7313793, -214212, -8319352, 4956929, -4559108, -4468914, -1724966, 697932, -17217450, + 4621922, 2341831, -17166448, -321586, 10298258, -8907762, 3178276, 3001645, 1970316, 2216203, + 750009, 1560147, -9856413, 1154809, -3942780, 1806034, -4595078, -1287417, 649077, 4985920, + 2894808, 1764695, -4358855, 3254512, -1610613, 2569464, 3005403, -1054951, 2625836, -2655901, + 2240362, 829466, -2695092, -978716, 696322, -1441498, -862752, 819265, -2630668, 299574, + 263604, -981937, 3471407, -1609539, 3467112, 3011309, 1397475, 820876, 1613297, 603980, + 220117, 375273, -635655, -672162, -41876, 229244, -2328946, 606664, 622770, -838056, + -235686, 181999, -292058, 1245541, 1516660, 489089, + }, + { + -11956652, -121959352, 11861089, -1336809, -18861886, 3637301, 22212498, 38017976, -7088307, -35902704, + 2492692, 7970923, 3224984, 10474888, -3735011, -1093069, -2267743, -9335648, -8858370, -848793, + 6797860, 3212636, 5525476, 14457934, -7743826, -9620727, -6358699, -8865349, -382252, -8270497, + 2211908, -5026723, -4581657, -6959458, -1566053, -6791954, -1568200, -3293166, -86436, -2146410, + -3127810, -7109782, -3936875, 3666828, 3605088, -2436857, 2064269, 2034741, 1613834, -7657390, + 1100049, -4447439, 533113, -623307, 1326608, -405338, 6811282, 390305, -4045322, 7815767, + -5117991, 1771137, -1916629, -39728, -2313377, 8292508, 1503239, 2905546, -1576790, 2481417, + 2058900, 3278134, 1560147, -2515240, -5008469, -379031, -23622, -1261647, -1468342, -1517197, + 2160369, 1719061, -997506, -2224793, -76236, 418759, 137976, 81068, -433255, -2582886, + 282931, -65498, -360240, 244276, 765578, -924492, + }, + { + 847719, -46340548, 8791261, 1652489, -6819335, 12008192, -18903762, 3096135, 10448045, -5999533, + 2470680, 11982422, -10452877, -9270687, 4012036, -1240172, -2056216, 10746545, 3693135, 12097849, + 5053029, 3010235, -561567, -3412352, 4312147, -2695629, 359167, 11551315, 5987185, -4973036, + 4680441, -1794760, 2258616, 2078764, 11352135, -4016868, 1818919, 3713536, 4895726, 1529545, + 4435628, 3058017, 749472, -2958159, -3849901, -6561637, 1877975, -2350421, 4978404, -1590212, + -5056787, -4239670, 1273458, 27917, 301185, -512175, 3902515, -3084860, -1959579, 147640, + -2681670, 421444, -809601, -352724, -936840, -2684355, -3277060, 617402, -2989297, -1595044, + 3275450, 1296543, -588947, -1517734, -2451890, -696858, 3038689, 2298881, -2429878, 1848983, + -519691, -1886564, 149250, -235686, 274878, 346282, 489626, 861141, 2503429, 1842004, + -911070, 1141924, -2465311, 750009, -641561, 263067, + }, + { + -12399571, -78685408, 33871724, 960999, -14150307, 39568996, 4675609, -1727651, 288837, 13629542, + -4085051, 11996917, 3623342, 11388106, -13812078, 8150238, 11549704, -16408923, 13217762, -5237713, + 9005473, -4906464, 5117991, -4173635, -10814728, 3826816, 8817031, 3109020, 248571, 9196062, + -6580427, -4503810, 1203665, 5143224, -5873368, 448824, 579284, 4450660, -5479842, -7814693, + 2563022, -652835, -5051956, -1239635, 1857037, -1247151, -5264020, -4749160, 630286, -1459215, + 5305895, 2434173, -9790378, 2917357, 1913945, 4048007, 476205, 2121177, -439697, 990527, + 3745212, 4370129, -1037235, 1140851, 2085207, 851477, -1210107, 2183454, 2092186, 773631, + 1052267, -3319473, -2026688, 1043677, -1352915, -738198, 1818919, 2027225, -1527935, 1228898, + -466541, 1249299, 3347927, -1427540, 39192, 2052458, -1054415, 497142, 598611, -558883, + 1217623, -1188632, 423054, -504659, -1355599, -1526324, + }, + { + -1897302, -27089432, 12502113, -4090956, 4747013, 4247186, -10210748, -6327561, -4800700, 7215545, + 4252018, -7449621, -20556788, 412854, -19190450, 1096290, -3848291, -8880382, -18999324, 10204842, + 10267656, 3163244, -28395640, 3305514, 10238665, 13154948, 12004434, -9179956, 9104794, 5740761, + -7386270, 5624797, -9380209, -2270964, -2142115, 6208375, 6762426, 3264175, -4509716, 243203, + 441308, -2838974, -3474092, -2205466, -1449015, -3753802, -5031018, 594853, -6649146, 433255, + -337692, -2430952, -5852430, -3451006, 2327336, -2029372, -340913, 3083250, 1380295, -591632, + 2906619, 3658775, -707596, 1511292, 3119757, -3553549, -2245194, -278099, -2636573, -3983045, + 2698850, 774705, 2569464, -1524177, -1138703, -1194001, -2257542, -175557, 115427, -1189169, + 1150514, 59593, 284542, -2136746, -3849901, -2345589, -1745904, -2653216, -951872, -608275, + -2575370, -345745, -368293, 1920387, 879395, -1298691, + }, + { + -18613314, -27649926, 1033477, 13717052, 11893838, 17867600, 2510409, 8087424, -7928510, 8708583, + 9764071, 1613834, 7098507, 11096048, 44883480, 12585865, -2103997, 4563403, 13369159, 6842957, + 10786273, -1651415, -12841415, -3620121, -2256469, -1440962, -526670, -7000260, -1491964, 10104447, + -5094368, -13732084, -1695438, 9018894, 12818867, -8293045, -3109556, 1248225, 5164162, 1442035, + 3641059, -6194417, -5480915, -2330020, 6240051, 1992328, 275952, -3825205, 5275294, -4320737, + 1989107, -5976984, -2101313, 935766, 1268089, 4824859, -4766340, -2061584, -4085051, 2353642, + -1496259, 945967, 2450816, 3068754, 3651259, 989453, 1921998, 542777, 2470143, -1078037, + -2035815, -4959614, -281857, 2227478, -1163399, -1320166, -1418950, -37581, 834834, 1678795, + 1610076, -1272921, -406411, -2764348, 253940, 709207, -1407676, -492848, -497142, 1776506, + -1612760, 186294, 179315, 346819, 840740, 877784, + }, + { + 4708895, 23797340, -3089692, -12123619, 9571871, 7803956, 835371, -2913062, -3909494, 6273337, + -7321846, 5497558, 5768141, 13948443, -42402600, 1592359, -18298172, 8404714, -430034, 1526861, + 9905805, 1655710, -497679, 748398, -1105417, 7897908, 1647657, 11628624, -7631620, -6527814, + -14144938, 3274376, 5462662, 1523640, -1731409, -4299263, 5421860, -3176665, -7710003, -3070902, + -12941273, -6821482, 194347, 670015, 467615, -2653753, 1778653, 4052302, -5192616, -213138, + -7547332, 795106, 2771865, 935766, 1959042, -4435091, -193274, -1225139, -2078227, -2214056, + -1478006, -1963337, 1333587, 5184563, -1960116, -1549946, -758599, 802085, -5310727, 117575, + 1632088, -783832, 510027, 158377, -1215476, -2365990, -1492501, 405338, -812286, -946503, + 1698123, 1130650, 930397, -287226, -1416802, 1758789, -271120, 2303713, -2107755, -1181653, + -45097, -291521, -927176, 932008, -921807, -1013075, + }, + }, + { + { + -12286828, 243094608, 22276384, 71637368, -2269353, 5711233, 8790724, -2702608, -12295954, 11641509, + 4535486, 15149960, 3449396, 2161979, 2353642, 280784, 11001559, -3729642, 8767639, -6497749, + 470836, 381715, 11356967, -3487514, 3923453, -7051800, 5061082, 7869454, 8254391, -13240310, + -4872104, -878321, -4052839, 4874788, 1236414, -3131568, -6145562, -5062693, 3203509, -5520644, + 4285304, 13052942, -2410014, -9096741, -1815697, 4184909, -1340567, 1071058, 6789807, -2698850, + 1217623, 3685619, -4250407, -3659849, 4983236, 926102, 2627983, 2636036, 47245, 379568, + -3350075, -1331977, 228707, 2250563, -603443, 791885, -2884071, 1387274, -1736241, 679142, + -3966939, -3667365, -1150514, -1451162, -2030446, -352724, -1968169, -353261, 657130, -2133525, + 1282048, -909459, 794032, -163746, -590021, 631360, -518080, 861141, 850404, -180389, + -925565, -208843, 988916, 289373, 683437, -540092, + }, + { + -1225139, 8748312, 11252814, 9914395, -9714142, 4459250, -1871532, 6366752, -2358474, -6927782, + -13539884, 21649320, -5298916, 5288716, 5472862, -989990, 11865921, 1138166, -417686, -7522099, + 9078487, -13966697, 11605539, 16601122, 1031866, 9067213, -13356811, -7631620, -4869419, 14993731, + 1952600, 9185861, -10131828, 834834, 11834782, -3926137, -4147328, -4177393, -2046015, 7885560, + -1202591, -2110440, -1460826, -5311264, 1916629, -1799054, -786516, 1866163, 1418950, -4471598, + -1249299, -3615826, -1716913, -3240553, 3482145, -5290863, -1424319, -984621, 1599875, -3405372, + -3320010, 804770, 548145, 382789, 2350421, -320512, 2333778, 376883, 2886755, -2262911, + -1719598, -1110249, 222801, -996432, -1939178, -1460289, 885837, -468151, -1744831, 300111, + -745714, -197032, 727460, -1740536, 875636, -1140314, 1378685, 2019708, 93416, -1008244, + -322123, -137439, -709207, -517007, -1001264, -743029, + }, + { + 5963562, -52277804, -17857400, -31862752, 7567733, 1285269, -31139, 1263794, 7606387, -5446556, + 11997991, 18823768, -17133698, 8206072, -13333189, 165356, 3120294, -5074504, 2674154, -1144072, + 9087077, 4439386, -6288369, -1338419, -1961726, 1721208, -107911, 7425462, -1271847, 4214974, + 1465121, -7973070, 640487, -7912404, 6961605, 3668439, -8667244, 786516, -4940286, -26307, + 7227356, -5684926, -38118, 3079492, -537408, -4453881, 6477348, 6236293, 4335770, -520765, + 6005975, -71404, -2889439, 324270, 747324, -1283658, -184684, -2981244, 1769527, 3512210, + 92879, -601295, -692027, 1534914, 2521683, 3078418, -2666101, -1107565, 3538516, -226023, + -645856, -1300838, -909459, 2437931, 2563022, -333397, -1490891, -1074816, 374199, -321049, + -1875827, 1475858, 624918, 74088, 277025, 1516124, -819802, -695785, -1387274, -1499481, + -406948, 322659, -559956, 516470, 947040, 1299228, + }, + { + 14835891, -23852100, 6388227, 59194312, -2726231, -5168993, -3782256, 5514201, -1133335, 12024298, + -18859202, -9157407, 5613523, -1935957, -322659, 13562433, 16943110, 8137890, 8100309, 4488778, + 3184718, 11653320, 2565706, 3991635, 1655173, 6965900, -10446434, 1061394, -626528, -11804718, + 5861557, 3222836, 877784, -70867, 7000797, 2239289, 3384971, 3325379, 6599754, 10528039, + 4368519, -643171, -1712081, -7385197, 2364380, -3597572, -6128382, 990527, -1780801, -3765076, + -1569274, 1451162, -1061394, 1104344, 1339493, 4408247, 2136746, -2177012, -3593814, 2181844, + -3193308, -670015, -1976222, -3316252, -16106, 3719442, -1161252, -1646583, -1171989, 985158, + -1337882, 2056216, 586263, -1775969, -251256, -260919, -1402307, 287763, 472446, 1427003, + -899259, -2091649, -1194538, 792958, -625992, -859530, -504122, -150861, 220654, -1129576, + 241592, 1319629, -23085, -2592550, -1882269, -987306, + }, + { + 1956358, 9238475, 176094, -5532992, -1894081, -362925, -693637, 4300336, -528818, -1040993, + -1955821, 11254962, -1004486, 5469641, 50214072, -15700253, -17136920, -6129455, -13700946, -5395016, + 6746857, -8076686, -4426501, 6299644, 8489540, 1349157, 8142185, 6112276, 8506720, 6394670, + 7384123, -5441187, 6203544, -5747203, -7004555, 2199023, -4627291, 271120, -1649268, -1268626, + -1450625, -3549791, 1465121, 234076, -9023189, 2121714, 4684199, -2277943, -940598, -2559801, + 696322, 1154809, -1093069, 2821257, -736587, 3097745, 1960653, 2510409, 5115843, -872952, + 4687957, 898185, -2882460, -717796, -1405528, -1387274, -1253594, -2646774, 591095, -606127, + 663572, 5068599, -894427, -2079301, 1678795, 1699733, -723165, -413927, 729608, -3349538, + 51540, -1774895, -626528, -96637, 660888, -675384, 1445793, -338229, -171262, 864899, + 660888, -64961, -42950, -687195, 1126892, 904091, + }, + { + 26694832, -73495480, 9372692, 55951076, -796180, 1387274, 11327976, 12079596, 15538655, 1687922, + -6221260, -10446971, 12444131, -19675782, 2758980, -106300, -8577050, 9609452, -4022237, 117038, + 1678795, -4784594, -5235029, -4235375, 4166655, 1146219, 1161789, 1200443, 8238821, 5854578, + -3019362, 2109366, 5543192, -3243237, -900333, -1274532, 2450279, -1607392, -3345243, 1062468, + 1039382, -2785286, -3343095, 5361730, 2759517, 5625334, 3468186, 2885681, 3446711, -4040491, + 1288490, 2493766, -872952, -2740726, -3544959, 1806571, 1109175, 2199023, -1046898, -1082332, + 1115081, -2055142, -4110821, 399969, 613643, -2365990, -5262946, -1014686, -669478, 1081795, + -2702071, 2365453, 842350, -980326, -259309, 84289, 885300, -1024887, -6979, -16106, + 1787243, 817654, 1662152, -981937, -1056562, -981400, 124017, 59056, 252329, 1571958, + -138513, -350577, 647466, -355409, 518617, -599148, + }, + { + -431107, -15459735, -4312684, 965831, -216359, -1633698, 155693, 4610111, 3782793, 2490007, + -6444062, -386010, 8353712, -10695542, 23883240, -13880261, 3295851, -10094247, -6626061, -5619428, + 312996, 577673, -5921150, -3723200, 9306657, 541166, 2458869, 889058, 10692321, 5265630, + -1542967, 1689533, 1302449, 11526082, -4207994, 8588324, -4138201, 9684614, -6548215, 6022081, + -6227166, -3907347, 2596308, 4503810, -3674882, 401043, -3950296, 2682744, 4282620, 2700461, + 2405182, 1256815, -2002529, 3218541, 3074123, -396211, 350577, -1889249, 198642, 3699041, + 383326, 2571612, 1420024, 2165201, 336618, 2778844, 1018444, -37581, 1474248, 911607, + 912144, -2841658, -1859184, -1525250, -2443837, -335007, 1088774, -2003602, -330712, 1777580, + -166430, -2356863, 16643, 1656784, -2070711, 557809, 743029, -739808, 254477, 255014, + 639413, 184684, -820339, 208843, -729608, -489089, + }, + { + 32830730, 54412404, -15163919, -10379325, 10639171, 3928821, -10354092, -7808251, 3264712, 6865505, + 7832947, 19141596, 7012071, -1882806, -1378685, 14698452, 5178657, 12106976, 2547989, 365072, + -6733972, -14541686, 251792, -3052648, 16437377, -226023, 6383932, -141197, -7569880, 10104984, + 453656, -5441187, 2432562, -7533910, 9171903, -11704323, 4927938, -4387309, -832687, 6240051, + 2553895, 561567, 2850785, -4114579, 6773701, -4624606, -1845762, 3917010, -10782515, -538482, + 3221226, -55298, -881005, -1931662, 1377074, -304943, 1335198, -905701, 2024003, 3547643, + 3814468, 1823214, -3570729, 1692754, 806380, -2266669, 873489, -3115999, -2554969, -153545, + -340376, -1073205, -532576, -1457605, 167504, -926639, 2492692, -2712809, 551366, 1272384, + -1472100, 1515050, 979253, -489626, 78920, -1379221, -2270427, 1165010, 2017561, -922881, + -993748, 1097901, 1574106, 1163399, -719407, 983011, + }, + { + 268435, -9968619, -71941, -411243, 1979980, 357019, 1975148, 1201517, 5258114, 3933653, + -54761, -114354, -3645890, 4680978, -23212150, -5748814, -12399034, 14256070, 14768782, -8115341, + -4867809, 11835319, 1705639, -11833172, 10728828, -7803956, -3863860, -9466645, 11057930, -24232742, + 210453, -6657200, -6973417, 5808407, -890669, 2783676, 1934346, -8596914, 11468100, -2202245, + 4613869, -3296924, -8390755, 1986959, 2283312, -3313567, -3200825, -4667556, 5775121, 1956358, + 1656247, 1423245, -2073396, 2612414, -1229971, 4387846, 1142461, -1028645, 2542084, -1853815, + 1493575, -1540820, 890669, -1606855, -352724, 2367064, -2048699, 2006824, -2404645, 533113, + -308164, -1105417, 2195265, 636729, 741956, 2621004, 1278827, 1736241, 1224603, 739271, + 1496796, -1529545, 807454, -167504, -937914, -1137093, -675384, -60666, -545998, 375810, + -856309, -1127429, 1228898, 379568, 809064, 1307818, + }, + { + 10399190, -119824752, -15640123, -17009144, -3307125, 17260400, 20033874, 12022150, -15301895, -10618770, + -4661114, 18826452, -183073, -12275017, 18910204, -3531537, -8630737, -5228049, -9012452, -3733400, + 4090420, 7155416, 10303090, 1088237, 1214402, -16286516, -2341294, -6925098, -6630356, -6851547, + 5699959, -9545565, -11093364, -1669132, -3987340, -4697084, 886374, -4307316, -365072, -3155190, + -5341329, -6461779, 687732, 1358283, 7124814, -5443334, 1607928, -141734, 1482838, -3639448, + -467615, -3478924, -25770, -6679748, 4893579, 4049617, 4438849, -2178085, 84289, 1861332, + 2551748, -2322504, 309238, -3872450, 4720169, 702764, 841277, 4480725, -790811, 4155381, + 1706713, 293132, 2853469, -4974109, -2345589, -1808181, -592706, 141197, -1460289, 96100, + 783832, 1442572, -793495, -3614215, -340913, 797790, -1256815, -169114, -123480, -2350958, + 504659, -773094, -1067299, 750009, 545998, -1774358, + }, + { + 381715, -41173704, 602369, 1157494, -9052717, 583579, -2975876, 2668785, 4269198, -19327, + -9525164, 7721815, 15067282, -14302241, -1246614, 2238215, -12611098, 11536282, 9257265, 10823318, + -1552631, 3326452, -2206003, -1931662, 8135742, 927713, 3208878, 1173063, 12447352, -7706782, + 7699266, -5347771, 455803, 4340065, 5095442, -4764730, 4228396, 4410932, 6642704, 795106, + 1358820, 7656316, 2413772, -4286378, -4849018, -6391985, 2079838, 4235912, -2433636, -4166655, + 857383, -6599218, 937377, -865436, 633508, 4156992, 1669669, -2660195, -2093260, -699543, + -1589138, -1745904, -535260, -1341104, 1313723, -1201517, -3598109, -426276, -4327180, 456340, + 1445257, 862752, -1525250, 1277753, -3204046, 113817, 2226941, 3278671, -1392643, -14496, + 207232, -1577864, -772557, 170188, -486942, 502511, 2064269, 1977833, 1628866, 636729, + -664646, 349503, 143881, -580357, -369367, 590558, + }, + { + -5402532, -83963928, 29687350, 10274099, -1751273, 24533390, -9398462, 7947837, 5985037, -14525043, + 17785460, 2549600, 16422881, 1872606, 5368709, -13511430, 708670, -1655173, 13293998, -1828582, + 8778913, -4029216, -3502546, -84826, -9370008, 1910187, 4269198, 2471754, 1307281, 49392, + 2669859, -3311420, 1644973, 1997697, -5518496, 462783, -2102923, 3478387, -2565706, -5082557, + -1147293, -2097555, -817654, -6602439, 2703682, 317828, -1067836, -3888019, 96637, -251792, + -237834, 3182571, -4764730, -1003412, 5522254, -492848, 554051, 3095061, 537945, 766115, + 4248260, 3469797, 711891, -22012, 2453500, -938987, 5148055, -259846, 3296388, 16106, + -406948, -2134062, -1763621, -1283658, -970126, 1471563, 390305, 3885335, -313533, 232465, + -948651, 1374926, 14496, 1788317, -47245, -158914, 730681, 1804423, -621160, -396211, + 75699, 718333, -1397475, -355945, -1267552, -454193, + }, + { + 2254858, -9759776, -12107513, 53687, 8423505, 3029563, -15261093, 2015950, -4544076, 2966749, + 1226750, -5387500, 1926830, -29800094, -15705085, 13205951, -18249316, 214212, -26754962, 18060338, + -2302103, 10747619, -31875636, 5159867, 5844377, 12887586, 6287296, 1350767, 9002251, -5619965, + 2694018, -7885023, 6908455, -9497783, 7056095, 1996086, 5883569, -2275259, 4098473, -7074348, + 4624069, -6992744, 3581466, -6339372, -4591857, -3519726, -2143726, -2784213, -649077, 1935957, + -1592896, -1858647, -9103720, -1576253, 1694365, -518617, -1592359, 2664490, -851477, 5363878, + -170725, 4588636, 915902, -417149, 3059091, 62814, -5366562, -2674154, -2672007, -2590939, + 2274185, 2829847, 1194001, 252866, -2552284, -1185948, -3360275, 550830, -1683627, -498216, + 1544041, 1197222, -499290, -1167157, -2624762, -2007360, -1458678, -1694902, -3227668, -1180042, + -535260, -1057099, -392453, 731755, 1340030, -629213, + }, + { + 13605920, -71223976, 13483513, 21029234, 2124935, -7399155, 25887916, 3711926, -7108171, 15701864, + 10603737, -4537096, -1207423, 8856759, 48279192, 18666464, 1446330, 3859028, 9882183, -751619, + 7040525, 3256122, -5182415, -10670309, -4052839, 7363185, -6419903, -5516349, -1545651, 2136209, + -150324, -7874286, -131533, 6335077, 1575179, 542240, 932545, -1817308, 2700998, 4911832, + 1493575, -8537321, -8630200, -3368865, 2144263, -2244657, 7552163, 4778151, -3657165, -5757404, + 2925947, -1033477, -4274030, 884226, -1137093, 3266860, -334471, -4282620, -3347927, 1202054, + 2413235, -520228, 2993055, 5287642, 3633006, 1870458, 319975, 788663, 1621887, -678605, + -1911261, -2405182, -1130113, -1305133, 1008780, -1030255, -704375, -2377265, 1975685, 1913945, + 417149, 988916, -1438814, -3308736, 358630, -217970, -463320, -882616, 576599, 867047, + -663572, -664109, 956704, 618475, 73014, -142271, + }, + { + -5015985, 26367878, 12400107, -2582349, -11040750, 17599166, -267899, -2355790, -1393180, 3795677, + -4988068, 1913945, 9277129, -42544336, 51074676, -16134045, -9004936, -10297184, 11141682, 13266617, + -5645198, 11823508, -4527970, 3169686, 4654134, 2962454, 11386495, 1968169, -8261907, -20877836, + -3287798, -1405528, 7586523, -3700114, 11252814, -1162326, -2344515, -3658239, -8685498, -1364726, + -14185203, -9758166, 6709276, -1277753, 3015067, -9591736, 8705899, 4552129, -12679817, 1554241, + -2645163, 16106, -1416266, 1235340, -804233, -970663, -170188, -1999844, -517007, -1632625, + -2013266, 674310, 36507, 620086, -3339337, -564788, -656056, 744103, -3897146, 179315, + -1455457, 2258616, -673773, -2309619, -430034, -2156074, -1403381, -433255, -2029909, 3927211, + 179315, 1527935, 736050, -296353, -1825361, 2169495, 574989, -1573032, 297427, -1096290, + -1147293, -452045, 1055488, -1673964, 410169, -660888, + }, + }, + { + { + 13093208, 247990336, -14329622, 47121696, -12508555, -248034, 5756867, 7487202, -8693551, 23965380, + 15388868, 7457674, -6705518, -7152731, 6803765, 796716, 1611, -17305496, 3553549, 93952, + 3665755, 946503, 4393752, -5639829, 1272921, -8451959, -3954054, -1934883, 11125039, -7316477, + 1573569, 8552354, -1289564, -3158949, -2373506, -3847217, 1284732, 762894, 6447820, -2627983, + -4450660, -11274, -6177774, -9505836, -1268089, 984084, -5062693, -4278861, 5624260, 2428267, + 2508798, 1368484, -6164889, -4903242, 2815351, -3513283, 2408403, 2741263, -2690260, 1866700, + 861678, -3173981, -2500208, 203474, -760746, 2498060, -2843805, 1673427, -1289564, 2412161, + -2414845, -2655364, -54224, -1384590, -4501126, -970663, 881542, -154082, 478889, 425739, + 3117610, -1109175, -631360, -2090039, -1504849, -71941, 298500, 781684, 1205812, 1402307, + 197569, -349503, -698469, -17180, 634581, -943282, + }, + { + 632434, -25645250, -15093052, 22436910, -2009508, 1265405, -4132296, 221191, -8254927, -1738925, + -4194573, 20889648, -15071040, 1120450, 7966628, -9292162, 187905, -2259153, 2885681, -15147276, + 7221988, -1167157, 3820910, -8740258, -9352291, 11959873, -17853642, -5690295, -1604707, 19136764, + 1522566, 8120173, -8070781, -2401961, 4555350, -5006322, -3236258, 23085, -12348, 4205310, + 2477123, 6159520, 4001836, -3135863, 5352066, -1865090, -8369281, 1076963, 1758252, -882079, + 1269163, -3497714, -1728724, -2528662, -150861, -6257768, 3245922, 369367, 1370095, 303332, + -844498, 77309, -27380, 1686848, 2399813, -1729261, 5192616, 925029, 925565, -213675, + 1500554, -911070, 808528, 667867, 887985, -441308, -530428, -374736, -1884417, 690953, + -1824824, -903554, 901406, -2929168, 227633, 48855, 1081795, -156229, 79457, 688805, + -28991, -497142, -132607, 1285806, 447750, -788663, + }, + { + -6194954, -6754910, 25224342, -38967164, -41876, 1012002, 499827, -5455146, -2211908, -2696166, + 16600049, 16423955, -16568910, 5691369, -11766063, 10462003, 5990943, -4439923, -1610076, -6937983, + -1539209, -3987340, -5699959, 4893042, 6072547, 394600, 806380, 11245835, 1308354, 6697465, + 2547453, -4967130, 5741835, -6786585, -1032940, 2745021, -6325413, 2619393, -4172024, -5803575, + 3294240, -12739947, -5108327, 3490735, 5640366, 5660230, 13194676, 8914205, 5276904, -6241661, + 3067681, 4846334, -5101885, -536871, 4567698, 173409, -1570347, -4744328, -1081258, 1794760, + 419833, 440234, -1815697, -3799972, -2595771, 3929358, -190589, -1206886, 1898912, -22012, + 1715839, 894964, 645319, 751082, 876173, 763967, 2820183, 796716, 905701, 702227, + -1414118, 1047972, -482110, -948651, -1184874, 439697, -1117765, -597000, -1583232, -602369, + -734976, -785979, -694174, 18790, -149787, 1238024, + }, + { + -10217727, -84373560, -15809775, 60349124, 3094524, -3694746, -4118337, -3364570, -5223754, 13458817, + -18177912, -6790880, 4218195, 273267, -1287953, 65498, 15774341, 5617817, -3068217, -317828, + -807454, 4796942, 12593918, 16902844, 7000260, 9777493, -10915123, 9549860, 13838385, -6573985, + 4345433, 10796474, 6292664, -1336809, 2725694, 4391604, 4735202, 435939, -634045, 3800509, + -4056060, -9666898, -3530463, -6601902, 1260573, -3091840, -2588792, 3062849, -341987, -5677410, + -689879, 3907347, 1640141, 2514703, -142808, 938987, 2978023, 1328756, -2383170, 3485366, + 1071058, -328565, -1121523, -58519, 2945811, 3795677, 2219424, 1629940, -1891933, 1512902, + 2236604, 1168231, -906238, -231391, 72478, -902480, -2880313, 798864, 1591285, 1149978, + 135828, -77846, -691490, 452045, -1096827, -1275605, -900869, -432718, 1055488, 657667, + 118112, 189515, 736587, -310311, -60130, -372052, + }, + { + -1894618, 19062676, 9038222, -554051, 1471563, -89121, 121870, 715649, -1014686, -1605244, + -1781875, 11710765, 1669669, -5938329, 19071802, -21467858, -10719165, 24029806, 6826851, -10961293, + 2018635, -13154411, -14154602, -3848291, 6580427, 12205223, 12084427, 4066260, 6383932, -6295885, + -1847910, 1047435, 18502182, 6576132, -2377265, 4017942, -1201517, 2891587, 3040300, 2833068, + 215822, 625992, 1919314, -741419, -2453500, 2234994, 2093260, 478889, 1406065, -577136, + 2330020, -2473901, -2782065, 4810364, 510564, 1257889, 4210679, 3694746, 1866700, -586800, + 7431367, 3137474, -2008971, -1003949, -1480690, 427349, 4312147, -399969, 1241246, 336618, + -1875290, 5628555, 1309965, -2137820, 1877438, 1377074, -1148904, 1801202, 2783676, -2851322, + 2691334, -355945, -2287607, -705448, 99321, -1619740, 615791, -739808, -815507, -358630, + -473520, -233539, 426812, 53150, 1365263, 542240, + }, + { + -17211544, -175136960, -10822781, 54636280, -12811887, -181462, 8150238, -4380330, 472983, 1893007, + -4462471, -14125074, 1812476, -26986890, -612033, -4462471, -14723685, 1916629, -10359461, -8225936, + -399432, 4758287, -4751845, -2370285, 11801496, -2701535, -6049462, -5921150, 2674154, 5818607, + -1403917, -2506650, 5486284, -433255, -297427, -3215857, -568546, -4183835, -5949604, 2439542, + 9075803, 3736085, -631360, 838592, -4710506, 558883, 290984, -1491427, -1210107, -3724274, + 2203318, 2972654, 1424319, -275415, 46708, 2116882, -536871, 1290101, 437013, -1596654, + -607201, 1002875, -1991254, 169114, 325881, -1457605, -1983738, 292595, -574989, 880468, + -2939905, 2014877, 767725, -2150168, -864899, 252329, 3075197, 246424, -732829, -912681, + 799401, -503048, 956704, -253940, 574452, -873489, 235686, 777389, 272194, -208306, + -948651, 517544, 658204, -1003412, 421981, -389768, + }, + { + 611496, -3565897, 1760400, 1285269, -1180042, -825707, 1308354, 3402688, -2778307, 539018, + -820876, -575526, 6736656, 3569118, 43670692, -14335527, 6380174, 2834142, 9215389, -2715493, + -4594542, 5005248, 3341485, -11531450, 3195993, 7719130, -6642167, -9328132, 18321256, 22509924, + 15532212, 1841467, -6041945, 13012677, -1846299, 8042327, -5568425, 10594074, -6714108, 5643050, + 697395, -940061, -2241973, -30065, -1277216, 2894271, -4787815, -2858838, 2348810, 2790655, + -1296543, 2953864, -5428302, -3544959, 1911261, 1313186, 1602560, -4123706, -2908230, 4043712, + 1646046, 923955, -2009508, 853625, 322123, 340913, -218506, 1172526, 162135, -692027, + 253940, -1933272, 188442, -226023, -1825898, -949188, 206695, -749472, -168041, 331249, + -232465, -388158, 1324461, 2081449, -1738388, 5369, -432718, -2529736, -562104, -1066763, + -955093, -762894, -1563368, -161061, -189515, -1188632, + }, + { + -53006340, -19168976, 28958816, -14985678, 4884452, 5558225, -19814832, 3686693, 18390514, 10092636, + -893890, -2031520, -11176042, -9918690, 598611, 15738908, -5143224, 7079180, -2934000, 5919002, + -3967476, -13948980, 8258685, 6127845, 20199768, 539555, 2571612, -5309654, -2004676, 11963095, + 2232846, -1299765, 2891587, -5265630, 8107825, -18614926, -3312494, -9119289, -2404645, 2772938, + 1529008, -266288, 7135552, -1196685, 10082436, -563178, -2568391, 2135673, -5387500, 2293513, + -459562, -322659, -2614025, -7794829, -141734, 2704756, 588411, -399969, 3029563, -101469, + -253940, 965831, 671089, 3995393, -1277753, -4119948, 1278290, -2085744, 306553, 3280818, + 1413044, -1959042, -674310, 1126892, 1960116, -2549600, 3033321, 284005, -746251, 1636383, + -670015, -616328, -828392, -1143535, -641561, 947040, 299574, 281320, 2174327, 175557, + -887985, -47782, 357556, 278099, -1180579, 1307818, + }, + { + 1472637, -2182917, 5501316, -3651796, -1304060, 893890, -772557, 84289, 7055021, 1825361, + -6862284, 2534568, 3128884, 8920110, -11034308, 14583025, 2574833, 10912975, 7173133, -18072148, + -15073725, -2565169, -4227322, -12928925, 12731894, -12142946, -5526013, -7474854, 15675020, -6912750, + 1283122, -1714766, 2675228, 4903779, -3251290, 3609920, -533650, -5033165, 12925167, -8430484, + 2391223, -2664490, -5168993, 5377299, 6925098, -2973728, -1955284, -871878, 6152541, -4144644, + -3339337, 2756295, 3314104, 5596343, -3361886, 1564979, 654446, 1476932, 2594697, 547071, + 100395, -3709241, 877784, -1712618, 489626, 2307471, -2639794, 3481071, -47782, 651761, + 104690, -547071, -974958, -989990, 679142, 190589, -1233193, 879931, 1165547, -957778, + 129386, -823023, 1261647, -1593970, -790811, 675384, 1059783, 616328, -1074816, -198642, + -798864, -1197759, 338229, 107911, -506269, 59593, + }, + { + -8538395, -155623840, -25984552, -10683194, -2404645, -6655052, -11654931, 2405719, -3359201, 8395587, + 2214593, 17519172, 471910, -15809238, 17854716, -14057428, -16770774, 4904853, 3176665, 552977, + -1160178, 5805185, 4504884, -7257421, -1170916, -11196980, -2061047, -6218039, -3614752, -8003135, + 2515240, -2990908, -7357816, 3110093, 1203665, -5523865, -172336, -908922, 3835406, 3481608, + 1200980, 332323, 4299263, -1886028, 9767829, 619012, -1172526, -2573759, 4873714, -824097, + -168577, 162135, 2551211, -7384123, 1702418, 107911, 1381906, -4246649, -667331, 2234457, + 4412005, -2987687, 767725, -1978906, 3437585, -1679332, 940598, 666794, -1058710, 5709086, + 218506, -1906966, 2576444, -3156264, 646929, 602906, 620086, 346282, -215822, 73551, + -2021319, -1306744, -626528, -1661079, 1202591, 478352, -739808, 380641, 477815, -559956, + 587874, -612033, -1083406, -80531, 994822, -142271, + }, + { + -2179159, -46759308, 1395864, 4749697, -680752, 9454297, 10138807, 5230197, -4687957, 2239826, + 119185, 6575058, 17727478, -12177843, 5531381, 16129750, -4788889, 10719165, -2224256, -9562208, + -8726300, 631360, -6217502, -3018825, -1723356, -5741835, 1838783, -5689758, 5950677, -9258339, + 5723581, -6947110, -7494181, -6269042, -3120831, -5541045, 1778117, -870805, -628676, -3277597, + -1831804, 7077569, 5354214, -3508988, -2668249, 868657, 4530117, 1301375, -4579509, -1646583, + 4974646, -3910568, -1543504, -3803731, 2049773, 3884261, 2485712, 446140, -1626719, 579821, + 1599339, -748935, -1229971, 648540, 5028870, 2224256, 29528, 3008088, -1828046, -93416, + -277025, 283468, -2080912, 1226213, -408022, 1002338, 772020, 2081985, -879395, -7516, + -890669, -977105, -1006633, -770947, -1111860, 755914, 2637110, 583579, -554588, -468688, + 227096, 1132261, -187905, -102005, 1193464, -37044, + }, + { + 24579024, -44977436, 13734769, -6491843, 3104188, 10145786, -17700098, 11157788, -4995047, -17995376, + 17139066, -13494250, 3195993, -3788698, 5976447, -14878840, 10863583, 5488968, 10072772, -3674882, + 3003256, 1901060, 9775346, 9417253, -7393786, -2727841, -3211562, -5196911, -4366371, -5080410, + -4168266, -1341104, 741419, -3195993, -3349538, -891206, -12868259, -8805757, 432181, 3114925, + 404801, -1660005, 8437463, 5142687, 4410395, 1340030, -350040, -496606, 7410429, 3837553, + -4075924, 2352032, 449898, -1028645, -264677, -4682588, 1064615, 2827162, -998580, -744640, + 4409321, 2588792, 1764695, 1025423, 1962263, -1009317, 5746130, 379031, 2326799, -719407, + -1020592, 53687, 1435593, -878858, -253403, 1530619, 365072, 2321430, -2026151, 803159, + 67646, 1760400, -1401770, 1691143, 407485, -1571421, -368830, 972273, -837519, 582505, + 1367947, 1969779, -1449552, 481573, 64961, 88047, + }, + { + -2829847, 5697274, 268435, 879395, 9245991, 2916283, -11586748, 3141232, -5107790, -943282, + 3053185, 3527242, -3427921, -28154048, -6476274, 15554761, -17401596, 7750806, -15829639, 7129646, + -24429238, -4116726, -9404905, 12804908, 6435472, 13829795, 848256, -326954, 5309654, 139586, + 11577084, -6272263, 17121888, -5769215, 8315057, 1386738, 6434935, -3641059, 4687957, 2008434, + 10781442, -5038534, 2980707, -4218732, 1283122, 2224256, -767189, -1884417, 1808718, 3831648, + -874563, 2068027, -2196339, -2650532, -2366527, 1221381, 1404991, 3036542, 1067299, 3772055, + -8779450, 402116, 3595961, -1736241, -704375, 57982, -3107946, -1536525, 3957276, 1187559, + -705985, 23622, -1115618, 1062468, 1103270, 2162516, -2284386, 1311576, -1393180, -221191, + 1341640, 670552, -741956, -263067, 124017, 887985, 13959, 906238, -1646583, 456877, + 1119376, -1475858, 139586, -906238, 82141, 621697, + }, + { + -195421, -83017960, 17576080, 7143605, -4573604, -27953794, 184147, -2931852, -8295193, 9160628, + 3034395, 6714645, -3609920, -9557376, 23105314, -3069291, -19823958, -7444252, 1670205, -4908611, + -8458401, -635118, -1812476, -4793184, 8510478, 8304856, 1268626, 9835475, 2134599, 9127, + 2443837, -413391, -5748277, -2597382, -6287296, 1243393, 1857037, -7545721, -4532801, -3015067, + 1111860, -5073967, -4081830, -6768332, -8160438, -4845260, 2973191, 2105608, -10009421, -3600256, + 5292474, -2401961, -1635309, 2362769, -1840930, -1655173, -3004867, 106837, 1819992, 3364570, + 2294586, -2612951, 3201898, 3943317, 1730335, -193810, -894427, 896038, -320512, 2064806, + 1476395, -435402, -898722, -2347737, 1880122, -59056, 1514513, 600222, 770410, -683437, + -1470489, 923955, -1770063, -3046206, 729608, 195421, 864899, 157303, -202400, 198105, + -1105954, -1172526, 77309, -890132, -1086627, -944356, + }, + { + 5043902, 22341884, -2940442, 3421478, -7916162, 13878113, 269509, -265214, 6885370, 7990787, + -6858526, -2784750, 8979166, -1460289, 101766568, -7903814, -10151155, -20432234, 11698417, 17050484, + -9814000, 6488622, -3508452, 2680060, -1721745, -7187628, -847182, -4534412, -5307506, -20568598, + -599148, -4043175, -490700, -8683887, 8303783, -2398739, 248571, 3691525, -2634426, -1765232, + -10485089, -2529199, 13010530, -1203665, 6306086, -2430952, 10793790, 5396090, -14443438, 1114007, + 954020, -928787, -3688303, -642098, -3353296, 1293859, 4613869, 1488743, 5080947, 7083475, + 925029, 372588, -51003, -4438312, -3604551, -2645700, -5131949, 619549, -1119913, 1259499, + -3379603, 1455457, -84826, -3462818, -983548, -2341831, -2182380, -15032, 1370632, 5155572, + -2428267, 726923, 1574106, -916976, -2480881, 1517734, 413927, -2680597, -352187, 18790, + 136902, -1617592, -1001264, -576063, 2339147, 266825, + }, + }, + { + { + -13769128, 196635952, 36422396, 9848897, 18006650, 3500398, -1553168, 19172734, -12794171, 18114562, + 16393353, -4264903, 2319819, -15243913, 2095944, 6289443, -14147085, -2522220, -2693481, 11176579, + -2163053, 3524558, 486405, -44023, -1412507, -7329899, -8835285, -248034, 3322157, 519154, + 2282775, 4100620, 2666638, -4046396, -7466264, -1742146, 4634270, 2171643, 3813931, -383326, + -2745558, -7925289, 735513, -9407052, -127238, -7624641, 1584306, -2413235, 1639604, 7530152, + -4453344, 936840, -1288490, -5150740, 1205812, -2017561, 2626373, 883690, -274341, -374736, + -661425, 132070, -467078, -4471061, -81604, 1350230, -1057636, 562104, -695248, 1758789, + -2550674, -1415192, -1376537, -1408749, -1110786, -2986076, 3075734, -1593970, 406411, 2419140, + 1991254, -818728, -723165, -1386738, -1730335, -479426, 561030, 93952, 1773285, 1570884, + 406948, -894964, -920734, 641561, -1039382, 418759, + }, + { + -291521, -54251880, 8797704, 17539036, 2263448, -4014721, 884763, -9541807, -2673617, -7744900, + 16505559, 8160438, -10204842, 12255689, -8969502, 4387309, -9801115, -8026757, 1259499, -9499931, + 4816269, 2115808, -17127256, -1558536, -308701, -3135863, -19266686, -2304787, 6131066, 21977348, + -3906273, 8064875, -305480, -3161633, -2197950, -2962454, -8754217, 7552700, 428423, -1641751, + 2536178, 8477729, 2005213, 1894618, 1824287, 892816, -9805410, -1323387, -3133716, 5479842, + 3894462, -4710506, -2673617, 106837, -7296613, 1899449, 2534568, -1078574, -751619, -664109, + 5712307, -3262565, -1433445, -278099, 4662187, 1663763, 1586990, 385473, 1329829, 642635, + 1563905, -1334124, 2450816, -223338, 241055, 929324, -2294050, 1497333, -940061, 382252, + -1530619, -885300, -90194, -819265, -2114198, 1221381, 400506, -470299, -513249, 433255, + -323733, 411780, -351650, 1459215, 365609, -300648, + }, + { + 5318244, 53810036, -34609920, -25679610, -10337986, 7973607, -665183, -7299834, -11309186, 2153926, + 29959008, 3973919, -4756140, -6768869, -2224793, 8082055, -7885560, 6260989, 2457258, -3385508, + -8878771, -6837051, -3016678, 12351252, 3810710, -4263292, 6701760, 4832912, 9171903, 2105608, + 189515, -196495, 1980517, 2780991, -8178692, 3234110, -4664872, 7332583, -6080063, -10009958, + -1325534, -5405753, -5925445, -3202435, 9756555, 11476153, 10937134, 2526515, 8357470, -4002910, + -2651606, 5247913, -4190814, -1953673, 5247377, 3133716, -3681861, -4949950, -3158412, 3090766, + 1970316, 745177, -1868848, -3648575, -2001455, 2168959, 1582159, 649614, -949188, 1645509, + 360777, 299574, 2213519, 573915, 345208, -157303, 3756486, 1320703, 1140314, 508417, + 426812, 987843, -1120450, -1139777, -1288490, 490163, -341450, -1029182, -1115618, 71941, + 395674, -2423435, 135828, -175557, 800475, 436476, + }, + { + -4359392, -121904056, 11380590, 60248728, -4923107, -6578816, 4004520, -6027987, -3533148, -3166465, + -6504191, -1285269, -3149285, -1435593, 10484015, -9064528, 10041097, 6199249, -1253594, -7524783, + 6577206, 376347, 10139344, 12509629, 8931921, 7896834, -2379412, 477815, 13018046, -5202816, + 5849209, 11771432, 3146601, 4878546, -716723, 4593468, -1692217, 3564286, -2979634, -1855963, + -2915746, -5586142, -6429029, -3894462, -2924336, 1015760, -1329829, 3636764, -3047279, 1734630, + 1195075, -3907347, 4454418, 4076998, -1686848, -429497, 2593624, 2165737, 2337536, 25233, + 1085016, -593242, 2112587, -1078574, 1777580, 2736431, 3371549, 1789928, -1282585, 865973, + 1155883, 2071785, -2209761, 87510, 1397475, -1226750, -2089502, 779000, 1228898, 840740, + 604517, 972273, -961536, -1341640, -789200, 290984, -892279, -63888, 123480, 143345, + 432718, 1611, 486942, 863825, 89121, 132607, + }, + { + 1445793, 29196114, -4625143, 3432216, -1917703, 854162, 2680060, -3973382, -527744, 865973, + -1960116, 9968619, 1856500, 8137890, -6434935, -9081171, -12799003, 14935212, 23262616, -17159468, + -6870337, -7706245, -6681896, -4082367, 584652, 17616882, -1743757, 9414031, 6211597, -363462, + 2174327, 5556614, 5288716, 1881196, 2870112, -2277407, 9157944, -2440078, 7683697, -2162516, + 825707, -1866700, 902480, 1065152, 1159104, -392990, 951335, 2386391, 2178085, 2466385, + -3290482, -1395864, -452045, 6573448, 3358128, -6929393, 7521025, 1540283, -1791001, 6460705, + 3467112, 2885144, 720481, -1756105, 746251, 1239635, 25770, -2147, 2633352, 27917, + 391916, 2233383, 1353452, 1035087, -2239289, 468151, 1214939, 1046898, 1649804, -549756, + 1337882, -554588, -705985, -1178432, -412854, -625455, 184147, -474057, -1629403, 148176, + -1813013, 1167694, 442382, 480499, 1066763, -475131, + }, + { + -7209640, -227025536, 5749888, 43080668, 5859409, 846109, 10384694, -4577899, -10197326, -10619844, + -492848, 5835250, -13459354, -16373489, -5198521, -9615895, -6048925, -8117488, -8701604, -6944425, + -5920076, 8046621, -3361349, 2082522, 8040716, -6804839, 3464965, -11027865, 1284195, 2979097, + -1311039, -193274, 8679055, -4573067, 4859756, -576063, -5323612, -2370822, -4952634, -1445257, + 7606924, 9728638, -158377, -1035624, -1200980, -2945811, 3030100, -7800198, 854162, -57445, + 1752347, -1585917, 1823751, -2334315, 3995393, 2766496, -2981781, 1063004, 3609920, -5401458, + 347355, 3855270, -3476239, -499290, 486405, -1633161, 779000, -53150, -855772, -657667, + 1600412, -1121523, 886374, -1837709, 419833, 477815, 1467268, 2246805, -2378875, 53687, + 392453, 99321, -172872, 736050, -988379, -188979, 474594, 61740, 1360431, -1831267, + 479426, 798864, -524523, 207769, 208843, -442919, + }, + { + 535797, 1475858, 1185411, 756988, -1085553, 412317, 537945, 3262028, -4522601, 399432, + 287763, 5405217, -1983201, 6356015, 42092828, 1069984, -149787, 3787624, 6905234, 103079, + 93416, 2505577, 15927349, -21104396, -3868155, 5483063, -2092723, 2632815, 3553549, 35596688, + 15630997, -13994077, 5425081, 862215, 7320772, 3228205, -2705830, 2118493, -3073586, 2423972, + 4580046, -2150705, -51003, -6263673, 327491, 552977, 811212, -4651987, -34360, 1273458, + -3762928, 4068408, -2138357, -7959112, 2729452, 1812476, -1975148, -12348, -4826470, 5465346, + 342524, 1453310, -490163, -21475, -863825, 408022, 1168768, -975494, 163746, 377420, + -3181497, 703301, -150861, 804233, -295279, -2392834, -1221918, 2165201, 100932, -1257352, + 708670, 1159641, 1250909, 327491, -727460, -62277, -435939, -2782602, -1088237, -882079, + -1064078, -179852, -1819456, -512175, -488553, -864362, + }, + { + 66209068, -113018304, -40916004, -28011240, 22887344, -6161668, -11080479, 8719857, 17756468, 3612604, + 3286724, -57982, -16219407, -4537633, -7732552, 15251966, -3534758, 4515085, 2024003, -1333587, + -6490233, -5860483, 10155450, 10370199, 11385421, 2467996, -1380832, -3413425, 5651640, 702764, + -274878, 8347269, -736587, 139050, -2612414, -14115410, -4895189, -14915885, 6739341, -2850785, + 5244692, -970126, 3080565, 2749316, 4322348, 7495792, -7100118, -1509144, 539555, -1479079, + -2680060, 2675228, -3029563, -3876745, -1986959, 3037616, 730681, -774168, 641024, 2124398, + 282931, -3463891, 5998996, 1481764, -494458, -1816771, -2393908, -955093, 3327526, 2018635, + 705448, -1431835, -143345, -111132, 2162516, 916976, 67646, 1941325, -1589138, 383326, + 1592359, -1374926, -2230699, -713501, -698469, 2012192, 368830, -551366, 1431298, 229781, + 9127, -643171, 556735, -269509, 39728, -735513, + }, + { + -172872, 6419366, 2062658, -927713, -2382633, 621697, -127775, -795106, 5830418, 2334852, + -9109626, 3584687, 11858405, -16996260, 11986180, 16547435, 7573101, 7627862, -9304510, -16779364, + 4401805, -19386946, 10883447, -26280904, -522375, 1719598, -7252053, 1576253, 852551, 8004209, + -4695473, -918586, 2775086, 7045357, -5421860, 3617973, 1047435, -18254, 8090645, -5326297, + -1512365, -1420024, 919660, 2074469, 2062658, 2796561, -4793721, 2163590, 4318590, -1642288, + -6210523, 5059472, 1823214, 7046431, -4443681, 259846, -347892, 3224984, 780073, 3018825, + -2367064, 973347, -1952600, -1561758, 1912334, -3146601, 125628, 1410360, 2172717, 1012539, + -2660732, 1007707, -977105, -1061394, 280247, 1104880, -425739, -1193464, 2413235, -1666447, + -212064, -84826, 8053, -419833, -1431298, 1204738, 1347546, -98784, 32749, -69793, + -418222, -1365800, -398358, -58519, 204011, -554051, + }, + { + 6034429, -183298464, -16548509, -18661096, 12693239, -20075750, -20339892, -978179, 15035607, 11163157, + 1582159, 3277060, 4116189, -8250096, -4541928, -4284230, -11502459, 7900056, 4514548, -475668, + 3235721, 7555921, -8875013, -621697, -4996121, -237834, -9481677, -4812511, 283468, -3185255, + -9964324, 5455682, -8230231, 5558225, 2013266, -3195993, -6356015, 2892124, 6366216, 4000762, + 801011, 1903207, 3674345, -2188823, 2295123, 9418326, -6162205, 394600, 2599529, 3405372, + -1356673, -2295123, 535797, -90194, -886374, -2573759, 893353, -1201517, -1474784, 1561221, + 2234457, 62277, -660888, 725850, 2143726, -238908, -393526, -451508, 558883, 586263, + 1484448, 679679, 978179, 365072, 1075352, 952946, -986769, -1001801, 1599875, 326418, + -1693828, -897111, -18254, -2641405, 289373, 1734093, 1058710, -1367410, 23622, 1410360, + -1233729, 1169842, -356482, -612033, 130460, 1705102, + }, + { + 3244311, -51527260, 5285494, -1501628, 1703491, 12477954, 12247636, -3728032, 4497368, -2309619, + 5215164, 1205275, 11962558, 6572374, 4078608, 2798708, 12981539, 1966021, -4101694, -12062416, + 1314797, -8220031, -2749316, -1858647, -7730941, -7395397, 3661460, -4081293, -2018098, 3818763, + -1250372, -5089536, -11664594, -7496866, -3599183, 4832, -79994, -3331821, -6907918, 678605, + -1794223, 7165616, 2436857, -1427540, -1155883, 1290638, 1781338, -3235184, 1232119, -1291711, + 1854352, -2574296, -2163590, -4140349, 2893734, 1415192, 3890704, -106837, 256624, -1224066, + 2099702, 1595044, -3788698, 3636227, 2922725, 2625299, 3242700, 1727114, -159988, -1721745, + -1649804, -706522, -417686, -91268, 1975685, 29528, -176094, 1793686, 1496259, -1853815, + -747324, -1920387, 336618, 264141, -2193118, 923418, 2141578, 168577, -727460, -658741, + 1056562, 64961, -404264, 916976, 999117, -762357, + }, + { + -33943128, 34809100, 12674985, -91805, 8810589, -25323664, -1498407, 20256676, -8578660, -8828842, + -1438814, -5890548, 4398047, -1074279, -3876208, -9098351, 16223702, 2417530, 1066763, 2621541, + 1316408, -866510, 13135621, 5538361, 4449586, -4753455, -2404108, -6651294, -5700496, -482110, + -8011725, 2100776, -2478196, -7667054, -2114735, -7358353, -1253057, -15748034, 1814624, 6262599, + -3075734, 6544457, 6354404, 4141959, -927176, 8523363, -3483219, -1302449, 9104257, 6715182, + -2509335, -2491618, 3871376, -549219, -5941551, 630286, -1039919, 301721, 1959579, 766652, + 1889786, -1038308, 3523484, -1134408, 4286378, 1110249, 724239, 2852395, 1207423, -276489, + -2726231, 1924682, 2452426, -726386, 1308891, -505196, 779000, -508954, 726386, -369367, + -388158, 2119030, 219043, 1042066, -1115618, -949188, 321586, -1119913, 777926, -299037, + 1304060, 1859184, -1098438, 2320356, -1456531, 788127, + }, + { + 2672544, 18538690, -9710384, -703301, 66035, 2727304, -1550483, -5309654, 4277788, -2820720, + 3192235, 3745212, -10980621, -12957916, -13561359, 15741055, -18073222, -2886218, 939524, 6162741, + -11533598, -42729556, 35651988, -14095009, 18509698, 20328618, 1328219, -15959025, 11761231, -785979, + 6980396, 10134512, -517544, 4727149, -1030255, 6122476, 4816806, -1375463, 5263483, 4649302, + 6305012, 3009162, -2271501, 344134, -4295, 3905199, -405338, -965831, 1728724, 1676111, + 42950, 724776, 113817, 39192, -5995238, 5087389, -782758, 1146219, 2510945, 680752, + -5676873, -3646427, 3688840, -548145, -1801202, -141197, -74088, -5376762, 7099044, -979253, + 930934, -1479616, -1040993, 1904281, 533113, 2000918, 589484, -906775, 356482, 1254131, + -2077154, -644245, 860604, 761820, 353798, 710280, -9664, 2472828, -2175938, 40802, + 891743, -1435056, 49929, -579821, 631897, 1218160, + }, + { + -16553878, -53583476, 7245073, -675384, -284005, -18553184, -12674985, -6730751, 3430605, 9609989, + -16399259, 26590680, -14363444, 24746528, -16980690, -5392869, -11584064, -6550362, -8940511, -8410620, + -8609262, -585189, 4591320, -656593, 6979, 10014790, 5082020, 7977365, -719407, -1165547, + 3541738, 3653407, -638340, -7129646, -5739150, -3452080, -2596308, -1508607, -2067490, -8089571, + 3103114, -9673877, 3332895, -6087043, -11171210, 3719442, -3505230, 2265059, -8688182, 463320, + -1353989, -3329674, -11274, 1182727, -1305133, 268435, -3413962, -597000, -396748, 6978785, + 1324461, -71404, 1795833, 606127, 2375654, 1121523, -3302293, 1899449, -207232, 4080219, + 107374, -896038, -20938, 988916, 629213, -2000381, 306553, 2105071, 549756, -1005022, + -896574, 1083942, -1649804, -1341104, -819802, 1231582, 533650, 814970, -997506, 344671, + -1464584, 286152, -1604170, -608275, -119722, -621160, + }, + { + -5789079, 8327942, 14537391, 8180302, -2202781, 156229, 3061238, 4554276, 4604205, 7499550, + 341450, -2785823, -810675, 42536284, 40102108, 2036351, -7952669, -13320841, 10224707, 7952669, + -8876624, 5741835, -3962644, -2811593, 2879239, -12072616, -13320304, -5390184, -375810, 3321620, + -10667088, -4301947, -6932077, -4151086, 5435818, -9655086, 2514703, 7906498, -1963337, -7901666, + -1811939, 1859184, 6787659, -3277060, 1260036, 11541114, 3974992, -979253, -2455111, -2327872, + -1088774, 963683, -4001836, -2463164, 212064, 2936147, 4956393, 1983738, 4165582, 5427228, + 2257005, -1653562, 2333778, -4664335, -2201708, -6019934, -2199560, -2270964, 2152316, 13422, + -2733747, 4832, -874026, -1655710, -2629594, -701690, -1496259, -321586, 370441, 1997697, + 1853278, -3363496, 2814277, 102005, -517544, -1288490, 998043, -974958, -300111, -61203, + -1017907, -1234803, -1514513, 741956, 1760400, 445066, + }, + }, + { + { + 18800146, 128838280, -28095528, -9265855, -1516660, 2304787, -5511517, 21519396, -12749074, -14813879, + -20008106, -23408108, 97174, -17536888, 562104, 7720204, -5631776, 7994545, 1207960, 16235513, + 1595580, -4737886, -6890738, -3832185, -2251100, 200790, -4445828, -5938329, -7249368, -7319161, + -9514426, -5937793, 2687039, 949188, -2058363, 4726075, 2553895, -3328063, -1032403, 4194573, + 2195802, -2998424, 9257802, -5623723, -2058363, -9437654, 2519535, 2425583, 845035, 4255776, + -5407901, 3301756, -959388, -2085744, 3112241, -2670396, 4410932, 6591164, 4688494, 296353, + 1828582, 2684, -2158221, -3391414, -8590, 1221381, 576063, 1047435, 518617, 759672, + -725313, 597000, -1665911, -937914, 2428267, -8053, 3154117, -2666638, -643708, 1063541, + 180389, -836982, 842887, 677531, 315143, -681289, 417149, 294742, -501974, -654983, + 941135, -90731, -233539, 1271847, -1051730, 387621, + }, + { + 195958, -53364968, 7775502, 8241506, -1676648, -2250563, 3762391, -5182952, 3417720, -1155883, + 13245679, -459025, -5708012, 4532801, -25607668, 18701362, -7954817, -13532368, 15378667, 4869956, + -2747169, -8803609, -21038360, -2873333, -13593035, -7151658, -3444564, 6186901, 8317204, 12640089, + -1931125, 11712913, 3959423, -626528, -9644886, -6446746, -9922985, 3141232, -3620121, -175557, + 3135863, 969052, -7708930, -1280437, -490163, 3643206, -7855495, -1648731, -3365644, 4399657, + 6904160, -3018288, -1742683, 1326071, -5415417, 1892470, 980863, -742493, -2260764, -2441152, + 5424007, -3584150, -1306207, 779537, 3682398, 3154117, 1588064, -2718714, -352187, -243739, + -369904, -1978369, 2263985, 1344325, 2070711, 2623151, -785442, 1203665, -741956, 925029, + -782221, -48318, 45097, -277562, -2021856, 49929, 185220, -182536, -2275796, -2297808, + -998043, 1185948, -345208, 301185, -1431835, -386010, + }, + { + -3594888, 104227584, 11853573, -13211856, -2382096, 3315178, -4282620, -6209986, -4179003, 9678172, + 16780974, -3220689, 11020886, -5833103, -8844948, 6351720, -3361349, 16797618, 4297115, 9594420, + 3074660, -8991514, -4512400, 10351945, 4276714, -4154844, 1178969, -119722, 7878044, 645319, + 6113886, 1525250, -1855963, 8277476, -2244121, 313533, -8676908, 8797704, 474594, 278636, + 4377109, -1839857, -5775121, -4582193, 3890167, 4747013, 2497524, -2864206, 9161165, -523449, + -2857227, 2700998, -1946157, -4182225, -206695, 1957968, -2773475, -482110, 905164, 3523484, + 2058363, 2364380, 584116, 761283, 328028, 613643, 724776, 929324, -1348083, 1372779, + -360777, 638876, 764504, -1781338, -1016834, -41339, 2841658, 903554, 3327526, 2185602, + 965831, 1367947, -839666, 419833, 527207, 571768, 227633, -394063, 1442035, 1317481, + 1339493, -129386, 840740, -427886, 580357, 336618, + }, + { + 25246354, -110589504, -16451335, 50345068, -3833795, -4308926, 3391414, -2374580, -6153078, -7752416, + 4429185, 9330816, 5491116, 4621385, 7682086, -12663174, -5279589, -9316321, -527744, -4279935, + 3017752, -10934987, -712428, 3763465, -1633698, 3012920, -1801202, -12659953, -1358820, -6417755, + 2040110, -960462, -6921340, 3151432, -465467, 4367982, -185757, 1804960, -4735739, -4497905, + 5945846, 5012227, -2324651, 3751117, 2318746, 1738925, -2900177, 3491809, -5524402, 570157, + 1294933, -3567507, 5048734, 4773856, -1616518, -130460, 3740380, 3295314, 258235, -3717831, + -818728, -1005022, 755377, -2288144, -1395328, -1445257, -1075352, 832150, -1092532, -1825898, + -1801739, 1257889, -512712, 1341640, 1292248, -576599, -33823, 56371, -1866163, -964220, + 570694, 973347, -241055, -400506, 305480, 1191853, -1245541, -347355, 440234, -723702, + -1180042, -606664, 743029, 1169305, 158377, 894427, + }, + { + -789737, 29633664, -2384244, 6039798, -9664, 493384, 1146219, -3580929, -67646, -768799, + -4667556, 5470715, -3536906, 7765838, 921271, 12005507, 6649146, -22953378, -10405095, -10475425, + -5083094, 1530619, 3198140, 8695698, 2138894, 21084532, 12699145, 9349607, -6458557, -7956427, + -6536404, -4105989, -5730023, -7761543, 305480, -11853573, 4253092, -2501282, 713501, -9140764, + -2663954, -4262755, -701690, 5323612, -1457068, -3288334, -1755568, -1530619, 3979824, 5726802, + -3732864, 1015223, 822486, 5416491, 2599529, -9710384, 4111894, -1002875, -3715147, 3941169, + -398358, 292058, 1062468, -907312, -1410897, 168577, 1154273, 1872606, 722628, -2558190, + 545461, 553514, -75699, 193810, -3328063, -1123134, 75162, 399969, -797253, -2089502, + 637803, -41876, 1791538, 234613, -1109175, -532576, 543850, 905701, -332860, 1362042, + -1228361, 584652, 19864, 664646, 484794, -1167694, + }, + { + 39355860, -200421424, -12813498, 27834072, -10924786, 2597918, 6113886, -11077794, -4987531, -9768903, + -3986804, 7424925, -10992969, -1774895, -9526774, -7053947, -140660, -11054172, -473520, -7176891, + -16604344, 10257993, 5199058, 3810710, 4430796, -2852395, 2703145, -8360154, 9836012, 9909563, + 7062000, 3818226, 1937567, -10087804, 4282620, 935766, 1970853, 2610803, -519691, -1868311, + 476741, 9301289, 5468567, -1066226, -3499862, -2320893, 6374269, -3444564, 2189897, 1854352, + -675384, -7463043, -34897, -2271501, -329639, 1213865, -3309809, 1466195, 3709241, -4678830, + 2482491, 3016141, -5457293, -3550864, 364535, 497142, 856309, 459025, -647466, -2425583, + 1530619, -137976, 2561948, 887985, 1445257, 718333, 167504, 2823404, -1226750, 404264, + 135828, 915902, 585189, 1417876, -1352915, -782758, -430034, -634045, 1346472, -1329292, + 891206, 179852, -1363652, 1023813, 901406, -386010, + }, + { + -1102196, -1828582, 1755031, 1189706, 912144, 537408, -491237, 2193655, -3559454, 1401233, + 404801, 6967511, -2851858, -1506460, 31026844, 14299557, -929324, -659278, 17039746, 10718628, + 2816962, -229781, 22076668, -25213606, -15607911, 9268539, 3219078, 2796561, -10453950, 17248052, + 3874597, -19881404, 4801774, -1028645, 5240397, -2464238, -6985765, -2183454, -9058623, -4548371, + 2752000, -1326071, 912144, -6577206, -1032940, -3041911, 2274185, -6578280, -3882651, -897111, + -6671695, 3737695, 30065, -9023189, 707596, 3040837, -2248416, 599148, -2698313, 5628018, + -219580, 4588636, 3406446, 323196, -167504, 452582, -1658394, -2233920, 926102, 488553, + -2986613, 752693, -472983, 648540, -1163936, -2480881, -1087701, 3102040, 1963874, 405338, + 1806034, 321586, -775778, -351650, 32749, -78383, 821413, 222801, 437550, 732829, + 1341104, 899259, -1591822, 468688, -13422, -368293, + }, + { + -67063768, -234838080, 15887621, -44022340, -9317932, -7390565, -4059281, -1245541, 2422362, -4158602, + 3637837, 6412386, 5180268, 275415, -10895258, 16621523, -5623723, 4709432, 6695317, -12870943, + -1943473, 7195144, 17542794, 10315975, -3345243, -5912023, -7604777, -4813585, 8217883, -3219078, + -6179921, 5440650, -362925, -1791538, -9771051, -18422188, -816044, -7217156, 4857071, -3936338, + 2713346, -4061965, 2267206, 4988605, -1074, 4040491, -3370476, -234613, 257698, -3890704, + -5369783, 3520800, 4996658, 4014721, 3009698, 3584687, -3411278, -502511, 1079111, 756451, + 974421, -2870649, 5079336, -847182, 105764, 1201517, -476741, 543313, 2185602, 494995, + 408022, -1743757, 449361, -949188, -253940, 977642, -511101, 1782948, -28454, 138513, + 434865, -1384053, -1395328, -539018, -928787, 1875290, 531502, -192200, 82678, -1083942, + 224949, -892816, 1086627, 524523, 33286, -966368, + }, + { + -1260573, -4533875, -6289443, 1877975, 792958, -177167, 754304, -3042448, -1769527, 4075924, + -4132832, 2935610, 7059316, -33916284, -2821257, 3481071, -7368554, 2241436, -10808285, -13567265, + 10636487, -12505871, 965294, -40527848, -7016366, 752156, -959925, 6537477, 7786239, 6948720, + 1117228, 8156680, -3187403, 4765266, -3200825, 4791036, 7373385, 1130650, 6610492, -1574106, + -5717675, -2375654, 1578937, 1443109, -4510790, -455803, -6674916, 2400350, 3205656, -884226, + -1810329, 4461398, -6133750, 2378875, -2950106, -576599, -2014340, 2330020, 609885, 1363652, + -3730179, 3551401, -1500017, -1223529, 1957968, -1944547, 1465121, -1019518, 277562, 1198833, + -1083406, 2277407, 429497, -389231, -188442, 2308008, 805306, -1567663, 1627256, -3246995, + -484258, 1841467, -357019, -544924, 460098, 1296543, -215822, -1110786, 47245, -215822, + -122407, -37581, 730681, -525597, -76236, 156229, + }, + { + -2866891, -205321456, 158377, -6618545, 7387344, 905164, 3336653, 309238, 11183558, 829466, + -11415486, -10600516, 379568, 2369748, -4563403, 1803886, 3318936, 10183367, -2288681, -5807333, + 6965900, 6948184, -6636798, 2183454, -603443, 8079907, 6305549, 4438849, 496069, 6049462, + -10196252, 1896765, -6904697, 2853469, -1919850, 666794, -3046206, -899259, 934155, -1802813, + -7525857, 468151, 7738458, 1200980, -1211181, 7580618, -7763154, -1840394, 1085553, 4176856, + -850940, -5043366, -2260764, 6188511, 2548526, -2161979, 2112587, -1567126, 625455, 2968359, + 1921461, 2573759, -362388, 14496, 2398739, 3863860, 1838246, -1044751, -1438814, -2017024, + 1180579, 1728188, 1861868, 1704565, 667331, 135828, -3323768, -1198296, 1550483, 910533, + 935229, 1219771, 1122060, -1920387, -1096290, 90194, 1409286, -319438, 61740, 558883, + -998580, 1640678, -161598, -932008, -303869, 1457605, + }, + { + -3539053, -40709312, 18480708, 5542656, 6258304, 1332514, 2137820, -3523484, 12531641, -5461051, + -1213328, -11516418, -4352950, 6458557, 8059506, -13038984, 16291348, 1872069, -13773423, 4996121, + 26044144, -5647882, 869731, 4869956, -8702677, -7091528, 4040491, -4671851, -5135707, 11862163, + 4908611, -3574487, -5086315, -2509872, 90194, 2610266, 1904818, -2453500, -9273371, -4380330, + -2887829, 8075613, -2043868, -1477469, -1202591, -5499169, -3112241, -7329899, -2322504, -4290673, + 273804, -1618666, -1838783, -2530273, 3734474, -486942, 2350958, -3002182, -2156611, 616328, + 1881196, 729608, -1961726, 2895882, 143345, 2556043, 2217814, -1723356, -533650, -3648038, + -2807298, -186294, -1582159, -2148021, 495532, -782221, -787053, 1631014, 2008434, -657130, + 871342, -1129040, 1549946, 1897839, -457951, 1358283, 967978, -398358, -365072, -1085553, + 396748, -796716, -1288490, 1326608, 459025, -878321, + }, + { + 24195698, 117742768, 7436199, -2589329, -1682554, -22870164, 15735686, 13683766, -4247186, 91805, + 5681705, 2287070, 8422968, 5487895, -6789270, -2771865, 12936441, 6018323, 820339, -15308874, + -4495757, -3056406, 7625715, 1840394, 11101954, 4956393, -2280628, -8387535, 3181497, 4191351, + -10162966, 4054986, 3321084, -4065187, -2604361, 428423, 12595528, -1353989, 11797201, 3551401, + -1506997, 11945378, -1312113, -7582765, -4753992, 5545877, 1620813, 1348620, 3172907, 1380832, + -3077881, -3209951, -2119566, -1354525, -4391604, -777389, -1995012, -1886028, 129386, -831076, + -2076080, -2808372, 3751654, -1693291, 1263257, 243203, -2547453, -438624, -382789, -1832877, + -2808372, 2280628, 2185602, 106300, 1550483, -613643, 1704565, 124017, 1822677, 144418, + -322659, 1034013, -1199370, -581431, -1975685, -1545115, -725850, -2239289, 1317481, -260382, + -202937, 1597728, -766115, 2731599, -347892, 1855426, + }, + { + -1582696, 34277596, 8591545, 3966939, 248571, 1719061, 519154, -7832947, 1206349, -2524367, + 1093606, 4658966, 4754529, 16542067, -27866822, -5801964, 4564477, 15491947, 11225434, 11055246, + 6095096, -25496536, 30033096, -9438728, 20872468, -5528160, 672699, -5627481, 5596880, -9248138, + -2320356, 5108327, -10266046, 1283658, -4854924, 5540508, 1813013, 559420, 9549323, -1914482, + -1238024, 903554, 4591320, 5425618, -2716030, 5249524, 884763, -4443681, -944356, 4244502, + 3571802, 1133871, -3258807, -679142, -6959458, 3273839, -3796214, 65498, 2400350, 2654290, + -1051730, -2415382, 1638530, -1941325, -1044214, 1225139, 1064615, -3852049, 3949223, -3156801, + 2519535, 596464, 687195, 2260764, -350577, -1188095, -478352, -119722, 1176284, 536871, + -2815888, -957241, 2350421, 1249836, -1123671, 288300, -773631, 1613297, -1143535, 47245, + 380105, -453656, -810675, -394600, 290984, 280247, + }, + { + 27209692, 3580392, 5492190, 2942053, -4166118, -7065221, 1424855, -7863012, -3846143, 7491497, + -16534013, 12626130, -11625403, 29782914, -27410482, 1949378, 16456167, 7056095, -9717364, -3262565, + 1091459, 1648194, -4093641, -10008348, -6641093, 7249905, 4551592, 1830193, -7276749, -5342940, + 3337190, 2603824, -118112, -6335614, -4642323, -2572686, 3135863, 4811974, 4532264, -5466420, + -1107565, -6723772, 10295573, 3502009, -3012920, 8999030, -4051228, 1512902, -912144, -425739, + -7332583, -375273, 2257542, 531502, -243739, 2945274, -297427, -1692217, -2061584, 4392141, + -472983, 2510945, 191663, -3967476, 1341640, 2290291, -1243930, 2246268, -275415, 2927020, + -2047089, -1286880, 868120, 3779571, 2661269, -1569811, -185220, 2064269, 1981591, 99321, + -260382, 2788508, 1591285, 583042, 306553, 3026341, 245887, -1799054, -881542, 1246077, + -1073205, 1341640, -20401, -556735, -434329, -163746, + }, + { + 6671695, -607201, -7884486, 7286412, 1248225, -2866354, 1480153, 7138236, 612570, 5743982, + -2641942, -8129836, -2476586, -1902671, -29395294, 2403034, 18314278, -172872, 2246805, 6918119, + -11329587, -10241350, -11308112, -1260573, 4363687, -3791383, -1772211, 11014981, 5312338, 10438381, + -13952738, -11494406, -2158758, 2662343, 4229469, -13552232, -5753646, 383326, -5496485, -3523484, + 4985920, -2217814, -5305895, -3631932, -4177930, 2615635, -1756642, -2481417, -196495, -301185, + 1154273, -470836, -4854924, 1318018, 3064459, 1681480, 3069291, -585189, -3319473, -3682935, + -1031866, -1569811, 2256469, -4392141, 61740, -879395, 2841658, -2681670, -1656247, -1664300, + -642635, -2983929, -2844879, -830539, -3781182, 1108102, 512712, -403190, -2041183, 337155, + 2969433, -3779034, 2131915, 453119, -284542, -925029, 1826435, 713501, 433792, -452045, + -725313, 108448, -722091, 485868, 693100, 1018981, + }, + }, + { + { + -24676198, 87957176, 59894928, -17207786, 1128503, 2042794, 8681740, 816581, -5628555, -21022254, + -10173167, -32556388, 4937065, -19888920, 1692217, 8370355, -1425392, 7827041, 8140037, 1049583, + 7224135, -1975685, -6249178, -4052302, -9435506, -4483409, 7220377, -6549825, -15841987, -3133716, + -16365973, -3278671, 479963, 1732482, 1113470, 13417478, -7068443, -1147830, -1445793, 3955128, + 3919695, -253940, 4627291, -2199560, -6135898, -2088965, -3565897, 9423695, -2246268, 1563905, + -6043556, 3725347, -1064615, -1076963, 5517423, -2643016, 2048163, 4669703, 12664785, -4988605, + 3429532, -594853, -5464809, 603980, 303869, 1367410, 2151779, -1946694, 866510, -1626719, + 2307471, 16643, -125091, -1478006, 2687039, 585726, 580894, -1253594, 987843, -1072668, + 207769, -291521, 1006633, 1124208, -52613, -837519, 160524, 2396055, -1569274, -769336, + 15032, -1291175, 1316944, 822486, -59593, -732292, + }, + { + -9664, -23517094, -9799505, -4247186, 3219615, 1100049, -374199, 5675263, -4379256, 4082367, + 9725417, -5232881, -8624831, 10551661, -25918518, 7779797, -1208496, -1039919, -7329362, 27508728, + -3184718, -26907970, -992674, -10340671, -17249126, 1228361, 5494337, -9891310, 20205136, -463320, + 5020280, 9820980, -306553, 4505421, -11371463, -8316668, -3427921, -4695473, -3840775, 5603859, + 1642825, -3206730, -4514011, -2702608, -92879, 3187940, -4152160, -2010582, -1750736, -251256, + 4793184, 2248416, 576063, -4235375, 536871, -2316598, -850404, 2792803, -5376226, -143881, + 4288525, -2211371, -550293, 1582159, 3041374, 84826, 554588, -761283, 918049, 474057, + -1362578, -1200443, -1691680, 2511482, 1063004, 3003793, 881542, 796716, -775778, -1562831, + 739808, 445066, 194347, -1233729, -462246, -382252, 72478, -250182, -2268280, -1773822, + -1027034, 573915, 1345935, -447750, -1660542, -700080, + }, + { + 1937567, 118941600, 1022202, -11644193, -2388002, -3162170, -4014184, 536334, -3371013, 7323456, + 12834436, -5648956, -4379256, 10695542, -809601, 7010461, -13675713, 30925912, -11683385, 13911936, + 10363219, -9400610, 267362, 3360812, 2500745, 38118, 1036698, -7255274, 4231080, 6758131, + 6273337, 4751308, -7063074, -858457, 5906117, -835371, -4812511, 2538326, -591095, 13474923, + -4450123, -1878511, -1416266, 1816234, 485331, 1515587, -392453, 1293859, -812286, 8290361, + -1829119, -4386772, 2762201, -350577, -5343476, 1000727, -5931887, 2561948, 777389, 3029026, + 3153580, -52076, 1632088, 226023, 2995740, -804770, -1961726, 3546032, -611496, 3327526, + -2159295, -70330, -224949, -1904281, 988916, 829466, 751082, 949188, 4085588, 1883343, + 126702, 657130, -90194, 283468, 1509144, -1191853, 1063541, -24696, 2038499, 288300, + 156766, 1952600, -1085016, 1218697, -209380, 489626, + }, + { + -45678588, -44128640, 10628433, 34409132, 5835787, -745177, -9157944, 4833986, -1280437, 3360812, + -930934, 2972654, 4811437, 16109349, -1538135, -7986492, -729071, -5498632, -12572443, -4151086, + 9803263, -7451232, -11421392, 1995012, 7063611, -11684459, 2168959, -8459475, -7659001, -2239826, + -19864, -3331284, -8910447, -1887101, 8116415, 1930051, 2029909, -5294621, 1896228, 3794604, + 4788352, 6055367, -4977867, 2121714, 3272765, 7055021, -4117263, -2962454, 975494, -5338645, + 2333241, -2461016, 1357747, 5925981, -1385664, 2544768, 3243237, 947577, 568009, -1440425, + -3762391, 1258425, -4756140, 2083596, -2605972, -2375654, -118648, -253940, -1401233, -509491, + -4126390, -41876, 2034204, 943819, 824634, -1446867, 889595, -845572, -398358, -1324997, + -912144, 857920, 463320, -157303, 453119, 360777, -791348, -709207, 1722282, -1591285, + -550293, -203474, -618475, 676994, -603443, 1580548, + }, + { + 121870, 25420300, 1691680, 5995775, -364535, 111669, -416075, -1786706, 351650, -2005750, + -1787243, 9404368, -278636, -5587753, -4998805, 3760781, 13658533, 17971754, -42398308, -26657788, + 3672734, 11683385, 514859, 10097468, 6771553, 9503689, 24984898, -7558606, 5621576, -9732396, + -9992778, 824097, -12952011, -12065100, 2221572, -11084774, 3156264, -2987687, -4629438, -1999307, + -9615358, 1486596, -5813775, 4935455, -5266167, 10907069, -10669773, -3705483, 7247221, 1216013, + -2863670, 1777580, 2712809, 328028, -121333, -2015950, 565862, 1734630, -1257889, 2145336, + -4387309, -20401, 68719, -612570, 224412, -972273, 2238752, 2439542, -2091649, 523449, + 737661, -615254, 200790, -244813, -4756677, 752693, 1411434, -957241, -955630, -1073742, + -34360, -680752, 631897, 119722, -999117, 1804423, 239444, -237834, 173409, 237834, + 756988, 53687, -967978, 384936, 392990, -343597, + }, + { + -68103152, -103333152, 26877906, 5235565, 5888400, 1177895, -698469, 2565706, -9797894, 239444, + -10370735, 2648384, -6649683, 7663833, -10942503, -4999879, -7522635, -9658845, 552440, -7288560, + -4909685, 4958540, 1955284, 6874095, -1522029, 7583302, -8255464, -1814624, 10980621, 8808441, + 1576253, 1520955, 3655017, -8460549, -571231, 5134097, 8938364, 939524, -5752035, 367757, + 684510, 1108638, 8660265, -1329829, -4568235, 1884954, 2906619, 1648731, -2882460, 6937446, + -2401961, -3877282, -3066070, -156766, -5478231, 3074123, -3311420, 1598802, 433792, 8053, + 2488397, -628676, -2800319, -4964982, 244276, 3170223, -1686848, -619012, -62277, -814970, + -665183, 2660195, -536334, 2683281, 657130, -1074, 864899, 1378685, -437013, 791885, + -792958, 3318399, -1098438, 2301566, -1554241, -241055, -794569, 396211, -208306, -401579, + 112206, -457414, -1066226, 1049046, 641024, -492311, + }, + { + 91805, 323196, -1634235, -3000572, 2670933, 810675, 367220, -1403381, 45097, 1648194, + -2555506, 8738648, -2459406, 3803194, 11221676, 12912282, -5128191, -1125281, 9967545, 20077898, + 7207492, -4011500, 22267258, -27726698, -15967078, 15502148, -11545409, 5075578, -3041374, 3511136, + -1130113, -4571993, 11759620, -4125853, -9877351, 2978560, -5006322, -4857071, -7310571, 2741263, + -4869956, -26844, 3061775, -6756521, 928250, -1699196, -681289, -6283001, -117038, -2574296, + -1888175, 872415, -1534914, -3388729, -3083787, 3076807, 143345, -2981244, 263604, 2386391, + 3142842, 2035815, 2165201, 1444183, 2543158, 714038, -3726958, -587874, 529892, 724239, + -2255395, 214748, -1213865, 783295, -1433982, -2057289, -506269, 2139968, 1549946, 2006287, + 230854, -1479079, 604517, -601832, 858457, -218506, -122407, 2587181, -41876, -12348, + 2218351, -29528, -319975, 1035087, -147640, 470299, + }, + { + 52943524, -362089888, -18888730, -23886460, -21437256, -9076877, 3303367, -6510634, 7955353, -4357245, + -3146064, 6332930, 17403744, -14969572, 18952616, 1975685, 1386201, -4789426, -3047279, -5697274, + -3037616, 14843407, 19837380, 8062728, -12540768, -639950, -5699959, -6095096, 10864120, -1609539, + -8745090, -2309082, 2808372, -743029, -6656126, -14833206, -11566347, 2153926, 23085, 1724966, + -477278, -2684892, 3992172, 7072738, 815507, -1724429, -34360, -4838818, 1081258, -1049046, + -4039954, 3961034, 57445, 2108829, 10656351, -487479, -829466, -13959, -2855617, 2023467, + 198642, -346819, 2340757, -242666, -1338956, 1988033, 1153736, 367757, 1149978, 885837, + -1591822, 190052, -1487132, 823560, -843424, -355409, 1642825, -441308, 1502702, -864362, + -659278, -92879, -847182, -378494, -1408749, 820876, 2354179, 325881, -1551557, -1369021, + 1233729, -346282, 194347, 1454920, -719944, -688269, + }, + { + 50466, -12770548, -4178466, 3020973, 2096481, -134218, -1579474, 2911451, -8005282, 1589138, + 4154307, -408559, 671089, -3395709, -50422380, -3570729, -10361072, 10911364, -13589277, -5448166, + 1279363, -7765301, -930934, -15683073, -2754685, -15364172, 5741835, -1023813, 15346992, 5271536, + -8259759, 5707475, -1979980, 9997073, -1933809, 4044786, 3596498, 5391795, 4078072, -4209605, + -5484137, 1163936, -4799089, 7800735, -9197136, 171799, -5095442, 5495411, 2340757, -6219113, + 2185065, 4171487, -6553583, 3057480, -1289027, -2043868, -3209951, 2433636, 437550, -1060857, + -1905892, -50466, -519691, 3198140, 380105, -78920, 272730, -2233920, 75162, 1076426, + 1020055, -1920924, 3878892, 1210644, -2123861, 1865626, -298500, 379568, -2114198, -760209, + -219043, 1190243, 11274, -1032940, 2425046, -382252, 86436, -1488206, -301185, -613107, + 499827, 251256, 653372, 29528, -1268626, 979253, + }, + { + -127238, -237073600, 17135308, 1104344, 4847408, 18209050, -14892262, 9631464, 8661875, 8426726, + -15902116, -8023536, 6475200, 9812927, -4529580, -1083406, 18443126, 2520609, -4597763, -12343199, + 11593727, -3429532, -1261110, -3094524, 8792335, -6979, 8512088, 3593814, -4726075, 9528922, + -9444633, 3551938, -8005282, -1985886, 4080756, -943282, 4433480, 600759, -8386461, -1519882, + -3004867, -4305168, 7846369, 2659122, -3460670, 3972845, -1793149, -2596308, -1209033, 3308736, + -1978369, -153008, -3335579, 4369593, 3761855, -1495186, 163209, 510027, 542777, 4377646, + 3963181, 1779190, -2717104, -1504849, 4273493, 3576097, 461172, 2402497, -5869610, 1644973, + -275952, -183610, 3322694, 1640678, 2026688, -1704565, -5267778, 2632278, -823023, 558883, + 1697586, 3055869, -974421, -1850057, -1137093, -437013, 649614, 1416266, -554051, -1845225, + 1847910, -710817, 857383, -1767916, 432181, -652298, + }, + { + 3761855, -19571630, -11625940, 7412040, 12511777, -10275172, 4866735, 591095, 8740258, -8619999, + -234076, -16996796, 6030134, 2057289, 1672890, -12448963, 18246632, -139586, 264141, 5509906, + 7240241, 7505992, 1636383, -5213017, 3127273, -6462852, -3152506, 2626373, -2816425, 5003637, + 8334921, -6836514, 4473746, -1508070, 4912369, -4172561, -4223027, -130997, -5417028, -4991826, + -558883, 9082245, -2946885, -2295123, -1809255, -3881577, -5221070, -2753611, -3684008, -5932424, + -4379256, -1868311, 2434173, 250182, 1295470, 2148021, -1564442, -2426657, -388158, -255551, + 376347, -2471754, 3263102, -1650341, 631897, 3069828, 449898, -2949032, 1380832, -3410741, + -2464774, 194347, -2116345, -1465121, -863288, 417149, -455803, 306553, 2656437, -1868311, + 1501091, 224412, 77309, 2003065, 1381369, 419296, 863288, -670015, 650151, -1511292, + -498753, -822486, -191126, 569083, -514859, 1020592, + }, + { + 4200478, 154511456, -5863704, 6663642, -3105261, -10195179, 6263673, -4336843, 12731357, 12300249, + -525060, 8251169, 3666292, -3261491, -11432666, 9002251, 9448391, 4329327, 580357, -26884348, + 5429376, 958315, 1322313, -9157407, 19803020, 9683541, -6958921, -5206037, 2361695, -3412889, + 5363878, 4893042, -5244692, 1096827, -112743, -1056025, 8400419, 9625559, 2525978, 3054796, + 1837172, 8289824, 2344515, -11411728, 1028645, 314606, 6521371, -66572, 2287607, -345208, + -3285113, -3358665, -5733782, -151398, -652835, -3058554, -3561065, 1169842, -2884608, 615254, + -5628018, 1805497, 923418, 2653753, -2084133, 350577, -1687922, -1267552, 3789235, -4908074, + -3199751, 3541738, -687195, 1067299, -148176, 44560, 1648731, 19327, 1635309, 2003065, + 410706, -2078764, -599148, 244813, -2295123, -1246077, -1575179, -1216550, 796716, 716186, + -175020, 546535, 572304, 719944, 1326071, 273267, + }, + { + 293132, 51174536, -6075231, 5828271, -190052, -658741, -43487, -3668976, -3458523, 587337, + -500901, 2353642, 390305, 18515068, -25938382, -2484639, 14432164, 29425358, -5506148, 18283138, + 7357279, 8016557, -11180337, 3256122, 16699907, -18255758, 6921877, -3296924, -10763725, 17308718, + -11931419, 180389, -8641474, -326954, -3308199, -4304094, 8275865, 1699196, 14672682, -6724308, + 3233037, -5156645, 4142496, 713501, 246961, 5427228, 298500, -4890894, 594316, 8229694, + 2429341, -2943126, -4577899, 453119, -2145336, 2437394, -5121212, 3499325, -1627256, 2484102, + 2647311, 3103114, -4065724, -350577, -1403381, 1633161, -2865280, 2255932, -741419, -1945083, + 284542, 3266323, -37581, 1635846, 1525250, -1699196, -685047, -318364, 2558190, -2313914, + -1654099, -438087, 1826972, 559956, -52076, -216896, 590021, -810675, -69256, 299574, + -581431, 198642, -2959769, 1110249, -392990, -372588, + }, + { + -24217710, 80835576, 1757179, 1268089, -6035503, -4544613, 3256659, -6782290, -2739116, -1848983, + 3550864, -14289893, 2249489, 18786724, -15723338, -8109972, 29116658, 1845225, 3954591, -6534793, + 6766184, 1120450, -11564736, -6247030, -6127308, 9279277, -2062121, -5318244, 6890202, -13018583, + 2952253, -3073049, 1241782, 529355, 2714956, -6975027, -6162205, 11824582, 1745904, 4357781, + -3439732, -3124052, -1051193, 5848135, -309775, 7157563, 4068945, -7052873, 1388885, -2083596, + -6220187, 2821257, 1454383, -360240, 1875290, 1921461, 1956358, -121333, -5697811, 909459, + 3256659, 1744294, -465467, -3285650, 1511829, -319438, 3021510, -1640678, 2158221, 3776350, + -3403762, -1353452, -1438814, 2079301, 3712999, -656593, 2300492, 1190243, 894964, 1537598, + 925029, 891206, 2468533, 284005, 1338419, 301721, 1391569, -2381023, -337692, 1139777, + 647466, -605054, 1383516, -1296543, -348429, 359167, + }, + { + -6748468, -6373732, 9902584, 999654, 3952444, -2023467, 313533, 8749922, 991601, 3427921, + -2316598, -2672007, 398358, -10638634, -16207596, -11509439, 8579734, 13316009, 3617973, 13791677, + -23560580, -7784628, -17144972, 8673150, 1045288, -3540127, -1090922, 27213450, -10038412, 10609106, + -4664872, -15226733, 10965588, -8319352, 11950210, -10788958, -12664248, -3613141, -1077500, 7775502, + -12626130, 8308614, -9538585, -1498407, -6460168, -5360656, -615254, -349503, 4238596, -4015795, + -573378, -341987, -2647847, 3489661, 864362, 1347546, -2394981, 813359, -3705483, -3424163, + 1575716, -3805341, -2636573, -676457, 1525787, -198642, 2503429, -1360968, -3644280, -485868, + -602906, -4632659, -3207267, -28991, -1414118, 684510, 62277, -5906, -2725694, 2050310, + -814970, -910533, 639950, 797253, -1363115, 60666, 2119566, -489626, 934692, -11274, + -215285, -263604, -478889, -471373, 285078, 1722282, + }, + }, + { + { + 23896662, 80966576, -463320, -9268003, -523986, 257161, 6608344, -13535053, -5509370, -317828, + 3854733, -29631516, 3037079, -9165460, 7212861, -1562831, -5337034, 6140730, 4172024, -5422396, + 1563905, 1399086, -6669011, -16080358, -18839874, -6502581, 8579197, 2252710, -4609574, 1263794, + -11442867, 1713692, 3602941, 5325223, -1555852, 14011794, -4201015, 625455, 5184563, 904628, + 1204738, 337692, 1848447, -337155, -1900523, 997506, -4920959, 8178692, -1411434, 5621576, + -4072166, 379031, -723165, -3550864, 1418413, -2158758, -5895380, -7582228, 8526584, -3337190, + 2231773, -1091459, -3573413, 3452080, -23085, -1455994, 2972117, -2425046, -175557, -2574833, + 1976222, 1551557, 816581, -2082522, 996969, -144418, 600222, -1147830, 1137093, -938450, + 1185411, 1481764, 1227824, 1473174, -715649, -1312113, 574452, 2267743, -1149441, 478352, + -1080721, -1903744, 2043868, -238371, 65498, -633508, + }, + { + -501437, 15582141, 24834574, -11506754, -5811091, -190052, -796180, 9675488, -8579734, -5780489, + 664646, -10025527, -5405753, 26356604, -11957189, -5851893, -12786118, 1925756, -5503464, 13358422, + -3722663, -6371584, 8438537, -18352932, -10297721, 14784351, 12107513, -16888348, 6264747, -5992016, + 5669357, 10431402, 2415382, 3308736, -7733626, 632971, 8229158, 1812476, -6726456, -917512, + 2104534, 904628, 4475356, -731755, -1531156, 1779727, -512175, 362925, -374736, -419296, + -369904, 3013993, 8157754, 351650, 2016487, -3712462, -3838090, 464393, -5847061, 382252, + 5947456, 1080721, 1067836, 1464584, 2608119, -2113124, 1555315, 2974802, 1088774, -1387811, + -1214939, -1510755, -4948339, 232465, -1666447, 842887, 341450, -207232, -1217623, -1976759, + 1257352, 812286, 729071, -689342, 479963, -176094, 365072, 1181653, -212064, 515933, + -52076, 1350230, 1843615, 665183, -775778, -1205812, + }, + { + -736587, 90216864, -19402514, -6063420, 5615670, 1988570, -4541928, 5238250, -4060892, 4184909, + 10873783, -7164006, -4126390, 10475425, 6586869, 12183748, -14324253, 25603910, -23288386, 5119601, + 10487773, -11251204, -929324, -1902134, 3885872, 7169374, 2960843, -2126009, -446677, -783295, + -3741454, -5373541, -11150272, 572304, 2609193, -2829847, -977642, 3680787, -3360275, 8932458, + -9828496, -5419712, 4344897, 8141111, -2419677, -2598992, -928250, 3045669, -3970697, 10177462, + 1280974, -4466766, 3801583, -183073, -7046431, -1458678, -6819871, 3375308, 488016, 1392643, + 57982, -3380676, -541166, -1544578, 2128693, -59056, -1613297, 3303904, -366146, 2414309, + -3243774, 406948, 2724083, 283468, 1549946, -1059783, -1835562, -707059, 1502702, 117038, + -1510218, -285078, 462783, -839666, -105227, -912681, 1794223, -886911, 557272, 110595, + -1160178, 719944, -626528, 1657857, -948651, 299574, + }, + { + 58298812, 57195004, -24242942, 22104586, 4252018, 566399, -10430328, 12438225, 3631932, 12026982, + -5409512, -4827543, 6816113, 15484431, 2130841, 7094212, 10860362, 6495065, -5741835, -13617731, + 8646843, 2237141, -6779606, -3503620, 762357, -16370268, 1348620, -4668630, -3172907, 1763621, + -308701, 2042794, -3165928, -4011500, 8691940, 2698313, 6838125, 2368675, 8298951, 9451076, + 1379221, 2277407, -3903589, -1858647, -3280818, 8404714, 1149978, -1420560, -40802, -8917426, + 2758443, -3091840, -2147, 6865505, -1032403, -914291, 1362042, 1465658, 721018, 554051, + -1047435, 3284039, -4413079, 3155190, -493384, -1040993, 541166, -2369211, -2733210, 1447404, + -2418067, -1006633, 407485, 1123671, 748398, -2259690, -13959, -1811403, -109522, -30602, + -22012, 866510, 766652, 631897, 830002, 50466, -122407, -1484448, 417149, -1260573, + 135291, -180389, -1513439, -580357, -748398, 1489280, + }, + { + 683974, 24720222, 585189, 1209033, -3644280, -1540820, -9127, 3592740, 2436320, -967441, + -1310502, 3871376, -8846559, -10707353, -23123568, -36668820, -10760504, 48382808, 1902134, -7703561, + 2146410, -7965017, -9834401, 12262132, 9776419, -10833518, 6796249, -8307004, 8303783, -12857521, + -6138045, -1368484, -14644765, -7788923, 9879499, -9259949, -2062658, 2822867, -2770791, 2659122, + -6430103, 1374390, -2747169, 1012002, -10760504, 12597676, -6111202, -3999688, 3281355, 998043, + -1634235, -2488934, 1323924, 834834, 60666, -415538, 2469606, 3120831, -3632469, 2188823, + -3940096, -1612223, 1465121, 2024540, 1046898, -434329, 3634079, 2438468, -1594507, 1617592, + -2553358, -2490007, 1935957, 1304060, -3731790, 863825, 3235184, 388158, 159451, 255551, + 892279, -969052, -1872606, 353798, -139586, 1941325, 692564, -383326, 564788, 8053, + 870805, -307627, -1563905, -94489, 144418, 236760, + }, + { + 83838832, 31754840, -32850594, -3351685, 6442, -4241817, 6406481, 12093017, -20223390, 2241436, + -2004139, 12839805, 3910031, -4016331, -10750303, -2874407, -8952322, -683974, 11702175, 3905199, + 9809168, 5111011, -2811593, 8508330, -6250251, 6140193, -3358665, -3427384, 32212, 2325188, + -10041097, -10135586, 2294050, -8237748, -2616709, 4155918, 4424890, 1712081, -3144990, 1866163, + 2254321, -4101694, 3171833, -3001109, -4410395, 1461900, 1387274, 1461363, -5082020, 3670050, + -2848637, 1453310, 2505040, 961536, -5403069, 2782065, -2474438, 2495376, 78383, -812286, + 77846, -424665, 2457795, -301185, 532039, 1469953, -3448322, -2611340, 115964, 1641751, + -324270, 2374043, -1042066, 2609193, -408559, -1502165, -850940, -1270237, -223875, 1882806, + -1260573, 2479270, -2928094, 525597, 329639, 1191317, -972810, 568009, 572304, 782221, + -526670, -521839, -885837, -660888, -257698, -275415, + }, + { + 727997, 13659070, 7491497, -5888400, -1707250, -98247, -186294, -1604170, 699543, -4648229, + -7931194, 2825015, -10428717, -14629732, -5576478, -13342316, -36774048, -14545980, 1462973, 5684389, + 8253854, -1259499, 18698676, -26176752, -25363392, -307090, -23026930, -1276679, -2611340, 20869246, + 19149648, 6643778, 7991324, 3504693, -1689533, 7868917, 1112397, 534187, -2672007, 8749922, + -942208, 106300, 3841312, -4471061, 3651259, 155693, 2530273, -1469953, 2760053, 1909650, + 2657511, 3757023, 3718905, 2745021, -1096827, 2086280, -361314, 1064078, 3212099, -1836099, + -1243393, -3544959, 693637, 2690797, 796716, -77309, -1677722, 2804077, 3264712, 419833, + -4563403, -384400, -1685775, 814970, 1758789, -954020, -370978, 1026497, 102005, 501437, + -1804960, -1854352, 1897839, 238908, 653909, 120796, 355945, 2559801, 721018, 616328, + 666257, -607201, 881542, 1861868, 615254, 189515, + }, + { + -26340498, -444684256, 10086731, 6280853, -7044283, -2522220, -3153580, -9565429, 5073430, -2310156, + 7713225, -2059974, 5916318, 398895, 23066122, -6604049, -508954, -13381507, -8979703, 3237869, + -1374390, 9335648, 8740258, 566399, -12775917, 3256122, 2848100, -5221607, 3212099, 933619, + -4087735, -4741107, 1294933, 3200825, 1132798, -639950, 2624762, 10934450, 4404489, -386547, + 84289, 3255048, 4640176, 1255204, 1367947, 1382443, 4944581, -2044941, 752156, 871342, + -4876936, 4284767, -5110474, -4995584, 6219650, -4217121, 170725, 2065342, -1356136, 1401233, + -2379412, -3657165, -264141, -758599, -1359894, 2068027, 2884071, 410169, 120796, 1617592, + -2406792, -345745, -1625645, 2576981, 476205, -956704, 1672890, -644782, 1306207, -405874, + -1342177, 289373, 563178, 1084479, 290984, 951335, 2783676, 1327145, -1182190, -1237488, + 972273, 434329, 862215, 658204, -1788317, -542240, + }, + { + 1207423, 4853313, 5844914, 1469953, 4444218, -372588, -2459406, 3647501, -7957501, 1455994, + 233539, -3120831, 4624606, -9471477, -79541720, -28169616, -22041772, 9912785, -15952582, 12003360, + 10321880, -13095892, 1079647, 13442711, 22067006, -20137492, 5638219, 5275831, 4275640, 8200167, + -8804146, 1817308, -3661460, 2940442, 812286, 2317672, -6732361, -735513, -1174674, -3049427, + 528281, 3744138, -2841121, 8637179, -4919885, 7065758, -1217623, 3976066, 1059246, -2381559, + 4107599, 2648921, -5028870, 4758824, 1305670, 94489, -1859184, 2912525, -1142998, -4492536, + -5269925, 62277, 1014149, 2008971, -317291, 1953673, 397821, -1357747, -635655, -906238, + -142808, -2419140, 3560528, 613107, -2938831, 37044, -841814, -750546, -3575024, 773094, + 673236, -76236, 179852, -332323, 1767379, -2120640, 352724, 171262, -212601, -1101659, + -64961, -464930, -73014, -407485, -1482838, 1397475, + }, + { + 2336462, -282472480, -23712514, 9703942, -6271189, 25596932, 13389561, 22093312, 15164456, 18771154, + -8800388, 4212826, 18342194, 20233590, 4869419, 1282048, 21221970, 1704028, -1862942, -4147328, + 9889162, -223875, 6128919, -12242267, -5869610, -2378875, -3459059, -9098351, -11938935, 4311074, + -2061584, 7602092, -8888972, -1119913, 9425843, 181999, 4887136, 4671314, -8219494, -206695, + 8777303, 42413, 1532230, -2488934, -4261682, -3484829, 272194, -183610, -215822, 5043902, + 3072512, 6490770, -2646774, -4765266, -1466195, 1085016, 1352915, 2573759, 1479079, -100395, + 139586, -284542, -2841658, 1847373, 2386928, -1413581, -472983, 2792266, -3410741, 2637647, + -1079111, -463856, 2451353, 222801, -67109, -1372779, -2910377, 1927904, -1451162, 1383516, + 153545, 402116, -2705293, -1574106, -9127, 421981, 1589138, 1182190, -2219961, -3613141, + 1009317, -1777580, -972810, -2077690, 537945, -1000727, + }, + { + -3811784, 15006079, 13211319, -6893960, 3616899, -9544491, 10963978, 255551, -1944010, -13596793, + 4925791, 365609, 21508122, -578747, 9706089, -6295349, 2131915, -12528420, 10736881, 663572, + -12584254, 12414603, 12708271, -779000, 5480379, 1209033, -1901597, -583042, -7044820, -1950452, + 9361418, 1490891, 11833709, -1949915, -3710852, -6893960, -3745748, -1317481, -646929, -1228898, + 2583423, 16979616, 3112241, -601832, -3537443, -8404714, -7529078, 725850, 3781182, -555661, + -1582159, -1032403, 2707977, -421981, 936303, 3481608, -1267552, 192737, 2915209, -1331440, + -504122, -4547834, 171799, -4394826, -300111, 1890859, -1890859, -3654480, 3016678, 442382, + 81068, 915902, 615254, 1000727, -358630, 726386, -1630477, -1096827, 1078574, -2582349, + 2254858, 190589, -921807, 88047, 704375, -1385664, -1261647, -968515, 1745367, -314069, + 509491, 19864, -261993, -816044, -210990, 2185065, + }, + { + -37507412, 105477416, -7289097, -8720931, 17165910, 22918482, -874026, -2289218, 11272679, 1158567, + 2110440, 13123273, 2934000, -2060511, -16151225, 895501, 1339493, -2131915, 12867722, -23638964, + -6228240, 1324461, 8967355, -2187212, 18356154, 7523709, -7676181, -4979478, 6942815, -3820374, + -27917, -351650, -7985955, 2871186, -131533, 1337346, -3171833, -3521873, -3578782, 4649839, + 4879620, 6654515, 578210, -1935420, 7851737, 904091, 7467338, -3248069, 1056562, -921271, + -5722507, -2598455, -3543885, -2991982, 715112, 342524, -2915746, 3400004, -368293, 3030636, + -1680943, 2556579, -1307818, 3482145, -984084, -12348, 1351841, 1250372, 3073586, -2803003, + -378494, 2902324, -3452617, -2061047, -2048699, 229244, 1944010, 154619, 670015, 697395, + 126702, -1512902, 460098, 1861868, -1382980, -1029718, -848256, -224949, 571768, 688269, + -195958, 762894, 614180, -521302, 685584, -848793, + }, + { + 661425, 59564216, -5017596, 3427384, -120259, -6980933, -3511673, -1238024, -82678, 2699387, + 442919, 1024350, -11712376, 39505108, 13794361, 24220394, 13164075, 11959336, -12539157, 14471892, + -12950937, 10150081, 11264089, 3235721, 693637, -11558294, 9956808, -1465658, -4830228, 27070106, + -10604274, -3848291, 815507, 6296422, 264677, -1236951, 12269111, -3553012, 11398306, -2354716, + 4369593, -6463926, -293132, -3721589, -1902671, -2247342, -1451699, -4510253, 2686502, 9018894, + 2595771, 4489852, 2388539, 2666101, 1355599, 5487895, 1269163, 7049652, -1717450, 2503429, + 820339, 6906845, -694711, -2043331, -1546188, 1808181, -1692754, -4832, -3855807, -2328946, + -4063039, 3307125, -768262, -1107565, 2990908, 1138703, 306553, -534723, 1216550, -2387465, + -648003, -760209, 479963, -573378, 811749, 963683, -141734, -2957622, -979253, 1265942, + -650151, 87510, -1480690, 893353, -1196685, -156229, + }, + { + 7981660, 132276936, 7296613, -8116415, -14487998, 144955, 525060, -8977555, 4934918, -3832185, + -8246874, -31431644, -14924474, 11186242, 4321274, -10148471, 19498078, 1475858, -4802311, -10710575, + 12265890, 9183714, 1631551, 7774428, 6305549, 10859825, -3171833, 165356, 25703768, -9456444, + -5878737, -10200547, -1085016, 1142461, 260382, -12554189, -16683800, 7142531, 6502581, 13473849, + -606664, -1682017, -4898947, 1547262, -6449967, 965294, 6367289, -6704444, -2532420, -681289, + -2767570, 3264175, 3138011, 1478006, -1012539, 343061, 2347200, 1306744, -5953899, -1516660, + 2178085, -233539, -128312, -1488743, 2740189, -1156420, 2269890, -1759326, -201327, -1816771, + -2797098, -1002875, -3672197, 1052804, 1796370, -1477469, 2321430, -847182, -1701881, 855235, + 1664300, 379031, 57445, -1868848, 73014, -1970316, 556735, -1808718, 573378, 2705830, + 1734630, -1355062, 622770, -1080721, -19327, 1125281, + }, + { + 6345278, -21509734, -15453292, -726923, -3018288, -7050726, -816581, 11176042, 2983929, -4022774, + 185757, 2015950, -2005750, 30765924, 41871636, -6926709, -14569603, -599148, 958315, -21094196, + -30575336, 24942486, 407485, 10233833, 921807, 497142, -187368, 18041010, -11150809, 13028783, + 19628000, 6900939, 13267154, -11366094, 6185290, -4100083, 974421, -7485591, -6013491, 14772003, + -7129109, 11894375, -5181341, -3891240, -9031779, -6753299, -2362769, -5060545, -2567854, -5145908, + 602906, 3959960, 4031901, 674310, -7980586, -2633352, -3940633, 1942399, 2665027, 5054640, + 4095788, -1872606, -2843268, 220117, 3658775, -435402, -60130, -2857227, -994822, 1520955, + 398895, -1058173, 338229, 1129040, 99858, 319975, 196495, 582505, -1955284, 1913945, + -3442953, -1466195, -219580, -803159, -1115618, 193810, 336618, -1753957, 1365800, -150861, + -434865, 157840, 121333, 518080, 647466, 399969, + }, + }, + { + { + -17324288, 56052008, 12095702, 4318590, 6069863, -201327, -5438503, -10343892, -6130529, -6373732, + 7749195, -11916387, -10055055, 4184909, 8159901, -8177618, -10258529, 3770445, -1098438, 7880191, + -12135430, 6328635, -9965935, -10165114, -12592844, -3105798, -1432909, 37044, 7791071, -2324651, + -4396436, -3300146, 2195265, 11328513, 734976, 4927401, 1440962, -3810173, 6929393, 2666638, + -2815351, 5336497, 128312, -4922033, 2303176, -1588064, -3852586, 3586298, 1453846, 6081674, + -1643362, -2825552, 1020055, -2339684, -900869, -3292093, -6164352, -6451578, 4210142, -2425583, + -785442, 1295470, 309775, 1281511, -313533, -3138011, 1079111, -562641, 1321239, -1660542, + -493921, 3180423, -1664300, -1071058, -514859, 550293, 211527, 239444, -977642, 245350, + -380641, 3441343, 1207960, 656056, -907312, 215285, 853088, 168041, -703301, 1101659, + -1002338, -1754494, 1793149, -758599, 527207, -910533, + }, + { + 1228898, 34475704, 9248138, -16758962, 1941862, -1372242, 1067836, 3345243, 1199907, -13589813, + -3801046, -7341710, -3453154, 11908871, 6648073, -7826504, -12831215, -8491150, 22434224, -13544716, + 231928, 10585484, -4570382, -6248641, -8933532, 1614371, 8693014, -10276246, 1528472, -5837935, + 9386651, 1148904, 12039867, -2421825, 2309619, 622233, 5942088, 6343130, -7463580, -2863133, + 6495065, -1452773, 5857262, -7255274, -1703491, 3492882, 7754564, -1290101, -2980707, 241592, + 401579, 2257542, 7801271, 2820720, 809601, -816581, -4918275, -5941551, -1505923, 968515, + 5305359, 2773475, 379568, 1153736, 2663417, -2600603, 1711545, 4161287, 1166621, -1751810, + -2277943, -1542430, -2974802, -2022930, -813896, -854699, -699006, -76773, -226560, -1068910, + 1582159, -301721, 528818, 491237, -245350, 329639, 114890, 1373316, -579284, 1288490, + -173409, 1248762, 846109, 1209570, 210990, -995359, + }, + { + -350577, 37980396, 16942036, 11448772, -9852655, 2651606, -946503, 4486630, -856309, -7214472, + 19141058, 1015223, -11608760, 4727686, 13351980, 4757750, 6481106, 8024610, -15163919, -2884071, + 4574677, -10604811, 9277129, -3749507, -4944044, 10181757, 1764158, 6805913, -11003706, 597000, + 5771363, -15730855, -9232032, 6260452, -8739722, 3942243, -3790309, 4434554, 100395, 233539, + -7592966, -5462662, 2563022, 8689793, -1770063, -2316598, -1917703, 6418292, -5193153, 2423435, + 2262374, 2603287, -1597191, -1448478, -2330020, -4141422, -4398047, 2633352, 363998, 3640522, + -2627446, -2900714, -1746978, -1196685, 2338073, 410169, 530428, -722628, 971200, 1206349, + -1181116, -1471026, 3050501, 425202, -166430, 138513, -906775, -1241246, 883690, 147103, + -1110786, -309775, 827855, -781684, -1674500, 1071594, 1277753, 445066, -2364380, 882079, + -564788, -238371, 777389, -17717, 203474, -225486, + }, + { + -57569740, 161161136, 25106232, 2588255, 10419591, 3792456, -3514894, 1799591, 4682588, 21961242, + -4878009, -10611790, 8475581, 3145527, 12140262, -237297, 16168941, 11412265, -7714298, -4307316, + -3259880, -4878009, 3579318, -6918119, -482110, -4782446, -15777562, 1318018, -2896956, 4344360, + 2944737, 6042482, -865973, -219580, 1501091, 6155762, -325881, 6721624, 1398012, 16020228, + 3302293, -4361003, -1002338, -7560216, 525060, 2545305, 9488120, -2439005, 1498407, -5936182, + -2480344, 406411, -137976, 2890513, 242666, -2147484, 921807, 4308926, -872952, 140123, + -573378, 3226057, -878858, -514859, 2754148, -2451353, 1883880, -2469069, -2313914, 2103997, + -418222, 364535, -1702418, -507343, 493384, -383326, -603980, -858457, -471373, 248034, + -626528, 390305, 1451162, 731755, 241592, -278099, 514322, -1815697, -946503, -96637, + 728534, -738734, -949188, -1052267, -278099, 1341640, + }, + { + -1517197, 24329380, 1747515, -4476967, 2338073, -1446330, -220117, -201327, 3684545, -2695629, + 5235565, -3624953, -2210835, -19344532, -27577986, -22477174, -10798622, 6065568, 32533304, 2389076, + 6184216, -15871515, -16125992, 16403554, 410169, -13634374, 15105937, -4901632, 13273596, -21458194, + 3007551, -2895882, -23934242, 8011188, 6737193, -7334194, -2616172, -463856, 1967632, -884763, + -500901, 649614, -682363, -5985037, -3009698, 19327, 1732482, -4314295, 1745367, 1356673, + 267362, -1563368, -1553168, 2592013, -1037772, 2984466, 2332167, -368830, -5063767, 1641751, + -412317, -1891933, 2599529, 3489124, -514322, 893353, 2656974, 1989107, -252329, 1158567, + -3385508, -1822677, 1401233, -116501, -1166621, -3758, 2086817, 1067836, 1619740, 1112933, + -1738388, 29528, -1682554, -169114, 887448, 1883880, 868657, -549219, 184684, 256624, + 590558, -217970, -478352, -854162, -493384, 94489, + }, + { + -80380312, 185176976, 12917651, 10482941, -2392834, -3777961, 4196720, 6613176, -15551003, -3732864, + 8893267, -8194798, 20619064, -17981418, -2069101, 1650341, -15814606, 1476395, 7675107, 13024488, + 10334228, 6100464, -4952634, 4663261, -1222992, 3841312, -1020055, -1077500, -6142340, -4766340, + -5558225, -13212393, -711354, 3474092, -5454609, 5160403, -3278671, 1409286, 1707786, 4137127, + 1053878, -3168075, -176631, -1785096, -5778342, 584652, 2604361, 387621, -6628745, 1862405, + 2571612, 79994, 5491653, -2114198, 1735167, -1979443, 1111860, 357556, -1492501, -686121, + 290447, -1279363, 2892661, 3289945, 850404, -2480344, -429497, -1060857, -1541893, 1095217, + 920734, -162672, 2839510, -505196, 110059, -890669, 91805, 130460, -1540283, 1014149, + -1013612, 1188095, -1321239, -1694902, 1762547, 643171, 143881, -473520, 1275068, -607738, + -1156420, 1341104, -485868, -921271, -957778, 885300, + }, + { + -179315, 16481400, 6658810, -369904, -3853123, 52613, 525060, -2555506, 2982855, -10464688, + -3416647, -5111548, -3197066, -15870978, 10407243, -10088878, -46981036, -5934034, 8942659, -10550587, + -3502546, 16521665, 1970316, -27482422, -13063143, -9928354, -4163971, -14239964, -2030446, 26383984, + 21106006, 7015292, -141734, 3600793, -200790, 7961796, 520228, 3984119, 620623, 5441724, + 855772, 1080721, -4923643, 922881, 6360847, 559956, 699543, -882079, 3854733, 3373697, + 2565706, 2082522, 4152697, 2216740, 106837, 860604, 319438, 910533, 6772090, -983548, + -2217814, -4388383, -2694555, 3117610, 27917, 443455, -1322313, 2564096, 3602404, 172872, + -5186710, -2455648, 949188, 355945, 2063732, 1074, 896038, -1205812, -76773, -60666, + -388158, -847182, 703301, 1584306, -1355062, -216359, 3004330, -604517, 918586, 2403571, + -960999, 225486, 609885, 818191, 1332514, -531502, + }, + { + -5526549, -455288000, -10961830, 5365488, 469225, 5386426, -15369540, 1637993, 145492, -2521683, + 6848326, 22012, -9635759, 11234024, 9285719, 5750961, -13300440, 5060009, -15069430, 3224447, + 2514703, 3686693, 6695317, -1343788, -7131257, -3876745, 5602248, -329102, -5334350, -2427194, + 3707631, -1512365, 1695438, 3622268, 2910377, 7836705, -751619, 8611946, 2296197, 299037, + -3347927, 5425618, 3906810, -140123, 1680943, 4746476, 7661148, -5229660, -3618510, 5976984, + -6971806, 4253092, -4795868, -3238405, 2344515, -4406637, 1117228, 489626, 2276870, -401579, + -1991254, -5332202, 1284732, -1573032, -1319092, 3664681, 2595771, 794032, -862215, 2803540, + -3868692, -501974, -399432, 2448668, 943282, 1611, -214212, 549756, 463320, -92879, + -1425392, -729608, 1030792, 1066226, 1961726, 1711008, 380641, 1000191, 37044, -601295, + 780073, 37044, 731755, -327491, -1184874, -660351, + }, + { + -45097, 14008036, 960462, 1760400, 5891622, -1309965, -531502, -2426120, -1785633, 1186485, + -3452080, 1274532, 1938641, -18181670, -72552200, -21399138, -14194330, 6803228, -18963354, 20048908, + 9846749, -15232638, -11144903, 27202176, 307090, -3878892, 4237522, 7381975, -1860795, 18491444, + -17242684, 3989488, 4511327, -2622615, -2560338, 6970195, -3928285, -5327907, 162672, -1129576, + -3405909, 5958194, -430034, -1394791, 6413460, 2842732, 1124208, 1104880, 1918777, 4014184, + -20401, 1316408, -1777580, 1880659, 1588064, 2487860, -4453881, 4097936, -2263985, -281320, + -7467338, 1083406, -1313723, 4413616, -124554, 649077, 274341, -1580011, -26307, -3016141, + 344134, -134755, 251256, 1656247, -743029, -3004867, 1268089, -1960116, -1769527, 984084, + 939524, -1386201, -612033, 499290, -292595, -30065, 630823, 452582, -1238561, 259846, + -1123134, -407485, 566399, -1707250, -318364, 1337882, + }, + { + -4174708, -295596288, -14305999, 20425254, -11135240, 2222646, 19961934, 21861384, 23863912, 13227426, + -1001264, 4084514, 17186848, 8201240, 1243393, 19878182, 15861851, 9575093, 3878892, 1227287, + -9169218, 844498, 3592203, -9352828, -10604274, 13081397, -14694694, -14629195, -13321915, 6182069, + 2459943, 3091303, -5228586, 2706366, 5139465, 3321620, 13002477, -4814122, -7247221, -7527467, + 17809082, -571768, 4188130, -9969156, 5635534, -6333466, -800475, 780073, 112206, 1256815, + 10077604, 2508798, -3042448, -5281199, -1670742, 1193464, -578747, 5026723, 1107565, 1186485, + -213675, -5818607, -991064, 3160559, -469762, -1716913, 3171297, 275415, -2150705, 1690607, + 2112050, -1474784, -620086, 2013803, -1697586, -228707, -1155883, -1040456, -542777, 2313914, + 184147, -1117228, -1263257, -653909, -882616, -1264331, 1301375, 969052, -1645509, -171799, + -2024003, -787053, -1923072, -417149, -1504312, 943819, + }, + { + 3233574, 38340100, -7834557, -4478577, -6242735, 5730023, 2806761, -964220, -3849901, 1285806, + -2718714, 8073465, 7461969, -845572, 20523502, -6398965, 10097468, -22820772, 7559143, 4299799, + -11896523, 6198712, 19189378, -4578972, 9887015, 899259, -2710124, -6658273, -3358128, 5565204, + -583579, 2639258, 12963822, -739271, -14231374, -75162, -623844, -3875671, 7095286, 756988, + -1037235, 9604621, 4053376, -712965, -1075352, -4628364, -6950868, -3326989, 3821447, 3362423, + -2770254, 536871, 4171487, -2861522, -472446, -11811, 3935264, -624381, 5405753, -3808026, + -1437740, 1630477, -3310883, -3621194, -1719061, -1973001, 184147, 792958, 610959, 608812, + 679142, -250719, 2473901, 1249836, -389768, 357556, -701153, -934692, -251792, -968515, + 1537598, -1028108, 202937, -1345935, 1185948, -2618856, -488016, -996969, 2149094, -89657, + -482647, 891743, -725313, -1371168, 1067299, 1538135, + }, + { + 56414932, -4102768, -17590576, -20058572, 20212116, 44369160, -22744000, 6284611, 7622493, 603443, + 11537356, 995896, -4124242, -6770479, -8813273, 1712081, 6451041, -10615012, 10223633, -9370008, + -11456288, 3558917, 12150999, 5238250, -5034776, 8333847, -2132451, 2572686, 2492155, -3016678, + -721018, -1154273, -2401961, -2685428, -3853123, 17904108, -12378633, -8043937, -4474819, 7780334, + -1075352, 14395120, -8504572, 3133716, 6689949, 3098282, 1306744, 2353642, -1139240, -1429687, + -1283658, -3280818, -6720013, -1200980, 1313186, -2762738, 3904125, 1034550, 2462090, 272730, + 2748242, 162672, -1185948, 756451, 885300, 2025077, -346282, 2209224, -625455, 1497870, + 138513, 535797, -307090, -2689187, -2355790, 1064615, 960462, 451508, 615791, -1390496, + 280784, 176631, 712965, 1119913, -1537598, -337692, -1413581, 421981, -379568, -56908, + 815507, -401579, 1218160, -809064, 486942, 75162, + }, + { + -1409823, 50133004, 1138166, -2322504, 8616241, -13030931, 2786897, -1040993, -569620, -2821794, + 1387811, 2237141, -13123273, 23868208, 3273839, 45230300, 3412889, 15409806, -3565897, 4364224, + -19926500, 6277095, 37979324, 2891050, -20794084, 18295486, 11141682, -15384036, -1954747, 13925895, + -541703, -2753611, 12618077, -4473746, 5556077, 3240553, 1621887, 4065724, 4182225, 7309498, + -3129421, -129923, -6866042, 1920924, -3406983, -7924752, 4414153, -3595961, 5687611, 448287, + 3795141, 7416872, 5974300, -3896072, 5879274, 3834869, 6517613, 2192581, 375810, 1409823, + -2146410, 6187974, -752693, -3862249, 1311039, -333397, 2201171, -2442763, -2942053, -2621004, + -4570919, 4223027, -2128693, 329102, 2010045, 12885, 1435056, -1264868, -237297, -664109, + 1005559, -588947, -1012002, -284005, 45634, 1764158, -1624571, -1304060, -570157, -377957, + -265751, -396211, -93952, -126165, -55298, -425202, + }, + { + 13532905, 125903744, -1050120, -10870562, -4846871, 3501472, -219043, -9416716, 2963528, -4645007, + -13954349, -31478352, -14143864, -10257993, 30579094, 4049617, -3926674, 1445793, -10356777, 1126892, + 7894687, 5289252, 9024800, 3963718, 17291538, -8538395, 10099616, 4687957, 19019188, -2019708, + -11676942, -8969502, -106837, 127238, -1695975, -4821101, -11820824, -1946157, 4502200, 7997229, + 11221676, -4231617, -6999186, 3689377, -10331007, 1968706, -1305133, -7128035, -4730907, 2173254, + 2124398, 4901095, -392990, -1100585, 1954747, 22549, 237297, 1748052, -5085778, 2011655, + 1088774, -2332167, -165356, 313533, 3809099, -633508, -757525, 766652, -1297080, -5954972, + 1206886, -2627446, -2817499, 972273, -275415, -248034, 1307281, -461709, -777926, 791348, + 373662, 622233, -1049046, -1848447, -744640, -1286880, 11274, -439697, 747324, 1700270, + 768262, 133144, 24159, -1184337, 577136, 576063, + }, + { + -6078990, -28567974, 3081102, -2595234, -2485176, -5553930, -7347079, 3721052, 5689758, 1557999, + 834834, 1059783, -12494597, 1388885, 60332480, 27766426, -11427297, -9888625, 3419868, -44259636, + -7432978, 27830314, -4121558, -4296041, -1358820, -2082522, -1400696, 3102040, 18892488, -6591164, + 21298206, 17507898, 1517197, -4384088, 6538551, -6015102, 2704756, -841277, -4677757, 3341485, + 2789045, -414464, 6396817, -13489955, -5447629, 58519, -5015448, -1379758, -9785546, 1639604, + 1908039, 2195802, 5738077, -806917, -7543573, -2830384, -6657200, 3504157, 5450314, 3628174, + 3860639, 717260, -2892124, -707596, 1133871, -15032, 2827699, -7970923, 2986076, 2165201, + -886911, 696858, 1950452, -861678, -190589, 1863479, -8053, -3280818, 1001801, 906238, + -2521683, -1557463, 104153, -1767916, 1152662, -542240, -122943, -134218, -243203, -38118, + 173409, -77846, -16106, 1341104, 423591, -312459, + }, + }, + { + { + 12887049, -72975792, -120718112, -22524956, -4416837, 22549, -2949032, -4109210, -4001299, -17400524, + -4450660, -7093139, -10411001, 5583995, 12326556, -4440460, -13365938, -2685428, -8637716, -17717, + -16056198, 8545374, -5465883, 612033, 6642167, 9731322, 2165201, -5140539, 9374303, 1723893, + -6667937, -4219806, 2068027, 5226975, -2314451, 5211943, 3074660, -2282775, 6460168, 6833293, + -1395864, 2920578, -736587, -3078955, -2192581, -6285685, -824634, 1305670, -663036, 2188286, + -7093676, -4348118, 1864016, -530428, 3505767, 517544, -4029753, -5508296, 1088774, -6366752, + -3735011, 3166465, 2861522, -1073742, -3941169, -5909338, -449361, -852551, 874563, 547608, + -354872, 1381906, -1833951, -449898, -761283, -230318, -951335, -100395, -1440962, 324807, + -1520418, 617938, 157840, 1900523, -486942, -433255, 471910, 183610, -646929, 758599, + -74625, -932545, 1005559, -823023, 481573, -775242, + }, + { + -1583232, 22929756, -3338800, -6072547, 14109504, -2315524, -3069291, -4051228, 1609002, -13014825, + -1565516, -6819871, 355409, 16518981, 15650324, 13440563, 1970853, -11413339, 18708878, -11174968, + 6369437, 17743584, -7722888, 2460480, -8755828, -14777372, -1235877, -10014253, 10121090, 3515431, + 8574902, -4121021, 16444356, -3636227, 698469, -5133560, -1634235, 11142219, 2438468, 113280, + 4245039, -2871186, 4949950, -4766877, 678605, 675921, 5896990, 3814468, 1129576, -621697, + 1174137, 672162, 2959769, 735513, 4967667, 5769215, -2296197, -5964099, -2270964, -190589, + 1739462, 1832340, 1292248, -7516, 1651952, -3076270, -1251983, 863825, -243203, -2509872, + -1101122, 2208687, 1614371, -1854889, -1521492, -719407, -529355, -35970, 584652, -104153, + 831613, -348429, 373125, 582505, -472446, -475668, -453656, 1114544, -1161789, 665720, + 40265, 374199, -1037772, 256087, 823560, -92342, + }, + { + 1445793, -9406515, -14003741, 25727928, -838592, 3862249, 3030100, -1719061, -7057705, -1203128, + 16152298, 6793565, -6359773, -10921565, 8607651, 8906688, -129386, 2507724, 1035087, -1714229, + 6547678, -7406671, 11376295, -852551, -17726940, 5582921, 5238787, 3171833, -12887049, -3831648, + 4448513, -10146323, -4530654, 7492571, -3995930, 6949257, -2486249, 935229, -4466766, -1534377, + 925565, 28454, -2953327, 2663417, -2018098, -2093797, -5388574, 3249143, -3625489, -881542, + -2541010, 1118302, -3215320, -634045, 1791538, -517007, -2187749, 2051921, 1216013, 3685619, + -1681480, -2609730, -1342714, -940061, 88584, -1287417, 784905, 328028, 1092532, 719944, + 415001, -2449205, 548682, -242129, -181462, 461172, -150324, -1474248, 153008, 1833414, + 1745904, 863825, -174483, -430034, -518080, 1350767, -82141, 539555, -1445257, 1602023, + -383326, -1297617, 731218, 509491, 819802, -581431, + }, + { + 42465416, 233372416, -26936424, -14180371, 243203, 6526203, 5468030, 52613, -7582228, 12502650, + 5865852, -11312407, -4605816, 98247, 14243185, -8321499, 9579388, 15876883, -7718056, -4854924, + -5122822, -11389716, 5753109, -3765613, 584116, 13720810, -2822331, 6899865, -1287953, 2385318, + 4531191, 5237176, 1432909, 1329829, -4032438, 5961952, -5106179, -53687, -4052302, 4174171, + -914291, -2254858, -354872, -1552094, 3142842, -4086662, 9354439, -1134945, 3907347, -536871, + -2779381, 3162707, 727460, 176094, -2028298, -4973036, -47782, 1421634, -2320893, 656593, + -1861868, 3935801, 469762, -1832340, 2774012, -1583769, 1734630, -834834, 410706, 3078418, + 1272921, 3015067, -62277, -1154809, 332323, 900333, 563714, 578747, -198642, 387621, + -140123, -552440, -540629, 294205, 379031, 412854, 760209, -1407139, -783832, -324270, + 138513, -657667, 223875, -549756, -322123, 915365, + }, + { + 1934883, 25403120, 416612, -7817914, 1266479, 845035, -1192390, -3255585, 2939368, -1072668, + 4835597, -6521371, -2776160, -15808701, -24520506, -6202470, 16996260, -24087250, 11104638, 15093052, + 1025960, -6691559, -10634339, 283468, 3919158, 2323041, 21239688, -3917547, 10529112, -14497125, + 4643934, 4220342, -5655398, 10245644, -3094524, -6691022, -2705293, -4527970, 3045669, -2056753, + 3622268, 2239826, -5383205, -7596187, 2437931, 2827162, 1887101, -6254010, 2925410, 1693291, + -271120, 77846, -2174864, 1648731, -75162, 3198140, 752156, -273267, -3129421, 3057480, + -235149, -1363652, 2521146, 2514703, -3134253, -1052804, 1817308, 1805497, 307627, 700617, + -2172717, -1286880, 454730, 112206, -949725, -1738388, -385473, 286152, 281320, 762894, + -802085, 1414118, -790274, 434865, 624381, 812286, 528818, -153008, -588947, -700617, + 310848, 739808, 843961, -783295, -885300, -434329, + }, + { + 56828324, 296987328, -36104032, 41038948, 16384763, 3805341, -7573638, -5905043, -4612258, -9688372, + -3040837, -9927817, 23047868, -24350318, -8237748, 11729556, 3498251, 7102266, -637803, -5603322, + -7534447, 4939750, -1962263, 2389076, -6832756, 3679713, 2903398, 5808944, 2137820, -5535139, + -2537252, -861678, 1949378, 1173600, -1620813, 6448894, -8459475, -5832566, 774705, 3603478, + 3038689, 5910949, -717796, -3992172, -2560338, 8689793, 6174016, -1309965, -3553012, 1165547, + 3655017, 1731409, 5987722, -1932735, 2095944, 996969, -58519, -2660195, -3270081, -2091649, + -823023, -2590402, 3520800, 2040646, 1159641, 998580, 2418604, 1471026, -1523103, 73014, + 1182727, -1055488, 3435437, 1235340, 1796907, 503585, 156766, -23622, 91268, 1597191, + -1224603, 1088774, -1428614, -2207613, 503585, -372052, 377957, -468688, 1745904, -228170, + -578747, 2248416, 156229, -8053, -358093, 396748, + }, + { + -319975, 5053566, -1145683, 6100464, 1882269, 550293, -212601, -2705830, 6053757, -1173063, + 4747013, 804233, 2586107, 9740986, 48348984, 42000484, 2048163, 10278394, 7437810, -15433428, + -4773856, 12999255, 22180284, -11921219, -12042015, -7844758, -2651069, -5324149, 11723650, 10171556, + -3951907, -4772783, 2092186, 6089190, -6307697, -489626, -2694555, -148176, -2262911, 85362, + -9127, 1649804, -5985574, 1906429, 3164317, -4338991, 1615445, 2297808, 1356673, -1290638, + -1963874, -2492692, -69256, 2376728, 476205, -256087, 970663, 2523830, 6380174, -755377, + -85899, -847719, -1025423, 2082522, -1467805, -659278, -3029563, -635655, 878858, 1648194, + -2484639, -1480153, 937377, -502511, 869731, -259309, 1633698, -1722819, -287226, -860604, + 209380, 1068910, 287226, 1068910, -1258962, -1318555, 1925219, -1501628, 765041, 2798171, + -840203, 627065, -257161, -762894, 851477, -853625, + }, + { + 34224448, -402438432, -7570417, -22028888, -19703700, 5527623, -5826660, 8591545, -61740, -6102612, + -9154723, -6177774, -10000294, 19183472, 4323959, -11729556, -6727530, 23877334, -6138045, -2099165, + -1807644, -5223217, -3293703, -2913599, 2178622, -1806571, 294742, 82141, 2091112, 4459787, + 5788006, -3410204, 3309809, 5833640, 3410741, 10162966, -5930276, 3627100, 799938, -839129, + -860067, 4131222, -94489, -2556579, 2130304, 6555194, 5267241, -2323577, -857383, 956167, + -9337259, 6821482, -205085, -3312494, -2862596, -7892540, 824097, 1513976, 4935455, 5355824, + 3868692, -3219615, 129923, -2956011, -1469416, 962073, -1813550, 724776, 1368484, 2333241, + -3142842, 1709397, -1295470, 503585, 1193464, 47245, -471373, -485868, -121333, 1249836, + -879931, -1008244, 871342, 287226, 1309428, 935766, -1360431, 373662, 910533, -363462, + -109522, -1392643, -839129, -860067, -437550, 334471, + }, + { + -1137093, 462783, -8287140, -2235531, 1086090, -740345, 459025, -1924145, 120259, 1263794, + -3584150, 1203128, 5587753, 15146739, -37127308, -396211, 10944114, 18895708, -24641302, 280247, + 1470489, -12248173, -2707440, 7558069, -32755568, -6077916, -8310225, -4700842, -3739306, 17119202, + -5486821, 12056510, 7006166, -5074504, -6833830, 10493142, 4480188, -5016522, 2172717, 6068252, + -5756330, 165356, 2693481, -3382824, 3251290, -56371, -100395, 3242700, 4970351, 4227322, + -1236951, 3627637, -1786706, 2305861, 3511673, 3609383, -4796405, 843961, -2695629, 4584878, + -2345589, 4206921, -2775086, 2019708, 549756, -354335, 1031329, 811212, 1537598, -2696166, + 1149978, 1689533, -1148904, 1178969, 404801, -1752347, 2196339, -1937567, -624918, 558346, + -439160, 981400, 1321776, -780610, -1527935, 627602, 689879, -33286, -366146, 1364726, + -1781875, -472983, 1328756, -744103, 518617, 186294, + }, + { + 6179384, -260080128, 16902844, 2930778, -25273198, -19360638, -956167, 5343476, 6026376, -5240397, + -7749732, -5337034, -5131412, -6189585, 6012954, 30380988, 16909286, 2078764, 7035694, 7521562, + -15337328, -5142150, 4922570, -2011118, -10555956, 9986336, -10830297, -6861747, -15781857, -311385, + 6419366, 4436701, -3690988, 11741904, -2639794, -5277978, 10274636, -5359046, -2792803, -2887829, + 14363444, -5373004, 8511015, -3735011, 7022809, -10089952, -1501091, 2948495, 1658394, 259846, + 2610266, -2414309, -2161442, -4977330, -953483, 1085553, -4151086, 2922725, 1976222, 1619740, + 94489, -5564667, -151934, 2299418, -68183, 96637, 193810, -922344, -1628330, 16106, + 1340567, -1727114, -358093, 2541010, -1914482, 136365, -1531156, -1813013, -937914, 1458678, + -581431, -443992, -582505, -1523640, -2023467, -2115272, 563178, 1275605, -98784, 1481227, + -1303523, 745177, -617402, 223338, -702227, 1675037, + }, + { + -2336999, 53791244, 11376295, 1581622, -2857227, -792421, -8495445, -1511292, 7205345, 10373957, + -10849087, -939524, 10756209, 9453760, 27791122, 3073049, 22469658, -4916127, -6529424, -8811662, + 5076115, -1225139, 9375914, -1387274, 13390097, -1704565, -5021354, -11088532, 1833951, 9859634, + -1343788, -4101157, 821413, 666257, -13331578, 1192927, 5225365, -4783520, 2953864, -869194, + -681289, 2278480, -5094905, -6187974, -1097364, 3484829, -5249524, -5806259, 7252053, 9571335, + 727460, -1987496, 4759361, 1249299, 78920, -3374234, 1964948, -1728188, 3299072, -1072131, + 2795487, 662499, -5278515, -1313186, -1194538, -391379, 1976759, 603980, 507880, 1692754, + 1242856, -175020, 3450469, 1504849, -816581, 1132798, 1353452, -67109, 690416, -1239098, + -358093, 654446, 783832, -2170032, 834834, -2360622, 729608, -38655, 1904818, -448287, + -1088237, 499827, 150324, -197569, 333934, -147103, + }, + { + -49341120, -131461968, -3267396, -17966386, -495532, 16640314, -19399830, 16634945, 3510062, -105764, + 12338367, -7996156, -5884105, 11437498, 2845953, -1704565, 6706055, -9339406, 9233106, -1625645, + -8377871, 3005940, 12578885, 1108638, -17377974, -1910724, -324270, 2188823, 2715493, 4135517, + -966368, -3087545, 6031208, 578210, 903554, 28849832, -5540508, -6279779, -2765959, 1961190, + -6408628, 7262253, -12457016, 2743947, -915365, -689342, -1702418, -5763846, -758599, 6059662, + 2162516, 182536, -4881767, 2705293, 5626944, -2885681, 4045322, 2254321, 4929549, -1467805, + -2108829, -1175747, -263604, -316754, 941135, 2285996, -2899640, 1099512, 640487, 3153043, + 1168231, -260919, 583579, -646929, -821413, 959388, 645319, 339839, 248571, -1416266, + 825171, 109522, 217433, 748398, -2192044, -385473, -2073396, -705985, -1226213, -1228361, + 488553, -1367947, 601832, -44023, 560493, 300648, + }, + { + 2156611, 31230318, -13121662, -4676146, 12425340, -10836739, -1781338, 207232, 3951370, -5222144, + -1136556, 2668249, -17069274, 2239826, -55645596, -18772766, -12924630, 7191386, 8335995, 14542759, + 1036161, 24956444, 27050778, -2611340, -22478786, 12212740, 12130598, -3595961, 6365679, 5581310, + -1750736, 3370476, 24910274, -3215320, -3612068, 4835060, 2136209, 3585224, -6026913, 950262, + -5883032, 4629975, -163746, 6466074, -2666638, -7313793, 5720897, -3486440, 270046, -6256694, + 1403381, 3008625, 1233729, -7544647, -922881, -2017024, 4567698, 98784, -997506, 1773285, + -3084860, -962073, -3024194, -1380832, 1587527, 101469, 5676336, -725313, -2262911, -2106682, + -4778151, 2296734, -1401233, -99858, -1221381, -1731946, 1421097, -1976759, -58519, 401043, + 1102733, -675921, 560493, 591632, -1530619, 775242, -2144799, -396211, 162672, 157303, + 350577, 40265, 519154, 22012, 841277, 95563, + }, + { + -30063698, 70062728, 8879845, -14611479, -1807108, 11261941, 3138547, -7429757, -2687039, -4919348, + 6934762, -9578314, -7231651, -13587666, 14804215, -2133525, 5976984, 18575196, -7612830, -231928, + 1897839, -4161287, 7786239, 6298033, 13129178, -15008763, 7854959, -303869, 6116034, -707059, + 2983392, 1096290, 5015448, 2258079, -1409823, 2868501, -5794985, -2815351, -1855426, -8850317, + 11432129, -4130685, -11684995, 3504693, -3136400, 6582575, -5502927, -10231149, -6154688, 2179696, + 6127308, 3905736, -8274792, -7927436, 2314987, 2692945, 2291902, 3870839, -2339684, 1963874, + -1873680, -2810519, 835908, 1849520, 3542811, -1330366, -1939178, 1771137, 523449, -1247151, + 3425773, -1783485, -978179, 62277, -1442572, -537945, 1916629, 567473, -344134, 227633, + -1246077, -912144, -823560, -536871, 168041, 826781, 1996623, -66035, 62814, 726386, + 377420, 1025960, 188442, -962610, 661962, -264141, + }, + { + 5633924, -39715024, -13023415, -1726577, -3303904, -6797860, -16530792, -5440650, -1376000, 5852967, + 6934225, -7082401, -12375411, -8485782, 32995550, 8604430, -16927540, -5215701, 5491116, -34569656, + -11136850, 16818018, -15632070, -16857746, -12417287, -12846247, -12278775, -12688407, 29454348, -2206003, + 2040646, 6191732, -3841312, -3102040, 8945880, -5839545, 3522947, 10058277, -2191507, -5244155, + -52613, -11584601, 948651, -7284265, 2237141, 1379221, -1428077, 6123013, -3203509, 5248987, + 4232154, 2383707, 3639448, -2387465, -4099010, 1515050, -6008659, -267899, 1635846, -771484, + -2078227, -1056562, -672162, -1176821, -920734, -1270237, 3625489, -4740034, 5792301, 1505923, + -2616172, 911607, 2264522, -601832, -1957968, 442919, -503048, -4187593, 1139240, 1748589, + 202937, 332323, 995359, -1129040, 2121714, -379568, 413927, 1186485, 684510, 614180, + 394063, -41339, -53150, 1059783, 89121, 399432, + }, + }, + { + { + -12553116, -208790704, 37478420, -35157528, -2566780, 4525822, 1018444, -11977590, 1142461, -12719546, + -24044838, -3308736, 5371931, 9185861, 5245766, -15751256, 4249870, -8460012, -5345624, -10068477, + 2266669, -2770254, -3156264, 2170032, 11659762, 6471979, 10496900, -9503152, -6102612, 7821136, + -7749195, 3539053, 4782446, -2360085, 377957, 1831267, 2358474, 4297652, 1867774, 4138201, + -434329, -377957, 597000, 189515, -8164733, -2668249, -949725, -352724, 329639, -1654099, + -4514011, -1934346, -135291, 1853278, 1707786, 1356136, -2738579, -1474784, -2084133, -3949223, + -2286533, 159988, 1869921, 53150, -4645007, -2580202, -2647847, -1724966, 1250909, 334471, + -32749, 364535, -328565, -1038308, -187905, 951872, -1397475, -760209, -11274, -807991, + -658204, -896574, -266288, 1183264, 814970, -558346, 314069, 583579, -574452, 221728, + -201863, -35970, 191126, -45097, -4832, 201327, + }, + { + 992674, 60130, 4272956, 11812234, 967441, 17180, -3464428, -7515656, 1147830, -12773770, + -8590, 2947958, 2136746, 7835631, 16975858, 23482734, -3140158, -9346923, -2245194, 15893526, + -7598871, 16557636, 3745212, -12214350, -22549, -10188199, 588411, -9775882, 6742562, 3367254, + 4811437, 2048699, 10407243, 1025960, -3326452, -4878546, 27380, 6125160, 3583077, 3668976, + 1221918, 1882269, -2923799, 855772, -1970316, 1567663, 2722473, 4440460, 1571421, -2973191, + 3671123, 2841121, 1775969, -2258079, 5867999, 4815732, -515933, -2119030, -2720325, -1539746, + -1013612, 1447941, 3028489, 93416, -1199907, -200790, -261993, -1444720, -370978, -3749507, + 1763621, -40265, 345745, 66035, -80531, -1536525, 284542, -10201, 44023, 462783, + -187905, 104690, 1100585, 827318, -746251, -1333587, -294205, 498753, -207769, -766652, + 397821, 309775, -584116, -569620, 540092, 410706, + }, + { + -2066953, -36008468, 8871792, 13043279, 11221676, 2458869, 1584306, -782758, -4199405, 2643552, + 7844758, 6976638, -8412767, -398895, 8961449, 11682848, 753230, -11358578, 6432251, 2913599, + 4699768, -2667175, 606664, 2769717, -4514548, -13597330, 7848516, -1118839, -3441343, -6227703, + -1291175, -6280853, 813896, -1622961, 6500970, 5003100, 2472828, -5938866, -1930051, -1268089, + 3703336, 2098092, -2799245, -2265059, -991064, 403190, -2356327, -2926483, -2182917, 330176, + -1116692, -2601140, -1658394, 515933, 1668058, -656056, 1894618, -1668595, 1748052, 2966212, + -526670, -1904818, -2085207, -1461900, 1277753, -736587, -679679, 10201, 1216013, 402653, + -113817, 217970, -1437203, 457414, 120796, -1015223, -1273458, 1292785, 465467, 1950452, + 664109, 294205, -424665, 126165, 903554, -217433, 95563, 185757, 590021, -262530, + -180926, -1093069, 19864, 1305670, 662499, 112206, + }, + { + -18137110, 238458736, 37935836, -10608032, -15128485, 3278134, 7624641, 2725694, -3204583, -3420405, + 16661789, -12981002, -3139621, -7056095, 8841727, -3320547, -262530, 26811334, -9481140, 50466, + -5055177, -3572876, -8240969, 553514, 2277407, 9861245, 1504849, 8004746, -1002338, 1917703, + 2886218, 1602560, 3036005, 375810, -115427, 633508, -2517925, -5685463, 3804267, -1924682, + -513249, 2780991, -2822331, -2643016, 3098282, -3943854, 2390686, 3563212, 3217468, 4452808, + -1904818, -603980, -1884954, 2736968, -317291, -4185446, -667867, -3693672, 1005022, -387084, + 1415729, 451508, -3230352, 1080184, 1613834, 1517197, 310848, -2162516, 1210107, 2715493, + -151398, 3054259, 1101122, -1651952, 459025, 979789, 1298154, -79994, -383326, 122407, + -154082, -579284, -987306, 491237, 579821, 566399, -75699, -364535, -655519, 349503, + -178241, -918049, 501437, -12348, -199716, 134218, + }, + { + -1939715, 14103062, 14862734, -5101885, -1774358, 1216550, 471910, -1917166, -13422, -2299955, + 4905390, -10352482, -4846871, -16275779, -22820234, -10222022, 34934728, 6817724, -27783606, 13979582, + 6400575, -8792872, -6382859, -3236258, 2557653, 9911174, 18026514, -3134789, 1963337, 2908230, + -5005785, 1751810, 1429150, 2275259, -6517613, -2418067, -3448859, 243739, 1395328, -4841502, + -317291, 4594542, -4040491, -5248450, 2214593, -1352378, 261456, 146566, 160524, 2378338, + -2167885, -1306744, -1066226, -648003, 1262184, 2939905, -278099, 467615, -2049236, 4488241, + -3514357, 762894, 2421288, -771484, -1713692, -1677185, 2252710, 1636383, -1036698, 804233, + -900869, -880468, 536334, -221728, -1840930, 818728, -2362769, 386547, -1463510, 1192927, + -107374, 663572, -157840, -18790, 767725, 913217, -53687, 523449, -348429, -671626, + 255014, 271120, 513785, -41339, -867583, -558883, + }, + { + -20638928, 313888544, 33945276, 63683628, -2433636, 6238977, 5430986, -27605366, 3327526, -154619, + -16006269, -2063195, 12692165, -14079977, -9160092, 9247065, 3303367, 7692287, 1298691, -3335579, + -13038984, 6139119, -4476967, 1131187, -5304822, 6702297, 4244502, 2563559, 9019968, -8266202, + -8442832, 1144609, 838056, 93416, 2063732, 2251100, -1618129, -5284958, -2858838, 5972152, + 4235912, 8352638, -3925063, -158914, -207769, 2938831, 6817187, -1343788, 1047435, 345745, + 2202245, 1552094, 3572876, 2816962, -4305705, 3790309, -3308736, -1400159, -3908420, -561030, + -1671279, -764504, 2316061, -901406, 1202054, 3089155, 1489280, 1323924, -271657, -694174, + 215285, 562641, -194884, 3826279, 829466, 856846, 427349, 93952, 997506, 541166, + 10201, -299037, -1327682, -470299, -410706, 174483, -365072, -172872, 1444183, 439697, + -624918, 1464584, 485868, -26307, 221191, 118648, + }, + { + -267362, -2938295, 2433099, 5599564, 1013075, 331249, -249108, -69256, 2433636, 2778307, + 5539971, -1070521, 5878200, 18644990, 44527000, 30292942, 16497506, 12485470, 3539053, -899796, + -8040179, 10143639, 30536680, -35633196, 317291, -11863237, 7123204, 2320893, 9482751, -5876052, + 284542, -8633421, 8697846, 7759396, -11179263, -1231045, 1562294, -4678830, -573915, -1284195, + 404264, 755377, -3485366, 2337536, 1480690, -1351841, 452582, 4007205, -2849174, -2685428, + -504659, -1551020, -4019553, 2394444, 552440, 994285, -373125, 2699924, 3647501, 561567, + -880468, 1078037, -538482, 1440962, -371515, 438624, -2920041, -16643, -625455, -287763, + -740882, -844498, 802622, -1867774, 1081795, 191663, 1662689, -1746441, -987843, -253403, + 223875, 1627793, 476741, -361314, -597000, -548145, 284542, -503585, 1569274, 877784, + 162135, 526134, -36507, -697395, -30065, -282931, + }, + { + -53262428, -318823488, 26640072, -50450832, 6956774, 341450, 4694936, 453119, 597000, -2645700, + -20073066, -8389145, 13949517, 8729521, 3677566, -16403554, 12004434, -813359, 4405026, 1235877, + -2559801, -4029216, -4473209, -6855305, 4245039, 250719, 537, -6291054, 4189204, 4284767, + 5006858, 34897, 2798708, 4412542, 2264522, 4380330, -682900, -506269, 484258, 1051730, + 119185, 102005, 488016, 2951180, 500901, 2029909, 5645735, 1953136, 61203, -1913945, + -3580392, -392453, 1165547, -1856500, -2623151, -4111358, -4152697, 1311039, 3389803, 6891275, + 3637301, -1298154, 249108, -3047816, 633508, 318901, -3147674, 1540283, 846109, 23085, + -410169, -409096, 102005, -965294, 1190243, -271657, 425202, -1708860, 562104, 1698123, + -387084, 50466, -59593, 15569, 1198833, 145492, -839129, 689879, -448824, -200790, + -611496, -498753, -938987, -933619, 395674, 479963, + }, + { + 78383, -9289477, -3238942, 879395, -5153424, 1065689, 56371, -630823, -1594507, -104153, + 1306207, -774705, -777926, -3412352, -15834471, 9164386, 6551436, 23215372, -18973554, 16385300, + -31343598, 1532767, 8267812, -28958816, -17588428, -3714073, -4929549, -3235184, 1040993, -3617436, + 8562017, 10196252, 446140, -1183264, 2572686, -722628, 8745090, -2822331, 6885370, 395674, + -5532455, -1256278, 4768488, -4307316, -2057826, 1862942, 369367, 5131412, 4083977, 3561602, + -2565169, 2755222, 1651415, 2490007, 1555315, 3734474, -1851131, -3708168, 184147, 1633161, + 430034, 1658394, -1214939, 1360968, 1895154, -1676111, 2530273, 973347, 187905, -752693, + -211527, 2299955, -108448, 294205, 311385, 532039, 261993, -1426466, 67646, -281857, + -1372779, 1714229, 1339493, -91805, -2012729, 658741, -554588, 840740, -227633, 235149, + -165356, -596464, 497679, 479426, 127775, -255551, + }, + { + -7980586, -249264336, 52805548, -15015206, -17092360, -1814087, -13305809, -12097312, 11537893, -7460358, + -6231461, -12534325, -18434000, -2377265, 22049826, 15079630, 23779624, -2823941, 2849174, 7491497, + -4051228, -11018202, 3722126, 834834, -2239289, -2426120, -8109972, -1212255, -13462038, -5590437, + 4647155, 7015292, 122407, 7855495, -10496363, -672162, 2595234, 2220498, -844498, 3467649, + 1222992, -2610266, 8494372, 2120640, -2341294, -7044283, 2439005, 745714, -423054, 5049808, + -4479651, -438624, -1511829, -3188476, 312459, -2661806, 146566, 902480, 1857037, 1229971, + 120796, -4795868, 1584843, 108448, -308701, 1810866, -1158567, 1177358, -2374043, -632434, + 499827, -1104344, -911607, 2369748, -513249, -1208496, -102005, -1734630, -804770, 814433, + -408559, 5906, -1465658, -323196, -3013993, -897111, -1034550, 825171, 563178, -124017, + 51540, 48318, 303332, 891206, 155156, 174483, + }, + { + 1620276, 49974092, 11053635, 434865, -2048163, -5582384, -10679436, 520765, 14244259, -1292785, + -2987150, -6667937, 6893423, 16716013, 18031884, 5829345, 14718316, 7707856, -12977244, -9614821, + 15118285, 634581, 3736622, 839129, 8303246, -11441256, 2101313, -4894652, 7452305, -1024350, + 4543002, -6966974, -909996, 2507187, -8843875, -6340446, 6544457, 1249836, 659814, -3924526, + 3353296, -3751117, -3971771, -5801427, 393526, 3278134, -5395553, -2964064, 2705830, 6231998, + 3406983, 1382980, 1116155, 4359392, -4005057, -2025077, 3937948, -865973, 1061394, 1707786, + 1304060, -1518271, -2728378, 255551, -1851131, 160524, 434865, -194347, 836445, 1264868, + 1653026, 1025960, 469225, 1719598, -768262, 2033130, 599685, 670015, 689879, -420907, + -1685238, 1912334, -263604, -867047, -336618, -76236, -424665, 1178432, -3758, 73014, + -544924, 1264331, -721018, 25770, 259846, -950798, + }, + { + 19436338, -190676688, -32729798, -12509629, -1629940, -17169668, 9876814, 5900748, -3410204, 13279502, + 7647726, -6849936, -6490770, 7043747, 4177393, 1002875, 7800198, -9762998, 2429878, 1166621, + 1582159, -2265595, 3837017, 2435247, -6430640, -7379291, 3072512, -4532801, 1401770, 6769406, + 1018981, -1625108, 5947993, -995896, 11143830, 10188199, 2825552, -6395743, 4323422, -5606006, + 1577864, -12885, -6067715, -3175592, -1601486, -7336341, 3022583, 448824, -2288681, 1228361, + -1500554, 2529199, -1335198, 2290291, 4802311, -2793876, 2776696, 4020626, 771484, 3197066, + -1533303, -1670742, -930934, -652835, 507343, 655519, -714038, 140660, 1319092, 802085, + 1439351, 342524, 1646583, 88584, 239981, -43487, 664646, 846645, -1009317, -1082332, + 157303, 1040456, 413927, -955630, -1122597, -1082332, -919660, -2048163, -1147830, 422517, + -1246077, -950262, 474594, 369367, -113280, -179852, + }, + { + -2773475, -119185, 22829898, -2851322, 3524558, -1863479, -6980933, 2429878, -2440615, -4775467, + 1229971, 2108829, 2611340, -16394427, -54278188, -42805792, 13769128, -9395241, 4555350, 15298674, + 18110804, 26306674, -11258720, -3767760, 562104, -137976, 7948911, 6091874, 11312407, 5949604, + -13362717, 17655000, 10186589, 284542, -3332358, -1899449, 9336722, 2020782, -9921911, -2313377, + 1302986, 5306969, 4134980, 2410014, -4268124, 264141, -645856, -2613488, -3444564, -349503, + 298500, -2539936, -2018635, -2840584, -2264522, -1819456, -231391, 1120987, 944893, -1187022, + 438624, -1358283, -1861332, -2217277, 140123, 1567663, 1411971, 1597191, -3221, -5359583, + -46171, -890132, 413927, -1318018, -1043140, -640487, -1062468, -1014149, -20938, 490163, + 250182, -130997, 1352915, 568009, -1292248, -505196, -770410, -103079, -854699, 1006096, + 317291, 791885, -49392, 168577, 661425, -362388, + }, + { + 33940444, -1020592, -4149475, -18380850, 32749, -7799124, 21164526, -3828963, 619549, -4628901, + 6287832, -8831527, -3453691, 4025995, 2190433, -1844689, 12519830, 7827578, -2436320, 8499203, + -3052111, -3955665, -168041, 12954158, -2408403, -4294968, 1963337, 3558381, 692564, -5267241, + 7896298, 4090956, 1508607, 1793149, 3747359, 182536, -4906464, -3189550, 1183800, -5440650, + 8891119, -12525198, -5839545, 2461016, -1056562, 4510253, -1672353, -9050033, -1310502, 965294, + 6027450, -2525978, -5516886, -5208185, 325881, 1483911, 2072322, 1666984, 1663763, 1228898, + -4560182, -526670, -434865, 2495376, 1422708, 346282, -1323924, 2005750, -1256278, 1689533, + 1925756, -1827509, 950262, -1421634, -1527398, -787053, 2918430, 295816, 1503775, -875100, + -1845225, -1250909, 1120450, -190589, -158377, 953483, 1120987, 208306, -179852, 162672, + 1153199, 941135, 41876, -202937, 148176, -63351, + }, + { + -4719096, -47445968, 8315594, -245350, -11748346, -2573759, -12437152, -8614094, -3421478, 6671158, + 6999723, -11558831, -9269076, 20308752, 2969433, -11450920, 3754338, -6514392, -4649839, -6924024, + -29699162, 4494147, -9678172, -6643241, -13293461, -19243064, -12670154, -9706626, 20855824, 16567836, + -6794639, -1872606, -1795833, -782221, 6532646, 2168422, 212064, 4407174, 1838783, -6902550, + -4732517, -8468602, -777389, -6982543, 3713536, -3372623, 6377490, 3453691, 1164473, 852551, + 6255083, 3578782, 845572, 880468, -3342558, -542777, -4471598, -3001645, 1255741, -2992519, + -2312840, 704912, -364535, -2218888, -1782411, -51540, 111669, 1038845, 883690, 2816962, + -1233193, 914291, 2684, 1079111, -1874216, 312459, -1455457, -2536178, 255551, 1080721, + 507343, 380641, 2149094, 158377, 643708, -1400696, 1087164, 103616, 891206, 912681, + 591632, 22549, 580894, -17717, 513785, 1069447, + }, + }, + { + { + 10545218, -155981936, 75513576, -12360916, 7130720, -615254, -1094680, -10591926, 10537165, -290447, + -12252468, 9058623, 6774237, -10770704, -146029, -5066451, 13489419, 1794223, 7774965, -4999879, + 549756, -5023501, -1622961, -1340030, -1210644, -1345399, 10766409, -8472360, -8091719, 10752451, + -5057324, -1461363, 2914672, -129386, 1559610, 33823, -731755, 3469797, 1778653, -1559073, + -2860985, 1647657, -1856500, -1971927, -4929012, -983548, -1350230, 892816, 143345, -1544578, + 15032, 1231582, -506806, 938450, -582505, 2478733, 1242319, 2447058, -725850, -975494, + 1899986, 13422, -485331, 1405528, -1696512, -141734, -15569, -1232656, -377420, -1117765, + -391379, 169114, 1869921, 1399623, 592169, 819802, -1640678, -982474, 230318, 30065, + 956704, -968515, -1087701, 115427, 348966, 253940, 643171, 1300301, 164283, 13422, + -38118, 490700, 384400, -118648, 27380, 183610, + }, + { + 118112, -8247948, -1217623, 2380486, -6412923, 2253247, -1270774, -2952253, 5929203, -250182, + 7636452, -373125, -885837, 4700305, 6040335, 9159018, -4822175, -4017942, -17577690, 6930467, + -10742250, 3524021, 4057670, 4046396, 11113228, -10601590, 8508867, -3698504, 4184372, -4656282, + 3524021, 2871186, 737124, -3107409, -3214783, 1840394, 2748779, 3921842, 2054068, 2955474, + -2464774, 671089, 110595, 1723893, -3646964, 1846299, 232465, 978716, -332323, -1761474, + 3010235, 1328756, 2041720, -2216203, 2904472, -692564, -330176, 85899, -1937030, 913754, + -594316, -56908, 62814, -667331, -818191, 1239098, 1720134, -2294050, -35433, -2388002, + 1796907, -521839, -598611, -659278, 91805, -884763, 445066, 345745, -152471, -686121, + 166967, 865436, 916976, 367757, -382789, -522375, -322659, -327491, -315143, -580894, + 805306, 150324, -156766, -98784, -91268, 51540, + }, + { + 1779190, -26209502, 4473746, -10884521, 2263448, 1927904, -983011, 1106491, -3179350, -3317862, + 4395899, 4737886, -8992588, 1243930, 5902896, 14096620, -3022046, -8313446, 4771709, -7257958, + 3906273, 1268626, 2215130, 3238942, 806917, -11484206, 8938364, -921807, 2339684, 426812, + -474594, -2604361, 6519224, -4199941, 947577, 2167885, 6061810, -3045132, 2852932, 3305514, + 2080375, -504659, -520228, -506269, 1688996, 4025995, -147103, 909459, 691490, 729071, + 1376000, -658204, 351650, 966368, 756451, -468688, 1589138, -2851858, -783295, 483184, + 515933, 22549, -793495, -634045, 641561, -579284, -226560, -875636, -295816, 710817, + 574989, 503585, -1509681, 271120, 28991, 311922, -26307, 1555315, -245350, -272194, + -1152125, 297427, -470299, -457414, 801548, -581431, -51003, -176094, 617938, -555661, + 4295, -839666, -411243, 352724, -413391, 614717, + }, + { + -6052146, 169877232, -38933880, 5683316, 4571456, -2968896, 6049462, 3247532, -2388539, -11405823, + 8222178, -6263673, 4543539, -5217312, -2469606, -7353521, -4263829, 13553843, -15525770, 510027, + -1523103, 1537598, -4188130, 2819109, -5933498, 725313, 167504, 7170985, 92342, -2926483, + 304943, -115964, -705985, 876710, 1808718, 351650, 46708, -2701535, 5139465, -4174708, + -970126, 3760781, -883153, -3870839, 846109, -964220, 973347, 648003, -1939715, 2433099, + -2412161, -3286187, -648003, 2945274, 641024, -1647657, 75162, -2774012, 1568737, -2036888, + 1209570, -423591, -3175592, 2510945, 588411, 608275, -56908, -3701188, -1015223, 399969, + -2339147, 588411, 723702, -1300838, 80531, -133681, 269509, -166967, 236223, 777926, + 492311, 356482, -534187, -104153, -203474, 198642, 552977, 250182, -303332, 785979, + 213675, -712428, 589484, 469762, 86436, 348966, + }, + { + 2062121, -2738579, -2964601, -588947, 801011, 421444, 1178432, 274878, 1450625, 242666, + 4327717, -8029442, 5872294, -1685238, -15338402, -21323976, 13375065, 23079544, -22565222, -2388539, + 4212289, 676457, 7994545, -1006633, -3786014, -19138374, 1106491, 1111860, -1066763, 325881, + -10872710, -4373888, -2590939, -2298881, -5054640, 237297, -2072859, 4980552, 3450469, -5707475, + -1091995, 4915053, -1798518, 49929, 1529545, -3836480, 69256, 674310, -3077881, 1870995, + 511638, -259846, -1548873, -1648194, 1898376, 2617783, -149787, 1761474, -3465502, 750546, + -4343823, -89121, 443455, -2041183, -819265, -1455994, -391916, 182536, -418222, 2959769, + 46171, -928787, 602369, 377420, -274878, 1819456, -2068564, 742493, -1095217, 461172, + -629750, 394063, -334471, -113280, 314069, 539555, -286689, 368293, 217970, -461709, + 129386, 245887, 51540, -293132, -241055, 204548, + }, + { + -14027363, 241383072, -22168474, 64337536, -7602092, 499827, 9688372, -19005768, 2698313, 6689412, + -5450851, -6900402, 6554120, -621160, -3900367, 8476655, 345208, 1954747, -1454383, 2480344, + -1755031, 6737730, -2854006, 5959804, -4253092, 406411, -2582349, -4378183, 7570954, -451508, + -2669859, 2731062, -377420, -4387309, -2617783, -767189, 2463701, 1513439, -56371, 4812511, + 1135482, 3542811, -2814277, 87510, -2302103, 3227668, 4699231, -5747740, -877784, 1254131, + -271120, -630286, 1843078, 2352568, -4375498, 4032438, -828929, 1417876, -3083250, -2218351, + -2385318, -1034013, -1037772, -2501819, 916439, 1028108, -158914, 891206, 251792, -634045, + -1046898, 625992, -2142652, 1775969, -550830, 596464, 644782, -469762, 347892, -464930, + -537945, 202937, 302258, 682900, 173946, 831076, -83752, -223338, 281857, 384936, + -689342, 494458, 188979, -548145, 80531, 299574, + }, + { + 673773, -9727564, -6582038, -518080, -3019362, 559420, -971736, -89121, 1438814, -152471, + 303869, -2594697, 3325379, 9143985, 25715580, -12046846, -12725988, 4318590, 6919729, 5946919, + -12863964, 904091, 27895812, -29766270, 3418794, 698469, 12881144, -2660732, 504659, -10305237, + 6282464, -6336688, 8821863, 14749455, -1773285, 3549791, 2414309, -481036, 5010616, 1221918, + 930397, 1644436, -538482, 2679523, 41339, 1544578, 987843, 2970507, -2259153, -2598455, + -774705, -1821066, -4105989, 1156957, -1145146, -580894, -921271, -1418950, 644245, 1162862, + -2663417, -192737, -379031, 1632625, 1170379, 1745367, -1431298, 625992, -227633, -343061, + -131533, 837519, 1192390, -1886564, 1573032, 644782, 1665374, -515933, -158914, 461172, + -13422, 369904, -183073, -82141, 19327, -534723, -253940, 4832, 457414, -862215, + 206158, 310848, 89121, 121333, 178241, -93416, + }, + { + 58703076, -180826720, 27219892, -45544908, -555661, 2329483, 1808718, -7089381, -2234457, 3465502, + -8495445, -2462627, 15103252, -1678259, 8413304, -10249403, 532039, -14148696, 2245731, 5559835, + 1724966, -83752, -1697586, -7232188, 2368138, 530965, 1036161, -4961224, 2964601, 1081258, + 816044, -3090229, -2263448, 113280, -1875827, 402116, -3397856, -2850785, 717796, 2483565, + -1542967, -4020626, 1415192, 1672353, 620086, 776315, -27917, 763967, 3099356, 1223529, + 3301756, -742493, -1561221, 608812, 2543695, 1492501, -325344, 268435, -411243, 4441533, + 359704, -1309428, 2464238, -1246077, 807991, 1024350, -981400, 226560, -1190243, 175020, + -391916, -795643, 1373316, -2684, 843424, -649614, 823023, -1141924, 793495, 1028645, + -192200, 964220, -46708, -637803, -631360, -848256, 405338, 672699, -595390, 466004, + -501437, 229244, 6442, 146566, 442382, -152471, + }, + { + 1020592, 257698, 1773822, 2080912, -2103997, 951872, -599685, -408559, -2249489, 819802, + -246424, -4691715, -2069101, 18110804, 7217693, -8534637, -20876762, 13515725, -16580184, 23155242, + -12582107, 11601780, 7538742, -20091320, 121333, 1729261, 7181186, -290447, -2885681, -6752763, + -1577864, 2713883, -1831267, -5128191, 2295660, -3460133, -517544, -5671505, 3939559, -2374043, + -1284195, -1014149, 5892159, 2537789, 1439351, 3117610, 27380, 2391223, 989453, 1057099, + -2003602, 2108292, 611496, 815507, -548145, 1654099, -622770, -2026151, -126165, -2172180, + -1178969, 800475, -910533, 782758, 1106491, -1032940, 2073396, -545998, 104690, 157303, + -1709934, 166967, -1606855, -184147, 1246077, 1256278, 39192, -884226, -15032, 427886, + -1076963, -6442, 170725, 674847, -1488206, 671626, -731755, 239444, -560493, -163209, + 608275, 38655, -537, 173409, 2684, -113280, + }, + { + 8958765, -195767296, 67240400, -7154342, 8884677, 9517648, -13260175, -5625334, 14176613, -2603824, + -3127273, -4548371, -6240051, 1917166, 10834592, -6686727, 11885248, -2804077, -2725157, -920734, + 2221572, -6174016, 6827925, -4430796, -7225746, 1949915, 1791001, 4027069, -7392176, -32749, + 1068373, 1906966, -1865090, 6559489, -7351911, -2552821, -916976, 1998770, -2285996, 4475356, + -2721399, -6097780, 4213900, -2171106, -755377, 1807644, 4171487, -1382443, -554051, 3634616, + -2991445, 4042638, 140660, -1612223, 1758252, 521302, 1732482, -672699, 1669669, 782758, + 2770791, -1029182, 906238, -1496796, -591632, 310848, -1357210, 1728188, -2368675, -700080, + -420370, -723702, -297963, 1423245, 374199, -197569, 1041530, -356482, -1032403, -170188, + -710817, 668941, -1115081, 455267, -1212791, 395674, -1013075, 574989, 41339, -861141, + 267362, -232465, 717260, 862215, -57982, -204011, + }, + { + -825707, 29634738, -2203855, -1780264, -2728915, -2745021, -7344394, -4093104, 5614596, -4243965, + 7079717, -3462281, 2830920, 3955128, -6732361, -11547556, -3694209, 9098351, 1511292, -6825240, + 8223252, 2508798, -1201517, -7135015, 4277788, -7104950, 8741869, 335544, 1575716, -10945187, + 8063801, -1751273, 1389959, 2756832, -2961917, -6163815, 2893734, 2836826, -401579, -2342368, + -1024887, -4115653, 1732482, -5291937, 2167885, 3076270, -3088618, 803159, -1289027, 367757, + 228170, 192737, -2484639, 1917166, -1701881, -719407, 1941325, -1026497, -1140314, 405338, + 2798171, 151934, -1248225, 680752, 1181653, 1801739, -1903207, -2276333, -306016, -527207, + -607738, -671089, -1028645, 1052804, -1282585, 1159104, 120259, 992674, 1145146, 763967, + -1041530, 1789391, -268435, -759136, -368293, 404264, -361851, 618475, -808528, 366146, + -159988, 1094680, -357556, 252329, 226023, -688269, + }, + { + 18522584, -172627088, -22141630, -13656385, -2644626, -28275918, 1275605, -1071058, -7378217, 5551782, + 3700651, -2148021, -4745939, 430034, 2282238, 3147674, 10217190, -4602058, -3977140, -6963753, + 5181341, -397284, -1308891, -2221035, 2992519, 171262, 5469104, -1683627, -157840, 3165928, + 1496796, 3843996, 5666136, -6176163, 1675574, 84826, 1513439, -2951180, 5760625, -4544076, + 1993939, -1221918, -2792266, -4393752, 3253975, -3394635, 1602023, 1112397, -1337882, -2809982, + -2787434, 2224256, -382789, 833761, 2954938, -2698850, 973347, 2253247, -1983201, 1378685, + -244276, 834297, 281857, 503048, -133144, 387084, -819802, -2139431, 951335, -625455, + -459025, -229781, 2015950, 747861, 493921, -810675, -144418, 300648, -576063, -284005, + -75162, 1046898, 67109, 294205, 386010, -1018981, 363462, -730144, -903554, 1137630, + 258772, -105227, -32212, 109522, -92342, -365609, + }, + { + 3003793, -17754858, 7194070, 841277, 2689187, -366683, -6491306, 1316944, -3365644, -4626754, + 1636383, 4082903, 2466385, -3495567, -14703284, -22910430, 17204566, -10458245, -10801306, 8185671, + -6252936, -2637647, -19475530, -1203665, 1651415, -12699681, -1286343, -894964, 5278515, 10455024, + -4576825, 17380658, -159451, -1553704, -4392678, -11862700, 1883880, -3419331, -8168491, -356482, + 3940096, 2994666, 1578401, 3200288, -127775, 3693672, -1040993, -3109020, -2146947, 1741072, + 314069, -3905199, -4109210, -466004, 1465658, -53150, -1480690, 395674, 593779, -1516124, + 1989107, 1407139, 1716376, -81604, -1274532, -458488, 221191, 1832877, 1445793, -2386928, + 2087354, -323196, 1449015, -782758, -97174, 303332, 193274, 33286, -1086090, -239981, + 310848, -711891, -327491, -603443, -456877, 342524, -127775, 15569, -891743, 613643, + -99321, 850940, -32212, -521302, -93952, 147640, + }, + { + -23082764, -66606888, -3415036, -20896626, 7028714, -6418292, 24336896, 3877819, 7654169, -5840619, + 14256070, 3636227, -2383170, 4810900, -670552, -6598681, 3079492, 6498286, 1653026, 8814884, + -3542811, -334471, -228170, 8611946, -4499515, 3423626, 3242164, 2349884, 2149631, -8660265, + -921807, -224949, 537408, 1079647, 3138547, -309238, -4010426, -2068564, 4428112, -977642, + 2731599, -11372537, -597537, 3010772, -1044214, 3211562, 2184528, -967441, 1795296, -678068, + 1984275, -1562831, 563714, -3070902, 455803, 14496, -1229434, 49929, -64425, 1330366, + -2546916, 243739, -1242319, -683974, -1259499, 85899, -1142461, 666794, -452582, 507343, + -76236, 476741, 1874216, -1886564, -361314, -380105, 1610613, -1341104, 954557, 76236, + 101469, -341450, 1027034, 417149, 523986, -521839, -698469, -272730, 163209, -106837, + 47245, 25770, 257161, 258235, -177704, -143881, + }, + { + 3925063, -53127136, -2230162, 6480032, -5963562, 8702677, -292058, -4111358, -2412161, 516470, + 3493419, -6514929, 3246995, 11770895, -8290361, -8186208, -2521683, -5560372, 2027761, 17484274, + -16039555, 1664837, -4755066, 1808181, 5808407, 1535451, 4104378, -8534100, 2027761, 10913512, + -6314676, -3595961, 1458678, -1774358, 2295660, 3842385, -1249836, 779000, 5387500, -2527588, + 608275, 1518271, 6473053, -1827509, 310311, -5048197, 6417218, 710817, 1359894, -1019518, + 3793530, 2932389, -2128693, 591632, -1658931, 1274532, -1252520, -1883880, 525060, -2246268, + 31139, 236223, -172872, 1110786, 724776, -796180, -1784022, 1685775, -1410360, 1230508, + -897648, 1222455, -208843, 1319092, -1106491, 209380, -36507, -438624, -363998, 184684, + 10737, -1061394, -278099, -835908, 78383, -1001801, 1066763, -462246, 277562, 249108, + -206158, -702227, 459025, -767189, -90731, 1020592, + }, + }, + { + { + -4719632, -54504208, -7231651, 11147051, -3543885, -832687, -4064113, -3365107, 3572339, -2936684, + 3223910, 7509751, -4373351, -5545877, -5827197, 1436130, 8383240, 7939247, 4271882, 1058710, + -1705639, 1261647, -4570919, -1220308, -5250598, -699543, 4854924, -2978023, -3193308, 2765959, + 2918430, -3417183, 1056025, 1591822, 1090385, 790811, -306016, -180926, 3913789, -804233, + -5130876, 1535988, -2900714, -3507378, -1264868, 711354, -2985002, -16643, -36507, -1467805, + 1458141, 1114544, 365609, -201863, 711891, 564251, 1903744, 1268626, 243203, -351114, + 1850594, 345208, -23085, -200790, 519154, -47245, 741956, -832687, -1301375, -976568, + 251792, 240518, 1534914, 1292785, -70330, 544387, -549756, -521302, 9664, 234613, + 686121, -858457, -927176, 22549, 325344, 153008, 859530, 746251, 725850, 286152, + 50466, 133681, 383863, -26307, 0, -67646, + }, + { + -541166, -1816234, -4041564, -8417599, 2040646, -713501, -421981, 3804804, -806380, 1739462, + 6346351, 1294933, -1249299, 2898029, 7191386, -5485210, 8028905, 782758, -14107357, -13073344, + 2183991, -3726421, 6904697, 4307316, 6602976, -1238024, 3299072, 2219424, -570694, 375273, + -2830920, 4995584, -2605435, -5668283, -779000, 3651259, 2501819, 6217502, 366683, -514859, + 228170, 17180, 2197950, -1281511, -3182034, 3762928, -1707250, 74625, 6979, -306553, + 692027, 1183264, 1995549, -113280, 1252520, -2113661, 250182, 149787, -702764, -783832, + 624918, 563714, -1216013, 80531, -505196, 442919, 1633698, -957241, -985695, 119722, + 192737, -395137, -635655, -827855, -295816, 47245, 130997, 355409, -652835, -1288490, + 1155346, 653372, 412317, -83752, 412854, -440234, -269509, -55835, -358093, 29528, + 81604, -229244, 578747, 41876, -140123, -242666, + }, + { + -721018, 2912525, -14428406, -14440217, 1418950, 2802466, 173409, -2711735, -384936, -1721208, + -1767379, 675384, 1669132, 295816, 6560026, 2171643, 3212636, -6141267, 195421, -2340220, + -622770, -3451006, 9528385, -1543504, 5240934, -4940286, 2728915, 3227131, 1032403, -3014530, + 2674691, 291521, 666257, -2684355, -2337536, 3987340, 5779952, -1664300, 4160213, 3330210, + -514859, -1537598, -423591, 1060857, 1454383, 2052994, 1270774, 1594507, -336618, 945430, + 2210298, 233002, -434865, 1631014, -164819, 1454383, -923955, -2318746, 260919, -958315, + -176631, 1102733, -793495, -80531, -244813, 604517, -613107, -94489, -522912, 224949, + 303332, -785979, -288300, -42413, 271120, 448287, 348429, 847719, -96637, -1352378, + 214212, -92879, -113280, -520228, -146029, -437013, 245350, -259846, 50466, -2147, + -361851, -530428, -280247, 21475, -409633, 301721, + }, + { + 21398064, 89652608, -632971, 6181532, -4305705, -1184337, 2010582, 1195612, 1136019, -8061117, + -1800665, 1510755, 14496, -1264868, -2757369, -6081137, -4612258, 911607, -8025147, 3095598, + -2809982, -1423782, 2087354, 2630668, -5723044, -517544, 469762, 2279017, 2470143, 616865, + -3968013, -834297, -1789928, 1810329, 1750199, 946503, 1138703, -1341640, 2993592, -5317170, + 421981, 3174518, -1198833, -1276142, 39192, 2364916, -2529736, -183073, -3000572, 350577, + 2089502, -3218541, -1222455, 860067, 905164, -1606318, -266288, -996432, 1250372, -1333587, + 1100049, -1619203, 434329, 624918, 420907, 156766, -266288, -2639794, -741956, -672699, + -628139, -1115081, -386547, -33286, -452045, -132070, 154082, -130997, 264677, 555125, + 876710, 57445, -103616, -353798, 449361, -96637, 185757, 397284, -301721, 304943, + 348429, 40265, 102542, 229781, 396211, 297963, + }, + { + -2391223, -9405442, 2617246, 2188286, -385473, -351114, 73551, 2367601, 1730872, -833224, + 1852205, -4312684, 1670742, 1757179, -10053445, -8272644, -8366060, 3413962, 13392782, -11006927, + 2802466, 2121714, 6640557, -3815005, 5638755, -25224342, -8308078, 3063386, 8771934, -12637404, + -1676648, -6623377, -4054986, -670015, -3292093, 448824, 831613, 2696166, 644782, 41339, + -667867, 726386, 1344325, 1646583, 578747, -2633352, -993748, 668404, -2565169, 1487132, + 1187559, -1104880, -1288490, -517544, 1212255, 1254667, 1225139, 684510, -278099, -2619930, + -3268470, -391916, 142808, -1331440, -177704, -1542430, -347892, -721018, 1079647, 2240362, + -972810, -464930, 1212255, -354872, 587874, 612033, 15569, -850404, -3758, -35433, + 31139, 191126, -307090, 15569, -226023, -22549, 490700, -308164, 581431, -73551, + 155693, 237297, -408022, -353798, 75162, 32212, + }, + { + 34433828, 129117992, 2196876, 46272368, 9802189, -1598802, 1686312, -891743, -4465156, 4125316, + 1846299, -6135898, -2637647, 10324565, 2109903, -267362, 957241, -2669859, 3345780, -2011655, + 3787088, -283468, 3107409, 2222109, -355409, -1233729, -3307125, -3548180, 2087354, 2331094, + 1323387, -399969, -2354716, -3074123, -3001645, -1717450, 2397129, 5210332, -1854352, 366146, + 2627446, -243739, 713501, -1039382, 1417876, 1178432, -394063, -1547262, -3905736, 26307, + 1834488, -821949, 3251290, 410706, -365609, 482647, 2501282, 89657, -2175938, -3358665, + -1925219, -545998, -2418067, -165893, -677531, 676994, -33286, 194347, 1328219, -405338, + -932008, -3758, -864362, 169114, -384936, 300111, 1045825, -833224, -499290, -187368, + 282931, -375273, 537945, 300111, 881005, 398895, -286689, 548145, -245887, -271657, + -97711, 206158, 242129, -249645, -396748, 94489, + }, + { + -2147, -11709155, -2625299, -3059627, -1653562, -617938, 80531, 1649268, -681826, 104153, + -1361505, -95563, -58519, 7188165, 19662898, -21005612, -7402913, -4054449, 4715874, 1522566, + -4901095, 2702071, 7854422, -5509370, -2138894, 4231080, -3988414, 985158, 717260, 2831457, + -3009162, -1488206, 8621073, 14118094, 2681670, 3063922, 994285, 1820529, 4566624, -22549, + 1639604, -34360, 2046552, 3590593, -578747, 1946694, 940061, 2145336, -2088965, -2664490, + -2148021, 275952, -1553168, -2201171, 1474784, -1961726, -832687, -1950989, 155693, 394600, + -1005022, -678068, -598074, 200790, 1687922, 672699, -261993, -410706, 151934, 303332, + -170725, 1240172, -3758, -9127, 866510, 978179, 535260, 1063004, -365609, 25233, + 213138, 308701, -379031, -415001, 275952, 89121, -987306, 286689, -71404, -504659, + -269509, 289910, 421444, 186294, 153545, -164819, + }, + { + -49496276, -17406428, -7807177, -27318676, 4700842, 1552631, -3574487, 1706713, -2345052, -3145527, + -233539, 609349, 5300527, 1338419, 2149631, -3568581, -3162170, -7191386, -3656091, 7324530, + -2855080, -2800319, 1739462, -1268626, -3016141, 2654290, -3317862, -484258, 2967286, -623844, + 80531, -346819, -1929514, -341987, -3696356, -1617055, -2305861, -739271, 1693291, -589484, + -479963, -2886218, 786516, -677531, 2129767, 228170, 1180042, 802622, 1437203, 956704, + 3467649, -568546, -607201, 178241, 3024731, 1934346, 1124208, 119185, 251792, 856846, + 928787, -68719, 506269, 1549410, 171262, 201327, -117575, -826781, -886911, -226023, + 11274, -161598, 289910, 727460, -67109, -132607, 1085553, -56908, 340376, 306016, + 539018, 532576, -242129, -275415, -541703, -794032, 529892, 267362, 96637, 44560, + -207232, 46708, 244813, 625455, 41876, -108448, + }, + { + -100395, 3683471, 4094178, 446677, 640487, -194347, -409096, -257698, -1210644, 775778, + -2160906, -3865471, 1427003, 6704444, 12224551, -19028316, -3263102, -2209224, -1532767, 13022341, + 9172440, 269509, -1123671, -2944200, -1321239, 7677791, 9577240, -3675955, -8608725, 6500433, + -5144297, -4976794, -3845606, -95026, -1108102, -4328254, -4182225, -2284923, 1162862, -2078227, + 2126546, -1450088, 1372242, 3719979, 3726421, 4054449, 787053, 377420, 214748, -21475, + 2039036, -1461363, 1165547, 551366, 270046, -139586, -744103, 595390, -172872, -2206540, + -1571421, 81604, -451508, 238908, 210453, 361851, -53687, -197569, -104153, 306016, + -1370632, -159451, -1534377, -337692, 1646046, 734439, -107374, -284005, -161598, 573915, + -335544, -449898, -337692, 1014149, -979789, 62277, 66035, -199716, -593242, -338229, + 301185, 176094, -96637, 167504, 53150, -57982, + }, + { + -9454834, -123983896, 3035468, 8761196, 15422154, -2979097, 2018635, 243739, 2976412, 2339684, + -2236067, 2943663, -3072512, 4142496, -1743220, -2825015, 3244311, 3651796, -2272038, 1486596, + -530428, -3645354, 3458523, -2346126, -9645960, 2346126, 3380139, 482647, 1378148, -2309082, + 198105, 1469416, 40802, -1034550, -759136, -1664837, -2171643, 4132832, -2632278, 326418, + -2770254, 268435, -2095944, -4890357, 4057134, 3168612, 925029, 373125, 1080721, 12885, + 1614908, 1564979, 336618, -1193464, 911607, 1683627, 981937, 439697, -71941, 725850, + 1488743, 1099512, 37581, -730681, 26307, -1495186, 339839, 930934, -1614371, -1088237, + -447750, -373125, -45634, 397284, 1194001, -377957, 425202, 338766, -738198, 247497, + -491774, -733366, -690416, 216896, 264677, 90194, 26844, -267362, -228707, -914828, + 605054, -455803, 676994, 621160, -190589, 115964, + }, + { + -372052, 15610059, 5768141, -3589519, -1801739, -2414845, -1689533, -3866544, -270583, 1460826, + 2316598, 4400731, 1583769, 1284195, -16748225, -5922223, -6023692, 7953206, 2538326, 3819837, + -9591736, 6687801, -1801739, -1160178, -1655173, -3739306, 2443300, 6384469, -940061, 348966, + -4379793, 498753, 2403034, -1596654, -2115272, -987843, 1059246, 3609383, -2486786, -358093, + -4340065, -1373853, 2225867, -1787243, 2265595, -882079, -67109, 1995549, -1535988, -258235, + -2028835, 498753, -1155883, -73551, -354872, -2025077, -49929, 1046898, -418222, 236223, + 1437203, -12348, 1156420, -859530, 1584843, 577136, -1750199, -1111860, -351114, -1175210, + -372052, -749472, -72478, -226023, -741956, 414464, 355945, 761283, 486405, 973347, + 203474, 259309, 120259, -637803, -272730, -132070, 336618, -82678, -339302, -293132, + 557809, 434329, 191663, -19327, 159451, -109522, + }, + { + -46248208, -95826624, -9324374, -12163347, -5207648, 2036888, -19378892, -9594420, 5795522, -1315871, + 5898601, -3126736, -5172215, -2949032, 4067871, 2156074, 5507222, -3886946, -2540473, 2866354, + -2019172, 3465502, -1548873, 371515, 2477123, 2924873, 1983738, -1591285, -1687922, -521839, + 3140158, 3784403, 1953136, -1934883, -1022202, -3577708, 761283, 3503083, -976568, 1658394, + -2223719, -2225867, -2345052, 866510, 1624571, -1737314, 825707, 2164127, -380641, -3688840, + -34360, -1064615, 2483028, -1431835, 509491, 1353452, 326954, 1501628, -1129576, -910533, + 1699733, 424128, 47245, 829466, 744103, 27380, -1491427, -1672353, 753767, -885300, + 559956, -881542, 1216550, 180389, 1086627, -571768, -468151, -238908, -293668, 223875, + -18254, 758062, -106300, 805306, 174483, -483721, 197569, -635118, 20401, 467078, + 661962, 123480, 70330, -157840, -57445, -102542, + }, + { + -2677375, -23368380, 9707700, 7227356, -172336, -2443300, -2304250, -652835, -3376918, -1962263, + 908922, 1538135, -2058363, 4107599, -13646185, 969589, 2896419, -5916855, -5646809, -2133525, + -15342160, -8909373, -2961917, -1724966, -1248225, -10853382, -5781026, 2347200, 6140730, 2441152, + 7453916, 11846594, -1414655, -5905580, 1794760, -10581726, -1748589, -6026376, -4439923, -707596, + 5221070, 2680597, -2462627, 2570001, 1903744, -1091459, 991601, -2561948, -606127, 2024540, + 276489, -2187749, -3326989, -2150705, 2727304, 289373, -796180, 1750199, -1181653, -795106, + 1453310, 1439351, 2636573, -262530, -1651952, -1101122, 1118839, 593242, 1892470, -217970, + 1045825, 250182, 1341104, -1198833, 914291, -64425, 212601, 114890, -445066, -233002, + 496069, -966905, -1171452, -470299, -336081, -149250, 368830, -431107, -212064, 410169, + -181999, 65498, 402116, -171799, -374199, 319975, + }, + { + 2539936, -101021392, -5902359, -8655970, 570157, 10860362, 53150, 12964359, -205622, -312996, + 3846680, 11054709, -3070902, 4689031, -1730872, -3009698, -4135517, 835371, 6580427, 5697274, + -1855963, 949188, 2648921, 3543348, -1976759, 2428267, 2030446, 5952825, 1264868, -3110093, + -4741644, -2905009, 1222992, 39728, 394063, 2024003, -3671123, -505732, -502511, 1572495, + -1564979, -3589519, -1327145, 2661806, 2403034, -145492, -821949, 4003447, -895501, 685584, + 1916629, -134755, -533113, -684510, 76236, -603980, -2857764, 302795, -1292248, 1683090, + 209917, -972273, -464930, -1784022, -1792612, -293132, -784905, -265751, 737124, -406411, + 312459, 1254667, 56371, -1235877, 111132, -783295, 987306, 54224, -153008, 532039, + -161061, 114890, 206695, 515933, 427349, -1210644, -539018, 215285, -177167, 139586, + 37581, -268972, 110059, 163209, 198105, -215285, + }, + { + -3549254, -45527728, -2059437, 3244311, 1067299, 3301756, 4111358, -1401770, -732829, -1936493, + -1516124, 5906, 8227547, 15365246, -9771587, -10363756, -10142565, -5963562, 4039954, 11848204, + -628139, -7889318, 5078799, -3973382, 11980811, 2505577, 8685498, -7372312, 1487132, -86973, + 803696, 901943, -2761127, -619549, 4760971, 1681480, -1960653, 3428995, 666257, 1160715, + 2091112, 5370320, 5619428, -1571958, -4287451, 1021129, 1795296, 1100585, 302795, -823023, + 1753420, 4181151, -2043868, 54761, -1073742, 321586, -677531, 3758, 805843, -1383516, + 570157, 995359, -507880, 264677, 979789, -74625, -1739999, 1133871, -497679, -432181, + 913217, -76773, 946503, 482110, -196495, -304943, -440771, 399969, -733366, -768262, + 405338, -522912, -1088237, -701153, -267899, -199716, 608275, 64425, -387084, -41876, + -105227, -285615, -359704, -381715, -91805, 384400, + }, + }, + { + { + -296890, -28368796, -19063750, 6348499, -3533148, -1118839, -215285, 2534031, -214748, -4662187, + 5350456, 3365644, -4503810, -204548, 779537, 3435974, -2412161, 1964948, -1828046, -1516124, + -3050501, 2159832, -241055, 5494337, 560493, -1196685, -1603633, -1957431, 959388, 1251446, + 3680250, -1353989, 1188095, 849330, 1344325, 434865, 2537252, 2450816, 3462281, -463320, + -4409321, 628676, -3398930, -2076080, -371515, 705985, -2398739, -24696, -196495, -1066763, + 1628330, 55835, 12885, -193274, 1150514, -497142, 1388885, 964220, 792958, 898185, + 1072668, 643708, 970663, -755377, 691490, -374736, 1186485, 518617, -166430, 629213, + 861678, -75699, 140660, 56908, -877247, -312996, -118112, 26307, -148713, 40265, + 77309, -155693, 257161, 125091, 55298, 5369, 224412, -90194, 472983, 286152, + 296353, -14496, -11811, -286152, -15569, 9127, + }, + { + 23622, 6746320, -1289027, -5175436, 5161477, -470299, 1264331, 2928094, -2116345, -638340, + 2830920, -2803540, -3184182, -242129, 5774047, -1691143, 10282689, 3621731, -585726, -6721624, + 5859409, -687195, 2336462, -4565550, 475668, 1447404, 1904818, -2531883, -2660195, 3111167, + -1767916, 2711735, -4966056, -3461744, 2588255, 3102040, 1878511, 2780455, -1615445, -257161, + 337692, -2221572, -77846, -742493, -1736777, 1754494, -3040300, -963683, -1799591, -706522, + 675921, -884763, 195421, -574452, -1611, -1964411, 466004, -219043, 22012, -657130, + 712428, 437013, -1103270, 956167, 621160, -9127, 318901, 31139, -100395, 92879, + -265751, -216896, 213675, -9127, 71404, 818728, -56908, 369904, 1611, -880468, + 536334, 92342, 464393, 95026, 436476, -237834, -308701, 49392, -417686, 136365, + 88047, -235149, 483184, -126165, -135828, -52613, + }, + { + -527207, 19980188, 4352413, 6295885, 7241315, 651761, -668941, -2118493, 2313377, 339302, + -621160, 1821603, 1986422, 179315, 967441, -8134131, 2350421, -6237367, 3685082, -517544, + -914291, -8712878, 8290361, 1436130, 8142185, -522912, 962073, 2617246, 1068910, -616865, + 4812511, 523449, -2208150, -4449049, -4095251, 1966021, 3133179, -1652489, 1675574, -96100, + -1341104, -592169, 281857, 630286, -712428, -969589, 1367947, 1469416, -1495186, -778463, + -422517, -353261, -526670, 198105, -73014, 2323577, -1640678, -521302, 2429878, 417149, + -1036161, -316217, -1227824, 445066, -663572, 508417, 162672, 540629, -761283, -1292785, + -521302, -603980, 419833, 186294, 20401, -53150, 113280, 446140, -249645, -1031866, + 509491, -200253, 156766, -157840, -47782, 537, 495532, -315680, -106300, 264141, + -156766, -63351, -84289, -42950, -424665, -36507, + }, + { + -23567022, 18550500, -17559974, -788127, 5498632, -1318018, -1999844, -1063541, 4946729, 555125, + 1455994, -777926, -1306207, 2333241, 7557532, 1609002, -3379066, -2422899, -7905424, 3519189, + -317291, 180926, 4118337, 2831994, -5536750, 2375117, -1850057, -2325188, 1240172, -541166, + -3360275, 1130650, -2154463, 1429687, 1575179, 2678449, 1738388, -1437203, 456877, -3551401, + 863825, 1144072, 748398, -2181307, -244276, 4637491, -2294050, -246424, -2192044, -666257, + 1212791, -1268089, -166430, -706522, -398358, -1194538, 1230508, -469762, 404264, -718870, + 1685238, -920734, 916439, 229244, 973884, -147640, 363462, -969589, 254477, 907312, + 1378148, -486942, -706522, -93416, -544387, -448287, -1611, -8590, -435939, -442919, + 376347, 159451, 263604, -513785, 176094, 73014, 6979, 275952, -377957, -30065, + 82141, 293132, -141197, -416075, 105227, -96100, + }, + { + 2338073, -13304735, -4548371, 2257005, -161061, -488553, -289373, 1289027, 407485, 28991, + 3804267, -847182, -115427, 1526324, -2951716, 9635222, 5100274, -11251741, 8284992, -10091026, + 5455146, 5692979, 9485972, 29528, 8626979, -9330816, 1772748, 2187749, 8278013, -13067438, + 5304285, 744640, -1046898, 2709051, 1965484, 3086471, -522375, -1251446, 225486, 3303367, + 2757369, 318364, 978716, 1706176, 1627793, -895501, 151934, 841814, -1503239, 1547799, + 1898912, -22012, -781684, -7516, 570157, -266288, 1307281, -928787, -1180042, -737124, + -528818, 85362, 464393, -499827, -172872, -746251, -111669, -1304596, 308164, 488553, + -1147293, -563178, 848793, -579284, 557272, 215285, 523986, -621160, 77846, 246961, + 272194, 444529, 314606, 255014, -136902, -417149, 284005, -651224, 272730, 135828, + 372052, 352724, -27380, 211527, 92879, -292595, + }, + { + -35866736, 17620640, -7864622, 36538896, 3591667, -1979980, 1707250, 7601555, 2759517, 2679523, + 884763, -2852395, -3311957, 5437966, -1879585, -4026532, 867047, -4745402, 2705830, -2195265, + -1377074, -5628555, 4200478, 460098, -1338419, -11274, -286689, -855235, 1267015, 1422171, + -549756, -959925, -2220498, -2408940, -3584150, -2764348, 15569, 2062658, -3239479, -649614, + 1784022, -1283658, 703301, 1414655, 2752537, -583579, -2602213, 26307, -2589865, -516470, + 3216394, -816581, 657130, -318901, 1753957, -745714, 389768, -149787, -391379, -828929, + 1850057, 1024887, -2517388, 540092, -750546, 544924, 156229, 336081, 1472100, 378494, + 27380, 184147, 92342, -283468, -403727, 80531, 55298, -942745, -197569, 209917, + 463856, -438624, 567473, -392453, -20401, -98247, -161061, 380641, 168577, -576063, + -683437, 4295, 84289, 164819, -235149, -246961, + }, + { + -538482, -13049721, -1442572, -1087164, -36507, 126165, 386547, 1388885, -1479616, -192200, + -1178969, -974421, -4108136, -697932, 6841346, -13548474, 4413616, -2214593, 1030255, -2621541, + -4341675, -5112622, 5747740, 11594801, 7635915, 6250788, -12972412, -2763275, 2148558, 8601746, + 3820910, 2542621, 7231115, 5603322, 786516, 528281, -1065689, 438087, 2470680, -3215320, + -1676648, -1716913, 123480, 2500208, -1811939, 929324, -22549, 1758789, 58519, -301185, + -1296543, -583579, -20938, -362925, 2805688, -1989107, -2403034, -1453310, 988916, -330176, + -1097364, -175557, -1377611, -1539746, 17717, -56908, 163746, -550293, -504659, 369904, + -83215, 671626, -101469, 713501, 690416, 161598, -501974, 743029, -442919, -430570, + 162135, -33286, -377420, -168041, 187368, 30065, -525060, 389768, 44023, 326418, + -349503, 85362, 248034, 122943, 292058, -175020, + }, + { + 29112362, 95771864, -3612604, -25240986, -613643, 3562675, -741956, 1618129, -3895535, -4253628, + 3934190, 1531156, -1117228, -1169842, 1035624, 2191507, 1364189, 3564823, -2561948, 3168075, + -2743947, -3212099, 3059627, 17717, -3811247, 3139621, 827855, 4373351, 2098629, -3899294, + 1710471, 3093987, 602906, -102005, -464930, 549219, -978716, 1261647, -1104344, -4010963, + 664109, -2543695, -1333051, -1111323, 1115618, 350040, 1848983, 719407, 579284, 292058, + 1356673, 1277216, 1699196, -363998, 1180042, 947040, 1901060, 314069, -510564, -1345399, + 1161252, -1104344, -1364189, 1019518, -847182, -316754, 377420, -526670, -445066, -547608, + -1074, 27380, -220654, 957778, 367757, 494458, 901943, 114890, 44023, 54761, + 422517, 267899, -150324, -226560, 97174, -100932, 99858, -49392, 311922, -221191, + -329639, -173409, 113280, 178241, -384400, 89121, + }, + { + -839129, -3177202, 425202, -668404, -200790, -344134, 666794, 490700, -539555, 206158, + -1349694, -268972, 925029, -1379221, 10502806, -14554034, 9887015, 7209640, 2179696, 9076340, + 8746164, -5857262, 1839320, 3786551, -7014219, 8608188, 12501039, -62277, -4976257, 9199820, + -2389076, -4468914, -1023813, 2563022, -3875671, -4665945, -4311074, -2995740, 1094143, -3042448, + -109522, -82141, 4295, -1432372, -270583, 1745367, 1131724, 1625645, 452045, -360777, + 729071, -853625, 802085, -216896, 1078037, 124554, -126165, 1422708, -948114, -1728188, + -297427, 1084479, 230318, 626528, 412317, 508417, -82141, 395137, 376883, 748398, + -504122, 318901, -1199370, -56371, 1532230, -110595, 154082, -90194, -391379, 499290, + -9127, 91268, -502511, 1036698, -796180, 18790, 58519, -252866, -130997, -406411, + -271657, 65498, -91805, -53150, -129923, -38118, + }, + { + 10341208, -113788720, -23324894, 6403260, 12664785, -5187247, 8298414, 2255932, -712428, 154082, + -931471, 3226594, 2763275, 8548596, -1318555, 483721, -1524177, 5191542, -3670050, -454193, + -728534, -3997541, 987306, 1190243, -4645007, 6410776, -758062, -4698158, 4394289, 4329864, + 860604, -3833258, -3293166, -2264522, 4416837, 817118, -2206003, 4303557, -329639, 1382443, + -2728378, -249645, -1224066, -3615289, 2784750, -75699, -2659122, -588411, 812286, -3064459, + -344134, -687195, -213138, -806380, 78383, 38118, -754304, -784905, -774168, 173946, + -410706, 289910, -404801, -697932, 411780, -544387, 466541, -297427, -840740, 452045, + 688805, -199716, -299037, 382789, 651224, -406948, -259309, 354872, -143881, 870805, + 177167, -240518, -368830, -361851, 2684, -337692, 106300, -60130, -288837, -737124, + 409633, -423054, 176094, -62277, -215822, 399432, + }, + { + 1435056, 8686571, -466541, 3702799, 1879048, 2084133, 4070019, -3061238, -2706903, -85899, + -344671, 9364639, 1201517, -1233729, -12890271, 1687385, 473520, 1924682, 1443109, 12584254, + -7384123, 2940979, -540092, -1597728, 1554241, 3298535, -132607, 2614561, -4079682, 2472291, + -3247532, 1108638, -163209, -315143, -913217, 393526, -209380, 1590749, 741956, 3798362, + -1274532, 2645700, 2975339, -572304, 2221572, -726386, -703838, 886374, -1167694, -686658, + -1854352, 874563, 256624, -44023, -17180, -1964411, -1252520, 496069, -436476, -1199907, + 357019, -511101, 74088, -1404454, 515933, 8590, -973884, -573378, 222801, -537, + 1014149, 347355, 670552, -199716, -193274, 251792, -261456, -248571, -940598, 440234, + 201327, -125628, 381178, -201863, -20938, -541166, 154619, 37581, 425739, 2147, + 318901, 292595, 280247, -71941, -27380, -97174, + }, + { + 50413252, 35258996, 702227, -7250442, -6380174, 29391534, 5249524, -4972499, 2742337, -7398618, + 7158637, 299574, -1242856, -2199560, -4487704, -3618510, 7365869, 2858301, -1229971, 4539244, + -667331, 3035468, 333934, 1690070, -346282, -1438814, 1449015, -1046361, -1875827, -2151242, + -17180, 462246, 632434, 2084670, 2680060, -1481227, -312459, 4767951, -1348620, 2536715, + -2702608, -1379221, 1228898, 4188667, 732829, -829466, 1095754, 3206730, 890132, -556198, + 1948841, -287763, 923418, -3132642, -60130, 1745367, -789737, 740345, 977642, -536871, + 740345, 645319, 580357, -411780, 274341, -206158, -510564, -312459, 123480, -1290638, + 1287953, -664109, 574452, -248571, 749472, -674310, -836445, -471373, -221191, 286689, + -64425, 258772, -19864, 591632, 336081, 161598, 62277, -314606, 65498, -569620, + 269509, -37581, 152471, 64961, -2147, 45634, + }, + { + 1793686, -28652264, -1344862, 5824513, -1291711, -4742718, 702227, 3080029, 160524, 602369, + -384936, -843424, -2978560, 8870181, -13907641, 2818036, 6579353, 1820529, 1702418, -2950106, + -1313723, 1944010, 4516158, -3038689, -8684424, -3687230, -3251827, -6707665, -5639292, -5921686, + 3175592, 5375689, -4371203, -5535139, 5264556, -4173635, 119722, -3060164, 302795, 1495722, + 2303713, -1558536, -6741488, -763430, -1313186, -1458678, 1190243, -2699924, 236760, -178241, + -263604, 652835, -150324, 221728, 2309082, -555125, -277025, 1379221, -1157494, 540092, + -82141, -1003949, 868657, -194347, 34360, -778463, 1220308, 978179, 2269890, 34897, + 651761, 391379, 943819, -1242319, 288837, -753230, 418222, 356482, 198105, 76236, + 550293, -290984, -751082, -317828, -479426, -598074, 83752, -86436, 253403, 35433, + -528818, 2147, 552977, 412854, 66572, 89121, + }, + { + 17248588, -83963928, -3230352, -716723, 360777, 16364899, -7184407, 3784403, -4637491, -2284386, + -4023848, 4317516, -1746978, -882616, -10179609, 2697240, -985695, -629213, 2407329, 541703, + -5435281, -4695473, -349503, -2046552, -3602404, 1484985, -339839, 1246077, 2991982, 3386045, + -340913, -3088082, -565325, -581431, -537945, -1054415, -1890323, 3034395, -990527, -966905, + 1594507, 1142998, -2927020, 434329, -223338, -449898, 1617055, 4720169, -220117, 1240709, + 1219771, 681826, 633508, 985158, 1613297, 542777, -2605972, 1649804, -942745, 1007707, + 1264868, -258235, -313533, -645319, -451508, 409096, -339839, -222801, 369367, -969052, + 453656, 715112, -105764, 518080, 1018981, -557272, 505732, -62814, 6442, 657130, + -62277, 237297, -115427, -260919, 222801, -621160, -484258, 196495, -255551, 263604, + 268972, -127238, -14496, 403727, 449361, -30602, + }, + { + 2876554, -37217504, -4278861, 1187022, -275952, -11811, 3360812, 1114544, 2131915, 328028, + 1214402, 4806069, 4843650, 8324184, 551903, 1869921, -5279589, -3790846, 1684164, 34360, + 3656628, 705448, 5233418, -11482058, 5147519, 1293322, 7626252, -7131793, 6372121, 1478543, + 5534066, 5004174, -1085553, 1053878, 4035659, -86436, -330712, 2122788, -2896956, 1200443, + 1977833, 966905, 1585917, -1585380, -2835752, 1511829, -751082, -525060, -675384, -783295, + -261993, 2717104, -1507534, 1119376, 1012539, 734976, -1352378, 840203, 2253784, -200253, + -57445, -256624, -1242856, -481036, 224412, -241592, -914828, 1040993, -79994, -698469, + 763430, -390305, 613107, -530965, -1051193, -741419, -736587, -107374, -676457, -439697, + 571231, -303869, -343597, 69793, 566399, -537, 242666, 282394, -413391, -115964, + 76236, -45097, -543313, -234613, -14496, -78383, + }, + }, + { + { + 2433099, -13093208, -18281528, -13930190, 6962679, -1974611, 1298691, 1913408, 1882269, -416612, + 1573569, -5011690, -1278827, 3055869, -153008, 3550327, -2765959, 274341, -1898376, -6189048, + 1571958, -1040993, 2762738, 964220, 4214974, -248034, -3554622, 846645, 2025077, -110595, + 2459943, 1949378, -1664300, -656056, 2054605, 928250, 4438849, 2153926, 492848, 1144609, + -2043868, -350577, -2395518, -2598455, 264141, -200790, -2527588, 825171, -363998, -1023276, + 393526, -294205, 572304, 896574, -717796, -315680, 1066226, 501437, 2484639, 733366, + 216359, 1112397, 351650, -211527, 34897, -541703, 564788, 1003412, -231391, 1302986, + 380641, -186294, 698469, -767189, -747861, -353261, 118648, -296890, 78383, 34897, + -375273, -112743, 608275, -15569, 249108, 174483, -316217, 93952, 273804, 133144, + 319975, -74625, -195958, 26844, -270583, 172336, + }, + { + 100395, 10466298, -6157910, 12530567, -9897215, 996969, 2131915, -1363652, 2730526, -2241973, + 2459943, -2522220, -2775086, 2978560, -3827353, 9302362, 5542656, -2238752, 680752, 4875862, + 1286343, 4556961, -3002719, -6236293, -4850629, 4717485, 1714229, -819802, -1689533, 2364916, + 1286343, -4615479, 2839510, -6015102, 750009, 4780836, -20401, -484794, 1101122, 192737, + 621160, -2557116, -927176, 1567663, -2301029, -2356863, -41339, -119185, -2304787, -1497870, + 32749, -460098, 132070, -266288, -1252520, -105227, 760209, -416612, 373125, -1240709, + 640487, -629213, -384936, 1711008, 491774, -94489, 35970, 158914, -295279, -34360, + -466004, 317291, 604517, 128849, -178778, 692027, -91805, 22012, 176631, 264677, + -680752, 748398, 92342, 351114, 90194, -39192, -104153, -536871, -148713, -125091, + 344134, 70867, 123480, -341450, -221191, -15569, + }, + { + 1192927, 13865765, 6801081, 33137284, -10918344, 1063541, -138513, -734439, -221191, 1330366, + 1392106, 2335389, 267362, 3993783, -992674, -7793755, -870805, -2093797, 2357400, -3160022, + 2285996, -9189619, 5714454, 3167539, 3445638, 5458367, -1785096, -836982, 1555315, 4904316, + 418759, 3093987, -1813013, -5914170, -1130650, 2036888, -396748, 122943, -839666, -159988, + 273267, 2258616, 473520, -1319629, -347355, -2223183, 1151051, 421981, -274878, -73551, + -1517734, 558346, -359167, 200253, -361851, 1420560, -1249836, 988916, 1026497, 1162862, + -1042066, -731755, -1591285, 1067836, -828392, 106837, 262530, 638340, -161598, -1596117, + -349503, 36507, -134218, 289373, -13959, -200790, 349503, -132070, -286152, 102005, + -116501, -282394, 11274, 333934, 43487, -27380, -129923, -212601, 268435, 73014, + -150324, 501974, -149250, -250719, 6442, -459025, + }, + { + 13217225, -31369904, -2071248, -4114579, -4758287, -128849, -934155, 387084, 1484985, 905164, + 6890738, -3654480, 2062658, 1163936, 7343321, 832687, -1792612, -3406446, -1105954, -518617, + 1676111, -2725694, 4348655, 592706, -2649995, 2048163, -2572149, -1852205, -1321776, -779537, + 325881, -338766, -280247, -12348, 2180770, 1397475, 1537598, -337155, -1695438, 126702, + 1194001, -340376, 970126, -3251827, 1362042, 3499325, -1575179, -1814087, 102005, -1931125, + -297963, 706522, 624381, -1624035, -1363115, 656056, 170188, -950262, 153008, 102005, + 47245, 475668, -347892, 1205275, 165893, -501974, 425202, 130460, 367757, 1093069, + 1011465, -12348, -278636, -378494, -354335, -466541, -383863, 110595, -108448, -174483, + -163746, -74088, 230854, -176094, -161061, 401043, -98784, 18790, -172872, 139586, + -270583, 259846, -92879, -396748, -98247, 2147, + }, + { + -1617055, -20333448, 7088844, 2279554, -467615, 4832, 115427, -1213328, 839666, 1075889, + -812823, 5463199, -3894999, -606127, 2640331, 4931160, 8203925, 4698158, -7626252, -4474282, + 783832, 4643934, 9880035, 3623879, -1584306, 9575093, 2136209, -2289218, 3919158, -4519380, + -74625, 2197413, -1244467, 821413, 5752035, 454730, -1145146, -2330020, 363462, 3776350, + 719944, 2083059, 1294396, 443992, 954557, -1175210, 914291, 722091, 271120, 597537, + 1600412, -248034, -270046, -797253, 310848, 296890, 915365, -868657, -1340567, -632971, + 1002338, -1264331, 97174, 358630, -448824, -983011, -550293, -256087, -682900, -36507, + -48855, -736050, 442382, 188442, 374736, 106300, -55835, -396748, -39192, -225486, + 493384, 197032, 941135, 207769, 171262, -324270, -491774, -124017, 189515, -148713, + 421444, 516470, 219580, 8053, 69256, -253940, + }, + { + 21093122, -66791036, -3159485, 40919228, 1719598, -1477469, 4646618, -110595, 5756330, 4628901, + -2662343, -653909, 647466, -9127, -3674882, -2079838, 740345, -3004330, 2344515, -4582730, + -3011846, -1304596, 2070174, -855235, -884763, -1653026, 2692945, 1369021, 2283849, -1632088, + -1135482, -216896, -3615826, 277025, -2414845, -1666984, -2442763, 631897, -1979443, -836982, + 523449, 148713, -212064, 3876208, 687195, 366146, -727460, -1602560, -1687922, 753230, + -62277, 3208878, -1719061, 2397129, -705985, -507343, -1493575, -541703, 5369, 350040, + 1411971, 830002, -799401, -623307, -85899, 615254, -190052, 489626, 391916, 1353452, + 10201, -751082, 256087, 263067, -98784, 99321, -232465, -428960, 39192, -199179, + 565325, -68719, 363998, -65498, -467078, -139586, -148176, -3758, 370441, -314069, + -597000, -12348, -92342, 231391, 21475, -314069, + }, + { + 118112, -5201743, -10254234, -228170, 1155346, -260382, -111132, 1227824, -1379758, -2014877, + 2683281, -2288681, -5570573, 5759551, -1181653, 7024956, -10023380, 8039105, 5225902, -14727980, + 1173063, -6474663, 6207302, 12396349, 9160628, -5778342, -9507447, 4742718, 4258460, 2978560, + 9176734, -1483374, 6291590, 3802657, 3240553, -4518306, 1159641, 1714766, -678068, -4430796, + -2270427, 180926, 53687, 168041, 469225, 63888, -284542, 611496, 1316944, -918586, + -517544, -1050120, 824634, -227096, 321586, -111132, -2800856, 239981, -171262, -432718, + -206158, -178241, -1273458, -612570, -950262, -303869, -438087, 423591, -1020592, 413927, + 417686, -183073, 283468, 691490, -87510, 139586, -114354, -365609, -134755, -663572, + 576063, -202400, -71404, -386010, 183610, -129386, -143881, 287763, 296353, 269509, + 23622, 137439, 52613, 266288, 16643, -79994, + }, + { + -5393405, 131886632, 8508330, -35214972, 6905771, 2022930, 3821984, -3484292, -1846836, -2554969, + -318364, 4953708, -583579, -576063, -2376728, 3484829, 1673964, 2855080, 5907728, -1822140, + -911607, -3582540, 10737, -1548873, 560493, 1557463, 2326262, 4905390, 2663954, -3131031, + 113280, 820876, 3859028, -2512019, 1930588, 1379758, -67646, -507343, -2363306, -2867965, + 115964, -1427540, -1508070, -796180, -260382, 252329, 877247, 1635846, 1245004, -209917, + 763967, 703838, 3405909, -456340, 556198, 685584, 866510, -182536, -206695, -1991254, + 1588064, -382252, -727997, -818191, -302258, -454730, -309238, 66035, -659278, -487479, + 354335, 22549, -537, 335007, -5369, 907849, 259309, 263067, 412317, 205085, + -264141, 208306, 17180, -463856, 408022, 188442, -184684, -108985, 332323, -83215, + -458488, -347355, 289910, -361851, -388695, 448824, + }, + { + 1611, -2850785, -5083631, -659278, 99321, -387084, 552440, 1280437, -383326, -885837, + 388695, -833224, 1549946, 1140314, 6048388, -2754685, -1194001, 9899900, 5356361, 1731409, + 3521873, -2888366, 2298344, -672162, -3583613, 3863860, 10512469, -1709934, -636729, 1813013, + -1409286, 1962800, -520765, 246424, -3792993, -2596308, -4348655, 12348, 307090, -1218697, + -2443837, 253940, 740345, -2670933, -810675, -653909, 1985349, 2770254, 164283, -501974, + -857920, 1566053, -894427, 867583, 386010, -117575, 890669, 722091, -1636919, -408022, + -54761, 134218, 1034550, 719944, 231928, 121333, 783832, 265214, 452582, -94489, + 793495, -17717, -650688, 535260, 609885, -251256, 92342, 85362, -239444, 341450, + -367757, 903554, -332860, 24696, -209380, 28454, -109522, -428423, 169651, -380105, + -253403, -156766, 120796, -193810, -25770, -122407, + }, + { + -11510512, -100749736, -2134062, 2820183, 3777424, -4875325, 5105643, 1567126, -3702262, -425202, + 3115999, -1700807, 2542621, 4090956, 2281165, 4155918, 557272, -3089692, -1819992, 1638530, + -4532264, -993748, -2902861, 1845762, 1560684, 879395, 1439351, -1246614, 1436130, 954020, + 2907693, -3056943, -3089155, -518617, 1184874, -592706, 498753, 2513093, 2222109, 120259, + -2289218, -1071594, -479426, -1767379, 1320166, 360240, -2501819, -267899, -577136, -2289218, + -2178085, 145492, -1329829, 593242, -651761, -299574, -690953, -1939178, 1322313, -8053, + -1517734, -60130, -824634, -393526, 863288, -76773, -109522, -814970, 160524, 1128503, + -527744, 267362, -530428, 587337, -195421, -268435, 81068, -161598, 337692, 110059, + 492311, 445066, -674847, -566399, -264677, -216359, -451508, 94489, -477278, -166967, + -53687, 140123, -309775, -33286, 148713, 172336, + }, + { + -1678795, 8750459, 679679, 10854993, -890132, 540092, 4806069, -2341294, -1592896, -1912334, + 3221, 7515656, 1806571, -1037235, -8373039, -2552821, 6217502, -1415192, 6495065, 3164317, + 8597988, -3225521, -79457, -2412698, -3212636, 7192997, -1471026, 1909650, -1997697, 2560338, + 112206, -2063195, -4294968, 1465658, 1289027, -310848, 679679, 1227824, 1450088, 2261837, + 727997, 3743064, -1090385, 2212982, -1051730, 1544578, -235686, -887985, 42950, -2704756, + 621697, 656056, 1012539, -1251983, 720481, -647466, -1277216, -230854, 244276, -914291, + -692027, -802085, -139050, -703838, -20938, -685047, -336618, -290984, -521839, 35433, + 959925, 1034550, 628676, -112206, -467078, 544387, -458488, -282394, -527207, 28454, + 63888, -119185, 339839, 30602, 149787, -629750, -134755, 519691, 269509, 551903, + 76773, 279173, 130460, 127775, -381715, -77309, + }, + { + -29445222, 140576432, 5521718, -2935073, -12776991, 22927072, 17396228, -3273839, 2069637, -3869229, + 1259499, 1798518, 1960653, 1375463, -5435818, 163746, -1654099, 3011309, 539018, 176631, + 9049496, -1502702, 1233193, -1441498, -2173790, -3011846, 5463199, -1876364, -1362042, -3078955, + 125628, 495532, 85362, 3809636, 391379, 3679713, -2008434, 2610266, 3374771, -1052804, + -1486059, 869731, 274878, 2433099, 698469, 1614371, -919123, 2810519, 1079111, 1163936, + -594316, 413391, 34897, -2647847, 376883, 493921, -878321, 489626, 1066763, 1343251, + -1311576, 1425929, 394063, -963683, -12885, -83215, -379568, 164283, -198105, -538482, + 424128, -301185, 417686, 180926, -39728, -215285, -643708, -205622, -88584, 70330, + 278099, -454193, 389231, 8590, 310848, 6442, -161061, -100395, -183610, -382789, + 233002, -164283, 85899, 156229, 30065, 64425, + }, + { + -653909, -32959042, 7090991, 4155918, -406948, -3388192, -1625645, 1594507, 3088082, -813896, + 3358665, -2336999, -1324997, -5229123, -6539625, 289373, 4128537, 2975339, 1228898, -2555506, + 13326210, 1243393, -4786741, -4775467, -14400488, 9422621, -7961259, -6666326, -5141613, -2627446, + -1132261, 3255048, -2309619, -2979097, 110059, 2602213, -3980898, -1023276, 1804960, 583042, + -1547262, -2721399, -2542621, -2184528, -78920, -551903, -2065342, 139050, -756451, -1068910, + 51003, 1078574, -483721, 1512902, 281320, -454730, -367757, -255551, -734439, 2507724, + -1532767, 113280, -1044751, 675384, 168577, -68719, 48855, 2450816, 392990, 962610, + 240518, 654446, 125091, -351650, -496069, -637266, 380105, -143881, 368293, 258235, + -103616, 532039, -212601, -309775, -382252, -909459, -89657, 427886, 20401, -94489, + -297963, 263604, 29528, 286152, 479963, -236223, + }, + { + -26346404, -25414396, -132607, -2088428, -4167729, 8647917, 890669, 1539209, -4334159, -2390149, + -2934000, -547608, 3630858, 3761855, -15872052, 2292976, 1685238, -200253, -2016487, -3067681, + -874026, -3009162, -2043331, -3699578, -695248, -3200825, 4002373, -2667712, 2437394, 3670587, + 2743947, -3764539, 427349, -1281511, 683974, -4478041, -181999, 2517925, -719407, 162672, + 717796, 933619, -2694018, -513785, -1804960, 2408940, 2277407, 1462436, 2589329, -452045, + 1551020, -13422, 1068373, 1043677, 627602, 1737851, -1559073, 301185, -235686, 1421097, + 175020, -23622, 200253, -948114, 258235, 748398, 121870, -671089, 548682, -831076, + 952409, -104690, 300111, 466004, 914828, 255551, -67646, -26307, 381178, 557809, + 8590, 168577, -200253, -255014, 343597, -77309, -118648, -569083, 110595, 345745, + 204011, 140123, -93416, 441308, 180926, 121870, + }, + { + -1608465, -34250216, 1440962, -1984275, -828392, -38655, 627602, 2823404, -1206349, 4095251, + 1137630, 3387656, 5115306, -3696356, 20219096, -5206574, -1100049, -4203163, -1392643, -1983738, + 3144453, 445066, 3260417, -5733782, -4121558, 4154844, 3047816, -4095788, 5030481, 6405944, + 3804267, 2231236, 3018288, -1444720, 4020090, 1083942, 752156, -1795296, -604517, -347355, + 4494147, -3244311, -909996, -387084, 741419, -645856, -161061, -1115081, -1259499, 740345, + 738734, -143881, -736050, 922344, 1708323, 990527, -1430224, 17717, 814433, -307090, + 371515, -663036, -753230, -632434, -461709, 224412, -147640, 678605, -751619, 10201, + -319975, 562104, -563178, -924492, -1145146, -442919, -180926, -466004, -662499, -476205, + 468151, -165893, 94489, 617402, 98247, 66035, 17180, 267899, 25770, -40802, + -56908, -147640, -314606, -318364, 106300, -239981, + }, + }, + { + { + -5139465, 15106474, 27575838, -24948392, -253940, 351114, -462783, 849330, 7381975, -218506, + -5063230, -5754720, 157840, -3034931, -5279589, 2017024, -2396055, 192200, -168041, -6970732, + 2812130, 655519, 3298535, -1606855, 1914482, 1168231, -2112587, 1944010, 4105989, 306016, + -862215, 1979443, -671089, -868120, 2732673, -978179, 1345935, 349503, -1646583, 775242, + -154619, 859530, -918586, -386547, 554051, -985695, -713501, 2042794, 122407, 786516, + 505732, -1796907, -817654, 213675, -1642288, -1434519, -323196, -297427, 1652489, 72478, + -253403, -126702, -73014, 443992, -9664, -550830, -351114, 266825, -854162, 745714, + 163746, -220117, 1031866, -289910, -278636, 147640, 557272, -395674, 55835, -113280, + -62814, -165356, 390842, 83215, 69256, 147103, -78920, 202400, 11274, -73551, + 184147, 185220, -159988, -15569, -300648, 26307, + }, + { + 1030255, 16428787, 76236, 17314624, -9386651, -729071, 668941, -1291175, 3673808, -1542967, + 1807644, -2404645, -3704946, 748398, -7461969, 4020626, -1952600, -4945118, -4058744, 6029597, + -1024887, 1384590, -360777, -574452, -4999879, 3342022, 660888, -490700, -316217, 1648194, + 801548, -2576444, 6357626, -5444945, -1828582, 2743947, -437550, -951335, 2353105, 890132, + 953483, -150861, 377957, 2617246, -2565169, -3220152, 440234, -654446, -1561221, -388695, + 1227287, 1187559, 1343788, -285615, -908386, 15032, 476205, -2147, 356482, -537945, + 192200, -775778, 307090, 1129576, 82141, 164819, 172872, -270046, -384400, -11811, + -985695, -588947, 358093, 100395, -462246, -31675, -638876, -90194, 150324, 297963, + -926639, 488016, -44023, 120259, 62277, 69793, 49929, -614717, -537, -288837, + 284005, -5369, 30602, 48318, -39728, 134755, + }, + { + -545461, 13346074, 1617055, 21673478, -11505681, 4618701, 2719251, 1489817, -1639067, -1384053, + 804233, 2728378, 1464047, 507880, -1322850, 315143, 4355634, 2252710, -2437394, -6857989, + 6114960, -2967823, 1930588, -1621887, -1254131, 2786897, -2937758, -1252520, -54224, 3937948, + -3129958, -733903, 533113, -2000381, 452045, 1384590, -462783, -1074816, -1027034, 1157494, + 1911797, 3803731, 831613, -782221, 1921998, 657130, 1953673, 739271, 353798, -454730, + -734976, 743029, -666794, 1322313, -38118, 14496, -1842541, 520228, -16643, 1459215, + -240518, 264141, -421444, 1778653, -670552, -621160, -323733, 248034, -323196, -999117, + 573915, 715649, 174483, 481573, -30602, -183610, 363462, 258235, -9664, 305480, + -346282, -185757, -208843, -119185, 16643, 78920, -251256, -97174, 311922, -170188, + -117038, 529355, -44023, -96637, 99858, -416075, + }, + { + 4689031, -24580634, 4743792, 2150705, 9389335, -355409, -1230508, 2621004, 2435247, 438624, + 2918967, -7910793, 7076496, 4429722, 5448166, -1540283, -3633006, -5050345, 532039, 1261110, + 1670742, -3237332, 1945083, 1136019, -2328946, -382789, -68719, -821949, -1103807, -91805, + 2816425, 1821603, 909459, -1258962, 2165737, 2529199, 2827699, 79994, 428423, -121333, + 341987, -18254, -1264868, -3097208, 2046552, 1469416, -2474975, -1336809, 2275259, -462783, + -319438, 191663, 548682, -926102, 137439, 1071058, -266825, -1162326, -178241, 55835, + -813359, -390305, -819265, 1712618, 146029, -182536, 309238, 391379, 468151, 762894, + 130460, -202937, 576063, 363462, -264141, -195421, -146566, -324270, 58519, 469762, + 103616, -86973, 41876, -186294, -197569, 129386, -230854, -163209, -236223, 392453, + -352187, -125091, -227633, -169114, -153008, -180389, + }, + { + 674847, -27861452, 135291, 1843078, -1269163, 281320, -1141388, -2806761, 646929, -184684, + -1235340, 3869229, -8090645, -776315, 4104378, -1772211, -6305012, 10393821, -6468758, -7540352, + -3721589, -2891050, -177167, 988379, -1014686, 9942849, -970663, -4294431, -1105954, -3390340, + -2427194, -3115999, -3229816, 353798, 1467268, -5534066, -4460324, -428960, -951335, 943282, + -366683, 900869, 91268, -948114, -1083406, -1874753, -673773, -414464, 136365, 259309, + 1423245, -577136, -54761, -1396938, -301721, -83752, 861678, -1074, -1052804, -165893, + 687195, -1541356, 122407, -91268, 627065, -558346, -639413, -441845, -1040456, 201327, + 284542, 273804, 557272, 221191, 193810, 51003, -411780, -214212, 78920, -254477, + 312996, -373662, 314606, 60130, 192200, 22012, -393526, -26844, 95026, -215285, + 556198, 400506, 123480, 168577, 175557, 194884, + }, + { + 2645700, -86882896, 6856379, 39015484, -6385006, -2887292, -101469, -9063455, 761283, 4443144, + -2548526, -1714766, 340376, -3543885, -4971425, 743566, 4137664, -1065689, 1655173, -1708323, + 2205466, 2932389, 2254858, -2721936, -2410551, -1633161, 2708514, -1198296, 519691, 1343788, + 2229625, 1064078, -3501472, 1306207, 409096, 247497, -2184528, -941135, 297427, 1456531, + -2001455, -1201517, -432181, 2040646, -153008, 626528, 1236414, 869194, 724776, 2078227, + -3182571, 438087, -1973001, 2337536, -1938104, 696322, -986232, -220654, 357556, 221728, + 275415, 140123, -267362, -48855, 443455, 972273, -222265, 66035, 13422, 568546, + -137439, -303332, -418759, 469762, -57982, 290447, -24159, -293668, 325881, -275415, + 102005, -395674, 236223, 299574, -100932, 111132, -114354, 50466, 231928, 79994, + -257698, 45634, -55835, 142808, 159988, -28991, + }, + { + 166430, 7435126, -1184874, -949188, -90731, 43487, -173946, 345745, -2340220, -2008971, + 2146410, -1780264, -3195993, 3468186, -612570, 12266427, -10743324, 1922535, -975494, -13695040, + 7791608, 852551, 14510010, 5236639, -6467147, -12329777, -4930623, 4522601, -517007, -1399086, + 5291937, -4354560, 2136209, -676994, 3295314, -900869, 140660, -1560147, -1819992, -1651415, + -512175, -1516124, -1202054, 997506, 1230508, 1354525, 289910, -987306, -412854, -901943, + 1007707, -522912, 625992, -237297, -31139, 1405528, -654983, 1037772, 732829, 381715, + 98247, -141197, -33823, 894427, -1021129, -885300, 136365, 2013266, -814433, -632971, + -485868, -324270, 417149, 6442, -98784, 345745, 147103, 3221, 46708, -532576, + 386010, -463856, -18790, -208843, 314606, 61203, -20401, 292595, 82141, -129923, + 180389, 216359, 12348, 112743, -214748, -78920, + }, + { + -13350369, 98702640, 91805, -40874668, -3871376, -1868311, 511638, -2742874, -508954, -2062658, + -3251290, 5175973, 4061965, -3651259, -1757715, 1418950, -861678, -2362232, 4215511, 852551, + 621160, -1729798, -615254, -3230352, -2978023, -60130, 626528, 1847910, 1832340, -2352568, + -2436857, -1971390, 2824478, -2537789, 2772938, -1122597, -1419487, -711354, -2884608, -2479270, + -470299, 212601, -890132, -1719061, 83752, -643171, -1086627, -1726040, 328028, -72478, + 469225, -1687385, 759136, -796180, 719944, 727997, -331786, -1552094, -89657, -1422171, + 1215476, 60666, 289910, -206695, 74625, -339302, -367220, -111132, -138513, 462246, + 554588, -87510, -20938, 199179, -399432, 195421, -1611, 53150, 305480, 82141, + -477278, -2147, -82678, -237297, 353261, 5369, 413927, 206695, -164819, -213675, + -358630, -133144, 322659, -140660, -105227, 266825, + }, + { + 733366, 2719251, -1591822, 2209224, 907312, 60130, -585726, 1283658, 1175747, -1076426, + -1036161, 390305, 903017, 962073, -2583960, 3111167, -5157719, -5007932, -151398, -3905199, + -2936684, -1864016, -3487514, -9117679, -2398739, -4907537, -2196876, -3720516, 1396938, -1560147, + -5419175, 313533, 83215, 977105, -1001801, 2929705, 1453846, 3124052, 339839, -153545, + -1138166, 2150168, 2347200, -1498407, -128312, -874563, 1566053, 192200, -302795, 284542, + -1324997, 1196148, -577136, 505196, 563714, 1083406, 332860, 238908, -82141, 1080184, + 471373, -488553, 495532, -527744, -416612, -307627, 31139, -544924, -251792, -485331, + 471910, -266288, 226023, 1362042, 336081, -375810, -287763, -231391, -2147, 665720, + -392990, 572304, -520228, -9664, -143345, 49929, 144955, -339302, 135828, -16106, + 55298, -269509, 44023, -143345, 92342, -76236, + }, + { + 11827803, -96535296, -20988968, 989453, 254477, -11179263, -7928510, -2356863, -5925445, -346819, + 2814814, -731218, -1264868, -3297998, 1497333, 3189550, -2639258, -3499325, 872952, -5478768, + -7735236, 947040, -405874, -1399086, -269509, -944356, 2429341, 1104344, 2122788, -379031, + 3874597, -7516, -705448, 2296734, 1255204, -2724620, 1438814, 969052, 522375, 3123515, + -1232656, 110059, 3111167, -1313186, 1170916, 2419677, -1633698, -77309, -636192, -970663, + -3170223, 293668, 1018981, 2352032, -1323924, 183073, 1295470, -608275, 2490007, -246961, + -1787780, 417149, -363462, -933619, 137976, -623844, 153545, 97174, 354335, 1199370, + -614180, 464393, -31139, 135828, -490163, -556735, 298500, -65498, 146566, -722628, + -408559, 223338, -615791, -504659, -447213, 48318, -583579, -161061, -82141, 347892, + 201327, 140123, -119722, 270583, 237834, 18790, + }, + { + 1295470, 9687836, 766115, 8556649, -2920578, -1117765, 2793339, -2615098, 2071785, -1250372, + 1118302, 1869921, 507880, 1511292, -6197101, -6299644, -969589, -2433099, 11858942, 4347044, + 9072582, -4400731, -426812, 2539936, 122407, 4776541, -4101157, -1795833, -4170950, -843424, + -418759, -2828773, -3306051, 2740189, 1145146, -1890859, 832687, 344134, -2071248, 246424, + -1483911, 1046361, -2597382, 2547453, -1457068, 313533, 609349, 1323387, 1165010, -1757179, + 2572686, 393526, 185757, -777389, 1737851, 497142, 368830, 586800, -310848, -1546188, + -723702, -653909, 904091, -256624, -34360, -1014149, -282931, 62814, -636192, -375273, + 21475, 97711, -245350, -6442, -245350, 541166, -364535, 7516, -35970, -180389, + -360777, -362388, -259309, -301185, 317291, 214748, -2684, 214748, -192200, 537408, + -46708, 46171, 37581, 206695, -196495, -72478, + }, + { + -4894115, 175148768, 3061775, 3670587, -12068321, -531502, 1335735, -249108, 7013682, 3117610, + 2210298, 2537252, 197569, 2286533, 2978560, 4155381, -3777424, 832150, -89657, -5787469, + 4853313, -1439888, 2167885, -107374, 2467459, -1643362, 2935073, -5008469, 426276, 513249, + 3699578, 1121523, -2117956, 4892505, 1138166, 3038689, -3311420, 815507, 2792266, -3287798, + 1041530, 1153736, -1131724, 2229625, 1891933, 1297617, -2491618, 810675, 695785, 186294, + -2342368, -369904, 29528, -3315178, -627602, -1386201, -1148367, 163209, 104690, 1686848, + -715649, 1232119, 237297, -407485, -743029, -366683, 19327, 141734, 530428, -69793, + 84826, -118648, 164819, -107911, 201863, 229781, -315143, 169114, -241055, -355945, + 162135, -261993, 24696, -414464, 201863, -386547, -58519, -9664, -214212, 12885, + 404264, -38118, -25770, 6442, -30065, 144955, + }, + { + -242666, -32731408, 7166690, -952946, -1351304, -1174137, -1301375, -130997, 1494112, -699543, + 2703682, -2508261, -1399086, -8818105, -10660109, -10005663, -1038308, -2540473, -2679523, 236223, + 4255239, -7432978, -4526359, 9804873, 2614025, 10907069, -7055021, 4437775, 1136019, 3812857, + 2065342, 3331821, -785442, -2825552, -1309428, 2495376, -1555315, 1080721, 1340030, -2299418, + -1519882, -1731409, 1266479, 1550483, 1255741, 102542, -1284195, 1488743, 89121, -88584, + 498216, 1353452, -920197, -416612, -278636, 655519, -275415, -700617, -355409, 3032784, + -709207, 1475321, -185220, 471373, -378494, -204011, -1449552, 1370632, -159988, 590558, + -520228, -51003, 145492, 338766, 136365, -319975, 181999, -161598, 284542, -91268, + -539018, 622233, -67646, 91805, 170725, -443455, 204548, 181462, -11274, 232465, + -80531, 178778, -359167, -134755, 340376, -269509, + }, + { + 21289080, 38065760, -4314295, -17584670, -15117748, 598074, -2598992, 5572183, 1451162, 299574, + -98247, -573915, 980863, 11597485, -6549289, -1665374, -4481799, 499290, -486405, -4410395, + 4282620, 1569274, -1816771, -2764885, -900333, -5718749, 1788317, -4066797, 1139240, 3274913, + 3775276, -1190243, 4067871, 1163399, 1574106, -4321274, -2303176, -1128503, -1891933, 2230699, + -205085, 3293703, 416612, -2800856, -3272765, 2024540, -258772, -1570347, 1460289, -1759326, + -1656247, -1141388, 1607392, -353261, -580894, 158914, -1642288, 605054, -314069, 1005022, + -591632, -95026, 528818, -467078, 1214402, 955093, 368293, -766115, 129386, -588947, + 1189706, -524523, 656056, 366683, 432718, 114354, 93416, -493921, 139050, 795643, + 282394, 114890, -2147, -200790, 42413, -10201, 125091, -489089, 442919, 368830, + -12348, -33823, -16106, 71404, -268435, 10737, + }, + { + 672699, -37949796, -3228742, 229781, 21475, -1939715, -34897, 2882460, -1648194, 1449015, + -2736968, -3117610, -2243584, -4252018, 22085258, -9454834, -1562831, -2636036, -5626407, -8775692, + -7827578, -8613020, -399432, -525060, -4206384, 1150514, 1070521, 3326989, 6201933, 2008434, + 903554, -297963, 4995047, -864899, 1246077, -516470, -899796, -2928094, 1034013, -1818919, + 1401770, -1637456, 639413, 750009, 714575, -1884954, 1217086, 16643, -352724, 404264, + -371515, -621697, -174483, 383863, -519154, -668941, -724776, -1213865, -515396, 913754, + 990527, -387084, 224949, 403727, 265214, 1546188, 258772, 255551, -1619740, -587337, + -626528, 637266, -332323, -182536, -133681, -112743, 212601, 205085, -566399, -430570, + 252329, -219580, -281857, 124017, -440771, -4832, -67109, -105764, 47782, 8590, + -253403, -99321, 142808, -52613, 281857, -151398, + }, + }, + { + { + 9375377, -7703024, 16856672, -14875619, -5719823, -686121, 255014, 1161789, 2615635, 4749160, + -6598681, -1774358, -4641786, -159988, -8370355, -2561411, 3111704, 279710, -1805497, -2431488, + 970126, 5516349, -1290101, -76773, 1330366, -676994, 552977, 226023, 4924717, -188979, + -49392, -2841121, 1923072, -224412, 516470, 2719251, -2309082, 3040837, -1146219, -2869038, + 263604, -163209, -1061931, 867047, 682363, -1246077, 536334, -404801, 217433, 2093797, + 552977, -1554241, -632434, 67109, -1415729, -1387274, -1461900, -542777, 1255741, 277562, + 410706, -712965, -367757, 599685, 1033477, -439160, -592169, 301185, -994285, 63351, + -46171, 95026, 326954, 607738, -216896, 120796, 272194, -86436, -299037, 214748, + 546535, -265214, 58519, 100395, -13959, 12348, 156766, 102542, 211527, 81068, + 104153, 144955, -80531, -138513, -190589, 21475, + }, + { + -2068564, 25906706, -1523103, -2641942, 6611029, -146566, 969589, 1722819, -266825, -6360310, + 4524748, -507880, -2398202, -1669669, -3029563, -1884417, -7660611, 2985539, -6250788, 6257768, + -3623342, -957778, -275415, 2283312, -5822365, 589484, -798327, 6213744, 179315, -44023, + -535797, 1923072, -415538, 2008971, -3077344, 865436, 3527242, -1170916, -1025960, 1848983, + -137439, 957778, 713501, 1261110, -2287070, -2895882, 1372242, -1872606, 619549, -667867, + 685584, 1256278, 2512019, -569083, -691490, -545998, -260382, 324270, 310311, -285078, + 106300, -913217, 1350767, -407485, -4832, 241592, 264141, -187905, -459562, 403727, + -1262184, -818728, 41339, 51540, -540629, 199179, -652298, -27380, 154082, -290984, + -351114, 30602, 235686, -349503, 239981, 157303, -180926, -463320, 13959, 16643, + 86436, -5906, -120259, 463320, -41339, -69256, + }, + { + -1524713, 32131724, -19266686, -13800267, 22395570, 2877628, 2496450, 1633698, 310311, -2213519, + 3179887, -2803003, 3905199, -5662378, -3330747, 8582955, -2453500, 4308389, -4951024, -549219, + 2363843, 14496, -1751810, -52076, -1431835, 676994, 299574, -3269544, -1312113, 1169305, + 65498, -2908230, 2456185, -2336999, -476741, -1454920, 1726577, -1229971, 177167, 1861332, + 2152852, 1186485, -495532, 1610613, 1359357, 1815161, 1638530, 884763, 124554, -614717, + 498753, -403727, -142271, 1417876, -406411, -390842, -1237488, -30602, -790811, 133681, + 297427, 1598802, -16643, 1548336, -241055, -1707250, 165893, 493921, -1296543, 556735, + -11811, 752693, 121333, 77309, 51003, 437013, -374199, 467078, 265214, -24696, + -161061, -99321, -167504, -235686, -304406, 262530, -122943, 111669, -127238, -148713, + 242129, -127238, 204548, 37044, -108985, -244276, + }, + { + -21989158, 18165564, 11307575, 11535745, -6531572, -744640, 533113, 650151, 3168612, 798864, + -427349, -6203544, 4311611, 5879274, 363998, 881542, -873489, -6237903, 1475321, -125091, + 117575, -1285806, 2961917, 104153, -2523830, 942208, -159988, -3616363, 1261110, -2170032, + 5556614, -197569, 11811, 1063541, 865436, 3431142, 3122441, -1122597, 1431298, 932545, + -1414118, -1049046, -2198487, -799401, 687732, 1522029, -1458141, -500901, 1612223, -192737, + 312996, -1869385, -30065, 977642, 424128, 498753, -251256, 74088, -932545, 270583, + -853088, 346282, -629750, 921807, 139586, 756988, -126702, 202937, 159451, 331249, + 87510, 246424, 20401, 518617, -216896, 274878, -356482, -476205, 282394, 242129, + 110595, 199179, 61203, -214748, -149787, -6979, -166430, -295816, -222801, 241592, + -132607, -68719, -415538, 50466, -90731, -155693, + }, + { + 89657, -32839320, 898185, 331786, 574989, -625992, 146029, -1479616, 202937, -2692408, + 1890323, 2869575, -5768141, 4179003, 4295, 1219771, -11086384, -945430, -10419054, 919660, + -9620190, -5420786, -1247151, 4929012, -4663798, 8167417, -4290136, 3306051, -4555887, 352187, + -4051228, -8378408, -1954210, -1885491, -2567854, 0, -4084514, -1147830, 540092, -379568, + -651224, 1266479, -365609, -166430, -2089502, -1420024, 577136, -825171, -467615, -83752, + 1020592, 11811, -602906, -1149441, 460098, -970663, 880468, 632434, -864362, -580357, + 324807, -705985, -133144, -403727, 1278827, -496606, 57982, -883690, -908386, 324807, + -90194, 940598, -336081, 311385, -155156, 11811, -234613, -128849, 287763, 368293, + -249645, -60130, -327491, 290984, 135291, -214212, 248571, -74088, -278099, 180389, + 285615, 610422, -100395, 215822, 169114, 420370, + }, + { + -24588150, -30686468, -15333033, 33062122, 4126390, -2505577, -2434173, -7467338, -1217086, -1536525, + 3199751, -1762010, -4032974, -3626563, -2725694, 3496640, 2600066, 1550483, -812286, -337692, + 5477694, -810138, 1186485, -1636383, -2653753, -1033477, 1006096, -1811403, -782221, 1901597, + 3424163, 139586, -542777, -2215666, 1197222, 1567663, -1771674, -602369, 1421097, -831613, + -2267743, -103616, 1021129, 82678, 601295, -1189169, 838056, 1923609, 1545651, 275415, + -1654099, -542240, -1664837, 568009, 914291, -394600, -204011, 166430, -241592, 532039, + -364535, -668404, 270583, 763967, 460635, -295816, 5906, 290447, 555125, 120796, + 364535, -348429, -561567, 451508, -389768, 224412, 326954, 249645, -78383, -272730, + 88047, -480499, -107374, 381715, 96637, -11274, 133681, 6979, -49392, 314606, + -191663, -47245, -96100, 83215, 214748, 30602, + }, + { + 333397, 11041287, -38655, -1515587, -935229, -472983, 219580, 203474, -1713155, 212064, + -2196876, -1257889, 432718, -3504693, 2625299, -2577517, -1343788, 1663226, -1735704, -7738994, + 2887829, 1029182, 9149891, 5737003, -9614821, -4866198, -6813429, 1283658, 1621350, 18254, + 3433826, -2793339, 845572, -1625645, -947577, 5030481, -2520609, -1408212, -3046743, 253403, + 882616, -2730526, -993748, 1791538, 535797, 1917703, 147640, -1094680, -433255, -431644, + 174483, 17180, 339839, 661962, 563178, 45634, 1218697, 45634, 496069, 997506, + -405338, 82678, -209917, 488553, -758062, -124554, 486942, 891743, 279173, -593779, + -1132798, -258772, 556735, 92879, 185757, 255551, 42950, 301185, -324270, 607201, + -404801, -359704, 1611, 132607, 86973, 129923, 146566, 67109, 37581, -299574, + -5369, 96100, 201327, 68183, -250182, -78383, + }, + { + 22140556, 14825690, 13077102, -33357938, -1233729, -2556043, -212601, -760746, -486942, -409633, + -1973538, -1476395, 5114769, -1133871, -4269198, 2320893, -3229816, -748935, -1918240, 1043140, + -668404, 2293513, -5038534, 696322, -6657736, 2077154, 958315, -2203318, 1977296, 216359, + -1477469, -2161979, -230854, -1103807, -482647, -1766305, -2645163, 229781, -2747705, -3065533, + -974958, 1150514, 637266, -2244121, 589484, -1789928, 436476, -4735739, 832150, 995896, + 506806, -1655710, -1265405, -15569, 956167, 961536, 271120, -1733556, -281857, -379031, + -571231, 615791, 1007170, 241055, -251256, -306016, 167504, -99321, -531502, 1341640, + 267362, 38655, 321586, 92342, -170188, -576599, 338229, 556735, -164283, -104153, + -184147, -42950, -128312, 24159, 85899, -23085, 635655, 130460, -463856, 10201, + -198105, -61740, 118112, 105227, -2684, 10737, + }, + { + 137976, 5055714, 2508798, 1202591, -668404, 569620, -1245004, 1267015, 944893, -1004486, + -3265249, 4456566, -2154463, 5396090, -4009352, 3016678, -4246112, -7683160, -2826625, -4261682, + -1643362, 2605972, -10161356, -5275831, -1242856, 52613, -4417911, -657130, 37581, -4587025, + -2850248, -415538, -1278827, 1203128, -1073205, 379568, 2188823, 3137474, -1229971, -1224066, + -31675, 4516158, 1383516, -1416802, -211527, 1418950, 1243393, -1776506, 429497, 200253, + 409633, 140123, 40802, 663572, 255551, 752156, -359167, 770410, 774705, 557272, + -287763, -138513, 518080, -187905, -887985, -340913, 16643, -541703, -653909, -670015, + 354872, -780610, 1168768, 765041, 399432, 204548, -722628, -272194, 551903, 366146, + 162135, -74088, -457951, -19864, -76773, -44023, 130997, 96637, -339302, 379031, + 34897, -330712, -187368, -215285, 369367, 234076, + }, + { + -10801843, -112000936, 16863652, -4826470, 2937758, 2287607, -26201448, 1947231, -3799972, 4235912, + -4310000, 1815697, -162135, 725850, -604517, -1921461, -790274, -3505230, 2290828, -5895380, + -4190814, -1665911, 440234, -2286533, -956167, 175557, 4331475, -2098092, 3207267, -2001455, + 4189741, -1719598, 2547989, 2483565, 1511829, -248571, 975494, 55835, 1643899, -273267, + 370441, 1897302, 2504503, -1199370, -496606, 3140695, -1378148, 1082332, -1446330, -202937, + -860067, -1511829, 2317135, 2363843, -2120640, 491774, 1444183, 1327682, 617402, 285615, + -1396401, -820876, 1372242, -1897839, -367757, -161598, 81068, -406411, 262530, 1093069, + 253403, 16643, 186294, 54224, 82678, -664646, 246424, -9664, 2147, -472446, + -542240, -294205, -459025, -78920, -228707, -210453, -93416, -181999, -6442, 398895, + 178241, -54761, 6442, 278099, 173946, 144955, + }, + { + -865436, -1763621, 14794015, -1753420, 2761664, 1395864, -1047972, -4207458, 3653944, -2103460, + 3583077, -2616172, 3155727, -2064806, -1585380, -5811628, -9473624, 1351841, 6634651, 10201621, + 4537096, -4706211, 2624762, 587874, 4897874, -5577015, 3925063, -2944200, -3870303, -4206384, + 457414, -2816425, -1670742, 2471754, -649077, 970126, -1570884, 299037, -2100776, 95563, + -3009698, -534187, 945430, 341450, -201327, -158377, -18254, 704375, 1378685, -830539, + 2171106, 352724, 286152, -127775, 785442, -452582, 1222992, 1091995, -763430, -955630, + -14496, -954020, 854699, -1165010, 152471, -576599, -447213, 334471, -409096, -6979, + -180926, -424128, -115964, 126702, -379568, -66572, -13422, -147103, 51003, 102542, + -812823, -246961, -133144, -282931, 194347, 156229, -18254, -127775, -113280, 169114, + 170188, 328565, -103079, -25233, 196495, -105764, + }, + { + 34209416, 127855272, -10086731, 3004867, -9673877, 1051730, -2407329, 971200, 5604933, 7978439, + 1350767, 412317, -952946, -2846490, 10204305, 558883, 2120640, -637803, -2425046, 4482335, + -3934190, 602906, 1225676, 3139621, 1082869, 896038, -875100, -3371549, 119185, 889595, + 3759707, 627602, -830002, 763967, 5060545, 2908767, -4058744, -235149, -506806, -438624, + -90731, 2078227, 975494, 2434173, 2978560, -1273458, 125628, -883690, 1234803, -1662689, + -1286880, -2194728, 1826435, -3008088, -659278, -1714229, 340913, -741956, -318901, 768262, + 1337882, 714038, 570694, -180926, -215822, -1293322, 190052, -65498, 584652, 373662, + -271120, 129386, 268972, -484794, 81068, 657667, -178241, -183610, -75162, -563178, + -4295, 116501, -377420, -6442, 177167, -396211, 107374, -20938, -5369, 10737, + 110059, 409096, -1611, -119185, -111132, 355945, + }, + { + 680752, -25341918, 1859721, -8660802, 1239098, -328028, -32212, -4860293, 2334852, 2028298, + -1407676, -1183264, 1483911, -11480448, -9680856, -1160178, -9487583, -2658048, 226560, -1173063, + -3111167, -3064459, -737661, 9604084, 6669548, 1877438, -555125, 4609574, 2174327, 3108483, + 6204617, -171799, 1839857, -2404108, -923418, -870805, 446677, 818728, 1558536, -2393371, + 242129, -2386391, 955630, 3411815, 545461, 846645, -1354525, -507343, 2313914, -72478, + 1400159, 299037, 501974, -1837172, 60666, 590558, 833761, -711354, 151934, 1563905, + -14496, 1112397, 1282585, -1104344, -274341, -145492, -827318, 628676, 258772, -456877, + 439697, -516470, 467615, 414464, 510027, -34897, -244276, 562104, -237297, -135828, + -212064, 244813, -249108, -370978, 523449, -240518, 201327, -43487, 18254, 168577, + 24696, 24696, -31139, -118648, -228170, 31675, + }, + { + -6262063, 69701952, 3873524, -21772800, -4933844, -1402844, -6950331, 4643397, 1662152, 5085242, + -5530844, -46171, 2926483, -4408784, 17994302, -3002182, -5904507, -2310693, -3311420, 1669132, + 2680060, -608812, 1648194, -2024540, -3637301, -765041, -2888903, -1478006, 138513, 3009698, + -164283, 1882269, 4010426, 1939178, 538482, -645319, -2645700, -3690988, -2132451, 3054796, + -2280628, 3659312, 1685238, -1865626, -2330557, 395674, -1731946, -137439, 114890, -780073, + -2275796, -522375, 1222992, -1036698, -608812, 83752, -675921, -363462, -190589, 55835, + 435402, -911070, 549219, -45097, 861141, 248034, 351650, -238908, 172872, -395674, + 348429, 112743, 964757, -222801, 372588, -140123, 215285, -676457, 261456, 477278, + 507880, -121333, -236760, 44560, -284542, -136365, -99321, 248034, 363462, 206695, + -85899, -397821, 204011, -144955, -261456, 38118, + }, + { + -668404, -39142184, -93416, 2997350, -2992519, -1340030, 2244657, -1296543, 2519535, -1051730, + -4541391, -1984812, -3428458, 13954349, -12496744, -3573950, 639950, -2145873, -7113540, -3900904, + -6962679, -11757473, 905701, 1199370, -4511863, 243739, 335007, 5844914, 4541928, -2238215, + 2321430, 666794, 3082176, 557272, 1602023, -583579, -3403225, -578747, 919123, -744640, + -2617783, 2303713, 694174, 577673, -1650341, -1328756, 2154463, -897648, 633508, 133681, + -38118, 149250, -903554, 965294, -1080184, -1101122, -122943, -1357210, -362388, 715649, + 1689533, 353798, 549219, -170188, 353798, 1448478, 218506, -338229, -665183, -329102, + -480499, -294742, 296890, -11274, 417686, -259309, 160524, 157303, -172872, -452582, + 64425, -192200, -602906, -16643, -129386, -177167, 13422, -19864, -118648, -263604, + -266288, 27917, 300111, 9127, 136365, 157840, + }, + }, + { + { + -11457362, -89982248, -50322520, -3307125, 5466420, -202400, -659278, 650688, -275952, 5541582, + -2870112, 3014530, -5375689, -3140695, -9424232, -1068373, 8347269, 3494493, 4612258, 7119445, + 2115272, 3343095, -834834, -692564, 1211181, 1735704, -444529, -2883534, 492848, -2900177, + -80531, -408022, 5795522, 674847, -1411971, 794032, -4493610, 2771865, -2511482, -5195300, + -2951716, 700617, -906238, -1839857, -50466, -1648731, -996432, -2506650, -905164, 416612, + -791348, -1807108, 1443646, 1927367, -483721, 263604, -118648, 194347, 744640, -157303, + 1365263, 105764, -105764, 440771, 1443646, 316754, -394600, -90194, -413927, 695785, + -115964, -684510, -638340, 753767, 402116, -54224, 126702, 204548, -147103, 352187, + 400506, -315143, -234076, -25770, -227096, -230854, 194347, -10737, 373125, 252329, + 52076, 31675, 49929, -41876, -49929, 271120, + }, + { + 1274532, 17466022, -12073153, -12280385, 1887101, 25233, 1374390, 236760, -3502009, -6259915, + 5396090, -679679, -2915209, -641561, 801548, 6442988, -1450625, 2901787, -4469987, 2781528, + -2581812, -5058935, -2627446, 1437740, -8278550, 782221, -2469606, 6609418, 1393717, -1196148, + 1329829, 5088463, 495532, 3963181, -1277216, 2687039, 3384971, -2805151, -3462818, 1448478, + 513249, 1037235, 774705, 91805, -1468879, -19864, 2332704, -1619740, 559956, -1085553, + -13422, -678605, 1521492, -507343, 23085, -717796, -1035087, 20938, 557272, 539018, + 869194, -872952, 628139, -1130113, -181999, -1144609, -1831804, -667331, -6979, 551366, + -702764, -198642, 95026, 96100, -688805, 443992, 226023, 328565, -390842, -448287, + -48318, -137976, -11274, -489089, -221728, -139586, -384400, -337155, -48855, 67109, + 86436, 17180, -155156, 392990, 45634, 38655, + }, + { + 4035122, 68698536, -2807835, -45866492, 2555506, 3117610, 872415, 2020782, 5072357, -3652333, + -12271258, -11909944, 2696166, -10669773, -4133369, 5922760, -8255464, 820339, -3022046, 671089, + -3033858, -4341675, -2427730, -284005, 5278515, -1213328, -2827699, -3221762, -3148211, -1251983, + 583042, -5007395, 1652489, 824097, 1035087, -2195265, 1070521, -471373, 271657, 2356863, + 1040456, -3143916, -55298, 2875481, -14496, -1023813, -70867, 496069, 173409, 81068, + 1966558, 593242, -950798, -943282, -1513439, 738198, -816581, -1068373, -2048163, -672699, + -41339, 1569274, 512175, 1204738, -282394, -1247688, 198105, 983548, -865973, 437550, + -147640, -332323, -810138, -282394, 117038, 389231, -919660, -133681, 331249, 139586, + 131533, 226023, 78920, -19864, -352187, 158377, -84289, 221191, -96637, -231391, + 124017, -413927, -30065, -130997, -118112, -133681, + }, + { + 30370250, 87747792, -2608119, 15194521, 7772280, -2020245, 903554, -2233920, -599148, 38655, + 2149631, -5949604, -4736812, 543850, 2318746, 2511482, 3248606, -4550518, -616865, -1239635, + -1071594, 727460, 4638028, 1239635, -2170569, 2125472, -2081985, -4017405, 2703682, -2032593, + 2044404, -3248606, -2863133, 431644, -99858, 1012539, 1527935, -1302449, 418759, -572304, + -673773, -552440, -1567126, 380105, -169651, 353261, -82678, 1576790, 789737, -1184874, + 422517, -364535, 441308, 1480690, 11811, -424665, -183073, 772020, 71941, 911070, + -646393, 625992, -1611, 33286, -416612, 1039919, 104690, -234076, -639413, -154619, + -42413, 141197, -400506, 413391, 23622, 108448, -408022, 41339, 511101, -79994, + -424128, -77309, 98247, -166967, 2147, 37044, -83215, -80531, -220654, 73551, + -140660, 26844, -335007, 239444, 184684, -28991, + }, + { + -756988, -38426000, -4110821, -1714229, -498753, -1226750, 78383, -1580548, 1207423, 666794, + 4022237, 5120138, -129923, 2962991, -2629594, 10431939, -8878234, -22157200, -13646185, 6704444, + -10561861, -1384053, 75699, 4707284, -257698, 6330245, -3720516, 5810554, -2062658, 2739652, + -1285806, -8800925, -4044249, -3121368, -3319473, 1975685, -1106491, 12885, 3028489, 1923609, + 104153, -536334, -1102196, 1085553, -130460, 235149, 527744, -2699924, -1678259, 448824, + 1644973, 488553, -548682, 99858, 987306, -999654, 401043, -420907, -972810, -594853, + 923955, 236760, 179315, 29528, 829466, -398895, 607201, -163209, -396211, -9664, + -389768, 205085, -589484, -91805, -555661, -180926, -89657, -90194, 463856, 184147, + -503585, 315143, -244276, 76236, 151398, -376347, 519691, 228170, -85899, 199179, + -130460, 431107, -178778, 83752, -70867, -48855, + }, + { + 33094334, 78980152, 8528194, 19462108, -9596568, -702764, 239444, -3903052, -5034239, -11853573, + -3686156, -3477313, -2987687, 132607, -606127, 5776194, 3339874, 402116, -960462, -3045132, + 998043, -317291, 919660, -3637837, -2829847, -2489471, -592706, 42413, -618475, -1189169, + 380641, 921271, 3688840, 261456, 308701, 784368, -941135, -135291, 3013457, 1406065, + -831613, 801011, 971200, -964757, -136365, -412317, 933619, 1007707, 1480153, 58519, + -828392, -908922, -2108292, -1516124, 1546725, -102542, -48855, -647466, -1038308, 485331, + 285078, -478352, 1114544, 1833414, 92342, -779000, 37581, 231391, 1262184, 455803, + 465467, 693637, 270046, -93952, -17180, 199716, -301185, -13959, 139586, 334471, + 442919, -297427, -253403, -60130, 43487, -121333, -200253, -285615, -266825, -69256, + -108448, -41339, 22549, 226023, 89657, -48318, + }, + { + -487479, 8890582, 2421288, 1271847, -17717, -1229434, -155156, 1478543, 486942, 155156, + -3503620, -657130, 1904818, -5176510, -1353989, -2457258, 7314866, 3360275, 2692408, -6060736, + -1544041, -5486284, -6744710, 3246995, -2820720, 4034048, -5756867, -1848447, 1309965, 1858647, + 1444183, -6858526, 818728, -1909113, -889595, 3535832, -5074504, -1362578, -2348810, -265214, + 153008, -586263, 869194, 1400696, -1771674, 274878, -114890, -680215, -860604, 267362, + 1497333, 745714, -147640, 570694, 1648731, 91805, 1769527, 151398, -948651, -239981, + -256624, 767725, -489089, 18790, -798327, 292058, 159451, 95026, 418222, 190052, + -486405, -293668, 533650, 700617, 212601, 34897, -286152, 194347, -30602, 938450, + -723702, -549219, 380641, 458488, 173409, 206158, 304406, 18790, 96100, 136902, + -81068, -222801, -62814, 87510, -206695, -124554, + }, + { + -19469086, -99778536, -31398358, -21603686, 7414724, -751082, 6367826, 6271726, 5450851, 2470680, + -1014686, -3386045, 2764885, -4587562, -9627169, -21475, -5789616, 1243393, -6659884, -1384053, + -3616899, -2697776, -7051800, -1001264, -7810398, 1136019, -137976, -3866544, 142808, 526670, + 3060164, -427886, -2623688, -4857071, -3138547, -4631586, -6334540, -308164, -2558727, -2861522, + -289373, -157303, 939524, -31675, 1588601, 1611, 1851131, -3173444, 1967095, 773094, + -510564, -944356, -1461900, -870805, 44560, 1029718, 923955, -403190, 1481764, 702764, + 69256, 548682, 536334, 550293, 372588, 556735, 336618, 453656, 387621, 1119376, + -210990, 241055, -25233, -184684, 527744, 6442, 40265, 223875, -10201, 73014, + -78383, -202937, -458488, -76236, 376347, -62814, -28991, 74625, -133681, 206695, + 87510, -42950, -33823, 170188, -18790, -192200, + }, + { + -723702, -3084324, -1292248, 86973, -1674500, 1291711, -580357, -1162862, -1822677, 1673964, + 1167694, 7584376, -3095061, -1491964, -7067906, 3449933, 11922829, 4072166, 2637110, 2552284, + -95026, 3811247, -4955319, 753230, 2008434, 12839805, 4925254, -1576253, -3634616, -2767570, + -3808026, -2165737, -445603, -3566434, -2288681, -634581, -1950452, -494458, -1126892, -861141, + -1154809, 3462818, -793495, -1268089, -2684, 1085553, 1457068, -146566, 1113470, 1307818, + 1706713, 1611, 379568, 1305133, -600759, 164283, -523986, -447213, -635118, 479963, + 222265, -96100, 543850, 845572, -84826, -252866, -77309, 162672, 88047, -505196, + 928250, 29528, 1117765, 463320, 35433, 140660, -226023, -27917, 541166, 176631, + 259846, -191663, -341987, 89657, -171262, -94489, 188979, 258235, -482110, 130460, + -111132, -279710, -346819, -219580, 279173, 118648, + }, + { + 9314710, -134149544, -13415867, 9664213, 11344619, -8732742, -25824028, 4995584, 5719823, 6718940, + -5823439, 6706592, 7098507, 1764695, -1531693, -666794, -3732864, -2096481, 3955128, -1810329, + -3420942, -1804960, 1853815, -4087198, -6698002, -324807, 4221416, -2234994, 3412889, -2747169, + 4931696, -1447404, 492311, 1495722, 3403762, 4240207, 4994510, 1765768, 808528, -3323768, + -97174, 3249680, 1517734, -636192, 1690607, 2852932, -2049236, -346282, -2178085, 1698660, + 2159832, -2309619, 540092, 1206349, -2523293, -175557, 312459, 829466, 53687, 779537, + -1226750, -1545651, 1263257, -1409286, -1348083, -1029182, 613107, -726386, -150324, 911070, + 121333, 137439, 336618, 135291, 423054, 130460, 191663, 14496, 559956, 212601, + 145492, -205085, -297963, 355409, 263067, 126165, 117575, -246961, 6979, 175557, + -82678, 159988, 99321, 67646, 151398, 352187, + }, + { + 467078, -19673634, -10503343, -8313446, 5987185, -2104534, -5446019, -4232691, 2940442, -2997887, + 2980171, -1416266, -515933, -2080912, 289373, -5065377, -3883724, -295279, -3049427, 5727339, + 2276870, -6158446, 4631586, -4415227, -229781, -8771934, 1432909, -1057099, 1160715, -853088, + 166430, -641024, -1576790, -1309428, -1654636, 2525978, -1810329, -469762, -2973728, 801548, + -530965, 306553, 1295470, -776852, -467615, -356482, -867047, -1038845, 96637, -1293322, + 668404, -171799, 23085, -11274, -84289, -1476932, 271120, 415538, -747861, -324270, + 838592, -1000727, -309238, -1918240, -752156, -134218, 190052, 523986, -82141, 568546, + 439697, -66572, 61203, 40802, -423054, -178778, 262530, -227633, -450972, 191126, + -328565, 62277, 288837, -23085, 121333, -55298, 155156, -86973, -57445, 38655, + -5906, 223338, -20938, -16643, 79994, -180389, + }, + { + -44754632, 23427436, -9914395, -4918275, -11890617, 4257923, 1794223, 488553, 45097, 9686225, + 7372848, 752156, 3299072, 2030983, 12763569, 1392106, 8750459, 3440269, -5027259, 3121904, + -4397510, 1180579, 674310, 3008088, 1729798, 6030671, -1785096, -1095754, 466004, -310311, + 2286533, -2860985, 100395, -382252, 2873870, 2870649, -1036161, 1322313, -923418, 1714766, + -906775, 2253784, 4633196, 4456029, 1091459, -506269, 2502355, -634045, 1192927, -852014, + -797253, -1216013, 2408940, -1683090, 1093069, 310311, -64961, -955093, 479963, -130997, + 1695975, 310311, 338229, 18790, 750009, -565325, 570694, -15569, 332860, 850404, + 118112, 74088, 292058, -384936, -209380, 497679, 63888, -38655, 122943, -332323, + 170188, 105764, -143881, 267362, 384400, -175020, 27917, -121333, 141197, 153545, + 19327, 306553, 62277, -171262, -273804, 374199, + }, + { + -910533, -17472464, 3337190, -14734422, -2136209, -1879048, 3076807, -3770981, -2636036, -185757, + -6701760, -3228205, 2362769, -4666482, -1238024, 5216775, -6852621, 1619740, 5054103, -4444755, + -3682935, 4682588, 5953899, 4503273, 4310537, 3898220, 4460324, 2956548, 2378338, -1071058, + 5111011, 603443, 2216740, -1880659, -1165010, 40265, -67109, -1567126, 1823214, 1342177, + 697395, -3033858, 348966, 3895535, -925029, -1904281, -1920924, -1532230, 1704028, 1188632, + 3592203, 215822, 78920, -2390149, -1135482, 57982, 1175210, -450972, 70330, 547608, + -613643, 172336, 281320, -1194001, 469225, 220117, -13959, 494995, 203474, -492311, + 491774, -323733, 1062468, 393526, 755377, 27380, -617402, 168041, -304406, -132070, + -270583, -94489, -509491, -531502, 361851, -126702, 195958, -229781, -253940, -191663, + -162135, -58519, 50466, 52613, -209917, -69793, + }, + { + -10340134, 66593468, 7887171, -5986111, 13765370, 4304094, -6426882, 5126044, 3957812, 5549635, + -6374805, 1607392, 4056060, 1180042, 34241628, -1335198, -5602248, 521839, 487479, 4147865, + 3368865, -4577362, 1768453, 2147, -5681705, -1245004, -990527, -1838783, -2269890, 519154, + -4076461, 1055488, 3605088, 2967823, 1967095, 1279363, -16106, -2116882, -1269700, 2217814, + -2521683, -172872, -178778, 1267552, -190589, -473520, -875636, 2174327, 497142, 268435, + -454193, -300648, -1340030, -2601677, -277562, 537, -740882, 452045, 1056025, -3758, + 527207, -539018, 335544, 289910, 1124208, 69256, -78383, -200790, 198642, -548145, + 351650, 686658, 399432, -831076, -170725, -253940, 83215, -363998, 101469, -59056, + -65498, -189515, 234613, 59056, -146029, 30602, -301185, 222265, 79457, 117575, + -12348, -306016, 28991, -235686, -226023, -66572, + }, + { + 804233, -27578522, 5862631, 2668785, 615254, -822486, 1931125, -1147830, 1862942, -908386, + -2296734, 3985193, -3088618, 1852205, -25380572, 4345433, 5291400, -1577864, -2435783, 1702418, + 875100, -8303246, 2215666, 1709397, -3111704, 2690260, -1822677, 1577327, -523986, -9877888, + 362388, 3136937, 1474248, -2675765, -432718, -1309428, -2446521, 257698, 594853, 513249, + -1884417, 589484, -1670742, -195421, -2177012, -1016834, 1852205, -1995549, 894427, 1257352, + 46708, 275415, -1571421, 199179, -1394791, -603443, 581431, -231391, 743029, -127775, + 541166, 64425, 237297, -648540, 375810, 545998, -863825, -1071594, -159451, 521839, + 584652, -465467, -349503, -447750, 235686, -123480, 125628, 430570, 367757, -216359, + 302795, -81068, -326418, 227633, 328565, 94489, 506269, 334471, -203474, -187368, + -135828, 14496, 41339, -110595, -100395, 144418, + }, + }, + { + { + 10678362, -82407000, -70637176, 13256417, -10868415, -70867, 3263102, 1279900, -4611185, 4893042, + -1235877, -4083440, 3999152, -4863514, -7488813, 5181878, 700080, 1792612, 8396661, 5357972, + 1539746, 3725347, 897648, -1701881, 872415, 1435056, 860067, -1911261, -3454764, 437013, + -2718714, 3403225, 4726075, 335007, -2908767, 3060164, -4036733, 3983582, -5940477, -1567126, + -2886755, 415538, -1080184, -1822677, 1081258, -1877975, -2692408, -2143726, -490700, -1410897, + -877247, -1474784, 1564979, 1187022, 1408212, 5369, -234076, 1221381, 556735, -86436, + 779537, 763967, -179852, 124017, 259846, 885300, 597000, -968515, 182536, 376883, + 143881, -697932, -760209, 150861, 832150, 155156, 93952, -292595, 235686, 322123, + -82678, -293132, -89657, 267899, -113817, -216896, -107374, 73551, 228170, 299574, + 240518, -125091, -41339, 304943, -217433, 309775, + }, + { + 607201, -14942191, 12894566, -7234336, -4172561, -452582, 270583, -776315, -4630512, -1126892, + 3053185, -885837, -1666984, -3645354, -1805497, 6988449, 3428995, -1385664, 7041599, -4951561, + 1874216, -12540231, -372052, 591632, -4119411, -1785096, 673773, -261456, 5635534, 1159104, + -2349347, 5075041, 1658394, 2501282, 2554432, 1043140, 1198833, -1438277, -3350611, 2754148, + 1300301, -1579474, 751082, -410169, 701153, 1482301, -323733, 450972, -216359, -2448131, + 226023, -297963, -58519, -386547, 467078, -332323, 100395, -1169842, 1313186, -172336, + 479963, 69256, -680215, -735513, -365609, -516470, -1683090, -1090922, 471373, -158914, + -379031, 230318, 195421, 135291, -548682, 158914, 584116, -6442, -670015, 304406, + -220654, 30602, -329639, 9664, -644782, -226560, -266288, -239981, 79457, 47782, + 63888, -15032, -68719, 81068, 24159, 108448, + }, + { + -5484137, 91242288, -3514894, -31868658, -13865228, 2713346, 4460324, -898185, 1938104, 628676, + -16474958, -4394826, -2646774, -9923522, -2942590, -2731599, 2179159, -9104257, -273804, -424128, + 1497333, -7628399, 1701344, -2649995, 6013491, -139586, -2038499, -6250788, -383326, -2207613, + -227096, -2263985, 1342714, -2301566, 1714229, 1514513, -2711735, 1110786, -1320703, 1697049, + 3573413, -4762045, 3000035, -29528, 1137630, -2740726, 710817, 468688, 914291, -176094, + 1342714, 722091, -424665, -1341104, -1693291, 545998, -108985, -1358820, -1175210, -655519, + 95563, -507880, 1626719, 262530, 57982, -337692, -161061, 467615, 616328, -503585, + 27380, -598074, -885837, 23085, 204548, -315143, -518617, -424665, 113280, 299037, + 535797, -146566, 445066, 31675, -96100, -286689, -60666, 77846, 297963, -244276, + -189515, -5369, -200253, -136902, -133144, -77846, + }, + { + -25880936, 150172992, 17743584, 10232223, 1393180, -2275259, 2236067, -4235375, 213675, -1581622, + 4039417, -2678449, -10755135, 2916283, 9874667, -3321620, 1292248, -4446902, -3328063, 3293166, + -3376381, 2165737, 1435056, 3876745, -5165772, 2127620, 612570, -3213173, 1355062, 617402, + -898722, 1503775, -5157719, -287226, 1284195, -3470871, 721018, -230318, 1225139, -1759326, + 632434, -724239, 1380295, -2413235, 819802, 643171, 449361, 899796, -1600949, 862752, + -839666, 874026, -933619, 2401961, -687732, 897111, -387621, -756988, 1420560, 21475, + -295279, -414464, 898722, -557809, -50466, 418222, 566936, -222265, -665183, -290984, + 170188, -185220, 121870, -467078, 548145, 102542, -369367, 613643, -193810, 162135, + -434865, -323196, 48318, 62814, -102005, -13422, 42950, -277562, 284542, -286689, + -108448, -6442, -165893, 176631, 86436, 27380, + }, + { + 1340567, -34415572, -7325604, -1839857, -633508, 92879, -1353452, -2936684, 2356327, 223875, + 2996277, 9156870, 789200, -2522757, -11902965, 12811887, -5652177, -19478750, -2701535, 10397042, + -6567005, -4011500, 6652905, -1206349, 2858838, 3449396, 7029251, -3292629, 1081795, -1720671, + 2913062, -4442607, -6128382, -1199907, -3011846, -944356, 4625680, -3534221, -424665, 4054986, + 754841, -340913, -439160, -409096, 1253594, 1281511, -1452236, -603443, -1888712, 154082, + -324270, 2036351, -508417, 486405, -475668, -122407, 96637, -905164, 31675, -1607928, + 282931, 1540283, -468151, 617402, 473520, -290447, -288300, -64425, 558883, -903017, + 453119, -380641, -237297, -279173, -481036, 42950, -89121, -299037, 580894, -127238, + 43487, -360777, 179852, -93416, 219580, -477815, 484258, 315680, -102005, 315680, + -217433, 180389, 40265, -167504, 18790, -280784, + }, + { + -22552336, 187826432, -13705241, 4410932, 1460826, 909996, -426276, -1532767, -3920232, -4791036, + -13197898, -226023, -7643431, 1741609, 1634235, 2767570, 5537287, 1584843, -3103651, -385473, + 724776, -3751654, -914828, -4581657, 715649, -3407520, -925029, 2365453, -800475, -1084479, + 483184, -351650, 6227703, 2313377, -3127273, 206695, -2303713, 860067, 4635344, 483721, + 919123, 378494, 161061, -466541, -1451162, 2237141, 287226, 492848, 2529736, -354335, + -28454, -2269353, 416075, -2683281, 1573032, -348966, -1068373, -1388348, -1329292, 762894, + 1690607, -724776, 1191853, 1159641, 504122, -794032, -1074, 382252, 1015223, 563178, + 755914, 107911, 650151, 289910, -74625, -268435, -535260, -131533, 505732, 335007, + 431644, 198105, -270583, 119185, -217433, -120259, -287763, -396748, -212064, -299037, + 94489, -201863, 103616, 346819, 69793, -158914, + }, + { + -249645, 5381057, 2724620, 1905892, 457414, -722091, -732292, 1257352, -132070, -242666, + -814970, -2501282, -1263257, 2079838, -8595840, 3339874, 9873593, 3382287, 7757785, -7641284, + -660888, -5801964, -7888245, 1454383, -962073, 3148211, -3061775, -1883880, 2513630, 1039382, + -1733556, -4748623, 3418794, -5926518, 1259499, 867583, -4258997, -1801739, -2185602, -587337, + -822486, 1566589, 590558, 443992, -919123, -992137, -1356673, 251256, -1083942, 298500, + 1214402, 915365, 1469416, -325344, 892279, 734976, 1233729, -804770, -660351, 265751, + -876173, 975494, -245350, -81604, -596464, 1272384, -1009854, -108448, 192737, 558883, + 554588, -373662, -157840, 444529, 451508, 98784, -586263, 178778, 172336, 326418, + -135828, -519691, 198105, 255014, 323733, 277025, 213675, 119722, -2147, 356482, + -30065, -310848, -67109, 205085, -274878, -156766, + }, + { + 6436546, -193885568, 15567109, -14799920, 53150, 294205, 6822019, 2194728, 9789304, 4210679, + -1834488, 1068373, -1451162, -2752537, -8307004, -1276679, -3802120, 2313914, -7672959, -4602058, + -1455457, -1962263, -5907191, -3803194, -3182571, -1792075, 1996623, -3266860, 545998, -1679332, + 4414153, -1632088, -1643362, -4147328, -3293166, -5450851, -6134824, 471910, -1654099, -3389266, + 1719061, -1353989, 1734630, -280247, 845572, 1313723, -380641, -515396, 1611687, -1320703, + -377957, -365609, -1848447, 1198296, -1000191, 1518808, -17717, 503048, 1608465, -307090, + 854699, 1010928, -19864, 25770, 136902, 1519345, -238371, 574452, 656593, 781147, + -534187, 25233, 164283, -389231, 179852, 491237, -5369, 10737, -27917, 143345, + -16106, -134218, -765041, 75162, 627602, -134218, -98784, 96100, -56371, -82141, + 216896, -10737, -16106, -7516, -4832, -20938, + }, + { + -253403, -3357054, -3848828, -1131187, -1321776, 1738925, 457414, -332860, -4181151, -492311, + 4256850, 4043175, 5416491, -7912941, -6552510, 8363375, 12545599, 1466195, 2698850, 548682, + -2865280, 5906654, -4679904, 4226248, 2090039, 9247065, 10152766, -5874442, -6751152, -970663, + -1158567, -4932233, 1397475, -3870303, -118112, -1014686, -3006477, -2350958, 321586, 1403917, + -2694555, 234076, 475668, 427886, -1118839, 2288681, 309775, 1918777, -1504849, 2263985, + 843961, 767189, 736050, 1270774, -2238752, 446677, 1118839, -2156611, 12885, 553514, + 533113, -95563, 171262, 432718, -257161, 373662, 209380, 266288, 97711, -317828, + 573915, 590558, 843961, 105227, -74625, 198105, -120259, 168041, 112206, 283468, + 276489, -379568, -16106, 311385, -277562, -223875, 49392, 209917, -357019, -91268, + -62814, -258235, -268972, -13959, -48855, 83215, + }, + { + -8198556, -175519744, 42853572, 16414291, 10428717, -34012920, -4621922, 2957085, 9659918, -2034741, + -729071, 10153840, 7241315, -579821, 954557, -7614977, -1397475, 2209224, -5555004, 3566434, + 336618, -2977486, -3084860, -1909113, -8178155, 792958, 2642479, 1981054, -1674500, 315680, + 5763309, -1607392, 563178, 1904818, 852014, 6044093, 2656437, 3980361, -1763084, -490163, + -1185948, 2372970, 1195612, -434865, 3653944, -1267015, 542240, -1781875, -1136019, 872415, + 1613834, -525060, -1479079, 151398, 352187, -569620, -838056, 296890, 675384, -1064615, + 48318, -758599, -980863, 139586, -1124745, -1436667, 317291, -235149, -779000, 874563, + 278636, 391916, 248571, 212064, -528818, 376883, 193274, 64425, 723702, -62277, + 737124, -97174, 60130, -284542, 74625, -11274, 323196, -67646, 12348, -20938, + -17180, 220654, 93416, -191126, 140123, 253403, + }, + { + 25233, -31807990, -8301635, 1920924, 388158, -3040837, -5826123, -834297, 2117419, -1289027, + -2429878, 505732, 1614371, -3863860, 3699041, -7153268, 8167417, -6503654, -2633352, -9227737, + 10278930, 104690, -1560684, -5430986, 998043, -4583267, -3739306, 1443109, -1572495, 5173288, + -1858647, -3117610, 475668, -3822521, 89657, 803159, 550293, -78920, -2742337, 350040, + 2258616, 606127, 691490, -784905, -1001264, 158377, -1010391, -1214939, -1448478, 157303, + -1202054, 1364726, -268435, -601295, -889058, 823023, -1392106, -125628, -590021, 122943, + 295816, -399969, -710817, -649077, -1370632, -178241, 217433, 461172, -545461, 387621, + 1002338, 83752, 323196, -229244, -216896, -249108, 4832, 340913, -651224, 134218, + 46708, -9127, 164283, 113280, 82141, -14496, 190052, 181999, 13959, 31675, + -172336, 35433, 35970, 19327, -4295, -219580, + }, + { + 34730180, -79009144, -5535676, -11675332, -6516539, -884226, 5929739, -1417339, -3059091, 8499740, + 5860483, 294205, 4603668, 4017942, 16944720, 352187, 7781944, 106300, 1029718, -3273839, + -3802120, 4287988, 1359894, -358630, 257698, 6681359, -2852932, 1741609, 1398012, -1744294, + -163746, -2145873, 92879, 457414, 987843, 2830384, 3066070, 1276679, -1525787, 2467459, + -1259499, 2316598, 2696166, 3570192, 1482301, 577673, 1963874, -397284, 592706, -1062468, + -388158, 594316, 18254, -628676, 937914, 1823751, -1445793, -156229, 233539, -402653, + 492848, 485868, 102542, -80531, 1288490, 207232, 337692, -184684, 529892, 698469, + 260919, 361314, -496606, -431644, 681289, 434329, -193274, -275415, 46708, -203474, + 260382, 312459, 124017, -66035, 32749, 177704, -37581, 35433, -151398, 293668, + 118112, 1074, -70867, 74625, -47245, 115427, + }, + { + 1159641, 667867, -16474421, -7212861, -6463926, 1184337, 92879, -2553358, -4346507, 1154273, + -5539434, -4479651, -11860552, 3446175, 9896142, -1093606, -2202781, 1993402, 5373541, -928787, + -4057670, 14152991, 14865419, -15859704, 6089190, 1071594, 7822209, -442382, 4493073, -1578937, + -618475, 2965138, -1892470, 696322, 870268, -2648384, 1198833, -136902, -143881, 607738, + 1261647, -599148, -1090385, 1258425, 26307, -613107, -1840930, -2521683, 1195075, 2165737, + 2876554, 699543, -1235877, -871878, -1962263, -1206349, -336081, 689879, 467078, -507880, + 1035087, -610422, -646393, -308701, 475668, 1074, -73551, 394600, 324270, -588947, + 943282, -200790, 599148, 176094, 446140, -130997, -176631, 45097, 164819, -557272, + -73551, -547071, -347892, -2684, 184684, 33286, 15032, -90194, -368293, -382252, + -55835, 130460, -72478, 93416, -29528, -245887, + }, + { + 20453708, 33825016, -1324997, -2171106, 12276090, 1389959, -1304060, -1074279, 13384729, -958315, + -299037, -2612414, 7853885, 358093, 35216584, -6354941, -848256, 1446867, 4910758, -1027571, + 2466922, -4048544, -404801, 2488397, -5109938, -3187403, 415001, -5783711, 822486, -541703, + -2901251, 408022, 2408403, 1971927, 2594160, 349503, 102005, -638340, -247497, 323733, + -433792, -4048007, 1196685, 2057289, -212601, -939524, -1093069, 3188476, 211527, -344134, + 1239635, -431107, -3158949, -1488743, -387621, -138513, 36507, 440234, 826781, -306016, + 603443, 636729, -68183, 294205, 740882, 146566, 133144, -133144, -185220, -106300, + -319438, 1305133, -475668, 274341, -645319, -15032, -214748, 339839, -53687, 156229, + -63351, -214212, 322659, -68183, 48318, -76773, -169651, 162672, -18254, 140660, + -85899, -166967, -119722, 58519, -143881, -234613, + }, + { + -343597, -13043279, -3202972, 774168, 2907156, 545998, 886374, -2157147, -2605435, 2184528, + -1877975, 4594542, -1111323, -19004694, 9286793, 5093831, 6998113, -2578054, 1885491, 2197413, + 1548336, -4642323, -6527277, 3940096, -5362804, 7090991, -2902324, -5412733, 66035, -3336116, + -2440078, 3758097, 1829119, -4046933, 536334, -2714956, 209380, -1742683, -1850057, 278636, + 610959, -2587181, -1614908, -85362, -97711, -1830193, 1590212, -4832, -612033, 1169305, + 563178, 374199, -1280437, -489089, -1515050, -171262, -7516, -742493, 1335735, 199716, + -338229, -1226750, 403190, -201327, 384936, -186294, -763967, -650151, -257698, -355409, + 1015760, -30602, -1237488, -257698, -152471, 79994, -5906, 462246, 288300, 70330, + 444529, -45634, -40802, 10201, 173946, 417686, 472983, 386547, -79994, -179852, + -3758, 23622, -113280, 129923, -311922, 27380, + }, + }, + { + { + -10850161, 43330852, 71965936, 23055384, -3146601, 2725157, 4556424, 5232344, -4334159, 144955, + -3103651, -6871948, 5566278, -4351339, -1681480, 9705015, -3206193, 4517769, 6449431, -781147, + -4753992, -672699, -1150514, -3322694, 3851512, 1075352, 1576790, 1643899, -1894081, 3476239, + -3278671, 2684892, 5780489, 2914135, 1797444, 4130685, -2447058, 8837432, -1852205, 2073932, + 120796, -469762, -1428077, 178241, 2620467, -84826, -979789, 372588, -250182, -1283122, + 87510, -1213328, -206158, -130460, 2130304, 562104, 226023, 1166084, 653909, -102542, + -8053, 35970, -370441, -698469, -1204738, 464930, 501974, -517007, -9664, -479426, + 335544, 85362, -200790, 96100, 780610, 27917, 104153, -258772, 184684, 175557, + -106837, -71941, 263604, 498753, 18790, 259846, 228707, -3221, -69793, 107911, + 59593, 77846, 104153, 190052, -185757, 202400, + }, + { + -1197222, -58245664, -12547747, 4491999, 144418, 497142, 654983, 796180, 1694902, 2399276, + 527744, -341987, -1701344, -5792301, -5104032, -3451543, -415001, 482647, 3277597, -5071283, + 4931160, -16137266, 461709, 4516695, 5785321, 4744865, -5651640, -10816875, -807454, -828929, + -3169149, 2971044, 1212255, -273804, 1728188, 3347390, 4599910, 1910187, -216359, 2254858, + -773631, -596464, 3143916, -651224, -853625, 1534914, 324807, -180926, -905164, -1242856, + 453656, -280247, 48855, -629750, 690953, -526134, 932008, -773631, -150324, -1163399, + -176094, -192200, -393526, 88584, 64961, 607738, 276489, 92342, 332323, -51003, + 68183, 5369, 126165, 366146, -32749, 230854, -34897, -133681, -93952, 565862, + 16106, 216896, -186294, 317291, -202937, -55298, 12885, 235149, 432718, -11274, + 196495, 75699, -159451, -121870, -67109, 62277, + }, + { + 5260261, 77239616, -17600776, -2052994, 1856500, -103079, 4591320, -1382443, -715112, 5131949, + -12995497, -1889249, 5007395, -57982, -3777424, -9599789, 2642479, -7370701, -713501, -2887829, + 756988, -7189239, 5989332, 1826435, 529355, 973884, 7643968, -999117, 1151588, -1982127, + 2279554, -853625, 3329674, 228707, 1122597, 1239098, -2097555, -1050120, -4322348, 882079, + 4560182, -2126009, 3858491, -1485522, 2069101, -221728, 1668595, 561030, 1845762, -233539, + -303332, 1221918, 804770, -268435, -842887, -128849, -399969, -294205, 809601, -18254, + -364535, -847719, 1330903, -545998, 431644, -177704, -588411, 67109, 252866, -753767, + 217433, 388695, -76236, -311385, -268435, -562641, -64425, 62277, 49392, -23622, + 274341, -122943, 192200, -72478, 128312, -488016, -198642, 134755, 611496, 59593, + -106837, 153545, -62814, -180389, -205622, 94489, + }, + { + 11020886, 172255568, -13164612, 4463545, 2902324, -476205, 3601330, -3919695, -1771137, -4053376, + 3181497, 40265, -2314987, 2772402, 4520453, -2731062, 977105, -6947110, -6085432, 1840930, + -3660386, 1362578, -3772055, -133681, -4097936, 1477469, 1109175, -2392297, 2185602, 2185065, + 1260573, 4387846, -1682554, 193274, -232465, -4695473, 1726040, -489626, 1441498, -1037772, + 910533, -358630, 2388539, -1049046, 1897302, 775242, -146029, 136365, -1490891, 1464584, + -712965, -330712, -2199023, 1599875, -1250372, 704912, 279173, -2046552, 513785, -246961, + -954557, -409096, 841277, -150324, 211527, 2147, 369367, -214748, -519154, -440234, + -268972, -816044, 215285, -481036, 229781, 3758, -30065, 546535, -86436, 641024, + -26307, -1611, 169651, 236760, -5906, 122407, 89121, -259309, 441845, -162672, + -119185, -49392, 49929, 88584, -91805, -7516, + }, + { + -1598265, -15299210, 11188927, -1220845, -377420, 185757, -370978, -2290291, 1059246, -1642825, + -1023813, 3769371, -275952, 1025423, -27054536, 3308199, 16851842, 29704530, 17030082, 5013301, + -4728759, -5870147, 7335268, -1094680, 352724, -2152316, 5857262, -4935991, 3678640, -2672007, + 2481954, 2072859, 1612223, 4882841, 1351304, 1178432, 3988414, -5793374, -2573222, 3297998, + -162672, 370441, 777926, 390305, 1993939, 245887, -1401233, 1700807, -804233, 2040646, + -800475, -1267015, -1988570, 18790, -1090922, -222265, -585726, -1101659, 1343251, 167504, + -917512, 71404, -1078574, -663572, 163746, -33823, -620623, 22549, 999654, -534187, + 324807, -388695, -121333, 267899, -8053, 88047, -216359, -118112, 638876, -149250, + 64961, -564788, 491774, 122943, 73551, -460635, 188979, -70330, -90194, 232465, + -108985, 92879, -3758, -202400, -89121, -108448, + }, + { + -2043331, 232085536, 2161979, -1461363, -5226439, 1054415, 4224101, 2700461, 378494, 3911105, + -11658152, -343597, -4025458, 3134253, -254477, 1577327, 483721, -1064078, 37044, 1412507, + 5517959, 345745, -581968, -5284421, 112743, -1181116, 1252520, 3390877, 1273995, 732292, + 743029, -2560874, 3459059, 1841467, -3120294, 819802, 23085, 1619203, 2138357, -390842, + 2373506, -288837, -2849174, -59056, -1014149, 130997, 477815, 1025423, 2805688, 1730872, + 1512365, -2114735, 1049583, -1160715, -149250, -1192927, -426812, -486942, -231928, 450435, + 1144609, -753230, 415538, -544387, -274878, 10737, 596464, -382252, -133144, -93416, + 152471, -619549, 134218, 484794, -39728, -16643, -475668, 37581, 810138, -349503, + -445066, 233002, 18254, 523449, 38655, 170725, -164283, -14496, 217970, -112743, + 197569, -117038, -158377, -42413, 39192, -9664, + }, + { + 632971, 2719788, -2438468, 636192, 236760, -270583, -250182, 754304, -1686848, 767725, + 3245385, 212064, -2077154, 1946694, -5646809, 4333085, 3063386, -1737314, 3962644, -4715337, + 8384313, -2027761, -15794742, -3623879, 1567663, 465467, 5278515, 2894808, 2009508, 2161442, + 1866700, 2139968, 1967095, -4933307, 4808753, 577673, -3534758, -2013266, -1993402, 763430, + -1425929, 899796, 92879, -610422, -65498, -783295, -2646237, -783832, -1762010, -152471, + 133681, -427886, 1676648, -982474, -368830, -120259, 683974, -1364726, -50466, 1031866, + -892816, 1183800, -110595, 103616, -441308, 1061394, -289373, 885837, -72478, -194347, + 744103, 214748, -381715, -141197, 321049, 411780, -278636, 270583, 64425, -143345, + 153545, 5906, -33286, -275952, -74625, 57982, 57982, 134218, -41876, 56908, + -42413, -105227, -2684, 27917, -321586, -149250, + }, + { + 12297028, -221074848, -5077725, -8498130, 1843615, -1071058, 1302986, -3351685, 4253092, 1612760, + 2496450, 2771328, -1627793, 16091095, 11641509, 483184, -1872606, 1418413, -1966021, 2772938, + 4073777, 591095, -4599373, -2371359, -316217, -1423782, 2420751, -1148367, 3681861, 920197, + 483184, -2072859, 2131378, 448287, 107911, -3233037, -3776887, 2543695, 1635846, -1286343, + 1030792, -2051921, 3691525, 1195612, 69256, -2387465, -1491964, -1548336, -180389, 292595, + 1116155, -841277, -2056216, 1979443, -476741, 1555315, 441845, 50466, 56908, -1217623, + 246961, 284005, -204011, -697395, -1061931, 821949, -172872, 366683, 27917, 348429, + -550293, -418222, 20938, -68183, 165356, 236223, 20401, -35970, -115427, 310311, + 195421, 114890, -459562, 13959, 309775, 41339, -27917, 79457, 88584, -128312, + 238371, 88047, -289910, -146029, 74625, -52076, + }, + { + 789737, 4584878, 878858, 77846, -767189, 1338419, 868120, 316217, -3563212, 186294, + 2590402, -1511829, 3037079, 1148367, -5814849, -2365990, -5905580, -10677289, 4029216, -3834869, + -9121974, 5301064, -3488587, 4928475, -3139621, -6962679, 3541201, -3332895, -4682588, -4111358, + 3098819, -1621887, -673236, 1977296, 4316442, -230854, -674847, 1334124, 2120103, 3892314, + -1171452, -2669322, -1770600, 1376000, 43487, 2246268, 1232119, 932008, -3250753, 1868311, + 138513, 13959, 432718, 1564979, -1873680, 548145, 1056562, -1944010, 57445, 353798, + -217970, -1228898, -180389, -309775, -1169842, 55298, 99321, 97711, -278099, -810675, + 214212, -419833, -100395, -243739, -442919, -113280, -265751, -14496, -563178, 79457, + 217433, -118112, 161598, 219580, -277562, -25770, -18790, 107911, -333397, -67109, + 185757, 2147, 38655, 207232, -118648, -3221, + }, + { + 7019587, -170832864, 20489678, -7201587, 2559264, -15582678, 8477729, -2146947, 3388192, -6056978, + -3223373, 5728950, 3584150, -2624225, 2295123, -7573101, -4074850, -2965675, -9578851, 1391569, + 2032056, -2934000, -5662378, -1392106, -2439005, -1023813, -146566, 2041183, -1932198, 1460826, + 6311992, 3278671, -539018, -171799, -468688, 467615, -1640678, 2218351, -2234994, 5028870, + -640487, -1105417, 877247, -223338, 3592740, -1665374, -29528, -1233729, 78383, 339302, + 59593, -244813, -475668, 517007, 964220, -466541, -1568200, -484794, 881005, -1973001, + 398895, -680752, -1656784, 1127966, 44023, -1043140, -61203, 302795, -824097, 184684, + -610959, 374736, 365609, -408022, -860067, 66572, -20938, -104153, 512175, -171262, + 667867, -49929, 93416, -311922, 34897, -104690, 268435, 128849, 3758, -118112, + 19327, -39192, 246424, -114354, -38118, 70330, + }, + { + -408559, -29588030, -4781909, 3346853, -539555, -1806034, -1728724, 2130841, 3067681, -536871, + -1734630, 2014340, 6478422, 2742337, 7457137, -6163278, 6613713, -8233989, 601295, -11298985, + 8853538, -828929, -148176, -1396938, 2069637, 4911295, -1048509, 370978, -926102, 785442, + -3675955, -3816615, 2190433, -2136209, -586263, -1154809, 1383516, 3005403, 714038, 1664837, + 1889786, 1120450, 1389422, 235149, -19864, 475668, -739808, -215285, -955630, 889058, + -1799591, 842350, -334471, -592706, -776315, 1764158, -1155883, -1123134, -774168, -375273, + 587874, 254477, -628676, 591095, 131533, 25770, 158914, 310311, -726923, -110059, + 472983, -140123, -167504, -252866, -1074, -86973, -172336, 355945, -273267, 110059, + 73551, 224949, -17717, -78383, 1074, 106837, 178778, 165893, -133681, 16106, + -300111, -175020, -141734, -103079, 3221, -293668, + }, + { + -12972412, -116163296, 24059334, -4421669, -4230543, -4604205, 1163399, -5431523, -3866008, 2731599, + -3985193, -4887673, 7293928, 6577743, 12254079, -5306432, 3692598, -3221, 4398047, -4163971, + -3338263, 4111358, -3149822, -2838974, -1493575, 2483028, -1567126, 205622, -907849, -1056025, + 2364916, 901943, -886374, 1142998, -176631, -2951716, 11811, 1279900, -229244, 2001992, + -491237, 1157494, -3696893, -1482301, 724239, -141197, 612570, -2207613, 472446, -205622, + 449898, 318901, 24696, 258235, 1611, 402116, -2061047, 131533, 459562, -629213, + -1708323, -787590, 26307, -500364, 753767, 268972, 481573, 140660, 755914, 705985, + 165356, 26307, -491237, -228707, 436476, 339839, 126702, -78920, -256087, 128312, + 565325, 527744, 218506, -229781, -257698, -23622, -148176, -15569, 51003, 549756, + 208843, 8053, -10737, 172872, -81068, 16106, + }, + { + -1256815, 12212203, -90731, 2044941, -6136972, -192737, -609885, 585726, 612033, 3595425, + -1040456, -2428804, 11162083, 27715424, 1677185, -5077188, 1465121, 6810208, 8001524, 3037079, + -5755793, 13196824, 22079354, -17084306, -2694018, -2624762, 7335268, -4242354, -4508642, -3456912, + -764504, 1892470, -3339874, -914291, 2364380, -3817152, 1520418, 578747, -2944737, -563714, + 772020, 796180, 1729798, 437550, -929324, -646393, -1709397, -418222, 1083406, 102005, + 998043, 1039382, -794569, -681826, -1338419, -1156420, -1175747, 664646, 745714, -643708, + 861678, -95026, 155156, -514859, 48318, 179315, -182536, 23085, -166430, -268435, + 737124, -519691, 77846, 167504, 369367, -99321, 83215, -197032, 170188, -400506, + -86436, -34897, 95563, 136902, 177704, -5906, 207769, 23622, -331249, -326418, + 84826, 303332, -17717, 130997, 154082, 49392, + }, + { + -19899658, -20944944, -2029909, -5191542, -320512, -652835, 1826435, -4829154, 13422847, -760209, + 5203890, -282931, 5238250, -23447838, 7386270, 437550, 6856916, 1568200, 1876901, -2572686, + 3028489, -2432562, -1112933, 330176, -3831111, -161598, 1133871, -6882685, 1185948, 504659, + 738734, 602906, 2372433, 2349884, -124554, -1137630, 936303, 172336, -431644, -840740, + -613107, -3394635, -1930588, -2260764, -1372242, 141734, -233002, 1342177, -1956895, -4295, + 938450, -921807, -1687385, 726386, 1007170, -810675, -600759, -31675, -463856, -966368, + 30065, 725850, 132607, -652835, 92879, 288300, 267362, -108448, 303332, 137976, + -293132, 1120987, -419296, 708133, -476741, 257698, -130997, 206695, 105227, 547608, + 230318, -183610, -88047, -267899, 50466, -200790, 18254, 187905, 27380, 244276, + 32212, 537, 68719, 195421, -104153, -324807, + }, + { + -154619, -3784940, 2997887, -1513976, 870268, -808528, -449361, -1411971, -2303713, 2188286, + -3004330, 3479997, 3901978, 19107236, 67623720, 14482630, 3991635, -1166084, 6111202, 8119636, + 1717450, -5507222, -8331700, 388158, -5757404, 6944425, -3231426, -4250944, 1148904, -63888, + -2708514, 1828582, 3324305, 6442, 2099702, -1755568, 1095754, -4208531, -2982855, -311922, + 755377, -1204202, 746787, 1690607, 1075889, -1998234, 1586454, 108448, -506806, 818191, + -651224, -861678, -810138, 1024350, 284005, 712428, 500364, -1464584, 490700, 300111, + -405874, -1455457, 569083, -222265, -574452, -1283658, -971200, 191126, -42950, -644245, + 146566, 366683, -901943, -453119, -139586, 143345, -20401, 408022, 126165, -39192, + 328565, -88584, -197569, -69793, -212064, 173409, 154082, 114890, 126702, 140660, + 246424, 17717, -149787, 272730, -158377, 9664, + }, + }, + { + { + 12665322, 122841432, -2311766, 15420543, 4258997, 2945811, 2921652, 1799054, 2412161, -2011118, + -3883724, -1632088, -1228898, 1182190, -1756105, 9621264, -4031901, 4530117, -4190814, 6212134, + -3851512, -1489280, -5171141, 11274, 1757715, 2951716, -540092, 1032940, -135291, 5567352, + -2732136, -555125, 5350993, 1975148, 7121056, -381715, 1542967, 3902515, 1886564, 1136019, + 1012002, -2268817, -1761474, 1810866, 2059974, 1220845, -93416, -420907, -636729, 84826, + -141197, -147103, 383863, -504659, 921271, 517007, 1387811, 153545, 768799, -224949, + -162135, 345745, -872952, -829466, -643171, -85899, 227096, -17717, -497142, 18790, + -489089, 743029, -197569, 49392, 672162, 562641, 242129, -427349, -361851, 353798, + 96637, 354872, 68183, 98247, 314606, 145492, 387621, 112206, -43487, -1074, + -300648, 168041, 244813, -152471, 207232, -8053, + }, + { + 82678, -67210336, -4274566, 6007586, -40802, -608812, 3649112, -493921, 2777770, 3394098, + -207769, -2204392, -1662152, -6425808, 2516314, -12489765, -1618129, 5665062, -5324686, 1895691, + 6357626, -13217762, -3684545, 1925219, 7413651, -104153, -1717450, -9017284, -4935991, 811212, + 1208496, -636729, -757525, 924492, 354872, 5113159, 3869766, 1124208, 2424509, -1109175, + -49929, 3378529, 1197222, 30602, -3966402, 3228205, 175557, -432181, -1875827, -419296, + 1165547, -738198, 943282, -1607928, 1540283, -1142998, 952946, 491774, -1845762, -750009, + -93952, 33286, -7516, -194347, -26844, 1001801, 605590, 163209, -455803, 413391, + -306553, 300648, 28454, -32749, 403727, 399969, -266825, -314606, 424665, -19864, + 411780, -105764, 102005, 189515, 91805, -283468, -23622, 518617, 268435, 193810, + -60130, -28454, 14496, 59593, -83215, -33823, + }, + { + -4304631, 7198365, 37008124, 12514998, 293132, -2531346, 2273112, 1529008, -1594507, -1852742, + -3091303, -2389613, 3221762, 2344515, -2678986, -13329431, 6955700, -9175124, -2357937, 4273493, + -5203890, -4329327, 3847754, 4750771, -319438, 238908, 6323266, 1220845, 1247688, 1297617, + 84826, 1101122, -1726040, 2228551, 3058554, -1880659, -460098, -2808372, -1350767, -433792, + 1549410, 1123671, -254477, 874026, -931471, 4004520, 447750, 713501, 999654, 476205, + -91268, 333934, 1054951, -282931, 316754, -1052804, -606664, 991601, 597537, -705448, + -70867, 559956, -306553, -697395, 694174, -44023, -530428, -149787, 141197, -337155, + -115427, 834297, 360777, -495532, -488553, -681289, 278099, -4295, -120259, 194884, + 353261, -290984, 14496, 61740, 71404, -468688, -12885, 189515, 308164, 258772, + -34897, 142808, -213675, -272194, -82141, 30065, + }, + { + 7585449, 166463808, -3743601, 4883378, -4075387, 1865090, 915365, -478352, -4571993, -3271691, + -464393, 2226404, 2749316, 4437775, -1957431, -983548, 1946157, -13889924, 0, -2414309, + -157303, 1226750, -3342558, -2921115, 261993, -2647311, 883153, -2178085, 2041183, 802622, + 3120831, 4349192, -743566, -1091459, -1700270, -2823404, 1660005, 34360, 1003949, 438624, + 1192390, -869731, 168577, 482110, 1785096, -423591, 2189897, -687732, -656056, 848793, + -311922, -1112933, -1554778, 914828, 177167, -405874, -302258, -1147830, 177704, -470299, + -501437, -91805, 1038845, -133144, -68183, 376347, -297963, 347892, -213138, -566399, + -371515, -688269, 99321, -734439, -6979, 269509, 231391, 181999, 150324, 314069, + 363462, 25233, 257161, -67646, 89657, 236760, -56371, 47782, -9127, 70867, + 85899, -224412, 11811, 17717, 55298, 28454, + }, + { + 1583232, 5313949, -8252243, 514322, -339839, 83752, -1059783, -1077500, 168041, -434329, + 967441, 1474248, -4224101, -1712618, -20041928, 2158758, 11668889, 42315628, 10392747, -2308008, + 2590402, -18095234, 11122892, -723702, -1611687, -4365835, -408559, -47245, 2393371, -958315, + 1758789, 3037079, 1892470, 4340065, 2247879, 1689533, 311385, -3860639, -1469416, 1420024, + -662499, 480499, 1369558, -41339, 2078227, -668404, 908386, 643171, -1542430, 2666638, + -784905, -1852205, -1918777, -379568, -304943, -577673, -1501628, 137976, 1243393, 635118, + -1480690, -466541, -359167, -845035, 210453, 679679, -651761, 244813, -186831, 353798, + -265751, 395137, -365609, 24159, -330712, 260919, 97174, 57982, 339302, -26844, + 193810, -492848, 223338, 229781, 34360, -73014, -9664, -157840, 71404, 3758, + -13959, 50466, 141197, -223338, -243739, 192737, + }, + { + 29030758, 198603040, -9038759, 130997, -2969970, 1112397, 479963, 5521181, 1319092, 194884, + -3228742, -5095979, 1175747, 3176128, -191126, 208843, 135828, -481036, -359704, 686658, + 6897181, 2740189, -2711735, -2677375, -1443109, -158377, 1760937, -1446330, 257698, 1992328, + 4793721, -1618129, 743029, 2147, -1178969, 973884, -494458, 923955, 1838783, 1666447, + -35433, -288300, -3344706, -1490891, 1060320, -794569, 1905892, -504122, 1744831, 2199560, + 134218, -845572, 293668, 646393, -1592359, -699006, 815507, -193274, 900333, -564788, + -140660, -98247, 603980, -845035, -263067, 338229, 162672, 38655, -700080, -245887, + 184147, -311922, 23622, 311385, -482647, 99858, -58519, 299574, 251256, -416612, + -598611, 41339, 309775, 355945, 190589, 90194, -59056, 61203, 215822, 172872, + -7516, -98784, -127775, -109522, 6442, -54224, + }, + { + -45634, -2187212, 3583613, -1320166, 325881, 304406, -1058710, 856846, -977642, 97174, + 2142115, -1108102, 7585449, -7585449, 729608, 4500589, -6553047, 212601, 1983201, 329102, + 5433134, 14496, -15708843, -4618701, -2878702, 1436667, 2336462, 7780334, 989990, 1217086, + 1649804, 6777996, -4836133, -482110, 2164127, 3100430, -2610803, -824634, -949188, -991064, + 754841, -788663, -225486, -583579, -343597, -635655, -1792612, -1015760, -1443646, -787053, + -30602, -503585, 1854889, -737124, -84826, 317291, -514322, -395674, 1011465, 416612, + -496069, 300648, -313533, -347892, 513785, -353798, 314606, 637803, 230318, 38655, + 222801, 204548, 245350, -6979, -114354, 391379, -236223, 326418, 91268, 68183, + -110595, 324270, -157303, -139586, -247497, -91268, 199716, 15569, -144418, -81604, + -75699, -38118, -133681, -1611, -171799, -130460, + }, + { + -29072634, -188097552, 10158671, -2690797, -2010045, -665720, -2194728, 1166084, -3829500, 4422743, + 3828963, 903017, 1820529, 6413460, 20597052, -849330, 353261, 1868848, -2222646, 6750615, + 1873143, -1817308, -1868848, 1613297, -2869575, -1662152, 450435, 4100083, 926639, 2476586, + -2470680, 3644280, -3646427, 773631, 3446711, -7904351, 2742337, -1579474, 877784, 3134789, + -1192390, -1000191, 2790118, 1349157, 1787780, -4031901, -2249489, 638876, -1137093, 687732, + 216896, -1382443, -1604170, 1151051, 1824824, 533113, 311385, -329102, -94489, -1183264, + -316754, -76236, 239444, -338229, -913217, 384936, 271657, 258772, 55298, -206695, + -173409, -251792, 24159, 183073, 215285, -180389, 162672, 192737, 13959, 134218, + 288837, -118112, -279710, -177167, -9664, 443455, -167504, 208843, 6442, 40265, + -97174, 255014, -199179, -149787, 98247, -128312, + }, + { + 294205, 3294777, 5073430, -778463, 941672, 436476, 113817, -1265942, 274341, 418759, + -248034, 520765, 1199907, -818728, -4220879, -1252520, -13355738, -2902324, -2989834, -4527970, + -4009352, 2435783, 4524211, -7345468, 5388574, -9432285, -6536940, 6209449, -6303402, -5706401, + 4567698, -928787, -1248225, 2291902, 2836289, 2694555, -1660005, 2102923, 1089848, 2772938, + 99321, -2834142, -999654, 1025423, 1629403, 846645, 1626182, -741956, -547071, 290984, + -273267, 40265, 307090, 739271, -373125, 376883, 192200, -163746, -1421634, -161598, + 79994, -378494, -402653, -608275, -1343251, 96100, -83215, 193274, 183610, -1479616, + 158914, -982474, -103079, 34360, -613107, -116501, -428960, 148713, -511638, 139050, + 74625, -48318, 89121, 95026, -374199, 88584, 66035, 141197, -264141, 1611, + 133681, 148176, 39728, 270046, -98784, -29528, + }, + { + -5132486, -143588272, -3620121, -2132988, -4246649, 108448, -796180, 3668439, -5950141, -103079, + -1439888, 1327145, 3870839, 77309, -5575405, 329639, -7143605, -7255811, 4522064, -10872710, + 2016487, 169651, -4169876, -3042984, 3119220, -3765613, -1421097, 1098975, -3033321, 3352222, + 5198521, 5716065, -2262911, -1857573, 2384244, -4692252, 553514, 2319819, -43487, 4779762, + -1192390, -658741, 632971, -783295, 829466, 567473, 1064078, -1239635, -895501, 953483, + -231391, -69793, 913754, 1647657, -721555, -736050, -819802, -5369, -32749, -1282585, + -41339, -695248, -845035, -46171, 418759, 130997, -637803, 102542, -253940, -322123, + -427886, 680215, -83752, -694174, -350040, 192737, -90731, -234076, 88584, 208843, + 193274, 282931, -204011, 76236, -140660, -73551, 453656, 201863, 44023, 104690, + -197569, -179852, 83752, 233002, -115964, 29528, + }, + { + 566399, -19683836, -10023917, 3635690, -2079838, -898722, 133144, 1669132, 1935957, 69256, + -358630, 1569811, 6424198, 1733019, 7010997, -3263638, -1527398, -1034013, -673236, -4006668, + 3833258, -155156, 1560147, 947040, -2609730, 5955509, 3184182, -1471026, -742493, -4293894, + -2692408, -1231582, 1003412, -268435, -2764885, 736050, 478889, 2600066, 782758, 2743410, + -1790465, 1981054, 2055142, -249645, 1599339, -387621, 13959, -735513, -252329, 153545, + -971736, 287763, 448287, -662499, -255014, -5906, -340913, -730681, -132607, -893890, + 401043, 66572, 26844, 77309, 841814, -288837, 290984, 281320, -514322, -14496, + -242666, -68183, -574989, 120796, 56908, -26844, -330176, 279173, 48318, -42950, + -39728, 179852, 193810, -152471, -123480, 188442, -27917, 118112, -173946, -157303, + -91805, -202937, -133681, -146566, 82141, -229781, + }, + { + -8072928, -102590664, 5985574, -205622, -2001992, -1486596, -4872641, -2679523, 81068, -373662, + -5971079, -5853504, 12355010, 3107946, 3058017, 2550137, -1392106, 2137820, 2112587, -279173, + -3151432, -403190, 232465, -2189360, -3023657, -1091995, 55298, 281857, -1738388, 1400159, + -435402, 5110474, -3740380, 2500745, -870805, -4696010, -4295, -730681, 793495, 374736, + 1949378, 1432372, -3410741, -4264903, 1564442, -420907, -295816, -1748052, 1181653, -1396401, + 171262, 714575, 86973, 1337346, -54224, -853088, -991064, -356482, -317291, -272194, + -685047, -1394791, -261993, 363998, 49392, 377420, 469225, 240518, 568009, 499827, + 113817, 320512, -602906, -34897, -90731, 742493, 96100, -156766, -137976, 292595, + 330176, 380641, 317291, 19864, -518617, -128312, -41339, 141734, 209380, 223875, + 321049, 99858, 177704, 70330, -111669, -37581, + }, + { + 989990, 14798847, -449361, 1512365, -4565550, -2445984, -1186485, 1479079, 2334852, 2956548, + 750009, -3446175, 1358820, 47720844, -6256694, 2852395, -2968359, 7278359, 2677912, 648540, + 8739185, 1580011, 17411260, -10598369, -3328600, -1510755, 5384815, -521302, -10089415, 231928, + 369367, 1206349, -2529199, -2495913, 3244311, -4852776, 1060857, 2410014, -5796059, 2475512, + -362925, 1899449, 2223183, -550830, -388695, 526134, -2241973, 1061931, -1636919, 1643899, + 1315334, 251256, 1427540, -2109366, -724776, -899259, 13959, -682363, 1567126, -1194001, + 670552, 251256, 525597, -724776, -311922, 442382, 108448, 227633, -226023, -207232, + 128312, -169114, -32749, 266825, 170725, 168041, 557272, -154082, -255551, 10737, + -273804, -24159, -7516, 3758, 118648, 57982, 36507, -33286, -20401, -345208, + 202937, 149250, 173409, 45097, 156229, 210453, + }, + { + 10201084, -62707596, -3063922, -3342558, -2973728, 3179350, -4083977, 1401233, 7015292, 675384, + 5289789, 2066953, -4656819, 6473590, -24710020, -2007360, 7817914, 2823404, -1825361, 1966558, + 1064615, -1785096, 3081639, -3935801, 2684, -1287953, 458488, -2413772, -3208341, 3038153, + 1181116, 745714, 1304060, 3350611, -2852932, -534723, -403190, 2065342, -868120, -1500017, + -581431, -1171989, -4733054, -1443646, -206695, -921271, 153545, -981937, -506806, 521839, + 388158, -1024350, 175020, 1052804, -704912, -830002, -377420, -355409, -629750, -1218697, + -146029, 553514, 79994, -450435, -111132, 24159, 190052, 178778, 170188, 93952, + 44023, 246424, -30065, 774705, -239981, 530965, -275415, -4832, -34360, 322123, + 262530, 118648, -486942, 12885, -131533, -300648, 105764, 105227, 119185, 148176, + -24159, 96100, -63351, 216896, -13422, -78383, + }, + { + -2147, -1624571, -811749, -1480690, 1999307, -51003, -1453310, 46171, -1348620, -1682554, + 1341104, -918049, 6513855, 20312510, 58092116, 15263240, 1043140, 304943, 7298760, 7639136, + -130997, -6557878, -3679713, -1084479, -2955474, 2021856, -2451353, -718333, 2357400, 145492, + -2656974, 54761, 1499481, 2862059, 1078037, -2098092, 1457068, -3941169, -1008244, 500364, + -2111513, 2630668, 664109, 1002875, 1640141, -1198296, 757525, -615791, -115964, 446677, + 286689, -1943473, 77309, 785442, 323733, 227096, 1603097, -1421097, -85362, 672699, + 482110, -1021129, -539018, 351114, -899259, -675384, -632971, 54761, -264141, -134218, + -154619, -171262, 42413, -301185, -26307, -169651, -155156, 301185, 227633, 66035, + -54224, -67109, -300111, -85362, -156229, -135828, 226560, 77309, 99321, 198642, + 201863, -6979, -70867, 23085, 140660, -81604, + }, + }, + { + { + -12409234, 136878464, -1792612, 214212, 920734, 389768, -2427194, -3382824, -1498944, -1737851, + 2833605, 3481071, -2416993, 3302830, -8351564, 6831146, -2477659, -4326106, -4923107, 9341554, + -4306242, -1073205, -1976759, 432718, -3792456, 1453310, -1945620, -472983, 727997, 4678293, + -2057826, 407485, 2210298, -3368328, 4225711, -2778307, 171262, 2023467, 721018, -2828773, + -2324651, -1728188, -2760053, 325881, 2716567, 1701344, 902480, 466004, 818728, 1482838, + 706522, 93952, 867047, -569083, 881005, 640487, 249108, -1202054, 1285269, 271657, + -105227, 1304596, 61203, -801548, -23085, 57445, 143345, 374199, -104153, 139586, + -840740, 729071, -438087, 179315, 707596, 550830, 529892, -5369, -426812, 197569, + -154619, -90194, -238371, 53150, 301721, -170725, 144418, -101469, -131533, -70330, + -299574, 10201, 126702, -198642, 203474, -88584, + }, + { + 548145, -24512452, 23887534, 4824322, 2234994, 9127, 3286187, -1618129, 475131, -653909, + -230318, 639413, 727997, 1167157, 13371307, -9417253, -796180, -1249299, -10913512, 6092948, + 6673306, -7321846, -955093, -2144263, 472983, -2208687, 831076, -3343095, -929860, 210990, + -794032, 552977, 1605244, 2648384, -1621887, 897648, 772020, 375810, 407485, -3633542, + -732829, 3405909, 734976, 943282, -2446521, 2164127, -1606318, -756988, -1333051, 228707, + 1181116, -1575179, 642098, -1198833, 1376537, -1298154, 241055, -24696, -884763, 301721, + -452045, -581431, 126702, -251792, -22012, 562104, -213675, -181462, -171799, 818728, + -385473, 182536, -242129, -187905, 273804, 212064, -166430, -357019, 111132, -143881, + 543850, -235686, 176631, 289373, -64961, -359704, -548145, -180926, -221728, 66035, + -22549, 118648, 40265, 139050, -20938, -52076, + }, + { + 3965329, -81712288, -38707320, 9801115, 2644089, -1120987, 1742683, 2268817, -613107, -934692, + 975494, -4560182, 1074816, 2698850, 1294933, -7573101, 5509370, -9882720, -1221381, 5226975, + -1889249, 755377, 5433134, 3543885, -5596343, -3205656, 4268661, -2268817, -1627256, -28454, + -2458869, -1221918, -3455301, -1833414, -22012, -259846, 1545115, -1042066, -1134945, -1728724, + 567473, -1232656, -4788889, 672162, -71404, 4108136, -1033477, -589484, -181999, 184147, + 525060, -18254, 282394, -434329, 665183, -4832, 258772, 618475, -384400, -1015760, + 95563, 1071594, -379031, -755377, 340913, -613643, -246961, 146029, -182536, 132070, + 64961, 470836, -31139, -510027, -15032, 97711, 147103, -194884, 222801, -24696, + 312459, -47782, 211527, 135291, 180926, -94489, 54761, 44560, -122943, 146566, + 3758, 66035, -123480, -104690, 134218, 69793, + }, + { + -23098334, 136796320, 749472, 3469260, -821413, -599685, -2773475, 216359, -700617, -424128, + -1105417, 1459752, 3341485, -233002, -8397735, 2607582, 2544768, -16109885, 2243047, -2281702, + 988916, 1663226, -1546725, -2878165, 1721745, -1179505, -1394791, -4520453, -733366, -3694209, + -599148, 3862786, 750546, 1014686, -827855, -1516660, 1832877, 1115618, 75162, -275952, + 1098438, -1656247, -224949, 1032403, -470836, -2966749, 2314987, 674310, 106300, 525060, + -271120, 332323, -233002, 1469953, 1270774, -589484, -546535, -67109, 241592, 274341, + 303332, -286689, 580357, -172872, 370978, 406411, -493384, 595927, 47782, -25770, + 500901, -66572, -2684, -395137, 173946, 188979, -112743, -352187, -140660, -51540, + 293668, -219580, 537, -237297, 3221, 89657, -117575, 103616, -236223, 45097, + 210990, -147640, -153545, -73014, 91805, 39192, + }, + { + -1628866, 19983946, 3625489, 523986, 272194, -185220, -306016, -194884, 173946, 969052, + 637803, -2180770, -6807523, 5324686, -8659728, -2266132, -13176960, -11665668, -10547366, 1682554, + 4866735, -19505058, 1811939, -3120831, 2543158, -2048699, 29528, 2873333, 1262720, -3051038, + -2159832, 84826, -3054796, 2157684, 4286378, 482647, -1494112, -3906273, -2848637, -1569274, + -3113315, -1915555, 224949, 171262, 2204929, -77846, 1637456, -716186, -2668785, 1682017, + -993211, -294205, -576599, 648003, 814970, 395137, -711354, -481573, 777389, 908922, + -830539, 11274, 576599, -286689, 588947, 1032403, -973347, -212064, -641561, -38655, + -218506, 786516, -512712, -259846, -222265, -100395, -242129, 119185, 353798, -242666, + -51540, -204548, 298500, 133681, 194347, 278636, 284005, -31675, -37044, -10737, + 72478, -33286, 145492, 63888, -215822, 86973, + }, + { + -48019880, 126092720, 14288819, 6507949, 1784559, 80531, -2452426, 4335233, 2022393, 1138703, + 3703873, 610422, 5317170, 1537061, 482647, -852014, -2510409, -1170379, -649077, -259309, + 3257733, 2833605, -547608, -1162326, -955630, 267362, -9664, -2618320, 494995, 2083596, + 5134097, -1737314, 990527, -770947, -230854, 2163590, 295816, -18254, -1251983, -991064, + -4552666, -1364189, -2386391, -2947421, 370441, -644245, 1801739, -1656784, -1489817, -467078, + 541703, -219043, -858993, 1015223, 869194, 1063541, 1883343, 401043, 1129040, -853088, + -403190, 32212, 664646, -490700, 448287, 419296, 102005, 387084, -569620, -178241, + 77309, -184684, 227096, -417686, -578747, 106300, -246961, 245350, 178778, -265751, + -517544, -67109, 97711, 29528, -47245, -177167, 10201, 63351, 96637, 97711, + 15032, -19864, -128849, -41339, 21475, -115964, + }, + { + -314606, -10023380, 112206, -412317, -22012, 65498, -887448, 1465121, 71941, 73551, + 1214402, 1069447, 7251516, -5895917, 9294846, 2664490, -11596949, -1537598, 8857296, 5845988, + 1038845, -3514894, -23215372, -3959960, -415001, -871342, -4403415, 4742181, -123480, 325344, + 190589, 6178311, -4135517, -1387274, 1779727, 4310537, -630823, 991064, 929324, 276489, + 1692754, -362388, -678605, -1264868, -1337882, 456877, 142271, -1006096, -980863, 358093, + 321586, -925565, 1366873, 309238, 1454383, 783295, -210453, 102005, 756988, -468688, + -908922, 1074, -645856, -715649, -76773, -958315, 111669, 447750, 231928, -176631, + -419296, -176631, 606127, 132607, -459562, 376883, -105227, 303332, -163209, 124554, + -225486, 231391, 103079, 234613, -49929, 35970, 207232, -220654, -74088, 61740, + -10201, 183073, -127775, 12348, 36507, 17717, + }, + { + 37951940, -137174272, -25514790, -804233, 5257577, 357019, -882079, 724776, -7711077, 1845225, + 623844, -147640, 367220, 1878511, 14519137, -2965138, 1402307, 4303021, -1347009, 5794448, + 1761474, -654983, -1304060, 2662343, -126702, -1970316, -173946, 5272073, 22549, 796180, + -2778844, 4993973, -4929549, -189515, 1758252, -9149891, 4167192, -1096290, 590021, 2530810, + -987843, -242666, 1585380, 1024887, 2461553, -365072, -404801, 1509144, -91268, 479426, + -296353, -273267, -1589138, 475131, 1225139, -307090, 42413, -704375, 1275605, -189515, + -740345, -546535, 278636, 912144, -70330, 603980, 892816, 510564, 63888, -57982, + 221728, 301721, 38655, -12348, 326954, -30602, 36507, 4295, -3758, -142808, + -168577, -161061, 151934, -101469, -187905, 228707, -394063, 31139, -33823, 4295, + -207232, 194884, -10201, -27917, 237834, 67646, + }, + { + -872415, -7146289, -1878511, -1699733, 1435593, 88584, 443455, 670552, 2208687, 1008780, + 893890, 1742683, -864899, -379031, -7853348, 775242, 3619584, 3083787, -4136591, 2327336, + 3638911, 1637456, 5385352, -12444668, -2238752, -2253247, -5198521, 3956202, -581431, 136902, + 4397510, -513785, 1297617, -896574, -2866354, 1167157, -2730526, -217970, -1458678, 1906966, + -351114, -1140314, 346282, -799938, -122407, -1352915, -357556, -224949, 805843, 268435, + -1095754, -915902, 188979, 326418, 220654, 34360, -756988, -269509, -506269, 642635, + -259309, 275415, 401579, 240518, -752156, -22012, -124554, 634045, 1223529, -907312, + 251792, -520228, -53687, 9664, -391379, 239444, 70330, 134218, -318901, 199179, + -62277, -84289, -41876, 75162, 84289, 104153, -190589, 262530, 13422, 60666, + -85362, 83752, -53687, 198642, 17180, 118112, + }, + { + 3200288, -133982040, -11696807, -93952, -303869, -1631014, -5581847, 6419366, -3779571, 3823595, + -1292785, -1612223, 3389803, 2391223, -4975720, 3098282, -2417530, -3184718, 8775692, -8036958, + 2097555, -370441, -1196148, 212601, 2277407, -3941169, -1806034, 282931, -3096135, 2706903, + -695248, -1019518, -1941862, -190052, 4974109, -1382443, 1811939, 181462, -1470489, 3314104, + -726923, 69793, 1825898, 348966, 189515, 491774, 653909, -1036698, 126165, 943282, + -217433, -393526, 223875, 337155, -1145683, 35433, -692027, 458488, 424665, -275415, + 262530, -457414, -719407, -41339, 398358, 144955, 152471, 210990, -19327, 227633, + -228170, 353798, -243739, -284542, 48855, 184684, -255551, -67646, 1611, 165893, + -42950, -42950, -141197, 529355, 68183, -85899, 142808, -6979, 24159, 176631, + -248571, -48855, -85899, 32212, -132607, 104690, + }, + { + -803159, 569083, 8353712, 2413235, -3148748, -603443, -347355, 509491, 909996, -292058, + -86436, -1247151, 1343251, -2079301, 966368, -6359773, -5276904, 1713155, 33286, 3605088, + 7512435, 261993, 7066832, 2783676, -4122632, 1767916, 1185948, 467615, 542777, -2287070, + -157303, 1064078, 2797634, -141197, -1953136, 2930778, -672162, -572304, -1837709, 789200, + -2782602, 1495186, 507880, -855772, 2382633, -821413, -286152, -922881, -831613, -338229, + 299037, 1300301, 667331, -289373, -231928, -1006096, 177167, 73551, 756451, -667331, + -232465, -74625, 390305, 59593, 753230, 51003, 143881, 104153, 198642, 267899, + -801548, -512175, -568009, 363998, 61203, -5369, -99858, 366683, 15032, -3221, + -41876, 81604, 6979, -236760, -24159, 104153, -75162, 144418, -122943, -49929, + 237297, 104153, 96100, -70330, 47782, -63351, + }, + { + 19447612, -64608120, 5835250, 2017561, -551903, 6837588, 546535, 1840930, 1209570, 445066, + -441308, -3240016, 5102958, -11952894, -2905009, 6768332, -738198, 228170, 1354525, 2378338, + -3488050, -514322, 609885, -1337346, -1204738, -709743, -2190970, 918586, -948651, 70330, + -3098282, 3243774, -3122978, 493384, -725850, -1870458, 241592, 750009, 542240, -1476932, + 1672353, 628676, -2089502, -2313914, 459025, -797790, 405338, -291521, 1234803, -1614908, + -382252, 1154273, 476741, 1310502, 281320, 234613, 586800, -337692, -76773, 998580, + 591632, -831076, 91805, 246424, -359704, -17180, 463320, 84289, 202937, 361851, + -260382, 204548, -498216, -133681, -164283, 636729, -71941, -20401, 97711, 171799, + -75699, -63351, 183610, 111669, -336081, 43487, 70867, 283468, 86973, -204011, + 228707, 100932, 169114, 22549, -157303, -127775, + }, + { + -530428, 12821551, 960462, 2789581, -408559, 1465658, -939524, 1313186, 854699, -1037772, + -3743064, -3206193, -4458713, 35022236, -8247948, 7736310, -2794950, 865436, -1609002, -2252174, + 6433861, -8771934, -1000727, -11754789, 6888054, 3299072, 1635309, -1392106, -6154688, 3059091, + 4195110, 3280281, 1495186, 107374, 5259188, -1333587, -545461, 3361349, -3510599, 2618320, + -1500017, -389768, 860604, 1328219, 1490891, 1394791, -1175747, 2937221, -959388, 965831, + 1066226, 215285, 2404108, -2046552, -794569, 8590, 1701344, -717260, 1620813, -339839, + 591095, 427349, 861141, -686121, 180389, 535260, 354335, 149787, -24696, 194884, + 504659, 527207, 231928, -159451, -28991, 260382, 742493, 24159, 154082, 462246, + -17180, -257161, -380105, -201863, -38655, 331249, -39728, -59593, 82141, -277562, + 60666, -379031, 128849, 95026, -98784, 146566, + }, + { + 2579128, -73901888, 3930432, 5585605, 2425046, 5025112, -5243082, -1736241, 106300, -766652, + -2010045, -5747740, -7722888, 8047158, -31071404, -496606, 8052527, 1809255, -2180233, 2630668, + 2258079, -644782, 3324305, -2633352, 3775813, -244813, 644245, 1170916, -4110821, 399969, + 312996, 681826, 1043677, 875636, -2241436, 2284386, -2492692, -755377, -187368, -136902, + 1700270, 1915555, -3185255, -816581, -268435, -147103, -462783, -1920387, 999117, 1592896, + 486405, -1442572, 366683, 1607928, 15032, 271120, 617938, -863288, -603443, -529355, + 329639, 190589, -501437, -393526, -260919, -169651, 98247, 398358, 165356, 64961, + -137439, 277562, -87510, 440771, -129386, 617402, -476205, -94489, -178778, -64961, + 276489, 345745, -193274, 267899, 38655, -41339, -62814, -91805, -87510, -22012, + -314606, -33823, -107911, 144418, -76236, -43487, + }, + { + 407485, -2374043, -1466731, -1632088, 701690, 1162326, 912681, -409633, -1234803, -462783, + 3457986, -4346507, -4344897, -37352792, -26722750, 3187403, -2510409, -6507949, 5018133, 7984344, + 3504157, -4678830, -1188632, -2864206, -1330903, 6337224, 3221226, 775778, -897111, -3479997, + -1669132, 1699733, -1615982, -860067, 1016297, -2485712, 2480344, 2876554, 3346317, 870268, + -2545305, 2039036, 834834, 541703, 840740, -24696, 349503, -1688996, -1555852, -94489, + 1789928, -593242, 170725, 384400, 134218, 26307, 2063195, -796180, -493384, 338229, + 619549, -1440425, -828929, 478889, -534723, 964757, 424128, -830002, -54224, 279710, + 80531, -83752, 539018, -98784, -292058, 28454, -429497, -209917, 186294, -190589, + -151398, 56908, -310848, -303869, -60130, -159988, 150324, 85362, -25770, 25770, + 163746, 24696, -62814, 20401, 215822, -87510, + }, + }, + { + { + 9602473, 175600272, -76570144, 2070174, 4548371, -687195, -1898376, -3208341, -5107253, -1168768, + 1358820, 6780143, -1411434, 1438277, -3906273, 350577, 874026, -5732171, 1672890, 1844152, + -2731599, -2896419, 428960, 2002529, -2328946, -2594697, -1192927, -3418257, 5247377, 788127, + 110595, 2467996, -1957431, -150861, -114354, -1063541, 436476, 908922, 751082, -3211025, + -1783485, -1380832, -2421288, -610959, 1910724, 753230, 947040, -212064, 1122597, 2256469, + 1133871, -1544041, 790274, 649077, 1187022, -334471, 92879, -290984, 563178, 583042, + 682900, -6442, 957241, -707059, -26307, 154619, 106300, 198642, 63888, 239981, + -85899, -69256, -313533, 460098, 556735, 411780, 308701, 120259, -95563, -68183, + -489089, -155693, -29528, 5906, 238371, -235686, -81068, -81604, -153008, 22012, + -183073, -105764, 79457, 10201, 63888, -1611, + }, + { + 627602, 35140348, -22903450, 1286880, 2106145, 2102387, 663572, 2091649, -1065152, -3355443, + 68719, 1762547, -58519, -2410551, 14756434, 3811247, -5121749, -1512902, -10866267, 2095407, + -238908, 3872987, -2414845, -2858301, -854162, -2803003, 1600949, -1956895, -1059246, 652835, + -296353, 3264712, -723165, 1195612, 12885, -1257352, 288837, 1417876, -1364189, -1737314, + 452582, 818728, -1460826, 924492, 1345935, -542240, -10201, -872952, -845572, 518080, + 357556, -1257889, -936303, -79457, -347355, 341450, -82678, -277025, 415001, -111669, + -641024, -889058, 269509, -302258, 360240, -173409, -76773, -345208, -99858, 597000, + -377957, 162135, -112206, 47782, 66035, 191126, -103079, 1074, -108448, -211527, + 244276, 102542, -68719, 280784, -106837, -162135, -585189, -308164, -254477, -236760, + 282931, 45097, 184684, -11274, -150861, 99321, + }, + { + -4199405, -132250096, 14464913, 9352828, -2280091, -678068, -1588064, 1531156, 897111, 651761, + 289373, -1808718, -2810519, 5015448, -3041911, -2904472, -4680441, -4495757, 911070, 2329483, + -410706, -300111, 7619272, 1198296, -4769025, -3833795, 604517, -672162, 2285996, -1166084, + -2403571, -1360431, -4019553, -331786, -4868346, 4514011, -1061931, -132070, -696322, -1722819, + -1427540, 284005, -3284576, -199179, 1336809, 378494, -683437, 689342, -1066226, 285615, + 1125281, -198642, -679679, 92342, 559956, 191663, -46708, 494995, -137439, -849330, + 274878, 890669, -328565, -909459, 373125, -838592, -56908, 479963, -20938, 61203, + -53150, -39728, -285615, 168577, -112743, 52613, -8590, -228170, 388158, -175020, + 325881, 236760, -50466, 304406, 220654, -55835, -25233, -37581, -168041, 170725, + 81068, -115427, -30602, 26844, 148713, 108448, + }, + { + 30729418, 88684096, -11206643, 3570729, -5124970, -811749, -2885144, -346282, -199179, 341987, + -1080184, 2186675, -5906, 175557, -10087804, 4702453, 3304977, -13804562, 856309, -3681861, + 705985, -1751810, 2771328, -1410897, -446677, 317828, -2056753, -1713692, -2392297, -1981591, + -3052111, 2075006, 1582159, 1919314, -1500017, -551903, -221728, 2518462, -195958, -1103807, + 593779, -503585, 218506, 360777, -1025423, -1760400, 225486, 1751810, -288300, 577136, + 170725, 105764, 220654, 1683627, 765578, 139050, -943282, 86973, 201863, 1111323, + -675384, 354335, -176094, 102542, 63888, 154082, 14496, 369904, 23085, -93952, + 571768, 3221, -60130, 277025, 207769, -225486, -198642, -421981, -6442, -141734, + -109522, -166967, 89657, 18790, -207769, -51003, 40265, -40265, -128849, 150324, + 38118, -61203, -166967, -15569, -62277, 79994, + }, + { + 1646046, 21906480, -751619, 1210107, -364535, -38655, 168577, -261456, 378494, -700080, + 1530082, -1037772, -4337917, -909459, 2218351, -7183870, -159451, -37058588, -5529234, 10773925, + -6609418, -6386080, -6345814, -3955665, 4012573, 867047, 1526861, 1950989, 1560684, -1982127, + -3130494, -708670, -833224, 852014, 1560684, -535797, -253403, -2566780, -2643016, -2945274, + -2071785, -1500017, -1292248, 2011118, 1430761, 151934, 852551, -1296006, -635655, -628676, + -483721, 825707, -953483, -42950, 2037962, 12885, 78383, -1624035, 785979, 305480, + 346282, 229244, 370441, 526134, 89121, 300648, -731755, -149787, -235686, -824097, + 309238, 465467, -299574, -249108, 121870, -619012, -100395, 126165, -52076, -122943, + -108985, 32212, 370441, 39192, -8053, 390842, 217433, 102542, -45097, 116501, + -4295, 66035, -138513, 213138, -129386, -3758, + }, + { + 53814328, 51080584, -33344516, 8837969, 3195456, -636192, 938987, 139586, 2566243, 2495376, + 656593, 637266, 7882876, -2741800, 3233037, -2334315, -3692061, 1688996, -1524177, 1239635, + -877784, 3568581, 497142, -1294396, 390842, 566936, -376883, -761820, -838592, 143345, + 6010807, -226560, -1700270, 256087, 1673427, 1171452, 1451699, -1447404, -921271, -1007707, + -4870493, -291521, -1866163, -3283503, -1367947, 539555, -131533, 293132, -1368484, -1857573, + 1217086, 104690, -623844, -412317, 1350767, 1408212, 900869, 1308891, 345745, -273267, + -311385, -71941, 675384, -284005, 706522, 35433, 280784, 91805, 33823, -75699, + -45634, -77309, 83752, -601295, -286689, 189515, -354872, 99321, 129386, 160524, + -324270, -184684, -188979, 190589, -73551, -239444, -132607, 109522, 34360, 60666, + -22549, 27917, -1611, -127775, 126165, -233002, + }, + { + -181462, -9439801, -3185255, 2140504, -728534, -157303, -763430, 1298691, 794569, 550830, + 415001, 2258079, 4909148, -7160248, 13274670, 2753074, -5790690, -2379949, 1978369, 10901164, + 307090, -3029563, -19486266, -6674379, -241592, 1651952, -2826089, 985695, -841814, -365609, + 105227, 1679332, 316217, -2079838, 291521, 3165928, 1190243, -144418, 2266669, 529892, + -899259, 779000, 1204738, -2572149, -593779, 65498, -157840, -939524, -279173, 100932, + -8590, -191126, 1182190, 418759, 1047972, 175557, 256624, 854162, -494458, -547608, + 41339, -390842, -601295, 5906, -618475, -1111323, 163209, 324270, 235686, -57982, + -330712, -344671, 311922, 452045, -238371, -37044, -63888, -39192, -53150, 211527, + -32212, -100395, 204011, 103079, 16643, 105227, 91805, -67109, 86436, 297963, + -56908, 79994, -86436, -7516, 91268, -62814, + }, + { + -38442640, -105970264, 32438278, -207232, 3629784, 395674, 2578054, -2223719, -4495220, -102005, + -478352, 2915209, -1842541, 4916127, 6295349, 1371168, -22549, 4493073, 48855, 1167694, + 2430415, -699006, 1142998, -367220, -274341, -914828, 1532767, 3583077, 391916, -711891, + -685584, 1850594, -1909650, -1464584, 2056216, -4102231, -1269163, -986232, 369367, 1241246, + -598611, -107911, 1265405, 2152852, 819265, 1957431, -1574106, 2377801, 948651, 417686, + -1334124, -228707, -981937, 503585, 668404, -368830, 476205, -803696, 598074, 348966, + -398895, -238908, -368293, 788663, 1057636, 333397, 16643, 1003949, -146566, 312996, + -222265, 442382, 257161, -347355, 318901, 309238, -7516, -335007, 164819, -122943, + 8053, -330712, 116501, -62814, 229781, -177167, -83215, -214748, 4295, -42950, + -107374, -28991, 78383, -7516, 54224, 265751, + }, + { + -275952, -6934225, -7456600, 1637456, -520228, 474594, -293132, 1675574, 1217086, 539018, + 2512019, 792421, -949725, -4638565, -5193689, 5677410, 9450002, -12348, -5574868, 300648, + 5178657, 5412196, -4245039, 2688113, -9956808, 2689723, -2110977, -4736812, 4507032, 1031329, + 2529736, -565325, 424665, -445066, -935229, -865436, -2674154, 672699, -668404, 226023, + -1604170, -532039, 689879, 166430, -2334315, -942208, -270046, -1020055, 1747515, -1132261, + 725850, -665183, -869731, 683437, 625455, -729608, 57982, -859530, -317828, -126702, + 57445, 843961, -121333, 859530, -592706, -101469, 333934, 417149, 733903, 181462, + 42413, -339839, -48855, -88584, 156229, -84826, 182536, 59593, 47245, -28454, + -177167, 121870, 27380, -140660, 299037, -124017, 47782, -94489, 300111, -17717, + -266825, 86973, -20938, 232465, 6979, 12885, + }, + { + -2483028, -121585152, -11395085, 372588, 3907347, -5592048, -1047435, 926102, 1275605, 505732, + 351650, -1275068, 602906, 4030827, 798327, -1604707, 3176665, -3172370, -1862405, 2341831, + 11811, -2618320, 2253247, 2327872, -1717987, -2117419, -1875290, -219043, -1755568, 949188, + -2625299, -1721745, -331249, 1321776, 2463164, 1661079, 1238024, -2534031, 1432909, 1174137, + 1235877, -1301912, 2485176, 420370, 961536, 205622, -969052, -570694, 399969, 232465, + -959925, -434329, 17180, -409096, 199179, -293132, -359167, 294742, 382789, 126165, + -244813, -648003, 86973, -5906, -193810, 81068, 585726, 60130, 143881, 161598, + 185220, -432718, -143881, 239981, -100395, 229244, -384936, 143345, -122943, -45097, + 53687, 40265, 42950, 204548, 28991, 60130, -81068, 76773, 25770, -63351, + -83752, -20938, -7516, -140123, 1611, 1611, + }, + { + 1204202, 15008226, 1495186, -5535676, 212064, -2586644, -825707, 3350611, -1896765, -1131724, + 392990, -2180770, 2684, -3368328, -486942, -1867774, -8206609, 8533026, -3117073, 545461, + 13707388, -4927401, 4233764, 1691143, 2047626, 1643899, -2208150, 5216775, -4336843, 1089848, + -3252364, 3102577, 5055714, -3139084, 11274, 759136, 631897, -1535988, -2262374, -459025, + -399432, 1192390, -68183, -336081, 908386, -716723, 652835, -1393180, -1132798, -542240, + 1056562, 535260, 747861, -12348, 451508, -1427540, 81068, 335544, 556198, -88584, + -515396, -212601, 270583, 401579, 127775, 411780, 51003, -346819, 235149, -150324, + -253940, -293132, -464930, 346282, -236760, 107911, 12885, 369367, 43487, 42413, + -126165, 96637, -218506, -19864, 95026, 107911, 69256, 88584, -98247, 57445, + 109522, 209917, 60666, 155693, -209917, 7516, + }, + { + -19209242, -16858820, 11042361, -4396973, 1447404, 6880001, 4268661, 1024350, -1315871, 870268, + 3095061, -1898376, -40802, -5365488, -6162741, 3365107, 786516, -645856, 1886564, 2460480, + -2072322, -228170, -613643, -1440425, 34360, -1105954, -1159641, -2315524, 301721, -2106145, + 449898, -988916, 983548, -2442226, -2403571, 627065, 1637993, 1030255, 530428, -1596654, + 1899986, 1601486, -3308199, -1594507, 184684, -347355, 281320, 1851131, -2267206, 19864, + -470836, 1319629, 319438, 1289027, 297963, 501437, 872415, -132070, -362388, 599685, + 456340, 16643, 112743, 76773, -428960, 223338, 3758, 286152, 196495, 170725, + -215285, 246961, -524523, -192200, -34897, 179852, 148713, 125091, 103079, 8053, + 104690, -206695, 260919, 12885, -105764, -76236, 26307, 191126, 199716, -277025, + 81604, -56371, 176094, -16643, 32212, -94489, + }, + { + 183073, 11292543, -1156957, 4100620, 635655, 2029372, -2343979, 2317135, 348966, -2225330, + -3142842, -2067490, 14861124, 3660923, 2205466, -3194382, -2582349, -157303, -3416110, 178778, + -7427072, 2776696, -7543037, -947577, 2922188, 3685082, 816581, -4793184, -1976222, -2778307, + 6291054, 4552666, 1053878, 1334661, 1871532, 1930588, -1409286, 2287070, 297963, 470299, + -955093, -332860, -541166, 1074816, 1233729, 2204392, -390842, 165356, 319438, -404801, + 1481764, 964220, 1868848, -1529008, -532039, -305480, 1207960, 16643, 206695, 899259, + 53687, 792958, 322659, -460635, 321049, 526670, 564788, -498216, 293668, 24696, + 854699, 665720, 355409, -553514, -32749, 403727, 499827, -279173, 420907, 193810, + 249645, -273267, -357019, 59056, -155156, 448824, -537, -97711, -137976, -144418, + 177167, -448287, -177704, 170188, 43487, -125628, + }, + { + -11824045, -60889216, 8794482, 9618579, 1644973, 3204583, -724239, -1845762, -2171643, -149787, + -4009889, -4252555, -5035849, -6415608, -16318728, 3029563, 3403762, 1063541, 391916, 2384781, + 1495186, 2194192, 590558, 1096290, 755914, 236223, 81068, 1012002, -2992519, -1278827, + 1625108, -1431835, 2030446, -932008, 1160178, 571768, -2404108, -259309, -1711545, 866510, + 3214246, -494458, -2139968, -109522, -186294, 329639, -1835562, -172872, 1157494, 300648, + 997506, -443992, -599148, 854699, 887985, 201327, 985695, -855235, 103616, -461709, + -150324, 297427, -712428, 139586, -399432, -290984, 499290, 723702, 20938, -333934, + -69256, 537, 176094, 404264, 213138, 209380, -340376, -31139, -19327, -237834, + 172336, 319975, -30602, 135828, 329102, 144955, -281320, -39192, -238908, -84289, + -30065, -87510, -51540, 56371, 22012, -213138, + }, + { + -448824, -1575716, -698469, -1313186, -1611, -121870, 587874, -197032, 1044214, 1571421, + -539555, -2971044, -9021042, -2940979, -82478408, 11960947, -574452, -3256659, 2024540, -2080375, + 12291660, -3726958, -6963753, -4832375, 6506339, 2909304, 2885681, 1222992, -583042, -4268124, + -635118, -1644973, 1314260, 222801, 639413, -3965866, 1285269, 5449240, 1148367, 1090385, + -113817, -724239, 1291175, -66035, -79994, 533650, -730144, -594853, -695248, -220654, + 1195612, -400506, -531502, 295279, 96100, 565862, 1569274, -703301, -337155, -403727, + -98784, -1000191, -383326, -275952, -137976, 505196, 542777, -846645, -17717, 309775, + 132070, 166967, 82678, 20938, -262530, -41876, -286689, -403727, 146029, -179852, + -123480, 224949, -215822, -412317, 45634, -81604, -15569, 278099, -59056, 10737, + 104690, 70867, -537, -36507, 144418, -122943, + }, + }, + { + { + -8045548, 170596640, -38579544, 9034464, -1607928, -612570, -245887, -1997160, -2284386, 2559264, + 1545115, 2965138, -1723356, -1080721, -2207613, 2128693, 1925756, -132070, 3574487, -2034204, + -894964, -1962800, -104153, 1997160, -497679, -1033477, 1678259, -2915209, 3680250, 1154809, + 2354179, 3212636, -1869921, -331786, -389768, 740345, 394600, 589484, 425202, -3344706, + -1175210, 375810, -1111323, -639413, 247497, -1132261, -88584, -579284, 164283, 304406, + 141734, -1034550, 172336, -259309, 557272, -565325, 519691, 177704, 189515, 186294, + 572304, -472983, 468688, -277025, 214748, 265751, 57982, -128849, 17717, 284005, + 239444, 18790, -166967, 33823, 109522, 22549, -18254, -31139, 244276, 209917, + -241055, -159988, 142808, 178241, 162135, -58519, -140123, 25770, -120796, 3221, + -52613, 34360, 105227, 78920, 96100, 54224, + }, + { + -1981591, 50608672, -10912438, -3982509, -4468377, 126165, -1392643, 1177358, -1332514, -841814, + 1018981, 553514, -1780801, -4276177, 7454990, 4820564, -1770600, -898185, -9470403, -419296, + -3712999, 2700998, -1098438, -1529545, 3406446, 956704, -593779, -3269544, -1513439, -223875, + -1940788, 3655017, 2868501, 1124208, 1671279, -2454037, -2339147, 941672, -779000, 207769, + 845572, 525060, -1501091, 574452, 2194192, -1066763, 249108, -116501, -161598, -140123, + -234613, -300648, 20938, 483721, -533113, 509491, -526134, -496606, 449361, -15032, + 180926, -96637, 352187, -397284, 262530, 38118, 226560, -264677, -182536, 100395, + -233539, 314069, -162135, 133681, 148176, 48318, -141197, 231928, 90731, -187368, + -46708, 113817, -55298, 151934, -46171, 123480, -127238, -25770, -63888, -270583, + 271120, -38118, 93952, -122943, -188979, 126165, + }, + { + 3461744, -110886928, 25243670, 11279658, -4230543, -137439, 70330, -377957, 187368, -180926, + -177704, 1294933, -3966939, 3197066, -2645700, 1249836, 926639, -731755, -4566087, -1139777, + -1183264, -1756105, 2770791, -1755031, -1413581, -2618856, -660888, -486942, 2659122, -2428267, + -1917166, 2622078, 180926, 1411971, -5468030, 4181151, 952946, 1342714, -915902, -261993, + -545998, 2618320, -312996, -555125, 449898, -486942, 46171, 464393, -1272384, -7516, + 773094, 67109, -449361, 1015223, 813359, 90731, 69793, 0, -245887, -564251, + -386010, 290447, 417149, -301185, 687732, -241592, 19864, 250719, 226560, -35970, + -259309, -206695, -107374, 496069, -172336, -268972, 39728, 33823, 314606, -258235, + 19327, -25233, -169651, 125628, 168041, -200253, -84289, -74625, -107911, 156229, + -59056, -38655, 112206, -43487, 22549, 170725, + }, + { + -28643136, 40293236, 12128988, 3809099, -236223, 90194, -1802813, 175020, -989990, 142271, + -1682017, 1421634, -212601, 612033, -10683194, 871878, 1508070, -11012296, 2537789, -2387465, + 857920, -1027034, 3687766, -64425, -490700, 1431835, 531502, 892279, -300648, 0, + -1793149, 181999, -1106491, 473520, -842350, -1265942, -1464584, 1757715, -1209570, -639413, + 1337882, 147103, 34360, -1130650, 104153, 279710, -330712, 642098, -832687, 215822, + 74088, 302258, -243203, 512712, 504659, 1036698, -427349, 198642, -163746, 557272, + -572841, 463320, -579284, 111132, -190589, 85899, 102542, -49929, 63888, -23622, + 426812, -216359, -115964, -28454, -46171, -236223, -170725, -106837, 214748, -26307, + -190589, -164819, 112743, 177167, -120259, -81068, 41339, -73014, -47782, 104690, + -15032, -19327, 23085, 26844, -117038, 95026, + }, + { + -1214402, 15358266, -1526324, 1439888, -1044751, -147103, 177167, -403190, 537408, -515933, + 1149441, -536871, -1861868, -668941, 9405442, -198105, 2499671, -6021544, 15421080, 6287296, + -3752728, 3663070, -336081, -1458141, 2648384, -1036161, 168577, -329639, 1538135, 1450625, + 832150, 60130, -1494112, -1423245, 2073932, 312459, 478889, -1178432, -531502, 825171, + 796180, 710280, -734976, -2147, -385473, 302258, 148176, -557809, 634045, 97174, + -26844, -19327, -794032, -681289, 605054, -577136, 284542, -1160178, 681826, 272194, + 944893, 209917, -574989, 66572, 63888, 191663, -410706, 113280, 258772, -570694, + 98784, 336081, -125091, -96100, 527207, -8053, 103616, 114354, 213138, 51540, + 20401, -29528, 179315, -19864, -150324, 98247, -73551, 68183, -60130, 200253, + 23622, 1074, -190052, 259846, 27917, -40265, + }, + { + -45934140, -2149094, 32672890, 3327526, -1082869, 562104, 755377, -3623879, 1423782, 2110977, + -2434710, -1773822, 3531000, -4890357, 2668249, 702227, -2297808, 193810, -792421, 2180770, + -1371705, 1887638, -67646, -922344, 1191317, 1253594, 561567, 1110786, 668941, -963146, + 4166118, 276489, -652298, 910533, 957241, -442382, 647466, -1835562, -337692, 145492, + -1713692, 1619740, 137439, 750546, -692564, -7516, -1365263, 263067, 956704, -1339493, + 857920, 326954, -103616, -339839, 292058, 716723, -25770, 451508, -176094, 291521, + -278636, -321586, 754841, -285615, 450435, -46708, 441308, 53150, 234076, -88584, + -122943, -97174, -5906, 134755, 150324, 314069, -206695, 11811, -10737, 382252, + 24696, 14496, -136365, 303869, 12885, -18254, 25233, 10737, -215285, 91268, + 57445, -5369, 19864, -134218, 163209, -87510, + }, + { + 398358, -2341294, -489089, 2003602, -451508, 287763, -387084, 1056025, -21475, -163209, + -209917, -677531, 2035815, -6436546, 9509594, 5966247, 4422743, 792958, -943819, 7246684, + -290447, -942208, -13385266, -3872450, 790811, 1644436, -1206349, 678605, -1513976, -2063732, + -2277943, -1137093, 2923799, 1044214, -431644, -634045, -369904, -329102, 1382443, 1079111, + -647466, -333397, 1229434, -289373, 1431298, -22012, -134218, -468688, 299037, -263604, + -317291, 47245, 537945, -66035, 188979, 201327, 596464, -83752, -443455, -9127, + 332323, 19864, -309238, 221191, 121870, -452045, -149250, 91268, -175020, -96100, + 133144, -368830, -219580, 317828, 159988, 181999, 122407, -106837, -306016, 133681, + 139050, -261456, 127775, 8053, -69793, 41339, 23622, 87510, 77309, 208306, + -81068, -20938, -38655, -62277, 37581, -20938, + }, + { + 33119030, -70817568, -13683229, -3478924, 343061, 86973, 2279017, -845035, -21475, 909996, + -374736, 2952253, -1403917, 394600, -1798518, 276489, -2194728, 41339, 345745, 1068373, + 128312, -2401961, 525597, -1191317, 969589, 259846, 1108102, 1660542, -597000, 564788, + 403190, -774705, -986769, -1948841, 338229, 411780, 601832, -312996, -1243393, -178241, + 1185411, 811212, 793495, -145492, -672162, 1451162, -973347, 1899449, -70867, 417149, + -789737, -526134, -95026, 828929, -150861, 607738, 1173063, -523449, -108448, 221728, + 304943, 4295, -413391, -169114, 299037, 230318, -426812, 525597, -130460, 421981, + -594316, -425202, 95563, 74625, 317828, 250182, 251256, -146029, 494995, 54761, + 126165, -62814, 195958, 41876, 196495, -209917, 63888, -130460, 40265, -1611, + 88584, 112206, 2147, -93416, -46708, 124017, + }, + { + 971736, 6599754, 986769, 2087354, -1763084, 140660, -510027, 1364189, -337155, -384400, + 2376728, 140123, 2425046, 2468533, -2449205, 4296578, 2380486, -163746, 1682017, -2738579, + -1613297, 3098819, -2959233, 7564511, -9423695, 1976759, 1967095, -4565550, 2032056, -1746978, + 1374390, 599148, 1585917, 1392643, 19327, 106300, -876173, 597537, -1017370, 874563, + -337155, -489089, 308701, 1442035, -418759, -5369, 204011, -1548336, 1414655, -933082, + 613643, -146029, -805306, 30602, -173946, -751082, 195421, -816581, 635655, 85362, + 160524, 628676, -630286, 381178, -242129, -22012, 79457, -68719, -191126, 261456, + 352187, -88047, 302795, -35433, 97174, -151934, 2147, 151934, 117038, 73551, + -41876, 27917, -41876, -237297, 170725, -190052, 84826, -122407, 216359, 9127, + -44560, 21475, -141197, 99321, -79994, 81068, + }, + { + 2952253, -80271328, 21221970, -857920, 3464965, -4030290, -1212791, -1969243, -390842, -1242319, + 1842541, -226023, -3031173, 20401, 3508452, -2928631, 5968394, 2124398, -1837709, 5635534, + 2831457, -3059091, 1106491, 2134062, -1991791, 89657, 1511829, 654446, -2104534, 952409, + -2349347, -2048163, 235149, 29528, -1826972, 1239098, 1572495, -2572686, 1484985, 831076, + 1301912, -1240709, 1637993, 682363, 979789, -680215, -970126, 331786, -89121, 17180, + -582505, -240518, 111669, -650688, 531502, 370978, -68183, -294205, -108985, -419833, + 167504, -279173, -55835, 176094, -315680, 76236, 500364, -186831, 1611, -53687, + 135828, -284005, 51540, 188442, -96637, 94489, -275952, 83215, -61203, -33823, + -39728, -5369, 17180, -38655, -15032, 69256, -75162, 121333, 15032, -53687, + 119185, -51003, 84826, -53687, 119185, 8590, + }, + { + -1288490, 14818174, 4721780, -4306242, 1233729, -1952063, -924492, 4001836, -184147, -647466, + 914828, -1062468, -3641596, -2924873, 3177202, -2006824, -4603131, 8339216, -1937030, -5767068, + 6449967, -6452652, 2198487, 1037235, 2223183, 630823, -4472672, 4814659, -2072859, 4435091, + 227633, 493921, 1574642, -2332167, 786516, -697395, -1327682, -1533303, -469225, 442919, + -26307, -321586, -275952, 463320, 216896, 251792, 815507, -1212255, 341987, 558346, + 981937, -246961, 156229, -323196, 936840, -104153, 320512, -98784, -193274, -273267, + -20938, -81068, -135828, 308164, -44023, -155693, -26844, -119185, -46708, -62814, + 290447, 75699, -210990, 385473, -224949, 129923, -125091, 146566, 8590, 23622, + -8590, 133681, -303332, -26844, 34897, 135291, -537, 82678, -127775, 22549, + -34897, 115964, 11811, 116501, -137439, 60666, + }, + { + 11497627, 12676059, 302795, -4154844, 1493038, -3768834, -2102923, 333934, -1975148, 2145336, + 1420024, -1082332, 3960497, -1061931, -6146635, -813359, -2141578, -1891396, 1570884, 172872, + -467078, 165356, -2134599, -1491427, 133681, -1023813, 884226, -1519882, 591632, -2665027, + -132607, -3333968, 838056, -795106, -739808, 551366, 838592, 793495, 663036, -1955821, + 469225, 781147, -1158567, -146029, 653909, 408559, -177704, 939524, -2062658, 1540283, + 139050, 459025, -1003949, 271120, -353798, 23622, 788127, 179852, -379031, 402116, + -159988, -242129, 102005, 35970, -526134, 325881, 154619, 53150, 1074, 224949, + -303869, 210453, -293668, 117038, 115964, -2147, 68183, 209380, -24696, -24696, + 325881, -65498, 108448, 16106, 69256, -116501, 22549, -132607, 94489, -24159, + 56371, -91268, 87510, -41339, 92342, 5369, + }, + { + 33823, 6331319, -7087233, 2043331, -732292, 1249836, -2697240, 1438814, 115427, -734976, + -1973001, -651761, -6290517, -19853486, 8371965, -9520869, -5015448, 190052, -4184372, 612570, + -5857262, 6535867, -3767223, 2960843, -3357591, -3346317, 812823, -2952790, -1301912, -2437931, + 1296543, 817654, 82678, 1138166, -522912, -302258, -2377265, 217970, 651761, -1357747, + -1713155, 961536, -599685, -381178, -721555, -120796, -651224, 153545, 965294, -863825, + 116501, -281857, 619549, -956704, 388695, -556735, -195421, -270583, -190589, 653372, + -35433, 737124, -256624, -239981, 170188, -17180, 163746, -240518, 387084, -363462, + 417149, 88047, 280247, -100395, 240518, 89657, 26307, -368293, 207769, -186294, + 167504, 2147, -124554, 122943, -211527, 255014, 136902, -108985, -126165, -53150, + 176631, -92879, -129386, 20938, 178241, -135828, + }, + { + 14137959, -30617748, -918049, 746251, -5572720, 4269198, 6763500, -623307, -89657, -142808, + -384400, 1185948, -786516, 6640020, 1781338, -3757560, -3551401, 2093797, 499290, -67109, + 1188095, 1999307, -1662689, 268972, -386547, -103616, -706522, 383863, -1033477, -1926293, + 1226750, -1616518, 1260573, -615254, 2000918, 489626, -1864553, 476205, -1425392, -88047, + 405338, -1661079, -1548336, -330712, -894427, 6442, -923418, 409096, 629750, -196495, + 692564, -266825, -442382, 738198, 433255, -154082, 615791, -574452, 398895, 40802, + 44023, 359167, -117575, 264141, -326954, -235149, 467615, 181462, -181999, 6979, + 36507, -128849, 204011, -117575, -91268, 162672, -39728, 20938, -29528, -162672, + -70330, 64425, -134755, -56371, 33286, -75699, 90194, 214212, -222265, 27917, + 100395, -195958, 15032, 43487, 96100, -150861, + }, + { + 373662, -4010963, -2139431, -409633, -559420, -495532, 75699, 205085, 1044214, 561567, + -1841467, -2228551, -4751845, 28738700, -51363512, 4473209, -2385854, -2816425, -2391223, -6880001, + 3936875, -7474854, -3116536, -58519, 2811056, -236760, 903554, -1468879, -678605, -1637456, + 268435, -1732482, 1529008, 25233, 1465658, -1839320, 976031, 1659468, -1137093, -8590, + 608812, -952409, 535260, -419296, -9127, 62277, -546535, -133681, -742493, 217970, + 1035087, -610422, 124017, -704912, -1447404, -323196, 711891, -410706, 53687, -492311, + -167504, -514322, -113280, -368830, -224412, -307627, 165893, -212601, -7516, 304943, + 111132, 450435, -159988, 10737, -64425, -6979, 116501, -123480, 97711, -125628, + -233539, 28454, -45634, -44023, -64961, -44023, -33286, 60666, -21475, 84289, + -60666, -32749, 41876, -33823, 81068, -139050, + }, + }, + { + { + 8143258, 81192064, 40925132, -4341675, 1081258, -93416, -260919, -1383516, 1123671, 191663, + 1206349, 1614908, 271657, -2321430, -77846, 2550137, -67109, 3339337, -1942936, -1223529, + 957778, -632971, -644782, 245350, 283468, 84289, 1741609, -1013075, 1013075, 1181653, + 3625489, 1133335, -181999, 162135, -429497, 1895154, -856309, 1286880, 4832, -2046015, + -722091, -233539, -17717, -81068, -514322, -186294, -173946, -1599339, -3221, 9127, + 6979, -26307, -245350, -79994, -46171, -286689, 301721, 387621, -308701, 163209, + 321049, -90731, -83215, -44560, -16643, 240518, 75699, 25233, -30602, 48318, + 344671, -112206, 225486, 16643, -193810, -107374, 72478, 113280, 83215, 103079, + 102005, -4832, 85362, 129923, 107374, 35433, -17180, -32749, -29528, -60666, + 64961, 25233, 68719, 105227, 51540, 62814, + }, + { + 1477469, 26302916, 6548752, -4999342, -2914135, -820339, -846645, -118648, 165893, 221728, + 477815, -923418, -1136019, -243203, 2250026, 3333968, -4005057, -1319092, -5454072, -2443300, + -2088428, -908386, 373662, -530428, 4638565, 1105417, -1407139, -3746822, -1257889, -1183264, + -110595, 2034741, 3059627, 1086627, 1780264, -1229434, -556735, -740345, 13422, 618475, + -943282, 1182190, 90194, 139586, 1052267, -587874, 48855, -290447, 176094, -259846, + -117575, 174483, 414464, 91268, -102542, -88584, -484258, -228170, 75699, 127775, + 52076, 409096, 98247, -161061, 47782, 229781, 289373, 113817, -245887, -127238, + 88047, -102542, -82141, 30602, 185220, 37581, -124554, 51003, 148713, 8590, + -26844, 27380, 11274, -39192, 91268, 116501, 36507, -6442, -34360, -3221, + -10737, 42950, 35433, -75699, -66572, 10737, + }, + { + -785442, -57276612, -17016124, 6589554, 4851703, 314606, 325881, -91805, 35433, 126165, + -2030983, -45634, 1838246, -64961, -2860985, 1811403, 180389, -311922, -3804267, -2481417, + -2500745, 3430068, -745714, -927713, -1020055, -1192927, -1219234, 295816, 361314, -423054, + -586263, 868657, 2766496, -806380, -1307281, 667867, 1291711, 1342714, -1167694, 213138, + 405338, 1424855, 1317481, -562104, -263604, -26844, 217970, 347355, -348429, -1611, + -667867, 494995, 156229, 1142461, 1014149, -157303, -108448, -109522, -335544, -289910, + -352724, 192737, 123480, 193810, 173946, 321049, -181999, 170725, 224412, 15032, + -398358, -163746, 216359, 290984, -118648, -159988, 2147, 140123, -25233, 61740, + -166430, -144955, -61203, -8053, 55835, -78920, -56908, -96100, 24696, 60130, + -49392, -16106, 60130, -33286, -3758, 110059, + }, + { + 18640158, -3452080, -2207076, 2463164, -858993, -830539, -788127, -53150, -233002, -844498, + -765041, -150324, -1105954, -509491, -5353140, -1149978, 815507, -5891622, -2700461, -970126, + 616328, 820876, 938450, 1032403, 318364, -24159, 673236, 425202, 435939, 617402, + -46708, -995896, -1018981, -343597, -265214, -940598, -1007170, 301721, -247497, -92879, + 333397, -315680, -375273, -146029, -253403, 785442, 1611, 274341, -359167, -346282, + 217970, -186831, 181999, 194884, 480499, 804770, 106837, 85899, -12348, -19327, + -155156, 71941, -124017, 134755, -152471, 112743, 218506, -215822, 91805, 150324, + -75162, -122407, -146566, -45634, -313533, -60130, -84826, 67109, 81604, 109522, + -68183, -21475, -17717, 49392, -11274, -56371, -15032, -84289, 8590, 55298, + -1611, -8053, 45634, 12348, -16106, 19327, + }, + { + 449898, 8844948, 1218160, 379031, -120259, 138513, -174483, -33823, 208306, 19864, + 120796, -658741, -514859, 919123, 4969814, 380641, -2647311, 10695005, 13036836, 2688650, + -537945, 151934, 2236604, 1932735, -93952, -496606, -1498944, -67646, 448824, 1255741, + 2930778, -963146, -892816, -1374390, 1219771, 839666, -248034, 1000191, -442382, 184684, + 417686, 947040, 238371, -352187, -856309, 98247, -275952, 522912, 454730, 469762, + -124554, -447750, -512712, -263067, -433792, -196495, 27917, -545461, 206695, 622770, + 609349, -167504, -340913, -115427, 137976, 47245, 189515, -54224, 64961, -161598, + -29528, 172872, -17180, 55298, 229781, 214212, 179315, 127775, 156766, 187905, + 104690, 10201, -157303, 6442, -20401, -43487, -17180, -20938, 82678, 94489, + 30602, -537, -76773, 51003, 87510, 54224, + }, + { + 27994060, -45991584, -9912248, -99858, 437013, 343597, 177704, -1432909, -590558, 838056, + -704375, -332860, -2635499, 363998, 352724, -678605, -612033, -88047, 858457, 867047, + 926639, 466541, -120796, -861141, 1005022, 636729, 1491427, 192200, 504122, 588411, + 1984275, -770410, 1245004, 812286, 1103807, -762357, -677531, -756988, 71404, 39192, + 256087, -580894, -52076, 777389, 264141, -437550, -689342, -124554, 822486, 157840, + -471373, 404801, 378494, -33823, -84826, 36507, 395674, 406411, 230854, -260382, + -81604, 71404, 280784, -67109, 59593, 189515, 257161, 185757, 0, -147103, + -44023, 46708, -190589, 264141, 100932, 122407, 127775, 6979, 19327, 210453, + 44560, -33286, -41876, 27917, 174483, 110059, 33286, -14496, -135828, -17717, + 54761, 63888, -5906, -66035, 1074, 108448, + }, + { + 244276, 3697967, -1068373, -1191853, 17180, 267899, 246961, 19864, 117038, -356482, + -76773, -50466, -1475321, 6009733, -278636, 3772592, 3430068, 534187, 3598646, 1432372, + -1396401, -1834488, -4007205, -8935143, -332323, 1647657, -245887, -1204202, -937377, -1466195, + -171262, -1119913, 1446330, 1311576, 392990, -1020592, -726386, 445066, 366683, 748935, + 572841, -481573, 151398, 292058, 1356673, 200253, 159988, -146566, -197569, -469225, + -187368, 369904, 134218, 109522, 114890, 188979, 463856, -272194, -119722, 214748, + -61203, 4832, 6979, 130997, -10201, -147103, -234076, 237297, -131533, -20401, + -246961, -103616, -176094, 83752, 273804, 239981, 265214, -16643, -210990, -120259, + 57982, 76773, -19864, -4295, -72478, 51003, -18254, 54761, 38118, -69793, + -11811, -90731, -3221, -4832, -18790, 12885, + }, + { + -23595476, -11735998, -3514357, -2415382, -1688996, 31139, 348429, 46708, 590558, 632434, + 1377611, 193810, -335007, -805306, -821413, 129923, -2433636, -1762010, 1415192, 315143, + -47245, -774168, -100395, 357556, -895501, 832687, 1193464, 86973, -233002, 1414655, + -255551, -1076963, -1030255, -1366873, 110595, 2230162, 264677, 357019, -1497333, -1126892, + 373125, 1254131, 1011465, -84826, -423591, -409633, 201863, 996969, -318901, 461172, + 16643, -861678, -18254, 174483, 122407, 851477, 529892, 274341, -227633, -298500, + 490700, -181462, 4832, -225486, 172336, -149787, -63888, 61740, 114890, 82678, + -246961, -428960, 12885, 223338, 144418, 187905, 331249, 144955, 278636, 87510, + 151398, 89657, -27917, 125628, 19864, -47245, 27380, -46708, -39728, 174483, + 75162, 56371, 26307, -75699, -27917, -18254, + }, + { + 137976, 8718247, 4467303, 735513, -221191, -265214, 201327, 291521, -259846, -158914, + 1369021, 61203, 2001455, -205622, 2176475, 2944200, 1256278, -1633698, 2932389, -4238596, + -496606, 1133335, -712965, 3884798, -3405372, -1651415, 185220, -15032, -1439888, -1691143, + 383326, 1527935, 1498944, 849330, 407485, 359704, -69256, -240518, 572304, -146029, + 144955, 353261, -246424, 676457, 843961, 442919, -82678, -519691, 34360, 22012, + -76236, 133681, -537408, -575526, -213138, -225486, -10737, -32749, 395674, -4832, + 122943, -99321, 118112, -255551, 37044, -351650, -173409, -69793, -117038, 310848, + 119185, -197569, 158914, -54761, 47782, 26307, -120796, 154619, 76773, 60130, + -33286, -24696, -127238, -106300, -46708, -537, 53150, 34360, 86436, -2147, + 81604, -22549, -84826, 4295, -9664, 93952, + }, + { + -3395172, -48153564, 1472637, 1220845, 1776506, 4276714, -6838125, -2346663, -1072131, -368293, + 258772, 364535, -1101122, -2421825, 2826089, 48855, 5724655, -101469, -637803, 3766150, + 1874753, 922344, -368830, 660888, -1089848, 180926, 1331440, -175557, -291521, 211527, + -807454, -1340567, -1757179, -725313, -746251, -14496, 493921, 155693, 307090, 737661, + 448287, 379568, 264677, 548145, 615254, 148713, -689879, 41876, -354335, 384936, + 134218, -196495, 12348, -20401, 162135, 423054, -79994, -302795, -264141, -205622, + -36507, -56371, -234076, 42413, -80531, 104153, 88584, 228170, -237834, 11811, + 38118, -30065, 54761, -64961, 73551, -114354, 41339, -89121, -67109, 2147, + -205085, 20938, 77309, -129386, 99321, 78920, 55298, 90731, 44023, 21475, + 58519, -31139, 537, 79457, 49392, 77846, + }, + { + 819802, 10079751, 2531346, -317291, -952946, 421981, 554051, 887448, 390842, 726923, + 540092, -516470, -1626719, -3650185, 4536023, -4079682, 1554241, 1313186, 1109712, -3053185, + -1212255, -1509144, 192737, 581431, 1687385, 456877, -594316, -5906, 1271310, 425739, + 1316944, 1368484, -330712, -1222992, -942745, 36507, -1430224, -282394, -370441, 619012, + -252329, -352187, 371515, 273267, -69256, 590021, 307627, -548145, 934692, 750546, + 464930, 151934, -177167, 126702, 166430, 77309, 51540, 14496, -275415, 198105, + -155156, -161061, 11274, 88047, 153008, -178778, -152471, 223875, -108985, 52613, + 78383, -147640, 133144, 92342, -88047, 98247, -39728, -99858, 5906, 34360, + 51003, 27380, -100395, -148176, -5906, 47782, -13959, 27380, -62277, -92879, + 11274, -12885, 10737, 34897, 65498, 40265, + }, + { + -2569464, 24303072, 1796907, -346282, 1984812, -4080219, -4157528, -883153, 642635, 1851668, + -1059246, -734976, 1329829, 1719061, -1842541, -4432943, -1633161, -455803, 57982, -967441, + 246961, -121333, -1440425, -293668, -433255, -269509, 58519, -763967, -680752, 118648, + -2337536, -2010045, -425739, -286689, 374736, -229244, 350577, 468151, -358630, -1159104, + 296890, -556735, -209917, 897648, 655519, 73014, 19864, -496069, -71404, 2147, + 1001264, -181999, -400506, -84289, -117038, -146029, 77309, 377957, -95563, -17717, + -324270, -114890, -32212, 64425, -298500, 67646, 263067, -70867, 27380, 130460, + 44023, -119185, 61740, 24696, 105764, 96100, 38655, 131533, -148713, 52076, + 168577, 156766, 28991, 82678, 6442, -32749, -85362, -108448, 11811, 124017, + 90194, 34897, 1074, -5369, 44023, 77846, + }, + { + -251792, 404801, -1811403, 934155, 70330, -10737, -486405, -435939, 510564, 215822, + -562641, -1129576, -4487167, -17009144, -537408, -3092377, -4024921, -1614908, -2123861, -1100585, + -679679, 355945, 4343286, -507343, -3688303, -4629975, 609885, -2679523, -1533840, 94489, + -152471, 273267, -857383, 1432372, -302795, -1523103, -933082, -615254, 260382, -793495, + -1093069, -217433, -143345, -1046898, -463856, -402116, 41876, 148176, 284542, -79994, + -759672, -114890, 204548, -165893, 472446, -247497, -682363, 31139, -36507, 121870, + 63351, 73014, 142271, 41339, 30602, -41876, -85899, -132607, 302258, 16106, + 104153, 87510, 32749, 170188, 177167, 84289, -81068, 11811, -97711, -27380, + -71404, 17180, 16106, -15569, -118112, 89121, 117038, 17180, -57982, -30065, + -11274, 84289, 9127, -51540, 115964, 2684, + }, + { + -10199474, 104690, 840203, -4031901, -2747169, 1216550, 5759551, 603980, 1017907, 39192, + 1430761, 108985, 1132798, -2813204, 11311870, -2057289, -3926674, 643708, 246961, -940061, + 1163399, 1733019, -1057099, -934155, 14496, 723165, -221728, -107911, -1314260, -362925, + -781147, -33286, 66035, 746787, 294205, 103616, -276489, -321586, -937377, -114890, + -657130, -865436, -1277216, -1188632, -747324, -590558, -411780, 343597, 416075, 236223, + -11811, -274878, 648003, 130997, 353798, -329639, -318901, 212064, 6442, 217433, + 23085, -95563, 376347, -170188, -92879, -173946, 207769, 61203, -6442, 73551, + -111669, -70867, 96637, -16106, -110059, -61740, 166430, 27380, -169651, -68183, + -110595, -86973, -100395, -97174, -57445, -155156, 172872, 104153, -25770, -1611, + 90731, -134218, -51003, 18254, 5906, -19327, + }, + { + -569620, -5401458, -706522, -452582, -349503, -9127, -548145, 118112, 876173, -424665, + -1838246, -1308891, -520228, -9583146, 8574902, -4240744, -3882114, -2800319, -1614371, -1713155, + -5196374, -5840082, -1582696, 1574642, 1510755, -1186485, -503585, -396748, 320512, -522375, + -1298691, 321049, 517544, 349503, 457414, -146566, 1086090, 99321, -450972, -363462, + 171799, 622770, 215285, -908386, 268435, -293132, -194347, -691490, -63351, 481573, + -17180, 31139, 51540, -645856, -995359, -473520, 23085, 15032, 128312, 59056, + -246424, -224949, 115964, -392453, 31675, -564251, -237834, 316217, -13959, 150324, + 33286, 452582, 77309, 78920, 22549, -108448, 34897, 94489, 99858, -47245, + -264677, -155156, -88584, 47782, -72478, -91805, 13422, -22549, 10201, 5906, + -10737, -68183, 13422, 5906, -4295, -28991, + }, + }, + { + { + -6244883, 19388556, 14042396, -5833640, 1089848, 311385, -158914, -830002, 847719, -1510755, + 83215, 1292248, 624381, -709207, -1017907, 1737851, -769336, 783832, -3694746, 1117228, + 414464, -336081, -1168231, -610959, 708133, 312459, 1191853, -240518, -284542, -646929, + 1949915, -467615, 742493, 1467268, 733366, 1261647, -1306744, 1262720, 718870, -405338, + 411243, -109522, 305480, 447750, -580357, 182536, 541166, -1363652, 241592, 431107, + 385473, 291521, -233539, -72478, -33286, 12885, -91805, -131533, -282394, -6979, + 234076, 21475, -189515, -145492, -250719, -12348, -68183, 38655, 24696, 1611, + 178778, -40265, 271657, 175557, -46708, -121333, 87510, 250719, -84826, 33823, + 70867, -6979, 25233, 64425, 38118, -99321, 133681, -49929, -23622, -52076, + 68183, -32749, 9127, -12885, -3221, 44023, + }, + { + 313533, 10649371, -52613, -2095407, 1498944, 75699, -416075, -920197, 676994, -51003, + -437013, -719407, 554588, -805306, -913754, -204011, -5460514, 550293, 987843, 1504849, + 563178, -796716, -326954, -1609539, 2042794, 669478, -792421, -1769527, 675921, -511101, + -462783, -445603, 931471, -5906, 492311, 206695, 1850057, 814433, 709743, 760209, + -1091995, 1341104, 504659, -322123, -117575, -139050, 227096, -374199, -47782, -356482, + 18254, 23622, 345745, 178778, 143345, -419296, -326418, 120796, -61740, -183610, + 89121, 352724, 86436, 47245, -33823, 3758, -90731, 211527, -47245, -8053, + 69256, -90731, -40802, 11274, 96637, 22012, -96100, -21475, 76236, 10737, + 47245, -51003, 7516, 12348, 69793, 37581, 2147, 12348, -68183, 122407, + -79457, -20401, -5369, 4832, 41876, -4295, + }, + { + -2523830, -28018220, 2684, -5265630, -550293, 268972, 70867, -199716, -261993, 390842, + 195421, 453656, 2108292, -1774358, -2561948, 792958, -784905, 2153926, -865436, -75699, + -1546725, 2935610, -387621, -132070, 659814, 879931, -186294, 741419, -876173, -216896, + 249645, -175020, 1895154, -779537, 104153, -1100049, -157840, 579821, -582505, 413927, + -401043, -420370, 457414, -170725, 85899, 677531, 85899, 173946, -291521, 5906, + -945967, 434329, 195421, 233539, 79457, -227633, -34897, 118112, -143345, 42950, + 46708, 57982, -296353, 205085, -120259, 235686, -280247, -120259, -104153, 214748, + -127238, -70330, 128849, -11811, -20938, 164283, 10201, -2684, -144955, 130460, + -20938, -93416, 90194, -34360, -47245, -10737, 0, 24696, 20938, 35970, + 5369, -19864, -12348, -16106, -4832, -10737, + }, + { + -5659157, -32762548, -3720516, 1093069, 1104344, -213675, 25233, -228707, -225486, -303332, + 261456, 256624, -443992, 1417876, -1261110, -337692, 294742, -2656974, 314069, 176094, + 442382, 215822, 57982, 389768, 504659, 15032, -988916, -486405, 387084, 524523, + 525597, -524523, -523449, -119722, 120796, 442382, -511101, 134218, -431644, 65498, + 423591, -441308, -168577, 505732, -358093, 106837, 284542, 185757, -207769, 58519, + 359167, -308164, 72478, 56908, -197032, 85362, 39728, 335544, 187905, -33823, + 86436, 42413, 121333, 105764, 31139, 143345, 31139, -24159, -40265, 55835, + 56371, 179852, -157303, 25233, -135291, 86973, -19327, 18790, -537, 52613, + 15032, 73014, 8590, -52613, 28991, -12348, -48318, 2684, -47245, -13422, + 18254, 18254, -15569, -8053, 31139, 13422, + }, + { + 10737, 6659884, -1217086, -882616, 398895, 57982, -296890, 130997, -206158, 190589, + 150324, -154619, -260919, -2669322, -550293, 559956, -2489471, 78920, 1657321, -1457068, + 484794, 19864, 967441, 1232119, -46708, 361851, -1848983, -21475, -413927, -148176, + 1339493, -1038845, -22012, -531502, 148713, -543313, -1641751, 847719, -148176, -494995, + 74625, 363462, 16643, 61203, -535260, 274878, 48855, 63351, -162672, -18790, + -52076, 41339, -289373, 201863, -317828, -215285, 129923, -53687, -117038, -7516, + -47245, -365072, -152471, -54761, 200253, -9664, 221191, 69793, 55298, 23622, + 80531, 98247, -1074, 14496, -108985, -139586, 46171, -10201, -1074, 141197, + 38655, 114890, -160524, -97174, 66572, -13959, 47782, 3221, 23085, -32212, + -2684, 53150, 6979, -22549, -53687, 59593, + }, + { + -7111392, -72378792, 3397319, -983548, -479963, 332323, -115427, 692564, -920734, -959388, + 1044214, 623307, -2509335, 1633161, 228707, -312459, -195958, -459562, 895501, -449898, + 289373, -128849, 251792, -354872, 217970, -199179, 245887, -544387, -615254, -856846, + 523986, -1232656, 1057099, -962073, -132607, -687195, -657130, -63888, 375810, 331249, + 44023, -1141924, -224949, 501974, 409633, -336618, 42950, 26307, -78383, -58519, + -330176, -4295, 154082, 54224, 364535, -119722, 358093, 98784, -22549, -265751, + -17180, 30065, 126165, -81604, -47782, 18790, 27917, 102005, -74088, -136365, + 4832, 133144, -52076, 9664, -24696, -31139, 59056, 34897, -65498, 63888, + -8053, 3758, -5906, -198642, 86973, 45634, 41339, -39728, 66035, -1074, + 31139, 19864, -39192, -9664, -47782, 63888, + }, + { + -597537, 3061238, 1689533, -733366, 241055, 9127, -16643, -278099, 235686, -17180, + -151398, 182536, -1217086, 5190468, -2143726, 1772211, -572841, -1420560, 639950, -2231236, + -773631, -14496, -718333, -3686156, 1071058, 415001, -1042066, 576063, 144955, -916439, + 1086090, 166430, -265214, -937377, 339839, -90194, -576063, 229244, -102542, -190052, + 794032, -351650, -254477, 169651, 144955, -391379, 306553, -103616, -235686, -432181, + -345745, 102542, -208843, 1611, 198105, -34897, 75162, 140660, 75699, 172336, + -134218, 151934, 120796, 23622, 9664, -28991, -126702, 195421, -30065, 39728, + -308164, 37044, -59056, -74625, 28991, 9664, 103079, 46171, -76236, -95026, + -78383, 67646, -48318, 55835, -70867, -5369, -12885, -40802, 16643, -53687, + -13422, -13959, -6979, 31139, -5369, 2684, + }, + { + 11368778, 35348656, -8437463, -1424855, -299574, -178241, -214748, -343597, -233002, 75162, + 1324997, 78920, -376883, -1016297, -287763, 1082332, -548682, 230854, 204548, -482647, + 926102, 61740, -216896, 1063541, -214748, 334471, 55298, -188442, -299574, 491774, + -681826, 18254, 119722, 69793, 179315, 832687, -578747, -232465, -921807, -454193, + -374736, 260382, -100932, -15032, 139586, -304406, -354335, 680215, -383863, 118112, + 153545, -107374, -71941, -279710, -53687, 125628, 10201, 200790, 172872, -119185, + 279173, -247497, -37581, -244276, 319975, -23622, -5369, -74625, 56371, -98784, + -63351, -184684, -68183, 60666, 56908, 9127, -4832, 92342, 32749, -103616, + 136365, 73551, -95563, 39192, -11274, 10201, -35433, 5906, -78383, 104690, + 4832, -13422, 44023, 7516, 46171, -50466, + }, + { + -962073, 192200, 760746, -1061394, 291521, -150324, 110059, -246424, 321049, -14496, + -381715, -903554, 901406, 421981, 4299799, 237834, 1822677, -1030255, -209380, -3039763, + 2989834, -293132, -2518462, 812823, -1266479, -642635, -2143726, 436476, -476741, 253940, + 605590, -1267552, -185757, -533650, 18790, 750546, 90194, -244813, 485868, -319975, + 341987, 614180, -563714, -280784, -124554, -117038, -230318, -82141, -307090, -112743, + 66035, 47782, -264677, -85362, 410706, 142271, -171799, -38118, -15569, -237297, + -33823, 51003, 261993, -326954, 11811, -159451, -91805, -136902, 14496, 105764, + -77309, -175557, -26307, -247497, 23622, 78920, -97711, -10201, 1611, -34897, + 5906, 37044, -154082, 11274, -57982, 28454, 37044, 108448, 62814, -55298, + 20401, 35970, -34897, -14496, 8590, 39728, + }, + { + 3330747, -26655104, 3765076, -3930432, -1661616, 3132642, -6720550, 599685, -469762, -636192, + 746251, 185220, 427886, -1155346, -175020, -8053, 2682744, -1602023, 656056, 1559073, + -628139, 601295, -1127429, -148713, -833224, 75162, 354872, -862752, 84826, 301185, + -428960, -637803, -1285806, -324807, 11274, -357019, -70330, -4832, 386010, 112743, + 85362, 203474, -164819, -30602, -39728, 648540, 3758, 286689, -266288, 157840, + 292058, -90194, 77309, 299574, -150861, 27917, -14496, 133681, -116501, 166967, + -171262, -1611, -136902, -40802, 66572, -28991, -126165, 138513, -272194, 86973, + 99321, 23085, -88584, -98784, 118648, -79994, -34360, -81604, -132070, 144955, + -107911, -6979, 59593, -50466, 3221, -30065, 42950, 41876, -10201, 48318, + -51003, 11811, -25233, 43487, -47782, 59056, + }, + { + -310311, 4945118, -3381750, -1435593, -250182, 745177, -99858, -960462, 28454, 213138, + -283468, 882616, 166430, -961536, 4293894, -2981781, 5280126, -523986, -759136, 582505, + -1269700, -1072668, 671626, 1073205, 282931, -176094, 1296006, -984084, 648540, -856846, + 17717, 718333, -290984, 237834, -517007, 894964, -457951, 692564, 12885, 895501, + -188979, -246424, 803696, 136902, -185757, -160524, -166430, -223338, 625992, -48855, + 71941, 344671, -10201, 63351, -16643, -37044, -193274, -65498, -67109, 231391, + -206695, -53150, 28454, -99858, 68719, 130997, -81604, 233002, 82141, 107374, + -27917, -238371, 1074, -74625, -54224, 13422, 47782, -5906, -31139, 111132, + 25770, -40265, 106300, -75699, -75162, -31139, -32749, -51003, 57445, -88047, + 31675, -10737, -25770, 20401, 50466, 39192, + }, + { + -3144990, 18596672, -2466385, 1425392, 1596117, 75162, -1115081, 41876, 672162, -247497, + -797253, -439160, 774705, 2666101, 1551557, -2493229, 45097, 907312, -347355, 209917, + 280247, 376883, 123480, 544387, -757525, 636192, -14496, 334471, -607201, 1082869, + -1120987, 195421, 48318, -574452, 732292, -179315, 21475, 97711, -471373, -351650, + 179852, 56371, 27380, 434329, 424128, -225486, -150861, -491237, 503048, -277562, + 463320, -90731, 103616, 188442, -106300, -190052, -24696, 101469, -95563, -309775, + -267362, 18254, -22549, -5906, -25770, -35970, 37581, -49392, 78383, 25233, + 113280, -114890, 175557, -22549, -52613, 106837, -22549, 47782, -83215, -23622, + -18254, 58519, 16106, 26307, -105227, 72478, -62277, -2147, 5906, -18254, + 63351, -4295, 4295, 33823, -13959, 31139, + }, + { + 407485, -307090, -702227, 1560147, -556198, -463320, 864899, -1096290, -170725, 805306, + 395674, 111669, 7565585, 246424, -842350, 2477659, 9127, 646393, 535797, 297963, + 5619965, -3062312, 694711, 136365, -359704, -1257352, 1643899, -1251983, -409633, 25233, + 994285, 113817, -926639, 281320, -698469, -506806, -44023, 137439, -408022, -43487, + -287763, -62277, -342524, -487479, 264141, -163746, 120796, -82678, -137976, 489089, + -431644, -207232, 331249, -277025, 250719, 198642, -113280, -41876, -14496, -302258, + -281857, -92879, 333397, -20938, 38118, -178778, 75162, 72478, -1611, -78920, + -7516, 53687, -89657, -26307, 1074, 43487, -3221, 101469, -33823, 134218, + -3758, -17180, -83752, -10737, -102005, 23622, -33286, 107374, 71404, 13422, + -25233, 40265, 92342, 13422, -9127, 2147, + }, + { + 3282429, 18373334, -135291, -3684545, 372588, 314606, 793495, -2017024, -619549, 482647, + 952409, -252329, 2451890, -4229469, 5591511, 885837, -214212, -278099, 446677, 507343, + 332323, 518080, 514859, -1294933, -215285, 313533, -762894, -534187, -1241782, 1009854, + -854162, 809601, -151934, 1021665, -822486, -150324, 448287, -278099, -394600, -190589, + -327491, 661425, 96100, -361314, 370978, -69793, -316754, -131533, 123480, 86973, + 341450, -116501, 249645, -249108, 263067, -180926, -367757, 186294, 63888, -108448, + 5906, -12348, 235686, -204011, 84289, -133681, -60666, 118112, 5906, 10737, + -156229, 32749, 64961, 63888, -207232, -192737, 31675, 55298, -63888, 25770, + -36507, 10201, 47245, -18254, -57445, -86973, 45097, 20938, 71941, -37044, + 6979, 18790, -35970, -18790, -1074, 67109, + }, + { + 718333, -3234647, -525597, -142808, 272194, 64961, 192737, 207232, 426276, 41876, + -42950, 345745, -386010, -11653857, 16106664, -1057636, -1157494, -629213, 507343, 2878165, + -135291, -1357747, 1570347, 348429, 189515, -672699, -699543, -258235, 540092, 169651, + -246424, 1088237, 366146, 727460, 988916, -734976, 737661, 691490, -207769, 46171, + 111669, 566936, 187368, -624381, -236760, -45634, -156229, -625992, 295816, 96100, + -433255, 85899, 142271, 23622, -96100, -143345, 129386, 158377, -229781, -9127, + 243739, 110059, 189515, -106837, 212064, -129386, 82678, 26307, 71941, 106300, + -35433, 106300, 55298, 92879, -9127, 20938, -94489, -68183, -9127, 10737, + -19864, -84289, -24696, 1074, 58519, -54761, 56908, 32212, 12348, -25770, + 26844, -17717, 2147, 1611, 11811, 1074, + }, + }, + { + { + 2762738, 31606664, -20196010, -3455838, 2815351, 386010, -489089, -379568, -504122, -1047435, + -406411, 1388885, 57982, 972810, -2305861, 607738, 843961, -1564979, -1183800, 303332, + 76236, -43487, -951872, -1139240, 1044214, 742493, 542240, -399969, -394063, -796180, + 678605, -167504, 1189169, 732829, 940598, 620086, -804770, 619012, 649614, 260382, + 91268, -314069, 406948, 4295, -4295, 67646, 106837, -365072, -184147, 365072, + 178778, 209917, -4832, -20938, -45097, 315680, -234613, -241055, 122407, -132607, + 3221, 199179, -14496, -171262, -161598, 12885, -238371, 56371, 25233, 149250, + -2147, 103079, 56908, 165893, 88047, 77846, 32212, 134755, -21475, -40802, + -49929, -68183, 35433, 42413, 24159, -70867, 57445, -45097, -71404, -38118, + 22012, -29528, 0, 10737, -3758, 19864, + }, + { + -1293322, 5884105, 3535295, 208306, 575526, 151398, -332323, -918049, 289910, -88047, + -1184874, -513249, 510027, 466541, -1610076, -1806571, -1097364, -418759, 4915053, 166967, + -242129, -1013075, 146566, -1121523, -495532, 421444, 433792, -1532767, 317828, 46171, + 163746, 384400, -956167, 1079647, -656056, 462783, 1226213, 900333, 499827, 605590, + -259846, 606127, 302258, -168577, -420907, 490163, -151934, -157303, -188979, -389231, + 14496, -63351, -63351, 142271, -18254, 73014, -291521, -23085, 42950, -188979, + 0, 124554, 75699, 173409, -93952, -67646, -157840, -26307, 18254, -6442, + 107911, -36507, 63888, 18254, -35970, 0, 71404, -55298, -12348, 3221, + 59056, -17180, 13422, 42950, 2684, -40802, 7516, -39192, -57445, 12348, + 24696, -33823, -45634, -22549, 41339, 19327, + }, + { + 4143570, -27677306, -4313221, -8581345, -564251, 270583, -503048, -383326, 235686, -217970, + 836982, 506269, 754304, -168577, -2730526, -149787, -1706713, 2100776, 1039919, -23622, + 320512, 490700, -8590, 171262, -30065, 882079, 51003, 457414, -809601, -201863, + 277562, 346282, 280784, -1073742, 798864, -818191, -942745, -445066, 644782, -73014, + 36507, -660888, -123480, -434329, 348429, 464930, -194884, -47782, 69793, -215285, + -204548, -24696, 55835, 131533, -340376, -119722, 82678, 210990, -94489, 100395, + 151934, -57982, -139586, -25770, -41876, -129923, -95026, -2684, -143345, 79994, + 19864, -46171, -19327, -74088, 130460, 279173, -89657, -79457, -49392, 90731, + 41339, -64961, 34897, 12348, 10737, -8590, -62277, 78920, 24159, 17180, + 23085, 3221, -37044, 2147, 47245, -68183, + }, + { + -4763656, -31879394, -3071439, -738734, -205085, -12348, -55298, -708133, 57445, 453119, + 259309, 61203, -155156, 243739, 768799, 32212, -207769, -2377265, 512712, 383326, + 480499, 74625, 70330, 102005, 29528, 339302, -1012002, 62277, 8590, -305480, + 203474, -388695, -98247, -176631, 121333, 836982, -565862, -86973, 28454, -40265, + 371515, -322659, 140660, 176631, -16643, -218506, 303332, 64425, -10737, -165893, + 236223, -37581, 2684, -23085, -187905, -24159, 66572, 258772, 157840, 126165, + 29528, -91268, 134218, -41339, 74088, 59056, -44023, 61740, 51540, -87510, + 126165, 278636, 3758, -32749, 8590, 39192, -537, -61203, -13959, -33823, + -35970, 17717, -4832, -37044, 32749, 39192, -33823, -6442, -20938, -35970, + 9664, 20938, -8053, -18254, 15569, 2147, + }, + { + -16643, 6328098, -479963, -619549, 112206, 66572, -38655, -70867, -498753, 663572, + 179852, -764504, 372052, -337692, -5974837, 2770791, 394063, -6579890, -2215666, 65498, + 1136556, 994285, -665720, -531502, 1331977, 594316, 951872, -492311, -710817, 89121, + -34897, -315680, -386547, -11274, -838056, -460635, -891743, 106837, 23622, -433792, + -455803, 217433, -175020, -32212, -172336, -64425, 420907, -127238, -50466, -202400, + -140660, 42413, 51540, 55835, -294742, -13422, 73014, 9664, -47245, -140660, + -394600, 32749, -77846, 81604, -55835, -52613, 20401, 108448, 158377, -61203, + 155156, 81604, -52613, 15032, -74088, -128312, -63888, -53150, -54224, -45097, + -3221, 95563, 11811, -79457, 16643, 34360, 30602, 26844, 38655, -61740, + -23622, 19864, 57982, -1611, -72478, -16106, + }, + { + -9006010, -64548528, -1328219, -623844, 391916, 346819, -246961, 501437, 97711, -1062468, + 405338, 384400, 74088, 197569, -343597, 791348, -620086, -545461, 640487, -650688, + -501437, -129923, 497679, 16106, -68719, -296890, -493921, 335007, -937914, 67646, + -737124, -340913, 298500, -1182190, -136902, -106300, -127775, -223875, 15032, 126165, + -694174, -751619, 105227, 489626, 336081, -125628, -17717, 105764, -231928, -514859, + 177167, 66572, -276489, 181462, 429497, -12885, -5369, -14496, -162135, -167504, + 63888, 81604, 5369, -108985, -18790, 44023, 21475, 75162, -8053, -54761, + 3758, 12348, 69793, -81604, 2684, 31139, -39192, -27917, 14496, -11811, + 62277, 48855, 7516, -91805, -25233, -73551, 59593, -105227, 90731, 31139, + 10201, 25233, -47782, 4832, -1074, -20401, + }, + { + 36507, 1826972, 357019, 280247, 245350, 48318, -238371, -115427, -15569, 204548, + -41339, 497679, 339839, 211527, 2626909, 2257005, -2423435, -422517, -989990, -1381369, + -578210, 90194, -1749125, 70867, 1052804, -301185, -1570884, 997506, 343061, -168041, + 117038, 129923, 161598, -1366873, -587874, 251792, -696858, 38118, 153008, -494995, + 307090, -23085, -97711, -6442, 41876, -292595, 15032, -45634, -301721, -233002, + -158377, -102542, -260382, -72478, 101469, 113817, -222265, 217970, 219043, 40265, + 45634, 77846, 163746, -46171, 34360, 2684, -93952, -89657, 72478, 52613, + -62277, -132070, 53150, -110059, -115964, -31675, -14496, -83215, -55298, -9664, + -44560, -41339, -18254, 24159, -12348, -23085, 24696, -23622, 37581, 37044, + 18254, 68719, -19864, 5906, 13422, 537, + }, + { + -457414, 49272400, -777926, -3153043, 76773, -377420, 116501, -272194, -135828, 115427, + 55835, 270583, 574989, -177167, -628676, 755377, 28454, 1613297, -119722, -808528, + 213675, 460098, 186831, 192200, 1015760, 54761, -472983, 342524, -649614, -359167, + -97711, 584652, 112743, 324807, 298500, -753230, -51540, -579821, -566936, 185757, + -572841, 49392, -254477, 279710, 297963, 8053, -644782, 499290, -1074, -9127, + -84826, 358093, 136902, -272730, -107374, -179852, -104690, 86973, 280247, 97711, + -3221, 17717, -294742, 45634, 137439, 137439, -34897, -5906, 144955, -200790, + -67646, -17717, -76236, -192737, 6979, 98247, -53687, -7516, -46171, -16643, + 51003, -8590, 12885, 20401, 20938, 2147, -77846, -22549, -45634, -15032, + 22549, -22549, 25770, 45634, -16643, 2684, + }, + { + 20401, -7200513, 926102, 39192, 102005, 78383, 171799, -110059, 169114, -59056, + -318901, -9664, 462783, 909459, 3348464, -400506, 3477313, -942208, -1270237, -1138166, + 1481764, 308164, -215822, -2186675, -1562831, 172336, -719407, -2177012, 1615982, -22012, + 1024350, -1091995, -464930, -554051, -150324, 168577, -234613, -306016, 452045, 174483, + 66035, 242129, -179315, -493384, -720481, -283468, -281320, 54761, -234076, -215822, + 171799, -118648, 186831, -120796, 421981, 154619, -243739, -113817, -353798, -119722, + 93952, 248571, 6442, 71941, -37581, 37044, -34360, -61740, 122943, 12885, + -125091, 37044, -89657, -99858, -90731, 68183, 53687, -88047, -33286, -35970, + -30602, 81604, -63351, 32212, -6442, -9127, -85362, 85362, 27380, -7516, + -16643, 18254, 11811, -16643, -5369, -5369, + }, + { + -3499325, -15612206, 4034048, -4231080, -1446867, -3527779, 394063, 139050, -865436, -90194, + 488016, -645319, 212601, 478352, -398895, 113817, 1089848, -339302, 92342, 1058710, + -62814, 56908, -583042, -613643, -312459, -24159, -397821, -471910, 125628, -138513, + -375273, -881542, -142808, -546535, 72478, -116501, 246961, -410706, 381178, -270583, + -46708, 373125, -250182, 43487, 13959, 195958, 184147, 228170, -6979, -132607, + 29528, -23085, -149250, 48855, 296890, -118112, -123480, 154619, -132070, 85899, + 50466, -56908, 48855, -142271, -71404, 3758, -33286, -63351, -18254, 13959, + 100395, -37044, -100395, -3758, -23085, 0, -120259, -51003, -24696, 35433, + 56371, 13959, -50466, -5369, -57982, -69256, -36507, 0, -38118, 8590, + -42950, 15032, 32749, -37581, -18790, 2147, + }, + { + 221191, 2254858, 559956, -2760590, -981937, 98784, -1398549, -142271, 69256, -493921, + -83752, 145492, -660351, 1007707, 1376000, -306016, 2563022, -55835, 391916, 270583, + -1002338, 492311, 391916, 209917, 471373, -383863, 904091, -246424, -176631, 103616, + -497142, 389768, -85362, 567473, 155693, 173409, 544387, 220117, 220654, 174483, + 36507, 289373, 428423, -25233, -106837, -350577, -220117, 32749, -70867, -122943, + 27917, 153008, 329639, 226023, -89121, -184147, -162135, -138513, 27917, 68183, + -171799, -21475, 44023, -34360, -111669, 136902, 60130, -20401, 104690, 65498, + -41339, -61203, -51003, -105764, 537, -31675, 126165, 108448, 12885, 52076, + -22549, -40265, 63888, 41339, -47245, -13422, 30065, -46708, 57982, 39192, + -6442, -3758, -15569, 55298, -19864, 15032, + }, + { + 4573067, 6027987, -703838, 694711, 351114, 936303, 1305670, 641024, 171262, -667867, + -1177358, 973884, 1775432, -496069, 2836826, -1302986, -228707, 955630, 85899, 42950, + 104690, 446140, 279710, 497679, -766652, 656593, 25770, 60666, -144955, 136902, + -97711, 160524, 36507, -81604, 493921, -50466, 494995, 108448, -42413, -59593, + -381178, 443992, 559420, -37581, -413927, 154619, -183073, -106837, 83752, 85362, + 10737, 11811, 260919, -66035, 187905, -187368, 1074, -19327, -8590, -262530, + -143345, 25233, 69793, -194347, 51003, -51003, -6979, 78920, 87510, -49392, + 56908, -5369, 51003, -43487, -62277, 73014, -33286, 34360, 12348, -11811, + -30602, -35433, -5369, -55835, -57982, 69256, -36507, 35433, 3758, -78383, + 6979, -31675, -27917, 26844, 3221, 3221, + }, + { + -358630, -239981, 40802, 1968706, -1153199, 215822, 522912, -318901, -361851, 359704, + 381178, 681289, -14496, 9622337, -1554241, 1302986, 1253594, 770947, 638876, -226560, + 3878892, 1440425, -3642669, 395674, 503048, -718333, 715112, -676457, 381178, -1099512, + 1618666, 159451, -426276, -164283, -758599, 486942, -222265, 108448, -167504, -132607, + -20938, -134755, -709743, 103079, -219043, 335544, -69256, -524523, -314606, 503048, + 76773, -63888, -171262, 205085, -145492, -85362, 200253, -56371, -240518, -57982, + -253940, -3221, 13959, -37581, 128312, 35970, -58519, 219580, -163209, -104153, + 81604, 28991, -3758, -46171, -166430, -43487, -17180, 93416, 146029, 40265, + 57982, 18790, -82141, -5906, -54224, 48855, -71941, 61740, 84289, 31139, + 21475, 9664, -2147, 66035, -59593, -56908, + }, + { + 2691871, 17367238, -80531, 1228898, 1036698, -100395, -1117228, -334471, -1280974, 658741, + 354335, -1151051, 1949915, 3525095, -5078262, 1298154, 2956011, -830002, 613643, 998580, + 557272, 98784, 392453, -293132, -1204738, 25233, -705985, -728534, -1023276, 129386, + 270583, 447750, 65498, 552440, -459025, 143345, 242129, -106837, -169114, 86436, + -305480, 624918, -171262, 128849, 515933, 178778, -203474, -51540, 459562, -197569, + 420907, 181999, -401579, -234613, 248571, 137976, 4295, -216359, 163746, -98784, + 29528, 204548, 6979, -97174, 215822, -19864, 537, 100932, -6442, -46171, + -17717, -73014, 65498, -10201, -138513, -92879, -39728, -21475, 100932, 31139, + -2147, 13422, 114354, 52076, -59056, 29528, 10201, -64425, 13422, 8590, + -4832, 52613, -5906, 8590, -9664, 28454, + }, + { + -507880, -2043331, 1220308, -538482, 137976, -74625, 251256, 624381, 101469, 218506, + 790811, 600759, -1782411, 3768834, -8878234, 2639794, 596464, -242666, 1553704, 2334852, + 207232, 1459215, 574989, -1541356, 1123671, 24696, -654446, 172336, -144418, -227633, + 181462, 476205, 466541, 537945, 795106, -506806, 88047, 915365, 461709, -93416, + 42413, 84826, -529355, 175557, -42950, -311385, -297963, -200253, 164819, -203474, + -100932, -2147, -177167, 17180, 294742, 11811, -106300, 184684, -316754, -232465, + 2684, 166967, -70867, 114890, -1074, 72478, 225486, -176631, 119722, 25770, + 72478, -60130, -84826, -9127, -39728, 63351, -90731, -165356, -60130, 2147, + 76773, 2684, 26844, 2147, 32212, -9664, 27917, 45634, 41339, 13422, + 20401, 20401, -4295, -17180, -17717, 42950, + }, + }, + { + { + -2608119, 72520520, 9321690, -7005629, 1081258, 746251, -486405, -338766, -280784, -259309, + -471373, 660351, 68719, 429497, -2131378, -164819, 693637, -620623, 1451162, -35433, + -448287, -329102, -289910, -893890, 677531, -250719, 209380, -399969, -369367, -530428, + 826781, -61203, -124554, -338766, 251792, 863288, -505732, 178241, -201327, -77309, + 228170, -236223, 386547, -159451, -26844, -340913, -373125, 392453, 191663, -66572, + -287763, 39192, -38118, -161598, -275952, 120796, -104153, -27380, 392990, 25233, + -168041, 37581, -18254, 23622, -78920, 156229, -99321, -42413, -19864, 91268, + 31139, 48855, -83215, 9664, 28991, 155156, 5906, 11811, 159451, 0, + -26844, -92879, 5369, 6979, -19864, 35433, -8590, 31139, -27917, 6979, + 17180, 12348, 0, 33823, -5906, 1074, + }, + { + 889595, -1014686, -5995238, 772020, -256087, 417149, -325344, -200790, 228170, 321586, + -738734, -199179, 600759, 841814, -1986422, -1291711, 2204929, 128312, 2717104, 614180, + -5369, -1547262, 968515, -177704, -1448478, -271657, 989453, -1223529, 584116, -39192, + 304943, 649077, -1677722, 821949, -117038, 216896, 37581, -459562, -549756, 383326, + 37581, 89121, 18254, -120259, 38655, 449361, -166430, -51003, -51540, -405874, + -113817, -27380, -252329, -85362, -270046, 480499, -57445, -245350, -156229, -100932, + -142808, -126702, -155693, 66035, -112743, -74625, -10737, -173409, -47245, -56908, + 98784, -123480, 48318, 30065, -108985, -121333, 96637, -3758, 76236, -17717, + -88047, 49392, 84289, -14496, -42950, -37044, 38655, -5906, 50466, -95026, + 42950, 26844, 0, -48855, -12348, -2684, + }, + { + -3537443, -23163832, 11367168, -4335770, -1406602, -814433, -549756, -1318555, -667867, 266825, + 507343, -679679, -1322850, -343061, -1726577, 1138166, -1797444, 766652, 1486596, 1435593, + 178241, -27917, -644245, -1293859, -304406, 884226, -702764, -129923, -417686, 99858, + 614717, 131533, -1166084, -1556926, 138513, -439697, -1034013, -318364, 797253, -377420, + 3221, 73551, -44023, -970126, 213138, -480499, -570157, -8053, 231391, 106300, + 308701, 102542, -222265, -35970, -350577, -226560, 204548, 401579, 181462, 162135, + 97174, -130460, 15569, -63351, 182536, -88584, 25233, 201327, 34360, -149787, + -56908, 131533, -26844, -78920, 81068, 80531, -28454, 45634, -49929, 81604, + 14496, 21475, 18790, 12885, 105764, -20401, -88584, 12348, 25770, 15032, + -11811, -5906, -3758, 17717, 46708, -30602, + }, + { + 9378598, -12838731, -3021510, -690416, 67109, -33286, 146029, -354872, -264141, 154619, + 121870, -552440, 73014, -20938, -676457, -57982, -93952, -2923799, 197569, 494995, + 373125, 93416, 27917, -153545, -557809, -34897, -53687, 595927, -151934, -784368, + 326954, -99858, 72478, -117038, 192200, 825171, -140660, -104690, 519154, 26844, + 237297, 212064, 710280, 9664, -111669, -155693, 61203, -46708, 15569, -237297, + 8053, -101469, 98247, -226560, -190589, -88584, -132607, 31675, -14496, 8053, + -134218, -183073, -121870, 1074, -17717, -31139, -17717, -60666, 138513, -96100, + 5369, 41876, 150324, 79457, 75162, 41339, -29528, -41339, -1611, -5369, + -55835, -25233, -41339, 64425, 30065, 48855, 39728, -47782, 62277, 24696, + -9127, -18254, -3758, -11811, -29528, -11274, + }, + { + 56908, 6751689, 681826, 22012, -216359, -5369, -148176, 199179, 10201, 125091, + 168041, -108448, 1001264, -1131724, -7858180, 2492692, 263067, -1453846, 100395, 1027034, + 1781338, 2230699, -331249, -861141, 693637, -937914, 2040110, 559956, -51003, 59593, + 562104, 930934, 440771, 13959, -322123, 331786, 323196, 117038, -289373, -206158, + -553514, 324270, -370441, -85362, 221728, -102542, 155693, -22012, 90731, 174483, + -109522, -85362, 70867, -292058, -136365, 184147, 155693, -139586, -67646, 61740, + -90194, 196495, -194347, 2684, -44560, -83215, -100395, -92342, 76236, -72478, + -38118, 29528, 11274, -11274, 78920, 69793, -158914, -52613, -11274, -153008, + -70867, -57445, 37581, 40265, -61203, 43487, -17180, -9664, 44023, -51540, + 8053, 10737, -22012, -1074, 26307, -3758, + }, + { + 15960635, -34335044, -1597728, -242666, -452582, 199179, 389768, -393526, 1085016, 623844, + -949188, -160524, 949188, -70330, -1013075, 672699, -303869, -264141, -207769, -697932, + 224412, -90731, 316217, 476741, 409096, -13422, -424128, 601295, 60666, 521302, + -614717, -84289, 507880, -398358, -27380, 88584, 498753, 64961, -7516, 8053, + -288300, -239444, 152471, 113280, -89657, 26844, -166430, 13422, -19864, -257161, + 332860, 324270, -27380, 104153, -119722, -146566, -253940, -71941, -162135, -37044, + 46171, -4832, -73014, -216359, -23622, 74625, 32749, 47245, 120796, 82678, + -13959, -38118, 15569, 15032, 38118, 92879, -66572, -44023, 54224, 17180, + -8590, -24696, -2147, 40265, -24159, -92879, 7516, -48318, -38118, 28454, + -2147, 15032, -19864, -25233, 55298, -19327, + }, + { + 363462, 3356517, -427349, 457414, 2684, -45097, -199716, 44023, -337692, -20401, + 45097, -146566, -763430, -1691680, 2377265, 2565169, -2777233, -1318018, -333934, 770947, + 932008, 1261647, -1075352, -106837, 1202054, 650688, -89121, 414464, 530428, -274341, + -309238, -329102, -329102, -868120, -825707, -205085, -284005, 116501, -34360, -139586, + 176631, -115427, 195421, -124017, 399432, -83215, -141734, 67109, -112206, -6979, + 196495, 84826, 34360, -142271, -202400, 150324, -140660, -189515, -110059, -24696, + 47245, 55298, 204548, -115964, -61203, 59593, 82141, -10201, -51003, -33286, + 212064, 8590, 55835, -1074, 2684, -7516, -18790, -142271, -73014, -12885, + 34360, -61203, 0, -25770, 30602, 23622, -7516, 13959, 12348, 2147, + 27917, 61740, 18254, -31139, 20401, 10737, + }, + { + -4854387, 42746736, 5855114, -46171, 996432, -287226, -102005, 84826, 315680, 148176, + -777926, -928250, 795106, 1488743, 288300, 1187022, 82141, 260919, 788127, 97174, + -316754, 560493, 260382, -685047, 473520, -11811, -25770, 677531, -405874, -8590, + 319438, 609349, 461709, 213138, 394600, -489626, -134218, 198642, 280784, 469762, + -108448, 347355, 18254, -108985, -89657, 103079, -146566, 456340, 165356, -306016, + -351650, 120796, 284005, 119722, -41876, 130460, -24159, -103616, -3758, 16643, + -27380, 159988, -202400, 29528, -114354, 63888, 26844, 62814, 90731, -67109, + 11811, 31139, 105764, -69256, -84826, 5906, 77309, -52613, -12348, 98247, + -17180, -42950, 74088, 57982, 34360, -6979, 19327, -17180, -30602, -64961, + 29528, 45634, 1074, 22549, -27917, 32749, + }, + { + 829466, -4415764, -751619, 717260, -289910, 145492, 169114, 124017, 56908, 46171, + 197569, -45634, -267362, -2527052, 1957431, 645856, -34897, -1868311, 343597, -1112933, + 233002, 1225139, 535260, -297963, 272730, 1525787, 1125281, -2416993, 2108829, -11811, + 543850, -238371, -62277, -14496, 39728, -714038, -445603, -56908, 319438, 458488, + 137439, 3221, 170188, 163746, -366683, -208843, -6442, 135291, -90731, -96100, + 325881, 537, 408559, -40265, 133144, -90194, -100932, -98784, -278099, -41339, + 26844, 23622, -6442, 210453, 44023, 217970, 129386, 39192, -2147, -60666, + -138513, -48855, -16106, 146029, -77309, 26844, 72478, 25233, -67109, 6442, + -92342, 15032, 53687, 48318, 38118, 2147, -85362, -17717, -537, -7516, + -1611, -23085, 25233, 24159, -24696, 2147, + }, + { + 4216584, -9441412, 5290326, 1663226, 772557, -1609539, 3759170, -644245, -475131, 105764, + 360777, -732292, -848793, 677531, 1181653, -1297080, 872952, 7516, -368293, 1054951, + 191126, -344671, 350577, 314606, 445603, 166430, -173946, 277025, 271657, 11811, + 110059, 90731, 953483, 295279, 294742, -35433, 477815, -548682, -288837, -109522, + -106837, -3758, -514322, 112206, 173409, -132070, -94489, 171262, 141734, -31139, + -177167, 115964, -33823, -330712, 258772, -44023, -190052, 2684, -24159, -98247, + 245887, -93952, -42413, -92879, -135291, 76773, -23622, -28991, 141734, 26844, + 88584, -23085, -40265, -42413, -59593, -64425, -33823, -87510, 89657, -14496, + 42950, 71404, 17180, 2147, 42413, -1074, -68719, -6979, -12885, -54761, + 4832, -51003, 67646, -17717, 15569, -46708, + }, + { + -301185, 290984, 2492692, -273804, -202937, -174483, -1971927, -223875, -384400, -157303, + 454193, -1028108, -1131724, 33286, 353798, -1478543, -820876, -1466731, 467615, -1742683, + 366146, 1202591, 84289, -602906, 140123, -694174, -402116, -249108, -377957, 422517, + -260382, 149250, -377420, -172336, 103079, -437013, 129386, -331249, -49392, -24696, + 88584, 197569, -77846, -115427, -84826, -347892, -173946, 167504, -219043, 11274, + -69256, -272730, 5369, 58519, -59056, -87510, -31675, -69793, -51540, 146566, + -24159, -142271, 34360, 113817, -42950, -48855, 106300, -76773, -67109, -17180, + -25233, 73014, -9664, -47782, -11274, -12348, 34897, 27380, 93952, -34360, + -53687, 41339, -41339, -1074, 41339, 44560, -12348, 19864, 4832, 76773, + -3221, 11274, 9127, 15032, -33286, -44023, + }, + { + -3181497, -4219806, -1379758, -2261837, -5369, -1151588, 2084133, 1389422, 22012, -35970, + -2287070, 743566, 294205, -2092723, 2724083, 229781, 724776, 209380, 208843, -679679, + 619012, 515396, -214748, 283468, -548145, -329102, -353798, -858993, 64961, -454193, + 496069, 139586, 91805, 286689, -127775, -551903, 461709, 366683, 362925, -183610, + 10201, 191126, 236760, -348966, -401043, 163746, -139586, 98247, -336618, -41876, + 130997, 47782, 159451, -386010, 232465, -121333, 86973, -67646, -201863, 11811, + -80531, 34360, 101469, -75699, -30602, 25770, -10737, -7516, 117575, 15569, + -70330, 62277, -13959, -57445, -48318, -17180, -51540, 56908, 26844, 6442, + -9127, 22549, -47245, -97174, -16643, -46171, 56371, 45097, 11811, 12348, + -18254, 1611, -38118, -6442, 12885, -6979, + }, + { + 182536, -1655710, -1264331, 2681133, -1596654, 472446, -101469, 200790, 67109, 45097, + -736587, -116501, -4413079, 2167348, -2117956, -2330020, -2191507, -775242, 632971, 152471, + -1698660, 587337, -3935801, -1306207, 95026, 974958, 161061, -593242, 822486, -700617, + 418759, 92879, 340376, 3221, -336081, 490163, 87510, 253940, 568546, -266288, + 62814, 304406, -432718, 112743, -220654, 53687, -312459, -500901, -142271, 528818, + 378494, 51003, -513249, 207769, -23085, -178778, -178241, 53687, -136365, 57982, + -37581, 283468, -241592, -158914, -10201, 180926, -205085, 63351, -77309, -54761, + 147103, 9127, 52076, -17180, -25770, 7516, -45634, 77846, 66035, -86973, + 11811, 53150, -31139, 15032, -40802, 23622, 5369, -41876, 537, 51540, + 38118, 53150, -56908, -3221, 16106, -68719, + }, + { + -5033165, 3708704, 483721, 4627291, 64425, 51540, -384936, 465467, -174483, -199179, + 467615, -1253594, 1268626, 1433982, -8435853, -594316, 2326262, -602369, 1420024, 373125, + 92342, 468688, 141734, 975494, -697395, -8053, -745714, 274341, 49929, -863825, + 120796, -244813, -277562, -96637, -24159, 290984, 11274, 139050, -152471, 244813, + -348429, 592706, -19864, 71941, 279173, 287763, 17717, 464930, 458488, -561030, + -52076, 416075, -175557, -299574, 156766, 193274, 178241, -224949, -25770, 34897, + 52076, 221191, 45097, -79457, 153008, -33823, 241592, 77846, 21475, -35970, + 97711, -122943, 3221, -71404, -15032, 9664, 51003, -131533, 21475, 41339, + 31675, -83752, 11274, 63888, -24696, -8590, 78920, -44560, -40265, 27917, + 5906, -26844, 32212, 27380, 9664, -16106, + }, + { + 312996, -2630668, 130460, -61203, 362925, -171262, -169114, 708133, -98247, 208843, + 1144609, 420907, -769873, 8815420, -12646531, 258235, 1708323, 861678, 1027034, 1858110, + 179852, 2321967, 1013612, -789200, 1068373, 203474, -576599, -310311, -317291, 191126, + -274878, -875100, 26844, -330712, 238371, 375810, -103079, -208843, 264677, -359167, + 162135, 173409, -392990, 141197, 475668, -217433, 85899, 117038, 96100, -195421, + 95563, 12348, -116501, -213138, -44023, 69256, -89121, 16106, -73551, -84826, + -199716, 73014, -117038, -78383, -130460, -80531, -15569, 28991, -38655, -82141, + -30065, 36507, -158914, -71941, -45634, -61203, 91268, -11811, -53687, -26307, + -18790, -8053, 2147, 68719, -26307, 26844, 2147, -39728, 5906, 67109, + -2147, -5369, 50466, 537, -33286, 24159, + }, + }, + { + { + 6017786, 73981352, 5279589, -3736085, -273267, -518617, -59593, 281320, -464393, -178778, + 644245, -133144, 472983, -1730335, -1255741, 963146, -89657, 965831, 858993, -318901, + -628139, -685047, 275415, -146566, -419833, 260919, 47782, -374199, -236760, 290984, + 265214, 787053, -651224, -176094, 17180, 660888, 416612, -126702, -108448, 6442, + 126165, -27380, 102005, -248034, -76773, 49929, -488553, -73014, 648003, -121333, + -194884, -1074, -114890, -187905, -294742, -73014, -45097, -70330, 118648, 252329, + -106837, -134755, -47245, -2147, 21475, 34360, 75162, -42950, -70867, 61203, + 77846, -46171, -20938, -53687, -38655, 94489, 42413, 57982, 104153, 108985, + 13959, -6442, 5369, -1611, -37581, 40265, -3221, 84289, 23085, 32212, + -22012, 22012, 22549, -6979, 537, 6442, + }, + { + -339302, -9844065, 1868311, 665720, -537945, -261456, 97174, 566399, 35433, 12885, + 554051, -746251, -249108, 263067, -634045, -576599, 1443646, -494995, -348966, 1078037, + 681289, -1094680, 468688, -18790, 91268, 611496, -1025960, -45634, 300111, -759672, + 96637, 811212, -561030, 74088, 605054, 544387, -340376, -339839, -530965, -155693, + 5369, 51540, 270046, 245887, 42950, 12348, -25770, -13422, -30065, -336081, + -5369, -110059, 19864, -53150, -241592, 104690, 90731, -144955, -344671, -35433, + -89657, 27917, -200790, -78920, -102542, 32212, 105227, 11811, -143345, -51540, + 96637, -145492, -66572, 15032, -28991, -75162, -59593, -13959, 86973, -8590, + -47245, 22012, 48855, -20401, -12348, -2684, 63888, 23085, 86973, -55835, + -20938, 31675, 24696, -2684, 8590, -36507, + }, + { + 2445447, -4502200, -7992398, -1730335, -2272038, -710817, 18790, -1435593, -1129040, 628139, + 185757, -415538, -1586990, -2165737, 1005022, 629213, 471910, -368293, 1486596, 399969, + 217433, -559420, -426276, -1090385, -507343, 289373, 425202, 57982, -309238, -39728, + 303332, 417149, -886374, -667331, -937914, -671089, -178241, -82141, -244813, 114354, + 47782, 299037, -265214, -362388, 34897, -804233, -179852, -33823, 420907, -64961, + 76236, 500901, -201863, -76773, -200253, -157303, 238908, 190052, 94489, 167504, + 15569, 137976, -139586, -3221, 235149, 83752, 34360, 20401, 127775, -115964, + -105227, 159988, 53150, -33286, -14496, -23622, 55298, -2684, 26307, 22012, + -58519, 92342, 44560, -48318, 60666, 12885, -41339, 17717, -39728, 36507, + -21475, -22549, 18254, 4295, -5906, 30065, + }, + { + -8229158, 5852967, 1449015, 471373, -1460289, 590558, -203474, 250182, -404264, -469225, + -318364, -417149, 1294396, -569620, -1473174, -551366, 179315, -3041374, -16106, 341987, + 415538, 185757, -60130, -125628, -482647, -430570, 407485, 816044, -721555, -120259, + 547071, -93416, 228707, -46171, 16643, 414464, 272730, -71404, 398895, 20938, + 239444, 348429, 420907, -203474, -9127, 321586, -33286, -110595, 180389, -423054, + 129386, -89121, -31675, -95563, -43487, -271657, -142808, -33286, 137976, -187368, + -88047, -56908, -84289, 37581, 31139, -85362, 16643, -32749, 68183, -2147, + -45097, -95563, 77309, 91268, 8590, 27380, -16643, 18254, 19864, 26307, + 38655, -33286, -2147, 56908, -16643, 55835, 20938, -3221, 31139, 38655, + 13959, -38118, -9664, 3758, -12348, -11274, + }, + { + -324270, 7033009, 592169, -12885, -140660, 5906, -163209, 78383, 259846, 227633, + -4832, 536334, 173409, -219580, -7587597, -1060320, 535260, 3545496, 2910377, 355409, + 406411, 1442572, 602369, -695785, 838592, -1724966, 509491, 714038, 238371, 104153, + 1551020, 467615, 183073, 493384, 104690, 116501, 466004, 200253, -264141, 62277, + -353261, 75162, -22012, -265214, 123480, 106300, -339839, 312459, 302795, 185757, + 26307, -210990, -102005, -180926, 40265, -151934, 61740, -57982, -56908, 38118, + 8053, 98247, -241055, 40802, -17717, 37044, -81604, -84826, 22549, 18254, + -96637, -47782, 75699, -30065, 10201, 133144, -77309, -52076, 39728, -84826, + -37581, -69256, -25233, 19864, -26844, 5906, -22012, 13422, 10737, -6442, + 4832, 19327, -34897, -28454, 28991, 28991, + }, + { + -14146549, -2924336, 5970005, -1063541, -434865, 135291, 481573, -499290, 777926, 765578, + -408559, -294205, -206695, -40265, -180926, 136365, 366683, -296353, -274341, -255014, + 251792, 99858, 4832, 463320, 495532, 183610, -121870, -348966, 197569, 13959, + 370978, -117038, 242129, 184147, 30065, 241592, 87510, 477278, -249108, 140660, + -27917, 155156, -456877, 109522, -74088, 20401, -193274, -380641, 280784, -22549, + 149787, 1074, 462246, 119722, -403727, -233002, 73014, 18254, 19327, -120259, + -136365, 1074, 27917, -125628, -93416, -61203, 126702, 66035, 75162, 55835, + -35970, 10737, -24696, 30602, 20938, 69256, 3221, -32212, 76773, -28454, + -76236, -73551, -17180, 19327, -4295, 5906, -27380, 18254, -67109, -10737, + 35970, -5369, 13422, -27380, 19864, 11811, + }, + { + 34897, 2876554, 1468879, -77846, -14496, 86973, 121333, -111669, -518617, -179315, + 24159, 40802, -1399623, -619549, -849330, 1441498, -1418950, -1086627, -1051193, 1609539, + 803696, 441308, 139586, -99321, -304943, 140123, 1402307, 59056, -524523, 494995, + 262530, -89121, -810675, -30602, -622233, -114354, -287226, 172336, -347892, 349503, + 244813, -201863, 360240, -129923, 121870, 112206, 202937, -92879, -232465, 62277, + 137439, 9664, 113280, -60130, -137439, 134755, 3758, -223875, -211527, 220117, + -71941, -63888, 64425, 25770, -68183, 33286, 159988, 154619, -180389, -76773, + 74088, 129386, 39192, 62277, 74088, 46708, -9664, -35433, -69793, -19327, + 11274, 15032, -49392, -26307, 26307, 12885, 8053, -11811, -30065, -49392, + -6442, -31675, 39728, -15569, 9127, 8590, + }, + { + 4593468, 31177704, 2406256, 3064996, -388158, 49392, -999654, 497142, 209917, -153008, + -190589, -692027, -476205, 770947, 1781338, 738734, -252866, -799938, 594316, 959925, + -39728, 28991, 491237, -386547, -315143, 258772, 113280, 4832, 239444, 227096, + 459562, 172872, 608812, 226023, -46708, 401043, 50466, 169114, 82141, 218506, + 289373, 368830, -89121, -465467, -67109, -34897, 119722, 132070, 166967, -106300, + -240518, -153008, 133144, 195421, -25233, 231928, 69793, 23622, -84826, 28991, + -147640, 115427, -2684, -107911, -151934, 537, 55298, 104690, -4832, 66572, + 11811, -66035, 119722, 100395, -37581, -62814, 64425, 93416, -24159, 82141, + 11811, 8590, 32749, 64425, -16106, 20938, 60130, -19327, -16643, -10201, + -1074, 73551, 5369, 1074, 6442, 1074, + }, + { + -95563, 2930242, -2324114, -71404, -35433, -78920, 103616, -5906, 260382, -4295, + 552440, -723702, -312996, -2321967, 1778117, -605054, -599685, -1174674, 1362578, -1317481, + -922881, 1454383, 540629, -110595, 1075889, 1249836, 777389, -816581, 170725, 685584, + -157840, 1106491, -201327, -2684, -282931, -956704, 294742, 172336, -65498, 170188, + 294742, 176631, 288300, 140123, 111132, 217970, -121333, -197569, 107374, -71404, + 79994, 184147, 79994, 168577, 9664, -68719, -84289, 29528, -100395, -40802, + 17717, -58519, -69793, 13959, 71404, 116501, 8053, 44560, -85899, -106837, + -107374, -159988, -52613, 180389, -9127, -57982, 32749, 110595, -59056, -19327, + -10737, -67646, 48855, -31675, 44560, -8590, 41876, -1611, -12348, -34897, + 37044, -27380, -4832, 27380, -3758, 27380, + }, + { + -4587562, 4080219, -431107, 3313567, 571768, 2532957, 1611, -1055488, 119722, 505732, + 332323, -419296, -602906, 38655, 1646583, -2739116, 1825361, 316754, -862752, 875100, + 211527, -289373, 325881, 660888, 367757, -51003, 185220, 474057, -48318, 219580, + 403190, 272194, 401043, 736587, 654983, -529355, 320512, -58519, -424128, 48855, + 102542, -296890, -152471, -337155, 82141, 319975, -68719, -158914, 232465, -10201, + 24696, 68183, 197032, -130997, -58519, 88047, -89657, -96100, -18790, -104690, + -3221, 86436, -89657, 11274, -149250, -3758, 25770, 40802, 93416, 70867, + 5906, 28454, -8053, -60130, -48855, -88584, 62277, -63351, 41339, 11274, + -60130, 54224, 52613, 24696, 81604, 37044, 20938, -8053, 25233, -15032, + 17717, -51003, -2684, 20401, 14496, -9127, + }, + { + 196495, -522912, 947577, 1172526, 432181, -125628, -1321239, -215285, -905164, 625455, + 432718, -529892, -996969, 366146, -132607, -1435593, -1457068, -2383170, 2357937, -2603287, + 466541, 205085, -127238, 45634, 561030, -935229, -516470, -490700, -54224, -477278, + -293132, 325881, -668941, 27917, 165356, -595927, -347892, -118648, -162672, -13959, + 83215, 288300, -178241, -191126, -110059, -181999, -155156, 120259, -55298, 492848, + -296353, -166967, -246961, -180926, 137976, -74088, -100932, 69793, -67646, 113817, + 104153, -46708, -15032, 27380, 99321, -100395, 69256, 64961, -53150, -37044, + 15032, -10201, -72478, -12885, 18254, -25233, -50466, -63351, 99321, -41339, + -55298, 70330, 1074, -78383, 8590, 41876, -39192, 6979, -30065, 6442, + 34360, -5906, -1611, -15032, 16106, -22549, + }, + { + 1226213, -7696045, -3108483, -3291019, 309238, -570694, 1278290, 574989, 25770, -10201, + -2040110, -229781, 17717, -580357, 473520, 1253057, 301185, 149250, 259846, -531502, + 506269, 519691, 15032, -64961, 81068, -694711, -378494, -500364, -374199, -420370, + 811212, -119722, -181462, 177704, -114354, -599148, -248571, 146029, 492848, -170188, + 466541, -177704, -425739, -10201, 45097, 13959, -100395, -205085, -71404, -153545, + 259846, 113280, -108448, -163746, -34897, -6979, -5369, 23085, -298500, -9664, + 38655, -98247, 3758, 119722, -54761, 46708, -6442, -46708, -12348, 137439, + -53150, -4832, 15569, -42950, 10737, -34897, -9127, 12348, -26307, -17180, + 23622, 95563, -4295, -90731, 17717, -83752, 73551, 18254, 8590, 59056, + 2147, 26844, 27380, -13959, 9127, -11274, + }, + { + -74088, -3474629, 557272, 1138166, -160524, 78383, -115964, 78383, -102005, 295816, + -108448, 537408, 2619930, -8672613, -2776160, -596464, -3041374, -1264331, 303332, 949188, + -2685965, -629213, -947577, -1338419, 70330, 842350, -381715, -206158, 606664, -141197, + -237834, -35970, 184147, -41876, 634581, -146566, -167504, 473520, 232465, -62277, + 236223, 249645, -217970, -79994, -15032, -200790, -388695, -128849, 211527, 36507, + 350040, 140660, -76773, -111669, 247497, -170725, -158377, -97174, -47782, 31675, + 0, 219043, -226023, -27917, -67646, 20401, -73551, -91268, -14496, 74625, + -8590, 16106, 26307, -30602, 168041, 17717, 29528, 84826, -54761, -72478, + -17717, 12885, -29528, -45634, -13959, -14496, 53687, -35433, -75162, 77846, + 12348, 49392, 43487, -29528, 11274, 8590, + }, + { + 3691525, -8641474, 525597, 1921998, -88584, -857383, 795106, 1027571, 153008, -380641, + -395137, 928787, 388695, -2401961, -2532420, -268435, -1149441, -253403, 1202591, 151934, + -223875, 676457, 706522, 803159, 269509, -570157, -761820, 689342, 113280, -555125, + -144418, -492311, -143881, -397821, -22012, 93416, 196495, -187905, -63888, -1074, + 292595, 85899, 425202, -61203, -100395, -4832, 71404, 395137, 189515, -196495, + -258772, 113280, 195958, -97711, -34360, 171799, -107911, -28991, -236760, 260382, + -34360, 21475, 47782, -20938, -84289, 48855, 83215, 60666, 93952, -38655, + 34360, -83752, 5906, -30065, -9664, -17717, 21475, -58519, -81604, -42413, + 31139, -54761, -64425, 3758, -8590, -67109, 52076, 66572, -38655, 10201, + -2147, -40802, -4832, 8053, 35433, -10737, + }, + { + -447750, -2280628, -329102, 572304, 8590, -193810, -154082, 49929, 930934, -471910, + 770947, 194347, -179852, -3228742, 4725001, 1737314, -603443, 1595580, 28454, 1217623, + 486405, 433792, 1261110, 700617, 692564, -932008, -484258, -417149, 280784, 463320, + -339302, -193810, -379031, -802622, 254477, 433792, 153008, -504122, -89657, 16106, + 390842, 147103, 510027, -260382, 184147, -159988, 347355, 40802, 16643, -187368, + 193810, 89121, 124017, -372588, -207769, -68183, 17180, 76236, 78383, 286689, + -83215, -57445, 12348, -64961, -41876, -137976, -179852, 104153, -22549, -68183, + -132070, 72478, 67109, -51540, 15569, -47245, 51540, 48855, 5369, -61203, + -97711, -63888, -17180, 17717, -26844, 49929, 6979, -49929, 3221, 33286, + -11274, -24159, 18254, 46708, -4832, -22012, + }, + }, + { + { + -7271917, 33774548, -8458938, -1249299, 1243393, -663036, -159988, 990527, -67646, -595927, + 665183, -310311, 369367, 328028, 207232, 1326608, 121333, 1265405, -1289027, -370441, + 540629, -68183, 586263, 318901, -459025, 388695, -105227, 318364, 11274, 150324, + -49929, 625992, -460635, -73014, 196495, 392990, 246961, -475131, -164283, -74088, + 139586, 230854, 3758, -664109, -310311, 261456, 34897, -264677, 493384, 183610, + 65498, -15032, -45634, 112743, 59593, 48855, -41876, -84826, -164283, 99858, + 69793, -64425, -38118, -181462, -26844, 28454, 120796, 60130, -128849, -44023, + 537, -71404, 1611, 61203, -16106, -55298, -92879, 58519, -75162, 69256, + 4832, 112206, 33286, -39728, -13422, -58519, 42413, 6442, 2684, 13422, + -22549, -13959, 32212, -26307, -2147, 6979, + }, + { + 411243, -14034343, 320512, 1056562, 142808, 206158, 737661, -86973, 65498, 241592, + 1394254, -320512, 90194, 832687, 741956, -495532, 401043, -346819, -493921, -292595, + 748398, -1181116, -150324, 569083, 1194538, 891743, -1300838, 1067299, 392453, -536334, + 162135, 129923, -158914, 223875, 292595, 742493, 107374, 223338, 158914, -182536, + -284542, 329639, 536871, 259309, -497679, -99858, 43487, 8053, 41876, 150324, + 331249, -213138, 13959, 149250, 193810, -105764, 22012, -47245, -151398, 45634, + -47245, 14496, -76236, 25770, -61203, 193274, 88047, 171799, 6442, 22012, + 82141, 3758, -63888, -78383, -13422, 83752, -51003, -43487, 22549, -47245, + 64425, -19327, -66035, -18254, -28454, -11811, 57982, 12885, -3758, 40265, + -53687, -37581, 13959, 38655, 33823, -38655, + }, + { + -2348273, 15447924, 8396661, -392453, 1043140, -121870, 375810, -387621, -85899, 324270, + -412317, -176631, 609349, -1184337, 1821603, 857383, 932008, -195421, 2697240, -181462, + -361314, -408022, 127775, -24159, -41876, -245887, 271120, 665720, 39192, -173946, + 485331, 1014686, 142808, 334471, -432718, -856309, 221191, 41339, -33286, 319438, + 193274, 268435, -119722, 25233, 103616, -281320, -167504, -178241, 238908, -3221, + -347355, 310311, -99321, -47782, 172872, 12885, 16643, -19327, 36507, 165893, + -117038, 189515, -150324, 156766, 13422, 70330, 21475, -145492, -21475, 75699, + 30602, -12885, 28991, 40265, -18790, 1074, -10201, -71404, 64961, 32749, + -3221, 48318, 41876, -61203, -26844, 50466, 20401, 72478, -85899, 47782, + 30065, -28991, -19864, -17717, -27917, -9127, + }, + { + 3809636, 12603582, -8112657, 468151, -322659, 294205, -242666, 67109, -201863, -217970, + -60130, -150861, 1300301, -460098, -565862, -557272, 554051, -1906966, 69793, -66035, + 314069, -236760, -104153, 185220, 86436, 132070, -177167, 802622, -789737, 238371, + 938987, -71941, 392990, -16106, -328028, 197032, -358093, -27380, 147640, 17717, + 444529, 118112, 156229, 19327, 4295, 200253, -80531, -214212, 380105, -358093, + 118112, 64425, 6442, 239981, 78920, -172336, 85899, 48318, 162135, -191126, + -37044, 100395, 156766, -24696, 74088, -38655, -27917, 60130, -2684, 27917, + 16106, -20938, -136902, -60130, -35970, 35433, 19864, 38118, 0, -537, + 72478, 31675, 58519, -20401, -35433, 15032, -55298, 58519, -19327, 0, + 25233, 2147, -16643, -15032, 34897, 15569, + }, + { + 459562, 6847252, -828929, -342524, 177167, -8590, -248571, 183610, 23085, -205085, + -219580, 233002, -485868, 1568200, -4687957, -1133871, -942745, -238371, 2911988, -337692, + -743566, 56908, 1163936, 166430, -348966, -2465848, -952946, -129386, 306553, 651761, + 1173063, -211527, -165356, 224412, -392453, -582505, -180926, 220654, -545998, 90731, + 110059, 10201, 252866, 16643, 110595, 26307, -297963, 117038, 157303, -68719, + 124554, -68183, -190589, 186294, 180389, -271657, -32212, 129386, -111132, -165893, + 32749, 40265, -315680, 10737, -71404, 64961, -11811, 15569, 4832, -3758, + 44023, -32212, 51003, 11811, -42413, -46171, -43487, -14496, 32749, 37581, + 8053, 56371, -16106, -69793, 24696, -56908, 13959, 31675, -42950, -22012, + -27917, 19864, 3221, -23085, -37581, 18790, + }, + { + 7437273, 10664941, -7522635, 484258, 165356, -159451, -583042, -45097, -10737, -737124, + 658204, 196495, -328565, 245887, -89657, 81068, 462246, -437550, 240518, -264141, + 12885, 213675, 104690, 290447, -223338, 18254, -210453, -645856, -646393, -302258, + 785979, 144955, 7516, -47245, 352724, 59593, -721018, 110059, -341450, 177704, + -80531, 506269, -462783, -145492, -9664, 44023, 69793, -201327, 65498, -54224, + 467615, -226023, 164819, 85362, 97174, -253940, 197569, 105227, 73014, -114354, + -173409, -41876, 104690, 63351, 24159, -115427, 60130, 71404, -59593, -93952, + -70867, 41339, 75699, -22549, -6979, -74625, -18254, -9664, 47782, -30065, + -32749, 2684, 4832, -105227, -32212, 22012, 27380, -19864, 42950, -55835, + 20938, 12348, 14496, 15569, -5906, 10201, + }, + { + -283468, -787590, 905701, -232465, -69256, 35433, -215285, -184684, -30065, -45097, + -11811, 191663, -237834, 1632625, -2080912, -1705102, -1489817, 130997, -485331, 2204392, + -62277, -412854, -242666, -484794, -657667, -325881, 609885, 640487, -1450088, 839129, + 900869, 786516, 70330, -267362, -211527, 267362, -615791, -55835, -329102, 70867, + 421444, -110059, 63351, -126702, -323196, -216896, 128312, -73551, -215285, 141734, + 36507, -129923, 77846, 188442, 122407, 87510, -44560, 209380, -46171, 179852, + -34360, -63888, -141197, -68719, -66572, -32212, 18790, 168577, -25233, 5906, + -134755, 17180, 14496, -22012, -44560, 69256, 22549, 17180, 9127, 53687, + -35433, 33286, -43487, 43487, 3221, -12885, 61203, -54224, -22012, -7516, + -22012, -49929, -3221, 8053, -12885, -25233, + }, + { + -2457795, 27229556, 1571421, 2682744, -382789, -60130, -748935, -77309, -355945, -193810, + 368830, 395674, -928787, -879395, 59593, -716186, -854699, -398895, -563178, 272730, + 467078, -187905, -55835, -45634, -24159, -34360, 51540, -159451, 496606, 36507, + 38118, -99321, 33286, 261993, -19864, 363998, 275415, -134218, -382252, 171799, + 37581, 60130, -95563, 174483, -346282, -27380, 146029, -34360, -178241, -60666, + -26307, 328028, 268435, -82141, -83752, 141734, 126702, 76236, 159451, 182536, + -175557, -18790, 50466, 163746, 52076, -15569, -26307, 27380, 90194, 4295, + -11274, -10737, 13959, 52613, 103079, -1074, -135828, 127775, 4832, -3758, + 15032, 38118, -9664, 1074, -31675, 16643, -20938, 35433, 8590, 32749, + -9127, 0, -28454, -12885, 26844, -30602, + }, + { + -649077, 2926483, 1521492, 50466, 265214, -126702, -262530, -652298, 250182, -8053, + 355945, -484258, 335007, -1925219, 2929168, 905701, 1646583, 143345, 1633161, -666257, + 167504, 151934, -96100, -773094, 1001264, 954557, -942745, 256087, -590558, 68183, + 759136, 801011, -661962, -70867, -380641, -395137, 237834, -437013, 80531, -106837, + -209380, 258772, -98247, -288300, 13959, 272194, -207769, -138513, 198642, 63888, + -53687, -79994, -232465, -20401, -52613, -1074, -165893, 162135, -36507, -55298, + 63351, 34360, -84826, -80531, -155156, -70867, -25233, -23085, -17717, -6979, + 43487, -12885, -103616, -8053, 36507, 2147, 11811, 16106, -45097, -82678, + 53687, -27380, -72478, -78383, 4295, -24696, 15569, 44023, 17180, -20401, + 6979, -3758, -16643, -10201, -1074, -537, + }, + { + 3943854, 10637023, -12178917, -3655017, -780073, 715649, -3334505, 45634, -173946, 25233, + 571231, 69256, 165893, 489089, 525597, -1846836, 844498, -295279, -254477, 214212, + -557809, -213675, -197569, -38118, -19327, 61740, 421981, 114354, -241592, -34897, + -180926, -139586, -132607, -178241, 520765, -162672, 152471, -43487, 142808, 30065, + 205622, -344134, -20938, -128849, -110595, 341450, 211527, -233539, -219580, -233002, + 261993, -207232, 124554, 365072, -168577, -73551, 58519, 122943, 33823, 135828, + -216896, 114354, -12348, 30602, -59593, -111132, 15569, 35433, -38655, 22549, + 1074, 55835, -42950, 49392, 16643, -2684, 64961, 55835, -25770, 61740, + -83752, -19864, -5906, 32749, -16643, 9664, 75699, 1611, 1074, 40802, + 1611, 37581, -40265, -12348, -31139, 25233, + }, + { + -77846, 1359894, -151934, -432718, 235149, 191663, -171262, 321586, -979789, -60666, + 15032, 898722, -121870, 321049, 137439, 614180, 27380, -2237678, 1926830, -190052, + -136365, -964757, -350040, -43487, 556198, -1063004, 357556, -699543, -104153, -60130, + -142808, 329639, -392453, 176631, -285615, 258772, -8053, 294205, 27917, -1074, + -76236, -183073, -46171, 93416, -98784, -15032, 100932, 60130, 83752, 447213, + -307090, 88047, -87510, -190589, 115427, -21475, -55835, 106837, 20401, 50466, + 44560, 116501, -9127, -60130, 6442, 6442, -31139, 91268, 111132, -46171, + 31675, -69793, -108448, 8590, 104690, -4295, 9127, -55835, -53150, 22549, + -26307, 18254, 103616, -28454, -23622, -20938, -18790, -22549, 28991, -63351, + 3758, -12348, -30065, 3758, 19327, 41876, + }, + { + -118648, -7268696, 111669, -1060320, 99858, 1409823, 492311, -225486, 79994, -51003, + -426276, -726923, 595927, 398358, -687195, 263604, -381178, 565325, 92342, 34360, + -443455, -220117, -76236, 195958, 200253, 69256, -501437, -172336, -476205, 28991, + 343597, -200790, -97711, -304943, 120259, -423054, -505732, -88584, 220117, -54761, + 166967, -211527, -413927, 302795, 198642, 158914, -90731, -197032, 251256, -105227, + 2147, -50466, -198105, 18254, -97711, 39728, -54761, 73551, -19864, -141197, + 63351, -102542, -64425, 75699, 64961, -10201, -31139, 6442, -105227, 5906, + 19864, -79994, 26844, 0, 22549, 32212, 44560, 14496, 3758, -14496, + -11274, 8053, 55835, 17717, 45634, 51540, 25770, 2684, 6979, -11811, + 17180, -12348, 62814, 31139, -8053, -2147, + }, + { + 54761, -4461398, -159988, 275415, 207769, -165356, 494458, -439160, -428960, 299574, + -221191, 861141, 1459215, -7247758, -2325188, 1292785, -413927, -125628, 1024887, 880468, + 998580, 114890, 1155346, 728534, 786516, 246424, -476205, -607738, 633508, 240518, + 1051730, -189515, -84289, -328565, 676994, 187905, -529355, 159451, -361851, 398895, + 289910, 85899, 69793, -14496, -41876, 188442, -301185, -16643, 78920, -311922, + 175020, -6442, 216896, -82678, 108448, -13422, 228707, -182536, 31139, 71404, + -103079, -41876, 20401, 122943, 36507, -63888, 67646, -38655, -67109, 80531, + -71404, 32212, 25233, -91268, 21475, -12885, 53687, 49929, -69793, -4295, + 41339, -18254, -24696, -4295, -9664, 3221, -30602, 51003, -57445, 31675, + -4832, -61203, 45097, 42950, -49929, 34897, + }, + { + -880468, -11464341, 375273, -3198677, -617938, 161061, 449898, 397284, -203474, 222265, + 86436, 1345399, -230318, 785442, 2605972, -265214, -2400887, -93416, 12348, -292058, + -475668, 3758, 916976, -16106, 1051730, 267899, -357019, 1066226, 71941, 182536, + -445603, -392453, 57445, -166430, -718870, -293132, 417149, -155693, 6979, -233002, + 736050, -146029, 321586, -23622, 9664, 166430, -163746, -188979, 37044, -10201, + 101469, -75699, 179315, 149787, 23622, -5369, -357556, -58519, -64961, 143881, + -199716, -63888, -21475, -47245, -197569, -537, -213138, -20401, 48318, -49929, + -13959, 22012, -35433, 46708, -19864, -79457, -93952, 53150, -8053, -80531, + 15032, 28454, 1611, -40802, -7516, 12348, -57982, 62814, 31139, -6442, + -22012, 25770, -38118, -12885, 1074, 22549, + }, + { + 554588, -741956, -649077, 245350, -152471, -99858, -44023, -1238561, 40265, -856846, + 284542, 997506, -410169, -2774012, 11453604, 1282048, -2213519, -534187, -180389, 386010, + -1578937, -1176821, 513249, -1016834, -486405, -603443, 668404, 256087, 561030, 388695, + -3758, 788663, -150861, -487479, 311385, -439697, 297427, 18790, -199179, 61203, + 166430, 455803, 745714, -392453, -268435, 44560, 175557, -209917, 36507, -113817, + 33823, 66035, 215822, -118112, 60666, 37581, 84289, 142271, 26844, 317291, + 168577, 31675, -118648, -44560, 106837, 24696, -38118, -120796, 162672, 90194, + 16106, -24159, 152471, 63351, -6442, 68183, -81068, -65498, 45097, -8590, + -22549, -54761, 9127, -111669, 15569, 24159, 13959, 13422, 8053, -36507, + -8053, -9127, -35433, 44560, 26844, -25770, + }, + }, + { + { + 4486630, 12626667, -9462350, -610422, 223875, -348429, -15569, 646393, -241055, -619549, + 77309, 34360, 156766, 826244, 1034550, 792421, 224412, 434865, -526670, -657667, + 79994, 510564, 540092, -21475, 12885, 589484, -332860, 366683, -156229, -36507, + -189515, 154082, -101469, 232465, -154619, 340913, -240518, -141197, -579284, 277562, + 20401, 12885, 71404, -454193, -296890, -30065, 129386, -78920, 238908, 120796, + 99321, 40802, 56371, 122943, 170188, 81068, -62814, 78920, -105227, -87510, + 81604, 61740, 26307, -163209, -67109, 73014, 32749, 537, -27917, -27380, + -42950, -28454, -36507, 40265, 45097, -19864, -82678, 11274, -57445, -31675, + -12885, 34897, 13959, -24696, 14496, -53687, -11811, -25233, -9127, -28991, + 13959, -25770, 9664, 3758, 1074, 5369, + }, + { + -511638, -10001905, -389768, -94489, 219043, -126702, 1073742, -303869, 40265, 273804, + 593779, 489089, 28991, 359704, 936840, -572841, 1004486, 386010, 373125, -443455, + -359167, -900333, 44560, 1046361, 754304, 119722, -689342, 1010928, 510027, -106837, + 244813, -330176, 204011, -117575, 239444, 191663, 470836, 172336, 538482, -238908, + -78920, 172872, 326954, -46171, -311922, -56371, 50466, 81068, -34897, 238371, + 167504, -97174, -186831, 85362, 270046, -57982, -40802, 6442, 114890, -66035, + -130460, -93416, 13959, 144418, -69793, 164283, 17717, 2147, 112206, 22012, + -1611, 87510, 20401, -74625, -12348, 46708, 33823, -6442, -49392, -32212, + 69793, -2684, -52613, -36507, -32212, -22549, -24696, 11811, -39192, 15569, + -9127, -26844, -28991, 12885, 19327, -11811, + }, + { + 2681133, 26009248, -4133906, -420370, -250719, -76236, 119722, -163746, 407485, -97711, + -439160, -255551, 833224, -296890, 1058710, 569083, 394600, 423054, 1596654, 534187, + 126702, -129923, -208306, 399969, -573378, -292595, 140660, 479426, 20401, -360240, + 930934, 834297, 223875, 46708, -51003, -346819, 0, -270046, 243203, 395674, + 340376, -40802, -45097, 129923, -231928, -102542, -278636, -22549, -110059, 161061, + -195421, -102005, 15569, -18790, 8590, 63888, -25233, 19864, 71404, 113817, + -39192, 40802, -180926, 222265, 3221, -68183, -15032, -85899, -78383, 93416, + 79994, -52076, -30065, 41339, 39728, 75699, -52076, -80531, 18254, 47782, + 75162, -3758, 31675, 29528, -51003, 537, 27917, 46708, -15569, 6979, + 24159, 9127, -21475, -25770, -2147, -21475, + }, + { + 469225, 6001680, 693100, -132607, -166430, -112743, -59593, -361314, -148176, -125091, + 610959, 245887, 302795, -181999, 767725, -600222, -368293, -513249, -153008, -166430, + 37044, -55298, -308164, 156229, 142271, 437013, -210453, 366146, -310848, 166967, + 57982, 245887, 159988, -176094, 267899, -421981, -36507, 112206, -91805, 127775, + 421981, 96637, -59593, 155693, 253940, -66572, -128849, 38655, 33286, -20938, + -180389, 165356, 69793, 121333, 42950, 12348, 20938, 148176, -51540, 6979, + -41339, 123480, 54761, -29528, -32212, 11274, -29528, 60130, -9664, -17717, + 52076, 100932, -98784, -81068, 15569, 30065, -5906, 7516, 18254, -9664, + -12348, 22012, 11274, -30065, -2147, 10201, -47245, 33823, 15569, -15569, + 11274, 18254, -24696, -16643, 19327, 20938, + }, + { + -359167, 5031018, 1789391, -492311, 142808, -27917, -153545, 168041, -129386, -178241, + -216359, 46171, -282931, 1363115, -3849901, -707596, -861141, -1815161, -935766, 796180, + -99321, -241055, 680215, 282931, -1002875, -1326071, 81604, -370978, 229781, 1078574, + 194884, -303332, -529892, 278636, -584652, -641024, -449361, 114354, -82141, -294742, + 159988, -278099, 115427, 217970, 67109, -39728, 77309, -82678, 111669, -174483, + 54761, 111669, -180926, 250182, 12348, -20938, -157840, 86973, -8053, -184147, + -3221, -39728, -126702, -142808, -121333, 5906, 15569, 73551, 27380, -89121, + 91805, 78383, -24696, 11274, -16643, -96637, -22549, -56371, -53687, -1074, + -537, 74625, 43487, -70330, 16643, -34360, 8590, 35433, -25770, -47782, + -34897, 5369, 6442, 4832, -46171, -11274, + }, + { + -878858, 8626979, 1539746, 1165547, 423054, -23622, -748398, 321049, -57982, -1062468, + 224412, 392990, 247497, -256087, 853625, 193810, -351650, -621697, 129386, -141197, + -398895, -132070, 18790, 588947, -54761, -86436, -619549, 3758, -467615, -451508, + 91805, 584652, -173946, -35970, 469225, -149787, -906775, 132607, -17717, 27917, + -307627, 85362, -10737, -86436, 24696, 74088, 57982, 174483, -62277, -46708, + 289910, 15032, -63351, 9127, 246424, -79994, -107374, 17717, -18790, -22549, + 1074, -117038, 27917, 106837, 57445, -71941, -28454, 48855, -24159, -56908, + -26307, 4832, 78383, -2147, -4832, -75699, -91268, 8053, 11274, 8590, + 16106, 40802, 27380, -59056, -77846, -19864, 21475, -56371, 38655, 1611, + -7516, 9127, 6979, 29528, 9127, -4832, + }, + { + -163209, -2688650, 787053, 176094, 45097, -45097, -224949, -118648, -60666, 81068, + 170188, -81604, 139586, 305480, -559420, -1072668, -61740, -344671, 426276, 1489817, + -134755, -306553, -1515050, 462783, -170725, -101469, 236223, -438087, -454193, 454193, + 799401, 515933, 345208, -385473, -645319, 267362, -249645, -370441, -206695, -129923, + 256087, 60130, 121333, -136902, -540092, -234613, -184147, -92342, 70330, 45634, + -15569, -26307, -81604, 163209, 207769, 12885, -62814, 251792, 18790, 60130, + 19864, -15569, -75699, -111132, -71404, 30602, -89121, 17180, 92879, 99321, + -132070, -41339, 20938, -53150, -118112, -25233, 22549, -17717, -12348, 60666, + 0, -20938, -27917, 49392, 10737, -15032, 36507, -9127, 15032, 28991, + 27380, 15032, -15032, -15032, 0, -27380, + }, + { + 1059783, 30806726, -3474092, 300111, 403727, -223338, -274878, -346819, -316754, 20401, + -31139, 355409, 20938, -604517, -1440962, -584116, -284005, 338766, -415538, -460098, + 522375, 83215, -614180, 49929, 224949, -105227, -25770, -168577, 466004, -88047, + 32749, 174483, 30602, -47245, 323196, 3758, 83752, -86436, -697932, 375273, + -123480, -22012, -181999, 484258, -204548, 235686, -280247, 153008, -38655, -180389, + -204548, 484258, 394063, -23622, -19327, -74625, 48855, 55298, 182536, 174483, + 16643, -70867, -46171, 192737, 132607, 42950, -68183, 29528, 95563, -19864, + -5906, 1611, -25770, -57445, 41876, 78920, -133681, -24159, 16643, -10737, + -9127, 42413, 26307, -32749, -9127, 17717, -56371, 28991, -537, 26307, + -9127, -21475, -24159, -36507, 4832, -3758, + }, + { + 59593, -144955, 1149441, 86436, 0, 34897, -488553, -233002, -15569, 49929, + 242129, -2684, -11274, 299037, 638876, 500901, 4199941, 428960, 1422708, -328028, + -666794, 509491, -13959, -391916, -133681, 507880, -660888, -403190, -153545, 194347, + 996969, 282931, -620086, -442919, 54224, -196495, -396748, -238371, 64961, 39192, + -651761, 112206, -37581, -246961, -289910, -89657, -65498, 9664, 137976, 54761, + -92879, -196495, -154619, -111669, 53150, 11811, -108448, -13959, -52613, -68719, + 38655, 70867, -4295, 47782, -125628, -77309, 132607, -64425, 63351, -30065, + 73551, 59593, -16643, -65498, -2684, 5369, 60130, -45097, -20401, -70867, + -3221, 50466, -42950, -44560, -54761, 3758, -51540, -9664, 37581, 14496, + -35433, -2684, -6979, -26844, 9127, -16106, + }, + { + -2909840, 9758703, -1966558, -4818954, 38118, -2003065, -2139968, 910533, -441308, -311922, + 132607, 194347, 30065, 624918, 153545, -40802, -23622, -212064, -415001, 104690, + -464393, -307090, -286689, 88584, -273804, 81604, 408022, -201863, -24696, -3221, + -402653, -251256, -170188, -499290, 270583, 419833, -63888, -149787, 282394, 6979, + -77846, -233002, -57445, 96637, -10201, -30602, 146029, -35970, -321586, -291521, + 112743, -165356, -169114, 208306, 56908, 24696, 12348, 69256, 69793, 186294, + -110059, 80531, -5906, -55835, 13422, -82678, -11274, 5906, -37581, -28454, + 38655, 4832, -47245, 50466, 25770, 40265, -9664, 48855, 18790, 37581, + 4832, -18254, -45634, 25233, -65498, -41339, 13422, 7516, -25770, 18254, + -18254, 48318, -3221, -34360, -33823, 3221, + }, + { + 171799, 3932580, -1699733, -913217, -277562, -179315, -825707, 507343, -86436, -535260, + -512175, 741419, 104690, -363998, 438624, 891206, -598611, 184147, -852014, 1598265, + -33823, -693100, -93952, -578210, -63351, -364535, -48855, -382252, 5906, 333397, + -38655, 38655, 40802, 60666, -380105, 530965, 185757, 359704, -147640, -4295, + -41339, 33823, -75162, 61203, -95563, -61740, 80531, -2147, 197569, -99858, + -121333, 83752, 82678, -88584, 133144, 4832, -11274, -27380, 39728, 49392, + -31139, 77846, 34360, -36507, -70330, 41876, -25233, -7516, 78383, -8053, + 43487, -46171, -63888, -12885, 56371, 41876, 38655, 36507, -62277, -13422, + 4295, 5369, 59593, 39192, 1611, -21475, 26307, 537, 37044, -15569, + -15569, 6979, -18254, 12885, -11274, 17717, + }, + { + -268435, -8311836, 978179, 1015760, -825171, 1750199, 1179505, -244813, 42413, -392453, + 172872, -48318, 107374, 610422, -435939, 87510, -328565, 306016, -45097, 84289, + -296353, -601295, 281857, -259309, 107911, 371515, -400506, -443992, -194884, -45634, + 46171, 8590, 248571, -463320, -108985, 181999, -133144, 53150, 0, 13422, + -111132, -110059, -74625, 164283, 100932, -28991, 98784, -44560, 224949, 3221, + -242129, -164283, -35970, -29528, 2684, 54224, -76773, 75162, 92342, -158914, + 12885, 0, -6979, -55298, 78920, -5906, 8053, -12885, -2684, -104690, + 8590, -43487, -1074, -12885, -10201, 26844, 44560, 47245, 50466, -5906, + -22549, -50466, 9127, 55298, 10201, 71404, 15569, 10201, 7516, -51540, + -2147, -34897, 19327, 31139, 9127, -9127, + }, + { + -7516, -3833258, -685584, 47782, 526134, -31675, 251256, -38655, -307627, -370441, + 68719, 252329, -1734093, -893353, -2418604, -28991, 1383516, -91805, 567473, 430570, + 1964948, 474594, 395137, 609349, 1341104, -26844, -448287, -570157, 1076963, -62814, + 838592, -177704, -425202, 421981, 428960, 330176, -436476, 537, -189515, 145492, + 320512, -279173, 219043, -47782, 130460, 192737, -186294, -136365, -86973, 43487, + -113280, -108985, 182536, 2147, -95563, -15569, 183610, -79994, 10737, 52076, + 67646, -176631, 11811, 71404, 84289, 17180, 29528, 23085, -34897, -9664, + -35970, 45097, 13959, -66572, -74088, -55835, -537, 12885, -4295, 12348, + 43487, 10201, 8590, 40265, -1074, 16106, -49392, 26844, 17180, -23622, + 9664, -45097, -24159, 33823, -30065, -10737, + }, + { + -1085553, -7220914, -1210644, -4057134, 455803, 1141924, -236760, -111669, -483721, 255551, + -29528, 834297, -298500, 792958, 2843268, 264141, -1220308, -197569, -374736, -190052, + 22549, -331786, 438087, 460635, 501437, 666257, 75162, 289910, -202937, 240518, + -370978, 295279, -241055, -219043, -516470, -141197, 263604, -106300, 56908, -237834, + 425202, 70330, 146029, 94489, 143881, 176094, 13422, -338766, 183073, 94489, + 25233, 89121, -5369, 118648, 27380, 39728, -134755, -197032, 102542, 33286, + -134218, 27380, -77309, 11811, -75162, -537, -155156, -68719, -32212, 20938, + -48318, 39728, -35433, -23622, -6442, -21475, -93416, 37581, 41339, 1074, + -9127, 17717, 80531, -2147, -10201, 64425, -26307, -32749, 18254, -1074, + -14496, 48855, -7516, 1611, -10737, 15569, + }, + { + -351650, -455267, 1176821, 23085, -284005, -88047, 100395, -877247, -650688, -420907, + 147103, 685584, 357556, 3613141, -461709, 745714, 485331, -1184337, 479426, -946503, + -416612, -401043, -44023, -1923609, -498216, 68719, 777926, 466004, -410169, 525060, + 731755, 318364, -226023, 46171, 288300, -781147, 210990, 370441, -316754, 249645, + 62814, 216359, 232465, -215285, -112743, 45097, -54224, 18790, -84826, -119722, + 40802, 106300, -26307, -63351, 156766, 46708, 63888, 27380, 63351, 75699, + 60130, 83215, -205085, -45634, 32749, 78920, 63888, -79994, 75162, 44023, + 114890, -46708, 1074, 59056, -60130, 63888, -54224, -109522, -537, 4832, + 35970, 8053, 59593, -89121, 1611, 0, -6979, 40265, 14496, -26844, + 16106, 5369, -8590, -8590, 6979, 8053, + }, + }, + { + { + -2527052, 31641560, 12085501, 359167, -410169, -59056, 336618, -136365, -464393, -28454, + -280784, -121870, 386010, 465467, 469225, -465467, -288837, 38655, 225486, -1018444, + -92879, 48318, 328028, 59593, 172336, 278099, -139050, 507880, 302795, 118112, + -359704, -74625, -503048, 164283, -235149, 398895, -367220, 207232, -609349, -4832, + -66572, -27380, 96100, -110059, 27380, -25770, -30602, 3221, 177167, 1074, + -6442, -49392, -16106, 69793, 42950, 30602, -22012, 111132, 18254, 52613, + 6979, 48855, 51003, 81068, 2147, 106300, 54224, -120259, 25233, 1074, + 7516, 54761, -12885, -43487, 11811, 101469, 5906, -97174, 55835, -33286, + -28991, -50466, -11811, -1074, -4295, 55835, -61740, 12348, 1074, -28991, + -19864, -3221, -14496, 15032, 11811, 9664, + }, + { + 93952, -4209605, 2421288, 22549, -680215, -455267, 472983, -278636, -350040, -333934, + -712965, -25770, -472983, -115964, -484258, -1275605, 1469953, -521839, -839666, 179852, + -317291, -477815, 192200, 434865, 458488, 163746, 100932, 367757, 85899, 460098, + 675921, -173946, -157303, -600759, 260919, -368830, 231391, -14496, 234076, -51540, + 272194, 6979, 220117, -146029, 134218, 15032, 19327, -71404, -64961, 56908, + -7516, 112206, -189515, -45097, -56371, 137439, 61740, 0, 39192, 31675, + -34897, -31139, -50466, 93952, -71404, -10737, 47782, -108448, 17717, -47245, + 10201, -20938, 35970, 45097, 15569, -81068, 10737, 25770, 34897, -6979, + -20401, 39728, 34897, -19864, 13422, -11274, -37581, 12348, 24696, -66035, + 25233, 20938, -8053, -30065, -31675, -6979, + }, + { + -2240899, 21569326, -501974, 1886028, -126165, 246961, 170188, -190052, 207769, 73551, + -44023, -401579, -110595, -259846, -96637, -251792, -758599, -266825, -218506, -4295, + 92879, -17717, -601295, 365072, -259309, -322123, -150324, -6979, 56371, -161598, + 497679, 549219, -177704, -315680, -83215, 357556, 289910, -179852, -4832, 121870, + 159988, -56908, 143345, 20938, -98784, -105227, -253940, 12885, -136902, 93952, + 64425, -152471, -160524, 56371, -144418, -35433, 12348, -52076, 9664, 68183, + 9664, -108448, -145492, 74088, 72478, -57982, -49392, -71404, -4295, -27380, + 32749, 48855, -72478, 3758, 16643, -22012, 39728, 45634, -46708, 11274, + 62814, -9664, -31139, 65498, 30065, -37044, -15569, -31139, 23622, -1611, + -20938, 16643, 18254, -9127, 13959, 11274, + }, + { + -1988570, -5050345, -3690451, -248571, 381178, 5906, -51540, -12348, -120796, -217433, + 431644, 196495, -408559, -719944, 877784, 367220, -83215, -614717, -41339, -32212, + -31139, 116501, -236760, 169651, -165893, 144955, 301185, 220117, 13959, -275952, + -393526, 312996, 191663, -100395, 507343, -537945, 149787, -264141, -53150, -73014, + -35433, 99858, 68719, -17717, 147103, 54761, -40802, 85899, -16643, 306016, + -177704, -68719, 90731, -161061, -99858, 40802, 7516, 75699, -226560, 74088, + 22549, 73551, -96100, 94489, -90731, -28454, 39728, -101469, 43487, 2684, + -14496, -537, 64961, 28991, 51540, 46708, -22549, -26844, 17180, 21475, + -61740, -32212, -58519, 29528, 9664, -1611, 4832, -38655, 47782, 18254, + -5906, -13422, -2147, 4832, -21475, -4295, + }, + { + 387084, 2006287, -143881, 299037, -195421, 10737, 265751, 267362, -195421, -155156, + 2147, 53150, -175020, 56908, -4442070, 379568, -171262, 626528, -3739306, -433255, + 142271, 1025423, -69793, -850940, -586263, -762357, 1154809, -549756, -176631, 290447, + -340913, -284005, -226023, 318901, -377957, -482647, -387084, 121870, 330176, -176631, + -117575, -84826, 107374, 32212, 67109, 32212, -7516, -51540, 24159, -245887, + -141197, 35433, 45097, 62814, -52613, 156766, -52076, -26307, 40265, 2684, + 94489, 21475, -10201, 4295, -44023, -46171, -6442, 56908, 69793, -70867, + -28454, 82678, -6979, -11811, 17717, 2684, -21475, -7516, -16106, -68183, + -10201, -41876, 41339, 48855, -23085, 22549, -18254, -3758, 16106, -22012, + -16106, -6979, -22549, 13422, 21475, -10737, + }, + { + -1786170, -3008088, -4202089, 775778, -68719, -52076, 312459, -249108, -537, 322659, + -515396, -135291, 202400, -467615, 299037, -325344, -103616, -566399, -401579, 203474, + 142271, -467078, -517544, 251792, 23085, 53687, -341987, 162135, 382252, 42413, + -626528, 31139, 107374, 133681, 168577, -111669, -540629, 328028, 108448, 204011, + -2147, 73014, 156229, -233539, -48855, 279173, 190589, 399432, 184684, -22012, + -66572, 156229, 20401, 40265, 10201, 131533, -86973, -88584, -87510, 68183, + 71941, -18790, -45634, -82678, 23622, 12885, 3758, 10737, 68719, 46708, + 15569, -16643, -55298, 56908, -1074, 44560, -39192, -20401, -26307, 6442, + -2684, -4832, 31675, 85899, -13422, -6979, -10737, 3221, -58519, 60666, + -537, -20938, -17180, -13422, 47245, -1611, + }, + { + 397284, -1392106, -964220, 173946, 82141, 25233, -91805, 158377, -103616, -29528, + 113817, -262530, -438624, -1287953, -565325, 872952, 2694555, 230854, -712965, 240518, + 250182, 46708, -1650878, -624918, -525060, 66035, 636192, -1014149, -257161, -78920, + -7516, -427886, 162672, 322659, -723165, -8053, -141734, -255014, 139586, 363462, + -143345, -190589, 370441, -124017, -195958, -24159, -196495, -95563, 116501, 33286, + 53150, 22549, -59056, -65498, -19327, -35433, -70330, -32212, -77309, -10737, + 26844, 16643, 81604, -48318, -27380, 107911, 24159, -25770, -93952, 8053, + 30602, 24696, -49929, -25233, -24696, -36507, 39192, -38118, -40265, -5369, + 54224, -22549, 3758, 13422, 10737, 3221, -16643, 22012, 3221, -12348, + 38655, 36507, 36507, -40265, 22012, 15032, + }, + { + -556735, 31577136, 1684164, -880468, -411780, -115427, -208843, -5369, 47245, 337692, + -219043, -337692, 691490, 522375, -697395, 200790, 630823, 239981, 439160, -28991, + -121333, 253940, -302795, -312459, -47245, 72478, 190589, -268435, -290447, -133144, + 6979, 46171, 362925, -202400, 362388, 94489, -199716, 261993, -348966, 67109, + -104153, -85899, -117038, 372052, -46708, 85899, -282931, 48318, 34360, -166967, + -333397, -114890, -12348, 44560, -6442, -8590, -12348, -115427, -97711, 69793, + 105227, 47245, -41876, 41339, -34897, 40802, -74625, 30065, -1074, 15032, + 27917, -46708, 33823, -39728, -104153, 25770, 59593, -135828, -49929, 48855, + -53687, -17717, 5369, -22012, 1074, 9664, -6979, 9664, 5906, -7516, + -25233, 23085, 11274, -18254, -22549, -6979, + }, + { + 511638, -308701, -2519535, 219043, -384936, 69256, 86973, 526670, -103079, -67109, + 53150, 64425, 176631, 1145683, 380105, -1004486, 1973538, -345208, 660351, -880468, + -1067836, 987306, -394600, 94489, -685584, -410706, 482647, -1345399, 151398, -366146, + -205085, 307627, -442382, -171799, 129386, -620086, -324807, 243739, -59056, 357019, + -234076, -126702, -32749, -51540, -221728, -248571, -48318, -1074, -9664, -142271, + -44560, -55835, 89121, 20938, -38118, -23622, 128849, -73014, -118112, -143345, + -24696, -26307, -3221, 46708, 13959, 36507, 162135, -537, 13959, -102005, + -10201, -10201, 46708, 88584, -14496, -46171, 42950, 0, -9127, 24159, + -42413, -537, 33823, 22549, -537, 32749, -20401, -72478, -3221, 11274, + -18790, -35433, 19327, 9664, -9664, -1074, + }, + { + 2253247, 15704011, 5106716, -701690, 969052, 73551, 611496, 375273, -71941, -229244, + -287763, 125091, -460098, -30065, 889058, -84826, 662499, 204011, -1008780, 123480, + 428960, -206158, 7516, 370441, 187905, -71404, -172872, -322123, -83215, 146029, + -30602, -125091, 256087, -264141, -188979, 137439, -257161, -54224, -100395, -38118, + -256624, -59593, -20938, 148176, 223338, -197569, -264677, 12348, 27380, -105764, + -109522, 106837, -32212, -159988, 157840, 218506, -537, -157840, 35433, 29528, + 120259, 99858, -4832, 25770, 6979, 36507, -19864, -19864, 32212, -77309, + -29528, -25770, 24159, -17180, 22012, -12348, -537, -47782, 66035, -60666, + 17717, 61203, 6442, -18790, 12348, 1074, -41339, -1611, -9664, -46171, + 0, -29528, 33823, -3758, 12885, -30065, + }, + { + -266288, 4753992, 618475, -664109, -109522, -59056, -376347, 665720, -119722, -340913, + -838056, -282394, 33286, -726386, 354872, -782221, -1557463, 1353452, -1460826, -911607, + 219580, -196495, 547608, -70867, 194884, 405338, -384400, -171799, -35433, 242666, + 35970, 79994, 113280, -63888, 63888, -83215, -140660, 327491, -91268, 223875, + -30602, 234613, 100932, -1074, -26844, 106300, -11811, 16643, 31675, -171262, + 37581, 25233, 8053, -95563, 137439, 41876, 90731, -30602, -34897, 61740, + -38655, -162135, 12348, 76236, 25770, -68183, 31139, 3758, -37044, -32212, + 16643, -3758, -11811, 12348, -27380, -1074, -21475, 48318, 78920, -42413, + 4295, 53687, -48318, -16643, 44560, 35433, 15569, 40802, -30065, 45097, + 1074, 6442, 18254, 4295, -1611, -41876, + }, + { + 786516, -7619809, 398358, 383863, -20938, -71404, 523449, -324807, 134218, 208843, + -227633, 635655, -81604, -183610, -521839, 22012, -309775, -197569, 127238, -153545, + 507880, -364535, 339839, -316754, 276489, -205622, 19864, -456340, 376883, -370441, + -133681, -192200, 105764, -83215, -519691, 24696, 33286, 27917, 159988, -103079, + 103079, 44560, 172872, -100932, -139586, -123480, 173409, 24159, 164283, 100395, + -108448, -223338, 107374, -45097, 65498, -33823, -74625, 28991, -68183, 76236, + 31139, -8590, 41876, -12885, -79457, -18790, 11274, -67646, 109522, 15569, + -37044, 35433, 5369, 6442, -16106, -35970, -8053, 3221, 31139, 21475, + -13422, -9127, -52613, 0, 0, -46708, 46708, -2147, 9127, 15032, + -18790, -1611, -33286, -22012, 25233, -11274, + }, + { + -89657, -1916629, 542240, -247497, -213138, 106837, -325881, 32212, -315143, -333934, + -2684, -657667, 1868848, 4929549, -319975, -1297617, 706522, -237834, -216359, 102005, + -469225, 1258962, -82141, -1100049, 171262, 160524, 548682, 364535, 755377, -215822, + -828392, 23085, -164283, 263067, 59056, 60130, 233002, -169114, 135828, -267899, + 86436, -153545, 317828, -227096, 271657, 274878, 76236, -46171, -95026, 70867, + -117038, -63351, -112206, 17180, -33286, -125091, -173946, 9127, -44023, -56371, + 155693, 118112, -51003, -61203, -46708, 185757, -51540, -12885, 39728, -47245, + -14496, 30602, 57445, -18254, -1074, -30602, -62277, -30602, 35433, -1074, + -40265, 34360, 56371, 13959, 14496, 13959, 33823, -42413, 2684, -3221, + 34360, 57445, -52076, -53687, 39728, -16106, + }, + { + 1469416, -1959042, 1707786, -1010391, 654983, 892279, -94489, 44023, 223875, -295816, + -494995, 172336, 93952, 60666, 537408, -508417, 267362, 16106, -168577, -349503, + 296353, 310311, -309775, 380105, -539555, 198642, 120796, 348429, -16643, -308701, + 198105, 329639, -230854, -18254, 62814, -187368, -42950, -57445, 157303, 220654, + -68183, -171262, -103616, -141197, 6979, 89657, 117575, -64961, 177167, 153545, + -282931, 97711, -165893, -170725, -122943, 71941, 147640, 41339, 56908, 11274, + -116501, 91268, -16106, 41876, 68183, -537, 84826, -19864, -48318, -10201, + 36507, 0, 11811, -83752, -9664, 10201, 22012, -33286, -12348, 39728, + 15032, -38118, 11274, 31139, 10737, 14496, 74088, -33286, -42950, 8053, + 1611, -19864, 15569, 2147, 17717, -19327, + }, + { + 191663, -1103270, 758062, 289373, -95026, -66572, 7516, -99858, -449898, -114354, + 99321, -299574, 128312, 2761664, -5304285, 1107028, 1757715, -23622, 682900, 234076, + 1504312, 769336, -187368, -451508, 659278, 147640, 657130, 440771, -834834, 708670, + 520765, -146566, -48855, -33823, 197032, -234613, 104690, -222801, 74625, 577673, + 75162, -308164, -132607, -157303, 353798, 10737, -43487, 97711, -23622, -113280, + 66572, 70867, -115427, -206158, 5369, 20938, 46171, -95563, 149787, 6442, + -264677, -38655, -48318, 32749, -51540, 3221, -58519, 146029, -70867, -17180, + 63888, 44023, -83215, 9127, -3758, -47245, 59593, -10737, -12885, -18254, + 4295, 39192, 41339, 61740, -38118, -1611, -8053, -16106, -1611, 30602, + 15569, -24159, 32749, -2147, -15032, 19327, + }, + }, + { + { + 3958886, 46572476, 524523, 559420, -817654, 5906, 119722, -582505, -76236, 254477, + -99858, -14496, 370978, 727997, -822486, -115964, -304943, -158377, 30065, -207232, + 215822, -450972, 108448, 28454, 185757, 97711, 69793, 126702, 548145, 311922, + 158914, -347892, -301721, -39192, 156766, 50466, 81068, 120796, -312996, -266288, + -71941, -46708, -7516, 88047, 216359, -39192, -202400, 83215, 24696, 122407, + 75162, -54224, 21475, 45634, -105227, 13959, 56371, -41339, -63888, 160524, + -49392, -12885, -11274, 112743, 39192, 71941, 68183, -74625, 4295, -37044, + 56371, 37581, 19864, -41339, -36507, 16106, 47782, -63351, 47782, 23085, + 23085, -11811, -24159, 17717, -27917, 51003, 3758, 3221, 16643, 5369, + -36507, 11274, -1074, -1074, -1611, 6442, + }, + { + 406948, -1582696, 28454, -625455, -229244, -254477, 27917, -44023, -165356, -206158, + -876173, -268972, -623844, -241055, -1017370, -586263, -140660, 304943, -1256278, -121333, + -222801, -96637, 104153, -186831, 1004486, 521302, 300111, 132607, -96100, 151934, + 419296, 130997, -259309, -482110, 142808, -139586, 89657, 68183, -17180, 41876, + 150324, 113280, 309775, 68183, 86436, -47245, 23085, -296353, 96100, 27380, + 0, 159451, 39192, -30602, -169114, 60130, 31139, 61740, -82678, 26844, + 41876, 87510, -57445, -54761, 13959, -42413, 88047, 16106, -66035, -35433, + 45097, -91805, 4832, 24696, 34360, -87510, -70330, -9664, 70867, 38655, + -30602, 11811, 34360, 5906, 12885, 31139, -5369, 3221, 57982, -41876, + 4832, 14496, 20938, -2147, -32749, -13422, + }, + { + 1209570, 13038447, 3415036, 3160022, -656593, 382789, 532576, -135828, -382252, 35970, + -154619, 59056, -698469, 223338, -277025, -306553, 12348, -896574, -243739, -147640, + -231391, -243203, -578210, -128849, 399969, -175020, -46708, -196495, 139050, 143881, + 515933, -144418, -119185, -10737, -178241, 511638, 162672, 55835, -287226, -103616, + 101469, -43487, 128312, -2684, 16106, -51003, -130460, 32212, -27917, -39728, + 26307, -31139, -165356, 148176, -52613, -102005, -69256, -13959, -73551, 63888, + 45097, -47782, -19864, -55298, 49929, 16106, -22012, -59056, 21475, -42413, + -30065, 60666, -33823, 34360, -31139, -99858, 52076, 97711, -22012, -35433, + 8590, 35433, -11274, 4832, 20938, -6979, -11811, -30065, 18790, -4832, + -20401, -19327, 24696, 7516, -8053, 14496, + }, + { + 264677, -16058883, 3007014, -42950, 217433, 92879, 128849, 213675, -190589, -151934, + -190052, 70867, -286152, 306016, -584116, 335544, 268972, -798864, -271120, 133144, + -131533, -123480, 270583, 8590, -255014, -24696, 523986, 315143, -38655, -287763, + -166430, 328565, 193274, 8053, 307627, -384400, 121333, -209380, 25233, -85899, + -234613, 101469, 62277, -61740, -32212, 191663, 194884, 10737, -17717, 244813, + 53687, -239981, 70867, -183610, -21475, 26307, -75162, -11274, -143881, 6979, + 73551, 60130, -23085, 105227, -12348, 6442, 29528, -124554, -1074, 63351, + -11811, -86436, 12885, 46708, 22549, 8590, 18790, 9664, 9664, 52613, + -14496, -24159, -27917, 21475, -2684, -17717, 28454, -25770, 2147, 23085, + 11274, -12348, -9127, 12885, -8053, -5369, + }, + { + -607738, -96637, 1919314, 523986, -202937, 4295, 315143, 150324, 8590, 7516, + 0, -94489, 227096, 41339, -4158602, -529355, -492311, 1304596, -304943, -1358820, + 239444, 642098, -557809, -505732, -624381, 39192, -687732, -394063, 38655, 100932, + -237297, 41876, -174483, 99858, -273804, 119722, -472983, -163746, 414464, 184147, + -237834, 13422, 301185, -65498, -58519, 42950, -10201, -27380, -53687, -537, + -9127, -301185, 153008, -31675, -81604, 85899, 59056, 18790, -24696, 56908, + 115964, 37044, -41876, 28454, 28991, -13959, 25233, -20401, 63351, 47245, + -89121, -1074, 35433, -17180, 5906, 17717, -23085, 28454, 33823, -9127, + 5906, -56371, 4295, 31139, -19327, 16643, -21475, -4832, 5906, 2147, + -5906, -3221, -9127, -15569, 37581, 9127, + }, + { + 32749, -14112189, 2840584, 372588, -464393, -6442, 450972, -315143, -193810, 756451, + -187905, -310311, -183610, -293668, 250719, -675921, -151398, -299574, -142271, 26307, + 437013, -148713, -483721, -184147, 149787, 83215, -4832, -234076, 268972, -21475, + -222265, -171799, 323196, 199716, -223875, -51003, 74088, -6442, 140660, 340376, + 449361, -161061, -120259, -174483, 73014, 193810, 135291, 182536, 209380, 159988, + -197032, 5906, 173409, 185220, -83215, 74625, 119185, -65498, -66035, 47782, + -27380, 29528, -5369, -42950, -25770, -6442, 27917, -8590, 76236, 47245, + 2147, 1074, -53687, 18790, -8590, 55298, 35970, -15569, -40265, -32212, + -5906, -39192, -19327, 69256, 24159, 28454, 537, 45634, -52076, 12348, + 1074, -8590, -8053, -9664, 8053, 11811, + }, + { + 60666, 247497, -881542, -153008, 24696, 38655, -275952, 213675, 82678, -83215, + -67109, -327491, -455267, -2421825, -755377, 2772402, 963146, 181462, -402653, 29528, + -96100, 642635, -1200980, -1978906, -414464, 321049, -169114, 93952, -583042, 120259, + 178241, -133681, -364535, 303332, -136902, -178778, -244813, -34897, 286152, 394600, + -186294, 9664, 189515, -273804, -4295, 125091, -99858, -39728, -21475, 1074, + 92342, -13959, 31675, -60666, -63351, -40802, 26844, -129386, -56908, -72478, + 73551, -32749, 29528, 15569, -40265, 34360, 98784, 43487, -113280, -67109, + 13959, 62277, -22549, -5906, 41876, 18254, 37044, 21475, -6979, -33286, + 38655, -4295, 35970, -32212, 18790, 10201, -28454, -5369, -26307, -42950, + -12885, 9664, 36507, -18254, 6979, 27380, + }, + { + 1203128, 32046362, -1016297, -1136019, -66572, -31139, -499827, -181999, 410706, 124017, + 273267, -442382, 228707, 56908, 413927, 227096, 573378, -235686, 203474, 599148, + -288837, 44023, 27917, -284542, -158377, 84826, 237297, -188979, -701153, -25770, + 65498, -186831, 649077, -282394, 153008, 514322, -222265, 112206, 370978, -315680, + 59056, -360240, 157840, -61203, 31675, 63351, -231928, -171799, 18254, 22012, + -229244, -284542, -245350, 13959, 114890, 76236, 42413, -85362, -180389, -1611, + 52613, 25770, 33823, -2147, -47782, -27917, -52613, 44560, -20401, 16106, + 20401, -45097, 56908, 19864, -40265, -59593, 97174, -33823, -58519, 30602, + -41876, -3758, -30602, -537, -17180, 1611, 48318, 16106, 537, 2684, + -7516, 21475, 18254, 6979, -25233, -22012, + }, + { + 41876, 1112933, -1054951, -390305, -181462, -47245, 119185, 466004, 293668, -206158, + -221728, 85899, 418759, 999117, 1195075, -2893734, 1239098, -150324, -3758, -555661, + -597000, 414464, 788663, -585726, 22012, -1000727, -164283, -796716, 609885, -754304, + -351114, -537, -50466, 85362, -266288, -333397, -12885, 82678, -15569, -31139, + 443455, -176094, -83215, 45634, -106300, 57982, -35970, -26307, -100395, -144955, + -85362, 92342, 14496, 28454, -63351, 9664, 140123, -38655, 2684, -105227, + -41339, -118112, -12348, -48855, -18790, -4832, 40802, -23622, 19864, -92879, + -46708, -84826, -32212, 128312, 26844, -44023, -13422, 55835, -4832, 20938, + -10737, -60130, 9127, 18790, 21475, 17717, 51003, -13422, -34897, -11811, + 11811, -33286, 1611, 21475, -11811, 15032, + }, + { + -1676648, 19016504, 5695127, 1406065, 235149, 1154809, 1192390, -424128, 324270, 74625, + -157303, 41339, -75162, -578747, 390842, 186294, 721018, 135291, -688269, -129923, + 513785, -153545, 230318, 174483, 370441, -99858, -222265, -62277, -172336, -4832, + 138513, 257698, 96100, 188442, -63351, -267362, -246961, 67646, -337692, 16106, + -92342, 101469, -214748, 80531, 159451, 48318, -268972, -74088, 28991, 71941, + -69793, 146029, 115427, -103079, 63888, 142808, 122943, -187905, 35433, -95026, + 120796, 114890, 5369, 59593, -36507, 71941, -18254, -9664, 25233, -43487, + -62814, 11274, 50466, -10737, 13959, -28454, 40265, -45097, 11274, -37044, + -30065, 30602, 35433, -8590, 56908, 60666, -3221, 2147, 9127, -24696, + 22012, -60130, 10201, 12885, 26307, -9664, + }, + { + 150324, 3391951, 1465121, -550830, -226023, -1074, 218506, 277562, 161598, -35970, + -490163, -118648, -489089, -1026497, -186831, -290447, -789737, -323733, -370441, -1443109, + -293668, 39728, 804770, 74088, 454193, 178241, -220654, 263604, -313533, -217970, + -160524, 20401, 146566, -117575, 180926, -167504, -335544, 132607, 39728, 241055, + -13959, 8590, 321586, -38655, 22012, 128849, 6442, 119722, 28991, 2684, + 96100, -2684, -105764, -136365, -15032, 150861, -2684, 33286, 5906, 7516, + 35970, -107911, -33286, 60666, 60666, -40265, -1074, 78383, -47782, -2147, + -1611, -36507, -23085, 14496, -24159, -22549, -68183, -1074, 58519, -17180, + -2147, 64961, -19327, -53150, 2147, 30602, -8590, 8590, -40802, 5906, + 17717, 11274, 8590, -6979, 18790, -30602, + }, + { + -1552094, -5116917, -70867, 154082, 643171, -1378685, 696322, 118112, -147103, 638876, + -767189, 201327, 108448, -394600, -483721, -369367, 144955, -366683, 42950, 89657, + 169651, 144955, 19864, -83215, 246424, -204011, 110595, -427349, 183073, -34360, + -221191, -198105, -390305, 170725, -192200, -546535, -105764, -198642, 168577, -9664, + 44560, 171799, 110595, -59056, -153008, -41876, -37581, 186294, 19864, 5369, + 132607, -92342, -44023, 2147, -62814, -15569, -74625, 5906, -121870, 95563, + 51540, 9127, -20401, 37581, -82141, -537, -22012, -59593, 30065, 88047, + 1611, 10201, 11811, 10201, 20938, -11274, -36507, -15569, -15569, -2147, + -537, 42950, -15569, -14496, 5369, -51003, 28454, -2147, 15569, 35433, + 0, 28454, -10737, -19864, 10201, -1074, + }, + { + 161061, -579284, -430034, -861141, 187368, -31675, -271120, -169114, -396748, 57445, + 45634, -222265, 555661, 4752382, 682363, -428960, -454193, -113280, -593242, 813359, + -1629940, 89657, 985158, -1067836, 192737, 198105, 238371, 986769, 183073, 469225, + -1062468, -313533, 53150, 117575, -65498, -300648, 308164, 109522, 273804, -164819, + -251792, 164283, 177167, -118648, 324807, 103079, 178241, 25233, 54761, -111669, + -79457, 42413, -67646, 27380, -58519, -12885, -205622, -1611, 63888, -136365, + -3758, 187905, 35970, -23622, -121333, 112743, -12885, -41339, 57445, -2684, + -17180, -4295, 13959, 18254, 41876, 15569, -10737, -2147, 8053, -8053, + -46708, -17717, 30602, -13959, 12348, 3221, 39728, -32212, -8053, 16643, + -2147, 63888, 8053, -46708, 22549, 27380, + }, + { + -813896, 2183454, -1584306, 1194538, -99321, -1147293, 1359894, 545998, 458488, -361314, + 576063, -607201, 515933, -49392, -628676, -402116, 156229, -297427, -46171, -493921, + 140123, 584652, -239444, 204548, -350577, 45097, 108985, 371515, 185757, -173409, + 365609, -224949, -92342, -171799, 166430, -171262, -163746, 79457, -34360, 170188, + -164819, 9664, 4295, -188979, -161061, 17717, -119185, 30065, 81604, 53150, + -180926, -53687, -68183, -92879, -183610, 32212, 61740, 124017, -63888, 2684, + 13959, -46171, 64961, -67646, 59593, -71941, 78383, -17717, -2684, -27380, + 52076, -2147, 9127, -32212, -35433, -26307, 37044, -31139, -62814, 0, + 7516, -27380, -50466, -10201, 20401, -46708, 62814, 38655, -25770, -10201, + 537, -48318, 0, -4832, 17180, -2147, + }, + { + -322659, -864899, 99321, 147103, 265751, -8590, -330176, 797790, -952409, -249645, + 169114, -264141, 430570, -434865, 1543504, 1484448, 303869, 237834, -384936, 923418, + 1197222, 758062, -284542, 624381, 796716, -128312, -180389, 213675, 482110, 208843, + 449361, 54761, 49392, -168041, -100932, 44023, 84289, -317291, 251792, 328028, + 330712, -179852, 97711, -156229, 113280, 100932, 20938, 10737, 34897, -107911, + 74088, 39728, 13422, -157840, -178241, -4832, 32749, 51540, 57445, 236760, + -116501, -99321, 11274, 70330, -3758, -33823, -118648, 120796, -9127, 20938, + -56371, 90731, 42950, 6979, 31675, -44023, 23622, 71404, 2684, -5906, + -40802, 2147, -41876, 70330, -11811, -6442, 5906, -29528, -12348, 15569, + -2684, -31675, 27380, 19864, -2147, 4832, + }, + }, + { + { + -5036386, 39122320, 2305861, -1589138, 910533, -33286, -503585, -264141, 99858, -125091, + 508954, 517007, -269509, 181462, -1171989, 723702, 136902, -111132, -184147, 892279, + 782758, -71404, -201863, -183610, 91805, 74088, -335007, -123480, 56371, -36507, + 427349, -196495, 136365, 55298, 336081, -317828, 65498, 118648, 219043, 233539, + 167504, -61740, -30602, 43487, 65498, 9127, -64961, 9664, -6442, 136365, + 154082, -47782, -35970, 13422, -93952, 66035, 73551, -90731, -204548, 6442, + 49929, 21475, -39192, -48318, -5906, -32212, -19864, 46171, 26844, -5369, + 28454, -32212, 15032, 55298, -1074, -95026, -16106, 26844, -46171, 46708, + 10737, 39728, 11811, 11274, 17717, -45634, 59056, -38118, 537, 17717, + 4832, -8590, 17717, -9127, -11811, -8053, + }, + { + -445066, -1631551, 1545651, -1260036, 181999, 90731, 221191, -266825, 285078, 15569, + -247497, -60666, -407485, 641024, 599148, 89657, -894964, 794569, 357556, -38118, + -39728, 130997, -311922, -748398, 251792, 410706, 42413, 289910, -49392, -585726, + -164819, -212601, -209917, -128849, -227096, 130997, 40802, -1611, 91268, 156766, + -70867, -67109, 171799, 136902, -176631, 33823, 31139, -178241, 110595, 51540, + 151398, 19327, 81604, 69256, 130997, -157840, -194884, 39728, -26307, -54224, + 20401, 91268, 9127, -62277, 14496, 54761, -43487, 95563, -11811, -41339, + 11811, 1611, -26844, -82678, 12885, 50466, -48855, -54761, -6442, 38118, + 53150, -28991, -37044, 21475, -19327, 30602, 25233, -2684, -5369, 53150, + -9127, -32212, -3758, 34360, 24159, 2147, + }, + { + -616865, 10325638, 2598455, 2634426, 1049583, 408559, 315680, 289373, 90731, -180389, + -10201, 647466, -479426, -219580, 204548, -142271, 474057, -389231, 920734, -121870, + 155693, -99321, -282394, -200253, 212064, -171262, 300111, 225486, 237834, 152471, + 374199, -918049, -254477, 119722, -156229, -132070, 30065, 27917, -210990, -128312, + -63888, -374736, -190052, -20401, -192737, 106837, -104690, -15569, 17717, -66572, + -256624, 2684, 126702, 134218, 42413, 76236, -30065, 66035, -68183, 34360, + -77309, 66035, 87510, 73551, -93416, 14496, 47782, -3758, -35970, 27917, + -537, -59593, -35433, 81068, -16643, -33286, -32212, -12348, 35433, -24696, + -18790, 4295, 40265, -21475, -62277, 28991, 27380, 25233, -26844, -2684, + 17717, -17717, -5906, 2684, -20938, -20401, + }, + { + 3104725, -14253386, 956704, -1333051, -282394, 115427, 193810, 79994, -54761, 306016, + -181462, -244276, -348966, 543850, -211527, 53150, 260919, -181462, 23622, -45097, + -164819, -270046, 410706, 139050, -81604, 37044, -218506, 506269, -337155, -113817, + 153545, 181462, 62277, 106300, 35433, -70330, 164283, -10737, -112206, -9664, + -33286, -19864, -112206, 86973, -241055, -143881, 235686, -51540, 27380, -13959, + 95563, 30065, -67109, -12348, -13422, 11274, -34360, 13422, 95563, -49392, + -55298, 37044, 52076, -41876, 62814, 52076, -2684, 67109, -66035, 55835, + 70330, 23085, -110059, -19327, -6442, -48318, 6979, 25770, 4295, 18254, + 29528, 31675, 48855, -22549, -4832, -2147, -20401, 33823, -47245, -23622, + 18254, 27380, -15569, 0, 20401, 4295, + }, + { + 626528, -960462, -975494, -90731, 232465, 25770, -39728, 139586, 175020, 127238, + 87510, -84826, -169114, 165893, -2360085, 585726, -802622, -398895, 3400004, -376347, + 493384, -485331, -394063, 612570, -622770, 512175, -1323924, -338766, -317291, 277025, + 609349, 586263, -282394, 179315, -11811, 341450, -689879, -146029, 28991, -107911, + -59593, -164819, 191126, -69256, -210453, 13422, 78920, -31139, 133144, -23622, + 152471, -167504, -42950, 108985, -3221, -10737, -60130, 125091, 62277, -29528, + 30065, 48855, -51003, -56908, 2147, 29528, 20938, 59593, 26307, 5906, + 48318, -33823, -38118, -5906, -10201, -28991, 18790, -17717, -6979, 59056, + 18254, 43487, -14496, -81068, 33286, -18254, 13422, 12348, -27380, 11274, + -21475, 5369, 36507, -23085, -28991, 2147, + }, + { + 3723200, -12448963, -691490, 269509, -347892, 12885, -285615, 452045, -282394, -461709, + 486405, -24159, -272730, -120796, 533113, 63351, 250182, 20401, 537945, -149787, + -19864, 131533, 161598, -94489, -206158, -80531, -204548, -84826, 33286, -100395, + 374736, 185220, 177167, -127238, -230318, 61740, 342524, 137439, -32212, 176094, + 206158, -232465, -163746, 103079, 42413, -117575, -111132, -110595, -28454, 92879, + 75699, -210990, 4832, 17717, 120259, -120796, 59593, 81068, 99321, 9127, + -132607, -23085, 41876, 89121, 58519, -42950, -13959, 38655, 19864, 8053, + -6979, -11811, 33823, -42950, 1074, -20401, 56908, 31675, -12348, -24696, + 25233, -4832, -30065, -66035, -22549, 18254, 19864, -9127, 52613, -32212, + -3758, 6979, -2684, 20938, -32212, 537, + }, + { + -320512, -671089, 834834, -34360, 52613, -88584, -285078, 103616, 178241, 4832, + -127238, -6442, 301721, 1566053, 1070521, 1328219, -464393, 76773, -703301, -871342, + -278636, 441308, -915902, -398358, 297427, 663572, -525060, 1149441, -84289, 392990, + -68719, 186831, -326418, -427886, 128312, 335544, -211527, -129923, -88584, -155156, + 76236, 161598, -89121, -162672, -212064, 57445, 106837, 41876, -30065, 24696, + -73014, -103079, 44560, 45634, 2684, -45097, -10737, 43487, -51540, -78383, + 64425, -28991, -81604, -20938, -59056, -17717, -34360, 44023, 37581, 9664, + -138513, 1074, 52076, 5369, 9664, 44560, -8590, 38118, 37044, 7516, + 3758, 12348, 15569, -24696, -10201, -537, 31139, -34360, -14496, 3758, + -35970, -24159, -12885, 24159, -4832, -4832, + }, + { + -3728569, 30757334, 26844, -966905, 231391, -52076, 148713, -144418, 217433, -186294, + 446677, 349503, -313533, -414464, 931471, 277562, 60130, -26844, -785442, 127775, + 294205, -301185, -294205, 77309, 46708, -81068, 318901, 124554, -242129, -93952, + 25233, -330712, 100932, -462783, -269509, 364535, 264677, 241592, 466541, -105764, + 86436, -204548, 190589, -9127, -257698, 63888, -27380, 37581, -124017, 156229, + 67646, 147640, -78383, -170188, 24159, -44023, 64425, 11811, -12885, 13959, + -86436, -80531, 9127, 37581, 44023, -38118, -28454, 15569, 5906, -36507, + -1611, 13959, -11274, -22012, 89657, -18254, -74625, 72478, 1074, -8590, + 25233, 40802, -40802, -537, -11811, -5906, -20401, 28991, -8590, 11811, + 4832, -18790, -5369, 13422, 11811, -6442, + }, + { + -467078, -743029, 1437740, -213675, 231391, -16106, -23622, -268972, 273804, 118112, + -100932, 1611, -85362, -383326, 1722282, -893890, 1763084, -1034550, -214212, 78920, + -185220, -209380, 1693291, -134218, 1120987, -260919, -757525, 336081, 194884, -476205, + 528281, -376347, 59593, 2684, -576063, 192737, 237297, -137976, 260382, -261993, + 158914, 18790, -111132, 62814, 56908, 194884, -155156, -21475, -85362, 31139, + 9127, 83215, -135291, -12885, 76773, 76236, -93416, 35970, 113280, -49392, + 95563, -13422, -44023, -1074, -44560, -70867, -73014, -153545, 52076, 11274, + 23085, -26307, -84826, -41339, 15569, -6442, -10737, 32212, 46171, -8590, + 54224, -7516, -67646, -16106, -12885, -26844, 24696, 60130, 6979, -11811, + -11274, 2147, -12348, -3221, -2684, -7516, + }, + { + 653372, 17278116, -3023120, -164819, -13422, 1109712, 139050, -486405, -30065, 54761, + 17180, -304406, 301185, -175020, -981937, -70867, 121333, 34360, 154619, 71404, + -34897, 8590, -48855, -210990, 48318, 302258, 105764, -270046, -121333, 37044, + 61740, 290447, -289373, 85362, 446677, 61203, 2147, 121870, 84289, -168041, + -163746, -5369, -121870, -92342, -327491, 217433, 97174, -124554, -145492, 6979, + 164283, -33286, 35433, 221191, -49929, -108985, 194884, 63351, -19327, 6442, + -69256, 48855, -52613, -8590, 23085, -7516, 22012, 15569, -76236, 2147, + 4295, 39192, -32749, 22012, 2684, 21475, -5369, 36507, -39728, 48318, + -32749, -30602, -22012, 20938, -20938, 23622, 38118, 7516, -6979, 29528, + 537, 12885, -13422, -12348, -12885, 27917, + }, + { + -32212, 2171643, -442919, -588411, -257698, -26307, 163746, -396748, -248571, 149250, + 260382, 633508, -593242, -605590, -805843, 289373, 227633, -941135, -274341, 944893, + -407485, -745177, 475668, 140123, 494458, -51540, 303332, 214212, -159988, 537, + -157303, -83752, -81068, -34897, -133681, 221728, -163209, 30065, -70330, -27380, + -104153, -210453, 177704, 25233, 87510, -17180, -6442, 37044, 42950, 57445, + 35970, 52613, 14496, -53150, -101469, 52076, -133681, 10737, 126165, 15569, + -11274, 84826, -17717, -34897, -63888, 73551, -60666, 15569, 39728, 17717, + 32749, -30065, -41339, -17717, 31139, 10737, -1074, -14496, -92879, 22549, + -1074, -12348, 58519, 9664, -37044, -28991, 1611, -32212, 24159, -49929, + -8590, 11811, -12348, 9127, 3758, 29528, + }, + { + 1720671, -99321, -1112933, -1159641, -351114, -642635, -391916, -204548, -120259, 329639, + 155693, -310311, -129386, 72478, -181462, -282394, 265214, 0, -350040, 324807, + -419833, 206695, 212064, 135291, -244813, -94489, -289910, 112206, 98784, 369367, + -203474, -39192, -241055, -120796, 267362, -127238, 26844, -92879, -41876, -41876, + -245887, 157840, -133144, -68719, -69793, 97174, -66572, 52613, -110059, -165356, + 74088, 98247, -144418, 112206, -167504, 64425, 34897, 50466, 38118, -92342, + 71404, 73551, -78920, -4295, 89657, 30065, -44560, 5369, -46171, -31139, + 75162, -34360, -5369, 3221, 27917, 27917, -13959, 2684, -28454, -52613, + -18790, -2684, 31139, 15569, -6442, 46171, -25770, 0, 20401, -24696, + 18254, -1611, 38655, 15569, -22549, -1074, + }, + { + -181462, 161598, 1474248, -490163, 373125, -134755, 521302, -314069, -392990, 99321, + -124017, 319438, -2029909, 715112, -1147830, 847182, -412317, 93416, -93416, 485331, + 410706, -938987, 1546188, 246961, 204011, -194347, 28991, 462246, -112743, 348429, + 388158, 4295, 187368, -193274, 62277, 9127, -366146, 186831, -131533, -80531, + -297427, 171262, 195421, 17180, -4295, -142808, 24696, 83215, 159988, -107374, + -13422, 43487, 137976, -14496, -92342, 77309, 118648, -35433, 76773, -24159, + -102005, -123480, 41876, 20401, 14496, -16106, 33286, -24159, -24696, 48318, + -4295, -6979, -38655, 17180, -26307, 26844, 81604, 56371, 18790, 7516, + 32212, -35433, -29528, -12885, -10201, 6979, -38655, 27917, 3758, 14496, + -17180, -34897, 28991, 44023, -44023, 28454, + }, + { + -108985, 3949223, -1646583, 602369, -330176, -1881196, 136365, 79457, -28454, 170188, + 221728, -559420, 773631, 48318, 336081, 665720, -152471, -122943, -143345, -365609, + -120259, -31675, 31139, -302795, -137976, -375810, -426276, 256624, 537, 419833, + 256087, -44560, 162672, -121870, -76773, -34897, -125628, -86436, -55298, -41876, + 142271, 53687, 150861, -26844, -40802, -2147, -341987, -306553, -77309, -158377, + 157303, -57982, -6979, 149787, -55298, 30065, -77309, -44023, -51003, -14496, + 105227, -116501, 19864, -32212, -6979, -41339, -62277, 29528, 8053, 22549, + -27917, 30065, -10737, 56371, -7516, -26844, -42950, 49929, 8053, -28454, + -30065, 28991, -4832, -63888, -9127, -20401, -49929, 32749, 46708, -9664, + -19864, 15032, -16643, -2147, -14496, 27917, + }, + { + 396211, -573915, -1636383, -415001, 143345, -69793, -54761, 662499, -655519, 130460, + 77309, 42950, -494995, -828929, 7073811, 2587181, -421444, 323733, -792421, 82141, + 290984, -31675, 125628, 300648, 387621, -152471, -474594, -344134, 501437, -230854, + 100932, 324270, 103079, -204548, 2684, -326954, -95026, 44560, 132070, 247497, + 118112, -46708, 340376, -12348, -321049, -17717, -143881, -149250, -8590, -537, + 30602, -30602, 83752, 33823, -31675, -49929, -28991, 186294, -147640, 133681, + 154082, 26307, -60666, 537, -11274, 38118, 57445, -130997, 52613, 25770, + -54761, -54224, 57445, 28991, -3221, 118112, -53687, 23085, 27917, 19864, + 21475, -23622, -44023, -61740, 32212, -18790, 537, 16643, 5369, -30065, + 6442, -3221, -22549, 8053, 18254, -2684, + }, + }, + { + { + 3361349, 28029494, -5697274, 1323387, 664646, -139050, -528818, 57982, -184147, -285615, + 346819, 355945, 55298, -392453, -1611, 145492, 876710, -391379, 6442, 444529, + 708670, 278099, -198105, -139050, 25770, 53150, -92879, -444529, 135291, -318901, + 122407, 110595, 155693, -56908, 148713, -114890, -63351, -218506, 334471, 246961, + 255014, 57982, -230318, 40265, -25233, -91805, 23085, 57982, -26844, 49929, + 156229, 49392, -63351, -24159, -22549, 136365, 26307, -6442, -73551, -84826, + 65498, 6442, 75699, -76236, -23622, -32212, -30602, 28454, 35433, 22549, + 26307, -56908, -13959, 64425, 23085, -30602, -51003, 20401, -28454, -13422, + -19864, 12885, 18254, -21475, 52076, -51540, 537, -22012, -11811, -11274, + 10737, -6442, 13959, -4295, -1074, -7516, + }, + { + 207232, -1056562, -54761, -196495, 6979, 116501, 285615, -357556, 10201, 12885, + 43487, 56908, -280784, -30065, 1730872, 491774, -236760, 81604, 690953, 265214, + 47782, -301721, 83215, -354335, -548145, 209917, 267362, -214748, 31139, -263067, + -316217, -48855, -91805, -69256, -288837, 104690, 8053, -357556, 91268, 441308, + -100932, -163746, -169651, 279710, -191126, 69256, 4832, -68719, 83752, 61203, + 165893, -89657, -4295, 1074, 161598, -80531, -86973, -49392, 38655, -27917, + -53687, -12885, 44023, 2684, 24696, 66572, -92342, 8053, 1611, -14496, + -20938, 65498, -21475, -36507, -30602, 57445, 26307, -20401, -44560, 0, + 53150, -10201, -37581, 16106, -8053, -22012, 12885, -1074, -42413, 43487, + 5369, -20401, -19864, 7516, 22012, 14496, + }, + { + 573378, 8791798, 2680060, 1093606, 1284732, 400506, 138513, 318901, 417686, -166430, + -259846, 359167, 215822, -427886, 107911, 328565, 185220, -151398, 508417, 874026, + -191126, 140660, 182536, -134218, -158914, -470299, 529892, -135291, 262530, 397284, + -71404, -461709, -606664, 94489, 55298, -136365, -73014, -137976, 157840, -279710, + -46171, -493921, -98784, -216896, -32212, -59056, -35433, -63351, 4832, -139586, + -172336, -28454, 136902, -5906, 89657, 55298, 30065, 54761, -3758, -8590, + -25770, -16643, 31139, 136902, -88584, -31675, 8590, -1611, -20401, 18790, + 32749, -70867, -23085, 29528, 28454, 41339, -51540, -74088, 35433, 18254, + -13422, -9664, 29528, 24159, -66572, 5369, 19327, 16643, -9127, -5369, + 24159, 11811, -21475, -537, -6979, -24159, + }, + { + -5862631, -3359201, 1529008, -2110440, 231928, 192737, -108985, 88047, -3758, 321586, + 218506, -108448, -503048, 314606, 153545, 25233, 93952, -38118, 279710, -9127, + -61740, -216359, 80531, 231391, 537, 393526, -303332, 416612, -584652, -81068, + 227096, 16643, -114890, 248034, -86436, 188979, -77846, -19864, -62277, -141197, + 34360, 55835, -155693, 172336, -108448, -327491, 7516, 77309, 20401, 0, + -48855, 161598, -127775, 109522, -93416, 1611, 24696, -15032, 100932, 33823, + -58519, 16643, -9664, -98247, 2147, 32212, 16643, 90194, -27917, 537, + 76236, 88047, -47782, -44023, -5369, -16643, -22012, 16106, -13959, -5906, + -11274, 25233, 44560, -23085, -15569, 18254, -33286, 27917, -11811, -34897, + 2147, 24696, 4295, -18790, 19327, 1611, + }, + { + -367220, -1901597, 804770, -175557, 131533, 95026, 125091, -3221, 8590, 259846, + -1611, -57982, -66572, -955093, 81068, 1148367, -1213865, -1089848, 1370095, 527207, + 71941, -717260, -220654, 365072, 84289, -73014, -330176, 384936, -288300, -55835, + 551903, 222801, -114890, 84289, -242666, 75699, -501437, 37581, -248034, -127775, + -77846, 26307, -247497, -56371, 16106, -64961, 136365, 4295, -60130, 49929, + -26307, 119185, -75699, 63888, 63888, 35970, -64425, 103079, 106300, -40265, + -53687, 59593, -2147, -116501, -74088, -10201, 27380, 74088, 8053, -42950, + 104690, 25770, -82141, 17180, -17717, -28991, 4832, -61203, -54224, 22549, + 5369, 66035, 27380, -84826, 9664, -11811, 18790, 15569, -14496, 537, + -22549, -6979, 29528, 2147, -39192, -19864, + }, + { + -6454799, -319438, 623307, 1052804, -348429, 16106, -237834, -45634, 226560, -654446, + 115964, 63888, 33286, 42950, 139050, 658741, 138513, 146029, 263067, 28991, + -406948, -67646, 294205, 73014, -226560, -279173, -35433, -54761, 44023, -107374, + 388158, 425202, 79457, -224949, -213675, 102542, 206695, 178778, -8053, -20401, + -239444, 3758, 64961, 174483, -148713, -240518, -39728, 65498, -28991, -31139, + 123480, -144955, -85362, -118112, 124554, -45634, -19864, 34897, 47782, 15569, + -66035, -51003, 30065, 73551, 20401, 30065, -30602, 49392, -4832, -5906, + 12885, -8053, 55835, -55298, 22549, -14496, -4832, 11274, 18790, 10201, + 16643, 45097, 2684, -75162, -33823, -23085, 6442, -40265, 54761, -6979, + -11811, 1074, -2684, 24696, -8590, -20938, + }, + { + -64961, -1471026, 255551, 434329, 99858, -27380, -154082, -48855, 90731, 115427, + -90194, 88047, 274341, 1305133, 1926830, 852551, 317828, -135828, -537, -534723, + -173409, -239981, -1216013, 1224603, -61740, 346282, 28454, 564788, 272194, 27917, + -85362, 186294, -46708, -392453, -127775, 333934, -294742, -137976, -201327, -388695, + 148713, 99858, -60666, -49929, -216896, -83215, 44560, 19327, -53150, 45634, + -64961, -10201, -63351, 41876, 44023, -61203, -97711, 103616, -21475, -53687, + 32749, 42413, -85899, -46708, -27917, -20401, -71404, -10201, 41876, 61740, + -90194, -33286, 42950, -16106, -32212, -22549, -14496, -13422, 14496, 41876, + -2684, 8053, -18254, 8053, -19864, -2147, 30602, 2684, 2684, 39192, + 5906, 537, -26844, 26307, 5906, -21475, + }, + { + 7013682, 19668802, -2019172, -236223, -361851, 5906, 141197, 199716, -107911, -61203, + -14496, 541703, -149250, 4295, 269509, 368293, -147103, 425202, -464930, -365609, + 219043, 30602, -391916, 22549, 141734, -67646, 169114, 51003, -110595, -6979, + 74088, -124554, -304943, -214212, -377957, 42413, 390842, 304406, 117575, 190052, + -111669, 36507, -17717, 24696, -28991, 21475, -10201, 143881, 33823, -71941, + 61203, 276489, 113280, -125628, -55298, -90731, -34897, -18790, 48318, 81604, + -110595, -27380, 0, -4832, 98247, -10201, -12348, -24696, 20938, -23622, + -5369, 32212, -44560, -69793, 43487, 26307, -100395, 4295, 24696, -17180, + 24159, 27917, -5369, -7516, -5369, -3221, -49929, 1074, 10201, -15569, + 11274, -20938, -22012, -3758, 9127, 9127, + }, + { + -112743, -1967095, 731218, -338766, 114354, 47245, -137976, -233539, 175020, 113280, + 110059, 117575, -47782, 591632, -182536, 2274722, 475668, -419296, -983548, 168577, + 188979, 59593, 435402, 926102, 223338, 654983, -804770, 277562, -378494, 100395, + 555125, -212601, -223875, -2147, -493921, 111669, 290447, -111132, 133681, 23085, + -355409, -28454, 62814, -114890, -58519, 3758, -167504, 79457, 26844, -82141, + 49929, -16643, -57982, -64961, 134218, 59056, -161061, 46708, 12348, 57445, + 46708, 48318, -25233, 60666, -3221, 24159, -66572, -69256, -9127, 41876, + 100395, 4295, -33823, -76236, -45097, 15032, 1611, 31139, 50466, -15032, + 12885, 49929, -19864, -30602, -13959, -25770, -44560, 34360, 29528, -4295, + -34360, 13959, -6442, -13959, -4295, -16106, + }, + { + 392453, 14866492, -1662689, -853088, -135291, -100932, 30602, 272730, -367220, -89657, + -56908, -450435, 95026, 554588, -1203665, -139050, 165893, -12348, 191126, 192200, + -152471, 45097, -173946, -98784, -157840, 34897, 311922, -253403, -140123, 49392, + -16643, 26307, -226560, -75699, 293668, 239981, 198105, -39192, 274878, -242666, + -98784, -223875, 23622, -102005, -170725, -154619, 213138, -64425, -186831, -147103, + 110059, -113817, -115427, 244813, 80531, -134755, 73551, 142808, -53687, 71404, + -23085, -17717, -49929, -41876, 67109, -39192, -12348, 35970, -70330, -22549, + 37044, 10737, -56908, 18254, 0, 33286, -34360, 34360, -13959, 46708, + 9127, -17180, -26844, -2147, -51540, -30065, 3221, -1611, -20401, 9127, + -17180, 43487, -5369, -12348, -26307, 4832, + }, + { + 108985, 1155346, -1316944, 213138, 119722, 90731, -560493, -322123, -326954, 15032, + 357019, -5369, 49392, 90731, -1548336, -15569, 242666, -110595, -574452, 1391569, + -190052, -314606, -242666, -18254, 219043, 160524, 163746, 35970, 4295, 346819, + 123480, -146029, -128849, 45634, -98784, 200790, 117575, -16106, -94489, -106300, + 62814, -105764, -103616, 30065, 73551, -44023, -4295, 5369, 25770, -57982, + -34360, 18254, 62814, 100932, -29528, -35970, -63351, -48855, 103616, 51540, + -51540, 30602, 23085, -8590, -127775, 64425, -13959, -65498, 22012, 24696, + 20938, 17180, -12348, -35433, 21475, 19327, 58519, 20401, -74625, -12348, + 13422, -28454, 42413, 37044, -2684, -29528, 17717, -12348, 48855, -21475, + -20938, 3221, -1611, 19327, -13959, 18790, + }, + { + -740882, 2389076, -198642, 10201, -1388348, 340913, -651224, -35433, 72478, -439160, + 711891, 34360, -352187, 397821, 105227, -361851, 69793, 215285, -417149, 122407, + -316754, 22549, 259846, 63888, -374736, 83752, -333397, 222801, 60130, 105764, + 46171, -78383, 44023, -195958, 91805, 358093, -85899, 127238, 72478, -180389, + -190052, 74088, -44560, -141197, 5906, 45097, -5906, 60666, -75162, -191126, + -62277, 90194, -66035, 71404, -118648, 74625, 93952, 17180, 102542, -66035, + -6442, 82678, 0, -63351, 62814, 38655, -3221, 24696, -9664, -81604, + 41876, -16643, -26307, -1611, 2684, 12885, 0, 13959, 10201, -42413, + -5906, -32749, -12885, 18254, -15032, 52613, -5369, -537, 15569, -49392, + 9664, -30602, 11811, 15569, -11274, 0, + }, + { + 174483, 646393, 784368, -37044, 71941, -35970, 436476, -75699, -324807, -134755, + -121333, -2684, 395137, -937914, -2786897, 672699, 1059246, -64961, 56908, -55298, + 1272921, -417686, -258235, 483721, 960999, -105227, -251256, 557809, 60666, -212601, + 931471, 436476, -63888, -84289, -15032, 295279, -461172, -103616, -128849, -76236, + -85899, 49929, 162135, 129386, -126702, -138513, -91805, -6979, 108985, -31139, + 26844, -48318, 112743, -50466, -66035, 10737, 70867, 59593, -35433, 102005, + -19327, -207769, -35433, -4832, 59593, 13422, 4295, 17717, -27380, 8590, + 12348, 13422, -30065, 2147, -37581, -40265, 52076, 40802, 24696, 18254, + 54761, 15569, -30602, 30065, -11811, 6442, -51540, 17180, 32749, 1074, + 2684, -49929, -18254, 48855, -32212, -13422, + }, + { + 681289, 3221226, -1899449, 1138166, 81604, 322123, -1985349, 122407, -242666, 332323, + -625455, 113817, 117575, -197032, 1468342, 591095, 76773, 419296, -264677, -22012, + -139050, -342524, -97174, -236223, -158377, -367220, -303869, 191126, -463856, 574452, + 76773, 81068, 258235, 191126, -322123, 58519, 145492, -188979, -69256, -155693, + 186294, 32212, 82678, 40802, 104690, 14496, -109522, -330712, -41876, -236223, + 178241, 16643, -60666, 96637, 69793, 34897, 6442, -84289, 20401, -8590, + 68183, -47782, -59593, 48855, 4832, 15569, -49392, 20401, -15032, 20401, + -37581, 41876, -28454, 38118, 12348, 13959, -48318, 27917, 66572, -2147, + -17717, 25770, 45097, -24159, -29528, 40265, -49392, -22549, 28454, 0, + -11811, 38118, -8590, 12348, -14496, 14496, + }, + { + -192200, -193810, -503585, -297427, -282931, 5369, 10201, -118112, -227633, 326418, + 2147, 293132, -52613, 1623498, 1188095, 2830384, 138513, 3758, -996432, 238371, + 517544, -848793, 490163, 564251, -302258, -183610, -482647, -40265, 239981, -79457, + -56371, 339302, 97711, -408559, 41339, -42950, -407485, 259846, -112743, 239444, + 44023, -41876, -41339, 62814, -202400, -143881, -134218, 9664, -57445, -73014, + -36507, 0, -31139, 53687, 54224, 11274, -25770, 68719, -114890, -127775, + 134218, 30602, -59593, -104690, -19864, 30065, 152471, -105764, -17180, 15569, + -7516, -77309, -27380, -9664, -18254, 95563, -9127, -14496, 2684, 10201, + 63351, 1611, 16106, -68719, 537, -6979, -4295, 20938, 12348, -12885, + 4295, 22012, -17180, -18790, 9127, 15032, + }, + }, + { + { + -1995549, 25309168, -5073967, 1267552, 169114, -6979, 155156, 134218, -37044, 15032, + -274341, -362388, 89657, -41339, 1313186, -600222, 132070, -404264, 250182, -332860, + 129923, -54761, -75699, -188979, 130460, 29528, 283468, -364535, 143345, -381178, + -68719, 315143, 41876, -76773, -176094, 86973, -95563, -362925, -81604, -28991, + 302258, 318901, -81604, 28991, -46171, -168577, -84826, 222801, 127238, 99858, + 26307, 16643, -28454, -9664, -15032, 11274, -58519, 56908, 74625, 42413, + -31675, -66035, 16643, 33823, 25233, 42413, 62277, -45097, 20401, -2684, + 41339, -2147, -2147, -7516, -13422, 88047, 18790, -53687, 89121, -23622, + -13422, -30065, -12348, -34897, 3221, 43487, -60666, 32749, 7516, -15032, + -8590, 12348, -14496, 6442, 15569, 2684, + }, + { + -127238, 1480690, 957778, 352187, -84826, -70330, 48855, -74088, -273267, 193810, + 70867, 244813, -336618, -251256, 1438277, 93416, 307627, -512175, -1245004, -88584, + -176631, -471373, 865973, 105227, -836982, -576063, 270583, -568009, 143345, 198105, + 191663, 724239, -117038, -241592, 121333, -13959, 130997, -476741, -160524, 329102, + 125091, 89121, -218506, -105764, -82678, 27380, -1611, -12885, 184147, -55298, + -77846, -18254, -35433, -115964, -170188, 69256, 145492, 15032, 32749, 86973, + -75699, -91268, -25233, 26844, 62814, 18790, 54761, -49929, -62277, 4832, + 15032, -36507, 4295, 58519, 5906, -32212, 31139, 26307, 18790, -22012, + -44560, 29528, 36507, -2684, 23622, -18790, -19327, -3758, 14496, -52076, + 20401, 35970, 7516, -26307, -28454, 537, + }, + { + -365072, 7806103, 3410741, -268972, -1649268, -426812, -375810, -70867, 61740, 172872, + 40265, 27917, 44560, 81068, -334471, 415538, 132607, -86436, -701153, 853088, + 120796, 879931, 228707, 54761, 119185, -271657, 217433, -550830, 368830, 120259, + -296890, 415538, -341987, 19864, -51540, 193274, -100395, -178241, 107374, -266288, + 10737, -142808, 325881, -189515, 173946, -167504, 126702, 37581, 18790, -155156, + 3758, 44560, -20401, -5369, -15569, -76773, 75162, -68183, -71941, 5906, + 63888, -111132, -16106, -14496, 73014, -41876, -73551, -15569, 58519, -23085, + 24696, 42950, -13959, -25770, -11274, 1074, 33286, -15569, -28454, 22012, + 1074, 12348, -30065, 47782, 20938, -19327, -11274, -34897, 24696, -17717, + -11811, 11811, 9664, 1074, 14496, 22012, + }, + { + 6416145, 10945724, -792958, -2652142, -174483, 54224, -499290, 139586, -198105, 10201, + 376347, 116501, -532576, -250182, -388695, 41339, 118112, -372588, 9664, 225486, + 23085, -12348, -130460, -31675, 24159, 312996, 323196, 409096, -15569, -59593, + -190052, 31675, -171799, -98247, -185220, 62277, 129923, -357556, -45634, -271657, + -94489, 155693, -129386, 36507, 120259, -55835, -177704, 59056, 0, 173409, + -66572, 49929, 15032, 57982, -39728, -6979, 42413, 30602, -53687, 55298, + 12348, 21475, -85362, 28991, -100395, -59056, 34897, -81068, 49929, -19327, + -30602, -15569, 68183, 12885, 15569, 31675, -30602, -6442, -15569, 15032, + -36507, -15032, -36507, 6979, -16106, 13959, 4295, -36507, 38655, 11811, + -5906, -20938, 16643, 4295, -11274, -17180, + }, + { + 228170, -4134980, -769873, 279173, -260919, 42950, 175020, -34897, 38655, 258235, + 6442, 103079, 219043, -74088, 1950452, 1478543, 115964, 642635, -3660923, -381178, + -105764, -164819, -205085, -593242, 263604, 295816, 1599339, 431107, -756988, -776315, + -226023, -126702, 141197, 49392, -41876, -123480, -141197, 327491, -36507, 219043, + -139586, 198642, -169651, -83752, 177704, 64961, 58519, 176094, -103079, -34897, + -186294, 115427, 162135, -74625, -35970, 32212, -20401, -6979, 47245, 59056, + -35433, 21475, 34897, -23085, 25233, -66035, -44023, -10201, 9127, -17180, + -39192, 20938, -34897, 4832, -15032, 33823, -11811, 6442, 5369, -54224, + -10201, -33286, 36507, 33286, -52076, 18254, -18790, -8590, 26844, 537, + 1611, -6979, -23085, -1611, 26307, -7516, + }, + { + 6360847, 15802795, 107911, 2433099, 941135, 28454, 440234, -794569, 481036, 631360, + -518617, -317828, 60130, 263604, 394063, 419833, -37044, 251792, -87510, 307627, + -19327, -448824, -203474, -55298, 42413, -211527, 163746, 36507, 334471, -108985, + -157840, 69793, 258235, 77309, -206695, 158377, -18254, -88047, -52076, -129923, + -259309, -151398, 97174, -34360, -209380, -128849, -116501, 65498, 17180, -31139, + -81604, 170725, 85899, -85899, -133144, 123480, 65498, -80531, -107374, 24159, + 23085, 37581, -10201, -73551, -78383, 67646, 1611, -14496, 26844, 10737, + -8053, -10737, -7516, 20401, -8053, 40265, -24696, -43487, -2147, 17717, + -19864, 13959, 24696, 39728, 537, -23622, -25233, 10201, -48318, 25233, + -5906, -5906, -8590, -13959, 31139, -6979, + }, + { + 252329, 417149, -508417, 205085, -38655, 27380, 70330, 162135, -67646, 114890, + 62277, -5906, -246424, 410706, 1437740, -1653562, -570157, 422517, 568546, -136902, + 306016, -424665, -1247688, 1047972, 32749, 335544, 401043, -341450, 253403, -122943, + -38655, 301721, 103079, 242129, -245887, 32212, -144418, 130997, -67646, -107911, + -125091, -226023, 153545, -26307, 128849, -30602, -153545, -12348, -12885, 11811, + 42413, 37044, -97711, -74088, -4832, -4295, -2147, -46708, 20938, 20938, + 20401, -11274, 28991, 57982, -2684, 3221, 15569, -29528, -58519, 9127, + 66035, 46171, -16643, -23085, 9127, -56371, 13422, -23085, -26844, -19864, + 33823, -4832, -9664, 8053, 3221, 1074, -29528, 38118, -10737, -9127, + 24696, 31675, 15569, -18254, 5369, 2147, + }, + { + -8404177, 340376, 2654290, 338766, -265214, 29528, -293668, 441308, 16643, 55835, + -435402, -412317, 345745, 516470, -156766, 284542, -319438, -70330, 708670, 101469, + -355409, 477815, 210990, -75699, -114890, 190589, -25770, -52613, -277025, 102005, + 268972, -12885, 56908, 83752, -98784, -104690, -195421, 38655, -184147, -70867, + -95563, 97711, -13422, -198105, 235149, -208843, -273804, -16106, 160524, -103616, + -32749, -129923, 37581, 199716, -38118, 17180, -23085, -33286, -47782, 30602, + -31675, 91268, 57445, -73014, -7516, 35970, 18790, 3758, -13422, 33286, + 38118, -3221, 11811, -5369, -78383, -31675, 82678, -90194, -35970, 19327, + -37044, -15569, 16106, -6442, -6442, 15569, 18790, -24696, 10737, -26844, + 2147, 11811, -9127, -3221, -17717, 0, + }, + { + 454193, -96637, -1671279, -207232, -218506, 51540, 54224, 69256, -158377, -124554, + 2147, -5369, -400506, -285078, -824097, 1985886, -2044404, -217433, 329102, 216896, + -402653, 624918, -969052, 656593, -540092, 508954, 747861, -442382, 196495, 390842, + -331786, 193274, -347892, 414464, 260382, -113817, 247497, 97711, -223875, 208306, + -227096, -269509, 168577, -43487, -204548, -178241, -18790, -17717, -13422, -165893, + -3758, -37044, 106837, -49392, -42950, 30065, 96637, 34360, -64961, 42950, + -60666, -4832, 43487, -22012, 26307, 127238, 40265, 85362, 0, -15032, + 23085, -15569, 68719, 89121, -57445, -13422, 8053, 42413, -22549, -3221, + -57982, 2147, 64425, 13422, 24159, 10201, -13959, -36507, -18254, 8590, + 2684, -11811, 2147, 5906, 1074, 8053, + }, + { + -763967, 10313827, -874026, -59593, 173946, -647466, 238908, 185220, -85899, 100932, + -238371, -274878, -284005, -18254, 126165, 93416, 261456, -172336, -328565, 135291, + 366146, -132070, -79457, 81068, 96100, -67646, 117038, -172336, -168577, -39192, + 158914, -2684, -30065, 66572, -78383, 24159, 133144, -61740, -20401, -42413, + 18790, -59056, -114354, -26307, 205622, -260382, 6442, -31675, -19864, -106300, + -162672, -24159, -89657, -150861, 76236, 15032, -18254, -34360, -21475, -69256, + 127775, -18790, -34360, -7516, -15569, 38118, -38118, 21475, 33823, -43487, + -9127, -18254, 22549, -42950, 4832, -1074, 22549, -47245, 48318, -27917, + 6442, 40265, 31139, -35433, 20401, -5906, -52076, -15569, -1074, -43487, + 3758, -21475, 18254, 16106, 19327, -18790, + }, + { + -201863, -142808, -1137093, 53687, -27380, -112206, -1083942, -135291, 78383, 81604, + -28991, -600222, 679142, 308701, -495532, 6979, -263604, 641561, -193810, -656593, + -216896, 451508, -417686, -762357, -555125, 626528, -254477, -369367, -377957, 49929, + 282931, 150324, 95563, 51003, 233539, -299037, 47245, 85899, 35433, 76236, + 108448, 121333, -110059, -82678, -33286, 10737, -12885, 76773, 27380, -71404, + -55835, -148176, -77846, 97711, 124554, 5369, 27380, -17180, -13422, 24159, + 28454, -87510, 5369, 70330, 25233, -17180, 74088, -5906, -61740, 4832, + -34897, 26844, 31675, 2684, -34897, -23085, -4832, 12885, 69256, -37044, + 10737, 23085, -44023, -26844, 25233, 10737, 0, 13422, -18790, 43487, + 1074, -11274, 15569, 1074, 4832, -35433, + }, + { + -772020, 1961726, 507343, 602906, -301185, 158377, 645319, 216359, -179852, -224412, + -3221, 508417, -179315, 388695, 379031, -106300, 181999, 21475, -9664, -340913, + 190052, -141197, -109522, -169651, 74625, 96637, -6979, -226023, 146029, -456340, + 113817, -6442, -21475, 67109, -341450, 88584, -212601, 169114, 491237, -35433, + 6979, -76236, 67109, -133144, 159988, -74088, 11274, 206695, -7516, -30602, + 71941, -33286, 115964, -16643, -40265, -19864, 34897, 15032, -8053, 95563, + -46708, 0, 66035, 22012, -103079, -9127, 20401, -10737, 75699, 13959, + -70867, 28454, 5369, -2147, -18254, -33286, -5906, -1611, 19864, 18790, + 24696, 15032, -64425, -3758, 4832, -50466, 40802, -537, 17180, 12348, + -10737, 5369, -33286, -25233, 14496, -3758, + }, + { + -140123, 762894, 433792, 207232, 150861, 139586, -241592, 241055, 133144, 253940, + -27380, -505196, 1036161, 409633, 452045, -128312, 609349, 375273, -296890, 592169, + -621697, 997506, 614180, -154082, 435939, -86436, -188442, 871878, -191126, 437013, + 194884, 326954, -199716, 87510, -52613, 117575, 163746, -314069, 193274, -100395, + 46171, 45634, 59593, -16106, 136902, 27380, -61740, -97174, 85899, 33823, + -9664, -45097, -91268, 18254, 113280, 28991, -204011, 81068, -146029, -21475, + 119185, 85362, -118648, -96637, -71941, 128849, -64961, -38118, 60666, -23622, + -10201, 16643, 3758, -12885, 48318, -30065, -24159, -25770, -10201, -11811, + -17180, 42950, 9664, 20938, 5369, -5906, 32749, -42413, 11811, -12348, + 14496, 45097, -41876, -34897, 36507, -17180, + }, + { + -564251, 1533840, -1431835, 1286880, -90731, 1714229, -800475, 366683, 285615, -134755, + -273267, 127775, -558346, -101469, 948651, -520228, 156229, 350040, 188442, -80531, + -81068, 161061, -292595, 303869, -184684, 137976, -52613, 339839, -139050, -142271, + 62277, -169651, -79994, 169651, -72478, -78920, 77846, 20938, -70330, -7516, + -34897, 113280, 19864, -40802, 52613, 60666, 261456, 82141, 11811, -27917, + -71404, 103079, 13959, -52076, -22012, 16106, 115964, 38118, -19327, 21475, + 6442, 5906, -48855, -2147, 81068, 19327, 90194, -5906, 12348, -18254, + 24696, -5906, -5906, -34360, 3221, 23085, 57445, -42950, -20401, 24696, + 35433, -10737, 15032, 44023, -3221, 10737, 53687, -25233, -40802, 9127, + 21475, -13422, 11811, 12348, 15032, -18790, + }, + { + 54224, 108985, 755914, 423591, -169114, -81068, -241592, -159988, -248571, -56908, + -171799, 79994, 416612, 3907883, -4510253, -1826972, 35970, 37581, -1030255, -29528, + 326954, -842350, 90194, 766652, -592169, 202937, -27917, -116501, -53687, -113280, + 64961, 182536, 224412, -187368, -156229, 277025, -264141, -184147, -124554, 134755, + 153008, -42950, -345208, -186831, 222801, -64961, -44560, 237297, 81604, -148713, + -63888, 7516, -62277, -74625, 20938, 139050, -537, -85899, 81604, -66572, + -146029, -81068, 53687, -47245, -3758, -89657, -537, 180926, -96637, 14496, + -1074, 60666, -37044, -49929, 10737, -70867, 56371, 26307, -23085, -33286, + -20938, 29528, 26307, 68719, -44023, 9664, 10201, -25770, -3221, 32749, + -4295, 2147, 27380, -11811, -22549, 10737, + }, + }, + { + { + 2965138, 14825690, 2505577, 1581085, -605590, -73014, 354335, -175020, 53687, 248034, + -88047, -294742, -38655, 79457, 651761, -96100, -565325, -95026, -114890, -91805, + -45097, 92879, -253940, -74088, 102005, 59593, 213138, -134218, 61740, 145492, + -206158, 280247, -143345, 1611, -242666, 186831, -136365, -220654, -55298, -119722, + 108448, 341450, 78383, -15032, -48855, 10737, -113280, 169651, 62277, 156766, + 18254, 72478, 26844, -52076, -57982, -48318, -68183, 12885, -15569, 113280, + -31675, -93416, -60130, 86436, 48855, 24159, 62814, -10737, -2147, 12348, + -25233, 43487, 15569, -25233, -30602, 44023, 47245, -32749, 63351, 35433, + 9664, 13959, -31139, -9127, -33823, 49392, -12348, 25770, 18254, 8053, + -10201, 14496, -11274, -5369, 10737, 4295, + }, + { + 188442, 3919158, -1459215, 561567, -162135, 37581, -391916, 250719, -89121, 17717, + 116501, 181462, -577673, 318364, 1016834, -241592, -325881, 60130, -2008971, -590558, + 223875, -688805, 738198, 517544, -519691, -624918, 435402, -512175, 65498, -73551, + 369367, 792421, -215285, -13422, 75162, -29528, 139586, -195958, -171262, -17717, + 246424, 250182, -47245, -172336, -93416, -41339, 60666, -4832, 2684, 72478, + -110595, 33286, 41339, -41339, -235149, -48318, 147103, 32212, 9664, 5369, + 6979, -2684, -35433, 6442, 43487, -19864, 119722, 7516, -50466, -8590, + 23622, -70330, -11274, 22549, 39192, -38655, -24696, 23622, 20938, 10201, + -43487, 15569, 35970, -7516, 29528, 16106, -11811, 4832, 40265, -38655, + -537, 26844, 20938, -8053, -16106, -11811, + }, + { + -103616, 10422812, 401043, -819802, -762894, -540092, -211527, -120796, -106837, -21475, + 282931, -63351, 116501, 476741, -399432, -50466, 263604, -11274, -762357, 388158, + 210990, 603443, 59056, 117575, 151398, -11811, 150861, -158914, 209917, -181462, + -31675, 234076, 537, -61740, 11274, 147640, -29528, -134218, -19864, -153008, + -172336, 90194, 144418, -5369, 149250, -4295, 104690, 78920, 19327, -46171, + -96637, 82141, -5369, 31675, -40265, -76773, 24696, -49929, -61740, -32212, + 37581, -19327, 2147, -62277, 41339, 35433, -69256, 23085, 35433, -16643, + -20401, 54761, 34897, -16106, -38118, -51003, 29528, 44023, -31139, -8053, + -2684, 15569, -16106, -1611, 45097, -10201, -14496, -20938, -1074, -8590, + -13422, -8590, 15569, 5906, 2147, 28991, + }, + { + -4252018, 25422448, -1135482, -2385318, 12348, -5369, -265751, 66572, -69793, 154082, + -241592, 25233, 31139, -838056, -160524, -460635, 239444, -484794, -158914, 186294, + 58519, 12885, 38118, -89657, -2147, 47782, 452582, 272194, 203474, 32212, + -125628, 24696, 6442, -199716, -258235, 145492, 158377, -258235, -23622, -373125, + -43487, -100932, 129386, -58519, 61203, 31139, -87510, 89657, -74625, 169114, + 70867, -82141, 91805, 23085, -40802, -15032, 4832, 64961, -51540, -15032, + 33823, 56371, -59593, 97711, -60666, -59593, 22549, -78920, 17180, 2684, + -23085, -70330, 17180, 41339, -6442, 21475, 4295, -14496, 1074, 18254, + 6442, -13959, -33286, 10737, -17717, -5906, 22549, -26307, 7516, 23622, + 5369, -19327, 2147, 13422, -12348, -8053, + }, + { + -312459, -5055177, 368830, 108448, -153008, 7516, 157840, 180926, -157303, 194347, + 170188, -75699, 274878, -517544, 3732864, -612570, 594316, 688805, -1137093, -1339493, + -349503, -233002, 93952, -888521, 682363, -118112, 648003, 164819, -124554, -878858, + -254477, -24696, 57445, 112743, 78920, -34897, -77309, 223338, 17180, 347892, + -32749, 48318, 2684, -44023, 161598, 76773, 70330, 84826, -46708, -68183, + -12348, -42413, 157303, -91268, -44023, -22012, 7516, 32212, -53150, 38118, + 49929, 2684, 3221, 29528, 71404, -36507, -10201, -30065, 8053, 19327, + -79457, -33823, 21475, -11811, -30602, 42413, 3221, 35433, 41876, -27380, + 13422, -48855, -25770, 66035, -34897, 6442, -18254, -18790, 22012, 9664, + 7516, 2684, -26844, -12348, 31139, 6979, + }, + { + -3065533, 30309048, -665720, 2697240, 14496, 28991, 324807, -354872, 123480, 849330, + -309775, -355409, -117575, -125091, 766115, 177704, 125628, 207232, -119722, 233539, + 206695, -17717, -640487, -183610, 222265, -68183, 50466, 37581, 40802, 183610, + -163209, -149787, 184684, 339839, -158377, 110059, 38655, -241592, 34897, -73551, + -210453, -9664, -13422, -206695, -229781, 52076, -198105, -35970, 7516, 99321, + -164283, 95563, 169114, -21475, -79994, 47782, 146029, -25233, -51003, -24696, + -34897, 91805, 7516, -45634, -94489, 7516, 29528, -10201, 30065, -13959, + -13422, 17180, -34360, 35433, -14496, 15569, 8053, -17180, -17180, -9127, + -19864, -33286, 5369, 39192, 9664, 12885, -16106, 31139, -42950, -537, + 8053, -8590, 2684, -26307, 15032, 8590, + }, + { + 137439, 1209570, 194884, -412317, -53150, 45634, 122407, 218506, -67109, -40802, + 17180, 44560, -404264, -353798, 1185948, -1716376, -617402, -144955, 405338, 317828, + 126165, 42950, -2012192, 311922, 402116, 369904, 702764, -222265, -61740, 272730, + -223338, 120796, 137439, 341450, -537, -170725, -64961, 235149, 8590, 116501, + -124554, -235686, 98247, -55835, 176631, 62277, -74625, 3221, -45634, -33823, + 4832, 60130, -51003, -59593, -27917, 28991, 77846, -106837, 19327, 49392, + -11811, -75699, 52076, 30065, 13959, 15569, -10201, 37581, -57445, -35970, + 45097, 64961, 1074, -22012, 57982, 6442, 17717, 12348, -5369, -30602, + 18790, 2684, 11274, -13422, 11274, 2147, -32212, 1611, -12885, -37581, + -9664, 7516, 26307, -22012, -8590, 16106, + }, + { + 6863895, -18351858, 137439, 296353, -56908, -8590, -325881, 115427, 59593, 146029, + -237834, -475668, -1611, 428423, 350040, -73014, 14496, -491774, 425739, 497679, + -235686, 205622, 336081, 54224, -146566, 115964, -82678, 102005, -474057, 119722, + 347892, -61740, 141734, 38655, -34897, 31675, -190052, -163209, -13959, -133681, + -114890, 63351, 24159, -259846, 48318, -220654, -224949, -56908, -32212, 74625, + -4295, -224949, -119185, 162135, -7516, 88047, 84826, -6442, -68719, -45634, + -41876, 72478, 42413, -25233, -34360, 16106, 19327, 17717, -24159, 34360, + 33286, -5906, 24696, 66572, -56371, -55835, 88047, -38118, -26844, -2147, + -4832, -37581, -537, -1074, -8590, 11811, 39192, -6979, 1074, -3758, + 1074, 6979, 10201, 3758, -8053, -10201, + }, + { + 146029, 1570884, -1810866, 213138, -183073, -59593, 67646, 131533, -106300, -133144, + -52076, -304406, -253940, 285615, -2074469, -900333, 478889, -939524, 368293, -111669, + -252866, 492848, -869194, 944356, -402116, 371515, 308164, 76773, 159451, 133681, + -428960, 82141, 83752, 35970, 380641, -86436, 230318, 132070, -149250, 104153, + -6442, -219580, 42413, 159451, -95563, -42950, 33286, -133681, -60130, -134755, + -63351, 3221, 79457, -9664, -19864, 37044, 133681, 64961, -3221, 8590, + -56908, -82141, 35970, -91268, 18790, 55298, 23622, 57982, 13959, -18254, + -35970, -30065, 39192, 94489, -5906, -22012, 6979, 32749, -20401, -6979, + -32749, -41339, 38118, 22549, 22549, 20401, 25770, -8590, -37044, 1611, + 28991, -13959, -2684, 6442, -1074, 23622, + }, + { + 695785, 5738613, 2564096, -289910, -197032, 404264, -35970, -270046, 64961, 165893, + -146566, 22012, -137976, -525060, 616328, -308701, 124554, 12885, -122943, -33823, + 525597, -270583, 24696, -149250, 352724, 4832, -51540, -66572, -63351, -181462, + 265751, 176094, -39728, 95026, 111132, -139586, -30065, 51540, -180926, 61740, + 55835, 89121, -113280, -92342, 112743, -62814, -107374, -537, 114354, -42413, + -180389, 71941, 42413, -157840, -20938, 32212, 537, -68719, 5369, -89121, + 38655, 2684, 12885, 16106, -41876, 32212, -2147, 2147, 56908, -14496, + -33823, -14496, 53150, -52613, 15032, -13422, 46708, -45634, 19864, -34360, + -8590, 19327, 37044, -12348, 45634, 37581, -20401, -5906, 6979, -21475, + 12885, -35433, 0, 20401, 27917, 1611, + }, + { + 155693, -1011465, -509491, -384400, 322659, -113280, -359704, -330712, 211527, -16106, + 27917, -108448, 319438, 41339, 82141, -146566, -439697, 234076, 173409, -865973, + -589484, 394063, -689342, -125091, -567473, 356482, -164283, -267362, -595390, -14496, + 42950, 166430, 127238, 36507, 295279, -358093, -59593, -33823, 105227, 71404, + 91268, 8053, 16643, -39728, -41339, 62277, 24159, 4832, 113817, 24696, + 5369, -136902, -108448, -46708, 75162, 23085, 28454, 39192, -36507, 16106, + 54761, -57982, -13422, 40265, 117038, -34897, 42950, 62814, -21475, -20938, + -27917, -4832, 13959, 12885, -35433, -34360, -43487, -30065, 63351, -5906, + 4832, 26844, -35970, -48855, -7516, 20401, -18790, 1074, -48318, 25770, + 10201, -9664, 8590, -3221, 17717, -22549, + }, + { + 1660542, -3008625, 2036888, -138513, 245350, 275952, 202400, 281857, -393526, 231928, + -300648, -74088, 351114, 183610, 232465, -114890, 3758, -120259, 249108, -366683, + 384400, -18790, -401579, -11274, 215285, 13959, -33286, -196495, 42413, -239981, + -116501, 98247, -122943, 34360, -201863, -179852, -276489, 12885, 310311, -15569, + 144955, -52076, -107374, -32212, 122407, 37581, -15569, 89657, 54761, -3758, + 184684, -24696, 107374, -39192, -38118, -70867, 10737, 53150, -79457, 65498, + 43487, -24159, 7516, 48318, -64961, -33823, 13959, -31675, 24696, 56371, + -41876, 13422, 27380, 2147, 7516, -26307, -25233, -15569, -3221, 28991, + 11811, 39192, -35433, -4295, 19327, -63888, 25233, 4295, 6442, 44560, + -2684, 26844, -15032, -22549, 5906, 3758, + }, + { + 88047, 1545115, -596464, 175557, 26307, 191663, -343597, -32212, 292595, 388695, + 38118, -365609, -96100, 1335198, 853088, 857383, 164283, 170188, -345208, 781147, + -1128503, 565862, 1339493, 193810, -476741, 214212, -95563, 942208, -124554, 718333, + -249108, 70330, -145492, 86973, -15032, -141197, 114354, -83752, 148713, 2684, + 32212, 124554, -4832, -19864, 180926, 16106, 10737, 18254, 45634, 24159, + -30602, 62277, -35970, -37044, 154082, 103616, -161598, -537, -69793, -77309, + 13422, 108985, -26307, -83752, -83752, 62814, -18790, -60130, 44023, 27380, + -23085, -11274, 11274, -11811, 62814, 35970, -9664, -22549, -24696, -17180, + -33286, 1074, 8053, -13422, 5369, -19327, 56371, -34360, -17180, 3221, + 0, 46708, 8590, -45634, 25233, 19864, + }, + { + 53687, 640487, -737124, -239981, -1611, 503048, 805306, -128312, 652835, 29528, + -49929, -158377, -365072, 964220, -668404, -581431, -93416, -320512, 337692, -115427, + -94489, 283468, -128849, 386010, -139050, 71941, 10201, 304943, 200253, -268435, + 60130, -202937, -142808, -92879, 89657, -226023, -65498, 88047, -79457, 46708, + -92879, 79994, 114354, -63888, -25233, 36507, 114890, 134218, 20938, 49392, + -115964, -35433, 141734, -23085, -84826, -26844, 52076, 54224, -16643, -3221, + -4832, 28454, -14496, -73551, 49392, -20938, 76773, 0, 30602, -38118, + 46171, -8053, 5906, -23085, -3758, -5369, 63888, -24159, -68183, -11811, + 31139, -6442, -21475, 12348, 5369, -26307, 46171, 22549, -28991, -1611, + 21475, -32212, 1611, -3758, 19327, -8590, + }, + { + -180926, 63888, 661425, 398895, 14496, -93416, -317291, 95026, -303869, -87510, + -77846, -111669, 160524, -144418, 530965, -906775, -623307, 5906, -386547, -412317, + 216896, -62277, -537945, 755914, -10201, -214748, 647466, -661962, -261993, 84826, + 6442, 228707, 253403, -13959, -196495, 155693, 33823, -265751, -154619, 21475, + 101469, 121333, -195421, -74088, 84826, 69793, -39728, 233002, 85899, -76236, + -73014, -44560, 44023, -43487, -36507, 35970, 40802, -68183, 117575, 117575, + -84826, -117038, 93416, 6442, 38118, -90194, -85899, 146566, -38118, 19864, + -18790, 72478, 33286, -11274, 46171, -74625, 28991, 46708, 7516, -20938, + -61203, 4832, -20938, 60666, -7516, 2147, 10737, -25770, -6979, 17180, + 0, -17717, 20938, 11274, -11274, -8053, + }, + }, + { + { + -3539590, -1454383, 1249299, 2408403, 357556, -194884, -104153, -29528, -10201, -302795, + 179852, 394600, -77309, -622233, -784905, 578210, -193274, 50466, -42413, 784368, + -192200, 39728, -18790, 37044, -87510, 40265, -282394, -274878, -48855, 346819, + 13422, 44023, -221728, -131533, -13959, -137439, -75699, -222801, 6979, 33286, + -129386, 30602, 65498, -40265, -108448, 102542, 49929, 11274, -115427, 54224, + 35970, -7516, -19864, 2147, -63351, -38655, -63888, -35433, -109522, -22012, + 85899, 16643, -5906, -19864, 24696, -38118, -10201, 99321, -31139, 9664, + -53150, -7516, 6442, 40265, 18790, -43487, -20401, 31139, -63351, 38655, + 537, 52613, 4832, 16643, -1611, -57982, 53687, -17180, 9127, 21475, + 16643, -8590, 19327, -8590, -6442, -3758, + }, + { + -149250, 4440460, -423054, -142808, 310848, 178778, -336618, 119722, 215822, -183610, + 73014, 34897, -308164, -379031, 180389, 1119913, 266288, 1093606, -105227, -592706, + -106837, -833761, -357019, -23622, 442919, 491774, 562104, 102542, 309775, -155156, + 146029, 174483, -252329, 467615, 93416, 214748, -42413, -16643, 131533, -64961, + -121870, 78920, 114890, 99321, -205622, 21475, 47782, -24159, -155156, 99321, + 15569, -60666, 28454, 64961, 90194, -181462, -5906, -23622, -14496, -135291, + 6442, 70867, 73551, -25770, -40265, -16106, -27917, 90731, 39192, -24696, + -12348, 48318, -16643, -76773, 8590, 71941, -26844, -18790, -48855, 28454, + 37581, -24159, -33286, 11274, -8053, 7516, 25770, 19327, -12885, 48855, + -16643, -30602, -11811, 17717, 27917, -2147, + }, + { + 254477, 11651173, -591095, -1414655, 882616, 51540, 99321, 25770, -41876, -330712, + 210990, 176094, 19864, -99321, -302795, -516470, 402116, -68183, 467615, 128849, + -416075, -230854, -34360, -178241, -172336, -103616, 279173, 229781, 77309, -116501, + 361851, -308701, 177167, 378494, 309238, -259846, 10737, -8590, 128849, 19864, + 27380, -35433, -199179, 127775, -18790, 119722, -10201, -19327, 89121, 109522, + -254477, 30602, 44560, -100395, -12348, 77846, 37044, 72478, 18790, 10737, + -68719, 61740, 41339, 53687, -92879, 60130, 19327, 40802, -37044, 44560, + 537, -51540, 23085, 34360, -8053, 24696, -40265, -12348, 49392, -20938, + -23622, -11811, 38118, -14496, -24159, 10737, 9664, 38118, -28991, 4832, + 18790, -14496, -16643, 6442, -16106, -12885, + }, + { + 32749, 32927366, -282394, -2457258, 111132, 141734, 152471, -48318, 118112, 447213, + -562104, -387084, 162135, -466004, 317291, -747324, 31139, -35970, 51003, -104153, + -144418, -238371, 235686, 170725, 91268, 247497, -374199, 10737, -86973, 177167, + 317828, 114890, 60130, 154619, -88584, 353261, -56371, 24159, -138513, -221191, + 298500, -286689, 44560, 111669, -69793, -87510, 178778, 161061, 12348, 23622, + 26307, 34360, -20401, 88047, -7516, 38655, -23622, 13422, 61740, -104690, + -53150, 74625, 64425, 3758, 38118, 9127, -40265, 62814, -61203, 23622, + 62277, 29528, -92342, -3758, -7516, -5369, 25233, 7516, -9664, -28454, + 29528, 14496, 38655, -15032, -8590, 8590, -16106, 39192, -38118, -26307, + 5369, 19327, -6979, -6979, 15032, 10737, + }, + { + 257698, -4125316, -170188, -406411, 242666, -30065, -156229, 88047, -181999, 83215, + 52076, -11811, 383863, -499827, 4559645, -33286, -1282585, -2118493, 3093450, -405338, + -192200, -680752, 420907, 42413, 111669, -722091, -1163399, -405874, 998580, 95026, + -268435, 271120, -186831, 172336, -263604, 11811, -75162, 13959, -32749, 142271, + -44023, -111132, 115427, 38118, -47245, -103616, -33823, -78920, 49929, -185757, + 84289, -31139, -84826, 47782, 0, 3221, -31675, 70867, -17717, -64425, + 37581, 44560, -43487, -56908, 27380, 53150, 54761, 35970, -8590, 6979, + 88584, 2684, 13959, 24159, -22549, -37581, 15032, -14496, -2147, 37581, + 15032, 46708, -27917, -33286, 39192, -24159, 8590, 11811, -16106, 5906, + -13959, 5369, 23085, -1074, -25233, -3221, + }, + { + -2416993, 34308736, 918586, 2543158, -642098, 2147, -207232, 519154, -246961, -396748, + 471910, 220654, -156229, -532039, 406411, 130460, -44023, -146029, -26307, -68183, + -61203, 543850, -71404, -189515, -79994, -4832, 3221, 216896, -464393, 0, + 156766, 120796, 64961, 144418, -45097, -75162, 9664, -188979, -25233, 15569, + -110059, 353798, -172336, -114890, 1074, 127238, -2684, -107374, -192737, 6979, + 41876, -166967, 41339, -33286, 169114, -94489, 56371, 60666, 79994, -23085, + -96100, -10201, 0, 63888, 31139, -19864, -12885, 41876, 10201, -11811, + -6979, 2147, 15569, -20401, 18254, -66035, 20938, 39192, -5369, -13959, + 32212, -537, -18790, -56371, -11274, 10201, 26307, -4295, 59593, -40265, + 6442, 3221, 13959, 8053, -29528, -4295, + }, + { + -288837, -4832, 1939715, -95026, 3221, -46708, -53150, -28991, -24159, -5906, + -71941, 154619, 85362, -272194, 1178432, -30602, -128312, -119185, -79994, -347892, + -351650, 45097, -2529199, -116501, 45634, 605054, -360240, 93416, -282394, 221728, + -248571, 158914, 214748, -234613, 262530, 174483, -53150, 232465, 116501, -34360, + 209917, 38655, -125628, -16643, -81604, 11274, 108448, 75162, -41339, 46171, + -78920, -26307, -40265, 23622, -4295, -23622, -9664, 60130, -4295, -20401, + -25770, -29528, -30065, -42413, 0, -13422, -127238, 59593, 74625, 22549, + -87510, -23622, 49929, -18254, 16106, 42950, -19864, 24159, 36507, 24696, + -17717, 8053, 0, -4295, -8053, 3221, 31139, -31139, 6979, 7516, + -30065, -28454, -22012, 14496, -13959, -3221, + }, + { + -3602404, -30939870, -1835025, -336081, 107911, 125628, 363462, -115964, -59056, 12348, + 9127, 449898, -434865, -105764, 762357, -79994, 219580, 207769, -556735, -73014, + 202400, -200253, -22012, 400506, 87510, -277025, -192737, 97174, -442919, -276489, + 88047, -141734, -41876, 16643, -211527, -13422, -98247, -318901, 177704, 53150, + -148176, -3758, -16643, -140660, -216896, 118112, 17717, 69256, -339839, 32749, + 47782, 97711, -42950, -127775, -30602, -3758, 105227, 58519, 32212, 31139, + -37044, -62814, -40802, 63888, 46708, -40265, -12348, -15032, 13422, -18254, + -24159, 33286, -40802, 1074, 82141, 23622, -69256, 57982, 28991, -45097, + 45097, 0, -14496, 0, 9664, 4832, -20938, 16643, -1611, 24159, + 14496, -26307, 3758, 4832, 17717, -2147, + }, + { + -431107, 299574, 884226, 116501, 142808, -27380, -60130, -178241, 102542, 20938, + 77846, -93416, 83752, -598611, -1467805, -1195612, 322123, -1343251, -365609, -39728, + -69256, -614180, -601295, 525597, -282931, 557272, -226023, 1066763, -13959, 28991, + 29528, -472446, 310848, -161598, -19327, 58519, 41876, -259846, 154082, 41876, + 20401, 183073, -28991, 57982, -61740, 72478, -37581, -14496, 56371, 61203, + -12348, -40802, -93416, 8053, 113817, 41339, -69256, 44023, 53150, 41339, + 28454, -38655, 1611, 22549, -25233, -31139, -26307, -36507, 52613, 22549, + -1611, 8590, -49929, -58519, 52076, 53687, 22012, -16106, 27380, -27380, + 38655, 5369, -62277, -26844, -3758, -9664, -8590, 49929, -1074, -5369, + -2684, 13422, -4295, -6442, -2147, -3758, + }, + { + -830002, 2627446, -114354, -570157, -66572, 907312, -256624, -215285, -409633, -213675, + 164819, 59593, 346282, -31139, -55298, -119185, -307090, -8053, 256624, -70330, + -18254, -246961, -40802, -273804, 15032, 39192, 34360, -230318, 37581, -59593, + 124017, 197569, -291521, -48855, 446140, -5906, -127238, -65498, 114354, -130460, + 30065, 122943, 112743, -44560, -175020, 118648, 200253, 12885, 4295, -4832, + 106300, 10201, 56371, 194347, -34897, -92879, 59593, 71941, -39192, 46708, + -134755, -15569, 41339, -10737, 19864, -35970, 32749, 12348, -33823, 26307, + 15569, 3221, -19864, 9127, 1611, 22549, -8053, 36507, -50466, 34360, + 2147, -40265, -24696, 24159, -30602, 9664, 31139, 9664, -5369, 36507, + -2147, 32212, -24696, -11274, -16643, 22012, + }, + { + -128849, -79994, 787053, 232465, 15032, 192200, 279173, -437013, -88047, -297427, + 127775, 366683, -287763, -332323, -563178, 327491, 63351, -354335, 2147, 1053341, + -764504, -351650, -303869, 565862, -240518, -38655, 249108, -197569, -423591, -35970, + -494458, -165356, -79994, 74625, 1611, 19327, -63351, -222801, 18254, -85362, + 145492, -140123, -49929, 60130, 24159, -96637, 537, -81604, 80531, 27380, + 78920, 68183, 28991, -50466, -52613, 10201, -35433, -5369, 11811, -26844, + -23622, 105764, 2147, -67646, -24159, 52076, -40802, 12348, 73014, 2684, + 15032, -23085, -23085, -17717, 22012, 8053, 8053, -26307, -67109, 27917, + -2147, -27380, 52076, 18790, -33823, -10737, 9127, -20938, 17180, -30602, + -9664, 1611, -16643, 6442, -2684, 36507, + }, + { + -1240172, -8070244, -10737, -844498, -273804, 763967, -497142, 57982, -266825, 133144, + 409633, -544387, 235686, -137976, -217970, -359167, -10201, 238908, -537, 60130, + -133681, 141734, -200790, 162672, -97174, 164819, -253940, 326418, -180926, 260382, + -147103, 76773, -14496, -132607, 297963, 44023, -128849, -84289, -186294, -153008, + -36507, -69793, -337155, 47782, -9127, 100395, -68719, -61740, 69256, -39192, + 68183, 103079, -22549, 63888, -41339, 15569, 5369, 68183, 40802, -123480, + 56908, 33286, -57982, -46171, 117575, 5369, -28991, -1074, -62814, -42413, + 78920, -16643, -2147, -2147, 18254, 18254, -5369, 8053, -8590, -18254, + -20938, -6979, 25770, 13422, -2147, 25770, -33286, -537, -5369, -16106, + 15569, -6979, 32749, 19327, -18790, 3758, + }, + { + -61740, 1658931, -281857, -295816, 132070, -66572, 190589, -296890, -77846, -39192, + -341450, 317828, -669478, 1064615, 200790, 1852742, 24159, 41876, 64425, 249108, + 360240, -274341, 1701881, 623844, -552440, 181999, -9664, 508954, -243739, -497142, + -144418, -139050, -84826, -6442, -130460, 5369, -245887, 343061, -95026, 111132, + 93952, 66035, -61740, 83752, -56908, -10201, 11274, 69256, 74088, -63888, + -58519, 48855, 165356, -75162, 10201, 130460, 137976, -62277, 20938, 17717, + -102542, -107911, 95563, 14496, 26307, -67646, 88047, 20938, -68183, 49929, + 10737, -12885, -20938, -10737, -31675, 23622, 51003, 30065, -2147, 6979, + 30602, -28454, -37044, -19864, -23622, -10737, -12348, 37044, -6979, 8053, + -8590, -43487, 29528, 32749, -47245, 17180, + }, + { + 82141, 2718714, 805843, -1102733, -184684, -933082, -13959, -90194, 112206, 422517, + -336618, -223338, 246424, -405338, -1631551, 603443, -540629, -404264, 117575, -136902, + -161598, -146029, 234613, -238371, -56371, 41339, -118112, -158377, -163746, 315680, + -180926, -104690, 53687, -154619, -93416, -115427, 22549, -132607, -31675, -154619, + 57445, -37044, 96637, 47782, 52076, 31139, -167504, -162135, 25233, -61203, + 162672, -139050, 42950, 76773, -8053, -9664, -69256, -55835, 119185, -21475, + 32749, 32749, 32749, -2684, -32749, -23622, -83215, -2147, 20938, 30602, + -23622, 27917, -6442, 42413, -6442, -19864, -26307, 59593, 12885, -39728, + -27380, 15032, 7516, -45097, -13422, 4832, -59056, 15569, 38118, -2147, + 2147, 24696, -20401, -14496, -18790, 19864, + }, + { + 245350, 623844, -661425, -146566, 165356, 46171, -103079, 68183, -105227, 298500, + -84826, -152471, -404801, -2553895, 4179003, 2784213, -471373, -130460, 68719, 88047, + 668941, 138513, -2147, 552440, -279710, -362925, 527744, -633508, 86973, -220117, + -258772, 197032, 125091, 151934, 40802, -354872, 192737, 264141, -249108, 16643, + -160524, -9127, 151398, 303332, -248571, 160524, -4295, 14496, -40802, 37044, + -4295, -11274, 96100, 92879, -12885, -73014, -31139, 537, -60666, 20938, + 135828, -15032, -15569, -3758, 96637, 18790, 18254, -145492, 42413, 40802, + 4295, -61740, 57982, 38655, 17180, 72478, -49929, -12885, 25233, 32749, + 15032, -11274, -19327, -56908, 53687, -7516, 4832, 17180, 5906, -27917, + 8053, -3758, -23622, 8053, 24159, -4832, + }, + }, + { + { + 2046552, -6139119, -3609383, 1780264, 945967, -40802, -221728, 53150, -100395, -584116, + 148713, 423591, -27917, -331786, -1061394, 420907, 347355, -249645, 354335, 720481, + -139586, -57982, 177167, -52613, -88047, 11274, -161598, -527207, 263067, -7516, + -106300, -83215, -132070, -104690, 137976, -309775, -42413, -365609, -42413, 164819, + 34897, -84826, -42950, -133144, 44023, -111669, 185757, 39728, -123480, -114890, + 78383, -107911, 19327, 91805, -78383, 14496, -35970, -37581, -38118, -70867, + 90194, 40802, 34360, -44023, -8590, -17180, -26844, 69256, -3758, 1611, + -15569, -31139, -14496, 47245, 36507, -3758, -53150, 27380, -54761, -6442, + -9127, 3221, 11274, 9664, 24696, -64425, 23085, -13422, -5906, 2147, + 20401, -8590, 14496, 5369, -4295, -4832, + }, + { + 18790, 2990908, 652298, -227633, 368830, 102005, -50466, -85899, 126165, 93952, + 30602, -179852, -474594, 947040, -964220, 1574106, 395137, 337692, 602369, 238371, + -242129, -626528, -541703, -240518, 296890, 487479, 190052, 602369, 225486, 17180, + -281857, 35970, 228170, 252329, 190589, 254477, -181462, -42413, 120259, -17180, + -136902, -13959, 10201, 70867, -72478, -22012, -22012, 33823, -100932, 53150, + -5906, -17180, -95563, 54761, 147640, -56908, -66035, -57445, 2147, -112743, + -30065, 23622, 69256, 6979, -37581, 4832, -74088, 35433, 32212, -4832, + -17180, 55835, 16643, -39728, -16643, 61740, 18254, 5369, -60130, 3221, + 27917, 5906, -42413, 11811, -23085, -10201, 10201, 15569, -37581, 37581, + 1074, -26844, -26844, 10201, 20938, 5369, + }, + { + -41876, 9500468, 1522566, -1263794, 358093, 279710, 34360, -84289, 139586, -143881, + 74088, 216359, -45634, -90731, 47782, -806380, 100932, -41876, 1028108, -519154, + 391379, -783832, 157303, 111669, -495532, -264141, 200790, 217433, 41339, 72478, + 382789, -417149, 100932, 277562, 419296, -163746, -86973, 16643, 117575, -10737, + 170188, -157840, -86436, -3221, -56371, 95563, -28991, -44560, 32212, 105227, + -127775, -60666, -44023, -50466, -45634, 105764, -13959, 87510, 65498, 30065, + -59056, 24696, 12885, 90731, -73014, -33286, 47782, 20401, -22012, 44023, + 18790, -48855, -24159, 24696, 33823, 61740, -40265, -62277, 64425, 1611, + -8590, -26844, 23622, 17180, -30602, 3221, -1074, 33286, -15569, 5369, + 20401, -2147, -14496, -1074, -1074, -22549, + }, + { + 4438849, 28569586, -960999, -2702071, 30602, 0, 240518, -90194, -96100, 373125, + -61740, -307627, -74088, -59056, -332323, 41339, -193810, 212064, 292058, -230318, + -184147, -40802, 54761, 157303, 139050, 295816, -381715, -141734, 10201, 88584, + 191126, 166430, 24159, 103616, 20401, 161598, -56371, 178241, -260919, -127775, + 312459, -121333, -55298, 136902, -49392, -128312, 141734, 76773, 55835, 10737, + -108985, 156766, -46171, 59593, 31139, 42413, 73551, -85362, 53150, -30065, + -51540, 22549, 67646, -92342, 36507, 9664, -40265, 79994, -40265, -2684, + 26844, 93416, -34897, -28454, 9127, -537, 10737, -2147, -23622, -27380, + 1611, -8053, 42413, -16106, 6442, 17180, -23622, 22549, -13959, -28991, + -8590, 19864, 2684, -12348, 13422, 4295, + }, + { + 17717, -3473555, -287226, -243203, 168577, 8590, -185220, 11811, -133144, -93416, + 93416, 140660, 9664, 734976, 3055869, 973347, -1679869, -1649804, 789737, 312996, + 44023, -276489, -259309, 1136556, -732829, -515933, -681826, -786516, 814970, 800475, + -344134, 476205, -215285, -40802, -187368, 17717, -56908, -208843, -39192, -85899, + 13959, -64425, 35433, -24159, 42950, -141734, -62814, -94489, 56371, -156229, + -25233, 107911, -149250, 105227, -27380, 70867, -37044, 32749, 73551, -95563, + -19327, 41339, -37044, -62814, -23085, 39192, 20938, 57445, 2684, -23622, + 121333, 45097, 1074, 21475, -3221, -54224, 537, -18254, -37581, 13422, + -7516, 48855, 20938, -53150, 26844, -10737, 9127, 22549, -18790, -2147, + -17717, -1611, 25770, 8053, -32749, -9127, + }, + { + 7599945, 23500450, -847719, 1565516, 10737, 60666, -242666, 320512, -57445, -618475, + 369367, 214212, 136902, 179315, -681826, 269509, -28454, -231391, 47782, -164283, + -134218, 183073, 299574, -71941, -219043, 177167, -202400, 313533, -376347, -100395, + 156766, 290984, 4295, -47782, -52076, 104153, -100395, -25770, -191126, 10201, + 6979, 120259, -22549, -137439, 187368, -47245, 212064, -153008, -153008, -92342, + 149787, -98247, -103616, -82141, 150861, -20938, -62814, 17180, 40802, -9127, + 6979, -69256, -33823, 52613, 63888, -7516, 3221, 25770, 10737, -3221, + 1074, -12348, 31675, -30602, 27917, -61203, -7516, 22012, 14496, -2147, + 25233, 47245, -1074, -45097, -30065, -11274, 15569, -22012, 53150, -15569, + -2684, 3758, 3221, 23622, -20401, -13959, + }, + { + -113817, -331249, 1200443, 226560, 10737, -35433, -130460, -73014, -25770, 124017, + -68719, 68183, 79457, 4832, 1956895, 559420, -213138, 149250, -11274, -736587, + -166967, -301185, -2736968, 608275, -136365, 1017370, -804233, -219043, 158914, 282394, + -380641, 85899, 292058, -256087, 79994, 17717, 135291, -537, 166967, -71941, + 107374, 50466, -50466, -27917, -132070, -79457, 170725, -20401, 2147, 44560, + -6979, -76236, -56371, 27380, 41876, -44560, -78383, 95563, -34360, -22549, + -24159, 12348, -48318, -26307, 1074, -34897, -87510, -20938, 72478, 46708, + -25770, -65498, 13422, 9664, -46708, 14496, -21475, -14496, 23085, 38118, + -9127, -2147, -4832, 4295, -15569, -6442, 40265, -9664, 19864, 33286, + -537, -12885, -25233, 10201, 2684, -14496, + }, + { + -327491, -35970888, -976568, -616865, 170188, -34360, 753767, -166430, -110059, 3221, + -5369, 350040, -64425, -27380, 428960, -91268, 41339, 686121, -449898, -473520, + 229244, 64425, -377420, 236223, 144955, -207232, -92879, -160524, -173409, -146566, + -119722, -150861, -162672, -51003, -156766, -191126, -17717, -235686, 25233, 180389, + -96637, -24159, -101469, -537, -223338, 255551, 25770, 82678, -178778, -34360, + -55835, 199179, 105764, -127775, -38118, -45097, 1611, 41876, 51003, 28454, + 46708, -46708, -68183, 29528, 80531, -5369, -13422, -45097, 22549, -17180, + -27917, 30065, -37044, -60130, 49392, 69793, -92879, 24696, 27917, -23622, + 4295, 28454, -11274, 10201, 18254, 537, -41876, 5906, 3221, 10201, + 9664, -22012, -2147, -6442, 11811, 9664, + }, + { + -170725, -905164, 633508, 70867, 125091, 24696, -24159, -226560, 101469, 72478, + 145492, -27917, -40265, -1506460, -205622, 606127, -861678, -292058, -460098, -439697, + 112206, -447750, 135828, -753230, -28991, 790811, -42950, 596464, -67646, 34897, + 80531, -199716, 208306, -105227, -232465, 74625, -6979, -203474, 205622, 1611, + -95563, 122943, 45097, -161598, 10201, -77846, -63351, 108448, -1611, 48855, + 59056, -32212, -97174, -25770, 140660, 57445, -97174, -20938, -31675, 60130, + 63351, 81604, -27380, 23622, 20401, -17180, 13422, -31139, 32749, 52613, + 42413, 28454, -27917, -71941, 20938, 56371, 37581, -21475, 23085, -20938, + 12348, 46171, -40802, -28454, -10201, -25770, -32749, 16106, 24159, -4295, + -18790, 15569, 1074, -4832, -3221, -22012, + }, + { + 1017907, -2684355, 436476, 630286, -157303, -111132, 361314, -144418, -504659, -336618, + 123480, -108985, 272730, 402116, -372588, 47782, -388695, 25233, 127775, 73551, + -222265, -219580, -131533, -19864, -101469, -19864, -128312, -40265, 34897, -118648, + -61203, 107911, -285078, -215285, 358630, 210990, 18790, -67109, 91268, -94489, + -75699, 11274, 103079, 99321, -171262, 33286, 206158, -9127, -48855, -11274, + 53150, -3758, -44560, 112743, 66572, -70867, 63888, 63351, -38118, 75162, + -60130, -57982, 26307, -35433, 53150, -33823, -537, 11274, -41339, 20401, + 26844, 8590, -57445, 23622, -3758, 24696, -39192, 54761, -33286, 38118, + 18254, -21475, -44560, 7516, -42950, -37581, 12885, 7516, -14496, 18790, + -11274, 39728, -2684, -17717, -23085, 4295, + }, + { + 200790, 1949915, -560493, -124554, -69256, -15032, 166430, -345208, -249645, -207232, + -119722, 298500, -157303, -44023, -808528, -117575, 606127, -256087, 13422, 1025960, + -104153, -600222, -1074, 82141, -12348, -344671, 151398, -166967, -52613, 2684, + -401043, -155156, -286152, 54761, -115427, 223338, -51540, -121333, 40265, -124554, + 99858, -29528, -85899, -28454, -10737, -120796, -9664, -16643, -33286, 3221, + 15569, 75162, 93952, 31675, -46171, 12348, -29528, -36507, 11274, -18790, + -55835, 62814, 30602, -54761, -64961, 39728, -26307, -35970, 34360, 15032, + 21475, 19864, -17180, -30602, 16643, 27380, 39728, 9664, -57982, 4832, + -4832, -26844, 38118, 45097, -6979, -20938, 24159, -4295, 40265, -17717, + -15569, 0, -10737, 12348, -16106, 25233, + }, + { + -415538, -10173167, -2684, -172872, -358093, 154619, 185220, -129386, 20938, -179315, + 426276, -25233, 153008, -278099, -155156, -77309, 15032, 172336, -121333, 112206, + -281857, 30065, 47782, 17717, -164283, 185220, -181999, 186831, -96100, 250719, + 93416, -67109, 4295, -17180, 172336, 222265, 129923, -13959, -173409, -139050, + -165356, -88584, -166430, -56908, -67646, -16106, 55835, -10737, 39728, -15569, + -66572, 95026, -57982, 86973, 6979, 54761, 11811, 26307, 120796, -156229, + 27380, 32212, -20401, -62277, 92342, 10737, -8590, 11811, -44560, -67109, + 58519, 5906, -20938, -10201, -537, 17717, 1611, 23622, 14496, -27380, + -7516, -41339, 15032, 1611, -12348, 39192, -22012, -2684, -5369, -38655, + -1074, -22012, 16106, 21475, -10201, -3221, + }, + { + 54224, 1249836, 245350, -234613, 26307, -73014, 228170, -52076, -155156, -370978, + -213138, 130460, 829466, -797253, 15032, 1801739, 449898, -405874, 205085, 70330, + 1779727, -633508, 854699, 364535, 322659, -292595, 289373, 170725, -48318, -568009, + -181462, -81604, -78920, 37581, -149787, 118112, -197032, 241055, -117575, 76236, + 34360, 8590, -28454, 89657, -89657, 11274, 50466, -56908, 45097, -46708, + -44023, -13422, 102005, -17717, -23085, 6442, 150324, -32749, 4295, 77846, + -55298, -134218, 16643, 47245, 57982, -56908, 59056, 68719, -69793, -4832, + 32749, -6442, -10737, -5369, -48855, -31139, 34897, 22549, 18790, 12348, + 33286, 5369, -30602, 6979, -19327, 3758, -39192, 34897, 10737, 1074, + 3221, -48318, -8590, 36507, -35433, -16106, + }, + { + 482110, 3390340, -150324, -2147, -15569, -739808, -671626, 20938, -146566, 282394, + -364535, -108448, 186294, -564788, -925565, 236760, 15032, -169114, -35433, -81604, + 27380, -331249, 300111, -323733, -75162, -178778, -130997, -301721, -149250, 170188, + -113280, 31139, 106300, -57982, -2684, -132070, 19864, -162135, -48855, -67646, + 24696, -112743, 76773, 127775, 68719, 76773, -132070, -128312, -15032, -39192, + 116501, -10737, -84289, 26307, 108448, 16643, -30602, -69793, 87510, 18254, + 53150, -2147, 35970, 55298, -25770, 3221, -72478, -11811, 3221, 46171, + -32212, 15569, 1611, 28454, 4832, 537, -34897, 51540, 54224, -4295, + -33286, 12885, 32212, -24696, -9664, 32749, -48855, -26844, 24696, 13959, + -2147, 36507, -6442, -6442, -14496, 9664, + }, + { + -83752, 1682017, -935766, -201327, 127775, -40802, 205622, 85899, -210990, 111132, + 47782, 235149, -1140851, 2448668, -2413235, 2309082, 429497, 387084, -48318, 137976, + 1018444, 35433, -101469, 136365, -140123, -172872, 198642, -60130, -319438, 35970, + -454730, -41876, 344134, -50466, 115964, -217970, -65498, 126702, 146566, -172336, + -155693, -178778, 130460, 208843, -105764, 4832, 68719, 9127, -74625, 17717, + 25233, 15032, 7516, 46171, 57982, -17180, -95026, 22012, -118112, -95026, + 55298, 66572, -86973, -17717, 34897, 40802, 94489, -153008, 8590, 10201, + 31139, -73014, -8053, 28454, -22012, 81068, -26844, -35970, 3221, 17717, + 59593, 537, 27917, -52613, 15032, 0, 3758, 22012, 10201, -13422, + 537, 16643, -21475, -4295, 9664, 6979, + }, + }, + { + { + -1145146, 7047505, 5786395, 97174, -794569, 171262, 230854, 100395, 192200, -178241, + -369367, -115964, 140123, 438624, 130997, -52613, 391379, -272730, 324807, -358630, + 19864, 159451, 320512, 5906, -101469, -159988, 137976, -553514, 293132, -67646, + -76773, 125628, -9127, 132070, 35970, 82141, 127775, -209380, -137976, 70330, + 86973, 23085, -115964, -114890, 220117, -271657, -44560, 57445, -79994, -76236, + -2684, -109522, -30602, 12348, -20401, 15569, -47782, 18790, 80531, 27380, + -50466, -40802, -4295, 34897, -8053, 31139, 29528, -41876, 0, -9127, + 25770, 28454, 4832, -18790, -30602, 64961, 9664, -34360, 52613, -23085, + -8590, -49929, -14496, 1611, -13422, 38118, -36507, 20938, -8053, -13959, + -11811, 7516, -13422, 16106, 9664, 2147, + }, + { + 53150, 1136019, -690953, 325881, -400506, 26844, 48855, -32212, -294205, 285615, + -4832, -65498, -583042, 394063, -2593624, 601295, 626528, -419833, -379568, 666257, + -227096, -430034, 273267, 136365, -91805, -366683, -386547, 50466, 153008, 220654, + 22549, 414464, -51003, -199179, 271120, -3221, -62814, -141734, -39728, -31139, + 40265, -1074, -143881, -71404, 96637, -127775, -112743, -58519, 97174, 73551, + -84289, 201327, -30065, -44023, -183073, 121870, 59593, -54761, -1611, 41876, + -27917, -35433, 20401, 45634, 28454, -3758, 50466, -67646, -54224, 11274, + 15569, -46708, 46171, 51003, -8590, -57445, 17717, 60130, 17717, -12348, + -63351, 44560, 32749, -537, 11274, -11274, -28454, 2684, 8053, -52076, + 14496, 25770, 7516, -8590, -24159, -3758, + }, + { + 35433, 3639448, -1124745, 472983, -488016, 8053, -47782, -248571, 47782, 229244, + 151398, 23622, -108448, 592169, 202400, -229244, 135828, -134755, 66035, -498753, + 256087, -509491, -6979, 226023, -107374, 53150, -44023, -170188, 118648, -164283, + 113280, 124017, 101469, 15569, 96100, 267899, -35970, -58519, 53687, -82678, + 51540, -19327, 211527, -165356, -26844, -99858, -23622, -57445, -66035, -30602, + 83215, 59056, -119185, 10737, -90194, -65498, -16643, -38655, 11811, 38655, + 32212, -35970, -16106, -67646, 42950, -51540, -19327, 6442, 51540, -33286, + -3758, 64961, -24696, -26307, 2147, 4295, 57982, 9127, -24159, 1074, + 23085, 0, -37044, 28454, 38118, -12348, -19864, -22012, 17180, -6442, + -13959, 6442, 20401, -10737, 14496, 24159, + }, + { + -7080254, 14835354, 1129576, -2214056, 297427, -78920, -155693, -42413, -258772, -88047, + 113817, 361851, 122407, -194347, -788127, 363462, 87510, 8590, 226023, 20938, + -15569, 318364, -88047, -118648, 131533, 106837, 184684, -136902, 246961, -106300, + -192200, 89657, -74088, -79457, 107911, -255551, -102005, -116501, -30065, -1611, + 34360, -103616, -78383, 10737, 115427, 39192, -176631, -84826, -109522, 118648, + -106300, 38118, 60666, -37044, 70330, 6442, 18790, -95563, -47245, 79457, + 82678, -18254, -71941, -13422, -28454, -16106, 31675, -39728, 47245, -22549, + -60130, -16106, 83215, 14496, -9127, 17180, -10201, -7516, -10201, 16106, + -3221, -24696, -26307, 537, -6979, 9127, 20401, -37044, 36507, 17180, + -11811, -19327, 9664, 6979, -9664, -16643, + }, + { + -149787, -3486977, 539018, 268972, -192737, 57445, 40265, 40265, -5369, -147103, + 0, -68719, 177167, -845572, 160524, 639950, -240518, 1553704, -3066070, -318364, + -103079, 246961, -501437, 1001801, -174483, -250182, 1108102, -198105, 443455, 534187, + -442382, 302258, 413391, 38655, 537, -130460, -102542, -88584, -18254, 14496, + 73014, 193810, 0, -166967, 161598, -24696, -31139, 100932, 107374, 85362, + -123480, 69793, 110059, 26307, -91805, 74088, 48318, -49929, 48318, 537, + -57982, -36507, 3758, -8590, 0, -15032, -37581, -24696, 11811, 9127, + -39728, 22012, 15569, -10737, 13422, 41876, -10201, 19327, 8053, -37044, + -19864, -52613, 20938, 29528, -47782, 25233, -10737, -4295, 16106, -4832, + 1611, -4832, -27380, -1611, 28991, 6442, + }, + { + -9774809, 1189169, 1531156, 1238024, 4832, 20938, 37581, -693100, 280247, 440771, + -438624, -348429, 62814, 374736, -732292, -22012, 98784, 126165, -102542, 122943, + 220654, -292058, 95026, 163746, -8590, 19864, -202400, 63351, -78383, 107374, + -33823, 66035, 11274, -36507, -169114, 282394, -34360, -62814, -90731, 161598, + 149250, -186831, 27380, 46708, 333397, -169114, 159451, -12348, 22549, -77846, + -69793, 135291, 39728, -16643, -114354, 61740, -59593, -83215, -71404, 8590, + 92342, 21475, -35970, -51003, -61203, 3758, 48855, -46708, 15032, 26844, + 18790, -8590, -41876, 9664, -3758, 18254, -24159, -40802, 5906, 11811, + -40265, -4832, 17717, 60666, 5369, 537, -24159, 17180, -47245, 27380, + -1611, -6979, -8053, -12348, 20938, -537, + }, + { + 260382, 718870, -732829, 3758, 8590, 71941, 10201, -5906, -226023, 102005, + 45634, 66572, -61203, -304943, 2093260, 1314260, 962073, 1074, 74088, -532039, + 162135, 214748, -1695975, 773094, -69256, 345208, -598611, -623844, 271120, 63351, + -194884, 38655, -124554, 199179, -54224, -270046, 199716, -54224, 112206, 162135, + -115427, -136902, 155156, -93952, 148713, 9664, -54761, -100395, 42413, -33823, + 121870, 1074, -24159, -27917, 31139, -4832, -15032, -68719, -16106, -15032, + -63351, -19327, 40802, 6979, 2684, 8590, 48855, -39728, -60130, -52613, + 102542, 30065, -46708, 14496, -5906, -27380, 9127, -37044, -32212, -21475, + 19327, -5369, 9127, 3221, 1611, -13422, -23085, 17717, 1074, -5369, + 22012, 20938, 24159, -18790, 17717, 4832, + }, + { + 4620311, -32770064, -661962, -207232, 214212, -133681, 232465, 142271, -50466, 179852, + -13422, -384936, 420907, -30602, -386010, 30602, -233002, -93416, 468688, 246961, + -176631, 212064, -341450, -317291, -119722, 131533, -64961, -44560, -108448, -21475, + -213138, -227096, 29528, 56908, 158914, -10201, -265751, -118648, 7516, 54761, + 37581, 128312, 20938, -117575, 129923, 163746, -26844, 81604, 198105, 35970, + -109522, -104690, 26307, 160524, 34360, 4832, -90731, -2684, -34897, -39728, + 62814, 84289, 44023, -55835, -22549, 18254, 3758, -2684, -12348, 30065, + 20401, -11274, 24696, 3221, -78383, -1611, 70867, -54761, -24159, 23085, + -45634, -4295, 1074, 12348, 12885, 14496, 18790, -18790, 8590, -13959, + -16106, 9664, 9127, -10737, -15032, 1611, + }, + { + 397284, 507880, -1720671, 204548, -200790, -3758, 140660, 255014, 81068, -37044, + 76773, -30602, 274341, 1242319, 1877438, 2159295, -366146, 55298, 139050, -439160, + -609349, 28454, 455267, -84826, -567473, -131533, 562641, -332323, -199179, 66035, + -180389, 245350, -104153, 102542, 70330, -279710, -59056, 69256, -141197, 108448, + 2684, -147103, 236223, -20401, 59056, -191663, -15032, 76773, -47245, -99321, + 60130, 31139, 89657, -67646, -30602, -16106, 106300, 10201, -161061, -38118, + -33286, 42413, 1611, -63888, 36507, 58519, 77846, 37044, -19864, -14496, + -537, 15032, 41339, 49929, -29528, -15569, 3758, 5906, -30065, 9664, + -47245, -6442, 51003, 24159, 20401, 11274, -537, -51003, -7516, 2147, + 1611, -16643, 6442, 13422, 6442, 12885, + }, + { + -701690, -8054675, -903017, 548145, 227633, -973347, 318364, 9664, 193274, 189515, + 24159, -102005, -299037, -200253, -41339, -583579, -105764, 186831, -256624, 17717, + 274878, -213138, 26844, 183610, 127775, -185757, -196495, 275952, -99858, -316754, + -130997, -146566, -82678, -35433, -148713, -99858, 175557, 64961, -172872, 183073, + -118112, -68719, -86973, 102005, 212064, -85362, -152471, 6442, 137439, 29528, + -173409, 54761, -90731, -239981, 117038, 76773, -17717, -39728, 45097, -68183, + 128312, 1074, 1611, -44560, -10201, 49929, -26307, 1074, 37044, -18254, + -19327, -12348, 13959, -18790, 19327, -19864, 1611, -30602, 32212, -22549, + 6442, 23622, 16106, -22549, 28991, -13422, -32749, -8590, 4832, -34360, + 2684, -24159, 24159, 13422, 19327, -19864, + }, + { + -173409, 4221416, 1459752, -702227, 120796, -195958, -204548, -136365, -32212, 118112, + -62277, -348429, 336618, 54224, -530428, -437550, 511638, 751082, 583579, -1006633, + 52076, 401043, 340376, -151398, -176094, -52613, -344671, -270583, -226023, 10737, + 150324, 76236, -315143, -192200, 5906, -238908, -130460, 15569, 127775, 64425, + -8053, 120259, -10201, -113280, -43487, 15032, -2147, 116501, 24696, 29528, + -55835, -117038, -19864, 44560, 57982, 17717, 53687, 23622, -42950, 24159, + 41876, -106300, 3221, 31675, 51540, -71941, 47245, -7516, -84826, 537, + -24696, 25233, 26307, 15032, -33286, -20401, -9664, 9664, 70330, -30065, + -1074, 33823, -40802, -18790, 24159, 7516, -11811, 18790, -19327, 33286, + 6442, -7516, 12885, -1611, 1074, -36507, + }, + { + 2574296, -7587060, -884226, 25770, 383326, -1162862, 451508, 216359, 68719, -193274, + -359704, 476741, 158914, -108985, 236223, 410706, 461709, -106300, -5906, -331786, + 222265, 71404, 92342, -115964, 130460, 9127, 96637, -348966, 66035, -170725, + 127238, -113280, -166430, 376883, -123480, -113817, 13959, 166430, 257161, -19864, + 28454, -7516, 190052, -90194, 10201, -129386, 78383, 44560, -61740, -75699, + -537, -41876, 40802, -56908, 42413, 35970, -3758, -17180, 17180, 20938, + -13422, -38655, 51003, 32749, -72478, -19327, 28454, -10201, 37581, 19864, + -68719, 28454, -1074, -14496, -5906, -18790, -6442, 10737, 10201, 4295, + 14496, -2684, -36507, -16643, 4832, -51540, 31139, -2147, -4832, 14496, + -27917, 2147, -30602, -23085, 11274, 3221, + }, + { + -10201, 1111860, 398895, 448287, -88584, 117575, -281320, 209380, 62277, -155693, + 335007, -104690, -169651, -691490, 1420560, -191126, 1041530, -368830, -343597, 44560, + 133144, 841277, 326418, -461172, 680215, -168041, -133144, 337692, 91268, 396211, + -269509, 270046, 38655, 158377, -73014, -76773, 238908, -38655, 63351, -132607, + -129923, -116501, -2147, 13959, 86973, 14496, 55298, -199716, -39728, 83215, + 32212, 537, -88584, 16643, 42950, -55835, -157840, 28991, -18254, -5906, + 57445, 115427, -80531, -53150, -48855, 77309, -26844, -1074, 30602, -25770, + 8053, -25233, 15032, 12348, 52613, -17717, -30602, -45097, -3221, 5369, + -27380, 30065, 11811, 17717, 19864, -1611, 21475, -34897, 4832, -4832, + 11274, 42950, -28454, -42413, 42950, -11274, + }, + { + -1234266, 1752347, 988379, 932545, -103616, 18790, -243203, 222801, 202400, -342524, + 233002, 137439, -427886, 405874, 274341, -455803, 162135, -207769, 71404, -116501, + 168577, 109522, 42413, 212064, 25770, 127775, -21475, -319975, -166430, -298500, + 250719, -77846, -36507, 187368, 358630, -139586, -26307, 27917, 44023, 257698, + -147640, -154619, -227633, -192200, -99321, 66035, 83752, 112206, -58519, 92879, + -169114, 115427, -13959, -82141, 39728, -3758, 91268, 30602, -71404, 23622, + -6979, -1611, -5369, -38655, 22549, 3221, 85899, -24696, 2147, -11274, + 51540, -20938, 22012, -47245, -2147, 23085, 53150, -39192, -23085, 27917, + 16106, -18790, 4832, 39192, 6979, 0, 59056, -24159, -42950, 14496, + 8053, -23085, 20938, 5906, 19864, -21475, + }, + { + 17180, 2062121, 301721, 114890, 50466, -30065, -46171, 1611, -185220, 171262, + 187905, -37581, 234076, 3027952, -8257075, -61740, 688269, 709743, -482110, -154082, + 864362, 63351, -469225, 453656, 618475, 268435, -2147, 293668, -130460, 506269, + -184147, -376347, 193810, -307627, -273804, 341450, -75162, -503048, 365609, -24159, + 96637, -90731, -138513, -220117, 210990, -95026, 45097, 173409, -25770, -13959, + 46708, 23622, -18790, -125628, 5906, 111669, 5906, -37044, 37044, -28454, + -147640, 13959, -13959, -27380, -9664, -46171, -10201, 154082, -53687, -23085, + -10201, 42413, -39192, -20401, 0, -69256, 63351, 28454, -13959, -43487, + -27917, 2684, 26844, 66572, -48318, 11274, 10737, -23085, -8590, 29528, + -7516, 3221, 24159, 1074, -27380, 3221, + }, + }, +}; + const float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= { { @@ -20372,6 +39940,9110 @@ const float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MA } }; +const Word32 leftBRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= +{ + { + { + 5312338, -15328201, 16282758, 29370596, -15591268, 12818330, 1811403, 182536, -9895068, 2481417, + 491237, -11926587, 5715528, 5282810, 6278706, -12351789, 2285460, -4657892, 11144366, -3479461, + 4906464, -3717831, 3595961, -5890011, 6990596, -3155727, -4663261, -1210644, 6162205, -3131031, + 4348655, -2241436, 2251100, -799401, -1116155, 9625559, -1194538, -4785131, -2711735, 572304, + 6594923, 6273874, -7301982, -2674691, 1289027, 1906966, -487479, 1509144, -726386, 770410, + 226023, -288300, -2494302, 4155381, -2242510, -2687576, 521839, 1523103, 280247, 1378148, + -532576, 742493, -259846, 596464, 257161, -393526, 1384053, -1336272, -2343442, -372588, + -831076, 597000, 5369, 1152662, -3325915, 3321620, 296353, -28991, 1579474, -716723, + -1385664, 824097, -137976, 889058, -1136556, 190052, -27917, 1329829, -2356863, 166967, + 546535, 307090, 70867, 149250, -1052804, 570694, + }, + { + -1878511, 17737678, -17321604, 19983410, -14324253, 7502234, 2997887, 3507378, -8614631, -1859184, + 1334661, -6471979, 993748, 1572495, 8171176, -13944148, 4880694, -3664144, 10201084, -4412542, + 730681, -2709588, 8744553, -5805722, 1595580, -5035849, 3263638, -2362232, 540629, -3300682, + 6315750, 2110440, -6184216, -4188667, 5704254, -1165010, 4133369, -6009733, -1692217, -3385508, + 5913633, 5572183, -5843840, -2107755, 4840965, -2926483, -1759326, 2276333, -584652, 3922916, + -2763812, -1257889, -41876, 1346472, -2653753, 3075734, -2070711, 2164127, -2144799, 1511829, + 1400696, 883153, -2318746, -430034, 2891050, -3351685, 4524748, -2738042, 1201517, -2592550, + 1482838, -2003602, 494458, -41339, 85899, -975494, 364535, 1664837, 1857037, -461709, + 230318, -395674, 814433, 67109, -1385664, -938450, 1464584, 335007, -806917, -1799054, + 1691680, -73014, 67646, -622770, 793495, 709207, + }, + { + 1511829, 1513976, -4419522, 27764280, -14358076, 13790603, 3252364, -9540733, 794032, 5572183, + -6106370, -10015327, 8767102, 3111167, -2601677, -3448859, 7910256, -4816269, 2439542, -885300, + -1461900, 4851166, -1792075, 1909113, -579284, 5089000, -9176198, -9768366, -688805, -1454383, + 9844602, -1716913, -1995549, 9068823, -1946157, -3422015, 2071785, 4333085, -2915209, -3728569, + -13959, 2765959, 3430068, -293668, -28454, -5693516, 4027069, 4806069, -1596654, -4428112, + 1627256, -1127429, -3068217, 1995549, 1992865, 16106, -1770600, -3318399, -153545, 3567507, + 1425929, 1480153, -384936, -407485, 2409477, -1116155, 1678259, 139050, 826244, -3308199, + -1213865, -1698123, 1036161, -883690, 1144072, -2500745, 1324461, 1468342, 670552, 235686, + 1043140, 724239, -1097364, -133144, 239981, 1453846, -2284386, -932545, -658204, 2100776, + 11811, -593779, 243739, 1205275, -233002, -308164, + }, + { + 14759118, -47656956, 15619185, 18750216, -6482717, 6076842, -2073396, 3107946, -3583077, -8136279, + 5846524, -5396627, 5415417, 3515431, -757525, 9468255, -2396592, -4336307, -2494302, 4351876, + -3119220, 7886097, -6424198, -7972533, 10735808, 5888400, -7277285, -6745783, 6926709, 6168110, + -3765613, -1012539, 4037806, -4781909, 1706176, 630286, 2334852, -3817152, 2831457, -2628520, + 685584, 682363, 853088, -1152662, 1496796, 1825898, -3122978, 358093, 3617973, -2821257, + 649077, 2146410, 584652, -2779918, 1059246, -1236951, -1378148, 2666638, -2761664, 2726767, + -300648, 172872, -129386, -22012, 34360, 664109, -46171, 652835, -871878, -1017370, + -888521, -346819, 330712, 368830, -168041, 1155883, 159988, -90194, 309775, 184147, + 350577, -603980, -401579, 405874, -298500, 578747, 475668, -1049046, -585726, 303332, + 681826, -453656, -831076, 666257, 137439, 340913, + }, + { + -235686, 11187316, -20111722, 23366770, -21138218, 8778913, 6176700, -1894618, 927176, -2820183, + -3235721, -7745974, 5153961, 7634841, -10519986, 10456098, 8409009, -14551886, 10614475, -1965484, + -3012383, 6664179, -2268817, -12690018, 16714939, -3394098, -7367480, -9629317, 10082973, -6877854, + 10856604, -9347459, 6423124, -5399311, -974421, 3379066, -2268817, -4389994, 7019051, -2147484, + 2791729, 865973, -1511829, -3963181, 2746095, 5527623, -6184753, -1511292, -1290638, 6837051, + -1390496, -1603097, 1284195, 691490, 1523103, -1762010, 821413, -711891, -444529, 3688840, + -1002875, -2233383, 92342, 1019518, 1869385, 1480690, -2762201, 734976, -2713883, 2064806, + -1337882, 135291, -1392106, 1134945, 481036, -286689, 561030, -596464, 1449015, 423054, + -1340030, 628139, -649077, 1489817, -2268817, 967978, 784905, -872415, -373662, 521302, + -136365, 692027, -1122597, -38655, -172872, 428960, + }, + { + 19509352, -64412700, 23457500, 21772800, -2419677, 2259153, 3331821, -3532611, -4037806, 1436667, + 5179194, -17941690, -4281546, 16269873, -9058086, 14944339, -3533148, -10220948, -1289564, -2030446, + 15389942, -11142756, -10510859, 4478577, 5759551, -5384815, 12187507, -11731166, 9569187, -7611756, + -1301912, -5772436, 8174397, 8390755, -2353642, -2870649, -582505, -3890704, 5292474, 463320, + 1320166, -7281044, 2638721, 3129421, -1117765, -3943854, -228707, 807991, 28454, 1709934, + -1439351, -63888, 2142652, 401579, 752693, 1597728, -635655, -3596498, 497142, -411780, + 688269, 2191507, -5393405, 3028489, -1174674, 90731, 2779918, -830539, -1854352, 920734, + -1211718, 120259, 1400696, 1611687, -2023467, 1606855, -110595, -204548, -257161, 272730, + -1467268, -1513976, 706522, 87510, 536334, 1636383, -404264, -173409, -1279900, 243203, + 35970, -163746, 515396, 511101, -33823, 1058173, + }, + { + -1795833, 20707112, -32792076, 23744726, -18837726, 7560216, 6619619, -1218697, -2314451, -2202781, + -556735, -3958886, -12127914, 5669357, 3277060, 12116640, 62277, -9705015, -2224256, -2025614, + 10918344, 76236, -12405476, -7141457, 6460168, -2634426, 15206332, -15780784, 4519380, 1002338, + -9215926, -4342212, 11005854, 613107, -744103, -6572911, 1298154, 1505386, 2160369, -143881, + -920734, -3894462, 4447976, -434865, 1169842, -1978906, 2633889, -1066226, 268435, -2422899, + 1462973, -549756, 3957812, -616865, 2720325, -884226, -37581, -2654827, 3102040, -2392834, + 158914, -987306, -2294586, 1512365, 1766842, -1382980, 2263985, -2747705, 431107, 519154, + -271120, 505196, 587337, 449361, 1513439, -989990, -251792, -56371, -712965, -1046898, + 572304, -1304060, -386010, 1265405, -1028645, 2281702, -1120987, 100932, -1631014, 972810, + -12885, -137976, 1039919, -540092, -463320, 731755, + }, + { + 16981764, -56895432, 24611774, 21936546, -5342940, 7660074, -2584497, -2967286, 2484639, -5905580, + 1956358, -16724066, 7751342, 14867029, -12740484, 7344394, -7058242, -4048007, 13473312, 1557463, + -4805532, -4983236, 12642236, -12135430, -9858024, 14453102, 2812130, -1634772, -7023346, 5540508, + -4072166, 250182, -526134, -2897492, 10938745, -3962107, -4967130, 3672734, -421444, 1986422, + -1153736, -2592550, -2722473, 4157528, 947040, -353261, -2173790, 667331, 1450088, 1864553, + -881005, -6741488, 4555887, 4300873, -1057099, 2744484, 181999, -53687, -4269198, 1094680, + 2002529, -4604205, 2578591, 229781, -4285841, 1513976, 2944200, 382252, -1535988, -819265, + 1133871, 173409, 216359, 2851858, -2499134, -28991, 4573604, -3896609, 262530, -426812, + -1157494, -1235340, -180389, 484794, 1307281, 831613, 513249, -397284, -1567126, -351114, + 404801, 401579, 1215476, 453119, -745714, 415001, + }, + { + -1898912, 22643068, -38548944, 24912420, -17003238, 4400194, 9096204, 234613, -3450469, -3834869, + 1771137, -10518912, -3963718, 12140799, -550293, -2965138, 2650532, -8160438, 11890617, -548145, + -4634807, 3637837, 1883343, -11204496, 126702, 4858682, 16890496, -12792560, 1769527, -4717485, + -3195993, 11159399, -11986180, 10284836, -4656282, -2163053, 2572149, 3319473, -1615445, 2324114, + -4486094, 1670742, 1240172, -3856344, 2228551, 1751810, 1069447, -5204427, 759136, 4014721, + -1615445, -5482526, 4042101, 3636764, 1723356, -2246268, 3710852, -1366337, -4788889, 1828582, + -1134945, -581968, -762357, -503585, 766115, -510027, 2339147, 2078764, -2164127, -1748589, + 1334661, -159988, 2298881, 1909650, -998580, -1019518, 928787, 876710, -1318555, -897648, + -462783, -170725, 436476, -336081, 753230, 1717987, -747324, -1275605, -1265405, -448287, + 1691143, -322123, 566936, 796716, -415001, -1191317, + }, + { + 11045045, -32876364, 8340290, 18104360, 3212099, 104153, -14018773, -575526, 11572789, -3147674, + -4546760, -7494181, 12850542, -10114648, -1496259, 5943698, -2239826, 7892540, -8507256, 4433480, + -1641214, 12130598, -9672266, 10990284, -9851581, -3774740, 3331821, -4731444, 5446019, 3574487, + 3012383, -7050726, 7794292, -6359773, 57445, 1829656, 71941, -1643362, -2571075, 2026151, + 5374615, -2528662, 4089883, -10426570, 1915555, 2698313, -8253317, 6000070, 1835562, 3655554, + -4281009, 830002, 207232, -2386391, 1966021, 487479, 822486, -890669, 2156611, -792958, + -744640, -1085553, 725313, -119185, 1049583, 1367410, -440771, -945430, 2914135, -1796370, + 243203, -572304, -81604, -2814277, 1590749, -1954747, 1560147, -646929, 1949915, -1267552, + 1114544, 1047972, -198642, -2451890, 2932926, -1191317, 93416, 584116, -635118, -1181116, + 538482, -92342, -998580, 431644, 909996, 844498, + }, + { + 1951526, -1252520, -4450660, 17591650, -3061775, 5971615, -19012746, 4438849, 15155329, -4493610, + -1342177, -2172180, 4929012, 1711008, -6664716, 6905771, -10448582, 2665027, 5218386, 1537061, + -8198019, 11589969, -5337034, 3729642, -3327526, -9520869, 3167539, -1369021, -9149354, 10700374, + 2361158, 1968706, 1963874, -3059627, 964220, 1821603, -1794760, 4209068, -2830384, 6850473, + -3741454, 2296197, -4121558, -1649268, 1862942, -1991791, 336618, 8039642, -4155381, 4155918, + -1076426, -5590437, -2149094, 1104344, 1330366, 219043, 832150, 3549254, -1814087, -1007707, + -1184874, -1226750, 308164, 1119376, 2521146, -4012573, 1813550, -699006, -248571, -637266, + 798327, -874563, 1723893, -2705293, -93416, 949725, -143345, -324807, 1677185, -877247, + 52613, 1293859, -403727, 368293, -659278, -456340, -1469953, 1380295, -2007897, 1666984, + -294205, -61740, 1183264, 321049, 226560, -384400, + }, + { + 16724066, -54424216, 24016384, 16218333, 2622615, -229244, -6679211, 10845866, -2998961, 9867150, + -29236916, 9869298, 8449811, -15844134, 12715251, 3453154, -523986, 2774549, -205085, -4210142, + 2449205, 2014340, -3876745, 2466922, -905701, -826781, -2839510, 6432251, 7812009, -13349295, + -910533, 1897839, 856846, 5768678, -2393908, 651224, 3175592, -8968429, 1388348, 5872294, + -7933879, 1311576, 3837553, -3561065, 1435056, 3999688, -2183991, 2351495, -1664300, 3901978, + 57982, -2732136, 38118, 252329, 676994, -1644436, -5184026, 3423089, -1054415, 238371, + 3646427, -732829, 863288, -879395, 911607, -338766, -2291902, 691490, 768799, 116501, + 194884, -969589, 623844, -92342, 918586, -228170, 537408, -2114198, -1280437, -439160, + -796716, 1575716, -1374926, -634581, 849867, -1003949, 252329, 1002338, 1103270, -932545, + 1130650, 507343, 540092, -635655, -231391, -486942, + }, + { + 448287, 6634651, -9032853, 15345381, -2375654, 1223529, -19807852, 11365557, 2129230, 5767068, + 2703682, -26346940, 23375360, -14102525, 4283156, 3120831, 4329864, -9807021, 5224291, 5291937, + -14072997, 4913980, -9549323, 9849971, 787053, -3354370, -170188, 5004174, -2477123, 2615635, + -7850664, 4985920, -4202089, 4719096, 6729677, -7505456, 2442763, -7187091, 3899830, -5713917, + 1315334, -271657, 5739687, -4461934, -100395, 2415919, -2565706, 3275450, 180926, 644245, + 4545686, -4531191, -175020, -348966, 599685, -2886755, -2801393, 1971390, -2143726, 1848447, + -2724620, 3562139, -918049, 301721, -636192, 2759517, -2583423, -2193118, 3487514, 1781875, + -2218351, 187368, 1857573, 212601, -249108, -1234803, 2329483, -2800856, -848256, -776315, + 1190780, -1357210, -404264, -535260, 454730, 149250, 34360, 652298, -919660, 1036161, + 156766, 1289027, -439160, 186831, 399432, -1067836, + }, + { + 16133508, -50945292, 22196928, 6430640, 8043400, -3537443, -11391864, 12313671, 920197, -6473053, + -4886062, -5131949, -10255308, 13766444, -3438658, -466004, 7041599, -5843303, -7774428, 1607928, + 1829119, -209380, -28991, 3231963, -8385924, -570694, 7070053, 923955, -3607236, 2573222, + -3866008, -164819, -3471407, 7772280, -7465727, 2116345, -3626026, 5818607, -3962107, 1343251, + 6237367, 2172180, -9084930, 847182, 3152506, -7275675, 1183800, 1473711, 2120103, 1200980, + 3020973, -1214939, -876173, -3531537, -1597191, 3324305, -1464047, 1251446, -1532230, 1237488, + 2059437, -3098282, 1225139, -2407329, 3711389, -1664300, 1575716, 532039, -406411, -1537598, + 853088, -668941, -57982, 989453, -2013803, 1045825, -754304, -674847, -1480690, 153008, + 6979, -359167, 1414118, -320512, 1423245, -1261647, 406411, 1002875, -241592, -1040456, + -416612, -256624, 1267015, -649077, 394600, -1297080, + }, + { + 3932043, -8747238, 1968169, 7729868, 2339147, -1849520, -22146998, 18181670, -3309809, 3830037, + -809064, -12105365, 399969, 9071508, 5670431, -18088792, 12317429, -708670, -4087198, -1396938, + 2544768, -1189706, 5521181, 6648073, -9254581, 2428804, -771484, -5743982, 3870839, 2408403, + -8186208, 10273562, -1151588, 5949067, -11838004, 6634651, 569620, -566399, -3616899, 5836324, + -1320703, 4142496, -3505767, -443455, 3020973, -170725, -2520609, 3269007, 2726767, 4345970, + -634045, -3609383, -460098, 457414, -831076, -218506, -190052, 3064996, -1687385, 2042257, + -1031866, -1002875, 890669, 1019518, 823023, -854699, -76773, 2980171, -1726040, 729608, + -856846, -3758, 1760400, -1726577, 615791, 61740, 1741609, -1194001, -2136209, 990527, + 1548336, -1329829, 896574, 156766, -466004, 2329483, -551903, -305480, -814970, 44023, + -388695, 617938, 274341, -285078, 633508, 244276, + }, + }, + { + { + -4482872, 28839632, 76304392, 61546344, 2663417, 13988172, 4247186, 4619774, -6138045, 3905199, + -2973191, -18294950, -830539, -1454920, 11599096, -15888695, -936840, -6803228, 7468412, 1937030, + 11842299, -9400610, 2805151, -2087354, 14620069, -1771674, -5182952, -4300873, 6912213, -2089502, + -1600412, -4452271, 10584947, 9364639, 3853123, 12952548, -18254, 654983, 1224066, 2383707, + 5071820, 2677375, -8999567, -2144263, 6462852, 5727876, -1794223, -110595, -2606508, 529892, + 3830574, 4368519, 864362, 3654480, -3748433, -321049, 1378148, -193274, 1062468, 2030983, + -1656784, 1757179, 1085016, 966905, -401579, -3160022, -1963874, -1500554, -76773, 1246077, + -704912, 2110440, -654983, 849330, -2720862, 4781909, 1413581, 707059, 1231045, -3215320, + -4275103, -1117765, -706522, 1465121, 221191, 1032940, 338229, 1593970, -2112587, 1344325, + 1056562, -468151, -699006, -231928, -463856, 849867, + }, + { + -338766, 61415348, 15611669, 9440338, -21532818, 2443300, -3299609, 6394133, -1631551, 307090, + -1473174, -7240778, -2691871, -6294812, 319975, -22467510, 12042551, 175557, 1326608, -9340480, + 821413, -2894271, 19238770, -8172249, -6328635, -7420630, 5719286, 5753646, 7582228, -3056943, + 1290101, -3332358, -10959146, -5172751, 1697049, -8074539, 4212289, -11470247, -8075076, -5384815, + 6061810, 7973070, -6896107, -4566087, 5655935, 743566, -389231, -1331440, -2468533, 8692477, + -1590749, -5043366, -759136, 4623533, 1286343, 7335268, -1056025, 2297808, -3507378, 518080, + 374736, -2478196, -3925600, -1590212, -111132, -5529234, 6795175, 883153, 4900021, -1301912, + 5432060, -793495, -160524, 929324, 382789, -2499134, 846645, 2493229, 51003, -935766, + 28991, -1445793, 963146, -52076, -2120103, -1299228, 2304250, 2145873, 57445, -1854352, + 1767379, -1159104, 46171, -558346, 955630, 1686848, + }, + { + 380641, 59243704, 48001092, 42336568, 635118, 15008226, 8574902, 350040, 1510755, 9108015, + -5251135, -17617418, 7868380, 5167920, -5149129, -14354318, 11403675, 3655554, 2236604, -534723, + 3555159, 225486, -10012106, 1254667, 2330557, 4824322, -14513768, -18128520, -5068062, -6743099, + 10276783, 2444910, -1569811, 13202193, 840203, -2855617, 5487895, 8312373, -3521873, -1575179, + -1035087, -974421, 8238821, 8363912, 4868883, -8895414, 2909840, 6211060, 206695, -1698660, + 4402342, -2556579, -6953552, 3302830, 2627983, -4975720, -1792612, 743029, 1102733, 1414655, + -483184, 1181653, 1640141, 1957431, 326418, -931471, 5162014, 2567854, 1180042, -4600984, + 1174137, 1159641, 2928094, -685047, 165356, -4046933, -180926, 226560, -6979, -1546725, + 463320, 938987, -701153, 355945, 33286, 2727304, -1365800, 242129, -51003, 2112587, + 132070, -1199907, -243739, 2097555, 344134, 249108, + }, + { + -12965433, -93600224, 11103564, 47905528, 15134928, 2648384, -5536750, -22549, -9589588, 3934727, + 24285892, 3155727, 6387153, -3045132, 2965675, 17890150, 6890738, -1830730, -7762617, 6073084, + -8128763, 4532264, 4820027, 1049046, 9186398, 6004365, 2037425, 3870303, 12895102, 10055592, + -1724966, 2524904, 1289027, -10789495, 4014721, 2691871, -1365263, -6886443, -407485, -3709778, + 2429878, -2164127, 3537979, 3473555, 3887482, 5180268, 536334, 4088272, 3243237, -3252364, + 5898601, 3380139, -591632, -2377265, -1393717, -1538135, -1088774, 329102, -4570919, 3502546, + -89121, 1686848, 418759, -1439888, -623307, 1275068, 1467805, 1001264, -2708514, -1158567, + -1006096, -955093, 210453, -1321239, -690416, 1775432, 1180579, 592706, 853088, 995896, + 483721, -460635, -1238561, 347892, -469762, 507880, 1168768, -2232309, -1656247, -28454, + 741419, 98247, 235149, 1672890, 643708, -8590, + }, + { + 280784, 46764676, 59056, 2466385, -39307540, 6648610, 5394479, -1607928, 3771518, 11492796, + 1255204, -11431055, 4279935, -217433, -16392280, 19051402, 26164940, -5289789, 7523172, -8365523, + -4125316, 8746701, 7299834, -12686260, 12147778, -3869229, -9096204, -22466974, 720481, -20535312, + 10363756, -5583995, 4239670, -11470784, -5002563, 3631932, 1839857, -4620311, 5309654, 1415192, + 5276368, 911607, -806917, -4153234, 4014721, 5682779, -7584376, 3403225, 3831648, 12488691, + -1707250, -3879429, 4882841, 4713190, 3608310, 537945, 3716757, 701153, -1301375, 5381594, + -37044, -1482301, 2265059, 1849520, 4023848, 2126009, -4087735, 126702, -4682588, 2435783, + 915365, 996432, -3210488, 1045825, -541166, -1728188, -162672, -1001264, 1537061, 1014686, + 418759, 2005750, -1242856, 329102, -3324305, 1411971, 823560, -1049046, 831076, 1343788, + 468151, 1033477, -1182190, 387084, 115427, 602906, + }, + { + -15682536, -120856088, 18982144, 65122980, 29969744, -4514011, 4304631, -2905009, -2981781, 5942624, + 7777649, -19528680, -11659762, 9244917, -18276696, 2150705, -17572322, -10454487, -1418413, -12364674, + 9629317, -14058502, -9901510, 5478231, 10171556, -4277251, 6251862, -11213086, 19978578, -10095858, + -3325915, -3831648, 12777528, 10835129, 1889249, 2812667, -3924526, -9249212, 2401961, -2114198, + 8253854, -2933463, -1868311, -275952, -5413270, -7293392, -2016487, 3751117, 6029597, 3490735, + -3102577, 1628866, 4018479, -528281, -1092532, -1621887, -1995012, -2887829, 580357, -1323387, + 2394444, 4003447, -4621922, 5526549, -2177012, -1012002, 5303748, 1527398, -2064806, -296890, + -3376918, -2279017, 690416, 3534221, -2705830, 1056025, -699543, -1232656, 280784, 677531, + -1766305, -343061, 1240172, -12348, -449361, -435939, -936303, 1309428, -125628, 1339493, + 1347546, 510564, 43487, 308701, 717796, 1654099, + }, + { + -1073742, 45053672, -20771536, -2367601, -40050032, 6734509, 3884798, -2544231, 412854, 4087198, + -797790, -8554501, -17715130, -6356015, -4284767, 12298102, -5752035, -13150653, -2108292, -9127879, + 3032784, -3943854, -12318503, -6820945, 3287798, -2856153, 24058796, -22105660, -8840116, -5879274, + -15313706, -13260712, 5637145, -2702608, -1101659, -7940321, 664109, 2047089, -544387, -1126355, + 4842039, -4241280, -345208, 2389076, 8027294, -620623, 1736777, -2494839, 375273, 1052804, + 760209, 393526, 6613176, -2077154, 3469260, 461172, -493921, -2445984, 3239479, -5060009, + 460098, 354335, -2422362, 1714229, 1547799, -3830037, -89121, -3066607, 3737159, 3277060, + 1703491, 1487132, 948114, 30602, 1064615, -251256, -1708860, -2900714, -2763275, -1126355, + 1777580, -1459215, -1368484, 1408749, -1676111, 1819456, -1701344, -333397, -742493, 2377265, + 490163, -148713, -66035, -1893007, -774705, 718870, + }, + { + -14235132, -96278136, 29791504, 61176976, 29850022, 8715562, -7289633, -10312753, 4875862, -1081258, + 5609228, -21945136, 478352, 13081397, -19822884, 1300838, -3351685, 1022202, 13382581, 10632728, + 1532230, 376347, 22500796, -5738613, -11087995, 5625871, -671626, 2239289, -4132296, 6255620, + -5669894, -4024384, -727997, -2639258, 12090870, -1688459, -5740224, 1754494, -394600, 5862631, + -1082869, -2287607, 4660577, 7233799, 263067, 3247532, 1813550, 1385664, 795643, 4743792, + -3438658, -12179454, 5492190, 4766877, -1584843, 7055021, 2633352, 2602213, -1100049, 4789963, + 6404870, -5018670, 911607, -626528, -4942971, 3653944, 1817845, -677531, -46708, 255551, + 1910724, -2081985, -3576097, 2308545, -1946694, 647466, 7444789, -2734284, 1634772, 295816, + -1387811, -1977296, -792958, 688269, 2603287, 1785633, 656593, 297427, -813896, -399969, + 424665, 510564, 805843, -182536, -1189706, 1107565, + }, + { + -1804960, 38754564, -34475704, -1616518, -35203700, -1082869, 6202470, 4700305, -1883343, -3794604, + 3324305, -11288785, -5713917, 5170604, -5426155, -7887708, -1584306, -3618510, 19141596, -557809, + -3837553, 8811125, -649077, -1149978, 17872432, 4751845, 10720238, -11770358, 12353400, -4874788, + -2738579, 4350265, -21752936, 2378338, -11214696, 4840965, 8922795, 3805341, -1577327, 4395899, + -2051384, 2887829, 1789391, -6944962, 2721399, 5892159, 1193464, -6276558, 671626, 2050847, + 37044, -4748623, 1183264, 3518652, 1192927, -2850785, 3253438, -1150514, -3163780, 1406602, + -354335, 197032, -1329292, 30602, 319975, 309775, 4044249, 3678640, -200790, 477278, + 2210835, 585726, 3679713, 1701344, -1103807, -1379758, 1023276, 2826625, 785979, -817654, + -673236, -1232656, 646929, -629213, 7516, 2447595, -734439, -1162326, -1117228, -2100776, + 533650, -677531, -1184874, -1031866, -501974, -1263794, + }, + { + -8017094, -33328946, 36980744, 30870614, 2998961, 8695161, -8949101, -12361990, 10516764, -14118631, + -5706938, -7732552, 1393180, -17019882, -1250909, 16457241, 4964446, 7500087, -9989557, 13060996, + 3111704, 12058121, -6903623, 675384, -17580912, 763430, 6641093, 1042603, 18919868, 10800232, + 5258651, -811749, 7103876, -4774930, 414464, -4293357, -2723009, -125091, 202937, -838592, + -1599875, -7156490, 4340065, -10692321, 3725347, 4792647, -11287174, -134218, 28454, 5703717, + -908922, 5946382, 4151623, -3286187, 2279554, 1153199, -400506, -2699924, 3298535, 4216048, + 2527588, -1635846, -290447, -1331977, -170188, -1029182, 536871, 1767379, 6802155, 71941, + 715112, -650151, -1535451, -3638374, 1435056, -1784022, 2102923, -773094, 1133335, -1924145, + 1792612, 260382, -442382, -2620467, 2421288, -2069101, -576063, -826781, -1248762, -806917, + 324807, -42950, -1040456, 671626, 1667521, 1499481, + }, + { + -76236, 41194640, 25232932, 8623221, -13406740, 3605088, -19074486, 12307766, 23641648, -2561411, + 16917876, 1474248, -3274913, -4441533, -12097312, 2539936, -25176024, 8136279, 14166413, 4678830, + -10611790, -5369, -2301029, 4459787, -6022081, -8602283, 2014340, -4147328, -10136660, 20033874, + 10279467, 6615860, 4266513, 2448668, 2941516, 3891777, 3601330, 9716827, -1259499, 14377940, + -109522, 2210298, -1076963, 2889976, 715649, -4151086, -575526, 4191888, -4647155, 2948495, + -1389959, -1564979, 729071, 2151779, -248571, -4089883, 475668, 3623879, -4355097, -1691143, + 1056025, 1756105, -1474784, -862215, -1854352, -5026186, 5641440, -41876, -609885, -1426466, + 185220, -2848100, 1329829, -1693291, 769336, 340913, -2182917, 684510, 3028489, -1981591, + -2194192, -212064, 966905, 2456185, -2156611, -3216931, -492311, 3476239, -484258, 4480725, + 30602, -86436, 1064615, -428423, -234076, -1477469, + }, + { + -12283606, -108481208, 18961206, 30659088, 18592914, 24953224, 12961674, 12153147, -1122060, -10529649, + -44325136, 23794118, 22448184, -16109885, 6549825, 2846490, 8701604, 11500849, -577136, 3860102, + 14048838, 3277060, -3991635, -2239289, 2108829, 3988414, -5944235, 6244346, 7047505, -15465640, + -6221260, -270046, 5229660, 9252970, -6354941, 3124052, 10443750, -6169721, 979789, 3491809, + -5611375, 4240744, -1282048, -4011500, 6161131, 5425081, -2965138, 3177202, 2896956, 4756677, + -4505958, -4464619, 1335198, 2634426, 1171989, -3677566, -4165582, 8637716, 5283347, 1621887, + 164819, -3773666, 1604170, 1686848, 1656784, -1206886, -2067490, 1015760, -2073932, -3073586, + -2502355, -3204046, -1879048, -3780645, 162135, -545461, -390842, -3445638, -2629057, -1956895, + -634045, 3060701, -1768990, -2345052, -2684, -949188, -824097, -195958, 1339493, -1414655, + -197569, 317291, 1796370, 336618, 383863, -227096, + }, + { + -234076, 51933132, 22157736, 1258425, -19265612, -13864154, -26694832, 14337138, 6314676, 5217312, + 9405442, -21334714, 24902758, -14698452, -8342437, -16292422, -7948911, -4663261, 12680891, 3289945, + -21385716, -1300301, -12458626, 11163157, 11587285, 4145180, -1193464, 1584306, -4843650, 7894150, + -3425237, 3404299, -10512469, -2093260, 4326643, -9272834, 8053, -15973520, -2813204, -1435056, + 10333154, 832150, 694711, -8048232, 1406065, 4195646, -1684701, 4351876, 2384244, 987306, + 1792075, -12242804, -2067490, 2863133, 910533, -4092030, -6351720, -1696512, -2117956, 230318, + -7234336, 1212255, -1950989, 2463164, 388158, 3913252, -2064269, -2189897, 1911261, 489089, + -1423782, 341987, 1843615, -2069637, -2760053, -662499, 3266323, -3560528, -1687922, 57982, + 2425583, -2571075, -2617246, -544387, 1459215, -597537, -1723893, -826244, -2896419, 185220, + 970126, 1669669, -1212791, 909996, 652835, -1866163, + }, + { + -12437688, -101058968, 16285979, 14797236, 11887933, 6774774, -2981244, 13169980, 4867809, -29398514, + -20458002, -10951093, -29929480, 2319819, -4666482, 1996623, 1404454, -13603772, -13431436, -217433, + 5256503, -3365644, -10587094, -1216550, -18570902, -5313949, 15609522, 12817793, -3008088, -6585259, + -10653666, 169651, -3228205, 7223062, -6831683, 180926, -6358699, 13513578, -4157528, -2139431, + 5931350, 514859, -8674760, 1316944, 840203, -6660958, -356482, 1036698, 5916855, 2724083, + 5456756, -2820720, -7478612, -1961190, 4338454, 5472862, -3350611, -1492501, -2315524, 1696512, + 4231617, -587337, 647466, -7263864, 1504312, -2387465, 2186675, 3498788, 3119757, -534187, + 1767379, -2804077, -4112968, -689342, -4396973, 559956, -2306934, -1152125, -1725503, -1683090, + -1320703, -151934, 1996086, -140660, 3212636, -1423245, 15569, 2496450, -366683, -2014877, + -1088237, 584652, 4094178, 726386, 449898, -613107, + }, + { + -1429150, 24830280, 28164784, -2260227, -13288092, -22554484, -35943508, 17277042, 7279970, 6673306, + -8926553, -17107392, 1483374, 6848326, 996969, -23703388, 6081674, -967441, -6298033, 1754494, + 2851858, -7979513, 7490423, 13524852, -5607617, 7391639, -1644973, -11587822, 3638374, 1588064, + -3359201, 22934052, 1499481, 8313446, -6750078, 12313671, 3071975, -13959, -8020852, 2738579, + -3053722, 8050380, 1410360, 7711077, 10707353, 6447283, -18254, 8635569, 8305393, 5628018, + 4697621, 1108102, -2324114, 707059, 1533840, -55835, 1773285, 5250598, -4274566, 1873680, + 2234994, -87510, 1506460, 3875671, 514859, -791348, 2969970, 1196148, -2230162, 3009162, + -896038, -575526, 2197413, -1544578, 626528, 1871532, 4715337, -386010, -3965866, 1641751, + 2743947, -1465658, 2727304, 1484448, -629213, 2389613, -2054068, -1454383, 762894, 1407676, + 401043, 2132451, 1078574, -272730, 1748589, 683437, + }, + }, + { + { + 1350230, 101808976, -14503031, 20640002, 38388956, 12414066, 3110630, -132070, 8665097, -9302899, + -5192616, -7151658, -5890548, -9973988, 11929272, -10640781, -1409286, 5288716, 3876208, -9809705, + 12771622, -10890963, 6227166, -8224326, 8856759, 7098507, -3207804, -6770479, 3061775, 2683818, + -13397614, 9386651, 6941204, 4152697, 5705864, 6131603, 3962107, 1660005, 1465658, 703301, + 1941325, -1884417, 642098, -2574296, 2711198, 5628555, 979789, -2807298, -928787, -475668, + 2331630, 2162516, 6589554, -221728, -2528662, 3412889, -868120, -995896, 1779190, 588411, + -59593, -4832, 3609920, 1054951, -2784750, 1117765, -5929739, 1483911, -2362232, 1050120, + 2660732, 32749, -1707786, 545461, 387621, 485868, 1354525, 3369402, 119185, -2764348, + -3995393, -2607045, 611496, 1688996, 1485522, -978179, 2374043, -580894, -748935, -120259, + 646393, 570157, 733366, -570157, -904628, 261993, + }, + { + 2139431, 24499030, 34134252, -14110041, 15166066, -4140349, -3494493, -2616172, 8981850, -5733245, + 181999, -811212, -6829535, -3704946, -323196, -3251290, -4506495, 277025, -6826851, -1053878, + -4836670, 6191732, 7336341, -5652714, -453119, -7844758, -4707821, 6591701, 12649752, -1325534, + -947040, -9066139, -7432978, -212601, -5103495, 1842004, -1959579, -9605157, -8122857, -1093069, + 616328, 4956929, -9150965, 113280, 6405944, -4599373, 1889786, 1764695, -4656819, 6950868, + -2405182, -2514167, -590558, 2139431, 9385577, -1644436, 464393, 2459943, -1975685, -3486977, + 955093, -1982664, -124017, -1864016, -1862405, -1942936, 2244657, 3169686, 4432943, -885837, + 3564286, 1575716, -1285269, 1076426, -1267015, -8053, 497142, 375273, -1987496, -97174, + 2209761, -1545115, -2115272, 2785286, -1951526, -790274, 700617, 1376537, 760746, 1005022, + -2310156, -791348, -287763, 437013, 1354525, 1196148, + }, + { + -1371168, 87235080, 24251532, -7520488, 44567800, 10901164, 7180649, 6446746, -3707094, 37044, + 4475356, -15188615, 2549063, 3910568, -1651952, -13008382, 1065152, 3648038, 3191698, 5153961, + 6858526, -419833, -8805220, -2768107, 5825587, -1646046, -3725347, -19935090, -4122632, -7320772, + 13351980, -6465000, 3471407, 8316131, 4174171, -5480379, 6118718, 7073275, -5342940, 3314104, + -7477538, 5173825, 4643397, 7694434, 5461051, -4087198, 5034239, -1258425, -569083, 1374926, + 3420405, -773631, -5208722, -743566, 2907156, -3623879, 1275068, -1553704, 3694209, -1672353, + -624918, 1235877, 733366, 366683, 402653, 2527588, 2806761, 2540473, 137976, -540629, + 587337, 1420560, 1105954, -1855963, 1771674, -2632278, -2283312, -1093069, 996969, -439160, + -84289, 1119376, -834297, 1290638, -2077690, 3460133, -397284, 670552, -814970, 2243584, + 556198, -1041530, -777389, 1018444, -288300, -176094, + }, + { + 11821897, -78383688, -28942174, 46219752, 9999221, 10705206, -7208029, -3323768, -214748, 14944339, + 6511171, 6327561, 4110284, -4823785, 10437307, 5242545, 1524177, 8439611, -7818451, 5395016, + -3463354, 1546188, 6178848, 1749662, 8053064, 5829881, 4090956, 8550206, 7067906, 8606041, + 327491, 1888175, 678605, -7045357, -3573950, 289910, -5995775, 620086, -4891431, 2485712, + 1802813, -1282048, 3261491, -2349347, 8904004, -222801, 3123515, 5117454, 947577, -2877628, + 2595771, 6874632, -1478006, -996432, -3786551, 3162170, 348966, -3814468, -3665755, 5555004, + -379031, -2767033, 3399467, -2861522, 2160906, -30065, 2618856, -1161789, -4940823, 1819992, + -2208150, -4295, 813359, -1816234, -810138, 1631551, 279173, 1218160, 1365800, -234076, + -148176, 398358, -221728, -200253, -105227, -50466, 674847, -2103460, 291521, -976568, + 1381369, -1315334, 1334661, 1192390, -165356, -617938, + }, + { + 107374, 36960340, 11705933, -12811351, -12065100, -6012954, 3106872, 3806952, -1700270, 7338489, + 265214, -1822677, -335007, -913754, -4269198, 9899363, 15385110, 6476811, 2752537, -11055783, + 6451578, -11934640, 16368120, -2494839, 3060164, 507880, -11430519, -16602196, -6743636, -11443403, + 1605781, 1036161, -1394254, -2983392, -9650255, 2203318, -3805878, 7031935, 321586, 1736777, + 450972, 3256659, 683974, 2163053, -1735167, 5569499, 133681, -1672353, 2836289, 10039486, + 1690607, -6934225, 139050, 9701257, 2374043, 5229660, 2464774, -991064, -906775, 2847027, + 2289755, 234613, 612570, 2197413, 4554276, 1458678, -2057826, -2404108, 1477469, -1699733, + 2632278, 377420, -3134789, -56908, -1044751, -3063386, 188442, 77846, 1121523, 1746978, + 687732, 2007897, -2011655, -844498, -1543504, 1273458, -138513, 556198, -74625, -84289, + 2116345, 452582, -44023, -616865, 201863, 1199370, + }, + { + 13508746, -84147536, -46176804, 66787816, 16287590, 8158291, 2383170, -468151, -4221953, 4474282, + -2812667, 5634997, -6355478, -10631118, -11267847, -2405182, -23652922, -9392557, 3101503, -4213900, + 878858, -10414759, 26844, -4022237, 2190970, 5938329, 3187403, -5530308, 11096048, -3546569, + -9026411, 3281892, 11498164, 4975720, 2323041, -1208496, -3332895, 320512, -2797098, 2090039, + 3712462, -260919, -5642514, 3022583, -11645804, -3961571, 3715684, 355409, 5976447, 3573413, + -987306, -1199907, -710280, 1448478, 3053722, -5400922, -4062502, 1899986, 221191, 1806571, + 387621, -108448, 1325534, 1883880, -378494, 514322, 3189550, -576063, 972810, -1228898, + -3365644, 1655710, -2341294, 2084670, 346282, -2018098, 924492, -1105954, 478889, -481036, + -2985002, 3497714, -1187559, 85899, -372052, -974421, -132070, -1006633, 2269890, 1122060, + 482110, 1018444, -166430, 667867, 8053, 952946, + }, + { + 2144263, -16780974, 43761960, -16339666, -24133422, 2939368, 61740, -6042482, 6257231, 5476620, + -7132330, -7807177, -9937481, -7109782, 1080184, 5784247, -8806830, -8913131, -8566312, -9787694, + -111132, -3526168, -5306432, -2607582, 6219113, 775778, 2490544, -6765111, -10643466, 1606318, + -21692270, -13439490, 8473434, -4961761, -6497749, -28991, 1839857, -3976066, 3049427, -3952981, + 6593312, -3862786, -2553895, 8752606, -2688113, 939524, -872952, 4664872, -2874944, 2224256, + -2673080, 2078227, -127775, 2823404, 2855617, -453119, 1908039, -582505, -216359, -3678640, + -572841, 332860, -1794223, 656056, -1515050, -1231045, -1873680, 1088237, 1698660, 3030636, + 1770600, 2107218, -609349, 2384781, -522375, -472446, -365609, -2587181, -2693481, 1581085, + -1247151, -1108102, -808528, 1906429, -1635309, 1075352, 353798, -2370285, 172336, 2139968, + 594853, -566399, 115964, -1868311, -649614, -945430, + }, + { + 12784507, -53531936, -40072580, 52984328, 32631014, 12775380, -7900593, -8029978, -530428, 5971079, + -2979634, -9334038, -8841190, 9659918, 2616709, -8793409, -11470247, 14088030, 6094022, 15019501, + 5060545, -1128503, 11796665, -4159676, 4960687, -8951249, 7947300, -1654636, 3588982, -2864743, + -3389266, -2624762, -3920768, 5633387, 5632313, 1276679, -6702297, 2651069, 2885144, 7963406, + -1069984, -3563212, 2997350, 7789460, -1224066, 3552475, -804233, 4442607, 2098629, -104153, + -3325915, -5966247, 5182952, -141197, -1171452, 6665789, 1396401, 1286880, 1540820, 7273527, + 3854196, -354872, -1570884, -1945083, -3438121, 4467840, -823560, 1148904, 1196148, -558883, + 625992, -3113851, -1329292, -964220, 1086627, -265214, 5676873, -1078037, 1594507, 368830, + -303332, -415001, -1586454, 1609539, 1964411, 1137630, -774705, 1030792, 566399, -907849, + -155156, -279173, 821949, 887448, -1612223, 2079838, + }, + { + 2202245, -34957812, 45122388, -17801028, -18653042, -2827699, 1369021, 3699578, -851477, -4525285, + 285078, -5654862, -955630, -7394860, 470299, 30065, 3165391, -6931541, 3722126, 13673565, + -7522635, 6733435, 3442953, 8527658, 11105175, -4286914, 11633993, -14003204, 16528645, -10672457, + 14852534, -11569568, -11571716, -2837900, -13138842, 2400350, 13378286, 3238405, -1629403, 1817845, + 71404, -562641, 2861522, -7428146, 4557497, 844498, -936840, 1250909, -451508, 2828236, + -2673080, -2454574, -376347, 1974611, 2112587, -2263985, -877784, 1792612, -1765232, -880468, + 1351841, 329639, -1158567, 25770, -928787, 1810866, 2419140, 2538326, 1446867, 1846299, + 1444720, 3364033, 17717, -363462, 767189, -1837172, 2703682, 1142998, 1474248, -1870995, + 294205, 293132, -757525, -2326799, 2114735, 22549, -1239635, 806917, -619549, -1901060, + 373125, -1191853, -407485, -681826, -2740726, -777389, + }, + { + 5463736, 9644886, -1623498, 14336064, -173409, -9395241, 33851320, -8151848, -9658845, -13521631, + -7347079, -539018, -7357279, 3088618, -2887292, 4953708, 2748779, -6827388, 10210211, 2907156, + 11083163, -2913062, 787590, -11202348, -7574712, 12650289, -9507447, 8224863, 11565810, 14604499, + 4287988, 5790690, -12254615, 8529268, 6352257, -8014409, 543850, -8160438, 9974525, 1026497, + 4296041, -13653164, 1034550, -6663642, -1874216, 40802, -11274, -6082211, 1501628, -1353989, + 2263448, 5548024, 2313914, 4830228, -783832, -3238405, 3506304, -6524056, 1074, 8836895, + -1473174, -11811, 1206886, -279710, 1129040, -5133560, 4862977, 1628866, 5391258, -457951, + 797253, -589484, -4196720, 1315871, -1002875, 1436130, 121333, 196495, -1744294, -556735, + 1747515, -1093606, -1785633, -906775, 867583, -759672, -430034, -645319, -402116, -1809255, + 1395328, 1140851, -1797981, 387084, -592169, 1496259, + }, + { + -835908, 61262876, -199716, 7210713, -414464, -18003966, 2005750, 15685221, 1853278, -2771865, + 26856968, -4040491, -5506148, -7779797, -14706505, 6749004, -19047106, 4587025, 10968810, -8410083, + 8985608, -10787347, 4433480, -5550709, 7552163, -9563282, -1400696, 5009543, -1999844, 16655883, + 10021769, 634045, 3859028, 4193499, -12739410, 18403398, 5436355, 6062883, -1100049, 3398930, + 8423505, 3415036, -3666828, 1708323, -1724966, -1625645, 6785512, -2695629, 33286, -2239289, + -1197222, 2750390, -465467, -2123861, 325344, 1900523, -1298154, -755914, -3007551, -1523640, + 2035278, 2823941, -1621887, 1918240, -5284958, -2640868, 3733400, -2551748, 1551557, 569083, + 1518271, -2697776, -2536715, -113817, 1879585, -1132798, 238371, 1509144, -2206540, 719407, + -2047089, -1596654, 381178, 3694746, -1403917, -3260954, 584116, 1751273, 2203855, 2380486, + -502511, -431644, -866510, 2134062, -1288490, -451508, + }, + { + 7954817, -112769200, -3224447, 17062294, 14304389, 10513543, 39204460, -1023813, 2731599, -17031156, + -9236864, 1308891, 11835319, 7146289, -4396436, -5325223, 1048509, 14023605, 7536057, 4301947, + 10089415, 6337761, 2711198, -4815195, -1844689, 10682657, -8210904, 5396090, 551366, -10919954, + 882079, -4870493, 2998961, -2066953, 6226092, -4311611, 12582107, 1506460, 3907347, 796180, + -5621576, 1707786, -5477694, 5159867, 568009, -282394, 2510409, 2572149, 5086315, 500901, + -5995775, -1516124, 4528506, -949188, 5509370, -7361574, -730681, 6375879, 4123706, 1612223, + 2674691, -2733210, -1395328, 2644089, -617938, 1332514, -2695629, -113817, -795106, -6318434, + -205622, -2717104, -3583077, -2618856, -319975, -102542, -2660732, -530965, -2587718, -3780108, + 1271847, 1236414, -1433982, -976031, 81068, -702764, -2681133, 290984, 1489817, -894964, + 615254, -1195075, 790811, 2582886, -627602, -469225, + }, + { + 400506, 53145924, 7208029, 1581622, -10533944, -6047314, -19955492, 9653476, -567473, 2969433, + -115427, -5567352, 13405130, -11519102, -16944182, -4189741, -16699907, 6330245, 16094853, -14053133, + -8687108, -7253663, 1785096, 3517578, 11510512, 1319629, -2140504, -8766028, 12569222, 3157875, + 9519795, -8788577, -4156455, -313533, -5044976, -2000918, -10289668, -12353937, -5875516, 8272644, + 5676873, -4294431, 2228551, -4441533, -3191698, 3674345, 1796370, 2335925, 4808216, 1931662, + -1809792, -8101919, -423054, -577673, 2727841, -6466074, -1986422, -5640366, -2844342, 1735704, + -6535867, 994822, -4570382, 217970, 4600984, 1177895, -2214593, 3054796, -2568927, -1440425, + 867047, 383863, -2193655, 1246614, -1466195, -1204738, 880468, -421444, -3913252, 1591822, + 392990, -1637993, -1489280, 1702418, 1027571, 33823, -3997004, 503048, -3527779, 280784, + -543850, 581431, 1189706, 370978, -814970, -1134945, + }, + { + 8718247, -101567920, -13317620, 19938312, -2522757, -3420405, 29215978, -3986267, -6157910, -7323993, + -21974126, -4101157, -29250874, -4400194, -17530446, 12973486, 7735236, -15547245, -16100222, 9371619, + 2967286, 3524558, -18174154, -7199439, -7531225, -6273874, 9487583, 13829795, -197032, -10174778, + -11576011, 6439230, 235149, -2513093, -4321811, -2790118, 3385508, 1167157, 5785321, -166967, + 1188632, 870268, -9851581, 6624987, -7915625, 3528853, -4657355, 865973, 4130148, 4777078, + 2434710, -3204046, -3031173, 1227287, 2005750, -1599875, -18790, -2878702, 2342905, 1193464, + 1120987, 2742874, -528281, -7572564, 3362423, -3841312, -324270, 1786170, 4203163, 2866891, + -1627793, -737661, -5124970, 216896, -3536369, 1343251, -2825552, -1438814, -285078, -459025, + -1544578, 58519, 2863670, -307090, 882079, -953483, -346282, 1998770, 1391569, -2075543, + -1176284, 1903207, 1999307, 1712618, -5906, 833224, + }, + { + -66572, 59507308, -5701569, -1591285, -9918690, -18682570, -26866632, 8261907, 8293045, -1403917, + -8035884, -6191196, -331786, -15650324, -6248641, 21561810, -9753871, 409633, -3970161, -2223719, + -15722265, 6124624, 6285685, 3211562, 9119289, -3394635, 6429029, -12000675, -1895154, 17012902, + -814970, 3433826, 13093745, -8638790, 8982387, 5414343, 1847373, 9097278, -9422085, -4827543, + 322123, 3083250, 4221416, 10280541, 4091493, 9816148, -1069984, 9671729, 5169530, 2360085, + 11086384, -1168768, -3899294, 2764885, -1153736, 1236414, 2067490, 2463164, -635118, -520765, + 8153996, -923418, -3007014, 2733747, -170188, 1730335, 4325569, -2319819, 374199, 215285, + 1772748, -2497524, -313533, 452045, -662499, 7015829, 1093069, -2463164, -3858491, 3209951, + 315680, 1696512, 2038499, -1422708, 1010391, 397821, -1054951, 582505, 921807, -415001, + 2753074, 77846, 2090575, 83752, 746787, 146566, + }, + }, + { + { + 2621541, 113498808, -31434866, -45505180, -16387448, 6688338, 3369402, -4683662, 12765180, -5724118, + 930397, -1476395, -4806606, -8799851, 9031779, -7468412, 7291244, 19567872, -3917010, -32796370, + 491237, -13707925, 9641665, -2094333, 2220498, 1131187, 1602023, -3764539, -4490925, -2379412, + -11190000, 10875931, -1557999, -2514167, -881005, -2956011, 2382096, 2754148, 3806415, -1253057, + -4177930, -7395397, 1065689, -737661, 2037962, 3148748, -2143189, -5009006, 843424, -162672, + -3789772, -3703873, 5046050, -2299955, -4171487, 2234994, -611496, -2267743, -519154, -430570, + 1684164, 1608465, 3216931, 4407710, 846645, 3524558, -4042101, 409096, -3424163, -476741, + 449898, -526670, -2302103, -1613834, 1278290, -994822, -819265, 4289062, 1660005, -811212, + -1037235, -607738, 1823214, 1926293, 1185411, -1828046, 323733, -1036161, 625992, -525597, + 66572, 546535, 1247688, 539555, -132607, 1611, + }, + { + -1574642, -38419556, -16041703, -23359790, 16935056, -5950677, -2490544, -2133525, 10171556, -5297842, + -2197413, 2837900, 5893769, 7166690, 1061394, 4904316, -8822400, -13167833, -4155381, 15103252, + -1505923, -5152350, -317291, 5026723, 1220308, -12664785, -8968965, 4405563, 3487514, -3999688, + -1649268, -4856535, -6089190, -3703873, 2800319, 9583683, 3085397, -3077344, -4300873, 1257352, + -3180960, -1427003, -6024229, 1448478, -359704, -7058779, 2560338, 1883343, -5288179, 4413616, + -4747550, -1792612, -159451, -1305133, 5406827, -3842385, -92879, 1137093, 572304, -5162551, + -181999, 107911, 4027606, 749472, -667867, -498753, -1462436, 1136019, 2175401, -2019708, + 2212982, 1238561, -2394981, 235686, -1273995, 159988, -1089311, -2345052, -2744484, 348429, + 2782602, 981400, -346282, 3507378, -511638, -587874, -1227824, -821413, -409096, 1250909, + -2571612, -917512, -685047, 929860, 522912, -2015950, + }, + { + 406948, 39811124, -34553012, -52451752, 12463458, -1156420, 3573413, 3375308, -3341485, -2985539, + 3117610, -13634374, -2527052, -3322157, 861141, -2068027, -1971927, -1149978, 4515085, 7140920, + 3287261, 3136400, -2901251, -55298, 4417911, -9427453, 5202279, -8643622, 2279554, -19864, + 8392366, -11465415, 1377611, -3937411, -3296388, -578747, 3959960, 4012573, -2816425, 5145908, + -4526359, 5224291, -2881923, -3270618, 5122286, 7378217, 8213588, -2738579, -2155000, -1031329, + 1344862, 4261145, 471910, -2305324, 754841, -3601867, 4407174, 296353, 2933463, -4627828, + -1478006, 1248225, 354872, -3053185, -2939905, -23622, 249108, 1726040, -1289027, 64961, + 860067, 1560147, 1988033, -2296734, -1241782, -1754494, -728534, -928250, 1578937, -1161789, + -717260, 2229088, -786516, 1035087, -1765232, 1563905, -648003, 1566589, -454193, 603443, + -281857, 517544, -1029182, -397284, -707596, -508417, + }, + { + -12721156, -33964064, 22435298, 25370908, -7486665, 10660109, -2889976, -5004711, -4467303, 3434363, + -4645544, -1379221, -2693481, -8016557, -5274757, -3295314, 2064806, 11108933, -3775813, 8571681, + 6442451, 1727114, 5454072, -55835, 1417876, 801548, 1207960, 2960306, -998043, 983548, + -3322157, 2165201, 6255620, -6219650, -12300249, -7816841, -5189394, 5821292, -5305359, 4221416, + 1190780, -122407, 6912213, -1614371, 7672422, -8070244, -2417530, 1053341, -38655, 1876364, + 1349157, 1947231, -1446867, 1430761, -3104188, 4240207, 606127, -2665564, -2156611, 1415729, + -1833414, -1134945, 4334159, -2160369, 1989107, -2079301, 2626373, 730681, -2085207, 2668785, + -2012192, -881542, 616328, -1846299, -481573, 842350, -2165737, -935229, -171799, -925565, + -670015, 376347, 1244467, 682900, -91805, 106300, -451508, -2560338, 550293, -651761, + 1484448, -1321239, 1741609, -441845, 5369, 477278, + }, + { + -605590, 6204617, -4849018, -5094368, 5698885, -4067871, 1330903, 1460826, -5894306, 2098092, + 965294, 8140037, -175557, -11078331, -14306536, -12010876, -7604777, 5963025, -1312649, -8316668, + 9156870, -13172128, 15275588, -5739150, -660351, 8750459, 2626909, 436476, -1001264, -6367289, + -3598646, 2814814, -1480153, 559420, -107374, 6784438, 278636, 6887517, -4459250, 594853, + 3029563, 3481071, -2937221, -655519, -2316598, 4286378, 2764348, -909996, -2670933, 3671660, + 1385127, -6049462, -4122095, 3578245, -1165010, 3563212, 987306, -1145146, -2078764, 769336, + 1059783, 726386, 1800665, 3347927, 2718178, 418759, 125091, -1105954, 3867081, -4342749, + -170725, 485868, -2164127, -376347, 244813, -1749662, 1806571, 1020592, -249108, -353798, + 178778, 1667521, -2588255, -663572, -461172, 744103, -1251983, 807991, -884226, -1585917, + 1655173, 54761, -561030, -768799, 180926, 1096827, + }, + { + -15248208, -26445188, 22428856, 26043072, -25992606, 4932233, 6174553, -2090039, -10772852, -734439, + -2867965, 9695889, -4001299, -8716636, -8768713, -4660577, -10529649, 2314987, 4793184, -2622078, + 576599, -8031589, 4223564, -6481643, 3256659, 12109123, 2824478, -4013110, 9810779, 3571265, + -2547989, 5206037, 2511482, -1919850, -804770, -1014686, -4077535, -339839, -3436511, 1378685, + 2270964, 2121177, -6576132, -1098438, -11463268, -790811, 9170829, 142808, 2626909, -1761474, + -1988033, 2655364, -2572686, 66035, 4693326, -2753074, -2219961, 2950106, -848256, 442382, + -1404991, -848793, 4829691, 195421, -3617973, -473520, 1078574, -1269163, 3044058, 257698, + -1342177, 3785477, -2199560, -250182, 1520418, -68719, 1760937, -1583769, 137439, 3221, + -1978369, 3607773, -3469260, -1125818, 909996, -794569, 1407676, -786516, 1056025, 1352378, + 700080, 1917703, -729608, -486405, -756451, -1044214, + }, + { + -2147, -35017404, 36735392, -3869766, -384936, 3086471, -726923, -1313186, 6488622, 1973538, + -5395016, 1757179, -6242198, -8502962, -1395864, -9424769, -16602196, -4109747, -175020, -5425618, + -7765301, -4880157, 13979045, 2767570, -780610, 6174553, -635655, -3804267, 905164, 21727166, + -1020592, -7306276, 4184909, 3874061, -1649804, 350040, 1460289, -5719823, 7865159, -2510945, + 2801929, -5425081, -3040300, 9860171, -7601555, -1443646, -1991254, 1526861, -3666828, 5043366, + -4714801, -4472672, -7270843, 1663763, 1564979, -1967095, 584652, -458488, 484794, -1779190, + -2386928, -3936338, -1628866, 759136, -2464774, 802085, 397284, 2029909, 1350767, 1185411, + -706522, 3729105, 1531156, 1839857, 289910, -29528, 172872, 1997160, 492311, 1932735, + -1236414, -287763, -713501, 797790, -2956548, 148713, 1522566, -2134599, -425202, 503585, + -583042, -549219, 1074816, -1156957, -433792, -1489280, + }, + { + -14815490, -6765111, 15340013, 7113003, -15660525, 5867462, 2510945, 1824287, 2137820, 6442988, + 2942590, 5505611, -5577552, 5041218, 16214575, 4728759, -13905493, 12805445, 2044941, 6997039, + 1258962, -1371168, 3985730, -7941395, 8144869, -10189273, 7130183, -1144609, 10267656, -2070711, + -4248260, 3020973, 135828, 1122597, -2606508, 1508607, 1465658, 4806606, -1386201, 3904662, + 351650, -1390496, -4378719, 1435593, -412854, 5486284, -2137820, -1829119, -495532, 792421, + -2031520, 284005, 3235184, -6710350, -1334661, 6606734, 3646427, 2877628, -2270964, 2798171, + 2882997, 1209570, -3159485, -770947, 846645, 4876936, -2684, 2699387, 310848, -907312, + 1938641, -2168422, -2684, -710817, 1045288, -2187212, 3166465, -157840, 2275796, 526670, + 500901, 2059437, 150324, 2588255, 1316944, -169114, -1580548, 1029718, 1656784, -599685, + -521302, -634045, 401579, 994285, -1111860, 1047435, + }, + { + 1521492, -29921426, 57892400, -3823595, 4829154, 289373, -2518462, 2601140, -440771, -2652679, + -405338, 2678986, 3729642, -13237089, -1590749, 10116795, 15131707, -3444564, 4303021, 16420197, + -4938139, 4911832, -9990094, -1352915, 7212861, -11523397, 8697309, -10999411, 14300094, -10240813, + 17987860, -8375186, -9826885, -865973, -5915244, -328565, 9190156, -3456912, -9340480, -3035468, + -230318, -1564979, 1873680, -6243809, 4909148, -4153234, -3417183, 5306969, -1537061, 57445, + -83752, -815507, -3352222, -1695975, -343597, -2519535, 2131915, 3803731, -2680597, -2083059, + -383326, -1601486, 390305, 1454383, -1794223, 1746441, 870805, -717260, 542777, 1547799, + -736587, 1344325, -1083406, -591632, 2217277, -1491427, 167504, -1362578, -1056562, -2176475, + 2472828, 411243, -1808718, -2735357, 1881733, -343061, -529892, 2223183, 1017907, -137976, + 981400, -231928, -281320, 139050, -736587, 680752, + }, + { + -5399848, 67294624, 38191388, -4364761, -11905112, -9943923, 38082940, -12244415, -16401406, -15743203, + -3623879, 4402342, -31675, 10858214, -2249489, -8533026, -14431090, -21933862, 2013803, -3498251, + 5434208, -13805636, 8515846, 3681324, 6725919, 14063870, -13575318, 6561100, -7408819, -709743, + 377957, 4167192, -11267310, 8470212, 4387309, -3891240, 4804995, -13273060, 11228118, 6115497, + 6897718, -8450348, 3341485, -4854387, -4828617, 1064078, 6032282, -4575751, -1194001, -2728378, + 209917, 4434017, 3983582, -2289755, -6901476, -4456566, 3382287, -4101157, -2068027, 3686693, + -1582159, 806380, 142271, -1482301, 1189169, -6222871, 2924336, 1812476, 2225330, -2689187, + 1743220, 1298154, -3236795, 3183645, 529892, 1578937, 1825898, -19327, -4953708, -2410014, + 1750199, -2406792, -1977296, 2266669, 264141, -55835, 2049773, 401579, 195958, -908922, + 1207960, 887448, -1675037, 306553, -1659468, 311385, + }, + { + 16106, 45294188, -25884158, -11874511, 2122251, -3728032, 10402948, -2375654, -14257144, -11429445, + 12062416, -2938295, -408022, -14549202, -25694104, 13003013, 5658083, -1787243, -4296041, -11151883, + 8858907, -8471823, 10732586, -10767483, 13273060, -1092532, 611496, 14879377, 6707665, -579821, + -614180, -8597451, 773631, 8534637, -20201916, 6182606, -5966247, -686658, -2357400, -638340, + 1766305, -2602750, 781684, 6628745, -1023276, 572841, 5399311, -5864778, 3261491, 15032, + 387621, 1189169, -1667521, -5322538, -1010391, 1862405, -4998805, -1291711, 2884071, 3258807, + 1196685, 1857573, 3610994, 5112085, -309775, 1729261, 690953, -4667019, 2634963, 3167539, + 1228361, -2492692, -1833414, -2471754, -1487669, 939524, 3808026, 1122060, -4497905, 1551557, + -583042, -1327682, -391916, 1140314, -1101122, -1236414, 2448131, 2516314, 1485522, -430034, + -1735704, -1120987, -2542084, 1240709, -695785, 868657, + }, + { + -5981279, -122469384, -15280957, -4373888, 4240744, -22921166, 7501698, -4306242, 5464809, -8653822, + 7187091, 86973, -1068373, -5546951, -5930276, 6184216, -1427003, 5547487, 10522670, 4370129, + 2201171, 710817, 10867341, 3451543, -5850283, 8195335, -4898410, -922344, -1369021, -2121714, + 1364189, -7789997, 2055142, -7390028, 4891968, -7590281, 8567386, 5362267, 4108673, -374736, + -1238024, -334471, -9820443, 4788889, -1284732, -1735167, -1174674, -2344515, 3608846, -2321967, + -3664681, 2080375, 7920457, 1590749, 5989869, -6182606, -3461744, -1729798, -982474, -2631741, + -1202591, -2334315, 1623498, 1360968, -3780645, -755377, -3402688, 845572, 1119913, -4679367, + 276489, -2056216, -1291175, 1771674, -773094, -1620813, -1334661, 3188476, 694711, -1581085, + 1869385, -1610076, -979789, 1377074, 310311, -273267, -2492155, 526134, 2278480, -143345, + 1165010, -1072668, -113817, 2649458, -1306207, -1302986, + }, + { + -711354, 11768210, -26962730, 3099893, -4589173, 3704409, -11918534, 6234682, -2515240, -1276142, + -3597035, -3591667, 16842178, -6260989, -20696374, 11966853, 4162360, 13009993, 6578816, -10657961, + -1136556, 5782100, 10777684, -10356240, 4016868, -3474629, -1966558, -9227200, 5201206, -1455457, + 6202470, -8998493, 7369627, 834834, -3155190, -2014877, -12749074, -10718628, -2173790, 12706661, + 5183489, -4399121, 5035849, -2157684, -6685117, 3046206, 2558727, 13959, 1482301, -560493, + -3053185, -5667746, -1522029, -1724429, 7188702, -1883880, 544387, -2370285, -46708, 4910758, + -575526, 3371549, -6363531, -410706, 2991445, -2420751, -4293894, 2324651, -4118337, -928787, + 1430224, -1667521, -2306398, 3110630, -2388539, -1568737, 644245, 2927020, -580357, 2815888, + -26307, 41339, 288300, 1560147, 2037962, 2114198, -1491964, 2598455, -1896765, -1243393, + -2068564, 103616, 1629940, 687195, -1300838, -1263257, + }, + { + -7057705, -98912560, -7292855, 17723720, 576599, -12536473, 27945742, 3669513, 693100, 9635759, + -482110, 9611063, -19826642, 6027450, -17463338, 7249905, 2900714, -7573638, -7394860, 9040369, + 831076, 8076686, -7082401, 413927, 3097208, -5094905, 3782256, 6586333, -5204964, -10479720, + -9171366, 6244883, 1017370, -7456600, -4235912, 5571110, 8884140, -4570919, 3908420, -1500554, + -874563, 4735739, -390842, 12471511, -8298414, 5907728, -3475166, 1149441, -1231582, 4787278, + 2754685, -4831302, -388695, -207232, -3337727, -2811056, -1132798, -574989, 6021008, -2701535, + -1240172, 1406602, -1071058, -5858336, 3502546, -1664300, 25770, -871342, 803696, 321586, + 1034013, 1327682, -5879810, 1969779, -722091, 2922188, -1732482, -579284, 1712618, 967441, + 664109, 1906429, 1389959, -1584306, 972273, 207232, 388158, 1216550, 1904281, -123480, + 930934, 742493, -800475, 2106145, 401579, 736587, + }, + { + -566936, 59870772, -9744207, -4672925, 1207960, 6823630, -14387604, -2469606, 2194192, -2018098, + -1635309, 2293513, -2105071, 9245991, 24234352, 31976032, -941135, 4031364, 2335925, -11554536, + -16294032, 7067906, -6280316, -3967476, 10872173, -5866389, 9251360, -3257733, -2207076, 12955769, + -882079, -2971044, 10286984, -9250823, 7822209, 2211908, -6311992, -1955821, -7598871, -5028333, + -2248952, -201327, -535260, -454193, -6214818, 4459787, -5403069, 2103460, 1175747, -234613, + 9334038, 920734, -1214939, 1886028, -5210869, 294742, 1358283, 2558190, 3479461, -2998961, + 2916283, -1817308, -2038499, 821413, -1664837, 1474784, 2210298, -561567, 947577, -4396436, + 2081449, -1598265, -4174708, -1887101, -2048699, 1468342, -1960653, 622770, -604517, 1536525, + -979789, 1251983, -1337882, -1673964, 1236951, -1463510, -815507, 216359, -928250, -1120450, + 1739462, -1858110, 2843805, 886374, -532039, 6442, + }, + }, + { + { + -4447439, 113771536, -5532992, -60713120, -17794050, 7514582, 4105989, -1789391, 12902619, -7812009, + 4068408, -2722473, -2980171, -3130494, -1172526, 1700807, 3547643, 15830176, -4363150, -25338696, + -4204236, -8628589, 868120, 3672734, 977642, 1898376, 387084, -3926137, 348429, -9430138, + -1302449, 7704635, 3935264, -7623567, -3826816, 4247723, 4526359, -3432216, 2280091, 1218160, + -5971079, -3723737, -1061931, 1899449, 3367791, -402116, -3239479, -2647311, 501974, -1964948, + -2334852, -533113, 870805, -2252174, -3011309, -95026, -247497, -3764002, -993211, 889058, + -1002875, 3621194, -59056, 5521181, 2354179, 2091649, 555125, -4520453, -792958, -2668249, + 378494, 13422, -2964064, -464930, 33286, -20401, 1145683, 493384, 2201708, 772557, + -1034550, -413927, 462246, 2339147, -326954, 819802, -1484985, 461172, -823560, 815507, + 858993, -114890, 895501, -100395, 947577, 260919, + }, + { + -321049, -58269284, -2615635, 4285304, -16777216, -3316789, -2861522, 6474127, -1345399, -2967823, + 4656282, -2612951, 11964705, 4319127, -372588, -4106526, -1711545, -15078556, 1385127, 12167105, + 3425237, -9564355, 855235, 7600482, -979789, -5950141, -3435437, 719944, -6458020, 4146254, + -3660923, 492848, -11848741, -714575, 809601, 6990596, 3272765, 1919314, -5513128, 3514894, + -6622840, -4938139, 458488, -2640868, 467615, -3486440, 5149129, -2105608, -5234492, 1669132, + -2256469, -1021665, 209917, -348429, 655519, -1561221, 1330366, -1528472, 929860, -5149666, + 577673, 3337727, 838592, 889595, -1610076, 299037, -1093606, 1455994, 2235531, -2157684, + 471373, 1660542, -1285806, -84826, -581431, -690953, -2711735, -2021319, 823560, -501974, + -76236, 1926293, 1859721, 1010928, 1168231, -928250, -1548873, -957241, 595927, 482110, + -1014149, -387621, -419296, 69256, 278099, -2779381, + }, + { + 434865, -18435610, 814970, -32908576, -14950781, -1683090, 4221416, 5127654, -5701569, -4948876, + 10050760, -16388521, 547071, -8587250, -513785, 2188823, -2264522, -225486, -224412, 11427834, + -5909338, 12023761, -1110786, -3568581, 5506685, -4572530, -5835787, -1327145, 1429687, 3522947, + -944893, -1797981, -3416647, -1050120, -6990060, -817654, 3033321, 1906429, 207769, 921271, + 1345399, 470299, 2107755, -3473018, -934155, 9595494, 5219459, -454730, -2680597, -3293166, + 3125663, 7156490, -3880503, 1298154, 697395, -3974992, 3411278, 1122597, 695785, -3437585, + -1341640, -807991, 3571802, -5004174, -1316944, -227633, -1805497, 1387274, 1697049, -1794760, + -881005, 3854196, 1153199, -2039036, -2889439, -2970507, 2114198, 702764, -1210644, -454193, + 1161252, 535797, -103616, 1008244, -942745, -1352915, 1235877, 670552, 125628, -212064, + 413391, -63351, -43487, -927713, -98247, -564251, + }, + { + 14150307, -601295, -35464620, 12750684, 11872900, 4233227, 804233, -5663988, -6039798, -4016331, + 3974992, -6980396, -3850438, -1330366, -10261751, -4011500, 5059472, -1176284, 6059662, 11157251, + 5220533, 573915, -5892695, 3842922, 5577015, -3959423, -1130650, 1918240, 1521492, -1204738, + 857920, 608812, 8041790, -8097624, -6659347, -10162429, -2610266, 103079, -407485, 798327, + 3406446, 1173600, 5645735, 3068754, 4077535, -5709086, -3875134, 759136, -3869229, 5947456, + 469762, -232465, 2264522, 653372, -1164473, -53150, 901943, -1372779, -527744, -5350993, + 3502546, 1289564, 2400887, -1840394, -1130113, -492311, 2484639, 2146410, 738734, -1228361, + -869194, -3163780, 2009508, -54224, -1203128, 1067299, -1857037, -26307, -1887638, -941672, + -603980, 28991, 1263257, 2233383, -1418950, 417686, -1660005, -1198296, -857383, 687195, + 2168959, -2046015, 1882269, -607201, 234076, 430570, + }, + { + 377957, -37719476, 26203058, 5384815, -1317481, -1020592, -1674500, 1828046, -2656974, -1479616, + 5915781, 7947837, -1440425, -13236552, -14278082, -9495099, -12782896, 10207527, -18708878, 5349919, + 2806224, -403190, -4801237, 3441880, 344671, 1411434, 6026376, 4544076, -29528, -206695, + -10455024, 682900, 1413044, -2123861, 10220412, 3294240, 3627637, 4845260, -8847096, 149787, + 9908490, -5480915, 1407676, 1561221, -3441880, -1997160, 4968204, 245887, -3602404, 1494649, + 1921461, -2852932, -5711770, 1442035, -2957085, 4878546, -1111323, -490700, -1656784, 328565, + 952409, 1648194, 1647120, 1702418, 2782065, 1751810, -2502355, -2162516, 2216203, -345745, + -1579474, -1050656, 688805, -2540473, 1505386, 256087, 2478733, -81604, 297427, -1557999, + 85899, -447750, -905701, 898722, -2174327, 750546, -1309965, 751619, -1287953, -485868, + -11274, 183073, -715649, -150324, 732292, 928250, + }, + { + 16756278, -13580687, -23517630, -182536, 5786932, 227633, 543850, -3297461, 3172370, -11024107, + 5956046, -8491687, 4951024, -15569, -9165997, -8260296, -3357054, 477278, -10648298, 1017370, + 7958038, -9028021, 5323612, -14014478, 17925046, 9034464, -1679869, 164283, 2183991, 6382322, + 2150705, 9700721, -4851166, 140660, -976568, -2918967, -4165045, -2874944, 1213328, -1781338, + -453656, 3527779, -7623030, -3234110, -4168803, -3445638, 8080981, -4203699, 2894271, -324270, + -2149631, 5171678, -204548, 26844, -1852742, 3659849, 209380, 937377, -4525285, -886911, + -188442, 1204738, 3143916, -3059091, 1629403, -2452963, 477278, -1231045, 1879048, 870268, + 1979443, 2984466, -2438468, -2550137, 2558727, 1473711, 652835, -1477469, -836445, -444529, + -374199, 726923, -1475858, -953483, 986232, 360777, 1305133, 358630, -1214402, 1021129, + 748935, 2113124, -767725, -102005, -1292785, -1089311, + }, + { + -1590212, 885837, -8295730, 6650220, 2043331, 850404, -655519, 4871030, -1709934, -909996, + -3861176, 3751117, -5291937, -487479, -4490925, -10744398, -19495394, -11842299, 6150393, -3023657, + -11901354, -3735548, 12377559, 5985574, -367757, 2123861, 3497714, -6662031, 2189360, 21437792, + 3733400, 468151, -5976447, 11664057, 1284732, -6521908, 7371238, -7363722, 5150203, 3969624, + -1269163, -4959077, -4234301, 6886443, -2115808, -1866163, -2512019, 2842732, -6702834, 5286568, + -1347009, -5797669, -3546569, -1478006, 2305324, -5590974, 1632088, -436476, -836982, 1254131, + -2576444, -2546916, -1670205, -2900714, -1423782, -168041, 2477123, 1236414, 453656, 725850, + 2660195, 2663954, 1771137, -1080184, 741419, 1580548, 233002, 814433, 3669513, -2319282, + 81604, -95563, 1607928, -1250909, -1887101, -664646, -209917, 331249, -1939715, 737124, + -1061394, 275415, 79994, -852014, -1130113, 191663, + }, + { + 17732310, -3774740, -17266842, -17226576, 5059472, 2291902, 6064494, -3115462, 3809636, 2706903, + 19835232, -4755603, -4160213, 5726802, 8138963, 16050830, -12292196, 1095217, 3811784, 7461432, + -1303523, 365072, 5296769, -5280663, -19327, -5444945, 4511863, 1374926, 6425271, 1062468, + -3474629, 2346663, -1335198, 959925, -3988414, -2314451, 9091909, 2024540, -3550864, 79457, + 826781, 1366337, -6388227, -2752000, 3310883, 2335925, 2472291, -4788889, 2593624, 230854, + -4058207, 2852932, -2719251, -53150, -1823214, 4435091, 2148021, 5298916, -1827509, 45634, + 3994857, -1447404, -543313, -875100, 2596845, 3274376, 1059246, 1818919, -568009, 1171452, + 1680943, -3910031, -62277, 1968169, -1382980, -967978, 879395, 1828046, -228707, 1115081, + 456877, 2566780, 388158, 1658931, 1584306, -1093069, 25233, 963146, 1363652, -935229, + 14496, -1132261, 1191853, 906775, -199179, -1051730, + }, + { + -2460480, 35443680, -16487843, 11696807, 3757560, 2581275, -2606508, 89121, 962610, -366683, + -3183108, 6367826, -245887, -9795747, -4449049, 8980777, 13253732, -246961, 2921115, 7504382, + 3477850, 3656628, -3908957, -7264401, 4639102, -7631083, 4791036, -2660732, 3183108, 4862440, + -3378529, 1146756, -7029788, -3098819, -1450625, 149250, 3740380, -105227, -12957916, 624381, + 2386928, -3802657, -575526, -6501507, 4009352, -3147137, -1156420, 2502355, -1544578, -1549410, + 1263257, -1162862, -1814624, -3428458, 1765232, -3206193, 2386391, 2585570, -1727114, -2215666, + -2074469, 76773, 1290638, -1088774, -589484, 301721, 1388348, 328028, -22549, -1092532, + 169651, -450972, -71404, 1225139, 664109, -906775, -41339, -1785633, -1432909, -981937, + 851477, 714038, -1898376, -421444, 832150, 221191, -966368, 1408212, 1071594, 2222109, + -1077500, 1442035, -954557, -394600, 352724, 1389422, + }, + { + 5996311, 103329400, -9637907, -1889786, -16936666, 2253784, 20498268, -3635153, -14235132, -8203388, + -12679280, -1724966, 5503464, -776315, 10312216, -7864085, -17727478, -12895102, -2854006, -11382200, + 5054640, -12913893, 6316823, 6615324, 7354058, 15023796, -10510859, -53150, 1092532, -6367289, + -1450088, -1316944, 1181653, 5425618, 2793876, -8154533, 5555004, -5319317, 155156, 6795712, + 4068408, 1390496, -9747428, 270046, 1627793, -3362423, 3732327, 3746822, -2372433, -3554622, + -1502702, 1968169, 11440719, -8047158, -5397164, -396211, -2761127, -2935610, -316217, -1839857, + -498753, 2900177, 639950, -3745748, 2073932, -2630131, -2579128, 3401614, 842887, -3585761, + 4052302, -505732, 556198, 637266, 744640, 695248, 1638530, -1186485, -3475702, -1487132, + -313533, 1446867, -3846680, 587337, 969589, 747861, 3546032, 616328, 421981, -969052, + 1052804, -877247, -114354, 152471, 256624, -1711008, + }, + { + 192200, -8720394, 21160766, -8390755, -3484829, -3893388, 14208289, 557272, -15083388, -5320391, + -3999152, 2858838, -3448322, -3105798, -15653008, -3299609, 10594611, -8747775, 4611721, -14246407, + -6089727, 11297911, 10760504, -18407692, 11040750, 5599027, -2785286, 4563940, 16215649, -12250320, + 5469104, -5096516, -1299765, 1327145, -6731825, -10560788, -1443109, -4437775, -180926, 3003793, + -4578972, -5488968, 5706938, 1030792, 3594351, 3409667, 3033321, -3889630, 2707440, 26844, + -1844152, 3040300, -2415919, -7856569, 2012729, 555661, -285615, -5549635, 5533529, 3823595, + 157840, -2398739, 5334887, 3806415, 3947075, -73014, -172872, -1844689, 584116, 5364951, + -2327872, -1533840, -987306, -1046898, -3868692, 208306, 3073586, 682900, -841277, -1216013, + 2391760, -2356863, -1418413, -1269163, 955093, 39192, 3530463, 1239098, -322659, 187905, + -369367, -1787243, 82141, -1702955, -32749, 914828, + }, + { + 3674882, -133233640, -8039105, 439160, -6259915, 229244, -22420266, -2069637, 1413581, -4095788, + -6376416, 10768557, -9536975, -523449, -12122545, 2345589, 13429826, -8663486, 16879222, 6834367, + 1354525, -3082176, 4878546, 5114769, -2585570, 4462471, 4799089, -6926709, -4638565, 5628555, + -4463545, -5627481, 2906619, -3031173, 348966, -7737384, 5326833, 5951751, -592706, 3689914, + 3681324, -4698158, -4297652, 2398739, -3336116, 502511, -2995740, -6505802, 3826816, -2273648, + 4027606, -1451162, 2316598, 5080947, -1642288, -1233193, -1236951, -2799245, -4781909, -809064, + -249645, -3611531, 1847910, -980863, -3986267, -452045, -1659468, -1846299, 3491809, 411243, + -3706020, -1379758, 1603097, 1887638, -2751464, -484258, -2254321, 2670396, 2738042, -2201708, + 1481764, 60666, -98247, 1990181, -1343251, -1677185, 210453, -885837, 1137630, 2505577, + -217970, -763430, 387084, 461172, -806380, 1082332, + }, + { + 277025, -29930554, 2793339, 1950989, 2611877, 729071, -7844758, -803696, 2961917, -2813204, + -6990060, 6089190, -5477694, 11725261, -3766686, 11141145, -8104604, 17885318, 2161979, -7133941, + 2615635, -4377109, 16305843, -5195300, -13871671, 9650792, -7062000, -3227668, -6295349, 4500589, + 6602976, -14532022, 8404714, -6230924, 10819559, -7797513, -3367254, -8079907, -1364726, 6496675, + 2895345, -962610, -2322504, -156766, -2498060, 1515050, 3745748, -2645163, 926102, 1370632, + -6861747, -3790309, -1471026, -318364, 5450851, 1108102, 132607, 2051384, -2072322, 3188476, + 3624416, 2567854, -6553583, 1556926, -1218697, -1963874, -4509716, 3515968, -2085744, -227633, + -1245004, -244276, -1056025, -403190, 2378875, -2357400, -1323924, 3133716, -538482, 3734474, + -3419868, 2236604, 2758980, -2653216, 4327717, 2336999, 338229, -587337, 729071, -3216931, + 88047, 1028645, 2483565, -1964948, -881542, -645319, + }, + { + 5792301, -94302984, -16056735, 8788040, 4922570, 3534758, 5674726, 9230422, -5931350, 10967736, + 3221226, 3929895, -8549669, -4570382, -7835631, 5257040, -2086817, -8377871, 7244536, 332860, + 2911451, 5760088, -8286603, -784368, 12763569, -5713917, 3399467, 1173063, -2520609, -7431367, + -9339406, -1086627, 2095944, -3794604, 3798899, 3140158, 2371896, -4612258, 5186710, 2003602, + -3113315, -3900367, 7606387, 7424925, -9467719, 3594888, -1156957, 4009352, 1194538, 2552821, + 571231, -2784750, -1262720, -576063, -5920076, 2552284, -3919695, 3542274, 3993783, -3067681, + 3336653, -2843805, -2937758, -1819456, 346819, -1310502, 1423245, -1940788, 878321, -600222, + 752693, 716723, -2079838, -1346472, 2623688, 18790, -137439, -1735167, 1249299, 477278, + 1832340, 2098629, -16643, -460635, 286689, -542777, 2966749, 140660, 115964, 928250, + 623844, 35433, -912144, 1696512, 1707786, -4295, + }, + { + 609885, 28419262, 12946105, -13696651, 10355166, 2823404, -11425150, -1960653, -2604361, 684510, + 4566624, 2401961, -6613176, 37044, 52470004, 6118718, 8699993, 3512747, 14582488, -11875048, + -7833484, -2546916, -2581275, -1161789, 5452461, -6648610, 2692408, 1440962, 5359046, 10067403, + -159451, -9663676, 8880382, -8766565, 7358890, 1144609, 1187022, -10369662, -6684580, 337155, + -1721745, -7124814, -3053722, -2480344, -357556, 1519345, -2684892, -1372779, 2483028, 3721589, + 3959423, 2145873, 208843, -971736, -6205691, -46708, 4157528, 1612223, 4348118, -2499134, + 1540283, -1076426, 450972, -2404108, -3018288, 3042448, -515933, 4668630, -754304, -2360622, + 673236, -3805341, -1154273, -648540, -471373, -3209414, -477815, 1361505, -619012, -1920924, + 462246, -418222, -1540283, 1005022, -183073, -1843078, 71941, -524523, -2170032, 237297, + 240518, -1077500, 2039573, 783832, -404801, -725850, + }, + }, + { + { + 5102421, 100581688, -6474127, -33172180, 5548024, 5698885, -16643, -900869, 16603270, 1442035, + 1475321, -11895449, -4654671, -674310, 124017, -1311039, -2187212, 12134893, -5849209, -3991635, + 18676128, -4326643, -3064996, -3009698, -8426189, -5453535, -2108829, 314069, 11295227, 3540127, + 5141076, 5095979, 10310069, -2027225, -2440078, 7029251, 8540006, -1802276, 413391, 5149666, + -1078574, -1181653, -2622078, -1147830, 645856, 1871532, 748935, 2815888, 1401770, -3117610, + 1350230, -136902, -2343442, -2310693, -4664335, -3251290, -519154, -4756140, -2362769, 8053, + -2940442, 1471563, -4270808, 2682207, 1242856, -1392643, -536871, -3454764, 823560, -2309082, + -1215476, -28454, 254477, 1804423, -911607, -1393717, -656593, -1038845, 1174137, 740882, + -1778653, -547071, 106837, 707059, -1283122, 660888, -1259499, 779000, -1105417, 1287417, + 1428077, -818728, 532039, 213138, 900869, 488016, + }, + { + 1148904, -16487843, 33478196, 21979496, -17253420, -4578972, 628676, 10343355, -2134599, -3041374, + -1639067, -8003672, 6112812, -764504, 1083406, -8255464, 6033356, 4358855, 12207371, 7541426, + 6963753, -8637179, -3566970, 400506, -2524367, -1301912, 1634235, 3272765, -7417946, 4176319, + 1850594, 6358699, -11087995, 1322850, 544924, 690416, 1065689, 6471979, -4457103, 2660732, + -3638374, 2959769, 3400004, 306016, 7068980, -700080, 2582349, -6433324, -6089727, 3040300, + 3467112, 3336116, 1115618, -1539746, -4439386, -2379412, 3036005, -106300, -1040993, -5822365, + 3937411, 3695283, -2622078, 163746, -2595771, 1155346, 2329483, 1947768, 2655901, -2297271, + -1418950, -361851, -643708, 949188, -178241, -337155, 306553, 1589138, 2058363, 1078037, + 1222455, 839129, 795643, -377420, 389768, -115427, 256624, -366683, 391379, 861141, + 2222646, 1819992, 445066, -632971, -28991, -1792075, + }, + { + 155156, -80633176, -37771552, 12735115, 5561446, -3390340, 6076305, -1910187, -10265509, -2882460, + 7128035, -15818365, 6347425, -3243774, 7439420, 10686416, 550293, -11688753, -15070503, 5114233, + -6964290, 7363722, -4342212, 1502165, 5316096, -6543383, -10757282, -1348083, 1280974, 89657, + -166430, 369367, -8217883, -256624, -1749125, 797790, -2379949, -7377143, -4731444, -879395, + 3918084, 1963337, 4566087, -5567352, -7159174, 4758287, 1375463, -672699, 603980, -1935420, + 2763275, 4238059, -4187593, 3967476, 545998, -2667175, 2900177, 763430, 2339147, -2215666, + -2056216, -2253784, 3163244, -1154273, -815507, -2048699, -1456531, 230854, 1141924, -2241973, + -2235531, 769873, 969052, -345208, -2894271, -2070711, 4002373, 2054068, -740345, -533650, + 1298154, 756451, -789737, 1179505, -478352, -1999307, 1058173, 1633161, 1453846, 861141, + 933619, -847719, 631360, -76773, 289910, -405874, + }, + { + -13597866, 1911261, 5051419, 8906688, -1347009, 1999844, 1669132, -6715182, -6038187, -9734007, + 1156420, -3524021, 1724966, 3754875, -6107444, -2013266, 3646427, -3398930, 1527398, 5496485, + -513785, -1671279, -8347269, 507343, 8316668, 2201171, -4683662, 2574833, 537, -2476049, + 6379637, 1129040, 3907883, -4239133, 2309619, 3658239, 5527623, -1639604, -325881, 60666, + 8801462, 3610457, 3820374, 2371896, -643171, -723702, 269509, 1286880, -3795141, 2775623, + -973347, -91805, 2573222, 1233729, 473520, -913754, 892279, 1472100, -1066226, -5200132, + 3433826, -1695438, 3131568, -92879, -1273995, 2972117, 2477659, 2305861, 1554241, -2708514, + 22549, -773094, 2226404, 1702955, 4832, 965294, -1287417, 587337, -1374926, -792958, + -381715, -96637, -28454, 1968706, -945967, 536334, -1078574, 665183, 146566, 415538, + 879931, -1990717, 1074279, -1261647, 527207, 430034, + }, + { + 249108, -50768124, 15869367, 9508521, -5370857, -149787, 1129576, 2837900, 1129040, 528281, + 5337034, 5206037, -217433, -9468255, -5123896, 6338298, -12598213, -395674, -15163919, 2538863, + -4545149, -5969468, -17506286, 7640747, 6457484, -7179575, -1093606, 3242164, -1997160, 4332549, + 455267, 267362, 1008780, -4255239, 1506997, -1188632, 7795903, 5661304, -4671314, -1714766, + 10501195, -6038187, -3552475, 543850, -2218888, -1420024, 1142461, -1501091, -4235912, -549219, + 1961190, 2250026, -2595771, 1629403, -441845, 4182225, -3341485, 271120, -2677375, -2768643, + -1922535, 847182, 1242856, -1111860, -321049, -539018, -1850594, -1472637, -249645, 1410360, + 1170916, 900869, 268435, -2974265, 2176475, 1239635, 3215857, -955630, -472446, -1813550, + -70330, -779000, 238908, 1585917, -3516505, 498753, -584116, 681826, -1220308, -658741, + -1204738, -180926, -719407, 280784, -53687, -488016, + }, + { + -13888314, -24870008, 16313896, -3171297, -4729833, -3624953, 974421, 6293201, 10038412, -12192875, + 6275484, -12235825, 7698192, 4958540, -7422777, -5400385, -3257196, 729071, -6223408, 1671816, + 4509716, -6756521, 6783364, -11433740, 15615964, 4059818, -675384, -1794223, -5322538, 2508798, + 2276870, 3726421, -5791764, 5281736, 3288871, -3463891, -6571300, -5992553, -1467805, -3260417, + -2241973, 1755031, -6425808, 505196, 3184718, -1583769, 5401995, -8298414, -1656247, -2485712, + -5986111, 2556579, 3692061, 3690451, -3136937, 2416456, -249645, 685047, -2865280, -468151, + 1262720, 1745367, -374199, -2899640, 3104725, -1676648, 1252520, -1260036, 1277216, -103616, + -112206, 1143535, -1568737, -2185602, 572841, 860604, 985695, -429497, -493921, 1074, + 137976, -17717, -1139777, -1283658, 591095, -421981, -286689, 223338, -1682017, -93952, + 168577, 839666, -1080184, 585189, -586263, -705448, + }, + { + 503048, 14470819, -14491220, 1902134, -3888556, 396211, -376883, 2246805, -8101919, 801548, + -1031329, 6090801, 2097018, 4677220, -2553358, 1826972, -2959769, -6753299, 8738111, -2020782, + -16493748, -7885560, 1072668, 3482682, -5295158, -1587527, 9215389, -3429532, 1117765, 8084202, + -1832340, 4373888, -1410360, 9597104, 941135, -7003481, 7238631, -3805341, -409633, -1809792, + 59593, 2069637, -346282, 3741454, -529892, 608275, -3155727, 5027796, -1235877, 4903779, + -2494839, -3413962, 907312, -4851703, -1586990, -4687957, 3072512, -798327, 905164, 4710506, + -1938104, -1805497, -1413581, -2762738, -459562, 1053341, 3582003, 209917, -313533, 864362, + 2073932, 34360, 1082869, -809601, 856309, 507880, -1567126, -1166621, 3675418, -2253784, + 1214939, -1670205, 344134, -1346472, -968515, 1238561, 149250, 1134408, -2190970, 308701, + -1681480, -148176, -339302, -873489, -1088237, 919123, + }, + { + -17801028, -19022410, 20524574, -24596204, -6451041, -3655554, 7316477, -1882806, -347355, -4284230, + 21369072, 1342714, -1073742, 6717329, 355945, 4625143, -9514963, 3404299, -2136746, -3722126, + -6752226, 1414118, 10147397, -2402497, -239981, -476205, 2385318, -3991635, -1358820, 345208, + 2393908, 4866198, -6778532, -6564858, -2764348, -1955821, 5075041, 216896, -4693326, -3456912, + -1204738, 3610994, 1341104, 1747515, 1899986, -1289027, 4949950, 3224447, 7191386, 1870995, + -3103651, 1746441, -1594507, 4308389, -679142, 1602023, 200790, 4165045, -2822331, -127238, + 1726040, -3264175, 2531346, -1404454, 485868, 3407520, 714575, 2216203, 695248, 1563905, + 1282048, -3937948, 567473, 2814814, -1579474, -1049583, 31139, -81068, -2817499, -118112, + 166430, 1743220, -1657857, -1044214, 244276, 364535, 1207960, -484258, -33286, -469762, + 792421, -1569811, 193274, -92342, 710280, -355945, + }, + { + -1096290, 22863722, -48716740, 4384625, -3584687, 499827, 177167, 1532230, 1651415, 1170916, + -6517613, 920734, 9878962, 4406637, -5288716, -11453067, -5768678, 2181307, 5257577, 1313186, + -3141232, 1765768, 559420, -71941, 4474819, -10464688, 10659035, -3121368, -4470524, 5187784, + -6066105, -424128, -5192079, -129386, 3468723, 4292820, 1616518, 5120675, -8376260, 4873714, + 3524558, -3835943, 1183264, -7276212, 3273839, 19864, -2238215, -3571802, -2619930, -1080721, + -1363652, 133144, 963683, -3163780, 1169305, -3365107, 2312840, 344671, -1580011, 359167, + -1574642, 949725, -137439, -2671470, 929860, -1345399, -362388, -1034550, -925029, -1097364, + -581431, -780073, 983548, 1224603, 663572, 116501, 1744294, 615254, -455803, -645319, + -151934, -8590, -1011465, 484258, -661962, -478889, -454193, 896038, -102005, 1141388, + -1005559, 1418413, -1461900, 824634, 1548873, 307090, + }, + { + -5032628, 81429360, -20787642, 3922916, -6858526, 4976257, 8598525, 7422241, 161598, -4347044, + -15068356, -3493419, 3203509, -9446244, 5099737, 7793218, 1844689, -4328254, -6578816, -24332064, + -3557307, -9578851, 193810, 3588982, -4310537, 11113765, -2524367, -135828, 3911105, -5563057, + 2818036, -2515777, 3937411, 6885907, 1785096, -5778879, 2079301, -8104604, -5666136, -2416456, + -1225139, 5008469, -7890929, 1080184, 2760053, -5337034, 1213865, 7301445, 2434173, 1880122, + 56908, 810138, 10597832, -969052, 3030100, 802085, -4175782, -2244657, -616865, -7714298, + 92879, 3246995, 575526, -3629784, 556198, 573378, -1924682, -774705, -1093069, -1598265, + 3069291, -699543, 1687922, -2254321, -1624035, -1457068, 1530082, 2042257, 813359, -287226, + -1769527, 1338419, -2413772, 850940, -795106, 397821, 2537789, 291521, 2062121, -456877, + 1497870, 484794, -414464, -1417876, 466004, -1306744, + }, + { + 1156957, -43517684, 893353, 4450660, 466004, -1569274, 16324097, 4517769, -6480569, -2479270, + -4575751, 8884677, 2028835, 972810, -3024194, 5317170, 5295695, -10602127, 9815074, -9654013, + -8583492, 7092602, -3675955, -19690814, 4559645, 1528472, -2940979, -1874216, 5000416, -17920214, + 9718437, 1792612, 1897839, 1314260, -4889821, -11631845, -3109020, -7304129, 312996, 1238024, + -6604586, -2837363, 3246995, -5465883, 5683316, 5131949, -2604361, -6198175, 2296197, 2535105, + -2068564, -49392, -943819, -1857573, 6516003, 2853469, 1580011, -6512244, 4607963, 4001299, + 1346472, -4275103, -1235340, -424665, 4198331, -3058017, -1541356, -1836635, -959925, 5011690, + -1381906, -1058173, 504122, 25770, -2874407, -406948, 992674, 1934346, 379031, -3118683, + 1616518, -2135136, -78920, 1332514, 3623879, -588411, 1457068, 993211, -71404, 2048699, + 732292, -1308354, 1742683, -1690070, -1139777, 1054415, + }, + { + 1550483, -109188272, 31849866, 18242874, -12984760, -1420024, -25272124, -5055714, 1263794, -4468377, + -31805844, 1097364, 92879, 7098507, -15065672, -15729244, 590021, -12715251, 15930571, 119185, + -2605972, 1316408, -5277441, -4705137, -3377455, -594853, -288837, -3151969, 886374, 8599598, + -19327, -2109366, 800475, -7707856, 3270618, -2217277, -2377801, -4485557, -10581726, 4260071, + 8576513, 1449552, 191663, 139586, 3085397, 3093987, -5712844, -4888747, 1433445, -4946729, + 4113505, -3766686, -5789616, 3412889, -3871376, -1569811, 1372779, 2566243, -640487, -2365990, + -1464047, -2996814, -1094680, -5310190, -964220, 1573032, 170725, 1050656, 4141422, 4417911, + -286152, -1112933, 3329674, 2367064, -3332895, 1671816, -2071248, -404264, 2922188, -400506, + 651224, 1284732, 1867774, 2255395, -1264868, -1110249, 528281, -1795296, -327491, 2388002, + 419833, -470836, -57982, -1063004, -1424319, 1169305, + }, + { + 622770, -40018356, 4548371, 7705708, 4317516, 1925219, -7655779, -3393024, 639950, -1640678, + -1190780, 9278203, 27917, 19854560, 6977711, 15425375, -8681203, 8526584, 565862, 12577275, + 4416837, -24685862, -928250, -584652, -14148159, -1656784, -13337484, 2905546, 5440650, 6295885, + 8122857, -8783745, 8159901, -2514703, 11002632, -11721503, 261993, 3699578, 4800700, 406411, + -6247567, -7678865, -7706782, -109522, 752156, -2220498, 785979, -3374771, 1524713, -146029, + -6211060, 607738, 2044941, 3048890, 2248416, 984084, 940598, 1394254, -9127, 1599875, + 2587718, 4639639, -772020, 3955665, -2429878, -302258, -4963909, 2377265, 2215666, 627065, + -1518808, 2749853, 971200, -791885, 3248606, 1577864, -629750, -1442572, -2122788, 2552821, + -3331821, 2614025, 2025614, -5359583, 1939715, 2550137, 2684355, -861141, -314069, -830539, + 2467459, 606127, 868120, -1469953, 548682, 459025, + }, + { + -2891050, -73767672, 8530342, -1334661, 7761543, -1818382, -14103062, 191126, -15084999, 1098438, + 7183870, 188979, -12625056, 6621229, 15818365, 16352551, -2568927, -7223598, 10033580, -3577171, + -2968896, 454193, 4080219, 10826539, 13789529, 114890, 7041599, -923418, -104690, -2198487, + -9113384, -3722663, 6910603, 8361228, 2233920, -9775346, -8102993, -6281390, 3533684, 2263448, + -889058, -10124849, -4752382, 576599, -9022116, 412317, -303869, 1895154, 7364259, 9175124, + -168577, -2595234, -2187749, 721555, 159451, 4734665, -6269042, 2879239, 3566970, -3260954, + 2790655, -4010963, -1768990, 1209033, -1436667, -3304441, 1018981, -2486249, 1280974, -918049, + -103079, 2127620, 1749125, -1337882, 1665911, -2381559, -1168768, -1646046, -802085, -3230889, + -1411434, 1334661, 1255204, -124554, -1165547, -510564, 2694555, -845035, -810675, -189515, + -59593, 1001801, 256087, 357019, -165356, 376347, + }, + { + 1332514, -11084774, -9531606, -9211631, 1397475, -5880347, -9990094, 1558536, -2726231, 4925791, + 4209068, -5294621, -4738960, -15302968, 29761440, -6257231, 4917201, 48318, 18655190, 3665755, + -737661, -5844377, 1335198, -3659312, 561567, -4941360, -5519570, -2310693, 4160213, -1927367, + -4993437, -4586488, 9265318, -10412074, 763430, 1469953, 241055, -9664213, 908922, 6208912, + -664646, -4880694, -5247377, -874563, 5772973, -3537443, -5702106, 714575, 2798708, 1151588, + 504659, -308164, -1001801, 134218, -3781182, 2666638, 4106526, 1460289, 3511673, -1933809, + 869731, -2129767, 3768297, 237834, -1846299, 1251983, -803696, 5226975, -54224, -1369021, + -111669, -2019172, 3377992, 1864553, 392453, -2191507, -759672, 603980, -107374, -1287953, + 2231236, -188979, -1148904, 607738, -1746441, -2209761, -42413, -1118839, -2720325, -540092, + 16643, 353261, 1474784, 344134, 733903, 267362, + }, + }, + { + { + -7822746, 32813550, 46029700, -7864085, -2717641, 1533303, 1664837, 8675834, 5188858, 9671193, + -9982041, -13928579, -2262374, 5174362, -6620155, 2854543, 830539, 1957431, -4044786, 1515587, + 21647172, -4437775, -8504035, -7288560, -3242700, -1156420, -5743982, 1673964, 2353642, 7092602, + 8527658, 4541928, 5396090, 954557, -3393561, 6400575, 8513162, 2591476, 1824287, 4890894, + -1630477, -3748970, 294742, -3201898, -1475321, 1419487, 2946885, 4051765, -1947768, 1554241, + -1391569, -1962263, -126702, -3036542, -2924873, -2014340, -1968169, -2464774, -1682017, -649614, + -2153389, -102005, -343597, -154619, -954020, -1909650, 446140, -2421288, -506269, -1807108, + -374736, -536871, 1999844, 861141, -1037235, -375810, -2169495, -37044, 952409, -181999, + -912144, -2015413, 412317, 84826, 238908, -1151051, 1011465, -1192927, 619012, 439160, + 711891, -557809, -438624, 1221918, 297963, -562641, + }, + { + -324807, 29778618, -83215, 17859548, -985158, -4305705, -1830193, 8796093, 1282048, 1859184, + -7615514, -12974022, 7749732, -2441689, -134755, -363998, 1525250, 12015171, 3147674, 3302293, + 8050380, -872952, -1873143, -7603166, -3334505, -2498597, 4898410, 1192927, -947040, 1034550, + 7121056, 2921115, -9069897, 3385508, -6929930, 5011153, -5910412, 11187853, -2859375, 2979097, + -3687766, 2253784, 2741263, 4175782, 4533875, 1567663, 1438277, -6222871, -3212636, 2386928, + 1272384, 1612223, -28454, 425202, -1995012, -2089502, -88047, 439160, -1302986, -3061775, + 1779190, 3344706, -193810, -2697240, -59593, 364535, 2049773, 893890, 2091112, -2311766, + 66035, -4295, -911070, -3221, 404801, -161061, 1564442, 1876364, 732292, 2797634, + 758599, 1063004, 59593, -838056, -868120, 75162, 1031866, -408022, 864899, 229244, + 3455838, 579821, 423591, 380641, -991064, -807991, + }, + { + -360240, -96124592, -16568373, 30740692, -7712151, 1877975, 3961034, -2155537, -7600482, 2619930, + 116501, -11914776, 1753957, 2980171, 6040872, 5077725, -4041027, -6332393, -8392366, -2124398, + -1776506, 53687, -948651, 4194036, -4914517, -5665599, -3463354, 380105, -2903398, 1391033, + 2042257, -3244848, -946503, -9084930, 2418067, -1644973, -4843650, -7767985, -5255430, -2450279, + 6058588, 1356136, 3051038, -4389994, -1570884, 2265595, -187905, -2250026, 1863479, 1877975, + -506806, -2854006, 3799436, -153008, -1091995, -22549, 4173098, 532576, -381178, 147640, + -3070902, -324807, -286152, 2391760, -3396782, 304406, -431644, 416075, -420370, -3221, + -3167002, -307627, 1036698, 746787, -2895345, -421444, 893890, 810138, 1668058, -483721, + 604517, -8053, 821949, 1344325, -129386, -1037235, 447213, 1221918, 855235, 1227824, + 514859, -683974, 704375, 173946, 149787, -542240, + }, + { + 9865540, -23895050, -9671729, 14856292, 4041027, 1804960, 2886218, -7041599, -6985228, -5145908, + -1372779, -3755949, 6000070, 1362578, -8003672, -3244848, -1189169, 12727062, -13566728, 6054830, + -409096, -3745748, -2523830, 5229123, 2282775, 5999533, -14513231, 10620380, -2859375, -299574, + 7414724, 5397700, -2436857, -455803, 4025995, 2778844, 3700651, 2969970, -3061775, 176094, + 6562173, 6170258, -470299, 2941516, -112206, 1437203, -4385699, 5556077, -2335389, -977105, + -69256, 2127620, 959925, 3208341, -608812, -891743, 640487, 1503239, -1202054, -1386738, + -1986959, 1534377, 540629, 2783139, -3623879, 3540127, 1472637, 2429878, 229781, -362925, + -1899449, 1616518, -524523, 3947075, -610422, 554051, -194347, 143881, -612570, -1082332, + 954557, -326418, 312459, 232465, -1132798, 1044214, 870268, 154082, -447750, 270583, + -355945, -1120987, 750009, 187368, -721555, -464393, + }, + { + 21475, -26081188, -7648800, 10261751, -3219615, -606664, 858993, -960999, 6048925, 1205275, + 7512972, -1009317, -1362578, -2315524, -319975, -1053878, -1708860, -9013526, -3342022, -10061498, + -5005248, -2414845, -9890773, 75162, 3357054, 5005248, -8775692, -806917, -52076, -752693, + 3625489, 425739, 492848, 484258, -3051574, -1532767, 6179384, 5686000, -2525441, -488553, + 3852586, -183610, -4565014, 210453, -3405372, 2557116, 1732482, -2399813, -4567161, -302795, + -11811, 4322348, 321049, 2204392, -624381, 315680, -222265, -433255, -420370, -1982664, + -3007014, 1202591, -1074, -3413962, 1894081, -3172370, -623307, 2110440, -2908230, 666257, + 2225867, 1184337, -984084, 70867, 503048, 808528, 1073742, -828929, 290984, -1364189, + -763967, 2163590, -1036161, -668941, 124554, -1188095, 743566, -1020055, -552977, -1233729, + -771484, -434329, 727997, 156766, -1351304, -351650, + }, + { + 7074885, -41459320, 1162862, -8944806, 7617662, -2441689, -1950989, 9853192, 2162516, -3127810, + -741956, -5920613, 5914170, 6416145, -9841381, 3687766, 278099, -6387690, -6796249, 4144107, + -397284, 222265, -3279745, 800475, 2214056, 1471026, 5509370, -1675037, -1411434, -3027415, + 1261110, 1623498, -363462, 1673964, 3207804, -6881075, -830002, -5129802, -5363341, 1117765, + -4516158, 2949032, -6074695, 225486, 3263638, -523449, 2081449, -3848828, -3458523, -1224066, + -1470489, -1571421, 1986959, 3172370, -231391, 818191, -413927, 1647657, -627065, -4455492, + 2183454, 1861332, -1580011, 1114007, 1387811, 1126892, -2301566, 224949, 1411434, -403727, + -503048, -964757, -741956, 220117, -1500554, 1688996, -622770, 1021665, -1427540, -17180, + 1304060, -1029182, -2050310, -735513, -542777, -590021, 762357, -536334, 94489, -1085553, + -892279, 979789, -1114544, 646393, 168577, 148713, + }, + { + 728534, 10603737, -4658966, -3241090, -3905736, 269509, -361851, -271120, -4843113, 619012, + 3323768, -45634, 4629975, 9514963, -8142185, 2073396, -55835, -851477, -99858, 4440996, + -17660368, -5249524, -9477382, 9596568, -6637335, 5644661, 5990943, -2354716, 3281892, -3588445, + -2131378, 4008815, 1784022, 1488743, 6805913, 410706, 67646, -1510755, -529892, -2552821, + -3015067, 5365488, 1830193, 2350958, -3893388, 461709, -1972464, 904091, 5405217, 431107, + -853088, -1448478, -1406602, -3616363, -4060355, -3764002, 1566053, 1798518, 2470680, 909459, + -878858, -183610, -2862596, -380105, -978179, 2401424, 1774358, 1218697, 347355, 538482, + 424128, 258235, 571231, 946503, -383326, 59056, -1563905, -2355790, 3423626, -736587, + 394063, -623307, -904628, -128312, -270046, 299037, 408022, -50466, -368830, -120796, + -905701, -1179505, -172336, 629750, -2175401, -84826, + }, + { + 14043469, -49450104, 966368, -24424406, -242129, -1602560, 11302206, -4893579, -1518808, 1386201, + 3729642, 10741176, -1367410, 7151658, -2329483, 743029, -1906429, -527744, -1605781, -10543071, + 8057359, -1613834, 2636036, 1714766, 2811593, 230854, -3299609, -2278480, -1959042, -1224066, + 6774774, 1384590, -4859756, -6283001, 913754, -1622961, 2457795, 1613297, -1853815, -1738388, + -204011, -69793, 5444408, 2095407, 819265, 1859184, 247497, 8107288, 2844879, 1591285, + -45634, 82141, 529355, 1554241, 2005750, -1405528, 3966939, -492311, -1516660, 1176821, + -1750199, 1449015, -220654, 1070521, -1404991, 2630668, 2864743, -603980, 3686693, 905701, + -1681480, -528818, -1280437, 1817845, 1956358, -1965484, -2692408, 844498, -144955, -1547262, + -46708, 515933, -963146, -2015950, 680215, 799938, 425739, -162135, -1021129, 928787, + -390842, -1434519, 596464, -52613, 243203, 373125, + }, + { + 2600066, -24688546, -2888903, -11773579, 892279, -1401233, 2968359, -2785286, 3848291, 618475, + 2003065, -6084358, 9132174, 10608569, -10836739, -2632278, -1631551, -4118874, 1160715, -349503, + -1717450, -574989, 1985886, 4254165, 3338800, -4616016, 1698660, -2257542, 2397129, 821413, + -4960151, -5151277, -1444720, 599685, 3176128, 5456219, 162135, 4206921, -4576288, 5404143, + 1866163, -8180302, 1218697, -296353, -4019016, 2681133, -5350993, -3425237, 1010928, 2137283, + -5462125, 1467268, 1374926, -1433982, -776852, 1137630, -2524904, 231928, -3963181, 1756105, + 1153736, -177704, -294205, -1595580, -1057636, 726386, -1583769, 280784, 550293, -1416266, + -2078227, 450972, 428960, 259309, 1090922, 39192, 1398012, 652298, 23622, 5369, + -427349, -322659, 332860, -876173, -534723, -577136, -284542, 505196, 384936, 427886, + 321586, -913754, -207232, 581968, 1480690, -143345, + }, + { + 3362960, 64331632, -13942538, -632971, 4907537, 13532368, -3297461, 7592966, -906775, -202937, + -11457362, -2955474, 5107790, -6808597, -6408091, 6215355, 9080098, -10977936, -11789685, -5494874, + -20429548, 2731062, -5917391, 5015985, -2364380, 941672, 4654134, 638340, 5612986, -9623948, + 4242354, -409633, -766652, 6497212, 3531000, 158377, -4602595, -4692789, -4251481, 702227, + -7755637, 1964411, 136902, -103079, -1908039, 903017, 1046361, 3926674, 135828, 960462, + 4929012, -2289755, 7658464, 1731409, 3062849, -1903744, 259846, -1533303, -3503083, -5101348, + -630286, 340376, 4191888, -1162862, -3661997, 1103270, -1264331, -989990, -1096290, 1690070, + 1637993, -678068, 37581, -2503429, -2414309, 199179, 1515050, 2059974, 103616, -303332, + 159988, 1906966, -2694018, 529355, -736587, -890132, 2029372, 1736777, -49929, 1064615, + 771484, 615791, -1382980, -1003412, 202400, -345208, + }, + { + -1763621, -41950556, -4382478, 7681549, -31675, 7792682, -1699733, -4684199, 7807177, -4396436, + 3249143, 2929168, 4639639, 1258962, -1197759, 5848672, 3866008, -2881386, -1140851, 5888937, + -6772627, -3908420, -16702054, -67109, -1969779, -191126, -434865, 2083596, -6456947, -4473746, + 2637110, 4232154, 1804423, 299574, -4619774, -5294621, -6563784, -10343355, -992674, -86973, + 1275068, -3529390, -1085016, -1699196, 2344515, -1909113, 2925947, -6441377, -2682744, 2991445, + 3112241, -113817, -1791538, 3062312, 4380330, 3525631, 627602, -5601174, 3739306, 1973538, + 2938831, -186831, -4187593, -2040646, 2937221, -4133906, -1465121, -1197759, 59593, 1699196, + 274341, 1707786, -853088, -1278290, -1044751, -918586, 738198, 3618510, -1796907, -1139777, + -1034013, -534723, 1159104, 914828, 2050847, 1025423, 440234, 978179, 1581622, 621697, + 1218697, -432181, 827855, -478889, -1398012, 637803, + }, + { + -8335995, -61356828, -1616518, 22414360, -10470057, -20642150, 1272921, -7585986, -4046396, -5644661, + -23641110, -5862094, 5100811, 3769908, -7879655, -14891725, -11184095, -4216584, 156229, 10488847, + -3582540, 6965363, -14012331, -2145336, -5164698, -1157494, -2533494, 3190624, 894964, 2888903, + 943819, -773631, 1973538, -9369471, -1854889, 8360691, -1477469, -7227893, -10922639, 5128728, + 5971615, -365072, 6896644, -3911105, 4355634, -1306744, 81068, -1488206, -1052804, -5971615, + -536871, 1629403, -5955509, -2991982, -140660, 1711008, 163209, 326418, 2339147, -2463164, + -4514011, -811212, -3337727, -265214, 1874216, -1474784, 1232119, 1341104, 3310346, 863288, + 2008971, 270583, 1742683, 1279900, -1453310, 992674, -363462, -109522, 1326071, -359704, + 814970, 472446, 1768453, 1801739, -2162516, 1445257, -1949915, 100395, 373662, 1147293, + 510564, -1001264, 455267, -1243393, -1080184, 1032940, + }, + { + -512712, -22282828, -4718559, 5805722, -1380832, -213675, 681289, -1995012, -1315871, -7170985, + 6183143, 3039226, 8676908, 5789079, 11381126, 11756399, 1056025, -504659, 766652, 8482024, + -59593, -2430415, -21456046, 3493956, -2934000, -16281147, 4925791, -9588514, 10283225, 3445638, + 6254546, 5076115, -5096516, 1044751, 7000260, -7886097, -2547989, 9192841, -1195075, 3569655, + -57982, -11403675, -7013145, -1783485, 169114, -4740034, -2596845, 219580, 3768834, -3890167, + -1364189, 514322, 2779918, 3911105, -1461900, -2230162, 3911642, -2141041, 2690260, 447750, + 5651640, -482110, 923955, 2218351, 1603097, -3576634, -1952063, 800475, 3103114, -2819109, + -2684, 2061047, 1482838, 1345935, 2094870, 1260573, 227096, -1834488, -1676111, 276489, + -132607, 1763084, -1923609, -1501628, 655519, 2134599, -292058, 886911, 1172526, 376347, + 2324114, 221728, -310848, -64961, -1646583, 432718, + }, + { + -1578401, -52490944, -6982543, -5386963, 13710072, -16787954, -3154117, 1180579, -11063299, -8315594, + 13000329, -11800960, -517544, -3320547, 29111826, 10363219, -8269960, 9918690, -558883, -2257005, + -4532264, 4162897, 7711614, 9403831, 1920924, 3682398, 13752485, 839666, -1909113, 3587372, + -3442953, -12090870, 4706748, 11215233, -546535, -8645232, -8489003, -3673271, 2444910, -1850594, + 186294, -6127845, -7999914, -2995740, -1239098, -6014565, 2490007, -122407, 7796440, 6600828, + 3220152, -409096, 724239, -4364224, 2357937, 4036196, -4463545, 1817845, 1921998, 2206003, + -1934883, -2375654, -1748052, 1813550, -4237522, 129386, -2843805, -942745, -1928440, 1296543, + 1554241, 959925, 2409477, -1036161, 1322313, -3159485, -1473711, -529892, 68719, -3303367, + -1040993, -112743, 1086627, 372588, -940061, -18790, -467615, 675921, -271657, 204548, + 75162, 590558, 1003949, -249645, -1410360, 1264331, + }, + { + -2947421, -20555714, -126165, -3592203, -9251360, -3547106, -2436857, -1923609, 649077, 1105417, + 4378183, -10665478, 1513976, 10252087, -23853712, 940061, 1238561, -2771328, 17415556, 6975027, + -4545686, -962610, -5928129, 766115, -3948686, -3343095, 790274, -9439264, 296890, 8421357, + -8094940, -177704, 700617, -3867081, -2554969, -3571802, 3053185, -2750927, -1927904, 5318244, + -3201898, -104690, -4607963, 2526515, 1476395, -3529926, -2939368, -3069291, 3826279, 950798, + -1493575, -69793, 3176665, -4505421, 1452773, 1657857, 1044214, 3628174, 905701, -12348, + -1619203, 150861, 2677912, -1542967, 2086817, -2447595, 1395328, 605054, 1923609, -529892, + 1022202, -2558727, 840203, 4911832, 43487, -1211718, 1607392, -643708, -585726, -1152662, + 3916473, 198642, -1594507, -2259690, -148713, -719407, -1852742, 842350, -1127966, -2001992, + -1184874, 694174, 659278, 455267, 2042794, 704375, + }, + }, + { + { + 11903502, -27575300, -40581536, 10498511, 16882980, 3590593, 7062537, 6158446, 3342022, 12780212, + -4609574, -12839268, -3788698, -2285460, -7905424, 5793911, -2917894, -1555852, -459025, -1444720, + 7572564, -4872104, -2090039, -1833951, -1851668, 309775, 806380, 2729989, -2217814, 1025960, + 4319664, 3165391, -2743947, -3454764, -3702799, 3636227, 6476274, 3625489, 3260417, 3688840, + -377420, -4152697, -1541356, -5845451, -2237678, 3401077, 3695283, 2206003, -2638184, 4895726, + -781147, -4271882, 1790465, -1379221, 192737, 2472828, 737661, 511638, 1268626, -834297, + -1574106, 3533148, 2953864, -545998, -1263794, -245887, 2289218, -1032940, -386547, -839129, + 1624571, -245887, 524523, 295816, 229244, -198105, -1387811, 1163399, 745177, -1077500, + -486405, -2474975, 1278827, 730144, -66572, -631360, 1304060, -2470680, -463320, -1396401, + -973347, -1002338, -991601, 205622, -26307, -614717, + }, + { + -479426, 46526844, 4541391, -96637, 5354751, 737661, -4168803, 3745212, 2020245, 1358283, + -10236518, -15261093, 4737349, 3836480, 7976291, 2208150, -8702677, -1652489, -5237176, 2383707, + 4479651, 6721087, 9500468, 1702418, 19327, -10191957, -4899484, -3967476, 2303176, 4907000, + 7205882, -337692, -9803263, 1420024, -6257231, 4559108, -7727183, 14828911, -1860258, 5545877, + 122407, -2905009, -2699387, 2542084, 1000191, -1731946, 3349001, -883690, 85899, 2801929, + -2645700, -2297808, -527744, 104690, -2133525, -2047626, 239444, -198642, -415001, 394063, + 1785633, 1509681, -833761, -3307125, 2013803, 972273, 347355, -1046361, -989453, -1992865, + 1123134, -155693, -662499, 31675, 432718, -134218, 1037235, 158377, -1583232, 1930051, + -510027, -425202, 302795, 745714, -1141924, -915365, 690953, -876710, -200253, -731218, + 1212255, -844498, -387621, 1084479, 384936, -616865, + }, + { + -1685775, -57585312, 25708600, 50136764, 3684008, 1404991, 1036698, -2262374, -66035, 1484985, + -8183524, -10512469, 2541010, 2587181, 4607426, 3424700, 600759, -3999152, -8176007, -2271501, + -4207994, -2294586, 529355, 7032472, -3371549, 428960, 8384850, 3773129, -3342558, 2640331, + 641024, -5626407, 1962263, -8450885, -995896, -4751845, -9911174, -1989644, 1701881, -3198140, + 82678, -577136, 3430068, -3305514, 4323959, 1512902, -1321239, 33286, 5309654, 3947612, + -2965675, -5745056, 3192235, -3887482, -1342177, -1801739, 2935610, 962073, -1176284, -1663226, + -3016678, 841814, -1517197, 2279017, -2211371, 844498, 89657, 1848447, -248571, 1585380, + -1509144, 1171989, 878858, 235149, -1002338, 83752, -739271, -39728, 938987, -959925, + 364535, 215822, 316217, 1694365, 2142115, 535260, -239981, 475131, -222265, 35970, + 1093069, 337155, 954020, 397284, -96637, -1897302, + }, + { + -3286187, -39884140, -2860985, 10580652, -6397891, -1299228, 2820183, -3825742, -365072, 774168, + -2068027, 1676111, 2807835, -7833484, -11958263, 5261335, 94489, 8000451, -21594558, -1247151, + -3385508, 829466, 5645735, 6257768, -2083059, -1613834, -10603201, 10341208, -3520800, -632434, + -309775, -780610, -4239670, 2339684, 2855617, -1222455, 671626, -866510, -6827925, -1076963, + -1108102, 2106145, -4315906, -2350421, 3013993, 4839355, -3304977, 5731097, -2425583, -587874, + 388695, -150324, -1684701, 2013266, -1804423, -2248416, 551903, 1251446, -30602, 2552821, + -1006096, 3071975, -2255932, 1235877, -3535832, 1113470, -1195612, -787590, -281320, 1614371, + -1581622, 978179, -1851668, 2674154, 604517, 1653562, 184147, 559956, -257698, -317291, + 1828582, -114890, -69256, -500364, -1001801, 1372779, 2490544, 1018981, 384936, -125091, + -605590, -677531, -346282, -19327, -626528, -1432372, + }, + { + -1328219, -2840047, 6382859, 3623342, -354335, 1009854, 709743, -6229313, 306553, 2047626, + 4636417, -4278325, 1364726, 4758287, -2311766, -5758478, 4723927, -4306779, -2210298, -9514426, + -966368, 2272575, 1731946, 3749507, 2822331, 15910706, -4560719, -4592394, -4901632, -5742908, + 1051193, 4377646, -1292248, -252866, -2575907, -117038, 3710315, 2847027, -475131, 1212791, + 79457, 4085051, 886374, 754304, -1267552, 4683125, 4578972, 1402844, -2547989, 469762, + 677531, 4399657, -1938104, 1297080, 2396055, 2608656, 1364189, 1772211, 2036351, -397284, + -653909, -71941, 619012, -1934346, 1438814, -3216931, -573915, 1018981, -1976759, -217970, + 443455, 1981054, 570694, 993748, -945967, -1141924, 621160, 1021665, 2536715, 128849, + -1431298, 1186485, -702227, -1007707, -233539, -466004, 1705639, -781147, 752156, 52613, + 140660, -34897, 734439, -236760, -659814, 557272, + }, + { + 1639604, -54639500, 9613211, -12458626, -7666517, -144955, -1395864, 5731097, -7643968, -974958, + 4937065, 6264210, 843961, 1690607, -11634530, 3180423, 6851010, -6364605, -8781061, -640487, + -6073084, 3691525, -1291711, 1254131, -6309307, -8185134, 5082020, 934692, -2940442, -4382478, + 1988570, 842350, 459025, 2938831, 2552821, -7102266, 4185983, 1225139, -3505767, 3087008, + -638876, 5107253, -2528125, 942745, 2583423, 2991445, 5066451, 1851131, -140660, -39192, + -783295, -3849901, -1732482, -1096290, -412317, 2465848, -369904, 1978906, 1194001, -1621887, + 2201708, 504659, 862215, 1833414, -1525787, 1223529, -2313914, 1553168, 1957431, -760746, + 144418, -1731946, -2393371, 565325, -1554778, 169651, -1605244, 971736, -1035087, -1337346, + -1012539, -849867, -1666984, -257698, -506269, -881542, 4295, -830002, 803696, 168041, + -300648, 1061931, -380105, 474594, 317828, 798327, + }, + { + -141734, 9942312, 4864588, -4436701, -302258, 848256, -2475512, -744103, -1335735, 588411, + 411243, -2714419, 7219840, 500364, -22362820, -2351495, -8684424, -4173098, -5495948, 5651103, + -7471096, 663572, -7019587, 8530879, -4705674, 9494025, 6427419, -5491653, -3511673, -10071698, + -2978023, 7457674, 2303713, 1081795, 6258841, 2408940, -2200634, -1997697, 3770445, 1532767, + -4532801, -1661616, -418222, -61740, -4146791, 3581466, -3558917, -2676838, 1835562, -1309428, + 2257005, 8590, -2147484, -422517, -3285113, -3707094, 803159, -258772, 521302, -1238561, + -2157684, -126702, -663572, 1853278, -1009854, 2006287, 41876, 1428614, 1816234, -559420, + 265214, 2442763, 587337, 1728188, -1341104, -624381, -1216550, -2900177, 1356673, -698469, + 1284732, -135291, -1822140, 805843, -107374, -1401770, 281320, -500901, 621697, 70330, + 316217, 254477, 561567, 1246614, -1764158, 206695, + }, + { + -7342247, -70134128, 11629161, -27398134, -8466454, -2693481, 5298379, 846109, 3694746, 3833258, + -12177306, -1851131, -7537668, -1324461, -13202729, -9805947, 2304787, 4025458, 4946729, 1095217, + 14787572, 765578, -1346472, -2479807, 4931696, -329102, -1103270, 6759742, -508954, -6426882, + 1333051, 568546, 4660040, 8442295, 9065602, -1390496, -2115808, 352187, 1562294, 2114735, + 3518115, 728534, 6243272, 362925, -1180579, 1843078, -3858491, 2962454, -2358474, -864899, + 283468, 1107565, 1214939, -1833414, 783832, -470836, 4925791, 372588, 67109, 3308199, + 887985, 2204392, -2384781, 901406, -2116345, -903017, 2407866, 802085, 1315871, -331786, + 247497, 2828236, -412854, -413927, 2322504, -125091, -1969779, -397284, 782758, -2684, + 1021129, 206158, -370978, -1004486, 392453, -998043, -1149441, 323196, -1203128, 824097, + -420370, -1185948, 314606, -311922, -510027, -35433, + }, + { + 543850, -25732760, 21643950, -5605469, 1653562, -3012383, 4016868, -382789, 1154809, -3284039, + 2934000, -3222836, 11210402, 8445516, -7250442, 21668646, 21807696, -6104759, -7494181, 3326989, + 2328409, -368830, 1421634, -398895, -5710696, -5581310, 3006477, 1385664, 4711043, 3401614, + 817654, -10564009, -5193153, 6239514, 6466074, -2147, -977105, 6653441, -2237141, 3818226, + -4857071, -11131481, 1081258, 1085553, -459025, 2389613, -4106526, 756988, 863825, 4063576, + -2033130, 3266860, 955630, -1313186, -2024540, 1721208, -3934727, -1572495, -3102577, 2856153, + 1574642, -73551, 1492501, 1671816, 339839, 1111860, -1524177, 1891933, 3228742, 977642, + -2348273, 285078, 347892, -510564, -23622, -1129576, 781684, 425739, -843424, 1206886, + 1091995, 582505, 1244467, -1740536, -789200, 797253, 1737314, 1756642, 569083, -960999, + 226023, -183610, 449361, -366146, 182536, -239981, + }, + { + -3347927, 65460672, 889058, -3595425, 12862353, 28169080, 3013993, 318364, -1927904, 4851703, + 4083440, -4600447, -10643466, -11858942, -4326106, 1450625, -599685, -8107288, 3009162, 10293963, + -12280922, -417686, -6337224, 1108102, -5701569, -5744519, -275952, -658204, 6660421, -9689446, + -1726040, 836982, -1293322, 4825933, 2370285, 4711579, 1873680, 1320703, 4715337, 4782446, + -6223408, 5751498, -617938, -2575370, 620623, 4932770, 302795, -5122286, -7305203, -2500208, + 6221797, -6131066, -922881, -1151051, -905164, -4111358, 1929514, -2109903, -3676492, -3212099, + -970126, -2040110, 5277978, 4755066, -752156, 2597918, 265214, 2684, 919660, 1635846, + 630823, -70867, -1447404, -3136937, -1710471, 1665911, 770947, -680215, 11811, 966905, + 962073, 2272038, -1811939, 728534, -1236951, -645319, 2617246, 905164, -1919850, -148713, + -113280, -1147293, -1934346, -322659, -1171989, -264141, + }, + { + 75162, -33103998, -3556233, 5266704, 307090, 2804077, -6458020, -10438918, 3191698, -686121, + 3327526, -3729642, 770410, -8291435, -3232500, 5766531, 5794448, 7115687, 3520263, 10765336, + 685047, -9668508, -13188771, 6132140, 1510218, 3842922, -5058935, -767189, -6544994, 1343251, + 1113470, -1508070, 4881767, 1064615, -8239358, -2625299, -5114233, -10566693, -412317, 737661, + 6321118, 1330903, 340376, 177167, 723165, -8565239, 230854, -5005248, -4362613, 3969087, + 6360847, 771484, -843961, 3245922, 2398739, 2993055, 2185602, -1458141, 2837900, -552977, + 3826816, 899796, -2098629, -3528853, 731218, -2433636, -263604, 1356673, 113817, -40265, + 396748, 260919, -1260573, 462246, -721555, 96100, 1376537, 1677722, -1063004, 972273, + -2366527, 1069984, 1694365, -1882269, -12348, 1736777, 294205, 730681, 1728724, 433255, + 909996, -1187559, 126702, 389231, -834297, -346819, + }, + { + 13602161, -23221814, -15723338, 6030671, -1836099, -12025372, 16864190, 2043331, 2075543, 6869800, + -4334696, -3861176, 929860, 9333501, 11285563, -591095, -9701794, -7926899, -1993939, 11537356, + -6281927, 5538361, -14507863, -4318590, -5523328, 4177930, 5907728, 6338835, -2157147, 113280, + 2530810, -6150393, -1810329, -4137127, 248571, 7643431, 529892, -1733019, -7289633, 3682935, + -1312113, -6823630, 9075266, -1290638, 1579474, -121333, 6283001, 48318, 4333085, -5253282, + -1693291, 4577899, -631897, -2854006, -1653562, 344671, -10201, -1627256, 4418448, 1780264, + -1139777, 1572495, -820339, 3274913, 3677566, -637266, -1682017, -1968706, -311922, -1358283, + 3097745, -184684, -219580, 161061, -617402, 549219, -1595580, 999654, 2136209, -636192, + -344671, -1315871, -336081, 308701, -1330903, 1893007, -1443646, 1046898, 56371, -236760, + 329102, -867047, 552977, -583579, -855772, 752693, + }, + { + -977642, -7379291, 724239, 7360500, -5172751, -4066797, 3636227, 952409, 623307, -6697465, + 8419210, -525597, -14398341, -23568096, -245350, 1180042, -111132, -5003637, -4760971, 3986804, + 66572, 4477504, -11779485, 6697465, -2033667, -19145354, 10819023, -9828496, 7376070, 1879048, + -4056597, 2821257, -1626182, -983548, 2680060, -5822365, -2573222, 5892159, -6851010, 1678259, + 3485366, -709743, -487479, -3534221, -3633006, -5875516, -1263794, -2173790, 4087735, 3893388, + 5130876, 470299, -619549, 257698, -868657, -4263292, -2833605, -5320391, 3942243, 1147293, + 4393215, -3396246, -2078227, -413391, 1249299, -4792647, -567473, -1703491, -3058554, -5134634, + 1699733, 1156957, -743566, 912681, 1238024, 1478543, 798864, -1428077, -1972464, -527207, + 129923, 551366, -739808, -154619, -2021319, 1212255, 27380, 830002, 1774358, 1128503, + 1538672, -494458, -256087, 222801, -1658931, 934692, + }, + { + 6847789, -39060580, -2265595, -1185411, 7127498, -8777839, 8950712, 6043019, 1006633, -2696703, + 14857902, -8029442, -6982006, -17626546, 14269492, 1456531, -22113176, 2433636, 3964792, 3809636, + -1954210, 8088497, 5186173, 5675263, -5356898, -1329829, 14651744, 3346853, 3325379, 8649527, + 5556077, -6826851, 1909113, 4133369, 2493766, 1652489, 2353642, -2602750, 1233193, -5211406, + -3176665, 1459215, 1047972, 338766, 162135, -3544422, 3949759, -1158031, 855235, 1206349, + 368830, -789200, 2435247, -1260036, 2798171, 1207423, -5417565, 708670, -1301912, 2319819, + -2558727, -1636919, -1898912, -1794223, -3534758, 2833068, -2980707, -1317481, -1628866, 1779190, + 527744, -106837, 3270081, -187368, 726386, -368293, 1738388, -523449, 697395, -1189706, + -23085, -256624, -1148367, -1445257, -1236414, 346282, -1423782, 38118, -23622, 1610076, + 1302449, 1222455, 1230508, -210990, -236223, 1265405, + }, + { + 2430952, -16182363, -2393908, 2455648, -5535139, 5146445, 7780334, -5629629, 2040646, -5802501, + 5234492, 357019, 3952444, -10752451, -66944580, -6637335, -915902, -5729487, 5157182, -2056216, + -5251135, 5641440, -6691559, 2369211, -4531191, -7701950, 4490389, -3243774, 6776922, 16134582, + 1214402, 908386, -3276523, -2619393, -6385543, -10168335, 4181688, 1023276, -4071629, -1290638, + -4083977, 4174171, -3049427, 1901060, -2586107, -2743947, 1164473, -1538135, 1240172, -1531693, + -1332514, -102005, 5887327, -504122, 3243237, 1037772, -1742683, 458488, 554588, -383863, + 208306, 2949032, 2250026, -3884798, 738198, -4912369, -1814624, -1382443, 2399813, -365609, + 1990717, -927713, -1488743, 4279398, 2388539, 2246268, 3321084, -697932, 246424, 697932, + 5060009, 1740536, -2106682, -3077344, -272730, -392453, -1578401, 1141388, 423591, 11811, + 442919, -12348, -621697, 171799, 494995, -379031, + }, + }, + { + { + -14176613, -31330176, 6281390, 33364916, -18781356, 11200201, 9088151, 1411434, 6992744, 2699924, + 3623342, -17961554, 4734128, -956704, -5596880, 2595234, -9220758, 6133750, -954557, 3688840, + -2902324, 3703336, -1082869, 976568, -5753109, -2162516, 6038187, 2735894, 65498, -4062502, + 5899138, 763967, 812823, -7955353, 3816079, -3532611, 5951751, 5081483, 5337571, -830539, + -1311576, -3828427, -252329, -2887292, -553514, 3508452, -213675, 2337536, 369367, 3309272, + -268972, -5679021, 7583302, -4278325, -814433, 362388, 4982699, 522912, 289373, -552440, + -3617973, 4133906, 1908039, 758599, -2304250, -1159641, 3824669, -963146, 221191, -798864, + 2321430, 1168231, -1832877, 221191, 1233193, -2249489, 768262, 484258, 1461900, -2251637, + 772557, -1575179, 220117, 901943, -1231045, 1461363, 82678, -2109366, -1364726, -715112, + -1909113, 99321, -475668, 95026, -364535, -904091, + }, + { + -76236, 40592808, 7234336, -33953864, 25744570, 390842, -1620276, -352187, 3239479, -1647657, + -3332895, -15741055, -256624, 9169755, 4973572, 4152697, -11733851, -10312753, -5422933, 8334921, + 6838125, 2403571, 13309030, 6605123, 1153736, -8136816, -7315403, -5324149, 1547262, 4813585, + -2944737, 3167539, -5784784, -106300, -1724966, -3002182, 4643934, 5813238, 2077690, -1294933, + 4514548, -514322, -3766686, -1729261, -98784, 1943473, 475131, 1899986, -132070, 2652142, + -3396246, -2965138, 3685619, -3933653, -4045859, -17717, -71404, 1044751, -2129230, 1942399, + 2238752, -119722, 1784559, -5488432, 1506997, 1169305, 5369, -197569, -2818572, -95563, + -121870, -882079, -59593, 1894081, -850940, 634045, -1146756, -83752, -596464, 355409, + -1620813, 839129, 348966, 426812, -301721, -682900, -219043, 312996, -1170379, -734439, + 107911, -264141, 184684, 146566, 1028645, -825707, + }, + { + 4715337, -28390270, 385473, 45222784, 3368865, 3191161, -454730, -4473209, 3012920, -729608, + -8556649, -14885283, 10762114, -7124277, 11569031, 659814, -5772973, 777389, -6529424, 9924059, + -6067715, -5248450, -4441533, 8618926, -4040491, 536334, 8320963, 5312338, -2507724, 813896, + -4843650, 6082748, -731218, -3018825, -3617973, -3279208, -7014756, -4494684, 4371740, -1982664, + -850940, -5376762, 3148748, -45634, 3642669, 2684355, 544387, -2753611, 5036386, 2301029, + -2637647, -1104880, 863288, -4463545, 1023276, -1924145, -262530, 2171643, -2055679, -3619584, + 297963, -132607, -2520609, 1778117, -377420, -320512, 1924145, 824634, -666257, 906238, + 380641, 1542430, 456877, 606127, -2047089, 322659, 1551557, 329639, -1379758, -410169, + 7516, -1032403, -361314, 1730335, 2468533, 1099512, -427349, -174483, -538482, 499290, + 784368, 83215, 1837709, -527744, -63888, -813359, + }, + { + -4638028, -45992656, -3160559, 15367393, -3071439, 895501, -2962991, -1117228, 790274, 7672422, + -15479062, 3373160, 4660040, -6694244, -12832289, 8698919, -3406983, 5727876, -12986907, -3067681, + -3376918, -153008, 2347200, 176094, 6756521, -17661442, 5232881, -4486094, 5921686, -1243393, + -8790187, 1465658, -4213900, 4508642, 4032974, -6422050, 3092913, -4620848, -1519882, 3985730, + -3974455, -2070711, -3732327, -1678259, 139050, 1078574, 4329864, -504659, -1785633, 3067144, + 144955, -2181844, 609349, -1659468, -1212255, -3938485, 3211025, 2515777, -3344706, 5763309, + 783832, 2250026, -4305705, 1967095, -386547, -2722473, -826781, -4100083, 4111894, -267899, + -1960653, 1273995, -636192, -207769, 1959579, 2621004, -407485, -1710471, 1708860, -159451, + 1179505, 399969, -338766, -1430224, 305480, 312459, 3777424, 410706, 1530082, -478352, + -830539, -715649, -133144, -168041, -905701, -2159295, + }, + { + 2220498, 10094247, -3958349, -7131257, 7822746, -511101, 3473018, -3472481, -3594888, 2842732, + 2292439, -4376572, -3320010, -4497368, 8360691, 155693, -8967355, 9084393, -6963216, -9499931, + 2719788, 4773320, -6334003, 9329743, 36507, 14473503, 445603, -5306969, -2458869, -4057670, + -2732136, 9714142, -5068062, 1653562, -862215, 1163936, 539555, 945430, 5348308, -862752, + -3889630, 6497212, 6398965, -4642323, -1104344, 501974, 4928475, 4094715, -1565516, -855772, + -704912, 859530, 4389457, -130460, 1729261, 1132261, 2392834, 3129958, -469762, 1060857, + -236223, -2030983, 4622996, -140660, -917512, -4480188, -658204, -158914, -387621, 2176475, + -3172370, 1466731, 1289564, -212601, 315680, 261456, -793495, 1695438, 2119030, -1006096, + 743566, -346819, 237834, -1216550, -255014, 1193464, -287226, -913217, 1463510, -153545, + 468688, 547608, -695248, 503048, -30065, -111669, + }, + { + -11018739, -43763032, 5666136, -19487340, 7070053, -4642323, 6161131, 311922, -11370389, 6557878, + -11196980, 18765248, -4500589, 3124589, -7126962, -2633352, 1580011, 1582696, -4502737, -5908802, + -4369593, 466004, -4784594, -3338263, 5685463, -9621264, 6549825, -3006477, -1896765, -4728222, + 4001299, -5210332, 7650948, 2109366, -4833986, 2951716, -463320, 3495567, 429497, -1080184, + 3602404, -461709, -107374, 1580548, 108985, 3360812, 3009698, 7796440, -653909, 909459, + -3804267, -1606318, -1226750, -3007551, -530428, 3649112, 1273995, 344134, 0, 2506114, + -2313914, -639950, 3327526, 700080, -2644089, 285615, -221728, 1591285, 1366337, 568546, + -133144, -1962263, -2332704, -1280437, 454730, -2499671, -478352, 1352378, -798864, -715112, + -2217277, 27380, -718870, 884226, -1580011, 399969, -1296006, 490163, 386547, 741956, + -415001, 19327, 1156420, -543313, 154082, 851477, + }, + { + -553514, 4940823, 6537477, -4185983, 1893544, -559420, -2290291, -277025, 105764, -894427, + -1739999, 1530082, -5751498, 4132832, -20637318, 317291, -19445464, -1735704, -2643016, -3051038, + 166967, 4940823, 1762547, -6755984, 476205, 773631, 3914863, -5341866, 4333622, -12623446, + 4443144, 5429913, -8221105, 12293807, 3754875, 4115653, -3329674, -1709934, 3637837, 2490544, + -1749125, -6736656, 1143535, -3524558, 1843615, 3092377, -2083596, -1562294, -5426155, 1175210, + 263604, 1271847, 158377, -10737, -1423782, -5039071, 2080912, -2449742, -660888, -440234, + -3340411, 449361, 60130, 818191, -1515587, 2077154, 1990181, -791885, 1045825, -539018, + 825707, 2726231, -209917, 1582159, -392990, -1344862, 9664, -1335198, -471910, -1310502, + -42950, 1156420, -2614561, 1397475, 173409, -1220845, -472446, -1489817, 1472637, 500901, + 158377, 608812, 398358, 566399, -403190, -113817, + }, + { + -1983738, -77126336, 8180302, -40745280, 10353019, 5181341, -16032576, 19491098, -2023467, 5674726, + -8295193, -13903346, -774705, -6145025, -3801046, -6444062, -8793409, 248571, 9475235, 7672422, + 4003447, 4573604, 2374043, -6548215, 1661079, -2999498, -2352568, 12348031, -3219615, 324270, + -3396782, 3938485, 5080410, 5564667, 6425808, 70330, -499290, -1339493, 3221762, 208306, + 4663798, 1768990, 1750736, 460098, -862752, -463856, -1203665, -964757, -241055, -4684736, + 2439542, 162672, -209917, 2215666, -4270271, 1990181, 4475356, 469762, 1755568, 1439888, + 1721745, 957241, 239444, -2774012, 781684, -3016678, 99858, 5385889, -1388885, 591095, + 2199560, 1697049, 366146, -1899449, 1067836, -933619, 153008, -876710, 2252710, -107911, + -300111, 1564442, 852014, -1036161, -909459, -1179505, -1321239, 963683, -955630, 749472, + -429497, -886374, 113817, -285078, -1792612, 310311, + }, + { + -2484102, 7605850, 193810, 3508988, -2397666, -1105417, 2437931, 457951, 2410014, -6532109, + -1673427, 3328063, 4879083, 7029788, -6161131, 20529406, 31012886, -11119133, -4918812, -973884, + 7381975, 3523484, -2202245, -594853, -5191542, 1566053, -3925600, 6677601, -932008, 4637491, + -3658775, -7344931, -2136746, 4208531, 8371428, -2487860, -518617, 6427419, -3730716, 2904472, + -3162707, -11049340, -733903, 6818261, -2852932, -4619774, -824634, 3339874, 161061, 106837, + 1249836, 3309272, 470299, 2625299, -6326487, 84289, 164819, -1534914, 21475, -1328219, + 2955474, 979789, 843961, -1015760, 2823404, 1891933, -3050501, 3574487, 2758443, 849330, + -2056753, 31675, -2250563, 2195802, -1109712, -282931, 485868, 502511, -486942, 2204392, + 81068, 824634, 1504849, -1568737, 213675, 651761, 2129230, 1036698, 1722819, -805306, + -649077, -463856, 986232, 74088, -733903, 401579, + }, + { + 5454072, 61184492, -3600793, -8434242, 19455664, 2442763, 18079128, -6028524, 11199127, 1373853, + 10875394, -9604084, -13768591, -9595494, 3622805, -6586869, -1613297, -8396661, 3797288, -1948841, + 8604967, -9587441, -1207960, 2954938, -6669011, 646929, -6337224, -1070521, -3033321, 1489817, + -4278325, -3292093, 6497749, -3839701, 3536369, 1432909, 5248987, 447213, 2693481, 9423695, + 1535451, 4146254, -2680060, -3671123, 3622268, 3902515, -7140383, -4100083, -3103651, -5468567, + 967441, -2923799, 613107, -1869921, -2790655, -2493229, -989990, -1313723, -525597, -3863323, + -2256469, -763430, 4649839, 5264556, -1046361, 2227478, 408559, 507880, 2319819, 510027, + -787590, -1145683, 365072, -3954591, -860604, 794569, 2717104, -2381559, -1196148, 1622424, + 712965, 2974265, -1550483, -751619, 1759326, -708670, 726923, 1349157, -1057636, -1427003, + 526134, -2899103, 709743, -876710, -1430761, -382252, + }, + { + 2101850, -31751082, -212064, -2961380, 6027450, -563714, -5209259, -1407139, -289373, 1754494, + 938987, -8141111, 1513439, -13408888, 5577552, -5500243, 13643500, 6707129, 6984691, 2505040, + -7082938, -1020592, -4072166, -5630702, 5326297, 6355478, -8652748, 625992, -4684199, -6420976, + 5497558, -5814312, 12879533, -5452461, -8504035, -3806952, -7308424, -4085051, 126702, 1734630, + 8603893, 1140314, -3758, -476741, -1718524, -1315871, -7255811, -1683090, 309238, 3656628, + 2079838, -1654099, 1102733, 900869, 1876901, 1549946, 2791192, 2509335, 1316944, 1571958, + 3300146, 209380, -3109020, 849330, -1352378, -1593970, 1453310, 1958505, -2533494, 252866, + 896574, -166430, -986769, 612570, -1364189, 256624, 2297271, -290447, 1137093, -154082, + -2651069, 1901597, 872415, -1997697, -288300, 2265595, 127775, 1102196, 266825, 359167, + -97711, -127238, -555125, 53150, 520765, -2066416, + }, + { + -14987288, 11746199, -10723460, 246424, 8489003, 8176007, -2226404, -6972880, 12134893, 10021769, + -720481, -8846559, 10802916, 8885750, 6786585, -2645700, -6037114, -5447629, 597537, 8417062, + -620086, -5796059, -8053064, -3731790, 1393180, 1990181, 10422275, -3879966, -236223, -977642, + 10002442, -13386339, -7290170, 6429029, -3506841, 3513283, 3561065, 1980517, -2383170, -1850594, + -2442763, -3369402, 3194382, 1506460, 893890, -2350421, 9376987, -2343979, 4823249, -1344325, + 2200097, -4993973, 3750580, -4230006, -226023, -955630, -79457, -3520263, 6344204, 2260764, + -1592896, 790811, -1014149, 4814122, -985158, 1347546, -441308, -558883, -2057826, -107911, + 398895, 878321, 2393908, -2268280, 522375, -2774549, -869194, 3671123, -1193464, -381715, + 1004486, -327491, -2080912, -875100, 1583232, -439160, -391379, 572304, 50466, -686121, + 528281, 432181, -1494649, 483184, -207769, -434865, + }, + { + 2285996, 823560, -8149701, 8230231, -10390063, 2527588, -3637837, 1259499, 4609037, -4348655, + 4359392, 1951526, 2905546, -50143208, -8590, -6129992, 5513665, -4020626, -2830384, 879395, + 2692945, -2818572, 264677, -2015950, -2116345, -11454141, 3522947, -7023882, -2964064, 367220, + -2543158, 6442988, 2237141, -8507256, 4098473, -5824513, 639950, 4902705, -4893579, 3447248, + -6739341, 5996311, 782758, -5158256, -2664490, -3658775, -820876, -3430068, -61203, 9091372, + 366146, 853625, -1746441, 180389, 304406, -341987, -6460705, -2430952, 2019172, -2575907, + 8994735, -3139084, -5216238, -1491964, 1058710, -2898566, -353798, -909996, -6052146, 96637, + 1294933, -2441689, -213675, 473520, 1316408, 1338956, -83752, 181999, -1379758, -2384244, + 1389422, -848256, 44560, -70330, -1007170, -715649, 622770, 365609, 2099702, 446677, + 706522, 642098, 966368, -841277, -440234, 584116, + }, + { + -11993159, -24495272, -821413, 10468446, -8760660, 13032541, 4957466, -4459250, 9505299, 11292543, + 3678640, 4860829, -33260764, 7684234, -11418171, -831613, -10864120, -10072235, 6047851, 8505109, + -1789928, 3823595, 2164664, 5195837, -3789772, -8615168, 19498614, 1422171, 7664906, 8462696, + 5265093, -9960566, 3298535, -3921305, 13238700, 680752, 5215164, -5589363, 1870458, -4901632, + -5552856, -1854889, 2723009, 5542656, -3893925, 2522757, 2100776, 5653251, -2835215, -382252, + -7226820, 5109938, 744103, 1032940, 1137093, -165893, -5138392, -180389, -2677375, 2750390, + -4420595, 263067, -1860258, -5084705, 17180, 1159641, -2037962, -1297080, -287763, 992674, + 1166621, -1389422, 2746632, 442919, -355409, -140660, 2624762, -319975, -2143726, 1236951, + 1308354, 219580, -1978369, -1760937, -1826435, 633508, -1535451, 599685, -1184874, 2266132, + 2121714, 170188, 726386, -1367947, 2015950, -544387, + }, + { + -1376000, -20265804, 5302674, 908922, 2927557, -1390496, 9946607, -1628330, 3579318, -6460705, + -2835215, 3903589, 7397008, -36441188, -36921688, 5586679, -3204583, 5665062, -7352984, -8783208, + 5048197, 6243809, -13347148, 1147830, -382789, -11161009, 1722819, 7707319, 5389647, 9121974, + 8684424, -380105, -3951907, -2400350, -7707319, 2469606, -8307004, -955630, 4568235, -9409736, + -5488968, 7987029, -730681, -1202591, -4301947, 3840775, -1609539, 2911451, 511101, -7299297, + 2482491, 1838246, 199179, 2784750, 2250563, -1999844, -1013612, -1535988, 3665755, -122943, + 2464238, 473520, 4662187, -4683662, -1026497, 1239635, -6615324, 2676838, -675384, 211527, + 214748, 1837172, 719407, 422517, 2692945, 928250, 3864397, 269509, 867047, 897111, + 2087891, 2419140, -1780801, -1422171, -1064615, -276489, -903554, 1847910, -1182727, -12348, + 743566, 149250, -1665911, 2485176, -1746441, 1402307, + }, + }, + { + { + 15158550, 7257958, 25109990, 67189392, -5123896, -1721208, -2311766, -3549791, 5548561, 10082436, + 20861194, -6715718, 7956427, 3886409, -540092, 5371394, -554051, 13078175, -2579665, 1803886, + -2598455, 6945499, 6474127, 7722888, -5093831, -2456721, 3056406, 2446521, 4209605, -4665945, + 3360812, -3518115, 2101850, -6054830, 7543573, 1075352, 6154152, 3928821, 118112, -2124935, + 1641751, 1307281, 6066105, 3434900, 726386, -2479807, -2206540, 2092723, -1064078, -1607392, + 1102733, -4766877, 1666984, -7732552, -3048353, -4439923, 3537979, 705985, -984084, -478352, + -3640522, 1465121, -1653026, -177704, -1762547, 383863, 2826625, -3303904, 324270, -340376, + 1501628, 1176821, -1940788, -222265, 913754, -1382443, 1416802, -1137630, 542240, -1559073, + 1222455, -934692, -165356, 402116, -1595580, 572841, -886374, -53150, -863288, 495532, + 559420, 1404454, 484794, -17180, -746251, -653372, + }, + { + 1238024, 19815368, -8079907, -47639240, 2799782, -3001109, -1993939, -1690070, 3484292, -131533, + 615791, -12440373, -4183298, 643171, -608275, 870805, -11174968, -3000572, 153545, 4540854, + 9470403, 376883, 8827232, 10171556, 8934606, -5294621, -5786932, -6946573, -963146, 475131, + -5834713, 1622961, -12722767, 1039382, 5179194, 1538135, 7662222, 1127966, 2973191, -1551557, + 2600066, 621697, -1951526, -7269232, -1513976, 10348187, 6382859, 2129230, -4945118, 2137283, + -2279554, -1810329, 2814814, -3503620, -2250026, 1032403, 193274, -1939178, -1814624, 3301219, + 1028108, -2804077, 924492, -3799972, 804233, 386010, 32749, -958315, -1526324, 788663, + -1861332, -1646583, -319438, 877784, -967978, 585726, -2204929, 1928440, 208306, -2189360, + -1590212, 2135673, 343597, -814433, 177704, -230318, 562641, 1973538, -750546, 93952, + 1437740, 756451, 569620, -1237488, -377420, -483721, + }, + { + -6091874, -9818832, 17046188, 9210020, -25745108, -2051921, -2015950, 401043, 4851703, -1614371, + -1986959, -16512002, 4389457, -13244069, 5419712, 8421894, -1472100, 1055488, -4250407, 10580115, + -2678449, -2677912, -8273181, 2484102, -3918084, -5113159, 2673617, 9757092, 1743220, -5945846, + -6316823, 12007118, 2332167, 6188511, 5799280, 6507949, 204011, -4262218, 8891119, 778463, + 59593, -7479149, 1996623, 725850, 1059246, 1818382, -861678, -4607426, 2534568, 1461363, + -625992, 2638184, 1034550, -1866700, 3325379, -1712618, -4170950, 1217623, -3987877, -4189741, + 2854543, 2016487, -1107028, 1549410, -761820, -1858647, 2400350, 863825, -312996, 274341, + -419296, 2374580, 434865, 431644, -2052458, 455803, 2924873, 1002875, -2046015, -2140504, + -2136746, -1834488, -1870458, -688805, 1059783, 30602, -1467268, -167504, 1123134, 1580011, + 303869, -206158, 1536525, 848793, 1676648, 233539, + }, + { + 11021960, -24312736, 6377490, 17143362, -9356049, 1654099, -3321084, -979253, -1868848, -105764, + -12103755, 7555921, 7482907, 6757058, -10215043, 10612864, -4896263, 1778653, -7192460, 1315871, + 518617, -11157251, -16297253, -8298414, 216359, -25596932, 4510253, -3431142, 5529234, -643171, + -6852084, 5621039, -577673, 3412352, 10085120, -4075924, 3053185, -1717987, 4952098, 6056441, + -4187593, -2452963, -3811784, 1443109, -803159, -1872069, 2684892, -4810364, -3113315, 5130339, + 3263102, 439697, 431644, -1635309, 733903, -3212636, 1218160, 2770791, -1931125, 4199941, + 1539209, 1031329, -6169721, -308701, 1341640, -1611, 512175, -1298691, 4671851, -1982664, + -1837172, 1922535, 18790, -1875290, 69793, -157303, -1810329, -1527935, 1232656, -481573, + 97174, -1260036, -386547, -357556, -103616, -1519345, 1506997, 467615, 2235531, 458488, + 426276, 509491, -75699, -918049, 787053, -303332, + }, + { + -1772748, 17264694, 5051419, -11188927, 1399086, -2854006, 687195, -329102, 518080, 2491081, + -3508988, -9499931, -2230699, 4861366, 16233366, -3406446, -3064459, 5598490, -7985418, 2201708, + 13045426, 483184, -18945638, 8797167, -5986111, 7601019, 11410654, 4566624, 157303, 4238059, + 4973572, 7265474, -3681324, 6914898, -134755, -1642288, 47782, -331249, -1537598, -9207336, + -6980933, 2324651, 3102040, -4138201, -2542084, -3777961, 176631, 1839320, 1060320, 88047, + -1352378, 78383, 6552510, -723702, -489089, -1057636, -1762547, 1932735, -559420, 787590, + -896574, -1846299, 3595961, -335007, -812286, -3452080, -3025805, -1946157, 779000, 2659122, + -2639258, 2902861, 2633889, -994285, 49929, 1462436, 58519, 1341104, -296890, -2456721, + 1351304, -285615, 2048699, -188979, -1730872, -562104, -908386, 713501, 1702418, -832687, + -105227, 635655, -578210, 208843, -184147, -560493, + }, + { + 17949206, -11323681, 5850283, -22002044, -3098282, -3295851, 8574365, -9967545, -18662706, 4677220, + -1931125, 25185152, -5189394, 9540196, -1216013, -5901285, -9671193, -1101122, 1829119, -963683, + 1569811, 551903, -9258339, -4220342, 18742700, -1739462, 7435662, -6027450, -4276177, -3617436, + 3910568, -2383170, 6686191, 2908230, -609349, 3507378, -623844, 1435056, -2631741, -2129230, + 2171643, -1090922, 864899, -681826, -879931, 2695092, 288300, 6214281, -663036, 463856, + -5485210, -1561221, 1482838, -1693291, -23085, 3330747, -247497, -3803731, -2138357, 2149631, + -2991445, -302795, -650688, -2037425, -2254858, 1334124, 2368675, 1340030, 525060, 774705, + 133144, -1986422, -1829656, 35433, 2465311, -374199, 1152662, 2135673, 1084479, 490700, + -845572, 1241782, 1330903, 2385318, -763967, 2276870, 828929, 718870, -639413, 1031866, + -367757, 227633, 2662880, -251256, -243203, 405338, + }, + { + -38655, -12328704, -14940044, -578210, 4776004, -227633, -996969, -363462, -4064113, -1100049, + -4538707, -2276333, -6715182, 7999914, -8104604, 3160022, -18256296, 1626719, -2069637, 3446175, + 4235912, 2156074, -321049, -15379204, -8911520, -6349036, -3988414, -4388920, 9690520, -10842645, + 6167036, 4294431, -8260296, 13516262, 4584878, 3253975, -3915400, -1451162, 2645700, -477815, + 3777424, -4051228, -6174553, -6692096, 4758824, 1933272, 102542, -768262, -9738838, 1280437, + 757525, 1268626, 3738769, 2881923, 1023276, -2074469, 2391760, -5369246, -3963181, 1008244, + -2290291, -822486, 737661, 1693291, 51540, 1358283, 950798, -3325379, 190589, 346282, + -110595, 1693828, -3088082, -1494649, 524523, -652835, 1351841, 978716, -126165, -2708514, + -1962263, 486405, -2180770, 9127, 1052267, 826244, -903554, -1535988, 1628866, 1368484, + 705985, -108985, -806380, 525060, 583579, 1091459, + }, + { + 13654775, -57584776, 12052752, -60455960, -1927367, 4744865, -10195179, 31941672, -3223910, 1282048, + 10296110, 11549167, 7885023, -1690607, 6532646, -7053947, -20633022, -3423626, 12062416, 2301566, + -6152541, -910533, -122943, -12560095, -5272609, 107374, 5224828, 10411001, 565325, 5196374, + -8078297, 4212289, 839666, -2253247, 2540473, -4155381, -463856, 43487, 2225330, -2981781, + 1749125, -164283, -3144453, -5182952, -5625871, 426276, 4105989, 726386, -577136, -5603859, + 3857418, 1913945, -145492, 870268, -5684926, 751619, -430034, -552440, 4253092, 877247, + 10737, -1380295, 397821, -2161442, 4115653, -1641751, 547071, 3549791, -1498407, 1595044, + 725850, -589484, 309775, -668941, -259846, -2612951, -825707, -781684, 2375654, -490700, + -770947, 2393908, 2050310, -239444, -1193464, -249108, -728534, 1167694, -111132, 865436, + -226023, -1017907, -1069984, -101469, -1002875, 1054415, + }, + { + -31675, 24305756, -1226750, 10347650, 3347927, 88047, 3656091, -2525441, 93416, -3563749, + -94489, 633508, -247497, 9320616, 1644436, 3679176, 12865575, -8740795, 272730, -2484102, + 9105868, -831076, -8723615, -2905546, 403190, 6474127, -1913945, 14878304, -3008625, -3632469, + -8046621, -10194642, -2245731, 3145527, 7331509, 3686693, 3803194, 1422708, -7901129, -2779918, + -5303211, -4927938, 1144072, 6460168, -7941395, -3740380, 4463545, 512175, -3435974, -1226750, + 142808, -18254, -1606318, 3564286, -2302639, 3000035, 3003793, 2132988, 5993627, -1651952, + -1442035, 206695, 1724429, -1054415, 1703491, 548682, -1192927, 899796, -3406446, -327491, + 237834, 2216203, -1781338, 1925756, 201327, 1713155, 711354, -165356, -207232, 2156074, + -257161, 890669, 2285460, -583579, 842350, 1131724, 1991791, 1487669, 2249489, -755377, + -676994, -340376, 395674, 23085, -1052804, -525597, + }, + { + -8323110, 57692148, 9366787, -6742562, -1939178, -22450868, -2923262, -9657234, 14960445, -2063195, + 4517769, -9224516, 7218230, 2514167, 4249334, -4492536, 5999533, -5928129, -9986873, -3502546, + 18051748, -4744865, -2793876, -1001264, -6379100, 5345087, -3380676, 901943, -1675037, 6265821, + -1025960, -4755066, 5573794, -9394167, 1539209, -1544041, 3563749, 1477469, 722091, 9190693, + 1220845, 336081, -1490354, -3287261, -2906082, -1066763, -5775658, 2559264, 3122978, -8130373, + -1554241, -2172717, -2797634, -777389, 3760781, 1973001, -3511136, -1051193, 2815888, -5360119, + -3387119, -764504, 1475321, 3764002, -1610076, -756451, -1152662, 337692, 1857573, -418222, + -375810, -2224256, 659278, -1468879, -197569, -2196339, 999654, -472983, 243203, 1225676, + -1932198, 1167157, 144418, 383326, 1359894, 697395, 956704, -362388, -624381, -404801, + 1342177, -1194538, 2851322, 252329, 169651, -474057, + }, + { + -2737505, -27110908, 7237557, -13045963, 247497, 12487617, 10483478, -5051956, -4602058, 7958575, + 4155918, -5644661, -1028645, -18586470, 4573604, -3843996, 9114457, 1125281, 9745818, 6258304, + -13668197, 4764730, -2274722, -15468862, 456877, 528281, -11887933, 1307281, -7568806, -11965242, + 7318625, -4096862, 7280507, -5255966, 3661460, 860067, -2910377, -345745, -586800, 3355980, + 7282654, -620623, 4065187, 215822, -100395, 3821984, -4286378, 4677220, -996432, -1857573, + -2012729, -3292629, 319975, -1546725, -565325, -2036888, 292058, 6121402, 2496450, 1199370, + -1971390, -4723391, -382252, 4710506, 1192927, 324270, 686658, 2203318, -368293, 1801739, + 2721399, 667867, -1287953, 116501, -883153, 645319, 1935420, -2054605, 361314, -285078, + -2145336, 244276, 388158, -192737, 1060320, 2183991, -143881, -483721, -1827509, -283468, + -1049046, -122943, -267899, 5906, 1753957, -344671, + }, + { + 10001905, 36636072, -352724, 15062450, 2649458, 38445328, 11372000, -13792214, 7075959, 263604, + 8158827, 4585952, -3846143, -9316321, 11477763, -197569, -2412698, 11200738, 2218351, -2072859, + 2507187, 521302, 1007707, 3007014, 4424890, 3361349, 6626598, -4234838, 1255204, -1329829, + 16481937, -8955007, -6549289, 8825621, -3768297, -729608, 1377611, 3142306, -133681, -943819, + -501974, -664646, 1344325, 161598, 2987687, -619549, 549756, -7335804, 4044249, -2422362, + -575526, -6455336, 6705518, -3478387, -4624069, -1603633, 707596, -4988068, 4555350, 1001264, + -3595961, 597537, -3241627, -1486596, -4309463, 548682, 491774, 4643934, 1292248, -154082, + -1456531, 456877, 3006477, -4625680, 93416, -1663226, -1223529, 3053185, -1857573, -1663226, + 184147, 1420560, -489626, 277025, 2218351, -549756, 204011, -339839, -592169, -518080, + 1060857, 963146, -2445984, 337692, 528281, -702227, + }, + { + -2110440, 4366908, 1120450, 9067213, -3918084, 1862405, -8178155, 1174674, 7552163, -4424353, + 3624416, 6484864, 2595234, -42248520, 5055714, -12723841, 1535451, -6637335, 2103460, 1610076, + -3548717, 1265405, 5029407, -6788196, -2815351, -8782671, -3511673, -667331, -4802847, -5123359, + 923955, 2519535, 1290101, -13095892, 3604551, -5225365, -3142306, 3081639, -3148211, 1331977, + -9448928, 6584722, 2477659, -3602941, -1485522, -292595, -2625299, -3583077, -1709934, 4684199, + -6426882, -2502892, 694711, 4908611, 1826972, 2151779, -2752000, -2560874, 488553, -5521181, + 5403606, -1264868, -5127117, -4413616, 711354, -970126, -444529, 1562294, 340376, 4254165, + 1074, -2518998, 417149, -527207, -449361, -625455, -1806034, 21475, 617938, -432718, + 1658931, -1039919, 239444, -1869385, -1337882, -255014, 1014149, 52613, 500364, -443992, + 278636, -257698, 2193655, 1217086, 1868311, 1021665, + }, + { + 14015552, 10865730, 6696391, 13216151, -10849087, 19385872, 2268817, -8617852, -2388539, 10161893, + -3119220, -1930051, -32075890, -5764383, -34561600, 5162014, 588947, -13713294, -59593, 6634114, + 2163053, -607738, -4043175, 4851703, -4704600, -22917408, 10916733, -7318088, -7369627, 1656784, + 4333085, -8288750, 3748970, -4698158, 11409044, -7990787, -3546032, -3684545, 8202314, -2567317, + -1374926, -1620813, 3971771, 6440304, -5200132, 6953015, 4611185, 4130685, -3796214, -2503429, + -5798206, 6651294, -4419522, -4491462, -1096290, 2764348, -4867272, -631360, -1793149, -336618, + -5492727, -635118, -433255, -3733400, 1065689, -247497, -2236604, 164819, -201863, -868120, + -396748, -1774358, 811212, -571768, 1058173, 576063, 694711, -2329483, -3078418, 111669, + -204011, 856846, 1730872, -33286, -2229088, -746787, -1477469, 913217, -2144263, 529892, + -428960, -1859184, 643708, -1147293, 1571421, -297427, + }, + { + 1595580, -28702192, -3502546, 3435974, 8061117, -1089848, 6362457, 625455, 7611219, 1673427, + -3250753, -1692217, 3338800, 15223512, 32712618, 3306588, 7539278, 3788161, -17336636, -8023536, + 10633802, 1919850, -10595147, 2602750, -357556, -8461086, -189515, 5037460, -5824513, -2971044, + 4634807, 7022272, 3448322, 4072166, -1945083, 8206609, -7136625, -8411693, 2389076, -8177618, + -5776194, 11500849, 969052, -659278, 1247151, 7975755, -252329, 704912, -1825898, -3452080, + 3810173, -1895691, 683437, 6730751, -271657, -5523865, -143881, 1388348, 3860102, -1819456, + 3153043, -266288, 5228586, -2419677, 138513, 5308580, -3060701, 5810554, 42413, -110059, + -2753611, 494458, 1618666, -1198296, 1326071, -1278290, 969052, -1024887, -598074, -401579, + 279710, 593242, 511101, 1169842, 468688, 2127620, 252866, 340913, -1315334, -151934, + -446140, 1095754, -679142, 3096672, -1513976, 1386201, + }, + }, + { + { + -17311940, 31659278, 31516470, 60117196, 13035763, -8324721, -4337917, 3634616, -3938485, 14585709, + 11527692, 4550518, 4603668, 5090610, -390842, 3515431, 10096931, 1634235, 955630, -303869, + 1216550, 8342974, 1192390, 8428873, -2742874, -2824478, 370441, 6118181, -1759863, 308701, + 2481417, -3012920, -1198833, 453656, 2704756, 5032091, -2021319, 8012262, -346819, -1425392, + 3085397, 54224, 2302639, 3224984, 3597572, -4568772, 1963874, -3125126, 1201517, -4258997, + 1240709, -571768, -2610803, -5909338, -1810866, -4785131, 1489817, 1077500, -987306, -2312303, + 1013612, -297427, -3081102, -361314, -1115081, 521302, -174483, -2099165, -1870995, 2108292, + -1207960, 1461900, -472446, 3221, 267362, -1114544, -522375, -1204738, -665183, -710280, + 147640, 1038308, -935766, 41876, 69793, -1555315, 39192, -698469, -777389, 1185948, + 1378148, 786516, 630286, -105764, 624381, -375273, + }, + { + -1476932, -8652212, 15042586, -10937671, -26320634, -2330557, 1006096, 2033130, 126165, 4651987, + -8885214, -8848170, 2773475, -7013682, -2450816, 6291590, -15721191, -3295314, 13423920, -14033806, + 5652714, 13516262, -1979980, 5434208, 10459856, -1976759, 2152316, -14061723, 3920232, 1140851, + -7000260, -2736431, -8302709, 3592740, 1961190, 577136, 10599979, 168041, 404264, 1957431, + -1744294, 4003983, 2269353, -8145406, -2480881, 10464151, 5350993, 3848291, -3884261, -1585380, + -1211181, -1388885, -2880849, 1524713, 563714, -135828, -1119376, -1060320, 739271, -2084133, + 253940, -474057, 649614, 330176, -1801202, -309238, 376347, -1481764, 2216203, -1975685, + -2357400, -612033, -347892, -848256, 821413, -6979, -2029372, 1461363, -54224, -1692754, + 454730, 848793, 1939178, -1823214, 195958, -890669, 1605781, 1148904, -1339493, 2544231, + 505732, 460098, 462246, -1100585, 80531, -1042066, + }, + { + 5236102, 22016002, -26234198, -32693292, 12039867, 113817, -2266132, -833224, 5849209, -2956011, + -9029095, -6640557, -11692512, 5401458, -3299609, 8458401, -2135673, -1932735, -3480534, 9152038, + 4153770, -4226248, -4847945, -7569343, 1636383, -1880122, 3654480, 5417028, 2936147, -6336151, + -6478422, 4153770, 11911555, -1589675, 13964012, -1964411, 8506183, -3105798, 702227, 103616, + 2460480, -4858145, 252866, 3897683, -1506460, 1556389, -4072166, 3522947, -2873870, 2882460, + -2641405, 3675418, -2813204, 2872260, 1614371, -440234, -5010080, -701690, -3821447, -834834, + 290447, -142271, 2350958, 3289945, -3411815, -583042, 1695975, -590558, 509491, 1794223, + -1502165, 767725, 996969, 1186485, -2570538, 518617, 2073932, 928250, -2203855, -479426, + -2610266, -641024, -489089, -2931852, 732292, 267899, -952409, -530428, 781147, 1993939, + 559956, 13959, 96100, 1195075, 781147, 1085553, + }, + { + -12320114, 2381559, -1311576, 23119272, 2717104, -1265942, -1954747, -6347962, 7186017, -6062347, + -9580998, 8434242, 568009, 13670881, -1595580, 3202972, -7230041, 10101763, -8240432, -11128797, + 5470715, -8837969, -21729850, -2044941, -5303211, -20758114, 1103807, 5516349, -1613834, 365609, + 3487514, -1527398, -646393, 6848862, 8577050, -1136019, 1691143, 2824478, 1691680, 2186138, + 686658, 1310502, -6149320, 2269890, -1199907, -282394, -3089155, -2608656, 683974, 4225174, + 659278, 3303367, -3730716, 2276333, -3655017, -397821, 862752, 2475512, 2821257, -3147137, + 4233227, -1469953, -2084670, -4413079, 1971390, 2740726, -1690070, 4174171, 29528, -852014, + -1347009, 2499671, -105764, -672699, -571768, -2491618, -1032940, 117038, 293668, -1165547, + -1640678, 1511292, -1634235, -529892, -577673, -868657, -1298691, 2195265, 1307281, 525597, + 251256, 1305670, 63351, -1385127, 1423245, 553514, + }, + { + 727997, 29198262, -7778723, -7572564, -2850785, 76773, -940598, 239444, 1013075, 623307, + -347355, -7744363, -3750580, -4515085, 28505162, -5509370, 10442139, -9213242, 3369939, 6642704, + 7027640, -1355062, -16538845, 3651259, -3439195, 7580618, 5319854, 6063957, 8413841, 1731409, + 1256815, 4301947, 694174, 4223027, -3885872, 1791538, 338229, -1141924, -7878581, -9262097, + 1815161, -1921998, -740345, 688805, -5760088, -5817533, 3450469, -2036888, 3279745, 1130113, + 1604707, -840203, 3489124, -1500554, 899796, -3324842, -688805, 2144799, 24159, -388695, + -1375463, 2722473, -1605244, -540629, 38118, -1004486, -3547106, -767725, -233539, 1700270, + -445603, 3134253, 343061, 320512, -1197222, 2119566, 1007170, -1360968, -1277216, -964220, + 2155000, 396748, 1624571, -478889, -1186485, -2039036, -437013, 1595580, 266825, -4832, + -141197, -547608, 265751, 1015223, -856309, -777389, + }, + { + -16760573, 42374684, -16533477, -16273631, 4741644, 1865626, 4293894, -14353244, -6912750, -5557688, + 20135344, 7796440, -843424, 7360500, 8686571, -1955821, -21963926, -2434710, 7480223, 2060511, + -133144, -5221070, -3712999, -2691334, 14215805, 6359236, -1224066, 227633, -6637335, -1353989, + 198642, 1280437, 3298535, 1583232, 1216550, 3064996, 4586488, -2859911, -8581882, -1200980, + 688269, 3375844, 1126892, -1846836, 125628, -2258616, 1289027, 4668630, 1960653, -4173635, + 1083942, -798864, -114890, -2316598, 2167348, -490163, 114354, -3730716, -1279363, -292058, + -1554241, 2344515, -5429376, -353261, 1323924, -1589138, 1717987, 1657321, 187905, 1945083, + -1221918, -2415382, 1887101, -584652, 1915019, -848256, 1064615, 1399623, 2377265, 179852, + 518080, 899796, 2102387, 1219234, -276489, 1802276, 485331, 422517, 602906, -493921, + -100395, 932545, 1512365, 527207, 466541, -81604, + }, + { + 457951, -23007602, -6371047, 3019362, 503048, 403190, -190589, -1125818, -4474282, -1854352, + 3445638, -8091719, -1072668, 5151277, -2022930, -2511482, -14728517, -948651, -4525822, 9806484, + 9001715, -2549600, -3458523, 142808, -15162845, -8506183, -10856604, 4557497, 5625871, -6614787, + 5517423, -1323924, 3045669, 671626, 9266929, 407485, -5195300, 160524, 1122597, -5760625, + 5762773, -968515, -10613401, -2760590, 5710696, -4751845, -22549, 552977, -8291435, 3985193, + 541703, -2113124, 5558762, 1512902, 1427003, -1777043, -911070, 1063004, -6017249, 422517, + -2191507, -673236, 2771865, 2617783, -313533, 18254, -433255, -1149978, -443455, 680215, + -69256, -504122, -682900, -3208878, 1042603, -1720134, 1610076, 781684, 547071, -2695629, + -1448478, 293132, -559956, -1431298, 299037, 2473364, -1144072, 935766, 187905, 771484, + 1697586, -314606, -1925756, 1570347, -361851, 1020592, + }, + { + -25283936, -10525354, 7628936, -64885144, 9825275, -1654099, 10150618, 11121281, 1380832, -3477313, + 11931956, 9807558, 13209709, -1541356, 8712878, -3524021, -21680994, 999654, 8328479, -94489, + 1306207, -6506876, 1941862, -5437966, -9133248, -426812, 8836358, 2836826, 4339528, 2637647, + -1073742, 343061, -3346853, 4387309, -3776350, -1228361, 938987, -1296006, 1087701, -1420560, + 3984656, -3401077, -5490042, -3564286, -437550, -1015760, 6089727, -2087354, 914828, -2036888, + 243739, 2987150, -1873143, -2247879, -104153, -1838246, -823023, -418759, 4027069, 1562831, + 2021856, -3185255, 1318018, -501974, 4166655, -2182380, 1714229, 1719061, 822486, -671626, + -1739999, 1773285, -773631, -741419, 230854, -1030792, -2787971, 679679, -39192, 498216, + -1203128, 2596845, 1895154, 301185, -2238752, 1074279, -600759, 551903, -619549, -131533, + 1280437, -160524, -1890859, -85362, -720481, 1103270, + }, + { + 2108292, 6694781, 10003516, 3684008, 4218195, 1942399, 1674500, 741419, -4469451, -2560338, + 8524436, -2994129, 1783485, -6296422, 13254269, -6487011, 1873143, 4587562, 810138, -4300873, + 14851997, -10989211, -6589554, -44023, 510027, 481036, 10771241, 8626979, -653372, -2979634, + -7495792, -19225348, 11820287, 4247186, 4939750, 1343251, 1303523, -3140158, -1357210, -9529996, + -7593502, 6030671, -3153043, 5238250, -7281044, -26844, 4779762, -3663607, -2939905, -1356673, + 992674, 802085, -2180770, 865973, 1217623, 3304441, 1586454, 1321239, 3819300, 2477659, + -2343442, -881005, 2437394, 894964, 1146219, -1496259, 288300, -1233729, -3920768, 544924, + 1601486, 227096, -941135, 1555315, 1571958, 284542, 2294586, -1524177, 1156420, 707596, + -1065689, 1633161, 1227824, 102005, 1310502, 686658, 383326, 2001992, 1706713, 699543, + -1582696, 130997, -27380, 322123, -1594507, -1387811, + }, + { + 11324755, 58631672, -5798743, -3145527, -25812754, 17995912, -28595892, 5419712, 5350993, -4872104, + 8108362, -19915226, 20345260, -782221, -4058744, 8621073, 1120450, 6986301, -14928769, -1901597, + 3084324, 6665253, -15753403, 4689568, -5989869, 4548907, -2544231, -1358820, 3491809, 3874597, + -882079, 5734318, -1590749, -10349261, 2152852, -1847910, 5550709, -1216013, 4638028, 2621004, + 1009854, -281320, -1902671, -697932, -1066763, -4297115, -2433099, 1631551, -1955284, -3476239, + 1390496, -1562294, -5501853, -405874, 6946573, 2175938, -6154152, -87510, 3198677, -3284039, + -4802311, -1605781, 3412352, -1254131, 1312649, -1585917, 767189, 798327, 333397, -539018, + 128849, -1624035, -482647, 155156, -788663, -1488743, -1254131, 750009, 1038308, -1194538, + -405338, 1795296, -1283122, 483721, 1074279, 108985, 2661806, -696322, -727997, 1197222, + -926102, 1211718, 1979443, -443992, 1284195, -1214402, + }, + { + 2624762, -24327232, -3974455, -6465000, -6210523, 7276212, 15752866, -4883915, -5426155, 8246874, + 2217277, 5299990, -11919608, -12159052, -3111167, 1752347, 980863, 562641, 6791417, 17925582, + -13093208, -3203509, -7555921, -13192529, 2746095, 3076807, -4840965, -498216, -12921946, 5038534, + -2406792, -2758443, 7963943, -10792179, 8111046, -2493766, -429497, 4800163, 477278, 1337346, + 1212255, 5369246, -383326, -1278290, 700080, 2505040, -604517, 6693170, -4750234, -6686191, + 1330903, -472983, -2303176, -1089848, -336081, 1188095, -4042101, 7203197, 2225867, 36507, + -3696893, -4767414, 1339493, 2112587, 1828046, 4210142, -1641214, 1025423, 750009, 2687039, + 2832531, -435939, 1398549, -2167885, 265214, 774705, 1896765, -2446521, 422517, -2421825, + -70330, -821413, 1815697, 181462, 980326, 1399623, 1291711, -1509681, -1110786, -660888, + -860067, -310311, 508417, -338766, 161061, 1161789, + }, + { + 2808372, 51627656, -6118181, 27131308, -793495, 47436840, 515933, -7399692, -6838662, -2762201, + 17871358, 1547799, -884226, -14618458, 10907606, 3749507, -7006166, 13836774, 6513318, -17229798, + 8128763, 2496987, 2615098, 648540, 3957276, 9391483, -144955, 3322157, -7869991, 4327180, + 11086921, -8531416, -205085, 5934571, -89657, -492848, 3662533, -6131603, 2070174, 2988760, + -5199595, 1266479, 3697967, 1836099, 425739, 3306588, -7080254, -5601174, 76236, 1487132, + -3692598, 698469, 71941, -1793686, -2603287, 246424, -5750961, 1603097, 1065689, -492311, + -665720, 438624, -2070174, -7261716, -1801739, 1697586, 1968706, 2064806, -185757, 871878, + 287226, -545998, 1768453, -1770063, -1705639, -1237488, 807991, 173946, -733903, -913217, + 940061, 379568, 113280, 962073, -293668, 1287953, 1447404, -1420024, -1724429, 811749, + 610422, -208843, 559956, -747861, -247497, -1973538, + }, + { + 1126892, 9105868, -581431, 3757023, 2448668, -85899, -5122822, -4808753, 5269925, -1702955, + 2319819, 4346507, -6235219, -8682276, -11824045, -7185481, 3123515, -7219303, -4037269, 4661114, + -1970316, 6274947, -2611877, -3030100, -2820183, -3978750, -5544803, -7143605, 6757058, -11755325, + 14488535, -10931229, -565325, -3873524, -5082020, 4669167, -10474888, 6987375, 2178085, -5872831, + -3903052, -132070, 8053, 1999844, -3020973, 2405719, -6503118, -176094, -1505386, 729608, + -5734318, -1609539, -1757715, 5952288, 1468879, -286689, 2367601, -438087, -4969814, -1344325, + 1065152, 686121, -4131759, -4001299, 1413044, -1915555, -579284, 646393, 1585917, 6220724, + -3599720, -509491, 1189706, -647466, -1930588, -127238, -1752884, 1091995, -2011118, 531502, + 2554969, -1821066, -505732, -1058173, 849330, -1661616, 1274532, 851477, -489089, -182536, + 546535, -1060857, 2913599, 153008, 2158221, 1126355, + }, + { + -8752070, 59652800, 252329, 5832566, -2598455, 11953431, -9568650, 9645423, -16184511, 5725192, + 4180614, -19100256, -8881455, -11815992, -28290950, 2837363, 2141578, -1163936, -5606543, 5418101, + 9948755, -14921253, -1432372, -229244, 3337190, -21568788, 14496, -10358924, -4221953, 4174171, + -6887517, 7889855, -3305514, -5610301, 7033546, -1174137, -10478646, -3558381, 11415486, -5482526, + 2464238, -2041720, 3977677, 2296734, -177167, 3190087, 7482907, -1055488, -1313186, -6432251, + 5949604, -3267933, -4275640, -3110093, -3118146, 4173098, -4554813, -594316, 1961726, -6152541, + -282931, -2502892, -308701, -1328219, 933082, 381715, -1442572, -765578, -1429687, 1046898, + -1398549, -1942399, 1507534, -1849520, 2180233, 45634, -380105, -1206349, -1780801, -759136, + -967978, 1271310, 1954747, -2428804, -273267, -1527935, 112743, -1226213, 100395, -765578, + -527744, -264677, -487479, 478889, -362925, 269509, + }, + { + -2165201, -22868554, -3056943, 4328790, 3193308, 2916283, -83215, 2455111, 7866770, 1901060, + 656593, -5251672, 3326989, 18950470, 27439472, -7806103, 16437377, 770947, -235149, -10673531, + 10408316, -16283295, -1026497, -9227200, -1412507, 5433671, -2290828, -1684164, -10137733, -741956, + 1099512, 3437585, 7694434, 230318, 9061307, -802085, -6318434, 878858, -2131915, -1301912, + -3563212, 4863514, 1312113, 2480344, 1292248, 6694781, -2638184, -1482838, 4940286, -818728, + 3055332, -1673427, -3650722, 8782671, -233539, -4606353, -1243393, 2591476, 214212, -301185, + 5762236, 599685, -875100, 1789928, -2402497, 3963718, 3765076, -603443, 2476049, -1703491, + -1006633, -2148558, 1618666, 1350230, -385473, -841277, -1058173, -526670, -1196685, -919123, + 2464238, 82678, 1545115, -870805, 2224256, 1792612, 1003412, -1590749, -590021, 262530, + -142808, 204548, 92342, 2181844, 72478, -156766, + }, + }, + { + { + 19127100, 11673184, -30871688, 34294240, -252329, -6068789, 310311, 5751498, -6817187, 4677220, + -1269163, 6859600, -2560874, -1524177, -3189013, 490163, 4987531, -8022999, 1418950, 8728447, + 7446400, 5904507, -3562675, 5117991, -4954245, -5714991, -718870, 3612068, -9087077, -4481799, + 3338263, -704912, -934692, 3103114, 1504849, 3710315, -3049427, 8687645, 121333, 834834, + 1261110, -1720671, 1054951, -1654099, 3874597, -2913062, 16106, -4087198, 3610457, -1383516, + 590558, 2545842, 293668, -3070902, 1706713, -3642669, -870805, -1593970, -1365263, -3685619, + 1465658, -189515, -3619584, -930934, -1017907, 1029182, -1580548, -2962454, -2659122, 1171989, + -1944010, 1047972, -398895, -1928440, -737661, -1888175, -1644436, -753767, -381715, -832150, + -1188095, 187905, -1068910, 584652, 988916, -1127966, -17180, -1071058, 485868, 1190243, + 330176, -340376, 42413, 273804, 2099702, 862215, + }, + { + 581968, -34977140, -2430952, 31884226, 7192997, -2274185, 3556770, 5989869, 1910187, 6586333, + -14783814, -9724880, 3350611, -7676717, -6487548, 6550899, -13124346, -6586333, 10317585, -15592342, + -364535, 4844723, -13797046, -5647345, 5290863, -4318590, 7005092, -5710696, 2947421, 2341831, + -2684, 619549, -1076963, 7030862, -1841467, -6254546, 2980707, -2862059, -2099702, 4310537, + 222265, 3315715, 4115116, -2603287, -1878511, 7755637, 1748589, -362925, -2935073, -181999, + 1746978, -517007, -6251862, 2951180, 1611150, -2226941, -1717450, -3676492, -1475858, -2056753, + 1348083, -348429, 35970, 1345935, 1273995, -222265, 274341, 1263794, 2561411, -2274722, + -1626719, 1360431, 1134408, -2516851, 114354, -388158, -3031173, 357019, 1118839, 63888, + 1426466, 1191853, 1980517, -768262, 734976, -1143535, 1302449, -208306, -2042794, 2220498, + -336081, 438624, 170188, -576063, 56371, -1344862, + }, + { + -3468186, 63171452, 10226317, -54509040, 3635690, 2797634, -3880503, -3972845, 3965329, -2635499, + 7591892, 62814, -24955908, 15143518, -6049462, 6491306, -499290, -4305705, -17812304, -13229036, + -4337380, 1529545, 3477313, 2058363, 13654238, 4726075, 6952479, 1216550, -2114198, -5364414, + -893353, -2825552, -2202781, -16270410, 9561134, -6988986, 10737, -6622303, -3603478, 907312, + 2170032, -1293859, 3549791, 3534758, -318901, 3136937, -6898255, 2375654, -856309, 2473364, + -3459596, 5003100, -4308389, -127775, 727997, 3811247, 1917703, 871342, -2332704, 1080721, + -108448, -4763119, -1262720, 2209224, -4678293, -2061584, 2061584, -845572, -972273, 1702955, + -2250026, -470299, -34360, 403727, -879395, 586800, -1357210, -685584, -762357, 1748052, + 513249, 2390149, 2177549, -1199370, -179852, 198105, 282931, 195421, -231391, -143345, + -512712, -883153, -724776, -129386, -35970, 1020592, + }, + { + 6516539, 22121766, 9213779, 28926604, -4960687, 2586107, 644245, -6332930, 4784594, -13033078, + -9605694, 11041824, -5580773, 1424855, -1675574, 6237903, -5812165, 14153528, -941135, -10452340, + 4225174, 1033477, -2355253, 9103183, -3056943, -14242648, 4530117, 12603045, 8931921, 700617, + 7384660, 3113315, -1350767, 7654169, 8003135, -2452426, -2079301, 2109903, -3199214, -1632625, + 1044751, 5292474, -287226, 2887829, -2255932, -1483911, -6063420, 1881733, 3301219, 2019172, + -1772748, 3402688, -2455111, 1060857, -6286222, 1421097, 2731062, -1690607, -413391, -809064, + 2732673, -3471944, 1833951, -593779, 1824287, 1358283, -994285, 3962107, -2744484, -461172, + -1297617, 1575179, 9664, 1505923, 1233193, -2517388, 739808, 1040993, -728534, -444529, + -1858110, 1400696, -3047816, -2568391, -1427540, -931471, -1119376, 650688, -191663, 54224, + 198105, 726386, 639413, -40802, 753230, -547608, + }, + { + -38655, 35416836, -3127810, 906238, 5534602, 441845, -717796, 2222646, 4565550, 2204392, + 1835562, -4132296, -2191507, 7282654, 37847788, -3484292, 12357695, -3159485, 8160438, 695785, + 2026688, 3661997, -7648800, 3955665, -2655901, 14367202, 8808978, 1982127, 4459787, -5278515, + -6185290, -4634270, -1327145, -941135, -15478525, 1361505, 390842, -167504, -2930778, -8814884, + 205622, -325881, 2251637, 4359392, -2709588, -1762547, 4610111, -4958003, 1523103, 638340, + 3900904, -2292976, -2130304, -4714801, -1493575, -2392297, 3643206, 2985002, -480499, -2052458, + -1553704, 2862059, -4334696, -1879048, 1739462, 1934883, -2758443, 91268, 803696, 1126892, + 259846, 507880, -2909304, -683437, -2860448, 200253, -497679, -2221035, 278636, 640487, + 1968706, 366146, 824634, -276489, -998043, -2376191, 633508, 1081795, -809064, 325881, + 638340, -55298, 607738, 401579, -1346472, -293132, + }, + { + 4380867, 73555072, -6576669, -23722714, -12002286, 869194, 3182034, -8382703, 3964792, -895501, + 23096724, 56371, 4590247, 15479062, 7734699, 2770791, -10985453, -7008850, -4917201, 460635, + 8048232, 2442226, 2022393, -489089, 1103807, -2612414, -7861401, 6635188, 5814849, 2953327, + -3315715, -3834869, -2583960, -3095598, 885837, 4267050, 1246077, -6549289, -7589744, -1342714, + -278099, 4151623, -2404108, -6395743, 1791538, -4628901, -2206003, 2440078, 486405, -4217658, + 3292629, 595927, -464393, -251792, 4105989, -661962, 1240172, -1292785, 1625108, -308164, + -1947231, 3403762, -3540664, -382789, 1560147, -839666, -194347, -1361505, -1605781, 978179, + -442919, -270583, 3652870, 875636, 1222992, -1271310, 474594, 1114007, 646929, -1800128, + -697932, -544387, 258235, 425739, -846109, -2147, -695248, 62814, -180389, -864362, + 117038, 574989, 421981, -251792, 817118, 840203, + }, + { + 203474, -10271951, 10502806, 1672353, -1657321, 918049, 1834488, -664646, -2903935, -935766, + 5253282, -4446365, -1407676, -4274030, -15199889, -10362682, 7630010, 16842714, -5834176, 3888019, + -7456600, -10053445, 5845988, 26336740, 7368017, -5862631, -9360344, 2744484, 3045669, -5982890, + -127238, -4556961, 3213173, -318364, 3651259, -3296924, -1692754, 5629092, 1268626, -10368051, + -724239, -6957847, -7390565, 1864553, 1918777, -6515466, -2434173, -382252, -4071092, 4195646, + -1759326, -2673617, 5421860, -278099, -2130304, -2258616, 1223529, 2669322, -3839164, 4912906, + 2451890, 1596117, 3428458, 3914326, -1396401, -600759, 576599, 2164127, -557809, -2194192, + -486405, -1676111, -97711, 435939, 1200443, -2514167, 1538672, 217970, 1250372, 548682, + 1561221, 437550, -185757, -394600, -103616, 1751810, 157840, 1965484, -552977, -1502165, + 1795296, 938450, -630286, 2432562, -973884, -348429, + }, + { + 32181654, 63592360, -3870839, -72375032, 5761162, -8029442, 1500017, 3553549, -5407901, 2251100, + 4049617, -11272142, 16727824, 7095286, 8106214, 2356863, -4720706, 9621800, 14053133, 8148627, + 5179731, 674847, 13095892, -484258, -5568962, 4265977, 2005213, -1316408, -2085744, -6883222, + -1058173, 3423089, 784368, 11578695, -2215130, -1605244, -1748589, -1045825, 2112050, -2847027, + 3645890, -1891933, 341450, -1623498, 5252745, 4449049, 6008123, -423591, 4600984, 1289564, + 534723, -1355599, -5938866, -37581, 2595234, -1321239, -91805, -1416802, 4066797, 3901441, + 4051765, -2313914, 2035278, 524523, 899259, -2517388, 2572149, 1560147, 444529, -929860, + -1232119, 1806571, -155693, 602369, 1831267, -1100049, -4392678, -203474, 378494, 1765768, + -1955284, 676994, 958315, -616865, -2404108, 1479079, -721018, 1052804, 332860, -798864, + -442919, 484258, 176631, 555661, -1357747, -389231, + }, + { + -238371, -15433428, 2872796, -4152697, -4721780, -1336272, 792958, 1173063, -6529424, 64425, + 12902082, -6025839, -256624, -769873, 20507932, -5670968, -7286949, 515396, 5925445, -3588445, + 5298379, -12409234, -1108638, 8697846, 1326071, -5268315, 13338021, 4811974, 2731599, 6251862, + 2638721, -24142012, 4104915, 5790153, -2288681, -6046777, 5301601, -4769561, -4044249, -7220914, + -3259343, 3518115, -5116380, 5692443, -929860, 4743255, 3775276, -1994476, 1154809, 2066953, + 1273458, 175557, -1156957, -690416, -73551, 4362613, -730681, -990527, -79457, 2691871, + -878321, -2461016, 1182727, 2018098, -242129, -2027225, 2076080, 365609, -916976, 3282429, + 1459215, 721555, -1602560, 1111323, 1966558, -2938295, -46708, -2182917, 183610, -942745, + -1036161, 751082, -651761, 103616, 1712618, -1181653, -709743, 1480153, -485868, 188979, + -553514, -797253, -519154, 462783, -2276870, -1272384, + }, + { + -15086609, 72861976, 43891344, -3354370, -19514184, 51233592, 14260902, 13674102, -28341416, -9874130, + 21878564, -8699993, 23564338, -11438572, -17554068, 6754373, 1728188, 9379672, -2882997, 2542084, + -8355322, 2177549, -11584601, 452582, -11810086, 3489124, -2291365, 7246684, 5875516, 3568044, + 6949257, 10433549, -5005248, -4950487, 3414499, -2515777, 8135205, 1796907, 6225555, -1140851, + -6160057, -4936528, 506806, 4926865, 2473901, 233539, 1488743, -879931, -6782290, -1007707, + 7410966, 1847910, -3012383, -2905546, 946503, 2818572, -856846, -2328409, 4034048, -1147293, + -3266860, 1114544, 3817689, -1693291, 4791036, 2157147, -1068373, -1962263, 547608, 1726040, + 2136746, 11811, -2022393, -1399086, -137439, 615254, -2698313, -1173063, 326418, -133144, + 1890323, 1726040, -476741, 1735704, 762357, -683974, 2173254, -1348083, -1238561, 1753957, + -70330, 1164473, 293132, -1101122, 816044, -1650341, + }, + { + -3325915, -5735929, 13203266, -8463770, -4737886, -11758547, -2097018, -2365990, -7552700, 6784975, + 1888175, -8814347, -13788456, 5544266, 9149891, 2092186, -3321084, -7883950, -6104759, 12023224, + -8370355, -10235444, -12786655, -7198902, 5576478, 10813654, 13027710, 10971494, -8664560, 14363981, + 2422899, -1923609, 6240051, -7222525, 5076115, -7339562, -491774, 2947421, -1137093, -573378, + -2589865, 2343979, -2508261, -2218888, -726386, 937914, -672162, 6390375, -2434173, -8750459, + 2098629, 3171297, -1127429, -935229, -895501, 3220152, -4112968, 1904818, -613643, -1069447, + -1504312, -2078764, -366146, -1642825, -1453310, 3433290, 407485, 1807644, -390842, 2846490, + 2299955, -2761127, -919660, -2661269, 1276679, 690953, 1571958, -3497714, 918586, -1272384, + -270583, -154619, 2058900, 122407, 68183, -143881, 969052, 736587, 2027225, -508954, + -1065152, -2036888, -467078, 483721, -1093606, 275415, + }, + { + -18874234, 44227964, -3861176, 12754979, 15445239, 37826852, -9736154, -4093641, 397284, -8963060, + 4036196, -5177583, 3308736, -7539815, 17624398, 15014669, -22082574, -3470871, 6119255, -13861470, + 14975477, 8631274, 4588636, -8352638, 2279017, 10916733, -3059627, 338766, -7067906, -4647692, + -767725, -1570347, 5952825, 2773475, -655519, -220654, 1540283, -8207146, 1588064, 7864085, + -1398549, -345745, 5530844, -339302, -7585986, -5122822, -7178501, 1101659, 2219961, 750009, + -2980707, -1328219, 36507, 1538135, 1633698, 2867965, -5558225, 758599, -878321, 938450, + 1582696, -816044, -1089311, -3715147, -892816, -1175747, 725313, 1531156, -1467268, 693100, + 64425, -1327145, 1815161, -833761, -1720134, 537408, 2209761, -737661, 2665564, 3099893, + 2377801, 1286880, -1227824, -451508, 180926, 383326, 457951, 577136, 165356, 1734093, + -287763, -938987, 1265942, -1505386, -1150514, -1427540, + }, + { + -591632, 27997282, 7424925, -5256503, 1422708, -3107409, -5856725, -5637682, 5863167, 169651, + -3944391, -6545530, 7937100, 22490060, -5130876, 899796, 556198, -9468255, -3127273, 6342593, + -5410048, 3562675, 4058744, 10136123, 8414378, 40802, -8066486, -3230352, 23533200, -9019431, + 9713069, -15373835, -4191351, 2102923, -744640, 12991739, -7379291, 1067836, 3291019, -23085, + -3267933, -6679211, -1974611, 5632313, -4345970, -3401077, -6397891, 281320, -1269163, 4410932, + -150861, 4032438, -2160906, 3899294, 593779, 358093, 5440113, 469762, -5784784, -621697, + 1567126, 2366527, -119722, -112743, 1507534, -360240, 3050501, 25233, -3048890, 985695, + -4101694, 1039382, 1575179, 1317481, 502511, 190052, -1862942, 1003412, -4095251, -1149441, + 643171, -2606508, -1045288, -600759, 2560338, 163209, 2149631, 2733747, 1036161, -741419, + -177167, -792958, 2411624, -1479616, -23085, 955630, + }, + { + -3911642, 74225624, 842350, 11839077, 3970161, -10313827, -15995532, 14695231, -11477763, 11666742, + 17424146, -2024540, 6116571, 3003793, -12850542, -5611375, 10729902, 22621056, 6170258, 106837, + -579284, -19861540, 2174327, 3451006, 3439195, -14160507, 2755759, -8979166, -1130113, -5528160, + -19163070, 7596187, 3686693, 388695, -6354404, -7865696, -2995203, 2916283, 10249939, -2375117, + 6003291, -1229971, 889058, -2434173, -3849365, -8791261, -4589173, -1145683, 2659659, -4023848, + 3291019, -4555350, 2819109, 439160, -3688840, -1522029, -4255776, 2043331, 2949569, -4974646, + 1079111, 1171452, 3034395, 1556926, 2961917, 2733747, 1698660, 375273, -502511, 1486596, + -839666, 838592, 5572183, -1178969, 1401770, 500364, 1679332, 327491, -704912, -399432, + -2472828, -453119, 845572, -1938641, 1217623, -1865090, 74088, -1056025, 1767379, -71941, + 56371, 1624035, 493921, 2062658, 359167, 485331, + }, + { + 1656247, -25487410, -9934796, 14742475, 5921686, -1115081, -2742337, -1559610, 7475391, -3354906, + 2627983, -1100049, -1352378, -32716914, -37142876, -14634027, 13240847, 2342905, 2918430, -3411278, + 6861211, -19553376, 678605, -12270722, 1207423, 9381282, 4010963, 1039919, -11629698, -4138738, + -6039798, -3569655, -2925410, -9548786, 7026567, 7851200, 6425808, 5459441, 178778, 1548336, + 627602, 6357626, 1314260, 4202626, 986769, 2716030, -2341831, -1483911, 3834869, -1494649, + 4696547, 5708549, -1408212, 4562866, -2094333, -899796, 1893544, 2385318, 888521, 702764, + 3688303, 2319282, 1207960, 1124745, -6634114, -2338073, 2220498, -4094178, 2284386, 898185, + -3221, -1778653, 1110249, 395137, -2049773, -1140851, -438087, -703301, -2543695, -1285806, + 3903052, 1261110, 948651, -2174864, 2483565, 1568737, 1621887, -1405528, -600759, 1681480, + -128849, -1224603, 710817, 1846299, -1003949, -144418, + }, + }, + { + { + -17922898, -48811768, 40914396, 7658464, 20284056, -3288334, 7634841, 6793028, -6800544, 4177930, + -12203613, 7945690, -849867, 893890, 850940, -6278706, -491774, -10128070, 9611063, 6929393, + 9797357, -3849365, 2189897, 3351685, -1379758, -2063195, -8559870, 639950, 1933809, -4072166, + 2137820, 3376381, -8239358, 3303367, 6590091, -149250, 6248104, -2746632, 5385352, -484258, + -7560216, 2869575, 6861211, -1263794, -454730, -270583, -3376918, -1841467, 2563559, 5669894, + -3828427, 3426310, 2271501, -656056, -2632815, -949188, 636192, -3030100, -862752, 763967, + -887448, -4828617, 1200443, -2489471, 1717987, -584652, -1471026, -2604898, -1319629, 358093, + 169114, -1224066, 62277, -3749507, -1428077, -265214, -1583769, -1729798, 183073, 31675, + -2241973, 284005, -1590212, 1859721, -177167, 33823, 485868, -2467459, 1826972, 753767, + 352187, -1176284, -382252, 1568737, 799938, 1412507, + }, + { + 398895, -50371912, 4351339, 35530652, 8644695, -2182917, 2714956, 3412889, 4051765, 9238475, + -22604412, -5197984, -5162551, 5028870, -3781719, -5731634, -219580, -3669513, 4454418, -12249784, + 3700114, 2586644, -25677462, -8829916, 16107201, 1578937, -1276142, 1908576, -10952703, 3087545, + 1451699, 1651952, 6993818, -4965519, 306016, 2507724, -4327717, 841277, -5055177, 1333587, + 6892349, -127238, 3375844, -1846299, 2399276, -2296197, 3857954, -317828, -1863479, 790811, + 688805, 136365, -4758287, 1417876, -1617055, 375273, 592706, -7109245, 72478, -786516, + -1122060, 237834, 171799, -93416, -941135, 1967632, 1338956, -334471, 1482301, 1638530, + -1826972, -833761, 1770600, -738198, 46708, -3118146, -1665911, -883690, 824097, 1396401, + -269509, 2622078, 117575, 790274, 443992, -207232, -1308354, -191663, 857383, 688269, + -1421097, 980326, -108985, 358093, -634045, -1442572, + }, + { + 1568737, 97345432, -13851806, -38049652, -11704323, -15569, 1778653, -10835666, 5322002, -3031173, + -2354716, 10647761, -13232257, 9705552, -898185, 2973728, -6304475, -1122597, -21660594, -7543573, + -15393700, 10615549, 341987, 9339406, 9007620, 1962800, 9303973, -2695629, 639413, -3726958, + 2518462, -2469606, -7058779, -11790759, -2617783, 5099200, -8852464, 408022, -4344897, -972273, + -173946, -105764, 5855651, -815507, 3957812, -577136, -5141076, -521302, 2938295, -2113124, + 2912525, 2651606, -3394098, -671626, 801011, 1675574, 5542656, -1474248, -2212982, -244276, + 1782948, -4373888, -1712081, -3389803, -416075, -192200, 1170916, -1421634, -1141388, 2051384, + -772557, -1189706, -1367947, -1782411, 1855426, 1057636, -735513, -2790655, 1218160, 367757, + 1574106, 1138703, 2609730, 0, -885300, -186294, 2148021, -388158, 492311, -1740536, + -340913, -908922, 11274, -1341104, -48318, 1611687, + }, + { + 5318780, 21294984, -2908230, 24933896, 16194711, -142808, -1119913, -5555540, 5359583, -10623602, + -436476, -3577171, -360240, -4006131, -6556805, -237297, 10067403, -1958505, 6516539, -928250, + -4416837, 1673964, 16700443, -3767223, 689342, -9963250, 10787347, 4887136, 14727980, -6762963, + 2408940, 8730595, -3306051, 6798933, 3084860, 5634460, -7124814, 1520955, -6474663, 1297617, + -1883343, 7269232, 4651450, -132607, -4793721, 2015413, -7808788, 3165928, 1682554, -713501, + 3589519, -1287953, 221728, -1829656, -5152350, -89121, 4058207, -478352, -3774740, 4298189, + -641561, -3065533, 3036542, 2821257, -2368138, -126702, 3865471, -354335, -2796561, 1432909, + -1006633, -2725694, 4056597, -171799, 796716, -1218160, 564251, 1264331, -1749125, -74088, + 685584, -31675, -2454574, -3012920, -1083942, -1437203, 558883, -835371, 1231045, -821949, + -724776, 373662, 1922535, 1209033, -529355, -1032940, + }, + { + -421444, 31644782, 2076080, 7392713, 571231, 1188095, -243739, 876710, 6556805, -435939, + 1864016, -5512054, 4799089, -10408316, 32890322, 27511414, 6949794, 5899675, -10787347, 1810329, + 3302293, 2691334, -4044249, -785979, 6157910, 15213848, -992674, 109522, 4479114, -11978664, + 4850092, 35433, 405338, -3947075, -14046154, -117575, 177704, -1757179, 1240709, -5428302, + -2019708, 2659659, -3290482, 7524783, 517007, -6837588, 2475512, 1256278, -2747705, 2621004, + 1028108, -3474629, -2000381, -4377646, -161598, -3124052, 5933498, -1326071, -427886, -1421097, + 111669, 967978, -2405182, -1187022, 848793, 3402688, 440234, -5037460, 2598992, -1087164, + -974421, 1452236, -2212982, -1796370, -1211181, -2297808, 338229, -974421, 79994, 1328219, + 1968169, -1489817, -130997, 380105, -1281511, -1589675, 433792, 811212, -1086090, 128849, + 806380, 18254, 1026497, -685584, -768799, -387084, + }, + { + 15926276, 51602420, -3301756, -41211820, 8722542, -4752382, -376347, -9687299, 17190070, 2457258, + 13626321, -5860483, 12317429, 13314399, 3207804, 1108102, -3855807, -7742216, -6186364, -4198868, + 13327284, 5506148, -5055714, 8139500, -7185481, -5068599, -5275831, 6968585, 3324842, 7747048, + -5158793, -6700149, 856309, -858993, -1903744, 5409512, -652298, -6102075, -3009698, -2188286, + 1651415, -514859, -816044, -11839077, 4660040, -5050345, 1513439, -1069447, 1114544, 1217086, + -1378685, 3502009, -821413, 2212445, -472983, 387621, 316754, 1155883, 3007551, -1799591, + -1618666, 4117263, -2944737, -1479616, 532576, 2139431, -2029372, -2375654, -1442572, -249645, + -357556, 1441498, 1233193, 2821257, -1186485, 1094143, -181999, 1175747, -893353, -1403917, + -1696512, -172336, -253940, 1821603, -835908, -1389959, -525597, 31675, -1325534, -861678, + 1019518, 469225, -277562, -163209, 1152662, 701153, + }, + { + -377957, 6656126, -570694, 91805, -534723, 1269163, -412854, -1899986, -2480344, 5179194, + 117038, -5881421, 128312, -5507222, -22090090, -4547297, 13220446, 14396730, -2314451, -8690329, + -10775536, -2207076, 9816148, 6285148, 21678310, -9965398, -12106439, 6315750, -2206540, 1492501, + 4808753, -8807367, -461172, 4791036, -2209761, 1311576, -426812, 6840809, -1763084, -3136937, + -191663, -12137578, -5427765, 4345970, 227633, -3889093, -3843459, -4833449, 3993783, -2276333, + 300648, 1225139, -1373316, 2249489, -2174327, 1245541, -645856, 8053, -1394254, 4545149, + 2760590, 996969, 2545842, 5019743, -1651415, -2346663, 3282966, 1879048, -2164664, -841277, + -217970, -565325, -672699, 1107028, 218506, -2032593, 956704, 883153, -329102, 901943, + 2758980, 912681, -1319092, 1035624, 93416, -721555, 1835562, 1019518, -110595, -2262374, + 1587527, 1063541, 1116155, 1064615, 194884, -1904281, + }, + { + -29520920, 172526144, -16822850, -67843304, -612570, -6914361, -3679176, 6975564, -12579959, 2711735, + -8429947, -8415988, 18662170, 10708427, 7861401, -11396159, 10066866, 2762738, 16483011, 19743964, + -643708, 7028714, 4495220, 399969, -7995619, 11785390, -11155104, 10470057, -5965710, -9832254, + 1247688, 920197, 4343286, 8963597, -1405528, -2172180, -2979097, 1888175, -4242891, 459562, + 408022, 1686848, 3610457, -3844533, 5048734, 6953015, 1114007, 3618510, 6769406, -4287988, + -427886, -247497, -6951942, 673236, 4310000, -1596117, -641561, 2324651, -1008780, 2763812, + 4222490, 2374580, 333934, 296353, -2292976, 1879585, 1033477, 2272575, -280784, -739271, + -26307, -362925, 2020245, 883153, -274341, -2424509, 927713, -2274185, -669478, 2710124, + -1907502, -703838, 1423245, -1009317, -1001801, 2592013, -1632625, -949725, 1822677, -410169, + -1015760, -1030255, 1742146, -206158, 316754, -872952, + }, + { + -1660005, -5536750, -3141232, -7601555, -1559610, -2469606, -1204202, 1952600, -5657009, 2226941, + 6211597, 1694365, -2158221, 8636642, 5944235, 9813463, -14955076, -6381248, 9368397, -664646, + -5612986, -2769180, 7068443, 7958038, -3039226, -7044283, 19133542, -6298033, 16243029, 3271155, + -5973226, -4893042, -10113037, 694174, 2111513, -10334228, 5807870, -1711008, -10573673, -3864934, + 2595771, -976568, -155693, -901943, 3955128, 3256659, 4625680, -1935957, -2545305, 1900523, + 4504884, 859530, 1507534, -2916820, -91268, 1766305, 2265059, -1065152, -1507534, 3924526, + -3128347, 1266479, 486405, 2400887, -989453, -115964, -242666, 2507724, -5906, 2595771, + 1288490, -898722, -2071785, 2562485, -397284, -2978023, -182536, -539018, -911070, -988916, + 714575, 1171452, -2106145, 659278, 2400887, -1752347, 258235, -157303, -556735, -122943, + 1316408, -2028835, -435402, -58519, -2858301, 591632, + }, + { + 19713364, 58990304, 32221918, -13069049, -5414343, 16208133, 29895120, 17799418, -17570174, -1387811, + -38118, 8681740, 11990475, -8321499, -13669807, -4556961, 11411728, 2044404, 7410429, -6131066, + -7952669, -614717, -4152160, -1427003, -1443109, 1939178, -3182034, 8316131, 2842732, 1198833, + 8251169, 12778065, -9841918, 2344515, -2312303, -517544, 6093485, 3437585, 3146601, 2921115, + -7170448, -945430, -4278861, 2223183, 5556614, 3038689, -2796561, -519154, -3551401, -1225676, + 6886980, 2946348, -2697240, -3559454, -4308389, 1343251, 2966212, -942208, 1789391, -82678, + -1241782, 399969, 3131031, -200253, 395137, 5722507, -2416993, -3118683, 3770981, -548682, + 230854, 1258962, -90194, -424665, -418222, -114890, -1626182, -2308545, -52613, -813896, + 1820529, 1423782, 2917894, 1242319, -753230, -846645, 2720325, -1467268, -74625, 536334, + 78920, 645856, -450972, -861141, 1394791, -1844689, + }, + { + 4272956, 1826972, -612033, -1063004, -3903052, -14203994, -2729452, -9089225, -5561446, 12307229, + -2868501, -19778862, 1758789, 1130113, 18000744, -2808372, -3022583, -12982612, -6328098, -1384053, + 10560251, -18323942, -5172215, -6522445, 490163, 12384538, 12629888, 3689377, 1919314, 8423505, + 6067178, 587337, -1013612, -2597382, 653372, -4502200, -2498597, 513249, -976031, 2051384, + -3516505, 479963, 2074469, -2662880, 3843459, -2017024, -2050310, 467078, 2464774, -3863860, + 1416802, 1480153, -3286724, 224949, -1279363, -1289564, 2695092, -940598, -1305133, 245350, + -2116882, -380105, -1634772, -1200980, -898185, 2205466, 908386, 3098282, -747861, 325881, + 952409, -1496259, -2785823, -301185, 1480690, -2064806, 163209, -1964411, 2379949, -1520418, + 158914, 1469416, -1160178, 1509144, -1057099, 106300, -682900, 982474, 1979443, 221191, + -105764, -2152316, -1344862, 1498944, -1371168, -743029, + }, + { + 27001386, -23561654, -8497056, 12603582, 37156300, 2367601, 13393319, -13517873, 9955197, 130460, + -11165841, -10355703, 7596724, 5139465, 16690780, 7738458, -3675418, -21801790, 6060736, -6639483, + 14820858, 8514773, 4898410, -8810589, 5000416, -1491964, 3709241, -3332895, -86436, -5801427, + -3139621, 6777459, -1931662, 7321846, 291521, -4569309, -4660577, -517007, 3610457, 2711198, + -686658, -2878702, 12171937, -7087233, -8344048, -7835094, 435939, -2306398, 3605088, -5280126, + 746251, 435402, 1208496, -2337536, 883690, 2087891, -868657, -3455301, 70867, 380641, + 3259880, -2294586, 1282585, -3191161, -1871532, -586263, 108985, 489626, -1422171, 1645509, + 211527, 856846, -476205, -306016, -755377, -462246, 2056216, -1979443, 4622459, 3700114, + 1136556, 175020, -1016834, 488553, 568546, -1182727, 684510, 849867, 1829119, 1094680, + -750546, -169651, 142271, -61740, -1312113, -1174137, + }, + { + 369367, 40541808, -5799280, -1153199, -5980742, 1942936, -4285841, -6754373, 670015, 1266479, + 1635846, -3088618, 1436667, 37143416, -21920976, 12386686, -3530463, 251792, -13879724, -6087043, + 3866008, 688269, 12385075, -5033702, 6726993, -4202626, 6855842, -1320703, 9465034, 13624173, + -15788837, 221728, -4722854, -2398739, 2338610, 2870649, 6657200, -8189429, 7460895, 1284195, + -4473746, -6015102, -239981, 4168266, 536871, -8211978, -4081830, 220654, -1937567, 5119601, + -621160, 9033927, -2569464, -2047626, 1216550, 5122286, 1361505, 1074279, -2717641, -2374043, + 323733, 5069135, 564251, -409633, 391379, 3717294, 3321084, -394600, -1100049, -5673115, + -2901787, 1468879, 294205, 3901978, 1433445, -898722, -1894081, 555661, -4216048, -801011, + -1422171, -1446330, -1067836, 811749, 2382096, 296353, 1461363, 3179350, 857920, -212601, + -1681480, 106837, 971736, -2766496, 1236951, 819802, + }, + { + 17496624, 51660404, -12904229, 5289789, 20058034, -31362924, 6268505, 4468914, 2243047, 1233193, + 21031918, 9259949, -3111167, -15018964, 10395431, -10577968, 22697828, 11752641, 18256832, -8007967, + -10642392, -2289755, -3352222, 11173357, -6918656, -10633802, 10370199, -9840307, -1749662, -13008382, + -3925063, -2441689, -1644436, 6672232, -10173167, 344134, -5509370, 5042829, 666794, 4046396, + 6479495, 1690607, -595390, -8472360, -3124589, -6601902, -10840497, 5272073, -1462973, 6732361, + -8194798, 2027761, 1650341, -290984, -4099010, -5447629, 2132988, 3694746, -3954054, -2827699, + -6979, 1681480, 3291556, -872415, 5140002, 1698660, 5920076, -3435437, 2946885, 1820529, + 265214, 1014149, 2603287, 678068, 2550674, -75162, 3469797, -1983738, -2277407, 37044, + -1552094, 639950, -433792, -188442, -719944, -884226, 269509, -1105954, 508954, 1158567, + 170725, 1311039, 353261, 1132798, 1515050, 343061, + }, + { + -761820, -39068096, 1888175, 20786032, -2838437, 132070, 1415729, -1423245, 6974490, -7182259, + 3440269, -454730, 534187, -14348949, -66022236, 4495220, 310311, 979253, 3915400, 834834, + -6103686, -5213017, 2832531, -12834436, 1449015, 4178466, 3549254, 4202626, -5554467, -3209951, + -6424734, -10044318, -3864397, -7978976, 4442607, 8453033, 8055211, 6149857, 1486059, -1955821, + 5450314, 1040993, -54761, 2527588, 2624225, -1583232, -1420560, 4031364, -1556389, 2724083, + 1400696, 3811247, 2952790, -1334124, -1482838, 2901787, 1138166, 1835562, 2647311, 4103841, + -3389803, 5289789, -72478, 723165, 76773, -8130373, 1658931, -660351, 587337, 1069447, + -1515587, 1139240, 642635, -333934, -338766, -2157684, 243203, -365609, -1064615, -4286914, + 2867428, 3413962, -1351841, -265214, 1168768, 1239635, 1084479, -313533, -39728, 2312840, + -492848, -2641942, 1062468, 2405182, -1775969, 706522, + }, + }, + { + { + 16249472, -134402944, -42671572, -33271502, -20793548, -1506460, 8770323, 3401614, -2864206, 8311299, + -9752797, 3587372, -1257889, 8520141, 2009508, -11514270, -11996381, -12722767, 11769284, 3686693, + 6241125, -3910031, 5632313, 7292855, 5206574, 2676838, -6100464, 3029026, 1694365, -6947647, + 7935489, 5227512, -4959614, 3840775, 5111011, -4668630, 5569499, -4420058, 5802501, -508954, + -2932926, 4121021, 2786360, 1535988, 4745939, -77846, -3180423, 5613523, 5784247, 7140383, + -959925, -1165010, 103079, 5637682, -903017, 1801202, 7313256, -1149441, 176631, 3036005, + -3228742, -5164698, 6003828, 897648, 2729452, -1266479, -30065, -174483, -241055, -1120450, + -2076617, -2520609, -1152125, -4974109, -459562, 2190970, -13959, -816044, 442919, 1759863, + -992674, 983011, -865973, 2135673, 350577, 1151588, 1334124, -1669132, 1241782, 703301, + 1003412, -871878, -210453, 1176284, -1199370, 49392, + }, + { + -742493, -49639620, 2505577, 14337675, -7592429, -4543539, -1827509, -6411313, -8631811, 283468, + -9212705, 4908611, -5167920, 22510460, 12623983, 8179765, 13934485, 6331856, 5763309, -5328981, + 10313290, 4184909, -18249852, -15202574, 15294915, 1313723, -14090714, -2485176, -11684459, 3096672, + -1819456, -3870839, 3021510, -1613297, 411243, -317828, -5314485, 858993, -339302, -375273, + 497679, -7032472, -2941516, -796180, 4738960, -5986111, 3537979, 1728724, -6084895, -1722282, + 250719, 628139, -1292248, 1087701, -5468030, 503585, 6296959, -3795141, 614717, -2341831, + -113280, 1933809, -416612, -3089155, -4585952, 2978023, 1238561, -3520263, -981400, 1734630, + -1222992, -680752, 2254858, 540629, -894427, -3868155, -2298344, -2235531, 765578, 695248, + -1911261, 2572149, -1283122, 957778, 1225139, 235149, -1017907, -613107, 15569, -931471, + -1932198, 470836, -32212, 202937, -558346, -67646, + }, + { + 634581, 120387936, 7793755, -5623723, 2185602, -3267396, 4303021, -7961796, 2873870, -6223945, + 595927, 12086038, -2762201, 7085086, 3391951, 13285944, -9684078, -3532074, -9214315, 7907572, + -11439645, 3443490, -3809636, 9103183, 4060355, -5661841, 5193689, -3288871, 3019362, 2487860, + 1156420, -1512902, -3038153, -2670396, 1329292, 2958159, -4975183, 10426033, 3538516, 3307125, + -6008659, -7160784, 8212515, -1720134, 536871, 4270808, 3689377, 1010391, -310848, -1268626, + 7288560, -573378, -4148402, 1417876, 512175, -662499, 3575560, -1238561, -1743220, -3082713, + 1369558, -2830920, -1654099, -3849901, 2066953, -395674, -972810, 448824, 32749, 969589, + 114890, -1738925, -1581622, -838592, 2705293, 1573032, 482110, -1403381, 1764158, -1473174, + 1160178, 346819, 1333587, 415001, -431107, -940598, 1293859, -423591, 867047, -893353, + 1371168, 299037, 799401, -205085, 1359894, 2150705, + }, + { + -19335942, -9638443, 12137041, 20390358, -1625645, -5126581, -393526, -1123134, 11478837, -9889699, + -4105452, -441845, 2448668, -8178692, -5327907, 6604586, 8589398, -10649908, 11745125, 5706938, + -1305670, 8080444, 20111722, -9400073, 1958505, -9896678, 6873559, 876710, 2838437, -12863964, + -1367410, 5334350, -5519570, 5368709, 4073777, 9252970, -8234526, -1233729, -3882114, 1094680, + -8451959, 900333, 2556043, -345208, -7982734, -2492155, -4133906, 1167157, -4483946, -485331, + 10656351, 660351, -907849, -1445257, -2181844, -609349, 657667, -3506841, -2368138, 7139310, + -646393, -1995012, 2818036, 4771709, -1210644, -1717450, 2233920, -1149441, -1238561, 2617246, + -743029, -3921842, 2257542, -2700461, 244813, -612033, 879395, 1398012, -1036698, 762357, + 1294396, 687195, 814433, -824634, -754304, -694711, 2180770, 1038308, 2239826, -1023276, + -677531, 305480, 897111, 478889, 26307, 393526, + }, + { + 1083406, 27699318, 471373, 8534637, -1181653, 1175210, 2109366, 447750, 1962263, -2615098, + 6147709, -2649458, 4903779, -1956895, 18233210, 6892349, -2754685, -10388452, -7729868, 9918153, + 4383551, -1096290, 4519916, 14379551, 15080704, 16525424, -11065446, -14896557, -4568235, -7689065, + 19394462, 22049826, 12404939, -4872641, -7836705, 805306, 1348620, 2557653, 7480760, 1422171, + 236760, 1541356, -7033546, 1092532, -468688, -4798016, -1521492, 1222455, -1592896, 1973001, + -1716913, -6173479, 159988, 1611, 3031173, -1187559, 2662343, -4459250, -4288525, -481573, + 1462973, -3139621, -1251446, 388158, 1141388, 6081674, 841814, -7903277, -223875, -2296197, + 784368, 1996623, -3290482, 471373, 2056753, -3772592, 553514, 811749, -1910187, -75699, + 1497870, -3740380, -470836, 438087, -1451162, -253940, 810675, 136902, -1033477, -453656, + -1030792, -1040993, 90194, -547071, -273804, -1443646, + }, + { + -37085968, -3175592, 26751204, -49744848, -5713917, 381178, 3424163, 758062, 19264002, -18629958, + -12644384, -10681584, 10582799, 6469832, 5913096, 1042066, 4372814, 551366, -6529424, -6455336, + 12527883, 3568581, -8284992, 13803488, 337692, -5063230, -710817, 13127031, 3751654, 3027952, + -8577587, -7648800, 470836, -154082, -2962991, 7205345, 801548, -2681670, 5364414, 688805, + -1675574, -5217312, 720481, -9205726, 8171176, 1372779, 4813048, -1410897, -948651, 4630512, + 1344862, 4310537, -1165547, -693637, -2689187, 2294050, -102542, -556198, 543850, -1575716, + -3024194, 1446867, -2433099, -1007170, -1199907, 217433, -899796, -121870, -1242319, -1336809, + 1226213, 3098819, -1845762, 95563, -818728, 2579128, -457951, -376883, -1760937, -674310, + -1065689, 496069, 27380, 1345935, -1142461, -1438277, 9664, -236223, -1577327, -1204738, + 683974, 324270, -462246, -329639, 574452, -64425, + }, + { + -608275, 10902238, -3114388, -1108102, -2225330, 437013, 338766, -2323577, -4221953, 1062468, + -4439923, -1677185, -46708, 4671314, -16626355, -3988951, 7506529, 2445447, -9139690, -19271518, + -9068823, 2660732, 4190814, -7638600, 15633144, -16717086, -18333604, 10743324, 4198868, 3293166, + 11108933, -6312528, 3776887, 6075231, -4214974, 3198677, 3554086, 4799089, -4491999, 3614215, + 2990908, -5092758, 1839857, 4953171, 1074, -1436130, -504659, 389768, 7070053, -4108136, + -39192, 807991, -2530273, 5314485, 781684, 2245194, -4145180, -3234647, 691490, 3062312, + -655519, -2206540, -1619740, 2479807, -1923609, -3077881, 2535641, 915365, -2372970, 561030, + -764504, -1604707, -853625, -707059, 831076, 314606, -38118, 81068, -34360, -499827, + 435402, 535260, 456877, 1042603, -657667, -712965, 818728, 37581, 239981, -1768453, + 650688, -163746, 961536, 583042, -37581, -1360431, + }, + { + 14976014, 281923264, 21198348, -61312804, 3754875, -18498424, -16544751, 10606422, -9171366, -2318746, + -10026601, -4465692, 10733660, 3813931, 12820477, -12083354, 6553583, -1261647, 3656091, 9573482, + -12599287, 4013110, 5969468, 2042794, -8953933, 5364951, -13979045, 11010686, 3438658, -3187403, + -6216965, -1959042, 733903, 4506495, -6046777, -5592585, 906238, -1959042, -4255239, 3176128, + -703301, 7000260, 5124970, -1385664, 998580, 3030100, 2177012, 346282, 3795677, -2960306, + -1358820, 1610076, -3512210, 3596498, 6866042, -574989, 362388, 4835597, -3791919, -1629940, + 2299955, -258235, -855772, -623307, -3439195, 3582540, 623844, 139050, 877247, 2188823, + 381715, -1562831, 2276333, -40802, -2391223, -100932, 4891431, -1482301, 56908, 1310502, + -1997160, 520765, 1163399, -905701, 276489, 2858838, -549756, 111669, 832150, -1535988, + -741956, -768262, 1816234, -941672, 1039382, -1190243, + }, + { + 235686, 6306086, -2129767, -3323231, 3268470, 215285, 268435, 4363687, -1561758, -1597191, + -1024350, 2782065, 112206, -1106491, -5801427, 16695075, -933619, 3685082, -4267050, -16916802, + 2094333, 7296076, 4729296, 10850698, -3558381, -9814537, 14923938, 1022739, 12310987, -6218576, + 588947, 89121, -11913166, -5306969, 210990, -8686034, 169651, 1562294, -6075768, -4252018, + 2053531, -5383205, 2647847, 1675037, -2879776, -3856881, 3376381, 1239635, -2741263, -446677, + 6194417, 1316944, 4346507, 353798, 1884417, 1636383, 3304441, 855235, -457414, 2157147, + -2645700, 4333622, 2591476, 3428995, 3008625, 1056562, -1184874, 2229625, -1072131, 2155000, + -102542, -2067490, -1820529, 2463701, -868120, -1555852, 1342714, 1291711, -933082, -308701, + 1781338, 1707786, -2070711, 431644, 2591476, -1139777, 334471, -1257352, -555661, 415538, + 2148021, 168041, 333934, -207769, -1424319, 1364189, + }, + { + -24207510, 23035520, 38223060, -13353590, 1102733, -4734665, 993748, -2524367, -8170102, 13988172, + 6904160, 7348152, -1865090, 5819681, -3546032, -17569638, 8893267, 3689914, 7053947, 331249, + 7875360, 14031121, 3934190, 2495376, 1500017, 6081674, 688805, -1865626, -3077881, 1036698, + -2586107, -1294933, -7098507, 3445638, -5219996, 737661, 1211181, -1665911, 1867237, 5891622, + 1772748, 10703059, 248034, 2269890, 786516, -3497714, -5481452, 3403225, 702764, -1797981, + 2701535, 1029182, -3369939, -969589, -1534914, 1074, -988379, -944893, 4449049, 1206349, + -2430952, -1780801, 600222, 353798, 550830, 4443144, -2282238, -3533148, 3677566, -3573950, + -6105296, -1057636, -802085, -1118302, 1805497, 1184874, 445603, -1606855, -459025, -450435, + 1209570, 1705102, 3045132, 921271, -941135, -1494649, 3073049, -112206, -491237, -754841, + -682363, -911607, 533650, 724776, 1748589, -794032, + }, + { + -4021163, 9318468, 17048872, 2770254, -3815542, -8587787, 15032, -9277129, -9339406, 1503239, + -10606959, -14578193, -2614561, -620086, 23564874, -7195681, 4466766, -6135898, -4974646, -1437740, + 12598213, -8606578, 6589017, -3118146, -6412386, -2063732, -2844342, -4600447, -1533840, 1083942, + 4882841, -1552631, -339302, -2042257, -1417339, -1744294, 936303, -1277216, -5487895, -552977, + -90731, 1250372, 113817, -2635499, 6245420, 2227478, -2241973, -5473399, 2641942, 4020626, + 284542, -3043521, -3631932, 836982, -675921, -3199214, 1895691, -2439542, 574452, 2804077, + -2866354, -148713, -597537, 1336809, -418759, -1162326, -345208, 2308545, -1541356, -363998, + -459562, -2970507, -2939905, 8053, 911070, -1166084, 724239, -1640141, 3307662, -84826, + -22549, 437550, -2661806, 1398549, -342524, 920197, -1497333, -1102733, -420907, -231928, + 1171452, -769873, -1096290, 1728188, -789737, -731755, + }, + { + -18009872, -86291800, -6187438, 9612674, 35537096, -11175505, -1783485, -10249939, 13727252, 16193637, + -5522791, -12617003, 15835544, 7472170, 7289633, 3082176, 15012521, -10553272, 51003, -10239202, + 8406325, -3635153, -763967, -14561013, 1320703, -937914, 5115843, 1433445, 7259032, 466541, + 3956739, 13673565, -427349, 4071092, -2409477, -9762998, -8972724, 2885144, -3316252, -6950331, + -5372467, -4746476, 7467338, -8156143, -6565932, -5039071, 2948495, -4770098, 488553, -6590091, + 3442953, -675921, -1246614, -731218, -4380330, -299574, 2479270, -4852776, -862752, 2279554, + 4953708, -3192235, 257161, -4342212, -2566243, 1319629, -177167, -387084, -317828, 1260036, + -492311, 1278827, 318364, 644782, 1944010, 413927, 1518271, -4006131, 912144, 739271, + -1614371, -1867774, -856309, 1738925, -147103, -2111513, 1272921, 381178, 1118302, 664109, + -402116, -691490, -894964, 1512365, 347355, -816581, + }, + { + 477815, 40863928, -107911, 9925133, -7327751, -9084393, -5891085, -3297461, 756451, 7288023, + 7448547, 2427194, -13605920, 14792941, -17041894, 20251308, 537408, -1203128, -16160888, -4596152, + 9256728, -11792370, 2690260, -5161477, -8950712, -4821101, 15220290, -4359392, -12011413, 6461779, + -20528334, 8842801, 35970, -7094212, 1675574, -7294465, 2731062, -9826885, 3344169, -463856, + -4012036, 204548, 4400731, 551366, 4582730, -2236604, -858993, 2520072, 1409286, 4903242, + -3898220, 3312494, -4852776, -124017, 3510062, 7422241, 2422899, 3701188, 1957431, -2134062, + -53150, 6704444, -749472, -570694, 1052804, 2603824, 2399276, 1350767, 408559, -4201015, + -1581085, -135828, -2333241, 842887, -1134408, -2985539, -1102733, 1549946, -2380486, 1984275, + -564788, -2486249, -2146947, -1117228, 1099512, -179315, 171262, 1625108, 483721, 591632, + -1694902, -634045, -367220, -2666101, 1319092, 672699, + }, + { + -23490250, 6266894, 2109903, -8274792, 5084705, -16029892, 15811385, -10472204, 6534256, 7429757, + 6218039, 355409, -2602213, 8752606, 32084480, -16360067, 13501230, 678068, 11709155, -16069620, + -14100915, -2319819, -6964290, 15744276, 1251983, -7045894, 14754286, -7060926, -1191853, -8281771, + -258235, -7718593, -174483, 12542915, 282931, 8591545, -10551124, -4535486, -4117263, 895501, + 1418413, -5279589, -2631204, -6894497, -967441, 1637456, -3020973, 5878200, -2502892, 12242267, + -5702643, 1090922, -1971927, -1538672, -3928821, -3039763, 2700998, 2313377, -5864778, -2942053, + -1212791, 1447404, 3438121, -2990908, 1566053, -1193464, 4680978, -4078072, 2787434, 1639067, + -41339, -375810, 78383, 2410551, 4364224, -738198, 1234266, -3605625, -3306588, -1011465, + -525060, 1444183, -1217086, 1606855, 764504, -187905, -164819, -1034013, -117038, 102005, + -823560, 992674, -468688, -966368, 1432372, 1376000, + }, + { + 635118, -53541600, -13065291, 10757282, -235149, 372052, -6870874, -1023813, 5964099, -8774081, + 696322, 11097659, 7633231, 43961136, -2016487, 289910, -4671851, 2466922, 15648713, -104690, + -9882183, 1400159, 9990094, -5608691, 143881, -1761474, -8461622, -13051869, -20360830, -2785286, + 8078297, 881005, 2838437, -2936684, 461172, -5663988, -4621922, -4006668, -3861713, -8370892, + -1944010, 3724811, 1448478, -3083250, -5521181, -1896765, 4044249, -4367982, -5900748, 7043210, + -3881040, -2958696, 784905, -2890513, -2965138, 4730907, 1681480, 2163590, 3253438, 2809446, + -5385352, 3978214, -1458678, 1483911, 6099928, -3858491, 2145336, 853088, 69256, 1865626, + -558346, 2465311, -136365, -1239098, 1234803, -730681, 2783676, 2707977, 2492155, -5165235, + -1060857, 936303, -3459059, -1282048, 1188095, 841277, -1374390, -485331, 796180, 2367064, + -608812, -2443837, -108448, 1951526, -1343788, 1052267, + }, + }, + { + { + -17692580, -206925088, 32919850, -45740328, -11418171, 320512, -2026688, 15496242, -9665824, -9490804, + 9565966, 5631239, 1747515, 9643812, -7803956, -3632469, -6476274, -10691247, 3304441, 5489505, + -659814, -1630477, 9275519, 5454072, 10946798, 2462627, -7133404, 1053878, -77309, -4651450, + 3765613, -1065689, 9804873, -1765768, 4468377, -7039452, 2379412, -4618164, 7960185, 455803, + 2334852, 2900714, 2050310, 328565, 4403415, -3440269, 1660542, 3001109, 4560182, 2909840, + 6117644, -5486821, 1199370, 4172561, -1973001, 2775086, 5515812, 1840394, -1052804, 4152160, + -3089692, -2330557, 3777961, 2854543, -1782411, 1541356, -408022, 1242319, -1322850, -1891396, + 1074, -3549791, -2362769, -1943473, 153545, 440234, -1072668, 296890, -919660, 1554241, + -100395, 2509872, -527744, 2078764, 283468, -61203, 628139, -360777, -528818, 1986959, + 2144263, -819802, -43487, 156766, -510027, -847182, + }, + { + 680215, -21925808, -16470126, -3693672, 3083250, -2617246, -1660005, -6003291, -6178311, -11220602, + -8580808, 13554380, 550830, 5966784, 22297860, 20668456, -3823058, 20895552, 3580929, -11202885, + 10977400, 1096290, -4592931, -12448963, -6060736, 17024176, -9762998, -12310450, -15766288, 4109210, + 4486094, -5433134, 4781909, -1902134, 1271310, -57445, -4413616, -5360119, 2587181, 751082, + -5203890, -7888781, -1349157, 845035, 2376191, 4203163, -2194192, 2714956, -7655779, -2165201, + 1555315, -477278, 2659659, -1615982, -2209224, -3521336, 4716948, 3758, 600222, -4556961, + 2312840, 1191853, 157303, -3843996, -4312684, 4581120, -2119030, -2588255, -528818, 683437, + -548682, 1717987, -680215, 2679523, -3181497, -1079647, -3054796, -1303523, 1004486, -289373, + -663572, 770410, -573378, 1335735, -116501, -521302, 879395, -887448, -983548, -1460826, + 561567, -1214939, 308701, -449361, -2684, 1108638, + }, + { + -2831457, 116383952, 13092671, 14573361, -14215268, -2259690, 3026341, 2893734, -819265, -12826383, + -7131793, 25279104, 5352066, -12676596, 10368051, 11079942, 40265, -14966887, 3425773, 8077223, + -4725001, -4844723, -652298, -35970, 10209674, -6540162, -268972, 1653562, -1434519, 7127498, + 3102040, -7542500, 4187593, 1242319, -782758, -2994129, 3250753, 7696582, 7947300, 799938, + -3813931, -6436009, 2955474, -1741072, -4394826, 5666673, 4413079, 6227166, -1411434, 3510062, + 3738232, -918049, -114354, -2864206, 1764695, 1862942, 3114925, -374199, -3080565, -6012954, + 1765768, -739808, -799938, -1562294, -2498597, -340376, -1323924, 119722, 996432, -568009, + 1969243, -2206540, -1875290, 8590, 2080912, 1538135, -614717, 906238, 1390496, -857383, + 636729, 663036, 671089, 1272384, -1032940, -237297, -27917, 512712, 972273, -799401, + 1832340, 858457, -884226, 226560, 1601486, 1165547, + }, + { + 30003030, -65086472, -11195906, 14396730, 15551540, -5099737, -2200634, 3320010, -1076963, 4082367, + -1866163, -2234994, -763430, -9482214, -247497, 6007049, -8418673, 7465190, 13606456, -2014877, + -1838783, 9875204, 8924942, -6229313, -154082, 5827197, -5123896, 661425, -1646046, 1212791, + -11345693, 3211562, 638876, 4861903, 816044, 10026601, -5004711, -2840584, -2857227, 443455, + 1874753, -4768488, 2938831, -1896765, -7058242, -7397008, 3012920, -4403415, -2976949, 1447404, + 6937983, 3384971, -4581657, 260919, 272730, -1438814, -18254, -2964601, -1551020, 5178120, + 695248, 486942, 316754, 2197413, -646393, -1069447, 8053, 3183108, -1268626, 560493, + -143345, -1320166, 830002, -2835215, 43487, 1176821, 55835, -1501091, 201327, 1666447, + 908386, 380641, 2203318, -447213, -759136, -353798, 799401, 1646583, 1568737, -653372, + -389768, 1057636, 443992, -196495, 664109, 415538, + }, + { + -1758252, 17311940, 10597832, 6629819, -281320, 329102, 1722282, 3710852, -2922725, 734976, + -49392, 668941, 4730907, 11339787, 12662100, 3882114, -15046881, -40876816, 49386220, -5621039, + 3174518, -3851512, 8326331, 12075837, 2889439, 16113107, -2037962, -19450296, -9309878, 7317551, + 10088878, 21343840, 13612362, -1439888, -588411, -9022116, 8071318, 2135136, 1976222, 6941204, + 929324, -2020782, -3413425, -675384, -7838852, 3578245, -3234110, -1234803, 3515968, 624918, + -2656974, -2914135, -4248260, 2675765, 1387811, 702227, -3886946, 47245, -4635881, -259846, + 1614371, -2820720, 2472828, -1820529, 296353, 5127117, 112743, -3797288, -4650913, 198105, + 926639, 441308, -718870, 1245004, 1854352, -4697084, 1870995, -102542, -1317481, -318901, + 1114007, -1528472, 637266, -1968169, -991064, 142271, 750009, 694174, -910533, -445603, + -2290291, -836445, -329102, -291521, -896038, -159988, + }, + { + 51679192, -91778080, -15012521, -45780056, 6099391, -518617, -695248, 12016782, 15976741, -23019414, + -9361418, -10017474, 20411832, -2139431, 3205656, 11410117, -3933653, 3198140, 2583423, -11906186, + 4369593, 6853694, -1487132, 243739, 7436736, 185220, -75162, 12012487, -377420, 3349538, + -5046050, -10733123, -3994857, 5300527, -5500780, 7109782, 2572149, 2115272, 3853123, -5991480, + -4839892, 1022739, -779000, -4092567, 3306588, 3721052, 4635344, 134755, -3780645, 4795868, + 554051, 3449396, 2164127, -2684355, -3926137, 4326106, -1163936, -1032940, -1584843, 1179505, + -3457986, -714038, -4832, -2100239, 64425, -1224066, 97174, 543313, -1788854, -1450625, + 2318746, 1388348, 695248, -2485712, 911070, 220117, -347355, 639413, -1549410, -888521, + -908386, 1105954, 430034, 103079, -116501, -1797981, 421444, -1265942, 409633, -1166084, + 215822, -539555, 346282, -141734, 147103, -236760, + }, + { + 923955, 4648229, -820339, 93952, -2256469, -1013075, -547071, -1071058, -2172180, -2600603, + -3311957, -721018, 1319629, -12724377, 3943317, 7352447, -7849590, 2858301, -5440113, -20282446, + -396211, -4473209, 13396003, -5925981, -833761, -3627637, -14118631, -1800665, 275415, 1198296, + 16590385, -1567126, 4083977, 6010270, -3637837, 1743757, 4960151, 2134062, -7282654, 4149475, + 2228551, 748935, 1948841, 3297461, -3270081, -260382, 3312494, -1771137, 4647692, -1686312, + -1093069, 2243047, 746251, 751082, 1682554, 1711008, -3349001, -597000, -568546, -1767379, + -225486, 670015, -3083250, -523449, 40802, -1794760, 49929, 1793149, -1774895, 1134408, + -662499, -2376728, 134755, -2015950, 1589138, 1241782, -1615445, 35433, 937914, -591632, + -239981, -1407676, 1488206, 1184874, -600759, 194884, 1147830, -250182, -308701, -36507, + -531502, -601832, 370441, 446140, -662499, -224949, + }, + { + 9676024, 340333760, -14088566, -59960964, -2997350, -6263136, -19224274, -5865315, -4803921, 6126771, + -10706280, 9492951, 8674223, -8672613, 7403987, 2794413, -6344741, 16454557, -10996727, 1416266, + 3117073, -9992778, 5422396, -4047470, -1017907, 1028645, -1405528, 3803194, 2320356, 4170950, + -7247221, 295279, 546535, -64425, -163746, -1327145, 4016331, -9296994, -7159174, 6091874, + -3542811, 10652593, -1311039, 6871948, -5868536, 10066866, 3546569, -1171989, -232465, 964757, + -2922725, 3777961, 4124779, -2126009, 3718368, -745714, 604517, 6634651, -5407364, -1179505, + 2520609, -1976759, -1108102, -673773, 1969779, 1031329, 1380295, -2474975, 254477, 3422015, + 428960, -629750, 1814624, -2942053, -744103, 1378685, 2010045, 1385127, 507880, -1399623, + -422517, 2094333, 304943, -692027, 457951, 318901, 1073742, 746787, -1007170, -357556, + -471373, -471373, 1006633, -711354, 752693, -282931, + }, + { + 1344862, -2071248, 712428, 4077535, -1245541, 1429687, 1947768, -2023467, 2055679, 3816079, + -5759015, 1706176, 74625, -1335198, -741956, -3475702, 7609072, 8104067, -736587, -16832514, + 5160940, -392990, -4314832, 18061412, -8687108, 8508330, -1020055, 8843875, 3601867, -6059662, + 11926587, -11404749, -11207180, -1835562, -2579128, -2189897, -920197, -8025684, 6504728, -3950833, + -4713190, 278099, -1909113, 2581812, -5895917, -533650, -393526, 621160, 74625, 3459596, + 1050656, -1765768, 1642288, 5042292, 5992016, -2234457, 4515621, -1407139, 4025995, -3097208, + 3388192, 1981591, 2064269, 2114735, 3824132, 2469069, -2146947, -135291, -176094, 2476586, + 516470, -2092723, -930934, 1468879, -1750736, 1756642, 16643, 875636, -404264, -448824, + 2129767, 373125, -1249299, 1363652, 870805, -944356, -277562, -270583, -258235, 662499, + 993211, 2021319, -920734, -639950, 615791, 296353, + }, + { + 27893666, 9901510, -12355010, -15246060, -3383361, 20134270, -23162222, -17951352, -999117, 8984535, + 10124849, 1255741, 3282429, 11354283, -5308580, -724776, -2721399, 5796059, -188442, 7736847, + 6628209, 15340549, 7095286, -1339493, 5906654, 5043902, 6189585, -13401909, 615254, 4663798, + -12470974, -2880849, -385473, -7470559, -76236, 6068252, -6550362, -3212099, 3113851, 3218541, + 7322919, 9874130, 1776506, 3705483, -5373004, -1477469, -3275450, 2961917, -234076, 2071785, + -313533, -1982127, -914291, 2552821, -3071975, 2466385, -5189394, 1949915, 2752537, -1694902, + 194347, 226023, -1023276, -395137, 1417339, 3854733, -2764348, -1078574, 198642, -3703336, + -2653216, -4273493, 344134, -1531693, 2027225, 1655173, -427349, 476741, -1568200, 1713155, + 113280, 1670742, 2954401, 194884, -2434710, -266825, 2462090, 431107, -306553, -1596117, + 137439, -1350230, 1370632, 519154, 547071, 464393, + }, + { + 2768107, 28269474, -11360725, 9171366, -15050639, -4155918, -3295851, 1008780, -8811662, -7816841, + -13055090, -9705552, -12399571, 16680579, 4218195, -9622337, 16922708, -14694157, 9272298, 10649371, + -1378148, -7373385, 15269682, -10810433, -1012002, -7633768, -6306086, -5995238, 1424855, 2634963, + -865436, 4883378, -978716, -3950833, -1576253, 2332167, -818728, -1231582, -5970542, -5549635, + 1195075, -144955, -639950, 5175973, -2334315, 2688113, 351114, -4589173, 2080912, 3784403, + 318901, -3439195, -2545305, 499290, -2433636, -2217814, 2239289, -3077344, 3149285, 1949915, + -3479997, 941135, -943282, -1123134, -464930, -47782, -948114, 828392, 1252520, -1735167, + 825171, -2955474, -1859721, -1207423, 372052, 433255, 13959, -48318, 1957968, 2065879, + -1061931, -415538, -1545115, 664646, 785979, -1056025, -491237, -163209, -663572, -462246, + 584652, -184147, -319975, 818728, -817118, 559420, + }, + { + -5958731, -114272976, 1268089, 18770618, 11177116, 18241262, -26461830, -2754685, 15844671, 5589363, + 10351945, -16762720, 20071456, 1701881, 7719667, -3838090, 3667365, 14262513, -14732812, -6789807, + 4483946, -6644852, -3206730, -8589398, -1642288, 6544457, -3140158, 8726300, 5177583, -3354370, + 5650567, 11756399, 5772436, -2872796, -2123325, -142271, -13094282, 7743289, -14960445, -6775848, + -3634616, -2670396, -8047695, 5067525, -9410810, 245887, 2797098, -6884296, -6646462, 3246995, + 2019708, -1302449, -5629629, 7023882, -7882339, 879931, 168577, -3919158, 362388, 590558, + 2877628, -1879585, 175020, -5850283, -629213, 1082869, -1604707, 67646, 1837172, 2281165, + -938987, -432718, 1577327, 719944, 1428614, 1145146, -69793, -1589675, -1331977, -318364, + -1107028, -2178085, -716186, 1806034, 11811, -1313723, 610422, -116501, 1074279, -881542, + -3758, 448287, -1459752, 1889249, 609349, 106300, + }, + { + -1916092, 39021388, 6309307, 7858180, -7107634, -6480032, -4048544, -3626026, -165893, 7113540, + 1156957, 10481331, 583579, 513249, -32851668, 27756764, 4531728, -7089381, -12221329, -6062347, + 22972706, -9966472, -14174466, 8919036, -30491584, 4105989, 23388782, -7538742, -21617644, 198642, + -5301601, 2588255, 2201708, -5173825, -77309, -8664023, -5974300, 2544768, -5061082, -3005403, + -167504, 4904316, 7372312, -5449240, 671089, 3781182, -92879, -1501091, 4209605, 1460826, + 2210298, -3532611, -3297998, 2427194, 1371705, 4254702, 3493419, 2278480, 2339147, 756988, + 552977, 1809255, -227633, 491237, 2864743, 416075, 2920578, -1502702, -977642, 472983, + -1420560, -1003412, -1962263, -1788854, -1857573, -2968359, 2091649, -902480, 139586, 1241246, + 354872, -3216931, -838056, -2731062, 613643, 728534, -1054951, 2374043, 601832, -761820, + 163209, -319438, -2683281, 177167, -1364189, 1453846, + }, + { + 17675938, -58137216, 16204375, -8858907, -4533875, 11468636, -7528004, -9554692, -4126390, 18014704, + -8215199, -2582349, 8331163, 7668664, 29197724, 51540, 7172059, -7503308, 5811091, -4400731, + -12339441, -6418829, -6524056, 10254234, 1334661, -1449015, 9248138, -7286949, -230318, -4300336, + -2319282, -6891812, 4389457, 4495220, 8798241, 5187247, -6628745, -12918188, 4936528, -8485245, + 5496485, -3026878, -4772783, -1344862, -5669894, -485331, 380641, 6919729, 1582696, 102005, + 2131915, 2869038, -8844411, 1300838, -4861366, 2845953, -1209033, 325881, -3807489, -4719632, + 554588, 2711735, -2063195, 990527, -708670, 1360968, -92879, -998043, -1346472, 1946157, + 1826972, 371515, -970663, 2479807, 1984275, 782758, -2740189, -767189, -2052994, -1429687, + -465467, 1804423, -287226, 1101659, -62814, 1051193, -2731599, 797790, 208306, -889058, + -96100, 805306, -105764, -1683090, 1198296, 1166084, + }, + { + -659814, -62466540, -5071820, 6435472, 34897, -1324997, -8792872, 4088809, -7599945, 7316477, + -8198019, 16245714, 1949915, 1258425, 58140436, 15911243, -5500243, -10489384, 3667365, 14327474, + -6796249, -7382512, 13047574, -9170292, 6726456, -2241436, -9146670, -19206020, -18109730, -7332046, + 9210557, -875636, 9921374, -6981470, -951335, -3757560, -11581379, -2901251, -4017942, 1485522, + -6681359, -7129109, 7606924, -1132261, -9924059, -2078764, 4459787, -3283503, -2733747, 6481643, + -5709086, -3607773, -145492, 84289, -4438849, 2497524, 1836099, 2141578, -689879, 1407676, + 1942936, 1697049, -1945620, 2399813, 3890704, 2842195, -2790655, 143345, -1291175, 3755949, + 857920, -1795296, 2950643, -2973191, 1321776, 1446867, 1088774, 1749662, 570694, -1652489, + -118112, -2882460, -958851, -1035087, 1469416, -559420, -572304, -32749, 33823, 1318018, + 362388, -541166, -1213865, -348966, -425202, 1215476, + }, + }, + { + { + 18675054, -221013104, -25792890, -38145752, -2182917, -5805185, -3124052, 9785009, -18712098, -13724568, + 1191853, 7927973, -2439005, 4224637, -5386963, 1771674, 6018323, -469225, 3871376, -938987, + -12177843, -4718022, 4866198, 1894081, 9751723, -224949, -2782065, 6203544, -1460289, -5004711, + -939524, -5104569, 6039798, -10030896, -529892, -1316408, 2106682, -3266860, 6882148, -1219771, + 2536715, 2897492, -334471, -5352603, 441308, -4105452, 5386426, -38118, 2994129, -3911642, + 372052, -8178155, -4087735, -1134945, -1716913, 2200634, 2028835, 299037, 51003, 5560372, + -561567, -332323, -297427, 508954, -2229625, 3498788, 959388, 2071785, -1766842, -2471217, + 656056, -1312113, -145492, 2092186, 1533840, 464930, -2598455, -1125818, 287763, 1721745, + -706522, 1920387, -475131, 1390496, -388695, -772557, 315680, 446140, 738198, 2319282, + 1531693, -1028108, -261993, -457414, 232465, -229781, + }, + { + -694174, 21036750, 18170396, -12390981, -645856, 1338956, 1326071, 1967095, 3636764, 283468, + -1467805, 8026757, -2552821, -12999255, 6024766, 6251862, -26390426, 20681878, -2629057, -19720880, + 11256572, -2146947, 103616, 475131, -7822746, 16372415, 3690451, -645856, -3258807, 5856725, + 5136781, -2693481, -839129, -5834713, 441308, 373125, -628676, -5419175, -4451197, 2012729, + -1598802, -6138045, -628139, 410169, 418759, 2906619, -2934000, 6059662, 287763, 2537789, + -2600066, -1527398, 6256694, -746251, 1166621, -1430761, 540092, -860067, 1045288, -1519345, + 2682744, -638340, 3838090, 3105261, 1054951, 3435437, -5292474, -3261491, 369904, 1436130, + 1381906, 3663607, -485331, 1235877, -2578054, 324270, -780073, 845035, 1423245, -507880, + -899259, -11274, -662499, -204011, -738198, 138513, 1607928, -1167157, -1014686, -268972, + 2096481, -1171989, 379568, 223875, 30065, 1636383, + }, + { + 4133369, 72959144, -30057792, 18019536, 4332549, 4287988, 124554, 9475235, 8948564, 4684199, + -8419210, 13319767, -12557411, -26976152, 8641474, 10551661, 6056441, -6025839, 2927020, 5097590, + -3782256, 82678, 12216498, 5608154, 9807021, -1984812, 8732742, 5452998, -7622493, 530428, + 3373160, -2586107, 13195750, -1854352, -6810745, -4118874, 6350109, 2960306, -4153770, 1316408, + 1400159, -4780299, 2017024, 5175973, 4881767, 8403104, 1860795, 8106751, -1592896, 275952, + 2514167, -1538672, -1129040, -311385, 5348308, 638876, -322123, -1733556, -1384590, -5115843, + 206158, -1898376, -1346472, -1157494, -3094524, -399969, -3365644, -2827162, 497679, 856309, + 3208878, -86436, -2095407, -2365990, -442382, 1454920, -571768, 814970, 1502165, -104153, + 590558, 497679, -332323, 1117228, 3221, 870268, -801548, 698469, 2117419, -271657, + 201327, -74625, -1491427, -811749, 483721, -136365, + }, + { + -31609348, -143212464, 7333120, 3861176, -8851928, -1521492, -1649804, -4000225, -5223754, 16268262, + 11922829, 7581691, -1682554, -2443837, 2114198, 1772211, -7835094, 18070002, 5854578, -10700374, + -2135136, 6514929, 3314104, -8019241, -472983, 6806987, -11605002, 2406256, 1097901, 7856569, + -2950106, 2490007, -1826435, 282394, -5197984, 6156836, -2052458, -4442607, -7689602, 3367791, + 10532334, -1427540, 2950106, -2163590, -2037962, -1422171, 8220568, -2431488, -1343251, 4035122, + 362925, 2885144, -1423245, -1188632, -1972464, 1091995, 3064459, -1487669, -3323231, 2370822, + 503585, 330712, -2603824, -1829656, -150861, -306016, -498753, 3305514, -980326, 1687922, + 1712081, -273804, 973347, 74088, -82678, 11811, -398895, -1495186, 1128503, 2907156, + 676994, -613107, 987843, -156766, 161598, -930397, -1242319, 20938, 652298, -193274, + 579284, 2154463, 870268, -822486, -360240, -705985, + }, + { + 2136209, 4173098, -6441914, 982474, -1569274, -384936, -1532230, 1034550, -3867618, -355409, + 1376000, 6965363, 12991202, 14155138, -7827578, -16985522, -12717935, -5956046, 62711892, -21528524, + -14130979, -10009421, 9439264, 2126546, -9514963, 4443144, 1741609, -12852153, -10612327, 8200167, + -29528, 7423314, 7722888, 1756642, 673773, -8762270, 12096775, -214748, -6928319, 2807835, + 131533, 463320, 1640141, -3423626, -11681774, 9979893, 4351876, -273804, 4973572, -696322, + -4194573, 378494, -1066763, 1080184, -8589935, -1758252, -1071594, 199716, 2283849, 5342940, + 1443109, -1853815, 744103, -4575751, -1447941, 2384244, 432181, 647466, -3376918, 629750, + 2623688, 2281165, 1053878, 434865, 109522, -2678986, 3620121, 390305, -91805, 1670742, + 3323768, 832150, 1356136, -2793876, -1130113, 916439, 2050847, 1123134, -352724, -700617, + -1524177, 531502, 251256, -389768, -1596654, -73014, + }, + { + -52590264, -215328192, 10482941, -38849052, -3071975, 1840394, -6744173, -3871376, 11414412, -4081830, + 14878304, -6305549, 6550362, -4711043, 8521752, 17582522, -1821603, 5932424, 8465917, -11428908, + 6547678, 11201812, 1341640, -3659312, 360240, 2967823, -2930778, 4157528, 2312303, 3843459, + -5742372, -9517111, -9685688, 2362232, -5222680, 1726040, 6058052, 7102802, 906775, -5308580, + -718870, 954557, -6058588, -7927973, -4247186, -696858, -679679, -3447785, -4995584, -827318, + -2739116, 2978560, 3629784, -1245004, -1441498, 830539, -1311576, 1117228, -4444218, 359704, + 1663226, -1312113, -723165, -55298, 644782, -805843, 1032940, 181999, -1091459, -106837, + 1864553, 506806, 1707250, -2334852, 392990, -1537061, -671089, 399969, -1381906, 8053, + -807991, 1134408, 134218, -476205, 381178, -755914, 1246077, 652298, 2122251, -580357, + 204548, -1535451, -304406, -79457, -388158, -1070521, + }, + { + 250182, 4085051, 3535295, -800475, -2113124, -752156, 229781, -894427, -1048509, 1062468, + 3574487, 1627256, 5146445, 4870493, 17460652, -7124277, -9704479, 12003897, 3183108, -9324911, + 13421773, 3897146, 11062762, -8928163, 10964515, 15832860, -15569, -5781563, 8263517, 4895726, + -8853001, -9119289, 14143327, 13939853, -4656819, -9592809, -4621922, -5580773, -11744051, 3775813, + -690953, -2600066, -3633542, -1828582, -3855807, -30602, 1702955, -6481106, 4163971, -479963, + 2370285, 4971425, -2643552, -1040993, 3726958, -139050, -548682, 2513630, -812823, -3154117, + -754841, 3430068, -3136400, -3025268, 424128, 1029182, -438087, 2648921, -782221, -685047, + 186294, 397821, 1172526, -776852, 508417, 418222, 698469, 1270774, 668404, 421444, + 489089, -2506650, 62814, 54761, -220117, 955093, 600222, -398358, 388158, -119185, + -1293322, -2283849, -1155883, 65498, -1278290, 302795, + }, + { + -38931196, 320280544, 13930190, -37283000, 13684303, -4806606, -13490492, -2501819, -1827509, 16269873, + -5143760, 1175210, 1006096, -18486612, 6975564, 13904957, -6804302, 20959440, -19942070, -10200010, + 4232154, -7469485, 6993818, -1545651, -543850, 736587, 2669322, 4899484, 4719632, 10489921, + 4758824, 5448703, -1606855, 2219424, 3685082, 12876849, 9434433, -5702643, -3252901, 5049271, + -2394981, 6721624, -1333051, 9724880, 906775, 10156524, 2160906, -2374043, -3821984, 421444, + 1488206, 7358890, 2228551, -8010651, -148176, -2142115, -493921, 7501161, -2845953, -401579, + 391379, 993748, 2065879, 135828, 3094524, -692027, 926102, -1494649, 710280, 1462436, + -1724429, -308164, 1746441, -2384781, 1847910, 790274, 335544, 1756105, 609885, -871878, + -764504, 921271, 159988, 82678, 254477, -1294933, -153545, 846109, -1268626, -448287, + -125091, 551903, 607201, -1228898, 222801, 241055, + }, + { + -109522, -9240622, 425739, 4273493, -3015604, 344134, -157303, -2309619, 4074850, 1893544, + -4717485, 7315403, -8042327, 4077535, 16545288, -25364466, -12058121, -5282810, -5315559, -5592585, + -5764920, -18629420, -21920976, 22311818, 14197551, 16943646, 4605816, 6772627, 2544768, 894427, + 11285563, -15819438, -9841381, 2994129, 2191507, 3313567, 1074279, -4835597, 11206107, -3549791, + -4010426, 3252364, -1901597, 163209, -4075387, -1391569, -3110093, 3672197, 3556233, 2100239, + -2838974, -4129074, -758599, 4233227, 5643587, -593779, 3582003, -2081449, 2744484, -5216238, + 3804267, -829466, -3776350, 13959, 2879239, 2620467, -741419, -1093606, -809064, 851477, + 895501, -562641, -1918240, 1885491, 905701, 2664490, -1996623, -35970, -1241246, -2152316, + 1349694, -827318, -1529545, 346819, 22549, -646929, -4295, 625455, -279173, -361314, + -547608, 1381369, -653372, 140660, 1356136, 240518, + }, + { + -31049930, -18639084, 23391466, -12547210, -365072, 33593088, -20351702, -22393422, -11901891, -11824045, + -2281165, -3001109, 5120675, 11646878, 659278, 12847321, 11255499, 15543487, 5237176, 13456669, + 4501126, 1220308, -7642895, -11207717, 3952981, 2357400, -467078, -13123273, -2221035, -2877091, + -13455596, -1566053, -2147484, -7815230, -1484448, 3215857, -2656974, 6090264, 4727686, -2208687, + 3089692, 5777805, -2454037, 2168959, -3704946, -1296006, -1813013, 5434744, 1020592, 1340567, + -2972654, -3036542, 2146947, 4810900, -2160906, 4325569, -4625143, -188979, 892279, -1395864, + 4694936, 4147865, 1537061, 32212, -330712, 2665564, -1611150, 628139, 338766, -889058, + 3155190, -2576981, -3758, -1350230, 2277407, 1546725, -1563905, 2052458, 533650, 847182, + -991064, 848256, 1400696, -248571, -961536, 297427, 292058, -933619, 638876, -1119913, + 1325534, -280247, 489089, 76773, 351114, -79994, + }, + { + -1669669, 50149648, -5162014, -2964064, -13649406, -632971, -8462159, 2399813, -7279433, -6405944, + -4765266, -5407901, -11809013, 10965588, -12478491, -18402324, 14316200, -16036334, 21553220, 23855858, + -1074279, -14155675, 14709726, -15105400, -246961, 2534568, -2848637, -5386963, 6623914, 7766912, + -7734163, -1294396, -2731062, 552440, 6926172, 9476845, -3783866, -6781217, -6006512, -4116726, + 4973572, 1813013, -5188321, 2183991, -9636833, -55835, 4039954, 1403917, 4907000, 3010772, + 800475, -4853850, -2086280, 4601521, 3047279, 1515587, 1973001, -3850975, 3439732, 2209761, + -1816234, -1110249, -924492, -1322313, -1648194, -363998, -3262565, -2010582, 843424, -1096827, + 3362423, 105227, 722091, 143345, 1119913, 588947, 1895154, 1331440, -255551, 1313186, + -1656247, 229244, 857920, -126702, 1183800, 212601, 856846, 1189706, 1001264, 571231, + 209380, -1176284, 78383, 1177895, -1258962, 887448, + }, + { + 31930398, -66307316, -12788265, 6236293, -1290638, 23147726, -6098854, -9720585, -7276212, 4899484, + 28950228, -2897492, 18523120, -13373454, -9185324, -7646653, -3126736, 14202383, -17326972, -15285789, + 1631014, 3006477, 4942434, -8513162, -8845485, -1171989, -12368969, 3433826, -1046898, -17940616, + -2528662, 10702522, 1998234, -5898064, 2787434, 12444131, -9546639, 11789685, -5964099, -4609037, + -523449, -3152506, -13849122, 8155069, -2996814, 3014530, 475668, -2572686, -3681861, 2254321, + -288837, 1493038, -5684389, 4821101, -2828236, 3787624, -889595, -592169, 1274532, -1940252, + -2015950, -2634426, 650151, -2801929, 2166811, -71404, -1478543, -85899, 2134599, 3337727, + 1037772, 875100, 294742, -104690, 119185, 186294, -369904, -1166621, -2056753, -693637, + 1688996, -684510, -1586990, 388158, -660351, -147103, -119185, -927713, 545998, -1348083, + 1095754, 877784, -654983, 1389422, -307627, 386547, + }, + { + 2965675, 33890512, -4742718, 3618510, -4580046, -718870, -2237141, -1093606, -857383, 911070, + -3712999, 3441343, -3194382, -8256001, -49162880, 5552319, -14766098, -3160559, -2610803, -8912594, + 9959492, 28527172, 11459510, 11398843, -13839995, -1094680, 8870718, -6327561, -16910360, -749472, + 8724152, 206695, 472446, -731218, -687732, -7931194, -14559402, 3610457, -1737851, -1096290, + 4364224, 4228396, 3236258, -11907797, -5997385, 216896, -3382824, -4209605, 4980552, 1160715, + 5388574, -4005594, -6319508, -3071439, -2270964, 530965, -520228, 17717, -544387, -3532611, + -3301756, 2550137, -507343, -1541356, 2447595, -2372433, -2189897, -3033321, 180389, 387084, + -448287, -942745, -1088237, -1447941, -515396, -637803, 3365644, -48855, 1604707, 636729, + 368293, -282394, 1426466, -2231236, 618475, 550293, -703301, 1743220, 180926, 496606, + 696858, 147103, -2363306, 271120, -2110977, 187905, + }, + { + -1917166, -88507464, 8805220, -12334072, -9641128, 11782169, -11601780, -5266167, -5451924, 1053878, + -9811316, -1577327, 10462540, -3745748, 3291556, -1500554, 133681, -16258599, 1693291, 14855755, + 8161512, 6079526, -5812165, 3696356, 4061965, 2631204, 972810, -12366821, -2925410, -3700114, + -2704756, -8653822, -5277441, -6497749, 8115878, 9060234, 1812476, -6162741, 8542153, -7287486, + 9472014, 9749576, 2340757, -4290136, -4370666, 734976, 644245, 3515431, -4254165, -7579007, + -330712, 4830765, -5421860, 1091459, -3671660, 4173635, -2558727, 2888903, 2536178, -2706903, + -911607, 2154463, -4464082, 1678795, -106300, -1491427, -2826089, -1362578, -3724811, 1537061, + 2707977, 1619740, -229244, -1532230, -4957466, -2197950, -1547262, 2924336, 737124, 267899, + 1614371, 1976759, -1122597, 430034, 613107, 723165, -3788698, 836445, 1430224, -759672, + 304943, 1016834, -142271, -1133871, 115964, 212064, + }, + { + -200253, -60617020, -1290638, 335007, -8877697, 700617, -3828427, 2190970, -11440182, 5806796, + -11120744, 11458973, 5280126, -10382010, 35960152, 12839805, -17391396, -18294950, -2216740, 12156368, + 5529234, -6488085, 3358128, -11425150, 4653597, -7078106, -5819144, -9510131, -6871411, -11828877, + -3651796, -8958228, 8049843, -6500433, -2440078, 3155190, -2998424, -3273839, -401579, 14587320, + -391916, -9868224, 6458557, 893353, -3213173, -2899103, -4560719, -5411659, 2474975, 9044664, + -2059974, -2091112, 1063004, 4533338, 653372, 4159676, -350040, -2665027, -3741990, -103079, + 3519189, 1973001, -6304475, -2857764, -529355, 2139431, -3566970, -1246614, -817654, 2842195, + 630286, -3936875, 737124, -4136591, 1475858, 2762201, -198105, -849330, 97174, 1891933, + 142271, -2185602, 1681480, -1371168, 787053, -631897, 545998, 236760, -651761, -4295, + 1595044, 1280974, 10201, -391916, -1094143, 130460, + }, + }, + { + { + -13242458, -207497920, 3590056, -21601002, -9122511, -5292474, -773631, -4591320, 5003100, -11305428, + -11086921, 7880191, -6223945, 6066642, -17283486, 7461432, 4180614, 466004, -1367410, 366146, + -8043937, 2196876, -2340220, 483721, 10695542, -4183298, 4056060, 6589017, -1929514, -1880122, + -571768, -4956393, -4409858, -5085778, -7696582, 10373957, -1426466, 3357054, -1116692, -3716757, + 6913824, -2279017, 4444218, -3080029, -941135, -2651606, 758599, -1556926, 3774203, -765041, + -4575214, -6520297, 417149, -9348533, 4711579, 1252520, -5549635, -494995, 5604933, 5340255, + -3424700, 4880694, -3209951, 1229434, -4294968, 4589710, 1337346, 687732, -865436, -1176821, + -785979, 1684164, -469762, 1553704, 70867, 979253, -1503239, -1251983, 1085016, 134755, + 640487, -425739, 244813, 1309965, -1067299, 358630, -469225, 590021, 2208150, 1247688, + -392990, 999654, -1854352, -279173, 1120987, -308701, + }, + { + 900869, 47197932, -1457605, -15532212, 482110, 2033667, 425739, 6658810, -53687, 4571456, + 2190970, 5576478, -2120640, -2993055, -7274601, -12045773, -9423695, 8939974, -12223477, -8912594, + 14841796, 8570607, -18358838, 10149008, 5302137, -1803349, 7364259, -7362648, -3758, 8623221, + -2281702, 4627291, -5391795, -1625645, 1377074, 2755759, -4306779, -1227287, -11828340, 1591285, + 1776506, 364535, -91805, -3373697, -3311957, 42950, 3738769, 1094680, 4591857, -1260036, + -3942780, 4532801, 4023311, 365072, 315143, 638340, -2056753, 916976, -1290101, -722091, + 1709934, 1781338, 1813550, 2105071, 4003983, -312996, -1058710, -2947958, -763430, 1815697, + 4543539, -328028, 1214402, -1005022, -1342714, 374736, 271120, 277025, 1848983, -968515, + -153545, -966368, 673236, -1075889, -75162, -683974, 1595044, -469225, 178241, -584652, + 357556, -573915, -454730, 1725503, -411780, 594853, + }, + { + -4362613, 7737921, 33356864, 13084081, 8577587, 2229088, -3024194, 13907104, -3250217, 12771085, + -12191802, 19109384, -24196236, -10499048, 236223, 7968238, -3663607, 7690139, -2374043, 2774012, + 1222455, 1986959, 8338142, 8004209, 10376641, -994822, 10572062, 4214437, -9847286, -3748970, + 1870458, 10920491, 6518150, 1103270, -12130598, 5516349, 94489, 813359, -8751533, 5004174, + 1289027, 716186, 473520, 1836099, 5896990, 7592966, 2308545, 5064840, -368830, 2927557, + -2194192, 1245004, -1443109, 571231, 3549791, 822486, -604517, -3856881, -2130304, -3178813, + -574452, -1765232, -860604, -2524367, -1234266, 210453, -3582003, -2079838, -1094143, 1830193, + 2226404, 1367410, -1570884, -2656437, -2346126, -664109, 1007170, -7516, -263604, 2496987, + -699006, 2010045, -522912, 199716, 488016, 1344862, -913754, 387621, 1662152, 317828, + -1216013, 170188, 16106, -1525787, -277025, 158377, + }, + { + 20981452, -224266544, 5721970, -3499325, 694711, 2457258, -532576, -1529008, -11282342, 21398064, + 2421825, 16393890, -8257612, 4202089, 5787469, 5966247, -10694469, 28957206, -12021613, -6306623, + 5267778, 6187438, -6208375, -5249524, 18254, 6155762, -5025649, -1634235, 1920924, -37581, + 122407, 6631430, -4689568, -4510790, -1253057, -1058173, 6837588, -7864085, -5894843, -3105261, + 8588861, 4780299, 3578782, -8223252, -620086, 5684926, 3365107, 2125472, -2809446, 6389838, + -2348810, 310848, 261456, -62277, -3620121, -272730, 2513630, 367220, -845035, 1253057, + 273267, -1377074, -1130650, -2101850, 758062, -1001264, -694711, 699006, 1391033, 2229625, + 681289, -863288, 477815, 2233920, -1158031, 423591, -962073, 214212, 1241246, 2809446, + -198105, -420907, 159451, 453656, -180389, -579284, -228170, -1964948, 625992, 706522, + 363998, 1478006, 180389, -73014, -715649, -1550483, + }, + { + -2320893, -2156074, 521302, -3463891, 2750390, -1713155, 1361505, -927176, -5338645, 2364380, + -4990752, 9163850, 10444824, 21918292, -28890634, -14254996, -5244155, 43761960, 14244259, -10610180, + -33496986, -108448, 5864241, -1882269, -3910568, -18842022, 10029286, 88047, -7346542, 9223442, + -4104378, 3288334, 7972533, -3512210, 5590437, -10336376, 9800578, 2582349, -9076340, 6487548, + -5892695, 4396436, 1834488, -7838316, -4821101, 7526930, 6923488, -3570192, -303332, 4311074, + -5591511, -874563, 1960653, -2071785, -5373004, -4556961, 2886755, -2199560, 3316252, 5637145, + -1144072, 71941, -1206886, -2663954, -1538672, 454193, -117575, 775778, 10737, -566936, + 457951, 3661997, 1516124, 709743, -1819456, -1166621, 2717104, -428423, 2047089, 1595044, + 2925947, -184147, 285078, -132070, -2321430, 744640, 2270964, 690416, 214748, -1669669, + 363462, -262530, 1053341, -1293322, -448824, -485868, + }, + { + 35219268, -342133344, 6471442, -23888072, -7276212, 252329, 3870839, -12655121, 2618856, 13871134, + 4903779, 8469139, -18522046, 4460861, 12859669, 7380902, 7881265, 2177012, 425739, -4904853, + 5791764, -1991254, 9446781, -3976066, -4424890, 8010651, 2670396, -9473087, 4192425, 2513093, + -7141457, -2320356, -6860674, -1974074, -1663226, -3417720, 6321118, 10252087, -2187212, -1745904, + 118112, -5055177, -3805878, -3038689, -5753109, -5582921, -1398549, -2900177, -3512747, -7292318, + 3995930, 997506, 2723546, -2886218, 1941862, -3332895, 2254321, -781684, -1282585, -2985539, + 2656974, 770410, 958315, -2324114, -715112, -506806, 1246077, -1030255, 1703491, -719944, + 58519, -75162, 1014686, 144955, -1950989, -272730, -2203855, 1458141, 372588, -736050, + -1482838, 598074, -577673, 795643, 1226750, -886374, 422517, 1649268, 1598802, 127775, + -1679869, 282931, -1615982, -591095, 322659, -965831, + }, + { + -1020592, 11063299, -1050656, -2797098, -655519, 311385, -341987, 1196685, -1569811, 9127, + 3709778, -313533, 4370666, -121870, 14919106, -8999567, 6606197, 4638565, -395137, -245887, + 20131586, -8830453, 23631446, -6664179, 5587216, 2767033, 19508816, -11144366, 7286949, 8883603, + -9939091, -7380902, 6573985, 22706418, -10787884, -5699422, -7314866, -5840619, -7893613, 998580, + -1348083, -5340255, -730681, -6441377, -101469, -2165201, 5089000, -8079371, 2110440, 1005022, + 2991982, 1663226, 2288144, -2324114, 1347009, -2788508, 3431142, 3242164, -5761699, -653372, + -35970, 2593624, 568546, -3779571, -1211181, 4025995, 331249, 965294, -731755, -1139777, + 370441, 1968706, -2212982, 2975339, 121333, -1293322, 1554778, -240518, 1059246, -68719, + 1491964, -712965, -634045, -857383, 915365, -120259, 144955, -142808, 961536, -1740536, + -1271310, -501974, -1247688, -682900, -537945, -515933, + }, + { + 65725348, 244537184, -30870614, -9565966, -9591199, -3473018, -16566763, 1446867, -5075041, 19393388, + -2748242, -15190762, 6304475, -1722282, -21406654, 25824564, -2290828, 4764730, -1484448, -8256538, + -9438191, -4175782, -1372779, 15452755, -1454920, 4199941, -76236, 5906, 2152316, 16110959, + 681826, 4858145, -3368328, 11161546, 1820529, 22609782, -3528316, -1114544, -2639794, -1872069, + 6941741, -3238942, 1208496, 1387811, 12978854, 1341640, 7617125, -4796405, -3434900, -1154809, + 2001455, 4004520, -3532074, -4145717, -2935073, 2458869, 810138, 4019553, -787053, -106300, + -1366873, 1760400, 850404, 3187940, -177167, -747324, 1287417, -672699, 943282, 706522, + -734439, 35970, 144955, 213138, 1253057, -278099, 900869, 658741, 1233193, 241055, + -1081258, 617938, -649614, 900869, -959388, -1668595, 471373, 400506, -436476, -767189, + -694174, 1908576, -1136556, -151398, 18254, 395674, + }, + { + -1214939, 6245420, -12308303, 2327872, -1230508, -139050, -699543, 1288490, 475131, 335544, + -4249870, 6754373, -205622, 8003135, 13360570, -31027918, -9121437, -13093745, -1457605, 4408247, + -22788022, -6797860, -15325517, 19893214, 13671418, -3600793, 21068962, -7208029, -3806415, 24169928, + -8294656, -4085051, -14148159, 5749351, 6681359, -6847789, 5328444, 542777, 5861020, 4644471, + -2778844, -1196685, 1908576, -6341519, 5162014, -2754148, -3566434, -58519, 5849746, 4046396, + -7144141, 1434519, -843961, 3045132, 2594160, 3891240, -1137630, -849867, -190052, -1394791, + 2095407, -390842, -4359392, -1973538, 5099200, 914291, 1395864, -935229, -1584843, 169651, + -11274, 651224, -3275986, 2456185, 1557999, 832687, -1060857, -708133, -663572, -690416, + -1095754, -221728, -209380, -903554, -1086627, -78920, 1631014, 700617, -1161252, -504122, + -264141, -293668, 441308, 854162, 160524, 539018, + }, + { + 33704220, -48572324, -9854802, -14758581, -3067681, 33494840, -12033425, -30499636, -7411503, -11634530, + 2108292, -7310035, 4600984, 7909719, 2882997, 301185, 18788334, 7982197, 26458072, 4712116, + 3595425, -355409, -6887517, -18191334, 2125472, 4445291, -10009421, 4154844, -13203266, -2854006, + -2130304, -6727530, -2823404, -6640557, -44023, -5451387, 5636071, 12763569, -1030792, 639950, + -86436, -1256815, -4918275, 5916855, -6539625, 2003602, 4427575, -1672890, 3557844, -2251100, + 1377074, -1029182, -510027, -2355790, 5237713, 1191317, -1265942, -1733556, -572304, -3301219, + 8993662, 3292629, 4180614, -787590, -4151086, 2808372, 556735, 2294050, 1042603, -3230352, + 4360466, -1207423, -1258425, -412854, 1669132, 3891777, -1345935, -1750736, 3009162, -1489817, + -541166, 801548, 2102923, 649614, 63888, -231928, -1187022, -1074816, 547608, -434865, + 1421097, -226560, 18790, 1079111, -641561, -373125, + }, + { + 831613, 67124968, -25729538, -6118718, -3697430, 2225867, -7204808, -3910031, -5814312, 1008244, + 4870493, -5915781, -8413304, -8335995, 5947993, -25702694, -455267, 3290482, 20353314, -2312303, + 12701292, -8071318, 6505802, -10504416, -1487132, 8474507, -7481296, -31675, -2444910, 5687611, + 1251983, -3847754, -4405563, 2385854, 2714956, 12071006, -6584185, -4320200, -3194382, -1014149, + 1082332, 3000035, -3933116, 28991, -8546985, 1180579, 3359201, 5993090, 3966402, 1272921, + 1539746, -7132330, 499290, 1518271, 4906464, 1295470, 954020, 94489, 439160, 123480, + 1125818, -3981972, 1688459, -1825361, -610959, -2462627, -2035278, -916439, 1253594, 907849, + 321586, 245887, 2106682, -946503, 1129040, -366146, 1387274, 1022202, -258772, 1387274, + -849867, 65498, 702764, -976031, 1764695, -540629, 1537061, 1503239, 1498407, 1052804, + -223875, -1251446, -369367, 28454, 384400, -221728, + }, + { + -44815300, 35121560, -7034620, -5817533, 27322972, -2649458, 8117488, -7605850, -19021874, 13753559, + 23621784, 9168681, 6905234, -1554241, -23758148, -1231045, -8205535, 11172821, -98247, -19603304, + -7226820, 10147934, 2525441, -3686693, -16153372, -149787, -7001334, -2226404, -1289027, -17227650, + -6526740, 8777303, 2184528, -162135, -1703491, 9632538, -8041253, 9154186, 154082, 46171, + -3731253, -6609418, -180389, 4255239, -6955700, 3633006, -2594160, -982474, 1755568, -1393717, + 1234803, 4549444, -3948149, -4482872, 6618545, -1161252, -2261300, 2765959, -1393717, 989453, + -4145180, -3032247, -1788854, 2921115, -845572, 249645, 1600949, -2945274, 1650341, 5492190, + -569083, -227633, 55298, 794569, 136902, -235149, -261456, -1088774, -1756642, -61203, + 2180770, 398358, -1389422, -29528, -294205, -39728, -141734, -1359357, -142271, -503585, + 590558, 816044, -241592, 331249, -388695, 294742, + }, + { + -3142306, 21552682, 6951942, 2147, -2430415, -680752, -1367410, 1796370, -1242856, -2343979, + -2376191, -2900714, -15671799, 15908559, -46628848, -13945222, -34882112, 4195646, 6118718, -5648419, + -5651103, 35231616, 17963164, -9941776, 13555991, -2495913, -1096290, 4170413, -11716134, -5254893, + 5113159, 1095754, 3434900, -1028108, -4850629, -2593087, -13580687, -7237020, 6362994, 2800856, + 3119757, 2737505, -3618510, -6058052, -5296769, -7447474, 3979287, -6321655, 4519916, -2041183, + 7260642, 528818, -5532992, -5330592, -3240016, 973347, 344671, -1574106, -1074816, -3008625, + -4057134, 6156836, -2448131, -1342177, 404264, -2105608, -1335735, -5449240, 3579318, -2302103, + -1623498, 1264331, -2508798, -820339, 2873870, -35433, 1175210, 245887, 994285, 1713692, + -740345, 540629, 321049, -275952, 1091995, -610959, 515933, 124554, 1564442, 1214939, + -892279, 1435056, -1266479, -2241436, -469762, -560493, + }, + { + -17501454, -72622528, -15569, -8776766, -145492, 4526359, -10065256, 4858145, -2284386, -12658342, + -1260573, 2401961, -7369090, 8641474, -7170985, -10547366, -760209, -4049081, -8036958, 20722680, + 4007205, 13272523, -1430761, 1739462, -3939022, 5154498, -8107825, 1041530, -3142306, -8312373, + -3856881, -7022272, -6445672, -5630702, 4749160, 6499360, 1636919, 3066070, 4547834, -705448, + 3490735, 14102525, -1265405, -1105954, -4763119, 1402844, 5550172, -2378875, -5354751, -4006668, + -4270808, -971200, 4400731, -4699768, -2560874, 3442953, -1916092, 5648956, -781684, -2097555, + -574452, 1439351, -603443, -274878, -19864, -1596654, -1420024, -840740, -4107063, 1697049, + 5663988, -1291711, 940598, -3721589, -4617627, -1387811, -894964, 1546725, 1276142, 1493575, + 2209224, 51540, -68719, 150861, 1054951, -1388885, 110595, -323196, 1067299, -219043, + 377957, -325344, 501974, 317291, -1176284, 855235, + }, + { + 1476395, -66013112, 6626598, -5247913, -6360310, 3528316, -1199370, -3107409, -5660230, -4112968, + 9485435, -4904853, 10261214, 20977158, -28804736, 11342472, -22920092, 5243082, -8235600, -1093606, + 31958314, 1331977, -10805601, -7295002, 249645, -3464965, -15490873, -7934952, 6828998, -9570261, + 2409477, -17223892, -169114, -4887136, -3647501, 16705812, -5828271, -11695196, 7002944, 11843372, + 87510, -4633733, 3015067, -425202, -294742, -3786014, -6508486, -5556077, 5873368, 4161287, + 2328946, 663036, 1635309, -2744484, 6085969, 3215320, 1131187, -4725001, 2787971, -3004330, + 1430761, 3445638, -5831492, -1729798, -2799245, -1022202, -1570347, 1139777, -339302, 363462, + 1391569, -660351, -3068754, -1515587, -169114, 773631, 1850057, -1195075, -696322, 869194, + -61203, 309238, -809601, -44023, 579284, -1480690, 498216, 1051730, 297963, -1170379, + 2567317, 511638, 977642, -748935, -994822, -1741609, + }, + }, + { + { + 4159676, -204280448, 4672388, -15679315, 2480344, 4366908, -2863670, -19111530, 3983582, -15636365, + -28038620, -835908, -1225139, 10691247, -6197638, 3918084, -3007551, -3441880, -9283035, 3155190, + 730681, 314069, -10719165, -4348118, 11413876, 6288906, 5566278, -3025268, 358630, 333397, + 6800544, 5371394, -2638721, 317291, 6547678, 14573361, -3090229, 4929012, -3070902, -5121749, + 2764348, -2551748, 7350837, -2336462, -1485522, -1206349, -705985, -4810364, -1247688, -2437394, + -3499325, 331249, 3160559, -4466229, 5511517, -3563212, -8091719, 1972464, 3226594, -1009854, + -5713380, 1597191, -1714229, 4200478, -3182034, 3999152, -1144609, -1952063, 1387811, 2720325, + 1219234, 2182380, -1359357, -128849, -1195075, 596464, -318901, -44560, 906775, -1348620, + -689879, -1816234, 345745, 147640, -2764348, 1400159, 1480153, -114890, -228170, -509491, + -1893544, 1600949, -1122597, -628139, 328565, -304406, + }, + { + -1053878, 44601088, -4260608, -12858595, -438087, 766115, 2212445, 3089155, -2828773, 11462194, + 777926, -511638, 8216273, -4215511, -19691352, -9861245, -4439386, -180926, -1370095, 3732327, + 1291175, 7664906, -18482854, 10198937, 19765976, 1722819, -8529805, -7978439, 149787, -463856, + -8561480, -88047, -12207908, -7400766, -1688459, 8252780, 1112397, 3451006, -6473053, 4864588, + 5870147, 6368900, 1860258, -6231998, -9167071, -7671349, 3887482, 3059091, 3262565, -1940788, + -1206349, 5342403, 762357, -985695, 1010391, 1489817, 841814, -2038499, -4063039, 2051921, + 840740, 468151, -67109, -255014, 1016834, -1690607, 2907156, 583042, 563178, 2395518, + 3922379, -2465311, 1854352, 188979, -104690, 456877, -1782948, -2546379, -304406, -784368, + 982474, -298500, 102542, -815507, 598074, -823560, 1308354, -374199, 223338, -938450, + -151398, -251792, -1604170, -229781, -1544041, 141197, + }, + { + 4194573, -50203336, -14827838, 17610976, 5249524, -6622303, -8243653, 4373351, -6741488, 12555263, + -20534238, 18509698, -8944806, 3202435, 1044751, -3488050, 2238215, 18584860, -1981591, 10881300, + -6554120, -7652558, 6286759, 6082748, 5369246, -5760088, -2419140, 45097, -6415071, -4420595, + 3684008, 11444477, 1477469, 10144176, -7696582, 5069672, -2408403, -382252, -2995203, 5188858, + -4326106, 1641751, 699543, -4105989, -2676838, 1525787, -782221, 2373506, 2299418, 225486, + -10579578, 1889249, -312996, -4162360, -851477, -1808718, -912144, -536334, -910533, 90731, + 323733, -1249299, 70330, -1759863, 1278290, 1767379, 2043331, 1365263, -2030983, -763967, + -235686, 1913945, -1023813, -1975148, -3101503, -3329137, 892279, 95026, -745177, 839129, + -1735167, 794032, -1090922, -10201, -486942, 589484, -336081, 683437, 948651, -1352378, + -1614371, 392453, 1469416, -774168, -825171, 360240, + }, + { + -142808, -285146624, -11870753, -4354023, -4968741, 244813, 6603512, 5128191, -13024488, 16627429, + -1181653, 18153754, 4234301, 8924405, 27917, 8595303, -9009231, 18148922, -13833016, 14397267, + 15028627, -1703491, -6968048, -304406, -1182727, 7086696, -4033511, -13038984, -7982197, -10524280, + -6206228, 3958349, -2515777, 3767223, 6161668, -1176821, 3591667, -7451769, -3403225, -8349417, + 4937602, 2336462, 2850248, -7121056, -2284923, 1161252, -3864934, 2061584, -2675228, 7546795, + 583579, -285615, 3473555, -597000, -6288906, -1681480, 828392, 33286, 1288490, 269509, + -39728, -2124935, 188979, 430570, -224412, -816044, -934155, -1163399, 1667521, 1232119, + 675384, 1986959, 2704219, 1758252, -2264522, 580894, 449898, 1329292, 1485522, 1984275, + -74625, -923955, -198642, 954557, 53150, -630823, -131533, -1677185, -588411, -813896, + -256087, 29528, -468151, 284542, 280247, -439697, + }, + { + 2345052, -6350646, -7417946, -7786239, -807991, 6442, 2819646, -1510218, -8237211, -2115808, + -8521215, -1126892, -7356205, 7380365, -31958852, 11725261, 19945292, 9608916, -37808060, -7554848, + -13863618, 10077604, 278099, 1752884, -3348464, -27060978, -1820529, 2692408, -3221, 6362457, + 33286, 3168075, -2521683, -5890548, 9399536, -5934034, 10450192, 2939905, -3092377, 7194607, + -4041027, 7358890, 5420249, -1771674, 5508833, 1571421, -6900402, -2360622, -1898912, -58519, + -5216238, 1294933, 3052111, -1739462, -1486596, -624918, 6884833, -3732327, -1727114, -1988570, + -6356015, 238371, -15032, -227096, -1116692, 1208496, -130460, -2093797, 153008, -941672, + -2306398, 2124935, 817118, -2303713, -1721745, 1171452, 1089848, -2676302, 1558536, 1224066, + 642098, -3636764, -592706, 586800, -1933272, 582505, 557272, -180926, 297427, -682900, + 1168231, -672699, 1253057, -56908, 283468, -887448, + }, + { + -2568927, -415679296, 178778, -2191507, 3945464, 2915746, 8815420, -14105209, -4867272, 8479876, + -650688, 5052492, -31191664, -6456410, -137976, -74625, 1355062, -7783018, -14550812, -11700028, + 8091719, -5369246, 8843338, -4138738, -2063732, 9642202, 3895535, -2693481, 5339181, -5415954, + -9662603, 2825552, -8624831, -2596308, 6370510, -1219771, -2788508, -1301375, -2190433, 4953171, + 4793721, -2158221, -581968, 121333, 592169, -3379603, -3136937, -3968550, -2469069, -8717173, + 1639604, -486942, 939524, -5297306, 4117263, -533113, 2699387, 1427003, -536871, -3132642, + 812286, 187905, -446140, -3084324, 2014340, -1269163, -1108638, 248034, 2987687, -998580, + -805306, -1729261, -15569, 432181, -3964255, -499827, -1699196, 3038153, 2910914, -515396, + -1384590, -824634, -1307281, 1515050, 785979, -689879, 380105, 1396401, 157840, -1009317, + -3030636, -295816, -1242856, -61203, 90194, -433792, + }, + { + 273267, 9292162, -9973451, -2614561, 2156611, 1380832, 498216, 2954401, -374199, -3545496, + -929324, -8359617, -7481833, 461709, 14978698, 2091649, 9401683, 9472014, 12508019, 9116605, + 8541616, -12194486, 10969346, -36964100, -1292248, -12681428, 17644262, 4243428, 7529078, 6453189, + -3863323, 1333051, -652298, 6034429, -14783814, -1703491, -7050726, -2520072, 1209570, 4609574, + -1370632, -2134599, -2055679, -8172249, 2996814, 234076, 6991670, -6698539, 1962263, 585189, + 4109210, 1427540, 3299072, -1972464, 135828, -3264175, 1029718, 1398549, -4640176, 4451734, + 3927211, 4095251, 2824478, -3104725, -2510409, 1515587, 543850, 1052267, -180389, -1380832, + -303869, 305480, -4028143, 2616172, -1324461, -1573569, 2476049, -594316, -628676, -2436857, + 1036161, 1818382, 899259, -266825, 748935, -1787243, 667331, -62814, -243739, -1497333, + -281320, 1056025, 478889, -325344, -340376, -1031866, + }, + { + -83508120, 128919888, 40486508, -7271380, -8318278, 7296613, -7252589, 9024800, -4449049, 9877888, + -3549254, -10101763, 7482907, 6578280, -34029024, 8856223, -7266548, -4118874, 9624485, 2921652, + -2278480, 6634651, -1216550, 9629317, -642098, 6499896, -6150393, 1983201, -2363306, -1665911, + -14564234, 2215130, -1264331, 8464307, -4037269, 17711372, 144955, 6361384, -4431333, -4487704, + 3469260, -8003135, -3776887, -7033009, 4644471, -5382668, 5011690, -3146064, -4574677, -7197292, + -362925, -617938, -8573292, 2091112, -1126355, 1433982, 1502702, 694711, -1300301, -34360, + -4398584, -1911797, -2307471, -208306, -2713346, -401043, 2116345, 1486059, 1535451, 124017, + 299574, -852014, -327491, 1702955, -431644, 116501, 1212791, -950262, 867047, -175557, + -1440962, -179852, -1863479, -267362, -418759, 811212, 806917, -1552631, -1308354, 86973, + -72478, 1481764, -839129, -554051, -691490, 413391, + }, + { + 25233, 14208826, -11945378, 353798, -498753, -178241, 1764158, -935766, -3259880, 1926830, + -5093295, 6801081, 130460, -21326660, -8309688, -3848828, 12550431, -8422968, -3842385, 15887084, + -11544335, 12163884, -3104725, 286689, -14032732, -24796994, 15184320, -8447127, -5165772, 17160542, + -12605192, 2545842, -8015483, 6597070, 4103305, -7489349, 8018704, 4872104, 4265440, 7865696, + 1675574, 141197, 6417218, -7721815, 5714454, 1725503, 452582, 145492, -348966, 4981089, + 1270774, 3255048, 1374926, 3487514, -2818572, 924492, -1408749, -1559610, -1887101, -248571, + 3016678, 1982127, -2333241, -1212791, 5209259, 779000, 2115808, 390842, -1206349, -1156420, + -1997697, 1138703, -2584497, -719407, -220117, 139050, -1395328, -733366, 892816, 2581275, + 1170916, 1966021, -504122, -807454, -1686848, -683974, 1977296, 467078, -1027571, -292595, + 112743, -354872, 591632, 50466, -540092, 783295, + }, + { + -34957812, -56202332, 53233436, -8817568, 3682935, 12478491, -16765942, -21170430, 2323577, -10609643, + 2443837, 2173254, 6077379, -4502200, -13859859, -10776610, 6986838, -5224291, 27814208, 10773389, + 7670275, -2823404, -6134287, -18114562, -1406602, 5290863, -3654480, 4709969, -13117904, -153008, + 4398047, -8643622, -1430761, 998580, -1348083, -5803575, 11655467, 10538239, -5928666, -818191, + -7512435, -4732517, -5766531, 564251, -7751342, 5015448, 5890548, -2140504, 4684199, -4410932, + 1474248, 1249836, -3397856, -5478768, 4739497, -433792, -55835, 65498, 1367947, -1404454, + 8270497, -948114, 1212791, -395674, -5451387, -1629403, -744103, 1486596, 855772, -2910914, + 3281355, 2352032, 435939, -1726040, -1069984, 815507, -63351, -1744294, 1135482, -1260036, + 166430, 455267, 1118302, 2805688, 2651069, 607738, -1820529, -3152506, -1919314, 586263, + 1995012, -1213865, -698469, 1243393, -335007, -915365, + }, + { + 294742, 69712688, -15089294, 7228967, 598611, 7469485, 5660230, -1086627, -3172370, 8687645, + 15515032, 12686260, 2404645, -17260400, 7589207, -19594714, -292595, -2316061, -2225330, -22798760, + 10365904, -4530117, 926639, -10532870, -4384625, 1704565, -9261023, -4528506, -7786776, 3918621, + 3286187, -6249178, -4714801, -1698123, -9024263, 991064, -6558415, 838592, 5875516, 12484396, + 11698954, 2034204, -8622147, -979789, -3828963, 5393942, 5147519, 9921911, 2309082, -1030255, + 5906, -3573413, 4182761, -471910, 742493, -5174362, -2047626, 1888175, 178241, -223875, + -1163399, -2435247, 6280316, 2399276, 3620121, -2554969, -3934190, 1809792, 2930778, -450435, + -1909113, -1487132, 239981, -2042257, -104153, -1963874, -859530, 884763, -564788, 1057636, + 1430761, -317828, -809064, -1165010, 193274, -1913945, 62277, 597537, 306553, 557272, + 45634, -802622, -383326, -1075889, 664646, -621697, + }, + { + 35743792, 152235648, 10940355, 5041755, 31583578, 518080, 17546016, 6628745, -6171868, 13311714, + 16922708, 9911174, 1128503, -6587406, -24393266, 8146479, -4392141, 7298223, -5210869, -14796162, + 985695, 11917997, 912681, 8414915, -11283416, -13311177, -13848048, 433792, 4434017, -9778567, + -5228049, 3287798, 3490198, 5277978, -5904507, 6090264, -4875325, 7590281, 959388, 3881577, + -1202054, -2112050, 3810710, 1182190, -8111583, 4179540, -5716065, -2218351, 6609955, -4303557, + -190589, 4835597, -3709778, -6025302, 2654827, -7569880, -2929705, 3042448, -2060511, 491774, + -1245541, 1516660, -49392, 2171643, -3578245, 797253, 3187403, -1371705, -2010582, 970663, + -316217, -1452236, -687732, 2284386, 1797981, 1933809, 1529545, 692027, 1160178, 516470, + 68719, 562104, 1380295, 437013, -409096, 367220, 748935, 390842, 848256, -558346, + 58519, 186294, -1052267, -435939, -1040456, -24696, + }, + { + 2856153, -5564667, -19971598, -3857954, -7587597, -4822175, -654446, 6896107, 2317135, -3707631, + -5534066, -8472360, -10800769, 12058121, -57964880, -8793409, -28494424, 768262, 10697153, -4406100, + -19770808, -2196339, -6994354, -12526809, 8657580, 2742874, 16209743, 14516989, -212064, -12141873, + -15833397, 904628, 7972533, -3712999, -3263638, 8624831, -6312528, -10776073, 2206540, -1129576, + -857383, 208306, -3361886, -1986959, 527744, -7104413, 3141769, -3158949, 9330280, -2066416, + 1398549, 763967, 343061, -1720671, -190052, 4694936, 4917201, 2311229, 1951526, 2627446, + -1330366, 4757750, -4308926, -2272038, -859530, -973347, 263604, -4045322, 2813204, -2933463, + -433255, 3117073, -1976759, 1409286, 4166118, -933082, -1041530, -759136, -1683090, -1044214, + -418222, 2543158, 1567663, -4295, 1337346, -620623, -141734, -350577, 2997887, 1390496, + -1844689, 957778, -280247, -1490891, 391379, 90194, + }, + { + 31779000, -20089172, -17475686, -19908784, 3492345, 5433671, -4152160, 12577275, 7116224, -7215545, + -4381404, -6709813, -13089987, -7445326, -23091354, 7933879, 16148003, -10478110, -21122650, 9960566, + -1326608, 5492727, -1093069, 2407866, -5827734, -2792266, -13588740, 12539157, -1429150, -8840653, + 178778, -7042136, -2794950, -5404143, -5339718, -1665911, 9510668, 13353053, -177167, -3904662, + -1912334, 8206609, 1296006, 6085432, 2011655, 5045513, -705448, -9663676, -6539625, -4215511, + -4634807, -382789, 5029944, -4599373, -1307818, 3911105, -2278480, -39192, -4832375, 1309965, + 2745558, 2093797, 1075889, 1234266, 2928631, 2978560, 3993246, 3384434, 1404454, 622233, + 2223183, -2353642, 1839857, 98784, -1998234, 601832, -72478, -1627793, 330176, 2457258, + 1999307, 17717, 417149, 457414, 765041, -813896, 1121523, -785979, 1924682, 388695, + -1331440, -1682554, 237834, 257161, -335544, 697932, + }, + { + -2272575, -65906812, 16539919, 2197413, 2085207, 9387725, 8210904, -581968, -6828998, -2018635, + 13695577, -8292508, 4766340, -6110665, -86388976, -18185966, 4191888, 36209796, 3357054, -11021423, + 41260140, 28205050, 6873022, 6546067, -4264366, -2872260, -8985608, -7301445, 13414257, 1249836, + 1484985, -13299366, -4207994, -5056787, -1525787, 12252468, -4209605, -8092256, 11424613, 3757023, + -3917547, -3657165, -3826816, -3209951, -4309463, -344134, 1085016, 210453, 2434173, 166967, + 5863167, 4019553, 2141041, -5136781, 5717139, 3247532, 1945083, -1713692, 6942815, -1509681, + -2256469, 3771518, 693100, 4096325, -1570884, -2217277, 137439, 2480881, -792421, -920734, + 339839, 1694365, 344671, 298500, -1297080, -384936, 2441689, -1859721, -1573032, -1660005, + -2127620, 971200, -1348083, -498216, 498216, -330712, 207232, 1549410, 1278827, -1786170, + 1402307, -317828, 917512, 402116, 284542, -984084, + }, + }, + { + { + 255551, -253332736, 31951336, -18279380, 7977902, -760746, 5468030, -18949396, -1925219, -24830280, + -6965363, -15489263, -319438, 2225867, 11463805, -2207076, -7515119, -3291019, -9934259, 2529736, + 3790309, 1900523, -9399536, 4299799, 1935420, 7301982, 437550, -3431679, 4795331, -2927020, + 5717139, 2865280, -228170, -1580548, 15843597, 4649839, 3779034, 424665, -1949378, 1635846, + -4653597, 1083942, 3848291, 3642669, -9058086, 5621039, -5342403, -4980552, -3143916, -3212099, + -1282585, 3623342, -2300492, 3244311, 1346472, -3256122, -3740380, -1440425, 150861, -2025077, + -1715839, -588411, -363998, 852014, 1721745, 5906, 557809, -3394635, 2330020, 3626563, + -942745, 1293859, 1202054, -1751810, -1117765, -392990, 707059, 578747, -137976, -435939, + -2456185, -1766842, 1841467, -350040, -1938641, 638340, 1319092, 917512, -1436130, -425202, + 86436, -645319, -630286, 469225, -834297, 299037, + }, + { + 732292, 14085345, 9034464, 9953587, -12839268, 945967, 520228, 454193, 3465502, 7355132, + -1398549, -1464047, 5980205, -7125888, -12657805, 5527086, -3680787, -14316737, 763967, 12763032, + -4708895, -1346472, -1482301, 14087493, -4557497, 8922258, -11200201, 5682779, -5806259, -1095217, + -16239271, 1664300, -9787157, -4084514, 34897, 551903, 4552666, 7553774, -190052, -1839857, + 4716948, 7168838, 2024003, -2659659, -9171903, -11171747, 5400922, 6735046, -566399, -4075387, + 2488934, -1886564, 2354179, 128849, 5055714, -989990, 3591667, -4504884, -2197950, -873489, + -1058173, 3213173, -1482301, -25233, -65498, -477815, 458488, 2244121, 2496450, 2852932, + 1726577, 1312113, -712965, -1256815, 865973, 38655, -2147484, -1931662, -809601, -932008, + 54761, 1096290, -1591822, 1192927, -243203, -44023, 26307, 529892, -589484, -200790, + -597000, -1057099, -804770, -731755, -242129, -348966, + }, + { + -3968550, -72685880, 5727876, 18524194, -1443109, -5513665, -3346317, -10009421, 8302172, -1639604, + -16464757, 23248658, -8789114, -6228777, 9729712, -1923609, 777926, 26014080, 3693135, -1547262, + 5161477, -11498701, 6601902, 1820529, -3591130, 7948374, -15557445, 3827353, -4006668, -3883187, + 6184753, 12496207, -8366597, 10518375, -2783676, 1143535, -1189169, -2951716, 1955284, 4113505, + 743029, -4957466, -3555696, -91268, -2183991, -565862, -2146410, 4147328, 1855963, -4575751, + -5385889, 983011, -1047435, -273804, -3282429, 271120, -5017596, 2056216, -2641405, 1799054, + 1968706, -1214402, 719407, -3186866, 821949, 2109366, 3695283, 1246077, -2492692, 55835, + 397284, -1667521, 462783, -1096827, -1190243, -3104188, 873489, -2430415, 1367410, -54761, + 712965, -2863670, 149250, 169114, -194884, -1405528, 237297, 1957968, -4295, -902480, + -1449015, 78920, 886374, 44560, -672699, -1611, + }, + { + -24011014, -297949920, 14456323, -1330366, 601832, 1937030, 4675609, -2405182, -7532299, 10035728, + 16310675, -1171989, 8807367, 11227581, -6130529, 3849365, -5027259, 10659035, -1931125, 17275432, + 7092065, -253403, 1879585, -5900748, 2707977, 12366285, -12702903, -9134859, -14411763, -9237938, + -4587562, -2045478, 6210523, -877784, 5570036, 4857071, -6160057, -1530082, -6479495, -7374459, + 11003169, 887985, 3060164, -27380, -10554882, -3118146, 116501, -2241436, 4706211, 1752347, + 2874407, 1786170, -1628330, -951872, -1631014, -2215130, 1159641, -3062849, 5666136, -1848983, + -387621, 1105417, -1269700, -673236, 376883, -167504, -553514, 1549410, -663572, 199179, + 2051384, 1997697, 3325915, -1333587, 659278, -664646, 1840930, 699006, 1294933, 675384, + 769336, -2414309, 465467, 1025960, 59056, -57445, -842350, 83215, -1698660, -1137630, + -71404, 426812, -230318, -315680, 106837, -33823, + }, + { + -1942936, -11636140, 141197, -5860483, -1708860, 1808181, -1228898, -19864, -5451387, -3310346, + -7794829, 587337, -5952825, 4614406, -21454436, 13727252, 3736085, -34569120, 1838246, -13916231, + -3066070, 25710212, -27212376, 4749160, 5669894, -22595286, -8713952, 2386391, 5039071, 9265855, + -4161287, 16474421, -6441914, -15182709, 8622147, 6987375, -2007897, 4444218, 4437238, 1561758, + 4039417, -685584, 6163815, 4562329, 6179921, -2631204, -8922258, -136902, -314069, -4032438, + 1135482, -144418, 381715, -1200443, 1053341, -896038, 4113505, 938987, -3214783, -5717675, + -2695629, -2297808, -219580, 609349, -858457, 836445, -563178, -709207, 226023, -1331440, + 947577, -1847910, 863825, -1241246, -817118, -828929, 819265, -1430761, 249108, 1454383, + 576063, -3231963, -482110, -816581, -1856500, 505732, 441845, 296353, -705985, 603980, + 361314, 740345, -62277, 560493, -8590, -818728, + }, + { + -33925408, -403652288, 14730127, 14885820, 2021856, 2798708, -8160438, 16813724, -10386305, -5212480, + 1198833, -653909, -16575353, -5371394, -9218074, 11537356, -6678138, -16066936, -17269526, -10104984, + 8326868, 3994320, 4672925, -5676336, 2381559, 7007239, 3947075, 7573101, 1187022, -5491116, + -1631014, -1514513, -16330003, 814433, 3826816, -1735167, -4954782, -3854196, 1321239, 301721, + 9236864, 387084, -2634426, 3350075, 3238405, -1851131, -7819525, 1399086, -3513283, -7296076, + 2098629, -2034204, 137976, -1699733, 2315524, 3004867, -2993592, 3694746, -2371359, -39192, + -2273112, 800475, -1177358, -2711198, 4031364, -530965, -1828046, 1874753, -559956, 759672, + -1551020, -1258425, -330712, 10737, -2377265, -957241, -1510218, 2552821, 3142842, -1330903, + 19864, -1089848, -233002, 306553, -676457, 806917, 789737, 126702, -5369, -512175, + -2264522, -1167694, -366683, 375810, -1057636, -210453, + }, + { + 403727, -7232725, 2440078, 3295851, -849867, 22012, 1530082, 1177358, 3091840, 370441, + -7463043, -2830384, -12872017, 15784005, -5145908, 41683196, -13467944, -2005750, 6011881, 20799452, + -6711960, -6444599, 24607478, -36175972, -10950556, -11318313, -1361505, 23193360, -6624450, -15146739, + 9676024, 9443559, 1728724, -4493073, -11585674, -1225139, -4798016, -1393717, 1019518, 1531156, + 1846836, -230854, -2262911, -6798933, -1486059, 3629784, 5674189, -2719788, -1591285, 945430, + 3226594, 1664300, 2092186, 2295660, -3342022, 185220, -525597, -1959579, -1212255, 5396627, + 5094368, 2543158, -39192, -3228742, 138513, -1040993, 1658931, -2386391, 2952790, 1590212, + -122407, -3361886, -2013803, -510564, -1174137, 454730, 1093606, -251792, -796180, -2758443, + 1748052, 649077, 430570, 1064615, 341987, -2676838, 1183800, -243739, -485868, -403190, + 430034, 468688, -31139, -202400, 452582, -1121523, + }, + { + 87199112, -9591736, -33244658, -24223078, 3947612, 4665945, 7199976, -3171833, 2867428, -1501628, + -6772627, 7827578, -6520834, 11599633, -30072288, 3178276, 6187974, -2563559, -741956, 704375, + 2675228, 2516314, 6153078, 7695508, 5834713, -4203699, -2305324, 6485401, -1286880, -8636642, + -14166413, -90194, 2987150, 751619, 2026151, 7817378, 134218, 11039140, -7778723, 4603131, + -4951561, -4773856, -7427609, -697395, -1949915, -3223910, -141734, 7389491, -10038412, -4515085, + 627602, -919123, -4392141, -1423782, -173409, 2167885, 1721745, -2605972, 380105, -127775, + -1907502, -5216775, -3019899, -672699, -3286187, -1129576, 1988033, 3911105, 770947, -400506, + 2651069, -1991254, -2755222, 2435783, -1190780, 1236414, 485331, -1479616, 905701, 252866, + -1414655, -471910, -1662152, -1263794, -40265, 1474248, 27380, -266288, -647466, -869731, + 302258, -140123, 213675, 43487, -535797, 66035, + }, + { + 1183264, -2422899, 4301947, -6109591, 4612795, 348966, 2400887, -921807, -2557653, -911607, + -427886, 1615982, 5315022, 12734041, -45384920, 10688563, -11400991, 5316096, -18301392, 6847789, + 17497696, 180926, 10259066, -33027224, -2698313, -11970611, -13539348, 8705899, -3449933, 6516539, + 709743, -9158481, 2611877, -1774358, 1290638, 3493419, 3820374, 2625299, 6595459, 9840844, + -5847598, 4529043, 5387500, -4718022, 507343, 1580011, 2595234, 169651, -588947, 780073, + 7587060, 52076, 1646046, 2717104, -1662152, -363998, 169114, -3468186, 1580011, 1675037, + 991601, -137439, -3097208, 576599, 4446902, -253403, 3655017, 89121, -255551, -2363306, + -446140, -1471563, -1032403, -464930, 22549, 61203, -910533, 216359, 845035, 1189706, + 1855426, 3884261, -2740726, -367757, -860604, -126165, 96100, 360777, 877247, -1130113, + -180926, 638876, 141197, 444529, -1057099, -280784, + }, + { + 34180960, -23936390, -67143224, 2261300, 16079821, -20580410, -819265, -21876952, 1319092, 646929, + 7576859, -2688650, -3724274, 115427, -11378442, -9981504, -3033321, 5686537, 22112640, 8456791, + 8100309, -2732673, -916976, -9245991, -8470212, 3034395, 12579959, -5619428, -10359461, -5669357, + 7709467, -13278428, 7032472, -2126009, -9042517, 1587527, 8019241, 8975408, -583042, -5689221, + -10901701, -440771, 185757, -2221035, -4872641, 446677, 5573794, -243203, 2021856, -5871221, + -971200, 5427765, -1329829, -4799089, 3373160, -2399276, -2069101, 2368675, 1234803, 1694365, + 5486284, -413927, -1799054, -2280628, -49392, -5660767, -2091112, 4156992, -1702418, -894427, + 842350, 3605088, -312996, -1490354, -197569, -755914, -184684, 548145, -2274722, 584652, + -146029, 2823941, -970126, 3546032, 1779190, 556198, -2139431, -1270237, -1991254, 792421, + 430034, -88047, -1015223, 243203, 386010, -1442035, + }, + { + -1453846, 50971600, 6870337, 8400956, -1006633, -2891587, 11889543, -1322313, 6065568, 1557999, + 4557497, 15377057, 5500780, -17725330, 1326071, -6257231, -132070, 4894652, -37461240, 9659918, + -5656472, -10166724, 4852240, -2076617, -5858336, -4341675, -5164162, -7882339, 573378, -7555385, + 7305740, -13325136, 271120, 4825933, -9715753, -4336843, -3806952, -2840047, 6940131, 12808666, + 8462159, -2026688, -1994476, -1724966, 2042794, 8705362, -1865090, 9715753, -1413581, 2894808, + -6191732, -341450, 4827543, 1188632, -3410204, -6762426, -842350, 1364189, -585726, 5589363, + -5404680, -295279, 5547487, 4548907, 622770, 392990, -5225902, 1845762, 1306744, 788663, + -3160559, 320512, -1848447, -564251, -1580011, 343597, -1387811, -89121, 879395, -1465121, + 2204392, 984621, -3131031, 828929, -1387274, 238371, -962073, -324807, -533113, 969589, + -536334, 186294, 875100, -2015950, -588947, -106300, + }, + { + -6385543, 223364608, 16920560, 4106526, -6701223, 21663278, 21103858, 3599720, -1229971, 11440719, + 9619116, 11285027, 6550899, -897648, -25004226, -1683090, 4487167, 2741263, -10003516, 2000918, + -10369662, 9871445, -5766531, 10866267, -12479027, -6933151, -10382010, -1683090, 2072859, -111669, + -8526047, 4277788, 5806259, -447750, -2769717, 3486440, 1698123, 3564823, -4977330, 1762547, + -2615635, 1484448, 8732742, -5553393, -6398965, 5396090, -8930848, -600222, 10649371, -3699041, + -1378148, 2117956, -3846680, -2573759, -3349538, -6966437, -2144263, 307627, 122407, -4223564, + 2336999, 3613141, 504122, -1394791, -1504312, 359167, 183073, 2302639, -1704565, -1323387, + -343597, -2029909, 1728188, 1774358, 1625108, 810675, 2331094, 833224, 2453500, 325344, + -506269, -812823, 2648384, 639413, -23085, 767189, -209380, 1288490, -301721, -127238, + 501974, -1371168, 41876, -573915, -791348, -124554, + }, + { + -2505040, -31853624, 4572530, -5710159, -185220, -8258685, -488553, 8747775, 1792612, -7384660, + -4875325, -5426155, -6828998, -9303973, -54526220, -5751498, -1402307, -4414690, 18172544, -16198469, + 9627169, -32904282, -13173202, 10599442, -12875775, 4108136, 22661322, 16667157, -11780022, -6588480, + -9914932, -4290136, 12691091, -15430207, 5291400, 1431298, -2618856, -8183524, -4697084, 1851131, + -1294933, 3702262, -3330747, 171799, -630286, -2212445, -853625, 548145, 1637456, 2642479, + -747324, -1880659, 4420058, -674310, -1320166, 5129265, 5393942, 3066607, 2471217, 4975720, + -2413772, -35970, 3425773, -2759517, -3740917, 1569811, -599685, -1277216, 518617, -411780, + -3473018, 2368138, 428423, -9664, 1069447, 1459215, -1465121, -975494, -1172526, -1933809, + 14496, 1698660, 2252174, -1063004, 409633, 421444, -74625, 732292, 1265942, 892816, + -832687, 39192, -172872, -755377, 814970, -570157, + }, + { + -32857574, 51849384, 9971303, -29685740, 14685567, -16546898, 8372502, 2255395, 3115999, 5837935, + 9724880, -21233782, -12805982, -26264262, -14595373, 17220672, 19696720, -7701950, -17534204, -2129230, + 250182, 496606, 4958540, -3486977, -630823, -7019587, -7158637, 1414655, -701153, 7835631, + -1879048, -10085657, -2603287, -7237557, -3788161, 4442607, 479426, 8541079, -8987756, -2956548, + 11711302, -1358283, 1902671, 7253663, 6654515, -3579318, 595927, -6810208, -7431367, -3956739, + -1306207, -1679332, 121333, 62814, 1656784, 578747, 659814, -2755759, -2463701, -1065152, + 4165582, 1488206, 1955821, -409096, 2747169, 3578245, 4594542, 3091840, 4814122, 597537, + -2590939, 1852742, -1845225, 558346, 115427, -453119, 297427, -1759863, 306016, 1976222, + 763430, 765578, 1615982, 976568, -373662, 906238, -105764, -916976, 758062, -30065, + -554588, -994285, 79457, -117038, -35433, -588411, + }, + { + 2828773, -60342680, 8106751, 1165010, 10065793, 1924682, 6001143, -1709934, -6163815, 6942815, + 3252364, -2673617, 6887517, -51484848, -41808824, -29317446, 36089536, 16250546, 19699404, 5735392, + 2419140, 29333552, 11184632, 12569222, -8125542, 2330557, -13766444, -8669928, 13731010, -8257612, + -1380832, 736050, -1722819, -2888366, 2411087, 1495186, 817118, 4151086, -3260417, 4172024, + -3999688, -5509906, 620086, 2360085, -11685532, -785979, 2512556, 4823249, -3077881, -1032403, + 2679523, 3644280, 8053, 2967823, 4938139, 2503966, -1256278, -1736777, 3786551, -152471, + -2339147, 5394479, 2942590, 1230508, -257161, -2018098, 2796561, 1593433, -3200825, -1819992, + 1276679, 1089848, 1331977, 386010, -2266132, 622233, 2192581, -1406065, -1626182, -1541893, + -344134, -1565516, -769873, -110059, 96100, 379568, -12885, 1196685, 363462, -466541, + -370441, 526670, -286689, 714575, 162135, 1055488, + }, + }, + { + { + 792958, -284313952, -28560996, -21189758, 2056216, -11126650, 4334696, -11194832, -4807679, -16561931, + 1730335, -26154204, -8393440, 5810017, 15590194, -12287901, -7234336, 1774895, -9058086, -8847096, + 733366, 7218767, -8415452, 5952825, 1577327, 7538742, 1230508, 4493073, 1843615, -16193100, + -7904888, 1532230, 10358924, 1117765, 9562208, -2103460, -1114544, 4544613, 6174016, 2665564, + -5027796, -2471217, -5897527, 1437740, -10503879, 2711735, -2325725, -4488778, -4240744, -7028714, + -4842039, 2310156, -3690988, 2384781, -285615, -3837017, -2426657, 454730, -1167694, -1544041, + 4719632, 1512365, -2479807, -2975339, -1178432, 340376, 2602213, -2933463, 199716, 703301, + -2201708, -774705, 419296, -1434519, -1027034, -933082, 677531, 611496, 608275, 1527398, + -52613, 292595, 2019172, -805306, -1423245, 590021, 687195, 760209, -594316, 726386, + 494995, -89657, 39192, 784905, -351114, 1180579, + }, + { + 232465, -12226698, -14989436, 16798690, -1582696, -1255741, -1874216, -1540283, -5210869, -6477348, + -11713986, -3779034, 13887240, -515933, -4524211, 14596446, -711891, -4822712, -9508521, 1821066, + -118112, -5910412, 2792266, 7754564, -28309204, 11344082, 1745904, 18329846, 3102040, 4005057, + -9719511, 6560026, -826781, -423054, 4909148, -929860, 7789997, 7248831, -1751810, -1879585, + 146566, 5478768, 2580739, 377957, 1685775, -2959769, 3551401, 34360, -4199405, -5761162, + -33286, -3182034, 2691871, -500901, 3129421, -6693707, -474594, -1582696, 4770635, 1948305, + -1670742, 665720, -1984275, 1613834, -1145146, -761820, 879931, 2268280, 1018444, -165356, + 1079647, 2215666, -4031901, -3830037, 969052, 888521, -265751, 398358, -62277, -55298, + 239981, 288300, -1155883, 2077154, 338766, 513249, -10201, -20938, -512175, 825707, + -580357, -1200443, 177167, 216359, -193810, -471373, + }, + { + 3318399, -62000536, -1871532, -4825933, -14368276, -2672544, -2571612, -12885976, 6971269, 6245956, + -7932268, 9031242, -17302276, -2172180, 21641266, 8713952, 6715718, 20880520, -5318244, 2746632, + 13945222, -1404454, 7365332, -10248866, 3549791, 20732344, -15293305, -2652679, -3973919, 2789045, + -4247723, -2318209, -9446781, 619549, -6516003, 1689533, 1543504, -1053878, 184684, 1441498, + 648003, -2617246, 827855, 2382096, -2692945, -927176, 1735167, 4709432, -2631204, -2781528, + -46708, 575526, -2390149, 1495186, -1878511, 1222992, -981937, 5280126, -1374926, 1052804, + 745177, 259846, 2734284, -1859184, -537, 1932735, 2982855, 514859, -989453, 857920, + -927713, -1749662, 2457795, 740345, 2415919, -862752, -1192390, -2986613, 3197603, 1250909, + 1993402, -2717104, -552977, -347355, 827318, -679679, -316754, 873489, 479426, 732829, + -1381906, -285078, -326418, -471910, -406948, 176094, + }, + { + 43122544, -260294352, -16658568, 22654342, 10446971, -1852742, -4373888, -7585449, -379031, 4228932, + 1635309, -9078487, 3157875, 2069101, -23130546, -9551470, -13471702, -5260798, -9748502, 9482214, + 725313, 9391483, 11624329, -6220724, 5187247, 10611254, -9436043, 4160213, -3675955, 5047661, + 4490925, -3795141, 4589710, -3322157, 4462471, 4464082, -6631430, 2029909, -1316408, -1005559, + 8518531, 251256, 4596152, 4430259, -7002944, -1129576, -2379412, -8704288, 2080375, -1145683, + 5706938, 5598490, -3208341, -972273, 2300492, 3622268, 5885716, -3580392, 3374771, -1496796, + 3555696, 4796942, -2963528, -1847910, -12348, 1763621, 2268280, 2856153, 299574, 792958, + 1531693, 306553, 678068, -1707786, 1649268, -699543, 1780264, 149250, 373662, -658741, + -133681, -2244657, -93952, -244813, -619549, 108448, -1625108, -107911, -693100, 99858, + 598074, 857920, 301185, 45097, 1264868, 666257, + }, + { + 1201517, -20895552, -9480603, 413391, 3850438, 845035, -1572495, 6214818, 1694365, 1647657, + -5300527, 187905, -12548284, -8405251, -26530550, -2383170, -12070469, -7741142, 42171212, -6841883, + -4582730, 19470698, -24819006, 4162897, 955093, -6267968, 5491653, -117038, -2261837, 7773891, + 4509716, 14681272, 2368138, -5362804, 578747, 3579318, -1688459, 8250632, 8011725, 2874944, + 5786395, -6144488, 2980707, 7782481, 8709120, 1101122, -5979668, 4201015, 7762617, 967441, + 5315559, -633508, -625992, -601295, 1250909, -2246268, -328565, -870268, -965294, -900333, + 856309, 73014, 2295123, -562104, -1285806, 1704028, 1549946, 1802276, 877247, -1585380, + 1094680, -930397, 1861332, 216896, -570694, -584116, 2181307, -228170, -712965, -641561, + 909996, -1129576, -49392, -758062, -1216550, 162672, -519154, -68183, -581431, 1128503, + 601295, 729608, -1149441, -114890, 345745, -40265, + }, + { + 60972428, -328603648, -20302848, 23801636, -2189897, 269509, -3550864, 24013700, -9729175, 1777580, + 4490925, 10050223, -1846299, -3881040, 5020280, 16212428, -8369818, -7485055, -3456912, 2612951, + 12461848, 5697811, 3704409, -7652021, -1034550, 5743445, 5013301, 11218991, 4718559, 2880849, + 1532767, -4565014, -18330920, -5741835, -3019899, -6932614, -6649146, 570694, 1386201, -4824859, + 6431177, 3295314, -1153736, 4233764, 11039677, 6591164, -7838852, 1030792, 2888366, 2645163, + 5235029, 1047435, 1027571, 1121523, 3401614, 1808718, -5815386, 446677, -3925600, 1459215, + -1371168, 3060701, 2794413, -777389, 2473364, -390305, -373662, 768799, -1314260, 2102923, + -608275, 763430, 4832, -730144, -1089848, -601832, -1687922, 676457, 1893007, -1240172, + 1489817, 172336, -1381369, -81604, -329102, 892816, 433792, -249645, 356482, 312459, + 272730, -6979, -543313, 389231, -423054, 96637, + }, + { + 105764, -13833016, 6254010, 6109054, -801548, -841277, -479963, 2581275, 4049617, 2498597, + -657667, 4996121, -4799626, 29331942, -3927211, 10153840, -30853434, -1158031, -8428873, 11485816, + 5841693, 9225053, 25732222, -31772558, -8469139, -9717900, -15861851, 17813376, -2511482, -19593104, + -2299418, 1699733, 2434710, -3003793, -6395207, 533113, -2620467, 236223, -2068564, -2274722, + 310848, -1642825, -631360, -722091, -3125663, 2065879, 6268505, 1770063, -21475, -1717450, + -9127, 1318555, 1360968, 592169, -3629247, 2283312, 799938, 2147, -1266479, -1516660, + -1061931, -1517197, -637803, -2596845, 216359, -1561221, 2381559, 593779, 4740034, -53687, + -1207960, -1382443, 129386, -943819, -1174674, 506269, 119185, -578747, 179315, -1960116, + 1118302, -693637, 572841, 457414, -488553, -712965, 1460826, -801011, 1228361, 159988, + -316754, -410706, -623844, 272730, 148713, -1196685, + }, + { + -74568688, -150067232, 11241540, -49376016, 108448, 3248606, 9047349, -678068, 1865090, -625992, + -6866042, 3891777, -4230543, 23800024, -17091822, 2161442, 19248970, 5978058, -12069932, 2347737, + 8045011, 4075924, 7468948, 5838471, 5901822, -2021319, 4910222, 6393596, -955093, -5229660, + -9627706, 1653026, 6600291, 622770, 1566053, -1687922, -6258841, 10192494, -8148627, 5885716, + -3323231, 317291, -5878737, 4365298, 4217121, -421981, -4614406, 8953933, -620086, 3073586, + 7878581, 5224828, -2262911, -944356, -213675, 3746822, 3856881, -3591667, -306016, -2139431, + -3747359, -3958349, -1647120, -397821, 566399, 971736, 969589, 2480881, 1121523, -2551211, + 932008, -866510, -3115462, 1083942, -2464774, -627065, -1353452, -1842541, -175557, -665183, + -804770, 1706176, 427886, -217970, 250182, 666257, -84826, 1260036, -4832, -1397475, + -858993, -1133335, 308701, 349503, 109522, 1513976, + }, + { + -56371, -12335683, 7082401, 2109903, 6939594, -666257, 1661079, 567473, 1233729, -506806, + 1228361, 3709241, 3125663, -9775346, -69837240, 4440996, -20075214, -1356136, -18289582, 23190140, + 16389595, -15643882, 15648713, -37316824, -12759274, -5110474, -13981729, 11773042, 6958921, -2039573, + -1730872, -4355634, -1889249, -10038949, 6614250, 7226283, -5134097, -471373, 9954124, 7806640, + -7605314, 5883569, 4399657, -1421097, -3360812, -5574868, -1195075, 343061, 143345, -3138547, + 2568927, -6017786, -2233920, 3458523, 130997, -1917166, 1599875, -952409, 2709588, 207769, + -429497, -1884417, -3855807, -6979, 674847, -2437931, 1318018, -863288, -105227, -1525787, + 1408749, -1748589, 659814, 1375463, 311385, 2093260, 949188, 297427, 1764695, 530965, + -27380, 2284923, -2678986, 358630, 717796, 709207, -1196685, -396748, 1772211, -1167694, + -368830, 1780801, -183073, 485331, 284542, -435402, + }, + { + -32006634, -12793634, -3519189, -4419522, 9408663, -147640, 30983894, -5019206, -1591822, -41876, + 10553272, -1096290, -13629005, -7096897, 448287, 2352032, -9337259, -2557653, 1924682, -10849624, + 1605244, 6005975, 4279398, -4151623, 7972533, 7622493, 6167036, -6438156, 2816962, 3151432, + 5507759, -11657078, 12233677, 1546725, -13200582, 768799, -5295695, -5514738, 3139084, 7940858, + -4122632, 865973, 3363496, 2355790, -1695975, -6258304, 4279935, -630286, -459025, -3343095, + -868120, 537, -1686312, -1064615, 4924180, -3518115, -2675228, 3604551, -476741, -1084479, + -1065689, -3677029, -783295, -1872606, 320512, -4655745, -1815161, 2360622, -1386738, 948651, + -1029182, 751082, -533113, -1789928, -127775, -809064, -491237, 1980517, -537945, 1946694, + 20938, 2772402, -1996086, 1959579, 476741, 1923609, 888521, 608812, -960999, -183073, + -1413581, -242129, -1571421, -273804, 1349157, -109522, + }, + { + 2048163, 27309012, -14113799, 1403917, -5037460, -10131291, 1450625, -3283503, 7462506, -8294119, + -9301289, 6106907, -127775, -12284680, -3899830, -6279779, -4474282, -142808, -32311576, 14776835, + -5633387, -5252745, 8413841, 6581501, -113817, -12083890, -11208254, -4127464, 11574400, -4211216, + 2645700, -9942312, 2066953, 740882, -4119411, 1059783, -5888400, -5907191, 1654099, -381178, + 302258, -3598109, -4151623, -628676, 2916283, 4059818, -6933151, 7190312, -2310693, -2722473, + -10595684, 1239098, 3281355, -340913, -4095251, -6293201, -877784, 1247688, -250719, 6897181, + -1751273, -2070711, 697932, 3231963, 781147, 3099356, -3182034, 447213, -331249, 922881, + -1461363, 3426310, -183073, -1175747, -1412507, 1972464, -868657, -600222, -155693, -2236067, + 877247, 518080, -3205656, 1222455, -1357747, 1009854, 343597, 289910, -695785, -852551, + -666794, 1226213, 1647120, -1076426, -311922, -315680, + }, + { + -30332670, 205869600, 20309826, 3735011, -9598178, -2123861, 4093104, 7165616, -10263361, 3983582, + 4771709, 1940788, 8942659, 4509179, -19239842, -3548717, -2474975, 703838, -12972949, -1278827, + -4876399, 13399761, -12412992, -2503966, -2861522, 11778948, 2930778, 2312303, -1404991, -519691, + -5882495, 4947803, 2007897, -5880884, 8588861, 1915555, -13972602, -2724620, -7569343, -1843615, + -1785096, -384936, 3968550, 1581085, -4151623, -1010391, -13537200, 1114007, 12681965, -2032056, + -6485938, -5727339, -3564286, 2697240, -3731790, -4760435, -1061394, -2356327, -3173444, -7056095, + 3759707, 4511327, 966368, -1183800, 55298, -1888175, -2931852, 3332895, -153545, -2159832, + -2077154, -2212445, 1357747, 926102, 2217814, 1603097, 2430952, 1224066, 1949915, -96100, + -59593, -1324997, 2595234, -73551, -887448, 712428, -494995, 816581, -1299765, 780610, + 745714, -1675037, 688805, 119185, -410706, -1073742, + }, + { + 1986959, -50778324, -10514617, 6194954, 5182415, -5625334, 5488968, 6705518, -2743410, -10136123, + -280784, -2252710, 10242960, 7875897, -24151138, 17336098, 19470698, 5849209, 15049565, -17251274, + 26014616, 5522254, -10153303, -14526116, -24947854, 2960306, -876710, -242666, -2909840, 7987566, + 1225676, 726923, 7041062, -24385750, 2153926, -6128919, -3620658, -2558727, -5084168, -2142115, + -1204738, 7744900, 5081483, 5521718, -1683090, 5354751, 3459059, -82141, -1498407, 2950106, + 5299990, -1784559, -643171, -673773, 1020055, 3492345, 1341640, -2764885, 77309, 2334852, + -3427921, -351114, 5658620, 1227824, -1507534, 2444373, -1817845, -4646618, -795643, -667867, + -2356327, 2069637, -1018444, -1571421, -2251637, 1667521, -1151588, -2054605, -663036, -1328756, + -1357210, -1650878, 364535, -2062121, -49392, -712965, -1349157, 896038, -504659, -336618, + -482110, 213675, 342524, 361851, 1036698, -517544, + }, + { + 18741626, 120687504, 10581726, -19832548, 17694192, -28229210, -10350334, -11126113, -2381559, 7979513, + 11653320, -24515136, -1968169, -1571958, 10725607, 15402826, 24035174, -292595, -11339787, 8179229, + 7781944, 4811974, 6375879, -1475321, -3794604, -7384123, -2679523, -3809636, -3444027, 1379758, + -4849018, -5448166, -916976, -11702175, -4866198, -1183800, -11576547, -2662343, -11819750, 485868, + 12254079, -10860362, -2994666, 1227287, 1415192, -9179956, -4081830, -1560147, 3491809, 7427072, + 8150774, -1352915, -4144107, 5694590, 7570417, 549756, 1227824, -3500935, 252329, 961536, + 912681, -94489, 950262, -1179505, -867583, -1548336, 1334124, 1090922, 1533840, -26844, + -2008434, 1415192, -1649804, 802622, -118112, -887448, -105227, -870268, 1606855, 1523103, + -956704, -574989, 1032403, 1709934, 358093, 1504312, -811212, -1287417, 398358, -1071594, + -109522, 201863, -199179, -64961, 311385, -355409, + }, + { + -3604551, -56316148, 14999100, 1649268, 5236639, -8167954, 1291175, 2178085, -2909840, 6117644, + -4933307, -7812546, 9263171, -4950487, 32597192, -22196390, 20557860, 4929549, 6273337, 5159330, + -3007014, -1915019, -17855790, 8738111, 77309, 5427765, -13429289, -7359964, 2134599, -14059039, + 8489540, 6290517, -159451, 2348273, 3246459, 501437, 11355894, 9439264, -7541426, 5257040, + -3202972, -4450123, 2767033, 1182190, -10062035, -4031364, -856846, 1927367, -3481608, -575526, + -2578054, 163746, -2161979, 3000572, 5281199, 1304596, -1884417, -869194, -653909, -2013803, + -2982855, 2652142, 1415192, -71404, -1129576, -1206349, -759136, -1309428, -2021856, -4499515, + 509491, 896574, -166967, -888521, -609349, 1890323, 194884, -658741, 1506997, -96637, + -118112, -1986959, -45097, 1947768, 2046552, 326418, -289910, -340376, -1528472, -1285806, + -1360968, 57982, -433792, 12348, -284005, 1519882, + }, + }, + { + { + -456877, -149100320, -129279592, 1933809, -26450020, -2972654, -1858647, 2414845, -10599979, -1469416, + -11051488, -16430397, -21800180, -752693, 24366424, -13361106, -6267968, 205085, -2709588, -15932181, + -2928094, 6587943, -742493, -4588099, 1128503, 7617662, 4910222, 10635950, -7598871, -5376762, + -13665512, 33286, 9452149, 7374459, -1132798, 1735704, -2089502, 5965710, 4580583, 607201, + 1989107, -4350802, -7880728, 926102, -2644626, -6394670, 2252174, -6212670, -3026878, -5604933, + -1376537, -5436892, 683437, -3106335, 641561, -620623, -764504, -1218697, -1565516, 1560684, + 2000918, -619549, -2179159, 31139, -2377265, 1096827, 1260573, -2087354, -1369558, -389231, + -1130650, -798327, 1127429, -1396401, -1428614, -1001801, 1076426, -61203, 1337346, 1562831, + 880468, 210990, 551366, -1068373, 343597, 404801, -509491, 1293859, -300111, 794032, + 488016, 51540, 20938, 289373, 534187, 554588, + }, + { + -1223529, -15771120, -8932458, 950798, 10409390, -856846, -2067490, -150324, -2844342, -6533719, + -17442936, -4635344, 9496710, -5539434, -1410360, 9360881, 7134478, 1601486, -20300700, 5757941, + -4789426, -6015639, 11200738, 9096204, -28865938, 6854231, 12324409, 7055021, 4451197, -2090575, + 8245801, -9033927, 9374840, -1666984, 9942849, -2163053, 2598992, 3322694, 1870458, -1919314, + -668404, 5216775, 5068062, -2418604, 3288334, -1069447, 454193, -3307125, -183073, -3066070, + -5464272, -336618, 2623151, -45634, -2742874, -2333241, 940061, -986232, 5326833, 887448, + -1774358, -1922535, -594316, 3289408, -1294933, 667867, -316217, 1388885, 2344515, -1570884, + 771484, 1204738, -3156264, -2985539, 950262, 115964, 223338, 992137, -141197, -47245, + 927176, -1215476, 141197, 1190780, 1316408, 685047, -1097901, 63351, 219043, 765578, + -792958, -867583, 531502, 175557, -825171, 482647, + }, + { + -2067490, -24927990, -23626616, -20511690, -443455, -3700651, -1726040, -3206730, -1944547, 817118, + 6829535, -7290707, -4489315, -5478768, 12643310, 15889232, 7216619, 21902722, -18066244, 10536092, + 10936597, 6292127, 358093, -4379793, 10761041, 8236137, -5363341, -4372277, 2862596, -815507, + -6702834, -2943126, -4330401, -10660109, -4898410, 1781338, 4784594, 427886, -845035, -1054415, + -1611150, 2020782, 2882997, -1181116, 1770600, -2574833, 3435974, 3794067, -4601521, -2479807, + 2952790, -1552094, -1190243, -2536178, 2109366, -1287417, 3062849, 562641, -117038, 755914, + 2293513, 91268, 2161442, -1788854, -667867, 2863133, 1290638, -1040456, 824634, 1018981, + -934155, -888521, 1657321, 250182, 2123861, 1208496, -3209414, -1407676, 1261110, 1129576, + 1774358, 5369, -1520418, -128849, 469762, 140660, -466541, 248571, 554588, 755914, + -327491, -890669, -1079647, -1068373, 447750, 644245, + }, + { + -50762220, -185044368, 24664386, 49833968, -12402255, -542777, -4167192, -5697274, 4534412, -6724308, + 2881923, 2598455, -4683125, -6798933, -21949430, -3077344, -22525492, -6447820, 1122060, 124017, + 4207994, 8283918, 9492951, -6330245, 424128, 6292664, -1135482, 3680787, 1926293, 2812130, + 9658308, -5663988, 3296388, -424665, 1257889, 1363652, 937914, -622233, -3810710, 5095442, + 628139, 4105452, 4647692, -1950452, 799401, -336618, -5794985, -5495948, -2281702, 3801583, + 2375654, 6813429, -1582696, -2508261, 4958003, 3893388, 2477123, 913217, -2568927, 1089848, + 3251827, 3978214, -1045825, -2148021, -1510755, 2855617, 2917357, 1419487, -335007, 1754494, + 503585, 330712, 605054, -271657, 143345, -413391, 1402844, 1062468, -139586, -309775, + -871342, -253940, -1613297, -935766, -610422, 479963, -693100, -884763, -223875, 157840, + 657130, 467615, 370441, 523986, 580894, 716723, + }, + { + -643708, -34526704, 4282083, 5663452, -26844, -366683, 1162862, 3773129, 4313221, 390305, + -3694209, 2664490, -7097434, -9627706, -20715164, -28564216, -16499654, 39346196, 6025302, 3100967, + 2647847, 9729175, -8587787, -10107669, -4247186, -11308112, 22636626, -7455527, 1057099, 4963372, + 6125697, 6803765, 2711735, 4138201, -1125281, -818191, 2289218, 6367289, 5040144, 3794604, + 3458523, -3655554, 5873368, 4899484, 2546916, 3630858, 496606, 959925, 5243618, 5554467, + 4842576, -1199370, -1076426, -529892, -378494, -2501282, 322123, -1491964, -1647657, 1671279, + 3120831, -2811593, 3402688, -956167, 1872069, -1810866, 1061931, 3621731, 392990, 769336, + -941672, 315143, 456340, 2131915, -1137093, -155693, 1463510, 751082, -1002338, -1158031, + 683974, 468688, -503585, -677531, -875636, -224412, -267899, -39192, 215822, 243739, + 692564, 564788, -818191, -45634, 536334, 119722, + }, + { + -70165272, -201386192, 14257681, 5180268, 12611635, -306016, 13483513, 7443179, -8581882, 11998528, + 3136400, -6408091, 11938398, 195958, 2983929, 7167764, -5494874, -2240362, 1153199, 13470628, + 2931852, 2949032, 3240016, -2391760, -6222871, 1159641, 8331163, 4211753, 10266046, 9009768, + -2413235, -7791608, -11868068, -7998303, -6481643, -4539244, -1723356, 1938641, -3161096, -4823249, + 1256278, 4395362, 5000953, -1199907, 8923331, 5559835, -5489505, 581431, 3862249, 4052302, + -120259, 4793184, -1750736, 6739341, 134755, 1366873, -1610076, -615791, -3174518, -361314, + 1014149, 560493, 1531156, 3025805, -1596654, -616328, 1884417, -755377, 701153, 432181, + -56908, 1405528, -1889249, -26844, -345208, -107911, -1100049, 394063, -151934, 332860, + 745177, 1535988, -1466731, -734439, 31675, 813359, -12885, -343597, 75162, 1328756, + -187368, 152471, 24159, -169651, 476741, 62277, + }, + { + -484258, -12397960, 6337224, 1298691, 3925600, -844498, -1124745, 3361349, 1862405, 576599, + 3629247, 4002910, -74625, 5081483, 5597953, -15367930, 1452236, -1591822, 769873, -607738, + 7234873, 6254546, 20937966, -4378183, -17690434, 730681, -20944944, 4101694, -5190468, 1740536, + -7757248, -6087580, -1217623, 6231998, 112206, -7284802, 1075889, 1174674, -3262028, -3322694, + -102542, -1637993, -1422708, -1389422, -565325, 3979824, -132070, 5702106, 1435593, -1680943, + -1603097, 1796907, 949725, -2770791, -323733, 1074279, 1857573, -3379603, 3031710, -3180960, + -2213519, -654983, -934692, -1273995, -174483, -46708, 1688459, 1219771, 3314641, -1062468, + 118112, -836445, 184684, -1138703, -169114, -827855, 791885, 261993, -226023, -851477, + -496606, -825171, 1460826, 206695, -519691, -117038, 746251, -620623, -22012, 870805, + -57982, -1120987, 318901, 255551, -637803, -208306, + }, + { + 48508972, -232052256, -38760468, -50966228, -10098005, 3468186, -1574106, 3856881, 3599720, 7152195, + -2062121, -11774116, -3141769, 7592966, 15353434, -9999221, 7988639, 13290239, -9242770, 6672232, + 5880347, 4608500, 4502200, 4561792, 2369748, 1414118, 8082592, -471373, -3253438, -4795331, + -1909113, -259846, 3648575, 3273302, 1108102, -1298691, -4128537, 3342022, -1056025, 1881196, + -3642132, 1089848, -1245004, -624918, 7982197, -3158412, -2856690, 8277476, 2934000, 5835250, + 6728067, -373125, 1739462, 72478, 624381, 3406446, 1096827, -4874788, -927713, -2633889, + -2638721, 448287, -1577864, -753230, 525597, 2509335, 741956, -1119376, 2485176, -1185411, + -1031329, 244813, -1044214, -1658931, -1027571, -1658394, -1327682, -521839, -2039036, -514322, + 523449, 955630, 376883, 55298, -417686, 1400696, 119722, 227096, 1051193, -1181116, + -1316944, -260382, -178778, 390842, -484258, 1189706, + }, + { + -1098438, -361851, -5362804, 10003516, 1128503, 116501, 605590, 1711008, 1222992, 911607, + -1218160, 4608500, -1447404, -2557653, -53888416, -30093226, -16087874, 4174171, -11090142, 25682830, + 11785390, -17898202, 3735548, -5840619, -24065776, -10558103, 2210298, -6536404, 13484050, -7183870, + -3882114, 3710315, -4080756, -9477919, 11218455, -2723009, -2729452, 3737159, 3780645, 8569533, + -408559, -437013, 4951024, 1195612, -6127845, -4684736, -3281892, -785979, 518080, -405874, + -665720, -4830765, -2820183, 1744831, 162672, 335544, 2457795, -120796, -132607, -471373, + 919660, -2798708, -1411971, -2187749, 157840, -807454, -1298154, -522375, 1433445, -1739462, + -217970, -1211181, 854699, 1571958, 1112933, 817118, 1968169, 164819, 1066763, 896038, + -544924, -1001264, 525597, 683974, 532576, 383863, -1050656, 52076, 971200, -627602, + 632971, 209380, -9127, 276489, 967441, -201863, + }, + { + 29383482, -13627931, -57869316, 13467407, -3045132, 6312528, 26089778, 2859375, -8737574, 8589935, + 2915746, 6930467, -13535589, -18662706, -6647536, 1844689, -657667, 4976257, -12890807, -49392, + 3932580, 2507724, 1265405, -3790309, 13616120, 9154186, -449361, -2602750, 5743982, 1074279, + -8443369, 4327180, 2038499, 7209103, -8310762, -5551245, -6161131, -4599373, 3958349, 6034966, + -1345399, 145492, 1684164, 1787243, 5487358, -5440113, -3901441, 1573032, -1977833, -1794760, + 4062502, -4676683, 351114, 508954, 404264, -17717, -4489852, 2358474, -246961, -1491964, + 518080, -3998615, -2592013, 185220, -1758252, -2291902, 159988, -574989, 1641214, -938450, + 352187, -147640, -1000191, -1850057, 1634772, -1058173, 463856, 355945, 239444, 843961, + 1790465, 1313723, -500364, 982474, 1000727, 799401, 933082, 541166, -338766, -199179, + -1684164, -96100, -1663226, -55835, 521302, 1022202, + }, + { + -2288144, -4282083, 15157476, -2231236, -2317135, -1479616, -9292162, -4700305, 809064, 2885144, + -2747705, -9282498, -4348655, -9808632, -5506685, -1726040, -9074729, 6612102, -9569187, -7473780, + -2135136, -443455, 571231, 6936372, 4868883, -5403606, -14007499, -1828046, -1182190, 7699803, + 1204202, -5560909, -869194, -1636919, 5734318, -10703059, -1540283, -5418638, 1698660, -1990181, + -6629819, 4691715, -6172405, -1180042, 1884954, -950798, 2093260, -2391760, -2280091, -4134980, + -3652870, -427886, -818191, 1724966, 281857, -7824357, -1175210, 556198, 351114, 3684545, + 3163244, -1697586, -960999, 1685238, 2622078, -449361, -722091, -402116, -649077, -154082, + 373125, 2268817, 547608, -388695, -944893, 398358, 440234, -591095, -749472, 146566, + -1619740, 156766, -720481, -394600, -505732, 457414, 343061, -110595, 278099, -818728, + -861678, 1004486, 1321776, -399969, -243739, 140660, + }, + { + 55097988, 108452216, -1363115, 1680943, -5108864, -6706055, 1983201, 2656974, -8121783, -2072322, + 12831752, 4656282, 3497177, -5441187, -2385318, -9740449, 1115081, -3083250, -15083925, -148713, + 6323266, -1425929, -2902861, -8517994, 15104326, -1792075, 13739064, -3883724, -1705639, -6256694, + 3489124, 450972, -1997697, -5841156, 4828080, 4078072, -8931921, -3320547, -7466801, 91268, + -4799626, 4510790, -2639258, 2451890, 2738579, -9737765, -10524817, 5218922, 3561065, 498216, + -4027069, -7246684, -1488743, -1400696, -1162862, -2282775, -3776350, -1425392, -4034585, -3163780, + 3897146, 2308545, 625992, -294205, -760209, -392990, -3221762, 931471, 959925, -2172717, + -1765232, -493384, 529892, 1078574, 1340567, 1532767, 1738388, 1668595, 1986959, -759136, + 121333, -357019, 1123671, 1282585, -1152125, 169114, 592169, -289910, -1621887, 1439351, + 384400, -1404991, 10201, 620623, -522912, -827855, + }, + { + -1118302, -54681912, -2930242, 5501316, 3476239, 1396401, 3069291, -175557, 908922, -10009421, + 1114007, -2946348, 8560944, 24438900, 9742596, -22241488, 17591650, 3648575, -1700807, 4481799, + -11746736, 31153008, -4295, -18853296, -18865644, -3197066, -7745437, -7796977, 7270306, 11577621, + 4221416, -8473970, 4887136, -6869264, -5637145, -8505646, -2582886, 2914135, -213138, -7314330, + 386547, 2418067, 9625559, 5399848, 2039036, 1713155, 3410204, 363462, -791348, -214212, + 6868190, -799401, -884226, 96637, 646393, 875100, -1305133, -1871532, 1010391, -944356, + -592169, 444529, 4518843, 814970, -1198296, -192737, -549756, -4274566, 867047, -1024350, + -2077154, 37044, -467615, -1235340, -1858647, 813359, -82141, -2690260, -1480153, -201327, + -1511829, -1949378, -1202591, -19327, 115964, -1328219, -929860, 475668, -1209570, -651761, + 13959, 388158, 280247, 180926, 751619, 330712, + }, + { + 3792456, 139589120, -2181844, 11089606, -7197292, -15275051, -13290239, -6674916, 1625108, -4611185, + 17920752, -21294984, -394063, -4701916, 21357262, 757525, 15707769, 7739531, -6256694, 6787659, + 9456444, 7969312, -2680060, 1312649, 820876, -4112431, -7174743, -5208185, 3568044, -8910447, + -4033511, -974421, -3249680, -9941776, -3095061, -3358128, -4655208, -11167989, -1143535, -4660040, + 4555350, 1952600, -7235410, -3877819, -842887, -5500780, -772557, 511638, 118112, 5292474, + 6220724, 5994701, -2167348, 2238215, 5850819, -607738, 524523, -690416, -553514, 3892851, + -1065152, 404801, -1884417, -611496, -603443, -304406, -1088774, 970663, 1315334, -3104188, + 2679523, 533650, -1117228, 580894, -166430, -2321967, -1232656, 1186485, 1578401, 2014340, + -321586, -1444720, 103616, 1968169, 513785, -372052, -191663, -34897, 32749, -1715303, + -5369, 818728, 85899, -5906, -332860, 827855, + }, + { + 4147328, -45686104, -1513439, 6462315, -98784, 251792, -4647155, 623844, -2794950, -1889249, + 1045825, -561030, -2761127, -5839545, 56588880, -11303817, 412854, 8435316, 851477, 17311402, + -12173548, -12080132, -11346230, 2633352, 12323335, -3521336, -8390755, -19005768, -8841727, 5926518, + 3455301, 6983080, 1269163, -2641405, 2062121, 7502234, 6717329, 7153805, 2007360, 475131, + 3507915, -6420976, 5517959, -5456219, -6176700, -3478387, -4663261, 508954, 1203665, -3630321, + -2429341, -2147, -766115, 5347771, 2717641, 2263985, -1220308, -2240899, -2663954, 896574, + -2450816, -954020, 3482145, -141197, -2326262, -2231236, -883690, -2724620, -1718524, -2327872, + 530428, -30065, -656056, -90731, 693637, 998580, 1167157, -1146756, 297427, 437550, + -244276, -2327336, 656056, 2039573, 2382096, 134755, -471910, -475668, -1866163, -1017370, + -1090922, -74625, 77846, -733903, 155156, 595390, + }, + }, + { + { + -3329674, 22081500, 33061584, 26717918, -10223633, 4555887, -2651069, 8275328, -966905, -2687576, + -5443871, 5267778, -16864190, -9838696, 8787503, -15717433, -6306086, -4460861, -1523103, -11558294, + -2080375, 5959267, 5208185, -2492155, -1453846, 3766150, -3481071, 2221572, 1523103, 5469641, + -7268159, 4955319, 4052302, 3135326, -2340220, 4628364, 1508070, 2679523, -2449205, -2156611, + 5495948, -560493, -4818417, 729608, 1091995, -2161442, 5472862, -1738388, 694174, -1702418, + 1465658, -4418448, 2579665, -3435437, 1800665, 850940, -225486, -1792612, -1766842, 1253057, + -1145146, -2018635, -1138166, 710280, -2524904, 1361505, 1063541, -622233, -200790, -421444, + 197032, 806917, 1538672, -882616, -982474, -1226750, 525597, 288837, 1580011, 1156957, + 427349, -805843, -176631, -693100, 584116, 508954, -809064, 625455, -876173, 397284, + 188442, 244813, -373662, -89121, 488553, -214748, + }, + { + 1282048, -1080721, 881542, -9238475, 1960653, -1234803, -3681324, 3453154, 718333, -461709, + -9619653, -6301791, 6459631, -3197066, -2847563, -9538585, -3765613, 7569880, -708133, 10533944, + -5438503, -1017907, 2260227, 11388106, -18003430, 6116571, 6445136, -2075006, 3258807, 296890, + 14260902, -9550397, 6586333, -6307160, 4498978, -3701725, -2333241, -2076617, 658741, -3115462, + -2640331, 2066416, 2514167, -5065377, 424665, -1291711, -397284, -4093641, 763430, 1527398, + -2838974, -427349, -280784, -1104880, -2175401, -728534, 1647120, -1997160, 3395709, 174483, + -1667521, -1100585, -748398, 2137283, -658204, 1045288, -1481764, -431107, 809064, -577673, + 1761474, 158914, -83215, 79457, 1216550, 53687, 983548, 1328219, 537, -477815, + 806380, -391379, 317828, -775242, -56908, 190052, -950798, 533650, 540629, 1191853, + 59593, -497679, 215285, 297963, -487479, 695248, + }, + { + 746251, 14342506, 12866111, -5818607, 7135015, -2639794, 2712272, 1483374, -4364761, 2312303, + 7230041, -15700253, 868657, 3888556, 7779260, 2032593, -11328513, 15787763, -16611860, 8089034, + 4383014, 529892, 424128, -897111, 2735357, 4765803, 3978214, -25770, 7020661, -1088774, + -5000953, 5087389, 374736, -8146479, -2318209, 1426466, 816581, -635118, 1475321, 840740, + -1021665, 2049236, 2487323, -2055142, 3110093, -3300682, 77309, 366683, -4331475, -2357937, + 1482838, -1463510, -182536, -2615635, 2339684, -1782411, 1414655, -2578591, 181462, -103079, + -146566, -2333241, 571768, -1216550, -352724, 1145146, -81604, -1016834, 1603633, 1020055, + -98784, -1095217, -192737, -1305670, 60666, 798327, -930397, -192737, -702764, -1042603, + 678605, 1342177, -354872, 990527, 367757, -141734, -554588, -303869, -338229, -111669, + -294742, -556735, 70867, -571231, 466541, 326418, + }, + { + 44230648, -75366472, 11722039, 55511916, -11158862, 5391795, 3321620, -3178276, 2611340, -2654827, + 2078227, 1673427, -2552821, -890132, -6139656, 10430328, -5657546, -8472360, -6542309, 1291175, + 2035278, -2603287, 628676, -6317897, -75162, 5010616, 2542621, 3323231, -608812, 1077500, + 10127533, -5066988, 1195075, -1381906, -823023, -1311039, 1514513, 1116155, -2950106, 834834, + -4238596, 1088774, -548145, -3209414, 6499896, 5778342, 423054, -1309428, -2842732, 797253, + -2604361, 6102612, 2532420, -1672890, 352187, -787590, -1546188, 554588, -2860985, 1185411, + 1326071, -402116, 703301, 1787780, -1867237, 258772, -1283658, -1502165, 680215, 957778, + -248034, 342524, -610422, -509491, 48855, -651224, 572841, 456340, -148713, 93416, + -360240, 278099, -1373853, -431644, 99321, 1340030, 180389, -752693, 172872, -24159, + -667867, -215822, 129923, -72478, -433792, 106300, + }, + { + 346282, -33032594, 5680094, 4760971, -968515, -354335, -52076, -777389, 1359894, -126702, + -8327942, -398895, -6270653, -11456288, -9690520, 4254165, 3039226, 5230734, -27686970, 12087112, + 3773129, 7905424, -1248225, -10048613, -2782602, -5142150, 19121732, -14727443, -285615, -2718714, + -2572149, 404264, -2083059, 3237869, 13959, -1473174, 2204392, 3701725, -3986804, -1620813, + 4174708, -3394635, 844498, 591632, -1534914, 2283849, 2232309, -2109903, 833761, 3388729, + 1113470, -2079838, -699006, 558346, 613107, -2569464, 300648, -2689187, 339839, 2987687, + 1794223, -2341294, 2047626, -1621887, 2316598, -1502702, 122943, 1416802, 685047, 1882269, + -2157147, 570694, 543313, 1669132, 154619, 138513, 946503, 1137630, -232465, -446140, + 571231, 816581, 200253, 1031866, 66572, -293132, -300648, -13422, 22549, -18790, + 816044, 688805, -367757, -159988, 311922, -206158, + }, + { + 59356448, -50589348, 6092411, -19987704, -18952080, -2337536, -1641214, -7757785, -3314104, 3877282, + -6661495, -8196945, 4980552, -4531191, 7392713, 7828652, -840203, 2018098, 613107, 7304129, + -3641059, -4022774, -802085, -1349694, -5851893, -553514, 2079301, -1421634, 3586835, -45634, + -256087, 2663417, -1868848, -1764158, -556735, 1675574, 1537061, 3638374, 1672353, -2730526, + -4245575, -4801237, -794032, -6220187, 2502355, 3418257, -7157026, -2529199, 1376000, -1287953, + -5286568, 2265059, -2452963, 3646427, -861141, 2291902, 888521, 1652489, -1290638, 380641, + 780610, -1227287, -1450088, 1717987, -1795296, -1473174, 1064078, -1644436, 39728, -380641, + -34360, 783832, -1431835, 1023276, -440234, 654446, -670015, 441308, -1014686, -489626, + -153008, 1524713, -572841, 121870, 560493, 684510, -542777, 159988, 66572, 249108, + -533113, 597000, 4295, 109522, 940061, -140123, + }, + { + -204548, -8548059, 3265786, -3238405, 2388002, -106837, -913754, 3666292, 128312, -772020, + 2244121, 4584878, 2098092, 3739306, 895501, -17919678, 20906828, 11191611, 3254512, -13166222, + 605054, 10733660, 5044439, 89121, 8930311, 15984258, -15193984, -5463199, -8176007, 15351287, + -889595, -6474663, 1686312, 4533338, 1259499, -1862942, 3085934, 3330747, 430570, -2409477, + -142808, -3045132, -680752, 1253057, 2924336, 5123359, -888521, 3823058, -141734, -644782, + -2365990, -460635, 2911451, -528818, 377420, 193274, 1551557, -2446521, 3514894, -3003256, + -346282, 2405182, 1909650, 1207960, 757525, -46708, 547608, -701690, 27917, -1742146, + 1432909, 789200, -128312, -83215, 1306207, -870268, 181999, -234076, 507880, -185220, + -144418, -244813, 1104880, -428960, -682900, -117575, 423054, -635118, -681826, 112206, + 91805, -559420, 703838, 457414, -237297, 205085, + }, + { + -17097192, -219883536, 32938642, -40616432, 6738804, -272730, -12703440, 250182, 5908265, 5013838, + -1737851, -3440269, 189515, -2020245, 10272488, -14455786, -1022202, 9548249, 3009698, 8906688, + -3068754, -4495220, -6569153, 271120, 835908, -235149, -463320, -6631967, -3174518, -1397475, + -503585, -2560874, 1446330, 2947958, 632434, -2414309, -6292664, 801548, 16643, 374199, + -4085051, 2746632, 2968896, -2940442, 5069135, -2751464, -1006096, 6249178, 915365, 569083, + -294205, -5673652, 23085, 1653562, -133681, 971200, 215285, -2166811, 1989107, -864899, + -2734821, 2724620, 191126, 122407, 1771674, 2348810, 483721, -1733019, 1612223, -398895, + -563178, 1524177, 807991, -1009317, -1156957, -1911797, -836982, 200253, -664646, -468151, + -96637, -120259, -979253, -394063, -651761, 1056562, 25770, -716186, 813896, -445066, + -565325, 382252, -411780, 332860, -605590, 616328, + }, + { + 113817, 5618891, -9957345, 4087735, -3136400, -38118, -368293, 190052, 721555, 1598265, + -3655554, 2160369, 2023467, 10523744, -30219926, -22947474, -156766, 4662187, -9680856, 13535589, + 380105, -707596, -2446521, 2507187, -1961190, 5479305, 14374182, -9866614, 5894306, -2820183, + 5479842, 9189619, -5886790, -6774774, 8807904, -8179765, -3988951, 3074123, -2106682, 2282775, + 3043521, 1535451, 1637993, -3158412, -2717641, -81068, 609349, 268435, -1078574, -2017024, + 627065, 199716, -1938104, -71404, -957241, -460098, -593779, -1340030, -695248, 376347, + 3318399, 158914, 1377611, -566936, 112206, 294205, -863825, -1572495, 176094, -3114925, + -1004486, -1321776, -261456, 922344, -45097, -1300301, -149787, -1209033, 156766, 106837, + -545461, -435402, 1478006, 377957, 421981, 1027034, 73014, 632434, 393526, -114354, + 635118, -725313, -272194, -89121, 560493, -106837, + }, + { + -26319022, 17317308, 31625992, 4482872, -2986613, -9915469, 6155225, 11644193, -2144263, -829466, + -5683853, 8774081, 3573413, -1245541, -4757213, -2559264, -1822140, -1148367, -10130217, 6626598, + 3241090, 780610, 543313, -8611409, 7417409, 887985, -7729868, -4597763, 3369939, 4127464, + -8507793, 4648765, 150861, 4532264, -7368554, -1334124, 504659, -161598, 2632815, 1263794, + -6327561, 807991, -196495, -5180268, 3518115, -1081258, -4549444, 552977, 1326071, -1053878, + 4787815, -2285996, -764504, -677531, -617938, 1141924, -2800319, 2055679, 361314, -1459215, + 171262, -2690260, -825171, 909459, 175557, 341450, 1553704, -442919, 2557653, 5906, + 778463, 291521, 1147293, -627065, 1505386, -427886, 126165, -1300301, 244813, 463856, + 1432372, 294205, -1031866, -315143, 108448, 42950, 558883, 610959, -725313, -20401, + -809601, 523449, -559956, 156229, -288837, 433792, + }, + { + 2607045, -17992692, 2072859, -1772748, -281857, 1584306, -6863358, 1691143, 566936, 8014409, + 4147865, -5310727, 4771709, -1148904, -2603824, 261993, -3652870, 11077258, 57982, -1173063, + 3075734, -2588792, -8709120, 1642825, 5446019, 171799, -8768713, -5524402, -7512972, 12463995, + 10051297, -4517769, 188979, -6318434, -8590, -9395241, 4689031, -1293322, 2497524, -1279363, + -7494718, 3840775, -6760816, -924492, 3869229, -4168266, 818191, -1003412, 1474248, 1224066, + 670552, -1449552, -1348083, 1691680, 2521683, -3049964, -498216, -1156957, -532039, 2094870, + 2343979, -2974265, -311922, 1999844, 2158221, -2454037, -1516124, 356482, 265751, -442382, + -606127, 413391, 928250, 372588, -632434, -346282, 30065, 27380, -141734, 412854, + -709207, 810138, -947577, -556735, -121333, -96637, 241592, 112743, 646393, 67109, + -236760, 254477, 124554, -31675, -13422, 198105, + }, + { + -53388056, -58040040, -20283520, 3034395, 3397319, 11293617, 13772350, -6634651, -5182415, 4563403, + 8346195, 1040993, 1953136, -4516695, 6074158, 2361158, 1955821, -9575093, -12076911, 6949794, + 9607305, -2226941, 5142150, -245350, 17921288, -2061584, 14539538, -4398584, 2206540, -6574521, + 2273112, -826244, -5133023, -4565014, 2282775, -818191, -7857643, 3199751, -1829119, 2901251, + -3263638, 1169842, -7542500, -438087, 2737505, -5959804, -3444027, 2581275, -2415919, -154082, + 1982664, -1933809, 65498, -539018, -1571958, -1191853, 62277, 1448478, -420370, 228170, + 1585917, -305480, -892816, -99858, -421981, 1427003, -1873143, 46708, 1032940, -506269, + 591095, 1525787, 195421, -1191853, -1164473, -437550, 91805, -409633, 242666, -789200, + 922881, 201327, -172336, 662499, -1300301, -378494, 394600, -748935, -700617, 1460826, + -26844, -541703, 223338, 454193, -244813, 223875, + }, + { + -20401, -38917772, 4840965, -1904818, -1070521, -3664144, 3758, -2829847, 578210, -4299799, + 5040144, -6221797, -6414534, 7474854, 571231, -17511656, 9210020, -12648142, -1191853, 6541772, + -31474058, 970663, -8521752, -7154342, -5397164, -506269, -8639864, -7829726, 9962714, 2339147, + 3940096, -1382443, 5140002, 983011, -812823, 3004867, 6777996, 1962263, 5140539, -818728, + 1988570, -414464, 5192079, 500901, 1095754, -2941516, -3863323, -2673617, -178778, -1789928, + 2959769, -1070521, 1512902, 685584, -1358283, -1373316, -1833414, 106300, 921271, -1429150, + 954020, 387621, 1142461, -629213, -1248762, -568009, 736587, -2345052, -21475, -563714, + -65498, 60130, -234613, -289373, -9127, 663036, -148176, -2072322, -638876, 1215476, + -123480, -164819, -418222, 591095, 809601, -706522, -448824, -5369, -635655, 208843, + 386010, 266288, -703301, -638876, 337692, 114890, + }, + { + -23136988, 90272696, -16360067, 21669184, 6598681, 14099841, 6781217, -1029182, 2862059, -10659035, + 11769821, -18603114, 4021700, -5791764, 10466835, -8368207, 5268851, -2823941, -8334384, -1566053, + -3767223, 4556424, -570157, 1600949, 563178, 813896, -5782637, -2094870, 2514167, -7166690, + 3561602, 1670205, 622770, -987843, -246961, -2524367, 3837017, -202937, 3586298, -6813966, + -5284958, -379031, 193810, -1328219, 3390877, 4297652, 1847910, 434329, -1127966, 352187, + -89657, 5145908, -466541, -47782, 3776350, -1345935, 740345, 286152, -2532957, 1101659, + -1577864, 1512365, -542777, 1111860, 509491, 193274, -918049, -16106, 461709, -2409477, + 3499325, 1120987, -717260, -290984, 20938, -1038308, -1282585, 639950, 885300, 1259499, + 440771, -464930, -219043, 641561, -277025, -1506460, 54224, 470299, 295816, -814970, + 330712, 511638, 173409, 26844, -331249, 903554, + }, + { + -4112968, -31117038, 17310866, 171262, -1391569, 4224637, -7339562, 2650532, 2055142, 676994, + 613107, -1919850, 5576478, -3015067, 43873092, -7209103, -4605279, 1903744, -5838471, 2605435, + -8295730, -948114, -8676908, 410169, 5814312, -4643397, -1895691, -4354023, 6976101, 5864778, + -6525666, 2545305, -1365263, -4393215, 1848983, 6107444, -1507534, 1242856, 1450088, -3016141, + 5124433, -819802, 6827925, -2998424, -117575, 2871723, -186294, 60666, 2496450, -1218160, + -19327, -1126892, -1651415, 1698660, -1086090, -82678, -2210835, -389231, -994822, 1351304, + -1451162, -1062468, 3346853, 122943, -2243047, -2159295, 1145146, 81068, 853625, -66035, + 750009, 649077, -340913, 80531, 469225, 431107, 794032, -831613, 237834, -782221, + -1085016, -1034013, 818191, 795643, 457414, -301185, 109522, 307090, -272194, 2147, + -496069, 481036, 473520, -515396, 468688, -232465, + }, + }, + { + { + 5377836, 48751100, 34792992, 10805601, 2505040, 2987150, 1786170, -559420, 449898, -476205, + -6336688, 4396973, -3812857, -7764227, -2832531, -14814416, -6546067, -3252364, -3818763, -624918, + -3053185, 4361003, 5227512, 1546188, -3623342, -1688996, -2564096, 2193118, 1269163, 2120640, + 958851, 4743792, 329639, 1294396, 1992865, 1218160, 5979132, -1728188, -3039763, 1308891, + 3311420, -1452773, 1918777, -1206349, -1081258, 2459943, 1169305, 641561, 136365, 216896, + -980326, -1308354, 217970, -370978, 757525, -531502, 768799, -2100239, 500901, -423054, + -2761127, -121870, -740345, 198105, -742493, -205622, 858993, 112206, 261993, -379568, + -138513, 636192, 17717, 694174, -1109175, -258235, 310848, 397821, 708133, 704375, + 235149, 165893, -958851, -584116, 280247, 302795, -667867, 309238, -565862, 324807, + 119185, 164283, -408022, 282394, 133681, -125628, + }, + { + -501437, 8760660, -2758980, -1373853, -5772436, 838592, -3162707, -17180, 806380, -1876364, + -4039417, -2530273, 1338956, -2927557, 398358, -10442139, -1324997, 7857106, 13013751, -1327145, + -4704063, 1736777, -4068945, 2472291, 481036, 1422708, -2059437, -315680, 3830574, 4628901, + 5319317, -2172180, -122943, 4840965, -9486509, 1685238, -5237713, -3331821, 2628520, -1593433, + -2160369, 262530, -785979, 1474784, -4239133, -1257889, -753767, -1206349, -530428, 1565516, + -1468879, -1985349, -424128, -1849520, -260382, -8590, 674847, -454730, 1403917, -374736, + -1351841, -238371, -339302, 149787, 544387, -1042603, 98784, 308701, -662499, 246424, + 1168768, -382252, 1744831, 540629, 514322, 268972, 406411, 1404991, 96637, -686121, + -479426, 866510, 194347, -964757, 27380, -292058, -214212, 487479, 288837, 653372, + 274341, -24696, -213675, 179852, -5906, 374736, + }, + { + -76773, 25235618, 6281927, 10774999, -3597572, -982474, 3197066, 2844879, -2427730, 783832, + -238371, -8713952, 1003949, 5432060, 430034, 2187749, -3550327, 1708860, 1519882, -1541356, + 4464082, -6980396, 2965675, 2114735, -343597, 1059246, 2421825, 3031173, 4247723, 108448, + -3018288, 4125853, -1511829, -1044751, -4220342, -953483, 1113470, 352187, -230318, 1992865, + 1070521, 1287953, 840740, -810138, -611496, -500901, -527744, -2784213, -1347546, -2622615, + -572841, 444529, -271120, -1967095, 1969779, -1483374, 911607, -1196685, -307090, -209917, + -1553168, -1070521, -409096, -460635, -392990, 158914, 351114, -307627, 891743, -28454, + 1205812, -382789, -1126355, -997506, -425739, -309775, 733366, -334471, -548682, -831076, + -302258, 1000191, 521302, 757525, 187905, -199716, -429497, -532039, -264141, -418222, + -78383, -247497, -95026, 78920, -88584, 281320, + }, + { + -25823490, 33841656, -1362042, 44868988, 1385127, -697395, 3772592, 1875827, 2610266, 1196685, + -2570538, 182536, 2280628, -743029, 6709813, 2266669, -1466731, -7707319, -4423280, 810138, + 4509716, -5673115, -4570382, 416612, -191126, 4002910, -1205812, 3763465, -668404, 1301375, + 6422587, -1685238, -1258962, -798327, -28991, 144955, -252866, 82678, 224949, -61203, + -6543383, 2256469, -325344, -2733210, 5694590, 4271345, 1895691, 683974, -2456721, -2176475, + -553514, 4494147, 1229971, 224412, -985158, -484258, -1271310, -1931125, -387084, 1072131, + 106300, -1017907, 172872, 1930588, -569620, -1112933, -610422, -1575179, 593242, 326418, + 88047, -77309, -324807, -592169, -141197, -523449, 343597, -175557, -187368, -150324, + 462246, -77309, -555125, -568009, 377957, 917512, -28991, 213138, -248571, -170188, + -733366, 90731, -591632, 130997, -588411, -95026, + }, + { + 225486, -26521960, 566399, 1942399, 593779, -78920, -32212, -2573759, -56371, -24159, + -4964446, -4255239, -7269769, -6478958, -2842195, 12473659, 1756105, -28486908, -8972724, 8203925, + 6142877, 98784, 3246459, -5877126, 161598, 9762461, -7034620, -5526549, -1535451, 2233920, + -3610457, 203474, -4216048, 917512, 1628866, -917512, -1761474, 3423626, -3276523, 386547, + -247497, -771484, -1463510, 797790, 229781, 1859721, -1022202, 311922, -1058710, 1764158, + -22012, 537945, -1302449, 625992, -1114544, -479963, 130460, -2316061, 2436857, 2681670, + -852551, -750009, -23085, 208843, 486942, 738198, -1336272, 151934, 245887, 1216550, + 331786, -667867, 755914, 600759, 1105417, 352724, 1112397, 237297, -27917, 86973, + -235149, 639413, 518080, 945967, 124554, -213675, -157840, -268435, 216359, 260382, + 362388, 386010, 471910, -24159, -369367, -6979, + }, + { + -32417876, 72615552, -6223945, -24308978, -1711008, -2783676, -4107063, -4212826, -2435247, -7139847, + -1521492, -3336653, -6069863, -816044, 5962489, 5433134, 3809099, -1611687, 3900367, 854699, + -5725729, -2421825, -220654, -3665755, 722628, -1432372, 530428, -1569811, 1066226, -2073396, + -146029, 5738613, -1128503, -92342, -447750, 2502355, -1025423, 2491081, 3379066, -1876364, + -4514011, -4744865, -2135136, -1898912, -2061047, 320512, -1410897, -163209, -2476586, -3687766, + -1985886, -2999498, 361851, 1902671, 1437740, -564788, 2202245, 2070711, 658204, 184684, + -57445, -2528662, -727997, -486942, -787053, -673773, -442382, -591095, -467615, 312459, + 17180, -268435, -538482, -177704, 344671, -338229, -30602, 770947, -867047, -449898, + -477278, 908922, 63351, 134218, 258235, 859530, -329639, -67109, 584652, -796180, + -155693, 173946, 219043, 732292, 141734, -18254, + }, + { + 708133, -1872606, -3120831, -2298344, 120796, 389768, -508417, 1702418, 520765, 567473, + -14496, 4403952, -1463510, -2756832, 296890, 15276125, 6726993, 4153234, 4671851, -2384781, + -4978404, 2163053, 8642011, 3712462, 9918690, 6453725, -11737609, -3496640, -6372121, 11605539, + 1603633, -4531191, -5712844, 1586990, 5884642, 111669, 2698313, 535260, 3475702, -2416993, + -909459, -1901060, -465467, 1702418, 3067144, 3811784, -180926, 3555159, 526134, 726923, + -3272228, -856309, 3239479, 412317, -293132, 213138, -380105, 938987, -327491, -707059, + 831613, 2202781, 832687, 1476395, 545461, 1270237, -121870, -1101122, -1305670, 186294, + 398895, 592706, 88047, 248571, 105227, -293668, -118112, 234613, 186831, -164819, + -346819, 339302, 845035, -566399, -522375, 22549, 227633, -768799, -183073, -31675, + -401579, 254477, 199179, 500901, 221191, 60666, + }, + { + -10277857, -173792624, -2592550, -27268748, -6432251, -32749, -8149164, -1258962, 4635344, 3337727, + -1768990, -2228551, 3668439, -2233920, 5919539, -6998649, -947577, 3039226, 2741263, 6476274, + -804233, -4759898, -6213744, -2062658, -1094143, 2277943, -3664681, -5603859, -4528506, 1612223, + -1237488, -1511292, -751082, 1953673, 1729798, -5069672, -467615, -3163244, -1157494, 1098438, + 175020, -832687, 2612951, -321586, -1010928, 85362, 1189169, 1726577, 2512556, -1590212, + -2412161, -831613, -2552821, 2020245, -1246614, 1946157, -1006096, 562641, -663036, 448287, + -898722, 300648, 1159641, 585189, 1038308, 2612951, 384936, -400506, 155156, -272730, + 582505, 25770, 949188, -381715, -1363115, -1447941, -580894, -320512, -196495, -115964, + -528281, -70330, -810138, -646393, 115964, 147103, -369904, -156229, -71941, 67646, + 56371, -108448, -302258, -114354, 5369, 272194, + }, + { + 913754, -2190433, -727997, -3288334, -294742, -60130, 448287, -692564, 617402, -126702, + 1101659, -98784, -2039573, -282931, -7299834, -11164231, 637803, -2783676, -5182415, 334471, + 1359894, 8482024, 1223529, -3688303, 376347, 8298951, 7449621, 5667746, -7252589, 2069101, + 7653632, 2653216, -598611, -3813931, -320512, -1632088, -3543885, -1046361, -141734, -1252520, + 4862977, 2168422, -2527052, -3609920, -614180, 870268, 2454037, -197569, -872415, -2094870, + 545461, 2530273, -2789045, 265751, -782221, -499827, -1109712, -1321239, -724239, 2081985, + 1510755, 1336272, 827318, 23085, 304943, -195421, -149787, -970663, -1552094, -1320166, + -1773285, -300111, -411243, -481573, -679142, -708670, -26844, -1244467, -120796, -84289, + 150861, 155156, 558346, 838592, 117038, 717260, 328565, 874563, 71941, 52076, + 66572, -231391, -410169, 89121, -104690, 561567, + }, + { + 22490060, -22122840, 18592376, -2646237, 7431367, -8760123, -4279398, 7227893, 3762928, -3513820, + -2871186, 3696356, 10360535, -1478006, -101469, -8127152, -1291175, 241055, -9119826, 8165807, + 3322157, -1221918, -789737, 507880, -1183264, -3490735, -9186398, 1917703, 1192927, 4094715, + -9319542, 3540127, -118112, 2881923, -1897839, -3672197, 1004486, 1311039, 2201171, -1551020, + -4744328, 31139, 452045, -4897337, -3697967, 2468533, -2988760, 1850594, 9664, 710817, + 566936, 1864553, -806380, -1213328, -747324, 92342, 156766, 23622, 937377, -820339, + -835371, -719944, -482110, -234613, 1390496, 652835, -461172, 1204738, 2106682, 504659, + 220654, -26307, 1141388, -213138, 655519, 59056, -626528, 6442, -484258, 843961, + 432181, 716186, -1268089, -399432, -197569, 4295, 452582, 276489, -578210, -258772, + -352724, 61203, -168577, 66572, 217433, -471373, + }, + { + -2617783, -17875654, 5194226, 3005403, -2216203, 1137630, -3418257, -7516, -73014, 4578435, + 2276333, 3543885, -1202054, 6907381, 1484448, -3783866, -2654290, 846109, 8712878, 2285996, + -2421288, 187368, -3776887, -3660386, 8119636, -6030134, -5106716, -8747775, -677531, 6414534, + 13352516, -6240588, 1028108, -3967476, -5340792, -4729833, -14496, 2952253, 3799972, -2808372, + -1535451, -2240899, -3407520, -1098438, 1399086, -1246614, -1839857, 1910724, 454730, 2206540, + 174483, -1262720, 457951, 158914, 1458678, -534723, -1923609, -510564, -541703, 1077500, + 928787, -1664837, 783832, 1553704, 607738, -501437, -1040993, -387621, 930934, -688805, + -595927, -467078, 595390, 483721, -108985, -1272384, 91268, -264677, 355945, 69793, + 375273, 57982, -379568, -238908, -175020, -434865, 4832, 464930, 375810, 47245, + -81604, 307090, -229781, 191663, 38118, 195958, + }, + { + 25705380, -167028592, -10723460, -5082020, 432181, 24049670, 2992519, -9969156, -4275103, 5320391, + 5779416, 3912178, 90731, -4083977, 318364, 9594420, 2080912, -6533719, -11865384, 7988639, + 164819, 4868346, 2572149, 8615168, 3263638, 4864051, 7197292, 1420560, 1875827, -4683125, + -537408, -2276870, -1229971, 333934, -2575907, -5026723, -2558727, 1451162, -368293, 3146601, + -2374043, -49392, -3303904, -5471252, 137976, -1468342, -656593, -1290101, -338766, 147640, + 332323, 630823, -2160369, 1285269, -2931852, -64425, -951335, 2873870, 605054, 816044, + -1050656, 1469416, -1832877, -398895, -405338, 1441498, 920197, -1607392, 0, 110059, + 1534914, 134218, 96637, -1229434, -813896, -329639, -339302, -282931, -430570, 24696, + -48855, 513249, -37044, -105764, 115964, -744640, 63888, -384936, -442919, -9664, + 505196, -76773, 204548, 18254, 156766, 202400, + }, + { + 1182190, -28792388, -5260261, -1964411, 1189169, -3131031, 1661079, -3649649, 1065152, -2608656, + -878321, -552440, -4361540, 2195265, -12719546, -1788317, -2747705, -3991635, -2758980, -1844152, + -4032438, -25479356, -3023657, -10887742, 1724429, -2985539, -6535330, -11075647, 6345814, 966905, + -1073205, 4968741, 6431714, 3665218, 783295, 6375879, 4555887, 1964411, 3485903, -1522566, + 337692, 521839, 3015067, -1584306, 2152316, -660351, -6066105, -843961, -927176, -2097555, + 1756642, 763967, 2204929, -688269, -2474975, -258772, -1099512, 402116, 592169, -416612, + -707596, 1012002, -541166, 1052267, -541703, -1410360, -390305, -120796, -865436, -471373, + 562104, -240518, 330176, 64961, 66035, 67109, -309238, -923418, -366146, 165893, + 566399, 886911, -541703, 563178, 140660, -157303, -318901, -164283, -179315, -126165, + 640487, -173946, -581968, -236223, -212601, -256624, + }, + { + 30147450, 9507447, 4332549, 5346698, 6761353, 15018427, 531502, 7474317, -357556, -2086817, + -8511015, -1843078, 28991, -3477850, 4471061, 3926137, -5272609, -3924526, -7749732, -1329292, + -7097434, 2092186, 350577, 876710, 2112587, 180926, -8224863, 3318399, 134755, 705448, + 2131915, -551366, 208843, 3546569, -3005403, -392990, 4716948, 1421634, -851477, -4800163, + -1268089, -4704063, -718333, 466004, 1816771, 7657390, 1989644, -2345589, 2037962, -3251290, + 421981, 3983582, 1075889, -350040, 1193464, 710280, 367757, 102005, -3425237, -385473, + 1132798, -74088, 977105, 1643362, -370441, 397284, -307627, -588947, -447213, 161598, + 827855, 997506, 682900, -70330, -862752, -101469, -1479079, 408559, 628139, 661962, + 794569, -271657, 137976, -583579, 596464, -1021129, -111132, 141197, -102005, 148176, + 97711, 37044, 405874, -23085, 39728, 424128, + }, + { + 4124242, -16398185, -3321620, -643708, -1534914, 2910914, -3152506, 3821447, -132070, 1409286, + 1098438, -2595234, -1618666, 10986526, 19986630, 5677947, -2479270, -3089155, -8071854, -6127845, + 6808597, -3799436, -5922760, -2427730, -2379949, 802085, -898722, 3808562, 2777233, 2066953, + -2076080, -2194192, 1013075, -5000953, 639413, 4482872, -1336272, -3120831, 3693135, -3009162, + 668404, 2268280, 2975339, 3270618, -578747, 792421, 1650341, 727997, 1521492, -1032403, + -647466, 294205, 22549, -252329, -788663, -1591285, -891206, -339839, 517007, -593242, + -1706713, 586263, 1334124, 443455, -1527398, -396211, 622233, 1027034, 267362, 723702, + -210453, 918049, -183073, 391379, 24159, 303869, 418759, -217433, 289373, -1398549, + -1321776, 404801, 366683, 275415, -282931, -407485, 97711, 443992, 311922, 67109, + -26844, 423591, 63351, 99858, -5369, -335544, + }, + }, + { + { + -3609383, 34920768, 11556683, -11941083, -2731062, 642635, -87510, -2455111, -3156264, 4763656, + 5834713, 5297306, 432718, -754841, 5123896, -5342940, 3164854, 2964601, -1893007, 3419868, + 1367947, 3466576, 2862596, 1585380, -5430986, -2309619, -3552475, 1160178, 1023276, 1068910, + 315143, 4511863, 620623, 63351, 246424, -2506650, 5114769, 436476, -847719, 113280, + 1582159, -424665, 3804267, 690953, -678605, 3193845, 301721, 752693, -73551, 1165010, + -521302, -758599, -44023, 2374043, 923955, -1279900, 1073742, -1891396, 615254, 463320, + -522375, 1827509, 86436, 208843, 216896, -401043, 161061, -389768, 234076, 501974, + -339839, -221191, -318901, 768262, -676457, -40265, -218506, -188979, -418222, 74625, + -138513, 467078, -75162, -138513, 122943, 312459, -202400, 393526, -205085, 410706, + 104690, -22012, -463320, 255014, -91268, -110595, + }, + { + 185757, 7402913, -1664300, 13563507, 2627446, 810138, -1508607, -2177549, -1199907, 690953, + -375273, 662499, 2850785, 2799245, 5797669, 922881, 4201015, -1498407, -196495, -3570729, + 386547, 6265821, -1184874, -1903744, -3296924, -4543539, -8312373, -1126892, 5134634, 2542084, + 1446867, -1134945, -2433636, 8993662, -6907918, 4103841, -1141388, -2552284, 887985, -826781, + -1969779, -371515, -893353, 3798362, -1348083, -1079647, -1567663, 1271847, 113280, 1438814, + -993211, -2843805, -790274, -975494, 507343, -1302449, 517007, -417149, 635118, -533650, + -318901, -93416, -633508, -243739, 404264, -914291, -103079, 229781, -668941, -387621, + -65498, -288300, 1443646, 79994, 444529, -42413, -478889, 192737, -976031, -151934, + -31139, 679679, 105764, -363998, 73014, -293132, 378494, 97174, -509491, 133681, + -27380, 190052, 151398, 62814, -17180, -11811, + }, + { + 437013, 10944114, -10727218, 18161270, 4123706, 148176, 811212, 2392834, 15032, -1138703, + 644245, -305480, -438624, 2330020, -806380, 5568425, -477815, -913754, 5896990, -4496294, + 1052804, -7692287, 2128693, -3963718, -5680094, -2735357, 162672, -2399813, -5021354, -280247, + -2735357, -776315, -1876364, 1517734, -5906, 1899986, -388158, -1080721, -987306, -862215, + -444529, 376347, 703301, 1073742, -383863, 513785, -905164, -3797288, -1219234, -1150514, + -284542, 811749, 2068564, 483184, 2521683, -1317481, 690416, 1926830, 1114544, -785979, + -1130650, 46708, -81604, -147103, -1034013, -452045, -46708, -630823, -20938, 73014, + 1553704, 562104, 476205, 140660, 237297, -190589, 965831, -345208, -360240, 119185, + -2147, -24159, -76773, 233539, 260919, 196495, -208843, -505196, -123480, -381715, + -179852, -7516, 39728, 169114, -256087, 134218, + }, + { + 3108483, 73293616, -9967545, 39740796, 1315334, -2231773, 2757369, 5162551, 2766496, 723165, + -2039573, 2715493, 7995619, 4358318, 5859409, -5320391, 280784, -509491, 5754183, 7012608, + 6012418, 750009, 1727114, 2588255, 629750, 6223945, -3583077, 3405909, -1954747, -2100776, + 3133179, -698469, 607201, 1859184, 1787243, 1140314, -3277597, 37581, -676994, 1310502, + 317291, 3846680, -359167, -1210644, 3184718, -784905, 32212, 1789391, 199179, -571231, + -1836635, 897111, -184147, 1658931, -308164, 1197759, 498753, -1779190, 558883, 506269, + -875100, -1025423, -79994, 942745, -42950, -1104880, -452582, -397284, 903554, 326954, + -74088, -154082, 118112, -459025, -23622, -251792, -141197, -1044214, -176631, 359704, + 754304, -144955, -161598, -206158, 214748, 123480, -266825, 389231, -312459, 166967, + -216359, 387084, -622233, 280784, -199716, 245350, + }, + { + -1228361, -23799488, -32212, -1626182, 489626, 40802, 580357, -1162326, -861678, 2020245, + -1629403, -2071248, 437550, 1138703, 2277407, 8457327, -7048578, -14706505, 9532680, 5148592, + 5452461, -5779416, -476205, -2223183, -3898757, 6177774, -1505923, 4380867, -2278480, 5180805, + 4134443, 1712618, -1588601, -1433982, -483721, 2684, -3117610, 2276333, -2087354, 2110977, + -1759326, -1532230, -421444, 1860795, -823560, -268435, -2099165, 1000727, -7516, 1997160, + -230318, 836445, -850940, 1188095, -754304, 766652, 919123, -1179505, 1855426, 512175, + -838056, 969052, -914828, -105227, 302258, 1092532, -1072668, 317828, 185220, -323733, + 833224, -149250, 77846, -195421, 969052, -107374, 235149, -566399, 20401, 108985, + -730144, -46171, -176094, 115427, 223338, 511101, 156229, -57982, 526670, 361851, + -34360, -19327, 687732, 313533, -435939, 251792, + }, + { + 88584, 110776872, -4670240, -12641699, -2009508, -88047, 767725, 3171297, -1850594, -7400766, + 95563, 1046898, -360240, 315143, -222265, 2490544, 630286, -2303176, 4838818, -1304060, + -5330055, 2735357, 3817152, -4459250, 2490007, -1169305, -923955, 992674, 3628711, -1064615, + -2749316, 462783, -5628018, -504659, -195958, 3628711, -752693, -959925, 928250, 132070, + -1322313, -799938, 405338, 2230699, -1174674, -331786, 2296197, 2592550, -2139431, -599148, + -650151, -2867965, 2003065, 2154463, 2948495, -648540, 454730, 27917, -689879, 259846, + 73014, -2842732, 541166, 874026, 1030255, 916439, -348966, 341987, -796180, -255014, + 102542, -848256, -853088, -1062468, 2147, -591095, -550830, 656056, 137976, 118112, + -558346, 584652, 69793, -87510, -93952, 470836, -102005, -248571, 166967, -986232, + 216359, 219580, 51003, 349503, -339302, 12348, + }, + { + -163746, 5514201, 6781754, -52076, 488016, 551366, -863825, -751082, -62814, 177167, + -2403034, 1756642, -2532957, 2192581, -173409, 18673444, -670552, -4046396, 9589588, 8798777, + -3223373, 1566053, 6115497, -6439767, -1529008, -8835821, -18865106, 491237, -3264175, 3205119, + -818191, 2467996, -4649839, -4806069, 2563559, -1787780, -1551020, -528818, 2708514, -3785477, + -1384053, -487479, 2099165, 143345, -1413044, 1633161, -1227824, 1389422, -1143535, 1353452, + -1867237, -69793, 2279017, 1523640, -1013075, -1300301, -619012, 2965138, 236760, -945967, + 581968, 964220, -644245, 1133871, 601295, 725313, -570694, -738198, -352724, 807991, + 68183, 104690, 30065, 442919, -133144, -419833, 113280, -70330, -732829, -310848, + -424665, -353261, 358093, -140660, -97174, -152471, 393526, -257698, 209917, 64961, + -265214, 390842, -220654, 279710, 70867, -67646, + }, + { + 27063126, -113911656, -7978976, -24446954, 3600256, 2485176, 268435, 212601, -344134, 3752191, + 2162516, 3436511, 4894652, 74625, 4247723, -4568772, 25770, -3600256, -2257005, 3425237, + 811749, 666794, -2496987, -5462662, -1618129, 2091649, -1224066, 677531, -915365, 3367791, + 1884954, -200790, -1262720, -395674, 1108102, -2668249, 5144834, -446140, -1986959, 1945083, + 1317481, -1767916, 1644973, 1554778, -1566589, 39192, -632971, -1775432, 1357210, -62814, + 38655, 2274185, -944893, 2018635, -280784, 2327336, -805843, 421444, -1027034, 1169305, + -676457, -1163399, 1618129, 625992, -434329, 1177895, -392453, -289910, 27917, -656593, + 506806, -417149, 976568, 478352, -127238, 134755, -272194, -269509, 463856, 787590, + 25770, 92879, -472446, -372052, 3221, -28454, -189515, 41876, -394063, 139586, + 445066, 10737, 44023, -107374, -180389, 144418, + }, + { + -50466, -2486249, 8074539, -3128347, 299574, -68719, 54224, -969052, 470836, -969052, + 2318209, 839666, -1795833, 4095788, 2617783, 8967355, 8237748, -924492, 331786, 1279363, + -3551401, 1757715, 1432372, -6793565, 1635846, 8530342, -1402844, 4934918, -4039417, -249645, + -2626373, -3821447, 6473590, -736050, -3489124, 1995012, -1710471, -836445, 1887101, -1482838, + 2886218, 1716376, -1648731, -352724, 1433445, 471910, 296353, -184147, 1127966, -600222, + -164283, 2021856, -1675037, 1542967, 795643, -710817, -501437, 117038, -730144, 1079647, + 345745, -547608, -881542, -161061, -73014, -1140851, -171799, -376883, -437013, -103616, + -774168, 410706, 14496, 450972, 4832, -399969, 107374, -884226, 449898, -135828, + 130460, 62814, 126702, 7516, -868120, 311385, -371515, 354335, -8053, -20938, + 8590, 203474, -207769, 69793, -343061, 384936, + }, + { + -18632642, -61074972, 29118804, 5755256, 12265890, -2658585, -2936684, -2008971, -1449015, -2486786, + 2219424, 1500017, 6320045, -2346663, -325881, -3715147, 3324305, 2864743, -10526428, 5204964, + -1023276, -1194538, -220117, -1703491, -544387, -246424, -5781026, 6656663, 3722126, 1697049, + -9592273, 1124208, -1605244, 4041027, 53150, -4383551, -74088, -834297, 1523640, -1331440, + -4283156, 1198833, 241055, -2272575, -2892124, 1173063, -152471, 3548717, -1039919, 257698, + 249108, 3297998, 1056562, 936303, 780073, 415001, 501974, -609349, 970126, 872952, + 461172, 200253, -897648, -935229, 1083942, 47782, -665720, -6979, 287763, 1165010, + 141197, -687732, 507880, -301721, -348966, -692564, -329639, 605054, -753767, 170725, + -992674, 441845, -862752, 81604, -273804, 186831, 282394, 66035, -537945, 275415, + -62277, 213675, 28454, -334471, 266825, -216359, + }, + { + 1794760, -13486734, -1861868, -1177895, -3136937, 367220, -3067681, -779000, -881542, -1992865, + -179315, 3118146, -5082557, 677531, 484258, -128312, -759136, -2087891, 7832410, 204548, + -3315715, 6501507, 4941360, 1456531, 4721243, -9697499, -1713155, -5332739, 1837172, 929324, + 7818451, -3018288, 2411087, -3445101, -3576097, 549219, 902480, 1299228, 2964601, -2402497, + 1555315, 1423245, -384400, 374199, -234076, -985158, -152471, 1917166, -1969243, -222265, + -1214939, 439160, 1418413, -770947, -1049046, 176094, -78383, 399432, -271120, 1821066, + 1265942, -157303, 746787, 461172, 125628, 242666, -455267, 159451, 1142998, -326954, + -256087, -542240, 143345, 224949, 498753, -590021, 146566, -707596, 77309, -113280, + 146029, -187905, -135291, 259846, 199716, -143881, -292595, -99321, -115964, -170725, + 107374, 441845, -156766, 178778, -209380, 6979, + }, + { + 12531104, -178495088, -3811247, -8516920, -7511898, 4082367, -15109695, -4589710, -2055679, 3178813, + 1416266, -4577899, -2173790, 435939, -594853, 10741176, 2434710, -3271691, -9508521, 2019172, + -4110284, 7950522, 533113, 4736812, -7588134, -1792075, -747861, 533650, 4020626, -874563, + 215822, -2437931, 878321, 974958, -4376035, -4165582, 995896, -1381906, -4104378, 955093, + -3225521, 1248225, 2421288, -2287070, -920197, 1416266, 2754148, -527207, 467615, 1590749, + -161061, 641561, -2743947, 1893007, -782221, 897111, -1388885, 1517197, -913754, 129386, + -839129, 1852205, -1307818, -469762, -629213, 155156, 434329, -896038, -566399, -324807, + 940598, -1276142, -54761, -303869, -117038, -609349, 14496, 279710, 205622, 613107, + 173409, 340913, 215285, 161061, 427349, -379568, -328565, -278099, -499290, -505732, + 446677, -111669, 344134, -48318, 205085, 192200, + }, + { + -2037962, -18428094, 6043556, -851477, 2298344, 1411971, 6655589, -2732136, 424128, -1949378, + 472983, 5127117, 2592013, -8402030, -18642842, 14948634, 5240397, 811212, 1048509, -623307, + 17716740, -973347, 10557030, -7089381, -5629092, -4143033, 1938104, -7945690, 810675, 2155537, + 1869385, 98247, -1776506, 3426310, -231391, 2639258, 1211181, -1197222, 1279900, 420907, + -56908, -5086315, -382789, -2140504, 1089848, 3423089, -2998424, 1059246, 1121523, -1491964, + 1311576, 260919, 1817845, 1488206, -235149, 438087, 820876, -418759, -772557, 525060, + -1480690, 251256, -702227, 296353, 32212, -454193, 375810, 1125818, -658741, -607738, + 880468, 176631, 302795, -57982, -125091, 204548, 703301, 114354, -112743, -309775, + 46708, 133681, -275415, 545998, -124017, 337692, -161598, 256087, 226023, -444529, + 267899, -17717, -41876, 63888, -429497, -209380, + }, + { + -22597970, -60014116, 7789997, -4670240, 3304977, -1389959, -12239046, 3955665, -5107790, 1899986, + -5844377, -614180, 745177, -1072668, 6886980, 9700721, -2831457, 3705483, -5657009, -3854196, + -9651328, 555661, -455803, -1524177, 1964411, 2197950, -3828427, 6748468, 1741609, 3632469, + 1191853, 437013, 1494112, 2398202, -2371359, -1611687, 769336, -2099702, -2746632, -844498, + 3860639, -4452271, -1865090, -177704, -2152852, 1817845, 436476, -3393561, 1440425, -2234457, + 556735, 1260036, -634045, 117038, -108985, -999654, 964757, 692564, -1928977, 594853, + 879931, -937377, 110059, 498216, -1231582, -85899, -454193, -333934, -506806, 628139, + -293668, 178241, 494458, 185757, -982474, 610959, -616328, 107911, 401043, -317291, + -171262, -382252, -52076, -1123134, 399432, -302795, 328565, 120259, -13422, 437550, + 121333, 75162, 493921, 68719, -135291, -55298, + }, + { + -4505421, -13131326, 6445136, 777389, -2637110, 2481417, -1865090, 1186485, -4008815, -1279900, + -30602, -944893, -1774358, -2281165, -4391604, -445066, 1545115, -1458678, -5289252, -8430484, + 2373506, -3808026, -4240207, 724239, 75162, 1889786, -2507187, 885837, -3419868, -3997004, + -183610, -3197066, 2036351, -2655364, -2521146, -2433636, 165356, -2951716, 778463, -2098629, + 870268, 1381369, -1264868, -314606, -1414118, 855235, 1335198, -333397, -963146, -1195612, + 1431835, 1160178, -401043, 342524, -317291, -656056, 832687, 1187559, 93952, -1654636, + -986232, 648003, -117038, 801011, -125091, 827318, 932545, 569620, -830539, 698469, + -128312, 513249, -61203, -610959, -1091459, -386010, 30602, -223338, 447213, -103616, + -549756, -136902, -268972, 32749, -36507, -210990, -537, -26844, 218506, 396211, + 180926, 160524, -290447, 213675, 34360, -156229, + }, + }, + { + { + 2041183, 48557828, -26601416, -11613055, 334471, -947577, -3712999, 2849174, -3810710, 2974265, + 9363029, 5349919, -2367601, -2047089, 8084202, -2626373, 2899640, 3483755, 3020436, -2805688, + 4344360, 861678, 3207804, -3678640, 675921, -2105608, -2029909, 972273, 965831, -446140, + 106300, 5608154, -1230508, 1690607, -3420405, -1198296, 1867237, 2555506, 1745904, 1926293, + -662499, 1842004, 969589, 1859721, -1934883, 3204046, 1187022, -829466, 462246, 1131187, + -1731946, -30065, -90731, 2570001, 601295, -832150, -135291, -875100, -690953, 1469416, + 585189, 1315871, 879395, -614180, 567473, 135291, -675384, 629213, -510027, 666257, + -325344, -230318, -107911, 755377, -468151, -132070, -359704, -362388, -363998, -132607, + 437550, -49392, 431644, 537, -226023, 450435, 157840, -231928, 388158, 272730, + 204011, 74088, -372588, 192737, -243203, 84826, + }, + { + -883153, 4781373, 1394791, 9955197, 3882114, -1677722, -108985, -114354, -761820, 227633, + -3056943, 5175436, -2084133, 5798206, 1662689, 3915937, 1629940, 2410014, -10355703, -220117, + 1926830, 3865471, 6629819, -2873870, -8810589, -5232881, -6658273, 2135136, 2656974, 930397, + 849867, 2611877, -960462, 2236067, -1361505, 4832, 2798708, 76773, -1022202, -1510755, + 157840, -591632, -271657, 2291365, 824634, -1636383, -1825361, 405874, 1549410, -228170, + -976568, -2388002, -562641, 45097, 341987, -2234457, 283468, -98247, 778463, -360777, + -445066, 334471, -1237488, -252329, 498216, -285078, -623844, 389768, -229781, -638876, + -593242, 221191, 467615, -168577, 375810, -471910, 224412, -597000, -394063, 203474, + -79457, -163209, 335007, 58519, 28454, 75699, 399969, -308164, -199179, -396748, + 135828, -132607, 637266, 119722, -35970, -252866, + }, + { + -1785633, 4222490, -10158135, 6128382, 12131135, 2414309, -707059, 1343251, -965294, 199716, + 398895, 5029407, -4352413, 12348, 5452998, 3929895, 2359548, -3063386, 137976, -804770, + 3357054, -5688148, -3687230, -5099737, -1887101, -1433445, 1656247, -2966212, -8067559, 572304, + -3505230, -911070, 3574487, -432718, -1953673, 2044404, -1234803, -35970, -1551020, -779537, + -967978, 950262, 311922, 2026151, 853088, -257161, -2119030, -926102, -2273648, -685047, + 936303, -545998, 1868311, 1860258, 685584, -156766, 1000191, 1142461, 911607, -31675, + -1110786, 823023, -567473, -357019, -989990, -206695, -984084, 82678, -241055, 916439, + 278099, 439697, 1207960, -151934, 438087, 11811, 266825, -34360, -94489, 213675, + 304406, -105764, -423591, -32749, 563714, 171262, -168041, -230854, -500364, 33286, + -375273, 27917, 52613, 27917, -94489, -36507, + }, + { + 14019847, 58200564, -11102490, 43271796, -2717641, 323196, -121870, 5742372, 409096, 876173, + -3900367, 7012608, 5216775, 3077344, 830002, -4639102, 2287607, 299037, 7932805, 3089692, + 4017942, 3117610, 3008088, 4791573, -1283122, 5034776, 1500554, -704912, 200253, -1006096, + 84826, 2107755, -1618666, 1693291, 425739, 1451162, -2331630, 1694365, -1990181, 62814, + 4364761, 1079111, -204548, 2197413, -2257542, 280247, 1607392, 816044, 1595580, -489626, + -1119913, -578210, -154619, 1827509, 196495, 251256, 1031866, -648003, -55298, -238371, + -910533, 165356, 350577, -597537, 917512, -1008244, 5906, 215822, -214212, 448287, + -156229, 369904, 1611, -106837, -492311, 390305, -737661, -863288, 95026, 488016, + 120259, -2684, -157303, 22549, -106837, -278636, 292058, -168041, 10737, 73551, + 28454, 90731, 22549, 86436, -128849, 193810, + }, + { + 2079301, -21859236, -5711233, -1822677, 1905355, -616865, -634045, 1422708, -290447, 227633, + 363462, -2087354, 2688650, 3221226, 3097208, -3395172, -11663521, 19814294, 7752953, -3064459, + 3211562, -10211285, -1611150, 2591476, -2069101, -4394289, 7232188, 318364, 2114735, 4241280, + 5057324, -1911261, 3493956, -4156992, -3977140, 964220, 1690070, -481573, -3442953, 3451543, + -1984275, -1984812, 1702418, 242666, 412317, -1046361, -1946157, 1959042, 529355, 1091995, + 977642, 538482, 273804, -399432, -404264, 287763, 564251, 826781, 442382, 120796, + -239444, 1507534, -1449552, 85362, 1078037, -420907, 308701, 48318, 476741, -911070, + 1158567, -152471, -347892, 83215, 219580, 70330, 161061, -240518, -90194, -119722, + -434865, -399969, -167504, -3221, 512712, 584652, 100932, 92879, 179315, 423054, + -210990, 86973, 674847, 184684, -153545, 533650, + }, + { + 23030152, 74546672, -10910828, -14401562, 10972031, -259309, -159988, 4578972, -4808216, 1606318, + -2266132, 3219078, -715649, 1149978, 1203128, 338229, 1086090, -1641214, 4322348, 494995, + -1693828, 1809255, 537945, -1226213, 1249836, -1338419, -804233, -244276, 3416647, 3371549, + -3555159, -1830730, -4744328, 697395, -1747515, 2475512, -1154273, -310311, 1793686, -1960653, + -1772748, 2183454, -1586454, 1523640, 1542967, 104690, 2437931, 1725503, -1514513, 190052, + -3508988, 1052804, 1937030, 957778, 3602404, 753767, -545461, -5369, -776315, -269509, + -359704, -819802, 967441, 799401, 508417, 873489, -306553, -127238, -574452, -702764, + 1164473, -1109175, -1003412, -648003, -549756, -352187, -455803, 346282, 414464, -182536, + -224412, 271657, -78383, 171262, 65498, 69793, 2684, -73551, -323196, 93416, + 21475, 130460, 37044, -66035, 9664, 186831, + }, + { + -278099, 15457587, 1123671, -1469953, 830539, 341987, -1155346, -568009, 519691, -104153, + -1449552, 1994476, -2209224, -748935, 7295539, 8344048, -5134097, -5248450, 11742977, 11329587, + 213138, -839129, 641561, -12382391, 162135, -4793184, -10723460, -12251931, 3026878, -2521146, + 410706, 4869419, -5667746, -1069984, 4261145, -2288681, -3823058, 629213, 2739116, -1606318, + -2373506, -2192044, 2361695, -91268, -1935957, 1566053, -1014149, -223875, -143881, 1696512, + -1094680, 303869, 188442, 1302986, -572304, 459025, -714575, 1491427, 496606, -585726, + 68719, 190589, 684510, -230854, 272194, 5906, 379568, -158914, -396211, 96637, + 107374, 518080, -234076, 363998, 530965, -594316, 513249, -131533, -713501, -483721, + -216359, -468688, 227096, -59593, 61203, -74625, 58519, -197569, 228707, -17717, + 24159, -154082, -29528, 73014, 95563, -73014, + }, + { + -30361124, -50160924, 8891656, -24643986, -3646427, 1059783, 2766496, 4200478, -3429532, 4199941, + -99858, 6269042, -2255932, 4299263, 1779190, -4679904, 3126736, -7617662, 1476932, 1913945, + 2667175, -6979, -834834, -5427765, -2032593, -400506, 398895, 819265, 2417530, 1940788, + 1880122, 541703, 759672, 81068, -174483, -1795296, 5711233, -1062468, 1463510, -1661616, + 1461900, -649077, -135828, 1006633, 874563, -1295470, -1675574, -1939715, 1439888, 279710, + 1848983, -158377, 1327682, 693637, 685047, 1358283, 178778, 628139, 295279, -496069, + -521302, -399969, 1143535, 761283, -273804, 108985, -526670, 199716, 284005, -1146219, + 26307, 219043, 357556, 759136, 202937, 78383, -329102, 246424, 196495, 885300, + 235149, -145492, 121333, 537, -518617, 25233, 346819, -296890, -206695, 358093, + 293668, -48855, 78920, 272730, -369367, -227096, + }, + { + -779537, 3633006, 5609228, -1062468, -340913, -456877, -1471563, 862752, 709207, -1330903, + 1235877, 1436130, -2510409, 1750736, 1908039, 23482196, -13871671, 4735739, 3748970, 585189, + 23085, -1763621, -3025805, 571231, 498216, -3777424, 3482682, 6725919, -145492, -1164473, + -7013145, -102542, 4967667, 268435, 710280, 1088774, -2264522, -2029372, 1757179, 976031, + -705448, 1645509, -621697, 2108829, -883690, 412317, -1924145, 164283, 2680597, 66035, + -1433445, 795106, 59056, 166967, 2137283, -794032, -1253594, 1717987, 415538, -339302, + -481036, -1580011, -1011465, -497679, 460098, -1644436, -168577, -395137, 576063, -535797, + -154082, 151398, 103079, 205622, 53687, 293132, -520765, -215285, 270583, -175020, + -76236, -250182, 325881, -197569, -571231, 38118, -66572, -165893, 195958, -58519, + -75699, 63351, 16106, -144955, -38655, -85899, + }, + { + 16166794, -75663368, -4833986, 11712376, 369367, 7638063, 3957276, -3501472, -4117800, 279710, + 3879966, 1596117, -4527433, -535260, 641024, -719407, 1118839, 6106907, -9208947, -392990, + 1100585, 250719, -1875827, -4792647, 2783676, -1015223, 670552, 3711926, 3486977, -2131378, + -1894618, -575526, -1426466, 2644089, -1791538, -1910724, -1333587, -3687230, 3425773, 1255204, + -4151623, 1950452, -915365, -2539936, 123480, -1528472, 1976222, 467615, 898722, -66572, + 191663, 2017024, 2034741, 969052, 106300, 1287417, 104153, -207232, -10201, 909996, + 1271310, 82678, -930397, -274878, -616328, 756451, 454730, -482110, -889595, 1484448, + 72478, 141734, -477278, -386010, -26307, -587874, 135291, -25233, -241592, -548682, + -482647, 194884, 61203, -385473, -26307, 573378, -239444, 251256, 115427, -27380, + -131533, 209917, -125091, -262530, -84289, 401579, + }, + { + -565325, -11800960, -4238059, -3092913, 473520, -642635, -1138166, 541166, 32749, -4765266, + 231391, -5013838, 4186519, -1715839, 1707250, -4107599, -826781, -2666101, 5674189, -4965519, + 4567698, 1568737, 9162776, 5204964, -2830920, -7218230, -2602750, -624381, 1861332, 881542, + 579284, 4674535, -1388885, -2736431, -1812476, 1595580, 914291, -1596654, 1277753, 993748, + -602906, 1784559, 617402, 2030983, -2911988, 575526, 1374926, 262530, -1530619, -292058, + -2289218, 414464, 618475, 397284, -1464047, 517007, -42413, 90731, 146566, 1624035, + 1529545, 860067, 216896, -406948, -26844, 449898, 138513, 248034, 123480, -160524, + -331249, -129923, 201863, 754841, 69256, -157840, 180926, -622770, -231928, -236223, + 70330, -506269, 303332, 6442, 534723, 135828, -745177, -301185, -158377, -162672, + -55835, 321049, 253940, 140660, -108985, -125091, + }, + { + -41438920, -102870912, -1599875, -3454228, -13900125, -20557860, 1620276, 2389613, -4454955, 4615479, + -4291746, -1140314, -6516003, 8514236, -2434710, 4621922, -2020245, 1311576, -6504191, -5993090, + 3091303, 7430294, 382252, 1831267, -3010235, -5539434, -2185065, 2594697, 2990908, -727460, + -988916, -3035468, 389768, -67109, -4248260, 682900, -1619740, -2616172, -3332358, -212601, + 242666, -3542274, 3505230, 170188, 93952, 628139, 993748, 691490, 1676648, 1212791, + 137439, -641561, -925029, 478352, -303869, 609885, -284542, -595927, -959388, -146566, + 491237, -372052, 976031, -404264, -398895, 111669, -819265, -30602, -385473, -326954, + 25770, -785442, -586263, 500364, 149250, -682363, 324270, 55835, 227096, 373662, + 710280, 187368, -117575, 321049, 232465, -46171, -285615, -365072, -324807, -223338, + -537, 0, 333397, 73551, 115427, 132070, + }, + { + 2279017, -9187472, -7915625, 1919850, 4379793, 2848637, 3525631, -3595425, 15569, -577673, + 1122597, 4904316, 2432562, -3099893, -12596065, 6878927, 8323110, -1005022, 5849209, -1294933, + 3580929, 22694608, 7111929, 4767951, -13020730, -7758322, 5490042, -1567663, -7082938, 5442261, + -1233729, 307627, -1316944, 1435593, 163746, 1457068, 669478, -819802, -2123325, 2213519, + 928250, -3852586, -947577, -1409823, -974421, 3268470, 540629, -511101, 482647, -318901, + 621160, 1299765, -260919, 841814, 1930051, 306016, 264677, -447750, -989990, 53150, + -481036, -501437, 336618, -710280, 361314, -476205, -301721, 341987, 625992, -605054, + 245350, 479963, 366683, 207769, -155693, 296890, 464393, 340376, -23622, -527744, + 66035, -445066, 502511, 263067, -91805, 341450, -570157, 353798, 156766, -52613, + -318901, 81068, 192737, 43487, -228170, -111132, + }, + { + 5168457, -91169272, -1447941, -5808407, 4752382, -9473087, -3357054, 1246077, -2378338, -900333, + -329102, -4816806, -1407139, 10168335, -847182, 4330401, -1601486, 11104638, -10451266, -1116155, + -4003983, -2093797, -1665911, 1560147, -1685238, 251256, 1873680, 2158221, 3113851, 2267206, + 1355062, 1610613, 1040993, -1255204, 836982, -1082869, -2587718, -2351495, -856309, 1134945, + 343597, 1793686, -4064650, -2116882, -599685, -3034395, -881542, -248034, -36507, 341987, + -415001, 1518271, -1471026, 1238024, -506806, -989453, 2189897, -484258, -22012, -128849, + 619549, -178241, -406948, -56908, -998580, -998043, 53150, -651224, -245350, 572304, + -412854, -66572, 885300, -461172, -504659, 265751, 306016, -242666, 252866, -125091, + -403190, -95563, -309775, -935229, 18790, 272194, 27380, 155693, 78920, -28991, + 380641, 292058, 128312, -91268, 158377, -119722, + }, + { + 4455492, -13472776, -4573067, 4975720, -3467649, -920734, 1322850, -1971927, -1785633, -3260954, + -442382, -2581275, -1387274, 97711, -1087164, -2630131, 3272765, -4756140, -4637491, -8268349, + 1269163, -6696391, 1814624, 2149094, 106837, -2488934, 814970, 1261647, -9740449, -2146947, + 1224066, -1780801, 2448668, -3542811, -2808372, -2134062, 3176665, -2006287, -543313, -2527588, + 3027952, 1101659, -413391, -2189897, -797790, 261993, 758062, -353261, -1695438, -1185948, + 653909, 2374043, -747861, -414464, -555661, 1380295, 1600412, -972810, 959925, -901406, + -1117765, 994285, -32212, 558346, -311385, 1364726, -877247, 526670, -373125, 216359, + 622233, -281320, 703301, -844498, -390842, -1153199, 186294, -125628, 111669, 256087, + -388158, -312996, -755377, 84826, 424128, 46171, -267362, 27917, 41339, 308164, + 90731, 183073, -199716, 171799, -353261, 139050, + }, + }, + { + { + -2159295, 38489348, -16426639, 7100655, 11072963, 1425392, -624381, 9301825, -522375, -1335735, + 2273648, 3131031, -3781719, -2706366, 7845832, -2125472, -1555852, 1353989, 2401961, -5013301, + 2763812, -446140, 3121368, -5218386, 5476620, -143881, 765041, 4032974, 1869385, 656593, + 1369558, 2487323, -6018860, 365072, -4792647, -594316, 824097, 875100, 2915209, 2305324, + 170188, 1628330, -2949032, 1647120, -845572, 1481764, 1656247, -54761, -226560, 771484, + -1422708, 893890, 1584306, 843961, 573915, 1129040, 654983, 63888, -738198, 837519, + -6442, 257161, 193274, -531502, 538482, 1009317, 318364, 1133335, 273804, 715112, + -784368, 114354, -359167, -31139, -244813, 543313, -123480, -463856, -107911, -410169, + 420907, -121870, 323733, -85362, -273267, 377957, -12348, -273267, 233002, 89121, + 138513, 206695, -175557, 188979, -25233, 301721, + }, + { + 1231582, 2248952, -1872069, -10039486, -12232604, -8053, 2323041, 4379793, 2173790, -794569, + -6690486, 361314, -1801739, 4320737, -639413, 1018444, -8431558, -1523103, -4587025, 5548561, + 890669, -1711008, 1932198, -3274913, -3559454, -739808, -6887517, -396748, 20401, 19864, + -111132, 3224447, -3362423, -3378529, 3979287, 321586, 2079301, 3551938, 1146219, -365072, + 1700270, -124554, -8053, -1593433, -1684164, -1242856, -1556926, -1494649, 1140314, 1119376, + 275952, -212064, 934155, 206695, 701153, -281857, 1125281, -125628, 855235, 268435, + -605590, -100932, -532576, 17180, -599148, -818191, -598611, 248571, 31675, -324807, + -337155, -139050, -148176, -940061, -186294, -693637, 474057, -259846, 315680, 13422, + -229781, -301721, 154619, -217970, -146029, -140660, -284005, -454730, 105227, -301721, + 241592, -232465, 302795, -137976, -99321, -161061, + }, + { + 3555696, 13049721, -9837623, -28749974, -12380780, 2432025, -1803886, 530965, -1983738, 2073396, + 4654134, 9543417, 156229, 747861, 2398739, 278099, 1120450, -5406827, -6046777, 1897302, + 6561637, 980863, 819265, 1068373, 4840428, -1866700, 3688840, 2519535, -1418413, 872952, + -3103651, 3292629, 5390721, 1433445, -614180, 742493, -3081102, 277562, -166430, 1448478, + 720481, 1835025, -622770, 181999, 376883, -186831, 56908, 1093606, -923418, 19327, + 1910187, -1478543, -118112, 574989, 63351, -994285, -1611, -268435, -20938, -681289, + -2174864, 0, -289373, -62814, -391379, 248571, -1103807, 95026, -1125818, 392453, + -66035, -262530, 629750, -772020, -288300, -152471, 79994, -240518, -190589, -108448, + 120796, 163746, -353798, -70330, 204548, -184147, -237834, 147640, -344671, -9127, + -48318, 9127, -170725, 24696, 27380, 36507, + }, + { + -18684182, -1570347, -15871515, 51452096, -1888712, -599685, -199179, 3473018, -2405182, 1174137, + -5624260, 3619047, 1222992, -1366337, -4194036, -6736120, 1180042, -1899986, 5785858, -1091995, + -1195075, -119185, 1213865, 148713, -4311611, 2393908, 2403571, -1481764, 481573, -1603633, + -951872, 1418413, -3955128, 863825, 28454, 1318555, -504659, 1285806, -1823751, 497679, + 3252901, -1553168, -2385318, 1648731, -1326608, 30602, 1001264, 1596117, 1527398, 726923, + 1211181, -35970, -1901597, -619549, -363462, -1015223, 81604, 527207, 91268, -237834, + -426812, 767725, 1664837, -344671, 194884, -317291, 685584, -97174, -273804, -163746, + -1113470, 24696, 133681, -113280, -721018, 664646, -60130, 63351, 344671, 62814, + -613107, -159451, -212601, 75699, 84826, -134218, 447213, -442919, 156229, -13422, + -243739, -54761, 122407, 220654, -113280, 158914, + }, + { + -2352568, -15167140, 7211250, -2017024, -355945, -918586, -557272, 3604551, 2712272, -661425, + 884763, -1779190, 2477659, 8150774, 8257075, 1036161, 1890859, 24653650, -3891240, -6796786, + 3213173, -8179229, -3433826, 1411434, -513785, -10663330, 445603, -3059091, 2047089, 2007897, + 4018479, -4581120, 3034395, -2693481, -7705172, -3405372, 3477850, 545461, -2736968, 2292976, + -2817499, -1647657, 934155, -1675037, -433255, -1290101, -787590, 2177012, 991064, 1509144, + 101469, -657667, 59593, -1090922, -341450, -275952, -537408, -692027, -209917, 941135, + -452045, 771484, -346282, 45634, 212601, -1265942, 607738, -2684, 836982, -233002, + 438624, 347892, 68719, -220117, -289373, -439697, -318364, -156766, -222801, -26844, + 113817, -184684, -20938, 49929, 64961, -80531, -98784, 266825, -133144, 151934, + 3758, -42950, 185757, -3758, 13422, 459025, + }, + { + -27074400, 6662031, 4483409, -22800370, -4152160, 1922535, -273267, 2104534, 52076, 4125316, + -3308736, 4256850, 14496, -1544041, 142271, 1307281, 2800319, -212601, 3759707, 2003602, + 4821638, 2427194, -3299609, -1745904, 660351, 7516, 703301, -2288144, 1336809, 2690260, + -1661079, 454730, 344671, 2568927, -3779571, 493384, -799401, 1651415, 3578782, -2413235, + -4083977, 1123671, -777389, 780610, 1743757, -133144, -1211181, -1113470, -91805, 235149, + -2930778, 2982318, 1351841, -784368, 1554241, 1434519, 62277, 875636, 312996, 499290, + 800475, -209380, 288837, 5369, -385473, -280247, -1128503, -543850, -49392, -831076, + 994285, -377957, -562641, 67646, -434865, -288837, -624918, 459025, 609885, 118648, + -114890, 294205, 52613, 279710, 246961, -57445, 23622, 371515, -291521, 472446, + 266825, 374199, 108448, -115427, 178241, 316754, + }, + { + -120796, 12208445, -4772246, -904091, 1025423, 56371, -456340, -187368, -732292, 1791538, + 303869, 619012, 433255, -2132988, 1508607, -10282689, -11894375, -3088082, 1862942, 4054986, + 5664525, -718333, -425739, -15285789, -2310693, 1177895, 4825396, -5650030, 5002563, 3651796, + 1100585, 5792301, 2884071, 5176510, 3463354, -3219078, -326954, 957778, 993211, -944893, + -83215, -1970853, 1574106, -71941, -130997, 2071785, -1211181, -575526, -163746, 2071248, + -513249, -492848, -1251983, 358093, 501974, 483184, -956704, -88584, -804770, -611496, + -315143, -509491, 693100, -1334124, -1126892, 11811, 1673427, -108448, -936303, 251792, + 402116, 787053, -231928, 97711, 670015, -415538, 363998, -143345, -651761, -126165, + 275415, -93416, 380641, 64425, 266288, -217970, 32749, -73014, 91805, -73014, + 23085, -290447, 83215, -54761, -32749, 42413, + }, + { + 20410222, -252866, -9818295, -16699907, 7064148, -143345, -220117, 3417720, -3714610, 2280628, + -659278, 1563905, -10678899, -1425392, 4545149, -2670396, 5120138, -2464774, 5408975, -1553704, + -4069482, -1165547, 37044, -3602941, -105764, 1137093, 1761474, 261456, -1382980, 696322, + 3373160, 3367791, 1578937, 1615445, 882079, -4348655, 1756642, -3716757, 664109, -3432216, + -83752, -1721745, -83752, 1069447, 2930778, -1036161, -794569, -994285, -173409, -1927904, + 246424, -2016487, -166430, -335007, 241592, 364535, -346819, 1136019, 366683, -543850, + -180389, -854699, 331249, 368293, -481036, -352187, -586263, 357019, 267899, -617402, + 239981, 227633, 367220, 779000, 130997, -102005, -336618, 435402, -47782, 6979, + -122943, -74625, 382252, 689879, 44560, 270583, 750546, -106837, 16106, 133144, + 122943, 321049, 141197, 193810, -113817, -124017, + }, + { + -69793, 3898220, 1468342, 2686502, 944356, -70867, -725313, 1282585, 381178, -1875827, + -1785096, 156229, -3679176, 1791001, 1909650, 20429548, -11330661, 5407364, 2857227, -2985002, + -4738423, -2479270, -6112276, -544387, 286152, -5259188, 2648921, 3188476, 4018479, 41339, + -5124433, 7793218, 2768107, 720481, 5663988, 431644, -1481764, -158377, -362925, -1250372, + -2098092, 723165, -1264868, 694174, -2227478, 416075, -462246, -846645, 308164, -960999, + -1126355, 1116155, 722628, 115427, 1652489, -229244, -1250372, 675921, 345745, 18254, + -892279, -1043140, -162135, -388695, 1037235, -773631, 568009, 353261, 746251, -772557, + -271657, -790811, -133144, -78920, -1071594, -140123, -534187, -284005, 144955, -205622, + -173946, -299574, 387084, 86973, -221191, 195958, -142808, -514859, -129386, -200253, + -8053, -168577, -108985, -326418, -92342, 47245, + }, + { + -15434502, -99636264, 9715753, 9466108, -16417512, 5508296, 13651017, 292058, -284005, 3023657, + 718333, -3272765, -9545028, -2410014, 4059818, -2951716, -4246649, 5135707, -7996692, -3675418, + 3391414, 4163434, -1564442, -5161477, 4053912, 2646774, 3538516, 2984466, 590021, -1331440, + 128312, -2572686, -1496796, 2839510, -1935957, 1108102, 3138011, -2550137, 2991982, 1251983, + -2659122, 2931852, -1238561, -575526, 2748242, -4131222, -2070711, -1526324, 704375, -1006096, + -152471, 506806, 556198, -748935, -922881, 1503775, -341987, 1234803, 832150, -584652, + 1277753, 585189, -318364, 976568, -991064, 1462973, 1298691, -407485, -633508, -45097, + -470836, 731218, -338766, -237834, 529355, 368830, 586263, -191126, 150861, -288837, + 391916, 120259, 175020, -121870, 452582, 255551, -630823, 391916, 496069, 115427, + 54224, 49392, -38655, 142808, -57445, 228170, + }, + { + -268972, -17964238, -3283503, 592706, -650151, 4038343, 1846299, 1205275, 1414655, -1279900, + 2865817, -7381975, 2857227, -4800700, 151934, 835908, 415001, -2565706, 1358820, -10673531, + 463856, -5458904, 2184528, -1376537, -1899986, -4802311, -2645163, 2234994, 2079838, 82678, + -2447058, 2376191, -1497333, 456877, 50466, 763430, 1362042, -2740189, 1258425, 2863133, + -1447941, -279173, -435939, 2138894, -2229088, 1674500, 1111323, -1029718, -2301566, 353798, + -1180579, -1401770, -971736, 1294933, -216896, -641024, -442382, -162672, -992674, 254477, + 1180042, 881005, 251256, -770947, -341987, -359704, 263067, -82141, -455803, 183610, + 230318, 199179, 322123, 803159, 108985, -227633, -68183, -259846, 155693, 145492, + 59056, -473520, 200790, -127238, 551366, 140123, -426276, -261993, -171799, -179852, + -513785, 57982, 161598, -141734, -92879, -35433, + }, + { + 48309792, 18202072, -2199560, -3094524, -6160057, -11316702, 6806450, 4530117, -2076080, 6186364, + -2675228, 1640678, -7078643, 2922188, -7052873, -3462281, -6424198, 138513, -5806796, 526670, + 7879655, 2559264, -781684, 1837709, 3134789, -3044595, -2266132, -833224, 68183, -1979980, + -1381369, -3885872, 455267, -394063, -3062312, 3251827, -59593, 1443646, -2715493, -1255204, + 766652, -4146791, 3530463, 965831, 1647657, -716723, 202400, 1468342, 570694, -1264868, + -674310, -1246077, -2536178, -817118, -17717, -377957, -2147, 335544, -572304, -401043, + 142271, -898722, 1197759, 555661, 560493, 903017, -487479, 234076, 252329, 156229, + 43487, 87510, 15569, 490163, 15032, -556198, 456340, 73014, -68719, 76773, + 246424, 13959, -485868, 25233, -136365, -273267, 197032, -106300, 255551, 429497, + -155693, -207769, 136902, -4295, 68183, 194884, + }, + { + -1935420, 5818607, 8629663, -143881, 925565, -183610, 2051384, -4853313, -1087164, 709743, + -382252, 220654, 688269, 6852621, -3415036, 3337727, 2847563, -5644124, 3708704, -532039, + -9532680, 12902619, 8738111, 12591233, 605590, -5496485, 1161252, 3452080, -4563940, 3150896, + -2589865, -1018981, -2919504, 875100, 1702418, -569083, -1543504, -168577, -1601486, 12348, + 155693, -883153, 1706176, 446677, -1333587, 1133871, 1713692, -1145146, -456877, 591632, + 487479, 32749, -1606318, -167504, 1298691, -337155, -905701, 233002, 931471, -35433, + 54761, 379031, 480499, -516470, -548145, -769873, -22549, 261993, 608275, -963146, + -739271, 221191, -217433, 96100, 76236, 51540, -102542, 107374, 264677, -376347, + 359704, -14496, 484794, 234076, -226560, 405874, -193810, 127238, 51540, 112206, + -214748, 307627, 271120, 373662, 154082, -53150, + }, + { + 13105556, -79381736, -5752035, -2001455, 12525198, 1953673, 7574175, 4507568, -2132988, -1304596, + 2360085, -4185983, -2619393, -536334, -19114752, 89121, 1540820, 13775034, -8808978, 4490389, + 2974802, -986232, -860604, 3408057, -2842732, 2095407, 3702799, -1159104, 1991791, -1716913, + -2799782, -477815, 458488, -947040, 791348, 797790, 2893197, 2490007, 2617783, 1788854, + -2329483, 1933272, -3537979, -1338419, 2245731, -284542, -372588, 1291711, -353261, -53687, + -1227824, 2065342, -742493, 553514, -49929, -706522, 3052111, 1202054, 921807, -214212, + 79994, 252329, -435402, 470836, 357556, -980326, -336618, -490700, 134218, 767189, + 307090, -495532, 937914, -120796, 48318, 153008, 328565, -271120, 390305, 482647, + 199179, 425739, -60666, -302258, 108985, -227633, -313533, 144418, 373662, -102005, + 126165, -96100, -138513, -209917, 154619, 7516, + }, + { + -3517041, -10901164, 6266894, 7977902, -569083, -416612, 3537979, -1554778, 579284, -962610, + 550830, -2917894, -1366337, 14271103, 11526618, -11614665, -1957431, -3600793, -1456531, -1765232, + 9024263, 1129040, 8028905, 3748970, 4120484, -807454, 674310, 4281546, -4494684, 1218697, + 1976222, -651224, 193274, -2986613, 1960653, 2851322, 3615289, -506269, 2798171, -303332, + 2263448, -752693, 749472, -1157494, -603443, -868657, -900869, -1228898, -599685, -809601, + -293132, 1505923, -629213, -313533, -49392, 1844689, 1414118, -955093, 1596654, -310848, + -1525787, 685584, 1068373, 917512, -538482, -155693, -2193655, -47782, -403727, 778463, + 982474, -440234, 91805, -535260, 510027, -550293, 696322, -228707, -335007, 263604, + -176094, -2147, -301721, 289910, 290984, 251792, -205622, -12885, -124017, -120259, + -439697, 1074, -75162, 338766, -279173, 366146, + }, + }, + { + { + 531502, 1617055, 35664336, 16703128, -488016, 1822140, -25770, 7082401, 900869, 1034550, + -170725, 3299609, -7241315, 5544803, -1134945, 1948841, -2319819, -1695975, 3642132, -1989644, + -4715337, 631897, 4864051, -5144297, 6684580, -864362, 869194, 642635, 1797981, 3013457, + 2360622, 318364, -3856344, -2618856, -2451890, -1708860, 1808181, -307627, 3799436, 2684, + 1754494, 2272038, -3500398, 187368, 1906429, 540629, 672162, 876710, -455803, -602369, + 1016834, 872415, 2153389, -890669, 1476932, 2081449, -283468, -135828, -914828, 830539, + 82678, -246424, -154619, 68719, 320512, 1015223, 82678, 992137, 1088237, -85899, + -486405, -96637, -306553, -3221, 46708, -10201, 314069, -439697, -78383, -706522, + 348966, -257698, -47245, 11274, -24159, 200253, -114354, -122943, -40802, -107374, + 159988, 305480, 78920, 31139, 247497, 1074, + }, + { + 33286, -11009612, 13259638, -18561238, -6276558, -82678, 2829847, 1475858, 5370320, -2451890, + -4685810, -1544041, 1588064, 3192235, -2747169, 3177202, -11493869, -3236258, 842350, 5770289, + 544387, -4776004, -94489, -4367982, 1124745, -2605435, -7826504, -193274, -2925410, 3280818, + 969052, -1074279, -1448478, -3185255, 3607773, 141197, -89121, 3685619, 1406065, 729608, + 2063732, -224949, -909459, -2298881, -69256, -1144072, -2007360, -348966, -27917, 1512902, + -492311, 181462, 1302986, 113280, 1360431, -457951, 1665374, -491237, 767189, 831076, + -944893, -411243, -548145, 335007, -1071058, -1341640, 129386, 270583, -110059, 104690, + 407485, -1056025, -24696, -326418, -578210, -147103, 446140, -492311, 184684, -57445, + -130997, -338766, 170725, -477278, -165356, -241055, -214212, -187368, -297963, -30602, + 120259, 102005, -232465, -126702, -2684, -120796, + }, + { + -4608500, 24676734, -4981089, -41104448, -3507915, -1417876, 475668, 2486249, 10201, -1453846, + 976031, 12557411, 3460670, 2483565, 59056, -4109210, -22012, -1148367, -4321811, 543850, + -302258, 9057549, -3971771, 8624831, 1494112, -4869419, 7245610, 1755031, 1008780, -581968, + 373125, 1682017, 5093831, 3842922, -1758789, -1235877, -1027034, -607201, -24159, 995359, + -46708, 1604707, 1774895, -2575907, 65498, -836982, 1358283, 185220, 1063541, 59056, + 1149978, -1177895, -1014149, -217970, 923955, -332323, -933619, -661962, -466004, -380105, + -1879585, -491237, -650688, -32749, 889058, -428960, -1224066, 645856, -1235877, 35970, + -77846, -358630, 26307, -308701, -310311, -256624, 142271, -511101, 195958, -542240, + 105227, 32212, -171262, 284542, -406948, -100932, -255551, 164819, -181999, -249645, + 110595, -115964, -46708, 67646, 252329, -35970, + }, + { + 10260677, -75571024, 9964324, 49963892, 151398, -809601, 2272038, -1727114, -788127, 1910187, + 1133871, -1766842, -3591667, -170725, -124017, -1996086, 2274185, -4070555, 1919314, -1163399, + 1379221, -2991445, -1313186, 469762, -1736241, -1730872, 2044941, 720481, -1742146, -2552821, + -2204392, 2276870, -2556043, 936303, -390305, 645856, 1422171, -91268, -252866, 642098, + 2362769, -2151779, -287226, -651224, -1494112, 885837, 2128693, 736587, -308164, 1314260, + 1611150, 579284, -2751464, -940061, -1066763, -668941, 399432, 311385, 445066, -318901, + 22012, 35970, 1050656, -280784, -37044, 395137, 20401, -279710, 83215, -641024, + -695785, 90194, 53687, -47782, -406948, 166430, 490163, 270583, 16106, -363462, + -301721, -214212, 43487, 115964, 191663, -59593, 362925, -211527, -61203, -29528, + -301185, 26307, 35970, 135828, -57982, 35433, + }, + { + 2264522, -7090454, -1612760, -2602750, -697932, -345745, 1255204, 796716, 3612604, -291521, + -3782256, 2911451, 3417720, 1636919, 10415296, 6692633, 8980240, -3439732, -1095217, -3466039, + 525597, -1178432, -10660646, 5378910, -3944928, -7456600, 316217, -1453846, 2480881, 1887638, + 1648731, -954020, -1584843, -1674500, -4395899, -3595425, 1627256, 890132, -1338419, -1563368, + -1788854, -1444720, 588411, -1056025, -162672, -1702955, -390305, 156229, 2384781, 608275, + -556198, -613643, 744640, -972810, -179852, -590021, -839129, -577136, 699006, -10201, + -175020, -437013, 695248, -652835, -367757, 197032, -2147, 274878, -241055, 618475, + -705985, 964757, 166967, -347892, -67109, -215285, -506806, -166967, -517544, -90194, + 413927, 74625, -280247, 250719, -69256, -153545, -134218, 382252, -137439, -272730, + 57982, 137976, 34360, 85362, 23085, 117038, + }, + { + 12874164, -48668420, 3062849, -34368328, 8013335, 1542967, 2579128, -2698850, 1464047, -1647657, + 3238405, 1075889, 5546414, -6296959, -481036, -486942, 2054605, 1229434, 4387309, -2842732, + 8270497, 1813013, -3840775, -226023, -198642, -972810, 628139, 34897, -751619, -2012729, + 1415192, 2553358, 2344515, 401579, -2792803, 637266, -10737, -167504, 3399467, -606664, + -4010426, -1032403, -362925, 1016297, 447213, 1193464, -3233037, -1468879, 1093069, -603443, + -423591, 1485522, -177704, -578210, 859530, 2008434, 75162, 233002, 568546, 135291, + 1129040, -229244, -95026, -893353, -23085, -62814, -1356136, -596464, 288300, -705985, + 526670, 806917, -1438277, 390842, 122407, -783832, -385473, 366683, 598611, 197569, + -103616, 435939, -54761, 283468, 403190, -195958, 23085, 363462, -245887, 453119, + 224412, 181462, 165356, -132607, 239444, 228170, + }, + { + 268972, 3305514, 99858, 466004, -623844, 247497, -448824, 1166621, -1174674, 358093, + 1724966, 191663, 591095, -3972845, -1801739, -8285529, -6525666, -6518687, 8712341, -7350837, + 8788040, -6818798, -4124242, 427349, -1050120, 1774895, 92879, -879395, 2090575, 4810364, + 2007360, 2035815, 8507256, 2896419, 479963, -2588792, 3893925, -387621, 373125, -2741263, + 1193464, 256087, -648540, -1083942, 1449552, 931471, 506269, -870268, -200790, 1528472, + -103079, -1559073, -992137, 847719, 609885, -365072, 157840, -1124745, -1372779, 146566, + 369367, -760746, 20938, -762357, -825707, -55835, 748935, -346282, -164283, 519154, + 531502, -245350, 250182, -155156, -99321, 387621, -313533, -8590, -319438, -158377, + 32212, 523449, 128849, -70330, 149250, -140123, 126702, -31675, 149787, 92342, + -160524, -130460, 4832, 179852, -34897, 41876, + }, + { + -1351841, 10548440, 9773735, 1086090, -11592654, 1822677, 436476, 303332, -1734630, 860067, + -943819, -1729798, -2857227, -5357435, 6485401, -3413425, 4641786, 938987, 3143916, -795643, + -8910447, 1780801, -819802, -2315524, 287763, -743566, 1559073, 378494, -2235531, 3448322, + 1970853, 2301566, -416075, 2304250, 1234266, -3267396, -957778, -2032056, -537, -1800128, + -2498597, -1850594, 2275259, 814433, 842350, 70867, 483184, -197032, -2182917, -2155000, + -1015223, -272730, -1971390, -104690, -332860, 271657, 12885, 1364726, -238371, -62814, + -739808, -838056, 51540, 384400, -213138, -210990, -616865, 768262, -654983, -221728, + 617938, 104153, 16643, 913754, 34897, -251256, -473520, 252329, 540629, -627602, + -2147, -135291, 318901, 156766, 713501, -186294, 521839, 438624, 66035, -72478, + 199716, 117575, 66572, 154619, -140123, 107911, + }, + { + 724239, -2837363, 3900367, 2134599, 1699733, 483184, 82678, -914828, 1828582, 836982, + -4394826, -981937, -3740380, 3333968, 4794794, 7212324, 13259638, -4568235, 4555350, -6131066, + -7456600, 2794950, -2726767, -6954089, 1343251, -299037, 341450, -48318, 4214437, 964757, + -3081639, 9212168, -2270964, 1930588, 6793565, -2292439, -158914, 265214, 862215, -2936147, + -1223529, -2160906, 677531, 585726, -2816425, -569620, 2098092, -362925, -1396938, -951335, + 83215, 101469, 1644973, -153545, 435402, 184147, -348966, -1237488, 388158, 1131187, + -611496, -503585, 419833, 301185, 449898, -573378, 817118, 818728, -83752, -824097, + 180926, -1297617, -202400, -440771, -1044214, 156766, -222801, -571231, -345745, 100932, + -71941, 200790, 236760, -112743, 169114, -90194, -86973, -368830, -298500, -172872, + 244276, -234076, -231928, -202937, -468151, 358630, + }, + { + 15352361, -111282064, -17894982, 13058848, -17673254, 8094403, 4129074, -722628, 5136244, -4427575, + 770410, -4270808, -2331094, -5963025, 9315247, -5643050, -3657702, 2047626, -3751117, -2812130, + 1745367, 4248797, -1558536, -3597572, 595927, 2072859, 3098819, 3033858, -883690, -1028645, + 1592896, -3652870, -2069101, 2202245, 200253, 2450816, 3350611, -1275068, 1362578, -794032, + 1364189, -783832, -1611, 2142652, -494995, -2221572, -2672544, -1305133, 848793, 353798, + -1140851, -625455, -720481, -369904, 386547, 279710, -129923, 1361505, 1281511, 648003, + 74088, 296353, 495532, 762357, -906775, 1542430, 606127, -238908, -207232, -1065689, + 80531, 747861, -273267, 193274, 678068, 366146, -217433, 323196, 177167, -4295, + 459562, -157840, 231391, 97174, 258772, -251792, -507880, 267899, 234613, -81604, + 440234, 44560, 121333, 19327, 184684, -207232, + }, + { + 636729, -26593900, -2566780, 10107669, -3217468, 1274532, 5654862, -267362, 92342, 1095754, + 783832, -3071439, -3178813, 3765613, -5287642, 6243272, -991064, -3640522, -6426882, -2027225, + -4402879, 1577864, -3395709, -8074539, 2525978, -2314987, -3092913, 4460861, 623307, -2839510, + 2267206, -1190780, -2954401, -63888, 1431835, -1094143, 939524, -281320, 355409, 2579665, + -663036, -1505923, -421981, 453656, 991064, 194347, 489626, -1464584, -717796, -1086090, + -545998, -1454920, 1074, 673236, -403727, -541703, -762894, -177167, -311385, -183073, + 484258, -358093, 881542, -276489, -256624, -136902, -341987, -311385, 7516, -149787, + 202937, 325344, 63888, 833761, -129923, 176631, -494995, 162135, -16106, 505732, + 115964, -287226, -198105, 60130, 156229, 80531, -15032, -306553, -209917, -73014, + -496606, 93416, 82141, -253940, -34897, 45097, + }, + { + -32785096, 121550792, 2334852, 1401233, -6349036, -2335925, 4742181, -1527398, 155156, 5704791, + -56908, 134755, 302795, -9639517, -3201361, -3424700, -996969, -5075578, -5093831, 4709432, + 5543729, -2769717, 2894271, 122407, 5021354, -1407676, -2942590, 1487669, -4793184, 1316408, + -4345970, -489089, 186294, -3354906, -2253784, 3193845, 2707977, 217970, -358630, -1408749, + -1919314, -699543, 2304250, -2747705, 2992519, 1226213, 490700, -328028, 1312113, -1595580, + -657667, -1141924, -2175401, -140123, -1010391, -479426, -1184337, 2109903, -1267552, -66035, + -533650, -704912, 1308354, 219580, 1062468, 523449, 341987, -639413, 640487, 231391, + -5906, 309775, 459562, -137976, -708133, 621697, 118648, 275415, -296890, 284542, + -665720, 235686, -300111, -63888, -295816, -220654, 169651, -42413, 509491, 86436, + -230318, 10737, -84289, -20401, 67109, 248571, + }, + { + 1425392, 15989090, 1384053, -1640141, 1082332, -2541547, 6292127, -7186554, -1468342, 1525250, + -1450625, 2655364, 507343, 6288906, -4672388, 1803886, -2607045, -1424855, -2801929, 1378148, + -2192044, -215285, 7162932, 6976638, 8079907, -956167, -1723356, -609885, 2412698, -5357972, + 2451890, -2556579, 1067836, -2107218, 2494839, -647466, -2232309, -1856500, 3141769, -1767379, + -1921998, 1737851, -286689, 487479, -1089311, 681826, 2256469, -2231236, -261993, 1737851, + -688805, -840203, 713501, -459562, 261993, -219043, -697395, 389768, 591095, -367757, + 1017370, 9127, 77846, 797253, -1228898, 103616, -628676, 249645, 67109, -290984, + -1174674, 779537, -697932, 50466, 348966, -384400, -426276, 31675, 510564, -11274, + 91805, 645856, 46708, 193810, -150324, 493384, -133681, 27917, 62277, 98784, + 76773, 218506, 54224, 462246, 194347, -122943, + }, + { + -23034984, -25968446, -2390686, 9948755, -3230352, 7421167, 5327370, 2046015, -2951716, 2062658, + 38118, -2769180, -4971962, -1640141, -21887154, 5111548, 4727149, 5931350, -2136746, 1969779, + 2047089, -1660542, 3395709, 479963, -279173, 2513093, 3278134, -2887829, -338766, -1320703, + -984084, -754304, -617938, 3012383, -1338956, 3626563, 2825552, 3658775, 216896, 616865, + -1699196, -2739652, 851477, 1712618, -252866, 1721745, 1200980, -987843, 532576, -374199, + -627065, 302795, -321049, 243739, 99858, -42413, 2219961, 1500554, 499290, -849330, + 686121, 83215, -76773, 672699, 204548, -393526, -362388, -128849, 278636, 187905, + 466004, -595927, 169114, 246961, 568009, 177704, -40802, -27917, -234076, 658741, + 358093, 919660, -6442, -90194, 201327, -481036, -181462, -189515, 303332, 293132, + 81604, -238908, -229781, 42413, -2684, -99321, + }, + { + 2583960, 1676111, -8455717, 5048197, 4051228, -3513820, 4596689, -1079111, -364535, 1313186, + 1673427, -2551748, -2770791, 5223754, 15599321, -7032472, -6507413, 1944547, -452045, 2098092, + 7010997, 4237522, 5266167, 1894618, 3498251, -916976, 307627, 1959579, -1707250, 1817308, + 1673964, 138513, -2098629, -74088, 2728378, 5960341, -604517, 1403917, 2173254, 1082332, + -780073, -1109712, -420370, 1641751, -1198296, -872952, -1797981, -567473, 584116, -1169305, + -13959, 493384, -123480, -80531, 947577, 1318018, 596464, 257698, 79994, -1287953, + 22012, 152471, 1064615, 566936, 11274, -1569274, -31139, -286689, 117038, 699006, + 187368, -219580, -466541, 21475, 45097, 112743, 242129, 136902, -350040, -229781, + -88584, 314069, 114354, 54761, -155156, 244813, 11274, -243739, 282931, -140123, + -491774, -119185, -17180, 239444, 26844, 382789, + }, + }, + { + { + 3406446, 38968240, 51804820, 24119462, 5182952, -656593, -692027, 4836133, -1748589, -1626719, + -2886755, -100932, -7752953, 6526740, 739808, 9727027, 4618701, -3660386, -1573032, -1803886, + -6295349, -780610, 3095061, -976568, 4595615, -4861366, -1762010, -1468879, -1309965, -130460, + 319438, 2419677, 1171452, -1798518, -932008, -3857954, 2917357, 307627, -518617, -1949915, + 1889249, 2081985, -1692754, 644782, 2280628, 1600949, 770410, 420370, 26844, -523986, + -53150, 114354, 1262184, -1518808, 266825, 1548336, -648003, 267899, -699006, 729608, + 172872, -263604, 344134, 142808, -664646, -848793, -537945, 542240, 504659, 5906, + -496069, -154082, 119722, 23622, -489626, -595390, 330176, -437550, -169651, -480499, + -84826, -609885, -229244, -89121, 121333, 250719, -52076, -126165, -94489, -223338, + 179852, 248034, -15569, 18790, 336618, -83215, + }, + { + -1750199, -36481452, 1746978, -26307, 9622874, 3110630, 1508070, -2682744, 451508, -489626, + 944893, -745177, 1247151, 1095754, -4082367, 920734, -10572062, -3315178, 294742, 4813048, + -3482682, -6197638, -1251446, -8152385, 405874, -3009698, -6751152, 1133335, -4952634, 5485210, + 1795296, -2334315, -774168, -1711008, 2581812, 2362232, -3014530, -1039919, 899796, 1060320, + 1513976, 528818, -1280974, -2195802, 1102733, 3211025, 372052, 914828, 784905, 838056, + -907312, 25233, 182536, -1289564, 873489, -1615982, 1631551, -205622, 497142, 767725, + -836982, 352724, 23622, -185757, -927713, -1100585, 682900, 762357, 306016, 146566, + 254477, -224412, 639413, 131533, 192737, 416075, 230854, -576063, -685047, -251792, + 224412, -48318, 8590, -217433, 78920, -255551, -12348, 43487, -203474, 300648, + 188979, -22549, -84826, 64425, 78383, -34897, + }, + { + 3940096, 11895449, -19366008, -4907000, 23634668, -1352915, 2108292, 4317516, -944893, -7617662, + -6273337, 13735305, 3078418, -717796, 1377611, -5188858, 112743, 2921115, -4293894, -2591476, + -5658083, 7845295, -1299765, 9401683, -332860, -1606855, 7437273, 988916, 1138166, 2704219, + 697932, -287226, 4920422, 1161252, -4379793, -1031866, 547608, -1877438, -189515, -532039, + -2623688, -448824, 1692754, -2273112, -842350, -1363652, 294205, -887448, 1160715, -58519, + 322123, -1391033, -811212, -489089, 644245, -259846, -944356, 92342, 66035, 765578, + -35970, 45097, -1235877, -842887, -952946, -681289, -149250, 324270, -903554, 872952, + 150861, -409096, -224949, 221728, 488016, -324270, -63351, -379568, 124554, -890669, + -105227, -258772, -130460, 406411, -165356, 196495, -80531, 205085, -136365, -45634, + 26844, -154619, 5906, -5906, 125091, -103079, + }, + { + 6696928, -118189984, -15247671, 39666172, -5995775, -54761, 1668595, -2787434, 486405, 3661997, + 1125281, -1079111, -353798, 1567663, 7610682, 4858682, 2009508, -5402532, -998043, -2587718, + 2472828, -1140851, -1765768, -253940, -828392, -4111358, -3172907, 2442226, -942745, 151398, + -992674, 2838974, 2871186, 3888019, 1648731, 1612223, -1843615, -2102923, 33286, -554588, + 1082332, -1651952, 1906429, 1022202, -1111323, 183610, 1920387, 913754, -2239826, -1108102, + -184147, -30602, -1965484, -374199, -960462, 782221, 1242856, -590021, 916976, -518617, + -78383, -594316, -454193, -685047, 102005, 280247, -607201, -32749, 261993, -37044, + 175557, 476741, 173946, -31139, -395674, -37044, 492311, 603443, 287763, -350040, + 357019, 341450, 272730, 117575, 301721, -181462, 23622, -33823, 6442, 60666, + -187905, 155156, -37044, 94489, -97711, -41339, + }, + { + -2039036, 5528160, 8828305, -2388002, 905701, 732829, 1125281, -2093260, 973884, -471373, + -2801393, 2653753, 4561256, -5225902, -3310346, -7174743, -15617575, -30425012, -10102837, -4033511, + 1619203, 7850664, -2675765, 7639136, -1611150, -282931, 4816269, 4490389, 2168422, -588411, + -2267743, 3013457, 3244848, 2188286, 3528853, 389768, 1269163, 4226248, -72478, -3387656, + -1569811, -810675, 1159104, 114354, -190052, -16106, -74088, -601295, 3026878, 809064, + -1866700, -1822677, 1057099, 676457, 246424, -377957, -110595, -88584, 1163936, -511638, + -1433982, -1285269, 59056, -427886, 205622, 1083406, -47782, -370441, -815507, 283468, + -610959, 532576, -81068, -132607, -115427, 66572, -32749, 304406, -88584, 56908, + 659278, 626528, -246424, 127238, -176094, 35970, 31675, 259846, 24696, -24159, + 274878, 125628, -10737, 88584, -215285, -118648, + }, + { + 10983842, -66147328, -2395518, -35261144, -1954210, -1267552, -903017, -5244155, -165356, -752693, + 8661338, 1838783, 5462662, -8405788, 970663, -558883, -2885144, 395137, 3697967, -3068754, + 8640937, 1537061, -4680441, -4551055, -1274532, -680215, -210990, -106300, -2284386, -3757560, + 930397, 1120450, 440234, 1762010, 375273, 562104, -2236604, -3106872, 806917, -277025, + -1206349, 100395, -1015223, 335007, -2626909, 930934, -776852, 69793, 444529, -1040993, + -588947, -1322850, -1024350, 755377, 744640, 1059246, -577673, -868657, -869194, -1342177, + -298500, -281857, 628676, -856309, 159451, 729071, -621697, 222801, 652835, -454730, + 556198, 877247, -762357, 821949, 887985, -515933, -417686, -99321, -110059, -289910, + -285615, 272194, 64425, 237834, 287763, -93416, 47782, 243739, -139050, -65498, + -227096, -277025, -51003, -111132, -5369, -164283, + }, + { + 393526, -2859375, -1063541, 876710, -1538672, 339839, 161061, 535260, -1737851, -1822140, + -399969, -1138703, -4046396, -5398237, -672699, -2013266, -2537789, -7529078, 6371047, -4027606, + 8855149, -5880884, 4016331, 10728828, 1146756, 860067, -2085207, 2247879, 1553704, 1595580, + -2400887, -2557116, 5041755, -1862942, -840740, -3801583, 930397, -2005213, -136902, -2689187, + 441308, 1433982, 532039, -1239635, 115427, -298500, -521302, -1219234, -746787, 634581, + -1104344, -1554241, 206158, 2089502, 431107, 200253, 1216013, -739808, -855235, 394063, + 814433, -984084, -656056, -387621, -73551, 564251, 309238, -692027, -480499, -153008, + 185757, 12885, 660351, -516470, -661425, 371515, -381715, 150861, 249108, -102542, + -413927, 632434, 202400, -215822, 30065, 176094, 388158, 32749, 156766, 54761, + -171799, -115964, -172872, 134218, -74088, 94489, + }, + { + -19211926, -12928388, 4869956, 13179107, 502511, 3748970, 1979980, -2804614, -3598109, 1236414, + 1404991, 5417028, 6812892, -2794950, 3680250, -4216048, 2706903, 791348, -988916, -2658585, + -9343164, -796716, -865973, -1743220, 1598265, 413391, 107911, 2162516, 1695438, 2530810, + -1592896, -887448, -3169686, 84826, 903554, -3310346, -24696, 124017, -129923, 1347009, + 119185, 1060320, 3248069, 965831, -1216550, 976031, 648540, 321049, 1152125, -876710, + -2076617, -56908, -2181307, -380641, 37581, 514859, -824097, 367220, -48855, 271120, + -674847, -346819, 135828, 9664, -183073, 300648, 18254, 869731, -100932, 81068, + 268435, -255014, -439697, 529892, -118112, -311922, -380641, 124554, 436476, -632434, + -13959, -314606, -213138, -479426, 380641, -600759, 57445, 359704, -17717, -185220, + -95563, -321049, -90194, 98784, -201327, 187905, + }, + { + 192200, -4382478, 6538551, -911607, 496606, 660351, 715112, 53150, 3489124, 1445793, + -2794413, -1964948, -1475321, 4034048, -1147830, 5122822, 16685948, 475668, 5508296, -5958731, + -2286533, 2789581, -153008, -2711735, 6213207, 5258114, 484258, 738198, -542240, -482110, + 539018, 3551401, -3484292, 606664, 3575024, -559420, 1641751, -1202054, 67646, -2232309, + 688805, -3170760, -1964411, 1335198, -580357, 1420024, 2697240, 828929, 824634, -110059, + 28991, -1158567, 1539209, -223875, -612033, -992674, -339302, -1042603, 493921, 1691143, + 316217, 697932, 1296543, 34360, -679142, -879931, 548682, 309775, -192200, 338229, + 872415, -616328, 558883, -500364, -596464, 324270, 112743, -66572, -34897, 78920, + 178241, 35970, -193810, -133144, 401043, 70330, 52076, -64961, 105227, 72478, + 91805, -104153, -42950, 249108, -251256, 136365, + }, + { + -15091441, -115461072, -4157528, 12757127, -5172215, -5959804, -15000173, -1353452, 3578782, -9673877, + 105764, 3761855, 7828652, -195421, 10997801, -5594732, -4866198, 3597035, -1228361, -3202972, + 1080184, 5676336, -668404, -3341485, -1341104, -601832, -670552, 667867, -610959, -1248762, + 3566434, -2312303, -368293, 4192962, 1667521, 2739116, 1937567, -1238561, 792421, -1191853, + 2709588, 194347, 252329, 1927367, -111669, -1237488, -1065689, 128312, 642098, 1755031, + -1828046, 464393, 1112933, -822486, 410706, 1740536, 922344, 1010391, 891206, -23622, + -1276142, 812286, 509491, -392990, -99858, 1097364, -158914, -130460, 331249, -657667, + 66572, 865973, 102005, 658741, 287763, -410706, -757525, 442919, -62277, -208306, + -15032, -261456, 390305, 377957, -306016, -481036, -398895, 267899, 204548, 91268, + 466004, 372588, 295279, -119722, 95026, -408559, + }, + { + -893353, -24312736, -5242545, 8710194, -2534568, -5354751, 1300838, -619012, 308164, 495532, + 1131187, -2049236, -3215857, 4843650, -7823283, 4344897, 4472672, 5608154, 1753420, 2120640, + -11692512, 3025805, 1175210, -7908109, 2819646, 1200980, -1165010, 2153926, -2571075, -3925600, + 2738042, -3359201, -3263102, -2136209, -1421097, -3012383, -1272921, -462246, -1295470, -514859, + -630823, 371515, 519154, 35970, 1090922, -421444, 234613, -183610, -348966, -1265405, + -207769, -264677, 944356, -200790, -2011655, -223875, -699006, -1238024, -1011465, -446140, + -769873, -1758252, 144418, 31675, 578210, 679142, -155693, -326954, 180926, -382252, + -285078, -145492, -339302, 316754, -153545, 503048, -571768, -88047, -141197, 227096, + 260919, 247497, -16106, 111669, -96100, -19864, 118112, -69793, 224412, 204011, + -111132, 125628, -95563, -155156, -122407, 33286, + }, + { + 4955319, 164296464, -5665599, 2938295, 273267, 9342091, 3566434, -896038, 1948841, 2456721, + -4453881, -2912525, 954557, -8555575, -1643899, 1401770, 5181878, -4707821, -2673617, 2782602, + -1931662, -4006131, 4100620, 725850, 1363115, -927176, -4659503, 2643552, -1484448, 6007049, + -3578782, -1349157, -53150, -3064996, -3219615, -2231236, 1531156, 970663, 1233193, -292058, + 93952, 1520418, 1203665, -4707821, -71404, 1290638, 390305, -1038308, 1570884, -1758789, + -1007170, 1175210, -450972, 110059, -836982, 157840, -804770, 2645700, -588411, -67109, + -936840, -1001264, -349503, -1465121, 62814, 44023, 856309, -539018, 380105, -197032, + -174483, 201327, 146029, -827855, -377957, 1336272, 252866, 120796, -662499, 49392, + -949725, -36507, 76773, 272730, -399969, -249108, -42950, 68719, 352187, -302795, + -49929, 106300, -214212, -175557, 268972, 323196, + }, + { + -1056025, 25661892, 6757058, -2187749, 5553930, 1228898, 9061844, -4456029, 732829, -569083, + -1368484, 4926328, -8971650, -20480552, -13416404, 1961726, -1729798, 3423089, -5629092, -608275, + 5779952, 4328790, 11512660, 3555159, 1939715, 393526, -2635499, -4397510, 1866163, -1073742, + 4400731, -4029216, -1700270, -5990943, 1276679, -1224603, -2602213, -1253594, 3437585, -2493229, + -2949569, 2374580, 968515, -2150705, -3946001, 224949, 2529199, 337692, 622770, 1998770, + 458488, -250719, 1673427, 583042, 1662689, 448824, -836445, -1070521, 58519, -954557, + 209380, -10737, -522375, 885300, 123480, 348429, -547071, -237834, -836982, 87510, + -532039, 1269700, -91805, -278099, -650151, -1137093, -440771, 144955, 627065, 237834, + 280784, 278099, -848256, -20401, -219580, 423054, -77846, 46708, 28454, -62814, + 24159, -27380, -84289, 368830, 26844, -2147, + }, + { + 20223390, 42061688, 4088272, 8222178, -5834713, -1497333, -4471598, -1424855, -4422206, 1872606, + -1122060, 2005213, -4230543, 9324374, -2557116, 4417374, 1393717, 3891240, 3286187, 6221797, + -1078037, -2152852, 3679176, -1461900, 3608846, 5508296, 2270427, -1446330, 2648384, 3554622, + 3282966, 4092567, 1553704, 1600949, -3804267, 1137093, -2076617, -1290638, -1722819, -796180, + -416612, -3106335, 519691, 2777233, 174483, 1413581, 742493, -2169495, 229781, -540092, + 181999, 375273, -1047435, 329102, 198105, -1223529, 492311, 530428, -77309, -1277753, + 233539, 422517, 661425, 931471, 13959, -472983, -513249, 74625, -147640, -357556, + -196495, -966368, -899796, -504122, 294205, -155156, -610959, 51540, 537, 185220, + -114890, 770947, 178778, -5369, 408559, -94489, 26307, -37044, 311385, 253403, + -52076, -161598, -238371, -88047, -31139, -31675, + }, + { + -2408940, 13359496, 2259153, -1200443, 576063, -2255395, 5751498, -482110, -2885681, -3529390, + -245887, -1456531, -3375844, -14772540, -13414257, -3621731, -2210298, 1931125, 2232846, 4102231, + 634581, 4616553, 4027069, -4592394, 196495, 310848, 1720671, -340913, -8418673, -770410, + 4319127, 2502355, 609885, 1457605, 1217086, 1605244, -1564442, 2671470, 20938, -1733019, + -2122788, -1576790, -1797981, 558883, -2289218, 797253, -755377, 623844, 2525978, -922881, + -31139, 936303, 1856500, 1872069, 842350, 607201, -338229, -221728, -462246, -434329, + 1656247, -249108, -976031, -455803, 741419, -640487, 1051193, 159988, 712428, 162672, + -616328, -321049, -361851, 198642, -70867, 122407, -127775, -86973, -420370, -11811, + 186294, 177704, 356482, -62814, -499290, 44023, 183610, -194884, 417686, 121333, + -19864, 162672, 1074, 259846, 269509, 275952, + }, + }, + { + { + -5731634, 173194016, -66737888, 23475218, 7413114, -4203163, 898722, 4907000, -7759932, 3169149, + -861678, -3298535, -2282238, 2469606, 6833830, 869731, 7153268, 1298154, -9888088, 964220, + -5922223, 4726075, -2376191, 5148592, -675384, -5061619, 2130304, -1347546, -1529545, -970126, + -1000191, 621160, 3004330, 197569, -1036698, -3965329, 3389803, 1879585, -1142461, -924492, + 45097, -853088, 1916629, -846645, 1869385, 2345589, 1576253, -396211, -1335198, 1352378, + -1502165, -242666, -1458141, 1506997, -574452, 936303, -680215, 111669, -6979, 632971, + -144955, 683974, 672699, -1159104, 13959, -1117765, 277562, 738734, -972273, 417149, + 164283, -219043, 56371, -499290, -506269, -610959, 700080, -361851, -441308, -135291, + -139050, -112743, -289373, -161061, 108985, 406411, -201327, -252329, 145492, -26844, + 160524, 273267, -210453, 49392, 257698, -130460, + }, + { + 1758789, -50797652, 5105643, 12222940, 3994320, 2979097, -1425929, 2616172, -2215666, -2966212, + 1557463, 3741454, -2524904, 1134408, -4138201, -6380711, -1343251, -4379256, -4866198, 4955319, + -26307, -3364033, -2016487, -6521371, 2118493, -8704825, -6908455, 1510218, -3876208, 6266358, + -1402844, 859530, -1918240, 88047, 1225676, 3637837, -1059783, -20401, -1866163, -228170, + 27380, 3388729, -1802276, -663036, 139050, 3201898, 1379758, -372052, 2622078, -282394, + -1821066, 410706, -438624, -213675, -682363, -850404, 904628, -183610, 37581, 522375, + -166430, 471373, 724239, -658204, -620623, -61203, 718870, 104153, -253403, 693637, + -513785, 156766, 282394, 225486, 403727, 13422, -323733, 498216, -1081258, 41876, + 68719, -17717, -114890, 317828, 8053, -165893, 3221, -54224, -205085, 279710, + 226023, -220117, 99321, 72478, 205085, -199179, + }, + { + -1764158, -32673964, 22291954, 21601002, -2776160, -133144, 3629784, 1468342, 120796, 469762, + -7156490, 8207146, 3329137, 459025, -6583648, 193810, -273267, 7078643, -10987600, -333934, + -2956011, 4308926, 2921115, 2217277, -4592394, 13677323, 234076, 3316252, -4862977, 6021544, + 275952, -1292785, 5879274, -3064996, -3622268, 1673964, -113280, -2659659, -278099, -1401233, + -739808, 319975, -1829119, 84826, 304943, -1527935, -843424, -633508, 1233193, -1330903, + 62814, 438087, -954557, 454730, -593779, -545461, -245887, 934155, 107374, -508417, + 304943, 136902, -1270774, -845035, -802622, -970663, 367757, -957778, 137439, 745177, + -48318, 270583, -302795, -214748, 773631, -137439, -96100, -284005, -396211, -734976, + 295816, -265751, -234613, 354335, 215285, 59593, 89657, -36507, 44560, 225486, + -276489, 23085, 61203, -187368, 44023, 9664, + }, + { + -25255482, -121609312, 21619792, 26099442, 3593814, 2276333, -1959579, 564251, -754841, 1961190, + -897648, 4000225, 1233729, -7826504, 11485816, 6084358, 1023813, -1651415, -5793911, 79994, + -697395, 1490354, -2669322, 2624225, -50466, -4189204, -2138357, 1592896, -1157494, 2013803, + -873489, 3593277, 5086852, 172336, 2159295, 1368484, -2450279, -2512019, 61740, -313533, + 173409, -176094, 1867237, 724776, -1449015, 322123, 382252, 2147484, -1853278, -554051, + -1210644, -796180, -1148367, -397284, -476741, 1573569, 1260573, -1817845, 1534377, -903554, + 198642, -144955, -1226750, 408022, -528281, -28991, -133681, 373125, -64425, 332860, + 211527, 175020, 366683, -85362, -635118, 405874, 244813, 235149, 700080, -153545, + 601832, 244813, 169114, 70867, 105227, -59593, -130997, 89121, -122407, 186831, + -97711, 293132, -126165, -105227, 88047, 6979, + }, + { + 1569811, 26112328, -13079249, 87510, 524523, 354872, 2379949, -3201898, -900869, -959388, + -2221572, 1968169, 8937290, 186294, -23082228, 2452426, -16400333, -9677635, -26918708, -365609, + 4919348, 1658394, 954020, 6082748, -3404835, 2736431, 4684199, 5936719, 2702071, -5120138, + 3051574, 4212289, 4042638, 122943, 4132296, 23085, 1207960, 3396782, -604517, -2218888, + -605590, 57445, 803696, 632434, -1432909, 462783, 1452773, 576599, 925565, 1311039, + -2906619, -1286880, 1436130, 608275, 52613, -299037, -334471, 335544, 1271847, -528818, + -2859375, 228170, -1128503, -190589, 856846, 786516, -34897, -55298, -538482, -391379, + -188979, 93416, -5369, 427886, -799401, -89657, 342524, 213138, 48318, 475668, + 250719, 855772, -332323, -78383, -126702, 268435, -231391, 301721, 149250, 125091, + 306553, -96100, 296890, -99321, -165893, 173409, + }, + { + -34601332, -39729520, 15455440, -23793046, -3147674, -2797634, 1563368, -6058588, 1581085, 3035468, + 3628711, 2893197, 1059783, -7662222, 1596117, -2032593, -4911832, 6915971, 1823751, -1541356, + 7877507, 185757, -844498, -7119982, 216896, -832687, -1282585, -1052267, -2046015, -2949569, + -260919, -1631551, -36507, 4326643, 1075352, 254477, -1316944, -5688684, -1449015, 1735167, + 1151051, -1093069, -1032940, 1588601, -4635881, -34360, 1802813, -204011, -674310, 1709934, + -1183800, -2141578, 191126, 867583, -627065, 1604170, -146566, -303332, -1753420, -1874216, + -289373, -67109, -66035, 6442, 508954, 931471, -573378, -323733, 525597, -127238, + 574989, 93952, 536871, 312459, 992674, -350577, -279710, -321049, -280247, -842887, + 289910, 13959, 121870, 146566, 256624, 161061, 46708, 267362, -85899, -427886, + 90194, -419833, -285078, -83215, 168041, -159451, + }, + { + -659278, -5666673, 3428458, 216896, -588947, 336618, 128312, -1149441, -448824, -655519, + -891743, -2214593, -7548942, 1819456, -3032247, -5430986, -5417565, -2115272, 678605, 11006927, + -406948, 1991791, -3009698, 16986596, -5243618, 2277407, 2191507, -5616207, 4638565, -295279, + 629750, -1234266, -3071439, 3812857, -4649302, -947040, -667331, -2187212, 288300, -1851131, + -1504312, 1730335, -503048, 382252, -373125, -560493, -1351841, -336081, -904628, -335544, + -2359011, 136902, 459025, 1221918, 242129, 588947, 1734630, -583042, 600222, -424128, + 711891, -744640, -565862, -82141, -330176, 675921, 616865, -691490, -783295, -530428, + 554588, 339302, 37581, -90731, -216359, 324270, -184684, 68183, 35433, 15032, + 275952, 3758, -162135, 39192, -61203, 417686, 139586, 289373, -25233, -111132, + 2684, -68183, -408022, 87510, 46708, -106837, + }, + { + 34171832, -46002856, -20896626, 10390600, -658204, 2024003, -2156074, -515933, -5099200, 4606353, + 6158446, -173946, 6816650, 13089450, -14545444, 3055332, -3565360, 3295314, -1516660, -3311420, + -4741107, -3583077, -443455, -578747, 867047, -2467459, 1936493, 635118, 5294084, -2402497, + -1286880, 2065879, -220654, -1598802, -28991, -244813, -3757023, 2332704, -1762010, 1116155, + -1209033, 3374234, 1370632, 1245004, -1996623, 1940788, 1144609, -1906429, 2961917, 1305670, + -2419140, -51003, -2232309, -594853, -615791, 1234803, -8053, -1057099, 446140, 557272, + -1227824, 211527, 361314, -125628, -469762, 326954, 724239, -41876, 426812, 263604, + 251256, -476741, 205622, 137976, 59593, -523449, 69256, 51003, 60666, 36507, + -55835, -61740, -242666, -770410, -22012, -39728, -333397, 427886, 17180, -219043, + -90194, -445066, -24696, 166430, -91805, 26307, + }, + { + -740345, 3739306, 1888175, -780073, -677531, -133681, 1685775, 1003412, 2843805, -1021129, + -3207267, -3532611, 4220342, 10417980, -14072997, 7174743, 1753420, 13414793, 4046933, -5883569, + 2955474, -3625489, 4346507, 314606, -3129958, 6097243, 5536750, 5658620, -1964948, -4303021, + 8006356, -9041443, 4138738, 920734, -1656784, 1806571, 2683818, -2244121, -1563368, 166967, + -630286, -3655017, -1254667, 1648194, -325881, 1702955, 1703491, 131533, 2352032, -176631, + -157840, -1280437, 1163399, 554051, -256624, -2072859, 322659, 331249, -168577, 477278, + 330176, 823023, 999654, -192737, -865973, -406948, -33286, 135828, 406948, 632971, + 186831, -434329, 478352, -5369, 181462, -233539, 441845, -456877, 353261, -202937, + 603980, -248034, -361314, -31675, 485868, -13959, -112206, 269509, 103616, 18254, + 11811, 86436, -33286, 84289, 537, -67646, + }, + { + 15060840, -88888104, -62315144, 5779952, 20624970, 1444183, -28020366, -4794257, 19327, -3133179, + -2437394, 1992328, 8738648, 4880694, 6060199, -3456912, -3545496, -1367410, 1930051, -1361505, + -198642, 3004867, 309238, 118648, -671089, -6436009, 2069637, -1865626, 3767760, -6048925, + 4641786, 1792612, -2629057, 5151277, -173946, 704912, 125091, 1270237, 1529545, 2841121, + -3311957, 2520072, 1180579, 136365, 25770, -464393, -595390, 2251637, -1870458, 758599, + -828929, 1527935, 781684, -236760, 655519, 1129040, 1045825, 536871, 1054415, -731755, + 445066, -623844, 1364189, -741956, 668941, -374736, 354872, 13422, -357019, -191663, + 19864, 887448, 260919, 565862, 186294, -722628, -150861, -1074, -154619, 57982, + -516470, 308701, 252329, 421444, -477278, -214212, -206695, 408559, -117575, 659814, + -40265, 540092, 186294, -177167, -69793, 8053, + }, + { + 1016297, -7062000, -16575353, -1481764, 2877091, -3246995, -236223, -3861176, 1836635, -408559, + 2110440, -4559108, 2281702, -723702, -2714419, 1089311, 1107565, 9306657, 4792110, -3142306, + -9241159, 2022393, 6382859, -3385508, -342524, 5741835, -7420093, 5553393, -6274411, -892816, + 332323, -951872, -1744831, -2937758, -3375844, -1672890, -1228361, 45097, -1118302, -3132105, + 243739, 193810, 1551020, 169114, 359167, -657667, 1085553, -224412, -338229, -853088, + -1440962, 875636, 370978, 19327, -2185602, 592169, -1527398, -845035, -518617, -1168231, + 418759, -1716376, -361851, 679679, 118648, 236223, -195958, 125091, 76773, -865973, + 143881, -489089, -9127, 53150, 225486, -17717, -269509, -355409, 199179, -307090, + 432181, 94489, 186831, 12885, -89121, 52076, -23085, 15569, 356482, -21475, + 146029, -55835, -68719, -10737, -56371, 19864, + }, + { + 20788716, 150155280, -8466991, 635655, 888521, 5658083, -2111513, 5981279, -1583232, -1266479, + -1818919, -2646774, -152471, -5979668, -4303021, 5484673, 4763119, -138513, 1364189, -1607928, + -1722282, -2732673, 288300, 6250251, -5869610, 2545842, -2134599, -1813550, 2356863, 4224637, + -1063004, -2017561, -2302639, -1486596, -2880313, -4377646, 2838437, 311385, 1555315, -1509681, + 2414309, -1286343, -1018981, 816581, -1589138, 1409823, -431107, 123480, 1305133, 23622, + -1701881, -118112, 1417339, -938987, -1098438, 1088774, 298500, 947577, -173409, -960999, + -1141388, 416075, -1442035, -1154273, -48318, -134218, 518617, 73014, -513249, 251792, + -244813, 26307, 549219, -1138703, -12885, 753767, 985158, -528818, -249108, -119185, + -649614, -78920, 121870, 185220, -271657, -90194, -418222, 414464, -28454, -234076, + 61740, 55835, 59593, -176094, 144418, 253403, + }, + { + 685584, 28858422, 4849018, -32749, -734976, 4680978, 3457986, 1983201, -1542430, -1937030, + 4405563, -1702955, 4471598, -46134928, -3054259, 2786360, 1182727, -892279, -2383707, -1996086, + -664646, 11853036, 16156593, 2292439, -6379637, 6045704, -5812165, -406411, -3608310, 9409200, + -1777043, -501437, -3612068, -4176319, 1646583, -4039417, -27917, -1738388, 666257, -1232656, + -1515587, 1676648, 850404, -3821984, -1503239, 134218, 2509872, 1249836, -1393717, -270046, + 2927557, 1394254, 1209570, 958315, 1993939, -624918, -321586, -1652489, -33823, -830539, + -715112, 947577, -129386, -525060, 1140314, -576063, 303869, -1599875, 559420, -516470, + 117575, 308164, 242666, -176094, -933619, -359704, -402653, 25770, 805843, 102542, + 382789, -121333, -768262, -347892, -139050, 166430, 116501, 22012, -3758, -138513, + -192737, -59593, 217433, 135828, 16106, 331249, + }, + { + -7481296, 76884744, 10439992, -2356863, -5539971, 6956774, -11840688, -3287798, -1374390, 3808562, + 734976, 621697, -2776160, -12652437, 31122406, 5059472, -5135707, 1957431, 3642132, 7524783, + -1524177, 2148558, -2197413, 2838437, 4391067, 5021891, -1170379, 3438121, 75699, 5613523, + 2658585, 1858110, 2943126, -1400159, -1210644, 794032, -2284923, -3066607, -884226, -1263257, + 2103460, -2247879, -2257542, 1513439, 2506114, 20938, -1087164, -2003602, 420907, 1243930, + -913754, 1750736, -485868, 1121523, -1001264, -1516660, 139050, -53150, 10737, -144955, + -844498, 1029718, 282394, 74088, 309238, -235149, -574989, 340376, -281320, -554051, + -484794, -814970, -443455, -574989, -176631, -231391, -429497, 105764, 227633, -237834, + 127238, 180389, 43487, 238371, 256624, 54224, 41339, 38655, 224412, 104690, + 92342, -70867, -300648, -164283, 28454, -49392, + }, + { + 2362232, 13932337, -3485903, -3018288, -795106, 986769, 3811784, 1068373, -2475512, -5032628, + -3204046, 413927, -1458678, 2729452, -40387188, -1683627, -660888, 4127464, -1613297, 7686381, + -3092377, 8005819, -4894652, 32749, 402116, -1500554, 3842385, -3310346, -6073621, -140123, + 1135482, 1714766, 4099546, 1799591, -1642825, 486405, 541166, 1170916, -1214939, -1342177, + -944893, -988916, -653372, -2534031, -679142, 41876, -554051, 1248225, 1285269, -612033, + -95026, 1973538, 2061047, 2533494, 207769, -221191, -31675, -926102, -606127, 800475, + 1375463, 77309, -1264331, -802622, 270046, 350577, 1005559, -26844, 1007707, -1023813, + -57982, 316754, -266288, -246424, 325881, -155156, -390842, -229244, -62277, 84826, + 343061, -112743, 257161, -193810, -122943, -291521, 143345, 173946, 282931, 44560, + 259309, -155693, 226023, 181462, 227096, -62277, + }, + }, + { + { + 5740761, 224000800, -45141716, 6156836, -9006546, -3108483, -406411, -950798, -7930120, 7232725, + -1203665, 1331440, 782221, -1609002, 9502078, 1482301, 4178466, 7600482, -7004555, -2921115, + -2052994, 8249559, -4151086, 2443837, 934692, -1596654, 5219459, -954020, 331786, 349503, + 1585917, 2350958, -390305, -2038499, 1299765, -1590749, 4615479, 892279, -3540664, 188442, + 217970, -1424319, 418759, -122943, 498216, -404264, 1166621, 53687, -2022393, 847719, + -2418604, -550830, -360777, 2880849, -289910, -472446, -256087, 1437740, 815507, 747861, + -67109, 885300, 544387, -932545, 1243393, 254477, 317291, 309775, -1085553, 399432, + 446140, -200790, 170188, -87510, -236760, 36507, 1289564, 193274, 41876, -117038, + -58519, 399432, 437550, -1611, -107911, 495532, -159451, 11274, 577136, 245887, + -48855, -17717, -301185, -226023, 70330, -67109, + }, + { + -226560, -29983704, 17002702, 6843494, -2934537, -540092, -2326262, 3915937, -1472637, -946503, + 2327872, 2005750, -6077916, 329639, -2496450, -4908611, 2156074, -1787780, -4284230, 5173288, + 3189013, 5955509, 11121281, -587337, 3953518, -9265318, -8363375, 3507378, -2872260, 1129576, + 1017907, 6367826, -1851131, -1039382, 105764, 3047816, -478889, -1423782, -3076807, -1392643, + -2142115, 4890357, 477278, -268972, -979789, -210453, -690953, -1774358, 923955, -1166621, + -1854352, 379568, -533113, -357556, -1549946, -340913, 299574, -201863, 66572, -173409, + -431644, 235686, 814970, 103079, 203474, 550293, 756451, 157303, -599148, -34360, + -1245541, -493384, -122943, -348429, -233539, -246424, -277562, 769873, -89657, 460635, + -156229, -119185, 53150, 256624, 25770, -48855, -191126, 155156, 53687, 133144, + 194347, -350040, -37581, 26307, 142271, -140660, + }, + { + -466541, -99884296, -28919088, 20478940, -3298535, 2298881, 1554778, -1778117, 1610076, -732292, + -9458592, 7583302, 1367947, -1431835, -5924371, 1968706, -2558190, 5136244, -9268003, 5131412, + 375810, 3036005, 899259, -3236258, -5553393, 13244605, -6419903, -1614371, -5704254, 6161668, + 1751810, 2248416, 4804458, -4114042, 1233729, 3926137, -39192, -1403917, 2001992, 3755412, + -23622, 848256, -408559, 590021, 281857, -2039573, 5906, -324807, 44560, -2170032, + 821413, 599148, -1743757, -387084, -794569, -586800, -990527, 310848, 255014, -812823, + -79994, 926639, -423054, -1073742, -475668, -1076963, 433792, -1089311, -202400, 140660, + -297963, 189515, -96100, -24159, 645319, -146029, 194884, 175557, -374736, -300111, + 804233, 149250, -278636, 100932, 148176, -92342, 180389, 177167, 85899, 187905, + -34897, 340913, 230854, -232465, 62814, 55835, + }, + { + 38179040, -66944044, -3221762, 19674172, -1335735, 1703491, -2964064, 1283122, -1652489, -1187559, + -4427038, -393526, 2789581, -4546760, 8196945, 2132451, -1156420, -2640868, -2210835, 1242319, + -1747515, 3082176, -767725, 3251290, 3040837, 1189169, -703301, 1072668, 558346, 802622, + 37581, 2152852, 1552094, -2432025, -2771328, -1179505, -1395328, -2828236, -1150514, -1124208, + 526134, 682900, 326418, -1495722, -1660542, -467615, -624381, 1824824, -293668, 1407676, + -741956, -444529, 346282, 199716, -572841, 924492, -365609, -1817845, 1184337, -1331977, + -42950, 690416, -93416, 1125818, -479963, -147640, -176631, -226023, 99858, 666257, + -6442, 35433, 639413, 204011, -612033, 181462, 41339, 48318, 596464, -123480, + 68183, -53687, 9664, -110059, -149250, 33823, -35970, 136902, -12885, 107374, + 41339, 289373, -31139, -31139, 78920, 159451, + }, + { + -925565, 38784092, -1083942, 1078574, 305480, -45634, 1400159, -2044941, -261993, -185757, + 1974074, 2687576, 5650567, -5155035, -19506668, 20885352, 3217468, 21991306, -938987, 7310571, + 4761508, 2908230, 1481227, 5789079, -639413, 1674500, -1593970, -3034931, -858993, -6620155, + 4555350, 1601486, 3932043, 16643, 1224066, -528818, -1911797, -2207613, 1310502, 491774, + -326418, 602369, 974958, 592169, -1268089, -1064615, 1688996, 666257, -382789, 966905, + -2200634, -492848, 897111, -479963, -799938, -444529, -1651952, -752156, 520765, -421981, + -1915555, 391916, -1458678, -108448, 180389, -610959, -134218, 775242, -182536, -549219, + -281320, -14496, 299574, 524523, -959925, -460635, 130460, 490700, -85899, -146029, + -391916, 490163, -179852, -22549, -290447, 421444, -106300, 71404, 179852, 103079, + 111132, -235686, 197569, -44023, 26307, 286152, + }, + { + 49469972, 27491548, -14863808, -10915659, 1762547, -92342, 2036351, -7274601, 1412507, -2312303, + -4507568, -1108102, -1308354, -2004676, 3601330, -938987, -2513093, 6685117, 1151588, -638876, + 3938485, -2166811, 861141, -2129230, 4141422, 1080721, 1851668, -1142998, -3655017, -3673808, + -1560147, 1321239, 3138547, 969589, -67646, 1171989, 492848, -3787088, -2052994, 1281511, + 1301912, -1520418, -1010391, 1250372, -2595234, 1398549, 3003256, 849867, -70867, 1971390, + -1885491, -1293322, 723165, 745177, -1266479, 395674, -113817, 566399, 278099, 301721, + -37044, -495532, -237297, -74625, -44560, 564251, -343597, -600222, 263604, -515396, + -159451, -277025, 651224, -90731, 309775, -487479, 52613, 481573, 72478, -932545, + 325344, -214748, 129923, 200253, 157303, 56908, -74625, 246961, -177704, -62814, + 446140, -187905, -56371, 81068, 306553, -2684, + }, + { + -37044, -7300908, -583579, -813896, -854162, 56371, 80531, -1908576, -457414, 559956, + -1781338, -3666828, -3459059, 6711960, -1334661, -151934, -834297, 3046206, -980863, 8741332, + -636729, -1501091, -4069482, 18478560, -5972689, 2352032, 2881386, -6488622, 6305012, 1273995, + 1525250, 665183, -6150393, 4597226, -2503966, -3168612, -1132798, 30065, 3510599, 494458, + -939524, 1016297, -1630477, 182536, 69256, -710817, -1523103, 220117, 2147, 581431, + -2013266, 750546, -281320, -303332, 94489, 501437, 731755, -1118302, 2348273, 516470, + 1810329, 935229, 460098, 219043, 180389, 735513, 490163, -586263, -1034550, -260382, + 809601, 187368, -11274, 831076, 726923, 227633, -129386, -31675, -387084, -18790, + 375810, -22549, -106300, 234613, 53150, 138513, -289373, 159988, -130460, -190589, + 35970, 90731, -264677, -191126, -91805, -27380, + }, + { + -40378600, -90514288, 20464982, 9139154, 642098, -331786, -4663798, 2465311, -2725157, 1118302, + 3147674, -5601174, 4070019, 10812043, -22694608, -450972, -5120675, 2187212, 1391569, 3528316, + 362925, -4928475, -2405719, 1662152, 1686312, -2125472, 577136, -984621, 4817880, -3157338, + -90731, 4831302, 2695629, -2422362, -1942399, -808528, -1695438, 3198140, -5098663, -1272384, + -1280974, 2630131, 64961, -566936, -955093, 1352378, -23085, -1153199, 4124242, 2384244, + -1086090, -1057099, -1020592, 974958, -147640, 2479807, 388695, -394600, 170188, -144418, + -794569, 81068, -87510, -315680, -147103, 524523, 377957, -232465, 475131, 49929, + -136365, -217433, 454193, 197569, 187368, -390842, 199716, -81604, 183073, 535260, + 264677, 205622, 202937, -193810, -149250, 49392, -206158, 192737, 27380, -10201, + 70867, -355409, 39192, 205622, -78920, -265214, + }, + { + -288837, 2590402, -4934381, -1149441, -634045, -398895, 7516, -3046206, -942745, -254477, + -2471754, -2385318, 2352032, 4191351, -17324824, 6519761, -11471858, 6225555, 4439386, -8470749, + 2355790, -4530654, 5054103, 936840, -6328635, 6489159, 1493575, -35970, 983011, -3459059, + 4915053, -8608188, 4758287, -138513, -2922188, -697932, 3117073, -61203, -102542, -28991, + -2064269, -2373506, -6979, 991601, 82678, 1133335, -12348, -2253247, 1739999, 1192390, + -506806, -419296, 1229434, -683974, -241055, -262530, 366146, 923955, 320512, -1496259, + -1675037, 370441, 825171, -429497, -53687, 548682, 264141, 503585, 669478, 497679, + 143881, -524523, 234613, 183610, 376883, -375810, 136365, -620623, 453656, 24159, + 350040, -192200, 230318, 83752, 108448, -248571, -141197, -71941, -226560, 24696, + -22012, 9127, 92879, 129923, 161061, 53150, + }, + { + -15652471, -33052458, 16859358, -918049, 7642358, 4522064, -7353521, 2106145, -1183264, -4274566, + 112206, 154619, -1369558, -2267743, -2776160, -6001143, -154082, -5697274, 3783329, 2795487, + -4713190, -3904662, 35433, 876710, 3066607, -1032403, 4752918, -2729989, 2467459, -5049271, + 2921652, 1518808, -1301375, 2624762, -2810519, -3922379, -3478924, -1198833, 1837172, 5023501, + -4021163, 3090229, 551903, -249108, -1316408, -2910377, -1559073, 2261300, -1952600, -987843, + -1800128, -343597, -79994, 541166, 956167, -472983, 6442, 856309, 346282, -1051193, + 1350767, -1480690, 1506997, -337692, -700080, -192200, 1257352, -280784, -19864, 27380, + -243203, 937914, -91805, -376347, 30065, -7516, 548145, 51003, -188442, 27917, + -386547, 248034, 231928, 222801, -142271, -54761, -207769, 265751, -147640, 621160, + -133681, 202937, -153545, -124554, 205085, 227096, + }, + { + -869194, 10977936, 2646774, 79457, 3045669, -631360, 1405528, -1050120, 1630477, -1707786, + 2296734, -2359548, 3651796, -2985539, -3723737, -687195, -4658966, 3257196, 3323768, 3383361, + 2805688, 4104378, 8742943, 2738579, 2168422, 4823785, -5288716, 9553618, -1956358, 1750199, + -1114544, 3427921, 1848447, -427886, 805306, 1008780, 1802813, 805843, 867047, 128849, + 558346, -1328219, -23622, -884763, 181462, -725313, 1452236, -163209, 587874, 148713, + -887985, 413927, -734976, 1068373, 333397, 1290638, -1327145, 523986, 931471, 137439, + 1661079, -959925, 153545, 737661, -120259, -316754, -113817, 55835, -141197, -587874, + 24159, -744640, -52076, -257161, -73551, -247497, 57982, -248034, 412317, -178778, + 198642, -253940, -28454, 74088, 212064, 209917, 39192, -91268, 160524, -84289, + 53150, -60666, -20401, 59593, 34360, -25770, + }, + { + -33187212, 85803248, -1764158, -4618701, 1343251, 4103305, -4148402, 4315906, 2531346, 3816079, + -386547, 2513630, 6418292, 7199439, -537, 2667175, 4675072, 1170916, 3115462, -2221035, + 5821828, 577673, -1850057, 7851200, -1742683, 850940, -2762738, -2486786, 5906, 1711545, + 172872, -619549, -5369, 2241436, 751619, -2072322, 3014530, -919123, 1074, -2338073, + 1606855, -1457605, 1108102, 4163971, -955630, 898722, -1126892, 103079, 1136019, 338229, + -1126892, -1199907, 404264, -1075889, 193274, 750009, -145492, 401579, -755914, -1316408, + -738734, 1041530, -884763, -72478, 236760, -293132, 228170, 198642, -89657, 92342, + -718333, -211527, 487479, -450435, 129923, -345208, 367220, -621697, 145492, 436476, + 120796, 112743, -266288, 72478, -47245, -112743, -358630, 287763, 91805, 52076, + -136902, -115964, 86973, -100932, -38118, 55835, + }, + { + -125628, 18733036, -535260, 724776, -1314797, 2528662, -3256659, 405874, -785979, -1382443, + 3365107, -1342714, 12600360, -33557116, 3435437, 3084324, 2615098, -353798, -3149285, -9936944, + -3107409, 16138876, 679142, -4328254, -352724, 6805913, -4082903, 3321620, -1891396, 9436580, + -994285, 2272575, 88047, 1059246, 2301566, -4195646, 1611150, -3062849, -1763084, -884763, + -1094680, 923955, 1969779, -1747515, 172336, -546535, 1762010, 1212255, -2489471, -2303713, + 1656784, -43487, -439160, -128849, 1208496, -284542, 857383, -65498, 350577, -387084, + -375810, 936840, -492311, -1183800, 432181, -1126892, 490163, -880468, 1641214, 98784, + -15569, -488553, -41876, 142808, -297427, 57445, -81604, 151934, 468688, -272194, + 171262, -104153, -165893, 1074, -83215, -134755, -263067, -579284, -368293, -67109, + -146566, 44560, 171262, -141197, -17180, 289910, + }, + { + -7602629, 69839928, 642635, -2857227, -864362, 10041634, -6270653, 5708549, 5075578, 412854, + 1668595, 3631395, -1825898, 340376, 45916420, 47782, -9555765, -2456721, -3186866, 2698313, + -2172717, 1181653, -1522566, 3026341, 824097, 2902861, -3760781, 4099546, -333397, 1609002, + 907312, 1499481, 2860448, -553514, 860067, 703838, -1704565, -398895, 2605435, 136365, + 1540283, -333397, -2396055, -1280974, 2231236, 459025, -249645, -865436, -51003, 2316598, + -1473174, 1887101, 1646046, 3644817, 108985, -839129, 698469, 101469, 189515, 680752, + -579284, 194884, -761820, -311922, 803159, 161598, -103079, 506269, 58519, -434329, + 605590, -403190, -352187, -441845, -175557, 301185, 322123, 366146, 228707, -105764, + -68719, -274341, -210990, 122407, 57445, -234076, 134755, -85899, -129923, -253403, + -179315, -74625, -157840, -210990, -4832, 201863, + }, + { + -1702418, 7620883, -2809446, -2696166, -619012, 991064, 1111323, 293132, 2483028, -2131378, + -738198, 1870995, 539018, 23002234, -15164993, -4782446, -6713571, 3544422, -258772, 5595806, + -8212515, 362388, -5704791, 3219615, 4766877, -2265595, -3389803, -2990908, -324807, 3199751, + 2580739, 1034013, -1001801, -708133, -2692945, 14496, -762894, -1935420, -1069984, 625455, + -1074, 254477, 1498407, -2126546, 216359, 1337882, 303332, -92879, 257161, -234613, + 38655, 936840, 400506, 915902, -1022202, -551903, -493921, -724239, 212064, 81068, + -440771, 622770, 376883, -823560, -354335, -263067, 464393, 376883, 857383, -630823, + 795106, 296890, -264677, 129386, 896038, -42950, -99858, -18254, -178241, -40802, + 132607, -484794, -19864, 62814, 255014, -169114, -103079, -37581, -70867, -67646, + 155693, -344134, 221728, -122407, -249645, -200790, + }, + }, + { + { + -7170448, 169747312, 36805184, -10990284, -2754148, -300648, -2362769, -1342177, -2161442, 5435818, + -671089, -770947, 2246268, 922881, -2027225, 12424804, -3206730, 4526896, 3492882, -7642895, + 4697621, 1411971, 2678449, -7466264, 4023311, 1996086, 2547989, -1336809, -108985, 525597, + 4196183, 10737, -3794067, -1664837, 2822331, 679142, 1952600, -377420, -1328219, -694711, + 2007897, 1390496, -3707631, 1811939, -744640, 177704, 514322, 785442, -1698660, -845572, + -814970, -874563, 422517, 826244, 1209570, -1003949, -111669, 1570347, 1850594, -489626, + 565325, 874026, 17717, 148176, 595390, 261456, 227096, -49392, -128849, -317291, + 466541, 51003, -165893, 84826, -358093, 863825, 776315, 645856, -214212, -128312, + -114890, 62814, 695248, -12348, 32212, 101469, -7516, 249645, 259846, 281857, + 22012, -356482, -6979, -195958, -63888, 14496, + }, + { + -479426, 26133802, -21820044, 1069984, -2525441, -1173063, -1103270, 2020782, -272730, 661962, + 3648575, 2147, -2359548, 563178, -6131603, -5369, -404264, -6899328, 10180146, -1830730, + 4326643, 10772315, 4228396, -1459752, 1553704, -1785096, -5107253, 1876901, -3604551, -3688840, + 3097745, 6679211, -1335198, -1369021, -2222646, 422517, 841277, -681826, -2511482, -35433, + -1761474, 3019899, 943282, 1302449, -1927367, -2877628, 146029, 510027, -741419, -1305133, + -781684, -103079, -135828, -927713, -1365263, 500364, -863825, 862752, 711354, -690953, + -1154273, 664646, 121333, 713501, -263604, 584116, 292058, 637803, -411780, -362925, + -980326, -721555, -127775, -77846, -751619, -8053, 392990, -82141, 548145, 88584, + -103079, -37581, 226560, -252866, 184147, -30065, -559956, 188442, 229781, 52076, + 249645, -140660, -312459, 147103, -122407, 110595, + }, + { + 1555315, -145632672, 4447976, 9782325, 4372277, 2695629, -1096290, 376883, 388158, 391379, + -4379256, -790274, 4575751, -2224793, 4992363, -5060009, -3026878, -81604, -4099546, 1797981, + 7191386, -3513820, -2774012, -2258079, -1784022, 4697621, -5454609, -2872260, -370978, 3516505, + 1487669, 6545530, -194347, -2652679, 5395553, 2317135, 902480, -106837, 375273, 3925600, + 256624, -724776, 909459, 1308354, -1351304, -1457068, -319975, 221191, -676457, -556735, + 617938, -598611, -595390, -732292, -629213, 21475, -1553168, -1040993, 828929, -104690, + -544387, 418759, 253940, -998043, -452045, -740882, 306016, -1040993, 38655, -72478, + -305480, -180389, 32749, 495532, 403190, -27380, -350577, 503048, -529892, -227633, + 537408, 336081, -177167, -70867, 295816, -146566, -122407, 155156, 27917, 202400, + 158377, 403727, 188979, -41876, -35433, -63888, + }, + { + -40146132, 27867358, 3850438, 18485540, 689342, -1865626, 631897, 2553358, -527207, -3870303, + -3291556, -2800856, 2261300, -2763275, 8297877, 1622424, -568009, 205622, -2375117, -537945, + -677531, -69256, 934692, 1292785, 3393561, 762357, -300648, -301721, 657130, -2233383, + 2263448, 1449015, 1101122, -1229434, -2217277, -2882997, -1286343, -2306934, -1359894, -849330, + 366683, 512712, 64961, -2181307, -1702955, -290984, 197569, 996432, 118648, 522912, + 323196, 926102, -1159641, 128312, 187368, -444529, -20938, -753767, -797790, 806917, + -1058710, -149250, 634045, 1130113, -491237, -276489, -149787, -271657, 561567, 270046, + 63351, -2684, 436476, 258772, -557809, 73551, -259309, 346819, 41339, 199716, + -223875, -240518, 38118, 135828, -237297, 77846, 102005, 44023, 62277, 46171, + 118648, 97711, -46708, 88584, -60666, 214748, + }, + { + 432181, 37153076, 1115618, 958315, -1151588, 1379758, -80531, -684510, -919660, 1021129, + -967441, 5508833, 1089848, 2939368, -11403675, 5345087, 894964, 8935143, 28469190, 5132486, + 10732050, -3081639, -229781, 7269232, 3127810, -2415382, -922344, -6809671, -1596654, -2975339, + 1402844, 1668058, -223875, 4855461, -461172, -2241436, 1010928, -3270618, 19864, -208843, + 349503, -25770, 952946, -682900, 655519, -978179, 863825, 180926, 85899, -574989, + -82678, 982474, -836445, -690416, -1031866, 723702, -2272038, -1280974, -321049, 333397, + -1145146, -353798, -599685, -539018, -206158, -739271, -53687, 328565, 206158, -451508, + -127775, 169651, 166967, 223875, -224412, -825707, 0, 416075, -300111, -401579, + -32749, 19864, -32749, 28991, -46708, 154619, -57445, 49392, -20938, 236223, + -78383, -204011, 214212, 148713, -68183, 56371, + }, + { + -49280456, 137562976, 2404108, -250719, -5317170, 1708323, -3187940, -1347546, 230854, -850404, + -4097936, -3078418, -4588636, 987306, 1862405, -1489817, 1624035, 1864016, 1605244, -904091, + -1006096, 2444910, 591632, 1299765, 1486596, 1665374, 615791, 1567126, -3951370, -4522064, + -1883880, 4173098, 3606699, -1968706, 2049236, -797790, 1521492, -3615826, -1008244, 922344, + -251792, 1756642, -237297, -1522029, 518617, 331249, 2005213, 20401, 545461, 739271, + 477815, -1111323, -343597, 1091459, -762357, -569620, -605054, 372052, 725850, 788127, + 75699, -682900, -519691, 172336, 17717, -299574, 115427, -285078, -90731, -267899, + -582505, 371515, -135828, 174483, 236223, -503048, 135291, 274341, 329102, -310848, + 51003, -252866, 150861, 104690, 228170, -54224, 197569, -263604, -38118, 202937, + 236760, -11811, -1074, 184684, 117575, 92879, + }, + { + 453119, -9691057, -518080, -1011465, -90194, -24696, -220117, -1593970, -217433, -759672, + -1090385, -3178813, -1770600, 10431939, -8229694, 3679713, 1640678, 3695283, 3635690, -5129802, + 4093641, 1868311, -18790, 9695352, -4130148, 514859, -1061931, 2083596, 2545842, 3335042, + -776852, 2428804, -1374390, -801011, -1311576, -2593087, 1360431, -852551, 3264712, 43487, + 165893, -528281, -406411, 14496, 166967, 702227, -1658394, -467615, 627065, 48855, + -1151051, -676994, -107374, 630286, -409633, 359704, -194884, -550830, 1401770, 873489, + 1801739, 1065152, 941672, -214212, 558883, 443992, -67109, -509491, -784368, 172336, + 434329, 169114, 158377, 420907, 824634, 272194, -82141, -384400, -411780, 289373, + -11811, 296353, 69793, 205622, 3758, -91805, -336618, 191126, -39728, -75162, + 229244, 49392, -176631, -196495, 30065, -117038, + }, + { + 37616936, -153301872, -13430363, 11347840, -1471563, -2718178, -573378, -931471, 348429, -2396055, + -450972, 825707, 703838, -2882460, -9191767, 890132, -3258807, 1751273, 2735357, 354872, + 3160559, -2416993, -4134980, 2486249, 2130304, -3866008, 717260, -1495186, 2878165, -1305670, + 1876901, 2557653, 2855617, -2485712, -876173, 493384, -490163, -243739, -3938485, -2129230, + 1888712, -1327145, -223875, -509491, 1694902, 1751273, -2215130, 954020, 2106682, 654983, + 1228898, -1311576, -1005559, 410706, -115427, 2267743, -2147, 904091, 297963, -1008780, + -282931, -353798, -71941, -2147, -621697, 801011, -89121, -134218, 287226, 315680, + -195958, -201863, -5369, 143345, -129923, 158377, -147103, -150324, 398358, 51540, + 343597, 672162, 32749, -190589, -267899, 152471, 537, -39192, 117575, 18790, + 28991, -75162, 94489, -140660, 115427, -248034, + }, + { + 826781, -6180995, -1809792, 521302, -911070, -224949, 121870, -2433099, -3274376, -253403, + -1461363, -1358820, 503048, 1930051, -15241228, 9824201, -4693326, -4495757, 4042638, -3446175, + -6972880, -1886028, 5260798, -7204271, 3847217, 7235410, -5382131, -302795, 6099928, -5814849, + -1002338, 1284732, -574989, -4162897, 587337, 255551, 1769527, -751082, 1177358, 330712, + -1787780, 270046, -2112587, -693100, 1121523, -905164, 1253594, -272194, -804770, 1527398, + -1431835, 1979443, -632971, -181462, -51003, 171262, 257161, 979253, 814970, -2211371, + -1567663, 1046898, 132607, 290984, 201863, -114890, 717260, 478889, 988916, -294205, + 433792, -187905, -326418, 290984, -99321, 178241, -408022, -323196, 235686, 118648, + -44023, 328028, 164819, 340913, 38118, -629750, 14496, -100395, -166967, -67646, + -49392, 10201, 32212, 154619, 204548, 103616, + }, + { + 15966541, -16408386, -12262132, -4128001, 754841, -5090610, 5727876, -362925, 547608, -4081293, + -2748242, -774705, -2634426, 230318, -3114388, -3375844, 2534031, -7573101, 3279745, 214212, + -3164854, -5560372, 3257733, -2752000, 2740726, 2107218, 2053531, -613107, -1232119, -2384244, + -2959769, 2834679, 4415764, -3487514, 1038845, -4639102, -2592550, -3381213, 2227478, 2353642, + 1118839, 226023, 1276142, -177704, -2267743, -1737851, -1296543, 1515050, -852551, -2542621, + -556735, -1674500, -1021129, 211527, 2570001, -922344, -559956, 937914, 275415, -172872, + 439697, -643171, -57445, 574452, -1392643, 605590, 700617, -341450, 367757, -116501, + -497142, 623844, 73551, -104153, -403727, 179315, 580357, 30602, -170188, -208843, + 2684, 26844, 500901, -172336, 160524, -584652, -154082, 105764, 178778, 165893, + 251792, -97174, -195421, 100932, 213675, 37044, + }, + { + 694711, 25877178, -5408975, -203474, 974421, 1941862, -1801202, 1730872, 216896, 395137, + -894964, -1569274, 1551557, -2639794, -3338800, 2088428, -3823595, 2639258, 492848, 6318971, + 1612223, 8820789, 2267743, 3066070, 1397475, 716186, 2597382, 6882685, 1620276, 2888903, + -821949, 294205, 2716567, 388158, 2757369, -1171989, 2024540, 434865, 1829119, 677531, + 1267552, -2544768, -179315, -73551, 593242, -820339, 1578937, 100395, -61203, 303332, + 252866, -1163936, -212064, 1358820, 610959, 738734, -70330, 79457, 1005559, 190052, + 472446, 217970, 517544, 8053, 312459, -478889, -123480, 54224, 177167, -817654, + -301721, -158377, -62277, -391379, -250719, -33286, -64425, 1611, 268435, 537, + 82141, -366683, -192200, 312459, 264141, -33286, 237297, 13959, -34360, 235686, + -165356, 34360, -70330, -87510, 127775, -30602, + }, + { + 29394756, -7802345, 7896834, -3459059, 427349, 2670933, 504122, 966905, 1229434, 5761699, + 1975148, 1172526, -1730872, 9662603, 8519605, -53687, 1794760, 424128, 3714073, 20938, + 5881958, -425202, 1188632, 3855270, 3641059, -4138738, -701690, -439160, -1679332, -1075352, + 44023, 1073742, 2126546, -54761, 3887482, -1725503, 208306, 1835025, -3578245, 100932, + -992674, 779537, 4917201, -579284, -322123, 870805, -75699, 245350, -71941, -6979, + -1129040, -385473, -1355062, -128849, 957778, 439160, 146566, -586263, 277025, -847182, + -766652, 323196, -507343, -223875, -68719, 180926, 373662, -381715, 673236, -491774, + -359167, 237297, 110059, -234613, -88047, -620623, 217433, -122943, 48855, 49392, + 174483, 48855, -132070, 229244, 37581, -288300, 5906, -170725, 118648, 97174, + -77846, -157303, -142271, 127775, -83215, -28991, + }, + { + -424128, 8762807, 7817914, -209380, 3185792, -2102387, -4048007, 328565, -2298344, 1719061, + 160524, 4522064, -15447387, -667867, 6255620, 4163434, -2178085, -2660195, 1278827, -9460202, + -435939, -775778, -848256, 8059506, 3525631, -4926328, 1617055, 6444599, 2587718, -765578, + -48855, 2964601, 3325379, -470836, 1714766, -1677185, -3056406, 1533840, -3607773, -1633698, + -730144, -202400, 2399276, 833761, -372052, -374199, 1604707, 37044, -2412698, -2237141, + -245887, -56371, 500364, 365072, 40265, 469762, 242666, 192200, 614180, 71941, + -282394, 601832, -685047, -171799, -766652, -510027, -54761, 402116, 957778, 271120, + -275952, -11274, -597537, 184147, 30602, -231391, 99858, 308701, 220654, -178778, + 66035, -87510, 151934, -92342, 33286, -26307, -505732, -272194, -403727, 537, + -338229, 162672, 27380, -206695, 70867, 171262, + }, + { + 17635136, 35580584, -206158, -2691871, 2146947, 1643362, 5252208, -2336999, 8151311, -1297080, + 1249299, 2036351, 4843650, 11268920, 22454090, 2845416, -8453033, -568546, -4259534, -773094, + 981400, -1451162, 49929, 4463008, -304406, -234613, -416075, 3601867, -3779571, 759672, + 1611150, 1765232, 661962, 1234266, 3918084, -1151051, -2617246, 2285996, 3394098, -747861, + 1118839, 799401, -2171643, -2114198, 1056562, 2474438, -1427540, 807454, -111132, 489626, + -663572, 1959579, 1684164, 2367064, 967441, 379568, 127775, -337155, 999654, 261993, + -397821, -718333, -30602, -119185, 607201, 73014, 299574, 53150, 468151, -217433, + 233002, -4295, -886911, -27380, 149250, 368293, 348429, 223338, 15032, 139586, + 57445, -242129, 186294, -253940, 151398, -250182, -27917, -260919, -97174, -231928, + -300648, 34360, -94489, -161598, 35970, 253403, + }, + { + 898185, 470836, 2452426, -4296578, 578747, 1773822, -280784, -1170916, 3555159, -122407, + 1885491, -4118337, 1698123, -22612466, 35378720, 540092, -3949223, 1314260, 3657165, 1234803, + -1080184, -620086, -2087891, -1849520, 3555159, 531502, -4195110, -4226785, 890669, 4552666, + 2292976, 31139, -5616207, 1431835, 1063541, -279710, -1952063, 1031329, -3655554, 839129, + -773094, 108448, 969052, -800475, 1145146, 965831, 142271, -131533, -772020, 1028645, + 1058173, 121333, -931471, 30602, -500364, -737124, 47782, -111132, -319975, -159988, + -678605, 497679, 881542, -655519, -102005, 128849, -589484, 606127, 408559, -147640, + 677531, 71941, 12348, -38655, 497142, 408022, -361314, 146029, -277025, -161061, + 80531, -55835, -137976, 112206, -10201, 16643, -383863, 64425, -108448, 49392, + -59056, 16643, 27917, -150324, -217433, -109522, + }, + }, + { + { + 10453950, 129184024, 11629698, -7159174, -922344, 2124398, -1192927, 2363306, -77846, 1945620, + -3332895, -4104378, 2002529, -368830, -2576981, 11570642, -8709657, 1404454, 9058623, -2619930, + 747861, -3850438, 1581622, -6629282, 5324686, 1401770, -2648384, -4694400, -1018981, -1586454, + -107911, 339839, -4036733, -1060857, 2071248, -3066070, 812823, -885837, -1295470, -1115081, + 2653216, 2766496, -1304060, 4044249, -295279, -253403, -643171, -195958, -1902671, -683974, + 1155346, 317828, -821949, -376883, 1758789, -321049, -877247, 475131, 758062, -1637993, + 920197, 177704, -1161789, 9127, 97711, -341987, -251256, -289910, -26307, -600222, + 479426, 224949, -318901, 771484, 212064, 504659, -162672, 165356, 1611, 235149, + -220117, -270046, 486405, 74088, 19327, -263604, -147640, -124554, -275415, -39192, + 125091, -131533, 107374, 7516, 38118, -64961, + }, + { + -552977, 69077568, 13482439, -390305, -3114388, 573378, -882079, 1204202, 3330210, 1475858, + 1364726, -286689, -747324, 994822, -9814000, 3861713, 6224482, -4876936, 14177687, -1794760, + -9553618, -1369021, 415001, -2696703, 807454, 547608, -3186866, 2426120, -1022202, -2202781, + 1694365, 6742025, 969052, -1030255, -3576634, -1485522, -544924, 657130, -680215, 2048163, + 1694365, 2524904, -1978906, -1036698, -1276679, -1483911, 114354, 1770600, 81068, 1158031, + 1072668, 630823, 341987, -219580, -609885, -541703, -855235, 460098, 1075889, 383863, + -498753, 737661, -215822, 467078, -9664, 165356, -541166, 671089, 208843, 15032, + -272194, -148176, -199179, 265214, -290984, 126165, 175020, -289373, 373125, 9127, + -157303, -187905, 85362, -607738, -249108, -95563, -213675, 208843, 49929, -67109, + 67109, -73551, -154619, 258772, -102005, 158377, + }, + { + -1928977, -127387656, 22408454, 9104257, 5713917, 5805185, 60666, -842350, -1225139, 1040993, + -32749, 1831804, 7007776, 739271, 5732171, -2706903, -6187438, -9320079, -494995, -2703145, + -585189, -6571300, -4293894, -3739306, -5340255, 468151, -7103339, -4734665, 990527, 2987687, + 1204738, 4721243, -686658, 442382, 4294431, 61740, 1131187, -1466731, -1065152, 2135673, + -1612760, -3659849, 537408, 2490544, 828929, 9127, -2100239, 137439, 327491, 471910, + 666257, -190052, 318364, -164283, -32212, 668404, -930934, -1299228, 59056, 79457, + 119185, 668941, 408022, 37044, -18254, -497679, 547071, -217433, 612570, 540092, + 295816, -236760, -474057, 319975, 348966, 537, -654983, 206695, -322659, -296890, + -159451, -4832, 11274, -154619, 70867, -156766, -27917, 30602, -137976, -32212, + -12348, 52076, -267362, -5369, 39728, -54224, + }, + { + 30507152, 110248056, -10401874, 17074642, 482110, -1075889, 2188286, 2380486, 989453, -87510, + 960999, -590021, 1503775, -6440304, 3251290, 117575, -3761855, 4533875, 4622459, -419833, + -399969, -4843650, -3689914, -446140, 745177, -2237141, -3100430, -202937, 778463, -836982, + 4045859, -1043140, -702764, 493921, -192737, -287226, 850940, -777926, 73551, 524523, + -763430, -1045825, 548145, -637266, -1364726, 420370, 484258, -1059783, -784368, -879931, + 167504, 952946, -1400159, 871342, 121333, -612033, 482110, -123480, -432181, 1444183, + -688269, -112743, 255551, 502511, -76236, -214212, -42413, 267362, 181462, -77846, + -175557, -413927, -434329, 84826, 240518, 180389, -413927, 66572, -301185, 133144, + -382789, -412854, 39192, 269509, 23622, -54761, -100932, -10737, -125091, 53150, + 19327, -19864, -67109, 93416, -79457, 537, + }, + { + -63888, 24761024, -6790880, 652835, -1067836, 929324, -345745, 799938, 533650, 893890, + -3680787, 1952600, 1854352, 6257231, -4220879, 1688459, -1979980, -50466, 14314052, 1293859, + 3318399, -3771518, 2916820, 401579, -2279017, -3775813, 1205275, -3320547, -130460, -2684, + 550830, -544924, -1402844, 7555921, -586800, -4854924, -1251983, -2531346, 1412507, -983011, + -729071, 16106, 223338, 11811, 2279554, 225486, 243739, -1307818, 1313723, 59593, + -621697, 1280437, -413927, -135291, -465467, 1469953, -730144, 455267, -82678, -507343, + -966905, 382252, 49392, 434865, 1069984, -249108, -239981, 319975, 384400, 18790, + 461172, 120796, -334471, 340913, 498753, -345745, -107374, 331249, -472983, -491237, + 15569, 79457, 112206, -20401, -55835, -154082, -208843, -105764, -162672, 202937, + -61740, 3758, 200790, -47782, -214212, -31139, + }, + { + 33130304, 246435024, -4412542, -229244, -5056787, 1677722, -610959, 4783520, 546535, 504122, + 398358, -89657, -2048699, -1336809, -512712, -2632278, -2440078, -2372970, 1089848, -236760, + -1578937, 656593, -814433, 750546, 939524, 2216203, 801548, 5026186, 693637, -1283658, + -1846836, 2275259, 658204, -4684199, 2060511, -429497, 2480344, -842350, 1081795, 1020592, + 721018, 4081830, 2027225, 1230508, 1153736, -395137, -858457, -1410897, 550830, -45097, + 899796, -1095754, 67646, 900333, -810675, -634581, -1444720, -339302, 62277, 1611, + 62277, -93416, -243203, 281320, 692027, -181462, 140660, -193810, -89121, 468151, + -1611, 785979, -33286, -119722, 253403, -311922, 267362, 166430, 194347, -35433, + 518080, 230854, 32212, -295816, -37044, -64425, 177704, -398895, 128849, 27917, + -97174, -176094, 56908, 160524, -105227, -51003, + }, + { + 42413, -5131412, 5140002, -110059, 978716, -73014, 426812, -435939, 517544, 849330, + 1368484, 2022930, -2234457, 6086506, -5915781, 2297271, 439697, 6157373, 1104344, -13728863, + -913754, -5017059, 1242856, 11814381, -3425773, 674847, 2323041, 7864622, -752156, 886911, + -448287, 1393180, -1498407, -609885, 292058, -2358474, 1267552, -1241782, 1562831, 220654, + 159988, -1326071, 763967, 860604, 136902, 1457605, -846645, -462783, 802085, 433255, + -879395, -481573, 402653, 1178969, -397284, -622233, -1267552, -174483, 45097, -1457068, + 360777, -142271, -271120, -194347, 531502, -376883, -422517, -137976, -220117, 328565, + -82678, -106300, 46708, -385473, 471910, 348966, -77309, -296890, -221728, 453119, + -57982, 405874, 93416, 1611, -201327, 537, -253940, 5906, 125091, 212601, + 343061, -1074, -134218, 26844, 88584, -115964, + }, + { + -26595512, -220707088, -3674882, 8376260, -1441498, -1916092, 3129958, -2116345, 1786170, -403727, + -1262720, 4057134, 1349694, 1445793, 535260, 3276523, 2849711, 3348464, 2835215, -869194, + 356482, -810675, 99321, 3572339, 565862, -3705483, 4018479, -522912, 1682017, -1015223, + 1971927, -1714229, -251792, 579284, 687195, 6533182, 5625334, 243739, -320512, 333397, + 831613, -2301566, -811212, -227096, 507343, 710280, -1451162, 243203, 99321, 257161, + 1658394, -296890, -74088, 282931, -795106, 654983, -858993, 1085553, 38118, -1252520, + -171262, -231391, -41876, -372052, -329102, 1170379, -535260, -632434, -390842, -233539, + -492311, -543313, -380105, -90731, -276489, 126165, -268435, -188442, 112206, -521302, + 85899, 449898, -265214, -368830, -12885, 114890, 60666, 291521, 109522, 66035, + 230854, 26844, -35970, -89657, 171262, -155693, + }, + { + 306553, -4850092, 3462281, 1083942, 639413, 3758, 180926, -1076426, -1967095, 28991, + -357556, -1935957, -3473555, -4489315, -15425375, 10901701, 1517197, -2374043, -1529545, -6235756, + -9654013, -2618320, -4357245, -12225088, 8617852, 6633040, -2022930, 822486, 2841658, -1740536, + 1608465, 1051730, -2044404, -6259915, 1870995, 1109175, -375810, -815507, 3798362, 1791001, + -1898912, 1161252, -1425392, 305480, 785442, -1718524, 1476395, 229781, -1371168, -499290, + -2120640, 2434173, -747324, -42413, 551903, 455267, 173409, 1070521, 1731946, -841814, + -863825, 685047, -438087, -41339, -107374, -554588, 447750, 2147, -274341, -694174, + 685584, -110059, -346819, -355409, -87510, 624918, -195958, -201863, 238371, 176094, + -163746, 290447, -3221, 147640, 82141, -504122, 267362, 226560, 94489, 132070, + -21475, -36507, -26307, 106300, 127238, 86436, + }, + { + -14836965, -8647380, 19660212, -7245073, -3524558, -8271570, 7370701, -1329829, 310311, -879395, + -1498944, 1867237, 8590, 1322850, 3988951, 3539590, 7303592, 1552631, 30065, -4202626, + 779537, -5251672, 3580392, -665720, 1403381, 226023, 1749662, -1355599, 310311, 488016, + -5363878, -1372779, 2458869, -1852205, 3839164, -473520, 1817308, -3416647, 1591285, 181999, + 1371705, 833224, 1940788, 804770, -437550, 1838246, 600222, 956704, 454730, -565325, + -283468, -1611687, -1254131, -1255204, 1199907, -1083942, -569083, 675921, -163746, 212601, + -131533, -1200443, -431644, 1049583, -841277, 52076, -231928, -458488, 250182, 45097, + -176631, 174483, -619549, 115427, -85899, 65498, 166967, 284005, 33286, -209917, + -203474, -355945, 279173, -252866, -179852, -476741, 30065, 12348, 136365, -124554, + 59056, -6442, -69256, 22549, 68719, -104690, + }, + { + -644782, 30466888, 4340065, 1749125, -1847910, 1093606, -1292248, 3359738, 163746, -1211181, + -1620813, -1386201, -1489280, -972810, -6087043, 1730335, 891743, 4555350, 1467805, 8156680, + 215285, 6533719, -3944928, -6043556, -937914, 3205656, 4817343, 7318625, 2792803, 2596308, + -1693291, -3061775, 2526515, -79457, 2865280, -1649804, -280784, -414464, 573378, -1927367, + 798864, -728534, 709207, 1255204, 900869, -1757715, 584116, 212601, -48318, 11811, + 884763, -409633, -504122, 221191, -154619, 586263, -118112, -307627, 433792, 537, + 461172, 595927, 681289, 116501, 492311, 232465, 478889, 154082, 498753, -684510, + -333397, 229244, 353798, 86436, -98247, 17180, -71941, -102542, -183610, -60130, + 99858, -329102, -343597, 45634, 31139, -195421, 245350, 27917, -156766, 180389, + -220117, -12885, -162672, -107911, 19864, -67646, + }, + { + -15113990, -66559644, 11098732, -5399848, -3524021, 515396, 1328756, 580357, -2193655, 523986, + -1178432, 2388539, -7642895, 1075889, 10203232, -2870112, -3693672, -2117419, 747861, -2327872, + 2835215, 528818, 1635846, 839129, 3692598, -880468, 2816425, 1996086, -2712809, -2684892, + -233539, 991601, 1855426, -1158567, 154619, -3904125, -578747, 1199907, -3965866, 610959, + -455803, 950262, 3422552, -2339684, -112206, 873489, 370978, 1180579, -114354, -1120987, + -488553, 624918, -733903, 903017, 624381, 464930, 368293, 197569, 1389422, -302795, + -1335198, 190052, 229244, -51003, 231928, 577136, 360777, -672162, 697395, -621160, + -15569, 208843, -16106, -16643, 205622, -469762, -107911, 14496, -42950, -255014, + -222265, -98247, 28454, 172336, 145492, 147103, 114354, -230854, 1074, 77309, + 52076, -208306, -236760, -51540, -125628, 67109, + }, + { + 656593, 1295470, 616328, -1554241, 4344897, 271657, 190052, 2404645, -922881, 1427003, + -588411, 8838506, 9496710, 29605210, 7906498, 10219338, 173409, 591095, 3201361, -2254858, + -3789772, -16323023, -9018358, 7908646, 9110163, -2225330, 4196183, 1814087, 2216203, -2973728, + -3054796, 188442, 1045288, -1554241, -1438277, -3304441, -2585034, 1400159, -1826972, 1191853, + 690953, 1358820, 1991254, 445066, -1018444, -271120, 2301566, 288837, -2001455, -1455457, + -1864553, -657667, 355409, -140123, 443455, 1112397, 399969, 294742, 553514, -91268, + -167504, 45097, -492311, 580894, 10201, 82678, 198642, 261993, -357019, -69793, + -117038, 475131, -148713, 201863, -107911, 25770, 267899, 28454, -25770, -349503, + -143345, -231928, -12885, -81068, 178778, 266825, -134218, 383326, -117575, 118648, + -61203, 226560, 37044, -131533, -2684, 60130, + }, + { + -18957986, -11485816, 1751273, -3890167, 775778, -3985193, 1141388, -3676492, 4116189, -3052648, + -1547799, -1618666, 7853348, -8453033, -11828877, 4959077, -1327682, -1452773, -5138392, -346282, + -983548, -1698123, 173946, 4001836, 1228898, -301721, 271120, 1480690, -2971044, 2923262, + 1750736, 1188095, -665720, -1128503, 2809446, -775242, -2731062, 1531156, 311385, -2419140, + 1453846, -450435, -1464047, 88047, 505196, 2290828, -1802813, 887985, 905164, -359167, + -1285269, 702764, 688805, -12348, -554051, 260382, -693637, -875100, 1042603, 517544, + 104153, -744640, -151934, -265751, -68183, -481573, -163209, -63351, 682900, -62277, + -349503, -116501, -914291, 108985, 412317, 197569, -264677, 118112, 55298, 115964, + -52613, -308701, 122943, -488553, -23622, 10737, -35433, -285078, 53687, -170188, + -186831, 300648, 162135, 35970, -16643, 85899, + }, + { + -652835, -2180233, 2952253, -1891396, 2175401, 60666, -2387465, -3970697, 1936493, 3115999, + 2360085, -6061810, -879931, -12576738, 50838992, 934155, -3095061, 4658966, 9188546, -3417183, + -5496485, 2871186, 1712081, -7969312, 1219234, 4101694, -3427921, -3473018, -445603, 1653026, + 1495722, -344671, -5219459, 5248450, 4395899, 1565516, -431644, 3256122, -2698313, -317291, + 170188, 1450625, 1329829, 976031, 132070, -638340, -1154809, -1200443, 258772, 2840584, + 915365, -312996, -810675, -479963, -159988, 310311, 587337, 105227, 184684, 336081, + -680752, -292058, 1000191, -53150, 447213, 602369, -1016297, -398358, 22012, -324270, + 91268, -330712, -105764, -348966, 88047, 485868, -406411, 294205, -220117, -116501, + 106837, 62814, -49929, -104690, -185220, 178241, -222265, 98784, 70867, 137439, + -70867, 72478, 14496, 66035, 10201, -4295, + }, + }, + { + { + -11696270, 94897840, 47954920, -14658723, 1869385, 2012192, 57445, 3111704, 439697, -741419, + -5320391, -3820910, 2544768, -1991791, 4614406, 869731, -75699, 1719598, -290447, 4167729, + -1083406, -3488050, -2918430, 708670, 1648194, 1392106, -3453154, -4146254, -3481608, 1706176, + -3517578, 792421, -1585917, -1074816, 609885, -2480344, -625455, -649614, 830002, -1148904, + 2246805, 1410897, 1155883, 589484, 319438, 253403, 428423, -1306744, -1770600, -709207, + 2282775, 539555, -1932735, 127238, 681289, 904091, -867583, -114354, -559420, -389231, + 737661, -261993, -587874, 255551, -607738, -293132, -421444, 48318, -352724, -106837, + 12348, 432181, -347892, 423591, 421981, 23085, 60130, 84826, 301185, 279710, + -97711, -222801, 271657, -63888, 52613, -102005, -212601, -79457, -322123, 34360, + 48318, 10737, -80531, 100395, 31139, 22549, + }, + { + 1375463, 56866976, 19222664, -2750927, 1486596, -548682, -133681, 899796, 4307316, 2264522, + -2012729, 586800, -150324, -3547106, -8982387, 12090333, 439160, 5176510, 1646583, -2851322, + -7466801, -3776350, 580357, -2365453, 1731409, -2122251, -1316408, 3180423, -3163780, 1446867, + -2436320, 7192997, 1498407, -1711545, -313533, -4032438, 745714, 1165010, 981400, 1165547, + 1127966, 1995012, -1635846, -1455457, -593242, -266825, 382789, 1027034, 289910, 622770, + 1762010, 879395, 493384, -416612, -280784, -1554778, -264141, 277025, 532576, 845572, + 810138, -399432, 184147, -311922, 589484, -140123, -213138, 516470, 89121, -130460, + 492848, -291521, -297963, -3221, 114354, -13959, 26844, -45634, 5906, 68719, + -197569, -44023, -198105, -265751, -199179, 77309, 102542, -144955, 19327, -91268, + -182536, -73014, 129386, 223875, 73014, -44023, + }, + { + 3019899, -51266876, -40070436, 7767985, 7471096, 6862284, -783832, -1577327, 427886, -1656784, + 5637682, 1052267, 911607, 4665408, 4286378, -380641, -2812130, -12514998, -4307316, -389768, + -6726993, -4426501, -6502044, 1977296, -2841658, -4393215, -4276714, -3845070, -933619, 2313377, + 3383361, 1927367, 354872, 1653562, -1101122, 790274, 2591476, -2836826, 535797, -619012, + -2085207, -1209033, -857920, 951872, 1000191, 1349157, -2065879, -419296, 965831, -141734, + 584116, 348966, 309238, -41876, -45097, 693637, -572841, -871878, 26844, -66572, + -403190, 1372242, 512712, 74088, -534187, 567473, -798327, 547071, 309238, 791348, + -3758, 17180, -179315, 51003, 100395, -16106, -321049, -97174, -246961, -111132, + -456340, 122943, 2147, -256624, 161598, -63351, 216896, -244813, -8590, -158377, + -537, -21475, -291521, -140660, 26844, 53150, + }, + { + -14014478, 153095184, 3491272, 15102179, 2624762, -421444, 2079301, -151398, 1714229, 1343788, + -943282, 2042794, -936303, -608812, -3251827, -2928631, 3547643, 5186173, 1774358, -1088237, + -909996, -3713536, -2594697, -852551, -688269, -1032403, -2732673, 721018, -744103, 2397666, + 667331, -2126546, 225486, 1243393, 1379221, -1054415, 559956, -309775, 126702, 2182380, + -2123325, -125628, -1252520, 796180, 357556, -558346, -739271, -923418, -40802, -1451699, + 895501, -293668, -1069984, 356482, 859530, 274878, 164819, -7516, -603980, 933082, + 403190, -218506, 16643, 158377, 199179, 19864, -180926, 515396, -1611, 26307, + -181999, -415538, -661962, -118648, 649614, 30065, -55835, -87510, -322123, 51540, + -204548, -139586, -118648, 192737, 103079, -201863, -77309, -1074, -283468, 91268, + 100932, 57445, -22549, -90731, 108448, -140660, + }, + { + -507880, 8832600, 4540318, -290984, 566399, -277562, 558883, 550293, 1224066, -44023, + -1928977, 1443109, 3699041, 671626, 6542309, -7528004, -842887, 22357990, -22587234, 7638063, + 5349382, -1156957, 191126, -4038880, -4996658, -792421, -850940, 1203128, -421444, 3614752, + -2398202, -62277, -1214939, 4722317, 1231582, -2975339, -1741609, 80531, 1163399, -106837, + -2000381, 200253, -1370095, -210453, 2238752, 1545115, -753230, 765578, -82141, 1129040, + -1096827, 252329, 958315, -1518271, 386010, 688269, 1094680, 267362, -773094, -297427, + -151934, -189515, -120259, 1057636, 828929, 536871, -83752, 213675, 322659, 47782, + -24696, 287763, -238908, 351650, 304406, 210990, -417686, 223338, -33823, -363462, + 52076, -45097, -40802, 51003, -71941, -376883, 118112, -185757, -76773, 179852, + -83215, 245350, 28991, -59593, -173409, 2147, + }, + { + -7902740, 302563264, -6205154, -6868190, 3997004, -952409, 497142, 3797288, 539018, 475668, + 4170413, -2770254, 270583, -1871532, 740882, 367757, -7047505, -1320703, 1396938, -1330903, + 10201, -697932, 1731409, -1079111, 1016297, 1134945, 2130304, 3430605, 791348, -1959042, + 331786, 1602560, -1975148, -1911261, -387621, 1147830, 1629403, 889058, 1254131, 1324461, + 3124589, 1302449, 3539053, 1684701, -2391223, 801548, -2851858, 1265405, -232465, -703838, + 617938, -875100, 1105417, -411780, -358630, -979789, -752693, -540092, 512175, -39728, + -626528, 334471, 218506, 301721, 161061, 322659, 11811, 17180, 70867, 148713, + 574989, 219043, 493384, 22012, -256624, -13422, 215822, -111132, 11274, 472983, + 284005, 257698, -318364, -164283, -102005, 259309, -161061, -253403, 175020, -87510, + -64425, -239444, 212601, -138513, 32749, -90194, + }, + { + -290984, 4507568, -318901, 273267, 883153, -5906, 89121, -110059, 472983, 878858, + 948651, 375273, 2873333, -2754685, 168041, 4456029, 2311229, -2208687, -2442226, -7058242, + 823023, -525060, 6786049, 895501, -2615635, 163746, 3720516, 5069135, -805843, 316754, + -1467805, 1735704, 583042, -1280974, -1465658, -1455457, 1418950, -715649, -164283, 2004676, + -503585, -1926293, 2223719, 1378148, -1400696, 789200, 463856, -367757, 426276, -844498, + 159988, -794569, 288300, 1051193, -486942, 333934, -1596117, 312459, 83215, -1452236, + -135291, -335007, -715112, 150324, 792421, -1051730, -590558, 120259, 93416, 315680, + -227096, -263604, -13959, -15032, 351114, 157303, 116501, -189515, -10201, 333934, + -6979, 110059, 234613, -134218, -91268, -59056, 18790, -169114, 64425, 206158, + 112743, 2684, -50466, -3758, 32212, -63888, + }, + { + 10323491, -241567216, -21978958, 1082332, 2101313, 172336, 1523640, 1598802, -113817, -1326608, + 1037235, 1723356, 1498407, -3561602, 6395743, 4374961, 2058900, 2606508, 2255932, -120259, + -1455994, 1268626, 1723356, 3046206, 103079, -2587718, 1607392, 910533, 1465121, 1478543, + -191126, -2318746, 2012729, -2270964, 3637837, 8071318, 2518462, 1697049, -1198296, 3176665, + -1220845, -1418950, -2199023, 129386, 814433, 550293, -146029, -1989644, 813359, 1579474, + 1159104, 213675, 451508, -1931662, 702227, 184147, -310848, 449361, -611496, 146566, + -759136, -44023, -279710, -824634, 428423, 710817, -680215, -204548, -231391, -547608, + -491774, -646929, 230854, -180389, -196495, -154619, 81068, -12885, -132070, -457951, + 339839, -53687, -134218, -377957, 11274, 92342, 79457, 388158, -70867, 236760, + 114890, 15032, -150861, 190052, -152471, 46708, + }, + { + -939524, 7732552, -2573222, -1304060, 1413581, -164819, -462246, -609885, -508954, -644245, + -622770, -1354525, -782758, -5679021, -12520903, 1089848, -1003949, 10793790, -8775155, -6693170, + -9312563, 62814, -6180995, -4025995, 3554622, 3399467, 3324305, -1004486, -1729261, 2126546, + 1324997, -548682, -1100049, -3899294, -20938, 2614561, -2171643, -390842, 2659659, 2338073, + -476205, -592706, -842350, 2026151, -153008, -928250, 384400, -660888, 450435, -1927367, + -578747, 850940, -368293, -306016, 819265, 454193, 112743, 1698123, 904628, -453656, + -160524, -627602, -201863, -55298, 66572, -931471, 93952, -450972, -242129, 273267, + 239444, 53150, -334471, -514859, 359167, 171799, 19327, 55298, 101469, 163746, + 41876, -271120, 181999, -140123, 122943, -161061, 267899, 181462, 131533, 242666, + -8053, -182536, 37581, -537, 279173, -4295, + }, + { + 12544526, 15264314, -35879620, -5926518, -487479, -1441498, 1064615, -1035624, -1138166, 1810866, + 767189, -184147, -148713, 1188632, 6693707, 1509681, 9255118, 5099200, -3384971, -2901787, + -348966, -2762738, 773094, 1813013, 1683627, 1525787, -482110, -1522029, 1170916, -115964, + -2383170, -1802276, 547071, -1686848, 2415919, 2713883, 212601, -751082, -203474, -549756, + 2877091, 47782, 1483911, 788663, 288300, 2450816, 1917703, -126165, -809601, 1843615, + -1006633, -1011465, -759672, -959388, -408022, 126702, -569083, -154619, -129386, 492848, + -124554, -858993, -429497, 482647, -383863, 4295, -800475, 61740, -15569, 135828, + 348429, -142808, -502511, 49392, 89657, -41339, 157840, 69793, 229781, -227096, + -423591, -205622, 6979, -34897, -295816, -45097, 64425, -16643, 132070, 76773, + -118112, 10201, -15569, -73014, 29528, -36507, + }, + { + 381715, 18848464, 12095702, 860604, -74088, -876710, -625992, 2080912, 1833951, -2920041, + 1153199, -2500208, -4674535, 5275831, -8279623, 3463891, 16106, 874026, 8337069, -3030100, + 4682051, 5085242, -3001109, -3692061, -2459943, 4721243, 3716221, 6715718, 4283156, 1234266, + -2116345, -6796249, 5346698, 1260573, -77309, -762357, -1996623, 1740536, -1222455, -1921461, + -916976, -288837, 2515777, 184684, 277025, -5369, -1200443, 1504849, -127775, -427349, + -60130, 350040, -150324, -513785, 621697, 223875, -672699, -230854, 56371, 521302, + 937377, 2684, 113280, 411243, 231391, 622233, 781684, 271120, 14496, 169114, + -388695, 165356, 6979, 210453, 30602, -115427, -161598, -270046, -155693, 62814, + -76773, -191663, 6442, -338229, -155156, 0, -11811, 157303, -69793, -133144, + -69256, -49392, -150324, 23085, -2684, -58519, + }, + { + -149787, -81451368, 1145146, -377957, -5628018, -4092567, 5211943, 906238, -2178085, -427886, + -2822331, 3039763, -4142496, -1203665, 3542811, -1874216, -2088965, -1290638, -1373853, -248034, + 1531693, 63351, 2486786, 446677, 819265, 2989297, 2382096, 971200, -2507187, -1276679, + -1432909, 566399, 1583769, 96637, -1685775, -4556961, -540629, -1088774, -325344, -1452236, + -168577, 2588255, 2476586, -3030100, 789737, -249108, 102542, 1084479, 1464047, -1489817, + -826244, -85362, 81068, 1067299, 141734, 1114544, 131533, 989990, 240518, -73551, + -806917, 60130, 101469, 234076, 346819, 144955, 146566, -500901, 210990, -43487, + 1611, 97711, 201327, -31139, -57982, -185220, -132607, 100395, -254477, -64961, + -213138, -133144, 45634, 310311, 78383, 236223, -172872, -179315, 172872, -19864, + 31139, -116501, -83215, -139586, -57445, 162672, + }, + { + -617938, -2754685, 716186, 1107565, 2200097, 2640868, 2013266, -654983, 2717104, 530428, + 1975685, 5144834, -1664300, 46750720, 4938139, 8269960, 3968013, 1472100, -316754, 1731946, + -4234301, -16121160, 1215476, -579284, 2126546, 4461934, 6283537, -714575, 871342, -2937221, + -5317707, 1591285, -111669, -1483374, -2990908, -1266479, -2410551, 104690, 622770, 226560, + 2484102, 1465658, -172336, 457414, -2267743, 1491964, 2053531, 365609, -1043677, -1997697, + -1334661, -951335, 964757, 311922, 657667, -19864, 637803, 75162, 346282, -402116, + 40802, -542240, 403190, 570157, -295816, 73551, 628676, 33823, -942745, -98784, + -114890, 341450, 681826, 64961, -406948, 14496, 482110, 92879, -355945, -108448, + -89121, -194347, -315143, -54224, -49392, 150324, 320512, 214212, 209380, -208306, + 176631, 267899, -109522, -15032, 3221, -17180, + }, + { + 12499429, -47209744, -9903121, -136365, -1274532, 2767570, -5485747, -364535, 119722, -965294, + 1204202, -53687, 3371013, 1370632, -25301116, -3587908, 4828080, -704912, -5564667, 1256278, + -2732136, 317828, 239981, 2544231, 1947768, 579821, 563178, 1127966, 1237488, -492848, + 2805688, -293668, -285615, -749472, 512712, 505196, -1386201, -5906, -1452236, -2249489, + 872952, 1768453, -1100049, 173409, -645319, 1194001, -670015, -659814, 783832, -195421, + 80531, -312459, 596464, -680752, -492311, 93416, -1039919, 448287, -18254, 1020055, + -636729, 73551, -421444, -442919, -382252, -618475, -675921, 151398, 667331, 310311, + -841277, -28991, -747324, -170725, 435939, 88584, -52613, -16106, 169114, -170188, + -307090, 63351, -292595, -314069, -261456, 379031, -7516, -128849, -71404, -67109, + -130460, 249645, 106837, 16643, 166430, -39728, + }, + { + 682900, -4238059, 2612951, -747324, 761283, -694174, -1689533, -2666101, -434865, 2372970, + 1481227, -1460289, -1780801, 29315836, -3700651, -3135863, 6933151, -2009508, 7709467, -5711770, + -2899640, 6596533, 3107946, -11116986, -2721399, 5483063, -3306051, -1007707, 242129, 1391033, + -508417, -405338, -2782602, 4728759, 3365644, 2114198, -1522566, 1532767, 403190, -634045, + 1866700, 171262, 1905355, 814433, -267899, -699543, -744640, -1206886, 505732, 2236067, + -88047, 859530, -128849, -1695975, 675921, -422517, 1308354, 528818, -74625, 410706, + 442919, -455267, -14496, 506806, 142271, 147103, -166967, -725313, -72478, -326418, + -166430, -267362, -97174, 64425, -47782, 307090, -192200, -33823, -121333, 258772, + -264141, 69793, 165356, -255551, -172336, 138513, -167504, 48318, 172872, -44560, + -10201, 111132, -24159, 128312, -3758, 3758, + }, + }, + { + { + 10436771, 1122597, -54734528, -8111046, -1735167, -984084, -2094870, 36507, 850940, 1204202, + -3856881, -4147865, 177167, -3046206, 5106716, -675921, 983548, 2410551, -4013110, -739271, + -2250563, -318901, 84826, 2274722, -1115618, 1256815, -49392, 1627256, 231391, 1612760, + -2804614, 55835, -1385127, -66035, 232465, -946503, 60666, -809064, -534723, -1986422, + 1643899, -414464, 579821, 514859, 663572, 1057099, 1939178, 133681, -55298, -432181, + 251256, -171799, -856846, 721018, 53687, 736050, -213138, 293132, -40802, 345745, + 92879, -209917, 79994, 452045, -233002, 63351, -214212, 250182, -62277, 200790, + -93416, 267362, -307090, 296353, 100395, -177704, 88584, 24696, 291521, -88047, + -203474, -45634, 201327, -180389, -96637, 64961, -76773, 52613, -117575, 81068, + -22012, 144418, -114890, 68183, 60666, 40265, + }, + { + -278099, 6653441, -21526912, -4282620, 1410897, -691490, -457951, -737661, 135291, 1104344, + -1689533, -578747, -2051921, 3274376, -1498407, 6219113, -3775813, 645319, -3819300, 811212, + -448824, -1422708, -454730, -75162, 3399467, -2959769, -1897839, 1641214, -3216394, 1272921, + -3121904, 5115843, -1308354, -1807108, 1576253, -2043331, 3849365, 1979443, 272194, 809601, + 51003, 244276, -919660, 639950, 129386, -120259, -13422, -673773, -188442, -287763, + 371515, 452045, 751619, -418759, -190052, -522375, 103079, 167504, -92342, 430034, + 585726, -686121, 64961, -553514, 541166, -115964, -27917, 169651, 110595, -60130, + 565325, -237834, -191663, 32749, 12885, -336081, -13959, 110059, -197569, 0, + -8053, 136365, 100932, 62277, -25233, 52613, 28991, -130997, -11274, 19327, + -39728, -33286, 114890, -13422, 49929, -55298, + }, + { + -5155572, 27065274, 23555748, -7904351, -8467528, 2016487, -1695975, -869194, 1475321, -407485, + 4059818, -4646081, -1914482, 2301029, -440234, 9664, 267899, -9204115, -5073430, 349503, + -7516730, 1118839, -2068564, 2799782, -665183, -733366, -69793, -1035087, -3380676, -2044941, + 2063195, 505732, -790811, -1200443, -2025614, 2227478, 270583, -3451543, -295279, -1709397, + -740882, 554051, -1311576, 520765, 222801, 488553, -1419487, -861678, 439697, 177704, + 287226, -660351, -210453, 270046, -122943, 490163, 537, -291521, -95026, -74088, + -169114, 970663, -331249, -152471, -456877, 308701, -899259, 254477, -246424, 121333, + -484794, 29528, -34360, -223338, -281857, 184147, 236760, 223338, -276489, 92342, + -56908, 141197, -64961, -153008, 59056, -177704, 238908, -276489, 173946, -9664, + -18790, 113280, -16643, -80531, 122943, 77846, + }, + { + -2134599, 142359376, -11998528, 12627204, -124017, -300111, 638340, -1012539, 832687, 915365, + -155693, 3389803, -1909113, -4025995, -3284039, 2389613, 1648194, 5205501, 3885872, -900869, + 1138703, 1627793, 1094680, -436476, 1374390, 1441498, -504122, 679142, -1237488, 1127429, + 104690, -556735, 475668, 113280, 492848, -857383, 1840930, -289910, -617402, 3110093, + -1213865, 171799, -1926830, 481573, 800475, -457414, -360240, -245350, 919660, -140660, + 579284, -946503, -329639, 151398, 410169, -199179, -111669, 513785, -378494, 433255, + 397284, -135291, -178778, 149787, 45097, 90731, -59593, 275952, 6979, 366683, + -90194, -412317, -168577, 18254, 254477, -140660, 56371, 226560, -1074, 114890, + 49929, 280784, 3221, -26307, -51003, -67109, 66572, -73014, -128312, 160524, + 10737, -8590, 36507, -80531, 168577, -81068, + }, + { + 1142998, -559420, -2865817, -198105, -146029, 117575, 1078037, 328028, 862752, 544387, + -637803, -593242, 1715303, 768262, 6021544, -7410429, -4909148, 23011898, -22001506, 1149441, + 1023813, -2033130, -3054796, -1765768, -1137630, 919660, 1407676, 3518652, 438087, 2113661, + -1517197, 1291175, -730144, 2805688, 1043140, -1223529, -143345, 1328219, 3008625, 1806034, + -1224066, -133681, -1226213, -472446, 732292, 293132, -1589138, 645319, -628676, 1092532, + -1020055, -501437, 930397, -650151, 416612, -213675, 822486, 238371, -167504, 461172, + 361851, -421981, -269509, 808528, 136365, -120796, -106300, 329102, 35970, -69256, + -73551, 246424, -178778, 452045, 93952, 290984, -88047, 402116, 228707, -173409, + 97711, 3758, -44560, -31139, -41876, -191126, 162672, -129386, 67646, 209917, + -102542, 126702, 4295, 537, -103616, 26307, + }, + { + -15321759, 269466784, -16434692, -4959614, 4298726, -399969, -259846, 1568737, 1854889, -344134, + 1586990, -604517, 440234, -761820, 3055869, -610422, -5362267, 911070, 1584843, -479963, + 1668058, -545461, 901406, -1024350, 976031, -889058, 90194, 2684, -570157, 669478, + 1205275, -1638530, -1473711, 910533, 475131, 1344325, 263604, -23085, 1459215, 482110, + 2836826, -461172, 492848, -861678, -3619047, 608275, -1926830, 2059974, -685047, -25233, + 956704, -663572, 1276679, -51003, 450435, -333397, -78920, -541166, 389768, -127775, + -666257, 921271, 281320, 13959, -294205, 199716, 92879, -83215, 27380, -322123, + 244276, -175557, 354872, 35970, -217433, -53150, -15569, -105764, 35433, 325881, + -88047, 114890, -55298, 164819, -111669, 247497, -120796, -95026, 76773, -58519, + -59056, -217433, 105227, -174483, 127775, -25770, + }, + { + -293132, 8510478, 2100239, 1056025, 206158, 67646, 763967, 246424, -459025, 45097, + -6979, 318364, 1176821, 3953518, 11051488, 2803003, 822486, -3366718, 4357245, 3786014, + 2375117, -3952981, 5333813, 4446365, -432718, -109522, 2332704, -615254, -3335579, 287226, + -387084, 2996814, 859530, 2147, -596464, -784368, 1003949, 303869, 81604, 705985, + -1102196, -1081795, 1366337, 212601, -1552094, -207769, 72478, -81068, 338229, -1291711, + 499827, 37044, 213138, 389231, -108448, 1103270, -698469, 120796, 499290, -288300, + 155693, -333397, -250719, 355945, 324807, -733903, 166430, 139586, -101469, 321049, + 31139, -46171, 164283, 185757, 99321, -199179, 90194, -87510, 62277, 121870, + -300648, -98784, 212601, -147640, 35970, 30602, 95563, -71404, 15032, -107374, + -183073, -20401, -33286, -49392, 38118, 33823, + }, + { + 4777078, -186416608, 31012886, 3188476, 3581466, 620623, -988916, 1124208, 240518, -31675, + 2352032, -1982664, -300111, -3304977, 2558190, 818728, -815507, -5369, 1386738, 591095, + -3133179, 1044751, 1654636, 2392834, 696322, -988916, 1414655, -313533, -321586, 876173, + -452045, -1533840, 1913408, -2842732, 1160178, 3336653, -670552, 1733556, -125091, 2970507, + -1692754, -449361, -1384053, 213675, 1528472, -146029, 455803, -1090922, 617402, 638876, + 113280, -35433, 1229971, -957778, 807454, 536334, -586800, -253940, -266288, 452045, + -712428, 40802, -21475, -175557, 613643, 207769, -320512, 279710, 63888, -243739, + -160524, 118648, 903017, 216359, -70867, -242666, 256624, 184684, 69256, -174483, + 333397, -101469, 155693, -98247, -26844, 28991, -23085, 90194, -177704, 141197, + 48855, 22549, -163746, 185757, -181999, -51003, + }, + { + -207232, 8127152, -7565048, -2545842, -81068, -61203, 619012, 784905, -70330, -78383, + -486942, 122407, 1910187, -3208878, -9310952, 25233, -5782100, 9809705, -5870147, -215822, + -2207076, 2646237, -487479, -137439, -1124208, 2422899, 1557999, -690416, -668404, 1047435, + -1030255, -1591285, 818191, -1428077, -984084, 153545, -2045478, -847719, -231391, 1264331, + -1042066, -775242, -124017, 552977, -1498407, -577136, -681289, -652298, 1219234, -1065689, + 317291, -83215, 125091, -205085, -359167, -206158, -301185, 1081258, 380641, -358093, + 419833, -758062, -186831, 82141, 460098, -224412, 81604, -363998, 179315, 657667, + 165356, 186831, 59593, -145492, 226560, -195958, 144418, 176631, 41339, 77309, + -6979, -422517, 172872, -93952, 118112, -55298, 187368, -72478, -68183, 24159, + 4295, -182536, 93952, -62277, 180389, -8053, + }, + { + -10336376, 26012470, -6486475, -3463891, 2806224, 2924873, 4871030, 1088774, -491237, 2950106, + 214212, -2973191, -892816, -218506, 1375463, -1043140, 8009577, 2654827, -914828, 90194, + -1709397, -906775, 3083787, 1442035, 1066763, 2152316, -188442, -1797981, 1577327, 1056562, + 1029718, 2190970, 1737314, -2423435, 74088, 1377074, -1861332, 581968, 1458141, -369367, + 544387, -958851, 434865, -765578, -576599, 99321, 450972, -452582, -1563905, 879395, + -774168, 369904, 183073, -346282, -47245, 646929, -201327, -98784, -239444, 293668, + 477815, -102005, 92879, 191663, -434865, 545461, -525597, 80531, 98784, 22012, + 240518, 99321, 86436, 59593, 79457, -167504, 140123, -122407, 249645, -56371, + -194884, 28454, 114890, 30602, -33823, 137976, 63351, -44023, 25770, 107911, + -147103, -47245, -10201, -45634, 43487, -26844, + }, + { + 246961, 5611912, -2697240, -2069637, 1749662, -377420, 1915019, 1202054, -93416, -1722819, + 2483028, -2052458, -2121714, 8898098, -4349192, 2168959, 2457795, 605054, 3144990, -3378529, + 3410741, 2424509, 3126736, 761283, -2096481, 1176284, 742493, 2797634, 517544, 455267, + -2011655, -3707631, 3435974, -1308891, -1860795, -2626909, -2829310, 1225676, -561030, -679142, + -1286880, -410169, 1926293, -770410, -329639, 254477, -1694902, 742493, 350577, 258235, + -360777, 97711, 81068, 303869, 1136019, -173409, -578210, -258235, -396211, 263604, + 943282, -480499, -151398, 305480, -83752, 17180, 393526, 123480, -169651, 440771, + -207769, -202400, -65498, 148713, -186831, -169651, 48318, -3758, 57982, 37044, + -70330, -119722, 105227, -214748, 12885, 43487, -178241, 71941, -7516, 20401, + 107911, 1611, -99321, -10201, 43487, 37044, + }, + { + 9080098, -58520004, 3062849, -1701344, -1791001, -4600984, 3753265, -39192, -700080, 2505040, + -3226057, 3712462, -2844879, -5111011, 927713, 1240709, 1020592, 2197413, 1167157, -1190780, + 60130, -2192581, 107374, 201863, 180926, 2111513, 939524, -446677, -1278290, 766115, + -76773, -125628, 497142, 135291, 91268, -1296006, 1301912, 13959, 957778, -830002, + 567473, -176094, -281320, -1209570, 1997697, -636192, 105764, -28454, 1498944, -129923, + -481036, -550293, 35970, 501437, -249108, 1391033, -85899, 33286, -233539, 411243, + -395674, 56908, 19864, 47782, 73551, -18790, -13959, -325881, 172336, 44560, + -32212, 97174, 214748, 128312, 24159, 30602, 130460, 146029, -142808, 222801, + 2684, -13422, -34360, 106837, -122407, 44560, -129923, -120796, 99858, -98247, + -6979, 50466, 57982, -87510, -33286, 81604, + }, + { + 542240, -7679939, -4013647, 338229, -1650878, 213138, 339839, -663572, 1716376, -297963, + 1277216, 2179696, -11708618, 29821568, -6635188, -4295504, 2689723, 175020, -1453310, 2058363, + 1984275, -3768834, 8977555, -840740, -2471217, 2631204, 1813550, -4074313, -1187022, 553514, + -2456721, 1076426, -1154809, -811749, -1262184, 161061, 38118, 803696, 511101, -492311, + 2444910, 814970, -1603097, 16106, -1996623, 402653, 787590, 518617, -384936, -973884, + -24159, -717796, -415001, -721018, 580894, -563714, -65498, -332860, 409633, -491237, + 380641, -467615, -522375, -187368, -484258, -56371, 213138, -343597, -645319, 63888, + 11811, 37044, 358630, 42950, -91268, -141734, -84826, -63888, -142808, 56371, + -17180, -226560, -129923, 76773, -16106, 46171, 57445, -153545, 221191, -49392, + 86436, 139586, -11811, 70867, 59593, -8053, + }, + { + -2728915, -54953032, 933082, 1498407, 1345399, 7738458, -6627135, -799938, 918049, -200790, + 3778498, 33286, 52613, 784368, -21100638, -2071785, 6031208, 2624762, -1901597, 3103651, + -1520955, 1044214, -1149441, 470836, -308164, 3221, 1030255, 1560684, 1442035, -1212791, + 1480153, -1198296, 631897, 128849, 118112, -424128, -299574, 817118, -357556, 8590, + 137439, 1509144, -423054, 281320, -1049046, -77846, -687195, -282394, 379568, 438624, + 112743, -702227, 1076963, 168041, -231391, 446140, -760746, 566936, -506806, 637266, + -515396, 148176, -491774, -406411, -186294, 38655, -83215, -79994, 156229, 261456, + -370978, 235149, -335007, -290984, 176094, -85899, 33823, -20938, 69793, -8590, + 31139, 133681, -266288, 112743, -142808, 314069, 224412, -53687, -169651, 81604, + -106837, 118112, 89657, 7516, 117038, -112743, + }, + { + -464393, -6464463, 1620276, -840740, -243739, -255551, -102005, -964757, -1478006, -2089502, + -1631014, -1285806, 2172180, -6696391, -46322832, 3498788, 5035313, -4495220, 3658239, 1643362, + 1458678, 898722, 2986076, -4527970, -476741, 2374580, -3849365, -159451, 811212, 2274722, + -729608, 1092532, -665720, 1962800, -1738925, 811749, -401579, -391916, 637803, 197032, + 1299765, -445066, 1088774, -875636, 537, -263604, -260919, -726386, -176094, 1099512, + -1258425, 301721, 92342, -1882269, 797790, 105764, 693637, -536871, -227096, 334471, + 241592, -466004, 89657, 359167, -51540, 79994, -10737, -161061, 456340, -136902, + -71941, -73014, -78920, 169651, -26844, -17717, -224412, -78920, -106837, 169651, + -208843, 85362, 98784, 9664, 4295, 143881, -88584, 11274, 36507, -118112, + -55835, 64961, -31675, 75699, -178778, -57982, + }, + }, + { + { + -10386305, -38035156, -2546916, -6651294, -3600256, -887985, -835908, -2153926, 887985, -499290, + -2794950, -1761474, 156766, -937914, 460098, 142808, 1477469, 150861, 934155, -4735739, + -1108102, 1065689, 440771, 779537, -263604, -280784, 2529736, 1247688, 286152, -406948, + -369904, -249108, -365072, -235149, -519154, 37581, 58519, -1227287, -280784, -238371, + 115964, -695785, 323196, 513785, 338766, 1290101, 1520418, 906238, -50466, -365072, + -537945, -387084, 127238, 442919, 264677, 274341, -9664, 725850, 368830, 102542, + -263067, -32212, 408559, 362925, -261456, 394063, -299037, 186831, 141734, 79994, + 121870, 51540, -104690, 176631, 49392, 19864, 14496, 124017, 86436, -198105, + -184684, -33286, 32749, -79457, -99858, 116501, -1074, -6979, -25233, -42413, + -22012, 66572, -57445, 38118, 74088, 39728, + }, + { + -1562831, -17983028, -4020626, -1478006, -3164854, -359704, -682363, -833224, -552977, -201327, + -45097, -665720, -1308354, 74088, 3042448, 1457605, 1034013, -1293322, 620623, -540092, + 1439351, -1826435, -231928, -869731, 1649804, 125628, -1042603, 162135, -2290828, -992137, + -1385127, 966905, -758599, -450972, 1195612, 1054951, 2120640, 1032403, 196495, 1165010, + -521302, -457414, -97174, 288837, 272730, 187905, -394600, -534187, -343597, -350577, + 61203, 247497, 257698, -149250, -308701, 560493, 183073, -124017, -268435, 301185, + 3758, -479426, 67109, -107911, -122407, 13959, 159988, 28991, 122943, 77309, + 97174, -44560, 62277, 11811, -270046, -114354, 76773, 32749, -87510, -163209, + 68183, 183073, 139050, 4832, -7516, -58519, -29528, 23085, -83215, -19327, + 56908, 30065, -12885, -61203, -42950, 21475, + }, + { + 6691559, 52292300, -5473936, -15159624, -4165582, -119185, -865973, -143881, 573378, 2682744, + -201327, -4393215, -784905, 1069447, 556735, -2812667, -133144, -3419331, -5475010, 81604, + -6421513, 648003, 220654, 1225676, 478352, -1021129, -838592, -851477, -2574296, -1146756, + 66572, 398358, -688805, -248034, -868657, 588411, -934155, -881542, -741419, -1263794, + -862215, 491237, 40802, 81604, -244813, -683437, -335007, -785442, -24696, 438624, + -13422, -661425, -661962, -211527, 249108, 650151, -223875, 180389, -196495, 202400, + -211527, -108985, 19864, -208843, -41876, -251256, -376347, -169114, -62277, -57445, + -229244, -174483, -384936, -41876, -69793, 145492, 311922, 41339, -151398, 146029, + 78920, 37044, -116501, -68719, -31675, -127238, 16643, -44023, 41876, 18790, + 103616, 69793, 104690, 12348, 51003, 34897, + }, + { + 12407624, 89098560, 15500537, 8785892, 1029718, 534187, -344134, -408022, -47245, 1065689, + 1341640, 956167, -907849, -2173254, -1176284, 474594, 2818036, 5554467, 1096290, 8590, + -213675, 2229088, 527744, 802085, 1353452, 1521492, -41339, 396211, -678068, -367757, + 244813, 682363, -486405, -142271, 37581, 366683, 272730, -120796, 281857, 1089848, + 234613, 170188, -1328219, -226023, 171799, -461172, 18254, -134218, 1089311, 398895, + -401579, -420370, -23085, -346282, -168577, 18790, 45634, 349503, 14496, 294205, + 170188, -332860, 117575, -16106, -21475, -144418, 187368, -17180, 108985, 201863, + -19327, -117038, 113280, 81604, -51003, -112206, 11811, 118648, 138513, 7516, + 110595, 114354, 83752, -41876, -45634, 24696, 65498, -76236, 38118, 2147, + -4832, -60130, 51540, 537, 11274, 57982, + }, + { + -1291711, -1812476, 1008780, -23085, -385473, 324270, 985158, 10201, 362388, 284542, + 420907, 392990, -981937, -1118302, 4138738, 640487, 2495376, -6709276, -514859, -674310, + 2381023, -2223719, -4545686, 540629, 1066763, 877247, 1098438, 1328219, 1239098, -592169, + 1003949, 1848983, 615254, -97174, -260382, -537, 221728, 1292785, 2268817, 1027571, + 119185, -1146756, -223338, -206158, 31139, -641561, -913754, -316217, -178778, 126702, + 124017, -251256, 18254, 129923, 37581, -120259, 515396, -125628, -271657, 460098, + 179852, 100395, -45097, 245350, -179852, -413391, 197032, 88047, 150861, -27380, + -200790, 268435, 174483, 55835, 147103, 126165, 154619, 169114, 73551, -60130, + -4832, 47245, 76773, -95026, -44023, -33823, -55835, 29528, 5369, 103079, + 45634, -36507, -3758, 10737, -9127, 19864, + }, + { + 28201292, 164564352, 19489488, -2960306, 1283658, 1060857, 232465, 156766, 1685238, -176631, + -1067836, 803159, 218506, 658204, 530428, -34360, -2258079, -224412, -146566, 542240, + 612570, -367757, 1278827, -347892, 278636, -842887, -159988, -78383, -746251, -25233, + 1425392, -1134945, 114354, -739271, 2059974, 820876, 586263, 11811, 845035, 1029718, + 858457, 15569, -522375, -1724966, -1200980, -559956, 203474, -78383, -91805, 548682, + 78920, 212064, 415001, 28454, 302258, -146566, -194347, -549756, 510564, 162672, + -337155, 377957, 48318, -29528, -209917, 57982, 24696, -14496, 167504, -278099, + -57445, -30065, 47782, -33286, 13959, -149787, -58519, 27917, 87510, 139586, + 11274, 162135, 121870, 105764, -10201, 2684, -1074, 4832, -52613, -12348, + -137976, -77309, 8590, -13422, 45634, -32212, + }, + { + 556198, 5025112, 2357400, 1250372, 1074, 169651, 670015, -20401, -261456, 145492, + -437550, 525597, 28454, 5031554, 9241696, 3591130, 1991254, -322659, 1596654, 7669201, + 2279554, -908922, 3329674, 3437048, -2229088, 1185411, 1836635, -1546188, -1739999, -653372, + 1286880, 744640, 359704, 1125281, -435939, 366146, -116501, 369904, 406411, -455267, + -372588, 125091, 261456, -605054, -547071, -199716, -122943, 199179, 88584, -535260, + 69256, 57445, 219043, -100932, 440234, 147103, 241592, -134218, 159451, 457414, + -40802, 178241, -91805, 314069, -98247, 78383, -90194, -185757, -87510, 398895, + 323196, -86436, -155693, 200790, -121333, -165356, 43487, 30065, -3758, -126702, + -171262, -74088, 96637, -6442, 18790, -41339, 83752, 40802, 19864, -83215, + -42413, 16643, -53150, -49392, 43487, 16106, + }, + { + -12950937, -105440376, -5204427, 3141769, 897111, 203474, -738734, 923955, 139586, 227096, + 594316, -730144, -370978, -1086627, -559420, 1063541, -745177, -544387, 653909, 802085, + -1503775, 432718, 0, 1933272, 950262, 19327, -116501, 651761, -886911, 99858, + -155693, 691490, 381178, -1619203, -505196, -3758, 416612, 1533840, 1268626, 188442, + -851477, -914291, -358630, 801548, 1061931, -324807, -190052, 650151, 62277, -289910, + 472983, -153545, 589484, 493921, -195421, 264677, -221191, -266825, 228170, -186294, + -154619, 22012, -309238, 80531, 513249, -14496, 20938, 47245, 73551, 144955, + 37044, 161598, 491774, 113280, -155693, -63351, 202937, 30602, 132070, 124554, + 62277, 119185, 69256, 42950, 19327, 43487, 10201, -125628, -106837, -5369, + 104690, 26307, -33823, 0, -89657, -100395, + }, + { + 974958, -3587908, -3367791, -319975, -705985, 171799, 542777, 489089, -2684, -590021, + -921271, 1246614, 229244, -955093, -6659347, -3337190, 1968706, 1004486, -621697, 1678259, + -2432562, 957778, 452582, 2388002, -1096290, 644782, -627065, 467078, 819265, -673773, + -2782602, -320512, 115964, 431644, -748935, -1535451, 53150, -1442572, -1022739, 746251, + -1069984, -621697, 172872, -1105954, -1218160, -163209, -589484, -130460, -409096, 512175, + 168041, -134218, 551903, -350040, -629213, -196495, -71404, 2684, 231391, -20938, + 168041, -15569, -264141, 233002, 554051, 340913, -214212, -68183, 104153, 280247, + 427886, 179852, 86973, 55298, -185220, -73014, 120796, 37581, 108448, 41876, + -9127, -92879, 142808, -7516, -57982, 48855, -60130, -148176, -68183, -16106, + 12348, -41876, 17180, -33286, 16643, -5906, + }, + { + 8521752, 11991549, -8935143, -2181307, 229781, 3811247, 4931696, 2001455, -878858, 745714, + 99858, -3234110, 466541, -1340030, -1451162, 1029718, 3168075, 3577708, -671626, 90194, + -1120450, 934155, 1784022, 1736777, 865973, 801011, 385473, -69793, -173409, 1471563, + 1765232, 2500208, 673236, -1330366, -1502702, 388695, -1141388, 937377, 617402, 597537, + -922881, -452045, -92342, -621697, -309775, -540629, -338229, -188442, -795643, -1010928, + 149787, 314606, -345745, -79457, 218506, 428423, 124017, 68719, -78383, 8590, + 374199, 236760, -16106, 41339, -200253, 46708, -61740, 85899, 98784, -58519, + -23622, 282931, 84826, 70867, -25233, -19327, 47245, 4832, 61203, 93952, + -11811, 26844, 46171, -44023, 12885, -24159, -52613, -6979, -60666, 25233, + -46708, -37044, 6979, -2684, -25233, -55835, + }, + { + -727997, -766115, -231928, 3014530, -475668, 90194, 1381906, 671089, 14496, -929860, + 863288, 702764, 1198296, 2377265, -1057099, 2969433, 1067836, -675921, 1220308, 1092532, + 2389613, 547608, 3138547, 597537, -913217, 756988, 402653, 680752, 328565, 436476, + -1548336, -75699, 617402, -149787, -2617246, -2456185, -630823, -379031, -230854, 74088, + -1089311, -105227, 178778, -457414, -28454, -588947, 53687, -209917, -271120, 440234, + -115964, 18254, 141197, 850940, 1002338, -177167, -385473, -140660, -380105, 227633, + 308701, -258772, 88584, 86436, 90194, -134218, 13422, -28454, 12885, 97711, + 69793, -219043, -133681, 78383, -222265, -106837, 148176, 192200, 92342, -55835, + -34897, -40265, -60666, -30065, 72478, -15569, -79994, 15032, 79994, 85362, + 55835, -8590, -45634, -57445, 34897, 8053, + }, + { + -9929428, -23024246, -3331284, -1228361, -2482491, 1537061, -716186, -590558, -284542, 1625645, + 1170379, -37044, -1074279, -1144609, -289910, 1567663, 663036, 1062468, 1250372, -198105, + -701153, -1386201, -724239, 6979, 1180042, 466541, 539555, -357556, -616865, 902480, + 1374926, -827318, -384400, 219043, -18790, 486405, 769336, 1370095, 876710, -129923, + -420907, 179315, -2062121, 796180, 762894, 47782, 454193, 16643, 438624, 26307, + -383863, 42413, -256624, 34360, 162135, 657130, 105227, -187905, 146566, 249108, + -76773, -9127, -22549, 35433, -67646, -57982, -18254, 115427, 66035, -115964, + 57982, 170725, 102005, 26307, -30065, 105764, 86436, 143881, 77309, 4832, + 81604, -9127, -61203, -15032, -48318, -37581, 49392, -127775, -30065, -82678, + -50466, 34897, -18254, 0, -46171, 7516, + }, + { + -442919, -6296422, -1962800, -2394444, -1560147, -159451, -698469, 91805, 401043, 1336272, + 424128, 381715, 7568269, -1747515, -1123671, -4061429, 232465, -288837, -61740, -140123, + 2595234, -3158949, 6418292, 1057636, 1797981, -1678795, -431644, -817118, -2999498, -631897, + -860067, 499290, -583579, -1034550, 846109, 256087, 797790, -460635, 315680, 456340, + 1119913, 282931, -938987, -38655, -836982, -746787, 230854, -233002, 189515, -361851, + -551366, -792958, -685584, -530965, 193274, -172872, -488016, 78920, 31139, -157840, + 578210, -364535, -753767, -553514, -201327, -94489, 88047, -350040, -259846, 34897, + -91268, 184684, -70867, 161061, 94489, -279173, -231928, -166967, 123480, -54761, + 58519, -62277, 10201, 158377, -59056, 10201, -63888, -87510, 91268, 108448, + 28991, 50466, -56908, 47782, 67109, 4832, + }, + { + -4954782, -40358732, -5492190, 2629057, 1809792, 1478543, -1079111, -12348, 859530, 385473, + 2652679, 289373, -241055, -6094022, -7178501, 1079111, -12885, 2139968, 1844689, -528818, + -412317, 886374, 279173, -1255741, -590558, -490163, 1251983, 1189706, 1076426, -1255204, + 537945, -750546, 314606, 1464047, -984084, 647466, 61740, 1117228, 227633, 301185, + -108985, 1318555, -308164, -162672, -196495, -461172, -108448, -683974, 246961, 302258, + 312996, -213138, 250182, 529355, 268435, 495532, -97711, -12348, -290984, -51003, + 214212, -242666, -327491, -5906, -18790, 57982, 139050, -28454, -25770, 97174, + 164819, -114890, -124017, -115427, -31675, 82678, -23085, 9127, 69256, 179852, + 91805, 19327, 10201, 119722, -5369, 108985, 115964, -19864, -100395, -32749, + 19327, 74625, 33823, 41339, 56908, -80531, + }, + { + 237834, -3848828, -1644436, 230854, -1306207, 285615, -172872, -712428, -1265942, -1042066, + -1495186, -600759, 2248416, -15369004, -30295088, -1999844, 2505577, -925029, -876173, 7165079, + 2663954, -1839320, -494995, -2107755, 744103, -352187, -1760937, 118648, 826781, 2647311, + -1423245, 622233, 196495, 93416, -878321, -291521, -482647, -505732, 852014, 787590, + -389231, -119185, 511101, -586263, 14496, 265751, -293668, 92342, -846645, -193810, + -102005, -317828, -257698, -533650, -2684, 202400, -43487, -490700, -86436, -6442, + -73014, -244813, 350577, -19864, 47782, 41876, -51003, 192737, 85899, 49392, + -78383, 11274, -64961, 110059, 6979, -84289, -60666, -185220, -96637, 63888, + 9664, 56371, 66035, 55298, 20938, 37581, -78920, -28454, 43487, -56908, + -54224, 46171, 11274, -70867, -88584, -80531, + }, + }, + { + { + 11484743, 7770133, 20168092, -4594542, 709743, 133144, 5369, -982474, 658741, -327491, + 941135, 776852, 476741, -722628, -504659, 117038, -97711, -1777043, 2758443, -2067490, + -306553, 525597, 211527, -266288, -221728, -355945, 1306207, -505196, -376883, 230854, + 411243, -688805, 370978, 150861, 14496, -554588, 187905, -244276, -146029, 511101, + 399432, -593242, -21475, -321049, -543850, 697395, -13422, 549756, 423591, -261456, + -209917, -231928, 95563, 223875, 97711, 142808, -78383, 452582, 146566, -97711, + -121870, -179315, 88584, 87510, -208843, 493921, -292595, 184147, 118112, 41876, + 15032, -62277, -11811, 33823, -69793, 67109, 78920, 133681, -100932, -74625, + -73551, 19864, 100395, 39192, -41876, 16643, 79994, -1611, -14496, -10737, + -3758, -39192, -10201, 19327, 13959, -37044, + }, + { + 1934346, -16189879, -1743220, 3030636, -363998, 255014, -270583, -61203, 228170, -401579, + 193274, -103616, -1009854, -1615445, 1859721, -2202245, -424665, 434865, 5582921, 1784022, + 835371, -1468879, -489626, -1331977, 275415, 208306, -1200980, 1096827, -862215, -1154809, + -661962, 832687, 391916, 872952, 523449, 767725, 242129, -591632, -99321, 532039, + -602369, 103079, -111669, 484258, 26844, 172336, 41876, 307090, -165356, -83752, + 272194, -31675, 8053, 40265, -13422, 253940, 92342, 42413, -197032, 1611, + -64425, -114354, 182536, 104690, -188442, -53150, 84289, 93416, 64961, -18790, + -43487, 149787, 216359, 148176, -147103, 107374, 125628, -15032, -86436, -166430, + 53687, 68183, -8053, -50466, -34360, -88047, -4295, 52076, -54761, 45634, + 47245, 15569, -80531, -37044, -11811, 46708, + }, + { + -5878737, 38694436, -3030100, -9038759, 2689723, 1060857, -523986, -44560, 5369, 807454, + -1646583, -1556926, -137976, -140123, 2935073, -1807644, 695785, 425739, -343597, 2557653, + -1022739, 2219961, -1295470, -7516, 163209, -1531156, -632971, 434865, -168041, 780610, + -200253, 519691, -170188, 382789, 507880, 324807, 249645, -67109, -417686, -82141, + -217970, 545998, 144955, -91268, -388158, -541166, 157303, -481036, -134218, 251792, + 30065, 97711, -188979, -147103, -1611, 382252, -299037, 230854, -213675, 238908, + -263604, -324270, 312996, 227096, 64425, -251256, -93952, 51003, 99858, 37044, + -21475, -37581, -246961, 153008, 98784, 90194, 18254, -117575, 65498, 165893, + -63351, 20938, -6442, -61740, -57982, -89121, 0, 59056, 30602, -10737, + 86436, 13422, 28454, 52076, 8053, -14496, + }, + { + -14889578, 30404074, -475668, 6350109, -361851, 302795, 177704, -155693, -68183, 1244467, + 1107028, -907849, 382789, -486942, 448287, 501437, -279173, 2474438, -272194, -445603, + -739271, 671089, -316754, 388158, -310311, -356482, -1399623, 872415, -224412, -305480, + -121870, -77309, -405874, 199716, -98247, 242129, -406411, 37044, -15569, 430034, + 333934, 292058, -338229, -293668, -370441, -99321, 628676, -242666, 628676, 38655, + -474594, 125628, 47245, -268435, -157303, 155693, 119185, 130997, 19327, 72478, + -87510, -330712, 194347, -95563, 91268, -95026, 48855, -27917, 15032, 77309, + 77309, 80531, 118112, 32749, -48318, -92879, -4832, 9127, 36507, -95563, + -6442, -55298, 44023, -53687, -48855, -17180, 0, 35970, 49392, -76773, + -16106, -27380, 27380, 3758, -11811, 68719, + }, + { + 937914, -644245, -1037235, 53687, 195958, -83215, 316754, -16643, -37044, 337155, + 639950, 421444, -1766842, -52076, 4318053, -235686, 993748, -10093710, 7726110, 360240, + 2186138, -72478, -1459215, 752156, -704912, -993748, -710280, 82141, 175557, -62814, + 485331, 681826, -338229, -551903, -999654, -864899, -71404, 379031, -90194, -87510, + 758062, -705448, 361314, 213138, -59593, -425739, -600759, -352187, 228707, -75699, + 570694, -1611, -376883, 335007, -69793, -89657, -54224, -232465, -33823, 175557, + -310311, -5369, 13422, 162672, -44560, -141734, 207769, -129386, -4832, 37581, + 73014, 138513, -47245, -202937, -40265, -84289, 82678, -21475, -38655, -26844, + -34897, -24159, -19327, -90194, 86973, 3221, -54224, 54761, -68719, 21475, + 16106, -92342, -3758, 51540, -14496, -1611, + }, + { + -28696288, 53993644, -3640522, -3054259, -397821, 396211, -457414, -192737, 190589, -704375, + -285615, 462246, 764504, 819265, -1127966, 755914, -83215, 83752, -325881, 96100, + -168041, -77846, 1148367, -134755, 376347, -350040, -481036, 343597, -887448, -346819, + 1027571, -98247, 537408, -2145873, 894427, -273804, 963146, 505196, 416075, 25770, + -842887, -152471, -23622, -200790, 757525, 334471, 747861, -326954, -177704, 136902, + -59593, 13422, -259846, -166430, 376883, -54761, 1074, -301721, 315143, 181462, + -208306, 45097, -121870, 33286, 133681, 18790, -53687, 74088, 156766, -27917, + 60130, 55835, -73551, -78920, 135828, -145492, 66572, 80531, 85362, 2147, + -61740, 112206, -27380, 1074, 23085, -63351, 35970, -20938, 24696, 8053, + -70330, -4832, 49392, 64425, 6979, -59593, + }, + { + 87510, 731755, 86436, 50466, -231391, -137439, 181462, -157840, 49929, 1074, + -373662, 306553, 804233, 45634, 1240172, 1839857, -415001, 190589, -1501628, 936303, + -781147, -2582886, -1147830, 1814087, -373125, 455267, -657130, 113817, -1200980, -515396, + 1370095, -343597, 53687, 718870, 254477, 811212, -36507, -90194, 79457, -341450, + 241592, 357556, 49929, -460098, -201327, 279710, 231391, 170188, 199179, 24159, + 274341, -53150, 63351, -109522, 72478, -336618, 142271, -209917, -193810, 318364, + 92342, 459025, -149787, 107374, -102005, 272194, -79994, -103079, -97711, 200253, + 90731, -93952, -69793, 143345, -126702, 30065, 21475, -65498, -41339, 1074, + 14496, 30602, 62814, -9664, -8053, -29528, 83215, 47245, 70330, 16106, + 53150, 20938, -20401, 41876, 23085, -20938, + }, + { + 13999446, -47897476, 2852932, 1740536, -504659, -79994, 58519, -507343, -63351, -42950, + -579284, 312996, 280247, 46708, 925029, 1068373, -328565, 620086, -313533, 471373, + -45634, -270583, -1086090, 644782, 592169, 466004, 40802, 667867, -436476, -424128, + -506269, 493384, -67646, -403190, -28454, -1315871, -401043, 146029, 16106, -60130, + 209917, -339839, -57445, 654983, 251792, -79994, -48318, 480499, -1059246, -866510, + 224949, -89657, 257161, 263604, -257161, 56908, -120259, -11811, 272730, -56908, + 9664, -208843, -387621, 129386, 289373, -255551, 6979, -60666, 39728, 143881, + -1074, 13422, 84289, -83215, -29528, 55298, -17180, -7516, 121333, 56371, + 18254, 62277, -52076, 34897, 35433, -5369, 20938, -23085, -10737, -19327, + 29528, -15032, -29528, -19327, 8590, -39192, + }, + { + 62277, -8417599, -867583, 731218, -104690, 245887, 144955, 44560, 116501, -20938, + -538482, 1156420, 83752, 2975339, 744640, -13959, 3491809, -1774358, -1058173, 3130494, + -732292, -1170916, 925565, 2180770, -588411, -83215, -2584497, 719944, 397821, -718333, + -1831804, 432718, 445603, 613643, 541703, -329639, 512712, -1181116, -576063, 59056, + -498753, 60666, 47245, -549219, -382252, 328028, 161061, 375273, -655519, 554588, + -32212, -386547, 220654, 96100, -40265, -10201, -98784, -322659, 167504, -63888, + 161061, 320512, -163209, 91805, 151934, 124017, -156766, -33286, 5906, -66572, + 56908, -51003, -63351, -66035, -66035, 63351, 79994, -20401, 44560, -45634, + 69256, 60666, 15032, 2684, -14496, 41876, -73014, 5906, -7516, -66035, + 20401, 30065, 0, -8590, -32212, -35970, + }, + { + -6302865, -1666447, 2161442, 102005, -658204, -3422552, -2270964, 1365263, -1679869, -446140, + 969052, -1762010, 1201517, -321586, -566936, 1090385, -1570884, -154082, -208843, -267899, + -1428614, 529892, 420907, -27917, -656056, 60666, 70867, -91268, -566936, 58519, + -772020, 114354, 199716, 276489, -315143, 792958, -457951, 525597, 180926, 24696, + -751082, -133681, 580357, -12885, -221191, -347892, -95026, 156229, -27917, -456877, + 261993, 118648, -371515, 106837, 245350, 111132, 110595, 175557, -49929, -156766, + -309775, 12885, -57445, 196495, -26844, -223338, -25770, 15569, -62814, 122407, + -141197, 21475, -115964, 177167, -53150, -11811, -28454, 125628, 22012, 130460, + 40265, 61740, -70330, -70330, -53687, -77846, 3221, 31139, -82678, -16643, + 16643, 55298, 20401, -27380, -31675, -39192, + }, + { + 647466, -1574106, -927176, 5281736, -337692, -441845, -277025, -184147, 371515, -603980, + 376883, 1461900, -696322, 901406, -2499134, 2083596, 382789, -4476430, -528818, 3076270, + -202400, -1638530, 1430224, -420370, -539555, 391916, 129386, -5906, 195958, 212064, + -339302, -82678, -846109, 87510, -309775, -24696, 745714, 98247, 233002, 341450, + -559420, 62277, -179852, -226560, 197032, -434865, 600759, 78383, -419833, 74088, + 146566, 63351, 11811, 419296, 282931, -130460, -166430, 9664, -39728, -35970, + -366146, 10737, 277025, -49929, 74625, -6979, -131533, -110595, 97711, -78920, + -1074, -63888, -109522, -18790, -61740, 83752, 53150, 79457, -23085, -15032, + -537, -33823, -98247, 45634, 60666, -33823, 35970, 41339, 17717, 2147, + 19864, 11274, -537, -19864, -12348, 16643, + }, + { + 5807870, 3173981, 672699, 325344, -2535105, 2422362, -942208, -227633, 4295, 565862, + 1289564, -811212, 914291, 1416802, -1245541, -1074, -513249, -803159, -35433, 486405, + -415538, -488016, -275952, -491774, 499827, -104153, -71404, 550293, -199716, 245350, + 585726, -117038, -309238, -323196, 456340, 695785, 306553, 427349, -336081, 422517, + -210990, 624918, -715112, 1385664, -15032, -23085, 506806, -84289, -42950, 96100, + 11811, 476741, -152471, 198105, -69793, 119722, -75162, -214212, 143881, -78383, + 19864, 275415, 39192, -66572, 52076, 13422, -11274, 171262, 105227, -243203, + 88584, 73551, -38118, -95026, -35433, 89657, -38118, 50466, -33286, -89121, + 17717, -60666, -32212, -66035, -27917, 58519, 54761, -43487, -1611, -42950, + -537, -26844, -2147, 38655, -38655, -25770, + }, + { + 206695, -3712999, 1144072, -1561758, -769336, 99321, -430034, -112743, -70330, 626528, + -551903, 1848983, 1547262, -14733885, -43487, -295816, 306016, 971736, 919123, -534723, + 619549, -6254546, 2827699, 507880, 3355980, -1468342, -656593, 73014, -775778, -190589, + 434329, 485868, 239444, -572841, 638876, 226560, 493921, -307090, -130997, 135828, + 393526, 193810, -255014, 847719, -72478, -344671, 179315, -419296, 191663, -373662, + -630823, -83215, 123480, 51003, 333934, -88584, -81604, 306016, -37044, -73014, + 392990, -199179, -222801, -125628, 100395, -24159, 159451, 40265, -99321, 157303, + -16106, 146029, -234613, 114354, 73014, -195958, -67646, -84289, 193810, -22549, + 107374, 20938, 34897, 66035, -101469, 79994, -63351, 31675, -35433, 23085, + -5369, -23622, -74625, 86436, -45097, -39192, + }, + { + 7443179, -15265924, -380105, -865436, -194884, -1287953, -977105, -721555, 684510, 846109, + 663572, 222265, 943282, 1459752, 5230734, 2731062, -3015604, 577673, 876173, -1722819, + -223338, 217433, 277025, -869194, 504122, -958315, -13422, -564788, 216359, -692027, + 421981, -1074, 13959, 700617, -1381369, 786516, -493921, 268972, -8053, 425202, + 461709, 695248, -504122, 233002, 239981, -221728, 212601, -353261, 272194, 3221, + 721555, 9664, -179852, 264141, 139050, 191663, 68719, -44023, -158377, -303869, + 271120, -86436, -61203, 135291, -96100, 27380, 153008, -13959, -75162, 44560, + 106837, 52613, -3221, 6979, -80531, 157303, -54224, -9127, 38655, 71404, + -56908, 17717, 100395, 5369, -34360, 26844, -75162, -37581, 8053, -48318, + 18254, 41876, -29528, 10201, -9664, -62277, + }, + { + -353798, -2388539, -370441, 1001801, -607738, 374199, 51003, -34360, 16106, 963146, + -118648, -153545, 625992, 5407364, 7639673, 3959423, 1321239, 613643, 844498, 5159330, + -897648, -1506997, 970126, -1637993, 264141, -175557, -235149, 738198, -44023, 931471, + -1352378, 674847, -263067, 234076, -194884, -823560, -156766, -345745, -318364, 465467, + -819265, -305480, -54761, -51540, 251792, 421444, -256087, 467078, -318364, -181462, + 328028, -69793, -60130, 58519, 19864, 204548, -68719, -179315, -16106, 32212, + 187368, -48318, 63351, -184147, 180389, 192200, 144418, -1074, -21475, 161598, + 121870, 47245, -43487, 69793, -47782, 170725, 11811, -67109, -37044, 73551, + 40802, 23085, 19864, -84289, -58519, -17180, -51540, -55298, 46708, 2147, + -22012, 52613, -18790, -71941, 29528, -9664, + }, + }, + { + { + -9538585, 61473332, 92342, -757525, 1265405, -427349, 162135, 995359, -450972, 339839, + 1058173, 283468, 88584, 239444, -419296, -734439, -101469, -383326, 945967, -386010, + -564788, 53150, -12348, -687732, -415001, -471373, 591632, -136902, -590021, 498753, + -504659, -527207, 287763, 512712, -223338, -245350, -34897, 103616, 130997, 655519, + 32212, -90731, 16106, -500901, -119722, 182536, 234613, 234076, -214212, 51540, + 119185, 73014, -201863, 40802, -140660, 251792, -22549, -49392, -114890, -112743, + 163746, -133681, -106300, -118112, -22012, 121870, 28454, 78920, -52613, -9127, + -3221, -68183, 55298, 11811, -79994, -52076, 66035, 103079, -45634, 103616, + 49392, 51540, 2684, 79994, 4832, -12348, 68719, 26307, 40802, 18790, + -10737, -51003, -5906, -9127, -11274, -12885, + }, + { + -761820, -15353971, 4461934, 2233383, 1597191, -128312, -301721, 515396, 3758, 258772, + -261456, 39192, -1087164, -966368, -321586, -1129576, -548145, -650688, 2459406, 3225521, + -1001264, -804233, -475131, -876173, -2114735, 1409286, -124554, 938987, -934155, -872952, + -571768, 168577, 1385127, 1030255, 299037, 547071, -591095, 321586, -104153, 254477, + -348966, 253940, 273804, 282394, 115427, 178241, 294742, 284542, -28991, 283468, + -66035, 84826, 3221, 396211, -41339, -253940, -46171, -21475, 40265, -38118, + -25233, 170188, 83215, 98784, -11274, -32749, -49929, 289910, 33823, -114354, + 65498, 221191, -15569, 62814, 90731, 131533, -27380, -63888, -45634, -35970, + 11274, -37581, -40265, -14496, -10201, 24696, 30602, -2684, 26307, 24696, + -41339, 11811, -5906, 50466, -1611, -10737, + }, + { + 3216931, 31268972, -9087077, 113280, -452045, 966905, 59593, -425202, -99321, -418759, + -1228361, 229781, -804770, 1033477, 1883880, -179315, -494995, 3221, 3118146, -663036, + 741956, 1113470, -1088774, -522375, 435402, -1131724, -297963, 489626, 257161, 1017907, + -441845, -956167, 1359357, 485868, 31675, 162135, 707059, -225486, -595390, -537408, + 323196, -25770, -61740, 141197, -223338, -132607, 16106, -115964, -38655, 219580, + -384936, 516470, -226023, 183610, 201327, -42950, 46171, 107374, -146566, -179852, + -21475, 28454, 277562, 127238, -78383, 21475, 5369, -19327, 69793, 45634, + 82678, -72478, 9664, 37044, 56908, 1074, -2147, -65498, 128312, 36507, + -17717, 48318, -20401, -92879, -23622, 44560, 2684, -6979, 7516, 46708, + -12348, -27917, -14496, 22549, -27380, 17717, + }, + { + 10899553, -11294690, 1690070, 4962835, 431107, 429497, 419833, -243739, 351650, 784368, + 150861, -992674, 1337882, -763967, 234613, -103079, 843424, 549756, -841277, -513785, + -370978, 161061, 77309, 6979, -714038, -778463, -1030792, 460635, -57982, 639950, + 40265, -671626, 294742, 9664, -166430, 341450, -302258, 96100, -122943, 172872, + 213675, 61740, 151398, -221191, -632971, 413927, 363998, 132607, 197032, -291521, + -77309, 167504, -171262, 15032, 64425, 63351, 203474, -30602, 109522, -141197, + 104690, -28991, 10201, -18790, 199179, -26844, 32212, 71941, -60666, 124017, + 29528, -13422, 13422, 3758, 55298, -91805, 68719, -52076, -13959, 4295, + 33286, -34360, -10201, -61203, -53150, -49929, -13959, 35970, -42413, -31139, + 24696, 22012, -34360, 42950, 11811, 26307, + }, + { + -675384, -200253, -588947, 296890, 327491, -274878, 41876, 879395, -518617, 229244, + 1085553, -188442, -84826, 1844152, 1754494, -2952790, -4243965, 3373697, 803159, 1446330, + -318901, 464930, 1236414, -1447941, -2354716, -622770, 33823, 895501, -1024887, 709743, + 194884, 561030, -929860, 260382, -666257, -357019, -389231, 14496, -314606, 282394, + 125628, 51003, 293668, 629750, -412854, -141197, -299037, -277025, 389231, 290984, + 205085, 71941, -332323, 374199, -48318, -150861, -197032, 65498, 16643, 93416, + -178241, -140123, -89121, 136902, 324270, 106837, 36507, -176094, 20401, 71941, + 89657, 2147, -112206, -139050, -32749, -115427, 81068, 24696, 67646, 22549, + -6979, -20401, -110059, -21475, 27917, 0, 17717, -38118, -13422, 25770, + 9127, -15032, -9127, 23085, -13422, 8053, + }, + { + 19914690, -25227028, 1344862, -2295123, -528818, -239981, 155693, 294742, -848256, 108448, + 1157494, 181999, 668404, -546535, -179315, 311922, 277025, -47245, -213675, 551903, + 264677, 63888, 512712, -137439, -145492, 281320, -789737, 534723, -783832, 13422, + 201327, 99858, -593242, -490163, -806380, 380105, 685047, 705448, -26844, 92879, + -11811, -109522, -472983, 300648, 805306, 629750, 45634, -5906, -184684, 286152, + -351650, -52076, -137976, 54761, 285615, -100932, 188979, 162135, 16106, -47782, + -155693, -69793, 227096, 147103, 111669, -126165, 29528, 160524, 35433, 163746, + 15032, 129923, -44023, -66035, 54224, -98784, 204011, -4295, 6979, -16106, + -53150, 10737, -129386, -35970, 32212, 30065, 26307, 31675, -13422, -30065, + -11811, 40265, 34897, 6979, -22549, -26844, + }, + { + -501974, 962610, 1431298, -653372, -120259, -65498, 135291, 114890, 112743, -285078, + 22549, 31675, 1291711, -2021319, -595927, 755914, -1309428, 466541, -624381, -2512019, + -989990, -1186485, -925029, -591632, 426276, 357556, -1974611, 629213, -971200, -377420, + 534187, -110059, -362925, 1068910, 444529, 642635, -1074, -555661, -143345, 297427, + 360777, -277025, 98247, -348966, -52076, 277562, 431107, 248034, 89121, 99858, + -20938, 74088, 96100, -161061, -107374, -105227, 32749, -136365, -222801, 71404, + 140660, 180926, -189515, -3221, 83215, 128312, -11811, 164819, -19864, -53687, + -73014, 47245, 116501, 37044, -12885, 108985, 27380, 88047, -22012, 35433, + 19327, 63351, 2147, -18254, 10201, 15032, 27917, -22549, 49929, -8053, + -28454, -33823, 13959, 51540, -13422, -27380, + }, + { + -11702175, -10211285, -2412161, 1237488, -464393, 48318, 235686, -950262, -165893, 96100, + -259846, 35433, 11811, 1118302, 559956, 1116155, -61740, 108985, -239444, 231391, + 315143, -518080, -200790, 396211, -318364, 827318, 714038, 196495, 222801, -723165, + 537, -505732, -105227, 275415, 296890, -382789, -20938, 153008, -319438, -41876, + 119185, -52076, 46171, -51003, -28454, 864899, -491774, -466541, -701690, -311922, + 216359, 135828, -90731, -211527, 190052, -78920, 14496, -9664, 193810, -5906, + -34897, -198642, 0, -19864, -109522, 537, -44023, -114354, 99321, 13422, + 58519, 20938, -51003, 44023, 55835, -54224, -8053, 140123, 8053, 20938, + 24696, 28991, -77309, 11274, 18790, -20938, 40802, 82141, -3758, -18254, + -4295, -49392, -6442, 45097, 23622, -24159, + }, + { + -912681, -2956011, 600759, -777389, 306553, 21475, -251256, 415001, 354335, 164283, + -26844, 102005, -133681, -368830, 6123013, -1546725, 714038, 871342, -527207, 1110786, + 414464, -1842541, 1684701, 1213865, 1235340, -2259153, -219580, 114354, -1137093, 108985, + -1068910, 194347, 636192, -73551, 779000, 189515, -110059, -685047, 62814, -644782, + 410169, 91268, -41339, 316217, 49929, 76773, 479963, -15569, 65498, -102542, + -294742, -270583, -19327, 110059, 193810, -103079, 163746, 1611, 154082, -137439, + -56908, 38118, 188979, -188979, -169651, -19864, -134218, -95563, -11811, 2147, + -73551, -181999, -35433, -82141, 157303, 18254, 31675, 44560, -7516, -4832, + -5369, 11274, -95563, -3758, 47245, 40265, 5369, 112206, 19327, -71404, + -2147, 48318, -15032, 27380, -23622, 13959, + }, + { + 3502546, -17054242, 5060545, -271657, -907849, -1371168, -4482872, -460635, -523449, -730681, + 1256278, -98247, 435939, -121333, 260919, 109522, -1774895, 1024350, -468151, -1478006, + -162135, 362388, 471373, -639950, 92879, -571231, 49929, -382789, 366683, -807454, + -253403, -462783, -286689, 937914, 459562, -119185, 247497, -180389, 264141, -294205, + 62814, 37581, 593242, -116501, -154082, 391916, 179852, -88047, 88047, 460098, + 2147, 4832, 180926, -92879, -99858, 195421, 183073, 65498, -75699, -141734, + -438624, -86973, 90194, 146566, 25770, -217433, -46171, -37581, -52076, 149250, + 39192, -128312, -76773, 158377, -33823, 19327, -26844, 61203, 59056, 24159, + -26844, 19327, 9664, -12885, -58519, 61203, 59593, 37581, 16106, -12348, + 20938, 36507, -27917, -41339, -9664, 42413, + }, + { + -354872, -1399086, 2925947, 1683090, 93416, 221728, -1167157, -228707, 60130, 741956, + -34360, 493921, -565862, -998043, 116501, -355409, -759672, -2242510, 475131, 2646237, + -2218351, -505196, 148176, -384936, 181462, 430570, 537408, 120259, 502511, -556735, + -311385, -745714, -417686, -700080, 954557, 564251, -402116, 293132, 60666, -49392, + -144955, -199716, 187368, 399432, -206158, -108985, 333934, -39728, -29528, -88584, + 287226, 34360, 53687, -129386, 20938, 61740, -38655, -120259, 138513, -158914, + -146029, 83752, 9127, -34897, 34897, 166430, -49929, 29528, 114354, -81604, + 9664, -39728, -81604, -45634, 54224, 30602, -98784, -98247, -43487, 52613, + -19327, 5906, -18790, -14496, -57445, -53150, 52613, 46171, -56371, -66035, + 44023, 18254, -26307, 7516, 9127, 11274, + }, + { + -1166084, 14136348, -993748, -341987, 82141, -337155, 122407, -327491, 462783, 287226, + -296890, -1334661, -118648, 1687922, -453119, 438624, -1563905, -1010391, -3758, 323733, + -636729, 287763, -122943, -117575, -630823, 520765, -145492, 1126355, -220117, 89657, + -134755, 328565, -474057, -602369, 467078, 233002, -221728, -387084, -406411, 572841, + 243203, -137976, 733903, 566399, 173946, -127238, 351114, -2684, -122943, 91805, + 345745, 280784, 156766, 138513, 100395, -45634, -47782, -233539, 175020, -272194, + 233002, -26844, 115427, 10737, 156766, -169114, -38118, 8590, 24159, -41876, + 111132, -47245, -36507, 20938, -19864, 57982, -34360, 14496, -95026, -71404, + -37581, 37044, -1611, -9664, -31139, 71404, -32212, 6442, -11811, 0, + 44023, 8053, 61203, -27380, -19864, 19327, + }, + { + 73014, -3241627, 686658, -1169842, 375273, -134218, 346282, -436476, 163746, -680752, + 331786, 2247879, -4679904, -4770098, 219580, 901406, -588411, 2236604, 169651, -183610, + -4159676, 515396, 911070, 323733, 2688113, 485331, -1915019, 983548, -651761, 804770, + -587874, 995359, -301721, -399969, 258772, -390305, 327491, 90194, 48855, 185757, + 255014, 299574, 175020, 327491, -208306, 104153, 377957, 130997, -474594, -189515, + -228707, 134218, 242666, 96100, 372588, 103079, 51003, 146566, -76236, -102542, + -168577, -45634, 139050, 46171, 31675, 73551, -8053, 60130, -38118, 71941, + 42413, -13422, 21475, -41339, 57445, -11811, 71941, -64425, 21475, 99858, + -11274, -56908, 3758, -70330, -73014, 23085, 22549, 74088, -63888, -16106, + -62814, 23622, 63888, 54224, -65498, 12348, + }, + { + -5312875, 3722126, 953483, -4857608, -188979, -1556926, -2535641, 370978, -474594, 1228361, + -214748, 764504, 405338, 1887101, 6515466, 124017, -1445793, 120796, -619549, -654446, + -195421, 212601, 369367, 438087, 599148, -667867, 0, -85362, -334471, -190052, + -197569, 497679, -462246, -595390, 48318, -215822, -372052, -246961, -340376, 388158, + 941672, 240518, 170725, -137976, -17717, -259846, -310311, 116501, -108985, 344671, + 486405, 237297, -92342, -17717, -59593, -79457, 3221, -31675, -23085, -119722, + -27380, -27380, 95026, -162672, -221191, -40802, -34897, 2147, 71941, -17717, + 31675, 38655, -19864, 107911, -98247, -29528, -39192, 50466, -29528, -76773, + -81604, -27917, 5369, -79457, 37044, -73014, -57982, 59056, 33286, -69793, + 27380, 28991, -44023, -22012, -19864, 2147, + }, + { + 474057, -3422552, -259309, 1017370, -191126, 28454, -225486, -34897, 45634, 1188632, + -406411, 885300, -1198833, 9064528, 10408853, 2892124, 809064, -179852, 2455648, 870805, + -626528, 724776, 165893, -1317481, -223338, 959388, -539555, 54761, 75699, -224949, + -245887, 26844, 174483, 73014, 274341, -552977, -66035, -14496, -595390, 69793, + -5906, 227633, -141734, 7516, 158377, 256624, -193810, -108985, 241055, 92342, + 61740, 221191, 258772, 17180, -33286, 227633, -100395, 148713, 56908, 271657, + 331786, -25770, -234076, 22549, 277025, 141734, 4832, -112206, 99858, 112743, + 100932, 23085, 138513, 12348, 12885, 178778, -26844, 22549, 6442, 116501, + -51003, -35433, -92879, -64961, 28991, -92879, 29528, -54224, -32212, 30065, + 8053, 7516, -31139, 4295, 17180, -32749, + }, + }, + { + { + 4958540, 59452012, -26463978, 251792, 4090420, -448287, 105764, 1644436, -207769, 238371, + 341450, 113280, 217433, -445603, -892279, -1126892, 3758, 321586, 197569, 242666, + -529892, -779537, -943819, 196495, -1074, -688805, 485331, -70867, -542240, 762357, + -662499, -486405, 182536, 460635, -217970, -312459, -338229, 344134, -63888, 513785, + 198642, 423591, 405338, -353798, 126165, -54761, 387621, -68719, -420907, 204011, + 84289, 89121, -281857, -97711, -224949, 115964, -181462, -193274, -276489, -126702, + 45097, -108985, -109522, -82141, 61203, 11274, 20401, 18254, -114890, 39728, + 108985, 40265, 35433, -68719, -134755, -83215, 9127, 16106, 30065, 84289, + 46171, 4832, -76236, 21475, -20401, 62814, -52613, -39728, 56371, 59593, + -11811, -6979, -30602, -37581, -20938, 6979, + }, + { + -223338, -16971564, 1843078, 381715, 744103, -468688, -964757, 794032, 39192, 98247, + -551903, 527744, -809601, -1572495, -2070174, 718333, 2201708, -392453, -3027415, -1359894, + -2702071, -616865, 512712, -425202, -1396401, 1496259, -383863, 181462, -580894, -191126, + -726386, -780073, 605590, 481036, 373662, 848793, -16643, 768799, 167504, 113817, + -117038, 232465, -355409, -384400, 366683, 180389, -113817, -116501, 153545, 308164, + -140660, 190589, -1611, 203474, -247497, -173946, -213675, -63351, 103616, 116501, + 60130, 87510, 35970, -37044, 18790, 62277, -33286, 151934, 7516, -5906, + 60666, -6979, -96100, -28991, 93952, 83215, -12885, 50466, 59056, -36507, + -14496, -7516, 15569, -6442, 39192, 67109, -10201, -32212, 35433, -46708, + -61203, 18790, 22549, 34360, -12348, -19864, + }, + { + -986769, 42009612, 5597416, 4808216, -233002, 260382, 219580, -15569, 384936, 615254, + 277025, 899796, -340376, -858993, -208306, 537408, 622770, 1424319, 2177549, -1409286, + -47782, 557272, -1169305, 178778, 1080184, -1022202, -431107, 397821, -198642, 732292, + -186831, -1096290, 670015, 353261, -404264, -220117, 281320, 518080, -289910, -992674, + 283468, 92879, -477278, 129386, 428423, -233002, -68719, 110595, 52613, 32212, + -454730, 425739, -263067, 331786, -18790, -153008, 340376, 104690, -195421, -317828, + -42413, 94489, 11811, -222265, -107374, 100932, 26844, -103616, -132607, -94489, + 23622, 41339, 68719, -55298, -17717, -54224, 113817, -7516, -26307, -21475, + -41339, 36507, -49392, -13959, 38655, 16106, 13959, -44023, -8053, 11811, + -89657, -44023, 19864, -19864, -39192, 26307, + }, + { + -3846143, -35816808, -2084133, 4117263, -271657, 278636, -30602, -248034, 247497, -213138, + -867047, -343061, 1775432, -522912, -176094, 109522, -51540, -581431, 69256, 139050, + -247497, 159988, -35970, -319438, -323733, -208843, 153008, 349503, -354335, 521839, + -117038, -642098, 298500, -135828, 195958, -118112, -328028, 176631, -111669, -63351, + -331249, 92342, 178778, -359167, -532576, 394063, -78383, 43487, 27917, -50466, + 145492, 42413, 77309, 22549, 246961, 2147, 56908, -78920, -92879, -153008, + 234076, 141197, 91268, 72478, 103616, -54761, 0, 14496, -13959, 79994, + -17180, -116501, 12885, 10201, 95026, -35433, 34360, -42413, 19327, 39728, + 56371, 2147, -46171, -3758, -22012, -34897, -3758, -45634, -12348, 32212, + 33286, -2147, -37581, 40265, 5369, -6442, + }, + { + 725313, -717260, -1693291, 521839, 43487, -186294, 236760, 699006, -666794, -19327, + 794032, 273804, 1065689, -679142, 1137630, -1602560, -3658239, 8845485, -3725347, 949725, + -232465, -420907, 219580, -1586454, -1639604, 865436, 1276142, 746787, -949725, 510027, + 132070, 357556, -891743, 309238, 454730, 617402, 116501, -82141, 1074, 723165, + 199179, 418222, -89657, 294742, -409633, 111669, 19864, -147640, 143881, 362388, + -206695, 90731, 49392, 202400, 195421, 129923, 4295, -44560, -93952, 157303, + -47782, -232465, -180926, 128312, 171799, -73551, -69793, -134755, 102542, 27917, + -62277, 21475, 15032, 58519, 63888, -77846, 64425, 89121, 83215, -42413, + -33286, -48318, -46171, 53687, -62277, -2147, 0, -52076, 33286, 38118, + 67109, 44023, -12348, 11811, 26844, 9664, + }, + { + -7559143, -64206540, 1686312, -1435056, 619012, -233002, 339839, -48855, -403190, 443992, + 461709, -365609, -123480, -1311039, 57982, -82141, -151934, 718333, -151398, 875636, + 819802, -728534, -141734, -543313, -407485, 70330, -270046, -17717, -749472, -209380, + -791348, -185757, -484794, 487479, -510027, 568546, 135828, 387084, 104690, 258772, + 477815, 230854, 87510, 67646, -32749, 158914, -111132, 218506, -94489, 651761, + -183073, 79994, 135291, 174483, -103079, -282931, 235686, 58519, -49392, -13959, + -19327, 31139, 139586, 84826, -6979, -111132, 64425, 38655, -30065, 54224, + -8053, 74088, 38118, 18254, 11274, -7516, 141734, -47782, 16643, 52076, + -50466, -22549, -69793, 62277, 33286, 66035, -23085, 45634, -69256, -14496, + 18254, 24696, -30602, -25233, 40265, 11274, + }, + { + 41876, 342524, -1474784, -1023276, -89657, 6442, 393526, 527744, 31139, -129386, + 83215, -255014, 1009317, -843961, -1024887, -3775276, -2522220, 899796, 562104, -1205812, + 140123, -638876, -1338419, -325344, 512175, -764504, -1239098, -271120, -1127966, -620086, + -505732, -523449, -1314797, 809064, -108448, -75162, -47245, -92342, -195958, 448287, + -93416, -832687, 345208, 250719, 209380, -159451, 248571, 162672, -119185, -41339, + -39728, 29528, -81604, -373662, -8053, 24696, -27380, -101469, 11274, 108448, + 56371, 34360, -214212, -39192, 105227, 94489, 183610, 278636, 0, -63888, + -2147, 98784, 36507, 62814, 107911, 75699, -7516, 78920, -5369, 6442, + 19327, 46171, 537, -26307, 21475, -22549, -45097, -40265, 2147, -33823, + -5906, 1611, 537, -23622, -4295, -3221, + }, + { + 8518531, 12212203, -4954782, 770947, 300111, 73014, -209380, 226023, 221728, 177167, + -51540, -687732, -28454, -85899, -1271847, 353261, -740882, -346819, 41876, 86436, + -111669, 23085, 93416, 454193, -841814, 303869, 332323, -521302, -144955, -256087, + 503048, -136902, 409633, 383326, 338766, 195958, 463320, 529355, -91268, -350040, + -66035, 408022, -11811, -702764, -293668, 497142, -329102, -345208, 36507, 341450, + 421981, 34897, -155156, -130460, 356482, 37044, -53150, -106300, 70330, -48855, + 69793, 56908, 295279, -6442, -232465, 62814, -34360, -10201, 57445, -30602, + 141197, 51003, 22549, 57445, -31675, -111132, 76236, 35433, -98784, -4832, + -46171, -4295, 19864, 38655, -15032, 8053, 44023, 6979, -11274, 22012, + 1611, -30602, 8590, 45634, -28454, -33823, + }, + { + 71941, 5179194, 3093987, -685047, 42413, -67646, -373662, 421444, 177704, 24159, + 24159, 286689, -540629, -1110786, 4890357, -4204236, -3034395, 1809792, 851477, 1125281, + 1201517, -938987, 1080721, 408022, 561030, -1925756, 1198833, 395137, -864362, 290447, + -849867, 129386, 1010391, 381178, 437550, -591095, 3221, 745177, 750009, -208306, + 461172, -317291, 137976, 445066, 123480, 199179, 359167, -306016, 241055, -20401, + -205085, -145492, -32749, -229244, -8590, -252866, 224412, 78383, -65498, -110595, + -8053, 26307, 298500, -207769, -10201, 157840, -29528, 27917, 55298, -17717, + -90731, -108448, 67109, 23622, 126165, -128849, -90731, -16106, -28454, 31675, + -46171, -31139, 37581, 43487, 10737, 16106, 32749, 62814, -14496, -11811, + 10737, -6442, -12885, 1074, 6442, 37581, + }, + { + -1112933, -19773492, 5193689, -1859184, 282931, 2699387, -152471, -776852, -15032, 196495, + 616328, -547608, 84289, -6979, -134218, -162135, -484258, 1841467, 187905, -837519, + 170725, 65498, 56908, -207769, 928250, -443455, -181462, -365072, 489089, -852551, + 411780, 9664, -698469, -25770, -32749, -470299, -32212, -253403, 347892, 194347, + 488016, -537, 243739, 103079, 244276, 460635, 215285, -35433, -17717, 417149, + -185220, -79994, 215822, -200253, -230318, 174483, 179852, 55835, -41339, 5369, + -77846, -139586, 49392, 38655, 17717, 34360, 2684, 11274, 66035, 61740, + 85899, -70867, -15569, 20401, -59593, -23622, -8590, -81068, 107374, -54224, + -57982, 24696, 74625, 18790, 34360, 66572, -7516, -3758, 27917, 17180, + 1611, 8590, 2684, -6979, 14496, 47245, + }, + { + 317828, -292595, 803159, -2331630, -91268, 419833, -907312, 246424, -154082, 941672, + -289373, -880468, 232465, 345208, 1407676, -1171452, -937377, -79457, 1196148, -53150, + -517007, 1223529, -115964, -54761, 518617, 930397, 440234, 34360, 794569, -98247, + -105227, -338766, 117575, -599685, 1000727, 394600, -643171, 258772, 27917, -8590, + -258772, 197032, 641561, 201327, -351114, -40265, 39728, -200253, 93416, -39728, + -8590, -183610, -79994, -393526, -18254, 4832, 66035, -67646, 96637, -94489, + 121870, 17180, -17717, 48318, 25233, 34897, 85362, 110059, -7516, -33823, + 69793, 31139, 60666, 39728, 26307, -49392, -84289, -91268, 55835, 12885, + -59056, 22549, -3758, -70867, -45097, -47782, -13959, 37044, -37581, -33823, + 42950, -3221, -16643, 6442, 32212, -28454, + }, + { + -1481227, 13782013, -255551, 964220, 1066226, -1409823, 1415729, 403190, 248034, -686658, + -1057099, 291521, -791348, 1396938, -319975, 168041, -331786, -441308, -179315, -197032, + -117575, 14496, -10201, 214748, -668941, 572304, -307627, 661962, 191126, 124554, + -13422, 403727, -175557, 89121, -187368, -237834, -153545, -507343, -165893, 301185, + 563714, -56371, 258772, -428423, 97174, -430034, -30065, -82678, -111669, 78920, + 170188, -200253, -56371, -218506, 41339, -77309, 78920, -249108, 48318, -165893, + 228707, -236760, -22012, -9127, 45634, -142808, 11274, -14496, -3221, 70867, + 41339, -24159, -10201, 20401, -21475, -5369, -17180, 8053, -63351, -22549, + -8053, 96637, -12348, 51540, 0, 10201, -4295, 13959, 6979, 24159, + 5906, 2147, 25770, -32212, 14496, 44560, + }, + { + -192200, -3782793, 1362578, -1025423, -529355, 406411, 60666, -312459, 585726, -922344, + 576063, 1612760, 3323231, 9587441, 1019518, -774705, -974958, 1404991, -1144072, -284005, + -3802657, 2213519, 1058710, -498216, 1156420, 1346472, -1387811, 1577327, -382252, 1786706, + -1369558, 240518, -881005, -534723, 423591, -156766, 530428, -31675, 145492, -226023, + 91268, 76773, -115427, -72478, -114354, 22012, 54761, 147640, -21475, 257161, + -69256, -61740, 126702, 100395, 317291, 136902, -52613, 81068, -106837, -178778, + 39728, 246961, 39192, -51540, -16643, 37044, -69256, -22012, 9127, 37044, + -28991, -128312, 51540, -112206, 101469, 50466, 110059, -15032, -70330, 53150, + -59056, -88047, 10737, -47782, -13422, -1611, 46708, 14496, -35433, -23622, + -88584, 40265, 37044, -27917, -18790, 45097, + }, + { + 1315334, 13368086, 2196339, -2783139, 362388, -404801, -2776160, 1053878, -346282, 386010, + -1103270, -249645, -522912, -3594351, -243203, 596464, 914828, 185757, -522912, -8053, + -38655, 308701, 177167, 853088, 972273, 122943, 472983, 593779, -352187, -485331, + -169114, 137439, -236223, -377957, 447750, -41876, 54224, -31675, -353798, 24696, + 338229, 341987, 140123, 6979, 286689, -258772, -255551, 417149, -428960, 247497, + 73551, 47782, -181462, -116501, -121870, -148713, -11811, 142808, 39192, 177167, + 87510, 57982, -54224, -186294, -30602, 19327, 33823, -59593, 39192, -86973, + 18254, -131533, -55298, 22012, -83752, -32749, 7516, 4832, -39192, -45097, + -47245, -66572, -54224, -56908, 16643, -41876, 60666, 54761, -18254, -48855, + -14496, -25770, -31139, -39728, 16106, 12885, + }, + { + -256087, -3570729, 1088237, 1098438, 81068, 47245, -180389, -30065, -100932, 977642, + -155156, 479963, -770947, -3524021, -13105019, -1723893, 544387, -267362, 1518808, -1605244, + 376347, 1923609, -952409, -496069, 828392, 359704, -1337882, -367220, 1074, -66035, + -79994, 408559, 613643, -148713, -255014, 25770, -221191, -465467, -392453, -180926, + 777389, 360777, -241055, -34360, 182536, -103079, -197569, -78920, 255014, -45634, + -170188, 270046, 303869, -150861, -65498, 68719, -172336, -22012, 52613, 242129, + 157840, -77846, -107374, 143345, 141197, -27380, -26307, 112743, 125091, -48318, + -61203, -63888, 54224, -25770, 2147, 6442, 26307, 54761, 11274, 19864, + -146029, -35433, -49929, 62277, 33286, -81604, 34360, -30065, -28991, 22549, + -10201, -9127, -4295, 12885, -23622, -42950, + }, + }, + { + { + -3366181, 17725330, 15316927, -652835, 804770, 1091459, -278099, 763430, 446677, -361851, + -842350, 758062, 950262, 706522, -3020973, -721018, 82678, 587337, -970126, 1639067, + -529355, -1046898, -413391, 61203, -307090, -136902, 768262, 34897, -449898, -90194, + -199179, 50466, -355409, 213138, -147640, 115964, -573915, 161598, -260919, 413927, + 645319, 381178, -111132, 178241, 18790, -81604, 524523, -373662, 28991, 95563, + -208306, -11274, 110595, 10737, -29528, -199716, 141734, -134218, -145492, 1074, + -243203, -50466, 57445, 49929, 34897, 74625, -68719, -71404, 5369, 38655, + 224412, -1074, 24159, -126702, -59056, -10737, -45097, 1611, 68719, -83752, + 26307, -59056, -74625, -4295, 18790, 35970, -99321, -30065, 8590, 4832, + 8590, 2147, -25233, -8053, -20938, -11811, + }, + { + 222801, -13282723, -2872796, -776852, -424128, 460635, -1388885, 264677, 6979, 294205, + -325344, 151398, -826781, -602906, -1842004, 920197, 1851131, 306553, -2742874, -1446330, + -875100, -830002, 302795, -297963, 153545, -204011, 494995, -1214402, -241592, 392990, + -1278290, -224949, -383326, 121333, 351650, 598611, 651761, 212601, 559420, -51003, + 197032, -353261, -463320, -260919, 240518, 72478, -102005, -147640, 429497, -124017, + -7516, 68719, -127238, -96100, -62814, 197032, -124017, -25770, 132607, 11811, + -166430, -56908, 90731, -38118, -45634, 67109, 11274, -76236, 75162, 24696, + 3221, -59056, 44023, 5369, 10201, 40265, 87510, 109522, 5369, -118648, + 48318, 18254, 44560, -20401, 24159, -32749, -43487, -1611, -20938, -30065, + 9127, 7516, -2147, -99858, -537, 31139, + }, + { + 423591, 48506824, 4428648, 2609730, -2400350, -218506, 332323, 623844, 43487, 415001, + 249645, 714575, 1418950, -2095407, -1418413, 568009, 258235, 1673427, 460635, -138513, + 794569, -70867, -100395, 608275, -256624, -1510218, -277562, 406948, 351650, -788663, + 562641, 260382, -297963, 340376, -138513, 265751, -819802, 812823, -332860, -288837, + 67646, 465467, -252329, -339839, 450972, -457951, -97174, -228707, 75699, 137976, + -357019, 133144, -183610, 461172, -330176, -140660, 25233, 137976, 33286, -182536, + -162672, 46708, -127238, -259309, -21475, 45097, -88584, -7516, -187368, -31675, + -86973, -13959, 18254, -2684, -103079, 75699, 179852, -20938, -137976, 27380, + -25770, -85362, -4295, 85899, -26307, -28991, -47782, 4832, 0, -20401, + -30602, 18790, 26307, -16106, 10737, -4832, + }, + { + -2281165, -39209832, 190589, 3272765, -987306, 256087, -205085, 229244, -268972, -178778, + -425739, 167504, 209380, 991601, 192200, 596464, 140660, -484794, -351650, 424665, + -186831, 26307, -51003, -130460, 149787, 3758, 212064, 192200, -212064, -551903, + -198105, -185220, -67109, -476205, 388158, -592169, 47245, 46171, 114354, -280784, + -136365, 176094, -17717, -402116, -119722, -176631, -217970, 155156, 200790, 74625, + -52613, 81604, 203474, -68183, 87510, 24696, -125628, -218506, 9127, 90731, + 1074, 33286, 56371, 79994, -139586, 70330, -134218, -46708, 124554, -79457, + -32212, 15569, 125628, -8590, 71941, -15032, -7516, -32212, 26307, -11811, + -19327, 7516, -50466, 48318, -42413, 18790, 4295, -37581, 53687, 13959, + -28454, -537, 1074, -12348, -2147, -5906, + }, + { + -693100, -2204392, 2406256, -244276, -235686, 252866, 196495, -105227, -404801, -199716, + 645856, 246961, 795106, 1494649, 630286, -1580011, 1415192, -486942, -1449015, 1170916, + 312996, 399969, -1084479, -170725, -797790, 1873143, -377957, 394600, 223338, -336081, + -59056, 873489, -421444, -501974, 914291, -49392, 621160, -475668, 466541, 754304, + -537, 378494, -392453, -42413, -212064, -116501, -68183, -161061, -102542, 220117, + -108985, 196495, 186831, 13422, 284542, 170188, 98784, -226560, -98247, 124554, + -30602, -263067, 35433, -40802, -207769, -167504, -80531, -41339, 90194, -15032, + -35970, 89657, 115427, 76773, 70867, -72478, 90731, -1074, -47245, -79994, + -107374, -43487, 80531, 7516, -84826, 10737, -42950, -9127, 53687, 18254, + 32749, 0, 9127, 56371, 5906, -26844, + }, + { + -2494302, -68554120, 2163590, -489089, -664646, 163209, -208843, -402116, 646393, -105227, + -1007170, -68183, -59593, -586263, -854699, 427349, 221728, 410169, 10201, 394600, + 191663, -1002875, -113280, -440771, -44560, 73551, 145492, -511638, -289373, -474594, + -821413, -15569, -1074, 270046, -12885, 292058, -236223, 419833, 351114, 342524, + 37581, 296890, -4295, -125091, -33823, 59593, 289910, 64425, 3221, 382789, + 64961, 42413, -89657, 201863, -190052, -132070, -95563, -204011, 157840, 127775, + 5906, 38655, -137439, 14496, -18790, -19327, -40802, -62277, 61740, -54761, + 46171, -39728, 69256, 52613, -33286, 77846, -5369, -10201, 93952, 70867, + 2147, 37581, 60130, 93952, -18254, 5369, -32212, -11274, -56371, 8053, + -1611, 10737, -46171, 44023, 35433, 22012, + }, + { + 278099, -3185792, -885300, -5906, -102005, 144955, 82141, 892279, -409633, 202400, + -228170, 221191, 594316, 953483, -2839510, -2104534, 1273995, -1042603, 777389, -38655, + -399969, 161598, -1939715, 90731, 1216013, -1906966, 918049, -1580011, -477278, -413391, + -1165547, 303869, -652298, 28454, -629750, -285615, 32749, 322123, -55835, -265214, + -326954, -42950, 110059, 551903, 219043, -417686, 78920, 264141, -163746, 89657, + -53687, -13959, -190052, -237297, -125091, -11274, -98247, 10201, -49929, 195421, + 165893, -19327, 4295, 33286, 33286, 76773, 162135, 64961, 22549, 102005, + 111132, -64425, -75699, 90194, 40802, 42950, -63351, -30602, -16643, -43487, + 25770, 18790, 34897, -26307, -12348, -39192, -21475, 31139, -2684, 30065, + 61203, 49929, -10201, -46171, 24159, 14496, + }, + { + -4775467, 21806086, 5585605, 361314, 478889, 266288, -300648, 341987, 566399, -170188, + -274341, -155693, 55835, -1539746, -1255741, 204548, -341450, -54761, 383326, -257698, + -257698, 340376, -410169, 299574, -49392, -93416, -1611, -743029, -95563, -374736, + 242129, 225486, 686658, 31675, 198105, -287763, 484258, 194347, 88584, -432718, + 76773, 148176, 413927, -566399, -455267, 164283, -113817, 48855, 282931, 172872, + 94489, -153008, 157840, 242129, 48318, 93952, -220117, -79457, 31139, 11274, + 151934, 102005, 183610, -26307, -133144, 39192, -89121, 114890, 7516, 78920, + 126702, 9664, 35970, -38118, -135828, 18790, 1611, -98784, 22549, -80531, + -31675, 24159, 48318, 38118, 28454, 17180, 33286, -56371, -27380, 12885, + -9664, 11274, -10201, -6979, -46171, -13959, + }, + { + 743029, 4154844, 26844, 227633, -281857, 112743, -161598, -30065, -183073, -23085, + 250182, 797253, 205622, -514322, 920734, -1821603, -1890323, 1251983, 1061394, 1224603, + -240518, 253940, 1247688, -241055, -836445, -358093, 988916, 20938, -683974, -564251, + 631360, -476741, 1234803, 853088, -136902, -515396, -117575, 715112, 568009, 10737, + -154619, -346819, 253940, 28454, -96637, 196495, 140660, -105764, -22012, 155156, + -38655, -12348, -8053, -409096, -136365, 125091, -48855, -99858, -217433, -537, + 75162, 222265, 115427, 24696, 224949, 234613, 159451, 48855, 54224, -537, + 2147, 13422, -10201, 19864, -70330, -118648, -95026, -32212, 537, 16106, + -18254, 35970, 138513, 46171, -29528, -16643, -46171, -60130, 5369, 44023, + -19327, -10737, -6979, -33823, -8053, -3758, + }, + { + -243203, -19477140, 622233, 931471, 734439, -561030, 4094178, -883690, -285615, -200253, + -20938, -595390, -557272, 227633, -243739, 137976, -888521, 1813550, -670015, 593779, + -78383, 70330, -639413, 393526, 435939, -133144, 16643, -372052, -246424, -292058, + 324807, 81604, -248571, -1478543, 377957, -175020, -115427, 60666, 271657, 296890, + 124554, -177704, 192200, 428423, -175020, -111669, 217433, 40265, -37044, -130997, + -179315, -91805, -90731, -107374, 2684, 176094, 70330, 102005, 56908, -67109, + 153545, -134755, 11811, -19327, 11811, 25770, 11811, 41339, 55298, -71941, + 42950, 61740, 17717, -77846, -38655, -53150, 12348, -66035, 30602, -6442, + 49392, 27380, 9664, -25770, 56908, -63888, -89121, -21475, -50466, 20401, + 10737, 1611, 44560, 26307, -8053, -27917, + }, + { + -395137, 2467996, -2856153, -171262, -380105, 368293, 248034, -440771, -292595, -333934, + 141197, 55298, 337692, -271657, 2105071, -587874, -552977, -67646, -411780, -163746, + 1119913, 998043, -408022, 82678, 824097, 411243, 418759, -359167, 683437, 847182, + -215822, 39728, 126702, -482110, 542777, 2684, 237834, 243203, 33286, 100395, + -371515, 251256, 706522, -320512, 33823, 97711, -307627, -135291, -125091, -21475, + -144955, -201327, -36507, -59593, 120259, 17180, 17180, -76236, -116501, -4295, + 62814, -106837, 199179, 78920, -17180, -132607, 52076, 18790, -86436, 5369, + 125091, 44560, 135828, -19327, -42950, -41876, 57982, 31139, 91805, -12348, + -45634, -46708, -55298, 29528, 22549, -34360, 12885, -5369, 26307, 33823, + 4832, 4832, 7516, -11274, 9664, -17717, + }, + { + 2195265, 9210557, 1816234, -163209, -652298, -658204, 1123671, 1113470, 348429, 65498, + -363462, 83215, 995359, -689879, 44023, -35970, 412854, 60130, -264141, -411243, + -92879, -507343, 24159, 616865, -143345, 153008, -363998, 138513, 486942, -235149, + 236223, 299574, 333934, 318901, -319975, -66035, 318901, 56371, 278099, -168041, + 293132, 310848, -151398, -595390, 109522, -264677, -18254, -88584, -195421, 61203, + -282394, -103616, -177167, -216359, -44560, -63351, -2147, 33823, 6979, -4832, + -83215, -71941, -41876, -78383, -128849, 97174, 80531, 51540, 17717, -2147, + -4832, 46708, 4295, -26307, -77846, -12348, -4295, -4832, 46708, -17717, + -24696, -6979, 39192, 32212, -24696, -20938, 30602, 1074, 37044, -12348, + -46708, -30602, -52076, 20401, 23085, 13959, + }, + { + 159451, -2771865, -314069, -721555, -526670, -209917, -85362, -22549, 576599, -557809, + 257698, 479426, 4819490, 12750147, -4400731, -137439, -491774, -422517, -1185411, -651761, + 391916, 238908, -406411, -397821, -213675, 562641, 455803, 273804, 309775, 820876, + -1173063, 281857, -746251, -98247, 120796, 892279, -13959, -251256, 391379, -470299, + -124017, 222265, -63351, -514322, 461709, -216896, -347355, -158914, 34360, 167504, + -55835, -348966, 166967, 102005, 67646, 149250, -136365, 215285, -113817, 33286, + 260919, 199716, -152471, -197569, -18254, 80531, -98784, 89121, 22549, -23622, + -74625, -13422, -49392, -63351, 38118, -22012, -89657, 41339, 38118, -14496, + -537, 69256, 54761, 17180, 16643, -10201, -9664, -24696, -37044, 8590, + -11274, -45634, -60130, -6979, 28454, -18790, + }, + { + 1982127, 14843407, -2486786, 1895691, 426276, 711354, -1653562, 959388, -43487, -361851, + -84289, -2419140, -12885, 527744, -5749351, 567473, 2863133, -529892, -491237, 291521, + -17717, -127775, -114354, 650151, 1015760, 398358, 96637, 443992, -676457, -362388, + -145492, -155156, 513785, 329639, -228170, 200253, 551366, 334471, -92342, -99321, + -277025, -39192, 363998, 31675, 707596, 24696, 70867, -51540, 9127, 54761, + -175020, 31675, -52613, -123480, -71404, 77846, 275952, 13422, -35970, 45634, + 202400, 123480, -119185, 77309, 104153, 129923, 62814, -20938, -23085, -18254, + 82678, -195958, -41876, -17717, 10201, 31139, 11274, -55835, 13422, 61203, + 17717, -57982, 14496, 28991, 11274, -5369, 33823, -18254, -59593, 17717, + -57982, -30602, 10737, -24159, 1074, -4832, + }, + { + 39192, -2292976, 144418, 332860, 530428, 103616, -184684, -403727, 551903, 380105, + 349503, 605590, -35433, -4687420, -18485540, -1934346, 1574106, 66572, 1324461, -1481764, + 1938104, 280784, -353261, 162672, 773631, 372052, -828929, -473520, -244276, 79994, + -230318, 671626, 242129, -310848, -631897, 468688, -924492, -532576, 260382, -652298, + 572304, -140660, -250719, 124554, 386547, -321049, 16106, 133681, 36507, -253940, + -157303, 117575, 76236, -57982, -23085, -54761, -289373, -166430, 61740, -177167, + -37044, -9127, 97174, 74625, 8053, -71404, 164283, 198642, 18254, -34360, + -61203, -97711, -81068, -10201, -75162, -15032, 95026, 9664, -8053, -107374, + -24696, 18790, 32212, 52076, -68183, -2684, -42413, -11811, 25770, 1074, + -6442, 11811, 2147, -22549, -26844, 3758, + }, + }, + { + { + 5842766, 4699768, 5328981, 1782948, 363462, 211527, -358093, -222265, -336081, -360240, + -457414, 501437, 475668, 407485, -2301566, 1079647, 297963, -215285, -1027034, 1891933, + -290447, -362925, 583042, -381178, -228707, 270046, 521839, -63351, -403190, -259309, + 287763, 38118, -603980, 501437, 421981, 173946, -598611, 76236, -177704, 329639, + 467078, -56371, -630286, 217970, 326954, 158914, 245350, -71941, 301721, -240518, + -220117, 77846, 373125, 282394, 230854, -72478, 220117, 127238, 188442, 59056, + -133144, 28991, 101469, 61740, 40802, 117575, -114890, -87510, 56908, 27917, + 97174, -110595, 73014, -22549, 25770, -42413, -72478, 59056, 8053, -107911, + 13422, 5369, -30065, -12348, 24159, -29528, 1611, -13959, -37581, -52613, + 13959, 8053, 20401, 23085, 2684, -12348, + }, + { + -69793, -3772055, 5218386, 191663, -660888, 462246, -1384590, -353261, -46171, 419296, + -400506, 22549, 186294, -18790, -1192927, 210453, -770947, -54224, 1206349, 1188632, + -20401, -931471, -64425, -208306, 738734, -398358, 460098, -388695, 102542, 698469, + -505196, -155156, -375810, 325344, -399969, -229244, -167504, -301185, 549219, 217970, + 335544, 37581, 121333, 18254, -73014, 537, 45634, 124017, 209380, -159451, + 58519, -160524, -25233, 95563, 249645, 117038, -205622, -120259, 124017, -62277, + -251792, -96100, 65498, 60130, -16643, 85899, 537, -48318, 72478, 32212, + -25770, -9127, 65498, 11274, -19327, 61203, 27380, 20938, -78920, -97711, + 116501, -537, 10201, -15569, -16106, -12348, 15032, -13959, -54761, 23085, + 30602, -3221, -13959, -85899, 11811, 27917, + }, + { + -491237, 41166188, -1089848, 874563, -337692, 415001, -27380, 388158, 150861, -319975, + -926639, 35970, 814433, -831613, 289373, -312459, -941672, 1066226, -90731, -1333051, + 732292, -57982, 452045, 403190, -599148, -1216550, 150324, 179315, 175557, -967441, + 545998, 0, -788663, 192737, -40265, 420907, -293132, 566936, -181462, 409096, + 267362, 271120, -49929, -36507, 223338, -468688, 139586, 45634, 204548, 197569, + -102005, 82141, -212601, 402653, -190052, 92342, -121333, 99858, 187368, 6979, + -137976, -31675, -25233, 37581, 5906, 16643, -98784, 70867, -38118, 88047, + -40802, -121870, -51540, 74625, -39192, 74625, 19327, -42950, -2684, 20401, + -46171, -91805, 22012, 82141, -30602, -42413, -54761, 27917, -4295, 12348, + -6979, 5369, -21475, 9127, -1074, -32212, + }, + { + 4787278, -29979946, -86436, 2945274, -1125818, 310848, -131533, 226023, -420907, 159988, + 25233, 162135, -643171, 525060, 1040456, 1064615, -368293, 401043, 734439, 547608, + -100932, -124554, 227633, 127238, 99321, 3221, -188979, 14496, -483721, 150861, + 147103, -306016, -128849, -841814, 140123, -631360, -317291, 353261, 227096, -60666, + 367220, 51540, -257698, -484258, -4295, -249645, -127238, 279710, 221191, -155693, + -71404, 64425, -41339, -144955, -222265, 35433, -28454, -229781, 59056, -47245, + -181462, -69793, -43487, -48318, -151934, 53687, -104690, 45634, 46171, -142271, + -5906, 79457, 68719, -54761, 40265, -61203, -19864, -61203, 3758, -4832, + 2684, 33823, 17717, 13422, -47782, 10201, -20401, 35433, 23085, -34897, + -41876, 24696, 2684, -27380, -1074, 8053, + }, + { + 429497, -4204773, -554588, -659814, -56371, 55298, -176631, -271120, -228170, -91268, + 364535, -302258, -18790, 77846, 703301, 579284, 372588, -5051956, 2115272, 689342, + 571231, 1056562, -1277216, 629213, -1187559, 814970, -1178432, 112206, 667331, 593242, + 99321, 830539, -217970, -724776, 17180, -555125, 477815, -555125, 215285, 404264, + -68719, 126702, -472983, 43487, -148713, -303869, -120796, 34897, 33286, 25770, + 216896, 302795, 104690, 185220, 132070, 83215, 105227, -128849, -9664, 91805, + 121870, -138513, 122943, -73551, -280247, -73014, 21475, 80531, 30602, -19864, + 102542, 75699, 63888, -43487, -2684, -126165, 88047, -22549, -86436, -33286, + -19327, 42950, 46708, -62277, -1611, 26307, 3758, 27917, 10201, -7516, + -3221, -23085, 12348, 46171, -30602, -7516, + }, + { + 6715718, -50121196, 5780489, -355945, -1292248, 127775, -448824, 392453, 729071, -529892, + -552977, 251792, 227633, -433792, -514322, 1778653, 464930, -281857, -73014, -235686, + -270046, -415001, 64425, -506806, 88047, 358093, -58519, 66035, 329102, 157303, + -293668, 176631, -204011, -266288, 214212, -163209, -401043, 65498, 93416, 337155, + -168577, 81068, -666257, -32212, 274878, 82141, 89121, -151934, -161598, 137976, + 63351, -287226, -292058, 68183, -63351, 46708, -96637, -221728, 88584, 53150, + -7516, 29528, -168577, 15569, 139050, 55835, -61203, -80531, -20938, -63888, + 66035, 29528, 31675, 9664, 25233, -2147, -33286, 30602, 76773, -12348, + 33286, 83215, 4295, -10737, -40265, -3758, 7516, -30602, 24159, 12348, + -5906, 4832, -5906, 85362, -16643, -6442, + }, + { + 134218, -3762928, 630286, 333934, -49392, -66572, -370978, 535797, -335544, 235149, + -148176, -19864, -23085, -261993, -2735357, 723165, 2506650, -823023, 1304596, 673773, + -792958, 418222, -1043677, 134218, 1236951, -710280, 1653562, -852014, -268435, 436476, + -409096, 925565, -47782, -521302, -296890, -24696, 139586, 473520, 129386, -258772, + 56371, 672162, 159451, 267362, 16643, -169651, 56908, -23622, -55835, 302795, + -216359, -121333, -70330, -33823, -143881, -110059, -56908, 158914, -167504, 84826, + 41339, -28454, 6979, 31675, -6979, 9664, -82141, -183073, -57982, 146029, + 27380, -150324, -46708, 20401, -54224, 44023, -117575, -42413, 38655, 3758, + -7516, -10737, 37581, -4295, -25770, 8053, 10737, 0, 13959, 31675, + 19864, 10737, -6442, 8053, 11811, -10737, + }, + { + 1801202, 21794812, -809064, 78383, -697932, 238371, 273804, -391916, 200253, -270046, + -218506, 685584, 178241, -526670, 93416, -27917, 62277, 507343, 98247, -244276, + 241592, 331249, -684510, 168577, 434329, -275952, -17180, -514859, 120259, -426276, + 100395, 69793, 410169, -129386, 111669, -332323, 395137, -96100, 218506, 5369, + 128849, -397284, 339302, -132070, -382252, 409633, -52076, 90731, -156229, -198105, + -47245, 2684, 14496, -62277, -30065, 120259, -141197, 71941, 185220, -3221, + 105227, -9664, -13422, 3758, 3221, 65498, -32212, 150861, -11274, 23085, + 46708, 1074, -43487, -61203, -16106, 73551, -71941, -34897, 87510, -96100, + -21475, 32212, -12348, -11274, 20938, -35433, 12348, 3758, -29528, 2147, + 19864, 23622, -5369, -1611, -5906, 20401, + }, + { + -93416, -1131187, -424128, 606664, -79457, 140660, -294742, -310311, -137439, 82678, + 54224, 350040, -120796, 847182, 1119913, -1234266, 52613, 173409, -276489, 766652, + -214212, -600222, 283468, 79457, 1002875, 245350, -1069984, 9127, -259846, -414464, + 1418413, -1024350, 355945, -59593, -500364, 417149, 30065, -215822, 409633, -299037, + -305480, -222265, -215285, -208306, -19864, 32212, 78920, 315680, -5906, 198642, + 58519, -44560, -81604, -253403, -24696, 186294, -106300, -129386, -4832, 217970, + 101469, 15569, -96100, 89657, 121333, 82141, 92342, -25233, 15032, 46171, + 68183, 7516, -41339, -42413, -86436, 18790, -19327, -56908, -25233, -3758, + 26844, 44023, 17180, 19327, -30602, -65498, -64961, -22549, 14496, 16643, + -28454, 22549, -10737, -41876, -43487, -17717, + }, + { + 1188095, -24677272, -6532109, 1099512, 706522, -2956011, 1604707, -591632, -246424, -479426, + -75162, -591095, -135828, 291521, -1328756, 455803, -810138, 437550, -825171, 781684, + -720481, 28454, -509491, 114354, -345208, -357019, 254477, -410169, -323733, 113817, + 108985, 227633, 454730, -905701, 710280, 143881, 125628, -48318, 212601, -33286, + -111669, -277025, 367757, 308701, -438624, -218506, 64425, -81604, -59056, -95563, + 50466, 56908, -48855, -28991, -59593, -30065, -6979, 39728, 32749, -61740, + 35433, 8053, 19864, -65498, 8590, -63351, 27917, 47245, -37581, -47245, + -6979, 6979, -23085, 4832, -30602, 15569, 19864, 37044, -54224, 11811, + 76236, 10201, -70330, -34360, -10201, -72478, -42950, 3758, -48855, 18254, + 20401, 11274, 1611, -9127, -20938, -31139, + }, + { + 288300, 4468377, -1628866, 2158758, 31675, -108448, 205085, -1150514, -555661, -333934, + 463856, 813896, -107911, -1045825, 319975, -401579, -588947, -445603, -1320166, 391379, + 462783, -53150, -84289, 349503, 70867, -681826, 337692, -707059, 523449, 507343, + -150861, -147103, -5906, -207232, 60130, -135291, 485868, 133144, -219043, -168577, + -292595, -98784, 214748, -289373, 186294, 137439, -129923, -64961, -107911, -102005, + -117575, 64961, 71941, 139050, 71941, 55835, 15569, -66035, -48855, 13422, + -118112, -44023, 199716, -26307, -34360, 25770, -2684, -20401, 17180, 28991, + 153008, 8053, 73014, 3221, 12348, 35433, 97174, 41876, -3758, -29528, + -3221, -6979, -55835, 71941, 32749, -35433, 38118, -11811, 24159, -10201, + -33286, 5369, 20401, -537, -24696, 11274, + }, + { + -2051384, 2142115, -797253, -1422171, -460098, 865973, 284005, 161061, 127775, 244276, + 617402, 55835, 937914, -1300301, 455803, -39192, 332323, 377420, -400506, -148176, + -208306, -205085, 143881, 397284, -369904, -94489, -503585, 128849, -51540, -266288, + -155156, -210453, 228707, -195421, -263067, 120796, 688805, 594853, 153008, -331249, + -156229, -40802, -85362, -204011, 181999, 24696, 7516, 20401, -83215, 82141, + -291521, 113817, -107374, 95026, -13422, -88584, -69256, 73551, 63888, -44023, + -159988, 88584, 76236, -73014, -43487, 117038, 83752, 76236, 37581, -86436, + 22012, 28454, 6979, -8590, -43487, 38655, -9664, 22012, 61203, -11811, + -25770, -59593, 38118, 12885, 2147, 39192, -6979, -20938, 4832, -46708, + -22012, -21475, -13959, 25770, -8590, -8053, + }, + { + -146029, -705985, 1015223, -919123, -192737, -199179, 104153, -337692, 566399, -231391, + -122943, 202400, -2693481, 1276679, -4266513, 2544768, 338766, 1098975, 268972, -17717, + 1809255, -1707786, -2177549, 167504, -49929, -347892, 163746, -332860, 301185, 169651, + -194347, 297427, -822486, -23622, 97174, 616328, -520765, -73014, 317291, -95563, + -118648, -82141, -242129, -552977, 333397, -286689, -474594, -95026, -72478, 189515, + 77846, -379031, 192737, 51003, -202937, 15032, -61740, 122943, 17180, 178778, + 105227, -53150, -96637, -18790, 57982, 30065, -105227, 110595, -49392, 61740, + 15032, 108448, -97711, -56908, -18790, -32749, -61740, 37581, 44023, -12348, + 45097, 60666, 9127, 3758, 2684, 8590, -46708, 13959, -20401, 60130, + 4295, -79994, -33823, 47782, -19864, -15032, + }, + { + -3231426, 9835475, -624381, 1867774, 159988, 1210107, 408559, 900333, -456340, 221191, + 511101, -1476932, 793495, 1411971, -4882841, 454193, 1716913, -206695, -373125, -377420, + -122943, -227096, -456340, -368830, 421444, -113817, 406411, 487479, -774705, 270583, + -32212, 326954, 856309, 217433, -447213, 510027, 437550, 127238, 28991, 45097, + -288837, -631360, 276489, -70330, 488016, -139586, -85362, -357556, -45634, -202400, + 13959, -107374, -70867, 98784, 98784, 2684, 119722, -148176, 17717, -223338, + 86436, 132070, -17717, 184147, 70867, 127775, 39728, 69793, -36507, 56371, + 81068, -50466, 34897, 19864, -16643, 30602, -5906, 25233, 44560, 48855, + 23085, -15569, 74088, 9127, 31139, -537, -54224, -22549, -9664, 23085, + -32749, 10201, 16106, 16106, -17717, 2147, + }, + { + -142808, -2066416, -601295, -321586, 129386, 29528, -66572, -49929, 781684, 564788, + 459562, 95563, -166967, 5590974, 209380, 715649, 349503, 53150, 1990181, -1350230, + -67109, -567473, 245350, -69256, 39192, 496606, 199716, -343061, -757525, -830002, + -491774, 355409, -653909, -3221, -13422, 54761, -552977, 143345, 299037, -497679, + 55835, -212601, -112206, 159451, 163746, -155693, 54224, 81068, -42950, -173946, + 73551, 18254, -81068, 125091, 75699, -91805, -285615, -137439, -78920, -304943, + -4295, 24159, 23622, 9664, 14496, -17717, 119185, 19327, 12348, 11274, + 3758, -60130, -37044, 20938, -67109, 78383, -28991, -22549, 11811, -29528, + 74088, 45097, 30065, -36507, -24159, 40265, -50466, -18254, 34360, -23085, + -12348, 24696, 12348, -14496, -1611, 12885, + }, + }, + { + { + -6917045, 33987148, -3126736, 2028835, 504122, -552977, 119722, -388695, -25770, -160524, + 468151, -317828, -367220, -460635, -273267, 789200, 315680, -651224, 391916, 630823, + -201327, -287763, 500901, -198642, -300111, 118648, 37044, 125091, -142271, -268972, + 38655, -62814, -4832, 506806, 139586, -242129, 248034, 303869, 31139, -142271, + 227096, -207769, -60666, 64961, 236760, 406411, -184147, -86973, 124554, -78920, + 116501, -55298, 290447, 136902, 126165, 142808, -45634, 56908, 106837, 40802, + 137976, 5369, -25233, -6442, -49392, 19327, 36507, 21475, -11274, -41339, + -31139, 0, 32749, 36507, -38118, -93952, -15032, 2147, 15032, 39728, + 38655, 78383, 7516, -9127, -11811, -30065, 62814, -28454, 24696, -29528, + 5369, 3758, 14496, 5369, 10737, 1611, + }, + { + 408022, 4048007, 62814, 1083406, 412854, -775778, -542240, -78920, 12885, -279710, + -1074, 181462, 172336, -618475, -261456, -927713, -1892470, -377957, 1829656, 641561, + 56908, -839666, -1347009, 110595, 261993, 702227, 45634, 45097, 570694, 367757, + -316754, -107374, 386010, 46171, -377957, -278636, -164283, 57982, 140660, 383326, + -103616, 438624, 436476, 161598, -25233, -66572, 137976, 38118, -537, 78383, + 87510, -135291, 223338, 213675, 100932, -285615, -113817, -122407, -8590, 70330, + -1611, -1074, -84826, 76236, 42413, -45097, 112743, 134218, 4832, -17180, + 72478, -1611, -27380, -12885, 43487, 41876, -78383, -52076, -43487, 47782, + 19327, -35970, 11274, 39728, -26844, 55298, 47245, -51003, 17180, 34897, + -45097, -12885, 27917, 20938, 34897, -30065, + }, + { + -151398, 23111220, 8017630, 3263102, 2166811, -353261, 212601, 195958, -221191, -497679, + -7516, -488553, -427349, 86973, 539555, -340376, 19327, 176631, -376347, -539018, + -31139, 439160, 188979, 77309, -383863, -230854, 248571, -225486, 18254, -295279, + -715649, 1611, 15569, 186294, -307090, 63351, 748398, -382252, 4832, 11274, + 293132, -121870, 348429, 151934, 304406, -35970, -93952, 226560, 173946, 2684, + 150324, -13422, 166967, -32212, 280247, 85899, -68719, 25770, 2684, 26844, + 22012, 33286, 119722, -55298, 23085, 125628, -52076, 1074, 62814, 67646, + -27380, -75699, 22012, 25770, 5369, -15569, -68183, 16106, 46708, -36507, + -28991, -22549, 45634, -13422, 20938, 12885, -2684, -24159, 6442, 12348, + -22549, -54224, -34897, 5369, -45097, -1611, + }, + { + -3411815, -14536854, -3791919, 1699196, 102542, -147103, 144418, 78383, -83752, -146029, + -574452, 237297, -642098, 610422, 756988, 391916, -94489, 720481, 73014, 53150, + 153545, -21475, 512712, -159988, -276489, -164283, -522912, 248034, -45097, 539018, + 290984, -517007, 275952, -570694, -292058, -140660, -569083, 328565, -20938, 136902, + 208306, -127238, -27380, -325881, -250719, 222265, 123480, 15032, 206158, -172336, + -19864, -81068, -112743, -24159, -139586, 140660, -55298, -63351, -40802, -149787, + -114354, 37581, -32749, -41339, 51540, -46708, 56908, 20938, -40265, -3758, + 0, -26307, -79994, -10737, -23085, -11811, -13422, -57445, 5369, 47782, + 76773, 53150, 21475, -41339, -28991, -45097, -537, 7516, -47245, -7516, + 21475, 35433, -18254, -6442, 8053, -3758, + }, + { + -284005, -6557878, 518080, 20401, 71941, -213138, -90194, -170188, 18790, 326954, + 3221, -349503, -2147, 877247, 1344862, -1719598, -3398393, 485868, 1680406, -206695, + 562104, 292595, -441845, 328028, -716723, -859530, -518080, 126702, 47782, 740345, + 746787, 308701, 49392, -190589, -255014, -197032, -68719, 74625, -35433, -27917, + 313533, -144418, 32749, -49392, -44023, -104153, -120259, 131533, 166430, 41876, + 482110, 76236, 142271, 156229, 106837, -35970, 51540, 54224, 108985, -42950, + 190589, -15569, 66572, -59593, 4295, 26307, 53150, 44560, -55835, 74625, + 64961, -52076, 5906, -37044, -91268, -1074, 65498, 13959, 38655, 29528, + 48318, 16106, -58519, -11274, 29528, 6442, 29528, -3221, 14496, 11274, + -16106, 32212, 18790, -30065, -11811, 28454, + }, + { + -5254893, -24915106, -3515431, -558883, -300111, -152471, 293668, 180926, -144955, 497142, + 558346, -53150, -195421, -457951, 37581, 1754494, 374199, -325344, 130997, -102542, + -57982, 211527, -481573, -630286, 154082, 551366, -220117, 121870, 369904, 134755, + -377957, -23622, -311385, -442919, 335007, -184684, 119185, -426276, 28454, 287763, + 240518, 122407, -759136, 68183, 199179, 133681, -204548, -144955, -177167, 38118, + -51540, -278636, -40802, 111669, 136365, 18254, 80531, 16106, -30065, -129923, + -9664, 28991, 3758, 119185, 147640, -37581, -3758, -11811, -77846, 33286, + 42950, 61203, 537, 22012, 31139, 5369, 37044, -4832, -33823, 2684, + 1611, -12885, -91268, -37044, 16643, 10737, 41339, 14496, 30065, -18790, + 1074, 6979, 26844, 16643, -26307, 3221, + }, + { + -352724, -1049583, 956704, -201327, -79457, -115427, -107911, 98784, 106300, -266825, + 116501, 164283, -351650, -1945083, -1576253, 762894, -57982, -399432, -641561, 744640, + 168577, 19327, 811749, -1291711, 263604, 290447, 213675, 494995, -985695, 149787, + 191663, 641561, 193274, -282931, 464930, -257698, 140660, 124554, 189515, -47782, + 326418, 246424, 321049, 100395, -148176, 265751, 70867, -227633, 80531, 4832, + -197569, -39192, -12348, -67646, -36507, -79994, 89121, 120259, -158914, -52076, + -20938, -47245, -86436, -8053, 17717, -105764, -47782, -66572, -2147, -28991, + -106837, -3758, 64961, 39728, -6979, 34360, -17717, 79994, 39192, 11811, + 13959, -537, 14496, -30602, 3221, 47782, -19864, -51540, 1611, -42950, + -68183, -38118, 20938, 31139, -22549, -13959, + }, + { + -1793149, 12440373, 5942624, 168041, 238371, 472983, 198105, -839666, -130460, 53150, + 329639, 178778, -408022, 890669, 439160, -405338, 439160, -375810, -445603, 253403, + 372588, 122943, 159451, -53687, -94489, -155156, 286689, -427886, 22549, -18254, + -74088, -70330, 60130, 295279, 25770, 503048, 188979, 342524, -93952, 99858, + 85362, -330176, 62277, -117575, -147640, 336618, -32212, -437013, -158914, 183610, + -132070, -42950, -296890, -153545, 135828, 66572, 125091, 51540, 189515, 7516, + 20401, -23622, -1611, 11811, 33823, 20401, 25233, 35970, 30602, -19864, + 24696, 27917, -56371, 63351, 106837, -28991, -17717, 60666, -3758, -29528, + -537, -59056, -17180, 0, -17717, -57982, 18254, 80531, -10737, 3221, + 12885, 12885, 40265, 25770, 16106, 537, + }, + { + -569083, -1356136, 3013457, -69256, 235686, -68183, -42413, -485331, 333397, -61203, + -38655, -56908, -351114, 1074279, 1145683, -2127620, -121333, -89121, -541703, 2070711, + -301185, -1376000, -140123, 1567126, 645856, 624918, -989453, 140123, -617938, 111669, + 237834, -96637, 279173, -896574, 126702, 567473, 19864, -403727, 221191, -179315, + 134755, -232465, -294205, 183610, 271120, -99858, 209380, 216359, 114354, 83752, + -3758, -151934, -128312, 3221, -33286, 29528, 10201, 109522, 145492, 107374, + 9127, -191126, -57445, -16106, -77309, -136902, -42413, 2147, 30065, 53150, + -31139, -40802, -92879, 13959, 73551, 18790, -36507, -1074, 9664, -39728, + 20401, -76236, -63888, 20401, -15032, -35970, 38655, 49929, 4295, -34897, + 10737, 17717, -10201, -24696, -24159, 22549, + }, + { + -2325188, -20565378, -4748623, -2065879, 558346, 457951, -3019899, 35433, -396211, 56908, + 71941, 191663, 60666, -803159, -471910, 14496, -299574, 251792, -161061, -282394, + -232465, -181462, -200790, -246961, -62277, -527207, -160524, -13422, 168577, 52076, + -28991, 60130, 446140, 89121, 502511, -41339, 189515, 113280, -113817, -129386, + 274341, 214748, 154082, -286152, 51540, 224949, 23622, 1611, 11274, 212064, + 121333, 162672, 121870, -52076, -281320, -70867, 95026, -130460, 4295, 9664, + -174483, 93952, 64961, -537, -47782, -40265, 10201, -24159, -12885, 55298, + 3758, -52613, -12885, 38655, 9127, 10201, 9127, 41876, -64961, 21475, + -8590, -22549, -17717, 5906, -2684, 43487, 51003, 23085, 33286, 15569, + 16106, 5369, -48318, -28991, 9664, 23085, + }, + { + -154619, 3354370, 1119913, 1173600, 290447, 328028, -456877, -1616518, 133681, 181999, + 287763, 381178, -226560, -565862, -1196148, -467078, 418222, -1279363, -803696, 773094, + -1293322, -96100, 989453, 88047, -253940, -88047, -52613, -206695, 192200, -426276, + -83215, -243739, -94489, 39728, 15569, -78920, -13422, -63351, -192737, -314606, + -261993, -3221, -33286, 136365, 63351, -49929, -25233, -63888, -12348, 147640, + 64961, 103616, -71404, -85899, -195958, 180389, -34360, 11274, 65498, -57982, + -22549, 99321, -33823, -69793, 52076, 161061, -9664, 108448, 88584, 30065, + 75699, 22012, 2147, 24159, 60666, 29528, 2684, -81068, -44023, 9664, + -31139, 22549, 41339, -24159, -41339, -17717, 0, -5369, -25233, -62814, + -22012, 10201, 8053, 9127, -6979, 15569, + }, + { + 1717450, -2412161, -3391951, -1019518, 727460, -291521, -522912, 843424, -184147, 577673, + 95563, -564788, -208306, -442382, 442382, -240518, 418222, -85899, 38655, 79457, + -357556, 340376, 266288, -321049, -342524, -95563, 437013, -86436, -350040, -420370, + -369367, -131533, -178241, -421444, -2684, 116501, -183610, 48318, -59056, 49392, + -11274, -194884, 13422, 48855, 38655, 187368, -214212, 57445, 164283, -31675, + 112743, 60130, 139586, 83215, -112743, 14496, -78920, -59593, 31675, -107374, + -23622, 34360, 11274, 55298, 63351, -51003, 12885, 19864, -11811, 16106, + 72478, -81068, 50466, 16106, 17717, 27917, -32749, 10201, 12348, -6442, + -11811, 21475, 24696, 1074, 47782, 31139, -54224, 16643, -26307, -2147, + 29528, 9664, 49392, -11274, -9664, 6442, + }, + { + 191663, 1886564, -1901060, -615254, 220654, 214212, 204011, -523449, 357019, -20401, + -2147, 374736, 816581, -6958921, 1187559, 1542430, 169651, 1614371, -325881, 850940, + -361314, -715112, -770410, -55298, -134755, 970663, -101469, -1055488, 229781, 386547, + 565325, 208306, -1255741, -284542, 3221, 267362, -446140, 88047, 82141, 289373, + -15032, -121870, -311922, -240518, -155156, 52613, 22012, -5906, -200790, 114354, + 270583, -4832, 89121, -10737, -7516, -11274, 98247, -146566, 83752, -14496, + -145492, 22012, 111132, 53150, 84289, -67646, 15569, -60130, -63888, 110059, + 57982, 22012, 3758, -61740, -25233, 104690, 24159, 35970, 1611, -4295, + -33823, -43487, -68719, -51003, -2684, -11811, 18790, 29528, -6442, 9127, + -34897, -6979, 66035, 22549, -38118, 32749, + }, + { + 2339684, 1752884, 2027225, -1476395, -607201, -110595, 159451, 606127, -149787, 494458, + -820339, 1536525, -83215, -1266479, -305480, 429497, -353261, -338229, -199179, -374736, + -237834, -137439, -524523, -195958, 241592, 313533, 616865, 296353, 103079, 461172, + -95563, 460098, 302258, -260919, -165356, 144418, 6442, -170188, 116501, -44560, + -138513, -238908, 136902, 45634, -128849, -372588, -227096, -294742, -123480, 20938, + 50466, -295279, 10737, 185757, -20938, -122407, -75699, -20401, -70330, -143881, + 48855, -8590, 114354, -17180, -34360, -61740, 69256, 13422, 1074, 42950, + -1074, 77309, 49392, 0, -73014, -39728, 14496, 74625, -15569, -84289, + -2147, -4295, -39192, -26844, 15569, -34360, -44023, 62277, 29528, -28991, + 11811, 8053, -33286, 10201, 1611, 10737, + }, + { + 240518, -3020436, -864899, 205085, -70867, -39192, 153545, 338766, 574452, 243739, + -344134, 24159, -856309, 3864397, 11783780, -1212255, -214748, -357556, 1455457, -636729, + -1561758, -509491, 860604, -76773, -362388, -171799, 523449, -852551, -540629, -1080184, + -97711, 406411, -636729, 290447, 90194, -449898, 413391, 201863, -112743, -128849, + -210453, 249645, 455803, -16106, -261456, 171799, -255551, 39728, 146566, -8053, + 7516, 133681, 176631, 187368, -115427, -76236, -95026, -43487, -160524, 98247, + 202400, 12348, 2147, -44023, 57982, 121333, -179315, -64425, 86973, 74088, + -50466, -1611, 89657, 53687, 34360, 44560, -104153, 38655, 23085, 97174, + -1611, -54761, -39728, -8590, 27380, 6979, 15032, -21475, -31139, -12348, + 0, -22549, 13422, 23085, 9664, -29528, + }, + }, + { + { + 4245575, 51441360, -9879499, 276489, 442919, -186831, 628139, -261456, -21475, 52076, + 172872, -564788, -336618, 338766, 1050120, -179315, 93952, -259846, -335544, -125091, + 386010, 192200, 148176, -27380, -162672, -180389, 26844, 253940, -237297, -289373, + -150861, -46171, 177167, 385473, -70330, -28454, 398358, 347355, 92342, -104153, + -23085, -159451, 68719, -180389, 122943, 141734, -317828, -162135, -90194, -143881, + -3221, -279173, 41876, -84826, -44560, 96637, -25770, -9664, 18790, 137439, + 93952, -39728, -70330, -13422, -18790, 21475, 73014, 21475, -9127, -38118, + 15569, 95026, 15032, 18254, -15032, -13959, 5369, -53687, 68719, 49392, + 29528, 44023, -20401, -6442, -15569, 21475, 12885, -14496, 44023, -6442, + -10201, 10737, -10737, -4295, 13959, 8590, + }, + { + -731755, 5573257, 1144072, -636729, 77309, -177704, 186831, 212064, -8053, -139586, + 279710, 40265, -11811, -205622, -954557, -533113, -514322, -973347, 80531, -224412, + -171799, -222265, -257161, 567473, -148713, 137439, 181462, 296353, 263067, 302795, + -275952, 20938, 406948, 5369, 334471, 48855, 137976, 153545, -358093, -107374, + -266825, 268435, 17180, -229244, 155693, 6979, -3221, -342524, -35433, 76236, + -51540, -97174, 177704, 53687, -211527, -216359, 23622, -58519, -24159, 150324, + 102005, 17180, -83752, -20938, 36507, -6979, 86973, 59056, -56908, -21475, + 102542, -62277, -8590, 20401, 57445, -30602, -74088, -537, 17180, 42413, + -46171, -45634, 12348, 32212, 4295, 44023, 17717, -25770, 33286, -26307, + -49929, 9127, 51540, 40265, 20401, -33823, + }, + { + 1184337, 7301445, -5523865, 3452617, 732829, -671626, 358093, 360240, 11274, -6442, + 448824, -691490, -626528, 253940, 518617, 148713, 794032, 615254, -347892, 444529, + 62277, 365072, -130997, -19864, -96637, 613107, 514859, -387084, -289910, 243739, + -209917, 168577, -70867, -39728, -395137, 515933, 765578, -270583, 337692, -260919, + -48318, -229781, 222801, -201327, 172872, -16106, -88047, 210453, 86436, -118112, + 147103, 50466, 142271, -76773, 287226, 49929, 4832, -65498, -97711, -74088, + 75162, 104153, 191663, -46708, 28454, 76773, -86973, -20401, 62814, 22549, + -6442, 24696, 53150, -35433, -28991, -26307, 8590, 30602, -18790, -9664, + 13959, 13422, 25770, -31675, 27380, 31675, 19864, -58519, 23085, 20401, + -19864, -24696, 3758, -9664, -12885, 27917, + }, + { + -110059, -6858526, -2466385, 1012002, -95026, -337692, -164819, -55835, -130997, -190052, + -694711, 325881, -645856, 777389, 215822, -336618, -386547, 15569, -277025, -185220, + 47245, -305480, 122943, -429497, -360777, -149787, 42413, 236760, 168041, 337155, + 138513, -268435, 333397, -181999, -134218, 33286, -233002, -92342, -86436, 112206, + -137439, -126702, 168577, -62277, -173409, 257161, -8590, -73551, 96100, -69256, + 68719, -69256, 45097, -26844, 23085, 164283, -4832, 17717, -192200, -90194, + 72478, 93416, -10201, 37044, 32212, -1611, 117038, -49929, 1074, 34897, + -21475, -85362, -40265, 33286, -13959, 8590, -22012, 1611, 31675, 27917, + 35970, 9127, -25233, -9664, -537, -32212, 27917, -24696, -19327, 22549, + 18254, -2684, -13959, 15569, 5906, -9664, + }, + { + 341987, -7179038, -571768, 125628, -24696, -77309, 265214, -59056, -140123, 267899, + 121870, -237297, 503585, -285615, 1705639, 450972, -619012, 4452808, -1939178, -64425, + 897648, 369904, -282931, -326954, -410706, 429497, 1198833, 310848, 29528, 312996, + 282394, -370441, 352724, 27917, -255014, 8590, 231391, 128849, -383326, -192737, + 201863, -17717, 210453, -88047, 75699, 28454, 30065, 208306, -118112, -1611, + 296353, -130997, 164819, -62277, -57445, -222265, 25770, 79457, 69256, -15032, + 151934, -70867, 78920, 69793, 166967, 25233, 17717, -48855, -102005, 52076, + -24696, -68719, 1074, 43487, 2684, 82141, 7516, 0, 64425, 4832, + 16106, -37581, -22012, 72478, -24159, -12348, -11274, -51003, 8590, -1074, + -1074, 39192, -6442, -37044, 28991, 24696, + }, + { + 876710, -11529840, -614180, -299574, 560493, 9664, 567473, -507343, -376883, 958851, + 537945, -82141, -24159, 540629, 488016, 639950, -319975, -197032, 237834, 268972, + 115427, -124017, -93416, -180389, 6979, 85362, -34897, 50466, 161598, -126165, + -425739, -537, 107374, 190052, 98784, -387621, 432718, -71941, -65498, 114354, + 383326, 270583, -325881, -11274, -14496, 150324, -95563, 89657, -99321, 110059, + -83752, 37581, 155156, 95563, 58519, 24696, 251792, 102005, -38655, -185757, + -22549, 57982, 21475, 85899, -24159, -69793, 100395, 1611, -41876, 18254, + 2147, -15569, 10201, 44560, -43487, 44560, 37581, -23085, -55835, 15032, + -41876, -32749, -31139, 19864, 32749, 10737, -4295, 35970, -6442, 6442, + -12348, -8590, -5906, -18790, 10201, -1074, + }, + { + -122943, 1073205, 858457, -355409, 29528, 39192, 5906, -205085, -104153, -176631, + 115964, -13959, -188979, -1533303, -1867774, 239444, -811212, -1424855, -1154809, 961536, + 458488, -246961, 1060320, -1118302, -124017, 188442, -660888, -722628, -413927, 219580, + -138513, 241055, 169651, 165356, 472983, -288837, -212064, -96100, 304406, 258772, + -105764, -311385, 223338, -133681, -57982, 297963, 39192, -105764, 77846, -192200, + -76236, 125091, 45097, -85362, 104690, 1074, 88584, -18790, 16643, 20938, + -50466, -15569, -40802, -10737, 84289, -68719, 78920, 3758, -20938, -101469, + -30602, 118648, 27917, 70867, 51003, 26307, 23622, 70330, -1611, -3758, + 37581, -11811, 8590, -24159, 15032, 25770, -43487, -39192, -20401, -47782, + -45634, -4832, 22549, -9664, -2684, 6979, + }, + { + 4327717, 6724308, -4487167, -435939, 186831, 187368, -276489, -244276, -127775, 110059, + 271120, -605590, -303869, 579821, -494995, -372588, 93416, -776315, 25770, 474594, + -174483, -191126, 325344, -28991, -315680, 263604, 404801, -210453, 49392, -75699, + -264141, -183073, -70330, 184147, 32212, 418759, -131533, 29528, -289373, 88584, + 113280, -22012, 30065, -345745, -144955, 110595, -4832, -476205, 537, 267362, + -40802, -84289, -244276, -30602, 143345, 88047, 139586, -41339, 74088, -84826, + -57982, 9127, 79994, -39728, -47782, 2684, -537, -2147, 25770, 7516, + 10201, 15032, 38118, 67646, 6979, -89657, 43487, 15032, -28454, 27380, + -10737, -83215, 6442, 11811, -18254, -23622, 19864, 45097, 6442, 5369, + 537, 20938, 27917, 31675, 537, -22549, + }, + { + 11274, 382789, 1429687, -293132, 22549, -71941, 181462, -198642, 474057, -13959, + -212601, 26307, 119722, 1083942, 1431835, -1227287, -1188632, 207769, -170188, 1016297, + 380641, 321586, 749472, 2193655, -167504, 452582, -85899, -570157, -516470, 459025, + -316217, -131533, -77309, -488016, 199179, -66572, 330176, 203474, 57445, -119185, + 284005, -74625, 30602, 230854, 93416, -260382, 44560, -50466, 92879, -24159, + -50466, -40802, 113817, 58519, -133681, -70330, 73014, 126165, -102542, -32212, + 38655, -74088, 105764, -39728, -14496, -56908, -70867, -19327, -2684, 5369, + -44023, -6442, -19864, 70867, 44560, -39192, -20401, 28991, 31675, -15032, + -24159, -118648, -13422, 15032, -2147, 15569, 52613, 20401, -1074, -23085, + 20401, -1611, 16106, -2684, 15032, 28991, + }, + { + 3174518, -12686260, -3504157, -1912334, 971200, 850940, -2805151, 188979, -272194, 416612, + -12885, 145492, -60666, -520765, -363998, -123480, 566936, 257161, 92342, -108448, + 179315, -122407, 98247, 35970, 375810, -258235, -399432, 111669, 517007, -165356, + -200253, -188979, 79994, 155156, 374736, -303332, 173409, 281320, -239444, -98247, + 275952, 369904, -64961, -319975, 477815, 326418, -24159, 177167, 69793, 223338, + 34897, 45634, 79994, -142271, -201863, 34360, 26307, -132607, 41876, -39728, + -78920, -4295, 2147, 26307, -102542, 38655, -2147, -77846, 12885, -8590, + 9127, -32749, 14496, -2147, 35433, -16106, 19864, -27917, 10201, -23622, + -25770, -2684, 35970, 1611, 36507, 64961, 33286, 3758, 32212, 1074, + -3221, -12885, -24159, -6442, 23622, 26307, + }, + { + 231391, 1081258, -674847, 14496, 143345, 89121, -609349, -1148367, 372588, 494458, + 158914, -195421, -18790, -458488, -1345935, -1715839, 926639, -142808, -308701, -262530, + -1427540, 220117, 1066226, -99858, -163746, 134218, -415001, 201863, 444529, -318364, + 20938, -166967, -162672, -126702, 57982, -222265, -178241, -144955, -116501, -21475, + -239444, 118648, -37581, 27917, -61740, -125091, -75699, 55298, 164819, 224949, + 46171, 6442, -150324, -40802, -80531, 69256, 12885, 52613, 55298, -68183, + 62814, 39728, -61203, 12348, 50466, 23085, 52076, 125091, -56371, -30065, + -13422, -26844, 40802, 44560, 10737, -56908, -37044, -70330, 29528, 6442, + -26307, 20938, 35433, -51003, -11811, 1074, -20938, -8590, -34897, -16106, + 10201, 6979, 3758, 9664, 20938, -16643, + }, + { + -1314260, -4736812, -1553168, -224412, 1086090, -2046552, -1292248, 1116155, 263604, 570694, + -386010, -144955, -111132, 150861, 433255, -61740, 491774, -23622, 322123, 172872, + -98784, 191126, 46171, -491774, -273804, -219043, 667331, -113280, -60666, -294205, + 1074, 75162, -322123, -161061, 130460, 34897, -621160, -351114, -143881, 90731, + 125091, -224412, 100395, 116501, 49392, 35970, -280784, 86973, 228170, -134218, + 188979, -11811, 248571, -79457, -84826, 78920, 23085, -121870, -72478, 17717, + 68719, -95563, -1074, 96637, -16106, -93416, -41876, -13959, -8053, 70867, + 22549, -59056, 49392, -16643, -9664, -8590, -13959, -20938, -15569, -20401, + 537, 59593, -7516, 3221, 12885, -20401, -16643, 17180, -3758, 28454, + 10201, 15032, 15032, -32212, 0, 15032, + }, + { + -197032, 3002182, -231928, -308164, -50466, 176631, -139050, -545998, 225486, -93952, + 239444, 95563, 2053531, -5190468, 1376000, 337692, -502511, 776852, -653372, 831613, + -1082869, 899259, 228170, -889058, -469225, 1096827, -395137, -653372, -203474, 295279, + 121333, 360240, -869731, 126165, -173946, -407485, -462783, -227096, 26307, 311385, + 66035, 74088, -122943, -51540, 124554, 159988, 309775, 148713, -62814, 52076, + 193274, 97711, -37044, -49929, 135828, -38118, -20401, -152471, 58519, -84826, + -82141, 86973, 41339, -23622, 48318, -53687, -7516, -92879, 41876, 40802, + 12885, -13959, 51003, -24159, 27380, 67109, -20401, 3758, -30065, 3758, + -50466, -33286, -49392, -40802, 20938, -23085, 39728, -33286, 8590, 5369, + -34360, 32749, 38118, -33823, 11274, 27917, + }, + { + -396748, -3001109, -291521, -2773475, -198105, -1649804, -2147484, 55298, -121333, -129386, + -148713, 2365990, -651761, -142271, 1245004, -709207, -692564, -219580, -8590, 160524, + 86973, 225486, -179852, 215822, -537, 301185, 552440, 310311, 78920, 135828, + 105227, 64425, -283468, -346282, 3221, -49392, -49392, 20401, 297963, -51003, + -333934, 91805, 51540, -51003, -33823, -164819, -44023, 96100, 54761, 103616, + -133681, -67109, 32749, -26307, -108985, -45097, -5369, 166430, -48855, 21475, + 53687, 12885, 104153, -82678, 16106, -61740, 96100, -37044, 13959, -17717, + 25233, 25233, 23085, -9127, -15569, -33823, 47245, 6979, -55835, -55298, + 21475, -15032, -75162, -5906, -1074, -24159, 34897, 49929, -7516, -23622, + 7516, -16106, -34897, -2684, 26307, 537, + }, + { + -50466, -2775086, 809064, 462783, -134755, 125091, 120796, 445603, 462783, -264677, + -489089, 273267, 187905, 83752, 3994320, -1959579, 767189, -218506, 309775, -544387, + -277025, -213675, 135291, -81068, 6979, -471373, -13959, -1368484, 332860, 244276, + 33286, 339302, -142271, 490163, -139050, -74625, 386547, -291521, 318901, 54761, + -45634, 415001, 304406, -210990, -40802, 133681, -219580, 52613, 194347, 86973, + -37581, 114354, 61740, -11811, -113280, 22012, 47245, 15032, -15032, 93416, + 39192, -35433, 51003, -37044, -1611, 31139, -186831, 66035, 47245, 59056, + -55835, 27917, 97174, 33823, 37044, -58519, -52613, 51540, -7516, 33286, + -50466, -38118, -38118, 44560, 15032, -5906, 30602, 537, -32749, 9664, + -8053, -47245, 20938, 21475, -16643, -31139, + }, + }, + { + { + -2151242, 36612448, 4134443, 2065879, 20938, 386010, 162135, -69256, -122943, -369367, + -463320, -208843, -79457, 838592, 744640, -558346, 76236, 233539, -308701, -616865, + 722091, 234076, -180926, 269509, -189515, 14496, 298500, -68183, -503585, 86973, + 32749, 66572, -17180, -142271, 215285, 241592, 111132, 123480, 52613, 114890, + -40802, -98247, -6442, -223338, 40265, -175557, -33823, -34897, -200253, -270046, + -181462, -132607, -47782, 19327, 55298, -18254, 208843, 94489, 94489, 31139, + -27917, -71941, 78920, 66035, 13959, 18254, 22549, -15569, 56908, 18254, + 63351, 53150, 4295, -7516, 40265, 88047, -44560, -18790, 30065, -60666, + -45634, -25770, -16106, -10201, 24696, 3758, -39192, 4295, -30065, 3221, + -13422, -5369, -2147, 19864, 537, -8053, + }, + { + 501974, 3761855, -302795, -1286880, -344671, 293668, 104690, 36507, -40265, 134218, + 335544, -314069, 75699, 417686, -1530619, 246961, 424128, -329102, 153008, -389231, + 58519, -15032, 339839, -97711, -137439, 246961, -42413, 131533, 99858, -88584, + 375273, -178778, 26307, 2684, 246424, 146566, -19327, -47782, -178778, 64961, + -188442, -258772, -340913, -44023, 175557, -25233, -124017, -103079, -180389, -114354, + -7516, -6979, -91805, -224949, 19864, 90194, 25770, 21475, 49392, 17180, + -79457, -76773, 17180, -42950, -14496, 62814, -40265, -51540, -28454, 39728, + -17180, -15032, 79457, 54224, -6442, -13959, 40265, 28454, -3758, -71941, + -16106, 47782, -12348, -17180, 4832, -22549, -33823, 22549, -30065, -38118, + 30602, 16106, -18254, -17180, -12348, 25233, + }, + { + -1516124, 2767570, 1167694, 1398549, -715649, -311385, 452045, 578747, 298500, 290447, + -40802, -732829, 56908, -90194, -3758, 222265, 503048, 754841, -571768, 1149978, + 650151, -81068, -126165, 44560, -91805, 241055, -197032, 153545, -377420, 6979, + 295816, 538482, -393526, -260919, 222265, 458488, 143881, 360777, 372052, -90194, + -19327, 105764, -117038, -304943, -139050, -23622, -50466, 23622, -15569, 74088, + 37044, 61740, -70867, 12885, 537, 74625, -17717, -75162, -537, -64961, + -2684, 99858, 5369, 2147, 103616, -120259, 17717, -537, -60666, -33286, + 56371, 10201, -41339, -18790, -6979, 49929, 64961, -42413, -35970, 17180, + -9127, -6442, 0, 42950, -1074, -31139, -22549, -10737, 20938, 3221, + 17717, 47782, 6979, -1074, 33286, 0, + }, + { + 3314641, -7538742, -4111358, -441845, 52613, -366146, -172336, -124554, -189515, -31139, + -166430, 97174, -344671, 654983, 603443, -262530, 21475, -308701, -66035, -150861, + 114354, -467078, -449361, -102005, -65498, -243739, 491237, 114354, 141734, -364535, + -193274, 91268, -199716, 100932, -32212, 177167, -125091, -360777, 255551, -162135, + -90194, 87510, -31139, -23622, -86436, -82141, -166430, 51003, 12348, 12885, + 163209, -22012, 32749, -44023, -48855, 82141, -44560, 9127, -121870, -62277, + 20938, -55298, 6979, 40265, -109522, 45097, 24159, -28454, 5369, -52076, + -29528, 59593, 98247, -15032, -5906, -21475, -30065, 32749, 7516, -24159, + -23622, -48855, -1074, 28991, 10737, 18790, -5369, -4295, 49929, -5369, + -32749, -12885, 14496, -4295, -26844, 17180, + }, + { + -236223, -6412923, 240518, 137976, -233539, 178778, -74625, 202937, -367220, 48318, + 121333, 103079, -13422, 558346, 2112050, 1319092, 3040300, -180926, -2518998, 1064615, + 668941, 300648, 186294, -321049, 304943, 1349694, 714038, -127238, 13422, 482110, + 164283, -189515, 69793, -71404, 90194, -347355, 294205, -350040, -394063, 142808, + -52613, -19864, -130997, -20938, 93416, -49929, 16643, 147103, -235686, -102542, + 70330, 38118, 10201, -72478, -12885, -106300, -14496, -10201, 82678, -1611, + -21475, 41876, 99858, 2684, 537, -168041, 21475, -45634, -19864, -15032, + -7516, 46708, 47245, 66035, 113817, 40265, -75699, -30065, -63351, -57982, + -47782, -30065, 96100, 47782, -55298, 5369, -66572, -9664, 15032, -17180, + -7516, -18254, -15032, 30065, 21475, -23085, + }, + { + 3071439, -10159208, -2523293, 268435, 388695, 98247, 9664, -297963, 265214, -92879, + -485868, 225486, 530428, 708133, 249645, 324270, -186831, -69256, -287226, 200253, + -297427, -384936, 318364, -18790, 48318, -265214, 317291, 209917, -19327, -334471, + -292595, 63888, 432718, 281320, -54761, -32212, 22012, 113817, -130997, 87510, + 2147, 126165, 346819, -248034, -223338, 157303, 28991, 258235, 24159, 96637, + 24159, 170725, -137976, -96637, 48855, 5906, 77309, 11274, 10737, -51540, + 46708, -13959, -133144, -22549, -30602, 30602, 15569, -43487, 28454, -16643, + -44023, -53150, 41339, 38655, -43487, 54761, -41339, 5906, 36507, 1611, + -19327, 45634, 98247, 29528, -3758, -42413, -29528, 537, -12348, 41876, + -25770, -17717, -30602, 17180, 39192, -14496, + }, + { + 381715, 268435, -1047435, 289373, 89121, 135828, 126165, -566936, -110595, 110059, + 93952, -127238, -54224, 1817845, -5175973, 835371, 352187, -259309, -1116155, 1196685, + 611496, -162135, 493384, 44023, -267362, -281857, -242666, -1125281, 632971, -1088774, + 13422, 167504, 421981, 126165, -290447, 69793, -146566, -149787, 31139, 224412, + -358630, -33823, 194347, 133681, 24159, -87510, -45634, 32749, -15032, -119185, + 82141, 59593, -17180, -126165, 112743, 8053, -67646, -125091, 224412, -1074, + 30602, 62814, 95026, -5906, 46708, 20938, -15032, -47782, -40802, 41339, + 98784, -17180, -55835, 48855, -6442, -33823, -38655, -22549, -55298, 8053, + 31675, -19864, 3758, 537, 6979, -25770, 2684, 20401, -9664, 23085, + 36507, 42413, -537, -18790, 19327, 18254, + }, + { + -6286222, 13415330, 3370476, -115964, -667331, 74625, -13959, 18790, -139050, -199179, + -258772, -157840, 485868, -388695, -748398, -345745, -499827, 260382, 503048, -119722, + -273804, -134218, 59056, -243203, 206158, 268972, 26844, 220117, -245350, -303332, + -297427, -136902, 75162, -140123, -126702, -121333, -6979, -285615, -179315, 103616, + 162135, 185220, -308164, -66035, -244276, -11811, 245887, -133681, 76236, -70867, + -28991, -263604, 284542, -1074, -23085, 44560, -2147, -13422, -77309, -56908, + 57445, 44023, -39192, -81068, 35433, 44023, 2684, -56371, 45634, 74625, + 7516, -26844, 63888, -73551, -115427, 21475, 10737, -85899, 22012, 9664, + -44023, -11274, 31675, 1074, -1074, 13959, -14496, -33286, 9664, -1074, + 22549, 19864, -6979, 2147, -15569, 3758, + }, + { + 479963, -614180, -1110786, 352724, -327491, 151398, 42950, -377957, 304943, 113817, + -93952, 96637, 383863, 291521, 1725503, 455803, -1828582, 1425392, 850940, -639413, + 9664, 1708323, 1246077, 943819, -294742, 322659, 607738, -1706713, 223875, -67109, + -40802, -20938, -297963, 227096, -151398, -351650, 373125, 305480, -55298, -537, + -216359, 41876, 196495, -52076, -362388, -237834, -73014, -70330, 36507, 125091, + -7516, 95026, 115964, -113817, -128849, -4832, -36507, -50466, -242129, 25770, + 129386, 106837, 103616, 90194, 191126, 19864, 65498, -26307, 2684, -24159, + 31139, 87510, 36507, -51003, -75699, -38655, 8590, -9664, 24159, 10201, + -45097, 24696, 60130, -9127, -24696, 0, -42950, -56908, 15569, 23622, + 537, -11274, 11811, -8053, 5906, -26844, + }, + { + -3145527, -10226317, 3474092, -366146, -495532, -855772, -222801, -163209, 171262, -280784, + -436476, -408022, -166430, 220654, -549756, -264141, 915365, -130460, 267899, -30602, + 365609, -265214, 8590, 121870, 225486, 76236, -309238, 120259, -16643, -61203, + -151398, -190589, -149787, -145492, -60130, 215822, 184147, 2684, 56908, -86973, + -50466, 61740, -42950, 54761, 212601, 16643, -92342, 309238, 6442, -180389, + -93416, -27380, -225486, -125091, 123480, 15569, -7516, 48855, -48318, -3758, + 65498, -96637, -37044, 16106, -31139, 18254, -16643, -25233, -9664, -70330, + -51540, 26844, -28991, -31675, 22549, -11811, 537, -10201, 40802, -28454, + 46171, 18790, -17717, -17180, -5906, -42950, -51003, -8053, -37581, -13422, + -7516, 1074, 35433, 6979, -5369, -29528, + }, + { + -338766, -273267, 457951, 168041, -320512, -362388, -440771, -359704, 130460, 280784, + -118648, -298500, 695248, -667331, -989990, -1145146, 498216, 193274, -448287, -985695, + 515933, -331249, 229781, -223338, 195958, -140660, -438624, 263604, 333934, 488016, + 130997, -232465, -184684, -18254, -271120, -155156, 247497, -143881, 120259, -80531, + 77846, -78383, -51003, -102005, -5369, -158914, -25233, 24159, 119185, 41339, + -165356, -18790, 102005, 139050, 66035, -41339, 105227, -24159, -48318, 1074, + -29528, -44023, 71941, 111669, -66035, -69793, 22549, -57982, -72478, -27380, + 16106, 43487, 39192, -537, -45634, -6979, 16643, 64425, 69256, -32212, + -8053, -42950, -11811, 46708, 45097, 3221, 6442, -6442, 16106, 44560, + -9127, 10737, 7516, -537, 4832, -15032, + }, + { + 737661, -5728413, -1981591, 616328, -224949, -1871532, -81068, 690416, 579284, 325344, + 146566, 468688, 186831, 773631, -55298, 394063, -176631, 404801, -99321, 78920, + 273804, -469762, -125628, -96100, -279710, -104153, 136365, 93416, -84826, -35970, + 276489, 54761, 5906, 118648, -4295, 142271, -32212, 44560, -191126, 8590, + -217433, 85362, -199716, 135291, 59593, -78383, -40802, -74088, 54761, 16643, + -17180, -32749, -17717, -55835, -22549, 53150, 31139, -60130, 13422, 31139, + 1611, -83215, 83215, -49392, -75162, 34360, 23085, 33823, 28991, -37044, + -18254, 56908, -33823, -37581, -57445, -25233, 30065, -20401, 13422, -3221, + -5906, -21475, -26844, 15032, -38118, -23085, 44560, -13422, 28454, -6442, + -40265, -16106, -57445, -7516, 14496, -5906, + }, + { + 127238, 2468533, 1105417, -1041530, -410169, -99321, -290984, 68183, 127775, -457414, + 107911, -238371, -1856500, 1666984, -730144, -1523103, 610422, -10737, -23085, -160524, + 1087701, -335544, -93416, -1801202, -176631, 9127, -201863, -233002, -268972, 175020, + -265214, 412317, -290447, 108985, 130997, -489626, -241055, -413927, 18254, -67109, + 129386, 6979, -3758, -65498, 179315, 81604, 126702, -57982, 216359, 10201, + -90194, -148176, -91805, 92879, 48318, -188442, -27917, -12348, 10737, 111132, + 136902, -48318, -152471, -25770, 10201, -17180, -40802, 39192, 92342, -39192, + -12885, 3758, 17717, 28991, -5906, -77846, -107374, -2147, -3758, -6442, + 44560, 45097, 16106, 36507, 17180, 8053, -13422, -68719, 28454, 16643, + 17717, -16106, -69793, -13422, 28991, -38655, + }, + { + -988379, -1796907, -1228898, -1296006, 99321, -1329829, -1293859, -109522, 49929, -628676, + 724776, 359704, -97174, 770947, -351114, -262530, 250182, 103079, 85899, -71404, + 132607, -56371, 49929, 90731, -228170, 49929, 221728, 374736, -329102, -125091, + 429497, -144418, 92342, 117038, 137439, -223338, 251792, 413391, 275952, -118648, + -510027, 50466, -143881, 128312, 196495, 266825, 228707, 43487, 9127, -21475, + -124554, 188979, -115427, -115427, -33823, 180389, 114890, 39728, -18254, 138513, + 25770, 62814, 77309, 73014, 143881, 104153, 89121, -37581, -12885, 2147, + 12885, -16106, 1611, 7516, 73551, 33286, 10201, -79457, 36507, 60666, + 28454, -7516, 24696, 48318, -23622, 28991, 34360, -52613, -11811, 11274, + -25770, -11274, 17180, -4295, 1074, -5906, + }, + { + -107374, -2041720, 1143535, 67646, 52076, 206158, 178778, 402116, 532576, -519154, + -51003, 69793, 1003412, 374199, -5015985, 14496, 2688113, 615254, -1224603, 144418, + 889595, -136365, -216896, -177704, 170188, -102542, -636729, -763430, 362925, 400506, + -178778, 269509, 455803, -154619, 196495, 213138, -679679, -91805, 466004, -205622, + 112743, 38118, -146029, 136365, 126702, -192737, 227633, 35433, 65498, 26844, + -128312, 6442, -103616, -101469, 40802, -78920, -12348, -63351, -69256, -184147, + -137439, 46171, 37581, -88584, -49392, -67646, 144418, 43487, -45634, -12348, + 45097, -27917, -39728, 2147, -22012, -45634, 50466, -20401, -55298, -61740, + 23622, 48855, 52613, 14496, -38118, 6979, -23085, 10201, 32749, 3221, + -13422, -3758, 537, -16106, -22549, 20938, + }, + }, + { + { + 3149285, 19451370, -8847633, 1924145, 21475, -34360, -397821, -124017, -117038, -434865, + -82678, -74088, 17717, -46708, -643708, -202937, 98247, 357019, 528281, -50466, + 133681, -222265, -61203, 349503, 66035, 52076, 156766, -36507, -303332, 442382, + 282931, 185757, 181462, -64961, 214748, 43487, 134218, 40802, 56908, 251792, + 36507, -34360, -35433, -181462, -89121, -203474, 46708, 62277, -102005, -292595, + -165893, 18254, 73014, 55835, 31675, -110595, 62814, -47782, 40802, -73551, + -6979, -89121, 62814, 54761, 13422, 5369, -35970, 8590, 77309, 20938, + 24159, -47782, -3758, -8590, 5369, 16643, -64961, 32749, -15569, -71404, + -48318, 4295, 31139, 7516, 36507, -41339, -9127, -1611, -31675, 5906, + 2684, -15569, 23085, 24159, -11811, -14496, + }, + { + -49929, 3245385, -890669, -1023813, 266825, 353261, -154619, -231391, 59056, -255551, + 56908, -297427, 162135, 176094, -1206349, 619012, 674847, 219580, 603443, -372588, + 76773, -15569, -148713, -386010, 70330, 510564, 77309, 59593, -278636, -476741, + 290447, -593779, -100932, 250182, 42950, 326954, 64961, -48318, 64425, 242129, + -124554, -262530, -289910, 54761, 62814, -19327, -52613, 252866, -129923, -120259, + 129923, -48318, -113817, -99321, 235149, -9127, 35433, 103079, 23085, -132607, + -140660, -55298, 45097, 11274, -24159, 27380, -78920, -12348, -6442, 30602, + -51540, 50466, 39728, 10737, -22012, 22012, 43487, 12348, -19327, -54224, + 24696, 32749, -44023, -31139, -14496, -25233, -24159, 23085, -40265, 17717, + 41339, -11811, -37581, -24159, -5906, 36507, + }, + { + 1161789, 3470871, -1464047, -1830193, -1532767, -243203, 95563, 181462, 58519, -143881, + -336618, -725313, -28991, -166430, -296353, -212064, -82141, 622770, -254477, 603980, + 633508, -560493, 165893, 591632, -6442, -107374, -212064, 556735, -108985, 57445, + 100395, 77309, -280247, -102542, 397821, 11274, -146566, 139050, 238371, 246961, + 55298, 12885, -137976, -246424, -208843, -15569, -52076, -13959, -22549, 58519, + -121333, 19327, -3758, -69256, -176631, 65498, -85362, -20401, 84289, 2684, + -104153, 12885, -82141, -11274, 6979, -117575, 73551, -9127, -72478, -11811, + 17717, -105227, -32212, 57982, -2684, 59593, 9127, -55298, 27917, 25770, + -24696, -28991, 18254, 39728, -15569, -25770, -24159, 22012, -9664, -10737, + 26307, 45097, -16106, 12885, 14496, -23085, + }, + { + -4136054, -14179835, -763430, -955093, 74625, -166430, 88047, -82678, 91805, 453119, + 144418, -127775, -78383, 462783, 524523, -272194, -166967, -246424, -41876, -247497, + 108448, -124554, -177167, 34897, 98784, -62277, 421981, 139586, -352187, -459562, + 75699, 242666, -267899, 169651, -12885, 409633, 52613, -74625, 359704, -121870, + 150861, 0, -154082, -18790, -26307, -74088, -94489, 13959, 89121, -55298, + 97711, 30602, -108448, 40265, -61203, 57982, -79994, -58519, 3758, -45097, + -46171, -60130, 1074, -10737, -90194, -1074, -66572, 20938, 2147, -29528, + 12885, 90731, 61203, -13422, -6979, -41876, 6979, 22549, -5906, -39192, + -24159, -29528, 40802, 20938, 5369, 6979, -33823, 30602, 32749, -17717, + -22549, 5906, 12885, -9664, -22549, 28454, + }, + { + -101469, -5373004, 813359, -55835, -107911, 114890, -159988, 424128, -204011, 110059, + 70330, 140660, -296353, -463856, 1081795, 1506997, 1576253, -3126199, 940598, 1901060, + 530428, -186831, 76773, -38118, 317828, 651224, -1316408, -597000, 594316, 1259499, + 458488, 309775, 18790, 176094, 120259, -720481, 33823, 20938, -88584, 150324, + -32749, 130460, -17180, -37044, 75699, 49392, -73551, 97711, -119185, -232465, + 30602, 37581, -40802, -5369, 45097, 49392, 40265, 75162, 125091, 6979, + 27380, 85362, 69793, -51540, -54761, -133144, 100932, 67109, -15032, -39728, + 77846, 56908, 41339, 22012, 53687, -18254, -26844, -16643, -83752, -29528, + -12885, 26307, 57445, -29528, -2147, 6442, -36507, 26307, 0, -12348, + -8590, -15032, -2147, 35433, -8590, -20401, + }, + { + -3996467, -17223892, 505196, 1044751, -270583, 68719, -106837, 258772, 111132, -638876, + -470836, 217433, 253403, 119185, -468688, -7516, -115427, 48318, -227633, -171262, + -495532, -82678, 309238, -192200, 5369, -267362, 145492, 395137, -309238, -421981, + -17180, 275415, 170188, -154619, 118112, 161598, -71404, 67646, -39728, 113817, + -504659, -106837, 372588, 69793, 1074, -4832, -147103, 121870, 6979, 68183, + 78920, -23622, -268435, -115427, 1074, -146029, -106837, -1074, 101469, 51540, + 40802, -34360, -99321, 4832, 35433, 5369, -52613, 6979, 30602, -35433, + -63351, -1611, 35433, -4295, 1074, 15569, -41339, 12885, 52076, 14496, + 28454, 61740, 59056, -33823, -18790, -23085, 1074, -27917, 18254, 12348, + -22012, -11811, -8053, 37581, 1611, -22549, + }, + { + 38655, -686658, -555661, 250182, -27917, -13959, 322659, -128312, 135828, 80531, + 537, -51003, 9127, 2050310, -5077725, 336618, -192737, 28991, -1094680, 912144, + 598611, -530428, 139586, 1001801, 603443, -478889, 90731, 19864, 432718, -1301375, + -90731, -15032, 95563, -304943, -44560, 404801, 7516, -64425, -168577, -112743, + -134218, 358630, -22549, 35433, -12348, -78383, 15032, 98784, 1611, -41876, + -42413, -68719, 10737, -33286, 28991, -31675, -57982, -65498, 68719, -18254, + 77846, 40265, 89121, -27380, 15032, 32212, -104690, -24159, 20938, 69793, + 31139, -76236, -33286, -2684, -48318, -6442, -62277, -35433, -40265, 30602, + -3221, -27380, 3221, -9127, -9664, -20938, 25233, 15032, 15569, 40265, + 35433, 15032, -26844, 5906, 8053, 1074, + }, + { + 5768141, 22973244, -2921652, 554588, 12348, 292595, 444529, -173946, 42950, -286689, + -337155, 440234, 200253, -565325, 180389, -134218, -354872, 372588, -22012, -350577, + -6442, -190052, -17180, 25770, 562104, 39728, -169651, -66572, -424665, -192200, + -100395, 31139, -53150, -294742, -74088, -376347, 13422, -109522, -63351, 137976, + 54224, 31139, -161598, 49392, -317291, -20401, 197032, 121870, 32212, -179852, + -27917, -78920, 330712, -88584, -61740, -11274, -48855, -18254, -30065, 23085, + 56908, -33286, -78383, -8590, 82141, 6442, 17180, -38118, -11274, 14496, + -5906, -27917, -19327, -80531, -10737, 74625, -55835, -51540, 70867, -11274, + -3758, 41339, 8053, 537, 25770, 4832, -11274, -17180, -13959, -6979, + 20401, 2684, -12885, -15569, -7516, 26844, + }, + { + 84826, -1757715, 474594, 643171, -118112, 125091, -162135, -564251, 104153, 27380, + 103079, 60666, 228170, 836445, 1620276, 1949378, 987843, 1404991, 670552, -1194001, + -193274, 1381906, -221191, -651761, -98247, 299574, 330712, -353261, 672162, -411243, + 508954, -103079, 141197, 219043, -194884, 17717, 57445, -90194, 87510, -55835, + -306016, 29528, 45097, -122407, -289373, -67646, -18254, 65498, 48855, 183073, + 10737, -14496, -106300, -109522, 30065, 58519, -177704, -123480, -99858, 121870, + 126165, -6442, -41876, 37581, 70330, -6979, 74625, -19327, 36507, -35433, + 60666, 74088, 10201, -103079, -84289, 11811, 3221, -53150, -4832, -1074, + 537, 67646, 23622, -2684, -17717, -10737, -50466, -28454, 33286, 14496, + -19327, 8053, 4295, -6979, -17180, -32749, + }, + { + 2646774, -7114614, 1080184, 972810, -304943, -1134945, 124554, -203474, 71404, -635655, + -311922, -282931, 38655, 496069, 59056, -57982, 8590, -607738, 254477, 171799, + 90731, -191126, 137439, 122943, 53687, -34897, -304943, -12885, -168041, 163209, + 64425, -71404, -64961, -58519, -39728, 165893, -57445, -244813, 126165, -214212, + -66035, -81068, 186294, 177167, -153008, -73551, -108448, 134755, -53150, -155156, + -48318, -31139, -216896, 72478, 233539, 42413, 29528, 47782, -44023, 62277, + 42413, -39192, -37581, 23085, 69256, -31139, -23622, 7516, -39192, 10737, + -23622, 29528, -46708, 13959, -3221, -537, -26844, 49929, -18254, -12348, + 45097, -6442, -56371, 3758, -35970, -54761, -37044, 5906, -41339, 537, + 3221, 24159, 23622, -8590, -8590, -33823, + }, + { + 251256, -823560, -2017561, -702227, -600222, -29528, 502511, 251792, 38655, -184147, + 127775, 81604, 290447, 294742, 493384, -31139, -351650, -938987, -467615, 301185, + 631897, -416612, -157303, -541166, 169651, -439160, -265214, -272730, -205622, 198642, + -44560, -227633, -156229, 41339, -231391, 34360, 406411, -67646, 72478, -234613, + 263067, 20938, -28454, -107374, 20401, -112206, 64961, -43487, -97174, -79457, + -88047, 69256, 99858, 88584, 34897, -30065, 2684, -27917, -10201, 19864, + -80531, 6979, 76236, 34897, -83752, 11811, -61203, -94489, 38655, 17717, + 40802, 21475, -23085, -25233, -15032, 42413, 34897, 52076, -7516, -19864, + 8053, -39728, -20938, 59056, 16106, -4832, 22012, -10737, 32212, 18790, + -20401, 9664, -3758, -6442, -23622, 17717, + }, + { + 135291, -5541582, -1386738, 527207, -295279, 532576, 979789, -82678, 262530, 81068, + 320512, 66035, -14496, 278636, -184684, 316217, -616865, 105764, -358630, -16643, + -35433, -325344, -23622, 26307, -123480, 6979, -226560, 436476, 30065, -24159, + 147103, 95026, 268972, 74088, 51540, 343061, 355945, 274341, -240518, -158377, + -330712, 216359, -359704, 32749, -3758, 104690, 150861, -112743, -95026, 70867, + -149250, -11274, -105227, 75162, -30602, 8053, -16643, 43487, 71404, -36507, + -18254, -17717, 53150, -92342, -13959, 31675, 23622, 57982, 17180, -104690, + 17717, 36507, -50466, -12348, -30065, -4832, 13959, -10737, -3758, -12885, + -12348, -48318, 12348, 9664, -30065, 15032, 14496, -6979, 11274, -38118, + -16106, -13959, -28991, 6979, 537, -10737, + }, + { + -44023, 2213519, 897111, -765041, 231928, -150861, -6979, -54761, 67109, -437013, + -216896, -164819, -39192, 4278325, -846645, -1232119, 1041530, 381178, 693637, -110595, + 1584843, -947040, -1207960, -2219961, -455267, -783295, 75699, -357556, 28991, -286152, + -433255, 357556, 86436, 130460, 258235, -41339, -26307, -99858, -237834, -325881, + 132070, 141197, 100932, 48318, 156766, -5369, -127238, -173409, 99321, -112206, + -141734, -164283, 40802, 80531, -76773, -130460, 71941, -10737, -13959, 158377, + 105764, -135828, -95026, 30065, 42950, -48855, -79457, 59056, -9127, -40265, + -2684, 17717, -36507, 3221, -40802, -31139, -48318, 18790, -4832, -37044, + 53687, 44023, 20401, 40265, -537, 14496, -44560, -16106, 9127, 11274, + 33286, -48855, -56371, 35433, -8053, -33286, + }, + { + 1049583, 871878, -562641, -297427, 139050, 1038845, 1598265, 204011, 36507, 69793, + 46708, -649077, 417686, -81604, -1489817, 357556, 223875, 84289, 36507, -125628, + 388158, -192200, 51003, -234613, -116501, -120259, 85362, 383326, -331786, 193810, + 231928, -243203, 190052, 248571, 148176, -155156, 341987, 389231, 164283, 0, + -135291, -89121, -120259, 152471, 148176, 143345, 100395, -42950, 79457, -64961, + 105227, 58519, -146029, 11811, 54761, 178778, 5906, -102542, 66572, 94489, + 33823, 45097, 63888, 108985, 69256, 53150, 15032, -15032, -16106, 35970, + -54224, -1074, -20401, 1611, 33823, 30065, -16643, -34897, 66572, 32212, + -10737, 10201, 54761, 24159, -11274, 31139, -27380, -50466, 20938, 4295, + -18254, 16106, 18254, -5906, -31139, -8053, + }, + { + -13959, -1668058, 352724, 14496, 193810, 107911, 252329, -557272, -253403, -147640, + 68719, -176094, 641024, 2481417, -1464047, 810675, 1903207, 228707, -904628, 547071, + 498216, -524523, -206695, 322659, 686121, 362925, -453656, -235149, 112743, 144955, + 74088, 293668, 326954, -238908, 180389, 5369, -301185, 496606, 287763, -284005, + -205622, -169651, -127238, 235686, 6442, -239444, 236760, 99321, 46171, 42413, + -47782, -57445, -96100, 37581, 122407, -111132, -8590, -19327, -92342, -175557, + -73014, 52076, -23622, -65498, -21475, -16643, 158377, -98784, -48855, -28991, + 48318, -70330, -61740, -13422, -27917, 39728, 1074, -23622, -19864, -6979, + 71404, 39728, 48855, -41339, -40265, 5369, -29528, 3221, 35970, -11811, + -9127, 13959, -10737, -24696, 2684, 33286, + }, + }, + { + { + -3847754, 16582869, 3030636, 707596, 300648, -287763, -125628, -4295, -320512, -78920, + 379031, -421444, -120259, -203474, -466004, -466004, 439160, 104153, 338229, 470836, + -759672, 395137, -91805, 120259, 172336, -98247, -51003, 42950, 15569, 431107, + 133144, 322659, 278099, 330176, -257161, 99321, 322659, 139050, 144418, 56908, + -49392, 139586, -68183, -177704, -23622, 109522, -157840, -118112, -48318, -126702, + -64961, 82678, 60130, 5906, -136365, -107911, -100395, -119722, -91805, -26844, + 113817, -67109, -90194, -27917, 32212, -35433, 65498, 33823, -14496, -12348, + -26307, -13959, 14496, 2147, -50466, -92879, 9127, 14496, -25233, 51540, + 35433, 64961, 30602, 9127, -10737, -8053, 38118, -4832, 21475, 24696, + -2147, -12885, 20938, -1074, -8590, 6979, + }, + { + -99321, 4264366, -1219234, 1001801, 156229, -187905, -12348, 104690, -1611, -159988, + -303332, 239444, -198642, -922881, 100395, -437013, -16643, 171799, -356482, -113817, + -130460, -49392, -636192, -73551, -88584, 225486, 679679, 296890, -83752, -610422, + 17717, -368293, 294205, 239981, -2684, 277025, 270046, 91805, -99858, -186831, + 148176, 146029, -83215, -46171, 114890, -33823, 131533, 107374, -164819, 63351, + 46171, 21475, 98247, 226023, -62814, -220117, 34897, 18254, -44023, -67109, + 24159, 40265, 14496, -15032, 34360, -50466, 52613, 83752, -4295, -20938, + 3221, 51540, -75162, -33286, 47245, 5906, -61740, -39192, 537, 51540, + 11274, -57445, -14496, -1611, 3221, 34897, 11274, -11274, 20401, 34360, + -31675, -16106, 19864, 37044, 16106, -13422, + }, + { + -983011, 1951526, 91805, -1307818, 1453846, -517544, 205622, -150324, -103079, -228707, + -93952, -527744, -457414, 134755, -209917, 81068, 255014, 243203, -198105, -5369, + 325881, -252329, 233002, 367220, 327491, 155693, 56371, 443992, -218506, 79457, + 114354, -212601, 53687, -51003, -226023, -144418, 400506, -243203, 118112, 161061, + -19327, -152471, -81068, -7516, -38655, 68719, -537, -41339, 175020, -156229, + -59056, 38655, 47782, -71941, 26844, 61740, -85362, -2147, -20938, 28991, + -64961, 74625, -55835, 8053, -69256, 37044, 43487, -71941, 57982, 13959, + -64425, -77309, 67109, 537, 15569, -8053, -91805, 40802, 57445, -11274, + -1611, 5369, 15569, -7516, 12885, 31675, 11811, 1611, -38118, 13422, + -13422, -27380, -9127, 3221, -18790, -5906, + }, + { + 1850057, -23840290, 1169842, -930397, -234076, -25770, 99858, 48318, 193274, 254477, + -34897, -185757, 408022, -314606, 96100, -520228, 192737, -306016, -438624, -112743, + -131533, 263604, 16643, -47782, -28991, -184684, 85362, 251792, 92879, -122943, + 148713, 133144, 50466, -11274, 6442, 360777, 60130, 202400, -2147, 212064, + 48855, -325344, 16643, 49929, 57445, 81604, -5369, 17180, 38655, -76236, + 94489, -8590, -125091, 172872, -33823, 32212, -19327, -48855, -56908, -74625, + -10737, 100932, 17717, -36507, 68719, -76773, 13959, 27380, -10737, 19327, + 59056, -34897, -85899, 33286, -15569, -3221, 21475, -1611, 1074, 24696, + 41876, 18790, 15569, -12885, 2684, -45634, -5369, 15569, -39192, 9127, + 25233, 12348, -2147, 3758, 11274, 2147, + }, + { + 273804, -5436355, -368293, 147103, 176631, -285615, 56908, 510027, 85899, 213138, + 61740, 121333, -104153, 973884, -1280437, 37044, -1068373, -785442, 3089692, 1233729, + -375273, 396748, -292058, -91268, -314606, 155156, -1473174, -432718, 768262, 950262, + 265214, 861678, -202937, 702227, -253403, -186831, 52076, 53150, 99858, 23622, + 19327, 180389, 344671, -114354, 14496, 151934, -96637, 258772, -100395, -51540, + 151398, -123480, 47782, 16643, -44023, 12348, 85899, 143881, 90194, 63351, + 102005, 75162, 22012, 59056, 87510, 14496, 77846, 50466, -32749, 31675, + 17717, -22012, 12885, -19327, -53687, 8053, 79994, 27380, 25233, 22012, + 56371, 14496, -47782, -18254, 33823, -20938, 24696, 537, -22012, 16643, + 9664, 21475, 1611, -13959, -8590, 34360, + }, + { + 1068910, -25136296, 301721, 1481227, -525060, -44560, 309238, 280247, -592706, 278636, + 580357, -95026, -339302, -237297, -241055, -260382, -32749, 286152, 537, -134218, + 13959, 358093, -239981, -367757, 47245, -56908, -70330, 61203, -518080, 13959, + -84289, 100932, -190052, 48318, 144418, -36507, -27917, 69793, -7516, 155156, + -118648, -60130, -100932, 301721, 246424, -255014, -244276, -153545, 8590, 130997, + 56908, -181999, -38118, 97174, -54761, -84289, 24159, 107911, 21475, 30065, + -47245, 0, 79994, 90731, 20401, -73014, -6442, 48318, -17717, -11274, + -13422, 62814, 1611, -23622, 0, -6979, 48318, -1074, -25233, 15569, + 9127, -13422, -78383, -31139, 4832, 40265, 22549, 11274, 15032, -37044, + 18254, -5369, 15032, -12885, -23622, 3221, + }, + { + -264677, 950798, 246424, -454193, -537, -32749, 261993, 158377, 224949, -106300, + -10737, 47782, -92879, -1239098, -2112050, -2356863, 426276, -235686, -866510, 21475, + 331249, 56908, 895501, -551366, 521839, -579284, -90731, 796180, -621160, 36507, + -124017, 162672, -685584, 127775, 482647, 234613, -9127, -2684, -276489, 79457, + 90731, 90194, -69256, -63351, -119722, 139586, 140660, 61740, -22012, -83215, + -172336, -48318, 83752, 54761, -6979, 11274, 75699, 30602, -115964, -26307, + -20938, -31139, 17180, -16106, -49392, -12885, -45097, 104153, 35970, -79457, + -96637, 24696, 73551, -10737, 23622, 33823, 22549, 44560, 16643, 3758, + -4295, -9127, 11811, -22549, -13422, 14496, -9127, -33286, -3221, -34360, + -41339, -40265, -6442, 16106, -21475, 1074, + }, + { + -3492882, 29197188, -24159, 714038, 441845, 300111, 115427, -369904, 42950, -61740, + 238908, -25233, -461709, -191126, 662499, -185220, 106300, -134755, -624918, 31139, + 209917, -126165, 273267, 156766, -30602, -14496, -136365, 184684, -460098, -88047, + 75162, -88584, -91805, 128849, -219043, -82141, -32212, 82141, 137439, 150324, + -33286, -142271, 58519, -220654, -8590, -147103, -8053, -137976, -12885, 139050, + -6979, 54761, -79994, -179315, 37581, 62814, 57445, 55298, -4832, 20401, + -53150, -88047, 35970, 40802, -2147, -6979, -10737, 17717, -41876, -69793, + 12348, 14496, -49929, 94489, 85362, -23085, -12885, 58519, -537, -537, + 33823, 5906, -25770, 5369, 15032, -24696, 26307, 24159, 3221, 5906, + -9127, -4832, 23085, 13422, 10201, 0, + }, + { + -461172, 570157, 2141041, -84289, 162135, -103079, -257698, -265751, 156229, 52613, + -16106, -78920, -343597, 791348, 3123515, -1283122, 2392834, 1218697, -121333, -401579, + 250182, -315143, -1152125, 565862, 337155, 724239, -250719, 727997, 418222, -415538, + 241592, -72478, 343597, -53150, 52613, 67109, -273267, -88047, 130997, -56908, + 216359, -26307, -161061, 120796, 83215, 144955, 12348, -35433, 255014, -48318, + -76773, -158914, -89121, -25770, 77309, 3758, -57445, 2684, 140660, 25233, + -20938, -100395, -105227, -126702, -139586, -46171, -41339, -11811, 46171, -61740, + 7516, 0, -72478, 12885, 45097, 19864, -67646, -23622, -2147, 3221, + 23085, -49392, -59593, 22012, 1611, 14496, 43487, 44023, 13959, -11811, + -6979, 15569, -11274, 19327, -8053, 11274, + }, + { + -2329483, -4128537, 2047626, 1147830, 222265, -290984, -350040, -297427, -219580, 53150, + 187905, 184684, 88584, -321049, 963683, -656056, -733366, 322659, 171262, -165893, + -66035, 154082, 209380, -20938, 137439, -114354, -336081, 70330, 119722, -46708, + 156766, -30602, 140660, 279173, 138513, -123480, -257161, -18790, -10201, -172872, + 277025, 39192, 147640, -49392, -63351, 312459, -38118, -118112, 61203, 197569, + 29528, 9127, 96637, 35970, -26844, 57982, 66572, -41876, 9664, 1074, + -94489, 77309, 30602, -14496, 29528, 8053, -16643, -22012, 4832, 80531, + 3758, -17180, 12348, 28454, 0, 11811, -2147, 15569, -44023, 0, + -42950, -32212, 11811, 24159, 0, 52076, 48855, 24159, 31139, 14496, + 8053, 3758, -37581, -11274, 18790, 18790, + }, + { + -128312, -938987, -991064, -1695438, -75699, 389231, 407485, 232465, -12348, -79457, + 437013, 323733, -343061, 881005, 719944, -252866, -988916, -1030255, 180389, 244813, + -650688, -38118, -22012, -401579, -139050, 190052, -354335, -299574, -335544, -634581, + -85899, -68719, -126702, -107374, 32212, 164283, -133681, -71941, -119185, -237834, + 161061, 26307, 47245, 27380, -134755, 47782, 23622, -68719, 537, 39728, + 153008, 77846, -98247, -121333, -76236, -7516, -39728, 20401, 50466, -14496, + 119185, 36507, -103079, -53150, 77846, 49929, -20401, 60666, 83752, 2684, + 6979, -32749, -32749, 9127, 34897, -9664, -27380, -76236, -38118, 18790, + -26844, 31139, 28454, -33823, -54761, 0, -9664, -16643, -4832, -43487, + 537, -7516, -6442, -537, 5369, 14496, + }, + { + -1060320, -3312494, -2283312, 33823, 388158, 1463510, -267899, -459562, 210453, 95026, + -100932, -580894, -111132, -298500, 351114, -202937, -119185, -263604, -18254, -156766, + -200790, 136902, 151934, -193274, 135828, 19327, -65498, 265214, -51003, 19864, + -38655, 79457, -92879, -98247, 184684, 148176, -111669, -216359, -79457, -61740, + -196495, 10201, -39192, 125091, -125091, 77846, 42950, 19864, 25233, 62277, + -99858, 127238, 30602, 90194, -53687, -49392, -32749, 66572, -62277, -64961, + 39192, 8590, -16643, 40802, 26844, -83752, -11811, -15032, -38655, 10737, + 33823, -30602, 4295, 9127, 29528, 24159, -29528, -28454, -26307, -20401, + -13422, 30065, 40802, -17180, 28454, -3221, -35433, 18790, -17717, -1611, + 36507, 21475, 38655, -8590, -19864, 4832, + }, + { + -20401, 1828582, -101469, 759672, 246961, -70330, 323196, -347355, 17180, -150324, + -187905, 294742, 790811, 2081985, 1822140, -1732482, 1360968, 377420, 572841, 623307, + -845035, 605054, -795106, -1467268, -756988, -199716, -55835, -906238, 595390, 58519, + -261993, -100932, 175557, -37581, -15569, 126165, -44023, -21475, -162135, 32749, + -31675, -31675, 155693, 139586, 118112, 40265, -45634, 83215, -135828, -68183, + 53687, 96100, 113280, -22549, -51003, 108448, -4832, -125628, 18254, -32749, + -82141, -24159, 106300, 54761, -30065, -54224, -16643, -75162, -60130, 23085, + 22549, 1074, -33823, -31675, 18790, 79457, 60666, -4832, -20401, -15032, + -36507, -47245, -32212, -25233, -14496, -2684, 1611, 32212, -38655, -537, + -5906, 537, 59056, 17180, -35970, 39192, + }, + { + -399969, 2516314, -387621, -1212791, -130460, 1803349, 603443, -36507, 58519, 754841, + -297427, -18254, 186831, -836445, -253403, 145492, -656593, 89121, -38655, 19864, + 183610, 149250, 82678, -223875, 480499, -119185, -42950, 421981, 281320, 80531, + 62814, -91805, -171799, -37044, 61740, -12348, 71404, 41339, -37044, 98784, + 301185, -171799, 162672, -64961, -148713, -204548, -50466, -90731, 79457, 135828, + 53687, -170188, 30602, 73551, -19864, -111132, -110595, 32212, 85362, -41339, + 69793, 19327, 28991, -40265, -56371, -82141, -61203, 52613, 14496, -16643, + -53150, 44023, -1611, -3221, -63888, -32212, 18790, 39728, -34360, -60130, + -32212, 6442, -29528, -34897, 4295, -28454, -32749, 60666, 22549, -18790, + 15569, 1611, -30065, -13959, -10201, 4295, + }, + { + 97174, -1235877, -1105954, 477815, -67109, 143881, 62277, -557809, -286152, -444529, + 155156, -106837, -434329, 3006477, 576063, 3223910, -485868, 501974, -85899, -592706, + -544387, 398358, -445066, 421444, 726923, 1057636, -1071058, 222801, -568009, 213138, + 465467, 183073, 166430, 397284, -560493, 59056, 761820, 260382, -226560, 19864, + -13959, 166967, 161598, -72478, -86436, 34897, -173946, 114890, 165356, 57982, + 62814, -5369, 163209, 66035, 28991, -84289, 28454, 64425, 14496, 98247, + 115964, -537, -63351, 59593, -4295, 13422, -104690, -93952, 52076, 22012, + -38655, -22549, 73551, -19327, 45634, 1074, -63351, 18254, 77846, 47782, + 5369, -26307, -47782, -12348, 15032, -5369, 13422, -3758, -32749, -11811, + 1074, -16643, -9127, 17717, 0, -9127, + }, + }, + { + { + 2058363, 12707198, -8399345, 1435593, -59056, -122943, 346819, 184147, -275952, 31675, + 220654, -269509, -36507, 387084, 607201, -529355, 388695, -112743, -209917, -45634, + -953483, 370978, -267899, -537, 85362, -122407, -34360, 300111, 252866, 420370, + 179852, 237297, 28454, 277025, -376347, 147640, 95563, -43487, 112206, -11274, + -120259, -19327, -48318, -82678, 537, 95563, -42413, -33823, -26307, 12348, + -122407, -74625, 3758, -20938, -105227, 9664, -21475, -31675, -41876, 62814, + 65498, -24159, -65498, -15569, 62814, -6442, 97711, -23622, -56371, 3758, + -8053, 24696, 19327, -18254, -40802, -35433, 22549, -18790, 12348, 51003, + 38118, 28991, -18790, -2684, -22012, 28454, 16643, 10201, 23622, 14496, + -11274, 5906, -4832, -14496, 0, 14496, + }, + { + 21475, 4876399, -468688, 1198296, 72478, -122407, 164283, 245887, 52613, 147103, + -148176, 242129, -289373, 149787, 1124745, -532576, -20401, -267362, -930934, -122943, + -344134, 0, -463320, 219580, 198642, -51003, 373125, 148713, 235149, -330712, + 161598, -82141, 136365, 52613, 199179, -50466, -117038, 2684, -21475, -347355, + 51003, 309775, 52613, -141734, 157303, -8053, 35433, -40265, -49929, 46708, + -53687, 97711, 136365, 154619, -207769, -66035, 39192, -100395, -53150, 26844, + 39728, 14496, -33823, -32749, 78383, -45097, 74625, 11274, -35970, 12348, + 26307, -25770, -48318, -7516, 48318, -44023, -70330, -8053, 35433, 38655, + -20938, -33823, 35433, 16106, 13959, 33823, 537, -10201, 32749, -8590, + -36507, 2147, 26307, 23622, 537, -22012, + }, + { + 1131187, 3338800, -233002, -820339, 1054951, -456340, 285078, -178241, -17717, 138513, + 378494, -295816, -190052, 680752, 621160, 935766, 374199, 45097, -2147, 112206, + 105764, 230854, -185757, -54761, 112743, 260919, -54224, 190052, -48855, -83752, + -43487, -104153, 233539, 6442, -479426, 77846, 407485, -200790, 24159, -81068, + -41339, -18254, 69256, -8590, 79994, 71404, 75162, -29528, 113817, -197569, + 158914, 97174, -11811, 24696, 111669, 5369, -46708, -82141, -48855, 41339, + -32212, 98784, 537, -8053, -37044, 11274, -25770, -52613, 97711, -13959, + -49392, -2684, 75162, -55298, 4832, -5369, -40802, 66035, 4832, -24696, + 34360, 38118, -5369, -27380, 12885, 45097, 12885, -22549, -20938, 12348, + -30065, -32212, 18254, -11811, -7516, 13422, + }, + { + 2403034, -24460376, -220117, -581968, 489626, -106837, -16643, 61203, -8590, 86436, + -120796, -47782, 576063, -366146, -99321, -89657, 318901, -405874, -140660, 2684, + -257698, 274878, 128849, -38655, 110595, -168577, 66572, -96100, 212601, 46708, + 47245, -48318, 39728, -81068, -111669, 75699, -149787, -15032, -32212, 268435, + 0, -262530, 178778, 214748, 107911, 216359, 25770, 53150, -9664, -68183, + 27917, -83752, 2684, 108985, -53150, -39192, -33286, 8590, -126165, -51003, + 55835, 89657, -10737, -16643, 59593, -33823, 60666, -22549, 33823, 16106, + 11274, -81604, -58519, 56371, 5369, 29528, 10201, 5369, 6442, 35433, + 33823, 9664, -33286, -25233, 6442, -36507, 11811, -18790, -34360, 23622, + 24159, -3221, -1074, 9664, 2684, -19327, + }, + { + -178778, -4602595, 799401, 271120, 50466, -136365, 195958, 424665, 184684, 39728, + -68183, 86973, -216896, 768799, -1088237, -1061931, -1227287, 1309965, 38118, 410169, + -746251, 336081, -253403, -140660, -137439, 721018, -143881, -367757, -22549, -18254, + -24696, 396211, -256624, 488553, -178778, 309238, 308164, 17180, 19327, -106837, + -54761, 104690, 91805, -246424, 9127, 90731, 25233, 269509, -213675, 77309, + 135291, -52613, 170188, -40265, -26844, -28454, 77846, 93952, 4295, -537, + 11811, -32212, -51540, 79994, 116501, -27380, -5906, -32749, -537, 60130, + -68719, -59593, -537, 6442, -37044, 40265, 51003, 34897, 61740, 4295, + 32212, -28991, -52076, 11811, 8590, -3221, 26307, -13959, -8053, 13959, + 12885, 28454, -11811, -24159, 12885, 24696, + }, + { + 4021163, -21920976, 504122, 1734093, -296890, -24159, 115427, -287763, -249645, 695248, + 344671, -319438, -333397, 74088, 3758, -408559, -21475, 403190, 15569, 97174, + 121870, 120796, -332860, -338229, 47782, 9127, -11274, -276489, -391379, 219043, + -16643, -25233, -255014, 38655, 19327, 20401, 24696, 28991, -18790, 130460, + 135828, -25770, -113817, 83215, -2684, -193274, -61740, -96100, 4832, 121333, + 1074, 38655, 119185, 71404, -28454, 92342, 95563, -8053, -66035, -52076, + -70330, 40265, 76773, 69256, -16106, -44560, 45634, 26307, -5906, -8053, + -537, 31139, -3758, 10737, -5906, 34897, 34360, -23085, -38655, 18254, + -21475, -41876, -62277, 28991, 18254, 31139, 2147, 27380, -26844, -18254, + 30065, 4295, 6442, -32212, 1074, 17180, + }, + { + -114890, 1787243, 40802, -383326, -29528, -51003, 180389, 102542, 108985, -132607, + -49392, 10737, -134755, -915365, -446677, -2218888, 1082869, 13959, -987843, -194884, + 351650, -98247, 660351, -1534914, -273267, -454730, -41876, 546535, -65498, 1061394, + 421444, 191126, -727997, 552977, 361851, -186831, -229244, 56908, -234076, 291521, + -35970, -235686, -17180, -38655, -6442, 118112, 70867, 12348, -11274, -79994, + -112206, -6442, 36507, -9127, 28991, 35970, 120259, 22549, -3758, 51003, + -25233, -58519, 14496, -17180, -68719, -1611, 44023, 55298, -42413, -121870, + -48318, 73551, 15569, -11811, 34360, 1611, 56908, 52613, 0, -15032, + 22549, -8590, 6979, -16106, 3758, 10201, -29528, -36507, -30065, -41876, + -31139, -12885, 17717, -4295, -19327, 5906, + }, + { + 291521, 32250372, -310311, 539018, 311922, 177704, -84289, 155693, -61203, 9127, + 394063, -467078, -121870, 250719, 230318, -351114, 48855, -112743, -190589, 84289, + 38118, 1611, 140123, -278099, -529892, 31675, -237297, 140123, -245887, 195421, + 51003, -13959, 129386, 160524, -101469, 187905, -45634, 105764, -54224, -79994, + -48318, 1611, 41876, -234613, 212064, -323196, -69793, -230854, 35433, 187905, + 11274, -49929, -107911, -60666, 30602, 45097, 50466, 41876, 8053, -15032, + -71941, -3221, 54761, -46708, -67646, 0, -11274, 27917, -2147, -23085, + 20401, 10737, 1074, 114890, 8053, -51540, 58519, 16106, -44023, 18790, + 17180, -19327, -12885, 5906, 1611, -5369, 20401, 0, 14496, 5369, + -18254, -9127, 18790, 18254, -4832, -15032, + }, + { + -134755, 1882269, 358630, -688805, 97711, -88584, -88584, 49929, 183610, -38655, + -94489, -98784, -501437, 168577, 2534568, -5063230, -1031329, 1085553, 106300, -144955, + -46708, -639950, -729071, 1572495, 287763, 1049046, 204011, 310311, 354872, -264677, + -217433, 63888, 297427, 47245, -84289, -183610, -228707, -22012, 537, 75162, + 291521, -109522, -156229, 38655, 141197, 165356, 37044, -133144, 141197, -181462, + -98247, -134218, 28991, -40802, -3758, 2147, 121333, 125091, 95563, -66572, + -60130, -4295, 9664, -119185, -45097, -9664, -71404, 7516, 7516, -67109, + -44560, -25770, -9127, 95563, 52613, -4295, -33286, 26844, -3758, 4295, + -6979, -78920, -28991, 28991, 4832, 24696, 57982, 7516, -22549, -10737, + 8053, 4832, 2684, 23622, 9664, 18254, + }, + { + 1972464, -1752347, -1442572, 936840, 646929, 616865, -10201, -190589, -86973, 354872, + -63351, 145492, -537, -716723, 820339, -511101, -409633, 288300, 101469, -141197, + 181462, 139586, 132070, -125628, 137439, 41876, -333397, 42413, 312459, -106300, + 81068, -191126, 49392, 192200, -84289, -247497, -134755, 151934, -122407, -46171, + 317291, 34897, -65498, -52613, 169651, 297963, -167504, -198642, 93952, 243203, + -4832, 0, 170188, -82141, -158914, 38118, 16643, -104153, 1074, -14496, + -37581, -1611, 15569, -16643, -40265, 47782, -4295, -31675, 30065, 39728, + 25770, 1611, 37581, -10201, 22549, 8590, 14496, -47245, 11274, -19327, + -47245, 537, 42950, 0, 33823, 55298, 28991, 13959, 35970, 6442, + 537, -18254, -22012, 5906, 19327, 24159, + }, + { + 169114, -317828, 639950, -1131187, 119185, 22012, -249645, 297963, 285078, 278099, + 84289, 114890, 22549, 148713, 591632, -149787, -259309, 112206, 606664, -580894, + -469762, 449898, -2147, -336618, 126702, 453656, -741956, -192200, -167504, -434865, + 143345, 143345, -13422, -56908, 74088, -4295, -204548, -12885, -8590, -29528, + -72478, -113280, -5906, 9664, -132070, 61740, 20401, -5369, 90731, 102542, + 96100, -20401, -61740, -40265, -31675, -67109, -5369, 56371, 21475, -49929, + 155156, -39728, -125628, -25770, 103079, -3758, 40265, 74625, -6979, -31675, + -35970, -20938, 22549, 33286, 11811, -53150, -34360, -64425, 18790, 22012, + -10201, 46171, 20938, -62814, -34360, 10201, -18254, -5906, -15032, -26844, + 10737, -12885, -1611, 3221, 26844, -15569, + }, + { + 1219234, 781684, -841814, 543313, 509491, 505196, -586800, -165356, 250719, 162672, + -244813, -325344, 75699, 178778, 427886, 91805, 519691, -357556, 98784, -172336, + 121333, 268435, 151934, -201327, 249108, -34360, 92879, -77846, -141734, -2684, + -26307, -76773, -227096, 84826, 77309, -59593, -272194, -68183, 103079, -25233, + -9127, -1611, 99858, 140123, -137439, -136365, 3758, 79457, 6979, 65498, + 66572, 76236, 93416, -51003, -31675, 27917, 5906, 4832, -106300, -3758, + 71404, -12348, -3221, 76236, -1074, -59593, -6442, -19864, -22549, 67646, + -10201, -26844, 27380, 6442, 25770, 12348, -14496, -28454, -9664, 7516, + 19327, 47782, -3221, -12885, 22549, -26307, -9664, 12348, -12885, 18254, + 23622, 20401, 16106, -16643, -6979, 11811, + }, + { + 70330, 1740536, -199716, 1052804, 206158, 47245, 279710, -260919, 231391, 86436, + 97174, 388695, -305480, -610959, 1143535, -2042257, 1025960, -205622, 186294, 495532, + -1648194, 2137820, 645856, -416075, -116501, 98247, 117575, -596464, 314606, 740345, + -5369, -89657, -8590, 42950, 30602, 98784, -10201, -113280, 25770, 83752, + -63351, -129386, -24696, -41876, 9664, -82141, 41876, 172872, -141734, -93952, + 100932, 151398, 22012, -52076, 54224, 82678, -75162, -64425, 18790, -70867, + -31675, 45634, 32749, -32212, -37581, 15032, 4295, -75162, 23085, 5369, + 9664, -20938, 4295, 6442, 49929, 53687, 46708, -25233, -18254, 18790, + -47782, -54224, -32212, -28454, -4832, -8053, 33823, 8590, -20401, -6979, + -15569, 34897, 55298, -19864, -5369, 38655, + }, + { + 17717, 1621350, -456340, -71404, -289373, 5369, -1173600, 69256, -186831, 141197, + -537, 411243, -411243, 479963, 1781338, -119722, -333397, 187905, -317828, -68183, + 53150, 227633, 58519, 121870, 558346, 35433, 15569, 235149, 222801, -186294, + -53687, 2684, -34360, -96100, 63351, 46171, -112206, -207769, -90731, 61740, + 201327, -35970, 43487, -229781, -153008, -180926, -51540, -45097, 17717, 214748, + -76773, -91268, 81068, -16106, -72478, -101469, -46708, 114354, -16643, -26844, + -9127, -30602, 23622, -73014, -26844, -78920, -15032, 33823, 15569, -69793, + -3221, 11274, 2147, -9127, -49929, -27917, 47245, 9664, -55298, -27380, + 2684, -6442, -55298, -17180, -537, -25770, 23622, 57982, -9127, -6979, + 16106, -19327, -23622, -6442, 20401, 6979, + }, + { + 82141, -1180579, -454193, 509491, -322123, -15569, -66572, -53150, 167504, -321049, + 441845, 279710, -212601, -656593, -5369783, 612033, -1692217, -19864, 47245, -6979, + -434329, 1010928, 369367, -214748, -232465, 815507, -654983, 1065689, -376883, 114890, + 277025, -76236, -158377, 328028, -502511, 330176, 566399, -138513, 13959, 195421, + 39728, 84289, -39728, -300648, 31139, 85899, -215285, 44560, 63351, 16643, + 86436, 35433, 106300, -79457, 10201, -17717, -4832, 5906, 45097, 123480, + 42950, -7516, 11811, 88047, -5906, -10737, -82678, 23622, 42950, 11811, + -69256, 29528, 60130, -40265, 55298, -64961, -2147, 17180, 40802, 2147, + -32212, -23622, -46171, 39192, 11811, 2147, 11811, -11811, -39192, 2684, + 3221, -18254, 4295, 26307, -12885, -20938, + }, + }, + { + { + -691490, 4330938, -881542, -101469, 459562, 315680, 215285, -50466, -27917, -464393, + -351650, 463320, 143345, 136902, 658204, -70330, 64961, 167504, -329102, -823023, + -159988, 140123, 105764, -304943, -3758, 60130, 264677, 185220, 47782, 427886, + 111132, 119722, -150324, -19864, 124017, 49929, 15032, -425739, -41339, 94489, + -119185, 26844, -7516, 3221, -124554, -136365, 46708, 124554, -64425, -113280, + -198642, -91805, 23085, 74088, -7516, 76236, 104153, 133681, 60666, -29528, + -28991, 17180, 46708, 46171, 47782, 28991, -1074, -65498, 4295, 70867, + 37581, -4295, -20938, -26307, 39728, 66035, -46171, -15569, 5369, -52613, + -33823, -52076, 2147, -14496, 7516, 12348, -33823, 10737, -22549, -17717, + -4295, 9127, -1611, 537, 3758, -1074, + }, + { + -48855, 3148748, 612033, -300648, -6979, 291521, 216359, -104690, -38655, 201327, + 70330, 153545, 46708, -353261, 1217086, 1574106, 180389, -103079, 170725, -753230, + -45097, -33286, -403190, 655519, 738734, -663036, -55835, -161061, 177167, 108985, + -198105, -30065, -160524, 148713, 129923, -279173, -209380, -34897, -63351, 5906, + -177704, 68719, -90194, -5906, 56371, -49392, -104153, 15569, 64961, -155156, + 57982, 48855, -88584, -120796, 83215, 215822, -42950, -55835, 26844, 18254, + -154082, -57982, -40802, -12348, 10737, 29528, -26844, -91805, 4832, 11274, + 4295, -40802, 81068, 6442, -18254, -30602, 47782, 44023, 9664, -68719, + -11274, 65498, 10201, -8590, -11274, -26307, -16106, 10201, -25770, -30065, + 37044, 5369, -27380, -45634, -15032, 20938, + }, + { + -1021665, 2455111, 3988951, -685584, -1372779, 19327, -28454, -157303, 361851, 292595, + -129923, -187905, 323733, 467615, 710280, 603980, 146029, -32749, 532576, -112743, + 412317, 365072, -251256, 49929, -537, -290447, -272730, 113280, 150861, 20401, + 74088, 194347, -11274, -204011, 73551, 217433, -63351, 163209, 100932, 14496, + 164819, -88047, 89657, -230318, -112206, -56371, 52076, -13422, -9664, 62277, + 127775, -88584, -89657, 104153, -40265, -42413, -2684, -97711, 83215, -12348, + -49392, -15569, -36507, 17180, 38655, -111669, -47245, 13422, -11274, -54224, + 54224, -14496, -42413, -6442, 19864, 57445, 51540, -21475, -49392, 18254, + 25233, -6979, -4832, 25233, -12885, -17180, -20401, 2147, 16643, -23085, + 5369, 34897, 15569, -5369, 24696, -1074, + }, + { + -6279779, -13621489, 1176284, -355409, -544924, -40265, -122407, -77846, -144418, 55835, + 308164, 206158, 223338, 203474, 187368, 149250, -34360, -184147, 181462, -97174, + 17180, -165893, -15569, 98784, 135291, 133681, -133144, 28454, 537, -303869, + 6979, -137976, -101469, 122943, -102005, -245350, -18790, -101469, 236223, 9664, + -57982, 70867, 81604, 106837, 174483, 36507, -117575, 40265, 2684, -20401, + -84289, 53687, 22549, -67109, 28991, -149787, -44560, -13959, -56371, 38118, + 537, -78383, 1074, -28454, -64425, 15569, -31139, -11274, 55298, -46171, + -51003, 65498, 93416, -6442, 27917, 2147, -10737, 23622, -17180, -17717, + -37044, -34897, -9127, 14496, -1611, 19864, -16643, -3221, 31139, -4832, + -26844, -4295, 12885, -9127, -17717, -5906, + }, + { + 184684, -2092186, -617938, 24159, -165893, 174483, 63351, 136365, 155693, -381178, + 144418, 78383, -26307, -1726577, 1505386, 414464, 858993, -138513, -2199560, 625455, + 84289, 99321, -273267, 85899, 190052, 1050656, 192737, -103616, 250182, -1061394, + 286152, -156766, 122407, -141734, -66035, 561567, -55298, -102542, 40265, -268435, + 44560, 20938, -281320, -245350, 62277, -115427, 141197, 71404, -146566, -53687, + -63351, 139050, 76236, -29528, 40265, 104153, -68719, -7516, 66572, -42413, + -86973, -38655, 7516, -24696, -66572, -100395, -68719, -31675, 73551, -16643, + -14496, 51540, -4832, 57982, 49929, -5906, -42413, -11274, -35433, -55298, + -43487, -4295, 52076, -3758, -18790, 4295, -15032, 5906, 9664, -8053, + -2147, -17717, -4832, 23622, 8590, -38118, + }, + { + -8008504, -6386080, 2169495, 640487, 1018981, 96637, -272730, -455803, 420907, -90194, + -565325, 1074, 81068, 156229, -314069, -102005, 202400, -89657, -14496, 141734, + -237834, -289373, 89121, -144955, -30602, -64425, 128849, -239444, -22549, -134218, + -32749, 159988, 26844, 3221, -81068, -41876, 194884, -28454, 128312, -48318, + 9127, -159988, 94489, 123480, -308164, 82141, 73014, 1074, 43487, -28454, + 104690, 132607, 12885, -197032, 6442, 77309, -91805, -102005, -7516, 13422, + -9664, -27917, -81604, -13422, 25233, 15569, 9127, -38655, 65498, -23085, + -32212, -50466, 26844, 44560, 1074, 38655, -45097, -6979, 28991, 23622, + -6442, 23622, 78383, 55835, -27380, -35970, -11274, -24159, -25233, 37044, + -9127, -537, -13422, 9127, 28991, -3221, + }, + { + 270583, -96100, -555661, 370978, -81068, 73551, -31675, -66035, -26844, 168577, + -112206, -40265, 3221, -646393, 451508, 583042, 282394, -143881, -443455, 179852, + 341987, 511638, -958851, -1117765, -31139, -176631, -70867, 342524, 438624, 671089, + 264677, -82141, 228170, 213675, -311385, -54761, -155693, 13959, -31139, -40265, + -195958, -56908, 45634, 108448, 69256, -130460, -76773, 65498, -30065, 57982, + -35970, 14496, -85899, -81068, 32212, 12885, -34897, 2147, 126165, 62814, + 69793, 56371, 16106, 1074, -11811, 47245, -5906, -100395, -68183, 42950, + 78383, -66572, -60666, -25233, -33823, -52613, -9664, -47782, -38118, 1611, + 19864, -13422, -4295, 10201, -1611, -19327, -2684, 19864, -12885, 32749, + 44560, 36507, 4295, -15569, 15569, -2684, + }, + { + 3827353, 28887414, 1076426, 47245, 30602, -14496, 247497, 366683, -12348, -144955, + -159451, 29528, 411780, -137976, -284005, -24696, -86436, 215285, 450972, -453119, + -126165, 88584, -143881, -486942, -30065, -52613, -210453, -12885, -86973, -79457, + -14496, 274341, 186294, -213675, -30602, -175020, -187368, 144955, -281320, -69793, + 73551, 39728, -16643, -6442, 66572, -191663, -23085, 16643, 17717, -93416, + -53687, -57982, 184684, 115964, -66035, -100395, -30065, -22012, -25770, 53150, + 537, -537, -15569, -113817, -16106, 38118, 13959, -12348, 24696, 55835, + -24696, 4832, 10737, -48318, -84826, 51003, 8053, -85899, 9127, 8053, + -28454, 28454, 16643, 1611, 5906, 23085, -19327, -45097, 7516, -10737, + 2147, 6442, -26307, -15032, -19327, 8590, + }, + { + 450435, 304406, -2209224, -41876, -136902, 86973, 20938, 10737, -172336, -9664, + 130460, 181999, 122407, -230318, 1114007, -4001299, -974958, 1012539, 278099, -322123, + -1046361, 609349, 102542, 578210, -360777, 1326608, 552440, -494458, 414464, -223875, + -54761, 262530, -28991, 359167, -353798, -428960, 155693, -24696, 32749, 162672, + -107374, -188979, -56371, -212064, -115964, -51003, 31675, -2147, -74088, -36507, + -48855, -7516, 50466, -130460, -128849, 89657, 75162, -68719, -32749, -38118, + 97174, 98247, 114354, 45097, 100395, 79994, 31139, 26844, -83215, -9127, + 11811, 47782, 54761, 19327, -67109, -23622, 16643, 2147, 17717, -537, + -25770, 25233, 56371, -1074, 4295, -11274, -45097, -60130, -4295, 16106, + -5906, 2147, 20401, -7516, -537, -24159, + }, + { + -1082869, 1147293, 335007, 969589, -244813, 74088, 371515, 236223, -146029, -162672, + -437550, -307627, -228170, 293132, -14496, -38655, 128849, -469762, -146029, 306553, + 312996, 11811, 32212, -118112, -171262, 128849, 28991, -79457, 60666, -31675, + -163209, -91268, -41876, -411243, -301721, 99858, 108448, 13422, 20401, 33823, + -51540, -89657, -54224, 224949, 76773, -238908, -126165, -2684, 18254, -108985, + -114890, -49929, -110059, -107374, 137439, -26844, -74625, 31139, -20938, 22549, + 83215, -91805, -31139, -31139, 11274, 8053, -21475, 11811, 2147, -47782, + 12885, 28991, 3758, -38118, 4832, -537, -4295, -16643, 33286, -16643, + 35433, 23622, -12885, -28454, -7516, -49392, -48855, -10737, -26307, -16643, + -5906, -1074, 39192, 9664, -16106, -26844, + }, + { + -246961, 1522566, 358630, -1046361, -233539, -176631, -264141, 335544, 5906, 185757, + -451508, 95563, 619549, -222801, 557272, -129386, 353798, 733903, -430034, -253403, + 834834, 340913, -219043, -500901, 171262, -163746, -486405, -10201, -142808, 184147, + 234076, 145492, -67646, 82678, -151934, -85899, 213675, 91805, 140123, 75162, + -70330, -71404, -145492, -59056, -23085, -74088, 47245, 30602, -32212, 16643, + -92342, -56371, 110595, 161598, 61203, -24696, 12885, -31139, -67109, 18790, + -32212, -77309, 46708, 39728, -46708, -50466, 22012, -80531, -62277, -8590, + -22549, 47782, 48318, -6442, -33823, -8053, 27380, 78383, 41876, -26307, + 25770, -13422, -30065, 28454, 44560, 0, 12348, 9664, 12885, 37044, + -4832, -4295, -3221, 537, 4295, -14496, + }, + { + 1074, 3320547, -581431, 1511829, -731755, -449361, 664109, 173946, 330712, -146566, + 198642, 474057, 50466, 476741, 363462, 440234, 285615, -204011, 21475, -248034, + 294742, -98247, -92342, 98247, 537, -44023, 111669, -292058, -27917, 126165, + -18790, 2147, 135828, 354335, -249645, 132070, 246424, 230854, 105764, -31675, + -39728, -12348, 119185, -162672, -70330, -78920, 32212, 26307, -17717, -11811, + -14496, -23622, -42413, -34360, 61740, -29528, 26307, 4295, 42413, 49929, + -64961, 44023, 42413, -49392, -19864, 43487, 37581, 39728, 37581, -32749, + -35970, 22012, -12348, -20401, -26844, -3221, 20938, -7516, 18790, 18790, + 13422, -10201, -48855, 4832, -30065, -5369, 34360, -16643, 11811, -3758, + -32212, -18254, -46708, 1611, 11811, -6979, + }, + { + -93952, 1206349, 1089311, 205085, 93416, -50466, 118112, 141197, 102542, -66035, + 178778, 146566, -925029, 782758, -2240362, -1308891, 709743, 164283, -28454, -390842, + 757525, 963683, -530965, 9127, 254477, -218506, -402116, 359704, -366146, 129923, + 345208, 390305, 56371, 211527, 17180, 321586, -49392, -166967, -141734, -111669, + -50466, -116501, -29528, -117575, 18254, -58519, -114354, -97174, 64425, -78920, + -84289, -109522, -44560, 42413, -21475, -61740, -49929, 121870, -25233, 71941, + 185757, -33823, -169651, -88047, -10201, 51003, -10201, 40802, 28454, -26844, + -13959, -6979, 17717, 23085, -7516, -78920, -46171, -1611, 11811, 4295, + 24696, 52613, 17180, 27380, 17717, 5369, -2684, -35970, 20401, 6979, + 17717, -1074, -63351, -4295, 21475, -37581, + }, + { + -158914, 1936493, -272730, 617938, 289910, -1248225, 163209, -41876, -503585, -188442, + 325344, -245350, -344671, 253940, 2203318, -201863, 568546, 362925, -381715, -15032, + 32749, -10201, -60666, 136902, 177704, 159451, -171799, -198105, -34360, -226023, + 15569, 123480, 253940, 276489, 100395, 56908, 27380, -11274, 211527, -288300, + -47782, -135291, -132070, -31139, 152471, 150324, 163209, 4295, 16106, -48318, + -43487, 124017, -103616, -68719, 52613, 130460, 90731, 17717, -43487, 23622, + -24696, 39728, 29528, 50466, 72478, 75162, 37044, -30602, 2147, -26307, + -6979, -35970, -8053, -18254, 49929, 36507, -537, -45634, 46708, 65498, + 12885, -7516, 44560, 44560, -18254, 32749, 27917, -54224, -12885, 20938, + -17180, -537, 20401, 4295, 3221, -3758, + }, + { + -215285, -759136, 585726, 12348, -49929, -50466, -222801, 443992, 33823, 122943, + 158914, 344134, 846645, -3963718, -4460861, -2588792, 319975, -31675, -92342, 610959, + 467078, 381178, 521302, -504659, -363462, 268972, 71404, 1318555, -392990, 119722, + -341987, -116501, 76236, 27917, -19864, 486405, -465467, -62814, 362388, 1611, + -222265, -178778, -270583, -46171, 83752, -43487, 20401, -44023, 18790, 20938, + -2147, -41339, -198642, -67646, 3758, 92342, -149787, -30065, -73014, -168577, + -92879, 31675, 54761, -17717, -23085, -54224, 130460, 92879, -85899, -26307, + -6442, 4832, -98247, -27380, -45634, -19864, 78383, -44560, -34360, -48855, + 23622, 47782, 48318, 19327, -45634, 9127, -30065, -9127, 24696, 9664, + -8053, 16106, 8053, -18790, -1611, 9664, + }, + }, + { + { + 1556389, 7426536, 3563749, -209380, -343597, 181999, 47245, -76773, 26844, -471910, + -84289, 518617, -10201, -165893, 63888, -23085, -350577, -14496, 32749, -361314, + 255551, 83752, 133681, -362925, -63888, -47782, -13959, -77846, 19327, 346282, + -22012, -132607, -361314, -190589, 280784, -100932, -45634, -359167, -36507, 28991, + -12885, 128849, -82141, -54224, -165893, -112743, 40265, 128312, 30602, -87510, + -110059, -25770, -16643, 132070, 70867, 47245, 92342, 124554, 48855, -68719, + 12885, 15569, 62814, 16643, -16106, -22549, -41339, -44023, 18254, 41876, + 6979, -30065, -12885, -6442, 36507, 25770, -61740, 12348, -19864, -59056, + -35970, -31675, 18790, -15569, 9664, -22549, -12348, 0, -24159, -16106, + 3221, -3758, 14496, 10737, 0, -8590, + }, + { + 173946, 248571, -1688459, -528818, -97174, 99321, -26307, -213675, -19864, 248034, + 361851, 71941, 16106, -161061, 1842541, 2051384, -20938, -419833, 59056, -673236, + 150324, 505196, 241055, 409096, 457414, -344671, -286689, -226560, 252866, 156766, + -220117, -686121, -362925, 299574, -183610, -74088, -46171, 94489, 158914, 187368, + -217970, -138513, -118648, 84826, -38655, 7516, -92879, 93416, 63888, -127775, + 89657, -40265, -141734, -105764, 239444, 204548, 5369, 40802, 47245, -51540, + -130997, 22012, 7516, -14496, -45634, 14496, -49392, -41339, 19327, -19864, + -3221, 6442, 38655, -13959, 2684, 22012, 62814, 15569, -14496, -42413, + 19327, 58519, -15032, -6979, -25233, -27380, 5906, 4832, -44023, 0, + 37044, -13422, -35970, -34897, 0, 26307, + }, + { + 602369, -1411971, -1285806, -823023, -544924, 103616, -27917, -125628, 179315, -26307, + -213675, 54761, 278099, -31675, 204011, 170725, -287763, -297963, 743566, -650151, + 106300, 73551, -244276, 186294, 92342, -260919, -248571, 163209, 84826, 165356, + 262530, 95563, -22012, -124017, 208306, -70867, -179315, 198642, 71941, -19864, + 96100, -227096, 26844, -168577, -190052, -88047, -3221, 10737, 24159, 61203, + 35970, -25770, -82141, 35433, -50466, 60666, 6979, -68719, 82141, -39728, + -75699, -26844, -40802, 35970, 38655, -70867, 11274, 25770, -48855, -15569, + 71941, -52076, -47245, 22012, 19864, 48318, 2147, -49929, -16106, 22549, + -1074, -23622, 19327, 31139, -24696, -26844, -16106, 23085, 5369, -17717, + 24159, 31139, -12348, 6442, 19327, -13959, + }, + { + 7829189, 2540473, -2046015, 175557, 327491, -42950, -90731, -15032, -27380, -193274, + 27917, -22012, -237297, 249108, 93952, -384936, -95563, 69793, 272194, -130460, + 101469, -97174, 104690, 141734, 103616, -10737, -373125, 114354, -214212, -167504, + 127238, -122943, -20401, 195421, -34897, -225486, -162672, -9664, 153008, -101469, + 10201, 55835, 103079, -35433, 6979, -124017, 9664, 29528, 32749, -9127, + -97711, 119722, -62814, -57982, 20938, -51003, 37581, 35970, 53687, 56908, + -1074, -69256, 30065, -24696, -47782, 19327, -47782, 29528, 17180, -24159, + -33286, 60130, 59593, -35433, 11274, -23622, -4832, 8590, -33823, -23085, + -24159, -25233, 17717, 5906, 4832, 34360, -23085, 27917, 15032, -22549, + -25770, 5369, 3221, -14496, -6979, 9127, + }, + { + -384936, -318364, 840203, -214212, 5369, 117575, -143345, -87510, 34897, -331249, + 62814, 157840, -147640, -241592, 2811593, -349503, 504659, -902480, 208843, 335007, + 180389, 435402, 143881, 623307, 114890, 405338, -440771, -256087, -189515, -1421634, + 226560, 51003, 183073, -270583, -226023, 364535, -18790, 90194, 100932, -226023, + -9127, -44560, -176631, -25770, 94489, -91805, 47782, -45634, -43487, -117038, + -19327, 112743, -78920, -10737, 28991, 102005, -122943, -24159, 61203, -26844, + -21475, 13959, -13422, -78383, -73551, -32749, 2684, 10201, 31139, -31139, + 66035, 60130, -5906, 30602, 24696, -38655, -51540, -28454, -44023, -17180, + -16106, 28991, 44023, -31675, 1074, -9664, -11811, 22549, 1611, -16106, + -13959, -24696, 7516, 27917, -17717, -31675, + }, + { + 8542153, 13803488, 87510, -615254, -591632, 54224, -267362, 82141, 231928, -622770, + -491237, 229781, 185757, 527207, 172336, -20938, 8053, -411780, -53687, -64961, + -361314, -199179, 112206, -89657, -91268, -15569, 233539, 3758, 26307, -143345, + -47245, 235149, -11274, -233002, -148713, -71404, 113817, 3221, 207232, -134218, + 30065, 9127, -13959, 153545, -223875, 134218, 45634, -9664, -20938, -92342, + 113817, 38655, -59593, -172872, 35970, -37581, -130997, -29528, 46171, 38655, + 23622, -24696, -94489, -42950, 57445, 19327, -25770, -12348, 58519, -8590, + -23622, -26307, 22012, 19327, 3758, -10201, -33286, 16106, 43487, 12348, + 3758, 37044, 59593, 6442, -30065, -25233, 9664, -30602, 10737, 19327, + -18790, -4832, -5369, 26844, 10737, -10201, + }, + { + 137439, -555125, -11274, 286689, -33823, 26844, -135828, -198642, -17180, 234076, + -33823, -60130, -54761, 28454, 568009, 1404991, 10201, -146029, -17717, 98247, + -74088, -536334, -1114007, 90194, 165893, -306016, -415538, 137439, -294205, -126165, + 37044, 162672, 425739, -90731, -200790, 180389, 32749, 56371, -83215, -128312, + -15032, 200253, 22549, 98247, -45634, -201863, -61203, 91268, -50466, 108985, + -37581, -17180, -89121, -13422, 1074, 8053, -45634, 40802, 16643, -32212, + 58519, 68719, -14496, 2147, 31139, 14496, -57982, -26844, -8053, 72478, + 52613, -89657, -37581, -34897, -42950, -44023, -39728, -54761, -12348, 19327, + -3758, -9664, 9127, 21475, -6442, -8590, 15569, 26307, 15032, 41876, + 34897, 12348, -16106, 2147, 14496, -3221, + }, + { + -7713762, 15267535, 1941325, 73551, -71941, -2147, 452582, -63351, 57445, -176631, + -183073, 526134, 226023, -215822, 245887, 151398, -9127, 219580, 261456, -401579, + 47782, 71941, 18254, -137439, 222801, -206695, 2147, -69793, -183073, 104690, + 145492, 176094, 40802, -350040, -129923, -343061, -250719, 208843, -99858, 23085, + 135291, 537, -101469, 55835, -25233, -50466, 64961, 75162, -117038, -117575, + -44560, 15569, 184684, 26844, -43487, -50466, -6979, -26307, -27917, 41339, + -4295, -17180, -29528, -40265, 25770, 14496, 26307, -16106, 0, 22549, + -34360, -5906, -42950, -70330, -37044, 61203, -61740, -50466, 39192, -9664, + -25770, 27380, -1611, -5906, 16106, 2147, -24159, -20401, -3221, -12885, + 3221, 3221, -21475, -15032, -3758, 23622, + }, + { + 151934, -1246077, -1124745, 505732, -75162, 118112, 17180, -70330, -203474, 104153, + 227633, 117575, 1074, -1759326, -425202, -797790, 430570, -142808, 158914, -447750, + -1020055, 879395, 785979, -143345, -947040, 944356, 56908, -318364, 127238, -373125, + -39192, -70330, 37581, 303332, -234076, -125091, 172336, -117038, 300648, 45097, + -226023, 70867, 48318, -234613, -207769, -56371, 41876, 156229, -75699, 3758, + -19327, 27380, -11274, -67109, -32749, 75162, -18254, -155156, -28454, -8590, + 93416, 70330, 121333, 88047, 51540, 45097, 20938, -5369, -77846, 3221, + 51540, 41339, -9664, -61203, -64425, 9127, 4832, -27380, 8053, -11811, + 6442, 56371, 28991, -8590, 3221, -41339, -62277, -27380, 19327, 13959, + -18254, 9127, 5369, -13422, -8053, -29528, + }, + { + -12348, 1018444, -1868311, -93416, -624381, -727997, 45634, 270046, -208843, -296353, + -240518, -268435, -104690, 550293, -168577, 101469, 213675, -418759, -122943, 338766, + -117575, -270046, -80531, -97711, -143881, 137976, 128312, -140123, -11274, 161598, + -74625, -84289, -36507, -261456, -197032, 202400, 144418, 44023, 248034, 9664, + -45634, -67109, 83752, 202400, -131533, -199716, 117575, 76236, -75162, -184684, + -41876, -17717, -113817, 1611, 130997, -95026, -18254, 70330, -45634, 28991, + 40265, -18790, -26307, -28991, 70867, -33286, -10201, 15569, -52076, -31139, + -15032, 1611, -23622, -2684, -5906, -4832, -30065, 34360, 3221, 19864, + 45634, 3221, -37581, -17180, -35433, -52613, -37044, -1074, -26307, -5369, + 5906, 13959, 23085, -3758, -17717, -25770, + }, + { + 230854, 3344706, 948114, -74088, 6442, -192200, -99321, 244276, -253940, -47245, + -265214, 156766, 317291, -204011, 644782, 352724, 307090, 241592, -519691, 503048, + 824097, 273804, 135828, -75699, 296890, -129386, -185220, -112206, 131533, 479426, + 85899, 41339, -82141, 70867, -363462, -77309, 243739, 44023, 151934, 51003, + 121333, -36507, -24696, 81068, 4295, -113280, 41876, 24696, -123480, -91805, + -82141, 5369, 119185, 122943, 15569, 32749, -19864, -59593, -34897, 47782, + -99858, -22012, 68719, -1074, -83752, -537, -43487, -109522, 1611, 3221, + 2684, 44023, 0, -35433, -20938, 34360, 36507, 67109, -5369, -21475, + 15032, -30602, -26307, 53150, 36507, -6442, 15032, 1611, 23085, 22549, + -12885, 7516, 1611, 1611, -15032, 11274, + }, + { + -1955284, 2288144, -78383, 383326, -1112933, -227096, 520765, -162135, -38655, -143881, + 271657, 147640, -3758, -9127, -112743, 176631, 65498, -30602, -76773, -76773, + 172872, -291521, -128312, 158377, -113280, -66572, -63351, -91805, -137439, 71941, + 15569, 184684, 180926, 147640, -265751, 62277, 362388, 316754, -53687, -8590, + -38118, -37581, 34360, -58519, -1074, 4832, -25233, -16643, -40265, 34360, + -42950, 16643, -119722, 33286, 71941, -20938, 33286, 60130, 82678, 13422, + -81604, 60666, 1074, -76773, 23085, 19864, 17180, 31675, 3758, -88584, + 3221, 15032, -24159, -4832, -21475, 2684, 23085, 13422, 11811, -537, + -10201, -35970, -9664, 13959, -33823, 17717, 16106, -11274, 9127, -18790, + -28454, -25233, -28991, 9664, 8053, -10737, + }, + { + 92879, 363998, 43487, -272730, 47782, -192200, 99321, 156766, 83752, -177167, + 16643, 168577, 109522, 2365990, -2307471, 164819, 534187, -94489, -265214, -628676, + 1793686, 261993, -1520418, -540629, 130997, -339302, -121870, 455267, -485331, -186294, + 508417, 282394, -11811, 41876, -130460, 232465, -128312, 58519, -225486, -66035, + -13422, -93952, 45097, -71941, -30065, 28991, -105764, -35433, 174483, -3221, + -74088, -118648, 1074, 79994, -25770, -63351, -17180, 82678, -35970, 105764, + 107374, -94489, -117038, -16106, 56908, 28991, -27917, 49929, -12885, -3758, + -23085, -1611, -10201, 2147, -35433, -60666, -35970, 10737, 22012, -5906, + 39728, 45634, 15569, 31675, 4295, 18790, -23622, -13422, 11811, 9127, + 19327, -34897, -63888, 22549, -2684, -37581, + }, + { + 500364, 2739116, -1061394, -228170, 326954, -645319, 1085553, -72478, -484258, -195958, + -157303, -541703, 192737, -768262, 835371, -66572, 217970, 428423, -192737, -80531, + 48855, -49392, 90731, -20938, 175020, 32749, -389768, -433792, -18790, 129923, + -42950, 134755, 275415, 253940, 45634, 120796, 98784, -13959, 132070, -352187, + 4832, -320512, -82141, 162135, 264141, 154082, 101469, -37044, 50466, -133681, + 110595, 83752, -108985, -19327, 85362, 164819, 57445, -47782, 16643, -35433, + 28454, 38655, -13959, 79457, 45634, 68719, -8053, -28454, -3758, 30602, + -30065, -17180, -19327, -6442, 49392, 38118, -35970, -27380, 59056, 42950, + -3758, 10737, 62277, 12885, -10737, 35433, -24159, -52613, 15032, 16106, + -14496, 13959, 16106, 3221, -17180, 1074, + }, + { + 109522, -30602, 409096, -192200, 31139, -73014, -70330, 517007, 260382, 271657, + -376347, 67646, 710817, -95563, 3961571, -826244, -1611, -68183, 94489, 898722, + 404264, -139586, 582505, -230854, -344671, 459562, -101469, 744103, -312996, 111132, + -250719, -8053, 54224, -31139, 70867, 237297, -479426, 15032, 127775, -2684, + -326418, -174483, -43487, 212601, -24159, -78383, 104690, -24159, -44023, 3758, + -12348, -20401, -139586, 33286, -8590, 48855, -157840, 4832, -97711, -171799, + -30602, 34360, 4832, -16643, 9664, -25770, 146029, -3221, -67109, -11274, + 5906, -29528, -86436, 8590, -46708, 38118, 32749, -48855, -21475, -25770, + 43487, 38655, 47782, -14496, -34897, 2147, -30065, 537, 40265, 4295, + -6442, 19327, -537, -23085, 15569, 16106, + }, + }, + { + { + -1933272, 23130010, -1709397, -1115618, 722091, -237297, 114890, 219580, -59056, 24159, + 349503, -117038, -193274, 315143, -775242, 303332, -419296, -260919, -201327, 580357, + 149787, -161061, -5906, -220654, -17717, -244276, -65498, -173409, 180926, 313533, + 99321, -247497, 134218, -193810, 22012, -126702, 198642, -8053, -60666, -245887, + -17717, 148713, -77846, -37044, -46708, 41339, -60666, -103079, 192737, 4295, + 56908, 12348, -121870, 105227, 47245, -65498, -25233, -59593, -55298, 3758, + 108985, -6442, -35433, -86436, 1074, -56908, 27380, 25233, -21475, -31139, + -40265, 537, 15032, 2147, -56371, -74088, 42413, -9664, -16643, 49392, + 31139, 57982, 3221, -10737, -22549, -4295, 33823, -14496, 34360, 13422, + -1611, -4295, 10737, -2684, -5906, 9664, + }, + { + -202937, -1863479, 1013612, -128312, 267899, -114890, -234613, 30602, 146566, 74088, + 361851, 260919, -320512, -280247, 1620276, 430570, -467078, 89121, -825707, -541703, + 103616, 671626, 60666, 71941, -264677, 220117, -250182, 491237, 44560, -25770, + -126702, -872415, 162672, 69793, -217433, 355409, 164283, 187368, 137439, -210453, + 11274, -28991, 258772, -11811, -89121, 63351, 537, 39192, -33823, 79457, + 20401, -54761, 98247, 125628, 30065, -121333, 47245, 54224, -33286, -23622, + 49929, 99321, 16643, -35970, 0, -41876, 16643, 94489, -1074, -38118, + 23085, 17717, -86973, -40265, 60130, 18254, -38118, -38655, 8053, 69793, + 4295, -40802, 9664, 17717, -1074, 31675, 23085, -18790, 22549, 22549, + -42413, -12885, 20401, 31675, 15032, -13959, + }, + { + -433792, -6602439, 1647120, 923955, 668404, -182536, 84826, -90194, -260382, -363998, + 253940, 224412, -312459, 387621, 81604, 387084, -372052, -203474, 375810, -590021, + -473520, 168577, -213138, 201327, 304943, 145492, -105227, 271120, -281320, 195421, + 169114, -145492, 136902, -13959, -204011, -23622, 141734, -103079, -3758, -143345, + -168577, -121333, -92879, 91268, -28454, 65498, -61740, 99858, 59056, -25770, + -20938, 184147, -31139, -31139, 84289, 65498, -4832, -41876, -32749, -46171, + 9127, 45097, 8053, -13422, 0, 71941, 10201, -27917, 28454, 38655, + -19327, -28991, 56371, -17180, -9127, -30065, -48855, 10737, 22012, 3758, + -1611, 16643, 11811, -26307, 14496, 28991, 21475, -7516, -20401, 6442, + -2147, -36507, -16643, 1074, -11811, 4832, + }, + { + -6517076, 18342732, 1458678, 502511, -300111, 51540, -27917, 210453, 13959, -390842, + -172336, -151398, -64961, -74625, -526134, -670015, 164819, -95563, -120796, -30065, + -19327, 214748, 210990, -44560, 68719, -367757, -83752, -72478, -137439, 442382, + 54224, -24696, 239444, 21475, -76773, -280247, 23085, 86436, 80531, -67109, + -55835, -157840, 185757, -32749, 18254, -59593, 192737, 6442, -5369, 48318, + -20401, -13959, -82141, 113280, -41876, 56371, 23085, 128312, 4295, -9127, + 13959, 65498, 61740, 16106, 92342, -38655, 35433, 27917, -38655, 59056, + 14496, -93952, -66572, -8053, -11274, 2684, 32212, -7516, -9664, 24696, + 47245, 20938, -10737, -28991, 5906, -13422, 13422, 10201, -48318, 1611, + 23622, 3758, -18254, 9127, 15032, -2684, + }, + { + 426276, 222801, -1253057, 48318, 181999, -122943, -62277, 103616, 86973, -70867, + -39192, -133144, 334471, -688805, 1924682, -762894, -549219, 526670, 2525441, -752156, + -115427, 299037, 336081, 563178, -153008, -413927, -288837, -758599, -595390, -227096, + -337692, 417149, 216359, -111132, 48318, -136902, 380641, 280247, -88047, 57445, + -32749, -62814, 205622, 33823, 14496, 144418, -59593, 17717, 129386, -3221, + 22012, -69793, -17180, 35433, -70330, -12885, -10201, 52613, 8590, 25233, + 52613, 41876, -35970, -35970, 106837, 82141, 47245, 6442, -41339, 32212, + 8053, -32749, -7516, -12348, -49929, 537, 18790, 18790, 64425, 59593, + 33286, 17717, -74088, 6979, 20938, -10737, 22012, -4832, -9127, 3758, + 5369, 10737, 9127, -22549, -13422, 28454, + }, + { + -5558762, 29923574, 771484, -752156, -197032, -111132, 25770, 563178, -671089, 79994, + 545461, -67109, -244276, 350040, 545998, -210453, -117575, -45097, 7516, -219580, + 90731, 210990, -142271, -376883, -128312, 99858, 46171, -66572, -87510, 114354, + -67646, -86973, -264677, -45634, -97711, -48855, 74088, -17717, 136902, -32749, + 162672, 80531, -131533, 197569, -172872, -43487, -51003, -42950, -163746, 42950, + -43487, -49929, 106300, 88047, -33823, -93416, 126165, 102005, 0, -48318, + -25233, 30602, 85899, 13959, -6979, -31675, 8590, 40265, -11274, 41339, + 0, 51003, -20401, -11811, 9127, -22012, 35970, 9664, -12885, -10201, + -20938, -26844, -64425, -30065, 28991, 33286, 15569, 22549, 20401, -35970, + 7516, 7516, 9664, -6979, -17717, 10201, + }, + { + -288837, 469225, 1254131, -155156, -7516, -83215, -33286, -20938, 89121, -41876, + 42950, 71941, -268435, -1004486, 80531, 1235877, -1166621, -63351, -15569, -216359, + -292058, 205085, -478352, -760746, -587874, -445066, 142808, -14496, -1066226, 312996, + 287226, 89657, -271657, 310848, 455803, 116501, -111669, 26307, -74625, 156229, + 252866, -15569, -68183, -72478, -93952, 34897, 18790, 125628, -95026, -6442, + -78920, -11274, 31675, 41339, -29528, 49929, 83752, 76236, -135828, -53687, + -15569, -24159, -61203, -32212, 31139, -44023, 5369, 96637, 14496, -92879, + -46171, 32212, 42413, -9127, 17180, 14496, 27380, 26844, 46708, -10201, + -6442, 12885, 14496, 4832, -6979, 20938, -15569, -23085, 1074, -27917, + -48855, -36507, -537, 15032, -21475, -2147, + }, + { + 9059697, -5171141, -2802466, 593242, 22549, 151934, 18254, -229781, 5369, 150324, + 383863, -15032, -504659, -141734, 1056025, -31139, 59593, -248571, -230854, 399969, + -107374, -20401, 125091, 300648, -171799, -216359, 164283, 28454, -264677, 55835, + 332323, -76773, -94489, 87510, -124554, -34897, -136365, 198105, 24159, 78920, + -8053, -26844, -42413, -95563, -37581, -22549, -35433, -149250, -120796, 74625, + 66035, 13959, -177704, -89121, 60130, 50466, 91805, 57445, 16643, -50466, + -88584, 23622, 10201, 37044, -23622, -40802, 33823, 17717, -42413, -54761, + 12348, -4832, -24696, 70330, 63351, -53150, -6979, 68719, -21475, 2684, + 16106, -30065, -29528, -1074, 3758, -25233, 20938, 27917, -3221, -537, + -12885, -4295, 15569, 18790, 16643, -1074, + }, + { + -411780, 151934, 1739999, -384400, 171262, -118112, -2147, 61740, 62814, 64961, + 25770, -144418, -168041, 11811, -2924873, 1045288, 2147, -1312113, 127238, -26844, + -142808, 5369, 621160, -20401, -463320, -55835, 124017, 506806, -366146, 380641, + -373662, -508417, 395674, -179852, 219580, 86973, -177167, 30065, 179315, 10201, + 158377, 197569, -56908, 95563, 48855, 104153, -14496, 144955, 5369, -33286, + -111132, -22012, -102005, 37581, 75162, -52076, 81604, 40802, 52613, -21475, + -35433, -67109, 56371, -71404, -123480, -36507, -76773, -54224, 40802, -55835, + 25770, -58519, -79457, 2684, 69256, -2684, -24159, 5906, -5906, 3221, + 15032, -51540, -39728, 4295, 10201, -3221, 32212, 48318, 4295, -28454, + 3758, 5906, -10201, 11811, 8590, 13422, + }, + { + 654446, -1031866, -2321430, 253940, 76236, -435402, 32212, 88584, -148713, 91268, + 221728, -6979, 132607, -269509, 118648, -30065, -4832, 207769, 146566, -194347, + -210453, -41876, -128312, -150324, 140123, 45097, 53150, -144955, 159451, 148713, + -98247, 147640, 15569, 239444, -172336, 129386, -57445, 140123, 172872, 2684, + 108985, 201327, 93416, -141734, 53687, 176631, 159988, -28454, -37044, 145492, + 110059, -22549, 179315, 47245, -175020, -76236, 78920, -11811, -27917, -40265, + -48318, 75699, -19327, 18790, 5906, -8053, 28991, -45097, -16106, 53687, + -12348, -24159, 15032, 32212, -7516, -2147, -3221, 10201, -25770, 27380, + -42413, -15032, 20938, 11274, 2684, 59056, 37581, 19327, 38655, 13959, + 12885, -3758, -38655, -8590, 16643, 25770, + }, + { + -254477, 4253092, -99321, 682900, 63351, 142808, 187905, -166967, -89657, 94489, + 370441, -231928, 27380, 205622, 603980, 311385, -274878, -373662, 352187, 488553, + -378494, 220117, 477815, 354335, 54224, 122407, 81068, -246424, 29528, 10201, + -153545, -25770, -41876, -159988, -61740, 63888, -178241, -166430, 13959, -48318, + 98784, 5369, 181462, 108985, -53687, -12885, -31139, -12348, 0, 537, + 102542, 78383, -93416, -101469, -92342, 35433, -36507, 40802, 35433, 17717, + 17717, 44560, -90194, -73014, 37581, 56908, -37581, 49392, 63351, -8590, + -17717, -30065, -25770, 14496, 11811, -5906, -21475, -79457, -34897, 32749, + -22012, 23622, 23085, -28454, -40265, -5369, -20938, 537, -20938, -34360, + 8590, 0, -3221, 4832, 5906, 16106, + }, + { + 3062849, -4083977, -1094143, -689342, 104153, -19327, -375810, -13422, -423591, 100932, + -171262, -716186, 63888, -211527, -314606, -4295, 67646, -20401, 2147, 205622, + -166967, 216896, 32749, -157303, 5906, 45634, -52613, 63351, -168041, -133681, + 6979, 173946, -241055, -61740, -54761, -143345, -81604, -92342, -86436, 154619, + 10201, 63888, -114890, 160524, -61203, 1074, -164283, 25770, 34897, 85362, + 73551, 74625, 35970, 14496, 25233, 14496, -17180, 55835, -9127, -45634, + 44023, 16106, -61203, 55835, 31139, -62277, -44560, -20401, -69256, 15569, + 16106, -26307, 15032, 36507, 32212, 11274, -10737, -9664, -20938, -8590, + -6442, 26307, 48318, -16643, 27380, -5369, -32212, 14496, -12348, 9664, + 18254, 16106, 37581, -10201, -9127, 11811, + }, + { + -104690, 62814, -188979, 174483, 115427, 107374, 96637, -166967, 65498, 137976, + 157303, 66035, -349503, 2686502, -1550483, 2296197, -219580, 9664, -290984, -297963, + 431644, 68183, -568546, 98784, -102542, -81604, -121870, 127775, 160524, 511101, + 95026, -179852, -164283, -188979, -9127, -220654, -26307, 147103, -124017, 204011, + -137439, 47782, 22549, -19864, -105764, 75162, 90194, 179852, -5906, 115427, + 40265, 106837, 93416, -39192, 6979, 133681, -26844, -52613, -7516, -56371, + -145492, 24696, 83752, 41339, 25770, -49929, 8590, -58519, -7516, 25770, + -1611, -24696, -537, -27917, 15032, 76236, 41339, -3221, 4295, 2684, + -33286, -59056, -22012, -26307, -13959, -5369, 6442, 38118, -27380, -6442, + -16106, 1611, 57982, 2147, -22549, 31139, + }, + { + -717260, 3663607, -612570, -1395864, -31139, 325344, 110059, -300648, -73551, 163209, + -222801, -146029, 256087, -178778, -40265, -284005, -566936, 8590, -27380, 52613, + -134755, 157303, 205085, 145492, 540092, -177167, -110595, -317291, 368293, 368293, + -185220, -43487, 44560, -157303, 27917, 131533, -119185, -134218, -185220, -11274, + 118648, -271657, 67109, 39728, -20401, -143345, -148176, -35433, 52076, 83215, + 118648, -147640, 85899, 55835, -66035, -56908, -51540, 4295, 45097, -78920, + 56908, -30602, -31675, -41339, -52613, -60666, -65498, 22549, -8590, 22549, + -23622, 26844, -11274, 1074, -37581, -30065, -16106, 51003, -39192, -56371, + -13959, 13422, -31139, -51003, 6979, -25770, -26844, 62277, 12885, -19864, + 17717, 2684, -21475, -11274, -4832, 16643, + }, + { + -59593, -20401, -381715, -29528, 104690, -73551, 54761, 128849, 587337, -132070, + -472446, 132070, -185220, 548145, 8169028, 379568, -1454383, -404264, 446140, -148713, + -221728, 672162, 61740, 211527, 387084, -20401, 22012, 171799, 22012, 82678, + 147103, -204548, 537, 254477, -193274, -33823, 458488, -55298, -168577, 87510, + -18254, 136902, 146029, -49392, -49929, -22012, -68719, -18254, 68719, 59593, + -25233, 89657, 150861, 35433, -30602, -53150, 55835, -11274, 29528, 132070, + 140660, -54761, -33823, 62277, 55835, 38118, -99321, -48318, 55835, 5906, + -31139, -17180, 70867, 17180, 35970, 17180, -67646, 29528, 38655, 30602, + -24696, -39192, -37044, -5906, 41339, -17180, 17180, 3221, -23622, -4832, + 8590, -18790, -1611, 17717, 10737, -20401, + }, + }, + { + { + 275415, 30352534, -1484448, -2320356, 59593, -168577, 129386, 217970, -73551, 124017, + 272194, -301185, -306016, 151398, -668404, 631897, 39728, 193810, 149250, 793495, + 43487, -84289, -86973, -120259, 135291, -54224, -34897, -75162, 236223, 27380, + 144955, -38655, 448824, 114354, -64425, 44560, 140123, -83752, 30065, -137439, + 15032, 122407, -70867, 115427, 79457, 44560, -7516, -208843, 97174, 105227, + 91805, 33286, -47245, 22549, -35433, -93416, -68719, -60130, -28991, 60130, + 31139, -30602, -5906, -50466, 30065, -18790, 73551, 8053, -37044, -19864, + -21475, 27917, 537, -21475, -56371, -43487, 55298, -23622, 11274, 49929, + 26844, 45097, -9127, -12348, -32212, 33286, 23622, -9127, 40802, 17180, + -7516, 3221, -3221, -8590, -5906, 10201, + }, + { + 146029, -2222646, 777926, 152471, 180926, -214748, -284005, 95563, 64961, -101469, + -128312, -96100, -333934, -1189706, 59593, -514322, -893353, 291521, -440771, -8053, + -54761, 840203, 197569, -42413, -670552, -39192, 117575, 624918, -215822, -259846, + -1611, -539018, 133681, -69256, 5906, 157303, -41876, 119722, 76236, -279173, + 185220, 101469, 245887, -188979, -130997, 6442, 42950, -6979, 1074, 60666, + -67109, -45097, 86973, 106300, -113280, -90731, 1611, -45634, -60666, 56371, + 124017, 97711, 3221, -45097, 34360, -6979, 60666, 54224, -9127, -10737, + 18254, -9664, -46171, -20401, 54761, -11811, -37581, -38118, 5906, 54761, + -16643, -41339, 14496, 9127, 4295, 25233, 8053, -8053, 39728, 1074, + -41876, 5369, 37044, 30602, 537, -20401, + }, + { + 592169, -8673686, -844498, 1351841, 661425, -192737, 33823, -77309, -182536, -92342, + 448824, -11274, -237834, 576599, -237834, 723165, 30065, -14496, 325344, 109522, + -372588, 368830, 135291, 16643, 5906, 187905, -69256, 87510, -515396, 51540, + 52613, -171262, 273267, 114354, -241592, 164283, 196495, -94489, 5369, -147640, + -90731, 23085, -133144, 52076, 110059, 90194, -72478, 77846, 51540, -62814, + 19864, 151398, -74088, -41339, 71941, -4832, 8053, -28454, -24696, -17717, + 61203, 66572, -2147, -49392, 12348, 72478, -14496, -26307, 60130, 8590, + -33823, 10201, 54761, -53687, -23622, -33823, -13422, 32212, -13959, -19864, + 537, 16106, -12885, -35433, 11811, 18790, 17717, -26844, -11811, 11811, + -18254, -38655, 5369, -12885, -11274, 12348, + }, + { + 3030100, 28354838, -987843, 838056, 347355, 235149, 176631, 246424, -537, -332323, + -114890, 34897, -12885, -542777, -512712, 23622, 274341, -333397, -203474, -122407, + -89657, 164283, -66572, -129386, 181999, -233539, 90194, -194347, 0, 354335, + 43487, 10201, 62814, -224949, -208306, -417149, 102005, 44560, 227633, 301721, + -33286, -175557, 234076, -18790, -15569, 7516, 123480, -33286, -16643, 69793, + -30065, -60130, -10201, 104690, -51540, 0, -61203, 88584, -51003, -15032, + 11811, 40265, 31675, 25770, 76773, -44023, 67109, -8590, -30065, 39192, + 17180, -86436, -49392, 1074, -8053, 27917, 16643, -13422, 8590, 40802, + 36507, 18790, -22549, -15569, 15032, -14496, 20401, -17717, -37044, 11274, + 20401, -5369, -11274, 13959, 7516, -8590, + }, + { + -224412, 895501, 79994, 163209, 40802, -127775, 39192, 87510, 68719, 77309, + 73551, -66035, 658741, -78383, 1925756, -1426466, -274341, 1072668, 392990, -452045, + 181999, 231928, 561030, 399432, -615791, -135291, 332323, -367757, 329639, 115427, + -161061, 613107, 200790, -71941, 117575, -264141, 267362, 186294, -69793, 104690, + -537, 53150, 202400, 5369, 55835, 91268, 9664, 159451, 102542, 25770, + -66035, -129923, 60666, -18254, -46708, 38118, 57445, 104690, 9664, 28991, + 45634, 24696, -16106, 17717, 132607, 44023, 9127, -19864, -22012, 41339, + -45097, -25770, -5906, -7516, -32749, 35433, 33823, 37581, 69256, 30065, + 9664, -8053, -53687, 44023, 8053, 7516, 20401, -16643, -1074, 9127, + 15032, 17717, -1074, -25233, 10737, 27380, + }, + { + 460635, 36651104, -215285, -898185, -205085, -93416, 76236, 324807, -464930, 488553, + 489626, -239444, -300111, -129923, 144418, -139050, -126165, 39728, -40802, -60666, + 243203, 103616, -339839, -460635, 33823, 70330, 33286, -238371, -89121, 307627, + 4295, -83215, -127775, 99858, -110595, -90194, -111669, -237297, 42950, 3221, + 38655, -168577, -161598, 272194, -123480, -107911, -111132, -158377, -113280, 115964, + -71404, 56371, 148176, 50466, -100932, -37581, 171799, 51003, -39192, -77309, + -47782, 17717, 108985, 25770, -58519, -12885, 43487, 16643, -14496, 34897, + 4295, 37044, -25770, 3758, -12348, 6979, 42950, -537, -25770, -6442, + -24696, -31139, -54224, -5906, 32749, 30065, -1074, 33286, -11811, -24159, + 15569, 15032, 5906, -25770, -7516, 11811, + }, + { + -105227, 848793, 522912, -378494, 7516, -25233, 114890, 121333, 106837, -43487, + 95026, 111669, -268435, -388695, 671089, 251256, -1174674, 41876, -351114, -214212, + 199716, -16106, 13959, 149250, -365072, -620623, -305480, -208306, -613107, 323733, + 102542, -73551, -524523, 498216, 365609, 35970, -68183, 132607, 45634, 181462, + 19327, -224412, -17180, -76236, 79994, 151934, -22549, 54224, -63888, -17180, + -51003, -9127, 63351, 40265, -28454, -3221, 46708, 5369, -89657, -28991, + -46708, -11811, -28454, -48318, -1611, -40802, 63351, 69793, -37581, -105764, + -13959, 46171, 34360, 20401, 39728, 5369, 38655, 35970, 31675, -30602, + 9127, 10737, -3221, -17717, -8590, 13959, -26307, -17180, -8053, -37044, + -47245, -18254, 13959, 537, -18790, -2147, + }, + { + -7210177, -24259586, 96637, 588411, 174483, 99321, -449361, -183073, -10201, 213675, + 261456, -529892, -381178, 26844, 453119, -477278, 18790, -256087, -25770, 442919, + -412854, -365609, -322659, 69256, -383863, -126702, -60666, -239444, -390842, -67646, + 93952, -116501, 29528, 267899, -92879, -92342, -193274, 332860, 144955, 69793, + -42950, 28454, -46708, -159988, 181462, -3221, -60666, -185220, -40265, 74088, + 45634, -17180, -162135, -4832, 49929, 49392, 80531, 34360, -537, -34360, + -47782, 49392, 11811, 9127, -39728, -33823, 16643, 16643, -20938, -30602, + 23085, 5369, 25233, 88584, 31139, -56371, 51540, 49929, -49392, 13959, + 18254, -27380, 1611, 21475, -3758, -13422, 27917, 19327, 5906, -4832, + -20938, 1074, 18790, 22549, 11811, -16106, + }, + { + -187368, 733903, 847719, -471373, 20938, -120796, 30065, 125628, 61740, -99858, + -184684, -63888, 120259, 735513, -2770791, -927713, -813896, -607738, 475668, 969052, + 1206886, 462783, 173946, -17180, -413927, -358630, -165893, -118648, -478352, 717260, + -353261, -154082, 230854, -280784, 233002, 2684, -119185, 214212, 46171, 83752, + 220117, 52613, -87510, 135291, 83215, 78383, -5369, 25233, 44560, 105227, + 19327, 3221, -55835, 38655, 48855, -86436, 120259, 47245, 41339, -9127, + -59593, -95026, -32749, -133144, -64425, 537, -64961, -24696, 76773, -60666, + -5369, -60666, -27380, 66035, 61740, -38118, -25233, 15569, -11811, 13422, + 4295, -62277, -13422, 13422, 12348, 19864, 50466, 26307, -13959, -27917, + 11274, -9127, -1611, 16106, 16643, 18254, + }, + { + -956704, -955093, 803696, 989990, 241055, 426812, 498753, 152471, 177167, 484794, + 152471, -133681, -34897, -562104, 143881, -43487, 582505, 693637, 341450, -195958, + -88047, 45634, 38118, -54761, 118112, -118112, 45097, -76236, 67109, 25770, + -20938, 132607, -33823, 383326, -127775, 104153, -79994, 1074, -27917, 55298, + 107911, 264141, 5369, -124554, 223338, 176094, 31139, -17717, 29528, 143345, + 110059, -13422, 141197, 1611, -148713, -16643, 61203, -34360, 2684, -49392, + -8053, 51003, -11811, 16106, -49392, 3758, 13422, -41339, 31139, 28454, + -6442, -6979, 32749, 10737, 7516, -4832, 21475, -31675, 0, 3758, + -58519, -5906, 41339, 8590, 28991, 59056, 28991, 10201, 36507, 6442, + 6442, -16643, -28991, 1611, 17717, 22549, + }, + { + 387084, 4021163, -1015760, 168041, 185757, 184684, -107374, -400506, 51540, 260382, + 358630, -320512, 124017, -178241, 357019, 140123, -329102, -286689, 48855, -623307, + -754841, -150861, 98247, 54224, -156229, 169651, -103616, -132070, 47782, -35433, + 13959, 10737, -112743, -79994, 162135, 33823, -252329, -134218, -29528, -70867, + -45097, -20401, 120796, 3758, -49392, 41876, -54224, -13422, 82141, 53687, + 61203, 23622, -134755, -99858, -46708, 11274, 24159, 73014, 10201, -2684, + 65498, 20401, -102005, -40802, 56908, -2684, 25233, 76773, 11274, -11811, + -32212, -33286, -7516, 30602, 7516, -24696, -22012, -71404, -537, 21475, + -15032, 37581, 17717, -54761, -38655, -1611, -24159, 7516, -27380, -20938, + 11274, -10201, -5906, 2147, 18254, -5906, + }, + { + -2334315, -11600707, -489089, -104690, 344671, -211527, -19864, 397821, -169114, 71941, + -290984, -361851, 54224, -100395, -312459, -113817, 137439, -161061, 71404, 155693, + -76773, 274341, 30065, -164283, 169651, 42413, 96100, 106837, 71404, -71941, + -27380, -92342, -346819, 55835, -175020, -149250, -236760, -206158, -51003, 158377, + 51003, -16643, -232465, -3221, -135828, -65498, -105227, 60130, 46708, 59593, + 79994, -17180, 84289, -71941, -6979, -4295, -24696, 24696, -70867, 6979, + 104153, -28454, -54761, 78383, -21475, -47245, -37044, -28454, -35970, 80531, + -4295, -25233, 17180, 36507, 34897, -5369, -11274, -17717, -22549, -537, + 9127, 45634, 24696, -15032, 30602, -23622, -10737, 6979, -11274, 18254, + 15032, 28454, 28454, -14496, -3221, 19864, + }, + { + 125628, -30602, -412317, 429497, 83752, 143881, -37581, -223875, -9127, 105227, + 16106, -317828, -1338419, 1949378, -311922, 1786170, -825707, -171799, 520765, 229244, + -1108102, 59593, -548145, -174483, 97174, 209380, 104690, 195958, 160524, 548145, + -517544, -247497, -227096, -179852, -11811, -250182, 97174, -1074, -116501, 170725, + -71941, 166430, -4295, -30602, -108448, 2147, 62814, 99321, -90731, 66035, + 34360, 134218, 38655, -72478, 32212, 97711, -80531, -22012, 1074, -115427, + -112206, 104690, 66035, -6442, -28991, -39192, 23085, -76773, 40265, 22012, + -3758, -32212, 35433, -9664, 36507, 61740, 26307, -22012, 4295, 18254, + -44560, -58519, -19864, -24159, -2684, -12348, 26844, 18254, -19864, -8053, + -18254, 28991, 60130, -17717, 4295, 32749, + }, + { + 548145, 4978404, -406411, -850404, -34360, 318364, -113280, 116501, 110059, 11274, + 54224, 75162, -84826, -35433, -67109, -479963, -447213, 37044, 97174, 108448, + -181462, 154619, 81068, 236760, 555661, -128849, 20401, -179315, 471910, 321049, + -129386, -163209, 51003, -139586, -95026, -27917, -91268, -102542, -89121, 26844, + -78920, -118112, 39192, -127238, -76236, -188979, -178778, -1611, 38655, 164283, + -19864, -77309, 148176, 32212, -115427, -114354, -28991, 59056, 15569, -3221, + 41339, -35433, -15032, -64961, -23085, -49392, -29528, 20938, 10201, -1074, + 16106, 20401, -4832, -13959, -41339, -29528, 11811, 26307, -63351, -40802, + 8590, 11811, -42950, -32212, 4295, -30602, 7516, 56908, -8590, -11274, + 13959, -10737, -18790, -8053, 13422, 12348, + }, + { + 215822, -802622, -1011465, 169651, 100395, -2147, 71404, -106300, 418222, -227096, + -205622, -28454, -53150, -3725884, 2831457, 1924145, -1016297, -926639, -272194, -119185, + -170188, 453656, 60130, 370978, 382252, 19327, 307627, 344134, 521839, 357556, + 42413, -31139, 118112, 164819, -260919, 99321, 414464, -80531, 31139, -40802, + 171799, 264677, 44560, -258235, 29528, -9664, -127775, -101469, 537, 15032, + -77846, 96100, 155156, -25233, 18254, -28991, 94489, 6442, 112743, 150861, + 74625, -85362, -24159, 64961, 20401, -3221, -122943, 2147, 39192, 12885, + -30602, 20938, 79457, -9664, 30602, -33823, -34360, 32212, 13422, 1611, + -46708, -32749, -33286, 19864, 37581, -3758, 20938, -8590, -38655, -4295, + 2684, -23085, 8053, 20401, -5906, -22549, + }, + }, +}; + const float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= { { @@ -29476,6 +58148,9110 @@ const float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MA } }; +const Word32 rightBRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= +{ + { + { + -1409823, -49383532, 60373280, 17657148, -10086194, 10809896, -21563958, -24934970, -21000780, 7203734, + 9224516, 3362423, 27784680, 9658845, -9273371, -7822746, 2589865, 24520506, 1350767, -15502684, + -9993315, -125091, -7628936, -185220, -17885318, -125628, -4449049, 7846369, 1426466, 22142704, + 4288525, 519154, -8935143, 1160178, 9670656, -2841121, -10553808, -2444373, 8581882, 13063143, + 6616934, -15243376, -19841676, 6442, 7655243, 2362769, -785979, -3533148, 3619584, -11263015, + -1623498, 2724620, 678068, 1828046, 709743, 4689031, 9005473, 8693014, 2547453, -1622961, + -906238, -164283, 271657, -5508296, -3926674, -5305359, -6541772, -11915850, -2745558, -546535, + 5127117, 4666482, 4561256, 2406256, 6228240, 5369783, 3754338, 2274185, 1139777, -994285, + 55835, -2911451, -2268280, -4362613, -4982162, -2238752, -825171, -2682744, -4558571, 3070365, + 3326989, 1661616, 187368, 83215, 2015950, 1184337, + }, + { + 2640868, -51209968, 66600448, -8427263, 19280646, -9943386, -19514184, -28194312, -7065758, 5252745, + 4778688, 19797652, 20707648, 2399276, -13477071, 8817568, -4998268, 26811870, -12322798, -12193412, + 1767916, -14763413, -8566849, -2130304, -3816615, -7808251, 300648, 17030620, 5651103, 3369939, + 195958, -2847027, -3904662, 4616016, 13066901, 3541201, -12065637, -3132105, 5776731, 7214472, + 289910, -11136313, -5040144, 3871913, -3246995, -8171176, 5030481, 2472291, -936303, -5090610, + -4539781, -1574106, 1792612, 1438814, 405874, 10526965, 6155225, 5143760, 3433290, 5608691, + -432718, -2986076, -4282083, -2412161, -6130529, -8191040, -8491150, -9539122, -1684701, 814433, + 941135, 5207111, 7240778, 5467494, 9451076, 6065031, 4384625, 3262028, -2108829, -4870493, + -1611687, -2846490, -4686346, -6813429, -3148748, 251792, -1254131, -1297080, 1067299, 949188, + 3482682, 1179505, -561030, 1930051, -286152, -46708, + }, + { + 1272921, -54889144, 70116416, -6897181, 16925392, -1021665, -36054640, -9810242, 1701881, -13785234, + 5661304, 11031087, 20417200, 998043, 5360656, 4662724, -6286222, 5044439, 1260573, -995896, + 3775276, 3366718, -13290776, -12804371, -17464410, -14049375, -20833276, 9896142, 23509040, 30144764, + 4813585, -433255, 7194070, -2523830, -8381092, -3804804, 3205656, -2633352, -6980396, -891206, + 13872744, 1356673, -8372502, -5862631, 1686848, 1702955, 127775, -11855183, -9174587, -4013110, + -1461363, 5991480, 8189966, 2024540, 7959112, -426276, -5205501, 9494025, 17304424, 8923868, + -1685775, -4265977, -6469832, -1288490, -6101538, -10669236, -6327024, -12343199, -6592775, -8380555, + -1020055, 8147016, 6357089, 7927436, 9974525, 8219494, 9265318, 5656472, 2799245, -530428, + -4935455, -5570036, -6389838, -2803003, -3718368, -5420249, -5058935, 739808, 5608154, 1812476, + -2076617, 789737, -777926, -2099165, -2935073, -1791001, + }, + { + 302795, -35748624, 46741056, 14091788, -13078175, 8090645, -13390097, -13390634, -23165980, -17209398, + 21987012, 9961103, 33659120, 2245731, 2648921, -13372381, -20544976, 14322642, 8817568, -3461207, + -833224, -11237245, -10543608, 5988795, 11776263, -15676631, -12724914, 12333535, 6473590, 6332393, + -4284230, 3198677, 6997039, -9420474, 563178, 4193499, 2041720, 179315, 692564, -1603633, + 4122632, -6548215, -6513855, 3765613, -3609920, -2307471, -777926, 5057861, -14496, -5568962, + 7927436, 2255932, -5209796, 43487, -383326, 1794760, 2317672, 323733, 3340948, 75162, + -2856690, -2090039, 3027415, 39728, -4125316, -2095407, 473520, 423054, -6690486, -2167885, + 3740917, 3506841, 2694018, 3041374, 261993, 971200, -2269353, 2956548, 855772, -2236604, + -1044214, 503048, -480499, -1503239, -674310, -152471, -2263448, -3066070, 923955, 1133871, + -491774, 61740, 304406, 4186519, 1574106, 1433982, + }, + { + 894427, -22213570, 52410948, -28141700, 19387482, -6890738, -13024488, -20635708, -14133664, -12416750, + 21714818, 19566798, 21471078, 10114648, -6567542, -6053757, -15620259, 16610249, -8315057, -375273, + -375273, -20699594, -19310172, 30071750, 8432631, -22284438, -6532109, 14757508, 21944062, -4385699, + -13106093, 7596187, -6125160, -5790153, 6795712, -1991254, -4116726, 12633109, 3142306, 947040, + -995896, -5932424, -4259534, 5695664, -659278, -9580461, -7081864, 1276142, 12220793, 941135, + -3306588, 1144609, -6426345, 4789963, 2598992, -4763656, 6116571, 4332012, 1699733, 509491, + -7274064, 1597191, 2325725, -2075543, -1742146, -6379637, -4589710, -2240899, 2876554, -1418413, + 2293513, 2956011, 6820408, 3365107, 3838627, 2365990, -1065689, -3002719, -1931125, -5215701, + -2274722, 495532, -644245, -140123, 135828, 9127, -2310693, -690416, 1311039, 1393180, + -850940, 692027, -501974, 1322313, 1557463, 2510409, + }, + { + -2174327, -39218420, 51765092, 21826486, -19683836, 9637907, -10777684, -24227910, -20179366, 1060320, + 1462973, -2109366, 24901684, 44676788, 2937758, 9046812, -40161704, -11121281, -1750199, 11840151, + -8417599, -23329726, -17503066, 39338144, 5929739, 13909788, -18638010, -7882876, -755377, -5949067, + 2456185, 32213866, 3215857, -10001368, -12062416, -5646809, 4457103, 6508486, -141734, -4693863, + -18727668, 13702019, 7455527, -10590316, -7826504, 3514357, 8119099, 753230, 4570919, 3813931, + 3748970, -91268, 6427956, -976031, -3645890, -7919383, -10511932, -5186710, 798327, -962610, + -3868155, -601295, 2339147, 7064148, 6287832, 3100967, -2883534, -747861, 2184528, 5322538, + 1320166, 5812165, -729071, -662499, -3864934, -2881923, -6546604, -4999879, -3001109, -176631, + -2882460, 2809982, 5816460, 3599720, 2478196, -1408212, -4614943, -1457068, 699006, 2652142, + 2536715, 3017752, 1249299, -441308, -1480153, 519154, + }, + { + 681289, -20648056, 55862492, -37233072, 26775900, -12299713, -15882789, -16690780, -16576426, 2185602, + -3208878, 11117523, 50726248, 15768436, 10390600, -16327318, -37793028, -6031208, 16632798, 9248138, + -22032646, -24631100, 1111860, 14659797, 11395622, 14268418, -9106941, -6336151, 1821603, -2564632, + -3263638, 21037286, 10415833, -16028281, -13706851, 6088116, 5675800, -3831111, -1673427, -10510322, + -5630702, 8755828, 4897874, 696322, -1547799, -1131724, 5972689, -3944391, -223338, 7804493, + 7908109, 609885, 2508798, 143881, -7151121, -12479027, -6106370, -2218888, 1404991, -6316823, + -1436130, 4199941, 5660767, 1766842, 3411278, 3328063, -571768, -1709934, 3825742, 1909650, + 4785668, 4417911, -1284195, -196495, -6131066, -3427384, -2891587, -4278325, -2648384, -1997160, + -1262720, 2762201, 2569464, 3692061, 1576790, 367757, -2669322, -2284923, 666794, 3171297, + -203474, 1603633, 2676302, -1391569, 158377, -1851668, + }, + { + -2231773, -32385664, 44669272, 21364242, -19712290, 11218991, -13425531, -18399640, -16681653, -13292924, + -535797, 11979738, 37871948, 26555782, -20732880, 10612864, -19675782, 15820512, 5489505, -25715580, + -14566918, -9815611, -7732015, -15022185, 36152352, 37011344, -9113921, -38042136, 11484743, -7961796, + 9352828, 16327855, 11623792, -3575024, -13794361, -719407, 1136019, -1843615, -9474161, 1292248, + -9757629, -5267778, 7261179, 7984344, -1647120, -3428458, -945430, 14117558, 5657009, -3885335, + -1653562, 10754061, 11876658, -2871186, -9183714, -7931731, -9817758, -15568720, -5756867, 6821482, + -2978560, -2496987, 4871567, 5652177, 7286949, 9693741, 7801808, -5740761, -5400385, 7022272, + 6113886, 2405719, -1774358, -2884608, -4546223, -2372433, -9902584, -9753334, -2665564, 1197759, + 1218697, 5181878, 3921842, 4881767, 1394791, -1002875, -3957276, -2243584, 3769371, 6373195, + 2428267, 3568044, -52076, -3879966, -3664681, -1582696, + }, + { + 505196, -23672786, 58950572, -39694624, 29988536, -10748156, -19057306, -19891604, -12819404, 121333, + -4966056, 32779190, 37850472, 5066451, -5269388, -4802847, -13202193, 17317308, -16662862, -17555678, + -12997645, 5594732, -15477988, -11404749, 42913704, 5759015, 3413962, -29726542, 7137699, 15580531, + 14463302, -9109089, -7243999, 14100378, -8392903, -5187247, 4181688, -2557116, -11395622, -15515032, + 1283658, 4194573, 1712618, 11727945, -2987150, -1975685, 5687074, 6843494, 3393561, 3169149, + -1404991, 5014375, 9095130, 4537096, -13118441, -9497783, -13768055, -16826072, -4735202, 2071785, + 2434173, 6408628, 6199249, 2297808, 2051921, 11358578, 3344169, -2887829, 1827509, 2063732, + 7382512, 2152852, 133681, -7374459, -8681740, -1252520, -6386617, -4397510, -3347927, -950262, + 3278134, 3867081, 3058554, 2565706, 1114007, -1478543, -1952063, -96637, 1146756, 5506148, + 2982318, -394063, 918049, -1374926, -1918240, -1637456, + }, + { + 1175747, -48246440, 61643520, 14976014, -5596343, -35421668, 1482301, 3964792, 8601209, -20506858, + -9141838, 19321984, 4430796, -10534481, 6553047, 14601278, -1751273, -6371047, 20891794, -5011153, + 15548318, 1244467, -13179107, -15462956, -28265716, -13903883, 4622459, 299037, 12273943, 10872710, + 5585605, 9662066, -1119913, -8187819, 9550397, 272194, -2044404, 3475166, 12263205, 885837, + -6578816, -16409996, -13150116, -4911295, 9878962, 3880503, 18626200, -271120, 2157684, -18178986, + -14155675, 1925756, -509491, 6496675, 7353521, 9165997, 1765232, -7173133, -1304060, -4327717, + -2928094, 7886634, 10071161, 3365107, 231928, -5365488, -4858145, -2771328, -4422206, -4886599, + -2982318, -4285304, -2383707, -73551, 7909719, 6329708, 4896263, 2521683, 4309463, 4782446, + 303869, -3779571, -2232846, -1671279, -571231, -3085934, -4338454, -3039763, -5512054, 524523, + 2144263, 376347, 3010772, 1712618, 1290101, -1316944, + }, + { + 1604170, -26516054, 53627500, -7368017, -9885941, -48229800, 36755256, -537945, -2905546, -11680700, + -1831267, 26469884, -3442953, -11504070, 18430778, -13696651, 5567888, -3740917, 16069083, -13791140, + 7562364, -9415642, -10963441, -8048232, -20043538, 18779744, 5143760, 13532905, -1481764, 23033372, + -24456080, 8807904, -5728413, 4305168, 9899363, -3841848, -2404108, -108985, -3943317, -6619619, + -8248485, -8050916, -2447058, 4922033, 10504953, 10230075, 12763032, -3663607, -10157061, 2063732, + -18285824, -9047885, 10926397, 9452686, 3295314, 6766721, -1013612, 340913, -7857106, -1548336, + -1662689, 1404454, 2378875, 3109556, -6729677, -4853850, -1628330, 1470489, 231391, 3403225, + 578747, 884763, -2574296, 582505, 4343286, 2353105, 1794223, 775778, 1203128, 176631, + -1279900, -3732864, -5260798, -3029563, 1632625, -1564442, 1049046, 232465, -1476932, 2788508, + 2771328, 978716, 2365453, 714038, -1279363, -1267552, + }, + { + 234076, -46947212, 65129420, 13270375, -13859859, -23969138, -5111548, 20105816, -12599287, -5757941, + -45093400, 36184024, 10451266, 7917236, 36391256, 4824322, -25516938, -15707769, 6913287, -22622666, + 7525320, -628139, 889058, 15003931, -20185810, 14603426, 7456063, -6069326, -13461501, -7243463, + 13579613, 5361193, 8141648, 4757750, -13634911, -16875464, 2266669, -365609, 2864206, -5165772, + 5418638, 14464913, 1295470, -1050656, 10700374, 4439923, 159451, 28454, 1509681, 577136, + -17026860, -12734578, -2236067, -6259378, -6900402, -7039989, 4022774, 5695127, 4137664, 19157702, + 7243999, 1366873, -7561827, -1261110, 2851858, -2163590, -6665253, 7592966, 8096014, -349503, + -3201898, 778463, 2057826, -4056060, -9747428, -3681861, -6831683, -4269198, -1149441, 2821257, + 1547262, 1324997, 2502892, 5913096, 3479461, 5750425, 6564321, 3487514, -662499, -1435593, + -1520418, -5232344, -6679211, -4447976, -4803921, -2160369, + }, + { + -3971234, -9535364, 43525200, -9983115, -16724603, -29968134, 30095910, 1534914, -10022843, -11896523, + -29360934, 40623948, -3479461, 33114198, 13394392, -10668162, -21431350, 2080912, -7763154, -14673219, + 9120363, -1094680, 8735427, -5005785, -9941776, 9255118, 12442520, 1821603, -15027017, -2310156, + 5516886, 7544110, 5554467, 2872796, -10613938, -19851876, -12724377, 7407745, 3510062, -7715909, + 17491254, 14340359, 15673946, -15201500, 9279277, 11144366, -5679021, -4577899, 1796370, -2358474, + -9701794, -15756624, -10186589, -4242354, -7437810, -1680406, 12244415, 3235721, 9339406, 9204652, + 1956895, 1222455, -2624762, 317291, 2108292, -2166811, 1403381, 10476499, 11274, -4170950, + -82141, -2672007, -955630, -4200478, -5456219, -3374234, -7783555, -4592931, -1024350, 2547989, + 2882460, 4632122, 5257577, 5501853, 3469797, 3915400, 2960843, -463856, 287226, 66035, + -1749125, -2384244, -5471789, -5461051, -4342749, -2372970, + }, + { + 1509144, -43656196, 61792232, 6542309, -3508988, -32420560, 4681515, 7604777, -7219303, -10520522, + -15596637, 11097659, 11508902, 24399172, -10087804, -1730872, 1122597, -3949759, -7318088, 10950556, + 5814312, 9847286, -12242804, -9059160, -5037997, 4551592, -10337449, -10649908, 3439195, 4971425, + -5629092, 11039140, 912681, 1184874, -4449049, 23153632, -9287867, 15965467, -3614215, 7935489, + -12067784, -18742700, -9169755, 3283503, 198642, 1751810, 15826954, 9500468, 1777580, -4422743, + -18173080, -2618320, -5552319, -6178848, 5890548, 5892159, 3289945, 1288490, 1941325, 5890011, + -904091, -1303523, 6095633, 4331475, -1979980, -3812320, -4486094, -1112397, -5953899, -166430, + 66572, 809064, -2707977, 923955, 486405, -944356, -1183264, 8053, 4858145, 3147137, + 2788508, 2012729, 67646, 1520418, -2632815, 533650, -2655364, -3997541, -3631395, 1191317, + -154619, 382789, -767725, 1257889, -912681, 1401233, + }, + { + -3337727, -7187628, 36425616, -6924024, -11460046, -30481920, 28965796, -8285529, -11516955, 6017249, + -17506824, 7351911, 32678258, -5300527, -6774237, 17162152, -10046465, -13087302, 5586679, 2232846, + 221728, 1602023, 1318018, -10911364, -11923366, 5714454, 3606699, 2070711, 528281, -175557, + -7841000, 3500398, 2882997, -2362232, -8793409, 11165841, 4884452, 2534568, 9129490, 8513162, + -5368172, -13432510, -7108171, 6071473, -9955197, 4425964, 4413079, 10166188, -4207994, -4359929, + -12864501, -2779381, 169114, -1383516, 5806796, 6344204, 6575595, -1352915, 1624571, -6076305, + 68183, 144418, 1194538, 3437585, 2346126, -2916820, 1724966, 195958, -4953171, -1961190, + -731218, -169651, -1379221, -328028, 482110, 643171, -3022583, -1524713, 4546760, 3580929, + 522912, 2019708, 466004, 1999844, -1424319, -497679, -1532767, -4019553, -1430224, -1772748, + 1461900, -1374926, 649614, -899796, 1257352, -528818, + }, + }, + { + { + 2688113, -7674033, 59079424, 25202868, 8602819, 6252936, -6974490, 2416456, -600222, 7293928, + 808528, -10261214, 2238215, -6776385, 792421, -7646653, -14761803, 10013716, 2700998, -4631586, + 3245922, 12875238, -1184337, -1051193, -19454054, -6010270, -12169790, 1423782, -8114267, 12258374, + 1461900, 2948495, -336081, -2065879, -1647657, -4902705, 4028679, -25770, -1609539, -2365990, + -6519224, -1343788, -4721243, 2449205, 2340220, -2987687, -2805688, -1433445, 4034585, -8342974, + 571231, 1575179, -1512902, 179315, -2538326, 2863670, 5976984, 82678, -3827353, 307090, + 4669703, 4804995, 1753420, -3423089, 1193464, -84289, 221191, -2543158, 3298535, 807991, + 5375689, 3079492, 1845225, 1297080, 1897302, -1031866, -883690, -354335, 1872606, 620086, + 3088618, -53150, 1267552, 1650878, -1320166, -1483911, -724239, -1861332, -2289218, -60666, + -265214, 904091, 742493, 754304, 1206886, -336081, + }, + { + -5723581, -121847152, -21115132, 19022410, 36347772, -8276939, -11709691, -9825811, 7669738, 1997160, + 2407866, -489626, 683974, 1451162, 5103495, 21265994, -9092446, 7399692, -8014946, -6728067, + 2591476, -3082713, -3117610, -3195456, 4648765, 4722317, -3642669, 2758980, 5746666, 3941706, + 4723391, 3833258, -9143985, -1946694, 1167157, 4066797, 3187940, 3104188, 1675037, -1040993, + 1854889, 2861522, -2172180, -804770, -2549063, -7968238, 168041, 938987, -660888, 497679, + -2871723, 2074469, 1660005, -2807298, -5571110, 2580739, 3933653, 3105798, -366146, 558346, + -2918967, 1115081, -3364033, -1908576, -200253, -736587, 448287, -2324651, 1912871, 2916820, + -1219234, -1766842, -137976, -909996, 3318936, 1281511, 1547799, 1305670, -850404, -4491999, + -1424855, 118112, -761820, -2252710, -164819, -465467, -773631, 1328756, 1442572, -1796907, + -613107, -874563, -1613297, 886911, 613643, 1170379, + }, + { + -2095944, -68863360, 30504468, 18279380, 35343824, 1394254, -12001749, 4635881, 10972031, 1337882, + 11312944, 947040, 4396436, 392990, 1826435, -8186208, -6371047, 1396938, 1416266, 3576634, + -4856535, -7064685, -6307160, 3148211, -2088965, 2613488, -15234786, -324807, -4292820, -805843, + -5202816, 6192806, 7922604, -1360431, -6306623, -4726612, 234613, 125091, 3058554, 3205119, + 3506304, -3109556, 184147, 2124398, 2791729, 958315, -1188095, -3402688, 5018670, 4973036, + -4814659, -1900523, 1945620, -4504884, 2823941, -2161442, -2319819, 4640712, 3858491, -1939178, + -1482301, 2720325, 1348620, 1239098, -2788508, -3758633, 1757715, -1560147, 2689187, -613643, + -217433, 2125472, -694174, -137439, 592169, -833761, 976568, 175557, 443992, 1373316, + 637803, 2086280, 319438, 758062, -1615982, -1094143, -1898912, -1057636, 1387274, -1022739, + -2087354, 1249299, 663036, 626528, -1462973, -2000381, + }, + { + -112206, -22228604, 36974300, 13831405, -7192460, -4263829, -6691022, 1223529, -6744173, -5806796, + 15625091, -1597728, 12141873, 4092567, -395137, -18397492, -4455492, 16508244, -4903779, -10711648, + -2172717, -434329, 12020540, 13172665, 3016141, -3892851, 4663261, 3383897, -3919158, -565325, + -7323993, 9079024, 7203197, -5530844, 1739999, 5724655, 5326833, -491774, -2434173, -3446175, + 4772783, 2369748, 3118146, 3532611, -9507447, -775778, -665720, 268435, -1584843, -582505, + 2965138, -5456756, -2935610, 2428267, 752693, 2783139, 2003065, 165893, -1866700, 2066953, + 3491272, 186831, -2414845, -2123325, 850940, 2560338, 2095944, 2636036, -1525250, -2274722, + 759136, 223875, 2319282, 3127273, -452582, 815507, -861678, 1906429, 451508, -302795, + -291521, 1209033, 521839, 130460, 637266, 222265, -990527, 209917, 2405719, 1638530, + 75699, 102005, 369904, 3040300, 760746, 213675, + }, + { + -1326071, -107807976, -27940372, -13987635, 39588860, 2778307, -3538516, -7281580, -7989713, -24969330, + 9994389, 1265942, 6152541, 4630512, -15479062, -5221070, -2098629, 22629646, 475668, 8660802, + 3300146, -13336947, -20726976, 6852621, 2711198, -2635499, 2931852, -2123861, 2830920, 2209224, + -135291, -216896, -5966784, -3557307, -46708, 2789045, 1997697, 4361540, -3404835, 488553, + -3192235, -13842143, -10522133, 3310883, -2465848, 748935, 6720550, 748935, 4911832, -709743, + 617938, 8658117, 350577, 6339909, 1431835, -4413079, -900869, -7886634, -3636227, 579284, + -2295123, 6946573, 4881767, -2838437, -3834332, -3765613, 2101850, -1037235, 2243047, -461172, + 760209, -3442416, -1042066, -838056, 1642288, 2238752, 1551557, 1291711, 329639, 708133, + 3131568, 2593624, 220654, 1046361, 1320166, -470836, -2526515, -893353, -1502702, -998043, + -1181653, -387084, -1199370, -508954, -468151, 1197222, + }, + { + 2840584, 19521700, 72428720, 8179229, -19241990, -6729140, -3208341, -4123706, -3352759, 3201361, + -3748433, -6656126, -963146, 9094593, -13149579, 11170136, -16363825, 1872069, -161061, -10790032, + -16603270, -4431870, -3796214, 27523762, -18025440, -997506, -4805532, 7494718, -3742527, -6160594, + -5187784, 9824201, -18676128, -6065031, 385473, -4685810, -1553704, 5662378, -1823751, 4057134, + -6467147, 8670465, 956704, -222801, 4481262, 1813550, 3257733, 1797981, 2385854, 789200, + -571231, -4328254, 1437203, -79457, 2760053, 3762391, -5000416, -9319005, -4965519, -882079, + -2515777, 2632278, 3940096, 1468342, 3735548, 3185792, -2738042, -575526, -228707, 3105261, + 4651987, 5493263, 465467, 834834, -3428995, -267362, -1138703, 798327, 1821603, 2280628, + -483184, 1029718, 898722, -1233729, 539018, 1440962, 24696, -21475, -1075352, -258772, + 115427, 177704, -1333051, -1074, -462783, -54761, + }, + { + -110059, -116359256, -32743220, -29892436, 35485020, -1203128, 1138166, -3376381, -4884452, 2858838, + 1922535, 3825205, 14903000, -6165426, 7366406, -1086090, -12905303, 168041, 12025908, -3001645, + -19264002, -5626407, -5781563, -1730335, 4005594, 1698123, -10488847, -8413841, -227633, 4650913, + -4880694, 7022272, 1766842, -273804, 5072893, 8187282, 3508452, -4601521, 3630858, 2437931, + 2516314, 4398047, 3227668, 5944235, -130460, -9123047, -4925791, -3935264, 4879620, 5014911, + 3167539, -409633, 4933844, 8540006, 2953327, 577673, 2040646, -436476, 7777649, 536871, + 581968, 4367982, 4963372, -1917166, -2658585, -12348, 1276679, -656056, 2651069, -1007707, + -1219771, -2634963, -3870303, 1568737, -68719, 256087, -3550864, -4062502, 649614, 2227478, + 1730872, 2201171, 311385, 1496796, -1662152, 339302, 905164, -1282048, -134755, 717260, + -1354525, -157303, -348966, -3120831, -726386, -453656, + }, + { + 2425583, 28625958, 74911744, 7096360, -13113072, 600222, -9455371, -2309619, 2728915, -4089346, + -2017024, -3335042, 7347616, -3579855, -32488206, 8150238, -33888364, -4146254, 7224672, 3732327, + 3085397, -2595771, -1759863, -15017890, 14488535, 17285632, 5854041, -19937776, 14428943, -5717139, + -2312840, -1478006, -4074850, -6109591, -7028177, 5366562, 8867497, 7182259, -1919850, -1389959, + -6934225, 4573604, 4156992, -3379603, -1505923, 3190087, -624918, 5231807, -855772, -231391, + 3824132, 1187022, 3558917, 2101850, -2315524, -4295, 1880122, -2211908, -2516851, 1466731, + -213138, -2687576, -433255, 1635846, 143345, 1220845, 5265630, 1870995, -1891396, 2481954, + 4265977, 625992, -1919314, 948651, 2109366, 2321967, -4362076, -2598455, 1253594, 509491, + -2052458, 1910187, 1239098, 1713155, -709743, -844498, -2099702, -608275, 641024, 1101122, + -971200, 1282048, -845035, -941135, -453656, 15032, + }, + { + 291521, -117202680, -32640678, -31412854, 37101540, 4227859, 5443871, -2132988, 1046898, 2382633, + -3817152, 8106751, 5514201, 2924873, 1137093, -6921877, -3882651, 7703561, -14851997, -10074383, + -1019518, 36507, -16736414, -1857037, 20851530, -16414291, 3663607, -10456098, 9254044, 8129836, + 11380590, -8959302, -6221260, 10748156, -4366371, -2882997, 2134599, 944356, -9257265, -15941845, + 1418950, 1987496, -2864743, 6227166, -9197136, -5902896, 5765994, 5065377, -2803003, 484258, + 3499325, 1597728, -3085934, 995896, -3309272, 2144799, -693637, -5987722, -1166621, -4209068, + -2681133, 1370095, -2305324, 351650, 58519, 5182952, 3117610, -1252520, 3334505, 64961, + 172872, -978179, 1255204, 98784, -2672544, 987306, -2749853, -287763, -1573032, -1551020, + -179315, -2666101, -2755222, -248571, -700080, -1873143, -100395, 998580, 570157, 2275796, + -255014, -1036698, 885300, 132070, 39728, -690953, + }, + { + -1876901, -53823456, 41023916, 11574400, 10167798, -5745593, 6069863, -18894634, 12590697, 440771, + 3104188, 4104378, -11781095, 6207839, 10764262, 15918223, 1977833, -9730785, 20125680, -471373, + 11725261, 6162741, 5315022, 1906429, -8167954, -6075768, 1087164, -7350300, -6575058, -7321309, + -2320893, 931471, -7814693, -6950331, -6565932, -2757906, 7437273, 3851512, -260919, 3912715, + 5825587, -4586488, 3971234, 1350767, -322123, -4165582, 1059783, -11812771, -648003, -12928388, + -4391067, -434865, -8895414, 1716913, 1145146, -868120, -356482, -7435662, 5916855, 392453, + -2411624, 2589865, 131533, -6613713, -6801081, -3231963, 1323387, 2672007, 1663226, -3183108, + -3061238, -2901787, -68183, 1374926, 3056943, -575526, -1894618, -2269890, -57982, 864362, + -1247688, -2234457, 344671, 904628, 1250909, -2196339, -4865661, -399969, -302795, 622233, + 856309, 562641, 2616709, 759672, 2206540, 8590, + }, + { + -3345243, -97843112, -6881612, 1919850, 21837762, -5849746, 54575612, -20984136, -6523519, 13361643, + 752693, 10982768, -1336272, -5866926, 6695854, -8827232, 12081743, 15543487, 28243704, -13143674, + 10166724, 4944044, 932008, -14496, -9770514, 15855946, 3461207, 10054518, -3845606, 15150497, + -20538534, 5883032, -5692979, -3687766, -4599373, -3944928, 2462090, 4513474, -1031329, 174483, + 1992865, -1857037, -983548, -1773822, -2971044, 1285806, 3325379, -1798518, -106837, -216896, + -9670656, 1739462, 9358197, 759672, -4509716, 3543885, -6254546, 2450279, -2008434, -2867428, + -337155, 2949569, -549756, 419833, -751619, 655519, -4195110, -221728, -1492501, -380105, + -285078, -285078, -2135136, 1074816, 848256, 1095217, -113817, -602906, 2066416, 251792, + -102005, 864362, -1707786, -2166811, 1879585, 1541356, 3093450, 352724, 110595, 1642825, + 565325, -2336462, -256624, 1815161, -188979, -16643, + }, + { + -194347, -36638756, 48154636, 13392782, 5698885, -9632001, -18341658, -34360, -8987219, -876710, + -25784300, 26134876, 11570642, 12614856, 14025753, -9343701, -23434952, -2729989, 13749264, -5842766, + 15379204, 7581154, 6629819, 11803107, -17057462, -630286, -892279, 10880763, -1430224, -6323803, + 2393908, -11952894, -13045426, -3394098, 2113124, -4927938, 11023570, 3745212, -1061394, -8231305, + 1407139, 4132832, 2359011, 11431592, 6308770, -3183645, -787053, -357556, -2481417, -2266669, + -4186519, -1806034, -211527, 585726, -2208150, 1295470, 2469606, -3841312, -1308891, 5882495, + -1364189, 3752191, -5879810, -5424544, -253403, -1474784, -3657165, 6175089, 3255048, 481036, + 841814, 890132, 1291711, 2427730, -2325188, 170188, -1178969, -1187559, 715649, 2447058, + -1466195, 508954, 484258, 1662689, 401043, 2080912, -995359, -1940788, -984084, 181999, + 1942936, 571231, -564788, 195958, -2005213, -309775, + }, + { + 11995307, -53174380, -26763552, -9985799, 17700634, 11715597, 32778654, 9242233, -1393717, 3657702, + -17557290, 24019604, -12178380, 928787, -17156246, -9944997, -20139638, 8185671, 595927, -6781754, + 12210592, 3320547, 6948720, -4150012, -13031468, -4571456, -1506997, -81604, -1220845, 6573985, + -1589675, -12791486, -15239618, -6007049, 398895, 666794, 3139621, 9533754, 4207994, 477815, + 8830453, -8923331, 2670933, -16621523, 3075734, 4488778, -3046743, -647466, 8003672, 4810364, + -2694555, -7594039, -4909148, 4975720, -5912560, -3149822, 4973572, -3958886, 876710, 865973, + 207769, 2612951, 1114544, 579821, 2177012, -1192390, -4927938, -1167157, -4012573, 1702418, + 3877819, 34897, 2764885, -530428, -88047, 1421097, -3170223, -262530, 1072668, 2426120, + 1373316, 1322850, 1971927, 678605, 979789, 2668249, -993748, -2325725, -57982, -734976, + -1758789, -1232119, -436476, 153545, 647466, 1756642, + }, + { + -2769717, -63939180, 32897838, 161598, 6072010, -8055211, 3435974, -2244121, 13243532, 2166811, + -7989176, -1430761, -16013249, 11568494, 5647345, 5945846, -8694088, 1822140, -2937221, 2959769, + -925029, 8119636, -3959423, 18603650, 6665789, 5930276, 2753074, 1301375, 6325950, 4182761, + -17182016, -3129958, -2487323, 6036040, -9148817, 14370424, -1803349, 12700218, -9144522, 8628589, + 4205310, 291521, 2240899, 7143605, -485331, -4903242, 4276177, 6288369, 7260106, 6905771, + -2301029, 7514046, 1222992, -1105954, 2963528, 2771328, 1687922, -106300, 2668249, 3803194, + -1047435, -2923799, 752156, 1486596, 2004676, 2789581, -262530, -77846, -3362423, -1074279, + -903554, 1272921, -1183264, -490700, -2328946, 941672, 334471, -419296, 390842, -1193464, + 2764348, 4239133, 963146, 1587527, -969052, 1516124, -1790465, -2993055, -1287417, 3009162, + 265214, 1247151, 404801, 1598265, 1053878, 1216013, + }, + { + 9769977, -53098144, -27269284, -9379135, 23380192, 19413790, 31679678, -14296336, -20302310, 4613869, + -6808060, 10069014, 31686122, 747324, 20963736, 30127584, -2164127, 2165201, 14933064, -4929012, + -10440529, 4318053, 5173825, -8502962, -308701, -2908767, -4304094, -504659, -2199560, 1261647, + -715649, 4082903, -3003256, -10276783, -21744346, -843961, -2660732, -8066486, 493921, 2695629, + -431107, 2781528, 3142842, 4685810, -3817689, 703838, -8444443, 1032940, -2723546, -2524367, + -5902896, 5281199, 1321776, -3243237, -774705, 318364, 3325379, -2682207, 2326799, -4560719, + -462783, -2148558, -2510945, 2092186, 360777, -5019743, 1083942, 2735357, -489089, -1129576, + 616328, 2615098, -2039573, 1565516, 3150896, 3101503, 362925, -1963337, 1016297, -154082, + 332860, 973884, -1726040, -704375, -1683627, 1392106, 1280437, 523449, 2512556, -945967, + 376883, -1934883, 1600412, -312996, 941135, 1279363, + }, + }, + { + { + -1074279, 64811592, -9386651, 19950124, 22123376, -231928, 629213, -780073, 5285494, 5345087, + -1084479, -7245073, 1781875, -11851962, -6980396, -972273, -9569724, -5005248, 3846680, -3317325, + 13835163, 20823612, -8036958, -15164993, -5007932, -15404437, -1117765, -4191888, 1264331, -11127187, + 6630356, -673236, 4551055, 2903398, -10674067, -1463510, 6487548, -2608656, 781147, -7766912, + -5565204, 4756677, -2791192, 2952790, -4130148, -1642288, 4126927, 1518271, -7433515, 79994, + 44560, -76236, -647466, -93952, -5713917, 531502, 8153996, -2785823, -1705102, 3574487, + -2355253, 6888054, 2362769, -3284576, 1365800, -77309, 500901, 1029718, 2110977, 3074123, + 6784975, -236223, 1129040, 2563559, 1015223, -4500052, -1925219, 1427003, 1602023, 755377, + 3122978, 54224, 674310, 3030100, -674847, -1751810, 381178, -1336272, 251256, -1525787, + -1455457, 727460, -77846, 1475321, 1300838, -656056, + }, + { + 5630166, -95685968, -77680392, 71777496, -311385, -8258149, -14732812, 6178311, 6627135, -1569811, + 658204, -5616207, 1562831, 1768990, 11697343, 6031208, 1445257, -7712688, 11219528, -15909633, + -14496, 6737193, -4626754, 3201361, 7283191, -837519, 3627637, -4278861, 3859565, 10496363, + 2345589, 2172717, -4531191, -1198296, -2835215, -1007170, 5805722, 2943126, -4485020, 5206037, + 485868, 6812892, -314606, -3408594, 2324651, -8997956, -1017370, 1175747, -4174708, 5519033, + -4452808, -206695, 4203699, -5969468, -953483, -2375117, 2794950, 3177739, -2566243, 393526, + -2927020, 656593, -1925219, 1499481, -1490891, 328028, 2423972, -1507534, 1799591, 3942243, + -723702, -2417530, -2027225, -1627256, 730144, 592169, 1237488, 540629, -8590, -3118146, + -1203665, -1481227, 183073, -111669, 597000, -1029718, -1266479, 996969, 2209224, -1762010, + -1518271, -761820, -855772, -956167, 925565, 105764, + }, + { + 336618, 10593000, -56006912, 52958556, 10283762, -9141838, 448824, 1947231, 16557099, 7068443, + -2212445, 3525631, 3864934, 1600949, 704375, -6005975, 1256815, -8791261, 1609002, 5747203, + -10000831, -7915088, -4707821, 4976794, 678068, 1927367, -17828946, 5015985, -1075352, -9535901, + -3770981, 2958159, 5776731, 5077188, -6386080, -4508642, 1799054, -995359, 5159330, -1944547, + -681289, 1436667, 1178969, 2080375, -2271501, 5454072, -2717104, 145492, 6579890, 4000225, + 1012002, -6769406, -827318, -1821066, -1433445, 345745, 1991791, 1675574, -1269163, -3214783, + 1049583, 2409477, 624918, 2455111, -2843805, -1217086, 305480, 4262755, 1010391, 533113, + 1233193, -1837709, -186294, -261456, -3317325, -333397, -347355, 981400, 1309428, 272194, + 1438814, 3198677, 1427540, -1636919, -797790, 163209, -507880, -1232656, 391916, -352187, + -2337536, 154619, 312996, 2597382, -1054951, -1914482, + }, + { + -803159, 22520662, -6762426, 3120294, 5821828, -4398047, -2863670, -1412507, 4361003, 10607495, + -11466489, 4205310, 4266513, 4044249, -6601365, 1724966, -4417911, -2771328, -8264054, 372052, + -5450851, 5379447, 16248398, 16438450, -5944235, -4000225, 6168110, 2060511, -5257040, 1139240, + -3389803, 4101157, 8509404, -5546951, 3404299, 1455994, 4057670, 6534256, -3141769, -5005785, + 5037997, 2716030, 1917166, 4591320, -12731894, 975494, -806380, 2376191, -4983236, 5148055, + -5238250, -7421167, 3133179, 2529736, -1324997, 3745212, -963683, 2813741, -2961917, 5085242, + 1351841, 1505386, -3137474, -170188, 1424319, -2358474, 5195300, -235686, 1439351, 1393180, + -1594507, -1989644, 4560182, 806380, 364535, -49929, 1111860, -222265, -666257, 947577, + -457951, 1384590, 447750, 16106, 819265, 923955, -1653562, 2932389, 862752, 1401233, + -219043, 45097, 1262184, 855772, 1737314, -1089311, + }, + { + -385473, -176216064, 13844827, 27766964, 4578972, 3609383, -11180337, 4177930, -9029095, -27807228, + 13125420, -7774428, 7097971, -372052, -12459163, -1090385, 12474733, -8871792, 14133127, 3794604, + 1110786, 2239289, -15861314, -2422899, -908922, 3815005, 7634841, -3932043, -4057670, 5323075, + -3085934, -2531883, 410706, -3479997, -1540820, 3795677, 3012920, 1920387, -1978906, -971200, + -4316442, -12830678, -10648835, 897111, -3046743, 3978214, 14468671, -1576253, -4023848, 3189550, + -2825015, 10972031, 6398965, 126702, 1607392, -1382980, -5058935, -8486319, -667867, 50466, + -1890323, 7860327, 2123325, -3438658, -1461363, -54224, -682900, -1893544, 1244467, -310848, + 459025, -1247688, -1806571, -73014, 1315871, -32212, 1463510, 5046050, -1560684, 2288681, + 2213519, 1950989, 1482301, -483721, 1133335, 352187, -1505923, -869194, -1811939, -1927904, + -1071594, 503048, -1488743, -1705639, -165356, 1378685, + }, + { + 1111323, 54024248, 34416108, -16654273, 6667937, -7014219, -5723044, 1159104, 4083440, 1891396, + -11433740, -2220498, -294742, -12768938, 2069637, 6112276, -7465727, 118112, 2206003, -15590194, + -13213467, 69256, -1112397, 20812338, -21613350, 5235029, -2983929, 7677791, -4989679, -8834211, + -788663, 2586644, -17373142, -1429687, -3674882, 346819, -2464238, 735513, 383326, 9367861, + -4701379, 3268470, 492848, 3673808, 8675834, -1293859, -2796024, 5309654, 3148748, 1447941, + -1122597, -4584341, -1791538, 4655208, 2426657, 4020626, -6869800, -8038568, -6693170, 1291711, + -1655173, 1001264, 4751308, -227096, 3743064, 2881923, 1781338, -3107409, -1319629, 792421, + 9545565, -51540, 84289, -417149, 545998, 732292, -215822, 9664, 3783866, 2210298, + -936303, 495532, 2167885, -1548336, -465467, -381178, 2336999, 446140, -1378148, -293668, + -1520418, 464393, -3008088, -70867, 1722819, -671089, + }, + { + -3237332, -190296576, 18593450, 28940026, -19192062, 1638530, 4634807, -8120710, 6613713, -8473434, + 14755897, 4121021, -1739999, 1142998, -1711545, -10888816, 10240276, -4949950, 1971390, 1096827, + -15673946, -427349, -9185324, 2061584, 3467112, -7660611, -471373, -8686034, 864899, 4945118, + -5937256, -590558, 4169876, 4715337, 5327907, 4772246, 1819992, -3007551, 7028714, 3431142, + 5104569, -3448322, 7999377, 3630858, -2258079, -4115653, -8226473, 24159, 7171522, -1668595, + -308701, 4291746, 6692096, 5185100, 7554848, 3396246, 3028489, 16106, 4454418, 1820529, + 2724083, -1572495, 4902169, 1648194, -6834367, -83752, 2622615, 122943, -39728, 55835, + -632434, -5151277, -1671816, -250182, 812286, -369904, -1468342, -2578054, -515396, 2233920, + 2406256, 1181116, 200790, 26307, -497142, -403727, 2237678, -643708, -1407139, 1073742, + -1260036, 4295, -1809255, -1957968, -1735167, 1254131, + }, + { + 2084670, 40535364, 55119464, -13316546, 5469104, 1269163, -2270964, -553514, 3891777, -2393371, + 1277216, -11481521, 4065724, -11195906, -22644142, 8650601, -32423782, -15829639, 4663261, 15688442, + -530965, 1724429, 4172561, -13501767, 7699266, 5320928, 8842264, -6453189, 6973953, 3115462, + -5442798, -11606612, -8853538, -2037962, -3692598, 4878546, 6444062, 10634339, -767189, -2748779, + -1807108, 3235721, -869731, -4114042, 2915209, 1075352, -339839, -133144, 5231807, -2058363, + 5833103, 1120987, -828929, 3475702, 674310, -3329137, 2937758, 1769527, -57445, -5104569, + 2171643, 66035, -1977296, 2285996, -1899986, -746251, 3282429, 4128537, 2328409, 163746, + 4939213, -232465, -2306398, -846645, 3110093, 2435247, -1741609, -1622961, 2458869, -490700, + -2228551, 717796, 872952, -503048, -115964, 274878, -1214402, -130997, -1991791, 1117228, + -157840, 691490, -1515050, 828929, -667331, -42413, + }, + { + -3593814, -177594752, 7354595, 31607738, -14659260, -4070555, 8518531, -1302986, 13085692, -96100, + -1469953, -14723685, 9043591, -463856, -1769527, -5677947, 9957882, -7373922, -719944, -15555835, + -2724083, -4927401, -6817187, 459562, 6625524, -6868727, -6496675, 5956583, 3243237, 4859756, + 2294050, 659278, 2537252, 1860258, -2474438, -1937567, -151398, 4659503, -8928700, -15081778, + -2156611, 2716030, 1373853, 907312, -4970888, -7057705, 2319819, 3057480, -5397700, 3724811, + 4749160, 709743, -5152350, -4201552, 4798016, 1100585, -124554, -1124745, -252329, -4219806, + -4546760, 573378, -3142842, 319438, 800475, 1946157, 2717641, -1097364, 849867, 2097018, + -3446711, 267362, -834297, 5230734, -3151969, -963683, -1327682, 295816, 36507, -372588, + -2260227, -3542811, -1852742, 288300, -1784022, -2169495, 1920924, -102542, 1433445, -184684, + -1323924, 250182, 3758, 2076617, -571231, -1647120, + }, + { + 388695, -6835978, -2883534, 8643085, -1477469, 754304, 21290152, -14504641, -537945, 2413772, + 9173513, -3044595, -8417599, 11725798, -3650185, 7761006, 14231911, 11056320, 6665789, -8223789, + 12211129, 3745212, 11484743, 994822, -2390686, -2884608, -6830609, -6543383, 217970, -10462003, + -2184528, -2852932, -16234976, 3535295, -16062104, 3053185, 10365904, -789200, -9737765, 10708427, + 1556926, 1325534, -2617246, 11225971, -8629126, 2785823, -11100343, -5301064, -2604361, -12925167, + 5800890, -6755984, -11341935, 7653632, 2843805, -7129109, -2976949, -3902515, 5323075, -1239635, + 3430605, 916439, -2375117, -9845139, -6665789, 3058017, 1573032, 484258, 5148055, -5814312, + -3610994, -1883880, 965294, 5322002, -2973728, -1625108, -1532230, -1243393, -976031, -1136556, + -1254667, 131533, -96637, 1597728, -1421634, -1047435, -3032247, 628676, 1562831, -977105, + -74625, 363462, 2724620, 366146, 1490354, 745714, + }, + { + 2899103, -130011344, 4263292, 397284, 10437307, 32434520, 22788560, -24237574, 1045825, 21194052, + 5437966, -6129455, 8367133, 7656316, -13720810, 12620225, 11023034, 23104776, 14329622, -824097, + 942745, -3855270, 9284109, -5477694, -681289, 16660178, 3530463, 3310346, 5867999, -13721347, + 3668976, 570157, -6668474, -3614752, -13848585, 2867428, 2042794, 5413270, -1221918, 584116, + 7262253, -1360431, 5936182, -5782100, -12018392, -2392297, -286689, -96100, 9280887, -10492605, + -1516124, 4960687, 4303557, 1188632, -5317170, 1345399, -4164508, -226560, 575526, -8567386, + 5528697, 3667902, 1234266, -4605816, 1433982, 3356517, -7393250, 1612760, -1459752, -3833795, + 4252018, -3327526, -1904281, 4295, -2137283, 2613488, 186831, 1130113, -93952, 864362, + 801011, 758599, -2240362, 383326, 456340, 1136019, 1998770, 622233, 3609920, -555125, + -852551, -560493, -1115081, 1209033, -981937, 413927, + }, + { + -273267, 24588688, -17058536, 14903537, 6541235, -10857677, -3721589, -10392747, -3422015, -6706055, + 9240085, -7969849, 10973641, 25065966, -13582297, -2654827, -18658948, 12423730, 1693291, 2378338, + 6494528, 11288785, 25364466, 2762201, -11065983, -9432822, -4196720, 14616311, 7982197, -6450504, + -3584687, -16396575, -17305496, -5197984, 9043054, -3917547, 7953743, 1754494, 2683818, -3179350, + -5743445, 2904472, 6183679, 11751031, 5498095, -5377299, -718870, -1341640, -2282775, -3680250, + -3758097, 4388920, -5060009, 6781754, -3932043, 3369402, 2774549, -5637145, 3002719, -5970005, + 1464584, 5425081, -5382131, -5396627, -3300146, -1630477, 2115808, 2586107, 1607928, 2413235, + -244813, 3992172, -2009508, 1513976, 1262720, -345208, 1854889, -2176475, 885837, 3433290, + -4149475, -67109, 2117956, 549756, 289373, 1853815, -2471217, -1780801, -2338073, 1100049, + 1531693, 2248416, -339302, 1229434, -2090575, -1292248, + }, + { + -18018998, -55444268, 1780801, -4210142, 14332306, 37106368, -6190659, 9109626, -1481764, -2969970, + 654983, 17292612, -10095858, -5542656, -16081968, -6213207, -16641925, 1509681, 376883, 3719442, + 10778757, 7319698, -5422933, -5787469, -8803072, -569083, -3628174, -4539244, -2885681, 216359, + 6910603, -20651276, -12793634, -3067681, -5316096, 11433740, 6671695, 3861713, 1191853, 3892851, + 5463736, -9273908, -2652142, -6829535, 609885, -6005975, 5982890, 98784, 622233, 8391829, + -2997887, 1347546, -4355097, 4517769, -7104950, 309775, -2005750, 1346472, -3372086, -2571612, + -515396, 3111704, 3729105, 1192927, 126165, 2424509, -6000606, -4466766, -4980015, 4212826, + 386010, 3706557, 1494649, -825707, 2842195, -1199907, 1809792, 115427, -31139, 2321967, + -892279, 708133, 989990, 439160, 2531883, 3326989, -3771518, -674310, 119722, -1656247, + -748935, -1381369, 494458, 838592, -404264, 1418413, + }, + { + 1600412, -32166620, -12130598, 4434017, -4866735, -4128537, 18082350, -6502044, 6463926, 15548318, + -4890894, -5592048, -7899519, -16248398, 31989990, 13929116, -25713432, -1234266, -345745, 3824132, + -6531572, 10713259, 10854993, 14905147, 3543885, 7963943, -7298223, 11702175, 14493904, -1387811, + -20185810, -4101694, -2641942, -433792, 3473018, -633508, 12038793, 2995203, -6385006, 2836826, + 10296110, 6935299, 5112085, 5187784, 2619393, -8699993, -663036, 5247913, 4009889, 9201431, + 8453569, 1221381, 763430, 6467684, -3819837, 187905, 3722126, -581431, 3032784, 2616172, + -1305670, -1414655, 1397475, -1911797, 1882806, -522375, 6310381, -3046206, 92342, 612570, + -2364916, -1289564, 854162, 335007, -5418638, 2285996, 488016, 1789928, -1240709, -2797098, + 2354179, 5748814, -24159, 355945, 1668058, 256087, -1552094, -2298881, -809064, 2687039, + -683974, 2026151, 1874216, 655519, 474057, 1175747, + }, + { + -14275398, -72769096, 8062728, -3331821, 14369887, 44408352, 5703180, -8891119, -24415278, -1595044, + 4536023, 2641942, 29028074, 3379066, 39849780, 16346109, -10277320, 5446556, 25934086, 1324997, + -8442295, -6917582, 4262218, -11175505, 8982387, -209380, 5404143, -15182173, -2011118, -666257, + 7186017, 8676371, -11583527, -14059039, -13606456, -2752000, -2677375, -12838194, -2705830, -803696, + 1567126, 4224637, 6099391, -5185636, 11900818, -4678293, -7665443, -5774047, 1483911, -3052648, + -412854, 2413772, 2275259, -1658931, -4756677, -1983738, 1411971, 102542, 3680787, -1911797, + -4544076, 2930778, -6706592, 1177358, -3267396, -2149094, 1115081, 1408749, 510027, 1155346, + -687195, 5842230, -3730716, -404801, 5313949, 2007360, 2327872, -2323041, -344671, -2015950, + 2663954, -317828, -1898376, -2048163, 1369021, 1680943, 470299, 1408749, 2628520, -1345399, + 876173, -1508607, 376347, 1345399, 325881, 285615, + }, + }, + { + { + -1527398, 52698176, -22193170, -22399866, -15205795, 1461363, 3707094, -772020, 208843, -2526515, + 8063264, -4469451, 768799, 4362076, -5555004, 905164, -1810329, -10914049, 7479149, 4619238, + 8782134, 6646999, 55298, 4881231, 9058086, -16809428, -3018825, -3957812, 4129611, -18316424, + -1465121, -6149320, -6919729, 3755949, 963683, 3060164, 3051038, -2750390, 4839892, -4594542, + -4699231, 8889509, 2992519, 716723, -3022046, 1372242, 8112120, 2001455, -7399692, 8104604, + 3867081, -876710, -711354, -1641751, -8005282, -2557653, 4753455, -1381906, 1835562, 1811403, + -5893769, 951872, -2322504, -3790309, -529892, -4081830, -1163936, 1432909, 2057826, -23085, + 811212, -1853815, 921807, 1526861, 925029, -2600066, -754304, 862752, -166430, -927713, + -183610, -1632088, -1249299, 894427, 3758, 121333, 1484985, 1071058, 2067490, 413927, + 539555, 985695, -747861, 879395, 1095217, 677531, + }, + { + -5530308, -17485886, 8638790, 69162392, 476205, -5715528, -9089225, 3867081, -1654636, -594853, + 86973, -2231236, 1651952, -7636989, 6245956, 7187091, -5796595, -5444945, 22434762, -10364293, + 362388, 8742406, 3332895, 4896800, 2491618, -182536, 11855183, 5643587, -1432372, -1722819, + -2621004, 2221572, -2039036, 3663607, 561030, -1502165, 3467649, 5381057, -2538863, 1614371, + 736050, 5804649, 1132798, -789200, 7251516, -6369437, 776852, 2081985, -2765422, 3282966, + -4032974, -4017405, -1176821, -5488432, 3488587, -467615, 515396, 1161789, -3448859, -1799591, + -4838281, -1280974, -2680597, 4844723, 5167383, 2895345, 3929358, 1908576, 47245, 1415729, + 293132, -615254, -1684701, -3298535, -942745, -375273, 42413, -1193464, 901406, 359167, + 570694, -635118, 1095217, -1289027, -119185, 972273, -661962, 112206, 756451, -1089311, + 48318, 539018, 884226, -457414, 105764, -1438814, + }, + { + 1301912, 82709256, -13147969, 5898601, -22315040, -1650341, 3963181, -6402723, 6171868, 2262911, + -1944010, 888521, 176631, -5514201, -382789, 3112778, 4617627, -9171903, -5108864, 2641942, + -1646046, 2858838, -3834869, 411780, 2007897, 9040369, -6550362, 8945880, -3724274, -12636331, + -3980361, -3495567, 73551, 930397, -1227824, -91268, 3625489, 346819, 5113696, -4147328, + -2575370, 4046933, 4896800, -540629, -7264401, 3890704, 1110786, 2004139, 68183, 1180579, + 7242389, -4389994, -2015950, -526670, -785442, -153545, -448824, 168577, 2899103, 576063, + -2162516, 294205, 506806, 4239133, -645856, 1708860, -1476932, 1440962, -1882269, -2187212, + 183610, -2459943, 940061, 1005022, -4079682, -274878, -682363, -1278827, 1780801, 2331094, + 1477469, 2396592, 549219, -2193655, 257698, 1600412, 449898, -998043, 119185, 533113, + -860604, 639950, -301185, 1716913, -812823, -535260, + }, + { + 695785, 49483392, 8672613, -6139119, 419296, -350040, 369904, -464393, 2513630, 12277164, + -9881109, -2021856, -1815161, -4785131, -15630460, 382252, -11687680, -5691906, -3773129, -2806224, + -5459441, 1160178, 6862821, 12829604, -1389422, 2245731, 2028298, 3337727, 287763, -2828773, + -3600256, 6354941, 7882339, -5493263, 1030255, -12316892, -7381975, 4341675, -1526324, -4817880, + 6032282, -2283312, -8259222, 2937221, -11268384, 4676683, -790274, -1656247, -3586835, 2246805, + -6417755, -7380902, 2386928, 5300527, -4255239, 1786170, 1728188, 4220879, -2819646, 587337, + -2395518, -590558, -1007707, 1905892, 3402688, -2862596, 4408247, -324270, -1174674, 728534, + -847182, -2149631, 2371359, -1134408, 793495, 1544578, -1076426, -4403415, -2668785, -63888, + -2127083, -872952, -484794, 220117, -102005, 586263, -629750, 3010772, -1100585, -183073, + -469762, -979253, -1876364, -2155537, 336618, -1375463, + }, + { + 2222109, -186639952, 6117107, 37877852, 1799054, 2062658, -10998874, 8242042, 2318209, -17170206, + 20549272, -14178224, -470299, 215285, -1586990, -3606699, 2602213, -12360916, 10521596, -585726, + -7507066, -2914672, -1046898, 6986838, -212601, 166430, 5180805, 4958540, 4683662, 8925479, + -2551748, 1843615, 2094333, 2774012, 1314797, 3293703, 1720671, 1413044, -1122597, 1407139, + 4239133, -1479616, -7290707, -279710, 289910, 4136591, 8149164, -8412230, -7507603, 3155727, + -7530152, 4012036, 4549444, -364535, -1052267, 119185, 339302, -431107, 4310537, 1502702, + -3102577, 1815161, -4542465, -3254512, 3096135, 2856153, -1855426, -1122060, 637803, -843424, + 1537598, 360777, 1392643, 410169, 1150514, -220117, -2036888, 928787, -2423435, 1984275, + -107374, 796180, 290447, -3096135, 57982, -1060857, -405338, 492311, -530428, 190589, + -44560, 2889976, 28991, -710817, 34360, 377957, + }, + { + -2834679, -17379586, -32096290, -14485314, 10947335, -1881733, -4675072, 2805151, 5490579, 3156801, + -3484829, 8249559, 6739341, 860604, 13782013, 2753611, -10653666, 1843615, -1105417, 1012539, + 3181497, 1764695, 2635499, 16863116, -14150843, 21749178, -6104759, 2745021, 2196339, 4354023, + 13282186, 8677981, -8537321, 5914707, -2309082, 1231582, -81604, -6409702, -3344706, 6681359, + -3457449, 795106, -370441, 4340065, 2876018, -3445101, -1451162, 2640868, -192200, 3310346, + 3081639, 1214402, 3992172, 2800856, -1268089, 1382980, -4038343, -999117, -3438658, 1042603, + 2189897, -59593, 526134, -887448, 1906429, 162672, 846109, -1764158, 3244311, 188979, + 3652870, -3996467, -3626563, -683437, 965294, 361314, 1483911, -216896, 2359548, 284542, + -2099702, 739808, 1174674, -639413, -137976, -1999844, 1392643, 35433, -857383, -26307, + -682363, -4295, -3262028, -275415, 1117765, -149250, + }, + { + 6238440, -191446016, 7990250, 54451596, -1531156, -3234647, 227096, -10946798, 14160507, -5280663, + 2378875, -1913945, 2379412, 1535451, -4409321, -2091649, 16335371, -10456098, -6252399, 10972031, + 872952, 1149978, -9506373, 11201275, 9343701, -3276523, 8611409, 244813, 3946538, 4109747, + -3528853, -2317135, 2068027, 411780, 3723737, -813896, -1118302, -5299990, 1265942, -230854, + 2308008, -3192771, 6090264, 2074469, -2042794, 1214939, -3960497, 205085, 4992900, 191663, + -1480153, -2945274, 5615133, 2751464, 2738579, -2019172, -4064650, -8123931, -321586, -314069, + 1000191, -5870147, -337155, 4119411, -3850975, -1674500, 671089, -815507, -578210, 271120, + 861678, -324807, -696322, -2294586, 1693828, 1887638, 649077, 760209, -863288, -1398012, + -277562, 97711, -1421097, 1134945, 1520955, 77846, 1463510, 456340, -753230, 59056, + -490700, 1205812, 830539, 73014, -1328219, 2080912, + }, + { + -2734821, -44521632, -28163712, -8975408, 9496710, 4300336, -1694902, 278636, 2275259, -288837, + 7126962, -1938641, 1847373, -2288144, 4277788, 14339822, -28190018, -9751186, 13686987, 16671452, + 431644, 5774047, 2020782, -14693083, 7291244, -12172474, 650688, -3680250, 8543764, -537945, + -9240085, 1571421, -6324876, -2570001, -1394254, -7397008, -5010616, 8666707, -5237713, -988379, + 2717104, -221728, -5091147, -6080063, 1761474, -1353989, -2373506, 2845416, 9285719, -4388383, + 5245766, -721555, -6621229, 2473901, 3459596, -1803886, 3950296, 1852205, 186831, -5781563, + 401043, 1349694, -1771674, 119722, 133144, 1162862, -102542, 372052, -905164, -3118146, + 247497, 1053878, 2531346, -453119, 2677375, 3522410, -326418, -2299955, 1697586, 643708, + -683974, -172872, 894427, -1052267, 743029, 1603633, -1858647, 413391, -981400, 898722, + 170188, 1090922, -1112933, 12885, -1242319, 111132, + }, + { + 6260452, -174626928, -445603, 55148992, 220117, -11848204, -4032974, -8598525, 6080063, -7567733, + -6129455, -12533788, 10126996, -2849711, -7167764, -15605764, 6171331, 506806, -1569811, -10741713, + 3971771, 963146, 4129074, -2725157, -678605, -1285269, -4958003, 8093866, -23085, -1316944, + 1772211, 5122822, 6842420, 3229279, -274341, -798864, -1688996, 8139500, -2451890, -6884296, + 3488587, 4296578, -557809, -1955821, -4641249, -9268539, -3292093, 8486855, 528818, 2798708, + 1755568, -1688996, -635118, 322659, 3526705, 2098629, -595927, -1024887, -1219234, -950798, + -1152125, -4403952, -6274947, 1702418, 1924145, 105764, -1437740, -3662533, -2477123, -2196339, + -3690451, 4076461, -1371705, 3010772, -2299418, 940598, 1210107, 1005022, -833224, 89121, + 701690, 864362, 2610803, 2323041, -525597, -1363115, 1865626, -277025, 61740, -2017024, + -501974, 649077, -765041, 1442035, -111669, -287226, + }, + { + 404264, 50472844, 27436252, -13194140, -14865956, -7306276, 23393614, -2248952, -2737505, -4820564, + 9580998, 4804458, -7299297, 6272800, -7254737, -2710124, 14936823, 8328479, -4701916, -17541720, + 9923522, -25233, 7937100, -6031745, -1852205, -4445291, -6644852, 1493575, 10467372, -5600101, + -4015795, -1440962, -11977590, 6749541, -18832894, -4181151, 8604430, 2107755, -9033390, -222265, + -1874753, 3994857, -4008815, 13961865, -15577310, -1217086, -5717675, 1041530, 4951024, -4975720, + 5808944, -4905927, -7441031, 7503845, 6787659, 2985002, 1391569, 954557, 7466264, 2750390, + 7651484, -222265, -362388, -1890323, -983548, 4390531, -118112, 344134, 4947266, -3371549, + -1179505, -2279017, 1331440, 5559835, -3387656, -1413044, -211527, 2688113, 2825015, 1403381, + 1508070, -598611, -2525441, 779000, -2531883, -1052804, -1757179, 1338956, 1349694, -926102, + 518080, 569620, 1964411, -489089, 586263, -71941, + }, + { + -2816962, -137203808, -9673340, -3029563, 9947144, 2661806, -5363878, -4179003, 14921253, 9758703, + -4997732, -1234266, 12623446, 18671834, 7571491, 17905182, 1418413, 8733279, 11062225, 9005473, + 2730526, -4670777, 3409130, -8443906, -286689, 9672803, -5998459, -4825933, 3098282, -16583942, + -402653, 2760053, -2870649, -1833951, -13702019, 6378027, 2875481, -2359548, 971736, -1405528, + 1707250, 4677220, 7392176, -5123896, -8990440, -2854006, -960462, -8137890, 3034931, -6444599, + 2856153, 173946, -6712497, -1803886, 1035087, 4080219, -2881386, 840203, 3930969, -6453189, + 5763309, 588411, 2996814, -3229279, -2181844, 3656091, -1847910, 3917547, -123480, -1405528, + 3792993, -4726612, -3460670, -4497368, -3686693, 1832340, -1266479, 2658048, -1097901, 96637, + 734976, -2091112, -2698313, 477278, -497142, -493384, -231391, 632434, 2934000, -985695, + -1574106, 249645, -799401, -607738, -2779918, -769873, + }, + { + 51540, 58884540, -1977296, 1416802, 678068, -2942053, 4215511, -10733660, -2086280, -5696201, + 7677254, -9474161, 6056441, 13829258, -7868917, 27427662, -4558034, 3564286, -4826470, 3759170, + 4019016, 1314797, 13401372, -5493263, -6436009, -19327, 1632088, 1013075, -1302449, -9440338, + 1741609, 2559264, 4682051, 2099165, -702227, -5467494, 13002477, -2328946, -2024003, 2527588, + -1030255, -1063004, -4192425, 5578089, -24696, -5646809, 3090229, -943819, 1648194, -5612449, + -8909373, 2406256, -5850283, 4806606, -5756867, 3937948, 5725192, -1343788, 6268505, -3149822, + 2647847, 3799972, -4023848, -2172717, 1519345, -766115, -1662152, -2128693, 526134, 1247151, + -4504347, 914828, -2544231, 1281511, 1577864, -1098975, 125091, -1371168, 867047, 3075197, + -2473364, -1384053, -565325, 637266, 1014149, 2157684, -659814, -57982, -641024, 1407676, + 163209, 1869921, -657667, 1838783, -368293, -148713, + }, + { + 18800682, -44586056, -34293704, -18275086, 7318088, 10382547, -36784248, -1597191, -5382668, 3874597, + -5441187, 4665945, 264141, 19406810, 11696807, -2218351, -10852845, -1200980, -2877628, 942208, + 2034204, 4521527, -911607, -71404, -7601019, -352724, -8174934, -2655364, -1844689, -8474507, + 1729798, -13807246, -1109175, -719407, -7332583, 4283693, 716723, -266288, -2350421, 4950487, + 6658273, -5370320, 1408212, 307627, 736587, -5813238, 5983427, 2729452, -11274, 4192962, + 272730, 3112778, -1109712, 4966593, -9022653, 272194, -5633924, 1628866, 2268280, -2125472, + -2944737, 1567126, 4669167, 5184563, -467078, 1044214, -5924371, -4031901, -5996311, 1724966, + 515933, 5716602, 343597, 392453, 4963372, 556735, 1639067, -3960497, -4451734, -1114007, + -1275068, 418222, -923418, -1449015, -235686, 1683090, -2605435, 1464584, 2317135, 719407, + -1086627, -1853815, -1288490, -620086, -1348620, 335544, + }, + { + -884763, 14228153, 13981192, 694711, -2917894, 3073049, 17096654, -6529961, 1698660, 9405442, + 1671279, -2749316, -11248519, -28245852, 31757526, 26216480, -4725001, 11800423, 8241506, 5906117, + -23258858, 1978369, 6714645, 2591476, 5408438, 964220, -13953812, 9834401, 12847321, 9423158, + -9826348, -4428648, 1679332, 1204202, -4444755, -6033356, 11143830, 645319, -3604015, -2866354, + 314606, 792421, -417686, -2318746, 2895882, -3010772, -1817845, -2390686, -2167885, 2023467, + 2752537, -1868848, -338766, 8308614, -570694, 835908, 1826972, -976031, -362925, -3762928, + -4597226, -4612795, -3490198, -3026341, 562104, -2419677, 3260417, -3077344, 1085553, 1696512, + 520765, -1641751, -795106, 2429341, -3558917, 842887, 616328, 3594351, 1516124, -944356, + -308164, 3048890, 953483, 100395, 754304, 3044058, 828392, -2798171, -699543, 2152316, + -1963337, 828392, -702764, -1277753, -1242856, 1146219, + }, + { + 14837501, -66016332, -11934104, -9308268, -4827543, 3536369, -18589156, 5839008, -6877317, 4231080, + -4889284, -8969502, 8180302, 588411, 33723548, -611496, -535797, 9695889, 10933913, 1907502, + 1990181, -8114804, 6049999, 2266669, 12737799, -2655364, 7419019, -4721780, 7806640, -2719251, + -9361955, -716186, -2188823, 3502546, 946503, -966368, 993211, -8677445, -7822209, -4601521, + 1666447, 2110977, 8016020, -2363843, 10268193, -1176284, 4635344, -1433445, 1475858, -1711545, + -1678795, 1429687, 1599875, -2238752, -1142998, 530965, -973884, -7136625, -944356, 5140539, + -993748, 3442953, -3821984, 421444, 682363, -650688, -3649112, -23085, 1579474, 2255932, + -1291711, 4547834, -3149822, -3343095, 854699, 720481, 1709397, -2493766, 2418604, 609885, + 166967, -1410897, -1992328, -1226750, 1298691, 41339, 776852, 970663, 1151051, -2232846, + 940598, 809601, 3069828, 2399813, 215285, -938987, + }, + }, + { + { + 2229088, -15325517, 34388192, -31453120, -25071872, 5809480, 536334, 4423280, 1504312, -7795903, + 9941776, -2895345, -2981244, 5945309, -11225434, 1198833, 6073621, -4217121, 8955544, 5835250, + 11199127, -9896678, 6941204, 15214385, 11756399, -27055610, -1401233, -2091649, 7284265, -6249715, + -15392089, -4828617, -5803575, -47782, 6178311, 3420405, -2989834, 3221226, -1743757, -637266, + 2298344, 957778, 11854647, -8759049, 1546725, 4949413, -96100, 1287953, 679679, 5322538, + 280784, 1367947, 892816, -6619082, 209917, -2177549, -3054259, 2261837, 3655017, -3082176, + -30065, -3762391, -710280, -3129421, -3319473, -329102, -2024003, 3140695, -934692, -526134, + -2130304, 925565, 893890, -227633, -176631, 1404991, -689342, -278099, -1636919, -73014, + -1233193, 192200, -1290638, -45634, -778463, 941672, -40802, 2386391, 107374, 1417876, + 2037962, 833761, -492848, -208306, 566936, 161061, + }, + { + 6598681, 38855496, -10582263, -84826, 37965900, -4428648, 912144, -8488466, -6535330, 7901129, + -7719667, 3835406, -1365800, -533113, -3544959, 3925600, -8135205, 3882651, 9768366, -4094715, + 552977, 8669928, 6955163, 5629092, -8074539, 1906966, 12050068, 12341589, -2518462, -6359236, + -4201015, 3904662, 517007, -59056, 4143570, 2043868, 111132, 5602785, 573378, -3011309, + 5570036, -4074313, 7031935, -2734284, 4935455, -5508833, 745177, 3839164, 1253057, -4900021, + 3432753, -8207146, -3575024, -3308199, 6190659, -1148367, -1770063, 3391414, -1735167, -5120138, + 1203665, -2993592, -2359548, 5335423, 4385699, 64425, 2302639, 4664872, 1025960, -1131187, + 1600949, -1081795, -1581622, -1222455, -2062121, -1139240, 684510, -971200, -726923, 5310190, + -1013075, -1563905, 817118, -1881733, 1735167, 481036, -1116155, 857920, -1306207, -1283122, + 1417876, 1078574, 1660005, -628139, -351650, -2865817, + }, + { + -1131187, 102627704, -17991082, -38919384, 16342887, 3126736, 147640, -4822712, -1687385, -979789, + 4749697, -8221105, 2005213, -7973070, -1265942, 10797548, -238371, 194884, -13355738, -2420751, + 1898376, 8460549, -6864969, -4329327, 15125264, -3354906, 527744, 1503239, 3292093, -10436234, + -5878200, -3056406, 5441724, -8218420, -1308891, 2778844, 3490198, 5800354, 1948305, -6037651, + 1694365, 1911797, 8171712, -4709969, -7979513, 5000416, 2646774, 792958, -3933116, 3283503, + 6708739, -4370129, -2052994, 2847563, -4540854, -924492, -4049617, 3951907, 3353833, 3046206, + -3453154, 639950, -594853, 5998459, -1491964, 1066763, 834297, -3022583, -2192044, -1909113, + -967441, -2369211, 2137820, 1068910, -3385508, 389768, -649077, 858993, -594316, 834834, + 2378338, 851477, -548145, -2713883, 1216550, 1952600, -378494, -632971, 310848, 411243, + 737124, -157840, -449361, 222265, -312996, 155156, + }, + { + 361851, 45829448, 13651554, -10020159, -2656974, 2175401, 629750, -1228361, -2440078, 5312875, + 9734543, -11996381, 1504849, -12286291, -14108431, -2617246, -8821326, -10051297, -10104984, 4090956, + -10602664, 295816, 4038343, 6499896, 6080063, 8581882, -4094178, 1228361, 5411122, -9692667, + 4647155, 5844377, 4290136, -973884, 78383, -14175540, -9271761, 724239, 1787243, 2252174, + -2795487, 425202, -12300786, 2496987, -8723079, 1002338, 3156801, -8530342, 7882876, 1080184, + -13589277, -2922188, 3172907, 5008469, -7560753, 747324, 6813966, -2340757, 4235375, -883690, + -3127273, -3802120, 1800665, 1524713, 2360622, -1517197, 1814087, 1641751, -3264712, 1557999, + -264141, -479426, -84826, 425739, -2735357, 2856153, 299574, -5252745, -1296543, -2546916, + -1732482, -1552094, 315143, -253940, -1496796, 1287953, 537, 1656784, -842350, -698469, + -610422, -2684, -3034395, -2571075, 1244467, -1053341, + }, + { + -2675228, -154456144, -7058779, 39858372, 658204, 1263794, -5263483, 1557463, 4247186, -7979513, + 7237020, -3804267, -5636608, -323733, 3777424, 2101850, -1178969, -4552129, 3100967, -6403260, + -2042794, -11920682, 13139379, 2140504, -250719, -2095944, 1822677, 6083285, 7767985, 8473970, + 682900, 6633577, -4507032, 7401303, 108448, 2512556, 1105417, -1598265, 4385162, 675921, + -1657321, 4862977, -5569499, 325344, 156766, 1960653, -476741, -2003065, -4373888, 233002, + -2038499, -6496675, 4381404, -540629, 1107565, 2474975, -1688996, 2404645, 3002719, 2214593, + -998043, -1692217, -6576132, -974421, 2979634, 4468377, -4163434, 254477, 830539, -380641, + 2329483, 584652, 1640678, -2688650, 2698850, -91268, -4832, -3482145, -1843078, 711354, + -122407, 2286533, -578747, -3907347, 989990, -2204929, -299574, 1519882, -731755, 645856, + -621160, 4329864, 27380, -330712, 296890, -1241782, + }, + { + -94489, -36177584, -34224984, 4571456, -3150359, 899796, -2302103, 643708, 2096481, 3348464, + 362925, 3726958, 10874320, 6520297, 5504538, 13296145, -19940996, 2552284, -13632226, 7420630, + 2419677, 3297998, 5339181, 11999602, 3083250, 13047037, -6571300, -45634, 10168872, 6849936, + 7243463, 5944235, 3430605, -3114388, 3988414, -1532767, 3241627, -6855842, 2760590, -7293392, + 310311, 181999, 3779571, 2033667, 1873143, -5189931, 2313914, -3155190, 3036005, 3826816, + 2954938, 193274, 8267275, -2488397, 24159, -1664837, -1934883, -994822, 3218541, -2181307, + 2520609, -2025614, -769336, 449898, 2447058, 1303523, 384400, -1418413, 767725, 2864206, + -1826435, -398895, -4245039, 1104344, -761283, -397821, 897111, -587874, 2078227, 1846836, + -3319473, -409633, 2754148, -1296543, -233539, -872415, 381178, -151934, -1107565, -170188, + -155156, -614180, -1748052, -697932, 1552631, -752693, + }, + { + -7284802, -146537312, -4139812, 58178016, 308164, -8280697, -2028298, -3429532, 2379949, -1216013, + -10969883, 7464653, 1781875, 10224170, -10695542, -287226, 5668283, 162135, -15093052, 8626979, + 11384348, -4272419, -9119826, 19160922, 7575786, 3184718, 1701881, 4395899, 7580618, -4050691, + 81604, -5968931, 6078990, 757525, -994822, -1946157, 2021856, -1253057, -4184909, 300648, + -2940442, 6578816, -752156, 3163780, -2255395, -981400, -552977, -1110249, 1599875, 3732327, + -1246614, -6870337, 7025493, 879931, 2478733, -6768332, -2704756, -4041564, -3141769, -4268124, + -1262184, 529892, -1024350, 2208150, -1829656, -3753265, 2532420, -796180, -3189013, 3097745, + -893353, 3293703, -463856, -2260764, -1413044, 2423972, 1753957, 2369211, -1672353, -1374926, + -2006824, -83215, -2533494, 3031710, 1047972, 1163936, 202937, 1182727, -139586, -1775969, + 501974, 571231, 2165201, 515933, -1600949, 1149978, + }, + { + -1887638, -30037390, -66124244, 17649632, -3877819, 4572530, -2120640, 1207960, -1574642, 1365263, + 8817568, 6021008, -5559299, 4074313, 21811454, -11846057, -14584635, -6422587, 2661806, 9684078, + 7950522, 3410741, 3629784, -10385768, 5098663, -11750494, -4250944, 7514046, -919660, -5792301, + -7355669, 5324686, -3967476, -466004, -5365488, -8567386, -5466957, 3731790, -621697, 2678986, + 370441, -3782256, -1440425, -6427419, 2826625, -2626373, -965831, 2095944, 2950643, 2057289, + -725313, 4900558, -8929774, 2988760, 5926518, -17180, 76773, 296353, -3260417, -75162, + -3659849, 1034013, 731218, -833761, 1755568, 136902, 3190087, -1377074, -3106872, -2740726, + -281320, 458488, 2686502, 380641, 3227668, 1944010, -1255204, -2161979, 563178, -167504, + 2996814, -1421097, 563714, -635655, 1177895, 1118302, -2726767, 850404, 1377074, 84289, + 1368484, -989453, 762894, 52076, -2494839, -641561, + }, + { + -6706055, -143407344, 1773285, 58175868, -8348343, -8339216, -9223979, -569620, -4771172, -1418413, + -19058918, 3407520, 7243463, -1410360, -8462696, -6187438, -6215355, 1956358, -3156264, 2563022, + -7708930, 4908611, 5429376, -4969277, 372588, 2404645, -1335198, 161598, 3361349, -6402723, + 4292283, 9152575, -577673, 3241090, -893353, 4472135, -3449396, 7177427, -123480, 623844, + -1139777, 3351148, -13422, -2187749, -855235, -10056129, -1745367, 6801618, -177167, 5111548, + 215822, -2461553, 1013075, 4889821, -1980517, 2025614, -1595580, -1778117, -3389803, 1623498, + 1085553, -7087770, -2949032, 1620813, 1420560, 76236, -2012192, -3283503, -3464965, -3118683, + -360777, 4554813, 111132, -1196148, -1051730, -897648, 2204392, -35433, 371515, -1819992, + 2182380, 2644089, 3485366, -380105, 948114, 355945, 146029, 380105, -279710, -654446, + -1275605, 175020, 1009854, 479426, -1178969, 1554241, + }, + { + 543313, 77125264, 601295, -15147813, -11914239, 1551557, 15881178, 6123550, -7757248, -6866042, + -354335, 5092221, 13231184, -11928198, 2671470, 3147674, 3048890, -1153199, -230318, -11567421, + 6233608, 1620276, 9129490, -7854959, -1816771, -12591770, -1845762, 11397233, -720481, -3115462, + -2237141, -2597382, 5530844, -12351252, -4892505, -4400731, 1047972, 561030, 6874632, -12071542, + -636192, 7067369, -4963372, 4481799, -11230803, -1082869, -1046898, 1025960, 5177583, 2162516, + -4536023, -5673652, 248034, 6498823, 4473209, 5997922, -1054415, 3346853, 3873524, 6275484, + 2316598, 587337, 1054951, 603980, -337692, 3091303, -945967, 2579128, 1200980, -99321, + -22549, -1676111, -25770, 5101885, -2628520, -557272, -688805, 2167348, 4004520, 1642288, + 2851322, -1809792, -2108829, 932545, -2034741, -1229971, 193810, 1373853, -2138894, 565325, + -556735, 1632625, 1196148, -1351841, 1354525, -258772, + }, + { + 5128728, -93384936, -45937896, -1149441, -37044, 12323335, -23810762, -5628018, 14359149, -2238752, + 11249056, 1169305, 10098005, 8727374, 30967788, 3031710, -3962644, 8759049, 8524973, 11097122, + -318901, 508954, -2136746, -4925254, 3622268, -4144107, -3519726, 6431714, -6361921, -4705137, + -7994545, 7271917, -5991480, 501974, -4600447, -4828080, 9235253, -3954054, -288300, -1487132, + -4669703, 8675834, 760209, -1567126, -1460289, -4163434, 2144799, -12934294, -2189360, -957241, + 1360968, -1437203, -7565585, 2474975, -33823, 2509335, -1509144, 1861332, 180389, -1344325, + 6112812, -668941, 769873, 109522, -3546569, -1183800, 6647536, 3517041, -2417530, -181999, + 1491964, -3179887, -2615098, -4753455, -2037962, 1211718, -1246614, 2362232, -1282585, 1746978, + -2983392, -3262565, -727460, 280784, 252866, -380641, -743566, 1405528, 431644, -1231045, + 882616, -1604707, 151398, -1082869, -2223719, -662499, + }, + { + 625455, 48310328, 9256191, -1928977, 1337346, -366683, -2673617, -2811593, -6248104, -4338454, + -8423505, 10036802, -918049, 6790880, 8885214, 18519898, 4054986, -8644695, -594316, 1724429, + 11790222, -10586558, 12234214, -9982041, -9119826, 11607686, 968515, -6853157, -1896228, -5934034, + -1799591, 4685273, 10813654, 6478422, -7649337, -3042448, 4359929, 71941, 4691178, -161598, + 4558034, -6802155, -2277943, 2990371, -3220689, -2022930, 2463701, -639413, 3599720, -4482872, + -3412889, -5885179, -3378529, -2369211, 3679713, -1551557, 2025614, 1213328, 5983427, 2325725, + 105764, 858457, -1155346, -1196148, 3432216, -3812857, -3081102, -317828, -2177549, 2186675, + -1744831, -166430, -2217814, -1573032, 3984656, 238371, -3316252, 505732, 1068910, -765041, + 1811939, -2006287, -2485176, -248571, 2008971, 1562831, 945967, -84826, 1387811, 474057, + -760209, 2170569, -1474784, -460635, 1689533, 1296006, + }, + { + -16055125, -47720844, 3505230, -12955232, 4374961, 5682779, -31148176, -16742856, -1244467, 1901060, + 2971581, -5978595, 118112, 23918672, 12112345, -12479027, 13921600, -10321343, 5930276, 7831873, + -9986873, 2959769, 3678640, -8603356, -1138166, -2445447, -5885716, 2295123, 2639258, -15904801, + -3160559, 644782, -4813585, 4731980, -11856794, 1968169, -1458678, -6800007, 3504693, 833761, + 4599910, 1229434, 5967320, 3412889, -8986682, -2317672, 3929895, 7124814, -3071439, -1066763, + 8016020, -4329864, 3422552, -1370095, -5934571, 293132, -6153615, -692027, 5964636, 465467, + -118648, -143345, 547071, 6040335, -918586, -1915555, -2654290, -2753611, -7895761, 3118146, + -583042, 4703526, 865436, -346819, 5384815, -329102, 1955284, -6084358, -5193153, 778463, + -1569274, 785979, -1028108, -185220, -1872606, 550830, -323733, 2230699, 2153926, 987306, + -2501819, -896574, -3578245, -44560, -1298691, 814433, + }, + { + 1790465, 54135380, -24278376, 2097555, 4439386, 1159641, 5361193, 5349919, 3184182, -576063, + 5731634, -4252018, -4016331, 1878511, 9817758, -10464151, 12131672, 20866024, 8737574, 1200443, + -14742475, -6586333, 7019051, 3886409, 1879048, -9703405, -3529926, 7322919, 7425462, 12523588, + -9199283, -3165928, 2042257, 3442416, -3217468, -8986682, 6036040, 3204046, 917512, -1253057, + -6197638, 444529, 3234110, -9257802, 235149, -1672890, -1640678, -638876, 521839, 416075, + -6627135, 2608656, 1139240, 1905355, 2482491, 7021198, -5504538, 2663417, -2258616, -2446521, + -5114769, -6791954, -3102577, 2029372, -700617, -1851668, -2200097, 231391, -670552, 2830384, + 2439005, -4566087, -697395, 1711008, -1578401, 569620, 1166621, 2037962, 1307818, 1910724, + 1040456, -1339493, 1380832, 1107565, -358093, 4998268, -1118302, -2023467, 1513439, -2030446, + 537945, 1358820, -3381213, 418222, -2208687, -93952, + }, + { + -12835510, -73173360, 31595390, -12801150, -17647484, 3082176, -11307575, -7854422, 4041027, 5192616, + -10983305, 1617055, -14831059, 18084496, 25387014, -2880849, 5995775, 14552423, -7656853, 8231305, + -1437203, -1604707, -1881196, 12800613, 7148973, 3057480, -4752918, 5818070, 2396055, 4053376, + -14559939, -6831146, 4840965, 4958540, 9179419, -13558138, 5390721, -689879, -3376381, -7240241, + -3234647, 3272228, 2545842, 318364, 7863012, -1054415, 7120519, 2469606, -881542, 6884296, + -1977296, -5347771, 1012002, -1912334, 1934346, 1365263, -1488743, -3130494, -3708168, 5819681, + -164819, 2258079, 1013612, -5020280, 4475356, -1373316, -2010045, -4944044, 447750, 2231773, + 3221, 2180770, -911607, -168577, -4113505, 1851131, -765578, -730144, 2864206, 2034204, + -2283312, 1116155, -3223910, -188442, 999117, -234613, 1263794, 885300, -801011, -2587718, + 1246614, 1933809, 4360466, 301721, 875636, -1383516, + }, + }, + { + { + -662499, -64932388, 7669738, -290447, -3830037, 3348464, -2785286, 4898410, 6309307, -1954210, + 5632850, -2968359, -5960341, 376347, -9329743, 13889387, 20087562, 1047435, 2226404, -2035278, + 12962211, -14861124, -2117956, 8574902, 5250061, -23401666, 423054, 2587181, 8535711, 7906498, + -55835, 1084479, -6320045, -5865315, 3019362, 575526, 2036888, 8313983, -3562139, -117038, + 3400004, -4591320, 9065065, -7846905, 2573759, 2435247, -3803731, 3346853, 3331284, 2353642, + -1716913, -934692, -389768, -4317516, 2981244, -781147, -5130339, -1245541, 1882806, -545998, + 3819837, -2314987, 2177012, 2091112, -351114, 3592740, -335007, 2014877, -2019708, 498753, + -912681, 3758, 322659, -634581, 149787, 2302103, -418759, -651761, -1323924, 748935, + -1366873, 2236067, 616865, 651224, -803159, -1212791, -1860258, 1081795, -1930588, 410706, + 2818036, 716186, -133144, 884226, -367757, 184684, + }, + { + -6640557, 95624760, 43958452, -67384280, -27935542, -3250217, 1345935, -19187230, -9822053, 11256572, + 4199941, 8225399, -8769249, 324807, 1684164, 3704409, -6099391, -7397008, -9121974, -10370735, + -6607271, 504659, 1254667, 8549669, -10669773, -2051921, 8790724, 5003100, 1018444, 5028870, + -478352, -491237, 3158949, 5176510, 6694781, 5317170, 625992, 1897839, 579821, -1711545, + 959388, -7274064, 3504693, -7607998, 1307281, -2287070, 1787780, 1564979, 362925, -4677757, + 2623688, -7109782, -2684, -718870, 6264210, -2358474, -1427003, 3060164, 1069447, 1718524, + 4748087, -162135, -335544, 2342905, 213138, -3383897, -2246805, 1059783, -440234, -1573569, + 4251481, 1810866, 1559610, 219043, -1328756, -675384, 240518, -2390149, -2421825, 3313567, + 90194, -269509, 374736, -1041530, 1655173, -1212255, -2301029, 1652489, -883690, -380641, + 594853, -222801, 1174137, -1036161, -37581, -1126355, + }, + { + 908922, 80654656, -27680528, -44707924, 22502408, 6215355, 5657546, -1499481, -5122822, -3442416, + 2539400, -13540421, -6573985, -1889786, 3048353, 7215545, -2147, 6160057, -9139154, -8580271, + 1429687, 6131603, -9849971, -6545530, 13735305, -1809255, 4574140, 2089502, -3266860, -9167071, + 4320200, 7064685, 7739531, -10641318, -4213900, 3243774, -6105296, 3878356, 8114804, -5254356, + 3323231, 5328981, 10524817, -2076080, -9798968, -731755, -2447595, -3113851, -2233383, 3152506, + -2855080, -8694088, -2479270, 856846, -4198868, 2843805, -1298691, 3518115, 894964, 4923643, + 27917, 2005750, -2109366, 3325379, -1708860, -1679332, 137976, -1993939, -2603287, -288837, + -823560, -2808909, 2073396, -1206349, -2708514, 988916, -2638721, -339839, -3005403, -2174327, + 188442, -704375, -102005, -1428614, -817118, -646393, -1111860, -1375463, -144955, -956167, + 914828, 686121, -550830, 218506, -278099, 202400, + }, + { + -286689, -3245385, -21391084, 1152125, 4184372, 852014, -1516660, 1686312, -2183991, -3704946, + 479426, -17824652, 1846836, -11637214, -7487202, 114354, -16777216, -12797929, -14092861, -7500624, + -15687368, -860604, -569083, 378494, 7900056, -14496, -11927661, 6531035, 12551505, -3892851, + 4577362, 1763084, 3606699, 5465883, 2053531, -1912871, -3224447, -5320391, 733366, -1407676, + -5309117, 4134443, -12079059, 1351304, -5622112, -251792, -135828, -9101573, 9460739, 4507568, + -6687801, 3048353, 821413, 5954436, -3912715, -915902, 3614752, -4032438, 4758287, 63351, + -792958, -743029, 1176821, -838592, 2642479, -3047279, -1314260, 2649995, 375810, 2434710, + -908386, -935229, -1609539, 647466, -4196720, 461709, 1503775, -1745367, 714038, -2778844, + -2365453, -2119566, -256624, 522912, -195958, 517007, -1437740, 963146, -364535, -647466, + -255014, 875100, 182536, -154619, 3091303, 642635, + }, + { + 3016678, -94094680, 30355756, 31911608, -4177930, -20401, 1693828, 564251, -659814, -5508833, + 12683575, 12123619, 4476967, 5555540, 710817, 4149475, 15136002, -2412698, -6769406, -1689533, + 7494181, -1678795, 13495324, -9164386, -5170067, 1002875, 3784940, 2766496, 6347962, 9150428, + 7697119, 9001178, -1690607, 13979582, 2131915, -2341831, -4345970, -9140764, 902480, -3908420, + -10445360, -3663070, -6359236, 450972, -2655364, -298500, -2396055, 2799245, 2678986, -2272575, + -3339874, -2935610, 4546760, -1457605, 2947421, 2895882, -1249836, -1088237, -2375654, 1129576, + 774705, -2687576, -1945620, 2640331, 1973538, 4302484, -1306207, 1401233, -339302, -2753074, + 335544, -1292785, -1516660, -3391414, 1542430, -2130841, 761283, -1165547, -1126892, 605054, + 790811, 672162, -1618129, -1830730, 1954747, -1389959, -200790, 1348620, -1674500, -540092, + -471910, 3493956, -288837, -372052, 120796, -798864, + }, + { + 2073396, 774705, 2895882, 8302172, -6855842, 824634, -952409, -2056753, -6541235, -1027571, + -4813048, -2471754, 11614128, 1016834, 1036161, 16001438, -19347754, -8409546, -18457622, 124017, + -6037114, -1119913, 3572876, 529892, -9993852, 8157754, 1741609, -1109712, -7198902, 256624, + 1188095, -1683627, 3739306, -3611531, 3943854, -1704565, 2732673, -7350837, 3710852, -6492917, + -325344, -4000225, 3843459, 2139431, 2509335, -18790, 3452617, -4466766, 2497524, 5767068, + 5005248, -1672353, 6129992, -5499706, -586800, -1289027, -2239289, -908386, 2660732, -5968931, + 3035468, 2588255, 1896765, 1525787, 1648194, 323196, 158914, -3038689, -1435056, 967441, + -1457605, 1944010, -1417339, 3788161, 741956, 479963, 922344, -1406602, 527744, -83215, + -2011118, 698469, 768799, -1994476, 621697, -2113124, -1634772, 69256, 342524, 868657, + -1644973, -1799591, -144955, 149787, -45634, -1057099, + }, + { + 8689793, -95684896, 12219719, 50826108, -216359, -3959960, -494995, -11251741, -12214350, 915902, + -1808181, 9381819, -11586748, 1261110, -8222178, -542240, -5900212, 4714801, -14939507, -2543158, + 7460895, -2074469, -5346161, 11442330, -2584497, -2303713, 608275, 3959423, 4810364, -2958159, + 8109972, 4360466, 8376797, 4217121, -4427038, -2560338, 4650376, -698469, -2774549, 4067334, + -477815, 9228811, -5030481, -2564632, -3776350, -875636, 752693, -2881386, -2498597, 2172180, + 1207423, -5100811, 2222109, -4524748, -2865817, -5486284, 3092913, 368293, 601295, -960462, + 1791001, 3073049, -711891, -813896, -1001801, -1071058, 3732327, -584116, -4312684, 3952981, + -869194, 876173, 956704, -41876, -906238, 2322504, 2311766, 1468342, -1493038, -509491, + -2302639, -1331440, -1582696, 2635499, -2181844, 1335735, 132607, -641024, 204548, -551366, + -179315, -1162326, 2100239, 724239, -1749125, 1372242, + }, + { + 3265786, 42392400, -8279623, 14108968, -8647917, 355409, -4908074, 1193464, 159451, -527744, + 1508070, -1614371, -4278861, 9407589, 14974940, -14009110, -6873022, -3308736, -9102646, -10564546, + 2062658, 1555315, 1433982, -1979980, 7307350, -13751412, 4824859, 7066295, -12757127, -8887361, + -12624519, 3143379, 3335042, 5545340, -1846299, -1975148, 872415, 7164006, 3840238, 389231, + -2623151, -1509681, 2289755, -2404108, 5284958, -354872, 1494649, 4991826, 580894, 3702799, + 1447404, 4311611, -8805220, 4705137, 2395518, -2625836, 510027, 447213, -2333241, 4778688, + -3787624, -2197413, -10737, -330176, 2178622, -2467459, 1437203, 269509, -1571958, -614180, + 1064615, -644782, 1483374, -2148558, -451508, 894427, -242129, -500901, 2153926, -363998, + 1448478, -3572876, -784368, -458488, -364535, 390842, -1021129, 630286, 1059246, 604517, + 1700270, -485868, 550293, -1198296, -3045132, -1598802, + }, + { + 7540352, -106754096, 8996346, 50601156, -4881767, 2924336, -3114388, 5590437, 1291711, 4616553, + -5315559, 11721503, -1192927, -848793, 7248831, 8561480, 173946, 3652870, 926639, 4522064, + -2558727, 230854, -692564, -2451353, -4239670, 3635153, 930934, -6009733, -3781182, -15315317, + 53150, 4915590, -4389994, 2024003, -650151, 5349919, 1362042, 8836358, 2045478, 6285685, + 1095217, 3850438, -889058, 2878702, 5777268, -4187056, -770410, 4191888, -1494649, 5549098, + 3728032, -869194, 2837363, 3454228, -3132105, 250182, -612033, 330176, 312996, 568009, + -925565, -2758443, -877247, -41339, -4212289, -3419331, 2521146, 276489, -1254131, -500364, + 2173790, 3741454, -733366, -3453154, -1257889, -1464584, 479426, 157303, 584652, -2767033, + 554588, 2725157, 3091303, -2447595, -870268, -70330, 948114, 1606855, 918586, 473520, + -825707, 435402, 1796370, 1506997, -1081795, 1381369, + }, + { + -639413, 40507984, -27567248, -5382668, 3020973, 3855270, 10270877, 13571560, -2013266, -7366406, + -7025493, -1464584, 4720169, -13087839, 7539278, 3480534, 2849711, -1482301, 14439680, 13213467, + 2193118, -1934883, 2566780, -10027675, 1458678, -8194261, 478889, 7201587, -3462818, 4494684, + 1268626, 321586, 13657996, -1788854, 5287105, -5961952, 1381369, 5193689, 11708081, -11974369, + -1897839, 1773822, -10162966, -3047279, -6003291, 5577552, 3557307, -470299, 1900523, 2058363, + -5714991, -1338419, 4628364, 3127810, -6639483, -4073240, -7001871, -3019362, -642098, 90731, + -5906117, -894427, 1427540, -2662880, -4438849, -183610, 686121, 4336307, 3724274, 3790846, + 280784, -925029, -1781338, 1373853, -1664300, 1237488, -1155346, 650151, 2432562, 378494, + 1443646, -2225867, -3781182, 12885, -144955, 1256278, 1580011, 609885, -1737851, 1056025, + -982474, 86436, -849330, -1311039, 2741800, -373125, + }, + { + -8597451, -40403296, 20844550, 2339147, -9700184, 9745818, -24729884, -34907884, 5884105, 15444166, + 14906758, -14848239, -17661980, -16527034, 23432804, 4125316, -2840047, 1855963, -1917166, 4634807, + 1439351, 3825742, -4713727, -4532264, 6243272, -288300, 1139777, 11036455, 5695664, 8812199, + -6324876, -750546, -10544145, 5378910, 2182380, -7941932, 5059472, -3140695, -2295660, 1629403, + -3245922, 7529615, -3748433, -2819109, 4064650, 2794950, 10947335, -7517804, 1040456, 6531035, + 4683125, 783295, -3391951, 4203699, -1364726, 1533840, -1986422, 7053947, -1574106, -5809480, + 3278134, 319975, 2812667, 2333778, -2381023, -2444910, 3324305, 2882460, -1096290, 121870, + -193274, -2780455, 1937567, 2083059, 711891, 398358, -2401961, 2011118, -1272384, 1612223, + -1916092, -2756832, -2102923, -802085, 648003, -457951, -847182, 721018, -564251, -1814087, + 1899449, -930934, 845035, 281320, 1258425, 577136, + }, + { + -168577, 6542309, -17686138, -3067144, 2669859, 2406792, -8303246, -289910, -920734, -1369021, + -15096810, 5770826, -9986336, -9225590, 1140314, 2236067, -3801046, -628139, 16115791, 5768141, + 3086471, -22701050, 4592394, -10666551, -9245454, 513785, -6685654, -16783658, -9506910, 7206419, + 4134980, 1377074, 6178848, 8217883, 2825552, 3467649, -4177930, -8574365, 3265786, -4019553, + 7209640, 636729, 3208878, 3985193, 845035, -589484, -767189, 2992519, 7982197, -1963874, + 5147519, -2641942, -438087, -2667175, 4220879, -2037425, -835371, -340913, 1438277, 1102733, + 624918, -1580011, -2228014, -776852, 2417530, -89121, -1036698, -1389959, -3674882, 1039919, + 180389, 1711545, 1338419, 49929, 1612760, 1619740, -865973, -267362, 747324, -880468, + 64425, -3772592, -2964601, -1838246, -235686, -656056, 1153199, 970126, 2782602, -284005, + -2280628, 2188823, -615791, -876710, 941135, 278636, + }, + { + 15192910, -59070832, -29281476, -840203, 3952444, 10617696, -16786342, -6783364, 1607928, 5341329, + 6103149, -5601174, -2676838, 10809896, -1674500, -21937620, 21437792, 2447595, 17395154, 12678743, + -11702175, 2361695, 486405, -1523640, 9337259, 816581, 356482, 3365644, 5931350, -7576859, + 5051956, 10484015, -5172215, -1830730, -12069395, 5328444, -2872796, -7460358, 3626026, -4972499, + 4716411, 2142115, 763967, -2492155, -8227547, -3005940, -1817845, -2059974, -10119480, -2284923, + 9308268, -31675, 7172596, -1063541, -2536715, 1329829, -5385889, 138513, -620623, -5623186, + 202400, -1345935, -4912369, 1625645, -3333968, -3212099, -534187, 1320166, -5463199, 1239635, + -2915746, 2382633, 1282585, -492848, -377957, -5160940, 2677912, -3238942, -2377265, 1597728, + -1523640, -983011, -1446330, 1669132, 1398549, 545461, -1477469, 483721, -715649, 237297, + -2286533, -1400696, -2065342, 2529736, 1265942, 1783485, + }, + { + -2010582, 56491704, -16152298, -2345052, 610422, 2732136, 2308008, 115427, 7061463, 1245541, + 5641977, -3120294, 9562208, -4754529, -24046448, -18360986, -2764348, 2026151, 1846836, 13350906, + 3794604, -2226404, 4789426, 10214506, 1214939, -16401943, -4060892, -3172907, 11661910, 18160732, + -11836930, -8546448, -1536525, -559420, -3557844, -5512591, -409633, -797790, 4587562, 5383742, + -7901666, -2444910, 1956895, -8943196, -833761, -4939213, 122943, 4210679, 2034204, -2965675, + -7797513, 6308770, 1430224, 3352222, 1400696, 6366752, -6222334, 3159485, -2348273, -626528, + 4828080, 2229625, -1460826, 4748087, 1457605, -586263, -1465121, 1025423, -501437, -326418, + 1117228, -3574487, -2228551, -82141, 441845, 3514357, 1414655, 484794, -1459752, 300648, + 2761127, 155693, 1538135, -755377, -2900714, 2127083, -814970, 419833, 2999498, -1970853, + 803696, 2177549, -1396938, 646929, 4295, 54761, + }, + { + 12208445, -65768836, 1174137, -18540300, -14968498, 4679904, -8137890, -7351374, 8696235, 9911174, + 3506841, 5859409, -14815490, 12607340, 8208756, -5063767, 7303592, 10403485, -18598282, -1811939, + -1394254, -2442763, -11330124, 14741402, 6891812, 1551557, -8646843, 3245922, 2041720, 11556146, + -9178882, -14909979, -7157026, -3761318, 11649562, -8665633, 2913062, -1293859, 7900056, 3256659, + -2168959, 7372848, 2594697, -1396401, 6007586, -4844723, -1484985, 2705293, 4361003, 11672647, + 1721208, -5006858, -286152, -3249143, 2550137, 2184528, 326954, 2944737, 143881, 6580427, + -1665911, -681826, 41339, -4786741, 4081830, -2648384, -3003793, -5325223, -524523, -876710, + -2476586, 372588, 1378685, 3742527, -1757715, 1141388, -3280818, 1462436, 5904507, 2151242, + -4500589, 1839320, 189515, -933082, -1341104, -1214939, 1140314, 2266132, -519691, -3959423, + 639413, 1634235, 3054796, -1356673, -249108, 18254, + }, + }, + { + { + -725850, -48672180, -10793253, 26825828, -13721884, -1583232, -677531, 6623914, 5341866, 5925981, + -2944200, -2213519, -6088653, -10966662, -2985002, 16268262, 4800163, 4699768, -2437931, 8260833, + 11633456, -10618233, -9186935, 4762582, -2639794, -9334038, -3203509, 5481452, 3723737, 8752606, + 7130720, -6005975, 1762547, -11996917, -917512, 2500208, 11123428, 2393908, -1222455, -751619, + -377957, -3962107, 3896072, 2301029, -197569, -3842385, 1840394, 1524713, -540629, 454193, + 375810, 3157875, -3513283, 707059, -3211025, -1027034, -947040, -2593087, 583042, 1919314, + 144955, 2588255, 1866163, -542777, 4352413, 2139431, 243203, 1547799, -1490891, 606127, + 619012, -1493575, 452045, 1024350, -2436320, 1776506, 312459, 230854, -596464, -818191, + 1304596, 1162326, 208306, 1627793, -1481227, -245350, -2188823, -798327, -112743, 69793, + 1497870, 336618, 145492, 1924682, -2147, 144955, + }, + { + 5100274, 149795040, -29055990, -63755568, -29988536, -2662343, -10143639, -12006581, 4735202, -779537, + 10866267, 6054830, -7879655, -2295660, 5372467, 255551, 5743445, -15037754, -14165876, 618475, + -7965017, 1544578, 202937, -3100967, -2526515, 333934, 3351148, -615254, 1379758, 12126303, + -3883187, 456340, 9999758, 2692945, 6507413, 5888937, -1156420, -3780108, 3645354, 5141613, + -3764002, -3850438, -13422, -5261335, -831076, -1282048, 2334852, 3155190, -2570001, -2649458, + -2503966, -1287953, -153545, 1460289, 611496, -2813741, 3837017, -1289564, -1014686, 6967511, + 3180423, -489089, 2309082, -2712809, 1338956, -1789391, -1865626, -1347009, -200253, -1495186, + 4573604, 1886028, 1316944, -709207, -974958, 1544578, -1122597, -2346126, 317828, -1277216, + 301721, 914291, -862752, 940598, -417149, -933082, -265214, 735513, -8053, -852014, + -530965, 426812, -886911, 317828, -226023, -71941, + }, + { + -2479807, -3910568, 39440148, -24020142, 5921686, 6106370, 8356396, -4100620, -7729331, 9629317, + -11310796, -2756295, -4404489, -1842004, 7915088, -1399086, 7400229, -5815923, -233002, -1549410, + -2085207, -5150203, -6659884, 4487167, 3277597, 2563022, 3126736, 2254321, -2297271, -1773822, + 3769908, 3102577, 538482, -3579318, -2123325, 4775467, -7438347, -508417, 3630858, 5240934, + -1701881, 3633542, 9066676, 784905, -6405944, -3636764, -5368172, 924492, -1045288, 4706211, + -8240432, -4483409, -2254858, -2760590, 1611, 1130113, 580357, -428423, -831076, 5267778, + 1974611, 2340757, -1652489, -1528472, 983548, -3102040, 238908, 605590, -1825361, -88047, + -1716913, -15569, -729608, -2265595, -1075352, -1272384, -2721936, -612033, -2168422, -1382980, + 127238, -357556, -758599, -396211, 144955, -1610076, -1403381, -2218888, 238371, 56371, + 23622, -462783, -222801, 1406602, 289373, -944356, + }, + { + -1188632, -35694400, 3466039, 7341173, -1184337, -242666, -588411, 1957431, 2021319, -10638634, + 1178969, -12371116, -7348689, -5335960, 1386738, -13968307, -7824894, -9147207, -14609331, -7614440, + -13157095, -6266358, 5170067, 2001455, 530428, -6123550, -769336, 7159174, 3910031, 2072322, + 1786706, 2792266, 1537598, 8995272, 292595, 2190970, 3781719, -7743826, -2651069, -6949794, + -3151432, 4958003, -6959458, -2036888, 1216013, -3244848, -4015258, -1298691, 1078037, 4286914, + -366146, 874563, -2534031, 4778688, 2245731, -719407, -1550483, -24159, 1198296, 2436857, + 800475, -336618, -440234, 212064, 1197222, -2119030, -1278827, 2724620, 2183991, -457951, + 520765, -1236951, -914291, 493384, -3974992, -1613834, 1358820, -380641, 411243, -6979, + -4328790, -1895691, 580894, -432181, 148713, 993748, -877247, -906238, 315143, -191663, + 1056562, -651224, 1044214, 1826435, 1672353, 450972, + }, + { + -5354214, -58648852, 6532646, 29533806, 2025077, 1027034, -1179505, 2003602, -6952479, 8893267, + 6140730, 10189273, 5861020, 5330592, 2727304, 6584185, 14669461, -4247723, 10062035, -6522445, + -1665374, 4252018, 4592394, -8844411, -1303523, 2014877, 7424388, -351650, 613107, 11594801, + 11239929, -3056943, 9444633, 9360881, 3499862, -2199560, -1073205, -7837779, -1095217, -5197448, + -10150618, -9916006, -4808753, -2424509, -113280, 1954210, -3722663, 4147328, 4648229, -2521146, + -3386045, -1400159, 3160022, -1145683, 5487358, -1939178, 1072668, -2403571, -4514548, 1234803, + -614180, -1431298, 2931852, 257161, 3560528, -1512902, 2404108, 2596845, -2118493, -1192927, + -373662, -1992865, -3197066, 37044, -1805497, -789200, 757525, 491237, 98784, -596464, + 1089848, 183610, -1320166, -269509, 1675574, -70330, -800475, -583579, -948651, -1339493, + 745714, 373662, -187905, 1850057, -1240709, -295279, + }, + { + -64961, 13326210, 8554501, 3414499, -3622268, -1842541, 645319, -1444720, -1527935, -4794794, + -5592585, -4515085, 6235219, -10259066, 19351512, 1090922, -2616172, -16336982, -6642167, -6743636, + -7070053, 4665945, 2265595, -5230734, -6806987, 1519345, 9441949, -4699231, -10122701, 2287607, + -5947993, 290984, -2762738, -3689377, 5197448, -2049236, 333934, -3293166, -2495913, 1166621, + -3099356, -2571612, 2593087, 2835215, 1730335, 5167383, -108985, -1072131, 365072, 4817343, + 4013647, 1774895, 3578245, -6045704, -196495, -1538135, 146029, -641024, 209917, -1870995, + 1446330, 1189169, 3040300, 391916, 1062468, 229244, 90194, -1807108, -828392, -3644817, + 2194728, 565325, 122943, 2769180, 2228551, 468688, -363462, 689879, 284005, -1971390, + 920734, -838056, -596464, 212064, -1029718, -1625108, -891743, -1262720, 1610613, -16106, + -1644436, -934155, 284542, -808528, -1243930, -301721, + }, + { + -12358768, -38145216, -12065637, 43195560, 1193464, -99858, 3294777, -12123619, -19227494, 2378875, + 2513630, 4767951, 2540473, -9259413, -12354473, 73014, -11315091, 8466454, -3008625, -12589623, + 4073240, 7532836, 2735894, -7240778, 24159, -344671, -1437203, 1081795, 885300, 1151588, + 4255239, 8296803, 3755412, 10211822, -5257040, 3222836, -2576444, 1473711, -883153, 6328098, + 4582193, 1998770, 1848447, -8438537, -2130304, -741419, -1290101, 1347546, -1810866, 2042794, + -2656974, -1796907, 1294933, -6358699, -1963337, -62814, 1977296, -506269, 2217277, -449361, + 2375117, 2478196, 1440962, -1826435, -2113661, -665720, 2150168, -370441, -399969, 2179696, + -704912, -3214783, 219043, 1916629, 2178622, -263067, 3639985, -2702071, 558883, 67646, + -598611, -1998234, -904091, 443455, -1145146, 750009, -749472, 286152, -1016834, 854162, + -1229434, -475668, 1348620, -449898, -312459, 1349694, + }, + { + 1238561, 30175366, 25905096, -3987877, 4176856, -4817343, -3788161, -826244, 3320010, 110595, + -2166274, 1556926, 3608310, -1883880, 4540854, -8336532, -3833795, -3889630, -13196287, -8842264, + 1562831, -1184874, 6519224, -4391067, 1252520, -5188858, 4042638, -142808, -4101694, -3058554, + -14588930, 2746095, 1549946, 6311992, -2285996, 150324, 6063957, -387621, 9984188, -977642, + -6681896, 3025268, 2814814, 2847027, -1229971, 7775502, 1165010, 1881196, 1966021, -195421, + 342524, 4815732, -5651640, 3707631, -589484, -3302830, 4036196, -1801739, 289373, 3421478, + -703301, -1408212, -629213, 1282585, -559420, -1481764, -2689187, 2961917, -967441, 1091995, + 505196, -269509, 1708323, -3054796, -767725, -24159, -13959, 822486, 1451162, -374736, + -1065152, -1286343, -887448, 800475, -2423972, -888521, 513249, -169114, 1096290, 562104, + 1214402, -170725, -355945, -1162862, -1199907, -2378338, + }, + { + -11447698, -61982820, -9947681, 39128764, 1698123, 6791954, -4288525, 3262028, 11485816, 2060511, + 15129022, -6891275, 1014149, -4796405, 17741974, -2677375, -5918465, 10018011, 4023311, 5776731, + 2807298, -4641786, -4187593, 274341, -1884954, 504659, -589484, -1451162, -12954158, -11664594, + -1246614, 3109556, -1453310, 3715147, 4031901, 2843268, -884226, 5739687, 5359583, -572841, + 4314832, 4454418, -2040110, 6080600, 5569499, -1721208, -217970, -618475, 1321239, 1197222, + 6309844, -644782, 2713346, -1730335, 3474629, -3450469, 2308008, 329102, 988379, -162672, + -3453691, -62814, -675384, 97174, -4987531, -3959423, 2829847, 2030446, -763430, -91805, + 3344169, -565862, -560493, -510564, -2255395, 752156, -508954, -868657, 583042, -591095, + -1292248, 1867774, 614717, -796180, -413391, -530428, 677531, 1848983, -141197, 265214, + -104153, -290447, 2135673, 2140504, -222801, -594316, + }, + { + -1632088, 3269544, -6765111, -927176, 13701483, 7824357, -9382356, 6000606, 10759430, -4799626, + -9515500, 1510755, -4336307, 5637682, -3206730, 4544076, 8188892, -6331856, 13506598, 27921046, + -14747307, 4921496, 2047089, -3402688, -5739687, -2713883, 1934883, 226023, 679142, -2099702, + 6088653, 6446209, 1385664, 3408594, 322659, -2607045, -645319, 2818572, 7445326, -3747896, + 301185, -5545340, 562104, -10596221, 492311, 3093450, 3614215, -4037269, -57445, -1182727, + -9664, 376883, 2843805, 628676, -1737851, -9047885, -5255966, -5665062, 135291, -2295123, + -9480067, 1834488, 1069984, -3859565, -4287451, -2428804, 2369211, 5868536, -396748, 5098663, + -402116, -166430, -1552631, -435402, 992674, 1649268, -2182380, 2406792, -664646, -1715839, + 389768, -1493575, -1900523, 843961, -238908, 1041530, 1847373, -476205, 1277216, -503585, + -1692217, 1105954, -1591285, -632971, 1221918, 416075, + }, + { + 10834055, -41480796, 2058900, 4400194, 3070365, -9868224, -106300, -27536646, -5497558, 14898168, + 5283347, -4325032, -22435836, -16905528, 7119982, 7923678, -5319317, 1964411, 2163590, -3255585, + 10553808, -815507, -2404108, -6944962, 377420, 5004711, 8217883, 6654515, -846109, 9241696, + 3238405, -9485972, -5095442, 5458904, -836982, -8519068, 2743410, -107911, -722628, 40802, + 4855461, -2209761, -45097, 550830, -181462, 3371549, 4625143, 1657857, 2697240, 6002754, + 1421097, 4206384, -2226941, 5281736, -4124242, 1977833, -3602404, 8106214, -850940, -4525822, + -558883, 5864778, -518080, 1840394, -2169495, 282931, -1944547, 2429341, 1447404, -955630, + -72478, -708133, 620623, 2294586, 1913408, -134218, -706522, -993211, 470836, 170188, + -154619, -3273839, -1642288, -1301375, 210990, -497142, 266288, -224412, -292595, -1928977, + 1198296, -920197, 2117419, 1063541, 1002875, 1220845, + }, + { + -1509681, -20153060, -925029, -5461051, 3854196, 2039573, -3556770, -1976222, 1312113, -3612604, + 1090385, -9284109, -17717, -29016262, 8636642, -5722507, -4862440, 260919, 18676666, 10168872, + -2020245, -12007655, -3491809, -6107981, -5957120, -9177271, -4266513, -5829881, -17689360, 8898098, + 17382806, -6800007, -1216013, 11698954, 2937758, 3628711, -3201898, -3190087, -2185065, -4063039, + 5122822, 1847373, 9550397, -3180423, 2680597, -5130876, 2200634, 9214315, 732829, -4314295, + 12349105, -5653788, 1680943, -1857037, 1001264, 2377801, -1846836, -218506, -926639, 4619238, + -1791538, -617402, -1027571, 1127429, -3369939, 897111, -1118839, 759672, -3639985, -69793, + 1104344, 1897302, 286689, -729071, 1091459, 3140695, 1397475, 950798, -2138357, -2115272, + 1403917, -3547643, -2172717, -2687039, 304943, -1133335, 1770063, -398895, 2714419, -329102, + -834297, -135828, 2102923, -376883, -1906966, 684510, + }, + { + -16718160, -28388124, -19813758, -9964324, 10300942, -7052337, 1819456, 5461588, -3864397, 38118, + -2488934, 4245575, 11853573, -4319664, -14510010, -12338904, 19716048, 4768488, 21288006, 6952479, + -5173288, -1361505, -2808372, 3682935, 9065065, -5632313, 716723, 3874597, 1760937, 4216048, + 5408438, 1861332, -8040716, -3058017, -4155381, 10984916, -10369662, -2935073, 2026151, -2184528, + 795106, -2035815, 1541356, -4848481, -164819, -4992900, -2046552, -4431333, -6883759, 452582, + 6703370, 1963874, 1199907, -132070, 1492501, -1239098, -3278134, -13422, -2838974, -7204271, + 1186485, -1268626, -3070365, -3227668, -5212480, 729071, 1508070, -274341, -1865090, -1347546, + -168041, -2703145, 2729452, -777926, -2782065, -2544768, 2185065, -3679176, 17717, -1392106, + -801548, -1485522, 984084, 779537, 1449552, -654983, -296353, 328028, -1637993, 282931, + -1072131, -1711008, 273804, 1578937, 1450088, 415538, + }, + { + 217433, 34089156, 4236449, -8269423, -239981, 2646774, 6475737, -76236, 5583458, 4318053, + 1474784, -1838783, 8329552, -10598369, -8379481, -5069135, -20876762, -5390721, 7157563, -3449396, + 18472118, 4523138, -321049, 8735963, 4193499, -14663555, -2334852, -6984691, 11183021, 4397510, + 3467112, -4950487, -2239289, -6298570, -802085, -5130876, 1351841, -1797444, -756451, 5411659, + -3201361, -2108829, -2784213, -3899294, -1391569, -5665062, -1417876, 6965900, -916439, -638876, + -2335389, 5360656, -2567317, 6496138, 2596308, 1962263, -5401995, 4653597, -2218888, 848793, + 901406, 3874061, 2506650, 4053376, -743029, -248034, -29528, 2505040, -1136556, -1287953, + 832687, -3089692, -2373506, -845572, 744640, 3797288, 2012729, 321586, -1181116, 649077, + 1686848, 1038308, 333397, -2518462, -764504, -1279900, 1434519, -64425, 2800319, -1234266, + 541703, 1171989, 1802813, -1018981, 220117, 634045, + }, + { + -13926431, -29716342, -10151692, -9612137, -5331128, -11691438, 114354, -4956929, 8257612, 2161979, + 9905268, -9738838, 6841883, 22570054, -17868674, -2300492, 6801618, 6997576, -10536629, -576063, + 1251983, 2158758, -8910983, 423591, 7636452, 2287070, -9026411, 2580739, -181999, 2688650, + -1394791, -3969087, -6109054, -7231651, 1064615, 2155537, 315143, -379568, 6226092, 2674691, + -3737695, 9513889, -1079647, 2480881, -2696703, -899259, 1310502, 762894, 3311957, 3675955, + 5207648, -3169686, -2647847, 107374, -1742146, 730681, 3554086, 5539434, 1376537, 2234457, + -384400, -3232500, -3176128, 2454574, 559956, -467615, -1414655, -5112085, -2656974, -1790465, + -2806761, 1819992, 849867, 1885491, -1061394, 722091, -2576981, 4687957, 3009162, -983548, + 669478, 542777, 1169842, -1270774, -3231963, 424665, 1351304, 357019, 1254667, -1819456, + -632434, 1728724, 1893544, -1557463, -1347546, 25770, + }, + }, + { + { + 131533, -7552700, 14386530, 34977140, -11138998, -2277943, 887448, -1216550, 649077, 2995740, + -4364224, -9797894, -9903121, -4195646, 1085016, 5925981, -12258374, -5026723, -10474351, -2743947, + 4755066, -8660802, -21897354, -6375342, 4516158, -351650, -170188, -1844152, -3439195, -201327, + 5083094, -4329327, 3817152, -7746511, -578747, 1819456, 7969849, -422517, -2397129, -3354906, + -1100049, -4184372, 3610994, 2085744, -749472, -6172405, -714575, 947577, 959925, 3790846, + 2326799, 5484673, -2057826, -387621, -4485020, 2130304, 1481227, -4640712, -872952, 564251, + -3209951, 862752, 2892124, 133144, 650688, -1934346, 231928, 2554432, 2144799, 1323924, + 1547262, -2696703, -3663607, 1956358, -1540283, 869731, 2222109, 2193655, -1107028, 187368, + 820339, -960462, 375273, 1963874, -260919, 1505923, -452045, -223338, 23622, 915365, + 1961190, 1229434, 1383516, 1700807, -286689, -587337, + }, + { + -4088809, 157826096, -9466645, -56996364, -17453136, 4512400, 8425652, 13111998, 6182069, -16705275, + 1282585, 19478214, 6270116, 2714956, -106300, -283468, 16580721, -6305549, -663036, 12566537, + -1831267, 2389076, -5959267, -9595494, -4050691, -2542084, 8139500, -189515, -8486319, 10274636, + -4834523, 825171, 9532143, -300111, -425202, -870268, 3626563, 7118372, 9954124, 5408975, + -4281009, -3787624, 2837363, -1832877, -592706, -2653216, 1296543, 4421132, 3824669, -1447404, + -1046361, 3507378, -1848447, -3595961, -2050310, -1387274, 1331977, -4565550, -4680978, 362388, + -345208, -2026688, 1832340, -1450625, 2535105, -10737, 104153, -2961380, -1509681, -1216013, + 3404835, 1069447, -572841, -2404645, -1444720, 2993055, -602906, -102005, 2282775, -2046552, + -1269700, -255014, -548682, 809064, -731218, -301185, 565325, 1282585, 803696, -1056025, + -705985, -76236, -1581622, 496606, 166430, 532576, + }, + { + 4485557, -65009700, -16127602, -1738925, 10189810, -2481954, 7635378, 740345, -2815351, 11502996, + 2937221, 6869264, -1880122, 4619774, 12875775, 6712497, 11751031, -9690520, 2078764, 11697343, + -26307, -2468533, 3440269, 9845139, 5765457, 2122251, -3097745, 3108483, 5717675, 523449, + -6979, -220654, -235149, -5422396, -1858110, 7071127, -2443300, -1995549, 981937, 5520644, + -1586454, -74625, 5204964, 2552284, -2886218, 5783711, 2991445, 1549946, -3204046, 3644817, + -574452, 3489124, 2171643, -507880, 2996277, 2585570, -1209033, -2159832, -3526705, 1052804, + 187905, 1411971, -2957622, -2146410, 2538863, -2130304, 1146756, 2458869, -1612223, -616865, + 85362, 1117765, -1000191, -310311, -326418, -2748779, -2448131, 850404, 1981054, 2805688, + 555661, -1085016, -301721, 316754, 2528125, 171799, -721555, -1450088, -556735, 327491, + -935766, -1864553, -487479, 1873143, 458488, -2039573, + }, + { + 1698123, -36913096, -2229088, 9039832, 3253438, -772557, -1170379, -657130, 1636919, -10640245, + -1473174, -7581691, -3842922, 1263257, 13833553, -2655901, 7264937, 3856344, 2218351, 660351, + -8711267, -7933879, 5492190, 2432562, -5966784, -5489505, -4090956, -2390686, 2101313, -2070711, + 2155000, 8024073, -18254, 6997039, 1315871, -999117, 6944962, -2829310, 360777, -2637110, + -1354525, 7531762, -1216550, 1367410, 6078453, 860604, 631360, -682900, -4647692, -1647657, + -1805497, -1665374, -4515621, 1991254, 1059246, -881542, -206695, 2035278, -585726, 3480534, + 971736, 1136556, 1552094, -748398, 2129230, -1526861, -3812857, -244276, -1485522, -1308354, + 3285650, 1308354, -51540, 650151, -2758980, -1021665, 656593, -1741609, -1353989, 1796907, + -2127083, -258772, -138513, -932008, 1095217, 767189, -1194001, -292058, 151934, -73551, + 1335198, -1799591, 312996, 436476, -289910, -311922, + }, + { + 9601936, -33931852, 6974490, 22638236, -4017942, -2915746, -1309965, 8007967, -7510824, 9353365, + 6954089, 7872138, 1658394, 2573222, 3410204, -6267431, 4583267, -173946, 22019760, -2244657, + -1846299, 3308199, 6503654, 1122597, 2105071, 765578, -749472, -929860, 4649302, 3204583, + 4393215, -3304977, 6875169, 2626373, -64425, -4257923, 1483374, 4839355, 1024350, -3089692, + -2541547, -5392332, -481573, 3832185, 6267431, 3479461, -4744328, 3230352, 2291365, 102005, + -415538, -3010772, 783832, -1352915, 3111167, -4334696, -2285996, -1895154, -1021665, 3750580, + -1921998, -698469, 1588601, -2544768, 3354906, -404264, 2398739, 1370632, -2270427, -498216, + -649077, -500364, 421981, 1960653, -948651, -1582159, 319438, 2048163, 369367, -153545, + 767725, -170188, -294742, 708133, 1180042, -72478, -984621, -1832877, 527207, -44560, + -110595, -1147830, -1356136, 1098975, -1554241, 296890, + }, + { + -1560147, 3236795, 2679523, 3621194, -1526861, -969589, 2906082, 310848, -197032, -4151086, + -4078072, -2735357, 2276333, -5339181, 37633040, 14531485, 17263622, -2035815, 1640141, -224949, + -731218, 9584756, -2229625, -5428839, -414464, 4660577, 13445932, 2793339, 2303176, 1143535, + -11197517, -6553583, -6827925, -3942243, -162672, -3479997, -875100, -4323422, -1440425, 4919348, + -3211562, -4844186, 2233383, 2319282, 965831, 5077188, 2447595, 3464965, -954020, 3724274, + 1472637, -9664, 4504347, -4271882, -2797634, -2143726, 2407329, -1203665, -1079111, -1887101, + 1276142, 1006633, 1818382, 600222, 2610266, -98784, -1510218, -714038, 351650, -4094178, + 1629403, -1163399, 94489, 2871186, 2488397, 827855, -897648, -1454920, -1888175, -2590939, + 1206886, -385473, 97711, 2002529, -433792, -837519, 511101, -309775, 1877438, 219580, + -311922, -1311039, -1162862, -619549, -914828, -1173600, + }, + { + 16268262, 1003412, -11643656, 42217916, 1309428, 3846680, -462783, -1495722, -1262720, -7085623, + -3929358, 7051263, 6732361, -5231807, -11176042, 6037651, 9348533, 10514080, 4118874, -1038845, + 6342056, 5599564, 1766842, -10008348, 3984656, 1621350, -5801964, -2253784, 3067681, 16643, + 7595650, 11156178, -6441377, 4773320, -836445, 10930155, -2274722, 1576790, 1251446, 1383516, + 940598, -23622, 3352759, -4099546, 6022618, -209917, -527207, 4258460, -468688, 5577015, + 1863479, 900333, 994822, -3421478, 1709397, 758062, 4096862, 663572, 3006477, 344671, + -929860, -1148904, 2169495, -379568, -3713536, -2635499, -2000381, -37044, 4376035, 3535832, + 726386, -2371359, -671089, 326418, 2261300, 140123, 2120640, -3386582, 1165547, 150324, + -841277, -599685, -1749125, -1913945, -1443646, 1151051, -85899, 810675, -1379221, 797253, + -1781338, 246961, 1190780, -604517, 1057636, 846109, + }, + { + -3520800, -23306104, -8737574, -9805410, 4884989, -593779, 548682, 3191698, 3148748, -3580929, + -1628866, 8390219, -1870995, -24978992, -1021665, 6917582, 12402792, 5941551, -7103876, -2967823, + -5046587, -8391829, 4429722, -8169028, 163209, -6158446, 1354525, -2724083, 4791036, 6449967, + -3730179, 8313983, -2855617, 5591511, 1761474, 1405528, 8551280, -2833068, -2598992, -6448894, + 253403, 6114960, 2254858, 3000035, -785979, 6410239, 23085, -1197222, 566399, -1382443, + 1312113, 4814659, -3804804, 2112587, -2923799, -2615635, 3860639, -2585570, 2463164, 5632313, + 1845225, 1050120, 1536525, 2825015, -1975148, 80531, -1867774, 2420214, -743029, 2439005, + 2674691, 806380, 1757715, -2996814, -3224984, -784905, 238908, 890132, -240518, -2699924, + -1312649, 218506, 762894, 562104, -2807835, -376883, -86436, -1447941, 294205, -47245, + 124554, -1240172, -824097, -257161, -11274, -1618666, + }, + { + 17164836, -23952496, -4939213, 43456480, -4658966, 2587181, -4276714, 1662689, 8938901, -9310415, + 10460930, -3941706, -6337761, -8514236, 16138876, 1629940, -7686918, 1160715, 879395, -862752, + -3355980, -9430138, -5341329, 2849174, 3879966, 4342212, -3746285, 2621004, -6774774, -2477123, + -2947958, -4072703, -769873, 1855963, 4478041, 5267241, -960462, -2218351, -220654, -1971927, + -482110, -827318, -3484829, 3084324, 3755412, -2047626, -697395, -409096, 1829656, -3234110, + 2636573, -30065, 2247342, -4081293, 4512937, -1343251, 302258, -2005213, -1917166, 1678259, + -3148748, 591095, 491774, 2133525, 60666, 387084, 1089311, -75162, -1051193, -770947, + 1981591, -60666, 92342, 1595580, -342524, 1440962, -519154, -1327682, -297963, 876710, + -684510, -307090, -44023, 25770, 25233, -375273, -491774, -332323, -2174327, -341450, + -436476, -577673, -52613, 1156957, 650151, -776852, + }, + { + 3896072, -7478075, -8754754, 788663, 6593849, -9643812, -22565758, -2540473, 7546258, 1660005, + -1547799, 8707509, -312459, 16161962, 5331665, -1119913, 2013266, -6478422, -5974300, 10485626, + -13679471, 2926483, 3800509, -10887205, -9347459, 2430952, -3116536, -3980898, 3321084, -4273493, + 6159520, 7614977, -3810710, -6036040, -6474663, -248571, -1695438, -1327145, 6466074, -630823, + -703838, -5401995, 5930276, -1873680, 3915937, -310311, 875100, -4793721, 1983201, -245350, + 33286, 1536525, -2118493, 53687, 4109210, -6708739, -1170916, -1422171, 1933272, 1932735, + -5507222, 3262028, 1342714, -3626563, -2928094, 1517734, 444529, 474594, -5474473, 890669, + -769873, 417686, -722091, 2052458, 448287, 52076, 4832, 2630131, -1710471, -1799591, + -554051, -294205, 59593, 450972, -1220308, 899259, 397821, -1605244, 2217277, 111132, + -2001992, 697395, -1442572, -963683, 355945, 157303, + }, + { + -11449309, -58306328, -2510409, -4204236, 7005092, 779000, 13882945, -4757213, 7313793, 11292006, + -507880, -41339, -5502390, -6415071, -4475893, -1809255, -10472204, -6317897, -3555159, -10551124, + 5303748, -1840930, 1017370, -8763881, -4897874, 3374234, 666794, -300648, -5915781, -5102958, + -5765994, -10443750, -3795677, -4373888, 508417, 8009041, 12963822, 1292248, 5605469, -396211, + -3906810, -7365332, 3036005, 2728378, -494458, 3573950, -129923, -3431679, 2470680, 2098092, + -7835094, -876173, -3917010, 5779416, -652835, 5702106, -3281355, 3788161, -97711, -2289755, + -3639448, 3770445, 1874753, 2089502, -3701725, 120259, -1258962, 1504849, -890669, -1683627, + 1206886, 692564, 60130, -460098, 1341640, -648003, -511638, -271657, 293132, -850404, + 2397666, -1005022, -910533, -985158, -255551, -1338956, -836982, -1573569, -817654, -790811, + 587874, -1022202, 2331094, 257161, 921807, 1093606, + }, + { + 2374043, -26933740, -9123584, -4179003, 1571958, 1309428, 4053912, -2597918, -311922, 478352, + 13247290, -3541738, 6883759, -27695022, 2219424, -5375689, -2275259, -471373, 7155953, 1669669, + 3907883, 2646774, 1831267, 241592, -1976222, -6255620, 11093364, 14113799, -1053341, 6801081, + 14334990, -1814087, 2316061, 12009802, 2112587, 589484, -5329518, 5456219, 385473, -2731599, + 5143224, 765578, 7838316, -6453189, 1191317, -6989523, -1705102, 6908992, -116501, -8833674, + 9021579, 891743, 9099425, 629213, -343597, 3745748, 2099702, 4269735, 999654, 2996814, + -998580, 547608, -3532074, 1498944, -2341831, 1415729, 367757, 1392643, -3301219, 182536, + -3134789, -1919850, -1662689, -104690, 1491427, 399432, 774705, 1112933, -249645, 985158, + -261993, -2030983, 1468342, -525060, 1000727, -1852742, 1243930, 42950, 1905355, -1746978, + -1005559, 279173, 2930242, 277562, -1725503, 1086627, + }, + { + 14626511, 33636572, -7126962, -6645388, 8007967, -25297894, -4287451, -3249680, -12026445, -5563057, + -7335268, 8636105, 7939784, -16162499, 2805151, -2667175, 8125005, -1482301, 16750909, -683974, + -8238284, -2529736, 3222836, 4926865, -145492, -8609262, -3719979, -6849399, -3511673, 1714766, + -4459250, -5284958, -6295885, -13422, 687195, 10111427, -6416681, 6901476, -5915781, -5723581, + 523449, -8157754, 1661079, 6218039, 10130217, 1177358, 3741990, 3163780, 481573, 1259499, + 4967667, -1546725, -4757750, -3456375, 114354, -753230, 215822, -1134945, -3564286, -3912715, + 1966558, 55298, -2978560, -5252745, -3736085, 1315334, -792421, 1335735, 450435, -2566243, + 1259499, -2309619, -61740, -2906082, -2845416, -28454, 4035122, 283468, 1914482, -2270427, + 356482, 961536, 343597, -1683090, 796716, 89657, 893890, 1275068, 222801, 1382980, + -154082, -601295, -602906, -68183, 89657, -351114, + }, + { + 1633698, 28687160, 3595425, -408559, 7292318, 2790655, 1161252, -10422275, -5065914, 4804995, + 5150203, -4375498, -2608656, 30769146, 78653736, 21549998, -22196928, -11889543, 5932424, -10497437, + 12584254, 11220065, 2668249, -5143224, -2934537, -14541149, 238371, -1640141, 7199439, -4326643, + 4526896, -6320581, -194347, -2972117, 4667556, -335007, 6762963, 593779, -10127533, 2114198, + 1496259, -6727530, -6926709, -618475, -153545, -6146635, -1114544, 5982353, -5968394, -2224256, + -671089, 1964948, -3794067, 4645544, 3393024, 914291, -6717866, 2990908, -1776506, 2020245, + -4126927, 656056, 2057826, -1131187, -3387119, -449898, 265751, 2454037, -2572686, -1151051, + 690953, 449898, 155156, -1715303, -277025, 2190433, 1784559, 66035, -649614, -603980, + -1002338, 235149, -268435, -2022393, 874563, -512712, 1217086, -1625645, 698469, -827318, + 132607, 1611, 293132, -2800319, -1144609, 251792, + }, + { + 14353244, 16797618, -1596654, -3663607, -2238752, -7489349, 6191196, 1105417, 3269544, -15585899, + -15180025, -20020454, 6326487, -6345278, -47505024, -6615860, 18410378, 16261820, 5556614, 15881178, + 6376953, 2686502, 725850, 3615826, 14356465, 6623914, -8446590, 8855686, 3786014, 4533338, + 16556025, 9380745, -9615895, -3509525, 3137474, 223875, -5377299, -1710471, -4485020, -2987687, + -4357245, 2885681, -5818607, -1538135, -6481643, -2156611, 2193655, -1165547, -1167157, -5370857, + -900869, -6155762, -2834142, -165893, -4909685, 616328, 4548371, 2687039, -499290, -3122978, + -2780991, -4624069, -2656437, 4729833, -621160, 260919, -383863, -2512556, -1624571, -309238, + -1674500, 1649268, 275952, -914828, -1800665, 2467459, -704912, 4243965, -1491427, -3452080, + 1546725, 18254, 1079647, -928787, -2783676, 748935, 2250026, 85362, 1948841, 560493, + -363998, 287763, -173409, -1866163, -615254, 175557, + }, + }, + { + { + 1149441, 31255550, -8657580, 8272107, 1319629, -2571075, 1788317, -4310000, -6483253, 3133716, + 6871411, -19773492, 1708860, -4694936, -3508988, 2205466, -8919036, -944356, -987843, -10065793, + -2815351, -5595269, -12822625, -7055558, 7818988, -5011153, 3252364, -13898514, 3904662, -3234647, + -3833795, 1179505, 1559073, 1418950, -188979, -6116034, 4552666, 3258270, -4486630, -5890548, + 2514167, -1406065, 3619047, -2170569, 811749, -6599754, -1931125, 3741454, -2826625, 6129992, + 4518306, 2510945, 1470489, -2248952, -4830228, 1194538, -455267, -2721399, 2649458, -964220, + -1766842, -753230, 250719, 1563368, -1268089, -2563559, 2371359, -1923609, 5464272, 1709397, + -1074, -2242510, -3228742, 1865090, -1591285, -412317, 2257542, 3165928, 508417, -659814, + 447213, -417686, 1478006, -352724, 12885, 1363652, 51003, 1010391, -1104344, 2121714, + 1436667, 862215, 2202245, 0, -17180, 627602, + }, + { + 3928285, 127469264, 18202072, -86937120, 16760036, 303869, 10386305, 18039400, -1738925, -8843338, + -309775, 25605522, -205622, -1066226, -2589329, 1119376, 6455873, 2903935, 12962211, 2483028, + -5791764, 2400350, -5892159, -4846871, -1208496, -5152887, 3470334, 5858336, -8283382, 4174708, + -510027, 2625836, 2059437, -1869385, 870268, 2399276, 2574296, 7582228, 8863202, 1531156, + -1012002, -5893769, -2157147, 895501, 4160750, -4780299, 1850057, -183610, 10510859, -6209986, + -1898376, 3251827, -1826972, -1845225, -1276142, -168577, -2878702, -3054796, -1205275, -3307662, + 979253, -4643934, -1314797, 1548873, 542240, 3234110, 539555, -1277216, -3930969, 1755568, + -1413044, 801011, -1311576, 472446, -1794223, 2410551, 94489, 947040, 612033, 443455, + -1856500, -1400696, 826244, -1406065, 1157494, -449898, 1399623, -347892, 388695, -856309, + -264677, -273267, 117575, 1571958, -608812, -713501, + }, + { + -4208531, -81110992, 8606578, 34127812, -30116310, 8112657, -553514, -6437082, 11005317, 874563, + 4466766, 10787347, -1664300, 9458592, 9754944, 8915278, 11725798, -7963406, 737661, 26529476, + -13231184, -3084860, 10584947, 4173635, 4034048, 3302293, -6667937, 9787157, 5362804, -770947, + -2686502, 1445793, 3316789, -8979166, 3115999, -1707250, 9741523, -7948374, 2573222, 2469606, + 4763656, -4086125, -2438468, 7595113, -2965675, 5206037, 5515275, -595927, -310311, -2036888, + 6280316, 3401077, 3602404, 38118, 1002338, 2357937, -556735, -959388, -2103460, 13422, + 345745, 777926, -3964792, -652298, 2740726, -928250, 23085, -215822, 2261300, -2955474, + 215822, 1176284, -352724, 738734, 955093, -2432562, -1350767, -2136746, 3760781, 3306588, + -25233, -3036005, 106837, 878321, 2367601, 1169305, -2151242, 242666, -2106682, 2215130, + -2049773, -1342177, -476741, 1370632, 348966, -1104344, + }, + { + -135828, -28561532, -3698504, 7231115, 2057289, -633508, -413391, -5156645, 2194728, -933619, + -8474507, -10138807, 369904, -7291781, 16652125, 7378217, -4613869, 3722126, 17449916, -6606197, + -7119445, -3264175, -6505265, 3291556, -1152125, -7132330, -7263864, -5472325, 7199439, -261993, + 6761889, 5368172, -679142, 6352794, 2716030, -3184718, 2470680, -4167192, 5955509, 563714, + -1754494, 554588, 4599373, 2578591, 2523830, 2324114, 2694018, -2120640, -1518271, -4281546, + -1683090, -3485366, 664109, -547608, -918586, -1524177, 1216550, 2215130, -2054068, 3106872, + 1493575, 1928977, 1142998, -164819, -35433, 644245, -4731444, 894427, -3383897, 791348, + 2530810, -445066, -257161, 588411, -1440425, 1086627, -3293703, -95026, -1594507, 761820, + 649077, 1042066, -4316979, 611496, -296353, 376347, -283468, 131533, -1114007, 811212, + 891743, -517007, -703301, -155156, -1069447, 1005022, + }, + { + -13147969, -10094784, 11083700, 29593936, -7990250, -3782793, 106837, 3392487, -1263257, 4922570, + 8526047, 13681081, 4655208, -5072893, 3737159, -7004555, 1137630, -1476932, 18928994, -2712272, + 4847408, -4590247, 9296994, 10478646, -4720706, 4629438, -5388037, 5319854, 1950452, -3708704, + 110595, 5517423, 2717641, 2525978, 268972, -2563559, -716186, 7284265, 768262, -5015985, + 1732482, 3462281, -1111323, 5207111, 4752918, 2721936, -6459631, 3855807, -1308354, 4760971, + -4135517, -971736, -2594697, 3127273, -2351495, -495532, -5498095, 473520, -2438468, 3797825, + -325881, -536334, -886911, 463320, -416612, 2025077, 2180770, -1373316, 341450, -512712, + -2804077, 1592896, 619012, -141197, 1804423, -1345935, 977105, 112206, 357556, 691490, + -1607392, 662499, 1567126, -305480, -1451162, 874026, -224949, -1007707, 61203, 866510, + -1548336, -856846, -1502702, 1076963, -1144609, 1316408, + }, + { + -149787, 3995930, -7248831, -1147830, 5309117, -128312, 82678, -114890, -920197, -2407329, + 2648921, -4034048, -3971234, -11167452, 45170708, 18908594, 13882408, 904091, 19327, 4163971, + -1356136, 10736881, -6426345, -1669669, 8071854, 986232, 10299332, 1272921, 7952132, -8578660, + 4888210, -9417253, -1984812, 471373, -2566780, -3859565, -1859184, -3082713, 1260036, 2754685, + -3322157, -2277407, -3427921, -1446867, 2222646, 4399121, 5708549, 1855426, 635118, 609885, + 2013803, 79994, 2905009, -821413, -4663798, -2823404, 3980361, -581431, -3193845, 775242, + -18254, -387084, -540629, 2946348, 652835, 1340567, -969052, -442919, -887448, -892816, + 97174, -1353989, -520228, 1733556, 2076080, -362925, 2718178, -2768643, -3721052, -842887, + -1801202, 825171, 518617, 2895882, 454193, -336081, -1044214, -936303, 1352378, 519691, + 1175210, -1455994, -1691680, -438624, 294205, -1247151, + }, + { + -16642998, 37642168, -264141, 44350908, -1636383, 2124398, -5684389, -2497524, 16620987, -13793824, + 2820183, 2996277, 3084324, -1323387, -10509248, 4017405, 31343598, -6111739, 5124970, 5454609, + 4671851, -539555, 3057480, -10308458, 10822781, 6318971, -2208687, -8304856, 569620, -2071248, + 7628936, 10070625, 289910, -1638530, 3551938, 7802345, -3179350, 4327180, 3455838, -1903744, + -595927, -1678259, -580357, -4358318, 10234907, -2571612, 2257005, 3659849, -2812667, 7130720, + 1770600, 659814, 404801, -2356863, 3259343, -1066226, 3154654, -42950, 2501819, 2006824, + -1237488, 331249, -867583, 1325534, -3414499, -2393371, -2107755, 91268, 5698348, 2415382, + -787053, 185757, 1103270, -782758, 817654, 2213519, -1977296, 423054, -1146756, 1761474, + -1973538, 344671, -3351148, -807991, -448824, 1140314, 5369, 376883, -1362578, 341987, + -332323, 210990, 84289, 206695, 1381906, -833224, + }, + { + -369904, -38284800, -13328357, -965294, -4446902, 5624260, 2149094, 3616363, -1022739, -2364380, + -3994857, 8659191, -4364761, -13333189, 2662343, 994822, 21239150, -6716255, -11598022, 1993402, + -3522410, -3694746, -1482838, -10805601, 1270237, -4370129, 4738423, -7490960, -319438, 3999688, + 7267085, 6940131, -3111704, 3010772, 6152004, -1842541, 4843113, -3571265, -8755291, -1163399, + 3059091, -1014686, 6403260, -991601, 2632278, 2753611, 231391, 679679, -1656247, -465467, + 4364761, 2671470, 688269, -2091649, -850940, -1287417, -430034, -1739999, 2870649, 6660421, + 1113470, 2494302, -616865, 3539590, -3259880, 3272228, -1817845, -454193, 412854, 1795296, + 958851, 1952600, -620623, 561567, -2688113, -2459943, 149787, 1239098, -320512, -1626182, + -573915, -449361, -655519, 619012, -242666, -1804960, -1348083, 447213, 149250, 267362, + -114354, -1618666, -1347009, -12348, 676994, -1702955, + }, + { + -20862804, 19301584, 9181566, 52396452, -12221866, -1289027, 3310346, -5848672, 3739306, -1655710, + -16229608, 21267604, -14960982, 2218351, -9272298, -6752763, 16473884, -4607426, -3132105, -6128919, + -6611029, -7451769, -1926293, 4568235, -92342, 11799886, -7974144, 502511, -4858682, -161061, + -1130650, -2481954, -3437585, -2342905, 1818919, 4750771, 1730335, -3299609, 1270237, -681289, + -1226750, -251256, -3597035, 823023, -414464, 695785, 1400696, -3068217, 5099200, -1138166, + -2260227, 2451890, -2006287, 1689533, -1064078, 3354370, -6768332, 1470489, -5979668, 6803765, + -1221918, -2572149, -732292, 646929, 1719061, 1919850, -109522, 661425, -598611, 516470, + -427349, 2348810, 244813, -537408, 1481227, -1060320, 526670, -682363, -870268, 463856, + 205622, -929860, 657130, 790274, -550293, -128312, -62277, -1580548, -2148021, 873489, + -1973538, 9664, -1464047, 1803886, 899259, -699006, + }, + { + -3701188, -14157286, 16251083, -4116726, -2171106, -21832930, -756988, -5726265, 563714, 10375030, + -7293928, -1738388, 14746233, 6352794, 14501957, -3561602, -4290673, -2972654, -8432095, -1659468, + 1905892, -6036577, 3708704, -16279537, -12126840, 4523138, -6199786, 3207804, 5785321, -294742, + 2487860, 5526549, -2537252, -6907918, -6351183, 1397475, 78920, 809064, 3148211, 4769561, + -4716411, -1314260, 2792266, 51003, 3302293, 3867618, -2435783, -3019899, -4875862, 5655935, + -226560, 793495, -1076963, -3038153, 2462627, -4254702, 328028, 4227322, -2899640, 3852586, + 308701, 1447941, -597000, -818728, -2592550, 2972654, -1960116, -3228742, -965294, -1269163, + 226560, -1701344, 1432909, 2790118, -1621887, 229244, -17717, 266288, 2504503, -2077690, + -208306, -85899, -832150, 842350, -2010582, 2035278, -795106, -183073, 206158, 1191317, + -579821, -138513, -1892470, 1078037, -1019518, -710280, + }, + { + 11542725, -68426344, -29792040, -12466679, 21052856, 21870510, 2089502, 3753802, -2350958, 1846299, + -6373732, 4143570, 11722039, -6504191, 1794760, -12444131, -5122286, -16550120, 2108292, -1600412, + -2419140, 753767, -294205, -15477988, 1787243, -3033321, 6054294, -907312, -8615168, -8917426, + -4153234, -7322919, -2760590, -7647190, 5936182, 3179350, 11618423, -998580, 8782134, -344134, + -4293894, -8377334, 7598871, -761283, 2318746, 3467649, -3143916, -2094333, 413391, 348429, + -7601555, -4023311, -3092377, 3555696, 1033477, 3779571, 631897, -2129230, 2237141, 287763, + -85362, -2335925, 2189897, 1178432, -1386738, -882616, -499290, 1285806, -405338, -2129230, + 2187212, -68719, -951872, -1475321, 2008434, -514322, -98784, -98784, 1553168, -1530082, + 1062468, 178241, -1773285, 937377, -223338, -1357210, -1995012, -741419, -2559264, 1163936, + -751082, 1349694, 866510, -532039, 974958, -25770, + }, + { + -1285269, -23409720, -4841502, -3023120, -6915434, 5543729, 4213900, -2934000, 1073205, -1577327, + 10495289, 3817152, -8406862, -8891119, 2895882, -1809792, 1080184, 7004018, -3921305, -187368, + 365072, 8362838, -4966593, 2132451, 6068789, -10151155, 12856985, 14472429, 19413252, -6982006, + -1102733, 9356049, 6808597, 6912750, -6170258, 6187438, -4600984, 8893267, -2912525, 778463, + 360240, 3027952, 951872, 1214402, 595390, -1027034, -3478924, -2986076, 1692754, -2216740, + 4412005, 3175055, 4556424, 402116, -540629, 5067525, 4167192, 2081449, 2968359, 1578937, + -833224, 1974074, -4623533, 255014, 439697, 402653, -529355, -623844, 717260, -59056, + -3957276, -4204236, -2579128, 3425237, -510564, -114354, 832150, 310311, -1304060, 3259880, + -1506997, 6979, 158377, 257698, 2063195, -2040110, 2327872, 459025, -603443, -940598, + -32749, 419296, 691490, 341987, 139586, 320512, + }, + { + -5070746, 68691024, -5311801, -16479253, -9595494, -7754027, -6541772, -3056406, -11530377, -12926241, + 5974837, 1363115, 13936632, -17317846, 9004936, -2388002, 2385318, -1315334, 8161512, -4792110, + 3145527, -5902359, 421981, 10030896, -3898220, 1466731, -7486128, -14026826, -3248606, 1136019, + -1018444, -9388799, 1183800, -2537252, 4164508, 6817724, -11273215, 12204686, -5033165, -4285304, + -1013075, -8164733, -96637, 8002598, 10662793, 6054830, 3034395, 1422708, 1347546, -474594, + 5101885, -2937221, -3317325, -1854352, -3590056, 1035624, -282394, -9664, -1333051, -3685082, + -170188, 1719598, -4212826, -6882685, 2673617, 237297, -4391604, 2330557, -3200288, 57445, + 603443, -936840, 278636, -3190087, -2020245, 1255204, 369904, 2696703, 288837, -1747515, + 1617055, 1297617, -1325534, -1490354, 594316, 1918240, 746787, 729071, -430570, 2723009, + -487479, 312996, -2397129, 963146, -686121, 324270, + }, + { + -1947768, 29174102, 3479997, 5580773, 7178501, 916439, 816581, -11686069, -5541045, 1768990, + 8781598, 1662689, -10702522, -3891777, 134051296, 21170430, -13606993, -19416474, 8837432, 333934, + -5826660, 12996571, 12370043, -8076149, -11290395, -14424111, 3781182, 1235877, 173946, -1240709, + 2566243, -6359236, -1326608, -7828652, 11785390, 308701, 3062312, 1771674, -7409356, -2308545, + 4931696, -11077258, -1389959, -1299765, -4113505, -380641, 1232656, -2813204, -122407, -4265977, + -2110440, 1636383, -3699578, 1338956, 3060164, -3033858, -964220, 919660, -2240899, 3953518, + -6090801, -4909148, 7059853, -3504157, -3001109, 118648, -2145336, 4837207, -5191005, 2094870, + 171799, 353798, -294742, -1430224, -616328, 1090385, 1730872, -2006824, 1902134, 328028, + -962610, -795106, -2039036, 1935420, -1682017, 491237, -415001, 317828, -1733556, 1448478, + 267362, -774705, -1983738, -1068373, -2360085, -92342, + }, + { + -9994926, 52307868, 2322504, -9782862, -10830834, 6233608, 3155190, 3524021, 1378148, -11501386, + -23198728, -12671227, -4678293, -17322676, -48951888, 2399813, 32321240, 5162551, 21235928, 4904853, + 13423383, -6120329, 10122164, 5214091, 10375030, 7667591, -3362960, 7374996, 8109972, 6039261, + 8831527, 11085847, -3215857, -1862405, 1698660, -1267015, -8523899, 2244657, -5353140, -9865540, + 2370822, -1468342, 2236604, -6445136, -2708514, -4306242, 3798899, -1391569, -5155572, -2973728, + -635118, -7285339, 2981781, -6521371, -1979443, 1353452, 6110665, -2328409, -1644973, -2149631, + -4764730, -3624953, -102005, 2537789, -1236414, 903017, -1063004, 1401770, -1415192, -4380867, + -720481, 1522566, 2105608, -1062468, -1444720, 2652679, -891743, 2075543, -790811, -3140695, + 1792612, 492311, 673236, -1149978, -427349, -22549, 1021129, 389768, 265751, 27380, + 579821, 319975, -534723, -1386201, 901943, -76236, + }, + }, + { + { + -811749, 49443664, 12200391, -25987236, -14734422, 5256503, 986232, 1384590, -3481071, 4656819, + 11781095, -6412923, 14505178, -1970316, -10521059, 7330973, 12712566, 19576460, 8520141, -15389942, + 5020280, 9145596, -848793, -632971, 1404991, -8493298, 4165045, -15649787, -524523, -2681133, + -2573222, 2276870, 2292976, -2284923, -5612986, -9747965, 1011465, -2239289, -10125385, -3661997, + 7327214, 4275103, 2509335, -6573448, 5318780, -3204046, -3898220, 1041530, -4331475, 3192771, + 181462, -1073205, 426812, 756988, -1798518, -1258962, -1841467, -1047972, 91268, -6126234, + -1580548, 1190243, 1982664, 2236604, -2025614, -2334315, 2454574, -88584, 5776194, 586263, + -3189013, -219043, 1027034, -294205, -1404991, -142271, 717796, 1313723, 1969779, 1200443, + -107911, -201863, 976031, -721018, 214748, 165356, -1144609, 1034013, -1442572, 861141, + 186831, -391916, 840203, -347355, -529892, -38118, + }, + { + -2596845, 98028872, -1411971, -56482040, 48894444, 7583839, 4537633, -3245922, -4180077, -5537824, + -18447422, 7295002, -4317516, -3983582, 2634963, -5825587, -10718091, -4745402, 7581691, -3347927, + -2554969, 3849901, -5849746, -2680060, 4444755, 4218195, 7661685, 7733089, -12029130, -3167539, + -7348152, -100932, 4523675, -1706713, -4508105, -2769180, -1644436, 2006824, -141197, -4875862, + -3104188, -7775502, -2341831, 149787, 2823941, -4917201, -814970, -4163434, 2368675, -8548059, + -1998234, 2470143, 639413, 267899, 443992, 431107, -1386201, 573378, 281320, -5409512, + 681289, -4410395, -787590, 3220689, -2563559, -605054, -1794760, 2430415, -894964, 747324, + -4500052, 172872, -235686, 2004676, -3015067, 483184, 1787243, 743029, -264141, 2251637, + -113280, -380105, 1224066, -2413772, 1961726, 4832, 888521, -1015760, -1912334, -535797, + 1682554, 1052267, 1795296, 1757179, -692564, -983011, + }, + { + 1167157, -84636088, 4165582, 65485904, -9416716, 7714298, 2027761, -1894618, 8654896, -1061394, + 13346074, 19814832, -4032438, 6253473, 10372883, 355945, 7197292, -436476, 1814087, 19432042, + -7980049, 4992900, 7817914, 3020436, 1835562, 277025, -4940286, 8779987, 830539, 1044214, + -7030862, -3760244, 11401528, 1758252, 4552666, -2720862, 7373385, -9396852, 2566243, -4825396, + 3593277, -2127083, -4290136, 12033961, -1354525, -4602595, -1451699, -1883880, -1228898, -1709397, + 4721243, 1252520, 1722819, 218506, -1633161, -1649804, 129923, 2687039, 2464238, 1836635, + 2141041, 3509525, 21475, 956167, 1600949, 551366, 1544041, -2072859, 2983929, -4250407, + -2190433, 214748, 631360, 908386, 251256, -2434173, -808528, -2185602, 600222, -936303, + -1455457, -2951716, -509491, 121870, 795106, -257698, -1701881, 1171452, -1113470, 2593087, + -1329292, 111669, 27917, 1389959, 598074, 44560, + }, + { + -1607928, -27254788, -1809255, -969052, -3727495, -877247, -2404108, -1321776, 2968896, 627602, + -1756642, -11672647, 79457, -8129836, 2726767, -2558190, -15899969, 25233, 18166638, -8286603, + -1060857, -2639258, -15376520, 2799782, -4326106, -8982387, -1232656, -4711579, 4076461, 468151, + 6133214, 8766565, -1969779, 4221416, 1743757, -2341294, 3061238, 1165547, 10606422, 3585761, + -3796751, -32212, 5796595, 2301566, -4490389, -4844186, 196495, -1129040, 4192962, -4564477, + -1969779, 2098092, 2880849, -1675574, -541703, 258772, 625455, 1693828, -1953136, 557272, + -814433, -614717, 382252, 1740536, -765041, 2692945, -1166621, 2818572, -1685775, 1245541, + -397821, -2354179, -484258, -1223529, -2201708, 537408, -1691680, 2438468, -310848, 1717987, + 1229971, 1171452, -1718524, 1130113, -2587181, -376883, -151934, 424128, -813896, 540629, + -41339, 566936, -317291, -1102733, -1028108, 1971927, + }, + { + 12816719, 16492138, 9426379, 40597104, -2695092, 3129421, 663572, -2257542, 2507724, 9600326, + 1748052, 7710003, 9104257, -4181151, 4349728, -5091684, -2984466, -8475044, 12649752, -6251325, + -1626182, 1002875, 4739497, -9186935, -7775502, 4397510, 1249299, 23625004, 7131257, -6781754, + -1962800, 5360119, 455803, 4030827, 6438156, 175020, -5658083, -1778117, 2098629, 951335, + 5290863, 6647536, -156229, -306553, 1126355, 4090956, -5103495, 3064996, -5108864, 3515431, + -1450625, 315143, -7196755, -1855426, -4485557, 1796907, -1492501, 2983392, -1187559, 2799245, + 1660542, -643708, -1442035, 1195612, -295279, 699006, -755914, -4252018, -148713, 1103270, + -2306398, -628139, -1396401, 1633698, 4544613, -226560, -27917, -1458141, -1129040, 216359, + -2267743, 420907, 1102733, -945967, -3728032, 956167, 905164, -347355, 628676, 1854352, + -1034013, -4832, -251256, 1488743, -412854, 1603633, + }, + { + 1576790, 15247671, -3168075, -3479461, 3623879, -1215476, 1174137, 547608, 1637993, 5681168, + 2263448, -10934987, -9036611, -23354958, 33403034, 6686191, 1663226, -5862631, -2857764, -264141, + -10580115, 5047124, 11781095, 10931766, 1121523, 67646, 6550362, -6385543, 7929047, -3052648, + 11615739, 2314987, 5737003, 3505230, -1096827, -814433, 4072703, -2204929, -2274722, -4800700, + -3055869, 3289408, -3226057, -2078764, 394600, -195421, 3897146, 461172, -1985349, -2054068, + 1027571, -1094680, 653372, 192737, -1141924, -4089883, -282394, -1184337, -217433, 2961917, + -1385664, -2361158, -2410014, 2252710, -672162, 1653026, 691490, 805306, -416075, 772020, + 1042603, 1868848, -1160178, -2339684, 343597, -1336809, 4228932, -332860, -1663226, -1391033, + -3005940, 2719788, 78383, 1600949, 59593, -1654636, -1293322, -104690, 318364, -1206886, + 950262, -196495, 269509, 605054, 658204, -299037, + }, + { + 11186779, 67065916, 613107, 53717692, -1391033, 4291209, -1051730, -9183714, 9592809, 2513093, + -1743757, -9414031, 14232448, 12565464, -45097, 12120398, 33846488, -9683004, 1402307, 6979, + 1892470, 2058363, 10079751, 2445447, 6379637, 668404, -3045669, -4748623, 2808909, -3285113, + 4500052, 6822556, -3112778, -7968238, -947577, 1370095, -6675990, 3735011, 4783520, -1799591, + 1961190, -18254, -2797098, -4952634, 3786014, -6376953, -2953864, -3859565, -5552856, 1220845, + -1518271, 539018, 869731, -15032, 4709432, -927713, 2232309, 1320166, 2114198, -506269, + 268435, 2580739, -1655173, 2626909, 710280, 1111323, -1207423, -2206003, 3060701, 2818036, + 719944, 2336462, 2384781, -505732, 420370, 1052804, -594316, 3537443, -1586454, 330712, + -3112778, 2195265, -982474, -5906, 185220, 1155346, 1198296, 1232119, -2627983, -535797, + 1504312, 480499, -245887, -80531, 960999, -1624571, + }, + { + 3331821, -2354716, 8230768, 14755360, 3757023, 2727841, 3804267, 2021319, -5211406, -274878, + -5057861, 963146, -1939178, 2000381, 15141907, 4346507, 10162429, -11077794, -7053410, 7609072, + -18790, -955093, -1975148, -6838662, -1682017, -15392626, -1600412, -7945690, -2449205, -260382, + -6422587, -5398774, -1591822, 3984656, 5744519, -5525476, -1983738, -9286256, -7447474, 2702608, + -1102733, 880468, 8011188, 165356, 2570538, -446140, 829466, 2688113, 403727, 1559073, + 2033667, 3428995, 2397666, -2122788, 3446175, 913217, 1074, -354872, -747324, 1134945, + -2800856, 2835752, -3250217, 3247532, -3335579, 1798518, -62277, -2681670, -1012539, -484258, + -2772938, 159451, -2479807, 315680, -723165, -1466195, 1049583, 4372814, 1516124, 85362, + 1452773, -1240172, -2316598, 640487, 690416, -463856, -91805, 1823214, 307627, 701153, + 995896, -576063, -425202, 98784, 1465121, -2011118, + }, + { + 19276886, 65860640, 10897943, 71233640, -5573794, -127238, -1175210, -18450642, -4771709, 1371168, + -26909044, 8442295, -12574054, 729608, -26113938, -11876121, 21395380, -13248900, -9394704, -6471979, + -8861054, -10384157, -1787780, 3303904, -2182917, 10741713, -3464428, 6847789, -431107, -1157494, + -2614025, -10154376, -13726715, -5354214, -5158256, -2417530, 1194001, 478889, 5929203, 4577899, + -2383707, 234076, -4219269, 1530619, 331249, 2364380, 4625143, -4656819, 1145146, -11811, + -3036005, -790811, -3763465, 289373, -3451006, 2738579, -7179575, 3095598, -1791001, 7400766, + -2426120, -3970161, -3122978, -3365107, -4403415, -858993, 2660732, 2165201, 2011118, 3425773, + -895501, 708133, -444529, -2950643, 1414118, -2598455, -2514167, 685047, 1589138, -116501, + 1018444, 712428, 2523830, 397821, -2630668, -452045, 560493, -965294, -1625108, 456877, + -1037235, 916439, -2049236, 976568, 628676, -640487, + }, + { + 2161442, -24640228, 3652870, -2398739, -4779762, -98784, 21160230, -17069274, -15615427, 15982110, + -557272, -7281044, 159988, -14288819, 5673115, 1197222, -100932, -8074002, 2969970, 8151848, + 4925254, -2643552, -27917, -12145094, -12910135, 3429532, -1480153, 197569, 4645007, 5910412, + -833761, 6534256, 9587978, 759136, -9123047, 326954, 5890548, -552440, 2641405, 16565689, + 4475356, 1049046, 2341294, -6871411, -3810173, 3794067, -2121714, 1635309, -5800890, 2271501, + 2799782, 1489817, -304406, -6235756, -2244657, -6863358, 6442, 6125697, -3533684, 3433290, + 1079647, 529355, -2327872, -2907693, -853625, 3317862, -1983201, -1460826, 3104725, 1169842, + -198105, -2371896, 826244, 1064078, 983548, 1041530, -1759326, 2109366, 6076842, 995896, + -863288, -897111, -248571, 2179696, -1234803, 922344, -825171, 332323, -412854, 1494649, + -3221, -274878, -849330, 2054068, -913754, -294205, + }, + { + -11192148, -88514448, -17909476, -5229660, 14723148, 6447283, -730681, 5546414, 7036767, -3738232, + -4540854, 6597070, 22847616, 11977590, 8811662, -14886894, 3729105, -5560909, 7906498, -140660, + -2640331, 2636036, 5298916, -5658083, 9314173, -11416560, 3921842, 3069828, 2774549, 5128728, + 8995272, 4085051, -4212289, -9473087, 362925, -13761075, -508954, -989990, 8536248, 3537443, + 4865661, -2065342, 6137509, -1376000, -797253, -2246805, -5746666, -4353486, -2123861, -2035815, + -100932, 2364380, -3454764, -1512365, -1074279, 4837744, 777389, -3344169, 1577864, 53150, + 3452080, -1080721, -1193464, -2122788, -2753611, -1615445, 787590, 1886028, -230318, -1400159, + 1557999, -937914, -2685428, -380105, 4337917, 243739, -535797, -14496, 2108292, -870268, + -355945, -1538135, -2956011, -103616, 358630, 2229088, -770410, -1184874, -1771137, 1420024, + -936303, 1490354, 628676, -1257889, -414464, -1022739, + }, + { + -369904, -25200184, -2398739, 2367064, -9456981, -4017942, -4103305, -689342, -261993, -367220, + 3019362, -1551557, 6869264, 16307991, 7289097, -2528125, 8904541, 13664438, -10298258, -6358699, + -5276904, 3173444, -5565204, 5711770, 17125646, -615254, 4013110, -6868727, 5865315, -9002251, + -9142912, 845572, -2150168, 4416300, -7931731, -3192771, -3861176, 15754477, -1147293, -1120450, + -1259499, 1218160, 1158031, 3969087, 1129040, 7203197, 2728378, -7270843, -4502200, -2066416, + 1883343, -4180077, -1611687, -1656784, 1772211, 3542274, -2844342, -4312147, -763967, -213138, + 797790, 1416266, -4742181, 1620276, 2450816, 2863670, -1269700, -2021319, 3292629, -540629, + -3019899, -1212255, -2176475, 4682051, -637803, -83215, 1307818, -1231045, -2752000, 2418067, + -2481954, 915902, -260382, -1833951, 1657321, -2622078, 1833414, 1458141, -139050, -178778, + 524523, 537, -537945, -1101122, -826244, 87510, + }, + { + -8252243, 48535276, -13069049, 3263638, -3866544, 10670309, 8231305, 5261872, 1642288, -13250511, + 1989644, -6312528, -5513128, -22651120, 13551159, -9540196, -2883534, 4892505, -4224101, 2396055, + 18032420, -3524558, 4941360, 2578054, -2273648, 13696114, -4217121, -4427038, 7512972, 556735, + 1550483, -1647120, 11395622, 2227478, -3042984, 284542, -6296959, 12805445, 1049583, 4226785, + 4328790, -5298379, -854699, -1132261, 937914, -1234266, -2141578, -1580548, -4707284, -5208185, + -514859, -2064806, 4454418, 2075543, -1829119, 5871221, 999654, -979253, -2507724, -2684892, + -1261647, -713501, -226023, -2361158, 1947231, 1252520, -3155190, -1629403, -5595806, -1297617, + -1248225, -1767916, -113280, -1033477, -364535, 2154463, 1432909, 2644626, 166430, -1250372, + 1673427, 1224603, -461709, 542777, 1113470, 1598265, -747861, -924492, -2650532, 1810866, + -242129, 1482301, -1753420, 610422, -1055488, 841277, + }, + { + 2007897, 22851374, -7220377, 1945620, -1445793, 929324, 9372692, 1820529, 4915053, 194884, + 4914517, 577673, -7917236, -28599650, 80781896, 13974750, 9496173, -2035278, 15582141, 14845554, + -12919798, -3543885, 4715874, -14129906, -14998563, -4330938, 3479461, -11074036, -1628330, -3829500, + 778463, 1759326, 1467268, -5522254, 7039989, -4960687, 4541391, 3696893, -3942780, -1908039, + 2910914, -5354214, -49929, -2563559, -2224793, 1282048, 4411469, -1637993, -913217, -2065879, + 531502, 2859911, -9004936, -10558640, -1793149, -1722282, -217433, 1520955, -2246268, 2764885, + 469225, -3563749, 2319819, -46708, 2241436, 207232, -5375152, 2343442, -3616363, 4090956, + 45097, -2794413, -1976222, -576063, -2046015, -379031, 2147, -2263448, 1304060, -181999, + 1392106, 481036, -760209, 3136400, -2691334, 207232, -528818, 1991254, 555125, 562641, + -284005, -419833, -1518808, 505196, -2115272, 227096, + }, + { + 1142998, 61005716, -7754564, -24566676, -12037183, 24122684, 14116484, 6469832, 800475, -1942399, + -14015552, -4101694, 550293, 17709760, -1406065, 9089761, 27057758, 2554432, 14737107, 4330401, + 11686069, -12989055, 12746926, 3847217, -3211025, 2724620, -427886, 12156368, 11362873, -7421167, + -5913633, -1721745, -5682242, -967978, 4353486, 1348083, 1045288, 5340792, -6378027, -3739306, + 9183177, 4362613, 8613557, -7172596, -1282048, -3350075, 1835025, 586800, 2912525, 434865, + 381178, -5812702, 2037962, -3584687, 1671279, 3559991, 6313065, -1247151, -2871186, -3616899, + -2888903, -601295, 1603633, 1006633, -507343, 697932, -1928977, -723165, -675384, -2200097, + 201327, -246424, 2120640, 4314832, 916439, 708670, -3841848, 1070521, 1205275, -3053185, + 291521, -271657, 574452, -419833, 365609, 183073, -796180, -239444, -33286, -1385664, + 1284195, 300111, -700080, 344134, 2542084, 712428, + }, + }, + { + { + -981400, 51845088, 10529649, -39899708, 6249715, 1483374, -2984466, 6328098, -2798171, 5464809, + 8562017, 2840584, 2082522, 4316979, -9384504, 10744934, 17311940, 17083232, 5609764, -13262859, + 8159901, 1719061, 6227166, 8866423, -11613592, 3457449, -12905840, -1655173, -3707094, 1399086, + -6398428, -6061810, 5120138, 1581085, -11900818, -5218922, 4355097, 324270, -11045045, -1878511, + -420370, 4439923, 7073275, -6776385, 2980171, -2077690, -2488934, 3732864, -3541738, -1976759, + 1918240, 1418413, -3973919, -1098975, 4846334, -888521, -5010616, -763430, -3581466, -5438503, + 2327336, 1074, 1300301, 165893, 538482, 2403034, -2531883, 3706020, -438624, 1904281, + -1887638, 446140, 2916283, -1138703, -1356673, -277025, 1092532, -1337882, 1433982, 2304250, + 135291, 2650532, -1594507, -444529, 843424, -1299765, -1634235, -421981, 783832, 626528, + -828929, 100932, -198642, 1557463, -1203665, -618475, + }, + { + -37581, 126462088, -19444928, 3119220, -23490250, 16802986, 12697534, -20459076, 3763465, 2266132, + -10306311, -19952808, 7059316, -7024419, 3998615, -5387500, -10106595, -2914672, -6550362, 3339874, + 7690139, -8196945, -1912334, -2156611, 5093831, 5080947, 1522566, 7376070, -2159295, -9827959, + -4640176, 1139777, 1727651, 688805, -3878892, -213675, 187905, -1791538, -2694018, -3731253, + -4159676, -9987410, -1486596, 38118, -14496, 4233227, -8268886, -2143189, -4407710, 1348083, + -4723927, -443455, 2328946, -1416802, 847182, -20938, 33286, 5130339, -5522254, -2519535, + -1788317, -205085, -418222, 450435, -2422899, 844498, -5389110, 3220689, 1796370, -1562831, + -4533338, 1131724, 1032403, -1286343, 304943, -2467996, 2477659, 2047626, 264677, -159988, + 994285, 217970, -199179, -1072668, 1632625, 538482, 468151, 147640, -2787971, -156766, + 1354525, -13422, 2920041, -301185, -5906, 614717, + }, + { + 2704219, -102313104, 16855062, 51069844, 1140314, 4874251, 6732898, 9679246, 1077500, 1996086, + 386010, 25221658, 8458938, 1411971, 12036646, -1110786, 1675037, 1425929, 12570296, 4138738, + -3024194, 11332808, -1695438, 6782290, -229781, 124017, 1677722, 1241246, -1930588, 2334315, + -890669, -3285113, 14023605, -41339, -2696166, 10988137, -7415798, -6825777, 5639829, -5346698, + -4143033, 3711389, -4737349, 6900939, 1653026, -5967320, -1368484, -989453, -4290136, 4592394, + -506269, 3557844, 3462281, -3244848, -4597226, -5296769, 3643743, 3539053, 1705639, 3702799, + 2499134, -340376, 3583613, -624381, 100395, -1497870, 5986111, -2356327, 1210107, -2920578, + -1236414, -2559264, 340376, 133144, -1060857, -592706, -2631741, 807991, -834297, -3415573, + -1270774, -426276, -1216550, 695248, 74625, -1709397, 62277, 192200, 1557463, 218506, + -176631, 226560, 143345, 1615982, -840740, -111669, + }, + { + 1921998, -28099286, -5528697, -5465346, 954557, -1467805, -4837207, 3765076, 2332167, -115427, + -396211, -13226352, -1106491, 2498597, -9866077, 4661114, -16009491, 1070521, 9131100, -2771328, + 2101313, -1173600, -18889266, 3171833, -4839355, -11933030, 5382668, -5530844, -6393596, 8398809, + 8745627, 6849936, -4399121, 7789460, -8067023, 13348758, 19327, 3445101, -1269163, 10449119, + -10820633, 5364951, 3451006, 1975148, -2910377, -4648765, -197032, -176631, 5287105, -3260954, + -4852240, 2907156, 1043140, -597537, 803159, 950262, 99858, 1034013, 107911, 2490007, + -247497, -2101313, -2445984, 3612068, -3327526, 1869385, 597000, 289373, 2895345, 1296543, + -543850, -3655554, 387621, -2207076, -537945, -804233, 1487132, 672699, 88584, 1506997, + 1179505, -475131, 995896, 1450088, -3240553, 60666, -675384, 976568, -485868, 29528, + 50466, 1358283, -537945, -1496259, 238371, 896574, + }, + { + -6869800, 40854804, 44023, 48129404, 3712999, 932545, 5403069, -2554432, 4202626, 10170483, + 1760400, 1529008, 6505265, -2033130, -1692217, 1322850, -4241817, -5755793, 6201396, -342524, + -10863046, 10960757, -4573067, -16236587, -5987722, 9588514, -1286343, 18836652, 10386305, -1493575, + 3451006, -4931696, 4252018, -1274532, 10413685, -1020055, -25233, -6788196, -1739999, 5253819, + 5983427, 2924336, 1283122, 1831267, -4482872, 2858301, 3263638, -662499, -7892540, 4078608, + 3480534, -3127810, -7294465, -5287642, 2406256, -1258962, 1687922, 1961190, 151934, -1075352, + 1986959, 571231, 1939178, 1378685, -2911988, -107911, 547608, -4246649, -1817308, 1322313, + -572304, -818728, -2614561, 1970853, 2851322, 3338263, -2508798, -440234, -2505040, 1197222, + -2210298, 1061394, 24159, 99858, -2856153, 218506, 190589, 1846836, -370441, 1663763, + -383863, -1457605, 320512, 838056, 1292785, 536334, + }, + { + 8590, 8035884, 10741713, 1102733, -3884261, -535797, 336618, 2062658, 3326989, 2083059, + 4079682, -13360033, -8660265, -17907866, 32016296, 5316633, 3629247, -14127758, -2754148, -8634495, + -4976257, 3762928, 13329968, 13852343, -1647120, 2291902, -2480344, -3088618, -5195837, 7732015, + 4323959, 5389647, 1136019, 1628866, 2677375, 813359, 4196183, 1106491, -2223719, -5223754, + -1030792, 164819, -4989679, 1523103, 2313377, -3139621, 1277216, 537945, -2278480, 812823, + -944893, 890132, -2219961, 3345780, -1011465, -2140504, -6003291, -1152125, 2156074, 3520263, + -4100083, 734439, -2541010, -499290, 839129, 134218, 1766305, 1152125, -329102, 1804423, + 313533, 1821603, 286152, -746787, -1653562, -396211, 3001109, -722091, 89121, -2456185, + -1476932, 1356673, -828929, 1938641, -92879, -1472637, -423591, -923418, -447750, -1488743, + 794032, 657667, 450435, 991601, 229244, 98247, + }, + { + 555661, 80521512, -4786741, 63122060, -4601521, -1675574, 5242545, 1433445, -9195525, 13478144, + -2238215, -11199664, 17849884, 1126892, 16055125, 11900281, 16445967, -7672422, 2359011, 8826158, + -9361418, 10993506, 1722282, 22278532, -6708202, -2695092, -6321118, -4469987, 1629403, -1433982, + 951872, 5883032, -5573257, -5473399, -3009162, -5849746, 2610266, 1629403, 748935, 2221035, + 2181844, 1363652, -2819109, -108448, -2007897, -7271380, -4460324, -517007, -4117263, 669478, + -3968550, -4529580, 8085813, 779537, -102005, 1733019, 2333241, 1086627, 2570001, -1866163, + 1432909, 5133560, -2702071, 1681480, 2768107, -1762010, 1302449, -643171, -981937, 2095944, + 2124935, 890132, 1471026, 543850, 1473711, 282394, 326418, 2476049, -1629940, -501974, + -544387, 544924, 1871532, -1535988, 1184874, -486942, 2316061, 210990, -2222109, -412317, + 1104880, -446677, 796180, 521839, -529355, -851477, + }, + { + -421981, 33929704, -5997385, 8229694, 9929428, -1296006, 4783520, 2108829, -6881075, -4426501, + 7240241, -2981244, -5334350, 8051990, 19224810, 8607651, -9263171, -10003516, 343061, 16360604, + -2297271, 3478387, -12481175, -339839, 3673271, -19408958, -8283382, -4157528, -9814537, 12805982, + -19658602, -8730595, 8547522, -814433, 12178380, -2776160, -16139413, -1766305, 3597035, 1489280, + -5767604, 4995047, 2230699, 7566659, -4504884, -1298691, 2651069, 3218541, 2705830, 6272263, + -8032663, 5544803, 1766305, -1730872, 2833605, 2729989, -2663417, 857383, -637266, 333397, + -222265, -2238215, -476205, 4242891, -3817689, -25233, 977105, -1108102, -2188286, -1465121, + -2571612, 479963, -3332358, 65498, -925565, -1109175, 1159104, 3821984, 2415382, 599685, + 1546725, -581431, -2202781, 772020, -39728, -1027571, 943282, 1474248, 781684, -335544, + 415001, 1566053, -306016, -1013075, 1922535, -1594507, + }, + { + -10428717, 112048720, -2241436, 78006808, -4555887, -9418326, -492848, -12322261, -2214056, 1964948, + -14054207, -5851893, 8572755, -14697378, -15470472, -2349884, 5437966, -9571871, -8099235, -9190693, + -9103183, -3381213, -4408784, -4479114, 3435974, 2544231, 3901441, 4153770, 1800665, -3298535, + -3072512, -6722161, -14130442, -845572, -13458817, -1625108, 3000035, 8297877, -3748433, 4605279, + 106837, -4372814, -3066607, 4906464, -2309619, 5306969, 1222455, -4184909, -2752000, 1697049, + 1794760, -5849746, -4473746, 399969, 1447404, -3592203, -2149631, -588947, 3572339, 1173600, + 328028, -1965484, -1128503, -5039608, -6055367, -3570729, 4196183, 1661079, 3741454, 787053, + 404264, 643171, -221191, -5705327, 2426657, -1207423, -4603131, 546535, 2670396, 97174, + 240518, 1722282, 2930242, -1166621, -2172180, -590558, -37581, 223338, -1461363, -292595, + 546535, -736587, -478352, -565862, 777389, -70330, + }, + { + -1543504, -35333084, 625992, 5914707, -6172405, 12646531, 7489349, -15818901, -11777874, 11952894, + 2210835, -5677410, -860604, -4839892, -5037460, -5793374, 7019051, -1979443, 2186138, 10092636, + 4891968, 2148021, -10450192, -3716221, -4349192, -5114769, 1082332, -1235877, 460098, 14126684, + -8304320, 3882651, 16652125, 2434173, -13422847, 1412507, 7939784, -552977, -1705639, 15873662, + 12642773, -2653753, 191126, -7859254, -838592, 2212445, 1793149, -1918777, -468688, -4645007, + 2850248, 1527935, -2811056, -2939905, -970126, -9575093, 585189, -545998, 1571421, -464930, + 964220, 52613, -1914482, -3038153, 2238215, -841814, -1072131, 475668, 2434173, 731755, + -785442, -748398, 2484102, -20938, -127775, 2106682, -2381023, 1115618, 4051765, 4801237, + -1429150, -870805, -654983, 2461016, -1648194, -508417, 1151588, -267362, -749472, 645319, + 591095, -1824824, 1666447, 314069, 405338, -827318, + }, + { + 9378598, -138181984, 11348377, -2073932, 11179800, -30580704, 43831752, -2158221, 2929705, -19864, + -666257, -3810710, 24065238, 4854924, 12892418, -13875429, 13959181, 855235, 3692061, -6532646, + -192737, -3167539, 6241125, 2833605, 4291746, -6134824, 6231461, -6704444, 8701604, 13383655, + 87510, 6002754, 1357747, -10098542, -7217156, -2542084, -7795366, 1975148, 4515621, 754304, + 8508330, 5165235, -1923609, 121333, 2565169, -5415954, -4744865, -6473053, 2501282, -5563594, + 2748779, 1348620, 538482, -4674535, 1054415, 2448668, -712965, -791348, 260919, -2905009, + 4857071, 1329829, -2884608, -3756486, -1520418, 1041530, -1467805, 2334852, -362388, -133681, + -778463, -80531, -2178622, 727460, 1808181, 1213865, -1067299, 440771, 1516660, 868657, + -2708514, 39192, -1478006, -2180233, 274341, 2410551, -1419487, -1188632, -91268, -461709, + 1027571, 335544, 599148, 689342, -1816234, -495532, + }, + { + 1069447, -34568044, 372588, 4169340, -4484483, -1101122, -12209518, 3663070, -1101659, 2945274, + -16574279, 6487548, 5913096, 13695577, 17222282, -7846369, 8925479, 15192910, -19535658, -4323422, + -2129230, -103616, -2972117, 1368484, 18375480, 392453, 10694469, -2053531, -10070088, -4884989, + -7886634, -5658620, -11026792, 10128070, -574452, -6025302, -221728, 5311264, 2401961, -2718714, + -2579665, -835908, 4722854, 4481262, -716186, 5891622, 428423, -5940477, -1496259, 292595, + -2330557, -3368865, -3043521, -327491, 1352915, 5790690, -6951942, -15032, -1412507, -2608119, + 489089, 332323, -565325, 1843615, -671089, 1990181, 271657, -1880122, 2338073, -1073742, + -808528, -192200, -1737851, 2924336, 974421, 755377, -1226213, -1005022, -1175747, -327491, + -2348810, 3328063, -706522, -2595234, 944893, -1334124, 748935, 1568737, 675384, -1284195, + 659278, 798327, -641561, -1722819, -712428, 1522566, + }, + { + 18575734, 2554432, -10027675, 12652974, -5210869, 25620016, -6183679, 12804371, -1899449, 4966056, + -19053548, 9561134, -20956756, -13787919, 40802, -5761699, -347892, 11767137, -6208375, 4330401, + 10129143, -567473, 8382166, 2857227, 1991791, 7668127, -4501663, -1872069, 3509525, 1265942, + 6907918, -11630771, 13108777, 2379949, -3748970, 869731, 4981089, -732292, 6228777, 1765232, + 8035347, -165893, -2451890, -4509179, -3322694, 1242319, -1909650, 188442, -9643812, -1247688, + -4622459, -1807108, 4687957, 3934190, -3011846, 4612795, -674310, -2349884, -763430, -1642288, + -3013457, -1341640, 665183, 537408, -2245731, 1851131, 1991791, -4879620, -5364414, -1964411, + -2816962, 49392, 61740, -1007707, -431107, 1359357, 2647847, 2020782, -1559073, 306553, + 2317135, 1353989, -557272, 1356673, 534187, 214748, -389231, -203474, -2747705, 1374390, + -92879, 455267, -1080721, 763430, -725850, 485868, + }, + { + -3101503, 27545772, -5514738, -374199, -6332393, 5761699, 11090679, 2708514, 6798933, 2262374, + 381178, -3194919, 4417374, 53789096, -36862092, -381715, 13995151, 16452409, 4672925, 12570296, + -6505802, -7532299, -2937221, -9759239, -17507898, -3843996, -3517578, -6373195, -4398047, 3607773, + 1002875, 9114457, 31675, -1607928, -3949759, 141197, 2799245, 4205310, -2893734, 2005213, + -1126355, 1018444, -410706, -3934190, 1785633, 1666447, -3962644, 1426466, -3385508, 4362076, + 1207423, -139586, -5724118, -9613747, -7316477, 2279554, -1730335, -1027571, 3538516, -1576790, + 3272765, -657667, -4228396, 3975529, 4833449, 197569, -4472672, -521839, 3008625, -284542, + -727460, -1640141, -3426847, 890669, -3103114, -210990, -1375463, 1696512, -1888712, -308701, + 1950989, -368830, 1433445, 1197759, -698469, -690953, -721555, 1168768, 2121714, 459562, + -1670742, 1085553, -1421634, 570157, -18790, -1372242, + }, + { + 9534291, 45748380, -3171297, -30621506, 2518462, 19943144, 13248900, 4379256, -5323612, 5367636, + -3631932, -1022202, -17037062, 3813931, 45746772, 7330436, 4153234, 16689169, -1221381, 10007274, + 1100049, 132607, 5122822, 2209761, -8138963, 7136625, 11238319, 2943126, 2712809, -12229919, + 2956011, -11684995, 1369021, -1809792, 4938139, -7378754, 7552700, 571231, 3330747, -2165737, + 6686727, -203474, 13225278, -1937030, -3674345, -3209951, -5120138, 2335389, 2976412, 2819646, + -3413425, -1751810, -5228586, 5601174, -630823, 3868155, 3559454, 821413, -2244657, -3992172, + -2487323, 269509, 4029216, 799938, -5014375, 821949, -49929, -2186138, -903554, 940598, + 813359, 575526, 434329, 3875671, 595927, -824097, -1719598, 329102, -35970, -1965484, + 1418950, -630286, -871342, 1611, 478352, 505196, -1557999, -326954, 1537061, -3134789, + 1592896, 1295470, -501437, 835371, 1006096, 887985, + }, + }, + { + { + 1968169, 37911676, -4532264, -9005473, 26009786, -527744, -6450504, -3251827, -9100499, 3974992, + 121333, -7848516, -1990181, 9692131, 230318, 9660455, -3808562, -6896107, 1801202, -1799054, + 16534550, 540092, -3971234, 8573292, -11667816, 3116536, -11417634, 6971806, 119185, 2092186, + -9789304, -10280004, 3294777, 1168231, -3717831, -3165928, -595390, 6702834, 690416, 1526324, + -3039226, 6607271, 9147207, -4114042, 2869038, 2019708, 6680822, 7039452, -2786360, -2453500, + 2841658, 3192771, -2957622, -680752, 5657546, 1445257, -5505075, -486942, -93416, 1533303, + 3223373, -2455111, 121870, -1436130, -811749, 477815, -3196530, 3380139, -753230, 1131724, + -1419487, 1947768, 3417183, 31139, -1329292, -872415, -418759, -2152316, 218506, 2163590, + 69793, 3227131, -1469416, 861141, -304943, -1907502, -692027, -354872, 1432909, 1196685, + -119185, 781684, -624381, 639950, -727460, 513785, + }, + { + 2043868, 190358320, 19965156, 53814868, 9767293, 7145752, 15769509, -68719, 13427142, 9983115, + -3948149, -36134632, -2856153, -4949950, 11701102, 4573067, -10218264, -8599061, -4228396, 1970316, + 2168422, -2491618, 3116536, -4400194, 1648731, 2505577, -1122597, 3524558, 7756174, 610422, + 217433, 1875827, 4038343, 8754217, 809601, -4034585, -5551245, -2199560, 1954747, 3299609, + 361851, -5061619, 5430986, 649077, -2862059, 2594160, -4740570, 2234457, 2705830, 7416872, + -2811593, -749472, -1264331, -6621229, -3409130, 2083596, 1294396, 2772938, -5081483, 1177895, + -4205847, -469762, 1946157, -856309, -367220, 4143570, -4224101, 1160715, 1177358, 1297080, + -2066416, 348966, 1671279, -763967, 1819992, -3602941, 482647, 1051193, -945967, 205085, + 329102, -1549410, -180389, 556198, 1320703, 1898912, 1435056, 505732, -1351304, -796716, + 882616, -8053, 1695975, -381715, 1405528, 625455, + }, + { + -5552319, -112415400, 12339441, 614180, -30407832, 6821482, 7882876, 8053601, -2807835, -4105989, + 858993, 34320008, 9681393, -367757, 13808857, -1073205, -628139, 2590939, 15553150, -8288750, + -9208410, 11718281, -3153043, 6745783, -9116605, -7006703, 557272, 2678449, 3509525, 3671660, + 3291556, -2877091, 8829916, -3952981, 2847027, 12119324, -15141907, -7611219, 5107253, -5009006, + -8479339, 445603, -2865280, 3971771, -547608, -1219234, 2833605, -2713346, -8000987, 5338108, + 2530273, 1678259, -411780, -4627291, -1399086, -4550518, 1205275, 1878511, -418222, 4035122, + 1439888, -4735739, 566399, -3746822, -2047089, -4308389, 5178120, -2215130, 336081, -301721, + -682363, -3452617, -2229088, -2884608, -2083059, 62277, -1041530, 2469606, -1343251, -2334315, + 2469069, 1768990, 410706, 1255741, -296353, -518080, 1555315, -103616, 1332514, -84289, + 1049583, 1313186, -472983, 316754, 70867, 772020, + }, + { + -1738925, -12582644, 13608067, -7244536, -1539209, 739808, -776852, 6194417, 1437740, -1551020, + 5077725, 2035278, 7235946, 2081985, -15410880, 10093710, -327491, 7127498, 8577050, 201863, + -162672, -570694, -11989938, 4136054, -8300025, -10224707, 12409771, 4723927, -1897839, 8964134, + 5495948, -2406792, -5129802, 6449967, -5009006, 17813914, 5609764, 716186, -13236015, 8624831, + -6301791, 4864588, -2016487, -1071058, 620086, -3809099, -99858, 66035, 3848828, 550830, + 1358820, 2027225, -1341640, 1242319, -1543504, -3747896, -1136019, 1289027, -656593, 3260954, + 4136591, 1395328, -1594507, 2161979, -5103495, 1642288, 2437394, 507880, 3160022, 1200443, + 1476932, 2259690, 3123515, -4245039, -1086627, -215822, 2146410, 285078, -1242319, 1782948, + 2654290, 263604, 588411, 1415192, -960999, 1360968, -23085, 2848100, 383326, 251792, + 548682, -553514, -673236, 834834, 1368484, -575526, + }, + { + -3909494, 33703144, -1854352, 47809964, -3721052, 681826, 10075993, -893353, -3822521, -9172976, + -23154706, -8981850, 8323647, 1773822, 10201084, 14192719, 3877282, -12841952, -16895864, -12072079, + -17943836, 6387153, -6908992, -15352361, -1883880, 12537546, -8931384, 2095407, 2037962, 7201050, + 6485938, -8090108, 2435783, -6364068, 9419937, 2528125, 3204046, -8602283, -10514080, -78383, + -1028108, -1319629, -1039919, 5218386, -2008971, 1001264, 10307922, 4211216, -6298570, 2554432, + 638340, -5754720, -4565550, 1323387, 6379100, 1122597, 770947, 2684, 783832, -2794413, + 549219, 4216048, 4854924, -892279, -5370320, 1874216, 928250, 209380, 999117, 1912871, + 1115081, 1189706, -1282048, 179852, 339839, 3099893, -1791001, 259309, -2743947, 209917, + -1695438, 838056, -126702, 1279363, 71941, 1350230, -1261647, -317828, -1722819, 1067836, + 303869, -104153, 1204202, 640487, 387084, -644782, + }, + { + -1373316, -16004122, 339839, 7123204, -2927020, -1862405, -465467, -1392643, -1382443, -2610266, + 4105989, -7655243, -1372242, 947577, 47097000, 2542084, -4096862, -8375723, -7882339, -11644730, + 7408819, 8273181, -3763465, 321586, -1007170, 2346126, -10525891, -4232691, 3769908, 6846715, + -10441065, -12406013, -7394860, 191663, 4511327, 6722161, 1648731, -2697240, 188442, 995896, + -6111739, -5514738, 549756, 2194728, 3130494, -3677566, -1731409, 1661616, -1845225, 3861713, + -579284, -284542, -1587527, 6015102, 195421, 284542, -2462090, -176631, 1912871, 4577362, + -1824824, 2353642, -1449552, -4614943, -1217623, 662499, 1369021, -606127, 818728, 4217121, + 155156, -785979, -51003, 1130113, -624918, 714575, 1160178, -3420405, 750546, 529355, + -40802, -529355, -3211562, 1169305, 113817, -1472100, 1071594, -856846, -1795833, -1888175, + 776315, 1480690, -100932, -892279, -1088237, -296353, + }, + { + -16930762, 62250184, 4119411, 61998928, -7750806, -2100776, 13135621, 15557982, -7445863, -81068, + -775778, -1195075, 16988744, -2486786, 12572980, -746787, 399969, -17035450, -2564096, 2578591, + -8250096, 17197050, -2343979, 6101001, -11489574, 583579, -9670119, -9658845, -1253594, 2623151, + -7415798, -5150740, -4695473, 1695438, 4532264, -4377646, 2816425, 3879429, 2316061, -42413, + 488016, 6083285, -168577, 719944, 1652489, -3755412, 732292, 1500554, -6739878, 2369748, + 1025423, -4471061, 7959648, -1160178, -2717104, 2579665, 2459943, 959388, 2706366, -2911451, + -63351, 1512902, -4191351, 537408, -2104534, -3431142, 3576634, 2316061, -461709, 919660, + 1095754, -818728, -1127429, -94489, 1459752, -1144072, -1007170, 697932, -173409, -602906, + -1372242, 249645, 2093260, -215822, 2438468, -2360622, 233002, -214212, -845035, 1240709, + 756451, 397821, 1480690, -238371, 169651, 93416, + }, + { + -2711735, 17519172, -12557948, -3876745, 560493, -1733556, 2874407, 261456, -6416681, -200253, + 12243878, 2004676, 102005, 8318815, 17634598, 436476, -12725988, -2833605, 6044630, 17535814, + -5937793, -2528125, -10725070, 6803765, 9325985, -17665200, -15278272, -51003, 1313186, 4895726, + -19978040, 5728950, 14353244, -958851, 9526774, 3604015, -7941932, 9479530, 7072738, 1536525, + 927176, 3544422, -5557688, 2753611, -5711770, 1023276, 4788889, 2146947, 3863860, 4685273, + -8771934, 3183645, -4057670, -4843113, -386547, 488016, -2783676, 826244, 2334852, 3473555, + 1821066, -1408749, -2074469, 4095251, -775242, 2535641, 754841, -1152125, -142271, 244813, + -2794413, 99858, -4217658, -867047, -336618, -822486, -923955, 1207423, 2092723, 932008, + 2269353, 1185411, -1091995, -587337, -1366337, -820876, -186294, -425202, 1181116, -54761, + 589484, 270583, -823023, -595927, 1435593, -886911, + }, + { + -6248641, 131025496, 8307004, 64698312, -11713450, -2466922, 11022497, 7632157, 12740484, -4081293, + -5101885, 6858526, 18210124, 6923488, 5624260, -3192235, 8312909, 7296613, -2457258, -882616, + 3313567, -1205812, -9253507, -6403260, 8113193, 2435783, 2951716, 3474629, 1485522, -4781909, + -1080721, 5573257, -818728, 5493263, -6925635, 3522947, -214212, 5313412, -8734890, -4616553, + -4148402, -2544768, -1814087, 1715839, -1910187, -682363, -5982353, -1413044, -6108517, -9667971, + -3322157, -5745056, -3364570, -2191507, 383326, -1597728, 1557463, 1762010, 6014565, -345745, + -2086280, -554588, 129923, -5061619, -3642132, -3672734, 1132261, -1881196, 99858, -2398202, + -313533, 866510, 180389, -5648419, 1110249, -376883, -3077344, 658741, 1665911, 1799591, + 2071248, -68183, 2025614, 605590, -1347009, 831076, 539555, -773094, -2012192, -586800, + 998580, 459562, 885837, -1382443, 260919, 934155, + }, + { + 1586990, -54997592, -28629178, -741419, -5719286, -5528160, -7774428, 404264, 4170950, 17575006, + 7827041, 10302016, 15638513, 3261491, -7874286, -4093104, 4337917, -6876780, -163746, 6263673, + 8216273, 9709310, -7204271, -2163590, 7233799, -2127620, 4918275, 383326, 1096290, 10025527, + -13135621, 7833484, 10185515, -6476811, -7614440, 637803, -5172215, -10158671, -5240397, 4757750, + 5602785, -3107946, 2543158, 294742, 2148021, -420907, 464930, -2334315, 6025302, -3461207, + -3718368, -5238250, -4474819, 1283658, 1872069, -4798016, 317828, -2155000, 2346126, -2415382, + -1176284, -1675574, 943282, -1379758, 335544, 563714, 55835, 312996, 37581, -408559, + 111132, 501974, 2575907, -1846836, -2474975, 1105954, -1454383, 922344, 850940, 3482145, + -1239635, 1206886, 626528, 492848, -3278671, -2098092, 635655, -607738, -2147484, -1694902, + 104153, -2057289, 118112, -6442, 703838, -840740, + }, + { + -5980205, -139731936, 45206680, -1411971, -5456756, -49499500, 32278290, -149250, 6321655, 10017474, + 1934883, -6897718, 7009924, -18486612, 4617627, -7385197, 19434728, 17863306, 10460393, -9979893, + 817118, -1802813, 4183835, -1907502, 606664, -3748433, -1609539, -10846403, 1483911, 8199630, + -1314260, -646929, 3020973, -7752953, -3875671, 7271380, -3813931, -1479079, 4377109, 1940252, + 4562329, 3564823, -574989, 2588255, 1893544, -4181688, -816044, -7854959, 2739116, -1820529, + 2824478, -4179540, -2121714, -1287953, 3544959, -1661079, -3375844, -3792993, -828929, -2126009, + 1156957, -1762547, -2807835, -779000, 1050656, 3618510, 647466, 114354, -222265, 1453846, + -900869, 97174, 192737, 102005, -603443, 337692, -2452963, -469225, 1319092, 2936147, + -1350230, 49929, 165893, -1321239, -6979, 594853, -1718524, -1282048, 409096, 570157, + 10737, -2160906, 17180, 2058900, -421444, -511101, + }, + { + -1327682, -39150236, 4840965, 12226161, 4460324, 2974802, -9696426, 6118181, -1885491, 1754494, + -14452028, 1859721, -11251741, -7623030, 17785996, -15380278, -4456566, 5594195, -24794310, 245887, + 5706938, 709207, -11274289, -9019431, 6000070, 3786551, 15280420, -3211025, -4338454, 1287417, + -3863860, -2656974, -8159901, 13437342, 1064615, -5509906, -8092256, -14960982, -9542880, 622233, + 8625368, 1243930, -6057515, -1892470, -1290101, -417149, -1559610, -2149094, 901943, 2597918, + -2253784, -2638721, -637803, -48855, 1445257, 4858145, -4409858, 7926362, 5739150, -248571, + -3961034, 1296006, 1357747, 1923609, -1444183, 906775, 2546916, 432181, -206158, -1192390, + -559420, -626528, -2229625, 168577, 1047972, 2602750, -2492155, -1002338, -45634, -1358283, + -2350421, 1923609, 129386, -1954747, 1074, 651224, -685047, 774168, 1023813, -668404, + 1034550, 210453, 158377, -244813, 188442, 1382980, + }, + { + -21053930, -43906912, -5141076, 13419625, -5768678, 12824235, -19304804, 11777874, 11429982, 8313446, + -32901060, 13128641, -528818, -2323577, -4547297, 6934225, 11145977, 3482145, -11036992, -3953518, + -4706748, 120796, 1530619, 5983427, 4866735, -9746891, -11754252, -7631620, -13146358, -2927020, + 11684459, -19792284, 3668976, 6894497, 2759517, 4271882, 6704444, -5047661, -3759707, -6059662, + 10828149, 9089225, 214748, -1195075, -1299228, 5781026, 3727495, 4352950, -8021389, -3432216, + -4692789, -4971962, -1461900, -2150705, -9393630, -4656819, -5142150, 663572, -347355, 417149, + 1641751, 1443109, 3381750, 901943, -3313031, 3219615, 5389647, -2838974, -5375689, -1878511, + -1859721, 2456185, -615791, -2731599, -904091, 685047, 2721399, 238908, -1054951, 1816771, + 1870995, 2404108, 760746, -244276, -1586990, -296890, 305480, 625992, -3149285, 624381, + 97711, 733903, -11811, 75162, -2069101, -1534377, + }, + { + 4138201, 42913164, -3671123, -1762010, -1622961, 6845104, 6645925, -1412507, 2956011, 3004330, + -5439039, -2841121, 7779797, 20439212, -67007932, -4454955, -1279900, 13670881, -12694850, -9570261, + -726386, -336618, -3684008, -6093485, -12217571, -1400696, -6636262, 3034931, -6308233, 2675228, + 6168110, 13154411, 2318746, -1701881, -308164, 12177843, 5961952, 1461363, 940061, 1624035, + -4561256, -1974074, -3990025, 1930588, 2905009, 1103807, -2336999, 2909840, -2440615, 4736812, + -149787, -2331094, 4706211, 609885, -4769561, 4710506, -1805497, 2366527, 3751654, -5228049, + 494458, -930397, -757525, 7543037, 3479997, 1462973, 1558536, 2719251, 4872104, -1849520, + 315680, 3696356, -600222, -366146, -5037997, 1801739, 989453, 830539, -4259534, -1083942, + 646929, -55298, 1240172, -938987, 550293, 2238215, 2041183, -521302, 1780801, 2232846, + -3424163, 1162862, 430570, 1600412, 1449015, -1263257, + }, + { + -18571976, 20185272, 23265838, -19611894, 1984275, 6010270, 2138357, 3511136, -8849243, 3805878, + 8041253, 56908, -17197050, 5804112, 43861280, 3751654, -4489315, -3002719, -20086488, -972273, + -7985418, 8307004, 9951976, -2763812, -10166724, 7095286, 1200980, -10549513, -6053757, -11759084, + 467615, -12057584, 7892540, 3684545, 3322694, -6953552, 3790846, -255551, 5687611, -6649146, + 941135, -4385162, 8241506, -2158221, -5989332, -4930623, -7961796, -4825396, -6809134, -2153926, + 315680, 1530619, -8202851, 7866770, -456340, -2813204, -964757, 2715493, -836445, -5869610, + -1613297, 3534221, 4475893, 1739462, -803696, 2017024, -748935, -75162, 373662, 1504312, + -1080721, -753767, -1539209, 796716, -630823, -1772211, -1865626, 1338956, -492311, -2198487, + 2251100, 323196, -1550483, -460098, 282931, 345745, -307090, 23622, 1640678, -1242319, + 2159832, 1525787, 426276, 540092, 525597, 752156, + }, + }, + { + { + -1199907, 7886097, 16495896, 28274306, -13778255, 2535641, -5597416, -2557116, -6295885, 2521146, + -4835060, -9968619, -2599529, 8355322, 13087839, 2055679, -24565066, -5636608, 13564580, -2028835, + 10472204, -700080, 1357210, 7126962, -10522670, 5951214, -17942226, 11729556, -2926483, 579284, + -1867237, -13240310, 4105989, -157840, -2047089, -2152316, -4002373, -586800, 7627862, 1280974, + -3193308, 8779450, 4784057, 761283, -2507724, 1359357, 15099494, 3252364, -6762963, -635118, + 2178622, 7406134, -4677220, 4603668, 6056441, -828392, -4988605, 1851131, -1945620, 2644626, + 485868, 1277753, -329639, -3833258, -507343, -1291175, -813359, 1253594, 1804960, 2491081, + -958851, 1984812, -2177549, 4112431, -2149094, 295816, -995896, 1142998, -2859375, 2081985, + 955093, 1661079, 1085553, 722628, -2377265, -1240709, 559956, 99321, 755914, 1229434, + 1115618, 302258, -66572, -1039382, 126702, 1016834, + }, + { + -3462818, 249409824, 2187212, 70927088, -11260331, 6198712, 8661875, 9023726, 8841190, -1926830, + 3474629, -25819196, -9657234, -1498407, -512712, 10708964, -249645, -9191230, 1978369, -2193118, + -2091112, -1735704, 4243428, 57982, -418759, -7662759, 1378148, 4013110, 12816182, -1719061, + 837519, 7128572, -3477313, 8341364, 5864241, -4898947, -1712618, -1343251, 1330903, 468151, + 2171643, -900333, 8242042, -5711770, -457951, -5917928, -267899, 5070209, 5833640, 2092186, + -790274, -280784, -318901, -9771051, 16643, 5735392, -5129265, -89121, -1833414, 386547, + -1059783, -1238024, 1818919, -560493, 2406256, 957241, 545461, -1645509, 274341, 1890859, + -1942399, 42950, 1624571, 628676, 907849, -177167, -826244, -1016834, -1848983, 222801, + 1910187, -1367410, -801011, 637266, 1017907, 1881196, 1999307, -1032940, -1611, -502511, + 853625, 1606855, 1026497, -807454, 926639, -259309, + }, + { + 6969122, -95834680, -19422916, -38830800, 15126338, -3598109, 10581726, 745714, 3488050, -10929081, + 1845762, 26203058, 9502078, 3372086, 2088428, 9710384, -3619047, 8428873, -3504157, 6136972, + -7858717, 1276142, 1722282, 5700496, -4150549, -7140383, -7691213, -1430224, 11709155, -4213363, + 8659728, 3791919, 1749662, -5579700, 9853192, -3940096, -1967095, -7144678, -3162170, 13959, + -6561637, -2842732, 2009508, 660888, 1985349, 1552631, 1235877, -2326262, -6861747, -243203, + 10529112, -2401961, -646929, -3711389, 501437, 742493, -1056562, -590558, -743566, 5078262, + 1184337, -5235029, -1990717, -3377455, -2230699, -1155883, 2410551, -2320893, -1891933, 1176821, + -759136, -3656628, -3164317, 556198, -1221918, 683437, 98247, -120796, -60666, -2468533, + 2093260, 1807108, 2022930, 3758, -149250, 229781, 1249836, -738734, 2037425, 740882, + 1481227, -172872, -502511, -1056562, 1867237, 1152662, + }, + { + 2202245, 3486977, -1862405, -3917547, -2212982, -1279363, 3240553, 2679523, 2372970, 3881040, + -3905736, 7507066, 4769561, 6272800, -16746614, -8552354, 13774497, 21826486, 7161858, -5820218, + -1112397, 3117073, -7027640, -13036836, 4173635, 7955353, 1184874, -2161979, 1427003, 3644280, + 7234873, -11740830, 8246874, -5359583, -2029372, 8735963, 17080548, -1000191, -2585570, -1609002, + 5118528, -1659468, -7670275, -1663763, 1889786, -592169, 23085, -442382, 5620502, -732829, + 1078037, -3764002, 3271691, 4721243, -4444218, -1515587, -2603287, -1344862, 1950989, 1589675, + 3318936, 1078037, 1034013, 1173600, -1270774, -227633, 2647847, -2242510, 3655017, 2490544, + -658204, 3530463, 1192390, -522912, -2699387, 1877975, -100395, -676457, 515396, 545461, + 1715303, -226023, 864899, 410169, 404801, 311385, 1860795, 2661806, -663572, 569620, + 2268280, -725313, -1168231, 749472, 921807, -1565516, + }, + { + 16281684, -4242891, -4405026, 45101452, 6790344, -949725, 2449205, 3577708, -9620727, -3874061, + -27844810, -10298795, 21056078, -4854387, 17097192, 9424769, 157840, -14992657, -15583215, -19238232, + -5622112, -3777961, -15333033, 1901597, -6686191, 9805947, -11553462, -935229, 5279589, 10900627, + 72478, -375810, -2395518, -5818070, 2012729, 10401874, -10646150, 10102837, -13162464, -2719788, + -3720516, -423054, -1644973, 4444755, 4254165, -4584878, 8621610, 3872450, -4127464, 1575716, + -1481764, -5590437, 890669, 1151588, 3719979, 1568737, -1519345, 1429687, 175557, 2102923, + -7478075, 4352950, 4361540, 1842004, -5651103, 6104223, -4481799, 2564632, 2299955, 1038308, + -1443646, 1797444, 2018635, -330176, 756451, -780073, -1051193, -1029182, 591632, -2018635, + 418222, 234076, 1648194, -2603287, 3017752, 1611150, -767725, -2120103, -2029372, 1191317, + 215822, -841814, 1434519, 1508070, -1154809, -85362, + }, + { + -102005, -25512106, 1700270, 6191196, -492311, -1865090, -1006096, -1273995, 25233, -2863133, + -1121523, -3721589, 2967823, 10693395, 26499948, 2380486, 820339, -4330938, -6171331, -3749507, + 9607842, 4126927, -6666863, -878321, -4808216, 1174674, -3857954, -15037217, 12844637, 3204046, + -5567888, -3602404, -10897406, -3006477, 2230699, 10728828, -3965866, -5055714, 3999688, 305480, + -7907572, -3994857, 1196685, 3711926, -858457, 2782602, -4380330, 1319629, -1880122, 1455994, + 1409286, 118648, 3070365, 3405909, -2895345, -1965484, 2505577, 27380, 4567161, 456877, + 1241246, -348966, -935766, -4748623, -375273, -270583, 1316944, -3376918, 4607426, 1111323, + -1312649, 1629940, 468151, 1443109, 10737, -891743, 1748589, -2440078, 1059246, -777389, + -90194, -466541, -3187403, 852551, -242666, -1034550, -172872, -264141, 146566, -1287953, + -535797, 842350, 665183, -1983738, -457951, -411780, + }, + { + 32663226, -14175540, 7279970, 51556252, 8069170, -3136937, 6932077, 10026601, 8668855, -9522479, + 13014825, -2215130, 13817984, 4036196, 7700340, -5799817, -11963631, -16536698, 3056943, 4781909, + 573378, 926639, 6507413, -9496173, 3059091, 4232154, -5845451, -13984950, 2002529, -3311957, + -3274913, -5822902, 1285269, 1129040, 4338991, -2986613, 733366, 3464428, 692027, -1186485, + 3924526, 1680406, 2312840, 4157528, -577673, -5636608, 10902774, -3114388, -7735773, 823023, + 2805688, -4302484, 4868883, -876173, -343061, 657130, 2982855, -485331, 2735894, -1072131, + -1851131, 1072131, -6721087, 4207994, -4268661, -363998, -1256278, 4185983, 174483, 62277, + 1487132, -584652, -1183800, -1116692, -82141, -602369, 380641, -92342, -392990, 422517, + -417149, -904628, 453656, 1788317, 315680, -2119030, -416612, 86436, 462783, 2695092, + -446140, 1006096, 385473, 176631, -115427, 905701, + }, + { + 796716, -15107547, 4886599, -5568425, -4010963, 1586990, -1044214, 1007707, -5366025, 1875290, + 7873749, 4796942, 11591580, 9006546, 100395, -8793409, -2477659, -4835597, -759672, 17357036, + -2644626, -9983651, -3398930, 255014, 8901857, -19689204, -13092134, 5095442, 12569222, -6442988, + -18059800, 15380278, 805843, 4125316, 6839736, 359167, -9689983, 17185774, 1671816, 231391, + 8658654, -5993090, 5578626, -6476274, -2182917, 1911797, 4212826, 790274, 2586644, 5776194, + -4406637, -2128156, -2647847, -3869229, -1135482, -316754, -3543885, 2726231, 1093606, 4716411, + 1134945, -8590, -1043140, 2482491, 3119757, 2189897, 675384, -1355599, 354335, -144418, + -5858873, 504659, -797790, -2632278, 429497, 339839, -890669, -438087, 1722819, 1535988, + -76236, 1230508, 932545, -2512019, -306553, 168041, -550293, -1652489, 769336, 227096, + 768799, -1627793, 613107, 1263257, -796180, -484794, + }, + { + 28493886, 101802536, -13259101, 59931972, 15812459, -10063108, 7876970, 7633231, 21943524, -10306311, + 11698954, -3141232, -2008434, 13982803, 13329968, -2908767, 9681930, 2400350, -3979824, 4640176, + 6714108, 2001455, -8509404, -4626754, 13365401, 2631741, -3440806, 707596, 1188095, -1669669, + 6937983, 3709241, -1790465, 5060009, -773094, 622233, -3161633, 3961034, -280784, -11562052, + -9654550, 1413581, 4376035, -1080184, -7387344, -768799, -2874944, -3894999, -1822140, -10906533, + -5596880, -3926674, 2809982, -8086887, -3413425, 83752, 559420, 2713346, 2271501, -836445, + 952946, -384400, 2517925, -4654134, -5449777, 105227, -3851512, -1611150, -442382, -3107946, + 2704756, 374736, 483184, -3744138, -2367064, -21475, 43487, -1784022, 1180042, 3168612, + 4172024, -1000727, -457414, 4139812, -2453500, 684510, -651224, -1539209, -331249, -1003949, + 424128, 758599, 867047, -1023813, -144418, 1203665, + }, + { + -610422, -53592600, -23914914, -5643587, 3255048, -16925392, -9746891, -2256469, 10953240, 11019812, + -2474438, 24508158, 11791833, 12558484, -10232760, -6284611, -8201240, 5543192, 5372467, -7624104, + 20554640, -2226941, 5018670, -10273025, 14129906, -2276333, -1528472, 1818382, 7951058, 4604742, + -12702903, 3394635, 16649978, -11579232, -4922033, 4810364, -17810156, -2328946, 1282585, -6673306, + 1647657, 1561221, -1600949, 3917547, 4851166, -1009854, -1276142, -614180, 9406515, -4679904, + -6770479, -5966784, -4380867, 10380399, -4560182, 2124935, -591095, -570694, -1765232, -1258425, + 287226, -1600949, -871878, 2994666, -2429341, 2077154, -2410551, 507343, -1425929, 2094333, + 788663, -328028, -1483911, 2050310, -3307125, -1276679, 2273112, 853088, 627602, 1966558, + 30602, -601832, 277562, 402653, -2367601, -1379758, -243203, -869194, -2617783, -2726767, + 541166, -594316, -497142, -1403917, 798864, 613107, + }, + { + 2032056, -144386592, 38611220, -1897302, -16852378, 9129490, -15853261, 8146479, 1974074, 2428804, + -3100430, 11533598, -8829916, -7092602, -1382443, -6284611, 9250286, 27839442, -5365488, 1098438, + 3055332, 8267812, -4443144, -1365800, -10833518, 4930086, -4096862, -6170795, -10650982, 5172215, + 8638790, -10284836, 3765076, -5913633, -2072859, 6370510, 1859721, -5847061, 4939213, 6210523, + 430034, -542240, 2597918, 4350265, -2953864, -2226404, 70330, -4685273, -410169, -1356673, + -2034204, -3859028, -351114, -3388192, 4303021, -1661616, -2953864, -4398584, -278636, 2226404, + -4677220, -3405372, 1574642, -51540, 852014, 3022046, 1997697, -3663607, 1741072, 707596, + 1961190, -2010045, 3179887, -2573759, 843961, 887448, -2332167, -782758, -19327, 2164664, + 173409, 3221, -450435, -93416, 827318, -1365263, 149250, -1225139, -1307818, 1336809, + 54761, -1997160, 1254667, -418759, 575526, -893890, + }, + { + 2232309, -28723130, -3317862, 2042794, 13741748, 2742337, -4616553, -54761, 1418950, -5132486, + 649614, -8803072, -7850664, -19925428, 17279728, -7929047, 2425583, 3230889, -26272314, -7078643, + 11205570, -4500052, -13760538, 4622459, -647466, -1382443, 24089934, -5704254, -2594697, 7217156, + -10246718, 1533840, -6780143, 12552042, -1072131, -9139154, -1894618, -10424959, -14219563, 176631, + 12864501, 812286, -3937948, -6194954, 72478, -3628711, -7635378, 5179194, -2081985, 1947231, + -421981, -726923, 1577864, -2768107, 595927, -869731, 1678259, 8737574, 5877126, 2592013, + -5518496, 3572339, -1648731, 5720897, -2375654, -278636, 3469260, -1612760, -1014686, 1116155, + -884763, -2513093, -1925756, -729071, 2197950, 1152125, -2632278, -920197, 472446, -1042603, + -851477, 1611, -520228, 575526, -2891050, 1144609, -450435, 1385127, -726386, 1745904, + 565325, -1265942, 33286, 59593, 897111, 519154, + }, + { + 12639552, -90119688, -5200132, 26521424, -20492900, -17553532, 5561983, 2777770, 11700028, 8316668, + -25083682, 7031399, -739808, 12352326, -5753646, 576063, 18194018, -9137006, 1409823, -439697, + -17514876, -1307818, -3287261, 9118216, 1836635, -6217502, -9790378, -5852967, -17745732, 3704409, + 2962454, -9732933, -314069, 6904697, 7291781, 787590, 1450625, 1828582, -8197482, -1936493, + 1209033, 9769977, 5076652, -36507, 441308, 2674154, 4510790, 2326262, -2368675, -384400, + -9008694, -3184182, -2250563, -7999914, -5277978, -6430640, -7006166, 2225867, 423591, 3517041, + 63351, 3432753, 2217814, -976568, -513785, 4045859, 559956, -481036, -3120831, -709743, + -1884954, 2156611, -979253, -4274030, 934692, 216896, 1335735, 193274, -448824, 1275605, + 2181307, 1593970, 2858301, -934155, -2311229, -1407139, 2745021, -361851, -2914672, 311385, + 2102923, 130997, 211527, -2539400, -1073742, -1645509, + }, + { + -4067334, 53679576, 3758, -2449742, 3281355, 8425115, -6098317, 2529736, -4087735, 6272800, + -5890548, -4002373, 10846940, -35004520, 13346611, -11267310, -5273683, 6401112, -7779797, -8906152, + -10152766, -2379412, 8550743, -7100118, -14796162, 6680822, -9731322, 12773233, -19349364, 2316061, + 7303592, 9640054, 6914361, 6952479, -6919193, 12163884, 6191196, 1733556, 423591, -12538620, + 1900523, 1038308, -6483790, 3882114, 4450660, 1432372, 1484448, 2774012, -2367601, 4217658, + -1642825, -9039296, 8227547, -57445, 1168768, 5495411, -3804804, 601832, 96100, 673236, + -1478006, -1387811, 3093987, 4618164, -262530, 4236985, 1889249, 4158602, 2724083, 1678795, + -1882269, 4547297, 614180, -1591822, -2975339, 39192, 1321239, -261456, -2130304, -826244, + -1095217, 957241, 659814, 4295, -532039, 593242, 3505767, 496069, -1337882, 2760053, + -2116882, 326954, 104690, 1076963, 1923609, -1098975, + }, + { + 21107616, -31886374, 27006754, -17996986, -9289477, -5534066, 10402411, 5592585, 4794794, -10137197, + 17999134, -13991393, -6247030, 27954868, 3573950, -10216653, 10072772, -15424838, -1328219, -4807142, + -14323179, 14840186, 8181913, 5995238, -9927280, 4887136, -7598871, -13023951, -10088878, 8412230, + -7284265, -3534758, 1460289, 10211822, -7807714, -1511292, 2542084, 10857140, 3100430, -8037495, + -5504538, -6515466, 505732, 6174016, -8581345, -5835250, -6970195, -7952132, -5647345, -324807, + 4460861, 395137, -3633006, 3235721, 4406100, -4501126, -5738077, 76773, -678068, -3977140, + 1371705, -318364, 3915400, 625992, 3754338, -266825, -3401077, 2943663, 96637, 1312113, + -3753265, -2144263, -197032, 199716, -332860, -1751810, -2732673, 2024540, -1430761, -146566, + 2146410, -110059, -782221, -110595, 374199, -26307, 1191853, 17180, -860067, 938987, + 2410014, 39192, 1637993, -983548, 2198487, -320512, + }, + }, + { + { + 139586, -41724532, -25381110, 26025892, -16516297, -924492, -7022809, 3457986, 93416, -471910, + -7346005, -5614059, -5246303, -15149423, -8003672, -6157910, -18617072, 2636573, 11627550, -5375689, + 14341433, 6191732, -3392487, 2934537, -4625680, 6416681, -15915001, 6643241, -4880157, 1097901, + 4998268, 3629784, 9604084, -5265093, -1330903, -942745, -6283001, -3157338, 5806796, -359167, + -4268124, 2754148, 1708860, 1069447, -2491618, -1271847, 9303973, -2219961, -7855495, -1058173, + 3260954, 6965363, -2710661, 10137197, 4166118, -2098629, -1936493, 885837, -3969624, 2860985, + 90194, 4443681, 3902515, 1188095, 2466385, -517007, -1720671, -739808, 2835215, 5184563, + 2353642, 3095598, -3147137, 4918812, 273804, 3121904, -427886, 2190433, -195421, 2290828, + -281320, 421444, 1435593, 988379, -1046898, 413391, 1418950, -28991, -22549, -498753, + 1001801, 934155, 378494, -1722819, -946503, 122407, + }, + { + 6022081, 295972096, 29658360, 66723928, -12819941, -7683697, -8451959, -6227166, -4762045, -16382616, + -5943161, 1835562, 6888054, -10394358, -9528385, -677531, 2785823, 4505958, 10293426, 4811437, + 1852742, -3216931, 5369246, 7722351, 2580202, -4407710, -2250026, -3128347, 4708895, -3388729, + -85899, 2329483, -9675488, 881005, 3645890, -5360119, -464930, -251256, -155156, -1560684, + 3813394, -2721399, 6533719, -3034395, -1796907, -9422621, -954020, 2242510, 1281511, -2812130, + -3404835, -1499481, 3000035, -3218004, 3073586, 3411815, -8167417, -868120, -274878, 3600256, + 2648921, -1941862, 3812320, 5452461, 1401233, -1866163, 2344515, 581431, 3071975, 2561948, + -2014877, -1007170, 1053341, 1027571, -55835, 776852, 822486, 670552, -1134945, -468151, + 2159295, -1888175, -1771137, 440771, -652835, 150861, 969589, -781147, 1432372, 601832, + 795643, 1287417, 827318, -777389, 983548, -810675, + }, + { + -7383586, -46135464, 30711700, -44594644, 16874926, 661425, 5548024, -5476084, 3716221, -7759396, + -9813463, 5720360, -6358699, -7370164, 4147328, 12431783, -10427107, 10382547, -6867653, 1772211, + -10288594, -5290326, -4700305, -666794, 292595, 2667712, -4853850, 994285, 3335042, -16535087, + 7854959, 9698036, 1654099, -10379325, 4184909, -3697967, 13816373, 7929047, 5205501, -1098438, + -6203007, 4052302, 4410395, -217433, 3373697, -1838783, -4887673, 443992, -262530, 1214402, + 10113574, -4997195, -1064615, 55835, 3584150, 4142496, 731755, 429497, -230318, 3343095, + 432718, -3835406, -700617, -129386, 105764, 454730, 876173, -2341831, -2852395, -3469260, + 1329292, 110595, -397821, 4451197, 1451162, 3651796, 1254667, -2681133, -1808181, -3025268, + 15032, -435939, 2347200, -195958, -168041, 709743, 166430, -722628, 1901597, 303332, + 324270, -1980517, -83752, -45634, 1727651, 1331440, + }, + { + -2574833, 11496017, 8655433, 832687, 134218, -1144609, 3248606, -2239289, -496069, 2930242, + -5360656, 4290673, -429497, 608275, -18485002, -9192841, 13550622, 8470212, -4460324, 3631932, + 10760504, -1463510, -3723737, -2288681, 9325448, 17151952, 7203734, 499290, 564788, -10835666, + -1011465, -2841658, 9795210, 773094, 2039573, 1220308, 16523276, 2697240, 6284074, -1011465, + 6443525, -2645700, -9307731, -3784403, 2410551, 5708549, 328565, -3156264, 3127810, -3683471, + 2150168, -1665911, 1032940, -1658931, -2926483, 93952, -5641440, -3598646, 3574487, 2756295, + 1866163, 1337346, 1758789, 744103, 1532767, 2813204, 1335735, -4354023, -985158, -298500, + -914828, 2080912, -941135, -652835, -468151, 2013803, -904091, 363998, -265214, -1675037, + -218506, -995359, 1000191, 1667521, 582505, -1624035, 458488, 1924145, -180389, 267899, + 1516124, -544387, -553514, -67646, -118112, -612033, + }, + { + -25891674, -70017632, -3376918, 36766532, -7155953, -2370285, -4667556, 683437, -9316321, -10088341, + -2532957, 16321413, 13104482, -11316702, -23622, -3186866, 2171106, -14721537, -11017665, -15149423, + -3213173, -6352257, -11799886, 3853123, -8572755, 11542725, -7010461, 7984344, 10688563, 201863, + -8880919, 3093450, -6482180, -3336116, 3274913, 1149978, -14654965, 10778757, -9564892, 3024731, + 2440078, 5322002, -4042638, -2048163, 133144, -7599408, 1617055, -1057636, -211527, 839666, + -2858301, -3460670, 2785823, 195421, 1517197, -410706, -2689723, 761283, 363462, -838056, + -10506564, 821949, 1360968, 6264210, -4176319, 3783329, -4403415, 1021665, 202937, -1250909, + -2911988, 1731409, 2356863, -293132, -228707, -256087, 2736431, 292058, 879931, -2155537, + -967441, 78383, 3071975, -3786014, 495532, 1424319, 325881, -2749853, -1720134, 1219234, + -445066, -1052267, 1592359, 795106, -1016297, 863825, + }, + { + 1423245, -8196945, 9011915, 2012729, -781147, 275415, 353261, 36507, 1953673, -5152887, + -6948720, -4079682, 5302137, -4435091, 3294777, -7021735, 4631049, 8860518, 8342974, 7604240, + 7001334, -3459596, -924492, 7388418, -12000675, -6682969, 8027831, -12640089, 4689031, 1624035, + 9947144, 8390755, -10277857, -1725503, -3985730, 1137630, -6299644, -6250788, 2016487, -3706557, + -6959995, 4063576, 8054138, 9909563, 3161633, 4509179, -5364414, 1166084, -6652368, -535260, + 5683316, 1112397, 1953673, -2590939, -2334315, -679142, 3545496, 836982, 3202972, -1371168, + 1347009, -1349157, -671089, -2961380, 2614025, -428423, -1233193, -4105989, 4894652, 411243, + -1764695, 2609730, -656593, 1032940, 1546725, -341987, 2804614, -33286, 2513093, -1068373, + -789200, 264677, -2434173, -77846, 135291, 607201, 527744, -176094, 1132798, -375810, + -1606318, -98784, 1618129, 60130, 432718, -614717, + }, + { + -40080096, -140051360, -10832444, 42709692, 4855461, -1429150, -3599720, 11265162, 15219753, -6007586, + 28225452, 1239635, 6342056, 5963562, 2078764, 219580, -1699196, -8056285, -2227478, -1723893, + 4652524, -6918656, 7748658, 2574296, 15505369, 3095061, 1278827, 5369, 9536975, -1010928, + 3733400, 2441689, 6646999, -581431, 7110855, 3351148, -1316408, -1320703, -1364726, -1599875, + 1913408, -1370632, 1532767, 4174171, 5593658, -3512210, 3171833, -10060424, -5996311, -1531156, + 1207960, -3412352, -385473, -5846524, -1352915, 393526, 1242319, -3924526, 1089311, 196495, + -1711545, 6693170, -3327526, 4043712, 410706, 4620311, -2844342, 436476, -440234, 253403, + -919660, -710817, 642098, 18254, -178778, -333934, -301185, -1131187, -1392106, 1488743, + -218506, -2246805, 370441, 1550483, -1003949, -1337346, -55298, 313533, -651224, 2253247, + 340913, 300111, -871878, 609349, 889058, 1181116, + }, + { + 1998234, -15781857, -467615, -1028108, -2101313, 1352378, -2132451, 2006824, -3601867, -1271847, + -2166811, -1466195, 4394289, -3729642, -18211736, -9868761, 8510478, -8160438, -20373178, 1086627, + -10787884, -13723494, 11378979, 4635344, 4837744, -9463424, -5138929, -7084012, -3645354, -6973417, + -7241852, 9061307, -8193724, 739271, 861678, 4557497, -11487427, 4552666, -8713952, 249108, + 13174812, -8150774, 6364068, -4330401, -1341640, 579284, 6283001, 5893232, -2649458, 5797669, + 3088618, 3390340, 908922, -2516851, 1049046, 94489, -2331094, 5491116, -4993437, -3514894, + -124554, 4323959, -170188, 598611, 4467840, 2854543, 1626719, -2786360, -2371896, 1004486, + -3258807, 2938831, 3041374, -1171989, 1581622, 114354, -1376537, -1224066, 544387, 534723, + -1005559, -845572, 625455, -905164, 982474, 1923072, -503048, -2544231, 228170, 570694, + -552977, -1464047, 998043, -93416, -2273648, -1389959, + }, + { + -50927576, 34244848, 23307176, 66274568, 18968186, -4975720, 16915728, -8135205, -1266479, 446140, + 14747844, -7608535, -7100118, -2074469, 784368, -6179921, 1861868, -9155797, 865973, 4926328, + 7999377, 10185515, -4156455, -4332012, 8915278, 4123169, -3491272, -2975876, 76773, 2690797, + 11594264, 1025960, -10098005, 4738960, 9924059, 11681237, -6743636, -7165616, 6194954, -3512210, + -5618891, 9910637, 6966437, -4061429, -6021008, 176631, 1327145, 920197, -139050, -7554848, + -819802, -3227668, 2269353, -7258495, -1335735, -1393180, -5324149, -315143, 335544, 1239098, + 3624416, -1329829, 1629940, -1068910, -1851668, 2322504, -2672007, -620086, 447213, -2732673, + 2084133, -164283, 1401233, -382252, 514859, 1512365, 2321430, -1224603, 632434, 2832531, + 2954938, -1775969, -237834, 918586, -3441343, -670552, -2169495, -335544, 1836099, -223338, + -790274, -663036, -312996, -70330, 156229, 165893, + }, + { + -1390496, -52297668, -12945568, -539018, 1093606, -13879724, -3956202, -3639448, 5603322, 2728915, + -14527190, 10259603, 4530654, 12579422, -11620571, -5087389, -10147934, 2467459, 4885526, -22310208, + 120259, -6894497, 12640626, -2806224, 4714801, -3863323, 4684199, 6422587, 6598681, -1692217, + -7955353, 805306, 9112310, -3773666, 1375463, 9425843, -10073846, 1064078, 63351, -6569153, + 5454072, 3210488, -1418950, 5242008, -2103997, -5381057, -1546725, 3888019, 13675713, -1175210, + -1782411, 3460133, 2480881, 7421167, -8943196, 3357591, -1785633, -1097901, 1092532, 2709588, + 3246995, -1728724, -4085051, 5430986, -2812130, 387621, 621697, 2054605, -2152852, -693637, + -1258962, 162135, -3342558, 1409286, -1299765, -1960653, 1185948, -839129, 283468, 1397475, + 1663226, 324270, -229781, -64425, -1430761, 1016297, -325881, -1589675, -1996086, -1903207, + 46708, -360777, -645319, -1636919, 695785, -47245, + }, + { + 2097555, -171451872, 5058398, -4554276, -4037269, 26747982, -32433982, 1250909, 6053220, -5996848, + -7861938, 7248831, -10395431, 745714, -1830730, -8273718, 3134789, 27532888, -5655398, 2815351, + -1330366, 6267968, 4103841, -2537252, -14883135, 6897181, 85362, -4806606, -17423608, -6758131, + 4386236, -5110474, 2425046, -5565741, 9174587, 10768020, 39192, -6276558, -3355443, 4147865, + 4472672, -3234647, 4230006, 2688650, -10133438, -4019016, -48855, -2608656, 730144, -5959267, + -3216394, -2104534, -900333, -2035278, 5620502, -1837172, -3980898, 377420, 849330, 2525978, + -861678, 1548336, 3830574, -137976, 281857, 2600603, 3270081, -2416456, 2285460, -64425, + 196495, -1493575, 5429913, -1534914, 1554778, 1333051, -622233, 725850, 49929, 3195993, + 1115618, 472446, -230854, 898722, 736050, -198642, 2197413, -50466, -1734093, 265214, + 424128, -1544041, 748935, -2692945, 711354, 79457, + }, + { + -3378529, -23884314, 5222144, -965831, 4299263, -2377265, 142271, -755377, 2189360, 212064, + 9109089, -2973191, -6950331, -1082869, 28033788, -1990181, 11400991, 10873247, -12182138, -11387569, + 1195612, 12134356, 10937134, 10403485, 1753957, -13815299, 10248329, -1562294, -3895535, 3728569, + 668404, 12662637, -5783174, 10744934, -4020626, -11143293, 8269423, 3102040, -7834021, -214212, + 6831146, -5836324, -4911832, 925565, 4435628, -499827, -5939940, 4993973, -117038, 4177930, + -1641751, -3423089, -1195075, -4984310, 674847, -1580548, 2362232, 1889786, -1580011, 2846490, + -646929, 6732898, 995359, 2979097, -6546067, -2551748, 1679869, -2659122, -358630, 905701, + -1706176, -279710, 2808372, 1619740, 574452, -355945, -995896, -785442, 964757, -158377, + -1005559, -1420024, -3031173, 541166, -2092186, -380641, -2133525, 917512, -2341831, -1065152, + -585726, -893353, 440771, 430570, 1761474, 1201517, + }, + { + 6524056, -109026672, -17107392, 15016279, -33375118, -26015690, -211527, -4352950, -4121558, 6433324, + -10129680, -1182727, -928787, 12603045, -7596187, 6739878, 19079318, 7027640, 13219372, 2338073, + -6954626, 4900558, 4107063, -723702, -7770133, 2407866, 661962, 12438225, -3483755, 6204617, + 8025684, -932545, -1014686, 7679402, 3966939, -3736085, 5362267, 3762928, -4901632, 1844152, + -371515, 3910031, -777389, -4122632, -49929, -3767223, 3096672, 6988449, 64425, 2551211, + -4901632, -3632469, -3576097, -1905355, 3279745, -1865626, -7355132, 773094, 1188095, 5371394, + 1635309, 3719979, 3172370, 3748433, 871878, -1500017, -5643587, -405874, -2624225, -1519882, + -1515050, 154082, -324270, -423591, 2309619, -1462436, -1932198, -102005, 864362, -377420, + 1493038, -151934, 702227, -718870, -424128, -1527935, 1362042, 81068, 189515, 102005, + 1331977, 377957, 635118, -2094870, 288837, 1749125, + }, + { + 4089883, 45419280, -16275779, -5679558, 2677912, 2124935, -10390600, 5989869, -413927, 9094056, + 1537598, -1433982, 3661460, 6432788, 80675056, -18707266, -5727339, 4689031, -14883672, 870805, + -13989782, -5647882, 18910204, 395674, -6438156, 17786534, -3764002, 8458401, -17235704, -3764539, + -8490613, -8522826, -403727, 5137318, -5708012, 10129143, -3216931, -6322192, 3319473, -11274289, + 2317672, 4748623, -2940979, 4597763, 1035624, 3107946, 5395016, -5766531, -5086315, -1013075, + -1591285, -3573413, 5954436, 2088428, 4191888, 5493800, -5526549, 1874216, 1332514, -140123, + -758599, -770410, 1451699, -233002, -2831994, 1383516, -1039919, 4324495, 1741609, 2226941, + -2427194, 1046361, -880468, 1892470, 1014149, 83752, -965294, -804233, 153008, 1452236, + -362388, -900333, -178241, 448824, -1177895, -79457, 1484448, -1393717, -2996814, 2153926, + -374199, 1191853, -1828046, -600759, 1770063, -933619, + }, + { + -12856448, -103979544, -7039989, -21319144, -3441343, -5063230, 11943767, 12212740, 14624901, -19936702, + 10211285, 11029476, 7744900, -21596706, -56396140, 84289, 27415314, -1961726, 27392764, -248034, + -19543712, 13351980, 14860587, 11099806, -11800423, -5959267, -9165460, 7748121, 1954210, 14290967, + -2084133, -4389994, 35970, 17335024, 4007205, 4685273, 395674, 4804458, 11147051, 1759863, + -3666292, -7373922, -4040491, 10918881, -3116536, 933619, 4735202, 898722, 1108102, 5866389, + 5723581, 2299418, 692564, 60130, 2412161, -3804804, -6088116, -4618701, -1554241, -1097364, + -340376, -4644471, -176094, -1520955, 851477, -3767760, -2585570, -786516, -4077535, 1313723, + -1762010, -3534221, -623844, 1390496, 1903207, 933082, -1736777, 1828582, 2684, 298500, + 1794223, 1168231, 1212255, 619012, 1408212, 544924, 1609002, 161598, -1665374, -1708323, + 110595, -828929, 1613297, -259846, 1724429, -891743, + }, + }, + { + { + -108985, -75054552, 1265405, 10029822, 443455, -4516158, -2462627, 1236951, -3029026, 4760435, + -11126113, -17190070, 14040248, -7562364, -13635447, -15052787, -4225174, -2858301, 18304076, -565862, + -4857071, 5372467, -1202591, 5925981, -2735894, 188979, -1940788, -8846022, 3455301, 3356517, + 5870684, 3743064, 5935645, -5188321, -4406637, -1739462, 33286, -6033356, 8857296, -4059818, + -2547989, -537408, 1657321, 104153, -3643743, 2654290, 10609643, -6692096, -3937411, -4734665, + 2820183, 2725157, -330176, 10312753, 3374234, -179315, 2254321, -5316633, -734976, 667331, + -769336, 6379100, 2965675, 3653407, 1002338, 1500017, -1180579, -1677185, 177704, 6286222, + 2663954, 2616709, 568546, 1495186, 2116345, 1742683, -110059, 728534, 1628866, 1462973, + -452582, 672699, 1129040, -368830, 1035624, -249108, 1893544, -778463, -781684, -1526861, + 916439, 1372779, 1285269, -1662689, -1013612, -366146, + }, + { + -9288404, 315762240, 29853244, 38034084, 7771744, -7396471, -14884209, -7317014, -8839043, -2773475, + -26674968, 8960912, 10729902, -15127949, -4320737, -2804614, 15275588, 7277285, 5505075, 5417565, + 3055869, -5431523, 273267, 13829795, 3723200, -1427540, -12082280, 6969122, -7149510, 5568962, + -1721745, -7579544, 1853815, -9208947, 525597, -1390496, 5156645, -2393371, 200790, -1686312, + 2317672, 2012192, -5657009, 2852395, -6003291, 335007, -3295851, -3470871, 3944391, -3406983, + -3093987, -1024350, 1998234, 438624, -2237141, -1258962, -2917894, -1613834, 1417339, -25233, + 4728222, -3481608, 4218732, 7396471, -33286, -1089848, 2874944, -146029, 3529926, 444529, + -1210644, -986769, 296353, 1646046, 446677, -788663, 933619, 286689, -197569, -436476, + 1509681, 445603, -3870839, 607738, -5369, 2684, -724776, 840740, 678068, 1091459, + 657667, 85899, 1045288, 10201, 27380, -236223, + }, + { + 7123204, 29364692, -40241160, -20907900, 3879966, 6449967, -7745437, -2783139, -3905736, 10586021, + -5490042, -5587753, -8483097, -4221953, 8616241, -104153, -4991289, 18358300, -11798275, 3289945, + -3475702, -6589017, -12404402, 7200513, 3324305, -3913789, -1363652, 1000191, -4619774, -6902013, + 5948530, 3705483, -3073586, 1859184, -1764695, -4771172, 18432926, 9068823, 8839043, -5881421, + -5314485, 5260798, -297427, -1263257, 6152541, -2207613, -10158671, 7837242, -486405, 2141578, + 3412352, -2405719, 382789, 1406602, -883690, 5435818, 1972464, 1461363, -273804, 284542, + -274878, -1910724, -112206, 1345935, -1311576, 3622805, -648540, -6140193, 352724, -4393752, + 1376000, -1222455, 1689533, 3430068, 3416647, 1564979, -467615, 700080, -2177549, -3013993, + -395137, 893890, -567473, 568546, 178241, -381715, -387621, 1489280, 483184, -477815, + -300648, -1251446, 77309, 619549, 1000191, 770947, + }, + { + 2005213, 19526532, -2286533, 1080721, -931471, 509491, 1903744, -2378338, -2466922, 4126927, + -4279935, -849867, 1645509, 1924145, 2594697, -19153944, 7019587, 7332046, 3371013, -14340896, + 16574279, 5413807, -10580652, 1245004, 2047089, 18473728, 11638288, -1183800, -70867, 3911105, + -21384642, 15789910, -4608500, 8409009, 7740068, -2124935, 12181064, 491237, 12443057, -881005, + 5778879, -7125888, -768799, -3390877, -2943663, 5684926, -3059627, -773094, -3144453, 412854, + 1423245, -1832877, 236223, -3692061, 1830193, -3939559, -1455457, -5585068, 4304094, 3173981, + 77846, 3149822, -26307, 127238, 1706713, 4386772, -468151, -1952600, -3695819, 387621, + 1634772, -2134599, -1229971, 1010391, 186831, 446140, -214748, -290984, 833761, -1874216, + 1545115, -1116692, 13959, 1460289, -321586, -782758, 192737, 708133, 820876, -52613, + 498753, 448287, 188442, -838056, -862215, 979789, + }, + { + 28960964, -139638512, -20114406, 25958782, 12155831, -340376, -6418829, -13755170, 6643241, -21512418, + 5807333, 22697828, 11950747, -2863133, -15588047, 8675834, -6157910, -19673634, 7122667, -16139950, + -814970, -11126113, -4909685, 4002910, -9524090, 9967545, -1562831, 8991514, 6493454, -1076426, + -8123394, -3029026, -5094368, -1384053, 1165010, -2957085, 8361765, -12487081, 861678, 4391067, + 5117991, 1243930, -3377992, -3689914, -4105989, -1639067, -2858301, -2052458, 7429757, -4461398, + -5092758, -1466195, 3867618, 794569, -1767379, -4227859, 5201743, -3192771, -23622, -3281892, + -4460861, 76236, 1256278, 1299228, 894427, -636729, -1273458, -261993, 583579, -1648194, + -1506460, 619549, 675921, 752693, -692564, 734439, 2439542, 289910, 1939178, -3782256, + -666257, 2807835, 390305, -1191853, -756451, 263067, 1073742, -1465121, -1134408, -645856, + 742493, -783295, 704375, 1279900, 169651, -340913, + }, + { + 82678, 13008382, -2050847, -2350421, -243203, 428423, 1167157, 2478733, -601295, -4699231, + -4781909, -6019397, 6231461, -5297306, -3888019, -3279208, 15122043, -8543227, 27400818, 48855, + -2913599, -620086, 5520107, 9470403, -22935126, -1912334, 12401718, -11194295, 5985037, -1899449, + 637266, 12965433, -11214160, 5373004, -2963528, -4432406, -6149857, -5437966, -1819992, -1253057, + -823023, 5406827, 2007897, 11996381, 2138357, 2492155, -3418794, -1435593, -9130564, 3723200, + 8472360, -1678795, 518617, -6067715, 2938831, -2829847, 5133023, -717796, 2550137, -468688, + 1178432, 216896, -1289564, -228170, -104153, 3376381, -2540473, -4575751, 1186485, 2450816, + -1443109, 1276679, 10737, 1305133, 3794067, -715649, 833761, 1076963, 4066797, -2652679, + -1147830, 430034, -179852, -2336999, -164283, 1736777, 696322, -570157, 747324, 517007, + -1622961, -478352, 959388, 2010045, -83752, -830539, + }, + { + 33948496, -253037456, -14239964, 42426224, 5490042, 4303021, -5355288, 13982266, 3886946, 6528351, + 15006616, 3024731, -3661997, 8578123, 6567542, 6650220, -11904576, 4523138, 2786360, -19298362, + 16575353, -8515310, 1667521, 14306536, 17623862, -4286378, 1257352, 4762045, 5735392, 4868346, + 3373160, -2214593, 10380399, -163209, 5510443, 1202591, 5720897, -3963181, -5144297, 3652333, + -3178276, 504659, 1007707, 2078227, 7125888, 477278, -6020471, -7260106, -2276333, -8308078, + -1160178, 2587718, -725313, -7487739, 737124, 4483946, -2338610, -5493263, -55298, 1772748, + -759136, 7243463, 199716, -390305, 3894462, 3546032, -1806034, -1447941, -245350, -305480, + -2449205, 608275, 780610, -756988, 281857, 1097901, -2758980, 321049, -1879585, 1644973, + -15032, -2014877, -173946, 2271501, -2397129, -586800, 47245, 483721, 460635, 498753, + 606664, 40802, -517007, 383863, 843961, 556198, + }, + { + -724239, 5094905, -12241731, 3426310, -2526515, -1241246, -866510, -1248225, -445066, 1625645, + -8643622, 5337034, -6583648, -7377680, -12099460, -14264123, 4138738, -1270237, -8315594, -1900523, + -13546864, -4945118, 17542794, 10473278, -9672266, 3096135, 552440, -17357574, -15488726, 3962644, + 3867081, -7827578, -1000191, -1536525, 2036888, 8916352, -11251204, -12520367, 766652, 3565360, + 763967, -169651, 7437273, -1548873, -2130841, 3200288, -4020090, 13950591, -4004520, 2864743, + 9974525, 3096672, -3488587, -969589, -3130494, 1549410, 1792075, 4263829, -4854387, -3373160, + -907849, 2843805, -1411971, 1656784, 2487860, 2836289, 1443646, -3794067, -114354, -999654, + 121333, 435402, 4105452, -2305324, 2334315, 220654, -625455, -1048509, 823023, -988379, + -553514, 311922, -1149978, 1078574, -631360, 2355253, 638340, -920734, -1554241, 956704, + -1796370, 697932, -1021129, -244813, -1853815, -1480153, + }, + { + 67313408, -60659432, -41886132, 76131520, 13296682, 8732742, 15900506, -5658083, -19363860, -1954210, + 13760001, 2994666, -431644, -4977867, -4938139, -2900714, 7764227, -29160144, -2656437, 10721849, + 1711545, 11577084, 825707, -2151779, -2117956, 8067023, -876710, -809601, -6164889, 4483409, + 7470022, 1807644, -13385802, 7239168, 10668699, 6664179, 6439767, -11202885, -2509872, 6458020, + -2765422, 9568113, 5900748, -4466766, -8401493, 1428077, 7563975, -286689, -4120484, -2501819, + 1225676, -2787434, -852551, -4810900, -467615, -507343, -7435126, -2542621, 882616, 2261300, + 3452617, 2627446, -3377455, -43487, 916976, -743029, -839666, 557809, 854699, -1173600, + 54761, -521302, 1049046, -19864, 1854352, 673773, 2582349, -179852, 2112587, 103616, + 2560338, -1189706, 1346472, -3597572, -461709, -2579665, -1369021, 1308354, 1903207, -1481227, + -461172, 79994, -832687, -352724, -856309, 284542, + }, + { + 3045669, -64961380, -11425687, 12177843, -4013110, -20105816, 1624571, 2241973, -3490735, 4355634, + -7652558, 7716983, -551366, 7876970, -8681740, -1033477, -3771518, -12331925, -5251135, -1990181, + -10707890, -1028108, 5929203, 4603668, -4501126, -387621, 8438000, 10274636, -5319317, 4496831, + -2110440, -1676111, 4596689, 1187022, -4119948, 3341485, -515396, -858457, -7390565, 4487167, + 10072772, -4049081, 528281, 4946192, -9634149, -103616, -2221035, 9386651, 6502581, -438624, + 701690, 2905546, 5062156, 881005, -3422015, -704912, -2458869, -1855963, 1745367, 3783866, + -423054, 1167694, -4471061, 2578054, 301185, -1637456, -955630, 1589675, -1453310, 222265, + -582505, -447213, -1660542, -1218697, 1202054, -2408403, 115964, -1269163, 3298535, -321049, + 785442, -97174, 462783, 285078, -2068564, 516470, 533113, -885300, -1445793, -1198833, + -262530, -479963, -551903, -1089848, -760746, 576063, + }, + { + -7137162, -203074640, 39251708, -3849365, -2605972, -1284195, -2028298, -1677722, 4729833, -7659001, + 7300371, -20554640, 2764885, 92879, -3102040, -6509560, 9148280, 14826227, -6923488, 13367012, + -1975685, -2901787, 5784784, 1334124, -8185671, 2186675, -4750234, 615254, -12887049, -10228465, + 4429185, -10943577, -3913789, 3448322, 9007620, 8475581, 1816234, -1962800, -6031208, 439697, + 1828582, 3573413, 3647501, 1072131, -8245801, -3079492, -540092, -4295504, -1189706, -5902359, + 642635, -1771137, 1175210, -1862942, 1198296, 4260071, -7525320, 4945655, 38655, 1016834, + 587337, 3472481, 2262911, 1921998, 622233, -906775, 3388192, 2488934, -823023, 2297271, + -2706903, -1538135, 3005940, 2423972, -62277, 1199907, -695248, 2415382, 901943, 2816425, + -908386, -104153, 150861, 1423245, 596464, 1964948, 245887, -24159, -729608, -275415, + 891743, -900869, -204548, -2826625, 682900, -846109, + }, + { + 3710315, -13613436, -9304510, -966905, -6369437, 1275068, 2543158, -1655173, 798864, 4354560, + 10724533, -4508642, -19201726, 14607721, 25332790, 5265093, 15738908, -4509179, -4600984, 10468983, + -13547937, 2263448, 32744830, -8485782, 7968238, -1183264, -10988674, 5427765, -6793565, 11767674, + 4428112, 7859254, -3745748, 13893145, -6302328, -8485782, 5098663, -252329, 4351876, -4398047, + -1682017, -3494493, -1242856, 2902861, 426812, 2790655, -4810364, 2078227, 3312494, -937377, + 1515587, -4005594, -4807142, -5929739, 2879776, -54761, 712965, -1267552, -1651415, 398358, + 4458713, 3356517, 4842039, -797253, -4134980, -4735739, 1640678, -1829656, 322659, 79457, + -1134945, 1357210, 3242164, 1534377, -1600412, -912144, 2894808, -1610613, -1008244, -156229, + -1004486, 1335735, -3061775, -2040646, 156766, -1612760, -1563905, 98247, -1066226, -1563905, + -621697, -2146410, 2059437, 449898, 176631, 72478, + }, + { + -28457916, -64673616, -10402411, 3833795, -22384296, -11790759, -17008608, 3646964, -1336272, -5049808, + 3942780, -5303211, -5555004, 5630702, -13661217, 19726248, 17249662, 17809082, 15421080, -6508486, + 3928285, -5612986, 7329362, 384936, -10262287, 1744831, -2394444, 13492103, 14704894, -6244346, + 3210488, 9638980, -302258, 2697776, 819802, -1863479, 6106370, 4882304, -1595580, 147640, + 2669322, -707059, 2737505, -11157788, 2080375, -1213865, 2735357, 1956895, 2803003, 1188632, + -4693863, -5022965, 229244, -534187, 1355062, 1144609, -5688684, -504122, 649614, 3167002, + 3256659, 4919348, 2389076, 4223027, -738734, -2037425, -7221988, -1211718, -67109, -2550674, + -248034, 471373, -803159, 1676111, -1389422, -2541547, 345745, -996969, 2284923, -2925410, + 2064269, -522375, 86436, 64425, -819802, -2684, 549219, -1919850, 2659122, 81604, + -166430, 520228, 1651415, -1840930, 138513, 2582349, + }, + { + -5418638, 35595616, 519691, -9446781, -2969433, -3666292, 7391639, -2043331, 6985765, 5363878, + 5756867, 4290673, -392453, 37514392, 41101228, -29459180, -517544, -1561221, -12797929, -974421, + -7660074, -16826072, 18869938, 7472706, 1661616, 2751464, 11080479, -9899900, 3352222, -6568079, + -9340480, -14010720, 1121523, 3361349, -1140314, -1183264, -5129265, 3942780, 4224101, -5215164, + -8103530, 6801081, 4223027, -3258270, 4866735, -63888, 1832877, -9642738, 4185446, -2972117, + -543313, 2316061, -3060164, 6764574, 447750, 6250788, -4861366, -537, 179315, 2373506, + -30065, -2301566, 1884417, -511638, -3860639, 19864, -667331, 1932735, 2512019, 2432562, + -1906966, -1344325, -2359548, 3007014, 4059818, -1049583, -430570, 777926, -612570, -1273995, + -169114, -1186485, 1289027, 585726, -526670, 1495722, -3075734, 1254667, -679679, -2433636, + 1523103, 968515, -150861, -1569811, 721018, -1100049, + }, + { + -4511327, -115785336, -20034412, -18613852, 4899484, -1258425, -2943663, 12321724, 9131100, 3663070, + -15097347, 15736223, 17824652, -14434848, -69171520, 15259482, 31494996, -7194607, 28547574, 49929, + -858993, -974421, 13142063, 5203353, -7772280, -4993437, -12783433, 6109591, 5925981, 5677947, + 2910377, -8982387, 9559523, 6878390, 10619844, 8746164, -1713155, -1756105, 18277770, 1576790, + -13773423, 9807021, -5777268, 9041443, 4996121, -1345935, 2266669, 1283122, 4158602, 9124658, + 4022237, 41876, 3648575, -1878511, 101469, -2673080, -1455457, -2672007, -3078955, -1222992, + -2895882, -3550327, 2559801, -4541928, 1423782, -4239133, -623307, -7398618, 974421, -2510945, + 273267, -3595425, 1705102, -777389, 947040, 4449049, -1120987, -129386, 1960653, -1221918, + 3249680, 1128503, 1829119, -705448, 1705102, 233539, 1599339, 314069, -2556579, -1364726, + -271120, -1090922, 398358, 1087164, -702764, 1439888, + }, + }, + { + { + 455803, -59528248, 14878840, -6979, -2509872, -1504312, 321586, 1570884, 9886478, 15543487, + -11267847, -24023900, 19024020, 1091459, -16101296, -11425687, 10009421, -9718974, 2189897, 11320997, + 6002754, -3745748, -9395241, 6216429, -6986301, -4547297, -1366873, -9098888, -3871913, -7364259, + 6022081, 3109556, 2457258, -2916283, -5414880, 1873143, 12718472, 8121247, 12750147, -2111513, + -870805, -3055332, 4205310, 3753265, -3101503, -1186485, 6032282, -930934, 202937, -6681359, + 1343788, -2411087, -2394444, 4153234, -1200443, 2723546, 7100655, -2387465, -1962800, -3850975, + -931471, 1514513, -958851, 3353296, 163746, -1514513, -3376918, -2138357, -4801237, 3104725, + 4102768, 1970853, -738734, -78383, -660888, -147103, -1344325, -722091, 867583, -1159641, + -1302449, 758062, -1352378, -2327872, 585726, 29528, 2124935, -1149441, -918049, -1218160, + -230318, -652835, 702764, 52613, 1111860, 447213, + }, + { + 11625403, 272233824, -30630634, 3373697, -5509906, 5037997, -7450695, 7409356, -337692, -8130373, + -16274705, 21336324, 9719511, 2913062, 11170136, 9015136, 19414862, 1036698, 9007620, 15182173, + 8798777, -8220031, -10480794, 6863358, 7136088, 6710350, -10686416, 2971581, -14981920, 2812667, + 507880, -3598646, 8218420, -3553549, 4083440, 739271, 7035694, 728534, 2557116, 4051228, + -2456721, -749472, -4969814, 688805, -7417946, 4357245, 1393717, 379031, 8441221, -4378719, + -2462627, 1533303, 1247151, 3912178, -1747515, -4596689, -2606508, -4216584, -737661, 1429687, + 3811784, -2306934, 2151242, -505732, -1509144, -422517, 310848, -3281355, 118112, -950262, + 958315, -102542, -728534, -536334, 563714, -1108638, -338229, 799938, 836982, -417686, + 419296, 221191, -3562139, 173946, 414464, 632971, -423591, 869194, -735513, -726923, + -758599, -772557, 128849, 140660, 836982, 808528, + }, + { + -6138045, 100035160, 24973088, -7541426, 6213207, 3142842, -8169565, -151934, 4507032, 12960064, + -22454626, -4411469, 6402186, 2208150, 14244796, -19327, -1098438, 17056926, -14481019, 16260746, + 11869142, -1295470, -7801808, 19295140, 19043884, 3132642, 2931315, 1811939, -2205466, -2029909, + 2730526, -5208185, -5085778, 2747705, -5249524, -4518306, 11557220, -688805, 5567352, -4732517, + -7534447, 132607, -2528125, -2328409, 2863133, 1170916, -7735236, 3551938, -1875290, 180926, + 1669132, 838592, 2809446, -201863, -5038534, 2820720, 688805, 279173, 151398, 3462818, + -474057, -2577517, -802085, 108448, -2661806, 2457795, -3031173, -4730370, 4035659, -3202435, + 126702, -2309619, 892816, -40802, 690416, 331249, 212064, 3389803, -355945, -681826, + 695248, 541166, -1926293, 697395, 1035087, -908386, -561567, 1666984, -729071, -1583232, + -690416, -769873, 45097, 294205, 365609, -440771, + }, + { + -1238561, 24970402, 2569464, 2852395, 1407139, -942745, 382789, 554588, -1990181, 5269925, + -935766, 777926, 5827734, 3913252, 17014512, -5650030, -69793, -13530758, -1085553, -7590818, + 15494095, 5582384, -10987600, 4884452, 7206419, 17860084, 4405026, -6310918, 1860258, 23352810, + -4474282, 13977971, -11218991, 2275796, -1109712, -14801531, 10512469, 8462696, 5411122, -6332930, + 5376226, -3657702, -2622615, -6869264, -4589710, 1763084, -4493073, -925029, -9968619, -2765422, + 1043140, -3899294, 372052, 766652, 3763465, -3671660, 1156420, -2666638, 3510062, 875100, + -454730, 2334315, -1198833, 336081, -1439351, -105764, -449898, 1473174, -1736777, -933082, + 668404, -2554969, -769336, 165356, 132070, 741956, -1053341, -765041, 1428077, 26307, + 3296924, -1066763, -1040993, 533650, -1211718, -169114, 97711, -220654, -356482, 56908, + 865436, 304406, 810138, -1475321, -1496259, 125091, + }, + { + -23270132, -200074080, 2221035, 9211094, -10608032, 1265942, 1460826, -10771778, 17846126, -20466592, + -3026878, 14374182, 14125611, 7963943, -24238112, 585726, 4638565, -15313169, 11788075, 5536213, + 7405061, -234613, 8587250, 3779034, -9850507, -1079111, -9317395, 14206678, 11076184, -2957085, + -7233799, -4763656, -1075352, -2687576, -4571456, 4034585, 21907554, -12951474, 372588, 1191317, + -1839320, -6272263, -3234647, -5369, -1983201, 4835060, 1256278, 73014, 8871792, -5193153, + -155156, -3058017, -4891431, -2916283, 491237, -609885, 7873749, -2062121, 2343979, -1668595, + -1584306, 3111167, 1165547, 2551211, 3138547, -1275605, -454730, -643708, 2195265, 295816, + -1238024, 360777, -38118, 1534377, -500364, -898185, 1392106, 2219424, 4432406, -1597728, + 458488, 1589675, 235149, 1362578, 4295, 192737, 1225676, -19864, 1261647, 215822, + 714575, -712965, 162135, 1221381, 498753, -862215, + }, + { + -1685775, 7183870, -3619047, -2003602, 264141, -280247, -377957, 499827, 632434, 3127273, + 5111548, -2112050, 7759932, 15848429, 1897839, -6086506, 12656195, -18458158, 3496104, -13460964, + 4540318, 5652714, 5902359, 13043816, -4378719, 5980205, 4790499, -16108812, -5130339, -8239358, + 1148904, 12277701, -6676527, 6747931, -3270081, -5645735, -8451959, -7780334, 1547799, 4284767, + 1232656, 755377, -4120484, 6959458, -53150, 1081795, 935229, 4141422, -9445170, 1510218, + 2189897, -7588671, -294742, 1537598, 6988449, -3872450, 2981781, 1661079, 3279745, -836445, + 1162862, 3611531, 4367982, 2261300, 661962, 3513820, -1629940, -1846836, -1887638, 729608, + -2077154, -1081258, 176631, 1830730, 1449015, -2605435, -751082, -814433, 3193308, -1541893, + 117575, 185757, 935766, -992137, -771484, 174483, 1169305, 134755, -390842, 221728, + -1187559, -206695, 96100, 1017907, -328028, -59056, + }, + { + -14573361, -325324992, -5325223, 35034048, -15249281, 238908, -10298258, -6009733, -12713640, -4323422, + -8932458, -6157373, -931471, 9473087, 12206297, 2190970, -10369125, 10344429, 3292629, -9730248, + 26148298, 5871757, 6364068, 1408749, 3870839, -2103997, -1631014, -5628018, -5194763, 9482751, + 6834904, -4185446, 10205916, -3226057, -6607807, -6418292, 7089918, -3041911, -4963909, 1385127, + -4363150, 1300301, -171262, -2223183, 2991445, -727997, -5127654, 17180, -1519882, -9426916, + -60130, 5089536, 6332393, 927176, 3382824, 3382824, -560493, 1394254, 643708, -446677, + -59056, 6653441, 2753611, -1039919, 1394254, 625992, -3081639, -1239635, 1563368, -779537, + -4595078, -702227, 899259, -1112397, 165356, 1502702, -4109747, -1146219, -2668785, 750009, + -368293, -181462, 919123, 1738388, -707059, 530428, -238371, -1163399, -568009, 31139, + -108448, -674310, -641024, 288837, 896038, 615254, + }, + { + -1540820, 3223910, -9775346, 1360968, -2672544, -929324, -1757715, 158377, 4329864, 4881767, + -3059091, 7209103, -11547556, 827855, 6449431, 5792301, 15017890, -111132, 2367064, 9753871, + 1996086, 1541356, 19078244, 20434918, -6056978, 9920838, 17103096, -17726940, -12501039, 17793512, + -817654, -12910135, 3759170, 1595044, 10711112, 11710765, -12997645, -12766253, 3322157, -5504538, + -11297375, 2650532, 7935489, 1547262, 1353452, 2356327, -11915850, 7447474, 2656974, 5765457, + 4474819, -1541893, -749472, 1101659, -5577552, 245887, -1697049, -535260, -1782948, -1325534, + -2233383, -505732, -6886980, -595390, -645319, 394600, 2216203, -1154273, -1298691, -679142, + 2513093, -2118493, 1707786, -1781338, 1551557, 659814, -126702, -680215, 2714956, 1007170, + 905701, -33286, -2548526, 1315871, -280247, 2142652, 559956, -261993, -1463510, -1006633, + -1701344, 1466731, -1189706, 1378148, 424665, -65498, + }, + { + -72807752, -177383216, 21170430, 53271552, -23345832, -6786049, 8746701, 577136, -17826798, -5854041, + 3549254, 10155987, 16136729, 13640816, 10212895, -4497368, -6001143, -28128278, -1637993, 7638063, + -6813966, 7472706, -3494493, -6826851, -10039486, 419296, -5374078, 4512400, -1882269, -2304250, + -2950106, -133144, -7981660, 4763656, 4496831, 3877282, 9006010, -609885, 1903207, 7532299, + -4708358, 2135673, 5227512, -75162, 898185, 5259725, 2084670, -1803349, -359704, 3799436, + 915365, -4330401, 1977833, -1560147, -1119376, 4578435, -411243, -661962, 4115116, 1707786, + 44023, 478889, -3936338, 3718368, 4339528, 48318, 582505, 2083596, 3906273, 319438, + -1696512, -72478, 610959, -1548336, 1221918, 911607, 2229625, -1374390, 1148904, -1915019, + 976031, -1057636, 1036161, -3737695, 1518271, -101469, -419833, 452582, 593779, -1064078, + 500364, 207769, -970663, 88584, -678068, -271657, + }, + { + -3911642, -62111132, -1769527, 6740415, -8164196, -19419694, -4066260, -3554086, -7571491, 7361037, + 6878927, 17099876, 1394791, -3117073, -19582366, 5481452, 3125126, -11637751, -8397735, -3477850, + -4348118, 10408316, 3796214, -3039226, 2537252, 2938295, 2245194, 2207076, -4627291, 3740380, + -4380330, -5053566, -748935, 1124208, -9325448, -116501, 1131187, -4299263, -7527467, 12094091, + 16192027, -710817, 1893544, -550830, -10291815, 6018323, -1967095, 2742337, -2130841, -10385768, + -1286343, 819265, -3173444, -4248797, -403727, 965294, -3396246, -5004174, -4164508, -3055869, + -1571958, 5951751, -2342368, -1003412, -2329483, -973347, -1276142, -1722819, -883153, 1033477, + -3003256, -1207423, 616328, 203474, 1956358, -1309965, 481036, -2660195, 2412161, 1571958, + 2044404, 654446, -85899, -9664, -1694365, -169651, 1282048, 122943, 1133871, -413927, + -513249, 74088, 500364, -665720, -1691680, 135828, + }, + { + 13037910, -215081232, 16703665, 7992398, 26339424, -10657424, -8177081, 1136019, 10943577, 1699196, + 14828911, -17750026, 11292006, -658741, -3602941, -3956739, -797253, 1853278, -18943490, -7167764, + -16422881, -8235600, 7449084, 2167885, -6651831, 3118683, -309775, 8161512, -4895726, -7443179, + -343061, -5428839, 3937948, -1208496, 591632, 5720360, 693637, 260382, 689342, 2990371, + -2257542, -826244, 4043175, 3236258, 1135482, 425202, -1513976, -4527970, -1788317, -86436, + 4828080, 552977, 2180770, -3066070, 2994129, 8540006, -2536715, 7107097, -2953864, -462246, + 1486059, 3810173, -631360, 1347009, 4405563, -896574, 1690607, 4133906, 42413, 2486786, + -2525441, -3813931, -877784, 476205, -2154463, 340913, -782758, 3457986, 729608, 2158758, + -1457068, -780073, -525597, -497679, -1567663, 1052804, -540092, -500364, -519154, -294205, + 1185411, 246961, 1051730, -511638, 1548873, -751082, + }, + { + -3281892, 7427072, 13870597, -2636573, -12181064, -1902134, 3550327, -4252555, 186294, 2574833, + 7410966, -2564096, -3792456, 17696340, 10148471, 15439871, 31675384, -2943663, -8680666, 11844983, + 2891587, 10203769, 15380278, -25831544, 2153926, 5784784, -18148384, 2007360, 9033390, 19155554, + 1913945, 3135326, -3816079, 9756555, -3626563, 2685965, 830002, -10429791, 1342177, -3240016, + -1643362, -750009, 575526, 2294586, -1352378, 211527, -640487, 688269, -6011881, -6356015, + 4839892, 330176, -1072668, -2553358, 577136, -3218004, -2035815, 1740536, -1414655, -2366527, + 3729642, 2227478, 529892, -1229434, 2251100, -3973919, -904628, -1691680, -1979443, 1469953, + 2092723, 2420214, 3147674, -1301912, -3238942, 838592, 4191351, -1062468, -819265, 1008780, + 1585917, 3751117, -2561948, -903017, 1789391, -231928, 357556, -337155, -667867, -712965, + 675384, -887448, -237297, -1612223, -164819, -1935957, + }, + { + 39071316, 33714420, 927713, 3891777, -13885092, 13709536, 7108708, 22972706, 6437619, -6328098, + -3262028, 7206419, 5370320, 8069707, -13533442, 27954868, 16397111, 648540, 8684961, -13429289, + -4954245, -16789564, 29528, -721018, -13106630, -3609383, -7841537, 3101503, 8570607, -3650185, + 7868380, 5192079, -4921496, -5917928, -5039608, -2568391, 2100776, 5334350, -1978369, -5485747, + 7714298, -32212, -594316, -10837276, 5290326, 6947110, 2146410, -2170569, 1464047, 5630702, + -1214402, -4940823, 5494337, -3271155, -1954747, 2876554, -6433324, 590558, 1866700, 812823, + 636729, 4342212, 1109712, 1513976, -892816, 262530, -4967667, -217970, -1233729, -3566970, + 842350, -91268, -1848447, -653909, -3157338, -1555852, 1989644, -150861, -330712, -3598109, + 1827509, -716186, -252329, -1665374, -1873143, -595927, 426812, 143345, 2787434, -1410360, + -273804, -61203, 1840930, -1315871, 608812, 2145336, + }, + { + 6962142, 39587252, -4722854, -3863323, -2929705, -4236985, 3852586, -7711077, 5839008, 8818105, + 1930051, -2390149, -9127879, -59290412, -66369056, -19763292, -1113470, -1133871, 7129646, -2506114, + -19679004, -15143518, 15199889, 3383361, 14977088, 9807021, 8121783, -1653562, 14283451, -1243930, + -693637, 904628, 12150462, 1147293, -1293859, -7283191, -426812, 9524627, 4584878, 4159676, + -10420128, 2202245, 3952444, -6291590, -1956895, -6257768, 602369, -8410620, 6628209, -796180, + -987843, 3707631, -2001455, 1962263, -3527242, 4601521, -3963181, 506269, -2369211, 925029, + -2446521, -4220879, -1590212, -2514703, -4281546, 3464428, 1982127, -4191888, -2884608, 810675, + -2097555, -1327145, -2228551, 263067, 3569655, -48318, 1981591, 810675, -3131568, -1445793, + -1034550, 143881, 3118683, 241055, -71404, 3141232, -867583, 2616172, 224412, -2010045, + 642635, -553514, 574989, -635118, 313533, -171799, + }, + { + 22066468, -71123584, -13103408, -13896367, 7534983, 6216429, 3958886, 9232569, 1039919, 3978750, + -21556440, 8868571, 19683298, 28150826, -19257022, 12193949, 11547020, -13140452, 21245592, 4322348, + 533650, -12559021, 2301029, -2859911, -5313412, 3333432, -5698885, -4567161, -5590974, 6168110, + 2747705, -14465987, 5674726, -2018635, 3668976, 5141076, -5061619, -2353642, 10206453, 1357210, + -7150047, 15146202, -2648384, 7583302, 4345433, 2478196, 3806952, -2588255, 681289, 5015985, + -2616709, -2608656, 4342212, 3205119, 825171, -2290828, 7865159, 2285996, -3439195, -875636, + -2886755, -3275986, 5529234, -3197603, 820876, -673236, 5105106, -1155346, 2887829, -5529234, + 587874, 134218, 1368484, -2000918, 382252, 5529234, 754841, -471910, 2346126, 103079, + 5067525, 980863, 89121, -1562294, 692027, -1024887, -950262, -1328219, -2002529, -1537061, + -1913945, -1060857, -561030, -1024887, -1811939, 1796370, + }, + }, + { + { + -2147, -13490492, -15266461, -12771622, 1262184, 3697430, -1728188, -2753611, 7575249, 2408403, + 5865315, -11163694, 2327336, -2859375, -197569, -16129213, -5182952, 9361955, -11629698, 19396072, + 7103339, -5655935, -9346923, -3704946, 5079336, -13976360, -7836168, -2538326, -10147397, 3320547, + -5886253, 9880035, -10879689, 4377109, 4057134, 10152766, 800475, 7529078, 15644955, -2871186, + -1445793, -4156455, 3484829, 7129646, 134755, -1948305, -2718178, 1574642, 1967095, -2163053, + 1053341, -6089727, 4615479, -1094143, 3533684, -2025614, 8179765, -1617055, -333397, -4461398, + 190589, -2073932, 368293, -1426466, 1293859, -3218004, -3919695, -1498944, -1088237, 2873333, + -23085, 1092532, -1168768, 1149978, -1165010, 781147, -1472100, 762894, -694711, -1288490, + -548682, 413927, -1100585, -956167, -939524, -605590, 2456185, -1043677, -964220, -647466, + -26307, -243203, -668941, 702764, 1915019, -21475, + }, + { + -13927505, 209854256, 33974800, -8231305, 12692702, -2600066, -6554657, 16852378, -7308424, -12289512, + -2058363, 21515102, 2676838, 6840809, 189515, 16436840, 27227946, -7265474, 12255689, 16452409, + 2546916, -9284646, -10945724, 7426536, 7721815, 681289, -7036230, 6667937, -8841727, -4226785, + -3075734, 6047851, 5152350, -3692061, 4250407, -1886564, 3255048, 11135776, 1254667, 8229694, + -5264020, 1602023, 731755, -7931194, -938987, -1888175, 520765, 1456531, 8705899, -1533303, + 3319473, 3875671, -2186675, 4440996, -2516851, -5095442, -53150, -6098854, -1147830, 4818417, + 1937030, 1490354, -1061931, -5199058, 2888366, -1271310, -1859184, -428423, -177704, -3550864, + 2697240, -90194, -2206540, -305480, 1821066, 133681, -2556579, 1785633, 520765, 1084479, + 419296, -2807835, -77309, -258235, 348429, 48318, 893890, -127238, -1229434, -1777580, + -204011, -214212, 278099, 462246, 515933, 444529, + }, + { + 4337380, 134573680, -7617662, -5797132, -5881958, 4602595, -4541928, 5747203, -1203665, 8042327, + -20137492, -17217450, 15365782, 16287590, 1416266, 1205812, 1910187, -4134980, -8665633, 18831820, + 7145215, 3144990, 5014911, 9127879, 18565534, 5080947, 6436009, 1752347, 6522982, -7691213, + 84826, -4917201, -8988293, -1990181, -211527, 2453500, 2668785, -599685, 4184372, -358093, + -3532611, -10034117, -1366337, 399432, -1965484, 5288179, -703838, -5101885, 3551401, -513249, + 2851322, 3802120, -2448131, -214748, -1314260, -127775, 1794223, -999654, 2607045, 1335198, + -1317481, -1584843, -1595580, -654446, 1091995, -1146219, -5482526, -1160178, 976568, 512175, + -1469953, 364535, 162135, -760209, 468688, 281857, 1020592, 2331094, 142808, 1386201, + 177704, -213138, -839129, 470836, -540092, -117575, 370978, 874026, -1444720, -782758, + -796180, -948651, 1212791, -417149, -216359, -552440, + }, + { + 1038308, 27571542, -1247688, 5684389, -1465121, 775778, -1682554, 2334852, -3347390, 2699387, + 5954972, -3043521, 5966784, 5181341, 3842922, 17956722, -13036299, -15359877, 79457, 3127273, + -2390686, -5844914, 3144990, -1613834, 12604118, 11545409, -2415919, 3653407, -8396124, 20824148, + 15621870, -1848983, -1993939, -3925600, -4832, -8828305, 2905009, 12207908, 2218888, -5180268, + 3804804, -2876554, -7139310, -2247342, -7720741, 1535451, 1439888, -651224, -13833016, 703838, + 1929514, -6118718, 2084670, -392453, 1084479, -1180579, 210990, 2703145, 298500, -216359, + 776315, 948651, -1469416, 2099165, -2865280, -901943, 1165010, -1793686, 963683, -1081795, + -2843268, -45097, -1119376, 51003, 648003, 1035624, -2182917, 321049, 733366, 1465658, + 1700270, 1642288, -3037079, 111669, -1582696, 665720, 530428, -807454, -467078, 956167, + 1119376, -386547, 226023, -672162, -2061584, 176631, + }, + { + 8872866, -259941616, 11618423, -3833795, 4665945, -1614908, -367220, -4602058, 12848395, -23862838, + 7757785, 8359617, 15946140, 2770254, -19147502, -2962454, 4206921, -18910204, 17929878, 7955890, + -3347927, 7645579, 7666517, 1468342, -5259725, -4578435, -7658464, 14617384, 4362613, -2222109, + 3099356, -16135655, 6559489, -8955544, -1590749, 2936147, 2731062, 11931419, -11144366, 3607773, + -885837, -7604240, -1782411, -4025995, 2682207, 1806034, 6694781, -2437931, 10198937, -3400540, + 358093, -1808181, -8810589, 1232119, -1573032, 2412698, 1222992, 3221762, 2362769, -2459943, + -1494649, 3495567, 2621541, 644245, 4707821, -1372779, -4279398, 1232119, 2405719, 1131724, + -134218, -776315, 921807, 780073, -545461, 3758, 687732, 1396938, 4339528, -876173, + 1434519, 30602, 933082, 1103270, -268435, 1130113, 490700, -243203, 1969243, 652835, + -526134, -212064, -1611, 404264, 1101122, -212064, + }, + { + 523449, -2927557, -1573569, -2043868, 2107218, 544924, -1270774, 1578401, 1066763, 2228014, + 3500398, 4322885, 181999, 11383274, -9452149, 13567802, 80531, -4706748, -4040491, -2407866, + -833224, 9361418, 4249870, -4510253, -1166621, 10771241, -6052146, -16062641, 4664872, -7767985, + 6767258, 5148055, 2258079, 1293859, -1356673, -6910066, -7146826, -4434554, 5494874, -2985539, + 4881767, -5890011, -2754685, 6680285, -1220308, -209917, 1889786, 2037425, -4145180, 1714766, + -2758980, -2617783, -3426310, 7486665, 2483028, -3202972, 314069, 5737540, -759136, 4910222, + -958851, 2818572, 6708739, -724776, 2202781, 1953673, -1500554, -572304, -2051384, 1154273, + -3818763, -1699733, 75699, 2530810, -1737314, 93416, -444529, -2524904, 1159641, 293132, + 1189706, 57982, 297963, 288837, -481573, -1624035, 475668, 836982, -492848, 65498, + -813896, 78920, 479426, -188979, -178778, -344671, + }, + { + -13453448, -360643040, 21974664, 18873696, -2342905, -1960653, 379568, -13909788, -10150618, -11324218, + -862215, -2276333, 5258114, -15127412, 11523934, 9400610, -5011153, 17833778, -15061377, 5301064, + 6984691, 19015430, 6252936, -2405719, -2199023, 4107599, -7490960, -849867, -7803956, 5144834, + 10743861, -819802, -1280437, 5821292, -12197707, -7097971, 10962367, -5157719, -1377611, -6657200, + 3317325, 362925, -1437203, -1292785, 1379221, -3101503, -8220568, 9584756, -8595840, -1740536, + 2640331, -361851, 8663486, 3047279, 3495567, 206158, 908922, 3124589, -1199907, -417149, + 1070521, 1910724, 6092411, -1220845, -599685, -489089, -831076, -479426, 2283849, -1324997, + -4141959, -1861332, 1678259, -252866, -2932926, 358093, -339302, -2056753, -3742527, 2214056, + -1891396, 1063004, 1927904, -1218160, 2119566, 447213, 1136019, -2371359, -275415, -11811, + -883153, 811749, -1640141, -759672, 1828582, 264677, + }, + { + 484794, -10037875, -1355599, -4050154, 868657, 254477, -1128503, 1629940, 1125818, 3040837, + 1409823, -428423, -4762045, 3153043, 3283503, 18582712, 13239237, -13742822, 26277684, -17174500, + 16131360, 7766375, -3594888, 5752572, 8536248, 5770289, 13925358, -2588792, 6196564, -8680666, + -6613176, -5960878, 5957657, 13158169, 1109712, 4912906, -7217693, -2537252, -6946036, -6711960, + -5015985, -189515, 4896263, 2440615, -2223183, 4039954, -4847408, -5677947, 10288594, 6717866, + -420370, -2274185, 1509144, 681289, -5027259, 2815888, 545461, -5799280, 949188, -923955, + -4275103, 1767379, -7650948, -849867, -1248762, 2678449, -3515431, 3030636, -272194, -1333051, + 2596845, -1084479, -155156, -645319, -2106145, 1966558, 137976, -253403, 1168768, 2063195, + 108448, -715649, 492311, -1513976, 1813013, 45097, 778463, -910533, 1139240, -2629057, + -879931, 335007, -288837, 555125, 1316944, 925029, + }, + { + 64707440, -304361248, -20417738, 31197568, -8887898, -5872831, 1872606, -90194, -5600638, 266288, + -12205223, 20320564, 10241886, 24781424, -1034550, 4813585, -21237540, -6652905, -8572755, -778463, + 1417876, 2416993, -5501316, -3416647, -7185481, -1387811, -6589554, 3430605, 2029372, -252866, + -5633387, -1131187, -4770098, 8545374, -661962, 1622424, 3462818, 11857331, 3381213, -4117800, + -3058017, 2229088, 5392332, -3170223, 2342905, 2630131, 3027415, 257161, 528818, 4228396, + -2050847, -6036040, 2534031, 1826435, -5778342, 5862094, 2510409, 1084479, 1814087, 2188823, + -1215476, -1859721, 3446711, -963683, 3532611, 1900523, -292595, 2822867, 2633889, 1660542, + -2252174, 321586, 441308, -725313, -712965, 399969, 3529926, -1271847, 131533, -1556926, + 388158, 3758, -1045288, 351114, -563178, 1958505, -203474, -607738, -1406065, 724776, + 860067, -796180, -370978, -1081795, 188442, 859530, + }, + { + 4495757, -45518064, -23191212, 855235, -8232916, -7588671, -9390946, -4465692, -5262946, 7445863, + 9922448, 9122511, 5659693, -11592654, -15758235, 8045011, -11168526, 2640868, 13437879, -37754912, + 11710765, 12738873, 6842420, -8282845, 10288057, -2797098, 5069672, 1444183, -4552129, -5851356, + -4212289, 3228742, -2524904, -2149631, -4350802, -4592394, 2977486, -2487860, -2545842, 3435437, + 13706851, 993211, 4477504, -2468533, -3308199, 683974, 1365263, -3505767, 2317672, -11307575, + 314069, -364535, -8187282, -2080912, -2521683, 3328600, -2594160, -391916, -8482560, -2960306, + -301721, 3965329, -806380, -1999844, -2578591, 769336, -492311, -5470178, 2162516, -137439, + -940598, -3939559, -193274, 1671816, 700080, -1271847, 1798518, -165356, 20401, 760209, + 158377, 1901060, 1738388, -912681, -1020055, -1784022, 2102387, -173409, 1664300, -723702, + 650151, -1409823, 2077690, -1750199, -1302986, -58519, + }, + { + -18148922, -231587328, 56870736, 13689135, 28991566, -2921652, -2587718, -2312840, 11192685, -913217, + 4209605, -201327, 7618735, -5139465, -2905546, 5167920, -4737349, -6293738, -16470126, -1441498, + -24939264, -961536, 840203, 5277441, -8750996, 5214627, -5763309, 2787971, 2556579, 4786741, + -5018133, -3306051, 4065724, -4242891, -782758, 1754494, 6847252, -194347, 6566468, 411780, + -3903052, -4007205, 2584497, -1746441, 3624953, 5240934, -2123325, -6952479, -3092377, 9046812, + -3045132, -517007, 5702643, -3775276, 2945811, 2426120, 5311264, 4532264, -2291902, -2798171, + 2885144, 827318, 2857764, 234613, 3656628, -1589675, 467078, 2693481, 2557653, 2423972, + -2949569, -3606162, -514322, -206695, -2331094, 1547262, -691490, 3000035, -77846, -282394, + 228170, 499827, -2229625, -44560, -1858647, 351650, -403190, -55298, -856846, 185220, + 323196, 936303, -66035, 834834, 1243930, 459562, + }, + { + 2803540, 30292942, -4715874, -6266358, -5894843, -4648765, 2815888, 423054, -4906464, 4441533, + 8108362, -6193343, 14179835, 1654099, 12251394, 2450279, 38676180, -9806484, 3695283, -7490960, + 3769908, 26277146, -15838229, 4277788, -15875810, 13114683, -14324253, -930934, 10479720, 19352048, + 1503775, -7973070, 13753559, -2299955, -5078262, 9202504, -8450885, 3764002, -5181878, 125091, + 912144, 1360431, 1715303, -1772748, 2908767, -9993852, 5841156, 383863, -5228049, -1689533, + -220654, 766652, 113280, -89121, -5200669, -6129992, -681289, 5203353, -1399623, 2218888, + -169114, 979253, -499827, -862215, -512175, 541166, -3706557, 839129, -2543158, 752156, + 1150514, 2084670, 2519535, -2796561, 1278827, 2380486, -513249, 2451353, -1387811, -1367410, + 4266513, 2018635, -1515587, 1861332, -1054951, 1605244, -548145, -674310, 1014686, -991601, + 620086, -136902, -1903207, -827855, 284005, -2455648, + }, + { + -28943784, 139476384, 22012, -6705518, -14390288, 25698936, 4225174, 21734146, -14655502, 8777839, + -1014686, 11870216, -2596845, -1622961, 7757785, 19302120, 15525233, -922881, 393526, -7510824, + -11074036, -7610145, -9263171, -5862094, -5444408, -3013457, 3762928, 1279900, -9258339, -5800354, + 12887586, 5071820, -5020817, -4070019, 2541010, -7484518, -3907347, 775242, 2462090, -5289789, + 7689602, -5143224, -3649649, -3952981, -646929, 13386876, -2787434, -3631932, 2330020, 5150740, + 3020436, -7072201, 2178085, 1756642, -2657511, -1910724, -414464, 1806034, 464930, 1064078, + -1099512, 5648419, 1248762, -568546, -848793, 617938, -3511673, 23622, 919660, -4387846, + -121870, -368293, -1739999, -343061, -2821257, 462783, -136365, -106300, -3017752, 229781, + -964220, 1829119, -536871, -2421825, -609349, -1627256, 825171, 2025614, 1407139, -2617783, + 1846836, -1022739, 472446, -180389, 795643, 1039382, + }, + { + -7241315, 43906376, 7307887, 7102802, -10000294, 2261837, -5730023, 3525095, -3111167, -3390877, + 1450625, 3222836, -6567005, -40622336, -98909872, 3423626, -24673514, 12756053, 10246718, -36740760, + 13282723, -9110163, 4442070, 10159745, 1804423, 18670760, 1562294, 8724689, 7058242, 9232569, + -7894150, 3576097, 9539122, 4700842, -1671816, -17425220, 11454141, 8459475, -882079, 5889474, + -5483063, -4735739, 4938139, -2636573, -6784438, -3428995, -931471, -3599183, -1545651, 3240553, + 1177895, -1705102, 1600949, -3325915, 635655, 2775623, -2538863, 3182034, -5510980, 826781, + -3419868, -2101850, -4196720, -3650722, -969052, 144418, 4181151, -2554969, -3519189, -43487, + -4594542, -830002, 3869766, -2608656, 1560147, 2036888, 332860, 882079, -1443109, -150861, + -2214056, 1219771, 1418950, -1806034, 1915019, 2062121, -68183, 3196530, -104690, -782758, + -1027034, -1130650, 541703, 1083942, -610422, 1433982, + }, + { + -29923574, -5252208, 4825396, -1319092, -15112379, 6959995, 6106370, 17088064, -2114735, -2407329, + -10042707, 9489193, -396748, 5791764, 28906204, 13491029, -561030, -4733054, 518080, 15277736, + -5194763, -10362682, 5310190, -3397319, -10819023, 6873022, -6156299, -2754148, -1056025, 2710661, + -6441377, -3969087, -3316252, -1687922, 10408316, 5857799, -16273094, 9411884, -1035087, 4695473, + -7478612, 3425773, 4430796, 2902861, 3489661, 3073049, 7479686, -2017561, -1096290, -1655173, + 645319, -3215857, 56371, 9061307, -3616899, -4448513, 10790032, 2511482, -1774358, -2826625, + -4693326, 198642, 3999152, -256624, 1048509, 94489, 3062312, 3723200, -3156264, -794569, + 203474, 1435056, -3285650, -1243393, 1459215, 3129421, 4317516, -2115808, 1035087, 3058017, + 1452773, 3179887, -1249299, -671626, 689342, -1927904, -955093, -797790, -1658394, -757525, + -2920041, -190589, -2394444, -928787, -100395, 827318, + }, + }, + { + { + -1056025, 32141924, 16557636, -22859964, -10030896, 1992865, 1153199, -3208878, 2787971, 3856344, + 7206419, -5392332, -2299955, -14992120, -13644037, -28285580, -18778670, -2626373, -18520972, 8691940, + -5235565, 4821101, 5631776, -4417911, -6512244, -18739480, -10378788, -5233955, -8738111, 4858145, + -15646566, 1504849, -8660265, 6833830, 2891050, 12308303, 1640678, 3157875, 6784438, -5126581, + -1243930, -3621194, -245350, -2008434, -1563905, 5376226, 103616, 3253975, 3854733, 3374771, + 5833640, 1203665, 8400956, 115964, 7836705, -2134062, 2870112, -3718368, 2735357, -2334852, + 1688459, 1409286, 1763084, -3525631, -644782, -1906429, -2393908, -1071594, 2272038, 2571612, + -3158412, -1661079, -1383516, 3699578, 47782, 1769527, -200790, 1147830, 1420560, 123480, + -1357210, 1818919, 1672890, 271657, 10737, 180926, 2095944, -252866, 22549, -420907, + 266288, -823023, -852014, 1389959, 1968706, -929324, + }, + { + 17460652, 149785904, -35497368, -3950296, 5856188, -348429, -7390028, 206158, -20883742, -3567507, + 8083129, 13321915, -6576132, -5414880, 2527588, -6927246, -2365990, -3750043, 6956774, 6521908, + -2932389, -12639015, -12764643, 8260296, 3809099, -3680787, -1109712, 10520522, -2149094, -4335770, + -5179731, 9877888, 1237488, -11812771, 12852690, 8516383, 1349694, 5140539, -6745246, 5885179, + -3698504, 6420439, 2369748, -6017786, 6675453, -1600949, 2915746, 2077154, 5366562, 2971581, + 6969658, 8455180, 3353833, 7391639, 1437740, -2189360, 4590783, -299574, 1182190, 5106716, + 2698313, 3948149, 56908, -5585605, 2193118, -727460, -2677375, -467615, 2684355, -1288490, + 1828582, -431107, 141197, 2417530, 534187, 699543, -1335198, 751082, 641024, 1723893, + 761283, -2356327, 1350767, 776315, 422517, -961536, 1366873, 1042066, -773094, -1222455, + 1567126, 851477, 610422, 2069101, 688805, -1381369, + }, + { + -2119030, 118753160, -23189066, -8553427, -4473209, 4613869, -4804458, 5433134, -7385733, -8905078, + -23308250, -21383568, 1352378, -566936, -6742562, 4808753, -1453310, -9177271, -8313983, 2774012, + -7943542, -6833830, -2908767, 2356327, 16907138, 6048925, 2337536, 1415729, 6570763, -13527536, + -6053757, -2047626, -799401, -4289062, -7474854, 853625, 350040, -6138582, 5324686, 6007049, + 1555315, -3664681, 4176856, 3213173, 1283122, 5131412, 2616172, 809601, 7081328, 1422171, + 3258270, 1819992, -3481071, 1959579, 191126, -3566434, 2787971, 1273458, 1410360, -1895691, + 362925, -530965, -895501, -1446867, 3769371, 404264, -4125853, 1652489, 2463164, 4552129, + 912144, 643171, 471910, 1461363, 884226, -1462973, -955630, 683974, 1442572, 1966558, + -384936, -1011465, -620623, -17717, -1086627, 612570, -413927, -731755, -578747, 443992, + 380641, 333934, 1227287, -787590, -339839, -709743, + }, + { + -718333, 23880556, -1679869, 7883950, -559956, 806917, -372052, 2036351, -4489852, 152471, + 1891396, -8404177, 8926553, -3448859, -33062658, 675921, -10832444, -9538049, -2565706, -4933307, + -14564234, -14547054, -1973001, -1121523, 10893111, -2317672, -8937827, 4126390, -10602127, 11538967, + 9157407, -1121523, 923955, -6246493, -2597382, -1533303, 7274064, -3792993, -2848637, 135291, + 2154463, -1184874, -7069516, -1249836, -2641942, 6228240, 5591511, 2104534, -3746285, 5119064, + 18790, -7429757, 715112, -1547262, -212601, -1619740, -166967, 3809636, 967978, -2080912, + -2334315, 1381906, 514859, 3863860, -1850057, -2211908, 583042, -483721, 1318555, -2107755, + -3869766, 1326608, -157840, -498216, -477815, 476741, -252329, 2015950, -101469, 942208, + 393526, 2289218, -1473711, 516470, -1312113, 40265, 306016, 137439, 92879, 1538672, + 766652, -990527, 380105, 627602, -683437, 445603, + }, + { + 11076184, -292373984, -9938554, -7005092, -2616172, -104153, -2028835, -898185, 15547782, -16666084, + 261456, -5497558, 11542725, 2623151, -6931004, -5195837, 6128919, -14703821, 4839892, -8990440, + -10267656, 6047851, 3776887, -4172024, -8672076, -2847027, -15264851, 1272921, -4860293, 782758, + 15129559, -8570070, 4584878, -10504953, 3030100, 5260261, -23267986, -6908992, -9334038, -2007360, + -7929584, -7895761, -461172, -117038, 1713692, 3402151, 6595459, -6601902, 7595650, 1953673, + 5187247, 2114198, -2090039, 5359583, 2361158, 1231045, -5546414, 2808372, 1242856, -48855, + -3758, 654446, -169114, -1305670, 5339181, 798864, -6361921, -393526, 2237141, 175557, + 79457, -1005022, -1422708, -666257, -1621350, -1902671, -565325, -748398, 2730526, 581968, + 1821603, -422517, 1540820, 369904, -1672353, -1069984, -689342, -266288, 592169, -722628, + -1174674, 8053, -148713, -1645509, 390305, -104690, + }, + { + 1194538, 4672388, 1777580, 642098, 3658239, 135291, -260382, 1760400, 1757179, 1029718, + 1910724, -581968, -13795435, -16760573, -54692112, -224412, 5650030, 1654099, -4843650, 8919036, + 12610024, -2012729, -12150462, -13431436, -10431402, -8062191, -9999221, -14117021, 11631845, -4278325, + -5872831, -8344048, -2369748, 11398843, 12338904, 3760781, 5439039, -609885, 981937, -10106595, + 3388729, -6581501, -6633577, 2508261, -2500745, -1855426, -1532767, 694174, 2294586, 4005594, + -2498597, 1804960, -243203, 6328098, 2428804, -2297808, 351650, 6454262, -1687385, 4229469, + -3324842, -328028, 4385162, -3573413, -613643, -881005, -2438468, 1451162, 164283, -3044595, + -5368709, 606664, -2069101, -1002338, -1973538, 1963874, 1722282, -2643016, -457951, 188442, + 500364, -140123, 38118, 608275, -991064, -2193118, 469762, 942208, -587337, 654446, + 229244, 17717, -49392, -581431, 69793, -384936, + }, + { + 43120396, -341536352, -24247774, 9126806, -1198833, 3797288, 7574712, 2231773, 1661079, -7216082, + -4119948, 173946, 9685688, -27049168, -120259, 6160057, -1269700, 19065360, -20792474, 1840930, + 5951751, 6109054, -3753802, 585726, 2328409, 9323837, -2685965, 52613, -6437619, -125628, + 157840, 994285, -702764, 2277943, -11856794, -1204202, 11482058, -7152195, 1297617, -6189585, + 5575942, 712965, -337155, -2372970, 2479807, 2994666, -9764608, 6792491, -2634426, 3237332, + 3314641, -1760400, 7078106, 3153580, 1742146, -510027, 2591476, 5628018, 2185602, 568546, + 280784, -3337190, 3834869, 759136, -2280628, 1185948, 2998424, 2222646, 1481227, 328028, + -1799054, -1785096, 2632815, 457951, -2597918, 933082, 1994476, 200253, -2659659, 2924336, + -2628520, 145492, 2495376, 231391, 1461363, -649077, 1948841, -1138703, -10201, 99321, + 170188, 1608465, -922881, -969589, 1029182, 725850, + }, + { + 1406602, 387621, 5078262, -1131187, 1567126, 1218160, 879395, -4216048, -4156455, 5564130, + -3956739, -365072, 4832, 9951439, -2983392, -2626909, -10539313, -36674188, 12838194, -34335580, + 1808181, -11274, -3548717, -6971269, -2961917, -6186364, 4603131, 4119948, 6002754, -32789390, + -14176613, 5168993, 1364189, 14170171, -741956, -725313, -1491427, 7218767, -4080219, 2139431, + 4012036, -5407901, 2156074, 274878, 221191, 8782134, 1909650, -4717485, 2050310, 188979, + -1893544, 2776160, 2528662, 2618856, -1298154, 3277060, 1304060, -7089918, 960462, 2208687, + -2960843, 3701725, -3335579, 862215, -970126, 1610613, -4566087, 2359548, -1651415, -234613, + 4020626, -752693, -852551, -1068910, -2880849, 857383, -811212, -830002, 950798, 2292976, + -934692, -1950452, 1606855, -1265942, 1737851, -1279363, -265751, -1991254, 1203665, -556735, + 692027, -361851, 26844, 332860, 72478, 695785, + }, + { + -43431248, -396807744, 26431766, 34184180, 591632, -1273458, 6720013, 2005750, 6869264, 9212705, + -19850266, -5544266, -8906152, 16672526, -9780177, -740882, -5011690, 11157788, -5066988, 418222, + -4594005, -8294119, -3138547, 10529649, 7322383, 6456947, -3348464, 3576634, 4739497, -2706366, + -5915781, 6305012, -3315178, 6590628, -3710315, -3238405, -4065724, 7359964, 523449, -11586211, + -8903467, -796180, 805306, -3090229, -875636, -2721936, 7422241, 5443871, -4077535, -4452808, + -2816962, -4694936, 3134789, 3308736, -5357435, 3896072, 2748779, 3656091, 1401770, -165356, + -1922535, -1205275, 3932043, -1953136, 1006633, -704912, -250182, 1800665, 762894, 1717987, + -507343, 1709934, -138513, -1841467, -348966, -960999, 1163399, -167504, 1064078, -59056, + 1318555, 6442, -335544, 2292976, -1316408, 471910, -916976, -1667521, -874026, 2091112, + 953483, -784905, -470836, -1641214, -215285, 1968706, + }, + { + -4781909, -15111842, 10331544, -3146064, -14993731, 4503810, 4307852, 4306779, 2672544, 6052683, + -1154809, -4132832, -2668249, -24176908, -21080236, 2484102, -19461570, 13932874, 48187924, -14700599, + 1007707, -8964670, -6170795, -9423158, 17769890, -1621887, -1096290, -7012071, -6777996, -7380902, + -11164767, 1913408, 11982422, 7556458, 46708, -3279745, 956167, 13017509, 1122597, -12472048, + 4137127, -2952253, -263067, -876173, 6365679, 3623342, 3342558, -762357, 5209796, -909459, + 8100845, -1493038, -6518150, 108448, -6143951, 4839892, 2463701, 180926, -8705899, 2574833, + 3419331, 1392106, -1044214, -460635, -1229971, 2010045, -995896, -5874979, 4161287, 1381369, + 2085207, -3311957, -2328946, 1348083, 831076, -978179, 2423972, 462246, -1185411, -1191317, + -314069, 1331977, 2088428, -798327, -760746, -1613297, 1344862, -368830, -135828, -1345399, + 1403381, -528281, 2670933, -1468879, 374199, 1316944, + }, + { + 21157546, -246447904, -2017024, 10850161, 5231270, 12321724, 18292266, 3229816, 3619047, -14674830, + -4631049, 12509629, 18887118, 11058467, 6008659, 3789235, -4620848, -552977, -11310260, 7488813, + -17001628, -3899830, -4850092, 1397475, -6236830, 8419747, -13774497, -205085, 5144297, 9660992, + 2116345, 2649995, 3892314, -8096550, -930397, 2952790, 9301825, 990527, 3170760, 2634963, + 3358128, -6394670, -4825396, -8764955, 450435, 2910377, -4626754, -3590593, -2989297, 5870684, + -9430674, -7851737, 763967, -1007170, 4871567, 1256815, 3695283, 2079301, 2754685, -2094870, + -4122095, -5647882, 2002529, 186294, -219580, -3800509, -2077154, -1443646, 2392834, 2885681, + -1290101, -956704, 848256, 2135136, 1892470, 1603097, -317828, 570694, -3578245, -894427, + 1089311, 583042, -2864206, 869731, -753767, 743029, 448287, -90194, -1249836, 1115081, + 932008, 1050656, -302258, 587874, 1497870, 578210, + }, + { + -2254321, 46684148, 11242614, 557272, 9555228, 3820374, -414464, -1328219, -4334696, 5997385, + 9574556, -8295193, 21795348, -6536940, -2135136, -16376710, 19963008, -6790880, 9593883, -17218524, + -3468723, 7374459, -14379551, 31527744, -15675020, 1725503, -3608310, 8519068, 3505230, 15936476, + -4831302, -13120588, 26124138, -3519726, -10732050, 8448738, -9835475, 13999983, 9117679, 14146549, + 10146860, -3795677, -242129, 6948184, 6414534, -9478993, 4284230, 1220308, 5032628, 2375654, + -3819837, -694711, 1771674, 1002875, -7471633, -3827353, 456340, 1351841, -2167348, -194884, + -3570729, -862752, -463320, 425202, -3076807, -1076426, -3283503, 12348, -1143535, 722628, + -350040, -52613, 1050656, -1522566, 3890167, 3382824, -3167002, 1991254, -139050, -1235340, + 3675418, 1821603, -512712, 2660732, -1320703, 1358283, -484258, 13959, 1974074, -358630, + 323733, -193810, -1156420, 734976, 438087, -1174674, + }, + { + 1233729, 182113056, 1316944, 1617055, -12113418, 24406688, -16455630, -14671608, -36153960, -4112968, + -10447508, 6768869, -4708895, 370978, 2716567, 5817533, 7975218, -4123169, -10921565, -732292, + 5660230, -8626442, -16276852, 1929514, 9732933, 9439801, 10327786, -279173, -13145284, -5146445, + 3775276, -3266860, -81604, -1240172, 1083942, -1690607, -6060199, -8144332, -2224793, -10449119, + 795106, -1964411, 3335579, 1349157, -6824703, 1101659, -3748970, -6627135, -3728032, 811749, + 5616744, -5027259, 1910724, 6488622, -2828773, -255551, 3218541, 5713380, -497679, 1097364, + 2877628, 4904316, 98784, 1423782, 2252174, 1043140, -2597918, 2191507, 4998805, 740882, + 1877975, 130460, 606664, 1642288, -1227824, -35970, -1995012, -1618129, -3422552, 3320547, + 958315, 641024, 443455, -1405528, 544387, -50466, 880468, 455267, 786516, -2129767, + 1971927, -897648, 239981, 321586, 227633, -198105, + }, + { + 6831683, 35669168, -11880953, 10786810, -2644089, 4704063, -10935524, -207232, -9823664, -10012643, + -5651103, 1430761, 1239635, 24888262, -25872882, 7214472, -15599321, 5498632, -1544041, -15327128, + 34049428, 5927055, 1350767, -7168838, -15795279, 9767829, 14597520, 30242476, 2361695, -3588445, + -15870441, -1750199, -2335389, -4971962, -8636105, -12033425, 12920335, 2453500, -2393371, -1937567, + -8099235, -7009387, -1660542, 244813, 923955, 1712081, 1438277, -1084479, -5058398, -3820910, + -2396055, -2129230, -636192, -1996623, 2533494, 340376, -6091338, 2186675, -1800128, 863825, + -826781, 1087164, -631360, -900333, -68719, -688269, 1771137, -462783, -105227, 1509681, + -1332514, 4112968, 7154879, -2633352, -678068, 3003256, -127238, 150324, 287226, 1580548, + -2594160, -821949, -92342, -3154117, 56371, 725850, 426276, 1600949, -2287070, -658741, + 1034550, 1300301, 607201, 781147, -417149, 496069, + }, + { + 24074902, 75182328, 3749507, -2719788, -13708462, -3293166, -1360431, 21818970, 5280126, -7992398, + 12069932, 22659174, -8328479, 10433549, 28362354, 11324218, 10424422, -488016, -9284109, -433255, + -16639777, -10716480, 3065533, -2682744, -3326989, -4188130, -10123238, 1697586, 4063039, 8398272, + -7771207, 3991098, -10737, -2810519, -6569690, -8128763, -14106283, 8191577, -10481331, -2418067, + -7314866, -5195300, -4529580, -3000035, -421444, 1899986, 3221, -7528541, 3180423, 2112587, + 181462, -1827509, -50466, 6346888, -2472828, -4858682, 4483946, -1478006, -1385664, -1181116, + -708670, 1356136, 2977486, -508417, 1489280, -5906, -629213, 1825898, -2012192, 1743757, + -2431488, 761820, -35970, -99321, 646929, -1340567, -340376, -1628330, 746787, -583579, + -2012729, 2728378, -959925, -390305, 491774, -1500017, -405338, 1382443, 644245, 278636, + -1224603, 1138703, -790811, -964220, -115427, -214748, + }, + }, + { + { + 1659468, 43694312, -1130113, -5679021, -15483357, 504659, 954020, 2163053, -4516695, 16495359, + -4649302, 7646116, -18400176, -1056025, -32696512, -11315091, -20421496, -14693620, 1362042, -1345935, + -5236102, -4093104, 4343286, -11688753, -1453846, -6610492, -17100950, -10096394, -13415330, 3228205, + 772020, -4634807, -7413651, 6628745, -2984466, 11326903, 501437, 10735271, -3810710, -2397666, + -6116571, 1613297, 3354370, -7553774, -4592394, 8625905, 4913443, 2390686, -1086090, 4668630, + 3234110, 2166811, 7222525, 3835943, 5464272, 2379949, -2587181, -1845225, 1687385, -1592896, + 2546379, 3973382, -1233193, -429497, -872952, -756988, 48855, -2398739, 1759326, 2710124, + -2399276, -1860795, 203474, 4734665, -315680, -352187, 2276870, 231928, 1918240, -526134, + -236760, 510027, 1669132, 1212791, 974421, -736587, 549756, -206695, 649614, -189515, + 140660, -696858, -153008, 1110786, 1452236, -600222, + }, + { + -19493246, 123713848, 11343545, 13790603, -5155035, 24696, -777389, -14802605, -10577968, 919123, + 11311333, -5759015, -689879, -9993852, 1882269, -23429584, 4361003, 7385733, 590021, 2042794, + -5702643, -11628087, -9985262, 12384538, 198105, 8189429, -1901597, 1420560, 3032247, -1911261, + -6245420, 2260764, 2528662, -10234370, 9177271, 9725953, -293668, 6874095, -52613, -2857764, + -3380139, 563178, -762894, 4434017, -2499671, 3121368, 1244467, 7129109, -282394, 4796942, + 5199595, 4845260, 6873559, 7007239, 3751654, -3352222, 972810, 2565706, 2767033, 6812892, + -1906966, 3598646, 2224793, -442919, -2442763, 1289564, -3320010, 798327, 2026151, -655519, + 1349157, 90731, 1680406, 670552, 312459, -96100, 1888712, 363998, -617402, 849330, + 421981, 507880, -110595, -12885, 426812, 575526, 753230, 881542, -388695, 55835, + 547608, 850404, 544924, 2092723, 649077, -1578937, + }, + { + 260382, 76726904, 6925635, 6446746, -13419625, 100932, -3051038, 2639258, -3904662, -11500312, + -16299938, -16360604, -4639102, -120796, -4641786, -3500398, 1455457, -5033702, 2887292, -15834471, + 4831302, -11519639, 5240934, -6672769, 2806761, 6775848, -936303, 5021354, -2087354, -10607495, + -14858976, 8104067, -3122441, 1903207, -8574902, 675384, -1539746, 517007, 3125663, 6408628, + 711891, -840203, 8326331, -4850092, 2586644, 9292162, -277025, 3247532, 6512781, -486405, + 4660040, -1338956, -3412352, 2288144, 2214056, -4567161, 3856881, -1977296, 1226213, -2241973, + 4338991, -4414690, 3062312, -2394981, 2938831, 852551, -956704, 154619, 2664490, 3286187, + 2426657, 274878, 312459, 1324997, 846645, -1749125, -1255741, -666794, 1782948, 717260, + -985158, -271120, 774168, 618475, -1257889, -204548, -5906, -876173, -326418, -3221, + 322123, 803696, 359704, -882079, 172336, -288837, + }, + { + -306553, 20314658, -876710, 4720169, 4095788, -465467, 1447404, -2782602, -2041720, -164819, + -149250, 637266, 3650722, -8075076, -31554588, -12404402, -5463199, 9184788, -6764574, -14079440, + -14340359, -40802, -14914811, -2159832, 12933757, -10737, -7283191, -8373039, 5345087, 3029563, + 1351841, -6722161, 1050656, 11689827, -9520869, -5392332, 14410689, -9658308, 5167920, -4388920, + 1225139, 18790, -6068789, -900333, 242666, 3473555, 1486596, -1910724, 9702868, -1163399, + 217433, -3184182, -3461744, -360240, -776852, -1167694, -1163399, 4221953, -785979, 1402844, + -2518998, -183610, 3606162, 1989644, -2416456, 1693828, -253940, -1724429, -663036, 391916, + -767725, -2164664, -234613, 978716, -1206349, -653909, 366146, 2885144, 342524, 183073, + -405874, 1898912, -147103, 202937, -406948, -818191, -20938, -490700, 1294933, 1474784, + -353261, 345745, -774168, 619012, 386010, -380105, + }, + { + -30802968, -281631744, 15406585, 1222992, -3622805, -722628, -2847563, 5669357, 2746095, -2742874, + -1529008, -2319282, 7543037, 431644, -6064494, -16800838, 5044976, 6200859, -2367601, -12514461, + -8107288, 9126806, -8652748, 1247688, -5204427, -8539469, -9585830, -2993592, -8883066, 5711233, + 9028558, 1235340, -4303557, -5238787, 3524558, 4319127, -16750909, -16441672, -9619653, 1080184, + -5395553, -4573604, -4254165, 661425, 156766, 995896, 6794639, -5607080, 4013647, 7373922, + 1960116, -677531, 2416456, 5601174, 2869575, -1509681, -3277060, 2660195, -2724083, 2441689, + 523449, -430570, -874026, -55298, 1719598, 1333051, -3717831, -664109, 2143726, 227633, + -605590, -1981054, -2893197, -360240, -3110093, -567473, -434865, -317291, 1650341, 1012539, + 369904, 649614, 671089, 483184, -459025, -2189360, -8053, 217433, -1280974, -1184874, + 256087, -842350, 610959, -1758789, 281857, -1011465, + }, + { + -613107, 17244830, -2179159, 1318555, -263604, 244813, 879395, -1362578, 4281546, 4213900, + -6009196, -1866163, -6863358, -29739428, -65799436, 12357695, 941135, 106837, 6390375, 11014981, + -3394098, -16073378, -157303, -10952167, -13445932, -12976170, -1905892, -15555298, 9783399, -2681133, + -10838887, -1414118, -11611444, 13276281, 14261976, 4010963, 1612223, 531502, -972273, -494458, + -4261145, -6036577, -4191888, -5083631, 3959960, -3845606, -537, 3654480, 1670742, -3579318, + 1968706, 754304, 2828773, -111669, 4527970, 1977296, -1835025, 6324340, 69793, 2334315, + -4877472, 76773, 2129230, -1473174, -1861332, -2537252, 2587181, -1842541, 845572, -584116, + -2773475, -541166, -3571802, -3645890, -111669, 163209, 3215320, -789200, -1592896, 2478196, + -439160, -478352, -45634, 133681, -1697049, -92342, -718870, 1370095, -404801, 173946, + -17180, 92342, -192200, -733366, 1132798, -805843, + }, + { + -65582540, -257999216, 15594489, 17696876, -1660005, 1828046, 4052839, -5189931, 9891847, 10537165, + -5113159, -4283156, -3485903, -13158169, -12601971, 5074504, 8609799, 6598681, -8122857, -930397, + 5648419, 826244, -8698919, 7119982, 4344360, 3784940, -1128503, 3447785, 956167, -8014409, + -820339, 5902359, -2614025, 168577, -4511863, -3622268, 3099893, -7102802, 5363341, -891206, + 2042794, -2709051, 5804112, -5163625, 5160940, 532576, -4736812, -2737505, 2856153, 4947803, + 2138894, 7856032, -5908265, 2425583, 5788542, -2034204, 3520263, 4256313, 1739462, 828392, + 397821, 829466, 368830, 3743601, -2521146, 1764695, 370978, 2485176, -932008, 1129576, + 1423782, -1170916, -526670, -626528, 1234803, -11811, 796716, 1605781, -1660005, 1221918, + -1192390, -198105, 1258962, 1167157, 996432, -225486, 1269163, 172336, -300111, -91268, + 67109, 408559, 186831, 435402, 149250, 1648731, + }, + { + -408022, 17659294, -7078643, 2522220, 45097, 2114198, 1341640, 1488743, -7792145, 2312303, + -6353331, 2733747, 7087770, 1865626, -6147709, -9663676, -13796509, -16086263, -9734007, -22100292, + 4868346, -13201656, 8527658, -11456825, -1660005, 3285113, -660888, 13091060, -12391518, -28672128, + -11480984, 7733626, -4299799, 13937169, 3946001, -3444564, -2134062, 11154030, -7598334, 6259378, + 8945343, -10517301, 6132677, -4359392, 3578782, 2481417, 3802657, 1819456, -5888400, 1478006, + -1014686, 7853348, -2332167, 3828427, 4320737, 1639604, -2363843, -2910914, -1786170, 938450, + -1040993, -1235340, -477815, 2155537, 730144, -2346126, -1221381, 1353452, -1668595, -131533, + 3236258, 132070, -1530619, -375273, -421444, -1845762, 137976, -195421, 641024, 2122251, + -1600412, -2082522, 2030983, -989990, 588947, -973884, 24159, -1392106, 380641, 266825, + 766652, -926639, 108448, -320512, 828929, 94489, + }, + { + 13789529, -432349120, -9316858, 37692632, 6614250, -6586333, 9441412, 2237141, 7334194, 2596308, + 10031433, -32259500, -7840463, 7767449, 8599061, -21467858, 10155987, 9037685, -2418604, -2457258, + 1271847, -14106820, -2142115, 11009075, 7947300, 1110786, 1835025, 1000727, 1811403, 1659468, + -669478, -1690607, -5004174, 9897215, -3594351, -5173825, 1263257, 3148211, -6870337, -5577552, + -11755325, -2580739, -1453846, 1780264, -2351495, -2221035, 6360310, 4881231, -5039608, -167504, + -1143535, -7447474, 4519380, -2344515, 4657355, -462246, 3080565, 3932043, 766115, -74088, + -2269890, -936303, 585189, 136365, 794032, 904628, 5369, -714038, 1534914, 731218, + 1824287, 572304, -2482491, -517544, 1098975, -394063, 45634, 1597191, -715112, 337692, + 803159, 326418, 170188, 2047626, -731218, -1403381, -710817, -1363115, -470836, 1398549, + 782758, -610959, -843424, -643708, -665183, 1723356, + }, + { + 4402342, 24000278, -20638392, -10007274, -11377368, -4130148, 11584064, 11420318, -3773129, 9361418, + -11887933, -2324651, -11295764, -24926380, -12458090, 153545, -4541928, 6148783, 13810467, 14764487, + 3675418, -9804337, -6129992, -5861557, 4399121, 2236604, -3870839, -12070469, -6546604, -4025458, + -1159104, -4667556, 10943577, 16042777, -5806796, 351650, -7486665, 21470004, 1228361, -11120207, + -606664, 1439351, -8379481, 5412733, 2002529, 7183333, 1577327, 2310156, 2073396, 3308736, + 5296232, -1016297, -1560147, -4778151, -2421825, -43487, 1527398, 1326071, -3729105, -113280, + 6309307, 1425929, -4292820, 1824824, -1005022, -170725, -3052111, -3672734, 4619774, -78383, + 5130339, -3076807, -3811784, 386010, 2335389, 1685238, 391916, -337155, -675384, -2082522, + 1414655, -1064078, 1513439, 1261647, -502511, -1166084, 92342, 125091, -1316408, -375810, + 955093, 535260, 1667521, -1088237, 703838, 991601, + }, + { + -22715546, -242671552, 27535572, 22225918, -18429168, 27138824, -2397129, 14084808, -8698919, -6353867, + -6542309, 10031970, 16514686, 34616900, -12924630, 5430450, -11161546, 1603633, -9094593, 5031554, + -3446175, -4982699, -7240778, -10573673, 4159139, -494995, -5663452, -1707250, 771484, 11167452, + 6093485, 638876, 1045825, -2805688, 3115999, 4617090, -782758, 3008088, -5614059, 7562364, + 4290136, -4291746, -8140037, -4775467, -2543695, 2164127, -2317672, 192200, 3037079, -5430986, + -8883066, -6760816, -2700461, 7911330, 1111860, 4146254, -1792075, -439160, 5907728, -2885681, + -3190087, -5768141, 1936493, 785442, -2138357, -1207423, -3002182, -3107946, 3437048, -1001264, + 423591, 2835752, -23085, 767725, 4185983, -551366, 351114, -1055488, -3451543, 670015, + 945430, -233002, -2273112, 285615, 782758, 767725, 340376, -355409, -750546, 495532, + 772557, 656593, 1014686, 596464, 387621, 213138, + }, + { + 1212791, 57120380, -9315247, 8318815, 10450192, 7386807, -806917, -5233955, -2434173, 2804614, + 2126546, 1678795, 564788, -19940996, 45847164, -12065100, -7490423, -1639067, 25330644, -15655693, + -4089346, -2389076, 3927748, 9267466, -6273874, -11809013, 8712878, 13330505, 3746822, 5954436, + 5203353, -3019899, 15180562, -6738267, -4700305, 2457258, -3048890, 7066295, 15782394, 8243116, + 8967355, -737124, 564788, 7953743, 1286880, 4987531, -595927, -3008088, 3094524, 2496450, + -2157684, 3414499, -5906654, 195958, -3717294, -241592, 2237141, -4091493, 4115653, -3228742, + -3570192, -3430068, 1513439, -372588, -2765959, -4251481, 3075197, -1337346, 411243, -2032593, + 907312, -1577327, -1384053, 4167192, 2424509, 185220, -1509681, 2315524, 1285806, -553514, + 584116, 2506114, 88584, 847182, -132070, -466541, -312459, 847182, 754304, 1100585, + -660888, -599685, 92879, 1280974, -1246614, 588411, + }, + { + 31481036, 167113424, -32633698, 28570122, -18475338, -6715718, -5379447, -12356084, -22699976, -19477676, + -9053254, -11516418, 4145180, 1056025, -1463510, 17522930, -6660421, 6940667, -11511586, -5376226, + 15472620, -20029044, -9550397, 10825465, 13274133, 3957276, 4693863, 6955700, -202400, -6364068, + -5103495, 1793149, -12344273, 8447664, 2269353, -1960653, -1774358, -16052440, -4221953, -1331977, + -1550483, -6307160, 8311299, -4930086, -1976759, -4415764, 3878356, -2241436, -8994735, -1791538, + 945430, 437013, -3540127, 10198937, -4216584, 4505958, 2262911, 6549289, 389768, -3016141, + 4904316, 2263448, 681826, 1693828, 3959960, 1265405, -1214939, 1759326, 2137820, 1891396, + 3092377, -410169, 2212445, 472983, 634045, -1830730, -2029909, -2629594, -264677, 419833, + 4236449, -2386391, 1586454, -1388348, -1868848, 3433826, -107911, -1353452, 1376000, -327491, + 243203, 493384, -527744, 1330366, -24696, -914828, + }, + { + -7019587, 15181099, 16768089, 4073240, 5211406, 6684043, -13003550, -6158983, 1838783, -12561706, + -872415, -393526, 2696703, -24519432, 43195560, -4212289, 10876468, -8980777, -19085224, 24189792, + 4064650, 11868068, -2536715, -13620415, -13289703, 4772783, 16028281, 25185152, -5537287, -3910031, + -4922033, -10950556, -5500243, -373662, -15261093, 4545149, 1724429, 2667175, -4105989, -4454955, + -6150393, -3368328, 906775, -3903589, -71941, 6240588, -3965329, 142808, -4903779, -1096827, + -6402723, 3374771, -4917201, 1312649, 1601486, -188442, -6479495, -3533148, 3444564, -2661269, + 4000762, -150324, 650151, -312459, 2005750, 544924, -3716757, -1574642, 3396782, 1581622, + 2168422, 3809099, 3693135, -502511, -2215666, 3019362, 358093, -1051730, 69793, 1017370, + -1523103, 112743, 636192, -1774358, -1462973, -866510, 1442035, 681289, -1291711, -583579, + 1430761, 306553, 394600, 905701, 294742, -296890, + }, + { + -7113540, 126151776, -8680129, 2920578, -15522549, -19883552, 13873281, 10191957, 6629282, 2054605, + 15210627, 17116518, 3558381, 13173738, 9708774, -402116, 21347598, -6773164, 2871186, -2418067, + -11730093, -4393752, -2061584, -6754910, 6888591, -23833848, 1854352, -3272228, 282394, 20447266, + -5288179, 3526705, -6584722, -5443871, -3829500, -8205535, -3262028, -13764833, 5983963, -11077258, + -8839580, 4701916, -13041668, 4594005, -2853469, -181462, -2510945, -3563212, 10349261, -187368, + -129386, -3499325, -1918777, 1976759, 3405909, -1773285, -1390496, -241592, 1850057, -1118302, + -2471217, 2655364, 150324, 1916629, 799938, -1405528, -1835562, 930397, 1551020, -988379, + -751619, -207232, 1059783, 394063, -180389, 25770, -2861522, -372052, -417149, 587874, + -1984812, 496069, 863288, -2073396, -30602, 855772, 578210, -335544, 1957431, -1057636, + 790811, 167504, -81604, -679679, -1087164, -724239, + }, + }, + { + { + -1377611, 26974006, -11714523, 15314243, 6136435, 788127, 3769908, 7408819, -1481764, 9885941, + -9555765, 14015552, -19273128, 688269, -26709328, 12967043, 2658585, -872415, 7468412, -15247134, + -13518946, -13762686, -3675418, -27098022, -9053254, 5835787, -9786083, -5213017, -11176579, -11405823, + -10476499, -2422899, -577673, 7712688, -5547487, 9488120, 2098629, 9423158, -6889128, 1898376, + -2800319, -713501, 2191507, -2196339, 2586107, 5617281, -790274, 3118146, -766652, 1859184, + 151398, -1892470, 2724083, -201327, 805843, 315680, -4432406, -933082, 4846334, 1966558, + 4270808, 2368675, -599685, 5050345, 3754875, 739271, -322659, -728534, -73551, 2157147, + 876710, 505196, 1378148, 2888903, -1317481, 1048509, 1959042, -1713155, 1320166, 511638, + 562104, -1584306, -468688, -181462, 1193464, -627065, 19864, 411780, 1122597, 158914, + -125628, -1202054, -343061, 397821, 585726, -456340, + }, + { + 16781510, 106806712, -29781840, -2672544, -14772003, 2020245, -3032247, -3692061, 2252174, -8607114, + -11590506, -15705622, 6040872, -7547868, 8546985, -6709813, 8542690, 1709934, -337692, 1133335, + 4288525, 8925479, -2445447, 2981244, -7542500, 9917616, -2260227, 3019899, 7698192, 3501472, + -6847789, -2328946, -947040, -5781026, 3689914, -1995012, -2258079, 1986422, -2765959, -5367636, + -8398272, -6986301, -2115272, 5288716, -9368397, -508954, 111669, 6388764, -5161477, -227633, + 2942053, -368830, -893890, 1936493, -2146410, -5570573, 192200, -188979, -719944, 2236604, + -3010235, 2775623, 736050, -243203, -1637993, 2177012, -1396401, 3974992, 1964411, -300648, + 533650, 635118, 3140158, 591095, 2046015, 1180579, 2647311, 150861, -1345399, -1487132, + -1134945, 2473901, 426812, -1269700, 170188, 1535988, 345745, 283468, -772557, 344134, + 836445, 699543, -75699, 734976, 359704, -518080, + }, + { + 912144, 24743844, -22196928, 33037962, 3935264, -2644626, -6556268, -482110, -237834, 3925063, + 14539001, 5364414, -2943663, 14147622, 11687680, -1377074, 4440996, 11978664, 15969762, -11262478, + 10928544, -14331232, 6584722, -3923990, -6211597, -346819, -8797167, -6912213, -6612639, -6348499, + -7057705, 12948253, -6578280, 1864553, -6641630, -1979443, -45097, 3975529, -2025077, 7391639, + 2656974, -728534, 4911832, -8056285, 2690797, 7546795, -609349, 839666, 328028, -3352759, + 4882841, 70867, -4336843, -2592013, -2260227, -5076115, 266288, -2687039, 3193308, -2233920, + 4180614, -3775813, 4675072, -772557, 405338, -163746, -606664, 452045, 4032974, 758599, + -1372242, -1093606, -678605, -726386, -331786, -1846299, -1023813, -703301, -961536, -1605244, + -781684, -384400, -340376, -18790, -829466, 187368, 1223529, -537, -599148, 201863, + 64425, -309775, -380641, -331786, 1090922, 900869, + }, + { + 1184337, 26674968, 2776160, -2526515, 29528, -343597, 565862, -2348810, 1349694, -2573222, + -4642860, -1482301, 5924371, -4731980, -13475460, 29572460, 20386600, 665720, 1550483, 2830384, + 8082592, 15904264, -10104984, 2269890, -586263, 7783555, 8504035, -21261162, -526670, -9063455, + -5582384, 814433, -5284958, 12262132, -92879, -9723269, 6924024, -9235253, -1520418, -6718940, + -149250, 3227131, 2620467, 6963216, 4789963, -6981470, -9754944, -4108136, 4982162, -4397510, + 2884071, -1326071, -3171833, -1401770, -506806, 3071439, 1756642, 1221918, 527744, 6759205, + 2901251, -25233, -1516660, -344671, -992674, 3095061, 631897, 900333, 250182, -257161, + 2826089, -130997, -1446867, 834834, 1381369, 836982, -911607, 574452, -849330, -768799, + -1770600, 89121, 330712, 850404, -137439, -316754, -642098, -1542430, 37581, -70867, + -488016, 525597, -984621, 413927, 13959, -1099512, + }, + { + 44453984, -243696448, -28391882, 17664664, 5859946, 1834488, -510027, 8242042, 842887, -5176510, + -11084237, -4523675, 7035157, -4313758, -5464272, -6120866, 17598092, 9832254, -801011, -2201708, + -346819, 639950, -20623896, 4707284, -228707, -879931, 2782065, -7792145, -15520401, 9508521, + 9950902, -1260573, -9338333, -1307818, 2811056, -542777, 5443871, 8040179, 8443906, 8438537, + -2379412, -2742337, -11179800, -6650757, 2624762, -850940, -1950452, -3233037, 4944044, -682900, + -5629092, -1887101, 2608656, 3911105, 1552631, -4228932, -2605435, 1971390, -4236449, 2081449, + 288837, -1655710, -3226594, -1155346, -172336, 2301029, 1315871, 1198833, 905701, -456877, + -65498, -1335735, -1991254, 525597, -4664335, -191126, -629750, -1112397, 265214, -433255, + -9664, -258235, -136902, 1619740, -443992, -1692217, 1292248, 656056, -1152662, -543850, + 1176821, -132607, 1678259, -927713, 641024, -810675, + }, + { + -650151, 6317360, -8517457, 2198487, -1167694, -141734, 89657, -2009508, -39728, -3878356, + -8592082, 4095788, 1847910, -6553583, -45891724, -16262357, -22831510, 3938485, 563714, 7593502, + 3569655, -9284646, 6526203, -8921184, -9682467, -2468533, -3017215, -21919366, -12793097, -19848118, + -2596845, 10401337, -11905649, -3543348, -1339493, -628139, -2250563, 3103651, 2309619, 1561758, + -3674882, -468688, 748398, -6393059, 584652, -3899294, 982474, 5469104, 833761, -5954972, + 804770, -105764, 456340, -3869229, 5811091, 1372242, -6151467, 2453500, -1403917, 3948149, + -2246805, -266288, 1005022, -722091, -1380832, -2062121, 3322157, 916439, 3003793, 1629403, + 1639604, 2197950, -2615635, -1362578, 961536, -3170223, 682363, 572841, 352724, 2598992, + -992674, 65498, 428960, -195958, -258235, 900869, -592169, 1450088, -972273, -187368, + 789200, 774168, -743029, -588411, 1345935, -721555, + }, + { + 72727752, -153870432, -47540992, 40022116, 11057930, -22012, -1344862, -15895137, 395674, 4968204, + -2542084, -1122060, -8202851, -6306623, -5370857, 11674258, 7284802, 6495065, 5616744, 2134062, + 1388885, -6742025, -9539122, 2408403, -1064078, 611496, -319438, 6892349, 5813238, 527744, + 437013, -2093260, -5555004, 3376918, -2747705, -4961761, -1327145, -14125611, -853088, -939524, + 2407329, -134218, 11194295, 1759863, 12095165, 4767951, 122943, -1765232, 1020055, 1644436, + -1235877, 7262253, -7741142, 732829, 6034966, -3423626, 1571421, -1488206, -1490891, -296353, + 1000727, 4647692, 611496, 2280091, 201863, 1778653, -5368172, -1561221, -1694902, 2912525, + 2785286, -388158, -1187022, -1732482, 2001455, 39728, 260382, 2979634, -6979, 1068910, + -372052, 99858, -132070, -880468, -175557, -779000, 398895, 113280, -1611, 1176284, + -173409, -244276, 736050, 281857, -648540, 72478, + }, + { + -1296006, 6168647, -15374372, 2079301, 520228, 664646, 783295, 1682554, -7037841, 1622961, + -3723200, 4880694, 1458141, -14409078, -16664473, 7171522, 16320339, 2411087, -12153684, -135828, + 33729452, 5994701, 24628416, -1148904, -1299765, 9907953, 7021735, 12928925, -14285061, -1698660, + 8676908, 6403260, -347892, 19981798, 8477192, 244276, 920734, 7205345, 128849, 6724845, + 3257196, -9460202, 5312875, -287226, 4844723, -2354716, -324807, 6033892, 116501, 1342177, + -1323924, 1307818, -5559299, -214748, -1263257, 2659122, -1927367, 438624, -1327682, -1872069, + -708133, -2993592, -1234803, 2311229, -549756, -3128884, 1236951, 403727, -1863479, 824097, + 2572686, -1004486, -1257889, 301185, -580357, -1304060, 671089, 592169, 1132261, 1432372, + 331249, -916439, 1635846, 1075352, -270046, -1549946, 1136019, -470299, 806917, -402116, + -157840, -1158031, -694174, -462246, 343597, -628676, + }, + { + 16157667, -406241632, 2036351, 52777096, 13452911, -10241886, 1083406, -1722819, 8130910, -2989297, + 22189948, -4803921, 12438225, 15877957, 24910810, -15637439, -396748, -5332202, -3027415, -6446209, + -1963337, -8362838, 3758, 6040872, -1027034, -3470334, -3515431, -6149857, -471373, 1100049, + -7863012, -6488622, -1224066, 3695283, -9819369, -1585380, 5630166, -3096672, -9551470, 1512365, + -4323959, -1045825, -1146219, -877247, -1898912, -1039382, 235686, 1218697, -374199, 11148124, + 7339562, -4849018, 3179887, -4138201, 4949950, 965294, 1897839, 1758789, 3912715, 2570538, + -2418604, -916439, -2056216, -834834, 1556926, 494458, -505732, -267899, 3088618, 1640141, + 2670933, 1079647, -2313377, 240518, 1828582, -904628, -1262184, 1047972, -657667, -628139, + -772557, 454730, 143881, 762357, -619012, -219580, 359167, -1644973, -1427540, 770947, + 787590, -503048, -204011, 164283, -1207423, 1491427, + }, + { + -3670587, 53792856, 8395587, -4719096, -2297808, -7168838, 6618545, 6046777, -3777424, 10385231, + -14855218, -5414880, -1697586, -10428717, -9611600, 4864588, 1335198, -7438347, -18254148, 12206297, + 12822088, -11443403, -9270687, -12407624, -10723460, -3681324, 2500745, -2900177, -135828, 8724689, + 7196218, -4260071, -3368328, 8764955, -8140037, -706522, -9569187, 11161009, -2217277, -6239514, + -1772211, -1284195, -4578972, 6659884, -5826123, 4113505, 257698, 3508988, 4667556, -649077, + -3136937, -4225174, 1297080, -2365453, 372588, -1172526, -1834488, -1535451, -5301064, -1062468, + 5423470, 993211, -4056597, -203474, -2381023, 2279554, 680752, -3301219, 799938, 340376, + 6058588, -8590, -1078037, 2031520, 2746095, -154619, -522375, 263067, 1451162, 128312, + 3022046, -1240709, -39192, 219580, -625455, -319975, 627065, 880468, -29528, -202937, + -280247, -35433, 363462, -1757715, -2147, 194884, + }, + { + 24057186, -245443952, -24823838, 6665789, -35250944, -14558865, -45432700, 14822469, 9667435, -1218160, + -8814884, 5478231, -5519570, 5348308, -27521076, 4052302, -9678172, 939524, -7385733, 1574106, + 1361505, -2272575, -10299868, -9494025, 1028645, -8586176, -395137, 238371, -5135171, -1551557, + -94489, 441845, 4342212, 443455, -2501282, 2528662, -2178622, 3943317, -1770600, 4892505, + -890132, -4695473, -1999307, 1161789, -2117956, 2931315, -1967632, 2128156, 4406100, -454730, + 1282585, -1550483, -996969, 6359773, -2077690, 3730179, -1745367, -63888, 4754529, -1459752, + 1672890, -818728, 2661806, -190589, -1773822, 352724, -1459215, -3272228, 984084, -3405909, + -1045825, 1884417, -681289, -650151, 1840930, -3100430, -1594507, 258772, -1078037, 1985886, + 950262, 39728, 32212, 142271, 410169, 1215476, -785442, -191663, -453656, -465467, + 392453, -290984, 678068, 968515, -277025, -547071, + }, + { + 76773, 55642376, -13594108, 4536023, 1316944, 5835250, 4002910, -6565932, 1436667, -313533, + -4865124, -486942, 3191161, -3270081, 55682640, -8630200, 1824287, 6020471, 33527588, 13408888, + 19640348, 5971079, -6525129, -4741644, -4862440, 5481452, 25710748, 20477868, 15168214, -795643, + 8397735, -851477, -595927, -2079301, 2904472, -189515, -1992865, -1641751, 4804458, -573915, + -3316252, -3313567, 900869, 6279242, 1070521, 7157563, 925565, -3063386, -1631014, -1442035, + -153008, 5399311, -5717675, 1160178, 930934, 5335423, 2630668, -2826089, 6167036, 159451, + -171799, -2571612, 5278515, 1013075, -1739999, -3777424, 4782446, -236223, 772020, -1877438, + 1635309, -608812, -1599875, 4260608, -907312, -2929168, -827855, 1385664, 103616, -291521, + -180926, 473520, -1347009, 643708, 355409, -984621, -1595580, 272730, 34897, -216896, + -685584, 93952, 780610, 1432909, -1033477, 943819, + }, + { + -54889684, 95779920, 5037997, 19902342, -22550188, -28474560, -20681342, 8353175, -4365835, -17105780, + -424665, -11843909, 3615826, 7879118, 2166274, 17614734, 4935991, 20106890, -8405788, -16631187, + 7257958, -15715822, 5154498, 20243792, 9193377, 1620276, 5078262, 1768453, 2303713, -784368, + -5091684, 552977, -6549289, 9421548, -5219996, -983548, 6651294, -6305012, 4194573, -2544768, + -4011500, 231391, 12998182, -1751273, 10082436, 2329483, 6206765, 769873, -6027987, 1611687, + 694711, 302258, -4196720, 6594923, -8181376, 1934883, -934692, 5164698, 1848983, -4085588, + 2937758, -772020, -606127, 2802466, 4363150, 1534914, -1191853, -372588, -2283849, -1043140, + 2937221, 354335, 1589675, -1366873, -650151, -1799054, 1284195, -683974, -641561, -2900714, + 1271310, -2944200, 32749, -1862942, -1555315, 2683281, 488016, -556198, 1605244, 339839, + -241592, 963146, -1400696, 434865, 444529, -130460, + }, + { + 7519951, 729071, -9247065, -3708168, -397821, 9335648, -3388192, -3235184, 12254079, 4357781, + 8099772, 8977555, 6062883, -42720428, 32102196, 1064078, 11389180, -22605486, -13267154, 19397682, + -24498494, -15103789, -14664629, -13726179, -16726750, -14645838, -9030706, -2233920, -4114042, 1701344, + 2979634, -333934, -2012192, 4621385, -5397164, 8573828, -2022393, -712428, -1114007, 1310502, + -1511829, 528818, -1536525, -5441187, -3052111, 9169218, -5152887, -5317707, -1712618, 3409130, + -5308580, 2408940, -4866735, 2736968, -2712809, -5217312, -3416647, 858457, 3706020, -1098438, + 6356552, -2774549, -1114007, 260919, 810675, -663036, -2128156, -550293, 3864397, 1472100, + 1007170, -586263, -132607, 1632088, -1120987, 985158, 438087, -612570, -887985, 1440962, + -321586, 26307, 1069447, 974958, 1269163, -43487, 964757, 129386, -184147, -623844, + -71404, -625455, 329102, 801011, 193810, 475131, + }, + { + -14421963, 143354736, -3893925, -14194867, -8977019, -22566296, 3073049, 6190659, 8683350, 10363756, + 9863929, 8332774, 5659693, 323196, -1247688, 5164162, 14265734, -7218230, 4867809, 1540283, + 3774203, 1218160, -6694244, -21918292, -1031866, -19572702, 6011344, -863825, -4860293, 19406810, + 3078955, 1107028, -4341138, 421444, 4614406, -4124779, 1197222, -20987894, 4648765, -2284923, + -5115306, 10449655, -465467, 14761266, 1542967, 748398, 1541893, 2514167, 15063524, 613107, + -2869575, -2035278, -1738388, 909996, 3101503, 988379, 2151779, 3624953, 4639102, 1341640, + -3241627, 1110249, -7516, 1678259, -1104344, -2521683, -2321430, -3700114, 955630, 1434519, + 565325, -49929, 932008, 1428077, 412317, 648540, -588411, 1496796, 92342, -61203, + -3392487, -605054, 1724966, -1513439, 1553704, 851477, -615254, 280784, 1674500, -2010582, + 57982, 165356, 1437740, -163209, -1098975, 1275605, + }, + }, + { + { + 585189, -77846, 9246528, 12181064, 10125922, -695785, 2975339, 4236985, 439697, 12907987, + -4264366, -991601, -3684008, 2978023, -32589674, 11512660, 10708964, 3332358, -8315057, -18931678, + 5913096, -19453518, -3696356, -21154324, -4955319, -9342091, -5423470, -3682398, -5153424, -16916266, + -7402913, 1315871, -5643050, 12465606, 76773, 7750806, -1168768, -2903935, 2437931, 2933463, + -922881, -2973728, 1707786, 1515050, 5220533, -3425773, 1614908, 6288906, 2663417, 2351495, + -3596498, -3623879, 2085207, 90731, 3133179, -2204929, -3196530, 691490, 1981591, 2266669, + 3721589, 3773129, -492311, 3828427, 2869575, -523986, 1276142, -827855, -893353, 1422708, + 1582159, 1992865, -24696, 2292976, -702227, 1602560, 1203128, -1569274, 679142, 18790, + 523449, -1033477, 3758, 565862, -775242, -724239, 684510, 699543, 318901, 965831, + -591632, -96100, -725313, 239981, -63888, 464393, + }, + { + -11904039, 13554917, 70801464, -30354682, 10802916, 2882997, -8716099, 5764920, 777926, -13833553, + -9743670, -5194763, -395674, -4313221, -1654099, 10922639, 3501472, 4124779, -1636383, -5489505, + 11453067, 12559558, -7323993, 555661, -2217814, 5789616, 1117228, 7985955, 3479997, 4497905, + -8629663, -1308891, -7729331, 2131915, 3717831, -7007239, -2029372, 1792075, -5578626, -7773891, + -1081795, -9682467, 979789, 1505923, -6815576, -3201898, -521839, 2732136, 3171833, -1259499, + 1508607, -792421, -5352603, 806917, -938450, -1247151, -2007897, -1066763, -1841467, -549756, + -1102196, -68183, 293132, -56908, 1254667, 221728, 1228361, 2889439, -310311, 2940979, + 618475, -327491, 3032784, 294742, 2357400, 932008, 1534377, -378494, -931471, -488016, + -931471, 2654827, -707596, -894427, 975494, 774168, 827318, -527207, -451508, 283468, + 35433, 1128503, 724776, -365609, 208843, -20401, + }, + { + -1697586, -23950348, 14733885, 25521770, 12185359, -4151086, -2930242, -905701, 2282238, 6634651, + 10682121, 7920457, -1225139, 14300630, 11995307, 3571802, 8805757, 8078297, 6799470, 8967355, + -3620658, 3544422, -584652, -3336653, -1491964, -7956427, -9518721, -9245454, 1214939, -3912178, + -5842766, 4811437, -5383742, -1835562, 1636383, -2058363, -4721780, 6992207, -8212515, 10490458, + 3513820, -1896228, -1341640, -4409858, 5298916, 2063732, 312996, 3163244, -1198296, -1117765, + 586800, 1640141, -1264331, -3337727, -5958731, -1834488, -1391569, 610959, -507343, 946503, + -356482, 2665027, -817654, 609885, 226560, 1261110, -502511, -137439, 3732864, -275952, + -1797444, -439697, -669478, -1081258, -2889976, 391916, -279710, -343597, -1619740, -761283, + -614180, -843961, -641024, -664646, 529892, -690953, 952409, 1069447, -729608, -76236, + -140123, 211527, -1023813, 174483, 653372, 934155, + }, + { + -1212791, 27013734, 7228430, -6409702, 588411, 830539, -1478543, 748398, -651224, -4774930, + 1089311, -4629438, 3291556, 11906723, 13827110, -6725382, 32503238, 5063230, 3920768, 1741609, + 4056060, 14931991, -7688529, 1292248, -7885560, 7250442, 17265232, -12200928, -15709380, -1484985, + 2212445, -8511015, -11017665, 8260296, 3954054, -470836, 4439923, -4502200, -12005507, -3397856, + -239981, 4632659, 3950833, 6710887, 4053912, -6020471, -10230612, -2813741, -83752, -809064, + -1924145, -305480, 197032, -2337536, -2208150, 2978023, 1967632, 2676838, 3255585, 2690797, + 4781373, -346282, -2911451, -1275068, 916976, 1385664, 2281165, -57445, 620623, -24696, + 2095407, 112743, -34360, -847719, 2318746, 606127, -835908, -699006, -1427540, -114354, + -1106491, -740345, 604517, 571768, 1074, -960462, 571231, -1257889, -905164, -807454, + 281320, 43487, -136902, -330712, -379031, -956704, + }, + { + -48462264, -172067120, 15042049, 28164784, 1133871, 2815888, -1941862, 9408126, -591095, -8276402, + -4985920, -16342887, 13955422, -572304, -14271639, 6300180, 6669548, 1434519, 17458506, -825171, + 2241973, -14243185, -12465606, 6225018, -958851, 8337069, 5010616, -3542274, -21269214, 3190087, + 566399, 2129230, -351114, -5056787, -2319819, 3907347, 16886200, 4118874, 11086384, -4143033, + 5743982, -2643552, -7190312, -9025874, 3735011, 3475702, -7519414, -1762010, 5316096, -5829881, + -4746476, 134755, -2116345, 5965710, -998043, -1679332, -527744, -3514894, 902480, 2143189, + -3835406, 1660005, -3810710, -1054415, -325881, 2761664, 750546, 1261647, 662499, 1327682, + -2393908, 34360, -1926830, 242129, -1460289, -1267015, -872415, -330176, -639950, -446140, + -887448, 570694, -538482, 1604707, -675384, -1600412, 1832877, 260382, 419296, -227096, + -241055, -34897, 999654, 702764, 42950, 151398, + }, + { + 93416, -6894497, -4215511, -435402, 3405372, 104690, -560493, -3628174, 234076, -7481833, + -590021, 988379, 2652679, 8476118, -31932008, -27576374, -25235080, -1237488, 8466991, 1065152, + 4254165, -3502009, -288300, -16361141, -4811437, 23816668, -20774756, -16764868, -6681896, -21791590, + -5626407, -2310156, 991601, -3875134, -13894219, 7238631, 2310693, 952946, -2056753, 2027225, + 1627256, -1326071, -4203163, -6073621, -3172370, 878321, -1116692, 3502546, -3400540, 1563905, + 3505230, 106837, -3520263, -508954, 3460133, -1432372, -3004330, -57445, -159988, 4115116, + -370441, -33286, -1188095, -444529, 722628, -957778, 27917, 2487323, 2401424, 1905355, + 1429687, 1202591, -925565, -628139, 1109175, -1915555, -600759, 82141, 665720, 1149441, + 406411, -1894081, 1052267, -159988, -274341, 1356673, 318364, 619549, -1064078, 450435, + 482647, -330176, -130460, 91268, 228707, 4295, + }, + { + -61954368, -58377732, 28474560, 60321740, -7135015, -4290136, -4249870, -5937256, -5246840, -9185324, + 3478387, -3447785, -2421825, -2200634, 6788196, -3547643, 7552700, 10303090, 1258425, 5972689, + 1136019, -7878044, -1699733, -6085969, -456340, 93416, 3948149, -1003949, 6023692, 5639292, + 1692217, -5031554, -7358890, 8036958, -3612604, -8299488, -5925981, -13254269, 1542967, 2454037, + -2240899, 7425999, 2599529, 10350334, 9232032, -821413, 4215511, -1800665, 2500745, 133681, + -1166621, 4148402, 33823, -1338956, 3847754, -1900523, 900869, -1499481, -1047435, -2123325, + 579284, 4082367, 2194728, -317828, 505732, -32212, -3557307, -3112778, 854699, 2079838, + 1466731, 635655, -1046898, -1159641, 306553, 566936, 569083, 1631551, 199716, 615791, + -335007, 872952, -1025423, -945967, 468688, -1632625, 21475, 791348, -16643, 1304060, + -408559, 374199, 387084, -339839, -201863, -1115081, + }, + { + 397821, -15282567, -664646, -1733556, 2014340, 978716, -188442, -552977, -4006131, -40802, + 1362578, 1630477, -9669582, 1742146, -14835354, -3259880, 23965918, 2538326, -13358959, 14281303, + 18102750, 20085414, 10563472, 3688840, 8989367, 9977746, 13620415, -2521683, -12455405, 13524315, + 2216203, -1757715, 10618770, 16623134, 15213848, -4566624, 6425271, -1169305, 9747965, 4290136, + -6903086, 5906, -6129992, 1426466, 5744519, 2098092, 111132, -2432025, 8512625, -2203855, + -1079111, -3669513, -387621, 267899, -3128884, -165356, -460098, -1522029, -364535, 605590, + -1283658, -3948686, 408022, -446140, -1004486, -2096481, 3652870, -2092186, -1888712, 2255932, + 673773, -197032, -974421, 561030, -1243930, 152471, 813359, 753767, -30065, 1760400, + 797253, 61740, 712428, 348966, 628139, -1409823, -96100, 1067836, 427886, -17717, + -1023813, -890669, -701153, 87510, 295279, 158914, + }, + { + -38660612, -325942368, -1202054, 75983344, -9721658, -6199249, -6213207, -2864743, 14892262, -7669738, + 5937793, 23763518, 10829223, 14239427, 16929688, 2807298, -14195404, -3511136, -1484448, -2985539, + -9201967, -4568235, 2638184, 1905355, -2382096, -60666, -854162, -8049843, -1925219, -1709934, + -5094368, -11858942, 5985574, -7655779, -2439005, 2760053, 914291, -6573985, 2234994, 1569811, + -1660542, -9328132, 1335198, -2707440, 905701, 3938485, -2703145, -1273995, 1282585, 8782671, + 6770479, 1270237, 1202054, 177167, -1979443, 2365453, 1422708, 697395, 3857954, 3141232, + -1841467, -1681480, -2106145, 836445, 806917, -593242, 23622, 508954, 695785, 3218004, + 2440615, 673773, -1084479, 789200, 353798, -846109, -312459, -1065689, -329639, 571231, + -370441, -846645, 157840, 676994, -650151, 521302, -121333, -899259, -1023813, 128849, + -12885, 46708, -295279, 845035, -1116155, 490163, + }, + { + 3061238, 58544700, -5272073, -211527, 2759517, -6304475, 2362232, -209380, 1577864, 3779034, + -1369558, -8304856, -13124346, 15186467, -8135205, -7702487, 7969849, -7063611, -26742614, 5450314, + 16091095, -6651831, -7147363, -13436268, -9067750, -1146756, -1237488, 4129611, -1749662, 13521094, + -815507, 825707, -12922483, 3942243, -4009352, -1783485, -657667, 2018635, -1332514, -7642895, + -2151779, 3792993, -916976, -2229088, 376347, 2716567, 287763, 634045, 4710506, -2647311, + -4434554, -3241627, 641024, -1648731, 1399623, 476741, -1641751, -2120103, -4505958, -1981591, + 912144, 3511136, -4772246, -12348, -842887, 1408212, 995896, 275952, -3228205, 1381906, + 2075006, 3370476, 1002338, 2744484, -292595, 177167, 1238561, -1450625, 1415729, 1339493, + 1445257, 82678, -358093, -1537598, -571231, 1009854, 1061931, 281320, 239981, 69256, + -485868, 192737, -807454, -588947, -594316, 238908, + }, + { + -24922622, -210356224, -2458332, -12569759, -3488587, -34763464, -32127430, 4790499, 12367358, -2412698, + -2755222, 6994891, -10813654, -5837398, -13996225, 1025960, -7196755, -11115375, -3044058, -12127377, + 9221832, -298500, -6267431, -8992051, -1577864, -7465190, 6466610, -5745593, -7097971, 759672, + -3234110, 208843, 4004520, -2100239, 1691680, 620623, 4474282, -6034429, 4911295, 3846680, + -5179731, -1134408, 1176821, 3565360, -1756642, -1217086, 1284195, 2390686, -1165010, 4489315, + 2600603, -2909304, -519691, 2266132, -1504849, 5164698, -965831, 2124935, 1215476, 1818382, + 1392643, -176631, 299037, -2474438, 1469416, -1240172, 548145, -2905546, -1046898, -1177358, + -655519, 448824, -430034, -784368, 293132, -1268089, -3404299, 927713, -752693, 1954210, + 490700, 60666, 960999, -184147, -133144, 1002875, -1371168, 569083, -629750, -201863, + -130997, 62814, 330176, 822486, -74088, -987306, + }, + { + -1068910, 40505300, 6753299, -2727304, -3794067, 4140349, 10030896, -2348810, 233539, -1145683, + -8596914, -753230, -7085086, 17685064, 28854128, 24867324, -9666898, -388158, 36179732, 19054086, + -2756832, 34413424, -8141648, -9774809, -8301098, 16848620, 24857660, 8201777, 26670136, -3807489, + 1389422, 3368328, -4861903, 4831838, 1088774, -343061, 1038845, -392453, -6566468, 1382443, + -3690451, -4250407, 3757560, 2623688, -1419487, 8231842, 2552284, -1381369, -5118528, -4930086, + 5836861, 1329292, -1333051, 16643, 731755, 5101348, -1540820, 4563403, 1460289, 352187, + 3350075, -2339147, 1304596, 1402844, 1806034, -1564442, 2803540, 507343, -1321239, 1383516, + -1321239, -1581085, 821413, 593779, 151398, -692027, 93952, -897648, -1060320, -75699, + 1461900, -1047972, -1913945, 1119376, 497142, -958851, -1206349, 831076, -481573, 496069, + 241055, -66572, 574989, -134755, 971200, -193274, + }, + { + 57936960, -22634478, 2653216, -2272038, -6982543, -30773978, -16587701, -168577, -5748277, -2383707, + -8125542, -10630581, -1753420, 13897977, 15892453, -1985349, 15829102, 3779571, -3309809, -9993852, + -7617662, -4437775, 9620727, 19585050, 3885872, -753230, 5380521, -4306242, 9704479, -2940979, + 2651606, -6317897, 2043868, -2465848, -126165, 1456531, 1014149, -755914, 3612604, -1496259, + -5050345, 3467112, 9795210, 883153, 6488622, 7147363, -1469953, -2010045, -665720, 5282810, + -1141924, 246424, 3986804, -353261, -2787434, -2506650, -1757715, -403190, 5057324, -1218697, + 2042794, -1541893, -1019518, 3322694, 2100239, -876710, 1555852, 408022, -2188823, -3218541, + 2300492, 3202435, -1321776, -165893, -176094, -1315871, 558346, 477815, -2159832, -1624035, + -1198833, -79994, -1508607, -1791538, -1060857, 601832, 1331440, 1217086, 176631, -275952, + 164283, 1250372, -963683, -372588, 456877, -363462, + }, + { + -7331509, -4227859, 6176700, -2895882, 1955284, -1150514, 5276904, -1023813, 8202851, 12011950, + 5902359, 10188736, 2275796, -12724914, 5181878, -10402948, 6848326, -15362561, -4313758, -17272210, + -7012071, -28302760, -3665755, -15861314, -4660577, -21145734, -12023761, -6552510, 5591511, 2297271, + 3570729, 3624953, 1347546, 1104880, 2425046, -1061394, 5458904, -5804649, 1484985, 5109401, + -4367982, 3124589, -9458592, -3100967, 1299765, 8957691, -4099546, -9124658, 549219, 1347009, + -804770, -1629403, -1491427, -3307662, -315680, -5516886, -261993, 2560338, -471910, 2575370, + 3077344, -2310156, -3977677, 562641, 1544578, -2507724, 2412698, 324807, -16643, 1539209, + -822486, -600759, 776852, 3447248, -563714, -2621541, 2092186, 1243930, -493384, 775242, + -982474, 538482, 425739, 1365263, 732829, 874026, 780073, 514322, 897111, -1098438, + -1512365, -440234, 78920, 600222, 293132, 316217, + }, + { + 31731756, 100152728, -1818382, -11399917, -13154411, -15752866, -8021389, 6714645, 9640591, 5770826, + -563178, 15707769, 3295314, 2015950, -9869298, 12358768, -5305895, -6606734, 5921686, 11200201, + 9266929, -3928821, -9294309, -13313325, -4874788, -17631378, 5103495, 1081795, 4177393, 6023692, + 5679021, 1787780, -257161, -6119255, 5726265, -6105296, 239981, -8730595, -5385352, 59056, + 118648, 6197638, 10887742, 6752226, 498753, 1227824, 3469797, 6122476, 7303055, 4000225, + -5092221, -625992, -1793686, 3388729, 1110249, 162672, 2120103, 3866008, 3202972, 3082713, + -557272, -717796, -1343251, 1234266, -277562, -1465121, -1189706, -2602213, -1690607, 1407139, + 1028645, -858457, 1590749, 1371168, -82141, 1901060, 549219, -258235, -170725, -923955, + -979789, -353798, 617402, -168577, 539018, 1277753, -1148367, 430570, 482647, -289373, + -1906966, 518617, 1598265, 336081, -888521, 1533303, + }, + }, + { + { + 201327, -13214004, 2683281, -4859756, -4590783, 293668, -770947, 471373, -450972, 13018583, + 384400, 3451006, 9732396, 7620346, -21898964, 557272, -14116484, 941672, -1198833, 3633542, + 21256866, -10541460, 8477192, -18957448, -5113696, -4327180, 9694815, 7667591, 8524973, 816581, + 735513, 4374424, -9838159, 5250598, -1844152, 5938866, -5651640, -7462506, 3361886, 4306242, + 3446711, -2377801, -3053185, 1671279, 7863548, -3812320, -1461363, 5420786, 2032056, 2517925, + 2579665, -745177, 1523103, 601832, 1888712, -1814087, 326418, 288837, -481573, 530428, + 289910, 1967632, -1806571, -221728, 781147, 190589, 1576253, 638876, 1188632, 214212, + -572841, 956167, -1057099, 2218351, 224412, 1372242, 563714, -679679, 512175, -595390, + 409096, -516470, 520765, 529892, 139586, 143345, 544924, 610959, -239444, 323196, + -760209, 258235, -504122, 433255, -112206, 614717, + }, + { + 9801652, -82937432, -20039244, -30176440, 4469451, -2437931, -3164854, -1218160, -6061810, 2508798, + -1424319, -4756140, 4029753, 103616, -4393215, 9736154, -5010080, -1047972, -1151588, -7581154, + 6270116, 8024073, -3850975, -4675072, -9389335, 892816, -1776506, 7198902, -173409, 1651952, + -1677185, 3468723, -5153961, 1261110, 1159641, -5639829, -5448166, -972273, -3084860, -3082176, + 4063039, -4293357, 4085051, 2796561, 52613, -13959, -1628330, -3220689, 262530, -2868501, + -372052, 625455, -2403571, 2525441, -139050, 853088, 1347009, 131533, -2054605, 240518, + 193810, -835908, -818191, 926639, 2182917, -479963, 1047972, 3083787, -152471, 1768990, + -228170, -907849, 1336272, -601832, 760746, -850940, 118648, -745714, 42413, 1239098, + -682900, 554588, -1089848, -630286, 702764, -8590, 798327, -881542, -1048509, 147640, + 66035, 695785, 516470, -988379, -235149, -17180, + }, + { + 2039573, -38922604, -9605157, -7341173, -3240016, 1180579, 1062468, 412854, 216896, -7334731, + 2353105, 12856985, -11137924, 132070, 10654203, 1190243, 2203855, -597537, -7923141, 5674189, + -2743410, 5644661, 6728603, 6010807, 5303211, 349503, -722628, -5007395, 675921, -2282238, + -616328, 811749, -8626979, -2689723, 3361886, 1151588, -4064650, 5812165, -8701604, 3373160, + -308164, 1352915, 2109366, -1335198, 3708704, 646393, 449898, 2189360, -1198296, -102542, + 277025, 897111, -293668, -1352915, -1648194, 1973538, -67109, 3795677, 884763, 373125, + -2268817, 2900177, -2036351, 106300, -592169, 867047, -441308, -1416266, 1230508, -505732, + -779000, -528281, -364535, 887448, -1062468, 234076, -214748, 1673964, 53687, 863288, + 512712, 175557, 311385, -937377, 510564, -401579, -405874, 162672, -601832, -161061, + 312459, 816581, -882616, -406948, -184147, 475131, + }, + { + 1221918, 17468168, -3716221, -4954782, 1305670, 303332, -1639067, 1610613, 376347, -2793876, + 1497870, -6382322, -754304, 7064685, 32483912, 746787, 8441758, -13241384, -4514011, 2699387, + -1909113, 14496051, -467615, -1356136, -2834142, 4092567, 10679436, -283468, -7278896, 4656282, + 2190970, -10994043, -6706055, 4113505, -1033477, 5513665, 8848706, -2232846, -5417028, 3657165, + 5424544, 5190468, -2593087, -68719, 4232154, 343597, -2092186, 194347, -2461553, 2097555, + -1723893, -768262, 1664837, -166430, -1226750, 1418950, -1913408, 1799591, 1736777, -3274913, + 2187749, 554051, -2131378, -1704028, 1861868, 256624, 909996, 410169, 561030, -1294933, + -708133, -1144072, -433255, -1097901, 1068373, -185757, -497679, -270583, -1009854, 149787, + -428960, 309775, -176094, -240518, 714575, -585726, 614180, -421444, -132070, -277025, + 208306, -398358, 574452, 154082, -325344, -634045, + }, + { + 41880764, -70008504, 8005282, 36514740, -1853278, 3137474, -4110284, 813359, -6084358, -5641977, + 10264972, -9822053, 12087112, 437550, -8940511, 8642011, 308701, -7961259, 15100568, 3341485, + -1951526, -7250442, 348429, -1476395, -5767068, 4781373, -2597382, 10107669, -7342247, 993748, + -926102, -1700270, 220117, -414464, -2033667, -1930588, 3863860, -4889821, 9343701, -4786741, + 6626598, 336618, 856309, -3218004, 538482, 2343442, -4966593, -1267552, 3230352, -5965710, + -1590212, 1224066, -5105643, 1475858, -3354370, 1319092, 656593, -4714801, 573378, 3423089, + -1801202, 2519535, -2828236, -979789, -784905, 2182917, -1291711, -415001, -277025, 1020592, + -1891396, 972810, -1523640, 459025, 66035, -179852, 907312, 1037235, -280247, 57982, + -623307, 253940, -601295, 916976, -393526, -883153, 715649, -651224, 590021, 279173, + -37581, -132070, 72478, 281857, 108448, 345745, + }, + { + 935766, -10346039, -7285339, -1535451, 1643362, 748398, -501437, -1923609, 2824478, -2742874, + 5849746, 2596308, -1854352, 741956, -4477504, 3860639, -16386374, 2196339, 5068062, -5965173, + 10546829, -1010391, -2552284, -11304891, -4583804, 29266980, -3732327, -4582193, 7143605, -8635569, + -49392, 151934, 3490735, 2638184, -7242926, 2425583, -3109020, 1913945, -614717, 1230508, + 5117991, -1702418, -6003291, -3176128, -2473901, 2204392, -1762547, 703301, -2894271, 4388383, + 4518306, -171262, -2204392, 2160906, 2479807, -3758, -1392643, -609885, -1326071, 1125818, + -1738388, -1453846, -1555315, 481036, 3258270, -430570, -1647120, 983548, -974421, -299574, + 660351, 666794, 113817, 1102733, 2244657, -1105417, -679142, 73551, 623844, -650151, + -86973, -1787780, 300111, 2684, -359704, 419296, -234076, 53150, -1337882, 231391, + 61740, -493384, 151934, -76773, -30602, 122943, + }, + { + 37877316, 28761786, -5166846, 56526600, -6617471, 565325, 6816650, 2672544, -8530879, -12159589, + 5873368, 1129576, 9901510, 4789426, 10058813, -1211718, 4981089, 4595615, 42413, 3816615, + -10268730, -10144176, 1644436, -8026757, -1015223, 1108638, 5690295, -1634772, 1250909, 295816, + -942208, -629750, -4995584, 4903779, -980326, -3036005, -2753611, -5051956, 4977330, -1525787, + -6570763, 3885335, -1940252, 1186485, -1775432, -3586298, 4673462, -2889976, 1202054, 1083406, + -3034395, 2290291, 6396280, -370441, 434865, -948651, 3286724, 1118302, -848256, -1450088, + -510564, -205085, 287226, -724239, -779000, -234076, -484794, -96100, 776852, 132070, + 299574, -73014, 122407, 9664, -652298, -648003, -964757, -30602, -600759, -198105, + -810138, 752693, -593242, 304406, 718333, -851477, 295816, -107911, -765578, 338766, + -919123, 692027, 519691, -500364, -133144, -1035624, + }, + { + 1133335, -7596187, 7786776, -3126199, -1706713, 302795, -750009, 1531693, -1610076, -309238, + -28454, -2587718, -7092065, -445066, -3875671, -7863548, -8979703, -5310727, -2851858, 16228534, + 642635, 2206003, -1634772, -2029372, 12693239, 10543608, 2332704, -550830, -6484864, 10227928, + 3381750, -7301445, 7075959, 180389, 2520072, -7141457, 5628555, -5236639, 5027259, -510564, + -9907953, 2489471, -4594005, 128312, -2828236, -843424, 971200, -4602595, 7114614, -3257733, + -348429, -3444027, 1647657, 1178432, -2115272, 94489, -510027, -2959233, -734976, 1933809, + 1080184, -629213, 1279363, -965831, -488553, -2565169, 1532230, -1133335, -483184, 1600949, + 191126, 99321, -888521, 814970, -502511, 574452, 648540, 646393, -643708, 950798, + 535797, -619549, -619012, -887985, 1155346, -630823, 173946, 957241, 346819, 948114, + -8053, 241055, -111132, -93416, 140660, 307090, + }, + { + 48860084, -197135776, 4823785, 62398360, -16840030, 1022202, -804770, -2381559, 10311143, -3648575, + -1268089, 5468030, -10146323, 1017370, 7711614, 6932614, -9579388, 6448894, 5833640, 1268626, + -2707440, -2987687, 1532767, 2410014, -4435628, 2334315, 4223564, -7477001, -2654290, 582505, + 1760937, -6029061, 6920266, -5821292, -1410897, -246961, -203474, -966905, 9744207, 415001, + 2904472, -1348083, 4727686, -607738, 421444, 3450469, 489626, 855235, -1141388, 1248225, + 2589865, 2079838, 748935, -756451, -3472481, 876710, -1125818, -1219234, 1878511, 1018981, + -2092723, -673773, 40265, 962073, -888521, -881005, -272730, 573915, 310848, 1762010, + -219043, -150324, 201863, -173409, -288837, -232465, 25770, -1119376, -487479, 1385664, + 830002, -1060320, -648540, 567473, 0, 434865, 122407, 711891, -494458, -136902, + 300111, 539018, -1041530, 586263, -270046, -192200, + }, + { + -2210298, 46339476, 2477123, 7050189, -112743, -10340671, -6528351, -3257196, -785442, 1573569, + 2360085, -5609764, -987306, 17995912, -6307160, -4704063, 2235531, 2385318, -5574331, 8447127, + 7596724, -1704028, 9672803, 3012383, 5200669, 1796370, 1437740, 17144436, 466541, 5800354, + -4374961, 4138738, -9764071, 2038499, -3935264, 948114, -397284, -1061394, 480499, -4576825, + -2903398, 4141422, 672162, -3787088, 1181653, 2418604, 2140504, -1260573, -734439, -5131412, + -1526324, -486942, 1251983, -648003, 2859375, 1771137, -1159641, -2041720, -821949, 1100049, + -1766842, 2845416, -1698123, 605590, -1603633, 486405, 338766, 1191853, -1217086, 1047972, + -841814, 813896, -733903, 1656784, -1521492, 71404, 2274722, -1516124, -418222, 92879, + 157840, -205622, -130997, -337155, 1175210, 281857, -285615, -638340, 4832, 76236, + -685584, 332323, 17717, 565325, -375810, -81604, + }, + { + 24257976, -155260928, -6591701, -268435, 12761958, 3675955, -3133716, -7854959, 6742025, -1634235, + 444529, 7113003, -5551245, 3341485, -7219303, 5138392, -742493, -9232032, -1733019, -3244848, + 5156108, -2733747, 2456721, -5218922, 2171643, 1864016, 4894115, -5756330, 709743, 4947266, + 544924, 3041374, 2494839, -2144263, 2602750, -2816962, 4919348, -2126546, 4000225, 151398, + -1043677, 906775, -1212255, 1235340, -542240, 674847, 443455, 634581, -1521492, 4074850, + -1091995, -4615479, -1792612, -688269, -18790, 4236985, -1825898, 1010928, -63888, 911070, + -19327, -287763, -787053, -3576097, 1006096, 532039, 3414499, -1906429, -805306, 1078574, + -306553, 605590, 1368484, -448824, -775778, -212601, -1547799, 1486596, -1108638, 1154809, + 634045, -437550, 121870, 676457, -354335, 404801, -1348620, 814433, 141734, 345745, + -66572, 527207, -58519, 141197, -110595, -831613, + }, + { + 1831267, 25471840, -4570919, -1883880, -1483911, 5216775, 7803419, -1298691, 1334124, 378494, + -4946192, -1655710, -2441152, 21579526, -4398584, 1883343, -11041824, -397284, 22949084, 3854196, + -6969122, 30350386, 3338800, 3988951, -11170136, 5779416, 3554086, -8122320, 18894098, -1965484, + 159988, 559420, -7226820, 2741800, -2524367, -270583, 2954938, 73014, -6684043, 4257387, + -552440, -743029, 4907000, -2526515, -5172215, 1367410, 928787, 2697240, -563714, -1688996, + 4313758, 549756, 689879, -1741072, -2454037, 1020055, -3154117, 3544422, -416075, -908386, + 2414309, 93952, -926639, -2604361, 2415382, 410706, 690953, 243203, -1433982, 906238, + -486942, -1349157, 415538, -37581, 1093069, 522912, 1179505, -809064, -1391569, 12885, + 1605781, -664109, -1757179, 1087164, 1527398, 734976, -310311, 294205, -448824, 1067836, + 1102196, 256087, -24159, -527207, 675384, -687195, + }, + { + -37128920, -146997408, 1265942, -7851200, 5735929, 11895986, 16006806, -926102, -10103374, 8164196, + 4688494, 354872, 4482872, 10228465, 3129958, -6976638, 6249178, -10957535, 2011655, 2276333, + -4777614, -9680319, -1433982, 6840809, -4803921, 4946729, 5864241, -10809359, 10602127, -616865, + 3100430, -6963753, 3633006, -5348308, -758062, 1549410, -296353, 1751273, 4753992, 384936, + -2585034, -921807, 3408594, -1792075, 712965, 3711926, -4523138, 47245, 2344515, 3204583, + -2137820, -1150514, 2630131, 716186, 1236951, -2226404, -1668595, -1777043, 3303367, -522912, + 2121177, -1449015, -2949032, 311385, -90194, -2294050, 1600949, 1372779, 79457, -1116692, + 942745, 2348273, -294205, -124554, 137439, -395674, 568009, 1432909, -72478, 48855, + -1669132, 717260, -663572, -427349, -16106, -723165, -106300, 503048, -560493, -889595, + -447750, 597537, -709743, -274878, 527207, -345745, + }, + { + 6634114, -9028021, -13011067, -907849, 2181844, -5943161, 1203665, -5894306, -5746666, -1419487, + -4887673, 6069863, 14956687, -21729850, -10303090, 3974455, 13445932, -4254702, 2364380, -12769475, + 7654706, -9017821, 14374182, -4555887, 8101919, -4381941, -3527779, 2241436, 5769215, -8089571, + 2233383, 5191542, 1253594, 6136972, 4819490, -5616207, 6233608, -4038880, -2043331, 1338956, + -2036351, 5703717, -5364951, 712965, -42413, 2375654, -3161633, -1636383, 3634079, 845572, + -533650, -1333587, 1381369, -3917010, 2861522, -2222646, 915902, 2491618, -2934000, 360777, + 816581, -1434519, -3047279, 170188, 579284, -2434710, 3966939, 1143535, -2426120, -195421, + -121870, -53150, 871342, 3246995, 147640, -1505923, 1869921, 1100585, 299037, 908386, + -954020, 273267, -1243393, 205622, -137976, 621160, 608812, -332323, 235686, -870805, + -923418, 28991, -749472, -256087, -131533, 67109, + }, + { + -36290328, 23754928, 10712185, -567473, 17505212, 10191957, -5559835, 18254, 54224, -7209103, + -9378598, 5791227, -12429098, -7192997, -13477071, 1273458, -12969727, -230318, 5257040, 5857262, + 2848100, -8945880, -1377611, 4332549, 4459250, -7472170, 8932995, -946503, 1823751, -2449205, + -2587718, 1042603, 1358283, -5513128, 5694053, -4487167, 2226404, 2669322, -906238, 231391, + 3312494, 3080565, 306553, 179852, -1328219, -3104188, -769336, 1937030, 3123515, 526134, + -5921150, 1327145, 938987, 2915746, -753767, -1478006, 1010928, 599685, -1028108, 3517041, + 2333778, -978179, -2120640, -474057, -8590, 1666447, 500364, -1234266, -847182, 2368138, + 657667, -1561221, 634581, 766115, -816581, 868120, 374736, -1244467, -676994, 132607, + 308701, 217433, -630286, -437013, 367757, -34897, -1544041, 920734, 66035, 170188, + -979789, 422517, 313533, 278636, 130460, 1087701, + }, + }, + { + { + -568009, -7240241, -3147674, -7619809, -1931125, 159451, -1612760, 323196, 1991254, 3008625, + 10047539, 7788387, 3412889, -443455, -12673375, -5146445, -12399571, 316217, 1367947, -1016297, + 16280074, 3069291, 4701916, 2430415, -14382772, -171799, 1798518, 2725694, 11043435, 10614475, + -358630, -3292629, 4213900, -1884417, -866510, 422517, -706522, -5675800, -1173063, 4253628, + 307090, 774705, -1950989, 949725, 3287798, 1050656, -900333, 2257542, 723702, 3066607, + 2783139, 632971, 539555, 2050310, -87510, 108985, 1213865, -332860, -1105954, 992137, + -57982, 1814087, -998043, -111132, -967978, 1229434, 1322850, 641561, 2456185, -219043, + -515396, -108448, 229244, 234613, 1140851, 943282, 460635, -35970, -60130, -130997, + 348429, 388695, 362388, 215822, 395137, 394600, -25770, 767189, -303869, -75162, + -398895, -214212, 23085, 693637, -257161, 165356, + }, + { + -9474698, -92130272, -11975979, -10887205, -6487548, -1676111, 1727651, -7427072, -5739150, 1846299, + -2233383, 1858110, 420370, -3397319, 1567126, 2900177, -5512591, 1760400, -3288871, -6132140, + 7910256, -2229088, 4543539, -5233955, -12019466, 848793, -1737851, 3483219, 1105417, -3321620, + 4214437, -1992865, 3325379, -3597572, -3610994, 677531, -2859375, -3378529, 70330, -1346472, + -227633, 663572, 2093797, 673773, 3917010, -1067299, -1559073, -1308891, -1716913, -1983201, + -1222992, -110059, 3129958, -681289, 540092, 651761, 737124, 1851668, -1183800, -620086, + 1228898, 204548, -2184528, 2193655, 1431298, 641561, 522375, 1826435, 793495, 562104, + 191126, -686121, -64961, -125091, 143881, -897648, 83752, -477278, 721018, -48855, + 273267, -348429, -703838, -5369, 119722, 245350, 183610, -490163, -777389, -153008, + 394600, 344134, 483721, -549756, -384400, -93952, + }, + { + -1249836, -18828062, -19967840, -22099754, 1862405, 1656784, 3476239, 892279, -1799591, -4223564, + 223338, 4981625, -1699733, -4465156, -1326608, 2177012, -1774358, -2165737, -1496259, -1912334, + 5862631, 1938104, 6077379, 5210332, 4355634, 2082522, 456340, -331249, -3956739, -2931315, + 1126355, -756988, -5196911, -4625143, 4105989, 1735167, -903017, -3583077, -408022, 402653, + 149787, 784905, 1862405, 802085, 2084133, 2026688, -2770254, 865436, 1803886, 1327682, + -967441, -281857, -146029, -438624, -1061931, 770947, 1296543, 2374043, 1427540, -201327, + -666257, 614180, -10201, 448287, -1352378, 31139, 341450, 343061, -964220, 386010, + 133681, -840740, -603443, 903554, -118112, -147640, -547608, 774168, 1018444, 778463, + 405338, 528818, -381178, -295816, 458488, 81604, -755914, -464930, -151934, -253940, + 462246, 419833, -353798, -207769, -258772, 18254, + }, + { + -2008434, 9203041, 3401614, -1329829, -298500, -201327, -1319092, 921807, -184147, -1227824, + 653372, -3400004, 226560, 7508677, 29160144, 6999723, -15173583, 5287105, -11531987, -7219840, + 7086696, 7419019, 3082176, -1246614, -613643, -1502165, 6051609, 3256659, -1247151, 7089381, + -7948374, -10909217, 2953864, 3212636, -227096, 4981625, 6177774, -425739, -796180, 2142652, + 4344360, 4268124, 628139, -2639258, 814433, 2222646, 1264331, 511638, -1905355, 2728378, + -2966212, 318901, -214748, 1525787, -720481, 170725, -1231045, 1178969, 104690, -2714419, + 162135, 1295470, -1566589, -709743, 1109175, 644782, 544924, 472983, 254477, -318364, + -2175938, -1476395, -741419, 69256, -26844, -230854, -79994, -77846, -824097, 31675, + 318901, -66035, -36507, 181462, 96100, 11811, 0, 191126, 5906, -254477, + -139050, 117038, 235149, 550830, -374736, 94489, + }, + { + -26312580, 37583112, -11651173, 37882684, 5630166, -89657, -3557844, -1940788, -1619740, -5634460, + 4264903, 4316442, 2281702, 243739, -187905, 3481608, -781684, -4467840, 7422777, 3338263, + -3501472, -1681480, -1391033, -4700305, -67646, 2851858, -5456756, 7678865, -200253, -1902671, + 1453846, -2481417, 937377, -951335, 295279, 665183, -6910066, 730681, 1642288, 97711, + 4274030, 709743, 856846, 504659, -3445638, -421444, -1094143, -920734, -2850248, -1231582, + -141197, -1044751, -205622, -2836826, -1603097, 724776, -40265, -1059783, -312459, 274341, + 832150, -523449, 564251, -903017, -694174, -322123, 346282, -1472100, 320512, -610959, + -1234266, 362925, -541166, 529892, -267899, 166967, 717796, 909996, -76773, 297963, + -573378, -153545, 348429, 15032, -425739, -657667, 98247, -208306, 179315, 89121, + 136902, -76236, 126702, -454193, 172336, 343061, + }, + { + -231928, -8172786, -3378529, -751619, -1544041, 886374, 478352, -640487, -185220, 3354906, + 2865817, 142271, 447750, 1098975, 286152, -7872138, 3357591, -3444027, 5154498, -7512972, + 3244848, 4154844, -4639639, -129386, -2365990, 6587406, 10845866, -2207613, 1017370, -3927211, + 3007014, 3106872, 1487669, 5645735, -2902861, -4923643, -643708, 285615, 4142496, 198105, + 1120987, -1755031, -3706020, -2178085, -603980, 1013075, 430570, -2344515, 909996, 1839320, + 3773666, -892279, 495532, 1388885, -274341, 789737, 916976, -1552094, -747324, -1159104, + -1439888, -1127429, -1684164, 1335735, 2461553, -311922, -810138, -715649, -996969, -208843, + 18254, 956167, 1131187, 395674, 1739462, 381715, -711354, 192200, 653372, -1353452, + -467615, -675921, -633508, 189515, 77309, -172336, -12348, -455267, -520228, -209917, + -10201, -405874, -373125, 433792, -63351, 31139, + }, + { + -9091909, 79809080, 4988605, 47700980, -3866008, 2354716, 2592013, 4159676, -4788889, 239444, + 24159, 483721, 10179609, 3285113, 4755603, -1267552, 5439576, 5676336, 1933809, 1511292, + -9394167, -8664023, 258235, -6163278, 1170379, -314606, 2952253, 2739116, -463320, -3612068, + -817118, 995359, -1753420, -758062, 3047816, -1717987, -4371203, -96100, -407485, -972273, + -1026497, 622233, 59056, -3953518, -1201517, -3255048, -107374, 1840930, -2010045, 1373316, + -3729642, 4811974, 2567854, 1398549, 341450, 484794, 1694902, 590558, 922881, -998043, + 11274, -448824, -1604707, 699543, -1070521, -624918, 415001, 1357747, -409633, -722628, + 906775, -385473, 359167, 646929, -820339, -768262, -883690, -513785, -111132, -443992, + -284542, 41876, -161061, 882616, -402116, 244276, 224949, -775242, -392990, 14496, + -248571, 9127, 163209, -107911, -481036, -182536, + }, + { + -345208, 4253092, 861141, 39728, -1327145, -428423, 135828, -260919, 474594, -1246614, + -432718, -2401961, -310848, -2480344, 3601867, -10738492, -15253576, -9737228, -958851, 15870978, + 8000987, -9571871, -3760781, -238908, 7511361, 7321846, 3244311, -3629247, 609349, 2506114, + 5132486, -4180614, -4629438, 2845953, -890669, -2789045, -597000, -3298535, 2122788, -563178, + -3623879, -1693828, -1729261, 433792, -6823093, -341450, 1139240, 571231, 613643, -3295314, + 972273, -1178969, 2237141, 135828, -738734, -774705, 198105, -1651952, -1256815, 1345935, + 1344325, -321049, 734439, -976031, 451508, -1699733, -731755, 606664, 180389, -498753, + 989453, -62814, -40265, -562104, 725313, 172872, 753230, -370441, -169651, 631897, + -270583, 300111, -589484, -620086, 359167, -253940, 251792, 574452, 37044, 784368, + 305480, 274341, 12348, -499827, 690953, -234076, + }, + { + -45213656, -56690348, 907849, 43763032, -668404, -573378, 889058, -633508, 1871532, 5373004, + -4873178, -6526740, -6167036, -1670742, 6282464, 2414845, 511101, 3416647, 2153389, 4843650, + -519154, -3308199, -940598, 1178432, -2737505, 3984656, 2471217, -3973382, -5036386, 766652, + 229781, 1052267, -2674691, 665183, -3060701, -1498944, 753767, 2723009, 8003135, 597000, + 798864, 2300492, 2390149, 1394254, -1080721, 2412698, 3383361, -1858647, 1396401, -1902671, + -460635, 3306588, -996432, 618475, -2270427, -1813013, -266825, -551366, 1411971, -888521, + -973347, -149787, 1194001, 537, -1086627, -234076, -770410, 351114, 623307, 441845, + -404264, -739271, 1476932, -535797, 146029, -146566, -635655, -112743, 4832, 827318, + 286689, -446677, -769336, 342524, 598611, 17717, -105227, 411780, -5369, 27917, + -256624, 392453, -263604, 92879, 198105, -76236, + }, + { + 646393, 28188944, 9237938, 8492761, -1372779, -4114579, -6965363, -5987185, 1910724, -4014721, + 2231773, -2530273, 579821, 8087424, -292595, 2650532, 2171106, -2728378, 12381854, -1800128, + 5790690, 2726767, 1888712, 8689256, 7388955, 5326833, -3565360, 10331544, 7107097, 3898757, + -4088272, -457414, 1147830, -1598265, -4850629, 2242510, -3101503, 4757750, -2624762, -3393561, + 2413235, 296353, -2345589, -2989297, 2563022, 890132, 2585570, -699006, -3358665, -2445984, + 1192390, -768262, 1482301, -696322, 1430761, 457951, 467078, -1897302, -707059, 721555, + 502511, -128849, 1074, -376347, -81068, -107911, 683974, 504122, 583579, 6979, + 114890, -1258962, 228170, 507343, -960462, 599685, 438087, 31675, -754304, -485868, + -179852, -535797, 341987, -35433, 1259499, -98247, -602906, -215285, -379031, -583042, + 170188, 9664, 277025, 578747, -91805, -265751, + }, + { + -22428856, -95513096, -3176665, 5723044, 9048959, 6965900, 6530498, -5664525, -2867965, -2049773, + 2574833, 5532992, -143345, 2800856, -4101694, 4907000, -326418, -1825361, -4698694, 1975148, + -4410395, -852014, 2254321, -815507, -2703145, 8832063, -3939559, 3267933, 3329137, 1808718, + 4678830, 1716913, 1538135, -1379758, 35433, 345745, 3062849, 1720134, -1285269, 98247, + 1789928, -412317, 646393, -439160, -101469, -977105, 1280437, -336081, 1115618, 1723356, + -2614561, -2245194, -3139084, -588411, 2193655, 680752, 427886, -471373, -337692, 1600949, + -1661616, 457951, -1726577, -977105, -1506997, 1203128, 1469416, 137439, -1642825, 1921998, + 766115, -64961, 1315334, 233002, -597000, -887448, 476741, 704375, -891743, -41876, + 723702, 86436, -118648, 384400, 57982, 194347, -689342, 271120, 423054, 264677, + 41339, 315680, 184147, -41876, -280247, -8053, + }, + { + -2626373, 13203266, 5518496, -2244657, 5119064, 6229313, 577136, 3981972, 818191, -688269, + -618475, -5167383, 2027761, -242666, 7059853, 424128, -11673184, 5673115, 7947300, 4874788, + 8557185, -4080219, 14615237, 5265630, 110059, 3623879, -8265128, -450435, 8250096, -2647847, + -759672, 3288334, -2997887, -3967476, -1869385, -873489, 3638911, 1008780, -1817308, 477278, + 1983738, 1306744, 849867, -1566053, -3420405, 774705, 2518998, 181462, 847182, 3257733, + -490163, -251256, 1852742, -3221762, -830002, -1076426, -439697, 23085, -520765, -655519, + 1296543, 314069, -243203, -1844152, 11274, 1450625, -261456, -609885, 274878, 425202, + -281857, -1255741, 905164, -110059, 1075889, 147640, 1169305, -494458, -503048, 725313, + 5369, -758599, 137439, 234076, 1421097, 192200, 83752, -118648, -290984, 944893, + 951872, 524523, 98247, -89657, -47245, -214212, + }, + { + 733366, -191791760, -24925842, 4694400, 6714108, 27434104, 13261785, -6123013, -9939628, 10362682, + 6002217, -934692, 5504538, 1890859, 1420560, -1684701, -5087926, -2799782, -1873680, 5748814, + -3526168, -8069707, -4292820, 3733400, 2764348, 3604551, 281320, -5597953, 1018981, 5368172, + 548145, -3950833, 102542, -932545, -1897302, -724776, -1071058, 4398047, 2817499, 2783676, + -713501, -3258807, -409096, 2412698, -4352413, 1255204, -53687, -1198296, 1949378, 1400159, + 760746, -2452963, 519154, 1815161, 140123, 4295, -1354525, -1063004, 402116, 311922, + 1535451, -699006, -1487669, -2845953, -197032, -504659, 978716, 582505, 309775, 2059974, + 44023, 55298, 1872606, 226560, -267362, 260382, 523449, 535797, 186294, 290984, + -943819, 23085, 81604, -82678, 88584, -906238, 106837, -293668, -251792, -1001801, + -134218, -185757, 9664, -41876, 273267, -231391, + }, + { + -6184216, -9221295, -1402307, 1878511, -190589, -4187056, -2618856, -285078, -10474888, -3760781, + -6349036, 4805532, 11426224, -1326071, -16074989, -525597, 8140574, 3642132, -519691, -8193187, + 4012573, 4036733, 8257075, -2742874, 4997195, 1741072, 1457068, 5000416, 178778, -3033321, + -3673271, 8181376, 56908, 1306207, 4275640, -719407, -520765, 2804614, -1881733, -2565706, + 1144609, -1482838, 255551, 1179505, 1165010, -1989644, 376883, -97174, 1548873, 567473, + 1313186, -1730335, -33823, -2462090, 2528125, 650688, -165356, 1527935, -2388002, -25233, + 131533, -441308, -596464, -1490891, 350577, 67646, 221191, 1045288, -113817, -1458141, + -184147, 871878, 1759863, 1468342, 286689, 391916, 873489, 359167, 377420, 256087, + -112206, -6979, -793495, -219043, -562641, 81604, 644782, -354335, 248034, -650151, + -563714, 288300, -871878, -247497, -42950, -197032, + }, + { + 25045564, -55550032, -6820408, 8394514, 12961138, 8447664, 7473243, -5168457, 2181307, -11731703, + 3477313, -9509594, -7582228, -4929012, -13762686, -3244848, -4354560, -3742527, 3655554, 1966021, + -1868311, -3237869, -3787624, 8500814, 1409286, 3478924, 412854, -376347, 2208150, -1519345, + -2059437, -2757906, 1467805, -77309, -1966021, 353798, 40802, 6321655, -396211, -3347390, + 3173444, 2076617, 194884, 813359, -2756295, -2902861, -1840394, -610422, 3785477, -1073205, + -1536525, 64425, 1446867, 47782, 1087164, -326418, -616328, -61203, -494995, 1748589, + 2717641, 598611, -2385318, -1214402, -216359, 1895691, 365609, -393526, -829466, 2223183, + 403190, -542240, -47245, 928250, -635118, -301721, 179315, -1155346, -168577, -828929, + 570157, 716186, -947577, -75699, -382789, -283468, -1031866, 842350, 429497, -102005, + -236760, -48318, -324270, 425739, 494995, 92342, + }, + }, + { + { + 428960, 3100430, 1490891, 6196027, 7572028, -772020, -1132261, -1269163, -1840394, -1124745, + 4081830, -2044404, -1842541, 4065187, -1755568, 9210020, -1016834, 9212705, 3166465, -9743133, + 10370199, 1979980, 1085016, 7180649, -9831180, 3673808, -2545842, -8650601, -73551, 9073118, + 2501282, -1013612, 7553774, -3533684, 144955, -400506, 126165, -1583232, -1209033, 1804423, + -1540820, 1255204, -1279363, -1469416, -573378, 1596117, 768799, 1130650, -537945, 526134, + 184147, -630286, 14496, 1906429, -1213328, 1212791, 1239635, 20401, 150324, 1001801, + 154619, 2673617, 10201, 1442035, 978179, 1400696, 459562, 24159, 1142461, 154619, + 341987, -100395, 311385, -794569, -143345, 274878, 375810, -518617, 4832, 115964, + -170725, 9664, -211527, 86436, 300111, -94489, -785442, -24696, -320512, -215822, + -409096, 136902, 127775, 317828, -306553, 102005, + }, + { + 6183679, -66507032, -9096741, 9263171, 3282429, 1401770, 3029026, -3911105, -85362, -2160906, + -6958921, 1236951, -692564, -552440, 245887, -1296543, -3432216, 3573413, 2368138, 2254321, + 9189083, -4635344, 6239514, -972810, -12739410, -2435783, -704912, -329639, -2111513, -3555696, + 1473711, -6303402, 7472170, -49929, -2811056, 2908230, 2342368, 3073586, 4316979, 59593, + -2243584, 1371705, 1722282, -523986, 3576634, 2369211, 1005022, 571768, -335007, -663572, + 867047, -831613, 1735167, -2249489, 362388, 1107565, -282394, 1110249, -241055, -411780, + 75699, 875636, -1508070, 693100, 99321, 924492, 140660, -27917, -525597, -559956, + -481036, -714575, -4295, -217433, 254477, -252866, 946503, -622233, 265214, -670015, + 203474, 200790, -182536, 153545, -271120, 332860, 112206, 248034, -131533, 94489, + 76236, -197569, 143345, -22549, 38118, -287226, + }, + { + -658204, 3100430, 6278706, -177167, 6389838, -1020592, 1989644, 2005750, 1826972, 1609539, + 2493766, 768262, -2200634, -2587181, 916976, 1936493, 187905, 4817880, 4403415, -6087043, + 1323924, -5893769, 730144, 1466731, 122407, -711891, -2371896, -3124052, -2316598, -404801, + -1212255, -2962991, 1424319, -1415729, 3370476, 1121523, -4045859, -4402342, 4806069, 1018981, + -3958349, -1275068, 173946, -2189360, -593779, 692564, -3143379, -424128, -464393, 766115, + -176094, 567473, 90194, -379031, -1071058, -210990, -288837, -194347, 397821, 64961, + -441308, -25770, 130460, 579284, -560493, 185220, 1122060, 1092532, -941672, -303869, + 155156, -839129, -1096827, 317291, -200790, -117575, -1137630, -450972, -15032, -213138, + -66035, 797790, -28991, 8053, 564788, 55298, -332323, 77846, 100395, -322659, + 32212, -123480, -170188, 95026, -281320, -185757, + }, + { + 2807298, 7039989, -2641405, 652298, 1169305, -309238, -477278, 722091, -804233, -2645700, + 1517734, 2519535, 2973728, 1809792, 19940996, 5735392, -8973797, 6669548, -8055748, 2495376, + 9383430, 3167539, 1430761, 2066416, -2212445, -4641249, 5874442, 2508261, -42413, 5932424, + -4206384, 762357, 6979859, 2714419, -832687, 1963337, 1004486, -3329674, 1513439, 564251, + -170725, 782758, -126702, -2496450, 1244467, 1824287, 1058710, 1406065, -1503239, 1998770, + -357019, 1364726, -2188286, 1445793, -488553, -1231582, -1541893, 71404, -186294, -78383, + 485331, 1261110, -45634, -121870, 676457, 468688, 191663, -500364, -496606, 698469, + -860604, -791348, -280784, 387621, 156766, -259309, -28454, 291521, -36507, 440771, + 427349, -318364, 89121, 256624, -100932, 43487, 148176, 459025, -41339, -215285, + -74625, 258235, 126165, 554588, -235149, 184147, + }, + { + 6747394, 86356224, -9360344, 35399656, -1530082, 437550, -818728, 331786, 1401770, -5170067, + -2021856, -621160, -1457068, 1421097, -1296543, 427886, -4743792, -3079492, 4312147, -2340757, + -2962991, 1061931, -1745904, -1758789, -341987, -1177358, -5077725, 6695317, 1367947, 121870, + 1805497, -1603633, 3320010, 2544231, 2023467, 1037772, -4961224, 52076, 1272384, 2692945, + 1824287, -2614025, -3517041, -1206349, -3295314, -2115808, -1765768, -1033477, -3570192, 792421, + 1794223, 195421, 2100239, -518617, 749472, 847182, 1661079, 963146, -1362578, -445603, + 2113124, -1545651, 406411, -406411, -347355, -398895, 1373316, -418759, 772557, -1235340, + -1093069, 424665, 8590, 302258, -1194538, -172336, 406948, 511638, -234076, 221191, + -744640, -186831, 223338, -283468, -231928, -656593, -190589, -278636, -450435, -146566, + 543850, 124554, 270046, -357019, -264677, -38655, + }, + { + -953483, -8377871, 61203, 1186485, -1131187, 46171, -37044, -314606, -32212, 2716567, + -1549410, -724239, 1400159, -4347044, 3390340, 2556043, 13560822, 8249559, 5813775, -8712341, + 345745, 5030481, 4315906, 4085051, -8310762, 3088618, 12412455, -31675, 765578, -8152922, + 2626909, 5868536, 1310502, 10004053, 2121714, -4536023, -2165201, -2013803, 2135136, -1279900, + -452582, 289373, -275415, 213675, 234076, -1194538, 316217, -969052, 982474, -739808, + 334471, -2496987, 94489, -252866, -937914, 132070, 472446, -1019518, -273267, -846109, + 428423, 1006096, -104690, 1260573, 970126, -219043, 584652, 602906, 333934, 929324, + 190052, 934155, 1491427, -144418, 203474, 530428, 132607, -24159, 344671, -918049, + -344671, -214212, -195958, 272730, 45097, -360777, -78383, -106300, 95026, -301721, + 47782, -311922, -536334, 380105, -91805, 253403, + }, + { + -15338402, 76453640, 406411, 42577620, -3631395, 1196148, -1227287, 6417755, -805843, 5638219, + -526134, -4773856, -446677, -6037114, 1737851, 722628, 925565, -470299, 4609574, 4891431, + -372052, -4596689, 2175938, 1248225, 3090766, -4053376, -3400004, 723702, -222265, -2626373, + -2097018, 1091459, 1639067, -2171643, 1268626, -645319, -2585034, -819802, -1675574, 2378338, + -382789, -1246614, 2432562, -4232691, -776852, -3816079, -3324842, 970126, -1255204, 2497524, + -4000225, 1529545, -525597, 2471217, 1204738, 480499, -274341, -830539, 901406, -650151, + 693637, 781147, -925565, 1626719, -328565, -627065, 459562, 1009854, -583042, -894427, + 579821, 331786, 235686, 840203, 549756, 125091, 53687, -217970, -250182, 226560, + 792421, 38118, -264677, 83752, -874563, 322123, 287226, -613643, -183073, 221191, + 237834, -70867, -65498, -30065, -465467, -85362, + }, + { + -948651, 1216550, -2149631, 1764158, 1114544, 49392, 223875, 1159641, 3113851, 7516, + 3036005, 870805, 246424, -7507603, 5595269, 9463424, 12219719, 5681168, 1609002, 7758859, + 1283658, -7398081, -2342905, -7041062, -2854543, 3933653, -109522, -3995393, 2720325, -804233, + 3728569, -3078955, -10402948, 446677, -816581, 1021665, 2907156, -1209570, -1132261, -1904818, + -490163, 2111513, 2525978, 1810866, -6137509, -50466, 528818, 1449552, 687195, -992674, + 3496640, -704375, 1094143, -1717450, -222265, -820876, -823023, 916976, 702227, 1042603, + 507343, -1825361, -814970, -666794, 1544041, -1170379, -841814, 130460, -876710, -925565, + 1519345, -546535, -806917, -916976, 1105417, 103079, 2684, -1098975, -311385, 197569, + -483184, 424665, -6442, 40265, 11274, -322123, -132070, 42413, -283468, -77309, + -153008, 76773, -199716, -587337, 618475, -397821, + }, + { + 29759828, 53611928, -64961, 38219304, 1241782, -67109, 1675037, 1647657, 986232, 1436667, + -4996658, -5703717, -24159, -1611687, 547071, -3138011, 738734, 897648, -4010963, 1997160, + 673773, -598074, -708670, -1300301, -3495567, 469225, 1088774, -763967, -4196720, 1461363, + -1362042, -516470, -5872294, 2506114, 237297, 1463510, 2305324, -978179, 578210, -3146064, + 1353989, 5086852, 801011, 427349, -1883880, 638876, 1647657, -3902515, -505196, -4184909, + -3410741, 1435593, -2874407, 1466731, 1477469, -1386738, 139586, 172336, 908922, -468688, + -467615, 319438, 273267, -753767, -258772, -204548, -795106, 330176, -8053, -627602, + 29528, -164819, 1260036, -163209, 480499, 547071, -132607, 556198, 144418, 673773, + -187368, -502511, 1611, 239981, 128312, -420370, -441845, 237297, -242129, -72478, + -166430, 242666, -67109, 0, -192200, -184684, + }, + { + 1034550, 19182398, -6762963, 1136019, 3712999, -2142115, -2985002, -893353, 1956895, -4816806, + 930934, 966368, 1049583, -36507, -2110977, 3647501, 5010616, -4096862, 12737799, -1598265, + 1719598, 1382980, -4007741, 3219078, 3675418, 4634270, -1260036, 2827699, 2418604, 3208878, + -1693828, 2115808, 4614406, -473520, -6200859, 1982664, -3224984, 4728759, -3047279, -1211181, + 3052648, -3762391, -3365107, -1557463, 55298, 540629, 671626, -1305133, -247497, 1138703, + 2182380, -1726577, 1012002, -809601, -606664, 404264, 782221, -1992865, 425739, 686121, + 1357747, -621697, 696322, 934155, 352187, -576063, -301721, -963146, 112206, -148176, + 551903, -1021129, -156229, -91268, -464930, 316754, -612570, 733903, 80531, -111132, + 369367, -127238, 148176, -193810, 253940, -449361, 61203, 185757, -88584, -264677, + 30065, -487479, -138513, 292058, 81604, 9664, + }, + { + 21097954, -57905824, -18009334, 10249403, 5547487, -6953015, -17180, -1795296, -4452271, -2181307, + 100932, 6232535, 588411, 379031, -2370822, 5467494, 1848447, 1249299, -5775658, 1204202, + -7182259, -1953673, 3242700, 2761664, -2607045, 8297340, -2561411, 6754910, 7072738, -273267, + 868657, 478352, 2082522, -1161252, -225486, 758062, 622233, 1416802, -3115999, -2057826, + 669478, 310848, 2273112, 1933272, -60130, -1644436, 1148904, -1074279, 438087, 204548, + -1304060, 1375463, -709743, -1138166, -246961, -762894, 1016297, 117575, -573378, 920734, + -1404454, 1215476, -243203, 201863, -1742683, 441308, -852551, 327491, -926639, 466541, + 4832, -226560, 689342, 460098, -338766, -888521, 798864, 351114, -956167, -153545, + 298500, 212064, 188442, 17180, 182536, 286152, -246961, -81604, 143881, 120259, + 2684, -30065, 112206, -2684, -358630, 244276, + }, + { + 3074123, 3670050, -8563628, -2437931, 6954626, 5049808, 1131187, 6230387, 111132, -2570001, + 1586454, -1089848, 683974, -14190572, 4467303, 2058900, -6294812, 2908767, -5744519, -1108638, + 1524177, -19043348, 5603859, -3331284, -4125853, 3612068, 698469, 3213173, 350040, -10193568, + -3985193, 3318399, 3264175, 1580011, 1327682, -2753611, 426276, 2668249, 468151, -1165547, + 1275605, 361314, -1185411, -1708860, -1520955, 2427194, 2401961, -1244467, 507880, 3982509, + 323196, 920197, 978716, -2112587, 941135, -269509, 233539, -1156957, -222801, -466004, + -862752, -579821, 904628, -491237, -630286, 474594, 384936, -518080, 983011, 484794, + -322659, -613107, 258772, -665183, 579284, -250719, 860604, 64425, 832150, 1036698, + -106837, -88584, 576599, -240518, 408022, -671626, -283468, -311385, -646393, 12885, + -104153, 53687, 254477, 314606, -301185, -93416, + }, + { + 33856692, -149360176, -21298206, 12832289, 13589277, 9284646, -12388296, -4577899, -5811091, 7717520, + 7725036, 2652142, -323196, -6828998, 972810, 704912, -3259880, 411243, -7757785, 1027571, + -358630, -4209068, -2940979, 3382287, 788127, -6365142, 288300, 2187212, 807454, 2865817, + 858457, -1648731, -2338073, -1092532, -1798518, -1970316, -3415573, 907849, 971736, 2660195, + 1410360, -1118302, 263067, 4923643, 781147, 4952098, 19327, -2358474, -1447941, -2015950, + -1952600, -2251100, 2024540, 2075543, -630823, -606127, -1700807, -371515, -82141, -1214939, + 472983, 124017, 210453, -1457605, 93952, -122943, 31139, -108985, 1032940, 2279017, + 277562, 34897, 1575179, -22012, -469762, -594316, -636729, 9127, -208843, -49392, + -252866, 90194, 217433, 199716, 862215, 35433, 499827, -62814, 370441, -128849, + 441845, 266825, -32212, -103616, 253403, -77846, + }, + { + 5824513, -6990596, -9474161, 973884, -512175, -703838, 1586454, 5253819, -1257889, 3375308, + -3583613, -1262184, 3422552, -9201431, -6226629, 12140262, 3595425, 2790655, -747861, -1721745, + 7339562, 1412507, -1616518, -10305774, -2377801, -912144, 3742527, 10929618, 4748087, 4279935, + -7161858, 826781, -2314987, -63351, 3071975, 2006287, 3141769, 4835597, -3083787, -1471563, + 949725, -1620813, 949188, -1690607, -284542, -1034550, 1765768, 1457068, 617938, -625992, + 1915555, -1075889, -281320, -854699, 1802276, 1574106, -1083942, 1074279, 542240, 169651, + -1168231, 127775, 1380295, -498216, -235686, -246961, -1535988, 347892, 1330366, -1061931, + -39192, 60666, 683437, 426812, -14496, 179315, 266825, -77846, -24696, 74088, + -111132, 472446, 184684, 510564, -296353, -311385, 770947, -231928, 567473, 296353, + 118648, 721018, -161061, 187905, 514322, 144955, + }, + { + -3554086, -109644072, -16634408, 9715753, 4388920, -8732205, 666257, -6823093, 262530, 605590, + 10111427, -8761733, 2232846, 2916283, -4741107, 3915400, 3293703, -7164543, -6849399, -7438347, + 2812667, 1614908, -6792491, 1301375, 2074469, 7573638, 1436667, 433792, 1958505, 1160715, + 1553704, -1672890, 482647, 2309619, 768799, 2150705, -1367410, 910533, 152471, -1984275, + -2152852, -3105261, -2639794, -214212, -959388, 605590, 1570884, 956704, 2203855, 666794, + 2485176, 1239635, -1094680, -2330557, 746251, 383863, -644782, -1160715, -1154809, 759672, + 181462, 1147830, -1132261, -681826, 186831, 1039382, 25233, 628139, 563178, 1748052, + -197569, 287226, 87510, 388158, -401043, -62814, -238371, -613107, 549219, -609885, + 130997, -443455, -860067, -16106, -666257, -235686, -905164, 437550, 212064, -254477, + 238908, -69256, -624381, 51540, -139050, -289910, + }, + }, + { + { + -361851, 13681618, -6291590, 16907676, -1526324, 205085, -1680943, -1508070, -676457, -60666, + -3055869, -4917738, 1202054, 3711926, 3087545, 14648523, 4900558, 3365644, 3277060, -5426155, + -467078, 3078955, 3758, 6147709, -1152662, 778463, -11184632, -4116189, -1875290, 5222680, + 1052804, 842350, 4512937, -1221381, 1105417, -1165010, 1275068, 519154, -1777043, 794569, + 1979980, -3216931, -1823751, -500364, 1417876, 568009, 1109712, 810138, -1124208, 9664, + 643171, -1066226, -456340, -110595, -481573, 1299228, 631897, 636729, 816044, 1447404, + 312459, 805306, 1440962, 1215476, 1248762, 962610, 66035, -105764, -80531, 401043, + 1002338, -35433, -12885, -79457, -665720, 249108, 296890, -186294, -753767, 392453, + -193274, -137976, -685584, 249108, 39192, -248571, -541703, -300648, -11811, -317291, + -208306, 15569, 192200, -143345, 96100, 20401, + }, + { + -688269, -54430656, 79994, 6750615, 2541547, 1648194, -1175747, 2955474, 784905, -3207804, + -10206453, 4912369, -2098629, 2931315, -274878, -4381404, 1281511, 2945811, 4784057, 3432753, + 8563091, 374736, -2764885, 1188095, -7160248, -3530463, 665183, -2633889, -3024731, 2085744, + -4675072, -4080756, 3590056, 2399276, -819265, 1489817, 2500745, 3813394, 2282238, 1475321, + -763430, -74088, 1774358, 373662, 621160, 2092723, 1539209, 1078037, 1457605, 244276, + 1063004, -2590402, 238371, -554051, -1440425, 1246077, 118112, -236760, 461709, 68183, + -1032940, 710280, -962073, -314606, 941672, 312996, 689879, -1052804, -118112, -850404, + -678068, -649614, 447750, -352187, 795106, -400506, 761283, -576063, 202937, -253403, + -587874, 562641, -272194, 152471, 50466, 308164, -111132, 272194, -537, 252866, + -395674, -111132, 5369, 55298, 128849, -353261, + }, + { + 2337536, -1289564, 11767137, 33516314, -19545322, -554588, 331786, 2152852, 3186866, 2294050, + 1863479, 528281, 379031, 1897302, 5094905, -5450314, 4628364, 2956548, 6332930, -766652, + -2424509, -11324755, 3687766, 1270774, -2325725, -489089, 433792, -4593468, -1088774, -307090, + -3204046, -5077725, 5163625, 375273, -178241, 1346472, -4727686, -1037772, 1201517, 3456912, + -3738769, -1806034, -1547799, -3013457, -597537, 738734, -1219234, -984084, -980863, -629213, + 1374926, 1615445, -298500, -1533840, -1505923, 23085, -278636, 122407, -294742, 745177, + -838592, -695785, 708670, -464930, 748935, 186831, 886374, -351114, 589484, -415538, + -639950, -98784, -435402, -268435, -437013, -320512, -636192, -576063, -428423, 187368, + -67646, 90194, 179852, 31675, 482647, -362388, 295279, 95026, -68719, -56908, + 249108, -536871, -12348, 64425, -208843, 78383, + }, + { + -2651069, 6271726, 4582193, 482110, 491237, -668941, 715112, -1335198, 577136, -1903744, + 253403, 2079301, 6113349, 5528160, 4598300, 4318053, 17956184, -14171781, 8094940, 4820564, + 1881196, 5424544, -1804960, 3674345, -4512937, 3210488, 4078072, 219580, -3461207, 3851512, + 1255204, 577673, 4962835, 4015258, -1324997, 1534914, -2252174, -465467, -398895, -1170379, + -918586, 297427, -711891, 2269353, 372052, 971200, -60666, 588947, -523449, -370978, + 2107755, -157303, -902480, 1406065, -661425, -1523103, -851477, -59056, -875636, 859530, + 1003949, 11811, 466541, 362925, 870268, -258772, -169114, -820876, -313533, 133144, + 483721, -559420, 386010, -127238, 638340, -159451, -810675, 219580, 408022, 248571, + 428960, -399969, -44023, 439697, -456877, 83215, 160524, 475668, -534187, -48855, + 301721, 89657, 197032, 40265, -48855, 59593, + }, + { + 9275519, 73656544, -7544647, 33267206, 3298535, 861141, 2347737, -3794067, -532576, -4658429, + -166430, -2228551, -4574677, 4141422, -8334384, 4632122, -4963909, 981400, -678605, -1052267, + -3825742, -49392, -222801, -334471, 932545, -2581812, -2371896, -795106, 2212445, 210990, + 2797098, 95563, -266288, 6541772, -120796, -523449, 2361695, -2373506, 2572149, 708670, + 649077, -2233920, -3842922, -1873143, -1425929, -1250372, -1080721, -1864553, -3322157, -816044, + 2353105, 1532767, -583579, 1844689, 892816, 432718, 2106682, -6442, -44560, 26307, + 1480690, -1580548, 449361, -79994, -1253594, 460635, 1571958, -94489, 1083406, -1123134, + -748935, 173409, 486942, 55835, -1057099, -82678, -96100, -115427, -121870, -147103, + -465467, 19327, 17717, -223338, -135291, -300648, -241055, -297427, -507343, 311385, + 191126, 227633, 176094, 134218, -325881, -326954, + }, + { + 504659, -8881455, -1945083, 943819, -1111860, 307090, 239444, -1017907, 648540, 1684164, + -2753074, 10201, -518080, 7228430, -3525631, 4179540, 6608881, 14273250, 210453, -2215130, + 974958, 1131187, 3703873, -804233, 2345052, 1694365, -5297842, 14048301, 1797444, -8952322, + 2564632, 615791, 2542621, 7463043, 886911, 759136, -3322157, -1732482, -647466, 821949, + -2109366, -474057, 2744484, 216896, 39728, -1803886, -1108102, 1018981, 124017, 331249, + -2150705, -807454, -391916, -1426466, 392453, -339302, -542777, -242666, -629750, -84289, + -31675, 1621887, 1062468, 462783, -60130, 875100, 688269, 1252520, 207769, 1060857, + 1222992, 629750, 330712, 627065, -731755, 634045, 287226, -327491, -138513, -166430, + 133681, -263604, -330176, -5369, 356482, -444529, 329639, -267362, 81068, -218506, + -238371, -24159, -302795, 50466, 129386, -144955, + }, + { + 27306866, 28926604, -2156611, 42886324, -6209449, 293132, 689342, 462246, 329639, 2436857, + 1963874, -3564823, -6212134, -4650376, -1932735, 2747705, 1860258, -840203, 2652679, 3811247, + 3989488, -2011118, -2989834, 3222836, 1051730, -3460670, -2262374, -1302449, -1787780, -509491, + -2527052, 1992865, 1181116, -882616, -597537, 593242, -1180042, -3438658, -909459, 2310156, + -1677722, -1330903, 1109712, -594853, -2084133, 530965, -3659849, -1425929, 81604, 149250, + 258235, -2120640, -788127, 2276870, 1038308, 576599, 171262, -1207960, 386547, -138513, + 845035, 402116, 301185, 238908, -135828, -140123, 580357, -292595, -646929, -261993, + 32749, 1161789, 23622, 223875, 1545651, -130997, -319438, -97174, 426812, -103079, + 632971, 437550, -462246, -738734, 155693, -23085, 321586, -604517, -119185, 297963, + 284542, 81068, -131533, -29528, -263604, -317291, + }, + { + 143881, -611496, -4728222, 1046361, 295816, 1031866, -619012, -403190, 5440650, -405338, + 3228742, -477815, 2255395, -2617246, 1367947, 8977555, 11750494, 7963406, 4694400, -1132798, + 2022930, 44023, 17717, -6934762, -3286724, 5565741, -3266323, -3830574, -3558917, 9014599, + -4182761, 2071785, -3438658, -2590402, -1092532, 1888175, 2491081, 2709051, -1316944, -3781719, + -535260, 2942053, 2871186, -585189, -2451890, -1966558, 977105, 810675, 1388348, -199716, + 2510945, -726923, -340913, -447750, -1234266, -605054, -397284, 550293, 830002, 864899, + -572841, -1086090, -854699, 262530, 1130113, -1326071, -143881, -930397, -810138, 203474, + 1181116, -1248225, -918586, 161061, 24159, 263067, -213675, -1032940, -310311, 417149, + 25233, 102005, 388695, 39192, -155693, -157840, -210453, 98247, 19864, -185220, + -233002, -111669, -285078, -575526, 336081, 41339, + }, + { + -8302172, 109266112, 1895691, 39673148, -3632469, -956704, -735513, 2913599, 2091112, -2415919, + -5464809, -465467, 865973, -734439, 1895691, 61740, -3891777, 596464, -4757750, 3477850, + 2645700, -399969, -2376191, -542240, -1567126, -13422, -1230508, -432181, -1057099, -488553, + -2505577, -3462281, -1137093, -139050, 2689187, 1181653, 281320, 1263257, -2542621, -710817, + -302795, 3915400, 1036161, -458488, 47245, 580357, -921807, -3026341, -966905, -3034395, + -1347009, -629213, -557272, 654983, -358630, 1095217, 223338, 1523640, -2090575, 726386, + -618475, 1135482, -1201517, -534187, 634581, -791348, -33286, 146029, -497679, 198642, + -128312, 625992, 310848, 205622, 189515, 503585, 609349, 372588, 204548, 158377, + -596464, 66572, 108448, 191663, -255014, -214748, -378494, 177167, -351650, 141197, + -115964, -119722, 55298, 13422, -278099, -6979, + }, + { + -1846299, 20069846, -2814277, -3994320, 4552129, -4775467, 2580739, 1990717, -650151, -4220879, + 593242, 2603824, 3327526, -624918, 1598802, -2709051, 4173098, -2675765, 8617852, -1202591, + 2114198, -3009698, -2495376, 1457605, 3088618, -2243047, 3320547, 1601486, -1855963, 3473555, + 3590056, -368293, 5469104, -2763275, -5881421, 3571802, -1278827, 941135, -1882269, -147640, + 942208, -1934883, -2969970, -592169, -2573222, 1234803, -679679, -796716, 893353, 2106145, + -72478, -1269163, -128849, -910533, 289910, 587337, -295279, -399432, 26307, 457951, + 1200443, -608812, 527207, 839666, 97174, 297427, -673236, -1072668, -172336, -369904, + 593779, 339302, -1073742, 394063, -427349, 384936, -405338, 461709, 176094, 412317, + 336081, 102005, -195421, -35433, -621697, 328565, -35433, 11274, -89657, 316754, + -278636, -35433, -502511, -183610, 250719, -10201, + }, + { + -20850992, -29579440, 3541201, 6255620, 2638184, -4858682, -7849053, 59593, -4920959, 2072859, + -935229, 4809290, -2707440, 3244848, 111132, -2266669, 6269579, -1210107, -2765959, -5721970, + -4691178, -1115081, 731218, 3371013, -1874216, 4980015, 3462818, 2237678, 4657892, -307090, + -1205812, 2223719, 735513, -954020, 4723391, -1208496, -3271691, 3207267, -2641405, -1067836, + -2607582, 1942936, 2952790, 1350230, 832687, -1911261, 1645509, -1195075, 94489, 882079, + -1014149, -148176, 874563, -705448, -2630131, 981937, 369367, 1066226, -521302, -1851668, + 551903, 588411, 689342, -199179, -194347, -329102, -1314260, 39728, 19327, -555125, + 33286, 149250, -449361, 528818, -292595, -618475, 784368, -896574, 336081, -144955, + -15569, 297427, 583042, -17180, -40265, -346282, 268972, -117575, -261993, -144418, + 296353, -263067, 277025, 254477, -277562, -110059, + }, + { + -2675228, -5415417, 7152195, -5264020, 5435818, 150861, 7081328, 4677757, 119185, -3055869, + 1609002, -318364, -616328, -12060268, 7241315, -4399121, -183610, 1866700, -12800613, 6646462, + -10050223, -2988224, -7519951, 796716, 1676648, -4936528, 2925410, 10153303, 387084, -11089069, + -1152125, 2197950, -145492, 2815351, 3430605, -117575, 102542, 683974, -2969433, -2163590, + 2859375, 292058, -2853469, -2437394, 1400159, 2326262, -374199, -1301912, 2480881, 350577, + 1079111, 1307818, -47245, 480499, -1337346, 1467805, -91805, 131533, 283468, -468151, + -2092723, 534187, -305480, 761283, 216359, -1238024, 614180, 865436, 153545, 697395, + -1240172, 12885, -411243, -130460, 210990, 73014, -120796, 428960, 1246077, 10201, + 628676, 273267, 77846, 537, -265214, -256087, -512712, -13959, -478889, -348429, + -237297, 23622, 103079, 364535, -459562, 134755, + }, + { + -50934016, -54827940, 14853608, 4773856, 20151986, -15551003, -7312719, 6500970, -3778498, -3400540, + 6340983, 6868190, 1032403, -5746130, 371515, -3691525, 2991445, 2683818, -11222213, 2827699, + -5014911, -2317672, 1373316, -1705102, 1870995, -8343511, 1593970, 3173444, 2331094, -673236, + -40802, 74625, -3450469, -1946694, 834297, -1562831, -1715303, -282394, -1676648, 1415729, + 1316408, 1088774, 3120831, 2828773, 2435247, 6316823, -476205, -1224066, -1440425, -1821603, + -4540318, 871342, 24159, -66572, 323196, -1534914, -1057099, 703838, 16106, -237297, + -1832877, 606127, 15569, 397821, -531502, 119185, -31139, 888521, 353798, 609349, + 921807, 326954, 307627, 545998, -998580, -271120, -670552, 420370, -625455, -541166, + -187905, 318364, -245350, 514322, 381715, 448824, 276489, 442382, -21475, 88047, + 269509, 671626, -143345, -193274, 69793, 114890, + }, + { + -5032091, -12279311, 8117488, 1087701, -1282048, 8590, 4680978, 738734, 7831873, 2159295, + -2105608, -1626719, -1308891, -14971719, 13484050, 5659693, 201327, -32212, 3889630, 3408594, + -2560874, 3034395, -5290326, -5596880, -9142912, 5963025, -8256538, 15920370, 5935645, 5400385, + -4765803, -6019397, 987843, 3922379, -954557, 2421825, 5000953, 2265595, -15032, 1228361, + -2308008, -517007, -748398, -1496259, -1985886, 1305133, 1087701, 1803886, -500364, -722628, + 1212255, -81068, 82141, -386547, 609349, 378494, -710817, 1626719, 92879, 1195075, + -1643362, -6979, 489626, -763430, -494458, -176631, -416612, -462783, 1222992, -470299, + 459025, -1182727, 439697, 526134, -245350, 178778, 374199, -145492, -173946, 732829, + -192737, 358630, 214212, 590021, -104153, 298500, 234076, 124017, 520765, 450435, + -62277, 258235, 235686, 289910, 310848, 258772, + }, + { + -17486422, -98455680, 3553012, -6730751, 2152852, -1704028, -5369246, -43487, -6291590, 5942088, + 4564477, -8884140, 9029095, -5927592, 9374303, 3988414, -4203699, -5497022, -5009006, -5583995, + 2419140, 1345399, -1137630, -4859219, 2978023, 2893734, 6755984, -1971390, 1787780, 2221572, + 2539936, -3305514, 2528662, 6567005, 20938, 275952, 505196, -2012192, -490700, -108985, + -5577015, -820876, -1632088, -2319819, 1677722, 1336272, 1178969, 1844152, 105764, 1667521, + 1201517, 2592013, -3781182, 366683, -1582696, 1672890, -1316408, 320512, -1636919, 240518, + -1195612, 2217277, -878321, -549219, 740882, 105227, 547071, 1178969, -230854, 1187022, + -328028, 1139240, 34897, -290984, 295816, -64961, -354335, -95026, 199716, -466541, + 213138, -359704, -530428, -119722, -255551, -788663, -189515, -262530, 99321, -151934, + 301185, -181462, -243203, -346282, -360777, -23622, + }, + }, + { + { + 969052, 22889492, -600759, 2787434, -13801341, -725313, -717260, 1015760, 523449, -1262720, + -6460168, -4789426, 4217658, 523986, 2657511, 12582644, -162672, -665720, 936303, -4516158, + -7523172, 1389422, -1365263, 1089311, -1082869, -3466576, -8222178, -741956, -1020592, 4503810, + -447750, -619549, 2045478, -149250, 1545115, -1596117, 579284, 1493038, -1416802, -2204929, + 2380486, -1589138, -2291365, 2263985, 4283156, -1672353, -656593, -199716, -2121177, -148713, + -45097, -756988, -735513, -1429150, -180926, 583579, 484794, 805843, 475668, 974421, + 184684, -42950, 496069, -84289, 301721, 375273, -621697, -1188095, -577673, 137439, + 577136, -77846, 44023, 319975, -334471, -11274, 135828, 156766, -759672, -77846, + -488016, 76773, -469762, 418222, 275415, 89121, 37581, 68719, -82678, -443992, + 28991, -115964, -167504, -417149, -67646, -31139, + }, + { + -1756642, -48007532, 9258876, -16416439, -12880607, -736587, -330176, 5405753, -681289, 2172717, + -5131412, 2122788, 964757, 9249749, 3937411, -6672232, -5020280, -1465121, 4536023, 2782065, + 7173133, 4286914, -1376000, 551903, -2538863, 3352222, 5186173, -2967823, -4547834, 4231617, + -1805497, -2576444, -1005022, 701153, -1985349, 674310, -391379, 1348083, -779537, -215285, + -1392643, -1359357, 1794760, -595390, -26307, 691490, 424665, 46171, -454730, -129386, + 726923, -2997350, 391916, 827318, -980863, -13422, 90194, 923955, 333934, 700080, + -375273, 233539, -995896, -788127, 784905, -188979, 665720, -388695, 1068373, 193274, + -128849, -848256, 401043, 10201, 664646, -639413, 276489, -876710, -59056, 104690, + -615791, 223875, -255014, 171799, 226560, 251792, -331249, -349503, -484258, 125091, + -367220, 79994, 30602, -77846, 258772, -166430, + }, + { + -2629594, -5983963, 8587787, 34946000, -12437152, 492848, 1507534, 2031520, 1643899, -1488743, + -4136054, 2743947, 1227824, 896574, 6008123, -6830609, 2629057, -1909650, 733903, -3521873, + -2889976, -7878581, 1084479, -2763812, 1016834, 2182380, 4948876, 763430, -590021, 462783, + -3034931, -2700461, 4313221, -1456531, -1576253, 152471, -4314295, 2348810, -339839, 2849174, + -1858110, -158377, 248571, -1745904, -1257352, 557272, 697932, 951872, 431644, 15569, + 1363652, 907312, -725313, -903554, -984084, 1177895, 743566, 674310, -1044214, 818191, + -608812, 154082, 1618129, -242666, 1056025, -229244, 211527, -98247, 1355062, 124554, + -642635, 291521, -38118, 135828, -182536, -104153, 50466, -202937, -106837, 377957, + 175557, 267362, 20401, -603980, 170188, -376883, 12885, 54761, 94489, 58519, + 493384, -118112, 351650, 108448, -117038, 76773, + }, + { + 1993939, -4310000, -8063264, 1597191, 394600, -849330, 703301, 164819, 2121177, -1891933, + 279710, 293132, 1682017, 6892349, -1502702, -1645509, 15373835, -9424769, 13386339, 83752, + 1197222, 1275068, -3470334, 2554432, -4088809, 5041218, 4839355, -39728, -6233608, 5142687, + 3700114, -3117610, 322659, 679142, -3445638, -1889786, -4417911, -1152662, -2729452, -300111, + 390842, 376347, -610422, 3386045, 493384, 382252, -1399623, 1463510, 607738, 630286, + 1577864, 46171, -212601, 321586, -948114, -213138, 453656, 734976, -991064, -375810, + -199716, -968515, 469225, 920197, 896574, -989990, 339302, -150324, -685047, -84826, + 747324, -379568, 500364, -165893, 406948, 261993, -284005, -141734, -230318, -118648, + 188979, -295279, -354872, 154619, -667867, -128312, 330712, 555661, -359704, -39192, + 197032, -204548, -27917, -210990, -120796, 39192, + }, + { + -15811385, 16307991, -17729088, 24616068, -8121783, 16643, 514322, -8151311, -4054449, -8018167, + -3430068, -7868380, -5034776, 6711424, -7683697, 8648454, -1879585, -3725884, -5161477, -195958, + -4060892, -3392487, 2696166, 2285460, -376347, -3475166, -4913443, -4072166, 107374, -2094870, + 1545115, -306016, -3730179, 1454920, -3583077, 54224, 4694400, -2031520, 2912525, -1363652, + -2444373, -3410204, -463320, 2090039, 690953, -11274, 1729798, 351114, -1856500, -1655173, + 419833, 833761, -823560, 2121714, 442919, -441308, 6979, -664109, 645319, 59593, + 566936, -1308354, 326418, 448287, -153545, 1292785, 816044, -529892, 1020592, -438624, + -60130, -68183, -481036, -6442, -503585, 329639, -357019, -264677, -70867, -125091, + -348966, -192737, 292595, 303332, 124554, 74088, -145492, -45634, -102542, 199716, + -259846, 94489, 123480, 302258, -49392, -66035, + }, + { + 553514, 2603824, 4868883, 33823, -2065342, -90194, -188442, -509491, 532039, 483184, + -661962, 819802, -786516, 4864588, -5554467, -1412507, -11439109, 4908611, 2165201, -804233, + 2256469, -2357400, 458488, -284005, 2295660, -629213, -9540733, 12630425, 833224, -8902930, + 3992172, -5055714, -3952981, 1261110, -796180, 5995775, 2748242, 2379412, 256624, -620086, + -260382, 1107565, 2576981, -155693, -1713692, -1605781, -541166, 274341, -1771137, 646929, + 220654, 1021129, 313533, -761283, -46708, -742493, -746787, -345745, -756451, 364535, + -24159, 1653026, 1040456, 359704, -110595, 216896, -119722, 539018, 16106, 338229, + 355945, 259846, -239981, 511638, -938450, 194347, -159988, -476741, -98247, -87510, + 693637, 165893, -304943, -66572, 341987, -456340, 341450, -233539, 66035, -111132, + -427886, 34897, -118648, -60130, 192200, -114890, + }, + { + -22243636, -33153390, 3820910, 47270948, 2033667, 986769, -2970507, -2733210, 409633, -4952634, + -598074, -2343442, -16106, 943282, 708670, 1520418, 208843, -366683, -1538672, -1055488, + -1152125, -913217, -3149822, -3237332, -5523328, -2655901, 157840, -3526705, -3113315, 508954, + -1526861, 914828, 1287417, 2917894, 1212791, 2138357, -1068373, -1817845, -1632625, -866510, + -156229, -1105954, 251792, 2447595, -321586, 2644089, -527744, -1045288, -901406, -549756, + -1096290, -3172370, -1449552, -93952, -113280, 1132798, 897111, -1455994, 577673, -428423, + 337692, 313533, -104153, -609885, -42950, 471373, 705448, -254477, -210453, 29528, + -194884, 897648, 52613, -101469, 483184, -479426, -154082, -177704, 231928, -31139, + 293668, 498216, 145492, -42413, 565862, -164283, 298500, 40802, 12348, -13959, + 220117, 148713, 13422, 104690, 274341, 239981, + }, + { + 966905, 5768141, -1756642, -1733019, -2850248, 671089, -1156957, -2363306, 2556043, -2106145, + 2659122, 459025, 3440806, -2094870, -45097, -7947837, -17884780, -876710, 10343892, -5277441, + -1187559, 6013491, 428960, -3473018, -290984, -2772938, -9012452, -3569655, 1784022, 11120207, + -5684926, 6961605, 6524056, 3584687, 1320703, -128312, 1961190, -71941, -1948841, -178241, + -857383, 625992, 1200443, -1515587, -1685238, -1154273, 219043, -409633, 2615098, -517007, + 226023, -982474, 240518, -24159, -565325, -385473, -431644, -846645, 37044, 1511829, + 569620, 718870, 47245, 55835, 891743, -835908, 471910, -570157, -391379, -88047, + 342524, -596464, 102542, 619549, -187905, 27380, -221728, -702227, -137439, 970126, + 466004, -12348, 528281, 43487, 52076, 252866, 428423, 438087, 143881, 132607, + -139050, -273267, -101469, -537408, 32749, 28991, + }, + { + -11508365, 89314384, -9924596, 48168596, 4358318, -792421, -1838783, -2609730, -2365453, -1913945, + -3706557, -459025, -1973001, 6497749, 6732898, 4721780, -2089502, -576063, -4875325, 4576825, + 3949223, 936303, -610959, 2378338, 648003, 1389959, 667331, 1885491, -515933, -2522757, + -2317135, -2211371, 200790, -847182, 1432372, -2193655, 454193, 3214783, -491774, 1015760, + 55298, 1628866, 677531, -677531, 2014877, 1865090, -367757, -762894, 3094524, -1191317, + -643708, 1274532, 253403, 533113, -1011465, 1947231, -6442, 597000, -1867237, 2200634, + -408022, 173946, -336081, 774705, 219580, -666257, 543850, 564788, 318364, 521839, + -420907, 681289, 265214, 97711, 172336, 196495, 335544, -26844, 33286, -54761, + -785979, -175020, 95026, 88047, -471910, 432718, -147103, -215822, -433792, 462783, + 111132, -275415, -299037, -94489, -114354, 290447, + }, + { + 1786706, 22038550, -103616, -5015448, -2170569, 1631551, 8316668, 2066416, 4161823, -2363306, + -2167885, -3207804, 952409, -1859721, -640487, 264141, -617402, -1533840, 8363375, -6345278, + -3459596, -11781095, -6839199, 1428614, 30065, -6571300, 3862249, -117038, -5725192, 2877091, + 3917010, -621160, 3013457, -4256850, -2296197, 2568391, -788127, 2326799, -100395, -427349, + 2640331, 2270964, 1191317, 513249, -2771865, 811749, -138513, -904091, -501437, 1418413, + -288300, -1392106, 94489, -452045, 218506, 442919, -664646, 1018981, 259309, -681826, + -73014, -572841, -348429, 555125, -314606, 304406, -119722, -616865, 242666, -94489, + 694711, 703301, -758599, 991601, 115964, 820876, 78383, 306553, 35433, 108448, + -324270, 347355, 287226, 73551, -244276, 552977, -151934, -142271, -268972, 320512, + -248571, 26307, -347892, -188442, 258772, -170188, + }, + { + 20541218, -10235444, -29348586, -5096516, -3409667, 1465121, -6252936, -3849901, -4949413, -1314260, + -4085051, 1868848, -3499325, 2349347, 2216203, -4741107, -1805497, -1590212, 4867809, 1011465, + 3953518, 2776696, -4379256, -1395328, -3172907, 2848100, 753230, -4960151, -617938, -2768643, + -2185602, 1374926, -1331440, -2757906, 6025302, 499290, -3383897, 2288681, 20938, 938987, + -2525441, 1357210, 1052804, -244276, 1374390, -499290, 2761664, -1260573, -52076, 1784022, + -1534377, -1481227, 158377, -1060857, -2318209, 921271, -1374390, -233539, -587337, -500901, + 1308891, -574989, -169651, -908922, 472983, -127238, -454730, 434865, 500364, -224412, + -121333, 360240, -602906, 384400, -13422, -745177, 320512, -1090385, 653909, 253940, + 216896, 198642, 368830, -38118, -231928, -476205, 112206, 143881, -255551, -180926, + 205622, -173946, 241592, 346819, 81604, -134755, + }, + { + 1765232, -18196702, -2752537, -3912178, -555125, -2576981, 4874251, -1047435, -889595, 1359357, + 150324, -2915746, 1134945, -4798016, 5981816, -2436320, 2229088, 5416491, -4469451, 9208947, + -5402532, 6703907, -5724118, 5065377, 1271847, -2655364, -22012, 2338073, -2093797, -5047124, + -725850, -155693, -2137820, 1488743, 2367601, -660351, 1172526, -106837, -2146947, -1699733, + 1721745, 970663, -2412161, -2434710, 577136, -1931125, -3084860, -3301756, 1132798, -607201, + 643171, 317828, 894964, 1910187, -2252174, -207769, -745177, 1295470, 1063541, 574452, + -1072668, 1403917, -946503, -951335, -94489, -438624, -227633, 529355, -637803, -62814, + -1122060, 248571, -862752, -581968, 606127, 690416, -34360, 27917, 202400, -807991, + 584116, -34897, -199179, 82141, -281857, 183610, -439697, 134755, -14496, -324270, + -381715, 137439, -51003, 235149, -335544, 224949, + }, + { + 45488000, 61630096, 892279, -4978404, 16331613, -14806363, -773631, 8176544, -7302518, -9097278, + -1502702, 7088307, 4256850, -4275640, 1692217, -2233383, 4044786, 2923262, -11470247, -370978, + -6822556, 792421, 5749351, -92342, 4255239, -1706176, 4671851, 2277943, 1207423, -864362, + 1589138, 839129, -1074816, -967441, 1405528, -810138, -998580, 2989834, -801548, -2666638, + 583042, 548145, -72478, 1996623, -1479079, 1660542, -865436, -587874, 202937, 1150514, + -2367601, 1756105, 1025960, 307627, -719944, -796716, 138513, 869731, -68719, 466004, + -1057636, 412854, 254477, 1164473, -461709, 17717, -185757, 757525, -463856, -794032, + 132607, -328565, -576063, 85362, -799938, 433255, 341987, 675384, -942745, -725850, + -901943, 299574, -504659, 90194, -38118, -147103, -183610, 277025, -169651, -15032, + 100395, 700080, 101469, -171262, 96637, -17180, + }, + { + 4102231, -16379932, -4167729, 2417530, 222801, 2532420, 6465000, -860067, 7732552, -1898376, + -3736622, -1322313, 745714, -2331094, 29152628, 8551280, -2304250, -7648263, -1868848, 3349538, + 1155883, 5046050, 1542430, 2662343, -8367133, 6379100, -9160092, 7233262, -1650341, 3621731, + 928787, -552440, 2062121, 3900367, -3027952, -1445793, 3183108, 2403571, 2386928, 1895691, + -2602750, 260382, 362388, -588947, 538482, 2244657, -2109903, 96100, 215285, -577673, + 807991, -289373, -198642, -2321967, -907849, -146029, -1387811, 911070, -854699, 352724, + -1078574, 157840, -876173, -847182, 713501, 339302, 418222, -98784, 306016, -466541, + 641561, -1030792, 29528, 345745, 284542, 623844, 424128, -49392, -292595, 469762, + -106837, 437013, -285078, 468688, 53687, 540629, 141197, 46708, 70867, -1611, + -293132, 102005, -94489, 15032, 249645, 97711, + }, + { + 28984050, -38580080, 2386391, -14267881, 1460289, 6015639, 225486, 6349573, -5329518, 2104534, + 1949378, -348429, 6586333, -9077950, 12467753, 3185255, -7622493, 205085, 2095407, -334471, + -628139, -1992865, 1905892, -1710471, 2801929, -2761664, 4529580, -3431142, 2512556, 3852049, + 820339, 107374, 4836133, 4204236, -2284386, -1535988, -112743, -1841467, -599685, 3499325, + -530428, -362925, -338766, -1574642, -657667, -1099512, 57982, 259309, -2376728, -540092, + -386010, 2478733, -3629784, 338229, -2894271, 690416, -2142115, 584652, -1418413, -382789, + -1517734, 1317481, -183610, 180926, 951872, -396211, -170188, 449361, -1557463, 655519, + -257698, 875636, 215285, -143881, 384936, 219580, -101469, 44560, 569083, -223875, + 588411, 850940, -35433, -5369, 539555, -291521, 47782, -170725, -183610, -16106, + 136365, -327491, -53150, -129923, -162135, -11274, + }, + }, + { + { + -1656247, 23449448, 1792075, -14124000, -1604707, 1885491, 488553, -2416456, 5230197, -4719632, + -5170067, -3269007, 3211562, 580894, 3762391, 5083094, -8357470, 7420093, -2627983, -4983773, + -6761889, -1523103, 440771, -2729989, 1708323, -4775467, -1402307, -2155000, 212601, 1443646, + 3694746, -3925600, 3005940, -312996, -1808181, 3104725, -2386391, 3033321, 703301, -2895882, + 2761664, -111132, -5199595, 3721052, 4305705, -857383, -1850594, -903017, -1067299, -83752, + -1934883, 533113, 181462, -906238, 867583, -47245, -12348, 731755, 398358, -106837, + 796180, -241592, 785442, -758062, 718333, 456877, -665183, -952946, -393526, 341450, + -333934, -39728, 477278, -18254, 112743, -381715, 106837, 331786, -151934, -571231, + -250719, -167504, 322659, 105227, 118648, 144955, 209380, 19327, -210453, -293132, + -222801, -171799, -186831, -80531, -141734, -65498, + }, + { + 1266479, -39521216, -5704254, -27304718, -3798362, -2976412, 3138011, 2635499, -2610266, 3663607, + 4796405, -10110353, 7364259, 4281546, 5760625, -10509785, -2266132, 461172, -2339147, 2900714, + 3316252, 9428527, -539018, -2753611, 1788854, 834834, 2417530, 1516660, -3055869, -985158, + -3112241, 4172561, -737661, -979253, -3737695, 1553168, -2570001, 1809792, -1984812, 519154, + -1191317, -1078574, 1610076, -986232, -70330, 1633161, -822486, -372052, -1225139, 1055488, + -765578, -1454383, -640487, 606664, 1420024, -938450, 110595, 1787780, 715649, 44023, + 508417, -134218, -309775, -602906, 570157, -46708, -156766, 348429, 1090385, 488553, + -492311, -558346, -120259, 535797, 157840, -104153, -700617, -252329, -81068, 56371, + -255551, -120796, -130460, 79994, 369904, -33286, -406948, -140660, -458488, -130460, + -101469, 78383, 1074, -128849, 169651, -4295, + }, + { + 1735704, 13484050, -21270288, -7835094, 27815818, -293668, 3438658, 1636919, 1118302, -595927, + -5668820, 2672007, -957241, -2631741, 179852, 570694, -2550674, -67109, 1795833, -5114233, + -3671123, -9380745, -889058, -345208, -1087701, 6117644, 3650185, 3648575, -3500935, 813359, + -2217814, 2305861, -3948149, 3266860, -1887638, -588411, -3377992, 2338610, -1906429, 2732673, + 235686, -9664, -199179, -379568, -1797981, 535260, 989453, 127775, 699543, 2173790, + 206158, -263604, -2046015, 1287953, -119722, 1138166, 53150, 1208496, -1736241, -198105, + 84826, 626528, 1438814, 119722, 122943, 680215, -235149, 481573, 102542, 892279, + -119722, -19864, 371515, 143881, 522912, -418759, -26307, -494995, 266288, -92879, + 371515, 20401, 333934, -323733, -297963, 59593, -110059, -80531, 155156, 4295, + 303869, 222801, 368293, 21475, -209380, 19327, + }, + { + -1667521, -21677236, 5808407, 3423089, 431107, 277025, -33823, -85899, 3268470, -814970, + -2138894, 1479616, -1475858, 6926709, -6220724, 6735583, -4643934, -713501, 12833899, 895501, + 3255585, -1474784, -1369021, 2585570, -3636227, 3658239, 3070902, -255551, -3577708, 4979478, + 1825898, -6486475, 978716, 1492501, -2206003, -2813741, -2618856, -3167002, -1248225, 1105954, + 658741, -625992, -804770, 3764539, -215285, 141197, -830539, 1392643, 1583232, 2273648, + -46708, 791348, -202400, -277025, -842887, 991064, -176094, 144955, -672699, -727997, + -507343, -384936, 473520, 917512, 665183, -868657, 288837, 78383, -556198, 433792, + -391379, -118112, 73551, 166430, 296890, 4295, 241055, -277562, -382252, 65498, + 13422, 40802, -344134, -44023, -303332, -147640, 311385, 295279, 19864, 18254, + 125091, -257698, -14496, -66035, -63351, 2147, + }, + { + 11935177, -56594784, 1795833, 14442901, 5864778, 1180579, -2581275, -4219806, -5821828, -3341485, + -6913824, -11547556, 1810329, 5468567, -6209449, -4475893, 6046777, -5699422, 21475, 1567663, + -7592966, -3786014, 4939213, -3163780, -2381023, -142271, -1938641, -4308926, 848256, -3920232, + 1038845, 723165, -4643934, 1184874, -217970, -1597191, 3194919, -3441343, 840203, -903017, + -1972464, -1580011, 485868, 2100776, 711891, -256087, 845572, -497142, 367220, -1036161, + -983011, 73551, 122943, 1030792, 915902, -179315, -1445793, -302795, 33823, 1258425, + -940598, -1045288, 628676, 782758, 152471, 759136, 156229, 226560, -642635, 140123, + 470299, 12885, -1652489, 319438, -624918, 615254, -372588, -8053, 161598, -109522, + -352187, -149250, -127238, 519691, -76236, 105764, -214212, 188442, 133144, -328565, + -238908, 258235, -10201, -61203, -54224, 199179, + }, + { + -254477, 17551920, -3111167, -1491427, -1750199, -192737, 20938, -831076, 1284732, -2107218, + 5763309, -2748242, -2733210, 4354560, -2160906, -10411538, -10537702, 4062502, 7510287, -12693776, + 11293080, 730681, 118648, -374736, -3740917, 2164664, 2139968, 1211718, -142271, -3534758, + -1600949, -5313949, -1311039, -3790846, 2654827, 7136088, 4198868, 1439888, 122407, 332323, + 737124, 1937030, 1243930, -944356, -744103, -1822677, -667331, -162135, -668941, -974958, + 822486, 2088965, -357019, -119722, 258235, -1038845, -768262, -854699, -663572, -24159, + 51540, 1462436, 624381, 433792, -253403, 155693, 191126, -150861, 920734, -705985, + -129386, 738198, -339302, -53150, -140123, -299037, -504122, 91805, -88584, 263067, + 104690, 136365, -215822, -128312, 125628, -351650, 226560, 48318, -255551, -125091, + -170188, -93416, -199179, -80531, 194347, 250182, + }, + { + 2974802, -73421392, 9941239, 46668040, 353798, 436476, 1424855, -6222871, 1935957, -2871186, + -1049046, -1755568, 2563022, 1273458, 291521, 1144609, -1384590, 2912525, -2532420, -439160, + -7351374, -266288, -253403, -1817308, -9468255, -1284195, 125628, -2503966, 113817, -3270618, + 1101659, 1391569, -1407676, 3316252, 598611, 3155190, -2798708, 2786360, -1343788, -3454764, + 2126546, -1912334, -2130841, 2607045, 392453, 2404645, 169114, -2011118, -396748, 629750, + -1973001, -2257542, -1133335, -419296, -547071, 1050120, 1756105, -1408749, -83752, -207769, + 455803, 716186, -957241, -614180, -267362, 1089311, 402116, 95026, -438087, -1611, + -63888, -197569, 484258, 472446, -543850, 245350, -428423, 427886, -385473, 325881, + 213138, 277562, 175557, 341987, -70330, 149250, 48855, 283468, 47782, -89121, + 235149, 78383, -1611, 298500, 205085, 351114, + }, + { + -9664, 7756711, 3109556, -4378183, -2589865, 193810, -714038, 346819, -1999844, 465467, + -1930588, 4334159, 3371013, 2906082, -6788733, -11082089, -20312510, -2626909, 10624138, -2196876, + 446677, 3126199, -1185948, 1061394, -4377646, -2473364, -2712809, -8740795, 7905961, -629750, + 1032403, 2435783, 7310571, 3913252, 3212636, -4675609, 1108102, 215822, -600222, 2685965, + -3818763, -395137, 2013266, -1969243, -2035815, 554588, 1143535, 374199, 231391, -1375463, + 1025960, 298500, -699543, 541703, 970126, -1298154, 673236, -1500554, -354872, 1633161, + 255551, 609349, 1138703, 23622, 521302, -1103807, 188442, -185757, 448824, -652835, + 146029, 130460, 123480, 272194, 373125, -590558, -379031, -2684, -17717, 500364, + 642098, -104690, 198105, -537, 255551, 13422, 639413, 359167, -110059, 157840, + 72478, -88584, -35433, -305480, -380641, 154619, + }, + { + 23422068, 7062000, 14412300, 49093624, 1126355, 825707, 807454, -5477694, -5994164, 4233764, + -6172942, 2747169, -4357245, 388158, 4258460, 7960722, -1503239, 319975, -1207423, 2582349, + 2584497, -1859721, 2629057, 1397475, 2725157, -870805, 3221762, 638876, -391379, -3871376, + -1698123, -1211181, 986232, 115964, -743566, -2445447, 2964064, 583042, -386547, 1964411, + 1100049, 1072668, 266825, -382789, 1605781, 1654636, -396211, 2071785, 2734821, -2835215, + 736050, 474594, -159451, 912144, -265751, 1552094, -387084, 57982, -85899, 769873, + 743566, -862752, 887448, 601295, -823560, -67109, 175020, 1042066, 478352, 393526, + -124554, 202400, 273804, 174483, 642098, 39192, -163209, -40265, 241592, -218506, + -525597, -217433, -294742, 34897, -406948, 406411, -88584, -326418, -30065, 242129, + 93952, -235686, -120259, -227633, 47245, 487479, + }, + { + -1549410, 8670465, 5792837, 7372312, -3117610, -4786741, 11842299, 717796, 3583077, -144955, + -2347737, 2021856, -6385543, 4473746, -10779294, 5320391, -1862405, 998043, -5101885, 4064650, + -1657857, -10802380, -5610838, 3386045, -1612760, -6972343, 726386, 2450816, -2381023, -1835025, + 4489315, -1107028, 2407329, -89121, 1312113, -2240362, 1648731, 16643, 1254667, -1809255, + 2442763, 2183991, 1414655, -629750, 28991, -91268, 401579, 137439, -1808718, 1223529, + 1128503, -198105, -807991, -1204738, 505196, -676994, 477278, 509491, -38655, -110595, + -845035, 308164, -148176, 81604, -350040, 161598, 270583, -702227, -49392, 715112, + 121870, 89657, 18790, 345745, 627065, 430570, 66035, 420907, 295279, -254477, + -338229, -27380, 467078, 40802, 261993, 148176, 162672, -166430, -197569, -55835, + 93416, -17717, -333934, -52613, 197032, -133144, + }, + { + -19452444, -4708358, 3044058, -7554311, -1347009, 7254200, -1726040, -8742406, -682363, -5971079, + 3704409, -7453379, 3467649, -547608, 3732864, -4795868, 1564442, -5120138, 5835250, 6470905, + 4907537, -1886564, -1964411, -3430605, -70867, 1364726, 173409, -1986959, -2428267, -2267743, + -477815, 470299, -3665218, -746251, 3843996, -1048509, -1617055, 2313914, 179315, 1452773, + -369367, -1448478, 923955, -408559, 1432372, 95563, 1191317, -550830, 1058173, -161598, + 875100, -2129230, -1485522, -426276, -981937, 638340, -1987496, -789200, -296353, 330176, + 812286, -568546, -205622, -667331, -476205, 53687, -99858, 323733, 812286, -221728, + -194884, -23085, 280784, 6442, 132070, -488553, 186831, -370441, 437550, 250182, + 311922, 87510, 24696, -20401, -203474, -212064, 219043, 479426, -431644, 191126, + -205622, -30602, 154082, 238371, 129923, 25770, + }, + { + -1075352, -28394028, 3246459, 3753802, -7366943, 4603668, -3131031, 503048, -88584, 2648384, + -1788317, -271120, -4497905, 8446590, -4954782, 2869038, -908386, 4808216, 5815923, -2264522, + 2305324, -1609002, 3877819, 882616, 742493, 1673964, -8125542, 3763465, -2510409, -3860639, + -1445257, -1379221, -1941862, 2263448, 2871723, -2733210, 7124814, -3664144, -1005559, -132070, + 2436857, -1947768, -2451353, -887448, -877784, -3174518, -3060164, -1002875, 1380295, -1002875, + 1669669, -848793, 645319, 52613, -1063004, -1403381, 521839, 865436, 96637, 1019518, + -368830, 286152, -588411, -1026497, -432718, 306016, -393526, -276489, -307627, -321586, + -430570, -189515, -481573, -203474, 290447, 1116155, 32749, -135828, -218506, -703838, + 421444, -260382, 3758, -49392, -285615, 206158, -248571, 34360, -147640, 1611, + -183073, 47782, -38655, 289373, -234076, 129386, + }, + { + -23124104, 153413008, -18264348, 6784975, 14489609, -14009646, 6308233, 1181653, -12002823, -7255811, + -3216931, 8703214, 2796561, -4328254, -3205119, 4450123, -403727, 3508988, -8529805, -2107755, + -2506650, 1899449, 2540473, 644245, 134755, 4944581, 3691525, -870268, 4239670, 455803, + -330176, 1228898, 1794760, -1102196, -477278, -1479079, -606127, 3889630, -1884417, 203474, + -351114, 580357, 117575, 1284195, -5167383, 24159, 1146219, 456340, 257698, -345208, + -96100, 427349, 766115, 746787, -1782411, 1283122, 46708, 848793, 34897, 431107, + -363998, -557272, 355945, 504659, 86973, -110059, 200790, 824097, -642098, -366683, + -286152, -671626, 191126, -655519, 367757, -376347, 912144, -251256, -49392, -817654, + -856309, 252329, -4832, -486405, 147103, -184147, -206695, -135828, 19327, -517544, + 340913, 404801, 141734, 127775, 339302, 55298, + }, + { + -3553549, -25572236, 8360691, 7591355, 572841, -1292785, 3831111, 1779190, 4425964, -6077379, + -1869921, 300111, -1230508, 14536317, 13489419, -469225, 2696166, -4749697, -555125, -3106872, + 6113349, 7558606, 3107946, 3297998, -3351148, -204011, 3521336, -8157217, 632434, 2978023, + 171799, 3371013, -673236, 2768107, -2874407, -2223183, 3297998, 78920, 3141769, -47245, + 2633352, -2071248, 905701, -980863, 1801202, 2677912, -2562485, -1294396, 1125818, 130997, + -1437740, 903554, -22549, -2724083, -169114, -71941, -235686, 194884, -1138166, -419833, + 53687, 80531, -1102733, -844498, 1426466, 653909, -198642, 197569, -520765, -133144, + 412854, 513249, -947577, 67109, 772020, 754841, 128849, -252866, -413927, 650151, + -3221, 95026, -64425, 111132, -14496, 448287, -537, 324270, -125628, -278636, + 54761, 53687, -91268, 17180, 167504, -10201, + }, + { + -27358942, 28654412, 1192390, -10802916, 5615670, 6965900, 4683125, 5717139, -4086125, 360777, + -1572495, 6402186, -2930778, -708133, -868120, 4976257, -5259725, 4402879, -4119948, 3719979, + -1721208, -6956774, 893353, 6270653, -4229469, -2222109, 3322157, 3288334, -2151242, 5048197, + -3913789, 2907156, 5324686, -1096290, -1962800, -1620276, 2214593, -2559264, 476741, 2847027, + 1671816, 826244, -1559610, -1339493, -2218888, -725313, -2285996, 95026, -1732482, -257161, + -75699, -437550, -565862, -1510755, -2062121, 335544, -1058173, -690416, -486405, 37581, + 194347, -1218697, 513249, -56908, 415538, -128312, -291521, -120259, -973347, -213138, + 1004486, -102005, -119185, 344134, 692564, 157303, -270046, 2684, 469225, -222265, + 601295, 641024, 31675, -39192, 775242, -204011, -114890, -105227, 66035, -11274, + -255014, -41876, -279173, -95026, 103079, -11274, + }, + }, + { + { + 1120987, 8665633, -11523934, -8941585, 5273146, 2800856, 2686502, 1625108, 6049999, -2556043, + 3321084, -4388920, -7686381, -7647726, -4554813, -6500433, -14333916, 966368, -7102266, -2036351, + -910533, 714575, 6942278, 621697, -1624571, -2747169, 858993, -2159832, 3174518, 3917547, + -1624571, -8754754, 500901, -4066260, -2859911, 6212670, 3406983, 8442295, 2762201, -2249489, + 748935, 958315, -2920041, 692564, 2852395, 790274, -2463164, -857383, -656056, -125628, + 775242, 2670396, 923418, 463856, 795643, 309238, 537, 1716913, 1161252, -1251446, + 82678, -909459, 187905, -732829, 650151, 1072131, 392453, -190052, -780610, -121333, + 412317, 108985, 245350, 265214, 119722, -827855, -324270, -13959, -113280, -142808, + 20938, -54761, 214748, -33286, 150861, -36507, -104153, -214212, -105764, -300648, + -394063, -26307, 216359, 411780, 13422, 16106, + }, + { + -3559991, -43344272, -9321690, -17828410, 7256884, 135291, 1389422, -313533, -1370095, 4440460, + 3991098, -14030048, 2590939, -1250909, 5376226, -6965900, -800475, -4399657, -8866423, -928787, + -2147484, 1822677, -2238215, -2063732, -1230508, -1781338, 1161789, 2653753, 66572, -1015760, + 594853, 9045201, 1402307, -2488397, -3435437, 4963909, 64961, 1744831, -199179, 1727651, + -1435593, -4440460, -651761, -911070, -1020055, 1177358, -701153, 1467805, -281320, 1784559, + 479426, -25233, -806917, -840203, 2155537, -466004, 639413, 2854006, 1561758, 3758, + -120796, -90194, 264141, -209380, -68719, 144418, -236223, -432718, 535260, 141734, + -697932, -130460, -252866, -11274, 112206, 47782, -666794, 579821, 418222, 96637, + -120796, -226560, -32749, -185220, 107911, 124554, -354335, 335544, -234613, -326954, + -88047, 101469, 8590, -30065, 78920, -9664, + }, + { + -135291, 53624276, 7070590, -48777944, -693637, -1789391, 63351, 612570, 1841467, 2849711, + -5363341, -2856690, -5196374, -679142, 5987185, 6046240, 2546916, -108448, 707059, -3048890, + 412854, -12671764, -7226283, 1079111, 1553168, 4597226, -1556926, 2756832, -2752000, 426276, + 387084, 2940979, -5257040, 3882651, -1428077, -100395, -155156, 790811, -4509716, 669478, + 5906, -29528, 47245, 566399, -1672353, 632434, -453656, -1365263, 692027, 2592013, + -412854, 942745, -355409, 1995012, -780073, -557272, -686658, 512712, -2190433, 50466, + 143345, -557809, 332860, -1219771, -1601486, 504659, -13959, 297427, -376883, 742493, + -43487, -228170, 619012, 791348, 573915, -600759, 27380, -487479, 155156, -370978, + 184684, 77309, 601295, 95026, -86436, 526134, 180926, -113817, 213138, 5906, + 252866, -51003, -20938, 54224, -150324, -55835, + }, + { + 1373853, -33123324, -6332393, 337155, 294205, 780073, -861678, -690953, 2680597, -2743947, + -2075006, 3712999, -6245420, -1226750, -14569603, -4944044, -7692824, 4538707, 7160784, 3526705, + 4653060, -3542274, 1334124, 6847252, -866510, 1326071, 1423782, 1046898, 449361, -274341, + -6023155, -5152350, 5003637, 3368328, -481573, -508417, 3620658, -1136556, 608275, 1493038, + -340376, -1473174, -3320547, 1565516, 408559, 1445257, -51540, 885837, 2064806, 1928977, + -301185, 1804960, -123480, -661962, -756451, 1436667, 22012, 35433, 44560, -168577, + -31139, 27917, -151398, 492311, 713501, 367220, 544387, 321049, 533650, 593779, + -578747, 158377, 127775, 51003, 100395, 6979, 540629, -1074, 237297, 616328, + 282394, 300648, 18254, 413927, 143881, -193810, -53687, 99321, 97174, 219580, + 135291, -247497, 86436, 153008, 36507, -109522, + }, + { + -439160, -113562696, -18185428, 7849053, -4895726, -224949, -1620276, 1548873, -1467268, 4125853, + -1165547, -4881767, 3555159, -3578782, -12793634, -7943542, 3325379, -6990596, 8367133, 11772505, + -5274220, -1598802, 1788317, -8187282, -3476239, 1268089, 4546223, -755914, 3067681, -3796751, + -2554432, -1409823, -1105954, 3087545, 76236, -148713, 5209796, -4143033, -64425, 1216550, + 535797, -406411, 427886, 3273839, 199716, -2483565, -788663, 4295, 13959, 155156, + -2029372, -1884954, -230854, -869194, 183610, -392453, -483721, 263604, -825707, 547071, + -583579, -1040456, 810675, 1348083, 422517, 361314, 161061, 27380, -1667521, -1000191, + 321049, 297963, -899796, 504659, -972810, 567473, -546535, -303332, -37581, 117038, + -545461, -827855, -554051, 327491, -154082, 59056, -578747, 109522, 87510, -268435, + 198642, 137439, -452582, -339302, -1611, 204011, + }, + { + -616865, 16970490, -1472637, -1110786, -672699, 151398, 293132, -260382, 1341640, -2545305, + 6144488, -2072322, -705448, 10017474, 4064113, -2824478, -4993973, -1293859, 3697430, -18333068, + 10330470, 7023882, -514859, -6630356, -2239826, 3108483, -1303523, -2646774, 266825, 1081795, + -1041530, -2531883, 2762738, 1501091, 5535676, 5881421, 2923799, -113280, 1319629, 2656437, + 1321239, -547608, -795106, -607738, 275415, -1159641, -234076, 357556, 937914, -424128, + -1074, 380641, -673773, 428960, 521839, -418759, 115427, -1425929, -746787, 3758, + -208306, 573915, -790811, 117038, -10737, 446677, 597000, -163746, 909996, -1125818, + -902480, 380641, 20938, -353798, -852014, -678605, -205085, -33286, -346819, 34897, + -387621, 27380, 17180, -275415, -63888, -187368, 405338, 199716, -330712, -219043, + -537, -88047, -527207, -62814, 339302, 538482, + }, + { + 20897164, -69663296, -11171747, 40984724, -1803886, 960999, 2746632, -5581310, 3121904, 4671851, + 6661495, 6140730, 4450123, -158914, -1283122, 2234457, -1131187, 1101122, -1919850, -786516, + -5867462, 2119566, 2328946, 2162516, -2243047, 2223183, 749472, 2101850, 3500935, -3151969, + 294205, 333934, -4184372, 1234266, -96637, 1737314, -481573, 3900367, -1623498, -1189169, + 4539781, -1628330, -3343632, 674310, -149250, 1130113, 1286880, -374736, 889595, 602369, + -2268280, 529355, 314069, 1176284, 187368, 445066, 892816, -1431298, -8053, -537, + 636729, 386010, -1367410, -869194, -964757, 285615, -302258, 34360, -745177, -250719, + -143881, -577136, 69793, 107911, -164283, 556198, -710280, 209380, -207769, 687732, + 227633, -312996, -37044, 230854, -544924, -66572, -57982, 139050, 266825, 134755, + 83752, -188442, -115964, 113817, -227633, -42413, + }, + { + -1143535, -4924717, -95563, -155693, -795106, 374199, 170725, 1618129, -2150705, 1273995, + 573378, 6412923, 2906619, 3076270, -6153615, -1764158, -5457830, 6104759, 3552475, 2865280, + 11567958, 163746, -4304094, 4898947, -2494302, 1280974, 3346853, -154082, 8699456, -8022462, + -1606318, -4299263, 1899986, -658741, -309775, -3949223, -1473711, -1607928, 1096827, 3560528, + -3148748, 441845, 3445101, -1549946, -1144072, 3222299, 2571075, 1311039, 2102387, -264677, + 131533, -401579, 323733, 2398739, 2020245, -439160, 1484985, -1566053, -1433982, -403190, + -1054415, 379568, 649077, -604517, 581968, -1123134, 209380, 340376, 228170, -555661, + 901943, 469225, 73014, -192737, 325344, -762894, -332323, 427349, 392453, -211527, + 191663, -185757, 46708, 164819, -32212, -260919, -193274, -212064, -174483, -3758, + 63351, -34897, -140660, -151398, -321586, -119185, + }, + { + -24229522, -110183624, -23643794, 40080636, -4096862, -1216550, -1666447, -4618701, -7311108, 778463, + -10906533, 5441724, 3292629, -4821101, -9859097, 647466, 2591476, 3578245, 2552284, 522912, + -2391760, -3613678, 2677912, 829466, 982474, -2604898, 2671470, -103079, 238908, -1460826, + 957241, -1213328, -2780455, 234076, -151934, -1068373, 5428839, -896038, -3122441, 2602213, + 2266132, 1502702, -1376537, -103616, 137439, -1574642, -459562, 3535295, 2804614, -2653753, + -955093, -1688459, -972273, 735513, -673236, -280247, -205622, 819265, 803696, 940598, + 1103270, 229781, 821949, -289373, -1058710, -222265, -66572, 853088, -137439, 91268, + 397284, -226560, -85899, 325344, -107911, -534187, 537, 147640, 28991, 129923, + 7516, -84826, -341987, 256624, 8053, 293668, -176631, -337692, 262530, 208843, + 26844, 83752, 231391, 11811, 124554, 423591, + }, + { + 1316408, -12787191, -22057342, 2247342, 4482872, -6489696, 7706245, 2621541, 3535832, 1757715, + 2361158, 7729868, -1785096, 8321499, -12693776, 6647536, 5947456, -5409512, -17843978, 3905199, + 7787313, 5654325, 143345, 1376537, -3736085, -4675072, -4710506, -2685965, 785442, 3198677, + 8520678, -1546725, 2698850, 2605435, -215822, -5684926, -422517, -2933463, -67109, -1709934, + 907312, -1322313, 1372779, 2804077, 668404, -26844, 401043, 55298, -648003, 2998961, + 1565516, 1093069, -476741, -2322504, 128849, -594316, 1374390, 938450, 891206, 836982, + -257161, 493921, 28454, 133681, -361851, -175557, -37581, -1428077, -344671, 620086, + -302258, -206158, -180389, -670015, -292058, -281857, -296890, 400506, -63351, 157303, + 319438, -341450, -33823, -282931, 190589, -338766, 56908, 12885, -6442, -173946, + 152471, 202400, -155693, 76236, 171262, -136902, + }, + { + 18603650, -21329882, -46880104, 1937567, 178778, 3422552, 11800960, 441845, 5418101, -814970, + 7174206, -7517267, 766115, 2756832, 10914049, -695785, 4874788, -5517959, 3625489, -362388, + 987843, -1559610, 232465, 602369, 1516660, 57982, 1358820, 3259343, 2588255, 820876, + 428423, -319438, -3475166, 416612, 874563, -1959042, 42413, 1440425, -1527935, -1176284, + -2363306, -1012002, 1858110, 1141388, 1776506, -823560, -215822, -1018981, 1107565, -2179696, + 686658, -95563, -1267552, 700080, 923418, 1036698, -857383, -496606, 748935, 500364, + 107374, -412317, 234613, 292595, -1260036, -210453, -457951, -304943, 703301, 317828, + 442382, 189515, 307090, 52076, 511638, -207232, 344134, 162135, 669478, 278099, + 142808, -238371, -202400, 2684, 246424, 144418, 348966, 435939, -249108, 336618, + -263067, -113280, 23622, -53150, -61740, 3758, + }, + { + 666794, -39666708, -9201967, 14305999, 3277597, 6941741, -4547834, -1307818, -1653562, 2838437, + 882616, 3735548, -2652142, 5886253, -5986648, 9349070, 470836, 3754875, 4168803, -4066797, + 6673843, -7410429, 3940096, -1264868, 2214593, 2897492, -6528887, 773094, -4516695, -4085051, + -1814624, 1040993, -875100, 424665, -1045288, -6012954, 5091147, -2673617, 3569655, -694174, + -1282585, -2546379, -192200, 206158, -135828, -208306, -846109, 152471, 1578937, -1821066, + 1178969, -1581085, -638340, -460635, -289910, -1533840, -459562, 440234, 657667, 1116155, + -360240, 202937, -258772, -502511, -80531, 567473, -149250, -538482, 102542, -692564, + 492848, 1396401, 152471, 290984, 140660, 711354, 27917, -283468, 35970, -214748, + 45097, -306016, 252866, -165893, -122407, 275952, -215822, -128312, -310311, 55835, + 71941, 440234, 92342, 131533, -302258, 116501, + }, + { + -4918275, 168472784, -39914740, -404801, 11804181, -12491376, 686121, -6473590, -9031779, -2654827, + -7154342, 1549410, -994822, -4190814, -3620121, 7564511, -2752000, -110595, -6150393, -1769527, + 2272038, 5346698, 949188, -2358474, -4981089, 1656784, -1872069, -343061, 6579353, 168041, + -293668, 2625836, 4594542, -340376, -4221416, -474057, 2217814, 2483028, 555125, 2089502, + -932545, 1100049, 77309, 1377611, -2864743, 544387, 942208, 821413, 554051, 190589, + -475131, -1979443, -1333587, -1896228, -2479270, 1949378, 34897, 1162862, -404264, -18254, + -589484, -1236414, -617938, -521839, 122407, 960999, 623307, 273267, -275952, 878321, + 647466, -161061, 785979, -835371, 567473, -341987, 542240, -605590, 451508, -395674, + -124554, 347355, 118648, -435939, -93952, 230318, 462246, -177167, 155693, -540092, + 133144, 30065, -164819, 202937, 364535, 120796, + }, + { + 3112241, -26804354, 708670, 4405026, -3481608, -4100620, 1281511, -1474248, -752693, -3802120, + 1792612, 3029563, -2211371, -16374026, -16719234, 3096135, 5332739, 2943126, 8511551, 773631, + 5981279, 1445257, -4351339, 2582349, -4480188, -6354941, 1117765, -11485816, -164819, -487479, + 685047, 882616, -4510790, 3043521, -1648731, -1561758, 1309965, -2688650, 2010045, -123480, + 5215164, 98247, 1880122, 834297, 2225867, 1462436, -1553168, -161061, 820339, -32212, + -1465658, 1045288, 79457, -891743, 1233729, 758062, -224412, -113817, -24159, 894964, + 913754, 12885, -508954, -374736, 424665, 717796, -450435, -505732, -199179, -56908, + 290984, 777389, -572841, 623844, 840740, 103079, -535797, -977105, -740345, 353261, + -413927, -35970, 251792, -134755, -329102, 204548, -265751, 65498, 57982, -278636, + 3221, 1074, -140660, 24159, 133681, -78383, + }, + { + 14681272, 77221904, -7211250, -9825275, 5228586, 4090956, -1024887, 1485522, -3279745, -1308891, + -3479997, 6196027, -653909, -10241886, -22996328, 3135326, 3635690, 2307471, -10612327, -2611340, + -4754529, -5090610, -1493575, 1330903, -3326989, 4302484, 1952063, -1754494, -7526930, 3923990, + -4497368, -2771328, 406948, -1040993, -2196339, -2544768, 2907693, -3330210, 579821, 2461553, + -78920, 1233729, -1131187, -1226213, -3063922, -2172717, -3444564, 720481, -1100049, 1075889, + 1785096, -686658, -893353, -1582159, -783832, 1313186, 565325, -103079, -287763, 541166, + 867583, -828929, 724776, -680752, -726923, 311922, 402653, 150861, -135828, -418222, + 645319, -585189, -1046898, -101469, 514859, 8590, -303869, -135291, 682363, -167504, + -322123, -398358, -99858, -268435, 339839, -501437, -630823, -427886, 153008, 224949, + -5906, 127238, -31675, -10201, 37581, 8590, + }, + }, + { + { + 525060, -25992606, 15164993, -184147, 403190, 497679, 4446902, 2621541, 4685810, -392990, + 2867428, -7828652, -7895224, -2151242, -5872294, -7700340, -8789114, -7613367, -1892470, -2870112, + 6830072, -745714, 4258997, 2541547, -10635950, 2797098, -1771674, -3200288, 2238215, 4878546, + -4570382, -4312684, -1058710, -5824513, 1410360, 5251135, 1905355, 8746164, 2643016, 478352, + 1145683, -737661, 401043, -1246077, 935229, 963683, -2111513, -2490544, 1059246, 1403381, + 1566053, 957778, 507880, 1265405, -482647, 1258425, 224412, 595927, 1385664, -196495, + -485331, -1547799, -157303, 794569, 141734, 499290, 59593, 164283, -461709, -259309, + 468151, 218506, 314069, 551903, -830539, -385473, -532039, 271120, -308701, -163209, + -150324, 338766, -185220, 31139, -314069, 46708, -63351, -379031, 246424, -134218, + -395674, -127238, 219580, 475668, 190589, 121870, + }, + { + 9494562, -103414760, 27251030, -1721208, -3601330, 1901060, -1377074, -97174, 731755, 3515968, + -2192044, -3660386, -2369211, 594853, -2661806, -4580583, -1435056, -3620121, -5542119, -5381057, + 1275068, -3752191, 2203855, -577673, -2975876, -1010391, -871342, 6014565, -737124, -1726040, + 1511829, 6983617, 4596152, -6276558, 2368675, 609885, 2177012, 443992, 1071058, 2552821, + 11811, -6288369, -1861868, 489089, -290984, -591095, 1662152, 1518808, -10201, -11811, + 1981054, 328565, -1235340, -1468879, 1648194, -260382, 1802813, 609885, 1426466, 681826, + -1068373, 680215, 288300, -527207, 277562, -190589, 73551, -595390, -358093, -30602, + -104153, 359167, -253940, -939524, 453119, 355409, -637803, 628139, 39192, 428423, + 27380, -373662, -117038, -67646, -39728, 11811, 66035, 239981, -164819, -315680, + -145492, 129923, -5906, 19864, 120259, -47782, + }, + { + -2283849, 89398136, -7417409, -30775588, -18985902, -1216550, 939524, -875100, 1708860, -2383707, + 2873333, -7059316, 484794, 2597918, -732292, 4529043, 4117263, 3077881, 1161252, -1102196, + 1479079, -7248831, -7518877, 3286724, 1330366, -1720134, -1223529, 517544, 474057, -1546725, + 3779571, -1801202, -1255204, -1908576, 1292785, -2886755, 4082903, -1333051, -2797098, -1707250, + -772557, 1022739, 321049, 47245, -2092723, 1556926, -858993, 24159, 865436, 916439, + -560493, 497679, 1347546, 1157494, -319975, -1202054, -151934, -899796, -744640, 453119, + -512175, -140123, -759672, -1030792, -1462436, 110595, -200790, -147103, 100395, 277025, + 163746, -23622, 519691, 843961, -175557, -105227, -177167, -505196, -114890, 216896, + -89121, 183073, 523449, 273804, 112743, 275952, 223875, 44023, 139586, -137976, + 241592, -139586, -68719, -40802, 280784, -128849, + }, + { + -519154, -39882528, 3120831, -2771328, 1270774, 351650, -795643, 10201, 1089848, -1105417, + -2056216, 5456756, -4704063, -9461813, -14070850, -4504347, -1595044, 6204617, 2378338, 6132677, + 372052, -3196530, 8259222, 796180, 1881196, -2204392, 4384088, 426276, 2163590, -3220152, + -5573257, -558883, 1505386, 2975876, 642098, -3886409, 6265821, -1640678, 3091303, -809064, + 769336, -1605244, -1580011, -213675, 942208, 696858, 2215666, -1500017, 2628520, 471373, + -107911, 1413044, 872952, -1111323, -300648, 1573569, -117038, 177704, -547071, -213138, + 185757, 811749, -936303, 649614, 558883, 576599, 124017, 141734, 969052, 14496, + -77846, 285078, 58519, 346819, 18790, 381178, 85899, 304943, 461709, 348966, + 401579, 212601, -153545, 583042, 154082, -151934, -137439, 43487, 5906, 212601, + 67646, -63351, -28991, 59593, -26307, -131533, + }, + { + -15248745, -149736512, 19799262, 1854889, 3755412, -2884608, -35433, 2715493, -219580, 6529961, + -1705102, -1786170, 428960, 1273995, -18023830, -3100430, -4249334, -2552284, 9659918, 7628936, + -494458, -3354370, 3716757, -8365523, -4959077, -1770600, 7159174, -3347390, 5630166, -3863323, + -3054259, -1821603, 3673808, 1498407, -1810866, 853088, -1469953, 3322694, 425202, -900333, + 858993, 1183264, 208843, 1698660, 716186, -644782, -2084133, 1266479, -1174137, 1927904, + -2091649, -2727304, -913754, -1477469, 1050656, 518080, -229781, 363462, -411780, -567473, + 250719, -770410, 1044214, 1013612, 51003, 144418, 543313, 411243, -1468879, -1126892, + 599685, -597537, 625455, -32749, -572304, -390842, -199179, -269509, -456877, 339302, + -510027, -1037235, -489626, 48855, 126165, -137976, -404801, 154619, -161061, 10201, + 539555, -198105, -367757, -268972, 81604, 32212, + }, + { + 316217, 3077344, 7365869, -2625299, 635655, 573378, -63888, 356482, 1192390, -154619, + 2870112, -2309082, -2836289, 7640210, 6587943, 2416993, 140660, -3352759, 1635309, -11898670, + 4436165, 5304285, 2558190, -13775571, -3893925, 11630771, -3234110, -1999844, 2134599, -792958, + -4540318, 3833258, 1379221, 3062312, 5413270, 3412889, 1359357, -2796561, 2779381, 4483946, + -704912, -1057099, -87510, -430034, 1148367, -35433, -805306, -337155, 1399623, 336618, + -834834, 645856, -1700270, 954557, 484258, -1741072, 648540, -281857, -1158031, -934692, + 1420560, 209917, -705985, -392453, 948114, -85362, 625992, 118648, 342524, -738198, + -497679, -108448, 308164, -740345, -680752, -790811, 200253, -379031, -241055, 278636, + -491774, -341987, 415538, -370441, -54761, 66572, 245887, 214212, -140123, -485331, + 263604, 31139, -651761, -176631, 409633, 294205, + }, + { + -39411156, -28177132, 20963736, 30373472, 2283312, 3472481, -1940252, -302795, -5105106, 7910793, + 8443906, 8431021, 2628520, -4180614, 4387846, -302795, -1981054, -590021, 104690, -3015067, + -821413, 1515587, -243739, -2099165, 7023882, 2196876, 1803349, 3310346, -1870995, 2238215, + -1242856, -2609193, -1568200, -240518, 796716, -858993, 4189741, -2661806, 1739999, 822486, + 1570884, 447213, -4830228, 139586, 2506650, -351114, 111669, 1151051, 605590, 126702, + -567473, 79457, 1843615, 801548, 72478, 60666, -124554, -167504, -782758, -159451, + -134218, -689342, -261456, -233002, -921807, -83752, -232465, -652298, -327491, -319975, + -519154, -524523, 644245, -664646, 387084, 359167, -324807, -113817, 357019, -102542, + 254477, 77846, 30602, -309238, -323196, 39728, -5369, 110059, 394600, -128312, + 161598, -252866, -54224, -205622, -19327, -268972, + }, + { + 124554, -14337138, 1078037, 3406446, -390842, -966368, 243739, 500901, 1052804, -637266, + 2674154, 8018167, 436476, 4035122, -10681584, 5869610, -1527398, 3433826, 1127966, 11957189, + 3608846, -453119, -3409667, 4443681, -373662, -1364189, -1866700, 9890773, 4306779, -5551782, + 877247, -2416993, -1409286, -1131187, -3738232, 3258807, -2275796, -1184874, 2510945, 767725, + -1278290, -973347, 2909840, 245350, -637266, 2109366, 1118839, 1731409, 2901251, 620623, + 307627, -1304596, 848256, 1543504, 896038, 971200, 1166621, -1960116, -1185411, -78383, + -740882, -1186485, -418222, 809601, 12348, -101469, -292058, 142808, 55835, -630286, + 1190780, 322123, 449898, -495532, 363462, -775242, -497679, 193274, 621160, -45097, + 4295, 37044, 75699, 499827, -424128, -86973, -535797, -55298, 46708, -235686, + -245887, -44023, -158914, -47245, -93416, -179852, + }, + { + 13874355, -213935536, 14082661, 22922778, 7787313, -179315, -7261179, -2696166, -5468030, -756451, + -9328669, 5922223, 865436, -690416, -3626563, -5771899, 5954436, -284005, 288837, 868657, + -1685238, -1720134, 1121523, 2711735, -938987, -1511292, 1273995, -157303, -4295, 44560, + 2845953, -3148748, -1641214, -2746095, 791348, 3007551, 1842541, -680215, -3595425, 2388002, + 3587908, 1813013, -2801393, 836445, -621160, -3177739, 371515, 2343979, 779000, -271120, + -2828236, -1116692, 461709, 257698, -607201, -2250563, 1162862, 1285269, 82678, 1059246, + 820876, 1026497, -496069, -258235, -205622, -163209, 18790, 226560, -250719, 155693, + 584652, -456877, -484794, 409096, -425739, -331249, 426276, 2684, -382789, 322123, + 347355, -71404, -309775, 62814, 498753, 345745, -127238, -349503, 20401, 188979, + -98784, 175557, 317291, 390305, -11274, 5369, + }, + { + -795643, -35422744, 6140193, -7712688, 8740795, -1025960, -3184718, 2994666, 1668058, 3363496, + 7567196, 7325067, -923955, 2796561, -3995393, -1877438, 9011915, -7926899, -14622753, -1065152, + 7372848, 16620987, -3642132, 2537789, -4697084, -11039677, -1798518, 2109366, -3288334, 6278706, + 4268124, -399432, 1150514, 2515240, -2241973, -5152350, -2214056, -383326, 1171452, -1869385, + 1279363, -2101850, -1013612, 4143570, 2273112, 632971, -3041911, 132607, 1779727, 2625836, + 209917, 1654636, -1620276, -571768, -646393, -290984, 1206886, 1604707, 1440425, -365072, + 729071, 297427, -366683, -308164, -144418, 279710, -704375, -735513, -484794, 0, + -40802, 63351, -514322, -388695, -659278, -492848, -419833, 708133, -58519, 167504, + 408559, -308164, -272730, -229244, -207232, -463856, 188979, 41339, 220654, 158377, + -293668, -61740, -41876, 192200, 144955, -220117, + }, + { + -18945100, -47771312, 12080669, 8652748, 3250753, -7913477, 11435887, 4187593, 1334124, 8104067, + 1004486, -1299228, -2749853, -1843615, 12070469, 3375308, 1525250, -2675765, -972273, -1696512, + 735513, 386547, 1053341, -1236951, 2910914, -3266860, 2328409, 1640141, 4564477, 1423782, + -1925219, 458488, -1507534, -913754, 34360, 362388, 1032940, -328028, -531502, -2360622, + -2303176, -1051193, 2871186, 1210644, -739808, 1876901, 193274, -659278, -1378148, -489089, + -214748, 793495, -262530, -192200, 738734, -547608, 1733556, -789737, 855772, -181999, + -1111860, 971200, 303332, 664109, -1551557, -852551, 105227, -227633, 274878, 672699, + 322123, -68183, 371515, 175020, 190052, 128849, -281320, 694711, 539555, 212064, + 80531, -39192, -185220, -116501, 73551, 262530, 236223, 206158, 44560, -105764, + 2147, -84826, 537, -42950, -156229, -199716, + }, + { + -86973, -32603096, -7635915, 9131100, 8239358, -1336809, -762894, -3536369, 1603097, -1984812, + 3335042, 8138426, 3170223, -8920647, -513249, 8930311, 4441533, 591632, -296890, -133144, + 2349347, -3940096, 5072357, -4143033, 5156108, -5945846, -858993, 757525, -2917357, 275952, + -5432597, 2576444, -1111860, 692564, -3155190, -2106145, 335007, 121333, 4072703, -1893544, + -4849018, 823023, -474057, -1689533, -525060, 1780801, -453656, 1202054, -1140851, -660888, + -95026, -510564, -381178, -1473711, 1350767, -2389613, -637266, -18790, 2163590, 494995, + -222801, 179852, -638876, -628676, 766115, -76773, 286152, -389231, -360777, -46171, + 289373, 1844689, -412854, 580357, 81604, 380641, -537, -5906, 265751, -258772, + 29528, -643708, 648003, -201327, 3221, 416612, -453656, -165356, -216896, 66572, + 129923, 162135, 57982, 34360, -32212, -88584, + }, + { + 26305064, 111772768, -16186121, -5039071, 5713380, 118648, -13638669, -1661616, -8938364, -3037616, + 2042794, -4610648, -28991, -1395864, -2983392, 2435247, -3119220, 4763119, -4648229, -1980517, + -675921, 7780870, 1035087, -4532264, -7416335, -253403, 1368484, 1195075, 2572686, 970663, + 2971581, -1315871, 4608500, 2024540, -6853157, 3071439, 1207423, -3748970, 4198868, 61740, + 528281, 1619740, 3896072, -2579665, -1126892, -263067, 1127429, 1139240, 875100, -126165, + -2142652, -996432, -2639794, -2432562, -258235, -316754, 151934, 1521492, -169114, 373662, + -814433, -766115, -870805, 47782, -374199, 709743, 608275, -83215, 74088, 982474, + 543313, -402653, 1364189, -530428, -116501, 338766, 207232, -696322, 399432, -289910, + -76773, 254477, 2684, -372588, -134218, 290984, 437013, 30602, 197032, -91268, + -344134, 98784, 104690, 89657, 170188, 230854, + }, + { + -2341831, -21883396, 4880694, 916976, -2649458, -708670, -354335, -651761, -6228240, 2312303, + 258235, -122943, 2730526, -25269440, -4351876, 9526237, 1233729, 2843268, 11525545, -6649683, + 7754564, 2310156, -5663452, -2624762, -3766686, -2320893, -4641249, -6754373, -1016297, -4483409, + 5448703, -1883880, -3307125, 2202245, -3692598, 286152, 1971927, -2764885, 2670933, 1164473, + 2270964, -37581, 1437203, 2449742, 766115, 32749, 159988, 493921, 1360968, -824634, + -938450, 362925, -678068, 804233, 922881, 260919, -713501, 771484, -322123, 677531, + 1521492, -657130, 38118, -122943, -294205, 695248, -374199, -787053, 129923, 347355, + -59593, 389231, -124017, 723165, 524523, -307627, -382789, -1088774, -240518, -53687, + -356482, -282394, 532576, -244813, -52076, 190052, -255014, -47245, 81068, -114890, + -221728, 16643, 11274, 17180, -63351, 86436, + }, + { + 2677912, 85435488, -1120987, -4849555, 2034741, 1449015, 1080721, 1772211, -4367445, 4384625, + -2886218, -4662724, 7262253, -8436926, -24400246, -859530, 12377559, -110595, -6871948, -9057012, + -3331284, -842350, -2495913, -1284732, -2555506, 8017630, -309775, -5404680, -3937948, 1155883, + 999117, -4740034, -3941169, -1176284, -2358474, 479963, -359167, -711354, 1571421, -153008, + 803159, 2218351, -2349347, -2024003, -2680597, -1760400, -1038845, -670015, -964220, 865973, + 719407, 1308354, -177704, -2285996, 701690, 27917, 312459, 854699, 402653, -37044, + 387621, -620086, -172336, 252329, -841814, 816581, 170725, 198642, 330176, -357556, + 274341, -548682, -597000, -491774, 169651, -199716, -41876, -19864, 303869, 304943, + -366683, -843424, 170725, -286689, -322659, -372052, -701690, -344671, 122407, 372588, + 134218, 35433, 128849, -236760, -70330, -141197, + }, + }, + { + { + -1444183, -61152820, -4096325, 5303748, 299574, -909996, 3486977, -993748, -290984, 2561948, + 4019553, -3469260, -2574833, -4629438, -2587718, 7293392, 1459215, -2292976, 12981002, 5454072, + 1364726, 111132, 2506650, 4561256, -5450851, -4541928, -8320963, -3967476, -2559264, -7099044, + -6070937, 3979287, 4043712, -1022739, 412317, 570157, -731755, 4471598, 1017370, 608812, + 653372, -1898376, -728534, -1911797, -97174, 392453, -585189, -993211, 3196530, 1649804, + 879395, 455803, 152471, 619549, -734439, 544387, -832687, -1052267, 794032, -301185, + -1204202, -629750, 551366, 188979, 153545, 67109, -768799, 219580, 171799, 56371, + 287226, -86436, -210453, 183073, -688269, 576063, 91268, 907312, -23085, 178241, + -56908, -76773, -285615, 225486, -293668, -20938, 6442, -449361, 231928, 239981, + 253403, 146566, 31139, 80531, -26307, 175020, + }, + { + -13082470, -180136304, 5481989, 12925704, 3625489, -406948, -2146947, -309775, -4131759, -4857071, + -9632001, -3658239, 1422171, -1490354, -10346039, -5722507, -4378719, -889058, 2837900, -1837172, + 1464047, -4064650, 4176856, 1039382, -3731790, -990527, 1567663, 5818607, -473520, 1366873, + 650688, -186831, 2186675, -806917, 2930242, -1536525, 3480534, 1312649, 1958505, 3495030, + -279173, -3180423, -143881, -340913, -99858, -1825361, 942745, 459562, -107911, -78383, + 2417530, 1999307, 848256, -2226404, -244276, -246424, 1347546, -1445257, -316217, 624918, + -1248762, 25233, -96637, -657130, -181462, -966368, 407485, -348429, -522912, -145492, + 256624, 579284, 194884, -541166, 59593, 621697, -258772, 79994, -185220, 542777, + -134755, -284542, -44560, -56371, 191663, -90194, -13422, -31139, -110059, 103616, + 66572, 265751, 133144, -61740, 14496, -85899, + }, + { + 4992900, 132666704, 24612846, 2901251, 5644661, 2042257, 2002529, -1284195, -2849711, -5880347, + 2304250, -6046777, -2195802, 984621, 627065, 2921652, 5358509, 2637110, 2113661, 3648038, + 4272956, -60130, 3806415, 8055748, -3364570, -2359011, -1772211, -3218004, -1457068, -3523484, + 737661, -1102733, 485331, -4537633, 558346, -2235531, 3246459, -824634, 89657, -3115999, + -1889249, 1082332, 883153, 1704028, -751082, 1505923, -377957, 1346472, 663572, 486405, + -845572, 602369, 1678795, -622770, -1570347, -242666, 1384590, -748935, 476205, 2006287, + -144418, -124554, -563714, 641561, 268435, -220654, -801011, -545461, 307627, 29528, + -126702, 378494, 456877, 147640, -836982, -34360, 61740, -15569, -13422, 153008, + -143881, 106837, 328028, -55298, 25233, 70867, 38655, -115427, -98247, -192737, + 177704, -255551, -99858, -38118, 381715, -100395, + }, + { + -471910, -38225744, 4778151, -3633006, 222801, 231928, -126702, 64961, -248571, -1741072, + -1701881, 7125888, -2371896, 2988760, -3833795, -7668127, -2568391, -1947768, -7421167, 1557999, + -5506148, -9083319, 6189048, -2301029, 3701725, 110595, 4055523, -27917, 947577, -5427228, + -335007, 3617436, -925565, 3313031, 358630, -4945655, 3111167, -1970853, 2865280, -2141578, + 1736777, -329639, -558346, 106837, 1431835, 1435593, 2471754, -2771865, 38118, -1680406, + -1091995, 456340, 759136, -716186, -526670, 1184337, -243203, 540629, -227096, -659814, + -871878, 55835, -1293322, -25233, -142271, -66035, -463856, 252866, 571231, -404801, + 177167, 51003, -145492, 461709, 22012, 250719, -56908, 249108, 134218, -49929, + 271120, -30602, -838056, 262530, 209380, -105764, -231391, -130997, -193274, 41876, + 119722, 16106, -28454, 12885, 14496, -150861, + }, + { + 31093952, -134768016, -11723650, 2530273, 883153, -1386201, -273267, 2661269, -1644436, 2985539, + 5845451, 8718784, 1623498, 3256122, -12329240, -199716, -4382478, -7036230, 676457, 2299955, + -257698, -2273648, 4668630, -4234301, 142808, -951872, 612033, -8230768, -283468, -4119948, + 530965, -2063732, 1322313, -1880659, -4670777, 308164, -8489003, 715649, 3379603, -2892124, + -2304787, 2507187, 373125, 395674, 4006668, 3163244, 955630, 4409858, 124554, 928250, + -291521, -115427, -39728, -12348, 1435593, 670015, 513249, 1179505, 384400, -291521, + -17717, -551903, 1034013, 501437, -491237, 729608, 753767, 952409, 80531, -25233, + 813896, -415538, 647466, -442382, -432181, -557809, -359167, -455803, -419833, 136365, + -486942, -102542, 113817, -214748, -94489, -43487, -156766, 92342, 25233, 86436, + 383863, 73014, -169114, -104153, 181999, -7516, + }, + { + 557809, -9088688, -1051193, 734439, 840740, 391379, -78383, 1049583, 1883880, -2678449, + -614180, -3180960, -5833640, 3648575, 4545686, 325344, 1093069, 3096135, 6231461, -14220637, + -1398549, 2021319, -1826972, -15402826, -4922033, 11440182, -1547799, -1097364, -1196685, -3976603, + -2400350, 5727339, 1693828, -679679, -177704, 940598, 1338956, -3555696, -420370, 1709397, + 329639, -565325, -220654, -214748, 1813013, 555661, -627602, 296353, 1775969, 835371, + -1894081, -435402, -2265595, 47782, 13422, -820339, 862215, 416075, 418759, 91805, + 1410360, 365609, 86436, -320512, 765041, -683974, 261456, -119722, -347355, -710817, + 483721, -1611, 49392, -237297, 249108, 418759, 712965, -122407, -292595, 458488, + 90194, -333397, 406411, -105764, 333934, -17180, -96637, 173409, 322123, -537, + 166430, 86436, -249645, -171262, 75162, -78920, + }, + { + 47308528, 45417132, -13591961, 14976014, -7237557, 167504, -1399086, 557809, -6407018, 3394098, + 1222992, -3703873, -6185827, -4571456, 8207683, -844498, -656593, 1722819, 1236414, -540629, + -855772, 242129, -1986959, -3179350, 8525510, 1917703, 134218, 547608, -2937221, 3233037, + -20938, -1308891, 1376537, 2118493, 1769527, -1804423, 1612760, -6487548, -676994, 600222, + 2254858, 1991791, -4627828, -589484, 1532767, 848793, 295816, -152471, 377420, 1169305, + -47782, -1811939, 1799591, -357019, -913754, -614180, -709743, 114354, -681289, -482110, + -95026, -152471, -229244, 105227, -419296, 125628, 662499, -672162, 19864, -105764, + -603980, -168577, 718870, -849867, 361851, 610959, -13959, -402116, 257161, -527744, + -357019, 153008, 363462, 177167, 353261, 195958, -37581, -56908, -78383, -372588, + 233002, -188979, -40265, -342524, -87510, -147640, + }, + { + 1226213, -3809636, 1766842, 600222, 316217, 53150, 78920, 206695, 2793339, -539555, + 16643, 2475512, -1643899, 6282464, -12671227, 3061775, -976031, -1457605, -1468342, 12664785, + -4995584, -7823283, -3751654, 7516, 2979097, -1925756, -5958731, 6156299, -883690, -730681, + 5418101, 3833795, 774168, -1380295, -669478, 5782100, -1308354, -883153, 2006824, 52076, + -926639, -1896228, 273267, 1188095, -73551, -658741, -838592, -1239635, 1137093, 1511829, + -101469, -1213865, 723702, -276489, -153545, -617938, -344134, -2367064, -1068910, 730681, + 57445, 267899, 64425, 809064, 109522, 37044, -665183, -432181, -68719, -1511292, + 572304, 135828, -111132, -199179, 535797, -304406, -1074, 384936, 845035, 717796, + 470836, -38655, 64961, 446677, -294742, 19327, -452582, 235686, 338229, -76236, + -112743, -60666, 30065, 368293, 283468, 18790, + }, + { + 4035659, -252788896, -450972, 10101226, -2935610, -3568044, -6620692, -721018, -2690797, 2977486, + -7873212, 208306, -4240744, 2189360, 4893579, -1098975, 397821, -1093606, 1764695, 2751464, + 4098473, 1515587, -149787, 1323387, -894427, -498753, 222265, 58519, 866510, -419833, + 2329483, -4017405, -255551, -2078764, 1737851, -1594507, -2212445, 2315524, -727460, 1364189, + 3817689, 448287, -1623498, 2393371, 78920, -3333432, -384936, 415001, -902480, 73551, + -1146219, -9127, 252329, 94489, -154082, -1221918, 967978, -775778, -1850057, 292058, + 134755, 975494, -428423, 229781, 529355, -355945, -616865, -212064, -454193, -317828, + 474057, 151398, -587337, 162672, 45097, -191126, 220654, -14496, -284542, 269509, + 510564, 62277, -215822, -64961, 503048, 455267, -121870, 166430, 35970, 45097, + -13422, 232465, 95026, 241055, -177167, -143881, + }, + { + 63351, -44396004, 8288750, -5747740, 3521873, -681289, -3288334, 1918777, -1203128, -1051730, + 4190814, 4796405, -1710471, 4010963, -2137283, -9430674, 1311039, -3676492, -1311039, 2348273, + -1767916, 10403485, -3971771, 2502355, 2939368, -4846334, -161598, -1115081, -8562554, 4385162, + 494458, -3762391, -2103460, -1556389, -3628174, 47782, 2866891, 881005, 2390686, -743566, + 1982664, -1205812, -1291711, 2348810, 1087164, -2147, -3601330, -549756, 440771, -37581, + -1610076, 1376537, -775242, 1523640, -129386, -366683, 557272, 466541, 245887, -2134062, + 135291, 745714, -321586, -105227, -270583, 113817, -459562, 501974, 1611, -595927, + -143881, 67109, -804770, -507880, -1174137, -237834, -356482, 307090, -542777, -501974, + 382252, 9664, -12348, -97174, -297427, -253940, 77846, -32212, 147103, -24696, + -413927, 19327, 124554, 40265, -96637, -54761, + }, + { + 19487878, -47419124, -24921548, 486942, 10452340, -3735548, -243739, 2525978, -4072703, 4541391, + -4453344, -2561948, -1112397, -1481227, 3823058, -2175938, 301721, -2238752, -3444564, -5385889, + 91268, 2498597, 619012, -3461744, 2282238, -5222144, 2142115, -1716913, 940598, -52613, + -1330366, 399432, -1098975, -600222, 1098975, 2898029, 938987, -992137, -23622, -1313186, + -533650, 179315, 2431488, 82678, -1186485, 3286724, 1408749, -1049583, -2745558, 140123, + 449361, 976568, 447213, -813359, -793495, -2419140, 729071, -77846, 69793, -1104880, + -634045, 1427003, 54761, 463856, -229781, -513785, -2684, -251256, 107911, 599148, + 70330, -304406, 36507, -347355, -188442, 323196, -159988, 235149, -67109, -13422, + 181999, 201863, 37581, 40265, -89121, -76236, -415538, -88047, 68183, -182536, + -60666, -92879, -64961, 24696, -24696, -233539, + }, + { + -670552, -17137456, 5895917, 3495567, 4753455, -2431488, 2046015, -3715147, -175020, -2674691, + 1278290, 4217658, -9450539, -27775016, -3326452, 5231807, 1647120, 1425392, 583579, 1331977, + 1419487, -3432216, 5922223, -3787624, -1129040, -4310537, 4861366, 4729296, 2914135, 3306588, + -6122476, 3879966, -113280, 1566589, -3170760, -1537061, -4485557, -2955474, 1708860, -1576790, + -3186866, 1939178, -895501, -2325725, 52076, 1748589, -1379221, 1357747, -2073932, -1377611, + 222801, -156766, 157840, -357556, 851477, -2966212, 456877, -579821, 676994, -416612, + -368830, 244813, 44023, -62814, 634581, -183610, -294205, -483184, -368830, 643708, + -219580, 790274, -104690, 671089, -52076, 324270, -132070, -157303, 336618, -26307, + 432181, -310848, 585189, -92879, -176094, 107374, -309238, 15569, -240518, -49929, + -61740, -144955, -108448, -27917, 71941, 46171, + }, + { + -32661616, 37917580, 3176665, 1256278, 12453795, 10897943, -14489072, -3794067, -4913980, 1679332, + 11073499, 3430068, 697932, 3124052, 7146289, 805843, 362925, 6874632, -1566053, 787590, + -4182225, 510027, -2951180, -1850057, -5167383, -1786706, 911607, 1778653, 3506841, -1420024, + -359167, -2425046, 3376381, 2698850, -2783139, 4470524, -4000225, -6051072, 3333432, -1410897, + 386547, 649077, 3504693, -5209259, -3685619, -1870458, 345208, -90731, -691490, -244276, + -1262720, 295279, -1937030, -1851668, 770410, 344671, 1229434, 1487669, 257161, 1961190, + -265214, -538482, -52613, 511101, -841814, 148713, -297427, -819802, -451508, -283468, + 205622, 121333, 1845225, 56371, 53687, 520228, 491774, -411243, -181462, 193274, + 259846, 28454, -347355, 26307, 221728, -104690, 75699, 8053, 23622, 184684, + -110059, 65498, 156229, 58519, -26844, -47782, + }, + { + 1539209, -17925582, 827318, 170188, 1387811, 1210107, 829466, 2164664, -2971044, 4621385, + 3180960, 2637110, 3109020, 17157320, 56652768, 10924786, -5942624, -1031866, 7701413, -8540006, + 2940442, 1563368, -3927748, -4816269, 528281, 4019016, -1037235, -2324651, -1152662, -5452998, + 5526013, 2451890, -1195612, 1430224, -5007395, -868120, 1949915, -3977677, 3199751, 2499134, + -853088, -929324, 1626182, 850940, -1530082, -1057636, 955630, -240518, 441845, -139050, + -514859, 660351, 209917, 149250, 199179, -818728, -566936, 1123671, -1134408, -47245, + 475668, -1043677, 819802, 557809, -865973, -309238, -298500, -721018, 187905, 314606, + -734439, 243739, 60130, 32749, -132607, 33823, 105764, -164283, 357019, -121333, + -16643, -314069, 310848, -69793, -40802, 132070, -134755, 105227, 8053, 24159, + -125091, 67109, -1074, 76236, 2684, -169651, + }, + { + -16694001, 58594092, 7710540, -312996, 27380, 1249299, 2916820, 7565048, -1469953, 6065031, + 1249836, 993748, 9388799, 12528956, 6313602, 4428648, 11605539, -5492190, -2223183, -402116, + 2663954, 2925410, 95026, -803696, -1850594, 6663105, 1250909, -5760088, -3360812, -236223, + 688269, -971200, -448824, 2890513, -128849, 406411, -3796751, -1762010, 516470, -191126, + 1910724, 2603287, -2094870, -3062849, -620086, 178778, 1455994, 810675, -439160, 193810, + -171799, 2051384, 1485522, -520765, 2194728, -676457, -1316944, 977105, -134755, -1159104, + -729071, -1566589, -317828, 818191, -605054, 381715, -161598, 177167, 677531, -479963, + -303332, -365609, -86973, -273804, 127238, 66572, 421444, 28991, 193274, 102005, + -76773, -418222, 305480, -376347, -606664, -6979, -72478, -56908, -219043, 194884, + 147640, -20938, 185757, -7516, 71404, -361851, + }, + }, + { + { + 683437, -64956548, -354335, 5129265, -2940442, 75699, 1962263, 936840, -2845953, 3157338, + -253403, 228707, 409633, -373125, -7449621, 12062416, -500364, 639413, 1854889, 11382200, + -966905, 773631, 980863, 853625, 7478075, -9598178, -7951058, -2792803, -2337536, -13283797, + 1673427, 1931125, -296353, 3087545, 876710, -1119376, -1473711, 965831, 4588636, -1656247, + 985158, -824097, -3310883, 715112, 84289, -1519345, 294742, 155156, 2104534, 906238, + 745714, 22549, 500364, -334471, 904628, -653909, -412317, -1321776, 267362, -1136019, + -108985, -88584, 632434, 213675, -576063, 635655, -593779, -158914, 482110, 312996, + -124554, -41876, -43487, -159451, -141197, 400506, 248571, 783295, 47782, -19327, + 324807, -252866, 191126, -183073, 17180, 31139, 156229, -334471, -127238, 200253, + 329102, 117575, 62814, -11811, -117575, 224949, + }, + { + 11942693, -202772928, 1644436, 10498511, 957778, -3388729, 840203, -85362, -4415227, -8293582, + -6927782, -5018133, 4163434, -4782446, -7787850, -3660386, -10908143, -2459406, 7933342, -2231236, + -1932735, 4423280, -3113851, 3185792, -2692945, -2161979, 5759551, 1261110, -635655, 682900, + 823023, -2684, -1875290, 5022428, -2044941, 2128693, 1198833, 3566970, 2598992, 651761, + -1748052, 411243, -1522029, 442919, 1599875, -2338073, -812286, 617938, 112206, 981937, + 2246805, 161061, 1388885, -844498, -1293859, 556735, 607201, -510564, -1193464, 1043677, + -650688, -428960, -236760, -126165, -164819, -1578937, 256087, 151934, -93416, -591095, + 79994, 178778, 404801, -191663, -303332, 294742, 587874, -391916, -268972, 416075, + 284542, -372588, -85362, 90194, 299574, -194347, -124554, -50466, -210453, 314606, + -195421, 315680, 128849, 53150, -102542, -76236, + }, + { + -6373732, 132961448, 28509456, 15159624, 4150012, -1984275, 856846, 1093606, -3474629, -3293166, + -945967, -3559991, -4534412, 323733, -2950643, 7249905, 3910031, -4798016, 734976, 5789079, + 3679176, 1352915, 1870995, 8965744, -3095598, -2442763, 620623, -3527242, -7372312, -1065152, + 242129, 1382980, -1745367, -831613, -2162516, 1168768, 797253, -438087, 3349001, -3958349, + -929324, -231928, -801011, 4975720, -1272384, -20938, 1791538, 658204, 52613, 289373, + -201327, 498216, -249645, -215822, 241055, -412317, 136902, -293668, 679142, 1655173, + 84826, -387621, 585189, 381178, 827855, -537945, -732292, -550293, 308164, -175020, + 551903, 24159, 717796, 19327, -649614, -204011, 38655, 29528, -166430, 171799, + -67646, 261993, -150861, 0, 169651, -144955, -143345, 136902, -138513, -37581, + 27917, -231391, 100395, -75699, -1074, 151398, + }, + { + 898185, -28623272, -4964982, -2269353, -275415, -255551, 11811, 1366337, -2404108, 1042603, + -1413581, 2718714, 1050656, -1094143, 4578435, -8927626, 1448478, -7207492, -11993696, 2084133, + -4388920, -9922448, 370978, 891206, 2209761, 2860985, 885300, 2332704, -3500398, -3693672, + 648003, 1996086, 831076, 2872260, -2141041, 588411, -2091649, 642635, -1532230, 278636, + 1505386, 458488, -221728, 295816, 423591, 2080375, 1073742, -1416802, -682363, -1449552, + 89657, -366683, 158377, -619012, -480499, 1578401, -775242, 450435, 282394, -962610, + -494458, -949188, -804233, 212601, -347892, 234613, -284542, -208306, 341987, -331786, + 168041, -329102, 22549, 320512, -85899, -27380, 71941, 231391, 177167, -247497, + 194347, -1611, -471373, -135828, 125628, 213675, -482110, -181462, -8590, 57982, + 128312, -56908, 11811, 94489, 62814, -34360, + }, + { + -41422812, -52562348, -6573985, 5956046, 3468186, -810675, -1050656, 632434, 738734, 896574, + 5119064, 7877507, 3621731, 1282585, -2111513, -4952098, -6146635, -991601, -1656784, -2197950, + -1916629, 3993246, -542240, -811749, -432718, -662499, -2312840, -2400350, -6958921, -1689533, + 1591285, -2482491, -581431, -2472291, -3839164, 1034550, -9404368, -1141924, 2935610, -1488206, + -2115808, 1572495, 51540, 882079, 4360466, 3078955, 1421097, 2318209, 2371896, -988916, + 1393717, 541703, 346819, 321049, 316754, 1473174, 93416, 1272384, -110059, -380105, + 70330, -242666, -159451, 1125281, -479426, 284005, 785442, 214212, 861141, 49392, + 446677, 767189, -447213, -759672, -109522, 193274, -833224, -249645, -367757, -62277, + -347892, 247497, -147103, 138513, -335544, 90731, 25233, -456877, 229781, 201863, + -73551, 136365, 41876, 40802, -45097, 134755, + }, + { + -496069, -7247758, -1518808, 1787780, 245887, 195421, 44560, 955630, 1404454, -402116, + -1728724, -4663261, -1188095, -1274532, 4416837, -4453344, 3723200, 3707094, 2805688, -18103824, + 2515777, 332860, -4967130, -6488085, -4310000, 860067, 1771674, 134218, -1387811, -5168993, + -804770, 3036542, -256087, 504659, 1221381, 881005, 1048509, -1315334, -2682744, 253940, + 2437931, -740345, -1302986, 818191, 980326, 747324, 201863, -367220, 1063541, 1093069, + -1757715, -958851, -253403, -1016297, -847182, -115427, 277025, 1170916, -86436, 788663, + 1052267, 433792, -37044, -340376, 701153, -340913, 492311, -855235, -596464, 25770, + -277562, 665720, -49392, -8590, -18790, 889595, 215822, 210990, -332323, 518080, + 293668, -177704, 61203, 46708, 180389, 203474, -299037, 49929, 469762, 82678, + -98784, 7516, 70330, -137976, -3758, -158914, + }, + { + -43166032, 147417776, 5950141, 6203544, 756988, -2794413, -190589, 658741, -1064615, -2893197, + -556735, -7762080, -4829154, -2143189, 6694781, -361851, 2173790, -29528, 2545842, -850940, + -403190, -2078764, -2062658, -2416456, 3227668, 5109938, 1506460, 134755, 483184, -1854889, + 981937, -2600066, 2987687, 941672, 984084, 485868, -1939715, -1785096, -3313567, -650688, + 2653216, 1511292, -1142461, -3103114, 678605, 1272384, -390305, 1136019, 287226, 1787780, + -234613, -1406602, 670015, -1701881, -490163, 93952, -454193, -214212, -61203, -799401, + 211527, -51540, -478352, -77846, 50466, -415538, 926102, -492848, 76236, -144418, + -238908, -255014, 188979, 173409, -89657, 186294, 284005, -155693, 74088, -617402, + -72478, 169114, -19864, 649077, 432718, 31675, -88047, 40265, -237834, -200790, + 84289, -67109, -126702, -190052, -206158, 143345, + }, + { + -402116, 13136694, -5600101, -1859184, 397821, -25233, -207769, 1157494, 1619740, -527744, + 2147, -1402844, 1540283, 2533494, 3271155, -13480829, 5303748, -3038689, -787590, 3309272, + 296353, -9601936, 3093450, 1816771, -4221416, -4173635, -4930086, 3490735, -3391951, 3971234, + 1265942, 3849365, 772020, 665183, -944893, 2132451, 493921, 284005, 1507534, 2054605, + -1530619, -2335389, 385473, 138513, -762894, 710817, -702764, -1152125, -981400, 2298344, + -185757, 18254, 401043, -1432909, 808528, -1458141, -546535, -1563368, -885837, -90194, + 164283, 822486, 774705, 350577, 496606, -82678, -874026, -358093, 484258, -1939178, + -26844, 743029, -152471, -289373, 256087, -32749, 330176, 401579, 282394, 1108102, + 330176, -321049, 629213, -128312, -129386, 133681, -317828, 81604, 302795, 59593, + 114890, -49392, 199716, 143881, 154082, 57445, + }, + { + -22677964, -234276512, 14849313, 4716411, -42950, -3482682, -2799782, -1469953, -1524177, 853625, + -1625645, -6116571, -5259188, -3657165, 7672422, 2028835, -2008434, 3086471, 1565516, 435402, + 4693326, 2360622, 336618, 2275259, -60666, -1722282, 523449, -52613, 1002875, -1044751, + 3299609, -4770098, 171262, -2158758, 1935420, -4016331, 467078, 1156957, -475131, 1180042, + 5996311, -4583804, 1661616, 553514, 1061394, -1589675, 623307, -2183991, 945967, -1058173, + -538482, 580357, -1428614, -566399, 1444720, -249645, 596464, -1702418, -962073, 51003, + 106300, 506269, -322123, 435939, 70330, 13422, -6979, -194347, -27380, -185220, + -311385, 245887, -375810, -79994, -20938, 144955, 21475, 338229, -24696, 205622, + 59593, 108448, -141197, -31139, 279173, 342524, -228707, 439160, 32749, 139586, + 5906, 392453, -38118, -91268, -6979, -184684, + }, + { + 511101, -38246684, 1909650, 928787, -4239670, 2649458, -1208496, -2146410, 544924, -1491964, + 2038499, 218506, 3869229, -4265440, -791348, -6034429, -3103114, 2037962, 2703682, 2903398, + -5302137, 5827197, 2668249, -1611687, 660888, 2870649, -3917547, -3958886, -3082713, -2596308, + 5366025, -3717831, -3695283, -2654290, -3015067, 1420560, 1294396, -75699, 3504693, 428423, + -506269, 1147830, 446677, 1267552, -629213, 892279, -1452236, -1954747, 279173, -2174327, + 312996, 248571, -92879, 1065689, 285078, -751619, -84289, 828392, -1190243, -1652489, + -48318, 1097364, -198642, -280784, -206158, 209917, -634581, 1188632, -330176, -547608, + -126165, 299037, -757525, -505732, -867047, -121870, -405338, -300111, -90731, -803159, + -2147, 253403, 92879, 77846, -357556, 134755, -155693, 80531, 14496, -126165, + -91268, -202937, 169114, -75162, 94489, -14496, + }, + { + -18639622, -42894912, 11987254, -4678830, 8457327, 10438918, -10202158, -2132451, -2960843, 911607, + -479426, -4105989, -2377265, 2516851, -850940, 356482, -4960151, 2734284, -2415382, -7406134, + 2214056, 1416802, 1473711, -6782827, 6331319, -3820910, -122943, -2506114, -965294, -819802, + 570157, 914828, 433255, -1006096, 850404, 2123861, 2215130, 213138, -3270618, 1276679, + 534723, 1598802, -731218, -41876, 349503, 1442035, 814970, -540092, -1454920, -1171989, + 628139, 638876, 1089848, -569620, -2283312, -570157, -955630, 53687, 114354, -411780, + -9664, 399969, 316217, -359704, 437550, -288300, -383863, 182536, -43487, 496069, + 184147, -299037, -264677, 203474, -183610, 48855, 433792, -63888, -534723, 117038, + 210453, 55298, 316754, -86973, -278636, 50466, -281857, -92342, 215822, -391916, + -51003, -141197, 2147, 31675, 16643, -170188, + }, + { + 1138703, -5090073, -3545496, -256624, 2255932, 363998, 897648, -1916629, -1192927, -2642479, + -63888, 359167, -3220152, -22029962, -7937100, -1702418, -866510, 1925756, 4864588, -501437, + 631360, -4725001, 7900056, -797790, -8348880, 2288681, 1304596, 5701032, -1077500, 2837363, + 1858110, -4072703, 1732482, 1550483, -4865661, 791348, -4227859, 298500, -1735704, -1548336, + 145492, 984621, -762357, -1170916, -1335198, 217970, -293668, -532039, 496606, -1420560, + -471910, -725850, 410169, 947577, -66572, -1881733, 289373, -875636, -643171, -195421, + 389231, -287226, 323196, -443992, -418759, 432718, -106837, -418759, -360777, 637266, + -161598, -139586, 358630, 413927, 617402, 316754, -134755, -221191, 233002, 64961, + 93416, 200253, 117038, -189515, -287226, 33286, -17180, -309775, -40265, 140660, + -105227, -245887, -3221, 27917, 2684, 164283, + }, + { + 24401856, -35608500, -11285027, 12262132, 8211978, 933082, 5425618, -7327751, -2267743, 778463, + 8952322, 4258460, 8484171, -7524246, 9554155, 1389959, -624381, 882079, 2834679, -3474092, + 2044941, -4358318, -2681670, -4037806, 526134, -919123, 2279554, 964757, -1798518, 872415, + -863288, 3214783, -302258, 2219961, 0, -1290638, -1236951, -2764348, -2230162, 1448478, + 1355599, -731755, 868657, -2504503, -4799626, -2532420, -109522, 1250909, -782758, -2015950, + -308701, -389768, -170725, -72478, 140123, 813359, -212601, 2290828, 527744, 654983, + 607201, -896574, -90194, 1020055, -459025, -63351, -1013075, -710817, -412317, -259846, + 661425, -183610, 1001264, 932008, -260919, 482110, 106300, 301185, -210990, 134218, + 107374, -20938, -281320, 135828, 266288, 225486, -336618, 71404, -175557, 104153, + 96100, 65498, 202937, 40802, -38118, 20401, + }, + { + -1117228, -10252624, -2137820, -943819, -42413, 1988033, 1963337, 1597191, 31675, 428960, + 2051384, 3349538, 4580046, 12513924, 74107512, -5686000, 3362960, -6468221, 3609920, 1904281, + -3262028, 3737159, -3282966, -4984310, 2132451, 3983045, 3267396, -2940979, -6703907, 3578782, + -1785096, 3970161, -539018, -748398, -2664490, 1851131, 391916, -4236449, 544924, 3868692, + -1858647, 6979, 2072322, -654983, 365609, -896574, -571231, -192737, 1390496, -309238, + -301185, -583042, 883153, 310311, 473520, -940598, -716723, 211527, -525597, -373125, + 393526, 140123, -103616, 178778, 54224, -692027, -647466, -195421, 99321, -49929, + -602369, 537, 106837, 1611, -16106, 52076, 192737, 158377, 187368, -12885, + 133144, -198105, 68183, -108448, -60130, 109522, -149250, 57445, 48855, -78383, + 141734, 70867, 83752, -68719, 47245, -158914, + }, + { + 21772262, 3587908, 7837242, -974421, 750546, 2822331, 1708860, 8740258, -2027761, 5833640, + 1639604, 6794102, -1672353, -6938520, 42298984, 1340567, 7369090, -5656472, 541703, 242666, + 2860448, 1480153, 1170916, 1241246, -745177, 1316408, 2963528, -7394323, 1411434, -1636383, + -3270081, 1628330, -597000, 4533875, 989990, 1444720, -4621385, -1277753, -787053, -234076, + 3990025, -266288, -49929, -2938831, 1625108, -553514, -839129, 359167, 661962, -258235, + 830002, 1061931, 980863, 686658, 1708323, -593779, -1675574, 150324, 165893, -971200, + -733366, -872415, -565862, 21475, 455267, -777926, -166430, -292058, 969589, -415001, + -120259, -186294, -418759, 85362, -57445, 205622, 557272, -87510, 416075, -388158, + 30065, -306553, 427886, -323733, -502511, -39728, 188442, -102005, -99321, 5906, + 134218, 44023, 161061, 124017, -9127, -120796, + }, + }, + { + { + 253403, -22121230, 26970784, 3881040, -2605435, -300648, 793495, 928787, -2887829, -699006, + -858457, 962073, 3740380, 7291781, -10024991, 3135326, -7929584, -3957812, -4881231, 913754, + -7719130, -3771518, -790274, 4274566, 9017821, -3222299, -2413235, -4292283, -4571993, -9589588, + 5009006, -3019899, -1847373, 1677722, -979253, -3477850, -1329829, 346819, 3471944, -1543504, + 1046898, -303332, -2844342, 1006096, -278099, -835371, 1191853, -648540, 501974, 61740, + -919660, -159988, 636192, -983548, -299037, -531502, 606664, -252329, -197032, -1783485, + 351650, 38655, 660888, 32749, -1248225, 542240, -428423, -97174, 814433, 602369, + 146029, 82141, 130997, -100932, 289910, 283468, 89657, 315143, -186831, -172336, + 307090, -5906, 281857, -187368, 304406, 172336, 276489, -227096, -201863, 91805, + -125628, -184147, -13422, -75162, -228707, 58519, + }, + { + -11297375, -129168992, 68403256, 3505230, -1319629, -135291, 3299609, 2413235, 496606, -2760590, + -14496, -6703907, -747324, -4286378, -506806, 716186, -2951180, -4220342, -3182571, -281320, + -1147830, 6112276, -1595580, 2616709, -2823404, -3196530, 5265630, -1305670, -1120987, -747861, + -593242, -387621, -2053531, 2503429, -3702262, 1758789, 364535, 4031364, 1560147, 1597191, + 718333, 1688459, -1564442, 2807835, 3362960, -608275, -1177358, -273267, 1180579, 732829, + -995359, -1437740, 1522566, -172872, -685584, 579284, 1203128, -466004, -1899986, 287226, + -657667, 537, 373125, 817118, -157303, -1462436, -137439, 297963, -76773, -980863, + 216359, -365609, -118112, 2147, -108985, 242129, 495532, -350577, -271657, 40802, + 539555, -140660, -21475, 175020, 305480, 60130, -99321, -86436, -248571, 128849, + -403727, 146566, 54761, 115427, -181999, 11274, + }, + { + 5999533, 57179436, -55948392, 268972, 1051730, -5535676, -1479079, 1517197, 448824, 1874753, + -1175210, -5185100, -8671539, 1005559, 2519535, 4772783, -1592359, -2959769, -5512591, -6603512, + -4452271, -9265318, -2181844, 6060736, -1613834, -321586, -59056, -3363496, -5790153, 2806761, + 3970161, 4936528, -2901787, 2377265, 1664837, 1638530, -82141, 908922, 5352066, -1604707, + 1163399, -337692, -1331440, 4024384, -1738388, -1108638, 136365, -835908, -106837, 1455457, + -276489, -1217623, -1414655, -1072131, 351114, 379568, -1620813, -1096290, -6979, -60130, + 14496, 227633, 558883, -754841, 287226, 258235, -251792, -43487, 743566, -95563, + 741956, -2147, 723165, 159451, -566936, -458488, -133681, -175557, -204011, 191126, + -30065, 85362, -365609, 105227, 365072, -57982, -77309, 100395, 74625, 331786, + -537, -191126, 164819, -22012, -53687, 115427, + }, + { + -1008780, -11202885, 8416525, -2678986, 62814, -255014, -779000, 804770, -1712618, 1174137, + -2164127, 1304596, 1014686, -1394254, 13962939, 3850975, 1221918, -10339060, -16046535, -2152316, + -1157494, -10171556, -6495065, -5570036, -3498788, 3745212, 558346, 3375308, -1206349, -1471563, + 247497, -3080565, -1578937, 879395, -3302293, 2111513, -593242, 2301029, -2917357, -248571, + 828392, 1135482, -479426, -150861, 286689, 302795, -448824, 439160, 1486059, -344671, + 1987496, -7516, -1326608, -661962, -1050656, 1239635, -244813, -263604, 68183, 67646, + 311922, -473520, -220117, 391916, 40802, 488553, -1074, -471373, 24696, -303332, + -49929, -480499, 8053, -5369, -325344, -426276, -81604, 176631, -15032, -434865, + -300111, -115427, 233539, 55835, 110595, 236223, -325344, 55835, 44560, 59056, + 91805, 6442, 89121, 190589, 88584, -28454, + }, + { + 41596760, 38851200, -25278030, 9210557, 3135863, 537408, -802085, -1687922, -1990181, 3077881, + -1460826, -1017370, 2848637, 3925600, 10421738, 1798518, 4896263, 4072703, -8598525, -6894497, + -3482682, 1675574, -3743064, 490700, 1177358, 1276679, -1811403, 1563368, -2645163, 717260, + 2887292, -2922188, -3726421, -4046396, -355945, 3394635, -1816771, 1779727, 1881196, -343597, + 617938, 1611150, -2542084, -601832, 830002, -176631, -919123, -728534, 978179, -938450, + 1096827, 219580, 1136556, 578210, 236223, 628139, -317291, -135291, -1481764, -158914, + 340913, -573378, -727460, 851477, -752156, -281857, 564788, -547071, 143345, -450972, + -163209, 415538, -627602, -600759, 43487, 532576, -285078, 488016, -14496, 103079, + -188442, 689879, 127238, 341987, -351650, -133144, 85362, -198105, 76773, 54224, + -145492, -5369, -10737, 4295, -141734, 233539, + }, + { + -108448, -5097053, -976568, 1090385, 861678, 347355, 499290, 1444183, 25770, -911070, + -799938, -1241782, 936303, -4089346, 3941706, -3991098, -464393, -2429341, -2461016, -29721710, + -927176, 5798206, -6960532, -3042984, 1269700, -6307697, -932008, 3463891, -1343788, -5813238, + -1034013, 1097901, -1600412, -1156420, 2368675, 1258962, 1629940, 608275, -3222836, -477278, + 2551211, 236760, -686658, 454730, -793495, -128312, -488016, -1663226, 450435, 1059783, + -295279, 922344, 1340567, -1335735, -663572, 321049, -367757, 243203, -504659, 1010928, + 399432, -472983, -68183, -307090, 253940, 267362, 692027, -549219, 287226, 417686, + -325344, 584652, -372588, 46171, 153008, 200790, -483721, 312996, 45634, 358093, + -297427, 69793, 113280, -164283, -62277, 27917, -298500, 113280, 336081, -43487, + -27917, -4832, 163209, 102005, -18254, -316754, + }, + { + 27494770, 263698640, 15381888, 11534135, 6713034, -2012729, 290447, -191663, 452582, 161598, + 4516695, -3409130, -2246268, 816044, 3272765, -5501853, 832687, -2160369, 687732, -1525787, + 480499, -172336, -1788854, -3405909, -2176475, 629213, -669478, 1549410, 2940979, -2669322, + 1333587, -2322504, 812286, -2135136, -1828046, -2260764, -2020782, 1565516, -1659468, 149787, + 1605781, 341450, -603443, -985695, 979789, -635655, 459025, 1503239, 708670, 1720671, + -222265, -114890, 436476, -1690607, -818191, 389231, -322123, -184147, 137976, -959925, + 752693, 857920, -378494, -339302, 56908, -819802, 232465, -40265, 418222, -216896, + 236223, 8053, -63351, 213138, -4832, 115427, 260919, 82678, 266825, -37581, + 435939, -210990, -435402, 325881, 101469, -70867, -143881, 364535, 227633, -90194, + 12348, 230854, 176631, 120796, -37044, 228707, + }, + { + -1042066, 10919954, -1740536, -425202, 509491, -282931, -1143535, -1028645, -900333, -1228361, + -1168768, -2033667, 2983929, 4248260, 23602992, 4027069, 12370043, 3042984, 4137127, 1307281, + 7373385, 2215130, 8220031, -2605435, -12888660, -616328, -5590974, -423591, -4918275, -1350230, + -3205119, 184147, -2185065, -102005, -514322, -1483374, -1571421, 825707, 574989, 1714766, + -35970, -1905892, 1479616, 1668595, -629213, 319438, -711354, 413927, -932008, 1458678, + 415001, 671626, 205622, -1216550, 1012002, -2266669, -607738, -335544, -347355, -898185, + -113817, 1411434, 1067836, -374199, 429497, 574452, -719407, -396211, 1198296, -957241, + 83752, 53687, -379568, -171799, 233539, 32749, 219043, -186294, -468151, 356482, + -125628, -308164, 643708, -369367, -130997, 389768, -235686, -121333, -9664, -69256, + 193274, -142808, 42413, -43487, -100395, -162135, + }, + { + 35606888, -184248192, -10375030, 5145371, 3058554, 308701, 863825, 1329829, -1066763, 847182, + 2272575, -3741454, -599148, -4037806, -681826, -2752537, -3745212, 2713346, 6084358, -603443, + -768799, 289373, 3077344, 2823941, -2382633, -1331440, 595390, -1029718, -558346, -4276714, + 4981625, -2364916, -1493038, -1206349, 1148904, -3446175, 2267206, 64425, -605054, 2933463, + 3661460, -5569499, 3812320, -330176, 203474, -674847, 614180, -836445, 2517388, -1343251, + -1194538, -387084, -2089502, 181999, 2611877, -45097, 627065, -884226, 562641, 620086, + 164283, 476205, 526134, 843961, 169114, 505732, 149787, -5369, 561567, 59056, + -512712, 372588, -22012, 118648, 331786, 402116, -19327, 700617, -9127, -96637, + -13959, 169114, -345745, -297427, -137976, 117575, -211527, 274341, 35970, 23085, + -69793, 305480, -124554, -191126, 52613, -5906, + }, + { + -925029, -24735790, 10902238, 3523484, -5330592, -845035, -725313, 1105954, 1494649, -2801393, + -3619047, -2691871, 67646, -7992934, -2796024, -11030013, 1311576, 3877819, 3980898, 12445741, + -3451006, 3659312, -349503, -4260608, 1121523, 2116882, -4046396, -2986076, 1042066, -3277597, + 6094559, -47782, -64961, -1033477, -2910377, 87510, -1254131, -1613297, 270046, -1437203, + -1056562, 1087164, 1137630, 1274532, -313533, 1471563, -1089848, -1296543, 429497, -2910914, + 758599, 253940, -1556926, 139586, 324270, -1975148, -1935420, -296890, -1010391, -869194, + 387621, 1200443, 31139, -170188, 159988, 412317, -451508, 834834, -395674, 82678, + -236760, 392453, -88584, 265214, 239981, 606127, -234613, -226560, 466004, -136365, + -149250, 67109, 248571, 427886, -53687, 295279, 80531, 86436, 150324, -168577, + 90731, -133144, 91805, -31675, 132070, -67109, + }, + { + 16645683, -52162916, -26298084, -5212480, -3699041, 6542846, -5539434, -6005975, -5912023, 2386391, + 3038689, -4426501, -4915590, 1789928, -4762045, -1394254, -10072772, 1698660, 6130529, -3086471, + 5370857, 1749662, 2127083, -6403796, 4496831, -3008088, 1040993, 512712, -1697586, -2838974, + 93952, 2469606, 4140349, 1808718, 1232119, 1897839, 1157494, 131533, -2411624, 2202781, + 1730335, 1970316, -1583769, -806917, -252866, -6442, -235149, 588947, 299037, -2186675, + -375810, 323733, 522375, 55835, -485331, 519691, -425202, 90194, 328565, 98784, + 409633, 317828, -43487, -711354, 193810, 82141, -304943, 711354, 4295, -254477, + -113817, 147103, -8590, 210990, -323733, -342524, 202400, -166967, -532576, 10737, + -5369, -206695, 158377, -330176, -179852, 217433, 79457, 41339, 291521, -331786, + -82678, -140660, 167504, 166967, 39192, -114890, + }, + { + -1151588, 3242700, -46708, -5270999, -2751464, -1007707, 870268, -744103, -818191, -1475321, + -365609, -1820529, 11304354, 1461363, -3152506, -3421478, -4914517, 622233, 6380174, -423054, + -304406, -6618545, 2083059, -6795175, -10904922, 4709432, 666257, 96100, -3469260, -71404, + 1767379, -3771518, 1600412, 723165, -2854006, 2883534, -568009, 2433099, -792958, -2301566, + 185757, 2212445, 854162, -300111, -2225867, -221191, 166430, 323196, 2384781, -896574, + -551903, -9664, 144418, -569620, 143881, 105227, 1874753, 154619, -582505, -300111, + 415538, -308701, 208843, -905701, -870805, 469225, 249645, -219580, -233002, 66572, + -358630, -217970, -214212, -148176, 625455, 256624, 31675, -185220, 154619, 106837, + -84826, 181462, -115427, -365609, -181462, 8590, 186294, 44023, 115964, 83215, + -51003, -19327, 115964, 25770, -120796, 70330, + }, + { + -9626632, -71746888, -16812650, -88047, 4169340, -1110249, 5247377, -10049687, 1615445, -1969243, + 1635846, 637803, -7873749, -18575196, 8301635, -6674916, -7479149, -1583232, 6317897, -1681480, + 4313221, -2659122, 2871186, -233002, 1292785, -2029372, -1495186, -1493038, -2993055, 386547, + -1807108, 3287798, -2122251, 1807108, 1174137, -2507724, 1146756, 10737, -2283312, 130460, + -81068, -838592, 2000381, 2861522, -1786706, 348429, 1677185, 731218, -1429150, -1023276, + 1032403, -727997, 992674, 1589138, -331249, 92879, -947577, 1964948, 345208, -1714229, + -685047, -239444, 232465, 1146756, -10737, 717260, -132607, -470836, -836982, -587874, + 189515, -834297, 5906, 278636, -241055, 60666, 48318, 384936, -479426, -344671, + 139050, 279173, -279710, -84289, 206158, 610422, 8590, 287763, 100932, -63351, + 10737, 31675, 156229, 214212, 6979, 84289, + }, + { + 838056, -5982353, -683437, 2017561, -230318, 1229971, 2737505, -1483374, -2389076, -472446, + 799938, 2800856, -1735704, -44364328, 16131897, -8879308, -5091684, -7281044, 4039417, 7774965, + 783295, 2376728, -3820910, 2102923, 3929358, -641561, 4633196, -4161823, -7370164, 5223217, + -1775432, 777389, -3909494, -2078764, 16106, 4905390, 2480881, -715649, 15569, 2287070, + -869731, -179852, -241592, -1402307, 1560684, -253403, -207769, -583042, 1225676, -194884, + -427886, -1095217, -234613, 15569, 338229, 193810, -174483, 412854, 135828, -193810, + 882616, 123480, -176094, 159988, 78920, -640487, -846645, 83215, 12885, -602906, + -437013, -137439, -70330, 114354, -45097, 57982, 81604, -186294, 326418, 272194, + 304943, 285615, 207769, -167504, -176631, 27380, -11811, 119185, 354872, -62277, + 124017, 58519, 169651, -36507, 82141, 30065, + }, + { + -17528298, -51153596, -1013075, -4613332, 2563559, -4524211, -5811091, 5977521, -528818, 5576478, + 333934, 742493, -7413114, -2028298, 44441100, -10293426, -5627481, -8478802, 1158031, -385473, + -125628, -1771674, -1507534, 783295, 1251983, 2318746, 2593087, -9351218, -629750, -597537, + -3535295, 2580739, -911607, 1319092, 642635, 3598109, -433255, 1124208, 925565, -980326, + 2553358, 1835025, 1643362, -2377801, 933082, 774168, 331786, -759136, -689342, -266825, + 336618, -656056, -675384, -849330, 339302, -810675, -831613, -32749, -208843, -255551, + 608812, -470836, -1138166, -674310, 339302, -661962, 2684, -346282, 1244467, -79994, + 424665, 443992, -424665, -117575, -9664, 184684, 341450, -296890, 440771, -225486, + 57445, -397821, 455803, -39728, -319438, -156229, 119185, -79994, 150324, 78920, + 136365, -59593, -49392, -54224, -33823, 111669, + }, + }, + { + { + 318364, 45221172, -28611998, 848793, 4017942, -2257005, -140660, 23622, -38118, -1821066, + -1941325, 10737, 7327751, 4566087, -11970611, -1180042, -330712, -3191161, -10392210, -5844377, + 1938641, -8296803, -386010, 7007776, 3900367, 3445101, -3857954, -6959995, -1870458, -8393977, + 4552666, -4533338, -3670050, -2916820, 332860, -1083942, -699543, 2206003, 1595580, 559956, + -418759, -673236, -304406, -265214, -2013803, 377957, 1206886, 208306, -1981591, 813359, + -202937, -486405, -15032, -40802, -1580011, 353798, -287226, 963683, -590021, -1068373, + 843961, -724776, 572841, 99321, -1027034, -25233, 242129, -62277, 410169, 644245, + 155156, -102542, 120796, 419296, -29528, 111669, 441845, -412854, -93416, -8053, + 19327, 269509, 45634, -239444, 250182, 56371, 189515, -176631, 149787, 118648, + -335544, -211527, -176094, -13422, -45097, 41876, + }, + { + 14432701, -18698140, -48010220, 7584912, 124017, 2917894, 1573569, -244813, 4603131, -814433, + 271120, -6646999, -641561, -578210, -6817187, -1607392, 9446244, 2363843, -15559593, 3715684, + -3068754, 1141924, 3654480, 429497, 196495, -4265440, 2504503, 928250, -1292248, -908386, + 385473, -411780, -169651, -2570538, 1962800, -511101, 898185, 2608119, 2430415, 296353, + 696858, 2922725, -287226, 2000918, 2144799, -400506, 220117, -687195, 1158567, -251256, + -1533840, -81604, 65498, 117575, 651224, -646929, 494995, -790811, -560493, 1611, + -321586, -17180, -53687, 367757, -358630, -403727, 50466, -404801, -20401, -557809, + -2147, -649077, -49392, 28991, 165893, 214748, 323733, -175557, -198105, -230854, + 518080, -132607, 271120, 35433, 129386, 177704, 6979, -54761, -4295, -137439, + -163746, -171262, -105227, 169651, -28454, 62814, + }, + { + -5698885, -49152680, 33502892, 3451543, -4278325, -6203007, -2861522, -470299, 1759863, 2716567, + -4169340, -988916, -8968965, 2371896, 9128953, -2298344, 396211, 1458141, -7916699, -9305047, + -5843840, -6692633, -130997, 1369021, 878321, -1755568, -181999, -5978595, 791348, 4172561, + 2085207, 865973, -50466, 365609, 3570729, 4162360, -3293166, 853088, 4660577, -819265, + 2177012, -1718524, 1423245, 2353642, -678605, -2667175, 159988, -1385127, 1153736, 1528472, + -841814, -1485522, -1527935, -1241782, 1078037, 477815, -2591476, -538482, -666794, -502511, + 650688, 86436, 205085, -739808, -441308, 1081258, -780610, 329639, 520228, 52076, + 889595, -16643, 27917, 535797, -367220, -678068, 72478, -304406, -410169, 273267, + 257161, -280247, -82678, 100395, 368293, -74625, 6442, -33286, 248571, 184684, + 60666, -96100, -19327, -68719, 63888, 31675, + }, + { + 1347009, 5449240, -5899675, -1552094, -296353, 73551, -1121523, -532576, 4295, 457414, + -637266, -223338, 1593433, -2549600, 11574400, 6374269, 2277943, -12154221, -13304735, 1151051, + -2261837, -7758322, -7094212, -4681515, -4182225, 2522757, 2122788, 1979443, -1327682, -1658931, + 265214, -4185983, -20401, -854699, -302795, 892279, -818728, 2873333, -2136746, -115427, + -320512, 939524, -1625645, 809064, 1523103, 41876, -1895691, 687195, 1968169, 505196, + 1009317, 91805, -1219234, -352724, -602369, 130460, 147103, -335007, -606127, 1082869, + 57445, 99321, 49929, 35433, 181462, 25770, 498216, -268972, -187905, -246424, + 100932, -780073, 350577, 5906, -418759, -62814, -287226, -3758, -137976, -143345, + -321049, -240518, 404801, 39192, 209917, -3758, -65498, 118112, -191663, 149250, + -25770, 55298, 63351, 45634, 87510, -41339, + }, + { + -32203664, 109582336, -6657200, 6067715, 7064148, -816581, 703301, -1694902, -2823941, 5150203, + -3549791, -1851668, 1179505, 3602941, 15635828, -158914, -3758, 4345970, -2465311, -11635066, + 570157, -2304787, -1705102, 66035, 5350993, -3768297, 355945, -3998615, 5808944, -594853, + 886374, -474594, -4246112, -2679523, -806380, 466541, 9451612, -4199405, 1638530, -813896, + 1972464, 1008244, -2374043, -128312, -331786, -624918, -2070174, 157840, -723702, -306553, + 990527, 625992, 1025960, 296353, 695248, 139586, -69793, -1547799, -382252, 324270, + -506269, 17180, -839666, -156229, 359167, -614717, 411243, -48318, -29528, -570694, + -554051, 324270, -242129, -308164, -115427, 207769, 375273, 446140, -248034, 177167, + -112743, 290984, 321586, 123480, -118112, -127775, -119185, 133144, -99858, 94489, + -121870, 159988, -110595, 175020, -233002, 178778, + }, + { + 125628, -4381941, -3754338, 1916092, 1115618, 256087, 254477, 495532, -950798, 790811, + -1670205, -362388, -2082522, -2608656, 8681740, -1203665, -1067836, -5823976, -2629057, -27222576, + -3277060, 5396627, -2139431, -8221105, 4339528, -7350300, -3568581, 2956011, -3202972, 1576790, + -3116536, -2055142, 448287, -1025423, 3615826, -116501, 525060, 350040, -1266479, 693100, + 1503775, -1740536, 497142, -651224, -694711, -114354, 255551, -889058, -728534, 585189, + 608275, 1302986, 481036, -750546, 340913, -1225676, 435402, 150861, -250719, 254477, + 365609, -564251, -471910, 777389, -352187, 833761, 19327, 330176, 253403, 390842, + -154619, 291521, -240518, -18254, 52076, 61203, -670015, -57445, 464393, 20401, + -253940, 148713, 256624, -154619, -266825, -117575, 105764, -101469, 383863, -194884, + 207232, -52613, 123480, 129923, -108448, -185757, + }, + { + -4307852, 344780096, -11269994, 17569100, 2172717, -1230508, 55298, -464393, -2405182, 3656091, + 4266513, 311922, -3338263, 4832, 3514357, -8025147, 667331, -508954, -1360968, 212601, + 758599, 781147, -1879585, -3037616, -2026688, -1374390, -2036888, 2093260, 1599875, 142808, + 2387465, -1925219, -1337882, -3646964, -1899449, -2270964, -2206540, 1884417, -518617, 235149, + -141197, 1043677, 69256, -196495, 1248225, -2849174, 2193118, 208843, 1801739, 828929, + -1369558, 1301375, -463320, 199179, -1034013, 530965, -437013, -522375, 660888, -785979, + 534187, 382789, -195958, -146566, -139050, -838056, 133144, -88047, 551366, -228170, + -221191, 433255, 9127, -83215, 349503, 71941, 135828, 319438, -111669, 76236, + 490700, -246424, -338229, -37581, 96637, 35433, -4832, 97174, 213675, 216359, + -89121, 297963, 127775, 170725, 75699, -15032, + }, + { + 565862, -7046968, 9045738, 707596, 556198, -292595, -1042603, -995359, -1531156, -281857, + -710817, 514322, 2095944, 2513630, 31526134, 11556146, 3039763, 2445984, 7220377, -6776922, + 8044474, 11642046, 128849, 2640868, -10799158, -673236, -1774895, -3303904, -1929514, -6179384, + 935766, -1258962, -4177393, 1893544, -63888, -1490354, -2739116, -122943, 1848447, 877784, + 762894, -898722, 671626, 842887, 452045, 266825, -137976, 6442, -472983, 759136, + 767189, -503048, 1497870, -270046, -506806, -936840, -1540820, 213138, -474594, -779537, + 1240709, 201327, 670552, -454193, 97711, 371515, -69256, 182536, -188442, 459025, + -117575, -896038, 16643, -104690, 68719, 178241, 352187, -629750, -136365, 61203, + -515396, 230854, -11811, 102005, -49392, 83215, 79994, -148713, -259846, -68183, + 181462, -75162, -91268, -26844, -147103, -207769, + }, + { + -40492952, -130419904, 22989886, 12023761, -2024540, 590558, 7516, 1040456, 296353, -539018, + 416612, 2149094, 727460, -2703682, -5941014, -1502165, 2024003, -2069637, 2762201, 686121, + -980326, -502511, 3959423, 303869, -666257, -1467805, -263067, -1053341, -1437740, -1629403, + 2360085, -454193, -3452617, 594316, -1032940, 1500554, 74088, 168041, -34360, 2515240, + 86973, -1149978, 1138703, 905701, -986769, -151934, 49929, 26307, 501437, -54224, + -640487, -1349694, -976568, 135828, 1855963, 176094, 191126, 109522, 979253, 194347, + 538482, -147103, 705448, 605054, 372588, 738198, -360240, -15032, 322123, 132607, + 13959, 70330, 103079, 68719, 261456, -175557, 525597, 512175, -70330, 22012, + -3221, 132070, -433255, -119185, -134755, 105227, 113817, -76236, -11274, 22549, + -11811, 102542, -20401, -113817, -64425, 56371, + }, + { + 1378148, -2185602, -7522099, -576063, -413391, -316754, -6375879, 3170223, 1416802, -2007360, + -5813775, -2713883, 545998, -8940511, -5890011, -5668820, 6120866, -812286, 4092567, 11142756, + 1821603, -1293859, 4822175, -6145025, 754841, -2345589, -285615, -3382824, 3762391, -232465, + -724239, 1421097, 2044404, -1686312, -2852932, 732829, -595927, -3057480, -368830, -681826, + -1144609, 109522, 799401, 1827509, 1260036, 155156, -743566, -943282, 165356, -1835025, + -488553, 62814, -927176, 213138, -563714, -772557, -1740536, -928250, -872952, -68719, + 328565, 544387, 561567, -527207, 737661, 249645, -268972, 184147, -453656, 409096, + -297963, 1074, 379031, 341450, 358630, 383863, 69793, -192737, 310311, 534723, + -253940, -148176, 301185, 205622, 139586, -87510, 205622, 212064, 172872, -78383, + 21475, -106300, -54224, 115427, -42413, 23085, + }, + { + -15126338, -72033048, 18456548, -1056025, -3459059, -5873905, -1517197, 906775, -6517076, 2399813, + 5977521, -5954436, -2646237, 785979, -8330089, 1974074, -6980933, 1847910, 3113851, -1864553, + 4177393, 1229971, 352187, -2182380, -1723893, 1204738, -793495, 3515431, -461709, -3107946, + -2920578, -910533, 7661148, 3873524, -320512, 1755031, 3065533, 220654, -2243047, 2054605, + 1336272, -453656, -966368, -86973, -1146756, -13959, 322123, -316217, 626528, -1805497, + -690953, 331786, 925565, -583042, 359167, -116501, 1010391, -888521, 801548, -288300, + 366146, 501437, -204011, 61740, -477815, 215285, -196495, 561030, 69256, -287226, + -184684, 89657, 95563, 190052, -357019, -178241, -224949, -118112, -55298, -322123, + 91268, -306553, -100395, -148713, 106837, 16643, 104690, 201863, -81604, -149250, + -192200, 71941, 166430, 69793, 8053, -88047, + }, + { + 979253, 10808285, -11221676, -4188130, 144955, -925029, -404801, 1548336, -2194728, -724776, + -709743, -3540664, -2960843, 23500450, -2695092, 2115808, -5634997, -804770, 2215666, 5719823, + -10837813, 2767033, -1068373, -5233955, -4740570, -2908230, 5250061, -3986804, -24696, -2413235, + 777389, -1588601, 3109020, -401579, -417686, 730144, -536871, 751619, 431644, -2260764, + -487479, 1274532, 1224066, 224949, -1889249, -385473, -467078, 1735704, 1737851, -279173, + -680215, 405338, -69256, -1255741, 238908, 389231, 1211718, 909996, 720481, 67109, + 391916, -1161789, -28991, -450435, -708133, 145492, 461172, -174483, 28991, -316217, + 33823, -231928, -613643, 83752, 379031, -15032, 156766, -212601, 122943, 121333, + -8053, -162135, -108985, -157303, 13422, -7516, 58519, 147640, 174483, 65498, + -41876, 14496, 122407, -99321, 17717, -51003, + }, + { + -3138011, -79870824, -11457362, -8468065, 10299868, -3048353, -4759361, -4058744, 361314, 41339, + -5440650, 3600793, -6998113, -20341502, 6851010, -7103339, -1257889, -1814087, 2343979, -122943, + -477278, 1950452, 3236795, 1771674, -850940, -3101503, -2609193, -1217086, -1816771, -860067, + 1086627, -2684, -2784213, 510564, 1839857, -2942053, 2884071, -384400, -1311576, -1423782, + 330712, 2363306, 1021665, 1379221, 656593, 1787243, 1368484, -754304, -136365, 11811, + 538482, -1019518, -257698, 1246077, -88584, -354872, -102005, 1297080, -281320, -1420024, + -1299228, 494995, 165893, 973347, 269509, 999117, -346282, -543313, -755377, -435402, + -7516, -282931, -616328, -329639, 318364, -88584, -169651, 521302, -634045, -171262, + 26844, 104690, -292595, 92342, 123480, 387621, 347355, 236223, 271120, -6979, + -51540, -15569, 96100, 91268, 74088, 2684, + }, + { + -420907, -1261647, -781147, 69256, -475131, 428960, 1763621, -1424855, -2493766, 13422, + -169651, 913754, -2355790, 4937602, -43394740, -13912473, -4047470, -1889786, -451508, 8004746, + 3266323, -2288144, -3013457, 5641440, -721555, -139586, -801011, -1377074, -1490891, 1468879, + -89121, -4095251, -938987, -2884071, 205622, 6669011, 891206, -383863, 1343251, -1336272, + 2656437, 389231, -2426120, 503585, 618475, -1388885, 506806, -642098, 2386928, -459562, + -1227287, -806917, -432181, 587337, -1069984, 1296543, -41876, -264141, 611496, -94489, + 328028, 6442, 254477, -666257, 403190, -592169, -678068, 183073, 425739, -537945, + -719944, -256624, 191663, -388695, 76236, 36507, 125091, -51003, 282931, 347355, + 173409, 377957, -79457, 59056, -225486, -125091, 234613, 93416, 343597, -28454, + 85362, 111669, 70867, 28454, 28991, 8053, + }, + { + 7876433, -77073728, -9789304, -6402723, 3397856, -3218004, -7684770, 2694555, 1589138, 5414880, + 1804960, -5728950, -1438814, 17262010, 20190104, -9036074, -9836549, -7104950, 326418, -859530, + 1146219, -4413616, -2397666, 290447, -743566, 3635690, 571231, -2222109, -7479686, 2207076, + -1377611, 1592896, 627065, -2538863, 2858301, 219043, 2128693, 2209761, -911607, 608275, + 726386, 3440269, 46708, -590021, 70867, -182536, 414464, 814433, -1506460, -296890, + -217970, 606127, -1029182, -1325534, 685047, -759672, 79457, -1050656, -549756, 797790, + -66572, -77309, -548682, -491237, -339839, -812286, 713501, 240518, 62277, 393526, + 316217, 61203, 270583, -418222, -69793, 356482, 27380, 137439, 59056, -5369, + -345208, -18254, 15032, 195421, -160524, -201863, -59056, -137976, 148713, 104153, + 57445, 30602, 26307, -186831, -112206, 135291, + }, + }, + { + { + -1568737, 70054672, -12424267, -7655779, 906238, -337155, 387621, 321586, -30602, 7516, + -227096, -3990562, 2626373, -4039417, -15695421, 1440425, 4748623, 3541738, -6580964, -12259447, + 1380295, -2739116, 1326071, 3277597, -293132, -174483, -3136937, 347355, 3310346, -5191005, + 3812857, -611496, -921807, -4951561, 973884, -113817, 497679, -293132, -2137820, 1855963, + -605054, -1771137, 140123, 208306, -1389959, -289910, -380641, 393526, -994822, 915902, + 12348, -508954, -271120, 515396, -1041530, 286152, -561567, -112206, -182536, 728534, + 870268, -1180579, 366146, 221728, -416075, 24159, 202400, 297427, 399969, 66035, + -285078, -19864, 126702, 355945, -93952, -127238, 288837, 41339, 37044, -247497, + -173946, 177704, -16106, -278636, -29528, -73014, 196495, -77309, 248034, 97174, + -77846, -25233, -181999, 24159, 95026, 105764, + }, + { + -16989816, 32148368, 15684147, 1365800, -856309, 3121904, -1722282, -3153580, 3597035, -200790, + 5735392, 3540664, 1449015, -1547262, -6328098, -2216203, 7304666, 2732136, -11999065, 6904697, + -1515050, -1620813, 536871, 1015760, 3748970, -2958696, -680215, 321049, 34897, 1038308, + 360240, 221728, 1685775, -1736241, 3907883, -1080184, 169651, 1058710, 999117, -193274, + 30602, 740345, -568009, 1781338, 357556, -2377801, -428423, -1122597, 1222455, -234076, + -440234, 1950989, 522375, -5369, 565325, -1141388, -52613, -860604, 313533, 672699, + 170725, -342524, -484258, 166967, -86973, 238371, 153545, -561030, 224949, -248034, + 318901, -355945, -26307, -98784, 33823, 146566, 416612, 36507, -51540, 23085, + 311385, -273267, 275952, 8053, 87510, -133144, 193274, 132607, 238908, -42950, + -140123, -84289, 6442, 38118, -64961, 111669, + }, + { + 6535867, -122060288, -18123152, 16462073, -1128503, -1476395, -680752, -1483911, 94489, -310311, + -4400194, 4634270, -584116, 5759551, 6176163, -644245, 4137127, 4546760, 601295, 342524, + -804233, -3260417, 175557, -1452773, 180389, -637266, 3158412, -1526861, 4885526, 2520609, + -411780, -1612223, -1231582, -2249489, -414464, 1281511, -2264522, -971200, 1020055, -571231, + 3492882, -799401, 246424, 744640, 286152, -708133, 1089311, -1483911, 1101659, 777389, + -655519, -160524, 896574, -982474, -756451, 118112, -1385127, 241592, 234076, -171262, + -281320, 70330, 471910, -185757, -155693, 1086627, -691490, 115964, -47782, -587874, + 454730, 340376, 172336, 412854, -202400, -177704, 435402, -1611, -355409, 298500, + 372052, -286152, 139050, 27380, -72478, -233539, 120796, -83215, 192737, 51003, + -54224, -105764, -18254, -166967, 19327, -9664, + }, + { + -1635309, 12575664, 3247532, 440234, 460098, 399432, -555125, -120259, 21475, -537408, + -1450625, 1009854, 3604551, -9155797, 2004139, 3527242, 3683471, -1703491, -3374771, 1362578, + -1973538, -363462, 437550, -566936, -3234110, -1229434, -653909, 1503775, 99321, -1609539, + 2679523, -1197222, -261993, -1360431, 1326608, 364535, -1825898, 2710661, -721555, 497679, + 409096, 953483, -1386738, 711891, 1693828, 596464, -1505923, 170725, 937914, -322123, + -769336, -55835, 630286, 723165, 70330, -206695, -365072, 491237, -512175, 297427, + -95563, -126702, -221191, 358093, -119722, -764504, 281320, 386547, -60666, -509491, + 112743, -425202, 360777, -61740, -10737, 323196, -70867, 121333, -109522, 235686, + -43487, -267899, 170725, -114354, 139050, -60666, 61740, 122407, -248034, 18790, + -106300, 46171, -47245, -74088, -5906, -31675, + }, + { + 18444200, 119291640, -44928044, 304943, -2225330, -134218, 547608, -480499, -2661806, 1457068, + -412854, -1457605, -2655901, 3714073, 14650670, -2927557, 451508, -3819300, -6601902, -4051765, + 227633, -1673964, 1777043, -3375308, 2289755, -5467494, 1980517, -3084860, 3821447, -971736, + 908386, 702764, 729071, -489626, -1527935, -2448131, 7177964, -2738042, 1897302, -2217814, + 1138703, -47782, -2161979, 10201, 275415, -416612, -2356863, 406411, 477278, 1239098, + 635118, -139586, 537408, -329102, 469762, 639413, -172336, -1383516, 268435, 704375, + -1079647, -112206, -293132, 44560, 508954, -361314, 246961, 105227, 418759, -133681, + -510564, -9664, -41339, 200253, -49392, -42950, 308701, -6979, -191663, 418222, + -16643, -18254, 84826, -136902, -84826, 57445, 31675, 279710, -134755, 212064, + -172872, 149250, -80531, 158914, -198105, 118648, + }, + { + 93952, 346819, -2009508, -635118, -184147, -154082, 561567, -244813, -1702418, 1418413, + -1577327, 462783, -2603824, -6097243, 9104794, 4241817, 1335198, -3987877, 4261145, -24998320, + -9158481, 1115081, -2786897, -10833518, 5141613, -1360431, -8266739, 317291, 3230352, 4438849, + -2086817, -377420, 4544613, -1340030, 1051730, -643708, -1197759, -218506, 958851, 1606318, + 1018981, -1722819, 1414118, 505196, -296353, -421981, 598074, -163746, -814970, 510027, + 55835, 161061, -142808, -348966, 673236, -1456531, 60666, 17717, -39728, 637266, + 192200, -12885, 108985, 482647, -394063, 706522, -311922, 99321, 102005, 110595, + -447213, -122407, -357556, 9664, 134218, 710280, -221728, -334471, 45634, -265214, + -54224, -25770, 106837, 8053, -93952, 59593, 346819, -176094, 266288, -188442, + 198642, 57982, 246961, 18790, -173946, -120796, + }, + { + -17987324, 338925536, 401579, 12380243, -219043, -535260, -495532, -85362, -1581085, 2749316, + 1647120, -29528, -2682207, 89657, 1784559, -9137543, 1850057, -1612223, -3357591, 815507, + 1420024, 1952063, -1512902, -2433636, 1041530, -808528, -3079492, 634581, 798864, 989990, + 1302986, -540092, 1396938, -3497177, -2536715, -756451, -1024887, 1110249, -938450, -882079, + -463320, 1460289, -1019518, -772557, 1382443, -2019708, 2361695, 207769, -136365, -1473174, + -1421097, 151934, 62814, 1215476, 479963, 1732482, -1024350, -950798, 607201, -709743, + 588947, 260919, -446140, 168041, 459562, -27380, 79457, -540092, 549756, -317291, + -327491, 443992, -149250, -467078, 293132, 115427, 140660, 301721, 68719, 88047, + 39192, -129923, -37581, -162672, -31675, 197569, 134755, -53687, 47245, 100932, + -205622, 62814, -41876, 68183, 1611, 13959, + }, + { + 728534, -9173513, 4246112, 115427, 702227, -168041, -548682, -206695, 38118, -25770, + -1069447, 864899, 1954210, -952409, 22335978, 2259690, -6114960, -69256, 5471789, -5024575, + 4991826, 7114077, -3443490, 783295, -3666828, 4760435, 1748052, 3379066, 1946694, -5738077, + 2838437, 450972, -2703682, 2235531, 768799, -31675, -1908039, 369367, 864899, -586263, + 222801, -133144, -564251, -733366, -489626, -639413, 689879, -439697, 898185, 1468879, + 223875, -425202, 1253057, 636729, 370441, 544924, -118112, -88047, -634045, -485868, + 1255204, -185757, 22549, -444529, -654983, -59593, 358093, 192737, -591632, 434329, + -301721, -736050, 60130, -102005, -99858, -362388, 192737, -327491, -47782, 164819, + -522375, 329639, -143881, 56371, 203474, 61203, -59056, -13422, 54224, -60130, + 30602, -61740, -89657, -24159, -82141, -136365, + }, + { + 38427072, -94828048, -31612570, 16940424, -755914, -932008, -3689377, -719407, 1797981, -234076, + -139586, 4085051, 1865090, 1410360, -2926483, 1647657, 3434900, -4993437, -2463164, -588947, + 660351, -711891, 1637456, -1902134, -1394254, -733366, 147640, -1100585, 628139, 208306, + 805843, 1310502, -188979, 1447941, -813359, 2500745, -748935, 809601, 456340, 898185, + -1996086, -1945083, -509491, -45634, -1213328, 697932, 441845, -728534, -602369, 534187, + 154082, -1113470, -217970, -156766, 681826, -478352, -27917, -62814, -172336, -738198, + 71941, -432718, -58519, -262530, -326954, 355409, -81068, -132070, 164283, 156766, + -163746, -203474, -196495, -367757, 64961, -333934, 476741, 61203, -280784, -52613, + 8053, 89657, -335007, 44023, -113817, 168577, 207769, -155156, -23622, 118648, + -62277, 54761, 71404, 85362, -75162, -64425, + }, + { + -1712618, 16100759, 8221105, -5622112, 968515, 2215130, -9780714, -278636, 98784, -254477, + -1676648, -2379412, 2591476, -476205, -3301219, -3775276, 10147397, 2124935, 3867081, 2284923, + -1761474, 75162, 4402879, -6271189, 2466385, -24159, 2030446, -4141959, 2484639, 595927, + -2549063, -115427, 2327336, -394063, -514322, 674847, 2131378, 396211, 852551, 710817, + 985695, 2046015, 1018444, 341450, 235149, -221191, 382789, -580894, 1067836, -583042, + -802085, 271120, 78920, 1187559, -242666, 952946, -63351, 112206, 116501, 736050, + 322123, -92879, 248571, -179852, 259309, -329639, -287763, 164819, -399969, 148176, + -118112, 27917, -224412, 146566, -10201, 32212, 312459, -126702, -85362, 380105, + -47245, -202937, 236223, 34360, -125628, -295816, -32212, 537, 21475, 82678, + 24696, -92342, -63888, 141734, -45634, -25770, + }, + { + 14457934, -80088792, -8420820, 9666361, -715112, -1202054, 263604, 1264868, -3977677, 896038, + 4773856, -1147293, 900869, 1063004, -5456219, 2279554, -614717, 4934918, -858993, -2240362, + 2220498, 2040110, 1501091, 1313723, -368293, 2185602, -1223529, 893890, -924492, -471373, + -2132988, -4572530, 4304631, 1619740, -1244467, 1532230, 2622078, 799938, -1548336, 1285806, + 58519, -1141924, -285078, 816581, -210453, -328028, -471373, -1534914, -243203, -799938, + -56908, -66572, 689879, -1010928, 306016, -175557, 1461900, -153545, 477278, -479963, + 16643, 177704, 101469, 605054, -350577, 164283, -143881, 338766, 69793, -380105, + -125628, -32749, -60130, 130997, 15569, 314069, -206695, -110595, 143345, -186294, + 233539, -57982, -136902, -91805, 63351, 32212, 10201, 133144, -191126, 17180, + -73014, -50466, -47245, -10201, 64961, 12348, + }, + { + -781684, 14994268, -1139240, -446677, 1393180, 374199, 748398, 2014877, -761283, -454193, + 409633, -1095217, -2719251, 27520002, 1722282, 4376035, -3626026, 2315524, 219580, 42413, + -5600101, 12728136, 1845225, -799938, -5583995, -2610266, 6768332, -4066797, 4612258, 2178085, + 1832877, 107911, -485331, -1492501, -497142, -1335735, -1037772, 437550, 993211, 1549946, + -137976, -1575716, 94489, 444529, -772557, 670552, -147640, 1894618, 852551, 256624, + 103079, 154619, 329639, -375273, 750546, 157303, 126165, 302258, 412854, -566936, + 430570, -777389, 84289, -140660, -653372, -23085, -79994, -133681, -224949, -247497, + 634581, 161598, -481573, 1611, 136365, -136902, 77846, -265214, -65498, -39728, + 126702, -291521, -75699, 139050, 204548, 134218, -53687, -9664, 16643, 537, + -26307, -34360, -7516, -210990, 10737, -142271, + }, + { + 10095858, -61251604, -3047816, -7119445, 6380174, -2416993, -2041183, -207232, 1449552, 2818572, + -1380832, 3906810, 1924145, -9157944, 6435472, -4035122, 2578591, -4014184, -2850785, 1934346, + 144418, -240518, 185757, 1529545, -299574, -261993, 607201, -364535, -775242, -1486059, + 2659659, -61740, -4094178, -430570, 1851668, -1595580, 1357210, -870805, 1664837, -346282, + 1081795, 1180579, -1153199, -1352915, 252329, 2681133, 580894, -2262374, 119185, -687732, + 108448, 501437, -1021665, 105764, -450435, -311385, 319438, 584116, -93952, -597000, + -1146219, 552977, -332323, 616328, -324270, 186294, 163209, -157303, -455267, -37044, + -43487, 22549, -375810, -190052, 435402, 96100, -457414, 280784, -315143, 49392, + -266288, -30065, -357556, 142271, 86973, 90731, 11811, -57982, 85362, -137976, + -49929, 76773, 179315, -93952, 32749, 36507, + }, + { + 159988, -1964948, -3563749, -1418950, -284542, -1133335, 261993, -789737, -1695975, -33823, + -2044941, 146029, -3715684, 15681462, -19787988, -1112933, -1056562, 1483911, -1643899, 1167157, + 1219234, -1049046, -2056216, 5641440, -2602750, -1703491, -3714610, 3062849, 2687039, -1303523, + -1323387, -2771328, 2263985, -1663226, -3053722, 2616172, 85899, 904628, 1633698, -1490891, + 1831804, -484794, -1716376, 1236414, 707059, -348429, 1886564, -1838783, 723165, -1098975, + -502511, -877784, -871878, 386010, -1176284, 689879, -150861, 171799, -120796, -247497, + 432181, -797790, 346819, -161061, 374736, -73551, 37581, 179852, 466004, -217433, + -594316, -89657, 580357, -435402, -216359, -74625, 44560, 212601, 156766, -43487, + -179315, 39728, -240518, 56908, -86973, 162135, 228170, -186294, 28454, -25770, + 86973, 29528, -90731, 49392, 45634, -48855, + }, + { + 1996086, -71708240, 1167694, -6324876, 5705327, 7199439, -1481227, 1217623, -535260, 793495, + 2319819, -1475321, 3708168, -8551280, -8589935, 4352950, 3608310, 404264, -1392106, -2327336, + 1220308, -1588601, -562104, -1142998, -2719788, 3277597, 154619, 2799782, -3169149, 2185602, + -527207, 695785, 351114, -3031173, 1056562, -2233920, -518617, 173946, -2078227, 237297, + -734439, 2148021, -754841, -1137630, 777389, 725313, 912144, 1505386, -130997, 161061, + 317828, 1357747, -162135, -413391, 710817, -301721, 519691, 49392, 730681, 333397, + -1190780, -273804, -1074, 226560, 306016, -324270, 572304, -41876, -486405, 198105, + -253403, -351650, 363998, 3758, 118648, 76236, -50466, 281857, 19327, -52076, + -175020, 197569, -236760, 70330, -30602, -147640, 16643, 95026, 42413, 87510, + 76773, 64961, 74625, -169651, -1074, 97174, + }, + }, + { + { + 1403917, 37110664, 10589242, -4982162, -1696512, 1072131, 460098, 1492501, -59056, -1861332, + -48318, -1622961, -1991254, -3741454, -7880728, -1059783, 1952600, 2552284, -2752537, -5737003, + -2306934, -2602213, 1265405, 646393, 2312303, -5231270, -526134, 2006287, 2809982, -3968550, + 2384781, 2397666, -775778, -1808181, -1388885, -154619, -157840, -3260417, -245350, 858993, + -273804, -1417876, 5906, 157303, -1571958, -429497, -639950, 701690, -112743, -23085, + 775778, -252329, -201327, -15569, 69256, -522375, -162135, -525060, -251256, 815507, + -91268, -19864, 354335, -200253, 3758, 205085, 226560, 479963, 39728, 71404, + -292595, 18254, 196495, 38655, -10737, -15569, 122943, 337155, 105764, -326418, + -118112, 147103, 62277, -161061, 30065, -114890, 31675, 92342, 141734, 23622, + 67109, -73014, -40802, 32212, 30065, -9127, + }, + { + 14842333, 23286238, -12345883, 5962489, -1513439, 803696, -839129, -1860258, -689879, 3614215, + 1233193, 5422396, 1103270, -1660005, -2739116, -2425583, 329102, -1807644, 110059, 1530082, + -1074, -287763, -779000, 2799782, 1011465, -515396, -307627, -563178, -878858, 1530619, + 34360, 1169305, 555661, 1229971, 1144609, -103079, 408022, 1333587, -847182, 205622, + 244813, -466004, -220117, 1018444, -64425, -1910187, -712965, 226023, -59056, -270046, + 814433, 1146219, 351650, 536334, 245350, -615254, -596464, -166967, 294742, 158914, + 452582, 64961, -494458, -246961, -5369, 31675, 100932, 56371, 96100, 127775, + -85899, 6979, -28991, -53150, -260382, 237297, 300648, 133681, 132070, 46708, + 17717, -30602, 174483, 73551, 74088, -164283, 42950, 135291, 175020, 103079, + -130997, -38655, 5369, -36507, 18254, 38118, + }, + { + -6492917, -125503776, -5133023, 8125542, 11622718, 1169305, -86436, -1352915, -680752, -2858838, + -2123861, 1608465, 3081639, 5093831, 1319629, 4886062, 1042066, 1110786, 4108136, 2727304, + -2965675, 436476, 598074, -2199023, -134755, 207769, 3694209, 2292976, 1554241, -697932, + 537, -1600412, -1083406, -2122788, -213675, -763430, 897648, -775242, -1021129, 252329, + 2194728, 553514, -82141, 449361, 441308, 143345, -94489, 697932, 719944, -142808, + -607738, -100395, 683437, 8590, -974421, -274878, 42413, 387084, -399969, 14496, + -777926, 465467, 62814, 494458, 312996, 274878, -231391, -62277, -282394, 58519, + 222801, 204011, 309238, 176094, 83752, -64961, 67109, 45634, 47782, 17180, + 135291, -1611, 210453, -46171, -283468, -97711, -22549, -49929, 104690, 4832, + -59593, 16106, -60130, -23622, -45097, -20938, + }, + { + 1349694, 9603010, 1471026, 1424319, 486405, 63351, 399432, -375810, -391916, 129923, + -1037772, -729608, 1739462, -3306588, -1104880, -2665564, 4680441, -272730, -4080756, 2362769, + -1840930, 1446330, 1955821, -2323041, 985158, -2806761, -652298, 448824, -611496, -751082, + 760746, 518080, -117575, -221728, 319438, -309775, 54761, 399432, 832150, 253940, + 434865, 392453, 646929, 79457, 1396938, 463856, -607738, -340913, -126702, 372052, + -1173063, -236223, 1311039, 182536, 329102, 39728, -241592, -53150, -83752, 92342, + -478352, -175557, -183073, 138513, -50466, -336618, -62277, 410706, -51003, -213675, + -353261, -103616, 60666, -219043, 255014, 201327, 117575, 28991, -13422, 152471, + -62277, -70330, 3221, -23085, 69256, -15569, 36507, -11811, -78920, -46708, + -41876, -4295, 11274, -34360, -53150, 89121, + }, + { + -5253282, 94073744, 3556770, -7298223, 161061, -183073, 388695, 518617, -1494649, -226560, + 1854352, -1759326, -2173254, 1582696, 8672613, 2289218, -4978404, -6058052, -847182, -2121714, + -146566, -157840, 472983, -1517197, -1672890, -2856690, 632434, 983548, -571768, 588411, + 661425, -638340, 1524177, -459025, -418222, -1948305, 972273, 1241246, 247497, -1048509, + -519154, -693100, -498216, -1234266, 1299765, -155693, -1024350, -360777, 6442, 1076963, + 1137630, 543850, -159451, 259309, 405874, 563178, -496606, -855235, 201863, 396748, + -712428, -221191, -128849, 143881, 159988, 346282, -406411, 177167, 363998, -48855, + -314069, -217433, 48318, 78383, 33823, -13422, 206695, -48855, 13959, 235149, + 128849, -4832, -48318, -165893, 47245, 13959, 105227, 92342, -139586, 158377, + -76236, 120796, -53687, 34360, -102542, 31139, + }, + { + 176094, 1187022, -834834, -1020592, 149250, -217433, 410706, -226023, -731755, -254477, + -373662, -1010928, -2332704, -3736085, 3716221, 3058554, 5523328, -4395899, -287763, -23507966, + -1006096, -3390877, -919123, -7809861, 162672, 1275068, -3180960, -2760053, 2644089, 1678259, + -1174674, 1948305, 1063541, -2684, 239444, -389768, -541166, 798327, 1017907, 869194, + 119185, -55835, 412854, 376347, 170725, 6442, -278099, 432718, 175020, 221191, + -477278, -224949, -243203, -431644, 340913, -877247, 121333, -192737, 51003, 522375, + 373662, 12348, -20938, 539018, 34897, -30065, -156229, 171262, -51003, -355409, + -242666, -13422, -237834, 31139, 38118, 497679, 164819, -50466, -392453, -98784, + -13959, 32212, 16106, -67646, 53150, 56908, 149787, 19864, 127238, 49929, + -39192, 130997, 114354, 14496, -29528, -8053, + }, + { + 31036508, 234309264, 27545772, 7573638, 2987150, 63351, -448287, -322659, 646393, 577136, + 854162, -730681, -2102387, -1633161, 752156, -1715839, -2601677, -895501, -1672890, -671089, + 575526, 86436, -441308, -441845, -368293, -41876, -767725, -115964, 23085, 63888, + 1225676, -1174137, 555125, -470836, -2742874, 478889, -77846, -278636, -1411434, -1132798, + 26307, 230318, 576599, -1266479, -668404, 1326071, 660351, -751082, -122407, -1174674, + -656593, -625455, -102005, 1147293, 685047, 485331, 335544, -666257, -100932, 239981, + 273267, 0, -424665, 223875, 190589, 386010, 187368, -379031, 105764, -2684, + -168041, 56908, -102542, -108448, 171262, 179852, 140660, 52076, 146029, 22012, + 69256, -22549, -12348, -81068, -83215, 235686, 46708, 17180, -16106, -53150, + -18254, -35433, -102542, 28991, 30602, 34897, + }, + { + -528818, 1207423, -3685619, 1983201, 682900, -376883, -146566, -599685, 584652, -81604, + -1014686, 1273995, 387084, 2252174, 9578851, 564251, -1925756, -3557307, 2935610, 4515085, + 246961, 1351841, -3058017, -769336, -2046552, 1508607, 5450314, 5255966, -1801739, -2820183, + 2762201, 1868848, -1336272, 230854, 294742, -409633, 637803, -267362, 750009, -353261, + -703301, -511101, -315143, -904628, -624918, -245887, 162135, 135291, 1078037, 964757, + -594316, 906775, 617402, 431107, 344134, 889058, 459562, -266825, -446677, -200790, + 518617, 108448, -354335, -74088, -390305, -311922, 91805, -63888, -306553, 208843, + -160524, -279173, -344671, 71404, -161061, -295816, 81068, 71941, -97711, -42413, + -130460, 64425, 15032, -128849, 145492, 11811, 38655, 2684, 108985, 4832, + -73014, -2684, -42413, -5906, -42413, -71941, + }, + { + -30771830, -36411124, -1203128, 10679436, 187905, -95563, -3057480, -1446867, 83215, 1491427, + 1274532, 711891, 1493575, -3321620, 2617783, 2249489, -310848, -1745367, -2409477, -381178, + 403190, 835371, -1252520, 528818, -862215, -1301912, -107911, -350040, -332860, 1789391, + 428960, 476741, 1276679, 615254, -643708, 1512902, -683437, 697932, 488016, -602906, + -2778307, 1746441, -755914, -1268089, -685584, 151934, 1194538, -722628, -1190243, 100932, + 687732, -450972, 357019, -545998, -13959, -37044, -498216, 179315, -630286, -482110, + -638876, 97711, -233539, -122943, -482647, -286689, 156229, 233002, 84826, 82678, + -274341, -264677, -40802, -410169, -16106, 34360, 220117, -71941, -149250, -201327, + 110595, -118648, -120259, -35433, -150861, 48318, 91805, 98247, 24159, 96637, + 33823, 13422, 60130, -29528, 57982, -537, + }, + { + 1624571, 16567836, 3128884, -1225676, -998580, -864362, -4284767, -1200980, 272194, -698469, + 569083, -2855617, 752156, 1810866, -5747740, 2021319, 1318555, 4310000, 5777268, 1166084, + -1896765, 897648, 196495, -678068, 2196339, 189515, -273804, -1888712, 676994, -1140851, + 1560147, -2200634, 1631014, 170725, 351650, 889595, 1636383, 640487, 1864016, 805306, + 1004486, 1777580, 1819456, -626528, -17180, -211527, 133681, 213675, 75162, 145492, + -396211, 200253, 534723, 981937, -263067, 525060, 553514, 96637, 377957, 501437, + 44560, 242129, -78920, 33823, -291521, -344671, -134218, 32749, 102005, -42413, + 163746, -234076, -212064, 31675, -18254, 38655, 176094, -117575, -108985, 25233, + -4832, -16106, 146029, -55298, -63888, -52613, -139050, -68719, -61740, 76773, + 27917, -26844, -10201, 43487, 19864, 5369, + }, + { + -13258564, -51739860, 3250753, -594316, 3000572, -1516124, 2423435, 421444, -718333, -630286, + 921807, 2702071, 738734, 118648, -791348, -1496259, 5464809, 1983201, -2029372, 996432, + 772020, 810675, 1838246, 804233, 1054951, 787590, 231928, -624918, 156229, -1795296, + -1357210, -2032056, 1161252, 1408749, 295816, 1401770, 820876, 249108, -587337, 1677185, + -54761, -186294, -665183, 502511, -632434, -607738, -217970, -832150, -628139, -541166, + 134218, -112206, 158914, -658204, -19327, -96100, 274341, 935766, 160524, 3758, + -14496, -109522, 214212, 248034, -86973, -35433, 16106, -40265, 191126, -260382, + 22549, -213138, 40265, 232465, 108448, 209917, -195421, -5906, 86436, -25233, + 63888, 140123, -212601, 64425, -61740, 59056, 28991, 13959, -70867, 54761, + -73014, -13422, -89657, -57445, 93952, 25233, + }, + { + 471910, 11603928, 1903744, -591632, 1787780, 345208, 603980, 862215, -19327, 100395, + -177704, 842350, 7575786, 9833864, 4037806, 62277, 700080, 2267206, -374736, -2784750, + -682900, 7953743, 1904281, -126702, -1466731, -2180233, 1279363, 2368675, 2552284, 3952444, + 745177, -406411, -1432372, -715112, -934155, -808528, -423591, 18254, 346819, 1705102, + 380641, -1036698, -457951, 484794, 286152, -382789, -28454, 1677722, -495532, 987306, + 643171, 2684, 296353, 230318, 292058, 164819, 69256, -167504, -170725, -66035, + -509491, 57982, -66035, -218506, -564251, -124554, -226023, -316217, -183073, 105764, + 428960, 99858, -145492, 162135, -160524, 75699, -30602, -137976, -116501, -85899, + 24696, -112206, -26844, 87510, 66035, 59593, -35433, 12885, -15569, -60130, + 34897, -3758, -95026, -64961, -64961, -77309, + }, + { + -11075110, -36239324, -5211406, 2196339, -478352, 2046015, 3609383, -310848, -361314, 2253247, + 1938641, -862215, -3469260, 4701916, 5395553, -1907502, 151398, -2544768, -3167002, 1473174, + 1192390, -708133, -413927, -329639, 679142, 535797, 1288490, 25233, -1124208, -823560, + 2789581, -1728188, -1055488, -853088, 1168231, 307090, -910533, -412854, 1930051, 1164473, + 118112, 133681, -102005, -2317135, -1025960, 1408212, -38655, -967441, -443455, -532039, + -49929, -102542, -72478, 149250, 542240, -463320, -152471, 180389, 17180, 73551, + -592169, -230318, 256624, -18254, -133681, -91268, -11274, -73014, -136902, 79457, + -204548, 24159, -140123, 113817, 230318, 98247, -345208, -76773, 114890, 107911, + -326418, 3221, -272730, 64961, 129923, 45097, -125091, -85362, -88584, -94489, + 26844, -41339, 149787, -23085, 79457, 114890, + }, + { + -255014, -1735704, -3607773, -2685428, 1270237, -559420, -1273458, 597537, -877247, -308701, + -1820529, -1614371, -2647847, -12281996, 30106110, -2981244, -3222299, 1498944, -2335925, -2141578, + 286689, 1094680, 2455648, 676457, -67646, -3561065, -1517197, 3252364, 2516314, -1832877, + -1391569, -569083, 99321, -770410, -1613834, 92879, 915902, 517007, 1261110, 6442, + -318364, -362925, 215285, 904091, -317291, 184684, 1017907, -307090, -363998, -820339, + -513249, -175557, -514322, -693100, -216359, -259309, -224949, 608275, -489626, -151934, + 294742, -270046, -164819, 66035, 360240, 115427, 88047, 233539, -14496, 21475, + -209380, 79457, 13959, 27380, -192200, 48318, -133681, 185220, -21475, -33286, + 1611, -134218, -175557, 1074, 30065, 28454, 33823, -59056, -43487, -66572, + 90731, 86436, -33286, 16106, 82678, -88047, + }, + { + -8037495, -48314624, -6953552, -1264331, 3590593, 6452115, 4220342, 1413581, -2535641, -983548, + 1483374, 4555887, 1238024, 1410360, -19333796, 2241436, 7215008, 450435, -1532230, -913217, + -75162, -389231, -873489, -1030792, -435939, 631897, 171799, 2996814, 108448, -1117228, + 24159, 1509144, 428960, -2487323, -563714, -1607392, -766115, -934692, -238908, -971736, + -284005, 925565, -456340, -871342, 501974, 485331, 715649, 843961, 731755, -119722, + 823023, 358630, 560493, 513785, 260919, -32749, 195421, 493384, 552977, -216896, + -601832, -304943, -229244, 172872, 352187, -8053, -537, -36507, -283468, -57445, + -194347, -285078, 108985, 311385, 175020, -183610, 275415, 127775, -133681, 67646, + -102542, 129923, -194347, -7516, -44023, -16106, -7516, 136902, 53150, 87510, + 151934, 32749, -27917, -73551, 101469, 13959, + }, + }, + { + { + 305480, 6346351, -7530152, -746251, 881542, -139050, -550830, 329102, 115427, -1498944, + 235686, -69793, -608275, 17717, -1053878, 607201, -1216013, 927713, 8053, -302795, + 1327682, 2057289, 1717450, -76236, 3436511, -3644280, -1118839, 377420, 1151588, -3705483, + 3320010, 1268089, -1811403, -1158031, -830002, 714575, 1228361, -1597728, 770410, 220654, + -5369, -275415, -166430, 357019, -264677, 462783, -620623, 504659, 2684, -517544, + 245350, -394063, 7516, 150324, 371515, -196495, 70867, -343597, -252866, -9127, + -500901, 346819, 434329, -55298, 79994, 177167, -25233, 206158, -153008, 164819, + -42413, -37044, 144955, -157840, -57445, 33286, -6979, 124554, 180926, -70867, + 42950, 46171, 5906, -28991, 228707, 15032, -28454, 4832, 36507, -13959, + 32212, 1611, 31675, 64425, -1611, -60666, + }, + { + -10881300, 16073378, 5801427, 3248606, -2984466, -1184337, 674847, -282931, -1864553, 790811, + -2845953, 1927904, 1035624, -244813, 1048509, -1133335, -2854543, 1759863, 5828271, -1169305, + -938450, 648003, -2310693, 1315871, 570694, 543313, 328565, -1047972, -925029, 807454, + -402116, 1246077, 188442, 398358, 125091, 846109, -1297617, -77846, -1042603, 352187, + -620086, -675921, 5369, 855772, 382789, 195421, -203474, 185220, -231391, -31139, + 585189, -199716, -157303, -193274, 19327, -28454, -289373, 316754, -68719, -281320, + 39192, 290984, -67109, 51540, 134755, -210453, -77846, 209917, 75162, 64425, + -85899, 292595, -83752, -47245, 23622, 52076, 96637, 99858, 108985, -115964, + -112206, 55835, 21475, -42413, -1074, -73014, -56371, 68719, -55835, 77846, + -85362, -4832, 4832, -14496, -42950, -30065, + }, + { + 3521873, -80752904, 15613280, -8490613, 1575179, 246424, 28454, -231391, -442919, -18790, + 410706, 219043, 641561, 2076080, -3054796, 542777, -3421478, -907312, 2955474, 2183454, + -1739999, 1130113, 1257889, -949188, 2099165, 670015, 2176475, 1150514, -1496259, -2498060, + 832150, 1236414, 1013612, -37044, -375810, -1300301, 919123, -1015223, -370978, -138513, + 490700, 25770, -234613, -11274, 92879, 838056, -175557, 340913, 74088, 324807, + 148176, -42950, 54224, 332323, -113817, 25233, 81068, 230318, -326418, 237297, + -662499, 204548, -238371, 162672, -54224, 229781, 27917, -41876, -191126, 36507, + -34360, -155156, 85362, 54224, 144418, -163746, -41339, 133144, 195958, -71941, + 83752, 76236, 73551, 61740, -101469, -82141, -57445, -50466, 79994, 45634, + -96100, 62814, -33823, 25770, -36507, 8053, + }, + { + -767725, 5258114, -254477, 188979, -62277, -285615, 281320, 202937, -259846, 91805, + -161598, -656593, 1764695, -3255048, -2224793, -3315178, 45634, 1101122, -1747515, 1138703, + 110595, -239981, 1322850, -863288, 823560, -1993402, -260919, 1418413, 887448, 463856, + -285078, 715649, 674847, 462783, 546535, -118112, 358093, -871342, 194884, 678605, + 461709, 6979, 781684, -56371, 114890, -50466, 149787, -357556, -345208, 912144, + -296353, -389231, 637266, -418759, -206695, -537, -93952, -220117, 98247, 175557, + -337155, -37581, -162135, -170188, -83752, 11274, -150324, 17180, -148713, 104153, + -71941, -188442, 13422, -17180, 208306, -99321, 11274, 17717, 82141, 79994, + -12885, 16106, 71404, 33823, 70330, 8053, -43487, -52613, 3758, -7516, + -30065, -26844, 10201, 41876, -32749, 77846, + }, + { + -5119601, 75573168, -2239826, -4701916, -383863, 154619, 257698, 1379221, 456340, -32212, + -762357, -2098629, 157303, -204548, 2635499, 676994, 1887101, 452582, -433255, -1085016, + 790811, 727460, 55835, -921807, -1674500, -484258, 645856, 1082869, -1470489, -392990, + 615791, -824097, 212064, 1611, 1123671, -1418413, -550830, -99858, 204548, 405874, + -434865, -867583, 88047, -172872, 1209033, -69256, 438087, 134218, -324807, 429497, + 427886, -311922, -380105, 631360, 231928, -12348, -137976, 88047, 97711, -48318, + -147103, 113280, -79994, 214748, -89657, 186294, -354872, -123480, -68183, -143345, + -27380, -50466, -70330, -182536, -57445, 33823, -47245, 79994, 16643, 9127, + 74625, 18790, -155156, -20938, 44560, -83752, 30065, 35970, -104690, 91268, + -84826, 51003, -41876, 40265, -70867, 54761, + }, + { + -375810, 1986959, 3567507, 220654, -309238, -341987, 95026, -67646, -520228, 81604, + 584116, -244276, -493384, -1735704, 499827, -2034741, 4949950, -2018098, 3482682, -17820894, + 3169149, -1665374, 2888366, -638876, 1678259, 532576, 869731, -388695, -230318, -893353, + -776852, 805843, -1949915, -657130, 529355, 313533, 603980, 720481, 154082, -177167, + -461709, 37044, -954020, -365609, -139586, 350040, 128849, 417686, -36507, -103616, + -245887, -282394, 158377, -314069, -33823, -126165, 436476, -375810, 105764, 125628, + 97711, -122407, -213675, 268435, -197032, -24696, -71404, -38118, -103079, -78383, + -105227, 233539, 47245, 12348, -164819, 146029, 31139, 86973, -140123, 91268, + -119185, 37581, -40265, -32212, 9664, -50466, 18254, -33286, -5369, 65498, + -66035, -33823, -56371, 12348, -16643, -4295, + }, + { + -32202592, 102693744, -7697119, 2495913, 232465, 300111, -256087, 467615, 1060857, -216359, + 75699, -479963, -1318018, -1198833, -99858, 483184, -746251, 353798, 875636, -42413, + 485868, 183610, 223338, 295279, -302795, 372052, -89657, 274878, -59593, -1156957, + 182536, -1723893, -83215, 589484, -365072, 2271501, -9664, -690953, -727997, 62814, + 64961, -762894, 1096827, -554051, -615254, 1232119, 44560, -1130650, 323733, -56908, + 51540, -338229, -618475, 478352, 1611, -462246, 186294, -284542, -7516, 277025, + 87510, 90731, -251792, 35433, -55298, 57445, 115427, 13959, -23085, 113817, + 177167, -18254, -173409, 96637, 166967, 41876, -71941, -87510, 24696, -68183, + 152471, -21475, 14496, 73014, -28991, 32212, -41876, 81068, 8053, -40802, + -13422, -11274, -68719, 55835, -27380, 3221, + }, + { + -454193, 4632659, -1199907, 535797, 539018, -273267, 532576, -110059, -38118, 328028, + -404264, 475131, -1398549, -972810, 1852742, -2989297, -1139240, -3582540, 1111860, 2581812, + -1488206, -1589675, -1160715, 913754, -860067, 2005750, 677531, 789200, -1272921, -1516660, + 1750736, 874563, -1823214, 131533, 184684, -717796, 1068373, 154619, 407485, -318364, + -599685, -363462, 475131, -273804, -274341, 77846, -61203, 639950, 399432, 146566, + -557809, 780073, -53687, -233539, -199716, 154619, 31139, 33823, 230854, -82678, + 207769, -20401, -28454, 196495, 45097, -163746, -188442, -63351, 43487, 3758, + -17717, 174483, -112206, 114890, -133144, -151398, 11274, 85362, -43487, 5369, + 88584, -57982, 21475, -192737, -14496, -26844, -17717, 62277, 3758, -56371, + 22012, -16643, -35970, 2684, -9127, 33286, + }, + { + 19002010, 24812562, -7639673, 5693516, -795643, 735513, -625455, 304943, -660888, 466541, + 287226, -1838783, -134218, -5144297, 3506841, -389231, -419833, 1979980, -952946, -387621, + 794032, 931471, -2003602, 1479079, 598611, -534723, 807454, 948651, -562104, 924492, + -383863, -66572, 732292, 588947, -816581, 728534, -687732, -34360, 115427, 561030, + -2587718, 1258425, -141734, -762894, -349503, -972810, 600759, 836982, -24696, -535260, + 26844, -455803, 561567, -277562, 417686, 617402, -341987, 40802, -217433, 169651, + -369367, 181462, -241055, 15032, -165356, -310311, 139050, 318901, 6442, -98247, + -122943, 44023, 153008, -205085, 108985, 228170, 10737, -3221, 63351, 15032, + 46708, -66035, 32749, 49929, -79457, -83752, -38655, 109522, 23622, 49392, + 38118, -9664, 13422, -127775, 112206, 1611, + }, + { + -1211718, 9880035, -2486786, 873489, 469762, 845035, 3007014, 780610, 9664, -253940, + 2488397, -722628, 854699, 519154, -6765111, 2664490, -2081449, 702227, 2348810, 959388, + -496069, 2093797, -1486596, -1476395, 481036, -59056, -379568, -997506, 149787, -1810329, + 2940979, -2331630, 446677, -92342, 19864, 270583, -57982, -542240, 1348083, -140660, + -60666, 92879, 741956, -461172, -333397, 216359, 39192, 673236, -92879, -418222, + -161598, 147103, -32212, 279173, -234076, 40802, 280247, -256087, -153545, 120259, + -85899, 11811, -191663, -47245, -12348, -43487, -30065, -17180, 25770, 125091, + 261456, -102005, 0, -121333, -24696, 87510, 42950, -82678, -29528, -70867, + 37044, 0, 78383, -13959, 42413, 51003, -56371, -18254, -11811, 6442, + 35970, -30602, -537, 1074, 39728, 33823, + }, + { + 10682657, -21609592, -91805, -3577708, 670552, -3440269, 2386391, 952946, 883690, -7516, + -245350, 1495186, 216896, -49392, 1614908, 1324461, 7248831, 2272575, -1137093, 470836, + -69793, -228170, 635655, -855772, 967441, -26307, 923418, -942208, -819265, -427349, + 711354, -18254, -7516, -139050, 435939, 915365, -518080, 646393, -5369, 921807, + -44560, 948114, -506269, 699543, -38655, 151398, 255014, -30602, 432718, -391916, + 125091, -415001, -6442, 132070, 116501, -246424, -370441, 326418, 207769, 97174, + -4295, 131533, 95026, -26844, 39728, 90731, 62814, 32749, 193274, -19864, + 136365, -183610, -53150, 152471, 14496, 3758, -75162, 74625, -6442, 22012, + -26307, 98247, -70867, 2147, 16106, 1611, 28991, 3221, -2147, 31675, + -55835, 34897, -8590, -30602, -9127, 537, + }, + { + -77309, 7307350, -1993939, -1846299, 832687, 773094, -246424, -164283, 98247, 745177, + 138513, 1266479, -334471, -5185636, 2856153, -727460, -930934, -202400, 26844, -1478543, + -1865626, -293132, 310848, 1057099, 995359, -277562, -754304, 1309428, 291521, 1246614, + 587874, -1135482, -44023, 362388, -258772, -370441, 229244, -187368, -74088, 641561, + 379031, -306553, -443992, 540629, 250182, -548145, -486405, 363462, -953483, 205622, + 126702, 60666, 214748, 226560, -39192, 27917, 150861, -239981, -529355, 70867, + -638340, 256624, 310311, 191126, -420907, -117038, 168041, -208843, -86973, -145492, + -80531, -152471, -82678, 206158, -191126, 98247, 99858, 27917, 29528, 26844, + -53150, 1074, 23085, -26307, -71941, 4832, -34360, -46708, 30065, -58519, + -34897, -13422, -1074, 64425, -49929, 5369, + }, + { + 7370701, -3212099, 1044751, 5448166, -3420942, 631897, 4619238, -954020, 198642, -319438, + 60130, -1021129, 773631, 10921028, 2946348, -2451353, 183073, -162672, -721018, 194347, + 1779727, -852551, -905164, -555661, 532039, -1103270, -521302, -308164, 668404, 481573, + 1505923, -1130113, 1272384, -214748, -412317, -352724, 296890, 80531, 491237, 296353, + -791348, 48318, 433792, -1139240, -1093606, 396211, -332860, -127775, -244813, -147103, + 377957, 42413, 205085, 175020, 608812, 75699, -212064, 86973, 17717, 61203, + 70330, -31139, 415001, -129923, 162672, 168577, -104690, 24696, 63888, 181462, + -8590, 74625, 17180, 133681, -102005, -22012, -95026, -133681, 77846, 92342, + 19864, 148713, -124554, -39192, -30602, 97711, -49929, -89121, -16643, 1074, + 74088, -5369, 67109, 32212, 4295, 46708, + }, + { + 295816, 2328409, 297963, -1358283, 1501091, 15569, -517007, -159988, -499290, 381715, + -446677, 1385664, -1968169, -7023882, 41564548, -1389959, -2415382, -105764, -1286343, -2328409, + -3640522, -1763621, 1807108, 171799, 877247, -2399276, 905164, 59593, 290984, -265214, + 86973, 1105417, 700080, 1074, 429497, 27917, 945430, 15032, -241592, 498753, + -369367, -50466, 477278, 89121, -467615, 252329, 312459, 209917, -158914, -95563, + -106837, 324807, -55298, -499827, 386547, 358093, -326418, 334471, -415538, -15569, + 302258, -82141, -147103, -93416, 73014, 22012, -338766, -57982, -28454, 37044, + 32212, 206695, -137439, 349503, 20938, 8590, -46171, 33823, -62277, -25770, + 51540, 53687, -39192, -11811, 49392, -62814, -44560, -90731, 96637, -52076, + 59056, 61740, -2684, -25770, 51540, -34360, + }, + { + 8680129, -18975166, 1437740, 5306432, 765578, -727997, 2700998, 2150168, -938987, -366146, + -409633, 4622459, -1633698, 4973036, -11111080, -871878, 2810519, -276489, 762894, 704912, + -195421, 18254, 568009, -202400, 54761, 612570, -1054951, 796180, -718333, -1796370, + -267362, 388695, 68719, -1083406, 601832, -15032, 226023, -576599, 418222, -184147, + 37044, -28991, -363998, -689342, -41876, 197032, -318901, -383326, 581431, -93416, + 497679, -521302, -154619, 335544, 273804, 56371, -73551, 273804, 449898, -253403, + -48318, 205085, -96100, -37044, 95563, -110595, -99858, -53687, -183073, -15569, + -11811, -72478, 37044, 100395, 156229, -91805, 111132, -63351, -73551, 89121, + -96637, 96100, -74088, -10201, -70330, 20938, 55298, 5369, 70867, -27380, + 59056, 1611, -67109, -11811, 61203, 2147, + }, + }, + { + { + -1592359, -9451612, 4553202, 1876901, 469225, -918586, -628139, -422517, 360777, -914291, + -700617, 503048, 280784, 479963, 194884, 1110786, -1953673, 602906, 1215476, -179852, + 1707250, 344134, 787590, 2097555, 35433, 186294, -1248762, -374199, -1345399, -1088774, + 1310502, 1119913, -2111513, -551903, -162672, -98247, 250182, 368293, 1228898, -202400, + 153545, -76773, -68719, -52613, 468688, 116501, 116501, 164819, -376883, -62277, + 173946, -353798, -249108, -37581, -86973, 277025, -1611, 60666, 30602, -540092, + -121870, 102005, 93416, 242129, 537, 88584, -42413, 10737, -128312, -18254, + 122407, 33823, 26844, -95563, -81068, 119185, 15032, 6442, -34897, 50466, + 42413, -1074, -55835, 18790, 76773, 48855, -3221, -24696, 26307, 62814, + 10737, -16106, 44023, 54224, 1074, -5369, + }, + { + 9361418, 6491306, -7888781, -424665, 1214402, -634045, 521302, 193810, 192200, -1563368, + -945967, 277025, 220654, 291521, 1282585, -1212255, -607738, 3354370, 2498597, -127775, + -957778, 292595, -950798, 386010, 331786, -209917, 406948, -571231, -541166, -277562, + 815507, 562104, -120796, 500901, -493384, 1381369, -937377, -1093069, 325344, 325881, + -817654, 76236, -149250, 104690, 503048, 346819, 450972, -121333, 260382, -100395, + 357019, -440234, -387621, -207769, -39728, -84826, -82678, 221191, -340376, -181462, + -100932, 61203, 134218, 55298, 20938, 5906, -49392, -23622, 61203, -8590, + 2147, 183610, -8590, -221728, 189515, 91805, -3758, 182536, -16106, -103616, + -10201, -23085, -70330, -24696, -24159, 52613, -47782, -9664, -6442, -29528, + -31139, -46708, -5369, -23085, -8590, -22549, + }, + { + 659814, -51977156, -237297, -12111808, -1312649, 772557, -555661, -10201, -201327, 1392106, + 453656, 1569274, -1017370, 1175210, -748398, -911070, -3328063, 445603, 1612760, -619012, + 1330366, -868657, 568546, 49392, 2351495, 1166621, 688269, 418759, -1743220, -886374, + 998043, 1369558, 758062, 530965, -446677, -811749, 900869, -1479079, -478352, -52076, + 606127, -600759, -236760, -151398, -354335, 852551, 445603, -179852, -265214, 485331, + 131533, 236760, -384936, 264677, 394063, -111132, -409633, 13959, 148713, -59593, + -315680, -175020, 54224, -183610, -208843, 168577, 33286, 20938, -107374, -25770, + -129386, -198105, 75699, 74088, 29528, -120259, -17180, 108985, 133144, 42950, + 67109, 27380, -23622, 57982, 54761, -68719, 537, 19864, 29528, 41339, + -62277, 12348, -8053, -9127, -34360, 37044, + }, + { + 486405, 3877819, -85899, -751082, -51003, 35433, 34360, 33286, 66572, 64961, + 22012, 83215, 267362, -2218888, -5338645, 3047816, -867047, -2003065, 1782411, 802085, + 32749, 457951, 825171, -147103, -1672890, -435939, 293132, 899796, 386010, 669478, + 68183, 857920, 520228, 178241, 509491, 321049, 210990, -1016834, -307090, 680752, + 399969, 380641, 47245, 80531, -8590, -235149, 239981, -406948, -11274, 202400, + 536871, -289910, -55835, -95563, -397284, -17180, 43487, -192737, -35970, 321049, + -133681, 81068, -13422, -332323, -162672, 163746, -46708, -246424, -86436, 57445, + 88047, 18790, -49392, 48318, 67646, -38655, -51003, -38118, 42413, 42950, + 25233, 41339, 22012, 69256, 47245, 72478, -52613, -60130, 5906, -56371, + 26844, -20938, -23085, 3758, 537, -19864, + }, + { + 11330661, 46231028, 3159485, -2139968, -50466, -81604, 179852, 1054951, 1006633, -64961, + -1938104, -1770063, 355409, -555125, 2949569, 596464, -1093069, 4179003, 963683, -137439, + 456340, 944893, -1183800, 94489, -485868, -551366, 929324, -742493, -475131, -399432, + 470836, 209917, -150324, -439697, 222801, -528818, 561567, -130460, 417686, 457951, + 124554, -825171, -483184, 949188, 187905, 113280, 454193, -257161, 35970, 332860, + -282394, -197569, -153008, 564788, -199179, -215285, 176094, 297963, -138513, -41339, + 104690, 89657, -303332, 232465, -91268, -68719, 97711, -203474, -200790, -214212, + 59056, -4832, 73014, -148176, -108985, 71941, -127775, 108985, -12885, -50466, + 0, 13422, -135291, 34897, 44560, -53150, -25233, 73551, -57982, 3758, + 2684, -6442, 7516, 28991, -28991, 18790, + }, + { + -44560, 3015067, 1247151, 255014, -159451, 21475, -360777, -97174, -375273, 249108, + 175020, 95026, 363998, -421444, 1371168, -238371, 162672, 1072131, -1288490, -14586783, + 2899103, 406411, 672162, 3294777, 498753, 532039, 1084479, -1035087, 227633, -1643899, + 619549, -354335, -1239098, -1065689, 657130, 57982, 599685, 222265, 374736, -193274, + -475131, 22549, -1089311, -306016, -409633, 181462, 2147, 403190, 294742, -468151, + 173409, -573378, 292058, -49392, -102005, 69256, -115964, 28454, -79457, 27380, + 200253, -178778, 11274, 104153, -235686, -2684, 66035, -24159, -4832, 93952, + -15032, 25233, 114890, -60666, -102005, 13959, -62277, -27917, 21475, 13422, + -79994, 17717, -16643, -13959, 44560, -24696, -45634, -32749, -38655, -35433, + 76236, -22549, -109522, -24159, -15032, -22012, + }, + { + 24787330, 7007239, 28991, 3714610, 9664, -84289, 259846, 355945, 47782, -235149, + 464930, -68719, -715112, -342524, -1153199, 461709, -313533, 400506, 826781, 398358, + 525060, 587337, 541703, 158914, -548682, 398895, -450972, 333397, 221191, -722091, + -392990, -1234803, -306016, 158914, 263067, 754841, 867047, -1180042, -137439, 361851, + 61203, -508417, 61740, 334471, -3221, 236223, 298500, -667867, 432181, 151934, + -31139, -264677, -184684, 122407, -31675, -590021, -93416, -11274, -45634, -23085, + 78383, 75699, -82678, 11274, 12348, -197032, -109522, 198642, -20938, 142808, + 53687, 203474, -168041, -54761, 161061, 46171, -34360, -115427, 21475, 20401, + 80531, -13422, -49392, 7516, 45634, -67646, -19864, 86973, 63351, -3758, + -43487, -22012, 29528, 54224, 7516, -39192, + }, + { + 339839, 273267, 844498, -431644, 498753, 129923, 166430, 386010, -507343, -85899, + 199716, 346819, -810138, -750009, -2724083, 304406, 349503, 1256278, -798864, 926102, + -1229434, -416612, 1129040, -197032, -455267, 1396938, 857383, -1255204, -1835562, 1094143, + -825171, 519154, -839129, -282394, 473520, -176094, -382252, 984084, 165893, -426276, + -419833, -273267, 234076, 352724, -213675, 238908, -365609, 693637, 483721, -537, + -175020, 45634, 154082, -187368, -264677, -317828, -319975, 363462, 321586, -35433, + 78920, -133144, 325344, -108448, 73014, -17180, -110595, -13422, 137976, -104690, + 11274, 35970, -6979, 180926, -133144, -107374, -2684, -35433, -63888, -31675, + 75162, 25233, 2684, -45634, -125628, 4295, -29528, -537, -19864, -64961, + 11274, -18790, -53150, 6442, 7516, 30602, + }, + { + -6716792, 54621248, 550293, 2072859, 1233193, -461172, 217970, 231928, -48318, -170725, + -653372, 14496, -242129, -2335925, 913217, -386010, 374199, 919123, -394063, -695248, + 358630, 532576, -86436, 465467, 543313, -233002, 169114, 1806034, -862215, -159988, + -91268, 572841, -512712, 294205, -395674, 202937, 758599, 439697, -1132261, 144418, + -1063541, 269509, -595390, -193274, 0, -740345, -665183, 934155, 660888, -105227, + -501437, -506269, 318901, 136902, 208843, 467078, 54224, -10201, 100395, 106837, + -210990, -3758, -43487, -181999, 96100, 9664, 45634, 29528, 47782, -37581, + -30065, 32749, 19864, -14496, 133681, 137439, 19864, -10737, 69793, 92342, + -40265, -5906, 62277, 77846, 21475, -48318, -48855, 40265, -37581, 27380, + 30065, -8053, 4832, -67646, 21475, 19864, + }, + { + 808528, 4656282, -4347581, 1599875, 2913062, -433255, 4104378, 1075352, 141197, 830539, + 842887, 444529, 349503, 712965, -5222144, 414464, -957241, 985695, -1704028, 3048890, + 890669, 1569274, -1088237, -1227824, -874563, -171262, -761283, 178241, -163746, -940061, + 971200, 361314, -807991, -65498, 22012, 339839, -1132798, -292595, 170188, -5906, + 256624, -457951, -242129, 351114, -233002, 250719, 16643, 257698, 149787, -169114, + -366683, 285615, -144955, -316217, 298500, 10737, -115964, -142271, -252329, -40802, + 58519, -197032, 118112, -75162, 69256, 183073, -63351, -98784, -95026, 71941, + 177167, -11811, 86436, -52076, -18790, 22012, 92879, -41876, 103079, -11274, + 100932, 12885, 3758, -12885, 5369, -48855, 37581, 10737, 17717, -10201, + 12348, -19864, -16643, 0, 6442, 12885, + }, + { + -7719667, -3549254, 3990562, 972273, -1598265, -400506, -4064650, 1333587, 854162, 1148367, + 662499, -25770, 396748, -348966, 1177358, 4051765, 2984466, 1559610, 2165201, -710817, + -767725, 130460, 129923, -837519, 188979, -27917, 379031, 180389, -878321, -354335, + 630823, 844498, -374199, -1032403, 1227824, 123480, -30602, 687195, 760209, -389231, + 144418, 467615, 375810, 616865, 146029, 193274, 56908, 103616, 369367, -257161, + 26844, -91268, -253403, 67109, 279173, -159988, -55298, -84826, 236760, 220117, + -72478, 136902, -15569, 76773, 78383, 105227, 99858, 122943, 6979, 12885, + 148176, -59593, -98247, -24696, -55835, -95563, -85362, 94489, 69793, -44023, + 19327, 17180, 3221, -72478, 34897, -22549, -27917, 20938, 26307, 9127, + -44560, -537, 31139, 24696, -51003, -25770, + }, + { + -207769, 5609228, -384936, -2792803, 271120, 991064, -96100, -252329, 128849, -259309, + 74625, 994822, -1426466, -2398739, 2427194, -996969, 454193, -2894808, 886911, -905701, + -1615982, -2022930, 555125, 534723, -452582, 1563368, 605590, 312996, 596464, -541703, + 399432, -678605, 366146, 151934, 19327, -410169, 294205, -60666, 25233, -176631, + 134218, 28454, 102542, 279710, -399969, 150324, -216896, -336081, -264677, -259846, + -323196, 332860, 101469, 193810, -5906, 5906, 151934, 89121, -212064, -537, + -315143, 132607, 141197, 162135, 3221, -175020, 85899, 34360, -93416, -115964, + -279710, -136365, -77846, -19327, -32749, -13422, 47782, 10201, 40802, 78383, + -44023, 18790, 65498, -15032, -31139, -8590, 13422, -9664, -18254, -32212, + -46708, -19327, 42413, 7516, -17717, 3221, + }, + { + -2035278, 14867566, 2729989, -1146756, -2286533, 73551, 1779727, 28991, 371515, -901943, + -159451, -792958, 2639258, 8155069, 853625, -802085, -738734, 912681, 537, -790811, + 785979, -185220, -210990, -368293, -641024, -1664837, 287226, -1591285, 469225, 1197759, + 553514, -502511, 856846, 363998, -116501, -827855, 573915, 303869, -50466, 322659, + -822486, 97174, -193810, 226560, -111132, 153545, 110595, -78920, -164819, 379031, + 215285, -373125, 294742, 183073, 101469, 307090, -280247, -1611, 88584, -68719, + -19864, 30065, 223875, 20401, 229781, 218506, -8053, 141734, -2147, 126165, + 22549, 92879, 19327, -140123, -56371, -46708, 23085, -112743, -66572, -17717, + 140123, 99858, 8053, -119185, -118112, 67646, 30602, 51003, 5906, 45097, + 44560, 79994, -46171, 27380, -23085, -20938, + }, + { + -26844, 2464238, 1553704, 489626, -215822, 676457, -24159, -733366, -649077, 617938, + 89121, 545461, -676994, 11872363, 7258495, 578210, -79457, -1538135, 2134062, -2770254, + -5230734, -1147830, 690953, 1458678, -788663, -1496259, 1120987, -514859, -220654, -1149978, + 1769527, 260919, 487479, 569620, 894964, 678605, 582505, -229781, 42950, 185757, + -36507, 361314, -132607, -478352, 125628, 310848, 43487, 247497, -194884, 66035, + -43487, 1611, -144955, 182536, 120259, 207769, 41339, -50466, -32212, 81068, + 24159, -198105, 28454, -45634, -99321, 0, -315680, -207232, 77846, -53687, + 28991, 167504, -25770, 192737, 109522, -18790, 54224, -77309, -23622, 2684, + -18254, 43487, 28991, 48855, 40265, -5369, -75162, -7516, 86436, 48855, + -47245, 537, 33286, 3221, -34897, 6979, + }, + { + -5331128, 591095, 1706176, 5750425, 256087, -1356673, -338229, 1131724, 934692, 1603633, + -1232656, 1655710, -1154809, -2748779, 3653407, -2138357, -2774012, -313533, 665720, 1603633, + -145492, -62814, 432718, -146566, -393526, 1286343, -1185948, -877247, -950798, -1035624, + 3221, 57445, -632434, 358630, -135291, 597537, 539555, 44023, -46708, -286152, + -181999, 45634, -224412, 92879, -228707, 168041, -577136, -191126, -35433, 102005, + 260382, -401043, -18254, -116501, 136902, -61203, 82141, 302795, 128849, -49392, + 146029, 238371, 63888, -32749, -115427, -77309, -39192, 2684, -8590, -48318, + 15032, 34360, 54761, -2684, -147103, 209380, -25770, 7516, -12885, -11274, + 20938, -16643, -38655, -22549, -6442, -14496, 537, -90731, 93416, 20938, + -31675, 44023, -47782, -24696, -3221, 6979, + }, + }, + { + { + 1324461, -14815490, -3917547, 1093606, -92342, -832150, -366683, -588947, 87510, 423591, + 319975, 918049, 1147293, -106837, 1497333, 2505040, -1478006, -345208, 448287, -982474, + 2854006, -39728, -412317, 2152316, -148176, 2249489, 488553, -326418, -789737, -629750, + -1647120, -601832, -1974611, 245887, 893890, 538482, 68719, -125091, -234613, -265751, + 415538, -3758, 282931, 35970, 664109, 233539, 166430, -45634, -326418, 306553, + 158914, -239981, -198642, -9127, -392990, 61740, -8053, -12885, 237297, -100395, + 186294, -8053, -178778, 32212, -151398, 1611, -147103, 5369, 6979, -176631, + 42413, 48318, 22012, 140660, 37044, 157303, -15032, -5906, -90194, 17180, + -1074, 20401, -42950, -10201, -56371, -8590, 27917, -61203, -23085, 26307, + 55835, -47245, 13422, -8053, -27380, 38655, + }, + { + -9147207, -20148228, -4767951, -1373853, 32749, 325344, -283468, -125628, 1119913, -556735, + -115427, 613107, -241055, -302795, 410169, -929860, 763967, 479963, -1490354, 848256, + -790274, 121870, -243739, 131533, 528818, -185757, 354335, 453119, 409633, 227633, + 1171989, -148176, -1194001, 41339, 379568, 923418, -313533, -267362, 452582, 38655, + -401043, 228170, -85899, 86436, 497679, -316754, 532576, -252866, 396748, -251792, + 188979, 73014, -310311, -206158, 65498, -120259, -232465, -160524, -48855, 41876, + -8053, -196495, -23622, -27917, -31675, 173946, -1611, -173409, 47245, -114354, + -24159, 32212, 3758, -195421, 24159, 81068, -167504, 71404, -37581, 48318, + 75699, -122943, -26844, 537, -88047, -72478, 95563, -44023, 25770, -45097, + 43487, -3758, 20938, -47245, 10201, -12348, + }, + { + -2654827, -46178416, 7583839, -5226975, 172336, 346819, 46708, -220117, -452582, 183073, + -639950, 467078, -1104344, 3162707, 2312303, 143345, -390842, 1810329, 363462, 135291, + 2130841, -1386201, -124554, -1082869, 1431298, 57445, -572304, -114890, -767725, -444529, + 730144, 664646, 438087, -243739, -343061, -259846, 787590, -823560, -339839, -57445, + 625455, -703838, 17180, -30065, -535797, -57982, 462783, 149250, -38655, 176094, + -241592, 54224, -264141, 187368, 105227, -25770, -184147, -78383, 365609, 171799, + -17717, 110059, 26307, -237297, -132607, 133144, -27917, 83215, 39192, -23622, + -78383, -90731, -22549, 39192, -18254, -47782, 537, 5906, -9127, 39192, + -30602, -66035, -5906, -110059, 47782, 73014, 32749, 46708, 14496, -7516, + 3221, -37581, -18790, -36507, -2684, 53150, + }, + { + -461709, 3146064, 822486, -126165, -210990, 62277, -98247, 106837, 267362, -328028, + -163209, -502511, 78920, 711891, -4901632, 1978369, 1014149, 555125, 3959960, 798327, + -602906, 239981, -565325, -631360, -1095754, 362925, 1569811, 500364, -275952, 235149, + -505196, 344134, 132070, -235686, 604517, 379031, -234076, -77309, 316754, 29528, + -22549, 121333, -476741, -40265, 34360, -116501, 185220, -239444, 233002, -178241, + 230854, -77846, -66572, 79994, 27380, -4295, 84289, 151398, -188442, 267899, + -82141, 183073, 144955, -13959, -54761, 35433, -6442, -49392, 14496, -96100, + 23085, 155156, -8590, -3758, -41876, 42950, 27380, 6442, -36507, -24159, + -50466, -4295, -85899, 48318, -34360, 26844, 44560, -2147, 14496, -39728, + 67109, 31139, -23622, -42950, 6979, -40265, + }, + { + -12035572, 12431783, 3073049, -528281, -403190, -302795, -544924, 217970, 281320, -105764, + 456877, -74625, 897648, -498753, 894964, -62814, 646393, 5375689, 179852, 28991, + 1375463, 1017370, -747861, -216359, 712428, -783832, 439160, -723165, 461709, -256624, + 588947, 241592, -54224, -391916, -91268, -543313, 1073205, 624918, 384936, -292058, + 383863, 66572, -412854, 118648, -16643, 119722, -129923, -97174, 37044, -1611, + 53687, 49929, -494995, 276489, -623844, -526134, -169114, 206695, -96100, 55835, + 34897, 125628, -168041, 49929, -178778, 89657, 113280, -98247, 62814, -137439, + 22549, -48855, 110595, 53687, -20401, -48855, -40802, 10201, 51540, 46708, + -27380, -32749, -36507, -22549, 26307, -37581, -10737, 95026, -61740, 25233, + -9664, 45097, 1611, 2147, 12885, 23622, + }, + { + 329102, 4092030, -773631, -434865, -13422, 183073, -207232, 43487, -1611, 54224, + -397284, 193274, -52613, -406948, 3143379, 1209570, -2294586, 567473, 2417530, -12560632, + -492848, -843424, -730681, 713501, 494995, 518080, -471910, -1233193, 772020, -98247, + 1511292, -84289, -27380, -91805, 641024, -665183, -148713, -728534, -53150, -212064, + -33823, 143345, -208843, 254477, -566936, 16643, -207769, -537, -43487, -417149, + 506269, -268435, 8053, 88047, 95563, -175020, -256624, 37044, -173946, -86436, + 75699, -84826, 192200, 69793, -129386, 66035, 82141, 129386, 84826, 89121, + 128849, -35970, -40265, 3758, 49929, 13422, -22012, -6979, 41339, -17180, + -1074, -35970, -22012, -37581, 103079, -537, -3221, -10737, -7516, -40802, + 54761, 32212, -7516, -36507, -8590, -33823, + }, + { + -13892609, -46124728, 986769, 3510062, -185220, -12348, 387084, -214748, -692564, -336081, + 595927, 70330, 719944, 1045288, -144955, 105764, -321049, 90194, -466541, 302795, + 227633, 191126, 26307, -194884, -272194, 306553, -3221, 356482, 200790, -86973, + 220117, -92342, 111669, 127775, -12348, -798864, -12885, -838592, 598074, 340913, + -125628, -428960, -369904, 477815, 155156, -107911, 86973, -227096, 541703, -167504, + 210990, -128312, -31139, -121333, 175020, -63888, 69793, 48318, 70867, 93952, + -127238, -227096, 64425, 176094, 90194, -153545, -157303, 12885, 30602, 134218, + -163746, 224949, 34360, -193810, -20401, 57982, 68719, -86436, 83215, 77846, + -60130, -31675, -8590, -22012, 16106, 59056, -6442, -20938, 23085, 24696, + -10737, -69793, 41876, 37044, 29528, -47245, + }, + { + 335544, -1422171, -921271, 57982, -70330, 185220, 22549, 369367, -129386, -153545, + -19864, 12885, -4832, -1763084, -6653441, -1876901, -989453, 2381559, -909996, -262530, + -1745367, 1231045, 994822, 147103, -1339493, -1731946, -68183, -1347009, -2056216, 916439, + -1142461, 527744, 302795, 153008, 118648, -33286, -449898, 693637, 38655, -305480, + 99858, -186831, -363462, 193274, 190052, 236223, -510027, -143345, 316217, 120796, + -139586, -161061, 113280, -44560, -192737, -23622, -132070, 136365, -190052, -12348, + 179852, -149250, 121333, -95563, 31139, 119185, 184684, -2147, -26844, -30065, + 19864, -44560, -20938, 171799, -67646, 24159, 139586, -13422, -59593, 12348, + -30065, 7516, 537, 69793, 19327, 15032, -2684, -52076, 3221, -3221, + -57445, 8590, -15032, 9664, -25233, -27380, + }, + { + -1532230, 56482040, -1719061, 1462973, 543850, -726386, -306016, -523986, 723702, 27380, + -1111860, 518617, -9127, 459025, 506269, 754304, 973347, 466004, 11274, -75162, + 330176, -240518, 512175, 146029, -380641, -94489, -576599, 484794, -1063004, 335007, + 543850, 95563, -885300, 439697, -160524, 348966, 510027, 872415, -805306, -964757, + -1406602, -157840, -485868, 498753, 319438, 70330, -201327, 199179, 353261, 231928, + -220117, -378494, 111132, -44560, -455803, -34360, 258235, 81604, 4295, 233002, + -18254, 53150, 75699, -279173, 6442, 130460, -51003, -236760, 63351, 114890, + -6979, -31675, 67109, -18790, 33823, -54761, 91268, -81068, 32212, 28454, + 68719, 4295, 1611, 23622, -43487, 56908, 61203, -2147, -86436, -27380, + -39192, -5906, 2684, 44560, -24696, -3221, + }, + { + -522375, 1490354, -556735, 1595580, 387084, -644245, 1684701, 850940, -137976, -115964, + -182536, -268972, 279173, 1900523, -901943, 2685428, -110059, 2602750, -445066, 456877, + -783295, 1371705, 737661, -257698, -655519, -146029, 102542, 722628, 68183, -159988, + -387621, 1210107, -292595, -645856, -62814, 1009317, -503048, -399432, -134218, 8053, + 234076, -251256, -233002, 343597, 676994, -30602, -358630, 54761, 288837, 95026, + -619012, 95026, 42413, -325344, 5369, 297427, -62814, -11274, -158377, -101469, + -40265, -107374, 238371, 51540, 19864, 190052, -12348, -58519, 28991, -96637, + 49929, -46708, -9127, 137439, 19327, -71941, 117575, -34897, 68719, 38655, + 104153, -11811, 537, -33823, 27917, -69256, -3758, 31675, 7516, 22549, + -24159, 2147, -69793, -4832, 14496, -17180, + }, + { + 5586142, 8173860, 307090, 2660195, 572304, -339839, -7592966, -8590, -19327, 1705639, + 561567, 196495, 132607, -232465, 432181, 1694902, -1188632, -1500017, 1086090, -131533, + -674847, 842887, -427349, -876173, -783832, -717796, 129386, 401579, -26844, 401043, + -243203, 91805, 512175, -621160, 359704, -654983, 856309, -23622, 89657, -441308, + -186294, -402653, 24159, 45097, 74088, 655519, 153008, -299037, 25233, 200790, + 218506, -2147, -134755, -166430, 124017, -223875, 66035, -82141, -34360, 246424, + -97711, -82141, -100395, 47245, 49392, -40265, 111132, 82141, -38655, -125628, + 88584, -38655, -34897, -22549, -97174, -3221, -108985, -1611, 71404, -124017, + 34360, 33823, -42950, 48318, -5906, 40802, -43487, 40265, -32212, 9127, + -5369, 2684, -13422, 23622, 26844, -20938, + }, + { + 316217, 4435091, -1131724, -2093260, 812286, -386010, 57445, 107374, -73014, -443455, + -328028, -40265, 1735704, 2974265, -76773, -263067, 2527588, -1574106, 1098438, 493921, + 1271310, 1538135, -539018, -481573, -2208150, 201863, 1104344, -459562, 585189, -286689, + -681826, 636192, -74088, 227096, 379031, -321586, -76236, 103616, -110059, -20938, + 77309, 271657, 474594, 293668, -361314, 411780, 80531, 248571, 102005, 207769, + -47245, 137976, 149250, 127238, -64961, -247497, -368293, -71941, 246424, 267899, + 41339, 137976, -159988, -20938, 151934, -61740, -154619, 140660, -44560, 13422, + -87510, 59056, 23085, -47245, 10201, 4832, -55835, -67646, 19327, 3221, + 33286, -46171, 15569, 59593, 26844, 35970, 32212, 34360, 7516, 16106, + -1611, 13959, 3758, -47245, 31139, -18790, + }, + { + -1094143, 10714333, -351114, -2784750, -476741, 162135, -1064078, 387621, 943819, 153008, + 96637, -868657, -2131378, -1255741, -1048509, -733903, 96637, 1241246, -494458, -36507, + -300111, 285615, -115964, 187905, 159451, -107911, 1626182, -965831, 780610, 950262, + 321586, -1130650, 505732, 617938, 450435, -384936, 542240, 404801, 10201, -236223, + -787590, 85899, 84826, 624918, 476205, 312459, 308164, -396211, 70867, 442919, + 100932, -365609, 6442, 243739, -17180, 95026, -290447, -270046, -105764, 106837, + -28991, 93952, -2684, 35433, -35433, -1074, 4832, 105227, 5369, 26307, + -62814, 140123, 103079, -143881, -57445, -34897, 17717, 141734, -34897, 22012, + -102005, -53150, 49392, 47782, -78920, -64961, -8590, 59593, -51003, -3758, + 28454, 59056, -3758, -27917, -10737, -27380, + }, + { + -148713, 785979, 330712, 868120, -426812, 249108, 68719, -102005, -474057, 63351, + -134755, 1081795, 323196, 397284, -13785234, 530965, 1913408, -2142115, 2481954, 1472637, + -314069, 199179, 505196, 731755, -1188632, -431644, -548145, 238371, 338229, -1192390, + 1349694, -1123134, 268435, 558883, -512175, -98784, 281857, -347355, 347892, -339302, + 250182, 776852, -248034, -258772, 90731, 63888, 192737, -21475, -122943, 9664, + 46708, -179852, -173946, 100932, 59593, 76236, -62814, -16643, 249645, 231928, + 13422, -311922, 59056, -4295, -35970, -25770, 79457, 17180, -1611, -15032, + -126702, 17180, 82678, 1074, 5369, -64425, -22549, 100932, 34360, 82678, + 6979, -103616, -24696, 67109, -50466, 25770, 7516, 59593, -16643, 105227, + -11274, -25233, -32749, 55298, -20938, -60130, + }, + { + 1141388, 8228084, -1695975, 1378685, 785442, 392453, -1360431, 574452, 834834, 1718524, + -315680, -164819, -802622, -1557463, 5421323, -835908, -1852205, 773094, -407485, 558346, + -649614, -96100, 635655, -229244, -976568, 751619, -1289027, -183073, -139050, 10737, + 379031, 331786, -725313, 636192, -19327, -256087, 21475, 222265, -446677, -205085, + 19864, 381715, -194884, 215285, 296353, 256087, 57982, 388158, -361851, -113280, + 276489, -163746, -139586, -308701, 138513, -259846, 142271, 281320, -82678, 18790, + 89121, 20401, 537, 52613, 23622, 63888, 37581, 61203, -11811, 10737, + -32749, 47782, 164283, 28454, -217433, 90731, -65498, 69793, 42413, 50466, + 49929, 63888, 537, 34360, 45097, -13959, -12348, -28454, -47245, 38118, + -25770, 22549, 49392, 13422, 2147, -18790, + }, + }, + { + { + -472446, -16684874, -121870, 15032, -488016, -487479, 35433, -447213, -3758, 14496, + 869194, 292058, 1195075, 33286, 1776506, -161598, 466541, 4832, 1207423, -457951, + 1889249, -378494, 49929, 1354525, 853625, 1701344, 431107, -163209, -296890, -565862, + -1615982, -913754, -551366, 255551, 471910, 704912, -966368, 614180, -1342177, 98247, + 327491, -193810, 229244, 463856, 521302, -12348, 132070, -183610, -223338, 260919, + 187368, -106300, -107911, -17717, -172336, -155156, -62814, 55835, 2684, 110595, + 98247, 139586, -102005, -158377, -117038, 6442, -32212, 3221, 147103, -164283, + -89657, 62277, 84826, 105227, 209380, -5369, 20401, 15032, -2684, 4832, + 8590, 57445, 38655, 23622, -82678, -19327, 22012, -42950, -7516, -35433, + 48855, -9127, -31675, 0, -26307, 9664, + }, + { + 7346542, -47131896, -502511, -3100430, -241592, 314606, -401579, -176094, -650688, 813896, + 107374, 552977, -257161, -206158, -761820, -117038, 297963, -806917, -969052, -87510, + 81604, -479426, -236223, 631360, 570694, 258235, -174483, 670015, 795643, 171799, + 724239, -57445, -870268, -503585, 557272, 113280, 687195, -283468, 202400, -311385, + 259309, -216359, 107374, -17717, 325881, -174483, -42950, -197032, 20401, 28454, + -118648, 378494, -8053, 39728, -88584, -155156, -214212, -192737, 201327, 127238, + 70330, -156229, -122943, 48318, -37044, 77309, 23085, -146029, 12885, 74088, + -97174, -47245, 3758, -51540, -107911, -17180, -56908, -2147, -59056, 114354, + 63888, -112206, -9127, 26307, -46708, -126702, 43487, 5906, 2684, 8590, + 7516, 35433, 15032, -20401, -17717, -7516, + }, + { + 2173790, -33772940, -9757092, 1453310, -925029, 557272, 346819, -219580, -417149, -717260, + -482110, -609885, 391379, 1484448, 2417530, -775778, 2539400, -121870, 1060857, 161061, + 1359894, -20401, 279710, -826244, -135291, 402653, 170188, -108448, -544924, -768799, + 572304, 744103, 39192, 65498, -685584, -463320, 694711, -527207, -284542, 366146, + -461709, 918586, -392990, 117575, 123480, -563178, 91805, 164283, 512175, -148713, + -222265, -127238, -5369, -3221, -140123, 69793, 166967, 14496, 280247, 165356, + 91805, 252866, -197032, -6442, 40265, 58519, -118112, 140660, 108985, -92342, + -12348, 15032, -6442, 33823, -6979, -35433, -8590, -11274, -61203, -4295, + -55835, -50466, 38655, -85899, -34360, 75162, 5906, 6442, 13959, -25770, + -11811, -7516, 5369, -27380, 8590, 18790, + }, + { + 331786, 3152506, -751082, 566399, -136365, -85899, 67646, 169114, 52076, -229244, + -264677, -524523, -327491, -907312, -1050120, -1351841, 1326608, 1851131, 1882269, 1036698, + -53687, -280784, -604517, -304943, -579821, 729608, 770410, -381715, 390842, -43487, + -780073, 729071, 29528, -88584, -130997, 590021, 12885, 363998, 175020, 191126, + 56371, -6979, -201327, -354335, -19864, 158914, -70867, -68183, 344134, -17717, + -149250, -48318, 105227, 112206, 9127, 150861, -47245, 125091, 63351, -10201, + -198105, 87510, 142271, 71941, 30065, -62814, -9127, 102542, -16643, -81604, + -112743, 78383, -8053, -32212, -24159, -2147, 131533, 30602, -21475, -28454, + -62277, -6442, -51540, -6442, 1074, -39728, 43487, 32212, 32749, 1074, + 16106, 30065, 15032, -31139, 6979, 10737, + }, + { + 7850127, -12444668, -2153389, -86973, 423591, -353798, -697932, -104153, 235149, -294205, + 1130113, 1366873, -110595, 11274, 521839, -482647, -98247, 4262755, 1006633, 576599, + 1001264, -56908, 178241, -176631, 111132, 33823, -234613, -3758, -428423, 26844, + 371515, 126165, 89121, 144955, -96100, -209917, -688805, 612033, 265214, -311385, + 89121, 108448, 82678, -523449, 27380, 262530, -120259, 63351, 189515, -133681, + 203474, 76773, -226023, -187368, -380105, -278636, -479426, -59056, 163746, -37044, + 79994, 98784, -94489, -55835, -69793, 129386, -9127, -148713, 151398, 5369, + -31675, -64425, -41339, 93952, -9127, -128849, 68183, -13422, 51540, 68719, + 10737, -25233, 16643, -68719, 25233, -56371, 36507, 48855, -62814, 14496, + -21475, 21475, 25770, -28991, 18254, 14496, + }, + { + 55835, 2416456, 1479079, -532576, 136902, -89657, 89121, -192200, 252866, -13422, + -180926, -134218, 129386, 1071594, -617938, -197032, -157303, 36507, 545461, -8507256, + -984084, -1458141, -326954, -1166621, 1021129, -123480, -206158, -926639, -39728, 1744831, + 1218160, -562641, 93952, 437550, 297963, -745177, -293668, -141197, -431107, -228707, + 129386, 153008, 297963, -31675, -171262, -48855, -295816, -120259, -73551, -297427, + 129923, 57982, -117575, 165893, -98784, -235149, -86973, -37044, 5906, -209380, + 4832, 53150, -24159, 37581, 62814, 39728, 79994, -3221, 76773, -37044, + 163209, 50466, -59056, -35970, 18790, 106300, 57982, 119722, -45097, -41339, + 43487, -7516, -64961, -32749, 62277, 9127, 31675, -54224, 15032, 49392, + -40802, -10737, 71941, -27380, -19864, 16106, + }, + { + 3662533, -61799212, -3737695, 1961726, 45097, 526670, 169114, -296353, -248034, -506806, + 642098, 156766, 501974, 200253, 373662, 188442, 482110, -353261, -228170, -148713, + -76236, -252329, -96637, -293132, 271657, 5369, -50466, 296890, -89657, 473520, + 491237, 99858, 368830, -360777, 42413, -469762, -218506, -848256, 957241, -17180, + -119722, 83752, -693100, 259309, 49392, 68719, -105764, -100932, 77846, -165356, + 22549, -93952, 74088, -154619, 123480, 89121, 143345, 172872, 40802, 77846, + -106300, -107911, 7516, 102542, 28454, 55298, 86973, -84826, -68719, 53687, + -31139, -16106, 125091, -56908, -74088, -20938, 119722, -20401, 28991, 66035, + -84826, -29528, 62814, 4832, -27380, 83752, 73551, -37581, -42413, -33823, + 28454, -35970, -30065, 20938, 27917, -13959, + }, + { + -147640, 362925, -520765, 460098, -198105, 85362, 103079, -127775, 252329, -12348, + -330712, -533113, 470299, -1086090, -8592082, -2169495, -1726040, 331786, -383326, 349503, + -1866700, 296353, 455803, 118112, -102542, -3349001, -285615, -370978, -1374926, -468688, + -41876, 435402, 38655, 83215, 537, 108985, -44023, 242129, -160524, 353798, + -124554, -256087, -284005, 10201, -13959, 92342, -62814, -352724, -230854, 171799, + 112743, -139586, 17717, 105227, 9127, -73014, 141197, 77846, -278636, 139586, + 45634, 46708, -41339, 5369, 5369, -48855, 85899, 75162, -75699, 28991, + -5906, -26307, -42413, 48855, 70330, 35433, 123480, 55835, -24159, 51540, + -78383, -25770, 3758, 24696, 54761, 6979, 34897, -26844, -12885, 55298, + -48855, -2147, 17180, 6442, -35433, -28454, + }, + { + 4150012, 42169064, 2462090, 778463, 77846, 272730, -361314, -585189, 368293, 551366, + -214212, -364535, -1215476, 667331, 1025423, 664646, 971200, 80531, 69256, 264141, + 354335, -61203, 280784, 399969, -466541, -348966, 348429, -86973, -758062, -151934, + 442919, 47782, -433255, 339302, 234613, 321586, 113817, -127775, 21475, -911070, + -1047435, -483721, -179852, 518080, 82141, 148713, 247497, 13422, 325344, -163746, + 37581, -15569, -124554, -121870, -360240, -217970, 188979, 45097, 106300, 77846, + 128849, -111669, 17180, -107374, -169114, -5906, 27917, -215285, -10737, 165893, + 28991, -97174, -26844, 37581, 96637, -97711, 49392, 19864, -53150, 36507, + 25233, -8590, -33823, 8590, -78383, 5369, 77309, 53150, -3221, -76236, + -62277, 25233, -15032, 59056, -2147, -2147, + }, + { + 321049, 763967, 1707250, 782758, -1048509, 1413581, 76773, 357019, -352724, -386010, + -477278, 30602, 143345, 725313, 652835, 1807108, 597537, 471910, 2776696, 231391, + -1059246, 34360, 858457, 679142, 222801, -346819, 461709, 429497, -302795, 303869, + -945967, 366146, 583042, -636192, 534723, 445066, 101469, -41339, 29528, -164819, + 302258, 243203, -20938, -17717, 571768, -91805, -217970, 121870, -104153, 228170, + -205085, -141734, 351114, -210453, -288300, 91805, 210453, -56908, -49392, 31675, + -176631, 61203, 62814, 11811, -21475, -87510, 129386, 38655, 173409, -34360, + -62814, -51003, -120796, 119185, 10201, -12885, 37044, -21475, -24696, -4295, + 28991, -1074, 14496, 6442, 42413, 5906, -53150, 17180, -24159, 15032, + -4295, 9127, -54761, -7516, 31139, 19327, + }, + { + -4059818, 17285632, 5603322, 1171452, 82678, -2122788, -2543158, -1470489, 288300, 1138166, + 103616, 396211, 20401, 684510, 388695, -212601, -1334124, -526134, 501974, 489089, + -364535, 513249, -287226, -472983, -796180, -276489, -198642, -157303, 289910, 511101, + -55298, -100932, 37044, -175020, -112206, -463320, 494458, 162135, -129386, -140660, + -174483, -52076, -208843, -380641, 53687, 401579, 175557, 33823, -208306, 163746, + 357019, -60666, -158914, -85362, -193274, -153008, -48855, 87510, -99321, 67646, + -4832, -98247, -92879, 39192, 51540, -88584, 75162, -33286, 13959, -91268, + 46708, 9664, -10201, -1074, -8053, 64425, -46171, -64425, -15569, 6979, + 7516, 39192, -50466, 55298, -22549, 49392, 48318, 18254, -23622, 537, + 10737, -8590, -33286, 10201, 33823, 20938, + }, + { + -343597, 2083596, 1273995, -759672, 351650, -584652, 50466, -28454, -37581, -416075, + -445066, 58519, 1561758, 2954401, -1202591, 1876364, -59593, 102005, 748398, 404801, + 1832877, 1241782, 24696, 275952, -1098438, -1133335, -278636, -292058, 655519, 596464, + -862215, 596464, -173409, 227633, -239444, 71941, -329102, 164819, 162135, 257698, + 184147, 111669, 357019, 347892, 3758, 228170, 53150, 257161, 103079, 453119, + 197569, -131533, 81604, 186831, -75699, -227096, -416612, -210990, -25233, 157303, + 113280, 90194, -110595, -142808, 58519, 30602, -190052, 8053, -41339, 3221, + 115427, 21475, -13959, 59593, 27380, 59593, -49929, -54224, 4295, -39192, + 14496, -18790, -32749, 54761, 22012, 17717, 26844, 15032, -5906, 20938, + 11811, 39192, -13959, -24159, 19327, 1611, + }, + { + 927176, 1928440, -157840, 811212, -550830, 962610, 172872, 897111, 176631, 62277, + 577673, -25770, -299037, -4615479, -2105608, 412317, -121333, 98784, -314069, 1294396, + -296890, -111132, -176094, -121870, 777926, 1005022, 1244467, -427886, 986769, 878858, + -1611, -539018, 108448, 513785, 321586, 557272, -359704, 401043, 212064, -283468, + -437550, -178778, 214748, 186831, -179852, 110059, 22549, -209917, -99858, 95026, + 199179, 61740, -80531, 342524, 97711, 83215, -62814, -264677, -267899, 193810, + 33823, 25770, -68719, 115427, -87510, -158914, 18254, 52076, 73551, -23622, + -45097, 82678, 117038, 12885, 22549, -6442, -88047, 158914, 63888, 55298, + -73014, -136902, -9127, 67109, 13422, -66572, -47782, -62814, -54224, -39192, + 31139, 17717, 48855, 7516, 15569, 7516, + }, + { + -24159, 1112933, -1531156, 357556, 354872, -244813, -70330, 243203, 86436, -658741, + -246424, 852551, 800475, -6505265, 2361695, -3828963, 1920387, -539018, 316217, 2236067, + 1205275, 250182, 1385127, 502511, -1639067, 1140314, -1187559, 158914, 77309, 682900, + -769336, -251256, -236223, 446140, -1111323, -395674, 160524, -220654, 511638, -352724, + 76773, 528818, 113280, -86973, -77846, 192737, 86436, -119722, -54224, -112743, + 167504, 6979, -126165, -141197, 188979, -158914, -1611, 63351, 162135, 123480, + -33286, 13422, -117575, 10737, 114890, -24696, 114354, 85362, -10737, -8590, + -71404, -5906, 130460, -107374, -32749, 45634, -32212, 74625, 27380, 17180, + 69256, -66035, -115964, 39728, -51003, -24696, -2684, 51003, -42950, 31675, + 46171, 33823, -26307, 42413, 4295, -55835, + }, + { + 1478006, 7473780, 580894, -2019708, 843424, 1438814, -278636, 748935, 862215, 404801, + 1227824, -712428, -164283, 2342368, -536334, -642635, 534187, 1127429, -999117, 393526, + -753767, 319975, 261456, 419296, -635655, -507343, -580894, 418759, -380641, 386010, + 55835, 411243, -341987, 117038, 422517, -391379, -494458, 151398, -421981, 141197, + 268972, -67646, -114890, 49929, 522375, 174483, 150324, 104153, 69793, -303332, + 98784, 176094, -53687, -160524, 6979, -75699, -57982, 54761, 71404, 155693, + -53150, -75162, -70867, 131533, 63351, -13422, 70867, -90731, -6979, 22012, + -9664, -35970, 98784, 98247, 35433, -66035, -95563, 105764, 24159, 15569, + 59593, 112206, 15569, 13959, 30602, 26307, -7516, 4832, 2147, -37044, + 42950, -3758, 39728, 42950, 16643, -21475, + }, + }, + { + { + 179315, -13596256, 3178276, 665720, -246961, -12348, 334471, -18790, 635118, -180926, + 439160, -914828, 375810, -221191, 256624, -1592359, -69793, 367757, 332323, -637266, + 1525787, -547071, -22549, 920734, 580357, 649077, 433255, 956704, 699543, 348429, + 162135, 305480, 363462, -365072, -551366, -559956, -844498, 976568, -1064078, 206695, + -40802, -336081, 16106, 284005, -79994, 31675, 153008, -177167, 58519, 144418, + -163209, -176094, -25770, -186294, 44560, 71941, 2147, 113280, -84826, 37581, + -105227, 89121, 97711, 34897, -12348, 82678, 46171, 1074, 42413, -45097, + -30602, -30065, 105227, -27380, 111669, -115964, 38118, 5369, 32212, 63888, + 10737, -5369, 8590, 37044, 30065, 15569, -1074, -22012, 13422, -19864, + -40802, 22549, -30602, 46171, 10737, -24696, + }, + { + -5052492, -44794900, 12407087, -2685428, -956704, -548145, 27917, 398358, -1330366, 649077, + 97711, -79457, 299037, -109522, -1100049, -184147, -626528, -81604, 1024887, -347892, + 60666, -179315, -322123, 281320, 86436, 344134, -135828, 241592, 270583, -369367, + 12885, -19327, -148713, 128849, 3758, -513785, 226023, 55835, 223338, -591095, + 177704, 201327, 392990, -255551, -97174, 170188, -399969, 40802, -110059, -177704, + -399432, -146566, 13959, 95026, -70867, 76773, -88047, 66572, 93416, 31139, + 15569, 13959, -42950, 146029, 93416, 73014, -93952, -139586, -68719, 97711, + -60130, 26844, -17180, 26307, -11811, -122407, 35433, 27917, -37581, 10201, + 22012, 9127, -24159, 24159, 28454, 27917, -72478, 61203, -35433, 10737, + -15569, 8590, -9127, 28454, -24696, 22549, + }, + { + -1740536, -11530377, 8150774, 2063732, 2095407, 194347, -71404, 155156, 135828, 325344, + -244813, -651761, -110059, -136902, 2330020, -164283, 1021665, -1541893, 1386201, -575526, + 1073742, 514859, 758062, -467078, -685047, -25770, 312996, 763430, 207769, -144418, + 286689, 452045, 112743, 489089, -555661, -391916, 673236, -370441, 331249, 814433, + -858457, 934692, -206158, 299037, 186831, -388158, -149250, -103616, 164283, 34360, + -52613, -310311, -5369, -93416, -132607, 70330, -74088, -12885, 153545, 70867, + -104690, 57445, -85362, 119722, -113280, -63888, -195958, 62277, 85362, -52076, + 16106, -15032, 26844, -6442, 73014, -8590, -11811, 0, 11274, -28991, + -55298, -35433, -19864, 36507, -48318, -13959, 20938, -28454, -10201, 13422, + -48855, 9664, -4832, 20938, -16643, -26844, + }, + { + -165356, 4019553, -29528, 271657, 222265, -54224, -40265, -42950, 15569, 144418, + 255014, -23085, -400506, -593242, 2907693, -1003949, -2258079, 212064, 824097, 16643, + 432718, -100932, -530428, 422517, -432181, -354872, -1109712, -756451, 86436, -122407, + -1196148, 578747, 357556, 407485, -293132, 288300, 760746, 228170, -190052, 372052, + -69793, -76236, 14496, -148713, 7516, 15032, -81604, -185220, 161598, 122407, + 1611, -211527, 60130, 47782, -128849, 223338, -122943, -170188, 156766, 76773, + -175020, -63351, 79457, -89121, -24159, 40265, 3221, 87510, -32749, 40265, + -45634, -73014, -29528, -27380, 62277, -70330, 23085, 22012, 61203, -6442, + -8053, -10737, 35970, -16643, 34360, -11811, -30065, -5906, 27380, -2684, + -28454, -25233, 16643, 20401, -2147, 15569, + }, + { + -2039573, -21590800, 907849, -1332514, -265214, 148176, -311385, -463320, 375810, 11274, + 1074, 945430, -247497, 547071, 382252, -756451, 534187, 3183645, -372052, -5906, + 63351, -209917, 468151, 462783, -475131, 606127, -137976, 312459, -757525, -86436, + -147640, -302258, -432181, 221191, 60130, -6979, -1004486, -728534, -186294, 128849, + 3221, -96100, 91805, -252866, -149250, -148713, -75699, 67109, 62814, -177704, + -146566, -111132, 279710, -56371, -59056, 47245, 41339, -75699, -81604, -182536, + 50466, 67109, -64961, 99321, 60130, 15032, -33823, -138513, 89657, 3221, + 16106, 5369, -139586, -68719, -8053, -7516, 13959, 74625, -7516, -44560, + -2684, 30065, 537, 45634, 1074, -87510, 19864, 1611, -11274, -9127, + 4295, 8590, 22012, -16643, -26844, -18254, + }, + { + -281320, -2332704, 457951, 82141, 74625, -186831, -70330, -197569, 134218, -31139, + 241055, 115964, 470299, 133144, -1551020, 483184, 854162, -139586, 1808181, -5352603, + 184147, -737124, 1058173, 73014, 173946, -672162, 330712, -797790, -864362, 1261110, + 1405528, -92879, -206695, 12885, 440234, -252866, -31139, 193274, -228707, 16106, + -222265, 523449, 431107, 76236, 137439, -103616, -137439, -47245, -37581, -318901, + -153545, -38118, -164283, -137976, -255551, -52613, 130997, 25770, 170725, -26307, + 22549, -32212, -59056, 42413, -34360, -11274, 11811, -137976, 49392, -72478, + 19864, 74088, 53687, -7516, -66572, 5906, -23085, 147103, -52613, 35433, + 6442, 84826, 30602, -20938, -55298, -1611, 35433, -48318, 10201, 65498, + -10737, -57982, -8053, 25233, 27917, 54761, + }, + { + 2899103, -49258980, 6185827, 1569274, -470299, 432718, 26307, 347892, 481036, -558883, + 127775, -7516, -5369, -328028, -2147, 401043, 338229, -280247, 834834, -317828, + -309238, -343597, -3758, -76773, 257698, -20401, -173946, 453119, -214748, 146566, + 280247, -138513, 349503, -338766, -21475, -10201, 108448, -880468, 398358, -261456, + 201327, 583042, -254477, 9127, 146566, 181999, 60666, -48318, -80531, -136902, + -171262, -125628, -148713, -4295, 47782, -16643, 34360, 35433, -64425, 24159, + 5369, 42413, -22549, -11811, -125628, -24159, 33823, 9664, -83752, 3758, + 146029, -85899, -90731, 56908, 37044, -80531, 22012, 9664, -37044, -26844, + 47782, -20938, 37044, 60130, 4832, -52613, 26307, 5906, -16643, -35970, + -3221, 21475, -37581, 2147, -8053, -2684, + }, + { + -340376, 538482, 976031, -111669, 103616, 52613, -6979, -267899, -22012, 158377, + 249645, 46708, 826244, -25770, -5779416, 11274, -534187, -580357, 51540, 1206886, + -1065152, -325881, 1140851, 1304596, 745714, -1329292, 677531, 256624, -503048, -457414, + 418759, 69256, -337155, 59593, -112743, -4832, 119185, 186831, -421444, 548682, + -129386, -61203, 146029, 42950, -310311, 45634, -13422, 241592, -403727, -250719, + 122943, -82141, -186294, -128849, 183073, 62277, -48855, 9664, -24696, 22012, + -121870, -93416, 18254, 73551, 43487, -173409, -115427, 62277, 91805, 28991, + -23622, 21475, -69793, -52613, 53687, -1074, 9664, 51003, 23622, 6979, + 44560, 28454, -11811, -70330, -50466, 537, -11811, 33286, -19327, 15032, + 13422, -10737, 17717, 35433, 4832, 8590, + }, + { + -3262028, 29291676, -1306744, -616865, -266288, 180389, 270046, 444529, -520765, 222265, + 1233193, -106837, -651224, -948651, 652298, -755914, 55835, -212601, -69256, -111669, + -186294, -53150, -513249, 236223, 273804, -326418, 450435, 99321, -304943, -117038, + -170725, 306016, 37044, 450972, 122943, -75699, -309238, -393526, 184147, -353798, + -229781, 421444, -17180, 16643, -5906, -173946, 123480, 177704, 86973, -620086, + -104153, 111669, -115427, 134218, 290984, 1074, -75162, -162672, 169651, -91268, + 14496, -14496, -2147, 49929, -4832, -128312, 24159, 35433, 21475, 39728, + 53687, -6979, -2684, 68183, 41876, -15569, -85899, 40802, -48318, 55298, + -68183, 32212, 2147, 8053, -25770, -30602, -17717, 41339, 39192, -19327, + 18790, 38655, -11274, -24696, 38655, 7516, + }, + { + -275415, 2723546, 712428, 150861, -453119, -179315, 508417, 603980, -536871, -181462, + -274878, 402116, -757525, -1200980, -559420, 2063732, 596464, -1896765, 565325, 621697, + -760746, -63888, -269509, 250182, 663036, 237834, 316754, 482647, -399432, -300111, + 26307, -449898, 206158, -461172, -44023, -75699, 86973, 41876, 366683, -132607, + 278636, 265214, 118112, -80531, -178778, 168041, 8590, 248034, -297963, -58519, + 123480, 22549, 210990, -52076, -18254, -195958, 98784, -105227, -28991, 78383, + -67646, 71941, 45634, -93416, -31675, -212064, -20938, -38655, 155156, 137439, + -69256, 19327, -31675, -42413, -10737, 53687, -8590, -41339, -1611, -13422, + -4295, -31139, 15032, 1611, -12348, 48855, -6442, 6442, -10201, -40265, + 32749, -1074, -17180, -22012, 10201, 51540, + }, + { + 2289755, 22247930, 2302103, 2000918, -813359, 1503775, 5377299, -853625, -278636, -445066, + -210453, -33823, -62277, -203474, 273804, 440234, -736050, -746787, -394600, -351650, + 88047, -155693, 154082, -216896, -299037, 68719, -194884, -392990, -336618, 258772, + -3758, -30065, -37044, -302258, -161061, 95563, -269509, 6442, 23085, -111669, + -113280, 284005, -285615, -224949, -27380, -72478, 9664, 169651, -23622, -63888, + 243739, -22549, -82678, 193810, 27380, -44560, -297427, -30602, 63351, 91268, + -537, 12885, 9127, -24696, -49929, -8053, 3758, -51003, -31139, -26307, + 41339, -29528, -47245, 15032, 56371, 13959, 70867, 45097, -61740, 92879, + -59056, -3758, 15032, -67109, 6442, -27380, 75162, -7516, 24159, -9664, + -25770, 2147, 11811, -6979, -46171, 31675, + }, + { + 346819, -323196, -1114544, 86436, 188979, 125091, -50466, -365609, 47245, 82141, + 133681, 358093, -2680597, -1316944, 340913, 454193, -1413044, -285078, 68719, -415001, + 794569, -1735704, -215285, 216896, 231391, -457414, -729608, -239444, -55298, 540629, + 387084, -158914, -61203, 139050, -237297, -22549, -552440, -357019, 652835, -3758, + 71404, 83752, -199716, 66572, -23622, -122407, -45634, 141734, 88584, 38655, + 74088, -120259, -207232, 93952, -54761, 165356, 26844, -12348, -183073, 10737, + -159988, 27380, 69793, -9664, -131533, -92342, 113817, -37044, -6979, -43487, + 99321, 30602, -95563, 28991, -26844, -16643, 51003, 63351, 9127, 11274, + -61203, 41876, 17717, -13959, -15569, 8053, 22012, -30602, -37044, 2684, + -7516, 17180, 20401, 21475, -22012, 1611, + }, + { + 139586, 1075889, -1863479, 2309082, -1351841, 916439, 2195265, 615791, 494995, -609885, + 38118, 134755, 926102, -2069637, -1846836, 830539, -774168, 0, 65498, 12885, + 463856, -3758, 226023, 345745, 734976, 75162, 582505, -452045, 739808, 633508, + -350040, -386547, -12885, 278636, -267362, 299037, -95026, 256087, -259309, 417686, + 122943, 154082, 86436, 48318, -443455, -161061, -212064, 177704, -382789, -170725, + 177704, 223338, 55298, 24696, 60666, 155693, 68183, 96100, -41876, 36507, + 87510, -71404, 39728, 73551, -36507, -64425, 4295, -6442, -99321, -5906, + 73014, -23085, 10201, 85899, 55835, -14496, -45634, -15032, 63888, 13959, + 102542, -89121, -71404, -31675, 33823, 92879, 3221, -87510, 9664, -30602, + -4295, -20401, -13422, 47782, 537, 2147, + }, + { + 134755, 3152506, -518617, -906238, -206695, -206158, -144955, -115427, 561567, -13959, + -139586, 758599, -455803, -1827509, 17723720, -733366, -448824, -1322850, -848793, 1262720, + 777389, 419833, 918049, 103616, -1040993, 572841, 84826, 499290, 289373, 1533840, + -543850, 447750, -464930, -103079, 6442, -42950, 16106, -238371, -15569, -197569, + -209917, 161061, 73551, -172872, -119722, 98247, -363462, -89121, -52613, -34897, + -129923, 159988, 59056, -129923, 143881, -197569, -97174, 1074, -5369, -56371, + -42413, 280784, -102005, -42950, 75699, 140660, -53150, -83752, 30065, 23085, + 75699, 37581, 1074, -55298, -21475, 34897, 54761, -100395, -27380, -122407, + -6442, 77846, -76773, 17717, 26844, -39728, -55835, -37044, 23622, -54224, + -17717, 55835, 34360, -7516, 6442, 27380, + }, + { + -2084670, 4294431, 2076617, -1204738, -229781, -319975, 543313, 26844, -241592, 122943, + 112206, 308701, 869194, 200253, -4235912, 111132, 1580011, 718870, -336618, 480499, + -776315, -190589, -283468, 183073, 302795, -421981, -504659, 853088, 75699, 701690, + -236760, 47782, 87510, -226023, 197569, -107911, -334471, -242129, -245887, 273804, + 284005, 108985, 149250, 61203, 186831, 160524, -26307, -108448, 207769, -168041, + -9664, -46708, 44023, 207232, 145492, 194884, -23085, -99321, 121870, 120796, + -11811, 1611, -183073, -46171, 38118, -2147, 8590, -127238, 28991, -45097, + 80531, -55835, -132070, -17717, 135291, 26844, -70330, 51540, -15032, -10737, + -13422, -23622, -8053, 1611, 537, 24159, 6979, -63888, 98784, -59056, + 52613, 22012, -10737, 10737, -5369, 20938, + }, + }, + { + { + -178241, -5960341, -2399813, 966368, 411243, -56908, 141197, 311385, 105764, 223338, + 19327, -97711, -431644, -464930, -358093, -16106, 174483, -527744, -477815, -445603, + 990527, -439160, 65498, 541166, 575526, 832150, 507880, 656056, 458488, 486405, + 187905, 922344, -128312, -763967, -57982, -1326071, -186831, 203474, 38655, 380105, + -68183, -88584, -35433, 161061, -113280, 173946, 33286, -2684, 129923, -226560, + -52076, -312996, -83215, -143881, -79457, 153008, 122943, 168577, 16106, -9127, + -71941, -95563, 134755, 135828, -5906, -1074, -18790, -9127, -55835, -12885, + -3758, 1611, 75699, 4832, -39728, -78920, 47245, 12885, -24159, 26307, + -12348, 5369, -38655, -6979, 27380, 26844, -3221, -8053, 537, 48318, + -60130, -15569, 20938, 27380, 20401, -2147, + }, + { + 4722854, -21990770, -15597711, -1127966, -155156, -454193, 18790, 510027, -62814, -134755, + -176631, -236223, 379031, 858457, -1047435, -161061, -93416, 220654, 773631, -552440, + 37044, -112206, -127238, 76773, 101469, -56908, -59593, 496069, -258772, 186831, + -308701, 223875, -321586, 500901, -566399, 57982, -597000, 423054, 300111, -425739, + 56371, 340913, 164819, -62814, -233539, 178778, -23085, -155156, 185220, -291521, + -77846, -446140, -228170, -60130, -8590, 35970, -5369, 78920, -66035, -69793, + -65498, 55835, 31139, 44560, 122943, 70330, -22012, -148176, -79457, -69256, + -11811, 71941, -15569, -3221, 42950, -38655, -23085, 53687, 21475, -58519, + -6979, 36507, -20938, -17180, 21475, 84826, -22549, 3221, -23622, -9664, + -2147, -17180, -5369, 11274, -6979, 17717, + }, + { + 2342905, 6179921, -5423470, -194347, 368293, 102542, -205085, 29528, 367757, 595927, + -77309, -343061, -213138, 42413, 2522220, 192200, -1107565, 699006, 540092, -463856, + 491774, 541703, -69793, 284542, -73551, -256087, 28454, 275952, 528281, 191126, + 178778, 315680, 217970, 248034, 25233, -12348, 385473, -336081, 236760, 391916, + -209380, 312459, 119185, -173946, 90194, -72478, -172872, -184147, -351650, 62277, + 223875, -167504, -15569, -154082, 20401, -42413, -234076, -44023, 32749, 18790, + -1611, -117038, -23085, -68183, -153008, -125091, -115964, -22549, 97711, -15032, + -58519, -16643, 52613, -24696, 18254, 11274, 12348, 9664, 44560, -55298, + 14496, -23622, -61203, 10201, 44560, -29528, 13422, 22549, -22012, 32749, + -20401, -22549, -26307, 18790, -17717, -28454, + }, + { + 181999, 4667556, -32749, -306016, 134755, 82678, -110595, -90731, -72478, 249645, + 321049, 230854, -184684, 688269, 3381213, -1168768, -2251637, 202400, 176631, 363462, + 680215, 113280, 118648, -209380, -254477, 191126, -1487132, -1242319, -185757, 169114, + -1430761, 317291, 738198, 247497, -23622, 581968, 462783, 47245, -172872, 75699, + -104153, -108448, 66035, -30065, 107374, -267899, -127775, 123480, -173946, 4832, + 111132, -89657, -71404, 133144, -176631, -17180, 68719, -151934, 75699, 106837, + 1611, -63351, 69256, -126702, -62814, 107374, -5369, 1074, -15569, 46708, + 45634, -43487, 32212, -21475, 59593, -9127, -67646, -38118, 56371, -1074, + 28454, -22012, 24159, -5906, -1074, 40265, -23622, -10737, -9664, -11274, + -15032, -27917, -25233, 22549, -9664, -14496, + }, + { + -2083059, -18389976, -19864, -1392643, 292058, -86436, 41876, -348429, 145492, 423054, + -474594, -236760, 334471, 899259, -444529, 397821, 250182, 2935073, 397284, -57445, + -258235, -154082, 482647, 207769, 266825, 89121, 173946, 100395, -50466, -395137, + -571768, -347892, -375273, 185757, 190052, -264677, -252866, -476205, -175020, 360777, + 21475, -146566, -61740, -64961, -122407, -394600, -117038, 57982, -57445, 0, + -222265, -158377, 61203, -34897, 85899, -47782, 200253, 42950, -172872, 33286, + 21475, -38655, -77846, 61740, 55298, -76236, -11274, 37044, -6442, 1074, + -27380, 47245, 4832, -96637, -31139, 74625, -86973, 88047, -8053, -64425, + -32749, 32749, -42413, 68719, -7516, -33823, 4832, -36507, 37044, 16643, + 12885, 6442, 11274, 0, -22012, -12348, + }, + { + -161061, -3878356, 265214, 394063, 11811, -30602, -223338, -104153, -73014, 64425, + 162135, 365072, 582505, 1102733, -594853, 117575, -243203, 30065, 355945, -3303904, + -636192, 755914, 409096, 1046898, 380641, -863825, 704912, -936840, -1151588, 1169842, + 845035, 381715, -38655, -42950, 26844, 121333, 120259, -104690, -108448, 34360, + -51003, 308701, 162135, 83752, -3758, -96100, 46171, -4295, -236223, -104690, + -178241, -119185, -84826, -124017, -212064, -32749, 137976, 11274, 122943, 44023, + 23085, 11811, -71941, 35970, -75699, -6979, 20401, -77846, 73551, 103079, + -34360, -2147, 57445, 2147, -74088, -85899, -33286, 4295, 6979, 61740, + -44560, 70867, 55298, 23622, -41876, -16643, -537, 3758, -9664, 12885, + 33823, -18790, -56371, 11274, 40265, 26844, + }, + { + -4355097, -24457692, -4523675, 929860, 142271, -103616, 46708, 271120, 195421, 11274, + -345745, 296353, 33823, -485331, -1074, 477815, -30602, -303332, 623844, 103079, + 193810, -144955, -69793, 100395, -223875, 85362, 22012, 74088, 284542, -139050, + 271120, -331786, -153545, 199179, -329639, -71941, 165893, -554051, -92879, 207769, + -17717, 229781, 352187, -79457, 141197, -9127, 368293, 124017, -156766, 24696, + -139050, -158377, -147640, 100932, 2147, -62277, -129923, 16643, -90194, -47782, + 48318, 38118, -49392, -56371, -107374, -95563, -119722, 67646, -19864, -17717, + 159451, 10201, -153545, 10201, 48318, -35433, -24159, 17717, -44560, -50466, + 52076, 26307, -15569, -5369, 51003, -54761, -33823, 6442, 6442, 16106, + -17717, 26844, 9127, 1074, -18790, 1074, + }, + { + 44560, -1167694, 519691, -60666, 49392, 72478, 22012, -51540, -289910, 48318, + 469225, 469762, 481036, 555125, -2050847, -1059246, -570157, 1035624, 294205, -55298, + 804770, 61203, 909459, 529355, -103616, 1215476, 568546, -772557, 362388, 257698, + 292058, -322659, -207769, -204011, 228707, 40265, 38118, -29528, -405874, 404264, + -188442, 277025, 99321, 136902, -297427, 75162, -57982, 232465, -103079, -191126, + -147640, -74625, -111669, -119185, -28454, 97711, -77309, -153545, 125628, 76773, + -166430, -134218, -22549, 42950, 46708, -54224, -96637, -13422, 112206, 20401, + 18790, -27917, -16643, -62814, -11274, 14496, -28991, -18254, 32212, -20401, + 69256, 56371, 9127, -42413, -57445, -20938, -26307, 0, -6979, -23085, + 18790, -12348, -5369, 38655, 22012, 10737, + }, + { + 1471563, 21814138, 658204, -1963337, -190589, -14496, 408022, 519691, -293668, -271120, + 813896, 447213, 134218, -1540283, 989990, -673773, -359704, 66035, -38118, -370441, + -585726, 14496, -438624, -82678, 259846, 294205, -167504, 6442, 368830, -242129, + -77309, -90731, 64961, 291521, 20938, -224949, 446140, -488553, -130460, -141734, + 184684, 20938, -11811, -159451, 67646, -3758, -220117, 64425, 168041, -499290, + -220654, 108985, 40265, 105227, 297427, 91805, -149250, -81604, 111132, 92342, + -1074, -5906, 16106, 39728, 91805, -21475, -78920, 35970, 11811, -13959, + 81604, 105764, -2147, 45097, -9127, 46708, -64961, -17717, -30602, 19327, + -25770, 49929, 43487, 5369, 40802, -5906, -38655, 2147, -7516, 2147, + 30602, 13422, 24159, -34360, 3758, 26844, + }, + { + 368293, 4624606, -1622961, -463856, -83752, -914828, 603980, 696858, -214748, -11811, + -543313, 604517, -109522, -667867, -665183, -62277, 1370095, -1326608, -1644973, 651224, + 525060, 1074, -498216, -275415, 381178, 494458, -45634, 82678, 133681, -91268, + 22012, 34897, -270583, -413927, -6979, -344134, -370441, -153545, 206158, -160524, + 96637, 52613, 148713, 199716, -191126, 47245, 79457, 56908, -22012, -153545, + 31139, -31139, -79994, -24696, 169114, -30065, -40265, -3758, -104690, -49392, + 54224, 69793, 48855, -35970, -537, -62277, -32212, -111132, -79457, 140123, + 3221, 23622, 49392, -26307, -6442, 22012, 4295, 10201, 30065, 42413, + 38118, -13959, -26844, -537, -47245, -6442, 47782, -1611, 9664, -25233, + 9664, 537, -14496, -6979, -24696, 18790, + }, + { + -343597, 25534118, -369904, 2426120, 379031, 1231582, 4049617, 281857, -231928, -368293, + -97711, -93416, -20401, -437550, -635118, 401579, 204011, -1121523, -98784, -483184, + 84826, -387621, -99321, -154619, -270583, -204548, -95563, -112743, -410169, -42950, + -156766, 146566, -11274, -103079, -85899, 82678, -68183, -297427, -73551, -85899, + -121333, 118112, -84826, -118648, 196495, -33286, -69256, 31139, 104690, 99858, + 30602, -13959, -40802, 198105, 100932, 57445, -147103, -93416, 15569, 93416, + 0, 104690, -6442, 7516, -26307, -49929, 19327, -18254, -42413, 5369, + 16106, -25770, -42413, -53687, -22549, -30602, 24696, 92879, -9127, 51003, + -52613, -45634, 50466, -71404, 2147, -40265, -2684, 18790, 13422, -11274, + -35433, 7516, 34897, -6442, -49392, -1611, + }, + { + -322123, -1656784, 547071, -58519, -28991, 158377, 47782, -146566, -191126, 242666, + 142808, 85899, -1613834, -2299418, 1495186, -828392, -783295, -762357, -151398, 489089, + -267899, -1502702, -1095217, 301721, -20938, 462246, -1015760, 23622, -804770, 716186, + 579284, -208306, 180926, 358630, -337155, -214748, -241592, -153008, 102005, -147640, + -57982, 216359, -192200, -221728, -85899, -176631, 175020, -157840, 231928, -148176, + -132070, 33286, -88584, 3221, -11811, 92879, 176094, 222265, 1074, -18254, + -113280, -66572, 74625, 71941, -42413, -86436, 132070, 6442, 44560, -22012, + -46708, -16106, -61203, -77846, -17717, -51540, 20401, 78920, 31675, 19327, + -18254, 24696, 28454, 11274, -12885, 23085, 37581, -23085, -18254, -16643, + -9127, 8590, 6979, 19327, -27380, -1611, + }, + { + -23085, 2976412, 231928, -890669, -145492, -904091, 1598265, 795643, 893890, -355409, + -832687, 79457, -1022739, 511101, -475131, 363998, -267899, -471373, 155156, -624918, + 260382, 239981, 335007, 626528, 123480, -61203, -175020, -25233, 260919, 258235, + -239981, -328565, 63351, 186831, -22012, -200790, 132607, 166967, -266825, 197032, + 200790, 241055, 265751, 142808, 113817, -45634, 6979, 103079, -166430, -136365, + 178778, -18254, 252866, -215822, -112206, 68719, 20401, 221728, 72478, -115427, + 86436, -6979, 86973, -78383, 8053, 68719, 12885, 26307, -105764, -25233, + 58519, 21475, -33823, -32212, 18790, 12885, -6979, -44023, -3221, -42413, + 67109, 27380, -45097, -101469, -16643, 83215, 82678, 19864, 5369, 537, + -5906, -19864, -44023, 2684, -17717, -28991, + }, + { + 90194, 2950106, 1069984, -1014149, -370441, -85899, -28454, -311385, 144418, 535797, + 354335, 271657, -256624, 6514392, 2556043, 2766496, -2051384, -936840, -132607, -82141, + 570694, -64961, 311922, 181462, -89121, -1117228, -223338, 852551, 127238, 1355062, + 157303, 324807, -442382, -245350, 782758, 215822, -161598, 77846, -424665, 70867, + -129923, -83215, -3758, -158377, -137439, 11274, -268435, -75699, -98784, 8053, + -49929, -154619, 106300, 2147, 18790, -66035, -71941, -27917, 45634, -52076, + -85362, 81604, 34897, -64425, 4832, 117038, -10201, -148713, 27917, -3221, + 98784, 8590, -57982, 9664, 16106, -20938, 34360, -69793, -79457, -57445, + -67646, 70867, 18254, -18254, 51003, 537, -18254, -27917, 28991, -31675, + -56371, 537, 46708, -3758, -16106, 39728, + }, + { + 1328756, -488553, 199716, 2279554, -905701, -1163936, 212601, -511101, -44560, 295816, + -828929, 901406, 213675, -1137093, -1715839, -292058, 1059783, -139050, 108985, 192737, + 52613, -357556, -427349, -199716, 286152, 27380, -124017, -271120, 519691, 70330, + 238371, -478889, 171262, -12348, 124554, 273804, -51540, -469225, 6442, 45634, + -117575, 304943, 354335, 128849, -180389, 152471, 12348, -8053, 81604, -168041, + -51540, -35970, -56908, 115427, 148713, 151934, 133681, -54761, 93416, 105764, + -35970, 98784, -76773, -74088, -27380, 51540, -9664, -53150, 67646, -25233, + 11274, 57982, -129923, -113280, 22549, 64961, 32749, -8053, -49392, 45634, + -14496, -80531, -8590, 5369, -2684, -1611, -2147, -79457, 23622, 18254, + 12885, 30602, 3221, -9127, -27380, 30602, + }, + }, + { + { + -190589, -149250, 62814, -205622, 321049, -168577, 22012, 271657, -250182, 85362, + -300648, 468688, -864899, -187905, 351114, -341987, 1212255, -458488, -599148, -679679, + 937914, -98247, 108448, 130460, -301185, 258772, -13422, -272730, 411243, 780073, + -948651, 726386, -569620, -513249, 642098, -695248, 196495, -313533, -315680, 60666, + 32749, 149787, -67646, -33823, 15032, 190052, -104153, 133144, 192200, -201863, + 143881, -395674, -132070, 57982, -218506, 54761, 177704, 36507, 112206, 176094, + 128849, -84826, -37044, 81604, 69793, -22012, -120259, -19864, 53150, -25233, + -6979, 8053, -42950, 77846, -34897, -31139, 28991, 49929, -16643, -16643, + -26307, 56908, 7516, -23085, -64425, -15569, 32212, 10201, -30065, 13422, + 25770, -36507, 9664, -22012, -3221, 17180, + }, + { + -5369246, -12867722, 947040, -1560147, 1045825, 245887, -608275, 266288, 892816, -16643, + -94489, 406411, -295816, 832687, -205085, 315143, 930934, -60130, -577673, -265751, + -67646, -405874, 244813, 245350, -124554, -245350, -4295, 708670, 22012, 383326, + -238908, 338229, -566399, 100932, -107911, 190052, -672162, 121333, 58519, -140123, + 245350, 204011, -10201, 107374, 40802, -186294, 300648, -322123, 277025, -172872, + 185757, 64961, -144955, -154619, 11274, -38655, 75162, -101469, -100932, -34360, + 31675, -48855, -5369, -67109, -33286, 24159, 160524, -26844, 19327, -117575, + -33823, 15569, 32749, -38118, -61740, 104153, -58519, 11811, 44023, 42413, + 9664, -17180, 28991, -13959, -24159, -49929, 86973, -50466, 19327, -23085, + -9664, -6442, 26307, -23085, 7516, -20401, + }, + { + -2553358, 10747082, 4946192, 1449015, -1114544, -374199, 17717, -306016, 62277, -49392, + -44560, -106837, -42413, -301185, 1515050, 172336, -676457, 1182190, -466004, -769873, + 55298, 357019, -27917, 563178, 402653, -46708, -144955, -345745, 179852, 300648, + 122943, -197569, -61203, 13422, 149250, -33286, 100932, -144955, 74088, -122943, + 74088, -159451, 244813, 12885, -76236, -215285, 130997, 58519, -113817, -197569, + 54224, 81068, 118112, -173409, 60666, 154619, -41339, -153008, -56908, -15032, + 162672, -44560, -99858, -45097, 33823, -41876, -35433, -1611, 132070, 53150, + -51003, 17180, 55835, -15569, -51003, 16643, 1611, 5906, 537, 18790, + 68719, -19864, -2147, -77309, 40802, 19327, -25770, 21475, 3758, 22012, + 36507, -33286, -6442, -15569, 8053, 7516, + }, + { + -205622, 4407710, 564788, -142808, -250719, 19864, 27380, 85899, -32212, -37581, + 11811, 264141, 278636, -149250, 1712618, 1607392, 1357747, 851477, 118648, 415538, + -484794, 223875, 799401, -214212, 492311, 999117, -179315, -1245541, -1220845, 807991, + 351650, -96100, 128312, 250719, 202937, 448824, -358093, 352187, 172336, -311385, + -170725, -30065, -11274, 59056, 285078, -25770, -62814, 125091, -50466, -61740, + -13422, 158377, -47245, 23622, -180926, -199716, 68719, 111132, -118112, -51540, + 106837, 80531, 0, -64425, -52613, 51003, 9664, 13422, -6979, -47782, + -33823, 45097, 110059, 2147, -37581, 79457, 16643, -34360, -15569, -37581, + -1074, 33823, -31139, -13959, -71941, 11274, 39192, 23085, -6979, -28454, + 20938, 28454, -28454, -13959, 11274, -22549, + }, + { + 3368328, -8106751, 3781182, -52613, 328565, -294205, -71941, -258235, 168577, 680215, + 212601, -943819, 102005, 894964, -419833, 848256, -488016, 1849520, 593779, 221728, + -75699, -259309, 173946, -501974, 926639, -429497, 45097, -229781, 372052, 117038, + -99858, -12348, 103616, -79457, -54224, -38655, -19864, 125628, 22012, -190052, + -23085, -78920, 150861, -59056, -23085, -147103, -51540, 147103, -24696, 11811, + 135291, 98784, -319438, -92342, -30065, -69793, -98784, 50466, -4295, 194347, + -85899, -45097, 53687, -67646, -82141, -13959, -41339, 87510, 57982, 18254, + -50466, -26307, 59056, 100932, 51003, 15032, -4832, -34897, 1611, 11811, + -54224, 6979, 4832, -50466, -15569, 17717, 13959, -8590, 11811, 38655, + -22549, -5906, 3758, -8053, 21475, 19327, + }, + { + 398895, -1454383, -341987, 236223, -40802, 89121, 41339, 68719, 15569, -106300, + -246961, 84826, -430570, -1096290, 522912, 1774358, -1592896, -448824, 1173600, -1761474, + -755377, 205085, -648003, -266288, 115964, 104690, 807454, -769336, -89121, 332860, + -579284, -139586, 233539, 140660, -230318, 199716, 80531, -425202, -100932, 2147, + 256087, -152471, 86973, 145492, -200253, -77846, -63888, 95563, 24159, 146566, + 83752, 5906, -78383, 129386, 146029, -70867, -36507, -20938, 59056, -2684, + -1611, 85899, -13422, -10201, -11274, -51003, -3221, -16106, 18254, 65498, + 51540, -9664, -33823, 3221, 31139, -19864, 16106, -86973, -28991, 4832, + 4295, -19864, -10201, 22549, 33286, -12885, -11274, 15032, -12885, -34897, + -6979, 37044, 20938, -33823, -8590, -20401, + }, + { + 1765232, -5708549, 2599529, 245887, -6979, -301185, 95026, -311922, -390305, 308701, + 86973, 121870, -24159, 27917, 297963, -711891, -221728, -196495, -387084, 276489, + 424128, 328565, -84826, -149250, -229244, -1611, 282394, -215822, 31675, -355409, + 259309, -108985, -294742, 173946, -394600, -231391, 240518, -228170, 108448, 177704, + -230318, -190052, 184684, 86973, 14496, -114354, 93952, 246961, 537, 49929, + 136365, -153008, 92879, -23085, 27917, 38118, -139586, 82141, 9127, -55298, + 5906, 537, -10201, 35433, 31675, 41876, -76236, -46171, 51003, 14496, + -26307, 98247, 53687, -55835, -39192, -5906, 47245, -30065, -13959, -6442, + -83752, 34897, 1074, -93952, -19327, 51540, -17717, -17717, 1611, 45634, + 23085, -22549, 17717, -8053, -2147, 6979, + }, + { + 357556, -293668, -1051193, -27380, -211527, 32749, 19327, -36507, 26844, -103616, + -69256, -31139, 64961, 316754, 1174674, 2641405, -223338, 1658394, -170725, -741419, + 95026, 2684, -316217, 10737, -67109, 1091995, 1072131, -572841, 407485, 406411, + -73014, -194347, 315680, -257698, 174483, 280784, 4295, -144418, -505732, -84289, + -277025, 267899, -171262, 20401, 537, 126165, 92342, -213138, 83215, 326954, + -117575, -120796, 79994, 201863, -104690, 48318, -8053, -222801, 3758, 247497, + -81604, -34897, -89657, 2147, -1074, 73551, 99858, -19864, -29528, -25233, + -11274, -60666, 22012, 32749, -41339, -37044, 30065, -18790, -25233, -4832, + -35433, 33823, 14496, 22012, 49929, -18790, 19864, -36507, 8590, 10201, + -37581, -2147, -2684, 10201, 8053, 1611, + }, + { + 54761, 18606872, 965294, -1501091, -249108, -136365, -124017, -340376, 597537, -173409, + -703838, 261993, 319975, -661425, 395674, 759672, 93952, 53150, 261993, -62277, + -468688, -321049, 78920, 70330, -98784, 599685, -402653, -123480, 583579, -278099, + 214748, -296890, -63888, 122943, 48318, 16643, 682900, -128312, 274341, -102005, + 249645, -219043, -140123, -246424, -272730, 182536, -345745, -492311, 331786, 9127, + -44023, 127238, 185757, 121870, -41876, -42413, 45634, 88047, -106837, 86973, + 151934, -60666, -16643, -106300, -55835, 181999, 64425, -54224, 3221, 15032, + 9664, 94489, 47782, -36507, -51003, -69256, 92879, -34897, -50466, -7516, + 38655, -11274, 10201, 14496, 27917, 32212, 35970, 3758, -41876, -15569, + -14496, -537, 7516, 26307, -36507, 23622, + }, + { + -366683, 4340602, -542777, -1159641, 642635, 458488, -251792, 311385, -53150, 191126, + -737661, 188979, 710817, 486942, -295816, -1367410, 891743, 85899, -987843, -1295470, + 388695, 491237, 78383, -365609, -237297, 162672, 171262, -205085, -274878, 309238, + -372588, 548145, -185220, -253940, 149787, -194347, -235686, -342524, 74088, -121333, + -137439, -122943, -78383, 102005, 260919, -153545, -6442, -132070, 196495, 160524, + -25770, -100395, -73551, -144955, -41339, 266825, -537, 74088, -49929, -91805, + 9664, 32212, -30602, 62814, -33823, 68719, 114354, -61740, -61203, -67109, + 2684, 2684, 537, 106300, -20401, -45097, 25233, 45634, -10201, 8590, + 44560, 12885, -18254, 2684, -6979, -51540, 3221, 22012, 11274, 28991, + -36507, 19864, -19327, 12885, -10737, -20401, + }, + { + -1061931, 21522618, -4050691, 272730, 280247, -1256815, -1772748, 228170, 284542, 293668, + 195958, 352724, -39728, -187905, -695248, -247497, -318901, -583579, 279173, 148713, + -76773, 5906, -199716, 184684, -321049, -174483, 121333, -54761, -49392, 187368, + -237297, 34360, 277025, 244813, 44560, -489089, 394600, -337692, -111669, 198642, + -392990, -340376, 115964, -66572, 285615, 99321, 30065, -38118, -137439, 123480, + -42413, 30065, -12885, -80531, -3221, 84289, 83752, 149250, -120796, -3758, + -26844, 105764, -2684, 40265, 59593, -140123, 47782, 1074, 42950, -4832, + 18790, -1074, 55835, 3221, -85362, 3221, -62814, -20401, 21475, -13959, + 9127, -15569, -2147, 66035, -19327, 38118, -69793, 14496, -42950, 1611, + 15032, -7516, -10737, 11274, 24159, -29528, + }, + { + 296890, -1879585, 118648, -398895, 72478, -443455, 193274, 148713, -184147, 241055, + 3758, -328565, 1369021, 2039036, 980326, -919660, -64961, -166967, 52613, 59593, + -789737, 1499481, -181999, 617402, -1181653, 234076, 38655, 659814, -644245, 646393, + -571768, 249645, -37044, 674847, -30065, 63888, -102542, 215285, -405874, 8590, + -238371, 51003, 121333, -242666, -164819, -110059, 95563, -17717, 165356, -12348, + -33823, 6442, 107374, 2684, -52076, -121333, -57982, 165893, 190052, 17717, + 81068, -115964, -83752, -11274, 104153, 51540, -82678, 83215, 1611, 53687, + -24159, -41339, 27380, -37044, 17180, 12885, -28454, -38655, 1074, -14496, + 59056, -23622, -23622, 48855, 6979, -5369, 11274, 24696, 10737, -6442, + 13422, 21475, -27380, -17717, 15569, 0, + }, + { + -632434, 1116692, 2843268, -1297617, 445066, -1021665, -1131724, -308164, 19327, 601295, + -17717, -130460, -299037, 1023813, 532576, 267362, 265214, -95026, -138513, -116501, + -497142, 473520, -115964, 249645, -127775, 93952, -439697, -40265, -1611, -195421, + 139586, -254477, 47245, 421981, 511101, -179852, -153545, -5906, 136365, -152471, + -240518, -45097, 327491, 61740, 304406, 48318, 177704, -252866, 306016, 96637, + 90194, -85899, 111132, -70867, -91268, -126165, -72478, 72478, -8053, 69256, + -27917, -26307, 33823, -29528, -77846, 0, -2684, 79457, 76236, -46708, + -78920, 85362, 38118, -62814, -22012, 26307, -23622, 55298, -31139, 0, + -81068, 52613, 28991, -8590, -20938, -76236, 22012, 59056, -16643, 12885, + 25770, -1074, 13959, -32749, 11811, -17717, + }, + { + -266288, 1387811, 832687, -201863, -4295, 159988, 146029, 152471, -104153, 122943, + 370978, -135828, 724239, -674310, -15247134, 417149, -639413, -393526, 879395, -550293, + -440771, -751082, -127238, 51540, -415538, -543313, -1204202, 471910, -480499, 601295, + -42413, 30602, 87510, 324270, 167504, 324270, 57445, 49392, -103616, 102005, + 222801, -111669, -262530, -8053, 18254, -22549, 73551, -92342, 30065, -61740, + 175557, -255551, -30065, -96100, 48318, -9664, -17717, 55298, 30602, 33823, + 54224, -148176, 13959, -9127, 29528, -61203, 168041, 45097, -13959, -46171, + -23622, -25770, 49929, -19864, 38655, -7516, -81068, 84826, -30065, 63888, + -12348, -55835, -2684, -5906, -24696, 33286, 51540, 54224, -40802, 44560, + 0, -32212, -11274, 32749, -1074, -33823, + }, + { + 7516, -3463354, -949725, 1935957, 22012, 898185, -89657, -426276, 322659, 492311, + -288837, -62277, -278099, 792421, 1911797, -246424, 158914, 195421, -259309, 126165, + 734439, 162135, 131533, 82678, -381178, 144955, -171262, -1283658, -139050, -486942, + 302258, -348966, -66035, -40802, -384400, -141734, 189515, -9127, -264677, -165893, + -145492, 45634, -17180, 82141, 112206, -2147, 48318, 154619, -35433, -163746, + 63888, 79994, -46171, -145492, -9664, -105227, 69793, 66572, 4295, 70330, + -20938, 31675, -20401, 48318, -32212, 42950, 83752, 45634, 57982, 16643, + -60666, 57445, 60130, -6979, -76773, -25770, 5369, 9664, -46171, 15032, + 21475, 19327, -24696, 2147, 12885, -10201, 6442, 34360, -73551, 36507, + -10201, -16643, 27380, -3758, -2684, 8053, + }, + }, + { + { + 644782, 239444, -526134, -1211718, -108448, 30602, 33823, 62814, -52613, 123480, + -143881, 249108, -158914, -1071058, 142271, 34360, 978179, 83215, -54224, -214748, + 26307, 225486, 113817, -140660, 22549, -290984, 25233, 86973, 363998, 525060, + -955093, 528818, 7516, -449898, 146029, -24696, 151934, -697932, -534187, -331249, + 359167, 14496, -29528, -40802, -18790, 150324, 26307, -35433, 135291, -146566, + 145492, -235686, -152471, 42413, -75162, -22549, 30602, 28991, 43487, 161061, + 94489, 51003, 62814, -53687, 102005, 3221, -68183, -6979, 103616, -2147, + -20401, -24159, -17180, 34897, 42413, -9664, 17180, 28991, 51540, -14496, + -17717, 48855, 62277, 3221, -41876, -3221, 12348, -6442, -11811, -40802, + 26844, -11274, -11811, -14496, -15032, -537, + }, + { + 4608500, -19887846, -3893388, -1568200, -99858, 290984, -321586, -606664, 428423, 444529, + 136365, 359704, -537, -206695, 283468, 406948, 267362, -127775, -419296, -99858, + -195421, -670552, 188979, 356482, -121870, -74088, 45097, 471373, 321586, 384936, + 165893, 105227, -566399, -252329, -46171, 253403, -216359, -162672, -192737, -46171, + 97711, 104690, 168577, 95563, 92879, -231391, 63888, -65498, -113817, 19864, + 40265, 169114, 147103, -134755, 59056, -78383, 89657, -49392, 17180, 25770, + 38655, -44023, 11274, -12348, -33823, -68183, 120259, 16643, 85362, -6442, + -57445, -55298, 44560, -16106, -88584, 23622, 15032, -22549, 16643, 82678, + 4832, -23085, 20938, 30602, -12885, -88047, 54761, -25770, 11274, -3221, + -10737, 12348, 21475, -19327, -2147, -20938, + }, + { + 1773285, 7306276, 1254667, 3101503, -268435, -164283, -19864, -149787, -193810, -400506, + -268972, -16643, 118648, 363998, -9664, -86973, 158914, 454193, -784905, -208843, + 35970, 395674, 228707, 371515, 134218, 156766, 20401, 67109, -337155, 164283, + -31139, -145492, 6442, -132607, -8590, -54761, 15569, 105764, 133681, -277562, + 90194, -92342, 434865, 86973, -25233, -170188, -100932, 242129, 230318, -91805, + -187368, 42413, 90731, -107374, 14496, 172872, 116501, -47782, -75699, -48855, + 132607, 93416, -86973, 22549, 78920, 31675, -19327, 99858, 23085, 87510, + -537, 32212, 22549, 14496, -18254, -5906, -18790, -28991, -17180, 53150, + 3758, 8590, 39728, -76236, -25770, 18254, -25770, -13959, 17180, -2147, + 30602, 537, 5369, -12348, -1611, 11811, + }, + { + 27380, 4027069, 8590, 101469, -73551, -102542, 48318, -17717, 137439, 40802, + -129386, 74088, 48318, 1043140, 688805, -96100, 1804423, 1431298, -97174, 55835, + -865973, 555661, 158377, 641024, 653372, -155693, 207232, -277562, -786516, -117575, + 497142, 356482, -242666, 244813, 206695, 282394, -7516, -6442, 313533, -132607, + -96637, 5369, 90731, -78383, 191126, 165893, 28991, 10737, 119722, -114354, + -107374, 229781, 26307, -71404, -18254, -141197, -72478, 191663, -120259, -108985, + -18790, 90731, 0, -8590, -25233, 15569, -8590, 33823, 42413, -77309, + -80531, 4295, 74625, 37044, -64961, 48318, 48855, 27917, -34360, -28454, + -20938, 38118, -26844, -11274, -54761, -29528, 30065, 16643, 33286, -8590, + 5369, 22012, 9127, -6979, 8053, 16643, + }, + { + -2166811, 2143189, 155693, 834297, -35970, -134755, -85362, -236760, 146029, -27380, + 992674, -201327, -68183, -268972, 455803, 136902, 195958, 702227, 565862, 390842, + -261456, 74625, 231928, -485331, 284005, -35970, -160524, 215822, 62277, -9664, + 216896, 55298, 122943, -167504, -44023, -103079, -249108, -173409, 158377, -397284, + -402653, -3758, 370441, -32749, -308164, 183073, 166967, 44023, -19327, 35433, + 207232, 195958, -194884, -123480, -210990, 63351, -255014, -7516, 89121, 59593, + -29528, -55298, 100932, -38655, -89121, -7516, -11811, 26844, 37581, 24159, + -12348, -49929, -9664, 66035, 83215, -10201, 51003, -54224, -6979, 64425, + -30065, 0, 16643, -59593, -44023, 18790, 5906, 12885, -13422, 9664, + -20938, -15032, -2684, -15569, 17180, 20938, + }, + { + 64425, 722628, -229244, -301721, 11274, -47245, 177704, 33286, 178241, -120259, + -148176, -191663, -410706, -911607, -111669, -79994, 245887, -818728, 1104880, -496606, + -1065152, -676994, -163746, -846645, -413927, 194347, -144418, -90194, -169114, 112206, + -570694, -277562, 307627, 496606, -338766, -37044, 155156, -239981, -157303, -96100, + 368830, -147103, 94489, 150861, -69256, -39728, -26307, -162135, 192737, 69256, + 174483, 53687, -117575, 18254, 236760, 24159, -69256, -19864, 8590, -7516, + -42413, 9664, 57982, -57982, 33286, -25770, -25233, 2684, -46708, -55298, + 44023, 43487, -48855, -9127, 64961, 38118, 62277, -21475, -8053, -42413, + 35433, -11811, -37044, -16106, 22012, 6979, -1611, -4832, 537, -12885, + -47782, 17717, 51540, -12348, -17717, -14496, + }, + { + 2001992, 1260573, -2493766, -907312, 277025, 51540, -44560, -140123, -154082, 96100, + 216359, -168041, -55835, -2684, 18790, -535260, 46171, 84289, -372052, -27380, + 121333, 145492, -239444, -65498, -11274, -238371, 440234, 56371, -328565, -307627, + 35970, 112743, 218506, -221728, -7516, -104153, -56908, -95563, 93416, 33286, + -120259, 537, -15569, 117038, -258235, 63351, -171799, 103079, 81068, -73014, + 49929, -29528, 82141, -183610, 76773, 100395, 5369, 48855, 90194, -1611, + -8053, 27917, -5369, 29528, 46171, 85899, 60666, -48318, 13959, -1074, + -56371, 13422, 90731, 7516, -42413, -11811, 59593, -34897, -537, -15032, + -66035, -15569, 27917, -19327, -72478, 51003, 33286, -4832, -22549, 5906, + 28991, -20401, -15032, -2147, -2684, 10737, + }, + { + 3758, 1437203, -724239, -57445, -195958, -70867, -57445, 22012, 170188, -65498, + -294205, -243203, -579284, 2423972, 1861868, -401579, -679679, 364535, -239981, 302258, + -1134408, -367757, -506269, 76236, 527207, -40802, 408022, 365609, -221728, 282394, + -63351, 46171, 301185, 40802, 13959, 54761, -4832, -140660, -345208, -207232, + -33823, 75162, -176631, -188442, 183610, 16643, 33823, -255014, 10201, 256087, + 0, -35970, 120259, 195958, 114354, 15569, 38118, -131533, -74625, 95563, + 68719, -27917, -19864, -23085, -35970, 43487, 75162, 19327, -54224, -59593, + -25233, -26844, 17180, 34897, -3758, -12885, 7516, 53150, -25770, 16643, + -54761, -11274, -5906, 17180, 60666, 537, 40265, -15032, -4295, 28991, + -29528, 0, 21475, -3758, 1074, -8590, + }, + { + -389231, 23291070, -2918430, -1061394, -186294, -11274, -96637, -545998, 489626, 237297, + -546535, -251256, -133681, -784368, 178241, 1197759, 478352, 122943, 77846, 2147, + -110059, -132607, -399969, 313533, -91268, 248034, 127775, -82141, 282931, -4295, + 104153, -296353, -133681, 13422, 147103, 409633, 155156, 1074, 314606, 90731, + -22549, -223338, -23085, -216359, -333397, 177167, 40265, -549219, -37581, 258235, + 52076, 151934, 132070, 132070, -186294, -54761, 57445, 82141, -61203, -46708, + 90194, 17717, -46708, -80531, -76236, 11274, 115427, -25233, 18790, 71404, + -32749, 12885, 55298, -43487, -13959, -69256, 52076, -26844, 12348, -46708, + 37581, -17180, -39192, 12348, -25233, 19327, 46171, 14496, 2147, -5369, + -32749, -15569, -2684, 43487, -23622, 11811, + }, + { + 185220, 3252364, 163209, -603980, -122943, 1233729, -271657, -288300, -42413, 115427, + -236760, -530428, 83215, 751082, -484794, -187905, -151934, 673236, 262530, -1117765, + -77309, 90731, -73014, -4832, -137439, 118112, 208306, -267362, -438624, 405874, + -511638, 266288, 67109, 17717, 47245, 76236, -66572, -30602, 85362, -81604, + -110059, -29528, -1611, -83752, 264677, -66035, -56908, -97711, 59593, 143345, + 137439, -15569, 10201, -45097, -185220, 185220, 37044, 57982, 1074, -17180, + -47245, -38118, -56908, 52076, -70867, 15032, 96637, 48318, 65498, -94489, + 12885, -18254, -61740, 76773, -10737, -31139, 0, -5906, -28454, -36507, + -6442, 3221, -537, 17180, 40265, -10201, -36507, 7516, -4295, 34897, + -16643, 5906, -2147, 7516, 20938, -15032, + }, + { + 1793149, 14520211, -123480, -1499481, 639950, -569620, -2124398, -294742, 198105, 133144, + 157840, 215822, 244276, -144418, -191126, -702227, -474057, -59593, 44560, 475131, + -98784, 304943, 2147, -234076, 102005, -22012, -120796, -150861, 220117, 16643, + 253940, -11811, 234076, -1074, 135828, -352724, 56371, 4295, -337692, 159988, + -69793, -268972, -80531, -69256, -19864, 123480, 90194, -3221, -94489, 5369, + -7516, 41876, 29528, -112206, -75699, -22012, 66572, 127775, -35970, -55835, + 4832, 18790, 15569, -2684, 27380, -71941, 1611, 5369, 33286, -537, + 6979, 21475, 63351, 70867, -4295, 3221, -22012, -61740, -2684, -31139, + 26844, 26307, -31139, 77309, -10201, 61203, -32212, -3221, -26307, -1074, + 20401, 3221, -30602, -8590, 42950, -537, + }, + { + -267899, -1523103, 115427, -185757, 82141, -220654, -82678, 162672, 5369, 68183, + -180389, -247497, 600222, 3711926, 430570, -1021129, -106300, 150861, 688269, -427886, + -693100, 1843615, 402653, 523986, -617402, -593242, -39192, 631897, -92342, 484258, + -606664, 193274, -164819, 108448, 323733, 34897, 76773, 186294, -253940, 188979, + -102005, -122407, 48855, 35970, -37581, -111132, -113817, 44023, 150324, 133144, + 74088, -31139, 10737, 37581, -25233, -92879, -150324, -49392, 2147, 16643, + 56908, -42950, -77846, -68183, 5369, 82678, -110059, 55835, -1074, 34897, + 25233, -10737, 32212, 40802, 34897, 43487, 3758, -44560, -40802, -17180, + 39728, -20401, -25770, 5369, 17180, -20938, -13959, 12885, 8590, 8053, + 7516, 22012, -4832, -16106, 12348, 10201, + }, + { + 598074, -2002529, 1171989, 468688, 416612, 1121523, -1450625, -683437, 53150, 547071, + 434865, -196495, 277025, -42413, 539018, 180926, 27917, 205085, -568546, 403190, + -88047, 218506, -89657, -24696, -91268, 486405, -98784, -22012, 90731, -130997, + 10737, 77846, 66035, 291521, 376883, 195421, -137439, -314606, 290447, -76236, + -251256, -179315, -26307, 133681, -81604, -161598, 171799, -306016, 146029, 106837, + 93416, 20938, 79457, 79457, 34897, -32749, 57445, -49929, -124554, 96100, + -17717, -8590, -37581, 4295, -67646, -88584, 32212, 11811, 74088, 41339, + -103616, 24696, 71404, 66572, -15569, 7516, -43487, 74088, 13422, 49392, + -70330, -33286, 22012, 61203, 20401, -71941, -51540, -5369, -31675, 1074, + 11274, -2684, 47245, 1611, 20938, 24159, + }, + { + 119722, 393526, -719944, 839666, 4295, 95563, 131533, 297963, 240518, -293132, + 24159, -26307, 129386, -3485903, -8586713, -1964411, 787590, -346282, 767189, -136902, + -639413, 79994, -391379, 102542, -355945, -51540, -539555, 417149, -900333, 41876, + -73551, 119185, 415001, 233002, -348429, 146566, -28454, -56371, 158377, -90731, + 150324, 24696, -132070, 34360, 32212, 8590, -13959, 23622, 41339, -52076, + 112743, -30602, -57982, -157303, 10737, -27380, -1074, 29528, -8590, 28991, + 97711, -16106, -45097, 42413, 71941, -42950, 114890, 140123, -26307, -8590, + -73014, -62277, 90194, -9127, -4832, 46708, -67646, 67646, 0, 22012, + 49929, -60666, -48318, -3758, -53687, -7516, 32749, 53150, -38118, 13422, + 45634, 8053, -25233, 17180, 26844, -44023, + }, + { + -994285, -2556579, 122943, 185220, 308164, 2216740, -347892, -227096, 331786, 136365, + 853625, -622770, -142271, 751082, 1335735, 347892, 335007, 644782, 31139, -51003, + 440234, -91268, 286152, 699006, -373662, -290447, -405338, -1101659, -47245, -370441, + 140660, -16106, -82678, -279710, -372052, -373662, -27380, 182536, -165356, -350040, + 79457, -5906, 4832, -22549, 203474, -65498, -77309, 185220, -7516, -19864, + 132070, 40265, 74088, -130997, -46171, -164283, 28991, 75162, 42413, -15032, + -7516, -34897, -15569, 31139, -10201, 20938, 46171, 19327, 3758, 67109, + -40802, -56908, 96100, 98784, -25770, -52076, -41876, -5369, 9127, -26307, + 11811, 57445, 10737, -16643, 2684, 14496, 3758, 76773, -33823, -12885, + 1611, -6442, 3758, 16106, 15569, -5369, + }, + }, + { + { + -566936, -1632625, 277562, -774705, -188979, 146566, -25770, -249108, 89657, 8590, + 69793, -25770, 585189, 457414, -106300, -807454, -204011, 149787, 801011, -137976, + -1015760, -244813, 337692, 115964, 423591, -277562, -324270, 175557, -226023, -137439, + -389231, -216359, 277562, -71941, -245350, -187368, 430570, -63351, -306553, -426276, + 123480, 68719, 79457, -98784, -231391, 159988, 69256, -224412, 24696, -304406, + 79994, -4295, -48855, -60666, 37044, 4832, -85899, 124554, -120796, -74625, + -21475, -35433, 81068, -39728, 27917, -14496, 49392, -54761, -34360, 60666, + 37581, -37581, 61203, -23085, 55835, -6442, 13422, -54761, 42413, 21475, + -3758, -2147, 11274, 20401, 52076, 42413, -16643, -36507, 14496, -537, + -43487, 26307, -9664, 22549, 10201, -24159, + }, + { + -2852395, -23443006, 877247, -88584, -125628, -56908, 271657, -506269, -365609, 101469, + 86436, -216359, 141734, -586800, 221728, 418222, -582505, 181999, 549756, -100932, + 61203, -180926, 28991, 104690, 34897, 411243, 251256, 141197, 36507, 118112, + -67646, 31139, -103616, -82678, -520228, 262530, 323733, 234613, -38118, -132607, + -369367, -116501, 188442, 154619, -23085, 48855, -155693, 253940, -281857, -41876, + 27380, -93952, 252866, 4295, 98784, 30602, -30602, 130460, 67109, 73014, + 25233, 68183, 30065, 50466, 51540, -87510, -35433, -53687, 47245, 119722, + 0, -19327, -43487, -24696, 23622, -110059, 69793, 1074, -25233, -15032, + -20401, 37044, -20401, 18254, 34897, 36507, -88047, 34897, -5906, 20938, + 7516, -537, -20401, 15569, -15569, 6442, + }, + { + -1238561, 2370822, -1915019, 911607, 1124208, 345208, -286689, 41339, -64425, 260919, + -83215, 66035, 190589, -646393, -1269163, -212601, -243739, -398895, -608275, -43487, + 297427, 70867, 537, -144955, -448824, 260382, 455267, 543313, -581968, -148176, + 128849, 102005, 82141, 262530, -105227, -231928, 38655, 53150, 404264, 68719, + -97174, 96637, 269509, 79994, 198642, 246424, -143881, 125091, 142271, 212601, + 32749, 7516, 42413, 12348, 11274, -5369, 40802, 110595, 16643, -13422, + -76236, 6442, 25770, 27917, -13422, 49392, -28454, 96637, -75162, 28454, + 41876, 9664, -537, -17180, 31139, -9664, -10201, -3221, 18254, -3758, + -37044, 8053, 1074, 15569, -13959, -15032, 22549, -35433, -21475, -537, + -25770, 27380, -13422, 19864, -13422, -8590, + }, + { + 150324, 4225711, -416612, -235149, 233539, -71941, -148713, -208843, 50466, 86973, + -67109, 168577, -95563, 512712, 1270237, -1640678, -1331440, 146029, -450972, 303869, + 150324, 137439, -485331, 1087701, -13422, -632971, -376883, 344671, 159451, -434329, + 194347, 440771, -384400, 109522, -328565, -241592, 438087, -237834, 81068, 215822, + -74625, 140660, 290447, -15032, 57982, -130460, 76236, 38118, 60130, 86973, + 146029, 17180, -17180, -38118, 48855, 147103, -12348, 4295, 56908, 7516, + -93416, -15032, 73014, -1611, 7516, 51003, -33286, -22549, 27917, 66572, + 37581, -100932, -24159, 16643, 11811, -32212, -11811, 24159, 23085, 26307, + 8053, -26844, 13959, -11274, 18790, -3221, -53687, -25233, 39728, 25233, + -7516, -28454, 10201, 35970, -9127, 16643, + }, + { + -783295, 5074504, -1029182, 649614, -102005, 103616, 208306, -241055, 212064, -335007, + 426812, 927176, -319438, -787590, 699543, -789737, 82141, 53150, -243203, 207769, + -286152, 338229, 98784, -85362, -512175, 253403, -101469, 948114, 314606, 89657, + 30602, -66572, -259846, 121870, 274878, 31675, 44560, -649077, 21475, 134218, + -233539, -12885, 81604, 31675, -271657, 34897, 250719, 87510, -10201, -45634, + -49392, 54224, 152471, 89121, -117575, 30065, 29528, 38118, -44560, -149787, + 61740, -44023, 1074, 52613, 12885, -33823, 52076, -9664, -68719, -18790, + 49929, 18254, -30065, -64961, 3758, 5906, -49929, 29528, -35970, 12885, + -12348, 20938, -20401, 44560, -38118, -23085, 2147, 4295, 3758, -27917, + 16106, -9664, -3221, 7516, -19864, -8053, + }, + { + -350577, 368293, 2035815, -233002, -11274, -118648, 4295, -1611, 168041, 102542, + 216359, -41339, 239981, -431107, -944893, -271120, 2349347, -218506, 270583, 644245, + 636729, -563178, -217970, 178241, -747861, -799938, -313533, -86973, -1247688, -380641, + -238908, -179852, -35970, 228707, -19327, -6979, 135291, 181462, 84826, -26307, + -151398, 197569, 90731, -22012, 238371, 128312, 46171, -246424, 53150, -89657, + 67109, 120796, 69793, -136365, 31675, 63351, -28454, -25770, -14496, 20938, + -45634, -100932, 54761, -9664, -29528, 5369, 13422, -11811, -6442, -64961, + -77846, 61203, 24696, -18790, -3758, -5369, 10201, 68719, 60666, -4832, + -37044, 49929, 0, -15569, -38118, 18790, 8053, -16643, 1611, 33823, + -3221, -38118, -20938, 24696, 3758, 5369, + }, + { + -4309463, -2993055, 865436, -1071594, -419833, 258235, -25770, 388158, 318364, -143345, + -127775, -125628, -359704, 471373, 386010, -274341, -56908, 131533, 493921, -317828, + -249645, -359704, -193810, 158914, -15032, -254477, 23622, 277562, -324270, -273267, + -73551, 80531, 540629, -235686, 244276, 171799, -176631, -193274, -31675, -31675, + -93416, 341987, 263604, -119185, -250182, 31675, -50466, -95026, -5906, 123480, + -195958, 71404, -20938, -170188, -9664, 12885, 26844, 6442, 40802, 35970, + 62277, 37581, -44560, 10737, -52613, -45097, 43487, 80531, -46171, -63888, + 64961, -81604, -108985, 62814, 20401, -30602, -7516, 11811, 7516, -31139, + 71941, -51003, -4295, 74088, -3221, -59593, 18790, 37044, 2147, -23622, + -24696, 30065, -13422, 11811, -16106, 6979, + }, + { + -353798, 338766, 826244, 166430, 244813, -45634, -97711, 70867, -21475, 108985, + 33823, -27917, -514859, 579821, 1474784, 159988, -499827, -423591, -562104, 1514513, + 91268, -438624, -84826, -128849, -339839, -916439, -449898, 222801, -198105, 27917, + 133681, 227096, -228170, -25770, 62814, -319438, -78383, 5906, -81068, 205085, + 67646, 8053, 61203, -44560, -67109, -172336, -131533, 248034, -189515, -152471, + 129923, -26307, -42413, -54224, 156229, 5369, 55298, 98247, 35970, -146566, + 4295, -71404, 99858, -12348, 27380, -38655, -87510, -537, 41339, -14496, + 13959, 28454, 3758, -22549, 27917, 25233, -59056, 51003, 31675, 1074, + 37581, -14496, -11811, -9127, -12885, 19864, -1611, 23085, -16643, -11811, + 35970, -4832, 4832, -3758, -3758, 2684, + }, + { + -1522029, 32075352, 3419868, -1165547, 234613, 142271, 137976, -31139, -373125, 95026, + 703838, -303869, 100932, -1085016, 903554, -48855, -55835, 162135, -248571, -237834, + -136365, 287763, -795643, 215285, 257161, -286689, 138513, 194884, 55298, -119722, + -117575, 9127, -151934, -179315, -252866, 17717, -111669, -86436, 141734, 336081, + -219043, 87510, 379568, -15569, -53150, -200253, 78383, 48318, -22549, 0, + -114890, 149787, -53150, 16643, 53687, 56371, -53150, -68719, 87510, -27380, + -18790, 46708, -33823, 47245, 63351, -165893, -24159, 66572, 13422, 23622, + 0, -6979, -39728, -4295, 24696, 49929, -74088, -16643, 12348, -12885, + -11811, 6979, -47245, 10737, -20401, -40802, -28991, 4832, 21475, 22012, + 15032, -18790, -3221, -24696, 17180, 8053, + }, + { + -54761, 2774549, -494458, 593779, -377957, -177167, 436476, 21475, -113280, 141197, + 178778, 268972, -387084, 91268, -996969, 626528, -114890, -512712, 137439, 858457, + 17180, -944356, -878858, 203474, 353798, 419833, -161061, -90194, -104153, 115427, + 148713, -117038, -110595, 166430, -2684, -63351, -171799, 108448, 229244, -70867, + -108985, -107374, 155693, 38655, -243739, 150861, -56371, 20938, -86973, -201327, + 217433, 166430, 88584, 161598, 85362, -106300, -72478, 3758, -15569, 64961, + 54761, 0, 38655, -13959, 12348, -69793, -63888, 12348, 44560, 73551, + -6442, -2147, -4832, -43487, 4295, 21475, -22549, -35970, -9664, -18254, + -27917, -36507, -13959, 13422, 17717, 29528, -1611, -26307, -16106, -18790, + 33823, -12885, 6442, -4832, 3758, 17717, + }, + { + -2270964, 9233106, 1473711, -871878, -233539, -117038, 1568200, 135291, -142808, -286152, + 57445, -234613, 86973, -62277, 429497, -535797, -242129, 45097, 161061, 294205, + 155693, -222801, 414464, -396748, 307090, 78383, -112206, 39728, -142808, -231928, + 472446, 212601, 34897, -348429, -30065, 153008, -406411, 102542, -144418, 68719, + 235686, 317828, -53150, -9127, -220117, -88584, -76236, -55298, 139050, -84289, + 30065, 8053, 63888, 154619, -77846, -77846, -111132, -120796, 108448, -1611, + 17717, 15569, 35970, -26307, -54761, 52613, -36507, -21475, -41339, 15569, + -12885, 5369, -25233, 24159, 71404, -20401, 67109, 30065, -55835, 9127, + -13422, 3758, 29528, -41876, 11274, -24696, 35433, -4832, 31139, -2684, + -20401, 12885, 6979, -15569, -15032, 26844, + }, + { + 177167, -1619740, -1167694, -245350, -198105, 242129, -142271, 86973, 8590, -64961, + -101469, 33823, -724776, 894427, 91268, -569083, 41876, -166967, 902480, -103079, + -731755, -375273, 390842, -232465, 656056, 455267, -627065, 224412, -57982, -191663, + 386010, 104690, 88047, -287763, 227096, -157840, 136365, -93416, 278099, 187368, + 141734, -2147, -185220, 177167, 100395, -111669, -24696, -171799, 21475, -31139, + 39192, 48855, -139050, 68183, 42413, 63888, -12348, -33823, -224949, -51003, + -120796, 4832, 18254, 8590, -96637, -51003, 93952, -44560, 15032, -17717, + -3758, 33823, -11811, 33286, 24159, 4295, 54224, 37044, -40265, 17180, + -33823, 25770, 33823, -28991, 1074, -9664, -7516, -26307, -13959, -4832, + -17717, 537, 23085, 20401, -24159, 8053, + }, + { + -90731, -3186866, -1968706, 1378685, -118112, 1751810, 1313186, -61203, 390842, -455803, + -23085, -16106, -18254, -435939, -265214, 423054, -834834, 63351, -85362, -194884, + 679142, 72478, 105764, -54761, -15569, 284542, -31139, -315143, 68719, 298500, + -119185, 242129, 111132, -54761, -352724, 38655, 211527, -179852, 12885, 251792, + 68183, -110059, -117038, 398895, -248571, -118648, 52076, 8053, -222801, -111132, + -19327, -44023, 89121, -2684, 179852, 89121, 142271, 100932, -42950, -124017, + 4832, -22012, -7516, -33286, 12348, 10201, 30065, -39728, -47245, 62277, + 23085, -27917, -23085, 82678, 0, -1611, -20938, -33823, 32749, 2684, + 74625, -45097, -23622, 2684, 23085, 73014, -5369, -50466, -1074, -4832, + -15032, -19864, -13422, 35970, -3758, 29528, + }, + { + -1611, 310848, -1740536, 254477, -24159, 8590, 105227, 101469, 369367, -211527, + -212601, 106300, -946503, 267899, 4092030, 822486, 978179, -207232, 92879, -111132, + -158377, 767725, -19327, 722628, 797790, 198642, 440234, 82678, -791885, 111132, + -576599, 99858, 421981, 54224, 18254, -13959, -14496, -51540, -50466, 168041, + -209380, 4832, 130460, -98784, -24159, 114890, -291521, 82141, 31675, 117038, + -132607, 164283, 199716, -23622, 4832, -1611, -40265, -19864, 27917, -53687, + -68719, 171262, -36507, -40265, 15032, 90194, -104690, -13959, 20938, 17717, + 41876, -32749, -10201, 24696, -19864, 34360, 67646, -68183, -17180, -49392, + -8053, 39192, -17717, -3221, 19327, -38118, -28454, -42950, 31139, -40802, + 1074, 37044, 24696, -29528, 10201, 31139, + }, + { + 874026, 844498, 547608, -261456, -598074, -314606, -643708, -174483, 118112, -340376, + 651224, 226023, -65498, -783832, -1691143, -367757, 653372, 33286, 71941, -156766, + 13959, -198105, -9127, 247497, 110595, -28454, -243739, -331786, 389768, -11811, + 90731, 10737, 241055, -26844, -82678, -318901, -202400, -136902, 215822, -224412, + 100932, 176631, 192200, 47245, -39192, 119722, -134755, -117575, -45634, 3221, + 68719, 10201, 123480, 121870, 28991, 13422, 59593, -63351, 90194, -38655, + 25233, 53150, -46708, -53687, 12348, -27917, -86973, -2147, 24159, 10201, + 35433, -56371, -79457, 22012, 66035, 25233, -14496, -32212, 18254, 1611, + -34897, -35433, 45097, -8053, -17180, 16643, 10201, -15569, 68183, -15569, + 1611, 20938, -27380, 3758, -13422, -1611, + }, + }, + { + { + 140660, -340913, -1697049, 556735, -389231, -70867, 73551, -258772, -14496, -34897, + 89121, -86436, 634045, 523986, 185220, -445066, -318901, -173409, 227096, -135828, + -639413, -601832, 316754, 68183, 316217, 106837, -545998, 231391, -238371, -644782, + -28454, -278636, -310311, 393526, -176094, -157303, 242129, 348429, -119722, -231928, + -11274, -50466, 143881, -128312, -76236, 84826, 54761, -56908, -118112, -200253, + -53150, 23622, -30065, -111669, -60666, 6979, -6442, 132607, 51540, -156229, + -52613, -124017, 8053, 49392, -1611, -55298, 20401, -42950, -119185, 34360, + 72478, 18790, 24159, -10737, 18790, -2147, 2684, -32212, -27380, 8590, + 12885, -29528, -31139, -10737, 52076, 33823, 1074, -35433, 9127, 36507, + -32212, 11274, 6979, 7516, 18790, -4832, + }, + { + 1910187, -17331804, -5388574, -727460, -154619, -418222, 223338, 237834, 56371, -346819, + -1611, -268972, 22012, -54224, -562104, 565862, 120796, 44560, 484794, -100932, + 132607, 473520, -385473, -19327, 218506, 270046, 2684, 458488, -68719, -27917, + -222265, -236760, 199716, 173946, -466541, -70867, 337692, 311385, 149250, -259846, + -111669, -253940, 146566, 197569, -180926, 198642, -103079, 223338, -86973, 95026, + -31675, -261456, 55298, 75162, -26844, 56908, -27917, 120796, 44023, 18790, + -68719, 131533, 26844, 12885, 51003, 3758, -73551, -60666, -69256, 87510, + 40265, 2684, -27380, -62814, 77846, -52613, 8590, 35433, -5906, -62814, + -18254, 19864, -10201, 1611, 11274, 83752, -61203, 17717, -537, 2147, + 5369, 537, -26844, 12348, -11811, 12348, + }, + { + 1473174, -2912525, 136365, -1125281, 991064, 317291, -293132, -25770, -25233, 628676, + 6979, 100395, 97711, 28454, -1363115, -477278, -302795, -235149, -170725, -365609, + 281320, -248571, -8590, -310311, -180926, 83752, 458488, 237834, -310848, -138513, + 393526, 176631, -161598, 371515, 46171, -257161, -135828, 95563, 321049, 97711, + -187368, 48855, 179315, -69256, 84826, 403190, 67646, 27917, -98247, 96100, + 97711, 87510, 99858, 13422, -2684, 4832, -134755, 98247, 30602, 16106, + -112743, -79457, 27917, -50466, -44560, -6442, 20401, -17717, -7516, -16106, + 5906, -3221, -4832, -45634, 20938, 8590, 19327, 4832, 45097, 0, + -22012, 3221, -44560, 22549, 27917, -13422, 31675, 2684, -30065, 20938, + -32212, 4295, -13422, 4295, -9127, -12885, + }, + { + -126702, 4080219, 561567, -398358, 116501, 57982, -220654, -157840, -86973, 29528, + 69256, 147640, -70330, -367757, 2437931, 122943, -2320893, 75162, -872952, 478889, + 646393, -695248, 154082, 485331, -538482, 327491, -612033, -168577, 513785, -404801, + 130460, 186294, -263067, -68719, -103079, -181462, 42413, 66035, -59056, -40265, + 80531, 126165, 184147, 79457, -4295, -117038, -28991, 25770, 45097, 96637, + 255014, -60130, -85899, 45097, 2147, 88047, 84826, -52076, 51540, 72478, + -28454, -40802, 87510, 9664, -23085, 32212, 3221, -38655, -21475, 92879, + 76236, -35433, -25770, 9127, 26307, 1611, -55298, -27917, 18254, 42950, + 26307, -36507, 6979, -7516, 17180, 25770, -46171, -22012, 5906, 12348, + -4295, -28454, -15032, 33286, -12348, -7516, + }, + { + 4078608, 2597918, -4075387, 641561, -151398, 120259, 187905, -28454, 24696, 292595, + -342524, 457414, -156766, -264677, 307090, -554588, 240518, -93952, -6979, 1074, + -90731, 173946, -244813, 345745, -318364, 135291, 100932, 1125281, 44023, 112206, + 0, -220117, -384936, 256624, 86973, 227096, 105227, 29528, -56371, 72478, + 212601, -122943, -83752, 9127, -179315, -58519, 86973, 97711, -19864, 17180, + -142271, -60130, 56371, 140123, 32212, -58519, 176094, 7516, -44023, -109522, + 27917, -5906, -61740, 32212, 31675, -75699, 55835, 48318, -46171, -18254, + -12348, 75699, 37044, -39728, -45097, 30602, -84826, 15569, -19327, -31139, + 1611, -5369, -27380, 37044, 17180, -32749, -3758, -9664, 12348, 5369, + 25233, -3758, -2684, 21475, -16643, -14496, + }, + { + -31675, -762894, 1381369, 360240, -24696, -2684, -122943, 55298, 9664, 135291, + 197032, 37581, 410706, 507880, -682900, 600222, 629213, 663036, -437550, 1158031, + 541166, -171262, -654446, 1007170, -806917, -527744, -512175, -133681, -259846, -1026497, + -215285, -149250, 59056, -210453, 329102, 156229, -199716, 229781, 141734, 67109, + -288300, 208306, 141734, -65498, 87510, 147640, -1074, -33286, -79457, -25233, + -44560, 125628, 89121, -11811, -126165, 15569, -40802, 69793, -6442, 11274, + 33823, -98784, -6979, 40265, -53687, -27917, 60130, 8053, 46171, -2147, + -64961, -4295, 16106, 28991, -40265, -49392, -49392, 35970, 26307, 42413, + -43487, 24696, 30602, 11811, -28991, -3758, 5369, -537, -9664, 22012, + 34360, -25770, -54761, 8053, 8590, 11811, + }, + { + 3897683, -12349105, 139586, -1430224, -140660, 45097, -44560, 450972, 106837, -154082, + -266825, 115964, -88047, 231928, 222265, -53687, 56371, -241055, 650688, 49929, + -228707, -248571, -132070, 147640, -184684, -103616, -112206, 112206, -273804, 60666, + -76773, -79457, 353261, 60130, -95563, 147640, -37044, -58519, -354335, 9127, + 17717, 260919, 244813, -82678, 9664, -92879, 37581, 44560, -47245, 165893, + -125091, 39728, -42413, -63351, -38655, -68719, -5369, 30602, -62277, 4832, + 33286, 25770, -10201, -5369, -52076, -102005, -59056, 79994, -23622, -41876, + 63888, 0, -136902, 6442, 16106, -17180, -23085, 15569, 4832, -32212, + 71404, -10737, -36507, 13959, 45634, -46171, -33823, 31139, 22549, 9127, + -40265, 26307, 15569, 8053, 5369, -12348, + }, + { + -35433, -1182190, 307090, 473520, 135828, 30065, -90731, 61203, -74088, 2684, + 265751, 125628, 88047, 717796, 1357747, 180389, 195421, 258772, -424665, 607738, + 1403917, 281320, -402653, 581968, -642098, -1142998, -185757, -67646, -120796, 45634, + 384400, -130460, -73014, -214748, 168041, -171262, -171799, -89657, 70867, 84289, + 106837, 79994, 18790, 114890, -77846, -161061, -189515, 271657, 32212, -185757, + 537, -8590, -114354, -56371, -14496, 24159, -32212, 85362, 96100, -95026, + -44560, -40802, 26844, 15032, 44023, -17717, -62277, -59056, 52076, 34360, + 23085, 29528, -10737, -3221, -4832, 12348, -20938, -24696, 25770, -20401, + 52076, 10737, 14496, -6442, -30065, 25770, -30065, -2684, 8053, -31139, + 22012, 1074, -21475, 9664, 1074, 4832, + }, + { + 5156645, 31678606, -1579474, -839129, -367757, 46708, -246424, 459562, -300111, -342524, + 539555, 188979, 331786, 265751, 321586, -703301, -431107, 181462, -191126, -117575, + -320512, 206158, -374736, -235686, 198105, -228707, 18790, -62814, -64961, 77846, + -14496, -134218, 47245, -382789, -209380, -192200, -39192, 476741, -624381, 480499, + -204011, 293668, 137439, 85899, -53150, -132607, -98784, 107374, 157840, -134218, + -142271, -42950, -40802, 73014, 161598, 27380, -33823, -60666, 79994, 38655, + 16106, 3758, -39728, 69793, 96100, -49929, -92879, 40265, -9664, -1611, + 8053, 41339, -50466, 40265, -19864, 55298, -48855, -13959, -14496, -13959, + -24159, 37581, -4832, 13422, 9664, -12348, -35970, -30065, 2684, 0, + 35970, -6442, 0, -38655, 16106, 8053, + }, + { + 110595, 2412161, -448287, 434865, 64425, -836445, 108448, 434329, 115964, 70330, + 178241, 709743, -246424, 96100, -1117228, 137976, 347355, -492311, -686658, 821949, + 71404, -658204, -472446, -53150, 202400, 177704, -156766, -54224, 190589, 154082, + 31675, -119722, -132607, 137976, -202937, -38118, -350040, -73551, 133681, -146029, + -96100, -186294, 53687, 225486, -263604, 67646, 32749, -41339, 3221, -137976, + -25233, 171262, 9127, 125091, 245350, -140660, -25770, -2147, -39728, 19864, + 74625, 46171, 81068, 9664, 24696, 9127, -77846, -49392, -66572, 68719, + 2684, 18790, 59056, -55298, 8053, 4295, 4295, -15032, 17180, 24696, + 9127, -26307, -18790, -15569, -21475, 10737, 26844, -18254, -6442, -26307, + 29528, -9664, -5369, -6442, -17717, 9664, + }, + { + 2563559, 4845797, -1815697, 664109, -146029, 83752, 849867, 632434, 229781, -353261, + 83752, -97174, -78920, -106837, -204548, 195421, -259309, -206695, 37044, 17180, + 181999, -227633, 198642, -78383, 164819, -35970, -218506, 219043, -82678, -248034, + 118648, -33823, 244276, -224412, -284542, 346819, -169114, -168041, 111132, 45634, + -537, 236760, 119185, 27380, -54761, -92879, -114890, -68183, 74088, 34897, + 34897, -42413, 41876, 134218, 59056, -26307, -76773, -171262, 66572, 54761, + 35970, -3221, 75162, 1611, -69256, 53150, -17180, -10737, -62277, 18254, + 13422, -12885, -45634, -33286, 9127, -25770, 32212, 54761, -28454, 10201, + -9664, -26844, 45634, -54761, 537, -53150, 15032, 0, 23085, 4832, + -22549, -4832, 24159, 5906, -34360, 8590, + }, + { + -55298, -2142652, -327491, -496069, -261456, 169651, 16106, -97174, 78920, -15569, + -111132, 87510, -177167, -435939, -110059, 12885, -181462, -24696, 64425, 63351, + 532039, -1666447, 213138, -806917, 627065, 747861, 88047, -392453, -4832, -31675, + 355945, 139586, 394600, -149787, -103079, 47245, 18254, -187905, 308701, 22012, + 37581, 102542, -77309, -16106, 9664, 10737, 3758, -183073, -42413, -186831, + -66572, 166967, -77309, 60130, -23085, 99321, 75699, 67646, -67109, -16643, + -63888, -38655, -9664, 56371, -25233, -67109, 132607, -35970, 34897, -28991, + -26307, 27917, -45634, -6442, -19864, -23085, 19327, 42413, -3758, 32749, + -27917, 23622, 42413, -537, 6442, 5906, 11811, -18790, -13422, -12348, + -20401, -4832, 8590, 13959, -10201, -12348, + }, + { + -401043, -2404645, -103616, 82141, -262530, -197032, 2128156, 98784, 520228, -355409, + -674310, -39728, -390842, 536871, -426276, 525597, -779000, -89121, 128312, -510027, + 431107, 100932, 197569, 70330, 67109, -211527, -187905, -266288, -280247, 236223, + 38118, 95563, -16643, -26844, -305480, -202400, 271120, 42950, -44560, 178778, + 17180, 25770, 151934, 250719, 130997, 197569, -99858, 106837, -128312, -197569, + 50466, -122943, 59593, -42950, 16106, 44560, 54761, 132070, 58519, -125091, + -39192, -12885, 537, -28991, 24159, 101469, -2147, 19864, -62277, -22549, + 83752, 0, -68719, -13422, 5906, -26307, 24159, -48318, -9127, -41339, + 74625, 15032, -17180, -36507, -20401, 69256, 45097, 8590, 24159, 2684, + -12885, -537, -51003, 1074, -12885, -9664, + }, + { + 169114, 610959, -803159, -413391, -15032, 12348, 4832, 156229, 78920, 94489, + -82141, 9664, -859530, 1971927, 1235877, 1592896, 10737, 403190, 117575, -505196, + -233002, 345745, 221728, 522375, 645319, 186831, 219043, -159451, -122943, 136365, + -515933, 230854, 237297, 163209, 252329, 47782, 215285, -58519, -161598, 292058, + -178778, -164283, 77846, -99858, -52613, 52076, -187368, -75699, 50466, 175557, + -130460, 47782, 160524, 124017, -21475, 9664, -22549, -47782, 85899, -40802, + -122943, 56908, -10737, -33286, -40802, 78383, -73551, -92879, 22012, 537, + 47782, 12885, -54761, 22549, 18254, -35433, 84289, -65498, -25770, -32749, + -42950, 33286, 32212, -11811, 53687, -9664, -13959, -49929, 30065, -8590, + -32212, -2147, 32212, -18254, -20401, 40265, + }, + { + 9127, 1800128, 1819456, -665720, -391916, -2288681, 57445, 29528, -30065, -126165, + -93952, -17180, 269509, -916439, -1727114, -428423, 579821, -772020, 304943, -70330, + -52613, 46708, -163746, -289373, 294742, 168577, -79994, 410706, -566399, 249108, + 195421, -98784, 137976, 321586, -64961, -31139, -329102, -101469, 93952, 54224, + -130997, 201863, 181462, 121333, -84826, 114354, 73014, -164283, -161061, 5906, + 38118, -88047, 11274, 97174, 54761, 60130, 109522, -32212, 65498, 12885, + -4832, 68719, 21475, -60130, -10201, 3758, -75162, 51540, 26307, -48855, + 64425, 5369, -100932, -76236, 16106, 44023, 30602, -16106, -23085, 37581, + -15569, -79994, 21475, 28454, -18790, -2147, -1611, -66035, 45097, 21475, + -1611, 20938, -5369, -18254, -27917, -2684, + }, + }, + { + { + 18254, 4119948, 767725, 789737, 186294, -187905, 102005, 103616, -78920, 219580, + -51003, 71404, 90194, -128849, 601295, -289910, 582505, -333934, -128312, -84826, + 355945, -61203, -154619, -403190, -391916, -317291, -449898, 15032, -183073, -97711, + 224949, 405338, -790274, 385473, 264141, 61740, 4295, 108985, 175020, 135828, + 128849, -229244, 25770, -43487, 186294, 8053, -170188, 59593, 20938, 103079, + 93952, -49392, -42950, 62814, -137439, -132070, 48855, -55298, 159988, 52613, + 80531, -32212, -101469, 41339, 78920, -20401, -63351, -7516, -15569, -73551, + -537, 46708, -48855, 44023, 11811, 537, -13959, 45097, -23085, -42413, + 16643, 30602, 12885, -23622, -42413, -24696, 31675, -6979, -10737, 5369, + 45097, -21475, 12348, -26844, -12885, 16643, + }, + { + -1646046, -11676405, 5760088, 1074279, 496069, 82678, -69256, 226560, 437550, -487479, + -152471, -11811, -367757, 452045, -751082, -313533, 573915, -243739, -547608, -52613, + -134218, 414464, 171799, 205622, -1074, -154082, -428960, 402116, -47245, -261456, + -284005, -306553, -199716, 102005, 23085, -236760, -142808, 54761, 179852, -30065, + 353798, -172336, -82678, 120259, -38655, -194347, 25770, -42413, 20938, 188979, + 124554, 15569, -122943, -52076, -111132, -119185, 47782, -10201, 69256, -6442, + -38118, 2684, -17717, -30602, -20938, 51540, 40265, 537, -71941, -55298, + 14496, -41876, 64961, -30065, -16643, 96100, -53150, -13422, 15569, 24696, + 17717, -39192, 32749, 13422, -31139, -26844, 76773, -35433, 17717, -17180, + -3758, 19864, 14496, -25233, 1611, -10201, + }, + { + -1452236, -6629819, 1967095, -878858, -1494112, -199179, -62277, -227633, -69793, 95563, + -138513, 100395, -8590, 596464, -934692, -477815, 172336, 408022, 352724, -51540, + -14496, 0, -56371, -83752, 343061, -191663, -228707, -388158, -274341, -2684, + 455803, 14496, -373662, -328028, -102542, -92342, -235686, -20938, -8053, -188979, + -57982, -225486, 130460, -76236, -132070, 18790, 142808, 137976, -38655, -298500, + -144955, 195421, 199716, -41339, -15569, 87510, -103079, -123480, -73014, 64961, + 53687, -23085, -74625, -90731, 63351, -17180, 12885, -69256, 62277, 31675, + -22012, -5906, -4832, -31675, -47245, 1074, 9127, 2684, 6442, 41876, + 16106, 10737, 9127, -47245, 8590, 19327, -12885, 19327, -1611, 12885, + 27917, -13422, 6979, -29528, -3221, 11811, + }, + { + 99858, 3340948, 607201, 215822, -157303, 56371, -18254, -17717, -146029, -100395, + -57445, 23622, 415538, -266825, 427349, 800475, 42413, 84289, -1316408, 716186, + 264677, -783832, -197569, -267899, -112743, 574452, 112206, -164283, 244276, -569620, + -282931, -246424, 18790, -62277, 86436, 350577, -561030, 86973, 184684, -419296, + 129386, 83215, -64425, -56908, -15032, 220117, -42950, -6979, 179315, -34897, + 9127, 91268, -89121, -5906, 52076, -80531, 17717, 132070, -61203, -33823, + 17717, 24696, -15569, 40802, -25233, -45097, 0, 6979, -31139, -39192, + -18790, 92879, 43487, 2147, -40265, 74088, -7516, -13959, -38655, -3758, + 9664, 26307, -38655, 6979, -22549, 10201, 25770, 13959, 3221, -24159, + 5906, 31139, -16106, -8590, 6442, -16643, + }, + { + -5797132, -7437810, 65498, 1298154, -132070, -238371, -192737, 202937, -118648, 287763, + 9664, -360777, 159988, 210453, 140123, 280784, -116501, -413391, 238371, 95026, + 277025, -223338, -344671, -9664, 259309, -148713, 194347, 639950, -269509, -282931, + 84289, -46708, 31139, 21475, -354335, 46171, -187905, 659814, 176631, -325344, + 360777, -11811, 10201, -127238, 28991, 152471, -201863, -24696, 75162, 0, + 37581, 118112, -238908, 35970, -22549, -28454, -44560, -27917, 104153, 135291, + 14496, -1611, -14496, -104153, -64425, -22549, -31139, 74088, 32749, -8053, + -63888, -18254, 23085, 93952, -11274, -4832, 6442, -59593, 31139, 16106, + 1611, -16643, 12885, -59593, 19864, 8053, 3221, -13959, -22012, 37581, + -2147, -6979, -7516, 6979, 25233, 8053, + }, + { + 251792, 241592, -682363, -116501, 25770, 89121, 74088, 537, -50466, -50466, + -198642, 1611, -47782, -199179, 552977, 1120987, -1491427, 424128, -259846, 493921, + -469762, 198642, 358093, 1083406, -105764, 702227, 41876, 4295, 654446, 75162, + 316754, -351650, 219043, -186294, 151934, 214212, -85899, -121870, -179315, 47782, + 175020, -132607, 91268, 40802, -69256, 14496, -219043, 46708, 6442, 119185, + 50466, 46171, -49929, 136902, 28454, -28991, -37581, 125628, -17180, -12885, + 72478, -10201, -11274, 62277, 37581, -73014, -12348, -24696, 35970, 39728, + 62814, -4295, -47245, 18254, 8053, -18790, -10201, -41876, -55298, -10201, + 28454, -25233, -10737, 7516, 37044, -15032, -11274, 12885, -3221, -19327, + -3758, 34360, 15569, -26844, -9127, -10201, + }, + { + -831613, -19117974, 518080, -1165010, 529892, -62814, 52076, -39728, -434865, 34897, + -21475, 48855, 215285, 287226, 425739, -203474, 368830, -344671, -319438, 310848, + 138513, 275415, -135291, -41339, -344671, -93416, 105764, -99321, -53150, 61740, + 163209, 73014, 99858, 145492, -188442, 117575, 52076, 134218, -183610, 45634, + -76236, -170725, -55835, 122943, 52076, -26307, -114354, 175557, 53150, -10201, + 81604, -52076, 91268, 29528, 75162, -25770, -13422, 126702, -4295, -22549, + -46171, -38118, -3758, 4295, 19327, 2147, -52613, -57445, 32749, 9664, + -59593, 84289, 41339, -58519, -52613, 15032, 34360, -38118, 23085, 17180, + -49392, 32212, 8590, -59593, -6979, 69256, -36507, -23085, -3221, 37044, + 3758, -29528, 11274, -17717, 14496, -10737, + }, + { + 328565, -466004, -1939715, 317828, -103079, 1074, 33823, -18254, 22012, -160524, + -44560, 88584, 435939, -714575, 198642, 1511292, 446140, 1034013, -133144, -679679, + 565862, 1011465, -799401, 517544, 154619, -217433, 308164, -427349, -539018, -40265, + 212601, -155693, 312996, -285615, 137439, 307090, -4295, -221728, 121333, -117575, + 58519, 179852, -141197, 39728, 118112, -18790, 68719, -133681, 166430, 230318, + 2684, 3221, -31139, 89657, -198642, -39192, -20401, -68183, 32749, 133144, + -2684, 82141, -74088, 10737, -9127, 38118, 132070, -26307, -49929, 2684, + -1074, -40802, -17717, 63888, -22012, -3221, 49929, -39728, -10737, 3221, + -47782, -537, 18790, 19327, 17180, -12348, 1611, -46708, 21475, 5369, + -36507, 17180, -13422, 5906, 9664, -2147, + }, + { + -8273718, 19838454, 4256313, -399969, 260382, 74625, -443455, 65498, 531502, -230318, + -764504, 106300, 36507, 729608, -364535, 301185, -268972, -40265, -150324, 103616, + -91805, -42413, -537, -362925, -272194, 75699, -260919, -379031, 33286, 100932, + 318901, -345745, 108448, -376347, -31675, -333934, -241055, 620623, -678068, -79994, + -85362, 315680, -79457, 188979, -53150, 149787, -56371, -208843, 123480, 2147, + -64961, -301185, -100395, 9127, -102542, -37044, 61203, -30065, -132070, 5906, + 51540, -70867, -28454, -33823, -73014, 143881, 62814, -53150, -5906, 23622, + -47245, 57445, 30065, 16643, -19864, -64961, 56908, -16106, 0, -29528, + 5906, 3758, 9127, 13422, -537, 30065, 35433, -13959, -5369, -32749, + -8053, 13959, 1611, 22012, -24696, 6442, + }, + { + -172872, 951335, 229244, 197032, 406948, 479426, -560493, 31139, 206158, 38655, + -274878, 118112, 377957, 749472, -559420, -442919, 386547, 696322, -187905, -670552, + -129386, 24696, 525060, 69256, -236223, -150861, 194884, -15032, -180926, 268435, + -555125, 219580, 41339, 38655, -183073, 249108, 17180, -180926, -206158, -220117, + -44023, -54761, -97174, 62814, 223338, -181462, 45634, -160524, 56371, 84289, + -149250, 27917, -64425, -137976, -48855, 104153, 53687, 12885, -13959, -26307, + 3758, 20401, -39192, 54761, -35970, 117575, 79994, -5369, -22549, -98784, + -9664, -19864, 18254, 51003, -13959, -45634, 16643, 9664, 2147, 11274, + 33286, 27917, 15032, -12885, -4295, -30602, -6979, 14496, -1611, 23085, + -24159, 4832, -12885, 8053, -1074, -23622, + }, + { + -2381559, 803159, -77846, 485331, -9664, 1078037, -1561758, -175557, 425202, -3758, + -40265, 24696, 32749, 125628, -798327, 308164, -71404, -175557, -151398, 55298, + -55835, 380641, -119185, 88047, -187368, -27917, -95563, 21475, 187368, -12885, + -224412, -561030, 279710, 81068, -278099, -242666, 264677, -194884, 89121, 335007, + -121333, -278099, 98247, -13959, 144955, 66572, -56908, -2684, -173946, 50466, + 2147, -9127, 28454, -138513, 83215, 7516, 74625, 51003, -107374, -3221, + 12885, -22012, 27917, 55298, 61203, -44560, 3758, -6442, 2147, -13959, + 25770, 9127, 31139, -3758, -64425, 9127, -47782, -28991, 24159, -32749, + 34897, -12885, -32749, 54761, -27917, 26307, -37044, 5906, -34360, 9127, + 16106, -22012, -15569, 15032, 24159, -18254, + }, + { + 18790, -2539936, 122407, -300648, 152471, -353798, 4832, 124017, 29528, -132070, + -193274, -171262, 561030, 592706, -1624571, -371515, 693100, 95563, -1005022, -326954, + 474057, 195958, 454730, -319975, -409633, -130460, 567473, -340376, -302795, 473520, + -475131, 521839, 119185, 90194, -185757, -5369, -110595, 120796, -254477, 1074, + -94489, 75699, 268972, -83215, -126165, 110595, 33286, 26844, -12885, -42413, + -84826, 71404, 105764, 20401, -97711, -31675, -4832, 103079, 161061, 19864, + 118648, -33823, -83752, -5906, 111132, 103616, -25770, 71941, 1074, 14496, + 8053, -12885, 1074, -4832, -25770, 11811, -49392, -40802, 10737, -5369, + 38655, -11274, -4832, 28454, 15032, -4832, 11811, 24159, 12348, 7516, + 11274, 11811, -26307, -20401, 32749, -5906, + }, + { + 1060320, -861678, 2876554, -440771, -76236, -1340567, -792958, -195421, 235686, 531502, + -315143, -424128, 397821, 1240709, -310848, 68719, 90731, 179315, -70330, 161061, + -523986, 137439, -28454, 28991, 537, -30065, -111132, 96100, -232465, -172336, + 48855, -191126, -176631, -47245, 210453, -63888, -161061, 97174, 265214, -264677, + -291521, -58519, 199716, -111669, 173409, 128849, 17717, -199179, 190052, 10737, + 226023, -18790, -84289, 2147, -107911, -84826, -64961, -33286, 8053, 109522, + -26307, 26307, 11274, 33823, -82141, 2147, -33286, 59593, 64425, -77309, + -55298, 64961, 30602, -40802, -8590, -20401, 11811, 57445, -33286, -9127, + -68183, 34897, 32212, 22012, -28454, -63888, 6979, 55835, 2147, 8053, + 13959, 12348, 3221, -33286, 12348, -22012, + }, + { + -309775, 947577, 1041530, -55835, 34897, -68719, -172872, 250182, -402653, -336618, + 185757, 24159, 377957, 1493575, -5352603, 714575, -1074, -150861, 260382, -451508, + -216359, -188442, 168041, 294742, -26307, 577673, -607201, 211527, 330712, 6442, + -56371, 381178, -5906, 226023, -61203, 157303, 254477, 6979, 43487, 33286, + 165893, -74625, -6979, 53687, -20938, -79457, 102542, -122943, 25770, -42413, + 118112, -108448, -142271, 2147, -3221, -44560, 8053, 20401, 43487, 14496, + 78920, -125091, -56371, 5906, -34897, -99321, 76236, 7516, -34897, -3758, + -42413, 1611, 36507, -25770, 21475, -30602, -43487, 60130, -10201, 48855, + 9664, -73014, 12885, -5906, -9127, 19864, 39728, 45634, -39728, 42950, + 13959, -34360, -22012, 23085, -4295, -26307, + }, + { + -456877, -266825, 2170032, 376883, 270046, -105227, 490163, 316217, -149250, -318901, + -42950, -907312, 113817, 1044751, 1734630, 38655, -92879, -304406, 321049, -357556, + 51003, 290447, 22012, -177704, -261456, -15032, 242666, 1321776, 44560, 15032, + 161061, 71404, -36507, 223875, -164283, 128849, -125628, 230318, -69793, 279173, + 6979, 66572, 39192, 5369, -8053, -196495, 173409, 130460, -112206, -105764, + 4295, -18790, -54761, -120259, 78383, -141734, -18254, 39192, -5906, 95026, + -39192, -31139, 61740, 22549, -1074, 22012, 5369, 62814, -33823, -43487, + -11811, -5369, 57982, 3221, -70330, -53687, 19327, 27917, -45634, 10737, + 42950, -1074, -27917, 20938, 9664, -1611, -16106, 8590, -71941, 17180, + -1611, -9664, 32749, 1611, 3758, -8590, + }, + }, + { + { + 122943, 7268159, -1272921, -172336, 267899, -55298, -55835, 240518, -3758, 220654, + 14496, 295816, -169651, 153008, -417686, -186294, 660888, 68183, 253940, -335007, + 544387, 77846, -255551, -281857, -703301, -520228, -187368, -81604, 79457, -2684, + 347355, 153545, -50466, -74625, 310311, 55298, -159988, 134218, -258235, 270046, + 54224, -47245, -93416, 1074, 170725, 10201, -231391, 26307, 18254, 158914, + 142271, 10201, -67109, 94489, -8590, -148176, 26307, -144418, 74625, 135291, + 28454, 108448, -34360, -33286, 52613, 51540, -35970, 0, 49392, -45634, + -51540, 16643, -31139, 51540, 24696, 0, -14496, 46708, 11274, -25770, + 1611, 52076, 44023, 8590, -36507, -20938, 9664, 2684, -9664, -31139, + 42950, -10737, -4832, -8590, -26307, 2684, + }, + { + 935766, -11209328, 3311957, -88047, -227096, 238908, -140123, -37581, -41876, 195421, + -302795, 1611, -230854, -280247, 112206, -484258, 91268, -191126, -565325, -318364, + 77309, 162672, 290984, 292595, -85362, -155693, -256087, 121870, -20938, -279173, + -40265, -339302, -155693, -52613, 74625, -47782, -227633, -113280, -18790, 106837, + 230318, 33823, -210453, 13959, 90194, -176631, -43487, -179852, -9664, 38118, + 172336, 148176, 19327, -52076, -74625, -154619, 34897, 20938, 76236, 20401, + 76236, -63888, 18790, 21475, -80531, 6979, 49392, 22012, 9664, -37044, + -13422, -44560, 39728, 25770, -73551, 60130, -26844, -28454, 9127, 37581, + 32749, -27917, 25233, 20938, 0, -73551, 53687, -9664, 9127, -4832, + 1611, 12348, 24159, -24696, -1074, -13422, + }, + { + 797253, -722091, -6373732, -1611, -719944, -274878, 182536, -280247, 59056, -338766, + -246424, 161598, -125091, 56908, -391379, -238908, 43487, 150861, 637803, 65498, + -156766, 34897, 23622, 33286, 236760, -176094, -143881, -307090, -181462, -122943, + 117038, -147640, -132070, -350040, -321049, -93952, 11811, -131533, -48318, -273804, + 45097, -23085, 37581, 68183, -64425, -174483, 144955, 72478, 128312, -153008, + -142808, 37044, 67109, 26307, 22012, 3758, 26844, -53150, -57445, 11811, + 41876, 31139, 7516, -53687, 65498, 12885, -9127, 8590, 32749, 59056, + -1074, 1074, 4832, -14496, -15569, -9127, -27380, 10737, -31675, 16106, + 13959, 12885, 40265, -29528, -34360, 14496, -19864, -4832, 18254, -9664, + 27380, -3221, 16106, -14496, -9127, 13422, + }, + { + -240518, 2138894, 1324997, 527744, -116501, -55835, 37044, 13422, -70330, -11811, + -119722, -284542, 214748, 182536, -1822677, 1080721, 1243930, 8053, -1646583, 472983, + -445066, -361851, 59056, -469225, 303869, -322123, 936303, 283468, -347355, -434865, + -165893, -334471, 23622, -147640, 224412, 229244, -377420, -3221, 214748, -287763, + 98247, 129923, -80531, 14496, -161598, 282931, 105227, -25233, 179315, 32212, + -106837, 45634, 38655, -57445, 82141, -57982, -43487, 161598, -46171, -110595, + -33286, 42413, -20938, 9127, -19327, -14496, -18790, 18254, 3221, -48855, + -47782, 37581, 30065, 5369, -25770, 20938, 37581, 17717, -27917, -17717, + -11274, 38118, -27380, 2684, -12348, -11274, 17180, 23622, 23622, -11274, + -6979, 29528, 16643, -13959, 9664, 9127, + }, + { + 4997732, -19530826, -2238752, 1378148, 199179, -70330, -420907, 176631, -150861, -115427, + 503048, -121333, 202400, 295816, 68183, 147103, -213675, -391379, 109522, 6442, + 187905, -148176, 8053, -347892, 98784, -155156, 165356, -464930, 807454, -456877, + 154082, -48318, 184147, -180389, -236760, -4832, -199716, 161061, 129923, -183073, + 176631, -124017, 59593, -89121, 46171, 168577, -127238, -32749, 115427, -23085, + 89657, 171799, -112743, -62814, -60130, 22549, -114890, -98784, 91805, 110059, + 65498, -18254, 45097, -99321, -91805, 11274, -48855, 34897, 47782, 6979, + -40802, -45634, -52076, 59593, 36507, -36507, 60130, -38118, 11274, 42413, + 23085, 4295, 16643, -59593, -25770, 22012, 1611, -1611, -29528, 4832, + -7516, -1611, -11811, -8590, 17717, 17717, + }, + { + 115964, 1169842, -572841, -424665, 21475, 19327, 98784, 54761, 39192, 20938, + -272194, -150324, -147103, -718333, 294205, 533650, -270583, -176094, 381178, 454730, + -1113470, 12885, 351114, 183073, 476741, 199179, 557809, -26844, 222801, 961536, + 164283, -190589, -73014, 78383, 23622, 206158, -11274, -108985, -94489, -173409, + 332323, -106300, 49929, 37044, -13422, 5369, -174483, -22549, 22549, 69793, + 161061, -2684, -23622, 27380, 93416, 36507, -32212, 90194, -10201, -44560, + 26307, 50466, 40265, 8053, 39192, -44023, -45097, -42950, -11811, -9127, + 56908, 33286, -46708, 2147, 24696, 26844, 35433, -24159, -40802, -35970, + 31675, -9664, -39728, -2684, 28991, -3221, -5906, 537, 7516, -11274, + -30602, 18254, 44023, -12348, -6442, -14496, + }, + { + -3606162, -17970680, 2282238, -380641, -414464, 19864, 308701, -276489, -332860, 167504, + 59593, -138513, 229781, 362925, 135828, 171799, 81068, 194884, -432718, -57445, + 139586, 142271, -219580, -78920, -130460, -118112, -22549, 37581, 67109, -100395, + 59593, 368830, 53150, -90731, 85899, -40265, 280247, 209380, -194347, -2147, + -16643, -207769, -171799, 192200, -82678, -42950, -127775, 39728, 191663, -146029, + 111132, -11274, 9127, 16643, 38118, 84289, -19864, 144955, 51003, -9664, + -5906, -29528, -11811, -16643, 34897, 62277, 26844, -60666, -10201, 13959, + -60666, 35433, 78920, -23085, -53150, 537, 37581, -9127, 6979, 27917, + -52076, 14496, 22012, -19327, -45097, 56371, 17180, -26844, -12885, 2684, + 25233, -33823, -19327, -13959, 0, 6442, + }, + { + 78920, 746787, -1308891, -74088, -152471, -49929, 17717, -2684, 96637, -125091, + -217970, -151398, 148713, -559420, 185220, 285078, 467615, 121870, 30065, -399969, + -32749, 2147, -452045, 291521, 82141, 454193, 50466, -99321, -648003, -250719, + 19327, -21475, 273267, -81604, -104690, 462246, 46171, -167504, 18254, 38118, + -133681, 121870, -112743, -82141, 96100, 60130, 170188, -125628, -10737, 226023, + 75162, 0, 65498, 46708, -67646, -21475, 37581, -77309, -49929, 132607, + 51003, 83215, -5369, -16106, 0, -24159, 101469, 20401, -23085, -54761, + -3221, -30602, -23085, 56371, 1611, 5906, 30602, 25770, -12885, 19327, + -52613, -32749, -15032, 20938, 31675, -10737, 20938, -23085, 1074, 24696, + -32749, 8053, 17717, -11274, 7516, -1611, + }, + { + 9233106, 2186138, -1223529, -431644, -2684, -12348, 57445, -407485, 350577, 234613, + -692564, -197569, -465467, 663572, -580357, 322123, 496069, -249645, -263067, 332323, + 128849, -61740, -318364, -156766, -299037, 213138, -126165, -269509, 44023, -18254, + 100395, -138513, 6442, -124554, -79457, -268435, -311385, 123480, 102005, -368293, + -135291, 111132, 144418, 20938, 71404, 124554, -56371, -171799, -1074, 7516, + 24159, -143881, -172336, -55835, -96100, -98247, 41339, -29528, -131533, 15032, + -8590, -29528, -30065, -60130, -143881, 95026, 107911, -54761, 20938, 28991, + -23085, -24159, 55298, -4295, -1074, -67646, 35433, 10201, -537, -8053, + 5906, -25770, 4832, -8590, -26844, 15569, 28454, 18790, 13422, -14496, + -22012, 7516, -7516, 31139, -16106, -4832, + }, + { + 133681, -1263257, 1962800, 118648, 115964, 718333, -55298, -337155, 64961, -62814, + -199179, -121870, 336081, 718333, -127238, -144418, -266288, 551903, 721018, -746251, + -386547, -128312, 237297, 496069, -12885, -255551, 359167, 2147, -295816, 127238, + -583579, 1611, 255014, 16106, 28991, 49392, 319438, -73551, -149250, -126165, + 11811, 18254, -41339, -89657, 291521, -165356, 16106, -89121, -86436, 77309, + 51003, -31139, 19327, -95563, -175557, 42950, 57982, -14496, 24696, 16106, + -18790, -22012, -70867, 537, -41876, 47782, 93416, 71941, 64425, -103616, + -14496, -20938, -35970, 35433, -13959, -17717, -13959, -6442, -9127, -35970, + 537, 25770, 23622, 5369, 22549, -5369, -28991, 10737, -9664, 26844, + -17180, 537, -3758, 9127, 18790, -14496, + }, + { + 1796370, -990527, -1916092, -998580, 352187, -84289, -359167, -517544, 126702, 272730, + -82678, -63351, 41339, 250719, -411780, 147103, -243203, 76236, -189515, 196495, + -181999, 402116, -19327, -9127, -99858, 117575, -28991, -73551, 46171, 167504, + -139586, -335007, -12885, 207232, -162135, -402653, 146029, -57982, 5369, 138513, + 180389, -187905, -59593, -54761, 66572, 33823, -47782, 16106, -72478, -1074, + -10737, -27917, 17180, -148176, 30602, -5906, 8590, 93952, -54224, -45634, + -29528, 4295, -18254, 28991, 85899, -36507, -12885, -30602, 23622, 16643, + -10201, 20938, 51540, 42950, -21475, 18254, -30065, -60130, 17180, -24696, + 22549, 14496, -48318, 59056, -16643, 45097, -9127, -537, -22549, -2147, + 18790, -9127, -29528, -1074, 39192, -4295, + }, + { + -55835, -2099702, 83215, -418759, 181999, -281857, -124554, 0, 178778, -225486, + -93952, -222265, -47782, 676994, -526134, -459025, -231391, 339839, -505732, 35970, + -340376, 1258962, 40265, 395674, -454193, -300111, 21475, 54761, -192737, 161598, + -128849, 216896, -189515, 210990, -191126, -81068, -83215, 250182, -195421, 112206, + -62814, -71941, 287226, -12885, -70867, 126165, -86973, 137439, -1611, 85899, + -8053, -63351, 87510, -39728, -4295, -67646, -47782, -10737, 88584, -15032, + 97174, 13959, -85899, -49392, 33823, 144418, -53687, 27917, 14496, 31139, + 15569, 2684, 26307, 23085, 9664, 15569, -13422, -47245, 4295, -22012, + 30602, -12885, -27380, 10201, 18254, -6979, -13959, 17717, 13422, 8590, + 22012, 9664, -15032, -10201, 22549, 5906, + }, + { + -1468342, 4641249, 88047, -82141, -121333, -246424, -1522029, 23085, 64425, 430570, + 187905, -130460, 177167, 902480, -104153, -274341, 317828, 191663, -52613, 431644, + -183073, -84289, -129386, -60666, -104153, 457951, -83752, 125091, 127238, -153545, + -141197, -122407, -148176, -42950, 293132, 103616, -226560, -37044, 241055, -144418, + -208843, -167504, -8590, -171799, -86973, -79457, -61203, -187368, 66035, 112743, + 183073, 81604, -88047, 122407, -55298, -32749, 4295, -83215, -62277, 128849, + 26307, -41339, 537, 60130, -80531, -68719, -35433, 8590, 70867, -5369, + -85362, 17180, 77846, 20938, -1611, 5369, -22549, 65498, 6442, 31139, + -62277, -11274, 20938, 50466, 10737, -66035, -35970, 6442, -20401, 537, + 10737, 2147, 30602, -2147, 17717, 8053, + }, + { + 203474, 313533, 563178, 64961, -63351, -67109, -127775, 266288, -411243, -312459, + 62277, 12348, 770947, -2107755, 1168231, -1856500, 478352, 339839, -9664, -408022, + 56908, -6442, 156766, 517007, -222801, 559956, -150861, 21475, 596464, -221728, + 89657, 18254, 30602, 129923, -230318, 139586, 61740, -67109, 160524, 4832, + 92879, 59593, 50466, 145492, 26307, -112743, 99321, -90731, 28991, -89657, + 133681, -44560, -126165, -122943, 6442, -33823, -30602, 39728, 8053, 8590, + 114890, -54224, -73551, 16106, 38118, -94489, 43487, 88047, -38655, -13422, + -33286, 0, 44560, -23622, -537, 29528, -73014, 47782, 16106, 30065, + 32212, -55298, -24159, -2684, -39728, 1611, 18790, 52613, -31675, 15569, + 37581, 1074, -32212, 18254, 17717, -39728, + }, + { + -46171, -1175747, 1066226, 469225, 757525, 1983738, -218506, 327491, -137976, -383863, + -346282, -265751, 10201, -53687, 3571802, 247497, -498216, 441845, 119185, -204011, + -112743, 313533, 101469, 153545, -249645, -258235, 11811, 1374926, 270046, 39728, + 39192, 76236, 15569, -11811, -59056, 20938, -33823, 49929, -52076, 224412, + 238908, 36507, -95026, -44023, 169114, -155156, -77846, 104690, 66572, -93416, + -21475, 31139, 39728, -68719, 5906, -136365, -134755, 15569, -4832, 84289, + -12885, -62814, 22012, 18254, 12348, -10737, 30065, 13422, -49392, 537, + -59593, -14496, 67109, 64425, -41339, -54761, -24159, 37044, -27380, -17180, + 23085, 46171, -6979, -10737, 19864, 2147, -10201, 42413, -48318, -13422, + 5906, -16643, 18254, 23085, 17180, -5906, + }, + }, + { + { + -132070, 6135898, -998580, -248034, -60666, 130460, -173946, -183073, 148713, 88047, + 134218, -197569, 34897, -62277, -1954210, -405338, -330176, 69256, 591632, -137976, + -32749, -157840, 149250, 135291, -383326, 170188, 287226, 271120, 322123, -107911, + 275952, -537408, 600222, -60130, -195958, -312996, -106837, 484258, -288837, 60666, + -128312, 108448, -16643, -129386, -25233, 190589, -16643, -22549, -46171, 22012, + 93952, 114890, 14496, -26844, 107911, 51003, -9664, -11811, -62277, -31139, + -72478, 59056, 98784, -10737, -16106, 46171, 61203, -13422, -28454, 59056, + 7516, -15569, 10201, -36507, 16643, 10737, 11811, -29528, 0, 17180, + -10737, -19864, -10201, 26307, 40265, 18790, -21475, -14496, 7516, -2147, + -34360, 22012, -14496, 20938, 4832, -15032, + }, + { + -52076, -14158360, 519691, 408022, -421981, -210453, 374199, -26844, -499827, 306553, + -117038, -118112, 230854, 47782, 1176821, 451508, -186831, 125091, 626528, -212601, + 10737, -196495, -239444, -73014, -200253, 97174, -114354, -122943, -119722, -135828, + 114890, -109522, 255014, 49929, -220654, 92879, -7516, 108448, 176631, -60666, + -287226, -42950, -22012, 78920, -40265, 148713, -241592, 59056, -153545, -118112, + 111132, -133681, 81068, 34897, 18790, 28454, -94489, 97174, 43487, 2684, + 31675, 18790, 36507, 97174, -2684, -37581, -42950, -5906, 20401, 89121, + 21475, -1074, -54224, 15032, 13959, -85362, 36507, 12885, -17180, -42413, + 10201, 26844, -26307, -6442, 34897, 42950, -83215, 39728, -10737, 17180, + 6979, -14496, -6442, 18254, -13422, 8053, + }, + { + -462783, 9902584, 741956, -423054, 1230508, 245350, 64425, -49392, 56908, -88584, + -385473, 71404, -47245, 151934, 24696, 39728, -33823, -302258, 651224, 288300, + 342524, 53687, 231928, -94489, -294205, -154082, 159988, 104690, 42950, -191126, + -132070, -168577, 12348, 257161, -45634, -50466, 185220, -169114, -3221, -59056, + -63351, 148176, -26307, 90194, 189515, 115427, -129923, -235149, -11274, 148176, + 95026, -95026, -107911, 43487, 28454, -105764, -25770, 109522, 15569, -14496, + -95563, -40802, 132070, 23622, -32212, 45634, -19864, 54224, -35433, 11274, + 49929, 8053, 5369, -4832, 40802, -20938, -11811, 5906, -5906, -20401, + -27917, -2147, 8053, 63888, -18790, -20938, 21475, -20401, -2147, 0, + -35970, 4832, -6979, 25770, -2147, -3221, + }, + { + 340913, 1137630, -778463, 22549, 148176, -48855, -66572, 73014, 84289, 53687, + -31675, -62814, 31675, -255551, -3388729, -1279900, -773094, -235686, -1247688, -288837, + 220117, 195421, 309775, 15032, 120259, -661425, -246961, 486942, 166967, -191663, + -149250, -198105, 243203, -63351, -31675, -388695, 170188, -5906, -25233, 85899, + 23622, 78383, 51540, 188979, -214748, -62814, 173946, -19864, -20938, 64961, + 73551, -128312, 32749, -42950, 9127, 105764, 16106, 9664, 107374, -2684, + -70330, -15569, 39192, -88047, -49392, 54761, 8590, -1074, -5369, 60130, + 44560, -71404, -44023, -9127, 45634, -56371, -12885, 19864, 47782, 12348, + -19327, -23622, 26307, -11274, 27380, 5906, -45097, -13422, 17180, 21475, + -22549, -28454, 13422, 19864, -6979, 11274, + }, + { + -2379412, -25528748, 446140, 894427, -185757, 42950, -189515, 250719, 99858, -265751, + -145492, 429497, -54761, -511101, -71404, -226560, 348429, -177704, -84289, 15032, + -109522, -10201, 190052, 41876, -525597, 149787, 134755, -1064615, 187368, -367757, + -33823, -92879, -27380, 52076, 91268, 200790, 412317, -339302, -217433, 145492, + 49929, -195958, -68183, 102542, -113817, -132607, 63888, -55835, -57445, 69256, + 537, -15032, 164283, -4295, -37044, -29528, 145492, -36507, -33286, -102542, + 96100, 4295, 34360, 35433, -5906, -20938, 27917, -9664, -22012, 18790, + 19864, 33286, -34360, -69256, 14496, 13422, -10737, 70330, -11274, 10201, + 22549, 17180, -10201, 41339, -36507, -17717, 13422, 24159, 13959, -34897, + 14496, 4832, -5369, -537, -32212, -1074, + }, + { + -270046, -126165, 1061931, -22549, 18790, -73551, -67646, 84289, -17717, 95563, + 24696, -70330, 362925, -93416, -417149, 117038, 1110786, -528281, -310848, 1278290, + -103616, -77846, -483184, 165356, 334471, -912144, 337692, 183073, -596464, 508954, + 207232, 108985, -124554, 15569, -22549, 35433, -147103, 171262, 209380, -111132, + -121870, 167504, 25770, -95026, 68183, 79457, 117575, 26307, -3221, -92342, + 13959, 14496, 86436, -65498, -6979, 106300, -27917, 7516, 46708, -1074, + 37581, 4295, 68183, 38118, -27380, 17717, 6442, -45634, -4832, -23085, + -98784, 15569, 40802, 3758, -24696, 8590, 2147, 29528, 29528, 16643, + -42413, 48318, -6979, -5369, -37044, -2147, 10201, -3221, -6442, 18254, + 9127, -32749, -12885, 23085, 10737, 9664, + }, + { + 7254200, -7747584, -2158758, 450972, -89657, 188979, 222265, 143881, 197032, 98247, + -63888, 49929, 32749, 164283, -301185, 631897, -71941, 196495, 448287, -251256, + -85899, -235149, -243739, -45097, 122407, 56371, -155693, 555125, 228707, -145492, + -198642, 180389, 51003, -284005, 183073, -25233, 193810, 286152, -17717, 20401, + -19864, 6442, -18790, 53150, 20938, -49392, 105227, -107911, 30602, -44023, + -67646, 79457, -147640, 6979, -96637, -41876, -59593, 28991, -5906, 29528, + 53687, 0, -5369, -15032, -19864, -20401, 28454, 75699, -53150, -9664, + 78383, -46171, -79457, 64961, 30602, -14496, -24696, 28991, -9127, -24696, + 53150, -18254, -24159, 43487, 2147, -64961, 11274, 18790, 18790, -26307, + -15032, 31675, -11274, 10737, -12348, 537, + }, + { + -308701, 1611, 967441, 64425, 151398, -12348, -4832, 59056, -127775, 37044, + 72478, -121333, -350577, -364535, 776852, -1276142, -333397, -685584, -171799, 12348, + -266825, -961536, 181462, 255551, -255551, 885300, 69256, 156766, -151934, -86436, + 98247, -180389, -93416, 110595, -163746, 97174, 66572, 42950, -3221, 84826, + -134755, -30602, 45097, 93416, -108985, -58519, -26307, 242666, -194347, -174483, + 87510, 537, 66035, -68183, 57982, 5369, -23622, 88584, 96637, -71941, + 17717, -25770, 97174, -28991, 50466, -44023, -67109, 2147, 60666, -48318, + 10201, 22549, -13422, -13959, 3221, 28454, -39728, 26844, 36507, 1074, + 44560, -16643, -26307, -13422, -30065, 14496, -5369, 31675, -10737, -8590, + 27380, -13422, 11811, -3221, -537, 4295, + }, + { + -8083129, -17379048, -166967, -586263, 536334, 35433, 491237, 185220, -493384, 103079, + 614717, -49929, -386010, -428960, -39192, -47245, 707596, -24696, -278099, 340913, + 71941, 208843, -577673, 71941, 133144, 61203, 132070, 246961, 71941, -99858, + -264141, 158914, 126702, 150861, -99321, -43487, -116501, -291521, 17717, -41339, + -180926, 116501, 264677, -185757, -4832, -184147, -101469, 131533, -25770, -60130, + 16106, 181999, -61740, -75162, 106300, 537, -17180, -41876, 82141, 27380, + -70330, 73014, -10737, 37581, 16106, -99858, -50466, 21475, -6979, -537, + 35970, -61203, -26307, 4832, -9127, 58519, -80531, 8590, 1611, 26844, + -27917, 12885, -6979, -3221, -4295, -30602, -34360, 6442, 23622, 23085, + 11811, -12885, 0, -24696, 25233, -2684, + }, + { + -155156, -2636036, 58519, 348966, -329639, -396211, 868120, -100932, -420370, -380641, + 22549, 346282, -432181, -311922, -386010, 330176, -623844, -362925, 415001, 834297, + -51540, -230318, -412317, -149250, 132070, 65498, -35433, -144955, 37044, 210453, + 190052, -320512, -105764, 70867, 103616, -268435, 32212, 60130, 169114, -17717, + 31675, -19864, 111669, -41876, -151934, 125091, 36507, 113817, -139586, -193274, + 153008, 83215, 21475, 95026, 84289, -206158, -30065, -61740, -32212, 55835, + 51540, -3221, 33823, -67646, -537, -76236, -58519, 36507, 28454, 74088, + -11274, 12885, 19864, -55298, 12885, 42413, -9127, -18254, 4832, -22549, + -34360, -39728, -6442, 4295, -537, 32749, 6442, -15569, -2684, -14496, + 27380, -18790, 11274, -2684, -1074, 20401, + }, + { + -1202591, -1673964, 1731946, -382789, -136902, -1188632, 1910724, -166430, -562641, -300111, + 22012, -182536, -38655, -15569, 52076, 260382, -300111, 110595, 62277, 50466, + 125091, -254477, 135291, -120796, 117038, 143345, 28991, -1074, -273804, 102542, + 153008, 223338, -51540, -18790, -56371, 119185, -306553, 20401, -7516, -310848, + 185757, 268435, -74088, 63351, -14496, -128849, -36507, -1074, 147103, -54761, + -31675, -71404, 22549, 69793, 34360, 11811, -107374, -119185, 121333, 1074, + -52076, 23085, 13959, -32212, -32749, 52613, -30065, -9127, -23622, 47245, + -22012, 3758, -30602, 4832, 44560, -12885, 46171, 11811, -35433, 15569, + -26307, -537, 29528, -48855, 20401, -30065, 42413, -15569, 27380, -2684, + -17717, 18254, 13959, -15032, -23085, 19864, + }, + { + 23622, -1246077, 35433, -189515, 52613, 309238, -87510, -311385, 26844, -263604, + 67109, 119185, -1001801, -635655, 995359, 324270, -526670, -26307, -76773, 415538, + -9127, 467615, 127238, -53687, 363462, 205085, -549756, -136365, -10201, -399969, + 812286, -291521, -30602, 68183, -46171, 30065, -16106, -199716, 120259, 9664, + -2684, -75699, -88047, 4295, -1611, -31139, -60666, -49392, 22549, 71404, + 34897, 35433, -135828, -85362, 70330, 37581, 21475, -26307, -103079, -32212, + -86436, 47782, 16106, 13422, -126165, -62277, 93952, -56371, 46708, -14496, + -29528, 40802, -18790, 20938, 13422, -30602, 39192, 29528, 0, 17180, + -27917, 16643, 15032, -25233, -1074, 11274, -9127, -23622, -9127, -1074, + -537, -9127, 13422, 18254, -23622, -537, + }, + { + 459562, 8623221, -2290828, 864362, -255551, 435939, 867047, 435402, 159451, -390305, + 170188, 536871, -430034, 596464, -107911, 39192, -260919, 35970, 227633, -274341, + 694711, -54761, 151398, -160524, -219580, 373662, 235149, 76236, 81068, 79457, + -300648, 69793, 76236, 83752, -57982, -12885, 23085, -132607, -179852, 234076, + 209917, 46708, -96100, 99321, -206695, -51540, -177167, 64425, -188442, 43487, + 24159, 13959, -12885, -31675, 37044, 83215, 67646, 46171, -26844, -125091, + 44023, -26307, -3758, -13422, -3221, -13422, -30602, -57445, -64961, 51540, + 48855, -58519, -31675, 43487, 42413, 26307, -5369, -25233, 35970, -3758, + 77309, -32212, -37581, -9664, 18790, 62277, -537, -49929, -9664, -10201, + -21475, -16643, -25233, 33286, -4832, 18790, + }, + { + -133144, -199716, -608275, -236760, 12885, -7516, 96100, 75699, -95026, 97711, + -191663, 22549, -616865, -2208150, 8509404, -315680, 660351, 530428, -375810, -103079, + 537408, 482110, -471373, -88584, 12348, 106837, 740345, -299037, 409096, -22549, + -107374, -110059, -98247, -264141, 149250, 25770, -48318, -77846, -124554, 107911, + -231928, 30065, 63888, 56908, 83215, 39728, -148713, -15032, 17180, 15032, + -91268, 112206, 68719, -50466, -21475, -4295, -59593, -20938, 1074, -48855, + -52076, 147103, 4832, 8590, 30065, 91805, -77846, 16643, 49392, -6442, + 45097, 18254, -39192, 19327, -2684, 31139, 47782, -81604, 23622, -40265, + -16643, 64425, -9127, -10737, 15569, -27380, -32749, -35433, 42950, -38655, + -10737, 40265, 26307, -24159, 1074, 26844, + }, + { + 827318, -35433, -404264, -705985, -279710, 738734, -30065, 92342, 220117, 205622, + -663036, 380641, 322659, -1033477, 1823751, 14496, -229244, -175020, -68183, 353261, + -49929, -12885, -91805, 82141, 158914, -115427, -367220, 435402, -197032, 209917, + -135828, 35970, 241592, -142808, -52613, 59593, 107911, -215822, 49929, 12885, + 81604, 173946, 57982, 16106, 57445, 99321, -210453, -201327, 38655, 29528, + -16643, -30602, 81068, 68719, -76236, -13422, -77309, -47782, 48318, 5369, + -1611, 34897, -13959, -76236, 17180, -11274, -18254, 1074, -11274, 13422, + 23085, 15032, -81068, -6442, 61740, 42950, -18790, -11274, 1074, 23085, + -13422, -12885, 23622, -24159, -10201, 8053, 6979, -18790, 73014, -26844, + -6442, 4295, -23622, 7516, -6979, 5906, + }, + }, + { + { + -74088, 2136209, 1916092, 9127, 82678, 65498, -106837, -179315, -3221, 128312, + -72478, -366683, 18790, 419833, -2298344, -125091, -734439, 94489, 151934, 329639, + 98247, -556198, -37581, 508417, -386547, 523986, 332323, 160524, 240518, -353261, + 68183, -237834, 354335, 74625, -547608, -144418, 121870, 389231, -43487, 13422, + -104690, 34897, 44023, -54761, -86436, 55298, 144418, 10201, -68719, -30602, + 71941, 99321, 15032, -28991, 12885, 89121, -5906, 77846, -32212, -90731, + -34897, -49929, 74088, 35433, -20938, -4832, 29528, -5906, -63351, 42413, + 46171, 0, -537, -41876, -17717, 31675, 10201, -39192, -24159, 10737, + -10201, -35433, -42950, 5369, 32212, 19864, -12348, -6979, -1611, 23085, + -32212, 18254, -3221, 7516, 18790, -2684, + }, + { + -246424, -17016660, 3439195, 1143535, -430034, -217433, 494458, 30602, -19864, 56371, + -150861, -214212, 267899, 303332, 992137, 798864, -77309, 74088, 741419, -83752, + 95026, -297963, -125091, -375810, 56908, -45097, -39192, -47245, -135828, -235686, + -92879, 157303, 133681, 158914, -285615, 135291, 169114, 124017, 157840, -64425, + -229781, -186294, 77846, 103616, -84289, 140660, -142808, 61203, 11274, -60130, + -10737, -151398, -63351, 11274, -30602, 119185, -102005, 40265, 31139, 7516, + -38655, 43487, 36507, 46708, 8590, -8590, -32212, -11811, -39192, 67646, + 20938, 33823, -61203, -24696, 71404, -77846, 19327, 35970, -11274, -45634, + -13422, 24696, -19327, -15569, 8053, 79994, -63888, 23085, -5906, 5369, + 1611, -5369, -21475, 19864, -10737, 11274, + }, + { + 745177, 16878684, -3117073, -1489817, 281857, 406411, -201863, 76236, -32212, 169114, + -219580, 2684, 330712, -246961, 193810, 162135, 59593, 67646, 219043, 68719, + 531502, -66035, 111669, -12348, -565325, -64425, 64961, 227633, 134755, -36507, + -189515, -69793, 73014, 153008, 71941, -48318, 134755, 20938, -125091, 537, + -30065, -63351, 55298, -8590, 82141, 185757, -117575, -154619, -137439, 63888, + 147640, 8053, -83215, 18790, 20938, -88584, -84826, 34360, 18254, -1611, + -81068, -74625, 56908, 34897, -78383, 19864, -10201, 17717, -8053, -17717, + 17717, -1611, 10737, 1611, 18254, -16643, 16106, -537, 18254, -5369, + -13959, -10201, -19327, 47782, 24159, -26307, 31139, 8053, -24159, 9664, + -33286, -3758, -14496, 18254, 0, -5369, + }, + { + -252329, 734439, 250182, -270583, 145492, 80531, -100932, -29528, 111132, 28991, + -5906, 61203, 35970, -599685, -4115653, 278636, -791348, -1423245, -490700, 166430, + 148713, 191126, 441845, -163746, 129386, 93416, -1095217, 498216, 81068, -311922, + 154082, -117038, 91268, -13422, -108985, -407485, 194884, 39728, -216896, 140660, + -51540, 19864, 170725, 63888, 37581, -208843, 3758, 38118, -86436, 54224, + 119722, -86436, -32749, 6442, -77309, 95563, 85362, -32749, 82141, 79994, + -1074, -37044, 46708, -71404, -68719, 48318, 16106, -14496, -31675, 71941, + 74088, -31139, -46171, -3221, 45634, -26307, -37044, -8053, 31675, 24696, + 0, -41876, 24696, -6442, 15569, 26307, -37044, -15032, -12348, 13422, + -2684, -38655, -10737, 17180, -8590, -7516, + }, + { + -853625, -26357678, -569083, 530965, 375273, -85362, 152471, 74625, 157840, -1611, + -386010, 157840, 135828, -931471, 153545, -265751, 455267, -272730, 127238, -21475, + -11274, -48855, -2684, 205622, -365609, 96637, 151398, -814970, -291521, -104153, + -279710, -115427, -75162, 141197, 69256, 302795, 500901, -136902, -324270, 256624, + 67109, -68183, -150861, 126165, -31675, -297963, 46171, 59593, -107911, -29528, + -10201, -106837, 130997, 71404, -41339, -46708, 193274, 40265, -49392, -79994, + 56908, 11274, 19864, 10737, 42950, -43487, 33286, -6979, -4295, -5906, + 33823, 47245, 36507, -56371, -16106, 39728, -44023, 51540, -1611, -11811, + 6979, 4832, -12885, 38118, -4295, -24696, 11274, 18790, 26844, -12885, + 16106, 5369, -537, 10201, -23622, -9127, + }, + { + -127238, -405874, 455267, 252329, -10201, -5906, -96637, 13422, -34360, -17717, + 152471, 85899, 338766, -15569, 672699, -128312, 462783, 47782, -293668, 1718524, + -602906, 57445, -1181116, 1313186, 69793, -687195, -95026, 357556, -111132, -462246, + 56371, 369904, 17180, -72478, -29528, -22549, -116501, 112743, 258235, 138513, + -372588, 148176, 46708, -100932, 49392, 33823, 141197, 81604, 8053, -97174, + -97174, 83215, 41339, -6442, -10201, 26844, 22549, -19864, 67646, 2147, + 52076, -3221, 40802, 43487, -13959, 11274, 17717, -16106, 30065, 7516, + -71941, -42950, 40802, 24159, -30602, -35433, -33286, 5906, 31139, 28454, + -41339, 27380, 18254, 9664, -33286, -6979, 10737, -537, -8590, 3758, + 30065, -17717, -37581, 18790, 7516, 11811, + }, + { + -8321499, 8681203, 1933809, 813896, -307090, 113280, -23085, 456340, -76773, 10201, + -47245, 279710, -40265, 158914, -317828, 413391, 23622, 62814, 466541, 31675, + -35433, -234613, -111132, -84289, 157840, -17180, -92342, 479963, 246961, -31139, + -16643, -70867, -135291, -112743, -62277, 89121, 198642, 161061, -1074, -30065, + -13959, -37581, 249645, -106837, 151398, -48855, 113280, 13959, -17180, 10737, + -86436, 39192, -92879, -26307, -47245, -89657, -91268, -42413, -31675, 2684, + 37581, 1074, 1074, -3221, -30065, -53150, -48318, 57982, 1611, -10201, + 89121, -21475, -97174, 24696, 51003, -1074, -45097, 18790, -6442, -22012, + 51540, -5906, -39728, 15569, 31139, -62814, -22549, 20938, 31675, -5906, + -26844, 32749, 11274, 15569, -7516, -10201, + }, + { + -127238, -655519, 649614, 134755, 92879, 60130, -47245, 51003, -134755, -4295, + 217433, 128312, -128312, -1050120, 646929, -774168, 146566, 194347, -104153, 406948, + -388695, -280784, 782758, -352187, -119185, 446677, 140660, -298500, 241055, 77846, + 186294, -118648, -176631, 0, 48318, -227633, 89657, 30065, 47782, -7516, + -36507, 16643, 56908, 67109, -32749, -71404, -71404, 194884, -52076, -194347, + 4832, -13959, -10737, -45097, -51003, 41339, -98247, 95026, 140123, -91805, + 3758, -38655, 52613, -26844, 51003, 41339, -78920, -10737, 32212, 14496, + -4295, 11274, 12885, -22012, -13959, 17717, -34360, -12885, 27380, -32212, + 53150, 24696, 3758, -18790, -38118, 12885, -19864, 17180, 2684, -27380, + 25770, -8053, -9127, 7516, -2684, 6979, + }, + { + 5267241, -33881924, -748398, -77846, -207232, -26844, 239444, 411780, -403727, -206695, + 630286, 187905, 155693, -171262, 156766, -386010, -38655, 360777, 22549, 67109, + -204548, 246961, -521839, 76236, 123480, 78383, 55298, 335007, -118112, 31139, + -245887, 215822, 112743, 91805, -12885, -77846, -33823, -221728, -85899, 206158, + -85362, -16643, 152471, -100932, -57982, -194884, -180926, 169651, 537, 41876, + -91805, 50466, 56371, -27917, 63351, 94489, -42413, -14496, 83215, 60130, + 8053, 18790, 23085, 39728, 90731, -62814, -114890, 4295, -11811, -21475, + 33286, -4832, -41876, 2147, -16106, 55298, -67109, -6442, 3221, 9664, + -13959, 23085, 7516, 2684, 20401, -10737, -37581, -8053, -1611, 8590, + 30602, -13422, 8590, -31675, 16106, 6442, + }, + { + 293132, -2193655, -1124208, 244276, -132070, -670015, 425739, 282931, -419833, -296353, + -42413, 452045, -253940, -201863, -663036, 52076, -30602, -548682, -631897, 1037772, + 150324, 2147, -196495, -346282, 61740, -18254, -335544, -62277, 192200, 202400, + 542240, -203474, -244813, -49929, -31139, -206695, -157303, -28454, 97711, -18254, + -68719, -75699, 105764, 82141, -229244, 130997, 22549, 124554, -61203, -151398, + 23622, 52076, -42950, 112206, 164819, -146566, -73551, -26844, -49392, 20938, + 62814, 22012, 69256, -34360, -1611, -19864, -54761, -28454, -62814, 74625, + 18790, 6442, 59056, -43487, 13959, 30065, 4832, 537, 13422, 18254, + -9127, -32212, -17180, -16643, -20401, 16106, 23085, -13422, 3758, -18254, + 23622, -12885, 2684, -4832, -13959, 10201, + }, + { + 675921, -2767570, 814433, 470836, -387084, -503048, 619549, 541703, -655519, -209917, + 161598, -107374, -50466, -244813, 114354, 324270, -416075, 37044, 112206, -16106, + -62277, -242666, 70330, -64961, 25233, 50466, 39192, 23622, -165356, -66035, + 137976, 189515, 97174, -133681, -122943, 265751, -234613, -57445, 13422, -229781, + -52613, 209917, 59056, 125628, 17717, -102005, -5906, -17180, 123480, -74625, + 1074, -53687, -26844, 113817, 54224, 32212, -40265, -130997, 58519, 42413, + -3221, -17717, 26844, 9127, -58519, 25770, -1611, 5906, -31675, 31139, + 2147, -6442, -44023, -38118, 10737, -22012, 27380, 34897, -28454, 18790, + -23622, -20938, 52076, -61740, 11274, -39728, 7516, 0, 16106, 8053, + -24696, 11274, 23085, 537, -32749, 5369, + }, + { + 80531, -516470, -619549, -88047, -109522, 270583, 4832, -191126, -141734, -172872, + -51003, 311385, -787053, -272194, 1025960, -192737, -207232, -290984, -99321, 65498, + 442382, 537, -118648, -396748, 140123, 759672, -300111, -598611, 257161, -428423, + 579821, -65498, 149787, 149250, -46708, 77846, -166967, -277562, 119185, -63351, + -52076, 37044, -144418, -101469, 23622, -112743, -1074, -52613, -6442, -25233, + -35970, 105227, -131533, -69793, 43487, 46171, 44023, 56908, -22012, 2684, + -86973, 24696, 39192, 29528, -55835, -109522, 102005, -19864, 32212, 0, + -45097, 23085, -32212, -15569, -19327, -33286, 3221, 49392, 11811, 18254, + -16106, 14496, 20938, -537, -6979, 20938, 6979, -16643, -10201, -6442, + -8053, -10201, 6979, 13959, -19327, -10737, + }, + { + 1793686, 8327405, -2165737, -136902, -87510, -60666, 964757, 360240, 459025, -501974, + -63888, 405338, 338229, 46171, -266825, 190052, -215285, -25233, 205085, -488553, + 504659, -8590, 102005, -29528, 64961, -172872, 36507, 139050, -206695, 166967, + -115964, 23622, -8590, 155693, -121333, -68183, 83215, -82141, -252329, 111132, + 247497, 207232, -40265, 233002, -49929, 118648, -101469, 135291, -122407, -13959, + -26844, -39728, 44023, -100395, -26307, 39728, -6442, 88584, 33286, -118112, + -3221, -537, 10201, -59056, 10201, 49392, 5369, -49392, -71941, -9664, + 68719, -22549, -66035, -3758, 25770, 26844, 28454, -48855, 2684, -27917, + 70330, 2147, -27380, -38655, -9664, 56371, 41339, -16643, 15569, -1074, + -23622, -8590, -45097, 6442, -12885, -3221, + }, + { + 268435, -22549, -1039382, 0, -104690, 34897, 121870, -90731, -28991, 134218, + -33286, -54224, -358630, 924492, 2599529, 1705639, -286689, 56371, -150861, 46171, + 352724, 263067, -387084, -421981, -92342, 173409, 606664, -418222, 15569, 384936, + -78383, -28454, -231391, -114354, 362388, -134218, 52613, 14496, -178778, 136365, + -184684, -26844, -537, -16106, -5369, 105764, -121333, -34897, -8053, 88047, + -158377, 68183, 102005, 15569, -23622, -21475, -32749, -16106, 0, -15032, + -103079, 62814, 28454, 15032, -18254, 99321, -43487, -41339, 37581, -6979, + 43487, 26307, -47782, 32749, 5369, -9127, 57982, -64425, -1611, -20938, + -46171, 62814, 19327, -12885, 36507, -6442, -12885, -48855, 41339, -16643, + -35970, 11811, 29528, -17180, -19864, 37581, + }, + { + -1192390, 2229625, 495532, -932545, -347355, -919660, 458488, 32749, 189515, 324270, + -207769, -191126, 110059, 914291, -540092, -204011, -125091, -469762, -323196, 345745, + 54761, -108985, -65498, -105764, 169651, 126702, -328565, 45634, -83752, 70867, + 93952, -135828, 180389, 33286, 56908, 27380, -5369, -91268, 93416, -97711, + 9127, 186294, 136902, 43487, -89121, 216896, -51003, -192200, -93952, -54761, + 5369, 0, 25770, 48855, -63351, 14496, 2147, -57445, 41339, -16643, + 14496, 77846, -11811, -68719, -33286, 42950, -9664, 11274, 17717, 1074, + 34360, 38655, -84289, -74088, 39192, 52076, 16643, -14496, 2147, 20401, + 10201, -39728, 10737, -6979, -16643, -2684, -1611, -39728, 50466, 2684, + -19327, 11274, -13959, -15032, -12348, 7516, + }, + }, + { + { + 200790, -871878, -1019518, -160524, 103079, -74625, -61740, 77309, -241055, 192200, + -248034, 45097, -229244, -638876, -1821603, 739808, 756988, 565862, -832687, -551366, + 1154273, 262530, -48318, 300648, -412854, 395674, 21475, -319438, 103079, 25233, + -143881, 141734, -341987, -48318, -409096, 28454, 79994, 121333, 110059, 152471, + 35970, -146029, -15032, 96637, 98784, -124017, -48855, 12885, -1611, 35970, + 17717, -86436, -90194, 73551, -106837, -73551, 27380, -31675, 70867, 9127, + 45634, -2684, -47245, 28991, 34897, -8590, -56371, 21475, 36507, -49929, + -11811, 46171, -14496, 30602, -26844, 29528, 537, 42950, -9127, -42413, + -8590, 28991, 1611, -10201, -47782, -27380, 27380, 22012, -19327, -1074, + 43487, -18254, 11274, -17717, -9127, 16106, + }, + { + 291521, -20451560, 1325534, 860067, 114890, 163746, -162135, -159988, 514859, 27380, + -190589, 89657, -117038, 92342, 293668, 215822, 323733, -362388, -285078, 48855, + 154082, -236760, 161061, -20401, 249108, -160524, -249645, -38655, 83752, -167504, + -114890, 106837, -391379, -64425, 171262, 195958, 35970, -70867, -4832, 46708, + 145492, -112743, -37581, 35433, 31675, -148713, 81604, -153545, 250719, 163209, + -19327, 85899, -153545, -81604, -48318, 69256, 38118, -92342, 57982, 20938, + 25233, -36507, 8053, -49392, -69256, 22549, 31675, 42950, -28991, -56908, + -3221, -24159, 10201, -17180, -25770, 67646, -34897, -7516, 13959, 40265, + 5906, -34897, 29528, 7516, -35970, -33823, 73014, -27917, 9664, -20401, + -6442, 18254, 2147, -20938, 13422, -7516, + }, + { + -733366, 16394427, 1217623, 652835, -891743, -41876, -121333, -183073, -15032, -24696, + -107374, -33286, -92342, 103616, 529892, -102005, 170188, -333934, -731755, -421444, + -333934, -51540, 46708, 114890, -78383, 96100, -10737, -28454, -43487, -23622, + 99321, 188442, 27917, -261993, 66035, -30065, -92879, 106837, -190589, -168577, + 229781, -191663, 72478, 8053, -176094, -143345, 210453, 206695, 23085, -239981, + -140660, 105764, 46708, 0, 12885, 27917, 30602, -73551, -27380, 26844, + 96100, 18790, -46171, -22549, -15032, -6442, 3758, -22012, 57982, 0, + -30602, 3221, 15569, 6442, -18254, 5369, -4295, -14496, -12885, 32749, + 22012, -4295, 8590, -51540, 4295, 10201, -12885, 30065, 0, -5369, + 27917, -8053, 8053, -20401, -2684, 5369, + }, + { + 176631, -438624, -504659, 55298, -214212, 44560, 1611, -21475, -24696, -91805, + -80531, -181462, 191663, -51540, -4514548, 967978, 1028645, -270583, 130997, 594853, + 250719, -19864, -643171, -1068910, 350577, 88047, -550293, 515933, -60130, -357019, + 260919, -201327, -10201, -90194, 83215, 184147, -323196, 112206, 42413, -136365, + 119185, 22012, 3221, -18790, 187905, 50466, -119185, 67646, 47782, -62277, + -100395, 80531, -66035, -11811, 30602, -24159, 8590, 84826, -40265, 38118, + 51003, 26307, 4295, 55835, -10737, -37581, -37044, 5369, -29528, -54761, + -41876, 61740, 28991, 31675, -32212, 53150, 31139, -6442, -37581, 2147, + -537, 8053, -26844, 3758, -28454, 9127, 32212, 25770, -15032, -24696, + 11811, 16643, -10201, -20938, 10201, -8590, + }, + { + 3846143, -22741314, -1794223, 143345, -308164, -60130, 151398, 25770, -107911, 240518, + 532039, -437550, 22012, -550293, -35970, -68719, -28991, -678068, 96637, -154082, + 135291, -225486, -234076, -458488, 335007, -22549, -127238, -742493, -80531, -178778, + -126702, -106837, 87510, 30602, -111669, -75699, -111132, 389768, -112743, -149787, + 155156, 68719, -5906, -133144, 73551, 28454, -55835, 134755, -11274, -30602, + 204548, -51003, -138513, 110059, 8053, 57982, -48318, -21475, 1074, 50466, + 5369, -8053, 54761, -53687, -15569, 6979, -55298, -24696, 49392, -15032, + -44560, -46708, 37044, 83215, 11274, 1611, 25233, -69793, 6442, 10737, + -4832, -20401, 8053, -53687, 15569, 14496, -2684, -1611, -10201, 22549, + -12348, 4832, 5906, 537, 23622, 11274, + }, + { + 263067, 802622, -1121523, 150324, 11811, 60130, 57445, -20938, 1074, -111669, + -45097, 14496, -245350, -151934, 2628520, -237297, -1341104, 936840, -639950, 1468879, + -52076, 75699, -889058, 664646, -229781, 288300, -95026, 2147, 491774, -475668, + -223875, 289373, 340376, 132070, -105227, 94489, 124017, -119722, 102542, 151934, + 95026, -125091, 40265, 83215, 2147, -24696, -73014, 55298, -4295, 14496, + 20401, 45097, -107911, 60130, 81604, -56371, -13422, 9664, -1074, -54761, + 45097, 27917, -39192, -17180, 45097, -35970, -5906, -2684, 11274, 34897, + 98247, -33823, -41876, 18790, 32212, 4295, 13959, -42950, -34897, -19327, + 30065, -46171, -17717, 13959, 32212, -7516, 2147, 12348, 2147, -26307, + -14496, 32749, 25233, -17717, -10737, -8590, + }, + { + 6524592, 25028922, -836982, 389768, 219580, -146029, -114890, -136365, -657667, 77309, + 97711, 97711, -54761, 14496, -100395, 88584, 68183, -134218, -375810, 268972, + 229244, 212601, -40265, -18790, 203474, -88584, -64961, -5906, 284005, 90194, + 236760, 23622, -235686, 205085, -147103, -170188, -127775, 57445, 160524, -60130, + 23085, -124554, 45634, -71941, 37581, -38655, -78920, 149787, 113817, -140660, + -17180, -150324, 49929, -69256, 31675, -4832, -91268, -6979, 14496, -40802, + -46708, -9127, 3758, 2684, 39192, 42950, -38655, -78920, 45097, 34360, + -51003, 32212, 69793, -52076, -40802, 22012, 16106, -37581, 2684, 24159, + -53150, 27917, 3221, -47245, -11274, 67109, -12348, -27380, -6979, 23622, + 19327, -31139, 12348, -1074, 6979, -1074, + }, + { + 303332, 775242, -983548, 55835, -163746, 41876, 18790, -1074, 20401, -173409, + -42950, 46171, 227633, -1126355, -693637, 80531, 940598, 821413, -60130, 428960, + 223875, 833761, 128849, -938987, -336618, -599685, 292058, -157303, 235686, 224412, + -31139, -154619, 146566, -128312, 10737, -53687, -62277, -188442, 34897, -186831, + 15032, 165893, -64961, -76773, 123480, 7516, 67646, -286689, 109522, 187368, + -125628, -44560, 16643, 92879, -187368, 3758, -33823, -65498, 15032, 119185, + 23085, 50466, -70330, -43487, -26844, 57982, 45634, -16643, -25233, 46171, + 0, -1611, 41339, 48318, -32749, -17717, 30065, -28991, -31675, -33823, + -53150, 19864, 13422, 7516, 29528, -2147, 10737, -33286, 19327, 11274, + -28991, 9664, -5369, 537, 1611, 537, + }, + { + -1063004, -43553652, 474594, 834834, 145492, -143345, -232465, -171262, 467078, -18254, + -542240, 41339, 143345, 869194, -98784, 540092, -436476, -123480, 175557, 72478, + -176631, -190589, -345745, 45634, -136365, 201327, -147103, 69793, 53150, 343597, + 309775, -135828, -88584, -15569, 53150, 39192, 117038, 338766, 280784, -76236, + 139586, -61740, -110595, 15032, -88584, 326954, 113280, -72478, -64425, 40802, + -88584, -164819, 84289, 28454, -84826, 56908, 76236, 65498, -79457, 25233, + 63888, -32749, 65498, -34897, -63351, 113817, 40802, -61203, 6979, 5906, + -20401, 28991, 34360, -18790, -12885, -70330, 48318, 5906, 10737, -38118, + 21475, -10201, 8053, -537, 6442, 36507, 28991, -4295, -18790, -27380, + -12348, 2147, 2147, 25770, -20938, 9664, + }, + { + -338766, -896574, 970126, -494995, 297963, 311922, -676457, 49929, 89657, 142808, + -228170, -237297, -43487, 273804, -160524, -63888, 533650, 547608, -565325, -936303, + -385473, 579284, 739808, -11811, -157303, -246424, 56908, 74625, -100395, 286152, + -1074, 337155, 73551, -184147, 15032, 81604, 163209, -84289, -244813, -92342, + -88047, -28454, -37044, -56908, 133144, -143345, -1074, -55298, 61740, 158377, + -96100, -47782, -49392, -92879, -70330, 136902, 37581, 28991, 11274, -35433, + -69793, -26844, -15569, 68183, -49392, 58519, 75699, 6979, -32749, -93416, + 34360, -26844, -537, 44023, -12885, -28454, 10737, 21475, -6442, 8053, + 27380, 28454, 8590, -17717, 5369, -22012, -11811, 11811, -1611, 23085, + -23085, 9664, -6979, 2684, 3221, -20401, + }, + { + -27917, -2828236, 2083059, 1436130, 405338, 1242319, -1418950, 234076, -83215, 136902, + 77309, 180926, 111132, -206695, -270583, 420907, -295279, -113817, -166430, 281320, + -250719, 417149, -191126, 14496, -272194, -87510, 15032, -27380, 157303, -47245, + -11811, -246961, 8590, 102542, 89121, -105227, 232465, -148176, -126702, 188979, + -184684, -345745, 78920, 17717, 122943, 64425, 26307, 20938, -97711, -1074, + 31675, -34360, -34360, -78920, -7516, -12348, 85899, 111132, -99321, 17717, + 49392, -33823, -42950, 37044, 35970, -68719, 23085, 9664, 24696, -10201, + 19327, 13422, 32212, -3758, -58519, 10737, -39728, -31675, 29528, -15032, + 26307, -5906, -22549, 46708, -30065, 31675, -49392, 17717, -28991, 10201, + 9664, -16643, -17180, 14496, 26844, -18790, + }, + { + -105227, -412317, 307090, -54761, 42413, -250719, 77846, 136902, -17717, 15569, + -104153, 11274, 578747, 55298, -20401, 950798, 475131, 331786, -242129, -391379, + -625455, 198642, -107911, 167504, -674310, 128312, 246424, -621697, 4295, 18790, + -663572, 224949, -41339, 348429, -56371, 19864, -241592, 117038, -153545, 20938, + -158377, 53687, 132607, -136365, -40802, -37581, -24696, 108448, -9127, 10737, + -103079, 16643, 67646, -41339, -76236, -123480, -89121, -11811, 125628, 51540, + 117575, -23085, -55835, -51540, 72478, 66572, -60130, 62277, 2684, 47782, + 5906, -10737, 12348, -4295, -22549, 11811, -51003, -28454, 11274, -30602, + 37581, -22012, -34360, 23622, -3758, -5369, 1611, 20401, 11274, 1074, + 9664, 11811, -19327, -18254, 17180, -5369, + }, + { + -3420405, 1176821, 1152662, -552977, 407485, 79994, -602369, -146566, 40265, 176631, + -14496, -201327, 176094, -637266, -293132, -152471, 341450, -12885, -196495, 38118, + -426276, 108448, -52613, 66572, 200253, -78920, -249108, 253940, -112743, 107911, + 176631, -94489, -161061, 120796, 130997, -24159, -113817, -4832, 166430, -220117, + -76236, 102542, 54761, 42413, 89657, 75699, 71404, 1611, 207769, 47245, + 22012, 12885, 75162, 62814, -126702, -66572, -74625, -18254, -3221, 99858, + -15569, 37581, 16106, -7516, -47782, -5369, 10201, 12885, 69793, -54761, + -52613, 61740, 38655, -28454, -26844, 1611, 11274, 34897, -31139, 2147, + -74088, 15032, 26844, 17180, -12348, -70330, 5369, 37044, 1074, 6979, + 14496, 13959, 17717, -26307, 6979, -13422, + }, + { + -334471, -82678, 406411, 378494, -31675, -22549, -118112, 122407, -102005, -104690, + 171262, -376347, 553514, 430034, -7561827, -846645, -292058, -742493, -32212, 315680, + 227096, -285078, -31675, -160524, -466004, 430570, -228170, -205622, -268972, -35970, + -78383, -70867, -202937, 282394, -81604, -125628, 202937, 0, -14496, -14496, + 198642, 4295, -106837, -19327, -143881, -91805, 177704, -11274, 71941, 42413, + 79994, -82678, -42950, 6979, 36507, -55298, -10737, 30602, 3758, 31675, + 63888, -135828, -53150, 13959, -22549, -54761, 82141, 4832, -57982, -4832, + -45097, -20938, 30065, -11274, 11811, -8590, -69256, 67109, -13959, 47782, + 5369, -54761, 9664, -2684, -20401, 17180, 32212, 35433, -40802, 33823, + 12348, -29528, -30065, 19327, -3758, -27917, + }, + { + 1123671, 3750043, 164283, -434329, 327491, -447750, -389231, 173409, -203474, -27917, + 791885, -223338, -233539, -68183, -1120987, 330176, -171799, -117575, -207769, -64961, + -75162, 32212, 112206, -51003, -467078, 94489, 384400, 394600, -122407, -182536, + 94489, -83752, 30602, 130460, -9127, -115964, -102005, 271120, 51540, 61203, + 81604, -30065, -37581, 16643, 38118, -2147, 102542, 141197, -6979, -77846, + 140123, 163746, -17717, -132070, 22549, -75699, -5369, 57445, -38118, 24159, + -1074, -30065, -15569, 30602, -16106, 28991, 31139, 3221, -25233, 2147, + -22549, 19327, 41339, -3758, -45634, -38118, 16643, 33823, 1611, -16643, + 34897, 14496, -25770, 3758, 12348, -5369, -18790, 25770, -73551, 6442, + -2684, -13959, 16643, -2684, 3758, -11811, + }, + }, +}; + const float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= { { @@ -38580,6 +76356,9110 @@ const float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_M } }; +const Word32 rightBRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= +{ + { + { + -2035278, 19121194, -18495202, 21711596, -15680926, 9638980, 6416681, 4471598, -10793253, -3351685, + 2279017, -5827197, 1007707, 9967008, 8763344, -16039555, 6591164, -2894271, 10535555, -6199249, + 2529736, -2745021, 10612864, -10028749, 3979287, -10853919, 5805185, -3331821, 1793149, 659278, + -1992865, 6929393, -4472135, -2035278, -152471, 761283, 6942278, -13087839, 4218732, -5743445, + 6646462, 9316858, -7805030, -2385318, -988916, -551903, 368830, 5871221, -1902134, 1813550, + -2979634, 1300301, -1066763, 1910187, -861678, -1155883, -2600603, 1974611, -551903, 4977867, + -1408212, -1838783, 600222, 867047, 162672, 37044, 1451699, -635118, -2068027, -2888366, + 1687922, -876173, 179315, 925565, -1653026, 2085744, -1959579, 1526324, 286689, 463856, + 368293, 169114, 262530, 455267, -1733019, 155156, -1090922, 1658931, -1168231, -1552094, + 1267552, -25770, 284542, -1096290, 321586, -537, + }, + { + 8136816, -25189446, 12812961, 30360586, -9987410, 9773198, -3379603, 3135863, -9449465, 456340, + 2957085, -13490492, 9465034, 2585034, 7221988, -7059316, -6502581, -1435056, 13447543, -11040213, + 4391067, -13959, -3312494, -3750043, 8544301, -2517388, -6125160, 1289027, 4635344, -7394860, + 13889924, -8974871, 992674, 354335, -1604170, 10275172, -1265405, -4112968, -4556424, -2851858, + 9610526, -2658585, -3022046, -2483028, 6434398, -4887673, 2120640, 799401, 1380832, -566936, + 499290, -955630, -3023120, 3121368, -3856344, 1736241, -592169, 1614908, -1478006, -240518, + 2666101, 1079111, -4053376, 4402342, 458488, 25233, 1598265, -1979980, -1576790, 156766, + -2041183, -168041, 698469, 436476, -746787, 1155346, 341987, 493384, 2553358, -1379758, + 552440, 861678, -331249, 361314, -855772, -1482838, 2013803, -1247151, -683974, -374736, + 347355, 1074279, -404264, 140660, 199179, -215285, + }, + { + 2308008, -1722819, -2019172, 29935922, -13342853, 13094818, -861141, -8566849, 1262184, 3405372, + -4356708, -11042898, 6787659, 4838818, -5328444, 1803349, 6729677, -6644852, 5601174, -48855, + -5687611, 6048388, 3274913, -1105954, 1222455, -1165547, -6602439, -9337259, -3428995, 1684701, + 11617350, -535797, -4531728, 3995930, 2230162, -3075734, 3430605, 1599875, 3325915, -4949950, + -4392141, 5973763, 3742527, -3918084, -689342, -1402307, 1336272, 2644626, -136365, -2348810, + -3827890, 1547262, -1386201, 382789, 22012, 1186485, 1546725, -4494684, 68183, 1663763, + 4500052, 544924, 180926, -2998961, 4159139, -2168959, 1541893, -1443646, 1865090, -2579128, + -2211908, -1650878, 643171, -1351841, 568009, -1274532, 1035087, -261993, 2499671, 1340567, + 1093606, 78383, 341450, -1297617, 115964, 981400, -2317135, -1459215, -791885, 2099165, + 174483, -565325, 146029, 132607, 117575, -758599, + }, + { + 301721, 8079371, -16995722, 20680804, -17728552, 6823630, 5736466, -1010928, 466541, -789737, + -3018288, -5883032, -1736777, 16521129, -16350404, 14711874, 2678986, -10865730, -332860, 1115618, + 39192, 4937602, 1141924, -9066139, 8107288, 7423314, -10737955, -7816304, 7523709, -7333657, + 11012833, -8402567, 2571612, 740882, -3403762, 888521, 9127, -2197950, 4801774, -2711198, + 1327145, 3643743, -2845953, -1785096, 88584, 3867081, -5732171, 1149978, 3424163, -835908, + -4743255, 3193845, 1904818, -3505230, 1681480, -897648, 1036698, -2356327, -332860, 3483755, + 126702, -1999844, -1533303, 3488050, 2003065, -1791001, -2138894, 2908230, -1492501, -1691143, + 898722, -1073205, 1481227, -334471, 222265, 790274, -613643, -523986, 1110786, -122943, + -403727, -28454, 78383, 659278, -983011, 712965, 503048, 91805, -1144072, 1039919, + -441845, 12885, -659278, 17717, 482647, 79457, + }, + { + 16685411, -54204096, 18261128, 23584740, -8156680, 5968394, -1075889, 176094, -1830193, -12161737, + 5422933, -8902393, 9307194, -1027571, 1838783, 2260764, 3607236, -3780645, -1861332, 3337727, + -6289443, 7250979, -6560563, -9421548, 16391206, 5369, -6279242, -7256347, 8251169, 8474507, + -954020, -11196443, 13689135, -10506564, 3978750, 4214974, -2521146, -4527433, 6531572, -1715839, + 3189013, -3187403, 2526515, -2851322, 1031329, 3116536, -2349347, -2099702, -126702, 2244121, + 717260, -1673964, 1902671, -1938641, 104690, 2276870, -6514929, 3122978, -11274, 3352759, + -885837, -652298, -170725, 842350, -1556389, 4847408, -2079838, -1475321, -211527, 146566, + -2585570, -1027034, -86973, 1322313, 984621, 668404, 760209, -203474, 920197, 2085744, + -2031520, 190052, -890669, 1233193, -1330366, 352724, 533650, -53150, -1380295, 1931125, + -1017907, 738198, -183073, -519154, -305480, 521302, + }, + { + -2437931, 24202678, -32778116, 23180476, -17727478, 5976984, 9805947, -3591130, 231928, -6711424, + 5379447, -7529078, -8643622, 3347390, -432718, 13681618, -417686, -6272800, -4049081, -4777078, + 13830332, 853088, -9789304, -7119445, 5083094, -2570538, 18596134, -14281840, 5530308, -4474282, + -4737886, -7016366, 9075803, 4195110, -601832, -9510131, 3097208, -1195612, -2209224, 5714991, + -1158567, -10047539, 7479149, 2357400, -1275068, -5388037, 4286378, -3728569, 1725503, -1583232, + 1963874, -602369, 32749, 1540820, 2452426, 3233037, -3412352, -2348810, -331786, 1192927, + -983548, 857920, -3028489, -1441498, 2808372, -1243393, 1506997, 379568, -2443300, 905164, + 39728, 99321, 1142998, -1673427, -1089848, 2616709, -230854, 23085, -1470489, 655519, + -523449, -2321967, 105764, 676994, 1919850, 1213328, -846109, -794569, -855235, 371515, + 153008, -790811, 1471563, -1074, -241592, -325881, + }, + { + 19390166, -64063196, 24146306, 20260972, -654446, 1129040, 4246649, -3192771, 191126, -9803800, + 10201621, -15146739, -1774358, 11901354, 3289945, 9708774, -7872675, -5925981, -4275103, 408559, + 11675869, -5082020, -13572634, 4686883, 2867428, -3920768, 8893804, -8516383, 6592775, -607738, + -2825015, -6295885, 8706972, 7479149, -5155035, -5909875, 4575214, -4413616, 6012954, -1402307, + -432718, -5543729, 3523484, 3182034, -4394289, -2340220, 2091649, 1402844, 856846, -2628520, + 881005, -1826972, 4114579, 660888, -278099, 3063386, -3355443, 521839, 2674154, -2136746, + -41876, 186831, -2192044, 714575, -455267, 980326, 1877975, -2006824, 875100, -2247879, + 704912, 239981, 1570884, 232465, 1915019, -2413772, -118648, 1237488, -98247, -339839, + -1067836, -889595, -228707, 1085016, -2053531, 3872987, -1950452, 688805, -1749662, -193810, + 1383516, -1638530, 1030255, -149250, 422517, 343061, + }, + { + -2224793, 24359980, -38693360, 24678882, -14039174, 1191853, 8783745, 723702, 1782411, -6467684, + 1130650, -10030896, -3144990, 9911711, 2107218, 554588, -2541010, -5852430, 10450192, 5086852, + -8255464, -49392, -983011, -978716, -15438797, 13928042, 11463268, -7081864, -5822902, 1729798, + -4765803, 3954054, -5646809, 11143293, -8586176, 4599373, -4912369, 5098663, -5324686, 519154, + 2229625, 602906, -8669391, 2154463, 5063230, -989453, -3520800, -3645890, 4125853, 4983773, + -4363687, -5438503, 8181913, 1229971, 1847910, -361851, 442919, 205085, -6287832, 1260573, + 1610076, -3684008, 516470, -316754, -501974, -683437, 3135326, 2234457, -4832375, 181462, + 1666447, 845572, 2465848, 727460, -155693, -1211181, 2338073, -1021665, -1751810, -353798, + -694711, -446677, 374736, -438087, 1165010, -113817, 1073742, -550830, -2615635, -96100, + 995359, -276489, 2211908, 282931, -190052, -740882, + }, + { + 18733036, -62598076, 27393838, 19163070, -535260, 9795210, -2845953, -1230508, -4468377, 0, + 3419868, -12179454, -2422362, 22666154, -18511846, 10930692, -6583648, -4216048, 11125039, -3110630, + 2776696, -15039902, 15306190, -11666742, -11208791, 10506564, 5202816, 2368675, -12700755, 3821984, + -643171, 493921, -2736968, 425739, 6603512, -6469832, 958315, 3280818, 934155, -2275796, + -2750390, -2179696, -427886, 678605, 1084479, 1592359, 361851, -1058710, -1385127, 1103270, + 2352568, -5490579, 1574106, 3666828, 760746, 2566243, -1251983, -12885, -4351339, -537, + 1276679, -2313377, 1281511, 3760781, -3617436, 952409, 3158412, -528818, 616865, -2945274, + 925565, 1319092, 186831, 2400350, -2095407, -51540, 616328, -1152662, -1024887, -210453, + -485331, -1555315, 1232119, 432718, 892816, 361314, 93416, -398358, -390305, -520765, + 377420, 1126355, -794569, 1438814, -107911, -121870, + }, + { + 2752000, -825707, -8179229, 16479253, 2835215, 3725884, -20996484, 5611912, 13813152, -4757213, + -1916629, -12141873, 12455405, 4762045, -11391327, 2378338, -10085120, 5406827, 4566087, 2015413, + -6605660, 9790378, -1069984, 1208496, 3748433, -12312061, 7002408, -9823664, -1425929, 3026341, + 4692789, -1962800, 6811818, -5387500, -1667521, 6510634, 264677, -586263, -5311264, 8185671, + -250719, 2115808, -261456, -11483669, 1715303, -1672353, -3612604, 5099737, 1149441, 3209414, + -5313949, -16106, -2797098, 1750736, -2193655, 4679367, 1271847, -1480690, 4041027, -5419175, + 875636, -5175436, 3777961, -2184528, 2040110, 992674, 1005559, -1060320, 2103997, -2279017, + 847182, -1785096, 598611, -1993402, -1107565, -216896, 140123, 727997, -121333, 205085, + 731755, 248571, -56371, -333397, 413391, -1195612, -385473, 1349694, -356482, -1950452, + 1060857, -808528, -383863, -70867, 1350767, -1133335, + }, + { + 11999065, -40768904, 18858128, 15680389, 1698123, -2427194, -11236708, -7740605, 16375100, -3618510, + -6114960, -481036, 6647536, -3309272, -704912, 1320166, -1129576, 11656541, -6546067, 5200669, + 2527052, 7603703, -12822625, 11763379, -14040248, 623844, 3594888, -251792, 30065, 2532957, + -1068373, -516470, 2602750, -7248294, 4001299, 24696, 1743220, -3599720, 3703336, -3347927, + 3355980, -2763812, 988379, -1322313, 154082, -537, -3790846, 6980933, -2502892, -421444, + 5133023, -5999533, -1521492, -1117765, 3856881, -97174, -185220, 5153424, -1775432, -1306207, + -938450, -314069, -77846, 2870112, 1905892, -1671279, -663572, -569620, 183073, -919660, + 1631014, -275952, 1882806, -2303713, -451508, 637803, -1475321, 1974074, -153545, -592169, + 1198296, 2167885, -1814624, -467078, -102542, 1296543, -2226404, 284005, -245350, -257698, + 25233, -1120450, 1564979, 813896, -340913, 228707, + }, + { + 596464, 6371047, -9658308, 15191836, 228707, -1268626, -21166136, 16761647, -2787971, 4490389, + 3436511, -13826573, 14001593, -12692702, 1101659, 1949378, 5230734, -9315784, 4208531, 318901, + -8022462, 835371, -7016903, 12051141, 359167, -8105677, 8099772, 3777961, -2772402, -2400350, + -2447595, 5048197, -5597953, 6600828, 4696547, -5738077, 2341294, -5284421, -40802, 1775432, + -1517197, -7615514, 12034498, -3599720, -5408975, 6559489, -1930051, 1999307, -3163780, 4827007, + 4862440, -8359080, 2467996, -850940, 1184337, -89657, -5303748, 2367601, 68183, -3901441, + 3757560, 3653944, -1782948, -391916, 877784, -683437, 315143, -3100967, 1063541, 3797825, + -1165547, -1789928, 2885681, 2587181, -1634235, -640487, 1476932, -1544041, 559956, -1927367, + 1895691, -1404454, -547071, -30065, 1059783, -797253, -539018, 2723546, 991064, -433792, + 1355062, 377420, 76236, -335007, 444529, -1616518, + }, + { + 18286360, -59293096, 25884158, 13550085, 6586869, -1349694, -10688026, 12868796, -10344966, 15255724, + -25170118, -95563, 6919193, -17524540, 16559246, 833761, 39728, -2471754, 2050847, -5446019, + -166967, 4176319, -3117073, 4264903, -7564511, -483184, 1455994, 7459285, 2395518, -8699993, + -2865280, 437013, -3252364, 6910066, 4022237, -2068564, -1074, -5796059, 6518150, -2180233, + -7810935, 987306, 7740068, -1113470, -3537979, 3973382, -883153, 3079492, -2222109, 421444, + 887448, -1373853, 288837, 1604707, -4583267, 2483028, -5653251, 6015102, -3847754, 3966402, + -1320703, 1296006, -1108102, -122407, 731755, -811749, -1991791, 2147, 4271882, 1867237, + -2911451, 1600949, -370978, 858457, 276489, -624918, -734439, 1032940, -2309619, 1322850, + -2050310, 74088, -1268626, -526670, 1245541, 348966, -190052, 1330366, -733903, 732292, + -151934, 1126355, 1050656, 120796, 79994, -907312, + }, + { + 4379256, -8027294, -2474975, 11282879, 2308545, -699543, -26183194, 22315040, -4377109, -5325760, + 6444599, -17369922, 5887864, 5151814, 10521596, -12064026, 13545253, -2038499, -5294084, -8467528, + 7938710, -8148627, 14334990, 2097555, -11656541, 6869800, 5526013, -10798085, 1962800, 3207804, + -7486128, 3976066, 2341831, 3394635, -13418552, 9698573, -1971390, -1440425, 633508, 1112933, + 5093831, -2662343, -763430, -3320547, 3207804, -1882269, -1918777, 4769025, 218506, 1089311, + 906238, 177704, -1381906, -1457068, -408022, -330176, -1122597, 937914, -1254131, -619549, + 1773822, -2922188, 994822, 1688996, 2619393, -1215476, -2312303, 2065342, -1634772, 287763, + 649077, 434329, 41876, -1411434, 1393180, 580357, -988916, -311385, -265214, 1007170, + 152471, 284542, 295816, 129923, 239444, 256087, -215285, 473520, -470299, -877247, + -10201, -454730, 44560, 534723, 615254, -1833414, + }, + { + 16895864, -54960012, 26162256, 1380295, 16823924, -7062537, -11407433, 12160126, -9874667, 6729677, + -7201587, -1016297, -9790378, 15442018, -4313221, 1765232, 2644089, -5308580, -6852621, 474594, + 3176128, 8330626, -7447474, 7694434, -7218230, -8999567, 9812390, 2077690, -3107409, 3114925, + -6233608, 3409667, 153545, 2242510, -8741332, 4974646, 337692, 2350421, -4612795, 4078072, + 1963337, 4505421, -8259759, 858993, 1553704, -3667365, -216359, 2161442, 2552284, -157840, + 1795296, -2142115, -2095944, 1222455, -2944200, 1583769, -1969243, 1218697, 217970, 2449205, + -2509335, 610422, 9127, 170188, 380105, -2280091, 1448478, -21475, 368293, -3209951, + 3218004, -2907156, 2608119, -1095754, -857920, 909459, -95026, -1690070, 27917, -792421, + 1132798, -970663, 348429, -856846, 1066226, -81068, 1224066, -341450, -289373, -1067299, + 153545, 544924, 372052, -1489817, 1401770, -318364, + }, + }, + { + { + -264141, 68258840, 16369194, 7657927, -19297288, 12680891, 8750996, 8322036, -8681740, 590558, + 1330903, -3745212, 11426224, 15974057, 6109591, -22472880, 15177878, 2458869, 5107790, -12659416, + 7072738, 6630893, 19915764, -18089328, -4084514, -15334644, 7822746, 1563905, 10470057, 2245731, + -11425687, -791885, -10370199, -765041, -2507187, -3817152, 5339181, -18183818, 1686848, -12220793, + 3582540, 10499584, -6015639, 1218160, -3363496, -4555350, 2185065, 13197361, -621160, 1715303, + 820876, 2257005, -350040, 3044595, -192737, -620086, -5199595, -1002875, -1379221, 8775692, + -537408, -5123359, -2718178, 124017, -417686, -1664300, -100395, -469225, -1668595, -2694018, + 4977330, 337155, 84289, 1720671, -1258425, 1060320, -4556424, 268435, -316217, 187905, + -342524, -941135, -515933, -1095754, -3115462, -447213, -2077154, 1591822, 570694, 683437, + 2177012, -179315, -494458, -1740536, -92342, -963683, + }, + { + -4207458, 11868605, 68243808, 64874944, 963146, 1488743, -8151848, 8546985, -1186485, 4255776, + 4422743, -15265924, 8908299, 3878892, 18137646, -13084618, -16029892, -6694781, 6089190, -13163538, + -2189897, -7266548, -6488085, -3187403, 15574088, -1573032, -3801046, 3948149, 1757179, -7145752, + 20168630, -10482405, 3975529, 10151692, 4738423, 12752832, -2797634, -6446209, -12394202, -8941048, + 8881992, -5426155, -3031710, -2182380, 6542846, -2054068, 7231651, 1922535, 1042066, -1531693, + 1868311, -1212791, -5148592, 2353105, -1440425, 5470178, -1835562, -507880, -4183298, -3055332, + 1342714, 100932, -5385889, 8165807, 2510945, 285615, 1763621, -1602023, -776852, 266288, + -1804960, 2097018, 2119566, 2414309, 101469, 137439, -498753, -814970, 1097364, -1450625, + 2468533, 770410, -2040110, 325344, 1233729, -443992, 2629057, -1296006, -1644436, -288837, + 932008, 1259499, 561567, 770947, -706522, -1843078, + }, + { + 360240, 59506236, 54447300, 49316960, 3038689, 6859600, -4317516, -4193499, 2901251, 9657234, + -4147865, -18968186, 2515777, 2574833, -6462852, 2360622, 15911243, 26307, 9143985, 1374926, + -7511898, 2328946, 1428614, -3746285, -1068910, -8958228, -16355772, -14168560, -4329864, 3381213, + 14697378, 2992519, -7168838, 3199214, 7068443, 3152506, 10628433, 7519414, 9500468, -2983929, + -8159364, 4471598, 5507222, -3732327, -2914672, -4795331, -1592359, 1921461, 1227824, -3299072, + -3706020, 4696010, -3301756, 215822, -598074, -860604, 6550362, 1823214, 508417, -1575179, + 5600101, 2542084, 409633, -5030481, 2576981, -2389076, 893890, -1142998, 3403225, -2692408, + -289373, -1605244, -292058, -1339493, -400506, -2269353, 886374, 338229, 5612449, 3199214, + 2233383, 1023813, 1071058, -1959579, -1937567, -478889, -3166465, -686121, -948114, 1605781, + 872415, -556735, -1476395, -1075352, -100932, 333397, + }, + { + 531502, 43401720, 3537979, 1577864, -34132640, 4432943, 5692979, -2640868, 2745021, 19924890, + 6817724, -8168491, -3328063, 10139881, -28794534, 19249506, 23091892, -8381629, -17289928, -5530844, + 675384, 8301635, 10322954, -4350802, 8532489, 5298916, -15050102, -15217069, 1519882, -13725642, + 15373835, -6106907, -4163434, -3051038, -4210679, -1787780, -4375498, -3969624, 7347079, 1956358, + 4325032, 3663607, -1793686, -4230543, -2026688, 4755066, -8110509, 1428614, 3813931, 1873680, + -5880884, -1782411, 3063386, -1624035, 2356327, -75699, -586800, -5396090, -1050120, 5902896, + 1153736, -1986959, -311385, 6939057, 6101538, -1575179, -3809636, -290447, -4608500, 810138, + 4321811, -175020, 2995740, -178778, 282931, 456877, -322123, 379568, 644245, -789737, + -139050, 356482, 111132, 676457, -1199907, 650151, 735513, 1610613, 177167, 1088774, + -960999, -363462, 292595, 497142, -99858, -162672, + }, + { + -14406931, -97638032, 20167018, 57848376, 17260400, 2102387, -7294465, -2382633, -7247758, -10233296, + 9731859, -14901389, 8752606, -9897215, -3969087, 4721243, 20994338, -1827509, -15416785, -6052683, + -24034100, 770947, 7330973, 929860, 14398341, -51003, 1061931, 1007170, 14256070, 9368934, + -1114007, -15522012, 14061723, -6973417, 8539469, 7597797, 591095, -4095788, 7967165, 784368, + 956704, -6170795, 6309844, -1786706, -1880659, 3495567, 407485, 3068754, 1776506, -302795, + 656593, -3244848, 3884798, -614717, -3867081, 2477123, -7969312, 945967, 786516, 4130685, + 999117, 1772211, -2575370, -1768453, -2158758, 8359617, 506806, -1627256, -2023467, -2541547, + -5661304, -2167885, 1455994, 3266323, 4156992, 1324997, 258772, 1341104, 3541738, 4835597, + -559956, 57982, -1640678, 1546725, -2763275, -1045825, 1279363, 1407676, -181462, 2694018, + -728534, 1558536, 506806, -126165, -97174, 1141388, + }, + { + -1709934, 53832048, -15636902, -4982699, -38745436, 7272454, 9113384, -4870493, 5386963, -2739652, + 4188667, -9689446, -5834176, -6052146, -12681965, 6539625, -5248450, -4712116, -8708583, -11519102, + 10946798, 710280, -1588064, -13626857, -4671851, -5371931, 20970178, -13539884, 2967286, -9826885, + -5739687, -17287780, 76236, 5759015, -3591130, -12936441, 4291746, -5178657, -5720897, 5063767, + 2779918, -8745627, 4474282, 2184528, 1973001, -2500745, 3600256, -7444252, 1564442, -358093, + 2791192, 1781875, 277025, 1864553, 5597416, 3664681, -6814503, -4044249, -925029, 758062, + -744640, 1199370, -4755066, -2698850, 1524713, -3941169, 2275796, 4118874, -1459752, 67646, + 44023, -1498944, -2912525, -6648610, -4444755, 3225521, 316217, 494995, -1442572, 361851, + -818728, -2570001, 54761, 2206003, 3364033, 856309, -1827509, -483184, -103616, 1584306, + 578747, -1868311, 762894, -1175210, -408559, 28454, + }, + { + -16222628, -118763360, 20569136, 65128884, 34739308, -2097555, 5369783, -4232691, 2654290, -12229919, + 12791486, -2734821, 488016, 11002096, 4356708, -3078418, -15992311, -1684164, -9960566, -16145856, + 3534221, -7588134, -15604153, 7527467, 3561065, -10734734, 5029944, -4920959, 13320841, 1678795, + -11274, -6325413, 4936528, 10176388, -630823, -7608535, -814433, -8527121, 8180839, 79457, + 3346317, -5655398, 2627983, 780610, -11334419, -5671505, 2827699, 4954782, 6896107, -1822677, + -5020817, -4156992, 7619809, -623844, -3088082, 5021891, -180926, 6977711, 6842957, -2402497, + 3175592, 1369021, -5062693, -925029, -828392, 236760, 1435056, -1135482, 863288, -4093104, + 1316944, -294205, 2559801, 1895691, 2027225, -4370129, -1394254, 3416110, 2029909, 13959, + -546535, -1330366, -776315, 171799, -3670587, 3891777, -2906082, 1051730, -1647657, -725313, + 1679869, -1009854, 439160, -758062, 1139240, 908386, + }, + { + -2219424, 42355356, -32041530, -1141924, -32543504, -3792993, 8963597, 7785165, 6080063, -3036005, + 7787313, -5597953, -5874979, 153545, 5277441, 3939022, 1756105, 7575249, 8230768, -963146, + -13646185, -4514011, -4355097, 9257265, -5930276, 7636452, -2311766, -5406290, 809064, -228707, + 3695819, 4208531, -16069083, 5367636, -10220412, 6593312, -5848135, 888521, -8319889, 120259, + 4854387, 4691178, -12111808, -1730872, 6338298, -85899, -3127810, -5130876, 864899, 6976638, + -2062121, -3659849, 11198053, 1411971, 3722126, 1090385, -2201708, -2020245, -5067525, 316754, + -1870458, -5059472, 2196876, 608275, 902480, -777389, 859530, -1044751, -3335579, 5276904, + 5186173, 3817152, 5046587, 2024003, -497679, -4060355, 576063, 836982, 612033, 351650, + 285615, 494458, -109522, -2614561, -1152662, -1865090, 1188095, 963146, -2824478, -1773822, + 797790, -150861, 1656247, 676994, 949725, -146566, + }, + { + -15829639, -110438104, 30605400, 69485056, 43733504, 11235634, -6339909, -1993402, 573915, 9400610, + 16230681, -9069897, -11547020, 14753750, -33012192, 1687922, -2166811, -7781944, 7033546, 2911451, + 3606699, -27564026, 10615012, -5402532, -17794050, 2283849, 3342558, 3766686, -6459094, 3898757, + -12232067, -9852655, 3721589, 2822331, 2840584, -6944425, 978179, 280247, -2435783, 1275605, + 227096, -6495065, 634045, 292058, 474594, 9312563, 6704981, -2259690, -6755447, -215822, + 2816425, -5832029, 2029909, 122943, -1808181, 2816425, -5488432, -418222, -2097018, 2997887, + 4195110, -1457605, 3700651, 7563975, -125091, 2978560, 1904818, -153545, 391916, -4334696, + 912144, 239444, -2011655, 1298154, -1161252, -741956, -2119566, -3084860, -2282775, 1212255, + -402116, -2946348, 1297080, 1330903, 793495, 382252, 1313186, 828392, 863288, -44560, + -1077500, 509491, -941135, 1770063, 571231, -452582, + }, + { + -339839, 44124348, 26177826, 10539850, -9363566, -6541772, -24353538, 17830020, 25158308, -6756521, + 2340757, -16545825, 12599287, 13695577, -14882599, -12927315, -28409062, 14654965, 17803714, 5109938, + -6106370, 5277978, -5619965, -4399121, 2581275, -10138270, 7839926, -15468325, -113280, 7741679, + 13956496, 485331, 5724655, -5297842, 1183264, 14993731, 10114111, 4206921, -6965363, 8410620, + -2738579, -364535, -2531883, -18612240, -4217121, -2622078, -8845485, 847719, -2096481, -1132798, + -2263985, 1522566, -3172907, 6910066, 3769371, 8256538, -1839320, -1879048, 4782446, -10922639, + -407485, -5303211, 1831804, -7557532, -1663226, 1391033, 4396436, 310311, 1768990, -2795487, + -531502, -2842732, 1672353, 256624, -834297, -3186329, -1682017, 978179, 378494, -1451162, + -2500208, -1032940, 598074, -525060, -2004139, -5039608, -862752, 3219078, 1655710, -176631, + 1494649, -1185948, -1142998, -1242856, -16106, -3591130, + }, + { + -9096204, -48709760, 45932528, 28967944, -1402844, 11814381, 504122, -28758028, 15211164, -6026376, + 666257, 748398, 1163936, 4890894, 1649804, 4962298, 17480516, 35225176, 1400159, 12046846, + 15061377, 4494147, -20076288, 6463389, -13477071, 6518687, 6799470, 2131378, 5486284, -5484673, + -7472170, 7437273, 2684355, -7296076, 2414309, -660351, 1615982, -4911832, 3090766, -4846334, + 5865852, 1857573, 9038222, 7577396, 3908420, -1487132, -12265890, 740345, -2016487, -2579128, + 4234838, 38118, 1442035, -1268626, 7180649, -127238, 90731, 7564511, -3417183, -3746285, + -2144799, 617938, 2651069, 3580392, 2176475, -573378, 197032, -106837, 909459, -1111860, + 1680943, 10737, 2121177, -2248952, -1870458, -1853815, -2812667, 3216931, 36507, -1225676, + 1409823, 2120103, -2434173, 705448, 1676648, 1318018, -3786014, -1835025, 242666, 679679, + -1220845, -1190780, 3220689, 995359, -1360968, 48855, + }, + { + 17717, 54784992, 23431730, 1261647, -15328738, -15483894, -26288422, 19927574, -5037997, 1713155, + 24054502, 6634114, 9312563, -14493367, -8264591, -25598542, -10921028, -6864432, 2573759, -3119757, + -14550275, -11250667, -6102075, 16705275, 7176354, 1389422, 9811853, 1286343, -1203665, 9263171, + 6380174, 4863514, -7590818, 2022930, 253940, -3193308, 1948841, -17146046, -7196755, 2149094, + -463856, -13774497, 12564927, -1797981, -8523363, 6788196, -2374043, 681289, -5655398, 1437740, + 3498251, -7858717, 3701188, -1290101, 3436511, 3903589, -4709969, 4153770, 5297842, -4374424, + -332860, 1532230, -3764539, 1905355, 519154, -5029407, 2206540, 185757, -43487, 2928094, + -538482, 490700, 5464272, 1500017, -2569464, 134218, 3336116, 1271310, 3312494, -679679, + 2463164, -1781875, 174483, 1300301, 2326799, 101469, -516470, 3731253, 2050847, 107911, + 1561758, -184684, 471910, -406948, 293132, -2758980, + }, + { + -13037373, -119832808, 20034412, 33978024, 28166932, 22021908, 4514548, 1536525, -23257784, -2517925, + -34543884, 732829, 1498407, -23270132, 8352638, -5792301, 4954245, 279710, -5243618, -3097745, + 9058086, 11238319, -2702608, -7373385, -13749801, 3248606, 7058242, 11234024, 700080, -16359530, + -13044353, -4664335, -5019743, 10441065, 4859756, -640487, 10001905, -1467268, 5603322, -1282048, + -11167989, -1177895, 5214627, 503585, 5438503, 2747705, -3906810, 7931194, -4318053, -7828115, + -6734509, -3400004, 6933688, 3829500, -5398774, 8350490, -4884989, 8793946, -486942, 2975876, + -3671660, -389768, -2155000, 96637, -404264, -1844689, 106300, 1551020, 5019206, 4592931, + -3461744, 307627, -1483911, -986232, -689879, -3584150, -3265786, 2895345, -949725, 2254321, + -3060701, -2143189, -4442070, -3450469, 1283122, 1207960, -542777, 2015413, 511101, 615254, + -92342, 2246268, 2260227, 1665911, 867583, -2013803, + }, + { + -1574106, 28410672, 25350508, -263067, -12904766, -18254148, -38652560, 22014392, -13957570, -16482474, + 7407745, -19494320, 13811004, 11447162, 12911745, -3107946, 21007758, -6742025, -14986752, -18660560, + 1446330, -13320304, 19738060, 14465450, -11120207, 5535139, 1085016, -15114527, 6826314, 3825742, + -10099079, 6310381, 2850248, -3690451, -15334644, 11972758, -4378183, -3469797, -4003447, -1180579, + -987843, -2045478, 6498823, 2587181, 8345659, 5111548, 1829656, 5087389, -2306934, -3893388, + 3545496, 4791573, -2787434, 1060320, 1707786, -4021700, -5747203, -1468879, -2952253, -4022237, + -1130113, -2844342, 4635344, 3595425, 2395518, -4681515, -5033165, 1705102, -1339493, 4152697, + 4198331, 838592, 276489, -158914, 1963874, 933619, -636729, 1564979, 1387811, 1771137, + 856846, 695248, 195421, -1058710, 279710, 368830, -2510409, -146029, 1190780, -993748, + -1483374, -1474784, 325881, 1495186, 791348, -2379412, + }, + { + -12686797, -114869976, 14782741, 12022150, 27876486, 3537443, -6538551, 1541356, -11693048, -105764, + -15764677, 4575214, -21502216, 9688909, 3062849, 320512, -11837467, -18284750, -17658222, -1417339, + 11826729, 14911590, -16420197, -2177549, -14505178, -10348724, 19689740, 8227547, -6728067, -2907693, + -6628209, 11530377, 2808372, -3825742, -8645232, 13686987, 3542274, 5517959, -3066607, 2404645, + -1107028, 3416647, -10194642, -7060390, -2795487, -2154463, -78383, -693100, -2320356, -3117610, + 4847408, 1249836, -3910568, 2581275, -1980517, -180926, -8295193, -2182917, 1132798, 5174362, + -912144, 2592550, 3278671, 683437, -3942243, -6502581, 1400696, -2298881, -3142842, -5080947, + 3237332, -4072166, 2511482, -1592359, -1452236, -209380, -1818919, -1594507, 132607, -3551938, + -531502, -2587181, -1224603, -2474438, 932008, 1799591, 2067490, 131533, -221728, -1684164, + 120259, 1286343, 532576, -2388539, 1607928, -1526861, + }, + }, + { + { + 2319819, 28944858, 37702832, -23418846, 21703544, 3565897, 9201967, -31675, -2671470, -225486, + 10560251, -11447698, 16920560, 15935402, -13241921, 587874, -4072166, 1095217, 6875706, -9826885, + -5191005, 13609141, 23190676, -9360881, -4994510, -9152575, -2283312, 4062502, 7018514, -1185411, + -4217658, -11281805, -7624641, 6271726, -1721208, -5656472, -3153043, -6708202, -2204392, -9580998, + -1003412, 6698002, -1792075, 482110, -1799054, -3906810, 4581120, 2047626, 7164006, 6979, + 453656, -1037235, 3088082, 261993, -813896, -1254667, -3978214, 999117, -612033, 2655364, + 570157, -5136244, -272194, 1833951, -3446175, -1828582, 439697, -1059246, -573915, -3516505, + 4056060, 3534221, -156229, 78383, 1741072, -326954, -2935073, -2637647, 420907, -1549410, + -340913, -20938, -1730872, -115964, 110059, -2113661, -994822, 1246614, 611496, 1607928, + 745714, -188442, -107374, -1186485, -448824, 558346, + }, + { + 753767, 108776488, -22784802, 22588844, 21629456, 6777459, -4938139, -857920, 6720013, 4965519, + -2471217, -564788, -1379758, 1301375, 17222818, -10423349, -10629507, -2128156, -1199370, -2287607, + -14916421, -2884071, -3186329, -5877663, 12251394, -1234266, 825171, 1622424, -7526930, 4479114, + 8270497, 1734630, 4357781, 6941204, 4226248, 5331665, -3427384, 811749, -11646341, -6671158, + 2944200, -3454228, 925029, 892816, 2964064, 1538672, 522375, 1288490, 1899449, -1962800, + 3625489, -4380330, -742493, 921807, -154619, 3010772, -3125663, -793495, -1939178, -2510945, + -1758789, 1687385, -3310346, 6277632, 3006477, -1568737, 737124, 27380, -4331475, 3058554, + 361314, 2936684, -856309, 1373316, 685047, -602906, -1224066, -227096, 1097364, -1210107, + 3096672, -1377611, -312459, -2590939, 3039763, 1684164, -205622, -935229, -831613, 1245004, + -947577, 1515587, 522375, 773631, -1415729, -913217, + }, + { + -2006824, 103549512, 17637820, -5538897, 45635100, 5542119, -5538361, -7670275, 4872104, 9917079, + -2228014, -10747082, -4708895, -1699196, 3350075, 1067836, 9624485, 6330782, 1838246, 2168959, + 5611375, -8829916, 148713, -7799124, 1787243, -473520, -15446850, -17827336, -3163780, 10790568, + 984621, -623844, -714038, 5652714, 8495445, -362925, 6298033, 7435662, 7712151, -1674500, + -3993783, 4139275, 209917, -499290, -5053566, -2975339, 3253975, -3045669, -3189550, 2457258, + 1534377, 2068564, -3296924, 2377265, -1301375, -494458, 2265595, 2931315, 5541045, -3969624, + 2161979, 2877091, 299574, -2123861, 2185602, -1718524, -2212982, 1660005, 117038, 408022, + -57445, -727460, -958315, 213138, -1620813, -461709, -702764, 1574106, 6328635, 1829656, + 1344862, 1687385, 672699, 13422, -2755759, -833224, -1774358, -748935, -660888, 1757715, + 583579, -495532, -2022930, -304406, 348429, 929860, + }, + { + -392990, 41625212, 10570988, -14656576, -10007274, -1921461, 1383516, -838056, -2013803, 18891950, + 6048388, -5664525, 548682, -720481, -10778220, 10470057, 11247446, 9737765, -23707146, -4012573, + 3853660, -7345468, 8099235, 4086662, 9196062, -1850594, -8952322, -6728603, -5669357, -9167608, + 5989869, -140123, -5742908, 2643552, -9250286, -1943473, -6310918, 2885144, 1162862, 5325223, + 4292820, -1648194, 1002338, 1586454, -1050656, -1373853, -7685307, 3872450, -648003, 3112778, + 3623342, -9716290, 1438814, 4480725, -3205119, 2017561, -2035278, -1605781, -3986267, 4001299, + 2251637, 518617, 2209224, 2848100, 5950141, -3132105, -564788, -2794950, -3221762, 2068027, + 3809636, -868657, 1510755, 1196148, 2041183, -1547799, 155693, 445603, 1530082, -962610, + -641024, 185220, 1374390, -260919, -1131187, 882616, 503585, -37581, 1008244, 536871, + 427349, -1687922, 481036, -134218, 366683, 472446, + }, + { + 12954695, -61631172, -37902012, 43744240, 19943680, 14212584, -11323681, 6899328, -5323075, -1649804, + -9860708, -10394358, 4308926, -3387656, 957778, -12364137, 23770496, -1658394, -11199664, -11897059, + -17113298, 4134980, 8600672, 1266479, 7688529, -3712462, 8318815, 6398428, 6229850, 4748087, + -1938104, -3860639, 1566589, 4811974, -1777580, 6323803, -1365263, 2128156, 2146947, 7098507, + 353261, -1602023, -3164854, -200790, 1584306, -4534412, 1908039, 4523675, 5236639, -2210835, + -1780264, -2420214, 3855270, 254477, -3536369, 3674345, -811212, -2755222, -2140504, 2414845, + -204548, -498753, 852014, -756988, -106837, 1647657, 4236985, -2769717, -2525441, -2010582, + -2892661, -2024003, 3979824, -1054415, 4907537, 612033, -1199370, 3659312, 3497177, 1631014, + -374199, 1367947, -1203128, 1093069, -2040110, -662499, 2191507, -304406, 2587718, 273267, + 78383, 973347, 1085553, 222801, -1032403, 668941, + }, + { + 2897492, -22214644, 56315076, -16298864, -19292994, 679142, 763967, 795106, -1476932, 4671851, + 2322504, -8194798, -5809480, 1423782, -17292612, -2463164, 6000606, -11121281, -3917547, -212601, + -6662031, -5126581, 0, -18816252, 11337103, -8024073, 820339, -1915555, 3346853, -4524748, + -10072235, -9329743, -120796, 1825898, -8617852, -1556389, -2625299, -6512244, 1923072, 2532420, + 3731253, -7903814, 6039798, -2253784, 1652489, 5970542, -3033858, -3956739, -1940252, 7219840, + -515933, 5877126, -5326833, 2008971, 3251827, 4005594, -962073, -2399276, -6631967, 2119566, + 193810, -3780108, -2876018, -265751, -4221416, 1592359, 1671816, 6204617, -1133871, -5093831, + 795106, 178778, -3451006, -2552821, -4828080, 1674500, 948651, -1771674, -1391033, 180926, + 1433445, -3657165, 109522, 4448513, -436476, 1398549, -1731409, 1082869, 188979, 657667, + 968515, -1923072, 1073205, -3256659, 579284, 1124208, + }, + { + 14364518, -80550504, -47483548, 72426568, 24154896, 4940286, 2577517, -1988033, 6879464, -10627897, + -6793028, 13962402, 3634616, -690953, 14814953, -9290551, -14208826, -3568581, -8363375, -4986994, + -5245229, -10459319, -8067023, 120259, -2403034, 1929514, -146029, 1571421, 1610076, 7381438, + -766652, -4441533, -1510755, 7169911, 2697240, -8498667, 2192044, -7756711, 5091147, 1337882, + 2814814, -2855080, 190052, -1967095, -1949378, -3200825, -1862942, 2980707, 1898376, 4096325, + -9882183, -1541893, 3647501, -2042257, 961536, 2869575, -227096, 6660421, 6994891, 17180, + 2458869, -3056943, -772020, 3076270, -1941862, -3064459, 287226, 1189169, -437013, -2489471, + 2457258, 656056, -445603, 3249680, 1419487, -3541738, -2147, 2115272, 209380, -813896, + 1699196, -1432372, -337155, -409096, -1103270, -459562, -608275, 1797444, -2087354, 272730, + 818728, 99858, 1413044, -1603633, 1149978, -311922, + }, + { + 2579665, -40336724, 51156280, -12734578, -18255222, -7678865, 5017596, 6427956, 3042448, 3697967, + 4057134, 4563403, -15539192, 16549583, 77846, 4536023, 8067559, 8933532, -5475010, -7257958, + -3950833, -5145908, -2913062, 7628399, -4872641, -5819144, 9654013, -9446244, 13945222, -11560441, + 17472464, -146029, -13969918, 682900, -2309082, -11154030, 6209449, -4904316, 1132798, 998043, + 4056597, -1731946, -972810, -3942780, 1571421, 2411087, -3081639, 1147293, -5186710, 2330557, + 1987496, -1733556, 5512054, 3837017, 3793530, 1893007, -1232119, -3926674, 899259, -4617090, + -310848, -3901978, 935766, -1670205, 5339181, -5428302, 298500, -644245, 1003412, 2854543, + 3549254, 9527848, 1021665, 105764, -668404, -22012, -306016, -781147, 947040, 1189169, + -333934, 340376, 107374, -2764348, -692564, -1090385, -166967, 731755, -1999844, -1713692, + 643708, 937377, -507880, 1209033, 1583232, -563714, + }, + { + 14132053, -71225056, -42908872, 78504488, 32649268, 9781788, -7323993, 4472135, -2007897, 17058000, + 7848516, -6811818, -4708358, -3936875, -7399155, -20024212, 13773423, -5065377, 157303, 11645267, + -7619272, -12361990, 682363, -15994995, 932008, -2284923, 2811056, -2223719, -2341294, 1016834, + -6393596, -5953362, 4725001, 1029718, 865973, -5821828, 1181116, -170725, 3683471, 1254667, + -1626182, -8784282, 2421288, 710817, 5204964, 3033321, 1623498, 7471096, -11628624, 236223, + -1383516, 1174137, 2884608, -3655017, -1611150, 1059783, -3834332, -748398, -1982664, 4955319, + -79457, -1740536, 4743255, 3931506, 1095217, 1446330, 1131724, 1977296, -3050501, -1837172, + 1622961, -429497, -3196530, 2503966, 1202591, -1232119, -3498788, -2560338, -2752537, 2486249, + -1452236, 332323, -1850594, 1605244, -101469, 280784, 214212, 1520955, -1155346, 1960653, + 131533, -2224256, 257161, 472983, 2287070, -1478543, + }, + { + -922344, 72021232, -4733054, 7123740, -667867, -22170622, 1170916, 17093432, 8396124, 71941, + 2243584, -5024038, -3020436, 16132434, -16524887, -10103374, -10636487, -1744294, 20018842, 523986, + -619549, -2701535, 854162, -2974802, 5114233, -7841537, 2908230, -10545218, 8689256, -3168075, + 13419625, 1510218, 4942971, -1698660, -4633196, 9732396, 10821707, 6271726, -4631049, 1409286, + 4634807, -4458176, -2212982, -9414568, -10961293, 3586298, -2927020, -5034239, 2592550, -4084514, + -1033477, 3630858, -6227166, 1020055, 12026445, 4653597, -3083250, 230318, -2743947, -2879239, + -4468914, -2426120, 3093450, -2804077, -6646999, -1387274, 3513820, 1439888, -260382, 3539053, + -4388920, -789200, -1253057, 1484985, 1945083, -3755412, -425739, 265751, -1174674, -495532, + -2145336, -2413772, 719944, -127775, -2099702, -2163590, -833761, 1794760, 1982127, 707059, + 988379, -1852205, -277562, -1323387, -797790, -1818382, + }, + { + 6829535, -4631586, -2022393, 22952842, -6286759, -10412611, 47649976, -19138912, -8761196, -18123688, + 15247134, 826244, -1563905, 11100343, 3874597, 135291, 14912663, 17854180, 24543054, 7419019, + 13469017, -5099737, -5581310, -1948305, -6321655, -565325, 4143033, 4322885, 11477763, -7404524, + -5694053, 8495982, 2360622, -1997160, -1754494, 2569464, -8004746, 3281355, 4850629, -6138045, + 6324876, 6009196, 3154117, 15094126, -378494, -1792075, -7276212, -5564130, 1826972, 3514894, + -4450123, -905164, -1493575, 8164733, 3221762, -1743220, 1485522, 2906619, -317828, -6451578, + -2924336, -463856, 7247758, -1966021, 1187559, 2372970, -48318, -974958, 2687576, -2034204, + -942208, 3061775, -1816771, -1198296, -1122060, -3861176, -180926, 2161979, -1772211, 1873143, + -99321, -527744, 1377074, -2560874, 3274376, -1801739, -471910, -1874216, 306016, 1126892, + -1371705, 1906966, -553514, 1481227, -1591822, 392990, + }, + { + -19864, 59989956, 7067369, 155693, -5249524, -7074885, -18354006, 6287832, -14496, 1925219, + 8179229, 15331423, -9498320, -4452808, 7060926, -14884746, -26843546, -3818226, 532576, -2065879, + -17450988, -10554882, -5025649, 20571282, 7714835, 4760435, 1087701, -10098005, 14557792, 9210557, + 15593953, -539018, -1185411, -13053479, -2245731, 3538516, -4478041, -19733228, 779000, 512712, + -3025268, -9882720, -646393, 3098819, -3958349, 8253317, -3776887, -920197, -1884417, -4560719, + 2134599, -1459752, 795106, -1773285, 3620658, 3841312, -1576790, 3290482, 763967, 2466385, + -6521908, 2421288, 278636, -9127, -323733, -5100274, -1840930, 1614371, 1056562, -1306744, + 1016297, 2105071, 4930623, -1725503, 64425, 40802, 3030100, 2332704, -82678, 2814277, + 1541356, -2250026, 199179, 2167348, 202937, 1327682, 1544578, 1396938, 1928977, -1321776, + 1043677, 430570, 1220845, -941135, -34360, -1855426, + }, + { + 7998303, -126444912, -2124935, 27062588, 22119618, 4729833, 36673652, -12920335, -5803575, -15448460, + -32138704, 11742977, -2935610, -3482682, -2052994, -9889162, 7932268, -8997956, -683437, -4476430, + 11574937, 7524246, 11304354, -12541305, -9454834, -1960653, 5217312, 14353244, -8145943, -9180493, + -12410845, 5837935, -7912404, 3833795, 3586298, -4996658, 13214541, -1912871, 4458176, -2796024, + -4699231, -1364726, 1930051, 4263829, 3100430, 1147293, -3722663, 7454453, -6751689, -5834176, + -1240709, -4653597, 7908109, -530428, 742493, 2005750, -2276870, 5861557, 2037962, -2426657, + -530965, -1993939, 1356673, -1047435, -2247342, 2843268, -315680, 3307662, -949188, 751082, + 1228361, -3251290, -68183, -739271, -2930778, -290984, -5513128, 2525441, -1957431, 1065689, + 144418, -4342749, -2490007, -3899294, -28991, 1785096, 2331630, -453119, 2855080, -134755, + -11811, 2276333, 243203, 1846299, -275952, -1449015, + }, + { + -239444, 64660732, -7542500, -1413044, -7427072, -19581830, -26217554, 7961259, -18523120, -2325725, + 2055142, -7137699, 7783018, -2286533, 7580081, 24739012, 2565169, -9474161, -10690174, -10882373, + -18433462, 9125732, -10428181, 25200720, -187905, -3858491, -1597728, -11820287, 6437619, 13970455, + -5391258, -6322729, 4958540, -14073534, -4568235, 5798743, -7526394, 3952981, -4640712, -6068789, + -2576981, 2402497, 3516505, 7998840, 10105521, 5260261, -3411278, 2045478, -588947, -2138894, + 5474473, 1498407, 583579, 2688113, -605054, -4816806, -3187403, -2224256, -3986267, -3394098, + 3203509, -5547487, 4103841, 3103651, 518080, -3459059, -3769908, 3206730, -2099165, 4172024, + 5148055, -1465121, 377957, 3844533, -1430224, -549219, 1177358, 1534377, 1539746, 173409, + -2138357, 3531537, 155156, -1935420, 518080, 2016487, -1881196, -1559073, 1373853, -1909113, + -1079111, -1047435, -49929, 1214939, 209380, -783295, + }, + { + 8339216, -116711440, -15710990, 21214990, -2940442, -6344204, 35182760, 785979, -8130910, -12636868, + -15180562, -3327526, -17394618, 7359964, -13263396, 16000364, -2921652, -29623464, -14282914, 14407468, + 6478422, -605590, -3767223, -9404368, -16044387, 252329, 15077483, 7737921, -7301445, -10338523, + -1089848, 12239046, 12205760, -5396090, -1835025, 1465121, 8293582, -887985, 237834, 879931, + -680752, -5015985, 452045, -12487617, -6416681, 6979859, -2079838, -6749004, -3044058, -3362960, + 3955665, 1533840, -2987150, 3329674, -126702, -3555696, -6625524, -4499515, 4407710, 7291781, + -4605279, 5317170, 2995740, -878858, -601295, -7810398, -1227824, 956704, -4676146, -1893007, + -2907693, 528281, 579821, -4063039, 513785, -333934, 41339, -1392106, 781147, -4263292, + -2277407, -24159, -1592359, -1631014, -1539746, 2783139, 1904281, -491774, 1287417, -1622424, + 484794, 887448, -190052, -1510755, 212064, -1074816, + }, + }, + { + { + -1918240, -43880072, -18045842, -25942676, 25643640, -6176700, -2615635, -3579855, 4920959, 4709969, + 9423695, -12212740, 6226092, -4181151, -24048058, -1581622, -22200686, -8328479, 4632122, -2757906, + -1834488, -2239826, 6148246, -2541547, 4937065, -1029182, -993748, 667331, 290984, 6148246, + 8431558, -9540733, -1769527, 9940702, -251256, -501974, -2218351, 35970, -484258, -8828305, + 342524, 3484829, -322123, 2375654, 524523, 2191507, 2244121, -12552579, 3438121, 1379221, + -4555350, -6427956, 911607, -5410048, -1988570, 5608154, -869731, -858993, -730144, -3974455, + -640487, -1587527, -261993, 2106682, -3610994, -850404, 3235721, 3298535, 4095251, -1050656, + 1009317, 2163590, 1574106, -186831, 54761, -730681, 1691680, -567473, 119185, -2391760, + -387084, 1140314, 989990, 2535641, 2264522, 260919, 1197759, 1144072, -62277, 515396, + 548682, 286152, 1953136, 902480, -362388, 68183, + }, + { + 711354, 138954544, -12490302, -35967668, -26876832, 849867, 3845070, 5906117, 9491341, 7217693, + -205622, 2899103, -3848291, 1131187, 16150151, -11436961, -7938710, 5352066, -5513665, -4710506, + -4370129, 4804458, 7346005, 853088, 3373697, -3283503, 803159, -968515, -4248797, 3658775, + -2619393, -736050, 3296388, -118648, -5040681, -951872, -1628866, 4953171, -642635, 1323387, + 3359201, -1728188, -83752, 2853469, -2473901, -3881040, -4246649, -4216048, 2120640, -2165201, + 1136556, -419296, 251792, -722628, -219580, -36507, -3664681, -2322504, 108448, -2260764, + -2595771, 3980361, 236223, 5332202, 528818, -3245922, -2338073, -685584, -2248416, 4540318, + 166967, 1236951, -4146254, -753767, -62277, -2147484, -3181497, -1876364, -424665, -820876, + 3813931, -1786706, 18254, -3591667, 3037079, 1453846, 61740, 1065152, 150324, 235686, + -2216203, 925565, 226023, 1032403, -573915, -206695, + }, + { + 958315, 58310624, -43556872, -59716688, 6352794, 991601, 401579, -824634, 5898601, -322123, + 1767916, -1779727, -5461588, -5406290, 1220845, -3659849, -760209, 1921998, -285615, -3635690, + 3139084, -12343736, -920197, -6639483, 9166534, 6650220, -2014340, -7974144, -7427072, 8618389, + -3652870, -2698313, 2396592, 862215, -1519345, -7485591, -2357937, 3886409, 3342558, -1867774, + 3817689, 5250061, -1760937, -938450, -2435783, 1737851, 6539088, 690953, -108985, 5785858, + 3550327, 2716030, 2736431, 7515119, 3931506, 206695, -2326799, -1018981, 4481262, -5245766, + -429497, 413391, 883690, -110595, 2074469, -516470, 433255, 2973191, -1681480, 2330020, + 842887, 747861, 415001, 91805, -296353, 1692217, -630823, 2261300, 4753455, -1123671, + -216896, 636192, -1385664, -693637, -1657857, 874026, 41339, 856309, 428423, 811749, + 1314260, 1341104, -69256, 126165, -714575, 1307281, + }, + { + -708670, 14049375, -3346853, -7175280, 4207994, -2696703, -2211371, -706522, -8320963, -3506304, + -3863323, 6509560, 4721243, -4027069, -2675228, -561030, -4581657, 16904454, -17861696, -2068564, + 2880313, -12125766, 516470, -6117644, -4759361, -3603478, 6247030, 3732864, -4847945, -9203041, + 552440, 5270999, -4342749, 4371740, -4609574, 1579474, -2452426, 2752537, -6216429, 6409702, + 5796595, -6928856, 3122441, 1872069, -183610, 501974, -6387690, 2416993, -168041, 6922951, + 5876589, -7285875, 4205310, 4189204, -6081137, 98247, -2152852, -542240, -4789963, 3124589, + 2260764, 955093, 863288, -240518, 707596, -3008625, 2360085, -2887829, -1354525, -361851, + 354872, -281320, 1551020, 422517, 1305670, -3351148, -599148, 422517, 2333241, -606664, + -897648, 96100, 1457605, 76236, -1459215, -657667, 214212, -947577, -747324, -585189, + -96637, -1611687, -68719, -1241782, -522912, -494458, + }, + { + -14264123, 1555315, 25510496, 8566312, -8382703, 8748848, -3743064, 15483357, -3855807, 15152645, + -3266860, -12496207, 2539936, -9794136, -2559264, -12444668, 14336601, 1790465, 8952322, -1737851, + -4117800, 5468567, 6672769, 2187749, 3506304, -2725157, 6859063, -1396401, -5215164, -6301254, + -2535105, 3834869, -810675, 3237332, -8638790, -1694365, -6200859, -366146, -2491081, 5547487, + -3282429, -4089346, -1640141, 4275103, 6211597, -1684701, -4014721, -3693672, 7266548, -842350, + 4847408, 3812320, -2487323, -3923990, -3823595, 4646081, 1537061, -1673964, -2886755, -1298154, + -651761, -590021, -287226, -420907, -89121, -3605088, 1104344, -2305861, -977105, 1103807, + 2675228, 1377074, 4906464, -3116536, 777389, -1534377, 341450, 2358474, -484794, -1829119, + -2523830, 1087164, -857920, 1139777, -537, -93416, 1428077, -1374390, 1951526, -471373, + 576599, 389768, 403190, 1115618, 286152, 99858, + }, + { + 573915, -46036680, 40758164, -2710124, 7351911, -1191853, -2334315, 4228932, -2225330, 2248416, + 2725694, 1598265, -3174518, 7179575, -10473278, -8401493, 6350646, -4610648, -4240744, -7239168, + -21087216, -13972602, 2401961, -23034446, 17027398, -290984, -9906879, -1375463, 6651831, 14020384, + 3251827, -5890011, -692564, 1106491, -7711077, 5828808, -2405182, -1086090, 12524662, 1549410, + 54761, -4480725, 7307887, -971200, 1377074, 5964099, -1362042, 338766, -1583232, 8360154, + -3288334, 3825742, -5506685, -1383516, -2887292, -1938104, -1662689, 313533, -3212099, 6918119, + 2900177, -2514703, -1762547, 401579, -4198868, 3474629, 818191, 5693516, 414464, -3678103, + -251256, -1981591, -132607, 4012036, -838056, 654983, -1174137, -3046743, -1733019, -1158567, + 3097208, -2190970, -1327682, 1919314, -3760781, 469225, 196495, 1524713, -45634, -1143535, + -286689, -2262374, 1045288, -1818919, 1060857, 825171, + }, + { + -16001438, -14432701, 29985852, 35421668, -10590852, 4774930, 614717, 5539434, 17623324, -4271882, + -12428025, 3508452, -175557, -5707475, 13246753, -2922188, -8778913, -2936147, 199716, -1369021, + -8099235, -5225902, 1104880, 3590056, -2885144, 11010149, 5792837, 2245731, 2384244, 5508296, + -561030, -3017215, -7714835, -1127966, -174483, -8036958, 2368138, -2513093, 7001871, -439697, + 425202, -26844, 2628520, -1974074, 4837744, 1078574, -3672197, 1376537, -2849174, 2735894, + -5749888, 812286, 313533, -4017405, 37581, -911607, -4829154, 4714264, 6925635, -629750, + -3135326, -4592394, 5048197, 4504347, -1123134, -1372779, -408559, 1095754, 200790, -348429, + 1505386, 680215, 222801, 3652333, 1758789, -2641942, 54224, 507880, -18254, 517007, + 2952253, -770947, 180926, -116501, -115427, -68719, 158377, 2052458, 32749, 1033477, + -146566, 48855, 1204202, -1704565, 1513976, -918586, + }, + { + 2020245, -34964792, 58193048, -4935991, 5336497, -4766877, -3154117, 394063, -2794413, 1532767, + 563714, 13346074, -4528506, 17318382, 6089727, -387621, -4979478, 16233366, -7428683, -16183974, + -4175782, -3163244, -8408472, 9404368, -1770063, -8878771, 10997801, -4734128, 20869782, -16682190, + 13026636, 2211908, -4526896, 6142877, 2605435, -10471130, 11293617, -6200859, 234076, 4567698, + 5151277, -1784022, 4731980, 2051921, 3272228, 3956202, 4241280, 8534100, -9792525, -3812857, + 411243, -7007239, 138513, 669478, 127238, 4386772, 4151623, -2822867, 294742, -4822175, + 1392106, -3976066, -654983, -2285996, 4296041, -5722507, 1551020, 1860795, 1903744, 586800, + -503585, 4830765, -4125853, -1621350, 1762010, 1784559, -2094870, -1288490, -490700, -2520072, + -2369748, 591095, 257698, -1592896, 798327, -1017370, -1862942, -471910, 19864, 714038, + 945430, 21475, -2325188, 801011, 1416802, -578747, + }, + { + -15714212, -20855824, 19266686, 40329744, -15804406, -3865471, -6774774, 10850161, -39192, 6509023, + -4828080, -2595771, 3053722, -4053376, 6351720, -3800509, 21959630, -7469485, -9573482, 11648488, + 674847, -4153770, 1890323, -12010339, 8990440, -1626182, 4231617, 252866, -985695, 3834869, + 3118683, 3539053, 6397354, -4582193, -2813741, -2764348, 6850473, -1462436, 1073205, 5548561, + 7444252, -5841693, 1469416, -1392106, 1367410, -194884, 3052648, 10077604, -9124658, 2652142, + -3158412, 780610, 1541356, -2433636, -164819, -1413044, -3827353, -1233729, -5347235, -1485522, + -4420595, -5073430, 609349, 510027, -1150514, 590558, -920197, 650688, -2410551, -1411971, + 2343979, 1217086, -455803, 3083787, 1645509, 331786, -1492501, -622233, -1723893, 1865090, + -1402844, 2458869, -1422171, -1045288, -3090229, 722091, -9664, 210453, -2374580, 1510218, + 923955, -2547453, 661425, -248034, 402116, -1320703, + }, + { + -72478, 59748900, -25232396, -11822434, -1745904, -2550137, 16608639, 3008625, -3508988, -169651, + 437013, -12706124, -7094212, 16385300, -5209796, 19147502, 14152454, -12771085, -1224066, -8170102, + 737661, -5996311, 3256659, 1000727, 10071698, -5398237, 4205847, 2554969, 11495480, -16229071, + 532576, -7283191, 7310035, -638876, -12994424, 8292508, 3264175, -6455873, -4168803, 1745904, + 4323959, -3198677, 8834211, -522912, -8458938, 7801271, 2169495, -791348, 3810173, 1518808, + 2944200, -2281702, -4433480, 424665, 4864588, -461709, -3499862, 3202435, -2450816, 2097555, + -2553358, -3379066, 268972, -629750, -2706366, -1158031, -258235, 1141388, -3097208, 440234, + -3320010, 2486249, 980863, 865973, 2059974, -497679, 1773822, 289373, -2306398, -695248, + -1246614, -2551211, 1185948, 1826972, 942745, 2573759, 2685965, 4145180, 2022393, 777926, + 1300301, -324807, 1514513, -301185, 179852, -192200, + }, + { + -7235946, 53833656, 38021736, 9775882, -7416335, -13034152, 42877732, -10982768, -4117263, -32023276, + 1089311, 1686848, 3809099, 9793062, 9286793, 1873680, -2406792, -5910949, 10792716, -7117835, + -1826972, -8815420, -374199, 11274, 6590628, -4632659, -10557566, 1667521, 7547868, -6244346, + 2419677, 3889093, 1747515, 704375, 4015795, 9046275, -4598836, 9475772, 10170483, 271657, + 5998459, 2325725, -8594766, 2819646, -471373, 7842611, 2182380, -1285806, 762894, 725313, + -6620155, -5752035, -6624450, 5197448, -261993, -6027987, -3206193, -1739999, -6792491, -5401458, + 1289027, -1717450, 1777043, -7980049, -521839, -2167348, -1463510, 1884417, 1929514, -1618666, + -3988414, -641024, -2070711, -202937, 1676648, -1116155, 1496796, 1557999, -2648921, 3463891, + -2090575, -4891431, 541166, -2055142, 2345052, -913754, 2758980, 1583232, 279173, -493384, + -407485, 2506114, -2691334, 427349, -1295470, 1618129, + }, + { + -534187, 18891950, -26160108, -572304, 2762201, 8715562, -5819681, 2410551, -270583, -2982855, + -13526463, 3798899, -5781563, -1806571, 19184546, 6346351, -13139379, 7958575, -3198677, -198642, + -6257768, 6356552, -5114233, 2299955, -8117488, 219580, 293132, -10699300, 13353053, 7097971, + 11410117, -3917547, 3118683, -6853157, -249645, 6563784, -4714264, -17099876, 7763154, 3939559, + 5092221, -1147293, -816581, 5227512, -5960878, 3847217, -4114579, -423054, -1355062, -5994701, + 7277822, 4198868, 1994476, -3980361, 1551020, 6001143, -3903589, -2451353, -4155918, 3678103, + -3710852, -2106145, -2137283, 810675, 1716913, -3470871, -5258651, -619012, -1607392, -6666326, + 360777, 1749125, 1955284, -4181151, -617402, 857383, 881542, 550830, 277025, 322123, + -1258962, 168577, 1207423, 338229, -1998770, -268435, -85899, -1118839, 1017907, -1108638, + 684510, 54224, 732292, -1982664, -1277216, 638340, + }, + { + -5968931, -136162272, -8779450, 7566122, 11451993, -14922864, 31347892, -3075734, 3410204, -2914135, + -10872710, 18344342, -3726421, 2207613, -15848429, -24343874, 5982353, -3504693, 8744017, 9014063, + 16371342, 2150168, 12680354, -5180805, -2467996, -2734284, -4672925, 9096204, -2988760, 7206955, + -6254546, 8375186, -2269353, 838592, 5904507, -3074123, 7205345, -7186554, -39192, -2544768, + -5470178, -6466610, 616328, 6609418, 1893544, -1443646, -2295660, 5377299, 1540820, 1981054, + 6225018, -609349, 5375152, -6509560, -2346663, -1966021, -4508642, -1109712, -5222680, -3798899, + 5705864, 4316979, 4804995, -1404454, -3197066, 721555, -2802466, 1651415, -3616899, -754841, + 2726231, -2842732, -1238561, -244276, -3506304, 1538672, -4642323, -60130, -3529390, 154082, + 1287953, -1505386, 1440962, 145492, 742493, -1521492, 1015760, 473520, 3612068, 560493, + -215285, 1437203, -778463, 112743, -579284, 113280, + }, + { + -227633, 71292160, -9406515, -8950175, 433792, 6003291, -13150653, 259309, -5757941, 4684736, + -2052458, -5763309, 172336, 14958297, 41667624, 11363410, -22239878, -3892851, 7620346, -348966, + -13530221, 20627118, -19959786, 17281338, -2240899, -13649406, -3627637, 2344515, 4313758, -1882806, + -11150809, -7580081, 2922188, -11441793, 2963528, 7716446, -7953743, 1582696, -413391, 127775, + 1503239, 4466766, 3829500, 8039105, 2189897, -1953136, -6391448, -1505386, 2397129, 2591476, + 3307662, -3473018, 3604551, 1345399, -4460324, 747861, 1559073, -359167, -1255741, 148713, + 6002754, -6779069, -410706, 1660005, 1781875, 2384781, -881005, 2088428, -1750736, 1345935, + 2793339, -2034204, 430034, 2097555, -2837900, 163746, 1365263, 365072, -2141578, -626528, + 340376, 3049427, -2711198, -2964064, 253940, 2241973, -1642825, -1697049, 2644089, -1793686, + -853088, 744103, -1010391, -531502, 115427, -973347, + }, + { + -6466074, -111536008, -10341208, 10894721, -13147432, -16146930, 34506840, 3171297, -3536369, -3668976, + -10514617, 2346663, -13188771, 4302484, -17532056, 4998268, 6920803, -4879083, -2439005, 8571144, + -4878546, -7877507, 5619965, -11811, -4667019, 5556614, 3380676, -1126892, -3980361, -11153493, + -959388, 3149822, 6935836, 1141388, 7637526, -3215857, -2500208, -3310883, 10669773, 8142721, + 2593624, -3124589, 1463510, -10227928, -7708393, -644782, -6090801, -6998649, -2511482, -2243584, + 6105833, 2538863, -6058052, -1321776, -278099, -2136209, -3015067, -188979, 7805566, 5267241, + -4897874, 4419522, 2556579, 2696166, 3418794, -2094333, 3702262, 5464272, -2752537, -1278290, + -2844879, 839666, -973884, 232465, 3502009, -814433, -346282, -260919, 2142652, -3581466, + -1743757, 1410897, -311922, 71941, -1044751, 1644973, 1763084, 416612, 639950, -1511292, + 985158, 804233, 1464584, -386010, -236223, 28454, + }, + }, + { + { + -250182, -67501320, -3795677, 12597139, -12487617, -4380330, -6108517, 187905, 8588861, 4679367, + -136365, 4977867, -5176510, -6286222, -14210436, -6744710, -19058380, -11252814, -9173513, 1122597, + 9018894, -9630927, -644245, -4821638, 15969762, 222801, -3336116, -2173790, -433792, 17851494, + 2760590, -3085934, -5096516, 7583302, -4633733, 1342177, 2357937, 607738, -2771328, -526670, + -2131378, -3108483, 4831838, 2831994, 670552, -118648, 1806034, -4778688, -3406446, 522375, + -4274566, -5395553, 2441689, -4719096, -442382, 981400, 874563, -3429532, 1498944, -2670933, + -1877975, -1821066, 2790655, -719407, -3440806, 2412161, -479963, 4206921, 4240207, 1448478, + -1088774, -175020, 2872796, 357019, 669478, -1632088, 3056406, -491237, 1072131, -2440615, + -267362, 2808909, 411780, 2418067, 1210644, 454193, 2609193, -846109, 498216, 134755, + 1125818, -453656, 2826625, -206158, 76236, 241592, + }, + { + -2980171, 135668352, 5640903, -82402704, 18248242, -24159, 5470715, -357556, 7912941, 5806796, + 11026255, -11322071, 758599, 5941551, 3129958, -5308580, -3478387, -8595303, 1300838, -9011378, + 2548526, -667867, 12090333, 9814000, -9022653, 2403571, -4227322, 2147, 8054138, -1234266, + -5425618, -6599218, 8784282, -4458176, -2585034, -2055679, 1721208, -2209224, 6007049, -763967, + 1438814, 1802276, -3806952, 2770254, -1949915, -515933, -8890582, -1106491, 1723893, -996969, + -1028108, 2756295, -689879, -3155190, 259846, -3157875, -1554778, -2655901, 3922916, -3958886, + -1384053, 2757369, 426812, 973884, 1054415, -744103, -3923990, -145492, 835908, 3031173, + 462246, 858993, -1845225, -1765768, -802085, -2831457, -2164127, -2390149, -932008, 371515, + 4344897, -2758980, 881005, -2605972, 1596117, -704912, 2377265, 306016, 1651952, -878321, + -2316061, 711891, 665720, 161061, 941672, -391379, + }, + { + 340376, -7754027, -1139240, -42134704, -19724638, 608275, 8788577, -3143379, 4630512, -9401147, + 11850352, -12202002, 5746666, -2141041, -8706436, -1352378, 610959, 4338991, -3770981, -5679558, + -919660, -6963216, -169114, -11243688, 11367168, 1764158, 4532801, -8616778, -4132296, 6102075, + 1728188, -5637145, 503585, -663572, -4085051, -5248450, -6360847, 9880035, 352724, -659814, + 6182069, -2187749, 3528316, 1768453, -4147865, 1506997, 2783139, 3053722, 5886790, -2722473, + 7128572, 3125663, 5999533, 2451353, 9482214, -1388348, -1604707, -4679904, 1620276, -174483, + -738734, -1363115, -791348, 1934883, 1889249, -2405182, 3898757, 1391033, -629213, 2834679, + -1611687, 2228014, -993748, 262530, 2216740, -1174137, -638340, 1960116, 1703491, -730144, + -468688, 784905, 1097364, -2587181, -2361158, 1758252, 848793, -49929, 463320, -178778, + 2576444, 419296, 156229, 97174, -220654, 312459, + }, + { + 777926, -35521528, 30748744, 5361193, -3146601, -3801046, -1184874, 1142461, -7658464, -11431592, + -3280818, 15389942, -65498, 1228898, 3363496, -6041409, -10226317, 17902498, -17317308, -2809982, + -514859, -7230578, -10543608, -730681, -2941516, -10973105, 12270722, 4897337, -3151969, -4540854, + -7932805, 507343, 4355634, -488016, 2172717, 7281580, -9371082, 1681480, -1088237, 195958, + 6584185, -3241627, 1491964, 245887, 2353105, -4332549, 642635, -2120640, 1976759, 7815767, + 5971615, -6382322, -845572, 3922379, -3282429, -4364224, -920734, -455803, -2212445, 2092186, + 3860102, 456340, -3093450, 759136, 433792, -3518115, 1754494, -733903, 1578401, -4684736, + 1415192, -756451, 1365800, 1561758, -1128503, -2891050, 1609002, 1117765, -555661, 284005, + -247497, -1331440, 161061, 2072859, -2231236, -1403381, 255014, -166430, -1034013, -268972, + -862752, 97711, 457951, -3360812, 904091, -1973538, + }, + { + 16713328, 43716324, -43960600, -5837398, 3705483, 6150393, 7680476, -2825015, 7969312, 4545149, + 7790534, -5020817, -5465883, -9856950, -9617506, 3650185, 9417253, -10551124, 18799072, 8731132, + 1451699, 163209, -1888175, 2631204, 3040837, 3577171, -3171833, -711354, -7248831, -4910222, + 4874251, -219580, 1156957, -172336, -6496675, -4122095, -2553358, -1241246, -758599, 1777043, + -1249299, -2242510, 2979634, -872952, 3249143, -363462, -1714766, -805306, 2932926, -2905009, + 10266046, 2323577, -6347425, -1469953, -2916283, 3717831, -733366, -1051193, -2579665, 1387811, + -1498944, -230318, 3053185, -4740034, -1029718, -166430, -1610613, -1959579, -668404, -563178, + 3590593, 2239826, 1699733, 446140, -2784213, -880468, 3586298, 549219, -1663226, -1618129, + -1802813, -1615445, 3540664, -1094680, 718870, 1058710, -649614, 213138, -41339, 521302, + -222801, -80531, 1282585, 373125, 1682554, -268972, + }, + { + -2490544, 10312753, -18825916, 4035659, 10657424, -2956548, -484258, -741956, -961536, 7450695, + -4341138, 5794448, -3263102, -2289755, -6315213, 4692789, -5277441, 441845, -5741835, -11854647, + -19110994, -11012833, -7374996, -10098542, 6401112, 7869991, -2860448, -4984310, -2940979, 25063282, + -4850629, 3599183, -773094, -4230543, -4511327, 3957276, -4158602, 4982699, 5348308, 2335925, + -4801774, -1636919, 3765613, -645319, 5684926, 3220689, -2227478, 1365800, -1858647, 5037460, + -1480153, -1274532, -220117, -1644436, -2649995, -1820529, -2065879, -5369, -1738925, 4683125, + 5100274, -583042, -2325725, -999117, -3020973, 3207804, 1453846, 2475512, 500364, -1481764, + -81068, -1200980, 788127, 1083942, 1230508, -390842, -1606855, -3683471, -712965, -810675, + 4141959, -3235721, -1035624, 913754, -1368484, -3015067, 2593087, 689342, 676457, -1671816, + -2094870, 215285, 486942, -1291711, -388695, 1973538, + }, + { + 18121540, 10298258, -17045652, 1853278, 17655000, 1649268, 3148211, 4039417, 12921409, 2167348, + -1195612, -18729278, 486942, 8363375, 8105140, -6133214, -5587753, 3635153, -7553237, -2590402, + -6756521, 3639448, -1510218, -4966056, 10104984, 5945309, 12142946, -6029597, 10456098, 1049046, + 7326141, -9657234, -5350456, -3202972, -4269735, -169114, -2092723, 781684, 4714801, -2388539, + 1369558, -373125, 17717, 4915053, 2491618, 2976412, -2056216, -4193499, -208306, 1401770, + 3408594, -5356898, -2643552, 78383, -1970316, 4546760, -3865471, 3491809, 3045669, 1436667, + -6301254, -1406602, 2390149, 3230352, 3423089, -1650878, -1248762, 1837709, -1531693, 2822331, + -1761474, 1924682, 2536715, 241055, 825171, -1216013, 366146, -185757, 1279363, 868120, + 716186, 442919, 689879, -2294050, 237834, 2507724, -1602023, 1685775, 2335925, 22549, + -1360431, -220654, 722628, 208843, -147103, -274341, + }, + { + -3009698, 46557984, -26159036, 887985, 7141994, -146566, -4876399, 631897, -4224637, -1167694, + -2958696, 10485626, 12875775, 3911105, 405874, 19530826, -14317810, 5446556, -17818208, -8495445, + -1021665, -5616744, -3383897, 11939472, -10891500, 4282620, 3080029, -6415608, 9454834, 1640141, + -2720325, 5601711, 1979443, 2157147, 1106491, -1258425, -675384, -2847563, -4465156, 5250598, + 3812320, 503585, 3454228, 2974802, 3358128, 1141388, 8628052, 1588064, -4325032, -862215, + -4341675, -4973036, 2613488, -5567352, 802622, 4115653, 4085588, -527207, -1003949, -1520955, + -4792110, -340913, -2816425, 1452236, -659814, -2471217, 730681, 3813931, 815507, 442382, + -1606318, 440771, -1510755, -1834488, 562641, 3941169, -2022393, -83215, -2632815, -2756832, + -2945274, 309775, -62277, 329102, -989453, 771484, -1606318, -2484102, 875100, 941672, + 296890, 290984, -1805497, 988379, 839666, -659814, + }, + { + 17979806, -3631932, -20299090, 6653978, 11613592, -6372121, -1911797, 1895154, 4730370, -413927, + 5292474, -8537321, -6589554, 15923054, -4285841, 18507550, -5872294, -328565, -10061498, 5032091, + 6767258, -11245835, 7266548, -6296959, -1677185, 8401493, -6371584, 5572183, -2028298, 1795296, + 905701, 3449396, 3736085, -4077535, 568009, -1304060, 7677791, -6205691, 8738648, -1284732, + 5469641, -3115462, 443992, 548682, 2136746, 973347, -974421, 5143760, -2355790, 413391, + -438624, 708133, -1381906, -2947421, 1821603, -2169495, -379568, -1794760, -3132642, -7410429, + -245887, -1651415, -5090073, 278636, -2884608, 4044249, 572841, -1301912, 52076, -1169305, + -404801, 360777, 2160906, 516470, 3413425, -2488397, 1836635, -1229971, 476205, -863825, + -138513, 1052804, 81604, -1758789, -2052458, 1256815, -277025, -259846, -98784, -71404, + 122943, -1256278, -433792, 1295470, -1639067, 430034, + }, + { + 460098, -3091840, 30697206, -12254079, -3761855, -6173479, 23046258, -5920076, 3512747, -6580427, + -2588255, -15245523, 1331977, 8439074, 5552856, 5138929, 21680458, -11566884, 5148592, -11972221, + -5942088, -3571265, 702764, 10632192, 9057549, -2195802, -1488743, 4050691, 9549323, -6857452, + -11503533, 1511829, 3645890, 5990406, -11664594, -1582696, 3915400, -9175124, 71941, -3081102, + 2485176, -2078227, 7960722, -170725, 4896800, -5731634, 5917391, -5598490, 6029597, 772020, + 4642323, -2771328, -4449049, -2789581, -1210107, 6364605, -2854006, 1969779, -3296924, 3672734, + -3158949, 1249299, -4628901, 994822, -2987150, 1025960, -2460480, 207769, 833761, -3684008, + -1256815, 1854889, -2109903, 1482838, 2280091, 1109712, -74088, -1035624, -328028, -1925219, + -395674, -406948, -2085744, 3627100, 1948841, 3011846, 685584, 4259534, 2109903, 1238024, + -97711, -453119, 2012729, 1019518, -197032, -148176, + }, + { + 8458938, 108714216, -24852828, -3724274, -2849711, 9477919, 325344, -6059662, 8457864, -21102784, + -13609678, 339302, 1299228, 5728413, 12466679, 7197292, -5170067, -13261785, 6242735, -3236795, + 565862, -5747740, -2047089, 2317672, 2462627, -1914482, -11682311, 3076270, 6714645, -6299644, + 1753420, -4204773, 7793755, 823023, 9095130, -6190659, 7446400, 4270808, 9069897, 3822521, + -558883, 2084670, -7159174, 1990181, 2462090, 5219996, 4687420, -2983392, 164283, -1735167, + -7438884, -2677912, -4676146, -2162516, 512175, -4268124, -2482491, -2567854, -9096741, -1495186, + -2302639, 3147674, -1445793, -3595961, -1636383, -5522254, -1984275, 4305705, 934155, -1415192, + -3249143, -51540, 952409, -617402, -1816234, 819265, 347892, 2057289, -2496987, 3598109, + -1145146, -3038689, -3904662, 2024003, -1848983, 1912871, 459025, 2363306, -297963, 457414, + -275415, 1386201, -2872796, 1731409, -143881, -1081258, + }, + { + 246424, -31960462, 17033840, -9354976, 10309532, 721555, 2348810, 1913945, 184147, -3782793, + -14718316, -214748, -5469641, 5116917, 747324, 12255152, 2071248, 9517648, -11411728, -4734665, + -2418067, 9292699, -3851512, 9862319, -17207786, -2583960, 3548180, -3959960, 13377749, 3750580, + -236223, 4968741, -4665945, 5841693, 5629629, -2483565, -9204115, -1344325, 3197066, 3948686, + 10135586, 1697586, -1554241, 4256313, 1053341, -5498632, -2903398, 3932043, -1483374, -94489, + 6735046, 1512365, 2197950, -6497212, 3005403, 224412, 949188, -6483253, -3636227, 2513093, + 856309, -5667210, 1712081, -517544, 1902134, 888521, -8264591, -1282585, -2639258, -4595615, + 652835, 732829, 2885681, -5872294, -1784022, 4110821, -914828, -838056, 3081102, -2127620, + -1904281, 2594160, 722091, -1715303, -2095407, 180926, 591632, -749472, -51003, -39728, + 104153, 1166084, -496069, -210990, -2178622, 664646, + }, + { + 4432406, -135855184, 2277943, -15048492, -897111, 13881871, 6971269, 6162205, -9173513, 7721815, + -7606387, 7268696, -10772315, 1850594, -14296872, -18961744, 1851131, -1956358, 6943889, 10205916, + 14779519, 2304787, 3729642, 10519986, -9376450, 4320737, -9744744, -1430224, 8556649, 6666326, + -938450, 3666292, -5107790, 186294, 6299644, -1691680, 2919504, -2718178, -5576478, -4106526, + 1996086, -10615012, 1679869, 6196564, 6499360, -8964670, 392453, -949725, 10556493, -641561, + 7286412, 4197794, -752693, -4347044, 703838, -7189776, 2042794, -8560944, -6306623, 722628, + 5477157, 2667175, 1740536, 2093797, -1078037, -2092186, 892816, 1580548, -3936875, -1600412, + 1060320, -249645, -504659, -743029, -4795331, 3206730, -365609, 1083942, -5063230, 221191, + -1721208, 370978, 558346, 3406983, -160524, -2721399, 66572, 336081, 1846836, 3675418, + -94489, 766652, 640487, -485331, -142808, -608812, + }, + { + 146566, 42217380, 12011413, -13450227, 690416, 3143379, -9316858, -4155918, 7237557, -3242700, + 1987496, -4970351, 7639673, -2916820, 62750008, -1945083, -22229140, -2099165, 14192719, 8065949, + -6609955, 3861176, -6560026, 8523899, -7942469, 1282048, -11996381, 1065689, 8035884, -11586748, + -5788542, -6195491, 587337, -5350456, 9777493, -3502546, -5420249, 1411434, 4495757, 664646, + -387621, 4089346, 5435281, 7310035, -3046206, -326954, -4006131, -3906273, 858457, 1340030, + 4664872, -3396782, 2426657, -289373, -4919885, 5513128, 356482, 99858, -899259, 4822175, + 4451197, -5713380, -5261872, 3145527, 1122597, 4143570, -943819, 345208, -787053, -1130650, + 3910031, 718870, -2605972, 1069984, -610959, -466541, -862215, 911070, -2153926, 473520, + 2863133, 215285, -2127083, -2080912, -1125818, 840203, 2076617, -1737314, 116501, -123480, + -2260227, 1782948, -670552, -1290101, 1706713, -4850629, + }, + { + 5861557, -100537128, -25125558, 6523519, -9728638, 233539, 7281044, 10153840, -10461467, 2530810, + -2419140, -10838887, -6321118, -16750372, 5013838, 3832185, 512175, 2282775, 5189931, -4552129, + 9568650, -15080704, 13542569, -2347737, 1695438, 4303557, 318364, -4356708, 1829656, -5141613, + -5275831, -7057168, 2738042, 5265630, 12328167, -5766531, -5499706, 3688840, 13159243, 5387500, + -876710, 1926293, -4949413, -5126044, -3664144, -8353175, -5284421, 1825361, -4452271, 2485712, + 2713346, 2298344, -5875516, -3206730, -221728, -3595961, 322123, 2455648, 3604015, 2006287, + -855772, 2925410, 2215130, 3442416, 1209033, 2707977, 4263829, 5122286, -4890357, -308701, + -2508261, 1472100, 1088774, 2365990, 1006633, -2788508, -39192, 1161252, -27917, -2272575, + -2202781, 3847754, -518617, -1896765, 595927, -543850, 2301029, 1191317, -463320, -375273, + 411780, -464930, 1861332, 1268089, 292058, 1044214, + }, + }, + { + { + 1491964, -18676128, 36704252, 29393146, -9873056, 1316408, -2943663, 3233574, 4790499, 2987687, + 535797, 5202279, 2661269, 1363652, -3665755, 2066416, -17051558, -18131204, -17817134, -2552284, + 7652021, -10399726, 7127498, -2728915, 700080, -5799817, 6488622, 3007551, 1219771, 10312753, + 1226213, 2455111, -2743947, 7193534, -6591164, -632434, 7645042, 2479807, -1442572, 7286412, + 941135, -412317, 480499, -719407, 5918465, -1931125, 3999152, 5275831, -3773666, -5027259, + -6244346, -2566243, 2449742, -371515, 2585034, -5432060, -2637110, -1279900, 3095598, 448824, + -1646583, -1731409, 5063767, -2140504, -1596117, 4497368, -1239098, 1580548, 564251, 798327, + -837519, -1828046, 2011655, 1591822, 1377611, -2226941, 1193464, -879395, 2870112, 32749, + 1111323, 4062502, -249108, 926639, -767725, -69793, 2603824, -1674500, 97174, 1496796, + 877247, -2658048, 155693, -2031520, -73014, 1079111, + }, + { + 7046968, 123163552, -6510634, -61540440, 48434348, 6185290, -3529390, -18343806, 1424319, 1733556, + 9675488, -14350023, -710280, 1664300, -5658083, -6752763, -4634807, -9863929, 878858, -9125732, + 9745281, 1408749, 10057203, 2464238, -12860206, 11589432, -169114, -6116571, 3570729, -4508642, + -5148592, -8061654, 9274445, 762894, 3729105, 4479651, 4910758, -8116415, -3681324, -4740570, + 124017, 2658585, -4133906, 103616, 426812, 2369748, -2387465, 4253628, 896038, -2156611, + -4345970, -2338073, -1349157, -113817, 577136, -6084358, 1047435, -660351, 981937, -2218351, + 1253594, 1288490, 305480, -276489, -2099165, 324270, -568009, 875636, -142271, 1731409, + -695248, -459025, -734976, -1766842, -331249, -236223, 981400, -208306, 2844342, 936840, + 1242856, -2512556, 1414655, -1395328, 161598, -3856881, 2625299, 526670, 700080, -108448, + -1196685, 617938, -514859, -1059246, 832687, 215822, + }, + { + 154619, -87307024, -45352708, 15333033, 9133248, -1919314, 6678674, -8064338, -2337536, -8297340, + 6040872, -19589346, 14758044, 7862475, 435939, 3696356, 734439, -1495186, -6776385, 2653216, + 6994891, -5046050, -4358318, -4888747, 6048388, -11756936, 1458678, -7977902, -4935991, 8153459, + 15423764, 1290101, -7617125, -6835441, 5181878, 4479114, 1436130, 13334800, -5339718, -2507724, + 7296613, -2518998, 246424, -4429185, -274341, 4057134, -5334350, -1896228, 6300180, -3513283, + 1134945, -340376, 5630166, -2792266, 6940131, -220117, 1493575, -3576634, -1737314, -537408, + -287226, -395137, 170725, 198105, -2106682, -3968013, 1212791, -2295123, -511101, 2237678, + -3854733, 2092723, -373662, -2068564, 1499481, -2385854, -1773285, -804770, -1354525, -246961, + -195958, 440771, 861141, -2038499, -624918, 1423782, -814433, -1883880, -1157494, -494995, + 1803349, -1564442, -1216013, -257161, -60130, 338766, + }, + { + 347355, -57187488, 13820131, 14095009, -1765232, -2600066, 1613297, 3613678, -219043, -3760244, + -5322002, 13774497, -1322850, 2094870, 9611600, -4009889, -16820702, 10378788, -10479183, -81604, + 3252901, 3566970, -5006858, 4408247, 1479079, -17606144, 4230543, 9767293, -541703, -3444564, + -1757715, -3178276, 2982318, -3000035, -574452, 5932424, -2826625, 8872866, 5158793, -5014375, + 1654636, -5126581, -1316944, 122943, 3282966, 943282, -245887, -274341, 4123706, -3897683, + 1075352, -1145146, -1314260, -2674691, -3543348, 1840394, 625992, -689879, 315143, -372588, + 1763084, 740882, -3682398, 1552094, 781684, -4319664, 3109556, 1494649, 4341675, -2329483, + 1738388, -928787, 1525250, 843424, -260382, -286152, -500901, -1329292, -1511829, 628139, + 1075889, -1140851, -178241, 2183991, -1846836, -1418413, 926102, 328028, -2269890, -236223, + -266288, 542240, 551903, -1146219, 2670396, -2057826, + }, + { + -17361868, 39228084, -6689412, -13740137, -9432285, 1842004, 4345433, -14331769, -5480379, -1245541, + 15718507, -3332895, -4109747, -5662915, -5581310, 12409234, 9919764, -15535970, 21871584, 21284784, + 5512054, 295816, -8150774, -10011032, -754841, 3554086, -5031554, 5417028, 383863, -750546, + 6098854, -8133058, -737661, -748398, -5106716, 535797, 3979287, 5158256, 5311801, 2412698, + 3499325, 1684164, 5068599, -3627637, -2585570, -242666, 954020, 213675, 169651, -3514357, + 7231115, 2778844, -2260764, 1312113, 617402, 817118, -3440269, 1574642, 593779, 1914482, + -3826816, -2567317, 3615289, -1338956, 2246268, 228170, -4449586, -1456531, -1624035, -1819456, + 1423782, -796716, -2204392, 1083406, -1684164, -1341104, 3308199, -481036, 768262, 2152316, + -67646, -2126009, 2516314, 239444, 1273995, 1683627, 1283122, 933619, -975494, 801548, + 678068, -899796, -1837172, -652298, 1549946, 327491, + }, + { + 86436, 25100326, -22784802, -1868848, 830539, -2128156, 540092, -2775623, 2080375, 10383083, + -2051921, 10022306, -5344013, -10926397, -6286759, -3835406, -20546586, -5403606, -4914517, -611496, + -3182034, 1734093, -328028, -3404299, 4837207, 9004936, 2584497, -3790846, -10381473, 12691628, + -12010876, 2712809, -663572, -5193689, -4733591, -997506, -8504572, 1646046, -3636227, -3911642, + -7029251, -1902134, 2760590, -3615289, 1155346, -756451, -1564442, 584116, -372588, 552440, + -6213207, -869194, 2220498, -1953673, -169651, -415538, -1917166, 2622615, -801548, 4666482, + 8949638, 2430952, -429497, 944893, -1744831, 181462, -1923072, 82141, 1988033, 30065, + -212064, -823560, 1255741, -1142998, -955630, -470836, -1909650, -1729798, 2161979, -954557, + 3380676, -1208496, -831076, 817654, 740345, -2727841, 2463701, -661962, 80531, -1622424, + -2581275, 666794, 1922535, 298500, -1739999, 401579, + }, + { + -16973710, 2239289, 29914448, -6963216, -1026497, -1449015, 3839164, 2210835, 2991445, -2623151, + 10428181, -17418240, 5218922, 19906100, 6785512, -579284, -3744675, -2700998, -4263292, 7359427, + -3714610, 2972654, 9696962, 2496987, 6316823, 221728, 12021613, -4713190, 7014219, -3852049, + 6486475, -11529303, -2370285, -3129958, -3722126, 5601174, -2450816, -4503273, 1472100, -2250563, + 6620692, 2244121, 208843, 8244190, -376347, 2015950, 934692, -1642288, 6211597, 5819681, + 4199405, -3950296, 318364, 858993, -3167002, 8460012, 1583232, 1570347, -434329, 989453, + -2649458, 1079647, 526134, 1013075, 3646964, 1750736, 541703, 478352, 1156957, 5659693, + -1159641, 1137630, -909996, -3184718, 2065879, 964757, 548145, -1678259, -947040, -1246077, + -365072, 844498, 2216203, -1567663, 289910, 3738769, -2706366, 288837, 1009854, -882616, + -1110249, 670015, 764504, -857920, -430570, 1054415, + }, + { + -1599875, 27468464, -57295936, -3105798, -1785096, 2209224, -2059437, 1351304, -6548215, -2092723, + -5440650, 18254, 12105902, 7933879, -6386080, 9421011, -12880607, 298500, -15963857, -1691680, + -2042257, -6853694, -6128382, 7440494, -20411296, 1598802, 1633161, -19519552, -6681359, 2863133, + -1400696, 6693707, 307090, -620623, -3856344, 35433, -2029372, -4946192, -12271258, -42950, + -2558190, -5108864, -3481071, 1859721, 2375654, -2271501, 9003325, 1510755, 2687039, 3996467, + -4363150, -7949985, 4517232, -1895691, -2391760, -1532767, 240518, -1707786, -540092, -759672, + -5930813, 3144453, 1021665, 4224637, 88584, 694711, 564788, -341450, -2184528, 1581085, + -1133871, -621697, 723165, -404264, 485331, 2552821, -2427194, 1538135, -1759863, -1171989, + -2837900, -969589, 538482, 1352915, 55298, 317828, -1365263, -1682017, -9664, -192200, + -821413, -139586, -1117765, -670552, -92879, 665183, + }, + { + -17696340, -9414568, 29146184, -9927817, -5399311, -729071, 506806, -4991289, -3734474, -2928631, + 23135378, 4598300, -6738267, 21595632, -4799626, 10079751, -29015188, -10679973, -13778255, -4196720, + 3795141, -10038949, 7493644, -5886253, -3778498, 7687455, -10383620, 4781373, -9219147, -5049271, + -4363150, -5069135, -3493419, -2285460, 7716446, 2747705, 5741835, -10153840, 4148402, -8487929, + -3600793, -5009543, -1152125, 1107565, 737661, 1559073, 2783676, 3349538, -608812, 2268280, + -1094143, 267362, -13422, -3894462, 1678259, -751619, 683974, 8590, 1330903, -4076461, + 1516124, 390842, -2479270, 1793686, -3240553, 3490198, -392453, -1914482, 1909113, 1145683, + 2275259, -572304, -1864553, -1824287, 2358474, -1226750, 4177930, -426812, 428960, 481036, + 2158221, 1227824, -887448, -1618129, 848256, 2510945, 537945, 212601, 489626, -1404454, + -366146, 140660, -551366, 1155346, -694174, 1446330, + }, + { + 1199907, -50862076, 87510, -4743255, 5991480, 1687922, 20157356, -19562502, -4025458, -7473780, + 1748052, -7846369, -693100, 4052839, 4384088, -11396696, 10518375, -7233262, 9710921, -517007, + -1734630, -59056, -2803003, 9533217, 10640781, -600759, 6521908, 3651796, 7910793, 3587908, + -3082713, 12978854, 3657165, 4946729, -4747013, -1809792, 4736275, -6234145, -6687264, -9649181, + 5475010, -3969087, 5222144, 417149, 8446590, -3666828, 4173635, -5491116, 2969433, -9423158, + -1642288, 718870, 527207, -2135136, -3570192, 8264054, 823560, 5646809, 572304, 1923072, + -4213900, 2120640, -4847945, -531502, -142808, 2731599, -2892124, 790811, 748398, -5294084, + -2701535, -1232656, -3442953, -2173254, -1862942, 1196148, -32749, 772557, 1654636, -2589865, + -3090766, -3280818, -3910031, 2435247, 614180, 1235877, -2165201, 894964, 774168, 1042603, + -625992, -217970, 1360968, 2222646, 533113, -1700807, + }, + { + -8230231, 98618888, -22869628, -9950365, 4640176, 3750043, -24662240, 14396194, 43526272, 2427194, + -16957068, -6039261, 3853660, 9861782, 8126615, -7261179, -7642358, -13660680, 162672, -4092567, + 5251672, 7516, -2880849, 2218351, -4333085, -5040681, -3151969, 6330782, -3037079, -15312632, + -1293322, -4503810, 7842074, 3279208, 9110163, -7973070, 922344, -10203769, 190589, -5123359, + -1998234, 3313031, -7515656, 4531191, 2319282, -22549, -7595113, -8646306, 4067334, -762894, + -4924180, -368830, 1231582, -147103, 2172717, -1950452, -47782, -537, -6927246, 3914326, + 97174, 5747740, 2618320, -579821, -166967, -1058710, -309775, -1199370, -2704756, 183610, + -1726577, 1912871, 2932926, -1349694, -2351495, 817118, 861678, 2727304, -2632815, 2509872, + -865436, -158377, -2953327, 2423435, -3439195, -69256, -1670742, 768799, -1696512, 574989, + -1748589, -618475, -1780264, 2649995, 667331, -1262184, + }, + { + 842887, -49976240, 10519986, -6592775, 4133906, -10797011, -2085207, 3994320, 2394981, 779537, + 4494684, 11133092, -763430, 5167383, -8029442, 3752191, -1330366, 7735236, -10020696, -1158031, + -6460705, 8775692, 86436, 9659918, -2740189, 5810017, 5886253, 2900714, 14697378, -1770063, + 2256469, 15438797, 1227287, 8741869, 6131066, -4983773, -4429185, 12918188, 8396661, 5488968, + 9889699, 1830730, 5870147, 6160594, 1471026, -5471252, 715112, 12042551, 1743757, 330712, + 6059125, -1641214, 1142998, -5093295, 702764, -4285304, 2195802, -3225521, -3208878, 97711, + 3144453, -3578245, 4721780, 4323422, 3651259, 1106491, -5202816, -1051730, 1209033, 660888, + 1294933, 687195, 3138011, -3758633, -2750927, 937377, -501974, 1718524, 4360466, -4074850, + -3259880, 1723893, 729071, -697395, -418222, 1246077, 2041720, 1413044, 62814, -544387, + 1956358, 1965484, -647466, 2666638, -513249, -1032940, + }, + { + -1165010, -112155016, 33030982, -9839770, -11219528, -12171400, -25487410, 6572374, -3971234, 7328825, + -21989696, -7976291, -7566659, 9141838, -12498892, -9833864, 3350075, -5859409, 2824478, -10358924, + 2362232, 1387274, -5971079, 7807714, -10907606, 1128503, -12913893, -7250442, -856309, -278636, + 5148592, -411780, -11065983, -6107444, 4399657, 3041911, 1700807, -833224, -2764348, 2889439, + 8248485, -8063264, 1232656, -1432909, 3735548, -2889976, 2608119, -5632313, 6187438, 2388539, + 5657546, 1749662, -2245731, -6513855, 2889439, -4135517, 5249524, -2490544, -1870995, 2466922, + 3075734, -1603633, 684510, 2856153, -2659659, -2584497, 4291209, 3992172, 2180770, 4769025, + 4824859, 3676492, -32749, 1409823, -3147674, 5198521, 2747169, 1996623, -1933272, 983548, + -4059818, -1052804, -1108102, 3685082, 141734, -2780991, -729071, 7516, -704375, 1136019, + -997506, 1047972, 3149822, 2612414, 1207423, -528818, + }, + { + 1995549, -2473901, -15988553, -2964064, -1989107, -5354751, -11427297, 2150168, 12284680, -2347737, + 2205466, -6658810, 8301098, -19876572, 27824946, -5887864, 882616, 3973919, 6648610, -2253784, + -12695923, 2124935, 234076, 1423245, -17007534, 8237211, 912144, 4025458, 6711424, -24062018, + -13069049, 4420595, 12938589, 569083, 8005282, -2531883, 1192927, 2236067, 2628520, -4047470, + -6816113, 1347546, -2828773, -879931, -5487895, 617402, 684510, -1909650, -3769908, -3910031, + 6426882, 3310883, 1928440, -723165, -1294396, 2928631, -3431679, 1421634, -757525, 4911832, + 1061394, -5877663, -3020436, 4522601, -931471, 1076426, -2099165, 442919, 358630, -635118, + 2479270, 623844, -2603287, 125091, 661425, 25770, -2058900, 202400, -288300, 3600793, + 4190814, 1125281, 237297, -1163399, -167504, -958315, 62277, -1207960, -1216013, -740882, + -1633698, -95026, -928250, 29528, 2051921, -3785477, + }, + { + -4597226, -69978976, 9011915, 2106682, 8771934, 3074660, -18961206, 3197066, -8560944, -110059, + -5174899, -16549046, -2557653, 5415954, 20176146, 3672734, 938450, -8302709, 796180, -1772211, + 17754858, -674310, 29025926, 9657771, -717796, -6841883, -1333587, -1608465, 3423626, -9873056, + -19986630, -14497662, 4669703, 9357123, 3453691, -8007430, 3104188, 9102109, 10630044, 1604170, + 635118, 5917928, -5215164, 2622615, -563714, -8738111, 2667175, 11670500, 2364916, 852014, + -7216082, -243739, -3503083, -861678, 617938, -4287451, -973884, 1980517, 2028298, -237834, + -2189897, 324807, -3961034, 368830, 184684, 1372242, 3861713, 6908455, -996432, 1243393, + -855772, 2411087, 1722819, -99858, -1900523, -4457103, -1890859, 1937030, -596464, -4333622, + -2332704, 4686346, -380105, -526134, 1356136, -236760, 2784750, -303869, -2164664, 1319629, + 3024731, 1127429, 1503775, 853625, 769873, 435402, + }, + }, + { + { + -613643, 36815924, -3166465, 26130582, 1042603, 261456, -3163780, -1853815, 6582575, -3826816, + 11183558, -5231270, 11105712, 3612068, -10149008, -7576859, -8721468, -16154446, -13252122, -8447664, + 8974334, 1586990, -6286222, 9768903, -544924, -599148, -290447, -255551, 4698694, 59593, + 9073118, -2385854, 5115306, -1104344, -2677375, -1790465, 1483911, 6851010, -1228898, 5908802, + -358630, 2282775, -2297271, 268435, 6847252, -1949378, 950798, 6250788, -1758252, -7713225, + -4270271, -45097, -267899, 1993402, 2316061, -4048007, -5944235, -1310502, 1885491, 1205812, + -434865, -527207, 4746476, -2998961, -922881, 3244311, 376347, 1125281, -840203, -175557, + 2336999, -2964064, 415001, 4000225, -1225139, -1028108, 269509, -1289564, 2083596, 2212445, + -1715839, 4165582, -215285, 1796907, -688805, 550830, 556735, -649077, -165356, 1373853, + -60130, -421981, -1777043, -1524713, -95026, 250719, + }, + { + -10476499, 80577880, 47158740, -20006494, -585726, 6326487, 1600412, -21602074, -5179194, -5659693, + 3896609, 7415798, -2194728, -4186519, -11861089, 1369558, -1484448, -6389301, -581968, -1999844, + 1673964, -814970, 5296232, -741419, -2867428, 2164664, 5714991, -11435350, -1203128, 505196, + -5379984, -1555852, 611496, 4826470, -488553, 10349261, 6576132, -4823249, -9807558, -2216740, + 2208687, -454730, 2563022, -4895189, 1998770, -31139, -933619, 4631586, 3311957, -3820910, + -1173600, -5422933, -3518115, -694711, 2153926, -3205119, -1739462, 1982664, -5433671, -249108, + 3898220, 931471, 442382, -871878, -3273839, 1315871, -186831, 32212, 1030792, -1664300, + 425202, -1340567, -350040, -1633161, 454730, -118648, 1854352, 1420560, 586800, 645856, + -452045, -412317, 325344, -900333, -439160, -1693828, 558883, 1351841, -391916, 85362, + -769336, -535797, -170725, -560493, 1294933, -478352, + }, + { + -712965, -120520000, -10108206, 38346540, -9646497, 5294084, 3923453, 1585917, -15287399, 6014028, + -2684, -16136729, 9241159, 2895345, 5698348, 3439195, 228707, 717796, -5283884, 7286949, + 4279398, 1088237, -10159745, -289373, -2388002, -7504919, -5299453, -1971390, 1159104, 2782602, + 10438918, 3593814, -2865280, -7926362, 6383932, 5328981, 5107790, 4837207, -3940633, -111132, + 4339528, -1998770, -1661079, -646393, 2127083, 4079145, -8009041, -2835752, -423591, 3069291, + 1083406, 22012, 744640, -269509, 1119913, 1432909, -185220, 925565, -6094559, 844498, + -296353, 1895154, 338229, -966368, -2326262, -1526861, -1146219, -2551211, -523449, 1124745, + -1083406, -1654636, 1701881, -1095217, -779537, -966368, 233539, -1319092, -1117765, -508954, + -828392, 1305133, -961536, -502511, 628676, -10201, 56371, -2097018, -2300492, 662499, + 37581, -579284, -1436130, -412854, 170725, 99321, + }, + { + -383863, -31075162, -11862700, 15848966, -178241, -873489, 1729261, 100932, 3539590, 406411, + 1714229, 8114267, -1935420, 3914863, 1788854, 3078418, -8385924, -4155918, 686121, -2626909, + 5093831, -7270306, 4912369, -5366025, 2940442, -4512937, -8791798, 4067334, 6796249, -9891310, + 9993852, -5792837, -565862, 352724, 1563905, -872952, 8514773, 2689723, 6063957, -1699733, + -6174553, 2809982, -5721434, 1992328, -51003, 3734474, -1802276, -1175747, 219580, -3183108, + 1609002, -875636, -1822677, -3374771, 556735, 1263257, 2561411, -3002719, 896038, 170188, + -1050120, 3218004, -3203509, 301185, 2157684, -2608119, 536871, 1782411, 2382633, 3103651, + 996969, 273804, -227633, 1581622, 538482, -77846, -881005, -3050501, 292595, 1818919, + 542240, -143881, -1190780, 1014686, -978179, -1775432, 1047435, 255551, -2393908, -452582, + -162672, 247497, 181999, -583579, 2115272, -915902, + }, + { + 14889578, -5733782, -14585172, -8705362, 1857037, -2003065, 2750927, -8210367, -11897059, -5369, + 3495030, -1020055, -2301566, 1602560, -4055523, 855772, 13792214, -213138, 11512123, 15102179, + 5754720, -2136746, -4999342, -3664681, -5516349, -687195, -4857608, 13415867, -3160559, -4359929, + 5908802, -7405061, -4226248, -1828046, 2633889, -1722819, 9645960, 3857418, 2179159, 9105331, + 413927, 2435247, 1619203, -1735704, -4604205, 780073, 153008, -699006, -888521, 5692443, + -57445, -1276679, 2651069, -666257, 3127273, -1225676, -25233, 1938104, 1403381, -2542084, + -1793149, -1394254, -2057289, 1636383, 2142652, 22549, -3946538, -792421, -527207, -346282, + -684510, 169114, -1092532, -1744831, 775778, -2489471, 2550137, -170188, 958315, 2596308, + -1000191, 469762, 312459, 2015950, -1058710, 3069291, 509491, 1698123, 244276, -302258, + -230854, -464930, -2371359, -111669, 1167694, -209380, + }, + { + 1709397, 4190814, 2083059, -7452842, -3280281, 1612223, -113280, -2529199, 3621731, 5192616, + 3687766, 3260417, -4854924, -6471442, -11841225, -2034741, -9099962, -11790222, -5647345, -3272765, + 2474438, -2459943, 1909113, 2443300, -151398, 2600603, 4628364, -414464, -3478387, -11384348, + -389231, -3528853, 4420058, -5244692, -3338800, 321586, -5153961, 125628, -3779034, -1774358, + -5223754, -1952600, 2230699, -4511863, -258235, -4004520, 6283001, -3680787, 163209, -1643362, + -5269925, 906775, 2824478, -48318, -1819992, 995359, -2578591, 2222646, 1989644, 2393371, + 7635915, 2414309, 57982, 1793686, -163746, -2368675, 201327, 856309, 1095217, 292595, + -1336272, 187368, 904091, -2187212, -268972, -835908, -1821066, -5906, 1651415, 586800, + 755914, -177704, -253940, 301185, 855772, 125628, 392453, -1207423, -1308891, -195958, + -873489, -1114007, 1649804, 974958, -1794760, -992674, + }, + { + 11879880, -30870078, 10532334, -3180960, 10595147, -2262911, 2375654, 14337138, -11087995, -8383240, + 5746130, 724239, 4220879, 22721988, -1854352, 5552856, -3452080, -10596221, 11539503, -3669513, + -1180042, -1384053, 13612362, 4082903, -1781338, 2718178, 4960151, 6833293, -521302, -5021891, + 3884798, -12327093, -5029407, 4642860, -331786, 5249524, -5977521, 438624, -4370129, 473520, + 5743982, 5370857, 3010772, 6598681, -1481764, -2845416, 3415573, 997506, 4702453, 5153961, + 3762928, -3219078, 1312113, 1560684, -2407866, 3164854, 5080947, -1826972, 1254667, -1905892, + -330712, 1341640, 2602213, 17717, 2595234, 214748, 302795, 2496450, 1478006, 3024194, + 3091840, -1587527, -1883343, -2206540, 2632815, -88584, 647466, -249645, -1316408, -2090039, + 1375463, 1149441, -494458, -403190, 1181653, 1408749, -352724, -542240, -60666, -426276, + -397284, 1358820, -583042, 420907, -563178, -469225, + }, + { + 3427384, -34581468, -3792993, -8096014, -1740536, 679679, 970126, -2837363, -5401995, -2796561, + 1319629, -2659659, 306016, 3353833, 16894254, -5359046, 4017405, -3123515, -7813620, -7801271, + -13562433, 1952063, -5609764, 678605, -14239964, -2928631, -6134287, -7613367, -5408975, 2008971, + 318901, -650688, -1374390, 3365107, -1256815, -2963528, -1346472, -6062883, -10576357, 4483409, + -2602213, -8200167, -4102231, 2902861, -2478733, 809601, 6104223, 924492, 5648956, 609349, + -2174864, -4154844, 2059974, -1878511, 61740, -1717450, -2987687, 102005, -1520418, -635655, + -1866163, 1612760, 3111167, 1407676, 707059, 3674882, -1217623, -1687922, -999654, 1359894, + 480499, -2442226, 2169495, -524523, 165893, 1619203, -1574642, 653909, -1883343, 605590, + -524523, -916439, 205085, -488016, 1999307, -580357, -1934346, -1170379, -261456, -746787, + -135291, -96637, -597537, -463320, -237297, 753230, + }, + { + 14281303, -37787124, 5213554, -9515500, 1416266, 4347581, -923418, -5987185, -7265474, 1694902, + 20833276, 6147709, 2615098, 7453916, 7511898, -2485712, -31403728, -6359773, -9666898, -5747203, + -375273, -433255, -791348, -1555852, -10737, -537945, -1506997, 3614752, -5858873, -5264020, + -16071768, 841277, -3842385, -1537061, 4698694, 6465000, -1502165, -9118216, 2512556, -2174864, + -11098732, 1145683, -1595044, -610959, 2364380, 1746441, 2889439, 1203665, -600222, 722091, + 1119376, 108448, 118112, -2442226, 3064459, -3250753, 1207423, -2445984, 3185792, -1407676, + 1595044, -398895, -758062, 545461, 837519, -2163053, -3077344, 590021, 1452773, -348966, + 2692408, 667331, -2102387, 592169, -248571, 92879, 1799591, 1053878, -842887, 2804614, + -482110, 765041, -128312, -1101659, 2192581, 16106, 1094143, -147640, 637266, -823560, + -156766, -725313, -1687922, 1581085, 995359, 140660, + }, + { + -2255395, -47641924, 143881, -9702868, 5213554, 472983, 10463077, -12395812, -3393024, 1959579, + -1027571, -5178120, -5519033, 7692824, -2855080, -7905424, 3812320, 1034550, -14310831, 21731998, + -1851131, 1706176, 295816, 4299799, 9603547, -184684, -1067836, 7422241, 4865124, 5595806, + 2204929, 10085657, 3891777, -1283122, 4752918, -177167, -2527588, -3204046, -3546569, -3320547, + 307090, -48318, 4209605, 4639102, -2604361, 3144453, 3450469, -248571, -82678, -10347113, + -379031, -547071, -1937030, 4308389, -466541, 2506650, 4643397, 698469, 4501663, -721555, + -1014686, -3047279, 627602, -1808718, 2654290, -930934, -3795677, 881005, -1646583, -1345935, + -205622, -2680597, -2241973, -1547262, -4150012, 2206540, 529892, -1344862, 2637110, -1415729, + -4364761, -748935, -4287988, 16106, -45634, 333397, -1802813, 985158, 493384, 1215476, + -1103807, 1410897, 693100, 843424, 1087701, -780073, + }, + { + 7353521, 73327976, -15923054, -6364605, -3312494, 14105746, -6270116, 26261040, 11976516, 9931575, + -9387188, 165356, 14478872, -5718749, -1850057, 2091112, -6568079, -10070088, -5341329, -3004330, + 4345970, 4718022, 4814122, -5195300, -6394133, -6133214, -4982162, 13386876, -9256728, -12735115, + 470299, 5364414, -1238561, 578747, 15314243, -2004139, -10174241, -7865696, -773631, -9910637, + 417149, 2773475, -3365644, 4073777, -696322, -273804, -10840497, -2827162, 2473364, -4055523, + 667867, 254477, 2094870, 1258425, 2393908, -1894081, -2734821, -1835025, 1312649, 279710, + -886374, 5558762, 3174518, -474594, -342524, 1331977, -576063, -4420058, -1697049, 1217086, + -1175210, 2860448, -1269163, -585189, -1370095, 585726, 1449015, 1212255, -1653026, 1254667, + 1011465, -664109, -1380295, -1127429, -847719, -1435593, -1240172, -156766, -38118, -384400, + -2213519, -979253, -128849, 656056, 1456531, -1278290, + }, + { + -831076, -33628520, 552440, -2196876, -6592775, -5637145, 1402844, -4469987, 7467338, -893353, + 12206297, 6681359, 9995463, -8434779, -4807679, 1253057, -755377, -2523293, -7074348, 7408282, + 3968013, 1961190, 2992519, -490163, 8054138, 3774203, 8070781, 3741454, 7821136, -7998303, + 12387223, 9532680, 4418448, 5429376, 4304094, -6451578, 4566087, 11294153, 4150012, 5701032, + 2274185, 3008088, 6332393, 2933463, 3592203, -3038689, -52613, 8768713, 4503273, -4388920, + 5913633, 4496831, -2602750, -2547453, -2758980, -2207076, 687732, -475131, -4201552, -918049, + 5214627, -2871723, 4418448, 3639985, 3876745, -1743757, 1029182, -4278325, 3179887, -200253, + 91268, 2123861, 274341, -542777, -3621731, -2365453, 3324305, 825707, 5256503, -5871221, + -1248762, 2734821, -920734, -1008244, -131533, 47245, 2063732, 1958505, -675921, 158377, + 2407866, 841814, 549756, 1474784, 630286, -1177358, + }, + { + -3102577, -58657444, -10574746, 6419903, -29387776, -16092706, -21650394, -3292629, 7141457, -7546258, + -16212965, -6570226, -12634183, 18170932, 6190659, -20126216, -2542084, 905701, -5151814, -2328946, + -1704028, 4316979, -2148021, -8994735, -1273458, -1896765, -9084930, -7338489, -2135673, -8129300, + 4748623, 3064459, -5620502, -5187784, -2455111, 4271345, 9027484, -8322036, -4534412, 11265162, + -273804, -2754148, 1344325, -131533, -2352032, 4675609, 81604, 934692, -2952253, 875636, + 3235721, 898185, -304406, -2361158, -303332, 1980517, 1000191, -2879776, 5780489, 89121, + -926102, 897111, 542240, 970663, -1959579, -1892470, 2807298, 5773510, 1934883, 2957622, + 6764037, 264141, 894427, 1445793, 805843, 2283312, 2907693, 2229625, -2130304, -164283, + -2124398, -1403917, -3026341, 2294050, -452045, 122407, -1915555, 1154809, -725313, -1280974, + 770947, 823560, 850940, 2683281, 811749, 478352, + }, + { + -3861713, -16824998, 1639604, 1313186, -5338645, -10195715, -5106179, 740882, 5871221, 4092567, + -197569, -4266513, 3325379, 15537044, -42763916, 16716013, 5130339, -736050, -2803003, -3930432, + -12800076, 6213744, -8296803, -307627, 95026, 1701344, 4119411, 498753, -5823976, -11056320, + -5542119, -9127, 15057618, -2508798, 6058052, -2072859, 4069482, -389231, -4995584, 3969087, + -8528194, -1023276, -3259880, 336618, -6449967, 466004, -1317481, 1153199, -6427419, 5481452, + -2916283, 7073811, -410169, -858993, 2677912, 204548, -3462281, 1831267, 1779190, 1482838, + -2305861, -2076080, -3428995, 3375844, 1359357, -1585917, -1482838, 97711, 1823751, -695785, + 2249489, 2391760, -3496640, -250719, -770947, -705448, 224412, -571768, 400506, 2181307, + 3226057, 2700461, 999654, -205085, 615791, -2664490, -881542, -1520418, -106300, -857383, + -654446, -1224066, -363998, 892279, 66572, -843961, + }, + { + 1971927, -51230368, -1086090, 1964948, 7373922, -5267241, -12927852, -6593312, -5894843, -2990371, + -8214125, 1677185, -17792976, 9569724, 25898116, -6276558, 5078799, -10456635, 4848481, 501974, + 3326452, 16482474, 14599131, 7165079, 2617783, -6527814, 456877, -1537061, -5833640, -3981972, + -7244536, -21984326, 7699266, 7861938, -3597572, -4202089, 5196374, 6491306, 2971044, 8825084, + -4930623, 3133716, -1449015, 4590783, -4395362, -2058363, 436476, 10164577, 169651, -2719251, + -3239479, -255014, -958851, 1013075, -3994320, 1402307, -5962489, 4910758, -1348620, 251256, + 1457068, -2314451, -1960653, -4090956, 804770, 2499671, 3129421, 5307506, 1715839, 1565516, + -2676302, 683437, 559956, -1178969, -770410, -2127620, -2582886, -1309965, -1330903, 215285, + -2601140, 2285460, 743029, 2003602, -103079, 1025423, 1326071, -494995, 336081, 1218697, + 797790, 1224066, 1392643, 2160369, -165893, 367220, + }, + }, + { + { + -580894, 57650808, 4544076, -9863929, -7231651, 4780836, -1860258, -4534412, -2357400, -15177878, + 3717294, -13377213, 3309272, 623844, -8515846, -7088307, -5906654, -4697084, 510564, 4641249, + 5970005, -5857799, -5064304, 20274930, 6389301, 7153805, 2279017, -3189550, 1267015, -2005750, + 732292, -11643119, -1780801, -2819646, 6906845, 1374926, -8428873, -1395328, -3861713, 928787, + -5751498, 2001455, -159451, -581968, 1588601, -5232881, -2268280, 1343251, 668941, -4331475, + 474594, 706522, -1109712, 1495722, 717796, -1403381, -6602439, -4209605, 554051, 1517734, + 4786204, 4736812, 3765613, -2864743, -987306, 1220845, 1714766, 935766, -2416993, -894964, + 1977296, -1941325, 656056, 3242700, -940598, -430034, -1163936, -3526168, 478889, 1584843, + -3386045, 2640868, 932545, 2451353, -347355, -314069, -672162, 404801, 464393, 1694902, + 421444, 716186, -143881, -526670, -1004486, 375810, + }, + { + 12486544, 21235392, -34173444, -18798534, -12045773, -3513283, -1044214, -13061532, -3373160, -6766184, + 16323560, 26876832, 3522410, -312459, -7473243, 6652905, -810138, -5798206, 12061879, 8808978, + -3377992, -10095858, -5461588, -2385318, 5686000, 4190814, 4436701, -17158932, 362925, 3878892, + -2236067, 12109660, -344671, -2741800, -5817533, 7726646, 9558987, 5309117, -1817308, 270046, + 1137093, 1980517, 2612414, -8209830, 674847, 451508, 1267552, 889058, 1066226, -386010, + 2377801, -4354560, -4568772, -1395328, 3155727, 17717, -2530273, -1294933, -3589519, 2610803, + 3271691, -217433, -1144072, -3905199, -5859409, -1415192, 505732, 1414118, 1666447, -205085, + 2043331, -3692061, -3445638, -2971581, 1424855, 46171, -445066, 849330, -1425392, -1024350, + 17717, -290984, -98784, -1446867, 181999, 92879, 944893, 534723, -1691143, -398358, + -1004486, -1692217, -9127, 874563, 2086280, -143345, + }, + { + -1222455, -83522616, 26109644, 55748676, 2528125, 7650411, 2633352, -3419331, -11440719, 9232032, + -4604742, -17528836, -1670205, -874563, 4644471, -894427, -3671660, 1089311, 3910568, 15355582, + 8301635, 3236795, -3310346, 5197448, -4483946, -6316823, -4924180, 1339493, 2063195, -4115653, + -3147137, 935229, 3438121, -3982509, 6751152, 693637, -1089311, 3010235, -483184, 990527, + 6338835, 2957085, -2114735, -4603668, -1920387, 1210644, -5670968, -3642132, -2564632, 2064806, + -695785, 500901, 180389, 1533840, -955093, -1447941, -1823214, 3339874, -1717450, 2630131, + 570157, 1512365, -1120450, 38118, -715649, 797790, -90731, -3205119, -1910187, 1526324, + 1042066, -1758252, 1398549, -265751, -404801, 1768453, 4005057, 1421634, 268435, 429497, + -519691, 833761, -1522029, 950262, 1046898, -577136, 977105, -74625, -237297, 717260, + -408559, 565862, 927713, 408022, -620086, 470299, + }, + { + -1403381, -4697621, 5308043, 8447127, -439160, -151398, 1068910, -1404991, -1908576, 5424007, + 5382668, 570694, -2285460, -1177895, -10103911, 3127273, -748398, -6145025, 1762010, -1904281, + 1615445, -6761353, 7577933, -14523969, -2867965, -563178, -10509248, -6200322, -1161252, -8383776, + 18213882, 1166084, 934692, 4475893, 1653026, 1492501, 6238440, -6088116, -911070, -1391033, + -1665374, 1788317, -8511551, 3346853, -4141959, -61740, -3092377, -1486596, -727997, -1141924, + 3867618, -719407, 1668595, 3557844, 2949569, 7516, 1885491, -1544041, 29528, -1277216, + -2806761, 5150740, 9664, 1083942, 1260036, -2713346, 350040, 521839, 392453, 4772246, + 2230699, 415001, -1648194, -304943, 295279, 2648921, 886911, -2418604, 1811939, 729071, + 85362, 3898220, 113817, -472446, -671089, -2476049, -381178, 105764, -1592896, -480499, + -557809, 67109, 888521, -726386, 1291711, -298500, + }, + { + -9707700, -37801616, -1730872, -3757023, 1083406, -1681480, 3636227, -764504, -3919158, 4883378, + -7613904, -730144, 4598300, 10191957, -3417183, -5679021, 10067403, 5185636, -2392297, -11543798, + 971200, 896038, -4415227, 3852049, 3066070, 3293703, 4022774, 15460809, -5181878, -10835129, + -4095251, -8722542, -3965866, -4614943, -2949569, -7897908, 3550864, -713501, -5820755, 570157, + -7994008, 1228361, 3835943, 5633924, 2771328, 26844, -1074, 1650878, -995896, 5462125, + -2699924, -2725157, 2006824, 459562, 3658239, -194884, 3336653, 1267015, 311385, -4931696, + -2393371, 283468, -2390686, 2593624, 1103807, -2021319, -543313, -198642, 998043, 2394981, + -315680, 926639, 1850057, -2311229, -369367, -2198487, 2861522, -142808, -193810, 1372779, + -1341640, 237834, -28454, 2334315, -2241436, 804770, -1305670, 1893544, 1714229, -323196, + -572304, -584116, -1354525, -684510, -290447, 15032, + }, + { + 91268, -2364916, 13912473, -5807870, -3606699, 3988951, -85362, -4000762, -2451890, -3825742, + 31139, 5731097, -4460324, 1291175, -6488085, -2443300, -440234, -6789807, 631360, -4220879, + 1262720, -1384053, -424128, -5894843, -40265, 3699578, -3532074, -5221070, -2013266, -20714628, + -3033858, -3266860, 3398393, 2358474, 4707821, 9061844, 1046361, 3132642, 6144488, 8230768, + 6590628, 7971996, 7570954, -4788352, -1487132, -3543348, 5969468, -2786360, 2317672, 2577517, + -2873333, 2497524, -1176284, -1371705, -496069, 2256469, 286689, 3649112, 1965484, 344134, + 4262755, -82141, -513785, 1235340, -883153, -2929705, 1360968, 2008971, -569620, 596464, + 1887638, 1047972, 1103807, -191126, -159451, -1753957, -241055, 1286880, 222801, -103079, + 328028, -1648731, -936840, -565862, -93952, 2037962, 1043140, -947040, -2413235, -1437740, + -574452, -1324997, 296353, -474057, -1184337, 104153, + }, + { + -3728032, -66572528, 8582955, 773631, 91805, -5447629, -9456444, 1685775, -8290361, -1212255, + 7889318, 18928458, 2934537, 2905546, -6288369, 8704288, 5073430, -2421825, 9477382, -1773822, + 3619584, -4943508, 2862059, -5302137, -7573638, 2488934, 7594039, 14198625, -3395172, -6933151, + 2928631, -14370424, -6390912, 7341173, 3368328, 5765994, -6292664, 6876243, 1194001, 5668820, + 5180268, 3032247, -3460133, -2704219, -4694936, -6091874, 599685, 409096, 593779, -693637, + -169114, -2769180, -650688, 12348, -1455457, -800475, 1207423, -4957466, -1190780, -3553549, + 919123, 1924145, 2945811, -1969243, 144955, -1574106, -580357, 3604551, 2545305, 1037235, + 348966, -2467459, 523986, 1212255, 2455648, 98247, -8053, -1247688, -332323, -1785096, + 1977833, 901406, -1918240, -591095, 1638530, 1065152, 1142998, -450972, -557272, 528818, + 565862, 2560338, -671089, 631360, 375810, -1228898, + }, + { + 831076, -35295504, 24735790, 6001143, 82141, -3964255, 2587181, -335007, -1899986, -1088237, + 4218195, -4408247, -13415330, 1759863, 29510720, 881005, 13449153, 2542621, -9234180, -10619844, + -14015015, 9701794, -3854733, -1128503, -9789841, -1804423, 3331284, 7356742, 1292785, -8175470, + -844498, 2799245, 2474438, 6902550, 2771865, 3505230, 3955128, -2157684, -2637647, 7347616, + 5391795, -348429, -1605244, 1108102, -4412542, -208843, -862215, -2379949, 231928, -3339874, + 2691334, -33286, 1836099, 1085553, 1514513, 1926293, -1633161, -2022930, 168577, 832687, + 1639604, 2826089, 1709934, -1476932, -1927904, 2800319, 57445, -788127, 460635, 1465121, + -90194, -2706366, -1376000, -3131031, 1458678, 2199023, -929860, 215285, -2175401, 2275259, + 2494839, 1390496, 469762, -2442763, 1759863, 583042, -1966021, -453119, 862215, 404801, + 253403, 51003, -997506, -881542, -947577, 165893, + }, + { + -8063801, -71899904, 11793443, -876173, -6849399, 536871, -1218697, 5117991, -852014, 2436320, + 631360, -5058398, 7602092, 10167798, 9848897, -13560822, -18044768, 14947023, 4246649, -1053878, + -5171141, -119722, 893890, 3821447, 5167920, -1464584, 2664490, 952946, -6035503, -767189, + -10555419, 6245420, 4898947, 865973, -2487323, -3117073, -5176510, -5267241, 4212289, 1329292, + -4480725, 4912906, 1967632, 1848447, -2806224, -3922379, -238371, -1659468, -2376191, 1939178, + 1937030, 350040, -559956, -1724966, 3706020, -4452808, 612570, -4826470, 1836099, -2042794, + 2136209, 1495186, -321049, -3089692, -1629403, -2367601, -3291556, -434329, 317291, 37044, + 1472637, 454730, 520765, 1848447, 17717, -977642, -1080721, 1223529, -748398, 1392106, + -2004676, -178241, -1126355, -2035815, 678068, -1693291, 506806, -1044214, -378494, 230854, + 287763, -1462436, -2065879, 172872, -308701, -752156, + }, + { + 492848, -37533720, 2458332, -5674726, -272730, -19001472, -5033165, -2447058, 3451543, 7344394, + 2806224, -7723962, -10249403, 8611409, -2703682, 3536906, 2926483, 1764695, -10392210, 8783208, + -7063074, 6544457, -5057861, -10923712, -4526359, -8839043, -15540802, -1798518, -1097901, 3439732, + 3604015, 1385664, -5311801, -8559870, 2056216, 1873680, -1144072, 4182225, 4973036, 2238752, + 1168231, 2527052, 3969087, 2933463, -1375463, 8588324, 8333311, 4677220, 1742683, -5480379, + 5204427, 239444, -1674500, 4299799, -4452808, -6183679, 1294933, -1164473, 3277060, -3259880, + 1830730, 2496987, 2206540, 227096, 5682242, 1741072, -332860, -274878, -1090385, 3358665, + 2281165, 81604, 1472100, 3984119, -1224603, 1209033, 671089, -3602404, -901406, -330176, + -2064806, 2231236, -1787243, -726923, -1799054, 200790, -1951526, 975494, -231928, -609885, + -600222, 2129767, -434329, 552440, 1811939, -641561, + }, + { + -8089571, 68410240, 7007776, -803159, -10761577, 31791348, 23074174, 37266356, 2935610, 1654636, + -7647190, -4879620, 11862163, -1958505, 73551, 6889665, 420907, -1430761, -3080029, 5817533, + 9067750, 6975564, 7983808, -5347771, -1823751, -1505386, -2888366, 14161044, -1782411, -4744328, + 840203, 3669513, -3233574, -206158, 13391171, 4677757, -6108517, -5060545, -300111, -8184060, + -270046, 1301375, -530965, 2524904, -1879048, 4880157, -4293357, 4534949, 6470905, -2035815, + 4048007, 1075352, 1229434, 1433982, 826244, -3316789, -4215511, -2464774, -2564096, -2288144, + 1224603, 3073049, -2911988, -5905043, -2396055, 2573222, 435402, -3170223, -1037772, 1752884, + -908386, 1298154, -3736622, -236760, -1916629, -2112587, -671089, -576599, -1677722, 1251983, + -552440, -2340757, -249108, -282394, 2282238, 754304, 35970, 422517, 557272, 227633, + -588947, 1574106, 1252520, -746251, 1380832, -1085553, + }, + { + -966368, -17090212, 7861401, 185220, -5221070, -2190970, 4371740, -8207683, 5971615, -1659468, + 173409, -3351148, -5082020, -20936892, 643708, 1002875, 1646046, 6266894, 2659659, 8540542, + 5024038, 620086, -67109, -9676024, -56371, -2141041, -1349694, -8901857, 12125766, 9703405, + 5111548, -5948530, 5142150, 570694, -7618735, -8678518, 7690139, 5026723, -7012608, -571231, + -5743445, -3841848, -6319508, -8013872, 2189897, 1836099, 3700114, -1118302, -8049843, -5352603, + 4989679, 4769025, -1422708, -4195110, -2849174, -2272038, 943282, 1195612, -589484, 643708, + 3105261, -4106526, 3451543, -355945, 1116692, -1773822, 1270774, -5088463, 1546188, -1518271, + 301721, 802622, -2539936, 782221, -1579474, -2750390, 1874216, -2942053, 1532230, -5213017, + -1299228, 1692217, -1759863, -1175747, -525060, -310311, 2353105, 1948841, -1349694, -1568737, + 1536525, 1381906, -59056, -1671816, 919660, 897111, + }, + { + 8023536, -33432026, -6514929, 12514461, -40466644, -19024558, -10049150, -9749039, 1388885, -11568494, + -2792803, 7825968, -8946954, 26511760, 19709604, -4154844, 13878113, 10641855, -1292248, -2076617, + -4662187, 8251706, 854162, -10798622, 6548752, 6487548, 5052492, 1598802, -3691525, -12419435, + 818728, 3600256, -866510, -2122251, -1949378, 1478006, 4941897, -9226663, -5187247, 9895605, + -4387846, -2044404, 1349157, -2472291, -5742908, 4232154, 5690832, 3871913, -3081102, 1371705, + 1205275, -446140, 2377801, 3242164, 2216203, 1348620, -1876901, -4107063, 6324876, 1235340, + -735513, 708133, -268435, -2281165, 374736, 3280281, 861141, 1742146, -4423280, -3561602, + 1764695, -3440269, 1190243, 1253057, 2113124, 2794950, -218506, -682900, -2980171, -852014, + 599685, 422517, -3026878, -222801, -2152852, 582505, -390842, 1008244, -881542, -1966021, + 128312, -308701, -1644973, 419833, -72478, 1430761, + }, + { + 3640522, -14071923, -4593468, 2036351, 1283122, -1024350, 667867, -4014721, -1802813, 1156420, + -4042638, -273267, 5298379, 12996571, -68383392, -368293, 1536525, 3799972, -3710315, 3920232, + -7671886, 1941325, -13520020, 6721624, 7061463, -1098438, -58519, 4197257, -1595580, 456340, + 4912906, -3499325, 6297496, -11384348, -1806034, -1311039, 2824478, -7898982, -6040335, 6517076, + -6997039, -1280974, -713501, 8065412, -2883534, 3413962, 5494337, 2250563, -5084168, 11638825, + -2245731, 4323959, -630823, 4174171, 3337727, -4390531, -2215130, 3855270, 988379, 1052804, + -497679, -1407139, -4292820, 957241, -559956, -1801202, -137439, 79457, 1089848, 493384, + 1697586, 2704219, -786516, 1633698, -113817, 134755, 310311, -1391569, -1555852, 257161, + 1610076, 1832877, -336618, 267362, 2078764, -1124745, -661425, -564251, 518080, -246961, + 2444910, 539555, -543313, 2147, 674310, 456340, + }, + { + 2840047, -45383844, -464393, -775242, -2732136, -3411815, 2572149, -1551020, -5393942, -3627100, + -2368675, 18997178, -9189619, -18486076, -12167105, -12569222, 8439611, -11661910, 4713190, -679679, + -15118822, -1045825, -4164508, -2823404, -1629940, -9854266, 2940979, 3255048, -9295920, 3098819, + 6607807, -19732690, 6103149, 9897215, 141197, -3751654, -75699, -5537287, -5491116, 2433636, + -11251204, -2430415, -3062849, 4733054, -1483374, 6947110, -28454, 4068408, -5665062, -5888937, + -1386201, 1005022, 4761508, 4070555, -1646583, 7434052, -2343979, 4014184, -4422206, -445603, + -214748, -3186866, 1766305, -2775623, -1842004, -1912334, -2960306, 1474248, 4173098, 1524177, + -4718559, -1580548, -750546, -1015760, 1684164, 1199907, 694174, -386010, -2712272, 2200097, + -357556, 2325725, 1321239, 2020782, 1486596, 4259534, 1634772, 934155, 1094143, -732292, + -1186485, -290447, -461709, 1141924, 81604, 1900523, + }, + }, + { + { + 24696, 44578004, 13873818, -40288404, 19002546, -5093831, -53150, 1122597, -10873783, -10031970, + -490163, 746251, -9572408, -2747169, -9659381, 830539, -6082211, 2243047, -4168803, 8491150, + 7133404, -6987912, -1823214, 6410776, 5603322, 12255689, 2968896, -2534568, -5323075, 8891656, + -6280853, -6083285, -8456254, 119722, 7591355, -2743947, -7954280, -2288144, 4395362, -2390686, + -3826279, -1633161, -2999498, 4936528, -840203, -4550518, -4386236, -1897302, 2720325, -4875325, + 1195075, 1263257, 2193118, 2233920, -3708704, -1192927, -620086, -5080410, -3464965, 2314451, + 5508296, 5087389, 640487, -1473174, -179852, 345745, 2880313, 202400, -2265059, -813896, + -341987, 3682935, -2249489, 877784, 2855617, -2916283, -1104880, -2246268, 1999307, -1269163, + -830002, 889058, 2398739, 1469416, 159988, -389768, -229781, 645319, -440234, 685047, + 791348, 243739, 225486, 1180042, -1189169, 800475, + }, + { + -15170898, -9798968, 25266218, 20259360, -47232828, -5474473, -13016435, 1388885, 1847910, -3978214, + 6305012, 26348014, 7494718, 4474282, -477278, -5313949, -1818382, 918049, 7592429, 7228430, + 5542119, -12313671, -2141041, -4123706, 9944460, 539018, -107374, -10624138, 834297, -548682, + 1683627, 10399190, 1545115, -4837744, -5455682, 4235912, 7917236, 4672925, 1339493, 6388764, + 1023276, 4461934, -4326106, -6872485, -190589, 688805, 3456912, -3733937, -1076963, 7414188, + -2491618, -1534914, -2944200, -1231045, 862752, -206695, -1570884, -1947768, 61203, -738198, + 4670240, -2617783, 750546, -6033892, -4001299, -3505767, 4112431, 1323924, 994822, -820339, + 1268626, -2643552, -2358474, -1964411, -1785096, 1305133, -1124745, -1102196, 710817, 105227, + -90194, -418759, -573378, -1821066, 1306207, -1058173, 1659468, -717796, -348429, 404264, + -1028108, -1552631, -635118, 765578, 1653026, -201863, + }, + { + 4991826, -42782168, -11487427, 53757420, 1458678, 2557116, 4053912, -6563247, -7799124, 5303748, + -5599027, -13036299, -8302709, 1890323, -369904, -4260071, 5726265, 355945, -1696512, 15530602, + 16437914, -5123896, 301721, 3199751, -4708358, -2107218, -3097208, -2431488, 2624225, -1605244, + -10524817, 2688113, 8372502, 1859184, -4659503, 1338419, 740882, 2139431, -208843, 765041, + 9269613, 606127, -381178, -2003602, -5242545, -6500433, 2845953, -3277060, -30065, -1465658, + -540629, -595390, 3021510, 4480188, -2757906, -1322850, -555661, 2619930, 1033477, -850404, + 3061775, 741419, -63888, -2119566, 441308, 1602023, -2302639, -976031, -371515, -514859, + 1043677, 237297, -112743, -286689, 150861, 2987150, 2377801, -20938, -748935, 1269163, + 1585917, -282931, -1297080, -146029, 527744, 814970, 1320166, -703301, 1241246, -907312, + 1462973, -409633, 803159, -23622, 882616, -365609, + }, + { + 2769717, 6631967, -4489315, -3943317, 7865159, -661425, 679142, 1703491, -7241315, 10228465, + 6170795, -7003481, 1490354, -9363566, -14017700, 8947491, -823560, -3085934, -2178622, 3754875, + -142808, -5819681, 2081449, -9802726, -4708895, 1786170, -8622684, -11190000, -9154186, 1688996, + 3791919, 11989401, -6352257, 7973607, 1002875, 5020817, 4453344, -2783139, -6857452, 537945, + -776852, -3784940, -4388383, 846109, -6085969, 1693828, -1687385, 1433982, -652835, -357019, + 4512937, -309775, -27917, 3211025, 3055332, 317828, -3038153, 3680250, -3985193, -442919, + -264141, 3175592, 2980707, 1356673, -1733556, 1915555, -1928440, -321586, 324270, 1288490, + 1331440, 3370476, -3340948, 132607, -156229, 2084133, 1717450, -470836, -48318, 569620, + -819265, 4907537, 1140851, -2891050, 120259, -1387274, -551903, -919660, -82141, -1680943, + -78920, 751082, 115427, -430570, 416612, 462246, + }, + { + 2720325, -59900300, 132607, -5663988, 9342091, -864362, -4373351, 3339874, 1553704, 1356136, + -14050449, 12657269, 7342784, 6591164, 1571421, -4632122, 2176475, 803696, 840203, -10342281, + 818728, 5460514, -12378633, 6708202, 11050414, -5225902, 19697794, -1781338, -2150705, -9555228, + -4991289, -6214818, -5210332, -2190970, -4194573, -5119601, -6289980, 2363306, -3850975, -3940096, + -8756901, 3163780, -156766, 4319127, 7907572, -759672, 1504312, -663572, -62277, 2202245, + 2595771, -2476586, -2346663, 1522029, 1953136, 4706748, 246961, 1895154, -2222109, -3866544, + -665720, -1620813, 1021129, 1190243, 1340030, -4880694, 2070711, -44023, 1964411, 1538135, + -460635, -492311, 2614025, -1213328, -2135136, -1051193, 1567663, 383863, 12348, 122943, + -171799, -1363115, 1256278, 553514, -558346, 467078, -1603633, 1313723, 1658931, 128312, + -173946, -301721, -1129576, -1343788, -415538, -47782, + }, + { + -1556389, 5580773, 2670396, 789200, -1504312, 1212255, 1386201, -4304094, 519691, -4154307, + -5144834, 8382703, -3047816, -14409078, -9318468, 3275450, 9276592, 2311766, -393526, -1643362, + -9170829, 4064650, 7765838, -17954038, 3427921, 5542656, -8550743, 495532, -594853, -13477071, + -4261145, 516470, -6518687, 3097208, 3958886, 9412421, 612033, 1339493, 5446556, 6332930, + 14664092, 6743099, 3056943, -2292439, -4079682, 62814, 1226213, 1905892, -598074, 3342558, + -423591, 1701881, -2672544, 2743410, -115427, -1240709, 2762738, 3452080, 2189360, -321049, + 1404454, -753767, 1085553, -1598265, -102542, -1228898, 1403917, 960462, -229244, -299574, + 2686502, 2335389, -3454228, 1566589, 476205, -1662689, 2292439, 1151588, 271657, -2465311, + 1380832, -1852205, -3103651, 338229, -126702, 1718524, 1978906, -1004486, -3146064, -1556389, + -304943, 218506, -595390, -1837172, 406948, 506269, + }, + { + -6680285, -70456792, 4376035, -3755412, 9877888, -3262028, -7103339, -15382962, 7816304, 8350490, + -9986873, 23490786, 8493298, -5675263, -3382287, -846109, 4191351, 10121090, -2211908, 3049427, + 5113696, -1934883, 2031520, -8808441, -4625680, 6739341, 10301479, 10491531, -4795331, -2889439, + -7352984, -3922916, -4860293, 3861176, 1432372, 2733210, -2135673, 6163815, 3374771, 4958003, + 6439230, -2305324, -10201, -7274601, -6805913, 2473364, -8352101, 2976412, -404264, -3974455, + 4495757, -4436165, 843424, -857383, -773094, -2610803, -556198, -1960116, -4791573, -1195075, + 1499481, -118648, 3083250, -291521, 1226213, -1620813, -1693291, 1551020, 2212982, 2317672, + -826244, -843424, -534723, 2231773, -421444, 1688459, 1786170, -2465848, -890669, -817118, + 1218160, 2004676, -2319819, 88047, 0, 1017370, 1784559, 118112, -1335735, 1481764, + 772020, 309238, -103079, 278099, 913754, -1359894, + }, + { + -3496104, 11553999, -354872, 9647570, -7003481, -3439732, 4080756, -3033321, 4975720, -715112, + -4608500, -2313377, 1977296, -2177549, 14540612, 7013145, 3062849, 12700218, -13711683, -8802535, + -6961068, 4319664, -922881, -1040993, -9019968, 391379, 6173479, 11256572, -5455146, -12332462, + -2812667, 5232881, 5776731, 1245004, 2811593, 7217693, 3390877, -2518998, 4264903, 916439, + 3374771, 6343130, -5917928, 5371931, -6298570, 1988570, -4134443, 521839, -1994476, -2613488, + -262530, 4003983, 944356, 1498407, 3336116, -2078227, 3455838, -6262599, -966368, -1547262, + 6141267, 2348810, -3425237, 3978214, -4488241, 2412698, 376883, -1637456, 2420751, -2579665, + 385473, -865973, -2177549, -1680406, 2907693, -1204202, 226023, -666257, -1389422, 2274185, + 937377, 1144609, 75162, -891743, 1257889, 703838, -2195265, 13959, -494458, 2143726, + -650688, 762894, -710280, -1577327, 17717, -1321239, + }, + { + -1539746, -88138632, 5192079, 4427038, 7382512, -5432060, -3885872, 5342940, 3113851, 7460895, + -16740709, -24159, 14815490, 7033009, -227096, -2926483, -8716636, 9368934, 10287520, 1779190, + -5864241, -2151779, 1490354, 798864, 2614025, -1493575, 7878581, -2898566, -2570001, -6223408, + -265751, -3596498, 10631655, -1667521, -3244848, -8928163, 1467268, -1280974, 4999342, -5745593, + 3104725, 3844533, -828929, 2479807, -4129611, -2933463, 833761, -5370857, -436476, 1709397, + 512712, 2012729, -1062468, -3376381, 3173981, 362388, -1038308, -1825898, -1802276, -3435974, + 3104725, 1603097, -564788, -3214246, -3264175, 962610, -2072859, -1015760, 1433982, 883690, + -1694902, 1174137, 2672007, -397284, 1366873, -1571421, -562641, 1899449, -724239, -625992, + 285615, -2219424, 412317, -2416456, -590558, -2684, -933619, 372052, -1176284, 19327, + 1254131, -2251637, -1439888, -1120987, 39192, -875636, + }, + { + 2238752, -36217312, -887985, -113280, -3799972, 1307818, -24779276, -5106179, 3522410, 13284871, + -3208878, -9635222, -16343961, 9286256, 682900, 16205985, -8832600, 5927055, 3755412, -13722421, + 4544076, -767725, -3007014, -3736622, -17898202, -4258460, -16183437, -9375914, 1283658, -945967, + 180926, 1581085, -2880849, -5095979, -6081674, 1978369, -168041, -334471, 7634841, 3126199, + 1599339, 2535105, 2720862, -3986804, 4468377, 5723044, 8578123, 9119289, -6986838, 2678986, + 3657702, -1444720, 3825742, -4002373, 359704, -5753109, -989990, -772020, -1719598, 1175747, + -738734, 4224101, 95026, 2951716, 4210142, 936303, 2541010, -1063004, 864362, 1240709, + 568546, 1691680, -210453, 4840965, 2852932, -2877628, 2261837, -2913599, -2359011, 76773, + -2011655, 2913062, -1523640, 497142, -2458869, -849867, 1611, 10737, -639950, -486942, + 294742, 920197, 38118, 87510, 1227824, 677531, + }, + { + 10775536, 65954592, -10320806, -991064, -21751324, 28609850, 17427366, 42380588, -2000918, -3977677, + 5426155, -13185013, 8007967, 6433324, -7680476, 10895258, 330176, 5157719, -10121090, 13189845, + 2318209, 11523397, 858457, 4236985, -10662793, -1470489, 4436701, 7175280, 5242008, -796716, + 2000381, -4618164, -4751845, 5208722, -2446521, 2474975, 4257387, -1268626, -3540127, 485331, + -1218697, -3170760, -721555, 1613297, -4600984, 8161512, 118112, 5104032, 288837, 6035503, + 3624953, -312996, -3978750, 1107028, -158377, 76236, -4889284, -1289564, -4343286, -995896, + 1589675, 337692, -5131412, -2534568, -3035468, 2003065, -733903, -1586990, 1126355, -230854, + -330712, -344671, -2024003, 261456, -1891396, -2283849, -1340567, -1331977, -395137, 1073742, + -1585380, -1446867, 212601, -308701, 2997887, 2203318, -898722, 311385, 773094, -1395328, + 783832, 1038308, 1275605, -645856, 1168231, -427886, + }, + { + 2717641, -6997039, -3565360, -1235340, -5361730, -4781373, 7853348, -4465692, -379568, 4388383, + -11580842, -3041374, 6419366, -30766462, -2344515, 1193464, 6246493, -1172526, 9155260, -1396938, + 7084549, -1898912, 2560338, -7132867, -2526515, -4438849, -17696876, -2172180, 16155519, 17437030, + -7279970, -760209, -2045478, 6546604, -10584947, -3297461, 10615549, -988379, -5627481, 98247, + -5655398, -5745593, -6468221, -6323803, 805306, 6583648, 1194538, -7417946, -7882876, 2090575, + -2415382, 3363496, 731755, -3002719, -2379949, -5277441, 3177202, -1016834, 3469260, 840203, + 2201708, -3792456, 4248797, -1571958, 767189, -678605, -2813741, -1044214, -207769, -2762738, + 3796214, -1786706, -3383361, 423591, -1273995, 122407, -1287953, -1822677, -1775432, -1852742, + -1851668, 367757, -1285806, -1452236, 274341, -440234, 1717987, 1874216, -415001, 54761, + -1108102, 1429150, -252329, -651761, -214212, 2094870, + }, + { + -13656922, -18677202, 15981573, 1693828, -39939976, 2274185, -18370112, -2182917, -4995047, -14596446, + 5023501, -6438156, 7503308, 21038898, 9309342, -5590437, 20893942, 1751810, -521839, 15553150, + -12983686, 9435506, -5561983, -7254200, 18101140, 5507759, 8523363, 5631239, -9570261, -7588134, + 3786551, 2155537, -2932389, -2552284, -8405788, 7642358, 326954, -7077033, 3635690, 144955, + -2272038, 425739, -3438121, -6839199, -515933, -724239, 10203769, 2889976, 1752884, -211527, + -97174, 6605660, -310848, 2730526, 3508452, -649077, -2193655, -1348620, 2140504, 3979824, + -4038880, 3052648, 2535641, -4531728, -1541356, 6214818, -1975148, 423054, -1963337, -5194763, + -41876, -3109020, 2608119, 2371896, 721555, 1412507, -721555, -1626182, 95563, -2709588, + 899259, 249108, 520228, -2642479, -1466195, -897111, 977642, -184147, -1093606, 39192, + 346819, 71404, -1834488, -986232, 1052804, 627602, + }, + { + -2968359, -18220326, 7373385, -4825396, 1371705, 5118528, 2364380, 1517734, -10596221, -2644089, + -4416300, 7582228, -1454920, -34736084, -1953136, 10204305, 9491341, -5754720, -1322313, 5517959, + -10118406, -1800128, 318364, 6722698, 10420128, 1437740, -17069274, 7933342, 427886, -2845416, + 10172093, 612033, -2150168, -4700842, -13095355, 5746130, -206158, -7641821, 1488743, -5409512, + 4669703, -769873, -3063386, 10129143, -1626719, 5019206, 5032091, -1039382, -1581085, 9271224, + -2001455, 4016868, -3231963, 4319127, 5511517, -3662533, -359167, 1370632, -911070, 3023120, + 4337917, -8230231, -2057826, 3283503, -3036542, 23622, -1996623, 1303523, 1237488, 1251446, + -388158, 2246268, 2211908, 596464, -1398549, 1234803, -1040456, 1278290, -2837900, 1258425, + 1666984, 561030, -570157, 578747, 386010, 1399086, -1378685, 970126, -945430, -818728, + 3287798, 375273, 1266479, -1258962, 715649, 144955, + }, + { + -10146860, -36332740, 5661841, -4951024, -1687385, 1534377, 951872, 1421634, -5951214, 6364605, + -1369021, 12221329, -3608310, 1073742, -45086956, -21261162, -1229971, 922344, -1199370, 4176319, + -16886738, -1878511, -4589710, -9471477, -6652368, 1147293, -2208687, 7659001, -9474698, -3704946, + 3578782, -5960341, 4870493, 4194036, 4239133, -122407, -492311, -13153337, -1614371, 2663417, + -14267881, 1181116, -5952288, 6139119, 1767379, 7023882, -2900177, 5294084, -3510062, -6754910, + 3710852, -2377265, 4395899, 3697967, -860604, 2152316, 1566053, 4191888, -4263292, 2654290, + -1545651, -2413772, -1544041, 1070521, -565862, -5499169, -176094, -2316061, 6991670, -2193118, + -2206540, -4934918, 3406446, 959925, -705985, 281857, 1345935, 654446, 69793, -1416266, + 981400, 1586990, 2678986, 1005559, 1827509, 2899640, 578747, 2704756, -135291, -224412, + -1414118, -1043677, 724239, 762357, 53150, 919660, + }, + }, + { + { + 1555852, 17490718, -6881075, -36741836, 13898514, -6469295, -3031710, 44560, -3455838, 1028108, + -4003983, 9388799, -3528316, -6213744, -2485176, 9368934, 780073, 8751533, -8393440, 4265977, + 8531416, -14065481, -6679211, 3142842, -515396, 10749766, 150861, -2106145, 1395864, 13928579, + -470836, -137976, -10483478, -3604551, -2684, -3869766, 3599720, 3173981, 10211285, 7279970, + 2812667, -3794067, -7663833, 4645007, -1712618, -5209796, -2160906, -1366873, 3599720, -2262911, + -294742, 1977833, 2872260, -1012002, -2288681, 3881577, 5083631, 438624, -4056597, -2147484, + 854162, 1614908, -1299765, -3906273, -2525441, 2616172, 3996467, 1342714, -2035278, -5098126, + -2915746, 3534758, -2031520, -337692, 3285113, -835908, 2521146, 150861, 1532230, -2515777, + 323196, 1747515, 2401424, 296890, 73551, 287226, -234076, -1024350, -1754494, 565325, + -199179, -314069, -276489, 1372779, 491237, 853088, + }, + { + 18923626, 15362561, 17930952, 95011120, 15745350, -4916664, -6616397, 3147674, -6586869, -6713034, + 2361695, 8376260, -3857954, 8853001, -10201, -12368969, -6290517, 5212480, 1356673, -7374459, + 15287399, -821413, 483184, 672162, 10200010, 568546, -1330903, -10515691, 3188476, -852014, + -1877438, 6256157, 648540, -6291054, -4959614, 2897492, 8200167, 6631430, 2196876, 5437429, + -452582, 3504157, -4429722, -4225711, -1872069, 1933809, 5386963, -2422899, -5563057, 2207076, + 602369, 44560, -3313567, -2264522, -1506460, -1323387, -1301912, 1717987, 2015950, -2884608, + 1799591, -1756105, 5636071, -1646583, 960462, -699006, 3294240, -1271847, 586800, -990527, + -617402, -271657, 1414118, -1058710, -2522757, 1240709, -1343788, -1265942, 3539590, 1418950, + -594316, 929324, -77309, -779537, 1916092, -1312649, 1182190, -520765, 956167, 2303713, + 1016834, -173409, -389231, -875636, -1412507, -807991, + }, + { + -7652558, -21580600, 9714142, 7706782, -33206002, -3103114, -6099391, 729608, 1393180, 7231651, + -158914, -17335562, -9111236, 10769630, -3545496, -2263448, 5528697, -3716221, 170725, 1013612, + 2852395, -2310156, 2247879, -3196530, -6324340, -914828, 5497022, 993211, -2332704, -4294431, + -6577206, 10084046, 12096239, 6020471, -5272609, 1829119, 679679, 845572, 1791001, 1288490, + 3782793, -4142496, 5976984, -1157494, -8731132, -5107790, 3312494, -1609002, 2219961, 1466195, + 2250026, 894964, 6627135, 7541426, -160524, -1690070, -1108102, 1770600, 1455457, 869731, + 3788161, -596464, -576063, -721555, -237834, -802085, -2160906, 1948841, 1051730, -2711198, + 1096290, 1095754, -1833414, -1678795, -1814087, -329639, -242129, -898185, -143345, 417686, + -753230, -1373316, 119185, -542777, -492311, -1017907, -246424, -1900523, 1676111, -552977, + 1035087, -623844, 445603, 173409, 114354, -2761664, + }, + { + -2168959, 10072235, 1953136, -10047002, 1953673, -1944547, -741956, 2684355, -6841883, 4142496, + -717260, -8186208, -1854352, -4569309, -6009733, 3698504, 163209, 8418673, -5716065, -4447976, + 5011690, -86973, 6306623, -33286, -3115999, 6769942, 973347, -155693, -7412577, -3159485, + -5796595, 5250061, -8991514, 4744328, -6432788, 1733556, 5981816, 2889439, -4282083, -3281355, + -4433480, -4317516, -4911832, -4187056, -8247411, 2818572, 2240362, 4774930, 3215320, 2000918, + 5153961, -1442572, -3041374, -2824478, -1370632, 317291, -1651415, 3079492, -1613834, 6000070, + 5393405, 4126927, 2951180, 1264868, -967978, 1639604, -2886218, -2521683, -2594697, -835371, + -613107, 2276333, -4118874, -1324997, -519154, 1164473, 2550137, 1597728, -71941, 1120987, + -2167348, 11274, -738734, -1458141, 1242856, 298500, 302258, -613643, 403727, -701153, + -335007, 660351, 309238, -584652, 328565, -139586, + }, + { + 4866735, -52716964, 8921721, -17646946, -4121558, 770947, -3985193, 2511482, 7734699, 5456756, + 2935610, 28588912, 7962333, 3801583, 4532264, -3908420, -2898029, -3994857, 5815923, -1855963, + 6002217, 10126459, -12133283, -2410014, 6065031, -10187126, 13127031, -13632226, -7738994, -2343442, + 5689758, 1079647, -1925756, -1371705, -4385699, -4983236, -7127498, 1416266, -3489124, -3690988, + -2552821, 3486977, -1326608, 3932043, 5903433, -4240207, 2889439, -532576, -3468186, -2836289, + 2797098, -1183800, -2498597, -1229971, -1080184, 3484292, -2351495, 2782065, 1052267, 889058, + -344134, -2477659, 2141041, 1501091, 3323768, -2903935, 1123134, -27917, 417686, -2579128, + -2539936, -1488206, 1078037, 69793, -2742337, -1466731, 779000, -980326, -995896, -1144609, + -221728, -1111323, 667867, -1051730, 620086, 1578937, -2317135, 931471, 2064806, 1037235, + 836982, 659278, -629750, -1482301, -354335, 709743, + }, + { + -107911, -1745904, -14134737, 5501853, 1449552, -1088774, 1795833, -3395709, 5840082, 315680, + -8132521, 3352759, -3927211, 5194763, 5195300, -2596308, 10167798, 7026030, 1116155, 1579474, + -2462090, 9702331, 8481487, -7968238, 9423158, 12577812, -3558381, 5619965, -1054415, -8733279, + -2971044, -886374, -7745974, -6063957, -7010997, -782221, -7207492, -2114735, 1663763, 65498, + 7045357, 2608119, -2517388, 70330, 1712081, 3142842, 86973, -1537598, -3700114, 2130841, + -253940, 2596308, 890132, 5065377, 1918240, 2106682, 2375654, -1393717, 880468, -803696, + -1438814, -1767379, 1619740, -2954401, 159988, -872415, -1287417, -1699196, -120796, 114890, + 402116, -161598, -3856344, 2970507, 2134599, 808528, 2365453, -1087164, 946503, -2081985, + 2268817, -470299, -2838437, 365609, -1466195, -161061, 2136746, -120796, -1964411, -831076, + -293668, 69793, -255551, -628676, 1225676, 934692, + }, + { + 16949552, -45043468, 6993281, -11634530, -5129802, -4110821, -8181913, -9693741, 9183714, 1053341, + -13159780, 14647449, 6339372, -7808251, -1584306, 10979547, -4930086, -5947456, -7840463, 3195993, + 10776073, 927176, 396748, 1240709, 16873316, 8130910, 4107063, 5146445, 1217086, 3791919, + -2301029, 2334315, -2361695, 1890859, -2943126, -6838662, -4400731, 4613869, -4836133, -5129265, + 842350, -6801081, -1515050, 248571, -2200097, 2423435, -8476118, -401043, 2536178, 2243584, + 6434935, -5582384, 157840, 2536178, 653372, -2134599, 130997, 176631, -4479651, -1497870, + 65498, -1635309, 2828773, 324807, 2601677, 1354525, -355409, 3098282, 2114198, -508417, + -2287070, -325881, -2775623, -552977, -1956358, 271120, 2020782, -1619740, -1326071, -2524367, + 88047, 2070174, -1185411, 2012729, 7516, 738734, 917512, -259309, -1083942, 1811939, + -381178, -1737851, -1371168, 247497, 450972, -1338956, + }, + { + 60130, 37755448, 2298344, 3037079, -8166881, 616328, 4038880, -3992172, 3927748, -3972308, + -4511863, 5049271, 8533026, 304406, 7583839, 7776575, -5390184, -3565360, -8616778, 5566278, + 2274722, 6926172, 998043, 1809792, -4583267, 8108362, 3624953, 3219615, -10331007, -10572599, + -3389803, -2143726, -2217814, -3842385, -3363496, 5302137, -4952634, -11237245, 3548180, 3007014, + 2471754, 8527121, -6058588, 7875897, -1820529, 882616, -5369783, 1046361, 1108638, 3364570, + 435939, -965831, -2338610, -714038, 1714766, -3739843, 3121904, -6187974, -632434, -5066988, + 2352568, -2404645, -5677410, 5434208, -3875134, 2283849, -1748052, -542240, 2726767, -4231080, + -287226, -314606, -32212, 345208, 1367410, -2461016, 957241, -818191, -3100967, -155156, + -1692754, -1433445, 366683, 824634, 670015, 358093, -958851, 807454, -1113470, 1355599, + -2333778, -198105, 1389959, 248571, 42950, -1123671, + }, + { + 14199162, -71717360, 13506598, -7691750, -5696201, -4660577, -16601122, -5853504, -5153961, -4437238, + -3412352, 7675107, 12786655, 7262790, -7084549, 25438554, 6220187, -3543885, 6184216, 2206540, + -6869264, -1256278, 8455180, -1452773, -1296543, -5377836, 2385318, -2837900, -3860102, -4599373, + 1817308, -5980742, 9226663, 2299955, 2692408, -5506148, 5659693, 4608500, 7146826, -8637179, + 2341831, -18254, -5289789, 2386928, -2334852, -978179, 863825, -5365488, -1635309, -2623688, + 1387274, 3105261, -1049046, -2986613, 5879810, 2829310, 323733, 995896, -898722, -5836861, + -2405719, 1424855, 2573222, 3447785, 1767916, 5459441, 999654, 263067, 3085397, 804233, + -2124935, 1846299, 1956895, -1005022, 913754, -887985, 1474784, 1859184, -1278290, -241592, + 1079111, -1109712, 2871186, -1675037, -155156, 1669669, -1736241, -420907, -52076, 147103, + 1926830, -861141, -303869, -599148, -906238, -904091, + }, + { + -3255585, -36145372, 6637872, 340376, -483184, 18287434, -12058658, -10636487, 5729487, 5664525, + -15708843, -6903623, -16158741, 7643431, 1580011, 2683281, -24621436, 3185255, 13294534, -10212358, + 2340220, -3882651, -9837623, -2736968, -4262755, 7069516, -8822400, -6840809, -597000, -6899328, + -4028679, -3296924, -9388262, -5170067, -7095286, -1272921, -3379603, -3027415, 6969122, -3754875, + -3491272, 1774895, -2138894, -10581189, 3429532, -1599339, 685047, 6137509, -3808026, 6230387, + -886374, -3519189, 1626182, -4553739, 4301947, 1384590, 4692252, -1612760, -4531728, 1414655, + -3955128, 471373, -4319127, -518617, 4604742, 734976, -133681, 185757, 1721745, -2088428, + -3560528, 133681, -547608, 2833068, 2726231, -3207267, 3380139, 124017, -2727304, -1365263, + -670015, 3670050, -492848, 1396938, -1384590, -710280, 339302, 216359, -418759, -926102, + -812286, -1675037, -135828, -144955, -688269, 560493, + }, + { + -14062797, 38962332, -18176302, 1210644, -22466974, -12537546, -21836688, 26108032, -110595, -1673964, + 8998493, -7269232, -1876364, -3934727, -14890652, 4878546, 3978214, 17006460, -3179887, 8527121, + -3362960, 2667712, -14385993, 4493073, -10459319, -1614371, 8811662, 318901, -1078037, 3518652, + -1080184, -12122008, -5801964, 5174899, -9594420, 678068, 12592844, 6394133, 2895345, -178778, + -4056060, 1342177, 1670205, -570694, -4093641, 7052337, -1701344, 2746095, -1058710, 5481452, + 644245, -3056943, -3551938, 1815697, 1525250, 3143379, -3888019, 1702418, -394063, -151934, + -1309428, -511101, -1502702, 1480153, -2165737, 2486249, 614180, -193810, 1280437, 515396, + 147640, -1139777, 653372, 3155190, -540629, -2188823, -816581, 674847, 80531, 623307, + -1514513, -615254, 1999844, 1237488, 1688996, 368293, -2822867, -1337882, 691490, -1926293, + -205085, 368830, 496069, 219043, 1429687, -104153, + }, + { + -2863133, -7495255, 3252364, -4425964, -3518115, -1121523, 8500277, 286689, 694711, 8097624, + -14360760, -12474733, 7121593, -23689428, -3341485, -2193655, 10759967, -9538049, -1418950, -12103218, + -3651259, -13618268, -1823751, -1032403, -2519535, -4610648, -10230075, 13108777, 16043313, 3840238, + -5420249, 3330210, -8013335, 836445, -6658810, 2144263, 11849815, 1116155, -2165201, 7581691, + 1127966, -4075924, -1345935, 1314797, 2097555, 2805688, -6011881, -9543954, -3140695, 9410273, + -3136937, -1430224, 164283, -993748, 1460289, -4900558, 2091649, 159988, 5612986, -752156, + 1983738, -4064650, 4517232, 3328600, 3016678, -1407676, -3614752, 190589, -551903, -4350265, + 2154463, -1385127, 462246, 1691680, -746787, 3111704, -1726040, -2331630, -373662, -602369, + -2850248, 776315, 31675, 141197, 1138166, -52613, 1695975, 1297080, 477278, 1496259, + -1792612, 710817, -124017, 63888, -559420, 2167348, + }, + { + 16005732, 11439645, 10695542, 9302362, -12757127, 30381524, -4716948, 8573828, -7461969, -7506529, + 11951820, -4972499, 1064078, 2961917, -1975148, -18081276, 7778723, -8164733, 1608465, 21237002, + -11027865, 3755949, -1526861, 3375308, 17894444, 3308736, 4809827, 10736881, 2265059, 3501472, + 7488813, 1424319, -2302103, -3371013, -8122857, 3685082, 4310000, 785979, 384400, -703838, + -1312113, 4269198, 3855270, 891743, 2531883, -3191161, 5123359, 1793686, 2979634, 3624953, + 2086817, 6887517, -983011, -308164, 4881767, 1342177, -263067, -1596654, -2491081, 5361193, + -2135136, 1975148, 633508, -1811403, 187368, 1834488, -2892661, 1044751, 1779190, -581431, + 316754, -1717987, 1771137, 1570884, 642635, 1662689, 274341, -828392, 175557, -2791192, + 1068910, 411780, 1823214, -474594, 1369021, -1086627, -197569, -537408, 1071058, 3380676, + 1650878, 1238561, -450435, -90731, 1233729, 891743, + }, + { + 3553549, -18824304, 3263638, -2590402, -1168231, 3289945, -384400, 4713727, -3318936, 433255, + -2536178, 1759326, 878321, 49548352, 107142256, -1057636, -8045011, -2526515, 8046085, -187368, + -4052302, 5481989, 2308008, -5246303, 1296006, -828929, -24009404, -4699768, -7209640, -9856413, + 6460705, 2202781, 969052, 8087424, -5478768, 2402497, -1263257, -8698383, 1683090, -5759551, + 3774203, 253403, 1088237, 8910983, 774168, 10572062, 3359201, -4271345, -5178657, 3483219, + -1069984, 2596308, -5171141, 3349538, 4830228, -2095407, 1103270, -2132451, -3677566, 2799245, + 2083059, -3627100, 797790, 733366, -2967286, 1875290, -443992, 1010391, 2094870, 3731253, + -1545115, 297963, 713501, -779537, 138513, 2455648, -2704756, 2022930, 179315, 2385318, + 1636919, -585189, -108448, 468688, 45634, 3081639, -600222, 289373, -1686312, -2332167, + 96637, -1262720, 1052267, -2203855, 328565, -118648, + }, + { + 16546362, -8431021, -6720550, -9426379, 15795816, 14367739, -2512019, 803696, -7490423, 6507413, + -1020055, 15712601, 3540664, -6325950, -43794172, 1491964, -6447820, -8122320, -5635534, 51003, + -17529910, -1429687, -876173, -14580340, -9647570, -2657511, -580894, 15434502, -8621610, -12814572, + -1948305, -3299072, 1655173, 2255395, 5422933, -2200634, -2221035, -11231876, -954557, 12644384, + -807991, 6235219, -9994389, 6097243, 5743445, 7902203, -2810519, 4866198, 427886, 552977, + 4844723, -4196720, 90194, 1235340, 1126355, 2730526, 1306744, 1276679, -4318590, 3492882, + 1276679, 1807644, 1538135, 5277441, 1450625, -6326487, -12348, -4103305, 977105, -4250944, + 2997350, -45097, 6858526, 1187022, -2376728, -3180423, 215822, 1798518, -1736241, -3173444, + 1239098, 303869, 311922, -1774895, -183610, -175020, -1442035, 715112, -1334124, 94489, + -1373853, -1502165, 693100, 1158567, -235149, -1598802, + }, + }, + { + { + -1810866, -13997298, 14891188, 11316165, -24411520, 1748589, -6845104, -4480725, 3261491, 980326, + -6157910, 9892383, 1540820, -3257733, -233002, 690953, -2461553, 3504693, 13424994, -3777424, + 1776506, -10464151, -8093329, 14605573, -5139465, 13455596, -190589, -1748052, 3948149, 5286568, + 3051038, -985695, -10528575, 1163399, 1582159, -11072426, 8260833, 9213779, 5279589, 3170760, + 2072322, -2809982, -4720706, 3591130, -3403225, 1033477, -6008123, 809064, 1136556, -2601677, + -964757, 1683090, 4252555, -6118181, 3452617, 4883378, 1879048, 2825015, 494458, -3426310, + -4895726, 1483374, -886911, -2010582, -4237522, 3613141, 1253594, 202400, -970126, -4591320, + 803159, -781684, 493921, -1250909, 2464238, -1590212, 3104188, 256087, 757525, -2637647, + 1298691, 1147293, 2136209, 1018981, -1369021, 2124935, -1592359, -1111860, -1822140, 928250, + -285615, 151398, -1119913, 884226, 1796907, 460635, + }, + { + -21638582, 62524524, 19603304, 112741816, 4760435, -10770704, 12152073, 207232, -15373299, 5151814, + -8907225, -666257, -1761474, 8425652, -2851322, -9048959, -6827388, 4814659, 897648, -11889006, + 13507672, 11187316, -7512435, 4335233, 564251, 6148246, -11825656, -6979, 4520990, 1154809, + -8262980, 1632625, 2817499, -3942780, -3120294, 349503, 5903433, 9914932, 4005594, 4247186, + 42950, 2379949, -3723737, -1137630, -4916664, 6768869, 997506, -1750199, -435402, -5006322, + 3588982, -4164508, -627065, -3530463, -2583960, 3081102, -3149285, 2383707, 3318399, -2654827, + -4076461, 4814659, 1136556, 745177, 1957431, 2062121, -1274532, -1261110, 559956, 2467459, + -3987877, -454193, 1958505, -1367947, -429497, -2458332, 1324997, -1478543, 3658239, 858993, + -1486596, 1687385, 424665, 207232, -1228361, 2415382, -2183991, 3297461, -819802, 1236414, + 666257, 450972, -922344, 1521492, -2978560, -319438, + }, + { + 7624104, -236223, -28523952, -35388384, 7659001, -5029944, -13690745, 9891310, 954557, 9974525, + -7328825, -9942312, -11952894, 16265578, -7952669, 6644315, -1269700, 3288871, -5286031, -6555731, + 11172821, -8213588, 6272263, -7466264, -2945811, 3240553, 5347771, 734976, -3287798, -2762201, + 1074, 4224637, 8669928, 9044664, 1232656, -3182571, 4904316, 2013266, -3052111, 4385699, + -3792993, 478889, 1362578, -4577899, -2455648, 922344, -3357591, 971736, -1649268, 3150359, + 22012, 2433099, 5938329, 8356933, 1275605, -3495030, -1865090, 2003065, -965831, 4633196, + 365609, 1495186, -669478, 170725, -679679, -3299609, 1017907, 541166, 2089502, -1259499, + -868120, 876173, -3577171, -1041530, -420907, -1262720, 648003, -1444183, 129923, 1653026, + -1845225, -2369211, 850404, -1757715, 355945, -694711, -1526861, -1574642, -18790, 1133335, + 1064078, -231391, -1208496, 628676, 447750, -2698313, + }, + { + 956167, 23764590, -10402411, -10402411, 675384, -309238, -1038308, -3418794, -211527, 491774, + 5116917, -3935264, -10761041, -3483219, 2716567, -604517, -189515, -2838974, 3080565, -1851668, + 4303557, 8701067, 4551055, -1103270, -2537789, 9639517, 4243428, 6771553, -10264972, -7665980, + -7386270, 5909875, -3521336, 3161633, -7377143, -4009352, 5532992, 881005, -1806571, 3470871, + -6826314, -3819837, -5804649, -3498251, -2509872, -3210488, 4556961, 613643, 5442261, 6188511, + 1880659, -6162741, -1218697, -1561758, -4378183, 831076, 3371013, -1606318, 1930588, 5601174, + 8009041, 2316061, 1476932, -71404, 2530810, -265751, -588411, -3548180, -3036005, 1026497, + 1394791, 1044214, -4563940, -1269163, 916976, 66572, 2658048, 707059, 212064, 1611150, + -506269, -2104534, -2245194, 1850594, 302795, -359704, -438624, 1316944, -1627793, 536871, + -1296543, 647466, 1957968, -18254, -1014149, -841277, + }, + { + -11113765, -32569810, -450435, -24832964, 10127533, -946503, 2204392, -4322885, 7419019, -5618354, + 22217866, 13715441, 14002130, 2444373, 9312563, -4874251, 3710852, -16564078, 4110284, 10545755, + -539555, 7382512, -1497870, -4767951, -1755031, -7557532, -2336999, -15014669, 2246805, 4755603, + -1139240, 4563940, -3049964, -1770063, -3828963, -1191317, -3441880, -7814156, 4827007, -7530152, + 3248069, 1202054, 1403381, 5846524, -659814, -77846, 4090956, -840203, -1868311, -7945690, + 4403415, -507343, 3396246, -4979478, -2014340, 2427194, -3786551, 3180423, 1764158, 1265405, + 999117, -2907693, -7516, 69793, 4954782, -650151, 512712, 2335389, -3941169, -986232, + -2289218, -870268, -1523103, -1082332, -1164473, 1141924, -469225, -1086090, -2054068, -673236, + -245350, -1187559, 481573, 724239, -128312, 192737, -1307281, 1301912, 959925, 1838246, + 1977833, 511638, -2110977, -692027, -787053, 422517, + }, + { + 1498407, -21138218, 1731946, 2001455, 1388885, -1212255, 778463, -4669703, 5813775, -317291, + 3330210, -1391569, 824097, 3121368, 1345399, -4718559, 14128295, 10964515, -10362145, 9846749, + 709743, 3312494, -6727530, 16537235, 2483565, 12157442, -2794950, 10332618, -10445897, -9526774, + -6888591, 857920, 2833605, -7414188, -6201396, -3504157, -8395050, 2283312, 1072668, 5422396, + -8786966, 11621645, -5511517, -1464584, 5143224, -1034013, 3454228, -2384244, -1653562, 1193464, + -2323577, 2503966, 2985539, 4990752, 3326452, 3952444, -183610, -3747896, -198105, 2029909, + -898185, -556198, 227633, -4258460, 2206540, -1393180, -1867774, -2556579, 2193655, 281857, + -2048163, -2272038, 1570884, 1287953, 2737505, 199179, 187368, 703838, 2183991, 227633, + -1491964, 66035, -1633698, 142271, -11811, -413391, 1718524, -2150705, 286152, -784905, + -217970, -233002, -878321, 623307, 559420, 1213328, + }, + { + -22352620, 9760850, -12068858, -10854993, 9060234, -5384279, -3678640, -1953136, -5092758, -8499203, + 9656697, -1909650, -395674, 4929012, -6376953, 10047539, -2113124, -5137318, -10609106, 1843078, + 16131897, -5684926, -1351304, 1344862, 27495306, 541166, 9298067, -3745212, 7471096, 1934883, + -8865349, 8600135, 3051574, 1092532, -2288681, -10539313, -1986422, 221728, -4959614, -7959648, + -1024887, 439697, -7636452, 4946192, 2600603, -3086471, -4135517, -1382443, 694711, 7166690, + 2869575, -5147519, -2282775, 3220152, 1447404, -280784, -2168959, 2026151, -3416647, 554051, + -2854006, 590021, 2695629, -963683, 2190433, 4138201, 373662, 1821603, 734439, -1336272, + -866510, -441308, -2806761, 54761, -2360085, -115427, -509491, 1246077, -476205, -3851512, + 932545, 336081, 863288, 2002529, -386547, -501437, 297427, 1054415, -43487, 159451, + -821413, 57982, -2197413, 278636, 813359, -1832340, + }, + { + 3062849, 12102681, 13022341, -8422968, 3075734, 2140504, -1132261, 2112587, 1078574, -4159139, + -5126044, 10705743, -982474, 5223754, 4392141, 4825396, 11992086, -9278203, -9356586, 2554969, + 7026030, 6569690, 8147016, -7486665, 2990371, 7554848, -9316321, 5452461, -13272523, -4138201, + 9414568, -13859859, -4425964, -7918309, 1803886, 9641128, -10018011, -8519068, -3908420, 7857643, + 1944547, -1180042, -935766, 6799470, 2137820, -1657321, -3955665, 111669, 642098, 4658429, + 4990752, -8611409, 122943, 158914, -2063732, 919123, -137439, -4182225, 657667, -5172751, + 1423245, -4169876, -3391951, 3340411, 515933, 412317, -2211908, 2661269, 909459, -1184337, + -1765768, -637266, 228707, 1547799, -413391, -1811939, -1144609, -483721, -568546, -1304596, + 141197, -1579474, 411243, -266288, 1252520, 237297, -1250372, 711354, 364535, -594853, + -1088774, -1848983, 2508798, -227633, 497679, 399432, + }, + { + -26844082, -21184390, -5415954, -18538152, 24131274, -3362960, -13379897, -9470940, -13591424, -7641821, + 17202418, 1202591, 8797167, 14440217, -11742441, 12275017, 17314624, -3058554, -2655364, 6329708, + -8706436, -2171106, 5953899, -1241246, -2400887, -1265405, -1027034, -1739462, -2578591, -2188823, + 2215130, 6446209, -1296543, 4486630, 2943126, -3140158, -2535641, 6788196, 2835752, 125628, + 60130, 52076, -7815767, 2110977, 930934, -7220914, 5800354, -1720134, -7625715, -2235531, + 5355824, 1554778, -94489, -1498407, 4923643, 2501282, -249645, -360777, -1061394, -5168457, + -2397129, 2663954, 501437, 8565239, 1746978, 600759, 452582, -1074, 2151779, 362388, + 184684, 1946157, 1990717, 291521, -1378685, 2025077, 714038, -413927, -2510409, 2735894, + -1644436, 448824, 2060511, 972810, 169114, 1010928, -1447404, -966368, 571768, -493921, + 1393717, 307627, -649077, -1501628, -209380, -413391, + }, + { + 3085934, -34175592, 244276, -150861, 3987340, -3700114, 20070382, -4605279, -9114457, -1584306, + -11664057, -1745904, -11555073, -1374926, 6489159, -6267431, -23612656, -1254131, 7394860, -1134408, + -126165, 4024921, -12081206, 1391569, -186831, 2428804, -1513976, -9105331, -1721208, -5103495, + 1301912, -8798777, -15137612, 9693741, -4620311, -10539313, -2783676, 823560, 2835752, -8980240, + 5217849, -512712, 1708323, -6219650, -4557497, 1141388, 636729, 2955474, 4246649, 1082332, + -5326833, 1501091, -1245541, -911070, 4358855, 4159676, -1082332, 3098282, -4180614, -507343, + -2931315, -270046, -394063, -4185983, 2991982, 3157338, -2489471, 991064, -1568200, 406948, + -2433636, -936840, -705985, 477278, 2716567, -1537598, 2375654, -1419487, -1716913, -219043, + 2204929, 2003602, -996432, -383326, 1253594, -2302103, 1821066, -722091, 81604, -1806571, + 761283, -2964064, -176094, 954020, -1880122, 1006096, + }, + { + 17516488, 34311420, -43204688, -16470663, -4553202, -28084792, -4029216, 13529147, 10475425, 7090991, + -5575405, -735513, -8309688, -5238787, 5280126, -1090385, 2003065, 19482508, -2421825, 3561065, + -3687230, -1592896, -10310606, -295816, -887985, -5922223, 3787624, 7994545, -15537044, 10810433, + -6470368, -4770098, 1447941, 2044404, -5657546, 1496796, 4508642, 3344706, 5323075, -1315334, + -4641786, 6928319, -271657, 1269163, -2339147, 7087233, -2057826, -1562831, 2461553, 3602941, + -2434710, -4488241, 3133179, 2034204, -2432562, 1167694, 987306, -1306744, 3686156, -1770600, + -2609730, 195421, 2138894, 2180770, -3277597, 2822867, 222265, -1430224, 2459943, -621697, + 234613, 48318, 1795833, -779000, 166430, -316754, -409096, 799938, -67646, 1372242, + -2449742, 768799, 2084133, 444529, -115427, -822486, -433255, -2052994, 444529, -1850594, + -1626719, 82678, 928787, 1740536, 362388, -307627, + }, + { + 2225867, -2248952, -120259, -7776575, -257698, 611496, 5507759, -66035, 1739462, 5165235, + -6349573, -15867757, -9078487, -4760971, 1625108, -12060805, 8179229, -483721, 6025302, -13667123, + -9992241, -12447352, -4889284, -12080132, 6244883, -2287607, -5491653, 21016348, 13231184, -1900523, + 3939559, -1014686, -7326678, -7264401, 1181653, 3196530, -3973382, 3817152, 8314520, 5126581, + 3417720, -8181376, -2104534, 9891310, -1977296, 1247151, -4194573, -5439039, -2139968, 4152160, + -2108292, -290984, -1617055, 322659, 122407, -2874944, 2192581, 507880, 4989679, -2795487, + 397821, 2250563, -440234, 4326106, 3507378, -2457258, 2430415, -2945274, -1648731, 347892, + -1231045, 894427, -181462, -679679, 1772211, 2834679, -2237141, 521302, -1966558, -102005, + -2143726, -664646, 2935073, -1722819, 2542621, -345745, -949188, 2680060, 172336, 1676111, + -1634772, 604517, 829466, -237297, -940061, 634581, + }, + { + -8655433, 64572148, -12060805, 11977053, 4151086, 6838125, 2030446, 13604309, -3653944, -5854578, + 5068062, 6489696, 11813308, -20699594, 7557532, -5033702, -11283953, -6210523, 9328669, 1494649, + 5631776, -1000727, -7388418, 20962662, -6195491, 6480569, 10735271, 3912715, 557272, 9656697, + 7242926, -6136972, 1270237, 1953673, -5344550, 1780801, 1101659, 3513283, -4858682, 4017405, + 2156611, 4599910, 201863, 8669928, -4679367, 7226283, -4673462, 7779797, -3804804, 6332393, + 4443144, -1594507, 2737505, -215285, 2892661, 897648, 3846143, -533113, -4871567, 7106024, + -942745, -397821, 84289, -1094143, 538482, -1306207, 1870995, 18254, 1626182, 1003412, + -474057, 309775, -1419487, 2462627, -1352378, 1971927, -66572, 8053, 1665911, -3993783, + 417686, 1148904, 1185948, -627065, 2432025, -581968, -804770, 1225139, 508417, 2275796, + 1475858, 2557653, 93416, -75162, 279173, 511101, + }, + { + -4285304, -10356240, 1720671, 4504347, -727997, -3779034, 4547297, -356482, 5988795, -2939905, + 2611340, -72478, -423054, 35080220, 111419504, -9480067, -2401424, -4413616, 3403762, 2873333, + 11191611, -9500468, 5629629, -2742337, -2398739, -13981729, -9223442, -9905268, -13878650, -5652177, + -2341831, 1525250, 4235912, 5886253, 7713762, -5601174, -5990406, 208843, 1663226, -9364102, + 421981, -1003949, 5630702, 3667902, -1757715, 12434467, -117038, 270046, -3300682, -2768107, + 4386236, -202937, 5800354, -4417911, 341450, -476741, -86436, -236760, -7389491, 3631932, + -1869385, 2903398, 330176, -3194382, -2926483, 4891968, 54224, -1061931, 2482491, 1711545, + 3797288, -1891396, 49392, -2149631, 2609193, 1057636, -2234994, -839666, 2409477, 1629403, + 489089, 1217623, -1139240, 987306, 2325188, 1188095, -687195, -2368675, 1487669, -2646237, + -1611687, 401043, -669478, -1547262, 129386, -876173, + }, + { + -15919296, 39927088, 1927367, -6801618, 4622996, -4208531, 7258495, 2139968, -1260036, 6970195, + 5228049, 7949448, 3487514, -23895050, -17499308, 6917582, -15103789, -11496017, -1648194, -4020090, + -5412196, -2439005, -6960532, -8728447, -2985002, -11093901, 2801393, 8216810, -565325, -8446053, + -6890202, 3701188, 86436, -618475, 4583804, -1572495, -11577084, 2316598, 642635, 4192425, + 9780714, -1933272, -5390721, 8016557, 4132832, 4745402, -1453310, -715649, -653909, 5170067, + 3360812, -3100967, -3231963, 2901251, 92342, 1558536, 4279935, 946503, -2069637, 288837, + 3121904, 1390496, -675384, 7029788, 925565, -5034239, -1124745, -835908, -2995203, -2391223, + 1938641, 2560874, 2253247, 151934, 454730, -3149285, -172336, 296890, -1850057, -2463701, + 785442, 60666, -1184874, -923418, -628139, -597537, 289910, -2203318, 624381, -316217, + -2240362, 22549, 313533, -178778, -62814, -1072668, + }, + }, + { + { + 304406, -42120208, -7528004, 42295228, -864899, -3636227, -7739531, -4129611, 7678328, 8575976, + -3991635, 3246995, 1159104, -2594160, 9906879, 9581535, -5759551, -6628745, 12367358, 4634270, + 7012071, -7854959, -2374580, 18931142, -3779034, 13525389, 2287070, 3379603, 3292093, -4531191, + 2195265, 9277666, -561567, 5587753, 5269925, -6426345, 6773701, 1231582, -7490423, -4489852, + -1120987, 2064806, -4645544, 1311576, -2516314, 185220, -3906273, 180389, -2821794, -4431870, + -3223910, -5025649, 177704, -3788161, 5299453, 1091995, -1009317, 4123169, 4785668, -166967, + -4955319, 2027225, 1432372, 116501, -4031364, -463856, -1921998, -37044, 626528, -395674, + 5230734, 1809792, 311922, -3366718, 577136, -2505577, 956704, 332323, 2042257, -2911451, + 157303, -838592, 189515, 1977296, -1996623, 758062, -1695975, 811212, -379568, 627602, + 217970, 890669, -916439, -208306, 355945, 479963, + }, + { + 22948548, 73724728, -29923574, 75240312, -20477330, -6887517, 7860327, -5214627, -8061117, -3695819, + -26277684, 1557999, -3363496, -965294, -8093866, -15090368, -585726, 10909754, 9051107, -1941325, + 4281546, 5401995, -8054675, 3983045, -1264868, 659814, -16498580, -1693291, -1657857, -388158, + -9159018, 2019172, 1388348, -4269198, -4916127, -1609002, 4731980, 13058848, 6199249, 5202279, + -1629403, 6896644, 8354785, 4845797, -2779381, 1238561, -4905390, -219043, 6226092, -4785668, + 1357210, -2415919, 2020782, -1855426, 1781338, 7850664, -129386, -2389076, -1338956, -2369748, + -4748087, 6172405, 614717, -278099, 1582159, 1644436, -1035087, 2590402, 5906, 317291, + -4300873, -603443, -235686, -1733556, 26307, -744640, 5017059, -1526861, -741956, -2437931, + -3534758, 693100, 905164, 238371, -1767379, 2581275, -3067144, 1877438, -2877628, 205085, + -344671, 1230508, 477278, 2766496, -1797444, -860067, + }, + { + -5712307, 45532560, 16386911, -61537756, 10573136, 15411953, -3393024, 11946988, -607738, 13043279, + 6102075, 2878165, -18301930, 15284715, -7230041, -912681, -3607773, 11585137, -10065256, -16038482, + 19544248, -3663070, 4446365, -1978906, 6664179, 15134391, 8218957, -1164473, -6006512, -1220308, + -788127, 4838281, 3417720, 3156801, 10548977, -6199249, -2895345, 5080947, -8020315, -6639483, + -4318590, -314069, -3382824, -3952981, -1075352, 4344897, -1736241, -465467, -1275068, 2721936, + -3939559, -1020055, -2036351, 1453310, -1194001, 755914, 4236985, 2779381, -2203855, 3321620, + -2217277, 2375117, 16106, -740882, -1367947, -203474, 2802466, -1998770, -380641, -1333051, + -1178969, -1571958, -4108136, -766115, 1269163, 1050120, 2598992, -51003, -637266, 2148021, + -1069984, -1851668, 1526324, -1027571, 633508, 118648, -535260, -575526, -440234, 1205812, + 1783485, 610959, -941135, -326418, 226023, -266825, + }, + { + -615254, 37155764, 379568, -6943889, 5469104, -346282, -156229, -2863670, 1223529, 3865471, + 8308614, -1228898, -5530844, -5585068, 7980586, -5279052, -11782169, -24696, 17052630, 7369090, + 3113851, 5706401, 14435385, 418759, -5311801, 25114822, 22929220, 11098195, -3587372, 1089311, + -776315, 3236258, -119722, 4697084, -8639327, -10331007, -9157944, -6166500, 5923834, 11145440, + 776852, 7934415, -1758789, -122943, -935766, -3898757, 1044751, -1945620, 1783485, 3035468, + -42413, -9776419, -4624069, 1427540, -491774, 2996277, 7002944, -345745, 2485176, 2725694, + 1851668, -2665027, -682363, -1438814, 4538170, 3670050, 2050310, -476741, -462246, 4153234, + 2589865, 1482301, -4654134, 322659, 3952444, 1520418, 3002182, -1322850, 664646, 3350611, + 207232, -1607392, -1988033, 560493, -2068564, -1557463, -616328, 1891396, -2674154, 46171, + -967978, 1380295, 3018288, 1413044, -390305, -753230, + }, + { + 13504988, 2398739, 8653285, -33332704, -4748087, 370978, -1069984, -12569759, -4444755, -14685030, + 12865038, -7454453, 2607582, 3376381, 13557064, -123480, 3037079, -16602733, 402653, 3292629, + 2497524, 11141682, -4810900, -2619393, 10005663, -5048197, -5556614, -7620346, 1374926, 3026878, + -4422206, 5065377, -147103, 5261335, -2341831, -4022237, -3870839, -6477348, 17544942, 6273874, + 8274255, 1487669, 1258962, 4692789, -252329, 7369627, 4042638, -3422552, 2512019, -2990371, + 813896, -2697240, 8123394, 2779918, 868120, 919660, -3164317, 2024003, -690953, 1196685, + 3608846, -3927211, -3987877, -4888210, 3317325, 2560338, 1379758, 2308545, -1044751, 3103651, + -212601, -1142998, -1107565, 1257352, 2879776, 1393717, -3343095, -3830574, -2621541, -660888, + -34360, 1209033, 1212791, 420907, -501974, 1590749, 836982, 2259690, 979789, 1137630, + 843961, 410706, -1692217, 69256, -635118, -484258, + }, + { + 11811, -19298898, 12824772, -2750390, -1993939, -807454, -50466, -4472135, 3674882, 891206, + 4564477, -3062312, 5250061, 19206020, 6167036, -24533390, 264141, 1267015, -12978854, 12308303, + 3962107, 483184, -8861591, 14453639, -8921184, 1155883, -8916889, 5974300, -11873437, -11506754, + -9610526, 6197638, 18159658, 7194607, 3085934, 5732171, -1960653, 2630668, 1046361, 5089000, + -8752070, 13249437, -940061, 422517, 1860258, -3355980, 7172596, 603980, 1804423, 3034395, + -4395899, 882616, 3129958, 4960151, 494995, -878321, -2214593, -959388, 3346853, 3354370, + 519691, 1247688, -84826, -1343251, 4976257, -150861, 404264, -1194538, 3533148, -1173600, + -4212289, -3000572, 3233037, 1739999, 2968359, 278099, -1331977, 1330366, 4272956, 1545115, + -1147293, 601832, 491237, 1839320, -206695, -333397, -120796, -3658775, 1377611, 1749125, + 1894081, -101469, -841277, 217433, -594853, 659278, + }, + { + 18777060, 64472828, 1349157, -15983721, -7410966, 2927020, 6075231, -6911140, -17279728, -7414188, + 13026099, 2583423, 1330366, 8546985, 1621887, 8003672, -13784161, -17689896, -12629351, -4306242, + 12174085, -7247758, -4833986, -12335146, 1644436, -9234180, 7727183, -934692, 5675800, -3335579, + -10855530, 6947647, 2910914, 8626442, 5080410, -3100967, 1869921, 748935, -4687420, -6177237, + 1071594, 3159485, -8274255, 6853694, 2100239, -5779416, 1219234, 4194036, 2489471, 5257040, + -2085744, -1569274, -1991791, -2377265, 3207804, 3113851, -750546, 3700114, 86973, 3491809, + 2209761, 2044404, 1522566, -85899, 1554241, 5060545, 836982, -1117765, -38655, -636192, + 19864, 620623, -710280, 1541893, -3096672, -2222646, -1521492, 1434519, 121333, -2063195, + 2552821, 1949378, 680752, 1166621, -1170379, -2427194, -761820, -941135, -261456, 1663226, + 627065, 2091649, -1054951, 190052, 499827, -1444720, + }, + { + -675384, -25282324, -1395328, -3789235, 4938676, -130997, -4396973, -4165582, -2475512, 2047089, + -3494493, 4502737, 958315, 20105816, 6291054, -11392401, 4908611, -3860639, -6203007, -8810052, + -4442070, 2713346, 7340099, -6423661, -6773164, -12541305, -16152835, 8117488, 4094178, 7028714, + 19933480, 1734093, 4345970, -5228586, 6578280, 1711545, -9250823, -1421097, -3798899, 4918275, + -1959042, -8049843, 1013612, 4527433, -13959, 4269735, 1589138, -1269163, -2854543, -605054, + 6747931, -4709432, -3048353, 1407676, -310848, 200253, -694711, -2037962, 2495913, -1992865, + 2935610, -1779727, 405874, 2727304, 2512556, 3344169, -317828, 4152697, 4317516, 2794950, + -441845, -1766842, -1349694, 1517197, -597000, 275952, 1911797, 2640331, 2096481, 1439351, + 1904818, -1780801, 627602, -947040, 794569, 774705, 73014, 1621887, 871342, -1163936, + -513249, -2623151, 119722, 178241, 1473711, 580894, + }, + { + 35056596, 54679228, -7625178, -35556960, -180389, 9809168, -2348273, -8302709, -3253975, -638876, + 24515136, 11328513, -6756521, -9250286, -18079128, 1902671, 10927471, -6874632, -13443785, -256087, + -7558069, -2913062, 1997697, 6589017, 10231686, 7754027, 2977486, -1400159, -2653216, -606664, + 7366943, 11096585, -504659, 4604742, 4481262, 1017907, -8825084, 949188, 1918777, 6212134, + -1591285, -1727651, -4920959, 5206574, 438087, -10142028, 4682051, -1618129, -8220031, 1738925, + 6135361, 717796, 6687264, 4674535, 2021319, -3339337, -1001801, 96637, -1328219, -6273337, + -4418985, 778463, -2064269, 5509906, -189515, -1121523, -1387274, -3681861, -2309619, -2537252, + 845572, 1826435, 400506, 2494839, 117575, -703838, -525597, 17180, -3151432, 2134062, + -2168422, 1883880, 413927, -227633, 1462973, 1345399, -789200, -1591822, 77309, -361314, + 176094, -505732, -830002, -750546, 863825, -104690, + }, + { + -3750043, -22505092, 18241262, 2244657, 6668474, -2618320, 22706418, -38655, -7880191, -3365107, + -17660906, -584652, -9484898, -8661338, 1210107, -2372433, -20270098, -7477538, 3151969, -970126, + 4350802, 8898098, -2531883, 10786810, 3996467, 10247255, 6338835, -4420058, 5104569, -392453, + 7800735, 1801739, -9525701, 12840878, 3653944, -741956, -2551211, 430570, 9944997, 694174, + 4482335, -3925600, 4147865, -2908767, -4232691, 4868346, 2770254, 3854196, 6025839, -896038, + -4479651, -695785, -4190278, 506269, 3106872, 3266323, 1344862, 8715562, 472983, -248571, + -1675037, 1215476, 2780991, -1730335, 1697049, 2267743, -2987687, -1292248, -5018133, 1184874, + 1517734, 1469953, -2568927, -2627983, 1956358, -1966558, 1301375, 753230, 2442226, 1641214, + 2389076, 1166084, -2314451, -2936684, 926639, -290447, 2287607, -1184337, 411243, -1110786, + 577673, -1192927, 1449015, 1186485, -2384781, 1051730, + }, + { + -21791054, 39996348, 10707353, -11980274, 229781, 21840982, 46721192, 14794015, 11472931, 5232344, + -9592809, 10477036, 2729989, 6577206, 18988050, 9147207, 5479305, 9978283, -15831786, -6369437, + -3038689, 11866458, 6276558, 3579318, 4430259, -5421323, -438087, 12196097, -7881265, 7175280, + -2325725, 6617471, -486942, 2348273, 3769908, -1222455, -6228240, -722091, 1442035, 2720325, + -362388, 3044058, -3115999, 1591285, -4160213, 3244311, -3668439, 1800665, 4981089, 1233729, + -2829310, -5129265, 5180268, 3591130, -5095979, -3654480, 455267, -1166621, 3605625, 942208, + 71404, -2520072, 413391, 2332167, -320512, 3813394, -278099, -3179350, 302795, -2872796, + -153545, 1199907, 876173, -1763621, 721018, 904091, 1619740, 2066953, 572841, -202937, + -3534758, 70867, -250719, -1526861, -356482, -1166621, 408022, -220117, 842350, -1524177, + -1928440, 108448, 1741609, 1037772, -603980, -867583, + }, + { + -2141578, 15902653, 22662932, -6727530, -1765768, 995359, 8941048, 1281511, 1413044, 207232, + 3614215, -2804614, -6252399, 8917963, -7926362, -22370874, 11832098, 3796214, 10547903, -838592, + 1313186, -4810364, -10065793, -11009612, 6082211, -1394254, -5166309, 6999186, 1434519, 2296197, + 8773544, -2326799, -361851, -5626407, -6535330, -4143570, -9909563, 2583423, 10025527, 3821447, + 1557999, -5497558, 4402342, 14865956, -409633, 2858838, -3859028, -1200443, -784368, -5457293, + -7226283, 2084133, 1251983, 2888903, 1305133, -6001143, -1880122, -1280437, 947577, -3607236, + 1893007, 4500589, -1972464, 584652, 4114579, 1831804, 6299644, -804770, -322123, 1793149, + 1292785, 3351148, 438087, -631897, 1267015, 411780, -2733210, 1692754, -1651952, 27917, + 950798, 623844, 1794223, -1401233, 2335925, -2408940, -2241436, 1549946, -2379412, 1060857, + 590558, 849330, 20401, -1161252, -897111, -1423245, + }, + { + -8284455, 75612896, -6513855, 14244796, 6846178, -19643032, -14531485, 12948790, -134218, -7892003, + 8086350, 17631914, 11995844, -9644886, 28108950, 12895639, -198642, -2428267, 5349382, 8032663, + 12411382, -224412, -15344308, 4866198, -21882858, -5776731, 2857764, -2237678, -6253473, 10098005, + -1572495, -6462852, 12596065, 6305549, -864899, 6540162, -3174518, -972273, -2058900, 10231686, + 3545496, -5492727, -7072201, 7299834, -3459059, 9458055, -5527623, 738198, -10204842, 7100118, + 3506841, -3212636, 6077916, -1277753, -1763084, -564788, 2118493, -274341, -3631932, 6156299, + -545461, 155156, 712965, -3862249, -1785633, -10737, 136365, -4815195, -587337, 2516851, + 2920578, 2459406, -1289027, 1713155, -1634772, 1928977, -808528, -594316, 2003065, -2067490, + 685047, -626528, 12885, 117038, 2111513, -303332, 84289, 1624035, -162135, 347355, + 838592, 2978023, 1051193, -333397, -866510, 416075, + }, + { + 3871913, -12880607, -6941741, 10487236, 8725763, 6182069, 9055402, -3726421, 4781373, -4709432, + 1490891, 561567, -1864553, -42071888, -12207908, -24380918, 7761543, -15000710, -10860899, 5930813, + 3744675, -20611012, -9007620, -8653285, -3187403, -8827768, 780610, -156766, -10835666, -4469987, + -9507984, -7370164, -3682935, 5905580, 16216723, -1290638, -6222334, 5393942, 4430259, -14568529, + -9357660, -7919383, 486405, -2020782, -7662222, 4939750, -3262565, 4169340, 4698158, 3476239, + 7786239, -1171989, 4309463, -9101036, -499827, 1039382, 801548, 2498597, -11583527, -1432909, + -1930051, 2639258, 2815351, -515933, -4533875, 824097, 920734, 156229, -190052, -974958, + 5417565, -2066953, 856309, -1897839, 2393371, 1436130, -1955821, -2297271, 701153, 1201517, + -1185948, 1032403, -363998, 1422171, 2853469, -744103, -2497524, -1767916, 3352759, -3304441, + -1131724, 869194, -1810329, -1130113, -1260036, -1485522, + }, + { + 5735392, 77039368, 6619619, 213138, 4337917, -22807350, -2866891, -4788889, 998043, 8201240, + 10337986, -2642479, -3642669, 13051869, 31117038, 9191230, -16990354, -13175349, -233539, 2412161, + 3599720, 8701067, -2251100, -1221918, 14255533, 4173635, 5289252, -1213328, -10165114, -753230, + 4032438, 12407087, 10569378, 2587718, -2705293, -6432251, -8429947, 11943767, 9089761, 3902515, + 8303783, -4973036, -5355288, -2387465, -3282966, -1272384, -5920076, -9849434, -8790724, -1549946, + 434865, -2382633, 1574642, 6148783, 733903, 5245229, 5071283, -328565, -3664681, -1389959, + 5135707, 2997887, -2885681, 1423245, 467078, -21475, -597537, 620623, 1376537, 1634772, + -1099512, -1682554, -2771328, -2092186, 141197, -2453500, -779537, -1470489, -3330210, -1087164, + 1421097, -917512, -1377611, 884763, 148713, 141734, 1398012, -396211, 562641, -113280, + 499827, 904091, 71941, -545461, -271120, 443455, + }, + }, + { + { + 1028645, -64508800, 4415764, 29436096, 14849313, -7791608, -2615635, 2269890, 933082, 1463510, + 11829414, -7577933, -8265665, -7378217, 21825414, 11508902, 7707319, -18176838, 2352568, 18173080, + 4793721, -5630166, -6584722, 16006269, 5100811, 3145527, 9352828, -3711926, 7133941, -5414343, + 11574400, 9010305, -5787469, 10273025, 4616016, -2045478, -1597191, 69793, -9899900, 1351304, + -8201240, 436476, 1241246, 259309, -2922188, -9031779, -403190, 5560909, -1473174, -6031745, + -4337917, -6220187, 1207960, -4473209, 2022393, 4248797, 1701881, -826244, 4607426, 282394, + -2977486, 2669859, 1710471, 963683, -3325379, -1947231, -2230699, 803696, 53150, 2367064, + 3617973, 1331977, -57445, -331249, -384400, 44560, -2850248, 3490198, -513785, -1404454, + -1446330, 310848, 150324, 2181307, -391379, -427349, -1703491, 1208496, -374736, -448287, + 1228361, 271657, 265751, -57445, -763430, 646929, + }, + { + -24570972, 44130252, 38962332, 27275726, 12004434, -9439264, 8341900, -10622528, 5733245, -15334644, + 3311420, 3450469, -17302276, -8975945, -6487011, -16186121, 13099650, 3650185, 9087077, 5670968, + -41876, -3664144, 1473174, -299574, 2988760, -1649804, -15000173, -5428839, -2398202, 2718714, + -5706938, 1391033, -3800509, -680752, -4364761, 525597, 4365298, 10435160, 3628711, 7827041, + -705985, 4381941, 10954851, 2988224, -213675, -3272765, -1184874, -4283693, 5731634, 773631, + 494995, -1534914, 5899675, -427349, -184147, 2804614, 4046396, -4210679, -908922, -1010928, + -2819109, 1027034, 1373853, 1242319, -3013457, 3935801, 359704, 3950296, -1306744, -287226, + -1906966, -2291902, -1015760, -679142, -293668, 1961190, 1975685, 1301912, -4083440, -2572686, + -2116882, -235686, 1479079, -1446867, -1317481, 926639, -626528, 581431, -1723893, -717796, + -916976, 1144609, 1141388, 1750736, -361314, -1216550, + }, + { + 3289408, 98420784, -25441238, -44846976, 1612223, 7803956, 6696391, 2720862, 7458748, 3607773, + -3992172, 6570226, -4417911, 4199941, 3874061, -9389872, -4066260, 11098732, -8963060, -4731444, + 9198746, 4129074, -1906429, 2331630, 18180060, 10583336, 3110630, -1652489, -11559368, 538482, + 903554, 4311074, 1066763, -910533, 10095858, -432181, -512175, 369367, -4932233, -10614475, + 1174137, -2850248, -6622303, -1546188, -1137093, 599685, 1011465, 2644626, 1074816, -5303748, + -745714, -2241436, 500901, -972810, -1064078, 880468, 5139465, 1371705, -307090, -1613834, + 3358128, 1060320, 141734, 142271, -2347737, -207232, 1801202, 1936493, -5743445, 195421, + 2637647, -4239133, -2814814, -1734630, 385473, 3421478, -1098438, 753767, 869731, 1016834, + -2973728, 918049, 1187559, -620623, 1229971, -382789, -551366, 351114, -745177, 1284195, + 682900, 1290638, 971200, -1704565, -835908, 1418413, + }, + { + 431107, 34065532, 2833605, 397284, 127775, -478889, -1144609, -2263985, 2551211, 3204583, + 8240432, -8398809, 2457258, -4286378, 13085155, -8114804, -17831630, -6454262, 32101660, 14223321, + -8822400, 4853850, 26840324, -9780714, -2529736, 17665200, 22646288, 7272454, -4861366, -404264, + 14311905, -6118181, 51003, 5019206, -10944650, -12247099, -5411659, -3077881, 5985574, 4372277, + 8247948, 6476274, 865436, 44560, -330712, 878321, -5985574, 694711, -2516851, 4990215, + -959925, -5692443, -9394167, 1959042, 7021198, -1267552, 4396436, 1716376, 1110786, 559420, + -955093, -292058, -1964411, 370441, 3536369, 2340220, 815507, 1509681, -2266132, 5222144, + 1650878, 860604, -3024194, 2241436, 3052111, -896038, 4006668, -1371705, 6979, 1855426, + 59593, 1011465, -1913408, 716186, -3612068, -860067, -1455994, 1901060, -1262720, -993211, + -478352, 2525978, 1722819, 585726, 493384, 536334, + }, + { + -9652402, 50484120, -10198400, -43007656, 9780177, -570694, -3929358, -4277251, -12304544, -4622459, + 18601504, -34426312, -1604170, 13806709, -6570763, 20609400, 578747, -3369402, -564251, -627602, + -1503775, 12396886, -3654480, -2379949, 6239514, 1991791, -4416837, -1020592, -7594039, -2250026, + 7759396, 2695092, -1524177, 9034464, -10162429, -4019553, 2952790, -129386, 10014790, 10404558, + 3845070, 4768488, -5021354, 6400038, 830002, 8937290, -4373351, 5704791, 1286880, -394063, + 1109712, -1178969, 2266132, 4882304, 1997697, -374199, -725313, 1473174, -507880, -675921, + 4657355, -6979859, -217970, 192200, -3983582, 4221416, 2368675, -1319092, 2134062, 2551748, + 1270774, -1655710, 138513, 872415, 2454574, 1854889, -2021856, -5326297, -1193464, -782758, + -2338610, 2805688, 1325534, -955093, -677531, 3262028, 967978, 2221572, 1305133, -627602, + 652298, 355409, -1154273, -380105, 1449552, -1603097, + }, + { + -1314797, 4061965, -4851166, -1434519, 1701344, -1888712, -1256278, -981400, 1923072, -1570884, + 4866735, -628139, 3877282, -1109175, 9949292, -11538967, 4305705, -1683627, -6343130, 9838159, + -9800578, 8034810, -3384971, 8826695, -12704513, 569083, 855772, -6942278, -13408888, 4261682, + -5625334, 1089311, 12431783, 6104759, 207232, 8917426, 6979859, -2869575, 1655173, -392990, + 7054484, 1974611, 3788698, -1163399, 2011118, -2566243, 5739687, 1870995, -1059246, 3525095, + -2109903, 411780, 498216, 3527779, 4260071, -5219996, -233002, -318901, 1723356, 4566087, + 325344, 1961726, 880468, 496069, 3391414, -3573413, 4969814, -1508607, 1235340, -2749853, + -513249, -3548180, 1692754, 1738388, 2925410, 105227, 63351, 1438814, 2558190, 1973001, + -411243, 1114544, 133144, 813359, 175557, -7516, -1483374, -2029909, 1100585, 1344862, + 779000, 238908, 445603, -57982, -973347, 365072, + }, + { + -5284958, 98782640, -4206384, -26827440, 15117211, -4307852, 2903398, -2555506, -14171245, -200253, + 14652818, -10041634, 8715562, -2551211, 10618233, 9292162, -9097814, -21201032, -19908248, 5648956, + -4727149, 397821, -6187438, -5002563, -15200426, -906238, 9688909, 1721745, -4742181, -193810, + -3381750, 368830, -1643362, 7802345, 6038187, 3644817, -6295885, 5797132, -4665408, -488553, + -2609193, 2631204, -4435091, 4323959, 3532074, -7448547, 294742, 8983461, 4657892, -3659312, + 1055488, -3364033, -579821, -2995740, 3052648, 1258425, 3310346, -593779, 4196720, 1505923, + 3036542, 5458367, -2585570, 1147830, 4185983, 1371705, -292595, -1287953, 2118493, -1846836, + -372052, 1775969, 870268, -167504, -3002182, -931471, -2081449, 458488, -189515, 1311576, + -32212, 2711735, -26307, -306016, 937914, -2093260, -1381369, -1644973, -1084479, 2665564, + 904091, 869731, -100932, 1240709, -727460, -222801, + }, + { + -2336999, -18022756, -2150705, 2690797, 103079, -2631204, -2649458, -2703145, -3550327, -2140504, + -1894618, -881005, 6258841, 13840532, 7687455, 4661650, -16486769, -4842039, -16577500, -1644973, + -2894271, 2712272, 4329327, -9911711, 4110821, -11074573, -11140071, -8884140, 14151917, 10999411, + 14148696, -6378027, 17020418, -11303280, 10168335, 2790118, -7716446, -7482907, 1094680, 3258807, + -477815, -10248866, 6061810, 2600066, -825707, 2818036, 4607963, -4133906, -3723737, 2960306, + 2772402, 2645163, -3565360, -525597, 1001801, -3295851, 1115081, -2376191, -2930778, 1906429, + 4621385, 908386, -2074469, 890132, 4138738, 1036698, 4474819, 302795, 4875862, 5075041, + -1214939, -1529545, -1150514, -623844, -494458, 804770, 2262374, 1644436, 1738388, 2491618, + 707596, -1429150, 2430415, -1432372, 726923, -356482, 1031329, 958851, 1057636, -1239098, + -619549, 9664, -2246268, 350577, 2041183, -318364, + }, + { + -35136592, 157297808, -24412594, -33143188, 10327786, 7630547, 7485591, -23365696, 19945292, 8591545, + -616328, 23965918, -16471736, -16204912, -2365990, -851477, -2164664, 11003706, -15173583, -11894912, + 2302103, -2449742, -517544, 3979287, 5463736, 13590887, 46171, 1396401, -1789928, 287763, + 3127273, 8840653, 81068, 6039261, 4583267, 1653562, -16461536, 9469329, 4054986, 3386045, + -2658048, -1932735, -6192806, 8687108, -1119913, -9074192, 4179540, -1788854, -4286914, 3824132, + 1842541, -540092, 7977365, 5782637, 59056, -4906464, 55298, -932008, -1984275, -2772938, + -5015985, -1073742, 2449742, 2718714, -788663, -1472637, -1117765, -3998078, -2188823, -2764885, + -152471, 1333587, 1973001, 2637647, -960999, -1199907, -648003, -1425929, -1726577, -112743, + -1314797, 3821447, -1603097, -388158, 3610994, -1487132, 1064615, -1038845, 112743, -520765, + -1395864, -265751, -90194, 1113470, -1328756, -116501, + }, + { + 5100811, 284005, -4351876, -3664144, 9568113, 9558450, -1451162, 1765768, -9019431, -3693672, + -15162308, -10562935, 3171297, -5086852, 16643, -1309428, -12419435, -6429566, -2085744, -14244796, + 14076755, 7490423, 9881646, 2010045, -2015950, 18014704, -52613, 1098438, -3464965, 5477157, + 12701829, -12719546, 6628745, 15509127, -3621731, 8272644, -2936684, -3391951, 5142687, 4037269, + 3638374, -3288871, 2813204, -4747550, -3487514, 4812511, 2732673, 3012383, 5063767, 158914, + 2008434, -3797825, -6747394, -2168422, 5634460, 2168422, 1034013, 7326141, 2258079, -499827, + -301721, -394600, 1371705, 3626026, -3440806, 4886062, -1411971, -4285841, -3793530, -1717450, + 3965329, 2144799, -4229469, 962073, -466541, -1126355, -308164, 773631, 2799245, 2416993, + 3325379, -607738, -1854889, -1671816, 1178432, 326418, -720481, 1097901, 420907, -1300838, + -1279363, 1260036, 288300, 711891, -1461900, -40265, + }, + { + 26520886, -9143449, -3347927, 12977244, -390305, 23190140, 27809376, 24732570, 5534602, -1725503, + 2571612, 2695092, 7608535, 11889006, 9538049, 11409044, -7404524, 14704357, -14405857, -1438277, + -7352447, 20913270, 9196062, 182536, 5988258, -158914, 2084133, 3266323, 3763465, -8245801, + 11840688, 8250632, -10399726, 5643050, 4053912, -7362111, -2255932, 577673, -8618926, 10875394, + -1685238, -2430415, 2212982, -4740034, 2549600, -386547, -148176, 3395709, 2737505, -3169149, + 2226941, -5303748, 2954401, 657667, -3401614, -3853660, 2774012, -887985, -2415919, 3869766, + 2614561, -3599183, -2396592, 496069, 2195802, 975494, 1197222, -1848447, -1006633, -3172907, + 955630, 1420560, -198105, -1111860, 1028108, 685047, 3388192, -814970, 1227824, -501437, + -1050120, -1114007, -1238561, -1280437, -1155883, 1588601, -365072, 1100585, -1565516, -537408, + -46171, -184147, 1170379, -45097, 1609539, -1697049, + }, + { + 2211371, 28998546, 4362076, -5369246, -4110284, 7414724, 9588514, -4825396, 7515656, -3637301, + 7128035, 1505923, -4239133, 3635690, -28107340, 3522947, -6478958, 19891604, 888521, -10633265, + 9120900, 10440529, -24624122, -490163, -9708237, -5276368, -370978, 9547712, -14550812, 13649406, + 8086350, -5057324, -2580202, -4526359, 420370, -7308424, 2963528, -2793876, 4962298, -2129767, + -801548, 1305670, 9243843, 9823127, -291521, 4621922, -2746632, -3377992, 1642825, -7873749, + -5121212, 1909113, 1952600, 1432909, -1469953, -3120294, -3526168, -5946382, 1853815, 2636036, + 335544, 1396938, -28991, -2725694, 5827197, 2103997, 3364570, 2270427, -275952, 527744, + 2787971, 4413079, -358093, -1009854, -184147, 226023, -438087, -912681, 23622, -1171452, + 1250909, -662499, 1729798, 962073, -268972, -2629057, -1165010, 480499, -2165201, -19864, + 3171297, 204548, -777926, -447750, -560493, -1470489, + }, + { + 25013352, 33259690, -7593502, 3043521, 18815714, -21780316, -11592654, -1727651, -2914135, 21238076, + -3084324, 8762270, 9106941, 1560147, 19735374, 5082020, 3680250, 16624208, -11618423, 25279104, + 3424700, 3977140, -16856136, -13829795, -863825, -1467805, -3508452, 1706176, -11553999, 7732015, + -2644089, -549756, 2055142, 9119826, -4320200, 10570451, -3595425, -2153389, 6773701, 406411, + 2666638, -10179072, 1493038, 1881733, 1754494, -3106872, 6786049, -3733937, -3584150, 6238977, + 1730335, -4133369, 4576825, 4320200, -5222680, -782221, -2345052, -1586990, -97711, 996969, + 595390, -653372, 2308008, -1196685, -5936182, 41876, 147640, -1190243, -3957276, 2877628, + 1772211, 816581, 4277788, 193810, -1331440, -579821, -1276679, 2589865, -1363652, 227633, + -662499, -350040, -748398, 4166118, -294742, -1066763, 647466, 3142842, -938450, -1915019, + 2428804, 1205812, 2643552, -146029, -185220, 667331, + }, + { + -3436511, -29260538, 15840913, 4839892, 6636262, 3559454, 10704132, -107374, -3578782, 789200, + 911070, -3483219, -5588826, 1883880, -75322456, -8302709, 7141994, -13346074, -10499048, 15214385, + -14249628, -4853313, -20002200, 4445291, -11647951, 3069291, -13813152, 12928925, -11156178, -6587406, + -17143898, 512175, -6264747, 12276627, 6170258, 1461900, -6297496, 6023155, 9594957, -11638288, + -9752797, -7792145, -574452, -4975720, -6401649, 6823093, -5627481, 451508, 8919036, 1088237, + 14573361, -4575751, -683974, -2351495, -2361158, 827855, 3167002, 616865, -8937827, -4289062, + 2371896, -1193464, -461172, 1480153, -98247, -4176856, 3774203, -1490354, -475668, 915902, + 2105608, -1080721, 3285650, -212601, 498216, -734976, -848793, 930934, 471910, 162672, + -2086280, -941672, 1198833, 1353989, 1813550, -1351841, -2114735, -256624, 1897839, -1651415, + 132607, -923418, -2170032, 235149, -1531693, -291521, + }, + { + 9551470, 58783608, 17578764, 11324218, -6758131, -17853642, -6517076, -5550709, 4203699, -10406169, + 25895432, 1046361, -20841328, -5071283, 63353988, 1508070, -15685221, 4780299, -6604586, -1807644, + 3223910, 6960532, 3246995, 4561792, 11310796, 5592048, 15556908, 52076, -22371410, 4995584, + 4922570, 6335077, 5891085, 11081552, -4829154, -9343164, -5004711, 4690641, 20316270, 2813204, + 2697240, -9932112, 1777580, -5967320, 2704756, -1702418, -2372970, -15363098, -6586869, -7598334, + 456340, 2239289, 1811403, 530428, 4316442, 7683697, 1740536, -1943473, 2975876, -2730526, + 2069637, 966905, -223338, 1605244, -2475512, 6337224, -1015223, -2776160, 2575370, 6048925, + -3633006, -2732673, -3740380, 1114007, -2231773, 952409, -3164854, -1618129, -1657857, -1707786, + 27917, 1586454, -1560147, 1178969, -577136, 812286, 245887, 2013266, -626528, -1847373, + 2281702, 793495, 261993, 143345, -1513439, 1596654, + }, + }, + { + { + -920734, -60347512, 7643968, -1292248, -6158983, -2521146, 5365488, 8045011, -5987185, -13118441, + 246424, -19252728, -13970992, -1263794, 27995670, 9802189, 15038828, -3499862, 4672925, 27249956, + 6291590, -19117436, -13548474, 1880659, 315680, -6471442, 7394323, -2430952, 3349001, 6718403, + 19285476, 11968463, -5068062, 3623879, 2565706, -1853278, -286152, 2603287, -4935991, 3206730, + -6425808, 605590, -1617055, -5759015, -8590471, -8102993, 2683818, 2565169, -1118302, 222801, + -199716, -7882876, 679679, -4203699, -3621194, 1738925, 4304631, -2466385, 752156, 2596308, + -1133335, 1847910, 628139, 1644436, -1637456, -1034550, 1317481, 3470871, 431107, 1480690, + -267899, -2336999, 946503, 2649458, 808528, 2360085, -2375654, 3457449, -606127, 641561, + -151398, 1326608, 413927, 1134945, 355409, 1975685, 204011, 1833951, -229244, -1010391, + -69256, -572304, 797253, 1276679, 751082, 1387811, + }, + { + 26345866, -3489124, -33588792, -10749229, -5566815, 2460480, 13967771, -2123325, 7690139, -5728413, + 25164750, 2117956, -14198088, -8070781, -1510755, -9939091, 11518029, 6456947, 15919833, 5422933, + 1682554, -4313221, 4851166, -1348083, 5497022, 2539400, -7490423, 732292, 1384053, 4884452, + 5200669, -176094, -1516660, 3488587, -9853729, -5259188, 1318018, 3080565, -1382443, 4742718, + -2705293, 4215511, 3325915, -7016903, -2787434, 1404991, 9265855, -1064078, 1178969, 1222455, + 4543002, 3628174, 7733089, 3548180, 661425, -6738804, -736050, -861141, 3648575, 1479079, + -3814468, -1927367, -1319629, -365072, -4205310, 3536906, 1307818, 4175782, -219580, 79457, + -1170916, -440234, -345745, -86436, 543313, 1248762, -911070, -511101, -3877819, -173946, + -900869, -791348, 1517734, -1250372, -602369, 807991, -789200, -54761, -457414, -39728, + -175557, 528818, -1022202, 702764, 141197, -962073, + }, + { + -929860, 144543904, 15413027, -886374, 21163988, 845035, 2242510, -10006200, -5841693, -13357885, + 2754148, 16532403, -2509335, 4295504, 9762461, -12324409, -5557688, 8677445, -1903207, 3985193, + 4052302, 7242926, 2607045, 3311957, 14977088, -1605781, -3727495, -944893, -13433047, 1748052, + 8414915, -1613834, -11025718, -6970195, 5507222, -380105, 1793149, 697932, 2681670, -4870493, + 5987185, 2822331, -3643743, -2719788, -4137127, -3832185, -2163053, 3104188, 5825587, 789200, + 1291711, -4468914, 3577171, 1369558, 2247879, -839129, 2550674, 1482301, 4462471, -1343788, + -734976, -2022930, 263604, 744103, -551903, 1903744, 1815697, 1876901, -6183679, 505196, + 2960843, -3646964, -416075, -974958, 476741, 2238752, -5080947, -1446330, 1006096, 2561948, + 32212, 3762391, 2156611, -826781, 1453846, -234613, -744640, 1084479, 217970, 97711, + -1453846, -13959, 1685775, -213138, 28454, 495532, + }, + { + 550293, 29633126, 2712272, 4170950, -1503775, 1076963, 2025614, -149250, 1416266, -2719251, + 3615826, -8108899, 1935957, -4597763, 22143240, 18105972, 1501091, -4555350, 32163936, 15037217, + -13035226, -3491809, 17506286, -8000451, -5017059, -7508677, -10098005, -8879308, -9716290, 421444, + 8763344, -11848204, -3468723, -3171833, -3764002, 4602595, 7211787, -6709813, -2773475, -325344, + 6429566, -2398202, 761283, 8461622, 6575595, 3499862, -4924180, 2346126, -4871567, 2160906, + 1371705, -269509, -4845797, -1540283, 4109747, -5422933, -908386, 2018635, 858993, -720481, + -2185065, -644245, -1502702, -1221381, -899259, -712428, -2747705, 484258, -3377992, 287763, + -188442, 260382, -4094178, 61740, 1340030, -3517578, 866510, -2126009, -1960116, -135291, + -61203, 3121904, 947577, 1290638, -3062849, 637803, -269509, 1029718, -936303, 570694, + -944893, 482647, 25770, -306553, 125628, 1191317, + }, + { + -1595580, 94087168, 20179904, -51241644, -5759551, 121870, -938987, -8307004, -16167331, -12865575, + 13419088, -26358752, -5260798, 5529771, -12144557, 22444962, -663036, -7343321, 5167920, 9358734, + 1300838, 9011915, -2327336, 5356898, 10770167, 9255655, 8706972, 16408386, -2630131, -4564477, + 10047002, 1015223, -6200859, 6364605, -8720931, -4735202, 11180874, 1381906, -2897492, 5723581, + 1673427, 5033165, -4727686, 7120519, -2864743, 6013491, -4428112, 4385699, 1450088, 2932389, + 827318, -2515240, 311922, 5741835, 3235184, -2563559, -229244, 2916283, -653372, -5660230, + 5264556, 1221918, 7123740, 947040, -6526203, 2085744, -1033477, -1547262, 1063541, -515396, + 1862405, 1132261, 298500, -647466, -294742, 1837172, 768262, -2302639, -189515, -1214939, + -3357054, 2287607, 155693, -1322850, 914828, 1693291, -2308545, 459025, 1917166, -852014, + -846645, 1088237, 310311, -663572, 2273112, 187368, + }, + { + -185757, 22487912, 2292976, -1936493, 139586, -2351495, -73551, 1528472, 1858647, -5308580, + 1505386, 1423245, 1366337, -8988293, -2165737, -7937100, 12645457, 2547989, -705448, 21150566, + -8400419, 9305584, 1096827, 7887171, -14887430, 956704, -1705102, -3306588, 3266323, 23432268, + 945967, -13339632, -7838316, -2281702, 216896, 5686537, 3489124, 491774, 2076617, -5182415, + 11533598, 7401840, 8012799, -466004, 2372970, -5013301, 1848983, -4159139, -8761733, 1918240, + 788663, 2348273, 682363, -1141388, 1896228, -3467112, 2424509, 721018, -1523640, 1072668, + -439697, 1944547, 908922, 1039382, 3220152, -3678103, 6179384, -175557, 99321, -4637491, + 1111860, -3229816, -1759863, -1567126, 489626, 1588064, 1145146, 113280, 804770, 372588, + -556735, -378494, -283468, 701690, -889058, -470299, -291521, -896574, -304943, -971200, + 80531, 991601, 70867, 9127, 20401, 429497, + }, + { + -16339666, 118656528, 34092912, -29954176, -1438814, -9771051, 3524558, 8733816, 487479, 10698227, + 14504641, -17448842, 4643934, -15333570, -2160906, 2161442, -5364951, -8538932, -2764348, 8309688, + -12011950, 626528, -9470403, -3877819, -4408784, 459025, 2257542, -248571, -3622805, 3540664, + 677531, -2800319, -7754564, -1010928, -343597, 517007, -4391067, 9566503, -159988, 5595806, + -292595, 2452963, -154082, 2707977, 1081795, -1579474, 1258425, 1130113, 4581657, -2997887, + -292595, -4044786, 2250563, -2045478, 2271501, 2704756, 5264556, -2120103, 427886, -2868501, + 2079301, 2961380, -3746285, 1379758, 2018098, -1722282, -1187559, 722091, 2346126, -2197950, + -1886564, 1175747, 632434, -820876, -2040646, 576599, -1780801, -565325, 134755, 1810866, + -1979443, 1752884, -328028, -1019518, 706522, -1055488, -610959, -947040, 578747, 2758980, + -768799, -186294, 592706, 2307471, -46708, 314069, + }, + { + 796180, 7361037, 7528541, 3980898, 1056025, -867047, 972273, -430570, -4233227, -969052, + -1734093, -2256469, 1243930, -8039642, -6222871, 6289443, -33498060, -25628606, -12762495, 9409736, + -9295383, 1061931, 12222403, 259846, 6784438, 1847910, 6544994, -8374650, 4484483, -7353521, + 4277251, -6566468, 12416750, -7537131, 8286603, 321586, -139050, -4886062, -5874979, 3343095, + -1097901, -8568460, 5172215, 1118839, 1588601, 3986804, 3371549, -3911105, 1311039, 2163053, + -957778, 7607461, 329639, -2442226, -1245004, -8604967, 1731946, -1057099, -4149475, 3115999, + 6339372, 683974, -2547453, 1815161, 2024003, -1497333, 1867774, -4967130, 1213328, 2121714, + -654983, 1431298, -491774, -1008244, -711891, -987843, 463320, 595927, 358630, -729608, + -2109366, -2079838, 2100776, -1063004, 680752, -1879585, -703838, 1233729, 1869385, -258235, + 479963, 2229625, -297963, -718333, 39192, -992137, + }, + { + 24659554, 271473600, 22083648, -23698556, -7633231, 6401112, 23109072, -7301982, 27807228, 2207613, + -18875308, 13421236, -1212791, 7260642, 8035347, 3834869, 3294777, 18027052, -8624831, -12818867, + 927176, -12298102, -9522479, 1426466, -4301410, 535797, -3213173, 7304129, -964220, -195421, + -5026723, -5043366, -4490925, 3740380, 1910724, -2526515, -12540231, 17131550, -992674, -5800890, + 2206003, 8244727, -3501472, 5479305, -167504, -7293928, 3668439, 3474629, -90194, 2856153, + 452582, 1881733, 4565014, 2316598, 4272419, 1438277, 3204046, 829466, -1917703, -1162326, + -2596845, 1195612, 3961034, 27380, 3221, 526670, -381178, -116501, 528818, -461709, + 454730, -373662, -751082, -348966, -1265405, -718870, -1671279, -905701, 1574642, 1015223, + -2015413, 2298881, -95026, -1138703, 2077690, -1813550, 675921, 1042603, 2037962, 257698, + -568546, 1287953, 1684164, 2143189, -1928977, -586263, + }, + { + -5461588, -653909, 1227824, -2118493, 4934381, -944356, -15061377, 1638530, 1960653, -802622, + 1089311, 3976066, 11214696, -6487011, 306553, 10693395, 5733782, 4311611, -12158516, -14457397, + 18316962, 3779034, 2983392, -3766686, -7252589, 6655589, -2509335, 6807523, -3112778, -3052111, + 13557601, -2431488, 11769821, 10182831, -2404645, 3136937, -6780680, -2631204, -1497333, 619549, + 5429913, -4108673, -694174, -7041062, -6699075, -2685428, -3007551, 3946001, -601295, -4691715, + 5674726, -228170, -1451162, -3522947, 2887829, 2696703, -2760590, 2583423, 511101, 1883343, + 1471026, -2450816, 1093606, 3110093, -3798899, 6668474, -974421, -4745939, -2971044, -3667365, + 1907502, 2051384, -1433445, 2808372, -1146756, 459562, -51003, -86436, 3533684, 2625299, + 1218160, -2270427, -1187022, -159451, 594853, -966368, -3115462, 118648, 223338, -628139, + -195958, 1164473, -573378, 819802, -587337, -920734, + }, + { + -30129196, -53483616, 13333726, 10559177, -3550327, -30193620, -22956064, 17655536, -1333051, -8348880, + 7482370, -7655243, -10370735, -2076080, -8996346, 882616, -4734128, 8245264, -24374476, 6576132, + 2999498, 20433844, -1551557, -5118528, 11155104, 12818867, 2993592, -5609764, 7940858, -5906, + 12321187, 2704219, -19777788, -4720169, 1491964, -10280541, -2513630, 5050345, -3042984, 8853538, + -10515154, -4402342, 5931350, -7332046, 1815161, 1630477, 2666101, 1748589, -2577517, -7559143, + 2688650, -5456756, -791885, -418222, -1008244, -4810900, 3157338, -751619, -2480344, 3577171, + 2192044, -1173600, -2598455, 1413581, 3664681, -1083406, -1597728, 433255, 1870995, -606664, + 1767916, 927713, -1035087, -1708860, 2313377, -586263, 2042794, -432181, 3279745, 2086817, + 282931, -1234266, -1815161, -459562, -236760, 3725347, 255551, 377420, -816581, 1678259, + 1648731, 1294933, 1540283, -279710, 2125472, -1917166, + }, + { + -1378148, 35585952, 9329206, -2477659, -7431904, -1822677, 2449205, -5798743, 5631239, -3713536, + 7836705, 935766, -6690486, -146566, -24700356, 10259603, -7474854, -5824513, -23606214, -5279052, + 13522705, -1481764, -29530048, 249108, -19606526, -4423817, -4300873, -3197066, -20722144, 1272384, + 3741454, -7715372, -301185, 4884452, 5044439, 1242319, 9722195, -10970957, 3368328, 5098663, + 1214402, -2333778, 7213935, 6955163, -631360, 2769717, 2716030, -1353989, 5487895, 2318209, + 463856, 2694555, 122407, -2303176, -2696703, -803696, 1083942, -5687611, -608275, 346819, + -924492, -900869, -689342, -3486440, 1507534, -799938, -1766842, -514322, 315680, 133681, + 129923, 2673617, -192200, -1165547, -1744294, -1276142, -824097, -183610, 78920, -3471944, + -1794760, -2655364, 1618129, 1168768, -1100585, -915902, 207232, 539555, -921271, 1560147, + 3048353, -264677, -558883, 2274185, 862215, -1818382, + }, + { + -30115774, -39227548, 9716290, -6963216, 9820980, 14663018, 13598403, -1119913, -4022774, 14628659, + -10413685, 5079336, 2157684, -13672492, -10033044, -7996692, -8030515, 13836774, -9969693, 15684684, + -1008780, 11241003, -8702677, -8571144, 10508711, 5032628, -2841658, 827318, -3992172, 14533096, + -8886824, -6359773, 236223, 7067369, -10205379, 7333120, -1439351, -1750199, 6081674, -310311, + 5271536, -5626407, 4638028, 2125472, 3510062, -4034048, 11108933, -2248952, -853088, 2059974, + -5347235, -5327907, -1152662, 2006824, -4256313, -4545149, -1928977, 2640868, 422517, -2184528, + -1446330, 823023, 2879239, 1233193, -4173098, -1683090, -2265595, -1642825, -4880694, 2510409, + 361314, 1191853, 4998268, 2765422, 752156, -1890859, -1114007, 2641405, -1957968, 1168768, + -1342177, -565862, -1785633, 2522757, -1225676, 92879, 1734630, 1498407, -1716376, -47782, + 2008434, -941672, 1224066, 364535, 1649804, 898185, + }, + { + 4200478, -47586628, -6882685, -2554432, -5771363, -17179332, -1935957, 2712272, -2758443, -12348, + -5337034, 1717450, 1287417, 54246512, 7959648, 11950210, 20333986, -142808, -1582696, 5147519, + -12031814, 17283486, -10193031, 6125697, 2426657, 7530152, -17868138, 10364830, -6932614, 10264972, + -2229088, 13626857, -2719788, 5711233, 134755, -879931, -13034152, 198105, 11771432, 2551211, + 5340255, -3335042, 2521146, 314606, -2976412, 10147934, -8562017, -8730058, 4091493, -1974074, + 10275709, 534723, 2384244, 635118, 2286533, -446140, 2340220, 2450279, -5221070, -1382443, + 3414499, -1510218, -544387, 2790655, 3199751, -2876554, 1029182, -3371549, -1782411, -901943, + -478352, -1460289, 973347, -1644973, 41876, -112206, 1176284, 3380139, 3649649, 1454920, + -2350958, -1925219, -16643, -483184, 890669, 1641751, -443992, -1384590, 2779381, -318901, + -857383, -1102733, -328565, 2688650, -852551, -685584, + }, + { + -22277996, 23413478, 14759655, 5392869, 6620155, 8460549, -180926, -15411953, -15598247, -19437412, + 15790984, -14110578, -26650272, -26574036, 30866320, 644245, -3096672, 19873888, -1516124, -10486163, + 12496207, 22672058, 8191040, -1926830, 3962644, 5593658, 13588740, 1056562, -13026636, 2532957, + -13870597, -7551626, 1383516, 6438693, -6496675, -2029372, 1187559, -667331, 10353556, -4626754, + -6120866, -9208410, 11107859, -1540820, 6586869, 7886634, 4220342, -7508677, 2503429, -296353, + 3666828, 3211025, 1862942, 158377, -1359357, 663572, 367220, 1262184, 8158827, 362925, + 222801, 977105, 4137127, 4742718, -617938, 8191040, 3274913, -3139084, -289910, 4020090, + -3373697, -826244, 794032, 4053376, -3202972, 953483, -694174, 1330903, 372588, -83215, + -48318, 1914482, -104153, 1458678, -622770, 78920, -731755, 1463510, -1058173, -1373853, + 2541547, 943819, 38655, 450435, -1349157, 654983, + }, + }, + { + { + 368293, -14049912, -23935852, -15277199, -1277216, 2229625, 3992172, 2429878, 1889249, -19530826, + -4578435, -20098300, -4884989, 2093260, 16007343, 17741974, 3758097, -9982041, 15730855, 23587424, + 2201171, -19772956, 4832, -7012071, 901406, 1356673, -346819, 1346472, -7612293, 13498008, + 18544596, -646393, 10183904, -7604777, 4244502, -111132, 10611790, -8419747, -960462, 4831302, + -3567507, -3062849, -847182, -7655779, -5523865, -8985608, 4886599, 4468914, -5173288, 1540820, + -2496987, -4954245, -1525787, -6456947, 1767916, 3218004, 1435056, 2808909, -6007049, 4975720, + -653372, -2975876, 3753802, 962073, -1042603, -563714, 2816425, 1183800, -3321620, 3751117, + -485331, -2818572, 1296006, 1303523, -30602, 3200288, -861141, 1713692, -514322, 105227, + 2295660, -543850, 696858, 1060857, 1324997, 1228898, 887448, 1651415, 31139, -370441, + -2372433, 228707, 1669669, 1744294, 892816, 417149, + }, + { + -26496726, -89033600, 73549168, -29027000, 29718490, 3155727, 8319889, 4122632, 1604707, -3691525, + 30411590, -27229018, 9680856, -3656091, -10581726, -9490804, 2974802, 9876814, 17963164, 1203665, + 9048422, -6017249, 157303, -3338263, 13165685, 951335, -5944772, -4728759, 7128035, 1365263, + 11317239, -6385006, 7502234, -4174171, -4191351, -10086731, 1540283, -2136209, 3132642, -490700, + -4152160, 9265318, -896574, -3225521, -3397856, 6616397, 3805878, 1508070, -3541201, 1315871, + 6113349, 4555350, 4321274, 7566122, -2799245, -4540318, -1684164, -928787, 3007014, 106837, + -3602941, 1659468, -7144678, -402116, 1648194, 659278, 294742, 2387465, -4832, 2849711, + -1463510, -3758, -1721745, -686121, 2203318, -137976, -816044, -1358820, -1744294, -1206886, + -167504, 1056562, -420370, -884763, 711891, -76773, -50466, -852014, 70867, -362388, + 395137, 2147, -1079647, 1206886, -420370, 59593, + }, + { + -1360968, 155808528, 5900748, 22009024, -3821447, 6851010, -240518, -6885370, -3624416, -19861002, + 9264781, 19590956, -7131793, 3219615, 7566122, -5296769, 798864, -2970507, 5126044, 8167954, + 124017, 1927367, 5930813, 1474248, 10875394, -5962489, 308701, -7488813, 1226213, -2651606, + 4141959, -989990, -3911105, -9788230, 1298691, -838592, -2997887, 2067490, 7945690, 3018288, + 1196685, 1815161, 54224, -6657200, -3472481, 2520609, -7227893, 656593, 5334887, 562641, + 4319664, -1420560, 3817152, -1664300, 3927748, -2153926, 3097208, 409633, 6871411, 321049, + -2789045, -1163399, -454193, -334471, 566936, 2382096, 1657857, 2464774, -4597763, -774168, + -893890, -600759, -1588601, -1596117, 1839857, 319438, -1504849, -1488206, 1658394, 1565516, + 785442, 2509872, 1654636, 824634, 585726, -920734, 131533, -88584, 920734, -240518, + -397284, -626528, 124017, 752156, 222265, -593242, + }, + { + -1568200, 24109798, 6635188, 7987029, -3657702, 1408749, 2042794, 3467649, -3478387, 1121523, + -3139621, 848793, -7162932, 2697776, 23969138, 11443403, 4735739, -419296, 31921808, 5922760, + -2428267, 1240172, 665720, 3769371, -11578695, -12748537, -15417322, -1161252, -6096706, 4753455, + -6959995, -10840497, 806380, -12264816, 1474248, 474594, 17218524, -10111427, -3920768, 1476932, + 6571300, -1326608, -2407329, 8697846, 5184026, -1739462, 4031364, -1025423, -2163053, -2713346, + 4851166, -2952790, 2389613, -2699387, -1686312, -1335735, -1393180, 95563, -1655710, 1139777, + -587337, -710280, 259309, -1310502, -3752191, -273267, 1005022, 134218, -3563749, -1993402, + 479426, -702764, -1663763, -2879776, 1425929, -2137820, -880468, -1337882, -1145146, -744103, + 477815, 1382980, 2292439, -599148, 60130, -437013, 81068, -202400, -259309, 1106491, + -929324, 249645, 60666, -606127, 818191, -1292248, + }, + { + 18760954, 116616416, -26292716, -57276612, 4609037, 3393561, 3040837, -16061567, -40802, -22301618, + -8550206, -11847667, 5873368, 2134599, -11968463, 11945915, 17096118, -21350820, 9169218, 16268799, + -8743480, 14772540, -12635257, 11439109, 2257005, 3338800, 14827838, 14142254, 1482301, 224412, + 8748312, -1947768, -1043140, -5268315, -4241817, 3633542, 308701, 2637110, -1527935, -3833795, + 6308233, 2826625, 6356015, -454730, 97711, 1928977, -2483565, 2066416, -1114544, 8429410, + 150861, -6419366, 1134408, 4942971, 6357089, -4851703, 1549946, -147640, 2943126, -4207458, + 2696166, 804770, 4977867, 2314451, -4666482, 2054605, -2477659, -1630477, 1431835, -1843078, + 1050120, 934155, -171799, 1097901, -2177549, 798327, 1257889, 591632, -696858, -238371, + -4024921, 90731, 1601486, 27917, -213138, 52076, -993748, 773094, 638876, -487479, + -601295, 591095, -418759, 449898, 862752, 975494, + }, + { + 1599875, 11694122, 7375533, -869731, -2531346, -1065689, -715649, 899259, 5192079, -1011465, + -1547799, -2612414, 118648, 5925445, -26281978, 7379291, -2476586, 7650948, -13424457, 38170448, + -5730560, 9463424, -1553168, 16761647, -8966281, -12920335, -102542, -3548180, 835371, 22681722, + -2288144, -5864778, -8797167, -4104915, 2763812, 3299609, 551903, 2408403, 3729642, -2561411, + 3789235, 7264937, 3859565, 1219771, 5739150, -3878356, 5299990, -8056285, -7415261, -5753109, + 3794604, 2501819, 6169721, -2220498, -699543, -2208150, 556198, 2643552, -3990562, 250719, + 1229434, 2587181, 1658931, -168577, 748398, -217433, 5929739, -874026, -3772055, 720481, + -1633161, -2343442, -1700270, -2670396, -179852, 2399276, 1627793, -1218697, 1619740, 923955, + -915365, -1138166, 1738388, -670015, -1093606, -1136019, 1482838, -1395864, -871342, -184147, + 212601, 188979, -917512, 865973, 1080184, 645856, + }, + { + 41991360, 106954888, -31540092, -32507534, 3779571, -1454920, -4519380, 3036005, 18194018, -2157147, + 999117, 8457327, -3985730, -6645388, -11933567, -368293, 6068789, -12946105, 15323906, -5437429, + -5439576, -3870839, -9038222, -16061567, 14436996, 1730335, -3757023, -6242735, 3374771, 3818763, + -117038, -2466385, -4610111, -7168838, 311385, -2227478, 3488587, 5978595, 1894618, 763967, + 3100967, -278099, 3041374, -3221762, 5323612, 2193655, 4974109, -2880849, 2725157, -1675037, + -220654, -4412005, 4782446, 124554, -2242510, 2859911, 7659001, 228170, -6307697, 270583, + -300648, -498753, 1498944, -1349694, -149250, -688269, -90194, 1935957, 520228, -802622, + -1535988, -244813, 274341, -1011465, -98247, -1231582, -1115618, -11274, -475131, -241055, + 594316, 535797, -1324997, 60666, 780073, -1268089, -989990, -343597, 1384053, 1552094, + -515933, 263604, 1694902, 419833, 571768, 202400, + }, + { + 1736241, 9714142, 3124589, 108985, 2384244, 861678, -377420, 2411624, -4793184, -712965, + 71941, -2586107, -2367064, -1850057, -9483825, -1823751, -25882010, -21932788, -5744519, 12840878, + -11076721, -3011846, 9443559, 8269960, -4308926, 12432320, 6436546, -11148124, 7472170, -7987029, + -9883257, 8927626, -8338679, 8332237, 765041, 202937, 4502737, -2269890, -7794829, -5089536, + 2359011, -774168, -3223910, 7032472, -683437, 1381906, -1546725, 556735, 6046240, -4307852, + 588947, 7088307, 5112622, -5028870, -2915746, -7862475, -830002, 1399086, 2770791, -1585380, + 4708358, -1860795, 1837709, 667331, -416612, 578747, 3235184, -4796405, -958851, 2470680, + -214748, -1047435, 2937758, -330176, -1722282, -241592, -44560, 234076, 809601, -2017561, + -1447941, -2598992, 1324461, 202937, -742493, -1197759, -479963, 1736241, 231928, 577136, + 1914482, -105764, 1571958, -274341, -799401, -1023813, + }, + { + -3375308, 355566368, -24724516, -39154532, 17875118, 26844, 24898462, 10633265, 12715251, -6997576, + -10895795, 5532992, 13044889, 13384729, 9292162, -8063801, 21888764, 7200513, -5818607, -15216532, + -4167192, -7398081, -5878737, -474594, -7579007, -1215476, 29528, 11354283, -6646999, -1941325, + -5029944, 1538135, -4207458, -6878390, 3748433, -3790309, 3454764, 9848360, -4550518, -1324997, + -2586644, 5418638, 7406671, 3750043, 853625, -10285910, -515396, 9159555, 2783139, 1239635, + -3384434, 7106024, 1153736, 2939368, 1100585, 8269960, -951872, -21475, -1462973, -4381941, + 774705, 579284, 5012764, 1535451, -1858647, 2080375, -2259153, 1141924, 1234803, -1117228, + 397821, 348966, -2568391, -49392, -1211181, -547608, -2101850, 338229, 811749, 465467, + 176094, 1049583, 425202, 821949, 398895, -288300, -966368, 754304, 2218351, 1136556, + -30602, 1213328, 1679869, 1822140, -2228014, -109522, + }, + { + 4533338, 17812840, -23677080, -8805220, 13264470, -9164923, -9994389, -3302830, 5378373, -1181116, + 9902584, 481036, 8975945, -8231305, 11252277, 8185671, 6407555, -1745904, -9553618, 1582159, + 1224066, 6521908, -10246181, 4912369, 1469953, -6664179, -3263102, 10048076, 9027484, -8783208, + 12407624, -3006477, 17167522, 944893, 3905736, -2367601, -1753957, -1796370, 490163, -3306051, + 2210298, 1931662, -7025493, -2104534, -1066763, -3781182, -8938364, 2208687, -2059974, 2043331, + 3042984, -170188, -1828046, 2639794, 1894081, 819802, -586263, -496069, -260919, 1367410, + 5534066, -1829119, 118648, -2091112, 2179696, 3264175, -1492501, -3436511, -60130, -4686346, + 879395, 1677185, 1500554, -193274, 651224, -55298, -566936, -588947, 3640522, 3137474, + -652835, -1834488, -1278290, 2114198, -1168231, -1911797, -1625108, -290984, 986232, -2097555, + 1562294, -168041, 338229, 29528, -870268, -181462, + }, + { + 32030256, -93479960, -34876208, 17664126, 150861, -49932216, -12070469, 6490770, 2964064, -263067, + 1038845, -2549063, -10698227, -11667279, -7234336, -6118718, -9375914, 9815074, -21859236, 5346698, + 9307194, 10839424, -4532801, 2639794, 8501351, 8693551, 8141111, -5463736, 4567698, 304406, + 7886097, 4725538, -15149423, -13874892, -1214939, -5079336, -170725, 6004901, 3416110, 1167694, + -10437844, -507343, 3426310, -833761, 3751117, -6812355, 9241696, -4261145, -1602023, -5578626, + 693637, -5189931, -649614, -1499481, 1218160, -3645890, 1998770, -3836480, 1612223, 2224793, + -20401, 150861, -2612414, 5754183, 1712618, -1496796, -2537252, 3204046, -890669, 3154117, + 1960116, -2338610, -1162326, 39728, 1198296, 443992, 879931, 830002, 1844152, 3003793, + 48855, -466004, -1588601, -900869, 709743, 2226941, 1069984, 56371, 528818, 702227, + 2047089, 1556389, 1597191, 86436, -333397, -562104, + }, + { + -98247, 48474076, -5539971, 2511482, -8504572, -1909113, -4010963, -415001, 2780455, -6764037, + 11035918, 3235721, 2969433, -28533078, 991064, 8706972, -7526394, -4847408, -29956860, 11497091, + 1547262, -22857280, -16891570, -3954591, -7612293, -3111167, -8570070, -3051038, -6612102, -18925236, + 9168681, -7898982, 524523, 1145683, 15025406, -1449015, -1577327, -6780680, 8256538, 1125818, + 5247377, -3001645, 5410048, 1084479, 4480188, -103079, 5157182, -6352794, 5149129, 6965363, + 6055367, -687195, 2714419, -5007395, -2522757, -1501091, -296890, -326418, -4697084, -1047435, + -4832, -1767916, -2223183, 5166309, -877784, -5170067, -372588, -1583769, -616328, 3331821, + -2459406, -154082, 376347, -1352915, -921807, -235149, -1430224, 1244467, -427886, -2250026, + -3542811, -205622, -737124, 2641942, -2654827, 1630477, -699543, -1051730, 1415192, 1319092, + 1654636, -59593, -2528125, 4111358, -369367, -1073205, + }, + { + 19073950, -100168304, 11385958, -3135326, 7845832, 22010096, 11546483, -6055904, 2572149, -9468255, + 1956358, 10952703, -6523519, -11389180, -22137336, -3098819, -22262426, 10986526, 7870528, 3237869, + 2605435, 818728, 4122632, -1388348, 3644280, 749472, -3089155, -2099165, 9607842, 7548405, + -10893648, -5483063, 3937411, -1281511, 2381559, 874026, -1511292, 6622303, -2821794, 5272609, + 4858145, -2479807, 5994701, 2563022, 1306744, 1337346, 2201708, 568546, -1283122, 3890704, + -7165079, -972273, -3886409, -5909338, 4199941, -4614943, -2607582, 4578435, -3506304, -634045, + -2938295, 3430068, -148713, 3623342, 16106, -762894, -3478924, -2602213, -3920232, 4080756, + -2674691, 2964601, 1679869, 2333241, 2731599, -1721745, 90194, -28991, -1875290, 2168959, + -3332358, 572841, -1095217, -172336, 497679, -66035, 1528472, 1161789, -2426657, 2305324, + -4295, 21475, 714575, 852551, 857920, -551903, + }, + { + -4978941, -46925204, 3997004, -2645163, -8931921, -16473884, -8883603, 5515275, 399969, 1595580, + -12219719, 8581345, 3915937, -17544942, 123628488, 7120519, 5487358, 1074279, 27354646, -32851668, + 4976794, 11405286, -14387604, 8729521, 14305462, -11622718, -1485522, 3432216, -6247030, 13741748, + 7373385, 8145943, -5735392, -279173, 6726456, -9125195, -2516314, -9130564, 11105712, 9529996, + -2246805, 1796370, -378494, 1777043, -2523293, 7432978, -2355253, -6096169, -2163590, 432718, + 2259690, 7412577, -1782948, -39728, 2851322, 547071, 3476776, -1329829, -781684, -471910, + 1891396, -209917, -325881, 2941516, 1177358, 1829119, -6590628, -1980517, -419833, 1697586, + -1624035, -1001801, -2887829, -1823751, 1754494, 79994, 2769717, -700080, 5823976, 1312649, + -1590212, -113817, -1698123, -471910, -258235, 3215320, -84826, -1946157, 2496987, 311922, + -2523293, -864362, 1697049, 524523, -106837, -381715, + }, + { + 26540214, -15953119, -7898445, 9779104, -951335, 17170206, -10010495, -16900160, -11344619, -3277060, + -7234873, -17721036, -6807523, 12345347, -28626494, -15130096, 14487998, 13101798, -3232500, 4278861, + 5338108, 14449344, 5788542, 8424578, 3130494, 5974300, 6453189, -16029355, 9336722, -3980898, + -11719892, -11833709, -198642, -5988258, 1156420, 3732864, 4316442, -4955319, 690953, 8783208, + -6551973, -8345122, 4244502, 1056562, 5267241, 10425496, -1547799, 1785096, -341450, 1954747, + 2021856, 7332046, -1478543, 5851893, -4597226, 1060857, 878858, 457414, 5928129, 2728915, + -716186, -657667, 6364068, 683437, 4556424, 5008469, 4754529, -403727, -3798362, -1302986, + 3177739, -1649268, 565325, 1152662, -2717104, 473520, 619549, 1312649, 174483, 545998, + -388158, -206158, 2175938, 114354, 369367, -337692, -1199907, 2062121, -22012, -900869, + 1051193, 1495186, -1169842, -309775, 431107, -590558, + }, + }, + { + { + -637803, 40569724, 16386374, -18139258, -1770063, 3449396, 1494112, -3114388, 3754875, -29995514, + -20688858, 1269700, 11150809, -20604032, -7275675, 10507637, -5566278, -10549513, 24464670, 12707198, + 6455336, 999117, 17194364, -3349538, -449898, 9689983, -5613523, -1700807, -10985453, 4593468, + 6177774, -10060961, 4760435, -16337519, 7145752, 14052059, 19247896, -5653251, -857383, 2559801, + -310311, -1040456, 877247, -3876745, 8044474, 5501853, 3331284, -4332549, -8668318, 2477123, + 1492501, -3281892, 1205812, -1735704, 4333085, 3248069, -3925063, 1375463, -4503810, 4843650, + 2119566, -1912334, 2005750, -1650878, -4054449, -3164854, -2493229, -3062849, -2369748, 5901822, + -129923, -4772246, -1542430, -2266132, -3427384, 458488, -1579474, 1192927, -561030, -1837709, + 2295123, -470299, -343061, 1677185, 2100239, 366146, -993748, -492311, -692027, 132070, + -1607928, 859530, 935229, 285615, 1611, -601295, + }, + { + 25379498, -162592960, -33809444, -37413996, 19268298, -4780299, -1725503, -1378148, -1527935, -12283070, + 19219442, -19396610, 10536092, -1368484, -12368432, -16702591, 1801739, 4773856, 8517994, -2193118, + -490163, -11311870, 537, -1585380, 5109938, -7143068, -7458211, -6150930, 7297150, 3677029, + 3684545, -4774930, 7312182, -2484639, 3744138, -12138114, -7727720, -8609799, 4584341, 1832877, + -1824824, 9909026, 3819837, 6052683, 1294396, 6165426, -5590974, -3686156, -8619999, -6852084, + 4473746, 6027987, 2797098, 4350265, -4039417, -1734630, -458488, -1962800, -86973, 24159, + -2615635, 5424544, -3462281, -1845225, 511101, -553514, -3766150, 482647, 1387274, 2243047, + -1954210, -54224, -2037425, -2614025, 22549, -166967, 290984, -185220, -34360, 108985, + 933082, -32212, -194884, 1967632, 2030983, 833761, 1455994, 540092, -49929, -762357, + -421444, -324270, -240518, 1683627, -753767, 46171, + }, + { + 3485366, 118116968, -28417652, 22576496, -1016834, 2081985, -449898, 9308805, 11151883, -13085155, + 8007967, 17381196, -12420509, 13518410, 20236812, 3923990, 12419435, -10021769, -7902203, 2013266, + -11993159, -10766946, 9938554, 8884140, -1806034, -12413529, 1803349, -2246805, 8418673, 3628711, + 1588064, 462783, 2192581, -12336220, -3901441, 5206574, -752156, -722628, 5840619, 1632625, + 6652368, 5099737, -1760400, -3769371, -1823751, 336618, -2593087, 1065689, -497142, 1786706, + 5410048, 3032247, 4563940, -4680978, 3260954, 213675, 3078418, -1016297, 5429913, 1668595, + -3187940, 54761, 578747, -70330, 3098282, 2129767, -2713346, 2245731, -2666638, -1459752, + -2110977, 710280, 1568200, 61203, 1058710, 223875, 2315524, 685584, 40265, 646393, + 451508, 8590, 563714, 1857037, -46171, -1778653, 991601, 398358, 66035, -262530, + 598611, -615791, -278636, 1126355, 87510, -912681, + }, + { + 1765232, 16796006, -4440996, 5908265, -3138547, 1335198, 202937, 579284, -2873870, 624918, + -3886946, 7105487, -5765457, -5184026, 216359, -491237, 12024835, -2731599, 17401596, 6648073, + 11027865, -9789841, -8519068, 9147743, -3628711, -7743826, -13504988, 1625645, -1648194, -9112847, + -15178951, -7985955, -3022583, -9674951, -3256122, 2124935, 15205795, -11526618, -259846, 1582159, + 2482491, -4687957, -8091182, 1874753, 867583, -6782290, 1230508, -1286343, -1109712, -2491081, + 3322694, -1913408, 6538551, 113817, -4682588, -1154273, 291521, 2418604, 979789, 1229971, + 2786360, 2604898, 1341640, 694711, -1239635, 1941325, 4230006, 1107565, -2014877, 1214402, + 224949, -1149978, -159451, -2642479, 1879585, -294742, -6442, -184684, 602906, 936840, + 407485, -420907, 2092723, -1060857, 83215, -628676, 550830, -361314, -532039, 1358820, + -266825, 706522, 89121, -945430, 937377, -1959042, + }, + { + -37385544, 79473536, 9088151, -50122268, 4188130, 2990371, -1393180, -6028524, 4977330, -25198036, + 232465, 5590974, 12241194, -4282083, -12163884, 4068945, 5710159, -24489366, 4637491, 8236674, + -13699335, 8125005, -14289356, -4099010, -8108899, -8242579, 6752226, 13031468, -3044058, -5368709, + 5327370, -2291902, -1677722, -6587943, -603980, 2594160, -25567940, -9320079, 4642323, -7940321, + 5869073, 2481954, 11621645, -3182571, -595390, 1262720, -4068408, 2705830, -2270427, 6201396, + 1744294, -2829310, 3463354, 3432753, 6230924, -1948841, 1708323, -2774012, 4854387, -2960843, + 1823214, -1558536, 1116155, 2770791, -1595580, 1409286, -3342558, -1561758, -28991, -3361886, + 578210, 105764, -841277, 1086627, -2639258, 769336, 2099702, 1795833, -1130113, -55298, + -1184337, 278636, 502511, -291521, -1500554, -338229, -77309, 383326, -100395, 40802, + -222265, -159988, -771484, -236223, -963683, 636729, + }, + { + -182536, -4128001, 711891, -1401233, -2771865, -104153, -408559, 584652, 6105833, 1733556, + -3219615, -5218386, 1564442, -1830730, -39195872, 6696928, -18199924, -413391, -15273441, 35305168, + -1093069, 7355132, 2436320, 11614665, -17035988, -15269682, -12408697, -17272210, -12052215, 587874, + -3382824, 3416647, 5943161, 8510478, 405338, -514322, -4775467, 2586107, 9893457, 1457605, + -770947, -675921, -656056, 204548, 3506841, -3696893, 5391258, -7348152, -1180579, 82141, + 13422, -186831, 6744173, 526134, -559956, -2292439, -920734, -282931, -6123550, -1083406, + 2244121, 2065879, 595927, -1868311, 128849, -1701344, 1312649, -1129576, -1838246, 2479270, + 68719, -52613, 652835, -402116, -1197222, -154082, 1168768, -763967, 32212, -1264331, + 116501, 358093, 2493766, -73551, 1248762, 996969, 1355599, -1865090, -45097, 158377, + -66035, 113280, -105764, 968515, 479426, 190052, + }, + { + -64422360, 20347408, 17789754, -34879968, -7976291, -1183800, -2106145, 1301375, 7064148, -10376641, + -1266479, 29773250, 15324443, 8325794, -16003048, -8075613, 16240882, 4744865, 17450452, 4725001, + 2886218, -9592273, 2655364, -7201587, 13455059, -4076998, -6733972, -7821136, 8604430, 1423245, + -3059091, 6738267, -365609, -8462696, 3426847, 1097901, 3183645, 537945, 1460826, -2943663, + 2437931, 2780991, 3633542, -598074, 8443369, -1074279, -531502, -2786897, -273804, 264141, + 8258685, 2280091, 4922570, 824097, 1627256, 1466731, 4409858, 2100776, -4968204, 310311, + -344671, -2265059, 1027571, -2010582, -635118, -1473174, -549219, 1791001, 48318, -532576, + 75699, 727997, -25770, -297963, 671626, -4606353, -2457795, 395137, -948651, -1293322, + -46171, 227633, 133681, -803159, -1259499, -550830, 895501, 1228361, 1755031, 1341640, + 208306, 1033477, 1763621, -853625, 17180, -441308, + }, + { + -613643, -6563784, -2492692, -3087545, 44023, 1794223, 273267, 6185827, 2715493, -740345, + 1231582, -3642132, -7716983, 7037304, -12233141, 3867081, 3075197, 8007967, 16786342, 17892296, + -1955821, 21119964, 15207942, -13992467, -23362474, 1427540, -11002632, -12948790, 28886876, 7614440, + -11272142, 4988605, -10565083, 16682727, 7296613, -7316477, -1227824, 9106404, 2625836, -6248641, + 4252555, 6797860, -2624762, 2595771, -3371013, -6126234, -1218697, 324807, -337155, -3759707, + -645856, -1502702, -356482, -5544266, -2206003, -1446330, 2993592, 4355097, 6718940, -1088774, + 2738579, -2572149, 3600256, 1820529, 365072, 1788317, 2156074, -4055523, 1731409, 5138929, + 1225139, 756988, 4651450, 1853278, 238371, -471910, -222265, 1712618, 2039573, -1471026, + -300648, -2735357, 1374926, 796180, 197569, -346282, -1468879, -144418, 141197, 1029718, + 1678795, -1440425, 978179, -416075, -1025423, 311385, + }, + { + -25052544, 372542784, 22011170, -44379896, -5625871, -3543348, 9294309, -12797929, -3046206, 380105, + 540092, 5029407, 16205985, 12467753, 6872485, -9174050, 15533286, 374736, 12598213, -7123740, + -1384053, 3787624, -863288, 3522947, 826244, 2364380, -816581, 6614787, -8483097, 2463164, + 4151086, 5175973, -401043, 738734, 6260452, -1570884, 540092, 4343823, 3566970, 3658775, + -4012573, 5144297, 6462315, 569083, 785442, -7360500, -3405372, 2746095, -430570, 3100967, + -1897839, 5063767, -2327872, -907849, -2094870, 2427730, -4936528, 1488206, 399432, -3905199, + 659278, -3512747, 3173444, 3652333, -4423817, -790274, -2539936, 724239, -324270, -2442763, + 687732, 900869, -2789045, 1385664, 482647, -452045, -1789928, 1241782, 206695, 449898, + -557272, -204548, -1226213, 726386, 879931, 383863, 955630, 1571958, 653909, 201327, + 600759, 97174, -248034, 489626, -1484448, 1359894, + }, + { + -3349001, 43057584, 7294465, -15411416, -1020055, -2540473, 9465034, 1748052, 4659503, 1538135, + 11200201, -5164162, -5972689, -20557324, 4454955, 603980, -9177271, -5913096, 5760625, -755377, + -16836272, 3374234, -9038759, 13225278, 9013526, -4773320, -856309, 9936407, 13400835, -10009958, + 2518462, -1078037, 15864535, -6329708, 5927592, 1402307, 3651259, 4671851, 8076686, 6581501, + -220117, -111132, -1068910, 5442261, 9048959, 6138045, -2708514, 2927557, -2634963, 5935108, + 5880347, 1902671, 24696, 3243237, 957778, -1465121, -1880122, 1142998, 3732327, 2205466, + 6886980, -710817, 59593, -2592013, 1352915, 670552, 84826, 492848, 3622805, -1398012, + 2197950, 1684164, 967978, -1275605, -222801, -1207423, -1116692, 161598, 3641059, 859530, + -2669859, -3000572, -1150514, 1229434, -786516, -417686, -328565, -648003, 734976, -1392106, + 2397129, -20938, 235686, -331786, -498753, 169651, + }, + { + -33268816, -118295744, 2265059, 2148558, 1261647, -19334332, 15848429, 12715251, 3586835, 7621420, + -4808216, 5008469, 4385699, -10466835, -11232950, -4451734, -5093295, 2517925, -21910776, 4357781, + -2641405, 5099737, -2364916, -2492692, 4532264, -2228014, -279173, -12182675, -8455717, 2121177, + 8566849, 11724187, 817118, -1974611, 7289633, -987843, -2392297, 5105106, 8276402, 7422241, + -1921998, 3745212, 1455457, -4396436, -1603633, -11211475, 6608881, -6447283, 100395, -92879, + 3081639, -3151969, 3420942, 4342749, 5988258, -5906654, -363998, -1397475, 2017024, -759136, + -1607928, 1330366, 254477, 7664906, 784368, 517544, -753767, 1147830, -1999844, 2406792, + -570694, -1620813, 517544, 726923, 189515, 490700, 1961726, 964220, 530965, 408022, + -2276333, 583042, 520765, -334471, 342524, 310311, -149250, -147640, 1202054, 499290, + 351650, -228170, -578210, -964220, -1207423, -100932, + }, + { + 1236414, 56559352, -1621350, 1849520, -2146410, 3714073, -4209068, 622233, 5723581, -4380867, + 6422050, -2098629, 18620830, -9229885, 14618458, 11500312, -10039486, -1420560, -11342472, 16959216, + -9522479, -11707007, -10471130, -7846369, 2254858, -3872450, -2095944, 8589398, 7032472, -14181982, + 2985002, -8433705, 248034, -9981504, 447213, -9387188, -13051869, -4341675, 9599789, -4041564, + 501974, -4714264, 6087580, -272194, 1824287, -4090420, 657130, -5864241, 1602023, 5787469, + 7779797, -1537598, 3487514, -1787780, -428960, -4824859, -4271345, -1146756, -5099200, 1773822, + 4676683, -299574, -2773475, 4673998, -4266513, -5822365, 1472637, -1349157, 932008, 3583077, + -3664144, -1713692, -2183991, -3915400, 1021665, 3901441, -183610, 1730872, 2148021, 773631, + -600759, 360240, -2484102, 3958886, -1155346, 1781338, -938987, -2073396, 548145, 153008, + -261456, -291521, -2659122, 2007897, -1236951, 226560, + }, + { + 4893042, -121569584, 13982803, -5499706, -1433982, 7233799, 1343788, -9584220, -8675834, -27401354, + 7735773, 17297444, -3935801, -17603460, -13586592, 14293114, -26367342, 2895882, -438624, -6722161, + -5324149, -4647155, 11626476, -4923643, -7199976, -2075543, 5763846, 14237817, 10099079, -1336809, + -9491341, -1649268, 6206228, 1224603, 16337519, 11873974, 4377109, 5599027, -5627481, 13325673, + 12661564, 809064, -749472, -597537, 385473, 2568927, -2633889, -2277407, -3085934, 2772938, + -4943508, 4277251, -1499481, -6910066, 8753143, -2096481, -527207, 9198209, 90194, 4625143, + 157840, 3440806, -705448, 3579318, 402653, -399969, -828929, 1757715, -1282585, 5141076, + -2585570, -173409, -2736431, -1337882, 1111860, 763430, 1309428, -1125818, -3132105, 1987496, + -3302830, -76236, -821413, -1636919, 977642, 425739, 253940, 2056753, -743029, 1267552, + 16106, 1386201, -203474, -538482, 1165010, -365072, + }, + { + 4270808, -46721192, -5454072, 6059662, 4709432, -372052, 584652, 10612864, 13078175, 2612951, + -16551193, 5767604, 705985, -29270202, 101112120, 6651831, 10990284, -1118302, 34559456, -35822176, + -2192044, 20823612, -6861211, 9371082, 15634755, -10386305, 5639292, 259846, -14700599, 6417218, + 4822175, 2833068, -9938554, -7023882, 5486821, -9364639, 1909650, -7272990, -139050, -5163088, + -4873714, 4711579, -3449396, 3210488, -2962991, 3227668, 114354, 776852, -1733556, -4484483, + 1119913, 4991826, -2979634, -2860985, -470299, -2851322, 492848, 1509681, 3149285, -319975, + 490700, 1868848, 917512, -2063732, -270046, 2850248, -7472170, 128849, 3212636, 2879239, + -2003065, -3040300, -3019899, 755914, 1323387, -1384590, 317291, -5856725, 1690070, 856846, + 432718, 3776887, -275952, -1624571, -690416, 1533840, -1304596, -2114735, 1051193, 1425929, + -568009, -1330366, -671089, -1113470, -4295, 969589, + }, + { + -19438486, -74715248, -11500312, 20145544, 530965, 1404991, -8985072, -4010426, 591095, -691490, + 4017942, 4833449, 5346698, -16683800, -55771760, -126702, 6541235, 1640678, -7940321, -8366597, + -11805791, 296890, -742493, 5566815, -3425773, -7701950, -1986422, -16401943, 20337208, 1674500, + -7905424, -5421860, 763967, -16112033, 2145873, 9118752, 7032472, 1612223, 235686, 7595113, + 4984310, -7714835, -3250217, -1887101, -3622805, 1223529, -5187247, 7430294, 7388418, 1820529, + -2157684, 8165807, -2494839, 5200132, -5700496, -903554, -2169495, -4347581, 1426466, 1596117, + -3276523, -2349884, 1741609, -4174708, 4001836, 1219771, 1335735, 978179, -4242891, -4080219, + 4952098, 1585380, -1740536, -3700114, -1822677, -1398549, -1120987, 1898912, -1079111, 1384590, + 412317, -2610803, 680215, -67646, 970663, 340913, -884763, 1725503, 1059246, 898722, + 841277, 1500017, -1755031, -1629403, 1284195, 122943, + }, + }, + { + { + 1306207, 64990908, -7233262, -11133629, -1515050, 645319, 3863860, -8480950, -1098438, -18671296, + -17962090, 8133595, 3762391, -20178294, -913754, -90194, -1875290, -11754252, 24192478, -3282429, + 22509924, 16530792, 8617852, -7959648, -2485176, 17886928, -8189429, 254477, -7431367, -4440996, + -4767414, 5597416, -286152, -10458782, 2652142, 16199006, 10501195, -4351876, 4526359, 3828963, + 1016834, -3520800, -1159641, -1437740, 13999983, 4554813, 1436130, -4879620, -2961917, -870805, + 1357747, -621160, -5963025, 4502200, 2194192, -235686, -3286187, 2605972, 673773, -84826, + 2120640, 1470489, -1805497, -2314987, -2908767, -198642, -5586679, -2246268, -1207960, 1209033, + 1440962, -3221762, -1049046, -2774012, -1925756, -1155883, -781147, -250719, 2485712, -3216931, + 1163399, 1322850, -408559, 821949, 2425046, -991064, -905164, 179852, -1174137, -680215, + -416612, -20401, 972273, -636192, -264677, -460635, + }, + { + -24275692, -196462000, 34831648, -25601226, 3673271, 5316096, -11526618, -3203509, 2982855, 7374459, + -16295643, 5554467, -2437931, 2761664, -2091112, -41475964, 15844134, 11458436, -12722230, 13738527, + -5743445, 410169, -13560822, 5604396, -9440875, 6410776, -6731825, -2282238, 4213363, 3271155, + -2794950, 3397856, -4748623, 5676873, 4870493, -12327093, -12895102, -7526394, 4704063, 8361765, + 1799591, 7258495, 341450, 12359842, 440234, -1166084, -2533494, -10948945, -2047626, -4085588, + -1423245, 7662222, 573378, 2874944, 117038, -322123, -508954, -2631741, -5422933, 119722, + 1461363, 1895154, 660888, -2586107, -32212, -398358, -2756832, -534187, 4639639, -1751273, + -1314260, 369367, -96100, -3233574, -2848100, 3202972, -2027761, 822486, 569620, -15032, + 1296006, 142808, 90194, 1727651, 680752, 754304, 2336462, 949188, -268972, -251256, + -488016, -1338419, 732292, 1039919, -1040456, -124017, + }, + { + -5016522, 47702592, 37516540, 17787608, -1028108, 4547297, -3433290, 15423228, -1868848, 6796786, + 11705933, -1509681, -11843372, 14727443, 23875724, 8064338, 2638184, 1330366, -14046691, -10577431, + -3855807, -4281546, 1930588, 15110769, -9214315, 241592, -8290361, 11078868, -592706, 9383430, + -8520141, 8665097, -2312840, -13747653, -3946001, 3730716, -1635846, -801011, 8005819, 1473174, + 8979166, 3899830, -5084705, 1221918, -4758287, -3999688, 7721278, -2785286, -1868311, 3034395, + 57445, 7477538, 842350, -288837, -2175938, 2499134, 3823595, 742493, -1393717, 3511136, + 386547, -229781, -644245, 297963, 4554276, 51540, 585726, -2066416, -831076, -839129, + -2762201, 344134, 1521492, 1545115, -1741072, 1742146, 542777, 2470680, -476205, -23622, + 173946, -404801, 690416, 1135482, 783832, -941672, -345745, 1442035, 1068910, -974421, + 1305670, -1114544, -250182, 921807, -285078, -134218, + }, + { + -1809255, 7401303, 4627291, 1889786, 887985, 252329, 635655, -1528472, -1727651, -3144990, + -391379, 1016834, 7424388, -15554224, -11712376, 11433740, 12586402, -2911988, 8105140, 2254321, + 12048457, -11566884, 210453, -4097399, -5826123, -4902169, 5326297, -9794673, -3653944, -17481590, + -4010963, -2284923, -14444512, -791348, -3486977, 8083666, -9200357, -8054675, 12910135, -110059, + -3827890, 5659693, -11400454, 4173098, -5983963, -2079838, -4797479, 3186329, -995359, -4463008, + -811749, 3644280, 252866, 2581275, -4121558, 403190, -1362042, 2769180, 1353989, -1091459, + 3361886, 3429532, -366683, 2710661, -465467, 571768, 5171141, 1404454, -1993939, 1899986, + 145492, 348966, -2405182, -921271, 163209, 977105, 1259499, -2245731, 1266479, 833224, + -181999, 1813550, 991601, -1053341, 244813, -1756642, 1619740, -649614, -606664, 525060, + 130460, 996432, 640487, -209380, 68719, -1434519, + }, + { + 51761336, -5164162, -20363514, -35012036, -1324461, 2677375, -7271917, 2472828, -3840238, -7206955, + -20725902, 15507516, 5740224, 10219338, -1682554, -12091407, 3237332, -16980690, -5280663, 1607928, + 2436320, -9510668, 4778688, -18352396, 6888591, -9617506, -3382287, 2844342, 4606890, -1572495, + 6708739, -4627828, -2844879, -4005594, 1061931, -5343476, -32042066, 2767033, 5613523, -17507898, + 16179142, -3573413, 15323370, -8491150, 2350958, -1727114, -2811593, 243739, 877784, 7162395, + 636729, 3736085, 1211181, 803159, 5588826, -3660923, 1893544, -431644, 2878165, 2136209, + -2188286, -1784559, 782221, 1148367, 3304441, -250719, -2789045, -1816771, -945967, -1118839, + 1776506, -1609539, -886374, 1010928, -1261647, -867583, 2193655, -1058710, 1409286, 490700, + -939524, 537408, -93952, -689879, -1086090, -827318, 1633161, -179315, -661425, 396211, + 296353, -177704, -1060320, -878858, 451508, -410706, + }, + { + -1553168, 1129040, -1867237, 1110249, -4110284, 515396, -12348, 155693, 2940442, 1162862, + 1119913, -9854802, 3016141, -12217034, -31251256, 6316823, -13201656, -3626563, -6487548, 27311160, + -797790, -7894150, 8240969, 6941204, -17031156, -16815334, -1860795, -20524038, -8167954, -14566382, + -6861747, 9108015, 11082626, 12567611, -1919314, 5737003, -5689221, -4547297, 4087198, 4854924, + 4059281, -4483409, -3346853, 662499, 856846, 420370, -3075734, 2247342, 2065879, -1180579, + -1503239, 2499671, -2155000, 1779727, 356482, -1203128, -2400887, -2689187, -2412698, -821413, + 1078037, -807991, 1088774, -1086090, -53687, -1344325, 213675, 1736241, -3141769, -553514, + 5407364, -1074816, -1142461, 586800, 456877, -1735167, 736587, -1200980, -442382, -1537061, + 926639, 1101659, 1525250, 899259, 1061394, 1768453, -132607, -1214402, 515933, 535260, + -196495, -1097901, 1038845, 191663, 552977, -312459, + }, + { + 75001400, -117714320, -28039694, -25555056, -618475, -5217849, 5805722, 5846524, -15950435, 4763119, + -6824166, 38668128, 4368519, 11546483, -16813186, 255014, 5076652, 18013092, 2489471, 11684995, + -2776696, -11959336, 12768938, -739808, 4270271, -3427921, -1653026, -9934796, 11707007, -10537165, + 891743, 11644730, -3955128, -1230508, 5810554, 1178969, -3045669, 3950833, 1996086, -3140158, + 2273112, 2467996, 3026878, 1224603, 5965173, 3911105, -11291469, 5496485, -1433445, -1742146, + 4479651, 5110474, 4800163, -1360431, 3366181, 3674882, 471373, 3120831, -1157494, -2461553, + -465467, -5062693, 5813775, -3229279, 1263257, -231391, 1310502, -2051921, 590558, 1642288, + -301721, -207769, 726386, -483721, 188979, -4277788, -645319, -948114, -853088, -2039573, + -160524, -982474, 1452773, -1276679, -2748242, 686658, 2088428, 1370632, 554051, 1220308, + 1130650, 395137, 1446867, -2135136, 491237, -186294, + }, + { + -1436130, 1074816, -3661460, -3412352, -1875827, 1324461, 2126009, -1464584, 12989055, -2500208, + -2926483, 2572686, -9900436, 15443629, -25016574, 6084895, 3284039, 17936320, 15963857, 8286603, + 4219806, 28088550, 6010807, -18168248, -13711683, -11163157, -5868536, 4859219, 17632988, 5065914, + 8090108, -7659538, -8327942, 15879568, 2724620, 3164854, 104153, 6516539, 4124779, -2040646, + -721555, 856846, 3336116, -554051, 1050120, -7504382, 1851131, -6084895, -6896107, 457414, + 1483911, -1145146, -6149857, 1189169, -5748277, 3010235, 3135326, 3770981, 5142687, 2381559, + -1923072, 2455111, 1021129, -972273, 1040456, 1451699, 525060, -2401424, 3333968, 3860639, + 632434, 2313377, 2625299, 2311229, 562104, -318901, 42950, 1970853, 650688, 498216, + -610959, -1147293, 868120, -105764, 200790, -785442, 127238, -1364189, 1444183, 1658394, + -439160, -805843, 572304, -1360968, -633508, 1314797, + }, + { + 53469660, 326865280, -38589744, -22123914, -8777839, 30602, -3828963, -7624641, -847719, -4115653, + 2377801, -434329, 12147241, 5261872, 10375567, 4175245, 14394046, -8880382, 12502650, -6320045, + -3646964, 8236137, 5107253, 3616363, 2264522, 633508, -1626182, -1794223, -1634772, -3348464, + 12659953, 4318590, -6106370, 3089155, 5712307, -989453, -4070019, 5344550, 8728447, 1905355, + -186831, -1427003, 4413616, 4201015, -6172405, -1963337, 380105, -2659122, -4363687, 3584150, + 8229158, -3197603, -834297, -1355599, -3180960, -2137283, -1013075, 1513976, -1793149, -615791, + 316754, -2429341, -763967, 3073049, -5277441, -180389, 571231, -2724620, 192737, -73551, + 608275, -442382, -1666447, 361851, 1336272, -3392487, 660888, 2252710, -284542, 811749, + -1949378, 148713, -884763, 321049, -381178, 1163399, 1612760, 1256815, 877247, -1038308, + 871342, 134218, -520765, -705448, -493921, 1613834, + }, + { + 2250026, 68265824, -9475772, -12265353, -5353677, 11544872, -4465692, 10525354, -6201933, 3106335, + -648003, -2440078, -5298916, -12103218, -5786395, -8215199, -4924717, -3364033, 19765976, -19729470, + -28358058, 2623151, 2875481, 15231565, 3257196, -1586990, -17180, 7104413, 8150238, -3685082, + -10035191, 10714333, 6261526, -1959042, 5849746, -429497, 2750390, 12670690, -6339909, 8827768, + 756988, 3103114, 719407, 8946954, 8818642, -450972, 7053947, -2966749, 4288525, 6154688, + 907849, 895501, 6915971, -3075197, -574989, 598074, -1593433, -594853, 7001871, 1752884, + -76236, 2210298, 2777233, -1883343, 2122251, -2100239, 2896419, -548682, 2371359, 45634, + 4224637, 40802, -683974, -1362578, -516470, -801011, -312459, 508417, 1938104, -358630, + -1210107, -3460133, 418222, -1126355, 2088965, -1774895, 299574, -789200, -483184, 899796, + 609885, 605054, -261993, 729071, -335007, -661962, + }, + { + 34337728, -160682784, -30618822, -1815697, -13637058, 39375188, -1365800, 9269613, -4104378, 10758356, + -5429913, 11411728, -8435316, 12220793, -18758806, -700617, -1111323, -1889249, -12913893, 3400540, + -3943854, -6023155, 7151121, -5752572, 7480223, -7989713, -6529961, -3894999, -11931956, 5233418, + 8013872, 9016210, 328565, 4989142, 4282620, 1407676, -497679, 2750390, 4262755, 9620727, + 5298916, -3864934, 1085553, -6576669, -2054068, -9401683, 6386080, -3125126, -3102577, 3496640, + -16643, -1542967, 2247342, 7951058, -96637, -426812, -4213363, 2878702, 3439195, -5801427, + -1991254, 1284732, 2698313, 3701725, 278099, 3738769, -2340220, -195958, 11274, 1992865, + -799938, 292595, -1409823, 3434363, -1806034, 118648, 2245194, -1155883, 2028298, -554588, + -1294933, 414464, 788663, 99321, -406948, -132607, 257698, -259309, 1159641, 421981, + -648540, -359704, -1156420, -674847, -685047, -353798, + }, + { + -1953673, 50078244, 8783745, 1425929, 4249334, -3684008, -887985, 2876554, 1785633, -1731409, + 2025614, -3175055, 19359566, -19123878, 11986717, 2765422, -368293, 8675297, -3656628, 8039642, + -14620069, -4457639, 11201812, -6889665, -13537737, 937377, 4331475, -3806415, -3692061, 5190468, + -10552198, 5157719, -212601, -10983842, -3679176, -8558259, -11000485, 3604015, 105764, 1593970, + -8675834, -3138547, 8003135, 3253438, -4399657, 2218351, -7574712, 6221260, -707596, -1524713, + 5602248, 886911, 4767414, -3935264, 1174137, -4338454, -8449811, -2394444, -1618666, 712428, + 5191542, -608812, 731755, 543313, -4890894, -1556389, -1137630, -352187, 2952790, -1515050, + -852014, -2689187, -1435056, -2812130, 1999844, 1424319, 16106, 2267743, 2577517, 307627, + -175020, 966368, -455803, 1319629, 912681, 236223, -176631, -1375463, -115964, -369367, + -230318, -361851, -151398, -873489, -454193, 981937, + }, + { + -32824824, -83092048, 23138062, -6488622, 4769025, -15928423, -8107825, -4454955, 3969624, -28006408, + 13436268, 2216740, 3120831, -15382962, -17775796, 3342022, -348429, -5862631, -10201, 6190659, + -6842957, -7931194, 5054103, -1532230, -7841000, -728534, 1872069, 14492830, 11456825, -4003447, + -12625593, 8907225, 9196599, -7327751, 22841710, 13188771, 948651, 2815351, 719944, 6872485, + 12656732, 9820980, -6917582, 2650532, -13662828, 6886443, 208306, -2057289, -1956895, 421981, + 3881577, -1060857, -347892, -3263638, 2639794, 1586454, -159451, 6262599, 468688, 7816841, + -1089848, 192737, 2639794, 3020436, -1297080, 825707, 1040993, 471910, 2379412, 1387274, + -1531156, -919123, -1621887, -1040993, -195421, 715649, 904628, -891206, -1267015, 1032940, + -3530463, -99321, 752156, -879395, 470836, -332860, -75162, 80531, 2667175, -801011, + 1006096, 883690, 310848, -568546, 256087, 740345, + }, + { + -2896956, -57783952, 8497056, 7238094, 7937637, 979789, 8641474, 536871, 16644072, -2362232, + -10244034, 4759898, 6960532, 51163260, -29886530, 21922050, 9186935, -3951907, 20780662, 2159832, + -16935056, 16711718, -9378598, 13194676, 928250, 2993055, 14282377, -3828963, -14017163, 2049773, + 7299297, -4527970, -10873783, 755914, 1519882, 198105, -12328704, 2535641, -908922, -12117713, + 5708549, -6294275, 389231, 9062381, -2444373, -2496987, 1404454, 1189169, -4522601, -4774393, + 5985574, -1447941, 375810, -1342177, -3956202, -634581, -79457, 3502009, 2788508, -3232500, + 3955128, -1116692, 4005594, -5594195, 944356, -1938641, -911607, 658204, 1442035, 801011, + 1180042, -4671314, -978179, 138513, -872415, 1156957, -2830384, -1152125, -1738388, 1080721, + -703838, 2384781, 984084, -707596, -1124745, 666794, -1509144, -1481227, 1403917, 1170379, + 1550483, -1541893, -2777233, -447750, 161061, -145492, + }, + { + 1721745, -100196216, -15508590, 21564494, 1890323, -18955302, -4919885, 6191732, 358093, -5571110, + 23230404, -14869177, 11741367, -27239220, -40041444, 6016713, -280784, -1883880, -15580531, -4001299, + -6039798, -1807108, -5257040, 12150462, -2857227, -16561394, 6341519, -11394011, 11353209, -2593624, + 5596343, -2206003, -3293166, -16001974, -7368017, 19461034, 8885750, -3333968, 584116, 11751031, + 3212636, -9521406, -569620, -7354595, 3886946, -7297687, -1582159, 6206228, 11092827, -680752, + 161061, 7082401, -5286568, 2336999, -401579, -3855270, -6604049, 2636036, -1396401, 4332549, + -4029216, -4383551, -915902, -2066416, 3502009, -625992, -1346472, 1706176, 205085, -3208878, + -849867, 6331856, -2436320, -4798016, -1671279, -3812857, 1620813, 2507187, -3066607, 37581, + 2120103, -1247688, 933619, -259309, 376883, 940061, -188979, 2634963, -243203, 2261837, + 58519, 1445793, -979253, -2132988, 1005559, -189515, + }, + }, + { + { + -1210644, 46752868, -20779052, 639950, 8163659, 676457, 3803731, -4641249, 3484292, -608812, + 1802813, 9394167, 1464047, -7431904, 8646843, 3902515, 15457050, -11681774, 13657459, -865436, + 24962886, 11779485, -4469987, -19440096, -8778376, 15278272, 1447941, 4793184, -6731288, -11610370, + -382252, 21923124, 9693204, 4268661, 4749160, 5127654, -2348273, -2486786, 4833449, -631360, + -2615098, -4008278, 4080756, 581968, 6974490, -4519380, 2498060, 4956393, 2302639, -1181653, + -2188286, -1684164, -8254927, 1731946, -2456185, -1570347, -1406065, 2376191, 655519, -2906082, + 302795, 823560, -2848100, -2567854, -1532230, 44023, -1962800, 2517925, -21475, -1771674, + -578210, -1009317, 2223719, 1359357, 2353642, 663572, -375273, 1680406, 3824132, -2211371, + 1123134, 1785096, -1164473, -492848, 2010045, -68719, -933619, -1305133, -2277407, -1188632, + -676457, -1125281, 1008780, 65498, -493921, -354872, + }, + { + 21532818, -194490608, -14182519, -14918032, 9109089, 359167, -5612986, -95563, -273804, 20531018, + 4864051, 19319300, -6380711, 8419747, 10147934, -38210176, 3462818, 5342940, -7884486, 9664213, + -12244415, -6181532, -14037027, 5707475, -12633109, 12704513, 10618233, 6329708, 812823, 2958159, + 4281009, 6097780, -12734578, 7076496, 6457484, -8301635, -5652714, -5792837, 8420820, 11351062, + 1160178, 2187749, -12379169, 4332012, -3518115, -5677410, 1274532, -4969814, 4105989, 925565, + -2233383, -1046898, -5672578, -519691, -1790465, 2113661, -1383516, -4429722, -3057480, 2465311, + 1291711, -4290673, -2894271, 480499, 3416110, 262530, 1332514, 1963337, 3509525, -2168422, + 246424, 1784022, 3404299, 196495, -2626373, 1775432, -2333778, 2603287, 954557, -545461, + -306553, 613643, 840740, -278636, -1739462, -316754, 2121714, -15569, -432718, 1810329, + 1349157, -901406, 666794, 337692, -1472637, -333397, + }, + { + 5493800, -22468048, -20353850, 25109452, 2943663, 3087545, -5545340, 7326141, -7865696, 4587562, + 2849711, 885300, 3974992, 9725417, 12282533, -704912, -6235219, 6628745, -222265, -1584843, + 1959579, 10472204, 16026134, 27360552, -4036196, -2639794, -15149423, 6617471, -13469554, -2911988, + -15643345, -3435974, -11002632, -12611635, -2030446, 2912525, -3984119, -1156957, 9183177, -2164664, + 877784, 964220, -165356, 3567507, -5898601, -5057324, 7461969, -1034550, 367757, -122407, + -3442953, -157840, -4457103, -1336809, -3773666, 2791729, 3795141, -200253, -6078453, -610422, + 1263794, -863288, -1037235, 150324, 2048699, -3772055, 2253247, 1268089, 591095, -1436667, + -2598992, 367757, 250719, 576599, -2988760, 215285, -1627793, 326954, -2101313, -1622424, + -2319282, -2109366, 300111, 1119376, 2427730, 1129040, 53150, 1336809, 1835025, -260382, + 1058710, -287226, 148176, -340913, -754304, 144418, + }, + { + 2362769, -785442, -6316823, -4344360, -3702262, -611496, 551903, -3409667, -4183298, -4170413, + -3075197, 3673271, 17960480, -17770428, -2109366, 11314554, -14775224, -6276558, 12976707, -5095979, + -1359894, -8639864, 7670812, -10701985, -11141682, -3107409, 4740034, -17936320, 287226, -3656091, + 3100967, -11130945, -25866440, 59056, -2075006, 293668, -14421426, -9418326, 12602508, 2014877, + -3046206, 8046085, -6347962, 6345814, -4129074, 2535641, -6746857, -3716221, -1843615, 743566, + -4459250, 3180423, -1234266, 1594507, -899259, 1171989, -2609730, -24159, -1481227, -4291209, + 787053, -1013075, -1560147, 2625299, -2247342, 298500, 4183298, 1299765, -3662533, -766115, + 2626373, 2562485, -2253784, 853625, 480499, -798327, 184147, -2260764, 911070, 564788, + -435939, 831613, 278099, -668404, 846645, -441845, 1247688, -926639, -182536, 944893, + -370441, 700617, 670552, -814970, -21475, -678068, + }, + { + -57319024, -102291088, 30234960, -13923747, 4815732, -1133871, -7813083, 7924752, -10587631, -2769717, + -7617662, 22850300, 4514011, 9810779, 4245575, -7246147, -9121437, -11343009, 4708895, -1502702, + 9048959, -4333085, 10108206, -12442520, 16767015, -1017907, -3131568, -1785096, 3961034, 3918621, + 1096827, -7943005, 99321, -1734630, 4491999, -2951716, -10364830, 13263933, 875100, -21021180, + 9287330, -6751689, 11944841, -4490389, 7021735, -1753957, -3868155, 2944737, 475131, 3354370, + 1818382, 2139968, -1455457, 23622, 2586644, -5473399, 3532611, 2685428, 769336, 1992865, + 2684, 659278, 2185602, 2930242, 3150896, -2949569, -642635, 2415919, 1924145, 1495186, + 3692061, -1002338, -265214, -418222, -2214593, -1325534, 1001801, -701690, 2113124, 780073, + -899259, -61203, -38118, -1757179, -175020, 927176, 2173254, 855772, -185757, -406411, + 234076, 722091, -501437, 55298, 1738925, -805843, + }, + { + 716186, 9635222, 1097901, 6534793, -1042066, -148176, 459025, -2115808, -2227478, 1169305, + 4922570, -9825811, 1901060, -14788109, -23794656, 20093468, 4136054, 4781909, 2589329, 31607202, + -5364414, -25566330, -15263777, -6735583, -12144020, -10172630, 1412507, -5669894, 3733937, -3241090, + 1516124, 7735236, 5792301, 6864432, -3726958, 7222525, -4126927, -8541616, -6877854, 2414845, + 8092792, -6167036, -1929514, -3735548, -6343667, -1248762, -4087198, 5999533, 4053912, -4116189, + -5745593, -954557, -6002754, -1236414, -5413270, -3626026, 1108102, -1479616, 1457068, 930934, + -2297808, -2177012, -2301029, -3912178, -321049, -3546569, 287763, 2863670, -4672925, -2433636, + 8198019, 2017561, -851477, -643708, -1231582, -2817499, -1808718, -1540820, 326418, -445603, + 2097555, 1244467, 258235, 122407, -750546, 922881, 712965, -583579, 734976, 656056, + -492848, -1537061, 95026, -992674, -372052, -417686, + }, + { + -68744712, -252797488, 38546256, -1399086, 8726300, -993748, 716723, -5764920, -22761180, 15698105, + 5856188, 30105036, -14805289, 9028021, 1153736, -15569, -3738769, 3880503, -15934329, 14359149, + -894427, -10126459, 7291244, -3957812, 2448131, -4657892, -401579, -8267275, 12090870, -6877317, + -2710661, 6039261, -368830, -503048, 5308580, 9898289, -7937637, -5015985, 899259, 3797825, + 6003828, -1127429, 1250909, 1323924, 2276870, -1887638, -9225053, 5356361, -6860137, -2651069, + 995896, 7331509, 6183679, -4907000, -756988, 1963337, -563178, 1850594, -261456, -2509335, + 772020, -1358820, 7407745, -1551557, 6359236, 2911451, 2736968, -1668595, 274341, -492848, + -875636, 3200288, 1884954, -3032247, 642098, 193810, 874563, -2132451, 603443, -1248762, + -1598265, -374736, 25770, -2074469, -2002529, 1033477, 715112, -173409, 300648, 592706, + -71404, -1995549, -882616, -944356, 1868311, 1130650, + }, + { + 415001, 13813689, 2335925, 557272, -1781875, -70867, 1886028, -1007170, 18359912, -608812, + -3496640, 6411313, 1384053, 20735028, -14278619, 12952548, -19582904, 6779606, 3749507, 1867237, + 10223096, 9082245, -7854959, -13077102, -395137, 7914014, 13209172, 14302241, 4742718, -3843996, + 15701864, 1076963, 1588601, 8542153, -6940131, 6749004, -1024887, 2329483, 887985, -609349, + -678605, 1502702, 6677064, 268435, 4223564, -6599754, -3389266, -5272073, -6638946, -4174171, + -3153580, -382252, -3950833, 708133, -432181, 7763154, -85899, 323196, 1741072, -412854, + -2666101, -699006, -5167920, -3018288, -468688, -1430224, -1147293, -1804960, 842350, 1626182, + -2409477, -1449552, -819802, -823560, 1460289, 1311039, -304943, 2097018, 959925, 875636, + -680215, -133144, 1140314, -424665, -870805, -1307818, 219580, -709743, 1134408, 434865, + -275415, -115964, 724776, -1021129, -138513, 1624571, + }, + { + -74431248, 231840720, 41941428, 470836, -11559904, 1153199, -6778532, -3687766, 3862249, -11646341, + 7190849, 7068443, -1144609, -15648713, -5880884, -5432597, -1398549, -13311714, 7249368, -6152004, + 326418, 7970923, 6247030, 1441498, -2285996, -5690295, -7059316, -2207076, -4646081, -10125385, + 10555419, 3056943, -8830453, -227633, 1703491, 1200980, -1008244, 6826851, 1162862, -3492345, + 1566053, -4547297, -6385006, -1268626, -4677757, 2724620, 2665027, -5994164, -6286759, 2182380, + 6053220, -3558381, 1383516, -3600256, -1053341, 3649649, 1702418, 3738769, -810675, 199179, + 646393, 48318, -3778498, 38118, -3399467, 2614025, 4832375, -453656, 759672, -285078, + 222265, -273267, -2909840, -2244121, -29528, -2391223, 1981054, 2381559, -119722, 11274, + -1575179, 116501, 23085, 141734, -117575, 1017370, -583042, -332323, 1355062, -1057099, + -868120, -947040, -1003949, -1037772, 124017, 513785, + }, + { + -867583, 83098488, 15262166, 4265977, 1116692, 11622718, -16935592, 6979859, -3985193, -1593970, + -11595338, -7523709, -10285373, -21316460, -5418101, -7794829, 5201743, 14385993, -6161668, -42230264, + -19193672, 1910187, 4141422, 15918223, 943282, -4384088, -4111894, -9523016, -7786239, -10092099, + -9361955, 9962714, -2137283, -4727149, -224412, -2738579, -2836826, 2343442, -15937550, 8517994, + 736587, 2749853, 317828, 1748052, 2890513, -4614406, 6019397, -814970, 2658585, 1282585, + -2612414, -5156108, 6614787, -4788889, 278099, 2446521, -5036923, -7001871, 5125507, 4475356, + -916976, 2884608, 4042638, 825171, 6036040, 350577, -477278, -3047816, 2381023, -1938104, + 1460826, -992137, -1611, -988916, -2091649, 1151051, 2851858, 401043, 250182, -817118, + 922344, -1888712, -1072131, -2911988, 2624225, -66035, 982474, -1123671, -1601486, -184684, + -866510, 343597, -802622, 87510, 667331, -493921, + }, + { + -33950644, -168576400, 42582452, 2435247, -12315282, 34478924, -9296457, 4115653, -16880296, -4959614, + -3141232, 7010997, -17432198, 22843320, 2489471, 8208220, 49392, -4030827, -7059316, -128849, + -1960116, 3948149, 13862007, -7562901, 1758252, -8439611, -4700842, 6258841, -6832756, 110595, + 1490354, 3111167, -6240051, 1115618, 8011725, 12170327, 4931696, -1305670, -6798933, -2928631, + -3765076, -8696235, -369367, -6639483, 3442416, -7881802, 4453344, 3215320, 7821136, 7344394, + -4598300, -1757179, -2627983, 3740380, 1858647, 5618891, -39728, 155156, -1854889, -6851547, + -2201708, 217970, -377957, -1465658, -3422015, 1797981, -1255741, 1012002, 130460, -1671816, + -3676492, 2133525, 1398012, 3671123, -1582159, -403727, 1302449, -2822867, 1611, -22012, + 219043, -545998, -409096, -484258, -428423, 474594, -204011, -974958, 160524, 316754, + -1207960, -1352378, -598074, 1058173, 206695, -1254131, + }, + { + 2740726, 34637836, -10149545, -1537061, 3523484, -1335735, 2592550, 3867081, 2035278, -883690, + -9132711, -10225243, -855235, -56457344, -13087302, 14097693, 10632728, -1924145, -1632625, 10524280, + 4916127, 520765, 26088706, 4558034, -17991618, -1287953, -5191005, -8627516, -6548752, 918049, + -15624017, 19299436, 14155138, -8470212, 4904853, -109522, 2831457, 9279277, -2962991, 1174674, + -12702366, -3881040, 9552007, 4381404, -9201431, 7025493, 3070365, 9244380, -3279745, -8733279, + -1115081, -468688, 1996623, -11073499, -3304441, -1280437, -3091840, -499827, 1544578, 2835752, + 2949569, -942745, 274341, -3262565, -4477504, -889595, -1232656, 1864553, 4483409, -1009854, + 1468342, -1093606, -1823214, -1524713, 2868501, -2160906, -2446521, 775242, 1356673, 2544768, + 1326071, -192200, 956167, 561030, 8590, -471910, -462783, 405874, -255014, -367757, + 1017370, -223875, 989990, 226023, -491774, 933082, + }, + { + 51310364, 19949586, 5430450, -8579197, 21394842, -21339546, -19617264, -166430, 20892868, 4342749, + 15473157, -14366129, -5863704, -5686537, -11880953, 5637145, 7446400, -11598559, -3524558, 10310069, + -3104725, -11794517, -2029909, 3006477, 4052839, 4615479, -9139690, -5768141, 9070434, 13505525, + 512175, 11553462, 4988068, -14078903, 13515725, 9055939, 1339493, 4680441, -3392487, -1460289, + 10325638, 9655623, -5609764, 2185602, -13680545, 2186138, -867047, 5760088, 9301825, 4360466, + -24159, -5499169, 784368, -7005629, -4277788, 1270237, 1190243, 3899830, -1291711, 6249178, + -2005750, -2449742, -642098, 148713, -3394635, -629750, 1853278, 3157338, 1191317, -1094680, + -925029, 423054, 1256815, 408022, 175557, 1145683, 464393, -1243393, 869731, 2971044, + -1188095, 2072322, 1459752, 1315871, 288837, -561567, 1115618, -1052804, 781147, -799938, + 1559610, -47782, 1069984, 694711, 1198296, 500901, + }, + { + 2399276, -74737264, -8992588, -3009162, 1738388, 1595044, 6372121, -7050726, 6005438, 115964, + 170725, 7656853, -1676111, 5429913, -94449552, 6847252, 6699612, 8698383, 6928319, 24299314, + 1322313, 9691594, -4971962, 7573101, -2851322, 13827110, 17237314, 985695, -11973832, -11295764, + 3211562, 2043331, -8423505, 2032056, -3536906, 10888816, -1063541, 4086125, 2197950, -11673721, + 4627828, -5583995, 4938676, 10127533, -1132798, -544924, -3181497, -3101503, -3296388, -2167885, + 5177046, -2786897, 2665564, 2879239, 6979, 2396055, 2899640, 1240709, -2583423, -5106179, + 602369, -4784057, 2284923, -3977677, 2968896, 1607928, 2577517, -2446521, -2367064, -2212445, + 3245922, 2561948, 1918240, -680215, -109522, 1057099, -2159832, 1136019, -2254321, -1352378, + -3928821, 478889, 1126892, 2278480, 1578401, 401043, -464393, -782221, 667331, 1613297, + 3082713, -94489, -1782411, -301721, 153545, -932545, + }, + { + 20096152, -75528072, -17160542, 14903000, 4916127, -14965277, 2272038, 7503308, -13317620, -8846022, + 27218818, -21327734, 11148661, 5714991, -420907, -2239289, -24890946, -17994302, -20601884, -2297271, + -1288490, 10073309, 1152125, 10552735, 9072582, -6716792, 13870597, -1680406, 2577517, -3825205, + 12595528, 10562935, 4775467, -6713034, -9709310, 10412074, 10400800, -2678986, -615254, 8419210, + -3389266, -1141924, 6591701, -3262028, 9240622, -5154498, -3819300, 1009317, 11062762, 766115, + 1562831, 4937602, -5796059, -4011500, -4566624, 1802276, -3212099, 852014, -2106682, 4395899, + -2050847, -1066226, -1346472, -2121177, 1670205, -1653026, -2746632, -846109, 3500398, -14496, + -2353105, 5332202, -362925, 81068, 363998, -1583232, 2044941, 1799054, -2879239, -1325534, + 3664681, 892816, 652298, -420370, -1381369, -620623, 1642825, 2927020, -1756105, 955630, + 308701, 2284386, 391379, -312996, 1582159, -1467268, + }, + }, + { + { + 236223, 7364259, 6971806, 19210314, -6539625, -668404, 3463891, -1014149, -2634963, -4632659, + 24082956, -1079647, -2330557, 12123619, 11668352, 2680597, 8273718, -256624, -6596533, 2200634, + 22335978, 1647657, 266288, -21922586, 8074539, 6414534, 3102040, 2221035, -9390946, -17924510, + 7704098, 20653424, 5422396, 3329137, 5090610, 436476, 677531, -3304441, 5817533, 2003065, + -5127117, -5652714, 5088463, 6283537, -3092913, -9065602, 2870649, 9386114, -843424, 1118302, + -2621541, -3756486, -5408975, -1969243, -2025077, 2058900, 87510, 2074469, -8053, -2224793, + -2673080, -1211718, 2485712, -3066070, 111132, -3704946, 1610076, 2531883, -4070019, 1724429, + -1908039, 527207, -751619, 1557999, 4350265, 996969, -1479616, 3073049, 1084479, 2170569, + -1722282, 704375, -756988, 231391, 2084670, -402116, -409633, -1176821, -2367601, -528818, + -1321776, -500901, 217970, -372052, 390305, 404264, + }, + { + -15227270, -175850992, -4161823, -13951664, 14283451, -5034239, 2486249, 8057359, -6640557, 3309809, + 12217571, 22056268, 333934, 3017752, 7118909, -16005732, -20025286, 2937758, 7399155, -5690295, + 4863514, -9264244, -15047418, -13190918, 4265440, 4698158, 13965623, 6921877, 4165045, 2797634, + 5988258, -1507534, -2268817, 3124052, -8653822, 3265249, -2638721, -5748814, 12174085, 3277060, + 2512019, -2863133, -4728759, -5126044, -2155537, -4903242, 603980, -3018288, 1365263, 2571075, + 613107, -5989332, -3693135, -1334124, -830002, 5301064, -4456029, -2798171, -2491081, 1704565, + 3128884, -7318625, -1179505, 914828, 3476239, -689879, 3887482, 497142, -154619, 543313, + -672699, 3697967, 692564, 2158221, -785979, -443455, -1522566, 2330020, -230318, -653372, + -54224, 1981591, -350040, -1080721, -883690, 132070, 188442, 1067836, -286152, 2242510, + 406411, 71941, -433255, 17180, 362388, 115427, + }, + { + -4980015, -62272192, 16980690, 26952530, -1235877, -1427540, -1433445, -2122251, 2910377, 6384469, + 9065065, -13162464, 7394860, 10499048, 1269700, -1179505, -3107946, 13319230, -5228049, 7822209, + -10201, 8196408, 25147570, 11135240, 2340757, -1337882, -11734924, -3149822, -2210298, -4190814, + -8574365, -16166794, -11158862, -4141422, -3812320, -1826435, 1850594, -4736812, 3442953, 3314104, + -1171452, -932545, 1270774, 1966021, -7370164, -1482301, 3326452, -3721589, 3540664, -1665911, + 953483, -4199941, -2794413, -4588099, 1795833, -277562, -217433, 2914672, -4294431, -3739306, + 2145336, -2173254, 1635309, -2554969, -1279900, -330712, 1633161, 1227824, -222265, -2756295, + -93416, 991601, -830539, -32749, -516470, -1274532, -782221, -1938641, -2361158, -103079, + -1562294, -2525441, -121870, 1219234, 2539400, 1009317, 710280, 335544, 1385127, 803696, + -719407, 229781, 835371, -639413, -328028, -73014, + }, + { + -2663954, -630823, -2513630, -7968775, -322659, -120259, -750546, -551903, -3639985, -8114804, + -380641, 3197066, 12902619, -7050189, 20049982, 9286256, -43795780, 8312909, 17267916, 3382824, + -6019397, -7960185, 6149857, -15629923, -18489298, 17239998, -15148350, -10997801, 2303176, -12543452, + 18611704, -16101296, -23833848, -1335198, 4456566, -20876226, 2808909, -3711389, 1636919, 6467147, + -4367445, 8534100, -1838783, 2678986, -3212636, -3703336, 2354179, -6008123, -5246303, 6855305, + -2696703, 889058, -666257, -646929, 1771137, 675384, -4423817, -3476239, 3357054, -3805341, + 1769527, -6494528, 677531, 2292976, -308701, -863288, 3442953, 1711008, -3913789, -1376537, + 5184026, -832150, -824097, 1320166, 1248762, -1779190, -2037425, -527207, 604517, 178241, + -194347, 52076, 1345399, -658204, 1058710, 444529, -723702, 377420, -1194001, 1360968, + 292058, 310311, 119722, -159988, -738734, 248571, + }, + { + 51836496, -195390416, -15424838, 826781, -1534377, -3731253, -1592359, -574452, -3911642, -3827890, + -165356, 17077864, -3109556, 16252693, 5190468, -2560874, -16291885, -13247290, 9674414, 6095096, + -1271847, -2046015, 1692217, 7781944, 1128503, 11758547, -4573067, -3744675, 7108171, 1617055, + -3587908, -6322192, 2479270, 2544768, -7031935, -1001264, 21262236, 90194, -5222144, -14089640, + -295816, 282394, -2356863, 5091147, 4409858, -6498286, 2108829, 5706401, -5721434, 1930588, + 3588445, 3151432, -4870493, 478352, 1457068, -2271501, 3679713, 1011465, 142808, 1432909, + 1089848, 548145, 3144990, 1743220, 536871, 989990, 1006633, -1187559, 2215666, 2393371, + 4118874, -1133335, 1624571, -3346853, -1173063, 42413, -1741609, 1044751, 315143, 1404454, + -185757, -1598265, 1249299, -1566053, 631897, 1428077, 238371, 1116155, 501437, 41339, + -264141, 660888, -288300, 224412, 1165547, -374199, + }, + { + 798864, -1533303, 12468827, 505732, 1758789, -522912, 644245, -2051384, -6090801, 3374234, + 3958349, 619012, -3828427, 14903537, -24770150, -21427054, 33178622, -2392834, 1122060, 28798292, + 2888366, -15710990, -19075560, -9764071, -10799695, -2856153, -4806606, -1501628, -9227200, 21870510, + 5872294, 1531693, -5754183, -4772783, 7218230, 2245194, 2035815, -1784559, -7687992, 74088, + 7386270, 575526, -2823404, -8479876, -6014565, -802622, -4046396, 4038880, 79457, -4473746, + -4383551, -1430761, -5040144, -3444564, -2746632, -4845260, 179852, -1231582, 2353642, 2635499, + -2105608, -3912178, -1235877, -2803003, -854699, -3189013, 519691, 1655173, -3697430, 710817, + 5069672, 1852742, 68183, -408559, -4410932, -2385854, -1293859, 1122597, -1761474, 379031, + 1694365, 2232846, -1838783, 1660542, -854162, -823560, 847719, 177704, 175557, 514322, + 191126, -1238024, -1154809, -47782, -1232119, 587337, + }, + { + 47318192, -351603744, -17053168, 19366544, 2219424, 1060857, -3528853, -11965242, -6333466, 3602941, + 22919556, 2749316, 13959, 3621731, 2851858, -1173600, -14178224, 9470403, -9357123, -19864, + -3271691, 2672544, -714575, -7546795, 3823595, -2555506, -25233, -2604361, 2885681, 2655901, + -8894340, 1372242, 4687957, 1288490, 3528316, 5599564, -6300717, -6638946, -4811974, 10141492, + 1319629, 776315, 1220308, 862215, 1762547, -3109020, -843424, -4053376, -7189239, 360777, + -2290291, 9066676, 2277407, 50466, -2982855, 2132988, -1072668, -497679, 3900367, -2837363, + 1989644, 518617, 2017024, 3022046, 7087770, -968515, 1914482, 874026, 397821, -197569, + -912681, 4001299, -169114, -1326071, -351114, 1358283, -7516, 301721, -798327, -631897, + -1158031, -840203, -1478006, -1792075, 228170, 141734, -478889, 490700, 452582, 1024350, + -2224793, -172872, -1864553, 430570, 530965, 1334124, + }, + { + 1363115, 2670933, 7479686, 1536525, -2843805, 493384, 1483911, 4536559, 9310952, 570157, + 2289755, -102005, 6678674, -209917, 15651935, 8669928, -10351408, -6752763, -89657, 14099841, + 854699, -3896609, -4907537, -8997420, -4716411, 16329466, 11071352, 16059420, 4742718, 13289166, + -12043088, 4001299, 712965, 2485712, -4648229, 12310450, -8410620, 4383014, 3136400, -6397891, + 6410776, 1528472, 3355980, 3023657, -4663798, -714575, -5525476, 2426120, -8628052, -3433290, + -5768141, -3780645, 3895535, -7501161, 7423314, 5389647, 317828, 2517925, -4841502, 1262720, + -395674, -3358128, -4861366, -1973538, -2349884, 435402, -2825015, -752693, -111132, -1202591, + -1847910, -953483, -335007, -1836635, 1174137, 1494112, -730144, 1989644, -365609, 860067, + 2107218, -2248952, 1563905, 353798, -3045132, 1445793, -1427003, 414464, 38118, -476205, + 942745, 2684, -58519, -98247, -685584, 1451162, + }, + { + 82762944, 100474856, -38257960, 17652852, -3905199, -165356, -12737262, 5397700, -3724274, -5908802, + 10930155, 13114683, -16823924, -10395431, -2423435, -7883950, -16656957, -333397, 3767760, -8428873, + 10943040, 406411, 551366, -4828080, -408022, -2961917, -8674223, 1180042, -4614406, -3583613, + -884226, 9196599, -10073309, -3497177, 428960, 7910793, -4146791, 5579163, 843961, 3620121, + -1222455, -4708895, -8934606, -4599910, 1621350, -1496259, -1076963, 717260, -550830, 372052, + 613643, -1195075, -1457068, -389768, -437550, 5121749, -1360968, 5309654, 1442572, 466541, + 140660, 977105, -4693863, -237834, -769873, 2405182, 2719251, 2272575, -693637, -481036, + 288837, 630286, -2070174, -2578591, -1240172, -981400, 1508070, 1459752, 945430, -2007360, + 823023, -90194, -268435, 66572, 1626182, 531502, -907849, -1060320, 652298, -545461, + -551366, -904091, -106300, -1491964, -155156, -392990, + }, + { + -551903, 82159504, 12499429, 12104828, 1196148, -4887136, -10831371, 1588601, 5641440, -7721815, + -3831111, -6199786, 3351685, -27458800, -741956, -8703751, 5414880, 4100083, -20075214, -18597208, + -8949638, -4893579, 11258720, -739808, 3942243, -764504, 4538170, -13430900, -6034966, -10954314, + -1980517, -1410897, -10660646, 6860137, -4749160, 1666447, -10936597, -4900558, 2462627, 2237141, + -4962835, 4929012, 4063576, -5856188, -2057826, 2724083, 738734, 4580046, -52076, -3046743, + -1511292, 255014, 3363496, -2637647, -237834, -909459, -3340411, -3295314, 1836635, 3438121, + -1228361, 5072893, 3191161, -434865, 6255620, 2960306, -1078574, -5367636, 815507, 33286, + -1284195, 2599529, -1801739, -100395, -3243774, 1375463, 3855270, 1343251, -95563, -686658, + 270583, -1524177, -1850057, -1088237, 1196148, 181999, 261993, -373125, -792421, -2106145, + -270046, -359704, -153545, 208843, 29528, -329102, + }, + { + 31003222, -179057728, -16958142, -7836168, 13931800, -17624398, 13639742, 8163122, -6096706, -19827716, + 4958540, -9783936, -14396194, 13057774, 26348014, 2552284, 7093676, -9179419, 1007170, -12875775, + 6799470, 687195, 8368207, -4832, -13109314, 2246805, -915902, 1995549, -8020852, -4578972, + 7653095, -2893197, 1840394, -5757404, 3186329, 15796890, 3638374, 3735011, -10084583, -7494181, + -4437238, -2354179, 779000, -7015292, 1873680, -2974265, 477815, 6129992, 6440304, 11000485, + -3356517, -3112241, -5901822, -1131187, 4020090, 4400731, 4584341, -4249334, -1489280, -1307818, + -102542, -2292439, -2315524, -1997697, -1096827, -123480, 351114, -1078037, -983011, -1249299, + -2756832, 1122597, 2920578, -192200, 556735, 326954, 595390, 242666, -1975685, -668404, + 474057, 162672, -25770, -2817499, 1159104, -532576, -376883, 426812, -1342714, -24696, + -803159, -1875827, 616865, 519691, 62814, -870268, + }, + { + -3424163, 14549202, 5383742, 1815161, -7563975, 11278047, -3347390, 9016210, -955093, -4364224, + -7198902, -6992744, -9478993, -50133544, -22836878, 19248432, 25011206, -28217398, 13716515, 13342316, + 6060736, -14367202, 22326314, 6017786, -2015413, -4502200, -15873662, -4883915, -2130304, -13930190, + 12064026, -5635534, 16712255, 7888781, -2003065, 596464, 9550934, -6124624, 5410048, -5033702, + -3847754, 2367064, -301721, 4594542, -4139275, 3046206, 10377178, 2396055, -2340220, -4973572, + -3274913, 872415, -972810, -7095286, -3554622, -2979634, -1600949, 586800, 1427540, 5587216, + -1772748, 1032403, -1026497, -5189394, -165893, -3754875, -52076, 1792612, 3396246, -279173, + 2296734, -1903207, -2111513, -1476932, -388158, 503585, -1316944, -1082869, 2028835, 2041183, + 62814, -31675, 1948305, -6442, -35970, -583042, -1199907, 919660, -907312, 113280, + 2081985, -452045, 665183, 381715, 430034, -336081, + }, + { + -48103632, 164651328, -9178345, 4086662, 24521578, -20703890, -3411815, 16070157, 117575, 22788022, + 1102196, -14319421, -10539850, -2574296, -9287330, 2427194, 10505490, -9147743, -3096672, -6542846, + 6373195, -5104032, -6758668, -6024229, 7986492, 5091684, -9241696, -10993506, 13492103, 13242458, + 3434363, 10539850, 2668785, -10686416, 2987150, 13850733, 5214627, 6751689, -7462506, -4434017, + 9745281, 5755256, -2878165, 3357591, -4166118, -7090454, 3442416, 4375498, 9137543, -189515, + -865436, -6338298, -871342, -7008850, -1271310, -1034550, 1741609, 2093797, 2384781, 489626, + -926102, -1621350, -217433, -1787780, -1319092, -293132, 264141, 2114198, 143881, 143345, + -1369021, 1908039, 30065, 934692, 1043140, 1980517, 1163399, -2502892, 1054415, -1229971, + 2479270, 2159295, 321049, 3293166, -1749125, -1033477, 2779381, -1912334, 566936, -336618, + 657130, 287763, -16106, 1643362, 1449015, 410169, + }, + { + -2430952, -80115632, -1289564, -7142531, 236223, 7938710, 1031866, -4597763, 1641214, 4882841, + -1999844, 12010339, -2708514, -27872190, -44405132, 4393215, -11082089, 27083526, 4765803, 1271847, + 9174050, 4886062, 7167764, 5876052, -10132902, 8841190, -2674154, 6750078, 9558450, -17595408, + 9544491, -1752347, -5983963, 3727495, -1063004, -708133, 4260608, 3520263, 3191161, -3638374, + 1140851, -5601174, 6092411, 3209951, -2506650, 6905771, -7496329, -394063, -1566589, -11811, + -1296543, 60130, 3534758, 1460289, -1569274, 5901822, 4797479, -2330557, -5536750, 673773, + -4813585, -1833951, 61740, -1388348, -105764, 4041027, 2430952, -3466576, -2875481, -2001992, + 1333051, 1340567, 3710315, 1409286, -731755, -1334661, 815507, -166967, -1115081, -433792, + -3195993, -1354525, 2039036, 3288871, 1098975, -841814, -66572, 92342, 1738388, 397284, + 1808718, 453119, -376347, -615791, 151934, 310311, + }, + { + -35013648, -64961, -18046916, 22928682, 11392401, -14879377, -2961917, 4437238, -9446781, 2678449, + -5734855, -499290, 4665408, 1625645, 24876988, -18299782, -19765976, -13434658, -25457882, 4873178, + 2705293, 4311611, 4685273, -1845225, 18933290, 4606353, -3623342, 9556839, -16709570, 16224239, + 2002529, 13925895, 6274947, 1119913, -7190849, 4114579, 6178311, -4671314, 4970888, 6376953, + -11982422, 7962333, 3323768, 1142461, 1442572, -278099, -789737, -2027225, 6106370, 2400887, + 5737003, 1002338, -4333085, -5943161, -1884417, 2408403, -1373853, -1645509, -478352, 2572686, + -2723546, 1261647, -2186138, -515933, -1126892, 1405528, -3253438, -2405182, 5520107, -84289, + -898185, 1104344, 475131, 2815888, -2306934, 1933272, 1785096, -368830, -1440962, -1347009, + 1547262, 2094870, 729608, -286689, -713501, -3036005, 3722126, 725850, -920734, 621160, + 484258, 1523640, 1276142, -121333, 1319092, -750009, + }, + }, + { + { + 799938, -19618874, -10013179, 14323716, -7583839, 2401424, 3241090, -2563559, -839129, -6422050, + 23108534, -5668283, -3930969, 11945915, 8965744, -3788161, -1534377, 9677098, -9059697, -21731998, + -5171678, -5152887, -99321, -9603547, 27944668, 3026878, -8491687, -6677601, -9729175, -16655346, + 276489, 3604015, -3968550, -4029216, 6334540, 6310381, 5130339, -9160092, -5655398, -687195, + -4564477, -5294084, -269509, 2620467, -1899986, -10965052, -5332202, 2001455, -2364380, 6640020, + 442919, -2355790, -3283503, -2828236, 612033, 3422015, 40802, 4122095, 1079111, -1727651, + -2528125, -1668595, 5927055, 976568, 1066226, -4576288, 719407, 1723893, -3887482, 1433445, + -2559264, 832150, -797790, -1385664, 631360, 601832, -2279017, 930934, -1448478, 798864, + -3569655, -811212, -54224, 1903744, 1964948, -1392643, -53687, 102542, -1088237, 80531, + -1098975, 356482, 1168768, 396748, 389768, 215285, + }, + { + 8349417, -203197584, -54977728, -36130876, -5408438, -7215545, -1398012, 962610, -9584220, -12089259, + -9636833, 13353590, 2447058, -4212826, -1942936, -5670968, -11944841, 2325188, 6695854, -11009075, + 4554813, -4030290, -9731322, -16689706, 6296422, -2479807, 3030636, 6562173, 5591511, 1111323, + 3054259, -2338073, -3689377, -938987, -7427609, 3369939, 32749, -4464619, 2755759, -10974715, + -4214437, -922881, 3199214, -5690295, -2179696, -1896765, -1361505, -8286603, -2945811, 5216775, + 5453535, -1706713, 206158, -2842732, -4600447, 7245610, 1258425, 1619740, 1133871, -320512, + 1238024, -4969277, -2836826, -2762738, 1022739, -2675228, 2192044, -203474, -3938485, 28991, + 90194, 3170760, -1671279, 1314797, -207769, -369367, -1950989, -1007170, -2777233, -1357747, + 186294, 2186675, -1300301, -581431, 1216550, 1028645, -704912, 607201, -417149, 1957431, + -406411, -171262, 70330, 833761, 638340, 571231, + }, + { + 4038343, -77815144, -9757092, 2676302, -17778480, -5187247, -2410014, -591095, 4674535, 8546985, + 13262859, -15707232, -134755, 6058588, -9991168, -2959233, 4828080, 14734422, -13154948, 11538967, + 1043677, 4239133, 22180284, -1709934, 5990943, 5380521, -7640747, -4563940, 3094524, 6493454, + 10205379, -6944425, -5427228, 977105, -668941, 3762928, 6074695, -4808216, -173409, 2051384, + -1122597, 1403917, -4365298, -3830574, -1036698, -1592359, -6018860, -7611219, 412317, -95026, + 1890323, -7437273, -1212255, -1548336, 1304060, -3353296, -2559264, 3418257, -2237678, -3987877, + -1194001, -2640331, 2252174, -5414343, -2580202, -16643, 1353989, 2327872, 884763, -2253247, + 153545, 1347009, 197569, 982474, -815507, -2077154, 1471563, -89657, -897648, 1361505, + 585726, -864362, -417149, -622770, 542240, -177704, -710280, -1214402, 405338, 600759, + -1199370, -194884, 244813, -136365, 347892, -482647, + }, + { + 2069101, -2813741, -7073275, -4191888, 1690070, 219043, -1296543, 1708860, 141197, -6841883, + 769336, 2315524, 4161823, 2141578, 54794120, 27845346, -38048040, 19355806, 27745488, 18321794, + 11920145, -2228014, 4429722, -2150705, -10559177, 10137733, -21203716, 4010426, 12757127, -12672301, + 23339926, -856309, -6692096, -4850629, -5789616, -11660299, 17271138, 4291746, 2043868, 4522601, + -3125663, 4799089, -640487, 5586142, -2029909, -4212826, 8521752, 2375117, -1263794, 8157217, + -872415, -1718524, 1507534, 1589675, 1797981, 45634, -3642132, -2059974, 6898255, 458488, + 3182571, -4239670, 1841467, 698469, 1083406, -635118, 2197413, 1488743, -2077154, 302258, + 3853660, -2796024, 929860, 2006824, 1438814, -995896, -751619, 272730, -419296, -782758, + 315680, -168041, 911607, -425739, 726923, -380105, -1217623, 1606318, -233002, 595927, + -313533, -215822, 327491, 556735, -994285, 73551, + }, + { + -36039072, -249955824, 33156610, 3010772, -11811, 214212, 3671123, 973347, 1189169, -898185, + 2119566, 8077223, -12184285, 5524939, -728534, 3432753, -6308233, -23809688, 633508, 5989869, + 103616, -5872294, -8737037, 6229313, -8976482, 11092290, 8518531, 12085501, 18105434, 7232188, + -11614128, -15917149, 1683090, 6209449, -9339943, -1814624, 25063282, 4854924, 4326643, -10074920, + -6288906, -2879239, -3929358, 6164352, 3399467, -2661806, 5154498, 5886253, -4897337, -2908230, + -2007897, 1400696, -3877819, -1607392, -1840394, -3097745, 3787624, -2494839, -1241782, 1981054, + -1268089, -2882997, 550830, 136902, 361851, 1381369, 470299, -2325725, -178241, 17180, + 1372779, -3051574, 1306744, -3922379, 619549, 3227131, -686658, 2263448, 121333, 909459, + 2147, -1380295, 2291365, -740345, -423591, 108448, -831076, -150861, 667867, 1795833, + 89657, -185757, -1501628, -629750, 300648, -159451, + }, + { + -308164, -16652125, 5075578, -5819681, -1341104, -33286, 282394, -388158, -5558225, -1504849, + 2462627, 3738769, -6954626, 18829674, 4687420, -6844031, 32265404, 366146, -1472637, 23077934, + 3038153, 2141041, -1466195, -7832947, -7250979, 10545218, 1621887, 4102768, 817654, 30303678, + 15235323, -6241125, -12796855, -636192, 4511327, -4316979, 10216653, 13479218, 1857573, -549219, + 5965710, 7056095, 1555852, -5001490, -3607773, -686121, -2138894, -3293166, -11029476, -6904697, + 656056, 3912715, 58519, 980863, 1646046, -6579890, -1191317, -1369021, -901406, 896574, + -823023, 1236414, 1767916, -1422171, 804233, 973347, 1785633, 498753, -1541356, 1104880, + 763967, -2185065, -893353, 1659468, -2651069, 903017, 2496987, 2930778, -70867, 169651, + -74625, 1073742, -2785823, 536871, -1572495, -1551020, 881542, 165356, -450435, 1031329, + 1127966, -1138703, -1758252, 1009854, -777926, 211527, + }, + { + -17322676, -390875840, 20938502, 29033442, 729608, -231391, -9294309, -7102802, 8322573, -10399726, + 1623498, -14638322, -5671505, -2083596, 7710003, 3339874, -18204218, 3797825, -9858024, -11087995, + -9442486, -117575, 442919, -4377646, 4341138, -2263985, 2378875, -2717641, -6368900, 758599, + -6062883, -164819, 1411971, 107374, -515933, 934155, -10854993, -10214506, -10019085, 3313567, + -2720325, 3040300, 84289, -264141, 5947456, -3532611, -1606318, -4871567, -3160022, 2682744, + -3172907, 2488934, -1639604, 6360847, -1032403, 2370285, 1978369, -237297, 5647345, 648003, + 3477850, 136902, 847719, 1107565, 2398739, -5319317, -528818, 1222992, 985158, 2250563, + -1415192, 1377074, -615791, 1477469, 834297, 479426, 1108638, 1647120, -900869, -245350, + 24159, 263067, -534723, -493384, 898722, -471373, -1430761, -209917, 446677, 882616, + -1564442, 2123861, -312996, 321049, -489626, -597000, + }, + { + -397284, -18435074, -4747013, 59593, -2653216, 555125, -651761, -2768107, -1876364, -2477123, + 3204046, -1699196, -9259949, -14096083, 25004762, 6067715, -2758980, -1426466, 631360, 21759378, + -4540318, -6478422, -2341831, -12149926, -1763621, 12464532, 6739341, 5340792, -10976326, 17193828, + -14847165, -5612986, -8464307, -1573032, -7280507, 9163850, -4563403, 4338454, 5534066, 572304, + 4923107, 765578, 629213, -5568962, -10579578, 1941862, 2247879, 6951405, -5361193, 1032940, + -2592013, -5348308, 3726421, -4307316, 7959112, 900333, -3519189, 1417876, -5424544, 1984812, + 1447404, -1593970, 154082, 184147, -4373351, 23622, -514859, 24696, -1413581, -879931, + -1864553, -2034741, 76773, -1561758, -702227, 789737, -265751, 2020782, -513249, -54761, + 1553168, -1392106, 2126009, 149250, -2514703, 2555506, -1335735, 191663, 105227, -595390, + 681289, -928787, -455267, 467078, -410706, 1517197, + }, + { + -76114336, -34829500, 27924804, 22750978, -4523138, 3647501, -7422241, 3278671, -6737730, -1284732, + -7445326, -2064269, 1081795, 9401683, -4894115, -8761733, -2618320, 2957085, 1973001, -4753455, + 7496329, -7420630, 1030792, -5340792, -2054068, 1394791, -578210, 9917616, 4796942, 858457, + -4299799, 9287330, -4872104, -7250979, -7271380, 11537893, -2144263, -2445447, -72478, 12053826, + 7381438, 3767223, -3894462, -3488587, 2574833, 1871532, 4603131, 5772436, 4415764, 1239098, + -6027987, 535797, 2451890, 5496485, 4321811, 3135863, -3046206, 3504693, 771484, -1424855, + -172872, 2340757, -1911261, 2733210, 1400696, 113817, -727997, 2792266, -971736, -1598802, + 207232, 323196, -415538, 1473711, 998043, -463320, 1355062, 88584, -218506, -827318, + 2675765, 755914, -70330, 55835, 754304, 25770, -933082, -1340030, 1370632, 1120450, + -177704, -1233729, 318901, -678068, 891743, -16643, + }, + { + 1462436, 53509924, -22645216, -6046240, -4608500, -1325534, 5579700, 383326, 6169184, -5822902, + 4381404, 9467719, 9410810, -15761993, 29222958, 6911140, 8362302, 7376070, 875100, 9669045, + -2959769, -4121021, 11213623, -3077881, 8927626, 6560026, 15629386, -1159641, 9804873, 4231080, + 5394479, -1710471, -6931004, 403190, -11350525, -215822, -3768297, 3178276, 2377265, -1779727, + -7718593, 2394444, 7283728, -4025458, -2335389, 7895761, 116501, 3860102, -3115462, -4191888, + -1101659, 1606855, 1412507, -797790, 752156, -1269700, 1150514, 1086627, 2734284, 4766877, + -2163053, -872952, -1497333, -4643934, 2637110, 1172526, -1935957, -1467268, 3244848, 1068373, + -3502009, -702227, 665183, 4468914, -948651, 506806, 2690260, 1053341, -20401, 474594, + 51003, -1103807, 258235, -826781, -1701881, -1357210, 588411, 181999, 173946, -1209570, + 923418, 465467, -197032, -128849, 463320, 293132, + }, + { + -26486526, -163718240, 46744276, -28838558, 5280126, -26306674, 15051713, 19838454, -2428267, -17399986, + 9983115, -554051, -2784213, -5849746, 15709917, 7213398, 12142946, -4258460, 2845953, -17662516, + -8312909, -11684995, -1945083, 3088082, -8869644, 3426847, 3178813, 4654671, -5196374, -2340757, + 6564858, -3568581, 1671279, -11043435, -3929895, 6541235, -174483, 4489315, -7708930, -2912525, + -4250407, -760746, 5867462, 1641214, 9173513, 1095217, 54761, 6255620, 741419, 4753992, + -1771674, 1798518, -110059, -1986422, -1440425, -1923609, 1762547, -811212, 2492692, 2124935, + 4670777, 1509681, 555125, -2524904, -367220, -347892, -1032403, -1209570, -1119376, -801548, + 418222, 1052804, 419296, -1068910, 283468, 353261, 1698660, 1006633, -1018981, 280784, + -560493, -745177, 797253, -1949915, 1218160, -1552631, -999654, 556735, -1198833, 103079, + -253940, -1081258, 582505, -807454, -1122597, -594853, + }, + { + 3484829, -10747082, -15874736, 7148436, -11133092, 4937065, -13471702, 6968048, 3653944, -572841, + -555661, -1675037, -3324305, -12758200, -16615618, 1436667, 29503740, -17307108, 10595147, 3416647, + -8427800, -33224256, 10668699, -444529, 3112778, 8694624, -753230, 3562139, 1171989, -10190347, + 11246909, -21066814, 2565169, 3752728, -1686848, -361851, 6047851, -2137820, 9425306, -5979668, + -371515, 3702799, -3577708, 2639794, -3674345, -1822140, 4800163, -252866, 754304, -2573759, + -125628, 482647, -608812, 610959, 2006824, 118112, -2584497, 1326608, -248034, -1035087, + -4253092, 2623688, -2201171, -6703370, 328565, -175557, 3340411, 401579, 897111, 615791, + 2476586, -3432216, -442919, -1727651, -4179003, 1224603, 2727841, 231928, -329639, -638340, + -849330, -956704, -270046, -1251983, -1641214, -2035815, -2430952, 52076, -1373316, -554051, + 1824824, 151934, 1059783, -405338, 268972, 412317, + }, + { + 21806086, 253950144, 4609037, 19560354, 28947006, 14762876, 31279710, 24182276, -10652056, 21746494, + 9339943, 909459, 2147, -1882806, 5561446, 7597261, 882079, -12198781, -16156593, -12928388, + -3649649, -10107132, 7866770, -914828, 1892470, 1138703, -10011569, -12642236, 4334159, 2080375, + 896574, 7368017, 8394514, -3668976, -2962991, 11143830, 1326071, 4973036, -3804804, -2245194, + 6399502, 5794448, -38118, 5574868, 3316789, -5027796, -1175747, -12265890, -6903086, -7320235, + -3966402, -8303783, 4431333, -683437, 4403952, 4182761, 2429878, -1835025, -4478577, -1860795, + 1279363, -929324, 832687, 568546, -297963, -3742527, -3760781, -825171, -1203128, 818191, + -2823404, 394600, -2362232, -1385127, 634045, 2098629, 1222455, -2687039, -128312, -2723009, + 887985, 13422, -831613, 1050656, -1036161, -1382443, 383863, -1469953, 826244, -1830193, + -900333, -725850, -827318, 1081258, -158377, -673236, + }, + { + 1780801, -71365176, 484794, -5988258, 796180, -1585380, -9173513, -325881, 3370476, 7022809, + 5005785, 16931834, -7905961, 10983305, 47604880, 24481850, -20883742, 11637751, 12890271, -21875342, + -19587198, -12704513, -13458280, -9744744, -15540802, -3293703, -16768089, -5677410, 3781182, -8281234, + 12741557, -2878165, 1754494, 3799436, 1405528, -3069291, 1289564, -65498, 1787780, 1838246, + 4690105, -1970853, 382789, -7007239, -2093797, 8963597, -3184718, 5960341, 2112587, -431107, + -1893007, 2631741, 2454037, -1422171, -6874095, 346282, 3256122, 672162, -2573222, 4794794, + -2013803, -640487, 106300, -2474975, -2954938, 155156, 404264, 852014, 871342, -1860258, + -2157147, -4125853, 111132, 585189, 742493, -1214939, -714575, -675384, 2113661, 2524367, + -424665, 360240, 1333587, 1746978, -112743, -920734, 42950, -23085, 2375654, 834834, + 898185, 320512, 753767, -156229, 288837, 905164, + }, + { + 34628712, 87395072, -20483772, 36390184, 22888954, 6164889, 12990129, 7348689, 1425929, 8738648, + -12536473, 1612223, 6180458, 3639985, 22173306, -7267622, -5870147, -10006200, -22115324, 2219424, + -746251, -96100, -4030827, -6536404, 12677670, 3351148, -6338298, 4381941, -2606508, 20981988, + -8092792, 7483444, 6529424, 6677064, -5728950, -5345624, -7152195, -4390531, 5538897, -2461553, + -8032126, 5102421, 3011309, 5162014, -6455873, -1035624, 341987, 2114735, 1111323, -6184753, + 3055869, 855772, 448824, 1031329, 1642825, 2767570, -215822, -2157684, -2675228, -991601, + -1461900, 3959423, -1155883, -1679869, -2525978, 1497870, -961536, 790274, 5207111, -1725503, + -1660005, -1447941, -1637993, 1320703, -2665027, 1921461, 1664300, -481036, -1033477, -2640331, + -1155346, 1774358, -162672, 673236, 1136019, -2792803, 2662880, 4832, -1221918, 199716, + -108448, -537408, -480499, -1179505, 1243393, 150861, + }, + }, + { + { + -1293322, -23229330, -449361, -11705933, 11316165, 1791001, -2097555, 1759326, -4083440, 3089155, + 5472862, 7802882, 2595234, 4268124, 11278047, -27154394, 4697084, 12156368, 1328219, -15423764, + -27262842, 8157754, -7180112, 986769, 19660750, 3635690, -3652870, -16462610, -77846, -12416750, + -6131066, -6223408, -7129646, -2029909, 6849936, 6826851, 5109938, -4485020, -8922795, -1082332, + -944893, -6965900, -2178085, 1440425, -430034, -6265284, -7996156, -504659, -1459215, 7703024, + 4502737, -6958384, -804770, -3438658, 1995549, 4268661, 550830, -455267, 2072322, -2239289, + -2058363, 1842004, 2978560, 1137630, 2448131, -2193118, -627065, 823023, -1903207, -1364189, + -377957, 53687, -504659, -681826, -1160178, -603980, -125091, -42950, -1908039, -193810, + -2230699, -695248, -326418, 2223183, 1781875, -1787243, -445066, 50466, -290447, -502511, + 185220, 337155, 670552, 508417, 164819, 353261, + }, + { + -5318244, -228414416, -4949413, -34928820, -24539296, 2726767, -87510, -16471200, 9446244, -7627862, + -21174188, 6745246, 6415071, -6247030, -11267847, -1562294, -9134859, 7173669, -1004486, -4785668, + -9242233, 6345278, -6051072, -12554726, 2070174, -2524904, -789200, 5369783, 3912178, 7417409, + 1952600, -4205310, -705448, -9442486, 2499671, -1469416, -2671470, 1268626, -28991, -8584566, + -4185446, -1248762, 302795, -1231045, -157840, -3528853, -6190659, -8411157, 367220, 2001992, + 4695473, 2557116, 817654, -3687766, -2408403, 4537633, 3350075, 0, 2325725, -717796, + -1415192, -1793686, -2818572, -2059974, -2226941, -250719, -832687, 899796, -3095598, -801548, + 1848983, 792421, -1364726, 1127966, -1169305, 426812, -1076963, -1018444, -2186675, -612033, + -1592359, 1177358, 387621, -510564, 772557, 575526, 412854, 35970, 190052, 789737, + -695248, -283468, 827318, 635118, 902480, 381715, + }, + { + -2932389, -54305028, -18591840, -24909200, 4073777, -2305861, -4976257, 3229816, 352724, 1845225, + 14869714, -2660732, -16508781, 10755135, -6172942, -5941014, 7947300, 2258079, -8278013, 12798466, + 441845, 6998649, 16216723, -764504, 5917928, 7042673, -3244311, -6602439, 1165010, 10190347, + 4575214, -4354023, 3756486, -4827543, 2137283, 5023501, 1719061, 63888, -3261491, -4952098, + 7898982, 1993939, -4027606, -6247567, -1481764, 331249, -7370164, -4751308, -1531693, 1776506, + -1744831, -3499862, -453119, 171262, 1248762, -5930276, -781147, 487479, -1779727, -3303367, + -2925410, -274878, -860604, -2478733, -3095598, 1293322, -155693, 970126, 519154, 1293322, + -280247, 197032, 1501628, 1151051, -1117765, -2772402, 2531883, 223875, -347355, 738734, + 280247, 396211, -944356, -1184337, -4832, -450435, -1661079, 337692, -279173, 97711, + -370978, -208306, -325881, -194884, 72478, -242129, + }, + { + -1430224, -15622407, 5851893, 1762010, -2244657, 795106, -766652, 1052804, 1244467, -3320010, + -1217623, 2566780, -5318244, 10210748, 56848188, 725313, -8822937, 13993003, 31867046, 13801341, + 6628745, 12809740, -2308008, 640487, 3742527, -17647484, 406411, 13616120, -893890, -1098975, + 6087043, 10390600, -6366752, -10656351, -7211787, 5106716, 4454955, 12057584, 4018479, -1982127, + 285078, -3104725, 1182727, 4290136, 3946538, 382789, 5704254, -1632625, 3342558, 4973036, + -325344, -1461900, 2260227, 2274722, -333397, -2215666, -2470680, 2173790, 1233729, 2689187, + 2590402, 1264331, 253940, -1151051, 2313914, -2603824, 3666292, 88584, 435402, 142808, + 1462436, -994285, 1553704, 374199, 438624, 568546, 571768, -37044, -293132, -1364189, + 957241, -520765, -716186, 879395, 737661, -1424855, 21475, 1125281, 456340, -368293, + -692564, 67109, 862215, -318364, 162135, -652835, + }, + { + 14325863, -235138192, -29736206, -9612137, 9933722, 3914326, -672699, -2561411, 9819906, 2245194, + 9346923, -14687178, -125091, -353261, 5196911, -9713605, 838056, -22198538, 1771137, 3965866, + -681826, 9403831, -17791902, -7187628, 1031866, 117038, 14896557, 28810640, 3178276, 1974611, + -7918846, -12281996, 3569655, 3524558, -9903658, 347892, 7698192, 10023917, 9300215, -7132867, + -3879429, -2849174, 4540854, -3466039, -872415, 5341329, 4896263, -1438814, 81068, -1606855, + -1592359, -3365107, -1833414, -3138547, 808528, -139050, -345745, -2482491, -512175, 2421825, + -1234803, -3116536, 309775, -1360968, 760209, 406948, -156229, -815507, -1160715, 1216013, + -231928, -1507534, -1263257, -1386738, 1190780, 1606855, 1356673, 325344, 746787, 481573, + -8590, -664646, 1126355, -194884, 961536, -1754494, -948114, 268435, 817118, 1672890, + 242666, -1044751, -1277216, -22012, -441308, 223875, + }, + { + -745714, -11569568, 1166084, -8148090, -192737, 171262, 250182, 791348, -2938295, -796716, + -1170379, 409096, -3982509, 12833899, 40299680, -11908871, 5976984, 1558536, -887985, 14374182, + 7793755, -2348810, 10966125, -7429220, -11239393, 10776073, 15205258, -3964255, 15098958, 8751533, + 11419244, -7704098, -6616397, 5972689, -1760937, -10577431, 13306346, 11218991, 5201743, 23622, + 6670084, 2764348, 5654325, -3566434, -3721052, -2272575, -1919850, -5140539, -7126962, -6619619, + 635655, 3652870, 2923799, -446140, 533113, -994822, -5053029, 472983, -4274030, 1002338, + 528818, 2206540, 1449015, -578747, 1401233, 332323, 1380295, -1469416, -432718, 2054605, + -1202054, -1344862, 345745, 255014, -744640, 1118302, 2298881, 1962800, 659278, -789200, + 1646046, -1081258, -1253594, -435939, -1563368, -830002, 274341, 372052, -41876, 563714, + 646929, -227633, -1245004, -18790, 178778, -373662, + }, + { + -12496207, -328438848, -40645424, 15924665, 23198192, -3663607, -642635, -11836393, 6125160, -7617662, + -4772246, -11209328, -142271, -9827959, 8192650, -2920578, -12991739, -3893925, 1232119, -18103824, + -1791001, -322123, -421444, -2151242, 814970, -2668249, 2752537, -4541928, -5902896, -1645509, + -400506, 5459977, -7977902, 1570347, 4299263, -1570347, -7923678, -7315940, -13967234, -2404645, + -2756295, 3148748, -921271, -2820720, 6893960, 3314104, -5283347, -3275450, 294205, 820339, + -3088082, 740882, 3719979, -2131915, 4849555, 1343251, 3541738, 126165, 3007551, 3629247, + -1170379, 925565, 2464238, 801548, -803159, -1049583, -324807, -389768, -1358283, 2341831, + -115427, 331249, 1038845, 1068373, 482110, -504122, 880468, 1469953, -140660, -439160, + 843961, -394600, 918049, -386547, -6442, 52076, -1739999, -340376, 172872, -70867, + 609885, 1165010, 460635, -142271, -238371, -715649, + }, + { + -1235877, -7786239, -10570451, -5620502, 472446, -365609, -801548, 330176, -6499896, -573915, + -1709397, 32212, -6418829, -12513924, 34486976, -27077622, 8310225, 16259672, -1189169, 635655, + -5896990, 6971806, -1584843, -6841883, 2561948, -578210, 2604898, 22353158, -22816476, 17128866, + -13063680, -3263638, -14393509, -10071161, 10986526, 1612223, 2782065, -2006287, 5524402, 4338454, + 6647536, 1348083, -946503, -10348187, -9113921, 4209068, 3235721, 2568927, -2576981, 2565169, + -2090039, -3167002, -1058173, 1461363, 3755412, -674310, -1384053, -1065152, -1884954, 342524, + 2662343, -1078574, -285078, -200253, -2191507, -2681670, 358630, 2212445, -2728915, -1000191, + -1243930, -834297, -962610, 183610, -1367947, -19327, 120259, 1850594, -1017907, 600222, + 447750, -179315, 956167, -15569, 622233, 357556, -219043, -960999, 781684, 157840, + 187368, -721018, -977105, -129386, 293668, 967978, + }, + { + 55672440, -130993280, -47890496, 4133369, 30048664, -1198833, 527744, -10471667, -4147865, 7767985, + -20086488, -10421738, 8480950, 7167764, -102542, 2607045, 2508261, 2426657, -3381213, 4619774, + 2750927, -9021042, -11811, -2002529, -3223910, 4757750, 4261145, 5597953, 5668820, 2650532, + 2232309, -730681, -2049236, -3383361, -8038032, 3412889, 3122978, -2185602, 177704, 8280160, + 14555107, 320512, -2282238, -1142998, -2585570, 4240744, 7207492, 3469797, -293132, 905701, + -1643899, 1822677, 1979443, 5182415, 5597953, -1996086, 744103, -330176, 1021665, -748935, + 2330557, -171262, 823023, 121333, 2065342, -207769, -478889, 1185411, -892816, -1845762, + 198642, 1334124, 174483, 613107, 2757906, -224949, 732292, -148713, -861678, 1167157, + 1271310, 704912, -534187, 642098, 374199, -902480, 976031, -645319, -106837, 985695, + 336081, -1220308, -717796, 860067, 460098, -970126, + }, + { + -2116882, 18682034, 12830678, -20755966, 2340757, -5198521, 12316892, -930934, -537945, 2923262, + 4365835, 10882910, 3541201, -14127758, 34646428, -2838437, 13923747, 10305237, 13784161, -6644315, + -876710, 11931419, 5653251, 901406, 3995930, 1799054, 17806398, 2132451, 600222, 7947837, + 9054328, -1603097, -1766305, -8621073, -3187403, -4332549, -2982855, 3629784, 6251862, -4281546, + -7671349, 3607236, 3346317, -362388, -2713346, 6813429, 1360968, 418759, -3578782, 1862942, + -828392, 1000727, -1751273, 2311766, -1631551, -609349, 1486596, 3569655, 4410932, -1284195, + -2265595, 1012539, -1931662, -4815195, 156229, -832150, -179315, 1899449, 2092186, -1855426, + -1400159, -1781338, 1830193, 3083250, 1743757, 289910, 1884417, 19327, 211527, 764504, + -381178, 222801, 342524, 461709, -2964601, -1845762, 704375, 288837, 755914, -645319, + 482110, 755914, 251792, -188979, -184147, 434329, + }, + { + 22141094, -128475896, -26589068, -17864380, -7472706, 18196166, -20260434, 5505611, 6253473, -4728222, + -585189, 18790, 12094628, -6154152, 2893734, 9851581, 10581189, -1665911, -154619, -8209830, + -24211268, 2817499, -4920959, -1873143, 172872, -1980517, -2044404, 8019241, -2370822, -3340411, + 4575751, -2886218, -1589138, -3654480, -5503464, -2685428, 4599373, 2845416, -10129143, 2416456, + 945967, -4370129, 1977833, 5974300, 7216619, 2112587, -1555852, 5774047, 92879, 464930, + 1173063, 4633196, -1869921, -193274, -2180770, -3653407, 1101659, 418759, 3208878, 636192, + 6503118, 912144, 1953673, -2740726, 680215, -384400, -574452, -2400887, -28991, -1307818, + 310311, 1520418, -305480, -770410, 144955, 2251100, 375273, 169114, -285615, -265214, + -228707, -1136556, 806380, 160524, -1250372, 68719, -908386, 119185, -194347, -698469, + -118648, -298500, -854162, -411780, -841277, -309775, + }, + { + -3060164, -28091234, 7166690, 2018635, -5609228, -4223564, -6441377, 5083094, 3387656, 3680250, + 1549410, -5245766, -3325915, -11001559, -29766270, 23048942, 11906723, -2088965, -9954124, 14735496, + -16171089, -13185013, 9536975, -4160213, -3434900, -1745904, 5839545, 5137318, 2552284, 8423505, + -6938520, -8144869, -5971615, 3347390, -3207804, 4577362, -4057670, 7548405, 2539400, -558883, + -1248762, 3550327, -6554120, 1378148, -1267015, -5089000, 6749004, 1173063, 2191507, -4963909, + -537, 1530619, -467078, 1022202, 1035087, -21475, -450435, -1848447, 1716376, -5265630, + 723165, 1479616, -5945309, -2135136, 92342, 140123, 1653562, 2551748, -1679869, 2128693, + 1925219, -3182034, -1086627, -1188632, -2750927, 711354, 2703145, 233002, -519691, -1615445, + -213675, 143881, -2414309, -850404, -1007707, -1517734, -2782065, -1219771, -358093, -863288, + 1201517, 126702, 893353, -398895, 3221, 897111, + }, + { + 15123654, 238092048, 28313498, 17020956, 29867202, 34183644, 15985331, 9863392, 3038153, 10179072, + 15623480, 1938104, -1707250, -11451457, 7820062, 17020418, -17453136, 6634651, -13098577, -6621766, + -13611825, -9838159, 48318, 104690, 5089536, 6917582, -13624173, -137976, -2137820, -1219234, + 2931852, 5548561, 5476620, 197032, 1709934, 4338991, 3047816, 222801, 478352, 3286724, + 3760781, -2936684, 6376416, 657667, 4688494, -3681861, -118112, -9940165, -12819404, -7923141, + -1400696, -6098854, 1707786, 5520644, 4250944, 2175938, 3117073, -5210332, -2567317, -1859184, + 1555315, 61740, -687732, 448287, -405338, -2868501, -3262028, -1222992, 0, -1070521, + -3716221, 724239, -1545115, -1847910, 1433445, 845572, 387621, -147640, -313533, -2729989, + -40265, -672162, 531502, -464393, -637266, -2101313, -826781, -54761, 530428, -1548873, + -1578937, -141197, -115427, -11811, -343597, -425739, + }, + { + -653372, -62736052, -2030446, -3138547, 126702, -5406827, -4777078, -3308199, 3260954, 2955474, + 9152038, 8026220, 13996762, -10347650, 82835960, -2618320, 7002944, -7825968, 17853642, -21572546, + -14716705, -16444356, -15370614, -15701864, -5382131, -10644540, -17301738, -3529926, -14751065, 4529043, + 7529615, -5738613, 9703942, 415538, 148713, -3293166, 4043712, -2370285, -419296, 3752728, + 5736466, 399432, -142271, -10040023, -2334852, 1893007, 10868952, 2855080, -1628866, -165356, + -185757, 4078608, 255551, -3537443, -2094333, -3474092, 893890, 68719, 1072131, -71404, + 2672544, 944356, -945967, -3636764, -1726040, -469225, -704375, 1554778, -62814, 409633, + -2254321, -5249524, -920197, 546535, 2276870, -1158031, -2096481, 339839, 2251637, 1207960, + 1633698, -93952, 519691, 1190780, -484258, -53150, -774168, 519154, 1961190, 1790465, + 500364, 85899, -214748, 397821, 192737, 772557, + }, + { + -19316078, 139728704, 5655935, 31614180, 26146150, 615791, 4440996, 1371168, 7909719, 3956739, + -6455873, 3542274, 3349538, 14203457, 2665027, -2027761, 6650220, -9616432, -20557860, -2499134, + -556198, 3017215, 2082522, -3573950, 4421132, 449361, -5685463, -5815386, 11089069, 3908957, + 5730560, 2551211, 9118752, 704912, 733366, -8011188, -4636954, -105227, 30602, -7534983, + 1555852, -7668664, 1621350, 10308995, -5383742, -1698123, -1588064, 2195265, -762894, -1623498, + 2235531, 1256278, -67109, 383863, 2775086, 1160178, -258235, -3500935, -1439351, 315143, + 192737, 1314797, 434329, -3534758, 1111323, -366146, 137976, 2200634, 1432372, -1545115, + -885300, -1525250, -1935420, 99321, -580894, 635118, 1514513, -455803, -269509, -1076426, + -2323041, 797790, -927713, 2166811, -723702, 218506, 813896, 68719, -623844, 1129040, + -387084, -1827509, -991601, 468688, 42413, -177704, + }, + }, + { + { + 1169305, -6470368, 9911174, -15272904, 7842074, -194884, -2115272, 2452426, 305480, 355945, + -7378754, 11982422, 6494528, -12919798, 2977486, -23216982, 3732327, 6846715, 75699, 214212, + -28108950, 801548, -11119133, 1307281, 21548388, 10976326, 7124814, -13176960, 3421478, -3620658, + 733903, -7202124, -3244311, 6391985, 6406481, 1235340, -134218, 5907191, 2240362, 2120103, + -225486, -5152887, 1169842, 5159867, 1751273, -833224, 2076080, 4016331, -2429341, 3158412, + 2061584, -4779762, 2423972, -1708860, -757525, 408559, 266288, -1198833, 1869385, -554588, + 1246077, 1789391, 97174, 1125818, 2660195, -869194, -487479, 391916, -137439, -670552, + 733903, 250182, 624381, 324807, -1615982, -638876, -701690, 154619, -1152125, -325881, + -874563, 803159, 170188, 614717, 290447, -1363652, -50466, -134218, -46171, -632971, + 602906, -20401, 33286, 370441, 207769, 125628, + }, + { + 4599373, -155649616, 53782116, -5248450, -2669859, 3842922, 1835025, -11087458, 15006079, 486942, + -17276506, 4866198, 4487167, -5219459, -4261145, 2785286, -5866389, 7852811, -3235721, 3476776, + -2694018, 5386426, -1622424, -1517197, 3776887, 2508798, 1741609, 2441152, -2133525, 1253594, + -272194, -3706020, 1879048, -3730716, 1506460, -6158446, -310311, 3062849, 1533840, 2309619, + 1632088, 748935, 1896765, -424665, 510027, -2055142, -4094178, -2676302, 2939368, -184147, + 1260573, -81604, 2326262, 991064, -996969, 1173063, -337155, -2857227, 1299228, -684510, + -831613, 796180, 388695, 446677, -1028108, 1629403, 1264331, 1828582, -728534, -199716, + 914828, 1079111, -326954, 596464, -1428614, 958851, -476741, 267899, 503048, 645856, + -1600412, 31139, -183073, -82141, 208306, -139586, 404801, -828392, 74625, 292595, + -566936, -125628, 133681, -170725, 498216, -53150, + }, + { + 1439888, -10503879, 18849538, -16837882, 6079526, -226560, -2202781, 4646618, -3427384, -1596654, + 14389751, -2695092, -9942312, 23148800, -1541893, -12309376, -4720169, -13445932, -13636521, 2697240, + -6056978, 5246303, 7348152, -3357591, -929324, 0, -3679713, 457414, 1148904, 3269544, + 368830, -2723546, 6288369, -1876901, 2494839, 1390496, 2700461, 914291, -2657511, -3553012, + 6778532, 2498597, -1729261, -1374926, 1165010, 1890323, -792421, -1717987, -1378148, 2517388, + 258772, -110595, 491774, 267899, 2192581, -3550327, 671626, -1098438, -2972117, -2383170, + -572841, -229781, -2224793, 1045825, -617938, 475131, -2442763, 236760, -11811, 706522, + -110059, 35433, 1355599, 292595, -541166, -1330366, 1844689, -478352, -844498, 308701, + -202400, 768262, -982474, -1360431, -78383, -176631, -709207, 648003, -719944, -34897, + 123480, -481036, -617402, 55835, 418222, 297963, + }, + { + 1522566, -23489714, -2512019, 4335233, -383326, 211527, -163209, -17180, -855235, -1266479, + -1136019, 2514703, 851477, 8068633, 29431800, -9019968, 899796, -328028, 23042500, -562104, + -1964411, 10259066, -5940477, 2908230, 9436580, -9803263, 2030446, -380105, -5142150, 4391067, + -5345624, -2136746, -4993973, -2359548, 215822, 11167452, -8543764, 1058710, 4337380, -150324, + 1070521, -5425618, 5906, 5296769, 2767033, -2969433, 1387811, -2154463, 3473555, 2437394, + -1210107, -158914, 227633, 56371, 155156, -1150514, 109522, 4444218, -1955821, 417686, + 846645, -623844, -1484985, -743029, 2278480, -3379066, 1952600, -1053341, 522912, -625992, + 384936, -919660, 186831, -607738, -461709, -246424, 627065, -437550, -294205, -1338419, + 731218, -184147, -1068373, 722091, 163209, -1128503, 395674, 83215, 216359, -416612, + -752693, 30065, 432718, -1044214, 107374, -330176, + }, + { + 6174553, -164789312, 37383396, -20360292, -3465502, 861678, -3962644, -5585068, 3416647, 3339874, + 1745367, -12641699, 8035347, -8646306, 8256538, -1856500, 6923488, -1192390, 8275865, -4898410, + -3824132, 11334956, -9509594, -6643778, 7295002, 1273995, 7428146, 11209865, -10294500, 2616172, + -403190, -1865090, 5890548, 2515240, -4821101, 2843268, -3455301, 4575214, 8040716, -4355634, + 3059091, -2570001, 4911832, -2676302, 1665911, 1402844, 85899, 172872, 343597, -2146410, + 2267206, -2787434, 1060857, -172336, 1349157, 839129, -2600066, -495532, 4042638, 2581812, + -1101122, -2529736, 239444, 681289, 2586644, -120796, -789737, 876173, -25233, 555125, + -565862, -709207, -566399, 1023276, 1146756, 904091, 1424855, -1081258, 204011, 58519, + 195421, -410169, 803696, -188442, 838592, -897111, -57445, 231928, 430570, 682900, + 33823, -221191, 100932, 438624, -352187, 33286, + }, + { + 57982, -4245575, 2516851, -960999, 2796561, -796180, -173409, 2977486, -1235340, 1066763, + 839666, -1462436, -5263483, 1451699, 41908680, -11023570, 633508, 8048232, -3686693, 5851356, + -645856, -11940546, 4933844, -4225711, 9958419, 7201587, -3369939, -6492380, 3270081, -15667504, + 1767916, -3786014, 1632625, 5148055, -2081985, -10507101, 1921998, -2386391, -509491, 1354525, + 2147484, -8551280, 971736, -1300838, 75699, -25770, 1218697, 1138703, 2653753, 2082522, + 383863, -309238, 2436320, 1942399, 280784, -638876, -2810519, 2882460, -1782948, 1083406, + -1281511, 440234, 456877, 302258, 1057636, -1759863, 1394791, -1300838, -1603633, 642098, + -1216550, -1183264, -40265, 137439, -996432, -134218, 843961, 344134, 149787, -1269700, + 701153, -951872, 54224, -332323, -292058, 250182, 94489, -37044, -31675, 515396, + -4832, 408559, -222801, -257698, 351650, -306016, + }, + { + 32914482, -192530496, 29567628, 2070174, -671626, -2081449, 2874944, -17228724, -2805151, 4769025, + 7348152, -1474248, 5456219, -6284611, 3522410, -7757785, -10525354, -4655745, 4293894, -10115722, + 463320, 2615098, 3006477, -974958, 1296543, -1234803, 2085744, -2285996, -193810, -2331630, + -1402307, 3504157, -6475737, 1043677, 578747, 816044, -2182380, 3906810, -4890894, -5237713, + -2159295, 5250598, 779000, -2026688, 2876554, 5022428, -2958696, 1357747, 4638028, -1155346, + -2113124, 2792803, 3053722, -6526740, 2985002, 229781, 2198487, -3245922, -1199907, 1436130, + -1551020, 1003949, 1003949, -980326, -608812, 545461, -23622, -357556, -1294933, 715649, + -982474, -199179, 521839, -39192, -280784, -987843, -25233, -222265, -310848, -229244, + 382252, -801548, 631897, -199716, -563714, 645319, -358093, -391379, -210990, -305480, + 769336, 358630, -608812, -750546, -373125, -210453, + }, + { + 405338, 9408126, -2710124, -5427228, 1475321, -198642, 459025, 1118302, -4605279, 268435, + -4467840, -506269, 5479305, -2233920, 34357592, -14354318, 12166569, 8405788, -4321811, -3892851, + 348429, 16661789, 1084479, 3024731, 9983115, -5123359, -7842611, 15855946, -20434918, 17966922, + -9467182, 8184597, -2344515, -6901476, 9310415, 1896765, 3687766, -6345278, 536334, -4396973, + 4144107, 2471217, 127238, -3284039, -3092377, 2731062, -2888366, 1321239, -1573569, -879395, + -3722663, -1812476, -252866, 76236, -9664, -2216203, -1016297, -302258, 706522, 26844, + 447213, -859530, -1029718, -737124, -1163936, -828929, 830002, 1452773, -82678, 1189169, + -792958, -274878, -46171, 1344862, -715112, 472983, -81604, 557272, -1696512, 215285, + -1355062, -623844, 687195, 827855, 1300838, -331786, 807991, -488016, 708670, -262530, + -428960, -413391, -853625, -522912, -126702, -101469, + }, + { + -27146340, -166404752, 31345746, -10421738, 2876018, 2264522, 4806606, -2688650, -1129040, 5962489, + -9355513, -10014790, 163746, 2932389, 2172717, 4673462, 5899138, 9403294, -3950296, 3180960, + 3708168, 123480, 6438156, -673773, -2644089, 7274601, 1196685, 212601, 4996658, 2139431, + -90194, -1494112, 244276, 50466, -2985539, -876173, -949725, 2153389, 2247342, 966368, + 9036611, -1573569, -71941, 549219, -1719598, 2720325, 3105798, -1457605, -1882806, 3434363, + 436476, -394063, -1635846, 125628, 2376728, -3453154, 401579, -784368, 529892, -2429341, + 371515, -1014149, 1109712, -598074, 894964, 937914, 1377074, 714038, 375810, -641561, + -840203, -169651, -430034, -493921, 1854352, -417686, 287226, -150861, 504659, 1566053, + -913754, -415001, -62277, 297427, 270046, -148176, 1950452, -277025, -733366, 363462, + 255551, -1312649, -584652, 948114, 102542, -245887, + }, + { + 2964064, -5957120, -4115653, -13325673, 1088237, -5916318, 11445014, -1739462, -828929, 1814087, + -6579890, -188442, 5024575, -18859738, 11241540, -7445326, 15942382, 6413997, 20907364, -87510, + -317291, 13817447, 2430415, -2070174, 619549, -1807108, 11439645, -8602283, -11678016, -523986, + 1685238, -6018323, -86973, -4544613, -1702418, -3084860, -5277978, -828929, 149250, -3867618, + -373125, 5935108, -1311039, -1074279, -1361505, 1975685, -2815351, -1251446, -4032438, 1596117, + 60666, 1284195, -1183800, 1930588, -994822, -1063541, -1679869, 1145146, 2720862, -3682398, + -2022393, 696858, -1768990, -3258270, -876710, -926102, 539555, 1037772, 1300301, -1447941, + 999117, -1000727, 830539, 1054415, 914291, 1013075, 717260, -797790, 1179505, 1241246, + 70330, 353261, 296353, 1631014, -715649, -586263, 376883, -26307, 818191, -911607, + -357556, 325881, 13422, -205085, -434329, -33286, + }, + { + -18111340, -108955808, 35307852, 1924682, -2878165, 21946746, -24517820, 6134824, 9286256, -3210488, + -175557, -3925600, 9802726, -3336653, -2380486, 4121021, 863288, -534723, 8431558, 9349070, + -10792179, 8902930, -3604551, -1612760, 2141578, -3010772, -9096204, 1989107, 2214593, -3093987, + 1973001, -2018635, -2455111, 447213, -4721780, -4974646, 3391414, 2043868, -6141267, 2528662, + 1646583, -5464809, -460098, 1446867, 1307818, -202400, -3068754, 2206003, -1217623, -1074, + -1468879, 3359201, -1190243, 1222992, 1913408, -905164, 1059246, 1164473, 900869, -2179696, + 2891050, -1468879, 448287, -1248762, 2462090, -147103, -1428614, -2567317, 1034013, -1236414, + 764504, 2142652, -76773, -316217, 20938, 1016834, 133144, 569620, 865436, 685584, + -238371, -662499, 1168231, 875636, -973884, 881542, -293668, 551903, 76236, -341450, + 162672, -85362, -765578, 256087, -183073, 571768, + }, + { + 2572149, -34711924, -2742874, 107374, 284542, 2419677, -2497524, 1644973, 1245004, 2852932, + 3541738, -972273, 6032819, -11056320, -34237332, 14189498, -788663, 10913512, -11547556, 2335389, + 4261145, 4536023, -5516349, -14799920, -3045132, 7989713, 5723044, 5545340, 2568391, 4012036, + -7674033, 1023276, 2146947, 4705674, -5275294, 3133179, -4972499, 3517041, -602906, 2387465, + -3271691, 5572720, -3459059, -1590212, 948114, -1512365, 5840082, 748935, 1626182, -198105, + 2813741, -1023276, -2008971, -1140851, 254477, -915902, 584652, -1460826, 890669, -3626563, + 1843078, 287763, -3682935, 2100776, 1428077, -357019, -739271, -38655, -2506650, 749472, + 690953, -1721208, 599148, 858993, -676457, -372052, -274878, -1628866, 3221, 75699, + 357019, -853625, -1176284, 1449552, 367757, -378494, -1039382, -417686, 216896, -615791, + 49392, -794569, 404801, -95026, -108448, 573915, + }, + { + -44829796, 138064944, 4753992, -9088151, 4566087, 12741020, -156229, -1297617, 5296232, 9003325, + 8496519, 229781, 4020090, -7423314, -3081102, 13042742, -15730318, 10679973, -396211, 5882495, + -7219840, -2083596, 4197257, -135291, 6805913, 18298708, -3741454, 10650982, -848793, -6227703, + -1289027, 130460, -166430, -989453, 4831302, 282394, -1921998, -399432, 3266323, 1623498, + 4050691, -345745, 5050345, -2375117, 4407710, -6472516, 1244467, 671089, -2191507, -1445793, + 4065187, 2176475, 2532420, 2265595, -1642825, -2689723, 2364916, -1460826, 205622, -1367410, + 496606, -1677722, 255551, 467078, -2873870, -1341640, -159451, -670015, -952946, -443992, + -739808, 556735, -1403381, -595390, 759672, -207232, 1386201, 1283658, 379568, -1492501, + 346282, -335544, 627602, 292058, 448287, -1129576, -30065, 106300, 295279, -522375, + -4832, 86973, -149787, 304406, -90194, -111669, + }, + { + 28991, -56263536, 4855998, 1784022, 2403571, -1366337, 1588601, -1234266, 4627291, -3017215, + 1429687, -942208, 4173635, -21740588, 65863860, -10782515, 9598715, -14721537, 13034152, -5261872, + -2394981, -5070746, -768799, -8506183, 522912, -4475356, -1075352, 7723425, -13931263, 1277216, + 4493073, -4706211, 11704323, 594853, -4830765, -553514, 2323041, -5563057, 3503620, 3442416, + 5866926, -2814814, -2499671, -3564286, 1491964, -2700461, 5810017, 1399086, -2308008, -1405528, + 172872, 2298881, -2018098, -1927904, 932545, -2619393, 1879048, -265214, 539555, -1551020, + 1376537, -1020055, 947577, -23622, -332323, 1452773, 706522, -1275605, -1341104, 1516124, + -477278, -2018098, 1906966, 37044, 251792, 445603, 482110, 802085, 646393, -1086090, + 388158, -677531, -76236, 752156, -671089, 294742, -1038308, -344134, 41876, 299574, + 210990, -234076, -740345, 354335, -172872, -86436, + }, + { + -2943663, 140153904, -12937515, 7214472, -139586, -25290914, -7543573, -1482838, 2612414, 109522, + 4485020, 2984466, -7778186, 5973763, 570694, 1130650, 9280887, 5904507, -5235565, 2570538, + -2954938, -185757, 7045894, 510564, -468151, 2464238, 4533338, -6961068, 5971079, -4881767, + 6611566, -830539, 1087164, 948651, 3451006, -3903052, 2273112, 2084670, 2801393, -4371203, + 3247532, -8877161, -1303523, 8783745, -685047, 1524177, 1058710, 1946157, -1428614, -3393024, + 229244, 1532230, -995359, -2065879, -775242, 345745, 757525, -1919850, 1683627, 1741609, + -1666447, -602369, 1586990, -559956, 2615098, -341450, -376883, 1129040, 1376000, -499290, + -365072, 915365, 938987, 972273, 603443, 133144, -53687, -275952, 840740, 234613, + -1641214, 743029, -802085, 2047089, -557272, 122407, 342524, 758599, -346819, 1258425, + 631897, -176094, -228170, 543850, -1611, -557809, + }, + }, + { + { + -672162, 8099772, -1726577, 3850438, -5966247, 1116692, 107911, -2057826, 1301912, -1527935, + -4624606, 5226975, 8764955, -2592013, -3837553, -8995272, -844498, 3478924, -10261214, 2120103, + -14893336, -6441914, -8136816, 12438225, 9858024, 13008919, 2206540, -8272644, -2031520, 5342940, + 2024540, -3976603, -2867965, 7124814, 4791573, -1884417, 1311039, 7588134, 2148021, 492848, + 1285806, -1366337, 590558, 1947231, 500364, 3102577, 2881386, 2904472, 130997, -1643362, + 1593970, -340913, 909459, -1042066, -1407676, -374736, -314606, 1080184, -241592, -165356, + 2260764, 694711, -117575, 1579474, 1414118, -1628866, 985158, -907849, 461172, 403190, + 22549, 395674, 208843, 187905, -864899, -98784, -555661, 92879, -114890, -1207960, + -12885, 631360, 377420, -104153, -477278, -54224, -354335, -243739, 292595, -423054, + 615254, -245887, -368830, 171799, 679142, -72478, + }, + { + -1400696, -59488520, -11166378, 12288975, -4335233, 410169, -1659468, 5028870, 455803, -503048, + -2690797, -3753265, 3964255, -1169305, -4583267, 4040491, -2368675, 2854006, 4113505, -215822, + -1738388, 4921496, -528818, 6756521, -5080410, 4921496, 3191161, -1867774, 1476395, -1895154, + 92342, -1992865, 3469797, -1819992, -1473711, -4928475, 3199751, 171262, 649614, 3729642, + 1017370, 2490544, -2379412, 1483374, -717796, 1066763, -4882841, 2048163, 477278, 1324461, + -205085, -2011655, 875636, 2716567, 755377, -1001264, -2218888, -448287, 317828, -849330, + -580357, 1588601, -204548, -853625, 1531156, 1180579, 1830193, 121870, 1436667, -356482, + 1131724, 490163, 1037235, -752156, 305480, 221728, -303332, -112206, 1254131, 108448, + -306553, -578210, 156229, -751619, -11811, -104690, 542777, -353798, -40265, -349503, + -175020, -111132, -4832, 288300, -184147, -40265, + }, + { + 128312, 19513110, -2139431, 4908611, -6460168, -906238, -610959, 2343979, -989990, 823023, + 1862942, -1969243, 5151277, 10192494, 3557844, -8710194, -9047349, -10752451, -9578314, -6038187, + -2021319, 3597035, 474594, 3040837, -2959769, -595390, -4024921, 4530654, 2178622, -795643, + -2895882, 1995549, 3727495, -3301756, 2265059, -721018, 2967823, 1938641, -1584306, -3299609, + 3075197, 1646583, 73551, -318364, -249108, 1937567, 2751464, -3964255, 513249, 1000191, + 1832340, 337155, 778463, 735513, 49392, -1649268, -1174674, -1560147, -1158567, -1099512, + -451508, -877247, -2242510, 2057289, -593242, -834297, -1318555, -210990, -541166, 149250, + 666257, 17180, 443992, -19864, 120259, 139050, -588411, -317291, -648540, 217433, + 118112, 592169, -722091, -1066763, -166967, -69793, 216896, -18254, -562104, -245350, + -302795, -12348, -212601, -149787, 188442, 282931, + }, + { + -1553168, -23553064, 2400350, 2604898, -549756, 358093, 304943, -1360968, -1551020, -1152125, + 1433445, 1075889, 1128503, 3215320, 9009768, 6761889, 7631620, -4003983, 17542794, -343061, + -9290014, 6838125, 478889, 5575405, -3332358, 1748589, -1978369, -2663954, -3521873, 3174518, + 2390149, -8730058, -11458973, 2068027, 1956895, 3661460, -6547678, 3013993, 1774358, -964220, + -1596117, -1716376, 1202054, 3248606, 1909650, -1981054, 239444, 74625, 765041, 1386201, + 1213865, -1532767, -1067299, 701153, -155693, -310311, 1453846, 1195612, 974958, -392990, + -1514513, 286152, -1012539, -915365, -70867, -741419, -25770, -810138, 566399, -37581, + -128312, 85899, -1392106, -217970, -635655, 92879, -197032, -146566, -511638, -702227, + -148176, 139586, -609885, 226560, -49392, -96637, 207769, -340376, 62277, -254477, + -435402, -218506, -157840, -426812, -100932, -98247, + }, + { + -19149648, -88432304, 405338, -23536958, 6380174, 871342, -2187749, -1529008, -1682554, 1916629, + -8174934, -381715, 4855998, -3430605, 1171989, 2646774, 2515777, 8640937, 298500, -1513439, + 3445638, -903554, 456340, -3423089, 1502165, 6153078, 5663452, -1692754, -2367601, -369367, + -326418, 3977677, 2001455, 411780, -88584, 1013075, 783832, 214212, 4983236, -1177895, + 1007170, 1160178, 274341, 2399813, 1966558, -2267206, 1047435, 993748, 403727, -1996623, + 1158567, -1673427, 1056562, 737124, -6979, -977105, -163209, 140660, 2090039, 2268817, + -789200, -1159641, 362388, 1726577, 1364189, -501437, 92342, 1103270, -25233, 557809, + -360777, -396748, -58519, 944893, 766652, 749472, 547071, -409096, 330712, -170188, + 114354, -177704, 25770, 260919, 774705, -599148, 191126, -23622, 331249, 231928, + 292595, -31139, 555125, 128849, -257698, 301185, + }, + { + 1052267, 1037772, -4230543, 3415573, -186831, -457951, 490700, 1960116, -1062468, 96100, + 1377611, 211527, -2958696, 2583960, 31993212, -5610838, 4437238, 3971771, -2792266, 4974109, + -3760244, -3173444, -239981, -6312528, 8713415, 8797167, -11938398, 1299228, -3699041, -11854647, + -1460826, -1900523, 2486249, 2660195, -919123, -4435091, -4696547, -5025112, -1871532, 2837363, + 794032, -5568962, -2156611, -788663, -1442572, 21475, 2327872, 1879048, 1969243, 2050310, + 359704, 881542, 686658, 2058363, -237297, -947040, 344671, 1374926, 178241, 509491, + -406411, -1037772, -192200, -986769, 787590, -432718, 796716, -583042, -1022202, -1360968, + -597000, -469762, -129923, -987843, -488016, 802085, -268435, -509491, 346819, -2147, + -593242, 132607, -215822, -468151, 13422, 145492, 188442, 428423, -144955, 46708, + 201327, 164283, 110059, -569620, 395674, 77309, + }, + { + -37250252, -47542604, -13663365, 5913633, 5103495, -753230, -2136746, -3665755, -10623602, 8581345, + 1218160, 5039071, -2935073, 3949759, -812286, -6245956, -12579422, -204548, 274341, 208306, + 2415382, -2473364, 5143760, -3042448, -1562831, -469225, -1691143, 2283849, 1219234, -1623498, + -2803003, 300648, -561567, -4248260, 1115081, 2153389, 551366, 293132, -1200980, -2420751, + -4019553, 3628174, 2355253, -865973, 2077690, 629213, 1326071, 1746441, 3619047, -1209033, + -1560684, -301185, 3651796, -3520800, 667331, -388158, 391379, -1455994, -1100049, -383863, + 194347, 861141, -135828, -162135, -198105, 200790, -224949, -505196, 721018, -1930051, + 5906, 233002, -427349, 64425, -289373, 197569, -455803, -1387811, 17717, 642098, + -983011, -70867, -243203, -445603, 238908, 35970, 301721, -166430, -515933, 79994, + 350577, -391916, -399969, -383863, -255014, -162672, + }, + { + 1012002, 5258651, 659814, -1293322, -931471, 190052, 605590, 335007, -2186138, -655519, + -1553704, -1029718, 4914517, 5617281, 17663054, 16325708, 4723927, -6082211, -5435281, -10746008, + 12556874, 12702903, -2164664, 4257387, 2145336, 5122822, -4704063, 7098507, -7807714, -1155346, + 6314139, 1648731, 914291, -1487669, 2608656, 4125853, 1527935, -5677410, -2659122, -791885, + 1444183, 2656437, -1818919, 897111, -309238, -1119376, -4797479, 1120450, 623307, -1240172, + -4555350, -1335735, -806380, -344671, 776852, -3773129, 805306, 265214, -209917, -883690, + -134218, -730144, -1430224, -301185, -581431, 98247, -264141, 65498, 607201, 964220, + -369367, -135828, -34897, 831613, -182536, 142271, -197569, 119185, -1399086, -260919, + -1129576, -64961, 475668, 842887, 399432, 183610, -178778, 537945, 20938, -394600, + 13959, -351650, -201327, -796180, -387621, -170188, + }, + { + -750546, -154165696, -13037373, -3441343, 5174362, 4028679, 1362578, 1375463, -54761, -3607773, + 3317862, -6655589, -2019172, -7694434, 3866008, 6589554, 3471407, 6519224, -4254702, 4088809, + 2230162, 7266011, -491237, 1070521, -921807, 1510755, 5117991, 1058173, 1485522, 1863479, + -1801202, 355409, -1438814, 2858301, -2159295, -722091, -4027606, 1156420, 2354716, 2582349, + 5912023, -2049236, 467078, 688269, 387621, 442382, 1791001, -1319629, -122407, 857383, + 1120450, -759136, -1263794, 2095944, -627602, -1894081, -15569, -606664, -90194, -272730, + -1494112, -148713, -329639, 483184, 714575, 965831, 1602560, -119722, 197032, -68183, + 310311, -1517734, -94489, -321586, 236223, 640487, -216359, 155156, 398358, 1091459, + -952946, 19864, 406411, -753767, 631360, 527207, 868657, 75162, -452045, 84826, + -81068, -760746, -60666, 6442, 81068, 459025, + }, + { + -3481608, -13944148, -2214056, 4312684, -1625645, -3280818, 4918275, -1227824, 105764, -669478, + -5713917, 817118, -4394289, -5257577, -1744831, 2352032, 10744934, 7331509, 10056129, 4922570, + 2673617, 12439299, -3963181, 2698850, -2635499, 7796977, -2748242, -9070434, -5611375, -3407520, + 1891396, -4408784, -2804077, 565862, -5282810, -1939715, -5490042, -2640331, -668404, -1899986, + -235149, 3606699, 1904281, -3801583, -257161, -1204202, -2547989, -93952, -101469, -2405182, + 562641, -1410897, 2214056, -1581622, -6442, 1511292, -3116536, 1415192, -452045, -2353105, + -571231, -807991, -162135, -2073932, -1825898, -265751, -21475, 52613, 759672, -574989, + 906775, 72478, -49392, 635118, 880468, 231928, 1102733, 338229, 794569, 599685, + 942745, 27917, -31675, 793495, -222801, 854699, -147640, -107374, 321586, -580357, + -747324, 3221, -34360, -30602, -63351, -316754, + }, + { + 13470091, -108068360, -530428, 3369939, 3449396, -2848100, -20938, 381715, 5044976, -3097208, + -1052804, 1480153, -820339, 1804960, 3142842, -3698504, 4594005, -580894, 9077413, 5386426, + -113280, 1984812, -1239635, 725850, -5184026, -461709, -5869610, -811212, 1206886, -3405372, + -506269, -276489, -891743, -1479616, -2530273, -1961726, 1222992, 150861, 335007, -2086817, + 648540, -3369939, 641024, 195421, -469225, -216359, -1540820, -3221, -867047, 1814087, + 740882, 943282, -1395328, -772557, 1930051, 1355062, 1822140, 485868, -449361, 138513, + -504122, -166967, -197569, -208843, 843961, -938450, -1302449, 467615, -1171452, -1312113, + 1522029, 672162, 792421, -74625, 508417, -66035, 38118, 627065, 868657, 445603, + -291521, 488016, 119722, 722091, -76236, 569083, 52076, -199716, 242129, -48318, + -132607, -313533, -150861, 311922, 235686, 335544, + }, + { + -1854352, -35290672, 2795487, -1976759, -135828, 384936, 2903935, -477815, 955093, 2490007, + 3628174, 1999844, -1246614, -20082730, -11445014, 6892886, -82678, -1750199, -5870684, -1631014, + 8762807, 2063732, -7794829, -11811697, 901943, 11972758, 4312147, -4486630, 6924024, -338229, + -2367064, 3840238, 9338870, -2034204, -565862, -4273493, 3240553, 715649, -812823, 867583, + -1634235, 1789391, 1229971, -2045478, 161061, 111132, 4076461, 1038845, 1005022, 1991254, + 2138357, -1907502, -955093, -353798, -1658394, -790811, 636192, -1089311, 1073742, -1502165, + -353261, -152471, -31675, 840740, 463856, 2684, -930934, -1249836, -263067, -894427, + 624381, -756451, -317291, 499827, 587337, -928250, -1265942, -622233, -67109, -127775, + 820339, -1250909, 11274, 295279, 443455, 238371, -133681, -265214, -260382, -512712, + -304943, -217970, 107374, 385473, -185220, 259309, + }, + { + 54735064, 5855114, -3375844, -11770895, 1616518, -11902428, 13007845, 8614094, 2398202, 7861938, + 3318936, 4257387, -6338835, 7341710, -4109210, 3583613, -3874597, 1550483, 674847, 6641630, + 885837, -162672, -2880849, 4080219, 3603478, 11574937, 10167798, 2668249, -2974265, -2505577, + 1696512, -2352568, -2756832, 51003, 2721936, -1917703, -1656247, 75699, 3329674, 377420, + 4984847, 379031, 1869385, 1618666, 1690607, -4334696, -623844, 3474092, -755377, 2639258, + 1682554, 5933498, 333397, -357019, -2215130, -1670742, 124017, 829466, -462246, -644245, + -420907, -341987, 381178, -563714, -3323768, -522375, -1134408, 1086627, -1440962, -1127966, + 1163399, -728534, -893890, 605054, 123480, -779000, 1433982, 1370095, 84289, 254477, + -307627, 307090, -79994, 814433, 315143, -624381, 262530, -24159, 188442, 66035, + 67646, -272730, -235149, 330712, 25770, -44560, + }, + { + 189515, -47492676, -1525787, -216896, 3083250, -166430, 2461016, 1541356, 2522220, -1915019, + -1540283, -8135742, 4955319, -1845225, 32744830, -4731980, 2320893, 548682, -383326, 7927973, + -3995393, -6731825, 3809099, -5281736, 87510, -3235184, 7122667, -4596689, 3921305, -4201015, + -2367601, 2875481, 5220533, 1631014, -3285650, 2017561, -21475, -4902705, 4852240, 4066797, + 2085744, -785979, -4281009, -979253, 2298344, -1117228, 1302449, 202937, -1603633, -1031866, + 1767379, -1009854, 543850, -1681480, 137439, 650688, -1124745, 1967632, 82678, -2477123, + 736587, -365072, 1367410, 84289, -502511, 1292248, 402653, -993748, -830539, 468688, + -393526, -259846, 798327, 389231, 391379, -237297, 1683627, 708133, 32749, -560493, + -499827, 78920, -76773, 394063, -433792, -148713, 52076, -878321, 130460, 309775, + -329639, -125091, -325881, -110595, 17180, -695785, + }, + { + 22257594, 81151256, 16648904, -10296110, -8891656, -20868710, 2258616, -5661841, 4328254, 3380139, + -417149, 4917738, -8169565, 6298570, -838056, 4678830, 1031866, 1503775, -3492882, 5547487, + 3579318, -4389457, 5006322, -1949915, 5542119, -1271847, 7817914, -3440269, -665183, -1928440, + 5076115, -373125, -3741990, 5568962, 824097, -337692, 199179, 1768453, 5066988, -1257889, + -5513665, -1778653, 451508, 3505230, 5382131, 625992, 2880313, -2554432, -1069984, 1802276, + -2117419, 55298, -2101850, -683974, -1628866, 967441, 16643, -863288, 2212982, -85362, + -1522029, 1879585, 358630, 1382443, 156766, -121870, 779537, 1028108, 297427, -759136, + 912681, 1029182, 1135482, 864899, 1182190, -197032, -219580, 638876, 93416, 84289, + -1154809, 192200, 1010391, 11274, 528818, -171799, 115964, 35433, 289373, 893353, + 662499, 256624, 84826, 161061, -149250, -275415, + }, + }, + { + { + 338766, 11468100, -85362, 12635794, -2105071, 809601, 376883, -3152506, 2251637, 2455111, + -2436857, -4841502, 2400887, -2562485, 2160369, 3549791, 4614406, 7903814, -11732777, 9545565, + 230854, -2819646, -3886409, 7685307, 2353642, 12468827, -1174674, -2557653, 3643206, 5343476, + 342524, -237297, -3255048, -1398012, -577673, -4908074, -563178, 3723737, 956167, -147640, + 3390340, 1206349, -1503775, -1170379, -1982664, 2114735, 1391033, 716723, -252866, -2624225, + 540092, 1202591, 1547262, -1412507, -1083406, 221191, -1260036, 540092, -488016, -63888, + 1626182, -868657, -681289, 1164473, 255551, -1793149, 1010391, -848256, -178241, -246961, + -696322, 33286, -622233, 62814, 468151, 900869, -176631, 312459, 493921, -503585, + 397821, 366146, 260919, 201327, -134218, 272194, -66572, -93416, 304406, -139050, + 320512, -177167, -312996, -185757, 372052, -72478, + }, + { + -3518652, -15643882, 7195681, 8136816, -634045, 1467268, -3068217, 3123515, -4690105, -2044941, + 2568391, -1319092, 4110284, 922881, -2527052, 2652142, -2685965, 4859756, 6015639, 2995203, + 132070, 5437966, -2347200, -3022046, -4598836, 7256347, 2893734, -3329674, 1300301, 1238024, + 771484, -662499, 4499515, -5312875, -719944, -643171, 4043712, -897111, -2673617, -2372970, + -632434, 3852049, -2094333, 1814087, -274341, 529355, -4432406, 1066226, -1529545, 2476049, + 1880122, -1169305, -552440, 967978, 1211181, -937377, -1106491, 620623, 37581, 518617, + 241055, 800475, -596464, -47245, 2000918, 398895, 886374, -807991, 943282, -122943, + 171262, -454730, 561567, -590558, 919660, 96637, -306016, -730681, 682900, -41339, + 653909, -257698, 181462, -605590, 554588, 342524, 174483, -122943, 242666, 196495, + 110059, -25233, -235149, 231928, -337155, -180389, + }, + { + -611496, 16965658, -3350075, 27094802, 6881612, -53687, -1544041, -1216013, -1392643, -143345, + -2273648, -4177393, -422517, 2792803, 6080063, 625455, 26307, 1145146, -2905009, 1581622, + 4448513, -117575, -4231617, 941672, -3534221, -1158567, -2101313, 3926137, 3210488, -957241, + -3811784, -1073742, -505732, -1720134, 3048353, -5470715, -484258, 2854543, 989453, -3413425, + 619012, 1798518, 23622, -1235877, -405874, -4832, 1759326, -2228551, 1322313, 256087, + 1280974, 496069, 1108102, 25233, -126165, -622233, -768799, 428960, 1429687, 341450, + 124554, 125628, -1244467, 660888, -1593433, 88047, 162672, -768799, -1641751, -419296, + 17180, -599148, 555661, 805843, 847182, 543313, -379568, 468688, -64425, 515396, + 613107, 210453, -731218, 29528, 171262, -544924, 174483, -107374, -566936, -43487, + -78920, 330712, 75162, -26844, 69256, 282394, + }, + { + 631897, -21998286, 372052, 1123671, -518080, -119185, 221191, -1305133, -2718714, 52076, + 2243047, -1053878, -1340567, 3745212, -5917928, -14259291, 791885, -3435437, 4071629, 8172249, + -3952981, 1343788, -2138357, 1024887, -8230231, 9030706, 2875481, 84826, 500901, -1352915, + 124017, -3642132, -7036767, 1062468, -1660005, -877784, -3581466, 3008625, 994822, -707059, + -2164664, -1925756, -1917703, 222265, 2332704, -1506460, 1903744, -717796, -1032403, 54224, + 472446, -1896765, -550293, 1541893, -26844, 665183, 1376537, -301721, 848793, -90194, + -791885, 411780, -483721, -127775, 492311, 599685, 138513, -1523640, -81068, -333934, + -766115, 207769, -325881, 881005, 202400, 512175, -579284, -306553, 57982, 333397, + -194347, 132607, 37581, 339302, 159451, 344671, 100395, -474594, -402653, -226560, + 85899, -23622, 198105, 5906, -124554, 4295, + }, + { + 22000434, -35092032, 3755949, -21879100, -1902671, 1545651, 2774012, 2645163, -4634807, -2850785, + -2714956, 6445672, 7474317, -1226213, -3052648, -3599720, -5333813, 5884105, -1057636, -1360431, + 1891396, -4563403, 3082176, -158914, -2570001, 1414655, 3703873, -3117073, -3351685, -2039036, + -3485903, 1997697, -1624571, -1326608, 1214939, 421981, 3950833, 1268089, 2530810, -1681480, + -2314451, -892816, -1540283, 1822140, 293132, -2081985, 3064459, 1216013, 288837, -1527935, + -214212, -847182, 428960, -1058710, -578747, -1109712, 821949, -1493575, -1102196, 944893, + -422517, -525597, 331249, 813359, 184147, -616328, 79457, 544387, -282931, 160524, + 547608, 433792, 466541, 149250, 323733, 912144, 379031, -96637, -230318, -799938, + -358630, 7516, -53150, -173409, 49929, -401043, 383863, -215285, -13959, 71404, + 299574, -152471, 64425, -156229, -139050, 310848, + }, + { + -443455, 2449205, 2391760, 2476586, -1459215, -132607, 87510, 1400159, 66572, 777389, + 630286, 1483911, -2289755, 543850, 17360258, -8707509, 7851200, 2079301, -6437619, 3854733, + 4509179, 4364224, 392990, -11274826, 2377801, 11197517, -18303004, -4359392, -3008088, 2529736, + 9610526, -1645509, -344671, -1767379, -3110093, 480499, 584116, 510027, -969052, 25770, + 595390, -3073586, -1945620, -248571, -377957, 764504, 771484, -1184337, -520228, 1009317, + -568009, 114354, 306016, -51540, -833761, 126165, 609885, 350577, -66035, 479426, + -95563, -1510755, -136902, -924492, -907849, -1071058, 682900, 135291, 419833, -645856, + 427886, 1294396, 578210, -702764, -250182, 344671, -573915, -166430, -25233, 137976, + -23622, 958315, 432718, -126165, -251256, -101469, 331786, 622770, -54224, 70330, + 130997, -322123, 302795, -10737, 477278, 202400, + }, + { + 25504590, 60108068, 10658498, 10463614, -4906464, 1564442, 2530273, 7072201, -7331509, 3566434, + -3628174, 8421357, -741956, 5262409, -1055488, -4045859, -4986994, 4456566, 1277216, -2829847, + -1168231, -1546188, 3425773, -5683853, -1960653, -1884417, -1481227, 2799245, 145492, -894964, + -2822331, 928787, 2173254, -2937758, 309775, -352724, 1135482, 480499, 1061394, 2643552, + -2557116, 1439888, -1456531, -3065533, 114890, -1678795, 4699768, -209917, 1006633, -1834488, + -741956, 489626, 1946694, -1731409, -584116, -2043331, -489626, 282394, 246961, 13959, + 1896765, 800475, 561567, 1212255, -501437, 137439, 867583, 304406, 446677, -1747515, + 411780, -107911, -672162, 130460, -63351, 909459, -194347, -1022739, 309775, 1112933, + -504122, 205622, -251256, -657130, 188979, -205085, 150324, 28454, -118648, 159988, + -75699, -117575, 123480, 26844, 137976, -56371, + }, + { + -243203, -945430, 4118874, 3004330, 478352, 766652, 176094, 513785, -1510755, 1762547, + 1829656, -3114925, -2236604, 2627446, 11338177, 9795747, -678068, -8479339, -945430, -12976170, + -4036733, -2834142, -6909529, 3281892, 220654, 7605850, -2196876, 6544457, -3101503, -5739150, + 701690, -7867843, 1584843, 2931852, -3412889, -1623498, -2661806, -4436701, 1627256, 585189, + -123480, 1079111, -1493575, -438624, -1236414, 843424, -3016141, 2809446, 63888, 209917, + -1991254, -393526, -1192390, -1628330, 1802813, -2587718, 1759326, 1400696, 302258, -947040, + -1801739, -2084670, -782758, 753230, 108985, -48318, -575526, -1048509, -927713, 759672, + 333934, -316217, -656056, 543313, -86436, -447213, -1068373, -203474, -480499, 137976, + -191126, 199716, -89657, 48855, -613643, 31139, -560493, 269509, -295279, -152471, + 544924, 11274, 223338, -98784, -275415, -138513, + }, + { + 20175072, -103939816, 14732275, 7258495, -5296769, 94489, -2229625, 311922, -762894, -6082211, + 3194382, -3862249, 1491427, -7236483, -2963528, -3976603, -4379256, -3344706, -7275138, 1611687, + -1298154, 4246112, -4632122, -874563, 949188, 984621, 3040837, -1581085, 513785, 2741263, + -2323577, 765041, -1945083, 3578782, -1374390, 3787624, -2617783, 44023, -294742, 1364726, + 3709241, -2886755, -1029182, -1245004, 915365, -796716, -1630477, -1495722, -159451, -3033858, + 1489817, 312996, -547608, 3569118, -1806571, -1074279, 727460, 1445257, 1239098, -420370, + -1639604, 655519, -602369, -425739, -501974, -1087164, -243203, -293132, -767725, -449361, + 1086090, -384936, 282394, -399969, -300111, -23622, -433792, 516470, 372052, 621697, + -1030792, 334471, 753767, -576599, 348429, -393526, -404264, -354335, -192737, 447750, + 236760, -254477, 88584, -355409, -17717, 380641, + }, + { + 2881386, -11203422, -7611219, 4316442, -3814468, -7745437, -202937, 1381906, 1403381, -1086627, + -828392, 3723200, 1486596, 3925600, 7512972, 7556995, 1525787, 1733556, -999117, 1690607, + 1605244, 4626754, -3612068, 8353712, 331786, 5771363, -4912906, -3395172, 564251, -5756867, + 776315, -437550, -2537252, 1715303, -2129230, 2234457, 1504312, 1619203, 294742, 2211908, + -105227, -320512, 3147137, -1204738, 1433445, -200790, -2217814, -66035, 1533840, -1204202, + 884226, -1144072, 2688113, -2384244, 111132, 1383516, -3429532, 720481, -537408, 130997, + 1308354, -427886, 1093069, -863288, -1272921, 2147, -651224, -666257, 332323, -33286, + 44560, 284542, 339302, -137976, 103616, -358630, 842350, 279173, -194884, -152471, + 601295, -66035, -474594, 89121, -679679, 641024, -51003, -399432, -229244, -273804, + -131533, 350040, 606127, 154619, 67109, 38655, + }, + { + -8587250, -122555816, 7443715, -766115, -3865471, -15089294, 9040906, -1979980, -2096481, -3488587, + 5120675, 3520800, -5576478, -374199, 11104638, -2413235, 5071820, 228707, 7349226, 763430, + -2039573, -950798, -3078418, -577136, -4195110, 1886028, -1726040, 3723737, -1639604, -4481262, + -488016, 874026, 332323, -1621887, 4645007, 4823249, 226560, -675384, 2051921, -1509144, + 1326071, -99858, 3037079, 282931, -746251, 1067836, -369367, -126702, 1017907, 2272575, + 518080, -179315, -1818382, -616865, 685584, 53687, 1159641, -318901, 1283122, 414464, + -2204392, -587874, -677531, -584116, 748398, 54761, -130997, 596464, -1001801, -794569, + 357556, -580357, -44023, -1159641, -352187, -299037, 354335, -461709, -432181, 417149, + -328565, 354335, -272730, 256624, 314606, -219580, -52076, 89657, 201327, -352724, + -402116, -266825, 15569, 69793, 71404, 164283, + }, + { + 605590, -34475164, -446140, -618475, 383863, -3247532, -613643, -2514703, -1666984, -1307818, + 65498, 621697, -2899640, -4037806, 10673531, 2490544, -2748779, -3569655, -4524748, -4192962, + -6292127, -8296803, -4268124, -10916733, 6344204, 7602092, -8114267, -8461086, 3705483, -2100776, + 6276558, 5854578, 5796059, -4460861, -381715, -957778, 8527658, 2869038, 695785, -419296, + -789200, 432718, -192200, -1610613, 1741072, 2186675, 2052458, -1728188, 2749316, 2116882, + 243739, -1152125, -964757, 181462, -1266479, -965831, 1042603, -59056, 1975685, -99321, + -964220, 1611, -68719, -654983, 579821, -133681, -946503, -556735, 1255204, -739808, + -110595, -609349, -770947, 39728, 943282, 71941, -255551, -103079, 414464, -395137, + 183610, -461172, 677531, -238908, -390305, -292595, -129923, -260382, -60130, -130997, + -85362, 537, -60130, 75699, -514322, -64425, + }, + { + -41774464, -131440496, -79994, 7297150, 11222750, -22089016, 3813931, 8312909, 7086696, 8069707, + -4057670, 1704565, -7837242, 11555610, -853625, -2477123, -5081483, -2268817, -2364916, 4862440, + 2490007, 2605972, 1999307, 3785477, -7366943, -984084, 3786551, -4032438, -1153736, 526670, + -883153, -5204427, -3054259, -3536906, -1981591, -2952790, 2294050, 3139621, -811749, -3940633, + -374736, -4081830, 1781338, 1739999, 1212255, -1179505, -1148904, 3353296, 1540283, 3796751, + -662499, 4578435, 415001, -3148748, -2864206, -1197759, -1146219, 1304060, 140123, 734976, + 198642, -768799, -901943, -482110, -935229, 689879, -773094, 2110440, 322659, -304943, + 811749, -259846, -805843, 2684, 5906, -700617, 610959, 30602, -73551, 449361, + 76236, 606664, -512175, 581431, 214212, -100932, 711891, -29528, 93952, -104690, + -184147, -512712, -596464, 222801, -173409, -103616, + }, + { + -685047, -47115256, -2860985, -402116, 975494, -399969, 1634235, -1445793, 885300, 1348620, + 2231236, -1267552, 3564823, -10630044, 17233556, -5194763, -3784940, -881542, -3114388, 13166222, + 4576288, -3011309, 3796214, -858993, 6245420, 230318, 8555038, -7186554, 8991514, -1103270, + 1558536, 1789391, -3431142, 656056, 112206, 359704, 1648194, -5317170, 1117228, 2989834, + 491237, 1603097, -1131724, -210990, 2175938, -1228361, -44023, 886911, 512175, -202400, + 161061, -1940788, 2408403, 404264, 1927904, 839666, -1377074, 1877975, 32212, -919123, + 1668058, 1471026, 1508607, -359167, -1104344, -71404, 115964, 369367, -560493, 118112, + 689879, 552977, -75162, -222265, -53150, -855235, 846109, -730144, -406948, -71404, + 273267, 790811, 107911, 344134, -354335, 376347, 491774, -630823, 567473, 142271, + -196495, 86973, -129923, 130997, 144955, -472983, + }, + { + -30983358, 648003, 18820546, -1037772, -5949604, -5323075, 15311022, -985158, 8549132, 6125697, + -5675800, 1682554, -5153961, 2610266, -4226248, 5583458, -6600291, -5543192, -4933844, 6799470, + 2767570, -7645042, 3412352, 294742, 6038724, -4919885, 2160906, -2522757, -612570, -2034204, + 743029, -2229088, -4998268, 4713727, 1988570, 699543, 47245, 1610613, 3190087, 696858, + -4964982, 771484, 2340220, -469225, 2185602, 2090039, 3440269, -2056216, -396211, 2630668, + -870268, -197569, -2156074, 977642, -624381, 316217, -355409, -387084, 1903207, -515396, + -1436667, 1465658, -530965, 938450, -320512, -518617, 365072, 838056, 460098, -1045288, + -226560, -178778, 11811, -539555, 466541, 110595, -365609, 416612, -351114, -142271, + -717260, -331249, 725313, -297427, 656593, -411243, 230318, -68719, -206158, -7516, + -39192, -9127, 122943, 49392, -376883, -24159, + }, + }, + { + { + -522375, 9284109, 188979, -998580, 8771397, 5369, 1612760, -1326608, -714038, 3173981, + -2054605, -2498060, -4225174, -4168266, 2767570, 2790118, 5922760, 2502892, 5071820, -891743, + 925565, 1739462, -4715337, 4202626, 2619393, 9888088, 998580, -2797098, 2459943, 1109175, + -298500, -182536, -2445447, -2189360, -3089155, -2475512, 1174137, -276489, -783295, -656593, + 4918275, 2589865, -3223910, -1592359, -2094333, 1098975, 1162862, -1002875, 831076, -1079111, + -148713, 1627793, -502511, 17180, -341987, -53687, -749472, -221191, -547608, 741419, + 128312, -406948, -69256, 815507, -690416, 580357, -563714, 228170, -555661, -71404, + -699006, 220117, -627065, 5369, 298500, 217433, 459025, 188442, 347355, -274878, + 507343, 311922, -54224, 745177, 21475, 214748, -173946, 159451, -197032, 282394, + -121870, -201863, -112743, -43487, -113280, 102005, + }, + { + 5241471, 2391223, -18442052, -9990094, 8675297, -77309, 125628, -3168612, -1422171, 2843268, + -4636417, 903554, 3040300, 659814, -697932, -1835025, -2850248, 4870493, 3309272, 1682554, + 961536, 6698539, 156766, -6043019, 4326643, 860067, 140123, -2469069, 2174327, 3002182, + 668941, -3688840, 1382443, -2593087, 355945, 161061, 306016, -165356, -1821603, -3056406, + 122943, 1156957, 1576790, -465467, 1661616, -2609730, -92342, -3303904, -754304, 2528662, + 1960116, 651761, -44560, -458488, 306553, -1436130, 1832340, -595927, 61203, 1549946, + -414464, 852551, -434329, 101469, 602906, 746787, 121333, 435939, 113280, 556198, + -322123, -875636, -128312, -93416, 389768, -1074, 210990, -815507, 118648, 264677, + 407485, -91805, 166430, -372052, 721555, 231391, -88584, 81604, 206158, 441308, + -24696, 3221, -195958, 224412, -121333, -46171, + }, + { + -588411, 11979201, -2495376, 19432042, 9093520, 462246, -1595580, -1663763, -622233, 292058, + -3052111, 4251481, -8801462, 4814659, 163746, 4438312, 91268, 1366873, -1694365, 6147172, + 8182450, -2861522, -9254044, 1910187, 242666, -5289252, 6700149, -1669132, 3476239, -1228898, + -791885, -1879048, -3443490, 309238, 1925756, -2907156, 1521492, -381715, -862752, -341987, + 1903207, 1312649, 571231, -2525441, 74625, -501974, 679679, 83215, 16106, 25770, + -21475, 843424, 1774895, -209380, -280784, -404264, -289910, 464393, 1180042, 805306, + -427349, 374736, -335544, -1064615, -717796, -419296, 967441, -699006, -1074816, -631360, + -156766, -375810, 334471, 1163936, 447750, 759136, 236223, 249108, 176094, 66572, + 863825, -217970, -510564, 183610, 34897, -414464, -265214, 129923, -396748, -158377, + 169114, 368293, -66572, 176631, 20938, -74088, + }, + { + 606127, -27400280, 2920578, 1416266, -342524, 426276, -705448, 872415, -3135326, 1728724, + 119185, -2509335, -4738423, 7477001, -12943958, -6190122, -6518687, 14408005, -19574850, 17627620, + -1852205, 728534, 456340, -1724966, -630286, 1961726, 6063420, 2622078, 1025960, -2682207, + -816581, -2419677, -3835943, 211527, -1418413, -2880849, 4461934, -2297271, 2842732, -1005022, + -1094143, -2338073, -1230508, -1831804, 2585570, -1320703, 2502892, -347892, -535797, -474057, + -846645, 547608, -1178432, 1264331, 914828, 1495722, -85362, 62814, 7516, -147103, + -261993, 657667, -141734, 146029, 311922, 1131724, 563714, -1138166, -869194, 374736, + -767725, -480499, 475131, 363462, 374736, 1026497, -600759, -489626, 23622, 355945, + -52076, 256624, -146566, 491237, -20401, 230854, -222801, 27917, -268435, -533650, + 87510, 42950, 243739, 186831, -29528, 53687, + }, + { + -15289010, 4668630, 1110786, -25407952, 7561290, 1623498, 4391604, 421444, 1483374, -7581691, + 5359046, 1174137, 6376416, 1074279, -1588601, -4714801, -5559835, -1895154, -165356, 4308926, + -2676302, -3240016, 3740917, -2578054, -3303367, 842887, 314606, 781684, -2467459, -3332358, + -2319819, 535260, -4335770, -612570, 2578591, 2748779, 1293859, 1717450, 646929, -1386738, + -2533494, 258772, 784368, -722628, -1679869, 1078574, 3139621, -126165, 134218, -1883343, + -2169495, 1705102, -455803, -1504849, -273804, -920734, 536871, -687195, -1538135, -449898, + 1101659, -598611, -261993, 785442, -46708, -1038845, 74088, -33286, 248034, 241592, + 401043, -396748, 805843, 11274, 754841, 199716, 329639, 338766, -718333, -65498, + -703838, 28991, 288300, -241592, -383863, -46171, -80531, 245350, -502511, 104690, + 29528, -20401, -179315, 44023, -100395, -4832, + }, + { + -722628, 10588705, -448824, -1300301, 224949, -752693, 756988, 1129576, -920734, 1866163, + -52613, 1298154, -2841658, 2091112, 9003862, -4714264, -3766150, 5734318, 3123515, -1791001, + 1454383, 4485557, 2284923, -2967823, -5443871, 5526549, -8917426, -5243082, -281320, 9596031, + 3785477, -2336999, -2454037, -709743, -1141388, 2519535, 1651952, 2272575, -1403381, -1753957, + 2025614, -2763812, -688269, -285615, 579821, 2109903, -1280437, -1961726, -887448, 1864016, + 164819, -804770, 927176, -1368484, -264677, 828929, 52076, -85362, -421444, 155693, + -839666, -677531, -449361, 41876, -1717450, -542777, -57982, 175557, 881542, -602906, + 493921, 1246614, 530428, 111132, -139586, -121870, 28991, 319975, -118648, -243739, + 825171, 364535, 416612, -347355, -1611, -150861, 277025, 345208, 230318, 39728, + -16106, -104690, -27917, 327491, 206695, 139050, + }, + { + -4601521, 100942472, -4599910, 16691854, 5476620, 170725, 461172, 10558103, -4527970, -815507, + 1315871, 5994701, 3768297, -337155, -1505386, -6338298, 1991254, 1175747, 2147, -3388729, + 510564, 1968169, -3272765, -3356517, 881542, -1548873, -534723, -914828, 1460289, -128849, + -3506841, 789737, 2566780, 16106, -1201517, 12348, 570157, 1228361, -1275068, 2981244, + 1404991, -2594160, -724239, -1948305, -1069447, -937377, 4692789, -3344706, 1076963, -2013803, + 836982, 1372242, -1939715, 346819, -652298, -570157, -960999, 1261110, 458488, -54761, + 1685238, 945967, 852014, 1042066, -104153, -206695, 803159, 985158, -476741, -469225, + -467078, -371515, -256624, 8590, 54224, 995896, -191126, -387621, 158377, 573915, + -14496, 436476, 235686, -484258, -392990, -344671, 410169, 203474, -574989, 6979, + 24159, 190052, 274341, -75699, 475668, -370441, + }, + { + -932008, 2965138, 3187403, 1058173, 1470489, 652835, -162135, -1297617, -193274, 1675037, + 2065342, -3281355, -2820720, 2927020, 10534481, -10830297, 1017907, 4214437, -2783676, -10894721, + -4299799, -4181151, -4730907, 5827197, -4997195, 92342, 8604967, 3122441, -1297080, -6221797, + -989990, -4271345, -306553, 2102387, -3724811, -3167539, -3919158, -2778844, 5351530, 1421634, + -2495913, -1313186, 1257352, -829466, -1062468, -1126355, -743029, 2683818, -608275, -620623, + -892279, 1288490, -2300492, -294742, 601832, -576599, 158914, 1090922, 22549, -21475, + -1157494, -1966558, -543313, -113817, 937914, -52076, -632971, -586263, -1139777, -259309, + 634581, 868657, -1029182, -119185, -27380, -477815, -474594, -268435, -235686, -55298, + 104690, -26307, 82141, -351650, -316754, 137439, -442382, -190589, -307627, 367757, + -36507, 296353, 221191, -72478, -272730, -79457, + }, + { + -26783416, -43832824, 3020436, 17286170, 3008088, -2488934, -593242, -4086662, 539018, 1276142, + -461709, -7261716, 4277788, -1432909, -10364293, -1934346, -3137474, -9436580, 421444, -3956202, + 3704946, -1138166, -1008780, -1418950, 1312113, 1124208, 2188823, 270046, -1061394, 2716030, + -359167, 383863, -3670587, 3133716, -2551211, 4081830, -491237, 22012, -648003, 2491618, + -1514513, -142271, -807991, -649614, 181462, -1814087, 469762, -1657321, 1398012, -5099200, + 1479616, 184147, -450435, 1865090, -1013075, -458488, -257161, 1908576, 1689533, -928787, + -1490354, 252329, 573378, -853625, -1435593, -492311, -1600412, 370441, -839129, -620086, + 566399, 99321, 177704, 49929, 26844, -545998, 3758, 446140, 421981, 317291, + -258772, 177167, 217433, -200790, 193274, -300648, -912144, -305480, 161598, 387621, + 76236, -129923, -102005, -39192, 36507, 217970, + }, + { + -1504849, -10931229, 812286, -8355859, 1975148, 76236, -10180683, 6007586, 756988, -2008971, + -1111860, 649614, 5772436, 2132988, 14244259, 4090956, -3653407, 5173288, -4387846, 1981591, + 1879585, -567473, 1961190, 5243082, 1061931, 4413079, -2910914, -2151242, 1119913, -2778844, + -3036005, 2001992, -3453691, 4790499, -848793, -908386, 6183143, 2524367, 1060320, 1100585, + 1913945, -1559073, 3853660, -2033667, 1478543, -1153199, 801548, -1765232, 746787, -129386, + 1626719, -132607, 1910187, -1877975, -220117, -1193464, -61203, 215822, -1120450, 281857, + 1115618, -40265, -421981, 442382, -1443646, 270583, -493384, 249108, -399969, 331786, + -491774, 545461, 103616, -12885, -44023, -195421, 99321, 74625, -142808, -257161, + 27917, 597537, -512175, -37581, -481036, -79457, 151398, -133144, -472446, 55298, + 66035, 506806, 685584, -191126, 281857, -76773, + }, + { + 5197984, -128006128, -3526168, -7405061, -4361003, 51540, 4121558, -3241627, -2365453, -4533338, + 5056787, 1340567, -158377, -2421288, 11687680, -4586488, 3366718, 9934796, 1305133, 2122251, + -1533840, -5073967, -5502390, 1577864, -3476776, 743566, -668404, 3294240, -692027, -909996, + -295279, 576599, 971736, -2000918, 6569153, 4425964, -2631204, 1044751, 1893007, -1095754, + 1853815, -882616, 1620276, 780610, 1144072, 535797, -69256, -744103, 1854889, 449361, + 871878, 144418, -1140851, 644245, -975494, -912144, -49929, 600222, 2290828, -227096, + -2065879, -759672, -191663, -284542, 718333, -22549, 1002875, -1332514, 379031, -861141, + -109522, -366683, -938987, -251792, -586263, -567473, 471910, -465467, -396211, 30602, + -199179, -114354, 98247, 69256, 547608, -574452, 50466, 396211, 22549, -470299, + -178778, -168041, -246961, 60130, 99858, -83752, + }, + { + 710817, -35078608, 2401961, -2961380, -1762547, -1540820, -3984119, -2379412, 4592394, -2487860, + -2374043, 566399, -768262, 3970697, 7342247, 342524, -4166118, -90731, -1371705, -6803765, + -5498632, -12199855, -3807489, -6178848, 2208150, 3814468, -14165339, -3799972, 4995584, 4633196, + -3015604, 7816304, -3612604, 703301, -3177739, 4562329, 2754148, 7417946, 2192581, -4287988, + 1268089, 2623688, -2438468, 1073205, -1464047, 2481417, 1076963, -2282238, 3285113, 1080721, + 347892, -295816, 528818, -373662, -854699, -1530619, 1051193, 371515, 1108638, 115427, + -425739, -362925, -809601, -1326608, 1454920, -417149, -933082, 371515, 10201, 526670, + 212601, -890669, -894964, 253940, 294205, 530428, 530428, -551366, 184147, -123480, + -300648, 331786, 280247, -358093, -242666, -464930, -542777, -34897, -57982, -488016, + 141734, 60666, -190052, -58519, -275415, -76236, + }, + { + 12172474, -200636176, -5315022, 422517, 16965120, -6309844, -2665564, 3429532, 9074729, -1962800, + -1987496, 1648194, 477815, 3354906, 1873143, -3872987, -5190468, 2654290, -4773856, 1102196, + 4976257, 1717987, 3518652, -1657321, -2350958, -3633542, -1740536, -3178276, -475668, 2275796, + -3133716, -3751654, -299574, -4841502, -2479270, -267362, 370441, 3742527, -3907883, -3577708, + 1290101, -7024956, 2010582, 1922535, -2423972, 1095217, 2203318, -463856, 3506304, 2122251, + 6442, 364535, 1694365, -2768107, -1592359, 390305, -2181307, 261456, -304406, 2066953, + -9127, -980863, -612570, -876710, 289373, -140660, -526134, 963683, 788663, 441845, + 37581, -191126, -188979, -223875, 426276, -33286, -39728, -760746, 707596, -113817, + 194347, 71941, -111669, 68719, 228170, 251792, 184684, 230318, 306016, -523986, + -638340, -27380, -333934, -195958, -202937, -37044, + }, + { + 1262720, -45207752, -9862319, 3234647, -647466, 3095061, -5308043, 661962, -33823, 3170760, + 1826972, 2328409, 1268626, 158914, 702227, 585726, -4924180, -3676492, 1426466, 10100689, + 1970853, 898722, 4023848, 2187212, -568009, 5339181, -707596, -4295504, 5089536, 6161668, + 6390912, -4431333, -3456375, -1181116, 3448322, -3957276, 2867965, -1074279, -8590, 146566, + 2187212, 2100776, 841277, -1097364, 1606855, -3245922, 1271847, 1673427, 1915555, -1211718, + 132607, -1356136, 2104534, -476741, 1859721, 403190, -862752, 1456531, 162672, 556735, + 2406792, 766115, 1096827, -13959, -526134, -1024887, 226560, 314069, 19864, 195958, + 481036, 236223, -806917, 323733, -213138, -317291, -386547, -406411, -750546, -15569, + 1171989, 234613, 73014, 354872, -278636, 167504, -26307, 66035, 237297, 180389, + 187905, 65498, -222265, 171799, 121870, -155156, + }, + { + 25807384, -66765804, 1622424, 1548873, -1163399, 4035122, 9870372, 2988224, 7151121, -796180, + 2790655, 1396938, -5924371, 2235531, -7796440, 6132140, -3018825, -406411, -5648956, 2190433, + -4824859, 2889976, -3666292, 5437966, -1189169, -4147865, -1078574, -449898, 2851322, -2092723, + -656593, -1424855, -5260261, 1796370, 3477313, 675921, 70330, 2732136, 362925, 2786360, + -2216740, -2042794, 3839164, -2361695, -936840, 3401614, 1126355, -877247, 718870, -156229, + 1541893, -102005, -537945, -179852, -288300, -279173, -457951, 1301912, -701690, -177167, + -377957, 365072, 1060320, -933082, 45097, -752693, 355945, 468151, 278099, -354872, + -641024, -390305, -97174, -929860, 441845, 238371, -37044, -164283, 160524, -814433, + -47245, -28454, -303869, 149250, 650151, -146566, 32749, -121870, -122407, 5906, + -406411, 121870, 39728, -80531, -405338, 83215, + }, + }, + { + { + 637266, -1719061, -9946607, -18080738, -3961571, -86436, 3935264, 891206, -3400004, 1265405, + -4231617, 405874, -3188476, -2973191, 6120866, -1853278, -2076617, -1936493, 8549669, -1577327, + 807454, 2630131, -8502425, -7605850, -8978629, -2083596, -1476932, -1177358, 3311420, -5262946, + -8252780, -1579474, -3642669, -1577327, -3264712, -1365263, 56371, -4364761, -3117610, 24696, + 3572876, 1723893, -1481227, 1292785, -645856, -268435, 1066226, -1179505, 1548336, 1930588, + -177704, -997506, -1450625, 1244467, 1293859, 1688996, 731218, 105227, -440234, 265214, + -494458, 10201, -212064, 326954, -41876, 1645509, -946503, 770947, 423591, 906238, + -111132, 57982, -33286, 147103, -388695, -358630, 138513, -132070, 590021, 147640, + 571768, 335007, -49392, 977642, -308701, -292058, -346819, 111669, -629750, 47782, + 19864, -242129, -137439, -83215, -181999, 214212, + }, + { + -4164508, 15015743, 2536178, -18487686, 3171833, -839666, 535797, -2308008, 1497870, 3030100, + -3570729, 3798362, 2077690, 2226941, -4669167, -7567196, -3435974, 4066260, -86973, -1433982, + -4221953, 847182, 3173981, -1650341, 6594923, 3172370, -2797634, -2610803, 5834176, 2679523, + -2696166, -4882304, 2537252, 1199370, 4531191, 761283, -2488397, -905164, -1404454, -1302449, + -223875, 199716, 2332704, -565862, 2244657, -1858647, 2158758, -2724620, -457414, 1362042, + -635655, 722628, 575526, -2100239, -491774, -938987, 2404645, -1225676, -446140, 358093, + -1167694, 103079, -387084, 425739, -242666, 562104, -317291, 574452, 48318, -156766, + -371515, -456877, 151934, -52076, -198105, 139586, 400506, -504659, 280784, 67109, + 75162, -68183, 322123, -175557, 384936, -349503, -201863, -147103, 162135, 260382, + -9127, 308701, 52613, 213675, -39192, 65498, + }, + { + 2610266, 27631136, -20401, -32210644, -25587804, 2003602, 2345589, 3320547, 1817308, 2634963, + 2149094, 11048266, -3944391, 8493835, -7936026, -2455111, -2748242, -3168075, -1648731, 4778151, + 4072703, -1610076, -4355634, 4543002, 2706903, -4488241, 6850473, -3213709, 1854889, -608812, + 1489817, 3837553, -303869, -1178969, 2942590, -40802, 3311420, 76773, -745177, -787590, + 2000918, 1953136, 1218697, -1510218, 1415729, -97174, 1569811, 1536525, 97174, 58519, + 538482, 93416, -403727, -1172526, 722091, 1406065, 941135, -384400, -118112, -63888, + -1326608, 536334, -519691, -768262, 311385, -206158, 968515, 95563, -241592, -905164, + -117575, -101469, 319438, 527207, -261456, 761820, 361851, 187368, 270583, -244276, + 295816, -324270, -562641, 112743, 114890, -123480, -83215, 571768, 34897, 106837, + 35433, -9664, -43487, -2147, -217970, -268435, + }, + { + -1184874, -36056252, -2736968, 499827, -1380295, 1106491, 631360, 2898029, -1421097, 3109556, + 1736241, -471373, -1901060, 7004555, -9124658, 8415452, -4366908, 7026567, -19830938, 11281805, + -1668058, 3112241, 4190278, 2709051, 5128728, 2178085, 4321811, -1602560, 1270237, 1463510, + -532039, 1214939, -884226, -1592896, 315680, 710817, 3536369, -4378719, 2408940, -692564, + 1563905, -1126355, 590021, -549219, 2245194, -1597728, 849330, -178241, 147640, 352187, + -340376, 1328756, -1045825, 623844, 255014, 1381906, 139586, 343061, -874026, -30065, + -113280, 835371, 615791, 1001801, 9664, 266825, 305480, -529355, -255014, 751082, + -424665, -284542, 188442, -423054, -206695, 571768, -219580, -238371, -325344, -197569, + -345745, 23085, -347355, -48855, -637803, 175557, 105227, 34897, -154619, -266288, + -6979, 11811, 46708, -83215, 69256, 15569, + }, + { + 1272384, 9699110, -6666326, -32237488, -5948530, -210990, -371515, -1610613, 5863167, -136902, + 7021735, -5069672, 4523675, 1761474, 6578816, -1292248, -10087804, -4001299, 2252710, 5381057, + -1381906, 195958, 2100239, -4874788, -5291400, -3051574, -1081795, 3979287, -711354, -1309965, + -837519, 56371, -1527935, 216359, 2667175, 5237713, -1500554, -229244, -315143, -3798362, + -3131031, 82141, 3755949, -978179, -1708323, 2342905, 1415192, -3224447, -6979, 1191317, + -133144, 1527398, -461172, -421981, 367757, 353261, 392453, 75162, -275952, 658204, + 984621, -906775, 229781, 355945, 312996, -352187, -755377, -391379, -217970, -759136, + 363998, -403727, 466541, -515396, 85362, -579284, -277025, -64961, -194347, 567473, + -368830, 394600, 460098, -405874, -289373, -255014, -358093, 326954, -168041, 299037, + -227096, 40265, 50466, 84289, -235686, -170188, + }, + { + 395674, 17570174, 526670, -1840930, 642098, -59056, 580894, 555661, -1510755, -140660, + -429497, 2251100, -2142115, -4363687, 4970351, -6233608, -13633300, 884226, -594853, -7346005, + -5248987, 1056562, 5109938, 4883378, -4069482, 1437203, 10917807, 10943040, -530965, 7961796, + 1209033, -4221416, 1947231, 1745367, -2637110, 1451699, 300648, 1147293, -2432025, -1585380, + 3182571, -297427, 2652142, 351650, 525060, 2428804, -523986, 83215, 1046361, 2371896, + -325344, -734976, 820876, -815507, 821413, 1070521, -464393, -654446, -439697, -216896, + -591095, 107374, -419833, 470299, -977105, -423054, -300648, -250182, 624918, -253403, + 204011, 236223, -155156, -287226, -55298, 341450, -216896, -47245, -49392, -31675, + 1028645, -516470, -88584, -255551, 106837, -171799, -26844, -170725, 29528, -345745, + -88047, 215285, -12348, 130460, -223875, -55835, + }, + { + -16291885, 71984728, -1174137, 14506252, -5688148, -565325, -1130113, 8448738, -2550674, 3690988, + 3383361, 1636383, 1409286, -2131915, 1141924, -2776696, 959388, -1107565, 623307, 900869, + 2330557, 222801, -2838437, 1345935, 2876554, -334471, -195958, -3023120, 1931662, 802622, + -88584, 3038153, 2239289, 1127966, -1141388, -791885, -1952063, 868120, 121333, 2882460, + 1397475, -1731409, 770947, -2245194, -1236414, -1117228, 1601486, -3862249, 1159104, -2225867, + 1668058, 1752884, -323196, 1702955, 949188, 1306744, -461172, 1670742, 578747, -630286, + 428423, 181999, 194884, 113817, 197569, 333934, 449898, 173946, -382789, 514322, + -55298, -285615, -454730, -39192, -591095, -27917, -70867, 297963, 482647, 347355, + -51540, 323196, 420907, -125628, -416075, -167504, 91268, -209917, -645856, -71941, + -8053, -174483, 23622, -172336, 462246, -186831, + }, + { + 50466, 3448859, -1302986, -1441498, -76773, -318901, -667867, 873489, 1178432, 297963, + 234613, -2661806, 469225, 2715493, 6943352, -20753282, 180926, 9047349, -3687766, -4153770, + 6242198, 795106, -3060164, 6350646, -4177393, -3859028, 8092792, 7589207, 3020973, -3465502, + -425739, 3092913, -318901, 273267, 346282, 1633698, -2410014, -2772402, 4468377, 2953864, + -202400, -266288, 113817, -2310693, -131533, 255551, 618475, 3029563, -584652, -1939178, + -1561221, 1806571, -938450, -63351, -195421, -66572, -358093, -153545, -47245, 637803, + 169651, -687195, -514322, 442919, 769336, -325344, -83215, -192200, -281857, 369904, + 34897, 849330, -191663, 207232, 155693, 3221, -195958, 72478, 374199, 177704, + -159988, 242129, 285078, -306016, 149787, 208306, -158377, -176094, -284542, 59056, + -712965, 123480, 22012, 197569, 238908, 154619, + }, + { + 20024748, 1301375, -778463, 14144401, -8578660, -3444027, 1137093, -3979824, 589484, 1301375, + 1410897, -179315, 10610717, 2454574, -8007967, 3470334, 1407676, -4130685, 7592966, 645319, + 3814468, -2901251, 2115272, -38118, 275952, 1269163, 838592, -111132, -2515777, 435402, + -1781875, -2269353, -2881386, 4954782, -2862596, 2158221, 1258962, 280784, -1761474, 46171, + -1891933, 511638, -1341640, -296890, -677531, -1840394, 461709, -1242319, 1872606, -4941897, + 1637993, -683437, -1636919, -515933, -597000, 479963, -115964, -105227, 848793, -276489, + -838592, 107374, 523986, -260382, -1104344, 666794, -528818, 277025, -204011, -355409, + 170725, 217970, 155156, -83215, 556735, 309238, 614180, 103616, 128312, 76773, + -97711, 327491, 117575, -391916, 5369, -11811, -390305, 14496, 300648, 45097, + -303869, -248034, -27380, 271657, 74088, 183610, + }, + { + 362925, -22987202, -11059541, -5557151, 10439992, 7371238, -9451612, 2984466, -4021163, -3965329, + -2275796, 1802276, 6103686, -2095944, 6933151, -3410741, -7414188, 3039226, -10173704, -11375221, + -3193308, -3657702, 2831457, 3259880, -3285650, 2612951, -2187749, -2229625, 3635690, 3785477, + -4653597, 295816, -5270462, 977642, 2573222, 1216013, 5781563, 2236067, 131533, 1355062, + 2036351, -2413772, 1941325, -4594005, 357556, -980863, 1114007, -1301912, 1759863, 263604, + 544924, 213675, 1802276, -1527398, 443455, -1068373, 1088237, 718333, -1214939, -1170379, + -988379, -909459, -375810, 1083406, -1056025, 672699, -125091, 930934, -265214, -191126, + -363998, -672162, -578210, -47782, -124017, -358630, -616328, -416075, 24159, 22012, + -158377, 577673, -544924, 48318, -198642, -396748, -77846, 231928, 107911, 312996, + -16643, 312996, 284542, -124554, 201327, -373125, + }, + { + -3969087, -144069840, -1796907, -3303904, -4836670, 11083700, -1814624, -4020626, 2208150, -2396592, + 3992172, -1148367, 2488397, 932545, 2060511, -7721278, 789200, 7709467, -3510062, 2040646, + 3977140, -1641214, -3461744, 2558190, -666257, 2448131, -2566780, 3894999, 2609193, 1166084, + 2354179, 913754, -704375, -290984, 2015413, -3834332, -3821447, -631360, -842887, -1285806, + 2866891, -1240709, -1604170, -1123134, -314606, -128312, -751082, -2042794, 456340, -2390149, + 257161, 2029909, -505196, 433255, -157840, 187905, -443455, 419296, 552440, -405338, + -575526, -180389, 401043, 241592, 724776, -590558, 760209, -879395, 1172526, -335544, + 249108, -350040, -667867, 341987, -1064078, -703301, -91805, -320512, 493921, 43487, + 63351, -51540, 52613, -131533, -81068, -375273, 14496, 220654, 75699, 116501, + 282394, 16106, -161598, 6442, 30602, -168577, + }, + { + -1374390, -31483184, 9801652, 1385127, 321049, 768799, -1481227, -3466039, 5324149, 346282, + -2556579, 857920, -769873, 1804960, 1221918, -1458678, -1823214, 1253057, 2163053, -1238561, + -1025423, -5015448, 1546188, -915365, -6801081, -1855963, -9481140, -4495220, -562104, 3350611, + -7486128, 2284386, -8280697, 1851668, -2871723, 4404489, 1637456, 7194070, 835371, -991064, + 4923643, 4302484, -2149631, 2069101, -2254321, -1044751, -2288144, -1219234, 3161633, -202937, + 1454920, 1065152, 2102387, -1481227, -952946, -1529008, 711354, 574452, 424665, -758062, + 934155, -82678, -1510218, -750009, 1519882, 261993, -44023, 804770, -757525, 395674, + 1174674, -190589, -460635, 1005559, 308164, 172336, 510027, -343061, 27917, -216359, + -143345, -18254, -150861, -252329, 115427, -364535, -314069, 279710, -30065, -402116, + 531502, 282931, -121870, -10737, 95026, 382789, + }, + { + 20386600, -180198576, -161061, -4854387, 9182640, -3641059, 1268626, -3644817, -2792803, -9501541, + -4030290, -1121523, -3552475, -4041564, -2910377, -2487860, -2494302, 1542430, -3263638, 2506114, + 3358665, 3502546, 1826435, -3194382, 454730, -1861332, 645319, -115964, -1452773, 2834142, + -738734, -832150, 2180233, 180926, 1200443, 1279900, -1782948, 503585, -4272956, -2539936, + 3848828, -4034048, 3981435, 1671279, -3685619, -1657321, -197032, -1476395, 2480344, -1022202, + -1173063, -637266, 393526, -2143189, -1464584, -46708, -1318018, -420907, -1034013, 1640678, + 428423, 41339, 303869, -520228, 95026, -83215, -200790, 621697, 689879, 646393, + -181462, -177704, 585726, -168041, 718870, 483184, 288300, -672162, 281857, -287763, + 149787, 5906, 358630, 274878, 19327, 94489, -98247, 45634, 134218, -470836, + -322659, 49929, -382252, -331786, -47782, 67109, + }, + { + -1348620, -42237244, -4064650, 3564823, 2414309, 7210177, -6246493, 875636, -915365, -3570192, + -3042448, 110595, -2846490, 9677098, 17425220, -3163244, -6888591, -2038499, 4782446, 3344706, + -6749004, -2395518, 3398393, 30065, -254477, 7770133, 3764002, 3546569, -1333051, 3339874, + 3768297, -1844689, 5005248, 1348083, 2406792, -855235, 4299799, 510564, -259309, -2356863, + 2917894, 2956548, 1156420, -833224, 1348620, -2954401, 2481417, 855772, -136902, -1061931, + 424128, -2751464, -261993, -1655710, 1069984, -626528, -46708, 2286533, 620623, 85899, + 1318018, -849867, -155693, 168041, 631897, -210453, 569083, 386010, -320512, -230318, + -324270, 213138, 382252, 213138, -417686, -92879, -760209, -119185, -474057, -309775, + 635118, -581968, -409096, -21475, -543313, -108985, -494995, 150324, -84289, -158914, + 238371, -29528, -308164, 331786, 165356, -190052, + }, + { + -9459665, -112986096, -9165460, -7443179, 2132451, -2537252, 1359357, 959388, 4322348, 555661, + 6078990, 4151086, -6429029, 3036005, -731218, 1702955, -686121, 7914551, -2740189, 100932, + -1326608, 7141457, -5304285, 5435281, -1776506, -5215701, -3502009, -15569, 8333311, -988379, + -1345399, 130997, -433255, -1901597, -3127810, -1646583, -1133871, 253940, -874026, 751619, + -1092532, -994822, 3360812, -1449015, -830002, 1141388, 66572, -1292785, 437550, -459562, + 1747515, -2170032, -1736777, -791885, -658741, -514322, -606664, 1065689, -1091995, 1282048, + 1975685, 896574, 590021, -395674, 692027, -435402, 427349, -533650, 182536, 191663, + -177704, 243203, -69793, -553514, 418222, 151934, 326418, 448824, 553514, -571231, + 653372, 168041, -683437, 88047, 275415, -62277, 259309, 212601, 143345, 534187, + -270046, 1611, 16643, -115427, -235686, 153545, + }, + }, + { + { + 223875, -19938848, 7463580, -11107322, -12297028, -475668, 3801583, 1117765, -5127654, 6509560, + -3183108, -4920959, -5560372, 4003983, 855235, 1280437, 736050, -6296422, 9284109, 3822521, + -2019708, -550830, -3447785, -11171747, -5424007, -6364068, 1483374, -3629784, 2430415, -9230958, + -5345087, -1430761, -4376572, 993211, -4408247, 890669, -3052111, -3111167, -1436667, 398895, + 88584, 5162551, -1931125, -781147, 2247879, -62814, 767725, 1446330, -1514513, 2904472, + 821413, -2739116, -147640, 657130, 227633, 1880122, 729071, 1123671, -1112397, -195958, + 390305, -591632, -207769, -121333, 598074, 1269163, 39192, 244276, -150861, 828929, + 783832, -1064078, 658204, 510027, -440234, -361314, -152471, 171262, 493921, 625992, + -55835, 463320, -204548, 621160, -393526, -198105, -236223, -35970, -361314, -20401, + 85899, -224949, -186294, -223338, -37581, 205085, + }, + { + 5721970, 18185966, -4121558, 61740, -10697153, -1610613, -3482682, 4082367, -397821, 1171452, + 1409823, 2397666, -2504503, 3959423, 1257352, -4899484, -6925635, 694711, 2214056, -4416837, + -4269198, -1532767, 5713917, 3091840, -570694, 6307697, -4001836, 2750927, 4302484, -72478, + -259846, -5553393, 2749853, 3550327, 2458869, 2240899, -4623533, 13959, -1658394, 259309, + -201863, -1673427, 2364916, -256087, 425202, -420907, 2226404, 386547, -201863, 118112, + -305480, 292058, -1142998, -1503775, 149250, -704375, 709207, -915365, -96637, -818191, + -438624, -579821, 617938, -393526, -147103, 1067299, -293132, 47782, 240518, -401043, + 227096, 29528, -33823, -236760, 118648, 357019, 12348, 370978, -353261, 421444, + -448824, 258772, 97711, -326954, 156229, -197569, -537, -114354, 53687, -59593, + 323733, 83752, 234076, -124554, 47245, 95563, + }, + { + -4377109, 51448876, -11337640, -53987204, -4511863, -2468533, 2865280, 4595615, 2171106, 5034239, + -474594, 7043210, 2556043, 9766219, -7280507, -3022583, -5626944, -8425115, 5867462, 2374580, + 2714419, -4674535, 527744, 3709241, 799401, -3630321, 1380832, 3332895, -1389959, 1421097, + 2177549, 1914482, 907312, -359704, 654446, 3170760, 875636, -1422171, 4295, -535797, + 2086817, -417686, 2846490, -237297, -56908, 67646, 1588064, 672162, 971200, -573915, + 2032593, 975494, -1867237, -797253, 21475, 1673964, 938450, -178778, -148713, 3758, + -1458678, -287763, -364535, -30065, 97174, 435402, 37044, 103079, -110059, -676457, + -15569, -51540, 516470, -34897, -75699, 797790, 299037, -11811, -101469, -20401, + -207232, -105764, -304406, 9127, 126702, 244813, -180926, 492848, 91805, 195421, + -199179, -244813, 86436, 73551, -292058, -14496, + }, + { + 1400159, -33422898, -8204998, -771484, 366146, 614717, 991064, 984084, 267362, 2196876, + 2752537, -408022, 48318, 2673617, -4786741, 2401424, 11509439, -16093779, -1326071, 3460670, + -1879585, 4886599, 2866891, 6683506, 1226213, 1094143, 1611687, 1384053, -1330903, -1054951, + 3768297, 1944010, -2757906, -2473901, 3184182, 1024887, 91805, -4338991, 862752, -2114198, + 2557653, -1226750, -623844, 1100049, 1998234, -490163, -1272921, -107911, -58519, 75699, + 1187559, 686121, -627065, 470836, -31139, 937914, 564251, 708670, -478889, -736587, + 392990, -532576, 826244, 644782, 627065, 319975, -1044214, 741956, -416612, -358630, + 441845, 55298, -660351, -447750, -117038, 227096, -23622, -218506, -121870, -645319, + -62814, -102005, -239444, -237834, -383863, -136365, 133681, 12348, -55298, 5369, + -154082, 91805, -106837, -101469, 4832, -177704, + }, + { + 15459198, -12566537, -6244346, -37846716, -1307281, -1108102, 358093, 957241, 555125, 7907035, + 882616, -1215476, -5547487, 2035815, 12425340, -5514738, -5803038, -3950833, 8030515, -784368, + 2115808, -225486, -4829691, 3404835, -6048925, -1994476, -391916, -1061931, -1082332, 719944, + -4063039, 2742874, 592169, -1282048, 3045669, 3773129, -86973, -1451699, 77309, -2683818, + -1364189, -1824824, 2560338, -431644, 42950, 268972, 849867, -1518271, -944893, 2397666, + -481573, 1036698, -1216550, 10737, 236760, 1377074, 280247, 51003, -114354, 1152662, + 657667, -629750, 157840, 543313, 92879, -45634, -803159, 258772, -355409, -839129, + 527207, 332860, 224412, -624381, -154082, -573378, -512175, -335544, 395674, 318364, + -95026, 97711, 257698, -491774, 312459, -426276, -369367, 209380, 207232, 246424, + -270046, 7516, 163209, 231928, -192200, -196495, + }, + { + 525060, 8813810, 4605816, 1519882, -799401, 108448, 363462, -248034, -845572, -1619203, + 1858110, 2414309, -2050847, -2747705, 906775, 412854, -16931834, -4551592, 490700, -5571647, + -4074313, 2011655, -842350, 7667591, 1378685, -6714108, 13054553, 11267310, 5126581, 4120484, + -1414655, 15569, 1587527, 1148904, -5891085, 2440078, -679142, 1195075, -3130494, 1580011, + -229244, -771484, 3799972, 798864, 501974, 1606855, -161061, 1446330, 1475858, 1056562, + -1568200, 357019, 1299228, -457414, 1035087, 966368, -406948, -951872, 916439, -1487132, + -452045, -471373, -22549, 625992, -413927, -380641, -453656, -68183, 114890, 279710, + -274341, 274341, -57445, -454193, -338229, 784905, -630286, -516470, -56371, 390842, + 467078, -179315, -104153, -246424, 238371, -246424, -20938, -207769, 55298, -374199, + -33286, 264141, -40802, -53687, -363462, 201863, + }, + { + 29704530, -11817603, 4632659, 8450348, 6938520, 229244, 2045478, 791885, 1452236, 1751273, + 4727149, -564788, -120259, -631897, 74625, 3119220, -4387846, -402653, 1154809, 3529926, + 1931125, -1811403, -661425, 2355253, 1938641, -2493229, -481036, -31675, -318364, -816581, + 2305324, 1036698, 768262, 1270774, -1679869, -144955, 75699, -1502165, 1711008, 2752537, + -471910, 663036, -832687, -2458869, -857920, 83752, 1095754, -2051921, -190589, -2132451, + 2939368, 418222, 465467, 1347009, 396748, 596464, 736587, 1445257, -49929, -227633, + -460635, 90731, 259309, -371515, 225486, 169114, 498753, 222801, -39192, 339839, + -206695, -117575, -814433, -25770, -357556, -314606, -124017, 274878, 706522, -12348, + -316754, 245887, 402116, -77846, -297963, 53687, -310848, -245887, -35433, -222265, + -264141, -88047, -178778, -31675, 51003, 206158, + }, + { + 1055488, -6589554, 4969814, -1761474, -684510, -941135, 324270, 456340, 1240709, 8053, + -1022202, -3017752, 4860829, 3586298, 3827890, -4384088, 1256815, -7325604, -7807177, 12590697, + -69256, -1074279, 2051384, 3481071, -2706903, 1813013, 2160906, 6410776, -5697274, 4031901, + -4061429, 4611721, 30602, -1078037, 2972654, 2889439, -4195646, 1518271, 133681, 3176665, + 1087164, -125091, -1644436, 89657, 592169, 106300, -844498, 1408749, 2544768, -3806952, + -1025960, 792421, 1174674, -1124745, -438624, 106837, 49929, -900869, -194884, -425739, + 1596117, -106837, -1549946, 825707, 729608, -201327, 185757, -604517, -31675, 710817, + -360240, 439697, 77846, 285078, 149787, 589484, -314606, 26844, -191663, -126165, + 261456, 192200, 311922, -88047, 194884, -111132, -415538, 430570, -75162, -300111, + -403190, -37581, -30065, 364535, -74625, 153008, + }, + { + -3096672, 21304112, 1639604, -2672544, 9241696, -3863323, 2623151, -930934, -1831804, -3226594, + 2330020, 7431367, 6067715, -6361384, -1609539, 7330436, 940598, 3380676, 1640141, -685047, + 2813204, 350040, 577673, -31675, -227633, 1615445, -944356, 962610, -37581, -949188, + -1435056, -4631586, -370441, 3944928, -1726040, 842350, 1753957, -593779, -256624, -1989107, + -217970, -357019, 66572, 181462, -1996086, -69256, -107911, -1188632, 1027034, -1331440, + -1468879, -758599, -650151, -1387811, -136902, 278636, 1040456, -1065689, 689342, -504122, + 447750, 90194, -646929, 159451, 104153, 289910, 122943, -466004, 108448, 263604, + 49929, -184684, 411243, -510564, -81604, 1161252, 661962, -268972, 136902, 329639, + -76236, 56371, 177167, -124554, -290447, 27917, 170725, -5369, 184684, -485331, + 139586, -243739, -28991, 190052, -73551, 206695, + }, + { + 290984, -35882304, -7435662, 7817914, 8085276, -982474, -807454, 329639, -4238596, -466004, + -2786360, 5137318, 4747550, 267899, -2425046, -1510218, -1855426, -6514392, -6893960, -11884711, + 2128156, -571231, -3706020, -1078574, 3914863, 723702, -11435350, 6120329, 1168768, 4154307, + -3831648, -2647311, -2318209, -429497, 1041530, 3441880, 602906, 758062, 2568927, 63351, + -63351, 382252, 834834, -3144453, -2114735, 1088774, -666257, -294742, 1576253, -358630, + -359704, 2062121, -340913, -466004, 581431, -6442, 110059, -106300, -79457, -1331440, + -1359894, -536871, -83752, 627602, -763430, 731218, -99858, 248571, -156229, -834834, + 153008, -664646, -554051, -504122, -117575, -63351, -367757, -573378, 139050, 890669, + -360240, 81068, -440234, 151934, -57445, -542777, 107911, 145492, 296353, 27917, + 310848, 90194, -28991, -15032, -11274, -123480, + }, + { + 3621194, -159454416, 1627256, 2433636, -12416750, 13092671, -4951024, -161061, 90731, -1567126, + 2195802, -894427, -1455994, 8123394, -8127689, 457951, -2035278, 2221572, -3254512, -2019172, + 10151692, -874563, 1102733, 31139, -1816771, 971200, 30602, 2285460, 2529736, 987306, + 410706, 153545, 296890, -742493, -3336653, -389231, -2487860, -3495030, 665183, -1725503, + 1901060, -204011, -2927020, 636192, -2451353, -341450, -733903, -282394, -1247688, -1883880, + 1653026, 1539746, -940598, 1176821, -375810, 879395, 173946, 32749, -301721, -711354, + -28454, -340376, 788127, 565325, -261456, 134218, -803696, 359704, 495532, 513785, + -79457, -505196, -360240, 60130, -594853, -599148, -616328, 22012, 279710, 117038, + 187368, -35433, 191126, 18790, -330712, -178241, -310848, 200253, 172872, 270046, + 82141, 39192, -147103, 138513, 126702, -114890, + }, + { + 1461900, -23519778, 1584306, 7801271, -3274913, 331249, -308701, -2182380, 334471, 3248069, + -3049427, 2767570, -818728, -3970161, -514322, 4832912, -5920076, 5893232, -5236639, 8052527, + -1985349, -2741263, 1132798, -1444720, -3967476, -2240899, -4401268, -9269613, 4263292, -3532611, + -1402844, -2995740, -3386582, -2263448, 555125, 2275796, 2765959, 7107097, -716186, 1619740, + 2583423, 5770826, 66035, -797790, -523449, -914828, -2843805, 19327, 789737, -100395, + 2152852, 245887, 2728378, -1653562, -122943, -1613297, -207769, 1213328, -11811, 328565, + 696858, -89121, -833761, 248034, 70867, 709743, -445066, 1038845, -761283, 76236, + 1277753, -77846, -67646, 364535, 57982, 14496, 229781, -131533, 547608, -420907, + -58519, -95563, -316217, 181999, -9127, -45634, 48855, 35433, 56908, -62814, + 404264, 145492, -310311, 228707, 267362, 166430, + }, + { + -40837084, -94333048, -2284923, -2640868, -349503, 8997420, -8059506, 2937758, -244813, -10627360, + -11349988, -12348, -1755568, 140123, -7822746, 332860, -7186554, 2607582, 3896072, -2187212, + 5157719, -2217277, 4013647, -2335925, 2261837, -3486440, 560493, 4447439, -3894999, 3390877, + 833224, 1846299, -572841, 2684355, -311922, 3966402, -3694209, -963146, -855772, -3428458, + 858993, 976568, 1287953, 4283156, -2018098, -3626563, -1439888, 1436130, 904628, 285615, + -2101850, -486942, -539018, -2385854, 145492, -2784213, 221728, -1125281, 146566, 557809, + 440771, 44023, -2684, 45634, 62277, 212064, -459562, 809064, 863825, 245350, + 245350, -238908, 268972, 27380, 683974, -89121, 419296, 215822, -4832, 42413, + -109522, -173946, 635118, 134218, -320512, 519691, -163746, -125628, 32749, -214748, + -180926, -423591, -27380, -303332, 61740, 84826, + }, + { + 1194538, -35817880, -8935679, -31675, 6197101, 2958159, -722091, -1422171, 796716, -447213, + -4713727, -1132261, -4303557, -10081899, 35818952, -2501282, -1503239, 1379758, 4393215, -2784213, + -8400956, -1852742, 5017596, 3884798, -1721208, 6033892, 5434208, 6860137, -3783866, 1970853, + 2557653, 174483, 6270116, 3743601, 2147, 934692, -168577, 1977296, -22549, -129386, + 3187940, 1341640, -120259, 1309428, -2343979, 835371, 1657321, -844498, -1506460, 1152662, + -1034013, -1839320, -692564, -106837, -763430, -178778, 133681, 1496259, 1317481, -304943, + -295816, -756988, 357019, -427349, -368293, 1721208, -146566, 165356, -314606, -481036, + -302258, 680752, 905701, -499290, -491237, -325881, 143345, -129386, -266288, -398358, + -156766, -316754, -290984, -444529, -135291, -225486, -267362, -38655, 51003, -283468, + 37581, -287763, 53150, 137976, 23085, -201327, + }, + { + -9782325, -110027936, -6330245, -12964359, -819265, -7437810, -2662343, 7006703, 548145, 1463510, + 7188702, -15032, -935229, -4689031, 8555575, 540629, 732292, 959388, 4660040, -4131759, + 7302518, 2201171, -3837553, 623844, 4354023, -6063420, -3582540, 674847, 5020817, 402116, + 585726, -3273839, 4422206, -930934, -5156645, -2536715, 379568, -2738042, 590558, -1596654, + -760209, 2438468, 1705639, 207232, 163209, -1359357, 1563905, -701153, -755377, 732829, + -251792, -2435783, -453656, -661962, -1155883, -614717, 493921, -894427, 389768, 1142998, + 1962800, 972273, -91268, 49929, 474594, 678068, -124017, -199716, 257698, -614717, + 496069, 350577, -35433, 294205, -252866, 770947, 206695, 442919, 514322, -301185, + 205085, 401043, -23085, -299574, 179852, 11274, 204548, 102005, 135291, 644782, + -122943, 181999, 78920, -234613, -83752, -70330, + }, + }, + { + { + -1607928, -40409200, -1836099, 7229504, 932545, 467078, 518080, 1633161, -1840394, 8545374, + -357019, -5300527, -5204427, 7794292, 6892349, 4936528, 5046050, -3111704, 1615982, -377420, + 1078574, 8412767, 6131066, -695785, -2669859, -7260642, 1107565, -4861366, -1544041, -8825084, + -1669132, 1820529, -1016297, -483721, -1452236, 3962107, -1195075, -2062121, -3526168, -598611, + -170725, 4134443, 433255, 3275450, 2601140, -1067299, -151934, 722628, -3600793, 1597191, + 2725694, -521839, -8053, -259846, -695785, 230318, 202400, 1422171, -2016487, -649614, + 649614, -615791, -547608, 12348, 904091, -154619, -588947, -848793, -671626, 810138, + 696858, -1074279, 754841, 693637, -17180, -84289, -537, -34897, 14496, 297427, + -746251, 101469, -170188, 382252, -434329, -156229, -285078, -115964, -28454, 234613, + 216896, -42950, -176094, -233539, 85899, 288300, + }, + { + -10261214, -5956046, -9643275, 18791018, 3143379, -103616, -2391760, 2427730, -3870839, 666794, + -2085744, 4592394, 4932233, 5129265, 2516314, -2036351, -5767068, -1999307, 2604361, -3374234, + -4071629, -4828617, -992674, 955093, -2960306, 5638219, -1568737, 2611340, 2400887, -791885, + 2434173, -2972654, 1588601, -600759, -589484, 3032784, -3961571, -548682, -2790118, -1896765, + -1581085, -925565, 396748, -2645700, 379031, 170725, 2217277, 2756295, 1276679, 416612, + -397284, -251792, -1123134, -81604, 986769, -994285, 963146, -181999, -913754, -1534914, + -614180, -496069, 597537, -205622, 528281, 1043677, -250182, 125091, 341987, -759136, + 238908, 667867, 454730, -169651, 52076, -197032, -107911, 489089, -713501, -155156, + -416612, 444529, -149787, -308701, 297427, -273267, -29528, 168041, -53150, -62814, + 245887, -115427, -17180, -128312, 54761, 87510, + }, + { + 5669894, 54562728, -19866372, -14513231, 29465624, -2085207, 1864553, 2172717, 69256, -973347, + -6455873, 2923799, 1404991, 14865419, -769336, -2439542, -8040179, -9227737, 3614215, -3531000, + -2777770, -4218732, 8356933, 5002563, 4469451, -429497, -2405182, 1429150, -2279554, 1032403, + 1663226, -12885, 557809, -304943, -3412352, -820876, -2239826, -2246805, 507880, 20938, + -1041530, -2777770, 1945083, -735513, -451508, -355945, -504122, -362925, 2806224, 593242, + 1486596, 117038, -1995549, -596464, -534723, 1440425, 570157, -230854, 685047, 1472100, + -724239, 691490, 625992, -3758, 150324, 503048, -449898, -409096, -119185, -481573, + 63351, 365072, 613643, 89121, -175557, 379568, 8590, -365609, -657667, -143345, + -164819, 10737, -171799, 39192, 358093, 392990, -293668, 92342, -81604, 107911, + -387621, -340376, 33823, 37581, -42413, 421981, + }, + { + -1928977, -21954262, 4139275, -337692, 551903, -567473, -1043140, 71941, -1138166, -430034, + 5119601, 1379758, 1302449, -983548, -12820477, -4500052, 9601936, -7996692, 6875706, 1945083, + -7072201, 63888, 2621541, 4435628, -4556424, -1235877, -4085588, 208843, -1193464, -3041374, + 2443837, 3007014, 453119, -3433826, -1286343, -4011500, -3022046, -5232344, -357556, -3189550, + 147103, -2335389, 870268, 1900523, 555125, -1493575, -670552, 343597, -212601, -485331, + 775242, -484794, -716723, 315143, 84826, 1187559, 589484, 676457, 22012, -1149441, + -264141, -971736, 643708, -56908, 278636, 495532, -760746, 612570, -638876, -625455, + -35970, -186831, -872415, -217970, -34360, 42950, -265751, -49392, 662499, 46708, + 117575, -198642, 32212, 183610, -2684, 38118, 105227, 30602, 53150, 325881, + -111132, 72478, 144418, 77309, -104690, -158377, + }, + { + -27893128, -70605504, 1408749, -31562640, -2076080, -3776350, -2472291, -2254321, -4959077, 4099546, + -2262911, 488016, -7150047, -4499515, 6134824, -1000727, -1057099, -2196339, 12575127, -6117107, + -1669132, 1997160, -3767223, 6659884, -2122251, -1893544, -4430259, -6092948, -3291019, -52613, + -4475356, 1568200, 2333778, 751082, 1182727, 2552284, -3974455, -4022774, 2362769, -1003949, + -395137, -978179, 1948841, 887985, -1013075, -1533303, 1708860, 66572, -1571958, 1251983, + -328028, 1429150, -1055488, -755914, -1301912, 590558, 1014149, 103616, -19864, 57982, + -406411, 381178, 1253594, 816581, 226023, 183610, -434865, 351650, -100395, 130460, + 902480, -146566, 115964, -356482, 408022, -26844, -639413, 255014, 415001, -123480, + -12885, 138513, 319975, -242666, 368293, -258235, -163746, 372588, 65498, 64961, + 171799, 44560, -90731, 308164, 5369, 37044, + }, + { + -197569, -8171712, -3875671, 1066763, -1452773, 250719, -26844, 683437, 304943, 2120640, + 4398047, 360777, 530428, -3965329, -12045236, -2645163, -3842385, 3987877, -3288871, 1931662, + 8505109, -517544, -8344048, 1312113, -1704565, -10797011, 941135, 4333622, 2968896, 4297115, + -1923609, 3039763, 2709051, 2757906, 188979, 5234492, -2663417, -316217, -2918430, 1971390, + -2399813, -2748779, 521302, -865436, -221191, 1478006, 1736777, 1110786, -403190, -265214, + -830002, 1324461, 1835025, 411780, 950798, 221728, -707596, -204548, 1963874, -1370632, + -26844, -104153, 13959, 483184, 44023, 757525, 18790, 324807, -239981, -133144, + -4295, 472983, 253940, -380105, -533113, 624918, -575526, -259846, 110595, 690416, + 138513, 99321, 127238, -11811, 140660, -88047, 334471, -148713, 205622, -94489, + 81068, 83215, -48855, 231928, -51003, 193810, + }, + { + -30288646, -119527864, -8674760, -4484483, -10585484, 491237, -1466195, -2779918, -306553, -6829535, + -1029182, -1141388, 1615445, 956167, 1531693, 4951561, -2887829, -863825, -594316, -1982664, + -1283122, -210453, -2376191, -6046777, -3546569, -2491618, 909459, 4225711, -712965, -1447941, + 2748779, -2113124, -1096827, 238908, -2421288, -1338956, 729608, -3063922, -1454383, 4136591, + -476741, -769873, -668941, -1372779, 666257, 944893, -241055, -2410014, -125628, -2840584, + 734439, 160524, 1297080, 1894081, 233002, 344671, 57445, 1037235, 927713, 747861, + -111669, -1689533, -1335198, -344671, 323733, 155156, 176094, 47782, -125628, -57445, + -472446, -408022, -897648, 59056, -69256, -409633, -417686, 151398, 467078, -170188, + -670552, 23622, 310848, -38655, -250719, -57982, -81604, 240518, 625992, 164819, + -191663, 163209, 54224, -71941, -149250, 221191, + }, + { + -42950, -12017855, 3448322, -955630, 2383707, 692027, 302258, -990527, -113280, 584116, + 1607928, 293132, 4280472, -1073205, 466004, 6063420, 8696235, -4838281, -7381438, 15458661, + -5057324, -6600828, -479426, 1016297, -3980361, -912144, -10652056, -4226248, -10603737, -1055488, + -5366025, 2812130, -1741072, -4250407, -3928821, -2263985, -2776160, 3197066, 585189, 643171, + 258235, 1443109, -2226404, 407485, 1869385, 1216550, -2488397, -585189, 2080375, -2778307, + 571768, 979253, 2178622, -383326, -850404, -216359, 602906, -451508, 990527, -3758, + 2336462, 653372, -2080375, -188442, -134755, -217970, 699006, -619549, -374736, 403727, + -182536, -163209, 128312, 645856, 122943, 664646, 11274, 100395, -420370, -192737, + 219043, -287763, 203474, -2147, -13422, -75699, -365072, 690953, 150861, 51540, + -54224, -311385, -314069, 19327, -414464, -46171, + }, + { + -17554068, 13110925, 13282723, -19981798, -11212012, -3862249, 696322, -4027069, -2956011, -6811282, + 1380832, 6240588, -3504693, -10696616, 4690105, 7923141, 1343788, 4841502, -3648575, -5167383, + -2176475, -496069, -1453846, -472446, 32212, 1097364, 105764, 1130113, 419833, 41339, + 1640141, 1012002, 2898029, 3481071, -2440078, 3584687, 4087198, -1403381, 1300301, 1504312, + 1918777, 1234803, 2742337, 2792266, 408022, 497679, 1545115, 762357, -620086, -1382980, + -1644436, -1162862, 743566, 402116, 441308, -266288, -270046, -898722, 1183800, -88584, + 389231, 343597, -978179, -429497, -29528, -73551, 519691, -39728, -166430, 565325, + 510027, -416075, 9664, -767725, -1061931, 206158, 71404, -350040, -130997, -41339, + -203474, -18254, 210453, -55298, -139050, 64425, 185220, 187905, 264141, -340376, + 157840, -276489, -143345, 70867, 230854, 97174, + }, + { + -897648, -39274792, -1880122, 15305116, 3986267, 4013647, 11191611, 738198, -3007551, 1746441, + 4831838, 7915088, 6099391, -1729798, -3599720, 6298570, -2391760, -9389335, 860604, 1786170, + 2595234, 2029372, 373125, 3418257, 7221988, -32749, -12421045, 8268349, 4184909, 6578816, + -2786360, -2690260, -390305, -1059783, -3212099, 4295, -5435281, -3648038, 2174327, 20401, + 112743, 941135, 1243393, -2828236, -1634235, 3288871, -767725, -1661079, 1170379, -48855, + -636729, 1655173, -1472100, 394600, 991601, 1611, -814433, -599148, 585726, 155693, + 546535, 846645, 163746, -418759, -1461363, 145492, -1188632, -472446, 327491, -235686, + 159451, -27917, -16643, -227096, 324270, 394063, 183073, -68183, 195958, 1216013, + -226560, 15032, -277562, 154082, 0, -358630, 68183, -158914, 110595, 192200, + 627602, -221191, -341987, -45634, 51003, 112743, + }, + { + -3083250, -179193008, -7250979, 11422466, -2091649, 6444062, -3240553, -176631, -4408784, -2023467, + 948114, 628676, 992137, 5777805, -10785737, 2029909, -2544768, -1635846, -2185602, -5928666, + 5991480, -1989107, 3408594, 1151051, -2253247, 22549, -1349157, -2837363, -3245922, -2559801, + -3072512, -3624953, 143881, -985158, -4064650, 1037772, 190589, -1523103, 1191853, -2238752, + 984084, 2434710, -248571, 2172180, -3330747, -1100585, -142808, 1619203, 304406, -82678, + 1716376, 56908, -55835, 1950452, -434329, -388695, -87510, 778463, 802085, 253940, + -408022, -865973, 689879, 185220, -581968, -197569, -1262184, 578210, -126702, 141197, + -274341, -599685, -416612, 223875, 241055, 169651, -162672, 170725, 147640, -4832, + -25233, 23085, 369904, 19327, -164283, -239981, -35970, 5369, 77309, 15032, + -355945, 159451, 85899, 163209, 24159, -147103, + }, + { + -1561221, -6976638, 19459960, 10742787, -1926830, 294205, -4078608, -4020090, -2775086, 143881, + -5034776, 2529736, 3497714, 4619238, 6666863, 9842991, -1119376, 10672994, -5405753, 10399190, + -2193118, -2624225, 5026186, 1687922, 6401649, 1801202, -2958159, -7139310, 1878511, -4254702, + 5829881, -1292785, 108985, -2248416, -2573222, 609885, 244276, 3387119, 2204929, 2770791, + -494458, 2658585, 1466195, 406948, 434329, -143881, -57982, 2225330, 12348, -28991, + 1624571, -1213865, 2582349, -582505, 578210, 353798, 682363, 774168, -70330, 692027, + 256087, 688805, 73014, 45634, -822486, -215285, -1019518, 637803, -683974, -294742, + 678068, -58519, -284542, -355409, -49929, -171262, -205622, 99321, 955093, 134755, + 250719, -81068, -204011, 109522, 19864, 312996, 178241, -185220, 46708, 176631, + 395674, 82678, -349503, 42413, 121333, 18254, + }, + { + 41732048, -2557116, -13588740, 14862197, -5632313, 4642323, -971736, 4846871, 4096862, -1456531, + 233539, 9498857, -134218, 7406671, 325344, 1263257, -12543452, -3710852, 3475702, -971736, + 5568425, -3062849, 5966247, -331249, 1282585, -3945464, 919660, 8250096, -1869921, 1098438, + 4124242, 5140002, -666794, 1677185, 289910, 5804112, 873489, 1094143, -1042066, -2661269, + -857920, 1409286, 1086627, 4530117, 650688, -335544, -1403381, 1244467, 209917, 1104344, + -2106682, -533113, -1211718, -2722473, 2473364, -851477, 12348, -1253057, -142808, -610959, + -871878, 60666, 173409, 488016, 790274, 492311, -1006096, -147640, -200790, 215822, + 343597, -573378, -653909, -107374, 525597, -302258, 338229, -41339, -46171, 114354, + 201863, -269509, -87510, -250719, -447213, 463856, -306016, -427886, -144955, 96637, + 108985, -590021, 112206, 283468, 266825, 192737, + }, + { + -1334661, -20770998, 7896298, -274878, 1999307, 3721589, 6236830, 2418067, 1796907, 2279554, + 16643, -2719251, -5784784, -14318884, 18434000, -2708514, 5696201, 7053947, 4431333, -2908767, + -3629784, 616328, 4958540, 4250407, -3626563, 3920232, 2012729, 5526549, 1936493, 813896, + 1934883, -1094680, 2366527, 265214, -4268661, -1211181, -2782602, 671626, 1777043, 1754494, + 821413, -1883343, -2455648, -19327, -2335389, -779537, -1878511, -1243930, -113280, 1609539, + -367220, 325344, -752156, 25770, -329102, -299574, -784368, -569620, 111669, -1122060, + -1401770, -379568, 523986, -438624, -747324, 1194001, -1134945, -175020, -30065, -47245, + 316217, 270583, 294205, 104153, 49392, -378494, 184147, -420370, 196495, -64961, + -343061, 127238, -46171, -415001, 178778, -15569, -120796, -173409, -20938, -391379, + -201863, -344671, 149250, 33823, -222801, -223338, + }, + { + 22638236, -63776508, -5143760, -8619999, 3096672, -7605314, -2510945, 3610457, -2092186, 2505040, + 8288213, -509491, -4354560, -6728067, 7951595, 220117, -5643587, -5245229, 8023536, 802622, + 3183645, -754304, -749472, -1213328, 6619082, 918049, -77309, -3578782, 2099165, 1207960, + 2536715, 2525978, 5608691, -2954401, -7021198, -2900177, -1599339, -3626026, 3761318, -217970, + -960462, 3512747, 846109, -137976, -209380, -1523640, 2888366, 264677, -1249836, 798864, + -1767916, -2331094, 1238561, 1078037, 700617, 232465, -42413, -1540283, 718870, 693637, + 399432, 588411, -571768, -935229, 30065, 860067, 37581, 45097, 200790, -220117, + 892279, 107374, 448824, 1340567, 211527, 624918, -196495, 225486, 114354, -352724, + 157840, 281320, 375273, 30602, 64425, -592706, -253940, -293668, 40802, 357556, + -40802, 409096, 190589, -80531, -139050, -280247, + }, + }, + { + { + 1856500, -46577848, -3591667, 10795400, 2536178, -566936, -965294, -466004, 4356708, 6533182, + -992137, 2485712, -6726993, 1542430, 12646531, 7843147, -431107, 2793876, 910533, -12041478, + 3928821, 10994579, 172336, 10820633, -8484708, -4611185, -1976222, -952946, -9387188, -3451543, + 4605279, -345745, 118112, -3710315, -3257196, 3588445, 380105, -4420058, 33286, -1244467, + 812823, 2872260, 1159104, 2624762, 1326071, 2013266, -707059, -1298154, -1873680, -980863, + 3013993, 596464, 47782, -728534, 450972, -826781, 262530, 4295, -402653, -637266, + 128849, 872952, -1795833, 399969, 852551, -976568, 195958, -896574, 4295, 85362, + 165893, -374736, 407485, 369904, 852014, -148713, -234613, -114354, 125091, 53150, + -867047, -165893, 388158, 235149, -226560, -355409, -90194, -228707, 247497, 162135, + 187905, -224949, -282931, -88584, 108985, 195958, + }, + { + 11862163, -26976690, -18371186, 21965536, -1840394, 1767916, -1474248, -782758, -4700305, 1261110, + -1179505, 5758478, 6780680, -1257352, 4762045, 1577327, -5198521, 196495, -3540664, -148713, + -9082782, 761283, -3914326, -197569, -577673, 1668058, -4295, 566936, 3836480, 314606, + -3402688, -1983738, 5972689, -2015413, -3503083, 1657321, -68719, -3588982, 82678, -4253092, + 707059, 1961726, -4472672, -1767379, 453656, 314606, 290447, 1828046, 1479616, -70867, + 552977, 1150514, -494995, -1642288, 1178969, -720481, 425739, -176631, -256624, -566399, + -586263, -341987, 541166, 52613, 364535, 638876, 177704, -75699, 376883, -413391, + 207232, 16106, 881542, -368830, -517544, 241055, -274341, -205085, -185757, -712965, + 357556, 344671, -438624, 59593, 267899, -261993, -146566, 321049, 57982, 172336, + -294205, -47782, -71404, -16106, 43487, 127775, + }, + { + -6195491, 36950676, 4690105, 25309706, 2397666, -3291019, 2495913, -1175210, 955630, -1398012, + -3488050, 3397319, -4862440, 14493904, -767725, -4303021, -1553704, -6859600, 243203, -4241817, + -199716, 712428, 7126962, -4909148, 7531225, 3456375, -4024384, 1191853, 137439, -2142652, + -47245, 4329864, -2422362, -170188, -2478733, -2444910, -4414153, 2640868, -749472, -1050120, + -993211, -1299228, 198642, -252329, 489626, -2578054, 395674, -265751, 1822140, 2071785, + -644245, 428960, -1847910, -844498, 730681, 1544041, -64961, 134218, 1080721, 430570, + 181999, 379568, 1324461, 384936, -379568, -175557, 104690, -642098, -143345, -622770, + 343061, 285615, -125628, 585726, 236760, 268435, -12885, -4295, -1131724, -32749, + -146566, -58519, -98247, 159451, 218506, 70330, 10737, -334471, 208306, -186294, + -132070, -183073, -15569, 36507, 61740, 236223, + }, + { + 2400887, -7164543, -9727564, -441845, 239444, -535260, -900869, -988379, 96637, -261456, + 3877282, 1742683, 2095407, 7195681, -19356344, -4770098, -3966402, 4401805, -167504, 5976447, + -5507222, 703838, -230318, 3302293, -493384, -2443837, -4238059, 2743410, -573378, -2126546, + 5055714, -3558917, 1902671, -280784, -3364033, -4072166, -3655017, -1014149, -2968896, -1404454, + -579821, -1042066, 818728, 303869, 213138, -1708860, 1036161, -1029182, 6442, 118648, + 295816, -1276142, 1115081, -14496, -476205, 915365, 902480, 324807, 619549, -1255204, + -874026, 329639, -156229, -603443, 697932, 207232, 431107, 14496, -876173, 648003, + -934155, -499290, -359704, 64425, -278099, 1611, -118648, 75699, 351650, 466541, + -36507, -22549, -74088, 432181, 94489, 66572, -92342, 98784, 5369, 214748, + 88047, 89121, 147640, 154082, -63888, -56371, + }, + { + 30415884, -133366248, -13617731, -23576686, -2143189, -3431142, -4269735, -1974074, -5785858, 249108, + 5945846, -3400540, -8262980, 4713190, -461172, -2331094, 1075889, -8062728, 6470368, -835908, + 2132451, -2830384, 4333085, 2178622, 1151588, -8696772, -4005057, -2774549, -3164317, 1747515, + -2909840, -2316061, 415538, 3366718, 373662, 2769717, -8732205, 363462, 1233193, -1778653, + -263067, 1720134, -2236604, 2564632, -676457, -60130, 1063541, 211527, -1985349, 457414, + 1950452, 470299, -692027, -1019518, -2265059, 787053, 1369021, -581431, 780073, -1046361, + 95563, 369904, 481573, 456877, 861141, 10737, -314069, 510027, 151398, -1074, + -67646, 271657, -501974, 281857, 334471, 79994, -151398, 308164, 76773, -290447, + 628676, 426812, -473520, -26307, -28991, 200790, -47782, 125628, 45097, -314606, + 517007, 89657, -207769, 151398, -114354, 108448, + }, + { + -674847, -16555488, 7048042, -2349347, -1350230, 171262, -18254, 1004486, 657130, 1085553, + 5416491, 785979, -2983929, -4048007, -10258529, -3451006, 3069291, 3687230, -817654, -1334661, + 3816615, 1157494, -3325915, 2588255, -12935905, -959388, -3332895, 1789928, -490163, 9846749, + -3672197, 3350075, -880468, 984084, 2386928, 5181878, 318364, -412854, -3336116, 1305133, + -285615, -1590212, -1523640, -505196, 659278, 635655, 2694018, -552440, -564251, -221728, + 42950, 1353452, 1105417, 406948, 1540820, 195958, -1792075, 1376537, 532576, -1313186, + -729608, 1050656, 246424, -415001, -3221, 889058, 272730, 397821, -354872, 481036, + 26307, -406411, 898185, -21475, 126702, -328565, -277025, 309775, -331249, 733366, + 73014, 147640, 35433, 237297, -193274, -53150, 256087, 105227, 410706, -53687, + -210453, 237297, 103616, -74088, -67109, 157303, + }, + { + 15830176, -206453712, -3143379, -9833328, 1131724, 870805, 995359, -3258270, -383326, -10298795, + -2799782, -2553895, 6860674, 716723, 1544578, 45634, 4925254, -4108136, 1705639, -4358318, + -3000035, 484794, -2778844, -6118718, -6356015, -2292439, 1938104, 4398584, 1628866, -56908, + 1671279, -856309, -1676111, -970663, -1476932, -2495376, 265751, -1672890, -851477, 2211371, + 286689, 528818, -1790465, -1177358, -937377, 2968896, -3488587, -867583, -581968, -432718, + -1567663, 687195, 1397475, 1030792, 1088774, -74625, 834834, 940061, 1306744, 474594, + 628139, -1488743, -1700270, 579821, -713501, 568546, 166967, -216359, 33286, -509491, + -31675, -979253, -635118, 206158, -116501, -222265, -428960, 13959, 191126, -173409, + -385473, 217433, 207769, 197569, -264677, -414464, 316217, -23622, 576599, 244276, + 146029, 123480, 197569, -243203, -2684, 62814, + }, + { + -1205812, 1096827, -6506339, 2956548, 2338610, 772557, -1078037, -266288, -141734, 326954, + -1588601, 1836099, 2327336, 3713536, -3472481, 8854075, -1862942, 921807, -4262218, 8388071, + -9198209, 5140539, -7723962, 2016487, 2411087, -8501888, -9030169, -11953431, -1187022, -2719251, + -3449933, -675921, -4694400, -484794, -4811974, -6445136, 467078, -272730, 1783485, 611496, + 2032593, -1986959, -561030, 2067490, -1690607, 347355, 63888, -2147484, 842350, 202400, + 362925, 1680406, -154082, 243203, 204011, -1289027, 1944010, 505732, 501974, 464930, + 1485522, 463320, -1720671, -600222, -104690, 18790, 208306, -257698, 99321, -799401, + 542777, -758062, 817118, 619012, 218506, 622233, -186831, 7516, -235149, 98247, + -27917, -444529, 23085, 203474, -27380, 31139, -55298, 268972, -39192, 415538, + -75699, -383326, -102542, -107911, -329102, -135828, + }, + { + 34932580, -7405598, -35992364, -20852066, -3346317, 239981, 1691680, -5998459, -2556043, -1794760, + -2036351, -2203855, -1195612, -5335423, 4811974, -748935, 1041530, 5792837, -4607963, -1461900, + -2689723, -2805151, -3506304, 949725, 2757906, -615254, 693100, 1786706, -234076, 186294, + 2162516, 4784594, 1801202, 1915555, -1933809, 770410, 5442798, 2370822, -1095754, 568009, + 2724083, 2270964, 3910031, 741956, 2061047, -727997, 1611687, 75699, -472446, 504122, + -1195612, -1846836, 11274, 1170916, 494995, -539555, -2202245, 279710, 596464, 81604, + -20401, 824097, -732292, -120259, -719944, -935229, 275952, 601295, -295816, 343061, + 945967, -159451, -706522, -73014, -481036, -982474, -129386, 257698, -306016, -257161, + 68719, 2684, -14496, -345745, 122943, -208843, 416612, 307090, -330176, 287226, + -132070, -197569, -230318, 188979, 264141, 158377, + }, + { + 1495722, -28375238, -1420560, 1213328, 4613332, 7703024, 11104101, -2771328, 7516, -2014340, + 7561290, 5666673, 5013301, 3437048, -3456912, 2566780, -3104725, 3002719, 1061394, -220654, + -9515500, 9813463, 1900523, 8878234, 8230768, -3848828, -5669357, 73551, 6774237, 1125818, + -983011, 1482301, -1364726, -67646, -1023813, 943282, -7229504, -3413962, 442382, 1125818, + -389768, 468688, -536334, -2074469, 498216, 2615098, 535797, -1880122, -1174137, 809601, + 549219, 1638530, -592169, 1175210, -1606318, 622233, -2296197, 519154, 464930, 667331, + 988379, 776852, 164819, -663572, -1234266, -556735, -262530, -183073, -176631, 62277, + -47245, 122943, 302795, -192737, 492311, 572304, -552977, 385473, -63351, 794032, + 93952, -1611, 62814, -65498, -89121, -18790, -372588, 135828, -248034, 478352, + 519154, -63351, -265214, -315143, 206158, 478352, + }, + { + 3061775, -165264432, -20710332, -2149631, 18139794, -13432510, 11909944, -5130339, -5747740, -241592, + -131533, 4600984, 3038153, -4907000, -7582228, 6160057, -1475321, -893353, -3215857, -2232846, + -743029, 1162862, 1149978, 1162326, -1286880, 534723, -913754, -5097590, -3003793, -1729798, + -1811403, -4524211, 2182917, -3787088, -132607, -836445, -1583769, 2705830, -1472637, 629750, + 289373, 991601, 358630, 1141924, -1824287, -295816, -578747, 1704028, 357556, 1138703, + -231928, 202937, 836982, 745177, -448287, -1568737, 579284, 893353, 40265, 1229434, + -281857, -820339, -16643, 617402, 234076, -1239635, -545998, -159988, -290984, 6442, + -289373, -122407, -777389, 294205, 438624, 476205, -66035, -207232, 118112, 169651, + -60666, 228707, 199179, 25770, -66572, -521302, 192737, 103079, 238371, -229781, + -202937, 142271, -42413, 181999, -117038, 68183, + }, + { + 1724966, 15131707, -4285841, 4627828, 4651450, 1421097, -3511136, -4954782, -2182917, -1384590, + -6338298, 1865090, 610959, 18521510, 6381248, -586263, 7282117, 5400385, 2679523, 3269007, + -1920387, -2039036, 5332739, 1285806, 6373732, 5310190, -7290707, -1420024, -1370095, -3754338, + 5895380, -1336809, -1095217, -1828046, -1670742, -2363843, -1533303, 2734821, 4598300, 3052111, + 186831, -609349, 2558190, 1248225, 603443, -1281511, 1197222, 1627793, -527744, 1479079, + 250182, -148713, 367220, 1496259, -787053, 2669859, -166967, -1127429, 234613, 735513, + 441845, 820339, 1098438, -1258425, -905701, -421444, -410706, 226023, -301721, -24159, + -918586, 612570, 193274, -882616, 20401, 123480, 245350, 7516, 839129, 220117, + 296353, -119185, -277562, 157840, -379568, 310848, 321586, -376347, -98784, 108985, + 217433, 75699, 25770, -231928, 139050, 33286, + }, + { + -26722212, 85241144, -3624416, 1995012, 3424163, -224949, -1922535, 8348880, 1156420, -197569, + 5619428, 7012608, -3006477, 15575699, -4115653, 375273, -5374615, -6556805, 3824132, -1573032, + -140660, -1497870, 8116952, 2815888, -5250598, -2833605, 1091995, 5920076, 1823214, -3962107, + 5858873, 2589865, 2004139, 2534031, 3923453, -809064, 2698313, 3344706, -4306779, 1155346, + -2507187, 792421, 1249299, 3186329, 1176821, -12885, -1360968, -498216, 524523, 2269890, + -1904281, -94489, -2267743, -51003, 164819, 1774895, -1929514, -982474, 1611, -30602, + -1195612, 787590, -537408, 301721, 545998, 382789, -1175747, 61203, -920197, 301721, + 614180, -456877, -814433, 369367, 26844, -191663, 520765, -637266, 159451, 665183, + -374736, -377957, -114354, 31139, -550293, -65498, -111669, -370978, -49392, 143345, + -253403, -382789, 131533, 312996, 60130, 349503, + }, + { + 1520955, -12122545, -2691871, 4753992, 678068, 992674, 7110319, 3303367, 3111704, -1514513, + 3396782, -6202470, -3117610, 19756850, -32734094, 1743757, 10082436, 4544613, 1124745, 3163780, + -7020124, 9764071, -967441, 5553393, -1195612, 1337346, 3432753, 2119030, 2028298, -1833414, + 2663417, 1141924, -2690797, -235686, -2717104, -3553549, 5906, -1353452, 2610266, -154082, + 123480, -374736, -2525441, -1920387, -351650, -861141, -1205275, -2514167, 2420751, 880468, + -300648, 1380832, -1342714, -870805, 188442, -20938, -149250, -1613834, -16643, -1464047, + -682900, 1029718, 275415, -828392, -645319, 321049, -325881, -255014, 279710, -412854, + 471910, 138513, -411243, -17180, 606664, 352724, -370441, 55298, -637803, 173946, + 200790, -275415, 29528, -47782, -330712, 122407, -31139, -173409, -84826, -135291, + -308164, -48318, -118112, 124017, -265214, -158914, + }, + { + -24178518, 304406, -1907502, -6918656, -1978369, -1709934, 867583, 1151588, 162135, 1224066, + 7511361, 32749, -4090956, 11307575, -18636400, 453119, -9987946, 2660195, 8471823, 2838437, + -4405563, -612570, -802622, 652835, 2309619, 564788, 4970351, -5012764, 1239635, 100395, + 4071629, 4886599, 718870, -2674691, -5400922, -3415573, -2806224, -579821, 947577, 1562831, + -944356, 3830037, -521839, 1054951, -795643, 25233, 805843, 39728, -1022202, -915365, + -1567663, -41876, 1104880, 905701, 811749, -718870, -239444, -595927, -250182, 834297, + -178778, 730681, -297427, -932545, -428960, 510027, 160524, 244813, 88584, -158914, + 642098, 471910, 365609, 619549, 632971, 309775, -215822, -83752, -67646, -114354, + 520228, -241055, 352187, 20401, 119185, -116501, -481036, -428960, -175557, 125091, + 178778, 175557, 187905, 151398, -315143, -228707, + }, + }, + { + { + -548145, -18871550, 16725676, 4978404, 380641, 729608, -173409, -392453, 2940979, 2739116, + -5283347, 1411434, -4895726, -463856, 8810052, 3452617, -570694, 9175661, 2799782, -18403934, + -1972464, 2258079, -7975218, -54761, -10519449, 1910187, -439697, 3799972, -2445447, 1166621, + 6207839, 3372086, -1039382, -4096325, -1373853, 3875671, 2225330, -3080565, 574452, 123480, + 365609, 578747, -481573, 1245541, 1996623, 2284386, -655519, 1124745, 2044404, -1419487, + 1156420, -467615, -518080, -1391033, 246961, -625992, -362925, -463320, -229244, -1296543, + -528818, 1665374, -1098438, 481036, 683974, -572841, 764504, 477815, 627065, -10737, + 39192, -100395, 442382, 11811, 792958, 129923, 128312, 100932, -15569, -92879, + -478352, 69256, 396211, 123480, -293668, -182536, 84826, 120259, 340376, -150861, + 28454, -175020, -38655, 28454, -21475, 185220, + }, + { + -8821863, 23973434, 40948756, 12319040, -6004901, 1240709, -2360085, -238908, -1171452, 1513439, + -4648229, 3955128, 4583804, -4027606, 2524367, 5267778, 160524, -1498407, -5534066, 4129074, + -6427956, 6764037, -109522, -2325725, -868120, 2234994, 2100776, -243203, 396211, -1543504, + -4378719, -2923262, 1656247, -3117073, -1897839, 278099, 1699196, -2008434, 4891431, -1043677, + -1268626, 566936, -3272765, -394600, 456877, 0, -1414655, -1679869, -185757, 168041, + 1424319, 1761474, -1335198, -1905355, 1028108, -476741, 182536, -1079647, 770410, 129386, + 621160, 616328, 630823, 71404, 62277, 605590, 397284, 26844, 689342, 210990, + 258235, -865436, 167504, -440771, -486405, -15032, -527207, 28991, 156766, -445603, + 168041, 212601, -169651, 316217, 234613, -156766, 67109, 149787, 82141, 268972, + -241592, -53687, -168577, -114354, -41339, -8053, + }, + { + 5093295, -8724152, -36126580, 27521076, -554588, -2389613, 710817, -3716757, -151398, 2289218, + -152471, 3983582, -3183108, 12541305, -1695438, -511638, 7599408, -3346317, -4998268, -4189204, + 938987, 2347200, 7186554, -9153112, 3285650, 1663763, -1560147, 2378875, -407485, -3622805, + -1567663, 1747515, -5136244, 434865, -1030255, -253403, -1794223, 2378875, -1168768, -26844, + 2825552, 1004486, -729608, -1520418, 1080184, -2447595, 1829119, 1484985, 875100, -356482, + -2294050, 1306207, -1087701, -1544578, 1301375, 2199560, -507343, -830002, 395137, -405874, + -205085, -629750, 328028, 506269, 27380, -185757, 220654, -78920, 92879, -852551, + 42950, 3221, -438087, 19864, -124554, 297427, -42413, 412854, -511101, 115964, + 3221, 314606, -75699, -251256, -74088, -244276, -296353, -345208, 328565, -40802, + 159451, -79457, 102005, 125628, -234613, -288300, + }, + { + -2161442, 10118943, 7135015, 5369, 856846, -594853, -301185, 170725, 337692, -864899, + 4690105, -708133, -1098975, 7650411, -14299020, 790274, -1513976, 7981660, -2665564, 6918119, + -3176128, 6794639, 772557, 1607928, 5672578, 3280281, 2175938, 4549444, -742493, -2316061, + 4585415, -4781909, 3406446, 2304250, -1570884, 3289408, 1808181, 2068564, -1158031, -1261110, + 561030, -768262, 834297, 607201, 857383, -384936, 163209, -1381369, 215822, -1037772, + 370978, -622770, 153008, -998043, -541166, 234613, -433255, -434865, 90194, -605054, + 77309, 623844, -648540, -117038, 599685, -73551, 893353, 550830, -570157, 642098, + -583579, 16106, 346819, 307627, -361851, 55835, 75162, -142808, -293668, 67646, + -161598, -45097, 62814, 547071, -305480, -82141, 9127, -19864, -150861, 13959, + -5369, 29528, -82141, -56371, -70330, -9664, + }, + { + -22949620, -165896864, 25232396, -11794517, 1899449, -1007707, -1072131, -665183, -1634772, 2434173, + 3974992, -3865471, -5914707, 2092723, -288837, 2244121, -649614, -9402757, 6009733, -325344, + 1003949, -1530619, 5379447, -1339493, 5377299, -4501126, -1816234, 3791383, 379031, 2348810, + -63888, -1620813, -959388, 1128503, -43487, 2077690, -5610838, 4769561, -919123, -3143916, + 1952600, 2078227, -3380676, 1785096, 182536, 1087164, 884763, -726923, -2247342, 10201, + 864362, 799401, 574452, 1259499, -765578, 601295, 1069984, -164819, 1236951, -278099, + 355945, 449898, 108448, -925029, 312996, 11274, -819265, -604517, -731755, -132070, + -719944, 373662, -19327, 212601, 20401, 458488, 671626, 243739, 270046, -169651, + 445603, 564251, -499290, -94489, -10737, 341987, 296890, 68719, -223875, -190589, + 238908, -346282, -305480, 259846, 70330, 97174, + }, + { + 462783, -9037148, 8843875, -2370822, 4295, 255014, 196495, 596464, -1767916, -747861, + 3616363, -852551, 1085553, 5194763, 619549, 985158, 2412161, 6439230, -4310537, -6990596, + 4076461, -121870, -6589017, 6332393, 986232, 6915434, -4128537, -1108102, -4813048, 6184753, + -2889439, 1493038, -6423661, -2241436, 258235, 2778844, -161061, 267899, -674310, 1221381, + 865973, -59056, -507343, 324270, 702227, -995896, 1166084, 597000, 433255, -409096, + -183610, -307627, -284005, 539555, 515396, -373125, -2149094, 350040, -564788, -839666, + -640487, 652298, -60666, -463856, -362925, 345745, 433255, 419296, -689879, 617402, + 388158, -791348, 579284, 399969, 616328, -227096, 7516, 45097, -547608, 37044, + -128312, 271120, -84289, 130997, -65498, -35970, 327491, 114890, 202400, -51003, + -284005, 12885, 2684, -17717, -139050, 61203, + }, + { + 9579925, -222563056, 1006096, -5937793, -1611, 3397319, 3053722, -1038845, 7667054, 1567126, + -1354525, -8899172, 408022, -1437740, -1345935, -6218576, 6024229, -2952253, 2160906, -1481764, + 1724429, 2583423, -1341640, 1089848, -2831457, -2926483, 2690260, 3741454, 5497558, 3745748, + 1757179, 210453, 200253, 482110, -1601486, -1401770, -162672, 152471, 2409477, 294742, + -1556389, -2324651, -631897, 2197950, -2427194, 1328219, -4388920, 205085, 1180579, 757525, + -610422, 1908039, 1162326, -1580548, -17180, 57982, 1067836, 465467, 587874, 377420, + 1180042, -9127, -515933, 832687, -469762, 780073, -381178, -757525, -113280, -506269, + 186831, -41339, -282931, 86973, 353798, -214748, -629750, -34360, 110595, -210990, + -140123, 415001, 166967, 33823, 15569, -51003, 303869, -285615, -98784, 27917, + 258772, -151934, 59056, -231391, 88584, 33823, + }, + { + 256624, 14988899, 947577, 3245385, 237297, -196495, -1055488, 966905, 951872, -190052, + -1032403, 334471, 1506997, 1824824, 761283, 6598144, -8343511, 6519224, 1529008, -597000, + -14876156, 6262599, -4334159, 7863012, 8035884, -6597607, -1044214, -3784940, -838056, 692564, + -59056, -1958505, -6431714, 1005559, -626528, -5803038, -2742874, -2381559, 296890, -418222, + 1311576, -1454920, 1176284, 290984, -4271345, -1225139, 1049583, -1354525, 241055, -273267, + -912681, 1076963, -626528, -100932, -260919, -1679869, 845035, -511638, 832687, 118112, + -125091, -83215, -1096827, -537, 9127, -106837, -47245, 379568, 369367, -441845, + 746787, -935229, 786516, 505196, -273804, -100932, -89657, 402116, -136365, -45634, + -399432, -442382, 136365, 93416, -79457, -1611, 76773, -21475, -410169, 199716, + -102005, 75699, 419296, 186831, -146029, -134755, + }, + { + -44627396, -48074104, 22108882, -9775882, -329639, -55298, 3568581, -1944010, 4305705, 1974074, + -1010391, -631897, 2331094, -3751117, -3273839, -5384279, -2084670, 5211943, 183610, 860604, + -2202781, -2712272, -755377, 710817, 2226404, 917512, -12885, 864362, -1587527, 1103270, + 1530082, 975494, 360777, 2170032, -1144609, -1932198, 4226785, 3129958, -561030, 233002, + 1299228, -959388, 162135, -2807298, -1915555, -1344325, 3021510, -545998, -1110249, 638876, + 178241, -598611, -447750, -1096827, -1591822, -260919, -940598, -197032, 25233, 314606, + -59056, 425202, -876710, -389768, -1420024, -1284732, 144955, 738198, 230318, 775778, + 861678, -150324, -325344, 442919, -255551, -1091995, -67109, 230318, -21475, 295279, + 111669, -418222, -199716, -96100, 355409, -335544, 106837, 166430, -427349, 244813, + 30602, 238371, 169114, 285615, 0, 163209, + }, + { + -1713692, -3668976, 18136036, -4989142, 2131915, 1286880, 5090073, -4531191, -1648194, -3629247, + 1955821, -4629438, -1899449, 1000727, -10485626, -403727, -363462, 5768678, 8547522, 1438814, + -7786239, 6050535, -1397475, 8615704, -906775, -3411815, 2643552, -5109938, 2770791, 134218, + -2262911, 4306242, 1374926, -677531, -356482, 3337727, -3605625, -3101503, -3546032, -459562, + -2185602, -2427194, 383863, 434865, 217970, -1394254, 1316408, 1174137, -402116, 470299, + 397821, 399432, -973884, 843961, -2628520, 1101659, -1066763, 1115618, -540629, -760746, + 306553, -306553, -227633, 197569, -184684, 104153, 667867, 529892, -123480, -433792, + -112206, -106300, 387084, 88584, 728534, 753767, -288300, 418759, -482647, 427349, + -118112, -33286, 115964, -3758, -159451, 140660, -280247, 289910, -293132, 62814, + 195421, 161061, -89657, -362388, -24159, 253940, + }, + { + -4407710, -148624656, 5385352, -1345935, 13152800, -7859790, 14868640, -8587250, -2403571, -1015760, + -4800700, 2139968, 1631551, -2328409, -4686883, 5600638, -2523830, 3351148, 784368, 2073396, + -165893, 424665, -2447595, -580357, -688805, 3612604, 3678103, -1913945, -528818, -1695438, + 110595, -2500745, 2826089, -609349, 2132451, -1942399, -2146410, 3803731, -1624035, 1291711, + 1107028, 1263257, 54761, -677531, 1002875, 1827509, -2108292, -863825, -1082869, 343597, + -1382443, -680752, -703301, -100395, -1293322, -1266479, 642098, -344134, -1635309, 341987, + 949188, -62814, -675921, 60666, 39192, -666794, 86973, -180926, -47782, -149250, + -218506, 418759, -679679, 48855, 142808, 285615, 77309, 121333, 160524, 102542, + 17717, 40265, 23085, 255014, -14496, -335544, 144955, 200253, 244813, -85362, + 19864, 51003, -193274, 112206, -140123, 81604, + }, + { + -1512365, 22531398, 1605244, 47245, -489626, -700080, -997506, -1043140, 2179696, 1479079, + -3597572, -2442226, -7265474, 16708497, 11827266, -3275986, 777389, -2201708, -674310, -2504503, + -4470524, -1697049, 2420214, -2088965, 512712, 3308199, -1816771, 2075006, -1181653, -6576669, + 3409130, 1379221, -3051574, -2024003, -2557653, -3435437, -2720862, 3011846, 1648731, -1483374, + 1478006, 822486, 1324461, 1545115, 1684701, -1821603, -60130, -61740, -2102923, 1621887, + -62814, -882079, -1519882, 1111860, -950262, 2621004, 853088, -809601, 289910, -267899, + 787590, 713501, 847719, -693100, -312996, -461709, -419833, 439697, 249645, 475131, + -408022, 437013, -24696, -520228, 170725, 406411, 364535, -47245, 485868, -34360, + 125628, 61203, -91805, -84826, -486405, -202937, 77846, -388158, -346282, -113817, + 53150, -43487, 55298, -218506, 69256, 36507, + }, + { + 5455682, 117336360, -16039018, -3110093, 2311766, -17133698, -17206176, 6754910, 2392297, 4751845, + 4948876, -504122, -1965484, 20333986, -4524748, 4486094, 8107825, -68719, 930397, -4452271, + -2796561, -2712272, 470299, -5117454, -6536940, 362925, 1685775, 4868346, -1356136, -9108552, + 131533, 1670205, 4102231, 547608, 3608846, -4002910, -3474629, 4006668, -2771865, 93952, + -271120, 2171643, -1462973, -2118493, 20401, 1354525, -353261, -750009, 1273995, 2146947, + -1858647, -227633, -1614371, 2608656, 775778, 2545842, -1057636, -710817, 336081, 329102, + -1196148, 756988, -774705, -415001, 40265, 596464, -1146219, -133144, -812823, 185757, + 600759, 843961, -116501, -45634, 47245, -246424, 1074, -941672, 410706, 685584, + -505196, -521839, -126702, 320512, -354335, -40265, 106300, -17180, 57982, -83215, + -188979, 48318, 300111, 5906, -284542, -14496, + }, + { + -1282048, -4720706, 6667400, 4729296, -2400350, -3435437, 561030, -2085207, 2167885, -2108292, + 99321, -7309498, -4756677, 25912074, -25905096, -10490458, 1748589, 3107409, -4982699, 5215164, + -3276523, 5799817, -5405753, 3542274, -2892124, -319438, -1231582, -1057636, -2056216, -353798, + 3944928, -2995203, -3404299, -457414, -1283658, 2450279, 3674345, 354335, 2241436, -3408594, + -1018981, 180926, -476741, -1263794, 562641, 1300301, 1472100, -1652489, 2401424, 383863, + 718333, 1130650, -1664837, 24696, 1309965, 838056, 1307281, -857920, 44560, -55298, + 170188, 1041530, 786516, -885837, -380641, 130460, 47245, 135291, 566936, -528281, + 234076, -92342, -574989, -341987, 335007, 322659, -707596, 658741, -341987, 187905, + 395674, -236760, 95026, -61740, -366683, 200253, 112206, 106837, -171262, 4832, + 45634, 173946, -104690, 253940, -130997, -114890, + }, + { + 15480136, 53679040, -1542430, -3048890, -265751, -136902, 3735011, -87510, -747861, -2276870, + 2266132, 1069447, -3629247, -5900212, -39864276, 1030255, -7230578, 1268089, 3616899, -242666, + -4456566, 132607, -1061931, 1414655, 1665911, -1858647, -1252520, -7674033, 2835215, -135828, + -8590, -1082869, -3453691, -1852742, -321586, 1583769, 822486, 2655901, -157840, 253403, + -302795, -64961, -4655208, 950262, 1773822, 2778844, -151934, -1915555, -1337346, -1084479, + -444529, 910533, -1240709, -545461, 390305, -1523640, 407485, -99321, -1377074, 540629, + -718870, 464393, 1234803, 226023, 330176, 827855, -126702, -12885, -328028, -510564, + 186294, 233539, -41339, -134755, -65498, -333934, -288837, -8590, 160524, -301721, + 112206, -531502, -93416, -457414, 122943, 220654, -147103, -47782, -157840, 27917, + -131533, -188442, 56371, 237297, -135291, 89657, + }, + }, + { + { + -557809, 33124398, -17353816, 565325, 842887, 1249299, -755377, 2199560, -978179, -445066, + 294205, -4927401, 1645509, 4598300, -2902861, -334471, 5233418, 6535330, -1262720, -13652627, + 2172180, -6585796, -1902671, -7981660, -3617973, 8101382, -2112050, 614180, 2553895, 5552319, + -5000953, 7021735, -2429878, -1648731, -1951526, 2326799, 726923, -2605972, 2318746, 1378685, + 529892, -24159, 761820, -316754, 2508261, 774705, 831076, 208843, 2913599, -1372242, + 270046, 78383, -919660, -1127429, -795643, 871342, -514859, -533650, -855235, -468151, + -672162, 470299, -479426, 550830, -79994, 627602, -10201, 1355062, -139586, 387621, + 22012, 260919, 19864, 548145, 338229, -35970, 340376, 104153, 91268, -311385, + 122407, 123480, 2684, 75162, -335544, -27917, 178778, 167504, -71941, 83215, + -242129, 152471, -118112, 55835, -63351, 164283, + }, + { + 6784438, 130150392, -49316424, 4917738, 4894115, -102542, -3273302, 3380139, -8053, 2824478, + -3597572, -2178085, -948651, 7920457, -679142, 1122060, 3981435, -10974178, 2720862, 4027606, + -4598836, 5067525, -895501, -213138, -999654, 1573032, -256087, 1773285, 678068, -3952444, + -1458141, -2137820, -835371, -3109020, 2240362, -3651259, 3182034, -1884417, 4199941, 3586298, + -1930051, -2651606, -243739, -11274, -598074, 1293322, -2679523, -382252, 223875, -1258962, + 710817, 2255932, -1628866, 108448, -984084, 394600, -352724, -1283658, 515396, -226560, + 1673964, -81604, 1066763, -332323, 440234, 396211, 56371, 764504, -322123, 884763, + -60666, -882616, 222265, -224949, -350040, -253940, -528281, 723702, -408559, 71941, + -71941, 120259, -28991, 175020, -134755, 373125, -98784, 16643, 167504, 4295, + 110595, -142271, -113280, -196495, -39728, -6979, + }, + { + -2587718, -99238976, 38332584, 17658222, 3826816, 2724083, -2859911, -142808, -130997, 1966558, + 452582, 2044404, 2081449, 6151467, -365609, -2818572, 7261179, 3413962, -13459891, 1009854, + -2275259, 3529926, 3381213, -4865661, 6637335, -5228049, 3870303, -383326, 592706, -5075041, + 1101659, -3115999, -3392487, 1780264, -2817499, -933619, 1921461, -1225139, 49392, 1677185, + 1177358, 79457, -1540820, -1035624, 1832877, -1849520, 1701881, 1445257, 610959, -770410, + -918586, 138513, 546535, -2493766, 2442763, 1063541, -832687, 49929, -1267015, -190052, + 762894, -781147, -848793, 685584, 497142, 321586, -304943, 205085, -298500, -687732, + -116501, -25770, -227096, -58519, 30602, 71404, -53687, 234613, 20401, -143345, + 29528, 172872, -2147, -322659, 60666, -204548, -273804, -201863, 343597, -16643, + 16643, 51540, -24159, 35970, -272194, -310311, + }, + { + 1553168, 24961276, -6477348, 230318, -263067, -89657, -462246, 647466, 357019, -426276, + 2275259, -508954, 2411624, -1868848, 1662689, -1739462, -1480153, 7885560, -5203353, 3094524, + 5014911, 1007170, -779000, 304406, 6201933, 4589173, 2088965, 4631586, -90194, 433792, + -2231236, -3043521, 2587181, 345745, 3085397, 2744484, 2463701, 838056, -1080184, -710817, + -112743, 1064615, -1200980, 1296543, -156229, 154082, 228707, 423054, -1249299, -769336, + 598611, -1002875, -383863, -144418, -1685775, 875636, -680215, -674847, -62814, 244276, + -75162, 295816, -762357, 257698, 35433, -161598, 757525, 12348, 321586, -349503, + 289373, 292595, -110595, 118648, 53687, -210990, 225486, -454730, -197569, -186831, + -199179, 409096, 95026, -51003, -180389, 127238, 245887, -267362, -206158, -62277, + 69793, 11811, -236223, -120796, -71404, 13422, + }, + { + 9754944, -180884688, 6763500, -13108777, 1629940, 406948, -748935, -1932198, 242129, 5312338, + -8348880, 2497524, -1818919, 873489, 5957657, 86436, 2150705, -14217952, 6114423, 520765, + 431644, -2865817, 5881958, -640487, 4181688, -437550, -1684164, 5507759, -2565169, 2886755, + -2297808, 1433982, -2724083, 2639794, 518080, -1738925, 4595615, -1905355, -1762547, -143881, + 1352915, -1135482, -828929, -503048, 24696, 2543158, -826244, -648540, -197032, 300111, + -650688, 1114544, 624381, 1469953, -202400, 329639, 780073, 311385, 1288490, 863288, + -267899, 520765, -265751, -578210, -89657, 89121, -1031329, -426812, -513249, -99321, + -876173, 625992, 671626, 175020, -405874, 526134, 781147, 32749, 316754, -34360, + 230854, 296353, -347892, -74088, 118112, 82141, 574452, -173946, -337155, 216896, + -271657, -112743, -123480, 196495, 149250, 121870, + }, + { + 333397, -92342, -2569464, 1584306, 212064, 105227, 445603, -730681, -2285996, 918049, + 2481417, 1526861, -1385127, 1871532, 6675990, 2449742, -3208878, 7216082, -148176, -5650030, + 1973538, -370441, -5129265, 9880572, 1072131, 1700807, 1145146, -163746, -4467303, 1666447, + -697395, -1918240, -3367791, -3975529, 1618666, -630286, 2833605, -1352378, 34897, -347355, + 2195802, 239444, 64961, -1082869, -322123, 408022, -799938, 2200634, -19864, 632434, + -162672, -545461, -704375, 228707, 511101, -1192927, -1494649, -229781, -179852, -360240, + -1021665, 759136, -143345, -541166, -163209, 289373, 34897, 998043, -650688, 222265, + 187368, -564788, 213138, 780073, 12885, -397284, 528281, -505196, -85899, -728534, + 332323, 253403, -238371, 202400, -8053, -17717, 318364, 10201, -125628, 184147, + -220117, 58519, -109522, 13959, -277562, -8590, + }, + { + -35744864, -161306624, 907312, 3790309, -1066226, 2856690, 1045288, 1226750, 6199786, 3774203, + 1748052, -7304129, -1752347, -5091684, -3155727, -2547453, 2315524, -2586644, 2730526, 738198, + 4767414, 565325, 485331, -103616, -3194382, 146029, 2077690, 3463354, 4833986, 2916820, + 3357591, -734976, 218506, 312996, -1717987, -283468, 1350767, -46708, 2567317, -2589865, + -1848983, -1535451, 1853815, 1903207, -3808026, 561567, -2119566, -387084, 756451, 583042, + 1643899, 192737, 1108638, -1534377, -376883, 131533, 807991, 180389, 104153, 315143, + 784905, 507880, -158914, 96637, 472983, -265751, -457414, 151398, -715649, 63888, + -56908, 121870, -352187, -107911, 194347, -122407, -316754, -91805, 263604, -160524, + -345745, 82141, 166430, -392990, 488553, 159988, -46171, 116501, -367220, -89657, + 135291, -36507, -136365, -1074, -42950, -4295, + }, + { + 1160178, 7815230, 5748814, 365609, -173946, 9664, -814970, -70867, 2305324, -712965, + 267899, 152471, 2528662, -2555506, 16493211, -3117610, -338229, 1874216, 4386772, -10080288, + 1432909, -4685810, -845572, 1051730, 11164231, 389768, -6913824, 3667365, -5591511, 1817845, + -1789928, 1443646, -5976984, 1445793, -1655173, -3189013, -2331630, -2660195, -2877628, 1860258, + 1063004, -1116155, 1405528, -1072668, -2605435, -1901597, 932545, 63888, -783295, -1199370, + 468151, -777926, 231391, -42950, -914291, -622233, 481036, -831613, 572841, -989453, + 256624, -321586, -869194, 115427, 329639, 492311, -772020, 585189, 654983, 126165, + -570694, -349503, 813896, 115964, -297427, -112743, -171799, 104153, -264141, 38655, + -168041, 31675, -175020, 128849, 180389, -128312, 18790, -239444, -91805, -141734, + 19864, 124554, 426276, 77846, 83215, -175020, + }, + { + 45035416, -118103544, -18977312, -877247, 2393371, -1534914, 1619740, 655519, 3186329, 492311, + 2703682, -220654, 5303748, -7773354, -6663642, -165356, -4032438, 6027987, 2414309, -3973382, + -892816, -553514, 2179696, -2627983, 1991254, 3352759, -3530463, 2187749, -2816425, 865436, + 4220879, -2632278, 1374390, 500901, -675384, 18254, 1180579, 1990717, 1586454, -1832877, + -47245, 2451890, -2738042, -3544959, -267362, -667867, 828392, 748935, -1285806, 83752, + 99858, -169114, -170188, -1968169, -1897302, 32212, 228707, -39728, -523449, 307627, + -192200, 463856, -362388, -1021665, -697395, -290447, -317828, 545461, 590558, 461709, + 284005, 565325, -328028, 125091, -361851, -551903, -316217, 234076, -275415, 529892, + 70330, -280247, -191663, 8590, -51003, 402116, -228707, 41339, -119185, -107374, + 216359, 178778, 420907, 207769, -28991, 130997, + }, + { + 1562831, 17842904, -2389613, -1384590, 968515, -403190, 3126736, -2226941, -3132105, -1559073, + -4300873, -687195, -5466420, 4233764, -12226161, -4687420, 7055558, -3227668, 10353019, -2516851, + -967441, -268435, 270583, 8544837, -5203353, 187905, 3288334, -3359201, -228170, -2349884, + 2448131, 2754685, 1934883, -2290828, 714575, -1732482, 376347, -3878892, -4642323, 644782, + -2312840, -1676111, -899796, 635118, 966905, -2362769, 2160369, 885300, 670552, -677531, + 681826, -1461900, -181462, -58519, -286152, -280247, 110595, 634045, 340376, -1574642, + -246961, -779537, 562641, 45097, 248034, 416075, 486942, -220117, 716186, -988916, + -30602, -44560, 561567, 339302, 438087, 246961, 181999, 79994, 98247, 82141, + -384936, 319975, -248571, 402653, -391916, 198105, -356482, 136902, 51003, -162135, + 197032, -51540, -109522, -125091, -165356, -98247, + }, + { + 6076842, -146534624, 218506, -7541426, -83752, 10466835, 1208496, -6442988, 2877628, -5629092, + 134218, -1006633, -2466922, 1405528, -4352413, 4972499, -5646272, 8313446, 3546569, -784368, + 870268, -1885491, 1314260, -3670587, -227096, 4013647, 2604361, 100932, -1350767, -482647, + -976568, -186831, -344134, 2146947, -1096827, -1110786, -995359, 4088809, 250719, -263067, + 1085016, 865973, 382789, -976568, 1723893, 125091, -17717, -741419, -1304060, -1027034, + -1171989, -777389, -1071594, 1152125, -923418, -930397, 556735, -1331977, -1137630, 89657, + 290447, 15032, -499827, 99858, -200790, -34897, -290447, 176094, -550830, -207232, + 331249, 322659, -553514, -185757, -54761, 38118, -12885, 593242, 113280, -70330, + 133144, -37581, 6442, 300648, -127775, 77309, -124554, 106300, 188442, 176631, + -46708, -88047, 22012, 26844, 38118, -75699, + }, + { + 870805, 23277112, -1594507, -2281702, -1866163, 518617, 1547799, -106837, 2741800, -148176, + -1709934, -4210142, 10241886, -6117107, 8683350, -3055332, 2018635, -6767258, 988916, -5522791, + 3933653, -8360691, 670552, 809601, 1295470, 68719, 137976, 494995, 2689187, -7472706, + 3241627, 1262184, -3169686, 876173, -1341104, -2508261, -335544, -596464, 841277, -1787243, + 1717987, 1639067, 976568, 687732, 741956, -607201, -514322, -566936, -829466, 463320, + -3758, -365609, -1845762, -394600, 1738925, 571768, 1074816, -275415, 198105, -335544, + 1256278, 320512, 229244, 140123, 99858, -836445, -9664, 362925, 55835, 174483, + 395674, 65498, -522375, 53150, 207769, 297963, 317291, -2147, 215822, 111132, + 140660, -71404, 73551, 24159, -259309, -345208, 218506, -222265, -496069, -127238, + 171799, -122407, -183610, 90731, -96637, 63351, + }, + { + 12856448, 103156528, -14526116, -5514738, 28454, -9564355, -16010027, 4437775, 3527779, -1875827, + 3711926, -3811784, 995896, 21090974, -8184597, 5731634, 8000451, 4323959, 1043140, -4017942, + -3376381, -407485, -819265, -7665443, -2124935, -1956895, 1228361, 3338263, -2350421, -4733591, + -2768107, 2530810, 1906429, 2568391, 1063004, -2872260, -2081985, 967978, -1161252, -3753265, + 2408403, 1024887, 1628330, -1035624, -1588601, 1729261, -2215666, 875100, 1585917, 2086280, + -1779727, -445603, -103616, 988916, -287763, 1517197, -695785, 274878, 458488, -856309, + 748398, -37044, -929324, -243739, -112743, 783832, -151934, -680752, -592169, -336081, + 359167, 1043140, -209917, 261993, 9127, -352724, 144418, -635118, 316754, 4832, + 112743, -199179, -377420, 107911, -241592, 210990, 82141, 248571, -153008, -113817, + 90194, 2147, 237834, -76236, -199179, -100395, + }, + { + 856309, -1010391, 3890167, 3246459, -4301410, -863825, -3084860, -1764158, 899796, -594316, + -4562329, -3459059, -5525476, -29748018, 47487304, -13756780, -1086627, 5355824, -6247567, 6702297, + -2149631, 1359357, -285615, 2725157, -8557185, 2132988, -543313, -174483, -2925947, 755914, + 1794223, -3627637, 130460, -170725, -649614, 2056216, 5350456, 1184337, -2833068, -727997, + -795106, -1085553, -579821, 1271310, -115427, 2069637, 524523, -1278827, 952946, 1294933, + 1222455, -991064, -598611, 664646, 1401233, 1403917, 539018, 469225, -885300, 721018, + -210453, -92342, 1155883, -717796, -16106, 54224, 379568, -333934, -164819, 345208, + 135291, -536871, 219580, -605054, 41339, -32212, -278636, 472983, 247497, -26844, + 143345, 5906, -127238, 45097, -228707, 259309, 56908, 54224, -136365, -71941, + 16643, 13959, 171262, 76773, 3221, -26844, + }, + { + -1687922, 75138304, -2159295, 3817689, -4618701, -3793530, 2940442, 401579, -455267, -3736085, + 2605435, -5191542, 3769908, -20330228, -25178708, -3547643, 3416647, 2377801, -1067836, -1986422, + -1152662, 1750736, -2274722, 3236258, -881542, -1345399, -2978560, -3179350, -75699, -60130, + -1233193, -2141041, -4737886, -1219771, 1739462, 3428995, 1831267, 1124208, -272730, -3051574, + 1387274, -228170, -2529199, 13422, 1489280, 4410395, -1752347, -2182917, -1032403, -344671, + -1493038, 688805, -1327682, -552440, -409633, 761820, 202400, -530428, -1010391, 918586, + -364535, -229781, 1022739, 881005, 872952, 594853, -286689, -110059, -128849, -255014, + 196495, 274878, -279710, -49929, -479426, -371515, 33286, -42950, 443992, -91805, + -83215, -537945, -113280, -223338, -26844, -161598, 234613, -114890, -102542, -42413, + -159451, -227096, 150324, 73014, 238371, -74088, + }, + }, + { + { + 66035, 76746768, 14488535, -4683662, -2979097, 1582159, -2544231, -1923072, -3882651, -155693, + 105764, -6495065, 4760435, 1205812, -6879464, -3503620, -1132798, 4966056, 21475, -9203041, + 5367099, -801011, 6506876, 1411434, 1202054, 8056285, 2743947, 2295123, 1060320, 8516920, + -2379412, 6641093, -1332514, -2387465, -6991670, -2908230, -634045, -1248762, 2179159, 612570, + 224412, -813359, 1960116, 711891, 42413, -1104880, 451508, -187905, 1184874, -2921652, + -348966, 359704, -922344, -904091, -758599, 721018, -1051730, -565325, -907312, -16106, + -77846, 305480, 7516, 79457, -245887, 537945, -256087, 1450625, -205085, 539555, + 238908, 194347, -333397, 466004, 369904, -75162, 555661, -82678, -308164, -42950, + 280247, 43487, -57445, 141197, 27380, 144418, -114354, -229244, 12885, 404264, + -153008, 235149, -227096, -141197, -50466, 98247, + }, + { + -8722542, 225454112, 27022860, -8198556, 49929, -503585, -2523293, 872952, -5988795, 1364726, + -1713692, -4543002, -4794794, 6658810, -3113315, -8734890, -375810, -1734630, 12847858, 4692252, + -2229088, -832687, -5191005, -27917, -2538863, 2538326, -1565516, -753767, 981937, -2040110, + 1751810, 1074279, 2435247, -2098092, 2763275, -591095, 4916127, -1267552, 1391569, 1500017, + -2751464, -2346126, 3517578, 2981781, -1335735, 1068373, -196495, 3187940, 1613297, -1684164, + -902480, 1111323, -1501091, 195958, -297963, 1335735, -1221918, -2374043, 37044, -394063, + 1132261, 67646, 994285, -912681, -714038, -359704, 39192, 512175, -1094143, 953483, + 346819, -564251, 80531, -81604, 304406, 199179, -321049, 527207, -308164, 284542, + -392990, -166967, -44023, 173409, -265214, 250182, -273267, -4832, 199716, -39728, + 340913, 144418, -178241, -343597, -95563, 118648, + }, + { + 548682, -171487840, -17835926, 9775346, 3060164, 4793721, -338229, 657667, -1451699, -1029182, + -4682588, -3109556, 329102, 1789928, 1059783, -2077690, -1212791, 3717294, -8492761, 1411434, + -9654550, -3087008, 4764730, -3141769, 3399467, -5717675, 1340567, -5408438, 969052, 118648, + 3424700, -6539088, -4580046, 870805, -4460324, -207769, 1786170, -2928094, -1991791, -937377, + -1515050, -2679523, -153545, 788127, 2015413, 122943, -183610, -892816, 780610, 1210644, + 881005, 231928, 425739, -2586644, 1857573, 374736, -588947, 1522029, -191126, -431107, + 594316, 246424, -533650, 398895, 276489, 168577, -396748, 438087, -117038, -41339, + 716186, 695248, 73014, -330712, 235686, 408022, 127775, 106300, 45097, -191663, + -148176, -140660, -15569, 110059, 228707, 4295, 107374, -182536, 168041, -190052, + -342524, 51003, -72478, -116501, -134755, -159451, + }, + { + -1238024, 32477468, 261993, -380641, 749472, 129923, -253940, -683437, -430034, -801548, + 2210835, 1331440, -291521, -1930588, 5854041, -4173635, -6196564, -2963528, -8333847, 1369558, + 334471, -3185792, -1580011, -1210107, 2470680, 2099702, -1752347, 2631204, -2789581, -340376, + -3824132, -4556961, -238371, -2944737, 1334124, 253940, 808528, -1000191, -1511829, 1784022, + 337155, 268435, -2894808, 204548, -418222, 221728, 347355, 506806, -1492501, 418759, + 1590212, -1368484, -36507, 505732, -532039, 1231582, -877247, -689879, -663036, -241055, + -738734, -457951, 16643, 305480, -387084, -493384, -16106, -133144, 358093, -244813, + 541166, 110595, -513249, 55298, 221728, -95026, 376883, -219580, -89657, -88584, + -109522, 383863, 75699, -63888, 162135, 110059, 168041, 16106, 23622, 124554, + 113280, -36507, -56371, 1611, -189515, -16106, + }, + { + 5027259, -194215200, 6134287, -10583336, -658741, -620086, -442382, -744640, 163746, 5029407, + -8127152, 5343476, 568546, 1257889, 4543002, -1906429, 2585034, -19430432, 3995393, -1606318, + -177167, -4189741, 498753, -1641214, 2939905, 1205275, -1939715, -1342714, -6364605, 3990025, + -4679904, 1305133, -2407329, 2213519, 1435056, -2950643, 8249022, 1444183, -1777580, -205622, + 428960, -2619393, -532039, 1416266, -90731, 422517, -1402844, 738198, 144418, -753767, + -2008971, 341450, 294205, 717260, 235149, 202937, 341987, -1020055, -91268, 783832, + -593779, 277025, 347892, -363462, -502511, 732829, -423054, 289910, 248571, 380105, + -303869, 197032, 68183, 9127, -200253, -33823, 170725, 334471, 425739, -70867, + 207769, 98784, -297427, -82141, -99321, -93416, 194884, -288837, -128849, 99858, + -420370, 59593, -19864, 159451, 99858, 108985, + }, + { + -375273, 868120, -1583769, 1593433, 43487, -79457, 56908, -1767379, -3299609, -518617, + -140123, 10737, -6315213, -3841312, 1105954, -2684, -2135136, 4372814, -6692633, -2176475, + 13296682, 926102, -3251827, 13351980, 1986959, -294205, 1645509, 3471944, -6546604, 1123134, + 4490925, 882616, -1406602, -2034741, 3645354, -925565, 1705639, -2364916, 1019518, 1787243, + 2350421, -446140, -374736, -2359011, -2209761, -507343, -1666447, 1729798, -18254, -649077, + -858457, 435402, -724776, -717796, 922881, -537408, -154082, 519691, 1079111, 711354, + -1257889, 23085, -979789, -513785, 103616, 285078, -738198, 571768, -117575, -110059, + 29528, -121870, 249108, 634045, -92342, -363998, 257161, -610422, 116501, -545998, + -45634, 189515, -136902, 255551, -57982, -311922, 4295, -50466, -352187, 18790, + -134755, -2684, -280247, -51540, -347892, 17717, + }, + { + 52674552, -61424476, -14661945, 7722888, -2813741, 38118, -242666, -537, 888521, -531502, + 2040646, -2490544, 3519726, -519154, -2360622, -823023, 624918, -2756295, 3701188, 314069, + 4156992, -657667, 935766, 1632088, 1522029, 1204202, -643708, 92342, -1937030, -1856500, + 2371896, 1197222, 1174674, -1577327, -1846299, -254477, 1551557, -2100776, 916976, -741956, + -379031, -1536525, 874563, 2800319, -1253057, 1056025, -112206, -969052, -1203128, -486942, + -768799, -2137820, -692564, -1825361, 298500, -774705, -349503, -292595, -287226, 568546, + 1138166, -154619, -493921, 35433, 88047, -672162, -289373, 823023, -355945, 184147, + -131533, -271120, -445066, 44560, 293668, 255551, 106837, 267362, 200790, -278636, + -365072, -314606, 24159, -346819, 198642, -226560, -62277, 289910, -457951, -287763, + -5906, 90731, -157840, -46171, -78383, -99321, + }, + { + -498216, -10436771, -5832029, -1459752, -289910, -102542, -482647, 4832, 1221381, -372052, + 2271501, 3267933, 5138392, 1481227, 18494666, 5031554, 12115029, -2217277, 2518998, -8846022, + -3413425, -10630581, -6231998, -13119514, 5259725, 2401961, -3912178, 5566278, -5995238, 741419, + -2781528, 2785823, -4472135, 1268626, -611496, -263604, 701153, -1127429, -3198677, 736050, + -197032, 79457, 1917703, -1022202, -1046898, 12885, 1334661, 1474784, 614717, -1345399, + 17180, -1861868, -374199, 808528, -278636, -179852, 659278, -1000191, 380641, -1037772, + 1892470, 1108638, -60666, 196495, 359704, 22012, -1111323, 884763, 333934, -15569, + 198642, -377420, 34360, -196495, -251256, 78383, 122407, 66572, 205085, 490163, + 64961, 401579, -314069, -268435, 318901, -181462, -114354, 347892, 162672, -202400, + 125091, 3221, 289373, 7516, 103079, -49929, + }, + { + -36086316, -189527776, 17627082, 4545149, 3372623, -2566243, 1004486, 503585, 112743, -1556389, + 1545115, -721555, 6061810, -3930432, -2445447, 593779, 34897, 8541616, -544387, -6077916, + 129386, 1047435, 1726040, -5235565, -594316, 2961380, -3528316, 1922535, -3009698, 981400, + 3095598, -4096862, 262530, -1409823, -2179159, 878858, 695785, -1128503, 1870458, 337155, + -3781719, 1882806, 229244, -1764695, 1739462, -350577, -564788, 1528472, -1246077, -1772211, + -575526, -46171, 526670, 775242, -740345, 133144, 47245, 75699, 683437, 1024887, + 377420, 953483, 191663, 0, 525597, 647466, -323733, 183610, -84826, -546535, + -16106, 627602, -267899, 337155, -6442, -150324, -442919, -39192, -615791, 369367, + 122407, -132607, -177704, 68719, -57982, 370978, -163209, 222801, 60130, -51003, + 277025, -18790, 29528, -48855, -92879, 61203, + }, + { + -1370095, 33552284, 8323647, -2469069, 784905, 323733, 4625143, 754304, -765041, 1346472, + -2407329, 1454383, -6873559, 1491427, -14907295, -3918621, 9211094, -9168145, 3638374, -5076115, + 1379221, -139050, -4948339, 7455527, -1072131, -580894, -1497333, 310311, 2779381, 2981244, + 4064113, -2829847, -195421, -2069101, 632434, -1375463, 3125663, 290447, -868657, 2074469, + 527207, 598611, -1119376, -778463, 1197222, -645856, 932008, 777389, 825707, -1062468, + 1507534, -1769527, 314606, 1103270, 272194, -785979, 831076, 515933, 119185, -416075, + 1045288, -692027, 267362, -503585, 81068, 47782, 148176, -683437, 332323, -424128, + 398895, -219580, 71941, 116501, 32749, -94489, 12885, 147640, 112743, 182536, + -73014, 397821, -256087, 194884, -396211, 302258, -415001, 38655, 114354, -103616, + 230854, -91805, 6979, 79994, -98784, -40265, + }, + { + -6208375, -151601072, 8414915, -9175124, -2946885, -970663, -13087839, -7063611, 4807679, -3100967, + 1175747, -1919314, -1234803, 4378719, -4062502, 1974611, -1284195, 12748000, 3796214, 53150, + 5182415, -1457068, 801548, -1944010, -1334124, -1696512, -179852, -624918, 415001, 3181497, + 411243, -1095754, -3052111, 594853, -193274, 1204202, -98784, 4179003, 3142306, 2471754, + 2699924, 1729261, 228707, 161598, 749472, -1217623, 643171, 256624, -600222, 97174, + 612033, 209917, -149250, 1401770, 280784, -111132, 942208, -733366, -119185, 93416, + -483184, -267362, -426276, 110059, -136365, -48318, -292595, 245350, -964220, -164819, + 165893, -112743, -481036, -124554, 18254, 163746, -53687, 186294, 3221, 102005, + 537, -33823, -274341, -230318, 119722, 284542, -20401, 205622, 67109, -1611, + -127775, 46171, 371515, 79457, -12348, -43487, + }, + { + -233539, 19985020, -4206384, -4467840, -2297808, 2115272, 1336809, -1059783, 1022202, -780073, + 675921, -3514357, -2201171, -27773406, 246424, -2453500, 6429566, -1275605, 803696, -3766150, + 4008278, -12392591, -1308891, -3287261, 9375914, 7398081, 302258, -117038, 5459441, -3953518, + 2626909, -948114, 1083406, 3692061, 3656628, 3362423, 2932926, -889058, 416075, -620086, + 1502702, 55835, -1202054, -1139240, 1023276, 782221, -327491, -40265, -347355, -63888, + 687732, 983011, -369904, -311922, 922881, -1014149, -378494, -1386201, -105764, 587874, + 1577864, 137439, -266825, -124017, 574989, -418222, 115427, 89657, 142808, 286152, + 486405, 302258, -375273, 485331, 435402, -28991, 92879, 127775, 238371, 117038, + 171799, -184147, -190052, -73014, 51540, -34360, 132607, -208843, -242129, 10737, + 145492, -34897, -92342, 174483, -7516, 134218, + }, + { + -21927418, 49571440, -10160819, 7071664, 3350075, 5921150, -5285494, 2618320, 2346126, -4701916, + -935229, -8781061, -7834557, 13405667, -10070088, -4398584, 1456531, 7041599, 4185446, -230854, + -1334661, -311922, 3409667, -987843, 3358665, -796716, -177704, -13422, -90731, 1446330, + 2118493, 2142652, -1283658, 107374, -3135863, -2563559, -958315, -198105, -646929, -3336653, + 326418, 536334, 3813394, -380641, -1341104, 2774012, -1956895, 187368, -471910, 2344515, + 337155, 1088237, 199716, -1113470, -1760400, 352724, 7516, 1315871, -754304, -1973538, + 609349, -206158, -247497, 165356, -125628, 1171989, 169651, -606127, -366683, 25233, + 27380, 613107, -134218, -19327, -166967, -162135, 174483, -527207, -61203, -136902, + 605054, -43487, -578210, 91805, 55835, 228707, -149787, 157303, -251256, 39192, + 290984, -22012, 34360, -113280, -51540, 5369, + }, + { + -657667, -23085, 5898064, 2994666, -2441152, 2144799, -2309082, -2991982, 456340, 971200, + -2809982, -1598802, -9404368, 3665218, 98277440, -8676908, -49392, 9637370, 275415, 4059818, + -288837, 191663, -46171, 6945499, -5545877, 2340757, -1872069, -3011846, 2025077, 4282083, + 1613297, -2800856, -212064, -280784, 397284, 1048509, 1573569, -1210644, -2742337, -773631, + -2705293, 385473, -152471, 2414845, 46708, 513785, -2092723, -1775432, 463856, 1079111, + 529355, -857920, 1053878, 1142461, 381178, 363462, 529892, 693637, -1016297, 1015760, + -872415, -951335, 880468, -973347, -686121, -341987, -208843, -469762, -228170, 616865, + 500364, -194347, 574989, -533113, -328565, -271120, -66572, 196495, 442382, 36507, + 169114, 448287, -62277, 42950, 62277, 34360, -320512, -74088, -38655, -213675, + -128312, 6979, 245887, -41339, 31139, 30065, + }, + { + -10815801, 70389144, 1442035, 3919695, -4425427, -5041755, 2425583, -1898912, -2331094, -3112241, + 1005559, -7907572, 5092221, 13322989, 18116708, 2025614, 7595113, 748398, 1250372, 1685775, + 3436511, 2864743, -2790655, 1537598, -1323387, -1861868, -6731825, -853088, 1168768, -2390686, + -232465, 1173063, -126165, 1191317, 881005, 50466, -1780801, 550293, 221728, -1680943, + 2662343, 1714229, -672162, 932545, 1535451, 2358474, -2866354, -1502165, -128849, 564251, + -1778653, 146029, -4295, 805306, 105764, 1665911, 1368484, 434865, -937914, 504659, + -166430, -470836, 741956, 1307818, 752156, -91805, -206158, 987843, 464393, -354335, + 348429, -211527, -458488, 525597, 29528, 390305, 292058, 151934, 552977, 54761, + -104153, -250182, 242129, -250182, 80531, -9664, 394063, -133681, 121333, -17180, + -173409, -180389, 89657, -106837, 176094, -272194, + }, + }, + { + { + 850940, 66901096, 14106283, -4220342, 971200, 172872, -3586298, -1479079, -2989297, 2493229, + -4185983, -5397700, 3103114, -2586107, 2554969, -4843113, -1903744, 6438693, -3719979, -7327751, + 7450695, 2925947, 942745, 1711545, 5876052, 3207267, 8974334, 1753957, 208306, 4746476, + -1610076, 8408472, -3715147, -2521146, -4993437, -3888556, 361314, -4569309, 2469069, 1211181, + -1052804, 1231582, 219580, 2233920, -1255204, -1454383, -875100, 1415192, -1250909, -1896765, + -160524, 154619, -803159, 202400, -558346, -288837, -1090922, -963683, 711354, -719944, + -332323, 273804, 389768, 216359, 74625, -359704, 402653, 529355, 82141, 372052, + 548682, 137976, -315680, 159988, 505196, -327491, 717796, -26307, -331786, -6979, + 106300, -110595, 387084, -9664, 238908, 13422, -111132, -221728, 88047, 174483, + 314606, -91805, -106837, -157840, -30602, -119722, + }, + { + 9906879, 221927408, 265214, -3367254, -62277, -1437203, -1330903, -2050310, -4272956, -8590, + 3817152, -5670968, -4740034, 2044404, 884763, -13233331, -2644089, 7144678, 9028021, -123480, + 864362, -6913287, -2580739, 683437, 711891, -1879585, -2127620, 1072131, 257161, -2684, + -668404, 3740917, 901943, -607201, 87510, 2088965, 1456531, 549756, 563178, -272194, + -1990717, -646929, 3674882, 814970, 377957, 619012, 707059, 2314451, 930397, -206695, + -407485, -89657, -715112, -176631, 349503, 566399, -853088, -759672, -900333, 185220, + 49929, 558346, 377420, -306553, -779537, -494458, -657130, 586263, -464393, 479963, + 212601, -164283, -561030, 244813, -5906, 37044, 428423, -199179, 103616, -171262, + -229781, -35970, -201327, 277562, -67646, -60130, 53150, -15032, 122943, 17717, + 207232, 151398, -178778, -328565, 17717, 56371, + }, + { + 193274, -171806208, -11045582, -3709778, 10064719, 2269353, 434865, -1282585, -805843, -2303713, + -2542084, -847719, -3440806, -4749160, -77846, 6318434, -7195681, 5555540, -1549946, -1367410, + -9904195, -4643934, -1287953, 1210644, -266288, 368830, -1588064, -2090575, -3278671, 106837, + 1887638, -4286914, -2595771, -3089692, -4850092, 2338610, 732292, -4933307, 153008, -1052804, + -1847910, -1945620, -2077154, 2907693, 1974611, 1466195, -3111704, -132070, -18790, 2570538, + 1034013, 627602, -315680, -2328946, 67109, 1513439, 526670, 697395, 811749, -1341640, + 101469, 1079647, 181462, -74625, -139586, 321586, 93416, -310848, -66572, 146029, + 933082, 863825, -112743, 28454, 630286, 211527, 148176, 114354, -309238, -125628, + -86436, -158377, 88047, 49929, -44560, 339839, 49929, -292595, 40265, -282394, + -132607, 47782, -55835, -181999, -54224, -67646, + }, + { + 1008244, 26909580, 2115272, 272194, 52076, 128849, -132607, -568009, -1235877, 162135, + 1125281, 2725694, -2484639, -5702106, 5180268, -3391951, -1977833, 3649112, -13485124, -3476776, + 2117956, -616865, -3186329, -406948, -3962107, 1716913, -2293513, 5745593, -3122978, -959925, + -2663417, -2152316, -4596152, 695785, -1989107, -63351, -472446, -96637, -216896, 1367947, + -280247, -143881, -1570884, -1401770, 3758, 973884, 656593, -1039919, -509491, 855235, + 332860, 466541, 329639, -273804, 397284, -273267, -51540, 50466, -1552094, -395674, + -244276, -932008, 697395, -282931, -419833, -165893, -12348, 376883, -333934, 593779, + -12348, 60666, -801548, 575526, -19327, 56908, 194347, 81068, -56908, 248034, + -307627, 132607, -34360, 114890, 225486, 68719, 32212, 135291, 156229, -34360, + 177704, -90194, 118112, 39728, -160524, 93952, + }, + { + -18540300, -185437360, 22277458, -18460306, 3845070, 650151, -2548526, 3158949, -3773129, 340376, + 3977677, -2887292, 1909113, -260382, -34897, 1103270, 3620121, -22741314, 12017318, -5737003, + -5311801, 2483028, -5254356, -2650532, 2429878, 1611687, 621160, -6233072, -4372814, 3155190, + -3790309, 2610266, -602906, -721018, 64961, -2562485, 4813585, 3661460, -1509144, 334471, + -1603633, -893890, 358630, 560493, -433792, 537, -224949, 316754, 755377, -2209224, + -2204929, 653372, 594316, -681826, 1219234, 85362, 606664, -1128503, -716186, 117575, + -264141, 329102, 305480, -396748, -426812, 395674, -29528, 125091, 561030, 274878, + -99858, -441845, 175020, -192200, -73014, -154082, -93416, 583042, 449361, -57445, + 209917, -271120, 165356, -135291, -51540, -58519, -53687, -158914, -156766, -44560, + -349503, 122943, -104690, 141197, -6442, 68719, + }, + { + 0, 4400731, -4359392, -831613, 733366, 82678, 37581, -2155000, -1058173, -455803, + -1449015, 132070, -5964099, -7939247, 22012, -20401, 1455994, 1326071, 3559991, -6131066, + 2889976, 2131915, 5479842, 5347771, 2287607, 2598455, -6675453, 10051834, -5830418, 1454383, + 2866354, 1928977, -584652, -3841312, 4005594, -122407, 102005, 554051, 1540283, -293132, + 2578054, 201327, -769873, -1577864, -2353105, -1151588, 173946, -580894, 200790, -1058710, + -432181, -56908, 876710, -1305133, 1151051, -776315, 141734, 388158, 1102733, 168577, + -825171, 628139, -1752884, -358630, 152471, 159988, -491774, -39728, 465467, -411243, + -53150, 239444, 545461, 89657, 177167, 230318, -404264, -134218, -275952, 33823, + -203474, -168041, 228170, 166967, -175557, -74625, -300111, -193810, -138513, 8590, + -115427, -105764, -188442, -122943, -55835, -78920, + }, + { + -56534116, 14949707, 30732102, 3361886, 5660767, -621697, -187905, 1677722, -1776506, -3755949, + 707059, 3900367, 1481227, -99858, -3348464, 4067871, -2592013, -1009317, 2660732, -148176, + 1511292, 868657, 840203, 1272384, 2443837, -1779190, 381178, -1441498, -1124208, -2713346, + 1029182, 4847945, -363998, -2231236, -177167, -136902, -485331, -1503775, -257161, -105764, + 435939, -1324997, -235149, 1759326, 1067299, -227633, -113280, -996432, -2879776, 1279363, + -1814087, -2080912, -332860, -1687385, 1253594, -2059437, -284542, -109522, 212064, 477815, + 1058173, -496069, -74625, 110595, -173946, -453656, -514859, 719407, -314606, 282931, + -168577, -713501, -198105, 264677, 206158, 183073, 252329, 382252, 92879, -371515, + -248571, 129386, -259309, -71941, -272730, -11811, -6979, 33823, -227096, -263067, + -52076, 88047, 537, -92342, -121870, 79994, + }, + { + -904091, -10730976, -6426882, 330176, -88047, 139586, -11274, 420907, -326954, 404801, + 1586454, 2972117, 2374580, -1264868, 7892003, 11752641, 13886703, -513249, -2107218, 212601, + -14740865, -3328600, -6843494, -8148627, 4459787, -6136435, 1545115, 1023276, -2192581, -3714073, + -1329829, -688805, 13422, -2793876, 1968169, -1826972, 1962800, -2539400, -1467805, 104153, + 379568, 1088237, -1173063, 776315, -1891396, 2090039, 752156, 1010391, 761820, -1510218, + 399432, -1542967, -788127, 1878511, -359704, 785442, -278636, -654446, 337155, -929324, + 1678259, 638876, 1234266, -323733, 99858, -155693, -8053, -59056, 489626, -443992, + 857920, -206695, -494995, -199179, -66035, -353798, 830002, 25770, 314069, 412317, + 200253, 78383, -280247, -101469, 168041, -168041, -47245, 607201, -73014, -84826, + 131533, 45634, 71941, 78920, 110595, 5369, + }, + { + 20058572, -239548048, -37044, 3098819, 3670587, -861678, 631360, 747861, -1069447, -427886, + 689342, -622233, 2439542, 965294, -3024731, -632434, 2262374, 2229088, -1327682, -744640, + -517544, -585189, -1031329, -1215476, 424128, 614717, -224412, -637803, 979789, -2536178, + 1598802, 1682017, -2375654, -1944547, -1866163, 972273, -267899, -126702, -536334, 1590749, + -3313567, 712428, 373662, 958315, 847719, 134755, -909996, 1082869, -1247151, -694711, + -1386201, 709743, -420907, 986232, -441308, 323196, -326418, 184684, 525597, 920734, + 634045, 680215, -236223, 780610, 77309, 706522, 113817, -333397, -5906, -563178, + 134218, 26307, 148713, 157303, 357019, -396211, -434329, -137439, 30065, -164819, + 178778, 19864, -76773, -134755, -93952, -24696, 69793, 119185, 224949, 52613, + 41339, 56908, -54761, -52076, -91268, -84826, + }, + { + 1112933, 37609416, -3304977, 2785286, 795106, 2701535, 1155346, 527207, 1141924, 3579855, + -34360, -3536906, -272730, -699006, -12904766, -188979, -1280974, -3735011, -5007395, -621160, + 3474092, -476741, -3172907, 5572183, 1687922, 1324997, -5031018, 2178622, 1160715, 5358509, + 184684, -687732, -1091459, 2099702, -1940252, -1130650, 5167383, -311385, 825707, 1267015, + 1526861, -388695, -972273, -1261110, 958315, 2239826, 194347, -299037, 1402844, -1015223, + 993748, -787053, 647466, 363462, 527744, -455803, 579821, 15569, 204548, 40265, + 242129, -412854, 518080, -639413, -488016, 35970, 157303, -293132, 44023, 50466, + 436476, -381178, -394063, 420907, -337692, 306016, -45097, 70867, -248571, 435939, + 118112, -119185, 204548, -231928, 28991, 67109, -204011, -52613, 113817, 220117, + 25770, 91805, -32749, 106300, -28991, 104153, + }, + { + 4685273, -139137072, -5038534, -10594074, -2728378, -1657321, -16253230, -802622, -2866891, -2040646, + 1815697, 1977833, -2164127, 2678449, 694711, -4373351, 9660992, -430570, 7634305, -98784, + 3491272, 940598, 1097364, 214212, -2524367, -2491081, -2052458, -886374, 3052648, 4407710, + -1684164, -4076461, -2176475, -20401, 2542621, -57445, 1270237, 4807142, 1124208, 2949032, + 3062312, 3066070, -178241, 1508607, -998043, -1442572, 499827, 379031, 849330, 286152, + 326954, -506806, 1502702, 136902, 955630, -770410, 741419, -415538, 374199, -40265, + -640487, -61203, 182536, -240518, -59056, -9664, -437013, -31675, -602369, 3221, + -112206, -352187, -354872, 201327, 339302, -17717, 154082, -254477, 134755, 19327, + -114354, 128849, -417686, -248571, 189515, 135828, 147640, 148713, 179852, -55835, + -171799, -28991, 316217, 35433, 60130, 109522, + }, + { + -166430, 15400679, 2441152, -7429757, -1089311, 1894081, -1709397, 683437, 272194, -1588064, + 1981591, -3013457, -12982076, -11461657, -4759361, -114890, 2982855, 3558381, -4958540, 1843078, + 4471598, -14985678, 2852932, -4153770, 7660074, 6448894, -3063386, 2900177, 3180423, -528818, + 1917166, -3420405, 529892, 5435281, 1831267, 4105989, 3012920, -683974, 2382096, 690953, + -2209224, -679679, 346819, -266288, 1234266, 398358, -900869, -643171, 461709, 425739, + 506806, 43487, 1277216, -184684, 87510, -1348620, -1002338, -1063541, -358630, 689879, + 1741072, 3221, 159451, -527744, 15569, -199716, 156229, 181462, -204011, 637266, + 301721, 310311, -181999, 172336, 348429, 169651, 314606, 63888, 79994, 171262, + 120259, -107374, -141734, -235686, 32749, -31675, -227096, -205622, -67646, 92342, + 12348, 55298, 49392, 6442, 62277, 138513, + }, + { + 19818590, -5106716, -6396280, -321049, -718333, 12665859, 1567126, -1116692, -1544578, -1078037, + -2326799, -7660074, 6228777, -10762651, -2297808, -2110977, -3718368, 3940096, 2631741, 5450314, + -3380139, -1308891, 2831457, 3636764, 1406065, 2477123, -2266132, -733903, 1494649, -243203, + 4748623, -423591, -484258, -1613834, -2336999, -687732, -2286533, 1545651, -1307281, -1120987, + -1807108, -1166621, 3550327, 130460, 740345, -49929, -441308, -325344, -128849, -48318, + 2828236, 800475, -1379221, -242129, -976031, 1140851, -1015223, 1065152, -595927, -887985, + -363462, -379568, -550830, 757525, -482110, 1228361, 558883, -835371, 26307, -9664, + -212064, 296353, -77309, -55298, -370441, 333397, -701153, 289910, -170188, -127238, + 284005, -38118, -321586, -151934, 141197, 51540, -283468, 71941, -47782, 6442, + 264677, -36507, -43487, -127238, 143881, -26307, + }, + { + 485868, -330176, 3147137, 2553358, -484258, 290447, 217433, -1280437, 556198, -1205275, + -1008780, -746787, -7986492, 34778496, 55370180, 2313377, 1462436, 2287607, 2597382, -3082176, + 8010651, -1910724, 1518271, 2476586, 455267, -673236, -722091, -424128, 111132, 1948305, + 2575370, -326954, -1370632, -2008971, -1804423, -44560, 2407329, -1384590, -2342905, 23085, + -4345433, 3185255, -817654, 1613297, 366683, 340376, -3191698, -1446867, 538482, 1780801, + 370978, -587337, 1254667, 576063, 141197, -380641, 1069447, -126702, -424128, 704912, + -697932, -379031, 696322, -1043677, -699006, 164819, -1265942, -52613, 115427, 606127, + 271120, -83752, 150861, -309238, -332860, -132607, -11274, -59056, 54761, 142808, + 386010, 508954, 85362, -8053, 220654, -270046, -479963, -122943, 160524, -192737, + -55298, 20938, 179852, -27380, 96637, 10201, + }, + { + 17099876, 46186468, -7554848, -330712, -2216740, 3912715, -6272800, -1202054, -2804077, -3036005, + 3110630, -2364380, -272194, -7773891, 53323092, 4782446, 6732361, -5344013, 1908039, 2196339, + 3711926, 2625836, -2559264, -1063541, -736587, -2500745, -4679904, 4258460, -3203509, -1835025, + -743029, 545998, 3406983, -290447, -350577, -685584, -2488397, 1104880, 993211, 55835, + 345208, 2718714, 776852, 916439, 1404991, 22549, -2374043, 74625, 236223, -790274, + -484258, -958315, 1771674, -274341, 726386, 1642825, 557809, 1318018, -992137, -929860, + 561567, 112206, 505196, 557809, 817654, -647466, -112743, 787053, 513785, -149787, + 57445, -155693, -286152, 767189, -139050, 490700, 70330, 508417, 64961, 323733, + -112206, -151398, -17717, 69793, 142271, 31675, 263604, -83215, 76236, -149787, + -15032, -140123, 16106, -53687, 25770, -194884, + }, + }, + { + { + -266825, 4566624, -37771016, -3140158, 2633352, -1155346, -1910724, 1411434, -19864, 2544231, + -5004711, -1391569, -378494, -10468446, 9397925, 5614059, 730681, 509491, -5630702, 245887, + 12719009, 2394444, -1304060, -2445447, 347892, -5289252, 2523293, 321586, -3449396, 1836635, + -2695629, 3573413, -4037269, 3508988, 3487514, 1195612, 2869575, -5323075, 877784, -11274, + -2336999, 555661, -717796, 1137630, -1546725, -1318018, -1660542, 399969, -930397, -609349, + -168041, 411243, 340913, 776852, -173946, 52076, -366146, -319975, 1452773, -241592, + -767725, -55835, 366146, -210453, 45634, -138513, 358093, 455803, 112743, -325881, + 29528, 209380, 11811, -91268, 95563, -453656, 397284, -34360, -42950, -45097, + 97711, -106300, 248571, -98247, 226560, -22549, -83215, -107374, 62814, -177704, + 256087, -180926, 91268, 130997, 82141, -102005, + }, + { + -6605660, 153247120, -33708512, -1595580, 1265405, -58519, -1337346, 1074816, 928787, 2163590, + 5486284, -3272765, -3404835, -2640868, 3821984, -2137820, 1264331, -4661114, -2767570, -2286533, + -1797981, -3893925, 1055488, 2790118, 361314, -3062312, -30065, 1871532, -16643, -340913, + -2525441, 1720671, -1228361, 620623, 635118, -381715, 190589, 1414118, 839666, -183610, + 565862, 356482, 1200980, -1024887, -1442572, -1302986, -789737, 721018, 711354, 82141, + 776315, 1072668, -728534, -496069, -94489, 72478, 160524, 333397, 194347, 212601, + -827318, 4295, 401579, 35970, -792421, -413927, -1032940, 382252, -246961, 60666, + -83215, -203474, -222265, 315680, -317291, -23085, 209380, -549219, 293132, 114890, + -63888, 56371, -7516, 330712, -24159, -53150, 311922, -111669, -27380, -141734, + 8590, 128849, 9127, -188979, 95026, 41876, + }, + { + -1435593, -103781440, 37754912, -18755586, -7444789, -2640868, 1124745, -226560, 832150, -2023467, + 132070, 273267, -3694746, -1527935, -3586298, 5682779, -3685082, 2876018, -2816425, 984084, + -4976794, -309238, -494995, 1584306, -544924, 1995012, -540092, 2415382, 651224, -1789391, + -994285, -2818036, -2158221, -3144990, -3122978, 811212, -594316, -449361, 2164664, -209917, + -161061, -748398, -1018444, 1527398, -577673, 802085, -2610266, 1090385, 1006633, 996969, + -1059246, 120259, -623844, -1599875, 220654, 694711, 559956, 1013612, 981400, -1051730, + -34897, 544387, -330712, -501974, 251792, 64961, -270583, -324270, -402653, 54761, + 759136, 316754, -98247, -19864, 231391, 230854, 96100, -163209, -120796, 297963, + -132607, -172336, 226560, -76773, -316217, 181462, -31675, -182536, 108448, -324270, + -38118, 28454, -42413, -81604, 121870, 49392, + }, + { + -372052, 14458471, -5228049, 129923, -558883, -298500, 346819, 612033, -832150, 169651, + 689879, 2228014, -5032091, -4013647, 8307004, -3149822, -3307125, 4828080, -10200547, -1872069, + 360240, 1872069, 496606, 484794, -1842004, 4543002, 1792075, 6801081, -2581812, 1657857, + -491237, -658741, -2665564, 2932389, -1149441, -518617, -692027, 670015, -174483, 951335, + -752693, -879395, -64961, 649614, 847182, 753230, 575526, 156229, 40802, -306553, + -755914, 701690, 171262, -759672, 43487, -714575, 440234, 775778, -1093069, 215285, + 201863, -607201, 515933, -398895, -511101, 194347, 455267, 366683, -542777, 705448, + -225486, 340376, -113817, 376347, -289373, 85362, 224412, 97711, -147103, 186294, + -467615, 57982, -144955, 44560, 16643, -104153, 21475, -36507, 14496, -195958, + 75162, -37581, 73014, 45634, -35970, 138513, + }, + { + 27260694, -157394976, -2629594, -11415486, 2733210, -1158567, -4453881, 1780264, -3276523, 244276, + 5422933, -3366181, 2932926, 1904818, -7404524, -6305012, 1384053, -25843892, 5850283, -5142150, + -2745021, 4588099, -4394289, -2222109, 962073, -1403917, 974958, -1283658, 151934, 3365644, + -770947, 1939715, -1126355, -1547262, -24159, -23622, -930934, 275415, -106837, 539018, + -357556, -981937, 294205, -208843, -1246614, -117038, 689342, 646393, 217433, -2261837, + -1877975, 387084, -12885, -1254667, 1036161, -415001, -216359, -581968, 23622, -329639, + -411243, 266288, 170188, -151398, -531502, 142808, -27380, -269509, 18790, -377957, + -209917, -556198, 15569, -17717, 4295, -15569, -93416, -11274, 241055, -44560, + 104153, -168577, 201327, -232465, 98784, 147103, 124017, -15032, -178241, -58519, + -204011, 245887, -67109, 50466, -32749, 54761, + }, + { + -110595, 4789426, -5033702, -1553168, 6979, 213675, 588411, -1190243, 1200443, 108448, + -2076617, 256624, -4286378, -966368, 4176856, -2727304, -1200443, 1299765, -3956202, -16008954, + 2256469, 1512365, 1391033, 2541010, 998043, 826781, -2093797, 14377403, -1566589, 687195, + -2354179, 1668058, -544387, -4631586, 1593970, -2517925, -874563, 678605, 1586990, -986232, + 726923, -627065, 684510, -290984, -926639, -47782, 289910, -1447941, 1076426, 810675, + 635655, -222265, 724239, -1187022, 456877, -1014149, 106300, -289373, 126165, -457414, + -771484, 949188, -1051193, -122407, 352724, 139586, -526134, -37044, 549219, -422517, + -43487, 83215, 233002, 54761, 453656, 18790, -693637, 232465, -245350, -81604, + -56908, -252329, 117038, -62277, -128312, 194347, -310311, -129923, 24159, 40265, + -33823, 66572, -21475, -271657, -39192, 97711, + }, + { + 49074296, 44639204, -54943368, -5168457, -446677, -1018981, 476741, 848793, -324807, -911607, + -1275068, 541166, -622233, -113280, -6507949, 4934918, 2023467, -1503775, 2115808, 488553, + 208306, -1571958, -2896419, 464393, 1135482, -3585224, 2319282, 1526324, 1893007, -1014149, + -148176, 2379412, -3128347, -2576444, 1832877, 619012, 696858, 919660, 67646, -215822, + 882616, -1729798, -1264331, 1257889, -486942, -104153, 679679, -556198, -2481417, 932008, + -306553, 160524, 1021129, -1098438, 1695438, -2267206, -834297, 565862, 194347, -39192, + 980863, -651761, -114890, 206158, -294742, -236223, -595390, 214748, -576063, -91805, + 33823, -391379, -194884, 194884, 156229, 78383, 268972, 106300, -53687, -171799, + -100932, 402653, 68719, 159451, -153008, 282931, 12885, -88584, -37044, -92879, + 91268, 97711, 117038, 19864, 20401, 286689, + }, + { + 584652, 3760244, 161598, -120796, -74625, 55835, 282931, 176631, -572304, -457951, + -259309, 1648731, 869194, 1682017, -3796751, -11651173, 506806, 1532230, -4089883, 6460168, + -234076, 5415954, -1726040, -3169149, 3334505, -10132902, -1664837, 275415, -3360275, -3614215, + 777389, -1786170, 3265249, -417149, 1196685, -3489661, 1903744, -274341, 766652, 854699, + 282394, 223338, -2083059, 733366, -1728188, 1924682, -115427, -446677, 1285269, -255014, + 286689, -275415, -185757, 1134945, -1120450, 108448, -236223, -170188, 727460, 228707, + 1075352, -562641, 416612, -891743, 112206, 224949, 397821, -642098, -101469, -843424, + 425202, 79994, -79457, -99858, -18790, -407485, 636192, -101469, 328028, -9664, + -114890, 173409, -18790, 244813, 181462, -239444, -47782, 262530, -222265, 74625, + -27380, -85899, -61740, -32212, 77309, 36507, + }, + { + -2714956, -223520832, 39660800, 3816079, -1726040, -36507, 2035278, 1979443, 251792, 181462, + 1313186, -514859, 158914, -228707, -3385508, 1386738, -1728188, -3890704, -245887, 3069291, + 461709, -814433, -357019, 575526, 2233920, 1847373, 1094143, -425739, 1542430, -2232309, + 2015413, 2137283, -887448, 321049, -452045, 109522, -943282, 621697, -1838783, -1231582, + -5640366, -306553, 1173600, 1008244, -319438, 342524, -748398, 286152, -1075889, -95026, + -1506997, 448287, 34897, 1506460, -182536, -84289, -477278, -73551, -310311, 184147, + -123480, -125628, -405874, 551366, -191126, 391916, -148713, -332323, 338766, -330712, + 22549, -275415, 34360, 89657, 357556, -186831, 275952, 22549, 230854, -254477, + 48855, -134218, -75699, -62277, -96637, -157840, -141734, -140123, 90731, -104690, + -104153, 95026, -45634, -2147, -128849, 32749, + }, + { + -558883, 25334402, -13449153, 1584306, 2140504, -1768990, -5101348, 730144, 506806, 2157147, + 427886, -640487, 2778844, 859530, -5747203, 6584185, -1904818, -3709241, -4400731, -4153234, + -55835, 855235, -4923107, 1621887, 2496450, 2392834, -4574677, 260919, -871878, 307090, + -1973001, 2874407, 149250, 1877438, -381178, 752693, 3769371, -1626719, 207232, 456877, + 1312113, -759672, -497679, -721555, 429497, 976031, -740345, -1036161, 304943, -1320166, + 1150514, -317828, 852014, -338766, -43487, -302258, 537, -179315, 454730, 51003, + -410706, -362388, 553514, -22012, -301721, -271657, 321049, -221191, -117038, -133681, + 307627, -338229, -375273, 452045, -219043, 463856, -171799, 20938, -185757, 255551, + -114890, -19864, 418759, -265214, -5369, 77846, 118648, 169114, 94489, 219043, + -116501, 171799, 98247, 131533, -12885, 102005, + }, + { + -3085934, -98577016, 40477384, -4168803, -2006824, 1611687, -11591580, 194884, -2175401, 1742683, + -745714, 70867, -525597, -820339, 2309082, -2136746, 9450002, -4231617, 1972464, 47782, + 3837017, 865973, -40265, 403190, -534723, -1271310, -1535988, -930934, 2183454, 2140504, + -3259880, -932545, 1265942, -1006096, 2774549, 766115, 822486, 529892, -2381023, 1662689, + 524523, 1155346, 113817, 1589675, -789200, -1081795, -471373, 153008, 750009, 46708, + 504122, -45634, 1026497, -745177, 720481, -632971, 118112, -559956, 232465, 173946, + 605590, 640487, 564251, 83215, 217970, 196495, -90731, 123480, -373662, 37044, + 33286, -15569, -23622, 343597, 225486, -168041, -155156, -437550, 81604, 12348, + -70867, 55298, -259846, 102542, 121870, -24696, -32212, -136902, -82678, -61203, + -68719, -90194, 86973, -37581, 53687, 25233, + }, + { + 466541, 5942088, -2984466, -2715493, 2034741, 1181116, -1702955, 472446, -368293, -956167, + 1436130, -302795, 7698192, 11712376, -4723927, -3811247, -1322313, 5040681, -4514548, -2166274, + 6638946, -6381248, 1013612, -10338523, -1970853, 3151969, -6597070, 356482, 2837363, 522375, + 826781, -2906619, -1615982, 1816234, -1686312, 869731, 1946157, 379031, 1804423, -358630, + -3098282, -217433, 1775432, -8590, 974958, 384936, -389768, 6979, -689879, -1055488, + -441845, -616865, 878321, -148176, 271120, -671089, -90731, -464930, -293132, 126165, + 806917, -562104, 482110, -806917, 48318, 219580, -185220, -150861, -688269, 435402, + 18254, -178778, -47782, 309238, 57445, -11274, 62814, -239444, -18254, -25233, + -100395, -106837, 139586, 10737, 78383, -165356, -271657, -15569, 72478, 2147, + -86973, 91268, 37044, -75699, 58519, 63351, + }, + { + -10541460, -38184408, -2838974, -6285685, -7039452, 941672, -2631741, -177167, -135291, -169651, + 1445257, -5506148, -2095944, -17714592, 1429150, 1843615, -1624571, -163746, 256624, 4597763, + -4168266, -1409823, 1076426, 1035624, -2375117, 1247151, -2690260, -483721, 86436, -2704756, + 1880122, -4312147, -998580, 782758, -358630, 1598265, -1117765, 1359894, -439160, 1139240, + 433792, -1732482, 1815161, 466541, 2016487, -612033, -1332514, -613107, 615254, -821413, + 2126009, -840203, -1872069, 983548, -55298, 2110977, -1054415, -25770, -1092532, -24696, + 391916, 218506, -289373, 731218, -986769, 436476, -121870, -846109, 276489, 130460, + -342524, 9127, -23622, 239444, -222265, 198642, -580357, 343061, -202937, 12885, + -90731, -96100, 132070, 158914, 49392, -130997, -300111, 153545, 54761, -74088, + 220654, 14496, -63351, -289373, 42950, -94489, + }, + { + -86436, -2550674, 108448, 1057099, -830539, 542240, 994822, -156229, 2262911, 143881, + 2612951, 1871532, -4215511, -2790118, -18606336, -7247221, 5350993, -1220845, 1234803, -5079336, + 1976759, -4953708, 3021510, 306016, -1509681, -1171452, -1213328, 424665, -2559264, -1906429, + 395137, 1297617, -847182, -3060701, -482110, 361314, 1037772, -302258, -846645, 1759326, + -2253784, 1715303, -965831, 1754494, -356482, 286689, -2084670, -547071, 630286, 284005, + 130997, -472446, 1115081, 31139, 341450, -437013, 83215, -511638, -376883, 663572, + -285615, -169114, 593242, -703838, -214748, 99321, -649614, 556198, -172872, -365609, + 2147, 346282, 3221, -337155, 234076, 418759, 110595, 93952, -343597, -184147, + 215822, 15032, -56371, 15032, 199716, 30065, -278636, -537, 159451, -31139, + 97174, -137439, -1611, 54761, 105227, -16106, + }, + { + -15881715, 11863237, -212601, -1611, 1475321, 2147484, -6809671, 2775086, -175557, -2477659, + 1924145, -874026, 231928, -10755135, 43772696, -2390149, 2780455, -4377109, 1458141, 283468, + 1076963, 1586454, -775242, -1167694, 1198833, 1091459, -1648194, 3775813, -1782948, 745177, + -799938, 367757, 2355790, 325344, 537945, -113280, -171262, 1254667, 1422708, 1796907, + 10201, 949725, -1057099, 853625, 1286343, -491774, -1046361, 734976, -9664, -1072131, + 359167, -1473711, 52613, -863288, 342524, 126702, -436476, 1351304, -427886, -1223529, + 308701, 391379, 314606, -184147, 85362, -448287, -12348, -260919, 209917, -17180, + -207769, 266288, 9664, 448824, -351114, 0, -176631, 479963, -306553, 67109, + 186294, 40265, -159451, 63888, 11811, 14496, 120796, -123480, -120796, -151934, + 151398, -35970, 14496, -23622, 105227, -62814, + }, + }, + { + { + -1423782, -35196184, -6299644, -353261, -3129421, -1003412, -97711, 282931, 2748779, -801548, + -2352032, -142271, -3058554, -2069637, 6065568, -47245, 4836670, -4207994, 3011309, 271657, + 10296110, -1657321, -2409477, -3462818, 933619, -3489661, -1984275, -412317, 67646, -1010928, + -1239098, -904091, 795643, 3237869, 4549981, 1709397, 1431835, -2139431, -1112397, -403190, + -181462, -891743, -506269, 548682, -532576, -1869921, -1074816, -111669, -81604, -637266, + -216896, 348429, 852014, 99858, -139050, 161598, -37044, 263604, 607201, -404264, + 37044, -564251, -3221, 49929, -133144, -37581, 139586, 595927, 88584, -223338, + -38118, -61203, 278099, -66035, -67109, -130997, -82141, 177704, 195421, -53150, + -32212, -79457, 99858, -79457, -1611, 68183, -94489, -23085, -82678, 4295, + 95563, -63888, 23085, 127238, 100932, 25233, + }, + { + 2553895, 102707160, -3702799, -2522757, 1538135, -177167, 1217623, 661962, 2081449, 541703, + 2694018, -802085, 112206, -2030446, 2471754, 468151, 336618, -1513976, -8974334, -1602560, + -1045825, -1151588, 76773, 2024540, 797790, -1357747, 218506, 1583232, -321586, -1818382, + -694174, -639950, -788127, 448287, 2348273, -2182917, -163209, 1764158, 1586454, 636192, + 403190, 1134408, -798327, -663036, -729071, -655519, -1860258, 454730, 746251, 358093, + 34897, 960999, -552977, -724239, 581968, -219043, 339302, -207232, 437013, -240518, + -486405, 80531, 191663, -48318, -465467, -523449, -279710, -314069, 5369, -191663, + 124017, -197569, 51540, 124554, -139586, -318901, 16106, -131533, 304943, 60666, + 13959, 23622, 48318, 144418, -46708, 190052, 165893, -207232, -12348, 35970, + 20938, 56371, -47782, -62814, -34897, 33286, + }, + { + 4521527, -16412144, -36881420, -22099218, -5834713, -367757, 810675, 105227, -22549, 1440962, + -1628866, -1449015, -1874753, -250182, -3127273, 1839320, 2631204, -1255204, -1545651, 1632625, + -1439351, 529892, -1323387, 1529545, -424128, -1374390, 541703, 2438468, 1859721, -1163936, + -901406, -1288490, -2654290, -2820720, -1989107, -293132, -1017907, 2261837, 407485, -632434, + 225486, 430570, -263067, -297427, -279173, 87510, -586800, 433792, 858993, 476741, + -598611, -278636, -931471, 27917, -15569, 313533, 70867, 667331, 617402, -46708, + -252329, -579821, -405874, -130997, 89121, 193274, -412854, -157840, -255014, -298500, + 453119, 31675, 124554, 6979, 148176, 126165, 108448, -177704, 85362, 136365, + -6442, -121333, 27380, 12885, -78920, -114354, -14496, -16106, -27380, -81068, + -75162, -42950, -66572, -28991, 102005, -20938, + }, + { + -355409, 4904853, 2014877, -749472, -256624, -31675, 514859, 882616, -1062468, 636729, + 1134408, -907849, -877784, -2372433, 4209068, -1563368, -1940252, 5051956, -8369281, -820339, + -652298, -237834, 4529043, -911070, 1467268, 2683818, 3913789, 2157684, 1167157, 201327, + -372588, -543850, -855235, 1059783, 559420, -547071, -772020, 446677, 175557, 537, + -421981, -1187022, 820339, 357019, 715112, 1577327, 4832, 235686, 13422, -471910, + -397821, -61203, -388158, -207232, -426276, -159451, 438087, 312996, -507880, 157303, + 332323, -286152, -155693, -135291, -257698, 17180, 203474, 151934, 31139, 199179, + 192737, 57445, 506269, -213138, -220117, 118648, 137976, -17717, -118112, -126165, + 6442, -234076, -57982, -53150, -111132, 53687, 46171, -79994, -91805, -127238, + -6442, -7516, -74625, 26844, -2147, 19327, + }, + { + -27741194, -76146016, -8017094, -7220914, -2669322, -1070521, -3047816, 717796, -1331440, 773094, + 336081, 2019172, 281857, -3283503, -6468758, 845572, -3096135, -14877767, -5519570, -120259, + -2325725, 1250372, -1316944, -588411, 737124, -1207423, -2105071, 2169495, 637266, 1081795, + 2355790, -546535, -39728, -259309, -442382, 42950, -1850594, 519691, 920734, -36507, + 259846, -360240, 56371, -1218697, -683974, 452045, 663036, -228707, -887985, -1466731, + -864899, -731755, 242666, -300648, 28991, -47782, 16643, 250182, -578747, 89121, + -15569, -16643, -95026, -286689, -234076, 43487, -107374, -258772, -113280, -216359, + -239444, -341450, 10737, 40265, -70330, -75162, -1074, -83752, 38118, 21475, + 49929, -32212, 43487, -102542, 111132, 129923, 92879, 83215, -81604, -85362, + -86973, 146029, 64961, 52613, 41876, -49392, + }, + { + 264141, 2425583, -2207076, -2277943, -279710, 420907, -88047, 183610, 226560, 146029, + -1079647, -342524, -1637456, 1282585, -260382, -226023, 420370, 2662343, -887985, -10931766, + -7609609, 2033667, 1567126, 844498, 211527, 455803, 5686537, 3453691, 1454920, 836445, + -2359548, -898185, 125628, -1786706, -1831267, -639950, -1630477, -624918, 831613, 35970, + 535797, -1220845, 1052804, -341987, -102542, 163746, -455267, -550293, 623307, 1481764, + 587337, -428960, 439160, -567473, -480499, 81604, -836982, 49929, -427886, -784368, + 237297, -65498, -221191, -275952, 478889, -135828, -157840, -71941, 377957, 91805, + -195421, 12348, -105764, 139050, 81604, -137439, -261456, -46708, -16643, -341987, + 18790, -282394, 117038, -52076, -60666, -12885, -48855, -162672, 38655, 24696, + -39728, 96637, -10737, -227633, -46708, 70330, + }, + { + -33791192, 54325968, 22983980, -6052683, 1530082, -73014, 429497, -88047, -401043, 1341104, + -1214402, 465467, -1567126, -1160715, -3731253, 3415573, 1465658, -740345, 973347, 959388, + -12885, -1010928, -2605972, 793495, -490700, -1132261, 1117765, 908386, 2476586, -244813, + 1005559, -800475, -1862405, -422517, 830539, -324807, 241055, 2093797, 757525, -908922, + -684510, -1042066, 441845, 303332, -1181653, -165893, 638876, 148176, -846109, 30065, + 336618, 295816, 266825, -367757, 350577, -1114544, -277562, 215285, -236760, -209917, + 210990, 316754, -306016, -169651, -24696, -372052, -125091, -361314, -275952, -97174, + -132607, 24696, -85899, -286689, 77846, 129923, 208306, -45634, 31675, -133144, + 27380, 311385, 143881, 15032, 66572, 133681, 28454, -137439, 37581, 56908, + 4295, 23085, 91805, 42950, 115427, 164283, + }, + { + 567473, 6530498, -1932198, -549219, 229781, 454193, 591632, -548145, -53150, -70330, + -684510, 447213, 1173063, -1353452, -5346161, -5007932, -4958003, 3483755, -4731980, 4466229, + 5770826, 4323959, 1420560, 699543, -1360968, -6903623, -5912560, 4242891, -1467805, -3062312, + -807991, 626528, 2092723, 882079, -409096, -636192, -506806, 654983, 144418, 1421097, + 99858, -188979, -1150514, 9664, -218506, -31675, -184147, -616865, 847719, 715649, + -208306, -391916, 571768, -143345, -653372, -290447, -45097, 219043, 629213, 388695, + 23622, -49392, -240518, -244813, -24159, 265751, -22012, -179852, -540092, -375273, + 146029, 140123, 11274, -221191, -24159, -94489, -56908, 172336, 71404, 17180, + -227633, 122407, 255551, 172872, 83752, -193274, 73551, -74088, -92879, 88047, + -136365, -27380, -28991, -45097, 87510, 71941, + }, + { + -9579388, -148861952, -15701327, 4033511, 1365263, 1344325, 1458141, 1392643, 447750, -1015760, + 736587, 1791538, 849330, 81068, -3383361, 114354, -59593, -2711198, -768262, 2204929, + 3221, -736587, 777389, 986232, 1931125, 1753420, 77309, 677531, -763430, -125091, + 617402, 1074279, 416075, 1019518, -427886, -750009, -651761, 866510, -1203128, -2032593, + -4559108, -937914, 1250372, 330712, -751619, -396748, 215822, 307090, -1069447, -636729, + -455267, -84826, 743029, 197569, 284005, 125628, -347892, -191126, -114354, 295816, + -531502, -341987, -86973, 215822, 210453, 110059, -232465, -204548, 193810, 33823, + 119185, -199716, -30602, -72478, 9664, 21475, 389231, 85899, 190052, -125628, + -155156, 17717, -68719, 37044, -104153, -84289, -179852, -154619, -75699, -142271, + 1611, 53150, 50466, 10737, -144418, 46708, + }, + { + -129923, 8642011, 97174, 1313186, 294205, -359167, -6190122, -1203128, 449898, 1192390, + 939524, 603980, 1265942, -165356, 663036, -638340, -1727651, -2944737, -3988951, -4014184, + 2196876, -2351495, -873489, -2643552, 1964411, 912681, 746787, -3665755, -68719, -1818919, + -421444, 2000918, 442919, 514322, 562104, 1341640, 448824, -438624, -608275, 42413, + 559420, -1017370, 417149, 365072, -40802, -428960, -611496, -55835, -998580, -3758, + -293668, 51003, 42950, -17717, 222265, 252329, -279173, -35433, -37581, 64961, + -526670, 1074, 260382, 487479, 24159, -62814, -51003, -284005, -263067, -189515, + 88047, -62814, -114354, -1074, 105764, 161061, 65498, 104690, -122407, 158377, + -3221, 67646, 95563, 56908, -74625, -15569, 186831, 161061, 84826, 24696, + -38655, 127775, 35970, 105764, -6442, -3221, + }, + { + 2201708, -60583200, 1292785, 792958, -144418, -3277597, -3197603, -2837363, 1612223, -1605244, + -576599, -1089848, 877247, -1670742, 2697240, -331786, 2865280, -503585, 479963, 290447, + 3253975, 586263, -467078, 382252, -282931, -552440, 206695, -1798518, 3146064, 137976, + -2097018, -565325, -324270, 845035, 998043, 768799, 1681480, -627065, -1123134, -363462, + 743029, 309238, 642635, 781147, 533650, -432718, -975494, 239444, -39192, 223875, + -184147, 352724, 324807, 20401, -296890, 379568, -570157, -214748, -88584, 320512, + 847182, 627065, 28454, 675921, 113817, 41876, 213138, -110059, 93416, -90731, + -6979, 117575, -27380, 124017, -37581, 23085, -334471, -192200, -11274, 49929, + -35433, -18790, -13422, 77846, -11274, -93952, -104153, -130460, -177167, 59056, + -13959, -90194, 7516, 29528, -11811, -8590, + }, + { + -710817, -950798, 2522220, -56908, 564788, 342524, 64961, 408559, -37581, 214212, + -763967, 488553, 1526324, 13764296, 3051038, -3282429, -1678795, 666257, -112206, -1591285, + -1044751, -44560, -801011, -5460514, -5293547, -832150, -3308199, -432718, 1311039, 890132, + 558883, 367220, -563714, -719944, -481036, -672162, 1370095, 208306, 211527, -838056, + -637803, 89121, 547071, 327491, 467615, 268435, -490700, 179315, -626528, -1376000, + -245350, -341987, 312996, -382252, 97174, -237297, 383326, -15569, 169651, 204011, + 39192, -225486, 165356, -12348, -63888, 62814, -236223, -186831, -504122, -51003, + -54761, 22549, 76773, 101469, 23622, -41876, -169651, -92342, -57445, -95026, + -61203, -125091, 170725, 124017, 11274, -32212, -141734, 92879, 68183, -93952, + -38118, 27917, 5906, 37044, 41339, 7516, + }, + { + 1527398, -35050692, -12741020, -11918534, -4212826, -6601902, -2848100, 1197759, 899796, -2192581, + 1728724, -2779918, -4533338, -14329622, -924492, 4356708, 1373316, -984084, 266288, -1120450, + -603443, -839666, -333397, 239444, -1918777, -996969, -1431298, 1141924, -1569274, -2699924, + -1461900, -644782, -1644436, -412854, 25770, 1651952, -248034, -455803, -316754, 705448, + 1555852, 343597, 582505, 1293322, 406948, -372052, -158914, -66035, 747324, -425739, + 888521, -1211181, -998043, 67646, 523449, 1112933, -527744, -377957, -473520, 525597, + 58519, 73551, -115427, 162672, -338766, -130997, -260382, 51540, -183610, -105764, + 41339, -11811, 85362, -186831, -31139, 125091, -38655, -153545, -123480, 141197, + -217970, 74088, 176631, 31675, -115427, -53687, 77309, 17717, 161598, -32212, + 132607, -4295, -110059, -201863, -158914, -81068, + }, + { + -209917, 925029, -1793149, -332860, -1221918, 1010391, 28991, 214212, 2060511, 523986, + 3465502, 900333, 230318, -10336376, -33093260, 4918812, -681289, 416075, 338766, -2607582, + -4486630, -1914482, 1781338, -779000, 583042, -710280, -3260954, -1618129, 318901, -1121523, + -570157, 1317481, -724239, -1459215, -677531, -130460, 1315334, -839129, 704912, 846645, + 249108, -721555, 7516, 600222, 452582, -557809, -341987, -206695, 42413, 290984, + -268435, -64961, 372052, 235686, 626528, -246961, -592169, -74625, -188442, 288837, + -365072, -46171, -9127, -280784, -140660, -52613, 117575, 30602, -94489, -389231, + -14496, 311385, 26844, -79994, 79994, 302795, 242666, 139586, -197032, -143881, + -63351, -93952, -48318, 50466, 87510, 175557, -12885, -57445, 26844, 62814, + -39728, -166967, 20401, 85899, 31139, 3758, + }, + { + 9673877, -14192719, -1967095, -5236102, -1628866, -2088965, -155693, 1684701, 461172, -2274185, + -1197759, -393526, -996432, 9296994, 10337449, 1156420, 1502702, 1868311, -577673, -926639, + 1419487, 1242856, 992674, -2221035, 782758, 1117765, 183610, 551366, 433792, 686121, + -907849, -566936, 2340757, 1145683, 729071, -71941, 1109712, 572304, 708670, 2229088, + -1430224, 148713, 67646, 437013, 636192, -52613, -41876, 15569, 111669, -1001264, + 34360, -940061, -1020592, -171799, 106300, -388695, 537, 494995, 105227, -289373, + 3758, 284542, 259309, -148176, -101469, 71941, -1074, -423591, 28991, 167504, + -251256, 454730, -23622, -24696, -86973, -253403, -50466, 376883, -87510, -29528, + 234076, 77309, -162672, 0, -68183, 37581, -23085, -170725, -191126, -13422, + 92879, 79994, 85362, -9664, -20401, 39192, + }, + }, + { + { + 2061047, -35036732, -750009, 5891622, -1733556, 271120, 608812, -681289, 1061394, -656593, + 292595, -52613, 301721, 1118839, 1894081, -3124589, 3509525, -3284039, 5734855, 1568737, + 7436736, -2964064, 373662, -258235, 1463510, -2193118, -426276, 750009, -329102, -716186, + 535260, -2232309, 1280437, 1802813, 2842732, 128312, -766652, -1256278, 307627, 30602, + 443455, -318364, 92879, 67646, 91805, -695785, 56908, 326954, -48318, -239981, + 162672, 399432, 727460, -402653, -471373, 101469, -149250, 228170, 222265, -358093, + 408559, -267362, -2147, -43487, -73014, 8053, 95563, 277025, -134755, 47782, + -27917, -171799, 134218, -163746, -16106, 64425, -26307, 148176, 39192, -82141, + 3221, -135828, -28454, 22012, 1074, 16106, -94489, -18254, -74088, 45634, + -53687, -17180, -45634, 0, 30065, 33286, + }, + { + -2238215, 78634944, -10209674, -2710124, -2490544, -715112, 1045288, -561567, 302258, -2235531, + 911070, 646929, 948114, -1000727, 683974, -1211718, 117575, 2897492, -3206193, -318364, + 970663, 7516, -9664, 1801202, 545461, -150324, -304943, 122943, -58519, -1233729, + 432718, -259309, -736587, -337692, 1254131, -2799245, -25233, 331786, 179315, 452045, + -448287, 1101122, 782758, 467078, -449898, 260382, -1091995, 699543, 40802, 19327, + -439160, -70330, -577136, -131533, 737124, -312459, 61740, -178778, 175557, -252866, + 93952, 128849, -93952, 52613, 49929, -126165, 263604, -197569, -5369, -3758, + 351114, -20401, -13959, 63888, 118112, -318901, 55835, 48855, 67109, -138513, + 45634, 103616, -90194, -96637, -80531, 268972, 46171, -103616, 51003, 70330, + 31139, 29528, -61740, -5369, -59593, 47245, + }, + { + -7345468, 26218628, 6445672, -10573673, 3423626, 352187, -352724, -468688, -501974, 1877975, + -1161789, 576063, 2498060, 799938, -2069101, 607201, 2207076, 704375, 198642, 561567, + -1639067, 1440425, -2144799, 583579, -237834, -1589138, 693100, -33286, 236760, 122407, + 1852205, 525060, 57445, 343061, 184147, 713501, 110059, 1769527, -67646, -21475, + 203474, 549219, 214748, -281320, 112206, 315143, 84826, 220654, 151398, 394063, + 83215, 133681, -316217, 332323, -12348, 134218, -564788, -98784, 162135, 54761, + -185220, -455803, -146029, 289373, 97174, 203474, -417686, 85899, 11811, -238908, + 126702, -175020, 121870, 2147, 16643, -31675, 173409, -94489, 33823, -26307, + 11811, -117038, -106837, -15032, 8053, -123480, 55835, 63888, 16643, -2147, + -103079, -23622, -38655, 24696, 53687, -64425, + }, + { + 573915, 2941516, -170188, -986232, -85362, -38655, 35970, 214212, -1032403, 445066, + 781147, 140123, 866510, -3202972, 539555, -508417, 900333, 2663954, -4980015, 2225330, + -861678, -1565516, 3893925, 190052, 1470489, 605590, 1410360, -351650, 319438, -1358820, + -751082, 570694, 137976, 346819, 501437, -516470, 467615, 337692, -435402, -348966, + -273804, -369904, 716723, -234076, -366146, 265214, -443455, -2147, 17180, -249645, + -219580, -50466, -248571, -45634, -219580, 208843, 179852, -145492, -53687, 1074, + 31139, -162135, 34360, 102542, -69256, -20401, 41339, -24696, 18254, -21475, + 123480, -61740, 374199, -164819, 12885, -18790, -55835, -34897, 14496, -148176, + 88584, -140123, 63888, -83215, -62277, 86436, 20401, -70330, -33286, 19864, + 16643, -21475, -45634, 46171, -32212, -13422, + }, + { + 20318416, -3511136, -4495220, -3419868, 453656, 889595, -89121, 1240172, -563714, 329102, + -3513820, 2049236, -261456, -2057289, -1789928, 3442416, -339839, -7762080, -3282429, 2690260, + -121333, 484794, -182536, 909459, 909996, 1265942, -110059, 1766305, -1005022, -411780, + 642635, -418222, 1283658, 1247688, -777389, -197569, 176631, -323196, 38655, -218506, + 147640, -165893, -79457, 124017, 237297, -158914, 425739, -312459, -323196, 404801, + -103079, -909996, 906238, 591095, -223875, -234613, 251792, 526670, -439160, 124017, + 101469, 90194, -168577, -156229, -19327, -61203, -129386, 123480, -30602, -59593, + 39192, 17180, 120796, -66572, 4832, 31675, 56371, 87510, 2684, -34360, + -18254, -115964, -10201, 48318, 39192, 10737, 77309, 50466, 88047, 19327, + -76773, 43487, -21475, 16643, -22549, -47245, + }, + { + 131533, 2151242, 1071058, -681826, -97174, 227633, -431644, -205622, -482110, 547608, + -285615, 32749, -484794, 2968896, -1343251, 2093797, 1418950, 2194192, -2952790, -5130876, + -161061, 649614, -1440425, 88047, 1171452, -2171106, 2448668, -2309082, -1127429, 41339, + -549756, -595390, 673773, 656056, -601295, 463320, -791348, -906238, 245887, -163209, + 246424, -850940, 822486, -399969, 404264, 425202, -415001, -472983, -176631, 498753, + 36507, -352724, 191663, -272730, -284005, 620086, -522912, 66572, -45097, -416075, + 270046, -397284, 253403, -57445, 268435, -77309, 27917, 8590, 168577, 136365, + -89121, 89121, -142271, -5369, -212601, -49392, -12348, -74625, 147640, -194347, + 23622, -60666, 132607, 537, -20401, 32212, 157303, -59593, 30602, -27380, + -44560, 28991, -6442, -48855, -5369, 35970, + }, + { + 14834817, 76194864, -3687766, -2206540, 685047, -509491, -32212, 511638, -170725, 682363, + -1032403, 318364, -1158031, 1065689, -1549410, 1243393, -569083, -267362, 734439, 271120, + -118648, -431644, -871342, 792421, -53150, -107374, -73551, -749472, 322123, -510564, + 443992, -1325534, 380105, 461172, 542777, -918049, -889058, 472446, 78920, -619012, + -568546, 583042, 895501, -476205, -229244, 28991, 6979, 271657, 133681, 242666, + 222801, -339839, 156766, 153545, -45097, -374199, 178778, -12348, -45097, -211527, + -267362, 165356, -190052, -96100, 98784, -228170, 110059, -37044, 90194, 47782, + -71404, 42950, -45634, -156229, 34360, -90194, -4832, -18790, 69256, -537, + 103616, 35970, -33823, -52076, 116501, -118112, -56371, 10201, 103616, 48855, + -77846, 13959, 19327, 26307, 30065, 55835, + }, + { + -439160, 175020, -1330366, 829466, 1611, 249645, 315680, -455803, 320512, 17180, + -531502, -701690, -250719, 275415, -1881196, -1604707, -3340411, 3758633, -854699, 1896228, + 1479616, -468151, 1825361, 1716376, 860604, 1146219, -2116345, 4907537, -767725, 708670, + 916439, -602906, 11811, 873489, -643171, 1073205, -282931, 309775, -755914, 532576, + -195958, 221191, -399432, 161598, 272730, -337692, -55298, 93952, 351114, -150324, + 57445, -329639, 282394, -377420, 188979, 162135, -272194, -23622, 186831, -65498, + -217433, -133144, 110059, 264141, 537, 64425, -282394, 127775, 44023, 155156, + 15032, -120796, -58519, -199179, 37044, 153008, -168577, 48855, -41339, 34360, + -114890, 7516, 41339, -37044, 30602, -125628, 51003, -25233, -68719, 1074, + -42950, -22549, 26844, -6442, 33823, 59056, + }, + { + 14579803, -84888416, 740882, 33823, -1949915, -215285, -711354, 445603, -818728, -1517197, + 315143, 1685238, 10201, 1605781, 564251, -89121, 2658585, 430570, -1072668, 424665, + -770947, -907849, 809064, 680215, 256087, 636729, -387621, 982474, 142271, 864362, + -790811, 454193, 525597, -257698, -965831, -545998, -1080184, 1392643, 453119, -368830, + -1197759, 1675037, 275415, -353798, 19327, 497679, 657667, 285615, -747861, 69793, + 287763, 352724, 552440, -281857, 375273, 200790, -142808, 169651, 390305, 508417, + -348429, -11274, -87510, 35970, 78920, 11274, -4832, 54224, -1611, 71941, + 339302, 84289, -126702, -173409, 27917, 145492, 70330, -122943, 39192, 56908, + -93952, 12885, -52076, 52076, -38118, 126702, -42950, -55298, -9127, -17717, + 75699, 3221, 12885, 4832, -35433, -6442, + }, + { + 547608, 1746978, -4326106, -1527935, -2303713, 277562, -1923072, -221728, -472446, 1285806, + 974958, 181462, -338229, -2557116, 1852742, -884226, -1484448, -1074279, -2532957, -2691334, + 3506304, -2386928, -734976, -2097018, 1347546, -510027, 1043140, -1880659, 1123134, -884226, + -459025, -645856, -360240, -674847, 245350, 376347, -1224066, 202937, -40802, -863288, + 291521, -55298, 443455, -111132, -440771, -526670, -257698, 371515, -1222455, -277562, + -355409, 275415, 193810, 306553, 527207, 468151, -252329, -95026, -121870, 194347, + -132070, 29528, -32212, 200790, 100932, 18254, -140660, -127238, 97174, 177167, + -2147, 58519, 99321, -81604, 25233, -15032, 3758, 62814, -27380, 172336, + -30065, 49929, -49929, 88047, -39728, -46708, 48318, -5369, -2684, -96100, + -39728, -30065, -59056, 56908, -50466, -30065, + }, + { + -1112397, -48859548, 1552631, -2484639, 1515587, -9127, 7166690, -847182, 1236414, -2699387, + 529355, -1201517, -303332, -1319092, 1836099, 235149, 30602, -3490735, 157303, -125628, + 1875827, -640487, -361851, 310848, -3221, 114890, 916439, -2068564, 1720671, -190052, + -168041, 1852205, 521302, 103616, -415538, 201327, 340913, -395137, 927176, -578210, + 148713, 115427, 483184, 862215, 879395, 528818, -394063, 331786, -125628, 153008, + -292058, 183073, 301721, 189515, -492311, 388158, -137439, -35433, -39728, 63888, + 165356, 78383, -433255, 208843, -214212, -4295, 177704, -10201, 16106, -125628, + -81068, 26307, 37044, -19864, -104153, 50466, -150861, 95563, -63888, 36507, + -17717, 21475, 78383, -19327, -19327, -109522, -9127, -50466, -57445, 110059, + 4832, -5369, 25233, 24159, -42413, 25233, + }, + { + 749472, -3396246, -244276, 1906429, 165356, 52613, 858993, 435939, 212064, -21475, + -1524713, -541703, -5189931, 3709778, 3783866, -444529, 106300, -515396, 887448, -184147, + -1184337, -544387, -358630, -423591, -1352378, 355409, 590021, 1305670, 1761474, -81604, + 1044214, 817654, 946503, -786516, -169114, -986232, 274878, -972273, 278099, -249645, + 259846, -133144, -196495, 145492, -144955, 38118, 309238, 331786, 113280, 37044, + 351650, -130460, -22549, -573915, 144955, -190052, 380641, 129386, 285078, 12885, + -209917, 192737, 91268, 18790, -167504, 75162, -23085, -20401, -38655, 84289, + 18254, 100932, 62814, -61203, 7516, 87510, -89657, 73014, -36507, -76773, + -45097, -127238, 110595, 41876, -7516, 97174, -30065, 96100, -8053, -102542, + -1074, -23622, -19864, 77309, -6442, -16106, + }, + { + 2715493, -17939542, 6050535, -1455994, -294742, -2493766, -67646, 1114544, 992674, -3321084, + 1104880, -90731, 3999152, -715112, -830539, 1248225, 1204738, -673773, 1342714, -883153, + 1275068, -33823, 392990, 1139777, -1069984, -1169305, 45097, 1626182, -1163936, -781684, + -1407676, 520765, -702227, -986232, -682900, 1177358, 101469, -617938, -705448, -350040, + 1317481, 871878, -832687, -312459, -16106, -25770, -365072, 132070, 447750, -133681, + 542777, -625455, 74088, -120259, 41876, 160524, 19864, 494995, 83215, 339302, + -30602, 71404, -319975, -160524, -10201, -71404, -233539, 310848, -198105, -57982, + 229781, -32212, -45097, -243739, -21475, 105227, 135291, -74625, -59056, 78920, + -24159, 105764, -29528, -39728, -59593, 92879, 74088, -103079, 51003, -68183, + 27917, -47245, -64961, -31139, -41876, 10201, + }, + { + 133144, 1249836, -2649458, 359704, -350040, 590021, 114890, -267899, 1273458, -69256, + 1750736, -529355, -1857037, 14420353, 4922033, 2340220, -5509906, -127775, 213138, -588947, + -3490198, -419833, 1058710, -643708, 488553, -388695, -38655, 625455, 2674154, 34360, + -778463, 601295, -586800, -586263, 421981, 132070, 1173600, -1264868, 459025, 446677, + 221728, -405874, 338766, -69256, 215285, 416075, 431644, 200790, -111132, 306016, + -236223, 59593, -28991, 172872, 779000, -228170, -399432, 204548, -278636, 316754, + -603443, -120796, -49392, 2147, 66572, 148176, 220654, -94489, -1074, -97711, + 31139, 80531, 63888, 49392, -207769, -18254, 304943, 54224, 76773, 23085, + -140123, -537, -66035, 11274, 26307, 101469, -11274, -101469, 57445, -2684, + -64961, -97711, 84289, 26307, -45634, 3758, + }, + { + -2495913, -25414396, 3752728, -2856690, -2623688, -1075889, 2497524, -1347546, -1189169, -393526, + 146029, -635655, -1072668, -1631014, -9291625, 2435783, 3083787, 115964, -1317481, -914828, + 918586, 212601, 674310, -1629403, 1411971, 430570, -571231, -1040993, -1245541, 388158, + -415538, -1042603, 181462, 300111, 228170, -892816, 312996, -265751, -227096, 745177, + -1755031, -63351, -205622, 159988, 586800, 649077, 162672, -427349, -119185, -395674, + 11811, -464930, 123480, 936840, 120796, -173409, 79994, -89121, -82678, -157303, + 30065, 61740, 86973, 63888, 13959, 46171, -23085, -312996, -64425, 141734, + -187368, 287226, -222265, -55298, -7516, -58519, 6442, 120259, 71941, 18254, + 20401, 33823, -42413, 17180, -79457, 31139, 9664, -153008, 3758, 63351, + -3221, 22549, 44560, -30065, -26844, -1611, + }, + }, + { + { + -934692, -24043764, -231391, 1711545, 957778, 547608, -347355, -342524, -88047, 1045825, + -450972, -640487, 1427003, 149250, 459025, -1371705, -1221918, 985695, 3476776, 3267933, + 2973728, 497679, 1156957, 1640141, 611496, 345745, -667867, 140660, 276489, -1182190, + -744103, 197032, 2108292, -409633, 1305670, -363998, -361314, -1974611, 375810, 79457, + 420907, 216896, -75699, -395137, 287226, -23622, -297427, -10201, 0, -447213, + 501437, 674847, 33823, -46171, -259846, -67646, -246424, 22012, 41339, 99858, + 20938, 97711, 99858, -111132, 13959, 100395, 32749, 60130, -20401, 183073, + -93952, -128849, -1074, -121333, -22012, 10737, 31139, 36507, 49392, -31139, + -77309, -44560, 24159, 145492, 63351, -73551, -83215, -84289, 15569, -40265, + -43487, 39728, -53687, -32749, -21475, -16643, + }, + { + 3854196, 50731080, 7681549, -7420630, -2059974, -631360, -60130, -985158, -1024887, -707596, + -1125818, 1152662, 392453, -327491, 288837, -2106682, -1056025, -484258, 3837017, -905164, + 543313, 102542, -573378, 528281, 1211718, 176094, -468688, -489626, -46708, -324270, + -193810, 99858, -118648, -578747, -553514, -931471, 931471, -818191, -951335, -9127, + 194347, 518080, 1472637, 180926, 52613, -140123, -63888, 51540, -377957, -12885, + -204011, -227633, -51003, 160524, 361851, -42950, -251792, 318364, -75699, -136365, + 301185, 25770, 17717, -38118, 67646, -100395, 3758, 107374, -29528, 106837, + 213138, -51003, 32749, 7516, -82678, -118648, 29528, 70330, -103079, -64961, + 81068, 51540, -76236, -93416, 77309, 85362, -27917, 65498, -3221, 88047, + 25233, -61740, 39192, -28454, -537, 24696, + }, + { + 7030862, 24692304, -6201396, 2749316, -1620813, 628676, -418222, -265751, -508417, -13422, + -741956, 540629, 2193655, -78920, 549756, -396211, 1270774, -423054, 672699, 797790, + -2404645, 22012, -918586, -661962, -171799, -288837, 770410, 77846, -121870, -195958, + 1359357, 340913, 1680406, 223338, 1322850, -546535, 1294933, 744103, -157303, -142808, + -195958, 783295, 239444, 54761, 358630, -366683, 465467, 17717, 223875, 549756, + 108985, -91805, 230854, -120796, -56371, 248034, -256087, -185757, 173409, -74625, + -49392, -19327, 35433, 155693, 56908, 104153, -66572, 20401, 22549, 30602, + 27380, -142271, -17717, 160524, 64961, -9127, 23622, -8590, -44560, -120259, + 6979, -15569, -90194, -11811, 21475, -71941, -15032, -3221, -20938, 8590, + -62814, -30602, 39728, 46171, -20938, -9127, + }, + { + -419296, 2842195, 674310, -381178, 23622, -349503, -152471, -25233, -321586, -11274, + 705448, -302258, 1082332, 1062468, -5510980, -1090385, 2418067, -215285, -2596845, 293668, + 520228, -2036888, 1780264, 2263448, 822486, -73551, -207232, -71404, 280247, -1883343, + -825707, 1080184, 525060, 222265, -431107, -262530, 1152662, 38655, -624381, -586800, + -6442, 321586, 200790, -206158, -643171, -123480, 180389, -193274, -179315, 25233, + 16106, -232465, 24159, 148713, 80531, -22012, 108448, -318901, 129386, -70867, + -217433, 33823, 174483, 25233, -23085, 46708, 24696, 51003, -21475, 64425, + -124554, -59056, 23085, 101469, 25770, -53150, 19327, 64425, 28454, -51540, + -44560, -3221, 61740, -63351, 15032, 12885, -20938, 11274, 47245, 39192, + -30065, 15569, 66035, 55298, -38655, 34360, + }, + { + -9651328, 33630668, 1758789, -3669513, 636729, 347892, 613107, 71941, 289373, -489089, + -235686, -235149, -445603, -2507724, -601295, 3220689, -748398, -6100464, -1497333, 1246077, + 406411, 284542, 97174, 111669, 745177, 659278, 1407139, 714038, -1276142, -707059, + -644782, 416612, 936840, 1502165, -568009, -337692, 95563, -1252520, 101469, 54761, + 1074, 169651, -917512, 635118, 80531, -160524, 386547, 237834, -544924, 778463, + -47245, -176094, 377957, 468151, -233539, 37581, 205622, -130997, -291521, 92342, + 1074, 143345, -132070, -176094, 24159, -46708, -86436, 170188, -82141, 22012, + 28991, -46171, -105764, 13422, 53150, 21475, 75699, 169114, -1074, -52076, + -7516, -33286, 26307, 22012, -101469, 40265, 18254, 46708, 66572, -40802, + 19864, -70867, -75162, -537, -66035, -10201, + }, + { + -392453, 1438814, 2433636, 216359, -302795, -82678, -243203, -15032, -489626, 56371, + -537, -126165, -101469, 528281, -1304060, 1399086, 886911, 1523103, 2768643, -6198712, + -1198833, -944356, -617402, -462246, 875100, -2730526, 1899986, -2814814, -686658, -222265, + 668941, -17717, 330712, 841814, 3758, 11811, -78920, -408559, 365609, -256087, + 258235, 201863, 31675, -200253, 192737, 267899, -295816, -744640, 27380, -49929, + 220117, -25233, -408559, 120259, -6979, 301185, -125628, -165893, 27380, -142271, + -109522, 10737, 49929, 14496, 135828, 31675, 3221, 54761, 8590, -11274, + 51003, 88584, 58519, 13422, -235686, -34897, 209380, 54224, 76236, -64961, + -103079, 133144, -13422, -31675, 15569, 53150, 119722, -12348, 6442, -32749, + -39728, -49929, 30602, 62277, 4295, -49929, + }, + { + 2265059, 81658600, 2830920, -273804, 559956, -89657, -150324, 635118, 118648, -1270237, + -270583, 340376, 711891, -180389, 183073, -733366, -474594, 489089, 100932, -567473, + -690953, -346819, 519154, -141197, 142808, -75162, 80531, -1006633, -645319, -551366, + 154619, -83752, 98247, 625992, -371515, -941672, 317828, -223875, -837519, 144955, + -302795, 1066226, -238908, -338766, 307627, -261456, 124017, -110059, 109522, 192200, + 102542, -491774, -315680, 354335, 114890, 97174, -69793, -61203, 292595, 23622, + -394600, 52076, 44023, -179315, -37044, -48318, 150861, 104153, 25233, 50466, + -48318, -183073, 136902, -6442, -2147, -88584, -2684, 100395, -61203, 117575, + 93952, -78383, 48318, 8590, -65498, -109522, -38655, 105227, 59593, 537, + -19327, 55835, -15032, -12885, 16106, 19327, + }, + { + -375810, -2487860, 2430415, -339302, 450972, 1074, -40265, 166967, -103616, 190052, + -630286, -783295, -331249, -425739, -901943, -2212445, 346819, -899259, 2117956, 316217, + -216359, -1581622, 1208496, 821413, -612570, 2367601, 652298, 2363306, -130997, 1106491, + -259846, -143345, -232465, -42413, -564788, 1173600, -89657, -111669, 141734, 343597, + -34897, -248034, -3758, 10737, 119722, -192200, 250182, 224412, -341987, 30602, + 424128, -319975, -125091, 131533, 612033, 132070, -243203, -78920, -194884, 89657, + -27917, 2147, 339839, 324807, -40802, -63888, -229781, 113280, 206695, 195421, + -20401, -95026, -245887, -30602, 166430, 65498, -49929, 86436, 15032, 17180, + 11274, -142808, -1074, -90731, 11811, -44560, 25233, 12348, -10737, -23622, + 41339, -27917, -9127, 8590, -15032, 39192, + }, + { + -14398341, -38281044, -4439923, -2147484, -367220, 3758, -755914, -658741, -1401233, 458488, + 34897, -766115, 785979, 484794, 867047, 426276, 2279017, 1165010, -369367, -1036161, + -789200, -337692, 292058, 338229, 452045, 293132, -403190, 1045288, 1369021, 605590, + -788127, 362925, 288837, -539555, -1216013, 64425, -1083942, 1206886, 287226, 615791, + -81604, 1428077, 88047, 35970, 234613, 816044, 185220, -404264, 117038, -17717, + 645856, 178241, -99321, 401579, -53150, 186294, 10737, 175020, 587337, 162135, + -22012, 127238, -155693, 59056, -210990, -153545, 64961, 276489, -151398, 170725, + 136902, 103616, -44560, -104153, 68183, 133144, -201327, 110059, -101469, 76236, + 34897, -102005, -86973, -62277, 4832, 39192, -24159, 35433, 59593, 60130, + 20938, -25770, -34360, 2684, 15032, -16643, + }, + { + -621697, -70867, 2097018, -7533910, -472446, -219043, 1979443, -509491, -309238, 696858, + 1666984, -749472, -932545, -51540, 2145336, -2594697, -1689533, -1111323, -1814087, -577673, + 462246, -268435, -350577, -248034, 704912, -222801, -475131, 575526, 372052, -213675, + -659278, -998580, -496606, -210453, -68719, 386010, -607738, 555661, 259309, -378494, + -100932, 858457, -4832, -370441, -63351, -426812, 115964, -200253, -644245, -394600, + 157840, 120259, 518617, 270046, 142808, -22012, 71941, 21475, -70330, 198642, + 156766, 5906, -186294, -124554, -18254, -136365, -32212, 125091, 277562, 188979, + 11811, 123480, -55298, 63351, -76236, -79457, -53687, -1611, 14496, 33286, + -77309, 38655, 30065, 39192, 52076, 12885, -48318, -23085, -44023, -31139, + 31675, -62814, -19327, 20401, 3221, 44560, + }, + { + -944893, -41736880, -8497593, 775778, 1633161, 1294933, 6903623, -2070711, -183073, -1315334, + 275415, -319975, -970663, 738734, -1189706, -201863, -381715, -1611150, 1097364, 666794, + 139050, -562641, 361851, 293668, -124017, -3221, 523449, -638876, 341450, 147103, + 296353, 2101850, 737124, -756988, -650151, 856846, -861678, 13422, 1221381, 201327, + 440234, 163209, 321586, 689342, 661425, 463320, -44560, 274341, 485331, -183073, + 59593, 105764, 545998, -165893, -192200, -220117, -83215, 70867, 241592, 89657, + -241592, 10201, -183073, -285078, 0, 13959, 19864, 29528, -103079, -70867, + -76236, 6442, 32212, 72478, 9127, 61203, 36507, -95563, -46708, -3221, + -53687, 122407, 16643, -38655, -8053, -1611, 28991, 0, 32212, -7516, + 26307, 42950, -31139, -18254, 537, 45097, + }, + { + -575526, -3608310, 1736777, 1779190, -994285, 483184, 688269, -205622, 470299, -373125, + -1245004, -1477469, -479963, -3882651, 2180770, 2276333, 657667, 155693, 411780, 1470489, + -1560147, -3040837, -572304, 1369558, 1338956, -883153, 1105417, 597537, 1637456, 544387, + 1822677, -380641, 95026, 238371, -310848, -328028, -655519, -161598, 391916, -8053, + 302795, -433792, -400506, 522375, -148176, 195421, 310848, 191126, 281857, 574452, + 121870, -176631, -63888, -142808, 150324, -185220, -106837, 31139, 134755, -207232, + -2684, 155693, -31139, -66572, -236760, 136365, 42950, 13959, 135291, 17180, + 172872, 92342, -52076, -22012, 48855, 104153, 132607, 44023, -78920, -71941, + -52076, -35433, -55298, -52613, 12885, 14496, -40802, -16643, -5369, -40265, + -16643, 6442, 11811, 17180, -30065, 26844, + }, + { + -3145527, -11296838, 5266704, 5399848, -2041720, 522912, 1471563, 1081795, -819265, -1252520, + -199179, 1306207, -1961190, 5887864, 1920924, -1240172, 210990, 411243, 461709, 650151, + 1214402, 348966, 619549, 1049046, -404264, -370441, 248034, 552977, -637803, -321049, + -363998, 133144, -206695, -967978, -283468, 587874, 496069, -727460, -505196, 472983, + 238908, 44560, -236223, -775778, -437550, -373662, -40802, -351114, -215822, 45097, + 256087, 112743, 133144, 90731, 142271, 126165, 335007, 292595, 94489, 15032, + 279710, -256087, -198642, -159451, 18790, 32749, -216359, -16643, -12348, 154082, + 33286, -161061, 53150, -129923, -1611, 45097, 93952, 32212, -60130, 20938, + 28991, 23085, -23085, -20401, 9664, 87510, -162672, -65498, -80531, -59593, + -63888, -32212, 31139, 13959, 56908, 44560, + }, + { + -57445, -1005559, -311385, 9664, 172336, 359167, 833224, -13422, 709743, -230318, + 761820, -130460, -2713883, 2672544, 29016262, -73551, -4534949, -1241782, 365609, 2869038, + -2988760, -1271310, -1518271, 1864553, 740345, -974958, 1028645, 1398549, 1711008, 635118, + -1427540, -159451, -414464, -427886, 207232, -275952, 660351, -762357, 253940, -106837, + 227633, 307627, 343061, -158914, -120259, 328028, 246961, 446140, 266288, 30602, + -86973, 420907, -115427, -40265, 352187, -186294, -206158, 163746, 27380, -235149, + 26307, 45097, -181999, -24696, 115427, 151398, 10737, -38118, 27917, 161598, + -127775, -79457, 26844, 103616, -127775, 537, 163209, -42950, 111132, 40802, + 14496, 90731, -64961, -63351, -3221, -22012, -69793, -61203, 78920, -67109, + 28991, 15032, 35970, -18254, 20938, 2684, + }, + { + -2558190, -20994874, -4712116, 2462090, -1457068, 1780264, 838592, -1673964, -920197, 383863, + 627065, -285078, 602369, -3765076, -6291590, 3503620, 2058363, -1183800, -1022202, 425739, + -487479, 343061, -478889, 587874, 551366, -549219, -117575, -518080, -578210, -598611, + -760209, 290447, -772557, 362925, -874026, -631360, -405874, -92342, 482110, -488016, + -82678, -164819, -297963, 4295, 268972, 524523, 10201, -468688, -194884, 202400, + -396748, 45097, 519154, 952946, -22012, 285078, -248034, -262530, -130460, -51540, + -22549, -103616, -41876, 5369, 175020, -227096, -122407, 1611, -109522, -32212, + 47782, -134755, -235149, 168041, 33823, 25233, 0, -57982, 204548, -23085, + -135828, 90731, 85362, -52613, 9127, 28991, 17717, -61740, 64961, 15569, + -44560, 6442, 16106, -57982, -4295, 10737, + }, + }, + { + { + -420907, -13728863, 4188130, -1656247, 260919, -64425, -547608, 235149, -324270, 432181, + -1810329, -841814, -1306744, -2453500, 2128693, -2066416, -2739652, 959925, 251792, 1389959, + 1435056, -152471, 180926, 117038, -542240, 855235, 120259, -352724, -373125, -1207423, + -825707, -292058, 17717, -1010928, 286152, -452045, 161598, -1850057, 595390, -125628, + 133681, -100932, -257698, -148713, 600759, 198105, -307090, -69793, 104690, -370441, + 40265, 115964, -221728, 265214, -19864, -53150, -222265, -107911, 249108, 178241, + 23622, 239444, 83752, -118112, 38118, -9127, -220117, -39728, -55298, 7516, + -125628, -39728, 37581, -62277, 62814, -28991, -26844, -23085, 17180, -47245, + -39728, 54224, 81604, 115964, 27917, -104690, -44023, -42413, 63888, -41876, + 50466, 29528, 26844, -12885, -43487, 6442, + }, + { + -3755949, 30678414, 3688840, -3474629, 730144, 422517, 31139, -164819, 444529, 765041, + -100395, 1169305, -296890, -545461, 473520, -1321776, 1197222, -462783, 3106335, -1211718, + -258235, -39192, -638340, 127238, 758062, -40802, -88047, -169651, 598074, 807991, + -229244, -258772, 509491, 267362, -247497, -622233, 462783, -367757, -492311, -122943, + 750009, 379568, 408559, -69793, 179852, -260919, 266288, -398895, -482110, 74088, + -39728, -13422, 178241, 150324, 137439, -194884, -52613, 272730, -55835, 78383, + 212601, -56371, 190589, 19327, 28454, -33286, -86973, 245887, -4295, -98784, + 92879, -134218, -9664, 0, -116501, 52613, 40802, 16106, -53687, 19327, + 24159, -51540, 25233, 18790, 29528, -60130, 45634, 34360, -19327, 45634, + -17180, -63888, 62814, -42413, 47245, -15032, + }, + { + -4315369, 28423556, 10511932, 7090991, -328565, -93416, -161598, -115427, -209380, -408022, + 32212, 54224, 867047, 359704, -491237, -2458869, -181462, -423054, -202937, 392453, + -2805688, -658741, -461709, 375810, 509491, -313533, 502511, -48318, -639950, -244276, + 710817, 132070, 836445, -767189, 1157494, -295279, 396748, -386010, -91268, -60130, + -489626, 245887, 442382, 203474, 556198, 59593, 625992, -73014, 150324, 75699, + -435939, -22012, 468151, -104690, -264141, 91268, 92342, -1611, 145492, -273804, + 204011, 372588, -25770, -177167, -1074, 39728, -11274, -83752, -33286, 29528, + -53687, -101469, 8053, 125628, 3758, -42950, -26307, 45097, -26844, -112743, + -2147, 48855, -10737, -36507, 42950, 27380, -40265, -4295, -11811, -10737, + 21475, -17717, 44560, 5369, -14496, 33286, + }, + { + 391379, 2714956, -2147, 35433, -2684, -246424, 59056, 365072, -30602, -314606, + 75162, -724239, 521839, -126702, -4798552, -111669, 802085, 1584306, -1680406, -1547799, + 819802, -948651, -111132, 381715, 11811, 183073, 930397, -392990, -183610, -777389, + -125628, 994285, -4832, 428960, -736587, -390305, -161061, 74625, 273267, -320512, + 307627, 210990, 137976, 22549, -319438, 168577, -64425, -333934, 83215, 85899, + -62277, 48318, 80531, 82678, 179315, -321586, 55298, -77309, 163746, 60666, + -122943, 137439, -34360, -93416, 1611, 19864, -20938, 119185, -61740, 65498, + -184684, -53687, -68719, 72478, -88047, -31139, 110595, 50466, -60666, -20401, + -46708, 38118, 46708, 17180, 1611, -27380, -35433, 41876, 61203, -5369, + -12885, 32749, 32212, 6442, -11811, 42413, + }, + { + 590021, 42856796, -205622, -3670587, 912144, -253940, -269509, -313533, -97174, -159988, + 1919314, -656593, 750009, -178778, -242129, 1691143, 579821, -4343286, -852014, 981400, + 616865, -178241, -1366337, -1117228, 366146, -314606, 821949, 237297, -731218, -6979, + -332860, -436476, -268972, 690416, -60666, 694711, -22549, -466541, 411780, -81604, + 109522, 235686, -370441, 406411, -253940, -116501, 60130, 248034, -248034, 581968, + 129923, 116501, 18254, -130997, -401043, 281857, 81068, -413927, -250182, 138513, + -42950, 106300, 62277, -150324, -71941, -3758, -183610, -15569, -150324, -23085, + 15569, -107911, -118648, 145492, 60666, -56371, 31675, 5906, -24696, -53150, + -13959, -28454, 31675, -46171, -102542, 47245, 537, -2684, -39192, -34897, + 67109, -31675, -51540, 15569, 12348, 38655, + }, + { + -11274, -753230, -2086280, -590021, -104153, -12348, 75162, 222801, -253403, -234076, + -102005, 118112, -239444, 1885491, 2019172, -1341104, -2610803, 202400, -1705639, -7166153, + 2646237, -160524, 1494649, -1082332, 77846, -1749125, 1335735, -1105417, 718333, 609885, + 1204202, -2684, -222801, 709743, 68183, -322123, 171262, 12885, 499827, -345208, + 708133, 183610, 194884, 193810, 28991, 230318, 48318, -268972, 244813, 51003, + 173409, -212601, -216359, 369904, 150324, -5369, -120259, -88047, 112206, 60130, + -137439, 286689, -33286, -292595, -40802, 17717, 54224, 23622, -53150, -44023, + 164819, 79994, 99321, 116501, 4295, -28991, 137439, 65498, -2147, -45634, + -25770, 57445, -81068, -25233, 56371, -4295, 3221, -31139, 4832, -9127, + -17180, -27917, 44023, 22549, -19327, -66035, + }, + { + -12330314, 62147104, 1928977, -1112397, -108985, -35970, -20938, -329102, -637266, -935229, + -231391, 218506, 1196685, -1054951, -430570, -1235877, -89657, 434865, -391379, -248571, + -204011, 150324, 298500, -337692, 30065, -176631, 387621, -1035624, -726923, -628139, + 544924, 893890, 135291, 145492, -705448, -501437, 205085, 32749, -247497, 543850, + -83752, 524523, -283468, 120259, 348966, -2147, -77309, 215285, 115964, -195958, + -10201, -346819, -58519, 280784, 330176, 156766, -118112, 20938, 356482, 38655, + -361851, 71404, 188979, -86973, -117575, -13422, 154619, 74088, 1074, -7516, + -40265, -144955, 110595, 32212, 83752, -17717, -7516, 78383, -13959, 58519, + -55835, -62814, 115427, -3758, -143345, 34360, 12885, 53687, -19327, -30065, + 9664, 23085, 41339, -15032, 7516, 26844, + }, + { + 233539, -185757, 549219, -835371, 431644, -58519, 119185, 77309, -433255, 93416, + -474057, -381178, -55835, -1516124, -1246077, -1114544, 1891933, -503585, 870268, -600222, + 192200, 929324, 450972, -310848, -1098975, 1309965, -120259, -433255, -343061, 1014686, + -360777, 667867, 287226, -382789, -551903, 460635, 207232, -61203, 105764, 238908, + 67109, -179315, 149250, 115427, 54761, -157303, 307627, 81068, -527207, -154082, + 177704, -103616, -325344, 118112, 309238, -142271, -179315, -82678, -222265, 470836, + 213675, 210990, 301185, 168041, 12348, 96100, 8590, 30065, -1074, -16106, + 86436, 66035, -72478, 38118, 41339, 2684, 78920, 42950, -20938, 20938, + -35970, -118648, 38118, -22012, 64425, -32749, 67109, -17717, 12348, 37581, + 30602, 41339, -8053, 1611, -12885, 12885, + }, + { + 11541114, -9109626, -4517769, 555661, -724239, -137976, -220117, -562104, -154619, 1038308, + -415538, -1229971, 269509, 228707, 339839, 220654, 116501, -705448, -380641, -242129, + -274341, -578210, 301721, 217433, 97711, 96100, 186831, 670015, 1103270, 427349, + -667867, -418222, -210453, -11811, -440234, 856309, -28454, 530428, -1504849, -107374, + 302258, 716723, -314606, 454193, -285615, 221728, -151934, -774168, 171262, -127238, + 200790, -161598, -205085, 265751, -180926, 28991, -135828, -141734, 149787, -52076, + 243203, 317291, -167504, 121333, -85899, 115427, 186294, 229244, -84826, -10737, + -128849, 47782, 16643, -89657, 95563, -11274, -127238, 234613, 9127, -2684, + 42413, -108985, -57982, -106300, -2684, -15569, -3221, 47782, 60666, 22549, + -68183, -31139, -40802, 45097, -5369, 4832, + }, + { + 556735, 1262184, 4275640, -3441343, 1693291, 1751810, 2669859, -651224, -173409, -189515, + 144418, -1204738, 1104344, 266288, 2174327, -1545115, -1376537, -286152, -1573032, -1038845, + -266288, 939524, -194347, 159988, 647466, 121870, -125628, 513249, -476741, 501437, + 57982, -281857, -361314, 275415, 554051, 809601, -164283, 629213, 183610, 34360, + -229781, 272730, -154619, -136902, 395674, -499290, 241055, -168577, -237834, -137439, + 376883, -7516, 161598, -226560, -269509, -302258, -83752, -9664, -37044, 67109, + -5369, 151398, -16106, -35433, -33823, -134755, 64961, 205622, 144418, -36507, + 26307, -22012, -159451, 92879, -89657, -6442, -97174, -24696, -23622, -28454, + -70330, 18254, 47245, -14496, 52613, -15569, -30065, 39192, -21475, 46708, + 11274, -537, 13959, 31675, 22012, 26307, + }, + { + 3155190, -30333206, 1511829, 3597035, 1007170, -2369211, -1609002, -2608119, 329102, 157303, + 90731, 60666, -523986, 818191, -639950, -1076963, -1540820, -1394791, 772020, 179852, + -230854, -11274, -244276, 168041, 162672, 130460, 590558, -329102, 433255, 266825, + -309238, 666257, -266825, -512175, -206158, 234076, -699006, -412317, 108448, 352187, + 307627, -382789, 118648, 76773, 135291, 14496, -424665, 155156, 488016, -224412, + 141197, -5369, 274341, -246424, -53687, -402653, -25770, 284542, 179852, -76773, + -328565, 55835, -6442, -104153, 218506, 37581, -3758, -73551, -103079, -11811, + -18790, 24159, 84289, 102542, -56371, 22012, 57445, -134218, -28454, -15032, + 49929, 92342, -53687, 75699, -16106, 54761, -2147, 30602, 25770, -34897, + 39192, 16643, -67646, 5906, 39192, 17717, + }, + { + 370978, -4898410, -1399086, 818191, -22012, -99858, -89121, -375273, 302258, -213675, + -581968, -801548, 1472100, -2479270, -1732482, 1553168, 580894, 159451, -569620, 476205, + -142271, -1574642, -281857, 439160, 1147830, 281320, 107911, -1028645, -6979, 89121, + 198642, -809064, -520228, 1060320, -312996, -17180, -228707, 461709, 208843, -20938, + 125628, -203474, 63888, 306553, -252866, 266825, 107374, 105227, -48855, 286689, + -27380, -95563, 221191, -537, 92879, -116501, -142808, 7516, 272730, -187368, + 250719, 57982, -72478, -100932, -119185, 281320, 57445, 96637, 17180, -53150, + 161598, 51003, -66572, -25770, -34897, 15032, 51540, -79994, -54224, -57982, + -28991, 13422, -69256, -83215, 13422, -42950, -47782, -5906, 32212, -7516, + -11811, 39192, 15032, -40802, -25770, 39192, + }, + { + 2363843, -8316131, -1479616, 721555, -1406065, 1833951, -466004, 232465, -580894, 260919, + -480499, 587337, -746251, 4898947, 1037235, -1003412, 905164, -230854, -1263257, 1028108, + 295279, -311385, -112743, 607201, -209380, 1194001, -171799, 38118, 406948, -13422, + -301185, 115964, 814433, -73551, 158377, 570157, 557272, -352187, 83752, 305480, + -501974, -282394, 380105, -142808, -82678, -283468, 200253, -515396, 30065, -221191, + -66572, 70867, 117038, 351650, -44560, -35433, -104690, -40265, -20938, 63351, + 170725, -212064, -17717, -42413, -63351, 39728, -97711, -57445, 151934, 144955, + -124017, -70330, 151934, -82678, 12348, 49392, 56371, 91268, -6442, 29528, + -89657, 24696, 82678, 5906, -53150, -46171, -179315, 20401, -40802, 6442, + -9664, 1611, 70330, -28454, 42413, -4832, + }, + { + 283468, -759672, 609349, -257698, -221191, -273267, -46708, -402653, 231928, -1142461, + 267362, -310848, -1400696, -6399502, 9696426, -2450279, -1628330, 4832, 1355062, 2818572, + -1075352, 660351, -878321, 1395328, 220117, 312459, 1387274, 400506, -1388348, 502511, + -297427, 230854, 322123, -162135, -397821, -549219, 52076, -548682, 401043, -355945, + 594853, 144418, -250719, -258772, -215285, -194347, -45634, -70867, 43487, -244813, + -37581, 277025, -184147, -83752, 156766, -216359, -12885, 267362, 246424, -132070, + 266288, 22012, -88584, -57445, 64425, -105227, -92342, 51003, 47782, 115964, + -96100, 50466, 42413, 77309, -35970, 74088, 1074, 40265, -29528, 1611, + 74088, 5906, 24159, -32212, -57445, -24159, -18254, 45097, 27917, -53150, + 59056, -23622, -40802, 5906, 27917, -33286, + }, + { + 4153770, -7581154, 144955, 4913443, -285615, 1046361, -1117765, -593242, 427349, 351114, + 1406065, 205085, -202400, 1501091, 3253975, 2126546, -458488, -263067, -414464, -89121, + -1355599, 908386, -248571, 685047, 382252, -741419, 849867, 1270237, 152471, -599148, + -352724, 476205, -753230, 216896, -688269, 376883, 310848, 239981, 658204, 148713, + 1169305, 192200, -332860, 208843, 256624, -16643, 208843, 185220, 173409, 336618, + -319438, -46171, 139586, 245887, -238908, 113817, -170188, -127775, -329102, -51003, + -2684, -215822, -104690, -16643, 179852, -216896, -16643, 60130, -39192, -4295, + 45097, -42950, -42950, 86973, -30602, 15032, -25233, -31675, 97174, -93416, + -51003, 93416, 30602, -12348, 48318, 49929, 15569, 21475, -4832, -15569, + -6442, -1611, 18790, -8590, 8590, 4295, + }, + }, + { + { + 716186, -4162360, -6356552, -1214939, 137439, -404801, -47245, 169651, -142808, -930397, + -1529008, -766115, -1911261, -1285269, 1402844, -1446330, 170188, -1262184, -711891, 1624035, + 984084, -709207, -1330903, -1134408, -696858, 688269, 1264868, -330712, -406948, -906238, + -874563, -243203, -2035278, 488553, -142271, 248034, 56371, -950798, 876710, -609349, + 234613, -620623, 207769, -311922, 521302, 255014, 83752, 319438, 123480, -279173, + -357019, 106837, -149250, 63888, -59593, -77846, 16106, -71404, 490700, -68183, + 27380, 11811, 17180, 11274, -15032, -158914, -151934, 5369, -115964, -99321, + -136902, -10201, 42413, 18254, 13422, 41876, 3758, 13959, -58519, -34360, + -26307, 63888, -10201, -14496, -38655, -34897, 45634, -24696, -1611, 23622, + 69256, -11811, 19864, 24159, 4832, 40802, + }, + { + 2847563, 40094592, -9911174, -312459, 676457, 48855, 484794, 1220308, 879395, 707596, + 677531, 202937, 151398, -381715, 249108, 765041, 1608465, 724239, -291521, -13422, + -546535, 359704, -197569, -385473, 379031, 132607, 308164, 198105, 434865, 289910, + 151398, -15032, 601832, 579284, -262530, -930934, 241055, 194884, 219043, 354872, + 721555, 236760, -438087, -106300, 126702, -108985, 262530, -150861, -106837, -180389, + 18254, 79457, -76236, -46708, 82678, -71941, 13422, -223338, 85362, 81068, + -8590, -56908, 150324, -4832, 131533, 41339, 78383, 61740, -128849, -21475, + 2147, -31139, 76773, -46708, -41876, 111132, -77846, 34360, 107374, -23622, + -13422, -31139, 31675, 5906, -55298, 5369, 67646, -46171, 15032, -2684, + 12348, -8590, -3758, -16643, 22012, -21475, + }, + { + 2377801, 41044320, -3331284, 3745212, -2715493, -81068, 159451, -121333, 155693, 14496, + 421981, 366146, -488016, 974421, -545998, -1364189, -1617055, 342524, -185757, -784905, + -335007, -642635, -214212, 278099, -41339, -625455, 354872, 528818, 110595, -355945, + -833761, 874026, -285078, -72478, 867047, -44023, -136365, 214748, -418759, 85899, + -399969, -55835, 765578, -179852, 161061, 655519, 621697, -122943, -39728, -265214, + -197032, 224412, 290447, -264677, 248571, -297963, 26307, -104690, 23085, 2147, + 100932, 100932, -28454, -178241, -129923, -6979, -122943, -95026, 2684, -74625, + -130460, -33823, -8590, -35433, 60130, -52613, -24159, -1074, 80531, -26844, + -17717, -21475, -1074, -45634, -537, 89121, -20938, 39192, 12348, 32749, + 5906, -35970, -4832, -18790, -4832, 14496, + }, + { + -475131, 3075197, 625455, -15569, -265751, 114354, 41876, 240518, 153008, -180389, + -51540, -224412, 289373, -1302449, 114354, -1439351, -500364, 1522566, -270583, -1465121, + 914291, 523986, -478889, 306016, -503048, 64961, 2287070, -812286, -732829, 1190243, + -435402, -62814, -17717, 490163, -469225, -61203, -673773, 257161, 166967, -158377, + 297427, -103616, 299037, 199179, 48318, 113817, -510564, -126165, 4295, -172872, + 71404, 144418, -180926, 0, 31139, -331786, 105227, 96637, -42413, 252866, + 61203, -112206, -57982, -16106, -71941, -69256, 0, 81068, -108985, -30065, + 8590, 59056, 39192, -135828, -537, -41876, 5369, -13422, -129923, 11811, + 10201, -11811, -13959, 8590, -27380, 31139, -1611, -9127, -22549, -11811, + 28991, -2684, -51003, -38118, 11811, -26844, + }, + { + 4916664, 33770256, 1356673, -2546379, 115964, -88047, -632434, -580894, 387084, 234613, + 450972, -545461, 1287417, 313533, -63888, 803696, -1522566, -2695629, 483184, 439697, + 812823, -88047, -858457, -577673, 378494, -263604, -61740, 419296, 235149, 11274, + -56908, -486405, -307090, -106300, 360777, 1171989, -339839, 623844, 87510, -97711, + 542240, -49392, 354872, -380641, 98247, -219580, -130460, -27917, 32749, 178241, + 116501, 159988, -98784, -205085, 62814, 35433, -69793, -288300, 158914, -59056, + -10201, 213138, 60666, -122943, -71941, -135828, -49392, -71404, -105764, -105764, + 5906, -2147, 67109, 155156, -27380, -27917, -67646, -137976, 32212, -59056, + -11811, -40265, -6442, -83215, 47782, 32749, -48318, 38655, -2684, -1611, + 34897, 17717, 24696, 35433, 41876, 10201, + }, + { + 268435, -4611721, -535260, -356482, 44023, 105227, 71941, -20401, -237297, -275952, + 190589, 95563, 62277, 1948305, 5995238, -3065533, -2234994, -695248, -447750, -4773856, + -1451699, 757525, 747324, -1860795, 691490, 768799, -785979, 1314797, -620623, 440771, + 631897, 559956, -278636, -227633, 183073, -135291, -304406, -79457, 277562, 76773, + 64425, 193274, 392990, 352724, -232465, 96100, 178778, 193810, 281857, 144955, + -169114, -209917, -61203, 375810, 93416, -155693, -62814, -28454, 89121, 67646, + -111132, 224949, -82141, -207769, -91805, -83752, 92879, 59593, -20401, 54224, + 140123, -22549, 94489, 68719, 35433, -89121, -40802, -51540, -16643, 35970, + -8590, -46708, 12348, -37581, 52613, -1611, -20401, 3758, -42413, -18790, + 50466, 23085, -10201, -40265, -41339, -12885, + }, + { + 13826037, 34382824, -5223217, -555125, 81068, -158377, 125091, -600222, -644782, 121333, + -526670, 106837, 294205, -615791, -797253, -1037235, 502511, -524523, 76236, 283468, + 604517, 208306, -389768, 274341, -234613, 117575, -145492, -793495, -145492, -183073, + 570694, 358093, 156229, -211527, -557272, 88047, -272730, 255014, -194884, 400506, + 297963, -80531, 173946, 287763, 26844, 96100, 206695, 541166, -176631, 19864, + 74088, -103079, 301185, -37044, 247497, -10201, -210453, 142808, -39192, -99321, + -100395, 24696, 49392, -13959, -25233, -22549, -127775, 121870, 62814, -129923, + 41339, 88584, -67646, -37581, 22549, 37581, -10737, -6442, 49929, -39728, + -37581, 5369, 16106, -63351, 13959, 26844, -9664, -6979, 12885, 16643, + -38118, -1611, 18790, 27380, 47245, 44560, + }, + { + 332323, 739271, -2580739, 249108, 19864, 163746, 156229, 7516, -135291, -293668, + 153008, -171262, 596464, 303869, 89657, -1800128, -526134, 930934, 164283, -435939, + 2010045, 1086090, 488016, 832687, -81068, 584652, -1021129, -16643, -608812, 424128, + 190052, 817654, 812286, -758599, 204011, -47782, 129386, -51003, -161598, 108985, + 153008, 99321, -221728, 306016, 97174, -110595, -83752, -99321, 83752, -338766, + -165893, -78383, -109522, -120259, -42413, -235149, -354335, -44560, 164819, 210453, + 212601, 115964, 110595, 98247, 73014, 242666, 52076, -75699, -44560, -82678, + 82141, 81604, 56908, -18790, -80531, -2684, 38118, -35433, -46708, -47245, + -13959, 2684, 18790, 70330, 27917, -35970, 25233, -10737, 3221, 6979, + -11811, 66035, -4295, 19327, 12348, 537, + }, + { + -7164543, 6222871, 5189394, 1023276, -1024350, -484258, 91805, 81068, 332323, -286689, + 230854, 631360, 660351, -986769, 165356, 573915, -1457605, -152471, -112743, 49392, + -367220, -259846, 243203, 154082, 423591, -313533, 245350, 532576, 914291, -428960, + -191126, -450972, -102542, -185220, 411780, -316217, 916976, 484794, -1488743, -607738, + 698469, -582505, -352187, 34897, -37581, -177167, -380641, -589484, 215822, 206158, + -211527, -210453, 157303, -71941, -64961, -95026, -72478, -184147, -168041, 122943, + 386010, 121333, -3758, 83752, 173946, 276489, 135291, 35433, -28991, -120796, + -17717, 83752, -51003, -157840, -34897, 52613, 107911, 50466, 88047, -40802, + 16643, -20938, -11811, -11274, 54761, 1611, -40802, 8590, 16106, -22549, + -49929, -14496, 12885, 20401, -33823, 22549, + }, + { + -433792, 4466766, -1309965, 3266860, 507880, 140123, 891206, 573915, 202400, -284542, + -1180042, 171799, 892816, 601832, 565862, -611496, -687732, -998580, -2317672, -1201517, + 1031329, 470299, -563178, -215822, -42950, 336618, 353261, -430570, -596464, 641561, + 117575, -150324, 220117, -435402, 468151, 1017370, -42950, -379568, 53687, -245887, + -56371, -370441, -69256, 40265, 183610, -303869, -49929, -172872, 124017, -157303, + 94489, -331786, 17180, -214748, -51540, -56371, -198105, 35433, -117038, -154082, + -53150, 47782, 226560, 146029, 33823, 84289, -43487, 58519, -106300, -137976, + 101469, -56908, -49392, -26307, -26844, 31139, -13959, 17717, -13422, 9127, + 20938, 29528, -13959, -44560, 3221, -30602, 8590, 49929, 3758, 5906, + -42413, 36507, -5369, -6442, -9127, -33286, + }, + { + -4305705, -21407190, 7158100, 1763621, 155156, 1628330, -8766565, 292058, -753230, 727460, + 21475, -150861, -15569, -1216013, 1373316, -1360431, -1694902, -1450088, -558346, 636192, + 338229, -69256, 3221, -248034, 205085, 205085, 71941, 141197, 227633, 61740, + -634581, 38655, 78383, -273804, 41339, -379031, -97174, -532576, -537, -59593, + -554588, -310311, 368830, -78920, 85362, -156229, -22012, -230854, 95563, 13422, + 33286, 186831, -231928, -54224, 195958, -248571, 194347, 11811, -92879, -39728, + -57445, 5369, 7516, 86436, 159988, 2684, 44560, -33286, -10201, -28454, + -1611, 61740, 107911, -85362, -75699, -68719, -8590, -55298, 31139, -25770, + 103616, -14496, 23085, 60130, -32212, -18254, -63351, 16643, -13422, 47245, + 10737, -20401, -11811, 39728, 20401, -30065, + }, + { + -233002, -5669357, 492311, -368293, 367220, -294205, 125628, 71404, 79994, -56908, + -531502, -574452, -1718524, 3309272, -3013457, 1103807, 1115618, -991601, -1386201, -306553, + 889058, 695248, -789200, -389768, -316754, 1279900, 318901, -1424319, -228707, -46171, + -965831, 396748, -270046, 995896, -285078, -73014, -158914, 294742, -297963, -163746, + 110059, 226023, 5906, -41339, -46171, -28454, 335007, 154619, -359167, -103079, + 110595, -37044, 157840, -109522, 105227, 130997, 18790, 310848, 191126, 68719, + 147103, -89121, 101469, -26307, 139586, 110595, 59056, 46708, -28454, -6442, + 34897, -4295, -48318, -59593, -84826, -71941, -68719, -116501, -4832, -6442, + -20401, -22012, 10737, 8053, 23085, -16106, 46171, 51003, 17717, 6979, + -24159, -6979, -2147, -5369, 17717, -36507, + }, + { + -1242856, -884763, -2866354, -3263638, 165356, -750009, -2830920, 731218, 796180, 318364, + -819265, -56371, 2432025, 1014686, 88047, 510564, 1066226, -623307, -1097364, -283468, + 278099, -128849, -246424, 41339, -400506, 586800, 163209, -57445, -455267, 161061, + 57982, -139050, 271120, 456340, 261456, 361851, 55835, -69256, 374736, -46708, + -200790, 171262, -188442, 713501, 71404, 119722, 92342, 150861, 131533, -270583, + -119185, -49929, -274878, 173946, -198105, -98247, -59056, -41339, 116501, 57445, + -103079, -10737, 101469, -156229, -31139, -43487, 79457, 17717, 108985, -9664, + -40265, 91268, 39728, -9664, -73014, 105764, 40265, -10201, 62277, -34360, + -35970, 86436, 62814, 23085, -128849, -86436, 33823, 75699, -1611, 33823, + 10737, 27380, -15032, -45634, -24696, -70867, + }, + { + -450435, 1248225, 42950, -752156, 29528, -455803, -599148, -121870, -237297, -499827, + -424665, -631360, 700080, -797253, -8633421, 286152, -163209, 638876, 724239, 790811, + 304406, 189515, -260382, 770947, 285615, 913754, 458488, 57445, -2070174, 625455, + 541703, 748935, -33823, 321049, -183610, -284542, -229781, 72478, -44023, 239444, + 329102, -476741, -82141, -47245, -279173, -178241, 171799, -319975, -122407, -327491, + 17180, -81604, -20938, 46171, 97174, -21475, 125628, 97711, 40802, 275952, + -30065, -216359, 46171, -32749, -60666, -8590, 24159, -48855, -3221, 10737, + -44560, 198642, 35433, 19327, -9664, 59056, 11811, 165356, -57445, -41339, + -12348, -70330, 53150, 7516, 5906, 60130, 37581, 18254, -46171, 31139, + -49929, -70330, -34897, 42950, -4832, -32749, + }, + { + -2711198, 4642323, 909996, 1167694, 592706, -1551557, -1099512, -473520, 508954, 824097, + -195958, 1087164, -1190780, 380105, 6177774, 200790, -2452963, 1817308, -1389959, -359167, + -294205, 571768, 292595, 73551, 461172, -36507, 1287417, 679679, -28991, -413927, + -319438, -7516, -156766, -572841, 503048, 578210, 912681, 75162, 273804, 484794, + 537945, 186831, -80531, 275415, 220117, 105227, 653372, 179852, 115964, 17180, + -207232, -68719, -180926, -134218, -162135, -106300, 537, -75162, -247497, 38655, + -70867, -48855, -31139, 127775, 71404, 32749, 16106, -22012, -44560, 52076, + 0, 65498, 132070, -153008, -51003, -25770, 48318, 15032, -19864, -46708, + 85899, -15032, 6442, 34897, 1074, 1611, 30065, -33286, -83752, 44023, + 8053, 25233, 19327, 20401, 18790, -33286, + }, + }, + { + { + -461172, 4959614, 3001645, 279710, -566399, -225486, 168577, 77846, 71404, -647466, + 238908, 461709, 1111860, 762357, -945967, -769873, 2637110, -639413, -471910, 1320703, + -73014, -1875290, -67109, -420907, -525060, 126702, 226023, -199716, 13959, -603980, + -359704, 296890, -769336, 1080184, -37044, -186831, 122407, -943819, -112743, -650151, + 264141, -303332, 818191, -213675, 314069, 217970, 198105, 316754, 284005, -105764, + -443992, 96637, -125628, -218506, -8053, 74088, 54224, 34897, 159988, -232465, + 4832, -184147, 70330, 121870, 25233, -55298, 56371, 84289, -125091, 66035, + 6442, -10737, 44560, 57982, -31675, 30065, 13959, 6442, -16643, 36507, + -67109, -30065, -71404, -30065, -13959, 57445, 64961, -18790, 2684, 54224, + 1074, -19327, -19327, 42413, 32749, 27380, + }, + { + -3690988, 61022896, 9088688, -795643, 906775, -369904, 752156, 726923, -334471, -34360, + 39728, -614717, 209917, 375810, 921271, 1669132, 987843, 586800, -350577, 96100, + -224412, 242666, -108985, -431107, 34360, 186294, 255551, 178241, -252329, -207232, + 709207, 292058, 552977, 585726, 1611, -569083, 547071, 221728, 276489, 211527, + 211527, -9127, -265751, -139586, 74088, 3758, 86973, 279710, -31675, -335007, + 158377, 93416, -138513, -45097, 111669, 16643, -133144, -209917, 68719, -106300, + -127238, -69793, 52613, -49929, 152471, -79994, -40265, -86973, -48855, 122943, + -9664, 16643, 12348, -40265, 75162, -3221, -63888, 38118, 69793, -32212, + -26844, -5369, -4832, -47782, -33823, 86436, -9127, -23622, -11274, -16106, + 46708, 20938, -12885, 8590, -9127, 0, + }, + { + -2154463, 44386340, 427886, 1009317, -1976222, 383326, 10737, 63351, 334471, 18790, + -584652, -248571, -496069, 986232, -11274, -258772, -1457068, 238371, 175557, -13959, + 1107028, -332323, -398358, -683974, -117575, -416075, 579821, 389231, 418759, -28991, + -914291, -29528, -619549, -281857, -108985, 63888, 83215, 452045, 36507, 53687, + -406411, 142271, 579284, -275952, -176094, 521839, 321586, -265751, -162135, -288837, + 63351, 130997, 110059, -164283, 538482, -258772, -128312, 137976, 155693, 10201, + -126165, -133681, 47245, 4832, -135291, -14496, -136365, 50466, -28454, -108448, + -60666, 25770, 22012, -40802, 72478, -44023, 38118, -40802, 83215, -32749, + -65498, -63351, 3221, 12885, -6442, 50466, -3221, 9664, -3221, 31675, + -40265, -537, -9127, 5906, 8590, -8590, + }, + { + 406948, 2922725, -714038, -100932, -22012, 187368, -70330, -24696, 32212, -32212, + 265214, 14496, 263604, 826244, 4883915, 253940, -402116, 1023813, 481036, -1008244, + 452045, 143345, 560493, 1082869, 139586, 915365, 1878511, -210990, 155156, 1131724, + -690416, -422517, -320512, 37581, -149250, 288837, 358093, 107374, -197569, -44560, + -62277, -308164, 91805, 287226, 89657, -74088, -405874, 210453, 40265, -243203, + -22012, -250719, -177704, -64961, -11811, -60130, 24159, -63351, 5906, 77309, + -52076, -159451, -39728, -53687, -28454, -10201, -8590, -43487, -100395, 537, + 113817, 45634, 35970, -103079, 140660, -12348, -51003, -1074, -32212, 25233, + 52076, -26307, -3758, -28991, -12885, 38118, -9127, -23622, -55298, 23085, + 38118, -35433, -43487, -7516, -8590, -33286, + }, + { + -6746857, 15927886, -1900523, -2294050, 293668, -3221, 52613, 75699, 660351, -366683, + -1090922, -274878, 464393, -126165, -622770, 107911, 192737, -888521, -103616, 339302, + 289373, -175020, 548145, 585726, 22549, 43487, -338229, 214748, 723165, 472446, + -133144, -274341, -343061, -226560, -54224, 453119, -363998, 160524, -217433, 70867, + 362925, -271120, 197032, -304406, 197032, -362388, -128849, -143881, -254477, -82678, + -86973, 100932, 106300, -113280, 62277, -79994, 44560, -98784, 175557, -29528, + 173946, 217433, -19327, 24159, 55835, -97711, -30602, 42413, 20401, -31675, + 49392, 34897, 90731, 4832, -79994, 25233, -50466, -51003, 23085, -41876, + 46171, 3221, 9127, -4832, 22549, 1611, 4295, 31139, 31675, 15032, + 17717, 20938, 23622, 10201, -20401, -17180, + }, + { + 137439, -4201015, 2032593, 135828, 81604, 17180, -163209, -41876, -141197, 41339, + 426276, 127775, 21475, 799401, 4652524, -1633698, 54761, 107374, -1050656, -2070711, + 270583, -14496, -239444, -1279363, 1166084, 452582, -1370095, 982474, -870268, -31675, + -435402, -302258, 18790, -20401, 205085, 20938, -34897, 89657, 411780, 233539, + -118648, 481036, 126702, -134218, -347892, 23085, 193810, 272730, -111132, -83752, + -135828, -10737, -20938, 153008, -137976, 10201, 154619, 91268, 31139, 20938, + -73014, -16643, 1074, -26844, -39192, -56908, -20938, 25770, 9127, 74088, + 51540, -40265, 66035, -15569, -61203, -70330, -16106, -79457, 21475, 98247, + -34897, -11811, 30602, -41876, 11274, 5369, -537, 5369, -4295, 3221, + 44560, -18254, -39192, -7516, 5369, 28454, + }, + { + -9403831, 13855564, 5259188, 398895, -545998, 56908, -28454, -13959, -79457, 591632, + 106837, 64425, -181462, -29528, -199179, -28991, 602906, -397821, 447750, -153008, + 445066, 49392, -345208, 314069, -89657, -46708, -217433, -190589, 178241, 287763, + 102542, -460098, -103079, -171262, -30602, 408559, -282394, 293668, 10737, 176631, + 306553, -121870, 292058, 391916, -25233, -224412, 259846, 306553, -240518, 212601, + 152471, -63351, 202937, -66035, -67646, -105227, -50466, 85362, -159988, -19327, + 112743, 110595, 35970, -46708, -41339, -75162, -149787, 133144, 86436, -89657, + 86973, 74088, -145492, -25770, -22549, 13959, -15032, -13422, 30602, -53687, + 31675, -537, -33823, -42413, 104690, -48318, -11274, 10201, 27380, 9127, + -68719, 33286, -10737, 32212, 10737, 3221, + }, + { + -85362, -760746, -917512, 772557, 64961, 89121, -79994, 143345, 252866, -2684, + 488016, -24159, 208306, -137976, 4350265, 2702608, -923418, -606664, -56908, -1104880, + 991064, 353261, 657667, -48855, -2254321, -25770, -1177358, -218506, -1083942, 332323, + 200253, 312996, 228170, -508954, 178241, -13959, 55298, -89657, -549219, -100932, + -179852, 110059, -168577, 165356, 16106, -206695, -242666, 19327, 223875, -232465, + -161061, -304943, 117038, -172336, 1074, -89657, -123480, 198105, 209380, -128849, + -3758, -4295, 80531, 40802, 6442, 154082, -25770, -39728, 4295, -45097, + -31675, -19327, 49929, -25233, -84826, 32749, -60666, -76773, -18790, -12885, + 96637, 24159, -32212, 15569, 4832, -2147, -15032, 31675, -4295, -49929, + -5906, 15032, 8053, 27917, -2684, 6442, + }, + { + 2921115, 9903121, -3626563, 666794, -657130, -218506, 314069, 727460, -98784, -572841, + 846109, 800475, 37044, -1793149, -197569, 86436, -533650, 802085, 175557, 31139, + -194884, 255014, 32212, -269509, 51540, -376347, 68719, -176094, 245887, 4295, + 535260, 274878, 284005, -287226, 74088, -834297, 73014, 328028, -481573, -103079, + 698469, -362388, -332323, -295279, 12885, -155156, 25233, 217433, 55298, -149787, + -194884, 69256, 388695, 10737, -54224, -1611, -64425, -105764, -107374, 53150, + 105764, -63351, 20938, 84289, 200253, 51003, -141197, -68183, -80531, -84826, + 34897, 60130, -53687, -91805, -113817, 120796, 89657, -76773, 27917, 2147, + -11274, 60130, 47782, 66035, 60130, 51540, -46708, -27917, -20938, 22012, + 51003, 4295, 20938, -4832, -1074, 15032, + }, + { + 270583, 5150203, -2133525, 4234301, -281857, -1319629, 402653, 46171, -128849, 199179, + -461709, 566399, -483721, 250719, 1316944, 359167, -906238, -1016834, -947577, -41876, + 1702418, 6442, -777926, -392990, -52076, 415001, 501974, -580894, -522912, 310311, + 284542, -227096, 287226, -449361, 449361, 652835, -349503, -290447, 257161, -363998, + 21475, -387084, 108448, 208306, 97174, 63888, 8053, 21475, 165356, -244813, + -25233, -212064, -110059, -84826, 227633, 56908, -140660, 60130, -59056, -57445, + 28454, -17180, 118648, -30602, 26844, 109522, -119722, 17180, -67646, -77309, + 40265, 36507, 68719, -54224, -8590, 40802, 23622, 14496, 8053, 36507, + -5906, -3758, -57445, -41339, -10737, 4832, 26844, 1074, -25770, -45634, + -14496, -15032, -20938, 11811, 8053, -19327, + }, + { + 4387846, -11714523, 1960116, -3282966, -2121177, 3121904, -3766686, 1933809, -392990, 300648, + 114890, -258772, 8053, -814970, 1788317, -1627256, -1342177, -224949, -267362, 328028, + 959388, -26307, 312996, -496606, 85362, 149787, -163209, -118648, -57982, -183610, + -636729, 298500, 97174, -323733, 130997, 121870, 208306, -137439, 93952, -940061, + -592706, 189515, 250182, -74625, -9127, -81068, 202937, -380105, -86973, 221191, + 64961, 23622, -162672, 161061, 195958, -119722, 270046, -108985, 27380, 52613, + -7516, 53687, 38655, 56371, 2684, 13422, 49392, 3758, -12348, 46708, + 12348, -24159, 54224, -96637, 22012, -41339, -3221, 18254, 28454, -20401, + 4295, -49392, 32749, -39728, 4832, -49392, -23622, -9127, -11811, 45097, + -31675, 1611, 41876, 7516, -32212, -4832, + }, + { + 123480, -5173288, 612570, -59056, 143345, -76773, 293132, 2684, 30602, 13959, + 89121, -282931, -1575716, 4239133, -605590, 529892, -133144, -1070521, -286152, 766115, + 936840, 695248, -199716, 6979, 311922, 1593433, 917512, -779537, 54224, -824634, + -203474, 609885, 183610, 296353, -304406, -303869, -348429, 323733, 55298, -244813, + 240518, 243739, -228170, -110595, 60666, -131533, 284005, 7516, -376347, -143881, + 82678, -129386, 17717, -113280, 126165, 99858, 30065, 308164, 4295, 23622, + -125091, -82141, 73551, 32212, 34897, -98784, 82141, -79994, 13422, 70330, + -12348, -77846, -78920, -48318, -45634, -31139, -26307, -6442, 40265, 32749, + 4832, 0, 47245, 32212, 7516, 26307, 46708, 3758, -13422, 18790, + -4295, -16643, -13959, 33823, 26307, -52613, + }, + { + 75162, 3263638, 97174, -1320703, -16643, -970126, -1693291, 985158, 671089, 12348, + -236223, 157303, -358093, -2615098, -347355, 821949, 779537, 153545, -158914, -871878, + 622770, 120259, 59056, 27380, -796716, -274341, 173946, 153545, -72478, 175020, + -257698, -25233, 176631, 132607, -196495, 125091, 22012, -233539, 12348, -207232, + 16643, 413927, -574989, 401579, -199716, 114354, -245887, 241055, 5369, 1611, + -95563, -103616, -229781, -69256, -70867, -112206, 88584, 132070, 220654, -78383, + -122943, 104153, 216359, -148713, 25770, -19327, 94489, 11811, -75699, -5369, + 114354, 62277, -81068, 18254, -51003, 69793, 33286, -61203, 33286, -32212, + 31675, 28454, -29528, 2684, -56908, 35970, 76236, 57445, 6979, 22549, + 1611, -6442, -68183, -11274, -41339, -47782, + }, + { + 263604, 1249299, -1647120, -673236, 375810, 38655, -157303, 92879, -97711, 151398, + 95026, -31139, 98784, 6554120, 1822140, 412854, 107911, 1206349, 849330, -652835, + -228170, 390842, -19327, 205085, 877247, 851477, -301721, 139586, -235149, 671089, + -186831, 297963, -447750, 27380, 180389, 69256, -125628, 41339, -244813, 208843, + 13959, -600222, -17180, 239981, 65498, 95026, 126165, -7516, 67109, -40802, + 82141, 1611, 98784, 98784, 26307, -42413, 109522, 3758, -121333, 229244, + -237297, -155156, 33823, 19864, -45097, 164283, 57982, -42950, 15032, 28991, + 8590, 136365, -73014, -12885, -31139, 4295, 57982, 21475, 3758, -44023, + -52076, -11811, 36507, 35433, 26844, 28454, 5906, -27380, 9127, 16643, + -80531, -10201, 23085, 0, -32749, 2684, + }, + { + 155156, 8145943, -2061047, -2425046, -324270, -1098975, 636729, -170188, 265751, 236760, + -2239826, 812823, -250719, -2113124, 272730, -602369, -1283122, 1302986, -1312113, 341450, + 99321, 374736, 177704, -331786, 504659, -80531, 508417, -263604, -79994, 255014, + -350040, -242129, -107374, -431644, 471373, 111669, 666257, -240518, 166967, 416612, + -194347, 29528, 290447, 383326, -10201, -2147, 151934, -380641, -283468, 10201, + -177704, 3221, -29528, 115964, -106837, -37581, 41876, -40265, 32212, 126165, + -67646, 32749, 39192, 165356, 34897, 112206, -19864, -32749, -77309, 31675, + -5906, -22549, 45634, -114354, 46171, -23622, 71404, 6442, -40265, 10201, + 44023, -78383, 29528, 33286, -36507, -55298, 6442, -51540, -12348, 27917, + -16643, 15032, -12885, -14496, 22549, -11811, + }, + }, + { + { + 538482, 8884677, 730144, 316754, -321586, -74088, -153545, 12348, 84826, -323733, + 1070521, 242666, 1956895, 1034013, -3367254, 721555, 1004486, 592706, 935229, -398358, + -306553, 184147, 460098, 21475, -261993, -200790, -456340, 143881, 287226, -195958, + -311922, 217433, 1077500, -171799, -155156, -185757, -198642, -1108102, -974958, -588411, + 409633, 264141, 82141, 142271, 263604, 231391, -47782, 198642, -78383, 100395, + -19327, -22012, -54224, -137976, 77846, 17717, -181462, 36507, -183073, 40265, + 12348, -31139, 146029, 123480, 34360, 74088, 85899, -63351, 89657, 140660, + 4295, -104153, 18254, 34360, 15569, 4832, -55298, 12348, 56908, 32749, + -75162, -42950, 35433, 63888, 50466, 3221, 3758, -3758, 16106, -3221, + -3758, 1611, -26844, 27917, -2147, -34360, + }, + { + 5211406, 61046516, -432181, -700617, -1154809, -83215, 311922, -587874, -864362, -214212, + -160524, -421444, -267899, 1124745, 1111323, -64425, 123480, 153008, 1160715, -116501, + -39192, -255014, -417149, -234613, -49392, 629750, -649614, -35433, -157303, 82678, + 482647, 989453, 89657, -176094, 209380, 71941, 512175, -489626, 224949, -271657, + -154082, 75162, 384400, -5906, 37581, 24159, -54761, 18790, -293132, 25233, + 54761, 99858, 129386, 2147, 119722, -52613, -66035, 19327, -47245, -18254, + 1074, 26844, -66572, 11811, -61203, -98247, -19327, -51540, 106837, 60130, + -20938, -39728, -88584, 27917, 16106, -68183, 40802, -50466, -32749, -28991, + 47782, 10201, -57982, -11811, 70867, -26844, -34360, 63351, -28454, -9664, + 3758, 10737, 30602, 18790, -13959, 0, + }, + { + 1854352, 32959042, 2295123, 2020245, 1627793, -15569, 227633, -15569, 119722, -354335, + -686121, -719944, -359167, -1603633, 1356673, 401579, -927713, -309238, 23085, 515933, + 0, -235686, 115964, -1079111, 243203, 273267, 462246, -253403, 212601, 27380, + -383326, -593242, 289910, -53150, -852014, 115964, 121333, 632971, -175020, 20938, + -329102, 238371, 476205, 101469, 113280, 185757, -320512, 57445, -10201, -47782, + 50466, -103616, -30602, 151398, 90194, 78920, -33286, 234076, 63351, -32749, + -65498, 60130, 213138, 0, -8053, -20938, -15569, -44023, 4295, 44023, + 537, -26844, 43487, 47245, 53687, -31675, 47245, -21475, -34360, -41339, + -73014, -21475, 30602, 36507, -48318, -6979, -10201, -45097, 13422, -40265, + 537, 34897, 22012, 17717, 20938, -25233, + }, + { + -312996, 1751810, 463856, 205622, 252866, -99321, 37581, -127238, -63351, -55835, + 299037, 176094, -295816, 442382, 4814122, 1497870, -1200443, -399432, 243203, -130997, + -367757, 66035, 1005022, 538482, 1040456, 900333, 461172, 581968, 24159, 1062468, + -993748, -1000727, 565862, -306016, -312996, -232465, 1410360, -258772, -1611, -5369, + -112206, 80531, -148713, 181462, -303332, 90731, -58519, 51003, 164283, 44560, + -233002, -336618, 19327, -75699, 120796, 92342, -144418, -116501, 57982, -68719, + -84826, -108985, -9664, -51540, 41876, 74625, -17717, -101469, 72478, 56908, + -78920, -86973, -3758, 61203, 54761, 30602, 27380, 53150, 84289, -16106, + 20938, 23085, 20401, -20401, 18254, -37581, -31139, 25233, 13959, 34897, + -2147, -2147, 42413, 27380, -17180, 14496, + }, + { + 5091684, -904091, -2194728, -1401770, -113280, 154082, 392990, 126702, 209917, -774705, + -606127, 406948, -591095, 153008, -628676, -237297, -257161, -420907, 438624, -15032, + 54224, -87510, 463320, 364535, -432718, 318364, 213138, -133681, 613107, 343061, + -433792, 129386, -601295, 111132, -30602, 167504, -805843, -583579, -128312, 302795, + -231928, -104153, 33286, 143345, -324270, -55298, 69256, -259309, -92879, -137439, + 96637, 81068, 230318, -76773, -124554, -2147, -35970, -124554, -147103, 39728, + 178778, 142271, -13959, 25770, 51003, -2147, -34897, -22012, 12885, 110595, + 9127, -70330, -50466, -45634, -2684, 11811, 33286, 27917, -5906, 10737, + 40802, 60130, 16643, 15569, -52613, -26307, 42950, 1074, -25233, 1611, + 8590, -22549, 1074, -36507, -41876, 3221, + }, + { + -346819, -81604, 881005, -248571, 37581, -89121, -31675, -9664, -79457, 223875, + 30065, -87510, -70330, -552977, 2319819, -377420, 782221, -666794, 802622, -234613, + -978179, -1131724, -167504, 334471, -551366, 257161, -724776, 407485, -1104880, -1104344, + 632971, -384400, 222801, 340376, 638876, -57445, 259846, 559956, 313533, -108985, + 159451, 463320, -54224, -104690, 25233, 68719, -7516, 158377, -302795, -187905, + 8590, 195958, -137976, -11811, -9664, 41876, 77846, 112206, -23085, 20938, + -65498, -45097, 19864, -5906, -8590, -15569, -29528, -79457, 537, -17717, + 44560, 121870, 44023, -3221, -40802, 3221, 66572, 50466, 77309, -5906, + -4295, 24159, 1074, -45097, -9127, 17180, 6442, -5369, 12885, 30065, + -18254, -55298, 11811, 30602, 20938, 8053, + }, + { + 3305514, 4658429, -584116, -250719, 50466, 187368, -53687, 237297, 229781, -174483, + 349503, -136365, 92879, 530428, -824634, 384400, 503048, 215285, -1611, -650688, + -189515, 169114, -60666, -121870, 79994, -472446, 96637, -13422, -226560, 30065, + -60130, 43487, -250182, 190052, 223338, 162135, 161061, -127775, -207232, 351114, + 123480, 143881, 153008, 1074, 331249, -395674, 111132, -149787, 173409, 79994, + -67109, -23085, -173409, 23085, -55298, 47782, 122943, 2684, 122407, 88047, + 176094, 26307, 92342, -70330, -64425, -39728, 83752, 26844, 12885, -6979, + 17180, -77309, 4295, 78920, -33823, -35970, 11274, 40802, -12348, 18254, + 33286, -46171, 12348, 32212, -22549, -49392, 62814, 45097, -14496, -45097, + 4295, 41876, -11811, -4832, -18790, -6979, + }, + { + -353798, -300648, 1208496, 222801, 157840, -121333, -92879, 179852, 216896, 122407, + -45634, -207769, -722628, 1062468, 6385006, 686658, -905701, -2171106, 214748, -280247, + -1349694, -200790, 335544, -723165, -2076080, -470836, -465467, -462246, -838592, -226560, + 26307, -82141, -312996, -19327, -274341, 193274, 25770, 106837, -437013, -62814, + -186294, -22012, 126165, -116501, -92342, -133144, 233539, -81068, -205622, 31675, + 4295, -284005, 37044, 11274, 125628, 30602, 212601, 240518, -137439, -56908, + 55835, 125091, 129923, 15032, 54761, -72478, -19327, 39192, 40802, -15032, + -5906, -35970, -36507, 9127, -12885, 20401, -11274, 15032, 23622, 51003, + 55835, -46708, -41339, -38655, 10201, 30065, 9127, 46708, -34897, 6442, + 26307, -34897, 8590, -537, 12348, 5369, + }, + { + -1239098, 4609574, 3670587, -11274, -236760, 159451, 75699, 227096, -482647, 456877, + 175020, -276489, -425202, -1598265, -397821, -45097, 783832, 404264, 236223, -125628, + 2147, 204548, -249645, -175020, -290447, -63888, 140660, -8590, -24696, 437013, + 645856, 566399, -153545, -280247, -322123, -107374, -481036, -121333, 630286, 363998, + -44023, 395137, -304943, -192737, -77846, 105227, 222265, 419296, -82678, -327491, + -33823, 195958, 33823, 287763, -82678, -2147, -119185, -9127, -64425, 5906, + -44560, -42413, 66035, 34360, -11274, -129386, -62277, -18254, -150324, 6979, + -23622, -5369, -17717, 30602, 14496, 28454, -19864, -19327, -3221, 22012, + -42413, 37044, -1074, 39728, -36507, 537, 14496, 10737, 32749, 72478, + 10737, -6979, -28454, 14496, 42413, -13959, + }, + { + -214748, 3295314, 1387811, 1883880, -453656, 132607, 625992, -275415, -123480, 550293, + 31675, -119185, -1093069, 688269, 608812, 426812, -893353, -341450, 397821, 639950, + 573378, -415538, 136902, -92342, 470299, 292058, 59593, 107911, -143345, 105764, + 236760, -718333, 560493, 286689, -68183, 396211, 110059, 298500, 456877, -237834, + -30065, -22549, 230318, -39728, 156229, 481036, -94489, 169114, -161598, -10201, + 136365, 59056, -99321, 82141, -156229, -186294, 25233, 79994, 53687, 130997, + 37044, -67109, -69256, -159988, -32749, -93952, 5369, 105227, 122407, 47245, + -2147, 50466, 0, -44560, 34897, -33286, -23622, -23622, -42950, -20401, + -60130, -8053, -13959, 6979, 12885, 36507, -2147, -22012, -33286, -15569, + 24159, -15569, 9664, 11274, 39728, 38655, + }, + { + -4159139, -4641786, -23622, -1590749, -614717, -709743, 4344360, -350577, -450972, 71941, + 203474, -234076, -16106, 949725, -233539, -1310502, 31675, 189515, -364535, 387621, + 78383, 259846, 573915, -176094, 91805, -154619, 32749, -508954, -52076, -143345, + 168577, 192737, -84826, -251792, 126702, 55298, 24159, 308701, -82678, -674310, + 119722, 449898, -178778, 20401, -459562, 105227, 97711, 0, 537, -27917, + 285078, -27380, 176094, 9664, -23622, -72478, -43487, 124017, 141734, -27917, + -19327, 92879, -6442, -86973, 29528, 35970, -34360, 11274, -37044, 27917, + -20401, -18254, 11274, 87510, 42950, 61740, 6979, -20401, -27380, 17180, + -70867, 22012, -18790, -40802, 31675, 2684, 37044, 8590, 28454, -20401, + -14496, 9664, 20401, -39192, -19864, 25233, + }, + { + -27380, -3803731, -380105, 282394, -48855, 250182, -220654, -196495, 144955, -103079, + 242666, -498753, 1398549, -510564, 1104344, -244813, -311385, 52613, 568546, 497679, + 257161, 409633, 151934, 571231, 1644973, 706522, 105764, 154619, -963146, -173409, + 744103, -486405, 275415, -318901, 257161, -398895, -288837, 228170, 529355, -5369, + -20401, -34897, -9127, 98784, 127775, -69793, -18254, -117575, -76236, 173946, + 62814, -158377, -75699, 96100, 107911, -34360, -88584, -119185, -135828, -72478, + -92342, 38118, -16106, -81604, -143881, -18254, 84289, -104690, 81604, 67109, + 22549, -16106, -38118, -16106, -18254, 79994, 57445, 11811, 34360, -10201, + -4832, 37581, -45097, -30065, -16106, -22549, -17717, -31139, -18254, 12885, + 6979, 17180, 23085, 0, -5906, 13422, + }, + { + 213675, 413927, 2368675, 999654, -856846, 325881, 884226, -109522, -537, 686121, + 508417, 319975, -660888, -2372970, 8590, -543313, 265751, 948651, -282394, 42413, + 668941, -95563, 147103, -12348, -276489, -249108, 372052, 310311, 307090, 351114, + 169114, -48855, 18254, -27380, -229244, 300648, 250719, -314606, 70330, -70330, + -155156, -235149, -179852, -366683, -226023, -282931, -234076, -149250, -151398, -154619, + -1611, 53150, 48855, 136365, 143345, -65498, 199179, 66035, 49392, -161061, + 91268, 20938, 132070, -19327, 53687, -42950, -77846, -12885, -49929, 84826, + 42413, -98784, 2147, 60130, 4295, 48855, -43487, 12348, 14496, 42950, + 46171, -67646, -59593, -2147, 37581, 39728, -74625, -2147, 0, -42413, + -13422, -28454, 1611, 31139, 5906, 36507, + }, + { + -83752, -367220, -549756, 27917, 24159, 379568, 67109, 128849, -135291, 240518, + -56908, 282394, -600222, 733366, 15185394, 159988, 654446, 133681, 654983, -1113470, + 998043, 38118, 418222, 678605, 1196685, 501437, -252866, -324270, 1323387, -259309, + -214212, -250719, -155693, -494995, 63888, 16643, -158914, -292595, 57982, -89657, + -370441, 105227, -1074, 259309, 47782, 43487, -57445, 281857, 212601, -26844, + 194347, 201327, 41876, -107374, 35970, -102005, -24159, -18254, -33823, 50466, + -28991, 128312, -84289, -2684, 15032, 82678, -11274, 139050, 12885, 71941, + 58519, -75699, -57445, 38655, -28991, 12348, 9127, -87510, 46708, -28454, + 28454, 85899, -26844, 6442, -32212, -44023, -74088, 17180, 55298, -33286, + -537, 61740, 2147, -34360, 16643, 9127, + }, + { + 1351304, 3724274, -2215130, -776315, -348966, 1763621, 490163, -33823, 6979, -349503, + -980863, 421981, 474057, 228170, -3441880, -238908, 803696, -415538, 185757, 568009, + -340376, -81068, -52613, 153008, 289373, 35970, -633508, -243203, 291521, 238908, + -84826, -24696, -261456, -201327, -426812, 294205, -4832, -36507, 253403, 230318, + 12885, -16643, 310311, 263067, -76236, -81604, -492848, -243739, -56371, 156766, + -250182, 128312, 292595, 96100, 17717, 71404, -158377, 15569, -35970, 81604, + 36507, -84826, 6979, -35433, 10201, -5369, 0, -13422, -83215, -10737, + 18254, -139050, -57445, 74088, 98784, 537, -35970, 0, 1611, -17717, + -38655, -3758, 41876, 0, -5906, 4295, 4295, 21475, 42950, -57982, + -27917, -12885, -32212, -6442, 15032, 23085, + }, + }, + { + { + -705448, 6296422, -471910, 8590, 388695, 35970, -108448, -23622, -70330, -76236, + 467615, -190052, 178778, 144955, -2562485, 445603, -292595, 311922, 759136, -232465, + 494458, 1027034, 134755, -420370, -358093, -346819, -377957, 207769, 469225, -316754, + -427886, 167504, 341450, -322659, -382252, 38655, 538482, -628139, -136902, -97711, + 390842, 169651, -304943, 158914, 211527, 102005, -151934, 309238, -181999, 185220, + 182536, 15032, 174483, 135828, 69256, 28454, -146029, -108985, -37581, 170725, + -53687, 28991, 48855, 30065, 22549, 48855, -39192, -52076, 141197, -17180, + -28991, -24696, 51003, 2147, -11274, 1074, -5906, 39728, 49392, -3221, + 1611, 33823, 45097, 22549, 12348, -40802, -7516, -11811, 9127, -42950, + 28991, -9127, 6979, 5369, -37581, -30602, + }, + { + -4915053, 40121972, -3151969, 1857037, -98247, -4832, 8590, -467615, -121870, 169114, + 124017, 118112, -269509, 159988, -23622, -1005022, -121333, -330176, 724776, 128312, + 166967, -59056, -45634, -25233, -206695, 156766, -802085, -234076, -232465, 17717, + -41876, 584116, -247497, -314069, 54224, -13422, 295279, -494458, -46708, -364535, + 45634, -107374, 45634, -19327, -10737, -164283, -119185, -242129, -137439, 257161, + 22012, 27380, 84826, -128849, -46708, -206158, 47782, 45634, -9127, 142271, + 27917, -65498, -51003, 37044, -107911, 33286, 11274, -11274, 71941, -99321, + -6442, -44560, -56371, 9664, -75699, 25770, 48318, -48855, -537, -1611, + 41876, -26307, -35970, 18254, 34897, -104153, 41876, 41876, -4832, -6442, + -28991, -1611, 37044, -12885, 4295, -10201, + }, + { + -683974, 18160732, -4180614, 1876901, 284542, -340376, 162135, -328565, -103079, -499827, + -144955, -221191, -9127, -479963, 1992865, -40802, -39728, 69793, -510027, 233539, + -131533, 40265, 485868, -298500, 621697, 490700, 181462, -368293, -70330, 177704, + 154619, -14496, 616328, 47245, -590021, 317291, -95563, 388158, -123480, -29528, + -7516, 100395, 148176, 114354, -64425, -147103, -267899, 169114, 119185, 93416, + -6979, -37044, 6979, 68719, -71404, 166430, 76236, 41339, -44560, -45634, + 59593, 81604, 125091, -48855, 18790, -56908, 104153, 22549, 68183, 62277, + 19327, -16106, 8590, -3221, 23085, -32749, 1074, -10201, -81068, -1611, + -2147, 31139, 40802, 3758, -34360, -14496, -44023, -27917, 31675, -49929, + 35433, 14496, 34897, -3221, 2147, -18790, + }, + { + 407485, 548145, -732829, 271657, 37581, -103616, 164283, -65498, -82141, -27380, + 193810, 70867, -317828, 370978, 2362769, -382252, -1109712, 27380, 79457, 140123, + -288300, 403727, 160524, -443992, 809064, -707596, -1253057, 46708, 481036, 1406065, + -777389, -535797, 813359, -233539, -255551, -181462, 722091, -193810, 125091, -193810, + 117038, 316217, -61740, 112743, -341450, 242666, 76773, -16106, 203474, 74625, + -268435, -8590, 73014, -123480, 155693, 38655, -75699, 46171, -11274, -26844, + 27917, 23085, -15032, 6442, 88584, 55298, -13422, -31139, 60666, 13422, + -166967, -24159, 30602, 71941, -24696, 58519, 79457, 27917, 13959, -48318, + -6442, 35433, -5906, 8053, 21475, -24696, -6442, 40802, 23622, -6979, + -12885, 21475, 36507, 10737, -1074, 17717, + }, + { + -1203665, -7318625, 1586990, -426812, 325881, -82141, 14496, 140660, 401579, -350577, + 485868, 138513, -39728, 281320, -838056, -139586, 147103, -208843, 63888, -464930, + -99321, 81068, -198105, -135291, 126165, 66035, 545461, 191663, 443992, 181462, + -108985, 450972, -9127, 461709, -17180, 92879, -845035, 222801, 342524, 284005, + -289373, -89121, -28454, 49929, -325344, 186294, 328028, -25233, 99858, -19864, + 275952, -13422, 64961, -2147, -75162, 24159, -99858, -103616, -111669, 34897, + -33286, 11274, 5906, -56908, -2684, 19327, -11811, 10737, -2147, 27917, + -59056, -90731, -34360, 74088, 12885, -14496, 81604, -9127, 10737, 22012, + 30065, 61203, 3758, -25233, -26844, 4295, 11811, -20938, -56371, -19327, + -4832, -22549, -12348, -39728, 5906, 6979, + }, + { + -131533, 2282775, 450972, -592706, 37044, -33823, 167504, 69793, -41876, -19864, + -180389, -79457, -186831, -696322, 3389803, -250719, -310848, -52613, 1073742, -162672, + 549219, -249645, 1167694, 1286880, -481036, 1285269, -195958, -65498, -123480, -679142, + 358093, -299574, 86436, 257698, 536334, -221728, 66035, 234076, -537, -244276, + 348966, 145492, -61203, 88047, 113817, 29528, -84289, 84289, -133144, -3758, + 77846, 97711, -171799, -45634, -15032, -55298, -35433, 62814, -34897, -7516, + -51003, 52076, -70330, -63351, -24696, -11274, 46171, -25233, 60666, -28991, + 77846, 46171, -62277, -11274, 44023, 18254, 51540, 43487, 25233, -55298, + 51540, 7516, 537, -11811, 19327, 10737, -6442, 2147, 14496, 9664, + -41876, -1074, 47782, 4295, 4832, -15032, + }, + { + 1085016, 6641630, 2653753, -1060857, 157840, 129923, 16643, -169114, 44560, -233539, + 25233, -430034, 144955, 362388, -1364726, -641024, 22549, 21475, -191126, -244813, + -128312, 225486, -97711, -147103, 45097, -320512, 362925, -19327, -86436, -9664, + 48318, 275415, -101469, 283468, 124017, 316217, 133681, 70330, -57982, 107911, + -36507, 167504, 55835, -46171, 386010, -63351, 25770, -166967, 254477, -66035, + -195421, 32749, -78920, -40265, 108448, 65498, 67109, 9127, 125628, 38118, + 40265, -86973, 84826, -9127, 20938, 54224, 77846, -72478, -5906, 48855, + -18790, -91268, 73551, 41339, -31139, 24696, 46171, 12885, 2684, 35970, + -10201, -11274, 35433, 11274, -71404, 28991, 45634, 5906, -22549, -11811, + 46171, -12348, 3758, -11274, 6979, 17180, + }, + { + 18790, 1343788, 275952, -154619, -32749, -116501, -88584, -9127, 41876, -79457, + -358093, -35970, -438087, 665720, 5822365, -530965, -71404, -615791, 175020, 504659, + -966905, 238908, 54224, 34360, -4295, 679679, 129386, -361314, -210990, -408559, + -256087, -207232, -148713, 249108, 229781, 266288, -54761, -89121, 71941, 161598, + -61740, 106300, 131533, -160524, 5369, 160524, 326954, -400506, -255551, 193810, + -34897, -41876, 27917, 119185, 97174, 64961, 150861, 28454, -132070, 78383, + -5906, 139050, 51003, 11274, -3758, -106300, 71941, 57445, 20401, -49929, + 34897, -5906, -40265, 43487, 10737, 9127, 83752, 47245, 6442, 21475, + -43487, -44560, -8590, -6442, 16106, -537, 33823, -8053, -20401, 46708, + -10737, -9127, -1074, -22549, 15032, -7516, + }, + { + 2664490, 2727841, -1145683, -46708, 238371, 244813, -384400, -481036, -156766, 565325, + -759672, -862215, -77309, -16106, 40265, -306553, 141197, -178241, 198105, -90731, + 68719, 99321, 148713, 63888, -278636, -168041, -31675, 174483, -158914, 33286, + 353798, -27380, -347892, -179315, -331249, 455267, 70867, 102542, 412854, 8053, + -161061, 256624, -249645, -537, -200253, 130997, 53687, 163209, -104153, -240518, + 255551, 73014, -245350, 227096, -100932, -81604, -57982, 20401, -48318, 28991, + -69793, -88047, 23085, -49392, -45634, 50466, 77309, 3221, -37044, 59056, + -53687, -21475, -537, 42413, 67646, -59056, -10737, -3221, 24159, 9664, + -31139, -11274, -22012, -16106, -57982, -19864, 69256, 32749, 16643, 26844, + -35433, -3758, -40802, 36507, 20938, -11274, + }, + { + 319438, 1429687, -370441, 228170, -119722, 1065152, 296890, -468151, -280784, 24696, + -71404, -106837, -929860, -241592, -1012539, -1611, -624381, 417149, 817654, 35970, + 44023, 188979, 973884, 386010, 355945, -187368, -406411, -191663, -280784, 95563, + -29528, -498216, 238908, 295816, -362925, 38118, 263604, 350577, 222265, -132070, + 88584, 7516, 48855, -241055, 120796, 172336, -62277, 88584, -166430, 157303, + 124017, 34360, -4832, -56908, -241592, -82141, 89657, 59056, 64961, 105764, + 1074, -51003, -120259, -74088, -66572, -72478, 92342, 85362, 112206, -42413, + 15032, -5369, -31675, 18254, 32212, -23085, -35970, -26844, -64961, -18254, + -28454, 8590, 27917, 15032, 11811, 2684, -15569, 6442, -17180, 31139, + 13422, 17717, 13422, 1611, 27380, 17717, + }, + { + 3811247, -599685, -3585761, 1341640, 531502, -521302, 3127273, -1218697, -258235, 250719, + -20401, -194884, -8053, 603443, -932545, -577136, 633508, 297427, -234613, 223875, + -925565, 161598, 382789, -147103, -19327, -173409, 28991, -543850, 278636, 13959, + 165893, -43487, -63351, -18254, 13422, -135828, 146029, 185757, 78383, 133144, + 305480, 143345, -316217, 59056, -294205, -12348, -102542, 103079, 64425, -178778, + 137439, -78920, 144955, -158377, -35970, -81068, -110595, 194884, -17717, -47782, + 44560, 67109, -73014, -78383, 25233, -23085, -31139, 3221, 9127, -22012, + -32749, 21475, 16643, 93416, -9127, 68719, -5906, -60130, 4295, 11274, + -44560, 41876, -32212, 27380, -1611, 52076, 6979, 5369, 2147, -29528, + 12885, -11274, -16643, -19327, 15032, 6979, + }, + { + -46171, -2405719, 331249, -170725, -76773, -1074, -256624, -171262, 307090, 1074, + -158914, -627065, 1214939, -2144263, -580357, -485868, 127238, 817118, 303332, -472446, + 76773, 568009, 165893, 2147, 326418, -378494, -646929, 263604, -636729, 918586, + 216896, -398358, 48855, -217970, -43487, -175557, -12348, 275952, 202400, 25770, + -152471, -68183, 118648, 49392, 40802, 76236, -63888, -59056, 7516, 146566, + -54224, -119185, 42413, 23085, -52076, -66035, -67646, -210990, -102005, -86973, + 61740, 5906, 5906, -84289, -46171, 95026, 18254, -1611, 74088, 32749, + 38118, 27917, 43487, 43487, -4832, 66572, 35433, -39192, 13422, -37581, + -3221, 31139, -45634, -28991, -4832, -33823, -12885, -4295, 4295, 11811, + 9127, 16106, 19864, -27917, -11811, 28454, + }, + { + 328565, -1108638, 885837, -490163, -576599, 1858110, 1069447, -600222, -291521, 1151051, + 477815, 34360, 647466, -518617, 949188, -523986, 47245, 764504, -402653, 553514, + 158377, -286689, 33286, 377957, 333934, 159451, -62277, 304943, 297427, -6442, + 16106, -162672, 261456, 200253, -88584, 187905, 324270, 39728, 340376, 3221, + -216359, -246961, 158377, -504659, -69256, -202400, 99858, -186831, 4295, -242666, + 90194, 105227, 33286, 274878, 28454, -25233, 160524, -84289, -66035, -33823, + 56371, -103079, 24696, -63888, -29528, -59593, -53687, 17180, 30065, 25770, + -48855, -67109, 62277, 28991, -4832, 6442, -61740, 76236, 8590, 30602, + -33286, -60666, -10201, 27917, 28454, -20401, -102005, -5369, 2684, -13422, + 1611, -5906, 63351, 14496, 21475, 24696, + }, + { + 217970, -778463, -420907, 194347, 106300, 209380, -1074, 260382, -74625, 73551, + -39728, 80531, -552977, -5865315, 5971615, -630286, 160524, -614717, 724776, 43487, + 1318018, 32749, 487479, -114890, -73551, -102005, 78920, 157303, 744103, -857383, + -486405, 129386, 519154, 160524, 37044, 172872, -46708, -169114, 347892, -123480, + -184684, 284005, -56908, 61740, -70867, -163209, -119185, 85899, 158377, -102005, + 171799, 75162, -89657, -104153, 86436, -172872, -11811, 15032, -23622, -52613, + 132607, 86436, -96637, 51540, 78383, -58519, -33823, 138513, 537, 77309, + 37581, -87510, -41876, 28454, 12348, 18790, -69256, 4295, -1611, 4832, + 67646, 16106, -19864, 7516, -53150, -19864, -45634, 44023, 537, -3221, + 54224, 39192, -38655, -12348, 20938, -33286, + }, + { + -1168768, -909459, -692564, 1855426, 388695, 1991254, -352187, 128312, 135828, -79994, + 1067299, 562104, -155693, 775242, -1569274, 545461, 795643, -619549, 616328, 737661, + -303332, -61740, -230318, 212064, 34360, 50466, -551366, 40802, 173946, -233539, + 4832, 220654, -14496, -77309, -604517, 289373, -265214, -42950, 191126, 30602, + 143881, -198642, -51540, 146029, 51003, -209380, -375273, 143881, 127775, 97711, + 14496, 141734, 111669, -118648, 20401, -20938, -214212, 130460, -70330, 7516, + -10201, -170725, -32212, -60666, -31675, -69793, 12348, -8590, -31139, -22012, + 30602, -81604, -4832, 86436, 10201, -44560, -51540, 3221, 4295, -32212, + -1611, 35970, 4295, 3221, 33286, 55298, 8590, 46171, 0, -39192, + -8053, -11274, 537, 16643, 4832, 5906, + }, + }, + { + { + 367220, 2853469, -381178, 243739, 260919, -59056, 52076, -74625, -199179, 56908, + -304943, 243203, -826244, 598611, -1324461, -265214, -39728, 337155, -230854, 43487, + 914828, -306553, -573915, -980326, -185220, -319975, 91805, -115427, 52613, 11811, + -409096, -477278, 39192, 247497, -101469, 197032, 279173, 332860, 394600, -12348, + -28991, 79457, -122943, 163746, -32749, 44023, 193810, 383863, 105227, 100395, + 62277, 45634, 89657, 100395, -187368, 52076, 62814, -24696, 142271, 67646, + -58519, -169114, -93416, 63888, -12885, 13959, -74088, 15569, -1611, -141734, + 34360, 40802, 63888, -3758, 2684, 2147, 34360, 48855, -17180, -18254, + 64425, 1074, -42413, -67109, -59593, 17180, 35433, -10201, -1074, 15032, + 27917, -27380, 16643, -10737, 12348, 26844, + }, + { + 3451006, 27208618, 172872, 1452236, 670552, 7516, -102005, 740345, 408559, 171799, + 312996, 66572, -27917, -52613, -365072, -70867, 719407, -122943, -501437, 642635, + 60130, 454730, -158914, 6979, -143345, -314606, -285615, -142271, -166967, -130460, + 25233, 120259, 55298, 213138, -98247, -268435, 89121, -99321, 274878, 17180, + -57445, -243739, -417149, 227633, -281857, -63351, 16106, -45097, 177167, 79994, + 94489, -102542, -207769, -184147, -143881, -142808, -64425, -53687, 24159, 112206, + -145492, -143881, 11811, -19864, 58519, 122407, 16643, -15032, -109522, -57445, + 2684, -4295, 38118, -28454, -9127, 66035, -47245, 28454, 74625, 24159, + -40802, -32212, 10201, -28991, -51003, -10737, 69793, -29528, 16106, -4295, + 537, -6442, -8053, -11811, 5906, -13959, + }, + { + -91268, 8763344, 3548180, -581431, -1065152, -52613, -188979, -283468, -128312, 49929, + 284542, -27380, 285615, 596464, 1275068, 93952, 61740, -56371, 256087, -275415, + 89657, 353261, 17180, 458488, 323733, 37581, -163746, 207769, -33823, 281857, + 196495, 167504, -36507, -43487, 265214, 87510, 9664, -54761, 124017, 59593, + 243739, -413391, 67109, 57982, -299574, 136365, 178778, -120796, -27917, -69256, + 127775, 112743, 62814, -3221, -84289, 106300, 37044, -186294, 43487, -16106, + -6442, -24159, -122943, -11811, -30065, -91268, 16643, 12885, 47245, -23085, + 12348, -23085, 1611, -81604, 13422, -13959, -13422, -4295, -35433, 59056, + 18254, 19864, -4832, -35433, 37581, -5369, -14496, 15569, 11274, 11811, + 27917, -29528, -537, -14496, -3758, -6442, + }, + { + -502511, 47245, 1054415, -186831, -154082, 174483, 75699, 5369, -163746, 79457, + 3221, 212601, 213675, -362925, 1498944, 70330, 18254, 274878, 1005022, 48318, + 137439, 222801, -226023, -18254, -228170, 24696, -550293, -334471, 301721, 833224, + 28991, -615791, 266288, -223338, 219043, 100395, -245887, 343061, -37581, -198642, + 186831, -14496, 95026, 107374, 30065, 89121, -35433, 12348, 13959, -90731, + -138513, 148713, -127238, -12885, 31139, -105227, 55835, 113280, -66035, 69793, + 78920, -18790, -2147, 89121, -75162, -57982, 16643, 14496, -55835, -47782, + 30602, 69256, 30602, -4832, 4295, 53150, 11274, -71404, -59056, -1611, + -9127, -6979, -24159, 20938, -8053, 26844, 22549, -10201, -30602, -8590, + 8590, -5906, -53687, -17717, 0, -20938, + }, + { + -2298881, -3995393, 1898376, -341987, 37581, -119722, -118112, 110595, 280784, 140123, + 511638, -382252, 110059, 274878, -541703, -220654, -379031, 73014, 210990, 120259, + 144418, -263604, -275952, 302258, 518617, -103079, 72478, 821413, 459025, 209380, + 237834, 175020, 308164, 173946, -81604, 175557, 176631, 687195, 126702, 216359, + 121333, -186831, -231391, 130460, 127775, -194884, 37044, 199179, -18254, -23085, + 242666, -215285, 52076, 80531, -22549, -55835, -34360, 85899, 48855, 32749, + -64425, -13959, 2684, -50466, 16643, -24159, -63888, 90731, -23622, -48318, + -38655, 20401, 137439, 60130, -66035, 22012, -5369, -48855, 28991, 8053, + -4832, 7516, -17180, -13422, 53687, 11811, -24159, -10737, -5369, 7516, + 1074, 18254, -2684, 23085, 13959, -6979, + }, + { + 403727, 1071058, -1407139, 398358, 91805, 76236, 70867, -70330, -4832, -176631, + 28991, 161598, 93952, 1238561, 3642669, -289373, -244276, -398358, 60130, 759136, + 305480, 252329, 806917, 719944, 923418, 1209570, -63351, -110059, 59056, 126702, + -615254, -34897, -195421, 20401, 63888, -154619, -16106, -255014, -49929, -45097, + 75162, -19864, 83752, 121333, 75699, -172872, 92879, 127775, 45634, 153545, + -78383, -52613, 38118, -98247, -70867, -162672, 53687, -20938, 28991, 29528, + -8053, 51540, -97174, -33823, -62277, -33823, 56371, 76773, 62814, 62814, + 47245, -98784, -74088, -1611, 29528, -39728, -66572, -48318, -49392, 9664, + 42950, -40265, 39192, 46171, 24696, -18790, -4295, 16106, -3221, -15032, + 8590, 53687, -11811, -40802, -13959, 1074, + }, + { + -2078764, 14590004, -217970, -719944, -19864, -47245, -53150, -448824, 9664, 279710, + -225486, -246424, -102542, 311922, -1162326, -1028108, -152471, -448824, -46171, 581968, + 318364, 114890, -47782, -31139, -10737, 59056, -213138, 221728, 273267, 205622, + 10201, -53150, -37581, 126702, 47245, 162135, 8590, 498753, -12885, -172872, + -86973, 147640, 131533, 285615, 53687, 211527, 112743, 157840, 139586, -38118, + -23085, 132070, 105764, -123480, 74088, -71404, -64961, 0, -87510, -66572, + -84289, -34897, 50466, 52076, 45097, 5906, -106837, -34897, 62277, -9664, + 9664, 88584, -27380, -118648, 23622, 70330, -7516, 4295, 41339, -26307, + -46708, 38118, -11274, -37581, 30602, 40265, -49392, -19327, 18254, 33286, + -1611, -34897, 24696, 9664, 42413, 15569, + }, + { + 359167, 267362, -1090922, 80531, -193274, 108448, -35433, -76773, -26307, -170188, + -65498, 347355, 193810, -1017907, 6134824, -147640, 897648, 397284, -24696, 673236, + 809601, 467615, -409096, 690953, 848793, 721555, 212064, -126702, 79994, -468151, + 326418, 105764, -71404, 315680, 407485, 170188, -15032, -111132, 126165, -193810, + 12885, 111669, 52613, 34360, 76773, 140660, -120259, -266825, 86973, 68719, + -232465, 5906, 12348, -56908, -102005, 66035, 18254, -199179, 95026, 78920, + -30065, 28991, -134755, 70330, -44023, 87510, 62814, -45097, -5906, -11274, + -14496, 10737, 14496, 14496, -41339, 16106, 16643, -27380, -23085, -34897, + -47245, 42950, 41876, 33823, -10201, -22012, -3221, -28991, 24696, -17180, + -20938, 11274, -10201, -4832, 13422, 537, + }, + { + -5059472, 10974178, 1224603, 874026, -642635, -151398, -590558, 33286, 278636, -433792, + -477815, 279710, 799401, 398895, -343597, -453656, -638340, 48855, 144418, 290984, + -93416, 164819, 375273, -259846, -33286, -390305, -60666, 73014, -271120, -10201, + 66572, -339302, -110059, -97711, -207232, 100932, 597537, 545998, -521302, -324270, + 113280, -90731, -172336, -10737, -330712, -126165, 38118, -105227, -45097, 67646, + -12348, -86436, -56371, -41339, 44560, -16643, 34360, -144418, 20938, 64425, + -29528, -30065, 3758, -53687, 163746, 198642, -1611, -42413, 41339, -25233, + -2684, 20401, -24159, -9664, -35970, 1074, 73551, -48855, 24159, 4295, + -3221, -21475, 54761, -3221, 35433, 24696, 37581, -16643, -23622, -34360, + 6442, 4295, 10737, 16643, -26844, 11274, + }, + { + -370441, 942745, 761820, -157840, 520228, -300111, -255551, 60130, -44023, -543313, + -97711, 311922, -179315, -475668, -1211718, -598611, -213138, 714038, -461172, -826781, + 463320, 617938, 898185, -303332, -166430, -357556, 10737, -541703, -399969, 88584, + -57445, 156766, -327491, -122407, -60666, -34360, 4832, -380641, -105764, 15032, + -119722, -130460, -190589, 36507, -24159, -216359, 24159, 27380, 46708, 13422, + -171262, -65498, -27917, -203474, 119185, 132607, 15569, 28454, -16643, -72478, + -32749, 26844, 5906, 106837, 15569, 54761, 17180, -49392, -108448, -102542, + 30065, -12885, 39192, 35433, -8590, 23622, 33823, 2147, -10201, 37044, + 33286, 22549, -24159, -13959, -23622, -39192, 14496, 9664, 9664, 3758, + -15032, 12348, -8590, 0, -28454, -23622, + }, + { + -3007551, 5087926, 2579665, -261993, 482110, 440234, -1634772, 319438, 530428, 5906, + -277562, -13422, -78920, -163209, -406948, -31139, -85362, -312996, -152471, -190589, + -417686, 79457, 6442, -266288, -98247, -15569, 9664, -223875, 95026, -106300, + -319438, -229781, 148713, 221728, -242129, 119722, 268972, -143881, 186831, 126702, + -314606, -192200, 34897, -82678, 124554, -93952, -196495, -31675, -100395, 48855, + -112743, -61740, -81604, -86973, 92342, 104690, 76236, -48318, -151934, 53150, + 65498, -34360, 9664, 92879, -34360, -27917, -9127, 37044, 28454, -31675, + 2684, 48855, -16643, -42413, -37581, -15569, -56908, 30065, 15569, 5369, + 22549, -33286, 13422, 37581, -48855, 17717, -48855, -21475, -27380, 21475, + -2147, -23085, 3221, 37044, -2147, -30065, + }, + { + 126702, -1598802, -409633, -253940, -173946, -241055, 345208, 78920, -99321, 162672, + -351114, -83215, -679142, -1482301, 294742, 904628, -350040, -448287, -324270, -328028, + 500901, 918049, -358093, -657130, -396211, -81604, -399969, -1074, 92342, 9664, + 8590, 452582, -160524, 332860, -494458, 81068, 201863, -110059, -250719, -19327, + 35433, 72478, 86973, -231928, -17180, 78920, 98247, -121870, -90731, -57982, + -195958, 89657, 35970, -130997, -91268, -13422, 106300, 128849, 90731, 28991, + 67109, -97711, 5369, 104153, 137439, -20938, -34360, 60130, 34360, 22549, + -12348, 19864, 17717, -14496, -1074, -62277, -74625, -5906, -1611, 7516, + 14496, -13422, 47245, 34897, 14496, 23622, 45097, 44023, 9664, 5369, + -3758, -21475, -13422, 13422, 2684, -11811, + }, + { + -243203, 1198833, -637266, -1809255, -24696, 682900, -1057636, 231391, 41876, 960462, + -241055, -36507, 374736, 297427, 572841, 530428, 480499, -40265, 75162, -374199, + -432181, 108985, -154619, 428423, 287763, 65498, -277562, -40802, -24159, -159988, + -227096, -120259, 119185, 111132, 236223, -70867, 112743, 330176, 51540, -134218, + 180389, -18254, 253940, -122943, 285615, 146029, 163746, 153545, 148713, -165893, + -1074, -75699, -100395, 117038, -264677, -62814, 22549, 2684, 120796, 6979, + -90194, -42413, 13422, -95026, -81068, -20401, 49392, 101469, 18790, -117038, + 40265, 63351, -15569, -53150, 3221, -5369, 12885, 11274, -6979, -31675, + -45097, 52613, 26307, -537, -60666, -19327, 53150, 44560, 15569, 49392, + 18254, 11274, 537, -39728, -10201, -52613, + }, + { + -343597, 160524, 293132, -122943, 61203, -256087, -6442, 63888, -171262, 190052, + 61740, -76236, 288837, -227633, -7684234, 413391, -543850, -260382, 315143, 1084479, + -56908, 154619, 303869, -632971, -193810, -300111, -415538, 610959, -485868, -479963, + -41876, 507343, 699543, 442919, 44023, 466541, 167504, 90731, 209380, 11811, + 61740, -83752, -132070, -86973, -32212, -29528, 31139, -250719, -51540, -5906, + -45634, -74625, -49929, 107374, 35970, -28454, 27917, 18254, -55835, -8053, + -54761, -157303, 42950, 27917, 32212, -48318, 92879, -26844, 2147, 37581, + 11811, 57445, -17180, -44023, 32212, -26844, 15569, 81604, -16643, 13422, + -68719, -44023, 44560, 13422, 13959, 45634, 38118, -14496, -27917, 42413, + -17717, -51540, -9664, 22012, -29528, -20938, + }, + { + 287226, -2586644, 957778, 1127429, 424665, -1413044, 461172, 231928, -268435, 238908, + 1436667, -602369, -306016, -756451, 1198833, -525597, -231928, 175557, 140123, 11811, + 844498, 226560, -318364, -282931, 299037, 424665, 333934, 29528, -638876, -310848, + 20401, 26307, 57445, 204011, -137439, 194884, 32212, 56371, 5369, -118112, + -52613, -336081, 57445, 142808, 139586, -46708, 190589, 18254, 67646, -217970, + 290984, -51540, -225486, -94489, -98247, -124554, -8053, 69256, 17180, 47782, + -81604, -18254, 18790, 95026, -41339, -20401, 49392, -7516, -20938, 10737, + 10201, 84289, 32212, -48855, -122407, 0, 32212, 5369, -32212, 8053, + 48318, 2684, -34360, 28991, 12885, -537, 18790, -42413, -38118, 41339, + -13959, 25770, 28454, 17717, -11274, -24159, + }, + }, + { + { + 197569, 3074660, 164819, 862215, 82678, -140660, -11811, -109522, -46171, -121870, + -162672, 154082, -91268, 1309965, -1287953, 490163, 623844, 146566, -428423, -337155, + 441308, -865436, 64961, -288300, 148176, -131533, 177167, -93952, 130997, 200790, + -78383, -485868, -18254, 277025, 167504, 256624, 90731, 396211, 337155, 37044, + -41339, -48318, -34360, -115427, -130997, 20401, 48318, 201327, 59593, 1074, + -51003, -53150, 31675, -41876, -148176, 83752, 68183, 68719, 29528, 13422, + -26844, -210990, -20401, 66572, -89657, -42950, -10201, 10737, -61740, -49392, + 49392, -4832, 37044, -12348, 3758, 22549, 15569, 13959, -24696, 0, + 41339, -35433, -61203, -42413, -24696, 55298, 22012, -5369, 15032, 34360, + -15032, 2147, 3758, -1074, 33286, 17717, + }, + { + -3001109, 26287884, 5603322, 1927367, 780610, -252866, -399432, 535260, -121870, -216359, + 132070, -130997, 191126, 311922, -162135, 124017, 397821, -115964, -658204, 136365, + -252329, 598611, -68719, -204011, -97711, 79994, 81068, 51003, -14496, -85899, + 144955, -227096, -54224, 275415, 149250, -111669, 141734, 72478, 270583, -41339, + -174483, -12348, -129923, 207232, -369904, 121333, 75162, 120796, 15569, -13959, + 157840, -180926, -246961, -28454, 31675, -14496, -143345, -70330, -15569, -537, + -144418, -30065, 38118, -5369, 122943, 56908, -4295, -35433, -90731, 38118, + -1611, 25770, 23085, -9664, 83215, 2684, -38118, 37581, 51540, 1074, + -38118, 3221, -3221, -48855, -23622, 50466, -11274, -20938, 4832, 0, + 20401, -8053, -25233, 9127, -6979, 1074, + }, + { + -85899, 4955856, -624918, -2258079, -1054415, 85362, -180389, 204011, 240518, 273804, + 26307, -144418, 105227, 105764, 703838, 48318, -53687, -16106, 567473, 216896, + 397821, -4832, -220117, 85899, -245350, -350577, -68183, 269509, 154619, 341450, + -17180, -56371, -110059, 81604, 406411, 43487, 51003, -71404, 178241, 61740, + 6979, -347892, 82141, -130997, -215285, 248571, 192737, -90194, -27380, -22549, + 176094, -21475, -107374, -30602, -19864, -59056, -130460, -85362, 149787, 48855, + -103079, -86436, -106300, 52076, -1074, -33286, -19864, 13422, -1611, -41876, + 2684, -13959, 6979, -84289, 19864, -11274, 31139, 3758, 18254, 54224, + -12348, -23085, -40802, -13959, 39728, -12348, 17717, 3221, 5906, 44023, + -1074, -27380, -13422, 6442, 10201, 537, + }, + { + 387621, -474594, -776315, -417686, 58519, 140123, -75162, 53687, 15032, 81604, + 24696, 189515, -15569, -1341640, 282394, 425202, 1551020, 571231, 1609002, 273267, + 154619, -504122, -19327, 455267, -1030255, 511638, 272194, -116501, -341987, 54761, + 303332, -433255, 17180, -388158, 287226, 65498, -217970, 157840, -112206, -130460, + 30065, -70330, 16106, 118648, 43487, -125091, -11811, 10201, -168577, -13959, + 134755, 10201, -103079, 100395, 16106, 14496, 99321, -2147, -22012, 41876, + 16106, -82141, -9664, 17180, -86973, -68183, -5906, 2147, -28991, -10737, + 107374, 28991, -9664, -60130, 42413, -10737, -66035, -60130, -12885, 24159, + -537, -40265, -11274, -5369, -3758, 24159, 2147, -8053, -31675, 18790, + 10201, -39728, -51003, -3221, -19327, -21475, + }, + { + 3398393, 7559143, 3941169, -329639, -193274, 42413, 116501, 45097, 166967, 178241, + -18790, -242129, -377420, 341987, -29528, -237297, 44023, 360240, 75699, 268435, + 105227, -331249, -79457, 428960, 64961, -3221, 47782, 755377, 144955, -104690, + 16643, 17717, -70330, -107374, -311385, 82678, 294205, 113280, -82678, 132607, + 224412, 99858, -99858, 212601, 206695, -288300, -107374, 63351, -176094, -85899, + 113817, -226023, 91805, -8053, -33286, 15032, 126702, 116501, 6442, -16106, + -58519, -41339, -52076, -33286, 16643, -56908, -85899, 9127, -75699, 9127, + 16106, 36507, 113817, -53150, -64425, 16106, -60666, 3758, 4832, -24696, + -13422, -7516, -23622, 13959, 30602, 9664, -7516, 2147, 27917, 13422, + 2147, 18790, 12348, 40265, -15569, -8590, + }, + { + 26307, -318901, -1152125, 249645, 76773, 37044, -86973, -74088, 66572, -5906, + 210990, 132070, -6442, 867583, 1785633, -158914, 845572, -686658, -264677, 1134945, + 329639, 119185, -316754, -445603, 184147, -67109, -872415, -549219, 134755, 1034013, + -392453, 107911, -43487, -301721, -156229, 160524, -10201, -364535, 133681, 75162, + -231391, 28454, 48855, 20938, 44560, -186831, 50466, 121870, 51003, 143345, + -98784, -11811, 91268, 20401, -12885, -147103, 46708, -67109, 44023, 55298, + 14496, 23085, 11811, 30602, -30602, -10737, -15032, 61203, 39192, 42413, + -17180, -53687, -10737, 10737, -28454, -33286, -51003, -48855, -30065, 15569, + -1074, -17180, 28454, 25770, -3221, -20401, -1611, 4295, -11811, -2684, + 34897, 13422, -49392, -24159, -13422, 12348, + }, + { + -111132, 18709952, 409633, -107374, 5906, -26307, -75699, -34897, 201863, 192737, + -95563, 82678, -16106, 755377, -815507, -431107, 158914, -257161, 198642, 452045, + 288300, -181999, 4295, -79457, -66572, 165356, -406411, 100932, -190052, 200253, + 39728, -162672, -16643, 5369, 84289, -102542, -108985, 409096, 46708, -208306, + -81068, 296890, 12885, -32749, -83752, 98784, 218506, 80531, -2684, 3758, + 17180, 115427, 17717, -59056, -54761, -176094, -42413, 30602, -119185, -59056, + -48855, -46708, 6442, 9664, -26844, -48855, -69793, 59593, 28991, -55835, + 42413, 67646, -60130, -45097, 37044, 27380, -43487, 17180, 20401, -37044, + 2684, 22012, -21475, -23622, 64961, -25233, -35970, 8053, 31675, 13959, + -37044, 6979, 0, -1074, 21475, 0, + }, + { + 17717, -1398012, -271120, 422517, -68719, 117575, -31139, -40802, -12885, 1611, + 199716, 168041, 441308, -893353, 5341866, -329102, 631897, -329639, -38118, 10201, + 166430, -126702, -301185, 727997, 705985, 653909, -154619, 223875, 438624, -60666, + 512175, 179852, -263067, 223875, -23622, -27380, 23085, 6442, -31139, -200790, + 6979, 9127, -95026, 37581, -3758, -67109, -186831, 57445, 200253, -3758, + -194884, -116501, 60666, -171262, -113817, -2684, -76236, -131533, 102005, -113280, + -82678, -22549, -87510, 63351, 0, 106300, -49929, -99858, -29528, 9127, + -56908, -6979, 30065, -16643, -39192, 23622, -47245, -8053, 7516, -12348, + 37044, 40265, 17180, 5906, -31139, -2684, -31675, 5906, 23085, -40265, + 20938, -8053, 2147, 13959, 3221, 6442, + }, + { + 6286759, 21864604, -4219806, 1030792, 41876, -70330, -362925, 518080, 51540, -545998, + 284005, 759136, 219580, 389768, 941135, -253403, -280247, 149250, -262530, 163746, + 124554, 319438, 314606, 149787, 295816, -233539, 130997, 168041, -449898, -155693, + -98247, -122943, 154619, -23622, -28454, -118112, 69793, 314606, -281857, -192737, + 43487, 67109, -62814, -120796, -161061, -238908, 537, 86436, 64425, 19864, + -185220, -20938, -4295, -154619, 54761, 76236, 8590, -95563, 115964, 80531, + 2147, 34897, 35433, 6979, 166967, 31139, -93416, -17717, -2684, -55298, + 38118, 6979, -88584, -20938, -75699, 45634, 26307, -56371, 15032, 24159, + -11274, -15032, 56371, 39192, 42950, 33286, -9664, -38655, -13422, -7516, + 33286, 5906, 28454, -21475, -8053, 17180, + }, + { + 235149, 358630, -498216, 502511, 363462, -857383, -1611, 95563, 173409, -212064, + 184147, 750546, 79994, -144418, -360240, 183073, -246961, -270046, -598611, 59593, + 390305, -554588, 260382, -272194, 298500, 8053, 270583, -57445, 184147, 253403, + 222801, -26307, -467615, -170188, 51003, -118648, -264677, -404264, -47782, -137976, + -182536, -25770, -32749, 103079, -198642, -144955, -98784, 54224, 25233, -107911, + -146029, -75162, -63351, -2147, 298500, 28991, -93416, 6979, -67109, -23085, + 13959, 19864, 78383, 73014, 55298, 49929, -84826, -74088, -86436, 3758, + 2684, 25233, 86436, -13959, -33823, 15569, 53687, 11811, 23085, 47245, + 6979, -537, -41339, -8053, -37044, -16643, 28991, -11811, 14496, -27917, + -4832, -14496, -9664, 1074, -34897, -10201, + }, + { + 1824824, 10372883, 310311, -2389613, -158914, 426812, -1095754, 539555, 330176, -186831, + -122943, 102542, -69256, -32749, 213138, 89657, -158914, -112743, 58519, -431644, + 41339, -167504, -193810, -370441, 177167, 143881, 109522, -126702, -128312, 66035, + -99858, -97711, -38655, -80531, -322123, 124554, 53150, -151934, 270583, -177704, + -403727, -8590, 108448, -70867, 85362, -52076, -104153, -57445, -121870, 141197, + -57982, -4832, -57982, -15569, 35433, 117575, 111132, -177167, -53150, 54224, + 15032, -47245, 42950, 97174, -75162, 9664, -3221, 34897, -13959, 7516, + 23622, 26844, -29528, -61740, -5369, -23085, -26844, 59593, -31675, 10737, + 12348, -27917, 40265, -24159, -26307, -39192, -23085, -16106, -15032, 25233, + -18254, -1611, 18790, 20938, -25233, -15569, + }, + { + -200253, -1605244, 129923, 304406, -50466, -15032, 476205, -105764, -539555, -23085, + -93952, 136902, -102542, -175557, 535797, 734976, -689342, -1242856, -359704, -626528, + 335007, 889595, -618475, -628139, 0, -129923, -129386, -223875, -152471, -766115, + 335544, 272730, -99321, 277025, -395137, -5369, 157840, -350577, -93952, 24159, + 153545, 35970, -51003, -149787, 49392, 59593, 193274, -67646, -15032, -114890, + -111669, 100395, -25233, -49929, 1611, -537, 159451, 194347, 5369, 47782, + -24696, -1074, 45097, 150861, 76773, -111669, 27380, -22012, 4832, -2684, + -39728, 28454, -14496, -25770, 22549, -61203, -63888, 19864, -9127, 41876, + 11811, -23085, 42950, 27380, -1611, 39728, 37044, 16643, -9127, 1074, + -3758, -24159, -21475, 29528, 7516, -25233, + }, + { + -828929, 1702418, 215285, -347892, 163746, -1178432, -1590749, 863825, 154082, -23622, + -546535, 41876, -207769, -181462, 115427, 223338, 82141, -261993, 154619, -654446, + 92879, 286152, -155156, -22012, -111669, -188442, -105764, -31675, -60130, -111132, + -190589, 52076, -139050, -306553, -35433, -205622, -109522, 46708, -139050, -92879, + 360777, 164819, 303332, 119722, 139050, 277562, -34897, 134218, 89121, -3758, + -96100, -97711, -86436, -54761, -101469, -26844, 52076, 42413, 109522, -69256, + -32749, 25233, 10737, -96637, 28991, 57982, 46708, 63351, -46708, -93416, + 115964, 68183, -77309, -49392, 9127, 4295, 15032, -42950, -19864, -26844, + 33286, 70330, -1074, -16643, -34360, 45097, 73551, 16643, -2684, 28991, + -3221, -1611, -38118, -21475, -17180, -39192, + }, + { + 170188, 1130113, 219580, 51540, -102005, -193274, -26307, -126702, -225486, 348966, + 96637, -89121, 287763, 1878511, -3661460, 1582696, -1401233, 47245, -6979, -152471, + -674310, -214748, 112743, -245350, -197569, -694711, -492848, -7516, -276489, 326954, + 215285, 266825, 78383, -44560, 53150, 122943, 47782, 45634, 8053, 156766, + -4295, -140123, -115427, -15569, 97711, 101469, 44023, -137976, -144418, -1611, + -160524, -7516, 39728, 78383, 5369, 50466, 37044, 10201, -81604, 37044, + -165356, -116501, 23622, -38655, -20938, 52613, 79994, -67646, -2147, 8590, + -17717, 74625, 19327, -30602, 8053, -40802, 72478, -19327, 21475, 537, + -106837, 11274, 31139, 11811, 44023, 41339, 32749, -48855, 1074, 14496, + -54224, -26307, 32749, 14496, -24696, 18254, + }, + { + 278636, -1850057, 1111860, -488553, -710817, -2444373, 233539, 263604, -79994, 371515, + 107374, -1091995, 173946, -557809, 450972, -705985, -42950, 88047, -373125, -105227, + 827855, 57445, -20938, -389768, 362925, 363462, 213675, 517544, -237297, -80531, + -12348, -148176, 3221, 171799, 123480, 213675, 184684, 44560, -105227, -69793, + 53687, -42413, 178241, -82141, -38118, 189515, 333934, -102542, -44560, -61740, + 301185, -30602, -135828, 75699, -139586, -34897, 83215, -47245, 71941, 76236, + -11811, 84289, 13422, 110059, -6979, 19864, 42413, 57445, -17180, 2684, + -10737, 71404, 1074, -58519, -65498, 41339, 31675, -17717, -22549, 30602, + 0, -23085, -4832, 21475, -3221, -32749, 15032, -75699, -2684, 33823, + -22549, 33823, 8590, -1611, -3221, -8053, + }, + }, + { + { + -333397, 5885179, 84826, 603443, -239444, -40265, -204548, 121870, -74625, 35433, + 13959, -122943, 1030792, -134755, -732292, 466004, 275415, 105764, 802622, -610422, + 159451, -99858, 770410, 450435, -23085, 16106, -91805, -135291, 350577, 530428, + 58519, -267899, 227096, -337155, 54224, 82678, 86973, 76236, -139050, -256624, + 99321, -46708, 54224, -268972, 76773, -93952, -82678, -113280, 52076, -43487, + 9127, 36507, -15569, 21475, 111669, -75162, -77309, -90731, -33286, 28454, + 61740, 4295, 90194, -1611, -52613, 38118, 4295, -19864, -3221, 88584, + -22012, -28991, -22012, -9664, 15569, 21475, -25770, -1074, 35433, 26844, + -25233, -11811, 37581, 56908, 28991, 2684, -17717, 13422, 8590, -24159, + -24696, 33286, -6442, 12348, -18254, -24159, + }, + { + 3427921, 24433532, 891743, 37581, -250182, -10201, -381715, -996432, -682363, 4295, + -31139, -166967, 400506, 306016, -474594, -659814, -246961, -149250, 354872, -419296, + -374736, 379568, -128849, -316754, 3758, 360777, -408022, -49929, 149250, 83215, + 326418, -144955, -207232, -135291, 164819, 174483, 61740, 91268, -204548, -272730, + -165356, 149250, 163209, 23085, -4295, -15032, -53150, -23085, -335544, 151934, + 70330, -101469, 48318, 156766, 31139, -8053, -66035, 53150, -31139, -43487, + 82141, 26844, 31675, 54224, -5369, -71404, -32212, 39192, 8590, 55298, + -11274, -28991, -26844, 24696, 4832, -50466, 39192, -25770, -33286, -6442, + 41876, -1074, -35970, -1074, 62814, -23622, -54761, 37044, -14496, 9127, + -12348, -537, 12885, 11811, -5369, 3758, + }, + { + 114890, 4708895, -2248416, -1087701, 1323387, -85899, 193810, 302258, 82678, -167504, + -387621, -150861, -528281, 44023, 326954, 238371, -284542, 293668, 313533, 86436, + 138513, -297427, -42413, -143345, -359704, -34897, 133681, 292058, -6979, 19864, + -98784, 74088, 251256, -13959, 191126, 10737, -19327, -55298, 273804, -35433, + -259309, 71941, 30065, 40802, 91268, -156229, -184147, 227096, 140123, 215285, + -54761, -183610, -129923, 49929, -47245, -74088, -10201, 106837, 115427, 3758, + -57445, 71404, 88584, 23085, 41339, 45634, 11811, 27380, 6979, 49392, + 22012, -25770, 35970, 2684, -3758, -10201, 45097, -19327, -1074, -28991, + -3221, -22549, 25233, 10201, -51540, -13422, -6442, -26844, 1611, 2684, + 537, 23085, 13959, 26844, 2147, 6442, + }, + { + -255551, -1664300, 100932, 132607, 132607, -41339, -53687, -1074, 84289, 61740, + 53150, -53150, -456340, -1023276, -1258425, 1705102, 532039, 474057, 1008780, 134218, + 237834, -1097901, 126165, 398895, -296890, -170725, 96100, 520228, -399432, -674310, + -121870, 590021, 31139, -443992, -140123, 129923, 122407, -233002, 157303, -25770, + -101469, 46708, 4832, -31139, -113817, -5369, 60130, -9664, -32212, 131533, + 74625, -92879, 125091, 40802, 123480, 113817, -66572, -30602, 89657, -85362, + -62814, -57445, -3221, -38655, 55835, -2147, 6979, -42950, 75699, 36507, + -30065, -92879, -41339, 27917, 27380, -62277, 27380, 59056, 27380, -6442, + -6979, -1074, 17180, -5369, 8590, -34897, -17717, 16106, 37581, 15569, + -4832, -9127, 28454, 20401, -11811, 17717, + }, + { + -2121714, 19828254, -1302986, -256087, 264141, 1611, 424128, 25770, -207769, -137439, + 4832, 502511, -358093, -129923, 214748, -89121, 100932, 191126, -150324, 219580, + -211527, -195421, 446677, -441845, -266825, 223338, 267899, -119722, 110059, -135291, + 96100, 155693, -315680, -117575, -190052, -42413, -398895, -530428, 171799, 101469, + -51003, 121333, 86973, 265214, -198642, -63351, 2684, 9664, -35970, -98784, + 36507, 152471, 43487, -106300, -49929, 94489, 78383, -129923, -76236, -61740, + 1074, -100395, -33823, -7516, 9664, -71941, -42413, -107911, -37044, 79994, + 12885, -94489, -62277, -73551, 46171, -5369, 9664, 75699, -57445, -1074, + 28454, 17717, 14496, 11274, -62277, 9664, 12348, -4295, -17180, -18254, + 4295, -22549, 537, -15569, -25770, 7516, + }, + { + -290984, 283468, 363998, -121333, -71941, -56908, -41876, -41876, 195421, 115964, + 80531, -81604, -118648, -271657, -580894, -19327, 1319629, -201863, 239981, 821949, + 569083, 368830, -379568, -350577, -957241, -864362, -542777, -693637, -84289, 1226750, + -289373, -90731, -68719, 8590, 122407, 208306, 199179, -130997, 269509, -69256, + -67646, 77309, -71404, 113280, 66572, -17717, -1074, -59056, -60666, -15569, + 24696, 129386, -41876, 62277, 27380, 65498, -74088, -78383, 17717, 9127, + 16643, -43487, 97711, 18790, 9127, 17717, -88584, 6979, 26844, -38655, + -40802, 113817, 12885, -23085, 1611, 27917, 66572, 38118, 32212, -32749, + -8053, 42413, -33286, -24159, -14496, 10201, -5369, -4832, -537, 16106, + -1074, -49392, 5906, 28454, -2147, -3221, + }, + { + 3594888, 13654238, 179315, 402116, -478352, 92342, -43487, 403727, 82678, -131533, + -29528, 240518, -19864, 424128, -401579, 250719, -52613, 162672, 93416, -267362, + -78383, -122943, -17717, -191126, -69256, -57982, -181462, 256624, -561567, -196495, + 120259, -109522, 206158, 89121, 262530, -149250, 42413, 48855, 18790, 5369, + -54761, 170725, -64961, -198642, 114890, -90194, -46171, -197032, 52076, -38655, + -8590, -81604, -53687, 76773, -191126, 26844, 52076, 48855, 81068, 65498, + -3758, -19327, -11274, -33286, -62814, 28991, 87510, 54224, -61740, -2147, + -2147, -102005, 53150, 114354, 9127, -55298, 3758, 32212, -7516, 22012, + 36507, -22012, 27380, 31139, -42413, -43487, 53687, 27380, -5369, -27380, + 7516, 35433, -36507, -12885, -19864, 3758, + }, + { + -340376, -319975, 1202591, 184684, 115427, -96637, 1074, -148176, 98247, 145492, + -44560, -190589, -387621, -135828, 3502546, 872415, -654446, -740345, 30602, -1070521, + -610959, -181999, -146029, -202400, 883153, -64961, -595390, 448287, 96637, 137439, + -68183, -108985, -227633, 158377, -373662, 190052, -32212, 154619, -63351, 26307, + -39728, -39728, -6442, -162135, -105764, 3758, 135291, 26844, -173409, 88584, + 91805, -140123, -11811, -26844, 107911, 8053, 26307, 122943, -139050, -163746, + 24159, 35970, 75699, 10201, 15569, -45097, -53687, 537, -38655, 4295, + -42950, -12885, -13422, -4295, 46171, 9664, -14496, 84826, 54224, 24696, + 48318, -54224, -28454, -46171, -10201, 27380, 17717, 25770, -23085, 22549, + 37044, -30602, 10737, 2684, -2147, -3221, + }, + { + -5931350, 30662308, 870805, 1464584, 194884, 95563, 231391, -231928, -369904, 451508, + 112206, -317291, -841277, 152471, 1282585, -20938, 651224, -258235, -150861, -56908, + 435939, 183610, 5906, 396748, 103079, 80531, 215822, 209917, -330712, -18254, + 49392, 243739, -74625, -99321, 34360, -207232, -284542, -151398, 568009, 110595, + 104153, 57445, 53150, 64961, -62277, -158914, 294205, 45634, -118648, -53150, + -38118, 6442, -67646, -54761, 92879, -21475, -104690, 74088, 89657, -67109, + 15032, 71941, 41876, 10201, -85362, -133681, 4295, 25770, -57445, 3758, + 8053, -64961, -34897, 29528, 37044, -45634, -62814, 31675, 17180, -3221, + -44023, 19327, -44560, 23085, -41876, -13422, 4832, 21475, 33286, 31675, + 4832, -2147, -16643, -11811, 31675, -3758, + }, + { + -91805, -815507, 1065689, 112743, -221191, 609349, 358630, -459562, 144955, 261456, + 255014, 4295, -229244, 140123, 676994, 11811, -181462, -830539, 1042066, 849330, + -387084, -657667, -49392, 266825, 741419, 164283, 151398, 446140, 111669, 317291, + 270046, -583579, 55835, 132070, -70330, 37044, -61203, 166967, 57445, 46171, + -55835, 132070, -18254, -62814, -55835, 162135, -69793, -3758, -176094, -15569, + 169651, 25233, -21475, 159451, -56908, -153545, -48855, 32749, 40265, 121333, + 20938, -40265, -51540, -64961, -18254, -81604, -23622, 74625, 125628, 76236, + -43487, 47782, 3758, -40265, 23085, -28454, -26844, -15032, -4832, -38118, + -42950, -12348, 9664, 5369, 5906, 32749, -3758, -14496, -6442, -9127, + 18254, 537, 11274, -1074, 20938, 27380, + }, + { + -767725, 13300977, -1040456, -2131915, -107911, 1236414, 845572, -541703, -389768, 123480, + -14496, 42950, 311385, 477278, -110059, 229244, 129923, 261993, -51540, -282931, + 158377, -431107, 123480, -208306, 226023, 242129, -100932, -258772, -12348, 209917, + 279710, 41339, -207232, -240518, 11811, -236760, -73014, 239444, -90731, -53687, + 284542, 108448, -101469, -537, -249645, -33823, 31675, 96637, -69256, -4295, + 98784, 102542, 27917, 9664, -108985, -89657, -25770, -31675, 133144, -83215, + -6442, 17717, -15032, -24159, -17717, 10201, -22549, -7516, -42413, 10201, + 12885, -14496, 9127, 69256, 56371, 25233, 42950, -28991, -41339, -3758, + -32749, 36507, -13422, -22012, 30602, -15032, 46171, -1611, 17180, -25233, + -2147, 19327, -15032, -34360, -5369, 28454, + }, + { + 189515, -1405528, -5906, 290447, -61203, 118648, -200253, -230854, -428423, -3758, + 132070, -182536, -97174, 533113, -399969, 275415, -560493, -826781, 411243, -226560, + -530965, 297427, 24696, 329102, 290984, -710817, -28991, -397284, -473520, 0, + 417149, -550830, -27917, -189515, 92342, -248034, 26844, -11811, 231391, 162672, + 66572, -157840, -8053, 186831, 86436, 90194, 14496, -49929, 157303, -4832, + 62277, -102542, -12348, 66572, 98784, -55835, 2684, -188442, -149787, -92342, + 11811, 142808, 18790, -55835, -114354, 4295, 70867, -75162, 4295, 13959, + 20401, 33286, 10737, 28991, 32212, 50466, 46171, 17717, -23622, -2147, + -8590, 18790, -51003, -44023, -11811, -5906, -32212, -30065, -6442, 5369, + -1074, 12885, 13422, -8590, -3758, 13959, + }, + { + 1272921, -2508261, 1316944, 1017907, 257161, -1347009, 1293322, 23622, -208306, -135828, + 385473, -8590, 24159, -976568, -80531, -176631, -290447, 136365, -70330, 86436, + 426276, 163746, 8590, -138513, -261456, 206695, 304406, 130460, 129386, -54761, + 55298, 80531, -111669, -433792, 48855, -156766, 108985, -182536, -124554, 313533, + 44560, -84826, -76236, 17180, -253940, -1611, -40265, -226023, -96637, 2147, + -39728, 47782, 5369, 98784, 238908, 75699, 33286, 66035, -124017, -33286, + 105227, -20938, -35433, -25770, 58519, 18254, -55835, -46708, -22012, 80531, + -8590, -37581, -12885, 49929, 10201, 2147, -43487, -9664, 9127, 33286, + 54224, -44023, -30602, 11811, 65498, 38118, -73551, -39192, -20401, -34897, + -20938, -7516, 13959, 37581, 6979, 38655, + }, + { + 11811, 1735167, -897111, 282394, -130460, 169651, -82678, -94489, 161598, 100932, + 184684, -34360, -514322, 1052267, 5405753, -970126, -1086090, 130997, -31139, -115964, + -209380, -325881, -63351, 419833, -170725, -251792, -91805, -161061, 338229, 206158, + 61740, -581431, -442919, 73551, 59593, -437550, 33286, -51003, -152471, 79994, + -11274, 146566, 22012, 10201, 94489, -17717, -2684, 104153, -75162, -26844, + 88047, 58519, 12885, -51540, -47782, 13422, -27917, -34897, -39728, 25233, + 31675, 99321, -81604, -67109, 9127, 60666, -61203, 84826, 46171, 12885, + -8590, -53687, 4295, 33823, -20401, 30602, -16106, -86436, 38655, -25770, + 48855, 57445, -33286, -5369, -9664, -41876, -38118, 16643, 17717, -36507, + 24696, 57445, 9664, -18254, 31139, 11274, + }, + { + -386547, -1686848, 594316, -823560, -454730, 1068373, -754841, 86436, 95026, 337155, + -583042, 295816, 217433, 1025423, -2077690, 166430, 410706, 45097, -201863, 314606, + -284005, -148713, 103079, 223875, 146566, -141734, -156766, 896038, 137976, -256624, + 45634, 105764, -168041, -82141, 126165, 30065, -106837, -39728, 76236, 119722, + 9664, 292595, -52076, -204011, -115964, 155693, -100395, 19327, 59593, 143345, + 82678, 163209, 144955, 118112, -3221, -32212, -37044, -82141, 64961, 20401, + 35970, 16643, -71941, -29528, -3221, -16106, -27917, 48318, -13422, 12885, + -22012, -51003, -41339, 74625, 71404, -12348, -35970, -31675, 16106, -10201, + -43487, -7516, 34897, -1611, 19327, 14496, -2684, 22012, 24696, -44023, + 0, -11274, -11811, -2684, 17180, 20938, + }, + }, + { + { + 102542, 5863167, -266825, 135291, -312459, 77309, -180389, 169651, -62814, 161598, + -215822, 100395, 383326, -618475, 105227, -74625, -181999, 241592, 1292248, -424128, + 431644, 641024, 440771, 180389, -77309, -79994, 102005, -82141, 92342, 323196, + 102005, -60666, 258235, -191663, -212064, 19327, 16106, -265214, -294205, -291521, + 49392, -77846, 27917, -74088, 267899, -117575, -130997, -133144, -55298, -59056, + 0, -25770, -52076, 42413, 37044, -94489, -21475, -136902, 20938, 32749, + 43487, 84289, 63351, 12348, -2147, 32749, -54761, -9127, 55298, 49392, + -33823, -15032, -24159, 19327, 12885, -19864, -30065, 10201, 22012, -6442, + -19864, 13422, 48318, 34897, 8590, -32749, -26844, 4832, 1611, -40265, + 10737, 7516, -2684, 3221, -32212, -14496, + }, + { + -3292629, 15647103, 2916820, 79457, -517544, 196495, -229244, -929860, -192737, 376883, + 281857, -14496, 236223, -213675, -656056, -500901, -66572, -138513, 414464, -425202, + -385473, 156766, -45634, -25233, 67109, 108448, -353261, 115964, -45097, -60666, + 66035, 9664, -28454, -80531, 122943, 365072, 171799, 98247, -319438, -178241, + 61203, 155156, 143881, -79994, 1611, -124017, 63888, -134755, -214748, 252329, + -130997, 13959, 198105, 88584, -54761, -22012, 96637, 100395, -41339, -45097, + 117575, -9664, 31139, 68719, -88047, -50466, -22012, 60666, 39728, -4295, + -34360, -41876, 1611, 6979, -61740, 3221, 25770, -46708, -22549, 4832, + 32749, -16643, 5369, 25233, 42413, -64961, 3758, 26307, 0, 6442, + -19327, 7516, 19864, -11811, 7516, 0, + }, + { + 477815, 10810433, 3737695, 359167, 1180579, -264677, 129386, -56371, -56908, -247497, + -47245, 291521, -270583, -407485, -261456, 777926, 300111, 297427, 120796, 13422, + 40802, -169114, -163209, -61740, -46708, 209917, -34360, -34897, -198105, 263604, + 65498, -70867, 78383, -155156, -41339, -94489, -3221, 36507, 39728, -309238, + -118112, 282931, 79994, 106837, 119722, -329102, -214212, 247497, -26844, 57445, + -2147, 99858, -22549, 5906, -21475, 26844, 62277, 16643, 45097, 4832, + 39728, 92342, 84826, 20401, 51540, -22549, -1611, -19327, 17180, 44560, + -4295, -54224, 16643, 13422, 3221, 14496, 23622, 4832, 2147, -49929, + 0, 11274, 35970, -14496, -42413, 3758, -30065, -12885, 15569, -17180, + 18790, 19327, 15569, 5369, -4295, 10201, + }, + { + 293668, -2662343, -794569, 219580, -48855, -113280, -10737, -25770, -33823, 19327, + 33286, -117575, -466004, -555125, -2455111, -293132, -630286, 280247, 170725, 114890, + -229244, -966905, 128312, -63351, 30602, -990527, -485331, 766115, -214212, -482647, + -36507, 688805, 118112, -327491, -254477, 76773, -109522, -100395, 160524, -150861, + 20938, 4832, -57982, -120796, -68183, 124554, -42950, 46171, 124554, 69793, + -55298, -35970, 51003, -22012, 121333, -25770, -83752, 50466, 5906, -89657, + -12885, 28991, 1611, -19327, 50466, 2147, 20938, -41339, 41876, 3221, + -82141, -43487, -11811, 40265, -11811, -18790, 77309, 56371, -12348, -26307, + -14496, 19327, 1611, 9664, 0, -33286, -2684, 27380, 48855, -15569, + 0, 27917, 41876, 16106, 4295, 21475, + }, + { + -501974, 24245628, 255551, -520765, -225486, -69256, 335544, 40265, -279710, -257698, + 261456, 211527, -100395, 236760, 562104, 356482, -10737, 113280, 217433, 150861, + -194347, -17180, 446140, -557809, 157303, 131533, 194347, -1185411, -690416, 158914, + 353798, 129923, -9664, 67109, 5906, 75699, -383863, -537, 105764, 28454, + 24159, 38118, -23622, -54761, -234076, 176631, 10737, 12348, 123480, -11811, + 110059, 110059, -67109, -57445, -24159, 95563, -24159, -117038, -46171, -60666, + -17180, -78920, 23622, -36507, -13422, -31139, 10737, -69793, -8053, 37044, + -11811, -88584, -55298, 6442, 38655, -26844, 31675, 36507, -26844, 9664, + 11274, 31139, 26844, -5369, -42413, 17180, 5369, -11811, -33286, -15569, + -6979, -24696, 1074, -26844, 1074, 8590, + }, + { + -74625, 1322313, 163746, -171799, -79994, -47782, 55835, -82141, 128849, 1611, + -32749, -24159, -254477, -870268, -71404, -405874, 201327, 405874, 1026497, 514322, + 166430, 510027, 372052, -351114, -1362578, -322659, 35433, -336618, -552977, 324807, + -491774, 6442, -24696, 79457, 138513, -130460, 170188, -51540, 157840, -59593, + 195958, 55835, -6979, 147103, 54761, -34360, -27917, -1611, -6442, -54224, + 56908, 59056, -99321, 29528, -2147, 52613, -70867, -22549, -26844, -41876, + -54224, -27380, 103079, 8053, -11811, 6442, -32212, -5906, 12885, -53150, + 18790, 89121, -38118, -23622, 42950, 26844, 73014, 39192, 13422, -45097, + 21475, 2684, -60130, -26307, 2684, 11274, -5906, 537, 4832, 4832, + -27917, -18254, 37044, 17180, 3221, -11274, + }, + { + -5995238, -432718, -285615, 957241, 666257, 72478, 69793, 93952, -334471, -124017, + -101469, 31675, -28454, 168577, -309238, 255551, -149787, 94489, 126702, -199716, + -66035, 136365, 35433, -30065, -3221, 172872, 182536, 98784, -341987, -113817, + 193274, 121333, 150324, -131533, 91805, -198105, -100932, 40802, -3221, 60130, + -69256, -33823, -110595, -100932, 102542, -140123, -267362, -185220, 103616, -70867, + 17180, -15032, 18790, 64961, -48318, 139586, 70330, 4295, 62814, 39192, + -33823, 6442, 9127, -18790, -26307, 71941, 65498, -37044, -74088, 17717, + -35970, -102542, 91268, 66035, -20401, -28991, 9127, 2147, 6442, 29528, + 6979, -5369, 43487, 17180, -69793, 6442, 39728, 6442, -20401, -16106, + 37581, 8590, -18254, -8053, -17180, 5906, + }, + { + -59056, 941672, 775242, 307090, -53150, -131533, 44023, -164283, 80531, 26844, + -252866, -163209, -439160, -799401, 971200, -1135482, -928250, -178778, -182536, -574989, + 53687, 155156, -212064, -436476, 1074, -591632, -240518, 123480, -9127, 303332, + -282394, -208843, -77309, 97174, -135291, 258772, -67109, 182536, 175557, 198105, + 70867, -100932, 10201, -178241, -178778, 32749, 255551, -85362, -156229, 207232, + 121333, -7516, -13959, 79994, 76773, 41339, 112206, 131533, -154082, -32212, + 70867, 62814, 44560, 16106, -1074, -49392, 8590, 23085, -19864, 10737, + 10201, 15032, -3221, 25233, 39728, -6442, 19327, 60666, 21475, -3758, + -20401, -45097, -13422, -30602, 10201, 15032, 39728, 537, -13422, 44023, + 5369, -10737, 2684, -10201, -1611, -10201, + }, + { + 4024384, 39221104, -810138, 2203318, 503585, 99858, 330712, -399432, -271120, 471910, + -421444, -656056, -556735, 217433, 654983, -201863, 327491, -368293, 107911, 5906, + 324270, -132607, -134755, 75699, -218506, 81068, 106300, 271657, 80531, 241055, + 8590, 6979, -232465, -9664, 128312, -74625, 168577, -241592, 405338, 343597, + 318901, 537, -54761, 128849, -59056, 135828, 216896, -198642, -124017, -53687, + 32212, -24696, -25233, 26844, 65498, -73014, -105764, -537, -51540, -87510, + 42413, 27380, 37581, -18254, -143881, -19864, 96100, -1074, -10201, 10737, + -31675, -32212, 24696, 30065, 56908, -98784, -41339, 47782, 7516, -39192, + -10201, 17717, -53150, -5906, -57982, -18790, 26307, 31675, 19864, -1611, + -18254, 1611, -26844, 13422, 12885, -14496, + }, + { + 86436, -1574106, 580357, -598074, -291521, 805843, -229244, -486942, 6979, -38118, + -78920, -383326, 108448, 244276, 888521, 611496, 724776, 144955, 1139240, 76236, + -638876, 21475, 34360, -51003, 359167, -69793, -53150, 176631, 91268, 272194, + 18254, -222265, 331786, 219043, -102542, 112206, 37581, 226560, -133144, 126702, + 74625, 131533, -73014, -69793, 142271, 152471, 62277, -2147, -109522, 133681, + 262530, 56908, 0, 44560, -180926, -40265, 54761, 24696, 73551, 92879, + -10201, -23085, -84289, -45634, -59593, -61740, 42413, 84826, 100395, -20938, + -26307, 12348, -42413, -15569, 23085, -30065, -52076, -25233, -20938, -47782, + -26307, 3758, 31139, 5906, 18254, 6979, -22549, 3758, -6442, 18254, + 0, 18254, 11811, -2684, 25233, 16106, + }, + { + 20401, 13781476, 234613, 372588, 517544, 273804, -955093, -960999, -537408, 226560, + 106837, 158377, 390305, 200253, -393526, 523449, 362925, 391379, 90731, 224949, + -28991, -277025, 73014, -155693, -40265, -74088, -197032, -120259, 154619, 3758, + 4295, -60666, -102005, -144418, 222801, -209380, 59056, 186831, -163209, 147640, + 221191, -67646, -130460, 24159, -156766, -5906, 537, 91805, -45097, -18254, + 117575, 113817, -12348, -57982, -75699, -130460, -62814, 86973, 88584, -77309, + 24696, 39192, -46171, -61740, 19864, -10737, -14496, -16643, -9664, 5906, + 12885, -1611, 30065, 85899, 17180, 30602, 18790, -69793, -2684, 9664, + -10201, 28991, -32749, 27917, 13959, 32212, 23622, 2147, 20938, -20401, + 12348, 2147, -28991, -17717, 19864, 16106, + }, + { + -116501, -457951, 1041530, 188442, -9664, -147640, -396211, -114354, -165893, 71404, + 5906, -185757, -147640, -746787, -1678259, 943282, 115964, -489626, 244276, 345745, + -143881, 304943, -26307, 90194, -54761, -513785, 12885, -128312, 120259, 774168, + 66572, -292595, -216359, -151398, 231391, -186831, -39192, 125628, 166967, 186294, + -5906, -74625, 126702, 105764, -62814, 38118, -120796, -32212, 185757, 68183, + 108448, -124017, -11274, -39728, -5369, -89657, -85362, -281320, -66572, -71404, + 99858, 56908, -12348, -117038, -81068, 89657, 16643, -35970, -23622, 11811, + 39192, -1074, 25233, 30065, -9127, 43487, 28454, -13422, -7516, -15032, + -4295, 32212, -57445, -48855, -2684, -22012, -25233, -12348, 10737, 3758, + -1074, 17717, 13959, -22549, -6442, 22012, + }, + { + -137976, -4002910, 2858301, 471910, 336081, 202400, 1491964, -754841, -343061, 129386, + 329639, 1074, 686658, -1018444, -214748, -174483, -206158, 284542, -185220, 576599, + 189515, 107911, -52076, 106837, 50466, 435402, 71941, -64425, 88584, 7516, + 123480, -69793, 27380, -124554, 277562, -54761, 215822, 47245, 17180, 143345, + -134755, -90731, -29528, -129923, -190589, -102542, 15032, -286152, -32212, -74625, + 39192, -4832, -22549, 220654, 139050, 49929, -21475, -5369, -122407, 95563, + 122407, -41876, -36507, -6979, -9127, -15032, -47245, -31139, 24696, 66035, + -74625, -35433, 53150, 52076, -21475, -12348, -21475, 34360, 5369, 28454, + -11274, -54761, 9127, 25233, 34360, -22549, -90731, -16643, -9664, -24696, + -8053, 2147, 45634, 28991, 16106, 29528, + }, + { + 64961, 1305133, -739808, 601832, -32212, 97174, -22549, 23622, -77309, -205085, + 303869, -5369, -17717, -1149441, 2260227, -689879, -638876, -228170, 79457, 441845, + 265751, -174483, -136902, 365609, 56908, 150324, -81068, 53687, 56908, -137439, + 262530, -185220, -293668, 156766, -108985, -227633, 23622, -163746, -120259, -107911, + 4832, 168041, 48318, -11811, 46708, -113817, 28991, 136365, 56908, -7516, + 217433, -19864, -90194, -45634, -50466, -49392, -32212, -18254, -2147, 3758, + 151934, 34360, -100395, -28454, 17717, -35970, -76236, 93416, 24696, -6442, + -15032, -45097, 1074, 26844, 4832, 62814, -58519, -10737, 1074, -6442, + 84826, -2684, -24159, -2684, -37044, -34897, -23085, 46708, -5906, -5369, + 56371, 32212, -30065, -12348, 30602, -22549, + }, + { + 152471, -694711, 68719, -1489817, 139586, 2609730, -258235, 118112, -128849, 77309, + -372052, 305480, -135291, 342524, -2239826, 381715, 107374, -97711, -24159, 41876, + -546535, -111132, 76236, 354872, -100395, -170725, 66572, 568546, -144955, -231928, + 199179, 225486, -242129, -248034, -76236, 121333, -41339, 69793, 29528, 9127, + -58519, 161061, -294205, -194884, -42413, 25770, -147640, 61740, 119722, 68719, + -28991, 76773, 88047, 44560, 116501, -12348, 5369, 21475, -8053, -64961, + -17717, -19327, -65498, -48318, -4832, -46171, -15032, 5906, -5369, 52613, + -13959, -42413, 24696, 93952, 18790, -52076, -27380, -2684, 33286, -16643, + -16106, 4832, 16643, -10201, 27380, 36507, -11274, 55298, -10201, -38655, + 15569, -26307, -9127, 0, 5906, 8053, + }, + }, + { + { + -41339, 1937567, 1728724, -171262, 119722, 53687, -76773, -62814, 0, -120259, + -176631, 48855, -549219, -35970, 1537598, -1037772, 268435, -145492, 328565, 294205, + 476205, 86973, -524523, -294205, 141734, 193810, -7516, -42413, 106837, -386010, + -239444, 253940, -251256, 404801, -55298, 96637, -177167, 251792, 136365, -59056, + -96637, -86436, -20938, 90194, 75162, -7516, 61203, 93952, -88047, -27380, + -152471, -38118, 11274, -119185, -118112, 36507, 51003, 41876, 68719, 25770, + -66035, -52613, -84826, 38655, 10737, -63888, -46171, 34360, -30065, -82678, + 13422, 33823, -10201, 33823, -537, -5906, 12348, 11811, -37581, -33286, + 18254, -11274, -35970, -67109, -39728, 9127, 30065, -12348, -10201, 26844, + 17180, -20401, 537, -5906, 19327, 27917, + }, + { + 2738042, 5185636, 3640522, 2403571, 235149, 49392, -144955, 514322, 588947, 67109, + 561567, 15569, -78383, 11274, -627602, 461709, 361314, -70330, -162672, -340913, + -173946, -71404, 396748, -61740, 111669, -183073, 84826, 314606, -84826, -78920, + -234613, 19327, -42950, 494995, 56908, -22549, 126165, 266825, 143881, 56908, + 157840, -43487, -115427, -61740, -137439, -27917, 183610, 26844, 164819, 1074, + -83752, 8590, -84289, -56908, -35970, -15569, -42950, -38655, -15569, -11274, + -68183, -66035, 40802, 31139, 25233, 68719, 32212, -27917, -58519, -54224, + 13422, 8590, 57445, -37044, 5906, 64961, -54761, 13959, 52613, 8590, + -48855, -13959, 36507, -18790, -44023, 28991, 37581, -35433, 24696, -3221, + 5906, 10737, -9127, -16643, 5906, -8590, + }, + { + -754304, 18666464, 1849520, -938450, -1495722, -32212, -117575, -328028, -21475, 211527, + 437013, 220117, 564251, 507343, -671089, 554051, 426276, -195421, 513249, 207232, + 148713, 299574, -380641, 105227, 24159, -171262, -286152, 41876, 229781, 139050, + 186831, -96100, -307627, 86973, 106300, -150324, -16643, -18790, -198105, 23622, + 0, -89121, 40265, 29528, -194347, 9127, 119722, -17717, -198105, -154082, + 195421, 223875, 73551, -78920, 64425, 56371, -71941, -152471, 28991, 69256, + 57445, -156229, -9664, -4832, -6979, -90194, -45097, -41339, -14496, -37044, + -17180, -34897, -17717, -33823, -14496, 42413, -3758, 18254, 48855, 13959, + -4295, 10737, -20401, -37581, 45634, 3758, -8053, 36507, 8053, 19327, + 5906, -21475, -11274, -11274, 4832, -8590, + }, + { + -308164, -3316252, 914828, -175020, -118648, 86973, 61203, 6979, -210453, -9127, + 76236, 23085, -155693, -410169, -2440615, -348966, -215285, 1513976, -714575, -40265, + 341987, -422517, -238371, -407485, -8053, -892816, -160524, 200790, 202937, 331786, + -211527, 166967, -86436, -199179, 84289, -114890, -219580, 118648, -110059, -158914, + -17717, -185220, 55835, 53687, 61203, 1611, -118112, 26307, -6979, -102005, + 86973, 59593, -127238, -9664, -21475, -118648, 85899, 62277, -63351, 44023, + 53150, -11274, -12348, 42413, -77846, -54224, 20401, -6442, -97174, -42950, + 58519, 99321, 537, -34897, -11274, 54224, -22012, -55835, -51540, -19327, + 9127, -4832, -28454, -3758, -13959, 37581, 23622, -23085, -10737, -11811, + 20401, -537, -37044, -8590, 7516, -22012, + }, + { + 3636227, 22993644, -2105608, -1420560, -56908, 18254, 22549, 141197, -66572, 86973, + -184147, -350040, 283468, 181999, 685047, 597537, -219580, 256087, 392453, 124017, + 46708, 92879, -25233, 277562, 568009, -266825, -59056, -1265405, -61740, 470299, + 135828, 87510, 189515, 19327, -38655, 118112, 526134, 494995, -158377, -26844, + 347355, 68719, -181462, -183073, 92879, 52076, -133144, -54224, 97711, 172872, + -62814, -177704, -63351, 68719, 56371, -54761, 44560, 108448, 34360, -52613, + -55298, 32212, 6442, -53687, -28991, -4295, -59056, 42413, 13959, -54761, + -22549, 74088, 89657, 31675, -51003, -13959, -23085, -50466, 36507, -22012, + -38118, 20401, -3221, 2147, 47782, 4832, -8053, -1074, 6979, 8590, + -5369, 25770, 7516, 11811, 25770, -9127, + }, + { + 252866, -191663, -324270, 206158, 8053, 39728, 6442, -122407, -98247, -38118, + 154082, 97174, 96637, 347355, 1264331, -475131, -746251, 744103, 115427, 1217086, + 18254, 570694, -491237, -150324, 178778, 115964, -128849, -2684, -348966, -388158, + -224949, 105764, 27380, -361851, -234613, -60130, -76236, -117575, -59056, 155693, + 11811, -68183, 206158, 6979, -106300, 25770, 52613, 121870, 81068, -26307, + -34360, -93952, 84826, 24159, -112743, -61203, -47782, 67646, 20401, -49392, + -5369, -10201, 24159, 15569, -2684, -34897, 59056, 8053, 24159, 45634, + 6979, -53687, -54224, 4295, 21475, -31139, -52076, -61203, -23622, 4295, + 14496, -57982, 3758, 19864, 13959, -23085, 13422, 0, -10737, -8053, + 6442, 48855, -18254, -40265, 2147, 4295, + }, + { + 5841156, -18599892, 1120450, 1937030, 185757, -165893, -32749, -166967, -201863, 82678, + -96100, -212601, -3221, -288837, 203474, -224949, -250182, -191126, 286689, 490163, + 281320, 256624, -105764, 163746, 169651, 236760, 32212, -208843, 250719, 74088, + 78920, -55298, 38118, -134755, -229781, -212601, -168041, 517007, -31139, -234613, + -41876, -139586, 20938, 200253, -99321, 23085, -78383, 38655, -15032, 91805, + 64961, 110595, 126702, -49392, 35970, -10201, -57982, -57445, -66035, -106300, + -74625, 22549, 9127, 16643, 34897, -27917, -93952, -52613, 42950, -31675, + -27917, 90731, -12348, -100932, -2684, 46171, -44023, -17717, 36507, -40265, + -9127, 40265, -16106, -35970, 39728, 27917, -57445, -10201, 11811, 31675, + 1074, -24159, 24159, 4295, 17717, -2147, + }, + { + 322123, 278636, -998043, 289910, -79994, 92879, 4295, -104153, 2147, -97711, + -38655, 198105, 97711, -304406, -729608, -1150514, 275952, 790811, -518617, 184684, + 909996, 632434, -167504, 337155, -185757, 162672, 27917, 31139, 160524, 98784, + -55835, 223338, 147640, -21475, 96100, 187905, -4832, 111132, -41876, 99858, + 150324, -157303, 101469, -66035, -42413, -46708, -130997, -30602, 307090, -4295, + -77309, 90731, 22549, -35970, -156229, 15032, -18790, -61203, 53150, 39728, + -20938, -48855, -48855, 8590, 25770, 85362, -537, -40802, -24159, 28454, + 4295, 36507, 13422, 10201, -42413, 15032, -9127, -50466, -19864, -37581, + -27380, 54224, 11274, 23085, -5906, -12885, 0, -22012, 27917, -8053, + -28991, 22012, -7516, 0, -3758, 3758, + }, + { + -287226, 41953240, 3357054, 2163590, -106837, -86973, -38118, 169114, 155693, -512175, + -172872, 299574, 500364, 139586, 633508, -284542, -833761, 188442, 103079, 113817, + -95563, 93416, 381715, -583042, -93416, -67109, -63888, 219043, 4832, 143345, + -188979, -245350, 42950, 215285, -84289, 266825, 97711, 139586, -350577, 207769, + 236223, -254477, 3221, -97711, 2147, 258772, -264141, -188442, 107911, 84826, + -111669, 19864, -45634, -64961, -16643, 55298, 10201, -115964, -130997, 50466, + 79457, 3221, -2684, 9127, 79994, 120259, 26307, -59056, 31675, -21475, + -25233, 48855, -537, -45097, -33823, 2684, 25770, -25233, -9664, -18254, + 31675, -8590, 30065, 25233, 17717, 31675, 5369, -34897, -22012, -40802, + 3758, 20401, 15032, 4295, -31139, 2684, + }, + { + -89657, -940061, -419833, -105227, 440771, -619012, -738198, 191663, -163209, -271120, + -325881, 198642, 374199, 288837, 668941, -145492, 1265405, 791348, -755377, -699543, + 401043, 543313, -600222, -655519, 122407, -228170, 55835, -367757, 414464, 66035, + 32212, 263067, -206158, 71404, -24696, -64961, -141734, -263067, -238371, -19327, + -54224, -67646, -178241, 97174, 134218, -181462, 102005, 40265, 117038, 3221, + -106837, -19864, -23085, -91805, 170188, 176094, 24696, -33286, -20401, -89121, + 10737, 51003, 55835, 80531, -8590, 69256, 0, -68719, -100932, -83752, + 16106, -17180, 26307, 31139, -40802, 17717, 27917, -3758, 3758, 36507, + 20401, 12885, -7516, -17180, -23622, -38655, 8053, 14496, 7516, -5369, + -23085, 11811, -13959, -6979, -22549, -22012, + }, + { + 598074, 12178380, 2790655, 521302, 217970, -1365263, -2432562, 158914, -16106, 32212, + 142808, 248034, -90731, -342524, 119185, 464393, 14496, 66572, -4832, 280247, + -128312, -138513, -177704, -57445, -397821, -64425, -42950, 25233, 184684, -314069, + -336081, -142271, -41339, 226023, -64425, 47782, 235686, -262530, 79994, -42950, + -407485, -103079, 45097, 78383, 129386, 15032, -27380, -236223, 0, 70867, + 5906, -16643, -103616, -75162, 115964, 68183, 63888, -46171, -102005, 55298, + 30602, -13959, -4295, 35433, 2147, -17180, 39728, 14496, -5906, 4295, + 27917, 22549, -1074, -46708, -45634, -12348, -53687, 19327, 25233, 5906, + 36507, -33823, 18790, 21475, -28454, -3221, -46171, -10737, -1074, 24696, + 2147, -17717, 3758, 27917, 2147, -24159, + }, + { + 106300, 812823, -81604, 84826, -222265, -184684, 83752, -85362, -44560, 68719, + -255014, 187368, -491237, -1261647, -63351, 922344, -27380, -699543, -723702, 290447, + 844498, 482110, -741419, -487479, -980326, 521302, 128849, 64961, 517007, -24159, + -249108, 477815, 66572, 167504, 25770, -8053, -55298, -256087, -104153, 27380, + 102542, 137439, 26844, -118112, -176094, 13959, 78383, -53687, 69256, -68183, + -52076, 33823, -31139, -132607, -107374, -41339, 19864, 96637, 157840, 55835, + 49392, -67109, 14496, 31139, 96637, -34897, -10201, 37581, -41876, 11811, + -20401, -18254, -537, -22012, -38655, -55835, -79994, -8053, 13422, 22012, + 13959, -11274, 35970, 16643, 15569, 26844, 42413, 28454, 13422, -4832, + -5906, -16106, -19864, 6979, 7516, -11274, + }, + { + -1414655, -1234266, 2554969, -594853, 78920, 463856, -1118839, -431644, 247497, 351114, + -488553, 25233, -195421, 591095, -277562, 330176, 126702, -219043, 60666, -100395, + -168577, 229244, -108448, 137976, 224412, 64425, -166430, -386010, -264677, 8053, + -11811, -156229, 51540, 76773, 74088, -92879, 5369, 212601, 12885, -155156, + 105227, 213675, 84826, 115427, 175020, 212064, 2684, 88047, 152471, -178778, + -10201, -102005, -110595, -19327, -117575, -105227, -13959, -9127, 129923, 70330, + 537, 19327, -44560, 1611, -76773, 22012, 66572, 53150, 19327, -79994, + 15032, 51540, -537, -45097, -13422, -21475, 44560, -537, -23622, -36507, + -31675, 53150, 38118, -4295, -60666, -28454, 60666, 36507, 14496, 36507, + 11811, 13959, -12348, -32749, -9127, -45634, + }, + { + -152471, 987306, 751082, 333934, -84826, -181999, -57445, -18790, -191663, -126702, + 71941, 94489, 741956, -1459752, -4961224, 1676648, -584652, -496069, 615791, 282931, + -404264, -107911, -526670, -116501, 173946, -47245, -138513, -37581, -462246, 166430, + 360777, 461172, 124017, 66035, 28991, 200790, 95563, -9664, -130460, -23622, + 149250, -258772, -86436, 102005, -41876, 85899, 44560, -78920, -71941, 52613, + 32749, -168041, -18254, 97174, -1611, -9127, 33286, -31675, -2684, 32212, + -62814, -149250, 9127, -6979, -56908, -13422, 34360, -48855, -33286, -29528, + -16643, 84826, 1074, -24696, 30602, -9664, 24159, 77309, -28454, 15032, + -41339, -67646, 41876, 10201, 12885, 51540, 40802, -12348, -22549, 44560, + -22549, -45634, -10737, 18254, -26844, -18254, + }, + { + 369904, -872415, 286152, -724239, 33823, -251256, 361851, 208306, 122407, 55835, + -299037, -585726, -415001, -1452773, 365072, -307627, -272194, -325881, 76236, -198642, + 97174, 77309, 145492, -222265, -71941, 527207, 4295, -317291, 177167, -117038, + 183610, 97174, -263604, 82678, 12348, 426812, 179315, -1611, -232465, -158377, + -128849, -76773, -132607, 53150, -537, 52076, 260382, -6979, -4295, -86436, + -7516, -103079, -158914, -37044, 87510, 4832, 147103, 39192, -61203, -6979, + -41339, 44560, 45097, 71404, -3758, 5369, 40802, -27380, 53687, 21475, + 7516, 73014, 61740, -48855, -97711, -12348, 32212, 26844, 9127, -3758, + 52076, -26844, -31139, 16106, 7516, -3758, -2684, -25233, -53687, 34897, + 4832, 2147, 16106, -1074, -10737, -24159, + }, + }, + { + { + 219580, -3122441, -2285996, -19327, -33286, -37581, -78383, -13959, 185757, -108985, + 39728, -258235, -359704, -92342, 1230508, -253940, 352724, -865973, -750546, 262530, + 595927, -444529, -369904, -350577, 307090, 434865, 41339, 180389, 169114, -392453, + -481573, 0, -26307, 469762, -24159, 3758, 70867, 526670, 121870, 62277, + -132607, -37044, 1611, 31139, 1074, -97174, 1074, 105764, -24159, 10737, + -157840, -31675, 43487, -121870, -35970, 102005, 32212, 124554, 8590, -41339, + -60666, -91805, -58519, 36507, -18254, -56371, -2147, 5906, -77309, -31139, + 41876, 26307, -14496, 10737, -15032, 13422, 15032, -16106, -46708, -2147, + 23085, -30602, -44560, -46171, -21475, 38655, 32212, -8590, 2684, 42413, + -20938, -8590, -7516, -2684, 31675, 22012, + }, + { + -2699924, -1453310, 630286, 428423, 95563, 1074, 119185, 753230, 293132, -231391, + 325344, -50466, 8053, 557272, -129923, 695248, 137439, -214748, -220117, -254477, + 105764, -154082, 251256, -244276, 36507, -78383, 228707, 355409, 8590, 34897, + -165356, -6979, -1074, 294742, -156766, -280784, 116501, 424665, 250182, -28991, + 3758, -90194, -13422, 37581, -97711, 91805, 89121, 191126, 166430, -16643, + 22012, -89121, -146566, -22012, 20401, 22012, -130997, -41339, -23622, -5906, + -67646, -10201, 41339, -12885, 71404, 38655, 15569, -46171, -48855, 27380, + 13422, 6442, 30065, -35970, 58519, 8053, -55298, 24696, 27917, 1074, + -37044, -1611, 12885, -34360, -26844, 62814, -9127, -20938, 9127, -1611, + 13959, 3758, -15569, 2147, -3221, -5369, + }, + { + 383863, 17714592, -869194, -155693, -716186, 107911, -182536, -84826, 160524, 146029, + 212601, 11811, 693100, 740882, -1002875, -74625, -77846, -6979, 813896, 114354, + 195958, 392453, -110595, 153545, -149787, -386547, -263604, 82141, 383863, 86436, + 117038, -177167, -108985, 268435, 45097, -236223, -96100, -32749, -7516, 314606, + 52076, -181462, -10201, -2147, -146029, 178241, 2684, -203474, -114890, -54761, + 170725, 35433, 31675, -26307, 66572, -12348, -59593, -34360, 37044, 17180, + -48855, -148176, -21475, -51540, -6979, -37581, -41876, 3221, -14496, -27380, + 8590, -9127, -13959, -20938, 4295, 16643, 5906, -9127, 41876, 28454, + 1074, 1074, -16643, -9127, 48318, 4295, 20938, 28454, -6979, 18790, + -26307, -20401, -16643, 537, 8590, -12348, + }, + { + 140660, -3056406, 453119, -412854, -54224, 107374, 56908, 22549, -171799, 5906, + 64425, 188979, 49392, -886374, -1721745, 731218, 280784, 677531, -1166084, 267362, + 403190, -641024, -263604, -126702, 52076, 330712, 815507, 285078, 45634, 175020, + -287226, 181999, 53687, -5369, 339302, -160524, 186294, 261993, -179315, 32749, + 52076, -197569, 141734, 117038, 74088, 44023, -19864, -27917, -139586, -102005, + 137439, -21475, -29528, 85362, -30065, -40265, 107374, -28991, -51003, 12348, + 27380, -31139, -13959, 3758, -59056, -30602, 10737, -9127, -70330, -12348, + 86973, 53150, -18254, -48318, 15569, 16643, -73014, -45634, -2684, -2147, + 10737, -22012, -17180, -10737, 1074, 31139, 8590, -26844, -29528, -537, + 18254, -18790, -41339, -6442, -8053, -26844, + }, + { + -6229850, 12640089, 551903, -1511292, -394600, 23085, 76236, 176094, -58519, 215822, + -416075, -70867, 159451, -136902, 147640, 163746, -295279, 59593, 44560, 41339, + 37581, 25233, 2147, 464930, 291521, -125091, -103079, -214212, 794569, 273804, + -44560, 48855, 86436, -11811, -40265, 232465, 706522, 6979, -326418, -10737, + 110595, -97711, -101469, 32212, 212601, -64961, -107911, 34897, 92342, 169651, + -208843, -203474, 45634, 60130, -1074, -107911, 38118, 40802, 20938, -18790, + -8590, 17717, -33823, -40265, -2684, 17717, -44560, 35970, -17717, -56908, + -2147, 106300, 94489, -15569, -33286, 13422, -30602, -13422, 28454, -14496, + -27917, -2684, -16643, 19327, 35433, -537, 537, 5369, 24696, 16106, + 6442, 22012, 3221, 19327, 6979, -4295, + }, + { + 134218, -758062, 257161, 253940, 52613, 35970, -10201, -59056, -89121, -6979, + 158377, 180389, 231391, 527207, 697932, -448824, -253940, 13959, 1611, 2086817, + -86436, 99321, -1214939, 67109, 799401, 274341, -11811, 162672, 491237, 356482, + -139586, -30065, 70330, -278099, -94489, 103079, -142808, -2147, -12348, 194347, + -75699, -19864, 82678, -113280, -66035, 74088, 53687, 46708, 4832, 30065, + -63351, -67646, 111669, 537, -86436, -39192, 20401, 104153, 41339, 19327, + 59593, -55298, 2684, -12885, -14496, -6979, 29528, 8590, 35433, 46171, + -38655, -29528, 4295, 13959, -19327, -31139, -68719, -69256, 1611, 24696, + -10201, -24159, 33286, 26307, -5906, -19327, 28454, -3221, -11274, 4295, + 20938, 22012, -42413, -25770, 6442, 12348, + }, + { + -3031710, -32509682, -578747, 1487669, -423054, -111669, -196495, -55298, 209380, 35433, + -46708, 27380, 53150, -170188, 369904, -159988, -390305, -150861, 202400, 277562, + 200790, -89121, -173946, 123480, 141197, -24696, -173409, 9664, 137439, 24159, + 114890, -105227, -26307, -80531, -191663, -115427, 98247, 396211, -147640, -239981, + -68719, -80531, 98247, 213138, -156229, 79994, 174483, 72478, -103616, 92342, + 25770, 16106, 26307, -64961, -72478, -85362, -11274, -13422, -84289, -76773, + -25233, 15032, 5906, 20938, 18790, -67109, -64961, 12348, 56371, -18790, + 16643, 81604, -71404, -82141, 10201, 47245, -39728, 2147, 11811, -46708, + 21475, 10201, -44560, -18254, 76773, -11811, -49392, 13959, 31675, 22549, + -25233, 537, 15032, 6442, 16106, -10201, + }, + { + 99321, -708670, -472446, 291521, -41876, 105227, -41339, -127775, -83752, 4295, + 166430, 251792, 226560, 66572, -665720, -773094, 102542, -14496, -214212, 782758, + 711354, 117575, 470836, 1021129, 377420, 1094143, -20938, -89657, -41876, -32212, + -13959, 389768, 248034, 39728, 114354, 99321, -190589, 42950, -271120, -92342, + 116501, -52076, 181999, 34360, 22549, -30065, -143881, 110595, 302258, -117038, + -85899, 36507, 45634, -146029, -139586, 9127, -79994, -32749, 109522, -66572, + -84826, -106300, -69256, -44560, 1611, 74088, -33823, -15032, 5369, 44560, + -8053, 6442, 8590, -14496, -48318, 34897, -46171, -42413, -4295, -31139, + 4832, 34897, 8053, 26307, -11274, -4295, -30602, 3221, 22012, -38118, + -10201, 8590, 0, 11811, -6442, 4295, + }, + { + -4491999, 35223564, 724239, 1388348, -138513, -159451, -103079, 333934, 11811, -580894, + 312996, 583579, 530965, -42950, 819802, 76236, -737661, 129923, 198642, 241592, + -221191, 24159, 233002, -358093, 186831, -122407, -73014, 212064, -183073, -111669, + -303869, -76773, 177704, 33286, -171799, 265214, -206158, -13422, -536334, 70330, + 261456, -4295, 74625, -161598, 145492, 84289, -263604, 78383, 113817, 99321, + -78920, 85362, -38118, -26844, -24159, 84826, 31139, -68719, -18790, 53150, + 39192, 18254, -11274, 45634, 165893, 60666, -54761, -37044, 14496, -12885, + 8590, 40802, -20938, -51003, -52076, 70867, 17717, -41339, -9127, 15569, + 25233, -537, 34897, 39728, 24159, 28991, -24159, -41876, -8590, -16643, + 21475, 13959, 25233, -10201, -11811, 14496, + }, + { + 12885, 1016834, 579821, 401579, 398358, -780610, -115427, 238908, -126165, -61203, + 14496, 279710, -136365, -54761, 280247, -633508, 533650, 61203, -1306744, -543313, + 492848, 108448, -652835, -401579, 379031, -11274, 88584, -453119, 329639, -310311, + -13422, 259309, -212601, 108448, 5369, -79457, -141197, -239981, -22549, -61203, + -128849, -83215, -91268, 112743, -44560, -169651, -22549, -3221, 84289, -103079, + -140660, -38655, -63888, 10201, 241055, 78383, -44560, -70330, -51003, -71941, + 26844, 34897, 85362, 48318, 25770, 67646, -33286, -72478, -101469, -5369, + 13422, 13959, 48855, 4832, -33286, 30602, 53150, 4295, 13959, 45634, + 10737, 3758, -20938, -15032, -23622, -11274, 24696, -1074, 8590, -23085, + -10737, -6442, -10201, -3758, -24159, -10201, + }, + { + -1059783, 8378408, 606664, -810675, -149787, -355409, -474057, 547608, -34360, -202937, + 46171, 105227, -235149, -281857, 678605, 348966, -373125, 13422, 100395, 150861, + 154082, -134218, -59056, 22549, -155693, 146029, 113817, 7516, 23085, -156766, + -129386, 137976, 149250, 213138, -187905, 109522, 49392, -269509, 160524, -228170, + -365072, 60130, 79994, 95563, 53150, -51540, 27380, -180389, 68183, 69793, + -92342, -42950, -24696, 13959, 115964, 66035, 76236, -95563, -27917, 51003, + 12885, -13422, 19327, 56371, -15569, -9664, 13422, 13422, -21475, 7516, + 3221, -2147, -29528, -73014, -20938, -10737, -31675, 58519, -2147, -5369, + 13959, -33286, 40265, -22012, -15032, -33823, -24159, -11811, 537, 22012, + -10201, 537, 20938, 16643, -15569, -12348, + }, + { + -160524, 1203128, 179852, 113817, -112206, 17717, 186294, -49392, -122943, -85362, + -192200, 100932, -286152, 450972, 2611340, 762894, -263604, -587874, -371515, 118112, + 333934, 407485, -752693, -278099, -576063, 511101, 32212, -154619, 185757, -605590, + -67646, 195421, 287226, 114890, -10737, 130997, 20938, -349503, -62277, -105764, + 121870, 146029, -107374, -110059, -5369, 51003, 134755, -64961, 42413, -139050, + -42950, 73014, -76236, -51540, -25233, 7516, 95563, 199179, 93952, 35433, + -79994, -83752, 17717, 98247, 93952, -78920, 14496, 6979, -11274, -7516, + -25233, 8053, -19327, -23622, -20938, -48855, -60666, 21475, 9127, 28454, + 1074, -26844, 45097, 29528, 7516, 31139, 29528, 11811, -537, -4295, + -5906, -24696, -20938, 23085, 9664, -15569, + }, + { + 2112587, 2615098, 723702, -311922, -222265, -150324, -1023276, 72478, 295279, -62277, + -437550, 80531, 5369, 1613834, -154619, 340376, 98784, -148176, 187368, -432718, + 92342, 166967, -168577, -251256, 104153, -153545, -214748, -451508, -408022, -165893, + -124554, 1611, 19327, -83215, -197032, -141734, -28454, 74625, -90194, -184684, + 90194, 153008, -58519, 122407, 61203, 130997, -150324, 215285, 137439, -44560, + -99321, -125628, -92879, -172336, -55835, -59593, 38118, 25770, 115964, -39728, + -17180, 48318, -13959, -8590, -42413, 34360, 71404, 68719, -10737, -64961, + 64425, 26844, -64961, -45097, 13959, -6979, 46708, -25233, -24696, -31675, + 19864, 52076, 3758, -19864, -41876, 20401, 79457, 16643, 7516, 35970, + 8590, 5369, -38118, -19327, -13959, -32749, + }, + { + 32212, 1515050, 514322, -25233, -62277, -64425, 112743, -115427, -67646, 132607, + -140123, 19864, 451508, 2217814, -886374, 1961190, 213675, -63888, 229781, -68719, + -360240, -29528, -253940, 107911, 135828, -170188, -1074, -6442, -331786, -25233, + 70867, 253403, 24159, -41876, 243203, 114890, -84289, -93952, -96100, 94489, + 18790, -257161, -49929, 121333, -97174, 113817, -9127, -47782, -94489, 38655, + -114890, -103616, 92342, 105227, 3758, 27380, 38655, -1074, -24159, 25233, + -146029, -98247, 38655, -15032, -67109, 55298, 42413, -62814, -36507, -20401, + -15032, 59593, -13422, -11811, 12348, -48318, 53687, 21475, 9664, -4295, + -75162, -15569, 32749, 6442, 34897, 42413, 33286, -34897, 537, 22549, + -49392, -26307, 18254, 9127, -28454, 13959, + }, + { + -699543, -2830384, 42950, -135828, 2684, -1755031, 66035, 185220, 155156, 115964, + -69793, 59056, -126702, 437013, 2621004, -457414, -24696, 135291, 366683, -28991, + 331249, -39192, -23085, -394600, 145492, 624918, 31139, -712965, -16106, 73551, + 37044, 76773, -120796, 135291, 123480, 288300, -16643, -157840, -143345, -102542, + -156766, -59056, 64961, 121333, -122407, 25770, 250719, -35970, -56908, -79457, + -54761, -122943, -130460, 5369, -16643, -537, 154619, -17180, -3221, 21475, + -35433, 85899, 34897, 75699, -18254, -4832, 27380, -22549, 8053, -8590, + 13959, 40802, -15032, -67109, -49392, 32212, 31675, -3221, -537, 9664, + 16106, -32212, -5369, 24159, -4832, -31139, -4832, -47782, -16643, 34897, + -8053, 12348, 13422, -12885, -10737, -10737, + }, + }, + { + { + -273804, -5084168, 492848, -236760, -153008, 6442, -159451, 197032, 70330, 195958, + 90731, -126702, 320512, -445066, 427886, 290447, -420907, -354872, -918586, 251792, + 649077, 140123, 574989, -16643, 414464, -340913, 146566, 56371, 407485, 269509, + -399969, -119185, 421444, -38655, -137976, -28454, 80531, 125628, -378494, 537, + -68719, 66572, -47782, -37581, -6979, -52613, -239981, -112743, 14496, -125628, + 62277, 33823, -10737, 44560, 175557, -50466, -39728, -13422, -117038, -14496, + 46708, 53150, 97174, -11274, -49392, 85362, -1611, -35433, 12885, 80531, + -13959, -1074, -13422, -41339, 537, 5369, -15569, -27380, 25233, 18254, + -16643, -3758, 37581, 60666, 26844, -2684, -19864, 9664, 12885, -30065, + -33823, 20938, -3221, 3221, -18254, -24696, + }, + { + 2921115, -6028524, -3641059, -33823, -216359, -98784, 45097, -347355, -593242, 260919, + -64425, 33823, 34360, -56908, 356482, -139586, -342524, -256624, 403190, -245350, + 73014, -210453, -133144, -109522, 3221, 192200, -143345, -38655, 382252, 51540, + -23085, -67109, -104153, -264141, -56908, 3758, 135828, 91805, -114890, -216359, + -23622, 140660, 124017, -28991, 163209, 72478, -114354, 5369, -123480, 67646, + 21475, 37581, 85899, 133681, 28454, 19327, -71941, 69793, -35970, 21475, + 90194, 59593, 6979, 17180, 5369, -123480, -24696, 60666, 42950, 70330, + -24159, -44023, -28991, 8053, -8590, -62277, 22549, -34360, -44023, -7516, + 41339, 6979, -28991, 16106, 50466, -28991, -37581, 34897, -18254, 9127, + -5906, -5906, 15032, 16643, -3221, -5369, + }, + { + -273804, 9541270, 3312494, 1612760, 943819, -92342, 61740, 277562, 130460, -247497, + -315143, -130460, -266825, 474594, -765041, -237297, -241055, 122407, 586800, -52076, + 100932, 155156, 183073, 106300, -157840, 18790, -18790, -88047, -24696, 16643, + 137439, -98247, 267362, 109522, -261456, -230318, -100932, 135291, 180926, 31675, + 26307, 45634, -39192, 143345, 91268, -66035, -248571, -92879, 195958, 95563, + -105764, -137439, -16643, 77846, -16643, -12348, 103079, 153008, -5369, -74625, + -30602, 96637, 55835, -38655, 32212, 60130, -3758, 39728, -8590, 53687, + 37581, -12885, 12348, 37044, 38655, -29528, 16106, -17180, -17717, -28991, + 11274, -3221, 35970, 25233, -31139, -2684, 5369, -17717, -3758, -22012, + -8590, 19327, 3221, 23085, -7516, 1611, + }, + { + 5906, -3192771, -51540, 102542, 94489, -99321, 5906, -13959, 17717, 76236, + 25233, -179852, -102005, 412317, -1577864, -890669, 480499, 97174, -1691143, 393526, + -133681, -1131724, -185757, 597537, -259846, 761283, 254477, 890669, -288300, -319438, + -184684, 474594, 197569, 82678, -18254, 104153, 353261, -33823, 127775, 114890, + 18254, -46708, 99321, 17180, -46171, 36507, 214212, -95563, -26844, 94489, + -537, -84289, 164819, 71404, 77846, 55835, -100395, -49392, 70867, -89657, + -78920, 26844, -6442, -13959, 44023, 11274, -1074, -16106, 68719, 15569, + -54761, -92342, 2147, 9664, 1074, -38118, 13422, 62277, 42413, -2147, + -25233, 8053, 12885, 537, 10201, -36507, -11274, 15569, 17717, 12885, + -10201, 10201, 34360, 11274, -4832, 18790, + }, + { + 6906845, -4258997, -1314797, -1664837, 285615, 192200, -17717, 19864, -111669, -55298, + 85899, 259846, -68719, 289373, -567473, -127775, 277562, -394600, -278636, -7516, + -60666, 140123, 136902, -98784, -153545, 112743, -100395, 833224, 48855, -111132, + 54224, -14496, -133681, 224949, -122943, 22549, -3758, -495532, 16106, -81604, + -222801, -79994, 85362, 69256, 30065, 15032, 74088, 108985, 41876, 86436, + -164283, 112206, 121870, -69256, -61740, -29528, -51540, -175557, -86436, -26844, + 73014, -107374, 33823, 13959, -26307, 5369, -8590, -83215, -10201, 26307, + -5369, -29528, -68183, -35970, 55298, 8590, 30602, 51003, -28454, 20401, + 35970, -4295, 24696, 15032, -50466, -4832, 8590, 5369, -12885, -11274, + 3758, -15032, -10737, -18254, -17717, 13959, + }, + { + -273804, 571231, 1219234, -292058, -20401, -64961, 28454, 64425, 96637, 96637, + -60130, -93416, 38118, -497142, -1297080, -248571, 1592359, -841277, -166967, 2934000, + 51003, -509491, -544387, -551903, 225486, -162672, 40802, 52613, 557272, 513785, + 138513, -192737, 37581, 268435, 103616, 227633, -59056, 192200, 102542, 6442, + 166967, 26844, -117575, 45634, 73551, 71941, -51003, -126165, -83215, 72478, + -15032, 79994, -64961, -53687, 76773, 48855, 40265, -22012, 20401, 44023, + -1611, -51003, 24696, -4832, 15032, 51003, -45634, -26307, -8053, -24696, + -14496, 80531, 38118, -11274, 8590, 31675, 41339, 42950, 25770, -13422, + -23622, 41339, -9127, -34360, -10201, 12885, 9127, -8590, 15569, 11811, + -19327, -41876, 11274, 33286, 10201, -4295, + }, + { + -1420560, -36447092, -126165, 889595, -100932, 70330, -74625, 213675, 367220, -432718, + 140123, 84826, -19864, 263604, -35433, 142808, -190052, 304943, -102005, -394600, + -124554, -191126, 35970, -110595, -1074, -294205, -117575, 243739, -170725, -119722, + 70867, 159988, 86436, 69256, -102542, -77309, 75162, 84289, -12348, -20401, + 81068, -79457, -124017, -19327, -4832, 31675, -60130, -127775, 6442, -45097, + -107911, -22549, -93952, -26844, -82141, 62277, 83752, 10737, 108985, 16643, + 86973, -18254, 10737, -23085, -27380, 31139, 104690, 15569, -53150, 31675, + -6442, -74625, 17180, 78920, -14496, -15569, 11274, 22549, -34897, 38655, + 26307, -33823, 18254, 38118, -32749, -26844, 49392, 13422, 0, -14496, + 5906, 25770, -19864, -9127, -12348, -3758, + }, + { + -303332, 477278, 975494, -10737, 117575, -128849, -40802, -93952, -49929, 125091, + -35433, -212601, 75162, 243739, -1142998, 389231, -1328219, -960999, 191126, 708670, + -616328, -150861, 199716, 526134, 150861, 413391, 478889, -127775, -186294, -287763, + -104690, -12348, 139050, 95026, -59593, -61740, -48318, 98784, -149787, 60130, + -42950, 66035, 90194, -67109, -53687, 43487, 181999, 113817, -121333, -10201, + 114354, 24696, -36507, 24696, 84826, 26307, 34897, 88047, -63888, -106300, + -24159, 11811, 38118, -57982, -29528, -82141, -11274, 69256, 53150, -13422, + 23085, -21475, -27380, -4832, 37581, 9127, -6442, 61740, 27380, 14496, + 7516, -66572, -22549, -12885, 10737, 13959, 5906, 31675, -25233, 16106, + 18254, -22549, 12885, -2684, -2684, -5369, + }, + { + 8184060, 19821810, -2852932, 1236414, 267899, 145492, 127238, -78920, -350040, 410169, + 69793, -365609, -464393, 180389, 427349, 426276, 87510, -3221, 92879, 148176, + 217970, -105227, -253403, 310311, -51540, -95563, 341987, -42413, 102005, -158914, + -32212, -49929, 125091, -220654, 73014, 170725, -492311, -213138, 125091, 76236, + 326954, 89657, 202400, 39728, 204548, 537, 130460, 85362, -227096, 10201, + 155693, 66572, -72478, 106300, -17180, -52613, -45097, 63351, 32749, -107374, + 9127, 49392, 26307, 14496, -41876, -96637, 31675, 19864, -31675, 18790, + 22012, -54761, 6442, 24696, 40265, -17180, -34360, 11274, 10201, -2684, + 537, -8053, -22549, -12348, -35433, -28454, -9127, 20401, 40265, 25770, + -5369, -5369, -14496, 2684, 28454, -2147, + }, + { + -11274, 2939905, -666257, 555661, -325881, 422517, 636729, -298500, 124017, 178778, + 100395, -467615, -580357, 401043, 324807, 195958, -485331, -511638, 323196, 217970, + -239981, -520765, -123480, 397821, 454193, 284542, -37044, 70330, -251792, -132607, + 16643, -13422, 126702, 318901, -7516, -19327, 185757, 184147, 206158, 19864, + 8053, 35433, 75699, -117038, -31139, 173409, -101469, -20401, -53150, -79994, + 200790, 52613, -13959, 117575, -86973, -146566, -22549, -24159, 36507, 59593, + 0, -12348, -37581, -76236, -37581, -88584, 28454, 85362, 107374, 67646, + -23085, 19327, -23622, -33286, 30602, -10737, -20938, -18254, -10201, -34897, + -34897, -8053, 12348, 16643, 16643, 36507, -4295, -11811, -8053, -1074, + 19864, -2684, 12885, -1611, 30065, 23085, + }, + { + 1137630, 4267587, -701153, -745714, -53687, 1336809, 1201517, -369904, -573915, -205085, + 69256, -12348, 90194, 294205, 481036, 60130, 201327, 97711, 326418, 105764, + 194347, -133681, 140123, 73551, 157840, 99858, 47245, -40802, -200253, 226560, + 396748, 84826, 54761, 47245, 149250, -266825, -146029, 99321, -107911, -9127, + 197032, 173946, -116501, -41339, -141197, -64425, 33823, 125091, 106837, -57982, + -1611, 33823, 130997, -13422, -110059, -62277, -43487, 52613, 125091, -58519, + 12348, 4832, -20938, -41876, 15569, 12348, -46708, -17717, -34897, 7516, + -18790, -23085, 3758, 61203, 43487, 28991, 45634, -22012, -32212, -11811, + -31139, 29528, -12348, -13422, 20938, 7516, 43487, 12348, 8053, -18790, + 1611, 19864, -8053, -33286, 4295, 27380, + }, + { + 141734, 874026, 187368, 6979, 107374, 135828, -260919, -146566, -1074, -146029, + -6442, -344671, 594853, -493921, 3663070, -687195, -84289, 355409, 481036, -140660, + -1238561, 370441, 442382, 423591, 137976, -435939, -11274, -324807, -386547, 31675, + 33286, -348429, -91805, -31675, 133681, 62814, 12348, 103079, 155156, -44560, + 53150, -139050, -537, 198642, 95563, 47245, -82141, -13422, 104153, 14496, + 108448, -71404, -30602, 61740, 5369, 31675, -62814, -150324, -136902, -38655, + -95563, 49392, 537, -41876, -96637, 41876, 14496, -45634, 25233, -16106, + 48318, 16643, 10201, 35433, 13422, 49392, 49929, 1074, -8590, -13422, + -13959, 8590, -44560, -29528, -17180, -13422, -39728, -27917, -5906, 1074, + 3221, 12885, 13422, -9127, -2147, 18790, + }, + { + -1978369, 6925098, 708133, 913217, -78920, 113817, 821949, -313533, -132607, -282394, + 446677, -49929, 138513, 1030255, 175557, -432181, -195421, 275415, 112743, 92879, + 557809, -81068, 23085, -457414, 17180, 35433, 17717, -86973, 39192, -163209, + -67109, 136902, -108448, -245350, -221728, 214748, 99321, -164283, 537, 26844, + -104690, -252329, -142271, -121870, -294205, -259846, -95563, -78383, -187368, 108985, + -143881, 125628, 1611, 32749, 175557, 111132, 24696, 29528, -137439, -32212, + 104690, -6442, -19864, 23085, 31675, -37044, -24696, -31675, 5369, 73551, + -19327, -78920, -6979, 42950, 4832, 14496, -25770, 10201, 17180, 34897, + 34897, -49929, -34360, 11811, 61203, 16643, -62277, -39728, -16643, -22012, + -3758, -10201, 21475, 31675, 13422, 46708, + }, + { + 63351, 1939178, -679679, -45634, 170725, 91268, 153545, 33823, 252866, -99858, + -48855, -199179, -240518, 2659122, 5071820, 813896, 560493, 226560, -145492, 2684, + 106837, 101469, 411780, 522375, -205622, -88584, 498753, -98247, 157840, -232465, + -188442, -266288, -176631, -141734, -18254, -125091, -256087, -272194, -16106, 19864, + -145492, 153545, 67109, -6442, -7516, -63351, 33286, 106837, 48855, -9127, + -48318, 132607, 56371, -68183, -39728, -4295, -66035, 14496, -537, -51003, + 90194, 85899, -47245, -72478, 49929, 16643, -68719, 73551, 26844, 18254, + -41339, -66035, -1611, 32749, -10201, 17717, -15032, -68719, 25770, -10737, + 37581, 56371, -32212, -10737, -12885, -49929, -30065, 21475, 18790, -24159, + 22549, 53150, 3221, -20401, 30602, 7516, + }, + { + 179852, -5887864, 579821, 9664, 126702, -82678, 331249, -96100, 119185, -3758, + 592706, 632434, -127775, 506269, 2218351, 804770, 129386, 385473, 384400, -23085, + -228170, -194884, -85899, 154619, 177167, 38655, -192737, -497142, 365072, -6979, + -23622, 147640, 41339, -157840, 46708, -188979, -82141, -166430, 146029, -26307, + -16643, 38655, 128312, -156766, -103079, -41876, -132607, 52076, 82141, 67646, + -103616, -5906, 130997, 92342, 13959, 22012, -33823, -67646, 3221, 1074, + 12348, -20938, -49929, -16106, -68183, -51003, -30065, 3758, -36507, 3758, + 1611, -84826, -51003, 77309, 64425, 6442, -48855, -16106, 22549, -28454, + -52076, 26307, 38655, 1611, 537, 13422, -10737, 27917, 29528, -28991, + -3758, -20401, -13422, -5906, 537, 26844, + }, + }, + { + { + 120796, -3971771, 964220, -167504, 151934, 25233, -84826, 228707, 537, 163746, + -293132, 68719, 294205, -932545, 729608, 794569, -291521, 77846, -741956, 230854, + 295279, 136902, 437550, -406948, 110059, -509491, -243203, -273804, 570694, 545998, + -91268, 100932, 274878, -326954, -114890, 252866, 63351, -217433, -461172, 6979, + -117038, -37044, -112206, 22012, 17180, -3758, -191126, -97711, 37044, -59056, + 171799, 41876, -32212, 97711, 101469, -110595, -12348, -60666, -56371, 31675, + 82141, 110059, 62814, -33823, -30065, 86973, -37044, -9127, 47782, 23622, + -33286, 4832, -16106, -34360, 19327, 2684, -20938, -12885, 25770, -4295, + -9664, 17717, 49392, 47782, 8590, -26307, -22012, 4832, 1074, -34897, + 4832, 13422, 8053, 0, -28991, -18790, + }, + { + -2800856, -7233262, 3688840, -539018, -570157, 188979, -173409, -649614, -424665, 234076, + -148176, 139050, -54224, -118112, 419296, -703301, -394063, 132607, 822486, 135291, + 213675, -537, -100932, -114354, -120796, -51540, -251792, -6442, 345208, 26307, + -118648, -289373, -305480, -260382, 73014, 134218, -178778, -276489, -319975, -197032, + 36507, 172872, 108448, -74625, 169114, -43487, -91805, -62814, -53150, 97174, + -21475, 128849, 113817, 104153, 32212, 15032, -19864, 113817, -16106, -9664, + 52613, -1611, -8053, -16106, -63888, -83215, 5906, 84289, 38655, 17717, + -28991, -56908, -10737, 10737, -62814, -29528, 28454, -35970, -26844, 2147, + 34360, 1611, -16106, 17180, 28991, -63888, 3221, 20401, -18254, 3221, + -9127, -2684, 13959, 1074, 4295, -9127, + }, + { + 715649, -909996, -4708895, 1474248, 646393, -192200, 27917, 271120, 82141, -394063, + -244813, 27917, -518080, 481036, -265214, 118648, 38655, -64425, 88047, -195958, + 134755, 243203, 187905, 84289, 34360, 485868, 101469, -259309, -463320, -117575, + 262530, 107374, 77309, -210990, -273804, -37581, 33286, 13959, -106300, -93952, + 109522, 35970, -87510, 94489, 9664, -112206, -79994, 31139, 110595, -68183, + -156229, -68719, -16643, 80531, -51003, 34360, 134218, 85899, -4832, -38655, + 68719, 159988, 74088, -35433, 37581, 49392, 22549, 38118, -8590, 33286, + 9664, -16643, 22549, 32212, 15569, -34360, 2684, 5369, -15569, -39192, + 6442, 7516, 33823, -2147, -38655, 9664, -2684, -15569, -537, -22549, + 23622, 25233, 8590, 8053, -14496, 4832, + }, + { + 10737, -3448859, -164283, 287763, 47245, -129386, -8053, 40265, 60666, 6442, + -104690, -222265, -85362, -310848, -558346, 655519, -744640, -588947, -1468879, 474057, + -458488, -1051730, -442382, 770947, -143881, -431644, -357556, 788663, -879931, -44560, + 245887, 584652, 230318, -17180, -151398, 239444, 190052, -73551, 223875, 96637, + 113280, 36507, 41339, -44023, -87510, 8590, 176094, -92879, 36507, 75162, + -48318, -8590, 91805, 17180, 135828, 16643, -108985, 32212, 56371, -66572, + -78920, 45634, -15032, 18254, 86436, 23622, -1074, -6442, 89121, 24159, + -81068, -64425, 37581, 40802, -23085, -13422, 56371, 54224, 1611, -24159, + -32749, 33286, 12885, 8053, -1611, -41339, -1611, 19864, 23622, -4295, + -19327, 20938, 37044, 3758, 3758, 18254, + }, + { + -5256503, -19937238, 79457, -1318555, 253403, 179852, -23622, -3758, -83752, 20401, + 351114, -60130, -174483, 687195, -213675, -73551, 1611, -598074, -77846, 12885, + -53150, 126165, 56908, -282394, 41339, -33286, -90731, 1241782, -9664, -253940, + 73014, -112206, -69256, 219043, -132070, -32749, -182536, -193274, 210453, 36507, + -111132, 13422, 161598, 21475, -29528, 118112, 165893, 79457, -22012, 114354, + -5369, 130460, 64961, -78383, -39192, 45634, -55298, -122407, -38655, 537, + 71404, -78383, 88584, 3221, -35970, -24696, -17180, -50466, 44023, 22012, + -40802, -69256, -73014, 16106, 51003, -5906, 34360, 6979, -20938, 24696, + 24159, -9127, 13422, -15569, -38118, 9127, 8590, -537, -32749, -11274, + 4832, -7516, -6442, -22549, 1611, 10737, + }, + { + -132070, 632434, 412317, -281857, -47782, -54224, 78383, 59056, 88584, 24159, + -141734, -162135, -57445, 71941, -323733, 59056, 1767379, -592706, 434329, 2876554, + -120259, -238908, 554588, -153545, -355409, -52613, 333397, 195421, -132070, -312459, + 207232, 57445, 78383, 312996, 71941, 146029, -58519, 143881, 66572, -95563, + 223875, -42950, -67646, 147103, 91268, 9127, -71404, -93952, -45097, 91268, + 79994, 28454, -175020, -34897, 84289, -3758, -15569, -63351, -11811, 54761, + 16106, -3221, 22549, 11811, 34897, 42413, -31139, -20401, 3221, -14496, + 27380, 59593, 19864, 3221, 39192, 32212, 46708, 43487, 3221, -32749, + -3221, 20938, -20938, -28991, 4295, 12348, -4295, -11274, 11811, -2147, + -30602, -19327, 32212, 22549, 4295, -15569, + }, + { + 5784247, -29011430, -1870458, 361851, 12348, 179852, 155156, 73014, 188979, -192200, + 207769, -45097, 28991, 54224, -388158, 70867, -41339, 328028, -156766, -281857, + -241055, -127238, 116501, -8590, -152471, -302795, 219043, 345745, -197569, -141734, + 119185, 84826, 1611, 169114, 33823, 49929, -66035, 52613, 95026, 130460, + 188979, 10737, -32212, -20938, 49392, 20938, -163209, -76236, -22549, -187905, + -79994, 44560, -33823, -5369, 30065, 106837, 63351, 25770, 138513, 30065, + 97711, -537, 25770, -18790, 7516, 73014, 91805, -8053, -37581, 47245, + -26307, -65498, 66572, 69793, -31139, -26307, 6979, 537, -25770, 35433, + -10201, -15032, 44023, 31675, -63351, 8053, 40802, -8590, -19864, -15032, + 18790, -537, -11811, -11811, -13422, 5906, + }, + { + -144418, 776315, 140660, -125628, 25233, -121333, 32749, -27917, -31675, 74088, + -130997, -246424, -272194, 326954, -800475, 1248225, 305480, 16643, -16643, 44560, + -563178, 665720, -569620, -617938, -117575, -421444, 456877, -164819, -73551, -219580, + -140660, -95563, 99321, 26307, -49392, -55298, 47782, 136902, -1611, 42950, + -55298, 42413, -6442, -17180, -7516, 75162, 200790, -42413, -142271, 71404, + 102542, 83215, -68719, 48855, 76236, 50466, 66572, 120796, -67646, -5906, + 38118, 78920, 42950, -8053, 5906, -97174, 20401, 74625, 31675, -45097, + 38655, -8053, -28991, -1611, 35433, -5906, 25770, 53687, -2684, 10201, + -537, -51540, -18254, -2147, 24159, 6442, 25770, 8590, -23622, 34897, + 1074, -8053, 5906, -14496, 6442, -4295, + }, + { + -9388262, 472983, 1891933, 1085553, -48855, 143881, 164819, -242129, -143881, 515396, + -333397, -606127, -284542, 360777, 170188, 551366, 333934, 176631, 204011, 117575, + 328565, -311922, -201327, 570694, -63888, 20938, 258772, -311922, 152471, 27917, + 45634, -97711, 157303, -82678, 40265, -5906, -263067, 36507, 276489, -20401, + 355945, 71941, 233539, 110059, 169114, 74625, 95026, -134218, -316754, -74088, + 123480, 29528, -60130, 97711, 7516, -75699, -64425, 40802, -8053, -119722, + -9127, 33286, 33823, -42413, -99858, -44560, 51003, -6442, -5369, 13959, + 537, -51540, 18790, 28991, 66572, -60130, 4832, 46708, 6442, -35433, + 3758, -17717, -31675, -38118, -38118, -30065, 11811, 31675, 25770, 10201, + -18790, -2684, -23622, 12885, 18254, -3758, + }, + { + 152471, 4743255, 504659, -74088, -353261, 693100, 215822, -401043, 164819, 207232, + 87510, -431107, 32749, 756451, 604517, 708670, -307627, -263067, 780610, 242666, + -97174, 2147, -49392, 153545, 93952, 255551, 83752, 58519, -260382, 268435, + 3758, -11274, 29528, 212064, -39728, 83215, 273267, 159988, 74088, 85899, + 128312, 129386, 71404, -140660, 87510, 177704, 15032, -31675, -51540, 18790, + 229244, 20938, -12348, 1611, -206695, -97711, 27917, 2684, 66035, 33823, + -40802, -4295, -67646, -77846, -60666, -61740, 62277, 82141, 105764, 29528, + -10201, -13422, -43487, -13959, 38655, -16643, -38118, -8590, -12348, -40802, + -16643, 2147, 18790, 19327, 28991, 13959, -23085, -537, -6979, 18790, + 9664, 12885, 15032, 0, 32749, 13959, + }, + { + -908386, 1136556, -787053, -457951, -6979, 706522, 242666, -360777, -286152, 207232, + 28454, -53687, 138513, 271120, 244813, -205622, 374736, 318901, 312996, 124554, + -1611, 85899, 116501, 147640, 175020, 14496, -158914, -110595, -93952, 247497, + 309775, -162135, -82678, -39192, 167504, -432181, -120796, 81068, -156229, 233539, + 204011, 43487, -123480, -71404, -128849, -56371, 8590, 147640, 38655, -111669, + 24159, 22012, 95563, -44023, -93416, -39192, -13422, 121333, 69256, -67646, + 537, -10737, -24159, -49392, 9127, -3221, -23085, -9127, -2684, 2147, + -12348, -6442, 20401, 74625, 26307, 37581, 28454, -56908, -10201, -5906, + -17717, 30065, -30602, 15569, 8590, 35433, 28454, 17180, 3221, -18790, + 10201, 6442, -19864, -21475, 15569, 13959, + }, + { + -35970, 650151, 237834, -148176, 131533, 12885, -312996, -58519, 162135, 63888, + 153545, -250719, 471373, -2158758, 1611687, -813359, 197032, 782758, 525597, 18790, + -768262, 277562, 396211, 384936, 75162, -414464, -323733, -336081, -346282, 453656, + -107911, -248034, -262530, -71941, 6979, -139050, -20401, 325344, 134218, -7516, + -67109, -155156, 73551, 177167, 0, -21475, -127238, 22012, 99321, 54224, + 86973, -94489, 10201, 67646, 17717, 51540, -56371, -193810, -89657, -37044, + -4295, 33823, -20401, -84826, -76236, 98247, -7516, 2147, 28991, -16106, + 48855, 2147, 24696, 39728, 1611, 55835, 53150, -12348, -8053, -22549, + -3758, 8590, -56371, -35433, -11274, -24696, -40265, -19864, 1611, 5906, + 6979, 16643, 15569, -21475, -6442, 22012, + }, + { + 1087164, 11100880, 1109175, 654446, 72478, 197032, 711891, -424128, -209380, -41339, + 455803, -205622, -113817, 35433, 18790, -443455, -248034, 147640, -62277, 306016, + 176094, -286689, -12885, -181999, 84826, 53687, 51540, 76236, 217970, -24159, + -44023, 51540, -55835, -133681, -162672, 176094, 71941, -28454, 115427, 97711, + -51003, -309775, -23622, -147640, -244276, -204011, 64425, -100932, -124017, 93952, + -60666, 183610, 36507, 124554, 77309, 92342, -27380, -3758, -142271, 63351, + 97174, -53150, -45097, 31675, 26844, -44023, -47782, -46171, 31139, 54761, + -61203, -49392, 50466, 44023, -15032, 537, -46171, 21475, 16106, 29528, + -12885, -59056, -12348, 22549, 40265, -22012, -77846, -24696, -6979, -22549, + -2147, -5906, 44560, 22012, 17180, 37044, + }, + { + 31675, 1749125, -496606, 139586, 85362, 23085, 110059, 151398, 135291, -208843, + 41339, -282931, -62814, 381715, 551366, -752156, 283468, 31675, 165893, 403727, + 150861, -88047, 428960, 491237, 73014, 335544, 116501, 12885, 452045, -79457, + 67646, -60666, 122943, 9127, -376347, -83752, -169651, -304943, 42950, -34360, + -98247, 148176, 20938, -126165, -53150, -100395, 69793, 75699, 105227, -44560, + 17717, 82141, -55835, -92342, -60130, -82141, -82141, 2684, -5906, -69793, + 163746, 44560, -51003, -41339, 81604, -32749, -65498, 90194, 22549, 18790, + -42413, -54224, 18254, 28454, 3758, 40802, -49929, -26307, -5369, 3758, + 65498, 24159, -31139, -16106, -31139, -45634, -30065, 35433, -3758, -10201, + 44560, 37581, -17180, -9127, 35970, -15569, + }, + { + 977105, -5772436, -430570, -480499, 501974, 813359, 347892, -212601, -147103, -135828, + 474594, 208843, -199716, -439160, 631360, 539555, -284005, -97711, 19327, -199179, + -397821, 32749, 22549, 256087, -5906, -46171, 2684, -129923, 357019, -95563, + 35970, 223875, 83752, -196495, -108985, -213138, 155693, 100395, 198105, 92879, + 71404, 44560, 61740, -133144, 84826, -54224, -164819, 130460, 140123, 128849, + 20938, 11811, 77846, 20401, 39728, -16643, -38118, 2147, -24696, -3758, + 537, -104690, -79457, -36507, -40802, -19864, -31675, -31675, -13959, 19864, + -12348, -74088, -7516, 99321, 38118, -22549, -42950, 2684, 22549, -30065, + -16106, 34897, 14496, -11274, 5369, 30065, -5369, 51003, -3221, -31139, + 5906, -24696, -3758, 11274, 2147, 15569, + }, + }, +}; + const float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= { { @@ -47684,11 +94564,24 @@ const float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_M } }; +#ifdef IVAS_FLOAT_FIXED +const Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX] = +{ + 921702144, 440470368, 434517536, 447499072, 463134912, 507976512, 495205440, 490485280, 488481664, 470204416, 485509536, 473953952, 475669760, 479900320, 480402816, 487614080, 489409376, 479041312, 472446400, 469403424, 473341888, 468688320, 457950880, 451686688, 445424608, 426812384, 421443680, 418581056, 408736992, 396210720, 387262176, 378315744, 379030848, 381356576, 394241504, 420728544, 436476064, 447572096, 460993888, 472446400, 478710624, 494816736, 502356544, 501753120, 507521248, 509872736, 518894336, 517796960, 512920032, 520515680, 528908032, 528169312, 528495712, 526983904, 523880768, 524250144, 513828416, 518561472, 504280704, 543399232 +}; +#endif + const float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX] = { 0.429201f, 0.205110f, 0.202338f, 0.208383f, 0.215664f, 0.236545f, 0.230598f, 0.228400f, 0.227467f, 0.218956f, 0.226083f, 0.220702f, 0.221501f, 0.223471f, 0.223705f, 0.227063f, 0.227899f, 0.223071f, 0.220000f, 0.218583f, 0.220417f, 0.218250f, 0.213250f, 0.210333f, 0.207417f, 0.198750f, 0.196250f, 0.194917f, 0.190333f, 0.184500f, 0.180333f, 0.176167f, 0.176500f, 0.177583f, 0.183583f, 0.195917f, 0.203250f, 0.208417f, 0.214667f, 0.220000f, 0.222917f, 0.230417f, 0.233928f, 0.233647f, 0.236333f, 0.237428f, 0.241629f, 0.241118f, 0.238847f, 0.242384f, 0.246292f, 0.245948f, 0.246100f, 0.245396f, 0.243951f, 0.244123f, 0.239270f, 0.241474f, 0.234824f, 0.253040f, }; +#ifdef IVAS_FLOAT_FIXED +const Word32 fastconvReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX] = +{ + 1254130, 450971, 500363, 455266, 551903, 3259880, 2478196, 2355789, 2716566, 2787433, 4982162, 5222680, 5768141, 5802501, 5652177, 5506148, 5866925, 5856188, 5602785, 5420248, 7337951, 3828963, 2119566, 1501091, 1301375, 1151051, 1097364, 1221918, 1288490, 1166083, 2699387, 2596307, 2055141, 1290637, 588410, 227633, 154618, 109521, 85899, 64424, 51539, 38654, 30064, 27917, 25769, 23622, 19327, 19327, 17179, 17179, 15032, 12884, 10737, 6442, 4294, 4294, 2147, 2147, 0, 0 +}; +#endif const float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX] = { diff --git a/lib_rend/ivas_rom_binauralRenderer.h b/lib_rend/ivas_rom_binauralRenderer.h index 8354ef582..a65192ac8 100644 --- a/lib_rend/ivas_rom_binauralRenderer.h +++ b/lib_rend/ivas_rom_binauralRenderer.h @@ -54,11 +54,29 @@ extern float leftHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_S extern float rightHRIRReal_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; extern float rightHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 leftHRIRReal_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 leftHRIRImag_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 rightHRIRReal_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 rightHRIRImag_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 leftHRIRReal_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 leftHRIRImag_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 rightHRIRReal_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 rightHRIRImag_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 leftHRIRReal_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 leftHRIRImag_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 rightHRIRReal_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; +extern Word32 rightHRIRImag_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]; + extern float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; +extern Word32 leftHRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; +extern Word32 leftHRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; +extern Word32 rightHRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; +extern Word32 rightHRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; + extern float FASTCONV_HOA3_latency_s; extern float FASTCONV_HOA2_latency_s; extern float FASTCONV_FOA_latency_s; @@ -77,7 +95,16 @@ extern float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_M extern float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; +extern Word32 leftBRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; +extern Word32 leftBRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; +extern Word32 rightBRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; +extern Word32 rightBRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; + /* Reverberation parameters based on BRIRs for fastconv */ +#ifdef IVAS_FLOAT_FIXED +extern Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; +extern Word32 fastconvReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; +#endif extern float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; extern float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 5d7adc221..4822e544b 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -133,7 +133,7 @@ void ivas_sba_prototype_renderer_fx( /* determine SPAR parameters FOR this time slot */ md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; // delete below - floatToFixed_arr( hSpar->hFbMixer->cldfb_cross_fade, hSpar->hFbMixer->cldfb_cross_fade_fx, Q15, CLDFB_NO_COL_MAX ); + //floatToFixed_arr( hSpar->hFbMixer->cldfb_cross_fade, hSpar->hFbMixer->cldfb_cross_fade_fx, Q15, CLDFB_NO_COL_MAX ); ivas_spar_get_parameters_fx( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat_fx ); @@ -145,10 +145,10 @@ void ivas_sba_prototype_renderer_fx( ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; // delete below - FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) - { - floatToFixed_arrL( bin2band->pp_cldfb_weights_per_spar_band[idx], bin2band->pp_cldfb_weights_per_spar_band_fx[idx], Q31, IVAS_MAX_NUM_FB_BANDS ); - } + //FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) + //{ + // floatToFixed_arrL( bin2band->pp_cldfb_weights_per_spar_band[idx], bin2band->pp_cldfb_weights_per_spar_band_fx[idx], Q31, IVAS_MAX_NUM_FB_BANDS ); + //} FOR( out_ch = firstOutCh; out_ch < outChEnd; out_ch++ ) { out_re_fx[out_ch] = 0; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 3ad19a9a9..9215f0068 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1988,28 +1988,59 @@ typedef struct ivas_hrtfs_fastconv_struct { float FASTCONV_HOA3_latency_s; float FASTCONV_HRIR_latency_s; + +#ifdef IVAS_FLOAT_FIXED + Word32 ***leftHRIRReal_HOA3_fx; + Word32 ***leftHRIRImag_HOA3_fx; + Word32 ***rightHRIRReal_HOA3_fx; + Word32 ***rightHRIRImag_HOA3_fx; +#endif float ***leftHRIRReal_HOA3; float ***leftHRIRImag_HOA3; float ***rightHRIRReal_HOA3; float ***rightHRIRImag_HOA3; +#ifdef IVAS_FLOAT_FIXED + Word32 ***leftHRIRReal_fx; + Word32 ***leftHRIRImag_fx; + Word32 ***rightHRIRReal_fx; + Word32 ***rightHRIRImag_fx; +#endif float ***leftHRIRReal; float ***leftHRIRImag; float ***rightHRIRReal; float ***rightHRIRImag; +#ifdef IVAS_FLOAT_FIXED + Word32 ***leftBRIRReal_fx; + Word32 ***leftBRIRImag_fx; + Word32 ***rightBRIRReal_fx; + Word32 ***rightBRIRImag_fx; +#endif float ***leftBRIRReal; float ***leftBRIRImag; float ***rightBRIRReal; float ***rightBRIRImag; float FASTCONV_BRIR_latency_s; +#ifdef IVAS_FLOAT_FIXED + Word32 ***leftHRIRReal_HOA2_fx; + Word32 ***leftHRIRImag_HOA2_fx; + Word32 ***rightHRIRReal_HOA2_fx; + Word32 ***rightHRIRImag_HOA2_fx; +#endif float ***leftHRIRReal_HOA2; float ***leftHRIRImag_HOA2; float ***rightHRIRReal_HOA2; float ***rightHRIRImag_HOA2; float FASTCONV_HOA2_latency_s; +#ifdef IVAS_FLOAT_FIXED + Word32 ***leftHRIRReal_FOA_fx; + Word32 ***leftHRIRImag_FOA_fx; + Word32 ***rightHRIRReal_FOA_fx; + Word32 ***rightHRIRImag_FOA_fx; +#endif float ***leftHRIRReal_FOA; float ***leftHRIRImag_FOA; float ***rightHRIRReal_FOA; @@ -2018,6 +2049,10 @@ typedef struct ivas_hrtfs_fastconv_struct int16_t allocate_init_flag; /*Memory allocation flag 0: if the hrtf pointers are allocated at application level , 1: of allocated at ivas_binaural_hrtf_open() */ +#ifdef IVAS_FLOAT_FIXED + Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 fastconvReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; +#endif float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 219a52c60..33bebf42f 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1395,6 +1395,8 @@ static ivas_error create_HRTF_from_rawdata( } #endif +#ifdef IVAS_FLOAT_FIXED + static ivas_error create_fastconv_HRTF_from_rawdata( HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ char *hrtf_data, /* i : pointer to binary file */ @@ -1405,7 +1407,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( int16_t i, j; char *hrtf_data_rptr; ( *hHRTF )->allocate_init_flag = 0; - ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); + ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); hrtf_data_rptr = hrtf_data; @@ -1677,14 +1679,306 @@ static ivas_error create_fastconv_HRTF_from_rawdata( memcpy( ( *hHRTF )->fastconvReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + floatToFixed_arrL( ( *hHRTF )->fastconvReverberationTimes, ( *hHRTF )->fastconvReverberationTimes_fx, Q31, CLDFB_NO_CHANNELS_MAX ); memcpy( ( *hHRTF )->fastconvReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + floatToFixed_arrL( ( *hHRTF )->fastconvReverberationEneCorrections, ( *hHRTF )->fastconvReverberationEneCorrections_fx, Q31, CLDFB_NO_CHANNELS_MAX ); } return IVAS_ERR_OK; } +#else +static ivas_error create_fastconv_HRTF_from_rawdata( + HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ + char *hrtf_data, /* i : pointer to binary file */ + RENDERER_TYPE rend_type, /* i : Renderer type */ + BINAURAL_INPUT_AUDIO_CONFIG input_cfg /* i : Input binaural config */ +) +{ + int16_t i, j; + char *hrtf_data_rptr; + ( *hHRTF )->allocate_init_flag = 0; + ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); + + hrtf_data_rptr = hrtf_data; + + /* BINAURAL_CONVBANDS */ + if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + /* HRIR */ + if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + { + ( *hHRTF )->FASTCONV_HRIR_latency_s = *( (float *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( float ); + + if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + } + } + } + else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) + { + /* HRIR_HOA3 */ + ( *hHRTF )->FASTCONV_HOA3_latency_s = *( (float *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( float ); + + if ( HOA3_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA3_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + } + else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) + { + /* HRIR_HOA2 */ + ( *hHRTF )->FASTCONV_HOA2_latency_s = *( (float *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( float ); + if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HOA2_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + } + else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) + { + /* HRIR_FOA */ + ( *hHRTF )->FASTCONV_FOA_latency_s = *( (float *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( float ); + if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + } + } + } + /* BRIR */ + else if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) + { + ( *hHRTF )->FASTCONV_BRIR_latency_s = *( (float *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( float ); + + if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + if ( BINAURAL_NTAPS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->leftBRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + } + } + for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) + { + for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) + { + memcpy( ( *hHRTF )->rightBRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + } + } + + /* Reverb Parameters */ + if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); + + memcpy( ( *hHRTF )->fastconvReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + + memcpy( ( *hHRTF )->fastconvReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + } + + return IVAS_ERR_OK; +} +#endif /*---------------------------------------------------------------------* * load_fastconv_HRTF_from_binary() -- GitLab From 288585afd1ba1998746cf61cf0d37d9d9fd48d74 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 11 May 2024 11:07:45 +0530 Subject: [PATCH 030/101] Fix for crash issues observered for SBA format with LTV set LTV crash for below cases are fixed: [SBA at 24.4 kbps, 32kHz in, 32kHz out, STEREO out] [SBA at 32 kbps, 48kHz in, 48kHz out, MONO out, DTX, bandwidth switching] --- lib_com/float_to_fix_ops.c | 10 +++++----- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 3de3c441a..902b03787 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -789,11 +789,11 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //st->hFdCngDec->msPeriodog_ST_fx[p] = (Word32) ( st->hFdCngDec->msPeriodog_ST[p] * ( 1u << ( 31 - st->hFdCngDec->msPeriodog_ST_exp ) ) ); } - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q4; // Q4 - for ( int p = 0; p < FFTCLDFBLEN; p++ ) - { - st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = (Word32) ( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - } + // st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q4; // Q4 + //for ( int p = 0; p < FFTCLDFBLEN; p++ ) + //{ + // st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = (Word32) ( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); + //} //st->hFdCngDec->hFdCngCom->sidNoiseEstExp = 31 - Q4; //st->hFdCngDec->partNoiseShape_exp = 31 - Q4; //for ( int p = 0; p < NPART; p++ ) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 1aadd2881..d13d7eab9 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1195,7 +1195,7 @@ void ivas_sba_dirac_stereo_smooth_parameters_fx( move16(); // The Q format of mixer_mat_prev_fx is Q30 so applying the left shift. hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS] = - L_add(Mpy_32_16_1(hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS], beta), + L_add_sat(Mpy_32_16_1(hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS], beta), L_shl(Mpy_32_16_1(hMdDec->mixer_mat_prev_fx[i_hist][i][j][b], sub((Word16)0x7FFF, beta)), Q1)); move32(); } -- GitLab From 2bf0827cf039a61d24935cb18748f50a4f8ca31f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 11 May 2024 12:03:03 +0530 Subject: [PATCH 031/101] renderer float dependencies cleanup, conversions of few functions to fixed [x] Converted few functions in ivas_rotation.c [x] Cleanup of ivas_objectrenderer_mix.c, reverb_delay_line --- lib_com/cnst.h | 1 + lib_com/float_to_fix_ops.c | 11 +- lib_com/ivas_prot.h | 6 + lib_com/prot_fx2.h | 3 +- lib_dec/ivas_binRenderer_internal.c | 909 ++++------------- lib_dec/ivas_init_dec.c | 42 +- lib_dec/ivas_mct_dec.c | 2 +- lib_dec/ivas_sba_dec.c | 2 +- lib_dec/ivas_stereo_cng_dec.c | 31 +- lib_dec/lib_dec_fx.c | 16 +- lib_rend/ivas_dirac_decorr_dec.c | 13 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 41 +- lib_rend/ivas_objectRenderer_hrFilt.c | 4 +- lib_rend/ivas_objectRenderer_mix.c | 24 +- lib_rend/ivas_objectRenderer_vec.c | 2 +- lib_rend/ivas_reverb_delay_line.c | 83 +- lib_rend/ivas_rom_binauralRenderer.c | 5 + lib_rend/ivas_rom_binauralRenderer.h | 5 + lib_rend/ivas_rotation.c | 1042 +++++++++++++++----- lib_rend/ivas_stat_rend.h | 25 +- lib_rend/lib_rend.c | 83 +- lib_util/hrtf_file_reader.c | 92 +- 22 files changed, 1385 insertions(+), 1057 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 7816c19e0..16ebf808c 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -566,6 +566,7 @@ enum #define FRAMES_PER_SEC 50 #ifdef IVAS_FLOAT_FIXED +#define MAX_PARAM__SPATIAL_SUB_FRAMES_PER_SEC 200 //(FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) #define ONE_BY_FRAMES_PER_SEC ((Word32)(0x028F5C29)) #define FRAMES_PER_SEC_BY_2 (FRAMES_PER_SEC >> 1) #endif diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 902b03787..dc7a3a9f9 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -194,6 +194,13 @@ Word16 Q_factor_L(float x) Q = norm_l(abs((Word32)x)); return Q; } +Word16 Q_factor_L_32( Word32 x ) +{ + Word16 Q = 31; + if ( x >= 1 || x <= -1 ) + Q = norm_l(L_abs( (Word32) x ) ); + return Q; +} Word16 Q_factor_arr(float *x, Word16 l) { Word16 Q = 15; @@ -789,10 +796,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //st->hFdCngDec->msPeriodog_ST_fx[p] = (Word32) ( st->hFdCngDec->msPeriodog_ST[p] * ( 1u << ( 31 - st->hFdCngDec->msPeriodog_ST_exp ) ) ); } - // st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q4; // Q4 - //for ( int p = 0; p < FFTCLDFBLEN; p++ ) - //{ - // st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = (Word32) ( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); //} //st->hFdCngDec->hFdCngCom->sidNoiseEstExp = 31 - Q4; //st->hFdCngDec->partNoiseShape_exp = 31 - Q4; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c801a195b..2253f7694 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -6485,9 +6485,15 @@ ivas_error ivas_binRenderer_open( ); #endif +#ifdef IVAS_FLOAT_FIXED +void ivas_binRenderer_close_fx( + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ +); +#else void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ ); +#endif void ivas_binaural_hrtf_close( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 5ce69999b..2c8c19d58 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -99,7 +99,8 @@ Word16 Q_factor(float x); Word16 Q_factor_L(float x); Word16 Q_factor_arr(float* x, Word16 l); Word16 Q_factor_arrL(float* x, Word16 l); -//Handles the cases where Q is negative +Word16 Q_factor_L_32( Word32 x ); + //Handles the cases where Q is negative Word32 floatToFixed( float f, Word16 Q); float fixedToFloat( Word32 i, Word16 Q); Word32 floatToFixed_32(float f, Word16 Q); diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 11edbc665..890c8367d 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -48,10 +48,6 @@ #include "prot_fx2.h" #include "ivas_rom_com_fx.h" #include "debug.h" -#define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) -#define float_to_fixQ29( n ) float_to_fix( n, Q29 ) -#define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) -#define fix_W64_to_float( n, factor ) ( (float) n / ( ( (Word64) 1 ) << factor ) ) #endif #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -242,18 +238,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( const HRTFS_FASTCONV_HANDLE hHrtf ) { Word16 bandIdx, chIdx; -#ifndef IVAS_FLOAT_FIXED - BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; - - /*-----------------------------------------------------------------* - * prepare library opening - *-----------------------------------------------------------------*/ - IF( ( hBinRenConvModule = (BINRENDERER_CONV_MODULE_HANDLE) malloc( sizeof( BINRENDERER_CONV_MODULE ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } -#else BINRENDERER_CONV_MODULE_HANDLE_FX hBinRenConvModule; /*-----------------------------------------------------------------* @@ -264,7 +249,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } -#endif IF( !isLoudspeaker ) { @@ -323,87 +307,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } /* allocate memory for filter states */ -#ifndef IVAS_FLOAT_FIXED - IF( ( hBinRenConvModule->filterTapsLeftReal = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsLeftImag = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsRightReal = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsRightImag = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) - { - IF( ( hBinRenConvModule->filterTapsLeftReal[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsLeftImag[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsRightReal[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterTapsRightImag[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - } - - - IF( ( hBinRenConvModule->filterStatesLeftReal = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterStatesLeftImag = (float ***) malloc( hBinRenderer->conv_band * sizeof( float ** ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) - { - IF( ( hBinRenConvModule->filterStatesLeftReal[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterStatesLeftImag[bandIdx] = (float **) malloc( hBinRenderer->nInChannels * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) - { - IF( ( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] = (float *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - - IF( ( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] = (float *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); - } - } - } -#else IF( ( hBinRenConvModule->filterTapsLeftReal_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); @@ -498,7 +401,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } -#endif /* set memories */ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -530,65 +432,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } -#ifndef IVAS_FLOAT_FIXED - IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - /* set the memories to zero */ - set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); - set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] ); - IF( isLoudspeaker ) - { - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftBRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftBRIRImag[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightBRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightBRIRImag[bandIdx][tmp]; - } - } - ELSE - { - /* set the memories to zero */ - set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTaps ); - set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTaps ); - IF( isLoudspeaker ) - { - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag[bandIdx][tmp]; - } - ELSE - { - IF( input_config == IVAS_AUDIO_CONFIG_HOA3 ) - { - /* HOA3 filter coefficients */ - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA3[bandIdx][chIdx]; - } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_HOA2 ) - { - /* HOA2 filter coefficients */ - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA2[bandIdx][chIdx]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA2[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA2[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA2[bandIdx][chIdx]; - } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_FOA ) - { - /* FOA filter coefficients */ - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal_FOA[bandIdx][chIdx]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag_FOA[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal_FOA[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag_FOA[bandIdx][chIdx]; - } - ELSE - { - return IVAS_ERR_INVALID_INPUT_FORMAT; - } - } - } -#else IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { /* set the memories to zero */ @@ -648,7 +491,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } } -#endif } } @@ -926,62 +768,42 @@ void ivas_init_binaural_hrtf_fx( { Word16 i; - HrtfFastConv->leftHRIRReal_HOA3 = NULL; - HrtfFastConv->leftHRIRImag_HOA3 = NULL; - HrtfFastConv->rightHRIRReal_HOA3 = NULL; - HrtfFastConv->rightHRIRImag_HOA3 = NULL; HrtfFastConv->leftHRIRReal_HOA3_fx = NULL; HrtfFastConv->leftHRIRImag_HOA3_fx = NULL; HrtfFastConv->rightHRIRReal_HOA3_fx = NULL; HrtfFastConv->rightHRIRImag_HOA3_fx = NULL; - HrtfFastConv->FASTCONV_HOA3_latency_s = 0x00; + HrtfFastConv->FASTCONV_HOA3_latency_s_fx = 0x00; - HrtfFastConv->leftHRIRReal = NULL; - HrtfFastConv->leftHRIRImag = NULL; - HrtfFastConv->rightHRIRReal = NULL; - HrtfFastConv->rightHRIRImag = NULL; HrtfFastConv->leftHRIRReal_fx = NULL; HrtfFastConv->leftHRIRImag_fx = NULL; HrtfFastConv->rightHRIRReal_fx = NULL; HrtfFastConv->rightHRIRImag_fx = NULL; - HrtfFastConv->FASTCONV_HRIR_latency_s = 0x00; + HrtfFastConv->FASTCONV_HRIR_latency_s_fx = 0x00; - HrtfFastConv->leftBRIRReal = NULL; - HrtfFastConv->leftBRIRImag = NULL; - HrtfFastConv->rightBRIRReal = NULL; - HrtfFastConv->rightBRIRImag = NULL; HrtfFastConv->leftBRIRReal_fx = NULL; HrtfFastConv->leftBRIRImag_fx = NULL; HrtfFastConv->rightBRIRReal_fx = NULL; HrtfFastConv->rightBRIRImag_fx = NULL; - HrtfFastConv->FASTCONV_BRIR_latency_s = 0x00; + HrtfFastConv->FASTCONV_BRIR_latency_s_fx = 0x00; - HrtfFastConv->leftHRIRReal_HOA2 = NULL; - HrtfFastConv->leftHRIRImag_HOA2 = NULL; - HrtfFastConv->rightHRIRReal_HOA2 = NULL; - HrtfFastConv->rightHRIRImag_HOA2 = NULL; HrtfFastConv->leftHRIRReal_HOA2_fx = NULL; HrtfFastConv->leftHRIRImag_HOA2_fx = NULL; HrtfFastConv->rightHRIRReal_HOA2_fx = NULL; HrtfFastConv->rightHRIRImag_HOA2_fx = NULL; - HrtfFastConv->FASTCONV_HOA2_latency_s = 0x00; + HrtfFastConv->FASTCONV_HOA2_latency_s_fx = 0x00; - HrtfFastConv->leftHRIRReal_FOA = NULL; - HrtfFastConv->leftHRIRImag_FOA = NULL; - HrtfFastConv->rightHRIRReal_FOA = NULL; - HrtfFastConv->rightHRIRImag_FOA = NULL; HrtfFastConv->leftHRIRReal_FOA_fx = NULL; HrtfFastConv->leftHRIRImag_FOA_fx = NULL; HrtfFastConv->rightHRIRReal_FOA_fx = NULL; HrtfFastConv->rightHRIRImag_FOA_fx = NULL; - HrtfFastConv->FASTCONV_FOA_latency_s = 0x00; + HrtfFastConv->FASTCONV_FOA_latency_s_fx = 0x00; HrtfFastConv->allocate_init_flag = 0x00; FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { - HrtfFastConv->fastconvReverberationTimes[i] = 0x00; - HrtfFastConv->fastconvReverberationEneCorrections[i] = 0x00; + HrtfFastConv->fastconvReverberationTimes_fx[i] = 0x00; + HrtfFastConv->fastconvReverberationEneCorrections_fx[i] = 0x00; } return; @@ -1078,7 +900,7 @@ static ivas_error ivas_alloc_pppMem_fx( return IVAS_ERR_OK; } -#endif +#else static ivas_error ivas_alloc_pppMem( float ****pppMem, const int16_t dim1, @@ -1116,7 +938,7 @@ static ivas_error ivas_alloc_pppMem( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------------* * ivas_allocate_binaural_hrtf() @@ -1157,29 +979,6 @@ ivas_error ivas_allocate_binaural_hrtf_fx( return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3"); } } - IF( ( HrtfFastConv->leftHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA3 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA3 != NULL ) ) - { - return IVAS_ERR_OK; - } - ELSE - { - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" ); - } - } } IF( input_config == IVAS_AUDIO_CONFIG_HOA2 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) @@ -1207,29 +1006,6 @@ ivas_error ivas_allocate_binaural_hrtf_fx( return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2"); } } - IF( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) - { - return IVAS_ERR_OK; - } - ELSE - { - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" ); - } - } } IF( input_config == IVAS_AUDIO_CONFIG_FOA || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) @@ -1257,29 +1033,6 @@ ivas_error ivas_allocate_binaural_hrtf_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); } } - IF( ( HrtfFastConv->leftHRIRReal_FOA != NULL ) && ( HrtfFastConv->leftHRIRImag_FOA != NULL ) && ( HrtfFastConv->rightHRIRReal_FOA != NULL ) && ( HrtfFastConv->rightHRIRImag_FOA != NULL ) ) - { - return IVAS_ERR_OK; - } - ELSE - { - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" ); - } - } } IF( renderer_type == RENDERER_BINAURAL_FASTCONV || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) @@ -1307,29 +1060,6 @@ ivas_error ivas_allocate_binaural_hrtf_fx( return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag"); } } - IF( ( HrtfFastConv->leftHRIRReal != NULL ) && ( HrtfFastConv->leftHRIRImag != NULL ) && ( HrtfFastConv->rightHRIRReal != NULL ) && ( HrtfFastConv->rightHRIRImag != NULL ) ) - { - return IVAS_ERR_OK; - } - ELSE - { - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" ); - } - } } IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) @@ -1357,29 +1087,6 @@ ivas_error ivas_allocate_binaural_hrtf_fx( return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag"); } } - IF( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) - { - return IVAS_ERR_OK; - } - ELSE - { - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" ); - } - IF( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" ); - } - } } return IVAS_ERR_OK; @@ -1567,23 +1274,23 @@ static ivas_error ivas_binaural_hrtf_open_fx( IF( input_config == IVAS_AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV ) { - HrtfFastConv->FASTCONV_HRIR_latency_s = FASTCONV_HRIR_latency_s; + HrtfFastConv->FASTCONV_HRIR_latency_s_fx = FASTCONV_HRIR_latency_s_fx; } IF( input_config == IVAS_AUDIO_CONFIG_HOA2 ) { - HrtfFastConv->FASTCONV_HOA2_latency_s = FASTCONV_HOA2_latency_s; + HrtfFastConv->FASTCONV_HOA2_latency_s_fx = FASTCONV_HOA2_latency_s_fx; } IF( input_config == IVAS_AUDIO_CONFIG_HOA3 ) { - HrtfFastConv->FASTCONV_HOA3_latency_s = FASTCONV_HOA3_latency_s; + HrtfFastConv->FASTCONV_HOA3_latency_s_fx = FASTCONV_HOA3_latency_s_fx; } IF( input_config == IVAS_AUDIO_CONFIG_FOA ) { - HrtfFastConv->FASTCONV_FOA_latency_s = FASTCONV_FOA_latency_s; + HrtfFastConv->FASTCONV_FOA_latency_s_fx = FASTCONV_FOA_latency_s_fx; } IF( input_config == IVAS_AUDIO_CONFIG_BINAURAL || renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - HrtfFastConv->FASTCONV_BRIR_latency_s = FASTCONV_BRIR_latency_s; + HrtfFastConv->FASTCONV_BRIR_latency_s_fx = FASTCONV_BRIR_latency_s_fx; } HrtfFastConv->allocate_init_flag = 1; @@ -1602,11 +1309,6 @@ static ivas_error ivas_binaural_hrtf_open_fx( HrtfFastConv->leftHRIRImag_fx[i][j] = leftHRIRImag_fx[i][j]; HrtfFastConv->rightHRIRReal_fx[i][j] = rightHRIRReal_fx[i][j]; HrtfFastConv->rightHRIRImag_fx[i][j] = rightHRIRImag_fx[i][j]; - - HrtfFastConv->leftHRIRReal[i][j] = leftHRIRReal[i][j]; - HrtfFastConv->leftHRIRImag[i][j] = leftHRIRImag[i][j]; - HrtfFastConv->rightHRIRReal[i][j] = rightHRIRReal[i][j]; - HrtfFastConv->rightHRIRImag[i][j] = rightHRIRImag[i][j]; } } ELSE IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) @@ -1617,11 +1319,6 @@ static ivas_error ivas_binaural_hrtf_open_fx( HrtfFastConv->leftBRIRImag_fx[i][j] = leftBRIRImag_fx[i][j]; HrtfFastConv->rightBRIRReal_fx[i][j] = rightBRIRReal_fx[i][j]; HrtfFastConv->rightBRIRImag_fx[i][j] = rightBRIRImag_fx[i][j]; - - HrtfFastConv->leftBRIRReal[i][j] = leftBRIRReal[i][j]; - HrtfFastConv->leftBRIRImag[i][j] = leftBRIRImag[i][j]; - HrtfFastConv->rightBRIRReal[i][j] = rightBRIRReal[i][j]; - HrtfFastConv->rightBRIRImag[i][j] = rightBRIRImag[i][j]; } } IF( input_config == IVAS_AUDIO_CONFIG_HOA3 ) @@ -1632,11 +1329,6 @@ static ivas_error ivas_binaural_hrtf_open_fx( HrtfFastConv->leftHRIRImag_HOA3_fx[i][j] = leftHRIRImag_HOA3_fx[i][j]; HrtfFastConv->rightHRIRReal_HOA3_fx[i][j] = rightHRIRReal_HOA3_fx[i][j]; HrtfFastConv->rightHRIRImag_HOA3_fx[i][j] = rightHRIRImag_HOA3_fx[i][j]; - - HrtfFastConv->leftHRIRReal_HOA3[i][j] = leftHRIRReal_HOA3[i][j]; - HrtfFastConv->leftHRIRImag_HOA3[i][j] = leftHRIRImag_HOA3[i][j]; - HrtfFastConv->rightHRIRReal_HOA3[i][j] = rightHRIRReal_HOA3[i][j]; - HrtfFastConv->rightHRIRImag_HOA3[i][j] = rightHRIRImag_HOA3[i][j]; } } IF( input_config == IVAS_AUDIO_CONFIG_HOA2 ) @@ -1647,11 +1339,6 @@ static ivas_error ivas_binaural_hrtf_open_fx( HrtfFastConv->leftHRIRImag_HOA2_fx[i][j] = leftHRIRImag_HOA2_fx[i][j]; HrtfFastConv->rightHRIRReal_HOA2_fx[i][j] = rightHRIRReal_HOA2_fx[i][j]; HrtfFastConv->rightHRIRImag_HOA2_fx[i][j] = rightHRIRImag_HOA2_fx[i][j]; - - HrtfFastConv->leftHRIRReal_HOA2[i][j] = leftHRIRReal_HOA2[i][j]; - HrtfFastConv->leftHRIRImag_HOA2[i][j] = leftHRIRImag_HOA2[i][j]; - HrtfFastConv->rightHRIRReal_HOA2[i][j] = rightHRIRReal_HOA2[i][j]; - HrtfFastConv->rightHRIRImag_HOA2[i][j] = rightHRIRImag_HOA2[i][j]; } } IF( input_config == IVAS_AUDIO_CONFIG_FOA ) @@ -1662,19 +1349,11 @@ static ivas_error ivas_binaural_hrtf_open_fx( HrtfFastConv->leftHRIRImag_FOA_fx[i][j] = leftHRIRImag_FOA_fx[i][j]; HrtfFastConv->rightHRIRReal_FOA_fx[i][j] = rightHRIRReal_FOA_fx[i][j]; HrtfFastConv->rightHRIRImag_FOA_fx[i][j] = rightHRIRImag_FOA_fx[i][j]; - - HrtfFastConv->leftHRIRReal_FOA[i][j] = leftHRIRReal_FOA[i][j]; - HrtfFastConv->leftHRIRImag_FOA[i][j] = leftHRIRImag_FOA[i][j]; - HrtfFastConv->rightHRIRReal_FOA[i][j] = rightHRIRReal_FOA[i][j]; - HrtfFastConv->rightHRIRImag_FOA[i][j] = rightHRIRImag_FOA[i][j]; } } } mvl2l(fastconvReverberationTimes_fx, HrtfFastConv->fastconvReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX); mvl2l(fastconvReverberationEneCorrections_fx, HrtfFastConv->fastconvReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX); - - mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); - mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); *hHrtfFastConv = HrtfFastConv; } @@ -1990,7 +1669,7 @@ static void ivas_binaural_obtain_DMX_fx( P_out_fx = L_add( P_out_fx, L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); //Q31-2*Q_in } // if ( ( factEQ <= 1e-20f ) || ( P_in[bandIdx] <= 1e-20f ) || ( P_out <= 1e-20f ) ) - IF ( LE_32( P_in_fx[bandIdx], 0 ) || LE_32( P_out_fx, 0 ) ) + IF( LE_32( P_in_fx[bandIdx], 0 ) || LE_32( P_out_fx, 0 ) ) { //factEQ = 1.0f; factEQ_fx = 0x40000000; @@ -2009,7 +1688,7 @@ static void ivas_binaural_obtain_DMX_fx( } //factEQ = max( min( factEQ, 2.0f ), 0.5f ); - factEQ_fx = max( min( factEQ_fx, 0x7fffffff ), 0x20000000 ); // Q30 + factEQ_fx = L_max( L_min( factEQ_fx, 0x7fffffff ), 0x20000000 ); // Q30 FOR( k = 0; k < numTimeSlots; k++ ) { //realDMX[chOutIdx][k][bandIdx] *= factEQ; @@ -2161,7 +1840,7 @@ ivas_error ivas_binRenderer_open_fx( } hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx; - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s_fx; // (int32_t)(st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f); } ELSE { @@ -2175,21 +1854,21 @@ ivas_error ivas_binRenderer_open_fx( { IF( hBinRenderer->ivas_format == MC_FORMAT ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s_fx; // (int32_t)(st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f); } ELSE { IF( hBinRenderer->nInChannels == 16 ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s_fx; //(int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); } ELSE IF( hBinRenderer->nInChannels == 9 ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s_fx; // (int32_t)(st_ivas->hHrtfFastConv->FASTCONV_HOA2_latency_s * 1000000000.f); } ELSE IF( hBinRenderer->nInChannels == 4 ) { - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s_fx; // (int32_t)(st_ivas->hHrtfFastConv->FASTCONV_FOA_latency_s * 1000000000.f); } ELSE { @@ -2200,7 +1879,7 @@ ivas_error ivas_binRenderer_open_fx( ELSE { /* same value for MC or HOA both use MC BRIR*/ - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s_fx; // (int32_t)(st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f); } } @@ -2444,73 +2123,13 @@ ivas_error ivas_binRenderer_open( * * Close convolution module handle of fastconv binaural renderer *------------------------------------------------------------------------*/ - -static void ivas_binRenderer_convModuleClose( +#ifdef IVAS_FLOAT_FIXED +static void ivas_binRenderer_convModuleClose_fx( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { Word16 bandIdx, chIdx; -#ifndef IVAS_FLOAT_FIXED - BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; - - hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; - - IF( hBinRenConvModule == NULL ) - { - return; - } - - FOR( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) - { - free( hBinRenConvModule->filterTapsLeftReal[bandIdx] ); - hBinRenConvModule->filterTapsLeftReal[bandIdx] = NULL; - - free( hBinRenConvModule->filterTapsLeftImag[bandIdx] ); - hBinRenConvModule->filterTapsLeftImag[bandIdx] = NULL; - - free( hBinRenConvModule->filterTapsRightReal[bandIdx] ); - hBinRenConvModule->filterTapsRightReal[bandIdx] = NULL; - - free( hBinRenConvModule->filterTapsRightImag[bandIdx] ); - hBinRenConvModule->filterTapsRightImag[bandIdx] = NULL; - } - free( hBinRenConvModule->filterTapsLeftReal ); - hBinRenConvModule->filterTapsLeftReal = NULL; - - free( hBinRenConvModule->filterTapsLeftImag ); - hBinRenConvModule->filterTapsLeftImag = NULL; - - free( hBinRenConvModule->filterTapsRightReal ); - hBinRenConvModule->filterTapsRightReal = NULL; - - free( hBinRenConvModule->filterTapsRightImag ); - hBinRenConvModule->filterTapsRightImag = NULL; - - FOR( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) - { - FOR( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) - { - free( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] ); - hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] = NULL; - - free( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] ); - hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] = NULL; - } - - free( hBinRenConvModule->filterStatesLeftReal[bandIdx] ); - hBinRenConvModule->filterStatesLeftReal[bandIdx] = NULL; - - free( hBinRenConvModule->filterStatesLeftImag[bandIdx] ); - hBinRenConvModule->filterStatesLeftImag[bandIdx] = NULL; - } - - free( hBinRenConvModule->filterStatesLeftReal ); - hBinRenConvModule->filterStatesLeftReal = NULL; - - free( hBinRenConvModule->filterStatesLeftImag ); - hBinRenConvModule->filterStatesLeftImag = NULL; -#else BINRENDERER_CONV_MODULE_HANDLE_FX hBinRenConvModule; hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; @@ -2579,20 +2198,117 @@ static void ivas_binRenderer_convModuleClose( free( hBinRenConvModule->Q_filterStatesLeft ); hBinRenConvModule->Q_filterStatesLeft = NULL; -#endif + free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; return; } +#else +static void ivas_binRenderer_convModuleClose( + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ +) +{ + Word16 bandIdx, chIdx; + + BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; + + hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; + + IF( hBinRenConvModule == NULL ) + { + return; + } + + FOR( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) + { + free( hBinRenConvModule->filterTapsLeftReal[bandIdx] ); + hBinRenConvModule->filterTapsLeftReal[bandIdx] = NULL; + + free( hBinRenConvModule->filterTapsLeftImag[bandIdx] ); + hBinRenConvModule->filterTapsLeftImag[bandIdx] = NULL; + + free( hBinRenConvModule->filterTapsRightReal[bandIdx] ); + hBinRenConvModule->filterTapsRightReal[bandIdx] = NULL; + + free( hBinRenConvModule->filterTapsRightImag[bandIdx] ); + hBinRenConvModule->filterTapsRightImag[bandIdx] = NULL; + } + + free( hBinRenConvModule->filterTapsLeftReal ); + hBinRenConvModule->filterTapsLeftReal = NULL; + + free( hBinRenConvModule->filterTapsLeftImag ); + hBinRenConvModule->filterTapsLeftImag = NULL; + + free( hBinRenConvModule->filterTapsRightReal ); + hBinRenConvModule->filterTapsRightReal = NULL; + + free( hBinRenConvModule->filterTapsRightImag ); + hBinRenConvModule->filterTapsRightImag = NULL; + + FOR( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ ) + { + FOR( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ ) + { + free( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] ); + hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] = NULL; + + free( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] ); + hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] = NULL; + } + + free( hBinRenConvModule->filterStatesLeftReal[bandIdx] ); + hBinRenConvModule->filterStatesLeftReal[bandIdx] = NULL; + free( hBinRenConvModule->filterStatesLeftImag[bandIdx] ); + hBinRenConvModule->filterStatesLeftImag[bandIdx] = NULL; + } + + free( hBinRenConvModule->filterStatesLeftReal ); + hBinRenConvModule->filterStatesLeftReal = NULL; + + free( hBinRenConvModule->filterStatesLeftImag ); + hBinRenConvModule->filterStatesLeftImag = NULL; + + free( ( *hBinRenderer )->hBinRenConvModule ); + ( *hBinRenderer )->hBinRenConvModule = NULL; + + return; +} +#endif /*------------------------------------------------------------------------- * ivas_binRenderer_close() * * Close fastconv binaural renderer memories *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_binRenderer_close_fx( + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ +) +{ + IF( hBinRenderer == NULL || *hBinRenderer == NULL ) + { + return; + } + + IF( ( *hBinRenderer )->hBinRenConvModule != NULL ) + { + ivas_binRenderer_convModuleClose_fx( hBinRenderer ); + } + IF( ( *hBinRenderer )->hReverb != NULL ) + { + ivas_binaural_reverb_close_fx( &( ( *hBinRenderer )->hReverb ) ); + } + + free( *hBinRenderer ); + *hBinRenderer = NULL; + + return; +} +#else void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) @@ -2609,11 +2325,7 @@ void ivas_binRenderer_close( IF( ( *hBinRenderer )->hReverb != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_binaural_reverb_close_fx( &( ( *hBinRenderer )->hReverb ) ); -#else ivas_binaural_reverb_close( &( ( *hBinRenderer )->hReverb ) ); -#endif } free( *hBinRenderer ); @@ -2621,7 +2333,7 @@ void ivas_binRenderer_close( return; } - +#endif /*------------------------------------------------------------------------- * ivas_free_pppHrtfMem() @@ -2657,7 +2369,7 @@ static void ivas_free_pppHrtfMem_fx( return; } -#endif +#else static void ivas_free_pppHrtfMem( float ****ppppHRIR, const int16_t dim, @@ -2686,7 +2398,7 @@ static void ivas_free_pppHrtfMem( return; } - +#endif /*------------------------------------------------------------------------- * ivas_binaural_hrtf_close() @@ -2732,31 +2444,6 @@ void ivas_binaural_hrtf_close( ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRReal_FOA_fx, FOA_CHANNELS, allocate_init_flag); ivas_free_pppHrtfMem_fx(&(*hHrtfFastConv)->rightHRIRImag_FOA_fx, FOA_CHANNELS, allocate_init_flag); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftBRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRReal, HRTF_LS_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightBRIRImag, HRTF_LS_CHANNELS, allocate_init_flag ); - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA3, HOA3_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA3, HOA3_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA3, HOA3_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA3, HOA3_CHANNELS, allocate_init_flag ); - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_HOA2, HOA2_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_HOA2, HOA2_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_HOA2, HOA2_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_HOA2, HOA2_CHANNELS, allocate_init_flag ); - - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRReal_FOA, FOA_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->leftHRIRImag_FOA, FOA_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRReal_FOA, FOA_CHANNELS, allocate_init_flag ); - ivas_free_pppHrtfMem( &( *hHrtfFastConv )->rightHRIRImag_FOA, FOA_CHANNELS, allocate_init_flag ); - return; } #else @@ -2905,258 +2592,6 @@ void ivas_binaural_add_LFE_fx( * Fastconv binaural renderer main function *-------------------------------------------------------------------------*/ -void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ - const int16_t numTimeSlots, /* i : number of time slots to render */ - float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ -) -{ - int16_t chIdx, k; - - push_wmops( "fastconv_binaural_rendering" ); - - /* Compute Convolution */ - /* memory reset for the binaural output */ - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { - set_zero( Cldfb_RealBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); - set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); - } - } - - -#ifdef IVAS_FLOAT_FIXED - Word16 exp_real_final = 0, exp_im_final = 0; - Word32 RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word16 i, j; - Word32 max32_real = 1, max32_im = 1; - - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) - { - max32_real = (Word32) L_max( max32_real, L_abs( (Word32) RealBuffer[i][j][k] ) ); - max32_im = (Word32) L_max( max32_im, L_abs( (Word32) ImagBuffer[i][j][k] ) ); - } - } - } - Word16 exp_real = norm_l( max32_real ); - Word16 exp_im = norm_l( max32_im ); - exp_real = exp_im = min( exp_real, exp_im ); - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) - { - RealBuffer_fx[i][j][k] = (Word32) float_to_fix( RealBuffer[i][j][k], exp_real ); - exp_real_final = exp_real; - ImagBuffer_fx[i][j][k] = (Word32) float_to_fix( ImagBuffer[i][j][k], exp_im ); - exp_im_final = exp_im; - } - } - } -#endif - /* Head rotation in HOA3 or CICPx */ - if ( hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] && hBinRenderer->rotInCldfb ) - { - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) - { -#ifdef IVAS_FLOAT_FIXED - for ( i = 0; i < 3; i++ ) - { - for ( j = 0; j < 3; j++ ) - { - hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j] = (Word32) float_to_fix( hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][i][j], 30 ); - } - } - /* Rotation in SHD (HOA3) */ - if ( hCombinedOrientationData->shd_rot_max_order == -1 ) - { - rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); - exp_real_final--; //( exp_real + 14 - 15 ) - exp_im_final--; //( exp_im + 14 - 15 ) - } - else if ( hCombinedOrientationData->shd_rot_max_order > 0 ) - { - rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order ); - exp_real_final--; //( exp_real + 14 - 15 ) - exp_im_final--; //( exp_im + 14 - 15 ) - } - - -#else - /* Rotation in SHD (HOA3) */ - if ( hCombinedOrientationData->shd_rot_max_order == -1 ) - { - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); - } - else if ( hCombinedOrientationData->shd_rot_max_order > 0 ) - { - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order ); - } -#endif - } - else - { - /* Rotation in SD (CICPx) */ -#ifndef IVAS_FLOAT_FIXED - rotateFrame_sd_cldfb( hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx], RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); -#else - rotateFrame_sd_cldfb_fixed( hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], RealBuffer_fx, ImagBuffer_fx, - hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); -#endif - } - } - - /* HOA decoding to CICP19 if needed*/ - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) - { -#ifndef IVAS_FLOAT_FIXED - ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); -#else - ivas_sba2mc_cldfb_fixed( *( hBinRenderer->hInputSetup ), RealBuffer_fx, ImagBuffer_fx, - hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); -#endif - } -#ifndef IVAS_FLOAT_FIXED - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer ); -#else - Word64 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word64 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - for ( j = 0; j < numTimeSlots; j++ ) - { - set64_fx( Cldfb_RealBuffer_Binaural_fx[i][j], 0, hBinRenderer->conv_band ); - set64_fx( Cldfb_ImagBuffer_Binaural_fx[i][j], 0, hBinRenderer->conv_band ); - } - } - ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, exp_real_final ); -#endif - - /* Obtain the binaural dmx and compute the reverb */ - if ( hBinRenderer->hReverb != NULL ) - { -#ifndef IVAS_FLOAT_FIXED - float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float inRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float inIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - - ivas_binaural_obtain_DMX( numTimeSlots, hBinRenderer, RealBuffer, ImagBuffer, inRe, inIm ); - - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { - set_zero( reverbRe[chIdx][k], hBinRenderer->max_band ); - set_zero( reverbIm[chIdx][k], hBinRenderer->max_band ); - } - } - - ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe, inIm, reverbRe, reverbIm ); - - /* Add the conv module and reverb module output */ - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < numTimeSlots; k++ ) - { - /* Combine first and second parts to generate binaural output signal with room effect */ - v_add( Cldfb_RealBuffer_Binaural[chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); - v_add( Cldfb_ImagBuffer_Binaural[chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); - } - } -#else - //float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - //float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 reverbRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 reverbIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word64 reverbRe_fx_64[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word64 reverbIm_fx_64[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - //float inRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - //float inIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 inRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 inIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - - ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx ); - // inRe_fx Q = exp_real_final - Q1 - - FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - FOR( k = 0; k < numTimeSlots; k++ ) - { - set32_fx( reverbRe_fx[chIdx][k], 0, hBinRenderer->max_band ); - set32_fx( reverbIm_fx[chIdx][k], 0, hBinRenderer->max_band ); - } - } - - ivas_binaural_reverb_processSubframe_fx( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx ); - // reverbRe_fx Q = exp_real_final + Q30 // - - FOR(i = 0; i < BINAURAL_CHANNELS; i++) - { - FOR(j = 0; j < numTimeSlots; j++) - { - - FOR(k = 0; k < hBinRenderer->hReverb->numBins; k++) - { - reverbRe_fx_64[i][j][k] = W_shl(reverbRe_fx[i][j][k], Q29); - reverbIm_fx_64[i][j][k] = W_shl(reverbIm_fx[i][j][k], Q29); - } - } - } - - /* Add the conv module and reverb module output */ - FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - FOR( k = 0; k < numTimeSlots; k++ ) - { - /* Combine first and second parts to generate binaural output signal with room effect */ - v_add_w64( Cldfb_RealBuffer_Binaural_fx[chIdx][k], reverbRe_fx_64[chIdx][k], Cldfb_RealBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band, 0 ); - v_add_w64( Cldfb_ImagBuffer_Binaural_fx[chIdx][k], reverbIm_fx_64[chIdx][k], Cldfb_ImagBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band, 0 ); - } - } -#endif - } -#ifdef IVAS_FLOAT_FIXED - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) - { - RealBuffer[i][j][k] = fix_to_float( RealBuffer_fx[i][j][k], exp_real_final ); - ImagBuffer[i][j][k] = fix_to_float( ImagBuffer_fx[i][j][k], exp_im_final ); - } - } - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - for ( j = 0; j < numTimeSlots; j++ ) - { - for ( k = 0; k < hBinRenderer->conv_band; k++ ) - { - Cldfb_RealBuffer_Binaural[i][j][k] = fix_W64_to_float( Cldfb_RealBuffer_Binaural_fx[i][j][k], ( exp_real_final + Q29 ) ); - Cldfb_ImagBuffer_Binaural[i][j][k] = fix_W64_to_float( Cldfb_ImagBuffer_Binaural_fx[i][j][k], ( exp_im_final + Q29 ) ); - } - } - } -#endif - pop_wmops(); - return; -} - #ifdef IVAS_FLOAT_FIXED void ivas_binRenderer_fx( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ @@ -3282,5 +2717,97 @@ void ivas_binRenderer_fx( pop_wmops(); return; } +#else +void ivas_binRenderer( + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ + const int16_t numTimeSlots, /* i : number of time slots to render */ + float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ +) +{ + int16_t chIdx, k; + + push_wmops( "fastconv_binaural_rendering" ); -#endif \ No newline at end of file + /* Compute Convolution */ + /* memory reset for the binaural output */ + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { + set_zero( Cldfb_RealBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); + set_zero( Cldfb_ImagBuffer_Binaural[chIdx][k], CLDFB_NO_CHANNELS_MAX ); + } + } + + /* Head rotation in HOA3 or CICPx */ + if ( hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] && hBinRenderer->rotInCldfb ) + { + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) + { + /* Rotation in SHD (HOA3) */ + if ( hCombinedOrientationData->shd_rot_max_order == -1 ) + { + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); + } + else if ( hCombinedOrientationData->shd_rot_max_order > 0 ) + { + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order ); + } + } + else + { + /* Rotation in SD (CICPx) */ + rotateFrame_sd_cldfb( hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx], RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); + } + } + + /* HOA decoding to CICP19 if needed*/ + if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) + { + ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); + } + + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer ); + + + /* Obtain the binaural dmx and compute the reverb */ + if ( hBinRenderer->hReverb != NULL ) + { + float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float inRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float inIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + + ivas_binaural_obtain_DMX( numTimeSlots, hBinRenderer, RealBuffer, ImagBuffer, inRe, inIm ); + + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { + set_zero( reverbRe[chIdx][k], hBinRenderer->max_band ); + set_zero( reverbIm[chIdx][k], hBinRenderer->max_band ); + } + } + + ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe, inIm, reverbRe, reverbIm ); + + /* Add the conv module and reverb module output */ + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < numTimeSlots; k++ ) + { + /* Combine first and second parts to generate binaural output signal with room effect */ + v_add( Cldfb_RealBuffer_Binaural[chIdx][k], reverbRe[chIdx][k], Cldfb_RealBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); + v_add( Cldfb_ImagBuffer_Binaural[chIdx][k], reverbIm[chIdx][k], Cldfb_ImagBuffer_Binaural[chIdx][k], hBinRenderer->conv_band ); + } + } + } + + pop_wmops(); + return; +} +#endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 6591023f2..0e9a1d528 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1170,6 +1170,16 @@ ivas_error ivas_init_decoder_front( { return error; } +#ifdef IVAS_FLOAT_FIXED + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + st_ivas->hExtOrientationData->Quaternions[i].w = fixedToFloat_32( st_ivas->hExtOrientationData->Quaternions[i].w_fx, st_ivas->hExtOrientationData->Quaternions[i].q_fact ); + st_ivas->hExtOrientationData->Quaternions[i].x = fixedToFloat_32( st_ivas->hExtOrientationData->Quaternions[i].x_fx, st_ivas->hExtOrientationData->Quaternions[i].q_fact ); + st_ivas->hExtOrientationData->Quaternions[i].y = fixedToFloat_32( st_ivas->hExtOrientationData->Quaternions[i].y_fx, st_ivas->hExtOrientationData->Quaternions[i].q_fact ); + st_ivas->hExtOrientationData->Quaternions[i].z = fixedToFloat_32( st_ivas->hExtOrientationData->Quaternions[i].z_fx, st_ivas->hExtOrientationData->Quaternions[i].q_fact ); + } + +#endif } /*-------------------------------------------------------------------* @@ -1182,6 +1192,33 @@ ivas_error ivas_init_decoder_front( { return error; } +#ifdef IVAS_FLOAT_FIXED + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + st_ivas->hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32( st_ivas->hCombinedOrientationData->Quaternions[i].w_fx, st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + st_ivas->hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32( st_ivas->hCombinedOrientationData->Quaternions[i].x_fx, st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + st_ivas->hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32( st_ivas->hCombinedOrientationData->Quaternions[i].y_fx, st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + st_ivas->hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32( st_ivas->hCombinedOrientationData->Quaternions[i].z_fx, st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + + st_ivas->hCombinedOrientationData->listenerPos[i].x = fixedToFloat_32( st_ivas->hCombinedOrientationData->listenerPos[i].x_fx, st_ivas->hCombinedOrientationData->listenerPos[i].q_fact ); + st_ivas->hCombinedOrientationData->listenerPos[i].y = fixedToFloat_32( st_ivas->hCombinedOrientationData->listenerPos[i].y_fx, st_ivas->hCombinedOrientationData->listenerPos[i].q_fact ); + st_ivas->hCombinedOrientationData->listenerPos[i].z = fixedToFloat_32( st_ivas->hCombinedOrientationData->listenerPos[i].z_fx, st_ivas->hCombinedOrientationData->listenerPos[i].q_fact ); + for ( Word16 j = 0; j < 3; j++ ) + { + for ( Word16 k = 0; k < 3; k++ ) + { + st_ivas->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( st_ivas->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); + } + } + } + for ( Word16 j = 0; j < 3; j++ ) + { + for ( Word16 k = 0; k < 3; k++ ) + { + st_ivas->hCombinedOrientationData->Rmat_prev[j][k] = (float) fixedToFloat_32( st_ivas->hCombinedOrientationData->Rmat_prev_fx[j][k], 30 ); + } + } +#endif } /*-------------------------------------------------------------------* @@ -4116,8 +4153,11 @@ void ivas_destroy_dec( #endif /* Fastconv binaural renderer handle */ +#ifdef IVAS_FLOAT_FIXED + ivas_binRenderer_close_fx( &st_ivas->hBinRenderer ); +#else ivas_binRenderer_close( &st_ivas->hBinRenderer ); - +#endif /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 37f986184..de9b4c932 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -2024,7 +2024,7 @@ static ivas_error ivas_mc_dec_reconfig( /* remove unneeded binaural renderers */ IF ( st_ivas->hBinRenderer != NULL && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) ) { - ivas_binRenderer_close( &st_ivas->hBinRenderer ); + ivas_binRenderer_close_fx( &st_ivas->hBinRenderer ); } IF ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV) && NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_MIXER_CONV_ROOM) && ( NE_16(st_ivas->renderer_type , RENDERER_BINAURAL_OBJECTS_TD) || NE_16(st_ivas->hIntSetup.output_config , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) ) ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 2d2779d81..a169d6683 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1330,7 +1330,7 @@ ivas_error ivas_sba_dec_reconfigure_fx( } else if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) { - ivas_binRenderer_close( &st_ivas->hBinRenderer ); + ivas_binRenderer_close_fx( &st_ivas->hBinRenderer ); } if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX && st_ivas->hMonoDmxRenderer == NULL ) diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index b549879e0..23e2d0746 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -791,22 +791,23 @@ static void stereo_dft_generate_comfort_noise_fx( IF( hStereoCng->first_SID_after_TD ) { - Word16 q_div, q_sqrt; - scaleAvg = 0; - move16(); - FOR( b = 0; b < hStereoDft->nbands; b++ ) + Word16 q_div, q_sqrt, q_sqrt2; + scaleAvg = 0; move16(); + FOR ( b = 0; b < hStereoDft->nbands; b++ ) { - Word32 tmp_n, tmp_d; + Word32 tmp_n, tmp_d, tmp_32, tmp_32_2; Word16 sqrt_res; IF( LT_16( hStereoCng->cm_fx[b], (Word32) ( 0x7333 ) ) ) { gamma = hStereoCng->cm_fx[b]; move16(); - gamma = BASOP_Util_Divide1616_Scale( gamma, sub( MAX_16, gamma ), &q_div ); - tmp_16 = Sqrt16( gamma, &q_div ); - gamma = Sqrt16( add( gamma, sub( MAX_16, mult( hStereoDft->g_state_fx[b], hStereoDft->g_state_fx[b] ) ) ), &q_sqrt ); - gamma = shl( gamma, sub( q_sqrt, q_div ) ); // Bring both gamma and tmp to same Q i.e., q_div. - gamma = shl( sub( gamma, tmp_16 ), q_div ); // Apply appropriate left shift on the result. + gamma = BASOP_Util_Divide1616_Scale(gamma , sub( MAX_16 , gamma ), &q_div); + q_sqrt2 = q_div+16; + tmp_32_2 = Sqrt32(gamma, &q_sqrt2); + tmp_32 = BASOP_Util_Add_Mant32Exp(gamma, 16+q_div, sub(MAX_16, mult(hStereoDft->g_state_fx[b], hStereoDft->g_state_fx[b])), 16, &q_sqrt); + tmp_32 = Sqrt32( tmp_32, &q_sqrt); + tmp_32 = BASOP_Util_Add_Mant32Exp(tmp_32, q_sqrt, L_negate(tmp_32_2), q_sqrt2, &q_sqrt); + gamma = extract_h(L_shl(tmp_32, q_sqrt)); } ELSE { @@ -843,7 +844,7 @@ static void stereo_dft_generate_comfort_noise_fx( scaleAvg = add( scaleAvg, shr( scaleMS, sub( Q15, q_sqrt ) ) ); } scaleAvg = BASOP_Util_Divide1616_Scale( scaleAvg, hStereoDft->nbands, &q_div ); - hStereoDft->scale_fx = shl( scaleAvg, q_div ); + hStereoDft->scale_fx = shl_sat( scaleAvg, q_div ); } } @@ -1169,11 +1170,11 @@ static void stereo_dft_generate_comfort_noise_fx( /* Real part in FFT bins */ rand_gauss_fx( ptr_r, &st->hTdCngDec->cng_seed, q_dft); //ptr_shb will be in Q30 - rshift at this point. So apply left shift by 1 to compensate Mpy_32_32 right shift.. - ( *ptr_r ) = L_shl(Mpy_32_32(L_shl(*ptr_r, add(1, *ptr_q_shb)), *ptr_shb), rshift_shb); move32(); + ( *ptr_r ) = W_extract_l(W_shl(W_mult0_32_32(*ptr_r, *ptr_shb), sub(add(rshift_shb, add(1, *ptr_q_shb)), 31))); move32(); ptr_r += 2; /* Imaginary part in FFT bins */ rand_gauss_fx( ptr_i, &st->hTdCngDec->cng_seed, q_dft); - ( *ptr_i ) = L_shl(Mpy_32_32(L_shl(*ptr_i, add(1, *ptr_q_shb)), *ptr_shb), rshift_shb); move32(); + ( *ptr_i ) = W_extract_l(W_shl(W_mult0_32_32(*ptr_i, *ptr_shb), sub(add(rshift_shb, add(1, *ptr_q_shb)), 31))); move32(); ptr_i += 2; ptr_shb--; } @@ -1185,9 +1186,9 @@ static void stereo_dft_generate_comfort_noise_fx( ptr_i = ptr_r + 1; FOR( i = 0; i < shr( sub( s_min( output_frame, shl( hFdCngCom->regularStopBand, 4 ) ), hFdCngCom->stopFFTbin ), 1 ); i++ ) { - ( *ptr_r ) = imult3216(L_shl(Mpy_32_16_1(*ptr_r, scale), q_div), shr(output_frame, 1)); + ( *ptr_r ) = W_extract_l(W_shl(W_mult0_32_32(Mpy_32_16_1(*ptr_r, scale), shr(output_frame, 1)), q_div)); move32(); move32(); - ( *ptr_i ) = imult3216(L_shl(Mpy_32_16_1(*ptr_i, scale), q_div), shr(output_frame, 1)); + ( *ptr_i ) = W_extract_l(W_shl(W_mult0_32_32(Mpy_32_16_1(*ptr_i, scale), shr(output_frame, 1)), q_div)); move32(); move32(); ptr_r += 2; ptr_i += 2; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index e5e73a07e..f5e7626eb 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -850,8 +850,20 @@ ivas_error IVAS_DEC_GetSamples( { return error; } - - + for ( Word16 i = 0; i < hIvasDec->st_ivas->hCombinedOrientationData->num_subframes; i++ ) + { + hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].w_fx, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].x_fx, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].y_fx, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].z_fx, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); + for (Word16 j = 0; j < 3; j++ ) + { + for ( Word16 k = 0; k < 3; k++ ) + { + hIvasDec->st_ivas->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); + } + } + } hIvasDec->updateOrientation = false; } diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index b1e24ca06..412da0468 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -1667,10 +1667,12 @@ static void get_lattice_coeffs_fx( { Word16 k; - for ( k = 0; k < ap_filter_length[band_index]; k++ ) + FOR ( k = 0; k < ap_filter_length[band_index]; k++ ) { Word16 cur_lattice_coeff = ap_lattice_coeffs_fx[band_index][channel_index * ap_filter_length[band_index] + k]; lattice_coeffs[k] = cur_lattice_coeff; + move16(); + move16(); } return; @@ -1729,7 +1731,7 @@ static void lattice2allpass_fx( Word16 *filter_coeffs_num_real_fx, Word16 *filter_coeffs_den_real_fx) { - int16_t i, p; + Word16 i, p; #ifdef IVAS_FLOAT_FIXED Word16 alpha_real_fx[2][DIRAC_MAX_DECORR_FILTER_LEN + 1]; @@ -1743,7 +1745,7 @@ static void lattice2allpass_fx( float *tmp; #endif - for (i = 0; i < 2; i++) + FOR (i = 0; i < 2; i++) { #ifdef IVAS_FLOAT_FIXED set16_fx(alpha_real_fx[i], 0, DIRAC_MAX_DECORR_FILTER_LEN + 1); @@ -1755,6 +1757,8 @@ static void lattice2allpass_fx( #ifdef IVAS_FLOAT_FIXED alpha_real_p_fx[0] = ONE_IN_Q12; alpha_real_p_old_fx[0] = ONE_IN_Q12; + move16(); + move16(); #else alpha_real_p[0] = 1.0f; alpha_real_p_old[0] = 1.0f; @@ -1764,6 +1768,7 @@ static void lattice2allpass_fx( #ifdef IVAS_FLOAT_FIXED Word16 lattice_alpha = 0; + move16(); FOR (p = 1; p < filter_length; p++) { alpha_real_p_fx[p] = shr(lattice_coeffs_fx[(p - 1)], 3);//Q12 @@ -1800,6 +1805,8 @@ static void lattice2allpass_fx( { filter_coeffs_den_real_fx[i] = alpha_real_p_old_fx[i]; filter_coeffs_num_real_fx[i] = alpha_real_p_old_fx[filter_length - i - 1]; + move16(); + move16(); }//Q12 #else for (i = 0; i < filter_length; i++) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index ebfc55f97..9cad5d1ff 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -6074,33 +6074,36 @@ static void computeTargetPSDs_direct_fx( Word32 aux_buffer_res[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ /* estimate direct and diffuse power */ - v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power + v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + + Word16 common1_q = s_min( *q_cy_auto_dir_smooth, *q_reference_power ); + Word16 common2_q = s_min( *q_cy_cross_dir_smooth, *q_reference_power ); /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_mult_fixed( direct_power, &direct_responses_square[cur_idx], aux_buffer_res, num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power - Scale_sig32( aux_buffer_res, num_freq_bands, sub( *q_cy_auto_dir_smooth, *q_reference_power ) ); // q_cy_auto_dir_smooth - v_add_fixed( &cy_auto_dir_smooth[cur_idx], aux_buffer_res, &cy_auto_dir_smooth[cur_idx], num_freq_bands, Q1 ); // (q_cy_auto_dir_smooth - Q1) + v_mult_fixed( direct_power, &direct_responses_square[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + scale_sig32( aux_buffer_res, num_freq_bands, sub( common1_q, *q_reference_power ) ); /* Q(common1_q) */ + scale_sig32( &cy_auto_dir_smooth[cur_idx], num_freq_bands, sub( common1_q, *q_cy_auto_dir_smooth ) ); /* Q(common1_q) */ + v_add_fixed( &cy_auto_dir_smooth[cur_idx], aux_buffer_res, &cy_auto_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common1_q) - Q1 */ - v_mult_fixed( direct_power, &direct_responses[cur_idx], aux_buffer_res, num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power - Scale_sig32( aux_buffer_res, num_freq_bands, sub( *q_cy_cross_dir_smooth, *q_reference_power ) ); // q_cy_cross_dir_smooth - v_add_fixed( &cy_cross_dir_smooth[cur_idx], aux_buffer_res, &cy_cross_dir_smooth[cur_idx], num_freq_bands, Q1 ); // (q_cy_cross_dir_smooth - Q1) + v_mult_fixed( direct_power, &direct_responses[cur_idx], aux_buffer_res, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + scale_sig32( aux_buffer_res, num_freq_bands, sub( common2_q, *q_reference_power ) ); /* Q(common2_q) */ + scale_sig32( &cy_cross_dir_smooth[cur_idx], num_freq_bands, sub( common2_q, *q_cy_cross_dir_smooth ) ); /* Q(common2_q) */ + v_add_fixed( &cy_cross_dir_smooth[cur_idx], aux_buffer_res, &cy_cross_dir_smooth[cur_idx], num_freq_bands, Q1 ); /* Q(common2_q) - Q1 */ } /* Q adjustment */ - *q_cy_auto_dir_smooth = sub( *q_cy_auto_dir_smooth, Q1 ); + *q_cy_auto_dir_smooth = sub( common1_q, Q1 ); move16(); - *q_cy_cross_dir_smooth = sub( *q_cy_cross_dir_smooth, Q1 ); + *q_cy_cross_dir_smooth = sub( common2_q, Q1 ); move16(); return; } #else - - static void computeTargetPSDs_direct( const int16_t num_channels, const int16_t num_freq_bands, @@ -6227,28 +6230,28 @@ static void computeTargetPSDs_diffuse_fx( Word32 aux_buffer_res[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ /* estimate direct and diffuse power */ - v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power + v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + + Word16 common_q = s_min( *q_cy_auto_diff_smooth, *q_reference_power ); /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); - v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, num_freq_bands - start_band ); // (q_reference_power, Q31) -> q_reference_power - Scale_sig32( aux_buffer_res, num_freq_bands - start_band, sub( *q_cy_auto_diff_smooth, *q_reference_power ) ); // q_cy_auto_diff_smooth - Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, negate( Q1 ) ); // (q_cy_auto_diff_smooth - Q1) - v_add_fixed( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], num_freq_bands - start_band, Q1 ); // (q_cy_auto_diff_smooth - Q1) + v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], aux_buffer_res, num_freq_bands - start_band ); /* Q31 + Q(q_reference_power) - Q31 = Q(q_reference_power) */ + scale_sig32( aux_buffer_res, num_freq_bands - start_band, sub( common_q, *q_reference_power ) ); /* Q(common_q) */ + scale_sig32( &cy_auto_diff_smooth[cur_idx + start_band], num_freq_bands - start_band, sub( common_q, *q_cy_auto_diff_smooth ) ); /* Q(common_q) */ + v_add_fixed( &cy_auto_diff_smooth[cur_idx + start_band], aux_buffer_res, &cy_auto_diff_smooth[cur_idx + start_band], num_freq_bands - start_band, Q1 ); /* Q(common_q) - Q1 */ } /* Q adjustment */ - *q_cy_auto_diff_smooth = sub( *q_cy_auto_diff_smooth, Q1 ); + *q_cy_auto_diff_smooth = sub( common_q, Q1 ); move16(); return; } #else - - static void computeTargetPSDs_diffuse( const int16_t num_channels, const int16_t num_freq_bands, diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index b1272616c..bf59d928e 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -441,7 +441,7 @@ static void GenerateFilter_fx( FOR( i = 0; i < num_az_idx[p]; i++ ) { modelEval->BM_fx[qp + i] = L_shl( Mpy_32_32( modelEval->elevBfVec_fx[p], modelEval->azimBfVec_fx[p][i] ), Q30 - ( Q30 * 2 - 31 ) ); // Q30 - BM_idx[qp + i] = model->azim_start_idx[EvIdx[p]] + AzIdx[p][i]; + BM_idx[qp + i] = add(model->azim_start_idx[EvIdx[p]] , AzIdx[p][i]); } qp = add( qp, num_az_idx[p] ); } @@ -927,7 +927,7 @@ static void getPeriodicBSplineSampVec_fx( FOR( i = 0; i < *num_az_idx; i++ ) { - d = d0 - ( i + nI - 1 ) * SegSamples; /* offset of knot_interval */ + d = sub(d0 , imult1616(( sub(add(i , nI) , 1) ) , SegSamples)); /* offset of knot_interval */ d = sub( d0, imult1616( sub( add( i, nI ), 1 ), SegSamples ) ); BfVec_fx[i] = azimBsShape_fx[abs_s( d ) * subSampFactor]; AzIdx[i] = add( nI, i ) % NumBFs; diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 5696571f9..30dbb9cd4 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -213,7 +213,7 @@ void TDREND_MIX_Dealloc_fx( { IF ( EQ_16(hBinRendererTd->HrFiltSet_p->FilterMethod , TDREND_HRFILT_Method_BSplineModel) ) { -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#if 0 /*IVAS_FLOAT_FIXED_TO_BE_REMOVED*/ BSplineModelEvalDealloc( &hBinRendererTd->HrFiltSet_p->ModelParams, &hBinRendererTd->HrFiltSet_p->ModelEval ); #endif BSplineModelEvalDealloc_fx( &hBinRendererTd->HrFiltSet_p->ModelParams, &hBinRendererTd->HrFiltSet_p->ModelEval ); @@ -704,7 +704,7 @@ static ivas_error DefaultBSplineModel_fx( SWITCH( output_Fs ) { case 48000: -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ HrFiltSet_p->lr_energy_and_iac[0] = defaultHRIR_left_avg_power_48kHz; HrFiltSet_p->lr_energy_and_iac[1] = defaultHRIR_right_avg_power_48kHz; HrFiltSet_p->lr_energy_and_iac[2] = defaultHRIR_coherence_48kHz; @@ -714,7 +714,7 @@ static ivas_error DefaultBSplineModel_fx( HrFiltSet_p->lr_energy_and_iac_fx[2] = defaultHRIR_coherence_48kHz_fx; BREAK; case 32000: -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ HrFiltSet_p->lr_energy_and_iac[0] = defaultHRIR_left_avg_power_32kHz; HrFiltSet_p->lr_energy_and_iac[1] = defaultHRIR_right_avg_power_32kHz; HrFiltSet_p->lr_energy_and_iac[2] = defaultHRIR_coherence_32kHz; @@ -724,7 +724,7 @@ static ivas_error DefaultBSplineModel_fx( HrFiltSet_p->lr_energy_and_iac_fx[2] = defaultHRIR_coherence_32kHz_fx; BREAK; case 16000: -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ HrFiltSet_p->lr_energy_and_iac[0] = defaultHRIR_left_avg_power_16kHz; HrFiltSet_p->lr_energy_and_iac[1] = defaultHRIR_right_avg_power_16kHz; HrFiltSet_p->lr_energy_and_iac[2] = defaultHRIR_coherence_16kHz; @@ -779,13 +779,13 @@ static ivas_error DefaultBSplineModel_fx( model->azimShapeSampFactor = defaultHRIR_rom_azimShapeSampFactor; /* float parameters */ -#if 1 /*To be removed later Floating point initializations */ +#if 0 /*To be removed later Floating point initializations */ model->elevKSeq = (const float *) defaultHRIR_rom_elevKSeq; model->elevBsShape = (const float *) defaultHRIR_rom_elevBsShape; #endif // 1 model->elevKSeq_fx = defaultHRIR_rom_elevKSeq_fx; model->elevBsShape_fx = (const Word32 *) defaultHRIR_rom_elevBsShape_fx; -#if 1 /*To be removed later : Floating point memory allocation*/ +#if 0 /*To be removed later : Floating point memory allocation*/ IF ( ( model->azimBsShape = (const float **) malloc( model->num_unique_azim_splines * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); @@ -836,7 +836,7 @@ static ivas_error DefaultBSplineModel_fx( FOR ( i = 1; i < model->elevDim3 - 1; i++ ) { -#if 1 /*To be removed later : Floating point initialization*/ +#if 0 /*To be removed later : Floating point initialization*/ IF ( ( model->azimKSeq[i] = (float *) malloc( model->azimDim2[i] * sizeof( float * ) ) ) == NULL ) /* azimDim2[i] = 91, i=2..15 */ { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); @@ -860,7 +860,7 @@ static ivas_error DefaultBSplineModel_fx( SWITCH ( output_Fs ) { case 48000: -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ model->AlphaL = (const float *) defaultHRIR_rom_AlphaL48; model->AlphaR = (const float *) defaultHRIR_rom_AlphaR48; model->EL = (const float *) defaultHRIR_rom_EL48; @@ -891,7 +891,7 @@ static ivas_error DefaultBSplineModel_fx( } BREAK; case 32000: -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ model->AlphaL = (const float *) defaultHRIR_rom_AlphaL32; model->AlphaR = (const float *) defaultHRIR_rom_AlphaR32; model->EL = (const float *) defaultHRIR_rom_EL32; @@ -922,7 +922,7 @@ static ivas_error DefaultBSplineModel_fx( } BREAK; case 16000: -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ model->AlphaL = (const float *) defaultHRIR_rom_AlphaL16; model->AlphaR = (const float *) defaultHRIR_rom_AlphaR16; model->EL = (const float *) defaultHRIR_rom_EL16; @@ -984,7 +984,7 @@ static ivas_error DefaultBSplineModel_fx( move16(); modelITD->elevBsStart[3] = 21; move16(); -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ modelITD->elevKSeq = defaultHRIR_rom_ITD_elevKSeq; #endif modelITD->elevKSeq_fx = defaultHRIR_rom_ITD_elevKSeq_fx; @@ -1008,7 +1008,7 @@ static ivas_error DefaultBSplineModel_fx( modelITD->azimSegSamples = 10; move16(); -#if 1/*To be removed later : floating point pointer initialization*/ +#if 0/*To be removed later : floating point pointer initialization*/ modelITD->azimKSeq = defaultHRIR_rom_ITD_azimKSeq; modelITD->W = (const float *) defaultHRIR_rom_ITD_W; modelITD->azimBsShape = (const float *) defaultHRIR_rom_ITD_azimBsShape; diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index 243001e26..e389ed74b 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -159,7 +159,7 @@ void TDREND_SPATIAL_VecNormalize_fx( exp = add( exp, sub( 31, q ) ); // Since vector is normalised, all values will be <= 1. Hence making all values in Q30 - shift = exp - 1; + shift = sub(exp , 1); VecNorm_p_fx[0] = L_shl( VecNorm_p_fx[0], shift ); move16(); VecNorm_p_fx[1] = L_shl( VecNorm_p_fx[1], shift ); diff --git a/lib_rend/ivas_reverb_delay_line.c b/lib_rend/ivas_reverb_delay_line.c index d8307be75..929597973 100644 --- a/lib_rend/ivas_reverb_delay_line.c +++ b/lib_rend/ivas_reverb_delay_line.c @@ -58,20 +58,25 @@ void ivas_rev_delay_line_init( ) { pDelay->MaxDelay = maxdelay; + move16(); - if ( delay <= pDelay->MaxDelay ) + IF ( LE_32(delay , pDelay->MaxDelay) ) { pDelay->Delay = delay; } - else + ELSE { pDelay->Delay = pDelay->MaxDelay; } + move16(); pDelay->pBuffer_fx = memory_buffer; + move32(); set_val_Word32( pDelay->pBuffer_fx, 0, pDelay->MaxDelay ); pDelay->BufferPos = 0; + move16(); pDelay->Gain_fx = ONE_IN_Q14; + move16(); return; } @@ -88,10 +93,12 @@ void ivas_rev_delay_line_feed_sample_fx( ) { pDelay->pBuffer_fx[pDelay->BufferPos++] = input; + move32(); - if ( pDelay->BufferPos >= pDelay->Delay ) + IF ( GE_32(pDelay->BufferPos , pDelay->Delay) ) { pDelay->BufferPos = 0; + move16(); } return; @@ -227,41 +234,48 @@ void ivas_rev_delay_line_feed_sample_blk_fx( UWord16 i, pos; pos = (UWord16) pDelay->BufferPos; + move16(); - if ( pos + blk_size > (UWord16) pDelay->Delay ) /* splitting block in 2 if it exceeds buffer end limit */ + IF ( GT_32(L_add(pos , blk_size) , pDelay->Delay) ) /* splitting block in 2 if it exceeds buffer end limit */ { UWord16 blk_size_1; /* 1st block up to the end of the buffer */ UWord16 blk_size_2; /* 2nd block at the beginning of the buffer */ - blk_size_1 = (UWord16) pDelay->Delay - pos; - blk_size_2 = blk_size - blk_size_1; + blk_size_1 = (UWord16) L_sub(pDelay->Delay , pos); + blk_size_2 = (UWord16) L_sub(blk_size , blk_size_1); pDst = &pDelay->pBuffer_fx[pos]; - for ( i = 0; i < blk_size_1; i++ ) + FOR ( i = 0; i < blk_size_1; i++ ) { pDst[i] = input[i]; + move32(); } pDst = &pDelay->pBuffer_fx[0]; pSrc = &input[blk_size_1]; - for ( i = 0; i < blk_size_2; i++ ) + FOR ( i = 0; i < blk_size_2; i++ ) { pDst[i] = pSrc[i]; + move32(); } pos = blk_size_2; + move16(); } - else /* copy only 1 data block directly if it fits in the buffer */ + ELSE /* copy only 1 data block directly if it fits in the buffer */ { pDst = &pDelay->pBuffer_fx[pos]; - for ( i = 0; i < blk_size; i++ ) + FOR ( i = 0; i < blk_size; i++ ) { pDst[i] = input[i]; + move32(); } - pos += blk_size; + pos = (UWord16)L_add(pos,blk_size); } pDelay->BufferPos = pos; + move16(); - if ( pDelay->BufferPos >= pDelay->Delay ) + IF ( GE_32(pDelay->BufferPos , pDelay->Delay) ) { pDelay->BufferPos = 0; + move16(); } return; @@ -278,15 +292,15 @@ Word32 ivas_rev_delay_line_get_sample_fx( ivas_rev_delay_line_t *pDelay /* i/o: the delay line */ ) { - if ( pDelay->Gain_fx == ONE_IN_Q14 ) + IF ( EQ_16(pDelay->Gain_fx , ONE_IN_Q14) ) { return pDelay->pBuffer_fx[pDelay->BufferPos]; } - else + ELSE { - return (Mpy_32_16_r( pDelay->pBuffer_fx[pDelay->BufferPos], pDelay->Gain_fx) << 1); + return (L_shl(Mpy_32_16_r( pDelay->pBuffer_fx[pDelay->BufferPos], pDelay->Gain_fx) , 1)); } } /*-----------------------------------------------------------------------------------------* @@ -307,58 +321,63 @@ void ivas_rev_delay_line_get_sample_blk_fx( pos = (UWord16) pDelay->BufferPos; gain = pDelay->Gain_fx; + move16(); + move16(); - if ( pos + blk_size > (UWord16) pDelay->Delay ) /* splitting block in 2 if it exceeds buffer end limit */ + IF ( GT_32(L_add(pos , blk_size) , pDelay->Delay) ) /* splitting block in 2 if it exceeds buffer end limit */ { UWord16 blk_size_1; /* 1st block up to the end of the buffer */ UWord16 blk_size_2; /* 2nd block at the beginning of the buffer */ - blk_size_1 = (UWord16) pDelay->Delay - pos; - blk_size_2 = blk_size - blk_size_1; + blk_size_1 = (UWord16)L_sub(pDelay->Delay , pos); + blk_size_2 = (UWord16)L_sub(blk_size , blk_size_1); pSrc = &pDelay->pBuffer_fx[pos]; - if ( gain == ONE_IN_Q14 ) + IF ( EQ_16(gain , ONE_IN_Q14) ) { - for ( i = 0; i < blk_size_1; i++ ) + FOR ( i = 0; i < blk_size_1; i++ ) { output[i] = pSrc[i]; + move32(); } pSrc = &pDelay->pBuffer_fx[0]; pDst = &output[blk_size_1]; - for ( i = 0; i < blk_size_2; i++ ) + FOR ( i = 0; i < blk_size_2; i++ ) { pDst[i] = pSrc[i]; + move32(); } } - else + ELSE { - for ( i = 0; i < blk_size_1; i++ ) + FOR ( i = 0; i < blk_size_1; i++ ) { - output[i] = Mpy_32_16_r( pSrc[i],gain ) << 1; + output[i] = L_shl(Mpy_32_16_r( pSrc[i],gain ) , 1); } pSrc = &pDelay->pBuffer_fx[0]; pDst = &output[blk_size_1]; - for ( i = 0; i < blk_size_2; i++ ) + FOR ( i = 0; i < blk_size_2; i++ ) { - pDst[i] = Mpy_32_16_r(pSrc[i],gain ) << 1; + pDst[i] = L_shl(Mpy_32_16_r(pSrc[i],gain ) , 1); } } } - else /* copy only 1 data block directly if it fits in the buffer */ + ELSE /* copy only 1 data block directly if it fits in the buffer */ { pSrc = &pDelay->pBuffer_fx[pos]; - if ( gain == ONE_IN_Q14 ) + IF ( EQ_16(gain , ONE_IN_Q14) ) { - for ( i = 0; i < blk_size; i++ ) + FOR ( i = 0; i < blk_size; i++ ) { output[i] = pSrc[i]; + move32(); } } - else + ELSE { - for ( i = 0; i < blk_size; i++ ) + FOR ( i = 0; i < blk_size; i++ ) { - output[i] = Mpy_32_16_r( pSrc[i], gain ) << 1; + output[i] = L_shl(Mpy_32_16_r( pSrc[i], gain ) , 1); } } } diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 9bd2b542d..8233d16ef 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -53,6 +53,7 @@ +const Word32 FASTCONV_HOA3_latency_s_fx = 20833; const float FASTCONV_HOA3_latency_s = 0.000020833f; const Word32 leftHRIRReal_HOA3_fx[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]= { @@ -7288,6 +7289,7 @@ const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS +const Word32 FASTCONV_HOA2_latency_s_fx = 20833; const float FASTCONV_HOA2_latency_s = 0.000020833f; const Word32 leftHRIRReal_HOA2_fx[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS_SBA]= { @@ -11723,6 +11725,7 @@ const float rightHRIRImag_HOA2[BINAURAL_CONVBANDS][HOA2_CHANNELS][BINAURAL_NTAPS +const Word32 FASTCONV_FOA_latency_s_fx = 20833; const float FASTCONV_FOA_latency_s = 0.000020833f; const Word32 leftHRIRReal_FOA_fx[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_SBA]= { @@ -14157,6 +14160,7 @@ const float rightHRIRImag_FOA[BINAURAL_CONVBANDS][FOA_CHANNELS][BINAURAL_NTAPS_S }; +const Word32 FASTCONV_HRIR_latency_s_fx = 666667; const float FASTCONV_HRIR_latency_s = 0.000666667f; const Word32 leftHRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= { @@ -21731,6 +21735,7 @@ const float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]= /* Binaural rendering data set based on BRIRs */ /* Tables derived from Mozart IIS BRIRs.*/ +const Word32 FASTCONV_BRIR_latency_s_fx = 937500; const float FASTCONV_BRIR_latency_s = 0.000937500f; const Word32 leftBRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= { diff --git a/lib_rend/ivas_rom_binauralRenderer.h b/lib_rend/ivas_rom_binauralRenderer.h index a65192ac8..b0258ccdd 100644 --- a/lib_rend/ivas_rom_binauralRenderer.h +++ b/lib_rend/ivas_rom_binauralRenderer.h @@ -40,6 +40,7 @@ *------------------------------------------------------------------------*/ /* Binaural rendering data set based on HRIRs */ +extern const Word32 FASTCONV_HRIR_latency_s_fx; extern const float FASTCONV_HRIR_latency_s; extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HOA3_CHANNELS][BINAURAL_NTAPS_SBA]; @@ -77,6 +78,9 @@ extern Word32 leftHRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTA extern Word32 rightHRIRReal_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern Word32 rightHRIRImag_fx[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; +extern Word32 FASTCONV_HOA3_latency_s_fx; +extern Word32 FASTCONV_HOA2_latency_s_fx; +extern Word32 FASTCONV_FOA_latency_s_fx; extern float FASTCONV_HOA3_latency_s; extern float FASTCONV_HOA2_latency_s; extern float FASTCONV_FOA_latency_s; @@ -89,6 +93,7 @@ extern Word16 hrtfShCoeffsIm_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BI /* Binaural rendering data set based on BRIRs */ +extern const Word32 FASTCONV_BRIR_latency_s_fx; extern const float FASTCONV_BRIR_latency_s; extern float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 0073b9b85..c9843bafd 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -101,7 +101,10 @@ static void external_target_interpolation( static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); +#ifdef IVAS_FLOAT_FIXED +static bool are_orientations_same_fx( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); +#endif /*-----------------------------------------------------------------------* * ivas_headTrack_open() * @@ -211,12 +214,12 @@ void ivas_headTrack_close( HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ ) { - if ( hHeadTrackData == NULL || *hHeadTrackData == NULL ) + IF ( hHeadTrackData == NULL || *hHeadTrackData == NULL ) { return; } - if ( ( *hHeadTrackData )->OrientationTracker != NULL ) + IF ( ( *hHeadTrackData )->OrientationTracker != NULL ) { free( ( *hHeadTrackData )->OrientationTracker ); ( *hHeadTrackData )->OrientationTracker = NULL; @@ -394,13 +397,13 @@ float deg2rad( Word32 deg2rad_fx( Word32 degrees ) { - while ( degrees >= DEGREE_180 ) + WHILE ( GE_32(degrees , DEGREE_180 )) { - degrees = degrees - DEGREE_360; + degrees = L_sub(degrees , DEGREE_360); } - while ( degrees <= -DEGREE_180 ) + WHILE( LE_32(degrees , -DEGREE_180) ) { - degrees = degrees + DEGREE_360; + degrees = L_add(degrees , DEGREE_360); } return Mpy_32_32( PI_OVER_180_FX, degrees ); @@ -432,18 +435,18 @@ Word32 rad2deg_fx( Word32 radians ) { - while ( radians >= EVS_PI_FX ) + WHILE ( GE_32(radians , EVS_PI_FX) ) { - radians = radians - EVS_PI_FX; + radians = L_sub(radians, EVS_PI_FX); } - while ( radians <= -EVS_PI_FX ) + WHILE(LE_32( radians , -EVS_PI_FX) ) { - radians = radians + EVS_PI_FX; + radians = L_add(radians , EVS_PI_FX); } return ( radians * _180_OVER_PI_FX ); } -#endif +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * rotateAziEle() @@ -464,24 +467,32 @@ void rotateAziEle_fx( Word32 dv_fx[3], dv_r_fx[3]; Word32 w_fx; Word32 temp; + Word16 temp_16; Word32 y, x, sqrt_fx; Word16 radian, angle; /*Conversion spherical to cartesian coordinates*/ - if ( abs( azi_in ) > 180 ) + IF( GT_16( abs_s( azi_in ), 180 ) ) { - azi_in = ( azi_in > 0 ) ? ( azi_in - 360 ) : ( azi_in + 360 ); + azi_in = GT_16( azi_in, 0 ) ? sub( azi_in, 360 ) : add( azi_in, 360 ); } - temp = ele_in; - w_fx = cosine_table_Q31[abs( temp )]; - temp = azi_in; - dv_fx[0] = Mpy_32_32( w_fx, cosine_table_Q31[abs( temp )] ); - temp = azi_in; - dv_fx[1] = Mpy_32_32( w_fx, sine_table_Q31[temp + 180] ); - temp = ele_in; - dv_fx[2] = sine_table_Q31[temp + 180]; - + temp_16 = ele_in; + move16(); + w_fx = cosine_table_Q31[abs_s( temp_16 )]; + move32(); + temp_16 = azi_in; + move16(); + dv_fx[0] = Mpy_32_32( w_fx, cosine_table_Q31[abs_s( temp_16 )] ); + move32(); + temp_16 = azi_in; + move16(); + dv_fx[1] = Mpy_32_32( w_fx, sine_table_Q31[add( temp_16, 180 )] ); + move32(); + temp_16 = ele_in; + move16(); + dv_fx[2] = sine_table_Q31[add( temp_16, 180 )]; + move32(); /*Rotation mtx multiplication*/ - for ( n = 0; n < 3; n++ ) + FOR( n = 0; n < 3; n++ ) { temp = L_add( Mpy_32_32( dv_fx[0], Rmat_fx[n][0] ), Mpy_32_32( dv_fx[1], Rmat_fx[n][1] ) ); dv_r_fx[n] = L_add( Mpy_32_32( dv_fx[2], Rmat_fx[n][2] ), temp ); // Q30 @@ -489,65 +500,68 @@ void rotateAziEle_fx( /*Conversion cartesian to spherical coordinates*/ y = dv_r_fx[1]; + move32(); x = dv_r_fx[0]; - radian = atan2_fx( abs( y >> 15 ), abs( x >> 15 ) ); + move32(); + radian = atan2_fx( L_abs( L_shr( y, 15 ) ), L_abs( L_shr( x, 15 ) ) ); radian = y > 0 ? radian : -radian; - if ( x < 0 ) + IF( LT_32( x, 0 ) ) { - if ( radian < 0 ) + IF( LT_32( radian, 0 ) ) { - angle = -( 180 + ( Mpy_32_16_1( _180_OVER_PI_Q25, radian ) >> ( 24 ) ) ); + angle = -add( 180, extract_l( L_shr( Mpy_32_16_1( _180_OVER_PI_Q25, radian ), ( 24 ) ) ) ); } - else + ELSE { - angle = 180 - ( Mpy_32_16_1( _180_OVER_PI_Q25, radian ) >> ( 24 ) ); + angle = sub( 180, extract_l( L_shr( Mpy_32_16_1( _180_OVER_PI_Q25, radian ), ( 24 ) ) ) ); } - if ( radian == 0 ) + IF( EQ_16( radian, 0 ) ) { - angle = y >= 0 ? angle : -angle; + angle = GE_32( y, 0 ) ? angle : -angle; } } - else + ELSE { - angle = ( Mpy_32_16_1( _180_OVER_PI_Q25, radian ) >> ( 24 ) ); + angle = extract_l( L_shr( Mpy_32_16_1( _180_OVER_PI_Q25, radian ), 24 ) ); } - *azi = (Word16) ( max( -180, min( 180, angle ) ) ); + *azi = (Word16) ( s_max( -180, min( 180, angle ) ) ); - if ( isPlanar == 0 ) + IF( EQ_16( isPlanar, 0 ) ) { sqrt_fx = L_Frac_sqrtQ31( L_add( Mpy_32_32( dv_r_fx[0], dv_r_fx[0] ), Mpy_32_32( dv_r_fx[1], dv_r_fx[1] ) ) ); y = dv_r_fx[2]; x = sqrt_fx; - radian = atan2_fx( abs( y >> 15 ), abs( x >> 15 ) ); + radian = atan2_fx( L_abs( L_shr( y, 15 ) ), L_abs( L_shr( x, 15 ) ) ); radian = y > 0 ? radian : -radian; - if ( x < 0 ) + IF( LT_32( x, 0 ) ) { - if ( radian < 0 ) + IF( LT_16( radian, 0 ) ) { - angle = -( 180 + ( Mpy_32_16_r( _180_OVER_PI_Q25, radian ) >> ( 24 ) ) ); + angle = -add( 180, extract_l( L_shr( Mpy_32_16_r( _180_OVER_PI_Q25, radian ), ( 24 ) ) ) ); } - else + ELSE { - angle = 180 - ( Mpy_32_16_r( _180_OVER_PI_Q25, radian ) >> ( 24 ) ); + angle = sub( 180, extract_l( L_shr( Mpy_32_16_r( _180_OVER_PI_Q25, radian ), ( 24 ) ) ) ); } - if ( radian == 0 ) + IF( EQ_16( radian, 0 ) ) { angle = y >= 0 ? angle : -angle; } } - else + ELSE { - angle = ( Mpy_32_16_r( _180_OVER_PI_Q25, radian ) >> ( 24 ) ); + angle = extract_l( L_shr( Mpy_32_16_r( _180_OVER_PI_Q25, radian ), ( 24 ) ) ); } - *ele = (Word16) ( max( -90, min( 90, angle ) ) ); + *ele = (Word16) ( s_max( -90, s_min( 90, angle ) ) ); } - else + ELSE { *ele = 0; + move16(); } return; @@ -575,21 +589,28 @@ void rotateAziEle_fixed( Word32 y, x, sqrt_fx; Word32 angle; /*Conversion spherical to cartesian coordinates*/ - if ( abs( azi_in ) > 180 ) + IF( GT_16( abs_s( azi_in ), 180 ) ) { - azi_in = ( azi_in > 0 ) ? ( azi_in - 360 ) : ( azi_in + 360 ); + azi_in = ( azi_in > 0 ) ? sub( azi_in, 360 ) : add( azi_in, 360 ); } temp_16 = ele_in; + move16(); w_fx = cosine_table_Q31[abs( temp_16 )]; + move32(); temp_16 = azi_in; - dv_fx[0] = Mpy_32_32( w_fx, cosine_table_Q31[abs( temp_16 )] ); + move16(); + dv_fx[0] = Mpy_32_32( w_fx, cosine_table_Q31[abs_s( temp_16 )] ); + move32(); temp_16 = azi_in; + move16(); dv_fx[1] = Mpy_32_32( w_fx, sine_table_Q31[temp_16 + 180] ); + move32(); temp_16 = ele_in; + move16(); dv_fx[2] = sine_table_Q31[temp_16 + 180]; - + move32(); /*Rotation mtx multiplication*/ - for ( n = 0; n < 3; n++ ) + FOR( n = 0; n < 3; n++ ) { temp = L_add( Mpy_32_32( dv_fx[0], Rmat_fx[n][0] ), Mpy_32_32( dv_fx[1], Rmat_fx[n][1] ) ); dv_r_fx[n] = L_add( Mpy_32_32( dv_fx[2], Rmat_fx[n][2] ), temp ); // Q30 @@ -597,36 +618,41 @@ void rotateAziEle_fixed( /*Conversion cartesian to spherical coordinates*/ y = dv_r_fx[1]; + move32(); x = dv_r_fx[0]; - radian = BASOP_util_atan2( y, x, 0 ); // Q13 + move32(); + radian = BASOP_util_atan2( y, x, 0 ); // Q13 - angle = ( Mpy_32_16_1( _180_OVER_PI_Q25, radian ) >> 1 ); // Q22 + angle = L_shr( Mpy_32_16_1( _180_OVER_PI_Q25, radian ), 1 ); // Q22 - *azi = (Word32) ( max( L_shl( -180, 22 ), min( L_shl( 180, 22 ), angle ) ) ); // Q22 - if ( abs( *azi ) <= ONE_IN_Q22 ) + *azi = (Word32) ( L_max( L_shl( -180, 22 ), L_min( L_shl( 180, 22 ), angle ) ) ); // Q22 + IF( LE_32( L_abs( *azi ), ONE_IN_Q22 ) ) { *azi = 0; + move32(); } - if ( isPlanar == 0 ) + IF( EQ_16( isPlanar, 0 ) ) { sqrt_fx = L_Frac_sqrtQ31( L_add( Mpy_32_32( dv_r_fx[0], dv_r_fx[0] ), Mpy_32_32( dv_r_fx[1], dv_r_fx[1] ) ) ); y = dv_r_fx[2]; x = sqrt_fx; radian = BASOP_util_atan2( y, x, 0 ); - angle = ( Mpy_32_16_1( _180_OVER_PI_Q25, radian ) >> 1 ); // Q22 + angle = L_shr( Mpy_32_16_1( _180_OVER_PI_Q25, radian ), 1 ); // Q22 - *ele = (Word32) ( max( L_shl( -90, 22 ), min( L_shl( 90, 22 ), angle ) ) ); // Q22 - if ( abs( *ele ) < ONE_IN_Q22 ) + *ele = (Word32) ( L_max( L_shl( -90, 22 ), L_min( L_shl( 90, 22 ), angle ) ) ); // Q22 + IF( LT_32( L_abs( *ele ), ONE_IN_Q22 ) ) { *ele = 0; + move32(); } } - else + ELSE { *ele = 0; + move32(); } return; @@ -724,7 +750,7 @@ void rotateFrame_shd( default: BREAK; } - + move32(); FOR( i = 0; i < subframe_len; i++ ) { cross_fade[i] = UL_Mpy_32_32( i, tmp ); @@ -748,14 +774,16 @@ void rotateFrame_shd( /* loop over l blocks */ m1 = 1; + move16(); m2 = 4; + move16(); FOR( l = 1; l <= shd_rot_max_order; l++ ) { /* compute mtx-vector product for this l */ FOR( n = m1; n < m2; n++ ) { tmpRot[n - m1] = 0; - + move32(); FOR( m = m1; m < m2; m++ ) { /* crossfade with previous rotation gains */ @@ -770,7 +798,9 @@ void rotateFrame_shd( output[n][subframe_idx * subframe_len + i] = (Word32) tmpRot[n - m1]; } m1 = m2; - m2 += 2 * ( l + 1 ) + 1; + move16(); + m2 = add( m2, add( shl( add( l, 1 ), 1 ), 1 ) ); + } /* unoptimized code for reference (full matrix multiplication) @@ -929,6 +959,7 @@ void rotateFrame_sd( Word16 azimuth, elevation; Word32 azimuth_fx, elevation_fx; Word32 tmp = Q31_BY_SUB_FRAME_240; + move32(); Word32 out_temp; Word32 tmp_gains_fx[MAX_CICP_CHANNELS - 1]; Word32 gains_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; @@ -936,9 +967,9 @@ void rotateFrame_sd( Word32 output_tmp_fx[MAX_CICP_CHANNELS][L_FRAME48k]; Word32 cross_fade_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; push_wmops( "rotateFrame_sd" ); - nchan = hTransSetup.nchan_out_woLFE + hTransSetup.num_lfe; + nchan = add(hTransSetup.nchan_out_woLFE , hTransSetup.num_lfe); index_lfe = hTransSetup.index_lfe[0]; - + move16(); SWITCH( subframe_len ) { case L_SUBFRAME_48k: @@ -956,7 +987,7 @@ void rotateFrame_sd( default: BREAK; } - + move32(); FOR( i = 0; i < subframe_len; i++ ) { cross_fade_fx[i] = UL_Mpy_32_32( i, tmp ); @@ -970,37 +1001,39 @@ void rotateFrame_sd( set_val_Word32( gains_fx[ch_in], 0, nchan ); /* set gains to passthrough by default */ gains_prev_fx[ch_in][ch_in] = ONE_IN_Q30; + move32(); gains_fx[ch_in][ch_in] = ONE_IN_Q30; - + move32(); /* skip LFE */ - IF( ch_in == index_lfe ) + IF( EQ_16( ch_in, index_lfe ) ) { - continue; + CONTINUE; } /* input channel index without LFE */ - ch_in_woLFE = ( ch_in >= index_lfe ) ? ch_in - 1 : ch_in; + ch_in_woLFE = ( ch_in >= index_lfe ) ? sub( ch_in, 1 ) : ch_in; /* gains for previous subframe rotation */ rotateAziEle_fx( (Word16) hTransSetup.ls_azimuth[ch_in_woLFE], (Word16) hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev_fx, hTransSetup.is_planar_setup ); - + test(); + test(); IF( hEFAPdata != NULL && ( hTransSetup.ls_azimuth[ch_in_woLFE] != azimuth || hTransSetup.ls_elevation[ch_in_woLFE] != elevation ) ) { - azimuth_fx = (Word32) azimuth * ONE_IN_Q22; - elevation_fx = (Word32) elevation * ONE_IN_Q22; + azimuth_fx = L_shl( (Word32) azimuth, Q22 ); + elevation_fx = L_shl( (Word32) elevation, Q22 ); efap_determine_gains_fx( hEFAPdata, tmp_gains_fx, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); FOR( ch_out = 0; ch_out < nchan; ch_out++ ) { /* skip LFE */ - if ( ch_out == index_lfe ) + IF( EQ_16( ch_out, index_lfe ) ) { - continue; + CONTINUE; } /* output channel index without LFE */ - ch_out_woLFE = ( ch_out >= index_lfe ) ? ch_out - 1 : ch_out; + ch_out_woLFE = ( ch_out >= index_lfe ) ? sub(ch_out , 1) : ch_out; gains_prev_fx[ch_in][ch_out] = tmp_gains_fx[ch_out_woLFE]; // Q30 } } @@ -1011,20 +1044,20 @@ void rotateFrame_sd( IF( hEFAPdata != NULL && ( hTransSetup.ls_azimuth[ch_in_woLFE] != azimuth || hTransSetup.ls_elevation[ch_in_woLFE] != elevation ) ) { - azimuth_fx = (Word32) azimuth * ONE_IN_Q22; - elevation_fx = (Word32) elevation * ONE_IN_Q22; + azimuth_fx = L_shl( (Word32) azimuth, Q22 ); + elevation_fx = L_shl( (Word32) elevation, Q22 ); efap_determine_gains_fx( hEFAPdata, tmp_gains_fx, azimuth_fx, elevation_fx, EFAP_MODE_EFAP ); FOR( ch_out = 0; ch_out < nchan; ch_out++ ) { /* skip LFE */ - if ( ch_out == index_lfe ) + IF( EQ_16( ch_out, index_lfe ) ) { - continue; + CONTINUE; } /* output channel index without LFE */ - ch_out_woLFE = ( ch_out >= index_lfe ) ? ch_out - 1 : ch_out; + ch_out_woLFE = ( ch_out >= index_lfe ) ? sub(ch_out, 1) : ch_out; gains_fx[ch_in][ch_out] = tmp_gains_fx[ch_out_woLFE]; // Q30 } @@ -1036,13 +1069,16 @@ void rotateFrame_sd( { FOR( ch_in = 0; ch_in < nchan; ch_in++ ) { + j = 0; /* crossfade with previous rotation gains */ - for ( i = subframe_idx * subframe_len, j = 0; j < subframe_len; i++, j++ ) + FOR( i = subframe_idx * subframe_len; j < subframe_len; i++ ) { out_temp = output[ch_in][i]; + move32(); Word32 temp = Mpy_32_32( Mpy_32_32( ( cross_fade_fx[j] ), gains_fx[ch_in][ch_out] ), out_temp ); - Word32 temp1 = Mpy_32_32( Mpy_32_32( ( ONE_IN_Q31 - cross_fade_fx[j] ), gains_prev_fx[ch_in][ch_out] ), out_temp ); + Word32 temp1 = Mpy_32_32( Mpy_32_32(L_sub ( ONE_IN_Q31 , cross_fade_fx[j] ), gains_prev_fx[ch_in][ch_out] ), out_temp ); output_tmp_fx[ch_out][i] = L_add( L_shl( L_add( temp, temp1 ), 1 ), output_tmp_fx[ch_out][i] ); + j++; } } } @@ -1224,7 +1260,7 @@ void rotateFrame_shd_cldfb( assert( nInChannels == HEADROT_SHMAT_DIM && "Number of channels must be 16!" ); /* initialize rotation matrices with zeros */ - for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) + FOR( i = 0; i < HEADROT_SHMAT_DIM; i++ ) { set16_fx( SHrotmat[i], 0, HEADROT_SHMAT_DIM ); } @@ -1236,24 +1272,28 @@ void rotateFrame_shd_cldfb( dbgwrite_txt( SHrotmat, HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM, "Fixed_SHrotmat.txt", NULL ); #endif /* rotation by mtx multiplication */ - for ( i = 0; i < numTimeSlots; i++ ) + FOR( i = 0; i < numTimeSlots; i++ ) { - for ( iBand = 0; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) + FOR( iBand = 0; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) { /*As the rotation matrix becomes block diagonal in a SH basis, we can apply each angular-momentum block individually to save complexity. */ /* loop over l blocks */ m1 = 1; + move16(); m2 = 4; - for ( l = 1; l <= shd_rot_max_order; l++ ) + move16(); + FOR( l = 1; l <= shd_rot_max_order; l++ ) { /* compute mtx-vector product for this l */ - for ( n = m1; n < m2; n++ ) + FOR( n = m1; n < m2; n++ ) { realRot[n - m1] = 0; + move32(); imagRot[n - m1] = 0; - for ( m = m1; m < m2; m++ ) + move32(); + FOR( m = m1; m < m2; m++ ) { temp1 = Mpy_32_16_r( Cldfb_RealBuffer[m][i][iBand], SHrotmat[n][m] ); temp2 = Mpy_32_16_r( Cldfb_ImagBuffer[m][i][iBand], SHrotmat[n][m] ); @@ -1262,13 +1302,16 @@ void rotateFrame_shd_cldfb( } } /* write back the result */ - for ( n = m1; n < m2; n++ ) + FOR( n = m1; n < m2; n++ ) { Cldfb_RealBuffer[n][i][iBand] = realRot[n - m1]; + move32(); Cldfb_ImagBuffer[n][i][iBand] = imagRot[n - m1]; + move32(); } m1 = m2; - m2 += 2 * ( l + 1 ) + 1; + move16(); + m2 = add( m2, add( shl( add( l, 1 ), 1 ), 1 ) ); } /* unoptimized code for reference (full matrix multiplication) @@ -1292,12 +1335,12 @@ void rotateFrame_shd_cldfb( } } // To make the Q factor same as tha of the remaining vector values - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + FOR( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) { - Cldfb_RealBuffer[0][j][k] = Cldfb_RealBuffer[0][j][k] / ONE_IN_Q1; - Cldfb_ImagBuffer[0][j][k] = Cldfb_ImagBuffer[0][j][k] / ONE_IN_Q1; + Cldfb_RealBuffer[0][j][k] = L_shr( Cldfb_RealBuffer[0][j][k], 1 ); + Cldfb_ImagBuffer[0][j][k] = L_shr( Cldfb_ImagBuffer[0][j][k], 1 ); } } return; @@ -1516,20 +1559,20 @@ void rotateFrame_sd_cldfb_fixed( Word32 Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t numTimeSlots, /* i : number of time slots to process */ - const int16_t nb_band /* i : number of CLDFB bands to process */ + const Word16 numTimeSlots, /* i : number of time slots to process */ + const Word16 nb_band /* i : number of CLDFB bands to process */ ) { - int16_t iBlock, iBand, m, n; + Word16 iBlock, iBand, m, n; Word32 gains_fx[MAX_CICP_CHANNELS - 1][MAX_CICP_CHANNELS - 1]; - int16_t azimuth, elevation; + Word16 azimuth, elevation; Word32 g1_fx; Word32 realRot_fx[MAX_CICP_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; Word32 imagRot_fx[MAX_CICP_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; Word32 *p_realRot_fx, *p_imagRot_fx; Word32 *p_real_fx, *p_imag_fx; - int16_t nInChannels; - int16_t isPlanar; + Word16 nInChannels; + Word16 isPlanar; push_wmops( "rotateFrame_sd_cldfb" ); nInChannels = hOutputSetup->nchan_out_woLFE; @@ -1539,7 +1582,7 @@ void rotateFrame_sd_cldfb_fixed( IF( hOutputSetup->ls_elevation[n] != 0 ) { isPlanar = 0; - break; + BREAK; } } @@ -1557,29 +1600,37 @@ void rotateFrame_sd_cldfb_fixed( { set_l( gains_fx[n], 0, nInChannels ); gains_fx[n][n] = 0x7fffffff; + move32(); } } /* Apply panning gains by mtx multiplication*/ FOR( n = 0; n < nInChannels; n++ ) { - set_l( realRot_fx[n], 0, MAX_PARAM_SPATIAL_SUBFRAMES * nb_band ); - set_l( imagRot_fx[n], 0, MAX_PARAM_SPATIAL_SUBFRAMES * nb_band ); + set_l( realRot_fx[n], 0, shl( nb_band, 2 ) ); + set_l( imagRot_fx[n], 0, shl( nb_band, 2 ) ); FOR( m = 0; m < nInChannels; m++ ) { g1_fx = gains_fx[m][n]; + move32(); p_realRot_fx = realRot_fx[n]; + move32(); p_imagRot_fx = imagRot_fx[n]; + move32(); IF( GT_32( g1_fx, 0 ) ) { FOR( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) { p_real_fx = Cldfb_RealBuffer[m][iBlock]; + move32(); p_imag_fx = Cldfb_ImagBuffer[m][iBlock]; + move32(); FOR( iBand = 0; iBand < nb_band; iBand++ ) { - *( p_realRot_fx ) = *p_realRot_fx + Mpy_32_32( g1_fx, *( p_real_fx++ ) ); - *( p_imagRot_fx ) = *p_imagRot_fx + Mpy_32_32( g1_fx, *( p_imag_fx++ ) ); + *( p_realRot_fx ) =L_add( *p_realRot_fx , Mpy_32_32( g1_fx, *( p_real_fx++ ) )); + move32(); + *( p_imagRot_fx ) =L_add( *p_imagRot_fx , Mpy_32_32( g1_fx, *( p_imag_fx++ ) )); + move32(); p_realRot_fx++; p_imagRot_fx++; } @@ -1591,20 +1642,28 @@ void rotateFrame_sd_cldfb_fixed( FOR( n = 0; n < nInChannels; n++ ) { p_realRot_fx = realRot_fx[n]; + move32(); p_imagRot_fx = imagRot_fx[n]; + move32(); FOR( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) { p_real_fx = Cldfb_RealBuffer[n][iBlock]; + move32(); p_imag_fx = Cldfb_ImagBuffer[n][iBlock]; + move32(); FOR( iBand = 0; iBand < nb_band; iBand++ ) { *( p_real_fx++ ) = *( p_realRot_fx++ ); + move32(); *( p_imag_fx++ ) = *( p_imagRot_fx++ ); + move32(); } FOR( ; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) { *( p_real_fx++ ) = 0; + move32(); *( p_imag_fx++ ) = 0; + move32(); } } } @@ -1619,7 +1678,49 @@ void rotateFrame_sd_cldfb_fixed( * * Allocate and initialize external orientation handle *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_external_orientation_open( + EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData, /* o : external orientation handle */ + const Word16 num_subframes /* i : number of subframes */ +) +{ + + Word16 i; + IVAS_QUATERNION identity; +#if 0 // to be removed later + identity.w = 1.0f; + identity.x = identity.y = identity.z = 0.0f; +#endif + identity.w_fx = ONE_IN_Q31; + move32(); + identity.x_fx = 0; + move32(); + identity.y_fx = 0; + move32(); + identity.z_fx = 0; + move32(); + identity.q_fact = 31; + move16(); + /* Allocate handle */ + IF( ( *hExtOrientationData = (EXTERNAL_ORIENTATION_HANDLE) malloc( sizeof( EXTERNAL_ORIENTATION_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for external orientation memory\n" ) ); + } + ( *hExtOrientationData )->num_subframes = num_subframes; + /* Enable head rotation and disable external orientation as default */ + FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + ( *hExtOrientationData )->enableHeadRotation[i] = 1; + ( *hExtOrientationData )->enableExternalOrientation[i] = 0; + ( *hExtOrientationData )->enableRotationInterpolation[i] = 0; + ( *hExtOrientationData )->numFramesToTargetOrientation[i] = 0; + move16(); + ( *hExtOrientationData )->Quaternions[i] = identity; + } + return IVAS_ERR_OK; +} +#else ivas_error ivas_external_orientation_open( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData, /* o : external orientation handle */ const int16_t num_subframes /* i : number of subframes */ @@ -1650,7 +1751,7 @@ ivas_error ivas_external_orientation_open( return IVAS_ERR_OK; } - +#endif /*-----------------------------------------------------------------------* * ivas_external_orientation_close() * @@ -1695,33 +1796,133 @@ void ivas_external_orientation_close( * * Allocate and initialize combined orientation handle *-----------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED ivas_error ivas_combined_orientation_open( COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* o : combined orientation handle */ - const int32_t fs, /* i : sampling rate */ - const int16_t num_subframes /* i : number of subframes */ + const Word32 fs, /* i : sampling rate */ + const Word16 num_subframes /* i : number of subframes */ ) { - int16_t i; - int16_t j; + Word16 i; + Word16 j; + Word16 tmp_e = 0, tmp; IVAS_QUATERNION identity; IVAS_VECTOR3 origo; - +#if 0 // to be removed later identity.w = 1.0f; identity.x = identity.y = identity.z = 0.0f; origo.x = origo.y = origo.z = 0.0f; -#ifdef IVAS_FLOAT_FIXED +#endif identity.w_fx = ONE_IN_Q31; + move32(); identity.x_fx = 0; + move32(); identity.y_fx = 0; + move32(); identity.z_fx = 0; + move32(); identity.q_fact = 31; - + move16(); origo.x_fx = 0; + move32(); origo.y_fx = 0; + move32(); origo.z_fx = 0; + move32(); origo.q_fact = 31; + move16(); + /* Allocate handle */ + IF( ( *hCombinedOrientationData = (COMBINED_ORIENTATION_HANDLE) malloc( sizeof( COMBINED_ORIENTATION_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for combined orientation memory\n" ) ); + } + + /* Initialization */ + ( *hCombinedOrientationData )->num_subframes = num_subframes; + move16(); + ( *hCombinedOrientationData )->interpolationCoefficient_fx = ONE_IN_Q30; + move32(); + ( *hCombinedOrientationData )->interpolationIncrement_Fx = ONE_IN_Q30; + move32(); + IF( EQ_16( num_subframes, 1 ) ) + { + ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 2000; + move16(); + } + ELSE + { + ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 500; + move16(); + } + ( *hCombinedOrientationData )->lrSwitchedNext = 0; + ( *hCombinedOrientationData )->lrSwitchedCurrent = 0; + + ( *hCombinedOrientationData )->lrSwitchInterpVal_fx = 0; + ( *hCombinedOrientationData )->isInterpolationOngoing = FALSE; + ( *hCombinedOrientationData )->Quaternions_ext_interpolation_start = identity; + ( *hCombinedOrientationData )->Quaternions_ext_interpolation_target = identity; + + /* Initialise orientations to identity */ + FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + ( *hCombinedOrientationData )->enableCombinedOrientation[i] = 0; + move16(); + ( *hCombinedOrientationData )->Quaternions[i] = identity; + ( *hCombinedOrientationData )->listenerPos[i] = origo; + + FOR( j = 0; j < 3; j++ ) + { + set32_fx( ( *hCombinedOrientationData )->Rmat_fx[i][j], 0, 3 ); + ( *hCombinedOrientationData )->Rmat_fx[i][j][j] = ONE_IN_Q30; + move32(); + } + } + + FOR( j = 0; j < 3; j++ ) + { + set32_fx( ( *hCombinedOrientationData )->Rmat_prev_fx[j], 0, 3 ); + ( *hCombinedOrientationData )->Rmat_prev_fx[j][j] = ONE_IN_Q30; + move32(); + } + ( *hCombinedOrientationData )->Quaternion_prev_extOrientation = identity; + ( *hCombinedOrientationData )->Quaternion_frozen_ext = identity; + ( *hCombinedOrientationData )->Quaternion_frozen_head = identity; + set_zero_fx( ( *hCombinedOrientationData )->chEneIIR_fx[0], MASA_FREQUENCY_BANDS ); + set_zero_fx( ( *hCombinedOrientationData )->chEneIIR_fx[1], MASA_FREQUENCY_BANDS ); + set_zero_fx( ( *hCombinedOrientationData )->procChEneIIR_fx[0], MASA_FREQUENCY_BANDS ); + set_zero_fx( ( *hCombinedOrientationData )->procChEneIIR_fx[1], MASA_FREQUENCY_BANDS ); + ( *hCombinedOrientationData )->q_chEneIIR = Q31; + move16(); + ( *hCombinedOrientationData )->q_procChEneIIR = Q31; + move16(); + ( *hCombinedOrientationData )->isExtOrientationFrozen = 0; + ( *hCombinedOrientationData )->isHeadRotationFrozen = 0; + + ( *hCombinedOrientationData )->subframe_idx = 0; + move16(); + tmp = BASOP_Util_Divide3232_Scale( fs, MAX_PARAM__SPATIAL_SUB_FRAMES_PER_SEC, &tmp_e ); + ( *hCombinedOrientationData )->subframe_size = shr( tmp, sub( 15, tmp_e ) ); + // ( *hCombinedOrientationData )->subframe_size = (int16_t) ( fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); + ( *hCombinedOrientationData )->cur_subframe_samples_rendered = 0; + + return IVAS_ERR_OK; +} #endif +#ifndef IVAS_FLOAT_FIXED +ivas_error ivas_combined_orientation_open( + COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* o : combined orientation handle */ + const int32_t fs, /* i : sampling rate */ + const int16_t num_subframes /* i : number of subframes */ +) +{ + int16_t i; + int16_t j; + IVAS_QUATERNION identity; + IVAS_VECTOR3 origo; + + identity.w = 1.0f; + identity.x = identity.y = identity.z = 0.0f; + origo.x = origo.y = origo.z = 0.0f; /* Allocate handle */ if ( ( *hCombinedOrientationData = (COMBINED_ORIENTATION_HANDLE) malloc( sizeof( COMBINED_ORIENTATION_DATA ) ) ) == NULL ) @@ -1744,9 +1945,6 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->lrSwitchedNext = 0; ( *hCombinedOrientationData )->lrSwitchedCurrent = 0; ( *hCombinedOrientationData )->lrSwitchInterpVal = 0.0f; -#ifdef IVAS_FLOAT_FIXED - (*hCombinedOrientationData)->lrSwitchInterpVal_fx = 0; -#endif ( *hCombinedOrientationData )->isInterpolationOngoing = FALSE; ( *hCombinedOrientationData )->Quaternions_ext_interpolation_start = identity; ( *hCombinedOrientationData )->Quaternions_ext_interpolation_target = identity; @@ -1780,15 +1978,6 @@ ivas_error ivas_combined_orientation_open( set_zero( ( *hCombinedOrientationData )->chEneIIR[1], MASA_FREQUENCY_BANDS ); set_zero( ( *hCombinedOrientationData )->procChEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hCombinedOrientationData )->procChEneIIR[1], MASA_FREQUENCY_BANDS ); -#ifdef IVAS_FLOAT_FIXED - set_zero_fx((*hCombinedOrientationData)->chEneIIR_fx[0], MASA_FREQUENCY_BANDS); - set_zero_fx((*hCombinedOrientationData)->chEneIIR_fx[1], MASA_FREQUENCY_BANDS); - set_zero_fx((*hCombinedOrientationData)->procChEneIIR_fx[0], MASA_FREQUENCY_BANDS); - set_zero_fx((*hCombinedOrientationData)->procChEneIIR_fx[1], MASA_FREQUENCY_BANDS); - (*hCombinedOrientationData)->q_chEneIIR = Q31; - (*hCombinedOrientationData)->q_procChEneIIR = Q31; -#endif - ( *hCombinedOrientationData )->isExtOrientationFrozen = 0; ( *hCombinedOrientationData )->isHeadRotationFrozen = 0; @@ -1798,8 +1987,7 @@ ivas_error ivas_combined_orientation_open( return IVAS_ERR_OK; } - - +#endif /*-----------------------------------------------------------------------* * ivas_combined_orientation_close() * @@ -1855,12 +2043,11 @@ ivas_error combine_external_and_head_orientations_dec( IVAS_QUATERNION *pHeadRotQuaternion = NULL; IVAS_VECTOR3 *listenerPos = NULL; - if ( hHeadTrackData != NULL ) + IF( hHeadTrackData != NULL ) { pHeadRotQuaternion = hHeadTrackData->Quaternions; listenerPos = hHeadTrackData->Pos; } - return combine_external_and_head_orientations( pHeadRotQuaternion, listenerPos, hExtOrientationData, hCombinedOrientationData ); } @@ -1880,22 +2067,22 @@ ivas_error combine_external_and_head_orientations_rend( { IVAS_QUATERNION *headRotQuaternions = NULL; IVAS_VECTOR3 *listenerPos = NULL; - int16_t i; + Word16 i; - if ( hHeadTrackData != NULL ) + IF( hHeadTrackData != NULL ) { - if ( hHeadTrackData->headRotEnabled ) + IF( hHeadTrackData->headRotEnabled ) { headRotQuaternions = hHeadTrackData->headPositions; listenerPos = hHeadTrackData->Pos; } } - else if ( hExtOrientationData != NULL ) + ELSE IF( hExtOrientationData != NULL ) { /* Head rotation data not available, use the freezed value or disable */ - for ( i = 0; i < hExtOrientationData->num_subframes; i++ ) + FOR( i = 0; i < hExtOrientationData->num_subframes; i++ ) { - if ( hExtOrientationData->enableHeadRotation[i] != 2 ) + IF( hExtOrientationData->enableHeadRotation[i] != 2 ) { hExtOrientationData->enableHeadRotation[i] = 0; } @@ -1913,7 +2100,7 @@ ivas_error combine_external_and_head_orientations_rend( * Combine the external orientations and the head orientation. * NOTE that the external orientations are inversed. *------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED ivas_error combine_external_and_head_orientations( IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ IVAS_VECTOR3 *listenerPos, /* i : listener position */ @@ -1921,107 +2108,397 @@ ivas_error combine_external_and_head_orientations( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { - int16_t i; - int16_t j; + Word16 i; + Word16 j; IVAS_QUATERNION identity; IVAS_VECTOR3 origo; - - identity.w = 1.0f; - identity.x = identity.y = identity.z = 0.0f; - origo.x = origo.y = origo.z = 0.0f; + identity.w_fx = ONE_IN_Q31; + move32(); + identity.x_fx = 0; + move32(); + identity.y_fx = 0; + move32(); + identity.z_fx = 0; + move32(); + identity.q_fact = 31; + move16(); + origo.x_fx = 0; + move32(); + origo.y_fx = 0; + move32(); + origo.z_fx = 0; + move32(); + origo.q_fact = 31; + move16(); /* Form combined orientations or return if no data available */ - if ( hCombinedOrientationData == NULL ) + IF( hCombinedOrientationData == NULL ) { - if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) + test(); + IF( headRotQuaternions != NULL || hExtOrientationData != NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - else + ELSE { return IVAS_ERR_OK; } } - else if ( headRotQuaternions == NULL && hExtOrientationData == NULL ) + ELSE IF( headRotQuaternions == NULL && hExtOrientationData == NULL ) { /* Reset the combined orientations and rotations */ hCombinedOrientationData->isInterpolationOngoing = FALSE; - hCombinedOrientationData->interpolationCoefficient = 1.0f; - hCombinedOrientationData->interpolationIncrement = 1.0f; + hCombinedOrientationData->interpolationCoefficient_fx = ONE_IN_Q30; + move32(); + hCombinedOrientationData->interpolationIncrement_Fx = ONE_IN_Q30; + move32(); hCombinedOrientationData->Quaternions_ext_interpolation_start = identity; hCombinedOrientationData->Quaternions_ext_interpolation_target = identity; - for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) { hCombinedOrientationData->enableCombinedOrientation[i] = 0; hCombinedOrientationData->Quaternions[i] = identity; hCombinedOrientationData->listenerPos[i] = origo; - for ( j = 0; j < 3; j++ ) + FOR( j = 0; j < 3; j++ ) { - set_zero( hCombinedOrientationData->Rmat[i][j], 3 ); - hCombinedOrientationData->Rmat[i][j][j] = 1.0f; + set_zero_fx( hCombinedOrientationData->Rmat_fx[i][j], 3 ); + hCombinedOrientationData->Rmat_fx[i][j][j] = ONE_IN_Q30; + move32(); } } } - else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) + ELSE IF( hExtOrientationData == NULL && headRotQuaternions != NULL ) { /* Head rotation only */ - for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) { hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; } } - if ( hExtOrientationData != NULL ) + IF( hExtOrientationData != NULL ) { /* External orientations */ - for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) { /* Check for frozen external orientation */ - if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) + IF( hExtOrientationData->enableExternalOrientation[i] == 2 ) { - if ( hCombinedOrientationData->isExtOrientationFrozen != 1 ) + IF( hCombinedOrientationData->isExtOrientationFrozen != 1 ) { hCombinedOrientationData->Quaternion_frozen_ext = hExtOrientationData->Quaternions[i]; hCombinedOrientationData->isExtOrientationFrozen = 1; } } - else + ELSE { hCombinedOrientationData->Quaternion_frozen_ext = identity; hCombinedOrientationData->isExtOrientationFrozen = 0; } - - if ( hExtOrientationData->enableRotationInterpolation[i] == 1 && hExtOrientationData->enableExternalOrientation[i] > 0 ) + test(); + IF( hExtOrientationData->enableRotationInterpolation[i] == 1 && hExtOrientationData->enableExternalOrientation[i] > 0 ) { - if ( hCombinedOrientationData->isInterpolationOngoing == true && hCombinedOrientationData->interpolationCoefficient <= 1.0f && are_orientations_same( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == true ) + test(); + IF( hCombinedOrientationData->isInterpolationOngoing == true && hCombinedOrientationData->interpolationCoefficient_fx <= ONE_IN_Q30 && are_orientations_same_fx( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == true ) { /* Continue interpolation */ -#ifdef IVAS_FLOAT_FIXED - hCombinedOrientationData->interpolationCoefficient_fx = float_to_fix(hCombinedOrientationData->interpolationCoefficient, Q30); - hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.w, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.x, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.y, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.z, Q29); + hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + + hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + + hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact = Q29; + move16(); + hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; + move16(); + QuaternionSlerp_fx( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i] ); + hCombinedOrientationData->interpolationCoefficient_fx = L_add( hCombinedOrientationData->interpolationIncrement_Fx, hCombinedOrientationData->interpolationCoefficient_fx ); + } + ELSE + { + /* Stop interpolation or check for new interpolation */ + hCombinedOrientationData->isInterpolationOngoing = FALSE; + hCombinedOrientationData->interpolationCoefficient_fx = ONE_IN_Q30; + move32(); + hCombinedOrientationData->interpolationIncrement_Fx = ONE_IN_Q30; + move32(); + external_target_interpolation( hExtOrientationData, hCombinedOrientationData, i ); + Word16 l_shift = 0; + move16(); + l_shift = s_min( s_min( Q_factor_L_32( hCombinedOrientationData->Quaternions[i].w_fx ), Q_factor_L_32( hCombinedOrientationData->Quaternions[i].x_fx ) ), s_min( Q_factor_L_32( hCombinedOrientationData->Quaternions[i].y_fx ), Q_factor_L_32( hCombinedOrientationData->Quaternions[i].z_fx ) ) ); + hCombinedOrientationData->Quaternions[i].w_fx = L_shl( hCombinedOrientationData->Quaternions[i].w_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].x_fx = L_shl( hCombinedOrientationData->Quaternions[i].x_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].y_fx = L_shl( hCombinedOrientationData->Quaternions[i].y_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].z_fx = L_shl( hCombinedOrientationData->Quaternions[i].z_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].q_fact = add( hCombinedOrientationData->Quaternions[i].q_fact, l_shift ); + } + } + ELSE + { + /* Interpolation disabled, use the current orientation values */ - hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.w, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.x, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.y, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.z, Q29); + /* Use the most recent external orientation */ + IF( hExtOrientationData->enableExternalOrientation[i] == 1 ) + { + hCombinedOrientationData->Quaternions[i] = hExtOrientationData->Quaternions[i]; + } + /* Use the freezed external orientation */ + ELSE IF( hExtOrientationData->enableExternalOrientation[i] == 2 ) + { + hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_ext; + } + } + } + } - hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact = Q29; - hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; + IF( hExtOrientationData != NULL && headRotQuaternions != NULL ) + { + /* Combine head and external orientations */ + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + /* Check for frozen head rotation */ + IF( hExtOrientationData->enableHeadRotation[i] == 2 ) + { + IF( hCombinedOrientationData->isHeadRotationFrozen != 1 ) + { + hCombinedOrientationData->Quaternion_frozen_head = headRotQuaternions[i]; + hCombinedOrientationData->isHeadRotationFrozen = 1; + } + } + ELSE + { + hCombinedOrientationData->Quaternion_frozen_head = identity; + hCombinedOrientationData->isHeadRotationFrozen = 0; + } + /* Use the most recent head rotation */ + IF( hExtOrientationData->enableHeadRotation[i] == 1 ) + { + IF( hExtOrientationData->enableExternalOrientation[i] > 0 ) + { + QuaternionProduct_fx( hCombinedOrientationData->Quaternions[i], headRotQuaternions[i], &hCombinedOrientationData->Quaternions[i] ); + } + ELSE + { + hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; + } + } + /* Use the freezed head rotation */ + ELSE IF( hExtOrientationData->enableHeadRotation[i] == 2 ) + { + IF( hExtOrientationData->enableExternalOrientation[i] > 0 ) + { + QuaternionProduct_fx( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternion_frozen_head, &hCombinedOrientationData->Quaternions[i] ); + } + ELSE + { + hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head; + } + } + + /* Reset the combined orientations to identity */ + IF( hExtOrientationData->enableHeadRotation[i] == 0 && hExtOrientationData->enableExternalOrientation[i] == 0 ) + { + hCombinedOrientationData->Quaternions[i] = identity; + } + } + } + + IF( headRotQuaternions != NULL || hExtOrientationData != NULL ) + { + /* Calculate the combined rotation matrix */ + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + QuatToRotMat_fx( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Rmat_fx[i] ); + } + } + + /* Save the current orientations */ + IF( hExtOrientationData != NULL ) + { + IF( hExtOrientationData->enableExternalOrientation[hExtOrientationData->num_subframes - 1] > 0 ) + { + hCombinedOrientationData->Quaternion_prev_extOrientation = hExtOrientationData->Quaternions[hExtOrientationData->num_subframes - 1]; + } + ELSE + { + hCombinedOrientationData->Quaternion_prev_extOrientation = identity; + } + } + IF( headRotQuaternions != NULL ) + { + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + hCombinedOrientationData->listenerPos[i] = listenerPos[i]; + } + } - QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i]); + /* Check if combined orientation is enabled */ + IF( headRotQuaternions != NULL && hExtOrientationData == NULL ) + { + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + hCombinedOrientationData->enableCombinedOrientation[i] = 1; + } + } + ELSE IF( headRotQuaternions == NULL && hExtOrientationData != NULL ) + { + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + IF( hExtOrientationData->enableExternalOrientation[i] > 0 ) + { + hCombinedOrientationData->enableCombinedOrientation[i] = 1; + } + ELSE + { + hCombinedOrientationData->enableCombinedOrientation[i] = 0; + } + } + } + ELSE IF( headRotQuaternions != NULL && hExtOrientationData != NULL ) + { + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + IF( hExtOrientationData->enableExternalOrientation[i] > 0 || ( hExtOrientationData->enableHeadRotation[i] > 0 ) ) + { + hCombinedOrientationData->enableCombinedOrientation[i] = 1; + } + ELSE + { + hCombinedOrientationData->enableCombinedOrientation[i] = 0; + } + } + } + ELSE + { + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + hCombinedOrientationData->enableCombinedOrientation[i] = 0; + } + } - hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].q_fact); + hCombinedOrientationData->subframe_idx = 0; + move16(); + hCombinedOrientationData->cur_subframe_samples_rendered = 0; + move16(); + hCombinedOrientationData->subframe_idx_start = 0; + move16(); + hCombinedOrientationData->cur_subframe_samples_rendered_start = 0; + move16(); + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + FOR( j = 0; j < 3; j++ ) + { + FOR( Word16 k = 0; k < 3; k++ ) + { + hCombinedOrientationData->Rmat_fx[i][j][k] = L_shl( hCombinedOrientationData->Rmat_fx[i][j][k], sub( 62, shl( hCombinedOrientationData->Quaternions[i].q_fact, 1 ) ) ); // Q30 + } + } + } + Word16 l_shift = 0; + move16(); + FOR( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + l_shift = s_min( s_min( Q_factor_L_32( hCombinedOrientationData->Quaternions[i].w_fx ), Q_factor_L_32( hCombinedOrientationData->Quaternions[i].x_fx ) ), s_min( Q_factor_L_32( hCombinedOrientationData->Quaternions[i].y_fx ), Q_factor_L_32( hCombinedOrientationData->Quaternions[i].z_fx ) ) ); + hCombinedOrientationData->Quaternions[i].w_fx = L_shl( hCombinedOrientationData->Quaternions[i].w_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].x_fx = L_shl( hCombinedOrientationData->Quaternions[i].x_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].y_fx = L_shl( hCombinedOrientationData->Quaternions[i].y_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].z_fx = L_shl( hCombinedOrientationData->Quaternions[i].z_fx, l_shift ); + hCombinedOrientationData->Quaternions[i].q_fact = add( hCombinedOrientationData->Quaternions[i].q_fact, l_shift ); + } + return IVAS_ERR_OK; +} #else - QuaternionSlerp(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); -#endif +ivas_error combine_external_and_head_orientations( + IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ + IVAS_VECTOR3 *listenerPos, /* i : listener position */ + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ +) +{ + int16_t i; + int16_t j; + IVAS_QUATERNION identity; + IVAS_VECTOR3 origo; + + identity.w = 1.0f; + identity.x = identity.y = identity.z = 0.0f; + origo.x = origo.y = origo.z = 0.0f; + + /* Form combined orientations or return if no data available */ + if ( hCombinedOrientationData == NULL ) + { + if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + else + { + return IVAS_ERR_OK; + } + } + else if ( headRotQuaternions == NULL && hExtOrientationData == NULL ) + { + /* Reset the combined orientations and rotations */ + hCombinedOrientationData->isInterpolationOngoing = FALSE; + hCombinedOrientationData->interpolationCoefficient = 1.0f; + hCombinedOrientationData->interpolationIncrement = 1.0f; + hCombinedOrientationData->Quaternions_ext_interpolation_start = identity; + hCombinedOrientationData->Quaternions_ext_interpolation_target = identity; + for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + hCombinedOrientationData->enableCombinedOrientation[i] = 0; + hCombinedOrientationData->Quaternions[i] = identity; + hCombinedOrientationData->listenerPos[i] = origo; + + for ( j = 0; j < 3; j++ ) + { + set_zero( hCombinedOrientationData->Rmat[i][j], 3 ); + hCombinedOrientationData->Rmat[i][j][j] = 1.0f; + } + } + } + else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) + { + /* Head rotation only */ + for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; + } + } + + if ( hExtOrientationData != NULL ) + { + /* External orientations */ + for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + /* Check for frozen external orientation */ + if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) + { + if ( hCombinedOrientationData->isExtOrientationFrozen != 1 ) + { + hCombinedOrientationData->Quaternion_frozen_ext = hExtOrientationData->Quaternions[i]; + hCombinedOrientationData->isExtOrientationFrozen = 1; + } + } + else + { + hCombinedOrientationData->Quaternion_frozen_ext = identity; + hCombinedOrientationData->isExtOrientationFrozen = 0; + } + + if ( hExtOrientationData->enableRotationInterpolation[i] == 1 && hExtOrientationData->enableExternalOrientation[i] > 0 ) + { + if ( hCombinedOrientationData->isInterpolationOngoing == true && hCombinedOrientationData->interpolationCoefficient <= 1.0f && are_orientations_same( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == true ) + { + /* Continue interpolation */ + QuaternionSlerp( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i] ); hCombinedOrientationData->interpolationCoefficient += hCombinedOrientationData->interpolationIncrement; } else @@ -2180,37 +2657,117 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->cur_subframe_samples_rendered = 0; hCombinedOrientationData->subframe_idx_start = 0; hCombinedOrientationData->cur_subframe_samples_rendered_start = 0; + return IVAS_ERR_OK; +} +#endif + +/*------------------------------------------------------------------------- + * external_target_interpolation() + * + * + *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED - for ( Word16 k = 0; k < 4; k++ ) +static void external_target_interpolation( + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ + const Word16 i /* i : subframe index */ +) +{ + /* Sanity check for number of frames */ + hExtOrientationData->numFramesToTargetOrientation[i] = s_min( hExtOrientationData->numFramesToTargetOrientation[i], hCombinedOrientationData->maximumFramesToTargetOrientation ); + hExtOrientationData->numFramesToTargetOrientation[i] = s_max( hExtOrientationData->numFramesToTargetOrientation[i], 0 ); + + /* Interpolate from the current orientation to the target orientation */ + IF( hExtOrientationData->numFramesToTargetOrientation[i] > 0 ) { - for ( i = 0; i < 3; i++ ) + IF( are_orientations_same_fx( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == false ) { - for ( j = 0; j < 3; j++ ) + /* Target orientation is different from the previous target, update the values */ + + /* Set the received orientation as the target */ + hCombinedOrientationData->Quaternions_ext_interpolation_target = hExtOrientationData->Quaternions[i]; + + /* Use the most recent external orientation as the starting orientation */ + IF( hExtOrientationData->enableExternalOrientation[i] == 1 ) { - hCombinedOrientationData->Rmat_fx[k][i][j] = (Word32) float_to_fixed( hCombinedOrientationData->Rmat[k][i][j], 30 ); + IF( GT_16( i, 0 ) ) + { + IF( hExtOrientationData->enableExternalOrientation[i - 1] == 0 ) + { + IVAS_QUATERNION identity; + identity.w_fx = ONE_IN_Q31; + move32(); + identity.x_fx = identity.y_fx = identity.z_fx = 0; + move32(); + move32(); + move32(); + identity.q_fact = 31; + move16(); + hCombinedOrientationData->Quaternions_ext_interpolation_start = identity; + } + ELSE IF( hExtOrientationData->enableExternalOrientation[i - 1] == 2 ) + { + hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_frozen_ext; + } + ELSE + { + hCombinedOrientationData->Quaternions_ext_interpolation_start = hExtOrientationData->Quaternions[i - 1]; + } + } + ELSE + { + hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_prev_extOrientation; + } + } + ELSE IF( hExtOrientationData->enableExternalOrientation[i] == 2 ) + { + hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_frozen_ext; } + Word16 tmp_e = 0; + move16(); + Word32 tmp; + /* Calculate the interpolation increment and coefficient */ + // hCombinedOrientationData->interpolationIncrement_Fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, L_shl( L_deposit_l(hExtOrientationData->numFramesToTargetOrientation[i]), 2 ), &tmp_e ); // Multiplying with MAX_PARAM_SPATIAL_SUBFRAMES + tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, L_shl( L_deposit_l( hExtOrientationData->numFramesToTargetOrientation[i] ), 2 ), &tmp_e ); + hCombinedOrientationData->interpolationIncrement_Fx = L_shl( tmp, sub( tmp_e, 31 ) ); // Q30 + hCombinedOrientationData->interpolationCoefficient_fx = hCombinedOrientationData->interpolationIncrement_Fx; + move32(); } - } - for (i = 0; i < hCombinedOrientationData->num_subframes; i++) + /* Interpolate */ + hCombinedOrientationData->isInterpolationOngoing = TRUE; + // hCombinedOrientationData->interpolationCoefficient_fx = float_to_fix( hCombinedOrientationData->interpolationCoefficient, Q30 ); + hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); + + hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx, hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact - Q29 ); + + hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact = Q29; + move16(); + hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; + move16(); + QuaternionSlerp_fx( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i] ); + hCombinedOrientationData->interpolationCoefficient_fx = L_add_sat( hCombinedOrientationData->interpolationCoefficient_fx, hCombinedOrientationData->interpolationIncrement_Fx ); + } + ELSE { - hCombinedOrientationData->Quaternions[i].q_fact = s_min(s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].w), Q_factor_L(hCombinedOrientationData->Quaternions[i].x)), s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].y), Q_factor_L(hCombinedOrientationData->Quaternions[i].z))); - hCombinedOrientationData->Quaternions[i].w_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].w, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].x_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].x, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].y_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].y, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].z_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].z, hCombinedOrientationData->Quaternions[i].q_fact); + /* Use the target orientation immediately */ + hCombinedOrientationData->isInterpolationOngoing = FALSE; + hCombinedOrientationData->interpolationCoefficient_fx = ONE_IN_Q30; + move32(); + hCombinedOrientationData->interpolationIncrement_Fx = ONE_IN_Q30; + move32(); + hCombinedOrientationData->Quaternions[i] = hExtOrientationData->Quaternions[i]; } -#endif - return IVAS_ERR_OK; -} - - -/*------------------------------------------------------------------------- - * external_target_interpolation() - * - * - *------------------------------------------------------------------------*/ + return; +} +#else static void external_target_interpolation( EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ @@ -2269,31 +2826,7 @@ static void external_target_interpolation( /* Interpolate */ hCombinedOrientationData->isInterpolationOngoing = TRUE; -#ifdef IVAS_FLOAT_FIXED - hCombinedOrientationData->interpolationCoefficient_fx = float_to_fix(hCombinedOrientationData->interpolationCoefficient, Q30); - hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.w, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.x, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.y, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_start.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_start.z, Q29); - - hCombinedOrientationData->Quaternions_ext_interpolation_target.w_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.w, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_target.x_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.x, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_target.y_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.y, Q29); - hCombinedOrientationData->Quaternions_ext_interpolation_target.z_fx = float_to_fix(hCombinedOrientationData->Quaternions_ext_interpolation_target.z, Q29); - - hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact = Q29; - hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; - - QuaternionSlerp_fx(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i]); - - hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].w_fx, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].x_fx, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].y_fx, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32(hCombinedOrientationData->Quaternions[i].z_fx, hCombinedOrientationData->Quaternions[i].q_fact); - -#else - QuaternionSlerp(hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i]); -#endif + QuaternionSlerp( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient, &hCombinedOrientationData->Quaternions[i] ); hCombinedOrientationData->interpolationCoefficient += hCombinedOrientationData->interpolationIncrement; } else @@ -2304,25 +2837,50 @@ static void external_target_interpolation( hCombinedOrientationData->interpolationIncrement = 1.0f; hCombinedOrientationData->Quaternions[i] = hExtOrientationData->Quaternions[i]; } -#ifdef IVAS_FLOAT_FIXED - /* Updating the fixed point values which will be used later */ - hCombinedOrientationData->Quaternions[i].q_fact = s_min(s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].w), Q_factor_L(hCombinedOrientationData->Quaternions[i].x)), s_min(Q_factor_L(hCombinedOrientationData->Quaternions[i].y), Q_factor_L(hCombinedOrientationData->Quaternions[i].z))); - hCombinedOrientationData->Quaternions[i].w_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].w, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].x_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].x, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].y_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].y, hCombinedOrientationData->Quaternions[i].q_fact); - hCombinedOrientationData->Quaternions[i].z_fx = float_to_fix(hCombinedOrientationData->Quaternions[i].z, hCombinedOrientationData->Quaternions[i].q_fact); -#endif return; } - +#endif /*------------------------------------------------------------------------- * are_orientations_same() * * *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static bool are_orientations_same_fx( + const IVAS_QUATERNION *orientation1, + const IVAS_QUATERNION *orientation2 ) +{ + bool orientationsAreSame = true; + Word32 error_margin_fx = 107374182; // 0.05f in Q31 + move32(); + Word16 error_margin_e = 0; + move16(); + Word16 w_e = 0, x_e = 0, y_e = 0, z_e = 0; + move16(); + move16(); + move16(); + Word32 w_result = 0, x_result = 0, y_result = 0, z_result = 0; + w_result = L_abs( BASOP_Util_Add_Mant32Exp( orientation1->w_fx, sub(31 , orientation1->q_fact), L_negate( orientation2->w_fx ), sub(31 , orientation2->q_fact), &w_e ) ); + x_result = L_abs( BASOP_Util_Add_Mant32Exp( orientation1->x_fx, sub(31 , orientation1->q_fact), L_negate( orientation2->x_fx ), sub(31 , orientation2->q_fact), &x_e ) ); + y_result = L_abs( BASOP_Util_Add_Mant32Exp( orientation1->y_fx, sub(31 , orientation1->q_fact), L_negate( orientation2->y_fx ), sub(31 , orientation2->q_fact), &y_e ) ); + z_result = L_abs( BASOP_Util_Add_Mant32Exp( orientation1->z_fx, sub(31 , orientation1->q_fact), L_negate( orientation2->z_fx ), sub(31 , orientation2->q_fact), &z_e ) ); + Word16 Flag_1 = BASOP_Util_Cmp_Mant32Exp( w_result, w_e, error_margin_fx, error_margin_e ); + Word16 Flag_2 = BASOP_Util_Cmp_Mant32Exp( x_result, x_e, error_margin_fx, error_margin_e ); + Word16 Flag_3 = BASOP_Util_Cmp_Mant32Exp( y_result, y_e, error_margin_fx, error_margin_e ); + Word16 Flag_4 = BASOP_Util_Cmp_Mant32Exp( z_result, z_e, error_margin_fx, error_margin_e ); + IF( EQ_16( Flag_1 , 1 ) || + EQ_16( Flag_2 , 1 ) || + EQ_16( Flag_3 , 1 ) || + EQ_16( Flag_4 , 1 ) ) + { + orientationsAreSame = false; + } + return orientationsAreSame; +} +#endif static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ) @@ -2943,7 +3501,7 @@ void ivas_combined_orientation_update_start_index( { IF( hCombinedOrientationData != NULL ) { - IF( EQ_16(hCombinedOrientationData->num_subframes , 1) ) + IF( EQ_16( hCombinedOrientationData->num_subframes, 1 ) ) { /* only one orientation available anyway or split rendering with low resolution*/ hCombinedOrientationData->subframe_idx = 0; @@ -2952,9 +3510,9 @@ void ivas_combined_orientation_update_start_index( ELSE { hCombinedOrientationData->cur_subframe_samples_rendered_start = add( hCombinedOrientationData->cur_subframe_samples_rendered_start, samples_rendered ); - hCombinedOrientationData->subframe_idx_start = add(hCombinedOrientationData->subframe_idx_start,mult(hCombinedOrientationData->cur_subframe_samples_rendered , div_s(1,hCombinedOrientationData->subframe_size))); - hCombinedOrientationData->cur_subframe_samples_rendered_start = hCombinedOrientationData->cur_subframe_samples_rendered % hCombinedOrientationData->subframe_size;/* No operator to calculate modulo*/ - hCombinedOrientationData->subframe_idx_start = s_min( hCombinedOrientationData->subframe_idx, sub(hCombinedOrientationData->num_subframes , 1) ); + hCombinedOrientationData->subframe_idx_start = add( hCombinedOrientationData->subframe_idx_start, mult( hCombinedOrientationData->cur_subframe_samples_rendered, div_s( 1, hCombinedOrientationData->subframe_size ) ) ); + hCombinedOrientationData->cur_subframe_samples_rendered_start = hCombinedOrientationData->cur_subframe_samples_rendered % hCombinedOrientationData->subframe_size; /* No operator to calculate modulo*/ + hCombinedOrientationData->subframe_idx_start = s_min( hCombinedOrientationData->subframe_idx, sub( hCombinedOrientationData->num_subframes, 1 ) ); } } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 9215f0068..0824de2c3 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -931,8 +931,8 @@ typedef struct ivas_binaural_rendering_conv_module_struct_fx Word32 ***filterStatesLeftImag_fx; Word16 ***Q_filterStatesLeft; - int16_t numTapsArray[BINAURAL_CONVBANDS]; - int16_t numTaps; + Word16 numTapsArray[BINAURAL_CONVBANDS]; + Word16 numTaps; } BINRENDERER_CONV_MODULE_FX, *BINRENDERER_CONV_MODULE_HANDLE_FX; #endif @@ -1112,7 +1112,18 @@ typedef struct ivas_binaural_head_track_struct /*----------------------------------------------------------------------------------* * External orientation data structure *----------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +typedef struct ivas_external_orientation_struct +{ + Word8 enableHeadRotation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* 0 - disable, 1 - enable, 2 - freeze to previous rotation */ + Word8 enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* 0 - disable, 1 - enable, 2 - freeze to previous orientation */ + Word8 enableRotationInterpolation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* 0 - disable, 1 - enable */ + Word16 numFramesToTargetOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Number of frames until target orientation is reached */ + IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; /* External orientation in quaternions */ + Word16 num_subframes; +} EXTERNAL_ORIENTATION_DATA, *EXTERNAL_ORIENTATION_HANDLE; +#else typedef struct ivas_external_orientation_struct { int8_t enableHeadRotation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* 0 - disable, 1 - enable, 2 - freeze to previous rotation */ @@ -1123,7 +1134,7 @@ typedef struct ivas_external_orientation_struct int16_t num_subframes; } EXTERNAL_ORIENTATION_DATA, *EXTERNAL_ORIENTATION_HANDLE; - +#endif /*----------------------------------------------------------------------------------* * Combined orientation data structure for the external orienations and head orientation *----------------------------------------------------------------------------------*/ @@ -1712,6 +1723,7 @@ typedef struct TDREND_HRFILT_FiltSet_struct Word16 *Elev_p_fx; Word16 *LeftFiltSet_p_fx; Word16 *RightFiltSet_p_fx; + Word32 *lr_energy_and_iac_dyn_fx[3]; const Word32 *lr_energy_and_iac_fx[3]; /* left/right energy and interaural coherence for late reverb */ Word32 latency_s_fx;/*Q-31*/ #endif // IVAS_FLOAT_FIXED @@ -1986,6 +1998,10 @@ typedef struct ivas_hrtfs_crend_structure /* Fastconv binaural data structure */ typedef struct ivas_hrtfs_fastconv_struct { +#ifdef IVAS_FLOAT_FIXED + Word32 FASTCONV_HOA3_latency_s_fx; + Word32 FASTCONV_HRIR_latency_s_fx; +#endif float FASTCONV_HOA3_latency_s; float FASTCONV_HRIR_latency_s; @@ -2016,6 +2032,7 @@ typedef struct ivas_hrtfs_fastconv_struct Word32 ***leftBRIRImag_fx; Word32 ***rightBRIRReal_fx; Word32 ***rightBRIRImag_fx; + Word32 FASTCONV_BRIR_latency_s_fx; #endif float ***leftBRIRReal; float ***leftBRIRImag; @@ -2028,6 +2045,7 @@ typedef struct ivas_hrtfs_fastconv_struct Word32 ***leftHRIRImag_HOA2_fx; Word32 ***rightHRIRReal_HOA2_fx; Word32 ***rightHRIRImag_HOA2_fx; + Word32 FASTCONV_HOA2_latency_s_fx; #endif float ***leftHRIRReal_HOA2; float ***leftHRIRImag_HOA2; @@ -2040,6 +2058,7 @@ typedef struct ivas_hrtfs_fastconv_struct Word32 ***leftHRIRImag_FOA_fx; Word32 ***rightHRIRReal_FOA_fx; Word32 ***rightHRIRImag_FOA_fx; + Word32 FASTCONV_FOA_latency_s_fx; #endif float ***leftHRIRReal_FOA; float ***leftHRIRImag_FOA; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d4bd50556..7793b192c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2202,7 +2202,11 @@ static ivas_error initIsmMasaRendering( if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { +#ifdef IVAS_FLOAT_FIXED + ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); +#else ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); +#endif // IVAS_FLOAT_FIXED inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -2356,7 +2360,11 @@ static void clearInputIsm( if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { +#ifdef IVAS_FLOAT_FIXED + ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); +#else ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); +#endif inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -3705,7 +3713,11 @@ static ivas_error initMcBinauralRendering( /* if TD renderer was open and we need to use CREND, close it */ if ( !reconfigureFlag || ( !useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL ) ) { +#ifdef IVAS_FLOAT_FIXED + ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); +#else ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); +#endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -3841,7 +3853,11 @@ static ivas_error initMcMasaRendering( if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { +#ifdef IVAS_FLOAT_FIXED + ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); +#else ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); +#endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -4175,7 +4191,11 @@ static void clearInputMc( if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { +#ifdef IVAS_FLOAT_FIXED + ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); +#else ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); +#endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -4885,13 +4905,48 @@ ivas_error IVAS_REND_Open( { return error; } +#ifdef IVAS_FLOAT_FIXED + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hIvasRend->hExternalOrientationData->Quaternions[i].w = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].w_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); + hIvasRend->hExternalOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].x_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); + hIvasRend->hExternalOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].y_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); + hIvasRend->hExternalOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].z_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); + } +#endif /* Initilize combined orientation data */ if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) { return error; } - +#ifdef IVAS_FLOAT_FIXED + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hIvasRend->hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].w_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasRend->hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].x_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasRend->hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].y_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasRend->hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].z_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); + + hIvasRend->hCombinedOrientationData->listenerPos[i].x = fixedToFloat_32( hIvasRend->hCombinedOrientationData->listenerPos[i].x_fx, hIvasRend->hCombinedOrientationData->listenerPos[i].q_fact ); + hIvasRend->hCombinedOrientationData->listenerPos[i].y = fixedToFloat_32( hIvasRend->hCombinedOrientationData->listenerPos[i].y_fx, hIvasRend->hCombinedOrientationData->listenerPos[i].q_fact ); + hIvasRend->hCombinedOrientationData->listenerPos[i].z = fixedToFloat_32( hIvasRend->hCombinedOrientationData->listenerPos[i].z_fx, hIvasRend->hCombinedOrientationData->listenerPos[i].q_fact ); + for ( Word16 j = 0; j < 3; j++ ) + { + for ( Word16 k = 0; k < 3; k++ ) + { + hIvasRend->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( hIvasRend->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); + } + } + } + for ( Word16 j = 0; j < 3; j++ ) + { + for ( Word16 k = 0; k < 3; k++ ) + { + hIvasRend->hCombinedOrientationData->Rmat_prev[j][k] = (float) fixedToFloat_32( hIvasRend->hCombinedOrientationData->Rmat_prev_fx[j][k], 30 ); + } + } +#endif /* Initialize EFAP */ if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) { @@ -7305,8 +7360,32 @@ ivas_error IVAS_REND_CombineHeadAndExternalOrientation( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + ivas_error error_type = combine_external_and_head_orientations_rend( &hIvasRend->headRotData, hIvasRend->hExternalOrientationData, hIvasRend->hCombinedOrientationData ); +#ifdef IVAS_FLOAT_FIXED + for ( Word16 i = 0; i < hIvasRend->hCombinedOrientationData->num_subframes; i++ ) + { + hIvasRend->hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].w_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasRend->hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].x_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasRend->hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].y_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); + hIvasRend->hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].z_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - return combine_external_and_head_orientations_rend( &hIvasRend->headRotData, hIvasRend->hExternalOrientationData, hIvasRend->hCombinedOrientationData ); + /*for ( j = 0; j < 3; j++ ) + { + for ( Word16 k = 0; k < 3; k++ ) + { + hCombinedOrientationData->Rmat_fx[i][j][k] = L_shl( hCombinedOrientationData->Rmat_fx[i][j][k], 30 - ( 2 * hCombinedOrientationData->Quaternions[i].q_fact - 32 ) ); + } + }*/ + for ( Word16 j = 0; j < 3; j++ ) + { + for ( Word16 k = 0; k < 3; k++ ) + { + hIvasRend->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( hIvasRend->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); + } + } + } +#endif + return error_type; } diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 33bebf42f..c8b7643c1 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -363,6 +363,9 @@ static ivas_error LoadBSplineBinary( int16_t i, tmp; fread( &HrFiltSet_p->latency_s, sizeof( float ), 1, f_hrtf ); +#ifdef IVAS_FLOAT_FIXED + HrFiltSet_p->latency_s_fx = float_to_fix( HrFiltSet_p->latency_s, Q31 ); +#endif // IVAS_FLOAT_FIXED model = &( HrFiltSet_p->ModelParams ); @@ -568,6 +571,14 @@ static ivas_error LoadBSplineBinary( HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) ); fread( HrFiltSet_p->lr_energy_and_iac_dyn[i], sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf ); HrFiltSet_p->lr_energy_and_iac[i] = (const float *) HrFiltSet_p->lr_energy_and_iac_dyn[i]; +#ifdef IVAS_FLOAT_FIXED + HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); + IF( i == 2 ) + floatToFixed_arr32( HrFiltSet_p->lr_energy_and_iac_dyn[i], HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q27, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + ELSE + floatToFixed_arr32( HrFiltSet_p->lr_energy_and_iac_dyn[i], HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q23, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + HrFiltSet_p->lr_energy_and_iac_fx[i] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[i]; +#endif // IVAS_FLOAT_FIXED } return IVAS_ERR_OK; @@ -895,6 +906,9 @@ ivas_error dealloc_HRTF_binary( for ( i = 0; i < 3; i++ ) { free( hHrtf->lr_energy_and_iac_dyn[i] ); +#ifdef IVAS_FLOAT_FIXED + free( hHrtf->lr_energy_and_iac_dyn_fx[i] ); +#endif // IVAS_FLOAT_FIXED } } @@ -1405,6 +1419,9 @@ static ivas_error create_fastconv_HRTF_from_rawdata( ) { int16_t i, j; + float f_tmp; + float f_tmp_ntaps_sba[BINAURAL_NTAPS]; + float f_tmp_ntaps_max[BINAURAL_NTAPS_MAX]; char *hrtf_data_rptr; ( *hHRTF )->allocate_init_flag = 0; ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); @@ -1421,8 +1438,9 @@ static ivas_error create_fastconv_HRTF_from_rawdata( /* HRIR */ if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { - ( *hHRTF )->FASTCONV_HRIR_latency_s = *( (float *) ( hrtf_data_rptr ) ); + f_tmp = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); + ( *hHRTF )->FASTCONV_HRIR_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1440,39 +1458,44 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRReal_fx[i][j], Q29, BINAURAL_NTAPS ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRImag_fx[i][j], Q29, BINAURAL_NTAPS ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_fx[i][j], Q29, BINAURAL_NTAPS ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRImag_fx[i][j], Q29, BINAURAL_NTAPS ); } } } else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { /* HRIR_HOA3 */ - ( *hHRTF )->FASTCONV_HOA3_latency_s = *( (float *) ( hrtf_data_rptr ) ); + f_tmp = *( (float *) ( hrtf_data_rptr ) ); + ( *hHRTF )->FASTCONV_HOA3_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); if ( HOA3_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) @@ -1490,39 +1513,44 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { for ( j = 0; j < HOA3_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRReal_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HOA3_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRImag_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HOA3_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HOA3_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } } else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { /* HRIR_HOA2 */ - ( *hHRTF )->FASTCONV_HOA2_latency_s = *( (float *) ( hrtf_data_rptr ) ); + f_tmp = *( (float *) ( hrtf_data_rptr ) ); + ( *hHRTF )->FASTCONV_HOA2_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1540,39 +1568,44 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { for ( j = 0; j < HOA2_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRReal_HOA2_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HOA2_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRImag_HOA2_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HOA2_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_HOA2_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HOA2_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRImag_HOA2_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } } else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { /* HRIR_FOA */ - ( *hHRTF )->FASTCONV_FOA_latency_s = *( (float *) ( hrtf_data_rptr ) ); + f_tmp = *( (float *) ( hrtf_data_rptr ) ); + ( *hHRTF )->FASTCONV_FOA_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1590,39 +1623,44 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { for ( j = 0; j < FOA_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRReal_FOA_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->leftHRIRImag_FOA_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_FOA_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); + memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRImag_FOA_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); } } } /* BRIR */ else if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { - ( *hHRTF )->FASTCONV_BRIR_latency_s = *( (float *) ( hrtf_data_rptr ) ); + f_tmp = *( (float *) ( hrtf_data_rptr ) ); + ( *hHRTF )->FASTCONV_BRIR_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) @@ -1641,32 +1679,36 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + memcpy( f_tmp_ntaps_max, hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_max, ( *hHRTF )->leftBRIRReal_fx[i][j], Q29, BINAURAL_NTAPS_MAX ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->leftBRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + memcpy( f_tmp_ntaps_max, hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_max, ( *hHRTF )->leftBRIRImag_fx[i][j], Q29, BINAURAL_NTAPS_MAX ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + memcpy( f_tmp_ntaps_max, hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_max, ( *hHRTF )->rightBRIRReal_fx[i][j], Q29, BINAURAL_NTAPS_MAX ); } } for ( i = 0; i < BINAURAL_CONVBANDS; i++ ) { for ( j = 0; j < HRTF_LS_CHANNELS; j++ ) { - memcpy( ( *hHRTF )->rightBRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); + memcpy( f_tmp_ntaps_max, hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float ); + floatToFixed_arrL( f_tmp_ntaps_max, ( *hHRTF )->rightBRIRImag_fx[i][j], Q29, BINAURAL_NTAPS_MAX ); } } -- GitLab From 4b06cf141ea8159e5e490031302a32a3923473b7 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 11 May 2024 14:59:57 +0530 Subject: [PATCH 032/101] MSAN fixes --- apps/decoder.c | 10 +- lib_com/ivas_cnst.h | 2 +- lib_com/mslvq_com_fx.c | 20 ++ lib_dec/acelp_core_dec_ivas_fx.c | 10 + lib_dec/hq_core_dec_fx.c | 2 + lib_dec/ivas_core_dec.c | 17 ++ lib_dec/ivas_dirac_dec.c | 12 + lib_dec/ivas_init_dec.c | 28 -- lib_dec/ivas_jbm_dec.c | 18 ++ lib_dec/ivas_mct_dec.c | 29 +- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 8 + lib_dec/ivas_sba_rendering_internal.c | 4 +- lib_dec/ivas_spar_decoder.c | 11 + lib_dec/lib_dec_fx.c | 33 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 28 ++ lib_rend/ivas_dirac_decorr_dec.c | 37 +++ lib_rend/ivas_render_config.c | 6 +- lib_rend/ivas_reverb_utils.c | 24 +- lib_rend/ivas_rom_rend.c | 36 +-- lib_rend/lib_rend.c | 299 +++++++++---------- lib_util/render_config_reader.c | 215 ++++++++++++- 21 files changed, 576 insertions(+), 273 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 4ceb112ff..8c7c2c99f 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -447,6 +447,14 @@ int main( fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); goto cleanup; } +#ifdef IVAS_FLOAT_FIXED + FOR( Word16 i = 0; i < 4; i++ ) + { + renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) ); + renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) ); + renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( 1u << 15 ) ); + } +#endif // IVAS_FLOAT_FIXED if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { @@ -622,7 +630,7 @@ cleanup: destroy_SetOfHRTF( hSetOfHRTF ); } - IVAS_DEC_Close( &hIvasDec ); + IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); RotationFileReader_close( &headRotReader ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index acbce6db6..a786807cb 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1859,7 +1859,7 @@ typedef enum #define ER_RADIUS_FX (1* ONE_IN_Q30) //Q2.30 #define ER_LIST_ORIGIN_X_FX (0) #define ER_LIST_ORIGIN_Y_FX (0) -#define ER_LIST_HEIGHT_FX (1.6 *ONE_IN_Q22) //Q.22 +#define ER_LIST_HEIGHT_FX (6710886) /* 1.6 in Q.22 */ #endif // IVAS_FLOAT_FIXED diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index 55e47f453..748685130 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -406,6 +406,12 @@ static int16_t decode_indexes_ivas_fx( { // set_f(x_lvq, 0.0f, 2 * LATTICE_DIM); set_s( x_lvq, 0, 2 * LATTICE_DIM ); +#ifdef MSAN_FIX + scales_mslvq[0] = 0; + move16(); + scales_mslvq[1] = 0; + move16(); +#endif index[i] = 0; return 1; } @@ -430,6 +436,10 @@ static int16_t decode_indexes_ivas_fx( { // x_lvq[i] = 0.0; x_lvq[i] = 0; +#ifdef MSAN_FIX + scales_mslvq[0] = 0; + move16(); +#endif } } else @@ -439,6 +449,12 @@ static int16_t decode_indexes_ivas_fx( /* safety check in case of bit errors */ // set_f(x_lvq, 0.0f, 2 * LATTICE_DIM); set_s( x_lvq, 0, 2 * LATTICE_DIM ); +#ifdef MSAN_FIX + scales_mslvq[0] = 0; + move16(); + scales_mslvq[1] = 0; + move16(); +#endif return 1; } @@ -476,6 +492,10 @@ static int16_t decode_indexes_ivas_fx( // x_lvq[i] = 0.0; x_lvq[i] = 0; } +#ifdef MSAN_FIX + scales_mslvq[1] = 0; + move16(); +#endif } else { diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 078ec95e4..e3d00c4f5 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1681,10 +1681,16 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); } Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1) +#ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1); +#endif cldfbSynthesis_ivas_fx(realBuffer_fx, imagBuffer_fx, synth_fx, -1, st->cldfbSyn); +#ifdef MSAN_FIX + Scale_sig32(synth_fx, output_frame, -(Q_real - 1)); +#else Scale_sig32(synth_fx, L_FRAME48k, -(Q_real - 1)); +#endif Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q10 - (Q_real - 1)); //Q10 } @@ -1879,7 +1885,11 @@ ivas_error acelp_core_dec_ivas_fx( if (save_hb_synth_fx16) { Copy_Scale_sig_32_16(save_hb_synth_fx, save_hb_synth_fx16, L_FRAME48k, 0); } +#ifdef MSAN_FIX + Copy_Scale_sig_32_16(synth_fx, synth_fx16, output_frame, 0); +#else Copy_Scale_sig_32_16(synth_fx, synth_fx16, L_FRAME48k, 0); +#endif if (st->hFdCngDec) { st->hFdCngDec->hFdCngCom->A_cng[0] = ONE_IN_Q12; diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index d033fdef0..ffcbef512 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -956,7 +956,9 @@ void ivas_hq_core_dec_fx( index = tcx_cfg->tcx_last_overlap_mode; move16(); +#ifndef MSAN_FIX Copy_Scale_sig_32_16( wtda_audio, wtda_audio_16, 2 * L_FRAME48k, -13 ); +#endif /* LB synthesis */ E_audio = 31 - Q_audio; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 25e7078cb..fd83492fd 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -555,7 +555,11 @@ ivas_error ivas_core_dec( ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32(output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 - Q_output); +#ifdef MSAN_FIX + Scale_sig(synth_16_fx[n], output_frame, -Q_synth); +#else Scale_sig(synth_16_fx[n], L_FRAME48k, -Q_synth); +#endif Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED @@ -697,8 +701,13 @@ ivas_error ivas_core_dec( } } +#ifdef MSAN_FIX + Scale_sig( synth_16_fx[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX, e_sig - 15 ); + Scale_sig( synth_16_fx[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX, e_sig - 15 ); +#else Scale_sig(synth_16_fx[0],L_FRAME48k,e_sig - 15); Scale_sig(synth_16_fx[1],L_FRAME48k,e_sig - 15); +#endif #endif } } @@ -927,7 +936,11 @@ ivas_error ivas_core_dec( } /*-------------------cldfb-end---------------------------*/ +#ifdef MSAN_FIX + Scale_sig(synth_16_fx[n], output_frame, negate(Q_synth)); +#else Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); +#endif IF(st->hHQ_core != NULL) { @@ -1096,7 +1109,11 @@ ivas_error ivas_core_dec( Word16 synth_fxl[960]; /* Q-2 */ Word16 q = 2; Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -(Q11 + q)); +#ifdef MSAN_FIX + Copy_Scale_sig_32_16(synth_32_fx[n], synth_fxl, output_frame, -(Q11 + q)); +#else Copy_Scale_sig_32_16(synth_32_fx[n], synth_fxl, L_FRAME48k, -(Q11 + q)); +#endif Scale_sig(st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, (Q8 - st->prev_Q_bwe_syn)); Scale_sig32(st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, (st->prev_Q_bwe_syn2 - Q11)); Copy_Scale_sig_32_16(st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, 2 * ALLPASSSECTIONS_STEEP, (st->prev_Q_bwe_syn2 - Q11)); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 8ca1cca1b..a81960d0f 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5394,6 +5394,17 @@ void ivas_dirac_dec_render_sf_fx( size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; +#ifdef MSAN_FIX + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + } +#else IF( hDirACRend->hOutSetup.is_loudspeaker_setup && hDirACRend->hoa_decoder != NULL ) { FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) @@ -5436,6 +5447,7 @@ void ivas_dirac_dec_render_sf_fx( } #endif } +#endif hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0e9a1d528..79a4cb735 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -70,34 +70,6 @@ ivas_error ivas_dec_setup( Word16 *data /* o : output synthesis signal */ ) { -#ifdef IVAS_FLOAT_FIXED/*TODO:To be removed later*/ - RENDER_CONFIG_DATA *hRendCfg = st_ivas->hRenderConfig; - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif Word16 k, idx, num_bits_read; Word16 nchan_ism, element_mode_flag; Decoder_State *st; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index f0cb016a4..89128520f 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -636,7 +636,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { +#ifndef MSAN_FIX_ scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); +#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; } @@ -654,7 +656,14 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } +#ifdef MSAN_FIX + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + { + Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 ); + } +#else Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); +#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, st_ivas->ivas_format == MC_FORMAT ); @@ -662,7 +671,14 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } +#ifdef MSAN_FIX + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + { + Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx ); + } +#else Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); +#endif scale_sig32(hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub(Q11, hCPE->hStereoDft->q_dft)); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -678,7 +694,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { +#ifndef MSAN_FIX_ scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); +#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index de9b4c932..9bccd4b81 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -576,7 +576,11 @@ ivas_error ivas_mct_dec_fx( Copy_Scale_sig_16_32(synth_fx[n], synth_fx_32[n], L_FRAME48k, sub(Q11, 0)); Copy_Scale_sig_16_32(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx, output_frame, Q11); ivas_post_proc_fx( NULL, hCPE, n, synth_fx_32[n], NULL, output_frame, 1 ); +#ifdef MSAN_FIX + Copy_Scale_sig_32_16(synth_fx_32[n], synth_fx[n], output_frame, sub(0, Q11)); +#else Copy_Scale_sig_32_16(synth_fx_32[n], synth_fx[n], L_FRAME48k, sub(0, Q11)); +#endif } @@ -3212,31 +3216,6 @@ static ivas_error ivas_mc_dec_reconfig( hSetOfHRTF->hHRTF_hrir_hoa3->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa3->latency_s, 31 ); hSetOfHRTF->hHRTF_hrir_hoa2->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa2->latency_s, 31 ); } - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } #endif // 1 if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index d13d7eab9..2d0aa25e5 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1264,7 +1264,11 @@ void ivas_sba_dirac_stereo_dec_fx( q_dft[0] = hCPE->hStereoDft->q_dft; q_dft[1] = hCPE->hStereoDft->q_dft; +#ifdef MSAN_FIX + Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); +#else Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); +#endif IF( hSCE != NULL ) { Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); @@ -1373,7 +1377,11 @@ void ivas_sba_dirac_stereo_dec_fx( set_val_Word32( output[ch], 0, output_frame ); } +#ifdef MSAN_FIX + Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); +#else Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); +#endif IF( hSCE != NULL ) { Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 5b479f344..07119019b 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -272,7 +272,7 @@ void ivas_mc2sba_fx( return; } -#endif // IVAS_FLOAT_FIXED +#else void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ @@ -349,7 +349,7 @@ void ivas_mc2sba( return; } - +#endif /*-------------------------------------------------------------------------* * ivas_param_mc_mc2sba_cldfb() diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index ef3222b47..1e250a383 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -3237,6 +3237,16 @@ void ivas_spar_dec_upmixer_sf_fx( } } } +#ifdef MSAN_FIX + FOR( out_ch = 0; out_ch < st_ivas->hOutSetup.nchan_out_woLFE; out_ch++ ) + { + FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + { + floatToFixed_arrL( cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, num_cldfb_bands ); + floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, num_cldfb_bands ); + } + } +#else FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) @@ -3245,6 +3255,7 @@ void ivas_spar_dec_upmixer_sf_fx( floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, 60 ); } } +#endif /*------------------------------------------------------------------ends*/ IF ( st_ivas->hDirAC != NULL ) { diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index f5e7626eb..6f38cbe77 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1796,15 +1796,18 @@ static ivas_error copyRendererConfigStruct( hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; - hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; - hRCout->roomAcoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; + hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx; + hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx; - mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS ); + Copy32( hRCin->roomAcoustics.pFc_input_fx, hRCout->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX); + Copy32(hRCin->roomAcoustics.pAcoustic_rt60_fx, hRCout->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX); + Copy32(hRCin->roomAcoustics.pAcoustic_dsr_fx, hRCout->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX); + Copy(hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS ); hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; +#if 1 // To be removed + mvr2r(hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS); +#endif return IVAS_ERR_OK; } @@ -1876,8 +1879,8 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig = hIvasDec->st_ivas->hRenderConfig; hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; - hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.roomAcoustics.acousticPreDelay; - hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.roomAcoustics.inputPreDelay; + hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; + hRenderConfig->roomAcoustics.inputPreDelay_fx = renderConfig.roomAcoustics.inputPreDelay_fx; hRenderConfig->roomAcoustics.use_er = 0; IF( EQ_16( renderConfig.roomAcoustics.use_er, 1 ) ) @@ -1887,15 +1890,17 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; - mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); + Copy32( renderConfig.roomAcoustics.AbsCoeff_fx, hRenderConfig->roomAcoustics.AbsCoeff_fx, IVAS_ROOM_ABS_COEFF ); } - mvr2r( renderConfig.roomAcoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.roomAcoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.roomAcoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); - - mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS ); + Copy32( renderConfig.roomAcoustics.pFc_input_fx, hRenderConfig->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_rt60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_dsr_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); + Copy( renderConfig.directivity_fx, hRenderConfig->directivity_fx, 3 * MAX_NUM_OBJECTS ); +#if 1 // To be removed + mvr2r(renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS); +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 0fbaf4ec2..cbc7f732b 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1122,12 +1122,32 @@ static void ivas_dirac_dec_binaural_internal( #if 1 double maxim = 0; Word16 q_input = 11; +#ifdef MSAN_FIX_ + Word16 nchan_tc; + + nchan_tc = 0; + move16(); + IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) + { + IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) + { + nchan_tc = st_ivas->nchan_ism; + move16(); + } + } + nchan_tc = add( nchan_tc, ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); +#endif + IF( st_ivas->hTcBuffer->tc[nchan_transport] ) FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[1]->no_channels * st_ivas->cldfbAnaDec[1]->no_col; ind++ ) { st_ivas->hTcBuffer->tc_fx[nchan_transport][ind] = (Word32) ( st_ivas->hTcBuffer->tc[nchan_transport][ind] * ( 1 << q_input ) ); } +#ifdef MSAN_FIX_ + FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) +#endif { FOR( Word16 ind = 0; ind < st_ivas->hTcBuffer->n_samples_available; ind++ ) IF( st_ivas->hTcBuffer->tc[cha] ) @@ -1136,7 +1156,11 @@ static void ivas_dirac_dec_binaural_internal( } } +#ifdef MSAN_FIX_ + FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) +#endif { IF( st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state ) FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++ ) @@ -1535,7 +1559,11 @@ static void ivas_dirac_dec_binaural_internal( } fixedToFloat_arrL( hDiracDecBin->frameMeanDiffuseness_fx, hDiracDecBin->frameMeanDiffuseness, 29, CLDFB_NO_CHANNELS_MAX ); +#ifdef MSAN_FIX_ + FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) +#endif IF( st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state ) FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++ ) { diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 412da0468..b6511652a 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -1274,8 +1274,22 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); // scaling to get max precision for aux_buffer values// +#ifdef MSAN_FIX_ + q_shift = Q31; + move16(); + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + q_shift = s_min( q_shift, + L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ) ); + } + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + } +#else q_shift = L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ); Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); +#endif q_frame_f = add( q_frame_f, q_shift ); @@ -1348,8 +1362,23 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub(31 , h_freq_domain_decorr_ap_state->q_direct_energy_smooth); // this step is b/c we are left shifting frame_dec_fx at the end of below for loop/ +#ifdef MSAN_FIX_ + q_shift = Q31; + move16(); + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + q_shift = s_min( q_shift, + sub( L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ), + Q2 ) ); + } + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + } +#else q_shift = sub( L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ), 2 ); Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); +#endif q_frame_f = add( q_frame_f, q_shift ); FOR( ch_idx = 0; ch_idx < num_channels; ch_idx++ ) @@ -1410,7 +1439,15 @@ void ivas_dirac_dec_decorr_process_fx( *-----------------------------------------------------------------*/ q_shift = q_input_frame - q_frame_f; +#ifdef MSAN_FIX_ + // scaling it to input q + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + } +#else Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); // scaling it to input q +#endif q_frame_f = q_input_frame; diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index fb788fa4e..eb451e6bb 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -44,7 +44,9 @@ *-----------------------------------------------------------------------*/ #define IVAS_REVERB_DEFAULT_PRE_DELAY 0.016f +#define IVAS_REVERB_DEFAULT_PRE_DELAY_FX 2147484 #define IVAS_REVERB_DEFAULT_INPUT_DELAY 0.1f +#define IVAS_REVERB_DEFAULT_INPUT_DELAY_FX 13421773 #define IVAS_REVERB_DEFAULT_USE_ER 0 @@ -142,8 +144,8 @@ ivas_error ivas_render_config_init_from_rom_fx( } ( *hRenderConfig )->roomAcoustics.override = FALSE; ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; - ( *hRenderConfig )->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_PRE_DELAY; - ( *hRenderConfig )->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_INPUT_DELAY; + ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_PRE_DELAY_FX; + ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_INPUT_DELAY_FX; ( *hRenderConfig )->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; set32_fx( &( *hRenderConfig )->roomAcoustics.pFc_input_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( &( *hRenderConfig )->roomAcoustics.pAcoustic_rt60_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 528f6c433..36ef7a539 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -96,37 +96,29 @@ ivas_error ivas_reverb_prepare_cldfb_params( fc[idx] = ( (float) idx + 0.5f ) * ( (float) MAX_SAMPLING_RATE / (float) ( 2 * CLDFB_NO_CHANNELS_MAX ) ); } #ifdef IVAS_FLOAT_FIXED - Word32* pFc_input_fx = (Word32*)malloc(60 * sizeof(Word32*)); - Word32* pAcoustic_rt60_fx = (Word32*)malloc(60 * sizeof(Word32*)); - Word32* pAcoustic_dsr_fx = (Word32*)malloc(60 * sizeof(Word32*)); - Word32* fc_fx = (Word32*)malloc(pInput_params->nBands * sizeof(Word32*)); Word32* pOutput_t60_fx = (Word32*)malloc(pInput_params->nBands * sizeof(Word32*)); Word16* pOutput_t60_e = (Word16*)malloc(pInput_params->nBands * sizeof(Word16*)); Word32* pOutput_ene_fx = (Word32*)malloc(pInput_params->nBands * sizeof(Word32*)); Word16* pOutput_ene_e = (Word16*)malloc(pInput_params->nBands * sizeof(Word16*)); - - for (int i = 0; i < 60; i++) - { - pFc_input_fx[i] = (Word32)pInput_params->pFc_input[i] * ONE_IN_Q16; - pAcoustic_rt60_fx[i] = (Word32)(pInput_params->pAcoustic_rt60[i]) * ONE_IN_Q26; - pAcoustic_dsr_fx[i] = (Word32)pInput_params->pAcoustic_dsr[i] * ONE_IN_Q30; - } + Word32 delay_diff_fx; for (int i = 0; i < pInput_params->nBands; i++) { fc_fx[i] = (Word32)fc[i] * ONE_IN_Q16; } - ivas_reverb_interpolate_acoustic_data_fx(pInput_params->nBands, pFc_input_fx, pAcoustic_rt60_fx, pAcoustic_dsr_fx, + ivas_reverb_interpolate_acoustic_data_fx(pInput_params->nBands, pInput_params->pFc_input_fx, pInput_params->pAcoustic_rt60_fx, pInput_params->pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX, fc_fx, pOutput_t60_fx, pOutput_ene_fx, pOutput_t60_e, pOutput_ene_e); + + /* adjust DSR for the delay difference */ + delay_diff_fx = L_sub(pInput_params->inputPreDelay_fx, pInput_params->acousticPreDelay_fx); + + delay_diff = (float)delay_diff_fx / ONE_IN_Q27; for (int i = 0; i < pInput_params->nBands; i++) { pOutput_t60[i] = (float)fabs(me2f(pOutput_t60_fx[i], pOutput_t60_e[i])); pOutput_ene[i] = (float)fabs(me2f(pOutput_ene_fx[i], pOutput_ene_e[i])); } - free(pFc_input_fx); - free(pAcoustic_rt60_fx); - free(pAcoustic_dsr_fx); free(fc_fx); free(pOutput_t60_fx); free(pOutput_t60_e); @@ -134,9 +126,9 @@ ivas_error ivas_reverb_prepare_cldfb_params( free(pOutput_ene_e); #else ivas_reverb_interpolate_acoustic_data( pInput_params->nBands, pInput_params->pFc_input, pInput_params->pAcoustic_rt60, pInput_params->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX, fc, pOutput_t60, pOutput_ene ); -#endif /* adjust DSR for the delay difference */ delay_diff = pInput_params->inputPreDelay - pInput_params->acousticPreDelay; +#endif ln_1e6_inverted = 1.0f / logf( 1e06f ); for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index 4b00e46d0..97bed6db4 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -1077,28 +1077,28 @@ const Word32 ivas_reverb_default_fc_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q16*/ = 1048576000 , 1310720000 }; -const Word32 ivas_reverb_default_RT60_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = +const Word32 ivas_reverb_default_RT60_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q26*/ = { - 1462651136 , 1555422464 , 1413903232 , 1695116160 , 1585487232 , - 1498299392 , 1383945856 , 1445471232 , 1155238784 , - 1116798848 , 1177894784 , 1165009920 , 1171452288 , - 1117121024 , 1127321600 , 1148796416 , 1184122496 , - 1257781120 , 1184015104 , 1145252992 , 1132797568 , - 1133119744 , 1129683712 , 1134837760 , 1118946304 , - 1050355712 , 864222592 , 815442496 , 772503552 , - 662305408 , 644577984 + 91415696, 97213904, 88368952, 105944760, + 99092952, 93643712, 86496616, 90341952, + 72202424, 69799928, 73618424, 72813120, + 73215768, 69820064, 70457600, 71799776, + 74007656, 78611320, 74000944, 71578312, + 70799848, 70819984, 70605232, 70927360, + 69934144, 65647232, 54013912, 50965156, + 48281472, 41394088, 40286124 }; -const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q0*/ = +const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = { - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 + 20, 23, 15, 16, + 13, 20, 25, 42, + 96, 204, 397, 658, + 766, 701, 494, 587, + 753, 736, 763, 747, + 568, 611, 663, 617, + 512, 292, 146, 117, + 66, 30, 28 }; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7793b192c..c406220d3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -269,7 +269,7 @@ typedef struct typedef struct { input_base base; - pan_matrix hoaDecMtx; + //pan_matrix hoaDecMtx; pan_matrix_fx hoaDecMtx_fx; CREND_WRAPPER_HANDLE crendWrapper; rotation_gains rot_gains_prev; @@ -1601,32 +1601,32 @@ static ivas_error initEfap( /*To be replaced with pointers*/ Word32 azimuths_fx[MAX_OUTPUT_CHANNELS]; Word32 elevations_fx[MAX_OUTPUT_CHANNELS]; - int16_t numNonLfeChannels; + Word16 numNonLfeChannels; - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + IF ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; } - else + ELSE { pEfapWrapper->speakerConfig = outConfig; } pEfapWrapper->pCustomLsSetup = pCustomLsOut; /* If re-initializing, free existing EFAP handle. */ - if ( pEfapWrapper->hEfap != NULL ) + IF ( pEfapWrapper->hEfap != NULL ) { efap_free_data( &pEfapWrapper->hEfap ); } /* Only initialize EFAP handle if output config is channel-based */ - if ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { pEfapWrapper->hEfap = NULL; return IVAS_ERR_OK; } - if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { /*float2fix block: to be removed*/ floatToFixed_arrL( (float *) pCustomLsOut->ls_azimuth, (Word32 *) pCustomLsOut->ls_azimuth_fx, Q22, pCustomLsOut->num_spk ); @@ -1637,19 +1637,19 @@ static ivas_error initEfap( return error; } } - else + ELSE { - if ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) + IF ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) + IF ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) + IF ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) { return error; } @@ -1658,7 +1658,7 @@ static ivas_error initEfap( floatToFixed_arrL( (float *) azimuths, azimuths_fx, Q22, numNonLfeChannels ); floatToFixed_arrL( (float *) elevations, elevations_fx, Q22, numNonLfeChannels ); /*float2fix block end*/ - if ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths_fx, elevations_fx, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths_fx, elevations_fx, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -2053,7 +2053,7 @@ static void initRendInputBase_fx( inputBase->inputBuffer.config.numSamplesPerChannel = 0; inputBase->inputBuffer.config.numChannels = 0; inputBase->inputBuffer.data_fx = dataBuf; - IF( inputBase->inputBuffer.data != NULL ) + IF( inputBase->inputBuffer.data_fx != NULL ) { set_val_Word32( inputBase->inputBuffer.data_fx, 0, dataBufSize ); } @@ -2266,33 +2266,6 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif // 1 if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -2315,17 +2288,6 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_FLOAT_FIXED -#if 1 /*TODO:To be removed later*/ - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - for ( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); -#endif if ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL,inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -3753,17 +3715,6 @@ static ivas_error initMcBinauralRendering( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { #ifdef IVAS_FLOAT_FIXED -#if 1 /*TODO:To be removed later*/ - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - for ( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); -#endif if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL,inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -3789,33 +3740,6 @@ static ivas_error initMcBinauralRendering( else if ( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif // 1 if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -4244,34 +4168,33 @@ static ivas_error initSbaPanGainsForMcOut( const AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) { - int16_t ambiOrderIn; - int16_t chInIdx, chOutIdx; -#ifndef IVAS_FLOAT_FIXED - float *tmpDecMtx, *readPtr; -#else + Word16 ambiOrderIn; + Word16 chInIdx, chOutIdx; Word32 *tmpDecMtx, *readPtr; -#endif IVAS_OUTPUT_SETUP hOutSetup; ivas_error error; - if ( ( error = getAmbisonicsOrder( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) + IF( ( error = getAmbisonicsOrder_fx( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) { return error; } - if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { assert( !"Invalid configuration" ); return IVAS_ERR_WRONG_PARAMS; } - switch ( outConfig ) + SWITCH ( outConfig ) { case IVAS_AUDIO_CONFIG_MONO: hOutSetup.ls_azimuth = ls_azimuth_CICP1; hOutSetup.ls_elevation = ls_elevation_CICP1; + + hOutSetup.ls_azimuth_fx = ls_azimuth_CICP1_fx; + hOutSetup.ls_elevation_fx = ls_elevation_CICP1_fx; ivas_output_init( &hOutSetup, outConfig ); - break; + BREAK; case IVAS_AUDIO_CONFIG_STEREO: case IVAS_AUDIO_CONFIG_5_1: case IVAS_AUDIO_CONFIG_7_1: @@ -4279,10 +4202,11 @@ static ivas_error initSbaPanGainsForMcOut( case IVAS_AUDIO_CONFIG_5_1_4: case IVAS_AUDIO_CONFIG_7_1_4: ivas_output_init( &hOutSetup, outConfig ); - break; + BREAK; case IVAS_AUDIO_CONFIG_LS_CUSTOM: - ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); - break; + //ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); + ivas_ls_custom_setup_fx( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); + BREAK; default: assert( !"Invalid speaker config" ); return IVAS_ERR_WRONG_PARAMS; @@ -4290,26 +4214,21 @@ static ivas_error initSbaPanGainsForMcOut( /* obtain and copy over HOA decoding matrix */ tmpDecMtx = NULL; - if ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) { return error; } readPtr = &tmpDecMtx[0]; - for ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) + FOR ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) { - for ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) + FOR ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) { - if ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) + IF ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) { continue; /* nothing to be rendered to LFE */ } -#ifndef IVAS_FLOAT_FIXED - inputSba->hoaDecMtx[chInIdx][chOutIdx] = *readPtr++; -#else - inputSba->hoaDecMtx_fx[chInIdx][chOutIdx] = ( ( *readPtr ) == ONE_IN_Q29 ) ? ONE_IN_Q31 : *readPtr << 2; - inputSba->hoaDecMtx[chInIdx][chOutIdx] = ( (float) *readPtr++ ) / ONE_IN_Q29; -#endif + inputSba->hoaDecMtx_fx[chInIdx][chOutIdx] = L_shl_sat( *readPtr++, 2 ); } } free( tmpDecMtx ); @@ -4431,89 +4350,62 @@ static ivas_error updateSbaPanGains( const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { -#if 1 /*Cleanup changes: float to fixed*/ - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif // 1 ivas_error error; AUDIO_CONFIG inConfig; rendering_context rendCtx; /* Reset to all zeros - some functions below only write non-zero elements. */ - setZeroPanMatrix( inputSba->hoaDecMtx ); + //setZeroPanMatrix( inputSba->hoaDecMtx ); setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); inConfig = inputSba->base.inConfig; rendCtx = inputSba->base.ctx; - switch ( getAudioConfigType( outConfig ) ) + SWITCH ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: error = initSbaPanGainsForMcOut( inputSba, outConfig, inputSba->base.ctx.pCustomLsOut ); - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: error = initSbaPanGainsForSbaOut( inputSba, outConfig ); - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + SWITCH ( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: { - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - break; + BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + IF ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } - break; + BREAK; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: error = IVAS_ERR_OK; - break; /* Do nothing */ + BREAK; /* Do nothing */ default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) + IF ( error != IVAS_ERR_OK ) { return error; } @@ -4630,7 +4522,7 @@ static ivas_error setRendInputActiveSba( rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } @@ -4639,28 +4531,28 @@ static ivas_error setRendInputActiveSba( { return error; } - if ( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF ( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); initRendInputBase_fx( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData_fx, MAX_BUFFER_LENGTH ); - setZeroPanMatrix( inputSba->hoaDecMtx ); + setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); inputSba->crendWrapper = NULL; inputSba->hDirAC = NULL; initRotGains_fx( inputSba->rot_gains_prev_fx ); - if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + IF ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) { - if ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + IF ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { return error; } @@ -5361,7 +5253,6 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( /* Input inactive, skip. */ continue; } - if ( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { return error; @@ -6947,7 +6838,7 @@ ivas_error IVAS_REND_InitConfig( return IVAS_ERR_OK; } - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IVAS_REND_GetRenderConfig() * @@ -7027,7 +6918,87 @@ int16_t IVAS_REND_FeedRenderConfig( return IVAS_ERR_OK; } +#else +/*-------------------------------------------------------------------* + * IVAS_REND_GetRenderConfig() + * + * + *-------------------------------------------------------------------*/ + +int16_t IVAS_REND_GetRenderConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ +) +{ + RENDER_CONFIG_HANDLE hRCin; + + IF ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL || hRCout == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + hRCin = hIvasRend->hRendererConfig; + hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; + hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; + hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx; + hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx; + Copy( hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS ); + + Copy32( hRCin->roomAcoustics.pFc_input_fx, hRCout->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( hRCin->roomAcoustics.pAcoustic_rt60_fx, hRCout->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( hRCin->roomAcoustics.pAcoustic_dsr_fx, hRCout->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); + + + hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; + hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; + + return IVAS_ERR_OK; +} + +/*-------------------------------------------------------------------* + * IVAS_REND_FeedRenderConfig() + * + * + *-------------------------------------------------------------------*/ + +int16_t IVAS_REND_FeedRenderConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ +) +{ + RENDER_CONFIG_HANDLE hRenderConfig; + + if ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + hRenderConfig = hIvasRend->hRendererConfig; + + hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; + hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; + hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; + hRenderConfig->roomAcoustics.inputPreDelay_fx = renderConfig.roomAcoustics.inputPreDelay_fx; + Copy32( renderConfig.roomAcoustics.pFc_input_fx, hRenderConfig->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_rt60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_dsr_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); + Copy( renderConfig.directivity_fx, hRenderConfig->directivity_fx, 3 * MAX_NUM_OBJECTS ); + + hRenderConfig->roomAcoustics.use_er = 0; + if ( renderConfig.roomAcoustics.use_er == 1 ) + { + hRenderConfig->roomAcoustics.use_er = renderConfig.roomAcoustics.use_er; + hRenderConfig->roomAcoustics.lowComplexity = renderConfig.roomAcoustics.lowComplexity; + hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; + hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; + + Copy32( renderConfig.roomAcoustics.AbsCoeff_fx, hRenderConfig->roomAcoustics.AbsCoeff_fx, IVAS_ROOM_ABS_COEFF ); + } + + + return IVAS_ERR_OK; +} +#endif /*-------------------------------------------------------------------* * IVAS_REND_SetHeadRotation() @@ -7599,7 +7570,7 @@ static void renderBufferChannel_fx( return; } -#endif +#else /* Take one channel from input buffer and copy it to each channel in output buffer, with different gain applied per output channel */ @@ -7613,7 +7584,7 @@ static void renderBufferChannel( return; } - +#endif #ifndef IVAS_FLOAT_FIXED static ivas_error chooseCrossfade( @@ -9087,7 +9058,7 @@ static ivas_error renderLfeToBinaural_fx( return IVAS_ERR_OK; } -#endif +#else static ivas_error renderLfeToBinaural( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) @@ -9149,7 +9120,7 @@ static ivas_error renderLfeToBinaural( return IVAS_ERR_OK; } - +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error renderMcToBinaural( input_mc *mcInput, diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 9e85b3551..bb708094f 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -57,6 +57,7 @@ #define ACOUSTIC_DSR_MIN ( 0.0f ) #define ACOUSTIC_DSR_MAX ( 1.0e+2f ) #define ACOUSTIC_DSR_EPSILON ( 1.0e-15f ) +#define ACOUSTIC_DSR_EPSILON_FX ( 1 ) #define ACOUSTICPREDELAY_JOTREV_MIN ( SHORTEST_REV_DEL_LINE ) #define ACOUSTICPREDELAY_JOTREV_MAX ( SHORTEST_REV_DEL_LINE + 1.0f / (float) FRAMES_PER_SEC ) #define ACOUSTICPREDELAY_FDREV_MIN ( 1.0f / (float) ( 16 * FRAMES_PER_SEC ) ) @@ -65,9 +66,13 @@ #define INPUTPREDELAY_MAX ( 1.0e+2f ) #define ER_MIN_ROOM_DIMENSION ( 1.0f ) +#define ER_MIN_ROOM_DIMENSION_FX ( 4194304 ) #define ER_MAX_ROOM_DIMENSION ( 999.0f ) +#define ER_MAX_ROOM_DIMENSION_FX ( 2095054848 ) #define ER_MIN_ABS_COEFF ( 0.0f ) +#define ER_MIN_ABS_COEFF_FX ( 0 ) #define ER_MAX_ABS_COEFF ( 1.0f ) +#define ER_MAX_ABS_COEFF_FX ( 1073741824 ) /*------------------------------------------------------------------------------------------* * Local Type definitions @@ -1114,7 +1119,7 @@ static int32_t errorHandler( * * Verifies if the configuration parameters lie within acceptable limits *------------------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error RenderConfigReader_checkValues( IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */ ) @@ -1227,7 +1232,129 @@ ivas_error RenderConfigReader_checkValues( return IVAS_ERR_OK; } +#else +ivas_error RenderConfigReader_checkValues( + IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */ +) +{ + int16_t band_idx, tab_value_err_count; + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoom_acoustics; + pRoom_acoustics = &hRenderConfig->roomAcoustics; + tab_value_err_count = 0; + int16_t wall_idx; + + + /* Verify the number of frequency bands in the config input data */ + if ( ( pRoom_acoustics->nBands > N_BANDS_MAX ) || ( pRoom_acoustics->nBands < N_BANDS_MIN ) ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + /* Verify input pre-delay value */ + if ( ( pRoom_acoustics->inputPreDelay > INPUTPREDELAY_MAX ) || ( pRoom_acoustics->inputPreDelay < INPUTPREDELAY_MIN ) ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + /* Verify data per band in the acoustic properties table */ + for ( band_idx = 0; band_idx < pRoom_acoustics->nBands; band_idx++ ) + { + /* Verify if the frequencies are in the ascending order (required for interpolation) */ + if ( band_idx != 0 ) + { + if ( pRoom_acoustics->pFc_input[band_idx] <= pRoom_acoustics->pFc_input[band_idx - 1] ) + { + tab_value_err_count++; + } + } + + /* Check the input frequencies */ + if ( ( pRoom_acoustics->pFc_input[band_idx] > FC_INPUT_MAX ) || ( pRoom_acoustics->pFc_input[band_idx] < FC_INPUT_MIN ) ) + { + tab_value_err_count++; + } + + /* Check the input RT60 values */ + if ( ( pRoom_acoustics->pAcoustic_rt60[band_idx] > ACOUSTIC_RT60_MAX ) || ( pRoom_acoustics->pAcoustic_rt60[band_idx] < ACOUSTIC_RT60_MIN ) ) + { + tab_value_err_count++; + } + + /* Check the input DSR values */ + if ( ( pRoom_acoustics->pAcoustic_dsr[band_idx] > ACOUSTIC_DSR_MAX ) || ( pRoom_acoustics->pAcoustic_dsr[band_idx] < ACOUSTIC_DSR_MIN ) ) + { + tab_value_err_count++; + } + + /* Replace zero DSR values with very small positive values, to avoid issues with coloration filter design */ + if ( pRoom_acoustics->pAcoustic_dsr[band_idx] <= 0.0f ) + { + pRoom_acoustics->pAcoustic_dsr[band_idx] = ACOUSTIC_DSR_EPSILON; + pRoom_acoustics->pAcoustic_dsr_fx[band_idx] = ACOUSTIC_DSR_EPSILON_FX; + } + } + + if ( tab_value_err_count != 0 ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + + + if ( pRoom_acoustics->use_er == 1 ) + { + /* Room dimensions */ + if ( pRoom_acoustics->dimensions.x < ER_MIN_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.x = ER_MIN_ROOM_DIMENSION; + pRoom_acoustics->dimensions.x_fx = ER_MIN_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.x > ER_MAX_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.x = ER_MAX_ROOM_DIMENSION; + pRoom_acoustics->dimensions.x_fx = ER_MAX_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.y < ER_MIN_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.y = ER_MIN_ROOM_DIMENSION; + pRoom_acoustics->dimensions.y_fx = ER_MIN_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.y > ER_MAX_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.y = ER_MAX_ROOM_DIMENSION; + pRoom_acoustics->dimensions.y_fx = ER_MAX_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.z < ER_MIN_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.z = ER_MIN_ROOM_DIMENSION; + pRoom_acoustics->dimensions.z_fx = ER_MIN_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.z > ER_MAX_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.z = ER_MAX_ROOM_DIMENSION; + pRoom_acoustics->dimensions.z_fx = ER_MAX_ROOM_DIMENSION_FX; + } + + /* Abs Coeff */ + for ( wall_idx = 0; wall_idx < IVAS_ROOM_ABS_COEFF; wall_idx++ ) + { + if ( pRoom_acoustics->AbsCoeff[wall_idx] < ER_MIN_ABS_COEFF ) + { + pRoom_acoustics->AbsCoeff[wall_idx] = ER_MIN_ABS_COEFF; + pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MIN_ABS_COEFF_FX; + } + if ( pRoom_acoustics->AbsCoeff[wall_idx] > ER_MAX_ABS_COEFF ) + { + pRoom_acoustics->AbsCoeff[wall_idx] = ER_MAX_ABS_COEFF; + pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MAX_ABS_COEFF_FX; + } + } + } + + return IVAS_ERR_OK; +} +#endif /*------------------------------------------------------------------------------------------* * RenderConfigReader_open() @@ -2217,6 +2344,9 @@ ivas_error RenderConfigReader_read( { errorHandler( item, ERROR_VALUE_INVALID ); } +#ifdef IVAS_FLOAT_FIXED + hRenderConfig->roomAcoustics.acousticPreDelay_fx = (Word32) ( hRenderConfig->roomAcoustics.acousticPreDelay * ONE_IN_Q27 ); +#endif // IVAS_FLOAT_FIXED } /* Pre-delay */ else if ( strcmp( item, "PREDELAY" ) == 0 ) @@ -2484,7 +2614,7 @@ ivas_error RenderConfigReader_read( } return IVAS_ERR_OK; } - +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------------------------* * RenderConfigReader_getEnvironment() * @@ -2552,7 +2682,88 @@ ivas_error RenderConfigReader_getAcousticEnvironment( } return IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING; } +#else +ivas_error RenderConfigReader_getAcousticEnvironment( + RenderConfigReader *pRenderConfigReader, /* i : RenderConfigReader handle */ + uint16_t id, /* i : Acoustic environment ID */ + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcEnv /* o : Target acoustic environment pointer */ +) +{ + uint16_t n, m; + uint16_t j; + + if ( pRenderConfigReader == NULL || pAcEnv == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + /* case when -aeid is not specified, select first ID from config file */ + if ( id == 65535 && pRenderConfigReader->nAE > 0 ) + { + id = (uint16_t) pRenderConfigReader->pAE[0].id; + } + for ( n = 0; n < pRenderConfigReader->nAE; n++ ) + { + if ( id == pRenderConfigReader->pAE[n].id ) + { + pAcEnv->nBands = (int16_t) pRenderConfigReader->pAE[n].pFG->nrBands; + pAcEnv->inputPreDelay = pRenderConfigReader->pAE[n].preDelay; + pAcEnv->inputPreDelay_fx = (Word32) ( pRenderConfigReader->pAE[n].preDelay * ONE_IN_Q27 ); + for ( m = 0; m < pAcEnv->nBands; m++ ) + { + pAcEnv->pFc_input[m] = pRenderConfigReader->pAE[n].pFG->pFc[m]; + pAcEnv->pAcoustic_rt60[m] = pRenderConfigReader->pAE[n].pRT60[m]; + pAcEnv->pAcoustic_dsr[m] = pRenderConfigReader->pAE[n].pDSR[m]; + pAcEnv->pFc_input_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pFG->pFc[m] * ONE_IN_Q16 ); + pAcEnv->pAcoustic_rt60_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pRT60[m] * ONE_IN_Q26 ); + pAcEnv->pAcoustic_dsr_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pDSR[m] * ONE_IN_Q30 ); + } + + /* If ER are allocated then propagate parameters */ + if ( pRenderConfigReader->pAE[n].pEarlyReflections != 0 ) + { + pAcEnv->use_er = pRenderConfigReader->pAE[n].pEarlyReflections->use_er; /* ER activation flag */ + pAcEnv->lowComplexity = pRenderConfigReader->pAE[n].pEarlyReflections->lowComplexity; /* Low complexity flag */ + pAcEnv->dimensions = pRenderConfigReader->pAE[n].pEarlyReflections->dimensions; + pAcEnv->dimensions.x_fx = (Word32)(pRenderConfigReader->pAE[n].pEarlyReflections->dimensions.x * ONE_IN_Q22); + pAcEnv->dimensions.y_fx = (Word32)(pRenderConfigReader->pAE[n].pEarlyReflections->dimensions.y * ONE_IN_Q22); + pAcEnv->dimensions.z_fx = (Word32)(pRenderConfigReader->pAE[n].pEarlyReflections->dimensions.z * ONE_IN_Q22); + /* Use default listener origin position if non provided */ + if ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin == NULL ) + { + if ( ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin = malloc( sizeof( IVAS_VECTOR3 ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = ER_LIST_ORIGIN_X; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = ER_LIST_ORIGIN_Y; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = ER_LIST_HEIGHT; + + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x_fx = ER_LIST_ORIGIN_X_FX; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y_fx = ER_LIST_ORIGIN_Y_FX; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z_fx = ER_LIST_HEIGHT_FX; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->q_fact = Q22; + } + else + { + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x_fx = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x * ONE_IN_Q22 ); + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y_fx = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y * ONE_IN_Q22 ); + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z_fx = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z * ONE_IN_Q22 ); + } + pAcEnv->ListenerOrigin = *pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin; + for ( j = 0; j < IVAS_ROOM_ABS_COEFF; j++ ) + { + pAcEnv->AbsCoeff[j] = pRenderConfigReader->pAE[n].pEarlyReflections->pAbsCoeff[j]; + pAcEnv->AbsCoeff_fx[j] = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pAbsCoeff[j] * ONE_IN_Q30 ); + } + } + return IVAS_ERR_OK; + } + } + return IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING; +} +#endif /*------------------------------------------------------------------------------------------* * RenderConfigReader_getDirectivity() -- GitLab From d8c0cdebe96e60977d1a29028a33b558229f390b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 11 May 2024 21:31:31 +0530 Subject: [PATCH 033/101] Few more MSAN fixes --- lib_dec/ivas_dirac_dec.c | 12 ++++++++++++ lib_rend/ivas_dirac_rend.c | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index a81960d0f..4923fa241 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5603,6 +5603,17 @@ void ivas_dirac_dec_render_sf_fx( #endif #ifdef IVAS_FLOAT_FIXED +#ifdef MSAN_FIX + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + } +#else FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) @@ -5615,6 +5626,7 @@ void ivas_dirac_dec_render_sf_fx( hSpatParamRendCom->num_freq_bands ); } } +#endif hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 10c54d1fe..6ae3e7f7d 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1590,13 +1590,21 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } +#ifdef MSAN_FIX + set_zero( hDirAC_mem->cy_cross_dir_smooth, size_ho ); +#else set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); +#endif #ifdef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->cy_cross_dir_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size_ho ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } +#ifdef MSAN_FIX + set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size_ho ); +#else set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size ); +#endif #endif if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) -- GitLab From 4e838b23c2b967a9452862b84406a2007c748feb Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 11 May 2024 22:04:06 +0530 Subject: [PATCH 034/101] Clean up : objectRendererSources [x] ftf changes added for ivas_td_binaural_open_ext_fx, ivas_td_binaural_renderer_fx. [x] Disabled structure members of TDREND_SRC_REND_t. [x] Integrated ivas_td_binaural_open_fx in ivas_td_binaural_open_ext_fx (parent function has intermediate conversions). [x] Integrated ivas_td_binaural_renderer_unwrap_fx in ivas_td_binaural_renderer_fx. [x] Disabled float call for TDREND_SRC_Init_fx. [x] Disabled all static functions in ivas_objectRenderer_sources.c file. --- lib_com/ivas_dirac_com.c | 12 +- lib_com/ivas_prot.h | 12 +- lib_dec/ivas_init_dec.c | 130 ++++--- lib_dec/ivas_ism_dec.c | 28 -- lib_dec/ivas_jbm_dec.c | 99 ++++++ lib_dec/ivas_mc_param_dec.c | 2 +- lib_dec/ivas_objectRenderer_internal.c | 35 +- lib_dec/ivas_sba_dec.c | 31 ++ lib_rend/ivas_objectRenderer.c | 454 +++++++++++++++++++++++-- lib_rend/ivas_objectRenderer_mix.c | 17 +- lib_rend/ivas_objectRenderer_sources.c | 272 ++++++++------- lib_rend/ivas_prot_rend.h | 37 +- lib_rend/ivas_stat_rend.h | 26 +- lib_rend/lib_rend.c | 70 +++- 14 files changed, 930 insertions(+), 295 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index d3057e3e8..f0f82bf97 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -654,8 +654,18 @@ void ivas_get_dirac_sba_max_md_bits_fx( Word16 exp_res = 0; IF (var1 % 5 != 0) { var4 = BASOP_Util_Add_Mant32Exp(var2_32, exp, ONE_IN_Q30, 1, &exp_res); + exp = exp_res; } - *metadata_max_bits = extract_l(L_min(MAX16B, L_shr(var4, 14))); + Word16 flag = BASOP_Util_Cmp_Mant32Exp(MAX16B, 31, var4, exp); + Word32 tmp; + if (flag == 1) { + tmp = var4; + } + else { + tmp = MAX16B; + exp = 31; + } + *metadata_max_bits = (Word16)L_shr(tmp, 31 - exp);; *qmetadata_max_bit_req = QMETADATA_MAXBIT_REQ_SBA >> 1; return; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2253f7694..fce1edd5d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -7333,11 +7333,19 @@ ivas_error ivas_td_binaural_open_fx( Word16 * SrcInd, /*Temporarily used to store the updated value of SrcInd*/ Word16 *num_src ); -#endif // IVAS_FLOAT_FIXED - +#else ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#endif // IVAS_FLOAT_FIXED + +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_td_binaural_renderer_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output[], /* i/o: SCE channels / Binaural synthesis */ + const Word16 output_frame /* i : output frame length */ +); +#endif ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 79a4cb735..2ed3529f1 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -371,15 +371,6 @@ ivas_error ivas_dec_setup( // Cleanup changes for ivas_td_binaural_open: fixed to float IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Up_fx, st_ivas->hBinRendererTd->Listener_p->Up, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Right_fx, st_ivas->hBinRendererTd->Listener_p->Right, Q30, 3 ); - TDREND_DirAtten_t *DirAtten_p = st_ivas->hBinRendererTd->DirAtten_p; - DirAtten_p->ConeInnerAngle = fix_to_float( DirAtten_p->ConeInnerAngle_fx, Q22 ); - DirAtten_p->ConeOuterAngle = fix_to_float( DirAtten_p->ConeOuterAngle_fx, Q22 ); - DirAtten_p->ConeOuterGain = fix_to_float( DirAtten_p->ConeOuterGain_fx, Q30 ); Word16 nchan_rend = num_src; IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { @@ -390,26 +381,15 @@ ivas_error ivas_dec_setup( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p->SrcSpatial_p != NULL ) { - Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } } - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; - Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; - } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); - SrcSpatial_p->DirAtten.ConeInnerAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeInnerAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterGain = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterGain_fx, Q30 ); } } // Cleanup changes for ivas_cldfb_dec_reconfig_fx: fixed to float @@ -497,15 +477,6 @@ ivas_error ivas_dec_setup( // Cleanup changes for ivas_td_binaural_open: fixed to float IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Up_fx, st_ivas->hBinRendererTd->Listener_p->Up, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Right_fx, st_ivas->hBinRendererTd->Listener_p->Right, Q30, 3 ); - TDREND_DirAtten_t *DirAtten_p = st_ivas->hBinRendererTd->DirAtten_p; - DirAtten_p->ConeInnerAngle = fix_to_float( DirAtten_p->ConeInnerAngle_fx, Q22 ); - DirAtten_p->ConeOuterAngle = fix_to_float( DirAtten_p->ConeOuterAngle_fx, Q22 ); - DirAtten_p->ConeOuterGain = fix_to_float( DirAtten_p->ConeOuterGain_fx, Q30 ); Word16 nchan_rend = num_src; IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { @@ -516,26 +487,15 @@ ivas_error ivas_dec_setup( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p->SrcSpatial_p != NULL ) { - Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } } - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; - Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; - } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); - SrcSpatial_p->DirAtten.ConeInnerAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeInnerAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterGain = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterGain_fx, Q30 ); } } // Cleanup changes for ivas_cldfb_dec_reconfig_fx: fixed to float @@ -2224,30 +2184,13 @@ ivas_error ivas_init_decoder_fx( ELSE IF ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { #ifdef IVAS_FLOAT_FIXED -#if 1 /*Cleanup changes: float to fixed */ Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src; - FOR( i = 0; i < 4; i++ ) - { - st_ivas->hRenderConfig->directivity_fx[i * 3] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 1] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 1], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 2], 15 ); - } -#endif IF( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, &num_src ) ) != IVAS_ERR_OK ) { return error; } #if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Up_fx, st_ivas->hBinRendererTd->Listener_p->Up, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Right_fx, st_ivas->hBinRendererTd->Listener_p->Right, Q30, 3 ); - TDREND_DirAtten_t *DirAtten_p = st_ivas->hBinRendererTd->DirAtten_p; - DirAtten_p->ConeInnerAngle = fix_to_float( DirAtten_p->ConeInnerAngle_fx, Q22 ); - DirAtten_p->ConeOuterAngle = fix_to_float( DirAtten_p->ConeOuterAngle_fx, Q22 ); - DirAtten_p->ConeOuterGain = fix_to_float( DirAtten_p->ConeOuterGain_fx, Q30 ); Word16 nchan_rend = num_src; IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { @@ -2258,26 +2201,15 @@ ivas_error ivas_init_decoder_fx( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p->SrcSpatial_p != NULL ) { - Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } } - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; - Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; - } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); - SrcSpatial_p->DirAtten.ConeInnerAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeInnerAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterGain = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterGain_fx, Q30 ); } #endif #else @@ -2367,10 +2299,41 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Allocate TD renderer for the objects in DISC mode */ +#ifdef IVAS_FLOAT_FIXED + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + IF((error = ivas_td_binaural_open_fx(st_ivas, SrcInd, &num_src)) != IVAS_ERR_OK) + { + return error; + } +#if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float + Word16 nchan_rend = num_src; + IF(EQ_16(st_ivas->ivas_format, MC_FORMAT) && NE_16(st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM)) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR(Word16 nS = 0; nS < nchan_rend; nS++) + { + TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; + IF(Src_p->SrcSpatial_p != NULL) + { + FOR(Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++) + { + fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); + fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); + } + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; + fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); + fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); + } +#endif +#else IF ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } +#endif /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ IF ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -2412,10 +2375,41 @@ ivas_error ivas_init_decoder_fx( IF ( ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { /* Allocate TD renderer for the objects in DISC mode */ +#ifdef IVAS_FLOAT_FIXED + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + IF((error = ivas_td_binaural_open_fx(st_ivas, SrcInd, &num_src)) != IVAS_ERR_OK) + { + return error; + } +#if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float + Word16 nchan_rend = num_src; + IF(EQ_16(st_ivas->ivas_format, MC_FORMAT) && NE_16(st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM)) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR(Word16 nS = 0; nS < nchan_rend; nS++) + { + TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; + IF(Src_p->SrcSpatial_p != NULL) + { + FOR(Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++) + { + fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); + fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); + } + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; + fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); + fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); + } +#endif +#else IF ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } +#endif } } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 22d7484c4..4df423d75 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -619,30 +619,13 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* Open the TD Binaural renderer */ if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) { -#if 1 /*Cleanup changes: float to fixed */ Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src; - FOR( Word16 i = 0; i < 4; i++ ) - { - st_ivas->hRenderConfig->directivity_fx[i * 3] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 1] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 1], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = (Word16)floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 2], 15 ); - } -#endif IF ( ( error = ivas_td_binaural_open_fx( st_ivas , SrcInd, &num_src ) ) != IVAS_ERR_OK ) { return error; } #if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Up_fx, st_ivas->hBinRendererTd->Listener_p->Up, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Right_fx, st_ivas->hBinRendererTd->Listener_p->Right, Q30, 3 ); - TDREND_DirAtten_t *DirAtten_p = st_ivas->hBinRendererTd->DirAtten_p; - DirAtten_p->ConeInnerAngle = fix_to_float( DirAtten_p->ConeInnerAngle_fx, Q22 ); - DirAtten_p->ConeOuterAngle = fix_to_float( DirAtten_p->ConeOuterAngle_fx, Q22 ); - DirAtten_p->ConeOuterGain = fix_to_float( DirAtten_p->ConeOuterGain_fx, Q30 ); Word16 nchan_rend = num_src; IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { @@ -653,26 +636,15 @@ static ivas_error ivas_ism_bitrate_switching_dec( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p->SrcSpatial_p != NULL ) { - Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } } - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; - Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; - } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); - SrcSpatial_p->DirAtten.ConeInnerAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeInnerAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterGain = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterGain_fx, Q30 ); } #endif diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 89128520f..f56362f1b 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -5457,10 +5457,109 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { +#ifdef IVAS_FLOAT_FIXED_s + //Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + //Word32 *p_output_fx[MAX_OUTPUT_CHANNELS]; + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + floatToFixed_arrL(p_output[i], p_output_fx[i], Q7, L_FRAME48k); + p_output_fx[i] = p_output_fx[i]; + } + + Word16 subframe_length; + Word16 num_subframes = (int16_t)((*nSamplesRendered * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); + subframe_length = (*nSamplesRendered) / num_subframes; +#if 1 + for (Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++) + { + Word16 idx = subframe_idx; + + IF(st_ivas->hCombinedOrientationData->Quaternions) { + float max_val = 0; + max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].w)); + max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].x)); + max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].y)); + max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].z)); + Word16 quat_q = Q_factor_L(max_val); + st_ivas->hCombinedOrientationData->Quaternions[idx].w_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].w, quat_q); + st_ivas->hCombinedOrientationData->Quaternions[idx].x_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].x, quat_q); + st_ivas->hCombinedOrientationData->Quaternions[idx].y_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].y, quat_q); + st_ivas->hCombinedOrientationData->Quaternions[idx].z_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].z, quat_q); + } + Word16 pos_q = Q25; + + IF(st_ivas->hCombinedOrientationData->listenerPos != NULL) + { + st_ivas->hCombinedOrientationData->listenerPos[idx].x_fx = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->listenerPos[idx].x, pos_q); + st_ivas->hCombinedOrientationData->listenerPos[idx].y_fx = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->listenerPos[idx].y, pos_q); + st_ivas->hCombinedOrientationData->listenerPos[idx].z_fx = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->listenerPos[idx].z, pos_q); + } + FOR( i = 0; i < 3; i++) + { + st_ivas->hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Front[i], Q30); + st_ivas->hBinRendererTd->Listener_p->Up_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Up[i], Q30); + st_ivas->hBinRendererTd->Listener_p->Right_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Right[i], Q30); + st_ivas->hBinRendererTd->Listener_p->Pos_q = pos_q; + st_ivas->hBinRendererTd->Listener_p->Pos_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Pos[i], st_ivas->hBinRendererTd->Listener_p->Pos_q); + } + + } +#endif + if ((error = ivas_td_binaural_renderer_fx(st_ivas, p_output_fx, *nSamplesRendered)) != IVAS_ERR_OK) + { + return error; + } +#if 1 + for ( i = 0; i < 3; i++) + { + st_ivas->hBinRendererTd->Listener_p->Front[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Front_fx[i], Q30); + st_ivas->hBinRendererTd->Listener_p->Up[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Up_fx[i], Q30); + st_ivas->hBinRendererTd->Listener_p->Right[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Right_fx[i], Q30); + st_ivas->hBinRendererTd->Listener_p->Pos[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Pos_fx[i], st_ivas->hBinRendererTd->Listener_p->Pos_q); + } + + Word16 ism_md_subframe_update_ext = 0; + Word16 nchan_transport_tmp = (st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_SBA_MODE_DISC) ? st_ivas->nchan_ism : st_ivas->nchan_transport; + + if (st_ivas->hDecoderConfig->Opt_delay_comp) + { + ism_md_subframe_update_ext = 1; + } + else + { + ism_md_subframe_update_ext = 2; + } + + if (st_ivas->ivas_format == MASA_ISM_FORMAT) + { + ism_md_subframe_update_ext = 2; + } + + for (Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++) + { + if (subframe_idx == ism_md_subframe_update_ext) + { + for(Word16 ns = 0; ns < nchan_transport_tmp - 1; ns++) + { + fixedToFloat_arrL(st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p_fx, st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p, Q30, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + fixedToFloat_arrL(st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p_fx, st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p, Q25, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + } + } + } + + + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + fixedToFloat_arrL(p_output_fx[i], p_output[i], Q7, L_FRAME48k); + } +#endif + +#else if ( ( error = ivas_td_binaural_renderer( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; } +#endif Word16 q = Q16; q = q - find_guarded_bits_fx( *nSamplesRendered ); diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 8a9b8a517..2e18522b5 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -4016,8 +4016,8 @@ void ivas_param_mc_dec_render( slot_idx_start_cldfb_synth = 0; for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) { - Word16 len = slot_idx_start_cldfb_synth * hParamMC->num_freq_bands + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]; #ifdef IVAS_FLOAT_FIXED + Word16 len = slot_idx_start_cldfb_synth * hParamMC->num_freq_bands + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]; for (i = 0; i < nchan_out_cldfb; i++) { floatToFixed_arrL(output_f[i], output_f_fx[i], Q11, len); diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ce8e3c6f3..d4c0132a1 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -69,8 +69,7 @@ ivas_error ivas_td_binaural_open_fx( } return ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, *num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity_fx, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns, SrcInd ); } -#endif // IVAS_FLOAT_FIXED - +#else ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -86,6 +85,7 @@ ivas_error ivas_td_binaural_open( return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); } +#endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * ivas_td_binaural_renderer() @@ -93,6 +93,35 @@ ivas_error ivas_td_binaural_open( * Receives the current frames for the object streams, updates metadata * and renders the current frame. *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_td_binaural_renderer_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output[], /* i/o: SCE channels / Binaural synthesis */ + const Word16 output_frame /* i : output frame length */ +) +{ + Word16 ism_md_subframe_update; + Word16 nchan_transport; + test(); + nchan_transport = (EQ_16(st_ivas->ism_mode , ISM_MASA_MODE_DISC) || EQ_16(st_ivas->ism_mode , ISM_SBA_MODE_DISC)) ? st_ivas->nchan_ism : st_ivas->nchan_transport; + + IF (st_ivas->hDecoderConfig->Opt_delay_comp) + { + ism_md_subframe_update = 1; + } + ELSE + { + ism_md_subframe_update = 2; + } + + IF (EQ_16(st_ivas->ivas_format , MASA_ISM_FORMAT)) + { + ism_md_subframe_update = 2; + } + + return ivas_td_binaural_renderer_unwrap_fx(st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hCombinedOrientationData, ism_md_subframe_update, output, output_frame, MAX_PARAM_SPATIAL_SUBFRAMES); +} +#endif ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -121,8 +150,6 @@ ivas_error ivas_td_binaural_renderer( return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hCombinedOrientationData, ism_md_subframe_update, output, output_frame, MAX_PARAM_SPATIAL_SUBFRAMES ); } - - /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_sf() * diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index a169d6683..5d06f0bfa 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1478,10 +1478,41 @@ ivas_error ivas_sba_dec_reconfigure_fx( /* Allocate TD renderer for the objects in DISC mode */ if ( st_ivas->hBinRendererTd == NULL ) { +#ifdef IVAS_FLOAT_FIXED + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + IF((error = ivas_td_binaural_open_fx(st_ivas, SrcInd, &num_src)) != IVAS_ERR_OK) + { + return error; + } +#if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float + Word16 nchan_rend = num_src; + IF(EQ_16(st_ivas->ivas_format, MC_FORMAT) && NE_16(st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM)) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR(Word16 nS = 0; nS < nchan_rend; nS++) + { + TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; + IF(Src_p->SrcSpatial_p != NULL) + { + FOR(Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++) + { + fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); + fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); + } + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; + fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); + fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); + } +#endif +#else if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } +#endif } } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index f8e2a9a17..a2eac77dc 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -274,7 +274,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( return error; } -#endif // IVAS_FLOAT_FIXED +#else ivas_error ivas_td_binaural_open_unwrap( TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ const int32_t output_Fs, /* i : Output sampling rate */ @@ -431,11 +431,17 @@ ivas_error ivas_td_binaural_open_unwrap( { return error; } - +#ifdef IVAS_FLOAT_FIXED + if ((error = TDREND_MIX_SRC_SetDirAtten_fx(pBinRendTd, nS, DirAtten_p)) != IVAS_ERR_OK) + { + return error; + } +#else if ( ( error = TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ) ) != IVAS_ERR_OK ) { return error; } +#endif } } @@ -462,11 +468,17 @@ ivas_error ivas_td_binaural_open_unwrap( DirAtten_p->ConeOuterAngle_fx = float_to_fix(DirAtten_p->ConeOuterAngle, Q22); DirAtten_p->ConeOuterGain_fx = float_to_fix(DirAtten_p->ConeOuterGain, Q30); #endif - +#ifdef IVAS_FLOAT_FIXED + if ((error = TDREND_MIX_SRC_SetDirAtten_fx(pBinRendTd, nS, DirAtten_p)) != IVAS_ERR_OK) + { + return error; + } +#else if ( ( error = TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ) ) != IVAS_ERR_OK ) { return error; } +#endif } } @@ -479,6 +491,7 @@ ivas_error ivas_td_binaural_open_unwrap( return error; } +#endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* @@ -530,6 +543,175 @@ void ivas_td_binaural_close( * * Call ivas_td_binaural_renderer() without st_ivas. *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_td_binaural_renderer_unwrap_fx( + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ + const Word16 num_src, /* i : number of sources to render */ + const Word16 lfe_idx, /* i : LFE channel index */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientaton data handle */ + const Word16 ism_md_subframe_update, /* i : Number of subframes to delay ism metadata to sync with audio */ + Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis */ + const Word16 output_frame, /* i : output frame length */ + const Word16 num_subframes /* i : number of subframes to render */ +) +{ + Word16 subframe_length; + Word16 subframe_idx; + ivas_error error; + Word16 c_indx, nS; + Word16 ch; + Word16 *enableCombinedOrientation; /* i : Combined orientation flag */ + IVAS_QUATERNION *Quaternions; /* i : Head tracking data per subframe */ + IVAS_VECTOR3 *Pos; /* i : Listener position data per subframe */ + + + Word32 reverb_signal_fx[BINAURAL_CHANNELS][L_FRAME48k]; + Word32 *p_reverb_signal_fx[BINAURAL_CHANNELS]; + + enableCombinedOrientation = NULL; + Quaternions = NULL; + Pos = NULL; + IF(hCombinedOrientationData != NULL) + { + enableCombinedOrientation = hCombinedOrientationData->enableCombinedOrientation; + Quaternions = hCombinedOrientationData->Quaternions; + Pos = hCombinedOrientationData->listenerPos; + } + + FOR(ch = 0; ch < BINAURAL_CHANNELS; ch++) + { + p_reverb_signal_fx[ch] = reverb_signal_fx[ch]; + } + + subframe_length = output_frame / num_subframes; + + c_indx = 0; + FOR(nS = 0; nS < num_src; nS++) + { + IF(!(ivas_format == MC_FORMAT && nS == lfe_idx)) /* Skip LFE for MC */ + { + hBinRendererTd->Sources[c_indx]->InputFrame_p_fx = output_fx[nS]; + hBinRendererTd->Sources[c_indx]->InputFrame_p_q = Q7; + hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; + c_indx = add(c_indx, 1); + } + } + + FOR(subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++) + { + IF(subframe_idx == ism_md_subframe_update) + { + /* Update object position(s) */ + IF((error = TDREND_Update_object_positions_fx(hBinRendererTd, num_src, ivas_format, hIsmMetaData)) != IVAS_ERR_OK) + { + return error; + } + } + + /* Update the listener's location/orientation */ + Word16 tmp_headRotEnabled; + + tmp_headRotEnabled = 0; + move16(); + + + IF(enableCombinedOrientation != NULL) + { + tmp_headRotEnabled = enableCombinedOrientation[hCombinedOrientationData->subframe_idx]; + move16(); + } + + IF((error = TDREND_Update_listener_orientation_fx(hBinRendererTd, tmp_headRotEnabled, &Quaternions[hCombinedOrientationData->subframe_idx], &Pos[hCombinedOrientationData->subframe_idx])) != IVAS_ERR_OK) + { + return error; + } + + IF(hReverb != NULL) + { + Word16 i, j, exp; + Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; + Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; + Word32 *pcm_out_fx[BINAURAL_CHANNELS]; + Word16 nchan_transport = audioCfg2channels(transport_config); + exp = Q7; + move16(); + FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + pcm_in_fx[i] = pcm_in_buff[i]; + } + FOR(i = 0; i < nchan_transport; i++) + { + + FOR(j = 0; j < ((subframe_idx + 1) * hReverb->full_block_size); j++) + { + + pcm_in_fx[i][j] = output_fx[i][j]; + } + } + FOR(i = 0; i < BINAURAL_CHANNELS; i++) + { + pcm_out_fx[i] = pcm_out_buff[i]; + } + FOR(i = 0; i < BINAURAL_CHANNELS; i++) + { + + FOR(j = 0; j < (hReverb->full_block_size); j++) + { + pcm_out_fx[i][j] = p_reverb_signal_fx[i][j]; + } + } + IF((error = ivas_reverb_process_fx(hReverb, transport_config, 0, pcm_in_fx, pcm_out_fx, subframe_idx)) != IVAS_ERR_OK) + { + return error; + } + FOR(i = 0; i < BINAURAL_CHANNELS; i++) + { + + FOR(j = 0; j < (hReverb->full_block_size); j++) + { + + p_reverb_signal_fx[i][subframe_idx * hReverb->full_block_size + j] = L_shl(pcm_out_fx[i][subframe_idx * hReverb->full_block_size + j], 2); + } + } + } + + /* Render subframe */ + IF((error = TDREND_GetMix_fx(hBinRendererTd, output_fx, subframe_length, subframe_idx, ism_md_subframe_update)) != IVAS_ERR_OK) + { + return error; + } + + + /* Advance subframe pointer */ + c_indx = 0; + move16(); + FOR(nS = 0; nS < num_src; nS++) + { + IF(!(ivas_format == MC_FORMAT && nS == lfe_idx)) /* Skip LFE for MC */ + { + hBinRendererTd->Sources[c_indx]->InputFrame_p_fx += subframe_length; + c_indx = add(c_indx, 1); + } + } + + /* update combined orientation access index */ + ivas_combined_orientation_update_index(hCombinedOrientationData, subframe_length); + } + + IF(hReverb != NULL) + { + v_add_32(reverb_signal_fx[0], output_fx[0], output_fx[0], output_frame); + v_add_32(reverb_signal_fx[1], output_fx[1], output_fx[1], output_frame); + } + + return IVAS_ERR_OK; +} +#endif ivas_error ivas_td_binaural_renderer_unwrap( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ @@ -656,14 +838,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( tmp_Pos->y_fx = (Word32)float_to_fix(tmp_Pos->y, pos_q); tmp_Pos->z_fx = (Word32)float_to_fix(tmp_Pos->z, pos_q); tmp_Pos->q_fact= pos_q; - for (int i = 0; i < 3; i++) - { - hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(hBinRendererTd->Listener_p->Front[i], Q30); - hBinRendererTd->Listener_p->Up_fx[i] = float_to_fix(hBinRendererTd->Listener_p->Up[i], Q30); - hBinRendererTd->Listener_p->Right_fx[i] = float_to_fix(hBinRendererTd->Listener_p->Right[i], Q30); - hBinRendererTd->Listener_p->Pos_q = pos_q; - hBinRendererTd->Listener_p->Pos_fx[i] = float_to_fix(hBinRendererTd->Listener_p->Pos[i], hBinRendererTd->Listener_p->Pos_q); - } // end float to fix IF ( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, tmp_Quaternions, tmp_Pos ) ) != IVAS_ERR_OK ) @@ -672,13 +846,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( } // fix to float - for (int i = 0; i < 3; i++) - { - hBinRendererTd->Listener_p->Front[i] = fix_to_float(hBinRendererTd->Listener_p->Front_fx[i], Q30); - hBinRendererTd->Listener_p->Up[i] = fix_to_float(hBinRendererTd->Listener_p->Up_fx[i], Q30); - hBinRendererTd->Listener_p->Right[i] = fix_to_float(hBinRendererTd->Listener_p->Right_fx[i], Q30); - hBinRendererTd->Listener_p->Pos[i] = fix_to_float(hBinRendererTd->Listener_p->Pos_fx[i], hBinRendererTd->Listener_p->Pos_q); - } #else if ( ( error = TDREND_Update_listener_orientation( hBinRendererTd, ( enableCombinedOrientation != NULL ) ? enableCombinedOrientation[hCombinedOrientationData->subframe_idx] : 0, ( Quaternions != NULL ) ? &Quaternions[hCombinedOrientationData->subframe_idx] : NULL, ( Pos != NULL ) ? &Pos[hCombinedOrientationData->subframe_idx] : NULL ) ) != IVAS_ERR_OK ) { @@ -800,7 +967,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( return IVAS_ERR_OK; } - /*---------------------------------------------------------------------* * TDREND_GetMix() * @@ -1098,10 +1264,17 @@ ivas_error TDREND_Update_object_positions( return error; } +#ifdef IVAS_FLOAT_FIXED + if ((error = TDREND_MIX_SRC_SetDirAtten_fx(hBinRendererTd, nS, DirAtten_p)) != IVAS_ERR_OK) + { + return error; + } +#else if ( ( error = TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ) ) != IVAS_ERR_OK ) { return error; } +#endif if ( hIsmMetaData[nS]->non_diegetic_flag ) { @@ -1129,13 +1302,13 @@ ivas_error TDREND_Update_object_positions( return IVAS_ERR_OK; } - /*---------------------------------------------------------------------* * TDREND_Update_listener_orientation() * * Update listener orientation (s) *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ @@ -1198,8 +1371,7 @@ ivas_error TDREND_Update_listener_orientation( return error; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error TDREND_Update_listener_orientation_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const Word16 headRotEnabled, /* i : Headrotation flag */ @@ -1285,7 +1457,57 @@ ivas_error TDREND_Update_listener_orientation_fx( * * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_td_binaural_open_ext_fx( + TDREND_WRAPPER *pTDRend, + AUDIO_CONFIG inConfig, + RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ + LSSETUP_CUSTOM_STRUCT *customLsInput, + const Word32 outFs, + Word16 *SrcInd, + Word16 *num_src ) +{ + Word16 nchan_transport; + AUDIO_CONFIG transport_config; + IVAS_FORMAT ivas_format; + IVAS_OUTPUT_SETUP hTransSetup; + ivas_error error; + Word16 *directivity_fx = NULL; + + IF( NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + IF( ( error = getAudioConfigNumChannels( inConfig, &nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + nchan_transport = customLsInput->num_spk; + } + *num_src = nchan_transport; + + transport_config = inConfig; + ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; + + hTransSetup.ls_azimuth_fx = NULL; + hTransSetup.ls_elevation_fx = NULL; + + IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + hTransSetup.ls_azimuth_fx = customLsInput->ls_azimuth_fx; + hTransSetup.ls_elevation_fx = customLsInput->ls_elevation_fx; + } + + IF( NULL != hRendCfg ) + { + directivity_fx = hRendCfg->directivity_fx; + } + + return ivas_td_binaural_open_unwrap_fx( &pTDRend->hHrtfTD, outFs, *num_src, ivas_format, transport_config, directivity_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd ); +} +#else ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, AUDIO_CONFIG inConfig, @@ -1333,6 +1555,7 @@ ivas_error ivas_td_binaural_open_ext( return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); } +#endif #ifdef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_ext() @@ -1363,6 +1586,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; ivas_error error; +#if 1 float *p_output[MAX_OUTPUT_CHANNELS]; float output_fl[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word16 ch,j; @@ -1378,6 +1602,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( { p_output[ch] = output_fl[ch]; } +#endif push_wmops( "ivas_td_binaural_renderer_ext" ); @@ -1418,23 +1643,112 @@ ivas_error ivas_td_binaural_renderer_ext_fx( hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; } - IF ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, - ism_md_subframe_update_ext, p_output, output_frame, (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ) ) ) != IVAS_ERR_OK ) +#ifdef IVAS_FLOAT_FIXED_S + //Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word32 *p_output_fx[MAX_OUTPUT_CHANNELS]; + FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + Scale_sig32(output[i], Q7 - (31 - exp), L_FRAME48k); + p_output_fx[i] = output[i]; + } + + Word16 subframe_length; + Word16 num_subframes = (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); + subframe_length = output_frame / num_subframes; + +#if 1 + for ( Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) + { + Word16 idx = subframe_idx; + + IF( ( *hCombinedOrientationData )->Quaternions ) + { + float max_val = 0; + max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].w ) ); + max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].x ) ); + max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].y ) ); + max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].z ) ); + Word16 quat_q = Q_factor_L( max_val ); + ( *hCombinedOrientationData )->Quaternions[idx].w_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].w, quat_q ); + ( *hCombinedOrientationData )->Quaternions[idx].x_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].x, quat_q ); + ( *hCombinedOrientationData )->Quaternions[idx].y_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].y, quat_q ); + ( *hCombinedOrientationData )->Quaternions[idx].z_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].z, quat_q ); + } + Word16 pos_q = Q25; + + IF((*hCombinedOrientationData)->listenerPos != NULL) + { + (*hCombinedOrientationData)->listenerPos[idx].x_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].x, pos_q); + (*hCombinedOrientationData)->listenerPos[idx].y_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].y, pos_q); + (*hCombinedOrientationData)->listenerPos[idx].z_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].z, pos_q); + } + FOR(int i = 0; i < 3; i++) + { + pTDRend->hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Front[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Up_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Up[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Right_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Right[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; + pTDRend->hBinRendererTd->Listener_p->Pos_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Pos[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); + } + } +#endif + if ((error = ivas_td_binaural_renderer_unwrap_fx(hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, + ism_md_subframe_update_ext, p_output_fx, output_frame, (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs))) != IVAS_ERR_OK) { return error; } - IF ( hReverb != NULL) + +#if 1 + for (int i = 0; i < 3; i++) { - exp = sub(exp , 2); + pTDRend->hBinRendererTd->Listener_p->Front[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Front_fx[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Up[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Up_fx[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Right[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Right_fx[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Pos[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Pos_fx[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); } - /*This intermediate conversion will be removed once the subfunctions are also converted to fixed*/ - for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + + for (Word16 subframe_idx = 0; subframe_idx < (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); subframe_idx++) { - for ( j = 0; j < L_FRAME48k; j++ ) + if (subframe_idx == ism_md_subframe_update_ext) { - output[ch][j] = (Word32) output_fl[ch][j] *( 1 << (exp)) ; + FOR(Word16 ns = 0; ns < num_src - 1; ns++) + { + fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p, Q30, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p, Q25, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + } } } + exp = 31 - Q7; +#endif + +#if 0 + FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + fixedToFloat_arrL(output_fx[i], output[i], Q7, L_FRAME48k); + } +#endif +#else + if ((error = ivas_td_binaural_renderer_unwrap(hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, + ism_md_subframe_update_ext, p_output, output_frame, (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs))) != IVAS_ERR_OK) + { + return error; + } +#if 1 + IF(hReverb != NULL) + { + exp = sub(exp, 2); + } + /*This intermediate conversion will be removed once the subfunctions are also converted to fixed*/ + for (ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) + { + for (j = 0; j < L_FRAME48k; j++) + { + output[ch][j] = (Word32)output_fl[ch][j] * (1 << (exp)); + } + } +#endif +#endif + pop_wmops(); return IVAS_ERR_OK; @@ -1513,12 +1827,92 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0]->radius = currentPos->radius; hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; } +#ifdef IVAS_FLOAT_FIXED_s + Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word32 *p_output_fx[MAX_OUTPUT_CHANNELS]; + FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + floatToFixed_arrL(output[i], output_fx[i], Q7, L_FRAME48k); + p_output_fx[i] = output_fx[i]; + } + + Word16 subframe_length; + Word16 num_subframes = (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); + subframe_length = output_frame / num_subframes; + +#if 1 + for (Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++) + { + Word16 idx = subframe_idx; + + IF((*hCombinedOrientationData)->Quaternions) { + float max_val = 0; + max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].w)); + max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].x)); + max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].y)); + max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].z)); + Word16 quat_q = Q_factor_L(max_val); + (*hCombinedOrientationData)->Quaternions[idx].w_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].w, quat_q); + (*hCombinedOrientationData)->Quaternions[idx].x_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].x, quat_q); + (*hCombinedOrientationData)->Quaternions[idx].y_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].y, quat_q); + (*hCombinedOrientationData)->Quaternions[idx].z_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].z, quat_q); + } + Word16 pos_q = Q25; + + IF((*hCombinedOrientationData)->listenerPos != NULL) + { + (*hCombinedOrientationData)->listenerPos[idx].x_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].x, pos_q); + (*hCombinedOrientationData)->listenerPos[idx].y_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].y, pos_q); + (*hCombinedOrientationData)->listenerPos[idx].z_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].z, pos_q); + } + FOR(int i = 0; i < 3; i++) + { + pTDRend->hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Front[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Up_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Up[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Right_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Right[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; + pTDRend->hBinRendererTd->Listener_p->Pos_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Pos[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); + } + } +#endif + if ((error = ivas_td_binaural_renderer_unwrap_fx(hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, + ism_md_subframe_update_ext, p_output_fx, output_frame, (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs))) != IVAS_ERR_OK) + { + return error; + } + +#if 1 + for (int i = 0; i < 3; i++) + { + pTDRend->hBinRendererTd->Listener_p->Front[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Front_fx[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Up[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Up_fx[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Right[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Right_fx[i], Q30); + pTDRend->hBinRendererTd->Listener_p->Pos[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Pos_fx[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); + } + for (Word16 subframe_idx = 0; subframe_idx < (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); subframe_idx++) + { + if (subframe_idx == ism_md_subframe_update_ext) + { + FOR(Word16 ns = 0; ns < num_src; ns++) + { + fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p, Q30, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p, Q25, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + } + } + } + FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + fixedToFloat_arrL(output_fx[i], output[i], Q7, L_FRAME48k); + } +#endif +#else if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, ism_md_subframe_update_ext, p_output, output_frame, (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ) ) ) != IVAS_ERR_OK ) { return error; } +#endif pop_wmops(); diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 30dbb9cd4..c91f8f6cd 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -94,8 +94,7 @@ void TDREND_MIX_LIST_SetPos_fx( return; } -#endif - +#else void TDREND_MIX_LIST_SetPos( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const float *Pos_p /* i : Listener's position */ @@ -116,6 +115,7 @@ void TDREND_MIX_LIST_SetPos( return; } +#endif /*-------------------------------------------------------------------* @@ -124,6 +124,7 @@ void TDREND_MIX_LIST_SetPos( * Sets the listener's orientation vectors in the specified mixer unit. --------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error TDREND_MIX_LIST_SetOrient( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const float *FrontVec_p, /* i : Listener's orientation front vector */ @@ -150,9 +151,7 @@ ivas_error TDREND_MIX_LIST_SetOrient( return IVAS_ERR_OK; } - - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error TDREND_MIX_LIST_SetOrient_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const Word32 *FrontVec_p_fx, /* i : Listener's orientation front vector */ @@ -416,12 +415,13 @@ ivas_error TDREND_MIX_Init( } /* Init virtual and rendering listeners for spatial mixers */ +#ifndef IVAS_FLOAT_FIXED TDREND_SPATIAL_VecInit( hBinRendererTd->Listener_p->Pos, 0.0f, 0.0f, 0.0f ); TDREND_SPATIAL_VecInit( hBinRendererTd->Listener_p->Vel, 0.0f, 0.0f, 0.0f ); TDREND_SPATIAL_VecInit( hBinRendererTd->Listener_p->Front, 0.0f, 0.0f, -1.0f ); TDREND_SPATIAL_VecInit( hBinRendererTd->Listener_p->Up, 0.0f, 1.0f, 0.0f ); TDREND_SPATIAL_VecInit( hBinRendererTd->Listener_p->Right, 1.0f, 0.0f, 0.0f ); - +#endif #ifdef IVAS_FLOAT_FIXED TDREND_SPATIAL_VecInit_fx( hBinRendererTd->Listener_p->Pos_fx, 0, 0, 0 ); hBinRendererTd->Listener_p->Pos_q = Q25; @@ -618,8 +618,11 @@ ivas_error TDREND_MIX_AddSrc( { return error; } - +#ifdef IVAS_FLOAT_FIXED + TDREND_SRC_Init_fx(Src_p, PosType); +#else TDREND_SRC_Init( Src_p, PosType ); +#endif /* Special OpenAL initialization due to a common distance attenuation model */ if ( hBinRendererTd->DistAttenModel != 0 ) diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 1b566cb9f..747859a15 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -47,25 +47,21 @@ * Local function prototypes *---------------------------------------------------------------------*/ -static void TDREND_SRC_SPATIAL_Dealloc( TDREND_SRC_SPATIAL_t *SrcSpatial_p ); - +#ifndef IVAS_FLOAT_FIXED static void TDREND_SRC_SPATIAL_Init( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_PosType_t PosType ); -static void TDREND_SRC_SPATIAL_Init_fx( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_PosType_t PosType ); - static void TDREND_SRC_SPATIAL_SetDirAtten( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DirAtten_t *DirAtten_p ); -static void TDREND_SRC_SPATIAL_SetDirAtten_fx( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DirAtten_t *DirAtten_p ); - static float TDREND_SRC_SPATIAL_GetDirGain( const TDREND_DirAtten_t *DirAtten_p, const float *Front_p, const float *RelPos_p ); -static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( const TDREND_DirAtten_t *DirAtten_p, const Word32 *Front_p_fx, const Word32 *RelPos_p, const Word16 RelPos_p_e ); - static float TDREND_SRC_SPATIAL_GetDistGain( const TDREND_DistAtten_t *DistAtten_p, const float Dist ); -static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( const TDREND_DistAtten_t *DistAtten_p, const Word32 Dist_fx, const Word16 Dist_e ); - -static ivas_error TDREND_SRC_REND_Alloc( TDREND_SRC_REND_t **SrcRend_pp ); - static void TDREND_SRC_REND_Init( TDREND_SRC_REND_t *SrcRend_p ); +#else static void TDREND_SRC_REND_Init_fx( TDREND_SRC_REND_t *SrcRend_p ); - +static void TDREND_SRC_SPATIAL_Init_fx( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_PosType_t PosType ); +static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( const TDREND_DirAtten_t *DirAtten_p, const Word32 *Front_p_fx, const Word32 *RelPos_p, const Word16 RelPos_p_e ); +static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( const TDREND_DistAtten_t *DistAtten_p, const Word32 Dist_fx, const Word16 Dist_e ); +static void TDREND_SRC_SPATIAL_SetDirAtten_fx( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DirAtten_t *DirAtten_p ); +#endif +static ivas_error TDREND_SRC_REND_Alloc( TDREND_SRC_REND_t **SrcRend_pp ); +static void TDREND_SRC_SPATIAL_Dealloc( TDREND_SRC_SPATIAL_t *SrcSpatial_p ); /*-------------------------------------------------------------------* * TDREND_MIX_SRC_SetPos() @@ -215,8 +211,7 @@ ivas_error TDREND_MIX_SRC_SetDirAtten_fx( return IVAS_ERR_OK; } -#endif // IVAS_FLOAT_FIXED - +#else ivas_error TDREND_MIX_SRC_SetDirAtten( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const int16_t SrcInd, /* i : Source index */ @@ -236,6 +231,7 @@ ivas_error TDREND_MIX_SRC_SetDirAtten( return IVAS_ERR_OK; } +#endif // IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -325,9 +321,6 @@ static void TDREND_SRC_REND_Init_fx( /* SrcGain */ FOR( nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { - // Float code - SrcRend_p->SrcGain_p[nC] = 1.0f; - SrcRend_p->SrcGainMin_p_fx[nC] = 0;/*Assuming Q15*/ move16(); SrcRend_p->SrcGain_p_fx[nC] = ONE_IN_Q14; @@ -340,10 +333,6 @@ static void TDREND_SRC_REND_Init_fx( /* Init directional and distance gains */ FOR ( nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { - // Float code - SrcRend_p->DirGain_p[nC] = 1.0f; - SrcRend_p->DistGain_p[nC] = 1.0f; - SrcRend_p->DirGain_p_fx[nC] = ONE_IN_Q14; move16(); SrcRend_p->DistGain_p_fx[nC] = ONE_IN_Q14; @@ -351,8 +340,7 @@ static void TDREND_SRC_REND_Init_fx( } return; } -#endif // IVAS_FLOAT_FIXED - +#else static void TDREND_SRC_REND_Init( TDREND_SRC_REND_t *SrcRend_p /* i/o: Source object */ ) @@ -365,12 +353,17 @@ static void TDREND_SRC_REND_Init( /* SrcGain */ for ( nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { +#ifndef IVAS_FLOAT_FIXED SrcRend_p->SrcGainMin_p[nC] = 0.0f; SrcRend_p->SrcGain_p[nC] = 1.0f; SrcRend_p->SrcGainMax_p[nC] = 1.0f; -#ifdef IVAS_FLOAT_FIXED +#else + SrcRend_p->SrcGainMin_p_fx[nC] = ONE_IN_Q14; + move16(); SrcRend_p->SrcGain_p_fx[nC] = ONE_IN_Q14; move16(); + SrcRend_p->SrcGainMax_p_fx[nC] = ONE_IN_Q14; + move16(); #endif } SrcRend_p->SrcGainUpdated = FALSE; @@ -378,9 +371,10 @@ static void TDREND_SRC_REND_Init( /* Init directional and distance gains */ for ( nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { +#ifndef IVAS_FLOAT_FIXED SrcRend_p->DirGain_p[nC] = 1.0f; SrcRend_p->DistGain_p[nC] = 1.0f; -#ifdef IVAS_FLOAT_FIXED +#else SrcRend_p->DirGain_p_fx[nC] = ONE_IN_Q14; move16(); SrcRend_p->DistGain_p_fx[nC] = ONE_IN_Q14; @@ -392,6 +386,7 @@ static void TDREND_SRC_REND_Init( return; } +#endif // IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * TDREND_SRC_REND_UpdateFiltersFromSpatialParams() @@ -623,115 +618,115 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( ELSE{ IF( SrcSpatial_p->DistAttenEnabled ){ *SrcRend_p->DistGain_p_fx = TDREND_SRC_SPATIAL_GetDistGain_fx( &SrcSpatial_p->DistAtten, ListRelDist, ListRelDist_e ); + } + } + + /* Update total gains */ + *Gain = extract_h( L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ) ); + + /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ + + elev_delta = L_sub( Elev, Src_p->elev_prev_fx ); + azim_delta = L_sub( Azim, Src_p->azim_prev_fx ); + + Src_p->elev_prev_fx = Elev; + move32(); + Src_p->azim_prev_fx = Azim; + move32(); + + /* map to -180:180 range */ + IF( GT_32( azim_delta, DEG_180_IN_Q22 ) ) + { + azim_delta = L_sub( azim_delta, DEG_360_IN_Q22 ); + } + ELSE IF( LT_32( azim_delta, -DEG_180_IN_Q22 ) ) + { + azim_delta = L_add( azim_delta, DEG_360_IN_Q22 ); + } + Word16 tmp1 = extract_l( Mpy_32_32( L_abs( azim_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 + Word16 tmp2 = extract_l( Mpy_32_32( L_abs( elev_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 + *intp_count = s_min( MAX_INTERPOLATION_STEPS, s_max( tmp1, tmp2 ) ); } -} - -/* Update total gains */ -*Gain = extract_h( L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ) ); - -/* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ - -elev_delta = L_sub( Elev, Src_p->elev_prev_fx ); -azim_delta = L_sub( Azim, Src_p->azim_prev_fx ); - -Src_p->elev_prev_fx = Elev; -move32(); -Src_p->azim_prev_fx = Azim; -move32(); - -/* map to -180:180 range */ -IF( GT_32( azim_delta, DEG_180_IN_Q22 ) ) -{ - azim_delta = L_sub( azim_delta, DEG_360_IN_Q22 ); -} -ELSE IF( LT_32( azim_delta, -DEG_180_IN_Q22 ) ) -{ - azim_delta = L_add( azim_delta, DEG_360_IN_Q22 ); -} -Word16 tmp1 = extract_l( Mpy_32_32( L_abs( azim_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 -Word16 tmp2 = extract_l( Mpy_32_32( L_abs( elev_delta ), 100 << Q9 ) ); // Q22 + Q9 - Q31 = Q0 -*intp_count = s_min( MAX_INTERPOLATION_STEPS, s_max( tmp1, tmp2 ) ); -} -ELSE /* TDREND_POSTYPE_NON_DIEGETIC */ -{ - *itd = 0; - move16(); - *Gain = ONE_IN_Q14; - move16(); - set32_fx( hrf_left, 0, *filterlength ); - set32_fx( hrf_right, 0, *filterlength ); - hrf_left[0] = L_shr( L_add( SrcSpatial_p->Pos_p_fx[1], ONE_IN_Q25 ), 1 ); // Q25 - move32(); - hrf_right[0] = L_sub( ONE_IN_Q25, hrf_left[0] ); // Q25 - move32(); - hrf_left_e = 6; - move16(); - hrf_right_e = 6; - move16(); - *intp_count = MAX_INTERPOLATION_STEPS; - move16(); - Src_p->elev_prev_fx = 0; - move16(); - Src_p->azim_prev_fx = DEG_360_IN_Q22; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ - move16(); -} - -test(); -IF( ( *intp_count > 0 ) && subframe_update_flag ) -{ - /* Set deltas for interpolation */ - Word16 tmp_e; - tmp_e = s_max( *hrf_left_prev_e, hrf_left_e ); - FOR( Word16 i = 0; i < *filterlength; i++ ) + ELSE /* TDREND_POSTYPE_NON_DIEGETIC */ { - hrf_left[i] = L_shr( hrf_left[i], sub( tmp_e, hrf_left_e ) ); - hrf_left_prev[i] = L_shr( hrf_left_prev[i], sub( tmp_e, *hrf_left_prev_e ) ); + *itd = 0; + move16(); + *Gain = ONE_IN_Q14; + move16(); + set32_fx( hrf_left, 0, *filterlength ); + set32_fx( hrf_right, 0, *filterlength ); + hrf_left[0] = L_shr( L_add( SrcSpatial_p->Pos_p_fx[1], ONE_IN_Q25 ), 1 ); // Q25 + move32(); + hrf_right[0] = L_sub( ONE_IN_Q25, hrf_left[0] ); // Q25 + move32(); + hrf_left_e = 6; + move16(); + hrf_right_e = 6; + move16(); + *intp_count = MAX_INTERPOLATION_STEPS; + move16(); + Src_p->elev_prev_fx = 0; + move16(); + Src_p->azim_prev_fx = DEG_360_IN_Q22; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */ + move16(); } - *hrf_left_prev_e = tmp_e; - move16(); - hrf_left_e = tmp_e; - move16(); - v_sub_32( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); - *hrf_left_delta_e = tmp_e; - move16(); - - Word32 fac = L_deposit_h( div_s( 1, *intp_count ) ); - v_multc_fixed( hrf_left_delta, fac, hrf_left_delta, *filterlength ); - - tmp_e = s_max( *hrf_right_prev_e, hrf_right_e ); - FOR( Word16 i = 0; i < *filterlength; i++ ) + + test(); + IF( ( *intp_count > 0 ) && subframe_update_flag ) { - hrf_right[i] = L_shr( hrf_right[i], sub( tmp_e, hrf_right_e ) ); - hrf_right_prev[i] = L_shr( hrf_right_prev[i], sub( tmp_e, *hrf_right_prev_e ) ); + /* Set deltas for interpolation */ + Word16 tmp_e; + tmp_e = s_max( *hrf_left_prev_e, hrf_left_e ); + FOR( Word16 i = 0; i < *filterlength; i++ ) + { + hrf_left[i] = L_shr( hrf_left[i], sub( tmp_e, hrf_left_e ) ); + hrf_left_prev[i] = L_shr( hrf_left_prev[i], sub( tmp_e, *hrf_left_prev_e ) ); + } + *hrf_left_prev_e = tmp_e; + move16(); + hrf_left_e = tmp_e; + move16(); + v_sub_32( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); + *hrf_left_delta_e = tmp_e; + move16(); + + Word32 fac = L_deposit_h( div_s( 1, *intp_count ) ); + v_multc_fixed( hrf_left_delta, fac, hrf_left_delta, *filterlength ); + + tmp_e = s_max( *hrf_right_prev_e, hrf_right_e ); + FOR( Word16 i = 0; i < *filterlength; i++ ) + { + hrf_right[i] = L_shr( hrf_right[i], sub( tmp_e, hrf_right_e ) ); + hrf_right_prev[i] = L_shr( hrf_right_prev[i], sub( tmp_e, *hrf_right_prev_e ) ); + } + *hrf_right_prev_e = tmp_e; + move16(); + hrf_right_e = tmp_e; + move16(); + v_sub_32( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); + *hrf_right_delta_e = tmp_e; + move16(); + + v_multc_fixed( hrf_right_delta, fac, hrf_right_delta, *filterlength ); } - *hrf_right_prev_e = tmp_e; - move16(); - hrf_right_e = tmp_e; - move16(); - v_sub_32( hrf_right, hrf_right_prev, hrf_right_delta, *filterlength ); - *hrf_right_delta_e = tmp_e; - move16(); - - v_multc_fixed( hrf_right_delta, fac, hrf_right_delta, *filterlength ); -} -ELSE -{ - /* No interpolation, just set the new filters and reset deltas */ - Copy32( hrf_left, hrf_left_prev, *filterlength ); - *hrf_left_prev_e = hrf_left_e; - move16(); - Copy32( hrf_right, hrf_right_prev, *filterlength ); - *hrf_right_prev_e = hrf_right_e; - move16(); - set32_fx( hrf_left_delta, 0, *filterlength ); - set32_fx( hrf_right_delta, 0, *filterlength ); - *hrf_left_delta_e = 0; - move16(); - *hrf_right_delta_e = 0; - move16(); -} - -return; + ELSE + { + /* No interpolation, just set the new filters and reset deltas */ + Copy32( hrf_left, hrf_left_prev, *filterlength ); + *hrf_left_prev_e = hrf_left_e; + move16(); + Copy32( hrf_right, hrf_right_prev, *filterlength ); + *hrf_right_prev_e = hrf_right_e; + move16(); + set32_fx( hrf_left_delta, 0, *filterlength ); + set32_fx( hrf_right_delta, 0, *filterlength ); + *hrf_left_delta_e = 0; + move16(); + *hrf_right_delta_e = 0; + move16(); + } + + return; } #endif @@ -851,8 +846,7 @@ static void TDREND_SRC_SPATIAL_Init_fx( return; } -#endif - +#else static void TDREND_SRC_SPATIAL_Init( TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i/o: Source spatial parameters */ const TDREND_PosType_t PosType /* i : Relative/absolute position type */ @@ -912,7 +906,7 @@ static void TDREND_SRC_SPATIAL_Init( return; } - +#endif /*-------------------------------------------------------------------* * TDREND_SRC_SPATIAL_SetDirAtten() @@ -937,7 +931,7 @@ static void TDREND_SRC_SPATIAL_SetDirAtten_fx( move16(); return; } -#endif +#else static void TDREND_SRC_SPATIAL_SetDirAtten( TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i/o: Source spatial parameters */ const TDREND_DirAtten_t *DirAtten_p /* i : Directionality specification */ @@ -957,7 +951,7 @@ static void TDREND_SRC_SPATIAL_SetDirAtten( return; } - +#endif /*-------------------------------------------------------------------* * TDREND_SRC_SPATIAL_GetDirGain() @@ -966,6 +960,7 @@ static void TDREND_SRC_SPATIAL_SetDirAtten( --------------------------------------------------------------------*/ /*! r: Gain value */ +#ifndef IVAS_FLOAT_FIXED static float TDREND_SRC_SPATIAL_GetDirGain( const TDREND_DirAtten_t *DirAtten_p, /* i : Directional attenuation specification */ const float *Front_p, /* i : Front-pointing vector */ @@ -1009,8 +1004,7 @@ static float TDREND_SRC_SPATIAL_GetDirGain( return DirGain; } - -#ifdef IVAS_FLOAT_FIXED +#else static Word16 TDREND_SRC_SPATIAL_GetDirGain_fx( /* o : Directional Gain Output Q14 */ const TDREND_DirAtten_t *DirAtten_p, /* i : Directional attenuation specification */ const Word32 *Front_p_fx, /* i : Front-pointing vector */ @@ -1340,8 +1334,7 @@ void TDREND_SRC_Init_fx( move16(); return; } -#endif // IVAS_FLOAT_FIXED - +#else void TDREND_SRC_Init( TDREND_SRC_t *Src_p, /* i/o: Source to initialize */ const TDREND_PosType_t PosType /* i : Position type specifier */ @@ -1394,3 +1387,4 @@ void TDREND_SRC_Init( return; } +#endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index b4d9a1da1..6c96ade83 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1142,6 +1142,22 @@ void ivas_HRTF_CRend_binary_close( /*----------------------------------------------------------------------------------* * TD object renderer *----------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_td_binaural_renderer_unwrap_fx( + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ + const Word16 num_src, /* i : number of sources to render */ + const Word16 lfe_idx, /* i : LFE channel index */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientaton data handle */ + const Word16 ism_md_subframe_update, /* i : Number of subframes to delay ism metadata to sync with audio */ + Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis */ + const Word16 output_frame, /* i : output frame length */ + const Word16 num_subframes /* i : number of subframes to render */ +); +#endif ivas_error ivas_td_binaural_renderer_unwrap( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ @@ -1211,6 +1227,17 @@ ivas_error ivas_td_binaural_open_unwrap( int32_t *binaural_latency_ns /* i : Binauralization delay */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_td_binaural_open_ext_fx( + TDREND_WRAPPER *pTDRend, + const AUDIO_CONFIG inConfig, + RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ + LSSETUP_CUSTOM_STRUCT *customLsInput, + const int32_t output_Fs, + Word16 *SrcInd, + Word16 *num_src +); +#else ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, const AUDIO_CONFIG inConfig, @@ -1218,6 +1245,8 @@ ivas_error ivas_td_binaural_open_ext( LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t output_Fs ); +#endif + #ifdef IVAS_FLOAT_FIXED void ivas_td_binaural_close_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd /* i/o: TD binaural object renderer handle */ @@ -1245,12 +1274,14 @@ ivas_error TDREND_GetMix_fx( ); #endif +#ifndef IVAS_FLOAT_FIXED ivas_error TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ const IVAS_VECTOR3 *Pos /* i : Listener Position */ ); +#endif ivas_error TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ @@ -1353,13 +1384,13 @@ ivas_error TDREND_MIX_SRC_SetDirAtten_fx( const Word16 SrcInd, /* i : Source index */ const TDREND_DirAtten_t *DirAtten_p /* i : Directional attenuation specifier */ ); -#endif // IVAS_FLOAT_FIXED - +#else ivas_error TDREND_MIX_SRC_SetDirAtten( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const int16_t SrcInd, /* i : Source index */ const TDREND_DirAtten_t *DirAtten_p /* i : Directional attenuation specifier */ ); +#endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED ivas_error TDREND_MIX_SRC_SetPlayState( @@ -1514,6 +1545,7 @@ ivas_error TDREND_MIX_SetDistAttenModel( const TDREND_DistAttenModel_t DistAttenModel /* i : Distance attenuation model */ ); +#ifndef IVAS_FLOAT_FIXED void TDREND_MIX_LIST_SetPos( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const float *Pos_p /* i : Listener's position */ @@ -1524,6 +1556,7 @@ ivas_error TDREND_MIX_LIST_SetOrient( const float *FrontVec_p, /* i : Listener's orientation front vector */ const float *UpVec_p /* i : Listener's orientation up vector */ ); +#endif #ifdef IVAS_FLOAT_FIXED void TDREND_MIX_Dealloc_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd /* i/o: TD renderer handle */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 0824de2c3..f961f6dfc 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1680,14 +1680,6 @@ typedef struct typedef struct { int16_t PoseUpdated; - float Pos[3]; - float Front[3]; - float Up[3]; - float Right[3]; - - int16_t VelUpdated; - float Vel[3]; - #ifdef IVAS_FLOAT_FIXED Word32 Pos_fx[3]; Word16 Pos_q; @@ -1695,7 +1687,16 @@ typedef struct Word32 Up_fx[3]; Word32 Right_fx[3]; Word32 Vel_fx[3]; -#endif // IVAS_FLOAT_FIXED +#else + float Pos[3]; + float Front[3]; + float Up[3]; + float Right[3]; + float Vel[3]; +#endif// IVAS_FLOAT_FIXED + + int16_t VelUpdated; + } TDREND_MIX_Listener_t; /* HR filter */ @@ -1750,10 +1751,11 @@ typedef struct /* Directional attenuation */ typedef struct { +#ifndef IVAS_FLOAT_FIXED float ConeInnerAngle; float ConeOuterAngle; float ConeOuterGain; -#ifdef IVAS_FLOAT_FIXED +#else Word32 ConeInnerAngle_fx; // Q22 Word32 ConeOuterAngle_fx; // Q22 Word32 ConeOuterGain_fx; // Q30 @@ -1782,13 +1784,13 @@ typedef struct TDREND_SRC_REND_s Word16 SrcGainMax_p_fx[SPAT_BIN_MAX_INPUT_CHANNELS]; Word16 DirGain_p_fx[SPAT_BIN_MAX_INPUT_CHANNELS]; // Q14 Word16 DistGain_p_fx[SPAT_BIN_MAX_INPUT_CHANNELS]; // Q14 -#endif // IVAS_FLOAT_FIXED +#else // IVAS_FLOAT_FIXED float SrcGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; float SrcGainMin_p[SPAT_BIN_MAX_INPUT_CHANNELS]; float SrcGainMax_p[SPAT_BIN_MAX_INPUT_CHANNELS]; float DirGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; float DistGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - +#endif } TDREND_SRC_REND_t; /* Source spatial parameters */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c406220d3..dbb301be6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2280,11 +2280,45 @@ static ivas_error setRendInputActiveIsm( } else { - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#ifdef IVAS_FLOAT_FIXED + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; + IF( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) { return error; } + Word16 nchan_rend = num_src; + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) + { + IF( Src_p->SrcSpatial_p != NULL ) + { + FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) + { + fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); + fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); + } + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); + fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + } + } +#else + if ((error = ivas_td_binaural_open_ext(&inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate)) != IVAS_ERR_OK) + { + return error; + } +#endif + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_FLOAT_FIXED @@ -3707,10 +3741,44 @@ static ivas_error initMcBinauralRendering( if ( useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL ) { +#ifdef IVAS_FLOAT_FIXED + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; + IF( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + { + return error; + } + + Word16 nchan_rend = num_src; + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) + { + IF( Src_p->SrcSpatial_p != NULL ) + { + FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) + { + fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); + fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); + } + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); + fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + } + } +#else if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } +#endif if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { -- GitLab From 2caf64d22bb96e9c4e51adf26b448d1795506e68 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 13 May 2024 09:00:02 +0530 Subject: [PATCH 035/101] omasa_ana, masa_merge conversion and lib_rend.c cleanup [x] lib_rend.c float dependencies cleanup [x] Functions in ivas_omasa_ana.c converted to fixed point. [x] Functions in ivas_masa_merge.c converted to fixed point. [x] Few other miscellaneous cleanup --- lib_com/cnst.h | 2 +- lib_com/ivas_prot.h | 3 + lib_dec/ivas_dirac_dec.c | 8 - lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/jbm_pcmdsp_apa.c | 533 ++- lib_dec/jbm_pcmdsp_apa.h | 16 + lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 3 - lib_rend/ivas_masa_merge.c | 317 ++ lib_rend/ivas_mcmasa_ana.c | 97 +- lib_rend/ivas_objectRenderer.c | 21 +- lib_rend/ivas_omasa_ana.c | 703 ++- lib_rend/ivas_prot_rend.h | 45 +- lib_rend/ivas_rotation.c | 2 +- lib_rend/ivas_stat_rend.h | 35 + lib_rend/lib_rend.c | 4418 ++++++++++-------- 16 files changed, 4001 insertions(+), 2206 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 16ebf808c..9cf45d203 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -566,7 +566,7 @@ enum #define FRAMES_PER_SEC 50 #ifdef IVAS_FLOAT_FIXED -#define MAX_PARAM__SPATIAL_SUB_FRAMES_PER_SEC 200 //(FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) +#define MAX_PARAM_SPATIAL_SUB_FRAMES_PER_SEC 200 //(FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) #define ONE_BY_FRAMES_PER_SEC ((Word32)(0x028F5C29)) #define FRAMES_PER_SEC_BY_2 (FRAMES_PER_SEC >> 1) #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fce1edd5d..b8469c0f1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -6577,12 +6577,15 @@ void ivas_ism_render_sf( const int16_t n_samples_to_render /* i : output frame length per channel */ ); +#ifndef IVAS_FLOAT_FIXED void ivas_ism_get_stereo_gains( const float azimuth, /* i : object azimuth */ const float elevation, /* i : object elevation */ float *left_gain, /* o : left channel gain */ float *right_gain /* o : right channel gain */ ); +#endif + #ifdef IVAS_FLOAT_FIXED void ivas_mc2sba_fx( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 4923fa241..9a5e1e5a5 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -735,10 +735,6 @@ static ivas_error ivas_dirac_rend_config_fx( IF( ( EQ_16( flag_config, DIRAC_OPEN) && hDirACRend->proto_signal_decorr_on ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( hDirACRend->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { #ifdef IVAS_FLOAT_FIXED - FOR( int ii = 0; ii < st_ivas->hSpatParamRendCom->num_freq_bands; ii++ ) - { - hDirACRend->frequency_axis_fx[ii] = (Word16) hDirACRend->frequency_axis[ii]; - } IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, hDirACRend->synthesisConf, hDirACRend->frequency_axis_fx, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { @@ -763,10 +759,6 @@ static ivas_error ivas_dirac_rend_config_fx( /* close and reopen the decorrelator */ ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); #ifdef IVAS_FLOAT_FIXED - FOR( int ii = 0; ii < st_ivas->hSpatParamRendCom->num_freq_bands; ii++ ) - { - hDirACRend->frequency_axis_fx[ii] = (Word16) hDirACRend->frequency_axis[ii]; - } IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, hDirACRend->synthesisConf, hDirACRend->frequency_axis_fx, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 8d3ff8518..b27f665e3 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -385,7 +385,7 @@ ivas_error create_sce_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { - IF( ( error = openCldfb_ivas( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 1586051d6..f2dc98789 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -56,6 +56,9 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx2.h" #endif + +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED + /*---------------------------------------------------------------------* * Local state structure *---------------------------------------------------------------------*/ @@ -68,66 +71,72 @@ struct apa_state_t { Word16 signalScaleForCorrelation; Word16 frmInScaled[6 * 2 * 48000 / 50 * 2 ]; + /* output buffer */ bool evs_compat_mode; + float *buf_out; - uint16_t buf_out_capacity; - uint16_t l_buf_out; - Word16 win_incrementor; - const Word16 *win_fx; + Word16 *buf_out_fx; + UWord16 buf_out_capacity; + UWord16 l_buf_out; /* Hann window */ float win[APA_BUF_PER_CHANNEL]; - uint16_t l_halfwin; - Word16 l_halfwin_fx; + Word16 *win_fx; + //const Word16 *win_fx; + UWord16 l_halfwin; + + Word16 win_incrementor; /* sampling rate [Hz] */ - uint16_t rate; + UWord16 rate; /* length of a segment [samples] */ - uint16_t l_seg; + UWord16 l_seg; /* length of a frame [samples] */ - uint16_t l_frm; + UWord16 l_frm; /* total number of processed input samples since apa_reset() */ - uint32_t l_in_total; + UWord32 l_in_total; /* time resolution in samples of the IVAS renderer*/ - uint16_t l_ts; + UWord16 l_ts; /* samples already available in the renderer buffer */ - uint16_t l_r_buf; + UWord16 l_r_buf; /* sum of inserted/removed samples since last apa_set_scale() */ - int32_t diffSinceSetScale; + Word32 diffSinceSetScale; /* number of input frames since last apa_set_scale() */ - uint32_t nFramesSinceSetScale; + UWord32 nFramesSinceSetScale; /* current and previous scaling ratio [%] */ - uint16_t scale; + UWord16 scale; /* minimum pitch length [samples] */ - uint16_t p_min; + UWord16 p_min; /* search length [samples] */ - uint16_t l_search; + UWord16 l_search; - uint16_t wss; /* waveform subsampling per channel */ - uint16_t css; /* correlation subsampling per channel */ + UWord16 wss; /* waveform subsampling per channel */ + UWord16 css; /* correlation subsampling per channel */ float targetQuality; - uint16_t qualityred; /* quality reduction threshold */ - uint16_t qualityrise; /* quality rising for adaptive quality thresholds */ + Word32 targetQualityQ16; + UWord16 qualityred; /* quality reduction threshold */ + UWord16 qualityrise; /* quality rising for adaptive quality thresholds */ - uint16_t last_pitch; /* last pitch/sync position */ - uint16_t bad_frame_count; /* # frames before quality threshold is lowered */ - uint16_t good_frame_count; /* # scaled frames */ + UWord16 last_pitch; /* last pitch/sync position */ + UWord16 bad_frame_count; /* # frames before quality threshold is lowered */ + UWord16 good_frame_count; /* # scaled frames */ - uint16_t num_channels; /* number of input/output channels */ + UWord16 num_channels; /* number of input/output channels */ }; + /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ @@ -158,11 +167,78 @@ static bool shrink_frm( apa_state_t *ps, const float frm_in[], uint16_t maxScali static bool extend_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); +static Word16 find_synch_fx( apa_state_t *ps, + const Word16 *in, + Word16 l_in, + Word16 s_start, + Word16 s_len, + Word16 fixed_pos, + Word16 corr_len, + Word16 offset, + Word16 *energydBQ8, + Word32 *qualityQ16, + Word16 *synch_pos ); + +static Word16 norm(float num); + + +static Word16 norm(float num) { + if( ( Word16 ) num == 0 ) { + return 15; + } + else + return norm_s(( Word16 ) num); +} + + /*---------------------------------------------------------------------* * Public functions *---------------------------------------------------------------------*/ /* Allocates memory for state struct and initializes elements. */ +#ifdef IVAS_FLOAT_FIXED +ivas_error apa_init( + apa_state_t **pps, + const Word32 num_channels ) +{ + apa_state_t *ps = NULL; + + /* make sure pointer is valid */ + IF ( !pps ) + { + return 1; + } + + /* allocate state struct */ + IF ( ( ps = (apa_state_t *) malloc( sizeof( apa_state_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } + + ps->num_channels = (UWord16) num_channels; + move16(); + ps->buf_out_capacity = (UWord16) ( APA_BUF_PER_CHANNEL * num_channels ); + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + IF ( ( ps->buf_out = malloc( sizeof( float ) * ps->buf_out_capacity ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } +#endif + + IF ( ( ps->buf_out_fx = malloc( sizeof( Word16 ) * ps->buf_out_capacity ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } + + ps->evs_compat_mode = false; + + apa_reset( ps ); + *pps = ps; + + return IVAS_ERR_OK; +} +#else ivas_error apa_init( apa_state_t **pps, const int32_t num_channels ) @@ -196,8 +272,65 @@ ivas_error apa_init( return IVAS_ERR_OK; } +#endif + /* Sets state variables to initial value. */ +#ifdef IVAS_FLOAT_FIXED +void apa_reset( + apa_state_t *ps ) +{ + /* init state struct */ + ps->signalScaleForCorrelation = 0; + move16(); + ps->l_buf_out = 0; + move16(); + ps->l_halfwin = 0; + move16(); + ps->rate = 0; + move16(); + ps->l_seg = 0; + move16(); + ps->l_frm = 0; + move16(); + ps->l_in_total = 0; + move32(); + ps->diffSinceSetScale = 0; + move32(); + ps->nFramesSinceSetScale = 0; + move32(); + ps->scale = 100; + move32(); + ps->p_min = 0; + move16(); + ps->l_search = 0; + move16(); + ps->wss = 1; + move16(); + ps->css = 1; + move16(); + ps->targetQuality = 0.0f; + ps->targetQualityQ16 = 0; + move32(); + + ps->qualityred = 0; + move16(); + ps->qualityrise = 0; + move16(); + ps->last_pitch = 0; + move16(); + ps->bad_frame_count = 0; + move16(); + ps->good_frame_count = 0; + move16(); + + ps->l_ts = 1; + move16(); + ps->l_r_buf = 0; + move16(); + return; +} +#else void apa_reset( apa_state_t *ps ) { @@ -229,6 +362,7 @@ void apa_reset( ps->l_r_buf = 0; return; } +#endif uint8_t apa_reconfigure( apa_state_t *ps, @@ -241,7 +375,8 @@ uint8_t apa_reconfigure( ps->num_channels = (uint16_t) num_channels; ps->buf_out_capacity = (uint16_t) ( APA_BUF_PER_CHANNEL * num_channels ); ps->buf_out = (float *) malloc( sizeof( float ) * ps->buf_out_capacity ); - if ( !ps->buf_out ) + ps->buf_out_fx = (Word16 *)malloc(sizeof(float) * ps->buf_out_capacity); + if ( !ps->buf_out || !ps->buf_out_fx ) { return 2; } @@ -341,7 +476,7 @@ bool apa_set_rate( #ifdef IVAS_FLOAT_FIXED ps->win_fx = pcmdsp_window_hann_640; move16(); - ps->l_halfwin_fx = 320; + ps->l_halfwin = 320; move16(); ps->win_incrementor = 1; move16(); @@ -349,14 +484,14 @@ bool apa_set_rate( { ps->win_fx = pcmdsp_window_hann_960; move16(); - ps->l_halfwin_fx = 480; + ps->l_halfwin = 480; move16(); } IF( EQ_32( ps->rate, 24000 ) ) { ps->win_fx = pcmdsp_window_hann_960; move16(); - ps->l_halfwin_fx = 480; + ps->l_halfwin = 480; move16(); ps->win_incrementor = 2; move16(); @@ -382,6 +517,43 @@ bool apa_set_rate( /* Set scaling. */ +#ifdef IVAS_FLOAT_FIXED +bool apa_set_scale( + apa_state_t *ps, + UWord16 scale ) +{ + /* make sure pointer is valid */ + IF ( ps == NULL ) + { + return 1; + } + + /* check range */ + IF ( ( LT_32( (Word32) scale, APA_MIN_SCALE ) ) || GT_32( (Word32) scale, APA_MAX_SCALE ) ) + { + return 1; + } + + /* do nothing if same scale is set multiple times */ + /* (otherwise scale control is confused) */ + IF ( EQ_32( (Word32 ) ps->scale, ( Word32 ) scale ) ) + { + return 0; + } + + /* copy to state struct */ + ps->scale = scale; + move16(); + + /* reset scaling statistics */ + ps->diffSinceSetScale = 0; + move32(); + ps->nFramesSinceSetScale = 0; + move32(); + + return 0; +} +#else bool apa_set_scale( apa_state_t *ps, uint16_t scale ) @@ -414,7 +586,25 @@ bool apa_set_scale( return 0; } +#endif +#ifdef IVAS_FLOAT_FIXED +bool apa_set_renderer_granularity( + apa_state_t *ps, + UWord16 l_ts ) +{ + /* make sure pointer is valid */ + IF ( ps == NULL ) + { + return 1; + } + + + /* copy to state struct */ + ps->l_ts = l_ts * ps->num_channels; + return 0; +} +#else bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts ) @@ -430,7 +620,25 @@ bool apa_set_renderer_granularity( ps->l_ts = l_ts * ps->num_channels; return 0; } +#endif +#ifdef IVAS_FLOAT_FIXED +bool apa_set_renderer_residual_samples( + apa_state_t *ps, + UWord16 l_r_buf ) +{ + /* make sure pointer is valid */ + IF ( ps == NULL ) + { + return 1; + } + + + /* copy to state struct */ + ps->l_r_buf = l_r_buf * ps->num_channels; + return 0; +} +#else bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf ) @@ -446,7 +654,24 @@ bool apa_set_renderer_residual_samples( ps->l_r_buf = l_r_buf * ps->num_channels; return 0; } +#endif +#ifdef IVAS_FLOAT_FIXED +bool apa_set_evs_compat_mode( + apa_state_t *ps, + bool mode ) +{ + /* make sure pointer is valid */ + IF ( ps == NULL ) + { + return 1; + } + + ps->evs_compat_mode = mode; + + return 0; +} +#else bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode ) @@ -462,6 +687,8 @@ bool apa_set_evs_compat_mode( return 0; } +#endif + /* ******************************************************************************** * @@ -520,6 +747,36 @@ bool apa_set_quality( * ******************************************************************************** */ +#ifdef IVAS_FLOAT_FIXED +bool apa_set_complexity_options( + apa_state_t *ps, + UWord16 wss, + UWord16 css ) +{ + /* make sure pointer is valid */ + IF ( ps == NULL ) + { + return 1; + } + + IF ( wss == 0 || wss > 1000 ) + { + return 1; + } + + IF ( css == 0 || css > 1000 ) + { + return 1; + } + + ps->wss = wss; + move16(); + ps->css = css; + move16(); + + return 0; +} +#else bool apa_set_complexity_options( apa_state_t *ps, uint16_t wss, @@ -546,6 +803,7 @@ bool apa_set_complexity_options( return 0; } +#endif /* ******************************************************************************** @@ -848,6 +1106,7 @@ static void get_scaling_quality( offset = 0; pitch_cn = normalized_cross_correlation_self( signal, pitch + offset, offset, corr_len, ps->num_channels * 2, &pitch_energy ); + if ( pitch_cn > 0.0f ) { /* calculate correlation for double pitch */ @@ -912,123 +1171,125 @@ static void get_scaling_quality( static void get_scaling_quality_fx(const apa_state_t * ps, - const Word16 * signal, - Word16 s_len, - Word16 offset, - Word16 corr_len, - Word16 pitch, - Word16 * energydBQ8, - Word32 * qualityQ16) + const Word16 * signal, + Word16 s_len, + Word16 offset, + Word16 corr_len, + Word16 pitch, + Word16 * energydBQ8, + Word32 * qualityQ16) { - Word32 energy, maxEnergy; - Word32 qualityOfMaxEnergy; /* we measure the quality for all channels and select the one with highest energy */ - Word16 half_pitch_cn; - Word16 pitch_cn; - Word16 three_halves_pitch_cn; - Word16 double_pitch_cn; - Word32 pitch_energy; - Word32 half_pitch_energy; - Word32 three_halves_pitch_energy; - Word32 double_pitch_energy; - Word16 i; + Word32 energy, maxEnergy; + Word32 qualityOfMaxEnergy; /* we measure the quality for all channels and select the one with highest energy */ + Word16 half_pitch_cn; + Word16 pitch_cn; + Word16 three_halves_pitch_cn; + Word16 double_pitch_cn; + Word32 pitch_energy; + Word32 half_pitch_energy; + Word32 three_halves_pitch_energy; + Word32 double_pitch_energy; + Word16 i; - maxEnergy = L_deposit_l(0); - qualityOfMaxEnergy = L_deposit_l(0); + maxEnergy = L_deposit_l(0); + qualityOfMaxEnergy = L_deposit_l(0); - FOR(i = 0; i < ps->num_channels; i++) - { - offset = 0; - move16(); + FOR(i = 0; i < ps->num_channels; i++) + { + offset = 0; + move16(); - pitch_cn = normalized_cross_correlation_self_fx(signal, add(pitch, offset), offset, corr_len, - shl(ps->num_channels, 1), &pitch_energy); - IF(pitch_cn > 0) - { - /* calculate correlation for double pitch */ - IF(LE_16(add(add(shl(pitch, 1), offset), corr_len), s_len)) - { - double_pitch_cn = normalized_cross_correlation_self_fx(signal, add(shl(pitch, 1), offset), - offset, corr_len, shl(ps->num_channels, 1), &double_pitch_energy); - } - ELSE - { - double_pitch_cn = pitch_cn; - move16(); - double_pitch_energy = L_add(pitch_energy, 0); - } - /* calculate correlation for three/half pitch */ - IF(LE_16(add(add(shr(i_mult2(pitch, 3), 1), offset), corr_len), s_len)) - { - three_halves_pitch_cn = normalized_cross_correlation_self_fx(signal, add(shr(i_mult2(pitch, 3), 1), - offset), offset, corr_len, shl(ps->num_channels, 1), &three_halves_pitch_energy); - } - ELSE - { - three_halves_pitch_cn = pitch_cn; - move16(); - three_halves_pitch_energy = L_add(pitch_energy, 0); - } - /* calculate correlation for half pitch */ - IF(LE_16(add(add(shr(pitch, 1), offset), corr_len), s_len)) - { - half_pitch_cn = normalized_cross_correlation_self_fx(signal, add(shr(pitch, 1), offset), - offset, corr_len, shl(ps->num_channels, 1), &half_pitch_energy); - } - ELSE - { - half_pitch_cn = pitch_cn; - move16(); - half_pitch_energy = L_add(pitch_energy, 0); - } + pitch_cn = normalized_cross_correlation_self_fx(signal, add(pitch, offset), offset, corr_len, + shl(ps->num_channels, 1), &pitch_energy); + IF(pitch_cn > 0) + { + /* calculate correlation for double pitch */ + IF(LE_16(add(add(shl(pitch, 1), offset), corr_len), s_len)) + { + double_pitch_cn = normalized_cross_correlation_self_fx(signal, add(shl(pitch, 1), offset), + offset, corr_len, shl(ps->num_channels, 1), &double_pitch_energy); + } + ELSE + { + double_pitch_cn = pitch_cn; + move16(); + double_pitch_energy = L_add(pitch_energy, 0); + } + /* calculate correlation for three/half pitch */ + IF(LE_16(add(add(shr(i_mult2(pitch, 3), 1), offset), corr_len), s_len)) + { + three_halves_pitch_cn = normalized_cross_correlation_self_fx(signal, add(shr(i_mult2(pitch, 3), 1), + offset), offset, corr_len, shl(ps->num_channels, 1), &three_halves_pitch_energy); + } + ELSE + { + three_halves_pitch_cn = pitch_cn; + move16(); + three_halves_pitch_energy = L_add(pitch_energy, 0); + } + /* calculate correlation for half pitch */ + IF(LE_16(add(add(shr(pitch, 1), offset), corr_len), s_len)) + { + half_pitch_cn = normalized_cross_correlation_self_fx(signal, add(shr(pitch, 1), offset), + offset, corr_len, shl(ps->num_channels, 1), &half_pitch_energy); + } + ELSE + { + half_pitch_cn = pitch_cn; + move16(); + half_pitch_energy = L_add(pitch_energy, 0); + } - /* combine correlation results: Q15.16 */ - *qualityQ16 = L_shr(L_mac0(L_mult0(half_pitch_cn, three_halves_pitch_cn), - pitch_cn, double_pitch_cn), 14); - BASOP_SATURATE_WARNING_OFF_EVS - energy = L_add(L_add(L_add(pitch_energy, half_pitch_energy), three_halves_pitch_energy), double_pitch_energy); - BASOP_SATURATE_WARNING_ON_EVS - } - ELSE - { - *qualityQ16 = L_shl(L_deposit_l(pitch_cn), 1); /* value is negative, thus pass it */ - energy = L_add(pitch_energy, 0); - } + /* combine correlation results: Q15.16 */ + *qualityQ16 = L_shr(L_mac0(L_mult0(half_pitch_cn, three_halves_pitch_cn), + pitch_cn, double_pitch_cn), 14); + BASOP_SATURATE_WARNING_OFF_EVS + energy = L_add(L_add(L_add(pitch_energy, half_pitch_energy), three_halves_pitch_energy), double_pitch_energy); + BASOP_SATURATE_WARNING_ON_EVS + } + ELSE + { + *qualityQ16 = L_shl(L_deposit_l(pitch_cn), 1); /* value is negative, thus pass it */ + energy = L_add(pitch_energy, 0); + } - /* update the quality by the quality of the signal with the highest energy */ - IF(GT_32(energy, maxEnergy)) - { - qualityOfMaxEnergy = L_add(*qualityQ16, 0); - maxEnergy = L_add(energy, 0); - } + /* update the quality by the quality of the signal with the highest energy */ + IF(GT_32(energy, maxEnergy)) + { + qualityOfMaxEnergy = L_add(*qualityQ16, 0); + maxEnergy = L_add(energy, 0); + } - /* go to next channel */ - ++signal; - } - *qualityQ16 = qualityOfMaxEnergy; - move32(); + /* go to next channel */ + ++signal; + } + *qualityQ16 = qualityOfMaxEnergy; + move32(); - /* increase calculated quality of signals with low energy */ - *energydBQ8 = apa_corrEnergy2dB_fx(maxEnergy, shl(ps->signalScaleForCorrelation, 1), corr_len); - *qualityQ16 = L_add(*qualityQ16, L_shl(L_deposit_l(apa_getQualityIncreaseForLowEnergy_fx(*energydBQ8)), 8)); + /* increase calculated quality of signals with low energy */ + *energydBQ8 = apa_corrEnergy2dB_fx(maxEnergy, shl(ps->signalScaleForCorrelation, 1), corr_len); + *qualityQ16 = L_add(*qualityQ16, L_shl(L_deposit_l(apa_getQualityIncreaseForLowEnergy_fx(*energydBQ8)), 8)); } - Word16 apa_corrEnergy2dB_fx(Word32 energy, Word16 energyExp, Word16 corr_len) - { - Word16 result, tmpScale; +Word16 apa_corrEnergy2dB_fx(Word32 energy, Word16 energyExp, Word16 corr_len) +{ - /* normalise before dividing */ - tmpScale = norm_l(energy); - energy = L_shl(energy, tmpScale); - energyExp = sub(energyExp, tmpScale); + Word16 result, tmpScale; - /* divide energy by corr_len */ - result = BASOP_Util_Divide3216_Scale(energy, corr_len, &tmpScale); - energyExp = add(energyExp, tmpScale); + /* normalise before dividing */ + tmpScale = norm_l(energy); + energy = L_shl(energy, tmpScale); + energyExp = sub(energyExp, tmpScale); + + /* divide energy by corr_len */ + result = BASOP_Util_Divide3216_Scale(energy, corr_len, &tmpScale); + energyExp = add(energyExp, tmpScale); + + result = BASOP_Util_lin2dB(L_deposit_l(result), energyExp, 1); + return result; +} - result = BASOP_Util_lin2dB(L_deposit_l(result), energyExp, 1); - return result; - } /* Converts the correlation energy to dB. */ static float apa_corrEnergy2dB( float energy, @@ -1601,11 +1862,11 @@ static bool shrink_frm( IF ( ps->evs_compat_mode == true ) { //overlapAddEvs_fx( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ); - overlapAdd( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx , ps->win_incrementor); + overlapAdd( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin, ps->win_fx , ps->win_incrementor); } ELSE { - overlapAdd( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx , ps->win_incrementor); + overlapAdd( frm_in_fx, frm_in_fx + xtract, frm_out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin, ps->win_fx , ps->win_incrementor); } for ( i = 0; i < l_seg; i++ ) frm_out[i] = (float)frm_out_fx[i]; @@ -2018,11 +2279,11 @@ static bool extend_frm( IF ( ps->evs_compat_mode == true ) { //overlapAddEvs_fx( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ); - overlapAdd( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ,ps->win_incrementor); + overlapAdd( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin, ps->win_fx ,ps->win_incrementor); } ELSE { - overlapAdd( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin_fx, ps->win_fx ,ps->win_incrementor); + overlapAdd( fadeOut_fx, fadeIn_fx, out_fx, l_seg, ps->num_channels, ps->win_fx + ps->l_halfwin, ps->win_fx ,ps->win_incrementor); } for ( i = 0; i < l_seg; i++ ) out[i] = (float) out_fx[i]; diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index ca7a5b290..cb3a2fc5b 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -112,17 +112,33 @@ bool apa_set_rate( apa_state_t *ps, const int32_t output_Fs ); * The scale is given in % and will be valid until changed again. * Must be in range [APA_MIN_SCALE,APA_MAX_SCALE]. * @return 0 on success, 1 on failure */ +#ifdef IVAS_FLOAT_FIXED +bool apa_set_scale( apa_state_t *s, UWord16 scale ); +#else bool apa_set_scale( apa_state_t *s, uint16_t scale ); +#endif +#ifdef IVAS_FLOAT_FIXED +bool apa_set_renderer_granularity( apa_state_t *ps, UWord16 l_ts ); +#else bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts ); +#endif +#ifdef IVAS_FLOAT_FIXED +bool apa_set_renderer_residual_samples( apa_state_t *ps, UWord16 l_r_buf ); +#else bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf ); +#endif bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode ); uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, uint16_t l_ts ); +#ifdef IVAS_FLOAT_FIXED +bool apa_set_complexity_options( apa_state_t *s, UWord16 wss, UWord16 css ); +#else bool apa_set_complexity_options( apa_state_t *s, uint16_t wss, uint16_t css ); +#endif bool apa_set_quality( apa_state_t *s, float quality, uint16_t qualityred, uint16_t qualityrise ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index cbc7f732b..a36599cf0 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1185,7 +1185,7 @@ static void ivas_dirac_dec_binaural_internal( IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] ) FOR( Word16 ind = 0; ind < FFTCLDFBLEN; ind++ ) { - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32) ( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * ( 1 << ( 31 - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32) ( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * ( 1LL << ( 31 - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); } Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME] = { 0 }; FOR( Word16 ind = 0; ind < 6; ind++ ) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 9cad5d1ff..25f5b5c26 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -379,9 +379,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } Copy(temp_alpha_synthesis_fx, dirac_output_synthesis_params->alpha_synthesis_fx, dirac_output_synthesis_params->numAlphas); - for (int k = 1; k < hSpatParamRendCom->num_freq_bands; k++) { - hDirACRend->frequency_axis_fx[k] = float_to_fix16(hDirACRend->frequency_axis[k], 0); - } computeAlphaSynthesis_fx( temp_alpha_synthesis_fx, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST_Q15, &dirac_output_synthesis_params->numAlphasFast, hSpatParamRendCom->slot_size, hSpatParamRendCom->num_freq_bands , hDirACRend->frequency_axis_fx, output_Fs); for (int k = 0; k < hSpatParamRendCom->num_freq_bands; k++) { temp_alpha_synthesis[k] = fix16_to_float(temp_alpha_synthesis_fx[k], 15); diff --git a/lib_rend/ivas_masa_merge.c b/lib_rend/ivas_masa_merge.c index b6b9ce3a0..527e19bbd 100644 --- a/lib_rend/ivas_masa_merge.c +++ b/lib_rend/ivas_masa_merge.c @@ -38,6 +38,10 @@ #include "ivas_cnst.h" #include "prot.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "prot_fx2.h" +#include "ivas_prot_fx.h" +#endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* @@ -46,10 +50,16 @@ static void copy_masa_meta_tile( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, const uint8_t sf, const uint8_t band ); +#ifdef IVAS_FLOAT_FIXED +static void full_stream_merge_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, Word32 inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne1_e, MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, Word32 inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne2_e ); + +static void diffuse_meta_merge_1x1_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, Word32 inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne1_e, MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, Word32 inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne2_e); +#else static void full_stream_merge( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); static void diffuse_meta_merge_1x1( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, float inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, float inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); +#endif /*---------------------------------------------------------------------* * copy_masa_meta_tile() @@ -197,6 +207,125 @@ void diffuse_meta_merge_1x1( } +#ifdef IVAS_FLOAT_FIXED +void diffuse_meta_merge_1x1_fx( + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i : Input metadata 1 */ + Word32 inEne_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 1 */ + Word16 *inEne_e, /* i : TF-energy of input 1 */ + MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, /* i : Input metadata 2 */ + Word32 inEneISM_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 2 */ + Word16 *inEneISM_e /* i : TF-energy of input 2 */ +) +{ + Word8 sf, band; + Word16 i,j, max_e, in1_e[MASA_FREQUENCY_BANDS]; + + FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + + FOR ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + Word32 energyTimesRatio_fx, energyTimesRatioISM_fx, total_diff_nrg_fx, dir_nrg_ratio_fx, total_nrg_fx; + Word32 dir_ratio_ism_fx, L_tmp1,L_tmp2; + Word16 scale, energyTimesRatio_e, tmp, total_nrg_e, total_diff_nrg_e, dir_ratio_ism_e, energyTimesRatioISM_e, dir_nrg_ratio_e ; + + tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16) UINT8_MAX, &scale); + energyTimesRatio_fx = Mpy_32_16_r( inEne_fx[sf][band], tmp); + energyTimesRatio_e = inEne_e[sf] + scale; + + /* target is original MASA diffuseness */ + tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16)UINT8_MAX, &scale); + total_diff_nrg_fx = Mpy_32_16_r(inEne_fx[sf][band], tmp); + total_diff_nrg_e = inEne_e[sf] + scale; + + /* criterion is mean of ISM ratio and new ratio */ + dir_ratio_ism_fx = L_deposit_h( BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16)UINT8_MAX, &dir_ratio_ism_e) ); + tmp = BASOP_Util_Divide3232_Scale(total_diff_nrg_fx, L_add(total_nrg_fx, EPSILON_FX), &scale); + L_tmp1 = L_deposit_h(tmp); + scale = scale + (total_diff_nrg_e - total_nrg_e); + L_tmp2 = L_sub(L_shl(1, scale), L_tmp1); + + L_tmp1 = BASOP_Util_Add_Mant32Exp(dir_ratio_ism_fx, dir_ratio_ism_e, L_tmp2, scale, &tmp); + L_tmp1 = L_shr(L_tmp1, 1); + energyTimesRatioISM_fx = Mpy_32_32(L_tmp1, inEneISM_fx[sf][band]); + energyTimesRatioISM_e = tmp + inEneISM_e[sf]; + + IF ( (BASOP_Util_Cmp_Mant32Exp( energyTimesRatioISM_fx, energyTimesRatioISM_e, energyTimesRatio_fx, energyTimesRatio_e ) > 1 ) ) + { + Word32 new_dir_ratio_fx, new_diff_ratio_fx; + Word16 new_dir_ratio_e; + outMeta->directionIndex[0][sf][band] = inMetaISM->directionIndex[0][sf][band]; + outMeta->directToTotalRatio[0][sf][band] = inMetaISM->directToTotalRatio[0][sf][band]; + outMeta->spreadCoherence[0][sf][band] = inMetaISM->spreadCoherence[0][sf][band]; + + outMeta->surroundCoherence[sf][band] = inMetaISM->surroundCoherence[sf][band]; + + tmp = BASOP_Util_Divide3232_Scale(total_diff_nrg_fx, L_add(EPSILON_FX, total_nrg_fx), &scale); + scale = scale + (total_diff_nrg_e - total_nrg_e); + dir_nrg_ratio_fx = L_sub(L_shl(1, scale), L_deposit_h(tmp)); + dir_nrg_ratio_e = scale; + + new_dir_ratio_fx = dir_nrg_ratio_fx; + new_dir_ratio_e = dir_nrg_ratio_e; + tmp = BASOP_Util_Cmp_Mant32Exp(dir_nrg_ratio_fx, dir_nrg_ratio_e, dir_ratio_ism_fx, dir_ratio_ism_e); + IF (tmp <= 0) + { + new_dir_ratio_fx = dir_nrg_ratio_fx; + new_dir_ratio_e = dir_nrg_ratio_e; + } + + outMeta->directToTotalRatio[0][sf][band] = (uint8_t) ( L_shr( new_dir_ratio_fx, 31 - new_dir_ratio_e ) * UINT8_MAX ); + new_diff_ratio_fx = L_shl( 1, 31 - new_dir_ratio_e ) - new_dir_ratio_fx; + outMeta->diffuseToTotalRatio[sf][band] = (uint8_t) floorf( L_shr( new_diff_ratio_fx, new_dir_ratio_e) * UINT8_MAX ); + } + ELSE + { + /* use the plain original meta for this tile */ + outMeta->directionIndex[0][sf][band] = inMeta->directionIndex[0][sf][band]; + outMeta->directToTotalRatio[0][sf][band] = inMeta->directToTotalRatio[0][sf][band]; + outMeta->spreadCoherence[0][sf][band] = inMeta->spreadCoherence[0][sf][band]; + + outMeta->surroundCoherence[sf][band] = inMeta->surroundCoherence[sf][band]; + outMeta->diffuseToTotalRatio[sf][band] = inMeta->diffuseToTotalRatio[sf][band]; + } + outMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; + outMeta->directToTotalRatio[1][sf][band] = 0u; + outMeta->spreadCoherence[1][sf][band] = 0u; + + inEne_fx[sf][band] = BASOP_Util_Add_Mant32Exp(inEne_fx[sf][band], inEne_e[sf], inEneISM_fx[sf][band], inEneISM_e[sf], &in1_e[band]); /* Update energy for subsequent mergings */ + } + + max_e = in1_e[0]; + FOR(Word16 i = 1; i < MASA_FREQUENCY_BANDS; i++) + { + IF(max_e < in1_e[i]) + max_e = in1_e[i]; + } + + FOR(Word16 i = 0; i < MASA_FREQUENCY_BANDS; i++) + { + inEne_fx[sf][i] = L_shr(inEne_fx[sf][i], max_e - in1_e[i]); + } + + inEne_e[sf] = max_e; + + } + + /* Set descriptive meta for mixed format */ + outMeta->descriptiveMeta.sourceFormat = 0u; + outMeta->descriptiveMeta.transportDefinition = 0u; + outMeta->descriptiveMeta.channelAngle = 0u; + outMeta->descriptiveMeta.channelDistance = 0u; + outMeta->descriptiveMeta.channelLayout = 0u; + outMeta->descriptiveMeta.numberOfDirections = 0u; + /* Number of transports should be set outside. */ + + return; +} + +#endif + /*---------------------------------------------------------------------* * full_stream_merge() * @@ -268,6 +397,107 @@ void full_stream_merge( return; } +#ifdef IVAS_FLOAT_FIXED +void full_stream_merge_fx( + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ + Word32 inEne1_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ + Word16 *inEne1_e, + MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i : Input metadata 2 */ + Word32 inEne2_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 2 */ + Word16 *inEne2_e +) +{ + uint8_t n_dirs_1, n_dirs_2; + uint8_t sf, band; + Word16 scale, tmp, dir_nrg_1_e = 0, dir_nrg_2_e = 0, max_e; + Word16 in1_e[MASA_FREQUENCY_BANDS]; + Word32 dir_nrg_1_fx, dir_nrg_2_fx, L_tmp; + + /* full stream select based on total direct energy */ + n_dirs_1 = inMeta1->descriptiveMeta.numberOfDirections + 1u; /* to 1-based */ + n_dirs_2 = inMeta2->descriptiveMeta.numberOfDirections + 1u; + + FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + FOR ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta1->directToTotalRatio[0][sf][band], (Word16)UINT8_MAX, &scale); + dir_nrg_1_fx = Mpy_32_32(L_deposit_h(tmp), inEne1_fx[sf][band]); + dir_nrg_1_e = scale + inEne1_e[sf]; + + + tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta1->directToTotalRatio[0][sf][band], (Word16)UINT8_MAX, &scale); + dir_nrg_2_fx = Mpy_32_32(L_deposit_h(tmp), inEne2_fx[sf][band]); + dir_nrg_2_e = scale + inEne2_e[sf]; + + + IF ( n_dirs_1 == 2 ) + { + + tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta1->directToTotalRatio[1][sf][band], (Word16)UINT8_MAX, &scale); + L_tmp = Mpy_32_32(L_deposit_h(tmp), inEne1_fx[sf][band]); + scale = scale + inEne1_e[sf]; + dir_nrg_1_fx = BASOP_Util_Add_Mant32Exp(L_tmp, scale, dir_nrg_1_fx, dir_nrg_1_e, &dir_nrg_1_e); + } + + IF ( n_dirs_2 == 2 ) + { + tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta2->directToTotalRatio[1][sf][band], (Word16)UINT8_MAX, &scale); + L_tmp = Mpy_32_32(L_deposit_h(tmp), inEne2_fx[sf][band]); + scale = scale + inEne2_e[sf]; + dir_nrg_2_fx = BASOP_Util_Add_Mant32Exp(L_tmp, scale, dir_nrg_2_fx, dir_nrg_2_e, &dir_nrg_2_e); + } + + IF (BASOP_Util_Cmp_Mant32Exp( dir_nrg_1_fx, dir_nrg_1_e, dir_nrg_2_fx, dir_nrg_2_e ) > 1 ) + { + copy_masa_meta_tile( outMeta, inMeta1, sf, band ); + } + ELSE + { + copy_masa_meta_tile( outMeta, inMeta2, sf, band ); + } + + inEne1_fx[sf][band] = BASOP_Util_Add_Mant32Exp(inEne1_fx[sf][band], inEne1_e[sf], inEne2_fx[sf][band], inEne2_e[sf], &in1_e[band]); + } + + max_e = in1_e[0]; + FOR (Word16 i = 1; i < MASA_FREQUENCY_BANDS; i++) + { + IF (max_e < in1_e[i]) + max_e = in1_e[i]; + } + + FOR (Word16 i = 0; i < MASA_FREQUENCY_BANDS; i++) + { + inEne1_fx[sf][i] = L_shr(inEne1_fx[sf][i], max_e - in1_e[i]); + } + + inEne1_e[sf] = max_e; + + } + + /* Set descriptive meta for mixed format */ + outMeta->descriptiveMeta.sourceFormat = 0u; + outMeta->descriptiveMeta.transportDefinition = 0u; + outMeta->descriptiveMeta.channelAngle = 0u; + outMeta->descriptiveMeta.channelDistance = 0u; + outMeta->descriptiveMeta.channelLayout = 0u; + IF ( n_dirs_1 == 2 || n_dirs_2 == 2 ) + { + outMeta->descriptiveMeta.numberOfDirections = 1u; + } + ELSE + { + outMeta->descriptiveMeta.numberOfDirections = 0u; + } + + /* Number of transports should be set outside. */ + + return; +} + +#endif /*---------------------------------------------------------------------* * ivas_prerend_merge_masa_metadata() @@ -304,6 +534,40 @@ void ivas_prerend_merge_masa_metadata( return; } +#ifdef IVAS_FLOAT_FIXED +void ivas_prerend_merge_masa_metadata_fx( + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ + IVAS_REND_AudioConfigType inType1, /* i : Type of input 1 */ + Word32 inEne1_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ + Word16 *inEne1_e, + MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i : Input metadata 2 */ + IVAS_REND_AudioConfigType inType2, /* i : Type of input 2 */ + Word32 inEne2_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 2 */ + Word16 *inEne2_e /* i : TF-energy of input 2 */ +) +{ + /* mixing ISMs with non-ISM use different merge */ + IF ( inType1 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && inType2 != IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && ( inMeta1->descriptiveMeta.numberOfDirections == 0u && inMeta2->descriptiveMeta.numberOfDirections == 0u ) ) + { + /* meta_1 is ISM and both are 1dir */ + diffuse_meta_merge_1x1_fx( outMeta, inMeta2, inEne2_fx, inEne2_e, inMeta1, inEne1_fx, inEne1_e ); + } + ELSE IF ( inType2 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && inType1 != IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && ( inMeta1->descriptiveMeta.numberOfDirections == 0u && inMeta2->descriptiveMeta.numberOfDirections == 0u ) ) + { + /* meta_2 is ISM and both are 1dir */ + diffuse_meta_merge_1x1_fx( outMeta, inMeta1, inEne1_fx, inEne1_e, inMeta2, inEne2_fx, inEne2_e ); + } + ELSE + { + + full_stream_merge_fx( outMeta, inMeta1, inEne1_fx, inEne1_e, inMeta2, inEne2_fx, inEne2_e ); + } + + return; +} + +#endif /*---------------------------------------------------------------------* * masaPrerendOpen() @@ -311,6 +575,7 @@ void ivas_prerend_merge_masa_metadata( * *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error masaPrerendOpen( MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ int16_t numTransports, /* i : number of transport channels */ @@ -361,6 +626,58 @@ ivas_error masaPrerendOpen( return error; } +#else +ivas_error masaPrerendOpen( + MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ + Word16 numTransports, /* i : number of transport channels */ + Word32 input_Fs /* i : signal sampling rate */ +) +{ + MASA_PREREND_HANDLE hMasaPrerend; + Word16 i; + ivas_error error; + + error = IVAS_ERR_OK; + + hMasaPrerend = (MASA_PREREND_HANDLE) malloc( sizeof( MASA_PREREND_DATA ) ); + IF ( hMasaPrerend == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA prerenderer\n" ) ); + } + + hMasaPrerend->num_Cldfb_instances = numTransports; + move16(); + FOR ( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ ) + { + IF ( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + FOR ( ; i < MASA_MAX_TRANSPORT_CHANNELS; i++ ) + { + hMasaPrerend->cldfbAnaEnc[i] = NULL; + } + + IF ( ( hMasaPrerend->hMasaOut = (MASA_DECODER_EXT_OUT_META_HANDLE) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA prerenderer\n" ) ); + } + + IF ( ( hMasaPrerend->sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA prerenderer\n" ) ); + } + generate_gridEq_fx( hMasaPrerend->sph_grid16 ); + + IF ( error == IVAS_ERR_OK ) + { + *hMasaPrerendPtr = hMasaPrerend; + } + + return error; +} +#endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * masaPrerendClose() diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index 468a7ce8f..7ca34554e 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -2352,39 +2352,34 @@ static void computeEvenLayout( return; } -#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_create_masa_out_meta() * * *------------------------------------------------------------------------*/ -void ivas_create_masa_out_meta_fx( - MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ - SPHERICAL_GRID_DATA *Sph_Grid16, /* i : Spherical grid */ - const Word16 nchan_transport, /* i : Number of transport channels */ - Word32 elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated elevation */ - Word32 azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated azimuth */ - Word32 energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated direct-to-total ratio */ - Word32 spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated spread coherence */ - Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated surround coherence */ - Word16 energyRatio_q, - Word16 spreadCoherence_q, - Word16 surroundingCoherence_q - +void ivas_create_masa_out_meta( + MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ + SPHERICAL_GRID_DATA *Sph_Grid16, /* i : Spherical grid */ + const int16_t nchan_transport, /* i : Number of transport channels */ + float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated elevation */ + float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated azimuth */ + float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated direct-to-total ratio */ + float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated spread coherence */ + float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : Estimated surround coherence */ ) { - const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ - int16_t i, sf, band; - uint8_t numFrequencyBands; - uint8_t numDirections; - uint16_t spherical_index; + const UWord8 ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ + Word16 i, sf, band; + UWord8 numFrequencyBands; + UWord8 numDirections; + UWord16 spherical_index; numDirections = 1; numFrequencyBands = MASA_FREQUENCY_BANDS; /* Construct descriptive meta */ - for ( i = 0; i < 8; i++ ) + FOR ( i = 0; i < 8; i++ ) { extOutMeta->descriptiveMeta.formatDescriptor[i] = ivasmasaFormatDescriptor[i]; } @@ -2398,62 +2393,69 @@ void ivas_create_masa_out_meta_fx( extOutMeta->descriptiveMeta.channelLayout = 0x0u; /* Construct spatial metadata from estimated values */ - for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { /* Spherical index */ - for ( band = 0; band < numFrequencyBands; band++ ) + FOR ( band = 0; band < numFrequencyBands; band++ ) { - spherical_index = index_theta_phi_16_fx( &elevation_m_values[sf][band], &azimuth_m_values[sf][band], Sph_Grid16 ); + spherical_index = index_theta_phi_16( &elevation_m_values[sf][band], &azimuth_m_values[sf][band], Sph_Grid16 ); + move16(); extOutMeta->directionIndex[0][sf][band] = spherical_index; + move16(); extOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; + move16(); } /* Direct-to-total ratio */ - for ( band = 0; band < numFrequencyBands; band++ ) + FOR ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->directToTotalRatio[0][sf][band] = (uint8_t) L_shr( energyRatio[sf][band], energyRatio_q - 8 ); + extOutMeta->directToTotalRatio[0][sf][band] = (UWord8) floorf( energyRatio[sf][band] * UINT8_MAX ); extOutMeta->directToTotalRatio[1][sf][band] = 0; } /* Spread coherence */ - for ( band = 0; band < numFrequencyBands; band++ ) + FOR ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->spreadCoherence[0][sf][band] = (uint8_t) L_shr( spreadCoherence[sf][band], spreadCoherence_q - 8 ); + extOutMeta->spreadCoherence[0][sf][band] = (UWord8) floorf( spreadCoherence[sf][band] * UINT8_MAX ); extOutMeta->spreadCoherence[1][sf][band] = 0; } /* Diffuse-to-total ratio = 1 - sum(direct-to-total ratios) */ - for ( band = 0; band < numFrequencyBands; band++ ) + FOR ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX - (uint8_t) L_shr( energyRatio[sf][band], energyRatio_q - 8 ); + extOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX - (UWord8) floorf( energyRatio[sf][band] * UINT8_MAX ); } /* Surround coherence */ - for ( band = 0; band < numFrequencyBands; band++ ) + FOR ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->surroundCoherence[sf][band] = (uint8_t) L_shr( surroundingCoherence[sf][band], surroundingCoherence_q - 8 ); + extOutMeta->surroundCoherence[sf][band] = (UWord8) floorf( surroundingCoherence[sf][band] * UINT8_MAX ); } } return; } -#endif +#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_create_masa_out_meta() * * *------------------------------------------------------------------------*/ -void ivas_create_masa_out_meta( - MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ - SPHERICAL_GRID_DATA *Sph_Grid16, /* i : Spherical grid */ - const int16_t nchan_transport, /* i : Number of transport channels */ - float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated elevation */ - float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated azimuth */ - float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated direct-to-total ratio */ - float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated spread coherence */ - float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : Estimated surround coherence */ +void ivas_create_masa_out_meta_fx( + MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ + SPHERICAL_GRID_DATA *Sph_Grid16, /* i : Spherical grid */ + const Word16 nchan_transport, /* i : Number of transport channels */ + Word32 elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated elevation */ + Word32 azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated azimuth */ + Word32 energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated direct-to-total ratio */ + Word32 spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated spread coherence */ + Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated surround coherence */ + Word16 energyRatio_q, + Word16 spreadCoherence_q, + Word16 surroundingCoherence_q + ) { const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ @@ -2485,7 +2487,7 @@ void ivas_create_masa_out_meta( /* Spherical index */ for ( band = 0; band < numFrequencyBands; band++ ) { - spherical_index = index_theta_phi_16( &elevation_m_values[sf][band], &azimuth_m_values[sf][band], Sph_Grid16 ); + spherical_index = index_theta_phi_16_fx( &elevation_m_values[sf][band], &azimuth_m_values[sf][band], Sph_Grid16 ); extOutMeta->directionIndex[0][sf][band] = spherical_index; extOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; } @@ -2493,29 +2495,30 @@ void ivas_create_masa_out_meta( /* Direct-to-total ratio */ for ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->directToTotalRatio[0][sf][band] = (uint8_t) floorf( energyRatio[sf][band] * UINT8_MAX ); + extOutMeta->directToTotalRatio[0][sf][band] = (uint8_t) L_shr( energyRatio[sf][band], energyRatio_q - 8 ); extOutMeta->directToTotalRatio[1][sf][band] = 0; } /* Spread coherence */ for ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->spreadCoherence[0][sf][band] = (uint8_t) floorf( spreadCoherence[sf][band] * UINT8_MAX ); + extOutMeta->spreadCoherence[0][sf][band] = (uint8_t) L_shr( spreadCoherence[sf][band], spreadCoherence_q - 8 ); extOutMeta->spreadCoherence[1][sf][band] = 0; } /* Diffuse-to-total ratio = 1 - sum(direct-to-total ratios) */ for ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX - (uint8_t) floorf( energyRatio[sf][band] * UINT8_MAX ); + extOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX - (uint8_t) L_shr( energyRatio[sf][band], energyRatio_q - 8 ); } /* Surround coherence */ for ( band = 0; band < numFrequencyBands; band++ ) { - extOutMeta->surroundCoherence[sf][band] = (uint8_t) floorf( surroundingCoherence[sf][band] * UINT8_MAX ); + extOutMeta->surroundCoherence[sf][band] = (uint8_t) L_shr( surroundingCoherence[sf][band], surroundingCoherence_q - 8 ); } } return; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index a2eac77dc..545fddc1b 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -820,24 +820,11 @@ ivas_error ivas_td_binaural_renderer_unwrap( tmp_Pos = &Pos[hCombinedOrientationData->subframe_idx]; } - // Float to fixed - float max_val = 0; - max_val = (float)max(max_val, fabs(tmp_Quaternions->w)); - max_val = (float)max(max_val, fabs(tmp_Quaternions->x)); - max_val = (float)max(max_val, fabs(tmp_Quaternions->y)); - max_val = (float)max(max_val, fabs(tmp_Quaternions->z)); - Word16 quat_q = Q_factor_L(max_val); - tmp_Quaternions->w_fx = float_to_fix(tmp_Quaternions->w, quat_q); - tmp_Quaternions->x_fx = float_to_fix(tmp_Quaternions->x, quat_q); - tmp_Quaternions->y_fx = float_to_fix(tmp_Quaternions->y, quat_q); - tmp_Quaternions->z_fx = float_to_fix(tmp_Quaternions->z, quat_q); - tmp_Quaternions->q_fact = quat_q; - Word16 pos_q = Q25; - tmp_Pos->x_fx = (Word32)float_to_fix(tmp_Pos->x, pos_q); - tmp_Pos->y_fx = (Word32)float_to_fix(tmp_Pos->y, pos_q); - tmp_Pos->z_fx = (Word32)float_to_fix(tmp_Pos->z, pos_q); - tmp_Pos->q_fact= pos_q; + tmp_Pos->x_fx = L_shr( tmp_Pos->x_fx, sub(tmp_Pos->q_fact, pos_q) ); + tmp_Pos->y_fx = L_shr( tmp_Pos->y_fx, sub( tmp_Pos->q_fact, pos_q ) ); + tmp_Pos->z_fx = L_shr( tmp_Pos->z_fx, sub( tmp_Pos->q_fact, pos_q ) ); + tmp_Pos->q_fact = pos_q; // end float to fix IF ( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, tmp_Quaternions, tmp_Pos ) ) != IVAS_ERR_OK ) diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index b8afd6474..e7165ed25 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -41,6 +41,8 @@ #include "ivas_stat_rend.h" #include "ivas_rom_com.h" #include "wmc_auto.h" +#include "prot_fx2.h" +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED /*------------------------------------------------------------------------- @@ -49,8 +51,38 @@ static void ivas_omasa_param_est_ana( OMASA_ANA_HANDLE hOMasa, float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_ism ); +#ifndef IVAS_FLOAT_FIXED static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, const float ism_azimuth[MAX_NUM_OBJECTS], const float ism_elevation[MAX_NUM_OBJECTS], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); +#endif +#ifdef IVAS_FLOAT_FIXED +static void ivas_omasa_dmx_fx( + Word32 data_in_f_fx[][L_FRAME48k], + Word16 *data_in_q, + const Word16 input_frame, + const Word16 nchan_transport, + const Word16 nchan_ism, + const Word32 ism_azimuth_fx[MAX_NUM_OBJECTS], + const Word32 ism_elevation_fx[MAX_NUM_OBJECTS], + Word32 prev_gains_fx[][MASA_MAX_TRANSPORT_CHANNELS], + const Word16 interpolator_fx[L_FRAME48k]); + + +static void ivas_omasa_param_est_ana_fx( + OMASA_ANA_HANDLE hOMasa, + Word32 data_f_fx[][L_FRAME48k], + Word16 data_f_q, + Word32 elevation_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q22 + Word32 azimuth_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q22 + Word32 energyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + Word16 *energyRatio_q, + Word32 spreadCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + Word16 *spreadCoherence_q, + Word32 surroundingCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + Word16 *surroundingCoherence_q, + const Word16 input_frame, + const Word16 nchan_ism ); +#endif /*--------------------------------------------------------------------------* * ivas_omasa_ana_open() @@ -58,6 +90,148 @@ static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], const int16_t input_f * Allocate and initialize OMASA handle *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_omasa_ana_open( + OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ + Word32 input_Fs, /* i : Sampling frequency */ + UWord16 total_num_objects /* i : Number of objects */ +) +{ + Word16 i, j; + OMASA_ANA_HANDLE hOMasa; + Word16 numAnalysisChannels; + Word16 maxBin, input_frame; + ivas_error error; + Word16 scale; + + error = IVAS_ERR_OK; + + IF ( ( hOMasa = (OMASA_ANA_HANDLE) malloc( sizeof( OMASA_ANA_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA\n" ) ); + } + + numAnalysisChannels = (Word16) total_num_objects; + move16(); + + /* Determine the number of bands */ + hOMasa->nbands = MASA_FREQUENCY_BANDS; + move16(); + + /* Determine band grouping */ + mvs2s( MASA_band_grouping_24, hOMasa->band_grouping, 24 + 1 ); + + maxBin = (Word16) BASOP_Util_Divide3232_Scale( input_Fs, 800, &scale ); + maxBin = shr( maxBin, sub( 15, scale ) ); + + FOR ( i = 1; i < hOMasa->nbands + 1; i++ ) + { + IF ( GE_16( hOMasa->band_grouping[i], maxBin ) ) + { + hOMasa->band_grouping[i] = maxBin; + move16(); + hOMasa->nbands = i; + move16(); + BREAK; + } + } + + /* Determine block grouping */ + mvs2s( DirAC_block_grouping, hOMasa->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); + + /* open/initialize CLDFB */ + hOMasa->num_Cldfb_instances = numAnalysisChannels; + FOR ( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) + { + IF ( ( error = openCldfb_ivas( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + FOR ( ; i < MAX_NUM_OBJECTS; i++ ) + { + hOMasa->cldfbAnaEnc[i] = NULL; + } + + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + IF ( ( hOMasa->direction_vector_m_fx[i] = (Word32 **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA data\n" ) ); + } + + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + IF ( ( hOMasa->direction_vector_m_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA data\n" ) ); + } + set_zero_fx( hOMasa->direction_vector_m_fx[i][j], MASA_FREQUENCY_BANDS ); + } + } + + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + IF ( ( hOMasa->buffer_intensity_real_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA data\n" ) ); + } + set_zero_fx( hOMasa->buffer_intensity_real_fx[i][j], MASA_FREQUENCY_BANDS ); + } + } + + set_zero_fx( hOMasa->buffer_energy_fx, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); + + FOR ( i = 0; i < MAX_NUM_OBJECTS; i++ ) + { + set32_fx( hOMasa->prev_object_dm_gains_fx[i], INV_SQRT_2_Q31, MASA_MAX_TRANSPORT_CHANNELS ); + } + + input_frame = BASOP_Util_Divide3232_Scale( input_Fs, FRAMES_PER_SEC, &scale ); + input_frame = shr (input_frame, sub( 15, scale ) ); + + + + FOR ( i = 0; i < input_frame; i++ ) + { + hOMasa->interpolator_fx[i] = BASOP_Util_Divide1616_Scale(i, input_frame, &scale ); + hOMasa->interpolator_fx[i] = shl( hOMasa->interpolator_fx[i], scale ); // Q15 + } + + hOMasa->index_buffer_intensity = 0; + move16(); + + IF ( ( hOMasa->hMasaOut = (MASA_DECODER_EXT_OUT_META_HANDLE) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + + IF ( ( hOMasa->sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + + generate_gridEq_fx( hOMasa->sph_grid16 ); + + FOR ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + set_zero_fx( hOMasa->energy_fx[i], MASA_FREQUENCY_BANDS ); + } + + set_zero_fx( hOMasa->ism_azimuth_fx, MAX_NUM_OBJECTS ); + set_zero_fx( hOMasa->ism_elevation_fx, MAX_NUM_OBJECTS ); + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED +#endif + + ( *hOMasaPtr ) = hOMasa; + + return error; +} +#else ivas_error ivas_omasa_ana_open( OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ int32_t input_Fs, /* i : Sampling frequency */ @@ -183,6 +357,7 @@ ivas_error ivas_omasa_ana_open( return error; } +#endif /*--------------------------------------------------------------------------* * ivas_omasa_ana_close() @@ -190,6 +365,52 @@ ivas_error ivas_omasa_ana_open( * Close OMASA handle *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_omasa_ana_close( + OMASA_ANA_HANDLE *hOMasa /* i/o: analysis OMASA handle */ +) +{ + Word16 i, j; + + IF ( hOMasa == NULL || *hOMasa == NULL ) + { + return; + } + + FOR ( i = 0; i < ( *hOMasa )->num_Cldfb_instances; i++ ) + { + deleteCldfb_ivas( &( ( *hOMasa )->cldfbAnaEnc[i] ) ); + } + + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + free( ( *hOMasa )->direction_vector_m_fx[i][j] ); + ( *hOMasa )->direction_vector_m_fx[i][j] = NULL; + } + + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + free( ( *hOMasa )->buffer_intensity_real_fx[i][j] ); + ( *hOMasa )->buffer_intensity_real_fx[i][j] = NULL; + } + + free( ( *hOMasa )->direction_vector_m_fx[i] ); + ( *hOMasa )->direction_vector_m_fx[i] = NULL; + } + + free( ( *hOMasa )->hMasaOut ); + ( *hOMasa )->hMasaOut = NULL; + free( ( *hOMasa )->sph_grid16 ); + ( *hOMasa )->sph_grid16 = NULL; + + free( ( *hOMasa ) ); + ( *hOMasa ) = NULL; + + return; +} +#else void ivas_omasa_ana_close( OMASA_ANA_HANDLE *hOMasa /* i/o: analysis OMASA handle */ ) @@ -234,7 +455,7 @@ void ivas_omasa_ana_close( return; } - +#endif /*--------------------------------------------------------------------------* * ivas_omasa_ana() @@ -242,6 +463,7 @@ void ivas_omasa_ana_close( * OMASA analysis function *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_omasa_ana( OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -267,13 +489,47 @@ void ivas_omasa_ana( return; } +#endif + +#ifdef IVAS_FLOAT_FIXED +void ivas_omasa_ana_fx( + OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ + float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + Word32 data_in_f_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ + Word16 *data_in_q, + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_ism /* i : Number of objects for parameter analysis */ +) +{ + Word32 elevation_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 azimuth_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 energyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 spreadCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 surroundingCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 spreadCoherence_q, sorroundingCoherence_q, energyRatio_q; + + /* Estimate MASA parameters from the objects */ + ivas_omasa_param_est_ana_fx(hOMasa, data_in_f_fx, *data_in_q, elevation_m_values_fx, azimuth_m_values_fx, energyRatio_fx, &energyRatio_q, spreadCoherence_fx, &spreadCoherence_q, surroundingCoherence_fx, &sorroundingCoherence_q, input_frame, nchan_ism); + + /* Create MASA metadata buffer from the estimated values */ + + ivas_create_masa_out_meta_fx( hOMasa->hMasaOut, hOMasa->sph_grid16, nchan_transport, elevation_m_values_fx, azimuth_m_values_fx, energyRatio_fx, spreadCoherence_fx, surroundingCoherence_fx, energyRatio_q, spreadCoherence_q, sorroundingCoherence_q ); + + /* Downmix */ + ivas_omasa_dmx_fx( data_in_f_fx, data_in_q, input_frame, nchan_transport, nchan_ism, hOMasa->ism_azimuth_fx, hOMasa->ism_elevation_fx, hOMasa->prev_object_dm_gains_fx, hOMasa->interpolator_fx ); + return; +} +#endif /*--------------------------------------------------------------------------* * Local functions *--------------------------------------------------------------------------*/ /* Estimate MASA parameters from the objects */ + +#ifndef IVAS_FLOAT_FIXED static void ivas_omasa_param_est_ana( OMASA_ANA_HANDLE hOMasa, float data_f[][L_FRAME48k], @@ -461,9 +717,445 @@ static void ivas_omasa_param_est_ana( return; } +#endif + +#ifdef IVAS_FLOAT_FIXED +static void ivas_omasa_param_est_ana_fx( + OMASA_ANA_HANDLE hOMasa, + Word32 data_f_fx[][L_FRAME48k], + Word16 data_f_q, + Word32 elevation_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q22 + Word32 azimuth_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q22 + Word32 energyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + Word16 *energyRatio_q, + Word32 spreadCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + Word16 *spreadCoherence_q, + Word32 surroundingCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + Word16 *surroundingCoherence_q, + const Word16 input_frame, + const Word16 nchan_ism ) +{ + Word16 ts, i, d, j; + Word16 num_freq_bins, num_freq_bands, index; + Word16 l_ts; + + Word32 reference_power_fx[MASA_FREQUENCY_BANDS]; + Word32 Chnl_RealBuffer_fx[MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + Word16 Chnl_RealBuffer_q; + Word16 Chnl_ImagBuffer_q; + Word32 Chnl_ImagBuffer_fx[MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; + Word32 Foa_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 Foa_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 intensity_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; + Word32 direction_vector_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; + Word32 diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; + Word16 diffuseness_q; + Word32 diffuseness_m_fx[MASA_FREQUENCY_BANDS]; + Word16 diffuseness_m_q; + Word32 renormalization_factor_diff_fx[MASA_FREQUENCY_BANDS]; + Word16 renormalization_factor_diff_q; + Word32 norm_tmp_fx; + Word16 scale; + + Word32 dir_v_fx[DIRAC_NUM_DIMS], L_tmp1, L_tmp2; + Word16 dir_v_q, norm_tmp_q; + Word16 foa_q; + + int16_t band_m_idx, block_m_idx; + + //float norm_tmp; + Word16 mrange[2]; + Word16 brange[2]; + + num_freq_bins = hOMasa->cldfbAnaEnc[0]->no_channels; + move16(); + num_freq_bands = hOMasa->nbands; + move16(); + l_ts = input_frame / CLDFB_NO_COL_MAX; + + Word16 intensity_q; + Word16 direction_q, reference_power_q; + + /* Compute ISM to FOA matrices */ + FOR ( i = 0; i < nchan_ism; i++ ) + { + Word16 tmp, tmp1, scale; + // 180 in Q22 754974720 + hOMasa->chnlToFoaMtx_fx[0][i] = 32767; // 1 in Q15 + move16(); + + tmp = BASOP_Util_Divide3232_Scale(hOMasa->ism_azimuth_fx[i], 754974720, &scale); + tmp = mult( tmp, EVS_PI_FX ); // Q13 + Q15 - Q15 --> Q13 + tmp = getSinWord16(tmp); // Q15 sine value + + tmp1 = BASOP_Util_Divide3232_Scale(hOMasa->ism_elevation_fx[i], 754974720, &scale); + tmp1 = mult(tmp1, EVS_PI_FX ); + tmp1 = getCosWord16(tmp1); + hOMasa->chnlToFoaMtx_fx[1][i] = shl(mult(tmp, tmp1), 1); // Q14 + Q15 - Q15 + Q1 -> Q15 + + tmp = BASOP_Util_Divide3232_Scale(hOMasa->ism_elevation_fx[i], 754974720, &scale); + tmp = mult(tmp, EVS_PI_FX); // Q13 + Q15 - Q15 --> Q13 + hOMasa->chnlToFoaMtx_fx[2][i] = getSinWord16( tmp ); // Q15 + + tmp = BASOP_Util_Divide3232_Scale(hOMasa->ism_azimuth_fx[i], 754974720, &scale); + tmp = mult(tmp, EVS_PI_FX); // Q13 + Q15 - Q15 --> Q13 + tmp= getCosWord16(tmp); // Q14 + + + tmp1 = BASOP_Util_Divide3232_Scale(hOMasa->ism_elevation_fx[i], 754974720, &scale); + tmp1 = mult(tmp, EVS_PI_FX); // Q13 + Q15 - Q15 --> Q13 + tmp1 = getCosWord16(tmp); // Q14 + + hOMasa->chnlToFoaMtx_fx[3][i] = shl( mult(tmp, tmp1), 2 ); // Q14 + Q14 - Q15 + Q2-> Q13 + Q2 -> Q15 + } + + /* do processing over all CLDFB time slots */ + FOR ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + mrange[0] = hOMasa->block_grouping[block_m_idx]; + move16(); + mrange[1] = hOMasa->block_grouping[block_m_idx + 1]; + move16(); + + FOR ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + hOMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx] = 0; + move32(); + hOMasa->direction_vector_m_fx[1][block_m_idx][band_m_idx] = 0; + move32(); + hOMasa->direction_vector_m_fx[2][block_m_idx][band_m_idx] = 0; + move32(); + } + + /* Need to initialize renormalization_factors, and variables to be normalized */ + + set_zero_fx( renormalization_factor_diff_fx, hOMasa->nbands ); + set_zero_fx( diffuseness_m_fx, hOMasa->nbands ); + set_zero_fx( hOMasa->energy_fx[block_m_idx], MASA_FREQUENCY_BANDS ); + + FOR ( ts = mrange[0]; ts < mrange[1]; ts++ ) + { + FOR ( i = 0; i < nchan_ism; i++ ) + { + Word16 in_q; + in_q = data_f_q; + move16(); + + cldfbAnalysis_ts_fx( &( data_f_fx[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hOMasa->cldfbAnaEnc[i], &in_q); + + FOR (Word16 ind = 0; ind < CLDFB_NO_CHANNELS_MAX; ind++) + { + Chnl_RealBuffer_fx[i][ind] = Chnl_RealBuffer_fx[i][ind] / (1 << 4); + Chnl_ImagBuffer_fx[i][ind] = Chnl_ImagBuffer_fx[i][ind] / (1 << 4); + + } + + Chnl_RealBuffer_q = sub(in_q, 4); + Chnl_ImagBuffer_q = sub(in_q, 4); + } + + + /* Compute channel-based energy for metadata processing */ + FOR ( band_m_idx = 0; band_m_idx < num_freq_bands; band_m_idx++ ) + { + brange[0] = hOMasa->band_grouping[band_m_idx]; + move16(); + brange[1] = hOMasa->band_grouping[band_m_idx + 1]; + move16(); + FOR ( j = brange[0]; j < brange[1]; j++ ) + { + FOR ( i = 0; i < nchan_ism; i++ ) + { + L_tmp1 = Mpy_32_32(Chnl_RealBuffer_fx[i][j], Chnl_RealBuffer_fx[i][j]); + L_tmp2 = Mpy_32_32(Chnl_ImagBuffer_fx[i][j], Chnl_ImagBuffer_fx[i][j]); + hOMasa->energy_fx[block_m_idx][band_m_idx] = L_add(hOMasa->energy_fx[block_m_idx][band_m_idx], L_add(L_tmp1, L_tmp2));// Chnl_RealBuffer_q + Chnl_RealBuffer_q - 31 + hOMasa->energy_q = sub( add( Chnl_RealBuffer_q, Chnl_RealBuffer_q ), 31 ); + } + } + } + + /* Compute FOA */ + /* W */ + + Copy32( Chnl_RealBuffer_fx[0], Foa_RealBuffer_fx[0], num_freq_bins ); + Copy32( Chnl_ImagBuffer_fx[0], Foa_ImagBuffer_fx[0], num_freq_bins ); + + FOR ( i = 1; i < nchan_ism; i++ ) + { + v_add_fixed(Chnl_RealBuffer_fx[i], Foa_RealBuffer_fx[0], Foa_RealBuffer_fx[0], num_freq_bins, 0); + v_add_fixed(Chnl_ImagBuffer_fx[i], Foa_ImagBuffer_fx[0], Foa_ImagBuffer_fx[0], num_freq_bins, 0); + } + + /* Y */ + + v_multc_fixed(Chnl_RealBuffer_fx[0], L_deposit_h(hOMasa->chnlToFoaMtx_fx[1][0]), Foa_RealBuffer_fx[1], num_freq_bins); + v_multc_fixed(Chnl_ImagBuffer_fx[0], L_deposit_h(hOMasa->chnlToFoaMtx_fx[1][0]), Foa_ImagBuffer_fx[1], num_freq_bins); + + FOR ( i = 1; i < nchan_ism; i++ ) + { + v_multc_acc_32_16( Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[1][i], Foa_RealBuffer_fx[1], num_freq_bins ); + v_multc_acc_32_16( Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[1][i], Foa_ImagBuffer_fx[1], num_freq_bins ); + } + + /* Z */ + + v_multc_fixed( Chnl_RealBuffer_fx[0], L_deposit_h(hOMasa->chnlToFoaMtx_fx[2][0]), Foa_RealBuffer_fx[2], num_freq_bins ); + v_multc_fixed( Chnl_ImagBuffer_fx[0], L_deposit_h(hOMasa->chnlToFoaMtx_fx[2][0]), Foa_ImagBuffer_fx[2], num_freq_bins ); + + FOR ( i = 1; i < nchan_ism; i++ ) + { + v_multc_acc_32_16( Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[2][i], Foa_RealBuffer_fx[2], num_freq_bins ); + v_multc_acc_32_16( Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[2][i], Foa_ImagBuffer_fx[2], num_freq_bins ); + } + + v_multc_fixed( Chnl_RealBuffer_fx[0], L_deposit_h(hOMasa->chnlToFoaMtx_fx[3][0]), Foa_RealBuffer_fx[2], num_freq_bins ); + v_multc_fixed( Chnl_ImagBuffer_fx[0], L_deposit_h(hOMasa->chnlToFoaMtx_fx[3][0]), Foa_ImagBuffer_fx[2], num_freq_bins ); + + FOR ( i = 1; i < nchan_ism; i++ ) + { + v_multc_acc_32_16(Chnl_RealBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_RealBuffer_fx[3], num_freq_bins); + v_multc_acc_32_16(Chnl_ImagBuffer_fx[i], hOMasa->chnlToFoaMtx_fx[3][i], Foa_ImagBuffer_fx[3], num_freq_bins); + } + + /* Direction estimation */ + FOR (i = 0; i < FOA_CHANNELS; i++) + { + FOR (j = 0; j < CLDFB_NO_CHANNELS_MAX; j++) + { + Foa_RealBuffer_fx[i][j] = L_shr(Foa_RealBuffer_fx[i][j], 5); + Foa_ImagBuffer_fx[i][j] = L_shr(Foa_ImagBuffer_fx[i][j], 5); + } + } + foa_q = sub( Chnl_ImagBuffer_q, 5 ); + computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); + + intensity_q = sub( shl( add(foa_q, Q1), 1 ), 31 ); + direction_q, reference_power_q; + + computeDirectionVectors_fx( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], &direction_q ); + + /* Power estimation for diffuseness */ + + computeReferencePower_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx, num_freq_bands ); // 2*inputq - 30 + reference_power_q = sub( shl( Chnl_ImagBuffer_q, 1 ), 30 ); + + /* Fill buffers of length "averaging_length" time slots for intensity and energy */ + hOMasa->index_buffer_intensity = ( hOMasa->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + index = hOMasa->index_buffer_intensity; + + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + /* only real part needed */ + Copy32( intensity_real_fx[i], &( hOMasa->buffer_intensity_real_fx[i][index - 1][0] ), num_freq_bands ); + } + hOMasa->buffer_intensity_real_q[index - 1] = intensity_q; + move16(); + Copy32( reference_power_fx, &( hOMasa->buffer_energy_fx[( index - 1 ) * num_freq_bands] ), num_freq_bands ); + hOMasa->buffer_energy_q[index - 1] = reference_power_q; + move16(); + + computeDiffuseness_fixed(hOMasa->buffer_intensity_real_fx, hOMasa->buffer_energy_fx, num_freq_bands, diffuseness_vector_fx, hOMasa->buffer_intensity_real_q, hOMasa->buffer_energy_q, &diffuseness_q); + + FOR ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + norm_tmp_fx = Mpy_32_32(reference_power_fx[band_m_idx], L_sub(1073741824, diffuseness_vector_fx[band_m_idx] )); // reference_power_q + 30 - 31 + norm_tmp_q = sub( add( reference_power_q, 30 ), 31 ); + + hOMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx] = L_add( hOMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx], Mpy_32_32( norm_tmp_fx, direction_vector_fx[0][band_m_idx] ) ); + + hOMasa->direction_vector_m_fx[1][block_m_idx][band_m_idx] = L_add(hOMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx], Mpy_32_32( norm_tmp_fx, direction_vector_fx[1][band_m_idx] ) ); + hOMasa->direction_vector_m_fx[2][block_m_idx][band_m_idx] = L_add( hOMasa->direction_vector_m_fx[0][block_m_idx][band_m_idx], Mpy_32_32( norm_tmp_fx, direction_vector_fx[2][band_m_idx] ) ); + + hOMasa->direction_vector_m_q = sub( add( norm_tmp_q, direction_q ), 31 ); + + + diffuseness_m_fx[band_m_idx] = L_add( diffuseness_m_fx[band_m_idx], Mpy_32_32( reference_power_fx[band_m_idx], diffuseness_vector_fx[band_m_idx] ) ); + diffuseness_m_q = sub( add( reference_power_q, diffuseness_q ), 31 ); + renormalization_factor_diff_fx[band_m_idx] = L_add( renormalization_factor_diff_fx[band_m_idx], reference_power_fx[band_m_idx] ); + renormalization_factor_diff_q = reference_power_q; + move16(); + } + } + + FOR (band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++) + { + FOR (d = 0; d < DIRAC_NUM_DIMS; d++) + { + dir_v_fx[d] = hOMasa->direction_vector_m_fx[d][block_m_idx][band_m_idx]; + move32(); + } + dir_v_q = hOMasa->direction_vector_m_q; + + FOR (Word16 i = 0; i < DIRAC_NUM_DIMS; i++) + { + dir_v_fx[i] = L_shr(dir_v_fx[i], 1); + } + + dir_v_q = sub( dir_v_q, 1 ); + ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( dir_v_fx, dir_v_q, &azimuth_m_values_fx[block_m_idx][band_m_idx], &elevation_m_values_fx[block_m_idx][band_m_idx] ); + } + + /* Determine energy ratios */ + FOR ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + IF ( BASOP_Util_Cmp_Mant32Exp( renormalization_factor_diff_fx[band_m_idx], sub( 31, renormalization_factor_diff_q ), L_deposit_h(EPSILON_FX), 2 ) > 0) + { + diffuseness_m_fx[band_m_idx] = BASOP_Util_Divide3232_Scale( diffuseness_m_fx[band_m_idx], renormalization_factor_diff_fx[band_m_idx], &scale ); + scale = add( scale, sub(sub(31, diffuseness_m_q), sub(31, renormalization_factor_diff_q)) ); + + diffuseness_m_fx[band_m_idx] = L_shr(diffuseness_m_fx[band_m_idx], sub( 31, add( scale, diffuseness_m_q ) ) ); + } + ELSE + { + diffuseness_m_fx[band_m_idx] = 0; + move32(); + } + energyRatio_fx[block_m_idx][band_m_idx] = L_sub( L_shl(1, diffuseness_m_q ), diffuseness_m_fx[band_m_idx] ); + } + + /* Set coherences to zero, as this mode is used at lowest bit rates where the coherences are not transmitted */ + FOR ( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) + { + spreadCoherence_fx[block_m_idx][band_m_idx] = 0; + move32(); + surroundingCoherence_fx[block_m_idx][band_m_idx] = 0; + move32(); + } + } + + *spreadCoherence_q = 0; + move16(); + *surroundingCoherence_q = 0; + move16(); + *energyRatio_q = 0; + move16(); + + return; +} + +#endif + +#ifdef IVAS_FLOAT_FIXED +/* Compute downmix */ +static void ivas_omasa_dmx_fx( + Word32 data_in_f_fx[][L_FRAME48k], + Word16 *data_in_q, + const Word16 input_frame, + const Word16 nchan_transport, + const Word16 nchan_ism, + const Word32 ism_azimuth_fx[MAX_NUM_OBJECTS], + const Word32 ism_elevation_fx[MAX_NUM_OBJECTS], + Word32 prev_gains_fx[][MASA_MAX_TRANSPORT_CHANNELS], + const Word16 interpolator_fx[L_FRAME48k]) +{ + Word16 i, j, k, l, tmp1, tmp2; + + Word16 azimuth_fx, elevation_fx; + Word16 gains_fx[MASA_MAX_TRANSPORT_CHANNELS]; + Word16 g1_fx, g2_fx, scale; + Word32 data_out_f_fx[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k], L_tmp; + Word16 max_e, tmp_e; + Word16 in_e[960]; + Word16 data_e[4]; + + FOR ( i = 0; i < nchan_transport; i++ ) + { + set_zero_fx( data_out_f_fx[i], input_frame ); + } + set_s(data_e, 0, 4); + set_s(in_e, 0, 960); + + FOR ( i = 0; i < nchan_ism; i++ ) + { + + azimuth_fx = extract_l(L_shr( ism_azimuth_fx[i], Q22)); + elevation_fx = extract_l(L_shr( ism_elevation_fx[i], Q22 )); + + ivas_ism_get_stereo_gains_fx( azimuth_fx, elevation_fx, &gains_fx[0], &gains_fx[1] ); + + /* Downmix using the panning gains */ + FOR ( j = 0; j < nchan_transport; j++ ) + { + IF ( GT_32( L_abs( L_deposit_h( gains_fx[j] ) ), 0 ) || GT_32( L_abs( prev_gains_fx[i][j] ), 0 ) ) + { + FOR ( k = 0; k < input_frame; k++ ) + { + + g1_fx = interpolator_fx[k]; // Q15 + move16(); + scale = BASOP_Util_Add_MantExp(16384, 1, negate(g1_fx), 0, &g2_fx); + + tmp1 = mult(g1_fx, gains_fx[j]); + tmp2 = mult(g2_fx, (Word16)L_shr(prev_gains_fx[i][j], 16)); + scale = BASOP_Util_Add_MantExp(tmp1, 0, tmp2, scale, &tmp1); + + L_tmp = data_in_f_fx[i][k]; + move32(); + tmp_e = sub( 31, *data_in_q ); + move16(); + + L_tmp = Mpy_32_16_1(L_tmp, tmp1); + scale = add( scale, tmp_e ); + + data_out_f_fx[j][k] = BASOP_Util_Add_Mant32Exp(data_out_f_fx[j][k], data_e[j], L_tmp, scale, &in_e[k]); + + } + } + max_e = in_e[0]; + move16(); + FOR(l = 1; l < L_FRAME48k; l++) + { + IF(LT_16( max_e, in_e[l] ) ) + { + max_e = in_e[l]; + move16(); + } + } + + FOR(l = 0; l < L_FRAME48k; l++) + { + data_out_f_fx[j][l] = L_shr(data_out_f_fx[j][l], sub( max_e, in_e[l] ) ); + } + data_e[j] = max_e; + move16(); + + prev_gains_fx[i][j] = L_deposit_h( gains_fx[j] ); // Q31 + + } + } + + max_e = data_e[0]; + move16(); + FOR(i = 1; i < nchan_transport; i++) + { + IF( LT_16( max_e, data_e[i] ) ) + { + max_e = data_e[i]; + move16(); + } + } + + FOR(i = 0; i < nchan_transport; i++) + { + FOR(j = 0; j < input_frame; j++) + { + data_out_f_fx[i][j] = L_shr(data_out_f_fx[i][j], max_e - data_e[i]); + } + } + FOR ( i = 0; i < nchan_transport; i++ ) + { + Copy32(data_out_f_fx[i], data_in_f_fx[i], input_frame); + *data_in_q = sub( 31, max_e ); + move16(); + } + + return; +} +#endif /* Compute downmix */ +#ifndef IVAS_FLOAT_FIXED static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], const int16_t input_frame, @@ -490,14 +1182,7 @@ static void ivas_omasa_dmx( { azimuth = ism_azimuth[i]; elevation = ism_elevation[i]; -#ifdef IVAS_FLOAT_FIXED - Word16 gains_fx[2]; - ivas_ism_get_stereo_gains_fx( (Word16)azimuth, (Word16)elevation, &gains_fx[0], &gains_fx[1] ); - gains[0] = (float)gains_fx[0] / 32768.f; - gains[1] = (float)gains_fx[1] / 32768.f; -#else ivas_ism_get_stereo_gains( azimuth, elevation, &gains[0], &gains[1] ); -#endif /* Downmix using the panning gains */ for ( j = 0; j < nchan_transport; j++ ) @@ -522,6 +1207,8 @@ static void ivas_omasa_dmx( return; } +#endif + #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 6c96ade83..727326b40 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -2646,11 +2646,19 @@ void ivas_mcmasa_ana_close( MCMASA_ANA_HANDLE *hMcMasa /* i/o: analysis McMASA handle */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_omasa_ana_open( + OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ + Word32 input_Fs, /* i : Sampling frequency */ + UWord16 total_num_objects /* i : Number of objects */ +); +#else ivas_error ivas_omasa_ana_open( OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ int32_t input_Fs, /* i : Sampling frequency */ uint16_t total_num_objects /* i : Number of objects */ ); +#endif void ivas_omasa_ana( OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ @@ -2660,6 +2668,18 @@ void ivas_omasa_ana( const int16_t nchan_ism /* i : Number of objects for parameter analysis*/ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_omasa_ana_fx( + OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ + float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + Word32 data_in_f_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ + Word16 *q, + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_transport, /* i : Number of transport channels */ + const Word16 nchan_ism /* i : Number of objects for parameter analysis*/ +); +#endif + void ivas_omasa_ana_close( OMASA_ANA_HANDLE *hOMasa /* i/o: analysis OMASA handle */ ); @@ -2695,6 +2715,7 @@ void computeReferencePower_ana( float *reference_power, /* o : Estimated power */ const int16_t num_freq_bands /* i : Number of frequency bands */ ); + #ifdef IVAS_FLOAT_FIXED void ivas_create_masa_out_meta_fx( MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ @@ -2708,9 +2729,9 @@ void ivas_create_masa_out_meta_fx( Word16 energyRatio_q, Word16 spreadCoherence_q, Word16 surroundingCoherence_q - ); #endif + void ivas_create_masa_out_meta( MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ SPHERICAL_GRID_DATA *Sph_Grid16, /* i : Spherical grid */ @@ -2770,17 +2791,39 @@ void ivas_prerend_merge_masa_metadata( float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : TF-energy of input 2 */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_prerend_merge_masa_metadata_fx( + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ + IVAS_REND_AudioConfigType inType1, /* i : Type of input 1 */ + Word32 inEne1_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ + Word16 *inEne1_e, + MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i : Input metadata 2 */ + IVAS_REND_AudioConfigType inType2, /* i : Type of input 2 */ + Word32 inEne2_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 2 */ + Word16 *inEne2_e /* i : TF-energy of input 2 */ +); +#endif + void copy_masa_descriptive_meta( MASA_DECRIPTIVE_META *outMeta, /* o : metadata to be written */ MASA_DECRIPTIVE_META *inMeta /* i : input metadata */ ); +#ifndef IVAS_FLOAT_FIXED ivas_error masaPrerendOpen( MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ int16_t numTransports, /* i : number of transport channels */ int32_t input_Fs /* i : signal sampling rate */ ); +#else +ivas_error masaPrerendOpen( + MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ + Word16 numTransports, /* i : number of transport channels */ + Word32 input_Fs /* i : signal sampling rate */ +); +#endif void masaPrerendClose( MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ ); diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index c9843bafd..20043875f 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1900,7 +1900,7 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->subframe_idx = 0; move16(); - tmp = BASOP_Util_Divide3232_Scale( fs, MAX_PARAM__SPATIAL_SUB_FRAMES_PER_SEC, &tmp_e ); + tmp = BASOP_Util_Divide3232_Scale( fs, MAX_PARAM_SPATIAL_SUB_FRAMES_PER_SEC, &tmp_e ); ( *hCombinedOrientationData )->subframe_size = shr( tmp, sub( 15, tmp_e ) ); // ( *hCombinedOrientationData )->subframe_size = (int16_t) ( fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); ( *hCombinedOrientationData )->cur_subframe_samples_rendered = 0; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index f961f6dfc..731afcdd0 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -2358,12 +2358,18 @@ typedef struct ivas_omasa_ana_data_structure HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_OBJECTS]; /* DirAC parameter estimation */ + +#ifndef IVAS_FLOAT_FIXED float **direction_vector_m[DIRAC_NUM_DIMS]; /* Average direction vector */ +#endif + int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; int16_t block_grouping[5]; /* diffuseness */ int16_t index_buffer_intensity; + +#ifndef IVAS_FLOAT_FIXED float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; float buffer_energy[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; @@ -2372,13 +2378,35 @@ typedef struct ivas_omasa_ana_data_structure float interpolator[L_FRAME48k]; float prev_object_dm_gains[MAX_NUM_OBJECTS][MASA_MAX_TRANSPORT_CHANNELS]; +#endif MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; +#ifndef IVAS_FLOAT_FIXED float ism_azimuth[MAX_NUM_OBJECTS]; float ism_elevation[MAX_NUM_OBJECTS]; +#endif float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifdef IVAS_FLOAT_FIXED + Word32 **direction_vector_m_fx[DIRAC_NUM_DIMS]; /* Average direction vector */ + Word16 direction_vector_m_q; /* Average direction vector */ + Word32 ism_azimuth_fx[MAX_NUM_OBJECTS]; + Word32 ism_elevation_fx[MAX_NUM_OBJECTS]; + + Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_q; + Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word16 interpolator_fx[L_FRAME48k]; + Word32 prev_object_dm_gains_fx[MAX_NUM_OBJECTS][MASA_MAX_TRANSPORT_CHANNELS]; + + Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; + Word32 buffer_energy_fx[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; + Word16 buffer_intensity_real_q[DIRAC_NO_COL_AVG_DIFF]; + Word32 buffer_energy_q[DIRAC_NO_COL_AVG_DIFF]; + Word16 chnlToFoaMtx_fx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; // Q15 + +#endif } OMASA_ANA_DATA, *OMASA_ANA_HANDLE; @@ -2419,7 +2447,10 @@ typedef struct ivas_dirac_ana_data_structure SPHERICAL_GRID_DATA *sph_grid16; float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifdef IVAS_FLOAT_FIXED Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#endif } DIRAC_ANA_DATA, *DIRAC_ANA_HANDLE; #else @@ -2462,6 +2493,10 @@ typedef struct ivas_masa_prerend_data_structure SPHERICAL_GRID_DATA *sph_grid16; float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifdef IVAS_FLOAT_FIXED + Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES]; +#endif } MASA_PREREND_DATA, *MASA_PREREND_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index dbb301be6..a1f9b9954 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -193,13 +193,13 @@ typedef struct { Word16 numLfeChannels; bool pan_lfe; - //float lfeInputGain; + // float lfeInputGain; Word32 lfeInputGain_fx; - //float lfeOutputAzimuth; + // float lfeOutputAzimuth; Word16 lfeOutputAzimuth_fx; - //float lfeOutputElevation; + // float lfeOutputElevation; Word16 lfeOutputElevation_fx; - //IVAS_REND_LfePanMtx lfePanMtx; + // IVAS_REND_LfePanMtx lfePanMtx; IVAS_REND_LfePanMtx_fx lfePanMtx_fx; } lfe_routing; #else @@ -269,7 +269,7 @@ typedef struct typedef struct { input_base base; - //pan_matrix hoaDecMtx; + // pan_matrix hoaDecMtx; pan_matrix_fx hoaDecMtx_fx; CREND_WRAPPER_HANDLE crendWrapper; rotation_gains rot_gains_prev; @@ -296,6 +296,9 @@ typedef struct input_base base; MASA_METADATA_FRAME masaMetadata; bool metadataHasBeenFed; +#ifdef IVAS_FLOAT_FIXED + Word32 *bufferData_fx; +#endif // IVAS_FLOAT_FIXED float *bufferData; MASA_EXT_REND_HANDLE hMasaExtRend; MASA_PREREND_HANDLE hMasaPrerend; @@ -822,7 +825,7 @@ IVAS_REND_AudioConfigType getAudioConfigType( } #else IVAS_REND_AudioConfigType getAudioConfigType( - const AUDIO_CONFIG config) + const AUDIO_CONFIG config ) { IVAS_REND_AudioConfigType type; @@ -1072,12 +1075,12 @@ static ivas_error initLimiter( return error; } // The below code has to be deleted once whole conversion is completed - (*phLimiter)->gain = 1.0f; - (*phLimiter)->release_heuristic = 0.f; - (*phLimiter)->attack_constant = powf( 0.01f, 1.0f / ( IVAS_LIMITER_ATTACK_SECONDS * sampleRate ) ); + ( *phLimiter )->gain = 1.0f; + ( *phLimiter )->release_heuristic = 0.f; + ( *phLimiter )->attack_constant = powf( 0.01f, 1.0f / ( IVAS_LIMITER_ATTACK_SECONDS * sampleRate ) ); for ( Word32 i = 0; i < numChannels; ++i ) { - (*phLimiter)->channel_ptrs[i] = NULL; + ( *phLimiter )->channel_ptrs[i] = NULL; } // Till this line. @@ -1301,7 +1304,7 @@ static ivas_error getAmbisonicsOrder_fx( AUDIO_CONFIG config, Word16 *order ) { - SWITCH ( config ) + SWITCH( config ) { case IVAS_AUDIO_CONFIG_FOA: *order = 1; @@ -1596,14 +1599,11 @@ static ivas_error initEfap( const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) { ivas_error error; - const float *azimuths; - const float *elevations; - /*To be replaced with pointers*/ - Word32 azimuths_fx[MAX_OUTPUT_CHANNELS]; - Word32 elevations_fx[MAX_OUTPUT_CHANNELS]; + const Word32 *azimuths; + const Word32 *elevations; Word16 numNonLfeChannels; - IF ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + IF( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; } @@ -1614,51 +1614,42 @@ static ivas_error initEfap( pEfapWrapper->pCustomLsSetup = pCustomLsOut; /* If re-initializing, free existing EFAP handle. */ - IF ( pEfapWrapper->hEfap != NULL ) + IF( pEfapWrapper->hEfap != NULL ) { efap_free_data( &pEfapWrapper->hEfap ); } /* Only initialize EFAP handle if output config is channel-based */ - IF ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { pEfapWrapper->hEfap = NULL; return IVAS_ERR_OK; } - IF ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - /*float2fix block: to be removed*/ - floatToFixed_arrL( (float *) pCustomLsOut->ls_azimuth, (Word32 *) pCustomLsOut->ls_azimuth_fx, Q22, pCustomLsOut->num_spk ); - floatToFixed_arrL( (float *) pCustomLsOut->ls_elevation, (Word32 *) pCustomLsOut->ls_elevation_fx, Q22, pCustomLsOut->num_spk ); - /*float2fix block end*/ - if ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth_fx, pCustomLsOut->ls_elevation_fx, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth_fx, pCustomLsOut->ls_elevation_fx, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } } ELSE { - IF ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) + IF( ( error = getSpeakerAzimuths_fx( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) + IF( ( error = getSpeakerElevations_fx( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) + IF( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) { return error; } - - /*float2fix block: to be removed*/ - floatToFixed_arrL( (float *) azimuths, azimuths_fx, Q22, numNonLfeChannels ); - floatToFixed_arrL( (float *) elevations, elevations_fx, Q22, numNonLfeChannels ); - /*float2fix block end*/ - IF ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths_fx, elevations_fx, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -1667,71 +1658,71 @@ static ivas_error initEfap( return IVAS_ERR_OK; } #else -static ivas_error initEfap( - EFAP_WRAPPER *pEfapWrapper, - AUDIO_CONFIG outConfig, - const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) -{ - ivas_error error; - const float *azimuths; - const float *elevations; - int16_t numNonLfeChannels; + static ivas_error initEfap( + EFAP_WRAPPER * pEfapWrapper, + AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) + { + ivas_error error; + const float *azimuths; + const float *elevations; + int16_t numNonLfeChannels; - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; - } - else - { - pEfapWrapper->speakerConfig = outConfig; - } - pEfapWrapper->pCustomLsSetup = pCustomLsOut; + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; + } + else + { + pEfapWrapper->speakerConfig = outConfig; + } + pEfapWrapper->pCustomLsSetup = pCustomLsOut; - /* If re-initializing, free existing EFAP handle. */ - if ( pEfapWrapper->hEfap != NULL ) - { - efap_free_data( &pEfapWrapper->hEfap ); - } + /* If re-initializing, free existing EFAP handle. */ + if ( pEfapWrapper->hEfap != NULL ) + { + efap_free_data( &pEfapWrapper->hEfap ); + } - /* Only initialize EFAP handle if output config is channel-based */ - if ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - pEfapWrapper->hEfap = NULL; - return IVAS_ERR_OK; - } + /* Only initialize EFAP handle if output config is channel-based */ + if ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + pEfapWrapper->hEfap = NULL; + return IVAS_ERR_OK; + } - if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( error = efap_init_data( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth, pCustomLsOut->ls_elevation, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( error = efap_init_data( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth, pCustomLsOut->ls_elevation, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = efap_init_data( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( ( error = efap_init_data( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED @@ -1803,67 +1794,67 @@ static ivas_error getEfapGains_fx( return IVAS_ERR_OK; } #else -static ivas_error getEfapGains( - EFAP_WRAPPER efapWrapper, - const float azi, - const float ele, - pan_vector panGains ) -{ - pan_vector tmpPanGains; /* tmp pan gain buffer without LFE channels */ - float *readPtr; - int16_t i; - int16_t lfeCount; - int16_t numChannels; - ivas_error error; - - /* EFAP returns an array of gains only for non-LFE speakers */ - efap_determine_gains( efapWrapper.hEfap, tmpPanGains, azi, ele, EFAP_MODE_EFAP ); + static ivas_error getEfapGains( + EFAP_WRAPPER efapWrapper, + const float azi, + const float ele, + pan_vector panGains ) + { + pan_vector tmpPanGains; /* tmp pan gain buffer without LFE channels */ + float *readPtr; + int16_t i; + int16_t lfeCount; + int16_t numChannels; + ivas_error error; - /* Now copy to buffer that includes LFE channels */ - if ( efapWrapper.speakerConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - numChannels = efapWrapper.pCustomLsSetup->num_spk + efapWrapper.pCustomLsSetup->num_lfe; - readPtr = tmpPanGains; + /* EFAP returns an array of gains only for non-LFE speakers */ + efap_determine_gains( efapWrapper.hEfap, tmpPanGains, azi, ele, EFAP_MODE_EFAP ); - for ( i = 0, lfeCount = 0; i < numChannels; ++i ) - { - if ( lfeCount < efapWrapper.pCustomLsSetup->num_lfe && i == efapWrapper.pCustomLsSetup->lfe_idx[lfeCount] ) + /* Now copy to buffer that includes LFE channels */ + if ( efapWrapper.speakerConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - panGains[i] = 0.0f; - ++lfeCount; + numChannels = efapWrapper.pCustomLsSetup->num_spk + efapWrapper.pCustomLsSetup->num_lfe; + readPtr = tmpPanGains; + + for ( i = 0, lfeCount = 0; i < numChannels; ++i ) + { + if ( lfeCount < efapWrapper.pCustomLsSetup->num_lfe && i == efapWrapper.pCustomLsSetup->lfe_idx[lfeCount] ) + { + panGains[i] = 0.0f; + ++lfeCount; + } + else + { + panGains[i] = *readPtr; + ++readPtr; + } + } } else { - panGains[i] = *readPtr; - ++readPtr; - } - } - } - else - { - if ( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - readPtr = tmpPanGains; + readPtr = tmpPanGains; - for ( i = 0; i < numChannels; ++i ) - { - if ( i == LFE_CHANNEL ) - { - panGains[i] = 0.0f; - } - else - { - panGains[i] = *readPtr; - ++readPtr; + for ( i = 0; i < numChannels; ++i ) + { + if ( i == LFE_CHANNEL ) + { + panGains[i] = 0.0f; + } + else + { + panGains[i] = *readPtr; + ++readPtr; + } + } } - } - } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED @@ -1909,43 +1900,43 @@ static ivas_error initHeadRotation_fx( return IVAS_ERR_OK; } #else -static ivas_error initHeadRotation( - IVAS_REND_HANDLE hIvasRend ) -{ - int16_t i, crossfade_len; - float tmp; - ivas_error error; + static ivas_error initHeadRotation( + IVAS_REND_HANDLE hIvasRend ) + { + int16_t i, crossfade_len; + float tmp; + ivas_error error; - /* Head rotation is enabled by default */ - hIvasRend->headRotData.headRotEnabled = 1; + /* Head rotation is enabled by default */ + hIvasRend->headRotData.headRotEnabled = 1; - /* Initialize 5ms crossfade */ - crossfade_len = L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES; - tmp = 1.f / ( crossfade_len - 1 ); - for ( i = 0; i < crossfade_len; i++ ) - { - hIvasRend->headRotData.crossfade[i] = i * tmp; - } + /* Initialize 5ms crossfade */ + crossfade_len = L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES; + tmp = 1.f / ( crossfade_len - 1 ); + for ( i = 0; i < crossfade_len; i++ ) + { + hIvasRend->headRotData.crossfade[i] = i * tmp; + } - /* Initialize with unit quaternions */ - for ( i = 0; i < hIvasRend->num_subframes; ++i ) - { - hIvasRend->headRotData.headPositions[i] = quaternionInit(); - } + /* Initialize with unit quaternions */ + for ( i = 0; i < hIvasRend->num_subframes; ++i ) + { + hIvasRend->headRotData.headPositions[i] = quaternionInit(); + } - if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); - } + if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); + } - if ( ( error = ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif @@ -1962,16 +1953,16 @@ static void closeHeadRotation( return; } #else -static void closeHeadRotation( - IVAS_REND_HANDLE hIvasRend ) -{ - if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) - { - free( hIvasRend->headRotData.hOrientationTracker ); - } + static void closeHeadRotation( + IVAS_REND_HANDLE hIvasRend ) + { + if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) + { + free( hIvasRend->headRotData.hOrientationTracker ); + } - return; -} + return; + } #endif @@ -2147,17 +2138,17 @@ static TDREND_WRAPPER defaultTdRendWrapper( return w; } #else -static TDREND_WRAPPER defaultTdRendWrapper( - void ) -{ - TDREND_WRAPPER w; + static TDREND_WRAPPER defaultTdRendWrapper( + void ) + { + TDREND_WRAPPER w; - w.binaural_latency_ns = 0; - w.hBinRendererTd = NULL; - w.hHrtfTD = NULL; + w.binaural_latency_ns = 0; + w.hBinRendererTd = NULL; + w.hHrtfTD = NULL; - return w; -} + return w; + } #endif @@ -2178,19 +2169,19 @@ static bool isIoConfigPairSupported( return true; } #else -static bool isIoConfigPairSupported( - const AUDIO_CONFIG inConfig, - const AUDIO_CONFIG outConfig ) -{ - /* Rendering mono or stereo to binaural is not supported */ - if ( ( inConfig == IVAS_AUDIO_CONFIG_MONO || inConfig == IVAS_AUDIO_CONFIG_STEREO ) && getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) - { - return false; - } + static bool isIoConfigPairSupported( + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig ) + { + /* Rendering mono or stereo to binaural is not supported */ + if ( ( inConfig == IVAS_AUDIO_CONFIG_MONO || inConfig == IVAS_AUDIO_CONFIG_STEREO ) && getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + { + return false; + } - /* If not returned so far, config pair is supported */ - return true; -} + /* If not returned so far, config pair is supported */ + return true; + } #endif @@ -2205,7 +2196,7 @@ static ivas_error initIsmMasaRendering( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); #endif // IVAS_FLOAT_FIXED inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -2322,15 +2313,16 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL,inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + + if ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } #else - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } #endif // IVAS_FLOAT_FIXED } } @@ -2359,7 +2351,7 @@ static void clearInputIsm( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); #endif inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -2405,29 +2397,29 @@ static void copyLsConversionMatrixToPanMatrix_fx( } #else -static void copyLsConversionMatrixToPanMatrix( - const LS_CONVERSION_MATRIX *lsConvMatrix, - pan_matrix panMatrix ) -{ - int16_t i; - int16_t inCh, outCh; - int16_t numNonZeroGains; - int16_t numColumns; + static void copyLsConversionMatrixToPanMatrix( + const LS_CONVERSION_MATRIX *lsConvMatrix, + pan_matrix panMatrix ) + { + int16_t i; + int16_t inCh, outCh; + int16_t numNonZeroGains; + int16_t numColumns; - /* Index 0 is special and describes the following values */ - numNonZeroGains = lsConvMatrix[0].index; - numColumns = (int16_t) lsConvMatrix[0].value; + /* Index 0 is special and describes the following values */ + numNonZeroGains = lsConvMatrix[0].index; + numColumns = (int16_t) lsConvMatrix[0].value; - for ( i = 1; i < numNonZeroGains + 1; ++i ) - { - inCh = lsConvMatrix[i].index / numColumns; - outCh = lsConvMatrix[i].index % numColumns; + for ( i = 1; i < numNonZeroGains + 1; ++i ) + { + inCh = lsConvMatrix[i].index / numColumns; + outCh = lsConvMatrix[i].index % numColumns; - panMatrix[inCh][outCh] = lsConvMatrix[i].value; - } + panMatrix[inCh][outCh] = lsConvMatrix[i].value; + } - return; -} + return; + } #endif static void setZeroPanMatrix( pan_matrix panMatrix ) @@ -2471,19 +2463,19 @@ static void fillIdentityPanMatrix_fx( return; } #else -/* Note: this only sets non-zero elements, call setZeroPanMatrix() to init first. */ -static void fillIdentityPanMatrix( - pan_matrix panMatrix ) -{ - int16_t i; + /* Note: this only sets non-zero elements, call setZeroPanMatrix() to init first. */ + static void fillIdentityPanMatrix( + pan_matrix panMatrix ) + { + int16_t i; - for ( i = 0; i < min( MAX_INPUT_CHANNELS, MAX_OUTPUT_CHANNELS ); ++i ) - { - panMatrix[i][i] = 1.0f; - } + for ( i = 0; i < min( MAX_INPUT_CHANNELS, MAX_OUTPUT_CHANNELS ); ++i ) + { + panMatrix[i][i] = 1.0f; + } - return; -} + return; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithIdentMatrix( @@ -2494,13 +2486,13 @@ static ivas_error initMcPanGainsWithIdentMatrix( return IVAS_ERR_OK; } #else -static ivas_error initMcPanGainsWithIdentMatrix( - input_mc *inputMc ) -{ - fillIdentityPanMatrix( inputMc->panGains ); + static ivas_error initMcPanGainsWithIdentMatrix( + input_mc * inputMc ) + { + fillIdentityPanMatrix( inputMc->panGains ); - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED @@ -2542,39 +2534,39 @@ static ivas_error initMcPanGainsWithConversionMapping_fx( } #else -static ivas_error initMcPanGainsWithConversionMapping( - input_mc *inputMc, - const AUDIO_CONFIG outConfig ) -{ - AUDIO_CONFIG ivasConfigIn, ivasConfigOut; - int16_t i; + static ivas_error initMcPanGainsWithConversionMapping( + input_mc * inputMc, + const AUDIO_CONFIG outConfig ) + { + AUDIO_CONFIG ivasConfigIn, ivasConfigOut; + int16_t i; - ivasConfigIn = inputMc->base.inConfig; - ivasConfigOut = outConfig; + ivasConfigIn = inputMc->base.inConfig; + ivasConfigOut = outConfig; - /* Find conversion mapping for current I/O config pair. - * Stay with default panning matrix if conversion_matrix is NULL */ - for ( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i ) - { - if ( ls_conversion_mapping[i].input_config == ivasConfigIn && ls_conversion_mapping[i].output_config == ivasConfigOut ) - { - /* Mapping found with valid matrix - copy */ - if ( ls_conversion_mapping[i].conversion_matrix != NULL ) - { - copyLsConversionMatrixToPanMatrix( ls_conversion_mapping[i].conversion_matrix, inputMc->panGains ); - } - /* Mapping found with NULL matrix - use identity matrix */ - else + /* Find conversion mapping for current I/O config pair. + * Stay with default panning matrix if conversion_matrix is NULL */ + for ( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i ) { - fillIdentityPanMatrix( inputMc->panGains ); + if ( ls_conversion_mapping[i].input_config == ivasConfigIn && ls_conversion_mapping[i].output_config == ivasConfigOut ) + { + /* Mapping found with valid matrix - copy */ + if ( ls_conversion_mapping[i].conversion_matrix != NULL ) + { + copyLsConversionMatrixToPanMatrix( ls_conversion_mapping[i].conversion_matrix, inputMc->panGains ); + } + /* Mapping found with NULL matrix - use identity matrix */ + else + { + fillIdentityPanMatrix( inputMc->panGains ); + } + + return IVAS_ERR_OK; + } } - return IVAS_ERR_OK; + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Missing multichannel conversion mapping" ); } - } - - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Missing multichannel conversion mapping" ); -} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithEfap_fx( @@ -2653,71 +2645,71 @@ static ivas_error initMcPanGainsWithEfap_fx( return IVAS_ERR_OK; } #else -static ivas_error initMcPanGainsWithEfap( - input_mc *inputMc, - const AUDIO_CONFIG outConfig ) -{ - int16_t i; - int16_t numNonLfeInChannels; - int16_t inLfeChIdx, outChIdx; - const float *spkAzi, *spkEle; - ivas_error error; - - if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) + static ivas_error initMcPanGainsWithEfap( + input_mc * inputMc, + const AUDIO_CONFIG outConfig ) { - return error; - } + int16_t i; + int16_t numNonLfeInChannels; + int16_t inLfeChIdx, outChIdx; + const float *spkAzi, *spkEle; + ivas_error error; - if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) + { + return error; + } - inLfeChIdx = LFE_CHANNEL; - } - else - { - numNonLfeInChannels = inputMc->customLsInput.num_spk; - spkAzi = inputMc->customLsInput.ls_azimuth; - spkEle = inputMc->customLsInput.ls_elevation; - inLfeChIdx = -1; - if ( inputMc->customLsInput.num_lfe > 0 ) - { - inLfeChIdx = inputMc->customLsInput.lfe_idx[0]; - } - } + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) + { + return error; + } - for ( i = 0, outChIdx = 0; i < numNonLfeInChannels; ++i, ++outChIdx ) - { - if ( i == inLfeChIdx ) - { - ++outChIdx; - } + inLfeChIdx = LFE_CHANNEL; + } + else + { + numNonLfeInChannels = inputMc->customLsInput.num_spk; + spkAzi = inputMc->customLsInput.ls_azimuth; + spkEle = inputMc->customLsInput.ls_elevation; + inLfeChIdx = -1; + if ( inputMc->customLsInput.num_lfe > 0 ) + { + inLfeChIdx = inputMc->customLsInput.lfe_idx[0]; + } + } - if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, spkAzi[i], spkEle[i], inputMc->panGains[outChIdx] ) ) != IVAS_ERR_OK ) - { - return error; - } - } + for ( i = 0, outChIdx = 0; i < numNonLfeInChannels; ++i, ++outChIdx ) + { + if ( i == inLfeChIdx ) + { + ++outChIdx; + } - if ( outConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inLfeChIdx >= 0 ) - { - inputMc->panGains[inLfeChIdx][LFE_CHANNEL] = 1; - } - else if ( inputMc->base.ctx.pCustomLsOut->num_lfe > 0 && inLfeChIdx >= 0 ) - { - inputMc->panGains[inLfeChIdx][inputMc->base.ctx.pCustomLsOut->lfe_idx[0]] = 1; - } + if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, spkAzi[i], spkEle[i], inputMc->panGains[outChIdx] ) ) != IVAS_ERR_OK ) + { + return error; + } + } - return IVAS_ERR_OK; -} + if ( outConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inLfeChIdx >= 0 ) + { + inputMc->panGains[inLfeChIdx][LFE_CHANNEL] = 1; + } + else if ( inputMc->base.ctx.pCustomLsOut->num_lfe > 0 && inLfeChIdx >= 0 ) + { + inputMc->panGains[inLfeChIdx][inputMc->base.ctx.pCustomLsOut->lfe_idx[0]] = 1; + } + + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error getRendInputNumChannels( @@ -2749,34 +2741,34 @@ static ivas_error getRendInputNumChannels( return IVAS_ERR_OK; } #else -static ivas_error getRendInputNumChannels( - const void *rendInput, - int16_t *numInChannels ) -{ - /* Using a void pointer for this function to be reusable for any input type (input_ism, input_mc, input_sba). - Assumptions: - input_base is always the first member in the input struct */ + static ivas_error getRendInputNumChannels( + const void *rendInput, + int16_t *numInChannels ) + { + /* Using a void pointer for this function to be reusable for any input type (input_ism, input_mc, input_sba). + Assumptions: - input_base is always the first member in the input struct */ - ivas_error error; - const input_base *pInputBase; - const input_mc *pInputMc; + ivas_error error; + const input_base *pInputBase; + const input_mc *pInputMc; - pInputBase = (const input_base *) rendInput; + pInputBase = (const input_base *) rendInput; - if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - pInputMc = (const input_mc *) rendInput; - *numInChannels = pInputMc->customLsInput.num_spk + pInputMc->customLsInput.num_lfe; - } - else - { - if ( ( error = getAudioConfigNumChannels( pInputBase->inConfig, numInChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + pInputMc = (const input_mc *) rendInput; + *numInChannels = pInputMc->customLsInput.num_spk + pInputMc->customLsInput.num_lfe; + } + else + { + if ( ( error = getAudioConfigNumChannels( pInputBase->inConfig, numInChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithMonoOut_fx( @@ -3054,55 +3046,55 @@ static bool configsAreEqual( return configA == configB; } #else -static bool configsAreEqual( - const AUDIO_CONFIG configA, - const LSSETUP_CUSTOM_STRUCT customLsA, - const AUDIO_CONFIG configB, - const LSSETUP_CUSTOM_STRUCT customLsB ) -{ - int16_t i; - - /* Both input and output are custom LS - compare structs */ - if ( configA == IVAS_AUDIO_CONFIG_LS_CUSTOM && configB == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( customLsA.num_spk != customLsB.num_spk ) + static bool configsAreEqual( + const AUDIO_CONFIG configA, + const LSSETUP_CUSTOM_STRUCT customLsA, + const AUDIO_CONFIG configB, + const LSSETUP_CUSTOM_STRUCT customLsB ) { - return false; - } + int16_t i; - if ( customLsA.num_lfe != customLsB.num_lfe ) - { - return false; - } + /* Both input and output are custom LS - compare structs */ + if ( configA == IVAS_AUDIO_CONFIG_LS_CUSTOM && configB == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( customLsA.num_spk != customLsB.num_spk ) + { + return false; + } - if ( customLsA.is_planar_setup != customLsB.is_planar_setup ) - { - return false; - } + if ( customLsA.num_lfe != customLsB.num_lfe ) + { + return false; + } - for ( i = 0; i < customLsA.num_spk; ++i ) - { - /* Compare to nearest degree (hence the int16_t cast) */ - if ( (int16_t) customLsA.ls_azimuth[i] != (int16_t) customLsB.ls_azimuth[i] || - (int16_t) customLsA.ls_elevation[i] != (int16_t) customLsB.ls_elevation[i] ) - { - return false; - } - } - for ( i = 0; i < customLsA.num_lfe; ++i ) - { - if ( customLsA.lfe_idx[i] != customLsB.lfe_idx[i] ) - { - return false; - } - } + if ( customLsA.is_planar_setup != customLsB.is_planar_setup ) + { + return false; + } - return true; - } + for ( i = 0; i < customLsA.num_spk; ++i ) + { + /* Compare to nearest degree (hence the int16_t cast) */ + if ( (int16_t) customLsA.ls_azimuth[i] != (int16_t) customLsB.ls_azimuth[i] || + (int16_t) customLsA.ls_elevation[i] != (int16_t) customLsB.ls_elevation[i] ) + { + return false; + } + } + for ( i = 0; i < customLsA.num_lfe; ++i ) + { + if ( customLsA.lfe_idx[i] != customLsB.lfe_idx[i] ) + { + return false; + } + } - /* Otherwise it's enough to compare config enums */ - return configA == configB; -} + return true; + } + + /* Otherwise it's enough to compare config enums */ + return configA == configB; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateLfePanGainsForMcOut( @@ -3148,48 +3140,48 @@ static ivas_error updateLfePanGainsForMcOut( return error; } #else -static ivas_error updateLfePanGainsForMcOut( - input_mc *inputMc, - const AUDIO_CONFIG outConfig ) -{ - int16_t i, numLfeIn, numOutChannels; - ivas_error error; - error = IVAS_ERR_OK; + static ivas_error updateLfePanGainsForMcOut( + input_mc * inputMc, + const AUDIO_CONFIG outConfig ) + { + int16_t i, numLfeIn, numOutChannels; + ivas_error error; + error = IVAS_ERR_OK; - /* If panning is not required, simply return */ - if ( !inputMc->lfeRouting.pan_lfe ) - { - return error; - } + /* If panning is not required, simply return */ + if ( !inputMc->lfeRouting.pan_lfe ) + { + return error; + } - numLfeIn = getNumLfeChannels( inputMc ); + numLfeIn = getNumLfeChannels( inputMc ); - if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - numOutChannels = inputMc->base.ctx.pCustomLsOut->num_spk + inputMc->base.ctx.pCustomLsOut->num_lfe; - } - else - { - if ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + numOutChannels = inputMc->base.ctx.pCustomLsOut->num_spk + inputMc->base.ctx.pCustomLsOut->num_lfe; + } + else + { + if ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + } - for ( i = 0; i < numLfeIn; i++ ) - { - /* panning gains */ - if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth, inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i] ) ) != IVAS_ERR_OK ) - { - return error; - } + for ( i = 0; i < numLfeIn; i++ ) + { + /* panning gains */ + if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth, inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i] ) ) != IVAS_ERR_OK ) + { + return error; + } - /* linear input gain */ - v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], numOutChannels ); - } + /* linear input gain */ + v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], numOutChannels ); + } - return error; -} + return error; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateLfePanGainsForAmbiOut( @@ -3202,19 +3194,19 @@ static ivas_error updateLfePanGainsForAmbiOut( error = IVAS_ERR_OK; /* If panning is not required, simply return */ - IF ( !inputMc->lfeRouting.pan_lfe ) + IF( !inputMc->lfeRouting.pan_lfe ) { return error; } - IF ( ( error = getAmbisonicsOrder_fx( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) + IF( ( error = getAmbisonicsOrder_fx( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) { return error; } numLfeIn = getNumLfeChannels( inputMc ); move16(); - FOR ( i = 0; i < numLfeIn; i++ ) + FOR( i = 0; i < numLfeIn; i++ ) { /* panning gains */ ivas_dirac_dec_get_response_fixed( inputMc->lfeRouting.lfeOutputAzimuth_fx, inputMc->lfeRouting.lfeOutputElevation_fx, inputMc->lfeRouting.lfePanMtx_fx[i], outAmbiOrder ); @@ -3226,39 +3218,39 @@ static ivas_error updateLfePanGainsForAmbiOut( return error; } #else -static ivas_error updateLfePanGainsForAmbiOut( - input_mc *inputMc, - const AUDIO_CONFIG outConfig ) -{ - int16_t i; - int16_t numLfeIn, outAmbiOrder; - ivas_error error; - error = IVAS_ERR_OK; + static ivas_error updateLfePanGainsForAmbiOut( + input_mc * inputMc, + const AUDIO_CONFIG outConfig ) + { + int16_t i; + int16_t numLfeIn, outAmbiOrder; + ivas_error error; + error = IVAS_ERR_OK; - /* If panning is not required, simply return */ - if ( !inputMc->lfeRouting.pan_lfe ) - { - return error; - } + /* If panning is not required, simply return */ + if ( !inputMc->lfeRouting.pan_lfe ) + { + return error; + } - if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) + { + return error; + } - numLfeIn = getNumLfeChannels( inputMc ); + numLfeIn = getNumLfeChannels( inputMc ); - for ( i = 0; i < numLfeIn; i++ ) - { - /* panning gains */ - ivas_dirac_dec_get_response( (int16_t) inputMc->lfeRouting.lfeOutputAzimuth, (int16_t) inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i], outAmbiOrder ); + for ( i = 0; i < numLfeIn; i++ ) + { + /* panning gains */ + ivas_dirac_dec_get_response( (int16_t) inputMc->lfeRouting.lfeOutputAzimuth, (int16_t) inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i], outAmbiOrder ); - /* linear input gain */ - v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); - } + /* linear input gain */ + v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); + } - return error; -} + return error; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateMcPanGainsForMcOut( @@ -3328,67 +3320,67 @@ static ivas_error updateMcPanGainsForMcOut( return error; } #else -static ivas_error updateMcPanGainsForMcOut( - input_mc *inputMc, - const AUDIO_CONFIG outConfig ) -{ - ivas_error error; + static ivas_error updateMcPanGainsForMcOut( + input_mc * inputMc, + const AUDIO_CONFIG outConfig ) + { + ivas_error error; - /* "if" conditions below realize the following mapping: + /* "if" conditions below realize the following mapping: - If in == out, use identity matrix, otherwise follow the table: - +-----------+-------------+---------------+-----------+--------------------+ - | in\out | MONO | STEREO | custom LS | other | - +-----------+-------------+---------------+-----------+--------------------+ - | MONO | mono out | EFAP | EFAP | EFAP | - | custom LS | mono out | EFAP | EFAP | EFAP | - | other | mono lookup | stereo lookup | EFAP | conversion mapping | - +-----------+-------------+---------------+-----------+--------------------+ - */ + If in == out, use identity matrix, otherwise follow the table: + +-----------+-------------+---------------+-----------+--------------------+ + | in\out | MONO | STEREO | custom LS | other | + +-----------+-------------+---------------+-----------+--------------------+ + | MONO | mono out | EFAP | EFAP | EFAP | + | custom LS | mono out | EFAP | EFAP | EFAP | + | other | mono lookup | stereo lookup | EFAP | conversion mapping | + +-----------+-------------+---------------+-----------+--------------------+ + */ - if ( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) - { - error = initMcPanGainsWithIdentMatrix( inputMc ); - } - else if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM || - inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO || - inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) - { - inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f; - inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0]; - error = IVAS_ERR_OK; - } - else - { - error = initMcPanGainsWithEfap( inputMc, outConfig ); - } - } - else if ( outConfig == IVAS_AUDIO_CONFIG_MONO ) - { - error = initMcPanGainsWithMonoOut( inputMc ); - } - else if ( outConfig == IVAS_AUDIO_CONFIG_STEREO ) - { - error = initMcPanGainsWithStereoLookup( inputMc ); - } - else /* default */ - { - error = initMcPanGainsWithConversionMapping( inputMc, outConfig ); - } + if ( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) + { + error = initMcPanGainsWithIdentMatrix( inputMc ); + } + else if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM || + inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO || + inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) + { + inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f; + inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0]; + error = IVAS_ERR_OK; + } + else + { + error = initMcPanGainsWithEfap( inputMc, outConfig ); + } + } + else if ( outConfig == IVAS_AUDIO_CONFIG_MONO ) + { + error = initMcPanGainsWithMonoOut( inputMc ); + } + else if ( outConfig == IVAS_AUDIO_CONFIG_STEREO ) + { + error = initMcPanGainsWithStereoLookup( inputMc ); + } + else /* default */ + { + error = initMcPanGainsWithConversionMapping( inputMc, outConfig ); + } - /* check for errors from above block */ - if ( error != IVAS_ERR_OK ) - { - return error; - } + /* check for errors from above block */ + if ( error != IVAS_ERR_OK ) + { + return error; + } - /* update LFE panning */ - error = updateLfePanGainsForMcOut( inputMc, outConfig ); + /* update LFE panning */ + error = updateLfePanGainsForMcOut( inputMc, outConfig ); - return error; -} + return error; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateMcPanGainsForAmbiOut( @@ -3484,75 +3476,75 @@ static ivas_error updateMcPanGainsForAmbiOut( return IVAS_ERR_OK; } #else -static ivas_error updateMcPanGainsForAmbiOut( - input_mc *inputMc, - const AUDIO_CONFIG outConfig ) -{ - int16_t ch_in, ch_out, lfeIdx; - int16_t numNonLfeInChannels, outAmbiOrder; - const float *spkAzi, *spkEle; - ivas_error error; - - if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) + static ivas_error updateMcPanGainsForAmbiOut( + input_mc * inputMc, + const AUDIO_CONFIG outConfig ) { - return error; - } - - if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) - { - return error; - } + int16_t ch_in, ch_out, lfeIdx; + int16_t numNonLfeInChannels, outAmbiOrder; + const float *spkAzi, *spkEle; + ivas_error error; - for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) - { - if ( ch_in == LFE_CHANNEL ) + if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) { - ++ch_out; + return error; } - ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); - } - } - else - { - numNonLfeInChannels = inputMc->customLsInput.num_spk; - spkAzi = inputMc->customLsInput.ls_azimuth; - spkEle = inputMc->customLsInput.ls_elevation; - for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) - { - for ( lfeIdx = 0; lfeIdx < inputMc->customLsInput.num_lfe; ++lfeIdx ) + if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - if ( inputMc->customLsInput.lfe_idx[lfeIdx] == ch_in ) + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) { - ++ch_out; - break; + return error; + } + + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) + { + if ( ch_in == LFE_CHANNEL ) + { + ++ch_out; + } + ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); } } + else + { + numNonLfeInChannels = inputMc->customLsInput.num_spk; + spkAzi = inputMc->customLsInput.ls_azimuth; + spkEle = inputMc->customLsInput.ls_elevation; - ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); - } - } + for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) + { + for ( lfeIdx = 0; lfeIdx < inputMc->customLsInput.num_lfe; ++lfeIdx ) + { + if ( inputMc->customLsInput.lfe_idx[lfeIdx] == ch_in ) + { + ++ch_out; + break; + } + } - /* update LFE panning */ - if ( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); + } + } - return IVAS_ERR_OK; -} + /* update LFE panning */ + if ( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateMcPanGains( @@ -3616,66 +3608,66 @@ static ivas_error updateMcPanGains( return IVAS_ERR_OK; } #else -static ivas_error updateMcPanGains( - input_mc *inputMc, - const AUDIO_CONFIG outConfig ) -{ - int16_t i; - ivas_error error; + static ivas_error updateMcPanGains( + input_mc * inputMc, + const AUDIO_CONFIG outConfig ) + { + int16_t i; + ivas_error error; - /* Reset to all zeros - some functions below only write non-zero elements. */ - setZeroPanMatrix( inputMc->panGains ); + /* Reset to all zeros - some functions below only write non-zero elements. */ + setZeroPanMatrix( inputMc->panGains ); - error = IVAS_ERR_OK; - switch ( getAudioConfigType( outConfig ) ) - { - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = updateMcPanGainsForMcOut( inputMc, outConfig ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = updateMcPanGainsForAmbiOut( inputMc, outConfig ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + error = IVAS_ERR_OK; + switch ( getAudioConfigType( outConfig ) ) { - case IVAS_AUDIO_CONFIG_BINAURAL: - break; /* Do nothing */ - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - /* Prepare rendering to intermediate format */ - error = updateMcPanGainsForMcOut( inputMc, IVAS_AUDIO_CONFIG_7_1_4 ); + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + error = updateMcPanGainsForMcOut( inputMc, outConfig ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + error = updateMcPanGainsForAmbiOut( inputMc, outConfig ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + switch ( outConfig ) + { + case IVAS_AUDIO_CONFIG_BINAURAL: + break; /* Do nothing */ + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + /* Prepare rendering to intermediate format */ + error = updateMcPanGainsForMcOut( inputMc, IVAS_AUDIO_CONFIG_7_1_4 ); + break; + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + break; /* Do nothing */ default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - break; /* Do nothing */ - default: - return IVAS_ERR_INVALID_OUTPUT_FORMAT; - } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } + /* Check error here to keep switch statement more compact */ + if ( error != IVAS_ERR_OK ) + { + return error; + } - /* Copy LFE routing to pan gains array */ - if ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - for ( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) - { - mvr2r( inputMc->lfeRouting.lfePanMtx[i], inputMc->panGains[inputMc->customLsInput.lfe_idx[i]], IVAS_MAX_OUTPUT_CHANNELS ); - } - } - else - { - /* For code simplicity, always copy LFE gains. If config has no LFE, gains will be zero anyway. */ - mvr2r( inputMc->lfeRouting.lfePanMtx[0], inputMc->panGains[LFE_CHANNEL], IVAS_MAX_OUTPUT_CHANNELS ); - } + /* Copy LFE routing to pan gains array */ + if ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + for ( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) + { + mvr2r( inputMc->lfeRouting.lfePanMtx[i], inputMc->panGains[inputMc->customLsInput.lfe_idx[i]], IVAS_MAX_OUTPUT_CHANNELS ); + } + } + else + { + /* For code simplicity, always copy LFE gains. If config has no LFE, gains will be zero anyway. */ + mvr2r( inputMc->lfeRouting.lfePanMtx[0], inputMc->panGains[LFE_CHANNEL], IVAS_MAX_OUTPUT_CHANNELS ); + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif static ivas_error initMcBinauralRendering( @@ -3712,7 +3704,7 @@ static ivas_error initMcBinauralRendering( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); #endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -3783,25 +3775,26 @@ static ivas_error initMcBinauralRendering( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { #ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL,inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + + if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } #if 1 /*Fixed to float conversions */ - FOR( Word16 k = 0; k < add( extract_l( L_shr(inputMc->hReverb->fft_size, 1 ) ), 1 ); k++ ) + FOR( Word16 k = 0; k < add( extract_l( L_shr( inputMc->hReverb->fft_size, 1 ) ), 1 ); k++ ) { - (inputMc->hReverb)->fft_filter_correl_0.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_correl_0.fft_spectrum_fx[k] / ONE_IN_Q31; - (inputMc->hReverb)->fft_filter_color_0.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_color_0.fft_spectrum_fx[k] / ONE_IN_Q31; - (inputMc->hReverb)->fft_filter_correl_1.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_correl_1.fft_spectrum_fx[k] / ONE_IN_Q31; - (inputMc->hReverb)->fft_filter_color_1.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_color_1.fft_spectrum_fx[k] / ONE_IN_Q31; + ( inputMc->hReverb )->fft_filter_correl_0.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_correl_0.fft_spectrum_fx[k] / ONE_IN_Q31; + ( inputMc->hReverb )->fft_filter_color_0.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_color_0.fft_spectrum_fx[k] / ONE_IN_Q31; + ( inputMc->hReverb )->fft_filter_correl_1.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_correl_1.fft_spectrum_fx[k] / ONE_IN_Q31; + ( inputMc->hReverb )->fft_filter_color_1.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_color_1.fft_spectrum_fx[k] / ONE_IN_Q31; } #endif #else - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } #endif } } @@ -3848,7 +3841,7 @@ static ivas_error initMcMasaRendering( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); #endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -3870,15 +3863,15 @@ static ivas_error initMcMasaRendering( #if 1 /*Fixed to float conversion for ivas_mcmasa_ana_open (to be removed later)*/ MCMASA_ANA_HANDLE hMcMasa = inputMc->hMcMasa; Word16 i, j; - fixedToFloat_arrL( hMcMasa->ls_azimuth_fx, hMcMasa->ls_azimuth, Q22, MCMASA_MAX_ANA_CHANS); - FOR ( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) + fixedToFloat_arrL( hMcMasa->ls_azimuth_fx, hMcMasa->ls_azimuth, Q22, MCMASA_MAX_ANA_CHANS ); + FOR( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) { - FOR ( j = 0; j < FOA_CHANNELS; j++ ) + FOR( j = 0; j < FOA_CHANNELS; j++ ) { hMcMasa->chnlToFoaMtx[j][i] = fixedToFloat( hMcMasa->chnlToFoaMtx_fx[j][i], Q31 ); } } - FOR( i = 0; i < (inSampleRate/FRAMES_PER_SEC); i++ ) + FOR( i = 0; i < ( inSampleRate / FRAMES_PER_SEC ); i++ ) { hMcMasa->interpolator[i] = fixedToFloat( hMcMasa->interpolator_fx[i], Q15 ); } @@ -3951,83 +3944,83 @@ static lfe_routing defaultLfeRouting( return routing; } #else -static lfe_routing defaultLfeRouting( + static lfe_routing defaultLfeRouting( + const AUDIO_CONFIG inConfig, + const LSSETUP_CUSTOM_STRUCT customLsIn, + const AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT customLsOut ) + { + int16_t i; + lfe_routing routing; + + /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ + + for ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) + { + set_zero( routing.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); + } + + routing.pan_lfe = false; + routing.lfeInputGain = 1.0f; + + switch ( inConfig ) + { + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_7_1_4: + routing.numLfeChannels = 1; + break; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + routing.numLfeChannels = customLsIn.num_lfe; + break; + default: + routing.numLfeChannels = 0; + } + + switch ( outConfig ) + { + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_7_1_4: + routing.lfePanMtx[0][LFE_CHANNEL] = 1.0f; + break; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + for ( i = 0; i < routing.numLfeChannels && i < customLsOut.num_lfe; ++i ) + { + routing.lfePanMtx[i][customLsOut.lfe_idx[i]] = 1.0f; + } + break; + default: + /* Do nothing */ + break; + } + + return routing; + } +#endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error setRendInputActiveMc( + void *input, const AUDIO_CONFIG inConfig, - const LSSETUP_CUSTOM_STRUCT customLsIn, - const AUDIO_CONFIG outConfig, - const LSSETUP_CUSTOM_STRUCT customLsOut ) + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) { - int16_t i; - lfe_routing routing; + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_mc *inputMc; - /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ + inputMc = (input_mc *) input; + rendCtx = inputMc->base.ctx; + outConfig = *rendCtx.pOutConfig; - for ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) { - set_zero( routing.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); - } - - routing.pan_lfe = false; - routing.lfeInputGain = 1.0f; - - switch ( inConfig ) - { - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_7_1_4: - routing.numLfeChannels = 1; - break; - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - routing.numLfeChannels = customLsIn.num_lfe; - break; - default: - routing.numLfeChannels = 0; - } - - switch ( outConfig ) - { - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_7_1_4: - routing.lfePanMtx[0][LFE_CHANNEL] = 1.0f; - break; - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - for ( i = 0; i < routing.numLfeChannels && i < customLsOut.num_lfe; ++i ) - { - routing.lfePanMtx[i][customLsOut.lfe_idx[i]] = 1.0f; - } - break; - default: - /* Do nothing */ - break; - } - - return routing; -} -#endif -#ifdef IVAS_FLOAT_FIXED -static ivas_error setRendInputActiveMc( - void *input, - const AUDIO_CONFIG inConfig, - const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) -{ - ivas_error error; - rendering_context rendCtx; - AUDIO_CONFIG outConfig; - input_mc *inputMc; - - inputMc = (input_mc *) input; - rendCtx = inputMc->base.ctx; - outConfig = *rendCtx.pOutConfig; - - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) - { - return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) @@ -4089,72 +4082,72 @@ static ivas_error setRendInputActiveMc( return IVAS_ERR_OK; } #else -static ivas_error setRendInputActiveMc( - void *input, - const AUDIO_CONFIG inConfig, - const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) -{ - ivas_error error; - rendering_context rendCtx; - AUDIO_CONFIG outConfig; - input_mc *inputMc; + static ivas_error setRendInputActiveMc( + void *input, + const AUDIO_CONFIG inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) + { + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_mc *inputMc; - inputMc = (input_mc *) input; - rendCtx = inputMc->base.ctx; - outConfig = *rendCtx.pOutConfig; + inputMc = (input_mc *) input; + rendCtx = inputMc->base.ctx; + outConfig = *rendCtx.pOutConfig; - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) - { - return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; - } + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } - if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } - initRendInputBase( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH ); + if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } + initRendInputBase( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH ); - setZeroPanMatrix( inputMc->panGains ); - inputMc->customLsInput = defaultCustomLs(); - inputMc->tdRendWrapper = defaultTdRendWrapper(); - inputMc->crendWrapper = NULL; - inputMc->hReverb = NULL; - inputMc->hMcMasa = NULL; + setZeroPanMatrix( inputMc->panGains ); + inputMc->customLsInput = defaultCustomLs(); + inputMc->tdRendWrapper = defaultTdRendWrapper(); + inputMc->crendWrapper = NULL; + inputMc->hReverb = NULL; + inputMc->hMcMasa = NULL; - initRotGains( inputMc->rot_gains_prev ); - inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); - set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); - inputMc->binauralDelaySmp = 0; + initRotGains( inputMc->rot_gains_prev ); + inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); + set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); + inputMc->binauralDelaySmp = 0; - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) + { + return error; + } + } - if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) - { - if ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + { + if ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } - if ( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED static void clearInputMc( @@ -4197,38 +4190,38 @@ static void clearInputMc( return; } #else -static void clearInputMc( - input_mc *inputMc ) -{ - rendering_context rendCtx; + static void clearInputMc( + input_mc * inputMc ) + { + rendering_context rendCtx; - rendCtx = inputMc->base.ctx; + rendCtx = inputMc->base.ctx; - freeMcLfeDelayBuffer( &inputMc->lfeDelayBuffer ); - freeInputBaseBufferData( &inputMc->bufferData ); - initRendInputBase( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); + freeMcLfeDelayBuffer( &inputMc->lfeDelayBuffer ); + freeInputBaseBufferData( &inputMc->bufferData ); + initRendInputBase( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); - /* Free input's internal handles */ - if ( inputMc->efapInWrapper.hEfap != NULL ) - { - efap_free_data( &inputMc->efapInWrapper.hEfap ); - } + /* Free input's internal handles */ + if ( inputMc->efapInWrapper.hEfap != NULL ) + { + efap_free_data( &inputMc->efapInWrapper.hEfap ); + } - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); - ivas_reverb_close( &inputMc->hReverb ); + ivas_reverb_close( &inputMc->hReverb ); - if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); - inputMc->tdRendWrapper.hHrtfTD = NULL; - } + if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); + inputMc->tdRendWrapper.hHrtfTD = NULL; + } - ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); + ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); - return; -} + return; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initSbaPanGainsForMcOut( @@ -4247,13 +4240,13 @@ static ivas_error initSbaPanGainsForMcOut( return error; } - IF ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { assert( !"Invalid configuration" ); return IVAS_ERR_WRONG_PARAMS; } - SWITCH ( outConfig ) + SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_MONO: hOutSetup.ls_azimuth = ls_azimuth_CICP1; @@ -4272,8 +4265,8 @@ static ivas_error initSbaPanGainsForMcOut( ivas_output_init( &hOutSetup, outConfig ); BREAK; case IVAS_AUDIO_CONFIG_LS_CUSTOM: - //ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); - ivas_ls_custom_setup_fx( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); + // ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); + ivas_ls_custom_setup_fx( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *) outSetupCustom ); BREAK; default: assert( !"Invalid speaker config" ); @@ -4282,17 +4275,17 @@ static ivas_error initSbaPanGainsForMcOut( /* obtain and copy over HOA decoding matrix */ tmpDecMtx = NULL; - IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) { return error; } readPtr = &tmpDecMtx[0]; - FOR ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) + FOR( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) { - FOR ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) + FOR( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) { - IF ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) + IF( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) { continue; /* nothing to be rendered to LFE */ } @@ -4304,75 +4297,75 @@ static ivas_error initSbaPanGainsForMcOut( return IVAS_ERR_OK; } #else -static ivas_error initSbaPanGainsForMcOut( - input_sba *inputSba, - const AUDIO_CONFIG outConfig, - const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) -{ - int16_t ambiOrderIn; - int16_t chInIdx, chOutIdx; - float *tmpDecMtx, *readPtr; - IVAS_OUTPUT_SETUP hOutSetup; - ivas_error error; + static ivas_error initSbaPanGainsForMcOut( + input_sba * inputSba, + const AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) + { + int16_t ambiOrderIn; + int16_t chInIdx, chOutIdx; + float *tmpDecMtx, *readPtr; + IVAS_OUTPUT_SETUP hOutSetup; + ivas_error error; - if ( ( error = getAmbisonicsOrder( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getAmbisonicsOrder( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - assert( !"Invalid configuration" ); - return IVAS_ERR_WRONG_PARAMS; - } + if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + assert( !"Invalid configuration" ); + return IVAS_ERR_WRONG_PARAMS; + } - switch ( outConfig ) - { - case IVAS_AUDIO_CONFIG_MONO: - hOutSetup.ls_azimuth = ls_azimuth_CICP1; - hOutSetup.ls_elevation = ls_elevation_CICP1; - ivas_output_init( &hOutSetup, outConfig ); - break; - case IVAS_AUDIO_CONFIG_STEREO: - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1_4: - ivas_output_init( &hOutSetup, outConfig ); - break; - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); - break; - default: - assert( !"Invalid speaker config" ); - return IVAS_ERR_WRONG_PARAMS; - } + switch ( outConfig ) + { + case IVAS_AUDIO_CONFIG_MONO: + hOutSetup.ls_azimuth = ls_azimuth_CICP1; + hOutSetup.ls_elevation = ls_elevation_CICP1; + ivas_output_init( &hOutSetup, outConfig ); + break; + case IVAS_AUDIO_CONFIG_STEREO: + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1_4: + ivas_output_init( &hOutSetup, outConfig ); + break; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); + break; + default: + assert( !"Invalid speaker config" ); + return IVAS_ERR_WRONG_PARAMS; + } - /* obtain and copy over HOA decoding matrix */ - tmpDecMtx = NULL; - if ( ( error = ivas_sba_get_hoa_dec_matrix( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) - { - return error; - } + /* obtain and copy over HOA decoding matrix */ + tmpDecMtx = NULL; + if ( ( error = ivas_sba_get_hoa_dec_matrix( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + { + return error; + } - readPtr = &tmpDecMtx[0]; - for ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) - { - for ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) - { - if ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) + readPtr = &tmpDecMtx[0]; + for ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) { - continue; /* nothing to be rendered to LFE */ + for ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) + { + if ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) + { + continue; /* nothing to be rendered to LFE */ + } + inputSba->hoaDecMtx[chInIdx][chOutIdx] = *readPtr++; + } } - inputSba->hoaDecMtx[chInIdx][chOutIdx] = *readPtr++; - } - } - free( tmpDecMtx ); + free( tmpDecMtx ); - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED @@ -4394,23 +4387,23 @@ static ivas_error initSbaPanGainsForSbaOut( return error; } #else -static ivas_error initSbaPanGainsForSbaOut( - input_sba *inputSba, - const AUDIO_CONFIG outConfig ) -{ - ivas_error error; - error = IVAS_ERR_OK; + static ivas_error initSbaPanGainsForSbaOut( + input_sba * inputSba, + const AUDIO_CONFIG outConfig ) + { + ivas_error error; + error = IVAS_ERR_OK; - if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) - { - assert( !"Invalid configuration" ); - return IVAS_ERR_WRONG_PARAMS; - } + if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + { + assert( !"Invalid configuration" ); + return IVAS_ERR_WRONG_PARAMS; + } - fillIdentityPanMatrix( inputSba->hoaDecMtx ); + fillIdentityPanMatrix( inputSba->hoaDecMtx ); - return error; -} + return error; + } #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateSbaPanGains( @@ -4423,13 +4416,13 @@ static ivas_error updateSbaPanGains( rendering_context rendCtx; /* Reset to all zeros - some functions below only write non-zero elements. */ - //setZeroPanMatrix( inputSba->hoaDecMtx ); + // setZeroPanMatrix( inputSba->hoaDecMtx ); setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); inConfig = inputSba->base.inConfig; rendCtx = inputSba->base.ctx; - SWITCH ( getAudioConfigType( outConfig ) ) + SWITCH( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: error = initSbaPanGainsForMcOut( inputSba, outConfig, inputSba->base.ctx.pCustomLsOut ); @@ -4438,25 +4431,25 @@ static ivas_error updateSbaPanGains( error = initSbaPanGainsForSbaOut( inputSba, outConfig ); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - SWITCH ( outConfig ) + SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: { - IF ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - BREAK; + BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - IF ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + IF( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -4473,7 +4466,7 @@ static ivas_error updateSbaPanGains( } /* Check error here to keep switch statement more compact */ - IF ( error != IVAS_ERR_OK ) + IF( error != IVAS_ERR_OK ) { return error; } @@ -4481,72 +4474,72 @@ static ivas_error updateSbaPanGains( return IVAS_ERR_OK; } #else -static ivas_error updateSbaPanGains( - input_sba *inputSba, - const AUDIO_CONFIG outConfig, - RENDER_CONFIG_DATA *hRendCfg ) -{ - ivas_error error; - AUDIO_CONFIG inConfig; - rendering_context rendCtx; + static ivas_error updateSbaPanGains( + input_sba * inputSba, + const AUDIO_CONFIG outConfig, + RENDER_CONFIG_DATA *hRendCfg ) + { + ivas_error error; + AUDIO_CONFIG inConfig; + rendering_context rendCtx; - /* Reset to all zeros - some functions below only write non-zero elements. */ - setZeroPanMatrix( inputSba->hoaDecMtx ); + /* Reset to all zeros - some functions below only write non-zero elements. */ + setZeroPanMatrix( inputSba->hoaDecMtx ); - inConfig = inputSba->base.inConfig; - rendCtx = inputSba->base.ctx; + inConfig = inputSba->base.inConfig; + rendCtx = inputSba->base.ctx; - switch ( getAudioConfigType( outConfig ) ) - { - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = initSbaPanGainsForMcOut( inputSba, outConfig, inputSba->base.ctx.pCustomLsOut ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = initSbaPanGainsForSbaOut( inputSba, outConfig ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + switch ( getAudioConfigType( outConfig ) ) { - case IVAS_AUDIO_CONFIG_BINAURAL: - { - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - - { - return error; - } - } - break; - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + error = initSbaPanGainsForMcOut( inputSba, outConfig, inputSba->base.ctx.pCustomLsOut ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + error = initSbaPanGainsForSbaOut( inputSba, outConfig ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + switch ( outConfig ) { - return error; - } + case IVAS_AUDIO_CONFIG_BINAURAL: + { + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; + { + return error; + } + } + break; + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + break; + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; } break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + error = IVAS_ERR_OK; + break; /* Do nothing */ default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - error = IVAS_ERR_OK; - break; /* Do nothing */ - default: - return IVAS_ERR_INVALID_OUTPUT_FORMAT; - } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } + /* Check error here to keep switch statement more compact */ + if ( error != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif @@ -4559,75 +4552,22 @@ static ivas_error initSbaMasaRendering( ivas_rend_closeCrend( &inputSba->crendWrapper ); #ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_dirac_ana_open_fx( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_dirac_ana_open_fx( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { return error; } #else - if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - - return IVAS_ERR_OK; -} - - -#ifdef IVAS_FLOAT_FIXED -static ivas_error setRendInputActiveSba( - void *input, - const AUDIO_CONFIG inConfig, - const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) -{ - ivas_error error; - rendering_context rendCtx; - AUDIO_CONFIG outConfig; - input_sba *inputSba; - - inputSba = (input_sba *) input; - rendCtx = inputSba->base.ctx; - outConfig = *rendCtx.pOutConfig; - - IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) - { - return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; - } - - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } - IF ( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } - initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); - initRendInputBase_fx( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData_fx, MAX_BUFFER_LENGTH ); - - setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); - - inputSba->crendWrapper = NULL; - inputSba->hDirAC = NULL; - initRotGains_fx( inputSba->rot_gains_prev_fx ); - - IF ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) - { - IF ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - IF ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif - return error; + return IVAS_ERR_OK; } -#else + + +#ifdef IVAS_FLOAT_FIXED static ivas_error setRendInputActiveSba( void *input, const AUDIO_CONFIG inConfig, @@ -4643,7 +4583,7 @@ static ivas_error setRendInputActiveSba( rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + IF( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } @@ -4652,30 +4592,83 @@ static ivas_error setRendInputActiveSba( { return error; } - + IF( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); + initRendInputBase_fx( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData_fx, MAX_BUFFER_LENGTH ); - setZeroPanMatrix( inputSba->hoaDecMtx ); + setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); inputSba->crendWrapper = NULL; inputSba->hDirAC = NULL; - initRotGains( inputSba->rot_gains_prev ); + initRotGains_fx( inputSba->rot_gains_prev_fx ); - if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + IF( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) { - if ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + IF( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { return error; } return error; } +#else + static ivas_error setRendInputActiveSba( + void *input, + const AUDIO_CONFIG inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) + { + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_sba *inputSba; + + inputSba = (input_sba *) input; + rendCtx = inputSba->base.ctx; + outConfig = *rendCtx.pOutConfig; + + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } + + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); + + setZeroPanMatrix( inputSba->hoaDecMtx ); + + inputSba->crendWrapper = NULL; + inputSba->hDirAC = NULL; + initRotGains( inputSba->rot_gains_prev ); + + if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + { + if ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + { + return error; + } + + return error; + } #endif #ifdef IVAS_FLOAT_FIXED static void clearInputSba( @@ -4699,26 +4692,27 @@ static void clearInputSba( return; } #else -static void clearInputSba( - input_sba *inputSba ) -{ - rendering_context rendCtx; + static void clearInputSba( + input_sba * inputSba ) + { + rendering_context rendCtx; - rendCtx = inputSba->base.ctx; + rendCtx = inputSba->base.ctx; - freeInputBaseBufferData( &inputSba->bufferData ); + freeInputBaseBufferData( &inputSba->bufferData ); - initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); + initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); - /* Free input's internal handles */ - ivas_rend_closeCrend( &inputSba->crendWrapper ); + /* Free input's internal handles */ + ivas_rend_closeCrend( &inputSba->crendWrapper ); - ivas_dirac_ana_close( &( inputSba->hDirAC ) ); + ivas_dirac_ana_close( &( inputSba->hDirAC ) ); - return; -} + return; + } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error setRendInputActiveMasa( void *input, const AUDIO_CONFIG inConfig, @@ -4773,6 +4767,85 @@ static ivas_error setRendInputActiveMasa( return IVAS_ERR_OK; } +#else +static ivas_error setRendInputActiveMasa( + void *input, + const AUDIO_CONFIG inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) /* Todo: This is not used at all within MASA. Support might be better to do after refactoring. */ +{ + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_masa *inputMasa; + Word16 numInChannels; + + inputMasa = (input_masa *) input; + rendCtx = inputMasa->base.ctx; + outConfig = *rendCtx.pOutConfig; + (void) hRendCfg; /* Suppress warning */ + + IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + + IF ( ( error = allocateInputBaseBufferData_fx( &inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1/*To be removed later:(contains malloc for inputMasa->bufferData)*/ + IF ( ( error = allocateInputBaseBufferData( &inputMasa->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + initRendInputBase_fx( &inputMasa->base, inConfig, id, rendCtx, inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ); + + IF ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + { + inputMasa->metadataHasBeenFed = false; + IF ( ( error = masaPrerendOpen( &inputMasa->hMasaPrerend, EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA1) ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + IF ( ( error = initMasaExtRenderer( inputMasa, outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + inputMasa->metadataHasBeenFed = false; + } + +#if 1 /*TODO: To be removed later(fixed to float)*/ + IF( inputMasa->hMasaExtRend ) + { + DIRAC_REND_HANDLE hDirACRend = inputMasa->hMasaExtRend->hDirACRend; + IF ( hDirACRend ) + { + FOR( int i = 0; i < hDirACRend->num_outputs_dir; i++ ) + { + hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], Q15 ); + } + IF( hDirACRend->hoa_encoder_fx ) + fixedToFloat_arrL( hDirACRend->hoa_encoder_fx, hDirACRend->hoa_encoder, Q29, hDirACRend->hoa_encoder_len ); + } + IF ( inputMasa->hMasaExtRend->hDiracDecBin ) + fixedToFloat_arrL( inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection_fx, inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection, (Word16) Q28 /*1.0f Q28*/, (Word16) CLDFB_NO_CHANNELS_MAX ); + } + inputMasa->base.inputBuffer.data = inputMasa->bufferData; + fixedToFloat_arrL( inputMasa->base.inputBuffer.data_fx, inputMasa->base.inputBuffer.data, 0, MAX_BUFFER_LENGTH ); /*fixed to float only for set zero(that's why q0)*/ +#endif + return IVAS_ERR_OK; +} +#endif // IVAS_FLOAT_FIXED static void clearInputMasa( input_masa *inputMasa ) @@ -4865,48 +4938,11 @@ ivas_error IVAS_REND_Open( { return error; } -#ifdef IVAS_FLOAT_FIXED - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hIvasRend->hExternalOrientationData->Quaternions[i].w = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].w_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); - hIvasRend->hExternalOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].x_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); - hIvasRend->hExternalOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].y_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); - hIvasRend->hExternalOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasRend->hExternalOrientationData->Quaternions[i].z_fx, hIvasRend->hExternalOrientationData->Quaternions[i].q_fact ); - } - -#endif /* Initilize combined orientation data */ if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) { return error; } -#ifdef IVAS_FLOAT_FIXED - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hIvasRend->hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].w_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - hIvasRend->hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].x_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - hIvasRend->hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].y_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - hIvasRend->hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].z_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - - hIvasRend->hCombinedOrientationData->listenerPos[i].x = fixedToFloat_32( hIvasRend->hCombinedOrientationData->listenerPos[i].x_fx, hIvasRend->hCombinedOrientationData->listenerPos[i].q_fact ); - hIvasRend->hCombinedOrientationData->listenerPos[i].y = fixedToFloat_32( hIvasRend->hCombinedOrientationData->listenerPos[i].y_fx, hIvasRend->hCombinedOrientationData->listenerPos[i].q_fact ); - hIvasRend->hCombinedOrientationData->listenerPos[i].z = fixedToFloat_32( hIvasRend->hCombinedOrientationData->listenerPos[i].z_fx, hIvasRend->hCombinedOrientationData->listenerPos[i].q_fact ); - for ( Word16 j = 0; j < 3; j++ ) - { - for ( Word16 k = 0; k < 3; k++ ) - { - hIvasRend->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( hIvasRend->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); - } - } - } - for ( Word16 j = 0; j < 3; j++ ) - { - for ( Word16 k = 0; k < 3; k++ ) - { - hIvasRend->hCombinedOrientationData->Rmat_prev[j][k] = (float) fixedToFloat_32( hIvasRend->hCombinedOrientationData->Rmat_prev_fx[j][k], 30 ); - } - } -#endif /* Initialize EFAP */ if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) { @@ -4943,7 +4979,7 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; Word32 temp = ( abs( (Word32) nonDiegeticPanGain ) ); - hIvasRend->inputsMc[i].nonDiegeticPanGain_fx = ( temp == 1 ) ? ( ( nonDiegeticPanGain < 0 ) ? L_negate( ONE_IN_Q31 ) : ONE_IN_Q31 ) :(Word32) (nonDiegeticPanGain * ( ONE_IN_Q31 )); + hIvasRend->inputsMc[i].nonDiegeticPanGain_fx = ( temp == 1 ) ? ( ( nonDiegeticPanGain < 0 ) ? L_negate( ONE_IN_Q31 ) : ONE_IN_Q31 ) : (Word32) ( nonDiegeticPanGain * ( ONE_IN_Q31 ) ); hIvasRend->inputsMc[i].hMcMasa = NULL; } @@ -4971,143 +5007,143 @@ ivas_error IVAS_REND_Open( return IVAS_ERR_OK; } #else -/*------------------------------------------------------------------------- - * IVAS_REND_Open() - * - * - *------------------------------------------------------------------------*/ - -ivas_error IVAS_REND_Open( - IVAS_REND_HANDLE *phIvasRend, - const int32_t outputSampleRate, - const AUDIO_CONFIG outConfig, - const int16_t nonDiegeticPan, - const float nonDiegeticPanGain, - const int16_t num_subframes ) -{ - int16_t i; - IVAS_REND_HANDLE hIvasRend; - ivas_error error; - int16_t numOutChannels; - - /* Validate function arguments */ - if ( phIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - if ( ( error = validateOutputAudioConfig( outConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + /*------------------------------------------------------------------------- + * IVAS_REND_Open() + * + * + *------------------------------------------------------------------------*/ - if ( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + ivas_error IVAS_REND_Open( + IVAS_REND_HANDLE * phIvasRend, + const int32_t outputSampleRate, + const AUDIO_CONFIG outConfig, + const int16_t nonDiegeticPan, + const float nonDiegeticPanGain, + const int16_t num_subframes ) + { + int16_t i; + IVAS_REND_HANDLE hIvasRend; + ivas_error error; + int16_t numOutChannels; - *phIvasRend = (IVAS_REND_HANDLE) malloc( sizeof( struct IVAS_REND ) ); - if ( *phIvasRend == NULL ) - { - return IVAS_ERR_FAILED_ALLOC; - } + /* Validate function arguments */ + if ( phIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - hIvasRend = *phIvasRend; - hIvasRend->sampleRateOut = outputSampleRate; - hIvasRend->outputConfig = outConfig; - hIvasRend->customLsOut = defaultCustomLs(); - hIvasRend->hLimiter = NULL; - hIvasRend->efapOutWrapper.hEfap = NULL; - hIvasRend->efapOutWrapper.pCustomLsSetup = NULL; - hIvasRend->num_subframes = num_subframes; + if ( ( error = validateOutputAudioConfig( outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize limiter */ - if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + *phIvasRend = (IVAS_REND_HANDLE) malloc( sizeof( struct IVAS_REND ) ); + if ( *phIvasRend == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } - /* Initialize headrotation data */ - if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) - { - return error; - } + hIvasRend = *phIvasRend; + hIvasRend->sampleRateOut = outputSampleRate; + hIvasRend->outputConfig = outConfig; + hIvasRend->customLsOut = defaultCustomLs(); + hIvasRend->hLimiter = NULL; + hIvasRend->efapOutWrapper.hEfap = NULL; + hIvasRend->efapOutWrapper.pCustomLsSetup = NULL; + hIvasRend->num_subframes = num_subframes; - /* Initialize external orientation data */ - if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Initialize limiter */ + if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initilize combined orientation data */ - if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize EFAP */ - if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Initialize headrotation data */ + if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize inputs */ + /* Initialize external orientation data */ + if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } - for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + /* Initilize combined orientation data */ + if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } - hIvasRend->inputsIsm[i].crendWrapper = NULL; - hIvasRend->inputsIsm[i].hReverb = NULL; - hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; - hIvasRend->inputsIsm[i].bufferData = NULL; - hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; - hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; - hIvasRend->inputsIsm[i].hOMasa = NULL; - } + /* Initialize EFAP */ + if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + { + return error; + } - for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + /* Initialize inputs */ - hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; - hIvasRend->inputsMc[i].crendWrapper = NULL; - hIvasRend->inputsMc[i].hReverb = NULL; - hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; - hIvasRend->inputsMc[i].bufferData = NULL; - hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; - hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; - hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; - hIvasRend->inputsMc[i].hMcMasa = NULL; - } + for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + hIvasRend->inputsIsm[i].crendWrapper = NULL; + hIvasRend->inputsIsm[i].hReverb = NULL; + hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; + hIvasRend->inputsIsm[i].bufferData = NULL; + hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; + hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; + hIvasRend->inputsIsm[i].hOMasa = NULL; + } - hIvasRend->inputsSba[i].crendWrapper = NULL; - hIvasRend->inputsSba[i].bufferData = NULL; - hIvasRend->inputsSba[i].hDirAC = NULL; - } + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; + hIvasRend->inputsMc[i].crendWrapper = NULL; + hIvasRend->inputsMc[i].hReverb = NULL; + hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; + hIvasRend->inputsMc[i].bufferData = NULL; + hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; + hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; + hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; + hIvasRend->inputsMc[i].hMcMasa = NULL; + } - hIvasRend->inputsMasa[i].metadataHasBeenFed = false; - hIvasRend->inputsMasa[i].bufferData = NULL; - hIvasRend->inputsMasa[i].hMasaPrerend = NULL; - hIvasRend->inputsMasa[i].hMasaExtRend = NULL; - } + for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + + hIvasRend->inputsSba[i].crendWrapper = NULL; + hIvasRend->inputsSba[i].bufferData = NULL; + hIvasRend->inputsSba[i].hDirAC = NULL; + } + for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - return IVAS_ERR_OK; -} + hIvasRend->inputsMasa[i].metadataHasBeenFed = false; + hIvasRend->inputsMasa[i].bufferData = NULL; + hIvasRend->inputsMasa[i].hMasaPrerend = NULL; + hIvasRend->inputsMasa[i].hMasaExtRend = NULL; + } + + + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( @@ -5142,32 +5178,32 @@ static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( return customLs; } #else -static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( - const IVAS_CUSTOM_LS_DATA rendCustomLsLayout ) -{ - int16_t i; - LSSETUP_CUSTOM_STRUCT customLs; + static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( + const IVAS_CUSTOM_LS_DATA rendCustomLsLayout ) + { + int16_t i; + LSSETUP_CUSTOM_STRUCT customLs; - /* Copy layout description */ - customLs.num_spk = rendCustomLsLayout.num_spk; - mvr2r( rendCustomLsLayout.azimuth, customLs.ls_azimuth, rendCustomLsLayout.num_spk ); - mvr2r( rendCustomLsLayout.elevation, customLs.ls_elevation, rendCustomLsLayout.num_spk ); + /* Copy layout description */ + customLs.num_spk = rendCustomLsLayout.num_spk; + mvr2r( rendCustomLsLayout.azimuth, customLs.ls_azimuth, rendCustomLsLayout.num_spk ); + mvr2r( rendCustomLsLayout.elevation, customLs.ls_elevation, rendCustomLsLayout.num_spk ); - customLs.is_planar_setup = 1; - for ( i = 0; i < rendCustomLsLayout.num_spk; ++i ) - { - if ( fabsf( rendCustomLsLayout.elevation[i] ) > EPSILON ) - { - customLs.is_planar_setup = 0; - break; - } - } + customLs.is_planar_setup = 1; + for ( i = 0; i < rendCustomLsLayout.num_spk; ++i ) + { + if ( fabsf( rendCustomLsLayout.elevation[i] ) > EPSILON ) + { + customLs.is_planar_setup = 0; + break; + } + } - customLs.num_lfe = rendCustomLsLayout.num_lfe; - mvs2s( rendCustomLsLayout.lfe_idx, customLs.lfe_idx, rendCustomLsLayout.num_lfe ); + customLs.num_lfe = rendCustomLsLayout.num_lfe; + mvs2s( rendCustomLsLayout.lfe_idx, customLs.lfe_idx, rendCustomLsLayout.num_lfe ); - return customLs; -} + return customLs; + } #endif @@ -5202,34 +5238,34 @@ static ivas_error validateCustomLsLayout_fx( return IVAS_ERR_OK; } #else -static ivas_error validateCustomLsLayout( - const IVAS_CUSTOM_LS_DATA layout ) -{ - int16_t i; + static ivas_error validateCustomLsLayout( + const IVAS_CUSTOM_LS_DATA layout ) + { + int16_t i; - /* Negative number of speakers or LFEs makes no sense */ - if ( layout.num_spk < 0 || layout.num_lfe < 0 ) - { - return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; - } + /* Negative number of speakers or LFEs makes no sense */ + if ( layout.num_spk < 0 || layout.num_lfe < 0 ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } - /* There must be at least one speaker or LFE in the layout */ - if ( layout.num_spk + layout.num_lfe <= 0 ) - { - return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; - } + /* There must be at least one speaker or LFE in the layout */ + if ( layout.num_spk + layout.num_lfe <= 0 ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } - /* LFE indices must be positive */ - for ( i = 0; i < layout.num_lfe; ++i ) - { - if ( layout.lfe_idx[i] < 0 ) - { - return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; - } - } + /* LFE indices must be positive */ + for ( i = 0; i < layout.num_lfe; ++i ) + { + if ( layout.lfe_idx[i] < 0 ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif @@ -5266,10 +5302,10 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( return error; } #else - if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) + { + return error; + } #endif hIvasRend->customLsOut = makeCustomLsSetup( layout ); @@ -5367,40 +5403,40 @@ ivas_error IVAS_REND_NumOutChannels( return IVAS_ERR_OK; } #else -/*-------------------------------------------------------------------* - * IVAS_REND_NumOutChannels() - * - * - *-------------------------------------------------------------------*/ + /*-------------------------------------------------------------------* + * IVAS_REND_NumOutChannels() + * + * + *-------------------------------------------------------------------*/ -ivas_error IVAS_REND_NumOutChannels( - IVAS_REND_CONST_HANDLE hIvasRend, - int16_t *numOutChannels ) -{ - ivas_error error; + ivas_error IVAS_REND_NumOutChannels( + IVAS_REND_CONST_HANDLE hIvasRend, + int16_t * numOutChannels ) + { + ivas_error error; - /* Validate function arguments */ - if ( hIvasRend == NULL || numOutChannels == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + if ( hIvasRend == NULL || numOutChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - /* Handle special cases where additional info is needed from the renderer, otherwise use getAudioConfigNumChannels() */ - switch ( hIvasRend->outputConfig ) - { - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; - break; - default: - if ( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) + /* Handle special cases where additional info is needed from the renderer, otherwise use getAudioConfigNumChannels() */ + switch ( hIvasRend->outputConfig ) { - return error; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; + break; + default: + if ( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + break; } - break; - } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif @@ -5415,15 +5451,15 @@ static IVAS_REND_InputId makeInputId( return (IVAS_REND_InputId) UL_or( UL_lshl( ( (UWord32) getAudioConfigType( config ) ), 8 ), L_add( inputIndex, 1 ) ); } #else -static IVAS_REND_InputId makeInputId( - AUDIO_CONFIG config, - const int32_t inputIndex ) -{ - /* Put config type in second byte (from LSB), put index + 1 in first byte - * - * Index is incremented here so that a valid ID can never be 0. */ - return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); -} + static IVAS_REND_InputId makeInputId( + AUDIO_CONFIG config, + const int32_t inputIndex ) + { + /* Put config type in second byte (from LSB), put index + 1 in first byte + * + * Index is incremented here so that a valid ID can never be 0. */ + return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); + } #endif @@ -5493,69 +5529,69 @@ static ivas_error getInputById( return IVAS_ERR_OK; } #else -static ivas_error getInputById( - IVAS_REND_HANDLE hIvasRend, - IVAS_REND_InputId inputId, - void **ppInput ) -{ - int32_t inputIndex; - IVAS_REND_AudioConfigType configType; - input_base *pInputBase; + static ivas_error getInputById( + IVAS_REND_HANDLE hIvasRend, + IVAS_REND_InputId inputId, + void **ppInput ) + { + int32_t inputIndex; + IVAS_REND_AudioConfigType configType; + input_base *pInputBase; - /* Reverse makeInputId() */ - inputIndex = ( inputId & 0xFF ) - 1; - configType = ( inputId & 0xFF00 ) >> 8; + /* Reverse makeInputId() */ + inputIndex = ( inputId & 0xFF ) - 1; + configType = ( inputId & 0xFF00 ) >> 8; - /* Validate values derived from input ID */ - if ( inputIndex < 0 ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - switch ( configType ) - { - case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: - if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsIsm[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - if ( inputIndex > RENDERER_MAX_MC_INPUTS ) + /* Validate values derived from input ID */ + if ( inputIndex < 0 ) { return IVAS_ERR_INVALID_INPUT_ID; } - pInputBase = &hIvasRend->inputsMc[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) + switch ( configType ) { - return IVAS_ERR_INVALID_INPUT_ID; + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsIsm[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + if ( inputIndex > RENDERER_MAX_MC_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMc[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsSba[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMasa[inputIndex].base; + break; + default: + return IVAS_ERR_INVALID_INPUT_ID; } - pInputBase = &hIvasRend->inputsSba[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) + + /* Ensure input ID matches and that input is active */ + if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) { return IVAS_ERR_INVALID_INPUT_ID; } - pInputBase = &hIvasRend->inputsMasa[inputIndex].base; - break; - default: - return IVAS_ERR_INVALID_INPUT_ID; - } - - /* Ensure input ID matches and that input is active */ - if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - /* Validation done, set value via output parameter */ - *ppInput = pInputBase; + /* Validation done, set value via output parameter */ + *ppInput = pInputBase; - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif @@ -5588,97 +5624,33 @@ static ivas_error getConstInputById( pInputBase = &hIvasRend->inputsIsm[inputIndex].base; BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - IF( GT_32( inputIndex, RENDERER_MAX_MC_INPUTS ) ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsMc[inputIndex].base; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - IF( GT_32( inputIndex, RENDERER_MAX_SBA_INPUTS ) ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsSba[inputIndex].base; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - IF( GT_32( inputIndex, RENDERER_MAX_MASA_INPUTS ) ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsMasa[inputIndex].base; - BREAK; - default: - return IVAS_ERR_INVALID_INPUT_ID; - } - - /* Ensure input ID matches and that input is active */ - test(); - IF( NE_32( pInputBase->id, inputId ) || EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - - /* Validation done, set value via output parameter */ - *ppInput = pInputBase; - - return IVAS_ERR_OK; -} -#else -static ivas_error getConstInputById( - IVAS_REND_CONST_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const void **ppInput ) -{ - int32_t inputIndex; - IVAS_REND_AudioConfigType configType; - const input_base *pInputBase; - - /* Reverse makeInputId() */ - inputIndex = ( inputId & 0xFF ) - 1; - configType = ( inputId & 0xFF00 ) >> 8; - - /* Validate values derived from input ID */ - if ( inputIndex < 0 ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - switch ( configType ) - { - case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: - if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsIsm[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - if ( inputIndex > RENDERER_MAX_MC_INPUTS ) + IF( GT_32( inputIndex, RENDERER_MAX_MC_INPUTS ) ) { return IVAS_ERR_INVALID_INPUT_ID; } pInputBase = &hIvasRend->inputsMc[inputIndex].base; - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) + IF( GT_32( inputIndex, RENDERER_MAX_SBA_INPUTS ) ) { return IVAS_ERR_INVALID_INPUT_ID; } pInputBase = &hIvasRend->inputsSba[inputIndex].base; - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) + IF( GT_32( inputIndex, RENDERER_MAX_MASA_INPUTS ) ) { return IVAS_ERR_INVALID_INPUT_ID; } pInputBase = &hIvasRend->inputsMasa[inputIndex].base; - break; + BREAK; default: return IVAS_ERR_INVALID_INPUT_ID; } /* Ensure input ID matches and that input is active */ - if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) + test(); + IF( NE_32( pInputBase->id, inputId ) || EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { return IVAS_ERR_INVALID_INPUT_ID; } @@ -5688,6 +5660,70 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } +#else + static ivas_error getConstInputById( + IVAS_REND_CONST_HANDLE hIvasRend, + const IVAS_REND_InputId inputId, + const void **ppInput ) + { + int32_t inputIndex; + IVAS_REND_AudioConfigType configType; + const input_base *pInputBase; + + /* Reverse makeInputId() */ + inputIndex = ( inputId & 0xFF ) - 1; + configType = ( inputId & 0xFF00 ) >> 8; + + /* Validate values derived from input ID */ + if ( inputIndex < 0 ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + switch ( configType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsIsm[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + if ( inputIndex > RENDERER_MAX_MC_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMc[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsSba[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMasa[inputIndex].base; + break; + default: + return IVAS_ERR_INVALID_INPUT_ID; + } + + /* Ensure input ID matches and that input is active */ + if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + + /* Validation done, set value via output parameter */ + *ppInput = pInputBase; + + return IVAS_ERR_OK; + } #endif #ifndef IVAS_FLOAT_FIXED @@ -5732,46 +5768,46 @@ static ivas_error findFreeInputSlot( return IVAS_ERR_OK; } #else -static ivas_error findFreeInputSlot_fx( - const void *inputs, - const Word32 inputStructSize, - const Word32 maxInputs, - Word32 *inputIndex ) -{ - /* Using a void pointer and a separately provided size is a hack for this function - to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). - Assumptions: - - input_base is always the first member in the input struct - - provided size is correct - */ + static ivas_error findFreeInputSlot_fx( + const void *inputs, + const Word32 inputStructSize, + const Word32 maxInputs, + Word32 *inputIndex ) + { + /* Using a void pointer and a separately provided size is a hack for this function + to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). + Assumptions: + - input_base is always the first member in the input struct + - provided size is correct + */ - Word32 i; - bool canAddInput; - const UWord8 *pByte; - const input_base *pInputBase; + Word32 i; + bool canAddInput; + const UWord8 *pByte; + const input_base *pInputBase; - canAddInput = false; + canAddInput = false; - /* Find first unused input in array */ - FOR( ( i = 0, pByte = inputs ); i < maxInputs; ( ++i, pByte += inputStructSize ) ) - { - pInputBase = (const input_base *) pByte; + /* Find first unused input in array */ + FOR( ( i = 0, pByte = inputs ); i < maxInputs; ( ++i, pByte += inputStructSize ) ) + { + pInputBase = (const input_base *) pByte; - IF( EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) - { - *inputIndex = i; - canAddInput = true; - BREAK; - } - } + IF( EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + *inputIndex = i; + canAddInput = true; + BREAK; + } + } - IF ( !canAddInput ) - { - return IVAS_ERR_TOO_MANY_INPUTS; - } + IF( !canAddInput ) + { + return IVAS_ERR_TOO_MANY_INPUTS; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif @@ -5847,71 +5883,71 @@ ivas_error IVAS_REND_AddInput( return IVAS_ERR_OK; } #else -ivas_error IVAS_REND_AddInput_fx( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ - IVAS_REND_InputId *inputId /* o : ID of the new input */ -) -{ - ivas_error error; - Word32 maxNumInputsOfType; - void *inputsArray; - Word32 inputStructSize; - ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); - Word32 inputIndex; + ivas_error IVAS_REND_AddInput_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ + IVAS_REND_InputId *inputId /* o : ID of the new input */ + ) + { + ivas_error error; + Word32 maxNumInputsOfType; + void *inputsArray; + Word32 inputStructSize; + ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); + Word32 inputIndex; - /* Validate function arguments */ - IF ( hIvasRend == NULL || inputId == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL || inputId == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - SWITCH ( getAudioConfigType( inConfig ) ) - { - case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: - maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; - inputsArray = hIvasRend->inputsIsm; - inputStructSize = sizeof( *hIvasRend->inputsIsm ); - activateInput = setRendInputActiveIsm; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; - inputsArray = hIvasRend->inputsMc; - inputStructSize = sizeof( *hIvasRend->inputsMc ); - activateInput = setRendInputActiveMc; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; - inputsArray = hIvasRend->inputsSba; - inputStructSize = sizeof( *hIvasRend->inputsSba ); - activateInput = setRendInputActiveSba; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; - inputsArray = hIvasRend->inputsMasa; - inputStructSize = sizeof( *hIvasRend->inputsMasa ); - activateInput = setRendInputActiveMasa; - BREAK; - default: - return IVAS_ERR_INVALID_INPUT_FORMAT; - } + SWITCH( getAudioConfigType( inConfig ) ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; + inputsArray = hIvasRend->inputsIsm; + inputStructSize = sizeof( *hIvasRend->inputsIsm ); + activateInput = setRendInputActiveIsm; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; + inputsArray = hIvasRend->inputsMc; + inputStructSize = sizeof( *hIvasRend->inputsMc ); + activateInput = setRendInputActiveMc; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; + inputsArray = hIvasRend->inputsSba; + inputStructSize = sizeof( *hIvasRend->inputsSba ); + activateInput = setRendInputActiveSba; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; + inputsArray = hIvasRend->inputsMasa; + inputStructSize = sizeof( *hIvasRend->inputsMasa ); + activateInput = setRendInputActiveMasa; + BREAK; + default: + return IVAS_ERR_INVALID_INPUT_FORMAT; + } - /* Find first free input in array corresponding to input type */ - IF ( ( error = findFreeInputSlot_fx( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Find first free input in array corresponding to input type */ + IF( ( error = findFreeInputSlot_fx( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) + { + return error; + } - *inputId = makeInputId( inConfig, inputIndex ); + *inputId = makeInputId( inConfig, inputIndex ); - IF ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif @@ -5943,10 +5979,10 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } #else - if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) + { + return error; + } #endif if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputMc ) ) != IVAS_ERR_OK ) @@ -6020,30 +6056,30 @@ ivas_error IVAS_REND_SetInputGain( return IVAS_ERR_OK; } #else -ivas_error IVAS_REND_SetInputGain_fx( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - const Word32 gain /* i : linear gain (not in dB) */ -) -{ - input_base *inputBase; - ivas_error error; + ivas_error IVAS_REND_SetInputGain_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const Word32 gain /* i : linear gain (not in dB) */ + ) + { + input_base *inputBase; + ivas_error error; - /* Validate function arguments */ - IF ( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + { + return error; + } - inputBase->gain_fx = gain; + inputBase->gain_fx = gain; - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif /*-------------------------------------------------------------------* @@ -6095,48 +6131,48 @@ ivas_error IVAS_REND_SetInputLfeMtx( return IVAS_ERR_OK; } #else -ivas_error IVAS_REND_SetInputLfeMtx_fx( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - const IVAS_REND_LfePanMtx_fx *lfePanMtx /* i : LFE panning matrix */ -) -{ - Word16 i; - input_base *pInputBase; - input_mc *pInputMc; - ivas_error error; + ivas_error IVAS_REND_SetInputLfeMtx_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_REND_LfePanMtx_fx *lfePanMtx /* i : LFE panning matrix */ + ) + { + Word16 i; + input_base *pInputBase; + input_mc *pInputMc; + ivas_error error; - /* Validate function arguments */ - IF ( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + { + return error; + } - IF ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - /* Custom LFE panning matrix only makes sense with channel-based input */ - return IVAS_ERR_INVALID_INPUT_FORMAT; - } - pInputMc = (input_mc *) pInputBase; + IF( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + /* Custom LFE panning matrix only makes sense with channel-based input */ + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + pInputMc = (input_mc *) pInputBase; - /* copy LFE panning matrix */ - FOR ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; i++ ) - { - Copy32( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); - } + /* copy LFE panning matrix */ + FOR( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; i++ ) + { + Copy32( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); + } - IF ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif #ifdef IVAS_FLOAT_FIXED @@ -6149,52 +6185,9 @@ ivas_error IVAS_REND_SetInputLfeMtx_fx( ivas_error IVAS_REND_SetInputLfePos_fx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ - const Word32 inputGain, /* i : Input gain to be applied to the LFE channel(s) */ - const Word16 outputAzimuth, /* i : Output azimuth position */ - const Word16 outputElevation /* i : Output elevation position */ -) -{ - input_base *pInputBase; - input_mc *pInputMc; - ivas_error error; - - /* Validate function arguments */ - IF ( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - IF ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) - { - return error; - } - - IF ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - /* Custom LFE routing only makes sense with channel-based input */ - return IVAS_ERR_INVALID_INPUT_FORMAT; - } - pInputMc = (input_mc *) pInputBase; - - pInputMc->lfeRouting.pan_lfe = true; - pInputMc->lfeRouting.lfeInputGain_fx = inputGain; // Q31 - pInputMc->lfeRouting.lfeOutputAzimuth_fx = (Word16) ( outputAzimuth ); // Q0 - pInputMc->lfeRouting.lfeOutputElevation_fx = (Word16) ( outputElevation ); // Q0 - - IF ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) - { - return error; - } - - return IVAS_ERR_OK; -} -#else -ivas_error IVAS_REND_SetInputLfePos( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - const float inputGain, /* i : Input gain to be applied to the LFE channel(s) */ - const float outputAzimuth, /* i : Output azimuth position */ - const float outputElevation /* i : Output elevation position */ + const Word32 inputGain, /* i : Input gain to be applied to the LFE channel(s) */ + const Word16 outputAzimuth, /* i : Output azimuth position */ + const Word16 outputElevation /* i : Output elevation position */ ) { input_base *pInputBase; @@ -6202,17 +6195,17 @@ ivas_error IVAS_REND_SetInputLfePos( ivas_error error; /* Validate function arguments */ - if ( hIvasRend == NULL ) + IF( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + IF( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) { return error; } - if ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { /* Custom LFE routing only makes sense with channel-based input */ return IVAS_ERR_INVALID_INPUT_FORMAT; @@ -6220,17 +6213,60 @@ ivas_error IVAS_REND_SetInputLfePos( pInputMc = (input_mc *) pInputBase; pInputMc->lfeRouting.pan_lfe = true; - pInputMc->lfeRouting.lfeInputGain = inputGain; - pInputMc->lfeRouting.lfeOutputAzimuth = outputAzimuth; - pInputMc->lfeRouting.lfeOutputElevation = outputElevation; + pInputMc->lfeRouting.lfeInputGain_fx = inputGain; // Q31 + pInputMc->lfeRouting.lfeOutputAzimuth_fx = (Word16) ( outputAzimuth ); // Q0 + pInputMc->lfeRouting.lfeOutputElevation_fx = (Word16) ( outputElevation ); // Q0 - if ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + IF( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { return error; } return IVAS_ERR_OK; } +#else + ivas_error IVAS_REND_SetInputLfePos( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const float inputGain, /* i : Input gain to be applied to the LFE channel(s) */ + const float outputAzimuth, /* i : Output azimuth position */ + const float outputElevation /* i : Output elevation position */ + ) + { + input_base *pInputBase; + input_mc *pInputMc; + ivas_error error; + + /* Validate function arguments */ + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + /* Custom LFE routing only makes sense with channel-based input */ + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + pInputMc = (input_mc *) pInputBase; + + pInputMc->lfeRouting.pan_lfe = true; + pInputMc->lfeRouting.lfeInputGain = inputGain; + pInputMc->lfeRouting.lfeOutputAzimuth = outputAzimuth; + pInputMc->lfeRouting.lfeOutputElevation = outputElevation; + + if ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; + } #endif /*-------------------------------------------------------------------* @@ -6314,33 +6350,33 @@ ivas_error IVAS_REND_GetInputNumChannels( return IVAS_ERR_OK; } #else -ivas_error IVAS_REND_GetInputNumChannels( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - Word16 *numChannels /* o : number of channels of the input */ -) -{ - ivas_error error; - const input_base *pInput; + ivas_error IVAS_REND_GetInputNumChannels( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + Word16 *numChannels /* o : number of channels of the input */ + ) + { + ivas_error error; + const input_base *pInput; - /* Validate function arguments */ - IF ( hIvasRend == NULL || numChannels == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL || numChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( ( error = getConstInputById( hIvasRend, inputId, (const void **) &pInput ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getConstInputById( hIvasRend, inputId, (const void **) &pInput ) ) != IVAS_ERR_OK ) + { + return error; + } - IF ( ( error = getRendInputNumChannels( pInput, numChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getRendInputNumChannels( pInput, numChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif /*-------------------------------------------------------------------* @@ -6367,23 +6403,23 @@ ivas_error IVAS_REND_GetNumAllObjects( return IVAS_ERR_OK; } #else -ivas_error IVAS_REND_GetNumAllObjects( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ - Word16 *numChannels /* o : number of all objects */ -) -{ - IF ( hIvasRend == NULL || numChannels == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + ivas_error IVAS_REND_GetNumAllObjects( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + Word16 * numChannels /* o : number of all objects */ + ) + { + IF( hIvasRend == NULL || numChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) - { - *numChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; - } + IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) + { + *numChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; + } - return IVAS_ERR_OK; -} + return IVAS_ERR_OK; + } #endif /*-------------------------------------------------------------------* @@ -6462,70 +6498,68 @@ ivas_error IVAS_REND_GetDelay( return IVAS_ERR_OK; } #else -ivas_error IVAS_REND_GetDelay_fx( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ - Word16 *nSamples, /* o : Renderer delay in samples */ - Word32 *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ -) -{ - /* TODO tmu : this function only returns the maximum delay across all inputs - * Ideally each input has its own delay buffer and everything is aligned (binaural and LFE filtering delays are nonuniform) - */ - Word16 i; - Word32 latency_ns; - Word32 max_latency_ns; + ivas_error IVAS_REND_GetDelay_fx( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ + Word16 * nSamples, /* o : Renderer delay in samples */ + Word32 * timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ + ) + { + /* TODO tmu : this function only returns the maximum delay across all inputs + * Ideally each input has its own delay buffer and everything is aligned (binaural and LFE filtering delays are nonuniform) + */ + Word16 i; + Word32 latency_ns; + Word32 max_latency_ns; - Word32 timescale_by_ns[7] = { 0, 17180, 34360, 0, 68719, 0, 103079 }; + Word32 timescale_by_ns[7] = { 0, 17180, 34360, 0, 68719, 0, 103079 }; - /* Validate function arguments */ - IF ( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - *timeScale = hIvasRend->sampleRateOut; - assert( *timeScale == 8000 || *timeScale == 16000 || *timeScale == 32000 || *timeScale == 48000 ); - *nSamples = 0; - max_latency_ns = 0; + *timeScale = hIvasRend->sampleRateOut; + assert( *timeScale == 8000 || *timeScale == 16000 || *timeScale == 32000 || *timeScale == 48000 ); + *nSamples = 0; + max_latency_ns = 0; - /* Compute the maximum delay across all inputs */ - FOR ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) - { - IF ( NE_32(hIvasRend->inputsIsm[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) - { - latency_ns = L_max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, - hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); - max_latency_ns = L_max( max_latency_ns, latency_ns ); - } - } + /* Compute the maximum delay across all inputs */ + FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) + { + IF( NE_32( hIvasRend->inputsIsm[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + latency_ns = L_max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, + hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } - FOR ( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) - { - IF ( NE_32(hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) - { - latency_ns = L_max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, - hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); - max_latency_ns = L_max( max_latency_ns, latency_ns ); - } - } + FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) + { + IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + latency_ns = L_max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, + hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } - FOR ( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) - { - IF ( NE_32(hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) - { + FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) { - latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; - max_latency_ns = L_max( max_latency_ns, latency_ns ); + IF( NE_32( hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + { + latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } } - } - } - FOR ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) - { - IF ( NE_32(hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) - { - latency_ns = (Word32) ( IVAS_FB_DEC_DELAY_NS ); + FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ){ + IF( NE_32( hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ){ + latency_ns = (Word32) ( IVAS_FB_DEC_DELAY_NS ); max_latency_ns = L_max( max_latency_ns, latency_ns ); } } @@ -6770,8 +6804,13 @@ ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( } /* Set position to OMasa struct */ +#ifdef IVAS_FLOAT_FIXED + hIvasRend->inputsIsm->hOMasa->ism_azimuth_fx[inputIndex] = floatToFixed(objectPosition.azimuth, Q22); + hIvasRend->inputsIsm->hOMasa->ism_elevation_fx[inputIndex] = floatToFixed(objectPosition.elevation, Q22); +#else hIvasRend->inputsIsm->hOMasa->ism_azimuth[inputIndex] = objectPosition.azimuth; hIvasRend->inputsIsm->hOMasa->ism_elevation[inputIndex] = objectPosition.elevation; +#endif return IVAS_ERR_OK; } @@ -6886,7 +6925,7 @@ ivas_error IVAS_REND_InitConfig( return error; } #ifdef IVAS_FLOAT_FIXED - IF ((error = ivas_render_config_init_from_rom_fx(&hIvasRend->hRendererConfig)) != IVAS_ERR_OK) + IF( ( error = ivas_render_config_init_from_rom_fx( &hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -7000,7 +7039,7 @@ int16_t IVAS_REND_GetRenderConfig( { RENDER_CONFIG_HANDLE hRCin; - IF ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL || hRCout == NULL ) + IF( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL || hRCout == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -7122,7 +7161,7 @@ ivas_error IVAS_REND_SetHeadRotation( rotQuat = headRot; } - IF ( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) { return error; } @@ -7237,17 +7276,7 @@ ivas_error IVAS_REND_SetReferenceRotation( #ifdef IVAS_FLOAT_FIXED - IVAS_QUATERNION refRot_fx; - refRot_fx.q_fact = Q29; - refRot_fx.w_fx = (Word32) float_to_fix( refRot.w, refRot_fx.q_fact); - refRot_fx.x_fx = (Word32) float_to_fix( refRot.x, refRot_fx.q_fact); - refRot_fx.y_fx = (Word32) float_to_fix( refRot.y, refRot_fx.q_fact); - refRot_fx.z_fx = (Word32) float_to_fix( refRot.z, refRot_fx.q_fact); - error = ivas_orient_trk_SetReferenceRotation_fx( hIvasRend->headRotData.hOrientationTracker, refRot_fx ); - hIvasRend->headRotData.hOrientationTracker->refRot.w = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); - hIvasRend->headRotData.hOrientationTracker->refRot.x = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.x_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); - hIvasRend->headRotData.hOrientationTracker->refRot.y = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.y_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); - hIvasRend->headRotData.hOrientationTracker->refRot.z = me2f( hIvasRend->headRotData.hOrientationTracker->refRot.z_fx, 31 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + error = ivas_orient_trk_SetReferenceRotation_fx( hIvasRend->headRotData.hOrientationTracker, refRot ); if ( error != IVAS_ERR_OK ) { @@ -7400,30 +7429,6 @@ ivas_error IVAS_REND_CombineHeadAndExternalOrientation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } ivas_error error_type = combine_external_and_head_orientations_rend( &hIvasRend->headRotData, hIvasRend->hExternalOrientationData, hIvasRend->hCombinedOrientationData ); -#ifdef IVAS_FLOAT_FIXED - for ( Word16 i = 0; i < hIvasRend->hCombinedOrientationData->num_subframes; i++ ) - { - hIvasRend->hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].w_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - hIvasRend->hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].x_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - hIvasRend->hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].y_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - hIvasRend->hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasRend->hCombinedOrientationData->Quaternions[i].z_fx, hIvasRend->hCombinedOrientationData->Quaternions[i].q_fact ); - - /*for ( j = 0; j < 3; j++ ) - { - for ( Word16 k = 0; k < 3; k++ ) - { - hCombinedOrientationData->Rmat_fx[i][j][k] = L_shl( hCombinedOrientationData->Rmat_fx[i][j][k], 30 - ( 2 * hCombinedOrientationData->Quaternions[i].q_fact - 32 ) ); - } - }*/ - for ( Word16 j = 0; j < 3; j++ ) - { - for ( Word16 k = 0; k < 3; k++ ) - { - hIvasRend->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( hIvasRend->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); - } - } - } -#endif return error_type; } @@ -8317,7 +8322,7 @@ static ivas_error renderIsmToBinauralRoom( { for ( j = 0; j < 3; j++ ) { - Rmat[i][j] = ( *hCombinedOrientationData )->Rmat[subframe_idx][i][j]; + Rmat[i][j] = fixedToFloat_32( ( *hCombinedOrientationData )->Rmat_fx[subframe_idx][i][j], 30 ); } } else @@ -8360,29 +8365,29 @@ static ivas_error renderIsmToBinauralRoom( /* set previous gains if this is the first frame */ /*float2fix to be removed*/ - Word32 azimuth_fx_tmp = floatToFixed(rotatedPosPrev.azimuth, Q22); - Word32 elevation_fx_tmp = floatToFixed(rotatedPosPrev.elevation, Q22); + Word32 azimuth_fx_tmp = floatToFixed( rotatedPosPrev.azimuth, Q22 ); + Word32 elevation_fx_tmp = floatToFixed( rotatedPosPrev.elevation, Q22 ); if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, azimuth_fx_tmp, elevation_fx_tmp, ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) { return error; } /* fix2float to be removed */ - fixedToFloat_arrL(ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS); + fixedToFloat_arrL( ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS ); /* compute gains only if position changed */ if ( position_changed ) { /*float2fix to be removed*/ - azimuth_fx_tmp = floatToFixed(rotatedPos.azimuth, Q22); - elevation_fx_tmp = floatToFixed(rotatedPos.elevation, Q22); + azimuth_fx_tmp = floatToFixed( rotatedPos.azimuth, Q22 ); + elevation_fx_tmp = floatToFixed( rotatedPos.elevation, Q22 ); if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - azimuth_fx_tmp, - elevation_fx_tmp, - currentPanGains_fx ) ) != IVAS_ERR_OK ) + azimuth_fx_tmp, + elevation_fx_tmp, + currentPanGains_fx ) ) != IVAS_ERR_OK ) { return error; } /* fix2float to be removed */ - fixedToFloat_arrL(currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS); + fixedToFloat_arrL( currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS ); } /* intermediate rendering to 7_1_4 */ @@ -8710,19 +8715,19 @@ static ivas_error renderIsmToMc( { // TODO tmu review when #215 is resolved /*float2fix to be removed*/ - Word32 azimuth_fx_tmp = (int16_t)floorf(ismInput->currentPos.azimuth + 0.5f); + Word32 azimuth_fx_tmp = (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ); azimuth_fx_tmp = azimuth_fx_tmp << 22; - Word32 elevation_fx_tmp = (int16_t)floorf(ismInput->currentPos.elevation + 0.5f); + Word32 elevation_fx_tmp = (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ); elevation_fx_tmp = elevation_fx_tmp << 22; if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - azimuth_fx_tmp, - elevation_fx_tmp, - currentPanGains_fx ) ) != IVAS_ERR_OK ) + azimuth_fx_tmp, + elevation_fx_tmp, + currentPanGains_fx ) ) != IVAS_ERR_OK ) { return error; } /* fix2float to be removed */ - fixedToFloat_arrL(currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS); + fixedToFloat_arrL( currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS ); } /* set previous gains if this is the first frame */ @@ -8730,19 +8735,19 @@ static ivas_error renderIsmToMc( { // TODO tmu review when #215 is resolved /*float2fix to be removed*/ - Word32 azimuth_fx_tmp = (int16_t)floorf(ismInput->previousPos.azimuth + 0.5f); + Word32 azimuth_fx_tmp = (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ); azimuth_fx_tmp = azimuth_fx_tmp << 22; - Word32 elevation_fx_tmp = (int16_t)floorf(ismInput->previousPos.elevation + 0.5f); + Word32 elevation_fx_tmp = (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ); elevation_fx_tmp = elevation_fx_tmp << 22; if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - azimuth_fx_tmp, - elevation_fx_tmp, - ismInput->prev_pan_gains_fx) ) != IVAS_ERR_OK ) + azimuth_fx_tmp, + elevation_fx_tmp, + ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) { return error; } /* fix2float to be removed */ - fixedToFloat_arrL(ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS); + fixedToFloat_arrL( ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS ); } } @@ -8907,12 +8912,56 @@ static void renderIsmToMasa( IVAS_REND_AudioBuffer outAudio ) { float tmpRendBuffer[MAX_NUM_OBJECTS][L_FRAME48k]; +#ifdef IVAS_FLOAT_FIXED + Word32 tmpRendBuffer_fx[MAX_NUM_OBJECTS][L_FRAME48k]; + Word16 i, j; + Word16 q_fact; +#endif push_wmops( "renderIsmToMasa" ); copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); +#ifdef IVAS_FLOAT_FIXED + Word16 input_e[MAX_NUM_OBJECTS], max_e; + FOR(i = 0; i < MAX_NUM_OBJECTS; i++) + { + f2me_buf(tmpRendBuffer[i], tmpRendBuffer_fx[i], &input_e[i], L_FRAME48k); + } + + Word16 guard_bits = find_guarded_bits_fx(L_FRAME48k); + max_e = input_e[0]; + FOR (Word16 i = 1; i < MAX_NUM_OBJECTS; i++) + { + IF (max_e < input_e[0]) + max_e = input_e[i]; + } + + FOR(i = 0; i < MAX_NUM_OBJECTS; i++) + { + FOR (j = 0; j < L_FRAME48k; j++) + { + tmpRendBuffer_fx[i][j] = L_shr(tmpRendBuffer_fx[i][j], max_e - input_e[i] + guard_bits); + } + } + max_e += guard_bits; + q_fact = 31 - max_e; +#endif + +#ifdef IVAS_FLOAT_FIXED + ivas_omasa_ana_fx(ismInput->hOMasa, tmpRendBuffer, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels); + + FOR (Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) { + FOR (Word16 band_m_idx = 0; band_m_idx < ismInput->hOMasa->nbands; band_m_idx++) { + ismInput->hOMasa->energy[block_m_idx][band_m_idx] = fixedToFloat(ismInput->hOMasa->energy_fx[block_m_idx][band_m_idx], ismInput->hOMasa->energy_q); + } + } + FOR(Word16 i = 0; i < ismInput->base.inputBuffer.config.numChannels; i++) { + fixedToFloat_arrL(tmpRendBuffer_fx[i], tmpRendBuffer[i], q_fact, L_FRAME48k ); + } +#else ivas_omasa_ana( ismInput->hOMasa, tmpRendBuffer, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels ); +#endif accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); @@ -8940,7 +8989,7 @@ static ivas_error renderInputIsm( ismInput->base.numNewSamplesPerChannel = 0; #ifdef IVAS_FLOAT_FIXED - ismInput->base.gain = fix_to_float(ismInput->base.gain_fx, 30); + ismInput->base.gain = fix_to_float( ismInput->base.gain_fx, 30 ); #endif // IVAS_FLOAT_FIXED /* Apply input gain to new audio */ @@ -9895,7 +9944,7 @@ static void renderMcToMasa( MCMASA_ANA_HANDLE hMcMasa = mcInput->hMcMasa; Word16 i, nchan_inp = mcInput->base.inputBuffer.config.numChannels; Word16 q_data = *( outAudio.pq_fact ); - FOR ( i = 0; i < nchan_inp - 1; i++ ) + FOR( i = 0; i < nchan_inp - 1; i++ ) { floatToFixed_arrL( hMcMasa->cldfbAnaEnc[i]->cldfb_state, hMcMasa->cldfbAnaEnc[i]->cldfb_state_fx, q_data, hMcMasa->cldfbAnaEnc[i]->p_filter_length - hMcMasa->cldfbAnaEnc[i]->no_channels ); } @@ -9908,33 +9957,33 @@ static void renderMcToMasa( ivas_mcmasa_ana_fx( mcInput->hMcMasa, tmpRendBuffer_fx, *( outAudio.pq_fact ), mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); #if 1 /*TODO: To be removed later(fixed to float)*/ /*From here : Cleanup changes for ivas_mcmasa_param_est_ana_fx*/ - FOR ( i = 0; i < nchan_inp - 1; i++ ) + FOR( i = 0; i < nchan_inp - 1; i++ ) { fixedToFloat_arrL( hMcMasa->cldfbAnaEnc[i]->cldfb_state_fx, hMcMasa->cldfbAnaEnc[i]->cldfb_state, q_data, hMcMasa->cldfbAnaEnc[i]->p_filter_length - hMcMasa->cldfbAnaEnc[i]->no_channels ); } - FOR ( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + FOR( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - FOR ( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + FOR( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) { - FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { hMcMasa->direction_vector_m[i][j][k] = me2f( hMcMasa->direction_vector_m_fx[i][j][k], hMcMasa->direction_vector_e[i][j][k] ); } hMcMasa->energy[j][k] = me2f( hMcMasa->energy_fx[j][k], hMcMasa->energy_e[j][k] ); } } - FOR ( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) + FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) { - FOR ( int j = 0; j < DIRAC_NUM_DIMS; j++ ) + FOR( int j = 0; j < DIRAC_NUM_DIMS; j++ ) { - FOR ( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) - hMcMasa->buffer_intensity_real[j][i][k] = fixedToFloat( hMcMasa->buffer_intensity_real_fx[j][i][k], hMcMasa->buffer_intensity_real_q[i] ); + FOR( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + hMcMasa->buffer_intensity_real[j][i][k] = fixedToFloat( hMcMasa->buffer_intensity_real_fx[j][i][k], hMcMasa->buffer_intensity_real_q[i] ); } - FOR ( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { hMcMasa->buffer_intensity_real_vert[i][j] = fixedToFloat( hMcMasa->buffer_intensity_real_vert_fx[i][j], hMcMasa->buffer_intensity_real_vert_q[i] ); } - FOR ( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + FOR( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) { hMcMasa->buffer_energy[i * j + j] = fixedToFloat( hMcMasa->buffer_energy_fx[i * j + j], hMcMasa->buffer_energy_q[i] ); } @@ -11172,6 +11221,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( MASA_DECODER_EXT_OUT_META_HANDLE inMeta2; float( *inEne1 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float( *inEne2 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32( *inEne1_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32( *inEne2_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 *inEne1_e; + Word16 *inEne2_e; if ( hIvasRend == NULL ) { @@ -11183,21 +11236,57 @@ ivas_error IVAS_REND_MergeMasaMetadata( { *hMasaExtOutMeta = hIvasRend->inputsIsm->hOMasa->hMasaOut; inEne1 = &( hIvasRend->inputsIsm->hOMasa->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne1_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); + inEne1_e = &(hIvasRend->inputsIsm->hOMasa->energy_e); + + + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS); + } +#endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { *hMasaExtOutMeta = hIvasRend->inputsMc->hMcMasa->hMasaOut; inEne1 = &( hIvasRend->inputsMc->hMcMasa->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne1_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); + inEne1_e = &(hIvasRend->inputsMc->hMcMasa->energy_e); + + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_e[i], MASA_FREQUENCY_BANDS); + } +#endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { *hMasaExtOutMeta = hIvasRend->inputsSba->hDirAC->hMasaOut; inEne1 = &( hIvasRend->inputsSba->hDirAC->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne1_fx = &(hIvasRend->inputsSba->hDirAC->energy_fx); + inEne1_e = &(hIvasRend->inputsSba->hDirAC->energy_e); + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_e[i], MASA_FREQUENCY_BANDS); + } + +#endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { *hMasaExtOutMeta = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; inEne1 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne1_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); + inEne1_e = &(hIvasRend->inputsMasa->hMasaPrerend->energy_e); + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS); + } +#endif } else { @@ -11209,21 +11298,56 @@ ivas_error IVAS_REND_MergeMasaMetadata( { inMeta2 = hIvasRend->inputsIsm->hOMasa->hMasaOut; inEne2 = &( hIvasRend->inputsIsm->hOMasa->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne2_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); + inEne2_e = &(hIvasRend->inputsIsm->hOMasa->energy_e); + + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS); + } + +#endif } else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { inMeta2 = hIvasRend->inputsMc->hMcMasa->hMasaOut; inEne2 = &( hIvasRend->inputsMc->hMcMasa->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); + inEne2_e = &(hIvasRend->inputsMc->hMcMasa->energy_e); + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_e[i], MASA_FREQUENCY_BANDS); + } +#endif } else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { inMeta2 = hIvasRend->inputsSba->hDirAC->hMasaOut; inEne2 = &( hIvasRend->inputsSba->hDirAC->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); + inEne2_e = &(hIvasRend->inputsSba->hDirAC->energy_e); + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_e[i], MASA_FREQUENCY_BANDS); + } +#endif } else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { inMeta2 = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; inEne2 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); +#ifdef IVAS_FLOAT_FIXED + inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); + inEne2_e = &(hIvasRend->inputsMasa->hMasaPrerend->energy_e); + for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + f2me_buf(hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS); + } + +#endif } else { @@ -11231,8 +11355,19 @@ ivas_error IVAS_REND_MergeMasaMetadata( } /* Merge metadata */ +#ifdef IVAS_FLOAT_FIXED + ivas_prerend_merge_masa_metadata_fx( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1_fx, inEne1_e, inMeta2, inputType2, inEne2_fx, inEne2_e ); + + FOR(Word32 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + { + me2f_buf((*inEne1_fx)[i], inEne1_e[i], (*inEne1)[i], MASA_FREQUENCY_BANDS); + } +#else ivas_prerend_merge_masa_metadata( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1, inMeta2, inputType2, *inEne2 ); ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; +#endif + + (*hMasaExtOutMeta)->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; return IVAS_ERR_OK; } @@ -11320,70 +11455,72 @@ static ivas_error getSamplesInternal( Word16 numOutChannels; /* Validate function arguments */ test(); - IF ( hIvasRend == NULL || outAudio.data == NULL ) + IF( hIvasRend == NULL || outAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } test(); - IF ( LE_16(outAudio.config.numSamplesPerChannel , 0) || LT_16(MAX_BUFFER_LENGTH_PER_CHANNEL , outAudio.config.numSamplesPerChannel) ) + IF( LE_16( outAudio.config.numSamplesPerChannel, 0 ) || LT_16( MAX_BUFFER_LENGTH_PER_CHANNEL, outAudio.config.numSamplesPerChannel ) ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } test(); - IF ( LE_16(outAudio.config.numChannels , 0) || LT_16(MAX_OUTPUT_CHANNELS , outAudio.config.numChannels) ) + IF( LE_16( outAudio.config.numChannels, 0 ) || LT_16( MAX_OUTPUT_CHANNELS, outAudio.config.numChannels ) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } - IF ( EQ_32(getAudioConfigType( hIvasRend->outputConfig ) , IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL) && - NE_32(outAudio.config.numSamplesPerChannel * 1000 , ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut) ) + IF( EQ_32( getAudioConfigType( hIvasRend->outputConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && + NE_32( outAudio.config.numSamplesPerChannel * 1000, ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); } /* Check that there is allowed configuration for MASA format output */ - IF ( EQ_32(getAudioConfigType( hIvasRend->outputConfig ) , IVAS_REND_AUDIO_CONFIG_TYPE_MASA) ) + IF( EQ_32( getAudioConfigType( hIvasRend->outputConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) { Word16 i; - Word16 numMasaInputs = 0; move16(); - Word16 numOtherInputs = 0; move16(); + Word16 numMasaInputs = 0; + move16(); + Word16 numOtherInputs = 0; + move16(); - FOR ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) + FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) { - //numMasaInputs += hIvasRend->inputsMasa[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + // numMasaInputs += hIvasRend->inputsMasa[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; numMasaInputs = EQ_32( L_add( numMasaInputs, hIvasRend->inputsMasa[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; } - FOR ( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) + FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) { - //numOtherInputs += hIvasRend->inputsMc[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + // numOtherInputs += hIvasRend->inputsMc[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsMc[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; } - FOR ( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) + FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) { - //numOtherInputs += hIvasRend->inputsSba[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + // numOtherInputs += hIvasRend->inputsSba[i].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsSba[i].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; } /* For ISM, we check only first as all ISMs are handled together via OMASA when merging to MASA. */ - //numOtherInputs += hIvasRend->inputsIsm[0].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; + // numOtherInputs += hIvasRend->inputsIsm[0].base.inConfig == IVAS_AUDIO_CONFIG_INVALID ? 0 : 1; numOtherInputs = EQ_32( L_add( numOtherInputs, hIvasRend->inputsIsm[0].base.inConfig ), IVAS_AUDIO_CONFIG_INVALID ) ? 0 : 1; test(); - IF ( EQ_16(numMasaInputs , 0) || EQ_16(numOtherInputs , 0) ) + IF( EQ_16( numMasaInputs, 0 ) || EQ_16( numOtherInputs, 0 ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } } - IF ( NE_32(( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) , IVAS_ERR_OK) ) + IF( NE_32( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ), IVAS_ERR_OK ) ) { return error; } - IF ( NE_16(numOutChannels , outAudio.config.numChannels) ) + IF( NE_16( numOutChannels, outAudio.config.numChannels ) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } @@ -11392,24 +11529,24 @@ static ivas_error getSamplesInternal( set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); set_val_Word32( outAudio.data_fx, 0, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); - IF ( NE_32(( error = renderActiveInputsIsm( hIvasRend, outAudio ) ) , IVAS_ERR_OK) ) + IF( NE_32( ( error = renderActiveInputsIsm( hIvasRend, outAudio ) ), IVAS_ERR_OK ) ) { return error; } - IF ( NE_32(( error = renderActiveInputsMc( hIvasRend, outAudio ) ) , IVAS_ERR_OK) ) + IF( NE_32( ( error = renderActiveInputsMc( hIvasRend, outAudio ) ), IVAS_ERR_OK ) ) { return error; } - IF ( NE_32(( error = renderActiveInputsSba( hIvasRend, outAudio ) ) , IVAS_ERR_OK) ) + IF( NE_32( ( error = renderActiveInputsSba( hIvasRend, outAudio ) ), IVAS_ERR_OK ) ) { return error; } - IF ( NE_32(( error = renderActiveInputsMasa( hIvasRend, outAudio ) ) , IVAS_ERR_OK) ) + IF( NE_32( ( error = renderActiveInputsMasa( hIvasRend, outAudio ) ), IVAS_ERR_OK ) ) { return error; } - IF ( NE_32(hIvasRend->inputsSba[0].base.inConfig , IVAS_AUDIO_CONFIG_INVALID) ) + IF( NE_32( hIvasRend->inputsSba[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { #ifndef DISABLE_LIMITER Word32 limiter_thresold = L_lshl( IVAS_LIMITER_THRESHOLD, *outAudio.pq_fact ); @@ -11419,7 +11556,7 @@ static ivas_error getSamplesInternal( ELSE { #ifndef DISABLE_LIMITER - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD); + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); *outAudio.pq_fact = 0; #endif } @@ -11622,12 +11759,12 @@ void IVAS_REND_Close( static ivas_error ivas_masa_ext_rend_dirac_rend_init( input_masa *inputMasa ) { - int16_t nchan_out_woLFE; - int16_t nchan_transport; - uint16_t i, j, k; - float ls_azimuth[MAX_OUTPUT_CHANNELS]; - float ls_elevation[MAX_OUTPUT_CHANNELS]; - int32_t output_Fs; + Word16 nchan_out_woLFE; + Word16 nchan_transport; + UWord16 i, j, k; + Word32 ls_azimuth_fx[MAX_OUTPUT_CHANNELS];/*Q22*/ + Word32 ls_elevation_fx[MAX_OUTPUT_CHANNELS];/*Q22*/ + Word32 output_Fs; ivas_error error; DIRAC_REND_HANDLE hDirACRend; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -11636,6 +11773,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend = NULL; output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); + move32(); hSpatParamRendCom = inputMasa->hMasaExtRend->hSpatParamRendCom; @@ -11643,12 +11781,12 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( * prepare library opening *-----------------------------------------------------------------*/ - if ( ( hDirACRend = (DIRAC_REND_HANDLE) malloc( sizeof( DIRAC_REND_DATA ) ) ) == NULL ) + IF ( ( hDirACRend = (DIRAC_REND_HANDLE) malloc( sizeof( DIRAC_REND_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC renderer\n" ) ); } - nchan_transport = inputMasa->base.inConfig == IVAS_AUDIO_CONFIG_MASA2 ? 2 : 1; + nchan_transport = EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA2) ? 2 : 1; /*-----------------------------------------------------------------* * output setup: for parametric binaural renderer, use output setup, otherwise internal setup @@ -11656,100 +11794,112 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( ivas_output_init( &hDirACRend->hOutSetup, *inputMasa->base.ctx.pOutConfig ); - if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF ( EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_LS_CUSTOM) ) { /* Copy from ivas_ls_custom_setup */ hDirACRend->hOutSetup.nchan_out_woLFE = inputMasa->base.ctx.pCustomLsOut->num_spk; + move16(); +#if 1/*TODO: To be removed later(floating buffer init)*/ hDirACRend->hOutSetup.ls_azimuth = inputMasa->base.ctx.pCustomLsOut->ls_azimuth; hDirACRend->hOutSetup.ls_elevation = inputMasa->base.ctx.pCustomLsOut->ls_elevation; +#endif + hDirACRend->hOutSetup.ls_azimuth_fx = inputMasa->base.ctx.pCustomLsOut->ls_azimuth_fx; + hDirACRend->hOutSetup.ls_elevation_fx = inputMasa->base.ctx.pCustomLsOut->ls_elevation_fx; hDirACRend->hOutSetup.num_lfe = inputMasa->base.ctx.pCustomLsOut->num_lfe; hDirACRend->hOutSetup.index_lfe[0] = inputMasa->base.ctx.pCustomLsOut->lfe_idx[0]; hDirACRend->hOutSetup.is_loudspeaker_setup = TRUE; - hDirACRend->hOutSetup.is_planar_setup = (int8_t) inputMasa->base.ctx.pCustomLsOut->is_planar_setup; + hDirACRend->hOutSetup.is_planar_setup = (Word8) inputMasa->base.ctx.pCustomLsOut->is_planar_setup; + move16(); + move16(); + move16(); + move16(); } nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; + move16(); - if ( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) + IF ( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) { - mvr2r( hDirACRend->hOutSetup.ls_azimuth, ls_azimuth, nchan_out_woLFE ); - mvr2r( hDirACRend->hOutSetup.ls_elevation, ls_elevation, nchan_out_woLFE ); + Copy32( hDirACRend->hOutSetup.ls_azimuth_fx, ls_azimuth_fx, nchan_out_woLFE ); + Copy32( hDirACRend->hOutSetup.ls_elevation_fx, ls_elevation_fx, nchan_out_woLFE ); } - if ( hDirACRend->hOutSetup.ambisonics_order == -1 ) + IF ( EQ_16(hDirACRend->hOutSetup.ambisonics_order , -1) ) { hDirACRend->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; /* Order 3 is used by default in DirAC for SHD processing */ - if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_MONO || hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_STEREO ) + move16(); + IF ( EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_MONO) || EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_STEREO) ) { hDirACRend->hOutSetup.ambisonics_order = SBA_FOA_ORDER; + move16(); } } - else if ( hDirACRend->hOutSetup.ambisonics_order >= SBA_FOA_ORDER ) + ELSE IF ( GE_16(hDirACRend->hOutSetup.ambisonics_order , SBA_FOA_ORDER) ) { - mvr2r( ls_azimuth_4d4, ls_azimuth, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); - mvr2r( ls_elevation_4d4, ls_elevation, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); + Copy32( ls_azimuth_4d4_fx, ls_azimuth_fx, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); + Copy32( ls_elevation_4d4_fx, ls_elevation_fx, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); } /*-----------------------------------------------------------------* * set input parameters *-----------------------------------------------------------------*/ - if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_MONO ) + IF ( EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_MONO) ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_MONO; hDirACRend->panningConf = DIRAC_PANNING_HOA3; nchan_out_woLFE = 1; + move16(); } - else if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + ELSE IF ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirACRend->panningConf = DIRAC_PANNING_VBAP; } - else if ( !hDirACRend->hOutSetup.is_loudspeaker_setup && nchan_transport > 1 ) + ELSE IF ( !hDirACRend->hOutSetup.is_loudspeaker_setup && GT_16(nchan_transport , 1) ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; hDirACRend->panningConf = DIRAC_PANNING_HOA3; } - else + ELSE { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_GAIN_SHD; hDirACRend->panningConf = DIRAC_PANNING_HOA3; } - if ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) +#if 1/*TODO: To be removed later(floating buffer malloc and init)*/ + IF ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED - hDirACRend->frequency_axis_fx = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ); - ivas_dirac_dec_get_frequency_axis_fx( hDirACRend->frequency_axis_fx, output_Fs, hSpatParamRendCom->num_freq_bands ); - - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) +#endif + IF( ( hDirACRend->frequency_axis_fx = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { - hDirACRend->frequency_axis[i] = (float) hDirACRend->frequency_axis_fx[i]; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#else - ivas_dirac_dec_get_frequency_axis( hDirACRend->frequency_axis, output_Fs, hSpatParamRendCom->num_freq_bands ); -#endif + set16_fx( hDirACRend->frequency_axis_fx, 0, hSpatParamRendCom->num_freq_bands ); + ivas_dirac_dec_get_frequency_axis_fx( hDirACRend->frequency_axis_fx, output_Fs, hSpatParamRendCom->num_freq_bands ); - if ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 && nchan_transport == 2 ) + + IF ( EQ_16(hDirACRend->panningConf , DIRAC_PANNING_HOA3) && EQ_16(nchan_transport , 2) ) { - if ( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) + IF ( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - ivas_masa_init_stereotype_detection( hDirACRend->masa_stereo_type_detect ); + ivas_masa_init_stereotype_detection_fx( hDirACRend->masa_stereo_type_detect ); } - else + ELSE { hDirACRend->masa_stereo_type_detect = NULL; } hSpatParamRendCom->numIsmDirections = 0; + move16(); /*-----------------------------------------------------------------* * (re)configure sub-modules @@ -11757,65 +11907,74 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* prototype signal computation */ /* allocate output setup related arrays */ - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_LS) ) { /* Directional and diffuses components in output LS format */ hDirACRend->num_outputs_diff = nchan_out_woLFE; hDirACRend->num_outputs_dir = nchan_out_woLFE; } - else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + ELSE IF (EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) { /* Directional and diffuses components in SHD */ /* Diffuseness components up to 1st order */ hDirACRend->num_outputs_diff = ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ); hDirACRend->num_outputs_dir = ivas_sba_get_nchan( hDirACRend->hOutSetup.ambisonics_order, 0 ); } - else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + ELSE IF (EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD) ) { hDirACRend->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; hDirACRend->num_outputs_dir = nchan_out_woLFE; } - else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) + ELSE IF (EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_MONO) ) { hDirACRend->num_outputs_diff = 1; /* There is one output channel in mono */ hDirACRend->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ } - else + ELSE { assert( 0 && "DirAC: not existing synthesis methods!" ); } + move16(); + move16(); - if ( ( hDirACRend->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_dir ) ) == NULL ) + IF ( ( hDirACRend->proto_index_dir = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - if ( ( hDirACRend->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirACRend->num_outputs_diff ) ) == NULL ) + IF ( ( hDirACRend->proto_index_diff = (Word16 *) malloc( sizeof(Word16) * hDirACRend->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_s( hDirACRend->proto_index_dir, 0, hDirACRend->num_outputs_dir ); - set_s( hDirACRend->proto_index_diff, 0, hDirACRend->num_outputs_diff ); + set16_fx( hDirACRend->proto_index_dir, 0, hDirACRend->num_outputs_dir ); + set16_fx( hDirACRend->proto_index_diff, 0, hDirACRend->num_outputs_diff ); hDirACRend->sba_map_tc = sba_map_tc; - if ( nchan_transport == 1 ) + IF ( EQ_16(nchan_transport , 1) ) { hDirACRend->num_protos_ambi = 1; hDirACRend->num_protos_dir = 1; hDirACRend->num_protos_diff = 1; + move16(); + move16(); + move16(); } - else if ( nchan_transport == 2 ) + ELSE IF ( EQ_16(nchan_transport , 2) ) { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) { hDirACRend->num_protos_ambi = 2; hDirACRend->num_protos_diff = 1; hDirACRend->num_protos_dir = 2; hDirACRend->proto_index_dir[1] = 1; + move16(); + move16(); + move16(); + move16(); } - else if ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_MONO ) + ELSE IF (EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_MONO) ) { /* Following the foa rendering for code compatibility */ hDirACRend->num_protos_ambi = 2; @@ -11823,143 +11982,118 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->num_protos_diff = 3; hDirACRend->proto_index_dir[0] = 0; hDirACRend->proto_index_diff[0] = 0; + move16(); + move16(); + move16(); + move16(); + move16(); } - else + ELSE { hDirACRend->num_protos_ambi = 2; hDirACRend->num_protos_diff = 3; + move16(); + move16(); - for ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) + FOR ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) { - if ( ls_azimuth[k] > 0.0f ) + IF ( GT_32(ls_azimuth_fx[k] , 0) ) { hDirACRend->proto_index_diff[k] = 1; } - else if ( ls_azimuth[k] < 0.0f ) + ELSE IF ( LT_32(ls_azimuth_fx[k] , 0) ) { hDirACRend->proto_index_diff[k] = 2; } - else + ELSE { hDirACRend->proto_index_diff[k] = 0; } + move16(); } - if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + IF ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { hDirACRend->num_protos_dir = 3; - mvs2s( hDirACRend->proto_index_diff, hDirACRend->proto_index_dir, nchan_out_woLFE ); + move16(); + Copy( hDirACRend->proto_index_diff, hDirACRend->proto_index_dir, nchan_out_woLFE ); } - else + ELSE { hDirACRend->num_protos_dir = 2; hDirACRend->proto_index_dir[1] = 1; + move16(); + move16(); } } } /* direct/diffuse responses */ -#ifdef IVAS_FLOAT_FIXED + IF( ( hDirACRend->diffuse_response_function_fx = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#endif +#if 1/*TODO: To be removed later (Float buffer malloc)*/ if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } +#endif - if ( ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) + IF ( EQ_16( hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_LS ) || EQ_16( hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf , DIRAC_SYNTHESIS_MONO ) ) { -#ifdef IVAS_FLOAT_FIXED initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); - FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) - { - hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], Q15 ); - } -#else - initDiffuseResponses( hDirACRend->diffuse_response_function, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, - hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); -#endif } - else + ELSE { -#ifdef IVAS_FLOAT_FIXED initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, IVAS_AUDIO_CONFIG_FOA, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); - FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) - { - hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], Q15 ); - } -#else - initDiffuseResponses( hDirACRend->diffuse_response_function, hDirACRend->num_outputs_dir, IVAS_AUDIO_CONFIG_FOA, - hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); -#endif } +#if 1/*TODO: To be removed later(after dependecny on float buffer hoa_encoder is removed)*/ hDirACRend->hoa_encoder = NULL; -#ifdef IVAS_FLOAT_FIXED - hDirACRend->hoa_encoder_fx = NULL; #endif - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + hDirACRend->hoa_encoder_fx = NULL; + IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD) ) { -#ifdef IVAS_FLOAT_FIXED IF ( ( hDirACRend->hoa_encoder_fx = (Word32 *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set32_fx( hDirACRend->hoa_encoder_fx, 0, nchan_out_woLFE * hDirACRend->num_outputs_diff ); - hDirACRend->hoa_encoder_len = nchan_out_woLFE * hDirACRend->num_outputs_diff; -#endif + hDirACRend->hoa_encoder_len = imult1616(nchan_out_woLFE , hDirACRend->num_outputs_diff); +#if 1/*TODO: To be removed later(float buffer malloc and init)*/ if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); - compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirACRend->hoa_encoder, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); +#endif + compute_hoa_encoder_mtx_fx( ls_azimuth_fx, ls_elevation_fx, hDirACRend->hoa_encoder_fx, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); } /* VBAP */ inputMasa->hMasaExtRend->hVBAPdata = NULL; - if ( hDirACRend->panningConf == DIRAC_PANNING_VBAP ) + IF ( EQ_16(hDirACRend->panningConf , DIRAC_PANNING_VBAP) ) { -#ifdef IVAS_FLOAT_FIXED - Word32 ls_azimuth_fx[MAX_OUTPUT_CHANNELS]; - Word32 ls_elevation_fx[MAX_OUTPUT_CHANNELS]; - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - ls_azimuth_fx[i] = (Word32) float_to_fix( ls_azimuth[i], Q22 ); - ls_elevation_fx[i] = (Word32) float_to_fix( ls_elevation[i], Q22 ); - } IF( ( error = vbap_init_data_fx( &( inputMasa->hMasaExtRend->hVBAPdata ), ls_azimuth_fx, ls_elevation_fx, nchan_out_woLFE, MASA_FORMAT ) ) != IVAS_ERR_OK ) { return error; } - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - ls_azimuth[i] = (float) fix_to_float( ls_azimuth_fx[i], Q22 ); - ls_elevation[i] = (float) fix_to_float( ls_elevation_fx[i], Q22 ); - } -#else - if ( ( error = vbap_init_data( &( inputMasa->hMasaExtRend->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE, MASA_FORMAT ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } /* HOA panning/dec */ hDirACRend->hoa_decoder = NULL; - if ( hDirACRend->panningConf == DIRAC_PANNING_HOA3 ) + IF ( EQ_16(hDirACRend->panningConf , DIRAC_PANNING_HOA3) ) { - if ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + IF ( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - if ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } @@ -11970,16 +12104,14 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* decorrelation */ hDirACRend->proto_signal_decorr_on = 1; - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) + IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_MONO) ) { hDirACRend->proto_signal_decorr_on = 0; } - if ( hDirACRend->proto_signal_decorr_on ) + IF ( hDirACRend->proto_signal_decorr_on ) { -#ifdef IVAS_FLOAT_FIXED - hDirACRend->frequency_axis[i] = (float)hDirACRend->frequency_axis_fx[i]; - if ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), + IF ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, @@ -11992,74 +12124,65 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( return error; } -#else - - if ( ( error = ivas_dirac_dec_decorr_open( &( hDirACRend->h_freq_domain_decorr_ap_params ), - &( hDirACRend->h_freq_domain_decorr_ap_state ), - hSpatParamRendCom->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - hDirACRend->frequency_axis, - nchan_transport, - output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } /* output synthesis */ -#ifdef IVAS_FLOAT_FIXED - if ( ( ivas_dirac_dec_output_synthesis_open_fx( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ) != IVAS_ERR_OK ) + IF ( ( ivas_dirac_dec_output_synthesis_open_fx( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( ivas_dirac_dec_output_synthesis_open( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; + move16(); - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD) || EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) { hDirACRend->h_output_synthesis_psd_params.use_onset_filters = 0; + move16(); } /*-----------------------------------------------------------------* * memory allocation *-----------------------------------------------------------------*/ - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) { hDirACRend->proto_frame_f = NULL; } - else + ELSE { - if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) +#if 1/*TODO: To be removed later(after dependency on proto_frame_f is completely removed)*/ + IF ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } +#endif + IF( ( hDirACRend->proto_frame_f_fx = (Word32 *) malloc( sizeof(Word32) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } +#if 1/*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ hDirACRend->buffer_energy = NULL; +#endif - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { +#if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ hDirACRend->buffer_intensity_real[i][j] = NULL; +#endif + hDirACRend->buffer_intensity_real_fx[i][j] = NULL; } } /* output synthesis */ - ivas_dirac_dec_output_synthesis_init( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, 0 ); + ivas_dirac_dec_output_synthesis_init_fx( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, 0 ); /* Allocate stack memory */ - if ( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -12407,42 +12530,199 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->buffer_energy = NULL; - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + { + for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + { + hDirACRend->buffer_intensity_real[i][j] = NULL; + } + } + + /* output synthesis */ + ivas_dirac_dec_output_synthesis_init( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, 0 ); + + /* Allocate stack memory */ + if ( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + inputMasa->hMasaExtRend->hDirACRend = hDirACRend; + + return error; +} +#endif + +#ifndef IVAS_FLOAT_FIXED +static ivas_error ivas_masa_ext_rend_parambin_init( + input_masa *inputMasa /* i/o: MASA external renderer structure */ +) +{ + DIRAC_DEC_BIN_HANDLE hDiracDecBin; + HRTFS_PARAMBIN_HANDLE hHrtfParambin; + int16_t nBins; + int32_t output_Fs; + RENDERER_TYPE renderer_type; + int16_t j, k, bin; + float binCenterFreq, tmpFloat; + ivas_error error; + float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + + error = IVAS_ERR_OK; + + hHrtfParambin = inputMasa->hMasaExtRend->hHrtfParambin; + + /* Set common variables and defaults */ + output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); + nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands; + renderer_type = inputMasa->hMasaExtRend->renderer_type; + + hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; + + /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); + } + + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ + hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ + + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) + { + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); + } + + for ( k = 0; k < BINAURAL_CHANNELS; k++ ) + { + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); + } + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + } + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; + + for ( bin = 0; bin < nBins; bin++ ) + { + binCenterFreq = ( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f ); + /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ + tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + } + + /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ + set_zero( hDiracDecBin->diffuseFieldCoherenceX, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero( hDiracDecBin->diffuseFieldCoherenceY, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero( hDiracDecBin->diffuseFieldCoherenceZ, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + + if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + } + else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + { + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + + if ( hDiracDecBin->hReverb == NULL ) + { + /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + } + else /* Not valid renderer type for this renderer */ + { + assert( false ); + } + + /* Always open frequency domain decorrelator */ +#ifdef IVAS_FLOAT_FIXED + Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; + ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); + + for ( int i = 0; i < nBins; i++ ) { - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) - { - hDirACRend->buffer_intensity_real[i][j] = NULL; - } + frequency_axis[i] = (float) frequency_axis_fx[i]; } + if ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis_fx, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - /* output synthesis */ - ivas_dirac_dec_output_synthesis_init( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, 0 ); - - /* Allocate stack memory */ - if ( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif + /* External renderer uses constant regularization factor */ +#ifdef IVAS_FLOAT_FIXED + hDiracDecBin->reqularizationFactor_fx = 6554; + move16(); +#else + hDiracDecBin->reqularizationFactor = 0.4f; +#endif - inputMasa->hMasaExtRend->hDirACRend = hDirACRend; + inputMasa->hMasaExtRend->hDiracDecBin = hDiracDecBin; return error; } -#endif - +#else static ivas_error ivas_masa_ext_rend_parambin_init( input_masa *inputMasa /* i/o: MASA external renderer structure */ ) { DIRAC_DEC_BIN_HANDLE hDiracDecBin; HRTFS_PARAMBIN_HANDLE hHrtfParambin; - int16_t nBins; - int32_t output_Fs; + Word16 nBins; + Word32 output_Fs; RENDERER_TYPE renderer_type; - int16_t j, k, bin; - float binCenterFreq, tmpFloat; + Word16 j, k, bin; + Word32 binCenterFreq_fx; + Word16 tmpFloat_fx; ivas_error error; - float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 tmp; + Word16 tmp_e; + Word16 tmp2; error = IVAS_ERR_OK; @@ -12451,12 +12731,14 @@ static ivas_error ivas_masa_ext_rend_parambin_init( /* Set common variables and defaults */ output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands; + move32(); + move16(); renderer_type = inputMasa->hMasaExtRend->renderer_type; hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ - if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + IF ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); } @@ -12467,81 +12749,107 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) + FOR ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { +#if 1/*To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); +#endif + set16_fx( hDiracDecBin->processMtxRe_fx[j][k],0, nBins ); + set16_fx( hDiracDecBin->processMtxIm_fx[j][k],0, nBins ); } - for ( k = 0; k < BINAURAL_CHANNELS; k++ ) + FOR ( k = 0; k < BINAURAL_CHANNELS; k++ ) { +#if 1/*To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); +#endif + set16_fx( hDiracDecBin->processMtxDecRe_fx[j][k],0, nBins ); + set16_fx( hDiracDecBin->processMtxDecIm_fx[j][k],0, nBins ); } +#if 1/*TODO:To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->ChEnePrev[j], nBins ); set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); +#endif + set_zero_fx( hDiracDecBin->ChEnePrev_fx[j], nBins ); + set_zero_fx( hDiracDecBin->ChEneOutPrev_fx[j], nBins ); } +#if 1/*TODO:To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->ChCrossRePrev, nBins ); set_zero( hDiracDecBin->ChCrossImPrev, nBins ); set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); +#endif + set_zero_fx( hDiracDecBin->ChCrossRePrev_fx, nBins ); + set_zero_fx( hDiracDecBin->ChCrossImPrev_fx, nBins ); + set_zero_fx( hDiracDecBin->ChCrossReOutPrev_fx, nBins ); + set_zero_fx( hDiracDecBin->ChCrossImOutPrev_fx, nBins ); hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - for ( bin = 0; bin < nBins; bin++ ) + FOR ( bin = 0; bin < nBins; bin++ ) { - binCenterFreq = ( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f ); + binCenterFreq_fx = L_mult0(extract_l(L_shr(output_Fs,1)), div_s(add(shl(bin, 1), 1), shl(nBins, 1)))/*( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f )*/;/*Q15*/ /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + tmp = BASOP_Util_Divide3232_Scale( binCenterFreq_fx, 2700<diffuseFieldCoherence_fx[bin] = L_shl(L_mult0(divide3232(tmpFloat_fx, Mult_32_16(binCenterFreq_fx, 187/*2^15*pi/550*/)), getSineWord16R2(tmp2)), tmp_e);/*tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f );*/ + hDiracDecBin->diffuseFieldCoherence[bin] = fixedToFloat( hDiracDecBin->diffuseFieldCoherence_fx[bin], Q30 ); } /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ +#if 1/*TODO: To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->diffuseFieldCoherenceX, BINAURAL_COHERENCE_DIFFERENCE_BINS ); set_zero( hDiracDecBin->diffuseFieldCoherenceY, BINAURAL_COHERENCE_DIFFERENCE_BINS ); set_zero( hDiracDecBin->diffuseFieldCoherenceZ, BINAURAL_COHERENCE_DIFFERENCE_BINS ); +#endif + set_zero_fx( hDiracDecBin->diffuseFieldCoherenceX_fx, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero_fx( hDiracDecBin->diffuseFieldCoherenceY_fx, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero_fx( hDiracDecBin->diffuseFieldCoherenceZ_fx, BINAURAL_COHERENCE_DIFFERENCE_BINS ); - if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + IF ( EQ_16(renderer_type , RENDERER_BINAURAL_PARAMETRIC) ) /* Indication of binaural rendering without room effect */ { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28/*1.0f Q28*/, CLDFB_NO_CHANNELS_MAX ); hDiracDecBin->hReverb = NULL; } - else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + ELSE IF ( EQ_16(renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) ) /* Indication of binaural rendering with room effect */ { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + Copy32( hHrtfParambin->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); - if ( hDiracDecBin->hReverb == NULL ) + IF ( hDiracDecBin->hReverb == NULL ) { /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } } } - else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + ELSE IF ( EQ_16(renderer_type , RENDERER_STEREO_PARAMETRIC) ) { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28 /*1.0f Q28*/, CLDFB_NO_CHANNELS_MAX ); hDiracDecBin->hReverb = NULL; hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; } - else /* Not valid renderer type for this renderer */ + ELSE /* Not valid renderer type for this renderer */ { assert( false ); } /* Always open frequency domain decorrelator */ -#ifdef IVAS_FLOAT_FIXED - Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); - for ( int i = 0; i < nBins; i++ ) - { - frequency_axis[i] = (float) frequency_axis_fx[i]; - } - if ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + IF ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), &( hDiracDecBin->h_freq_domain_decorr_ap_state ), nBins, BINAURAL_CHANNELS, @@ -12553,35 +12861,17 @@ static ivas_error ivas_masa_ext_rend_parambin_init( { return error; } -#else - ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - - if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /* External renderer uses constant regularization factor */ -#ifdef IVAS_FLOAT_FIXED hDiracDecBin->reqularizationFactor_fx = 6554; move16(); -#else - hDiracDecBin->reqularizationFactor = 0.4f; -#endif inputMasa->hMasaExtRend->hDiracDecBin = hDiracDecBin; return error; } +#endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG outConfig ) @@ -12744,6 +13034,170 @@ static ivas_error initMasaExtRenderer( return IVAS_ERR_OK; } +#else +static ivas_error initMasaExtRenderer( + input_masa *inputMasa, + const AUDIO_CONFIG outConfig ) +{ + Word16 i; + ivas_error error; + MASA_EXT_REND_HANDLE hMasaExtRend; + + error = IVAS_ERR_OK; + + IF ( ( hMasaExtRend = (MASA_EXT_REND_HANDLE) malloc( sizeof( MASA_EXT_REND_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA external renderer structure\n" ) ); + } + + inputMasa->hMasaExtRend = hMasaExtRend; + + /* Default init */ + hMasaExtRend->renderer_type = RENDERER_DISABLE; + hMasaExtRend->hDirACRend = NULL; + hMasaExtRend->hSpatParamRendCom = NULL; + hMasaExtRend->hDiracDecBin = NULL; + hMasaExtRend->hReverb = NULL; + hMasaExtRend->hHrtfParambin = NULL; + hMasaExtRend->hVBAPdata = NULL; + hMasaExtRend->hoa_dec_mtx = NULL; + + IF ( ( error = getAudioConfigNumChannels( inputMasa->base.inConfig, &hMasaExtRend->nchan_input ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = getAudioConfigNumChannels( outConfig, &hMasaExtRend->nchan_output ) ) != IVAS_ERR_OK ) + { + return error; + } + + SWITCH ( outConfig ) + { + case IVAS_AUDIO_CONFIG_MONO: + IF ( EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA2) ) + { + hMasaExtRend->renderer_type = RENDERER_DIRAC; + } + ELSE + { + /* 1TC MASA to mono does not need rendering. */ + hMasaExtRend->renderer_type = RENDERER_DISABLE; + } + BREAK; + + case IVAS_AUDIO_CONFIG_STEREO: + hMasaExtRend->renderer_type = RENDERER_STEREO_PARAMETRIC; + BREAK; + + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1_4: + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + case IVAS_AUDIO_CONFIG_FOA: + case IVAS_AUDIO_CONFIG_HOA2: + case IVAS_AUDIO_CONFIG_HOA3: + hMasaExtRend->renderer_type = RENDERER_DIRAC; + BREAK; + + case IVAS_AUDIO_CONFIG_BINAURAL: + hMasaExtRend->renderer_type = RENDERER_BINAURAL_PARAMETRIC; + BREAK; + + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + hMasaExtRend->renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; + BREAK; + + default: + return ( IVAS_ERROR( IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, "Wrong output config for MASA input in external renderer\n" ) ); + } + + IF ( NE_16(hMasaExtRend->renderer_type , RENDERER_DISABLE) ) + { + Word16 subframe; + IF( ( error = ivas_spat_hSpatParamRendCom_config_fx( &hMasaExtRend->hSpatParamRendCom, DIRAC_OPEN, 0, MASA_FORMAT, MC_MODE_NONE, *( inputMasa->base.ctx.pOutSampleRate ), 0, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + /* Simple population of the metadata index map as no adaptation is present */ + set16_fx( hMasaExtRend->hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + FOR ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) + { + hMasaExtRend->hSpatParamRendCom->render_to_md_map[subframe] = subframe; + move16(); + } + hMasaExtRend->hSpatParamRendCom->subframes_rendered = 0; + move16(); + } + + IF ( EQ_16(hMasaExtRend->renderer_type , RENDERER_DIRAC) ) + { + IF ( ( error = ivas_masa_ext_rend_dirac_rend_init( inputMasa ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( EQ_16(hMasaExtRend->renderer_type , RENDERER_BINAURAL_PARAMETRIC) || EQ_16(hMasaExtRend->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(hMasaExtRend->renderer_type , RENDERER_STEREO_PARAMETRIC) ) + { + IF ( NE_16(hMasaExtRend->renderer_type , RENDERER_STEREO_PARAMETRIC) ) + { + IF ( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1/*TODO: To be removed later after dependency on floating buffers in hHrtfParambin is removed*/ + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif // IVAS_FLOAT_FIXED + } + + IF ( ( error = ivas_masa_ext_rend_parambin_init( inputMasa ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Init CLDFB for analysis & synthesis if renderer is used. Otherwise, NULL. */ + FOR ( i = 0; i < MASA_MAX_TRANSPORT_CHANNELS; i++ ) + { + hMasaExtRend->cldfbAnaRend[i] = NULL; + } + + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + hMasaExtRend->cldfbSynRend[i] = NULL; + } + + IF ( hMasaExtRend->renderer_type != RENDERER_DISABLE ) + { + FOR ( i = 0; i < hMasaExtRend->nchan_input; i++ ) + { + IF ( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + FOR ( i = 0; i < hMasaExtRend->nchan_output; i++ ) + { + IF ( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + inputMasa->hMasaExtRend = hMasaExtRend; + + return IVAS_ERR_OK; +} +#endif // IVAS_FLOAT_FIXED static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut ) -- GitLab From b82e8fec26bfa04df113789cec55d2e915ffcbf4 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 13 May 2024 09:34:06 +0530 Subject: [PATCH 036/101] MSAN fixes for STEREO, OSBA High MLD fix [x] Fix for High MLD issue for a OSBA stream [x] MSAN fixes - STEREO streams [x] Fixed crash in ltv48_MC512.wav_Multi_channel_5_1_2_bitrate_switching_from_13_2_kbps_to_512_kbps_48kHz_in_16kHz_out_BINAURAL_ROOM_out.192 --- lib_dec/acelp_core_dec_ivas_fx.c | 24 +++++++++++++++++++++++ lib_dec/ivas_core_dec.c | 7 +++++-- lib_dec/ivas_dirac_output_synthesis_cov.c | 2 ++ lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_jbm_dec.c | 8 ++++---- lib_dec/ivas_mc_param_dec.c | 4 ++++ lib_dec/ivas_mct_dec.c | 12 ++++++------ lib_dec/ivas_mdct_core_dec.c | 5 +++++ lib_dec/ivas_post_proc.c | 8 ++++++++ lib_dec/ivas_stat_dec.h | 3 +++ lib_dec/ivas_stereo_switching_dec.c | 8 ++++++++ 11 files changed, 70 insertions(+), 13 deletions(-) diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index e3d00c4f5..39d3284ea 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -775,7 +775,12 @@ ivas_error acelp_core_dec_ivas_fx( /* Check LSF stability (distance between old LSFs and current LSFs) */ st->stab_fac_fx = lsf_stab_ivas_fx( lsf_new_fx, st->lsf_old_fx, 0, st->L_frame ); } +#ifndef MSAN_FIX for (int nsf = 0; nsf < NB_SUBFR16k; nsf++) { +#else + FOR( int nsf = 0; nsf < st->nb_subfr; nsf++ ) +#endif + { Scale_sig(Aq_fx + (nsf * (M + 1)), M + 1, norm_s(Aq_fx[nsf * (M + 1)]) - Q2); Aq_fx[nsf * (M + 1)] = ONE_IN_Q12; } @@ -1518,9 +1523,14 @@ ivas_error acelp_core_dec_ivas_fx( pRealSave_fx[i] = realBufferSave_fx[i]; pImagSave_fx[i] = imagBufferSave_fx[i]; } +#ifndef MSAN_FIX Copy_Scale_sig_16_32(bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1); //Q_syn-1 +#endif IF(st->p_bpf_noise_buf_32) { +#ifdef MSAN_FIX + Copy_Scale_sig_16_32( bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1 ); // Q_syn-1 +#endif Copy32(bpf_error_signal_fx, st->p_bpf_noise_buf_32, st->L_frame); Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( Q11, sub( st->Q_syn, 1 ) ) ); } @@ -1703,7 +1713,11 @@ ivas_error acelp_core_dec_ivas_fx( int16_t nSamples = NS2SA(st->L_frame * FRAMES_PER_SEC, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/); /* IVAS-64: optimization is likely possible here (don't resample the whole frame) */ /* analysis of the synthesis at internal sampling rate - needed for DFT stereo -> TD stereo switching */ +#ifndef MSAN_FIX for (i = 0; i < L_FRAME16k; i++) +#else + FOR( i = 0; i < st->L_frame; i++ ) +#endif { syn_32_fx[i] = L_shr(L_deposit_h(psyn_fx[i]), 4 + st->Q_syn); } @@ -1763,11 +1777,17 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); } Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1) +#ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1); +#endif cldfbSynthesis_ivas_fx(realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA(st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/), st->cldfbSyn); +#ifdef MSAN_FIX + Scale_sig32(synth_fx, output_frame, -(Q_real - 1)); +#else Scale_sig32(synth_fx, L_FRAME48k, -(Q_real - 1)); +#endif Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q10 - (Q_real - 1)); if (st->p_bpf_noise_buf_32) @@ -1783,7 +1803,11 @@ ivas_error acelp_core_dec_ivas_fx( } /* Copy output signal */ +#ifndef MSAN_FIX Scale_sig(syn_tmp_fx, L_FRAME16k + L_SUBFR, -st->Q_syn); +#else + Scale_sig(syn_tmp_fx, st->L_frame + L_SUBFR, -st->Q_syn); +#endif if (st->element_mode > EVS_MONO) { Copy(psyn_fx, output_fx, st->L_frame); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index fd83492fd..672dab774 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1142,10 +1142,13 @@ ivas_error ivas_core_dec( } Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); - +#ifdef MSAN_FIX + Scale_sig32(hb_synth_32_fx[0], output_frame, sub(Q11 , q)); + Scale_sig32(hb_synth_32_fx[1], output_frame, sub(Q11 , q)); +#else Scale_sig32(hb_synth_32_fx[0], L_FRAME48k, sub(Q11 , q)); Scale_sig32(hb_synth_32_fx[1], L_FRAME48k, sub(Q11 , q)); - +#endif } IF( EQ_16( st->element_mode, EVS_MONO ) ) diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index e558dda69..8fbb8bb9b 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -100,6 +100,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } + h_dirac_output_synthesis_state->cx_old_len = nchan_in * nchan_in; + move16(); if ( ( h_dirac_output_synthesis_state->cy_old_fx[idx] = (Word32 *) malloc( nchan_out * nchan_out * sizeof(Word32) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2ed3529f1..54156a695 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1976,7 +1976,7 @@ ivas_error ivas_init_decoder_fx( // } // } //} - fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); + fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, s_min(hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) ); //if ( hParamMC->ls_conv_dmx_matrix ) // fixedToFloat_arrL( hParamMC->ls_conv_dmx_matrix_fx, hParamMC->ls_conv_dmx_matrix, Q30, nchan_out_transport * nchan_out_cov ); if ( hParamMC->hoa_encoder_fx ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index f56362f1b..25a296bc4 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1339,7 +1339,7 @@ ivas_error ivas_jbm_dec_tc( #endif #endif // IVAS_FLOAT_FIXED } - ELSE IF( st_ivas->renderer_type != RENDERER_DISABLE && NE_16( st_ivas->sba_dirac_stereo_flag, 0 ) ) + ELSE IF( st_ivas->renderer_type != RENDERER_DISABLE && EQ_16( st_ivas->sba_dirac_stereo_flag, 0 ) ) { Word16 size = st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport + sba_ch_idx; IF( EQ_16( size, 3 ) ) @@ -3842,10 +3842,10 @@ void ivas_jbm_dec_feed_tc_to_renderer( FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) { - f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], nchan_transport * nchan_transport); + f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport)); f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], nchan_out_cov * nchan_out_cov); } - f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, nchan_transport * nchan_out_transport); + f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_transport * nchan_out_transport)); ivas_param_mc_dec_digest_tc_fx( st_ivas, (uint8_t) n_render_timeslots, (Word32 **)p_data_f_fx, in_q ); @@ -3863,7 +3863,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) { - me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], nchan_transport * nchan_transport); + me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport)); me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx], nchan_out_cov * nchan_out_cov); } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 2e18522b5..7474cd375 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -382,6 +382,8 @@ ivas_error ivas_param_mc_dec_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } + hParamMC->proto_matrix_int_len = nchan_out_transport * nchan_transport; + move16(); if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { @@ -1461,6 +1463,8 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } + hParamMC->proto_matrix_int_len = nchan_out_transport * nchan_transport; + move16(); Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, hParamMC->proto_matrix_int_fx, nchan_transport * nchan_out_transport );/*Q31*/ } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 9bccd4b81..ea952616c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1443,9 +1443,9 @@ ivas_error ivas_mc_dec_config( if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) { - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport_old * nchan_transport_old )); floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, s_min(hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_len, nchan_transport_old * nchan_out_cov) ); } } for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) @@ -1455,7 +1455,7 @@ ivas_error ivas_mc_dec_config( floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); } } - floatToFixed_arrL( hParamMC->proto_matrix_int, hParamMC->proto_matrix_int_fx, Q31, nchan_out_transport * nchan_transport ); + floatToFixed_arrL( hParamMC->proto_matrix_int, hParamMC->proto_matrix_int_fx, Q31, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) ); FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) { if ( hParamMC->diff_proto_info ) @@ -1509,7 +1509,7 @@ ivas_error ivas_mc_dec_config( { fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); } - fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); + fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) ); /*IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) fixedToFloat_arrL( st_ivas->hParamMC->ls_conv_dmx_matrix_fx, st_ivas->hParamMC->ls_conv_dmx_matrix, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) );*/ if ( last_mc_mode == MC_MODE_PARAMMC ) @@ -1518,9 +1518,9 @@ ivas_error ivas_mc_dec_config( { if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport_old * nchan_transport_old) ); fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, s_min(hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_len, nchan_transport_old * nchan_out_cov) ); } } for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 7aa9de8ce..16008fb1f 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -989,8 +989,13 @@ void ivas_mdct_core_invQ_fx( /* both input in same Q */ stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0[1], &spectralData_tmp[0], &spectralData_tmp[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, 1, &q_r, &q_l ); +#ifdef MSAN_FIX + Copy_Scale_sig_32_16( spectralData_tmp[0], sts[0]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[0], -15 ); + Copy_Scale_sig_32_16( spectralData_tmp[1], sts[1]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[1], -15 ); +#else Copy_Scale_sig_32_16( spectralData_tmp[0], sts[0]->hTonalMDCTConc->lastBlockData.spectralData, L_FRAME_MAX, -15 ); Copy_Scale_sig_32_16( spectralData_tmp[1], sts[1]->hTonalMDCTConc->lastBlockData.spectralData, L_FRAME_MAX, -15 ); +#endif sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp = sub( 30, q_l ); sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp = sub( 30, q_r ); } diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 8a50efab3..7267195a8 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -322,7 +322,11 @@ void stereo_dft_dec_core_switching_fx( IF( st->p_bpf_noise_buf_32 ) { +#ifdef MSAN_FIX + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); +#else Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, sub( *q, Q11 ) ); +#endif } IF( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE || ( st->bfi == 1 && st->core == ACELP_CORE && st->con_tcx == 1 ) ) @@ -700,7 +704,11 @@ void stereo_dft_dec_core_switching_fx( IF( st->p_bpf_noise_buf_32 ) { +#ifdef MSAN_FIX + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, negate( sub( *q, Q11 ) ) ); +#else Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, negate( sub( *q, Q11 ) ) ); +#endif } return; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 2b6fbddfa..43c23da67 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -787,8 +787,10 @@ typedef struct dirac_output_synthesis_cov_state_structure float *mixing_matrix_res[CLDFB_NO_CHANNELS_MAX]; #ifdef IVAS_FLOAT_FIXED Word32 *cx_old_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 cx_old_len; Word32 *cy_old_fx[CLDFB_NO_CHANNELS_MAX]; Word32 *mixing_matrix_old_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 mixing_matrix_old_len; Word32 *mixing_matrix_fx[CLDFB_NO_CHANNELS_MAX]; Word32 *mixing_matrix_res_old_fx[CLDFB_NO_CHANNELS_MAX]; Word32 *mixing_matrix_res_fx[CLDFB_NO_CHANNELS_MAX]; @@ -886,6 +888,7 @@ typedef struct ivas_param_mc_dec_data_structure Word32 *ls_conv_dmx_matrix_fx; Word16 ls_conv_dmx_e; Word32 *proto_matrix_int_fx; + Word16 proto_matrix_int_len; Word16 proto_matrix_int_e; #endif diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 78f8b26dd..029e2bcff 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -3637,12 +3637,20 @@ void stereo_td2dft_update_fx( /* update buffers used for fading when switching to DFT Stereo */ v_add_fx( sts[0]->hHQ_core->old_outLB_fx + nsLB, sts[1]->hHQ_core->old_outLB_fx + nsLB, hCPE->old_outLB_mdct_fx, old_outLB_len ); L_lerp_fx_q11( hCPE->old_outLB_mdct_fx, hCPE->old_outLB_mdct_fx, STEREO_MDCT2DFT_FADE_LEN_48k, old_outLB_len ); +#ifndef MSAN_FIX for ( int i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) +#else + FOR( int i = 0; i < old_outLB_len; i++ ) +#endif { hCPE->old_outLB_mdct_fx[i] = L_shr( hCPE->old_outLB_mdct_fx[i], 1 ); } v_add_fx( sts[0]->hHQ_core->oldOut_fx + ns, sts[1]->hHQ_core->oldOut_fx + ns, hCPE->old_out_mdct_fx, old_out_len ); +#ifndef MSAN_FIX for ( int i = 0; i < STEREO_MDCT2DFT_FADE_LEN_48k; i++ ) +#else + FOR( int i = 0; i < old_out_len; i++ ) +#endif { hCPE->old_out_mdct_fx[i] = L_shr( hCPE->old_out_mdct_fx[i], 1 ); } -- GitLab From 4284a6ea0451b979af50b8f54080f268811e36f5 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 13 May 2024 11:12:52 -0400 Subject: [PATCH 037/101] replace hard coded Q 18 with constant Q_icBWE. This is a bit exact modification --- lib_dec/ivas_stereo_icbwe_dec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 150df7e1d..1b1ec2837 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -46,6 +46,7 @@ #include "ivas_rom_com.h" +#define Q_icBWE 18 /*-------------------------------------------------------------------* * ic_bwe_dec_reset() @@ -915,9 +916,9 @@ void stereo_icBWE_dec_fx( // common Q for addition L_nlExc16k = L_deposit_l( hStereoICBWE->nlExc16k_fx[k] ); // prev_q_bwe_exc - 16 L_mixExc16k = L_deposit_l( hStereoICBWE->mixExc16k_fx[k] ); // Q_exc - L_nlExc16k = L_shl( L_nlExc16k, 18 - ( st->prev_Q_bwe_exc - 16 ) ); // Q18 - L_mixExc16k = L_shl( L_mixExc16k, 18 - st->Q_exc ); // Q18 - excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q18 + L_nlExc16k = L_shl( L_nlExc16k, Q_icBWE - ( st->prev_Q_bwe_exc - 16 ) ); // Q_icBWE + L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - st->Q_exc ); // Q_icBWE + excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q_icBWE move32(); k++; } @@ -929,13 +930,13 @@ void stereo_icBWE_dec_fx( Q_syn_shb = FindScale( hStereoICBWE->mem_syn_shb_nonref_fx, LPC_SHB_ORDER, hStereoICBWE->prev_Q_syn_shb_nonref, Q_syn_shb ); Q_syn_shb = FindScale( hStereoICBWE->lpSHBRef_fx, LPC_SHB_ORDER + 1, 12, Q_syn_shb ); - Q_syn_shb = FindScale( excSHB_nonref_fx, L_FRAME16k, 18, Q_syn_shb ); + Q_syn_shb = FindScale( excSHB_nonref_fx, L_FRAME16k, Q_icBWE, Q_syn_shb ); Q_syn_shb = FindScale( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, hStereoICBWE->prev_Q_lpc_shbsynth_nonref, Q_syn_shb ); Q_syn_shb = sub( Q_syn_shb, 3 ); // gaurded bits Scale_sig32( hStereoICBWE->lpSHBRef_fx, LPC_SHB_ORDER + 1, sub( Q_syn_shb, 12 ) ); - Scale_sig32( excSHB_nonref_fx, L_FRAME16k, sub( Q_syn_shb, 18 ) ); + Scale_sig32( excSHB_nonref_fx, L_FRAME16k, sub( Q_syn_shb, Q_icBWE ) ); Scale_sig32( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, sub( Q_syn_shb, hStereoICBWE->prev_Q_lpc_shbsynth_nonref ) ); Scale_sig32( hStereoICBWE->mem_syn_shb_nonref_fx, L_SHB_LAHEAD, sub( Q_syn_shb, hStereoICBWE->prev_Q_syn_shb_nonref ) ); -- GitLab From f422f6cee3d54f3b2419d1a0627c7408dcbfd09b Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 13 May 2024 11:22:07 -0400 Subject: [PATCH 038/101] Change Q18 to Q16, solves the crash and the difference created otherwise is of +/- 3 on the synthesis --- lib_dec/ivas_stereo_icbwe_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 1b1ec2837..997e6d9f4 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -46,7 +46,7 @@ #include "ivas_rom_com.h" -#define Q_icBWE 18 +#define Q_icBWE 16 /*-------------------------------------------------------------------* * ic_bwe_dec_reset() -- GitLab From 84dd0f5787cacb0f8dc72794886c771a4ce3663f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 14 May 2024 09:07:11 +0530 Subject: [PATCH 039/101] ASAN_MSAN_USAN_Warnings_LTV_Fixes [x] Few ASAN errors fixed. [x] Few MSAN errors for SBA path fixed. [x] Corrected Q factor in non_linearity_ivas_fx. [x] Warnings fixes. [x] Clean up of lib_rend.c. --- lib_com/arith_coder_fx.c | 2 +- lib_com/fd_cng_com.c | 4 +- lib_com/float_to_fix_ops.c | 29 +- lib_com/prot.h | 4 +- lib_com/swb_bwe_com_fx.c | 4 +- lib_com/swb_tbe_com_fx.c | 4 +- lib_com/window_ola_fx.c | 10 +- lib_com/wtda_fx.c | 8 +- lib_dec/ACcontextMapping_dec_fx.c | 4 +- lib_dec/FEC_HQ_phase_ecu_fx.c | 2 +- lib_dec/acelp_core_dec_ivas_fx.c | 16 +- lib_dec/core_dec_init_fx.c | 13 +- lib_dec/dec_tcx_fx.c | 2 +- lib_dec/hq_core_dec_fx.c | 4 +- lib_dec/ivas_core_dec.c | 26 +- lib_dec/ivas_init_dec.c | 10 + lib_dec/ivas_ism_dec.c | 2 + lib_dec/ivas_jbm_dec.c | 2 + lib_dec/ivas_sba_dec.c | 2 + lib_dec/jbm_pcmdsp_apa.c | 92 +- lib_dec/tonalMDCTconcealment_fx.c | 6 +- lib_rend/ivas_masa_merge.c | 12 +- lib_rend/ivas_objectRenderer.c | 9 +- lib_rend/ivas_omasa_ana.c | 19 +- lib_rend/ivas_prot_rend.h | 1 - lib_rend/ivas_stat_rend.h | 5 +- lib_rend/lib_rend.c | 3176 ++++++++++++++--------------- lib_util/hrtf_file_reader.c | 8 +- 28 files changed, 1814 insertions(+), 1662 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index ceb9b07de..efcc4b731 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -260,7 +260,7 @@ void tcx_arith_scale_envelope( b_e = add(b_e, mean_e); /* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */ - tmp = round_fx(BASOP_Util_Add_Mant32Exp(L_mult(b, b), shl(b_e, 1), Mpy_32_16_1(a, -4588/*-4.0f*0.035f Q15*/), a_e, &tmp2)); + tmp = round_fx_o(BASOP_Util_Add_Mant32Exp(L_mult(b, b), shl(b_e, 1), Mpy_32_16_1(a, -4588/*-4.0f*0.035f Q15*/), a_e, &tmp2), &Overflow); IF( tmp <= 0 ) { diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index 7ebf70ec8..c99088fcd 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -88,7 +88,8 @@ ivas_error createFdCngCom_flt( void initFdCngCom_flt( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const float scale ) + const float scale +) { #ifndef IVAS_FLOAT_FIXED /* Calculate FFT scaling factor */ @@ -102,6 +103,7 @@ void initFdCngCom_flt( /* Initialize the comfort noise generation */ set_f( hFdCngCom->fftBuffer_flt, 0.0f, FFTLEN ); #endif + UNUSED_PARAM(scale); set_f( hFdCngCom->cngNoiseLevel_flt, 0.0f, FFTCLDFBLEN ); set_f( hFdCngCom->olapBufferSynth2_flt, 0.0f, FFTLEN ); diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index dc7a3a9f9..780f87270 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -844,10 +844,20 @@ void fixed_to_float_stereo_tcx_core_dec( //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); } - for ( int p = 0; p < st->L_frame; p++ ) + if (st->hHQ_core->Q_old_wtda >= 0) { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); + for ( int p = 0; p < st->L_frame; p++ ) + { + st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); + st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); + } + } + else{ + for ( int p = 0; p < st->L_frame; p++ ) + { + st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); + st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); + } } //for ( int p = 0; p < st->L_frame; p++ ) //{ @@ -903,9 +913,18 @@ void fixed_to_float_stereo_tcx_core_dec( //{ // st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->fftBuffer[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) ); //} - for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) + if(( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) >= 0) { - st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); + for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) + { + st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); + } + } + else{ + for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) + { + st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] * ( 1u << ( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp - 31) ) ); + } } for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) { diff --git a/lib_com/prot.h b/lib_com/prot.h index bc84c7a92..d55404f79 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -8796,7 +8796,9 @@ void deleteFdCngCom_flt( void initFdCngCom_flt( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const float scale ); + const float scale +); + void initPartitions_flt( const int16_t *part_in, diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 8c7d50656..f1cae97fe 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -1057,8 +1057,8 @@ void WB_BWE_decoding_fx( energy = L_deposit_l(0); FOR(n_freq = swb_bwe_subband[n_band]; n_freq < swb_bwe_subband[n_band + L]; n_freq++) { - L_tmp = L_mult(WB_signal[n_freq],WB_signal[n_freq]); /*Q31 */ - energy = L_add(energy,L_shr(L_tmp,6)); /*Q25 */ + L_tmp = L_mult0(WB_signal[n_freq],WB_signal[n_freq]); /*Q30 */ + energy = L_add(energy,L_shr(L_tmp,5)); /*Q25 */ } tmp = sub(swb_bwe_subband[n_band + L] , swb_bwe_subband[n_band]); diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 72f498925..ea5cbcd09 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -4559,7 +4559,7 @@ void non_linearity_ivas_fx( } test(); - IF ( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 32 ), scale )) + IF ( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ) /*Q30 -> Q31*/, scale/*Q31*/ )) { scale_step = 16384; move16(); /* Q14 */ @@ -4645,7 +4645,7 @@ void non_linearity_ivas_fx( } test(); - IF ( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 32 ), scale )) + IF ( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ), scale )) { scale_step = 16384; move16(); /*Q14 */ diff --git a/lib_com/window_ola_fx.c b/lib_com/window_ola_fx.c index a9b11c5b3..26066ca46 100644 --- a/lib_com/window_ola_fx.c +++ b/lib_com/window_ola_fx.c @@ -351,8 +351,8 @@ void window_ola_fx( p1=paout+n; pa=ImdctOut+add(shr(L,1),n); /*p3=win_right+ sub(sub(sub(i_mult2(sub(shl(L,1),n),decimate),1),decay),WINDECAY48); */ - p3=win_right+ (2*L_FRAME16k-N16_CORE_SW)*3-1-1-WINDECAY48; - p5=win_int_right+ (2*L_FRAME16k-N16_CORE_SW)-1-WINDECAY16; + p3=win_right+ ((2*L_FRAME16k-N16_CORE_SW)*3-1-1-WINDECAY48); + p5=win_int_right+ ((2*L_FRAME16k-N16_CORE_SW)-1-WINDECAY16); p4=OldauOut+n; temp_len = sub(shr(L,1),n); @@ -372,8 +372,8 @@ void window_ola_fx( } pa=ImdctOut+sub(L,1); - p3=win_right+ (3*L_FRAME16k/2-1)*3+1-WINDECAY48; - p5=win_int_right+ (3*L_FRAME16k/2)-1-WINDECAY16; + p3=win_right+ ((3*L_FRAME16k/2-1)*3+1-WINDECAY48); + p5=win_int_right+ ((3*L_FRAME16k/2)-1-WINDECAY16); temp_len = sub(shr(L,1),n); FOR (i = 0; i < temp_len; i+=2) @@ -417,7 +417,7 @@ void window_ola_fx( p1=OldauOut+n; pa=ImdctOut+sub(sub(shr(L,1),1),n); p2=win_left+(L_FRAME16k-N16_CORE_SW)*3-1-1; - p3=win_int_left+L_FRAME16k-N16_CORE_SW-1; + p3=win_int_left+(L_FRAME16k-N16_CORE_SW-1); temp_len = sub(shr(L,1),n); FOR (i = 0; i < temp_len; i+=2) { diff --git a/lib_com/wtda_fx.c b/lib_com/wtda_fx.c index 32518c177..16a5aaa1a 100644 --- a/lib_com/wtda_fx.c +++ b/lib_com/wtda_fx.c @@ -299,12 +299,12 @@ void wtda_fx( pa=wtda_audio; p1=allsig_r+L_FRAME16k-1; - p2=win_int_right+ 3*L_FRAME16k/2-1-WINDECAY16; /* 3*L/2*decimate-decimate+decay-windecay48;*/ + p2=win_int_right+ (3*L_FRAME16k/2-1-WINDECAY16); /* 3*L/2*decimate-decimate+decay-windecay48;*/ p3=p1+1; p4=p2+1; - p5=win_right+(3*L_FRAME16k/2-1)*3+1-WINDECAY48; - p6=win_right+(3*L_FRAME16k/2+1)*3-1-1-WINDECAY48; + p5=win_right+((3*L_FRAME16k/2-1)*3+1-WINDECAY48); + p6=win_right+((3*L_FRAME16k/2+1)*3-1-1-WINDECAY48); FOR (i=0; ihMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, st->L_frame* HIBND_ACB_L_FAC, 0, &(st->Q_exc), st->Q_subfr, NULL, 0, INACTIVE); } - Rescale_mem(st->Q_exc, &st->prev_Q_syn, &st->Q_syn, st->mem_syn2_fx, st->mem_syn_clas_estim_fx, delta_mem_scale, - &st->mem_deemph_fx, st->hBPF->pst_old_syn_fx, &st->hBPF->pst_mem_deemp_err_fx, &st->agc_mem_fx[1], st->hPFstat, 0, 0, NULL); + IF(st->hPFstat != NULL) + { + Rescale_mem(st->Q_exc, &st->prev_Q_syn, &st->Q_syn, st->mem_syn2_fx, st->mem_syn_clas_estim_fx, delta_mem_scale, + &st->mem_deemph_fx, st->hBPF->pst_old_syn_fx, &st->hBPF->pst_mem_deemp_err_fx, &st->agc_mem_fx[1], st->hPFstat, 0, 0, NULL); + } + ELSE + { + Rescale_mem(st->Q_exc, &st->prev_Q_syn, &st->Q_syn, st->mem_syn2_fx, st->mem_syn_clas_estim_fx, delta_mem_scale, + &st->mem_deemph_fx, NULL, NULL, &st->agc_mem_fx[1], NULL, 0, 0, NULL); + } Copy_Scale_sig(exc2_fx, exc2_fx, st->L_frame, sub(st->Q_exc, i)); /* update past excitation signals for LD music post-filter */ @@ -1535,7 +1543,11 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( Q11, sub( st->Q_syn, 1 ) ) ); } +#ifdef MSAN_FIX + FOR( i = 0; i < st->L_frame; i++ ) +#else for (i = 0; i < L_FRAME16k; i++) +#endif { syn_32_fx[i] = L_shr(L_deposit_h(psyn_fx[i]), 4 + st->Q_syn); //Q12 } diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index d720137be..c6baf3efd 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -256,11 +256,14 @@ void open_decoder_LPD_fx( if (1)//st->element_mode == EVS_MONO) { - if ((st->hTECDec = (TEC_DEC_HANDLE)malloc(sizeof(TEC_DEC_DATA))) == NULL) - { - //return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TEC\n")); - assert(0); - } + if(st->hTECDec == NULL) + { + if ((st->hTECDec = (TEC_DEC_HANDLE)malloc(sizeof(TEC_DEC_DATA))) == NULL) + { + //return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TEC\n")); + assert(0); + } + } } else { diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 2c596d0af..9544cd186 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3927,7 +3927,7 @@ void decoder_tcx_invQ_fx( tmp32 = L_shl( L_mult0( index, 0x797D ), 7 ); /* 6Q25; 0x797D -> log2(10)/28 (Q18) */ *gain_tcx_e = add( extract_l( L_shr( tmp32, 25 ) ), 1 ); /* get exponent */ - *gain_tcx = round_fx( BASOP_Util_InvLog2( L_or( tmp32, 0xFE000000 ) ) ); + *gain_tcx = round_fx( BASOP_Util_InvLog2( L_or( tmp32, (Word32)0xFE000000 ) ) ); #ifdef BASOP_NOGLOB tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ ); diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index ffcbef512..f1d5e40cb 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -843,9 +843,9 @@ void ivas_hq_core_dec_fx( /*t_audio_q[i] *= ener_match;*/ Mpy_32_16_ss( t_audio_q[i], ener_match, &L_tmp, &lsb ); /*12+13-15=10 */ #ifdef BASOP_NOGLOB - t_audio_q[i] = L_add_sat( L_shl_sat( L_tmp, 2 ), lshr( lsb, 14 ) ); + t_audio_q[i] = L_add_sat( L_shl_sat( L_tmp, 2 ), lshr( (Word16)lsb, 14 ) ); #else - t_audio_q[i] = L_add( L_shl( L_tmp, 2 ), lshr( lsb, 14 ) ); + t_audio_q[i] = L_add( L_shl( L_tmp, 2 ), lshr( (Word16)lsb, 14 ) ); #endif move16(); /* Q12 */ } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 672dab774..8826be540 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -690,14 +690,26 @@ ivas_error ivas_core_dec( } } - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } + if(st->Q_syn >= 0){ + for ( int p = 0; p < 640; p++ ) + { + st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); + } - for ( int p = 0; p < 960; p++ ) - { - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); + for ( int p = 0; p < 960; p++ ) + { + st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); + } + }else{ + for ( int p = 0; p < 640; p++ ) + { + st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->Q_syn) ); + } + + for ( int p = 0; p < 960; p++ ) + { + st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->Q_syn) ); + } } } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 54156a695..7023c3741 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -386,10 +386,12 @@ ivas_error ivas_dec_setup( fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->q_Pos_p = Q31; } } // Cleanup changes for ivas_cldfb_dec_reconfig_fx: fixed to float @@ -492,10 +494,12 @@ ivas_error ivas_dec_setup( fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->q_Pos_p = Q31; } } // Cleanup changes for ivas_cldfb_dec_reconfig_fx: fixed to float @@ -2206,10 +2210,12 @@ ivas_error ivas_init_decoder_fx( fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->q_Pos_p = Q31; } #endif #else @@ -2322,10 +2328,12 @@ ivas_error ivas_init_decoder_fx( fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); + SrcSpatial_p->q_Pos_p = Q31; } #endif #else @@ -2398,10 +2406,12 @@ ivas_error ivas_init_decoder_fx( fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); + SrcSpatial_p->q_Pos_p = Q31; } #endif #else diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 4df423d75..338314583 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -641,10 +641,12 @@ static ivas_error ivas_ism_bitrate_switching_dec( fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->q_Pos_p = Q31; } #endif diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 25a296bc4..339d4009d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -152,7 +152,9 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; #if 1 // TODO: To be removed later st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; +#ifndef MSAN_FIX floatToFixed_arrL( st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->tc_fx[n], Q11, L_FRAME48k ); +#endif #endif } } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5d06f0bfa..af261f85e 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1501,10 +1501,12 @@ ivas_error ivas_sba_dec_reconfigure_fx( fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); + SrcSpatial_p->q_Pos_p = Q31; } #endif #else diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index f2dc98789..21d4ec3fa 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -55,9 +55,9 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx2.h" +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED #endif -#define IVAS_FLOAT_FIXED_TO_BE_REMOVED /*---------------------------------------------------------------------* * Local state structure @@ -364,6 +364,7 @@ void apa_reset( } #endif +#ifdef IVAS_FLOAT_FIXED uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, @@ -371,15 +372,25 @@ uint8_t apa_reconfigure( { /* realloc buffer */ - free( ps->buf_out ); ps->num_channels = (uint16_t) num_channels; ps->buf_out_capacity = (uint16_t) ( APA_BUF_PER_CHANNEL * num_channels ); + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + free( ps->buf_out ); ps->buf_out = (float *) malloc( sizeof( float ) * ps->buf_out_capacity ); + IF ( !ps->buf_out ) + { + return 2; + } +#endif + + free( ps->buf_out_fx ); ps->buf_out_fx = (Word16 *)malloc(sizeof(float) * ps->buf_out_capacity); - if ( !ps->buf_out || !ps->buf_out_fx ) + IF ( !ps->buf_out_fx ) { return 2; } + ps->l_buf_out = 0; ps->l_in_total = 0; ps->l_ts = ps->num_channels * l_ts; @@ -407,7 +418,50 @@ uint8_t apa_reconfigure( return 0; } +#else +uint8_t apa_reconfigure( + apa_state_t *ps, + uint16_t num_channels, + uint16_t l_ts ) +{ + + /* realloc buffer */ + free( ps->buf_out ); + ps->num_channels = (uint16_t) num_channels; + ps->buf_out_capacity = (uint16_t) ( APA_BUF_PER_CHANNEL * num_channels ); + ps->buf_out = (float *) malloc( sizeof( float ) * ps->buf_out_capacity ); + if ( !ps->buf_out ) + { + return 2; + } + ps->l_buf_out = 0; + ps->l_in_total = 0; + ps->l_ts = ps->num_channels * l_ts; + + /* set everything else dependent on the number of channels */ + /* set segment size */ + /* in the order of a pitch, set to 160 samples at 16 kHz */ + /* used for windowing and as the correlation length, i.e., */ + /* the size of the template segment. */ + ps->l_seg = ( ps->rate / 100 ) * ps->num_channels; + + /* set frame size */ + /* set to 320 samples at 16 kHz */ + ps->l_frm = ( ps->rate / FRAMES_PER_SEC ) * ps->num_channels; + + /* set minimum pitch */ + /* set to 40 samples at 16 kHz */ + /* (defines min change in number of samples, i.e., abs(l_in-l_out) >= p_min) */ + ps->p_min = ( ps->rate / 400 ) * ps->num_channels; + + /* set search length */ + /* must cover one pitch, set to 200 samples at 16 kHz */ + /* (the resulting maximum pitch is then p_min+l_search = 240 samples at 16 kHz) */ + ps->l_search = ( ps->rate / 80 ) * ps->num_channels; + return 0; +} +#endif /* Sets the audio configuration. */ bool apa_set_rate( @@ -474,7 +528,7 @@ bool apa_set_rate( ps->l_search = ( ps->rate / 80 ) * ps->num_channels; #ifdef IVAS_FLOAT_FIXED - ps->win_fx = pcmdsp_window_hann_640; + ps->win_fx = (Word16 *)pcmdsp_window_hann_640; move16(); ps->l_halfwin = 320; move16(); @@ -482,14 +536,14 @@ bool apa_set_rate( move16(); IF( EQ_32( ps->rate, 48000 ) ) { - ps->win_fx = pcmdsp_window_hann_960; + ps->win_fx = (Word16 *)pcmdsp_window_hann_960; move16(); ps->l_halfwin = 480; move16(); } IF( EQ_32( ps->rate, 24000 ) ) { - ps->win_fx = pcmdsp_window_hann_960; + ps->win_fx = (Word16 *)pcmdsp_window_hann_960; move16(); ps->l_halfwin = 480; move16(); @@ -817,6 +871,31 @@ bool apa_set_complexity_options( * ******************************************************************************** */ +#ifdef IVAS_FLOAT_FIXED +bool apa_exit( + apa_state_t **pps ) +{ + /* ignore NULL pointer input */ + if ( *pps == NULL ) + { + return 0; + } + + /* deallocate state struct members */ +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + free( ( *pps )->buf_out ); +#endif + free( ( *pps )->buf_out_fx ); + + /* deallocate state struct */ + free( *pps ); + + /* set pointer to NULL */ + *pps = NULL; + + return 0; +} +#else bool apa_exit( apa_state_t **pps ) { @@ -837,6 +916,7 @@ bool apa_exit( return 0; } +#endif /* ******************************************************************************** diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 5f29ce870..3fc81c1b1 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -466,11 +466,11 @@ void TonalMDCTConceal_SaveFreqSignal_ivas_fx( move16(); hTonalMDCTConc->secondLastBlockData.nSamples = nOldSamples; move16(); - nOldSamples = hTonalMDCTConc->lastBlockData.nSamplesCore; + nOldSamples = (Word16)hTonalMDCTConc->lastBlockData.nSamplesCore; move16(); - hTonalMDCTConc->lastBlockData.nSamplesCore = nNewSamplesCore; + hTonalMDCTConc->lastBlockData.nSamplesCore = (UWord16)nNewSamplesCore; move16(); - hTonalMDCTConc->secondLastBlockData.nSamplesCore = nOldSamples; + hTonalMDCTConc->secondLastBlockData.nSamplesCore = (UWord16)nOldSamples; move16(); } diff --git a/lib_rend/ivas_masa_merge.c b/lib_rend/ivas_masa_merge.c index 527e19bbd..43bead2e1 100644 --- a/lib_rend/ivas_masa_merge.c +++ b/lib_rend/ivas_masa_merge.c @@ -219,16 +219,16 @@ void diffuse_meta_merge_1x1_fx( ) { Word8 sf, band; - Word16 i,j, max_e, in1_e[MASA_FREQUENCY_BANDS]; + Word16 i, max_e, in1_e[MASA_FREQUENCY_BANDS]; FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { FOR ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) { - Word32 energyTimesRatio_fx, energyTimesRatioISM_fx, total_diff_nrg_fx, dir_nrg_ratio_fx, total_nrg_fx; + Word32 energyTimesRatio_fx, energyTimesRatioISM_fx, total_diff_nrg_fx = 0, dir_nrg_ratio_fx, total_nrg_fx = 0; Word32 dir_ratio_ism_fx, L_tmp1,L_tmp2; - Word16 scale, energyTimesRatio_e, tmp, total_nrg_e, total_diff_nrg_e, dir_ratio_ism_e, energyTimesRatioISM_e, dir_nrg_ratio_e ; + Word16 scale, energyTimesRatio_e, tmp, total_nrg_e = 0, total_diff_nrg_e, dir_ratio_ism_e, energyTimesRatioISM_e, dir_nrg_ratio_e ; tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16) UINT8_MAX, &scale); energyTimesRatio_fx = Mpy_32_16_r( inEne_fx[sf][band], tmp); @@ -277,7 +277,7 @@ void diffuse_meta_merge_1x1_fx( outMeta->directToTotalRatio[0][sf][band] = (uint8_t) ( L_shr( new_dir_ratio_fx, 31 - new_dir_ratio_e ) * UINT8_MAX ); new_diff_ratio_fx = L_shl( 1, 31 - new_dir_ratio_e ) - new_dir_ratio_fx; - outMeta->diffuseToTotalRatio[sf][band] = (uint8_t) floorf( L_shr( new_diff_ratio_fx, new_dir_ratio_e) * UINT8_MAX ); + outMeta->diffuseToTotalRatio[sf][band] = (uint8_t) ( L_shr( new_diff_ratio_fx, new_dir_ratio_e) * UINT8_MAX ); } ELSE { @@ -297,13 +297,13 @@ void diffuse_meta_merge_1x1_fx( } max_e = in1_e[0]; - FOR(Word16 i = 1; i < MASA_FREQUENCY_BANDS; i++) + FOR( i = 1; i < MASA_FREQUENCY_BANDS; i++) { IF(max_e < in1_e[i]) max_e = in1_e[i]; } - FOR(Word16 i = 0; i < MASA_FREQUENCY_BANDS; i++) + FOR( i = 0; i < MASA_FREQUENCY_BANDS; i++) { inEne_fx[sf][i] = L_shr(inEne_fx[sf][i], max_e - in1_e[i]); } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 545fddc1b..a8bf2de31 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -899,12 +899,15 @@ ivas_error ivas_td_binaural_renderer_unwrap( /* Render subframe */ #ifdef IVAS_FLOAT_FIXED ////// Float to fix ///// - FOR(Word16 i = 0; i < hBinRendererTd->NumOfSrcs; i++) + FOR( Word16 i = 0; i < hBinRendererTd->NumOfSrcs; i++ ) { - FOR (int j = 0; j < 3; j++) + FOR( int j = 0; j < 3; j++ ) { - hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j] = float_to_fix(hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p[j], Q25); + hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j] = float_to_fix( hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p[j], Q25 ); + + //hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j] = L_shr( hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j], hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p - Q25 ); } + hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p = 25; } IF ( ( error = TDREND_GetMix_fx( hBinRendererTd, output_fx, subframe_length, subframe_idx, ism_md_subframe_update ) ) != IVAS_ERR_OK ) { diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index e7165ed25..d04bcf475 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -494,7 +494,6 @@ void ivas_omasa_ana( #ifdef IVAS_FLOAT_FIXED void ivas_omasa_ana_fx( OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ - float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ Word32 data_in_f_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ Word16 *data_in_q, const Word16 input_frame, /* i : Input frame size */ @@ -741,19 +740,23 @@ static void ivas_omasa_param_est_ana_fx( Word32 reference_power_fx[MASA_FREQUENCY_BANDS]; Word32 Chnl_RealBuffer_fx[MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; - Word16 Chnl_RealBuffer_q; - Word16 Chnl_ImagBuffer_q; + Word16 Chnl_RealBuffer_q = 0; + move16(); + Word16 Chnl_ImagBuffer_q = 0; + move16(); Word32 Chnl_ImagBuffer_fx[MAX_NUM_OBJECTS][CLDFB_NO_CHANNELS_MAX]; Word32 Foa_RealBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 Foa_ImagBuffer_fx[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 intensity_real_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word32 direction_vector_fx[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; Word32 diffuseness_vector_fx[MASA_FREQUENCY_BANDS]; - Word16 diffuseness_q; + Word16 diffuseness_q = 0; + move16(); Word32 diffuseness_m_fx[MASA_FREQUENCY_BANDS]; - Word16 diffuseness_m_q; + Word16 diffuseness_m_q = 0; Word32 renormalization_factor_diff_fx[MASA_FREQUENCY_BANDS]; - Word16 renormalization_factor_diff_q; + Word16 renormalization_factor_diff_q = 0; + move16(); Word32 norm_tmp_fx; Word16 scale; @@ -779,7 +782,7 @@ static void ivas_omasa_param_est_ana_fx( /* Compute ISM to FOA matrices */ FOR ( i = 0; i < nchan_ism; i++ ) { - Word16 tmp, tmp1, scale; + Word16 tmp, tmp1; // 180 in Q22 754974720 hOMasa->chnlToFoaMtx_fx[0][i] = 32767; // 1 in Q15 move16(); @@ -986,7 +989,7 @@ static void ivas_omasa_param_est_ana_fx( } dir_v_q = hOMasa->direction_vector_m_q; - FOR (Word16 i = 0; i < DIRAC_NUM_DIMS; i++) + FOR ( i = 0; i < DIRAC_NUM_DIMS; i++) { dir_v_fx[i] = L_shr(dir_v_fx[i], 1); } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 727326b40..a3e349c7b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -2671,7 +2671,6 @@ void ivas_omasa_ana( #ifdef IVAS_FLOAT_FIXED void ivas_omasa_ana_fx( OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ - float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ Word32 data_in_f_fx[][L_FRAME48k], /* i/o: Input / transport audio signals */ Word16 *q, const Word16 input_frame, /* i : Input frame size */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 731afcdd0..aec0c3ebc 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1802,6 +1802,7 @@ typedef struct float Front_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; #ifdef IVAS_FLOAT_FIXED Word32 Pos_p_fx[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; // Q25 + Word16 q_Pos_p; Word32 Front_p_fx[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; // Q30 #endif // IVAS_FLOAT_FIXED int16_t DirAttenEnabled; @@ -2310,6 +2311,7 @@ typedef struct ivas_mcmasa_ana_data_structure Word16 interpolator_fx[L_FRAME48k]; Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_exp[MAX_PARAM_SPATIAL_SUBFRAMES]; Word16 chnlToFoaMtx_e; Word16 prevMultiChEne_e; Word16 prevDownmixEne_e; @@ -2403,7 +2405,7 @@ typedef struct ivas_omasa_ana_data_structure Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; Word32 buffer_energy_fx[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; Word16 buffer_intensity_real_q[DIRAC_NO_COL_AVG_DIFF]; - Word32 buffer_energy_q[DIRAC_NO_COL_AVG_DIFF]; + Word16 buffer_energy_q[DIRAC_NO_COL_AVG_DIFF]; Word16 chnlToFoaMtx_fx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; // Q15 #endif @@ -2450,6 +2452,7 @@ typedef struct ivas_dirac_ana_data_structure #ifdef IVAS_FLOAT_FIXED Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_exp[MAX_PARAM_SPATIAL_SUBFRAMES]; #endif } DIRAC_ANA_DATA, *DIRAC_ANA_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index a1f9b9954..9c1d72b5a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1628,7 +1628,7 @@ static ivas_error initEfap( IF( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - IF ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth_fx, pCustomLsOut->ls_elevation_fx, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth_fx, pCustomLsOut->ls_elevation_fx, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -1658,71 +1658,71 @@ static ivas_error initEfap( return IVAS_ERR_OK; } #else - static ivas_error initEfap( - EFAP_WRAPPER * pEfapWrapper, - AUDIO_CONFIG outConfig, - const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) - { - ivas_error error; - const float *azimuths; - const float *elevations; - int16_t numNonLfeChannels; - - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; - } - else - { - pEfapWrapper->speakerConfig = outConfig; - } - pEfapWrapper->pCustomLsSetup = pCustomLsOut; +static ivas_error initEfap( + EFAP_WRAPPER *pEfapWrapper, + AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) +{ + ivas_error error; + const float *azimuths; + const float *elevations; + int16_t numNonLfeChannels; - /* If re-initializing, free existing EFAP handle. */ - if ( pEfapWrapper->hEfap != NULL ) - { - efap_free_data( &pEfapWrapper->hEfap ); - } + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; + } + else + { + pEfapWrapper->speakerConfig = outConfig; + } + pEfapWrapper->pCustomLsSetup = pCustomLsOut; - /* Only initialize EFAP handle if output config is channel-based */ - if ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - pEfapWrapper->hEfap = NULL; - return IVAS_ERR_OK; - } + /* If re-initializing, free existing EFAP handle. */ + if ( pEfapWrapper->hEfap != NULL ) + { + efap_free_data( &pEfapWrapper->hEfap ); + } - if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( error = efap_init_data( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth, pCustomLsOut->ls_elevation, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Only initialize EFAP handle if output config is channel-based */ + if ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + pEfapWrapper->hEfap = NULL; + return IVAS_ERR_OK; + } - if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( error = efap_init_data( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth, pCustomLsOut->ls_elevation, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = efap_init_data( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; + if ( ( error = efap_init_data( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; } + } + + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED @@ -1794,67 +1794,67 @@ static ivas_error getEfapGains_fx( return IVAS_ERR_OK; } #else - static ivas_error getEfapGains( - EFAP_WRAPPER efapWrapper, - const float azi, - const float ele, - pan_vector panGains ) - { - pan_vector tmpPanGains; /* tmp pan gain buffer without LFE channels */ - float *readPtr; - int16_t i; - int16_t lfeCount; - int16_t numChannels; - ivas_error error; +static ivas_error getEfapGains( + EFAP_WRAPPER efapWrapper, + const float azi, + const float ele, + pan_vector panGains ) +{ + pan_vector tmpPanGains; /* tmp pan gain buffer without LFE channels */ + float *readPtr; + int16_t i; + int16_t lfeCount; + int16_t numChannels; + ivas_error error; - /* EFAP returns an array of gains only for non-LFE speakers */ - efap_determine_gains( efapWrapper.hEfap, tmpPanGains, azi, ele, EFAP_MODE_EFAP ); + /* EFAP returns an array of gains only for non-LFE speakers */ + efap_determine_gains( efapWrapper.hEfap, tmpPanGains, azi, ele, EFAP_MODE_EFAP ); - /* Now copy to buffer that includes LFE channels */ - if ( efapWrapper.speakerConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - numChannels = efapWrapper.pCustomLsSetup->num_spk + efapWrapper.pCustomLsSetup->num_lfe; - readPtr = tmpPanGains; + /* Now copy to buffer that includes LFE channels */ + if ( efapWrapper.speakerConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + numChannels = efapWrapper.pCustomLsSetup->num_spk + efapWrapper.pCustomLsSetup->num_lfe; + readPtr = tmpPanGains; - for ( i = 0, lfeCount = 0; i < numChannels; ++i ) - { - if ( lfeCount < efapWrapper.pCustomLsSetup->num_lfe && i == efapWrapper.pCustomLsSetup->lfe_idx[lfeCount] ) - { - panGains[i] = 0.0f; - ++lfeCount; - } - else - { - panGains[i] = *readPtr; - ++readPtr; - } - } + for ( i = 0, lfeCount = 0; i < numChannels; ++i ) + { + if ( lfeCount < efapWrapper.pCustomLsSetup->num_lfe && i == efapWrapper.pCustomLsSetup->lfe_idx[lfeCount] ) + { + panGains[i] = 0.0f; + ++lfeCount; } else { - if ( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + panGains[i] = *readPtr; + ++readPtr; + } + } + } + else + { + if ( ( error = getAudioConfigNumChannels( efapWrapper.speakerConfig, &numChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - readPtr = tmpPanGains; + readPtr = tmpPanGains; - for ( i = 0; i < numChannels; ++i ) - { - if ( i == LFE_CHANNEL ) - { - panGains[i] = 0.0f; - } - else - { - panGains[i] = *readPtr; - ++readPtr; - } - } + for ( i = 0; i < numChannels; ++i ) + { + if ( i == LFE_CHANNEL ) + { + panGains[i] = 0.0f; + } + else + { + panGains[i] = *readPtr; + ++readPtr; } - - return IVAS_ERR_OK; } + } + + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED @@ -1900,43 +1900,43 @@ static ivas_error initHeadRotation_fx( return IVAS_ERR_OK; } #else - static ivas_error initHeadRotation( - IVAS_REND_HANDLE hIvasRend ) - { - int16_t i, crossfade_len; - float tmp; - ivas_error error; +static ivas_error initHeadRotation( + IVAS_REND_HANDLE hIvasRend ) +{ + int16_t i, crossfade_len; + float tmp; + ivas_error error; - /* Head rotation is enabled by default */ - hIvasRend->headRotData.headRotEnabled = 1; + /* Head rotation is enabled by default */ + hIvasRend->headRotData.headRotEnabled = 1; - /* Initialize 5ms crossfade */ - crossfade_len = L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES; - tmp = 1.f / ( crossfade_len - 1 ); - for ( i = 0; i < crossfade_len; i++ ) - { - hIvasRend->headRotData.crossfade[i] = i * tmp; - } + /* Initialize 5ms crossfade */ + crossfade_len = L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES; + tmp = 1.f / ( crossfade_len - 1 ); + for ( i = 0; i < crossfade_len; i++ ) + { + hIvasRend->headRotData.crossfade[i] = i * tmp; + } - /* Initialize with unit quaternions */ - for ( i = 0; i < hIvasRend->num_subframes; ++i ) - { - hIvasRend->headRotData.headPositions[i] = quaternionInit(); - } + /* Initialize with unit quaternions */ + for ( i = 0; i < hIvasRend->num_subframes; ++i ) + { + hIvasRend->headRotData.headPositions[i] = quaternionInit(); + } - if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); - } + if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); + } - if ( ( error = ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif @@ -1953,16 +1953,16 @@ static void closeHeadRotation( return; } #else - static void closeHeadRotation( - IVAS_REND_HANDLE hIvasRend ) - { - if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) - { - free( hIvasRend->headRotData.hOrientationTracker ); - } +static void closeHeadRotation( + IVAS_REND_HANDLE hIvasRend ) +{ + if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) + { + free( hIvasRend->headRotData.hOrientationTracker ); + } - return; - } + return; +} #endif @@ -2138,17 +2138,17 @@ static TDREND_WRAPPER defaultTdRendWrapper( return w; } #else - static TDREND_WRAPPER defaultTdRendWrapper( - void ) - { - TDREND_WRAPPER w; +static TDREND_WRAPPER defaultTdRendWrapper( + void ) +{ + TDREND_WRAPPER w; - w.binaural_latency_ns = 0; - w.hBinRendererTd = NULL; - w.hHrtfTD = NULL; + w.binaural_latency_ns = 0; + w.hBinRendererTd = NULL; + w.hHrtfTD = NULL; - return w; - } + return w; +} #endif @@ -2169,19 +2169,19 @@ static bool isIoConfigPairSupported( return true; } #else - static bool isIoConfigPairSupported( - const AUDIO_CONFIG inConfig, - const AUDIO_CONFIG outConfig ) - { - /* Rendering mono or stereo to binaural is not supported */ - if ( ( inConfig == IVAS_AUDIO_CONFIG_MONO || inConfig == IVAS_AUDIO_CONFIG_STEREO ) && getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) - { - return false; - } +static bool isIoConfigPairSupported( + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig ) +{ + /* Rendering mono or stereo to binaural is not supported */ + if ( ( inConfig == IVAS_AUDIO_CONFIG_MONO || inConfig == IVAS_AUDIO_CONFIG_STEREO ) && getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + { + return false; + } - /* If not returned so far, config pair is supported */ - return true; - } + /* If not returned so far, config pair is supported */ + return true; +} #endif @@ -2196,7 +2196,7 @@ static ivas_error initIsmMasaRendering( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); #endif // IVAS_FLOAT_FIXED inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -2297,14 +2297,16 @@ static ivas_error setRendInputActiveIsm( fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->q_Pos_p = Q31; } } #else - if ((error = ivas_td_binaural_open_ext(&inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate)) != IVAS_ERR_OK) + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -2319,10 +2321,10 @@ static ivas_error setRendInputActiveIsm( return error; } #else - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } #endif // IVAS_FLOAT_FIXED } } @@ -2351,7 +2353,7 @@ static void clearInputIsm( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); #endif inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -2397,29 +2399,29 @@ static void copyLsConversionMatrixToPanMatrix_fx( } #else - static void copyLsConversionMatrixToPanMatrix( - const LS_CONVERSION_MATRIX *lsConvMatrix, - pan_matrix panMatrix ) - { - int16_t i; - int16_t inCh, outCh; - int16_t numNonZeroGains; - int16_t numColumns; +static void copyLsConversionMatrixToPanMatrix( + const LS_CONVERSION_MATRIX *lsConvMatrix, + pan_matrix panMatrix ) +{ + int16_t i; + int16_t inCh, outCh; + int16_t numNonZeroGains; + int16_t numColumns; - /* Index 0 is special and describes the following values */ - numNonZeroGains = lsConvMatrix[0].index; - numColumns = (int16_t) lsConvMatrix[0].value; + /* Index 0 is special and describes the following values */ + numNonZeroGains = lsConvMatrix[0].index; + numColumns = (int16_t) lsConvMatrix[0].value; - for ( i = 1; i < numNonZeroGains + 1; ++i ) - { - inCh = lsConvMatrix[i].index / numColumns; - outCh = lsConvMatrix[i].index % numColumns; + for ( i = 1; i < numNonZeroGains + 1; ++i ) + { + inCh = lsConvMatrix[i].index / numColumns; + outCh = lsConvMatrix[i].index % numColumns; - panMatrix[inCh][outCh] = lsConvMatrix[i].value; - } + panMatrix[inCh][outCh] = lsConvMatrix[i].value; + } - return; - } + return; +} #endif static void setZeroPanMatrix( pan_matrix panMatrix ) @@ -2463,19 +2465,19 @@ static void fillIdentityPanMatrix_fx( return; } #else - /* Note: this only sets non-zero elements, call setZeroPanMatrix() to init first. */ - static void fillIdentityPanMatrix( - pan_matrix panMatrix ) - { - int16_t i; +/* Note: this only sets non-zero elements, call setZeroPanMatrix() to init first. */ +static void fillIdentityPanMatrix( + pan_matrix panMatrix ) +{ + int16_t i; - for ( i = 0; i < min( MAX_INPUT_CHANNELS, MAX_OUTPUT_CHANNELS ); ++i ) - { - panMatrix[i][i] = 1.0f; - } + for ( i = 0; i < min( MAX_INPUT_CHANNELS, MAX_OUTPUT_CHANNELS ); ++i ) + { + panMatrix[i][i] = 1.0f; + } - return; - } + return; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithIdentMatrix( @@ -2486,13 +2488,13 @@ static ivas_error initMcPanGainsWithIdentMatrix( return IVAS_ERR_OK; } #else - static ivas_error initMcPanGainsWithIdentMatrix( - input_mc * inputMc ) - { - fillIdentityPanMatrix( inputMc->panGains ); +static ivas_error initMcPanGainsWithIdentMatrix( + input_mc *inputMc ) +{ + fillIdentityPanMatrix( inputMc->panGains ); - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED @@ -2534,39 +2536,39 @@ static ivas_error initMcPanGainsWithConversionMapping_fx( } #else - static ivas_error initMcPanGainsWithConversionMapping( - input_mc * inputMc, - const AUDIO_CONFIG outConfig ) - { - AUDIO_CONFIG ivasConfigIn, ivasConfigOut; - int16_t i; +static ivas_error initMcPanGainsWithConversionMapping( + input_mc *inputMc, + const AUDIO_CONFIG outConfig ) +{ + AUDIO_CONFIG ivasConfigIn, ivasConfigOut; + int16_t i; - ivasConfigIn = inputMc->base.inConfig; - ivasConfigOut = outConfig; + ivasConfigIn = inputMc->base.inConfig; + ivasConfigOut = outConfig; - /* Find conversion mapping for current I/O config pair. - * Stay with default panning matrix if conversion_matrix is NULL */ - for ( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i ) + /* Find conversion mapping for current I/O config pair. + * Stay with default panning matrix if conversion_matrix is NULL */ + for ( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i ) + { + if ( ls_conversion_mapping[i].input_config == ivasConfigIn && ls_conversion_mapping[i].output_config == ivasConfigOut ) + { + /* Mapping found with valid matrix - copy */ + if ( ls_conversion_mapping[i].conversion_matrix != NULL ) { - if ( ls_conversion_mapping[i].input_config == ivasConfigIn && ls_conversion_mapping[i].output_config == ivasConfigOut ) - { - /* Mapping found with valid matrix - copy */ - if ( ls_conversion_mapping[i].conversion_matrix != NULL ) - { - copyLsConversionMatrixToPanMatrix( ls_conversion_mapping[i].conversion_matrix, inputMc->panGains ); - } - /* Mapping found with NULL matrix - use identity matrix */ - else - { - fillIdentityPanMatrix( inputMc->panGains ); - } - - return IVAS_ERR_OK; - } + copyLsConversionMatrixToPanMatrix( ls_conversion_mapping[i].conversion_matrix, inputMc->panGains ); + } + /* Mapping found with NULL matrix - use identity matrix */ + else + { + fillIdentityPanMatrix( inputMc->panGains ); } - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Missing multichannel conversion mapping" ); + return IVAS_ERR_OK; } + } + + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Missing multichannel conversion mapping" ); +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithEfap_fx( @@ -2645,71 +2647,71 @@ static ivas_error initMcPanGainsWithEfap_fx( return IVAS_ERR_OK; } #else - static ivas_error initMcPanGainsWithEfap( - input_mc * inputMc, - const AUDIO_CONFIG outConfig ) - { - int16_t i; - int16_t numNonLfeInChannels; - int16_t inLfeChIdx, outChIdx; - const float *spkAzi, *spkEle; - ivas_error error; +static ivas_error initMcPanGainsWithEfap( + input_mc *inputMc, + const AUDIO_CONFIG outConfig ) +{ + int16_t i; + int16_t numNonLfeInChannels; + int16_t inLfeChIdx, outChIdx; + const float *spkAzi, *spkEle; + ivas_error error; - if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) + { + return error; + } - inLfeChIdx = LFE_CHANNEL; - } - else - { - numNonLfeInChannels = inputMc->customLsInput.num_spk; - spkAzi = inputMc->customLsInput.ls_azimuth; - spkEle = inputMc->customLsInput.ls_elevation; - inLfeChIdx = -1; - if ( inputMc->customLsInput.num_lfe > 0 ) - { - inLfeChIdx = inputMc->customLsInput.lfe_idx[0]; - } - } + inLfeChIdx = LFE_CHANNEL; + } + else + { + numNonLfeInChannels = inputMc->customLsInput.num_spk; + spkAzi = inputMc->customLsInput.ls_azimuth; + spkEle = inputMc->customLsInput.ls_elevation; + inLfeChIdx = -1; + if ( inputMc->customLsInput.num_lfe > 0 ) + { + inLfeChIdx = inputMc->customLsInput.lfe_idx[0]; + } + } - for ( i = 0, outChIdx = 0; i < numNonLfeInChannels; ++i, ++outChIdx ) - { - if ( i == inLfeChIdx ) - { - ++outChIdx; - } + for ( i = 0, outChIdx = 0; i < numNonLfeInChannels; ++i, ++outChIdx ) + { + if ( i == inLfeChIdx ) + { + ++outChIdx; + } - if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, spkAzi[i], spkEle[i], inputMc->panGains[outChIdx] ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, spkAzi[i], spkEle[i], inputMc->panGains[outChIdx] ) ) != IVAS_ERR_OK ) + { + return error; + } + } - if ( outConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inLfeChIdx >= 0 ) - { - inputMc->panGains[inLfeChIdx][LFE_CHANNEL] = 1; - } - else if ( inputMc->base.ctx.pCustomLsOut->num_lfe > 0 && inLfeChIdx >= 0 ) - { - inputMc->panGains[inLfeChIdx][inputMc->base.ctx.pCustomLsOut->lfe_idx[0]] = 1; - } + if ( outConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inLfeChIdx >= 0 ) + { + inputMc->panGains[inLfeChIdx][LFE_CHANNEL] = 1; + } + else if ( inputMc->base.ctx.pCustomLsOut->num_lfe > 0 && inLfeChIdx >= 0 ) + { + inputMc->panGains[inLfeChIdx][inputMc->base.ctx.pCustomLsOut->lfe_idx[0]] = 1; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error getRendInputNumChannels( @@ -2741,34 +2743,34 @@ static ivas_error getRendInputNumChannels( return IVAS_ERR_OK; } #else - static ivas_error getRendInputNumChannels( - const void *rendInput, - int16_t *numInChannels ) - { - /* Using a void pointer for this function to be reusable for any input type (input_ism, input_mc, input_sba). - Assumptions: - input_base is always the first member in the input struct */ - - ivas_error error; - const input_base *pInputBase; - const input_mc *pInputMc; +static ivas_error getRendInputNumChannels( + const void *rendInput, + int16_t *numInChannels ) +{ + /* Using a void pointer for this function to be reusable for any input type (input_ism, input_mc, input_sba). + Assumptions: - input_base is always the first member in the input struct */ - pInputBase = (const input_base *) rendInput; + ivas_error error; + const input_base *pInputBase; + const input_mc *pInputMc; - if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - pInputMc = (const input_mc *) rendInput; - *numInChannels = pInputMc->customLsInput.num_spk + pInputMc->customLsInput.num_lfe; - } - else - { - if ( ( error = getAudioConfigNumChannels( pInputBase->inConfig, numInChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - } + pInputBase = (const input_base *) rendInput; - return IVAS_ERR_OK; + if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + pInputMc = (const input_mc *) rendInput; + *numInChannels = pInputMc->customLsInput.num_spk + pInputMc->customLsInput.num_lfe; + } + else + { + if ( ( error = getAudioConfigNumChannels( pInputBase->inConfig, numInChannels ) ) != IVAS_ERR_OK ) + { + return error; } + } + + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithMonoOut_fx( @@ -3046,55 +3048,55 @@ static bool configsAreEqual( return configA == configB; } #else - static bool configsAreEqual( - const AUDIO_CONFIG configA, - const LSSETUP_CUSTOM_STRUCT customLsA, - const AUDIO_CONFIG configB, - const LSSETUP_CUSTOM_STRUCT customLsB ) - { - int16_t i; - - /* Both input and output are custom LS - compare structs */ - if ( configA == IVAS_AUDIO_CONFIG_LS_CUSTOM && configB == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( customLsA.num_spk != customLsB.num_spk ) - { - return false; - } +static bool configsAreEqual( + const AUDIO_CONFIG configA, + const LSSETUP_CUSTOM_STRUCT customLsA, + const AUDIO_CONFIG configB, + const LSSETUP_CUSTOM_STRUCT customLsB ) +{ + int16_t i; - if ( customLsA.num_lfe != customLsB.num_lfe ) - { - return false; - } + /* Both input and output are custom LS - compare structs */ + if ( configA == IVAS_AUDIO_CONFIG_LS_CUSTOM && configB == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( customLsA.num_spk != customLsB.num_spk ) + { + return false; + } - if ( customLsA.is_planar_setup != customLsB.is_planar_setup ) - { - return false; - } + if ( customLsA.num_lfe != customLsB.num_lfe ) + { + return false; + } - for ( i = 0; i < customLsA.num_spk; ++i ) - { - /* Compare to nearest degree (hence the int16_t cast) */ - if ( (int16_t) customLsA.ls_azimuth[i] != (int16_t) customLsB.ls_azimuth[i] || - (int16_t) customLsA.ls_elevation[i] != (int16_t) customLsB.ls_elevation[i] ) - { - return false; - } - } - for ( i = 0; i < customLsA.num_lfe; ++i ) - { - if ( customLsA.lfe_idx[i] != customLsB.lfe_idx[i] ) - { - return false; - } - } + if ( customLsA.is_planar_setup != customLsB.is_planar_setup ) + { + return false; + } - return true; + for ( i = 0; i < customLsA.num_spk; ++i ) + { + /* Compare to nearest degree (hence the int16_t cast) */ + if ( (int16_t) customLsA.ls_azimuth[i] != (int16_t) customLsB.ls_azimuth[i] || + (int16_t) customLsA.ls_elevation[i] != (int16_t) customLsB.ls_elevation[i] ) + { + return false; + } + } + for ( i = 0; i < customLsA.num_lfe; ++i ) + { + if ( customLsA.lfe_idx[i] != customLsB.lfe_idx[i] ) + { + return false; } - - /* Otherwise it's enough to compare config enums */ - return configA == configB; } + + return true; + } + + /* Otherwise it's enough to compare config enums */ + return configA == configB; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateLfePanGainsForMcOut( @@ -3140,48 +3142,48 @@ static ivas_error updateLfePanGainsForMcOut( return error; } #else - static ivas_error updateLfePanGainsForMcOut( - input_mc * inputMc, - const AUDIO_CONFIG outConfig ) - { - int16_t i, numLfeIn, numOutChannels; - ivas_error error; - error = IVAS_ERR_OK; - - /* If panning is not required, simply return */ - if ( !inputMc->lfeRouting.pan_lfe ) - { - return error; - } - - numLfeIn = getNumLfeChannels( inputMc ); +static ivas_error updateLfePanGainsForMcOut( + input_mc *inputMc, + const AUDIO_CONFIG outConfig ) +{ + int16_t i, numLfeIn, numOutChannels; + ivas_error error; + error = IVAS_ERR_OK; - if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - numOutChannels = inputMc->base.ctx.pCustomLsOut->num_spk + inputMc->base.ctx.pCustomLsOut->num_lfe; - } - else - { - if ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - } + /* If panning is not required, simply return */ + if ( !inputMc->lfeRouting.pan_lfe ) + { + return error; + } - for ( i = 0; i < numLfeIn; i++ ) - { - /* panning gains */ - if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth, inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i] ) ) != IVAS_ERR_OK ) - { - return error; - } + numLfeIn = getNumLfeChannels( inputMc ); - /* linear input gain */ - v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], numOutChannels ); - } + if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + numOutChannels = inputMc->base.ctx.pCustomLsOut->num_spk + inputMc->base.ctx.pCustomLsOut->num_lfe; + } + else + { + if ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + } + for ( i = 0; i < numLfeIn; i++ ) + { + /* panning gains */ + if ( ( error = getEfapGains( *inputMc->base.ctx.pEfapOutWrapper, inputMc->lfeRouting.lfeOutputAzimuth, inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i] ) ) != IVAS_ERR_OK ) + { return error; } + + /* linear input gain */ + v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], numOutChannels ); + } + + return error; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateLfePanGainsForAmbiOut( @@ -3218,39 +3220,39 @@ static ivas_error updateLfePanGainsForAmbiOut( return error; } #else - static ivas_error updateLfePanGainsForAmbiOut( - input_mc * inputMc, - const AUDIO_CONFIG outConfig ) - { - int16_t i; - int16_t numLfeIn, outAmbiOrder; - ivas_error error; - error = IVAS_ERR_OK; +static ivas_error updateLfePanGainsForAmbiOut( + input_mc *inputMc, + const AUDIO_CONFIG outConfig ) +{ + int16_t i; + int16_t numLfeIn, outAmbiOrder; + ivas_error error; + error = IVAS_ERR_OK; - /* If panning is not required, simply return */ - if ( !inputMc->lfeRouting.pan_lfe ) - { - return error; - } + /* If panning is not required, simply return */ + if ( !inputMc->lfeRouting.pan_lfe ) + { + return error; + } - if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) + { + return error; + } - numLfeIn = getNumLfeChannels( inputMc ); + numLfeIn = getNumLfeChannels( inputMc ); - for ( i = 0; i < numLfeIn; i++ ) - { - /* panning gains */ - ivas_dirac_dec_get_response( (int16_t) inputMc->lfeRouting.lfeOutputAzimuth, (int16_t) inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i], outAmbiOrder ); + for ( i = 0; i < numLfeIn; i++ ) + { + /* panning gains */ + ivas_dirac_dec_get_response( (int16_t) inputMc->lfeRouting.lfeOutputAzimuth, (int16_t) inputMc->lfeRouting.lfeOutputElevation, inputMc->lfeRouting.lfePanMtx[i], outAmbiOrder ); - /* linear input gain */ - v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); - } + /* linear input gain */ + v_multc( inputMc->lfeRouting.lfePanMtx[i], inputMc->lfeRouting.lfeInputGain, inputMc->lfeRouting.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); + } - return error; - } + return error; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateMcPanGainsForMcOut( @@ -3320,67 +3322,67 @@ static ivas_error updateMcPanGainsForMcOut( return error; } #else - static ivas_error updateMcPanGainsForMcOut( - input_mc * inputMc, - const AUDIO_CONFIG outConfig ) - { - ivas_error error; - - /* "if" conditions below realize the following mapping: +static ivas_error updateMcPanGainsForMcOut( + input_mc *inputMc, + const AUDIO_CONFIG outConfig ) +{ + ivas_error error; - If in == out, use identity matrix, otherwise follow the table: - +-----------+-------------+---------------+-----------+--------------------+ - | in\out | MONO | STEREO | custom LS | other | - +-----------+-------------+---------------+-----------+--------------------+ - | MONO | mono out | EFAP | EFAP | EFAP | - | custom LS | mono out | EFAP | EFAP | EFAP | - | other | mono lookup | stereo lookup | EFAP | conversion mapping | - +-----------+-------------+---------------+-----------+--------------------+ - */ + /* "if" conditions below realize the following mapping: - if ( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) - { - error = initMcPanGainsWithIdentMatrix( inputMc ); - } - else if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM || - inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO || - inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) - { - inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f; - inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0]; - error = IVAS_ERR_OK; - } - else - { - error = initMcPanGainsWithEfap( inputMc, outConfig ); - } - } - else if ( outConfig == IVAS_AUDIO_CONFIG_MONO ) - { - error = initMcPanGainsWithMonoOut( inputMc ); - } - else if ( outConfig == IVAS_AUDIO_CONFIG_STEREO ) - { - error = initMcPanGainsWithStereoLookup( inputMc ); - } - else /* default */ - { - error = initMcPanGainsWithConversionMapping( inputMc, outConfig ); - } + If in == out, use identity matrix, otherwise follow the table: + +-----------+-------------+---------------+-----------+--------------------+ + | in\out | MONO | STEREO | custom LS | other | + +-----------+-------------+---------------+-----------+--------------------+ + | MONO | mono out | EFAP | EFAP | EFAP | + | custom LS | mono out | EFAP | EFAP | EFAP | + | other | mono lookup | stereo lookup | EFAP | conversion mapping | + +-----------+-------------+---------------+-----------+--------------------+ + */ - /* check for errors from above block */ - if ( error != IVAS_ERR_OK ) - { - return error; - } + if ( configsAreEqual( inputMc->base.inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ) ) + { + error = initMcPanGainsWithIdentMatrix( inputMc ); + } + else if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM || + inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO || + inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) + { + inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f; + inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0]; + error = IVAS_ERR_OK; + } + else + { + error = initMcPanGainsWithEfap( inputMc, outConfig ); + } + } + else if ( outConfig == IVAS_AUDIO_CONFIG_MONO ) + { + error = initMcPanGainsWithMonoOut( inputMc ); + } + else if ( outConfig == IVAS_AUDIO_CONFIG_STEREO ) + { + error = initMcPanGainsWithStereoLookup( inputMc ); + } + else /* default */ + { + error = initMcPanGainsWithConversionMapping( inputMc, outConfig ); + } + + /* check for errors from above block */ + if ( error != IVAS_ERR_OK ) + { + return error; + } - /* update LFE panning */ - error = updateLfePanGainsForMcOut( inputMc, outConfig ); + /* update LFE panning */ + error = updateLfePanGainsForMcOut( inputMc, outConfig ); - return error; - } + return error; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateMcPanGainsForAmbiOut( @@ -3476,75 +3478,75 @@ static ivas_error updateMcPanGainsForAmbiOut( return IVAS_ERR_OK; } #else - static ivas_error updateMcPanGainsForAmbiOut( - input_mc * inputMc, - const AUDIO_CONFIG outConfig ) - { - int16_t ch_in, ch_out, lfeIdx; - int16_t numNonLfeInChannels, outAmbiOrder; - const float *spkAzi, *spkEle; - ivas_error error; +static ivas_error updateMcPanGainsForAmbiOut( + input_mc *inputMc, + const AUDIO_CONFIG outConfig ) +{ + int16_t ch_in, ch_out, lfeIdx; + int16_t numNonLfeInChannels, outAmbiOrder; + const float *spkAzi, *spkEle; + ivas_error error; - if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getAmbisonicsOrder( outConfig, &outAmbiOrder ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) + { + return error; + } - for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) - { - if ( ch_in == LFE_CHANNEL ) - { - ++ch_out; - } - ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); - } - } - else + for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) + { + if ( ch_in == LFE_CHANNEL ) { - numNonLfeInChannels = inputMc->customLsInput.num_spk; - spkAzi = inputMc->customLsInput.ls_azimuth; - spkEle = inputMc->customLsInput.ls_elevation; - - for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) - { - for ( lfeIdx = 0; lfeIdx < inputMc->customLsInput.num_lfe; ++lfeIdx ) - { - if ( inputMc->customLsInput.lfe_idx[lfeIdx] == ch_in ) - { - ++ch_out; - break; - } - } - - ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); - } + ++ch_out; } + ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); + } + } + else + { + numNonLfeInChannels = inputMc->customLsInput.num_spk; + spkAzi = inputMc->customLsInput.ls_azimuth; + spkEle = inputMc->customLsInput.ls_elevation; - /* update LFE panning */ - if ( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) + for ( ch_in = 0, ch_out = 0; ch_in < numNonLfeInChannels; ++ch_in, ++ch_out ) + { + for ( lfeIdx = 0; lfeIdx < inputMc->customLsInput.num_lfe; ++lfeIdx ) { - return error; + if ( inputMc->customLsInput.lfe_idx[lfeIdx] == ch_in ) + { + ++ch_out; + break; + } } - return IVAS_ERR_OK; + ivas_dirac_dec_get_response( (int16_t) spkAzi[ch_in], (int16_t) spkEle[ch_in], inputMc->panGains[ch_out], outAmbiOrder ); } + } + + /* update LFE panning */ + if ( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateMcPanGains( @@ -3608,66 +3610,66 @@ static ivas_error updateMcPanGains( return IVAS_ERR_OK; } #else - static ivas_error updateMcPanGains( - input_mc * inputMc, - const AUDIO_CONFIG outConfig ) - { - int16_t i; - ivas_error error; +static ivas_error updateMcPanGains( + input_mc *inputMc, + const AUDIO_CONFIG outConfig ) +{ + int16_t i; + ivas_error error; - /* Reset to all zeros - some functions below only write non-zero elements. */ - setZeroPanMatrix( inputMc->panGains ); + /* Reset to all zeros - some functions below only write non-zero elements. */ + setZeroPanMatrix( inputMc->panGains ); - error = IVAS_ERR_OK; - switch ( getAudioConfigType( outConfig ) ) + error = IVAS_ERR_OK; + switch ( getAudioConfigType( outConfig ) ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + error = updateMcPanGainsForMcOut( inputMc, outConfig ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + error = updateMcPanGainsForAmbiOut( inputMc, outConfig ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = updateMcPanGainsForMcOut( inputMc, outConfig ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = updateMcPanGainsForAmbiOut( inputMc, outConfig ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) - { - case IVAS_AUDIO_CONFIG_BINAURAL: - break; /* Do nothing */ - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - /* Prepare rendering to intermediate format */ - error = updateMcPanGainsForMcOut( inputMc, IVAS_AUDIO_CONFIG_7_1_4 ); - break; - default: - return IVAS_ERR_INVALID_OUTPUT_FORMAT; - } - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + case IVAS_AUDIO_CONFIG_BINAURAL: break; /* Do nothing */ + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + /* Prepare rendering to intermediate format */ + error = updateMcPanGainsForMcOut( inputMc, IVAS_AUDIO_CONFIG_7_1_4 ); + break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - - /* Copy LFE routing to pan gains array */ - if ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - for ( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) - { - mvr2r( inputMc->lfeRouting.lfePanMtx[i], inputMc->panGains[inputMc->customLsInput.lfe_idx[i]], IVAS_MAX_OUTPUT_CHANNELS ); - } - } - else - { - /* For code simplicity, always copy LFE gains. If config has no LFE, gains will be zero anyway. */ - mvr2r( inputMc->lfeRouting.lfePanMtx[0], inputMc->panGains[LFE_CHANNEL], IVAS_MAX_OUTPUT_CHANNELS ); - } + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + break; /* Do nothing */ + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } + /* Check error here to keep switch statement more compact */ + if ( error != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; + /* Copy LFE routing to pan gains array */ + if ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + for ( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) + { + mvr2r( inputMc->lfeRouting.lfePanMtx[i], inputMc->panGains[inputMc->customLsInput.lfe_idx[i]], IVAS_MAX_OUTPUT_CHANNELS ); } + } + else + { + /* For code simplicity, always copy LFE gains. If config has no LFE, gains will be zero anyway. */ + mvr2r( inputMc->lfeRouting.lfePanMtx[0], inputMc->panGains[LFE_CHANNEL], IVAS_MAX_OUTPUT_CHANNELS ); + } + + return IVAS_ERR_OK; +} #endif static ivas_error initMcBinauralRendering( @@ -3704,7 +3706,7 @@ static ivas_error initMcBinauralRendering( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); #endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -3741,7 +3743,7 @@ static ivas_error initMcBinauralRendering( { return error; } - +#if 1 Word16 nchan_rend = num_src; IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { @@ -3757,14 +3759,16 @@ static ivas_error initMcBinauralRendering( FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); + } + Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->q_Pos_p = Q31; } } +#endif #else if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -3781,7 +3785,7 @@ static ivas_error initMcBinauralRendering( return error; } -#if 1 /*Fixed to float conversions */ +#if 0 /*Fixed to float conversions */ FOR( Word16 k = 0; k < add( extract_l( L_shr( inputMc->hReverb->fft_size, 1 ) ), 1 ); k++ ) { ( inputMc->hReverb )->fft_filter_correl_0.fft_spectrum[k] = (float) ( inputMc->hReverb )->fft_filter_correl_0.fft_spectrum_fx[k] / ONE_IN_Q31; @@ -3791,10 +3795,10 @@ static ivas_error initMcBinauralRendering( } #endif #else - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } #endif } } @@ -3841,7 +3845,7 @@ static ivas_error initMcMasaRendering( #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); #else - ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); #endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -3944,89 +3948,89 @@ static lfe_routing defaultLfeRouting( return routing; } #else - static lfe_routing defaultLfeRouting( - const AUDIO_CONFIG inConfig, - const LSSETUP_CUSTOM_STRUCT customLsIn, - const AUDIO_CONFIG outConfig, - const LSSETUP_CUSTOM_STRUCT customLsOut ) - { - int16_t i; - lfe_routing routing; - - /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ - - for ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) - { - set_zero( routing.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); - } - - routing.pan_lfe = false; - routing.lfeInputGain = 1.0f; - - switch ( inConfig ) - { - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_7_1_4: - routing.numLfeChannels = 1; - break; - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - routing.numLfeChannels = customLsIn.num_lfe; - break; - default: - routing.numLfeChannels = 0; - } - - switch ( outConfig ) - { - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_7_1_4: - routing.lfePanMtx[0][LFE_CHANNEL] = 1.0f; - break; - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - for ( i = 0; i < routing.numLfeChannels && i < customLsOut.num_lfe; ++i ) - { - routing.lfePanMtx[i][customLsOut.lfe_idx[i]] = 1.0f; - } - break; - default: - /* Do nothing */ - break; - } - - return routing; - } -#endif -#ifdef IVAS_FLOAT_FIXED -static ivas_error setRendInputActiveMc( - void *input, +static lfe_routing defaultLfeRouting( const AUDIO_CONFIG inConfig, - const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) + const LSSETUP_CUSTOM_STRUCT customLsIn, + const AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT customLsOut ) { - ivas_error error; - rendering_context rendCtx; - AUDIO_CONFIG outConfig; - input_mc *inputMc; + int16_t i; + lfe_routing routing; - inputMc = (input_mc *) input; - rendCtx = inputMc->base.ctx; - outConfig = *rendCtx.pOutConfig; + /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + for ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) { - return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + set_zero( routing.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); } - if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) + routing.pan_lfe = false; + routing.lfeInputGain = 1.0f; + + switch ( inConfig ) { - return error; - } + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_7_1_4: + routing.numLfeChannels = 1; + break; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + routing.numLfeChannels = customLsIn.num_lfe; + break; + default: + routing.numLfeChannels = 0; + } + + switch ( outConfig ) + { + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_7_1_4: + routing.lfePanMtx[0][LFE_CHANNEL] = 1.0f; + break; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + for ( i = 0; i < routing.numLfeChannels && i < customLsOut.num_lfe; ++i ) + { + routing.lfePanMtx[i][customLsOut.lfe_idx[i]] = 1.0f; + } + break; + default: + /* Do nothing */ + break; + } + + return routing; +} +#endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error setRendInputActiveMc( + void *input, + const AUDIO_CONFIG inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) +{ + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_mc *inputMc; + + inputMc = (input_mc *) input; + rendCtx = inputMc->base.ctx; + outConfig = *rendCtx.pOutConfig; + + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + + if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) + { + return error; + } if ( ( error = allocateMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) { return error; @@ -4082,72 +4086,72 @@ static ivas_error setRendInputActiveMc( return IVAS_ERR_OK; } #else - static ivas_error setRendInputActiveMc( - void *input, - const AUDIO_CONFIG inConfig, - const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) - { - ivas_error error; - rendering_context rendCtx; - AUDIO_CONFIG outConfig; - input_mc *inputMc; +static ivas_error setRendInputActiveMc( + void *input, + const AUDIO_CONFIG inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) +{ + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_mc *inputMc; - inputMc = (input_mc *) input; - rendCtx = inputMc->base.ctx; - outConfig = *rendCtx.pOutConfig; + inputMc = (input_mc *) input; + rendCtx = inputMc->base.ctx; + outConfig = *rendCtx.pOutConfig; - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) - { - return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; - } + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } - if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } - initRendInputBase( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH ); + if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } + initRendInputBase( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH ); - setZeroPanMatrix( inputMc->panGains ); - inputMc->customLsInput = defaultCustomLs(); - inputMc->tdRendWrapper = defaultTdRendWrapper(); - inputMc->crendWrapper = NULL; - inputMc->hReverb = NULL; - inputMc->hMcMasa = NULL; + setZeroPanMatrix( inputMc->panGains ); + inputMc->customLsInput = defaultCustomLs(); + inputMc->tdRendWrapper = defaultTdRendWrapper(); + inputMc->crendWrapper = NULL; + inputMc->hReverb = NULL; + inputMc->hMcMasa = NULL; - initRotGains( inputMc->rot_gains_prev ); - inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); - set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); - inputMc->binauralDelaySmp = 0; + initRotGains( inputMc->rot_gains_prev ); + inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); + set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); + inputMc->binauralDelaySmp = 0; - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) + { + return error; + } + } - if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) - { - if ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + { + if ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } - if ( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED static void clearInputMc( @@ -4190,38 +4194,38 @@ static void clearInputMc( return; } #else - static void clearInputMc( - input_mc * inputMc ) - { - rendering_context rendCtx; +static void clearInputMc( + input_mc *inputMc ) +{ + rendering_context rendCtx; - rendCtx = inputMc->base.ctx; + rendCtx = inputMc->base.ctx; - freeMcLfeDelayBuffer( &inputMc->lfeDelayBuffer ); - freeInputBaseBufferData( &inputMc->bufferData ); - initRendInputBase( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); + freeMcLfeDelayBuffer( &inputMc->lfeDelayBuffer ); + freeInputBaseBufferData( &inputMc->bufferData ); + initRendInputBase( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); - /* Free input's internal handles */ - if ( inputMc->efapInWrapper.hEfap != NULL ) - { - efap_free_data( &inputMc->efapInWrapper.hEfap ); - } + /* Free input's internal handles */ + if ( inputMc->efapInWrapper.hEfap != NULL ) + { + efap_free_data( &inputMc->efapInWrapper.hEfap ); + } - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); - ivas_reverb_close( &inputMc->hReverb ); + ivas_reverb_close( &inputMc->hReverb ); - if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); - inputMc->tdRendWrapper.hHrtfTD = NULL; - } + if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); + inputMc->tdRendWrapper.hHrtfTD = NULL; + } - ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); + ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) ); - return; - } + return; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error initSbaPanGainsForMcOut( @@ -4297,75 +4301,75 @@ static ivas_error initSbaPanGainsForMcOut( return IVAS_ERR_OK; } #else - static ivas_error initSbaPanGainsForMcOut( - input_sba * inputSba, - const AUDIO_CONFIG outConfig, - const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) - { - int16_t ambiOrderIn; - int16_t chInIdx, chOutIdx; - float *tmpDecMtx, *readPtr; - IVAS_OUTPUT_SETUP hOutSetup; - ivas_error error; +static ivas_error initSbaPanGainsForMcOut( + input_sba *inputSba, + const AUDIO_CONFIG outConfig, + const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) +{ + int16_t ambiOrderIn; + int16_t chInIdx, chOutIdx; + float *tmpDecMtx, *readPtr; + IVAS_OUTPUT_SETUP hOutSetup; + ivas_error error; - if ( ( error = getAmbisonicsOrder( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getAmbisonicsOrder( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - assert( !"Invalid configuration" ); - return IVAS_ERR_WRONG_PARAMS; - } + if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + assert( !"Invalid configuration" ); + return IVAS_ERR_WRONG_PARAMS; + } - switch ( outConfig ) - { - case IVAS_AUDIO_CONFIG_MONO: - hOutSetup.ls_azimuth = ls_azimuth_CICP1; - hOutSetup.ls_elevation = ls_elevation_CICP1; - ivas_output_init( &hOutSetup, outConfig ); - break; - case IVAS_AUDIO_CONFIG_STEREO: - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1_4: - ivas_output_init( &hOutSetup, outConfig ); - break; - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); - break; - default: - assert( !"Invalid speaker config" ); - return IVAS_ERR_WRONG_PARAMS; - } + switch ( outConfig ) + { + case IVAS_AUDIO_CONFIG_MONO: + hOutSetup.ls_azimuth = ls_azimuth_CICP1; + hOutSetup.ls_elevation = ls_elevation_CICP1; + ivas_output_init( &hOutSetup, outConfig ); + break; + case IVAS_AUDIO_CONFIG_STEREO: + case IVAS_AUDIO_CONFIG_5_1: + case IVAS_AUDIO_CONFIG_7_1: + case IVAS_AUDIO_CONFIG_5_1_2: + case IVAS_AUDIO_CONFIG_5_1_4: + case IVAS_AUDIO_CONFIG_7_1_4: + ivas_output_init( &hOutSetup, outConfig ); + break; + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); + break; + default: + assert( !"Invalid speaker config" ); + return IVAS_ERR_WRONG_PARAMS; + } - /* obtain and copy over HOA decoding matrix */ - tmpDecMtx = NULL; - if ( ( error = ivas_sba_get_hoa_dec_matrix( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) - { - return error; - } + /* obtain and copy over HOA decoding matrix */ + tmpDecMtx = NULL; + if ( ( error = ivas_sba_get_hoa_dec_matrix( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + { + return error; + } - readPtr = &tmpDecMtx[0]; - for ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) + readPtr = &tmpDecMtx[0]; + for ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) + { + for ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) + { + if ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) { - for ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) - { - if ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) - { - continue; /* nothing to be rendered to LFE */ - } - inputSba->hoaDecMtx[chInIdx][chOutIdx] = *readPtr++; - } + continue; /* nothing to be rendered to LFE */ } + inputSba->hoaDecMtx[chInIdx][chOutIdx] = *readPtr++; + } + } - free( tmpDecMtx ); + free( tmpDecMtx ); - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED @@ -4387,23 +4391,23 @@ static ivas_error initSbaPanGainsForSbaOut( return error; } #else - static ivas_error initSbaPanGainsForSbaOut( - input_sba * inputSba, - const AUDIO_CONFIG outConfig ) - { - ivas_error error; - error = IVAS_ERR_OK; +static ivas_error initSbaPanGainsForSbaOut( + input_sba *inputSba, + const AUDIO_CONFIG outConfig ) +{ + ivas_error error; + error = IVAS_ERR_OK; - if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) - { - assert( !"Invalid configuration" ); - return IVAS_ERR_WRONG_PARAMS; - } + if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + { + assert( !"Invalid configuration" ); + return IVAS_ERR_WRONG_PARAMS; + } - fillIdentityPanMatrix( inputSba->hoaDecMtx ); + fillIdentityPanMatrix( inputSba->hoaDecMtx ); - return error; - } + return error; +} #endif #ifdef IVAS_FLOAT_FIXED static ivas_error updateSbaPanGains( @@ -4474,72 +4478,72 @@ static ivas_error updateSbaPanGains( return IVAS_ERR_OK; } #else - static ivas_error updateSbaPanGains( - input_sba * inputSba, - const AUDIO_CONFIG outConfig, - RENDER_CONFIG_DATA *hRendCfg ) - { - ivas_error error; - AUDIO_CONFIG inConfig; - rendering_context rendCtx; +static ivas_error updateSbaPanGains( + input_sba *inputSba, + const AUDIO_CONFIG outConfig, + RENDER_CONFIG_DATA *hRendCfg ) +{ + ivas_error error; + AUDIO_CONFIG inConfig; + rendering_context rendCtx; - /* Reset to all zeros - some functions below only write non-zero elements. */ - setZeroPanMatrix( inputSba->hoaDecMtx ); + /* Reset to all zeros - some functions below only write non-zero elements. */ + setZeroPanMatrix( inputSba->hoaDecMtx ); - inConfig = inputSba->base.inConfig; - rendCtx = inputSba->base.ctx; + inConfig = inputSba->base.inConfig; + rendCtx = inputSba->base.ctx; - switch ( getAudioConfigType( outConfig ) ) + switch ( getAudioConfigType( outConfig ) ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + error = initSbaPanGainsForMcOut( inputSba, outConfig, inputSba->base.ctx.pCustomLsOut ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + error = initSbaPanGainsForSbaOut( inputSba, outConfig ); + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = initSbaPanGainsForMcOut( inputSba, outConfig, inputSba->base.ctx.pCustomLsOut ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = initSbaPanGainsForSbaOut( inputSba, outConfig ); - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + case IVAS_AUDIO_CONFIG_BINAURAL: + { + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { - case IVAS_AUDIO_CONFIG_BINAURAL: - { - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + return error; + } + } + break; + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } - { - return error; - } - } - break; - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - break; - default: - return IVAS_ERR_INVALID_OUTPUT_FORMAT; + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; } break; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - error = IVAS_ERR_OK; - break; /* Do nothing */ default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + error = IVAS_ERR_OK; + break; /* Do nothing */ + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } + /* Check error here to keep switch statement more compact */ + if ( error != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif @@ -4557,10 +4561,10 @@ static ivas_error initSbaMasaRendering( return error; } #else - if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } #endif return IVAS_ERR_OK; @@ -4583,7 +4587,55 @@ static ivas_error setRendInputActiveSba( rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; - IF( !isIoConfigPairSupported( inConfig, outConfig ) ) + IF( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + + IF( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } + initRendInputBase_fx( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData_fx, MAX_BUFFER_LENGTH ); + + setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); + + inputSba->crendWrapper = NULL; + inputSba->hDirAC = NULL; + initRotGains_fx( inputSba->rot_gains_prev_fx ); + + IF( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + { + IF( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + { + return error; + } + + return error; +} +#else +static ivas_error setRendInputActiveSba( + void *input, + const AUDIO_CONFIG inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) +{ + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_sba *inputSba; + + inputSba = (input_sba *) input; + rendCtx = inputSba->base.ctx; + outConfig = *rendCtx.pOutConfig; + + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } @@ -4592,83 +4644,30 @@ static ivas_error setRendInputActiveSba( { return error; } - IF( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); - initRendInputBase_fx( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData_fx, MAX_BUFFER_LENGTH ); - setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); + setZeroPanMatrix( inputSba->hoaDecMtx ); inputSba->crendWrapper = NULL; inputSba->hDirAC = NULL; - initRotGains_fx( inputSba->rot_gains_prev_fx ); + initRotGains( inputSba->rot_gains_prev ); - IF( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) { - IF( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - IF( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { return error; } return error; } -#else - static ivas_error setRendInputActiveSba( - void *input, - const AUDIO_CONFIG inConfig, - const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) - { - ivas_error error; - rendering_context rendCtx; - AUDIO_CONFIG outConfig; - input_sba *inputSba; - - inputSba = (input_sba *) input; - rendCtx = inputSba->base.ctx; - outConfig = *rendCtx.pOutConfig; - - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) - { - return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; - } - - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } - - initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); - - setZeroPanMatrix( inputSba->hoaDecMtx ); - - inputSba->crendWrapper = NULL; - inputSba->hDirAC = NULL; - initRotGains( inputSba->rot_gains_prev ); - - if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) - { - if ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) - { - return error; - } - - return error; - } #endif #ifdef IVAS_FLOAT_FIXED static void clearInputSba( @@ -4678,10 +4677,8 @@ static void clearInputSba( rendCtx = inputSba->base.ctx; - freeInputBaseBufferData( &inputSba->bufferData ); freeInputBaseBufferData_fx( &inputSba->bufferData_fx ); - initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); initRendInputBase_fx( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ @@ -4692,24 +4689,24 @@ static void clearInputSba( return; } #else - static void clearInputSba( - input_sba * inputSba ) - { - rendering_context rendCtx; +static void clearInputSba( + input_sba *inputSba ) +{ + rendering_context rendCtx; - rendCtx = inputSba->base.ctx; + rendCtx = inputSba->base.ctx; - freeInputBaseBufferData( &inputSba->bufferData ); + freeInputBaseBufferData( &inputSba->bufferData ); - initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); + initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); - /* Free input's internal handles */ - ivas_rend_closeCrend( &inputSba->crendWrapper ); + /* Free input's internal handles */ + ivas_rend_closeCrend( &inputSba->crendWrapper ); - ivas_dirac_ana_close( &( inputSba->hDirAC ) ); + ivas_dirac_ana_close( &( inputSba->hDirAC ) ); - return; - } + return; +} #endif #ifndef IVAS_FLOAT_FIXED @@ -5007,143 +5004,143 @@ ivas_error IVAS_REND_Open( return IVAS_ERR_OK; } #else - /*------------------------------------------------------------------------- - * IVAS_REND_Open() - * - * - *------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * IVAS_REND_Open() + * + * + *------------------------------------------------------------------------*/ - ivas_error IVAS_REND_Open( - IVAS_REND_HANDLE * phIvasRend, - const int32_t outputSampleRate, - const AUDIO_CONFIG outConfig, - const int16_t nonDiegeticPan, - const float nonDiegeticPanGain, - const int16_t num_subframes ) - { - int16_t i; - IVAS_REND_HANDLE hIvasRend; - ivas_error error; - int16_t numOutChannels; +ivas_error IVAS_REND_Open( + IVAS_REND_HANDLE *phIvasRend, + const int32_t outputSampleRate, + const AUDIO_CONFIG outConfig, + const int16_t nonDiegeticPan, + const float nonDiegeticPanGain, + const int16_t num_subframes ) +{ + int16_t i; + IVAS_REND_HANDLE hIvasRend; + ivas_error error; + int16_t numOutChannels; - /* Validate function arguments */ - if ( phIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + if ( phIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - if ( ( error = validateOutputAudioConfig( outConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = validateOutputAudioConfig( outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - *phIvasRend = (IVAS_REND_HANDLE) malloc( sizeof( struct IVAS_REND ) ); - if ( *phIvasRend == NULL ) - { - return IVAS_ERR_FAILED_ALLOC; - } + *phIvasRend = (IVAS_REND_HANDLE) malloc( sizeof( struct IVAS_REND ) ); + if ( *phIvasRend == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } - hIvasRend = *phIvasRend; - hIvasRend->sampleRateOut = outputSampleRate; - hIvasRend->outputConfig = outConfig; - hIvasRend->customLsOut = defaultCustomLs(); - hIvasRend->hLimiter = NULL; - hIvasRend->efapOutWrapper.hEfap = NULL; - hIvasRend->efapOutWrapper.pCustomLsSetup = NULL; - hIvasRend->num_subframes = num_subframes; + hIvasRend = *phIvasRend; + hIvasRend->sampleRateOut = outputSampleRate; + hIvasRend->outputConfig = outConfig; + hIvasRend->customLsOut = defaultCustomLs(); + hIvasRend->hLimiter = NULL; + hIvasRend->efapOutWrapper.hEfap = NULL; + hIvasRend->efapOutWrapper.pCustomLsSetup = NULL; + hIvasRend->num_subframes = num_subframes; - /* Initialize limiter */ - if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Initialize limiter */ + if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize headrotation data */ - if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Initialize headrotation data */ + if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize external orientation data */ - if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Initialize external orientation data */ + if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initilize combined orientation data */ - if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Initilize combined orientation data */ + if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize EFAP */ - if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Initialize EFAP */ + if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + { + return error; + } - /* Initialize inputs */ + /* Initialize inputs */ - for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - hIvasRend->inputsIsm[i].crendWrapper = NULL; - hIvasRend->inputsIsm[i].hReverb = NULL; - hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; - hIvasRend->inputsIsm[i].bufferData = NULL; - hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; - hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; - hIvasRend->inputsIsm[i].hOMasa = NULL; - } + hIvasRend->inputsIsm[i].crendWrapper = NULL; + hIvasRend->inputsIsm[i].hReverb = NULL; + hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; + hIvasRend->inputsIsm[i].bufferData = NULL; + hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; + hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; + hIvasRend->inputsIsm[i].hOMasa = NULL; + } - for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; - hIvasRend->inputsMc[i].crendWrapper = NULL; - hIvasRend->inputsMc[i].hReverb = NULL; - hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; - hIvasRend->inputsMc[i].bufferData = NULL; - hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; - hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; - hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; - hIvasRend->inputsMc[i].hMcMasa = NULL; - } + hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; + hIvasRend->inputsMc[i].crendWrapper = NULL; + hIvasRend->inputsMc[i].hReverb = NULL; + hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; + hIvasRend->inputsMc[i].bufferData = NULL; + hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; + hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; + hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; + hIvasRend->inputsMc[i].hMcMasa = NULL; + } - for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - hIvasRend->inputsSba[i].crendWrapper = NULL; - hIvasRend->inputsSba[i].bufferData = NULL; - hIvasRend->inputsSba[i].hDirAC = NULL; - } + hIvasRend->inputsSba[i].crendWrapper = NULL; + hIvasRend->inputsSba[i].bufferData = NULL; + hIvasRend->inputsSba[i].hDirAC = NULL; + } - for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) - { - initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) + { + initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - hIvasRend->inputsMasa[i].metadataHasBeenFed = false; - hIvasRend->inputsMasa[i].bufferData = NULL; - hIvasRend->inputsMasa[i].hMasaPrerend = NULL; - hIvasRend->inputsMasa[i].hMasaExtRend = NULL; - } + hIvasRend->inputsMasa[i].metadataHasBeenFed = false; + hIvasRend->inputsMasa[i].bufferData = NULL; + hIvasRend->inputsMasa[i].hMasaPrerend = NULL; + hIvasRend->inputsMasa[i].hMasaExtRend = NULL; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( @@ -5178,32 +5175,32 @@ static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( return customLs; } #else - static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( - const IVAS_CUSTOM_LS_DATA rendCustomLsLayout ) - { - int16_t i; - LSSETUP_CUSTOM_STRUCT customLs; +static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( + const IVAS_CUSTOM_LS_DATA rendCustomLsLayout ) +{ + int16_t i; + LSSETUP_CUSTOM_STRUCT customLs; - /* Copy layout description */ - customLs.num_spk = rendCustomLsLayout.num_spk; - mvr2r( rendCustomLsLayout.azimuth, customLs.ls_azimuth, rendCustomLsLayout.num_spk ); - mvr2r( rendCustomLsLayout.elevation, customLs.ls_elevation, rendCustomLsLayout.num_spk ); + /* Copy layout description */ + customLs.num_spk = rendCustomLsLayout.num_spk; + mvr2r( rendCustomLsLayout.azimuth, customLs.ls_azimuth, rendCustomLsLayout.num_spk ); + mvr2r( rendCustomLsLayout.elevation, customLs.ls_elevation, rendCustomLsLayout.num_spk ); - customLs.is_planar_setup = 1; - for ( i = 0; i < rendCustomLsLayout.num_spk; ++i ) - { - if ( fabsf( rendCustomLsLayout.elevation[i] ) > EPSILON ) - { - customLs.is_planar_setup = 0; - break; - } - } + customLs.is_planar_setup = 1; + for ( i = 0; i < rendCustomLsLayout.num_spk; ++i ) + { + if ( fabsf( rendCustomLsLayout.elevation[i] ) > EPSILON ) + { + customLs.is_planar_setup = 0; + break; + } + } - customLs.num_lfe = rendCustomLsLayout.num_lfe; - mvs2s( rendCustomLsLayout.lfe_idx, customLs.lfe_idx, rendCustomLsLayout.num_lfe ); + customLs.num_lfe = rendCustomLsLayout.num_lfe; + mvs2s( rendCustomLsLayout.lfe_idx, customLs.lfe_idx, rendCustomLsLayout.num_lfe ); - return customLs; - } + return customLs; +} #endif @@ -5238,34 +5235,34 @@ static ivas_error validateCustomLsLayout_fx( return IVAS_ERR_OK; } #else - static ivas_error validateCustomLsLayout( - const IVAS_CUSTOM_LS_DATA layout ) - { - int16_t i; - - /* Negative number of speakers or LFEs makes no sense */ - if ( layout.num_spk < 0 || layout.num_lfe < 0 ) - { - return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; - } +static ivas_error validateCustomLsLayout( + const IVAS_CUSTOM_LS_DATA layout ) +{ + int16_t i; - /* There must be at least one speaker or LFE in the layout */ - if ( layout.num_spk + layout.num_lfe <= 0 ) - { - return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; - } + /* Negative number of speakers or LFEs makes no sense */ + if ( layout.num_spk < 0 || layout.num_lfe < 0 ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } - /* LFE indices must be positive */ - for ( i = 0; i < layout.num_lfe; ++i ) - { - if ( layout.lfe_idx[i] < 0 ) - { - return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; - } - } + /* There must be at least one speaker or LFE in the layout */ + if ( layout.num_spk + layout.num_lfe <= 0 ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; + } - return IVAS_ERR_OK; + /* LFE indices must be positive */ + for ( i = 0; i < layout.num_lfe; ++i ) + { + if ( layout.lfe_idx[i] < 0 ) + { + return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } + } + + return IVAS_ERR_OK; +} #endif @@ -5302,10 +5299,10 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( return error; } #else - if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) + { + return error; + } #endif hIvasRend->customLsOut = makeCustomLsSetup( layout ); @@ -5403,40 +5400,40 @@ ivas_error IVAS_REND_NumOutChannels( return IVAS_ERR_OK; } #else - /*-------------------------------------------------------------------* - * IVAS_REND_NumOutChannels() - * - * - *-------------------------------------------------------------------*/ +/*-------------------------------------------------------------------* + * IVAS_REND_NumOutChannels() + * + * + *-------------------------------------------------------------------*/ - ivas_error IVAS_REND_NumOutChannels( - IVAS_REND_CONST_HANDLE hIvasRend, - int16_t * numOutChannels ) - { - ivas_error error; +ivas_error IVAS_REND_NumOutChannels( + IVAS_REND_CONST_HANDLE hIvasRend, + int16_t *numOutChannels ) +{ + ivas_error error; - /* Validate function arguments */ - if ( hIvasRend == NULL || numOutChannels == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + if ( hIvasRend == NULL || numOutChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - /* Handle special cases where additional info is needed from the renderer, otherwise use getAudioConfigNumChannels() */ - switch ( hIvasRend->outputConfig ) + /* Handle special cases where additional info is needed from the renderer, otherwise use getAudioConfigNumChannels() */ + switch ( hIvasRend->outputConfig ) + { + case IVAS_AUDIO_CONFIG_LS_CUSTOM: + *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; + break; + default: + if ( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) { - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; - break; - default: - if ( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - break; + return error; } + break; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif @@ -5451,15 +5448,15 @@ static IVAS_REND_InputId makeInputId( return (IVAS_REND_InputId) UL_or( UL_lshl( ( (UWord32) getAudioConfigType( config ) ), 8 ), L_add( inputIndex, 1 ) ); } #else - static IVAS_REND_InputId makeInputId( - AUDIO_CONFIG config, - const int32_t inputIndex ) - { - /* Put config type in second byte (from LSB), put index + 1 in first byte - * - * Index is incremented here so that a valid ID can never be 0. */ - return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); - } +static IVAS_REND_InputId makeInputId( + AUDIO_CONFIG config, + const int32_t inputIndex ) +{ + /* Put config type in second byte (from LSB), put index + 1 in first byte + * + * Index is incremented here so that a valid ID can never be 0. */ + return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); +} #endif @@ -5529,69 +5526,69 @@ static ivas_error getInputById( return IVAS_ERR_OK; } #else - static ivas_error getInputById( - IVAS_REND_HANDLE hIvasRend, - IVAS_REND_InputId inputId, - void **ppInput ) - { - int32_t inputIndex; - IVAS_REND_AudioConfigType configType; - input_base *pInputBase; +static ivas_error getInputById( + IVAS_REND_HANDLE hIvasRend, + IVAS_REND_InputId inputId, + void **ppInput ) +{ + int32_t inputIndex; + IVAS_REND_AudioConfigType configType; + input_base *pInputBase; - /* Reverse makeInputId() */ - inputIndex = ( inputId & 0xFF ) - 1; - configType = ( inputId & 0xFF00 ) >> 8; + /* Reverse makeInputId() */ + inputIndex = ( inputId & 0xFF ) - 1; + configType = ( inputId & 0xFF00 ) >> 8; - /* Validate values derived from input ID */ - if ( inputIndex < 0 ) + /* Validate values derived from input ID */ + if ( inputIndex < 0 ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + switch ( configType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) { return IVAS_ERR_INVALID_INPUT_ID; } - switch ( configType ) + pInputBase = &hIvasRend->inputsIsm[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + if ( inputIndex > RENDERER_MAX_MC_INPUTS ) { - case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: - if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsIsm[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - if ( inputIndex > RENDERER_MAX_MC_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsMc[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsSba[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsMasa[inputIndex].base; - break; - default: - return IVAS_ERR_INVALID_INPUT_ID; + return IVAS_ERR_INVALID_INPUT_ID; } - - /* Ensure input ID matches and that input is active */ - if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) + pInputBase = &hIvasRend->inputsMc[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsSba[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) { return IVAS_ERR_INVALID_INPUT_ID; } + pInputBase = &hIvasRend->inputsMasa[inputIndex].base; + break; + default: + return IVAS_ERR_INVALID_INPUT_ID; + } - /* Validation done, set value via output parameter */ - *ppInput = pInputBase; + /* Ensure input ID matches and that input is active */ + if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } - return IVAS_ERR_OK; - } + /* Validation done, set value via output parameter */ + *ppInput = pInputBase; + + return IVAS_ERR_OK; +} #endif @@ -5661,69 +5658,69 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } #else - static ivas_error getConstInputById( - IVAS_REND_CONST_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const void **ppInput ) - { - int32_t inputIndex; - IVAS_REND_AudioConfigType configType; - const input_base *pInputBase; +static ivas_error getConstInputById( + IVAS_REND_CONST_HANDLE hIvasRend, + const IVAS_REND_InputId inputId, + const void **ppInput ) +{ + int32_t inputIndex; + IVAS_REND_AudioConfigType configType; + const input_base *pInputBase; - /* Reverse makeInputId() */ - inputIndex = ( inputId & 0xFF ) - 1; - configType = ( inputId & 0xFF00 ) >> 8; + /* Reverse makeInputId() */ + inputIndex = ( inputId & 0xFF ) - 1; + configType = ( inputId & 0xFF00 ) >> 8; - /* Validate values derived from input ID */ - if ( inputIndex < 0 ) + /* Validate values derived from input ID */ + if ( inputIndex < 0 ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + switch ( configType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) { return IVAS_ERR_INVALID_INPUT_ID; } - switch ( configType ) + pInputBase = &hIvasRend->inputsIsm[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + if ( inputIndex > RENDERER_MAX_MC_INPUTS ) { - case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: - if ( inputIndex > RENDERER_MAX_ISM_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsIsm[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - if ( inputIndex > RENDERER_MAX_MC_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsMc[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsSba[inputIndex].base; - break; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) - { - return IVAS_ERR_INVALID_INPUT_ID; - } - pInputBase = &hIvasRend->inputsMasa[inputIndex].base; - break; - default: - return IVAS_ERR_INVALID_INPUT_ID; + return IVAS_ERR_INVALID_INPUT_ID; } - - /* Ensure input ID matches and that input is active */ - if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) + pInputBase = &hIvasRend->inputsMc[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + if ( inputIndex > RENDERER_MAX_SBA_INPUTS ) { return IVAS_ERR_INVALID_INPUT_ID; } + pInputBase = &hIvasRend->inputsSba[inputIndex].base; + break; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + if ( inputIndex > RENDERER_MAX_MASA_INPUTS ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } + pInputBase = &hIvasRend->inputsMasa[inputIndex].base; + break; + default: + return IVAS_ERR_INVALID_INPUT_ID; + } - /* Validation done, set value via output parameter */ - *ppInput = pInputBase; + /* Ensure input ID matches and that input is active */ + if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + return IVAS_ERR_INVALID_INPUT_ID; + } - return IVAS_ERR_OK; - } + /* Validation done, set value via output parameter */ + *ppInput = pInputBase; + + return IVAS_ERR_OK; +} #endif #ifndef IVAS_FLOAT_FIXED @@ -5768,46 +5765,46 @@ static ivas_error findFreeInputSlot( return IVAS_ERR_OK; } #else - static ivas_error findFreeInputSlot_fx( - const void *inputs, - const Word32 inputStructSize, - const Word32 maxInputs, - Word32 *inputIndex ) - { - /* Using a void pointer and a separately provided size is a hack for this function - to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). - Assumptions: - - input_base is always the first member in the input struct - - provided size is correct - */ +static ivas_error findFreeInputSlot_fx( + const void *inputs, + const Word32 inputStructSize, + const Word32 maxInputs, + Word32 *inputIndex ) +{ + /* Using a void pointer and a separately provided size is a hack for this function + to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). + Assumptions: + - input_base is always the first member in the input struct + - provided size is correct + */ - Word32 i; - bool canAddInput; - const UWord8 *pByte; - const input_base *pInputBase; + Word32 i; + bool canAddInput; + const UWord8 *pByte; + const input_base *pInputBase; - canAddInput = false; + canAddInput = false; - /* Find first unused input in array */ - FOR( ( i = 0, pByte = inputs ); i < maxInputs; ( ++i, pByte += inputStructSize ) ) - { - pInputBase = (const input_base *) pByte; + /* Find first unused input in array */ + FOR( ( i = 0, pByte = inputs ); i < maxInputs; ( ++i, pByte += inputStructSize ) ) + { + pInputBase = (const input_base *) pByte; - IF( EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) - { - *inputIndex = i; - canAddInput = true; - BREAK; - } - } + IF( EQ_32( pInputBase->inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + *inputIndex = i; + canAddInput = true; + BREAK; + } + } - IF( !canAddInput ) - { - return IVAS_ERR_TOO_MANY_INPUTS; - } + IF( !canAddInput ) + { + return IVAS_ERR_TOO_MANY_INPUTS; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif @@ -5883,71 +5880,71 @@ ivas_error IVAS_REND_AddInput( return IVAS_ERR_OK; } #else - ivas_error IVAS_REND_AddInput_fx( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ - IVAS_REND_InputId *inputId /* o : ID of the new input */ - ) - { - ivas_error error; - Word32 maxNumInputsOfType; - void *inputsArray; - Word32 inputStructSize; - ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); - Word32 inputIndex; +ivas_error IVAS_REND_AddInput_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ + IVAS_REND_InputId *inputId /* o : ID of the new input */ +) +{ + ivas_error error; + Word32 maxNumInputsOfType; + void *inputsArray; + Word32 inputStructSize; + ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); + Word32 inputIndex; - /* Validate function arguments */ - IF( hIvasRend == NULL || inputId == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL || inputId == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - SWITCH( getAudioConfigType( inConfig ) ) - { - case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: - maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; - inputsArray = hIvasRend->inputsIsm; - inputStructSize = sizeof( *hIvasRend->inputsIsm ); - activateInput = setRendInputActiveIsm; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; - inputsArray = hIvasRend->inputsMc; - inputStructSize = sizeof( *hIvasRend->inputsMc ); - activateInput = setRendInputActiveMc; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; - inputsArray = hIvasRend->inputsSba; - inputStructSize = sizeof( *hIvasRend->inputsSba ); - activateInput = setRendInputActiveSba; - BREAK; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; - inputsArray = hIvasRend->inputsMasa; - inputStructSize = sizeof( *hIvasRend->inputsMasa ); - activateInput = setRendInputActiveMasa; - BREAK; - default: - return IVAS_ERR_INVALID_INPUT_FORMAT; - } + SWITCH( getAudioConfigType( inConfig ) ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; + inputsArray = hIvasRend->inputsIsm; + inputStructSize = sizeof( *hIvasRend->inputsIsm ); + activateInput = setRendInputActiveIsm; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; + inputsArray = hIvasRend->inputsMc; + inputStructSize = sizeof( *hIvasRend->inputsMc ); + activateInput = setRendInputActiveMc; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; + inputsArray = hIvasRend->inputsSba; + inputStructSize = sizeof( *hIvasRend->inputsSba ); + activateInput = setRendInputActiveSba; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; + inputsArray = hIvasRend->inputsMasa; + inputStructSize = sizeof( *hIvasRend->inputsMasa ); + activateInput = setRendInputActiveMasa; + BREAK; + default: + return IVAS_ERR_INVALID_INPUT_FORMAT; + } - /* Find first free input in array corresponding to input type */ - IF( ( error = findFreeInputSlot_fx( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) - { - return error; - } + /* Find first free input in array corresponding to input type */ + IF( ( error = findFreeInputSlot_fx( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) + { + return error; + } - *inputId = makeInputId( inConfig, inputIndex ); + *inputId = makeInputId( inConfig, inputIndex ); - IF( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif @@ -5979,10 +5976,10 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } #else - if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) + { + return error; + } #endif if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputMc ) ) != IVAS_ERR_OK ) @@ -6056,30 +6053,30 @@ ivas_error IVAS_REND_SetInputGain( return IVAS_ERR_OK; } #else - ivas_error IVAS_REND_SetInputGain_fx( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - const Word32 gain /* i : linear gain (not in dB) */ - ) - { - input_base *inputBase; - ivas_error error; +ivas_error IVAS_REND_SetInputGain_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const Word32 gain /* i : linear gain (not in dB) */ +) +{ + input_base *inputBase; + ivas_error error; - /* Validate function arguments */ - IF( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + { + return error; + } - inputBase->gain_fx = gain; + inputBase->gain_fx = gain; - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif /*-------------------------------------------------------------------* @@ -6131,48 +6128,48 @@ ivas_error IVAS_REND_SetInputLfeMtx( return IVAS_ERR_OK; } #else - ivas_error IVAS_REND_SetInputLfeMtx_fx( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - const IVAS_REND_LfePanMtx_fx *lfePanMtx /* i : LFE panning matrix */ - ) - { - Word16 i; - input_base *pInputBase; - input_mc *pInputMc; - ivas_error error; +ivas_error IVAS_REND_SetInputLfeMtx_fx( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_REND_LfePanMtx_fx *lfePanMtx /* i : LFE panning matrix */ +) +{ + Word16 i; + input_base *pInputBase; + input_mc *pInputMc; + ivas_error error; - /* Validate function arguments */ - IF( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + { + return error; + } - IF( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - /* Custom LFE panning matrix only makes sense with channel-based input */ - return IVAS_ERR_INVALID_INPUT_FORMAT; - } - pInputMc = (input_mc *) pInputBase; + IF( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + /* Custom LFE panning matrix only makes sense with channel-based input */ + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + pInputMc = (input_mc *) pInputBase; - /* copy LFE panning matrix */ - FOR( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; i++ ) - { - Copy32( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); - } + /* copy LFE panning matrix */ + FOR( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; i++ ) + { + Copy32( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); + } - IF( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif #ifdef IVAS_FLOAT_FIXED @@ -6225,48 +6222,48 @@ ivas_error IVAS_REND_SetInputLfePos_fx( return IVAS_ERR_OK; } #else - ivas_error IVAS_REND_SetInputLfePos( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - const float inputGain, /* i : Input gain to be applied to the LFE channel(s) */ - const float outputAzimuth, /* i : Output azimuth position */ - const float outputElevation /* i : Output elevation position */ - ) - { - input_base *pInputBase; - input_mc *pInputMc; - ivas_error error; +ivas_error IVAS_REND_SetInputLfePos( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const float inputGain, /* i : Input gain to be applied to the LFE channel(s) */ + const float outputAzimuth, /* i : Output azimuth position */ + const float outputElevation /* i : Output elevation position */ +) +{ + input_base *pInputBase; + input_mc *pInputMc; + ivas_error error; - /* Validate function arguments */ - if ( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - if ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - /* Custom LFE routing only makes sense with channel-based input */ - return IVAS_ERR_INVALID_INPUT_FORMAT; - } - pInputMc = (input_mc *) pInputBase; + if ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + /* Custom LFE routing only makes sense with channel-based input */ + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + pInputMc = (input_mc *) pInputBase; - pInputMc->lfeRouting.pan_lfe = true; - pInputMc->lfeRouting.lfeInputGain = inputGain; - pInputMc->lfeRouting.lfeOutputAzimuth = outputAzimuth; - pInputMc->lfeRouting.lfeOutputElevation = outputElevation; + pInputMc->lfeRouting.pan_lfe = true; + pInputMc->lfeRouting.lfeInputGain = inputGain; + pInputMc->lfeRouting.lfeOutputAzimuth = outputAzimuth; + pInputMc->lfeRouting.lfeOutputElevation = outputElevation; - if ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif /*-------------------------------------------------------------------* @@ -6350,33 +6347,33 @@ ivas_error IVAS_REND_GetInputNumChannels( return IVAS_ERR_OK; } #else - ivas_error IVAS_REND_GetInputNumChannels( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - Word16 *numChannels /* o : number of channels of the input */ - ) - { - ivas_error error; - const input_base *pInput; +ivas_error IVAS_REND_GetInputNumChannels( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + Word16 *numChannels /* o : number of channels of the input */ +) +{ + ivas_error error; + const input_base *pInput; - /* Validate function arguments */ - IF( hIvasRend == NULL || numChannels == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL || numChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( ( error = getConstInputById( hIvasRend, inputId, (const void **) &pInput ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getConstInputById( hIvasRend, inputId, (const void **) &pInput ) ) != IVAS_ERR_OK ) + { + return error; + } - IF( ( error = getRendInputNumChannels( pInput, numChannels ) ) != IVAS_ERR_OK ) - { - return error; - } + IF( ( error = getRendInputNumChannels( pInput, numChannels ) ) != IVAS_ERR_OK ) + { + return error; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif /*-------------------------------------------------------------------* @@ -6403,23 +6400,23 @@ ivas_error IVAS_REND_GetNumAllObjects( return IVAS_ERR_OK; } #else - ivas_error IVAS_REND_GetNumAllObjects( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ - Word16 * numChannels /* o : number of all objects */ - ) - { - IF( hIvasRend == NULL || numChannels == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } +ivas_error IVAS_REND_GetNumAllObjects( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + Word16 *numChannels /* o : number of all objects */ +) +{ + IF( hIvasRend == NULL || numChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) - { - *numChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; - } + IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) + { + *numChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; + } - return IVAS_ERR_OK; - } + return IVAS_ERR_OK; +} #endif /*-------------------------------------------------------------------* @@ -6498,76 +6495,76 @@ ivas_error IVAS_REND_GetDelay( return IVAS_ERR_OK; } #else - ivas_error IVAS_REND_GetDelay_fx( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ - Word16 * nSamples, /* o : Renderer delay in samples */ - Word32 * timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ - ) - { - /* TODO tmu : this function only returns the maximum delay across all inputs - * Ideally each input has its own delay buffer and everything is aligned (binaural and LFE filtering delays are nonuniform) - */ - Word16 i; - Word32 latency_ns; - Word32 max_latency_ns; +ivas_error IVAS_REND_GetDelay_fx( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ + Word16 *nSamples, /* o : Renderer delay in samples */ + Word32 *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ +) +{ + /* TODO tmu : this function only returns the maximum delay across all inputs + * Ideally each input has its own delay buffer and everything is aligned (binaural and LFE filtering delays are nonuniform) + */ + Word16 i; + Word32 latency_ns; + Word32 max_latency_ns; - Word32 timescale_by_ns[7] = { 0, 17180, 34360, 0, 68719, 0, 103079 }; + Word32 timescale_by_ns[7] = { 0, 17180, 34360, 0, 68719, 0, 103079 }; - /* Validate function arguments */ - IF( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } + /* Validate function arguments */ + IF( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - *timeScale = hIvasRend->sampleRateOut; - assert( *timeScale == 8000 || *timeScale == 16000 || *timeScale == 32000 || *timeScale == 48000 ); - *nSamples = 0; - max_latency_ns = 0; + *timeScale = hIvasRend->sampleRateOut; + assert( *timeScale == 8000 || *timeScale == 16000 || *timeScale == 32000 || *timeScale == 48000 ); + *nSamples = 0; + max_latency_ns = 0; - /* Compute the maximum delay across all inputs */ - FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) - { - IF( NE_32( hIvasRend->inputsIsm[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) - { - latency_ns = L_max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, - hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); - max_latency_ns = L_max( max_latency_ns, latency_ns ); - } - } + /* Compute the maximum delay across all inputs */ + FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) + { + IF( NE_32( hIvasRend->inputsIsm[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + latency_ns = L_max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, + hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } - FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) - { - IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) - { - latency_ns = L_max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, - hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); - max_latency_ns = L_max( max_latency_ns, latency_ns ); - } - } + FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) + { + IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + latency_ns = L_max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, + hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); + } + } - FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) + FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) + { + IF( NE_32( hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { { - IF( NE_32( hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) - { - { - latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; - max_latency_ns = L_max( max_latency_ns, latency_ns ); - } - } + latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; + max_latency_ns = L_max( max_latency_ns, latency_ns ); } - - - FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ){ - IF( NE_32( hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ){ - latency_ns = (Word32) ( IVAS_FB_DEC_DELAY_NS ); - max_latency_ns = L_max( max_latency_ns, latency_ns ); } } - //*nSamples = (Word16) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); - *nSamples = extract_l( Mpy_32_32_r( max_latency_ns, timescale_by_ns[*timeScale / 8000] ) ); - return IVAS_ERR_OK; + FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ){ + IF( NE_32( hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ){ + latency_ns = (Word32) ( IVAS_FB_DEC_DELAY_NS ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); +} +} + +//*nSamples = (Word16) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); +*nSamples = extract_l( Mpy_32_32_r( max_latency_ns, timescale_by_ns[*timeScale / 8000] ) ); + +return IVAS_ERR_OK; } #endif @@ -6586,53 +6583,52 @@ ivas_error IVAS_REND_FeedInputAudio_fx( { ivas_error error; input_base *inputBase; - int16_t numInputChannels; + Word16 numInputChannels; /* Validate function arguments */ - if ( hIvasRend == NULL || inputAudio.data == NULL ) + IF ( hIvasRend == NULL || inputAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + IF (LE_16( inputAudio.config.numSamplesPerChannel , 0 )|| LT_16(MAX_BUFFER_LENGTH_PER_CHANNEL , inputAudio.config.numSamplesPerChannel) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } - if ( inputAudio.config.numChannels <= 0 || MAX_INPUT_CHANNELS < inputAudio.config.numChannels ) + IF ( LE_16(inputAudio.config.numChannels , 0) ||LT_16( MAX_INPUT_CHANNELS , inputAudio.config.numChannels) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + IF ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); } - if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ) != IVAS_ERR_OK ) + IF ( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ) != IVAS_ERR_OK ) { return error; } - if ( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_AUDIO_CONFIG_OBA ) + IF ( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_AUDIO_CONFIG_OBA ) { - numInputChannels = (int16_t) hIvasRend->inputsIsm[0].total_num_objects; + numInputChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; } - if ( numInputChannels != inputAudio.config.numChannels ) + IF (NE_16( numInputChannels , inputAudio.config.numChannels )) { return IVAS_ERR_WRONG_NUM_CHANNELS; } inputBase->inputBuffer.config = inputAudio.config; - mvr2r( inputAudio.data, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); mvr2r_Word32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; @@ -6805,8 +6801,8 @@ ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( /* Set position to OMasa struct */ #ifdef IVAS_FLOAT_FIXED - hIvasRend->inputsIsm->hOMasa->ism_azimuth_fx[inputIndex] = floatToFixed(objectPosition.azimuth, Q22); - hIvasRend->inputsIsm->hOMasa->ism_elevation_fx[inputIndex] = floatToFixed(objectPosition.elevation, Q22); + hIvasRend->inputsIsm->hOMasa->ism_azimuth_fx[inputIndex] = floatToFixed( objectPosition.azimuth, Q22 ); + hIvasRend->inputsIsm->hOMasa->ism_elevation_fx[inputIndex] = floatToFixed( objectPosition.elevation, Q22 ); #else hIvasRend->inputsIsm->hOMasa->ism_azimuth[inputIndex] = objectPosition.azimuth; hIvasRend->inputsIsm->hOMasa->ism_elevation[inputIndex] = objectPosition.elevation; @@ -7269,7 +7265,7 @@ ivas_error IVAS_REND_SetReferenceRotation( ivas_error error; /* Validate function arguments */ - if ( hIvasRend == NULL ) + IF ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -7278,7 +7274,7 @@ ivas_error IVAS_REND_SetReferenceRotation( error = ivas_orient_trk_SetReferenceRotation_fx( hIvasRend->headRotData.hOrientationTracker, refRot ); - if ( error != IVAS_ERR_OK ) + IF ( error != IVAS_ERR_OK ) { return error; @@ -7424,7 +7420,7 @@ ivas_error IVAS_REND_CombineHeadAndExternalOrientation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ) { - if ( hIvasRend == NULL ) + IF ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -8923,24 +8919,24 @@ static void renderIsmToMasa( copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); #ifdef IVAS_FLOAT_FIXED Word16 input_e[MAX_NUM_OBJECTS], max_e; - FOR(i = 0; i < MAX_NUM_OBJECTS; i++) + FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { - f2me_buf(tmpRendBuffer[i], tmpRendBuffer_fx[i], &input_e[i], L_FRAME48k); + f2me_buf( tmpRendBuffer[i], tmpRendBuffer_fx[i], &input_e[i], L_FRAME48k ); } - Word16 guard_bits = find_guarded_bits_fx(L_FRAME48k); + Word16 guard_bits = find_guarded_bits_fx( L_FRAME48k ); max_e = input_e[0]; - FOR (Word16 i = 1; i < MAX_NUM_OBJECTS; i++) + FOR ( i = 1; i < MAX_NUM_OBJECTS; i++) { - IF (max_e < input_e[0]) - max_e = input_e[i]; + IF( max_e < input_e[0] ) + max_e = input_e[i]; } - FOR(i = 0; i < MAX_NUM_OBJECTS; i++) + FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { - FOR (j = 0; j < L_FRAME48k; j++) + FOR( j = 0; j < L_FRAME48k; j++ ) { - tmpRendBuffer_fx[i][j] = L_shr(tmpRendBuffer_fx[i][j], max_e - input_e[i] + guard_bits); + tmpRendBuffer_fx[i][j] = L_shr( tmpRendBuffer_fx[i][j], max_e - input_e[i] + guard_bits ); } } max_e += guard_bits; @@ -8948,14 +8944,16 @@ static void renderIsmToMasa( #endif #ifdef IVAS_FLOAT_FIXED - ivas_omasa_ana_fx(ismInput->hOMasa, tmpRendBuffer, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels); + ivas_omasa_ana_fx(ismInput->hOMasa, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels); - FOR (Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) { - FOR (Word16 band_m_idx = 0; band_m_idx < ismInput->hOMasa->nbands; band_m_idx++) { - ismInput->hOMasa->energy[block_m_idx][band_m_idx] = fixedToFloat(ismInput->hOMasa->energy_fx[block_m_idx][band_m_idx], ismInput->hOMasa->energy_q); + FOR( Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + FOR( Word16 band_m_idx = 0; band_m_idx < ismInput->hOMasa->nbands; band_m_idx++ ) + { + ismInput->hOMasa->energy[block_m_idx][band_m_idx] = fixedToFloat( ismInput->hOMasa->energy_fx[block_m_idx][band_m_idx], ismInput->hOMasa->energy_q ); } } - FOR(Word16 i = 0; i < ismInput->base.inputBuffer.config.numChannels; i++) { + FOR( i = 0; i < ismInput->base.inputBuffer.config.numChannels; i++) { fixedToFloat_arrL(tmpRendBuffer_fx[i], tmpRendBuffer[i], q_fact, L_FRAME48k ); } @@ -11238,7 +11236,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne1 = &( hIvasRend->inputsIsm->hOMasa->energy ); #ifdef IVAS_FLOAT_FIXED inEne1_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); - inEne1_e = &(hIvasRend->inputsIsm->hOMasa->energy_e); + inEne1_e = (hIvasRend->inputsIsm->hOMasa->energy_e); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) @@ -11253,11 +11251,11 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne1 = &( hIvasRend->inputsMc->hMcMasa->energy ); #ifdef IVAS_FLOAT_FIXED inEne1_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); - inEne1_e = &(hIvasRend->inputsMc->hMcMasa->energy_e); + inEne1_e = (hIvasRend->inputsMc->hMcMasa->energy_exp); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { - f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_e[i], MASA_FREQUENCY_BANDS); + f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS); } #endif } @@ -11267,10 +11265,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne1 = &( hIvasRend->inputsSba->hDirAC->energy ); #ifdef IVAS_FLOAT_FIXED inEne1_fx = &(hIvasRend->inputsSba->hDirAC->energy_fx); - inEne1_e = &(hIvasRend->inputsSba->hDirAC->energy_e); + inEne1_e = (hIvasRend->inputsSba->hDirAC->energy_exp); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { - f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_e[i], MASA_FREQUENCY_BANDS); + f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS); } #endif @@ -11281,7 +11279,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne1 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); #ifdef IVAS_FLOAT_FIXED inEne1_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); - inEne1_e = &(hIvasRend->inputsMasa->hMasaPrerend->energy_e); + inEne1_e = (hIvasRend->inputsMasa->hMasaPrerend->energy_e); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { f2me_buf(hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS); @@ -11300,7 +11298,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne2 = &( hIvasRend->inputsIsm->hOMasa->energy ); #ifdef IVAS_FLOAT_FIXED inEne2_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); - inEne2_e = &(hIvasRend->inputsIsm->hOMasa->energy_e); + inEne2_e = (hIvasRend->inputsIsm->hOMasa->energy_e); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { @@ -11315,10 +11313,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne2 = &( hIvasRend->inputsMc->hMcMasa->energy ); #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); - inEne2_e = &(hIvasRend->inputsMc->hMcMasa->energy_e); + inEne2_e = (hIvasRend->inputsMc->hMcMasa->energy_exp); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { - f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_e[i], MASA_FREQUENCY_BANDS); + f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS); } #endif } @@ -11328,10 +11326,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne2 = &( hIvasRend->inputsSba->hDirAC->energy ); #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); - inEne2_e = &(hIvasRend->inputsSba->hDirAC->energy_e); + inEne2_e = (hIvasRend->inputsSba->hDirAC->energy_exp); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { - f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_e[i], MASA_FREQUENCY_BANDS); + f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS); } #endif } @@ -11341,7 +11339,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne2 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); - inEne2_e = &(hIvasRend->inputsMasa->hMasaPrerend->energy_e); + inEne2_e = (hIvasRend->inputsMasa->hMasaPrerend->energy_e); for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { f2me_buf(hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS); @@ -11356,7 +11354,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( /* Merge metadata */ #ifdef IVAS_FLOAT_FIXED - ivas_prerend_merge_masa_metadata_fx( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1_fx, inEne1_e, inMeta2, inputType2, inEne2_fx, inEne2_e ); + ivas_prerend_merge_masa_metadata_fx( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1_fx, inEne1_e, inMeta2, inputType2, *inEne2_fx, inEne2_e ); FOR(Word32 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) { diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index c8b7643c1..a6267035c 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1066,7 +1066,6 @@ static ivas_error create_HRTF_from_rawdata( float *tmp, temp_buf[1]; tmp = temp_buf; memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); - pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); hrtf_data_rptr += sizeof( float ); } @@ -1099,7 +1098,6 @@ static ivas_error create_HRTF_from_rawdata( float *tmp, temp_buf[1]; tmp = temp_buf; memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); - pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); hrtf_data_rptr += sizeof( float ); } @@ -1137,7 +1135,6 @@ static ivas_error create_HRTF_from_rawdata( float *tmp, temp_buf[1]; tmp = temp_buf; memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); - pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); hrtf_data_rptr += sizeof( float ); } @@ -1168,7 +1165,6 @@ static ivas_error create_HRTF_from_rawdata( float *tmp, temp_buf[1]; tmp = temp_buf; memcpy( tmp, hrtf_data_rptr, sizeof( float ) ); - pOut_to_bin_wptr_fx[l] = (Word32) ( (float) hrtf_data_rptr[l] * ONE_IN_Q29 ); pOut_to_bin_wptr_fx[l] = (Word32) ( *tmp * ONE_IN_Q29 ); hrtf_data_rptr += sizeof( float ); } @@ -1542,7 +1538,11 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { memcpy( f_tmp_ntaps_sba, hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) ); hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float ); +#ifdef MSAN_FIX + floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRImag_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); +#else floatToFixed_arrL( f_tmp_ntaps_sba, ( *hHRTF )->rightHRIRReal_HOA3_fx[i][j], Q29, BINAURAL_NTAPS_SBA ); +#endif } } } -- GitLab From 449edfe8bb3b5ffb1ae4f3f5139c79498b683812 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 14 May 2024 11:32:31 +0530 Subject: [PATCH 040/101] ivas_dirac_dec_render_sf_fx cleanup --- lib_dec/ivas_dirac_dec.c | 2168 +++++++------------- lib_rend/ivas_dirac_output_synthesis_dec.c | 2 + lib_rend/ivas_dirac_rend.c | 2 +- 3 files changed, 741 insertions(+), 1431 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 9a5e1e5a5..b7ae00511 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3587,10 +3587,10 @@ void ivas_dirac_dec_render_sf_fx( int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; /*CLDFB: last output channels reserved to LFT for CICPx*/ - float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; int16_t index = 0, num_freq_bands = 0; /* local copies of azi, ele, diffuseness */ @@ -3605,32 +3605,19 @@ void ivas_dirac_dec_render_sf_fx( Word32 surCohEner_fx; Word32 surCohRatio_fx[CLDFB_NO_CHANNELS_MAX]; Word16 surCohRatio_q_fx = 0, temp_q = 0; - Word16 diffuse_power_factor_q = 0, direct_power_factor_q = 0; Word32 Cldfb_RealBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word16 cldfb_buf_q; Word16 offset; Word32 pppQMfFrame_ts_re_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 pppQMfFrame_ts_im_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - set_zero_fx(surCohRatio_fx, CLDFB_NO_CHANNELS_MAX); + set_zero_fx( surCohRatio_fx, CLDFB_NO_CHANNELS_MAX ); Word16 q_cldfb, q_temp_cldfb = 0; Word16 proto_length = 0; - //Word32 proto_frame_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; - - Word32 proto_direct_buffer_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; - Word32 proto_power_smooth_fx[2 * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; - Word32 reference_power_fix[5 * CLDFB_NO_CHANNELS_MAX]; - Word32 onset_filter_subframe_fix[2 * CLDFB_NO_CHANNELS_MAX]; Word32 proto_diffuse_buffer_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; - //set_zero_fx( &proto_frame_f_fx[0], 2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX ); - set_zero_fx( &proto_direct_buffer_f_fx[0], 2 * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS ); - set_zero_fx( &proto_power_smooth_fx[0], 2 * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS ); - set_zero_fx( &reference_power_fix[0], 5 * CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &proto_diffuse_buffer_f_fx[0], 2 * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS ); + Word16 q_proto_direct_buffer[CLDFB_SLOTS_PER_SUBFRAME]; + Word16 q_proto_diffuse_buffer[CLDFB_SLOTS_PER_SUBFRAME]; #endif DIRAC_DEC_STACK_MEM DirAC_mem; @@ -3641,6 +3628,12 @@ void ivas_dirac_dec_render_sf_fx( #endif uint16_t coherence_flag; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + Word16 q_onset_filter = 0; + Word16 scale = 0; + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + Word16 num_channels_dir, exp; + Word16 q_diffuseness_vector = Q31, q_reference_power_smooth = Q31; push_wmops( "ivas_dirac_dec_render" ); @@ -3655,20 +3648,20 @@ void ivas_dirac_dec_render_sf_fx( reference_power_smooth = ( DirAC_mem.reference_power == NULL ) ? NULL : DirAC_mem.reference_power + hSpatParamRendCom->num_freq_bands; onset_filter = DirAC_mem.onset_filter; onset_filter_subframe = ( DirAC_mem.onset_filter == NULL ) ? NULL : DirAC_mem.onset_filter + hSpatParamRendCom->num_freq_bands; -#ifdef IVAS_FLOAT_FIXED reference_power_fx = DirAC_mem.reference_power_fx; reference_power_smooth_fx = ( DirAC_mem.reference_power_fx == NULL ) ? NULL : DirAC_mem.reference_power_fx + hSpatParamRendCom->num_freq_bands; onset_filter_fx = DirAC_mem.onset_filter_fx; onset_filter_subframe_fx = ( DirAC_mem.onset_filter_fx == NULL ) ? NULL : DirAC_mem.onset_filter_fx + hSpatParamRendCom->num_freq_bands; q_cldfb = Q11; move16(); + set_s( q_proto_direct_buffer, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); + set_s( q_proto_diffuse_buffer, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); + //////////////////////////////////////////////////////////////////////////// to be removed /////////////////////////////////////////////////////////////////// - reference_power_smooth_fx = &reference_power_fix[hSpatParamRendCom->num_freq_bands]; - onset_filter_subframe_fx = &onset_filter_subframe_fix[hSpatParamRendCom->num_freq_bands]; IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) { mvr2r( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); - //Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); + // Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL32( diffuseness_vector, hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], Q30, hSpatParamRendCom->num_freq_bands ); md_idx = hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]; } @@ -3745,7 +3738,7 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); IF( hDirACRend->masa_stereo_type_detect ) { IF( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db == -INFINITY ) @@ -3768,16 +3761,16 @@ void ivas_dirac_dec_render_sf_fx( case 8: case 6: case 4: - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); BREAK; case 2: IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); } ELSE { - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); IF( hDirACRend->masa_stereo_type_detect ) { IF( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db == -INFINITY ) @@ -3792,13 +3785,13 @@ void ivas_dirac_dec_render_sf_fx( } BREAK; case 1: - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); BREAK; } } IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { - //Word16 val = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + // Word16 val = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; FOR( i = 0; i < 32; i++ ) { Word16 exp1 = 0, exp2 = 0, exp3 = 0; @@ -3813,6 +3806,54 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->q_buffer_energy[i] = sub( 31, hDirACRend->q_buffer_energy[i] ); } } + + IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) + { + if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 ) + { + DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state ); + f2me_buf( state->proto_power_diff_smooth, state->proto_power_diff_smooth_fx, &state->proto_power_diff_smooth_q, state->proto_power_diff_smooth_len ); + state->proto_power_diff_smooth_q = 31 - state->proto_power_diff_smooth_q; + } + } + + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + num_channels_dir = hDirACRend->num_outputs_dir; + hodirac_flag = ivas_get_hodirac_flag_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + { + num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE; + } + + if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + } + + if ( h_dirac_output_synthesis_params->use_onset_filters && ( hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + floatToFixed_arrL( hDirACRend->stack_mem.onset_filter, hDirACRend->stack_mem.onset_filter_fx, Q30, ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ? hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands : 2 * hSpatParamRendCom->num_freq_bands ); + } + + if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// hodirac_flag = ivas_get_hodirac_flag_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); @@ -3868,657 +3909,68 @@ void ivas_dirac_dec_render_sf_fx( } IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) - { - p_Rmat_fx = &st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; - - IF( EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 0 ) ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - move16(); - IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) - { - rotateAziEle_DirAC_fx( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat_fx ); - } - } - } - ELSE - { - p_Rmat_fx = 0; - } - - IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) - { - /* compute response */ - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_power_factors_fx( hSpatParamRendCom->num_freq_bands, - diffuseness_vector_fx, - hDirACRend->h_output_synthesis_psd_params.max_band_decorr, - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx ); - - direct_power_factor_q = Q29; - move16(); - diffuse_power_factor_q = Q29; - move16(); - - IF( coherence_flag ) - { - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - dirEne_fx = hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i]; // Q29 - move32(); - surCohEner_fx = Mpy_32_16_1( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hSpatParamRendCom->surroundingCoherence_fx[md_idx][i] ); // Q29 + Q15 - Q15 = Q29 - - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i] = L_sub( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], surCohEner_fx ); // Q29 - move32(); - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i] = L_add( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], surCohEner_fx ); // Q29 - move32(); - - surCohRatio_fx[i] = BASOP_Util_Divide3232_Scale( surCohEner_fx, ( L_add( EPSILLON_FX, L_add( dirEne_fx, surCohEner_fx ) ) ), &temp_q ); - move32(); - surCohRatio_fx[i] = L_shl( surCohRatio_fx[i], temp_q ); - move32(); - } - } - ELSE - { - set_zero_fx( surCohRatio_fx, hSpatParamRendCom->num_freq_bands ); - } - surCohRatio_q_fx = Q15; - move16(); - } - ELSE - { - Word16 max_exp_direct = 0, max_exp_diffusion = 0; - ivas_dirac_dec_compute_gain_factors_fx( hSpatParamRendCom->num_freq_bands, - hSpatParamRendCom->diffuseness_vector_fx[md_idx], - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, - &max_exp_direct, &max_exp_diffusion ); - - direct_power_factor_q = sub( Q31, max_exp_direct ); - diffuse_power_factor_q = sub( Q31, max_exp_diffusion ); - - IF( coherence_flag ) - { - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - surCohRatio_fx[i] = (Word32) hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]; - move32(); - } - } - ELSE - { - set_zero_fx( surCohRatio_fx, hSpatParamRendCom->num_freq_bands ); - } - surCohRatio_q_fx = Q15; - move16(); - } - - IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 1 ) ) - { - ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, - hDirACRend, - st_ivas->hVBAPdata, - st_ivas->hMasa == NULL ? NULL : st_ivas->hMasa->data.band_mapping, - st_ivas->hMasaIsmData, - azimuth, - elevation, - md_idx, - surCohRatio_fx, - surCohRatio_q_fx, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat_fx, - hodirac_flag ); - } - ELSE - { - ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, - hDirACRend, - st_ivas->hVBAPdata, - st_ivas->hMasa == NULL ? NULL : st_ivas->hMasa->data.band_mapping, - st_ivas->hMasaIsmData, - azimuth, - elevation, - md_idx, - surCohRatio_fx, - surCohRatio_q_fx, - 0, - NULL, - hodirac_flag ); - } - } - - IF( L_and( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ), EQ_16( nchan_transport, 2 ) ) ) - { - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = add( slot_idx_start, slot_idx ); - offset = i_mult( hSpatParamRendCom->num_freq_bands, index_slot ); - /* CLDFB Analysis*/ - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - q_temp_cldfb = Q11; - move16(); - cldfbAnalysis_ts_fx_fixed_q( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], - Cldfb_RealBuffer_Temp_fx[ch][slot_idx], - Cldfb_ImagBuffer_Temp_fx[ch][slot_idx], - hSpatParamRendCom->num_freq_bands, - st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); - } - q_cldfb = q_temp_cldfb; - move16(); - } - - IF( L_and( NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ), NE_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) ) - { - ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( st_ivas, Cldfb_RealBuffer_Temp_fx, Cldfb_ImagBuffer_Temp_fx, &cldfb_buf_q, hSpatParamRendCom->num_freq_bands, subframe_idx ); - } - } - - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = add( slot_idx_start, slot_idx ); - IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) - { - md_idx = hSpatParamRendCom->render_to_md_map[index_slot]; - move16(); - } - ELSE - { - md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; - move16(); - } - IF( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) - { - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - Copy32( pppQMfFrame_ts_re_fx[ch][slot_idx], Cldfb_RealBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); - Copy32( pppQMfFrame_ts_im_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); - } - q_cldfb = Q6; - move16(); - } - ELSE IF( L_and( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ), EQ_16( nchan_transport, 2 ) ) ) - { - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - Copy32( Cldfb_RealBuffer_Temp_fx[ch][slot_idx], Cldfb_RealBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); - Copy32( Cldfb_ImagBuffer_Temp_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); - } - } - ELSE - { - /* CLDFB Analysis*/ - offset = i_mult( hSpatParamRendCom->num_freq_bands, index_slot ); - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - q_temp_cldfb = Q11; - move16(); - cldfbAnalysis_ts_fx_fixed_q( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], - Cldfb_RealBuffer_fx[ch][0], - Cldfb_ImagBuffer_fx[ch][0], - hSpatParamRendCom->num_freq_bands, - st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); - } - q_cldfb = q_temp_cldfb; - move16(); - } - - /* CNG in DirAC, extra CLDFB ana for CNA*/ - IF( EQ_16( st_ivas->nchan_transport, 1 ) && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && !( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - Word16 Q_input = Q11; - move16(); - q_temp_cldfb = Q11; - generate_masking_noise_dirac_ivas_fx( st->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], - st_ivas->hTcBuffer->tc_fx[1], - Cldfb_RealBuffer_fx[1][0], - Cldfb_ImagBuffer_fx[1][0], - index_slot, - st->cna_dirac_flag && st->flag_cna, - ( L_or( EQ_32( st->core_brate, FRAME_NO_DATA ), EQ_32( st->core_brate, SID_2k40 ) ) ) && EQ_16( st->cng_type, FD_CNG ) && st->cng_sba_flag, Q_input, &q_temp_cldfb ); - Scale_sig32( Cldfb_RealBuffer_fx[1][0], CLDFB_NO_CHANNELS_MAX, sub( Q6, q_temp_cldfb ) ); - Scale_sig32( Cldfb_ImagBuffer_fx[1][0], CLDFB_NO_CHANNELS_MAX, sub( Q6, q_temp_cldfb ) ); - } - - /* LFE synthesis */ - IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && !hDirACRend->hOutSetup.separateChannelEnabled && !( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16( hDirACRend->hOutSetup.num_lfe, 0 ) ) ) - { - ivas_lfe_synth_with_cldfb_fx( st_ivas->hMasa->hMasaLfeSynth, - Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, - Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1], - slot_idx, - md_idx, - nchan_transport, q_cldfb ); - } - - /*-----------------------------------------------------------------* - * protoype signal computation - *-----------------------------------------------------------------*/ - IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 0 ) ) - { - protoSignalComputation_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, - proto_direct_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - proto_diffuse_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - reference_power_fix, &DirAC_mem.reference_power_q, - slot_idx, nchan_transport, - hDirACRend->num_outputs_diff, - hSpatParamRendCom->num_freq_bands, - p_Rmat_fx, q_cldfb ); - } - ELSE - { - protoSignalComputation_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, - proto_direct_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - proto_diffuse_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - reference_power_fix, &DirAC_mem.reference_power_q, - slot_idx, nchan_transport, - hDirACRend->num_outputs_diff, - hSpatParamRendCom->num_freq_bands, - 0, q_cldfb ); - } - } - ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) - { - protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, - &hDirACRend->proto_frame_f_q, - proto_direct_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - reference_power_fix, - &DirAC_mem.reference_power_q, - proto_power_smooth_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, - 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect, - q_cldfb ); - } - ELSE - { - SWITCH( nchan_transport ) - { - case 11: - case 8: - case 6: - case 4: - protoSignalComputation4_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, - hDirACRend->proto_frame_f_fx, - &hDirACRend->proto_frame_f_q, - proto_direct_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - reference_power_fix, - &DirAC_mem.reference_power_q, - proto_power_smooth_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, - slot_idx, hDirACRend->num_outputs_diff, - hSpatParamRendCom->num_freq_bands, - hDirACRend->hoa_decoder, - nchan_transport, - hDirACRend->sba_map_tc, q_cldfb ); - BREAK; - case 2: - protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, - &hDirACRend->proto_frame_f_q, - proto_direct_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - reference_power_fix, - &DirAC_mem.reference_power_q, - proto_power_smooth_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, - hDirACRend->hOutSetup.is_loudspeaker_setup, - slot_idx, - hSpatParamRendCom->num_freq_bands, - hDirACRend->masa_stereo_type_detect, - q_cldfb ); - BREAK; - case 1: - protoSignalComputation1_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, - hDirACRend->proto_frame_f_fx, - &hDirACRend->proto_frame_f_q, - proto_direct_buffer_f_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - reference_power_fix, - &DirAC_mem.reference_power_q, - proto_power_smooth_fx, - &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, - slot_idx, - hDirACRend->num_protos_diff, - hSpatParamRendCom->num_freq_bands, q_cldfb ); - BREAK; - default: - return; - } - } - - /*-----------------------------------------------------------------* - * Compute DirAC parameters at decoder side - *-----------------------------------------------------------------*/ - IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) - { - Copy( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); - Copy( &hSpatParamRendCom->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); - IF( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 0 ) ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - move16(); - rotateAziEle_DirAC_fx( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat_fx ); - } - - /*hDirACRend->index_buffer_intensity = ( hDirACRend->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1 */ - IF( EQ_16( hDirACRend->index_buffer_intensity, 0 ) ) - { - hDirACRend->index_buffer_intensity = 1; - } - ELSE - { - hDirACRend->index_buffer_intensity = add( sub( hDirACRend->index_buffer_intensity, i_mult( idiv1616( hDirACRend->index_buffer_intensity, DIRAC_NO_COL_AVG_DIFF ), DIRAC_NO_COL_AVG_DIFF ) ), 1 ); /* averaging_length = 32 */ - } - - index = hDirACRend->index_buffer_intensity; - move16(); - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - move16(); - - computeIntensityVector_dec_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, - q_cldfb, num_freq_bands, - hDirACRend->buffer_intensity_real_fx[0][sub( index, 1 )], - hDirACRend->buffer_intensity_real_fx[1][sub( index, 1 )], - hDirACRend->buffer_intensity_real_fx[2][sub( index, 1 )], - &hDirACRend->q_buffer_intensity_real[sub( index, 1 )] ); - - computeDirectionAngles_fx( hDirACRend->buffer_intensity_real_fx[0][sub( index, 1 )], - hDirACRend->buffer_intensity_real_fx[1][sub( index, 1 )], - hDirACRend->buffer_intensity_real_fx[2][sub( index, 1 )], - hDirACRend->q_buffer_intensity_real[sub( index, 1 )], - num_freq_bands, azimuth, elevation ); - - Copy32( reference_power_fix, &( hDirACRend->buffer_energy_fx[i_mult( sub( index, 1 ), num_freq_bands )] ), num_freq_bands ); - hDirACRend->q_buffer_energy[sub( index, 1 )] = DirAC_mem.reference_power_q; - move16(); - - computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); - } - ////////////////////////////////////////////// to be removed /////////////////////////////////////////////////////////////// - IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) && EQ_16( slot_idx, 0 ) ) - { - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); - } - ELSE - { - me2f_buf( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, 31 - diffuse_power_factor_q, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hSpatParamRendCom->num_freq_bands ); - me2f_buf( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, 31 - direct_power_factor_q, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hSpatParamRendCom->num_freq_bands ); - } - } - - IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - - IF( hodirac_flag ) - { - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - ELSE - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - - IF( !( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) ) - { - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - fixedToFloat_arrL32( st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, st_ivas->cldfbAnaDec[ch]->cldfb_state, Q11, ( st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels ) ); - } - } - - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - fixedToFloat_arrL32( Cldfb_RealBuffer_fx[ch][0], Cldfb_RealBuffer[ch][0], Q6, hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( Cldfb_ImagBuffer_fx[ch][0], Cldfb_ImagBuffer[ch][0], Q6, hSpatParamRendCom->num_freq_bands ); - } - - IF( EQ_16( st_ivas->nchan_transport, 1 ) && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && !( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) ) - { - fixedToFloat_arrL32( st_ivas->cldfbAnaDec[1]->cldfb_state_fx, st_ivas->cldfbAnaDec[1]->cldfb_state, Q11, ( st_ivas->cldfbAnaDec[1]->p_filter_length - st_ivas->cldfbAnaDec[1]->no_channels ) ); - fixedToFloat_arrL32( Cldfb_RealBuffer_fx[1][0], Cldfb_RealBuffer[1][0], Q6, CLDFB_NO_CHANNELS_MAX ); - fixedToFloat_arrL32( Cldfb_ImagBuffer_fx[1][0], Cldfb_ImagBuffer[1][0], Q6, CLDFB_NO_CHANNELS_MAX ); - } - - IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && !hDirACRend->hOutSetup.separateChannelEnabled && !( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16( hDirACRend->hOutSetup.num_lfe, 0 ) ) ) - { - FOR( i = 0; i < nchan_transport; i++ ) - { - Cldfb_RealBuffer[i][0][0] = fixedToFloat_32( Cldfb_RealBuffer_fx[i][0][0], Q6 ); - Cldfb_ImagBuffer[i][0][0] = fixedToFloat_32( Cldfb_ImagBuffer_fx[i][0][0], Q6 ); - } - fixedToFloat_arrL32( Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][slot_idx], Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][slot_idx], Q6, CLDFB_NO_CHANNELS_MAX ); - fixedToFloat_arrL32( Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][slot_idx], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][slot_idx], Q6, CLDFB_NO_CHANNELS_MAX ); - } - - IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL32( &proto_direct_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, 2 * nchan_transport * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( &proto_diffuse_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, 2 * s_min( nchan_transport, hDirACRend->num_outputs_diff ) * hSpatParamRendCom->num_freq_bands ); - IF( nchan_transport >= 4 ) - { - fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, 5 * hSpatParamRendCom->num_freq_bands ); - } - IF( nchan_transport == 4 && p_Rmat_fx != 0 ) - { - FOR( i = 0; i < 4; i++ ) - { - fixedToFloat_arrL32( Cldfb_RealBuffer_fx[i][0], Cldfb_RealBuffer[i][0], Q6, hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( Cldfb_ImagBuffer_fx[i][0], Cldfb_ImagBuffer[i][0], Q6, hSpatParamRendCom->num_freq_bands ); - } - } - } - ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) - { - fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( &proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); - proto_length = i_mult(6, hSpatParamRendCom->num_freq_bands); - fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - IF( hDirACRend->masa_stereo_type_detect ) - { - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } - } - ELSE - { - SWITCH( nchan_transport ) - { - case 11: - case 8: - case 6: - case 4: - offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); - fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); - fixedToFloat_arrL32( &proto_direct_buffer_f_fx[offset], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f[offset], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); - fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); - proto_length = i_mult(2, i_mult(hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff)); - fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - BREAK; - case 2: - IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) - { - fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( &proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 3 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 3 ), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); - } - ELSE - { - fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( &proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); - IF( hDirACRend->masa_stereo_type_detect ) - { - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } - } - fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); - proto_length = i_mult(6, hSpatParamRendCom->num_freq_bands); - fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - BREAK; - case 1: - fixedToFloat_arrL32( proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( &proto_direct_buffer_f_fx[i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ) ); - proto_length = i_mult(2, i_mult(hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff)); - fixedToFloat_arrL32( reference_power_fix, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - BREAK; - } - } - IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) - { - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[0][index - 1], hDirACRend->buffer_intensity_real[0][index - 1], hDirACRend->q_buffer_intensity_real[index - 1], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[1][index - 1], hDirACRend->buffer_intensity_real[1][index - 1], hDirACRend->q_buffer_intensity_real[index - 1], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[2][index - 1], hDirACRend->buffer_intensity_real[2][index - 1], hDirACRend->q_buffer_intensity_real[index - 1], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( hSpatParamRendCom->diffuseness_vector_fx[md_idx], hSpatParamRendCom->diffuseness_vector[md_idx], hSpatParamRendCom->q_diffuseness_vector, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( &hDirACRend->buffer_energy_fx[( index - 1 ) * num_freq_bands], &hDirACRend->buffer_energy[( index - 1 ) * num_freq_bands], hDirACRend->q_buffer_energy[index - 1], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - } -#else - float dirEne; - float surCohEner; - float surCohRatio[CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Temp[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#ifdef IVAS_FLOAT_FIXED - set_zero( surCohRatio, CLDFB_NO_CHANNELS_MAX ); -#endif - hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); - if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) - { - coherence_flag = st_ivas->hQMetaData->coherence_flag; - } - else - { - coherence_flag = 0; - } - - - /* Subframe loop */ - slot_idx_start = hSpatParamRendCom->slots_rendered; - slot_idx_start_cldfb_synth = 0; - - subframe_idx = hSpatParamRendCom->subframes_rendered; - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; - } - else - { - md_idx = hSpatParamRendCom->render_to_md_map[slot_idx_start]; - } - - /* copy parameters into local buffers*/ - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - mvs2s( hSpatParamRendCom->azimuth[hSpatParamRendCom->render_to_md_map[subframe_idx]], azimuth, hSpatParamRendCom->num_freq_bands ); - mvs2s( hSpatParamRendCom->elevation[hSpatParamRendCom->render_to_md_map[subframe_idx]], elevation, hSpatParamRendCom->num_freq_bands ); - mvr2r( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED - Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); -#endif - } - else - { - set_zero( diffuseness_vector, hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED - set32_fx( diffuseness_vector_fx, 0, hSpatParamRendCom->num_freq_bands ); -#endif - } - - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - set_zero( reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - } - else - { - set_zero( onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); - } + p_Rmat_fx = &st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) - { - p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; - if ( st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + IF( EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 0 ) ) { num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - if ( hDirAC->hConfig->dec_param_estim == FALSE ) + move16(); + IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) { - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat ); + rotateAziEle_DirAC_fx( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat_fx ); } } } - else + ELSE { - p_Rmat = 0; + p_Rmat_fx = 0; } - if ( hDirAC->hConfig->dec_param_estim == FALSE ) + IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) { /* compute response */ - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { -#ifdef IVAS_FLOAT_FIXED - for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - diffuseness_vector_fx[i] = float_to_fix( diffuseness_vector[i], Q30 ); - } - ivas_dirac_dec_compute_power_factors_fx( hSpatParamRendCom->num_freq_bands, diffuseness_vector_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx ); - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], Q29 ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], Q29 ); - } -#else - ivas_dirac_dec_compute_power_factors( hSpatParamRendCom->num_freq_bands, - diffuseness_vector, - hDirACRend->h_output_synthesis_psd_params.max_band_decorr, - hDirACRend->h_output_synthesis_psd_state.direct_power_factor, - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); -#endif + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q29; + move16(); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q29; + move16(); - if ( coherence_flag ) + IF( coherence_flag ) { - for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - dirEne = hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i]; - surCohEner = hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] * hSpatParamRendCom->surroundingCoherence[md_idx][i]; - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; + dirEne_fx = hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i]; // Q29 + move32(); + surCohEner_fx = Mpy_32_16_1( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hSpatParamRendCom->surroundingCoherence_fx[md_idx][i] ); // Q29 + Q15 - Q15 = Q29 - surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i] = L_sub( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], surCohEner_fx ); // Q29 + move32(); + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i] = L_add( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], surCohEner_fx ); // Q29 + move32(); + + surCohRatio_fx[i] = BASOP_Util_Divide3232_Scale( surCohEner_fx, ( L_add( EPSILLON_FX, L_add( dirEne_fx, surCohEner_fx ) ) ), &temp_q ); + move32(); + surCohRatio_fx[i] = L_shl( surCohRatio_fx[i], temp_q ); + move32(); } } - else + ELSE { - set_zero( surCohRatio, hSpatParamRendCom->num_freq_bands ); + set_zero_fx( surCohRatio_fx, hSpatParamRendCom->num_freq_bands ); } + surCohRatio_q_fx = Q15; + move16(); } - else + ELSE { -#ifdef IVAS_FLOAT_FIXED Word16 max_exp_direct = 0, max_exp_diffusion = 0; ivas_dirac_dec_compute_gain_factors_fx( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], @@ -4526,66 +3978,27 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, &max_exp_direct, &max_exp_diffusion ); - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], max_exp_direct ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], max_exp_diffusion ); - } - -#else - ivas_dirac_dec_compute_gain_factors( hSpatParamRendCom->num_freq_bands, - hSpatParamRendCom->diffuseness_vector[md_idx], - hDirACRend->h_output_synthesis_psd_params.max_band_decorr, - hDirACRend->h_output_synthesis_psd_state.direct_power_factor, - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor ); -#endif + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = sub(Q31, max_exp_direct); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = sub(Q31, max_exp_diffusion); - if ( coherence_flag ) + IF( coherence_flag ) { - for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - surCohRatio[i] = hSpatParamRendCom->surroundingCoherence[md_idx][i]; + surCohRatio_fx[i] = (Word32) hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]; + move32(); } } - else + ELSE { - set_zero( surCohRatio, hSpatParamRendCom->num_freq_bands ); + set_zero_fx( surCohRatio_fx, hSpatParamRendCom->num_freq_bands ); } + surCohRatio_q_fx = Q15; + move16(); } - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 ) + IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 1 ) ) { -#ifdef IVAS_FLOAT_FIXED - Word32 surCohRatio_fx[CLDFB_NO_CHANNELS_MAX]; - Word16 Q_surCohRatio = Q31; - IF( surCohRatio != NULL ) - { - float max_val = 0.0f; - for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - max_val = max( max_val, surCohRatio[i] ); - } - Word16 a = norm_l( (Word32) max_val ); - if ( a != 0 ) - { - Q_surCohRatio = a; - } - for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - surCohRatio_fx[i] = float_to_fix( surCohRatio[i], Q_surCohRatio ); - } - } - ////////////////////////////////////// to be removed ///////////////////////////////// - IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) - { - IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) - { - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - } - } - ///////////////////////////////////////////////////////////////////////////////////// ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, hDirACRend, st_ivas->hVBAPdata, @@ -4595,77 +4008,13 @@ void ivas_dirac_dec_render_sf_fx( elevation, md_idx, surCohRatio_fx, - Q_surCohRatio, + surCohRatio_q_fx, st_ivas->hCombinedOrientationData->shd_rot_max_order, p_Rmat_fx, hodirac_flag ); - ///////////////////////////////////// to be removed ////////////////////////////////////////////// - IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - - IF( hodirac_flag ) - { - fixedToFloat_arrL( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - ELSE - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////// -#else - ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, - hDirACRend, - st_ivas->hVBAPdata, - st_ivas->hMasa == NULL ? NULL : st_ivas->hMasa->data.band_mapping, - st_ivas->hMasaIsmData, - azimuth, - elevation, - md_idx, - surCohRatio, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat, - hodirac_flag ); -#endif } - else + ELSE { -#ifdef IVAS_FLOAT_FIXED - Word32 surCohRatio_fx[CLDFB_NO_CHANNELS_MAX]; - Word16 Q_surCohRatio = Q31; - IF( surCohRatio != NULL ) - { - float max_val = 0.0f; - for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - max_val = max( max_val, surCohRatio[i] ); - } - Word16 a = norm_l( (Word32) max_val ); - if ( a != 0 ) - { - Q_surCohRatio = a; - } - for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - surCohRatio_fx[i] = float_to_fix( surCohRatio[i], Q_surCohRatio ); - } - } - ////////////////////////////////////// to be removed ///////////////////////////////// - IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) - { - IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) - { - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - } - } - ///////////////////////////////////////////////////////////////////////////////////// ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, hDirACRend, st_ivas->hVBAPdata, @@ -4675,701 +4024,786 @@ void ivas_dirac_dec_render_sf_fx( elevation, md_idx, surCohRatio_fx, - Q_surCohRatio, + surCohRatio_q_fx, 0, NULL, hodirac_flag ); - ///////////////////////////////////// to be removed ////////////////////////////////////////////// - IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } - IF( hodirac_flag ) - { - fixedToFloat_arrL( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - ELSE + IF( L_and( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ), EQ_16( nchan_transport, 2 ) ) ) + { + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + index_slot = add( slot_idx_start, slot_idx ); + offset = i_mult( hSpatParamRendCom->num_freq_bands, index_slot ); + /* CLDFB Analysis*/ + FOR( ch = 0; ch < nchan_transport; ch++ ) { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////// -#else - ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, - hDirACRend, - st_ivas->hVBAPdata, - st_ivas->hMasa == NULL ? NULL : st_ivas->hMasa->data.band_mapping, - st_ivas->hMasaIsmData, - azimuth, - elevation, - md_idx, - surCohRatio, - 0, - NULL, - hodirac_flag ); -#endif - } - } - - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) - { - for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = slot_idx_start + slot_idx; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts_ivas( &( st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][hSpatParamRendCom->num_freq_bands * index_slot] ), - Cldfb_RealBuffer_Temp[ch][slot_idx], - Cldfb_ImagBuffer_Temp[ch][slot_idx], - hSpatParamRendCom->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); + q_temp_cldfb = Q11; + move16(); + cldfbAnalysis_ts_fx_fixed_q( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], + Cldfb_RealBuffer_Temp_fx[ch][slot_idx], + Cldfb_ImagBuffer_Temp_fx[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, + st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); } + q_cldfb = q_temp_cldfb; + move16(); } - if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->ism_mode != ISM_MASA_MODE_MASA_ONE_OBJ ) + IF( L_and( NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ), NE_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) ) { - ivas_omasa_preProcessStereoTransportsForMovedObjects( st_ivas, Cldfb_RealBuffer_Temp, Cldfb_ImagBuffer_Temp, hSpatParamRendCom->num_freq_bands, subframe_idx ); + ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( st_ivas, Cldfb_RealBuffer_Temp_fx, Cldfb_ImagBuffer_Temp_fx, &cldfb_buf_q, hSpatParamRendCom->num_freq_bands, subframe_idx ); } } - for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - index_slot = slot_idx_start + slot_idx; - if ( hDirAC->hConfig->dec_param_estim == TRUE ) + index_slot = add( slot_idx_start, slot_idx ); + IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { md_idx = hSpatParamRendCom->render_to_md_map[index_slot]; + move16(); } - else + ELSE { md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; + move16(); } - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + IF( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) { - for ( ch = 0; ch < nchan_transport; ch++ ) + FOR( ch = 0; ch < nchan_transport; ch++ ) { - mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); - mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); + Copy32( pppQMfFrame_ts_re_fx[ch][slot_idx], Cldfb_RealBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); + Copy32( pppQMfFrame_ts_im_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); } + q_cldfb = Q6; + move16(); } - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && nchan_transport == 2 ) + ELSE IF( L_and( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ), EQ_16( nchan_transport, 2 ) ) ) { - for ( ch = 0; ch < nchan_transport; ch++ ) + FOR( ch = 0; ch < nchan_transport; ch++ ) { - mvr2r( Cldfb_RealBuffer_Temp[ch][slot_idx], Cldfb_RealBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer_Temp[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hSpatParamRendCom->num_freq_bands ); + Copy32( Cldfb_RealBuffer_Temp_fx[ch][slot_idx], Cldfb_RealBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); + Copy32( Cldfb_ImagBuffer_Temp_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands ); } } - else + ELSE { /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) + offset = i_mult( hSpatParamRendCom->num_freq_bands, index_slot ); + FOR( ch = 0; ch < nchan_transport; ch++ ) { - cldfbAnalysis_ts_ivas( &( st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][hSpatParamRendCom->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - hSpatParamRendCom->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); + q_temp_cldfb = Q11; + move16(); + cldfbAnalysis_ts_fx_fixed_q( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], + Cldfb_RealBuffer_fx[ch][0], + Cldfb_ImagBuffer_fx[ch][0], + hSpatParamRendCom->num_freq_bands, + st_ivas->cldfbAnaDec[ch], &q_temp_cldfb ); } + q_cldfb = q_temp_cldfb; + move16(); } /* CNG in DirAC, extra CLDFB ana for CNA*/ - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && !( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) ) + IF( EQ_16( st_ivas->nchan_transport, 1 ) && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && !( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) ) { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - - generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], - st_ivas->hTcBuffer->tc[1], - Cldfb_RealBuffer[1][0], - Cldfb_ImagBuffer[1][0], - index_slot, - st->cna_dirac_flag && st->flag_cna, - ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); + Word16 Q_input = Q11; + move16(); + q_temp_cldfb = Q11; + generate_masking_noise_dirac_ivas_fx( st->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], + st_ivas->hTcBuffer->tc_fx[1], + Cldfb_RealBuffer_fx[1][0], + Cldfb_ImagBuffer_fx[1][0], + index_slot, + st->cna_dirac_flag && st->flag_cna, + ( L_or( EQ_32( st->core_brate, FRAME_NO_DATA ), EQ_32( st->core_brate, SID_2k40 ) ) ) && EQ_16( st->cng_type, FD_CNG ) && st->cng_sba_flag, Q_input, &q_temp_cldfb ); + Scale_sig32( Cldfb_RealBuffer_fx[1][0], CLDFB_NO_CHANNELS_MAX, sub( Q6, q_temp_cldfb ) ); + Scale_sig32( Cldfb_ImagBuffer_fx[1][0], CLDFB_NO_CHANNELS_MAX, sub( Q6, q_temp_cldfb ) ); } /* LFE synthesis */ - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled && !( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && hDirACRend->hOutSetup.num_lfe == 0 ) ) + IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && !hDirACRend->hOutSetup.separateChannelEnabled && !( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && EQ_16( hDirACRend->hOutSetup.num_lfe, 0 ) ) ) { - ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, - Cldfb_RealBuffer, Cldfb_ImagBuffer, - Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], - slot_idx, - md_idx, - nchan_transport ); + ivas_lfe_synth_with_cldfb_fx( st_ivas->hMasa->hMasaLfeSynth, + Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, + Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1], + slot_idx, + md_idx, + nchan_transport, q_cldfb ); } /*-----------------------------------------------------------------* * protoype signal computation *-----------------------------------------------------------------*/ - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 0 ) ) { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirACRend->num_outputs_diff, - hSpatParamRendCom->num_freq_bands, - p_Rmat ); + protoSignalComputation_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + proto_diffuse_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + reference_power_fx, &DirAC_mem.reference_power_q, + slot_idx, nchan_transport, + hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + p_Rmat_fx, q_cldfb ); } - else + ELSE { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirACRend->num_outputs_diff, - hSpatParamRendCom->num_freq_bands, - 0 ); + protoSignalComputation_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + proto_diffuse_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + reference_power_fx, &DirAC_mem.reference_power_q, + slot_idx, nchan_transport, + hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + 0, q_cldfb ); } + + q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; + move16(); + q_proto_diffuse_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q; + move16(); } - else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO ) + ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect ); + protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, + &hDirACRend->proto_frame_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power_fx, + &DirAC_mem.reference_power_q, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect, + q_cldfb ); + + q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; + move16(); + + proto_length = i_mult( 6, hSpatParamRendCom->num_freq_bands ); } - else + ELSE { - switch ( nchan_transport ) + SWITCH( nchan_transport ) { case 11: case 8: case 6: case 4: - protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, hDirACRend->num_outputs_diff, - hSpatParamRendCom->num_freq_bands, - hDirACRend->hoa_decoder, - nchan_transport, - hDirACRend->sba_map_tc ); - break; + protoSignalComputation4_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, + hDirACRend->proto_frame_f_fx, + &hDirACRend->proto_frame_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power_fx, + &DirAC_mem.reference_power_q, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + slot_idx, hDirACRend->num_outputs_diff, + hSpatParamRendCom->num_freq_bands, + hDirACRend->hoa_decoder, + nchan_transport, + hDirACRend->sba_map_tc, q_cldfb ); + proto_length = i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + BREAK; case 2: - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - hDirACRend->hOutSetup.is_loudspeaker_setup, - slot_idx, - hSpatParamRendCom->num_freq_bands, - hDirACRend->masa_stereo_type_detect ); - break; + protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, + &hDirACRend->proto_frame_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power_fx, + &DirAC_mem.reference_power_q, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + hDirACRend->hOutSetup.is_loudspeaker_setup, + slot_idx, + hSpatParamRendCom->num_freq_bands, + hDirACRend->masa_stereo_type_detect, + q_cldfb ); + proto_length = i_mult( 6, hSpatParamRendCom->num_freq_bands ); + BREAK; case 1: - protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirACRend->proto_frame_f, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, - hDirACRend->num_protos_diff, - hSpatParamRendCom->num_freq_bands ); - break; + protoSignalComputation1_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, + hDirACRend->proto_frame_f_fx, + &hDirACRend->proto_frame_f_q, + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power_fx, + &DirAC_mem.reference_power_q, + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + slot_idx, + hDirACRend->num_protos_diff, + hSpatParamRendCom->num_freq_bands, q_cldfb ); + proto_length = i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ); + BREAK; default: return; } + q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; + move16(); } /*-----------------------------------------------------------------* * Compute DirAC parameters at decoder side *-----------------------------------------------------------------*/ - - if ( hDirAC->hConfig->dec_param_estim == TRUE ) + IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { - mvs2s( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], hSpatParamRendCom->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); - mvs2s( &hSpatParamRendCom->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], hSpatParamRendCom->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); - if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) + Copy( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); + Copy( &hSpatParamRendCom->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); + IF( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && EQ_16( st_ivas->hCombinedOrientationData->shd_rot_max_order, 0 ) ) { num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat ); + move16(); + rotateAziEle_DirAC_fx( azimuth, elevation, num_freq_bands, hSpatParamRendCom->num_freq_bands, p_Rmat_fx ); } - hDirACRend->index_buffer_intensity = ( hDirACRend->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + /*hDirACRend->index_buffer_intensity = ( hDirACRend->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1 */ + IF( EQ_16( hDirACRend->index_buffer_intensity, 0 ) ) + { + hDirACRend->index_buffer_intensity = 1; + } + ELSE + { + hDirACRend->index_buffer_intensity = add( sub( hDirACRend->index_buffer_intensity, i_mult( idiv1616( hDirACRend->index_buffer_intensity, DIRAC_NO_COL_AVG_DIFF ), DIRAC_NO_COL_AVG_DIFF ) ), 1 ); /* averaging_length = 32 */ + } index = hDirACRend->index_buffer_intensity; - + move16(); num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + move16(); - computeIntensityVector_dec( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - num_freq_bands, - hDirACRend->buffer_intensity_real[0][index - 1], - hDirACRend->buffer_intensity_real[1][index - 1], - hDirACRend->buffer_intensity_real[2][index - 1] ); - - computeDirectionAngles( hDirACRend->buffer_intensity_real[0][index - 1], - hDirACRend->buffer_intensity_real[1][index - 1], - hDirACRend->buffer_intensity_real[2][index - 1], - num_freq_bands, - azimuth, - elevation ); - - mvr2r( reference_power, &( hDirACRend->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); + computeIntensityVector_dec_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, + q_cldfb, num_freq_bands, + hDirACRend->buffer_intensity_real_fx[0][sub( index, 1 )], + hDirACRend->buffer_intensity_real_fx[1][sub( index, 1 )], + hDirACRend->buffer_intensity_real_fx[2][sub( index, 1 )], + &hDirACRend->q_buffer_intensity_real[sub( index, 1 )] ); + + computeDirectionAngles_fx( hDirACRend->buffer_intensity_real_fx[0][sub( index, 1 )], + hDirACRend->buffer_intensity_real_fx[1][sub( index, 1 )], + hDirACRend->buffer_intensity_real_fx[2][sub( index, 1 )], + hDirACRend->q_buffer_intensity_real[sub( index, 1 )], + num_freq_bands, azimuth, elevation ); + + Copy32( reference_power_fx, &( hDirACRend->buffer_energy_fx[i_mult( sub( index, 1 ), num_freq_bands )] ), num_freq_bands ); + hDirACRend->q_buffer_energy[sub( index, 1 )] = DirAC_mem.reference_power_q; + move16(); - computeDiffuseness( hDirACRend->buffer_intensity_real, hDirACRend->buffer_energy, num_freq_bands, hSpatParamRendCom->diffuseness_vector[md_idx] ); + computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); } -#endif /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ - Word16 scale = 0, temp_len = 0; - if ( hDirACRend->proto_signal_decorr_on == 1 ) + IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) { /* decorrelate prototype frame */ - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_dec_decorr_process_fx(hSpatParamRendCom->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - nchan_transport, - &proto_diffuse_buffer_f_fx [slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff], - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - hDirACRend->num_protos_diff, - hDirACRend->proto_index_diff, - &proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min(4, nchan_transport)], - &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - onset_filter_fx, - hDirACRend->h_freq_domain_decorr_ap_params, - hDirACRend->h_freq_domain_decorr_ap_state); - - - fixedToFloat_arrL(onset_filter_fx, onset_filter, Q31, hSpatParamRendCom->num_freq_bands ); + ivas_dirac_dec_decorr_process_fx( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + &proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff], + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + &proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport )], + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + onset_filter_fx, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); + + q_onset_filter = Q31; + move16(); -#else - ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - nchan_transport, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->proto_index_diff, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport ), - onset_filter, - hDirACRend->h_freq_domain_decorr_ap_params, - hDirACRend->h_freq_domain_decorr_ap_state ); -#endif + v_multc_fixed( onset_filter_fx, 268435456, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); // 268435456 = 0.25 in Q30 + q_onset_filter = sub( add( q_onset_filter, Q30 ), Q31 ); - v_multc( onset_filter, 0.25f, onset_filter, hSpatParamRendCom->num_freq_bands ); - v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); - p_onset_filter = onset_filter_subframe; -#ifdef IVAS_FLOAT_FIXED - floatToFixed_arrL( onset_filter, onset_filter_fx, Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( onset_filter_subframe, onset_filter_subframe_fx, Q30, hSpatParamRendCom->num_freq_bands ); + v_add_fixed( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands, 0 ); // Q30 p_onset_filter_fx = onset_filter_subframe_fx; -#endif } ELSE { -#ifdef IVAS_FLOAT_FIXED - scale = L_norm_arr(hDirACRend->proto_frame_f_fx, proto_length); - Scale_sig32(hDirACRend->proto_frame_f_fx, proto_length, scale); - hDirACRend->proto_frame_f_q = add(hDirACRend->proto_frame_f_q, scale); - ivas_dirac_dec_decorr_process_fx(hSpatParamRendCom->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - nchan_transport, - hDirACRend->proto_frame_f_fx, - hDirACRend->proto_frame_f_q, - hDirACRend->num_protos_diff, - hDirACRend->proto_index_diff, - DirAC_mem.frame_dec_f_fx, - &DirAC_mem.frame_dec_f_q, - onset_filter_fx, - hDirACRend->h_freq_domain_decorr_ap_params, - hDirACRend->h_freq_domain_decorr_ap_state); - - temp_len = DirAC_mem.frame_dec_f_len; - fixedToFloat_arrL(onset_filter_fx, onset_filter, Q31, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff); - me2f_buf(DirAC_mem.frame_dec_f_fx, 31- DirAC_mem.frame_dec_f_q , DirAC_mem.frame_dec_f , temp_len); -#else - ivas_dirac_dec_decorr_process( hSpatParamRendCom->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - nchan_transport, - hDirACRend->proto_frame_f, - hDirACRend->num_protos_diff, - hDirACRend->proto_index_diff, - DirAC_mem.frame_dec_f, - onset_filter, - hDirACRend->h_freq_domain_decorr_ap_params, - hDirACRend->h_freq_domain_decorr_ap_state ); -#endif - - hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; - p_onset_filter = onset_filter; + scale = L_norm_arr( hDirACRend->proto_frame_f_fx, proto_length ); + Scale_sig32( hDirACRend->proto_frame_f_fx, proto_length, scale ); + hDirACRend->proto_frame_f_q = add( hDirACRend->proto_frame_f_q, scale ); + ivas_dirac_dec_decorr_process_fx( hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + nchan_transport, + hDirACRend->proto_frame_f_fx, + hDirACRend->proto_frame_f_q, + hDirACRend->num_protos_diff, + hDirACRend->proto_index_diff, + DirAC_mem.frame_dec_f_fx, + &DirAC_mem.frame_dec_f_q, + onset_filter_fx, + hDirACRend->h_freq_domain_decorr_ap_params, + hDirACRend->h_freq_domain_decorr_ap_state ); -#ifdef IVAS_FLOAT_FIXED hDirACRend->proto_frame_dec_f_fx = DirAC_mem.frame_dec_f_fx; hDirACRend->proto_frame_dec_f_q = DirAC_mem.frame_dec_f_q; + move16(); hDirACRend->proto_frame_dec_f_len = DirAC_mem.frame_dec_f_len; + move16(); p_onset_filter_fx = onset_filter_fx; - floatToFixed_arrL(onset_filter, onset_filter_fx, Q30, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff); -#endif + + scale_sig32( onset_filter_fx, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff, -1 ); + q_onset_filter = Q30; + move16(); } } - else + ELSE { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - set_f( onset_filter_subframe, 1.f, hSpatParamRendCom->num_freq_bands ); - p_onset_filter = onset_filter_subframe; -#ifdef IVAS_FLOAT_FIXED set_l( onset_filter_subframe_fx, ONE_IN_Q30, hSpatParamRendCom->num_freq_bands ); + q_onset_filter = Q30; + move16(); p_onset_filter_fx = onset_filter_subframe_fx; -#endif } - else + ELSE { /* no frequency domain decorrelation: use prototype frame */ - hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; - p_onset_filter = NULL; -#ifdef IVAS_FLOAT_FIXED hDirACRend->proto_frame_dec_f_fx = hDirACRend->proto_frame_f_fx; hDirACRend->proto_frame_dec_f_len = hDirACRend->proto_frame_f_len; + move16(); hDirACRend->proto_frame_dec_f_q = hDirACRend->proto_frame_f_q; + move16(); p_onset_filter_fx = NULL; -#endif } } /*-----------------------------------------------------------------* * output synthesis *-----------------------------------------------------------------*/ - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) { + DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state ); + Word16 diffuse_start = i_mult( i_mult( slot_idx, 2 ), i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) ); + + exp = getScaleFactor32( hDirACRend->proto_frame_dec_f_fx, hDirACRend->proto_frame_dec_f_len ); + scale_sig32( hDirACRend->proto_frame_dec_f_fx, hDirACRend->proto_frame_dec_f_len, exp ); + hDirACRend->proto_frame_dec_f_q = add( hDirACRend->proto_frame_dec_f_q, exp ); + + exp = getScaleFactor32( state->proto_diffuse_buffer_f_fx, diffuse_start ); + scale_sig32( state->proto_diffuse_buffer_f_fx, diffuse_start, exp ); + state->proto_diffuse_buffer_f_q = add( state->proto_diffuse_buffer_f_q, exp ); + /*Compute diffuse prototypes*/ -#ifdef IVAS_FLOAT_FIXED - /* Float to fixed */ - if (hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0) - { - f2me_buf(hDirACRend->proto_frame_dec_f, hDirACRend->proto_frame_dec_f_fx, &hDirACRend->proto_frame_dec_f_q, hDirACRend->proto_frame_dec_f_len); - hDirACRend->proto_frame_dec_f_q = 31 - hDirACRend->proto_frame_dec_f_q; - DIRAC_OUTPUT_SYNTHESIS_STATE *state = &(hDirACRend->h_output_synthesis_psd_state); - f2me_buf(state->proto_power_diff_smooth, state->proto_power_diff_smooth_fx, &state->proto_power_diff_smooth_q, state->proto_power_diff_smooth_len); - state->proto_power_diff_smooth_q = 31 - state->proto_power_diff_smooth_q; - Word16 diffuse_start = slot_idx * 2 * hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE; - state->proto_diffuse_buffer_f_q = 31; - f2me_buf(state->proto_diffuse_buffer_f, state->proto_diffuse_buffer_f_fx, &state->proto_diffuse_buffer_f_q, diffuse_start); - state->proto_diffuse_buffer_f_q = 31 - state->proto_diffuse_buffer_f_q; - } ivas_dirac_dec_compute_diffuse_proto_fx( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); - /* Fixed to float */ - if (hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0) - { - DIRAC_OUTPUT_SYNTHESIS_STATE *state = &(hDirACRend->h_output_synthesis_psd_state); - me2f_buf(state->proto_power_diff_smooth_fx, - 31 - state->proto_power_diff_smooth_q, - state->proto_power_diff_smooth, - state->proto_power_diff_smooth_len); - me2f_buf(state->proto_diffuse_buffer_f_fx, - 31 - state->proto_diffuse_buffer_f_q, - state->proto_diffuse_buffer_f, - state->proto_diffuse_buffer_f_len); - } -#else - ivas_dirac_dec_compute_diffuse_proto( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); -#endif } /*Compute PSDs*/ -#ifdef IVAS_FLOAT_FIXED -#if 1 // TO BE REMOVED - DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; - DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + num_channels_dir = hDirACRend->num_outputs_dir; + move16(); - h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); - h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ) ) + { + num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE; + move16(); + } - Word16 num_channels_dir = hDirACRend->num_outputs_dir; + IF( L_and( h_dirac_output_synthesis_params->use_onset_filters, L_and( NE_16( hDirAC->hConfig->dec_param_estim, TRUE ), NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) ) ) + { + Scale_sig32( h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_params->max_band_decorr, sub( Q31, h_dirac_output_synthesis_state->diffuse_power_factor_q ) ); + h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; + move16(); - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) - { - num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE; + scale_sig32( h_dirac_output_synthesis_state->diffuse_responses_square_fx, num_channels_dir, sub( Q31, h_dirac_output_synthesis_state->diffuse_responses_square_q ) ); + h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; + move16(); + + exp = getScaleFactor32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ) ); + scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), exp ); + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, exp ); + } + + IF( L_and( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ), NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) ) + { + scale_sig32( h_dirac_output_synthesis_state->direct_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub( Q31, h_dirac_output_synthesis_state->direct_power_factor_q ) ); + h_dirac_output_synthesis_state->direct_power_factor_q = Q31; + move16(); + + scale_sig32( h_dirac_output_synthesis_state->diffuse_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub( Q31, h_dirac_output_synthesis_state->diffuse_power_factor_q ) ); + h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; + move16(); + + scale_sig32( h_dirac_output_synthesis_state->direct_responses_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), sub( Q31, h_dirac_output_synthesis_state->direct_responses_q ) ); + h_dirac_output_synthesis_state->direct_responses_q = Q31; + move16(); + + scale_sig32( h_dirac_output_synthesis_state->direct_responses_square_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), sub( Q31, h_dirac_output_synthesis_state->direct_responses_square_q ) ); + h_dirac_output_synthesis_state->direct_responses_square_q = Q31; + move16(); + + scale_sig32( h_dirac_output_synthesis_state->diffuse_responses_square_fx, num_channels_dir, sub( Q31, h_dirac_output_synthesis_state->diffuse_responses_square_q ) ); + h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; + move16(); + + exp = getScaleFactor32( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ) ); + scale_sig32( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), exp ); + h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, exp ); + + exp = getScaleFactor32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ) ); + scale_sig32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), exp ); + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = add( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, exp ); + + exp = getScaleFactor32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ) ); + scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_channels_dir, hSpatParamRendCom->num_freq_bands ), exp ); + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, exp ); + } + + IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) + { + ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fx, + DirAC_mem.reference_power_q, + p_onset_filter_fx, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector_fx[md_idx], + hSpatParamRendCom->q_diffuseness_vector, + hSpatParamRendCom, + hDirACRend, + st_ivas->hCombinedOrientationData->shd_rot_max_order, + p_Rmat_fx, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); + } + ELSE + { + ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fx, + DirAC_mem.reference_power_q, + p_onset_filter_fx, + azimuth, + elevation, + hSpatParamRendCom->diffuseness_vector_fx[md_idx], + hSpatParamRendCom->q_diffuseness_vector, + hSpatParamRendCom, + hDirACRend, + 0, + 0, + st_ivas->hVBAPdata, + hDirACRend->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag, + hDirAC->hConfig->dec_param_estim ); + } + + IF( hDirAC->hConfig->dec_param_estim ) + { + Word16 fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp ); + Word32 flag = 0; + move32(); + fac = shl_o( fac, exp, &flag ); + + IF( LT_16( q_diffuseness_vector, hSpatParamRendCom->q_diffuseness_vector ) ) + { + scale_sig32( hSpatParamRendCom->diffuseness_vector_fx[md_idx], hSpatParamRendCom->num_freq_bands, sub( q_diffuseness_vector, hSpatParamRendCom->q_diffuseness_vector ) ); + hSpatParamRendCom->q_diffuseness_vector = q_diffuseness_vector; + move16(); + } + ELSE + { + scale_sig32( diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands, sub( hSpatParamRendCom->q_diffuseness_vector, q_diffuseness_vector ) ); + q_diffuseness_vector = hSpatParamRendCom->q_diffuseness_vector; + move16(); + } + v_multc_acc_32_16( hSpatParamRendCom->diffuseness_vector_fx[md_idx], fac, diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); + } + + IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + IF( LT_16( q_reference_power_smooth, DirAC_mem.reference_power_q ) ) + { + scale_sig32( reference_power_fx, hSpatParamRendCom->num_freq_bands, sub( q_reference_power_smooth, DirAC_mem.reference_power_q ) ); + DirAC_mem.reference_power_q = q_reference_power_smooth; + move16(); + } + ELSE + { + scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_q, q_reference_power_smooth ) ); + q_reference_power_smooth = DirAC_mem.reference_power_q; + move16(); + } + v_add_fixed( reference_power_fx, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 1 ); + q_reference_power_smooth = sub( q_reference_power_smooth, 1 ); + } } - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) + +#ifdef IVAS_FLOAT_FIXED + ////////////////////////////////// to be removed ///////////////////////////////////// + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ), q_proto_direct_buffer[slot_idx], 2 * nchan_transport * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL32( &proto_diffuse_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), q_proto_diffuse_buffer[slot_idx], 2 * s_min( nchan_transport, hDirACRend->num_outputs_diff ) * hSpatParamRendCom->num_freq_bands ); + } + ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) + { + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ), q_proto_direct_buffer[slot_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); + } + ELSE { - IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) + SWITCH( nchan_transport ) { - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + case 11: + case 8: + case 6: + case 4: + offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[offset], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f[offset], q_proto_direct_buffer[slot_idx], i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); + BREAK; + case 2: + IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) + { + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 3 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 3 ), q_proto_direct_buffer[slot_idx], i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + } + ELSE + { + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ), q_proto_direct_buffer[slot_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); + } + BREAK; + case 1: + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ), q_proto_direct_buffer[slot_idx], i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + BREAK; } } } + IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) + { + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); + } + ELSE + { + me2f_buf( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hSpatParamRendCom->num_freq_bands ); + me2f_buf( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hSpatParamRendCom->num_freq_bands ); + } + } + IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + + IF( hodirac_flag ) + { + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + ELSE + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + IF( !( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) ) + { + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + fixedToFloat_arrL32( st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, st_ivas->cldfbAnaDec[ch]->cldfb_state, Q11, ( st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels ) ); + } + } + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + IF( nchan_transport >= 4 ) + { + fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, 5 * hSpatParamRendCom->num_freq_bands ); + } + } + ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + IF( hDirACRend->masa_stereo_type_detect ) + { + hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + } + ELSE + { + SWITCH( nchan_transport ) + { + case 11: + case 8: + case 6: + case 4: + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); + fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + BREAK; + case 2: + IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); + } + ELSE + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + IF( hDirACRend->masa_stereo_type_detect ) + { + hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + } + me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + BREAK; + case 1: + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); + me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ) ); + fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + BREAK; + } + } - if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) { - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[0][i], hDirACRend->buffer_intensity_real[0][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[1][i], hDirACRend->buffer_intensity_real[1][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[2][i], hDirACRend->buffer_intensity_real[2][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + fixedToFloat_arrL32( &hDirACRend->buffer_energy_fx[i * num_freq_bands], &hDirACRend->buffer_energy[i * num_freq_bands], hDirACRend->q_buffer_energy[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); } - } - else if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) - { - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - } + md_idx = hSpatParamRendCom->render_to_md_map[add( hSpatParamRendCom->slots_rendered, slot_idx )]; + fixedToFloat_arrL32( hSpatParamRendCom->diffuseness_vector_fx[md_idx], hSpatParamRendCom->diffuseness_vector[md_idx], Q30, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); } - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + } + + IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) + { + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - floatToFixed_arrL32( reference_power, reference_power_fix, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands * (min( 4, nchan_transport ) + 1)); + fixedToFloat_arrL( onset_filter_fx, onset_filter, q_onset_filter, hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( onset_filter_subframe_fx, onset_filter_subframe, q_onset_filter, hSpatParamRendCom->num_freq_bands ); + p_onset_filter = onset_filter_subframe; } - else + ELSE { + fixedToFloat_arrL( onset_filter_fx, onset_filter, q_onset_filter, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); + me2f_buf( DirAC_mem.frame_dec_f_fx, 31 - DirAC_mem.frame_dec_f_q, DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_len ); + hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; + p_onset_filter = onset_filter; } } - - if ( h_dirac_output_synthesis_params->use_onset_filters && (hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD)) - { - h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, h_dirac_output_synthesis_params->max_band_decorr ); - - h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - - floatToFixed_arrL(hDirACRend->stack_mem.onset_filter, p_onset_filter_fx, Q30, ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ? hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands : 2 * hSpatParamRendCom->num_freq_bands ); - } - - if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD) + ELSE { - h_dirac_output_synthesis_state->direct_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - - h_dirac_output_synthesis_state->direct_responses_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_q, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - - h_dirac_output_synthesis_state->direct_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->direct_responses_square_q, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - - h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - - h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); - } -#endif - IF ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fix, - DirAC_mem.reference_power_q, - p_onset_filter_fx, - azimuth, - elevation, - hSpatParamRendCom->diffuseness_vector_fx[md_idx], - hSpatParamRendCom->q_diffuseness_vector, - hSpatParamRendCom, - hDirACRend, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat_fx, - st_ivas->hVBAPdata, - hDirACRend->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag, - hDirAC->hConfig->dec_param_estim ); + fixedToFloat_arrL( onset_filter_fx, onset_filter, q_onset_filter, hSpatParamRendCom->num_freq_bands ); + p_onset_filter = onset_filter_subframe; } ELSE { - ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fix, - DirAC_mem.reference_power_q, - p_onset_filter_fx, - azimuth, - elevation, - hSpatParamRendCom->diffuseness_vector_fx[md_idx], - hSpatParamRendCom->q_diffuseness_vector, - hSpatParamRendCom, - hDirACRend, - 0, - 0, - st_ivas->hVBAPdata, - hDirACRend->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag, - hDirAC->hConfig->dec_param_estim ); + hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; + p_onset_filter = NULL; } - -#if 1 - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac_flag ) + } + IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) + { + if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 ) { - IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state ); + me2f_buf( state->proto_power_diff_smooth_fx, + 31 - state->proto_power_diff_smooth_q, + state->proto_power_diff_smooth, + state->proto_power_diff_smooth_len ); + me2f_buf( state->proto_diffuse_buffer_f_fx, + 31 - state->proto_diffuse_buffer_f_q, + state->proto_diffuse_buffer_f, + state->proto_diffuse_buffer_f_len ); + } + } - IF( hodirac_flag ) - { - fixedToFloat_arrL( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - ELSE - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } + if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL( h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); } - if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + else { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL(h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_q, 2*hSpatParamRendCom->num_freq_bands); - fixedToFloat_arrL(h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_q, 2*hSpatParamRendCom->num_freq_bands); - } - else + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 -hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); - } + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); } } - else if ( hDirAC->hConfig->dec_param_estim == TRUE ) + } + else if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - - IF( hodirac_flag ) - { - fixedToFloat_arrL( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - ELSE - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } - } - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->diffuse_power_factor_q ); - } - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, (num_channels_dir) * hSpatParamRendCom->num_freq_bands ); - } - else + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); - } - + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->diffuse_power_factor_q ); } - } - - if ( h_dirac_output_synthesis_params->use_onset_filters && (hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD)) - { - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); - } - - if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD) - { - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - } -#endif -#else - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth, - elevation, - hSpatParamRendCom->diffuseness_vector[md_idx], - hSpatParamRendCom, - hDirACRend, - st_ivas->hCombinedOrientationData->shd_rot_max_order, - p_Rmat, - st_ivas->hVBAPdata, - hDirACRend->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag, - hDirAC->hConfig->dec_param_estim ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, (num_channels_dir) *hSpatParamRendCom->num_freq_bands ); } else { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - azimuth, - elevation, - hSpatParamRendCom->diffuseness_vector[md_idx], - hSpatParamRendCom, - hDirACRend, - 0, - 0, - st_ivas->hVBAPdata, - hDirACRend->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag, - hDirAC->hConfig->dec_param_estim ); - } -#endif - if ( hDirAC->hConfig->dec_param_estim ) - { - float fac = 1.0f / (float) hSpatParamRendCom->subframe_nbslots[subframe_idx]; - v_multc_acc( hSpatParamRendCom->diffuseness_vector[md_idx], fac, diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); + } } + } - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - v_add( reference_power, reference_power_smooth, reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - } + if ( h_dirac_output_synthesis_params->use_onset_filters && ( hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); + } + + if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + } + + if ( hDirAC->hConfig->dec_param_estim ) + { + fixedToFloat_arrL32( diffuseness_vector_fx, diffuseness_vector, q_diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + } + + if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL32( reference_power_smooth_fx, reference_power_smooth, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); } + ////////////////////////////////////////////////////////////////////////////////////// +#endif #ifdef IVAS_FLOAT_FIXED ivas_dirac_dec_output_synthesis_get_interpolator_fx( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); @@ -5386,61 +4820,6 @@ void ivas_dirac_dec_render_sf_fx( size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; -#ifdef MSAN_FIX - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], - Q6, - hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], - Q6, - hSpatParamRendCom->num_freq_bands ); - } -#else - IF( hDirACRend->hOutSetup.is_loudspeaker_setup && hDirACRend->hoa_decoder != NULL ) - { - FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) - { - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - floatToFixed_arrL( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer_fx[ch][slot_idx], - Q6, - hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], - Q6, - hSpatParamRendCom->num_freq_bands ); - } - } - } - ELSE - { -#ifdef MSAN_FIX - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], - Q6, - hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], - Q6, - hSpatParamRendCom->num_freq_bands ); - } -#else - FOR( ch = 0; ch < hDirACRend->num_outputs_dir; ch++ ) - { - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - floatToFixed_arrL( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer_fx[ch][slot_idx], - Q6, - hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], - Q6, - hSpatParamRendCom->num_freq_bands ); - } - } -#endif - } -#endif - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); @@ -5535,12 +4914,8 @@ void ivas_dirac_dec_render_sf_fx( { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - fixedToFloat_arrL( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer[ch][slot_idx], - add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ), - hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], - add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ), - hSpatParamRendCom->num_freq_bands ); + scale_sig32( Cldfb_RealBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ) ) ); + scale_sig32( Cldfb_ImagBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ) ) ); } } } @@ -5550,12 +4925,8 @@ void ivas_dirac_dec_render_sf_fx( { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - fixedToFloat_arrL( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer[ch][slot_idx], - add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ), - hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], - add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ), - hSpatParamRendCom->num_freq_bands ); + scale_sig32( Cldfb_RealBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ) ) ); + scale_sig32( Cldfb_ImagBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, sub( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, 33 ) ) ) ); } } } @@ -5564,7 +4935,6 @@ void ivas_dirac_dec_render_sf_fx( else { #ifdef IVAS_FLOAT_FIXED - Word16 q_reference_power_smooth; Word16 size, size_ho, q_Cldfb; size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; @@ -5595,31 +4965,6 @@ void ivas_dirac_dec_render_sf_fx( #endif #ifdef IVAS_FLOAT_FIXED -#ifdef MSAN_FIX - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], - Q6, - hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], - Q6, - hSpatParamRendCom->num_freq_bands ); - } -#else - FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) - { - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - floatToFixed_arrL( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer_fx[ch][slot_idx], - Q6, - hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], - Q6, - hSpatParamRendCom->num_freq_bands ); - } - } -#endif - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); @@ -5776,12 +5121,8 @@ void ivas_dirac_dec_render_sf_fx( { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { - fixedToFloat_arrL( Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_RealBuffer[ch][slot_idx], - q_Cldfb, - hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( Cldfb_ImagBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], - q_Cldfb, - hSpatParamRendCom->num_freq_bands ); + scale_sig32( Cldfb_RealBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, q_Cldfb ) ); + scale_sig32( Cldfb_ImagBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, q_Cldfb ) ); } } #endif @@ -5795,34 +5136,6 @@ void ivas_dirac_dec_render_sf_fx( #ifdef IVAS_FLOAT_FIXED //////////////////////////////////////////////// FLOAT TO FIXED ///////////////////////////////////////////// -#ifdef MSAN_FIX - Word16 idx1, idx2, idx3; - for ( idx1 = 0; idx1 < hDirACRend->hOutSetup.nchan_out_woLFE; idx1++ ) - { - for ( idx2 = 0; idx2 < hSpatParamRendCom->subframe_nbslots[subframe_idx]; idx2++ ) - { - for ( idx3 = 0; idx3 < hSpatParamRendCom->num_freq_bands; idx3++ ) - { - Cldfb_RealBuffer_fx[idx1][idx2][idx3] = floatToFixed( Cldfb_RealBuffer[idx1][idx2][idx3], Q6 ); - Cldfb_ImagBuffer_fx[idx1][idx2][idx3] = floatToFixed( Cldfb_ImagBuffer[idx1][idx2][idx3], Q6 ); - } - } - } -#else - for (int idx1 = 0; idx1 < MAX_OUTPUT_CHANNELS; idx1++) - { - for (int idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++) - { - for (int idx3 = 0; idx3 < CLDFB_NO_CHANNELS_MAX; idx3++) - { - Cldfb_RealBuffer_fx[idx1][idx2][idx3] = floatToFixed(Cldfb_RealBuffer[idx1][idx2][idx3], Q6); - Cldfb_ImagBuffer_fx[idx1][idx2][idx3] = floatToFixed(Cldfb_ImagBuffer[idx1][idx2][idx3], Q6); - - } - } - } -#endif - Word32 output_buf_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { @@ -5967,9 +5280,9 @@ void ivas_dirac_dec_render_sf_fx( Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q ); - FOR ( idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) + FOR ( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) { - FOR ( idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ ) + FOR ( Word16 idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ ) { Scale_sig32(Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); Scale_sig32(Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); @@ -6012,11 +5325,6 @@ void ivas_dirac_dec_render_sf_fx( #if 1 // TODOD: remove Fixed to float fixedToFloat_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); - for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) - { - fixedToFloat_arrL( Cldfb_RealBuffer_Binaural_fx[ch][i], Cldfb_RealBuffer_Binaural[ch][i], CLDFB_NO_CHANNELS_MAX, Q6 ); - fixedToFloat_arrL( Cldfb_ImagBuffer_Binaural_fx[ch][i], Cldfb_ImagBuffer_Binaural[ch][i], CLDFB_NO_CHANNELS_MAX, Q6 ); - } #endif } } @@ -7352,4 +6660,4 @@ void ivas_dirac_dec_render_sf( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 25f5b5c26..36bc0fef2 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -461,6 +461,8 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( tmp_fx = hDirACRend->diffuse_response_function_fx[ch_idx]; dirac_output_synthesis_state->diffuse_responses_square_fx[ch_idx] = L_deposit_h( mult( tmp_fx, tmp_fx ) ); + dirac_output_synthesis_state->diffuse_responses_square_q = Q31; + move16(); /*TODO : remove floating code*/ dirac_output_synthesis_state->diffuse_responses_square[ch_idx] = fixedToFloat( dirac_output_synthesis_state->diffuse_responses_square_fx[ch_idx], Q31 ); } diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 6ae3e7f7d..f52a9f0b8 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1729,7 +1729,7 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx = hDirAC_mem->proto_direct_buffer_f_fx; hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx = hDirAC_mem->proto_diffuse_buffer_f_fx; hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len = hDirAC_mem->proto_diffuse_buffer_f_len; - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = hDirAC_mem->proto_diffuse_buffer_f_q; + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = Q31; #endif /* Gains/power factors*/ hDirAC_mem->direct_power_factor = NULL; -- GitLab From 0327bd75163e05387238c99321995a007cf4fc65 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 14 May 2024 19:56:15 +0530 Subject: [PATCH 041/101] Fix for msan crashes observed for mc streams --- lib_dec/acelp_core_dec_ivas_fx.c | 8 ++++++ lib_dec/ivas_dirac_dec.c | 4 +++ lib_dec/ivas_jbm_dec.c | 29 ++++++++++++++++++++ lib_dec/ivas_mc_param_dec.c | 9 ++++++ lib_dec/ivas_mct_dec.c | 8 +++--- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 8 ++++++ lib_dec/ivas_stat_dec.h | 3 ++ lib_dec/ivas_stereo_dft_dec_fx.c | 3 ++ lib_rend/ivas_dirac_dec_binaural_functions.c | 20 ++++++-------- lib_rend/ivas_dirac_decorr_dec.c | 6 ++-- lib_rend/ivas_dirac_rend.c | 14 ++++++++++ lib_rend/ivas_objectRenderer_hrFilt.c | 3 ++ lib_rend/ivas_reverb.c | 7 +++++ 13 files changed, 104 insertions(+), 18 deletions(-) diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index d45b381a9..810a04adc 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -86,14 +86,22 @@ ivas_error acelp_core_dec_ivas_fx( Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ +#ifdef MSAN_FIX + Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )] = { 0 }; /* A(q) quantized for the 4 subframes */ +#else Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ +#endif Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ Word32 enr_q_fx; /* E information for FER protection */ Word16 tmp_noise_fx; /* Long term temporary noise energy */ Word16 Es_pred_fx; /* predicted scaled innov. energy Q8 */ Word16 FEC_pitch_fx; /* FEC pitch */ +#ifdef MSAN_FIX + Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )] = { 0 }; /* excitation buffer */ +#else Word16 old_bwe_exc_fx[( ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 )]; /* excitation buffer */ +#endif Word16 *bwe_exc_fx; /* Excitation for SWB TBE */ int16_t i, j, int_fs; int16_t tc_subfr; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index b7ae00511..cbb08a046 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3399,7 +3399,11 @@ void ivas_dirac_dec_render_fx( Word16 temp = 0; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; +#ifdef MSAN_FIX + float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k] = { 0 }; // VE2SB: TBV +#else float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV +#endif Word32 *output_f_local_fx[MAX_OUTPUT_CHANNELS]; Word32 output_f_local_buff_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 339d4009d..1400daddf 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -157,6 +157,9 @@ ivas_error ivas_jbm_dec_tc( #endif #endif } +#ifdef MSAN_FIX + st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec(st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); +#endif } /*----------------------------------------------------------------* @@ -1264,14 +1267,24 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } +#ifdef MSAN_FIX + FOR( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 ); +#else Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0]), hCPE->q_prev_synth_fx - 11); +#endif ivas_sba_dirac_stereo_dec_fx(st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0); FOR(i = 0; i < 2; i++) { Scale_sig32(p_output_fx[sba_ch_idx + i], L_FRAME48k, negate(s)); } +#ifdef MSAN_FIX + FOR( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx ); +#else Scale_sig32(&hCPE->prev_synth_fx[0][0], sizeof(hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); +#endif scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -2166,13 +2179,23 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } +#ifdef MSAN_FIX + FOR ( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 ); +#else Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0]), hCPE->q_prev_synth_fx - 11); +#endif ivas_sba_dirac_stereo_dec_fx(st_ivas, p_output_fx, output_frame, 1); FOR(i = 0; i < 2; i++) { Scale_sig32(p_output_fx[i], L_FRAME48k, negate(s)); } +#ifdef MSAN_FIX + FOR ( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_fx2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx); +#else Scale_sig32(&hCPE->prev_synth_fx[0][0], sizeof(hCPE->prev_synth_fx) / sizeof(hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); +#endif // MSAN_FIX scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -4233,6 +4256,9 @@ ivas_error ivas_jbm_dec_render( } } +#ifdef MSAN_FIX + st_ivas->hTcBuffer->no_channels = st_ivas->hTcBuffer->nchan_buffer_full; +#endif // MSAN_FIX /*----------------------------------------------------------------* * Update combined orientation access index *----------------------------------------------------------------*/ @@ -8084,6 +8110,9 @@ ivas_error ivas_jbm_dec_tc_buffer_open( hTcBuffer->tc_fx[ch_idx] = NULL; #endif } +#ifdef MSAN_FIX + st_ivas->hTcBuffer->no_channels = hTcBuffer->nchan_transport_internal; +#endif // MSAN_FIX } else { diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 7474cd375..033e4ad46 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -3619,12 +3619,21 @@ void ivas_param_mc_dec_render_fx( /* set everything to zero that will not be decoded */ nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; nbands_to_zero = sub(hParamMC->num_freq_bands , nband_synth); +#ifdef MSAN_FIX + FOR ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) +#else FOR ( ch = 0; ch < nchan_out_init; ch++ ) +#endif { FOR ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) { +#ifdef MSAN_FIX + set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX); + set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][0] ), 0, CLDFB_NO_CHANNELS_MAX); +#else set32_fx( &( Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); set32_fx( &( Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth] ), 0, nbands_to_zero ); +#endif } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index ea952616c..0aa255316 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1443,9 +1443,9 @@ ivas_error ivas_mc_dec_config( if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) { - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport_old * nchan_transport_old )); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, s_min(hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_len, nchan_transport_old * nchan_out_cov) ); + floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); } } for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) @@ -1518,9 +1518,9 @@ ivas_error ivas_mc_dec_config( { if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport_old * nchan_transport_old) ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, s_min(hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_len, nchan_transport_old * nchan_out_cov) ); + fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); } } for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 2d0aa25e5..7339afde7 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1271,7 +1271,11 @@ void ivas_sba_dirac_stereo_dec_fx( #endif IF( hSCE != NULL ) { +#ifdef MSAN_FIX + Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2(st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS),-( Q11 - hCPE->hStereoDft->q_dft ) ); +#else Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); +#endif // MSAN_FIX hSCE->q_prev_hb_synth_fx = hCPE->hStereoDft->q_dft; } @@ -1384,7 +1388,11 @@ void ivas_sba_dirac_stereo_dec_fx( #endif IF( hSCE != NULL ) { +#ifdef MSAN_FIX + Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2(st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); +#else Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); +#endif // MSAN_FIX hSCE->q_prev_hb_synth_fx = Q11; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 43c23da67..246d2b1fb 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1414,6 +1414,9 @@ typedef struct decoder_tc_buffer_structure Word32 *tc_buffer_fx; /* the buffer itself */ Word16 tc_buff_len;/*stores memory length of tc buffer*/ Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc Q11 for ivas */ // VE2SB: TBV +#ifdef MSAN_FIX + Word16 no_channels; /*Stores no of channels in tc_fx with values*/ +#endif Word16 q_tc_fx; #endif TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index c76c8ce0e..03bb0f511 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -97,6 +97,9 @@ void stereo_dft_dec_reset_fx( { Word16 i; Word16 j, b; +#ifdef MSAN_FIX + set_zero_fx( hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); +#endif /*Configuration*/ set_s( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index a36599cf0..04e02ca10 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1138,13 +1138,9 @@ static void ivas_dirac_dec_binaural_internal( nchan_tc = add( nchan_tc, ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); #endif - IF( st_ivas->hTcBuffer->tc[nchan_transport] ) - FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[1]->no_channels * st_ivas->cldfbAnaDec[1]->no_col; ind++ ) - { - st_ivas->hTcBuffer->tc_fx[nchan_transport][ind] = (Word32) ( st_ivas->hTcBuffer->tc[nchan_transport][ind] * ( 1 << q_input ) ); - } -#ifdef MSAN_FIX_ - FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#ifdef MSAN_FIX + // FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) + FOR( Word16 cha = 0; cha < st_ivas->hTcBuffer->no_channels; cha++ ) #else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) #endif @@ -1156,8 +1152,9 @@ static void ivas_dirac_dec_binaural_internal( } } -#ifdef MSAN_FIX_ - FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#ifdef MSAN_FIX + // FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) + FOR( Word16 cha = 0; cha < MAX_INTERN_CHANNELS; cha++ ) #else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) #endif @@ -1559,8 +1556,9 @@ static void ivas_dirac_dec_binaural_internal( } fixedToFloat_arrL( hDiracDecBin->frameMeanDiffuseness_fx, hDiracDecBin->frameMeanDiffuseness, 29, CLDFB_NO_CHANNELS_MAX ); -#ifdef MSAN_FIX_ - FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#ifdef MSAN_FIX + // FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) + FOR( Word16 cha = 0; cha < MAX_INTERN_CHANNELS; cha++ ) #else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) #endif diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index b6511652a..1e2fc6930 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -1274,7 +1274,7 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); // scaling to get max precision for aux_buffer values// -#ifdef MSAN_FIX_ +#ifdef MSAN_FIX q_shift = Q31; move16(); FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -1362,7 +1362,7 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub(31 , h_freq_domain_decorr_ap_state->q_direct_energy_smooth); // this step is b/c we are left shifting frame_dec_fx at the end of below for loop/ -#ifdef MSAN_FIX_ +#ifdef MSAN_FIX q_shift = Q31; move16(); FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) @@ -1439,7 +1439,7 @@ void ivas_dirac_dec_decorr_process_fx( *-----------------------------------------------------------------*/ q_shift = q_input_frame - q_frame_f; -#ifdef MSAN_FIX_ +#ifdef MSAN_FIX // scaling it to input q FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index f52a9f0b8..ecd3571db 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1560,6 +1560,9 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } +#ifdef MSAN_FIX + set_zero_fx( hDirAC_mem->frame_dec_f_fx, 2 * num_outputs_diff * num_freq_bands ); +#endif hDirAC_mem->frame_dec_f_len = 2 * num_outputs_diff * num_freq_bands; #endif } @@ -1802,6 +1805,9 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } +#ifdef MSAN_FIX + set_zero_fx( hDirAC_mem->onset_filter_fx, num_outputs_diff * num_freq_bands ); +#endif #endif } } @@ -1833,6 +1839,9 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } +#ifdef MSAN_FIX + set_zero_fx( hDirAC_mem->onset_filter_fx, 2 * num_freq_bands ); +#endif #endif } } @@ -4365,8 +4374,13 @@ void ivas_dirac_dec_compute_diffuse_proto_fx( Word16 new_diff_e = s_max( diff_e, old_diff_e ); Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx, diffuse_start, sub( old_diff_e, new_diff_e ) ); +#ifdef MSAN_FIX + Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx + diffuse_start, + sub(2*num_freq_bands_diff*hDirACRend->hOutSetup.nchan_out_woLFE, diffuse_start ), sub( diff_e, new_diff_e ) ); +#else Scale_sig32( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_fx + diffuse_start, sub( h_dirac_output_synthesis_state->proto_diffuse_buffer_f_len, diffuse_start ), sub( diff_e, new_diff_e ) ); +#endif h_dirac_output_synthesis_state->proto_diffuse_buffer_f_q = sub( 31, new_diff_e ); return; diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index bf59d928e..681a407bb 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -683,6 +683,9 @@ static void GenerateITD_fx( Word16 num_az_idx, num_ev_idx; Word16 BM_idx[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; Word16 itdMod_e; +#ifdef MSAN_FIX + set16_fx( AzIdx, 0, HRTF_MODEL_BSPLINE_NUM_COEFFS ); +#endif // MSAN_FIX /* Wrap the requested azimuth to the range of the BSplines */ azim_fx = L_add( azim_fx, model->azimKSeq_fx[0] ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 4a2e6b7ce..ef477db36 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -2487,9 +2487,16 @@ ivas_error ivas_reverb_open_fx( pFft_wf_filter_ch1_fx[i][0] = L_shl_sat(pFft_wf_filter_ch1_fx[i][0] ,8); pFft_wf_filter_ch1_fx[i][1] = L_shl_sat(pFft_wf_filter_ch1_fx[i][1] ,8); } +#ifdef MSAN_FIX + FOR( int i = 0; i < shl(sub(nr_fc_fft_filter, 1), 1); i++ ) + { + pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 ); /*Scaling signal down to 30*/ + } +#else FOR (int i = 0; i < RV_FILTER_MAX_FFT_SIZE; i++) { pTime_window_fx[i] = L_shr( pTime_window_fx[i], 1 );/*Scaling signal down to 30*/ } +#endif // MSAN_FIX Word32* pHrtf_inter_aural_coherence_const = (Word32*)malloc(nr_fc_fft_filter * sizeof(Word32)); FOR (int i = 0; i < nr_fc_fft_filter; i++) { -- GitLab From eefded5e45e4eb5b4db6750ddffc5f7a4172f169 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 14 May 2024 21:46:50 +0530 Subject: [PATCH 042/101] High_MLD_and_LTV_crash_fix_rend_cleanup [x] Fix for the high MLD issue seen in MASA [x] Fix for LTV assertions (MASA + 4ISM) [x] Cleanup of renderer code --- lib_com/gs_inact_switching_fx.c | 14 +- lib_dec/gain_dec_fx.c | 6 +- lib_dec/ivas_dirac_dec.c | 4 +- lib_rend/ivas_crend.c | 36 +-- lib_rend/ivas_dirac_output_synthesis_dec.c | 12 +- lib_rend/ivas_mcmasa_ana.c | 60 +--- lib_rend/ivas_prot_rend.h | 6 +- lib_rend/ivas_reverb_fft_filter.c | 4 +- lib_rend/ivas_stat_rend.h | 28 +- lib_rend/lib_rend.c | 331 +++++++++++++++++---- 10 files changed, 339 insertions(+), 162 deletions(-) diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c index 5a9c9a62f..a0150c20b 100644 --- a/lib_com/gs_inact_switching_fx.c +++ b/lib_com/gs_inact_switching_fx.c @@ -257,9 +257,9 @@ void Inac_switch_ematch_ivas_fx( { FOR(j = 0; j < 8; j++) { - L_tmp = L_mult(*pt_exc, ftmp); /* Q_exc*Q0 -> Q(Q_exc+1) */ - L_tmp = L_shl(L_tmp, add(exp, 15)); /* Q(Q_exc+1) -> Q(16+Q_exc)*/ - *pt_exc = round_fx(L_tmp); + L_tmp = L_mult0(*pt_exc, ftmp); + L_tmp = L_shl(L_tmp, add(exp, 15)); /* Q(Q_exc) -> Q(15+Q_exc)*/ + *pt_exc = round_fx(L_tmp); /*Q_exc - 1*/ pt_exc++; } } @@ -267,15 +267,17 @@ void Inac_switch_ematch_ivas_fx( { FOR(j = 0; j < 16; j++) { - L_tmp = L_mult(*pt_exc,ftmp); /* Q_exc*Q0 -> Q(Q_exc+1) */ - L_tmp = L_shl(L_tmp, add(exp,15)); /* Q(Q_exc+1) -> Q(16+Q_exc)*/ - *pt_exc = round_fx(L_tmp); /*Q_exc*/ + L_tmp = L_mult0(*pt_exc,ftmp); + L_tmp = L_shl(L_tmp, add(exp,15)); /* Q(Q_exc) -> Q(15+Q_exc)*/ + *pt_exc = round_fx(L_tmp); /*Q_exc - 1*/ pt_exc++; } } } /* Going back to time */ + Scale_sig( dct_exc_tmp, 240, 1 ); // Q_exc + Scale_sig( exc2, 240, 1 ); // Q_exc edct_16fx(dct_exc_tmp, exc2, L_frame, 5, element_mode); } diff --git a/lib_dec/gain_dec_fx.c b/lib_dec/gain_dec_fx.c index 6b87bd222..0c686ad6d 100644 --- a/lib_dec/gain_dec_fx.c +++ b/lib_dec/gain_dec_fx.c @@ -320,9 +320,9 @@ void gain_dec_tc_ivas_fx( *-----------------------------------------------------------------*/ /* *gain_code *= gcode0;*/ - L_tmp = L_shl(L_mult(wgain_code, gcode0_fx), 1); /* Q12*Q0+1 -> Q14 */ - *gain_code_fx= L_shl(L_tmp, add(exp_gcode0, 2)); - move32(); /* Q14 -> Q16 */ + L_tmp = L_mult(wgain_code, gcode0_fx); /* Q12*Q0 -> Q13 */ + *gain_code_fx= L_shl(L_tmp, add(exp_gcode0, 3)); + move32(); /* Q13 -> Q16 */ /**norm_gain_code = *gain_code / *gain_inov;*/ expg = sub(norm_s(*gain_inov_fx),1); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index cbb08a046..82b21930d 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -4563,7 +4563,7 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ), q_proto_direct_buffer[slot_idx], 2 * nchan_transport * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( &proto_diffuse_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), q_proto_diffuse_buffer[slot_idx], 2 * s_min( nchan_transport, hDirACRend->num_outputs_diff ) * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL32( &proto_diffuse_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), q_proto_diffuse_buffer[slot_idx], 2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); } ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { @@ -4861,7 +4861,7 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - 2 * s_min( nchan_transport, hDirACRend->num_outputs_diff ) * hSpatParamRendCom->num_freq_bands ); + 2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); } floatToFixed_arrL( p_onset_filter, p_onset_filter_fx, Q30, hSpatParamRendCom->num_freq_bands ); // Q30 diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 69b758d40..5d23db160 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -2703,71 +2703,71 @@ ivas_error ivas_rend_openCrend( void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend ) { - int16_t i; + Word16 i; CREND_HANDLE hCrend; - if ( pCrend == NULL || *pCrend == NULL ) + IF ( pCrend == NULL || *pCrend == NULL ) { return; } - if ( ( *pCrend )->hHrtfCrend != NULL ) + IF ( ( *pCrend )->hHrtfCrend != NULL ) { ivas_hrtf_close( &( *pCrend )->hHrtfCrend ); } { hCrend = ( *pCrend )->hCrend; - if ( hCrend != NULL ) + IF ( hCrend != NULL ) { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { - if ( hCrend->freq_buffer_re_fx[i] != NULL ) + IF ( hCrend->freq_buffer_re_fx[i] != NULL ) { free( hCrend->freq_buffer_re_fx[i] ); hCrend->freq_buffer_re_fx[i] = NULL; } - if ( hCrend->freq_buffer_im_fx[i] != NULL ) + IF ( hCrend->freq_buffer_im_fx[i] != NULL ) { free( hCrend->freq_buffer_im_fx[i] ); hCrend->freq_buffer_im_fx[i] = NULL; } } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + FOR ( i = 0; i < BINAURAL_CHANNELS; i++ ) { - if ( hCrend->prev_out_buffer_fx[i] != NULL ) + IF ( hCrend->prev_out_buffer_fx[i] != NULL ) { free( hCrend->prev_out_buffer_fx[i] ); hCrend->prev_out_buffer_fx[i] = NULL; } } -#ifdef IVAS_FLOAT_FIXED - if ( hCrend->lfe_delay_line_fx != NULL ) +#ifdef IVAS_FLOAT_FIXED_s + IF ( hCrend->lfe_delay_line_fx != NULL ) { free( hCrend->lfe_delay_line_fx ); hCrend->lfe_delay_line_fx = NULL; } #endif - if ( hCrend->lfe_delay_line_fx != NULL ) + IF ( hCrend->lfe_delay_line_fx != NULL ) { free( hCrend->lfe_delay_line_fx); hCrend->lfe_delay_line_fx = NULL; } - if ( hCrend->freq_buffer_re_diffuse_fx != NULL ) + IF ( hCrend->freq_buffer_re_diffuse_fx != NULL ) { free( hCrend->freq_buffer_re_diffuse_fx ); hCrend->freq_buffer_re_diffuse_fx = NULL; } - if ( hCrend->freq_buffer_im_diffuse_fx != NULL ) + IF ( hCrend->freq_buffer_im_diffuse_fx != NULL ) { free( hCrend->freq_buffer_im_diffuse_fx ); hCrend->freq_buffer_im_diffuse_fx = NULL; } - if ( hCrend->hTrack != NULL ) + IF ( hCrend->hTrack != NULL ) { free( hCrend->hTrack ); hCrend->hTrack = NULL; @@ -2775,14 +2775,14 @@ void ivas_rend_closeCrend( ivas_reverb_close( &hCrend->hReverb ); - if ( hCrend->reflections != NULL ) + IF ( hCrend->reflections != NULL ) { - if ( hCrend->reflections->closest_ch_idx != NULL ) + IF ( hCrend->reflections->closest_ch_idx != NULL ) { free( hCrend->reflections->closest_ch_idx ); hCrend->reflections->closest_ch_idx = NULL; } - if ( hCrend->reflections->circ_buffers != NULL ) + IF ( hCrend->reflections->circ_buffers != NULL ) { free( hCrend->reflections->circ_buffers ); hCrend->reflections->circ_buffers = NULL; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 36bc0fef2..1479d8885 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -2593,16 +2593,16 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( // ((p_gains_diff_q, p_proto_diff_q) >> Q1) -> (p_gains_diff_q + p_proto_diff_q - 32) output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] = - L_shr( L_add( output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]], - Mpy_32_32( g, ( *( p_proto++ ) ) ) ), - Q1 ); + L_add( output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]], + L_shr( Mpy_32_32( g, ( *( p_proto++ ) ) ) , + Q1)); move32(); // ((p_gains_diff_q, p_proto_diff_q) >> Q1) -> (p_gains_diff_q + p_proto_diff_q - 32) output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] = - L_shr( L_add( output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]], - Mpy_32_32( g, ( *( p_proto++ ) ) ) ), - Q1 ); + L_add( output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]], + L_shr( Mpy_32_32( g, ( *( p_proto++ ) ) ), + Q1)); move32(); } } diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index 7ca34554e..bf57b3fe7 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -87,11 +87,13 @@ void ivas_mcmasa_param_est_ana_fx( const Word16 input_frame, /* i : Input frame size */ const Word16 nchan_inp /* i : Number of input channels */ ); -#endif // IVAS_FLOAT_FIXED - +#else void ivas_mcmasa_param_est_ana( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); +#endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void ivas_mcmasa_dmx( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_inp ); +#endif static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], const int16_t freq, const int16_t N, CovarianceMatrix *COVls ); @@ -236,21 +238,6 @@ ivas_error ivas_mcmasa_ana_open( /* intensity 3-dim */ FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { -#if 1/*TODO: To be removed later*/ - if ( ( hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); - } - - for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - if ( ( hMcMasa->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); - } - set_zero( hMcMasa->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); - } -#endif IF( ( hMcMasa->direction_vector_m_fx[i] = (Word32 **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); @@ -282,13 +269,6 @@ ivas_error ivas_mcmasa_ana_open( { FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { -#if 1/*TODO: To be removed later*/ - if ( ( hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); - } - set_zero( hMcMasa->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); -#endif IF ( ( hMcMasa->buffer_intensity_real_fx[i][j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof(Word32) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); @@ -300,13 +280,6 @@ ivas_error ivas_mcmasa_ana_open( FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { -#if 1/*TODO: To be removed later*/ - if ( ( hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); - } - set_zero( hMcMasa->buffer_intensity_real_vert[j], MASA_FREQUENCY_BANDS ); -#endif IF ( ( hMcMasa->buffer_intensity_real_vert_fx[j] = (Word32 *) malloc( MASA_FREQUENCY_BANDS * sizeof(Word32) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); @@ -315,9 +288,6 @@ ivas_error ivas_mcmasa_ana_open( } set16_fx(hMcMasa->buffer_intensity_real_vert_q, 31, DIRAC_NO_COL_AVG_DIFF ); -#if 1/*TODO: To be removed later*/ - set_zero( hMcMasa->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); -#endif set_zero_fx( hMcMasa->buffer_energy_fx, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); set16_fx(hMcMasa->buffer_energy_q, 31, DIRAC_NO_COL_AVG_DIFF ); @@ -375,14 +345,11 @@ ivas_error ivas_mcmasa_ana_open( } } -#if 1/*TODO: To be removed later(floating point initialization)*/ - hMcMasa->prevMultiChEne = 0.0f; - hMcMasa->prevDownmixEne = 0.0f; - hMcMasa->prevEQ = 1.0f; -#endif hMcMasa->prevMultiChEne_fx = 0; hMcMasa->prevDownmixEne_fx = 0; - hMcMasa->prevEQ_fx = 32767; + hMcMasa->prevEQ_fx = 2147483647; + hMcMasa->prevEQ_e = 0; + input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); FOR ( i = 0; i < input_frame; i++ ) { @@ -675,7 +642,7 @@ void ivas_mcmasa_ana_close( free( ( *hMcMasa )->buffer_intensity_real_vert_fx[j] ); ( *hMcMasa )->buffer_intensity_real_vert_fx[j] = NULL; } -#if 1/*TODO: To be removed later( freeing float buffer)*/ +#if 0/*TODO: To be removed later( freeing float buffer)*/ FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { FOR ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) @@ -809,7 +776,7 @@ void ivas_mcmasa_ana_fx( return; } -#endif +#else void ivas_mcmasa_ana( MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ float data_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -844,6 +811,7 @@ void ivas_mcmasa_ana( return; } +#endif /*--------------------------------------------------------------------------* @@ -1404,7 +1372,7 @@ void ivas_mcmasa_param_est_ana_fx( } return; } -#endif // IVAS_FLOAT_FIXED +#else // IVAS_FLOAT_FIXED void ivas_mcmasa_param_est_ana( MCMASA_ANA_HANDLE hMcMasa, /* i : McMASA analyzer structure */ float data_f[][L_FRAME48k], /* i : Audio frame in MC-format */ @@ -1807,8 +1775,9 @@ void ivas_mcmasa_param_est_ana( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /* Compute downmix */ static void ivas_mcmasa_dmx( MCMASA_ANA_HANDLE hMcMasa, @@ -1900,8 +1869,7 @@ static void ivas_mcmasa_dmx( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void ivas_mcmasa_dmx_fx( MCMASA_ANA_HANDLE hMcMasa, Word32 data_f_fx[][L_FRAME48k], diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index a3e349c7b..91e724491 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1993,11 +1993,11 @@ int16_t ivas_reverb_fft_filter_init( ivas_reverb_fft_filter_t *fft_filter, const int16_t fft_size ); -#endif void ivas_reverb_fft_filter_ComplexMul( ivas_reverb_fft_filter_t *fft_filter, float *buffer ); +#endif void ivas_reverb_fft_filter_CrossMix( float *buffer0, @@ -2632,8 +2632,7 @@ void ivas_mcmasa_ana_fx( const Word16 nchan_transport, /* i : Number of transport channels */ const Word16 nchan_inp /* i : Number of input channels */ ); -#endif // IVAS_FLOAT_FIXED - +#else void ivas_mcmasa_ana( MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ float data_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ @@ -2641,6 +2640,7 @@ void ivas_mcmasa_ana( const int16_t nchan_transport, /* i : Number of transport channels */ const int16_t nchan_inp /* i : Number of input channels */ ); +#endif // IVAS_FLOAT_FIXED void ivas_mcmasa_ana_close( MCMASA_ANA_HANDLE *hMcMasa /* i/o: analysis McMASA handle */ diff --git a/lib_rend/ivas_reverb_fft_filter.c b/lib_rend/ivas_reverb_fft_filter.c index 47b529265..2d029c04c 100644 --- a/lib_rend/ivas_reverb_fft_filter.c +++ b/lib_rend/ivas_reverb_fft_filter.c @@ -651,7 +651,7 @@ void ivas_reverb_fft_filter_ComplexMul_fx( return; } -#endif +#else /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_fft_filter_ComplexMul() * @@ -683,7 +683,7 @@ void ivas_reverb_fft_filter_ComplexMul( return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR() * diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index aec0c3ebc..fef1c9987 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1295,7 +1295,9 @@ typedef struct ivas_reverb_fft_filter_t { Word16 fft_size; Word32 fft_spectrum_fx[RV_FILTER_MAX_FFT_SIZE]; +#ifndef IVAS_FLOAT_FIXED float fft_spectrum[RV_FILTER_MAX_FFT_SIZE]; +#endif } ivas_reverb_fft_filter_t; @@ -2283,10 +2285,10 @@ typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_ typedef struct ivas_mcmasa_ana_data_structure { - int16_t nbands; + Word16 nbands; /* CLDFB analysis */ - int16_t num_Cldfb_instances; + Word16 num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MCMASA_MAX_ANA_CHANS]; /* DirAC parameter estimation */ @@ -2294,7 +2296,9 @@ typedef struct ivas_mcmasa_ana_data_structure Word32 **direction_vector_m_fx[DIRAC_NUM_DIMS]; /* Average direction vector */ Word16 **direction_vector_e[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Average direction vector */ #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED float **direction_vector_m[DIRAC_NUM_DIMS]; /* Average direction vector */ +#endif #ifdef IVAS_FLOAT_FIXED Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; Word16 buffer_intensity_real_q[DIRAC_NO_COL_AVG_DIFF]; @@ -2318,27 +2322,31 @@ typedef struct ivas_mcmasa_ana_data_structure Word16 prevEQ_e; Word16 interpolator_e; #endif // IVAS_FLOAT_FIXED - int16_t band_grouping[MASA_FREQUENCY_BANDS + 1]; - int16_t block_grouping[5]; + Word16 band_grouping[MASA_FREQUENCY_BANDS + 1]; + Word16 block_grouping[5]; /* diffuseness */ - int16_t index_buffer_intensity; + Word16 index_buffer_intensity; +#ifndef IVAS_FLOAT_FIXED float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; float *buffer_intensity_real_vert[DIRAC_NO_COL_AVG_DIFF]; float buffer_energy[DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS]; - float chnlToFoaMtx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; float chnlToFoaEvenMtx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; float ls_azimuth[MCMASA_MAX_ANA_CHANS]; - int16_t leftNearest[MCMASA_MAX_ANA_CHANS]; - int16_t rightNearest[MCMASA_MAX_ANA_CHANS]; - int16_t numHorizontalChannels; - uint8_t isHorizontalSetup; +#endif + Word16 leftNearest[MCMASA_MAX_ANA_CHANS]; + Word16 rightNearest[MCMASA_MAX_ANA_CHANS]; + Word16 numHorizontalChannels; + UWord8 isHorizontalSetup; + +#ifndef IVAS_FLOAT_FIXED float prevMultiChEne; float prevDownmixEne; float prevEQ; float interpolator[L_FRAME48k]; +#endif MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9c1d72b5a..e20c61254 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -158,6 +158,7 @@ typedef struct rotation_matrix rot_mat_prev; #ifdef IVAS_FLOAT_FIXED pan_vector_fx prev_pan_gains_fx; + rotation_matrix_fx rot_mat_prev_fx; #endif pan_vector prev_pan_gains; int8_t firstFrameRendered; @@ -231,13 +232,15 @@ typedef struct rotation_gains rot_gains_prev; rotation_gains_Word32 rot_gains_prev_fx; Word16 nonDiegeticPan; - float nonDiegeticPanGain; Word32 nonDiegeticPanGain_fx; lfe_routing lfeRouting; - float *bufferData; Word32 *bufferData_fx; + float *bufferData; int16_t binauralDelaySmp; +#ifndef IVAS_FLOAT_FIXED + float nonDiegeticPanGain; float *lfeDelayBuffer; +#endif Word32 *lfeDelayBuffer_fx; MCMASA_ANA_HANDLE hMcMasa; } input_mc; @@ -1965,7 +1968,23 @@ static void closeHeadRotation( } #endif +#ifdef IVAS_FLOAT_FIXED +static void initRotMatrix_fx( + rotation_matrix_fx rot_mat_fx) +{ + Word16 i; + /* Initialize rotation matrices */ + FOR (i = 0; i < 3; i++) + { + set32_fx(rot_mat_fx[i], 0, 3); + rot_mat_fx[i][i] = ONE_IN_Q30; + } + + return; +} + +#endif static void initRotMatrix( rotation_matrix rot_mat ) { @@ -2247,6 +2266,9 @@ static ivas_error setRendInputActiveIsm( inputIsm->crendWrapper = NULL; inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); +#ifdef IVAS_FLOAT_FIXED + initRotMatrix_fx(inputIsm->rot_mat_prev_fx); +#endif initRotMatrix( inputIsm->rot_mat_prev ); set_zero( inputIsm->prev_pan_gains, MAX_OUTPUT_CHANNELS ); @@ -3672,6 +3694,176 @@ static ivas_error updateMcPanGains( } #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error initMcBinauralRendering( + input_mc *inputMc, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, + RENDER_CONFIG_DATA *hRendCfg, + uint8_t reconfigureFlag) +{ + ivas_error error; + int32_t binauralDelayNs; + int32_t outSampleRate; + int8_t useTDRend; + + /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) + or planar MC layouts with headrotation, CREND for the rest */ + useTDRend = FALSE; + if (outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) + { + if (inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) + { + useTDRend = TRUE; + } + else if ((inConfig == IVAS_AUDIO_CONFIG_5_1 || inConfig == IVAS_AUDIO_CONFIG_7_1) && + (inputMc->base.ctx.pHeadRotData->headRotEnabled)) + { + useTDRend = TRUE; + } + } + + /* if TD renderer was open and we need to use CREND, close it */ + if (!reconfigureFlag || (!useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL)) + { + ivas_td_binaural_close_fx(&inputMc->tdRendWrapper.hBinRendererTd); + inputMc->tdRendWrapper.hHrtfTD = NULL; + } + + + /* if we need to use TD renderer and CREND was open, close it */ + if (useTDRend) + { + ivas_rend_closeCrend(&inputMc->crendWrapper); + } + + if (!reconfigureFlag || (!useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL)) + { + ivas_reverb_close(&inputMc->hReverb); + } + + if (!reconfigureFlag || (inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled)) + { + if (inputMc->efapInWrapper.hEfap != NULL) + { + efap_free_data(&inputMc->efapInWrapper.hEfap); + } + } + + outSampleRate = *inputMc->base.ctx.pOutSampleRate; + + if (useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL) + { +#ifdef IVAS_FLOAT_FIXED + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; + if ( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + { + return error; + } + + Word16 nchan_rend = num_src; + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) + { + IF( Src_p->SrcSpatial_p != NULL ) + { + FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) + { + fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); + fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); + } + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); + fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + } + } +#else + if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + if (outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL) + { +#ifdef IVAS_FLOAT_FIXED + if ((error = ivas_reverb_open_fx(&(inputMc->hReverb), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate)) != IVAS_ERR_OK) + { + return error; + } +#else + if ((error = ivas_reverb_open(&(inputMc->hReverb), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate)) != IVAS_ERR_OK) + { + return error; + } +#endif + } + } + else if (!useTDRend && inputMc->crendWrapper == NULL) + { + /* open CREND */ +#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ + IF(hRendCfg) + { + hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed(hRendCfg->roomAcoustics.acousticPreDelay, 27); + FOR(int i = 0; i < 60; i++) + { + hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32)(hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16); + hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32)((hRendCfg->roomAcoustics.pAcoustic_rt60[i]) * ONE_IN_Q26); + hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32)(hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30); + } + + hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32)(hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27); + hRendCfg->roomAcoustics.dimensions.x_fx = (Word32)(hRendCfg->roomAcoustics.dimensions.x * 4194304); // Q10.22, min value:1, max :999.0 + hRendCfg->roomAcoustics.dimensions.y_fx = (Word32)(hRendCfg->roomAcoustics.dimensions.y * 4194304); // Q10.22 + hRendCfg->roomAcoustics.dimensions.z_fx = (Word32)(hRendCfg->roomAcoustics.dimensions.z * 4194304); // Q10.22 + + + FOR(int ii = 0; ii < 6; ii++) + { + hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32)(hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824); // Q2.30 min :0 max 1 + } + + hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32)(hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304); //( 2147483648 >> 2 ); + hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32)(hRendCfg->roomAcoustics.ListenerOrigin.y * (4194304)); + hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32)(hRendCfg->roomAcoustics.ListenerOrigin.z * (4194304)); + } +#endif // 1 + if ((error = ivas_rend_openCrend(&inputMc->crendWrapper, (inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate)) != IVAS_ERR_OK) + { + return error; + } + } + + /* Initialise the EFAP handle for rotation on input layout */ + if (inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL) + { + if ((error = initEfap(&inputMc->efapInWrapper, inConfig, NULL)) != IVAS_ERR_OK) + { + return error; + } + } + + /* determine binaural delay ( used for aligning LFE to output signal ) */ + binauralDelayNs = max((inputMc->crendWrapper != NULL) ? inputMc->crendWrapper->binaural_latency_ns : 0, inputMc->tdRendWrapper.binaural_latency_ns); + inputMc->binauralDelaySmp = (int16_t)roundf((float)binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f); + + if (inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES) + { + return IVAS_ERROR(IVAS_ERR_WRONG_PARAMS, "Invalid delay for LFE binaural rendering!)"); + } + + return IVAS_ERR_OK; +} +#else static ivas_error initMcBinauralRendering( input_mc *inputMc, const AUDIO_CONFIG inConfig, @@ -3831,8 +4023,39 @@ static ivas_error initMcBinauralRendering( return IVAS_ERR_OK; } +#endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error initMcMasaRendering( + input_mc *inputMc, + const AUDIO_CONFIG inConfig, + const Word32 inSampleRate) +{ + ivas_error error; + IF (inputMc->tdRendWrapper.hBinRendererTd != NULL) + { + ivas_td_binaural_close_fx(&inputMc->tdRendWrapper.hBinRendererTd); + inputMc->tdRendWrapper.hHrtfTD = NULL; + } + + ivas_rend_closeCrend(&inputMc->crendWrapper); + + ivas_reverb_close(&inputMc->hReverb); + + IF (inputMc->efapInWrapper.hEfap != NULL) + { + efap_free_data(&inputMc->efapInWrapper.hEfap); + } + + IF ((error = ivas_mcmasa_ana_open(&inputMc->hMcMasa, inConfig, inSampleRate)) != IVAS_ERR_OK) + { + return error; + } + + return IVAS_ERR_OK; +} +#else static ivas_error initMcMasaRendering( input_mc *inputMc, const AUDIO_CONFIG inConfig, @@ -3864,26 +4087,23 @@ static ivas_error initMcMasaRendering( return error; } #ifdef IVAS_FLOAT_FIXED -#if 1 /*Fixed to float conversion for ivas_mcmasa_ana_open (to be removed later)*/ +#if 0 /*Fixed to float conversion for ivas_mcmasa_ana_open (to be removed later)*/ MCMASA_ANA_HANDLE hMcMasa = inputMc->hMcMasa; Word16 i, j; - fixedToFloat_arrL( hMcMasa->ls_azimuth_fx, hMcMasa->ls_azimuth, Q22, MCMASA_MAX_ANA_CHANS ); - FOR( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) + //fixedToFloat_arrL( hMcMasa->ls_azimuth_fx, hMcMasa->ls_azimuth, Q22, MCMASA_MAX_ANA_CHANS ); + /*FOR( i = 0; i < MCMASA_MAX_ANA_CHANS; i++ ) { FOR( j = 0; j < FOA_CHANNELS; j++ ) { hMcMasa->chnlToFoaMtx[j][i] = fixedToFloat( hMcMasa->chnlToFoaMtx_fx[j][i], Q31 ); } - } - FOR( i = 0; i < ( inSampleRate / FRAMES_PER_SEC ); i++ ) - { - hMcMasa->interpolator[i] = fixedToFloat( hMcMasa->interpolator_fx[i], Q15 ); - } + }*/ #endif #endif // IVAS_FLOAT_FIXED return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static lfe_routing defaultLfeRouting( const AUDIO_CONFIG inConfig, @@ -4022,28 +4242,24 @@ static ivas_error setRendInputActiveMc( rendCtx = inputMc->base.ctx; outConfig = *rendCtx.pOutConfig; - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - - if ( ( error = allocateMcLfeDelayBuffer( &inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = allocateMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) + IF ( ( error = allocateMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF((error = allocateInputBaseBufferData(&inputMc->bufferData, MAX_BUFFER_LENGTH)) != IVAS_ERR_OK) { return error; } - if ( ( error = allocateInputBaseBufferData_fx( &inputMc->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + initRendInputBase(&inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH); + + IF ( ( error = allocateInputBaseBufferData_fx( &inputMc->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } - initRendInputBase( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH ); initRendInputBase_fx( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData_fx, MAX_BUFFER_LENGTH ); setZeroPanMatrix( inputMc->panGains ); @@ -4058,27 +4274,26 @@ static ivas_error setRendInputActiveMc( initRotGains( inputMc->rot_gains_prev ); initRotGainsWord32_fx( inputMc->rot_gains_prev_fx ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); - set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); set_val_Word32( inputMc->lfeDelayBuffer_fx, 0, MAX_BIN_DELAY_SAMPLES ); inputMc->binauralDelaySmp = 0; - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + IF (EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL) || EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) || EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) { - if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) + IF ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) { return error; } } - if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_MASA1) || EQ_16(outConfig , IVAS_AUDIO_CONFIG_MASA2 )) { - if ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - if ( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) + IF ( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -4160,16 +4375,13 @@ static void clearInputMc( rendering_context rendCtx; rendCtx = inputMc->base.ctx; - - freeMcLfeDelayBuffer( &inputMc->lfeDelayBuffer ); freeMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx ); - freeInputBaseBufferData( &inputMc->bufferData ); freeInputBaseBufferData_fx( &inputMc->bufferData_fx ); initRendInputBase( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); initRendInputBase_fx( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ - if ( inputMc->efapInWrapper.hEfap != NULL ) + IF ( inputMc->efapInWrapper.hEfap != NULL ) { efap_free_data( &inputMc->efapInWrapper.hEfap ); } @@ -4178,13 +4390,9 @@ static void clearInputMc( ivas_reverb_close( &inputMc->hReverb ); - if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) + IF ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { -#ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); -#else - ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); -#endif inputMc->tdRendWrapper.hHrtfTD = NULL; } @@ -4546,7 +4754,23 @@ static ivas_error updateSbaPanGains( } #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error initSbaMasaRendering( + input_sba *inputSba, + Word32 inSampleRate) +{ + ivas_error error; + ivas_rend_closeCrend(&inputSba->crendWrapper); + + IF((error = ivas_dirac_ana_open_fx(&inputSba->hDirAC, inSampleRate)) != IVAS_ERR_OK) + { + return error; + } + + return IVAS_ERR_OK; +} +#else static ivas_error initSbaMasaRendering( input_sba *inputSba, int32_t inSampleRate ) @@ -4569,7 +4793,7 @@ static ivas_error initSbaMasaRendering( return IVAS_ERR_OK; } - +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error setRendInputActiveSba( @@ -4971,10 +5195,12 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; hIvasRend->inputsMc[i].bufferData = NULL; hIvasRend->inputsMc[i].bufferData_fx = NULL; - hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; hIvasRend->inputsMc[i].lfeDelayBuffer_fx = NULL; hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; +#ifndef IVAS_FLOAT_FIXED + hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; +#endif Word32 temp = ( abs( (Word32) nonDiegeticPanGain ) ); hIvasRend->inputsMc[i].nonDiegeticPanGain_fx = ( temp == 1 ) ? ( ( nonDiegeticPanGain < 0 ) ? L_negate( ONE_IN_Q31 ) : ONE_IN_Q31 ) : (Word32) ( nonDiegeticPanGain * ( ONE_IN_Q31 ) ); hIvasRend->inputsMc[i].hMcMasa = NULL; @@ -9947,10 +10173,6 @@ static void renderMcToMasa( floatToFixed_arrL( hMcMasa->cldfbAnaEnc[i]->cldfb_state, hMcMasa->cldfbAnaEnc[i]->cldfb_state_fx, q_data, hMcMasa->cldfbAnaEnc[i]->p_filter_length - hMcMasa->cldfbAnaEnc[i]->no_channels ); } /*From here: Cleanup changes for ivas_mcmasa_dmx_fx*/ - f2me( hMcMasa->prevMultiChEne, &hMcMasa->prevMultiChEne_fx, &hMcMasa->prevMultiChEne_e ); - f2me( hMcMasa->prevDownmixEne, &hMcMasa->prevDownmixEne_fx, &hMcMasa->prevDownmixEne_e ); - f2me( hMcMasa->prevEQ, &hMcMasa->prevEQ_fx, &hMcMasa->prevEQ_e ); - floatToFixed_arr( hMcMasa->interpolator, hMcMasa->interpolator_fx, 15, L_FRAME48k ); #endif ivas_mcmasa_ana_fx( mcInput->hMcMasa, tmpRendBuffer_fx, *( outAudio.pq_fact ), mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); #if 1 /*TODO: To be removed later(fixed to float)*/ @@ -9963,38 +10185,14 @@ static void renderMcToMasa( { FOR( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) { - FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - hMcMasa->direction_vector_m[i][j][k] = me2f( hMcMasa->direction_vector_m_fx[i][j][k], hMcMasa->direction_vector_e[i][j][k] ); - } hMcMasa->energy[j][k] = me2f( hMcMasa->energy_fx[j][k], hMcMasa->energy_e[j][k] ); } } - FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) - { - FOR( int j = 0; j < DIRAC_NUM_DIMS; j++ ) - { - FOR( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) - hMcMasa->buffer_intensity_real[j][i][k] = fixedToFloat( hMcMasa->buffer_intensity_real_fx[j][i][k], hMcMasa->buffer_intensity_real_q[i] ); - } - FOR( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) - { - hMcMasa->buffer_intensity_real_vert[i][j] = fixedToFloat( hMcMasa->buffer_intensity_real_vert_fx[i][j], hMcMasa->buffer_intensity_real_vert_q[i] ); - } - FOR( int j = 0; j < MASA_FREQUENCY_BANDS; j++ ) - { - hMcMasa->buffer_energy[i * j + j] = fixedToFloat( hMcMasa->buffer_energy_fx[i * j + j], hMcMasa->buffer_energy_q[i] ); - } - } /*From here : cleanup changes for ivas_mcmasa_dmx_fx*/ FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { fixedToFloat_arrL( tmpRendBuffer_fx[i], tmpRendBuffer[i], q_data, L_FRAME48k ); } - - hMcMasa->prevMultiChEne = me2f( hMcMasa->prevMultiChEne_fx, hMcMasa->prevMultiChEne_e ); - hMcMasa->prevDownmixEne = me2f( hMcMasa->prevDownmixEne_fx, hMcMasa->prevDownmixEne_e ); - hMcMasa->prevEQ = me2f( hMcMasa->prevEQ_fx, hMcMasa->prevEQ_e ); #endif #else ivas_mcmasa_ana( mcInput->hMcMasa, tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); @@ -10028,8 +10226,9 @@ static ivas_error renderInputMc( mcInput->base.gain = fix_to_float( mcInput->base.gain_fx, Q30 ); /* Apply input gain to new audio */ +#ifndef IVAS_FLOAT_FIXED v_multc( inAudio.data, mcInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - +#endif v_multc_fixed( inAudio.data_fx, mcInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); *outAudio.pq_fact -= 1; // reducing the Q by 1 compensating for the v_mult_fixed done /* set combined orientation subframe info to start info */ -- GitLab From 010c4af772b1828f780d8a2a9cc024891f052069 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 15 May 2024 10:05:17 +0530 Subject: [PATCH 043/101] Renderer cleanup changes, MSAN error fixes, MC reconfig cleanup [x] Few MSAN errors for stereo fixed. [x] renderMcToMasa(), renderInputMc(), renderActiveInputsMc() cleaned up [x] MC dec config cleanup --- lib_com/float_to_fix_ops.c | 10 +- lib_com/ivas_prot_fx.h | 2 +- lib_dec/TonalComponentDetection_fx.c | 9 +- lib_dec/acelp_core_dec_ivas_fx.c | 4 + lib_dec/core_switching_dec_fx.c | 5 + lib_dec/ivas_binRenderer_internal.c | 2 +- lib_dec/ivas_core_dec.c | 28 ++--- lib_dec/ivas_dirac_dec.c | 17 +++ lib_dec/ivas_dirac_output_synthesis_cov.c | 48 ++------- lib_dec/ivas_jbm_dec.c | 119 +++++++++++---------- lib_dec/ivas_mc_param_dec.c | 58 +++++++--- lib_dec/ivas_mct_dec.c | 54 ++++------ lib_dec/ivas_stat_dec.h | 2 + lib_dec/ivas_stereo_ica_dec.c | 5 + lib_dec/ivas_stereo_icbwe_dec.c | 5 +- lib_dec/ivas_tcx_core_dec.c | 6 +- lib_dec/swb_tbe_dec_fx.c | 2 +- lib_dec/updt_dec_fx.c | 1 + lib_rend/ivas_dirac_output_synthesis_dec.c | 20 ++-- lib_rend/ivas_mcmasa_ana.c | 7 +- lib_rend/lib_rend.c | 113 +++++-------------- 21 files changed, 240 insertions(+), 277 deletions(-) diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 780f87270..883f3ba54 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -683,7 +683,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; st->hTcxDec->conLastFrameLevel = st->hTcxDec->LastFrameLevel_bfi_fx; - st->hTcxDec->conLastFrameLevel_e = 0; + //st->hTcxDec->conLastFrameLevel_e = 0; } IF( st->hHQ_core ) @@ -756,10 +756,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st->prev_Q_syn = st->Q_syn; //st->hTcxDec->conceal_eof_gain = (Word16) floatToFixed( st->hTcxDec->conceal_eof_gain_float, Q14 ); //st->hTcxDec->conCngLevelBackgroundTrace = (Word16) floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, Q15 - st->hTcxDec->conCngLevelBackgroundTrace_e ); - if ( st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - { - set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - } + //if ( st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) + //{ + // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); + //} st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; if ( hTcxLtpDec->tcxltp ) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 4bbd60e31..e6c840fef 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1865,7 +1865,7 @@ void stereo_tcx_core_dec_fx( const FRAME_MODE frameMode, /* i : Decoder frame mode */ Word16 *signal_out, /* o : synthesis @internal_Fs, Q0 */ Word16 *signal_outFB, /* o : synthesis @output_Fs, Q0 */ - Word32 pitch_buf[], /* o : floating pitch for each subframe, Q6 */ + Word16 pitch_buf[], /* o : floating pitch for each subframe, Q6 */ const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ const Word16 last_element_mode, /* i : last element mode */ diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 1cc38172d..e40828adc 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -73,7 +73,12 @@ void ivas_DetectTonalComponents_fx( { pScaledMdctSpectrum[i] = L_shl(lastMDCTSpectrum[i], 16); // Q31 - lastMDCTSpectrum_exp } - +#ifdef MSAN_FIX + FOR(Word16 i = 0; i < FDNS_NPTS; i++) + { + sns_int_scf_fx[i] = L_shl_sat(scaleFactors[i], 1 + scaleFactors_exp[i]); // Q16 + } +#endif IF (psychParamsCurrent == NULL) { nBands = FDNS_NPTS; @@ -84,10 +89,12 @@ void ivas_DetectTonalComponents_fx( } ELSE { +#ifndef MSAN_FIX FOR(Word16 i = 0; i < FDNS_NPTS; i++) { sns_int_scf_fx[i] = L_shl(scaleFactors[i], 1 + scaleFactors_exp[i]); // Q16 } +#endif q_pScaledMdctSpectrum = 31 - lastMDCTSpectrum_exp; sns_shape_spectrum_fx(pScaledMdctSpectrum, &q_pScaledMdctSpectrum, psychParamsCurrent, sns_int_scf_fx,16, nSamplesCore); q_pScaledMdctSpectrum = q_pScaledMdctSpectrum + 1; diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 810a04adc..fea2a55ac 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1104,7 +1104,11 @@ ivas_error acelp_core_dec_ivas_fx( lsf_dec_bfi(MODE1, lsf_new_fx, st->lsf_old_fx, st->lsf_adaptive_mean_fx, NULL, st->mem_MA_fx, st->mem_AR_fx, st->stab_fac_fx, st->last_coder_type, st->L_frame, st->last_good, st->nbLostCmpt, 0, NULL, NULL, NULL, st->hGSCDec->Last_GSC_pit_band_idx, st->Opt_AMR_WB, 0, st->bwidth); FEC_lsf2lsp_interp(st, st->L_frame, Aq_fx, lsf_new_fx, lsp_new_fx); +#ifndef MSAN_FIX for (int nsf = 0; nsf < NB_SUBFR16k; nsf++) { +#else + FOR(int nsf = 0; nsf < st->nb_subfr; nsf++) { +#endif Scale_sig(Aq_fx + (nsf * (M + 1)), M + 1, norm_s(Aq_fx[nsf * (M + 1)]) - Q2); Aq_fx[nsf * (M + 1)] = ONE_IN_Q12; } diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index d82aaea62..252bec195 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2259,8 +2259,13 @@ static void smoothTransitionDtxToTcx_fx( Word16 i, filter_len; Word16 w, step, fade_in; Word32 mem; +#ifdef MSAN_FIX + Word16 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k] = { 0 }; + Word16 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k] = { 0 }; +#else Word16 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; Word16 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; +#endif filter_len = TRANSITION_SMOOTHING_LEN_16k; IF( EQ_16( output_frame, L_FRAME32k ) ) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 890c8367d..d3b86d78b 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -2614,7 +2614,7 @@ void ivas_binRenderer_fx( /* memory reset for the binaural output */ FOR(chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++) { - FOR(k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++) + FOR(k = 0; k < numTimeSlots; k++) { set32_fx(Cldfb_RealBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); set32_fx(Cldfb_ImagBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 8826be540..27e9a3ede 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -148,7 +148,6 @@ ivas_error ivas_core_dec( set16_fx( output_16_fx[i], 0, L_FRAME48k ); } - Word32 pitch_buf_32fx[CPE_CHANNELS][NB_SUBFR16k]; Word16 tdm_lsfQ_PCh_fx[M], tdm_lspQ_PCh_fx[M]; Word32 conceal_eof_gain32; @@ -525,12 +524,10 @@ ivas_error ivas_core_dec( Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27)); st->hFdCngDec->msNoiseEst_exp = 27; - stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_32fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); + stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k,Q11); - Copy_Scale_sig_32_16(pitch_buf_32fx[n], pitch_buf_fx[n],NB_SUBFR16k,0); - stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 0, last_element_mode, frameMode[n]); fixed_to_float_stereo_tcx_core_dec( st, output_16_fx[n] ); } @@ -623,14 +620,14 @@ ivas_error ivas_core_dec( IF( st->hHQ_core ) floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); - if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - { - st->hTcxDec->conLastFrameLevel_e = 0; - } - if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - { - set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - } + //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) + //{ + // st->hTcxDec->conLastFrameLevel_e = 0; + //} + //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) + //{ + // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); + //} IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) @@ -1155,8 +1152,11 @@ ivas_error ivas_core_dec( Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); #ifdef MSAN_FIX - Scale_sig32(hb_synth_32_fx[0], output_frame, sub(Q11 , q)); - Scale_sig32(hb_synth_32_fx[1], output_frame, sub(Q11 , q)); + IF( !( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) || ( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) ) ) + { + Scale_sig32( hb_synth_32_fx[0], output_frame, sub( Q11, q ) ); + Scale_sig32( hb_synth_32_fx[1], output_frame, sub( Q11, q ) ); + } #else Scale_sig32(hb_synth_32_fx[0], L_FRAME48k, sub(Q11 , q)); Scale_sig32(hb_synth_32_fx[1], L_FRAME48k, sub(Q11 , q)); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 82b21930d..2cb597e7d 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5278,12 +5278,29 @@ void ivas_dirac_dec_render_sf_fx( /* Perform binaural rendering */ Word16 input_q = Q6; + + IF( st_ivas->hCombinedOrientationData != NULL ) + { + FOR( i = 0; i < 3; i++ ) + { + scale_sig32( st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i], 3, Q1 ); /* Q29 -> Q30 */ + } + } + ivas_binRenderer_fx( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, hSpatParamRendCom->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q ); + IF( st_ivas->hCombinedOrientationData != NULL ) + { + FOR( i = 0; i < 3; i++ ) + { + scale_sig32( st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i], 3, -Q1 ); /* Q30 -> Q29 */ + } + } + FOR ( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) { FOR ( Word16 idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ ) diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 8fbb8bb9b..dd9cf413c 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -209,21 +209,10 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { - - if ( ( h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); - } - if ( ( h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); - } if ( ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } - set_zero( h_dirac_output_synthesis_state->cx_old[idx], nchan_in * nchan_in ); - set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); if ( ( h_dirac_output_synthesis_state->mixing_matrix[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) @@ -234,8 +223,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - h_dirac_output_synthesis_state->cx_old[idx] = NULL; - h_dirac_output_synthesis_state->cy_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; } @@ -278,7 +265,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( #endif return IVAS_ERR_OK; } -#endif +#else ivas_error ivas_dirac_dec_output_synthesis_cov_open( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: hanlde for the covariance synthesis state */ @@ -312,15 +299,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { - - if ( ( h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); - } - if ( ( h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); - } if ( ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); @@ -337,8 +315,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - h_dirac_output_synthesis_state->cx_old[idx] = NULL; - h_dirac_output_synthesis_state->cy_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; } @@ -392,6 +368,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -483,8 +460,6 @@ void ivas_dirac_dec_output_synthesis_cov_init_fx( #if 1/*TODO: To be removed :Floating point initializations*/ FOR ( idx = 0; idx < n_param_bands; idx++ ) { - set_zero( h_dirac_output_synthesis_state->cx_old[idx], nchan_in * nchan_in ); - set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); } @@ -498,8 +473,7 @@ void ivas_dirac_dec_output_synthesis_cov_init_fx( return; } -#endif // IVAS_FLOAT_FIXED - +#else void ivas_dirac_dec_output_synthesis_cov_init( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ const int16_t nchan_in, /* i : number of input (tranport) channels */ @@ -528,6 +502,7 @@ void ivas_dirac_dec_output_synthesis_cov_init( return; } +#endif // IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -669,17 +644,6 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx( /* free cov buffers */ FOR ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - IF ( h_dirac_output_synthesis_state->cx_old[idx] != NULL ) - { - free( h_dirac_output_synthesis_state->cx_old[idx] ); - h_dirac_output_synthesis_state->cx_old[idx] = NULL; - } - - IF ( h_dirac_output_synthesis_state->cy_old[idx] != NULL ) - { - free( h_dirac_output_synthesis_state->cy_old[idx] ); - h_dirac_output_synthesis_state->cy_old[idx] = NULL; - } IF ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] != NULL ) { @@ -1022,6 +986,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( * samples with the covariance synthesis *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ @@ -1137,8 +1102,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( Word32 *Cldfb_RealBuffer_in_fx, Word32 *Cldfb_ImagBuffer_in_fx, diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 1400daddf..b40f30bc6 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -439,14 +439,14 @@ ivas_error ivas_jbm_dec_tc( } } - if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - { - st->hTcxDec->conLastFrameLevel_e = 0; - } - if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - { - set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - } + //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) + //{ + // st->hTcxDec->conLastFrameLevel_e = 0; + //} + //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) + //{ + // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); + //} IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) @@ -1053,14 +1053,14 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; } } - if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - { - st->hTcxDec->conLastFrameLevel_e = 0; - } - if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - { - set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - } + //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) + //{ + // st->hTcxDec->conLastFrameLevel_e = 0; + //} + //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) + //{ + // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); + //} IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) @@ -1435,14 +1435,14 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; } } - if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - { - st->hTcxDec->conLastFrameLevel_e = 0; - } - if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - { - set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - } + //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) + //{ + // st->hTcxDec->conLastFrameLevel_e = 0; + //} + //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) + //{ + // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); + //} IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) @@ -1639,14 +1639,14 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; } } - if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - { - st->hTcxDec->conLastFrameLevel_e = 0; - } - if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - { - set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - } + //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) + //{ + // st->hTcxDec->conLastFrameLevel_e = 0; + //} + //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) + //{ + // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); + //} IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) @@ -1847,14 +1847,14 @@ ivas_error ivas_jbm_dec_tc( sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; } } - if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - { - st->hTcxDec->conLastFrameLevel_e = 0; - } - if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - { - set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - } + //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) + //{ + // st->hTcxDec->conLastFrameLevel_e = 0; + //} + //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) + //{ + // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); + //} IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) @@ -3859,20 +3859,20 @@ void ivas_jbm_dec_feed_tc_to_renderer( nchan_out_cov = nchan_out_transport; } f2me_buf(st_ivas->hParamMC->h_output_synthesis_params.proto_matrix, st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_fx, &st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_e, nchan_out_cov * nchan_transport); + f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_transport * nchan_out_transport)); - //IF (st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV) - //{ - // f2me_buf(st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, &st_ivas->hParamMC->ls_conv_dmx_e, nchan_out_cov * nchan_out_transport); - //} - + ivas_param_mc_dec_digest_tc_fx( st_ivas, (uint8_t) n_render_timeslots, (Word32 **)p_data_f_fx, in_q ); + Word16 shift; FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) { - f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport)); - f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], nchan_out_cov * nchan_out_cov); - } - f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_transport * nchan_out_transport)); + shift = getScaleFactor32(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport)); + scale_sig32(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport), shift); + st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx] = sub(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], shift); - ivas_param_mc_dec_digest_tc_fx( st_ivas, (uint8_t) n_render_timeslots, (Word32 **)p_data_f_fx, in_q ); + shift = getScaleFactor32(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], nchan_out_cov * nchan_out_cov); + scale_sig32(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], nchan_out_cov * nchan_out_cov, shift); + st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = sub(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], shift); + } me2f_buf_16(st_ivas->hParamMC->h_output_synthesis_params.interpolator_fx, 0, st_ivas->hParamMC->h_output_synthesis_params.interpolator, n_render_timeslots ); @@ -3885,13 +3885,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], nchan_out_cov * nchan_out_cov); } } - - FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) - { - me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport)); - me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx], nchan_out_cov * nchan_out_cov); - } - #else ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); #endif @@ -5762,9 +5755,21 @@ ivas_error ivas_jbm_dec_render( { FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { IF(st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr) { +#ifdef IVAS_FLOAT_FIXED + mvl2l(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[param_band_idx], nchan_transport_tmp * nchan_out_cov); + st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[param_band_idx] = st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx]; + move16(); +#else mvr2r(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], nchan_transport_tmp * nchan_out_cov); +#endif } +#ifdef IVAS_FLOAT_FIXED + mvl2l(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[param_band_idx], nchan_transport_tmp * nchan_out_cov); + st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_exp[param_band_idx] = st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx]; + move16(); +#else mvr2r(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[param_band_idx], nchan_transport_tmp * nchan_out_cov); +#endif } } #endif diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 033e4ad46..1a68db7ee 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1631,10 +1631,10 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { /* Cx */ v_multc_fixed_16( cov_state_old.cx_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, nchan_transport_old * nchan_transport_old ); - v_add_fx( tmp_buf_fx, hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], nchan_transport_old * nchan_transport_old ); + v_add_fixed_me( tmp_buf_fx, cov_state_old.cx_old_e[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cx_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.cx_old_e[new_param_band_idx], nchan_transport_old * nchan_transport_old, 0 ); /* Cy */ v_multc_fixed_16( cov_state_old.cy_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, nchan_out_cov * nchan_out_cov ); - v_add_fx( tmp_buf_fx, hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], nchan_out_cov * nchan_out_cov ); + v_add_fixed_me( tmp_buf_fx, cov_state_old.cy_old_e[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.cy_old_fx[new_param_band_idx], &hParamMC->h_output_synthesis_cov_state.cy_old_e[new_param_band_idx], nchan_out_cov * nchan_out_cov, 0 ); /* mixing matrix*/ v_multc_fixed_16( cov_state_old.mixing_matrix_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx]], parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx], tmp_buf_fx, nchan_transport_old * nchan_out_cov ); v_add_fx( tmp_buf_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[new_param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[new_param_band_idx], nchan_transport_old * nchan_out_cov ); @@ -3903,8 +3903,7 @@ void ivas_param_mc_dec_render_fx( return; } -#endif - +#else void ivas_param_mc_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -4459,7 +4458,7 @@ pop_wmops(); return; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_dec() * @@ -4562,7 +4561,7 @@ static void ivas_param_mc_dec_init_fx( return; } -#endif // IVAS_FLOAT_FIXED +#else static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ const int16_t nchan_transport, /* i : number of input (transport) channels */ @@ -4615,7 +4614,7 @@ static void ivas_param_mc_dec_init( return; } - +#endif /*------------------------------------------------------------------------- * Local functions @@ -5104,6 +5103,7 @@ static void remove_lfe_from_cy_fx( * using the covariance method *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, @@ -5462,9 +5462,7 @@ static void ivas_param_mc_get_mixing_matrices( return; } - - -#ifdef IVAS_FLOAT_FIXED +#else static void ivas_param_mc_get_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, @@ -5707,11 +5705,40 @@ static void ivas_param_mc_get_mixing_matrices_fx( Copy32(Cy_state_fx, Cy_old_state_fx, nY_cov * nY_cov); + Word16 new_e = 0; + + hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx] = Cx_state_e; move16(); hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = Cy_state_e; move16(); + FOR( i = 0; i < nX * nX; i++ ) + { + IF(NE_32(Cx_old_state_fx[i], 0)) + { + new_e = hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx]; + move16(); + } + } + + hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx] = new_e; + move16(); + + new_e = 0; + move16(); + + FOR( i = 0; i < nY_cov * nY_cov; i++ ) + { + IF(NE_32(Cy_old_state_fx[i], 0)) + { + new_e = hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx]; + move16(); + } + } + + hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = new_e; + move16(); /* remove LFE IF necessary */ IF ( remove_lfe ) @@ -5873,9 +5900,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( return; } - -#else - +#endif /*------------------------------------------------------------------------- @@ -5885,6 +5910,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( * for mono and stereo output *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED // Not used anywhere static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : transport channel covariance for all parameter bands */ @@ -6047,14 +6073,15 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( return; } - #endif + /*------------------------------------------------------------------------- * param_mc_update_mixing_matrices() * * update mixing matrix buffers *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: Parametric MC handle */ float *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ @@ -6081,8 +6108,7 @@ static void param_mc_update_mixing_matrices( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void param_mc_update_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: Parametric MC handle */ Word32 *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 0aa255316..b16252440 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1385,7 +1385,7 @@ ivas_error ivas_mc_dec_config( { floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); } - Word16 cx_e = 0, cy_e = 0, mmo_e = 0, mmro_e = 0; + Word16 mmo_e = 0, mmro_e = 0; PARAM_MC_DEC_HANDLE hParamMC; hParamMC = st_ivas->hParamMC; Word16 nchan_out_transport, nchan_out_cov; @@ -1406,22 +1406,16 @@ ivas_error ivas_mc_dec_config( { nchan_out_cov = nchan_out_transport; } - Word32 max_cx_old_fx, max_cy_old_fx, max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; - float max_cx_old = hParamMC->h_output_synthesis_cov_state.cx_old[0][0], max_cy_old = hParamMC->h_output_synthesis_cov_state.cy_old[0][0], max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; + Word32 max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; + float max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i] ) { - for ( int j = 0; j < nchan_transport_old * nchan_transport_old; j++ ) - max_cx_old = max( max_cx_old, hParamMC->h_output_synthesis_cov_state.cx_old[i][j] ); - for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) - max_cy_old = max( max_cy_old, hParamMC->h_output_synthesis_cov_state.cy_old[i][j] ); for ( int j = 0; j < nchan_transport_old * nchan_out_cov; j++ ) max_mix_matrix_old = max( max_mix_matrix_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i][j] ); } } - /*IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) - floatToFixed_arr32( st_ivas->hParamMC->ls_conv_dmx_matrix, st_ivas->hParamMC->ls_conv_dmx_matrix_fx, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) );*/ for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) { if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) @@ -1430,8 +1424,6 @@ ivas_error ivas_mc_dec_config( max_mix_matrix_res_old = max( max_mix_matrix_res_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i][j] ); } } - f2me( max_cx_old, &max_cx_old_fx, &cx_e ); - f2me( max_cy_old, &max_cy_old_fx, &cy_e ); f2me( max_mix_matrix_old, &max_mix_matrix_old_fx, &mmo_e ); f2me( max_mix_matrix_res_old, &max_mix_matrix_res_old_fx, &mmro_e ); if ( mmo_e < 0 ) @@ -1440,11 +1432,8 @@ ivas_error ivas_mc_dec_config( mmro_e = 0; for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i] ) { - - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); } } @@ -1463,18 +1452,25 @@ ivas_error ivas_mc_dec_config( } } } - if ( st_ivas->hRenderConfig ) +#endif + IF ( st_ivas->hRenderConfig ) + { FOR( Word16 i = 0; i < 4; i++ ) { - st_ivas->hRenderConfig->directivity_fx[i * 3] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 1] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 1], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 2], 15 ); + st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = shl_sat( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2], 9 ); } -#endif + } if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } + IF ( st_ivas->hRenderConfig ) + { + FOR( Word16 i = 0; i < 4; i++ ) + { + st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = shr( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2], 9 ); + } + } #if 1 if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { @@ -1493,16 +1489,6 @@ ivas_error ivas_mc_dec_config( } if ( hParamMC ) { - //if ( st_ivas->hLsSetUpConversion ) - //{ - // for ( Word16 k = 0; k < nchan_transport; k++ ) - // { - // for ( int16_t i = 0; i < nchan_out_cov; i++ ) - // { - // st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); - // } - // } - //} fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); IF( hParamMC->diff_proto_info ) FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) @@ -1510,16 +1496,12 @@ ivas_error ivas_mc_dec_config( fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); } fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) ); - /*IF(st_ivas->hParamMC->ls_conv_dmx_matrix_fx ) - fixedToFloat_arrL( st_ivas->hParamMC->ls_conv_dmx_matrix_fx, st_ivas->hParamMC->ls_conv_dmx_matrix, Q30, st_ivas->hDecoderConfig->nchan_out * ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) );*/ if ( last_mc_mode == MC_MODE_PARAMMC ) { for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) + if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i] ) { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 246d2b1fb..49b4b3b22 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -779,8 +779,10 @@ typedef struct dirac_output_synthesis_cov_state_structure float *proto_power; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ float *proto_power_diff; #endif +#ifndef IVAS_FLOAT_FIXED float *cx_old[CLDFB_NO_CHANNELS_MAX]; float *cy_old[CLDFB_NO_CHANNELS_MAX]; +#endif float *mixing_matrix_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_dec/ivas_stereo_ica_dec.c b/lib_dec/ivas_stereo_ica_dec.c index 0286ac027..fb98f4a51 100644 --- a/lib_dec/ivas_stereo_ica_dec.c +++ b/lib_dec/ivas_stereo_ica_dec.c @@ -62,8 +62,13 @@ void stereo_tca_dec_fx( ) { /* Buffers, input Left and right channels @ input_Fs*/ +#ifdef MSAN_FIX + Word32 bufChanL_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k] = { 0 }; + Word32 bufChanR_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k] = { 0 }; +#else Word32 bufChanL_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k]; Word32 bufChanR_fx[L_DEC_MEM_LEN_ICA + L_FRAME48k]; +#endif Word32 *ptrChanL_fx, *ptrChanR_fx; Word32 *target_fx; Word16 target_idx, prevNCShift, currentNCShift, l_shift_adapt; diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 997e6d9f4..77717273e 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -1247,8 +1247,11 @@ void stereo_icBWE_dec_fx( hStereoICBWE->prev_Q_fsout = tmp; move16(); } - +#ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, sub( *Q_syn, add( 1, tmp ) ) ); +#else + Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); +#endif *Q_syn = sub( *Q_syn, 1 ); diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 21745b288..63eb0eba2 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -251,7 +251,7 @@ void stereo_tcx_core_dec_fx( const FRAME_MODE frameMode, /* i : Decoder frame mode */ Word16 *signal_out_fx, /* o : synthesis @internal_Fs, Q0 */ Word16 *signal_outFB_fx, /* o : synthesis @output_Fs, Q0 */ - Word32 pitch_buf_fx[], /* o : floating pitch for each subframe, Q6 */ + Word16 pitch_buf_fx[], /* o : floating pitch for each subframe, Q6 */ const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ const Word16 last_element_mode, /* i : last element mode */ @@ -795,11 +795,11 @@ void stereo_tcx_core_dec_fx( { Word32 tcxltp_pitch_tmp = L_add( L_deposit_h( hTcxLtpDec->tcxltp_pitch_int ), L_shl( L_deposit_l( div_s( hTcxLtpDec->tcxltp_pitch_fr, st->pit_res_max ) ), 1 ) ); /*15Q16*/ tcxltp_pitch_tmp = L_shr( tcxltp_pitch_tmp, 10 ); // Q6 - set32_fx( pitch_buf_fx, tcxltp_pitch_tmp, NB_SUBFR16k ); + set16_fx( pitch_buf_fx, extract_l( tcxltp_pitch_tmp ), NB_SUBFR16k ); } ELSE { - set32_fx( pitch_buf_fx, L_shl( L_SUBFR, 6 ), NB_SUBFR16k ); + set16_fx( pitch_buf_fx, shl( L_SUBFR, 6 ), NB_SUBFR16k ); } } diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 6f7ef267f..2334893c6 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -559,7 +559,7 @@ void ResetSHBbuffer_Dec_fx( Decoder_State* st_fx /* i/o: SHB encoder structure * set16_fx(hBWE_TD->mem_stp_swb_fx, 0, LPC_SHB_ORDER); hBWE_TD->gain_prec_swb_fx = 16384;/*Q14 =1*/ set16_fx( &st_fx->GainShape_Delay[0], 0, NUM_SHB_SUBFR / 2 ); - + hBWE_TD->prev_pow_exc16kWhtnd_fx32 = 1; /* Q0 1.f */ hBWE_TD->prev_mix_factor_fx = 32767; /*Q15 1.f*/ set16_fx(hBWE_TD->old_core_synth_fx, 0, L_FRAME16k); diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index a9576c88d..9749f039a 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -249,6 +249,7 @@ void updt_IO_switch_dec_fx( hBWE_TD->syn_overlap_fx, hBWE_TD->state_syn_shbexc_fx, &hBWE_TD->tbe_demph_fx, &hBWE_TD->tbe_premph_fx , hBWE_TD->mem_stp_swb_fx,&(hBWE_TD->gain_prec_swb_fx) ); set16_fx( st_fx->GainShape_Delay, 0, NUM_SHB_SUBFR/2 ); + hBWE_TD->prev_pow_exc16kWhtnd_fx32 = 1; /*Q0 1.f*/ hBWE_TD->prev_mix_factor_fx = 32767; /*Q15 1.f*/ swb_tbe_reset_synth_fx(hBWE_TD->genSHBsynth_Hilbert_Mem_fx, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx ); } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 1479d8885..e8260a818 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -3215,6 +3215,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Word32 L_tmp; Word16 exp_arr[CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS]; Word16 exp = 0, exp1, tmp, q_com, q_tmp, min_exp; + Word32 tmp32; move16(); push_wmops( "dirac_out_synth_sfr" ); @@ -3303,23 +3304,25 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( exp = sub( Q31, Q31 ); exp1 = 0; move16(); - tmp = BASOP_Util_Divide3232_Scale( L_shl( p_cy_auto_dir_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth ) ), + tmp32 = BASOP_Util_Divide3232_Scale_cadence( L_shl( p_cy_auto_dir_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth ) ), ( L_add( Sqrt32( h_dirac_output_synthesis_state->direct_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) &exp1 ); - target_power_y = L_shl( L_deposit_l( tmp ), exp1 ); // Q15 + (q_com - (31 - exp)) - q_target_power_y = add( Q15, sub( q_com, sub( Q31, exp ) ) ); + target_power_y = L_shr( tmp32, 1 ); // Q31 + (q_com - (31 - exp)) + q_target_power_y = add( Q31 - exp1, sub( q_com, sub( Q31, exp ) ) ); + q_target_power_y = sub(q_target_power_y, 1); exp = sub( Q31, Q31 ); exp1 = 0; move16(); - tmp = BASOP_Util_Divide3232_Scale( L_shl( p_cy_auto_diff_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ), + tmp32 = BASOP_Util_Divide3232_Scale_cadence( L_shl( p_cy_auto_diff_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ), ( L_add( Sqrt32( h_dirac_output_synthesis_state->diffuse_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) &exp1 ); - target_power_y1 = L_shl( L_deposit_l( tmp ), exp1 ); // Q15 + (q_com - (31 - exp)) - q_target_power_y1 = add( Q15, sub( q_com, sub( Q31, exp ) ) ); + target_power_y1 = L_shr( tmp32, 1 ); // Q31 + (q_com - (31 - exp)) + q_target_power_y1 = add( Q31 - exp1, sub( q_com, sub( Q31, exp ) ) ); + q_target_power_y1 = sub(q_target_power_y1, 1); - target_power_y = L_add( target_power_y, target_power_y1 ); - exp = q_target_power_y; + target_power_y = L_add( L_shl(target_power_y, sub(s_min(q_target_power_y1, q_target_power_y), q_target_power_y)), L_shl(target_power_y1, sub(s_min(q_target_power_y1, q_target_power_y), q_target_power_y1))); + exp = s_min(q_target_power_y1 - 1, q_target_power_y - 1); move16(); } ELSE @@ -3346,7 +3349,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Mpy_32_32( b, masa_stereo_type_detect->target_power_y_smooth_fx ) ); //(Q31, q_com) -> q_com masa_stereo_type_detect->q_target_power_y_smooth = q_com; move16(); - masa_stereo_type_detect->subtract_power_y_smooth_fx = L_add( Mpy_32_32( a, subtract_power_y ), Mpy_32_32( b, masa_stereo_type_detect->subtract_power_y_smooth_fx ) ); //(Q31, q_subtract_power_y) -> q_subtract_power_y diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index bf57b3fe7..83b4b4fc0 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -347,9 +347,10 @@ ivas_error ivas_mcmasa_ana_open( hMcMasa->prevMultiChEne_fx = 0; hMcMasa->prevDownmixEne_fx = 0; - hMcMasa->prevEQ_fx = 2147483647; - hMcMasa->prevEQ_e = 0; - + hMcMasa->prevMultiChEne_e = 0; + hMcMasa->prevDownmixEne_e = 0; + hMcMasa->prevEQ_e = 1; + hMcMasa->prevEQ_fx = 1073741824; input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); FOR ( i = 0; i < input_frame; i++ ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e20c61254..f0d024b31 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -10155,50 +10155,20 @@ static void renderMcToMasa( input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) { - float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - - push_wmops( "renderMcToMasa" ); - copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - #ifdef IVAS_FLOAT_FIXED + push_wmops( "renderMcToMasa" ); Word32 tmpRendBuffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer_fx ); -#if 1 /*TODO: To be removed later: Float to fixed */ - /*From here: Cleanup changes for ivas_mcmasa_param_est_ana_fx*/ - MCMASA_ANA_HANDLE hMcMasa = mcInput->hMcMasa; - Word16 i, nchan_inp = mcInput->base.inputBuffer.config.numChannels; - Word16 q_data = *( outAudio.pq_fact ); - FOR( i = 0; i < nchan_inp - 1; i++ ) - { - floatToFixed_arrL( hMcMasa->cldfbAnaEnc[i]->cldfb_state, hMcMasa->cldfbAnaEnc[i]->cldfb_state_fx, q_data, hMcMasa->cldfbAnaEnc[i]->p_filter_length - hMcMasa->cldfbAnaEnc[i]->no_channels ); - } - /*From here: Cleanup changes for ivas_mcmasa_dmx_fx*/ -#endif ivas_mcmasa_ana_fx( mcInput->hMcMasa, tmpRendBuffer_fx, *( outAudio.pq_fact ), mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); -#if 1 /*TODO: To be removed later(fixed to float)*/ - /*From here : Cleanup changes for ivas_mcmasa_param_est_ana_fx*/ - FOR( i = 0; i < nchan_inp - 1; i++ ) - { - fixedToFloat_arrL( hMcMasa->cldfbAnaEnc[i]->cldfb_state_fx, hMcMasa->cldfbAnaEnc[i]->cldfb_state, q_data, hMcMasa->cldfbAnaEnc[i]->p_filter_length - hMcMasa->cldfbAnaEnc[i]->no_channels ); - } - FOR( int j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) - { - FOR( int k = 0; k < MASA_FREQUENCY_BANDS; k++ ) - { - hMcMasa->energy[j][k] = me2f( hMcMasa->energy_fx[j][k], hMcMasa->energy_e[j][k] ); - } - } - /*From here : cleanup changes for ivas_mcmasa_dmx_fx*/ - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - fixedToFloat_arrL( tmpRendBuffer_fx[i], tmpRendBuffer[i], q_data, L_FRAME48k ); - } -#endif + accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); + #else + push_wmops( "renderMcToMasa" ); + float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); ivas_mcmasa_ana( mcInput->hMcMasa, tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); -#endif // IVAS_FLOAT_FIXED - accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); +#endif // IVAS_FLOAT_FIXED pop_wmops(); return; @@ -10212,80 +10182,54 @@ static ivas_error renderInputMc( { ivas_error error; IVAS_REND_AudioBuffer inAudio; - Word16 i; error = IVAS_ERR_OK; inAudio = mcInput->base.inputBuffer; - if ( mcInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + IF ( NE_32(mcInput->base.numNewSamplesPerChannel , outAudio.config.numSamplesPerChannel) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } mcInput->base.numNewSamplesPerChannel = 0; - /* To be removed */ - mcInput->base.gain = fix_to_float( mcInput->base.gain_fx, Q30 ); - - /* Apply input gain to new audio */ -#ifndef IVAS_FLOAT_FIXED - v_multc( inAudio.data, mcInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); -#endif + move32(); v_multc_fixed( inAudio.data_fx, mcInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - *outAudio.pq_fact -= 1; // reducing the Q by 1 compensating for the v_mult_fixed done + *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // reducing the Q by 1 compensating for the v_mult_fixed done /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *( mcInput->base.ctx.pCombinedOrientationData ) ); - switch ( getAudioConfigType( outConfig ) ) + SWITCH ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: renderMcToMc( mcInput, outAudio ); - for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) - { - outAudio.data[i] = fix_to_float( outAudio.data_fx[i], *outAudio.pq_fact ); - } - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: renderMcToSba( mcInput, outAudio ); - for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) - { - outAudio.data[i] = fix_to_float( outAudio.data_fx[i], *outAudio.pq_fact ); - } - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + SWITCH ( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: error = renderMcToBinaural( mcInput, outConfig, outAudio ); - for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) - { - outAudio.data[i] = fix_to_float( outAudio.data_fx[i], *outAudio.pq_fact ); - } - break; + BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - if ( mcInput->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF ( mcInput->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { error = renderMcCustomLsToBinauralRoom( mcInput, outConfig, outAudio ); - for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) - { - outAudio.data[i] = fix_to_float( outAudio.data_fx[i], *outAudio.pq_fact ); - } } - else + ELSE { error = renderMcToBinauralRoom( mcInput, outConfig, outAudio ); - for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) - { - outAudio.data[i] = fix_to_float( outAudio.data_fx[i], *outAudio.pq_fact ); - } + } - break; + BREAK; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: renderMcToMasa( mcInput, outAudio ); - break; + BREAK; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -10357,28 +10301,23 @@ static ivas_error renderActiveInputsMc( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) { - int16_t i; + Word16 i; input_mc *pCurrentInput; ivas_error error; - Word16 input_q = *outAudio.pq_fact; for ( i = 0, pCurrentInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pCurrentInput ) { - if ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + IF ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ - continue; + CONTINUE; } - if ( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + IF ( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; } } - for ( i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) - { - outAudio.data_fx[i] = (Word32) ( outAudio.data[i] * ( 1 << ( input_q - 1 ) ) ); // to make the output buffer Q same as input when it reaches renderActiveInputsSba - } return IVAS_ERR_OK; } #else @@ -11743,7 +11682,7 @@ static ivas_error getSamplesInternal( return error; } - IF( NE_32( hIvasRend->inputsSba[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + IF( NE_32( hIvasRend->inputsSba[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) || NE_32( hIvasRend->inputsMc[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { #ifndef DISABLE_LIMITER Word32 limiter_thresold = L_lshl( IVAS_LIMITER_THRESHOLD, *outAudio.pq_fact ); -- GitLab From 9d05f40495ee79c6f95dfdaa26fd8add78b3f4bc Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Wed, 15 May 2024 10:18:42 +0000 Subject: [PATCH 044/101] Update file .gitlab-ci-custom.yml --- .gitlab-ci-custom.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitlab-ci-custom.yml diff --git a/.gitlab-ci-custom.yml b/.gitlab-ci-custom.yml new file mode 100644 index 000000000..1fd82db40 --- /dev/null +++ b/.gitlab-ci-custom.yml @@ -0,0 +1,4 @@ +include: + - project: $CUSTOM_CI_PROJECT + ref: $CUSTOM_CI_REF + file: $CUSTOM_CI_FILE \ No newline at end of file -- GitLab From 9d2f65d73ad41ba777729a34347cf97f080aec21 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 15 May 2024 17:29:20 +0200 Subject: [PATCH 045/101] add longer per-testcase timeouts for CI --- .gitlab-ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 02e28fa0e..4696a114f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,8 @@ variables: IVAS_PIPELINE_NAME: '' BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" + TESTCASE_TIMEOUT_STV: 900 + TESTCASE_TIMEOUT_LTV: 2400 MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-mld' to run MLD test against reference float codec." # Not implemented yet, but may be good to have a manual pipeline trigger value: 'default' @@ -217,6 +219,9 @@ stages: - if [ $USE_LTV -eq 1 ]; then - *update-ltv-repo - *copy-ltv-files-to-testv-dir + - testcase_timeout=$TESTCASE_TIMEOUT_LTV + - else + - testcase_timeout=$TESTCASE_TIMEOUT_STV - fi - python3 ci/remove_unsupported_testcases.py $PRM_FILES - if [ $LEVEL_SCALING != "1.0" ];then @@ -226,8 +231,6 @@ stages: ### run pytest - exit_code=0 - # timeout of 15 min per individual testcase - hopefully too much, but better be safe for now - - testcase_timeout=900 - python3 -m pytest $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true @@ -273,7 +276,7 @@ stages: - make clean - make -j CLANG=$CLANG_NUM - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan.supp,report_error_type=1"; fi - - testcase_timeout=300 + - testcase_timeout=TESTCASE_TIMEOUT_STV - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path ./IVAS_cod_ref --ref_decoder_path ./IVAS_dec artifacts: name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" -- GitLab From 20fc24a45bf24005b8583363177a707f13f5375d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 15 May 2024 22:11:56 +0530 Subject: [PATCH 046/101] dirac dec binaural function loop range corrected --- lib_rend/ivas_dirac_dec_binaural_functions.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 04e02ca10..4985fe097 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1438,7 +1438,7 @@ static void ivas_dirac_dec_binaural_internal( floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); - FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + FOR( j = 0; j < nBins; j++ ) { f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); @@ -1543,7 +1543,7 @@ static void ivas_dirac_dec_binaural_internal( } } - FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + FOR( j = 0; j < nBins; j++ ) { hDiracDecBin->ChCrossRePrev[j] = me2f( hDiracDecBin->ChCrossRePrev_fx[j], hDiracDecBin->ChCrossRePrev_e[j] ); hDiracDecBin->ChCrossImPrev[j] = me2f( hDiracDecBin->ChCrossImPrev_fx[j], hDiracDecBin->ChCrossImPrev_e[j] ); @@ -6013,7 +6013,7 @@ static void ivas_masa_ext_rend_parambin_internal( hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); - FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + FOR( j = 0; j < nBins; j++ ) { f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); @@ -6186,7 +6186,7 @@ static void ivas_masa_ext_rend_parambin_internal( } } - FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) + FOR( j = 0; j < nBins; j++ ) { hDiracDecBin->ChCrossRePrev[j] = me2f( hDiracDecBin->ChCrossRePrev_fx[j], hDiracDecBin->ChCrossRePrev_e[j] ); hDiracDecBin->ChCrossImPrev[j] = me2f( hDiracDecBin->ChCrossImPrev_fx[j], hDiracDecBin->ChCrossImPrev_e[j] ); -- GitLab From 1e12de6f9b31ff98c74c378b18ac6e390c6face3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 08:36:16 +0530 Subject: [PATCH 047/101] lib_rend functions conversion, MSAN fixes in SBA path [x] renderism functions conversion [x] SBA path MSAN error fixes [x] ivas_masa_merge.c BASOP changes --- apps/renderer.c | 12 +- lib_com/cnst.h | 8 + lib_com/common_api_types.h | 4 + lib_com/ivas_cnst.h | 2 + lib_dec/acelp_core_dec_ivas_fx.c | 12 + lib_dec/ivas_jbm_dec.c | 62 +++- lib_rend/ivas_dirac_rend.c | 12 +- lib_rend/ivas_masa_merge.c | 116 +++++- lib_rend/ivas_prot_rend.h | 19 +- lib_rend/ivas_rotation.c | 114 ++++++ lib_rend/lib_rend.c | 586 ++++++++++++++++++++----------- lib_rend/lib_rend.h | 1 + 12 files changed, 736 insertions(+), 212 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index af75bcb68..5667a3042 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1433,8 +1433,11 @@ int main( if ( i == 0 ) { IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, args.inConfig.numAudioObjects ); - +#ifdef IVAS_FLOAT_FIXED + if ( ( error = IVAS_REND_FeedInputAudio_fx( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1450,9 +1453,12 @@ int main( else { IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, 1 ); - +#ifdef IVAS_FLOAT_FIXED + if ( ( error = IVAS_REND_FeedInputAudio_fx( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) - { +#endif + { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 9cf45d203..3d49d2738 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -44,10 +44,18 @@ /* clang-format off */ #ifdef IVAS_FLOAT_FIXED #define MATRIX_CONSTANT (759250113) +#define NUM_SAMPLES_960 (960) +#define NUM_SAMPLES_720 (720) +#define NUM_SAMPLES_320 (320) +#define NUM_SAMPLES_160 (160) #define L_SUBFRAME_48k (240) #define L_SUBFRAME_32k (180) #define L_SUBFRAME_16k (80) #define L_SUBFRAME_8k (40) +#define Q31_BY_NUM_SAMPLES_960 ( 2239294 ) +#define Q31_BY_NUM_SAMPLES_720 ( 2986764 ) +#define Q31_BY_NUM_SAMPLES_320 ( 6731924 ) +#define Q31_BY_NUM_SAMPLES_160 ( 13506186 ) #define Q31_BY_SUB_FRAME_240 ( 8985287 ) #define Q31_BY_SUB_FRAME_180 ( 11997115 ) #define Q31_BY_SUB_FRAME_80 ( 27183337 ) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index d61457a11..563c51d6d 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -118,6 +118,10 @@ typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG typedef struct _IVAS_ISM_METADATA { +#ifdef IVAS_FLOAT_FIXED + Word32 azimuth_fx; + Word32 elevation_fx; +#endif float azimuth; float elevation; float radius; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index a786807cb..c7b930a31 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -49,6 +49,8 @@ #define _180_OVER_PI ( 180.0f / EVS_PI ) #ifdef IVAS_FLOAT_FIXED #define _180_OVER_PI_Q25 1922527233 +#define _180_IN_Q22 (754974720) +#define _360_IN_Q22 (1509949440) #define _180_OVER_PI_FX (Word32) (( 180.0f / EVS_PI ) *ONE_IN_Q10) #define PI_OVER_180_Q15 ( 572 ) #define _180_OVER_PI_Q9 ( 29335 ) diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index fea2a55ac..4b1940cff 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1577,7 +1577,11 @@ ivas_error acelp_core_dec_ivas_fx( q_bpf_error_signal = Q6; +#ifdef MSAN_FIX + Copy_Scale_sig_16_32(bpf_error_signal_16fx, tmp_bpf_error_signal_fx, st->L_frame, q_bpf_error_signal - st->Q_syn); // Q6 +#else Copy_Scale_sig_16_32(bpf_error_signal_16fx, tmp_bpf_error_signal_fx, L_FRAME16k, q_bpf_error_signal - st->Q_syn); // Q6 +#endif for (i = 0; i < CLDFB_NO_COL_MAX; i++) { Scale_sig32(realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, -Q7); //Q0 @@ -1855,12 +1859,20 @@ ivas_error acelp_core_dec_ivas_fx( ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) ) { Word16 tmp_exp = 0; +#ifdef MSAN_FIX + Copy_Scale_sig_32_16(synth_fx, synth_fx16, output_frame, 0); +#else Copy_Scale_sig_32_16(synth_fx, synth_fx16, L_FRAME48k, 0); +#endif hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &tmp_exp, st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode, st->element_mode ); +#ifdef MSAN_FIX + Copy_Scale_sig_16_32(synth_fx16, synth_fx, 0, output_frame); +#else Copy_Scale_sig_16_32(synth_fx16, synth_fx, 0, L_FRAME48k); +#endif IF( st->hBWE_FD != NULL ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index b40f30bc6..8b335e463 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -641,7 +641,36 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { -#ifndef MSAN_FIX_ +#ifdef MSAN_FIX + IF( LE_16( st_ivas->nchan_transport, 1 ) ) + { + st = hCPE->hCoreCoder[0]; + IF( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE || ( st->bfi == 1 && st->core == ACELP_CORE && st->con_tcx == 1 ) ) + { + IF( ( ( st->last_core != ACELP_CORE || ( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) && st->last_core != AMR_WB_CORE ) || ( st_ivas->sba_dirac_stereo_flag && st->cng_type == FD_CNG ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( hCPE->hCoreCoder[0]->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + } + ELSE IF( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE ) /* ACELP -> TCX/HQ */ + { + IF( !st->tcxonly ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( hCPE->hCoreCoder[0]->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + } + } + } + ELSE /* ACELP core */ + { + IF( st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE || st->last_core == HQ_CORE ) /* TCX/HQ -> ACELP */ + { + IF( ( st->last_L_frame <= L_FRAME16k && st->L_frame <= L_FRAME16k ) || ( st_ivas->sba_dirac_stereo_flag && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( hCPE->hCoreCoder[0]->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + } + } + } + } +#else scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); #endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); @@ -699,7 +728,36 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { -#ifndef MSAN_FIX_ +#ifdef MSAN_FIX + IF( LE_16( st_ivas->nchan_transport, 1 ) ) + { + st = hCPE->hCoreCoder[0]; + IF( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE || ( st->bfi == 1 && st->core == ACELP_CORE && st->con_tcx == 1 ) ) + { + IF( ( ( st->last_core != ACELP_CORE || ( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) && st->last_core != AMR_WB_CORE ) || ( st_ivas->sba_dirac_stereo_flag && st->cng_type == FD_CNG ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */ + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( hCPE->hCoreCoder[0]->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + } + ELSE IF( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE ) /* ACELP -> TCX/HQ */ + { + IF( !st->tcxonly ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( hCPE->hCoreCoder[0]->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + } + } + } + ELSE /* ACELP core */ + { + IF( st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE || st->last_core == HQ_CORE ) /* TCX/HQ -> ACELP */ + { + IF( ( st->last_L_frame <= L_FRAME16k && st->L_frame <= L_FRAME16k ) || ( st_ivas->sba_dirac_stereo_flag && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( hCPE->hCoreCoder[0]->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + } + } + } + } +#else scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); #endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index ecd3571db..036b71754 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1767,11 +1767,17 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; + set_zero( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, size_pf ); + set_zero( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, size_pf ); #ifdef IVAS_FLOAT_FIXED hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx = hDirAC_mem->direct_power_factor_fx; hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx = hDirAC_mem->diffuse_power_factor_fx; - set_zero(hDirACRend->h_output_synthesis_psd_state.direct_power_factor , size_pf); - set_zero(hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, size_pf); + set_zero_fx( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, size_pf ); + set_zero_fx( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, size_pf ); + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; + move16(); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q31; + move16(); #endif hDirAC_mem->reference_power = NULL; @@ -1806,6 +1812,7 @@ ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } #ifdef MSAN_FIX + set_zero( hDirAC_mem->onset_filter, num_outputs_diff * num_freq_bands); set_zero_fx( hDirAC_mem->onset_filter_fx, num_outputs_diff * num_freq_bands ); #endif #endif @@ -1840,6 +1847,7 @@ ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } #ifdef MSAN_FIX + set_zero( hDirAC_mem->onset_filter, 2 * num_freq_bands ); set_zero_fx( hDirAC_mem->onset_filter_fx, 2 * num_freq_bands ); #endif #endif diff --git a/lib_rend/ivas_masa_merge.c b/lib_rend/ivas_masa_merge.c index 43bead2e1..cce11afee 100644 --- a/lib_rend/ivas_masa_merge.c +++ b/lib_rend/ivas_masa_merge.c @@ -48,12 +48,24 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void copy_masa_meta_tile_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, const UWord8 sf, const UWord8 band ); +#else static void copy_masa_meta_tile( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, const uint8_t sf, const uint8_t band ); +#endif #ifdef IVAS_FLOAT_FIXED static void full_stream_merge_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, Word32 inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne1_e, MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, Word32 inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne2_e ); -static void diffuse_meta_merge_1x1_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, Word32 inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne1_e, MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, Word32 inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne2_e); +static void diffuse_meta_merge_1x1_fx( + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i : Input metadata 1 */ + Word32 inEne_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 1 */ + Word16 *inEne_e, /* i : TF-energy of input 1 */ + MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, /* i : Input metadata 2 */ + Word32 inEneISM_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 2 */ + Word16 *inEneISM_e /* i : TF-energy of input 2 */ +); #else static void full_stream_merge( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); @@ -67,6 +79,41 @@ static void diffuse_meta_merge_1x1( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MA * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void copy_masa_meta_tile_fx( + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : metadata to be written */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i : input metadata */ + const UWord8 sf, /* i : sub-frame index */ + const UWord8 band /* i : band index */ +) +{ + outMeta->directionIndex[0][sf][band] = inMeta->directionIndex[0][sf][band]; + move16(); + outMeta->directToTotalRatio[0][sf][band] = inMeta->directToTotalRatio[0][sf][band]; + outMeta->spreadCoherence[0][sf][band] = inMeta->spreadCoherence[0][sf][band]; + + outMeta->surroundCoherence[sf][band] = inMeta->surroundCoherence[sf][band]; + outMeta->diffuseToTotalRatio[sf][band] = inMeta->diffuseToTotalRatio[sf][band]; + + IF ( inMeta->descriptiveMeta.numberOfDirections == 1 ) + { + outMeta->directionIndex[1][sf][band] = inMeta->directionIndex[1][sf][band]; + move16(); + outMeta->directToTotalRatio[1][sf][band] = inMeta->directToTotalRatio[1][sf][band]; + outMeta->spreadCoherence[1][sf][band] = inMeta->spreadCoherence[1][sf][band]; + } + ELSE + { + /* make sure the output has zeroed data in the second direction */ + outMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; + move16(); + outMeta->directToTotalRatio[1][sf][band] = 0u; + outMeta->spreadCoherence[1][sf][band] = 0u; + } + + return; +} +#else void copy_masa_meta_tile( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : metadata to be written */ MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i : input metadata */ @@ -97,7 +144,7 @@ void copy_masa_meta_tile( return; } - +#endif /*---------------------------------------------------------------------* * copy_masa_descriptive_meta() @@ -105,6 +152,28 @@ void copy_masa_meta_tile( * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void copy_masa_descriptive_meta( + MASA_DECRIPTIVE_META *outMeta, /* o : metadata to be written */ + MASA_DECRIPTIVE_META *inMeta /* i : input metadata */ +) +{ + UWord8 char_idx; + FOR ( char_idx = 0; char_idx < 8; char_idx++ ) + { + outMeta->formatDescriptor[char_idx] = inMeta->formatDescriptor[char_idx]; + } + outMeta->numberOfDirections = inMeta->numberOfDirections; + outMeta->numberOfChannels = inMeta->numberOfChannels; + outMeta->sourceFormat = inMeta->sourceFormat; + outMeta->transportDefinition = inMeta->transportDefinition; + outMeta->channelAngle = inMeta->channelAngle; + outMeta->channelDistance = inMeta->channelDistance; + outMeta->channelLayout = inMeta->channelLayout; + + return; +} +#else void copy_masa_descriptive_meta( MASA_DECRIPTIVE_META *outMeta, /* o : metadata to be written */ MASA_DECRIPTIVE_META *inMeta /* i : input metadata */ @@ -125,7 +194,7 @@ void copy_masa_descriptive_meta( return; } - +#endif /*---------------------------------------------------------------------* * diffuse_meta_merge_1x1() @@ -133,6 +202,7 @@ void copy_masa_descriptive_meta( * *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void diffuse_meta_merge_1x1( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i : Input metadata 1 */ @@ -205,6 +275,7 @@ void diffuse_meta_merge_1x1( return; } +#endif #ifdef IVAS_FLOAT_FIXED @@ -332,6 +403,7 @@ void diffuse_meta_merge_1x1_fx( * *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void full_stream_merge( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ @@ -396,6 +468,7 @@ void full_stream_merge( return; } +#endif #ifdef IVAS_FLOAT_FIXED void full_stream_merge_fx( @@ -451,11 +524,11 @@ void full_stream_merge_fx( IF (BASOP_Util_Cmp_Mant32Exp( dir_nrg_1_fx, dir_nrg_1_e, dir_nrg_2_fx, dir_nrg_2_e ) > 1 ) { - copy_masa_meta_tile( outMeta, inMeta1, sf, band ); + copy_masa_meta_tile_fx( outMeta, inMeta1, sf, band ); } ELSE { - copy_masa_meta_tile( outMeta, inMeta2, sf, band ); + copy_masa_meta_tile_fx( outMeta, inMeta2, sf, band ); } inEne1_fx[sf][band] = BASOP_Util_Add_Mant32Exp(inEne1_fx[sf][band], inEne1_e[sf], inEne2_fx[sf][band], inEne2_e[sf], &in1_e[band]); @@ -505,6 +578,7 @@ void full_stream_merge_fx( * *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_prerend_merge_masa_metadata( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ @@ -533,6 +607,7 @@ void ivas_prerend_merge_masa_metadata( return; } +#endif #ifdef IVAS_FLOAT_FIXED void ivas_prerend_merge_masa_metadata_fx( @@ -627,7 +702,7 @@ ivas_error masaPrerendOpen( } #else -ivas_error masaPrerendOpen( +ivas_error masaPrerendOpen_fx( MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ Word16 numTransports, /* i : number of transport channels */ Word32 input_Fs /* i : signal sampling rate */ @@ -685,6 +760,34 @@ ivas_error masaPrerendOpen( * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void masaPrerendClose_fx( + MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ +) +{ + Word16 i; + + IF ( hMasaPrerendPtr == NULL || *hMasaPrerendPtr == NULL ) + { + return; + } + + FOR ( i = 0; i < ( *hMasaPrerendPtr )->num_Cldfb_instances; i++ ) + { + deleteCldfb_ivas( &( ( *hMasaPrerendPtr )->cldfbAnaEnc[i] ) ); + } + + free( ( *hMasaPrerendPtr )->hMasaOut ); + ( *hMasaPrerendPtr )->hMasaOut = NULL; + free( ( *hMasaPrerendPtr )->sph_grid16 ); + ( *hMasaPrerendPtr )->sph_grid16 = NULL; + + free( ( *hMasaPrerendPtr ) ); + ( *hMasaPrerendPtr ) = NULL; + + return; +} +#else void masaPrerendClose( MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ ) @@ -711,3 +814,4 @@ void masaPrerendClose( return; } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 91e724491..ea57f5e9e 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -2309,6 +2309,15 @@ void rotateAziEle_fx( const Word16 isPlanar /* i : is roation planar and elevation meaningless? */ ); +void rotateAziEle_fx_frac_az_el( + Word32 azi_in, /* i : output elevation */ + Word32 ele_in, /* i : input elevation */ + Word32 *azi, /* o : rotated azimuth */ + Word32 *ele, /* o : rotated elevation */ + Word32 Rmat[3][3], /* i : real-space rotation matrix */ + const Word16 isPlanar /* i : is roation planar and elevation meaningless? */ +); + void rotateAziEle_fixed( Word16 azi_in, /* i : output elevation */ Word16 ele_in, /* i : input elevation */ @@ -2780,6 +2789,7 @@ void ivas_dirac_ana_close( ); #endif +#ifndef IVAS_FLOAT_FIXED void ivas_prerend_merge_masa_metadata( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ @@ -2789,6 +2799,7 @@ void ivas_prerend_merge_masa_metadata( IVAS_REND_AudioConfigType inType2, /* i : Type of input 2 */ float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : TF-energy of input 2 */ ); +#endif #ifdef IVAS_FLOAT_FIXED void ivas_prerend_merge_masa_metadata_fx( @@ -2817,15 +2828,21 @@ ivas_error masaPrerendOpen( ); #else -ivas_error masaPrerendOpen( +ivas_error masaPrerendOpen_fx( MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ Word16 numTransports, /* i : number of transport channels */ Word32 input_Fs /* i : signal sampling rate */ ); #endif +#ifndef IVAS_FLOAT_FIXED void masaPrerendClose( MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ ); +#else +void masaPrerendClose_fx( + MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ +); +#endif /* clang-format on */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 20043875f..41dc6a502 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -567,6 +567,120 @@ void rotateAziEle_fx( return; } +/*------------------------------------------------------------------------- + * rotateAziEle_fx_frac_az_el() + * + * Apply rotation to direction parameters azimuth and elevation + *------------------------------------------------------------------------*/ +void rotateAziEle_fx_frac_az_el( + Word32 azi_in, /* i : output elevation */ + Word32 ele_in, /* i : input elevation */ + Word32 *azi, /* o : rotated azimuth */ + Word32 *ele, /* o : rotated elevation */ + Word32 Rmat_fx[3][3], /* i : real-space rotation matrix */ + const Word16 isPlanar /* i : is rotation planar and elevation meaningless? */ +) +{ + Word16 n, radian; // temp_16; + Word32 dv_fx[3], dv_r_fx[3]; + Word16 w_fx; + Word32 temp; + Word32 y, x, sqrt_fx; + Word32 angle; + Word16 azi_in_q13, ele_in_q13; + /*Conversion spherical to cartesian coordinates*/ + IF( GT_32( abs( azi_in ), _180_IN_Q22 ) ) + { + azi_in = GT_32( azi_in, 0 ) ? ( azi_in - _360_IN_Q22 ) : ( azi_in + _360_IN_Q22 ); + move32(); + } + azi_in_q13 = (Word16)L_shr( Mpy_32_32( azi_in, PI_OVER_180_FX ), Q9 ); + ele_in_q13 = (Word16)L_shr( Mpy_32_32( ele_in, PI_OVER_180_FX ), Q9 ); + w_fx = getCosWord16( ele_in_q13 ); // Q14 + dv_fx[0] = L_mult( w_fx, getCosWord16( azi_in_q13 ) ); + IF( EQ_32( dv_fx[0], ONE_IN_Q29 ) ) + { + move32(); + dv_fx[0] = ONE_IN_Q31; + } + ELSE + { + dv_fx[0] = L_shl( dv_fx[0], 2 ); + } + dv_fx[1] = L_mult( w_fx, getSinWord16( azi_in_q13 ) ); + IF( EQ_32( dv_fx[1], ONE_IN_Q30 ) ) + { + move32(); + dv_fx[1] = ONE_IN_Q31; + } + ELSE + { + dv_fx[1] = L_shl( dv_fx[1], 1 ); + } + dv_fx[2] = (Word32) getSinWord16( ele_in_q13 ); + IF( EQ_32( dv_fx[2], ONE_IN_Q15 ) ) + { + move32(); + dv_fx[2] = ONE_IN_Q31; + } + ELSE + { + dv_fx[2] = L_shl( dv_fx[2], 16 ); + } + + /*Rotation mtx multiplication*/ + FOR( n = 0; n < 3; n++ ) + { + temp = L_add( Mpy_32_32( dv_fx[0], Rmat_fx[n][0] ), Mpy_32_32( dv_fx[1], Rmat_fx[n][1] ) ); + dv_r_fx[n] = L_add( Mpy_32_32( dv_fx[2], Rmat_fx[n][2] ), temp ); // Q30 + } + + /*Conversion cartesian to spherical coordinates*/ + move32(); + y = dv_r_fx[1]; + move32(); + x = dv_r_fx[0]; + radian = BASOP_util_atan2( y, x, 0 ); // Q13 + + angle = ( Mpy_32_16_1( _180_OVER_PI_Q25, radian ) >> 1 ); // Q22 + + + *azi = (Word32) ( max( L_shl( -180, 22 ), min( L_shl( 180, 22 ), angle ) ) ); // Q22 + *azi = ( L_add( *azi, ONE_IN_Q21 ) >> Q22 ) << Q22; + IF( LT_32( abs( *azi ), ONE_IN_Q22 ) ) + { + move32(); + *azi = 0; + } + IF( EQ_16( isPlanar, 0 ) ) + { + sqrt_fx = L_Frac_sqrtQ31( L_add( Mpy_32_32( dv_r_fx[0], dv_r_fx[0] ), Mpy_32_32( dv_r_fx[1], dv_r_fx[1] ) ) ); + y = dv_r_fx[2]; + move32(); + x = sqrt_fx; + move32(); + radian = BASOP_util_atan2( y, x, 0 ); + + angle = ( Mpy_32_16_1( _180_OVER_PI_Q25, radian ) >> 1 ); // Q22 + + + *ele = (Word32) ( max( L_shl( -90, 22 ), min( L_shl( 90, 22 ), angle ) ) ); // Q22 + *ele = ( L_add( *ele, ONE_IN_Q21 ) >> Q22 ) << Q22; + IF( LT_32( abs( *ele ), ONE_IN_Q22 ) ) + { + *ele = 0; + move32(); + } + } + ELSE + { + *ele = 0; + move32(); + } + + return; +} + /*------------------------------------------------------------------------- * rotateAziEle() * diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f0d024b31..d5a90e28a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -155,7 +155,7 @@ typedef struct TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; - rotation_matrix rot_mat_prev; + rotation_matrix_fx rot_mat_prev; #ifdef IVAS_FLOAT_FIXED pan_vector_fx prev_pan_gains_fx; rotation_matrix_fx rot_mat_prev_fx; @@ -163,8 +163,12 @@ typedef struct pan_vector prev_pan_gains; int8_t firstFrameRendered; float *bufferData; + Word32 *bufferData_fx; Word16 nonDiegeticPan; float nonDiegeticPanGain; +#ifdef IVAS_FLOAT_FIXED + Word32 nonDiegeticPanGain_fx; +#endif OMASA_ANA_HANDLE hOMasa; uint16_t total_num_objects; float ism_metadata_delay_ms; @@ -1968,39 +1972,39 @@ static void closeHeadRotation( } #endif -#ifdef IVAS_FLOAT_FIXED -static void initRotMatrix_fx( - rotation_matrix_fx rot_mat_fx) +static void initRotMatrix( + rotation_matrix rot_mat ) { - Word16 i; + int16_t i; /* Initialize rotation matrices */ - FOR (i = 0; i < 3; i++) + for ( i = 0; i < 3; i++ ) { - set32_fx(rot_mat_fx[i], 0, 3); - rot_mat_fx[i][i] = ONE_IN_Q30; + set_zero( rot_mat[i], 3 ); + rot_mat[i][i] = 1.f; } return; } -#endif -static void initRotMatrix( - rotation_matrix rot_mat ) +#ifdef IVAS_FLOAT_FIXED + +static void initRotMatrix_fx( + rotation_matrix_fx rot_mat ) { - int16_t i; + Word16 i; /* Initialize rotation matrices */ - for ( i = 0; i < 3; i++ ) + FOR( i = 0; i < 3; i++ ) { - set_zero( rot_mat[i], 3 ); - rot_mat[i][i] = 1.f; + set_zero_fx( rot_mat[i], 3 ); + rot_mat[i][i] = ONE_IN_Q30; + move32(); } return; } -#ifdef IVAS_FLOAT_FIXED static void initRotGains_fx( rotation_gains_fx rot_gains ) { @@ -2123,6 +2127,15 @@ static int8_t checkObjectPositionChanged( fabs( currentPos->elevation - previousPos->elevation ) < EPSILON ); } +#ifdef IVAS_FLOAT_FIXED +static Word8 checkObjectPositionChanged_fx( + IVAS_ISM_METADATA *currentPos, + IVAS_ISM_METADATA *previousPos ) +{ + return !( LT_32( abs( L_sub( currentPos->azimuth_fx, previousPos->azimuth_fx ) ), EPSILLON_FX ) && + LT_32( abs( L_sub( currentPos->elevation_fx, previousPos->elevation_fx ) ), EPSILLON_FX ) ); +} +#endif static rendering_context getRendCtx( IVAS_REND_HANDLE hIvasRend ) @@ -2258,6 +2271,13 @@ static ivas_error setRendInputActiveIsm( return error; } initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); +#ifdef IVAS_FLOAT_FIXED + if ( ( error = allocateInputBaseBufferData_fx( &inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } + initRendInputBase_fx( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ); +#endif inputIsm->firstFrameRendered = FALSE; @@ -2266,12 +2286,16 @@ static ivas_error setRendInputActiveIsm( inputIsm->crendWrapper = NULL; inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); -#ifdef IVAS_FLOAT_FIXED - initRotMatrix_fx(inputIsm->rot_mat_prev_fx); -#endif + +#ifndef IVAS_FLOAT_FIXED initRotMatrix( inputIsm->rot_mat_prev ); +#else + initRotMatrix_fx( inputIsm->rot_mat_prev ); +#endif set_zero( inputIsm->prev_pan_gains, MAX_OUTPUT_CHANNELS ); - +#ifdef IVAS_FLOAT_FIXED + set_zero_fx( inputIsm->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); +#endif inputIsm->hOMasa = NULL; @@ -2364,6 +2388,10 @@ static void clearInputIsm( freeInputBaseBufferData( &inputIsm->base.inputBuffer.data ); initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); +#ifdef IVAS_FLOAT_FIXED + freeInputBaseBufferData_fx( &inputIsm->base.inputBuffer.data_fx ); + initRendInputBase_fx( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); +#endif /* Free input's internal handles */ ivas_rend_closeCrend( &inputIsm->crendWrapper ); @@ -5031,7 +5059,7 @@ static ivas_error setRendInputActiveMasa( IF ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { inputMasa->metadataHasBeenFed = false; - IF ( ( error = masaPrerendOpen( &inputMasa->hMasaPrerend, EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA1) ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF ( ( error = masaPrerendOpen_fx( &inputMasa->hMasaPrerend, EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA1) ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) { return error; } @@ -5077,7 +5105,7 @@ static void clearInputMasa( freeInputBaseBufferData( &inputMasa->bufferData ); - masaPrerendClose( &inputMasa->hMasaPrerend ); + masaPrerendClose_fx( &inputMasa->hMasaPrerend ); freeMasaExtRenderer( &inputMasa->hMasaExtRend ); initRendInputBase( &inputMasa->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); @@ -5175,7 +5203,9 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); - +#ifdef IVAS_FLOAT_FIXED + initRendInputBase_fx( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); +#endif hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; @@ -5183,6 +5213,9 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; hIvasRend->inputsIsm[i].hOMasa = NULL; +#ifdef IVAS_FLOAT_FIXED + hIvasRend->inputsIsm[i].bufferData_fx = NULL; +#endif } for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) @@ -7801,7 +7834,7 @@ static void renderBufferChannelLerp_fx( /* Set output pointer to first output channel sample */ outSmpl = getSmplPtr_fx( outAudio, outChnlIdx, 0 ); - IF( gainsPrev == NULL || LE_32( abs( L_sub( previousGain, currentGain ) ), EPSILON_FX ) ) + IF( gainsPrev == NULL || LE_32( abs( L_sub( L_shr(previousGain,1), L_shr(currentGain,1) ) ), EPSILON_FX ) ) { /* If no interpolation from previous frame, apply current gain */ DO @@ -7818,6 +7851,18 @@ static void renderBufferChannelLerp_fx( Word32 tmp = Q31_BY_SUB_FRAME_240; SWITCH( outAudio.config.numSamplesPerChannel ) { + case NUM_SAMPLES_960: + tmp = Q31_BY_NUM_SAMPLES_960; + BREAK; + case NUM_SAMPLES_720: + tmp = Q31_BY_NUM_SAMPLES_720; + BREAK; + case NUM_SAMPLES_320: + tmp = Q31_BY_NUM_SAMPLES_320; + BREAK; + case NUM_SAMPLES_160: + tmp = Q31_BY_NUM_SAMPLES_160; + BREAK; case L_SUBFRAME_48k: tmp = Q31_BY_SUB_FRAME_240; BREAK; @@ -8490,26 +8535,26 @@ static int16_t getNumSubframesInBuffer( #ifdef IVAS_FLOAT_FIXED static ivas_error renderIsmToBinauralRoom( input_ism *ismInput, - IVAS_REND_AudioBuffer outAudio ) + IVAS_REND_AudioBuffer outAudio, + Word16 *exp ) { - int16_t position_changed; - int16_t i, j; - int16_t azi_rot, ele_rot; - int16_t subframe_idx; - int16_t tmp; - rotation_matrix Rmat; - float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word16 position_changed; + Word16 i, j; + Word32 azi_rot, ele_rot; + Word16 subframe_idx; + Word16 tmp; + rotation_matrix_fx Rmat; + Word32 tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; - pan_vector currentPanGains; - pan_vector_fx currentPanGains_fx; + pan_vector_fx currentPanGains; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_ISM_METADATA rotatedPosPrev; IVAS_ISM_METADATA rotatedPos; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; - int8_t combinedOrientationEnabled; - float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; + Word8 combinedOrientationEnabled; + Word32 *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpRendBuffer[i] = tmpRendBuffer[i]; } @@ -8521,147 +8566,143 @@ static ivas_error renderIsmToBinauralRoom( hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; - if ( hCombinedOrientationData != NULL ) + IF( hCombinedOrientationData != NULL ) { - for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) + FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { - if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) + IF( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { combinedOrientationEnabled = 1; - break; + BREAK; } } } - if ( combinedOrientationEnabled ) + IF( combinedOrientationEnabled ) { - for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) + FOR( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) { - for ( i = 0; i < 3; i++ ) + FOR( i = 0; i < 3; i++ ) { - if ( hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] ) + IF( hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] ) { - for ( j = 0; j < 3; j++ ) + FOR( j = 0; j < 3; j++ ) { - Rmat[i][j] = fixedToFloat_32( ( *hCombinedOrientationData )->Rmat_fx[subframe_idx][i][j], 30 ); + Rmat[i][j] = ( *hCombinedOrientationData )->Rmat_fx[subframe_idx][i][j]; + move32(); } } - else + ELSE { /* Set to identity */ - set_zero( Rmat[i], 3 ); - Rmat[i][i] = 1.0f; + set_zero_fx( Rmat[i], 3 ); + Rmat[i][i] = ONE_IN_Q30; + move32(); } } } } /* get previous position */ - if ( combinedOrientationEnabled ) + IF( combinedOrientationEnabled ) { - rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); - rotatedPosPrev.azimuth = (float) azi_rot; - rotatedPosPrev.elevation = (float) ele_rot; + rotateAziEle_fx_frac_az_el( ismInput->previousPos.azimuth_fx, ismInput->previousPos.elevation_fx, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); + rotatedPosPrev.azimuth_fx = azi_rot; + move32(); + rotatedPosPrev.elevation_fx = ele_rot; + move32(); } - else + ELSE { - rotatedPosPrev.azimuth = ismInput->previousPos.azimuth; - rotatedPosPrev.elevation = ismInput->previousPos.elevation; + rotatedPosPrev.azimuth_fx = ismInput->previousPos.azimuth_fx; + move32(); + rotatedPosPrev.elevation_fx = ismInput->previousPos.elevation_fx; + move32(); } /* get current position */ - if ( combinedOrientationEnabled ) + IF( combinedOrientationEnabled ) { - rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); - rotatedPos.azimuth = (float) azi_rot; - rotatedPos.elevation = (float) ele_rot; + rotateAziEle_fx_frac_az_el( ismInput->currentPos.azimuth_fx, ismInput->currentPos.elevation_fx, &azi_rot, &ele_rot, Rmat, 0 ); + rotatedPos.azimuth_fx = azi_rot; + move32(); + rotatedPos.elevation_fx = ele_rot; + move32(); } - else + ELSE { - rotatedPos.azimuth = ismInput->currentPos.azimuth; - rotatedPos.elevation = ismInput->currentPos.elevation; + rotatedPos.azimuth_fx = ismInput->currentPos.azimuth_fx; + move32(); + rotatedPos.elevation_fx = ismInput->currentPos.elevation_fx; + move32(); } - position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &rotatedPos, &rotatedPosPrev ); + position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged_fx( &rotatedPos, &rotatedPosPrev ); /* set previous gains if this is the first frame */ - /*float2fix to be removed*/ - Word32 azimuth_fx_tmp = floatToFixed( rotatedPosPrev.azimuth, Q22 ); - Word32 elevation_fx_tmp = floatToFixed( rotatedPosPrev.elevation, Q22 ); - if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, azimuth_fx_tmp, elevation_fx_tmp, ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) + IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, rotatedPosPrev.azimuth_fx, rotatedPosPrev.elevation_fx, ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) { return error; } - /* fix2float to be removed */ - fixedToFloat_arrL( ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS ); + /* compute gains only if position changed */ - if ( position_changed ) + IF( position_changed ) { - /*float2fix to be removed*/ - azimuth_fx_tmp = floatToFixed( rotatedPos.azimuth, Q22 ); - elevation_fx_tmp = floatToFixed( rotatedPos.elevation, Q22 ); - if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - azimuth_fx_tmp, - elevation_fx_tmp, - currentPanGains_fx ) ) != IVAS_ERR_OK ) + IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + rotatedPos.azimuth_fx, + rotatedPos.elevation_fx, + currentPanGains ) ) != IVAS_ERR_OK ) { return error; } - /* fix2float to be removed */ - fixedToFloat_arrL( currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS ); } /* intermediate rendering to 7_1_4 */ tmpMcBuffer = ismInput->base.inputBuffer; - if ( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + IF( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) { return error; } tmpMcBuffer.config.numChannels = tmp; - tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); - set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); + move16(); + tmpMcBuffer.data_fx = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( Word32 ) ); + set_zero_fx( tmpMcBuffer.data_fx, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); - renderBufferChannelLerp( ismInput->base.inputBuffer, 0, - position_changed ? currentPanGains : ismInput->prev_pan_gains, - position_changed ? ismInput->prev_pan_gains : NULL, - tmpMcBuffer ); + renderBufferChannelLerp_fx( ismInput->base.inputBuffer, 0, + position_changed ? currentPanGains : ismInput->prev_pan_gains_fx, + position_changed ? ismInput->prev_pan_gains_fx : NULL, + tmpMcBuffer ); - copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); + copyBufferTo2dArray_fx( tmpMcBuffer, tmpRendBuffer ); /* save gains for next frame */ - for ( i = 0; i < 3; i++ ) + FOR( i = 0; i < 3; i++ ) { - mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); + Copy32( Rmat[i], ismInput->rot_mat_prev[i], 3 ); } - if ( position_changed ) + IF( position_changed ) { - mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); + Copy32( currentPanGains, ismInput->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); } // Crend_process porting - Word16 nchan_out = 2, nchan_in = 12, subframe_len; + Word16 nchan_in = 12, subframe_len; + move16(); CREND_HANDLE hCrend; - Word32 output_buffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 *output_fx[MAX_OUTPUT_CHANNELS]; hCrend = ismInput->crendWrapper->hCrend; subframe_len = (Word16) ( *ismInput->base.ctx.pOutSampleRate / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); - Word16 gd_bits = find_guarded_bits_fx( subframe_len ); - Word16 exp = 15; - exp -= gd_bits; + move16(); Word16 nchan = nchan_in; - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - output_fx[i] = output_buffer_fx[i]; - } - if ( hCrend->reflections != NULL ) + move16(); + IF( hCrend->reflections != NULL ) { - if ( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) + IF( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) { - nchan = hCrend->reflections->shoebox_data.n_sources + 1; - for ( i = 0; i < 150; i++ ) + nchan = add( hCrend->reflections->shoebox_data.n_sources, 1 ); + FOR( i = 0; i < 150; i++ ) { hCrend->reflections->shoebox_data.gains.data_fx[i] = L_shl( hCrend->reflections->shoebox_data.gains.data_fx[i], 9 ); } @@ -8669,38 +8710,24 @@ static ivas_error renderIsmToBinauralRoom( } nchan = nchan_in; - for ( i = 0; i < nchan; i++ ) - { - for ( j = 0; j < L_FRAME48k; j++ ) - { + move16(); - output_fx[i][j] = (Word32) float_to_fix( p_tmpRendBuffer[i][j], exp ); - } - } /* render 7_1_4 with BRIRs */ - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, output_fx, *ismInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) { return error; } - if ( hCrend->hReverb != NULL ) + IF( hCrend->hReverb != NULL ) { - exp -= 2; + *exp = sub( *exp, 2 ); } - for ( i = 0; i < nchan_out; i++ ) - { - - for ( j = 0; j < L_FRAME48k; j++ ) - { + accumulate2dArrayToBuffer_fx( tmpRendBuffer, &outAudio ); - p_tmpRendBuffer[i][j] = fix_to_float( output_fx[i][j], exp ); - } - } - accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); + free( tmpMcBuffer.data_fx ); - free( tmpMcBuffer.data ); pop_wmops(); return IVAS_ERR_OK; @@ -8901,92 +8928,94 @@ static ivas_error renderIsmToMc( const IVAS_REND_AudioBuffer outAudio ) { int8_t position_changed; - pan_vector currentPanGains; pan_vector_fx currentPanGains_fx; ivas_error error; push_wmops( "renderIsmToMc" ); + ismInput->currentPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->currentPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + ismInput->currentPos.elevation_fx = L_shl( L_shr( L_add( ismInput->currentPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + ismInput->previousPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->previousPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + ismInput->previousPos.elevation_fx = L_shl( L_shr( L_add( ismInput->previousPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); - if ( *ismInput->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_STEREO ) + IF ( *ismInput->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_STEREO ) { - if ( ismInput->nonDiegeticPan ) + IF ( ismInput->nonDiegeticPan ) { - ismInput->prev_pan_gains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; - ismInput->prev_pan_gains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; + currentPanGains_fx[0] = L_add(L_shr(ismInput->nonDiegeticPanGain_fx,1),ONE_IN_Q30); + currentPanGains_fx[1] = L_sub(ONE_IN_Q31, currentPanGains_fx[0]); + ismInput->prev_pan_gains_fx[0] = currentPanGains_fx[0]; //Q31 + ismInput->prev_pan_gains_fx[1] = currentPanGains_fx[1]; //Q31 } - else + ELSE { - set_zero( currentPanGains, MAX_OUTPUT_CHANNELS ); + set32_fx( currentPanGains_fx, 0,MAX_OUTPUT_CHANNELS ); Word16 gains_fx[2]; - ivas_ism_get_stereo_gains_fx( (Word16) ismInput->currentPos.azimuth, (Word16) ismInput->currentPos.elevation, &gains_fx[0], &gains_fx[1] ); - currentPanGains[0] = (float) gains_fx[0] / 32768.f; - currentPanGains[1] = (float) gains_fx[1] / 32768.f; + Word16 azimuth_tmp, elevation_tmp; - set_zero( ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); - ivas_ism_get_stereo_gains_fx( (Word16) ismInput->previousPos.azimuth, (Word16) ismInput->previousPos.elevation, &gains_fx[0], &gains_fx[1] ); - ismInput->prev_pan_gains[0] = (float) gains_fx[0] / 32768.f; - ismInput->prev_pan_gains[1] = (float) gains_fx[1] / 32768.f; + azimuth_tmp = extract_l( L_shr( ismInput->currentPos.azimuth_fx, Q22 ) ); + elevation_tmp = extract_l( L_shr( ismInput->currentPos.elevation_fx, Q22 ) ); + + ivas_ism_get_stereo_gains_fx( azimuth_tmp, elevation_tmp, &gains_fx[0], &gains_fx[1] ); + currentPanGains_fx[0] = L_deposit_h( gains_fx[0] ); //Q31 + currentPanGains_fx[1] = L_deposit_h( gains_fx[1] ); //Q31 + + azimuth_tmp = extract_l( L_shr( ismInput->previousPos.azimuth_fx, Q22 ) ); + elevation_tmp = extract_l( L_shr( ismInput->previousPos.elevation_fx, Q22 ) ); + + set32_fx( ismInput->prev_pan_gains_fx, 0, MAX_OUTPUT_CHANNELS ); + ivas_ism_get_stereo_gains_fx( azimuth_tmp, elevation_tmp, &gains_fx[0], &gains_fx[1] ); + ismInput->prev_pan_gains_fx[0] = L_deposit_h( gains_fx[0] ); //Q31 + ismInput->prev_pan_gains_fx[1] = L_deposit_h( gains_fx[1] ); //Q31 } } - else + ELSE { /* compute gains only if position changed */ - if ( position_changed ) + IF ( position_changed ) { // TODO tmu review when #215 is resolved - /*float2fix to be removed*/ - Word32 azimuth_fx_tmp = (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ); - azimuth_fx_tmp = azimuth_fx_tmp << 22; - Word32 elevation_fx_tmp = (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ); - elevation_fx_tmp = elevation_fx_tmp << 22; - if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - azimuth_fx_tmp, - elevation_fx_tmp, + IF ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + ismInput->currentPos.azimuth_fx, + ismInput->currentPos.elevation_fx, currentPanGains_fx ) ) != IVAS_ERR_OK ) { return error; } - /* fix2float to be removed */ - fixedToFloat_arrL( currentPanGains_fx, currentPanGains, Q31, MAX_OUTPUT_CHANNELS ); } /* set previous gains if this is the first frame */ - if ( !ismInput->firstFrameRendered ) + IF( !ismInput->firstFrameRendered ) { // TODO tmu review when #215 is resolved - /*float2fix to be removed*/ - Word32 azimuth_fx_tmp = (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ); - azimuth_fx_tmp = azimuth_fx_tmp << 22; - Word32 elevation_fx_tmp = (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ); - elevation_fx_tmp = elevation_fx_tmp << 22; - if ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - azimuth_fx_tmp, - elevation_fx_tmp, + IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + ismInput->previousPos.azimuth_fx, + ismInput->previousPos.elevation_fx, ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) { return error; } /* fix2float to be removed */ - fixedToFloat_arrL( ismInput->prev_pan_gains_fx, ismInput->prev_pan_gains, Q31, MAX_OUTPUT_CHANNELS ); } } /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ - renderBufferChannelLerp( ismInput->base.inputBuffer, 0, - position_changed ? currentPanGains : ismInput->prev_pan_gains, - position_changed ? ismInput->prev_pan_gains : NULL, + renderBufferChannelLerp_fx( ismInput->base.inputBuffer, 0, + position_changed ? currentPanGains_fx : ismInput->prev_pan_gains_fx, + position_changed ? ismInput->prev_pan_gains_fx : NULL, outAudio ); - if ( position_changed ) + IF( position_changed ) { - mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); + Copy32( currentPanGains_fx, ismInput->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); } pop_wmops(); + return IVAS_ERR_OK; } #else @@ -9065,7 +9094,89 @@ static ivas_error renderIsmToMc( return IVAS_ERR_OK; } #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error renderIsmToSba( + input_ism *ismInput, + const AUDIO_CONFIG outConfig, + const IVAS_REND_AudioBuffer outAudio ) +{ + Word16 i; + Word8 position_changed; + Word16 ambiOrderOut; + Word16 numOutChannels; + pan_vector_fx currentPanGains_fx; + ivas_error error; + error = IVAS_ERR_OK; + + ismInput->currentPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->currentPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + ismInput->currentPos.elevation_fx = L_shl( L_shr( L_add( ismInput->currentPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + ismInput->previousPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->previousPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + ismInput->previousPos.elevation_fx = L_shl( L_shr( L_add( ismInput->previousPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + + push_wmops( "renderIsmToSba" ); + + IF ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + IF ( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ) != IVAS_ERR_OK ) + { + return error; + } + + position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); + + /* set previous gains if this is the first frame */ + Word16 azimuth_tmp, elevation_tmp; + IF ( !ismInput->firstFrameRendered ) + { + // TODO tmu review when #215 is resolved + azimuth_tmp = extract_l(L_shr( ismInput->previousPos.azimuth_fx, Q22 )); + elevation_tmp = extract_l(L_shr( ismInput->previousPos.elevation_fx, Q22 )); + ivas_dirac_dec_get_response_fixed( azimuth_tmp, + elevation_tmp, + ismInput->prev_pan_gains_fx, + ambiOrderOut ); + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + ismInput->prev_pan_gains_fx[i] = L_shl_sat( ismInput->prev_pan_gains_fx[i], Q2 ); + } + } + + /* compute gains only if position changed */ + IF( position_changed ) + { + // TODO tmu review when #215 is resolved + azimuth_tmp = extract_l(L_shr( ismInput->currentPos.azimuth_fx, Q22 )); + elevation_tmp = extract_l(L_shr( ismInput->currentPos.elevation_fx, Q22 )); + ivas_dirac_dec_get_response_fixed( azimuth_tmp, + elevation_tmp, + currentPanGains_fx, + ambiOrderOut ); + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + currentPanGains_fx[i] = L_shl_sat( currentPanGains_fx[i], Q2 ); + } + } + + /* Assume num channels in audio buffer to be 1. + * This should have been validated in IVAS_REND_FeedInputAudio() */ + renderBufferChannelLerp_fx( ismInput->base.inputBuffer, 0, + position_changed ? currentPanGains_fx : ismInput->prev_pan_gains_fx, + position_changed ? ismInput->prev_pan_gains_fx : NULL, + outAudio ); + + IF ( position_changed ) + { + Copy32( currentPanGains_fx, ismInput->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); + //mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); + } + pop_wmops(); + + return error; +} +#else static ivas_error renderIsmToSba( input_ism *ismInput, const AUDIO_CONFIG outConfig, @@ -9127,65 +9238,72 @@ static ivas_error renderIsmToSba( return error; } +#endif - +#ifdef IVAS_FLOAT_FIXED static void renderIsmToMasa( input_ism *ismInput, - IVAS_REND_AudioBuffer outAudio ) + IVAS_REND_AudioBuffer outAudio, + Word16 *exp ) { - float tmpRendBuffer[MAX_NUM_OBJECTS][L_FRAME48k]; -#ifdef IVAS_FLOAT_FIXED Word32 tmpRendBuffer_fx[MAX_NUM_OBJECTS][L_FRAME48k]; Word16 i, j; Word16 q_fact; -#endif push_wmops( "renderIsmToMasa" ); - copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); -#ifdef IVAS_FLOAT_FIXED + copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpRendBuffer_fx ); Word16 input_e[MAX_NUM_OBJECTS], max_e; + FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { - f2me_buf( tmpRendBuffer[i], tmpRendBuffer_fx[i], &input_e[i], L_FRAME48k ); + input_e[i] = sub( 31, add( getScaleFactor32( tmpRendBuffer_fx[i], L_FRAME48k ), 8 ) ); + move16(); } Word16 guard_bits = find_guarded_bits_fx( L_FRAME48k ); max_e = input_e[0]; - FOR ( i = 1; i < MAX_NUM_OBJECTS; i++) + FOR( Word16 i = 1; i < MAX_NUM_OBJECTS; i++ ) { IF( max_e < input_e[0] ) max_e = input_e[i]; + move16(); } FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { FOR( j = 0; j < L_FRAME48k; j++ ) { - tmpRendBuffer_fx[i][j] = L_shr( tmpRendBuffer_fx[i][j], max_e - input_e[i] + guard_bits ); + tmpRendBuffer_fx[i][j] = L_shr( tmpRendBuffer_fx[i][j], add( sub( max_e, sub( 31, Q8 ) ), guard_bits ) ); + move32(); } } - max_e += guard_bits; - q_fact = 31 - max_e; -#endif -#ifdef IVAS_FLOAT_FIXED - ivas_omasa_ana_fx(ismInput->hOMasa, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels); + max_e = add( max_e, guard_bits ); + q_fact = sub( 31, max_e ); - FOR( Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) - { - FOR( Word16 band_m_idx = 0; band_m_idx < ismInput->hOMasa->nbands; band_m_idx++ ) - { - ismInput->hOMasa->energy[block_m_idx][band_m_idx] = fixedToFloat( ismInput->hOMasa->energy_fx[block_m_idx][band_m_idx], ismInput->hOMasa->energy_q ); - } - } - FOR( i = 0; i < ismInput->base.inputBuffer.config.numChannels; i++) { - fixedToFloat_arrL(tmpRendBuffer_fx[i], tmpRendBuffer[i], q_fact, L_FRAME48k ); - } + ivas_omasa_ana_fx( ismInput->hOMasa, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels ); + + *exp = q_fact; + accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); + + pop_wmops(); + + return; +} #else +static void renderIsmToMasa( + input_ism *ismInput, + IVAS_REND_AudioBuffer outAudio ) +{ + float tmpRendBuffer[MAX_NUM_OBJECTS][L_FRAME48k]; + + push_wmops( "renderIsmToMasa" ); + + copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); + ivas_omasa_ana( ismInput->hOMasa, tmpRendBuffer, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels ); -#endif accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); @@ -9193,7 +9311,7 @@ static void renderIsmToMasa( return; } - +#endif static ivas_error renderInputIsm( input_ism *ismInput, @@ -9202,6 +9320,10 @@ static ivas_error renderInputIsm( { ivas_error error; IVAS_REND_AudioBuffer inAudio; +#ifdef IVAS_FLOAT_FIXED + Word16 exp = 8; + move16(); +#endif error = IVAS_ERR_OK; inAudio = ismInput->base.inputBuffer; @@ -9222,13 +9344,54 @@ static ivas_error renderInputIsm( /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *ismInput->base.ctx.pCombinedOrientationData ); +#ifdef IVAS_FLOAT_FIXED + ismInput->previousPos.azimuth_fx = (Word32) ( ismInput->previousPos.azimuth * ONE_IN_Q22 ); + move32(); + ismInput->previousPos.elevation_fx = (Word32) ( ismInput->previousPos.elevation * ONE_IN_Q22 ); + move32(); + ismInput->currentPos.azimuth_fx = (Word32) ( ismInput->currentPos.azimuth * ONE_IN_Q22 ); + move32(); + ismInput->currentPos.elevation_fx = (Word32) ( ismInput->currentPos.elevation * ONE_IN_Q22 ); + move32(); + + fixedToFloat_arrL(ismInput->base.inputBuffer.data_fx, ismInput->base.inputBuffer.data,Q8, ismInput->base.inputBuffer.config.numSamplesPerChannel*ismInput->base.inputBuffer.config.numChannels); + + floatToFixed_arrL( ismInput->prev_pan_gains, ismInput->prev_pan_gains_fx, Q31, MAX_OUTPUT_CHANNELS ); + ismInput->nonDiegeticPanGain_fx = floatToFixed_32( ismInput->nonDiegeticPanGain, Q31 ); + +#endif + switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: +#ifdef IVAS_FLOAT_FIXED + error = renderIsmToMc( ismInput, outAudio ); + FOR( Word32 i = 0; i < 16; i++ ) + { + ismInput->prev_pan_gains[i] = (float) ismInput->prev_pan_gains_fx[i] / ( ONE_IN_Q31 ); + } + FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) + { + outAudio.data[i] = ( (float) outAudio.data_fx[i] / ONE_IN_Q8 ); + } +#else error = renderIsmToMc( ismInput, outAudio ); +#endif break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: +#ifdef IVAS_FLOAT_FIXED + error = renderIsmToSba( ismInput, outConfig, outAudio ); + FOR( Word32 i = 0; i < 16; i++ ) + { + ismInput->prev_pan_gains[i] = (float) ismInput->prev_pan_gains_fx[i] / ( ONE_IN_Q31 ); + } + FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) + { + outAudio.data[i] = ( (float) outAudio.data_fx[i] / ONE_IN_Q8 ); + } +#else error = renderIsmToSba( ismInput, outConfig, outAudio ); +#endif break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) @@ -9237,7 +9400,19 @@ static ivas_error renderInputIsm( error = renderIsmToBinaural( ismInput, outAudio ); break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: +#ifdef IVAS_FLOAT_FIXED + error = renderIsmToBinauralRoom( ismInput, outAudio, &exp ); + FOR( Word32 i = 0; i < 16; i++ ) + { + ismInput->prev_pan_gains[i] = (float) ismInput->prev_pan_gains_fx[i] / ( ONE_IN_Q31 ); + } + FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) + { + outAudio.data[i] = ( (float) outAudio.data_fx[i] / ( 1 << exp ) ); + } +#else error = renderIsmToBinauralRoom( ismInput, outAudio ); +#endif break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: error = renderIsmToBinauralReverb( ismInput, outAudio ); @@ -9247,8 +9422,23 @@ static ivas_error renderInputIsm( } break; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: +#ifdef IVAS_FLOAT_FIXED + renderIsmToMasa( ismInput, outAudio, &exp ); + FOR( Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + FOR( Word16 band_m_idx = 0; band_m_idx < ismInput->hOMasa->nbands; band_m_idx++ ) + { + ismInput->hOMasa->energy[block_m_idx][band_m_idx] = fixedToFloat( ismInput->hOMasa->energy_fx[block_m_idx][band_m_idx], ismInput->hOMasa->energy_q ); + } + } + FOR( Word32 i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) + { + outAudio.data[i] = ( (float) outAudio.data_fx[i] / ( 1 << exp ) ); + } +#else renderIsmToMasa( ismInput, outAudio ); - break; +#endif + break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 9f5695c48..95a6dbfd5 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -84,6 +84,7 @@ typedef struct Word16 *pq_fact; float *data; Word32 *data_fx; + Word16 Q_data; } IVAS_REND_AudioBuffer; #endif -- GitLab From 8881f1e2fac7a7781feb734b9e2b9cac9b40c5f3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 14:51:50 +0530 Subject: [PATCH 048/101] LTV crash Fixes, bug-fix in acelp_core_dec_ivas_fx [x] Below LTV issues are addressed: [stereo bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out] [4 ISM with extended metadata and non diegetic pan object switching bitrate 256 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out] [MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, HR, exo] [MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, HR, OT, exo] [MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, HR, OT] [MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out, HR] [MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM IR out] [x] Fixes a bug related to Copy_Scale_sig_16_32 in acelp_core_dec_ivas_fx [x] Added changes for accomodating variable Q inside decoder_tcx_imdct function --- lib_com/ivas_prot.h | 12 +++ lib_com/ivas_stereo_td_bit_alloc.c | 2 +- lib_com/ivas_tools.c | 121 +++++++++++++++++++++++++ lib_com/prot_fx2.h | 3 +- lib_dec/acelp_core_dec_ivas_fx.c | 4 +- lib_dec/dec_tcx.c | 8 +- lib_dec/dec_tcx_fx.c | 41 ++++----- lib_dec/ivas_qmetadata_dec.c | 16 ++-- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 15 +-- lib_rend/ivas_objectRenderer_sources.c | 26 +++++- 10 files changed, 198 insertions(+), 50 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b8469c0f1..b5522fb5d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4763,6 +4763,18 @@ Word16 matrix_product_fx( Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ ); +Word16 matrix_product_q30_fx( + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ +); + Word16 matrix_product_mant_exp( const Word32 *X_fx, /* i : left hand matrix */ const Word16 *X_e, /* i : left hand matrix */ diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 3f648bee3..84aaff86c 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -509,7 +509,7 @@ void tdm_bit_alloc( IF( coder_type == INACTIVE ) { Word32 res_fix = 0; - res_fix = Mpy_32_32(644245094, ( element_brate_wo_meta - 500 ) ); + res_fix = Mpy_32_32(644245095, ( element_brate_wo_meta - 500 ) ); res_fix = ( ( res_fix / 100 ) * 100 ); *total_brate_sec = max( *total_brate_sec, res_fix ); diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index 9d5dd4419..49b1fea1d 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -1354,6 +1354,127 @@ Word16 matrix_product_fx( return EXIT_SUCCESS; } +Word16 matrix_product_q30_fx( + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ +) +{ + Word16 i, j, k; + Word32 *Zp_fx = Z_fx; + Word64 W_tmp; + + /* Processing */ + test(); + test(); + test(); + IF( EQ_16( transpX, 1 ) && EQ_16( transpY, 0 ) ) /* We use X transpose */ + { + IF( NE_16( rowsX, rowsY ) ) + { + return EXIT_FAILURE; + } + FOR( j = 0; j < colsY; ++j ) + { + FOR( i = 0; i < colsX; ++i ) + { + //( *Zp_fx ) = 0; + W_tmp = 0; + move64(); + FOR( k = 0; k < rowsX; ++k ) + { + //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) ); + W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ) );//Q56 + } + W_tmp = W_shl( W_tmp, 6 ); + ( *Zp_fx ) = L_sub(W_round64_L( W_tmp ), 64); //adjusting for precision + Zp_fx++; + } + } + } + ELSE IF( EQ_16( transpX, 0 ) && EQ_16( transpY, 1 ) ) /* We use Y transpose */ + { + IF( NE_16( colsX, colsY ) ) + { + return EXIT_FAILURE; + } + FOR( j = 0; j < rowsY; ++j ) + { + FOR( i = 0; i < rowsX; ++i ) + { + //( *Zp_fx ) = 0; + W_tmp = 0; + move64(); + FOR( k = 0; k < colsX; ++k ) + { + //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); + W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ) ); // Q56 + } + W_tmp = W_shl( W_tmp, 6 ); + ( *Zp_fx ) = L_sub( W_round64_L( W_tmp ), 64 ); // adjusting for precision + Zp_fx++; + } + } + } + ELSE IF( EQ_16( transpX, 1 ) && EQ_16( transpY, 1 ) ) /* We use both transpose */ + { + IF( NE_16( rowsX, colsY ) ) + { + return EXIT_FAILURE; + } + FOR( j = 0; j < rowsY; ++j ) + { + FOR( i = 0; i < colsX; ++i ) + { + //( *Zp_fx ) = 0; + W_tmp = 0; + move64(); + FOR( k = 0; k < colsX; ++k ) + { + //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); + W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ) ); // Q56 + } + + W_tmp = W_shl( W_tmp, 6 ); + ( *Zp_fx ) = L_sub( W_round64_L( W_tmp ), 64 ); // adjusting for precision + Zp_fx++; + } + } + } + ELSE /* Regular case */ + { + IF( NE_16( colsX, rowsY ) ) + { + return EXIT_FAILURE; + } + + FOR( j = 0; j < colsY; ++j ) + { + FOR( i = 0; i < rowsX; ++i ) + { + //( *Zp_fx ) = 0; + W_tmp = 0; + move64(); + FOR( k = 0; k < colsX; ++k ) + { + //( *Zp_fx ) = L_add( *Zp_fx, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); + W_tmp = W_add( W_tmp, W_mult0_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ) ); // Q56 + } + W_tmp = W_shl( W_tmp, 6 ); + ( *Zp_fx ) = L_sub( W_round64_L( W_tmp ), 64 ); // adjusting for precision + Zp_fx++; + } + } + } + + return EXIT_SUCCESS; +} /*takes input matrices in mantissa and exponent forms*/ Word16 matrix_product_mant_exp( const Word32 *X_fx, /* i : left hand matrix */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 2c8c19d58..100904a3f 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -9287,7 +9287,8 @@ void IMDCT_ivas_fx( const Word16 FB_flag, Decoder_State *st, const Word16 fullbandScale, - Word16 *acelp_zir_fx); + Word16 *acelp_zir_fx, + Word16 q_win); void v_mult16_fixed( const Word16 x1[], /* i : Input vector 1 */ diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 4b1940cff..b7de77632 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1869,9 +1869,9 @@ ivas_error acelp_core_dec_ivas_fx( psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &tmp_exp, st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode, st->element_mode ); #ifdef MSAN_FIX - Copy_Scale_sig_16_32(synth_fx16, synth_fx, 0, output_frame); + Copy_Scale_sig_16_32(synth_fx16, synth_fx, output_frame, 0); #else - Copy_Scale_sig_16_32(synth_fx16, synth_fx, 0, L_FRAME48k); + Copy_Scale_sig_16_32(synth_fx16, synth_fx, L_FRAME48k, 0); #endif IF( st->hBWE_FD != NULL ) diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 92c25ad45..dabf190f2 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -2071,7 +2071,7 @@ void decoder_tcx_imdct_fx( IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf_fx, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, - kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr(s_max( L_frameTCX, L_spec ), 1), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx ); + kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr(s_max( L_frameTCX, L_spec ), 1), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win ); } /* Generate additional comfort noise to mask potential coding artefacts */ @@ -2088,7 +2088,7 @@ void decoder_tcx_imdct_fx( mvl2l( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf_fx, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, - kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr(s_max( L_frameTCX, L_spec ), 1), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx ); + kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr(s_max( L_frameTCX, L_spec ), 1), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win ); } FOR(Word16 ind = 0; ind < L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX; ind++) { @@ -2098,13 +2098,13 @@ void decoder_tcx_imdct_fx( { IMDCT_ivas_fx( x_tmp_fx, q_x, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB_fx_16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, - kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir_fx ); + kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir_fx, q_win ); } ELSE { IMDCT_ivas_fx( x_fx, q_x, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB_fx_16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, - kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir_fx ); + kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir_fx, q_win ); } FOR(Word16 ind = 0; ind < L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX; ind++) { xn_bufFB_fx[ind] = L_shl(xn_bufFB_fx_16[ind], (q_x - q_win)); diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 9544cd186..a841e75e9 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -2805,15 +2805,15 @@ void IMDCT_ivas_fx( const Word16 FB_flag, Decoder_State *st, const Word16 fullbandScale, - Word16 *acelp_zir_fx) //Q(-2) + Word16 *acelp_zir_fx, + Word16 q_win) //Q(-2) { int16_t i, nz, aldo, w, L_win, L_ola; Word16 win_fx[(L_FRAME_PLUS + L_MDCT_OVLP_MAX) / 2]; TCX_DEC_HANDLE hTcxDec = st->hTcxDec; TCX_CONFIG_HANDLE hTcxCfg = st->hTcxCfg; - Word16 q_win, x_e_hdrm; - x_e_hdrm = 3; - q_win = q_x + x_e_hdrm - 16; + Word16 x_e_hdrm; + x_e_hdrm = add(q_win, sub(Q16, q_x)); aldo = 0; @@ -3601,7 +3601,7 @@ void decoder_tcx_ivas_fx( Word16 xn_buf_fx[L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX]; /* Q14 */ Word16 shift; Word16 x_len; - Word16 q_x = Q11, q_win = -2; + Word16 q_x = Q11; set32_fx( x_fx, 0, N_MAX ); set16_fx( gainlpc2_fx, 0, FDNS_NPTS ); @@ -3646,7 +3646,7 @@ void decoder_tcx_ivas_fx( decoder_tcx_tns_fx( st, L_frame_glob, L_spec, L_frame, L_frameTCX, x_fx, fUseTns, &tnsData, bfi, frame_cnt, 0 ); Scale_sig32( x_fx, N_MAX, sub( x_e, 20 ) ); // Scaling x_fx to Q11 - Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, -16 ); // Scaling xn_buf_fx to Q-2 + Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, st->Q_syn - 14 ); // Scaling xn_buf_fx to Q_syn x_e = sub( 31, 11 ); move16(); @@ -3657,30 +3657,23 @@ void decoder_tcx_ivas_fx( } /* Scaling down buffers for decoder_tcx_imdct_fx*/ - Scale_sig( st->hTcxDec->syn_Overl, 320, -( st->Q_syn + 1 + 2 ) ); // Scaling to Q-2 - Scale_sig( st->hTcxDec->syn_Overl_TDAC, 320, -( st->Q_syn + 2 ) ); // Scaling to Q-2 - Scale_sig( st->hTcxDec->syn_Overl_TDACFB, 480, -( st->Q_syn + 2 ) ); // Scaling to Q-2 - Scale_sig( st->hTcxDec->syn_OverlFB, 480, -( st->Q_syn + 2 ) ); // Scaling to Q-2 - Scale_sig( st->hTcxDec->old_syn_Overl, 320, -( st->Q_syn + 1 + 0 ) ); // Scaling to Q-2 - Scale_sig( st->hHQ_core->old_out_LB_fx, 640, -( st->Q_syn + 2 ) ); // Scaling to Q-2 - Scale_sig( st->hHQ_core->old_out_fx, 960, -( st->Q_syn + 2 ) ); // Scaling to Q-2 - + Scale_sig( st->hTcxDec->syn_Overl, 320, -1 ); // Scaling to Q_syn + Scale_sig( st->hTcxDec->old_syn_Overl, 320, 1 ); // Scaling to Q_syn Copy_Scale_sig_16_32_no_sat( st->old_Aq_12_8_fx, st->old_Aq_12_8_fx_32, M + 1, ( 28 - ( 15 - norm_s( st->old_Aq_12_8_fx[0] - 1 ) ) ) ); - Scale_sig( synth_fx, L_frame_glob, -2 ); // Scaling to Q-2 - Scale_sig( synthFB_fx, L_frameTCX_glob, -2 ); // Scaling to Q-2 + Scale_sig( synth_fx, L_frame_glob, st->Q_syn ); // Scaling to Q_syn + Scale_sig( synthFB_fx, L_frameTCX_glob, st->Q_syn ); // Scaling to Q_syn - decoder_tcx_imdct_fx( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x_fx[0], q_x, xn_buf_fx, q_win, MDCT_IV, + decoder_tcx_imdct_fx( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x_fx[0], q_x, xn_buf_fx, st->Q_syn, MDCT_IV, fUseTns, &synth_fx[0], &synthFB_fx[0], bfi, frame_cnt, sba_dirac_stereo_flag ); /* Scaling up again */ - Scale_sig( synth_fx, L_frame_glob, 2 ); - Scale_sig( synthFB_fx, L_frameTCX_glob, 2 ); - Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, ( st->Q_syn + 2 ) ); - Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, ( st->Q_syn + 1 + 2 ) ); - Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, ( st->hHQ_core->Q_old_wtda + 2 ) ); - Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, ( st->hHQ_core->Q_old_wtda + 2 ) ); - //Scale_sig( st->hTcxDec->old_syn_Overl, 320, ( st->Q_syn + 1 + 2 ) ); // Scaling to Q-2 + Scale_sig( synth_fx, L_frame_glob, negate(st->Q_syn) ); + Scale_sig( synthFB_fx, L_frameTCX_glob, negate(st->Q_syn) ); + Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, 1 ); + Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, ( st->hHQ_core->Q_old_wtda - st->Q_syn ) ); + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, ( st->hHQ_core->Q_old_wtda - st->Q_syn ) ); + Scale_sig( st->hTcxDec->old_syn_Overl, 320, ( -2 + st->Q_syn ) ); // Scaling to Q-2 } #endif diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index f7094db3d..fc870092a 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -8562,28 +8562,28 @@ void ivas_omasa_decode_masa_to_total_fx( SWITCH( len_stream ) { case 4: - matrix_product_fx( dct4_fx, nblocks, nblocks, 1, q_dct_data_fx, nblocks, 1, 0, dct_data_tmp_fx ); + matrix_product_q30_fx( dct4_fx, nblocks, nblocks, 1, q_dct_data_fx, nblocks, 1, 0, dct_data_tmp_fx ); Copy32( dct_data_tmp_fx, q_dct_data_fx, nblocks ); BREAK; case 5: - matrix_product_fx( dct5_fx, nbands, nbands, 1, q_dct_data_fx, nbands, 1, 0, dct_data_tmp_fx ); + matrix_product_q30_fx( dct5_fx, nbands, nbands, 1, q_dct_data_fx, nbands, 1, 0, dct_data_tmp_fx ); Copy32( dct_data_tmp_fx, q_dct_data_fx, nbands ); BREAK; case 8: - matrix_product_fx( dct8_fx, nbands, nbands, 1, q_dct_data_fx, nbands, 1, 0, dct_data_tmp_fx ); + matrix_product_q30_fx( dct8_fx, nbands, nbands, 1, q_dct_data_fx, nbands, 1, 0, dct_data_tmp_fx ); Copy32( dct_data_tmp_fx, q_dct_data_fx, nbands ); BREAK; case 12: - matrix_product_fx( dct12_fx, nbands, nbands, 1, q_dct_data_fx, nbands, 1, 0, dct_data_tmp_fx ); + matrix_product_q30_fx( dct12_fx, nbands, nbands, 1, q_dct_data_fx, nbands, 1, 0, dct_data_tmp_fx ); Copy32( dct_data_tmp_fx, q_dct_data_fx, nbands ); BREAK; case 20: matrix_product_fx( dct5_fx, nbands, nbands, 1, q_dct_data_fx, nbands, nblocks, 0, dct_data_tmp_fx ); - matrix_product_fx( dct_data_tmp_fx, nbands, nblocks, 0, dct4_fx, nblocks, nblocks, 0, q_dct_data_fx ); /* reuse of variable*/ + matrix_product_q30_fx( dct_data_tmp_fx, nbands, nblocks, 0, dct4_fx, nblocks, nblocks, 0, q_dct_data_fx ); /* reuse of variable*/ BREAK; case 32: matrix_product_fx( dct8_fx, nbands, nbands, 1, q_dct_data_fx, nbands, nblocks, 0, dct_data_tmp_fx ); - matrix_product_fx( dct_data_tmp_fx, nbands, nblocks, 0, dct4_fx, nblocks, nblocks, 0, q_dct_data_fx ); + matrix_product_q30_fx( dct_data_tmp_fx, nbands, nblocks, 0, dct4_fx, nblocks, nblocks, 0, q_dct_data_fx ); BREAK; default: printf( "Incorrect number of coefficients for OMASA.\n" ); @@ -8595,7 +8595,9 @@ void ivas_omasa_decode_masa_to_total_fx( { FOR( j = 0; j < nbands; j++ ) { - masa_to_total_energy_ratio_fx[i][j] = L_max( 0, L_shr( L_shl_sat( q_dct_data_fx[k], 31 - 25 ), 1 ) ); // Q30 + masa_to_total_energy_ratio_fx[i][j] = L_max( 0, q_dct_data_fx[k] ); // Q30 + move32(); + masa_to_total_energy_ratio_fx[i][j] = L_min( ONE_IN_Q30, masa_to_total_energy_ratio_fx[i][j] ); move32(); k++; } diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 0da7235e9..09b528233 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -997,19 +997,20 @@ static void run_min_stats_fx( /* Compute power spectrum twice if estimation will run on both channels. If only on one channel, it is computed only once (for ch == 0) and not again in the second run sive the outcome will be the same anyway */ - IF ( ( EQ_16(will_estimate_noise_on_channel[0], will_estimate_noise_on_channel[1]) ) || EQ_16(ch, 0) ) + IF( ( EQ_16( will_estimate_noise_on_channel[0], will_estimate_noise_on_channel[1] ) ) || EQ_16( ch, 0 ) ) { + Word16 tmp16 = getScaleFactor32( spec_in, L_FRAME16k ); /* calculate power spectrum from MDCT coefficients and estimated MDST coeffs */ - power_spec[0] = Mpy_32_32(L_shr(spec_in[0], 2), L_shr(spec_in[0], 2)); - power_spec[L_FRAME16k - 1] = Mpy_32_32(L_shr(spec_in[L_FRAME16k - 1], 1), L_shr(spec_in[L_FRAME16k - 1], 1)); - FOR ( Word16 i = 1; i < L_FRAME16k - 1; i++ ) + power_spec[0] = W_extract_h( W_shl( W_mult_32_32( spec_in[0], spec_in[0] ), tmp16 - 4 ) ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31 */ + power_spec[L_FRAME16k - 1] = W_extract_h( W_shl( W_mult_32_32( spec_in[L_FRAME16k - 1], spec_in[L_FRAME16k - 1] ), tmp16 - 4 ) ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31 */ + FOR( Word16 i = 1; i < L_FRAME16k - 1; i++ ) { Word32 mdst; - mdst = L_sub(L_shr(spec_in[i + 1], 2), L_shr(spec_in[i - 1], 2)); - power_spec[i] = L_add(Mpy_32_32(L_shr(spec_in[i], 2), L_shr(spec_in[i], 2)), Mpy_32_32(L_shr(mdst, 0), L_shr(mdst, 0))); + mdst = L_sub( spec_in[i + 1], spec_in[i - 1] ); /* Q31 - x_e */ + power_spec[i] = L_add( W_extract_h( W_shl( W_mult_32_32( spec_in[i], spec_in[i] ), tmp16 - 4 ) ), W_extract_h( W_shl( W_mult_32_32( mdst, mdst ), tmp16 - 4 ) ) ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31*/ } + power_spec_e = add( 4, shl( spec_e, 1 ) ) - tmp16; } - power_spec_e = add(4, shl(spec_e, 1)); Copy_Scale_sig32_16(power_spec, power_spec_16, L_FRAME16k, 0); diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 747859a15..298a45c4d 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -625,10 +625,28 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( *Gain = extract_h( L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ) ); /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP */ - - elev_delta = L_sub( Elev, Src_p->elev_prev_fx ); - azim_delta = L_sub( Azim, Src_p->azim_prev_fx ); - + Word32 ele_tmp = Src_p->elev_prev_fx; + IF( GT_32( ele_tmp, DEG_180_IN_Q22 ) ) + { + ele_tmp = L_sub( ele_tmp, DEG_360_IN_Q22 ); + } + ELSE IF( LT_32( ele_tmp, -DEG_180_IN_Q22 ) ) + { + ele_tmp = L_add( ele_tmp, DEG_360_IN_Q22 ); + } + elev_delta = L_sub( Elev, ele_tmp ); + + Word32 azi_tmp = Src_p->azim_prev_fx; + IF( GT_32( azi_tmp, DEG_180_IN_Q22 ) ) + { + azi_tmp = L_sub( azi_tmp, DEG_360_IN_Q22 ); + } + ELSE IF( LT_32( azi_tmp, -DEG_180_IN_Q22 ) ) + { + azi_tmp = L_add( azi_tmp, DEG_360_IN_Q22 ); + } + azim_delta = L_sub( Azim, azi_tmp ); + Src_p->elev_prev_fx = Elev; move32(); Src_p->azim_prev_fx = Azim; -- GitLab From 70e802e18a3eb576056d9cefb049fa1f3086aec2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 19:17:03 +0530 Subject: [PATCH 049/101] Warnings fixes for MSVS and Linux --- apps/decoder.c | 12 +- lib_com/basop32.c | 2 +- lib_com/basop32.h | 1 + lib_com/bits_alloc_fx.c | 1 + lib_com/bitstream_fx.c | 1 + lib_com/enr_1_az.c | 1 + lib_com/fd_cng_com.c | 4 + lib_com/fd_cng_com_fx.c | 1 + lib_com/float_to_fix_ops.c | 70 ++- lib_com/guided_plc_util.c | 4 + lib_com/interpol.c | 2 + lib_com/ivas_agc_com_fx.c | 20 +- lib_com/ivas_fb_mixer.c | 64 +++ lib_com/ivas_ism_com.c | 1 + lib_com/ivas_masa_com.c | 3 +- lib_com/ivas_omasa_com.c | 5 +- lib_com/ivas_prot.h | 2 + lib_com/ivas_prot_fx.h | 16 +- lib_com/ivas_qspherical_com.c | 1 + lib_com/ivas_rom_com.c | 35 ++ lib_com/ivas_rom_com.h | 9 + lib_com/ivas_sns_com_fx.c | 5 +- lib_com/ivas_spar_com.c | 4 +- lib_com/ivas_stereo_td_bit_alloc.c | 5 +- lib_com/longarith.c | 4 + lib_com/lpc_tools.c | 1 + lib_com/modif_fs.c | 1 + lib_com/modif_fs_fx.c | 1 + lib_com/mslvq_com.c | 2 + lib_com/options.h | 1 + lib_com/prot.h | 4 + lib_com/prot_fx1.h | 4 + lib_com/prot_fx2.h | 10 +- lib_com/rom_com.c | 116 ++--- lib_com/swb_bwe_com_fx.c | 4 - lib_com/swb_tbe_com_fx.c | 26 +- lib_com/syn_filt_fx.c | 2 +- lib_com/tcx_ltp.c | 20 +- lib_com/tools.c | 1 + lib_com/tools_fx.c | 11 +- lib_com/window_fx.c | 7 +- lib_dec/FEC.c | 8 + lib_dec/FEC_HQ_phase_ecu.c | 38 +- lib_dec/LD_music_post_filter.c | 11 +- lib_dec/acelp_core_dec_ivas_fx.c | 6 +- lib_dec/acelp_core_switch_dec.c | 2 + lib_dec/arith_coder_dec.c | 6 +- lib_dec/bass_psfilter.c | 4 + lib_dec/core_dec_init.c | 19 +- lib_dec/core_dec_init_fx.c | 6 +- lib_dec/core_switching_dec.c | 140 +----- lib_dec/dec_post.c | 28 ++ lib_dec/dec_tcx.c | 1 + lib_dec/dec_tcx_fx.c | 4 +- lib_dec/fd_cng_dec_fx.c | 16 +- lib_dec/hf_synth.c | 25 +- lib_dec/hf_synth_fx.c | 44 +- lib_dec/hq_core_dec_fx.c | 10 +- lib_dec/hq_lr_dec.c | 26 +- lib_dec/igf_dec.c | 15 +- lib_dec/ivas_core_dec.c | 41 +- lib_dec/ivas_cpe_dec.c | 9 +- lib_dec/ivas_cpe_dec_fx.c | 14 +- lib_dec/ivas_dirac_dec.c | 17 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 15 +- lib_dec/ivas_init_dec.c | 32 +- lib_dec/ivas_ism_dec.c | 485 +------------------ lib_dec/ivas_ism_param_dec.c | 6 +- lib_dec/ivas_jbm_dec.c | 135 +++--- lib_dec/ivas_masa_dec.c | 6 +- lib_dec/ivas_mc_param_dec.c | 80 ++- lib_dec/ivas_mct_dec.c | 20 +- lib_dec/ivas_omasa_dec.c | 10 +- lib_dec/ivas_out_setup_conversion.c | 4 + lib_dec/ivas_qmetadata_dec.c | 6 +- lib_dec/ivas_sba_dec.c | 12 +- lib_dec/ivas_sba_rendering_internal.c | 8 +- lib_dec/ivas_spar_decoder.c | 10 +- lib_dec/ivas_spar_md_dec.c | 17 +- lib_dec/ivas_stereo_cng_dec.c | 8 +- lib_dec/ivas_stereo_dft_dec.c | 4 + lib_dec/ivas_stereo_dft_dec_fx.c | 18 +- lib_dec/ivas_stereo_dft_plc_fx.c | 4 +- lib_dec/ivas_stereo_eclvq_dec.c | 1 + lib_dec/ivas_stereo_esf_dec.c | 2 +- lib_dec/ivas_stereo_mdct_core_dec.c | 7 +- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 4 + lib_dec/ivas_stereo_switching_dec.c | 2 + lib_dec/ivas_stereo_td_dec.c | 2 + lib_dec/ivas_tcx_core_dec.c | 2 + lib_dec/jbm_pcmdsp_apa.c | 51 +- lib_dec/lsf_dec.c | 4 + lib_dec/post_dec.c | 4 + lib_dec/swb_bwe_dec.c | 2 + lib_dec/swb_bwe_dec_fx.c | 1 + lib_dec/swb_bwe_dec_lr.c | 2 + lib_dec/swb_tbe_dec.c | 20 +- lib_dec/swb_tbe_dec_fx.c | 9 +- lib_dec/tonalMDCTconcealment.c | 2 + lib_dec/tonalMDCTconcealment_fx.c | 8 +- lib_dec/waveadjust_fec_dec.c | 19 +- lib_dec/waveadjust_fec_dec_fx.c | 3 +- lib_enc/ACcontextMapping_enc_fx.c | 2 +- lib_enc/enc_acelp_fx.c | 18 + lib_enc/enc_gain_fx.c | 3 + lib_enc/guided_plc_enc_fx.c | 2 +- lib_enc/igf_scf_enc_fx.c | 16 +- lib_enc/ivas_core_pre_proc_front.c | 4 +- lib_enc/ivas_init_enc.c | 1 + lib_enc/ivas_spar_encoder.c | 4 +- lib_enc/tcx_ltp_enc_fx.c | 2 +- lib_enc/tcx_utils_enc_fx.c | 2 +- lib_enc/vad_proc_fx.c | 4 +- lib_rend/ivas_crend.c | 4 +- lib_rend/ivas_dirac_ana.c | 4 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 20 +- lib_rend/ivas_dirac_decorr_dec.c | 4 + lib_rend/ivas_dirac_onsets_dec.c | 30 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 301 +++++------- lib_rend/ivas_dirac_rend.c | 8 +- lib_rend/ivas_limiter.c | 4 +- lib_rend/ivas_masa_merge.c | 4 +- lib_rend/ivas_mcmasa_ana.c | 13 + lib_rend/ivas_objectRenderer.c | 13 +- lib_rend/ivas_objectRenderer_mix.c | 6 +- lib_rend/ivas_objectRenderer_vec.c | 1 + lib_rend/ivas_omasa_ana.c | 3 +- lib_rend/ivas_orient_trk.c | 8 +- lib_rend/ivas_reflections.c | 3 +- lib_rend/ivas_reverb.c | 3 +- lib_rend/ivas_reverb_filter_design.c | 26 +- lib_rend/ivas_reverb_utils.c | 6 + lib_rend/ivas_rom_TdBinauralRenderer.c | 4 +- lib_rend/ivas_rotation.c | 13 +- lib_rend/ivas_vbap.c | 2 +- lib_rend/lib_rend.c | 36 +- 136 files changed, 1227 insertions(+), 1346 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 8c7c2c99f..5c7bf1765 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1518,7 +1518,11 @@ static ivas_error decodeG192( bool needNewFrame; int16_t nSamplesRendered, nSamplesRendered_loop, nSamplesToRender; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; +#ifdef IVAS_FLOAT_FIXED + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0,0 }, { 0, 0, 0, 0, 0, 0, 0 } }; +#else + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0, }, { 0, 0,0 }, { 0, 0, 0 } }; +#endif int16_t vec_pos_update, vec_pos_len; @@ -2085,7 +2089,11 @@ static ivas_error decodeVoIP( IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; +#ifdef IVAS_FLOAT_FIXED + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0,0 }, { 0, 0, 0, 0, 0, 0, 0 } }; +#else + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0, }, { 0, 0,0 }, { 0, 0, 0 } }; +#endif int16_t vec_pos_update, vec_pos_len; int16_t nOutSamples = 0; diff --git a/lib_com/basop32.c b/lib_com/basop32.c index d9f2875be..d55338764 100644 --- a/lib_com/basop32.c +++ b/lib_com/basop32.c @@ -3685,7 +3685,7 @@ Word16 i_mult_o(Word16 a, Word16 b, Flag* Overflow) { #ifdef ORIGINAL_G7231 return a * b; #else - Word32 register c = a * b; + register Word32 c = a * b; return saturate_o(c, Overflow); #endif } diff --git a/lib_com/basop32.h b/lib_com/basop32.h index 372348816..535b08d09 100644 --- a/lib_com/basop32.h +++ b/lib_com/basop32.h @@ -241,6 +241,7 @@ Word16 norm_s( Word16 var1 ); /* Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ Word32 div_w(Word32 L_num, Word32 L_den); Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ +Word32 L_sat(Word32 L_var1); /* Long saturation, 4 */ #endif /* BASOP_NOGLOB */ diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 8190378b7..6f31adeef 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -7,6 +7,7 @@ #include "options.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #include "basop_util.h" #include "rom_com.h" diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index c75094595..5b70971d3 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -40,6 +40,7 @@ #include "options.h" #include "ivas_cnst.h" /* Common constants */ #include "prot_fx2.h" /* Function prototypes */ +#include "ivas_prot_fx.h" #include "basop_util.h" #include "rom_com.h" #include "mime.h" diff --git a/lib_com/enr_1_az.c b/lib_com/enr_1_az.c index 6d6cbf20d..4bd1ab543 100644 --- a/lib_com/enr_1_az.c +++ b/lib_com/enr_1_az.c @@ -39,6 +39,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" +#include "prot_fx2.h" /*-------------------------------------------------------------------* * enr_1_Az() diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index c99088fcd..7f8411445 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -51,7 +51,9 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mhvals_flt( const int16_t d, float *m ); +#endif static void getmidbands( int16_t *part, const int16_t npart, int16_t *midband, float *psize_flt, float *psize_inv_flt ); @@ -1215,6 +1217,7 @@ void SynthesisSTFT_dirac_fx( * Compute some values used in the bias correction of the minimum statistics algorithm *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mhvals_flt( const int16_t d, float *m ) @@ -1254,6 +1257,7 @@ static void mhvals_flt( return; } +#endif /*------------------------------------------------------------------- * rand_gauss_flt() diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index a559680b1..a02bc15f4 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -11,6 +11,7 @@ #include "rom_com.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #define DELTA_SHIFT 2 #define DELTA_SHIFT_LD64 67108864l/*DELTA_SHIFT/64.0 Q31*/ diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 883f3ba54..9da36155b 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -80,8 +80,8 @@ void floatToFixed_arr32( float *f, Word32 *i, Word16 Q, Word16 l ) float fixedToFloat_32( Word32 number, Word16 Q ) { float val = 0.0f; - assert( fabs( Q ) <= 63 ); - if ( fabs( Q ) > 31 ) + assert( abs_s( Q ) <= 63 ); + if (abs_s( Q ) > 31 ) { if ( Q > 0 ) { @@ -102,8 +102,8 @@ float fixedToFloat_32( Word32 number, Word16 Q ) Word32 floatToFixed_32( float number, Word16 Q ) { float val = 0.0f; - assert( fabs( Q ) <= 63 ); - if ( fabs( Q ) > 31 ) + assert(abs_s( Q ) <= 63 ); + if (abs_s( Q ) > 31 ) { if ( Q > 0 ) { @@ -312,18 +312,16 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( { //H_IGF_GRID hGrid; - IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; - hPrivateData = &st->hIGFDec->igfData; + //IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; + //hPrivateData = &st->hIGFDec->igfData; //H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo; //ACELP_config *pConfigAcelp = &( st->acelp_cfg ); Word16 i = 0, - Q_old_synth = 0, Q_syn = 0,/* Q_synth_history = 0,*/ /*Q_fer_samples = 0,*/ + //Q_syn = 0,/* Q_synth_history = 0,*/ /*Q_fer_samples = 0,*/ Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, //Q_pst_old_syn = 0, //delay_comp = 0; - Word16 Q_lsf_cng = Q_factor( 6400 ); - if ( tofix ) { //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; @@ -352,7 +350,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( //st->hTcxDec->Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, L_FRAME32k / 2 ) - 1; //st->hTcxDec->Q_syn_Overl_TDACFB = Q_factor_arr( st->hTcxDec->syn_Overl_TDACFB_float, L_FRAME32k / 2 ); //st->hTcxDec->Q_syn_OverlFB = Q_factor_arr( st->hTcxDec->syn_OverlFB_float, L_FRAME_MAX / 2 ); - Q_old_synth = Q_syn; + //Q_old_synth = Q_syn; //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); @@ -430,12 +428,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - IF( st->hIGFDec ) - { - //st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; - //st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; - //st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0]; - } + //IF( st->hIGFDec ) + //{ + // //st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; + // //st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; + // //st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0]; + //} //st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 ); //IF( st->hBWE_TD != NULL ) @@ -445,7 +443,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( //} IF( st->hTcxDec ) { - Q_old_synth = Q_syn; + //Q_old_synth = Q_syn; //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); //st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); @@ -487,7 +485,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); } - Q_lsf_cng = Q_factor( 6400 ); IF( st->hTcxLtpDec != NULL ) { //Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY ); @@ -514,16 +511,18 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( { TCX_LTP_DEC_HANDLE hTcxLtpDec = st->hTcxLtpDec; TCX_DEC_HANDLE hTcxDec = st->hTcxDec; - Word16 i=0, bfi=0; - IF(EQ_32(frameMode, FRAMEMODE_NORMAL)) - { - bfi = 0; - } + Word16 i = 0; //bfi = 0; - IF(EQ_32(frameMode, FRAMEMODE_MISSING)) - { - bfi = 1; - } + UNUSED_PARAM(frameMode); + //IF(EQ_32(frameMode, FRAMEMODE_NORMAL)) + //{ + // bfi = 0; + //} + + //IF(EQ_32(frameMode, FRAMEMODE_MISSING)) + //{ + // bfi = 1; + //} bool reconf = ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || ( st->bwidth != st->last_bwidth ) || ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || @@ -532,12 +531,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( { //H_IGF_GRID hGrid; - IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; - hPrivateData = &st->hIGFDec->igfData; + //IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; + //hPrivateData = &st->hIGFDec->igfData; //H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo; //ACELP_config *pConfigAcelp = &( st->acelp_cfg ); Word16 /*i = 0,*/ - Q_old_synth = 0, Q_syn = 0, Q_synth_history = 0, Q_old_exc = 0,/* Q_fer_samples = 0,*/ + /* Q_syn = 0,*/ /* Q_fer_samples = 0,*/ Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, //Q_pst_old_syn = 0, //delay_comp = 0; @@ -563,7 +562,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //delay_comp = NS2SA_fx2( st->output_Fs, DELAY_CLDFB_NS ); /*CLDFB delay*/ //st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); //st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); - Q_syn = 0; + //Q_syn = 0; IF( st->hTcxDec ) { @@ -572,8 +571,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //st->hTcxDec->Q_syn_Overl = 0; //st->hTcxDec->Q_syn_Overl_TDACFB = 0; //st->hTcxDec->Q_syn_OverlFB = 0; - Q_old_synth = 0; - Q_synth_history = 0; + //Q_old_synth = 0; //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); @@ -634,8 +632,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( } else { - Q_old_exc = st->Q_exc; - Q_syn = st->Q_syn; + //Q_syn = st->Q_syn; //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); @@ -664,8 +661,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //} IF( st->hTcxDec ) { - Q_old_synth = Q_syn; - Q_synth_history = 0; + //Q_old_synth = Q_syn; //st->hTcxDec->Q_old_syn_Overl = st->Q_syn + 1; //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); diff --git a/lib_com/guided_plc_util.c b/lib_com/guided_plc_util.c index 910c114e2..a38b1f96d 100644 --- a/lib_com/guided_plc_util.c +++ b/lib_com/guided_plc_util.c @@ -44,7 +44,9 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void reorder_lsfs_flt( float *lsf, float min_dist, const int16_t n, const int32_t sr_core ); +#endif /*-------------------------------------------------------------------* @@ -236,6 +238,7 @@ void modify_lsf_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void reorder_lsfs_flt( float *lsf, /* i/o: vector of lsfs in the frequency domain (0..0.5)*/ float min_dist, /* i : minimum required distance */ @@ -321,3 +324,4 @@ static void reorder_lsfs_flt( return; } +#endif \ No newline at end of file diff --git a/lib_com/interpol.c b/lib_com/interpol.c index 7969b8ab2..c90aa9f0e 100644 --- a/lib_com/interpol.c +++ b/lib_com/interpol.c @@ -41,6 +41,8 @@ #include "rom_com.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "prot_fx_enc.h" + /*-------------------------------------------------------------------* * interpolation() * diff --git a/lib_com/ivas_agc_com_fx.c b/lib_com/ivas_agc_com_fx.c index ceb4f5950..20a045973 100644 --- a/lib_com/ivas_agc_com_fx.c +++ b/lib_com/ivas_agc_com_fx.c @@ -107,25 +107,25 @@ void ivas_agc_calcGainParams_fx( UWord16 *maxAttExp, const Word16 numCoeffs ) { - Word16 totExp; - Word16 Bm; - Word16 nbits; + //Word16 totExp; + //Word16 Bm; + //Word16 nbits; - nbits = NBITS_DIFFG; + //nbits = NBITS_DIFFG; assert( EQ_16( numCoeffs, IVAS_SPAR_MAX_DMX_CHS ) ); *absEmin = s_max( ABS_EMIN_MAX, LOG2_NUMCOEFF_SQRKMAX ); - totExp = add( add( *absEmin, AGC_EMAX ), 1 ); + //totExp = add( add( *absEmin, AGC_EMAX ), 1 ); /**betaE = (UWord16)ceilf(logf(totExp) * INV_LOG_2);*/ *betaE = (UWord16) LOG2_4; /*Bm = (UWord16)ceilf(logf((AGC_EMAX + 1 + 1)) * INV_LOG_2);*/ - Bm = 1; + //Bm = 1; - IF( GT_16( nbits, 0 ) ) - { - Bm = s_min( AGC_BITS_PER_CH - 1, NBITS_DIFFG ); - } + //IF( GT_16( nbits, 0 ) ) + //{ + // Bm = s_min( AGC_BITS_PER_CH - 1, NBITS_DIFFG ); + //} /**maxAttExp = ((UWord16) powf( 2, Bm ) ) - 2;*/ *maxAttExp = sub( shl( 2, 1 ), 2 ); diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index e7cdc7c5b..78b6afcbc 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -48,6 +48,9 @@ static void ivas_get_active_bins( const int16_t **pActive_bins, const int16_t ** static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, float **ppNew_FRs_re, float **ppNew_FRs_im, const int16_t *pActive_bins, const int16_t *pStart_offset, const int16_t num_bands, const int16_t delay, const int32_t sampling_rate ); static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate ); static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_t sampling_rate, const float **pWindow ); +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_fb_mixer_get_window_fx( const Word16 fade_len, const Word32 sampling_rate, const Word16 **pWindow ); +#endif /*-----------------------------------------------------------------------------------------* @@ -1111,6 +1114,13 @@ static ivas_error ivas_filterbank_setup( return error; } +#ifdef IVAS_FLOAT_FIXED + if ( ( error = ivas_fb_mixer_get_window_fx( pCfg->fade_len, sampling_rate, &( hFbMixer->pFilterbank_cross_fade_fx ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + if ( pCfg->num_out_chans > 0 ) { ivas_filterbank_t *pFb = hFbMixer->pFb; @@ -1271,6 +1281,60 @@ static ivas_error ivas_fb_mixer_get_window( return error; } +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_fb_mixer_get_window_fx( + const Word16 fade_len, /* i : window fading length in samples */ + const Word32 sampling_rate, /* i : sampling rate */ + const Word16 **pWindow /* o : pointer to the window coefficents */ +) +{ + ivas_error error; + + error = IVAS_ERR_OK; + + IF ( EQ_16( fade_len, NS2SA( sampling_rate, DELAY_FB_4_NS ) ) ) + { + SWITCH ( sampling_rate ) + { + case 48000: + *pWindow = ivas_fb_cf_4ms_48k_fx; + BREAK; + case 32000: + *pWindow = ivas_fb_cf_4ms_32k_fx; + break; + case 16000: + *pWindow = ivas_fb_cf_4ms_16k_fx; + break; + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported Sampling frequency!" ); + } + } + ELSE IF ( EQ_16( fade_len, NS2SA( sampling_rate, DELAY_FB_1_NS ) ) ) + { + SWITCH ( sampling_rate ) + { + case 48000: + *pWindow = ivas_fb_cf_1ms_48k_fx; + BREAK; + case 32000: + *pWindow = ivas_fb_cf_1ms_32k_fx; + BREAK; + case 16000: + *pWindow = ivas_fb_cf_1ms_16k_fx; + BREAK; + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported Sampling frequency!" ); + } + } + ELSE + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Incorrect FB window fade len (%f ms)\n", ( fade_len / 1000000.f ) ); + } + + return error; +} + +#endif static const float *ivas_get_cheby_ramp( const int16_t delay ) diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 7f4db1398..b3b8b0b34 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx1.h" +#include "prot_fx2.h" #define IVAS_FLOAT_FIXED_TO_BE_REMOVED diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 4fa9f5701..0a7e7967b 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" #include "ivas_rom_com_fx.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" /*--------------------------------------------------------------- @@ -1831,7 +1832,7 @@ void ivas_omasa_modify_masa_energy_ratios( void ivas_omasa_modify_masa_energy_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] /* Q30 */ ) + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] /* Q30 */ ) { Word16 i, m, d, b; diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index a5a8af1cd..d7b0c9e33 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -40,6 +40,7 @@ #include "ivas_rom_com.h" #include "rom_com.h" #include +#include "prot_fx2.h" /*--------------------------------------------------------------- * Local constants @@ -904,8 +905,8 @@ static Word16 get_bits_ism( Word32 val ) void calculate_nbits_meta_fx( const Word16 nchan_ism, - const Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 - const Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 + Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 + Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 const Word16 numSf, const Word16 numCodingBands, Word16 *bits_ism, diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b5522fb5d..42ef2c05f 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1621,6 +1621,7 @@ void stereo_dft_dec_synthesize( const int16_t output_frame /* i : output frame length */ ); +#ifndef IVAS_FLOAT_FIXED void stereo_dft_dec( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ Decoder_State *st0, /* i/o: decoder state structure */ @@ -1635,6 +1636,7 @@ void stereo_dft_dec( const int16_t nchan_transport, /* i : number of transpor channels */ const int16_t num_md_sub_frames /* i : number of MD subframes */ ); +#endif void stereo_dft_res_ecu( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index e6c840fef..4d63129c5 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -164,7 +164,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx( void ivas_omasa_modify_masa_energy_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] // Q30 + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] // Q30 ); Word32 calculate_cpe_brate_MASA_ISM_fx( @@ -1827,6 +1827,20 @@ Word16 set_ACELP_flag_IVAS( const Word16 cng_type /* i : CNG type */ ); +void ivas_calc_c_p_coeffs_fx( + ivas_spar_md_t *pSparMd, + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_cov_real, + const Word16 i_ts, + Word32 ***mixer_mat, + Word16 q_mixer_mat, + const Word16 num_ch, + const Word16 num_dmx, + const Word16 band_idx, + const Word16 dtx_vad, + const Word16 compute_p_flag, + const Word16 dyn_active_w_flag ); + Word16 is_SIDrate( const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); diff --git a/lib_com/ivas_qspherical_com.c b/lib_com/ivas_qspherical_com.c index 3d6ad98b1..c7cbe3aba 100644 --- a/lib_com/ivas_qspherical_com.c +++ b/lib_com/ivas_qspherical_com.c @@ -40,6 +40,7 @@ #include "prot.h" #include "cnst.h" #include "wmc_auto.h" +#include "ivas_prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 39fb8cd23..9fb0c9c6e 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -6416,6 +6416,24 @@ const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP] = 0.9664963994f, 0.9747640903f, 0.9818880329f, 0.9878510650f, 0.9926388212f, 0.9962397673f, 0.9986452283f, 0.9998494093f, }; +#ifdef IVAS_FLOAT_FIXED +const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP] = +{ +0, 4, 13, 26, 44, 66, 92, 123, 158, 197, 241, 289, 341, 398, 458, 524, 593, 667, 744, 826, 913, 1003, 1097, 1196, 1298, 1405, 1516, 1630, 1749, 1871, 1998, 2128, 2262, 2400, 2541, 2687, 2836, 2988, 3144, 3304, 3467, 3634, 3804, 3977, 4154, 4334, 4517, 4704, 4893, 5086, 5282, 5480, 5682, 5886, 6094, 6304, 6516, 6732, 6949, 7170, 7393, 7618, 7846, 8076, 8308, 8542, 8779, 9017, 9258, 9500, 9744, 9990, 10238, 10487, 10738, 10990, 11244, 11499, 11756, 12014, 12273, 12533, 12794, 13056, 13319, 13582, 13847, 14112, 14378, 14644, 14911, 15178, 15446, 15713, 15981, 16249, 16518, 16786, 17054, 17321, 17589, 17856, 18123, 18389, 18655, 18920, 19185, 19448, 19711, 19973, 20234, 20494, 20753, 21011, 21268, 21523, 21777, 22029, 22280, 22529, 22777, 23023, 23267, 23509, 23750, 23988, 24225, 24459, 24691, 24921, 25149, 25374, 25597, 25818, 26035, 26251, 26463, 26673, 26881, 27085, 27287, 27485, 27681, 27874, 28063, 28250, 28433, 28613, 28790, 28963, 29133, 29300, 29463, 29623, 29779, 29931, 30080, 30226, 30367, 30505, 30639, 30769, 30896, 31018, 31137, 31251, 31362, 31469, 31571, 31670, 31764, 31854, 31941, 32023, 32100, 32174, 32243, 32309, 32369, 32426, 32478, 32526, 32570, 32609, 32644, 32675, 32701, 32723, 32741, 32754, 32763, 32767, +}; + +const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP] = +{ + 1, 11, 30, 60, 99, 149, 208, 276, 355, 443, 541, 648, 765, 891, 1026, 1171, 1325, 1488, 1660, 1840, 2030, 2228, 2435, 2650, 2873, 3105, 3345, 3592, 3847, 4110, 4380, 4657, 4941, 5233, 5530, 5835, 6146, 6463, 6786, 7115, 7449, 7789, 8134, 8483, 8838, 9197, 9561, 9928, 10300, 10675, 11054, 11435, 11820, 12208, 12598, 12990, 13385, 13781, 14179, 14578, 14978, 15379, 15780, 16182, 16585, 16987, 17388, 17789, 18189, 18588, 18986, 19382, 19777, 20169, 20559, 20947, 21332, 21713, 22092, 22467, 22839, 23206, 23570, 23929, 24284, 24633, 24978, 25318, 25652, 25981, 26304, 26621, 26932, 27237, 27534, 27826, 28110, 28387, 28657, 28920, 29175, 29422, 29662, 29894, 30117, 30332, 30539, 30737, 30927, 31107, 31279, 31442, 31596, 31741, 31876, 32002, 32119, 32226, 32324, 32412, 32491, 32559, 32618, 32668, 32707, 32737, 32756, 32766, +}; + +const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP] = +{ +4, 44, 123, 241, 398, 593, 826, 1097, 1405, 1749, 2128, 2541, 2988, 3467, 3977, 4517, 5086, 5682, 6304, 6949, 7618, 8308, 9017, 9744, 10487, 11244, 12014, 12794, 13582, 14378, 15178, 15981, 16786, 17589, 18389, 19185, 19973, 20753, 21523, 22280, 23023, 23750, 24459, 25149, 25818, 26463, 27085, 27681, 28250, 28790, 29300, 29779, 30226, 30639, 31018, 31362, 31670, 31941, 32174, 32369, 32526, 32644, 32723, 32763, +}; +#endif + + const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12] = { 0.0083333333f, 0.0250000000f, 0.0416666667f, 0.0583333333f, @@ -6542,6 +6560,23 @@ const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP] = 0.5490085702f, 0.6451423386f, 0.7356983684f, 0.8171966421f, 0.8865052267f, 0.9409606322f, 0.9784701679f, 0.9975923633f, }; +#ifdef IVAS_FLOAT_FIXED +const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP] = +{ + 8, 78, 218, 427, 705, 1050, 1460, 1934, 2470, 3066, 3718, 4425, 5184, 5990, 6840, 7732, 8660, 9622, 10612, 11627, 12663, 13715, 14778, 15847, 16920, 17989, 19052, 20104, 21140, 22155, 23145, 24107, 25035, 25927, 26777, 27583, 28342, 29049, 29701, 30297, 30833, 31307, 31717, 32062, 32340, 32549, 32689, 32759, +}; + +const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP] = +{ + 19, 177, 491, 957, 1573, 2330, 3224, 4244, 5381, 6624, 7960, 9378, 10864, 12403, 13979, 15580, 17187, 18788, 20364, 21903, 23389, 24807, 26143, 27386, 28523, 29543, 30437, 31194, 31810, 32276, 32590, 32748, +}; + +const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP] = +{ +78, 705, 1934, 3718, 5990, 8660, 11627, 14778, 17989, 21140, 24107, 26777, 29049, 30833, 32062, 32689, + }; + +#endif const float ivas_fb_fr_12band_1ms_re[IVAS_FB_12_1MS_LEN] = { diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 360d5095a..e82ffe9b1 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -520,6 +520,15 @@ extern const float ivas_fb_cf_1ms_32k[IVAS_FB_1MS_32K_SAMP]; extern const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP]; extern const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP]; +#ifdef IVAS_FLOAT_FIXED +extern const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP]; +extern const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP]; +extern const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP]; +#endif + extern const float ivas_fb_resp_cheby_ramp_32del[IVAS_FB_1MS_32K_SAMP + 1]; extern const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1]; diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index e1c22014a..d04de5815 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -42,6 +42,7 @@ #include #include #include "wmc_auto.h" +#include "ivas_prot_fx.h" /*------------------------------------------------------------------- @@ -284,7 +285,7 @@ void sns_shape_spectrum_fx( const Word16 L_frame /* i : frame length */ ) { - Word16 i, n, k, tmp_k, bw, q_tmp, shift, min_shift = 63; + Word16 i, n, k, tmp_k, bw, q_tmp = 0, shift, min_shift = 63; Word64 L64_tmp[L_FRAME48k]; const UWord8 nBands = pPsychParams->nBands; const UWord8 *bandLengths = pPsychParams->bandLengths; @@ -337,7 +338,7 @@ void sns_shape_spectrum_fx( } } tmp_k = k; - q_tmp = q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); + q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); IF( GT_16( q_tmp, 30 ) ) { q_tmp = 30; diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index d9994bc39..2f867f212 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -3192,7 +3192,7 @@ void ivas_get_spar_md_from_dirac_fx( { idx = remix_order[i + ndm] - ndm; //P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; - P_dir_fact_fx[idx] = ( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); + P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); //P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[1] ); if ( P_dir_fact_fx[idx] == 0 ) { @@ -3208,7 +3208,7 @@ void ivas_get_spar_md_from_dirac_fx( { idx = remix_order[i + ndm] - ndm; //P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; - P_dir_fact_fx[idx] = ( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); + P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); //P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[2] ); if ( P_dir_fact_fx[idx] == 0 ) { diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 84aaff86c..d9ec5ada7 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -43,6 +43,7 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #endif @@ -1018,8 +1019,8 @@ static void tdm_SCh_LSF_intra_pred_tri_diag_mat_fx( lsf_tmp_ptr1_fx = lsf_tmp_ptr2_fx; *lsf_SCh_ptr_fx = mult_r((*lsf_tmp_ptr1_fx), (*prd_ptr_fx)); - *lsf_tmp_ptr1_fx++; - *prd_ptr_fx++; + lsf_tmp_ptr1_fx++; + prd_ptr_fx++; *lsf_SCh_ptr_fx = add( mult_r( ( *lsf_tmp_ptr1_fx), ( *prd_ptr_fx) ), *lsf_SCh_ptr_fx); v_add_16( lsf_SCh_fx, lsf_mean_out_fx, lsf_SCh_fx, M ); diff --git a/lib_com/longarith.c b/lib_com/longarith.c index 8f7acc21b..78def0889 100644 --- a/lib_com/longarith.c +++ b/lib_com/longarith.c @@ -39,6 +39,10 @@ #include "options.h" #include "prot.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" +#include "prot_fx2.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_com/lpc_tools.c b/lib_com/lpc_tools.c index 410478579..e4f0e5038 100644 --- a/lib_com/lpc_tools.c +++ b/lib_com/lpc_tools.c @@ -42,6 +42,7 @@ #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" +#include "prot_fx2.h" /*-----------------------------------------------------------------* * Local constants diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index a05f39601..caa84ae75 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -41,6 +41,7 @@ #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" +#include "prot_fx2.h" /*-------------------------------------------------------------------* * modify_Fs() diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index be45576b7..c426b5556 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -11,6 +11,7 @@ #include #include "rom_enc.h" /* prototypes */ #include "basop_util.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------* * Local functions diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index 77fb370a7..d5ae13697 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -41,6 +41,8 @@ #include "prot.h" #include "wmc_auto.h" #include "ivas_prot.h" +#include "prot_fx2.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------* * Local function prototypes diff --git a/lib_com/options.h b/lib_com/options.h index d8f609b72..0c348e36b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -113,6 +113,7 @@ //#define DBG_WAV_WRITER #define EVS_FLOAT_ENC //#define DUMPS_ENABLED +//#define WMOPS #define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION #define IVAS_CNST #define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */ diff --git a/lib_com/prot.h b/lib_com/prot.h index d55404f79..b4ef842c5 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -9204,6 +9204,10 @@ int16_t DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const int16_t index //int16_t GetTnsFilterOrderBitsSWBTCX20_flt( const int16_t value, const int16_t index ); //int16_t EncodeTnsFilterOrderSWBTCX20_flt( const int16_t value, const int16_t index ); int16_t DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t EncodeTnsFilterOrderSWBTCX10_flt(const int16_t value, const int16_t index); + +int16_t GetTnsFilterOrderBitsSWBTCX10_flt(const int16_t value, const int16_t index); //int16_t GetTnsFilterOrderBits_flt( const int16_t value, const int16_t index ); //int16_t EncodeTnsFilterOrder_flt( const int16_t value, const int16_t index ); int16_t DecodeTnsFilterOrder_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); diff --git a/lib_com/prot_fx1.h b/lib_com/prot_fx1.h index 9ddacf686..87e20a37d 100644 --- a/lib_com/prot_fx1.h +++ b/lib_com/prot_fx1.h @@ -576,6 +576,10 @@ Word16 lin_interp_fx( Word16 ceil_log_2( UWord64 val ); +Word32 imax_pos_fx( + const Word32 *y /* i : Input vector for peak interpolation */ +); + #ifdef IVAS_FLOAT_FIXED void re8_k2y_fx( const Word16 *k, /* i : Voronoi index k[0..7] */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 100904a3f..b3535e585 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -5336,6 +5336,12 @@ void tcx_ltp_get_lpc( const Word16 order ); +void tcx_ltp_get_lpc_fx( + Word32 *x, + const Word16 L, + Word32 *A, + const Word16 order ); + void predict_signal( const Word16 excI[], /* i : i excitation buffer */ Word16 excO[], /* o : output excitation buffer */ @@ -9184,8 +9190,8 @@ void save_synthesis_hq_fec_fx( ); void calculate_nbits_meta_fx( const Word16 nchan_ism, - const Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 - const Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 + Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 + Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 const Word16 numSf, const Word16 numCodingBands, Word16 *bits_ism, diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 695c93c96..256fc16d7 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -10933,74 +10933,74 @@ const Word16 msNoiseSlopeMax[4] = { 32767/*2.f Q14*/, 26214/*1.6f Q14*/, 21299 const SCALE_SETUP scaleTableStereo[SIZE_SCALE_TABLE_STEREO] = { - { 1, 0, 8000, -5.5f, -704/*-5.5f Q7*/ }, - { 1, 8000, 9600, -5.0f, -640/*-5.0f Q7*/ }, - { 1, 9600, 13200, -4.0f, -512/*-4.0f Q7*/ }, - { 1, 13200, 16400, -3.0f, -384/*-3.0f Q7*/ }, - { 1, 16400, 24400, -1.6f, -204/*-1.6f Q7*/ }, - { 1, 24400, 32000, -0.2f, -26/*-1.6f Q7*/ }, - { 1, 32000,512001, 0.0f, 0 /*0.0f Q7*/ }, - - { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/}, - { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/}, - { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/}, - { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/}, - { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/}, - { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/}, - { 2, 32000,512001, 0.0f , 0/* 0.0f Q7*/} + { 1, 0, 8000, -5.5f, -704/*-5.5f Q7*/, -704 }, + { 1, 8000, 9600, -5.0f, -640/*-5.0f Q7*/, -640 }, + { 1, 9600, 13200, -4.0f, -512/*-4.0f Q7*/, -512 }, + { 1, 13200, 16400, -3.0f, -384/*-3.0f Q7*/, -384 }, + { 1, 16400, 24400, -1.6f, -204/*-1.6f Q7*/, -204 }, + { 1, 24400, 32000, -0.2f, -26/*-1.6f Q7*/, -26 }, + { 1, 32000,512001, 0.0f, 0 /*0.0f Q7*/, 0 }, + + { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/, -115 }, + { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/, -83 }, + { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/, -256 }, + { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/, -384 }, + { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/, -102 }, + { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/, -32 }, + { 2, 32000,512001, 0.0f , 0/* 0.0f Q7*/, 0 } }; #if 0 //scaleTableStereo recheck extended from scaleTableMono #endif const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO] = { - { 0, 0, 8000, -5.5f, -704/*-5.5f Q7*/ }, - { 0, 8000, 9600, -5.0f, -640/*-5.0f Q7*/ }, - { 0, 9600, 13200, -4.0f, -512/*-4.0f Q7*/ }, - { 0, 13200, 16400, -3.0f, -384/*-3.0f Q7*/ }, - { 0, 16400, 24400, -1.5f, -192/*-1.5f Q7*/ }, - { 0, 24400,128001, -0.5f, -64/*-0.5f Q7*/ }, - - { 1, 0, 8000, -5.5f , -704/*-5.5f Q7*/}, - { 1, 8000, 9600, -5.0f , -640/*-5.0f Q7*/}, - { 1, 9600, 13200, -1.55f, -198/*-1.55f Q7*/}, - { 1, 13200, 16400, -3.0f , -384/*-3.0f Q7*/}, - { 1, 16400, 24400, -0.6f , -77/*-0.6f Q7*/}, - { 1, 24400, 32000, -0.2f , -26/*-0.2f Q7*/}, - { 1, 32000,128001, 0.0f , 0/* 0.0f Q7*/}, - - { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/}, - { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/}, - { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/}, - { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/}, - { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/}, - { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/}, - { 2, 32000,128001, 0.0f , 0/* 0.0f Q7*/} + { 0, 0, 8000, -5.5f, -704/*-5.5f Q7*/, -704 }, + { 0, 8000, 9600, -5.0f, -640/*-5.0f Q7*/, -640 }, + { 0, 9600, 13200, -4.0f, -512/*-4.0f Q7*/, -512 }, + { 0, 13200, 16400, -3.0f, -384/*-3.0f Q7*/, -384 }, + { 0, 16400, 24400, -1.5f, -192/*-1.5f Q7*/, -192 }, + { 0, 24400,128001, -0.5f, -64/*-0.5f Q7*/, -64 }, + + { 1, 0, 8000, -5.5f , -704/*-5.5f Q7*/, -704 }, + { 1, 8000, 9600, -5.0f , -640/*-5.0f Q7*/, -640 }, + { 1, 9600, 13200, -1.55f, -198/*-1.55f Q7*/, -198 }, + { 1, 13200, 16400, -3.0f , -384/*-3.0f Q7*/,-384 }, + { 1, 16400, 24400, -0.6f , -77/*-0.6f Q7*/, -77 }, + { 1, 24400, 32000, -0.2f , -26/*-0.2f Q7*/, -26 }, + { 1, 32000,128001, 0.0f , 0/* 0.0f Q7*/, 0 }, + + { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/, -115 }, + { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/, -83 }, + { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/, -256 }, + { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/, -384 }, + { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/, -102 }, + { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/, -32 }, + { 2, 32000,128001, 0.0f , 0/* 0.0f Q7*/,0 } }; const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN] = { - { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/ }, - { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/ }, - { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/ }, - { 0, 16400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ }, - - { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/ }, - { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/ }, - { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/ }, - { 1, 24400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ }, - - { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/ }, - { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/ }, - - { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/ }, - { 2, 24400, 32000, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ }, - { 2, 32000,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ } + { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/, 20295 }, + { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, + { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, + { 0, 16400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, + + { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, + { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 }, + { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, + { 1, 24400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, + + { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, + { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/, 4242 }, + + { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, + { 2, 24400, 32000, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, + { 2, 32000,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 } }; #if 0 //scaleTable_cn_dirac recheck extended from scaleTable_cn_only diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index f1cae97fe..f50094e78 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -744,14 +744,10 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 */ Word16 sign = 0; const Word32 *ptr; Word16 exp2, tmp_exp; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif BASOP_SATURATE_WARNING_OFF_EVS /* this is required for adaptative precision energy summation loop, do not remove */ - Overflow = 0; move16(); exp2 = 0; move16(); diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index ea5cbcd09..300433048 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -3056,7 +3056,31 @@ void GenShapedSHBExcitation_ivas_fx( } else #else - UNUSED_PARAM(Env_error_part, Env_error, EnvSHBres_4k, c5_part, c1, den, c3_part, c0, delta, c3, c2_part, c1_part, EnvWhiteExc16k, g2, c5, c4_part, EnvWhiteExc16k_4k, c2, g, cbsize, g1, EnvExc16kWhtnd, c0_part, EnvExc16kWhtnd_4k, c4); + UNUSED_PARAM(Env_error_part); + UNUSED_PARAM(Env_error); + UNUSED_PARAM(EnvSHBres_4k); + UNUSED_PARAM(c5_part); + UNUSED_PARAM(c1); + UNUSED_PARAM(den); + UNUSED_PARAM(c3_part); + UNUSED_PARAM(c0); + UNUSED_PARAM(delta); + UNUSED_PARAM(c3); + UNUSED_PARAM(c2_part); + UNUSED_PARAM(c1_part); + UNUSED_PARAM(EnvWhiteExc16k); + UNUSED_PARAM(g2); + UNUSED_PARAM(c5); + UNUSED_PARAM(c4_part); + UNUSED_PARAM(EnvWhiteExc16k_4k); + UNUSED_PARAM(c2); + UNUSED_PARAM(g); + UNUSED_PARAM(cbsize); + UNUSED_PARAM(g1); + UNUSED_PARAM(EnvExc16kWhtnd); + UNUSED_PARAM(c0_part); + UNUSED_PARAM(EnvExc16kWhtnd_4k); + UNUSED_PARAM(c4); #endif { Estimate_mix_factors_fx(shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k, diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 7a858fac3..a3bc741bd 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -91,7 +91,7 @@ static Word32 syn_kern_10_fx(Word32 L_tmp, const Word32 a[], const Word32 y[]) return syn_kern_2_fx(L_tmp, a + 8, y - 8); } -Word32 syn_kern_16_fx(Word32 L_tmp, const Word32 a[], const Word32 y[]) +static Word32 syn_kern_16_fx(Word32 L_tmp, const Word32 a[], const Word32 y[]) { L_tmp = syn_kern_8_fx(L_tmp, a, y); return syn_kern_8_fx(L_tmp, a + 8, y - 8); diff --git a/lib_com/tcx_ltp.c b/lib_com/tcx_ltp.c index e4c86f2b1..78558964f 100644 --- a/lib_com/tcx_ltp.c +++ b/lib_com/tcx_ltp.c @@ -53,6 +53,7 @@ * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_get_lpc_flt( float *input, const int16_t length, @@ -83,6 +84,7 @@ static void tcx_ltp_get_lpc_flt( return; } +#endif /*------------------------------------------------------------------- @@ -91,6 +93,7 @@ static void tcx_ltp_get_lpc_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_get_zir_flt( float *zir, const int16_t length, @@ -158,6 +161,7 @@ static void tcx_ltp_get_zir_flt( return; } +#endif /*------------------------------------------------------------------- @@ -214,6 +218,7 @@ void predict_signal_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_flt( float *synth_ltp, float *synth, @@ -273,7 +278,7 @@ static void tcx_ltp_synth_filter_flt( return; } - +#endif /*------------------------------------------------------------------- * tcx_ltp_synth_filter_zir_flt() @@ -281,6 +286,7 @@ static void tcx_ltp_synth_filter_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_zir_flt( float *synth_ltp, float *synth, @@ -334,6 +340,7 @@ static void tcx_ltp_synth_filter_zir_flt( return; } +#endif /*------------------------------------------------------------------- @@ -342,6 +349,7 @@ static void tcx_ltp_synth_filter_zir_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_fadein_flt( float *synth_ltp, float *synth, @@ -408,6 +416,7 @@ static void tcx_ltp_synth_filter_fadein_flt( return; } +#endif /*------------------------------------------------------------------- @@ -416,6 +425,7 @@ static void tcx_ltp_synth_filter_fadein_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_fadeout_flt( float *synth_ltp, float *synth, @@ -479,6 +489,7 @@ static void tcx_ltp_synth_filter_fadeout_flt( return; } +#endif /*------------------------------------------------------------------- @@ -548,6 +559,7 @@ int16_t tcx_ltp_decode_params_flt( * * ---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_10_flt( float *out, float *in, @@ -604,6 +616,7 @@ static void tcx_ltp_synth_filter_10_flt( return; } +#endif /*------------------------------------------------------------------- @@ -612,6 +625,7 @@ static void tcx_ltp_synth_filter_10_flt( * ---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_01_flt( float *out, float *in, @@ -668,6 +682,7 @@ static void tcx_ltp_synth_filter_01_flt( return; } +#endif #define MAX_TCX_LTP_FILTER_LEN 8 #define MAX_TRANSITION_LEN 240 /* L_FRAME_48K / 4 */ @@ -683,6 +698,7 @@ static void tcx_ltp_synth_filter_01_flt( * the current update interval with scaling from 0 towards non-zero gain ---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_11_unequal_pitch_flt( float *out, float *in, @@ -794,7 +810,7 @@ static void tcx_ltp_synth_filter_11_unequal_pitch_flt( return; } - +#endif /*------------------------------------------------------------------- * tcx_ltp_post_flt() diff --git a/lib_com/tools.c b/lib_com/tools.c index 943507c10..f91a2081a 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -40,6 +40,7 @@ #include "prot.h" #include "prot_fx2.h" #include "wmc_auto.h" +#include "prot_fx1.h" /*------------------------------------------------------------------* * own_random() diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 955338c2b..c7e150611 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -50,6 +50,9 @@ #include "basop_util.h" #include "basop32.h" #include "wmc_auto.h" +#include "prot_fx_enc.h" +#include "prot.h" +#include "ivas_prot_fx.h" #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ @@ -63,9 +66,13 @@ Word32 float_to_fix( float number, Word32 Q ) { assert( Q >= 0 ); if (number == 1.0f && Q == Q31) + { return ONE_IN_Q31; - if(isnan(number)) - number = 0; + } + if (isnan(number)) + { + number = 0; + } assert( fabs( number ) < pow( 2, 31 - Q ) ); Word32 ret = (Word32) ( number * ( (UWord32) 1 << Q ) ); return ret; diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index a32033be1..eaff59c07 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -19,6 +19,7 @@ #define P92_0Q15 30147 /* ~=round(0.92*2^15) */ #include "options.h" #include "rom_basop_util.h" +#include "prot_fx2.h" void ham_cos_window( @@ -85,11 +86,11 @@ void ham_cos_window_ivas( const Word16 n2 /* i: */ ) { - Word16 cc_fx, cte_fx; + Word16 cc_fx; Word16 i; // cte = PI2 / (float) ( 2 * n1 - 1 ); - cte_fx = div_s(1, sub(shl(n1, 1), 1)); + //cte_fx = div_s(1, sub(shl(n1, 1), 1)); cc_fx = 0; move16(); for ( i = 0; i < n1; i++ ) @@ -99,7 +100,7 @@ void ham_cos_window_ivas( } // cte = PI2 / (float) ( 4 * n2 - 1 ); - cte_fx = div_s(1, sub(shl(n2, 2), 1)); + //cte_fx = div_s(1, sub(shl(n2, 2), 1)); cc_fx = 0; move16(); for ( i = 0; i < n2; i++ ) diff --git a/lib_dec/FEC.c b/lib_dec/FEC.c index c05d32b87..3f19f35eb 100644 --- a/lib_dec/FEC.c +++ b/lib_dec/FEC.c @@ -47,9 +47,13 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void gain_dec_bfi( float *past_qua_en ); +#endif +#ifndef IVAS_FLOAT_FIXED static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word16 new_pit, Word16 Tc, Word16 L_frame ); +#endif /*-------------------------------------------------------------------* * FEC_exc_estim() @@ -488,6 +492,7 @@ void FEC_exc_estim( * next frame *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void gain_dec_bfi( float *past_qua_en /* i/o: gain quantization memory (4 words) */ ) @@ -517,6 +522,7 @@ static void gain_dec_bfi( return; } +#endif #define WMC_TOOL_SKIP @@ -526,6 +532,7 @@ static void gain_dec_bfi( * calculates some conditions for Pulse resynchronization to take place *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, @@ -574,4 +581,5 @@ static void pulseRes_preCalc( return; } +#endif #undef WMC_TOOL_SKIP diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index ba2856625..5208ca9b2 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -88,8 +88,10 @@ * Local functions *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t rand_phase( const int16_t seed, float *sin_F, float *cos_F ); static float imax2_jacobsen_mag( const float *y_re, const float *y_im ); +#endif /*-------------------------------------------------------------------* * mult_rev2() @@ -97,6 +99,7 @@ static float imax2_jacobsen_mag( const float *y_re, const float *y_im ); * Multiplication of two vectors second vector is multiplied in reverse order *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mult_rev2( const float x1[], /* i : Input vector 1 */ const float x2[], /* i : Input vector 2 */ @@ -113,6 +116,7 @@ static void mult_rev2( return; } +#endif /*-------------------------------------------------------------------* @@ -121,6 +125,7 @@ static void mult_rev2( * Square magnitude of fft spectrum *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fft_spec2( float x[], /* i/o: Input vector: complex spectrum -> square magnitude spectrum */ const int16_t N /* i : Vector length */ @@ -138,6 +143,7 @@ static void fft_spec2( return; } +#endif /*------------------------------------------------------------------* * rand_phase() @@ -145,6 +151,7 @@ static void fft_spec2( * randomized phase in form of sin and cos components *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: Updated seed from RNG */ static int16_t rand_phase( const int16_t seed, /* i : RNG seed */ @@ -176,6 +183,7 @@ static int16_t rand_phase( return seed2; } +#endif /*----------------------------------------------------------------------------- * imax2_jacobsen_mag() @@ -183,6 +191,7 @@ static int16_t rand_phase( * refine peak interpolation using jacobsen and periodic speca ana windows *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: The location, relative to the middle of the 3 given data point, of the maximum. (Q15)*/ float imax2_jacobsen_mag( const float *y_re, /* i : The 3 given data points. real part order -1 0 1 */ @@ -243,6 +252,7 @@ float imax2_jacobsen_mag( return posi; } +#endif /*------------------------------------------------------------------* @@ -251,6 +261,7 @@ float imax2_jacobsen_mag( * Transient analysis *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void trans_ana( const float *xfp, /* i : Input signal */ float *mag_chg, /* i/o: Magnitude modification */ @@ -432,6 +443,7 @@ static void trans_ana( return; } +#endif /*------------------------------------------------------------------* @@ -694,6 +706,7 @@ float imax_pos( * Spectral analysis *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spec_ana( const float *prevsynth, /* i : Input signal */ int16_t *plocs, /* o : The indicies of the identified peaks */ @@ -931,6 +944,7 @@ static void spec_ana( return; } +#endif /*-------------------------------------------------------------------* * subst_spec() @@ -938,6 +952,7 @@ static void spec_ana( * Substitution spectrum calculation *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void subst_spec( const int16_t *plocs, /* i : The indicies of the identified peaks */ const float *plocsi, /* i : Interpolated positions of the identified peaks */ @@ -1251,6 +1266,7 @@ static void subst_spec( return; } +#endif /*-------------------------------------------------------------------------- * rec_wtda() @@ -1258,6 +1274,7 @@ static void subst_spec( * Windowing and TDA of reconstructed frame *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void rec_wtda( float *X, /* i/o: ECU frame / unwindowed ECU frame */ float *ecu_rec, /* o : Reconstructed frame in tda domain */ @@ -1366,6 +1383,7 @@ static void rec_wtda( return; } +#endif /*-------------------------------------------------------------------------- @@ -1374,6 +1392,7 @@ static void rec_wtda( * Frame reconstruction *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void rec_frame( float *X, /* i/o: FFT spectrum / IFFT of spectrum */ float *ecu_rec, /* o : Reconstructed frame in tda domain */ @@ -1415,6 +1434,7 @@ static void rec_frame( return; } +#endif /*-------------------------------------------------------------------------- @@ -1423,6 +1443,7 @@ static void rec_frame( * FIR downsampling filter *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fir_dwn( const float x[], /* i : input vector */ const float h[], /* i : impulse response of the FIR filter */ @@ -1475,6 +1496,7 @@ static void fir_dwn( return; } +#endif /*-------------------------------------------------------------------------- @@ -1483,6 +1505,7 @@ static void fir_dwn( * Pitch/correlation analysis and adaptive analysis frame length calculation *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_ecu_pitch( const float *prevsynth, /* i : previous synthesis */ float *prevsynth_LP, /* o : down-sampled synthesis */ @@ -1608,6 +1631,7 @@ static void fec_ecu_pitch( return; } +#endif /*-------------------------------------------------------------------------- @@ -1617,6 +1641,7 @@ static void fec_ecu_pitch( * next power of 2 using linear interpolation. *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_ecu_dft( const float *prevsynth_LP, /* i : Downsampled past synthesis (2*160 samples) */ const int16_t N, /* i : Analysis frame length in 8 kHz (corr. max) */ @@ -1674,6 +1699,7 @@ static void fec_ecu_dft( return; } +#endif /*--------------------------------------------------------------------------* * singenerator() @@ -1681,7 +1707,7 @@ static void fec_ecu_dft( * fast cosinus generator Amp*cos(2*pi*freq+phi) *--------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void singenerator( const int16_t L, /* i : size of output */ const float cosfreq, /* i : cosine of 1-sample dephasing at the given frequency */ @@ -1731,6 +1757,7 @@ static void singenerator( return; } +#endif /*-------------------------------------------------------------------------- @@ -1739,6 +1766,7 @@ static void singenerator( * ECU frame sinusoid generation *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void sinusoidal_synthesis( const float *Tfr, /* i : DFT coefficients, real part */ const float *Tfi, /* i : DFT coefficients, imag part */ @@ -1862,6 +1890,7 @@ static void sinusoidal_synthesis( return; } +#endif /*-------------------------------------------------------------------------- * fec_noise_filling() @@ -1874,6 +1903,7 @@ static void sinusoidal_synthesis( * it to be inserted into wtda *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_noise_filling( const float *prevsynth, /* i : Past synthesis buffer (length 2*L) */ float *synthesis, /* i/o: Sinusoidal ECU / Sinusoidal ECU + noise */ @@ -1989,7 +2019,7 @@ static void fec_noise_filling( return; } - +#endif /*-------------------------------------------------------------------------- * fec_alg() @@ -1998,6 +2028,7 @@ static void fec_noise_filling( * length *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_alg( const float *prevsynth, /* i : previous synthesis */ const float *prevsynth_LP, /* i : down-sampled synthesis */ @@ -2031,6 +2062,7 @@ static void fec_alg( return; } +#endif /*-------------------------------------------------------------------------- @@ -2039,6 +2071,7 @@ static void fec_alg( * Main routine for HQ phase ECU *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hq_phase_ecu( const float *prevsynth, /* i : buffer of previously synthesized signal */ float *ecu_rec, /* o : reconstructed frame in tda domain */ @@ -2130,6 +2163,7 @@ static void hq_phase_ecu( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index a17dcdfb6..494fa1357 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -64,11 +64,12 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spectrum_mod_dct( float data[], const float lf_E[], float lf_EO[], const float noiseE[], const float minGain, float lp_gbin[], const int16_t music_flag, int16_t min_band, const float MAX_GN, const int16_t max_band ); - static void analy_sp_dct( const float dct_in[], float dct_buf[], float *fr_bands, float *lf_E, float *etot ); - static void find_enr_dct( const float data[], float band[], float *ptE, float *Etot, const int16_t min_band, const int16_t max_band, float *Bin_E, const float bin_freq ); +#endif + #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* @@ -366,6 +367,7 @@ void LD_music_post_filter( * spectrum enhancement according to the output of signal_type_clas() *---------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spectrum_mod_dct( float data[], /* i/o: DCT spectrum */ const float lf_E[], /* i : per bin E for first 46 bins (without DC) */ @@ -520,6 +522,7 @@ static void spectrum_mod_dct( return; } +#endif /*----------------------------------------------------------------------------------* * analy_sp_dct() @@ -527,6 +530,7 @@ static void spectrum_mod_dct( * Spectral analysis of the current synthesized frame *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void analy_sp_dct( const float dct_in[], /* i : input DCT spectrum */ float dct_buf[], /* i : output DCT spectrum */ @@ -553,6 +557,7 @@ static void analy_sp_dct( return; } +#endif /*------------------------------------------------------------------------* * find_enr_dct) @@ -561,6 +566,7 @@ static void analy_sp_dct( * The energy is normalized by the number of frequency bins in a channel *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void find_enr_dct( const float data[], /* i : fft result, for the format see fft_rel.c */ float band[], /* o : per band energy */ @@ -623,6 +629,7 @@ void find_enr_dct( return; } +#endif /*------------------------------------------------------------------------* * Prep_music_postP() diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index b7de77632..7787b4420 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1971,8 +1971,8 @@ void acelp_decoder_state_float2fix(Decoder_State *st/*, STEREO_CNG_DEC_HANDLE hS old_len_ana = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; old_len_bpf = st->cldfbBPF->p_filter_length - st->cldfbBPF->no_channels; - Word16 new_len; - new_len = 9 * (int16_t)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f); + //Word16 new_len; + //new_len = 9 * (int16_t)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f); floatToFixed_arrL(st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q11, old_len_ana); floatToFixed_arrL(st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q10, old_len_bpf); if(st->cldfbSynHB) @@ -2017,7 +2017,7 @@ void acelp_decoder_state_fix2float(Decoder_State *st) { (st->element_mode == IVAS_CPE_TD)) && (!st->BER_detect)) || ((st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT) && (st->hFdCngDec->hFdCngCom->active_frame_counter > 0)) || ((st->bfi == 1) && (st->nbLostCmpt == 1)))) || - (st->m_frame_type == ZERO_FRAME) && (st != NULL && st->cng_type == LP_CNG) + ((st->m_frame_type == ZERO_FRAME) && (st != NULL && st->cng_type == LP_CNG)) ) { fixedToFloat_arrL(st->hFdCngDec->msNoiseEst, st->hFdCngDec->msNoiseEst_float, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 8e3be6097..e0391ac47 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -45,7 +45,9 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void decod_gen_voic_core_switch( Decoder_State *st, const int16_t L_frame, const int16_t sharpFlag, const float *Aq, float *exc, const int32_t core_brate ); +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/arith_coder_dec.c b/lib_dec/arith_coder_dec.c index c1be77e57..12abd4d92 100644 --- a/lib_dec/arith_coder_dec.c +++ b/lib_dec/arith_coder_dec.c @@ -53,6 +53,7 @@ *-------------------------------------------------------*/ /*! r: number of bits consumed */ +#ifndef IVAS_FLOAT_FIXED static int16_t tcx_arith_decode( const int16_t L_frame, /* i : number of spectral lines */ const Word16 envelope[], /* i : scaled envelope (Q15-e) */ @@ -115,6 +116,7 @@ static int16_t tcx_arith_decode( return bp; } +#endif static Word16 tcx_arith_decode_ivas_fx( const Word16 L_frame, /* i : number of spectral lines */ @@ -131,13 +133,13 @@ static Word16 tcx_arith_decode_ivas_fx( Tastat as; UWord16 exp_k; Word16 tmp; - Word32 L_tmp; + //Word32 L_tmp; bp = ari_start_decoding_14bits_prm_ivas_fx( prm, 0, &as ); tmp = sub(envelope_e, 1); - L_tmp = L_deposit_l(0); + //L_tmp = L_deposit_l(0); FOR (k = 0; k < L_frame; k++) { diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index f7c8c7863..ac9a9d608 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -67,7 +67,9 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t Pit_track( const float syn[], int16_t T ); +#endif /*---------------------------------------------------------------------* * bass_psfilter_init() @@ -405,6 +407,7 @@ void bass_psfilter( *---------------------------------------------------------------------*/ /*! r: Pitch */ +#ifndef IVAS_FLOAT_FIXED static int16_t Pit_track( const float syn[], /* i : synthesis [-NBPSF_PIT_MAX..L_HALFR16k] */ int16_t T /* i : pitch period (>= PIT_MIN) */ @@ -449,6 +452,7 @@ static int16_t Pit_track( return ( T ); } +#endif /*---------------------------------------------------------------------* diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index c5001197f..7c773725e 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -58,10 +58,18 @@ void open_decoder_LPD( const int16_t is_init /* i : indicate call during initialization */ ) { +#ifndef IVAS_FLOAT_FIXED int16_t mem_syn_r_size_old; int16_t mem_syn_r_size_new; +#endif +#ifndef IVAS_FLOAT_FIXED int16_t fscaleFB; - int16_t encoderLookahead, encoderLookaheadFB; +#endif + +#ifndef IVAS_FLOAT_FIXED + int16_t encoderLookahead; + int16_t encoderLookaheadFB; +#endif TCX_LTP_DEC_HANDLE hTcxLtpDec = st->hTcxLtpDec; TCX_DEC_HANDLE hTcxDec = st->hTcxDec; @@ -72,7 +80,9 @@ void open_decoder_LPD( st->sr_core = getCoreSamplerateMode2_flt( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); st->fscale = sr2fscale( st->sr_core ); +#ifndef IVAS_FLOAT_FIXED fscaleFB = sr2fscale( st->output_Fs ); +#endif /* initializing variables for frame lengths etc. right in the beginning */ st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); @@ -105,8 +115,11 @@ void open_decoder_LPD( st->TcxBandwidth_float = getTcxBandwidth_flt(bwidth); #endif st->narrowBand = (bwidth == NB) ? 1 : 0; + +#ifndef IVAS_FLOAT_FIXED encoderLookahead = (L_LOOK_12k8 * st->fscale) / FSCALE_DENOM; encoderLookaheadFB = (L_LOOK_12k8 * fscaleFB) / FSCALE_DENOM; +#endif if (st->element_mode == IVAS_CPE_MDCT) { @@ -258,8 +271,10 @@ void open_decoder_LPD( set_zero(st->mem_syn_r_float, L_SYN_MEM); #endif // #ifndef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED mem_syn_r_size_old = 0; /* just to avoid MSVC warnings */ mem_syn_r_size_new = 0; /* just to avoid MSVC warnings */ +#endif st->con_tcx = 0; } @@ -273,8 +288,10 @@ void open_decoder_LPD( } #endif /*Compute size of old and new memories*/ +#ifndef IVAS_FLOAT_FIXED mem_syn_r_size_old = (int16_t)(1.25 * st->last_L_frame / 20.f); mem_syn_r_size_new = (int16_t)(1.25 * st->L_frame / 20.f); +#endif #ifndef IVAS_FLOAT_FIXED /*Reset LPC mem*/ diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index c6baf3efd..eb47d3849 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1110,7 +1110,7 @@ void open_decoder_LPD_ivas_fx( Word16 mem_syn_r_size_new; Word16 mem_syn_r_size_old; Word16 fscaleFB; - Word16 encoderLookahead, encoderLookaheadFB; + //Word16 encoderLookahead, encoderLookaheadFB; BPF_DEC_HANDLE hBPF; TD_BWE_DEC_HANDLE hBWE_TD; TCX_LTP_DEC_HANDLE hTcxLtpDec; @@ -1174,8 +1174,8 @@ void open_decoder_LPD_ivas_fx( st->narrowBand = 1; } // To be replaced with basops - encoderLookahead = mult( L_LOOK_12k8<<6 , st->fscale ); - encoderLookaheadFB = mult(L_LOOK_12k8<<6 , fscaleFB ); + //encoderLookahead = mult( L_LOOK_12k8<<6 , st->fscale ); + //encoderLookaheadFB = mult(L_LOOK_12k8<<6 , fscaleFB ); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { st->pit_res_max = initPitchLagParameters( INT_FS_12k8, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max ); diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index ef01cc2bd..f0afb5983 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -57,10 +57,6 @@ static void core_switch_lb_upsamp( Decoder_State *st, float *output ); static void smoothTransitionDtxToTcx( float synth[], const int16_t output_frame, const int16_t delay_comp ); #endif -#ifdef IVAS_FLOAT_FIXED -static void core_switch_lb_upsamp_fx( Decoder_State *st, Word32 *output ); -static void smoothTransitionDtxToTcx_fx( Word32 synth[], const int16_t output_frame, const int16_t delay_comp ); -#endif /*---------------------------------------------------------------------* * core_switching_pre_dec() @@ -2142,77 +2138,6 @@ static void core_switch_lb_upsamp( return; } #endif -#ifdef IVAS_FLOAT_FIXED -static void core_switch_lb_upsamp_fx( - Decoder_State *st, /* i/o: Decoder state */ - Word32 *output /* i/o: LB synth/upsampled LB synth */ -) -{ - Word16 i; - Word32 *realBuffer_fx[CLDFB_OVRLP_MIN_SLOTS], *imagBuffer_fx[CLDFB_OVRLP_MIN_SLOTS]; - Word32 realBufferTmp_fx[CLDFB_OVRLP_MIN_SLOTS][CLDFB_NO_CHANNELS_MAX]; - Word32 imagBufferTmp_fx[CLDFB_OVRLP_MIN_SLOTS][CLDFB_NO_CHANNELS_MAX]; - - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - FOR( i = 0; i < CLDFB_OVRLP_MIN_SLOTS; i++ ) - { - set32_fx( realBufferTmp_fx[i], 0, CLDFB_NO_CHANNELS_MAX ); - set32_fx( imagBufferTmp_fx[i], 0, CLDFB_NO_CHANNELS_MAX ); - realBuffer_fx[i] = realBufferTmp_fx[i]; - imagBuffer_fx[i] = imagBufferTmp_fx[i]; - } - - /* check if the CLDFB works on the right sample rate */ - IF( NE_16( ( st->cldfbAna->no_channels * st->cldfbAna->no_col ), st->L_frame ) ) - { - resampleCldfb_ivas_fx( st->cldfbAna, L_mult0( st->L_frame, FRAMES_PER_SEC ) ); - - IF( st->cldfbBPF != NULL && LE_16( st->L_frame, L_FRAME16k ) ) - { - resampleCldfb_ivas_fx( st->cldfbBPF, L_mult0( st->L_frame, FRAMES_PER_SEC ) ); - } - - IF( GT_16( st->ini_frame, 0 ) ) - { - st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); - move16(); - } - } - /* analysis of the synthesis at internal sampling rate */ - cldfbAnalysis_ivas_fx( output, realBuffer_fx, imagBuffer_fx, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbAna->no_channels ), st->cldfbAna ); - - /* analysis and add the BPF error signal */ - IF( st->p_bpf_noise_buf_32 ) - { - addBassPostFilter_ivas_fx( st->p_bpf_noise_buf_32, st->bpf_off ? 0 : i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbBPF->no_channels ), realBuffer_fx, imagBuffer_fx, st->cldfbBPF ); - } - - /* set output mask for upsampling */ - IF( EQ_16( st->bwidth, NB ) ) - { - /* set NB mask for upsampling */ - st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, 10 ); - } - ELSE IF( NE_16( st->cldfbSyn->bandsToZero, sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ) ) ) - { - /* in case of BW switching, re-init to default */ - st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); - move16(); - } - - /* synthesis of the combined signal */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), st->cldfbSyn ); - - /* save synthesis - needed in case of core switching */ - IF( st->hTcxDec != NULL ) - { - Copy32( output, st->previoussynth_fx_32, st->hTcxDec->L_frameTCX ); - } - - return; -} -#endif - /*---------------------------------------------------------------------* * smoothTransitionDtxToTcx() @@ -2280,67 +2205,4 @@ static void smoothTransitionDtxToTcx( return; } -#endif -#ifdef IVAS_FLOAT_FIXED -static void smoothTransitionDtxToTcx_fx( - Word32 synth[], /* i/o: synthesis */ - const Word16 output_frame, /* i : output frame length */ - const Word16 delay_comp /* i : delay compensation in samples */ -) -{ - Word16 i, filter_len; - Word16 w, step, fade_in; - Word32 mem; - Word32 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; - Word32 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; - - filter_len = TRANSITION_SMOOTHING_LEN_16k; - IF( EQ_16( output_frame, L_FRAME32k ) ) - { - filter_len = TRANSITION_SMOOTHING_LEN_32k; - } - ELSE IF( EQ_16( output_frame, L_FRAME48k ) ) - { - filter_len = TRANSITION_SMOOTHING_LEN_48k; - } - - /* prepare buffer */ - FOR( i = 0; i < filter_len / 2; i++ ) - { - smoothing_input_buffer[i] = synth[0]; - } - Copy32( synth, smoothing_input_buffer + filter_len / 2, add( shl( delay_comp, 1 ), shr( filter_len, 1 ) ) ); - - /* apply Mean filter */ - w = div_s( 1, filter_len ); - mem = sum32_fx( smoothing_input_buffer, filter_len ); - FOR( i = 0; i < 2 * delay_comp; i++ ) - { - smoothing_out_buffer[i] = Mpy_32_16_1( mem, w ); - move32(); - mem = L_add( mem, L_sub( smoothing_input_buffer[i + filter_len], smoothing_input_buffer[i] ) ); - } - - /* apply fades around transition */ - step = div_s( 1, delay_comp ); - step = shr( step, 2 ); - fade_in = extract_l( 0 ); - FOR( i = 0; i < delay_comp; i++ ) - { - synth[i] = L_add( Mpy_32_16_1( smoothing_out_buffer[i], fade_in ), Mpy_32_16_1( synth[i], sub( ONE_IN_Q15 - 1, fade_in ) ) ); - move32(); - fade_in = add( fade_in, step ); - } - - fade_in = 0; - FOR( ; i < 2 * delay_comp; i++ ) - { - synth[i] = L_add( Mpy_32_16_1( synth[i], fade_in ), Mpy_32_16_1( smoothing_out_buffer[i], sub( ONE_IN_Q15 - 1, fade_in ) ) ); - move32(); - fade_in = add( fade_in, step ); - } - - - return; -} -#endif +#endif \ No newline at end of file diff --git a/lib_dec/dec_post.c b/lib_dec/dec_post.c index a38a4155c..8c2059322 100644 --- a/lib_dec/dec_post.c +++ b/lib_dec/dec_post.c @@ -53,21 +53,37 @@ * Local function prototypes *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Dec_postfilt( const int16_t L_subfr, PFSTAT *pfstat, const int16_t t0, const float *signal_ptr, const float *coeff, float *sig_out, const float gamma1, const float gamma2, const float gain_factor, const int16_t disable_hpf ); +#endif +#ifndef IVAS_FLOAT_FIXED static void pst_ltp( const int16_t t0, const float *ptr_sig_in, float *ptr_sig_pst0, float gain_factor, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static void search_del( const int16_t t0, const float *ptr_sig_in, int16_t *ltpdel, int16_t *phase, float *num_gltp, float *den_gltp, float *y_up, int16_t *off_yup, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static void filt_plt( const float *s_in, const float *s_ltp, float *s_out, const float gain_plt, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static void compute_ltp_l( const float *s_in, const int16_t ltpdel, const int16_t phase, float *y_up, float *num, float *den, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t select_ltp( const float num1, const float den1, const float num2, const float den2 ); +#endif +#ifndef IVAS_FLOAT_FIXED static void modify_pst_param( const float psf_lp_noise, float *g1, float *g2, const int16_t coder_type, float *gain_factor ); +#endif +#ifndef IVAS_FLOAT_FIXED static void Dec_formant_postfilt( PFSTAT *pfstat, const float *signal_ptr, const float *coeff, float *sig_out, const float gamma1, const float gamma2, const int16_t l_subfr ); +#endif /*--------------------------------------------------------------------------* @@ -455,6 +471,7 @@ static void Dec_formant_postfilt( * Perform harmonic postfilter *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void pst_ltp( const int16_t t0, /* i : pitch delay given by coder */ const float *ptr_sig_in, /* i : postfilter input filter (residu2) */ @@ -522,6 +539,7 @@ static void pst_ltp( return; } +#endif /*---------------------------------------------------------------------------- * search_del() @@ -529,6 +547,7 @@ static void pst_ltp( * Computes best (shortest) integer LTP delay + fine search *---------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void search_del( const int16_t t0, /* i : pitch delay given by coder */ const float *ptr_sig_in, /* i : input signal (with delay line) */ @@ -809,6 +828,7 @@ static void search_del( return; } +#endif /*---------------------------------------------------------------------------- * filt_plt() @@ -816,6 +836,7 @@ static void search_del( * Perform long term postfilter *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void filt_plt( const float *s_in, /* i : input signal with past */ const float *s_ltp, /* i : filtered signal with gain 1 */ @@ -836,6 +857,7 @@ static void filt_plt( return; } +#endif /*---------------------------------------------------------------------------- * compute_ltp_l() @@ -844,6 +866,7 @@ static void filt_plt( * with long interpolation filter *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void compute_ltp_l( const float *s_in, /* i : input signal with past */ const int16_t ltpdel, /* i : delay factor */ @@ -896,6 +919,7 @@ static void compute_ltp_l( return; } +#endif /*---------------------------------------------------------------------------- * select_ltp() @@ -906,6 +930,7 @@ static void compute_ltp_l( *----------------------------------------------------------------------------*/ /*! r: 1 = 1st gain, 2 = 2nd gain */ +#ifndef IVAS_FLOAT_FIXED static int16_t select_ltp( const float num1, /* i : numerator of gain1 */ const float den1, /* i : denominator of gain1 */ @@ -927,6 +952,7 @@ static int16_t select_ltp( return ( 1 ); } } +#endif /*------------------------------------------------------------------------------------ @@ -935,6 +961,7 @@ static int16_t select_ltp( * Modify gamma1 and gamma2 values in function of the long-term noise level *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void modify_pst_param( const float psf_lp_noise, /* i : Long term noise energy */ float *g1, /* o : Gamma1 used in post filter */ @@ -994,3 +1021,4 @@ static void modify_pst_param( return; } +#endif diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index dabf190f2..aa9170ca7 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -47,6 +47,7 @@ #include "ivas_rom_com.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #ifndef IVAS_FLOAT_FIXED_UNIT_TESTING #include "debug.h" #endif // !IVAS_FLOAT_FIXED_UNIT_TESTING diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index a841e75e9..2b8d3209c 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3084,14 +3084,14 @@ void IMDCT_ivas_fx( Word16 buf_fx[L_FRAME_MAX / 4]; Word16 window_buf_fx[L_FRAME_MAX / 4]; Word32 r_fx[M + 1]; - Word16 q_r, q_old_Aq_12_8, q_buf; + Word16 q_r, q_buf; /* get the first 5 ms of non-aliased TCX syntesis */ mvs2s( xn_buf_fx + add(shr(overlap, 1), shl(acelp_mem_len, 1)), &buf_fx[0], analysis_len ); q_buf = q_win; move16(); - q_old_Aq_12_8 = 28; + //q_old_Aq_12_8 = 28; move16(); ham_cos_window_ivas( &window_buf_fx[0], analysis_len / 2, analysis_len / 2 ); diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index b2d730deb..3aece14b8 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1207,11 +1207,11 @@ Word16 ApplyFdCng_ivas_fx( #endif Word64 W_tmp; Word16 L_frame, last_L_frame; - Word32 *sidNoiseEst; + //Word32 *sidNoiseEst; hFdCngDec = st->hFdCngDec; hFdCngCom = hFdCngDec->hFdCngCom; - sidNoiseEst = hFdCngCom->sidNoiseEst; + //sidNoiseEst = hFdCngCom->sidNoiseEst; /* limit L_frame and core fs values for MDCT-Stereo modes which can have higher core sampling than 16kHz, but use a downsampled buffer */ L_frame = s_min( st->L_frame, L_FRAME16k ); @@ -1703,11 +1703,11 @@ Word16 ApplyFdCng_ivas_fx( } ELSE { - IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) - { - sidNoiseEst = hFdCngCom->sidNoiseEstLp; - move16(); - } + //IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) + //{ + // sidNoiseEst = hFdCngCom->sidNoiseEstLp; + // move16(); + //} /* Interpolate the CLDFB band levels from the SID (partition) levels */ IF( GT_16( hFdCngCom->regularStopBand, hFdCngCom->numCoreBands ) ) { @@ -1789,7 +1789,7 @@ Word16 ApplyFdCng_ivas_fx( { IF( !( hFdCngCom->msFrCnt_init_counter < hFdCngCom->msFrCnt_init_thresh ) ) { - sidNoiseEst = hFdCngCom->sidNoiseEstLp; + //sidNoiseEst = hFdCngCom->sidNoiseEstLp; s2 = negate( sub( WORD32_BITS, 1 ) ); move16(); diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index 2267d44d8..66b39ade4 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -51,17 +51,29 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hp400_12k8( float signal[], const int16_t lg, float mem[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void filt_6k_7k( float signal[], const int16_t lg, float mem[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void hf_synthesis( ZERO_BWE_DEC_HANDLE hBWE_zero, const int32_t core_brate, const int16_t output_frame, const float Aq[], const float exc[], float synth[], float synth16k[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void hf_synthesis_amr_wb( const int32_t core_brate, const int16_t output_subfr, const float Ap[], float exc16k[], float synth_out[], float *mem_syn_hf, float *delay_syn_hf, float *mem_hp_interp, float p_r, float hf_gain_i, float til, float voice_factors, const float exc[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void envelope( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const int32_t core_brate, const float Aq[], float Ap[], float *r, float tilt0, float tilt, float voice_factor ); +#endif +#ifndef IVAS_FLOAT_FIXED static void AdaptiveStartBand( int16_t *start_band, const int32_t core_brate, const float *lsf, const float voicing_fac, const int16_t clas, int16_t *voicing_flag, int16_t *start_band_old, float *OptCrit_old ); +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -489,6 +501,7 @@ void hf_synth_amr_wb( * - Set energy of high band *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hf_synthesis_amr_wb( const int32_t core_brate, /* i : core bitrate */ const int16_t output_subfr, /* i : output sub-frame length */ @@ -573,6 +586,7 @@ static void hf_synthesis_amr_wb( return; } +#endif /*-----------------------------------------------------------------------------------* @@ -581,6 +595,7 @@ static void hf_synthesis_amr_wb( * *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t EnhanceClass( const float qq, const float pp, @@ -621,6 +636,7 @@ static int16_t EnhanceClass( return ( *unvoicing_flag && qq > pp ); } +#endif /*-----------------------------------------------------------------------------------* * envelope() @@ -628,6 +644,7 @@ static int16_t EnhanceClass( * *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void envelope( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const int32_t core_brate, /* i : core bitrate */ @@ -763,6 +780,7 @@ static void envelope( return; } +#endif /*---------------------------------------------------------------------* * AdaptiveStartBand() @@ -770,6 +788,7 @@ static void envelope( * adaptively select the start band of bandwidth extension *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void AdaptiveStartBand( int16_t *start_band, /* o : start point of copied band */ const int32_t core_brate, /* i : core bitrate */ @@ -880,7 +899,7 @@ static void AdaptiveStartBand( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -1095,6 +1114,7 @@ static void hf_synthesis( * float a[3] = {1.000000000, 1.787109375, -0.864257812}; *-----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hp400_12k8( float signal[], /* i/o: signal */ const int16_t lg, /* i : length of signal */ @@ -1130,6 +1150,7 @@ static void hp400_12k8( return; } +#endif /*-------------------------------------------------------------------* * filt_6k_7k() @@ -1141,6 +1162,7 @@ static void hp400_12k8( * (gain = 4.0) *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void filt_6k_7k( float signal[], /* i/o: signal */ const int16_t lg, /* i : signal length */ @@ -1179,3 +1201,4 @@ static void filt_6k_7k( return; } +#endif diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index af60516cf..c62767ab8 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -8,6 +8,7 @@ #include "prot_fx2.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ #include "basop32.h" +#include "prot.h" /*---------------------------------------------------------------------* * Local constants @@ -49,38 +50,37 @@ static void AdaptiveStartBand_fx( Word16 *start_band, const Word32 rate, const *-------------------------------------------------------------------*/ void hf_synth_init_fx( - ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ + ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ ) { - hBWE_zero->seed2 = RANDOM_INITSEED; - set16_fx( hBWE_zero->mem_hf_fx, 0, ( L_FIR - 1 ) ); - set16_fx( hBWE_zero->mem_syn_hf_fx, 0, M ); - set16_fx( hBWE_zero->mem_hp400_fx, 0, 4 ); - set16_fx( hBWE_zero->delay_syn_hf_fx, 0, NS2SA( 16000, DELAY_CLDFB_NS ) ); - set16_fx( hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN ); - - return; + hBWE_zero->seed2 = RANDOM_INITSEED; + set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); + set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); + set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); + set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); + set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); + + return; } - void hf_synth_reset_fx( - ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ + ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ ) { - Word16 i; + Word16 i; - FOR(i = 0; i < L_FRAME16k; i++) - { - Random(&hBWE_zero->seed2); - } + FOR(i = 0; i < L_FRAME16k; i++) + { + Random(&hBWE_zero->seed2); + } - set16_fx(hBWE_zero->mem_hf_fx, 0, ( L_FIR - 1 ) ); - set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); - set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); /* TBV -> mem_hp400_fx has a length of 6, but only 4 values initialized in EVS ??? */ + set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); + set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); + set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); /* TBV -> mem_hp400_fx has a length of 6, but only 4 values initialized in EVS ??? */ - set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); - set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); + set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); + set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); - return; + return; } /*---------------------------------------------------------------------* diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index f1d5e40cb..a3d31ee09 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -623,10 +623,10 @@ void ivas_hq_core_dec_fx( TCX_DEC_HANDLE hTcxDec; TCX_CONFIG_HANDLE tcx_cfg; Word16 index, left_rect, tcx_offsetFB, overlapFB, L_frameTCX; - Word16 tcx_offset, overlap, L_frame, fscaleFB; + Word16 tcx_offset, overlap, L_frame; Word16 L_frameTCX_glob, L_frame_glob; Word16 acelp_zir[L_FRAME_MAX / 2]; - Word16 encoderLookahead, encoderLookaheadFB; + //Word16 encoderLookahead, encoderLookaheadFB; Word16 hq_recovery_flag; Word16 mdctWindowLength; Word16 mdctWindowLengthFB; @@ -923,9 +923,9 @@ void ivas_hq_core_dec_fx( L_spec = hTcxDec->L_frameTCX; move16(); st_fx->fscale = sr2fscale( st_fx->sr_core ); - fscaleFB = sr2fscale( st_fx->output_Fs ); - encoderLookahead = ( L_LOOK_12k8 * st_fx->fscale ) / FSCALE_DENOM; - encoderLookaheadFB = ( L_LOOK_12k8 * fscaleFB ) / FSCALE_DENOM; + //fscaleFB = sr2fscale( st_fx->output_Fs ); + //encoderLookahead = ( L_LOOK_12k8 * st_fx->fscale ) / FSCALE_DENOM; + //encoderLookaheadFB = ( L_LOOK_12k8 * fscaleFB ) / FSCALE_DENOM; mdctWindowLength = getMdctWindowLength( st_fx->fscale ); mdctWindowLengthFB = (int16_t) ( mdctWindowLength * st_fx->output_Fs / st_fx->sr_core ); IF( core_switching_flag ) diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 1a2e0266b..302d0ba15 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -49,14 +49,21 @@ * Local function prototypes *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t p2a_threshold_dequant( Decoder_State *st, int16_t *p2a_flags, const int16_t bands, const int16_t p2a_bands ); +#endif +#ifndef IVAS_FLOAT_FIXED static void mdct_spectrum_fine_gain_dec( Decoder_State *st, float y2[], const int16_t band_start[], const int16_t band_end[], const int16_t k_sort[], const int16_t bands, const Word32 L_qint, const int16_t Ngq, const int16_t gqlevs, const int16_t gqbits ); +#endif +#ifndef IVAS_FLOAT_FIXED static float band_energy_dequant( Decoder_State *st, float band_energy[], const int16_t bands, const Word32 L_qint, const Word16 eref_fx, const int16_t is_transient ); +#endif +#ifndef IVAS_FLOAT_FIXED static void spt_shorten_domain_set_dec( Decoder_State *st, const int16_t p2a_flags[], const int16_t new_band_start[], const int16_t new_band_end[], const int16_t new_band_width[], const int16_t bands, int16_t band_start[], int16_t band_end[], int16_t band_width[], int16_t *bit_budget ); - +#endif /*-------------------------------------------------------------------* * hq_lr_dec() @@ -954,6 +961,7 @@ void hq_lr_dec( * Huffman decoding of differential energies *--------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: bits */ static int16_t small_symbol_dec_tran( Decoder_State *st, /* i/o: decoder state structure */ @@ -980,6 +988,7 @@ static int16_t small_symbol_dec_tran( return ( bits ); } +#endif /*-------------------------------------------------------------------------- @@ -988,6 +997,7 @@ static int16_t small_symbol_dec_tran( * Huffman decoding of differential energies (MSB and LSB) *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: bits */ static int16_t small_symbol_dec( Decoder_State *st, /* i/o: decoder state structure */ @@ -1025,7 +1035,9 @@ static int16_t small_symbol_dec( return ( bits ); } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * decode_huff_8s() * @@ -1048,6 +1060,7 @@ static int16_t decode_huff_8s( return ( -*hufftab ); } +#endif /*-------------------------------------------------------------------------- @@ -1056,6 +1069,7 @@ static int16_t decode_huff_8s( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: bits */ static int16_t large_symbol_dec( Decoder_State *st, /* i/o: decoder state structure */ @@ -1162,6 +1176,7 @@ static int16_t large_symbol_dec( return cntbits; /* xx bits for diff. energies + 1 bit for LC coding mode */ } +#endif /*--------------------------------------------------------------------------* @@ -1170,6 +1185,7 @@ static int16_t large_symbol_dec( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float band_energy_dequant( Decoder_State *st, /* i/o: decoder state structure */ float band_energy[], @@ -1245,6 +1261,7 @@ static float band_energy_dequant( return ( deng_bits ); } +#endif /*--------------------------------------------------------------------------* @@ -1253,6 +1270,7 @@ static float band_energy_dequant( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t p2a_threshold_dequant( Decoder_State *st, /* i/o: decoder state structure */ int16_t *p2a_flags, @@ -1275,7 +1293,7 @@ static int16_t p2a_threshold_dequant( return ( j ); } - +#endif /*--------------------------------------------------------------------------* * mdct_spectrum_fine_gain_dec() @@ -1283,6 +1301,7 @@ static int16_t p2a_threshold_dequant( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mdct_spectrum_fine_gain_dec( Decoder_State *st, /* i/o: decoder state structure */ float y2[], @@ -1346,6 +1365,7 @@ static void mdct_spectrum_fine_gain_dec( return; } +#endif /*--------------------------------------------------------------------------* * spt_shorten_domain_set_dec() @@ -1353,6 +1373,7 @@ static void mdct_spectrum_fine_gain_dec( * update the shorten band information based on p2a analysis *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spt_shorten_domain_set_dec( Decoder_State *st, /* i : decoder state structure */ const int16_t p2a_flags[], /* i : p2a anlysis information */ @@ -1390,3 +1411,4 @@ static void spt_shorten_domain_set_dec( return; } +#endif \ No newline at end of file diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index c9251d4d6..494780d7b 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -55,6 +55,7 @@ *-------------------------------------------------------------------*/ /*! r: number of noise bands */ +#ifndef IVAS_FLOAT_FIXED static int16_t IGF_replaceTCXNoise_1_flr( const float *in, /* i : MDCT spectrum */ const uint8_t *TCXNoise, /* i : tcx noise indicator vector */ @@ -82,6 +83,7 @@ static int16_t IGF_replaceTCXNoise_1_flr( return noise; } +#endif /*-------------------------------------------------------------------* @@ -90,6 +92,7 @@ static int16_t IGF_replaceTCXNoise_1_flr( * replaces TCX noise *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_replaceTCXNoise_2_flt( float *in, /* i/o: MDCT spectrum */ const uint8_t *TCXNoise, /* i : tcx noise indicator vector */ @@ -127,7 +130,7 @@ static void IGF_replaceTCXNoise_2_flt( return; } - +#endif /*-------------------------------------------------------------------* * IGF_replaceTCXNoise_2_new_flt() @@ -135,6 +138,7 @@ static void IGF_replaceTCXNoise_2_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_replaceTCXNoise_2_new_flt( float *in, /* i/o: MDCT spectrum */ const uint8_t *TCXNoise, /* i : tcx noise indicator vector */ @@ -183,6 +187,7 @@ static void IGF_replaceTCXNoise_2_new_flt( return; } +#endif /*-------------------------------------------------------------------* @@ -228,6 +233,7 @@ static void IGF_decode_whitening_level_flt( * square the MDCT spectrum *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_getMDCTSquare_flt( const int16_t startLine, /* i : start MDCT subband index */ const int16_t stopLine, /* i : stop MDCT subband index */ @@ -244,6 +250,7 @@ static void IGF_getMDCTSquare_flt( return; } +#endif /*-------------------------------------------------------------------* @@ -252,6 +259,7 @@ static void IGF_getMDCTSquare_flt( * calculate energy per SFB *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_calcSfbEnergy_flt( const int16_t startSfb, /* i : start sfb index */ const int16_t stopSfb, /* i : stop sfb index */ @@ -275,6 +283,7 @@ static void IGF_calcSfbEnergy_flt( return; } +#endif /*-------------------------------------------------------------------* @@ -283,6 +292,7 @@ static void IGF_calcSfbEnergy_flt( * set power spectrum values to zero, needed for energy calculation *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_setLinesToZero_flt( const int16_t startLine, /* i : start MDCT subband index */ const int16_t stopLine, /* i : stop MDCT subband index */ @@ -302,6 +312,7 @@ static void IGF_setLinesToZero_flt( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -953,6 +964,7 @@ static void IGF_getWhiteSpectralData_flt( * refines the IGF grid *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_RefineGrid_flt( H_IGF_GRID hGrid /* i/o: IGF grid handle */ ) @@ -986,6 +998,7 @@ static void IGF_RefineGrid_flt( return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 27e9a3ede..cd013cff6 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -47,41 +47,6 @@ #include "ivas_prot_fx.h" #endif - -#ifdef IVAS_FLOAT_FIXED -static Word16 norm_arr_l(float *arr, int size); -static Word16 norm(float num); - -static Word16 norm(float num) { - if ((Word32)num == 0) return 31; - return norm_l((Word32)num); -} -static Word16 norm_arr_l(float *arr, int size) -{ - Word16 q = 31; - for (int i = 0; i < size; i++) - if (arr[i] != 0) - { - q = min(q, norm(arr[i])); - } - return q; -} -static Word16 s_norm(float num) { - if ((Word16)num == 0) return 15; - return norm_s((Word16)num); -} -static Word16 norm_arr_s(float *arr, int size) -{ - Word16 q = 15; - for (int i = 0; i < size; i++) - if (arr[i] != 0) - { - q = min(q, s_norm(arr[i])); - } - return q; -} -#endif - /*-------------------------------------------------------------------* * ivas_core_dec() * @@ -986,8 +951,8 @@ ivas_error ivas_core_dec( Q_synth_fx = 0; move16(); - TD_BWE_DEC_HANDLE hBWE_TD; - hBWE_TD = st->hBWE_TD; + //TD_BWE_DEC_HANDLE hBWE_TD; + //hBWE_TD = st->hBWE_TD; FD_BWE_DEC_HANDLE hBWE_FD; hBWE_FD = st->hBWE_FD; @@ -1152,7 +1117,7 @@ ivas_error ivas_core_dec( Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); #ifdef MSAN_FIX - IF( !( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) || ( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) ) ) + IF( !( ( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) ) || ( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) ) ) { Scale_sig32( hb_synth_32_fx[0], output_frame, sub( Q11, q ) ); Scale_sig32( hb_synth_32_fx[1], output_frame, sub( Q11, q ) ); diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index a86493ba4..0bcb595dc 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -51,9 +51,13 @@ * Local function prototypes *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void read_stereo_mode_and_bwidth( CPE_DEC_HANDLE hCPE, const Decoder_Struct *st_ivas ); +#endif +#ifndef IVAS_FLOAT_FIXED static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE ); +#endif /*--------------------------------------------------------------------------* @@ -966,6 +970,7 @@ void destroy_cpe_dec( * Read stereo technology info & audio bandwidth *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void read_stereo_mode_and_bwidth( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ const Decoder_Struct *st_ivas /* i : decoder main structure */ @@ -1073,7 +1078,7 @@ static void read_stereo_mode_and_bwidth( return; } - +#endif /*------------------------------------------------------------------------- * stereo_mode_combined_format_dec() @@ -1081,6 +1086,7 @@ static void read_stereo_mode_and_bwidth( * Set stereo format in a combined format *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, /* i : decoder main structure */ CPE_DEC_HANDLE hCPE /* i/o: CPE handle */ @@ -1119,3 +1125,4 @@ static void stereo_mode_combined_format_dec( return; } +#endif diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index bf2c88053..4c763fcc0 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -122,11 +122,11 @@ ivas_error ivas_cpe_dec_fx( #if 1 // Float to fix conversions float maxim = 0; - Word16 q_output_mem, q_buff_LBTCX_mem, q_input_mem_LB, q_old_out = 31, q_old_out_LB = 31, q_tcxltp_mem_in_float; - q_output_mem = 11; + Word16 q_old_out = 31, q_old_out_LB = 31; + //q_output_mem = 11; maxim = 0; - q_buff_LBTCX_mem = 11; - q_input_mem_LB = q_buff_LBTCX_mem; + //q_buff_LBTCX_mem = 11; + //q_input_mem_LB = q_buff_LBTCX_mem; maxim = 0; q_old_out = Q11; FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) @@ -160,7 +160,7 @@ ivas_error ivas_cpe_dec_fx( hCPE->hCoreCoder[ind1]->hHQ_core->q_old_outLB_fx = q_old_out_LB; } } - q_tcxltp_mem_in_float = 11; + //q_tcxltp_mem_in_float = 11; FOR( Word16 ind2 = 0; ind2 < 2; ind2++ ) { IF( hCPE->hCoreCoder[ind2] && hCPE->hCoreCoder[ind2]->cldfbSyn ) @@ -675,7 +675,7 @@ ivas_error ivas_cpe_dec_fx( IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; - FOR( int ii = 0; ii < sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ); ii++ ) + FOR( int ii = 0; ii < (int) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] )); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; } @@ -698,7 +698,7 @@ ivas_error ivas_cpe_dec_fx( IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; - FOR( int ii = 0; ii < sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ); ii++ ) + FOR( int ii = 0; ii < (int) (sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] )); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 2cb597e7d..88761d954 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -265,7 +265,7 @@ static ivas_error ivas_dirac_rend_config_fx( hDirACRend->hOutSetup = st_ivas->hIntSetup; nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; - IF( hDirACRend->hOutSetup.ls_azimuth_fx != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) + IF( hDirACRend->hOutSetup.ls_azimuth_fx != NULL && hDirACRend->hOutSetup.ls_elevation_fx != NULL ) { Copy32( hDirACRend->hOutSetup.ls_azimuth_fx, ls_azimuth_fx, nchan_out_woLFE ); Copy32( hDirACRend->hOutSetup.ls_elevation_fx, ls_elevation_fx, nchan_out_woLFE ); @@ -1760,15 +1760,15 @@ ivas_error ivas_dirac_dec_config_fx( { IF( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) { - float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + //float frequency_axis[CLDFB_NO_CHANNELS_MAX]; #ifdef IVAS_FLOAT_FIXED Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); - FOR( int i = 0; i < st_ivas->hSpatParamRendCom->num_freq_bands; i++ ) + /*FOR( int i = 0; i < st_ivas->hSpatParamRendCom->num_freq_bands; i++ ) { frequency_axis[i] = (float) frequency_axis_fx[i]; - } + }*/ IF( ( error = ivas_dirac_dec_decorr_open_fx( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, DIRAC_SYNTHESIS_PSD_LS, frequency_axis_fx, BINAURAL_CHANNELS, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) @@ -3587,7 +3587,9 @@ void ivas_dirac_dec_render_sf_fx( int16_t subframe_idx; int16_t slot_idx, index_slot; int16_t hodirac_flag; +#ifndef IVAS_FLOAT_FIXED float *p_Rmat; +#endif int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; /*CLDFB: last output channels reserved to LFT for CICPx*/ @@ -3689,13 +3691,11 @@ void ivas_dirac_dec_render_sf_fx( IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) { - p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; p_Rmat_fx = &st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; floatToFixed_arrL32( &st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][0][0], p_Rmat_fx, Q29, 9 ); } ELSE { - p_Rmat = 0; p_Rmat_fx = 0; } IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) @@ -4518,7 +4518,7 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp ); - Word32 flag = 0; + Flag flag = 0; move32(); fac = shl_o( fac, exp, &flag ); @@ -4945,7 +4945,6 @@ void ivas_dirac_dec_render_sf_fx( #endif /* Determine encoding quality based additional smoothing factor */ #ifdef IVAS_FLOAT_FIXED - float qualityBasedSmFactor = 1.0f; Word32 qualityBasedSmFactor_fx = ONE_IN_Q31; move32(); @@ -4956,8 +4955,6 @@ void ivas_dirac_dec_render_sf_fx( qualityBasedSmFactor_fx = L_deposit_h( st_ivas->hMasa->data.dir_decode_quality_fx ); // Q31 qualityBasedSmFactor_fx = Mpy_32_32( qualityBasedSmFactor_fx, qualityBasedSmFactor_fx ); // (Q31, Q31) -> Q31 } - - qualityBasedSmFactor = fixedToFloat( qualityBasedSmFactor_fx, Q31 ); #else float qualityBasedSmFactor = 1.0f; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index dd9cf413c..6c4c75e86 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -299,6 +299,15 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { + + if ( ( h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof(float) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + if ( ( h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof(float) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } if ( ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); @@ -315,6 +324,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { + h_dirac_output_synthesis_state->cx_old[idx] = NULL; + h_dirac_output_synthesis_state->cy_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; } @@ -1619,7 +1630,6 @@ Word16 computeMixingMatrices_fx( Word16 mixing_matrix_e; - Word16 Cr_buff_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; Word16 Cr_fx_e; @@ -2111,13 +2121,10 @@ Word16 computeMixingMatrices_fx( } /* Avoid Meaningless negative main diagonal elements */ - Cr_buff_e[i + i * lengthCy] = exp; IF(BASOP_Util_Cmp_Mant32Exp(Cr_fx[i + i * lengthCy], exp, 0, 0) < 0) { Cr_fx[i + i * lengthCy] = 0; move16(); - Cr_buff_e[i + i * lengthCy] = 0; - move16(); } } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7023c3741..46f510cfa 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -201,7 +201,7 @@ ivas_error ivas_dec_setup( DECODER_CONFIG_HANDLE hDecoderConfig=NULL; Word16 numch_out_dirac=0; SPAR_DEC_HANDLE hSpar = NULL; - Word16 numch_in, numch_out, num_md_sub_frames; + Word16 numch_in; IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) @@ -225,15 +225,15 @@ ivas_error ivas_dec_setup( } } hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + //uint16_t nchan_internal; + //nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); hDecoderConfig = st_ivas->hDecoderConfig; numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + //numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -1055,6 +1055,10 @@ ivas_error ivas_init_decoder_front( { set_zero((st_ivas->hLsSetupCustom)->ls_azimuth, MAX_OUTPUT_CHANNELS ); set_zero((st_ivas->hLsSetupCustom)->ls_elevation, MAX_OUTPUT_CHANNELS ); +#ifdef IVAS_FLOAT_FIXED + set_zero_fx((st_ivas->hLsSetupCustom)->ls_azimuth_fx, MAX_OUTPUT_CHANNELS ); + set_zero_fx((st_ivas->hLsSetupCustom)->ls_elevation_fx, MAX_OUTPUT_CHANNELS ); +#endif //set_f( ( st_ivas->hLsSetupCustom )->separate_ch_gains, 0.0f, MAX_OUTPUT_CHANNELS ); } ELSE @@ -1339,6 +1343,12 @@ ivas_error ivas_init_decoder_fx( st_ivas->hOutSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; +#ifdef IVAS_FLOAT_FIXED + st_ivas->hOutSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; + st_ivas->hOutSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; + st_ivas->hIntSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; + st_ivas->hIntSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; +#endif } ELSE @@ -1414,8 +1424,8 @@ ivas_error ivas_init_decoder_fx( IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { /*float2fix block: to be removed*/ - floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_azimuth, (Word32 *) st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); - floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_elevation, (Word32 *) st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); + //( (float *) st_ivas->hOutSetup.ls_azimuth, (Word32 *) st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); + //floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_elevation, (Word32 *) st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); /*float2fix block end*/ IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hOutSetup.ls_azimuth_fx, st_ivas->hOutSetup.ls_elevation_fx, st_ivas->hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { @@ -1491,8 +1501,8 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { /*float2fix block: to be removed*/ - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); /*float2fix end*/ IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { @@ -1648,8 +1658,8 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { /*float2fix block: to be removed*/ - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); /*float2fix end*/ IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 338314583..ce704794f 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -376,490 +376,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( return error; } #endif -#ifdef IVAS_FLOAT_FIXED -static ivas_error ivas_ism_bitrate_switching_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nchan_transport_old, /* i : last number of transport channels */ - const ISM_MODE last_ism_mode, /* i : last ISM mode */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - int16_t *data /* o : output synthesis signal */ -) -{ - ivas_error error; - int32_t element_brate_tmp[MAX_NUM_OBJECTS]; - int16_t nSCE_old, nCPE_old; - int16_t numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode; - TC_BUFFER_MODE tc_buffer_mode_new; - int16_t tc_nchan_tc_new; - int16_t tc_nchan_allocate_new; - int16_t tc_granularity_new; - int16_t nchan_out_buff, nchan_out_buff_old; - AUDIO_CONFIG intern_config_old; - IVAS_OUTPUT_SETUP hIntSetupOld; - RENDERER_TYPE renderer_type_old; - - error = IVAS_ERR_OK; - nCPE_old = st_ivas->nCPE; - nSCE_old = st_ivas->nSCE; - - /* temporarily set the ism mode back to the old one, otherwise this can give wrong results*/ - ism_mode = st_ivas->ism_mode; - st_ivas->ism_mode = last_ism_mode; - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); - st_ivas->ism_mode = ism_mode; - nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); - - if ( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->nSCE = st_ivas->nchan_transport; - - /*-----------------------------------------------------------------* - * Allocate, initialize, and configure SCE/CPE/MCT handles - *-----------------------------------------------------------------*/ - - IF ( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - - /*-----------------------------------------------------------------* - * HP20 memories - *-----------------------------------------------------------------*/ - if ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) - { - return error; - } - - //if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) - //{ - // return error; - //} - - /* save old IntSetup, might be needed for JBM flushing...*/ - intern_config_old = st_ivas->intern_config; - hIntSetupOld = st_ivas->hIntSetup; - tc_granularity_new = 1; - renderer_type_old = st_ivas->renderer_type; - - /*-----------------------------------------------------------------* - * Initialize the needed renderer struct and destroy the unnecessary renderer struct - *-----------------------------------------------------------------*/ - - /* select the renderer */ - ivas_renderer_select( st_ivas ); - - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - - if ( ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->ism_mode == ISM_MODE_DISC ) ) - { - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); - } - - { - /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) - { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; - mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } - - /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv - render what still fits in the new granularity */ - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - -#if 1 /*Float to fixed conversion*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } - if ( st_ivas->hSbaIsmData ) - { - for ( Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++ ) - { - floatToFixed_arr32( st_ivas->hSbaIsmData->delayBuffer[ch_idx], st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], Q11, st_ivas->hSbaIsmData->delayBuffer_size ); - } - } - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in, numch_out, num_md_sub_frames; - ; - Word16 numch_out_dirac = hDecoderConfig->nchan_out; - IF( hSpar ) - { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - hSpar->hMdDec->Q_mixer_mat = Q30; - for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); - } - } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] = float_to_fix( st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] ,Q11 ); - } - } - } - } - Word16 n_tc; - if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for (int ch = 0; ch < n_tc; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } -#endif - if ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 /*Fixed to float */ - if ( hTcBuffer->tc_buffer ) - fixedToFloat_arrL( hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len ); - IF( hSpar ) - { - FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ - } - } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); - } - } - } - } -#endif - - } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - - if ( st_ivas->ism_mode != last_ism_mode ) - { - /* EFAP handle */ - efap_free_data( &st_ivas->hEFAPdata ); - } - - /*-----------------------------------------------------------------* - * Switching between ParamISM and DiscISM - *-----------------------------------------------------------------*/ - - /* switching from ParamISM to DiscISM */ - if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) - { - /* Deallocate the ParamISM struct */ - ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); - - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) - { - /* close the parametric binaural renderer */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - /* Open the TD Binaural renderer */ - if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) - { - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - IF ( ( error = ivas_td_binaural_open_fx( st_ivas , SrcInd, &num_src ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float - Word16 nchan_rend = num_src; - IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p->SrcSpatial_p != NULL ) - { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); - } - Src_p->SrcSpatial_p->q_Pos_p = Q31; - } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); - SrcSpatial_p->q_Pos_p = Q31; - } -#endif - - if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - if ( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL,st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - } - else - { - /* close the ISM renderer and reinitialize */ - ivas_ism_renderer_close( &st_ivas->hIsmRendererData ); - - IF ( ( error = ivas_ism_renderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) - { - /* close the parametric binaural renderer */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - - /* Open Crend Binaural renderer */ - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; - } - } - - /* switching from Discrete ISM to ParamISM */ - if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) - { - /* Allocate and initialize the ParamISM struct */ - if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) - { - /* open the parametric binaural renderer */ - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1/*Cleanup Changes for ivas_dirac_dec_binaural_copy_hrtfs_fx*/ - FOR(Word16 i = 0; i < BINAURAL_CHANNELS; i++ ) - { - FOR(Word16 j = 0; j < HRTF_SH_CHANNELS; j++ ) - { - fixedToFloat_arr(st_ivas->hHrtfParambin->hrtfShCoeffsRe_fx[i][j], st_ivas->hHrtfParambin->hrtfShCoeffsRe[i][j], 15, HRTF_NUM_BINS ); - fixedToFloat_arr(st_ivas->hHrtfParambin->hrtfShCoeffsIm_fx[i][j], st_ivas->hHrtfParambin->hrtfShCoeffsIm[i][j], 14, HRTF_NUM_BINS ); - } - } - fixedToFloat_arrL(st_ivas->hHrtfParambin->parametricReverberationTimes_fx, st_ivas->hHrtfParambin->parametricReverberationTimes, 31, CLDFB_NO_CHANNELS_MAX ); - fixedToFloat_arrL(st_ivas->hHrtfParambin->parametricReverberationEneCorrections_fx, st_ivas->hHrtfParambin->parametricReverberationEneCorrections, 31, CLDFB_NO_CHANNELS_MAX ); - fixedToFloat_arrL(st_ivas->hHrtfParambin->parametricEarlyPartEneCorrection_fx, st_ivas->hHrtfParambin->parametricEarlyPartEneCorrection, 28, CLDFB_NO_CHANNELS_MAX ); -#endif - IF ( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* Close the TD Binaural renderer */ - if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) - { - ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; - - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - ivas_reverb_close( &st_ivas->hReverb ); - } - } - } - else - { - /* Close the ISM renderer */ - ivas_ism_renderer_close( &st_ivas->hIsmRendererData ); - } - - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) - { - /* open the parametric binaural renderer */ - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* close the crend binaural renderer */ - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); - } - } - - /*-----------------------------------------------------------------* - * CLDFB instances - *-----------------------------------------------------------------*/ - -#if 1 /*Cleanup changes: float to fixed*/ - Word16 i, Q_cldfbSynDec = 21; - FOR( i = 0; i < 16; i++ ) - { - IF( st_ivas->cldfbAnaDec[i] ) - floatToFixed_arrL( st_ivas->cldfbAnaDec[i]->cldfb_state, st_ivas->cldfbAnaDec[i]->cldfb_state_fx, 11, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } - IF ( st_ivas->hSpar ) - { - st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_factor_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, CLDFB_NO_COL_MAX ); - floatToFixed_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q, CLDFB_NO_COL_MAX ); - } - IF( st_ivas->cldfbSynDec[0] ) - { - Q_cldfbSynDec = s_min( Q_cldfbSynDec, Q_factor_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ) ); - floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } -#endif - IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 /*CCleanup changes:fixed to float changes*/ - FOR( i = 0; i < 16; i++ ) - { - IF( st_ivas->cldfbAnaDec[i] ) - fixedToFloat_arrL( st_ivas->cldfbAnaDec[i]->cldfb_state_fx, st_ivas->cldfbAnaDec[i]->cldfb_state, 11, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } - IF( st_ivas->cldfbSynDec[0] ) - { - fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } -#endif - - /*-----------------------------------------------------------------* - * floating-point output audio buffers - *-----------------------------------------------------------------*/ - - { - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - - IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /*-----------------------------------------------------------------* - * JBM TC buffers - *-----------------------------------------------------------------*/ - { - int16_t tc_nchan_full_new; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - - hTcBuffer = st_ivas->hTcBuffer; - tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); - tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - tc_nchan_allocate_new = tc_nchan_tc_new; - tc_nchan_full_new = tc_nchan_tc_new; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; - tc_nchan_full_new = tc_nchan_allocate_new; - } - - if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) - { - tc_nchan_full_new = 0; - } - - /* reconfigure buffer */ - if ( hTcBuffer->tc_buffer_mode != tc_buffer_mode_new || hTcBuffer->nchan_transport_jbm != tc_nchan_tc_new || - hTcBuffer->nchan_buffer_full != tc_nchan_full_new || hTcBuffer->nchan_transport_internal != tc_nchan_allocate_new ) - { - if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - if ( st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; - st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - - mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } - } - - return error; -} -#else +#ifndef IVAS_FLOAT_FIXED static ivas_error ivas_ism_bitrate_switching_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index eb6e5a174..823eaae5f 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -364,6 +364,7 @@ static void ivas_param_ism_collect_slot_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_param_ism_collect_slot( PARAM_ISM_DEC_HANDLE hParamIsmDec, /* i/o: decoder ParamISM handle */ float *Cldfb_RealBuffer_in, @@ -393,6 +394,7 @@ static void ivas_param_ism_collect_slot( return; } +#endif static void ivas_param_ism_compute_mixing_matrix( const int16_t nchan_ism, /* i : number of ISM channels */ @@ -2495,7 +2497,7 @@ static void ivas_ism_param_dec_render_sf_fx( /* CLDFB Synthesis */ idx_in = 0; idx_lfe = 0; - Word16 tmp_buff_Q[MAX_OUTPUT_CHANNELS]; + //Word16 tmp_buff_Q[MAX_OUTPUT_CHANNELS]; FOR ( ch = 0; ch < nchan_out; ch++ ) { @@ -2507,7 +2509,7 @@ static void ivas_ism_param_dec_render_sf_fx( { idx_lfe = add(idx_lfe,1); } - tmp_buff_Q[ch] = 0; + //tmp_buff_Q[ch] = 0; } ELSE { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 8b335e463..3e52052fa 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -58,7 +58,9 @@ static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] ); +#ifndef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout_fx( Decoder_Struct *st_ivas, const UWord16 nSamplesAsked, UWord16 *nSamplesRendered, Word32 *output_fx[] ); @@ -582,15 +584,15 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( p_output_fx[i], output_frame, sub( Q14, Q11 ) ); } SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx ), ( p_output_fx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -606,11 +608,11 @@ ivas_error ivas_jbm_dec_tc( #ifdef IVAS_FLOAT_FIXED { Word16 q; - float max_val = 0.0; - int i_max_val_op; + //float max_val = 0.0; + //int i_max_val_op; hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; - i_max_val_op = (int) max_val; + //i_max_val_op = (int) max_val; s = 0; FOR( i = 0; i < 2; i++ ) { @@ -795,19 +797,19 @@ ivas_error ivas_jbm_dec_tc( Word16 ch; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 Q_p_output = 14; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; FOR( ch = 0; ch < nchan_transport; ch++ ) { Scale_sig32( p_output_fx[ch], output_frame, sub( Q_p_output, Q11 ) ); } - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, p_output_fx, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #if 1 /*Fixed to float changes */ @@ -1248,15 +1250,15 @@ ivas_error ivas_jbm_dec_tc( #ifdef IVAS_FLOAT_FIXED #if 1 /*Float to Fixed changes */ SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -1389,19 +1391,19 @@ ivas_error ivas_jbm_dec_tc( Word16 ch; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 Q_p_output = 14; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; FOR( ch = 0; ch < nchan_transport; ch++ ) { Scale_sig32( p_output_fx[sba_ch_idx + ch], output_frame, sub( Q_p_output, Q11 ) ); } - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, &p_output_fx[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #if 1 @@ -2179,11 +2181,11 @@ ivas_error ivas_jbm_dec_tc( { #ifdef IVAS_FLOAT_FIXED Word16 q; - float max_val = 0.0; - int i_max_val_op; + //float max_val = 0.0; + //int i_max_val_op; hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; - i_max_val_op = (int) max_val; + //i_max_val_op = (int) max_val; s = 0; FOR( i = 0; i < 2; i++ ) { @@ -3265,16 +3267,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3427,16 +3429,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( } #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3564,16 +3566,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( { ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3703,16 +3705,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); } #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + // num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3951,16 +3953,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( { #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4332,7 +4334,7 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) { - Word16 slot_size, slots_to_render, tmp, e, slots_rendered, nSamplesRendered_tmp; + Word16 slot_size, slots_to_render, tmp, e, nSamplesRendered_tmp; slot_size = st_ivas->hTcBuffer->n_samples_granularity; @@ -4340,7 +4342,7 @@ ivas_error ivas_jbm_dec_render( tmp = BASOP_Util_Divide1616_Scale( nSamplesAsked, slot_size, &e ); tmp = shr( tmp, sub( 15, e ) ); slots_to_render = s_min( sub( st_ivas->hTcBuffer->num_slots, st_ivas->hTcBuffer->slots_rendered ), tmp ); - slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, slots_to_render ); + //slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, slots_to_render ); nSamplesRendered_tmp = (UWord16) L_mult0( slots_to_render, slot_size ); FOR( Word16 ind = 0; ind < st_ivas->hTcBuffer->nchan_transport_jbm; ind++ ) { @@ -4698,8 +4700,10 @@ ivas_error ivas_jbm_dec_render( #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; +#ifndef MSAN_FIX uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; @@ -5660,7 +5664,7 @@ ivas_error ivas_jbm_dec_render( #ifdef IVAS_FLOAT_FIXED #if 1//ftf changes int16_t channel_active_fx[MAX_OUTPUT_CHANNELS]; - uint16_t nchan_out_init; + //uint16_t nchan_out_init; Word16 nchan_out_cov; Word16 nchan_out_cldfb = 0; @@ -5668,7 +5672,7 @@ ivas_error ivas_jbm_dec_render( Word16 nchan_transport_tmp = st_ivas->nchan_transport; output_Fs = st_ivas->hDecoderConfig->output_Fs; Word16 nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - nchan_out_init = nchan_out_transport; + //nchan_out_init = nchan_out_transport; if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { @@ -8666,7 +8670,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( * * *--------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, @@ -8699,6 +8703,7 @@ static void ivas_jbm_dec_tc_buffer_playout( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout_fx( @@ -9191,7 +9196,7 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( { Word32 *cldfb_real_buffer_fx; Word32 *cldfb_imag_buffer_fx; - Word16 cldfb_real_e, cldfb_imag_e; + //Word16 cldfb_real_e, cldfb_imag_e; Word16 cldfb_ch, slot_idx, num_freq_bands; cldfb_real_buffer_fx = NULL; @@ -9202,9 +9207,9 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) ISM_FORMAT ) ) { cldfb_real_buffer_fx = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx; - cldfb_real_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp; + //cldfb_real_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp; cldfb_imag_buffer_fx = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx; - cldfb_imag_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_exp; + //cldfb_imag_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_exp; num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; ivas_ism_param_dec_tc_gain_ajust_fx( st_ivas, output_frame, output_frame / 2, tc_fx, &Q_tc ); @@ -9214,9 +9219,9 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( ELSE IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) MC_FORMAT ) ) { cldfb_real_buffer_fx = st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx; - cldfb_real_e = st_ivas->hParamMC->Cldfb_RealBuffer_tc_e; + //cldfb_real_e = st_ivas->hParamMC->Cldfb_RealBuffer_tc_e; cldfb_imag_buffer_fx = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx; - cldfb_imag_e = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_e; + //cldfb_imag_e = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_e; num_freq_bands = st_ivas->hParamMC->num_freq_bands; } /* CLDFB Analysis*/ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 006a9240a..06b7ed543 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -108,7 +108,7 @@ static Word16 ivas_decode_masaism_metadata_fx( IVAS_QMETADATA_HANDLE hQMetaData, static void decode_index_slice_fx( Word16 index, Word16 *ratio_idx_ism, const Word16 nchan_ism, const Word16 K ); -static void decode_ism_ratios_fx( UWord16 *bit_stream, Word16 *next_bit_pos, const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 nbands, const Word16 nblocks, const Word16 idx_separated_object ); +static void decode_ism_ratios_fx( UWord16 *bit_stream, Word16 *next_bit_pos, Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 nbands, const Word16 nblocks, const Word16 idx_separated_object ); static void read_ism_ratio_index_fx( Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 numCodingBands, const Word16 sf, Word16 ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], UWord16 *bit_stream, Word16 *next_bit_pos, const Word32 *masa_to_total_energy_ratio_fx, const Word16 idx_sep_obj, Word16 *num_zeros ); #endif @@ -2343,7 +2343,7 @@ static ivas_error init_lfe_synth_data_fx( /* Interpolation between slots */ hMasa->hMasaLfeSynth->lfeGainPrev_fx = 0; move16(); - hMasa->hMasaLfeSynth->transportGainPrev_fx = ONE_IN_Q15; + hMasa->hMasaLfeSynth->transportGainPrev_fx = MAX_WORD16; move16(); tmp = BASOP_Util_Divide3232_Scale( output_Fs, FRAMES_PER_SEC * CLDFB_NO_COL_MAX, &tmp_e ); @@ -5117,7 +5117,7 @@ static void decode_ism_ratios( static void decode_ism_ratios_fx( UWord16 *bit_stream, /* i : bitstream */ Word16 *next_bit_pos, /* i/o: position in bitstream */ - const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : masa_to_total energy ratios */ + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : masa_to_total energy ratios */ Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM ratios */ const Word16 n_ism, /* i : number of objects */ const Word16 nbands, /* i : number of subbands */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 1a68db7ee..64f125f30 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -79,10 +79,14 @@ typedef struct parameter_band_mapping_struct * Local function prototypes *-----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); +#endif static void ivas_param_mc_dec_init_fx( PARAM_MC_DEC_HANDLE hParamMC, const Word16 nchan_in, const Word16 nchan_out ); +#ifndef IVAS_FLOAT_FIXED static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_copy_diffuse_proto(PARAM_MC_DEC_HANDLE hParamMC, Word32 Cldfb_buffer_real_fx[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_buffer_imag_fx[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nY, const Word16 slot_idx); #else @@ -90,11 +94,17 @@ static void ivas_param_mc_dec_copy_diffuse_proto( PARAM_MC_DEC_HANDLE hParamMC, #endif static Word16 ivas_param_mc_range_decoder_LC( UWord16 *bit_buffer, Word16 *x, Word16 *BER_detect, const Word16 sz_seq, const Word16 sz_alphabet, const UWord16 *cft, const UWord16 *sft, const Word16 tot_shift, const Word16 nbbits ); +#ifndef IVAS_FLOAT_FIXED static int16_t ivas_param_mc_uniform_decoder( float *seq, const int16_t sz_seq, const float *alphabet, const int16_t N, uint16_t bit_buffer[PARAM_MC_MAX_BITS] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild_q, float *icc_q, const int16_t param_band_index, const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nY, const int16_t nX, float *Cx_state, float *Cproto, float *Cy_state ); +#endif +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); +#endif static void ivas_param_mc_get_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ @@ -113,18 +123,24 @@ static void ivas_param_mc_get_mixing_matrices_fx( #ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); #endif +#ifndef IVAS_FLOAT_FIXED static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); +#endif #ifdef IVAS_FLOAT_FIXED static Word16 ivas_param_mc_uniform_decoder_fx(Word16 *seq, const Word16 sz_seq, const Word16 *alphabet, const Word16 N, UWord16 bit_buffer[PARAM_MC_MAX_BITS]); static void ivas_param_mc_dec_compute_interpolator_fx( const UWord16 bAttackPresent, const UWord16 attackPos, const UWord16 interp_length, Word16 *interpolator ); #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, const uint16_t attackPos, const uint16_t interp_length, float *interpolator ); +#endif static void param_mc_set_num_synth_bands( const int32_t output_Fs, PARAM_MC_DEC_HANDLE hParamMC ); +#ifndef IVAS_FLOAT_FIXED static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, const uint16_t nchan_transport, const uint16_t nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info ); +#endif static void ivas_param_mc_get_param_band_mapping( const int16_t n_target_bands, const int16_t *target_band_grouping, const int16_t n_source_bands, const int16_t *source_band_grouping, PARAM_MC_PARAMETER_BAND_MAPPING *parameter_band_mapping ); @@ -3095,7 +3111,7 @@ void ivas_param_mc_dec_digest_tc_fx( Word32 cx_imag_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 cx_imag_e, tmp_e; - Word16 cldfb_slots, qout = 0; + Word16 qout = 0; Word32 real_part_fx, imag_part_fx, L_tmp1, L_tmp2; @@ -3168,13 +3184,13 @@ void ivas_param_mc_dec_digest_tc_fx( move16(); cx_imag_e = 0; move16(); - cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; + //cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; move16(); - IF (st_ivas->hDecoderConfig->Opt_tsm) - { - cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; - move16(); - } + //IF (st_ivas->hDecoderConfig->Opt_tsm) + //{ + // cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; + // move16(); + //} /* slot loop for gathering the input data */ FOR ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) @@ -3574,8 +3590,10 @@ void ivas_param_mc_dec_render_fx( /* format converter */ Word16 channel_active[MAX_OUTPUT_CHANNELS]; - UWord16 nband_synth, nbands_to_zero; - UWord16 nchan_out_init; + UWord16 nband_synth; +#ifndef MSAN_FIX + UWord16 nchan_out_init, nbands_to_zero; +#endif UWord32 output_Fs; hParamMC = st_ivas->hParamMC; @@ -3586,16 +3604,20 @@ void ivas_param_mc_dec_render_fx( set_s( channel_active, 0, MAX_CICP_CHANNELS ); nchan_transport = st_ivas->nchan_transport; nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; +#ifndef MSAN_FIX nchan_out_init = nchan_out_transport; +#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV )|| EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) { nchan_out_cldfb = BINAURAL_CHANNELS; set_s( channel_active, 1, nchan_out_cldfb ); +#ifndef MSAN_FIX IF ( st_ivas->hCombinedOrientationData ) { nchan_out_init = MAX_INTERN_CHANNELS; } +#endif nchan_out_cov = add(st_ivas->hTransSetup.nchan_out_woLFE , st_ivas->hTransSetup.num_lfe); } ELSE IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_CLDFB )) @@ -3618,7 +3640,9 @@ void ivas_param_mc_dec_render_fx( /* set everything to zero that will not be decoded */ nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; +#ifndef IVAS_FLOAT_FIXED nbands_to_zero = sub(hParamMC->num_freq_bands , nband_synth); +#endif #ifdef MSAN_FIX FOR ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) #else @@ -3933,8 +3957,10 @@ void ivas_param_mc_dec_render( #endif float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#ifndef IVAS_FLOAT_FIXED float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#endif for ( i = 0; i < MAX_INTERN_CHANNELS; i++) { for (int j = 0; j < PARAM_MC_MAX_NSLOTS_IN_SUBFRAME; j++) { for (int k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) { @@ -4261,7 +4287,7 @@ void ivas_param_mc_dec_render( } } - for (i = 0; i < BINAURAL_CHANNELS; i++) + /* for (i = 0; i < BINAURAL_CHANNELS; i++) { for (j = 0; j < hParamMC->subframe_nbslots[subframe_idx]; j++) { @@ -4271,7 +4297,7 @@ void ivas_param_mc_dec_render( Cldfb_ImagBuffer_Binaural[i][j][k] = fix_to_float(Cldfb_ImagBuffer_Binaural_fx[i][j][k], Q6); } } - } + }*/ #else ivas_binRenderer(st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, @@ -4627,6 +4653,7 @@ static void ivas_param_mc_dec_init( * Compute prototypes for decorrelation *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void param_mc_protoSignalComputation( float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ @@ -4666,6 +4693,7 @@ static void param_mc_protoSignalComputation( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void param_mc_protoSignalComputation_fx( @@ -4849,6 +4877,7 @@ static Word16 ivas_param_mc_uniform_decoder_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static int16_t ivas_param_mc_uniform_decoder( float *seq, /* o : decoded sequence of float values */ const int16_t sz_seq, /* i : number of values to decode */ @@ -4874,6 +4903,7 @@ static int16_t ivas_param_mc_uniform_decoder( return n_bits; } +#endif /*------------------------------------------------------------------------- @@ -4986,6 +5016,7 @@ static void ivas_param_mc_dec_compute_interpolator_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, /* i : flag indicating if we have a transient in the current frame */ const uint16_t attackPos, /* i : position of the transient */ @@ -5013,6 +5044,7 @@ static void ivas_param_mc_dec_compute_interpolator( return; } +#endif /*------------------------------------------------------------------------- @@ -5021,6 +5053,7 @@ static void ivas_param_mc_dec_compute_interpolator( * remove all LFE related values from a covariance matrix *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void remove_lfe_from_cy( const int16_t nY, /* i : dimension of the covariance matrix */ int16_t lfe_indices[PARAM_MC_LOCAL_SZ_LFE_MAP], /* i : LFE index */ @@ -5055,6 +5088,7 @@ static void remove_lfe_from_cy( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void remove_lfe_from_cy_fx( @@ -5504,7 +5538,6 @@ static void ivas_param_mc_get_mixing_matrices_fx( Word32 mixing_matrix_local_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 Cy_diag_e = 0, mixing_matrix_local_e = 0; Word32 Cproto_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word16 Cproto_buff_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; Word16 Cproto_e; Word32 *proto_matrix_ptr_fx; Word32 *Cx_state_fx; @@ -5630,13 +5663,10 @@ static void ivas_param_mc_get_mixing_matrices_fx( FOR (ch_idx1 = 0; ch_idx1 < nY_intern; ch_idx1++) { - Cproto_buff_e[ch_idx1 + ch_idx1 * nY_intern] = Cproto_e; IF (BASOP_Util_Cmp_Mant32Exp( Cproto_fx[ch_idx1 + ch_idx1 * nY_intern], Cproto_e, 0, 0 ) < 0 ) { Cproto_fx[ch_idx1 + ch_idx1 * nY_intern] = 0; move32(); - Cproto_buff_e[ch_idx1 + ch_idx1 * nY_intern] = 0; - move16(); } } @@ -6656,36 +6686,36 @@ static void param_mc_set_num_synth_bands( ) { UWord16 max_param_band_synth; - const UWord16 *param_mc_bands_coded; + const Word16 *param_mc_bands_coded; SWITCH( hParamMC->hMetadataPMC->num_parameter_bands ) { case 20: - param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_20; + param_mc_bands_coded = param_mc_bands_coded_20; BREAK; case 10: - param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_10; + param_mc_bands_coded = param_mc_bands_coded_10; BREAK; case 14: default: - param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_14; + param_mc_bands_coded = param_mc_bands_coded_14; BREAK; } move16(); SWITCH( output_Fs ) { case 8000: - max_param_band_synth = param_mc_bands_coded[NB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[NB]; BREAK; case 16000: - max_param_band_synth = param_mc_bands_coded[WB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[WB]; BREAK; case 32000: - max_param_band_synth = param_mc_bands_coded[SWB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[SWB]; BREAK; case 48000: default: - max_param_band_synth = param_mc_bands_coded[FB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[FB]; BREAK; } move16(); @@ -6914,6 +6944,8 @@ static ivas_error param_mc_get_diff_proto_info_fx( } #endif #undef FLT_ENABLE + +#ifndef IVAS_FLOAT_FIXED static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, /* i : protoype matrix for the synthesis */ const uint16_t nchan_transport, /* i : number of transport channels */ @@ -7061,7 +7093,7 @@ static ivas_error param_mc_get_diff_proto_info( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------------* * ivas_param_mc_bs_decode_parameter_values() diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index b16252440..a4bf16d6c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1358,10 +1358,10 @@ ivas_error ivas_mc_dec_config( { #ifdef IVAS_FLOAT_FIXED #if 1 /*TODO: To be removed(Float to fixed conversion)*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; - RENDERER_TYPE renderer_type_old; - renderer_type_old = st_ivas->renderer_type; + //DECODER_TC_BUFFER_HANDLE hTcBuffer; + //hTcBuffer = st_ivas->hTcBuffer; + //RENDERER_TYPE renderer_type_old; + //renderer_type_old = st_ivas->renderer_type; IF( st_ivas->hCombinedOrientationData ) FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) { @@ -1370,14 +1370,14 @@ ivas_error ivas_mc_dec_config( st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); } } - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; + //SPAR_DEC_HANDLE hSpar; + //hSpar = st_ivas->hSpar; Word16 nchan_transport_old = st_ivas->nchan_transport; - uint16_t nchan_internal; + //uint16_t nchan_internal; Word32 ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; + //nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + //DECODER_CONFIG_HANDLE hDecoderConfig; + //hDecoderConfig = st_ivas->hDecoderConfig; Word16 n_tc; n_tc = st_ivas->hTcBuffer->nchan_transport_internal; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 8635457e6..b3980c49c 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -348,7 +348,7 @@ ivas_error ivas_omasa_dec_config_fx( DECODER_CONFIG_HANDLE hDecoderConfig = NULL; Word16 numch_out_dirac = 0; SPAR_DEC_HANDLE hSpar = NULL; - Word16 numch_in, numch_out, num_md_sub_frames; + Word16 numch_in; IF(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC)) { IF(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) && NE_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC)) @@ -372,15 +372,15 @@ ivas_error ivas_omasa_dec_config_fx( } } hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata(st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); + //uint16_t nchan_internal; + //nchan_internal = ivas_sba_get_nchan_metadata(st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); hDecoderConfig = st_ivas->hDecoderConfig; numch_out_dirac = hDecoderConfig->nchan_out; IF(hSpar) { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + //numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes(st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate); + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes(st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate); for (Word16 in_ch = 0; in_ch < numch_in; in_ch++) { diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index f2960375f..dea30f1e8 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -103,6 +103,7 @@ static void ivas_lssetupconversion_computeEQFactor_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_lssetupconversion_computeEQFactor( float *outputEnergy, float *inputEnergy, @@ -117,6 +118,7 @@ static void ivas_lssetupconversion_computeEQFactor( return; } +#endif #ifdef IVAS_FLOAT_FIXED @@ -192,6 +194,7 @@ static void ivas_lssetupconversion_mdct_init_bands_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_lssetupconversion_mdct_init_bands( const int16_t output_frame, /* i : output frame length */ const int16_t tcx_mode, /* i : tcx mode (TCX10, TCX 20) */ @@ -255,6 +258,7 @@ static void ivas_lssetupconversion_mdct_init_bands( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void get_custom_ls_conversion_matrix_fx( diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index fc870092a..8ebb0f619 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -7309,7 +7309,7 @@ static Word16 read_coherence_data_fx( /* read average index */ read_huf( &bit_pos, bitstream, &av_index, bit_pos, MASA_NO_CV_COH1, huff_code_av_masa, 10 ); /* 10 is MAX_LEN*/ - nbits = ( nbits, sub( bits_GR, bit_pos ) ); + nbits = add( nbits, sub( bits_GR, bit_pos ) ); /* write indexes in metadata structure */ FOR( j = 0; j < coding_subbands; j++ ) @@ -8101,11 +8101,11 @@ static Word16 read_surround_coherence_hr_fx( Word16 j, k, sf; UWord16 byteBuffer; UWord16 idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS]; - IVAS_QDIRECTION *q_direction; + //IVAS_QDIRECTION *q_direction; Word16 min_index; Word16 d, idx; coding_subbands = hQMetaData->q_direction[0].cfg.nbands; - q_direction = hQMetaData->q_direction; + //q_direction = hQMetaData->q_direction; bits_sur_coherence = 0; bit_pos = *p_bit_pos; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index af261f85e..7b1a6c442 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1042,14 +1042,14 @@ ivas_error ivas_sba_dec_reconfigure_fx( } SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + //uint16_t nchan_internal; + //nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in = 0, numch_out; + Word16 numch_in = 0; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + //numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); hSpar->hMdDec->Q_mixer_mat = 30; @@ -1315,12 +1315,12 @@ ivas_error ivas_sba_dec_reconfigure_fx( if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { /*float2fix block: to be removed*/ - if (st_ivas->hIntSetup.ls_azimuth && st_ivas->hIntSetup.ls_azimuth_fx) { + /* if (st_ivas->hIntSetup.ls_azimuth && st_ivas->hIntSetup.ls_azimuth_fx) { floatToFixed_arrL((float *)st_ivas->hIntSetup.ls_azimuth, (Word32 *)st_ivas->hIntSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.nchan_out_woLFE); } if (st_ivas->hIntSetup.ls_elevation && st_ivas->hIntSetup.ls_elevation_fx) { floatToFixed_arrL((float *)st_ivas->hIntSetup.ls_elevation, (Word32 *)st_ivas->hIntSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.nchan_out_woLFE); - } + }*/ /*float2fix block end*/ /* open fastconv binaural renderer */ if ( ( error = ivas_binRenderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 07119019b..52db40217 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -986,11 +986,11 @@ void ivas_sba_mix_matrix_determiner( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; #ifdef IVAS_FLOAT_FIXED #if 1 /*Float to fixed changes */ - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_spar_dec_gen_umx_mat_fx( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, num_md_sub_frames); #else diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 1e250a383..494a6a035 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -988,6 +988,7 @@ static Word32 matrix_det_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static float matrix_det( const float a00, const float a01, @@ -996,6 +997,7 @@ static float matrix_det( { return a00 * a11 - a01 * a10; } +#endif #ifdef IVAS_FLOAT_FIXED static void matrix_inverse_fx( @@ -1077,6 +1079,7 @@ static void matrix_inverse_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void matrix_inverse( float in[3][3], float out[3][3], @@ -1122,6 +1125,7 @@ static void matrix_inverse( return; } +#endif /*---------------------------------------------------------------------* @@ -1195,11 +1199,11 @@ void ivas_spar_get_cldfb_gains_fx( /* optimization*/ /* compute time-domain cross-fade for considered time slots*/ tmp_idx = sub( cf_start, imult1616( cf_cldfb_start, stride ) ); - Word32 pFilterbank_cross_fade_fx[192];// Temporarily added to stored fixed value of hSpar->hFbMixer->pFilterbank_cross_fade_fx - floatToFixed_arrL( (float *)hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, Q31, cf_len ); + //Word32 pFilterbank_cross_fade_fx[192];// Temporarily added to stored fixed value of hSpar->hFbMixer->pFilterbank_cross_fade_fx + //floatToFixed_arrL( (float *)hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, Q31, cf_len ); FOR( sample = 0; sample < cf_len; sample++ ) { - tgt_fx[tmp_idx++] = pFilterbank_cross_fade_fx[sample]; + tgt_fx[tmp_idx++] = L_deposit_h(hSpar->hFbMixer->pFilterbank_cross_fade_fx[sample]); /* increasing window function */ } FOR( ; tmp_idx < num_samples; tmp_idx++ ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 858b542ce..5af8a70b8 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -83,7 +83,9 @@ static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_ static void ivas_mat_col_rearrange_fx( Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, Word32 ***mixer_mat, const int16_t bands, const int16_t num_ch ); #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands, const int16_t bfi, const int16_t num_md_sub_frames ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_spar_dec_compute_ramp_down_post_matrix_fx(ivas_spar_md_dec_state_t *hMdDec, const Word16 num_bands, const Word16 bfi, const Word16 num_md_sub_frames); @@ -92,7 +94,9 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix_fx(ivas_spar_md_dec_stat #ifdef IVAS_FLOAT_FIXED static void ivas_spar_md_fill_invalid_bands_fx(ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const Word16 *valid_bands, Word16 *base_band_age, const Word16 num_bands, const Word16 num_channels, const Word16 num_md_sub_frames); #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_spar_md_fill_invalid_bands( ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, const int16_t num_bands, const int16_t numch_out, const int16_t num_md_sub_frames ); +#endif static void ivas_spar_md_fill_invalid_bandcoeffs( ivas_band_coeffs_t *pBand_coeffs, ivas_band_coeffs_t *pBand_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, int16_t *first_valid_frame, const int16_t num_bands ); #ifdef IVAS_FLOAT_FIXED @@ -103,7 +107,9 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); +#ifndef IVAS_FLOAT_FIXED static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error ivas_deindex_real_index_fx( const int16_t *index, const int16_t q_levels, const Word32 min_value, const Word32 max_value, Word32 *quant, const int16_t num_ch_dim2 ); #endif @@ -962,7 +968,9 @@ ivas_error ivas_spar_md_dec_init( { int16_t i, j; int16_t nchan_transport; +#ifndef IVAS_FLOAT_FIXED Word32 pFC[IVAS_MAX_NUM_BANDS]; +#endif Word32 *pFC_fx=NULL, PR_minmax_fx[2]; ivas_error error; @@ -977,12 +985,13 @@ ivas_error ivas_spar_md_dec_init( nchan_transport = hMdDec->spar_md_cfg.nchan_transport; - +#ifndef IVAS_FLOAT_FIXED /* get FB coefficients */ FOR (i = 0; i < IVAS_MAX_NUM_BANDS; i++) { pFC[i] = L_shr(Mpy_32_32(ivas_fb_fcs_12band_1ms_fx[i], hDecoderConfig->output_Fs), 1); //Q0 } +#endif IF (EQ_32 (hDecoderConfig->output_Fs, 8000)) { @@ -3669,6 +3678,7 @@ static void ivas_spar_plc_get_band_age( return; } +#ifndef IVAS_FLOAT_FIXED static void ivas_spar_get_plc_interp_weights( int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], int16_t last_valid_band_idx, @@ -3698,6 +3708,7 @@ static void ivas_spar_get_plc_interp_weights( } return; } +#endif static void ivas_spar_get_plc_interp_weights_fx( int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], @@ -4890,7 +4901,7 @@ void ivas_spar_to_dirac_fx( Word32 radius_fx; //float en_ratio, res_pow; Word32 en_ratio_fx, res_pow_fx; - Word16 en_ratio_q, res_pow_q; + Word16 en_ratio_q; int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; @@ -5059,7 +5070,7 @@ void ivas_spar_to_dirac_fx( Word32 Pd_temp_res = Mpy_32_32(Pd_fx[0], Pd_fx[0]) + Mpy_32_32(Pd_fx[1], Pd_fx[1]) + Mpy_32_32(Pd_fx[2], Pd_fx[2]);//q = 22+22-31 = 13 //res_pow = w_en_norm + en_ratio + ( Pd[0] * Pd[0] + Pd[1] * Pd[1] + Pd[2] * Pd[2] ); res_pow_fx = L_shr(w_en_norm_fx, (31- q_w_en_norm_fx)-13) + en_ratio_fx + Pd_temp_res; - res_pow_q = 13; + //res_pow_q = 13; res_pow_fx = L_shr(res_pow_fx, 1); //res_pow *= 0.5f; //hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 23e2d0746..7bc77fd2b 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -850,7 +850,7 @@ static void stereo_dft_generate_comfort_noise_fx( IF( EQ_16( st->cng_type, LP_CNG ) ) { - Word16 q_sqrt, q_div, q_inv_sqrt, rshift_shb = 0, rshift_cng; + Word16 q_sqrt, q_div, rshift_shb = 0, rshift_cng; Word32 min_val; move16(); set_val_Word32( cngNoiseLevel_upd, 0, st->L_frame ); @@ -915,7 +915,7 @@ static void stereo_dft_generate_comfort_noise_fx( // The left shift of q_div and 1 (because of multiplication factor 2.0) is handled below. // by adjusting q_inv_sqrt. minimum_abs32_fx( ptr0, st->L_frame, &min_val ); - q_inv_sqrt = sub( sub( Q31, norm_l( L_abs( min_val ) ) ), add( q_div, 1 ) ); + //q_inv_sqrt = sub( sub( Q31, norm_l( L_abs( min_val ) ) ), add( q_div, 1 ) ); FOR( i = 0; i < shr( st->L_frame, 1 ) - 1; i++ ) { //if ((*ptr1 == 0) && (*ptr2 == 0)) @@ -1543,7 +1543,7 @@ void stereo_cng_dec_update( *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void stereo_cng_compute_PScorr_fx( - Word32 output_fx0[], /* i : Output signal Qx = 1/*temp*/ + Word32 output_fx0[], /* i : Output signal Qx = 1 temp*/ Word32 output_fx1[], /* i : Output signal Qx*/ Word16 *output_Q, Word32 *c_PS_LT_fx, @@ -1910,6 +1910,7 @@ static void stereo_cng_compute_LRcorr_fx( * Find the energie ratio between the mono and the side *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void FindEmEs( const float *ch1, /* i : Left channel */ const float *ch2, /* i : right channel */ @@ -1940,6 +1941,7 @@ static void FindEmEs( return; } +#endif static void FindEmEs_fx( const Word32 *ch1_fx, /* i : Left channel */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index c75400362..9895ea173 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -79,9 +79,13 @@ /*------------------------------------------------------------------------- * Local function prototypes *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void stereo_dft_compute_td_stefi_params( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const float samp_ratio ); +#endif +#ifndef IVAS_FLOAT_FIXED static void stereo_dft_adapt_sf_delay( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, float *pPredGain ); +#endif #ifndef IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 03bb0f511..3ffeb8f65 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -2180,7 +2180,7 @@ static void stereo_dft_compute_td_stefi_params_fx( Word32 wsum; Word32 pred_gain_avg, pred_g; Word16 shift_g; - Word16 q_pred_g, q_pred_gain_avg; + Word16 q_pred_gain_avg; Word32 nrg_DMX, nrg_pred_DMX; Word32 op1; Word16 q_div, q_sqrt; @@ -2256,12 +2256,12 @@ static void stereo_dft_compute_td_stefi_params_fx( IF (GT_16(sub(15, q_div), 15)) { pred_g = L_shl(pred_g, q_div); - q_pred_g = 15; - } - ELSE - { - q_pred_g = sub(15, q_div); + //q_pred_g = 15; } + //ELSE + //{ + // q_pred_g = sub(15, q_div); + //} pred_gain_avg = BASOP_Util_Divide3232_Scale(pred_gain_avg, wsum, &q_div); IF (GT_16(sub(15, q_div), 15)) { @@ -2380,7 +2380,7 @@ void stereo_dft_generate_res_pred_fx( /* variables for enhanced stereo filling */ Word16 norm_fac, q_norm_fac = 0, lim_norm_fac; Word16 q_sqrt; - Word16 alpha, gain_limit; + Word16 alpha; //gain_limit; /* variables for stereo filling */ Word16 d_long, d_short, d_long_ind, d_short_ind; @@ -2395,7 +2395,7 @@ void stereo_dft_generate_res_pred_fx( /* smoothing and limiting parameters */ alpha = hStereoDft->wasTransient ? 0 : (Word16)(0x199A); /* no smoothing after transients */ - gain_limit = 0x7FFF; // 2.0 in Q14 + //gain_limit = 0x7FFF; // 2.0 in Q14 move16(); /* residual prediction only used up to 16 kHz (SWB) */ @@ -2769,7 +2769,7 @@ void stereo_dft_generate_res_pred_fx( FOR ( b = band0; b < nbands_respred; b++ ) { /* TCX/HQ core -> TCX/HQ core: business as usual */ - d_short_ind = STEREO_DFT_PAST_MAX - STEREO_DFT_STEFFI_DELAY_SHORT + b & 1; + d_short_ind = add(sub(STEREO_DFT_PAST_MAX, STEREO_DFT_STEFFI_DELAY_SHORT), b & 1); move16(); d_long_ind = max( 4, (int16_t) ( ( STEREO_DFT_PAST_MAX + 4 - 1 ) * ( (float) b / ( hStereoDft->nbands - 1 ) ) + 0.5f ) ) - 4; move16(); diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 37d3841e0..318f8e1eb 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -516,7 +516,7 @@ void stereo_dft_res_subst_spec_fx( ) { Word16 i, idx; - Word16 fac; + //Word16 fac; Word32 s1, s2, abs1, abs2, abs3, abs4; Word32 abs_res[( STEREO_DFT_RES_BW_MAX ) / 2]; Word32 Xmax, Xmin; @@ -588,7 +588,7 @@ void stereo_dft_res_subst_spec_fx( abs3 = L_abs( p_mem[2 * i] ); abs4 = L_abs( p_mem[2 * i + 1] ); - fac = MAX_16; + //fac = MAX_16; move16(); /* Low-complex phase matching that brings the angle within pi/4 of the target angle */ test(); diff --git a/lib_dec/ivas_stereo_eclvq_dec.c b/lib_dec/ivas_stereo_eclvq_dec.c index 0e3cdc467..4094ced1a 100644 --- a/lib_dec/ivas_stereo_eclvq_dec.c +++ b/lib_dec/ivas_stereo_eclvq_dec.c @@ -39,6 +39,7 @@ #include #include "prot.h" #include "wmc_auto.h" +#include "ivas_prot_fx.h" /*--------------------------------------------------------------- diff --git a/lib_dec/ivas_stereo_esf_dec.c b/lib_dec/ivas_stereo_esf_dec.c index efec50708..6233f9e25 100644 --- a/lib_dec/ivas_stereo_esf_dec.c +++ b/lib_dec/ivas_stereo_esf_dec.c @@ -205,7 +205,7 @@ void filter_with_allpass_fx( IF( NE_16( q_shift, ap->q_buffer_fx ) ) { - FOR( k = 0; k < sizeof( ap->buffer_fx[0] ) / sizeof( ap->buffer_fx[0][0] ); k++ ) + FOR( k = 0; k < (Word16) ( sizeof( ap->buffer_fx[0] ) / sizeof( ap->buffer_fx[0][0] ) ); k++ ) { D1_fx[k] = L_shr( D1_fx[k], sub( ap->q_buffer_fx, q_shift ) ); move32(); diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 2a25d8a3b..dbe9f4f95 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -50,10 +50,13 @@ * Local function prototypes *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, float *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void run_min_stats( Decoder_State **sts, float *x[CPE_CHANNELS][NB_DIV] ); - +#endif /*-------------------------------------------------------------------* * convert_coeffs_to_higher_res() @@ -148,6 +151,7 @@ void convert_coeffs_to_higher_res( * decode core and MDCT stereo information *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void stereo_mdct_dec_stereo( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t ms_mask[2][MAX_SFB] /* o : bandwise MS mask */ @@ -172,6 +176,7 @@ static void stereo_mdct_dec_stereo( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 09b528233..e730824c5 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -50,7 +50,9 @@ *-------------------------------------------------------------------------*/ static void apply_dmx_weights_fx( CPE_DEC_HANDLE hCPE, Word32 *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); +#ifndef IVAS_FLOAT_FIXED static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, float *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); +#endif static void run_min_stats_fx( Decoder_State **sts, Word32 *x[CPE_CHANNELS][NB_DIV], Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]); @@ -477,6 +479,7 @@ void stereo_mdct_core_dec_fx( return; } +#ifndef IVAS_FLOAT_FIXED static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[CPE_CHANNELS][NB_DIV], /* i/o: MDCT Spectrum */ @@ -669,6 +672,7 @@ static void apply_dmx_weights( return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 029e2bcff..6ba9a2653 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -2866,6 +2866,7 @@ void synchro_synthesis_fx( * Handling of memories in case of CPE modes switching *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static Word16 saturate( Word32 L_var1 ) { Word16 var_out; @@ -2892,6 +2893,7 @@ static Word16 saturate( Word32 L_var1 ) return ( var_out ); } +#endif Word32 side_gain_table[32 + 1] = { -ONE_IN_Q31, -2040109440, -1932735232, -1825361152, -1717986944, -1610612736, -1503238528, -1395864320, -1288490240, -1181115904, -1073741824, diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index ceec414f0..5a10a04c3 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -583,6 +583,7 @@ void tdm_upmix_plain_fx( * downmix Left+Right to Primary+Secondary channel with fade in/out *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tdm_upmix_fade( float Left[], /* o : left channel */ float Right[], /* o : right channel */ @@ -652,6 +653,7 @@ static void tdm_upmix_fade( return; } +#endif Word32 inv_time[960 + 1] = { diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 63eb0eba2..a7eccb6c7 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -52,7 +52,9 @@ #ifndef IVAS_FLOAT_FIXED static void dec_prm_tcx( Decoder_State *st, int16_t param[], int16_t param_lpc[], int16_t *total_nbbits, const int16_t last_element_mode, int16_t *bitsRead ); #endif // !IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void stereo_tcx_dec_mode_switch_reconf( Decoder_State *st, const int16_t MCT_flag, const int16_t last_element_mode ); +#endif #ifdef IVAS_FLOAT_FIXED diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 21d4ec3fa..744bfea7b 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -82,7 +82,7 @@ struct apa_state_t /* Hann window */ float win[APA_BUF_PER_CHANNEL]; - Word16 *win_fx; + const Word16 *win_fx; //const Word16 *win_fx; UWord16 l_halfwin; @@ -141,11 +141,15 @@ struct apa_state_t * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float apa_corrEnergy2dB( float energy, uint16_t corr_len ); +#endif Word16 apa_corrEnergy2dB_fx(Word32 energy, Word16 energyExp, Word16 corr_len); Word16 apa_getQualityIncreaseForLowEnergy_fx(Word16 energydB); +#ifndef IVAS_FLOAT_FIXED static float apa_getQualityIncreaseForLowEnergy( float energydB ); +#endif static Word8 logarithmic_search_fx( const apa_state_t *ps, const Word16 *signal, @@ -157,9 +161,14 @@ static Word8 logarithmic_search_fx( const apa_state_t *ps, Word16 wss, Word16 css, Word16 *synchpos ); + +#ifndef IVAS_FLOAT_FIXED static bool logarithmic_search( const apa_state_t *ps, const float *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); +#endif +#ifndef IVAS_FLOAT_FIXED static bool find_synch( apa_state_t *ps, const float *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); +#endif static bool copy_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); @@ -179,18 +188,6 @@ static Word16 find_synch_fx( apa_state_t *ps, Word32 *qualityQ16, Word16 *synch_pos ); -static Word16 norm(float num); - - -static Word16 norm(float num) { - if( ( Word16 ) num == 0 ) { - return 15; - } - else - return norm_s(( Word16 ) num); -} - - /*---------------------------------------------------------------------* * Public functions *---------------------------------------------------------------------*/ @@ -528,7 +525,7 @@ bool apa_set_rate( ps->l_search = ( ps->rate / 80 ) * ps->num_channels; #ifdef IVAS_FLOAT_FIXED - ps->win_fx = (Word16 *)pcmdsp_window_hann_640; + ps->win_fx = pcmdsp_window_hann_640; move16(); ps->l_halfwin = 320; move16(); @@ -536,14 +533,14 @@ bool apa_set_rate( move16(); IF( EQ_32( ps->rate, 48000 ) ) { - ps->win_fx = (Word16 *)pcmdsp_window_hann_960; + ps->win_fx = pcmdsp_window_hann_960; move16(); ps->l_halfwin = 480; move16(); } IF( EQ_32( ps->rate, 24000 ) ) { - ps->win_fx = (Word16 *)pcmdsp_window_hann_960; + ps->win_fx = pcmdsp_window_hann_960; move16(); ps->l_halfwin = 480; move16(); @@ -1155,6 +1152,7 @@ uint8_t apa_exec( * ******************************************************************************** */ +#ifndef IVAS_FLOAT_FIXED static void get_scaling_quality( const apa_state_t *ps, const float *signal, @@ -1248,6 +1246,7 @@ static void get_scaling_quality( return; } +#endif static void get_scaling_quality_fx(const apa_state_t * ps, @@ -1371,6 +1370,7 @@ Word16 apa_corrEnergy2dB_fx(Word32 energy, Word16 energyExp, Word16 corr_len) } /* Converts the correlation energy to dB. */ +#ifndef IVAS_FLOAT_FIXED static float apa_corrEnergy2dB( float energy, uint16_t corr_len ) @@ -1379,9 +1379,11 @@ static float apa_corrEnergy2dB( return energydB; } +#endif /* Increases the calculated quality of signals with low energy. */ +#ifndef IVAS_FLOAT_FIXED static float apa_getQualityIncreaseForLowEnergy( float energydB ) { @@ -1407,6 +1409,7 @@ static float apa_getQualityIncreaseForLowEnergy( return qualIncForLowEnergy; } +#endif Word16 apa_getQualityIncreaseForLowEnergy_fx(Word16 energydBQ8) { @@ -1467,6 +1470,7 @@ Word16 apa_getQualityIncreaseForLowEnergy_fx(Word16 energydBQ8) * ******************************************************************************** */ +#ifndef IVAS_FLOAT_FIXED static bool logarithmic_search( const apa_state_t *ps, const float *signal, @@ -1538,6 +1542,7 @@ static bool logarithmic_search( return 0; } +#endif static Word8 logarithmic_search_fx(const apa_state_t * ps, @@ -1664,6 +1669,7 @@ static Word8 logarithmic_search_fx(const apa_state_t * ps, * ******************************************************************************** */ +#ifndef IVAS_FLOAT_FIXED static bool find_synch( apa_state_t *ps, const float *in, @@ -1695,6 +1701,7 @@ static bool find_synch( return 0; } +#endif static Word16 find_synch_fx( apa_state_t *ps, const Word16 *in, @@ -1818,7 +1825,7 @@ static bool shrink_frm( int16_t xtract, l_rem, s_start, s_end; uint16_t i; uint16_t over; - float energy, quality = 0.0f; + float quality = 0.0f; uint16_t l_frm; uint16_t l_seg; @@ -1851,7 +1858,7 @@ static bool shrink_frm( #endif // !IVAS_FLOAT_FIXED { /* maximum scaling */ - energy = -65; + //energy = -65; quality = 5; if ( ps->evs_compat_mode == false ) { @@ -1890,7 +1897,7 @@ static bool shrink_frm( //ps->signalScaleForCorrelation += 2; scaleSignal16( frm_in_fx, ps->frmInScaled, l_frm, ps->signalScaleForCorrelation ); findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (uint16_t) ( s_end - s_start ), 0, l_seg, 0, &energyQ8, &qualityQ16, &xtract ); - energy = fixedToFloat( energyQ8, 8 ); + //energy = fixedToFloat( energyQ8, 8 ); quality = fixedToFloat( qualityQ16, 16 ); //ps->signalScaleForCorrelation -= 2; #else @@ -2149,7 +2156,7 @@ static bool extend_frm( uint16_t over[MAXN + 2]; int16_t l_rem; int16_t s_start = 0; - float energy, quality = 0.0f; + float quality = 0.0f; uint16_t l_frm, l_seg; const float *fadeOut, *fadeIn; float *out; @@ -2265,7 +2272,7 @@ static bool extend_frm( #endif { /* maximum scaling */ - energy = -65; + //energy = -65; quality = 5; xtract[n] = s_start + ps->num_channels; if ( ps->evs_compat_mode == false ) @@ -2289,7 +2296,7 @@ static bool extend_frm( assert( sizeof( ps->frmInScaled ) / sizeof( ps->frmInScaled[0] ) >= 2 * (size_t) l_frm ); scaleSignal16( frm_in_fx, frmInScaled, shl(l_frm, 1), ps->signalScaleForCorrelation ); findSynchResult = find_synch_fx( ps, frmInScaled, 2 * l_frm, s_start, s_end - s_start, sync_start, l_seg, l_frm, &energyQ8, &qualityQ16, &xtract[n] ); - energy = fixedToFloat( energyQ8, 8 ); + //energy = fixedToFloat( energyQ8, 8 ); quality = fixedToFloat( qualityQ16, 16 ); if(max_flag) { diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 01ab068f9..e3f13d650 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -50,9 +50,13 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void lsf_mid_dec( Decoder_State *st, const float lsp_new[], const int16_t coder_type, float lsp_mid[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void dqlsf_CNG( Decoder_State *st, float *lsf_q ); +#endif /*---------------------------------------------------------------------* diff --git a/lib_dec/post_dec.c b/lib_dec/post_dec.c index 4d9270dfb..14c93a311 100644 --- a/lib_dec/post_dec.c +++ b/lib_dec/post_dec.c @@ -45,7 +45,9 @@ * Function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void bass_pf_1sf_delay( float *syn, const int16_t *T_sf, const float *gainT_sf, const int16_t l_frame, const int16_t l_subfr, float *bpf_noise_buf, int16_t *gain_factor_param, const int16_t disable_bpf, float *mem_deemph_err, float *lp_ener ); +#endif /*---------------------------------------------------------------------* @@ -189,6 +191,7 @@ void post_decoder_flt( * Perform low-frequency postfiltering *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void bass_pf_1sf_delay( float *syn, /* i : synthesis to postfilter */ const int16_t *T_sf, /* i : Pitch period for all subframes (T_sf[4]) */ @@ -340,6 +343,7 @@ static void bass_pf_1sf_delay( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * cldfb_synth_set_bandsToZero_flt() diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c index 84569e12c..7d4427f70 100644 --- a/lib_dec/swb_bwe_dec.c +++ b/lib_dec/swb_bwe_dec.c @@ -515,6 +515,7 @@ Word16 para_pred_bws_fx( * Decoding of WB parameters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t WB_BWE_gain_deq( Decoder_State *st, /* i/o: decoder state structure */ float *WB_fenv ) @@ -530,6 +531,7 @@ static int16_t WB_BWE_gain_deq( return ( mode ); } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/swb_bwe_dec_fx.c b/lib_dec/swb_bwe_dec_fx.c index f79f1b7fe..a4e8bc3f9 100644 --- a/lib_dec/swb_bwe_dec_fx.c +++ b/lib_dec/swb_bwe_dec_fx.c @@ -9,6 +9,7 @@ #include "prot_fx2.h" #include "rom_com.h" #include "rom_enc.h" +#include "ivas_prot_fx.h" #define MAX_Q_NEW_INPUT 8 #define Q_WTDA_FX 13 diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index 320308981..fe580269a 100644 --- a/lib_dec/swb_bwe_dec_lr.c +++ b/lib_dec/swb_bwe_dec_lr.c @@ -50,6 +50,7 @@ * Decoding of generic subband coding parameters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void DecodeSWBGenericParameters( Decoder_State *st, /* i/o: decoder state structure */ int16_t *lagIndices, /* o : lowband index for each subband */ @@ -83,6 +84,7 @@ static void DecodeSWBGenericParameters( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index c9516a549..671e069fe 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -53,11 +53,17 @@ * Local function prototypes *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dequantizeSHBparams( Decoder_State *st, const int16_t extl, int32_t extl_brate, float *Q_lsf, float *Q_subgain, float *Q_framegrain, int16_t *uv_flag, float *Q_shb_ener_sf, float *Q_shb_res_gshape, float *Q_mixFactors, int16_t *MSFlag ); static void Dequant_lower_LSF( const int16_t lsf_idx[], float lsf_q[] ); static void Map_higher_LSF( float lsf_q[], const float m, const float grid_in[] ); static void Dequant_mirror_point( const float lsf_q[], const int16_t m_idx, float *m ); +#endif +void find_max_mem_dec_m3( + Decoder_State *st, + Word16 *n_mem3 +); /*-------------------------------------------------------------------* * ResetSHBbuffer_Dec() @@ -452,7 +458,7 @@ void wb_tbe_dec( return; } #endif -void calc_tilt_bwe_fx_loc( +static void calc_tilt_bwe_fx_loc( const Word32 *sp_fx, /* i : input signal */ Word32 *tilt_fx, /* o : signal tilt */ Word16 *tilt_fx_q, /* o : signal tilt */ @@ -520,7 +526,7 @@ void calc_tilt_bwe_fx_loc( * * SWB TBE decoder, 6 - 14 kHz (or 7.5 - 15.5 kHz) band decoding module *-------------------------------------------------------------------*/ -void rescale_genSHB_mem_dec( +static void rescale_genSHB_mem_dec( Decoder_State *st_fx, Word16 sf ) { @@ -753,7 +759,7 @@ static void gradientGainShape( *GainFrame_fx = Mult_32_16(hBWE_TD->GainFrame_prevfrm_fx, hBWE_TD->GainAttn_fx); /* Q18 */ } -void find_max_mem_dec( +static void find_max_mem_dec( Decoder_State *st_fx, Word16 *n_mem, Word16 *n_mem2 @@ -3733,6 +3739,7 @@ void swb_tbe_dec( * Dequantized the lower LSFs *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Dequant_lower_LSF( const int16_t lsf_idx[], /* i : LSF indices */ float lsf_q[] /* o : Quantized LSFs */ @@ -3748,6 +3755,7 @@ static void Dequant_lower_LSF( return; } +#endif /*-------------------------------------------------------------------* * Map_higher_LSF() @@ -3755,6 +3763,7 @@ static void Dequant_lower_LSF( * Map the higher LSFs from the lower LSFs *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Map_higher_LSF( float lsf_q[], /* i/o: Quantized lower LSFs */ const float m, /* i : Mirroring point */ @@ -3804,6 +3813,7 @@ static void Map_higher_LSF( return; } +#endif /*-------------------------------------------------------------------* * Map_higher_LSF() @@ -3811,6 +3821,7 @@ static void Map_higher_LSF( * Map the higher LSFs from the lower LSFs *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Dequant_mirror_point( const float lsf_q[], /* i/o: Quantized lower LSFs */ const int16_t m_idx, /* i : Mirror point index */ @@ -3821,6 +3832,7 @@ static void Dequant_mirror_point( return; } +#endif /*-------------------------------------------------------------------* * dequantizeSHBparams() @@ -3828,6 +3840,7 @@ static void Dequant_mirror_point( * Dequantize super highband spectral envolope, temporal gains and frame gain *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dequantizeSHBparams( Decoder_State *st, /* i/o: decoder state structure */ const int16_t extl, /* i : extension layer */ @@ -4153,6 +4166,7 @@ static void dequantizeSHBparams( return; } +#endif #ifndef IVAS_FLOAT_FIXED diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 2334893c6..b62bcd3ba 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -32,6 +32,11 @@ static void rescale_genWB_mem( Decoder_State* st_fx, Word16 sf ); static void Dequant_lower_LSF_fx( const Word16 lsf_idx[], Word16 lsf_q[] ); static void Map_higher_LSF_fx( Word16 lsf_q[], const Word16 m, const Word16 grid_in[] ); static void Dequant_mirror_point_fx( const Word16 lsf_q[], const Word16 m_idx, Word16* m ); +Word16 dotp_loc( + const Word16 x[], /* i : vector x[] */ + const Word32 y[], /* i : vector y[] */ + const int16_t n /* i : vector length */ +); /* gain shape concealment code */ static void gradientGainShape(Decoder_State *st_fx, Word16 *GainShape, Word32 *GainFrame); @@ -41,7 +46,7 @@ static void gradientGainShape(Decoder_State *st_fx, Word16 *GainShape, Word32 *G * * Find norm and max in TBE memories and past buffers *-------------------------------------------------------------------*/ -void find_max_mem_dec( +static void find_max_mem_dec( Decoder_State *st_fx, Word16 *n_mem, Word16 *n_mem2 @@ -206,7 +211,7 @@ void find_max_mem_dec( * * Rescale genSHB memories *-------------------------------------------------------------------*/ -void rescale_genSHB_mem_dec( +static void rescale_genSHB_mem_dec( Decoder_State *st_fx, Word16 sf ) { diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index a3b0db6a0..74768cf0e 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -434,6 +434,7 @@ static void CalcPowerSpecAndDetectTonalComponents( } #endif +#ifndef IVAS_FLOAT_FIXED static void CalcMDXT( const TonalMDCTConcealPtr hTonalMDCTConc, const char type, @@ -458,6 +459,7 @@ static void CalcMDXT( return; } +#endif #ifndef IVAS_FLOAT_FIXED void TonalMDCTConceal_Detect_ivas( diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 3fc81c1b1..8ec2abe05 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -729,7 +729,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( Flag Overflow = 0; #endif - Word16 nBands; + //Word16 nBands; Word32 invScaleFactors_fx[FDNS_NPTS]; Word16 old_power_spectrum_q, power_spectrum_q; @@ -837,7 +837,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( sns_shape_spectrum_fx( powerSpectrum, &power_spectrum_q, psychParamsCurrent, invScaleFactors_fx, 16, hTonalMDCTConc->nSamplesCore ); power_spectrum_q++; // sns_shape_spectrum(powerSpectrum, psychParamsCurrent, invScaleFactors, hTonalMDCTConc->nSamplesCore); - nBands = psychParamsCurrent->nBands; + //nBands = psychParamsCurrent->nBands; } IF( old_power_spectrum_q < power_spectrum_q ) Scale_sig32( powerSpectrum, hTonalMDCTConc->nSamplesCore, old_power_spectrum_q - power_spectrum_q ); @@ -1195,7 +1195,7 @@ void TonalMDCTConceal_Detect_ivas_fx( Word32 * powerSpectrum = secondLastMDST; Word16 i, powerSpectrum_exp, secondLastMDST_exp, s; Word16 nSamples; - Word16 nBands; + //Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; nSamples = hTonalMDCTConc->nSamples; @@ -1277,7 +1277,7 @@ void TonalMDCTConceal_Detect_ivas_fx( sns_int_scf_fx[i] = L_shl(hTonalMDCTConc->secondLastBlockData.scaleFactors[i], 1 + hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i]); // Q16 } sns_shape_spectrum_fx(powerSpectrum, &power_spectrum_q, psychParamsCurrent, sns_int_scf_fx, 16, hTonalMDCTConc->nSamplesCore); - nBands = psychParamsCurrent->nBands; + //nBands = psychParamsCurrent->nBands; } powerSpectrum_exp = getScaleFactor32(powerSpectrum, nSamples); powerSpectrum_exp = sub(powerSpectrum_exp, 3); /*extra 3 bits of headroom for MA filter in getEnvelope*/ diff --git a/lib_dec/waveadjust_fec_dec.c b/lib_dec/waveadjust_fec_dec.c index c5b041d22..1a1acb860 100644 --- a/lib_dec/waveadjust_fec_dec.c +++ b/lib_dec/waveadjust_fec_dec.c @@ -46,6 +46,7 @@ * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void LpFilter2( const float *x, float *y, @@ -64,7 +65,9 @@ static void LpFilter2( return; } +#endif +#ifndef IVAS_FLOAT_FIXED static float harmo( const float *X, const int16_t n, @@ -93,8 +96,9 @@ static float harmo( return ener_harmo / ( ener + EPSILON ); } +#endif - +#ifndef IVAS_FLOAT_FIXED static int16_t Is_Periodic( const float cov_max, const int16_t zp, @@ -141,8 +145,10 @@ static int16_t Is_Periodic( return flag; } +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t zero_pass( const float *s, const int16_t N ) @@ -159,8 +165,10 @@ static int16_t zero_pass( return zp; } +#endif +#ifndef IVAS_FLOAT_FIXED static float sig_tilt( const float *s, const int16_t L_frameTCX ) @@ -178,8 +186,10 @@ static float sig_tilt( return tilt; } +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t pitch_search( float *s, /* lastPcmOut */ float *outx_new, @@ -398,8 +408,10 @@ static int16_t pitch_search( return pitch; } +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t OverlapAdd( float *pitch125_data, float *sbuf, @@ -428,8 +440,9 @@ static int16_t OverlapAdd( return ( n + pitch ); } +#endif - +#ifndef IVAS_FLOAT_FIXED static void add_noise( float *sbuf, float *outx_new_n1, @@ -455,6 +468,8 @@ static void add_noise( return; } +#endif + #ifndef IVAS_FLOAT_FIXED static int16_t waveform_adj( T_PLCInfo_HANDLE hPlcInfo, diff --git a/lib_dec/waveadjust_fec_dec_fx.c b/lib_dec/waveadjust_fec_dec_fx.c index ec7abe07b..d88ced1ce 100644 --- a/lib_dec/waveadjust_fec_dec_fx.c +++ b/lib_dec/waveadjust_fec_dec_fx.c @@ -12,12 +12,13 @@ #include "stat_com.h" #include "rom_com.h" #include "stl.h" /* FOR wmc_tool */ +#include "vad_basop.h" void get_maxConv_and_pitch_x(Word16 *s_LP, Word16 s, Word16 e, Word16 N, Word32 *maxConv, Word16 *maxConv_bits, Word16 *pitch); Word16 get_voicing_x(Word16 *s_LP, Word16 pitch, Word32 covMax,Word16 maxConv_bits, Word16 Framesize); Word32 con_Log10(Word32 i_s32Val, Word16 i_s16Q); - +Word16 Spl_GetScalingSquare_x(const Word16 *in_vector, const Word16 in_vector_length, Word16 times); Word16 vadmin(Word16 a, Word16 b) { diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index be8ab41ae..285d62181 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -587,7 +587,7 @@ Word16 ACcontextMapping_encode2_estimate_no_mem_s17_LC_fx( /* check while condition */ /* MSBs coding */ - lookup = (Word8 *)(&ari_lookup_s17_LC[t] + (1 << (NBITS_CONTEXT+NBITS_RATEQ))); /* address calculation not counted */ + lookup = (const Word8 *)(&ari_lookup_s17_LC[t] + (1 << (NBITS_CONTEXT+NBITS_RATEQ))); /* address calculation not counted */ WHILE (GE_16(s_max(a1, b1), A_THRES)) { pki = lookup[lev1]; diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 4ab5dc0a1..f00ef8255 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -23,6 +23,24 @@ static void E_ACELP_codearithp_fx(const Word16 v[], UWord32 *n, UWord32 *ps, Word16 *p); +void E_ACELP_h_vec_corr1(Word16 h[], Word16 vec[], UWord8 track, + Word16 sign[], Word16 (*rrixix)[16], + Word16 cor[], Word16 dn2_pos[], + Word16 nb_pulse); + +void E_ACELP_h_vec_corr2(Word16 h[], Word16 vec[], UWord8 track, + Word16 sign[], Word16 (*rrixix)[16], + Word16 cor[]); + +Word16 E_ACELP_xy1_corr(Word16 xn[], Word16 y1[], ACELP_CbkCorr *g_corr, Word16 norm_flag, Word16 L_subfr, Word16 exp_xn); + +void E_ACELP_codebook_target_update(Word16 *x, Word16 *x2, Word16 *y, + Word16 gain, Word16 L_subfr); + +void E_ACELP_vec_neg(Word16 h[], Word16 h_inv[], Word16 L_subfr); + +void E_ACELP_corrmatrix(Word16 h[], Word16 sign[], Word16 vec[], Word16 rrixix[4][16], Word16 rrixiy[4][256]); + /* * E_ACELP_h_vec_corrx * diff --git a/lib_enc/enc_gain_fx.c b/lib_enc/enc_gain_fx.c index 3cd54b006..fcfe02219 100644 --- a/lib_enc/enc_gain_fx.c +++ b/lib_enc/enc_gain_fx.c @@ -15,6 +15,9 @@ #include "prot_fx2.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ +void E_GAIN_norm_corr(Word16 exc[], Word16 xn[], Word16 h[], + Word16 t_min, Word16 t_max, Word16 corr_norm[], Word16 L_subfr); + /* * E_GAIN_norm_corr * diff --git a/lib_enc/guided_plc_enc_fx.c b/lib_enc/guided_plc_enc_fx.c index a21606c1a..a387d0387 100644 --- a/lib_enc/guided_plc_enc_fx.c +++ b/lib_enc/guided_plc_enc_fx.c @@ -19,7 +19,7 @@ * * *-------------------------------------------------------------------*/ -void coderLookAheadInnovation( +static void coderLookAheadInnovation( Word16 A_3Q12[], /* input: coefficients NxAz[M+1] */ Word16 *pT, /* out: pitch */ PLC_ENC_EVS_HANDLE st, /* i/o: coder memory state */ diff --git a/lib_enc/igf_scf_enc_fx.c b/lib_enc/igf_scf_enc_fx.c index 77b74fd7f..866bae043 100644 --- a/lib_enc/igf_scf_enc_fx.c +++ b/lib_enc/igf_scf_enc_fx.c @@ -108,7 +108,7 @@ static void arith_encode_residual( IGFSCFENC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Word16 *ptr, /* i/o: pointer to expanded bit buffer, one bit in each Word16 */ Word16 x, /* i: residual value to encode */ - const Word16 *cumulativeFrequencyTable, /* i: cumulative frequency table to be used */ + const UWord16 *cumulativeFrequencyTable, /* i: cumulative frequency table to be used */ Word16 tableOffset /* i: offset used to align the table */ ) { @@ -128,7 +128,7 @@ static void arith_encode_residual( hPrivateData->ptrBitIndex, &hPrivateData->acState_fx, x, - (const UWord16*) cumulativeFrequencyTable + cumulativeFrequencyTable ); return; @@ -142,7 +142,7 @@ static void arith_encode_residual( hPrivateData->ptrBitIndex, &hPrivateData->acState_fx, 0, - (const UWord16*) cumulativeFrequencyTable + cumulativeFrequencyTable ); } ELSE /* x > IGF_MAX_ENC_SEPARATE */ @@ -153,7 +153,7 @@ static void arith_encode_residual( hPrivateData->ptrBitIndex, &hPrivateData->acState_fx, IGF_SYMBOLS_IN_TABLE - 1, - (const UWord16*) cumulativeFrequencyTable + cumulativeFrequencyTable ); } @@ -235,7 +235,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)hPrivateData->cf_se01, + hPrivateData->cf_se01, hPrivateData->cf_off_se01); } ELSE @@ -252,7 +252,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)(hPrivateData->cf_se02 + index1), + hPrivateData->cf_se02 + index1, hPrivateData->cf_off_se02[index2]); } } @@ -267,7 +267,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)hPrivateData->cf_se10, + hPrivateData->cf_se10, hPrivateData->cf_off_se10); } ELSE @@ -291,7 +291,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)(hPrivateData->cf_se11 + index1), + hPrivateData->cf_se11 + index1, hPrivateData->cf_off_se11[index2]); } } diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index d5f4fbf66..011d5df52 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -54,7 +54,7 @@ *--------------------------------------------------------------------*/ static void calculate_energy_buffer( CPE_ENC_HANDLE hCPE, float enerBuffer_dft[], const int16_t no_channels, const int32_t input_Fs ); -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FIXED_ENC static void calculate_energy_buffer_fx( CPE_ENC_HANDLE hCPE, Word64 enerBuffer_dft_fx[], Word16 *enerBuffer_dft_q_fx, const Word16 no_channels, const Word32 input_Fs ); #endif @@ -838,7 +838,7 @@ ivas_error pre_proc_front_ivas( } -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FIXED_ENC /*-------------------------------------------------------------------* * calculate_energy_buffer_fx() * diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index fafd5cb69..0fc02c8b1 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -41,6 +41,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" +#include "prot_fx_enc.h" #endif diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 3227e1017..c07e5baad 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -53,11 +53,11 @@ *--------------------------------------------------------------------*/ static ivas_error ivas_spar_enc_process( Encoder_Struct *st_ivas, const ENCODER_CONFIG_HANDLE hEncoderConfig, BSTR_ENC_HANDLE hMetaData, const int16_t front_vad_flag, float *data_f[] ); -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static Word16 Q_factor_L_abs( float x ); #endif -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED Word16 Q_factor_L_abs( float x ) { Word16 Q = 31; diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index c8dd7b90c..3d4cb58f3 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -69,7 +69,7 @@ static Word32 interpolate_corr( /* o : interpolated value */ return s; } -void tcx_ltp_pitch_search( +static void tcx_ltp_pitch_search( Word16 pitch_ol, Word16 *pitch_int, Word16 *pitch_fr, diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index d9187de41..49e059ab2 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -149,7 +149,7 @@ void ComputeSpectrumNoiseMeasure_fx(const Word32 *powerSpec, } -void detectLowpassFac(const Word32 *powerSpec, Word16 powerSpec_e, Word16 L_frame, Word8 rectWin, Word16 *pLpFac, Word16 lowpassLine) +static void detectLowpassFac(const Word32 *powerSpec, Word16 powerSpec_e, Word16 L_frame, Word8 rectWin, Word16 *pLpFac, Word16 lowpassLine) { Word16 i, tmp; Word32 threshold; diff --git a/lib_enc/vad_proc_fx.c b/lib_enc/vad_proc_fx.c index d01df0897..d487e924d 100644 --- a/lib_enc/vad_proc_fx.c +++ b/lib_enc/vad_proc_fx.c @@ -190,7 +190,7 @@ Word16 vad_init_ivas_fx( hVAD_CLDFB->frameloop = 0; hVAD_CLDFB->lt_snr_org_fx = 33554432; /*Q26 */ hVAD_CLDFB->lf_snr_smooth_fx = 167772155/* 5.0 Q25 */; - hVAD_CLDFB->l_silence_snr_fx = 32768/* 0.5 Q16 */; + hVAD_CLDFB->l_silence_snr_fx = 32767/* 0.5 Q16 */; hVAD_CLDFB->l_speech_snr_fx = 327675/* 5.0 Q16 */; hVAD_CLDFB->l_silence_snr_count = 1; hVAD_CLDFB->l_speech_snr_count = 1; @@ -280,7 +280,7 @@ Word16 vad_init_ivas_fx( return 0; } -void UpdateState( +static void UpdateState( VAD_CLDFB_HANDLE_FX hVAD_CLDFB, /* i/o: CLDFB VAD state */ Word16 vad_flag, /* i : VAD flag */ Word32 frame_energy, /* i : current frame energy */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 5d23db160..e2596eacb 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -3785,8 +3785,8 @@ ivas_error ivas_rend_crendProcessSubframe( /* Rotation in SD for MC -> BINAURAL_ROOM */ ELSE IF ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { - Word16 nchan; - nchan = hIntSetup->nchan_out_woLFE + hIntSetup->num_lfe; + //Word16 nchan; + //nchan = hIntSetup->nchan_out_woLFE + hIntSetup->num_lfe; rotateFrame_sd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, hEFAPdata, 0 ); diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index a7f86d310..45f561abc 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -476,7 +476,7 @@ static void ivas_dirac_param_est_ana_fx( Word16 q_factor_intensity, q_factor_intensity_old = 0; Word16 q_factor_energy = 0, q_factor_energy_old = 0; Word16 exp = 0, exp_div = 0; - Word16 exp2; + //Word16 exp2; num_freq_bands = hDirAC->nbands; Word16 tmp_e; Word16 tmp = BASOP_Util_Divide3216_Scale( input_frame, CLDFB_NO_COL_MAX, &tmp_e ); @@ -557,7 +557,7 @@ static void ivas_dirac_param_est_ana_fx( /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); //( 2 * ( scale_fact - Q1 ) - 31 - 1 ); // computeReferencePower_ana( hDirAC->band_grouping, Foa_RealBuffer, Foa_ImagBuffer, reference_power[ts], num_freq_bands ); - exp2 = sub( shl( scale_fact, 1 ), 31 ); + //exp2 = sub( shl( scale_fact, 1 ), 31 ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hDirAC->index_buffer_intensity = add( ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ index = hDirAC->index_buffer_intensity; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 4985fe097..9dc46a56e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -119,7 +119,9 @@ typedef struct parambin_rend_config_data static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX], Word32 decIm[][CLDFB_NO_CHANNELS_MAX] ); @@ -140,12 +142,17 @@ static void adaptTransportSignalsHeadtracked_fx( COMBINED_ORIENTATION_HANDLE hHe static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3] ); #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); +#endif - +#ifndef IVAS_FLOAT_FIXED static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); +#endif static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); @@ -1651,6 +1658,8 @@ static void ivas_dirac_dec_binaural_internal( } #endif + +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, @@ -1704,6 +1713,7 @@ static void ivas_dirac_dec_decorrelate_slot( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot_fx( @@ -3914,6 +3924,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -4015,6 +4026,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( return; } +#endif static void eig2x2( @@ -5139,7 +5151,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( Word32 Enes_fx[2]; Word16 normEnes_fx[2]; Word16 remainderNormEne_fx; - Word16 normEnes_q_fx[2], temp_q = 0, subframeEne_q_fx, ismRatioAcc_q_fx; + Word16 normEnes_q_fx[2], temp_q = 0; Word16 eneMove_q_fx[2], enePreserve_q_fx[2], temp1; Word32 temp; @@ -5171,7 +5183,6 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( } subframeEne_fx = L_add( Enes_fx[0], Enes_fx[1] ); - subframeEne_q_fx = sub( add( *cldfb_buf_q, *cldfb_buf_q ), 31 ); // Q = -19 IF( NE_32( subframeEne_fx, 0 ) ) { @@ -5210,7 +5221,6 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( ratio = extract_l( hMasaIsmData->energy_ratio_ism_fx[ismDirIndex][dirac_read_idx][bin] ); // Q14 ismRatioAcc_fx = add( ismRatioAcc_fx, ratio ); - ismRatioAcc_q_fx = Q14; move16(); /* Get input and output panning gains */ @@ -6013,7 +6023,7 @@ static void ivas_masa_ext_rend_parambin_internal( hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); - FOR( j = 0; j < nBins; j++ ) + FOR( j = 0; j < hSpatParamRendCom->num_freq_bands; j++ ) { f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 1e2fc6930..607bbce5e 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -63,7 +63,9 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void get_lattice_coeffs( const int16_t band_index, const int16_t channel_index, float *lattice_coeffs ); +#endif static void lattice2allpass( const int16_t filter_length, const float *lattice_coeffs, float *filter_coeffs_num_real, float *filter_coeffs_den_real ); #ifdef IVAS_FLOAT_FIXED static void get_lattice_coeffs_fx( const Word16 band_index, const Word16 channel_index, Word16 *lattice_coeffs ); @@ -1680,6 +1682,7 @@ void ivas_dirac_dec_decorr_close( *------------------------------------------------------------------------*/ /* get lattice coeffs with phase offset */ +#ifndef IVAS_FLOAT_FIXED static void get_lattice_coeffs( const int16_t band_index, const int16_t channel_index, @@ -1695,6 +1698,7 @@ static void get_lattice_coeffs( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void get_lattice_coeffs_fx( diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index b9f8ddee9..50aaf39f5 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -144,33 +144,6 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ } return result; } - -Word32 pow32_fx(Word16 inp, Word16 indx) -{ - Word32 temp_1, temp_2; - IF(EQ_16(indx, 1)) - { - return L_deposit_h(inp); - } - ELSE IF(EQ_16(indx, 0)) - { - return ONE_IN_Q31; - } - ELSE - { - temp_1 = L_mult(inp, inp); // Q31 - temp_2 = temp_1; - FOR(int i = 0; i < (shr(indx, 1)); i++) - { - temp_1 = Mpy_32_32(temp_1, temp_1); // Q31 - } - IF(s_and(indx, 1)) - { - temp_1 = Mpy_32_32(temp_2, temp_1); // Q31 - } - } - return temp_1; -} #endif ivas_error ivas_dirac_dec_onset_detection_open( @@ -335,7 +308,7 @@ void ivas_dirac_dec_onset_detection_process_fx( Word16 tmp_fx; Word32 tmp32_fx; Word32 *p_onset_detector_1_fx, *p_onset_detector_2_fx; - Word16 q_result,e_scale; + Word16 e_scale; p_onset_detector_1_fx = h_dirac_onset_detection_state.onset_detector_1_fx;//Q0 p_onset_detector_2_fx = h_dirac_onset_detection_state.onset_detector_2_fx;//Q0 @@ -371,7 +344,6 @@ void ivas_dirac_dec_onset_detection_process_fx( /*onset filter limited between 0 and 1*/ tmp_fx = BASOP_Util_Divide3232_Scale(*p_onset_detector_2_fx, *p_onset_detector_1_fx, &e_scale); tmp32_fx = L_mult0(tmp_fx, DIRAC_ONSET_GAIN_FX); - q_result = 12 + 15 - e_scale; IF(LT_32(tmp32_fx, 0)) { tmp32_fx = 0; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index e8260a818..d3759ade4 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -88,7 +88,9 @@ static void computeTargetPSDs_diffuse_subframe( const int16_t num_channels, cons static void computeTargetPSDs_diffuse_with_onsets( const int16_t num_channels, const int16_t num_freq_bands, const int16_t num_decorr_freq_bands, const int16_t *proto_frame_diff_index, const float *diffuse_power_factor, const float *reference_power, const float *diffuse_responses_square, const float *onset_filter, float *cy_auto_diff_smooth ); +#ifndef IVAS_FLOAT_FIXED static void computeAlphaSynthesis( float *alpha_synthesis, const int16_t averaging_length_ms, const float maxAlpha, int16_t *numAlphas, const int16_t slot_size, const int16_t num_freq_bands, const float *frequency_axis, const int32_t output_Fs ); +#endif #ifdef IVAS_FLOAT_FIXED static void computeAlphaSynthesis_fx( Word16 *alpha_synthesis_fx, const int16_t averaging_length_ms, const Word16 maxAlpha_fx, int16_t *numAlphas, const int16_t slot_size, const int16_t num_freq_bands, Word16 *frequency_axis_fx, const int32_t output_Fs ); @@ -1294,15 +1296,12 @@ void ivas_dirac_dec_output_synthesis_process_slot( int16_t diff_start_band; DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; -#ifdef IVAS_FLOAT_FIXED - Word32 *reference_power_fx = NULL, *onset_fx = NULL; - Word16 q_reference_power, q_onset; -#endif h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); h_dirac_output_synthesis_state->onset_filter = onset; + /*-----------------------------------------------------------------* * processing *-----------------------------------------------------------------*/ @@ -1365,152 +1364,124 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state->diffuse_power_factor ); } } - else if ( dec_param_estim == TRUE ) - { - /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, - hDirACRend, - hVBAPdata, - NULL, - NULL, - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + else // ( dec_param_estim == TRUE ) + if ( dec_param_estim == TRUE ) { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); + /* compute direct responses */ + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, + hVBAPdata, + NULL, + NULL, + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - int16_t k; - if ( ch_idx != 0 ) - { - float a, b, c; + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) + + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); + + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + { + int16_t k; + if ( ch_idx != 0 ) { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + float a, b, c; + + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } } - for ( ; k < num_freq_bands; k++ ) + else { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } } - else + + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - } - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirACRend->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); + } - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); + return; } - - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirACRend->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } - - return; } - else - { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); - } - } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) { -#ifdef IVAS_FLOAT_FIXED - h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, h_dirac_output_synthesis_params->max_band_decorr ); - - reference_power_fx = hDirACRend->stack_mem.reference_power_fx; - q_reference_power = L_get_q_buf( (float *) reference_power, num_freq_bands ); - floatToFixed_arrL( (float *) reference_power, reference_power_fx, q_reference_power, num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); - - onset_fx = hDirACRend->stack_mem.onset_filter_fx; - q_onset = Q30; - floatToFixed_arrL( (float *) onset, onset_fx, q_onset, ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ? hDirACRend->num_outputs_diff * num_freq_bands : 2 * num_freq_bands ); -#endif - -#ifdef IVAS_FLOAT_FIXED - computeTargetPSDs_diffuse_with_onsets_fx( num_channels_dir, - num_freq_bands, h_dirac_output_synthesis_params->max_band_decorr, - hDirACRend->proto_index_diff, - h_dirac_output_synthesis_state->diffuse_power_factor_fx, - reference_power_fx, - &q_reference_power, - h_dirac_output_synthesis_state->diffuse_responses_square_fx, - onset_fx, - h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, - &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); -#else computeTargetPSDs_diffuse_with_onsets( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_params->max_band_decorr, hDirACRend->proto_index_diff, @@ -1519,11 +1490,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state->diffuse_responses_square, onset, h_dirac_output_synthesis_state->cy_auto_diff_smooth ); -#endif - -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); -#endif diff_start_band = h_dirac_output_synthesis_params->max_band_decorr; } @@ -1531,66 +1497,14 @@ void ivas_dirac_dec_output_synthesis_process_slot( /* process other PSDs only slot wise for 4 transport channels */ if ( dec_param_estim == TRUE ) { -#ifdef IVAS_FLOAT_FIXED - h_dirac_output_synthesis_state->direct_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor_q, num_freq_bands ); - - reference_power_fx = hDirACRend->stack_mem.reference_power_fx; - q_reference_power = L_get_q_buf( (float *) reference_power, num_freq_bands ); - floatToFixed_arrL( (float *) reference_power, reference_power_fx, q_reference_power, num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_dir_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_cross_dir_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->direct_responses_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_q, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->direct_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->direct_responses_square_q, num_channels_dir * num_freq_bands ); -#endif - -#ifdef IVAS_FLOAT_FIXED - computeTargetPSDs_direct_fx( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor_fx, reference_power_fx, &q_reference_power, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); -#else computeTargetPSDs_direct( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor, reference_power, h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth ); -#endif -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * num_freq_bands ); -#endif - -#ifdef IVAS_FLOAT_FIXED - h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, num_freq_bands ); - - reference_power_fx = hDirACRend->stack_mem.reference_power_fx; - q_reference_power = L_get_q_buf( (float *) reference_power, num_freq_bands ); - floatToFixed_arrL( (float *) reference_power, reference_power_fx, q_reference_power, num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); -#endif - -#ifdef IVAS_FLOAT_FIXED - computeTargetPSDs_diffuse_fx( num_channels_dir, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, reference_power_fx, &q_reference_power, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); -#else computeTargetPSDs_diffuse( num_channels_dir, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor, reference_power, h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->cy_auto_diff_smooth ); -#endif - -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); -#endif } return; } + #ifdef IVAS_FLOAT_FIXED void ivas_dirac_dec_output_synthesis_process_slot_fx( const Word32 *reference_power, /* i : Estimated power */ @@ -3497,7 +3411,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { FOR( l = 0; l < num_freq_bands; l++ ) { - *( p_power_smooth++ ) = L_shr( *p_power_smooth, sub( min_exp, exp_arr[add( i_mult( k, num_freq_bands ), l )] ) ); + *p_power_smooth = L_shr( *p_power_smooth, sub( min_exp, exp_arr[add( i_mult( k, num_freq_bands ), l )] ) ); + p_power_smooth++; move32(); IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) { @@ -6104,7 +6019,8 @@ static void computeTargetPSDs_direct_fx( return; } -#else +#endif + static void computeTargetPSDs_direct( const int16_t num_channels, const int16_t num_freq_bands, @@ -6138,7 +6054,6 @@ static void computeTargetPSDs_direct( return; } -#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_direct_subframe_fx( @@ -6252,7 +6167,8 @@ static void computeTargetPSDs_diffuse_fx( return; } -#else +#endif + static void computeTargetPSDs_diffuse( const int16_t num_channels, const int16_t num_freq_bands, @@ -6281,7 +6197,6 @@ static void computeTargetPSDs_diffuse( return; } -#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_diffuse_subframe_fx( @@ -6392,7 +6307,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( return; } -#else +#endif static void computeTargetPSDs_diffuse_with_onsets( @@ -6434,7 +6349,7 @@ static void computeTargetPSDs_diffuse_with_onsets( return; } -#endif + #ifdef IVAS_FLOAT_FIXED static void computeAlphaSynthesis_fx(Word16 *alpha_synthesis_fx, const Word16 averaging_length_ms, const Word16 maxAlpha_fx, Word16 *numAlphas, const Word16 slot_size, const Word16 num_freq_bands, Word16 *frequency_axis_fx, const Word32 output_Fs) { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 036b71754..bd0300711 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -2291,7 +2291,7 @@ void initDiffuseResponses_fx( ELSE IF( ivas_format == MC_FORMAT && ( transport_config == IVAS_AUDIO_CONFIG_5_1 || transport_config == IVAS_AUDIO_CONFIG_7_1 ) && output_config == IVAS_AUDIO_CONFIG_7_1_4 ) { num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; - var1, exp_var1 = 15; + exp_var1 = 15; var1 = ISqrt16( num_horizontal_speakers, &exp_var1 ); var1 = shr( var1, negate( exp_var1 ) ); // Q15 set16_fx( diffuse_response_function_fx, var1, num_horizontal_speakers ); @@ -2984,7 +2984,7 @@ void protoSignalComputation2_fx( Word32 min_sum_total_ratio_fx, min_sum_total_ratio_db_fx; Word32 sum_total_ratio_fx[MASA_SUM_FREQ_RANGE_BINS]; Word16 q_sum_total_ratio; - Word32 a_fx, b_fx, a2_fx, b2_fx; + Word32 a_fx, b_fx; Word16 interpolatorSpaced_fx, interpolatorDmx_fx; Word32 tempSpaced_fx, tempDmx_fx; Word16 q_shift, min_q_shift, exp, q_temp, temp_q_shift, q_temp2; @@ -3139,9 +3139,9 @@ void protoSignalComputation2_fx( a_fx = 21474836; /*0.01 in Q31*/ /* Temporal smoothing coefficient */ move32(); b_fx = L_sub( ONE_IN_Q31, a_fx ); /* Temporal smoothing coefficient */ - a2_fx = 214748365; /*0.1 in Q31*/ /* Temporal smoothing coefficient */ + //a2_fx = 214748365; /*0.1 in Q31*/ /* Temporal smoothing coefficient */ move32(); - b2_fx = L_sub( ONE_IN_Q31, a2_fx ); /* Temporal smoothing coefficient */ + //b2_fx = L_sub( ONE_IN_Q31, a2_fx ); /* Temporal smoothing coefficient */ IF( GT_16( stereo_type_detect->interpolator, 0 ) ) { diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index f6b0cbc53..1ecf2342b 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -472,7 +472,7 @@ void limiter_process_fx( Word16 apply_limiting, apply_strong_limiting; Word32 **output; Word16 num_channels, q_fact_gain, scale, result; - Word32 sampling_rate, release_constant, compare_value; + Word32 release_constant, compare_value; Word32 div32, gain, frame_gain, attack_constant; /* return early if given nonsensical values */ @@ -487,7 +487,7 @@ void limiter_process_fx( gain = hLimiter->gain_fx; output = hLimiter->channel_ptrs_fx; num_channels = hLimiter->num_channels; - sampling_rate = hLimiter->sampling_rate; + //sampling_rate = hLimiter->sampling_rate; attack_constant = hLimiter->attack_constant_fx; /*-----------------------------------------------------------------* * Find highest absolute peak sample value diff --git a/lib_rend/ivas_masa_merge.c b/lib_rend/ivas_masa_merge.c index cce11afee..cbb826842 100644 --- a/lib_rend/ivas_masa_merge.c +++ b/lib_rend/ivas_masa_merge.c @@ -290,8 +290,7 @@ void diffuse_meta_merge_1x1_fx( ) { Word8 sf, band; - Word16 i, max_e, in1_e[MASA_FREQUENCY_BANDS]; - + Word16 max_e, in1_e[MASA_FREQUENCY_BANDS],i; FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { @@ -304,7 +303,6 @@ void diffuse_meta_merge_1x1_fx( tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16) UINT8_MAX, &scale); energyTimesRatio_fx = Mpy_32_16_r( inEne_fx[sf][band], tmp); energyTimesRatio_e = inEne_e[sf] + scale; - /* target is original MASA diffuseness */ tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16)UINT8_MAX, &scale); total_diff_nrg_fx = Mpy_32_16_r(inEne_fx[sf][band], tmp); diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index 83b4b4fc0..a29800683 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -95,9 +95,14 @@ void ivas_mcmasa_param_est_ana( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAM static void ivas_mcmasa_dmx( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_inp ); #endif +#ifndef IVAS_FLOAT_FIXED static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], const int16_t freq, const int16_t N, CovarianceMatrix *COVls ); +#endif +#ifndef IVAS_FLOAT_FIXED static void computeVerticalDiffuseness( float **buffer_intensity, const float *buffer_energy, const int16_t num_freq_bands, float *diffuseness ); +#endif + #ifdef IVAS_FLOAT_FIXED static void computeVerticalDiffuseness_fx( Word32 **buffer_intensity, /* i : Intensity vectors */ @@ -128,7 +133,9 @@ static void ivas_mcmasa_dmx_fx( #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, const int16_t numChannels ); +#endif /*--------------------------------------------------------------------------* @@ -2039,6 +2046,7 @@ static void compute_cov_mtx_fx( } #endif /* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ +#ifndef IVAS_FLOAT_FIXED static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, real, s[ch][freq] */ float si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, imag, s[ch][freq] */ @@ -2065,6 +2073,7 @@ static void compute_cov_mtx( return; } +#endif /*------------------------------------------------------------------------- * computeVerticalDiffuseness() @@ -2146,6 +2155,7 @@ static void computeVerticalDiffuseness_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void computeVerticalDiffuseness( float **buffer_intensity, /* i : Intensity vectors */ const float *buffer_energy, /* i : Energy */ @@ -2197,6 +2207,7 @@ static void computeVerticalDiffuseness( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void computeEvenLayout_fx( @@ -2261,6 +2272,7 @@ static void computeEvenLayout_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, @@ -2320,6 +2332,7 @@ static void computeEvenLayout( return; } +#endif /*------------------------------------------------------------------------- * ivas_create_masa_out_meta() diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index a8bf2de31..ba2b6e575 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -53,7 +53,9 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd ); +#endif #ifdef IVAS_FLOAT_FIXED static void TDREND_Clear_Update_flags_fx( @@ -214,7 +216,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( DirAtten_p->ConeOuterGain_fx = ONE_IN_Q30; move32(); - TDREND_SRC_SPATIAL_t *SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; + //TDREND_SRC_SPATIAL_t *SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; IF( ( error = TDREND_MIX_SRC_SetPos_fx( pBinRendTd, nS, Pos_fx ) ) != IVAS_ERR_OK ) { return error; @@ -227,7 +229,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( { return error; } - /*TDREND_SRC_SPATIAL_t **/ SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; + /*TDREND_SRC_SPATIAL_t **/ //SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; IF( ( error = TDREND_MIX_SRC_SetDirAtten_fx( pBinRendTd, nS, DirAtten_p ) ) != IVAS_ERR_OK ) { return error; @@ -632,13 +634,13 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( IF(hReverb != NULL) { - Word16 i, j, exp; + Word16 i, j; Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; Word32 *pcm_out_fx[BINAURAL_CHANNELS]; Word16 nchan_transport = audioCfg2channels(transport_config); - exp = Q7; + //exp = Q7; move16(); FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) { @@ -1128,6 +1130,7 @@ static void TDREND_Clear_Update_flags_fx( #endif +#ifndef IVAS_FLOAT_FIXED static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd /* i/o: TD renderer handle */ ) @@ -1143,7 +1146,7 @@ static void TDREND_Clear_Update_flags( return; } - +#endif /*---------------------------------------------------------------------* * TDREND_Update_object_positions_fx() diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index c91f8f6cd..95a36a8db 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -38,6 +38,7 @@ #include "ivas_error.h" #include "wmc_auto.h" #include "ivas_rom_rend.h" +#include "ivas_prot_fx.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx2.h" @@ -61,10 +62,11 @@ /*------------------------------------------------------------------------- * Local functions *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static ivas_error DefaultBSplineModel( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, const Word32 output_Fs ); +#else static ivas_error DefaultBSplineModel_fx( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, const Word32 output_Fs ); - +#endif /*-------------------------------------------------------------------* * TDREND_MIX_LIST_SetPos() diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index e389ed74b..79efc7156 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -38,6 +38,7 @@ #include "wmc_auto.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index d04bcf475..8ddbae1c2 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -49,7 +49,9 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_omasa_param_est_ana( OMASA_ANA_HANDLE hOMasa, float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_ism ); +#endif #ifndef IVAS_FLOAT_FIXED static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, const float ism_azimuth[MAX_NUM_OBJECTS], const float ism_elevation[MAX_NUM_OBJECTS], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); @@ -933,7 +935,6 @@ static void ivas_omasa_param_est_ana_fx( computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); intensity_q = sub( shl( add(foa_q, Q1), 1 ), 31 ); - direction_q, reference_power_q; computeDirectionVectors_fx( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], &direction_q ); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 42e7d9509..44c665e1b 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -452,6 +452,7 @@ static void QuaternionConjugate_fx( * Computes an angle between two quaternions *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float QuaternionAngle( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2 ) @@ -465,6 +466,7 @@ static float QuaternionAngle( return angle; } +#endif #ifdef IVAS_FLOAT_FIXED static Word32 QuaternionAngle_fx( @@ -1349,9 +1351,9 @@ ivas_error ivas_orient_trk_Process_fx( Word32 cutoffFrequency_fx, cutoff_prod; Word16 q_cutoff_prod = 0; Word32 alpha_fx = float_to_fix( alpha, Q30 ); - pOTR->refRot.q_fact = pOTR->refRot.q_fact = pOTR->refRot.q_fact = pOTR->refRot.q_fact = Q29; - absRot.q_fact = absRot.q_fact = absRot.q_fact = absRot.q_fact = Q29; - pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = Q29; + pOTR->refRot.q_fact = Q29; + absRot.q_fact = Q29; + pOTR->absAvgRot.q_fact = Q29; updateRate_fx = float_to_fix( updateRate, Q23 ); // value is 200// absRot.w_fx = float_to_fix( absRot.w, absRot.q_fact); absRot.x_fx = float_to_fix( absRot.x, absRot.q_fact); diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index 2805751e3..1a33dabc7 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -722,7 +722,7 @@ ivas_error ivas_er_compute_reflections( ivas_error error = IVAS_ERR_OK; UWord16 circ_len, i, j; UWord32 tmp_fx, tmp_fx1; - UWord16 tmp_fx_hi, tmp_fx_lo; + UWord16 tmp_fx_lo; reflections->is_ready = 0; move16(); @@ -745,7 +745,6 @@ ivas_error ivas_er_compute_reflections( FOR( j = 0; j < reflections->shoebox_data.n_ref; j++ ) { tmp_fx = reflections->shoebox_data.times.data_fx[j + ( i * reflections->shoebox_data.n_ref )]; - tmp_fx_hi = extract_h( tmp_fx ); tmp_fx_lo = extract_l( tmp_fx ); Mpy_32_16_uu( tmp_fx, (UWord16) reflections->output_Fs_fx, &tmp_fx1, &tmp_fx_lo ); tmp_fx1 = (UWord32) L_add( tmp_fx1, 0x20 ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index ef477db36..b85a8cce1 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1360,7 +1360,7 @@ static ivas_error calc_jot_t60_coeffs_fx( Word32 L_tmp; Word16 f0_fx, tmp_fx, lf_target_gain_dB_fx, hf_target_gain_dB_fx, mid_crossing_gain_dB_fx; Word16 lin_gain_lf_fx, lin_gain_hf_fx, shift, expl, exph; - int16_t f_idx, minidx, e = pH_dB_exp; + int16_t f_idx, e = pH_dB_exp; uint16_t n_points_lf, n_points_hf; lf_target_gain_dB_fx = 0; @@ -1369,7 +1369,6 @@ static ivas_error calc_jot_t60_coeffs_fx( Word16 minval_e = 67, exp; Word32 L_tmpl = 0, L_tmph = 0; - minidx = nrFrequencies - 1; n_points_lf = 0; n_points_hf = 0; Word16 minidx_fx = nrFrequencies - 1; diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index 57dc79860..817b5873b 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -65,6 +65,7 @@ * from the amplitude spectrum of the input. *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void calc_min_phase( rv_fftwf_type_complex *pSpectrum, const int16_t fft_size, @@ -190,6 +191,7 @@ static void calc_min_phase( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void calc_min_phase_fx( rv_fftwf_type_complex_fx *pSpectrum, @@ -367,6 +369,7 @@ static void calc_min_phase_fx( * This function expects only the positive frequency bins up to Nyquist/2 *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void calc_min_phase_filter( rv_fftwf_type_complex *pH_flt, const int16_t fft_size, @@ -397,6 +400,8 @@ static void calc_min_phase_filter( return; } +#endif + #ifdef IVAS_FLOAT_FIXED static void calc_min_phase_filter_fx( rv_fftwf_type_complex_fx *pH_flt, @@ -405,10 +410,11 @@ static void calc_min_phase_filter_fx( { const Word16 spectrum_size = add(shr(fft_size, 1), 1); Word16 idx; - Word16 phase_increment; + //Word16 phase_increment; Word32 pMin_phase[RV_FILTER_MAX_FFT_SIZE]; - phase_increment = 0; UNUSED_PARAM(delay); // delay is 0.0, -PI2 * delay / (float)fft_size; + //phase_increment = 0; + UNUSED_PARAM(delay); // delay is 0.0, -PI2 * delay / (float)fft_size; move16(); Word16 q_pMin_phase; calc_min_phase_fx(pH_flt, fft_size, pMin_phase, &q_pMin_phase); @@ -437,6 +443,7 @@ static void calc_min_phase_filter_fx( * Apply the smoothing (anti-aliasing) window in the time domain *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void apply_window_fft( rv_fftwf_type_complex *pH_flt, const float *pWindow, @@ -484,6 +491,7 @@ static void apply_window_fft( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void apply_window_fft_fx( rv_fftwf_type_complex_fx *pH_flt, @@ -563,6 +571,7 @@ static void apply_window_fft_fx( * Limit the gain vs frequency slope to T db per bin *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void response_step_limit( float *X, const int16_t dim_x, @@ -623,6 +632,7 @@ static void response_step_limit( return; } +#endif static void response_step_limit_fx( Word32 *X, @@ -717,6 +727,7 @@ static void response_step_limit_fx( * Compute a smoothing window used later to avoid aliasing in FFT filters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_define_window_fft( float *pWindow, const int16_t transitionStart, @@ -755,6 +766,7 @@ void ivas_reverb_define_window_fft( return; } +#endif void ivas_reverb_define_window_fft_fx( Word32 *pWindow, //output in Q31 @@ -807,6 +819,7 @@ void ivas_reverb_define_window_fft_fx( *-------------------------------------------------------------------*/ /* Computes colorations filters for the target frequency responses */ +#ifndef IVAS_FLOAT_FIXED int16_t ivas_reverb_calc_color_filters( const float *pTargetL, const float *pTargetR, @@ -845,6 +858,7 @@ int16_t ivas_reverb_calc_color_filters( return 0; } +#endif #ifdef IVAS_FLOAT_FIXED Word16 ivas_reverb_calc_color_filters_fx( const Word32 *pTargetL, @@ -893,6 +907,7 @@ Word16 ivas_reverb_calc_color_filters_fx( * Compute correlation filters for the target frequency response *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED int16_t ivas_reverb_calc_correl_filters( const float *pTargetICC, const float *pWindow, @@ -930,6 +945,7 @@ int16_t ivas_reverb_calc_correl_filters( return 0; } +#endif #ifdef IVAS_FLOAT_FIXED Word16 ivas_reverb_calc_correl_filters_fx( Word32 *pTargetICC, //input in Q30 @@ -987,6 +1003,7 @@ Word16 ivas_reverb_calc_correl_filters_fx( * Compute the target levels (gains) for the coloration filters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_calc_color_levels( const int32_t output_Fs, const int16_t freq_count, @@ -1086,6 +1103,7 @@ void ivas_reverb_calc_color_levels( return; } +#endif void ivas_reverb_calc_color_levels_fx( const Word32 output_Fs, @@ -1233,6 +1251,7 @@ void ivas_reverb_calc_color_levels_fx( * Note: the fc frequencies both for the input and the output must be in the ascending order *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_interpolate_acoustic_data( const int16_t input_table_size, const float *pInput_fc, @@ -1282,6 +1301,7 @@ void ivas_reverb_interpolate_acoustic_data( return; } +#endif void ivas_reverb_interpolate_acoustic_data_fx( const Word16 input_table_size, @@ -1352,6 +1372,7 @@ void ivas_reverb_interpolate_acoustic_data_fx( * and frequency-dependent IA coherence. Expects frequency-domain HRTF input *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_get_hrtf_set_properties( float **ppHrtf_set_L_re, float **ppHrtf_set_L_im, @@ -1520,6 +1541,7 @@ void ivas_reverb_get_hrtf_set_properties( return; } +#endif void ivas_reverb_get_hrtf_set_properties_fx( Word32 **ppHrtf_set_L_re, diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 36ef7a539..7e6af2b58 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -515,11 +515,15 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( float *avg_pwr_right ) { int16_t freq_idx; +#ifndef IVAS_FLOAT_FIXED const int16_t cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); +#endif float avg_pwr_left_fft[FFT_SPECTRUM_SIZE]; float avg_pwr_right_fft[FFT_SPECTRUM_SIZE]; float input_fc[FFT_SPECTRUM_SIZE]; +#ifndef IVAS_FLOAT_FIXED float output_fc[CLDFB_NO_CHANNELS_MAX]; +#endif ivas_error error; for ( freq_idx = 0; freq_idx < FFT_SPECTRUM_SIZE; freq_idx++ ) @@ -527,10 +531,12 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( FFT_SPECTRUM_SIZE - 1 ) ); } +#ifndef IVAS_FLOAT_FIXED for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } +#endif if ( ( error = ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, hHrtfFastConv, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ) ) != IVAS_ERR_OK ) { diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.c b/lib_rend/ivas_rom_TdBinauralRenderer.c index 91f79fb63..95d0e4514 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.c +++ b/lib_rend/ivas_rom_TdBinauralRenderer.c @@ -19513,7 +19513,7 @@ const UWord32 defaultHRIR_rom_EL48_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x00003794,0x000038b9,0x00003d6e,0x0000442f,0x00004cb0,0x000056be,0x00006333,0x000063ac,0x00006094,0x00006dcf,0x000071ea,0x000086f7,0x0000a035,0x0000975b,0x00009e9a,0x0000a5e0,0x0000a79e,0x0000b23a,0x0000bfbc,0x0000abfe,0x0000991b,0x000097d5,0x00008cac,0x00006560,0x00005b16, 0x00004eb9,0x00004ef0,0x00004f16,0x00004fb6,0x0000510d,0x00005600,0x00004f04,0x00004bf4,0x00004a5b,0x0000497c,0x00004a37,0x000049e2,0x00004d5b,0x00004f63,0x00005179,0x00005522,0x00005687,0x00006262,0x00006816,0x00007ec4,0x0000abd6,0x0000706a,0x00008b60,0x0000ca1f,0x0000c5e3, 0x0000bba0,0x0000a655,0x0000b00c,0x0000aaff,0x0000a4e6,0x00007d8e,0x00006765,0x00009e3e,0x00007e4b,0x00007037 -};; +}; const UWord32 defaultHRIR_rom_ER48_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x047ee4d8,0x03f280b8,0x05386b98,0x0472fda0,0x0546eb40,0x076f6d78,0x04382528,0x0488aa00,0x06bd5348,0x0704d428,0x06d60568,0x05f157b8,0x06d09290,0x06f92248,0x06cc8e98,0x0466c600,0x03db67c4,0x07924390,0x048ebf48,0x03f41dd8,0x04657680,0x036a1ca0,0x03cfde2c,0x03e0ba68,0x03f52760, @@ -19573,7 +19573,7 @@ const UWord32 defaultHRIR_rom_ER48_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x0000a003,0x000086bc,0x00007153,0x00006d70,0x0000608f,0x0000634e,0x0000638a,0x000056ba,0x00004cad,0x00004436,0x00003d6e,0x000038b8,0x00003795,0x000039c6,0x0000432a,0x00004dc6,0x00005828,0x000065b6,0x00007d59,0x00006b47,0x000069b6,0x00006ec7,0x00007b81,0x00004eba,0x00005951, 0x0000654d,0x00007d87,0x00009920,0x000067b9,0x00007d2a,0x0000a4b4,0x0000aad5,0x0000b032,0x0000a656,0x0000bb83,0x0000c5fe,0x0000ca75,0x00008ba1,0x000070cc,0x0000ad9f,0x00007f4d,0x00006826,0x00006217,0x00005680,0x0000552a,0x00005176,0x00004f63,0x00004d5c,0x000049e2,0x00004a38, 0x0000497d,0x00004a60,0x00004bf4,0x00004f03,0x00005602,0x0000510f,0x00004fbb,0x00004f07,0x00004f16,0x00007035 -};; +}; const UWord32 defaultHRIR_rom_EL32_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x054a4eb8,0x04f4f0d8,0x05569b70,0x04b47630,0x052be930,0x0558ee78,0x05a21340,0x05c92f10,0x06092e60,0x05a367d8,0x056ef578,0x053967f0,0x050b7040,0x04e48198,0x04c1a078,0x04ab4c58,0x04922828,0x04796a68,0x045da820,0x040c93f8,0x048b76b0,0x046b48d0,0x04a92308,0x0663b628,0x04465358, diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 41dc6a502..e9f05808f 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -44,6 +44,7 @@ #include #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #include "debug.h" #include "ivas_rom_binaural_crend_head.h" #define float_to_fixed( n, factor ) ( round( n * ( 1 << factor ) ) ) @@ -99,7 +100,9 @@ static void external_target_interpolation( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, const int16_t i ); +#ifndef IVAS_FLOAT_FIXED static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); +#endif #ifdef IVAS_FLOAT_FIXED static bool are_orientations_same_fx( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); @@ -802,10 +805,10 @@ void rotateAziEle( { dv_r[n] = Rmat[n][0] * dv[0] + Rmat[n][1] * dv[1] + Rmat[n][2] * dv[2]; } - float inter, inter1, inter2; - inter = atan2f( dv_r[1], dv_r[0] ); - inter1 = min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ); - inter2 = max( -180.0f, min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ) ); + //float inter, inter1, inter2; + //inter = atan2f( dv_r[1], dv_r[0] ); + //inter1 = min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ); + //inter2 = max( -180.0f, min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ) ); /*Conversion cartesian to spherical coordinates*/ *azi = (int16_t) roundf( max( -180.0f, min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ) ) ); if ( isPlanar == 0 ) @@ -2995,6 +2998,7 @@ static bool are_orientations_same_fx( return orientationsAreSame; } #endif +#ifndef IVAS_FLOAT_FIXED static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ) @@ -3012,6 +3016,7 @@ static bool are_orientations_same( return orientationsAreSame; } +#endif /*-----------------------------------------------------------------------* diff --git a/lib_rend/ivas_vbap.c b/lib_rend/ivas_vbap.c index 3c3fd8023..c0e60b6e3 100644 --- a/lib_rend/ivas_vbap.c +++ b/lib_rend/ivas_vbap.c @@ -3718,7 +3718,7 @@ static ivas_error formulate_half_sphere_connections_fx( var2 = dotp_fixed( planeCrossingVec_fx, speaker_node_data[cmp_chB].unit_vec_fx, 3 ); move32(); - final_exp_A, final_exp_B, exp_var1_sq, exp_var2_sq; + //final_exp_A, final_exp_B, exp_var1_sq, exp_var2_sq; var1_sq = Mpy_32_32( var1, var1 ); //(2 * (Q_planeCrossingVec - Q1) ) - Q31 var2_sq = Mpy_32_32( var2, var2 ); exp_var1_sq = shl( ( sub( Q31, sub( Q_planeCrossingVec, Q1 ) ) ), 1 ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d5a90e28a..26bbeede5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -439,6 +439,7 @@ static ivas_error allocateMcLfeDelayBuffer_fx( return IVAS_ERR_OK; } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error allocateMcLfeDelayBuffer( float **lfeDelayBuffer, const int16_t data_size ) @@ -451,6 +452,7 @@ static ivas_error allocateMcLfeDelayBuffer( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static void freeMcLfeDelayBuffer_fx( Word32 **lfeDelayBuffer ) @@ -465,6 +467,7 @@ static void freeMcLfeDelayBuffer_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void freeMcLfeDelayBuffer( float **lfeDelayBuffer ) { @@ -476,6 +479,7 @@ static void freeMcLfeDelayBuffer( return; } +#endif #ifdef IVAS_FLOAT_FIXED static IVAS_QUATERNION quaternionInit_fx( @@ -1204,6 +1208,7 @@ static ivas_error getSpeakerAzimuths_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error getSpeakerAzimuths( AUDIO_CONFIG config, const float **azimuths ) @@ -1237,6 +1242,7 @@ static ivas_error getSpeakerAzimuths( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error getSpeakerElevations_fx( AUDIO_CONFIG config, @@ -1272,6 +1278,7 @@ static ivas_error getSpeakerElevations_fx( return IVAS_ERR_OK; } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error getSpeakerElevations( AUDIO_CONFIG config, const float **elevations ) @@ -1305,6 +1312,7 @@ static ivas_error getSpeakerElevations( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error getAmbisonicsOrder_fx( @@ -2888,6 +2896,7 @@ static ivas_error initMcPanGainsWithMonoOut_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithMonoOut( input_mc *inputMc ) { @@ -2941,6 +2950,7 @@ static ivas_error initMcPanGainsWithMonoOut( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithStereoLookup_fx( input_mc *inputMc ) @@ -2997,6 +3007,7 @@ static ivas_error initMcPanGainsWithStereoLookup_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithStereoLookup( input_mc *inputMc ) { @@ -3042,6 +3053,7 @@ static ivas_error initMcPanGainsWithStereoLookup( return IVAS_ERR_OK; } +#endif /* Returns 1 (true) if configs A and B are equal, otherwise returns 0 (false). * If both configs are custom LS layouts, layout details are compared to determine equality. */ @@ -4506,7 +4518,7 @@ static ivas_error initSbaPanGainsForMcOut( BREAK; case IVAS_AUDIO_CONFIG_LS_CUSTOM: // ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); - ivas_ls_custom_setup_fx( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *) outSetupCustom ); + ivas_ls_custom_setup_fx( &hOutSetup, outSetupCustom ); BREAK; default: assert( !"Invalid speaker config" ); @@ -5105,7 +5117,11 @@ static void clearInputMasa( freeInputBaseBufferData( &inputMasa->bufferData ); +#ifdef IVAS_FLOAT_FIXED masaPrerendClose_fx( &inputMasa->hMasaPrerend ); +#else + masaPrerendClose( &inputMasa->hMasaPrerend ); +#endif freeMasaExtRenderer( &inputMasa->hMasaExtRend ); initRendInputBase( &inputMasa->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); @@ -7970,7 +7986,7 @@ static ivas_error rotateFrameMc_fx( Word16 nchan; Word16 ch_in, ch_out; Word16 ch_in_woLFE, ch_out_woLFE; - Word32 *readPtr, *writePtr; + Word32 *readPtr, *writePtr = NULL; const Word32 *ls_azimuth, *ls_elevation; rotation_matrix_fx Rmat_fx; rotation_gains_Word32 gains; @@ -8084,12 +8100,12 @@ static ivas_error rotateFrameMc_fx( /* crossfade with previous rotation gains */ FOR( i = 0; i < subframe_len; i++ ) { - *writePtr++ = + *writePtr = L_add( *writePtr, L_add( Mpy_32_32( ( *readPtr ), Mpy_32_32( ( ONE_IN_Q31 - crossfade[i] ), gains_prev[ch_in][ch_out] ) ), Mpy_32_32( ( *readPtr ), Mpy_32_32( crossfade[i], gains[ch_in][ch_out] ) ) ) ); // Qinp -1 - move32(); readPtr++; + writePtr++; } } } @@ -9263,7 +9279,7 @@ static void renderIsmToMasa( Word16 guard_bits = find_guarded_bits_fx( L_FRAME48k ); max_e = input_e[0]; - FOR( Word16 i = 1; i < MAX_NUM_OBJECTS; i++ ) + FOR( i = 1; i < MAX_NUM_OBJECTS; i++ ) { IF( max_e < input_e[0] ) max_e = input_e[i]; @@ -11546,7 +11562,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( { MASA_DECODER_EXT_OUT_META_HANDLE inMeta2; float( *inEne1 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifndef IVAS_FLOAT_FIXED float( *inEne2 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#endif Word32( *inEne1_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word32( *inEne2_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 *inEne1_e; @@ -11623,7 +11641,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) { inMeta2 = hIvasRend->inputsIsm->hOMasa->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsIsm->hOMasa->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); inEne2_e = (hIvasRend->inputsIsm->hOMasa->energy_e); @@ -11638,7 +11658,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { inMeta2 = hIvasRend->inputsMc->hMcMasa->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsMc->hMcMasa->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); inEne2_e = (hIvasRend->inputsMc->hMcMasa->energy_exp); @@ -11651,7 +11673,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { inMeta2 = hIvasRend->inputsSba->hDirAC->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsSba->hDirAC->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); inEne2_e = (hIvasRend->inputsSba->hDirAC->energy_exp); @@ -11664,7 +11688,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { inMeta2 = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); inEne2_e = (hIvasRend->inputsMasa->hMasaPrerend->energy_e); -- GitLab From b6e38f36e2e65800af41d49142bf98c4b709bd97 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 19:51:38 +0530 Subject: [PATCH 050/101] msan fixes for SBA, Stereo and MASA cases --- lib_dec/TonalComponentDetection_fx.c | 2 +- lib_dec/hf_synth_fx.c | 10 +- lib_dec/init_dec_fx.c | 10 +- lib_dec/ivas_core_dec.c | 2 +- lib_dec/ivas_init_dec.c | 20 +- lib_dec/ivas_qmetadata_dec.c | 14 + lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 4 + lib_dec/ivas_stereo_cng_dec.c | 7 + lib_dec/ivas_stereo_dft_plc_fx.c | 2 +- lib_dec/ivas_stereo_icbwe_dec.c | 4294 ++++++++++++------------ lib_rend/lib_rend.c | 12 +- 11 files changed, 2212 insertions(+), 2165 deletions(-) diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index e40828adc..9c7f57f24 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -64,7 +64,7 @@ void ivas_DetectTonalComponents_fx( { Word16 F0; Word16 thresholdModification[L_FRAME_MAX], lastMDCTSpect_exp; - Word32 pScaledMdctSpectrum[L_FRAME_MAX]; + Word32 pScaledMdctSpectrum[L_FRAME_MAX] = { 0 }; Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; Word16 q_pScaledMdctSpectrum; diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index c62767ab8..4cb4399d5 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -56,7 +56,11 @@ void hf_synth_init_fx( hBWE_zero->seed2 = RANDOM_INITSEED; set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); +#ifdef MSAN_FIX + set16_fx(hBWE_zero->mem_hp400_fx, 0, 6); +#else set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); +#endif // MSAN_FIX set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); @@ -75,7 +79,11 @@ void hf_synth_reset_fx( set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); - set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); /* TBV -> mem_hp400_fx has a length of 6, but only 4 values initialized in EVS ??? */ +#ifdef MSAN_FIX + set16_fx(hBWE_zero->mem_hp400_fx, 0, 6); +#else + set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); +#endif set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index c5cf8a7bc..bc1fb287d 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -321,6 +321,9 @@ ivas_error init_decoder_fx( move16(); /*1; Q15*/ st_fx->exc_pe_fx = 0; move16(); +#ifdef MSAN_FIX + st_fx->Q_stat_noise = 31; +#endif // MSAN_FIX /*-----------------------------------------------------------------* * LD music post-filter *-----------------------------------------------------------------*/ @@ -1156,7 +1159,10 @@ ivas_error init_decoder_ivas_fx( move16(); /*1; Q15*/ st_fx->exc_pe_fx = 0; move16(); - +#ifdef MSAN_FIX + st_fx->Q_stat_noise = 31; + move16(); +#endif st_fx->prev_coder_type = GENERIC; move16(); @@ -1344,6 +1350,8 @@ ivas_error init_decoder_ivas_fx( } st_fx->masa_sid_format = 0; + move16(); + st_fx->Q_stat_noise_ge = GE_SHIFT; move16(); /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index cd013cff6..fc2bf862c 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1117,7 +1117,7 @@ ivas_error ivas_core_dec( Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); #ifdef MSAN_FIX - IF( !( ( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) ) || ( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) ) ) + IF( (GT_32( st->core_brate, SID_2k40 ) && ( !( ((EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 )) || (( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 )) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) )) ) )) ) { Scale_sig32( hb_synth_32_fx[0], output_frame, sub( Q11, q ) ); Scale_sig32( hb_synth_32_fx[1], output_frame, sub( Q11, q ) ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 46f510cfa..ac39d5247 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -325,7 +325,7 @@ ivas_error ivas_dec_setup( //////////////// Cleanup changes: float to fixed ////////////////// Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src = 0; - Word16 i, Q_cldfbSynDec = 21; + Word16 i; Word16 old_ism_mode = ivas_omasa_ism_mode_select(st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism); Word16 new_ism_mode = ivas_omasa_ism_mode_select(st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_ism); @@ -354,8 +354,7 @@ ivas_error ivas_dec_setup( } IF(st_ivas->cldfbSynDec[0]) { - Q_cldfbSynDec = s_min(Q_cldfbSynDec, Q_factor_arrL(st_ivas->cldfbSynDec[0]->cldfb_state, sub(st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels))); - floatToFixed_arrL(st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub(st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels)); + floatToFixed_arrL(st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q11, sub(st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels)); } } //////////////////////////////////////////////////////////////// @@ -402,7 +401,7 @@ ivas_error ivas_dec_setup( } IF( st_ivas->cldfbSynDec[0] ) { - fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); + fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q11, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ); } } //////////////////////////////////////////////////////////////// @@ -433,7 +432,7 @@ ivas_error ivas_dec_setup( //////////////// Cleanup changes: float to fixed ////////////////// Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src = 0; - Word16 i, Q_cldfbSynDec = 21; + Word16 i; Word16 old_ism_mode = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism ); Word16 new_ism_mode = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_ism ); @@ -462,8 +461,7 @@ ivas_error ivas_dec_setup( } IF( st_ivas->cldfbSynDec[0] ) { - Q_cldfbSynDec = s_min( Q_cldfbSynDec, Q_factor_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ) ); - floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); + floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q11, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ); } } //////////////////////////////////////////////////////////////// @@ -510,7 +508,7 @@ ivas_error ivas_dec_setup( } IF( st_ivas->cldfbSynDec[0] ) { - fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); + fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q11, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ); } } //////////////////////////////////////////////////////////////// @@ -1497,6 +1495,10 @@ ivas_error ivas_init_decoder_fx( { return error; } +#ifdef MSAN_FIX + set_f( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, 0.f, CLDFB_NO_COL_MAX ); + set_s( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX ); +#endif IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { @@ -2532,7 +2534,7 @@ ivas_error ivas_init_decoder_fx( } IF( st_ivas->cldfbSynDec[0] ) { - fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); + fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ); } IF( st_ivas->hSpar ) { diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 8ebb0f619..f97c89461 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1686,20 +1686,34 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( } } +#ifdef MSAN_FIX + FOR( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) + { +#else FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) { FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) { +#endif // MSAN_FIX hQMetaData->q_direction[0].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[0][b][m] ); move32(); } } IF( EQ_32( hQMetaData->no_directions, 2 ) ) { +#ifdef MSAN_FIX + FOR( b = 0; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) + { + FOR( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) + { +#else FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) { FOR( m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES; m++ ) { +#endif // MSAN_FIX hQMetaData->q_direction[1].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[1][b][m] ); move32(); } diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 7339afde7..c34ba020f 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -768,6 +768,10 @@ static void ivas_sba_dirac_stereo_compute_td_stefi_nrgs( ELSE { set_val_Word32( hStereoDft->hb_stefi_sig_fx + hStereoDft->hb_stefi_delay, 0, output_frame); +#ifdef MSAN_FIX + hStereoDft->hb_nrg_subr_fx[0] = 0; + hStereoDft->hb_nrg_subr_fx[1] = 0; +#endif // MSAN_FIX } hStereoDft->hb_nrg_subr_fx[0] = hStereoDft->hb_nrg_subr_fx[0]; //imult3216(hStereoDft->hb_nrg_subr_fx[0] , shr(hStereoDft->NFFT, 1)); move32(); diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 7bc77fd2b..21fda4add 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1282,9 +1282,16 @@ static void stereo_dft_generate_comfort_noise_fx( { FOR( i = 0; i < numSlots; i++ ) { +#ifndef MSAN_FIX Word16 q_sqrt; +#else + Word16 q_sqrt = hFdCngCom->cngNoiseLevelExp; +#endif /* Real part in FFT bins */ rand_gauss_fx( ptr_r, &st->hTdCngDec->cng_seed, q_dft ); +#ifdef MSAN_FIX + q_sqrt = sub( Q31, q_cngNoiseLevel ); +#endif tmp = Mpy_32_16_1( Sqrt32( *ptr_level, &q_sqrt ), scale ); ( *ptr_r ) = Mpy_32_32( *ptr_r, tmp ); move32(); diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 318f8e1eb..255066ea3 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -76,7 +76,7 @@ void stereo_dft_res_ecu_fx( Word32 *input_mem /* o : Residual DFT buffer input mem */ ) { - Word32 res_buf[L_FRAME8k]; + Word32 res_buf[L_FRAME8k] = { 0 }; Word16 i; Word16 L_res; Word16 step; diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index e1fedd72f..39ae1386f 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -1,2146 +1,2150 @@ -/****************************************************************************************************** - - (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., - Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, - Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other - contributors to this repository retain full ownership rights in their respective contributions in - the software. This notice grants no license of any kind, including but not limited to patent - license, nor is any license granted by implication, estoppel or otherwise. - - Contributors are required to enter into the IVAS codec Public Collaboration agreement before making - contributions. - - This software is provided "AS IS", without any express or implied warranties. The software is in the - development stage. It is intended exclusively for experts who have experience with such software and - solely for the purpose of inspection. All implied warranties of non-infringement, merchantability - and fitness for a particular purpose are hereby disclaimed and excluded. - - Any dispute, controversy or claim arising under or in relation to providing this software shall be - submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in - accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and - the United Nations Convention on Contracts on the International Sales of Goods. - -*******************************************************************************************************/ - -#include -#include -#include "options.h" -#include -#include "cnst.h" -#include "ivas_cnst.h" -#include "prot.h" -#include "prot_fx1.h" -#include "prot_fx2.h" -#include "ivas_prot.h" -#include "ivas_prot_fx.h" -#include "wmc_auto.h" -#include "rom_com.h" -#include "ivas_rom_com.h" - - -#define Q_icBWE 16 - -/*-------------------------------------------------------------------* - * ic_bwe_dec_reset() - * - * core switching reset of IC BWE memory - *-------------------------------------------------------------------*/ - -#ifndef IVAS_FLOAT_FIXED -static void ic_bwe_dec_reset( - STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo ICBWE handle */ -) -{ - /* unscaled & scaled SHB synthesis memory */ - set_f( hStereoICBWE->mem_syn_shb_nonref, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ - set_f( hStereoICBWE->mem_lpc_shbsynth_nonref, 0, LPC_SHB_ORDER ); - set_f( hStereoICBWE->mem_syn_shb_ola_nonref, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ - - /* inter-channel BWE SP and GSP mem reset */ - hStereoICBWE->memShbSpecMapping = 0; - - set_f( hStereoICBWE->memShbHilbert_nonref, 0, HILBERT_MEM_SIZE ); - set_f( hStereoICBWE->memShbInterp_nonref, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); - set_f( hStereoICBWE->memShb_fsout_nonref, 0, INTERP_3_2_MEM_LEN ); - hStereoICBWE->syn_dm_phase_nonref = 0; - - return; -} -#else -static void ic_bwe_dec_reset_fx( - STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo ICBWE handle */ -) -{ - /* unscaled & scaled SHB synthesis memory */ - set32_fx( hStereoICBWE->mem_syn_shb_nonref_fx, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ - set32_fx( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, 0, LPC_SHB_ORDER ); - set32_fx( hStereoICBWE->mem_syn_shb_ola_nonref_fx, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ - - hStereoICBWE->prev_Q_syn_shb_nonref = 31; - move16(); - hStereoICBWE->prev_Q_lpc_shbsynth_nonref = 31; - move16(); - hStereoICBWE->prev_Q_syn_shb_ola_nonref = 31; - move16(); - - /* inter-channel BWE SP and GSP mem reset */ - hStereoICBWE->memShbSpecMapping_fx = 0; - move32(); - hStereoICBWE->prev_Q_memshbspec = 31; - move16(); - - set32_fx( hStereoICBWE->memShbHilbert_nonref_fx, 0, HILBERT_MEM_SIZE ); - set32_fx( hStereoICBWE->memShbInterp_nonref_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); - set32_fx( hStereoICBWE->memShb_fsout_nonref_fx, 0, INTERP_3_2_MEM_LEN ); - - hStereoICBWE->prev_Q_hilb = 31; - move16(); - hStereoICBWE->prev_Q_interp = 31; - move16(); - hStereoICBWE->prev_Q_fsout = 31; - move16(); - - hStereoICBWE->syn_dm_phase_nonref = 0; - move16(); - - return; -} -#endif - - -#ifndef IVAS_FLOAT_FIXED -/*-------------------------------------------------------------------* - * stereo_icBWE_dec() - * - * Spatial mapping of reference to the non-reference channels in SHB - *-------------------------------------------------------------------*/ - -void stereo_icBWE_dec( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float *synthRef, /* i/o: Reference channel HB synthesis at output Fs */ - float *synth, /* o : Non reference channel HB synthesis at output Fs */ - const float *fb_synth_ref, /* i : ref. high-band synthesis 16-20 kHz */ - const float *voice_factors, /* i : voicing factors */ - const int16_t output_frame /* i : frame length */ -) -{ - int16_t i, j, k, nbSubFr; - Decoder_State *st; /* i/o: decoder state structure, primary channel */ - int16_t spIndx, gsIndx; - float excSHB_nonref[L_FRAME16k]; - float shb_synth_nonref[L_FRAME16k + L_SHB_LAHEAD]; - float error[L_FRAME32k]; - float nlMixFac[NB_SUBFR16k]; - float gsMapping, specMapping; - float fb_synth_nonref[L_FRAME48k]; - float scale, prev_pow, curr_pow, temp; - float alpha, winSlope, winLen, prevgsMapping; - float temp1, temp2; - float icbweM2Ref, ratio_L; - - STEREO_DFT_DEC_DATA_HANDLE hStereoDft = hCPE->hStereoDft; - STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; - st = hCPE->hCoreCoder[0]; - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of mono DMX output * - * -------------------------------------------------------------------*/ - - if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode > STEREO_DFT_RES_COD_OFF ) - { - hCPE->hStereoDft->core_hist[0] = st->core; - - return; - } - else if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 ) - { - - return; - } - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of SID or NO_DATA frame - * -------------------------------------------------------------------*/ - - if ( st->core_brate <= SID_2k40 ) - { - return; - } - - /*--------------------------------------------------------------------* - * TD high band stereo filling * - * -------------------------------------------------------------------*/ - - /* update buffers for TD stereo filling */ - if ( hCPE->element_mode == IVAS_CPE_DFT ) - { - float hb_nrg = EPSILON; - float hb_nrg2 = EPSILON; - - if ( st->core == ACELP_CORE || st->last_core == ACELP_CORE ) - { - for ( i = 0; i < output_frame / 2; i++ ) - { - hb_nrg2 += synthRef[i] * synthRef[i]; - } - - hCPE->hStereoDft->hb_nrg_subr[0] = hb_nrg2; - hb_nrg += hb_nrg2; - hb_nrg2 = EPSILON; - - for ( ; i < output_frame; i++ ) - { - hb_nrg2 += synthRef[i] * synthRef[i]; - } - - hCPE->hStereoDft->hb_nrg_subr[1] = hb_nrg2; - hb_nrg += hb_nrg2; - - mvr2r( synthRef, hCPE->hStereoDft->hb_stefi_sig + hCPE->hStereoDft->hb_stefi_delay, output_frame ); - } - else - { - set_zero( hCPE->hStereoDft->hb_stefi_sig + hCPE->hStereoDft->hb_stefi_delay, output_frame ); - } - hCPE->hStereoDft->hb_nrg_subr[0] *= hCPE->hStereoDft->NFFT / 2; - hCPE->hStereoDft->hb_nrg_subr[1] *= hCPE->hStereoDft->NFFT / 2; - hCPE->hStereoDft->hb_nrg[0] = hb_nrg; - hCPE->hStereoDft->td_gain[0] = 0; - hCPE->hStereoDft->core_hist[0] = st->core; - } - - /*--------------------------------------------------------------------* - * IC-BWE * - * -------------------------------------------------------------------*/ - - if ( st->core != ACELP_CORE || st->extl == -1 || ( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) ) - { - return; - } - else if ( hCPE->element_mode == IVAS_CPE_DFT && st->core_brate <= SID_2k40 ) - { - mvr2r( synthRef, synth, output_frame ); - return; - } - - - set_f( fb_synth_nonref, 0, L_FRAME48k ); - - /* core switching reset */ - if ( st->last_core != ACELP_CORE || st->bwidth == WB ) - { - ic_bwe_dec_reset( hStereoICBWE ); - - if ( st->last_core != ACELP_CORE ) - { - hStereoICBWE->prevSpecMapping = 0.0f; - hStereoICBWE->prevgsMapping = 1.0f; - hStereoICBWE->icbweM2Ref_prev = 1.0f; - } - - if ( st->bwidth == WB ) - { - /* copy to outputHB and reset hb_synth values */ - mvr2r( synthRef, synth, output_frame ); - - if ( st->element_mode == IVAS_CPE_TD ) - { - hStereoICBWE->prevSpecMapping = 0.0f; - hStereoICBWE->prevgsMapping = 1.0f; - hStereoICBWE->icbweM2Ref_prev = 1.0f; - } - else if ( st->element_mode == IVAS_CPE_DFT ) - { - hStereoICBWE->refChanIndx_bwe = L_CH_INDX; - hStereoICBWE->prevSpecMapping = 0.0f; - - prevgsMapping = hStereoICBWE->prevgsMapping; - temp1 = hStereoDft->side_gain[2 * STEREO_DFT_BAND_MAX + hStereoDft->nbands - 1]; - icbweM2Ref = 1.f + temp1; - gsMapping = 1.f - temp1; - - winLen = (int16_t) ( ( SHB_OVERLAP_LEN * st->output_Fs ) / 16000 ); - winSlope = 1.0f / winLen; - alpha = winSlope; - for ( i = 0; i < winLen; i++ ) - { - synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) ); - synth[i] *= ( alpha * ( gsMapping ) + ( 1.0f - alpha ) * ( prevgsMapping ) ); - alpha += winSlope; - } - for ( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) - { - synthRef[i] *= ( icbweM2Ref ); - synth[i] *= ( gsMapping ); - } - hStereoICBWE->icbweM2Ref_prev = icbweM2Ref; - hStereoICBWE->prevgsMapping = gsMapping; - } - - return; - } - } - - if ( !st->bfi ) - { - hStereoICBWE->refChanIndx_bwe = get_next_indice( st, STEREO_ICBWE_REFBITS ); - if ( st->flag_ACELP16k == 1 ) - { - spIndx = get_next_indice( st, STEREO_ICBWE_SPBITS ); - } - else - { - spIndx = 3; - } - if ( st->element_mode == IVAS_CPE_TD ) - { - gsIndx = get_next_indice( st, STEREO_ICBWE_GSBITS ); - } - else - { - gsIndx = get_next_indice( st, STEREO_ICBWE_GSBITS_DFT ); - } - - /* Store indices in case of frame loss */ - hStereoICBWE->prev_spIndx = spIndx; - hStereoICBWE->prev_gsIndx = gsIndx; - } - else /*bfi*/ - { - /* Retrieve last decoded indices */ - spIndx = hStereoICBWE->prev_spIndx; - gsIndx = hStereoICBWE->prev_gsIndx; - hStereoICBWE->refChanIndx_bwe = hStereoICBWE->prev_refChanIndx_bwe; - } - - /* IC-BWE parameter de-quant */ - /* sp Mapping */ - hStereoICBWE->prevSpecMapping = usdequant( spIndx, -0.6f, 0.2f ); - - /* gs Mapping */ - prevgsMapping = hStereoICBWE->prevgsMapping; - - if ( st->element_mode == IVAS_CPE_TD ) - { - hStereoICBWE->prevgsMapping = icbwe_gsMapping_tbl[gsIndx]; - } - else - { - hStereoICBWE->prevgsMapping = icbwe_gsMappingDFT_tbl[gsIndx]; - } - - hStereoICBWE->prevgsMapping = powf( 10, hStereoICBWE->prevgsMapping ); - - specMapping = hStereoICBWE->prevSpecMapping; - gsMapping = hStereoICBWE->prevgsMapping; - - if ( ( st->extl == SWB_TBE || st->extl == FB_TBE ) && st->flag_ACELP16k == 1 ) - { - mvr2r( voice_factors, nlMixFac, NB_SUBFR16k ); - if ( hCPE->hStereoDftDmx != NULL ) - { - if ( hCPE->hStereoDftDmx->targetGain < 0.5f || hCPE->hStereoDftDmx->targetGain > 2.0f ) - { - v_multc( voice_factors, 0.5f, nlMixFac, NB_SUBFR16k ); - } - } - else - { - if ( hCPE->hStereoTCA->targetGain < 0.5f || hCPE->hStereoTCA->targetGain > 2.0f ) - { - v_multc( voice_factors, 0.5f, nlMixFac, NB_SUBFR16k ); - } - } - - nbSubFr = ( st->flag_ACELP16k == 0 ) ? NB_SUBFR : NB_SUBFR16k; - for ( i = 0, k = 0; i < nbSubFr; i++ ) - { - if ( hCPE->hCoreCoder[0]->coder_type == UNVOICED || hStereoICBWE->MSFlag == 1 ) - { - temp1 = 0; - temp2 = 1.0f; - } - else - { - temp1 = sqrtf( nlMixFac[i] ); - temp2 = sqrtf( 1.0f - nlMixFac[i] ); - } - - for ( j = 0; j < L_FRAME16k / nbSubFr; j++, k++ ) - { - excSHB_nonref[k] = temp1 * hStereoICBWE->nlExc16k[k] + temp2 * hStereoICBWE->mixExc16k[k]; - } - } - - /* LP synthesis */ - mvr2r( hStereoICBWE->mem_syn_shb_nonref, shb_synth_nonref, L_SHB_LAHEAD ); - syn_filt( hStereoICBWE->lpSHBRef, LPC_SHB_ORDER, excSHB_nonref, shb_synth_nonref + L_SHB_LAHEAD, L_FRAME16k, hStereoICBWE->mem_lpc_shbsynth_nonref, 1 ); - - prev_pow = sum2_f( shb_synth_nonref, L_SHB_LAHEAD + 10 ); - curr_pow = sum2_f( shb_synth_nonref + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 ); - - if ( prev_pow == 0 ) - { - scale = 0; - } - else - { - scale = sqrtf( curr_pow / prev_pow ); - } - - for ( i = 0; i < L_SHB_LAHEAD; i++ ) - { - shb_synth_nonref[i] *= scale; - } - - for ( ; i < L_SHB_LAHEAD + 10; i++ ) - { - temp = ( i - 19 ) / 10.0f; - shb_synth_nonref[i] *= ( temp * 1.0f + ( 1.0f - temp ) * scale ); - } - /* spec and gs adjustment */ - deemph( shb_synth_nonref + L_SHB_LAHEAD, specMapping, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping ) ); - mvr2r( shb_synth_nonref + L_FRAME16k, hStereoICBWE->mem_syn_shb_nonref, L_SHB_LAHEAD ); - - ScaleShapedSHB( SHB_OVERLAP_LEN, shb_synth_nonref, hStereoICBWE->mem_syn_shb_ola_nonref, hStereoICBWE->gshapeRef, ( hStereoICBWE->gFrameRef * gsMapping * 0.9f ), window_shb, subwin_shb ); - - if ( st->extl == FB_TBE ) - { - v_multc( fb_synth_ref, gsMapping, fb_synth_nonref, L_FRAME48k ); - } - - /* generate 32kHz SHB synthesis from 12.8(16)kHz signal */ - GenSHBSynth( shb_synth_nonref, error, hStereoICBWE->memShbHilbert_nonref, hStereoICBWE->memShbInterp_nonref, st->L_frame, &( hStereoICBWE->syn_dm_phase_nonref ) ); - } - else - { - mvr2r( synthRef, synth, output_frame ); - - winLen = (int16_t) ( ( SHB_OVERLAP_LEN * st->output_Fs ) / 16000 ); - winSlope = 1.0f / winLen; - alpha = winSlope; - - ratio_L = ( hCPE->element_mode == IVAS_CPE_DFT ) ? ( 0.5f ) : ( tdm_ratio_tabl[hCPE->hStereoTD->tdm_last_ratio_idx] ); - - icbweM2Ref = gsMapping; - if ( hStereoICBWE->refChanIndx_bwe == L_CH_INDX ) - { - if ( ratio_L >= 0.1f ) - { - icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ( 1 - ratio_L ) * ( 1 - ratio_L ) * gsMapping * gsMapping ) ) / ratio_L; - } - } - else - { - if ( ratio_L <= 0.9f ) - { - icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ratio_L * ratio_L * gsMapping * gsMapping ) ) / ( 1 - ratio_L ); - } - } - - icbweM2Ref = max( gsMapping, icbweM2Ref ); - - for ( i = 0; i < winLen; i++ ) - { - synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) ); - synth[i] *= ( alpha * ( gsMapping ) + ( 1.0f - alpha ) * ( prevgsMapping ) ); - alpha += winSlope; - } - for ( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) - { - synthRef[i] *= ( icbweM2Ref ); - synth[i] *= ( gsMapping ); - } - hStereoICBWE->icbweM2Ref_prev = icbweM2Ref; - - ic_bwe_dec_reset( hStereoICBWE ); - hStereoICBWE->prevSpecMapping = 0.0f; - - return; - } - - /* resample to output FS */ - if ( st->output_Fs == 48000 ) - { - interpolate_3_over_2_allpass( error, L_FRAME32k, synth, hStereoICBWE->memShb_fsout_nonref ); - } - else if ( st->output_Fs == 32000 ) - { - mvr2r( error, synth, L_FRAME32k ); - } - else if ( st->output_Fs == 16000 ) - { - Decimate_allpass_steep( error, hStereoICBWE->memShb_fsout_nonref, L_FRAME32k, synth ); - } - - - if ( st->extl == FB_TBE && st->output_Fs == 48000 ) - { - v_add( fb_synth_nonref, synth, synth, L_FRAME48k ); - } - - /* copy to outputHB and reset hb_synth values */ - ratio_L = ( hCPE->element_mode == IVAS_CPE_DFT ) ? ( 0.5f ) : ( tdm_ratio_tabl[hCPE->hStereoTD->tdm_last_ratio_idx] ); - - icbweM2Ref = gsMapping; - if ( hStereoICBWE->refChanIndx_bwe == L_CH_INDX ) - { - if ( ratio_L >= 0.1f ) - { - icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ( 1 - ratio_L ) * ( 1 - ratio_L ) * gsMapping * gsMapping ) ) / ratio_L; - } - } - else - { - if ( ratio_L <= 0.9f ) - { - icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ratio_L * ratio_L * gsMapping * gsMapping ) ) / ( 1 - ratio_L ); - } - } - - icbweM2Ref = max( gsMapping, icbweM2Ref ); - - winLen = (int16_t) ( ( SHB_OVERLAP_LEN * st->output_Fs ) / 16000 ); - winSlope = 1.0f / winLen; - alpha = winSlope; - for ( i = 0; i < winLen; i++ ) - { - synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) ); - alpha += winSlope; - } - - for ( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) - { - synthRef[i] *= ( icbweM2Ref ); - } - - hStereoICBWE->icbweM2Ref_prev = icbweM2Ref; - - return; -} -#else -static Word16 FindScale( - Word32 *buff, - Word16 len, - Word16 Q_buff, - Word16 Q_prev ) -{ - Word32 maxVal; - Word16 norm_shift, Q_out; - - maximum_abs_32_fx( buff, len, &maxVal ); - norm_shift = norm_l( maxVal ); - IF( EQ_32( maxVal, 0 ) ) - { - norm_shift = 31; - move16(); - } - - Q_out = s_min( Q_prev, add( Q_buff, norm_shift ) ); - - return Q_out; -} - - -void stereo_icBWE_dec_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *synthRef_fx, /* i/o: Reference channel HB synthesis at output Fs Q_syn/Q_syn - 1 */ - Word32 *synth_fx, /* o : Non reference channel HB synthesis at output Fs Q_syn/Q_syn - 1 */ - const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz Qx */ - const Word16 *voice_factors_fx, /* i : voicing factors Q15 */ - const Word16 output_frame, /* i : frame length */ - Word16 *Q_syn /* i : Q of synth and synthRef buffers */ -) -{ - Word16 i, j, k, nbSubFr; - Decoder_State *st; /* i/o: decoder state structure, primary channel */ - Word16 spIndx, gsIndx; - Word32 excSHB_nonref_fx[L_FRAME16k]; - Word32 shb_synth_nonref_fx[L_FRAME16k + L_SHB_LAHEAD]; - Word32 error_fx[L_FRAME32k]; - Word16 nlMixFac_fx[NB_SUBFR16k]; - Word16 specMapping_fx; - Word16 fb_synth_nonref_fx[L_FRAME48k]; - Word32 prev_pow_fx, curr_pow_fx, maxVal1, maxVal; - Word16 scale_fx, e_scale_fx; - Word16 alpha_fx, winSlope_fx, winLen_fx; - Word16 prevgsMapping_fx; - Word16 temp1_fx, temp2_fx; - Word16 icbweM2Ref_fx, ratio_L_fx; - Word16 gsMapping_fx; - Word32 hb_nrg_fx, hb_nrg2_fx; - Word16 Q_syn_shb; - Word16 shift_prev_pow, synthRef_shift; - Word32 L_tmp; - Word16 tmp; - Word32 L_nlExc16k, L_mixExc16k; - - STEREO_DFT_DEC_DATA_HANDLE hStereoDft = hCPE->hStereoDft; - STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; - st = hCPE->hCoreCoder[0]; - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of mono DMX output * - * -------------------------------------------------------------------*/ - - test(); - test(); - test(); - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) && GT_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) - { - hCPE->hStereoDft->core_hist[0] = st->core; - move16(); - - return; - } - ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) ) - { - return; - } - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of SID or NO_DATA frame - * -------------------------------------------------------------------*/ - - IF( LE_32( st->core_brate, SID_2k40 ) ) - { - return; - } - - /*--------------------------------------------------------------------* - * TD high band stereo filling * - * -------------------------------------------------------------------*/ - - /* update buffers for TD stereo filling */ - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) - { - hb_nrg_fx = 0; - move32(); - hb_nrg2_fx = 0; - move32(); - maximum_abs_32_fx( synthRef_fx, output_frame, &maxVal ); - synthRef_shift = norm_l( maxVal ); - IF( EQ_32( maxVal, 0 ) ) - { - synthRef_shift = 31; - move16(); - } - synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( output_frame ), 1 ), 1 ) ); - test(); - IF( EQ_16( st->core, ACELP_CORE ) || EQ_16( st->last_core, ACELP_CORE ) ) - { - FOR( i = 0; i < output_frame / 2; i++ ) - { - // needed to be adjusted for q - L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); - hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); // 2*(Qx + SynthRef_shift) - 31 - } - - hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg2_fx; - move32(); - hStereoDft->q_hb_nrg_subr = sub(add(*Q_syn, synthRef_shift), 31); - hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); - hb_nrg2_fx = 0; - move32(); - - FOR( ; i < output_frame; i++ ) - { - L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); - hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); - } - - hCPE->hStereoDft->hb_nrg_subr_fx[1] = hb_nrg2_fx; // 2*(Qx + SynthRef_shift) - 31 - move32(); - hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); - - Copy32( synthRef_fx, hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame ); - - Scale_sig32(hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame, -5); - } - ELSE - { - set32_fx( hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, 0, output_frame ); - } - hCPE->hStereoDft->hb_nrg_subr_fx[0] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[0], shl( hCPE->hStereoDft->NFFT / 2, 6 ) ) ); // 2 * (Qx + SynthRef_shift) - 40 // 2 * (Qx + SynthRef_shift) - 31 - 15 - move32(); - hCPE->hStereoDft->hb_nrg_subr_fx[1] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[1], shl( hCPE->hStereoDft->NFFT / 2, 6 ) ) ); // 2 * (Qx + SynthRef_shift) - 40 - move32(); - hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 40 ); - hCPE->hStereoDft->hb_nrg_fx[0] = hb_nrg_fx; // 2 * (Qx + SynthRef_shift) - 31 - move32(); - hCPE->hStereoDft->td_gain_fx[0] = 0; - move32(); - hCPE->hStereoDft->core_hist[0] = st->core; - move16(); - } - - /*--------------------------------------------------------------------* - * IC-BWE * - * -------------------------------------------------------------------*/ - test(); - test(); - test(); - test(); - IF( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) - { - return; - } - ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && LE_32( st->core_brate, SID_2k40 ) ) - { - Copy32( synthRef_fx, synth_fx, output_frame ); - return; - } - - - set16_fx( fb_synth_nonref_fx, 0, L_FRAME48k ); - - /* core switching reset */ - test(); - IF( NE_16( st->last_core, ACELP_CORE ) || EQ_16( st->bwidth, (Word16) WB ) ) - { - ic_bwe_dec_reset_fx( hStereoICBWE ); - - IF( NE_16( st->last_core, ACELP_CORE ) ) - { - hStereoICBWE->prevSpecMapping_fx = 0; - move16(); - hStereoICBWE->prevgsMapping_fx = 16384; - move16(); - hStereoICBWE->icbweM2Ref_prev_fx = 16384; - move16(); - } - - IF( EQ_16( st->bwidth, WB ) ) - { - /* copy to outputHB and reset hb_synth values */ - Copy32( synthRef_fx, synth_fx, output_frame ); - - IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) - { - hStereoICBWE->prevSpecMapping_fx = 0; - move16(); - hStereoICBWE->prevgsMapping_fx = 16384; - move16(); - hStereoICBWE->icbweM2Ref_prev_fx = 16384; - move16(); - } - ELSE IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) - { - hStereoICBWE->refChanIndx_bwe = L_CH_INDX; - move16(); - hStereoICBWE->prevSpecMapping_fx = 0; - move16(); - - prevgsMapping_fx = hStereoICBWE->prevgsMapping_fx; - move16(); - temp1_fx = shr( extract_h( hStereoDft->side_gain_fx[2 * STEREO_DFT_BAND_MAX + hStereoDft->nbands - 1] ), 1 ); - icbweM2Ref_fx = add( 16384, temp1_fx ); - gsMapping_fx = sub( 16384, temp1_fx ); - - winLen_fx = extract_l( Mpy_32_16_1( st->output_Fs, 41 ) ); //(int16_t)((SHB_OVERLAP_LEN * st->output_Fs) / 16000); - winSlope_fx = div_s( 1, winLen_fx ); - alpha_fx = winSlope_fx; - move16(); - FOR( i = 0; i < winLen_fx; i++ ) - { - L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 - L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), ( hStereoICBWE->icbweM2Ref_prev_fx ) ); // Q15 + Q14; - tmp = shl( round_fx( L_tmp ), 1 ); // Q = 15 + 14 - 16 + 1 = Q14 - synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], tmp ); - move32(); - L_tmp = L_mult0( alpha_fx, gsMapping_fx ); - L_tmp = L_mac0( L_tmp, ( sub( 32767, alpha_fx ) ), ( prevgsMapping_fx ) ); - tmp = shl( round_fx( L_tmp ), 1 ); // Q = 15 + 14 - 16 + 1 = Q14 - synth_fx[i] = Mpy_32_16_1( synth_fx[i], tmp ); - move32(); - IF( LE_16( alpha_fx, sub( 32767, winSlope_fx ) ) ) - { - alpha_fx = add( alpha_fx, winSlope_fx ); - } - } - FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) - { - synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], icbweM2Ref_fx ); - move32(); - synth_fx[i] = Mpy_32_16_1( synth_fx[i], gsMapping_fx ); - move32(); - } - hStereoICBWE->icbweM2Ref_prev_fx = icbweM2Ref_fx; - move16(); - hStereoICBWE->prevgsMapping_fx = gsMapping_fx; - move16(); - - *Q_syn = sub( *Q_syn, 1 ); - } - - return; - } - } - - IF( EQ_16( st->bfi, 0 ) ) - { - hStereoICBWE->refChanIndx_bwe = get_next_indice_fx( st, STEREO_ICBWE_REFBITS ); - IF( EQ_16( st->flag_ACELP16k, 1 ) ) - { - spIndx = get_next_indice_fx( st, STEREO_ICBWE_SPBITS ); - } - ELSE - { - spIndx = 3; - move16(); - } - IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) - { - gsIndx = get_next_indice_fx( st, STEREO_ICBWE_GSBITS ); - } - ELSE - { - gsIndx = get_next_indice_fx( st, STEREO_ICBWE_GSBITS_DFT ); - } - - /* Store indices in case of frame loss */ - hStereoICBWE->prev_spIndx = spIndx; - move16(); - hStereoICBWE->prev_gsIndx = gsIndx; - move16(); - } - ELSE /*bfi*/ - { - /* Retrieve last decoded indices */ - spIndx = hStereoICBWE->prev_spIndx; - move16(); - gsIndx = hStereoICBWE->prev_gsIndx; - move16(); - hStereoICBWE->refChanIndx_bwe = hStereoICBWE->prev_refChanIndx_bwe; - move16(); - } - - /* IC-BWE parameter de-quant */ - /* sp Mapping */ - hStereoICBWE->prevSpecMapping_fx = usdequant_fx( spIndx, -19661, 3277 ); // Q15 - - /* gs Mapping */ - prevgsMapping_fx = hStereoICBWE->prevgsMapping_fx; // Q14 - move16(); - - IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) - { - hStereoICBWE->prevgsMapping_fx = pow_10_icbwe_gsMapping_tbl_fx[gsIndx]; - move16(); - } - ELSE - { - hStereoICBWE->prevgsMapping_fx = pow_10_icbwe_gsMappingDFT_tbl_fx[gsIndx]; - move16(); - } - - // hStereoICBWE->prevgsMapping = powf( 10, hStereoICBWE->prevgsMapping ); - - specMapping_fx = hStereoICBWE->prevSpecMapping_fx; // Q15 - move16(); - gsMapping_fx = hStereoICBWE->prevgsMapping_fx; // Q14 - move16(); - - test(); - test(); - IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) - { - Copy( voice_factors_fx, nlMixFac_fx, NB_SUBFR16k ); // Q15 - IF( hCPE->hStereoDftDmx != NULL ) - { - test(); - IF( LT_32( hCPE->hStereoDftDmx->targetGain_fx, 268435456 ) || GT_32( hCPE->hStereoDftDmx->targetGain_fx, 1073741824 ) ) - { - v_multc_fixed_16_16( voice_factors_fx, 16384, nlMixFac_fx, NB_SUBFR16k ); - } - } - ELSE - { - test(); - IF( LT_32( hCPE->hStereoTCA->targetGain_fx, 268435456 ) || GT_32( hCPE->hStereoTCA->targetGain_fx, 1073741824 ) ) - { - v_multc_fixed_16_16( voice_factors_fx, 16384, nlMixFac_fx, NB_SUBFR16k ); - } - } - - // nbSubFr = ( st->flag_ACELP16k == 0 ) ? NB_SUBFR : NB_SUBFR16k; - IF( EQ_16( st->flag_ACELP16k, 0 ) ) - { - nbSubFr = NB_SUBFR; - move16(); - } - ELSE - { - nbSubFr = NB_SUBFR16k; - move16(); - } - k = 0; - move16(); - FOR( i = 0; i < nbSubFr; i++ ) - { - IF( EQ_16( hCPE->hCoreCoder[0]->coder_type, UNVOICED ) || EQ_16( hStereoICBWE->MSFlag, 1 ) ) - { - temp1_fx = 0; - move16(); - temp2_fx = 32767; - move16(); - } - ELSE - { - tmp = 0; - move16(); - temp1_fx = Sqrt16( nlMixFac_fx[i], &tmp ); - IF( LT_16( tmp, 0 ) ) - { - temp1_fx = shl( temp1_fx, tmp ); - } - tmp = 0; - move16(); - temp2_fx = Sqrt16( sub( 32767, nlMixFac_fx[i] ), &tmp ); - IF( LT_16( tmp, 0 ) ) - { - temp2_fx = shl( temp2_fx, tmp ); - } - } - - FOR( j = 0; j < L_FRAME16k / nbSubFr; j++ ) - { - // common Q for addition - L_nlExc16k = L_deposit_l( hStereoICBWE->nlExc16k_fx[k] ); // prev_q_bwe_exc - 16 - L_mixExc16k = L_deposit_l( hStereoICBWE->mixExc16k_fx[k] ); // Q_exc - L_nlExc16k = L_shl( L_nlExc16k, Q_icBWE - ( st->prev_Q_bwe_exc - 16 ) ); // Q_icBWE -#ifndef FIX_736_BWE_SECT_C - L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - st->Q_exc ); // Q_icBWE -#else - L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - ( st->prev_Q_bwe_exc - 25 ) ); // Q_icBWE -#endif - excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q_icBWE - move32(); - k++; - } - } - - /* LP synthesis */ - Q_syn_shb = 31; - move16(); - - Q_syn_shb = FindScale( hStereoICBWE->mem_syn_shb_nonref_fx, LPC_SHB_ORDER, hStereoICBWE->prev_Q_syn_shb_nonref, Q_syn_shb ); - Q_syn_shb = FindScale( hStereoICBWE->lpSHBRef_fx, LPC_SHB_ORDER + 1, 12, Q_syn_shb ); - Q_syn_shb = FindScale( excSHB_nonref_fx, L_FRAME16k, Q_icBWE, Q_syn_shb ); - Q_syn_shb = FindScale( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, hStereoICBWE->prev_Q_lpc_shbsynth_nonref, Q_syn_shb ); - - Q_syn_shb = sub( Q_syn_shb, 3 ); // gaurded bits - - Scale_sig32( hStereoICBWE->lpSHBRef_fx, LPC_SHB_ORDER + 1, sub( Q_syn_shb, 12 ) ); - Scale_sig32( excSHB_nonref_fx, L_FRAME16k, sub( Q_syn_shb, Q_icBWE ) ); - Scale_sig32( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, sub( Q_syn_shb, hStereoICBWE->prev_Q_lpc_shbsynth_nonref ) ); - Scale_sig32( hStereoICBWE->mem_syn_shb_nonref_fx, L_SHB_LAHEAD, sub( Q_syn_shb, hStereoICBWE->prev_Q_syn_shb_nonref ) ); - - - Copy32( hStereoICBWE->mem_syn_shb_nonref_fx, shb_synth_nonref_fx, L_SHB_LAHEAD ); - - E_UTIL_synthesis_fx( 0, hStereoICBWE->lpSHBRef_fx, excSHB_nonref_fx, shb_synth_nonref_fx + L_SHB_LAHEAD, L_FRAME16k, hStereoICBWE->mem_lpc_shbsynth_nonref_fx, 1, LPC_SHB_ORDER ); - - hStereoICBWE->prev_Q_lpc_shbsynth_nonref = Q_syn_shb; - move16(); - - maximum_abs_32_fx( shb_synth_nonref_fx, L_SHB_LAHEAD + 10 + L_SHB_LAHEAD + 10, &maxVal1 ); // Qsyn_shb - - shift_prev_pow = sub( norm_l( maxVal1 ), find_guarded_bits_fx( L_SHB_LAHEAD + 10 ) ); - - prev_pow_fx = 0; - move32(); - curr_pow_fx = 0; - move32(); - FOR( i = 0; i < L_SHB_LAHEAD + 10; i++ ) - { - L_tmp = L_shl( shb_synth_nonref_fx[i], shift_prev_pow ); - prev_pow_fx = L_add( prev_pow_fx, Mpy_32_32( L_tmp, L_tmp ) ); - } - FOR( i = 0; i < L_SHB_LAHEAD + 10; i++ ) - { - L_tmp = L_shl( shb_synth_nonref_fx[L_SHB_LAHEAD + 10 + i], shift_prev_pow ); - curr_pow_fx = L_add( curr_pow_fx, Mpy_32_32( L_tmp, L_tmp ) ); - } - - IF( EQ_32( prev_pow_fx, 0 ) ) - { - e_scale_fx = 0; - move16(); - scale_fx = 0; - move16(); - } - ELSE - { - e_scale_fx = 0; - move16(); - scale_fx = BASOP_Util_Divide3232_Scale( curr_pow_fx, prev_pow_fx, &e_scale_fx ); - scale_fx = Sqrt16( scale_fx, &e_scale_fx ); - } - IF( LT_16( e_scale_fx, 0 ) ) - { - scale_fx = shl( scale_fx, e_scale_fx ); - e_scale_fx = 0; - move16(); - } - FOR( i = 0; i < L_SHB_LAHEAD; i++ ) - { - shb_synth_nonref_fx[i] = Mpy_32_16_1( shb_synth_nonref_fx[i], scale_fx ); - move32(); - } - tmp = 3276; - move16(); - FOR( ; i < L_SHB_LAHEAD + 10; i++ ) - { - IF( EQ_16( e_scale_fx, 0 ) ) - { - temp1_fx = 32767; - move16(); - } - ELSE - { - temp1_fx = shl( 1, sub( 15, e_scale_fx ) ); - move16(); - } - L_tmp = L_mult0( tmp, temp1_fx ); - L_tmp = L_mac0( L_tmp, sub( 32767, tmp ), scale_fx ); - shb_synth_nonref_fx[i] = Mpy_32_16_1( shb_synth_nonref_fx[i], shl( round_fx( L_tmp ), 1 ) ); - move32(); - IF( LT_16( tmp, 29492 ) ) - { - tmp = add( tmp, 3276 ); - } - } - - /* spec and gs adjustment */ - Q_syn_shb = sub( Q_syn_shb, e_scale_fx ); - Scale_sig32( shb_synth_nonref_fx + L_SHB_LAHEAD + 10, L_FRAME16k - 10, -e_scale_fx ); - - tmp = 31; - move16(); - tmp = FindScale( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, Q_syn_shb, tmp ); - temp1_fx = norm_l( hStereoICBWE->memShbSpecMapping_fx ); - IF( EQ_32( hStereoICBWE->memShbSpecMapping_fx, 0 ) ) - { - temp1_fx = 31; - move16(); - } - temp1_fx = add( temp1_fx, hStereoICBWE->prev_Q_memshbspec ); - tmp = s_min( temp1_fx, tmp ); - - tmp = sub( tmp, 9 ); - - Scale_sig32( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, tmp - Q_syn_shb ); - hStereoICBWE->memShbSpecMapping_fx = L_shl( hStereoICBWE->memShbSpecMapping_fx, tmp - hStereoICBWE->prev_Q_memshbspec ); - - hStereoICBWE->prev_Q_memshbspec = tmp; - move16(); - Q_syn_shb = tmp; - move16(); - - deemph_fx_32( 0, shb_synth_nonref_fx + L_SHB_LAHEAD, specMapping_fx, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping_fx ) ); - hStereoICBWE->prev_Q_memshbspec = Q_syn_shb; - move16(); - Copy32( shb_synth_nonref_fx + L_FRAME16k, hStereoICBWE->mem_syn_shb_nonref_fx, L_SHB_LAHEAD ); - hStereoICBWE->prev_Q_syn_shb_nonref = Q_syn_shb; - move16(); - - tmp = 31; - move16(); - tmp = FindScale( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, Q_syn_shb, tmp ); - tmp = FindScale( hStereoICBWE->mem_syn_shb_ola_nonref_fx, L_SHB_LAHEAD, hStereoICBWE->prev_Q_syn_shb_ola_nonref, tmp ); - - tmp = sub( tmp, 3 ); - - Scale_sig32( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, tmp - Q_syn_shb ); - Scale_sig32( hStereoICBWE->mem_syn_shb_ola_nonref_fx, L_SHB_LAHEAD, tmp - hStereoICBWE->prev_Q_syn_shb_ola_nonref ); - - ScaleShapedSHB_32( SHB_OVERLAP_LEN, shb_synth_nonref_fx, hStereoICBWE->mem_syn_shb_ola_nonref_fx, hStereoICBWE->gshapeRef_fx, ( Mpy_32_16_1( L_shl( hStereoICBWE->gFrameRef_fx, 1 ), mult_r( gsMapping_fx, 29492 ) ) ), window_shb_fx, subwin_shb_fx, &tmp, &temp1_fx ); - - hStereoICBWE->prev_Q_syn_shb_ola_nonref = tmp; - move16(); - Q_syn_shb = tmp; - move16(); - - IF( EQ_16( st->extl, FB_TBE ) ) - { - v_multc_fixed_16_16( fb_synth_ref_fx, gsMapping_fx, fb_synth_nonref_fx, L_FRAME48k ); - } - - /* generate 32kHz SHB synthesis from 12.8(16)kHz signal */ - - tmp = 31; - move16(); - tmp = FindScale( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, Q_syn_shb, tmp ); - tmp = FindScale( hStereoICBWE->memShbHilbert_nonref_fx, HILBERT_MEM_SIZE, hStereoICBWE->prev_Q_hilb, tmp ); - tmp = FindScale( hStereoICBWE->memShbInterp_nonref_fx, 2 * ALLPASSSECTIONS_STEEP + 1, hStereoICBWE->prev_Q_interp, tmp ); - - tmp = sub( tmp, 3 ); - - Scale_sig32( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, sub( tmp, Q_syn_shb ) ); - Scale_sig32( hStereoICBWE->memShbHilbert_nonref_fx, HILBERT_MEM_SIZE, sub( tmp, hStereoICBWE->prev_Q_hilb ) ); - Scale_sig32( hStereoICBWE->memShbInterp_nonref_fx, 2 * ALLPASSSECTIONS_STEEP + 1, sub( tmp, hStereoICBWE->prev_Q_interp ) ); - - hStereoICBWE->prev_Q_hilb = tmp; - move16(); - hStereoICBWE->prev_Q_interp = tmp; - move16(); - - Q_syn_shb = tmp; - move16(); - - GenSHBSynth_fx_32( shb_synth_nonref_fx, error_fx, hStereoICBWE->memShbHilbert_nonref_fx, hStereoICBWE->memShbInterp_nonref_fx, st->L_frame, &( hStereoICBWE->syn_dm_phase_nonref ) ); - } - ELSE - { - Copy32( synthRef_fx, synth_fx, output_frame ); - - winLen_fx = extract_l( Mpy_32_16_1( st->output_Fs, 41 ) ); - winSlope_fx = div_s( 1, winLen_fx ); - alpha_fx = winSlope_fx; - move16(); - - - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) - { - ratio_L_fx = 16384; - move16(); - } - ELSE - { - ratio_L_fx = extract_h( tdm_ratio_tabl_fx[hCPE->hStereoTD->tdm_last_ratio_idx] ); - move16(); - } - - icbweM2Ref_fx = gsMapping_fx; - move16(); - IF( EQ_16( hStereoICBWE->refChanIndx_bwe, L_CH_INDX ) ) - { - - IF( GE_16( ratio_L_fx, 3276 ) ) - { - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 - IF( LT_16( tmp, 4096 ) ) - { - temp1_fx = 0; - move16(); - temp2_fx = 0; - move16(); - tmp = shl( tmp, 2 ); - icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); - icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, ratio_L_fx, &temp2_fx ); - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 - } - ELSE - { - icbweM2Ref_fx = 0; - move16(); - } - } - } - ELSE - { - IF( LE_16( ratio_L_fx, 29490 ) ) - { -#ifdef FIX_TMP_714 - tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 -#else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 -#endif - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 - IF( LT_16( tmp, 4096 ) ) - { - temp1_fx = 0; - move16(); - temp2_fx = 0; - move16(); - tmp = shl( tmp, 2 ); - icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); - icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, sub( 32767, ratio_L_fx ), &temp2_fx ); - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 - } - ELSE - { - icbweM2Ref_fx = 0; - move16(); - } - } - } - - icbweM2Ref_fx = s_max( gsMapping_fx, icbweM2Ref_fx ); - - FOR( i = 0; i < winLen_fx; i++ ) - { - L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); - L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), hStereoICBWE->icbweM2Ref_prev_fx ); - tmp = shl( round_fx( L_tmp ), 1 ); - synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], tmp ); - move32(); - L_tmp = L_mult0( alpha_fx, gsMapping_fx ); - L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), prevgsMapping_fx ); - tmp = shl( round_fx( L_tmp ), 1 ); - synth_fx[i] = Mpy_32_16_1( synth_fx[i], tmp ); - move32(); - IF( LE_16( alpha_fx, sub( 32767, winSlope_fx ) ) ) - { - alpha_fx = add( alpha_fx, winSlope_fx ); - } - } - FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) - { - synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], icbweM2Ref_fx ); - move32(); - synth_fx[i] = Mpy_32_16_1( synth_fx[i], gsMapping_fx ); - move32(); - } - hStereoICBWE->icbweM2Ref_prev_fx = icbweM2Ref_fx; - move16(); - - ic_bwe_dec_reset_fx( hStereoICBWE ); - hStereoICBWE->prevSpecMapping_fx = 0; - move16(); - - *Q_syn = sub( *Q_syn, 1 ); - - return; - } - - /* resample to output FS */ - - - IF( EQ_32( st->output_Fs, 48000 ) ) - { - tmp = 31; - move16(); - tmp = FindScale( error_fx, L_FRAME32k, Q_syn_shb, tmp ); - tmp = FindScale( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, hStereoICBWE->prev_Q_fsout, tmp ); - tmp = sub( tmp, 4 ); - - Scale_sig32( error_fx, L_FRAME32k, sub( tmp, Q_syn_shb ) ); - Scale_sig32( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, sub( tmp, hStereoICBWE->prev_Q_fsout ) ); - interpolate_3_over_2_allpass_32( error_fx, L_FRAME32k, synth_fx, hStereoICBWE->memShb_fsout_nonref_fx ); - hStereoICBWE->prev_Q_fsout = tmp; - move16(); - } - ELSE IF( EQ_32( st->output_Fs, 32000 ) ) - { - Copy32( error_fx, synth_fx, L_FRAME32k ); - } - ELSE IF( EQ_32( st->output_Fs, 16000 ) ) - { - tmp = 31; - move16(); - tmp = FindScale( error_fx, L_FRAME32k, Q_syn_shb, tmp ); - tmp = FindScale( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, hStereoICBWE->prev_Q_fsout, tmp ); - tmp = sub( tmp, 4 ); - - Scale_sig32( error_fx, L_FRAME32k, sub( tmp, Q_syn_shb ) ); - Scale_sig32( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, sub( tmp, hStereoICBWE->prev_Q_fsout ) ); - Decimate_allpass_steep_fx32( error_fx, hStereoICBWE->memShb_fsout_nonref_fx, L_FRAME32k, synth_fx ); - hStereoICBWE->prev_Q_fsout = tmp; - move16(); - } -#ifndef MSAN_FIX - Scale_sig32( synth_fx, L_FRAME48k, sub( *Q_syn, add( 1, tmp ) ) ); -#else - Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); -#endif - - *Q_syn = sub( *Q_syn, 1 ); - - test(); - IF( EQ_16( st->extl, FB_TBE ) && EQ_32( st->output_Fs, 48000 ) ) - { - - // v_add( fb_synth_nonref_fx, synth_fx, synth_fx, L_FRAME48k, 0 ); - FOR( i = 0; i < L_FRAME48k; i++ ) - { - synth_fx[i] = L_add( synth_fx[i], L_deposit_l( fb_synth_nonref_fx[i] ) ); - move32(); - } - } - - /* copy to outputHB and reset hb_synth values */ - - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) - { - ratio_L_fx = 16384; - move16(); - } - ELSE - { - ratio_L_fx = extract_h( tdm_ratio_tabl_fx[hCPE->hStereoTD->tdm_last_ratio_idx] ); - move16(); - } - - icbweM2Ref_fx = gsMapping_fx; - move16(); - IF( EQ_16( hStereoICBWE->refChanIndx_bwe, L_CH_INDX ) ) - { - IF( GE_16( ratio_L_fx, 3276 ) ) - { - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 - IF( LT_16( tmp, 4096 ) ) - { - temp1_fx = 0; - move16(); - temp2_fx = 0; - move16(); - tmp = shl( tmp, 2 ); - icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); - icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, ratio_L_fx, &temp2_fx ); - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp1_fx, sub( temp2_fx, 1 ) ) ); // Q14 - } - ELSE - { - icbweM2Ref_fx = 0; - move16(); - } - } - } - ELSE - { - IF( LE_16( ratio_L_fx, 29490 ) ) - { -#ifdef FIX_TMP_714 - tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 -#else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 -#endif - tmp = mult_r( tmp, gsMapping_fx ); // Q14 - tmp = mult_r( tmp, gsMapping_fx ); // Q13 - IF( LT_16( tmp, 4096 ) ) - { - temp1_fx = 0; - move16(); - temp2_fx = 0; - move16(); - tmp = shl( tmp, 2 ); - icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); - icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, sub( 32767, ratio_L_fx ), &temp2_fx ); - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 - } - ELSE - { - icbweM2Ref_fx = 0; - move16(); - } - } - } - - icbweM2Ref_fx = s_max( gsMapping_fx, icbweM2Ref_fx ); - - winLen_fx = extract_l( Mpy_32_16_1( st->output_Fs, 41 ) ); - winSlope_fx = div_s( 1, winLen_fx ); - alpha_fx = winSlope_fx; - move16(); - FOR( i = 0; i < winLen_fx; i++ ) - { - L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); - L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), hStereoICBWE->icbweM2Ref_prev_fx ); - tmp = shl( round_fx( L_tmp ), 1 ); - synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], tmp ); - move32(); - IF( LE_16( alpha_fx, sub( 32767, winSlope_fx ) ) ) - { - alpha_fx = add( alpha_fx, winSlope_fx ); - } - } - - FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) - { - synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], icbweM2Ref_fx ); - move32(); - } - - hStereoICBWE->icbweM2Ref_prev_fx = icbweM2Ref_fx; - move16(); - - return; -} -#endif - -/*-------------------------------------------------------------------* - * stereo_icBWE_decproc() - * - * Stereo (inter-channel) BWE mapping - decoder initialization - *-------------------------------------------------------------------*/ - -#ifndef IVAS_FLOAT_FIXED -void stereo_icBWE_decproc( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float *output[CPE_CHANNELS], /* i/o: output synthesis */ - float outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ - const int16_t last_core, /* i : last core, primary channel */ - const int16_t last_bwidth, /* i : last bandwidth */ - const int16_t output_frame /* i : frame length */ -) -{ - int16_t i, j, n, decoderDelay, icbweOLASize, dftOvlLen; - int16_t core, memOffset, refChanIndx_bwe; - float temp0[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )], temp1[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; - float winSlope, alpha; - const float *win_dft; - int32_t extl_brate, output_Fs; - - STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; - - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of SID or NO_DATA frame - * -------------------------------------------------------------------*/ - - if ( ( hCPE->element_mode == IVAS_CPE_TD || hCPE->element_mode == IVAS_CPE_DFT ) && hCPE->nchan_out == 2 /*&& hCPE->hCoreCoder[0]->core_brate > SID_2k40*/ && hCPE->hCoreCoder[0]->last_core_brate <= SID_2k40 ) - { - stereo_icBWE_init_dec( hCPE->hStereoICBWE ); - } - - if ( hCPE->hCoreCoder[0]->core_brate <= SID_2k40 ) - { - return; - } - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of mono DMX output * - * -------------------------------------------------------------------*/ - - if ( hCPE->nchan_out == 1 && hCPE->element_mode == IVAS_CPE_DFT ) - { - add_HB_to_mono_dmx( hCPE, output[0], outputHB[0], last_core, output_frame ); - - return; - } - else if ( hCPE->nchan_out == 1 && hCPE->element_mode != IVAS_CPE_TD ) - { - return; - } - - /*--------------------------------------------------------------------* - * IC-BWE processing - * -------------------------------------------------------------------*/ - - core = hCPE->hCoreCoder[0]->core; - extl_brate = hCPE->hCoreCoder[0]->extl_brate; - output_Fs = hCPE->hCoreCoder[0]->output_Fs; - - memOffset = NS2SA( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); - - /* LRTD stereo mode - 2xBWEs used */ - if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) - { - /* delay HB synth */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - mvr2r( outputHB[n] + output_frame - memOffset, temp0, memOffset ); - mvr2r( outputHB[n], outputHB[n] + memOffset, output_frame - memOffset ); - mvr2r( hCPE->prev_hb_synth[n], outputHB[n], memOffset ); - mvr2r( temp0, hCPE->prev_hb_synth[n], memOffset ); - } - - if ( hCPE->nchan_out == 1 ) - { - /* stereo to mono downmix */ - for ( i = 0; i < output_frame; i++ ) - { - outputHB[0][i] = ( outputHB[0][i] + outputHB[1][i] ) * 0.5f; - } - v_add( output[0], outputHB[0], output[0], output_frame ); - } - else - { - /* Add the delayed hb_synth component to the delayed ACELP synthesis */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - v_add( output[n], outputHB[n], output[n], output_frame ); - } - } - } - else - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - set_f( hCPE->prev_hb_synth[n], 0, memOffset ); - } - } - - if ( hCPE->element_mode != IVAS_CPE_MDCT && !( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) ) - { - if ( hCPE->last_element_mode == IVAS_CPE_MDCT ) - { - set_f( hStereoICBWE->memOutHB[0], 0, memOffset ); - set_f( hStereoICBWE->memOutHB[1], 0, memOffset ); - - set_f( hStereoICBWE->memTransitionHB[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - set_f( hStereoICBWE->memTransitionHB[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - - if ( core == ACELP_CORE && extl_brate > 0 ) - { - refChanIndx_bwe = hStereoICBWE->refChanIndx_bwe; - - if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->hCoreCoder[0]->bwidth > WB && last_bwidth == WB && hCPE->hCoreCoder[0]->ini_frame > 1 /* counter wass already updated */ ) - { - /* fad-in reference HB signal */ - winSlope = ( memOffset > 0 ) ? ( 1.0f / memOffset ) : 0; - for ( i = 0; i < memOffset; i++ ) - { - outputHB[refChanIndx_bwe][i] *= ( i + 1 ) * winSlope; - } - } - /* Resampled LB and HB offset */ - mvr2r( outputHB[refChanIndx_bwe], temp0 + memOffset, output_frame - memOffset ); - mvr2r( outputHB[!refChanIndx_bwe], temp1 + memOffset, output_frame - memOffset ); - - decoderDelay = NS2SA( output_Fs, IVAS_DEC_DELAY_NS ); - - if ( last_core != ACELP_CORE && hCPE->element_mode == IVAS_CPE_DFT ) - { - /* hb_synth of mid band is faded out in the 1.25 ms prior to DFT analysis and the icbwe is faded in time domain */ - icbweOLASize = NS2SA( output_Fs, STEREO_DFT_DELAY_DEC_BWE_NS ); - - for ( i = 0; i < decoderDelay; i++ ) - { - temp0[i] = 0; - temp1[i] = 0; - } - - assert( icbweOLASize > 0 ); - winSlope = 1.0f / icbweOLASize; - alpha = winSlope; - for ( ; i < decoderDelay + icbweOLASize; i++ ) - { - temp0[i] *= alpha; - temp1[i] *= alpha; - alpha += winSlope; - } - } - else - { - if ( refChanIndx_bwe != hStereoICBWE->prev_refChanIndx_bwe ) - { - winSlope = ( memOffset > 0 ) ? ( 1.0f / memOffset ) : 0; - for ( i = 0; i < memOffset; i++ ) - { - temp0[i] = ( ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[refChanIndx_bwe][i] + - ( 1 - ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[hStereoICBWE->prev_refChanIndx_bwe][i]; - temp1[i] = ( ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[hStereoICBWE->prev_refChanIndx_bwe][i] + - ( 1 - ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[refChanIndx_bwe][i]; - } - } - else - { - mvr2r( hStereoICBWE->memOutHB[refChanIndx_bwe], temp0, memOffset ); - mvr2r( hStereoICBWE->memOutHB[!refChanIndx_bwe], temp1, memOffset ); - } - } - - if ( hCPE->nchan_out == 1 ) - { - /* stereo to mono downmix */ - for ( i = 0; i < output_frame; i++ ) - { - temp0[i] = ( temp0[i] + temp1[i] ) * 0.5f; - output[0][i] += temp0[i]; - } - } - else - { - - v_add( temp0, output[0], output[0], output_frame ); - v_add( temp1, output[1], output[1], output_frame ); - } - mvr2r( outputHB[0] + output_frame - memOffset, hStereoICBWE->memOutHB[0], memOffset ); - mvr2r( outputHB[1] + output_frame - memOffset, hStereoICBWE->memOutHB[1], memOffset ); - - if ( hCPE->element_mode == IVAS_CPE_DFT ) - { - win_dft = hCPE->hStereoDft->win32ms; - dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; - - /* Preparing buffers in anticipation of an ACELP to TCX switch */ - j = 0; - for ( i = 0; i < memOffset; i++ ) - { - hStereoICBWE->memTransitionHB[0][i] = hStereoICBWE->memOutHB[0][i] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; - hStereoICBWE->memTransitionHB[1][i] = hStereoICBWE->memOutHB[1][i] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; - j++; - } - - for ( i = 0; j < dftOvlLen; i++ ) - { - hStereoICBWE->memTransitionHB[0][memOffset + i] = outputHB[0][output_frame - i - 1] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; - hStereoICBWE->memTransitionHB[1][memOffset + i] = outputHB[1][output_frame - i - 1] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; - j++; - } - } - - hStereoICBWE->prev_refChanIndx_bwe = refChanIndx_bwe; - } - else - { - if ( last_core == ACELP_CORE ) - { - if ( hCPE->element_mode == IVAS_CPE_TD ) - { - v_add( output[0], hStereoICBWE->memOutHB[hStereoICBWE->prev_refChanIndx_bwe], output[0], memOffset ); - v_add( output[1], hStereoICBWE->memOutHB[!hStereoICBWE->prev_refChanIndx_bwe], output[1], memOffset ); - } - else - { - /* This is generated in the ACELP frame and windowed. This process is akin to GenTransition for IC-BWE */ - v_add( output[0], hStereoICBWE->memTransitionHB[hStereoICBWE->prev_refChanIndx_bwe], output[0], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - v_add( output[1], hStereoICBWE->memTransitionHB[!hStereoICBWE->prev_refChanIndx_bwe], output[1], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - - set_f( hStereoICBWE->memOutHB[0], 0, memOffset ); - set_f( hStereoICBWE->memOutHB[1], 0, memOffset ); - - set_f( hStereoICBWE->memTransitionHB[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - set_f( hStereoICBWE->memTransitionHB[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - } - } - else if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag && hStereoICBWE != NULL ) - { - stereo_icBWE_init_dec( hCPE->hStereoICBWE ); - } - else if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode == IVAS_CPE_DFT && last_core == ACELP_CORE ) - { - int16_t delay_tdbwe = NS2SA( output_Fs, DELAY_BWE_TOTAL_NS ); - - for ( n = 0; n < hCPE->nchan_out; n++ ) - { - for ( i = 0; i < delay_tdbwe; i++ ) - { - output[n][NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) - delay_tdbwe + i] += outputHB[0][i]; - } - } - /* reset BWE structs as they are only needed in the transition frame in MDCT Stereo */ - td_bwe_dec_init( hCPE->hCoreCoder[0]->hBWE_TD, -1, output_Fs ); - - fd_bwe_dec_init_flt( hCPE->hCoreCoder[0]->hBWE_FD ); - } - - if ( hCPE->element_mode == IVAS_CPE_DFT && ( max( hCPE->hStereoDft->td_gain[0], hCPE->hStereoDft->td_gain[1] ) > 0 ) ) - { - float win_in, win_out, tmp; - - win_dft = hCPE->hStereoDft->win32ms; - dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; - - for ( i = 0; i < dftOvlLen; i++ ) - { - win_in = win_dft[STEREO_DFT32MS_STEP * i] * win_dft[STEREO_DFT32MS_STEP * i]; - win_out = 1 - win_in; - tmp = ( win_in * hCPE->hStereoDft->td_gain[0] + win_out * hCPE->hStereoDft->td_gain[1] ) * hCPE->hStereoDft->hb_stefi_sig[i]; - - output[0][i] += tmp; - output[1][i] -= tmp; - } - for ( i = dftOvlLen; i < output_frame; i++ ) - { - tmp = hCPE->hStereoDft->td_gain[0] * hCPE->hStereoDft->hb_stefi_sig[i]; - output[0][i] += tmp; - output[1][i] -= tmp; - } - } - - return; -} -#else -void stereo_icBWE_decproc_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output[CPE_CHANNELS], /* i/o: output synthesis */ - Word32 outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ - const Word16 last_core, /* i : last core, primary channel */ - const Word16 last_bwidth, /* i : last bandwidth */ - const Word16 output_frame, /* i : frame length */ - Word16 q_output /* i : Q-fac of output */ -) -{ - Word16 i, j, n, decoderDelay, icbweOLASize, dftOvlLen; - Word16 core, memOffset, refChanIndx_bwe; - - Word32 temp0_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )], temp1_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; - Word32 winSlope_fx = 0, alpha_fx; - const Word16 *win_dft_fx; - Word32 extl_brate, output_Fs; - - STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of SID or NO_DATA frame - * -------------------------------------------------------------------*/ - - test(); - test(); - test(); - IF( ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) || EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) && EQ_16( hCPE->nchan_out, 2 ) /*&& hCPE->hCoreCoder[0]->core_brate > SID_2k40*/ && LE_32( hCPE->hCoreCoder[0]->last_core_brate, SID_2k40 ) ) - { - stereo_icBWE_init_dec_fx( hCPE->hStereoICBWE ); - } - - IF( LE_32( hCPE->hCoreCoder[0]->core_brate, SID_2k40 ) ) - { - return; - } - - /*--------------------------------------------------------------------* - * skip IC-BWE in case of mono DMX output * - * -------------------------------------------------------------------*/ - - test(); - test(); - IF( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) - { - add_HB_to_mono_dmx_fx( hCPE, output[0], outputHB[0], last_core, output_frame ); - return; - } - ELSE IF( EQ_16( hCPE->nchan_out, 1 ) && NE_16( hCPE->element_mode, IVAS_CPE_TD ) ) - { - return; - } - - /*--------------------------------------------------------------------* - * IC-BWE processing - * -------------------------------------------------------------------*/ - - core = hCPE->hCoreCoder[0]->core; - move16(); - extl_brate = hCPE->hCoreCoder[0]->extl_brate; - move32(); - output_Fs = hCPE->hCoreCoder[0]->output_Fs; - move32(); - - memOffset = NS2SA( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); - - /* LRTD stereo mode - 2xBWEs used */ - test(); - IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) - { - /* delay HB synth */ - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - Copy32( outputHB[n] + output_frame - memOffset, temp0_fx, memOffset ); - Copy32( outputHB[n], outputHB[n] + memOffset, output_frame - memOffset ); - Copy32( hCPE->prev_hb_synth_fx[n], outputHB[n], memOffset ); - Copy32( temp0_fx, hCPE->prev_hb_synth_fx[n], memOffset ); - } - - IF( EQ_16( hCPE->nchan_out, 1 ) ) - { - /* stereo to mono downmix */ - FOR( i = 0; i < output_frame; i++ ) - { - outputHB[0][i] = L_shr( ( outputHB[0][i] + outputHB[1][i] ), 1 ); - move32(); - } - v_add_32( output[0], outputHB[0], output[0], output_frame ); - } - ELSE - { - /* Add the delayed hb_synth component to the delayed ACELP synthesis */ - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - v_add_32( output[n], outputHB[n], output[n], output_frame ); - } - } - } - ELSE - { - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - set32_fx( hCPE->prev_hb_synth_fx[n], 0, memOffset ); - } - } - - test(); - test(); - test(); - test(); - test(); - test(); - IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) && !( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) ) - { - IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) ) - { - set32_fx( hStereoICBWE->memOutHB_fx[0], 0, memOffset ); - set32_fx( hStereoICBWE->memOutHB_fx[1], 0, memOffset ); - - set32_fx( hStereoICBWE->memTransitionHB_fx[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - set32_fx( hStereoICBWE->memTransitionHB_fx[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - - test(); - IF( EQ_16( core, ACELP_CORE ) && GT_32( extl_brate, 0 ) ) - { - refChanIndx_bwe = hStereoICBWE->refChanIndx_bwe; - move16(); - - test(); - test(); - test(); - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && GT_16( hCPE->hCoreCoder[0]->bwidth, WB ) && EQ_16( last_bwidth, WB ) && GT_16( hCPE->hCoreCoder[0]->ini_frame, 1 ) /* counter wass already updated */ ) - { - /* fad-in reference HB signal */ - IF( GT_16( memOffset, 0 ) ) - { - SWITCH( memOffset ) - { - case 15: - winSlope_fx = 71582792; - move32(); - BREAK; - case 30: - winSlope_fx = 35791396; - move32(); - BREAK; - case 45: - winSlope_fx = 23860930; - move32(); - BREAK; - } - // memOffset for 16K 32K 48K are 15 30 45 respectively.camera - } - ELSE - { - winSlope_fx = 0; - move32(); - } - FOR( i = 0; i < memOffset; i++ ) - { - Word32 mul_win = Mpy_32_16_1( winSlope_fx, ( i + 1 ) ); // Q30 + Q0 - 15 = Q15 - mul_win = L_shl( mul_win, 15 ); // Q30 - outputHB[refChanIndx_bwe][i] = L_shl( Mpy_32_32( outputHB[refChanIndx_bwe][i] /* Q11 + Q30 - 31 = Q10)*/, mul_win ), 1 ); // - move32(); - } - } - /* Resampled LB and HB offset */ - Copy32( outputHB[refChanIndx_bwe], temp0_fx + memOffset, output_frame - memOffset ); - Copy32( outputHB[!refChanIndx_bwe], temp1_fx + memOffset, output_frame - memOffset ); - - decoderDelay = NS2SA( output_Fs, IVAS_DEC_DELAY_NS ); - - test(); - IF( NE_16( last_core, ACELP_CORE ) && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) - { - /* hb_synth of mid band is faded out in the 1.25 ms prior to DFT analysis and the icbwe is faded in time domain */ - icbweOLASize = NS2SA( output_Fs, STEREO_DFT_DELAY_DEC_BWE_NS ); - - FOR( i = 0; i < decoderDelay; i++ ) - { - temp0_fx[i] = 0; - move32(); - temp1_fx[i] = 0; - move32(); - } - - assert( icbweOLASize > 0 ); - SWITCH( icbweOLASize ) - { - case 60: - winSlope_fx = 17895698; - move32(); - BREAK; - case 40: - winSlope_fx = 26843546; - move32(); - BREAK; - case 20: - winSlope_fx = 53687092; - move32(); - BREAK; - } - alpha_fx = winSlope_fx; // Q30 - move32(); - FOR( ; i < decoderDelay + icbweOLASize; i++ ) - { - temp0_fx[i] = L_shl_sat( Mpy_32_32( temp0_fx[i], alpha_fx ), 1 ); // Q11 - move32(); - temp1_fx[i] = L_shl_sat( Mpy_32_32( temp1_fx[i], alpha_fx ), 1 ); - move32(); - alpha_fx = L_add( alpha_fx, winSlope_fx ); - } - } - ELSE - { - IF( NE_16( refChanIndx_bwe, hStereoICBWE->prev_refChanIndx_bwe ) ) - { - IF( GT_16( memOffset, 0 ) ) - { - SWITCH( memOffset ) - { - case 15: - winSlope_fx = 71582792; - BREAK; - case 30: - winSlope_fx = 35791396; - BREAK; - case 45: - winSlope_fx = 23860930; // Q30 - BREAK; - } - // memOffset for 16K 32K 48K are 15 30 45 respectively.camera - } - ELSE - { - winSlope_fx = 0; - move32(); - } - FOR( i = 0; i < memOffset; i++ ) - { - temp0_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ), - L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, 1 - ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ) ); - move32(); - - temp1_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ), - L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( 1 - ( i + 1 ) ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ) ); - move32(); - } - } - ELSE - { - Copy32( hStereoICBWE->memOutHB_fx[refChanIndx_bwe], temp0_fx, memOffset ); - Copy32( hStereoICBWE->memOutHB_fx[!refChanIndx_bwe], temp1_fx, memOffset ); - } - } - - IF( EQ_16( hCPE->nchan_out, 1 ) ) - { - /* stereo to mono downmix */ - FOR( i = 0; i < output_frame; i++ ) - { - temp0_fx[i] = L_add( temp0_fx[i], temp1_fx[i] ); - move32(); - temp0_fx[i] = L_shr( temp0_fx[i], 1 ); - move32(); - output[0][i] = L_add( output[0][i], temp0_fx[i] ); - move32(); - } - } - ELSE - { - v_add_32( temp0_fx, output[0], output[0], output_frame ); - v_add_32( temp1_fx, output[1], output[1], output_frame ); - } - - Copy32( outputHB[0] + output_frame - memOffset, hStereoICBWE->memOutHB_fx[0], memOffset ); - Copy32( outputHB[1] + output_frame - memOffset, hStereoICBWE->memOutHB_fx[1], memOffset ); - - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) - { - /*win_dft = hCPE->hStereoDft->win32ms;*/ - win_dft_fx = hCPE->hStereoDft->win32ms_fx; - dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; - move16(); - - /* Preparing buffers in anticipation of an ACELP to TCX switch */ - j = 0; - move16(); - FOR( i = 0; i < memOffset; i++ ) - { - Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); - hStereoICBWE->memTransitionHB_fx[0][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[0][i], win_dft_fx[tmp_mul] ); - move32(); - hStereoICBWE->memTransitionHB_fx[1][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[1][i], win_dft_fx[tmp_mul] ); - move32(); - j++; - } - - FOR( i = 0; j < dftOvlLen; i++ ) - { - Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); - hStereoICBWE->memTransitionHB_fx[0][memOffset + i] = Mpy_32_16_1( outputHB[0][output_frame - i - 1], win_dft_fx[tmp_mul] ); - move32(); - hStereoICBWE->memTransitionHB_fx[1][memOffset + i] = Mpy_32_16_1( outputHB[1][output_frame - i - 1], win_dft_fx[tmp_mul] ); - move32(); - j++; - } - } - - hStereoICBWE->prev_refChanIndx_bwe = refChanIndx_bwe; - move16(); - } - ELSE - { - IF( EQ_16( last_core, ACELP_CORE ) ) - { - IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) - { - v_add_32( output[0], hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe], output[0], memOffset ); - v_add_32( output[1], hStereoICBWE->memOutHB_fx[!hStereoICBWE->prev_refChanIndx_bwe], output[1], memOffset ); - } - ELSE - { - /* This is generated in the ACELP frame and windowed. This process is akin to GenTransition for IC-BWE */ - v_add_32( output[0], hStereoICBWE->memTransitionHB_fx[hStereoICBWE->prev_refChanIndx_bwe], output[0], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - v_add_32( output[1], hStereoICBWE->memTransitionHB_fx[!hStereoICBWE->prev_refChanIndx_bwe], output[1], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - - set32_fx( hStereoICBWE->memOutHB_fx[0], 0, memOffset ); - set32_fx( hStereoICBWE->memOutHB_fx[1], 0, memOffset ); - - set32_fx( hStereoICBWE->memTransitionHB_fx[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - set32_fx( hStereoICBWE->memTransitionHB_fx[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - } - } - ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && hCPE->hCoreCoder[0]->tdm_LRTD_flag && hStereoICBWE != NULL ) - { - stereo_icBWE_init_dec_fx( hCPE->hStereoICBWE ); - } - ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && EQ_16( last_core, ACELP_CORE ) ) - { - Word16 delay_tdbwe = NS2SA( output_Fs, DELAY_BWE_TOTAL_NS ); - - FOR( n = 0; n < hCPE->nchan_out; n++ ) - { - FOR( i = 0; i < delay_tdbwe; i++ ) - { - output[n][NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) - delay_tdbwe + i] = L_add_sat( output[n][NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) - delay_tdbwe + i], outputHB[0][i] ); - move32(); - } - } - /* reset BWE structs as they are only needed in the transition frame in MDCT Stereo */ - td_bwe_dec_init_ivas_fx( hCPE->hCoreCoder[0], hCPE->hCoreCoder[0]->hBWE_TD, output_Fs ); - fd_bwe_dec_init( hCPE->hCoreCoder[0], hCPE->hCoreCoder[0]->hBWE_FD ); - } - - test(); - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && GT_32( L_max( hCPE->hStereoDft->td_gain_fx[0], hCPE->hStereoDft->td_gain_fx[1] ), 0 ) ) - { - Word32 win_in_fx, win_out_fx, tmp_fx, gain0_fx, gain1_fx; - - win_dft_fx = hCPE->hStereoDft->win32ms_fx; - dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; - move16(); - - //Scale_sig32(hCPE->hStereoDft->td_gain_fx, STEREO_DFT_CORE_HIST_MAX, -12); - - FOR( i = 0; i < dftOvlLen; i++ ) - { - win_in_fx = L_mult( win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )], win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )] ); /* Q31 */ - win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ - - gain0_fx = Mpy_32_32( win_in_fx, hCPE->hStereoDft->td_gain_fx[0] ); /* Q --> q_td_gain[0] */ -#ifdef FIX_736_BWE_SECT_C - gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ - gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ - gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ -#else - gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ - gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ - gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ -#endif - tmp_fx = L_add_sat( gain0_fx, gain1_fx ); /* Q --> q_output */ - - output[0][i] = L_add_sat( output[0][i], tmp_fx ); - move32(); - output[1][i] = L_sub_sat( output[1][i], tmp_fx ); - move32(); - } - FOR( i = dftOvlLen; i < output_frame; i++ ) - { -#ifdef FIX_736_BWE_SECT_C - tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ -#else - tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ -#endif - output[0][i] = L_add_sat( output[0][i], tmp_fx ); - move32(); - output[1][i] = L_sub_sat( output[1][i], tmp_fx ); - move32(); - } - } - - return; -} -#endif - -/*-------------------------------------------------------------------* - * stereo_icBWE_init_dec() - * - * Stereo (inter-channel) BWE mapping - decoder initialization - *-------------------------------------------------------------------*/ - -#ifndef IVAS_FLOAT_FIXED -void stereo_icBWE_init_dec( - STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ -) -{ - /* BWE ref channel */ - hStereoICBWE->refChanIndx_bwe = L_CH_INDX; - hStereoICBWE->prev_refChanIndx_bwe = L_CH_INDX; - - /* SHB output memory */ - set_f( hStereoICBWE->memOutHB[0], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); - set_f( hStereoICBWE->memOutHB[1], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); - - - /* SHB output memory */ - set_f( hStereoICBWE->memTransitionHB[0], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); - set_f( hStereoICBWE->memTransitionHB[1], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); - - /* inter-channel BWE spectral shape adj. */ - hStereoICBWE->prevSpecMapping = 0; - hStereoICBWE->prevgsMapping = 1.0f; - - hStereoICBWE->icbweM2Ref_prev = 1.0f; - - hStereoICBWE->prev_spIndx = 0; - hStereoICBWE->prev_gsIndx = 0; - - ic_bwe_dec_reset( hStereoICBWE ); - return; -} -#else -void stereo_icBWE_init_dec_fx( - STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ -) -{ - /* BWE ref channel */ - hStereoICBWE->refChanIndx_bwe = L_CH_INDX; - move16(); - hStereoICBWE->prev_refChanIndx_bwe = L_CH_INDX; - move16(); - - /* SHB output memory */ - set32_fx( hStereoICBWE->memOutHB_fx[0], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); - set32_fx( hStereoICBWE->memOutHB_fx[1], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); - - - /* SHB output memory */ - set32_fx( hStereoICBWE->memTransitionHB_fx[0], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); - set32_fx( hStereoICBWE->memTransitionHB_fx[1], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); - - /* inter-channel BWE spectral shape adj. */ - hStereoICBWE->prevSpecMapping_fx = 0; - move16(); - hStereoICBWE->prevgsMapping_fx = 16384; - move16(); - hStereoICBWE->icbweM2Ref_prev_fx = 16384; - move16(); - - hStereoICBWE->prev_spIndx = 0; - move16(); - hStereoICBWE->prev_gsIndx = 0; - move16(); - - ic_bwe_dec_reset_fx( hStereoICBWE ); - - return; -} +/****************************************************************************************************** + + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include +#include +#include "options.h" +#include +#include "cnst.h" +#include "ivas_cnst.h" +#include "prot.h" +#include "prot_fx1.h" +#include "prot_fx2.h" +#include "ivas_prot.h" +#include "ivas_prot_fx.h" +#include "wmc_auto.h" +#include "rom_com.h" +#include "ivas_rom_com.h" + + +#define Q_icBWE 16 + +/*-------------------------------------------------------------------* + * ic_bwe_dec_reset() + * + * core switching reset of IC BWE memory + *-------------------------------------------------------------------*/ + +#ifndef IVAS_FLOAT_FIXED +static void ic_bwe_dec_reset( + STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo ICBWE handle */ +) +{ + /* unscaled & scaled SHB synthesis memory */ + set_f( hStereoICBWE->mem_syn_shb_nonref, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ + set_f( hStereoICBWE->mem_lpc_shbsynth_nonref, 0, LPC_SHB_ORDER ); + set_f( hStereoICBWE->mem_syn_shb_ola_nonref, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ + + /* inter-channel BWE SP and GSP mem reset */ + hStereoICBWE->memShbSpecMapping = 0; + + set_f( hStereoICBWE->memShbHilbert_nonref, 0, HILBERT_MEM_SIZE ); + set_f( hStereoICBWE->memShbInterp_nonref, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); + set_f( hStereoICBWE->memShb_fsout_nonref, 0, INTERP_3_2_MEM_LEN ); + hStereoICBWE->syn_dm_phase_nonref = 0; + + return; +} +#else +static void ic_bwe_dec_reset_fx( + STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo ICBWE handle */ +) +{ + /* unscaled & scaled SHB synthesis memory */ + set32_fx( hStereoICBWE->mem_syn_shb_nonref_fx, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ + set32_fx( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, 0, LPC_SHB_ORDER ); + set32_fx( hStereoICBWE->mem_syn_shb_ola_nonref_fx, 0, L_SHB_LAHEAD ); /* use samples from !acelp) */ + + hStereoICBWE->prev_Q_syn_shb_nonref = 31; + move16(); + hStereoICBWE->prev_Q_lpc_shbsynth_nonref = 31; + move16(); + hStereoICBWE->prev_Q_syn_shb_ola_nonref = 31; + move16(); + + /* inter-channel BWE SP and GSP mem reset */ + hStereoICBWE->memShbSpecMapping_fx = 0; + move32(); + hStereoICBWE->prev_Q_memshbspec = 31; + move16(); + + set32_fx( hStereoICBWE->memShbHilbert_nonref_fx, 0, HILBERT_MEM_SIZE ); + set32_fx( hStereoICBWE->memShbInterp_nonref_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); + set32_fx( hStereoICBWE->memShb_fsout_nonref_fx, 0, INTERP_3_2_MEM_LEN ); + + hStereoICBWE->prev_Q_hilb = 31; + move16(); + hStereoICBWE->prev_Q_interp = 31; + move16(); + hStereoICBWE->prev_Q_fsout = 31; + move16(); + + hStereoICBWE->syn_dm_phase_nonref = 0; + move16(); + + return; +} +#endif + + +#ifndef IVAS_FLOAT_FIXED +/*-------------------------------------------------------------------* + * stereo_icBWE_dec() + * + * Spatial mapping of reference to the non-reference channels in SHB + *-------------------------------------------------------------------*/ + +void stereo_icBWE_dec( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + float *synthRef, /* i/o: Reference channel HB synthesis at output Fs */ + float *synth, /* o : Non reference channel HB synthesis at output Fs */ + const float *fb_synth_ref, /* i : ref. high-band synthesis 16-20 kHz */ + const float *voice_factors, /* i : voicing factors */ + const int16_t output_frame /* i : frame length */ +) +{ + int16_t i, j, k, nbSubFr; + Decoder_State *st; /* i/o: decoder state structure, primary channel */ + int16_t spIndx, gsIndx; + float excSHB_nonref[L_FRAME16k]; + float shb_synth_nonref[L_FRAME16k + L_SHB_LAHEAD]; + float error[L_FRAME32k]; + float nlMixFac[NB_SUBFR16k]; + float gsMapping, specMapping; + float fb_synth_nonref[L_FRAME48k]; + float scale, prev_pow, curr_pow, temp; + float alpha, winSlope, winLen, prevgsMapping; + float temp1, temp2; + float icbweM2Ref, ratio_L; + + STEREO_DFT_DEC_DATA_HANDLE hStereoDft = hCPE->hStereoDft; + STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; + st = hCPE->hCoreCoder[0]; + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of mono DMX output * + * -------------------------------------------------------------------*/ + + if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode > STEREO_DFT_RES_COD_OFF ) + { + hCPE->hStereoDft->core_hist[0] = st->core; + + return; + } + else if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 ) + { + + return; + } + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of SID or NO_DATA frame + * -------------------------------------------------------------------*/ + + if ( st->core_brate <= SID_2k40 ) + { + return; + } + + /*--------------------------------------------------------------------* + * TD high band stereo filling * + * -------------------------------------------------------------------*/ + + /* update buffers for TD stereo filling */ + if ( hCPE->element_mode == IVAS_CPE_DFT ) + { + float hb_nrg = EPSILON; + float hb_nrg2 = EPSILON; + + if ( st->core == ACELP_CORE || st->last_core == ACELP_CORE ) + { + for ( i = 0; i < output_frame / 2; i++ ) + { + hb_nrg2 += synthRef[i] * synthRef[i]; + } + + hCPE->hStereoDft->hb_nrg_subr[0] = hb_nrg2; + hb_nrg += hb_nrg2; + hb_nrg2 = EPSILON; + + for ( ; i < output_frame; i++ ) + { + hb_nrg2 += synthRef[i] * synthRef[i]; + } + + hCPE->hStereoDft->hb_nrg_subr[1] = hb_nrg2; + hb_nrg += hb_nrg2; + + mvr2r( synthRef, hCPE->hStereoDft->hb_stefi_sig + hCPE->hStereoDft->hb_stefi_delay, output_frame ); + } + else + { + set_zero( hCPE->hStereoDft->hb_stefi_sig + hCPE->hStereoDft->hb_stefi_delay, output_frame ); + } + hCPE->hStereoDft->hb_nrg_subr[0] *= hCPE->hStereoDft->NFFT / 2; + hCPE->hStereoDft->hb_nrg_subr[1] *= hCPE->hStereoDft->NFFT / 2; + hCPE->hStereoDft->hb_nrg[0] = hb_nrg; + hCPE->hStereoDft->td_gain[0] = 0; + hCPE->hStereoDft->core_hist[0] = st->core; + } + + /*--------------------------------------------------------------------* + * IC-BWE * + * -------------------------------------------------------------------*/ + + if ( st->core != ACELP_CORE || st->extl == -1 || ( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) ) + { + return; + } + else if ( hCPE->element_mode == IVAS_CPE_DFT && st->core_brate <= SID_2k40 ) + { + mvr2r( synthRef, synth, output_frame ); + return; + } + + + set_f( fb_synth_nonref, 0, L_FRAME48k ); + + /* core switching reset */ + if ( st->last_core != ACELP_CORE || st->bwidth == WB ) + { + ic_bwe_dec_reset( hStereoICBWE ); + + if ( st->last_core != ACELP_CORE ) + { + hStereoICBWE->prevSpecMapping = 0.0f; + hStereoICBWE->prevgsMapping = 1.0f; + hStereoICBWE->icbweM2Ref_prev = 1.0f; + } + + if ( st->bwidth == WB ) + { + /* copy to outputHB and reset hb_synth values */ + mvr2r( synthRef, synth, output_frame ); + + if ( st->element_mode == IVAS_CPE_TD ) + { + hStereoICBWE->prevSpecMapping = 0.0f; + hStereoICBWE->prevgsMapping = 1.0f; + hStereoICBWE->icbweM2Ref_prev = 1.0f; + } + else if ( st->element_mode == IVAS_CPE_DFT ) + { + hStereoICBWE->refChanIndx_bwe = L_CH_INDX; + hStereoICBWE->prevSpecMapping = 0.0f; + + prevgsMapping = hStereoICBWE->prevgsMapping; + temp1 = hStereoDft->side_gain[2 * STEREO_DFT_BAND_MAX + hStereoDft->nbands - 1]; + icbweM2Ref = 1.f + temp1; + gsMapping = 1.f - temp1; + + winLen = (int16_t) ( ( SHB_OVERLAP_LEN * st->output_Fs ) / 16000 ); + winSlope = 1.0f / winLen; + alpha = winSlope; + for ( i = 0; i < winLen; i++ ) + { + synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) ); + synth[i] *= ( alpha * ( gsMapping ) + ( 1.0f - alpha ) * ( prevgsMapping ) ); + alpha += winSlope; + } + for ( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) + { + synthRef[i] *= ( icbweM2Ref ); + synth[i] *= ( gsMapping ); + } + hStereoICBWE->icbweM2Ref_prev = icbweM2Ref; + hStereoICBWE->prevgsMapping = gsMapping; + } + + return; + } + } + + if ( !st->bfi ) + { + hStereoICBWE->refChanIndx_bwe = get_next_indice( st, STEREO_ICBWE_REFBITS ); + if ( st->flag_ACELP16k == 1 ) + { + spIndx = get_next_indice( st, STEREO_ICBWE_SPBITS ); + } + else + { + spIndx = 3; + } + if ( st->element_mode == IVAS_CPE_TD ) + { + gsIndx = get_next_indice( st, STEREO_ICBWE_GSBITS ); + } + else + { + gsIndx = get_next_indice( st, STEREO_ICBWE_GSBITS_DFT ); + } + + /* Store indices in case of frame loss */ + hStereoICBWE->prev_spIndx = spIndx; + hStereoICBWE->prev_gsIndx = gsIndx; + } + else /*bfi*/ + { + /* Retrieve last decoded indices */ + spIndx = hStereoICBWE->prev_spIndx; + gsIndx = hStereoICBWE->prev_gsIndx; + hStereoICBWE->refChanIndx_bwe = hStereoICBWE->prev_refChanIndx_bwe; + } + + /* IC-BWE parameter de-quant */ + /* sp Mapping */ + hStereoICBWE->prevSpecMapping = usdequant( spIndx, -0.6f, 0.2f ); + + /* gs Mapping */ + prevgsMapping = hStereoICBWE->prevgsMapping; + + if ( st->element_mode == IVAS_CPE_TD ) + { + hStereoICBWE->prevgsMapping = icbwe_gsMapping_tbl[gsIndx]; + } + else + { + hStereoICBWE->prevgsMapping = icbwe_gsMappingDFT_tbl[gsIndx]; + } + + hStereoICBWE->prevgsMapping = powf( 10, hStereoICBWE->prevgsMapping ); + + specMapping = hStereoICBWE->prevSpecMapping; + gsMapping = hStereoICBWE->prevgsMapping; + + if ( ( st->extl == SWB_TBE || st->extl == FB_TBE ) && st->flag_ACELP16k == 1 ) + { + mvr2r( voice_factors, nlMixFac, NB_SUBFR16k ); + if ( hCPE->hStereoDftDmx != NULL ) + { + if ( hCPE->hStereoDftDmx->targetGain < 0.5f || hCPE->hStereoDftDmx->targetGain > 2.0f ) + { + v_multc( voice_factors, 0.5f, nlMixFac, NB_SUBFR16k ); + } + } + else + { + if ( hCPE->hStereoTCA->targetGain < 0.5f || hCPE->hStereoTCA->targetGain > 2.0f ) + { + v_multc( voice_factors, 0.5f, nlMixFac, NB_SUBFR16k ); + } + } + + nbSubFr = ( st->flag_ACELP16k == 0 ) ? NB_SUBFR : NB_SUBFR16k; + for ( i = 0, k = 0; i < nbSubFr; i++ ) + { + if ( hCPE->hCoreCoder[0]->coder_type == UNVOICED || hStereoICBWE->MSFlag == 1 ) + { + temp1 = 0; + temp2 = 1.0f; + } + else + { + temp1 = sqrtf( nlMixFac[i] ); + temp2 = sqrtf( 1.0f - nlMixFac[i] ); + } + + for ( j = 0; j < L_FRAME16k / nbSubFr; j++, k++ ) + { + excSHB_nonref[k] = temp1 * hStereoICBWE->nlExc16k[k] + temp2 * hStereoICBWE->mixExc16k[k]; + } + } + + /* LP synthesis */ + mvr2r( hStereoICBWE->mem_syn_shb_nonref, shb_synth_nonref, L_SHB_LAHEAD ); + syn_filt( hStereoICBWE->lpSHBRef, LPC_SHB_ORDER, excSHB_nonref, shb_synth_nonref + L_SHB_LAHEAD, L_FRAME16k, hStereoICBWE->mem_lpc_shbsynth_nonref, 1 ); + + prev_pow = sum2_f( shb_synth_nonref, L_SHB_LAHEAD + 10 ); + curr_pow = sum2_f( shb_synth_nonref + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 ); + + if ( prev_pow == 0 ) + { + scale = 0; + } + else + { + scale = sqrtf( curr_pow / prev_pow ); + } + + for ( i = 0; i < L_SHB_LAHEAD; i++ ) + { + shb_synth_nonref[i] *= scale; + } + + for ( ; i < L_SHB_LAHEAD + 10; i++ ) + { + temp = ( i - 19 ) / 10.0f; + shb_synth_nonref[i] *= ( temp * 1.0f + ( 1.0f - temp ) * scale ); + } + /* spec and gs adjustment */ + deemph( shb_synth_nonref + L_SHB_LAHEAD, specMapping, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping ) ); + mvr2r( shb_synth_nonref + L_FRAME16k, hStereoICBWE->mem_syn_shb_nonref, L_SHB_LAHEAD ); + + ScaleShapedSHB( SHB_OVERLAP_LEN, shb_synth_nonref, hStereoICBWE->mem_syn_shb_ola_nonref, hStereoICBWE->gshapeRef, ( hStereoICBWE->gFrameRef * gsMapping * 0.9f ), window_shb, subwin_shb ); + + if ( st->extl == FB_TBE ) + { + v_multc( fb_synth_ref, gsMapping, fb_synth_nonref, L_FRAME48k ); + } + + /* generate 32kHz SHB synthesis from 12.8(16)kHz signal */ + GenSHBSynth( shb_synth_nonref, error, hStereoICBWE->memShbHilbert_nonref, hStereoICBWE->memShbInterp_nonref, st->L_frame, &( hStereoICBWE->syn_dm_phase_nonref ) ); + } + else + { + mvr2r( synthRef, synth, output_frame ); + + winLen = (int16_t) ( ( SHB_OVERLAP_LEN * st->output_Fs ) / 16000 ); + winSlope = 1.0f / winLen; + alpha = winSlope; + + ratio_L = ( hCPE->element_mode == IVAS_CPE_DFT ) ? ( 0.5f ) : ( tdm_ratio_tabl[hCPE->hStereoTD->tdm_last_ratio_idx] ); + + icbweM2Ref = gsMapping; + if ( hStereoICBWE->refChanIndx_bwe == L_CH_INDX ) + { + if ( ratio_L >= 0.1f ) + { + icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ( 1 - ratio_L ) * ( 1 - ratio_L ) * gsMapping * gsMapping ) ) / ratio_L; + } + } + else + { + if ( ratio_L <= 0.9f ) + { + icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ratio_L * ratio_L * gsMapping * gsMapping ) ) / ( 1 - ratio_L ); + } + } + + icbweM2Ref = max( gsMapping, icbweM2Ref ); + + for ( i = 0; i < winLen; i++ ) + { + synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) ); + synth[i] *= ( alpha * ( gsMapping ) + ( 1.0f - alpha ) * ( prevgsMapping ) ); + alpha += winSlope; + } + for ( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) + { + synthRef[i] *= ( icbweM2Ref ); + synth[i] *= ( gsMapping ); + } + hStereoICBWE->icbweM2Ref_prev = icbweM2Ref; + + ic_bwe_dec_reset( hStereoICBWE ); + hStereoICBWE->prevSpecMapping = 0.0f; + + return; + } + + /* resample to output FS */ + if ( st->output_Fs == 48000 ) + { + interpolate_3_over_2_allpass( error, L_FRAME32k, synth, hStereoICBWE->memShb_fsout_nonref ); + } + else if ( st->output_Fs == 32000 ) + { + mvr2r( error, synth, L_FRAME32k ); + } + else if ( st->output_Fs == 16000 ) + { + Decimate_allpass_steep( error, hStereoICBWE->memShb_fsout_nonref, L_FRAME32k, synth ); + } + + + if ( st->extl == FB_TBE && st->output_Fs == 48000 ) + { + v_add( fb_synth_nonref, synth, synth, L_FRAME48k ); + } + + /* copy to outputHB and reset hb_synth values */ + ratio_L = ( hCPE->element_mode == IVAS_CPE_DFT ) ? ( 0.5f ) : ( tdm_ratio_tabl[hCPE->hStereoTD->tdm_last_ratio_idx] ); + + icbweM2Ref = gsMapping; + if ( hStereoICBWE->refChanIndx_bwe == L_CH_INDX ) + { + if ( ratio_L >= 0.1f ) + { + icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ( 1 - ratio_L ) * ( 1 - ratio_L ) * gsMapping * gsMapping ) ) / ratio_L; + } + } + else + { + if ( ratio_L <= 0.9f ) + { + icbweM2Ref = sqrtf( 0.5f - min( 0.5f, ratio_L * ratio_L * gsMapping * gsMapping ) ) / ( 1 - ratio_L ); + } + } + + icbweM2Ref = max( gsMapping, icbweM2Ref ); + + winLen = (int16_t) ( ( SHB_OVERLAP_LEN * st->output_Fs ) / 16000 ); + winSlope = 1.0f / winLen; + alpha = winSlope; + for ( i = 0; i < winLen; i++ ) + { + synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) ); + alpha += winSlope; + } + + for ( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) + { + synthRef[i] *= ( icbweM2Ref ); + } + + hStereoICBWE->icbweM2Ref_prev = icbweM2Ref; + + return; +} +#else +static Word16 FindScale( + Word32 *buff, + Word16 len, + Word16 Q_buff, + Word16 Q_prev ) +{ + Word32 maxVal; + Word16 norm_shift, Q_out; + + maximum_abs_32_fx( buff, len, &maxVal ); + norm_shift = norm_l( maxVal ); + IF( EQ_32( maxVal, 0 ) ) + { + norm_shift = 31; + move16(); + } + + Q_out = s_min( Q_prev, add( Q_buff, norm_shift ) ); + + return Q_out; +} + + +void stereo_icBWE_dec_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *synthRef_fx, /* i/o: Reference channel HB synthesis at output Fs Q_syn/Q_syn - 1 */ + Word32 *synth_fx, /* o : Non reference channel HB synthesis at output Fs Q_syn/Q_syn - 1 */ + const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz Qx */ + const Word16 *voice_factors_fx, /* i : voicing factors Q15 */ + const Word16 output_frame, /* i : frame length */ + Word16 *Q_syn /* i : Q of synth and synthRef buffers */ +) +{ + Word16 i, j, k, nbSubFr; + Decoder_State *st; /* i/o: decoder state structure, primary channel */ + Word16 spIndx, gsIndx; + Word32 excSHB_nonref_fx[L_FRAME16k]; + Word32 shb_synth_nonref_fx[L_FRAME16k + L_SHB_LAHEAD]; + Word32 error_fx[L_FRAME32k]; + Word16 nlMixFac_fx[NB_SUBFR16k]; + Word16 specMapping_fx; + Word16 fb_synth_nonref_fx[L_FRAME48k]; + Word32 prev_pow_fx, curr_pow_fx, maxVal1, maxVal; + Word16 scale_fx, e_scale_fx; + Word16 alpha_fx, winSlope_fx, winLen_fx; + Word16 prevgsMapping_fx; + Word16 temp1_fx, temp2_fx; + Word16 icbweM2Ref_fx, ratio_L_fx; + Word16 gsMapping_fx; + Word32 hb_nrg_fx, hb_nrg2_fx; + Word16 Q_syn_shb; + Word16 shift_prev_pow, synthRef_shift; + Word32 L_tmp; + Word16 tmp; + Word32 L_nlExc16k, L_mixExc16k; + + STEREO_DFT_DEC_DATA_HANDLE hStereoDft = hCPE->hStereoDft; + STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; + st = hCPE->hCoreCoder[0]; + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of mono DMX output * + * -------------------------------------------------------------------*/ + + test(); + test(); + test(); + IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) && GT_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) + { + hCPE->hStereoDft->core_hist[0] = st->core; + move16(); + + return; + } + ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) ) + { + return; + } + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of SID or NO_DATA frame + * -------------------------------------------------------------------*/ + + IF( LE_32( st->core_brate, SID_2k40 ) ) + { + return; + } + + /*--------------------------------------------------------------------* + * TD high band stereo filling * + * -------------------------------------------------------------------*/ + + /* update buffers for TD stereo filling */ + IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) + { + hb_nrg_fx = 0; + move32(); + hb_nrg2_fx = 0; + move32(); + maximum_abs_32_fx( synthRef_fx, output_frame, &maxVal ); + synthRef_shift = norm_l( maxVal ); + IF( EQ_32( maxVal, 0 ) ) + { + synthRef_shift = 31; + move16(); + } + synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( output_frame ), 1 ), 1 ) ); + test(); + IF( EQ_16( st->core, ACELP_CORE ) || EQ_16( st->last_core, ACELP_CORE ) ) + { + FOR( i = 0; i < output_frame / 2; i++ ) + { + // needed to be adjusted for q + L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); + hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); // 2*(Qx + SynthRef_shift) - 31 + } + + hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg2_fx; + move32(); + hStereoDft->q_hb_nrg_subr = sub(add(*Q_syn, synthRef_shift), 31); + hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); + hb_nrg2_fx = 0; + move32(); + + FOR( ; i < output_frame; i++ ) + { + L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); + hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); + } + + hCPE->hStereoDft->hb_nrg_subr_fx[1] = hb_nrg2_fx; // 2*(Qx + SynthRef_shift) - 31 + move32(); + hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); + + Copy32( synthRef_fx, hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame ); + + Scale_sig32(hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame, -5); + } + ELSE + { + set32_fx( hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, 0, output_frame ); +#ifdef MSAN_FIX + hCPE->hStereoDft->hb_nrg_subr_fx[0] = 0; + hCPE->hStereoDft->hb_nrg_subr_fx[1] = 0; +#endif // MSAN_FIX + } + hCPE->hStereoDft->hb_nrg_subr_fx[0] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[0], shl( hCPE->hStereoDft->NFFT / 2, 6 ) ) ); // 2 * (Qx + SynthRef_shift) - 40 // 2 * (Qx + SynthRef_shift) - 31 - 15 + move32(); + hCPE->hStereoDft->hb_nrg_subr_fx[1] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[1], shl( hCPE->hStereoDft->NFFT / 2, 6 ) ) ); // 2 * (Qx + SynthRef_shift) - 40 + move32(); + hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 40 ); + hCPE->hStereoDft->hb_nrg_fx[0] = hb_nrg_fx; // 2 * (Qx + SynthRef_shift) - 31 + move32(); + hCPE->hStereoDft->td_gain_fx[0] = 0; + move32(); + hCPE->hStereoDft->core_hist[0] = st->core; + move16(); + } + + /*--------------------------------------------------------------------* + * IC-BWE * + * -------------------------------------------------------------------*/ + test(); + test(); + test(); + test(); + IF( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) + { + return; + } + ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && LE_32( st->core_brate, SID_2k40 ) ) + { + Copy32( synthRef_fx, synth_fx, output_frame ); + return; + } + + + set16_fx( fb_synth_nonref_fx, 0, L_FRAME48k ); + + /* core switching reset */ + test(); + IF( NE_16( st->last_core, ACELP_CORE ) || EQ_16( st->bwidth, (Word16) WB ) ) + { + ic_bwe_dec_reset_fx( hStereoICBWE ); + + IF( NE_16( st->last_core, ACELP_CORE ) ) + { + hStereoICBWE->prevSpecMapping_fx = 0; + move16(); + hStereoICBWE->prevgsMapping_fx = 16384; + move16(); + hStereoICBWE->icbweM2Ref_prev_fx = 16384; + move16(); + } + + IF( EQ_16( st->bwidth, WB ) ) + { + /* copy to outputHB and reset hb_synth values */ + Copy32( synthRef_fx, synth_fx, output_frame ); + + IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) + { + hStereoICBWE->prevSpecMapping_fx = 0; + move16(); + hStereoICBWE->prevgsMapping_fx = 16384; + move16(); + hStereoICBWE->icbweM2Ref_prev_fx = 16384; + move16(); + } + ELSE IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) + { + hStereoICBWE->refChanIndx_bwe = L_CH_INDX; + move16(); + hStereoICBWE->prevSpecMapping_fx = 0; + move16(); + + prevgsMapping_fx = hStereoICBWE->prevgsMapping_fx; + move16(); + temp1_fx = shr( extract_h( hStereoDft->side_gain_fx[2 * STEREO_DFT_BAND_MAX + hStereoDft->nbands - 1] ), 1 ); + icbweM2Ref_fx = add( 16384, temp1_fx ); + gsMapping_fx = sub( 16384, temp1_fx ); + + winLen_fx = extract_l( Mpy_32_16_1( st->output_Fs, 41 ) ); //(int16_t)((SHB_OVERLAP_LEN * st->output_Fs) / 16000); + winSlope_fx = div_s( 1, winLen_fx ); + alpha_fx = winSlope_fx; + move16(); + FOR( i = 0; i < winLen_fx; i++ ) + { + L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 + L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), ( hStereoICBWE->icbweM2Ref_prev_fx ) ); // Q15 + Q14; + tmp = shl( round_fx( L_tmp ), 1 ); // Q = 15 + 14 - 16 + 1 = Q14 + synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], tmp ); + move32(); + L_tmp = L_mult0( alpha_fx, gsMapping_fx ); + L_tmp = L_mac0( L_tmp, ( sub( 32767, alpha_fx ) ), ( prevgsMapping_fx ) ); + tmp = shl( round_fx( L_tmp ), 1 ); // Q = 15 + 14 - 16 + 1 = Q14 + synth_fx[i] = Mpy_32_16_1( synth_fx[i], tmp ); + move32(); + IF( LE_16( alpha_fx, sub( 32767, winSlope_fx ) ) ) + { + alpha_fx = add( alpha_fx, winSlope_fx ); + } + } + FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) + { + synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], icbweM2Ref_fx ); + move32(); + synth_fx[i] = Mpy_32_16_1( synth_fx[i], gsMapping_fx ); + move32(); + } + hStereoICBWE->icbweM2Ref_prev_fx = icbweM2Ref_fx; + move16(); + hStereoICBWE->prevgsMapping_fx = gsMapping_fx; + move16(); + + *Q_syn = sub( *Q_syn, 1 ); + } + + return; + } + } + + IF( EQ_16( st->bfi, 0 ) ) + { + hStereoICBWE->refChanIndx_bwe = get_next_indice_fx( st, STEREO_ICBWE_REFBITS ); + IF( EQ_16( st->flag_ACELP16k, 1 ) ) + { + spIndx = get_next_indice_fx( st, STEREO_ICBWE_SPBITS ); + } + ELSE + { + spIndx = 3; + move16(); + } + IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) + { + gsIndx = get_next_indice_fx( st, STEREO_ICBWE_GSBITS ); + } + ELSE + { + gsIndx = get_next_indice_fx( st, STEREO_ICBWE_GSBITS_DFT ); + } + + /* Store indices in case of frame loss */ + hStereoICBWE->prev_spIndx = spIndx; + move16(); + hStereoICBWE->prev_gsIndx = gsIndx; + move16(); + } + ELSE /*bfi*/ + { + /* Retrieve last decoded indices */ + spIndx = hStereoICBWE->prev_spIndx; + move16(); + gsIndx = hStereoICBWE->prev_gsIndx; + move16(); + hStereoICBWE->refChanIndx_bwe = hStereoICBWE->prev_refChanIndx_bwe; + move16(); + } + + /* IC-BWE parameter de-quant */ + /* sp Mapping */ + hStereoICBWE->prevSpecMapping_fx = usdequant_fx( spIndx, -19661, 3277 ); // Q15 + + /* gs Mapping */ + prevgsMapping_fx = hStereoICBWE->prevgsMapping_fx; // Q14 + move16(); + + IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) + { + hStereoICBWE->prevgsMapping_fx = pow_10_icbwe_gsMapping_tbl_fx[gsIndx]; + move16(); + } + ELSE + { + hStereoICBWE->prevgsMapping_fx = pow_10_icbwe_gsMappingDFT_tbl_fx[gsIndx]; + move16(); + } + + // hStereoICBWE->prevgsMapping = powf( 10, hStereoICBWE->prevgsMapping ); + + specMapping_fx = hStereoICBWE->prevSpecMapping_fx; // Q15 + move16(); + gsMapping_fx = hStereoICBWE->prevgsMapping_fx; // Q14 + move16(); + + test(); + test(); + IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) + { + Copy( voice_factors_fx, nlMixFac_fx, NB_SUBFR16k ); // Q15 + IF( hCPE->hStereoDftDmx != NULL ) + { + test(); + IF( LT_32( hCPE->hStereoDftDmx->targetGain_fx, 268435456 ) || GT_32( hCPE->hStereoDftDmx->targetGain_fx, 1073741824 ) ) + { + v_multc_fixed_16_16( voice_factors_fx, 16384, nlMixFac_fx, NB_SUBFR16k ); + } + } + ELSE + { + test(); + IF( LT_32( hCPE->hStereoTCA->targetGain_fx, 268435456 ) || GT_32( hCPE->hStereoTCA->targetGain_fx, 1073741824 ) ) + { + v_multc_fixed_16_16( voice_factors_fx, 16384, nlMixFac_fx, NB_SUBFR16k ); + } + } + + // nbSubFr = ( st->flag_ACELP16k == 0 ) ? NB_SUBFR : NB_SUBFR16k; + IF( EQ_16( st->flag_ACELP16k, 0 ) ) + { + nbSubFr = NB_SUBFR; + move16(); + } + ELSE + { + nbSubFr = NB_SUBFR16k; + move16(); + } + k = 0; + move16(); + FOR( i = 0; i < nbSubFr; i++ ) + { + IF( EQ_16( hCPE->hCoreCoder[0]->coder_type, UNVOICED ) || EQ_16( hStereoICBWE->MSFlag, 1 ) ) + { + temp1_fx = 0; + move16(); + temp2_fx = 32767; + move16(); + } + ELSE + { + tmp = 0; + move16(); + temp1_fx = Sqrt16( nlMixFac_fx[i], &tmp ); + IF( LT_16( tmp, 0 ) ) + { + temp1_fx = shl( temp1_fx, tmp ); + } + tmp = 0; + move16(); + temp2_fx = Sqrt16( sub( 32767, nlMixFac_fx[i] ), &tmp ); + IF( LT_16( tmp, 0 ) ) + { + temp2_fx = shl( temp2_fx, tmp ); + } + } + + FOR( j = 0; j < L_FRAME16k / nbSubFr; j++ ) + { + // common Q for addition + L_nlExc16k = L_deposit_l( hStereoICBWE->nlExc16k_fx[k] ); // prev_q_bwe_exc - 16 + L_mixExc16k = L_deposit_l( hStereoICBWE->mixExc16k_fx[k] ); // Q_exc + L_nlExc16k = L_shl( L_nlExc16k, Q_icBWE - ( st->prev_Q_bwe_exc - 16 ) ); // Q_icBWE +#ifndef FIX_736_BWE_SECT_C + L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - st->Q_exc ); // Q_icBWE +#else + L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - ( st->prev_Q_bwe_exc - 25 ) ); // Q_icBWE +#endif + excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q_icBWE + move32(); + k++; + } + } + + /* LP synthesis */ + Q_syn_shb = 31; + move16(); + + Q_syn_shb = FindScale( hStereoICBWE->mem_syn_shb_nonref_fx, LPC_SHB_ORDER, hStereoICBWE->prev_Q_syn_shb_nonref, Q_syn_shb ); + Q_syn_shb = FindScale( hStereoICBWE->lpSHBRef_fx, LPC_SHB_ORDER + 1, 12, Q_syn_shb ); + Q_syn_shb = FindScale( excSHB_nonref_fx, L_FRAME16k, Q_icBWE, Q_syn_shb ); + Q_syn_shb = FindScale( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, hStereoICBWE->prev_Q_lpc_shbsynth_nonref, Q_syn_shb ); + + Q_syn_shb = sub( Q_syn_shb, 3 ); // gaurded bits + + Scale_sig32( hStereoICBWE->lpSHBRef_fx, LPC_SHB_ORDER + 1, sub( Q_syn_shb, 12 ) ); + Scale_sig32( excSHB_nonref_fx, L_FRAME16k, sub( Q_syn_shb, Q_icBWE ) ); + Scale_sig32( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, sub( Q_syn_shb, hStereoICBWE->prev_Q_lpc_shbsynth_nonref ) ); + Scale_sig32( hStereoICBWE->mem_syn_shb_nonref_fx, L_SHB_LAHEAD, sub( Q_syn_shb, hStereoICBWE->prev_Q_syn_shb_nonref ) ); + + + Copy32( hStereoICBWE->mem_syn_shb_nonref_fx, shb_synth_nonref_fx, L_SHB_LAHEAD ); + + E_UTIL_synthesis_fx( 0, hStereoICBWE->lpSHBRef_fx, excSHB_nonref_fx, shb_synth_nonref_fx + L_SHB_LAHEAD, L_FRAME16k, hStereoICBWE->mem_lpc_shbsynth_nonref_fx, 1, LPC_SHB_ORDER ); + + hStereoICBWE->prev_Q_lpc_shbsynth_nonref = Q_syn_shb; + move16(); + + maximum_abs_32_fx( shb_synth_nonref_fx, L_SHB_LAHEAD + 10 + L_SHB_LAHEAD + 10, &maxVal1 ); // Qsyn_shb + + shift_prev_pow = sub( norm_l( maxVal1 ), find_guarded_bits_fx( L_SHB_LAHEAD + 10 ) ); + + prev_pow_fx = 0; + move32(); + curr_pow_fx = 0; + move32(); + FOR( i = 0; i < L_SHB_LAHEAD + 10; i++ ) + { + L_tmp = L_shl( shb_synth_nonref_fx[i], shift_prev_pow ); + prev_pow_fx = L_add( prev_pow_fx, Mpy_32_32( L_tmp, L_tmp ) ); + } + FOR( i = 0; i < L_SHB_LAHEAD + 10; i++ ) + { + L_tmp = L_shl( shb_synth_nonref_fx[L_SHB_LAHEAD + 10 + i], shift_prev_pow ); + curr_pow_fx = L_add( curr_pow_fx, Mpy_32_32( L_tmp, L_tmp ) ); + } + + IF( EQ_32( prev_pow_fx, 0 ) ) + { + e_scale_fx = 0; + move16(); + scale_fx = 0; + move16(); + } + ELSE + { + e_scale_fx = 0; + move16(); + scale_fx = BASOP_Util_Divide3232_Scale( curr_pow_fx, prev_pow_fx, &e_scale_fx ); + scale_fx = Sqrt16( scale_fx, &e_scale_fx ); + } + IF( LT_16( e_scale_fx, 0 ) ) + { + scale_fx = shl( scale_fx, e_scale_fx ); + e_scale_fx = 0; + move16(); + } + FOR( i = 0; i < L_SHB_LAHEAD; i++ ) + { + shb_synth_nonref_fx[i] = Mpy_32_16_1( shb_synth_nonref_fx[i], scale_fx ); + move32(); + } + tmp = 3276; + move16(); + FOR( ; i < L_SHB_LAHEAD + 10; i++ ) + { + IF( EQ_16( e_scale_fx, 0 ) ) + { + temp1_fx = 32767; + move16(); + } + ELSE + { + temp1_fx = shl( 1, sub( 15, e_scale_fx ) ); + move16(); + } + L_tmp = L_mult0( tmp, temp1_fx ); + L_tmp = L_mac0( L_tmp, sub( 32767, tmp ), scale_fx ); + shb_synth_nonref_fx[i] = Mpy_32_16_1( shb_synth_nonref_fx[i], shl( round_fx( L_tmp ), 1 ) ); + move32(); + IF( LT_16( tmp, 29492 ) ) + { + tmp = add( tmp, 3276 ); + } + } + + /* spec and gs adjustment */ + Q_syn_shb = sub( Q_syn_shb, e_scale_fx ); + Scale_sig32( shb_synth_nonref_fx + L_SHB_LAHEAD + 10, L_FRAME16k - 10, -e_scale_fx ); + + tmp = 31; + move16(); + tmp = FindScale( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, Q_syn_shb, tmp ); + temp1_fx = norm_l( hStereoICBWE->memShbSpecMapping_fx ); + IF( EQ_32( hStereoICBWE->memShbSpecMapping_fx, 0 ) ) + { + temp1_fx = 31; + move16(); + } + temp1_fx = add( temp1_fx, hStereoICBWE->prev_Q_memshbspec ); + tmp = s_min( temp1_fx, tmp ); + + tmp = sub( tmp, 9 ); + + Scale_sig32( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, tmp - Q_syn_shb ); + hStereoICBWE->memShbSpecMapping_fx = L_shl( hStereoICBWE->memShbSpecMapping_fx, tmp - hStereoICBWE->prev_Q_memshbspec ); + + hStereoICBWE->prev_Q_memshbspec = tmp; + move16(); + Q_syn_shb = tmp; + move16(); + + deemph_fx_32( 0, shb_synth_nonref_fx + L_SHB_LAHEAD, specMapping_fx, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping_fx ) ); + hStereoICBWE->prev_Q_memshbspec = Q_syn_shb; + move16(); + Copy32( shb_synth_nonref_fx + L_FRAME16k, hStereoICBWE->mem_syn_shb_nonref_fx, L_SHB_LAHEAD ); + hStereoICBWE->prev_Q_syn_shb_nonref = Q_syn_shb; + move16(); + + tmp = 31; + move16(); + tmp = FindScale( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, Q_syn_shb, tmp ); + tmp = FindScale( hStereoICBWE->mem_syn_shb_ola_nonref_fx, L_SHB_LAHEAD, hStereoICBWE->prev_Q_syn_shb_ola_nonref, tmp ); + + tmp = sub( tmp, 3 ); + + Scale_sig32( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, tmp - Q_syn_shb ); + Scale_sig32( hStereoICBWE->mem_syn_shb_ola_nonref_fx, L_SHB_LAHEAD, tmp - hStereoICBWE->prev_Q_syn_shb_ola_nonref ); + + ScaleShapedSHB_32( SHB_OVERLAP_LEN, shb_synth_nonref_fx, hStereoICBWE->mem_syn_shb_ola_nonref_fx, hStereoICBWE->gshapeRef_fx, ( Mpy_32_16_1( L_shl( hStereoICBWE->gFrameRef_fx, 1 ), mult_r( gsMapping_fx, 29492 ) ) ), window_shb_fx, subwin_shb_fx, &tmp, &temp1_fx ); + + hStereoICBWE->prev_Q_syn_shb_ola_nonref = tmp; + move16(); + Q_syn_shb = tmp; + move16(); + + IF( EQ_16( st->extl, FB_TBE ) ) + { + v_multc_fixed_16_16( fb_synth_ref_fx, gsMapping_fx, fb_synth_nonref_fx, L_FRAME48k ); + } + + /* generate 32kHz SHB synthesis from 12.8(16)kHz signal */ + + tmp = 31; + move16(); + tmp = FindScale( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, Q_syn_shb, tmp ); + tmp = FindScale( hStereoICBWE->memShbHilbert_nonref_fx, HILBERT_MEM_SIZE, hStereoICBWE->prev_Q_hilb, tmp ); + tmp = FindScale( hStereoICBWE->memShbInterp_nonref_fx, 2 * ALLPASSSECTIONS_STEEP + 1, hStereoICBWE->prev_Q_interp, tmp ); + + tmp = sub( tmp, 3 ); + + Scale_sig32( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, sub( tmp, Q_syn_shb ) ); + Scale_sig32( hStereoICBWE->memShbHilbert_nonref_fx, HILBERT_MEM_SIZE, sub( tmp, hStereoICBWE->prev_Q_hilb ) ); + Scale_sig32( hStereoICBWE->memShbInterp_nonref_fx, 2 * ALLPASSSECTIONS_STEEP + 1, sub( tmp, hStereoICBWE->prev_Q_interp ) ); + + hStereoICBWE->prev_Q_hilb = tmp; + move16(); + hStereoICBWE->prev_Q_interp = tmp; + move16(); + + Q_syn_shb = tmp; + move16(); + + GenSHBSynth_fx_32( shb_synth_nonref_fx, error_fx, hStereoICBWE->memShbHilbert_nonref_fx, hStereoICBWE->memShbInterp_nonref_fx, st->L_frame, &( hStereoICBWE->syn_dm_phase_nonref ) ); + } + ELSE + { + Copy32( synthRef_fx, synth_fx, output_frame ); + + winLen_fx = extract_l( Mpy_32_16_1( st->output_Fs, 41 ) ); + winSlope_fx = div_s( 1, winLen_fx ); + alpha_fx = winSlope_fx; + move16(); + + + IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) + { + ratio_L_fx = 16384; + move16(); + } + ELSE + { + ratio_L_fx = extract_h( tdm_ratio_tabl_fx[hCPE->hStereoTD->tdm_last_ratio_idx] ); + move16(); + } + + icbweM2Ref_fx = gsMapping_fx; + move16(); + IF( EQ_16( hStereoICBWE->refChanIndx_bwe, L_CH_INDX ) ) + { + + IF( GE_16( ratio_L_fx, 3276 ) ) + { + tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 + IF( LT_16( tmp, 4096 ) ) + { + temp1_fx = 0; + move16(); + temp2_fx = 0; + move16(); + tmp = shl( tmp, 2 ); + icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); + icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, ratio_L_fx, &temp2_fx ); + icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 + } + ELSE + { + icbweM2Ref_fx = 0; + move16(); + } + } + } + ELSE + { + IF( LE_16( ratio_L_fx, 29490 ) ) + { +#ifdef FIX_TMP_714 + tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 +#else + tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 +#endif + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 + IF( LT_16( tmp, 4096 ) ) + { + temp1_fx = 0; + move16(); + temp2_fx = 0; + move16(); + tmp = shl( tmp, 2 ); + icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); + icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, sub( 32767, ratio_L_fx ), &temp2_fx ); + icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 + } + ELSE + { + icbweM2Ref_fx = 0; + move16(); + } + } + } + + icbweM2Ref_fx = s_max( gsMapping_fx, icbweM2Ref_fx ); + + FOR( i = 0; i < winLen_fx; i++ ) + { + L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); + L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), hStereoICBWE->icbweM2Ref_prev_fx ); + tmp = shl( round_fx( L_tmp ), 1 ); + synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], tmp ); + move32(); + L_tmp = L_mult0( alpha_fx, gsMapping_fx ); + L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), prevgsMapping_fx ); + tmp = shl( round_fx( L_tmp ), 1 ); + synth_fx[i] = Mpy_32_16_1( synth_fx[i], tmp ); + move32(); + IF( LE_16( alpha_fx, sub( 32767, winSlope_fx ) ) ) + { + alpha_fx = add( alpha_fx, winSlope_fx ); + } + } + FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) + { + synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], icbweM2Ref_fx ); + move32(); + synth_fx[i] = Mpy_32_16_1( synth_fx[i], gsMapping_fx ); + move32(); + } + hStereoICBWE->icbweM2Ref_prev_fx = icbweM2Ref_fx; + move16(); + + ic_bwe_dec_reset_fx( hStereoICBWE ); + hStereoICBWE->prevSpecMapping_fx = 0; + move16(); + + *Q_syn = sub( *Q_syn, 1 ); + + return; + } + + /* resample to output FS */ + + + IF( EQ_32( st->output_Fs, 48000 ) ) + { + tmp = 31; + move16(); + tmp = FindScale( error_fx, L_FRAME32k, Q_syn_shb, tmp ); + tmp = FindScale( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, hStereoICBWE->prev_Q_fsout, tmp ); + tmp = sub( tmp, 4 ); + + Scale_sig32( error_fx, L_FRAME32k, sub( tmp, Q_syn_shb ) ); + Scale_sig32( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, sub( tmp, hStereoICBWE->prev_Q_fsout ) ); + interpolate_3_over_2_allpass_32( error_fx, L_FRAME32k, synth_fx, hStereoICBWE->memShb_fsout_nonref_fx ); + hStereoICBWE->prev_Q_fsout = tmp; + move16(); + } + ELSE IF( EQ_32( st->output_Fs, 32000 ) ) + { + Copy32( error_fx, synth_fx, L_FRAME32k ); + } + ELSE IF( EQ_32( st->output_Fs, 16000 ) ) + { + tmp = 31; + move16(); + tmp = FindScale( error_fx, L_FRAME32k, Q_syn_shb, tmp ); + tmp = FindScale( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, hStereoICBWE->prev_Q_fsout, tmp ); + tmp = sub( tmp, 4 ); + + Scale_sig32( error_fx, L_FRAME32k, sub( tmp, Q_syn_shb ) ); + Scale_sig32( hStereoICBWE->memShb_fsout_nonref_fx, INTERP_3_2_MEM_LEN, sub( tmp, hStereoICBWE->prev_Q_fsout ) ); + Decimate_allpass_steep_fx32( error_fx, hStereoICBWE->memShb_fsout_nonref_fx, L_FRAME32k, synth_fx ); + hStereoICBWE->prev_Q_fsout = tmp; + move16(); + } +#ifndef MSAN_FIX + Scale_sig32( synth_fx, L_FRAME48k, sub( *Q_syn, add( 1, tmp ) ) ); +#else + Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); +#endif + + *Q_syn = sub( *Q_syn, 1 ); + + test(); + IF( EQ_16( st->extl, FB_TBE ) && EQ_32( st->output_Fs, 48000 ) ) + { + + // v_add( fb_synth_nonref_fx, synth_fx, synth_fx, L_FRAME48k, 0 ); + FOR( i = 0; i < L_FRAME48k; i++ ) + { + synth_fx[i] = L_add( synth_fx[i], L_deposit_l( fb_synth_nonref_fx[i] ) ); + move32(); + } + } + + /* copy to outputHB and reset hb_synth values */ + + IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) + { + ratio_L_fx = 16384; + move16(); + } + ELSE + { + ratio_L_fx = extract_h( tdm_ratio_tabl_fx[hCPE->hStereoTD->tdm_last_ratio_idx] ); + move16(); + } + + icbweM2Ref_fx = gsMapping_fx; + move16(); + IF( EQ_16( hStereoICBWE->refChanIndx_bwe, L_CH_INDX ) ) + { + IF( GE_16( ratio_L_fx, 3276 ) ) + { + tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 + IF( LT_16( tmp, 4096 ) ) + { + temp1_fx = 0; + move16(); + temp2_fx = 0; + move16(); + tmp = shl( tmp, 2 ); + icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); + icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, ratio_L_fx, &temp2_fx ); + icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp1_fx, sub( temp2_fx, 1 ) ) ); // Q14 + } + ELSE + { + icbweM2Ref_fx = 0; + move16(); + } + } + } + ELSE + { + IF( LE_16( ratio_L_fx, 29490 ) ) + { +#ifdef FIX_TMP_714 + tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 +#else + tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 +#endif + tmp = mult_r( tmp, gsMapping_fx ); // Q14 + tmp = mult_r( tmp, gsMapping_fx ); // Q13 + IF( LT_16( tmp, 4096 ) ) + { + temp1_fx = 0; + move16(); + temp2_fx = 0; + move16(); + tmp = shl( tmp, 2 ); + icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); + icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, sub( 32767, ratio_L_fx ), &temp2_fx ); + icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 + } + ELSE + { + icbweM2Ref_fx = 0; + move16(); + } + } + } + + icbweM2Ref_fx = s_max( gsMapping_fx, icbweM2Ref_fx ); + + winLen_fx = extract_l( Mpy_32_16_1( st->output_Fs, 41 ) ); + winSlope_fx = div_s( 1, winLen_fx ); + alpha_fx = winSlope_fx; + move16(); + FOR( i = 0; i < winLen_fx; i++ ) + { + L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); + L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), hStereoICBWE->icbweM2Ref_prev_fx ); + tmp = shl( round_fx( L_tmp ), 1 ); + synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], tmp ); + move32(); + IF( LE_16( alpha_fx, sub( 32767, winSlope_fx ) ) ) + { + alpha_fx = add( alpha_fx, winSlope_fx ); + } + } + + FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) + { + synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], icbweM2Ref_fx ); + move32(); + } + + hStereoICBWE->icbweM2Ref_prev_fx = icbweM2Ref_fx; + move16(); + + return; +} +#endif + +/*-------------------------------------------------------------------* + * stereo_icBWE_decproc() + * + * Stereo (inter-channel) BWE mapping - decoder initialization + *-------------------------------------------------------------------*/ + +#ifndef IVAS_FLOAT_FIXED +void stereo_icBWE_decproc( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + float *output[CPE_CHANNELS], /* i/o: output synthesis */ + float outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ + const int16_t last_core, /* i : last core, primary channel */ + const int16_t last_bwidth, /* i : last bandwidth */ + const int16_t output_frame /* i : frame length */ +) +{ + int16_t i, j, n, decoderDelay, icbweOLASize, dftOvlLen; + int16_t core, memOffset, refChanIndx_bwe; + float temp0[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )], temp1[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; + float winSlope, alpha; + const float *win_dft; + int32_t extl_brate, output_Fs; + + STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; + + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of SID or NO_DATA frame + * -------------------------------------------------------------------*/ + + if ( ( hCPE->element_mode == IVAS_CPE_TD || hCPE->element_mode == IVAS_CPE_DFT ) && hCPE->nchan_out == 2 /*&& hCPE->hCoreCoder[0]->core_brate > SID_2k40*/ && hCPE->hCoreCoder[0]->last_core_brate <= SID_2k40 ) + { + stereo_icBWE_init_dec( hCPE->hStereoICBWE ); + } + + if ( hCPE->hCoreCoder[0]->core_brate <= SID_2k40 ) + { + return; + } + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of mono DMX output * + * -------------------------------------------------------------------*/ + + if ( hCPE->nchan_out == 1 && hCPE->element_mode == IVAS_CPE_DFT ) + { + add_HB_to_mono_dmx( hCPE, output[0], outputHB[0], last_core, output_frame ); + + return; + } + else if ( hCPE->nchan_out == 1 && hCPE->element_mode != IVAS_CPE_TD ) + { + return; + } + + /*--------------------------------------------------------------------* + * IC-BWE processing + * -------------------------------------------------------------------*/ + + core = hCPE->hCoreCoder[0]->core; + extl_brate = hCPE->hCoreCoder[0]->extl_brate; + output_Fs = hCPE->hCoreCoder[0]->output_Fs; + + memOffset = NS2SA( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); + + /* LRTD stereo mode - 2xBWEs used */ + if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) + { + /* delay HB synth */ + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + mvr2r( outputHB[n] + output_frame - memOffset, temp0, memOffset ); + mvr2r( outputHB[n], outputHB[n] + memOffset, output_frame - memOffset ); + mvr2r( hCPE->prev_hb_synth[n], outputHB[n], memOffset ); + mvr2r( temp0, hCPE->prev_hb_synth[n], memOffset ); + } + + if ( hCPE->nchan_out == 1 ) + { + /* stereo to mono downmix */ + for ( i = 0; i < output_frame; i++ ) + { + outputHB[0][i] = ( outputHB[0][i] + outputHB[1][i] ) * 0.5f; + } + v_add( output[0], outputHB[0], output[0], output_frame ); + } + else + { + /* Add the delayed hb_synth component to the delayed ACELP synthesis */ + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + v_add( output[n], outputHB[n], output[n], output_frame ); + } + } + } + else + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + set_f( hCPE->prev_hb_synth[n], 0, memOffset ); + } + } + + if ( hCPE->element_mode != IVAS_CPE_MDCT && !( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) ) + { + if ( hCPE->last_element_mode == IVAS_CPE_MDCT ) + { + set_f( hStereoICBWE->memOutHB[0], 0, memOffset ); + set_f( hStereoICBWE->memOutHB[1], 0, memOffset ); + + set_f( hStereoICBWE->memTransitionHB[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + set_f( hStereoICBWE->memTransitionHB[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + } + + if ( core == ACELP_CORE && extl_brate > 0 ) + { + refChanIndx_bwe = hStereoICBWE->refChanIndx_bwe; + + if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->hCoreCoder[0]->bwidth > WB && last_bwidth == WB && hCPE->hCoreCoder[0]->ini_frame > 1 /* counter wass already updated */ ) + { + /* fad-in reference HB signal */ + winSlope = ( memOffset > 0 ) ? ( 1.0f / memOffset ) : 0; + for ( i = 0; i < memOffset; i++ ) + { + outputHB[refChanIndx_bwe][i] *= ( i + 1 ) * winSlope; + } + } + /* Resampled LB and HB offset */ + mvr2r( outputHB[refChanIndx_bwe], temp0 + memOffset, output_frame - memOffset ); + mvr2r( outputHB[!refChanIndx_bwe], temp1 + memOffset, output_frame - memOffset ); + + decoderDelay = NS2SA( output_Fs, IVAS_DEC_DELAY_NS ); + + if ( last_core != ACELP_CORE && hCPE->element_mode == IVAS_CPE_DFT ) + { + /* hb_synth of mid band is faded out in the 1.25 ms prior to DFT analysis and the icbwe is faded in time domain */ + icbweOLASize = NS2SA( output_Fs, STEREO_DFT_DELAY_DEC_BWE_NS ); + + for ( i = 0; i < decoderDelay; i++ ) + { + temp0[i] = 0; + temp1[i] = 0; + } + + assert( icbweOLASize > 0 ); + winSlope = 1.0f / icbweOLASize; + alpha = winSlope; + for ( ; i < decoderDelay + icbweOLASize; i++ ) + { + temp0[i] *= alpha; + temp1[i] *= alpha; + alpha += winSlope; + } + } + else + { + if ( refChanIndx_bwe != hStereoICBWE->prev_refChanIndx_bwe ) + { + winSlope = ( memOffset > 0 ) ? ( 1.0f / memOffset ) : 0; + for ( i = 0; i < memOffset; i++ ) + { + temp0[i] = ( ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[refChanIndx_bwe][i] + + ( 1 - ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[hStereoICBWE->prev_refChanIndx_bwe][i]; + temp1[i] = ( ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[hStereoICBWE->prev_refChanIndx_bwe][i] + + ( 1 - ( i + 1 ) * winSlope ) * hStereoICBWE->memOutHB[refChanIndx_bwe][i]; + } + } + else + { + mvr2r( hStereoICBWE->memOutHB[refChanIndx_bwe], temp0, memOffset ); + mvr2r( hStereoICBWE->memOutHB[!refChanIndx_bwe], temp1, memOffset ); + } + } + + if ( hCPE->nchan_out == 1 ) + { + /* stereo to mono downmix */ + for ( i = 0; i < output_frame; i++ ) + { + temp0[i] = ( temp0[i] + temp1[i] ) * 0.5f; + output[0][i] += temp0[i]; + } + } + else + { + + v_add( temp0, output[0], output[0], output_frame ); + v_add( temp1, output[1], output[1], output_frame ); + } + mvr2r( outputHB[0] + output_frame - memOffset, hStereoICBWE->memOutHB[0], memOffset ); + mvr2r( outputHB[1] + output_frame - memOffset, hStereoICBWE->memOutHB[1], memOffset ); + + if ( hCPE->element_mode == IVAS_CPE_DFT ) + { + win_dft = hCPE->hStereoDft->win32ms; + dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; + + /* Preparing buffers in anticipation of an ACELP to TCX switch */ + j = 0; + for ( i = 0; i < memOffset; i++ ) + { + hStereoICBWE->memTransitionHB[0][i] = hStereoICBWE->memOutHB[0][i] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; + hStereoICBWE->memTransitionHB[1][i] = hStereoICBWE->memOutHB[1][i] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; + j++; + } + + for ( i = 0; j < dftOvlLen; i++ ) + { + hStereoICBWE->memTransitionHB[0][memOffset + i] = outputHB[0][output_frame - i - 1] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; + hStereoICBWE->memTransitionHB[1][memOffset + i] = outputHB[1][output_frame - i - 1] * win_dft[STEREO_DFT32MS_STEP * ( dftOvlLen - 1 - j )]; + j++; + } + } + + hStereoICBWE->prev_refChanIndx_bwe = refChanIndx_bwe; + } + else + { + if ( last_core == ACELP_CORE ) + { + if ( hCPE->element_mode == IVAS_CPE_TD ) + { + v_add( output[0], hStereoICBWE->memOutHB[hStereoICBWE->prev_refChanIndx_bwe], output[0], memOffset ); + v_add( output[1], hStereoICBWE->memOutHB[!hStereoICBWE->prev_refChanIndx_bwe], output[1], memOffset ); + } + else + { + /* This is generated in the ACELP frame and windowed. This process is akin to GenTransition for IC-BWE */ + v_add( output[0], hStereoICBWE->memTransitionHB[hStereoICBWE->prev_refChanIndx_bwe], output[0], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + v_add( output[1], hStereoICBWE->memTransitionHB[!hStereoICBWE->prev_refChanIndx_bwe], output[1], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + } + + set_f( hStereoICBWE->memOutHB[0], 0, memOffset ); + set_f( hStereoICBWE->memOutHB[1], 0, memOffset ); + + set_f( hStereoICBWE->memTransitionHB[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + set_f( hStereoICBWE->memTransitionHB[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + } + } + } + else if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->hCoreCoder[0]->tdm_LRTD_flag && hStereoICBWE != NULL ) + { + stereo_icBWE_init_dec( hCPE->hStereoICBWE ); + } + else if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode == IVAS_CPE_DFT && last_core == ACELP_CORE ) + { + int16_t delay_tdbwe = NS2SA( output_Fs, DELAY_BWE_TOTAL_NS ); + + for ( n = 0; n < hCPE->nchan_out; n++ ) + { + for ( i = 0; i < delay_tdbwe; i++ ) + { + output[n][NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) - delay_tdbwe + i] += outputHB[0][i]; + } + } + /* reset BWE structs as they are only needed in the transition frame in MDCT Stereo */ + td_bwe_dec_init( hCPE->hCoreCoder[0]->hBWE_TD, -1, output_Fs ); + + fd_bwe_dec_init_flt( hCPE->hCoreCoder[0]->hBWE_FD ); + } + + if ( hCPE->element_mode == IVAS_CPE_DFT && ( max( hCPE->hStereoDft->td_gain[0], hCPE->hStereoDft->td_gain[1] ) > 0 ) ) + { + float win_in, win_out, tmp; + + win_dft = hCPE->hStereoDft->win32ms; + dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; + + for ( i = 0; i < dftOvlLen; i++ ) + { + win_in = win_dft[STEREO_DFT32MS_STEP * i] * win_dft[STEREO_DFT32MS_STEP * i]; + win_out = 1 - win_in; + tmp = ( win_in * hCPE->hStereoDft->td_gain[0] + win_out * hCPE->hStereoDft->td_gain[1] ) * hCPE->hStereoDft->hb_stefi_sig[i]; + + output[0][i] += tmp; + output[1][i] -= tmp; + } + for ( i = dftOvlLen; i < output_frame; i++ ) + { + tmp = hCPE->hStereoDft->td_gain[0] * hCPE->hStereoDft->hb_stefi_sig[i]; + output[0][i] += tmp; + output[1][i] -= tmp; + } + } + + return; +} +#else +void stereo_icBWE_decproc_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output[CPE_CHANNELS], /* i/o: output synthesis */ + Word32 outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ + const Word16 last_core, /* i : last core, primary channel */ + const Word16 last_bwidth, /* i : last bandwidth */ + const Word16 output_frame, /* i : frame length */ + Word16 q_output /* i : Q-fac of output */ +) +{ + Word16 i, j, n, decoderDelay, icbweOLASize, dftOvlLen; + Word16 core, memOffset, refChanIndx_bwe; + + Word32 temp0_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )], temp1_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; + Word32 winSlope_fx = 0, alpha_fx; + const Word16 *win_dft_fx; + Word32 extl_brate, output_Fs; + + STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of SID or NO_DATA frame + * -------------------------------------------------------------------*/ + + test(); + test(); + test(); + IF( ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) || EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) && EQ_16( hCPE->nchan_out, 2 ) /*&& hCPE->hCoreCoder[0]->core_brate > SID_2k40*/ && LE_32( hCPE->hCoreCoder[0]->last_core_brate, SID_2k40 ) ) + { + stereo_icBWE_init_dec_fx( hCPE->hStereoICBWE ); + } + + IF( LE_32( hCPE->hCoreCoder[0]->core_brate, SID_2k40 ) ) + { + return; + } + + /*--------------------------------------------------------------------* + * skip IC-BWE in case of mono DMX output * + * -------------------------------------------------------------------*/ + + test(); + test(); + IF( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) + { + add_HB_to_mono_dmx_fx( hCPE, output[0], outputHB[0], last_core, output_frame ); + return; + } + ELSE IF( EQ_16( hCPE->nchan_out, 1 ) && NE_16( hCPE->element_mode, IVAS_CPE_TD ) ) + { + return; + } + + /*--------------------------------------------------------------------* + * IC-BWE processing + * -------------------------------------------------------------------*/ + + core = hCPE->hCoreCoder[0]->core; + move16(); + extl_brate = hCPE->hCoreCoder[0]->extl_brate; + move32(); + output_Fs = hCPE->hCoreCoder[0]->output_Fs; + move32(); + + memOffset = NS2SA( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); + + /* LRTD stereo mode - 2xBWEs used */ + test(); + IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) + { + /* delay HB synth */ + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + Copy32( outputHB[n] + output_frame - memOffset, temp0_fx, memOffset ); + Copy32( outputHB[n], outputHB[n] + memOffset, output_frame - memOffset ); + Copy32( hCPE->prev_hb_synth_fx[n], outputHB[n], memOffset ); + Copy32( temp0_fx, hCPE->prev_hb_synth_fx[n], memOffset ); + } + + IF( EQ_16( hCPE->nchan_out, 1 ) ) + { + /* stereo to mono downmix */ + FOR( i = 0; i < output_frame; i++ ) + { + outputHB[0][i] = L_shr( ( outputHB[0][i] + outputHB[1][i] ), 1 ); + move32(); + } + v_add_32( output[0], outputHB[0], output[0], output_frame ); + } + ELSE + { + /* Add the delayed hb_synth component to the delayed ACELP synthesis */ + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + v_add_32( output[n], outputHB[n], output[n], output_frame ); + } + } + } + ELSE + { + FOR( n = 0; n < CPE_CHANNELS; n++ ) + { + set32_fx( hCPE->prev_hb_synth_fx[n], 0, memOffset ); + } + } + + test(); + test(); + test(); + test(); + test(); + test(); + IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) && !( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && hCPE->hCoreCoder[0]->tdm_LRTD_flag ) ) + { + IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) ) + { + set32_fx( hStereoICBWE->memOutHB_fx[0], 0, memOffset ); + set32_fx( hStereoICBWE->memOutHB_fx[1], 0, memOffset ); + + set32_fx( hStereoICBWE->memTransitionHB_fx[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + set32_fx( hStereoICBWE->memTransitionHB_fx[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + } + + test(); + IF( EQ_16( core, ACELP_CORE ) && GT_32( extl_brate, 0 ) ) + { + refChanIndx_bwe = hStereoICBWE->refChanIndx_bwe; + move16(); + + test(); + test(); + test(); + IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && GT_16( hCPE->hCoreCoder[0]->bwidth, WB ) && EQ_16( last_bwidth, WB ) && GT_16( hCPE->hCoreCoder[0]->ini_frame, 1 ) /* counter wass already updated */ ) + { + /* fad-in reference HB signal */ + IF( GT_16( memOffset, 0 ) ) + { + SWITCH( memOffset ) + { + case 15: + winSlope_fx = 71582792; + move32(); + BREAK; + case 30: + winSlope_fx = 35791396; + move32(); + BREAK; + case 45: + winSlope_fx = 23860930; + move32(); + BREAK; + } + // memOffset for 16K 32K 48K are 15 30 45 respectively.camera + } + ELSE + { + winSlope_fx = 0; + move32(); + } + FOR( i = 0; i < memOffset; i++ ) + { + Word32 mul_win = Mpy_32_16_1( winSlope_fx, ( i + 1 ) ); // Q30 + Q0 - 15 = Q15 + mul_win = L_shl( mul_win, 15 ); // Q30 + outputHB[refChanIndx_bwe][i] = L_shl( Mpy_32_32( outputHB[refChanIndx_bwe][i] /* Q11 + Q30 - 31 = Q10)*/, mul_win ), 1 ); // + move32(); + } + } + /* Resampled LB and HB offset */ + Copy32( outputHB[refChanIndx_bwe], temp0_fx + memOffset, output_frame - memOffset ); + Copy32( outputHB[!refChanIndx_bwe], temp1_fx + memOffset, output_frame - memOffset ); + + decoderDelay = NS2SA( output_Fs, IVAS_DEC_DELAY_NS ); + + test(); + IF( NE_16( last_core, ACELP_CORE ) && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) + { + /* hb_synth of mid band is faded out in the 1.25 ms prior to DFT analysis and the icbwe is faded in time domain */ + icbweOLASize = NS2SA( output_Fs, STEREO_DFT_DELAY_DEC_BWE_NS ); + + FOR( i = 0; i < decoderDelay; i++ ) + { + temp0_fx[i] = 0; + move32(); + temp1_fx[i] = 0; + move32(); + } + + assert( icbweOLASize > 0 ); + SWITCH( icbweOLASize ) + { + case 60: + winSlope_fx = 17895698; + move32(); + BREAK; + case 40: + winSlope_fx = 26843546; + move32(); + BREAK; + case 20: + winSlope_fx = 53687092; + move32(); + BREAK; + } + alpha_fx = winSlope_fx; // Q30 + move32(); + FOR( ; i < decoderDelay + icbweOLASize; i++ ) + { + temp0_fx[i] = L_shl_sat( Mpy_32_32( temp0_fx[i], alpha_fx ), 1 ); // Q11 + move32(); + temp1_fx[i] = L_shl_sat( Mpy_32_32( temp1_fx[i], alpha_fx ), 1 ); + move32(); + alpha_fx = L_add( alpha_fx, winSlope_fx ); + } + } + ELSE + { + IF( NE_16( refChanIndx_bwe, hStereoICBWE->prev_refChanIndx_bwe ) ) + { + IF( GT_16( memOffset, 0 ) ) + { + SWITCH( memOffset ) + { + case 15: + winSlope_fx = 71582792; + BREAK; + case 30: + winSlope_fx = 35791396; + BREAK; + case 45: + winSlope_fx = 23860930; // Q30 + BREAK; + } + // memOffset for 16K 32K 48K are 15 30 45 respectively.camera + } + ELSE + { + winSlope_fx = 0; + move32(); + } + FOR( i = 0; i < memOffset; i++ ) + { + temp0_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ), + L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, 1 - ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ) ); + move32(); + + temp1_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ), + L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( 1 - ( i + 1 ) ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ) ); + move32(); + } + } + ELSE + { + Copy32( hStereoICBWE->memOutHB_fx[refChanIndx_bwe], temp0_fx, memOffset ); + Copy32( hStereoICBWE->memOutHB_fx[!refChanIndx_bwe], temp1_fx, memOffset ); + } + } + + IF( EQ_16( hCPE->nchan_out, 1 ) ) + { + /* stereo to mono downmix */ + FOR( i = 0; i < output_frame; i++ ) + { + temp0_fx[i] = L_add( temp0_fx[i], temp1_fx[i] ); + move32(); + temp0_fx[i] = L_shr( temp0_fx[i], 1 ); + move32(); + output[0][i] = L_add( output[0][i], temp0_fx[i] ); + move32(); + } + } + ELSE + { + v_add_32( temp0_fx, output[0], output[0], output_frame ); + v_add_32( temp1_fx, output[1], output[1], output_frame ); + } + + Copy32( outputHB[0] + output_frame - memOffset, hStereoICBWE->memOutHB_fx[0], memOffset ); + Copy32( outputHB[1] + output_frame - memOffset, hStereoICBWE->memOutHB_fx[1], memOffset ); + + IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) + { + /*win_dft = hCPE->hStereoDft->win32ms;*/ + win_dft_fx = hCPE->hStereoDft->win32ms_fx; + dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; + move16(); + + /* Preparing buffers in anticipation of an ACELP to TCX switch */ + j = 0; + move16(); + FOR( i = 0; i < memOffset; i++ ) + { + Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); + hStereoICBWE->memTransitionHB_fx[0][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[0][i], win_dft_fx[tmp_mul] ); + move32(); + hStereoICBWE->memTransitionHB_fx[1][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[1][i], win_dft_fx[tmp_mul] ); + move32(); + j++; + } + + FOR( i = 0; j < dftOvlLen; i++ ) + { + Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); + hStereoICBWE->memTransitionHB_fx[0][memOffset + i] = Mpy_32_16_1( outputHB[0][output_frame - i - 1], win_dft_fx[tmp_mul] ); + move32(); + hStereoICBWE->memTransitionHB_fx[1][memOffset + i] = Mpy_32_16_1( outputHB[1][output_frame - i - 1], win_dft_fx[tmp_mul] ); + move32(); + j++; + } + } + + hStereoICBWE->prev_refChanIndx_bwe = refChanIndx_bwe; + move16(); + } + ELSE + { + IF( EQ_16( last_core, ACELP_CORE ) ) + { + IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) + { + v_add_32( output[0], hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe], output[0], memOffset ); + v_add_32( output[1], hStereoICBWE->memOutHB_fx[!hStereoICBWE->prev_refChanIndx_bwe], output[1], memOffset ); + } + ELSE + { + /* This is generated in the ACELP frame and windowed. This process is akin to GenTransition for IC-BWE */ + v_add_32( output[0], hStereoICBWE->memTransitionHB_fx[hStereoICBWE->prev_refChanIndx_bwe], output[0], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + v_add_32( output[1], hStereoICBWE->memTransitionHB_fx[!hStereoICBWE->prev_refChanIndx_bwe], output[1], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + } + + set32_fx( hStereoICBWE->memOutHB_fx[0], 0, memOffset ); + set32_fx( hStereoICBWE->memOutHB_fx[1], 0, memOffset ); + + set32_fx( hStereoICBWE->memTransitionHB_fx[0], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + set32_fx( hStereoICBWE->memTransitionHB_fx[1], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); + } + } + } + ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && hCPE->hCoreCoder[0]->tdm_LRTD_flag && hStereoICBWE != NULL ) + { + stereo_icBWE_init_dec_fx( hCPE->hStereoICBWE ); + } + ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && EQ_16( last_core, ACELP_CORE ) ) + { + Word16 delay_tdbwe = NS2SA( output_Fs, DELAY_BWE_TOTAL_NS ); + + FOR( n = 0; n < hCPE->nchan_out; n++ ) + { + FOR( i = 0; i < delay_tdbwe; i++ ) + { + output[n][NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) - delay_tdbwe + i] = L_add_sat( output[n][NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) - delay_tdbwe + i], outputHB[0][i] ); + move32(); + } + } + /* reset BWE structs as they are only needed in the transition frame in MDCT Stereo */ + td_bwe_dec_init_ivas_fx( hCPE->hCoreCoder[0], hCPE->hCoreCoder[0]->hBWE_TD, output_Fs ); + fd_bwe_dec_init( hCPE->hCoreCoder[0], hCPE->hCoreCoder[0]->hBWE_FD ); + } + + test(); + IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && GT_32( L_max( hCPE->hStereoDft->td_gain_fx[0], hCPE->hStereoDft->td_gain_fx[1] ), 0 ) ) + { + Word32 win_in_fx, win_out_fx, tmp_fx, gain0_fx, gain1_fx; + + win_dft_fx = hCPE->hStereoDft->win32ms_fx; + dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; + move16(); + + //Scale_sig32(hCPE->hStereoDft->td_gain_fx, STEREO_DFT_CORE_HIST_MAX, -12); + + FOR( i = 0; i < dftOvlLen; i++ ) + { + win_in_fx = L_mult( win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )], win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )] ); /* Q31 */ + win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ + + gain0_fx = Mpy_32_32( win_in_fx, hCPE->hStereoDft->td_gain_fx[0] ); /* Q --> q_td_gain[0] */ +#ifdef FIX_736_BWE_SECT_C + gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ + gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ + gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ +#else + gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ + gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ + gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ +#endif + tmp_fx = L_add_sat( gain0_fx, gain1_fx ); /* Q --> q_output */ + + output[0][i] = L_add_sat( output[0][i], tmp_fx ); + move32(); + output[1][i] = L_sub_sat( output[1][i], tmp_fx ); + move32(); + } + FOR( i = dftOvlLen; i < output_frame; i++ ) + { +#ifdef FIX_736_BWE_SECT_C + tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ +#else + tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ +#endif + output[0][i] = L_add_sat( output[0][i], tmp_fx ); + move32(); + output[1][i] = L_sub_sat( output[1][i], tmp_fx ); + move32(); + } + } + + return; +} +#endif + +/*-------------------------------------------------------------------* + * stereo_icBWE_init_dec() + * + * Stereo (inter-channel) BWE mapping - decoder initialization + *-------------------------------------------------------------------*/ + +#ifndef IVAS_FLOAT_FIXED +void stereo_icBWE_init_dec( + STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ +) +{ + /* BWE ref channel */ + hStereoICBWE->refChanIndx_bwe = L_CH_INDX; + hStereoICBWE->prev_refChanIndx_bwe = L_CH_INDX; + + /* SHB output memory */ + set_f( hStereoICBWE->memOutHB[0], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); + set_f( hStereoICBWE->memOutHB[1], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); + + + /* SHB output memory */ + set_f( hStereoICBWE->memTransitionHB[0], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); + set_f( hStereoICBWE->memTransitionHB[1], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); + + /* inter-channel BWE spectral shape adj. */ + hStereoICBWE->prevSpecMapping = 0; + hStereoICBWE->prevgsMapping = 1.0f; + + hStereoICBWE->icbweM2Ref_prev = 1.0f; + + hStereoICBWE->prev_spIndx = 0; + hStereoICBWE->prev_gsIndx = 0; + + ic_bwe_dec_reset( hStereoICBWE ); + return; +} +#else +void stereo_icBWE_init_dec_fx( + STEREO_ICBWE_DEC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ +) +{ + /* BWE ref channel */ + hStereoICBWE->refChanIndx_bwe = L_CH_INDX; + move16(); + hStereoICBWE->prev_refChanIndx_bwe = L_CH_INDX; + move16(); + + /* SHB output memory */ + set32_fx( hStereoICBWE->memOutHB_fx[0], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); + set32_fx( hStereoICBWE->memOutHB_fx[1], 0, NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); + + + /* SHB output memory */ + set32_fx( hStereoICBWE->memTransitionHB_fx[0], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); + set32_fx( hStereoICBWE->memTransitionHB_fx[1], 0, NS2SA( 48000, STEREO_DFT32MS_OVL_NS ) ); + + /* inter-channel BWE spectral shape adj. */ + hStereoICBWE->prevSpecMapping_fx = 0; + move16(); + hStereoICBWE->prevgsMapping_fx = 16384; + move16(); + hStereoICBWE->icbweM2Ref_prev_fx = 16384; + move16(); + + hStereoICBWE->prev_spIndx = 0; + move16(); + hStereoICBWE->prev_gsIndx = 0; + move16(); + + ic_bwe_dec_reset_fx( hStereoICBWE ); + + return; +} #endif \ No newline at end of file diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 26bbeede5..1d745cfb7 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -525,7 +525,7 @@ static Word32 *getSmplPtr_fx( { return buffer.data_fx + chnlIdx * buffer.config.numSamplesPerChannel + smplIdx; } -#endif +#else static float *getSmplPtr( IVAS_REND_AudioBuffer buffer, const uint32_t chnlIdx, @@ -533,6 +533,7 @@ static float *getSmplPtr( { return buffer.data + chnlIdx * buffer.config.numSamplesPerChannel + smplIdx; } +#endif #ifdef IVAS_FLOAT_FIXED static void copyBufferTo2dArray_fx( const IVAS_REND_AudioBuffer buffer, @@ -1980,6 +1981,7 @@ static void closeHeadRotation( } #endif +#ifndef IVAS_FLOAT_FIXED static void initRotMatrix( rotation_matrix rot_mat ) { @@ -1994,6 +1996,7 @@ static void initRotMatrix( return; } +#endif #ifdef IVAS_FLOAT_FIXED @@ -7744,6 +7747,7 @@ ivas_error IVAS_REND_GetCombinedOrientation( This function takes 2 gain vectors - one for the beginning and one for the end of the buffer. Gain values are lineraly interpolated for all samples in between. */ +#ifndef IVAS_FLOAT_FIXED static void renderBufferChannelLerp( const IVAS_REND_AudioBuffer inAudio, const int32_t inChannelIdx, @@ -7810,6 +7814,7 @@ static void renderBufferChannelLerp( return; } +#endif #ifdef IVAS_FLOAT_FIXED /* Take one channel from input buffer and copy it to each channel in output buffer, with different gain applied per output channel. @@ -8705,19 +8710,15 @@ static ivas_error renderIsmToBinauralRoom( Copy32( currentPanGains, ismInput->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); } // Crend_process porting - Word16 nchan_in = 12, subframe_len; move16(); CREND_HANDLE hCrend; hCrend = ismInput->crendWrapper->hCrend; - subframe_len = (Word16) ( *ismInput->base.ctx.pOutSampleRate / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); move16(); - Word16 nchan = nchan_in; move16(); IF( hCrend->reflections != NULL ) { IF( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) { - nchan = add( hCrend->reflections->shoebox_data.n_sources, 1 ); FOR( i = 0; i < 150; i++ ) { hCrend->reflections->shoebox_data.gains.data_fx[i] = L_shl( hCrend->reflections->shoebox_data.gains.data_fx[i], 9 ); @@ -8725,7 +8726,6 @@ static ivas_error renderIsmToBinauralRoom( } } - nchan = nchan_in; move16(); /* render 7_1_4 with BRIRs */ -- GitLab From 827a6910ef6c91f798a9b75cf67d8c264aa27fb3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 20:06:48 +0530 Subject: [PATCH 051/101] EVS bitexactness preserving change --- lib_dec/hf_synth_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index 4cb4399d5..f2eea7d24 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -56,7 +56,7 @@ void hf_synth_init_fx( hBWE_zero->seed2 = RANDOM_INITSEED; set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); -#ifdef MSAN_FIX +#ifndef MSAN_FIX // Disabled to maintain EVS Bit-exactness set16_fx(hBWE_zero->mem_hp400_fx, 0, 6); #else set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); -- GitLab From d59eab386cf26c29ab573a7ee4287a38ca9dee07 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 21:16:47 +0530 Subject: [PATCH 052/101] EVS bitexactness fix --- lib_dec/hf_synth_fx.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index f2eea7d24..e10145bfd 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -56,11 +56,7 @@ void hf_synth_init_fx( hBWE_zero->seed2 = RANDOM_INITSEED; set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); -#ifndef MSAN_FIX // Disabled to maintain EVS Bit-exactness - set16_fx(hBWE_zero->mem_hp400_fx, 0, 6); -#else set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); -#endif // MSAN_FIX set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); @@ -79,11 +75,7 @@ void hf_synth_reset_fx( set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); -#ifdef MSAN_FIX - set16_fx(hBWE_zero->mem_hp400_fx, 0, 6); -#else set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); -#endif set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); -- GitLab From 2ea712ad3c6aaac182ce91f342f59c33100f5b73 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 21:48:11 +0530 Subject: [PATCH 053/101] LTV fixes for OMASA crashes --- lib_dec/dec_gen_voic_fx.c | 17 ++++++++++++ lib_dec/ivas_cpe_dec_fx.c | 2 +- lib_dec/ivas_dirac_dec.c | 10 +++++-- lib_dec/ivas_stereo_dft_dec_fx.c | 2 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 32 ++++++++++++---------- 5 files changed, 45 insertions(+), 18 deletions(-) diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c index fe1600050..7b43ca054 100644 --- a/lib_dec/dec_gen_voic_fx.c +++ b/lib_dec/dec_gen_voic_fx.c @@ -740,19 +740,36 @@ ivas_error decod_gen_voic_ivas_fx( Word32 Ltmp1; /* Contribution from AVQ layer */ Ltmp1 = L_mult(gain_preQ_fx, code_preQ_fx[i]); /* Q2 + Q6 -> Q9*/ +#ifdef BASOP_NOGLOB + Ltmp1 = L_shl_sat(Ltmp1, tmp1_fx); /* Q16 + Q_exc */ +#else Ltmp1 = L_shl(Ltmp1, tmp1_fx); /* Q16 + Q_exc */ +#endif /* Compute exc2 */ +#ifdef BASOP_NOGLOB + L_tmp = L_shl_sat(L_mult(gain_pit_fx, exc_fx[i + i_subfr_fx]), 1); + exc2_fx[i + i_subfr_fx] = round_fx_sat(L_add_sat(L_tmp, Ltmp1)); +#else L_tmp = L_shl(L_mult(gain_pit_fx, exc_fx[i + i_subfr_fx]), 1); exc2_fx[i + i_subfr_fx] = round_fx(L_add(L_tmp, Ltmp1)); +#endif /* code in Q9, gain_pit in Q14 */ L_tmp = L_mult(gain_code16, code_fx[i]); +#ifdef BASOP_NOGLOB + L_tmp = L_shl_sat(L_tmp, 5); + L_tmp = L_mac_sat(L_tmp, exc_fx[i + i_subfr_fx], gain_pit_fx); + L_tmp = L_shl_sat(L_tmp, 1); /* saturation can occur here */ + + exc_fx[i + i_subfr_fx] = round_fx_sat(L_add_sat(L_tmp, Ltmp1)); +#else L_tmp = L_shl(L_tmp, 5); L_tmp = L_mac(L_tmp, exc_fx[i + i_subfr_fx], gain_pit_fx); L_tmp = L_shl(L_tmp, 1); /* saturation can occur here */ exc_fx[i + i_subfr_fx] = round_fx(L_add(L_tmp, Ltmp1)); +#endif } } ELSE diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 4c763fcc0..e3bb1fe3d 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -615,7 +615,7 @@ ivas_error ivas_cpe_dec_fx( IF( shift != 31 ) { - shift = hCPE->hStereoDft->q_dft + shift - Q11; /* Q11 for guard bits */ + shift = hCPE->hStereoDft->q_dft + shift - Q13; /* Q13 for guard bits */ IF( shift > hCPE->hStereoDft->q_dft ) { diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 88761d954..143d8e2b8 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -4952,8 +4952,14 @@ void ivas_dirac_dec_render_sf_fx( { st_ivas->hMasa->data.dir_decode_quality_fx = float_to_fix16( st_ivas->hMasa->data.dir_decode_quality, Q15 ); - qualityBasedSmFactor_fx = L_deposit_h( st_ivas->hMasa->data.dir_decode_quality_fx ); // Q31 - qualityBasedSmFactor_fx = Mpy_32_32( qualityBasedSmFactor_fx, qualityBasedSmFactor_fx ); // (Q31, Q31) -> Q31 + IF( EQ_16( st_ivas->hMasa->data.dir_decode_quality_fx, MAX_16 ) ) + { + qualityBasedSmFactor_fx = MAX_32; + } + ELSE + { + qualityBasedSmFactor_fx = L_mult( st_ivas->hMasa->data.dir_decode_quality_fx, st_ivas->hMasa->data.dir_decode_quality_fx ); // (Q15, Q15) -> Q31 + } } #else float qualityBasedSmFactor = 1.0f; diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 3ffeb8f65..de55c77bd 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -2067,7 +2067,7 @@ void stereo_dft_dec_fx( gamma = 0; } - FOR ( i = s_max( hFdCngDec->cna_band_limits[b], shr(hFdCngCom->startBand , 2) ); i < s_min( hFdCngDec->cna_band_limits[b + 1], (L_FRAME16k) >> 1 ); i++ ) + FOR ( i = s_max( hFdCngDec->cna_band_limits[b], shr(hFdCngCom->startBand , 1) ); i < s_min( hFdCngDec->cna_band_limits[b + 1], (L_FRAME16k) >> 1 ); i++ ) { Word32 l_tmp; lev1 = *ptr_per++; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index d3759ade4..cc5ff84f7 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -3251,8 +3251,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( subtract_power_y = masa_stereo_type_detect->subtract_power_y_fx; // q_subtract_power_y move32(); - a = (Word32) ( 0.0004f * ONE_IN_Q31 ); /* Temporal smoothing coefficient */ - b = L_sub( ONE_IN_Q31, a ); /* Temporal smoothing coefficient */ + a = 858993; /* ( 0.0004f in Q31 ); Temporal smoothing coefficient */ + b = L_sub( ONE_IN_Q31, a ); /* Temporal smoothing coefficient */ q_com = s_min( exp, masa_stereo_type_detect->q_target_power_y_smooth ); target_power_y = L_shl( target_power_y, sub( q_com, exp ) ); @@ -3269,16 +3269,20 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( exp = 0; move16(); - tmp = BASOP_Util_Divide3232_Scale( masa_stereo_type_detect->subtract_power_y_smooth_fx, - L_add( masa_stereo_type_detect->target_power_y_smooth_fx, EPSILON_FX ), - &exp ); - exp = add( sub( Q15, exp ), sub( masa_stereo_type_detect->q_subtract_power_y, q_com ) ); - subtract_target_ratio = L_shl( L_deposit_l( tmp ), sub( Q15, exp ) ); // Q15 - - L_tmp = BASOP_Util_Log2( subtract_target_ratio ); // Q25 - L_tmp = L_add( L_tmp, L_shl( L_sub( Q31, Q15 ), Q25 ) ); // Q25 - subtract_target_ratio_db = Mpy_32_32( (Word32) ( 10.0f * ONE_IN_Q27 ), - Mpy_32_32( L_tmp, LOG10_2_Q31 ) ); // (Q27, (Q25, Q31)) -> (Q27, Q25) -> Q21 + IF( NE_32( masa_stereo_type_detect->target_power_y_smooth_fx, 0 ) ) + { + subtract_target_ratio = L_sub( BASOP_Util_Log2( masa_stereo_type_detect->subtract_power_y_smooth_fx ), + BASOP_Util_Log2( masa_stereo_type_detect->target_power_y_smooth_fx ) ); // Q25 + exp = sub( masa_stereo_type_detect->q_subtract_power_y, q_com ); + L_tmp = Mpy_32_32( L_sub( subtract_target_ratio, L_shl( exp, 25 ) ), LOG10_2_Q31 ); // Q25 + } + ELSE + { + subtract_target_ratio = BASOP_Util_Log2( masa_stereo_type_detect->subtract_power_y_smooth_fx ); // Q25 + exp = sub( 31, masa_stereo_type_detect->q_subtract_power_y ); + L_tmp = L_sub( Mpy_32_32( L_add( subtract_target_ratio, L_shl( exp, 25 ) ), LOG10_2_Q31 ), L_shl( -15, 25 ) /*log(EPSILON)*/ ); // Q25 + } + subtract_target_ratio_db = Mpy_32_32( 1342177280 /* 10.0f * in Q27*/, L_tmp ); // (Q27, (Q25, Q31)) -> (Q27, Q25) -> Q21 masa_stereo_type_detect->subtract_target_ratio_db_fx = subtract_target_ratio_db; // Q21 move32(); @@ -3300,7 +3304,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Word32 instDirectionSmoothness, weightedDirectionSmoothness, smoothedDirectionSmoothness; Word32 currWeight, prevWeight, sumWeight; Word16 indexFast, indexSlow; - Word32 alpha_quality_based = (Word32) ( 0.02f * ONE_IN_Q31 ); + Word32 alpha_quality_based = 42949672; /* 0.02f in Q31 */ move32(); indexSlow = s_min( l, alphaMaxBin ); @@ -4802,7 +4806,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( ismDirect_fx = L_add( ismDirect_fx, hMasaIsm->energy_ratio_ism_fx[dir][md_idx][k] ); } - totalDirect_fx = L_add( masaDirect_fx, ismDirect_fx ); + totalDirect_fx = L_add_sat( masaDirect_fx, ismDirect_fx ); // saturating as 1.0 (Q30) + 1.0 (Q30) is observed Word16 var_a = 0, var_b = 0; var_a = BASOP_Util_Divide3232_Scale( masaDirect_fx, totalDirect_fx, &exp_1 ); var_b = BASOP_Util_Divide3232_Scale( ismDirect_fx, totalDirect_fx, &exp_2 ); -- GitLab From 401a1d62b6e99a9f8e91a516c24f80fde31cad53 Mon Sep 17 00:00:00 2001 From: norvell Date: Thu, 16 May 2024 17:00:53 +0000 Subject: [PATCH 054/101] Add missing '$' for TESTCASE_TIMEOUT_STV --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4696a114f..d6119a9df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -276,7 +276,7 @@ stages: - make clean - make -j CLANG=$CLANG_NUM - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan.supp,report_error_type=1"; fi - - testcase_timeout=TESTCASE_TIMEOUT_STV + - testcase_timeout=$TESTCASE_TIMEOUT_STV - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path ./IVAS_cod_ref --ref_decoder_path ./IVAS_dec artifacts: name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" -- GitLab From ec843afa1916648257bc34bf8e7ed0bbe38913e3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 17 May 2024 20:59:40 +0530 Subject: [PATCH 055/101] MSAN fixes, LTV crash fixes, Float code cleanup in MC and renderer [x] MSAN fixes for stereo cases [x] Fixes for few LTV crashes [x] Float code cleanup in Multichannel config [x] Float code cleanup in lib_rend module --- lib_com/arith_coder_fx.c | 4 + lib_com/count.c | 12 +- lib_com/gs_inact_switching_fx.c | 8 +- lib_com/ivas_prot.h | 4 +- lib_com/ivas_prot_fx.h | 17 +- lib_com/ivas_stat_com.h | 11 + lib_com/lerp.c | 6 +- lib_com/prot_fx2.h | 2 +- lib_com/tcx_mdct_window.c | 2 +- lib_dec/acelp_core_dec_ivas_fx.c | 3 + lib_dec/core_switching_dec.c | 13 +- lib_dec/fd_cng_dec_fx.c | 37 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 31 +- lib_dec/ivas_init_dec.c | 82 +- lib_dec/ivas_jbm_dec.c | 88 +- lib_dec/ivas_mc_param_dec.c | 23 - lib_dec/ivas_mct_dec.c | 207 +--- lib_dec/ivas_mdct_core_dec.c | 2 +- lib_dec/ivas_omasa_dec.c | 133 +-- lib_dec/ivas_osba_dec.c | 18 - lib_dec/ivas_out_setup_conversion.c | 2 +- lib_dec/ivas_post_proc.c | 24 +- lib_dec/ivas_sba_dec.c | 18 - lib_dec/ivas_spar_md_dec.c | 2 - lib_dec/ivas_stat_dec.h | 60 +- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 4 +- lib_dec/ivas_stereo_switching_dec.c | 5 +- lib_dec/lib_dec_fx.c | 22 +- lib_dec/swb_bwe_dec_fx.c | 2 +- lib_enc/gp_clip_fx.c | 2 +- lib_enc/prot_fx_enc.h | 2 +- lib_enc/spec_flatness_fx.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 271 +---- lib_rend/ivas_orient_trk.c | 125 +-- lib_rend/ivas_prot_rend.h | 19 +- lib_rend/ivas_stat_rend.h | 17 +- lib_rend/lib_rend.c | 1008 ++++++++++++------ lib_util/masa_file_reader.c | 15 + 38 files changed, 1108 insertions(+), 1195 deletions(-) diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index efcc4b731..e3cf6f5e8 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -274,7 +274,11 @@ void tcx_arith_scale_envelope( tmp2 = BASOP_Util_Add_MantExp(negate(b), b_e, tmp, tmp2, &scale); scale = BASOP_Util_Divide1616_Scale(scale, round_fx(a), &tmp); +#ifdef BASOP_NOGLOB + scale = shl_o(scale, sub(sub(add(tmp, tmp2), a_e), 1), &Overflow); /* Q15 */ +#else scale = shl(scale, sub(sub(add(tmp, tmp2), a_e), 1)); /* Q15 */ +#endif /* iscale = 1.0f / scale; */ iscale_e = 0; diff --git a/lib_com/count.c b/lib_com/count.c index 2ee28cee4..664ebeef2 100644 --- a/lib_com/count.c +++ b/lib_com/count.c @@ -48,6 +48,7 @@ #include #include "stl.h" #include + #ifdef WMOPS static double frameRate = FRAME_RATE; /* default value : 10 ms */ #endif /* ifdef WMOPS */ @@ -854,9 +855,11 @@ void generic_WMOPS_output (Word16 dtx_mode, char *test_file_name) { /* FROM_EVS_DEV */ #define MAX_STACK 64 +#if WMOPS static int stack[MAX_STACK]; static int sptr; static int sum_stack[MAX_STACK]; +#endif /* jdr 20120117: add FLC similar functions */ void BASOP_frame_update(void) @@ -1062,6 +1065,7 @@ void BASOP_push_wmops (const char *label) #endif #endif /* if WMOPS */ + UNUSED_PARAM(label); } @@ -1115,7 +1119,9 @@ Word32 BASOP_get_wops (void) #define MILLION_CYCLES 1e6 #define FAC (FRAMES_PER_SECOND/MILLION_CYCLES) +#if WMOPS static Word32 prom_cnt = 0; +#endif void WMOPS_destroy(void) { @@ -1292,6 +1298,7 @@ void WMOPS_output_all(Word16 dtx_mode) WMOPS_destroy(); #endif /* if WMOPS */ + UNUSED_PARAM(dtx_mode); } void WMOPS_output_all_std(Word16 dtx_mode) { @@ -1392,6 +1399,7 @@ void WMOPS_output_all_std(Word16 dtx_mode) WMOPS_destroy(); #endif /* if WMOPS */ + UNUSED_PARAM(dtx_mode); } @@ -1431,6 +1439,8 @@ void BASOP_get_total_wmops(double *min, double *max, double *avg) *avg = (nbframe[0] == 0) ? 0 : ops_cnt / nbframe[0]; } #endif /* if WMOPS */ + UNUSED_PARAM(min); + UNUSED_PARAM(max); + UNUSED_PARAM(avg); } - /* end of file */ diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c index a0150c20b..5bfd30572 100644 --- a/lib_com/gs_inact_switching_fx.c +++ b/lib_com/gs_inact_switching_fx.c @@ -258,8 +258,8 @@ void Inac_switch_ematch_ivas_fx( FOR(j = 0; j < 8; j++) { L_tmp = L_mult0(*pt_exc, ftmp); - L_tmp = L_shl(L_tmp, add(exp, 15)); /* Q(Q_exc) -> Q(15+Q_exc)*/ - *pt_exc = round_fx(L_tmp); /*Q_exc - 1*/ + L_tmp = L_shl_sat(L_tmp, add(exp, 15)); /* Q(Q_exc) -> Q(15+Q_exc)*/ + *pt_exc = round_fx_sat(L_tmp); /*Q_exc - 1*/ pt_exc++; } } @@ -268,8 +268,8 @@ void Inac_switch_ematch_ivas_fx( FOR(j = 0; j < 16; j++) { L_tmp = L_mult0(*pt_exc,ftmp); - L_tmp = L_shl(L_tmp, add(exp,15)); /* Q(Q_exc) -> Q(15+Q_exc)*/ - *pt_exc = round_fx(L_tmp); /*Q_exc - 1*/ + L_tmp = L_shl_sat(L_tmp, add(exp,15)); /* Q(Q_exc) -> Q(15+Q_exc)*/ + *pt_exc = round_fx_sat(L_tmp); /*Q_exc - 1*/ pt_exc++; } } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 42ef2c05f..290ef3f88 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -6723,7 +6723,7 @@ void ivas_ls_setup_conversion_process_mdct( void ivas_ls_setup_conversion_process_mdct_param_mc_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *x_fx[][NB_DIV], /* i/o: Fixed output synthesis signal */ - Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]/* i/o: Exponent for output synthesis signal */ + Word16 x_e[CPE_CHANNELS][NB_DIV]/* i/o: Exponent for output synthesis signal */ ); #endif // IVAS_FLOAT_FIXED @@ -7234,6 +7234,7 @@ void ivas_merge_masa_transports( const int16_t num_transport_channels /* i : Number of transport audio signals */ ); +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_omasa_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); @@ -7241,6 +7242,7 @@ ivas_error ivas_omasa_data_open( void ivas_omasa_data_close( MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ ); +#endif ivas_error ivas_omasa_ism_metadata_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 4d63129c5..814fde0dd 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1399,7 +1399,7 @@ void ivas_mdct_core_tns_ns_fx( Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ Word32 Aq_fx[CPE_CHANNELS][(NB_SUBFR16k + 1) * (M + 1)], /* o : LP coefficients */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - Word16 x_e[MAX_CICP_CHANNELS][NB_DIV] + Word16 x_e[CPE_CHANNELS][NB_DIV] ); void decoder_tcx_imdct_fx( @@ -2185,4 +2185,19 @@ void ivas_param_mc_dec_read_BS_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder ParamMC handle */ Word16 *nb_bits /* o : number of bits written */ ); + +ivas_error ivas_omasa_data_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +); + +void ivas_omasa_data_close_fx( + MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ +); + +ivas_error ivas_mc_dec_config_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 idx, /* i : LS config. index */ + UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ + Word16 *data /* o : output synthesis signal */ +); #endif diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 3b70fb63b..dfe9942a5 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -445,6 +445,12 @@ typedef struct ivas_masa_directional_spatial_meta_struct float elevation[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifdef IVAS_FLOAT_FIXED + Word32 azimuth_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 elevation_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 spread_coherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#endif uint16_t spherical_index[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; } MASA_DIRECTIONAL_SPATIAL_META; @@ -453,6 +459,11 @@ typedef struct ivas_masa_common_spatial_meta_struct { float diffuse_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float surround_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifdef IVAS_FLOAT_FIXED + Word32 diffuse_to_total_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 surround_coherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 remainder_to_total_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#endif float remainder_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; } MASA_COMMON_SPATIAL_META; diff --git a/lib_com/lerp.c b/lib_com/lerp.c index 453c68663..abda17551 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -195,7 +195,7 @@ static void lerp_proc_flt( * Local function prototypes *-------------------------------------------------------------*/ -static void lerp_proc(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize); +static void lerp_proc(const Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize); /*-------------------------------------------------------------* * procedure lerp() * @@ -203,7 +203,7 @@ static void lerp_proc(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 buf * * *-------------------------------------------------------------*/ -void lerp(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize) +void lerp(const Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize) { Word16 tmp1, tmp2, tmpexp; BASOP_Util_Divide_MantExp(bufferNewSize, 0, bufferOldSize, 0, &tmp1, &tmpexp); @@ -267,7 +267,7 @@ void lerp(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize) * * * * *-------------------------------------------------------------*/ -static void lerp_proc(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize) +static void lerp_proc(const Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize) { Word16 i, idx, n; diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index b3535e585..cedbc4b7d 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -2247,7 +2247,7 @@ void ivas_synth_mem_updt2_fx( //lerp.c -void lerp(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize); +void lerp(const Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize); void L_lerp_fx_q11( Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 bufferOldSize ); diff --git a/lib_com/tcx_mdct_window.c b/lib_com/tcx_mdct_window.c index 5adb0348f..3351c99b7 100644 --- a/lib_com/tcx_mdct_window.c +++ b/lib_com/tcx_mdct_window.c @@ -160,7 +160,7 @@ void mdct_window_sine_IVAS_updated( } else { - lerp((Word16 *)window_table, temp, n, buf_in_size); + lerp(window_table, temp, n, buf_in_size); } for (int i = 0; i < n / 2; i++) diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 7787b4420..ef617eed6 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1886,6 +1886,9 @@ ivas_error acelp_core_dec_ivas_fx( ELSE { hf_synth_reset_fx( st->hBWE_zero ); +#ifdef MSAN_FIX + set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); +#endif } } diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index f0afb5983..11e1fb89a 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -130,6 +130,9 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); +#ifdef MSAN_FIX + set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); +#endif } IF( st->hBWE_FD != NULL ) @@ -450,6 +453,9 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32( st->output_Fs, 16000 ) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); +#ifdef MSAN_FIX + set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); +#endif } IF( st->hBWE_FD != NULL ) @@ -501,6 +507,9 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( GT_32(st->output_Fs , 16000) && st->hBWE_zero != NULL ) { hf_synth_reset_fx( st->hBWE_zero ); +#ifdef MSAN_FIX + set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); +#endif } IF( st->hBWE_FD != NULL ) @@ -1940,7 +1949,9 @@ void ivas_bw_switching_pre_proc_fx( IF ( EQ_16( st->core, ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) && st->hBWE_FD != NULL && !( LE_32( st->core_brate, SID_2k40 ) && EQ_16( st->element_mode, IVAS_CPE_DFT ) && EQ_16( nchan_out, 2 ) ) && !( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( nchan_out, 1 ) && EQ_16( st->idchan, 1 ) && LE_32( last_element_brate, IVAS_SID_5k2 ) ) ) { /* Calculate tilt of the ACELP core synthesis - needed in SWB BWE decoding */ - st->tilt_wb_fx = ivas_calc_tilt_bwe_fx( old_syn_12k8_16k_fx, Q , st->L_frame ); + Word16 old_syn_12k8_16k_tmp_16fx[L_FRAME16k]; + Copy_Scale_sig_32_16( old_syn_12k8_16k_fx, old_syn_12k8_16k_tmp_16fx, st->L_frame, sub( -1, Q ) ); + st->tilt_wb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_syn_12k8_16k_tmp_16fx, -1, st->L_frame ), sub( Q, 8 ) ) ); } return; diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 3aece14b8..22ae6ea99 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1760,7 +1760,10 @@ Word16 ApplyFdCng_ivas_fx( } s2 = s_max( s2, facTabExp[k] ); } - + IF(EQ_16(s2, -31)) + { + s2 = 0; move16(); + } FOR( k = 0; k < hFdCngCom->nFFTpart; k++ ) { s = sub( facTabExp[k], s2 ); @@ -1833,7 +1836,10 @@ Word16 ApplyFdCng_ivas_fx( } s2 = s_max( s2, facTabExp[k] ); } - + IF(EQ_16(s2, -31)) + { + s2 = 0; move16(); + } FOR( k = 0; k < hFdCngCom->nFFTpart; k++ ) { s = sub( facTabExp[k], s2 ); @@ -2705,27 +2711,40 @@ void perform_noise_estimation_dec_ivas_fx( Word16 scale; /* no updates during active frames except for significant energy drops */ enr_ratio = BASOP_Util_Divide3232_Scale( enr_tot, enr_tot0, &scale ); - IF( GE_16( scale, 0 ) ) + IF( LE_16( scale, 0 ) ) { - enr_ratio = shr( enr_ratio, scale ); + enr_ratio = shl( enr_ratio, scale ); + scale = 15; move16(); } ELSE { - enr_ratio = shr( enr_ratio, sub( 15, scale ) ); + scale = sub(15, scale); } - IF( LT_16( enr_ratio, ONE_IN_Q14 ) ) + IF( LT_16( enr_ratio, shl(1, sub(scale, 1)) ) ) { /* total energy significantly decreases during active frames -> downward update */ - wght = lin_interp_fx( enr_ratio, 0, 26214 /*0.8f in Q15*/, 16384 /*0.5f in Q15*/, 31130 /*0.95f in Q15*/, 32767 /*1 in Q15*/ ); - + wght = lin_interp_fx( enr_ratio, 0, shr(26214, sub(15, scale)) /*0.8f in Q15*/, shr(16384, sub(15, scale)) /*0.5f in Q15*/, shr(31130, sub(15, scale)) /*0.95f in Q15*/, shr(32767, sub(15, scale)) /*1 in Q15*/ ); + Word16 temp_q_msNoiseEst[NPART_SHAPING]; + Word16 min_q_msNoiseEst = MAX_16; + FOR(p = 0; p < NPART_SHAPING; p++) + { + temp_q_msNoiseEst[p] = hFdCngDec->msNoiseEst_exp; move16(); + } FOR( p = 0; p < npart; p++ ) { L_tmp = L_shr( msPeriodog[p], sub( sub( 31, hFdCngDec->hFdCngCom->periodog_exp ), 4 ) ); IF( LT_32( L_tmp, msNoiseEst[p] ) ) { - msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], wght ), Mpy_32_16_1( L_tmp, (Word16) L_sub( ONE_IN_Q15, wght ) ) ); + msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], wght ), Mpy_32_16_1( L_tmp, (Word16) L_sub( shr(MAX_16, sub(15, scale)), wght ) ) ); + temp_q_msNoiseEst[p] = sub(add(hFdCngDec->msNoiseEst_exp, scale), 15); } + min_q_msNoiseEst = s_min(temp_q_msNoiseEst[p], min_q_msNoiseEst); + } + FOR(p = 0; p < NPART_SHAPING; p++) + { + msNoiseEst[p] = L_shl(msNoiseEst[p], sub(min_q_msNoiseEst, temp_q_msNoiseEst[p])); } + hFdCngDec->msNoiseEst_exp = min_q_msNoiseEst; move16(); } ELSE { diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 6c4c75e86..f1f010f5b 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -91,7 +91,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } - + h_dirac_output_synthesis_params->proto_matrix_len = nchan_out * nchan_in; + move16(); /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { @@ -209,11 +210,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { - if ( ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); - } - set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); if ( ( h_dirac_output_synthesis_state->mixing_matrix[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { @@ -223,18 +219,11 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; } for ( idx = 0; idx < num_param_bands_residual; idx++ ) { - if ( ( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); - } - set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); - if ( ( h_dirac_output_synthesis_state->mixing_matrix_res[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); @@ -243,7 +232,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; } @@ -471,13 +459,11 @@ void ivas_dirac_dec_output_synthesis_cov_init_fx( #if 1/*TODO: To be removed :Floating point initializations*/ FOR ( idx = 0; idx < n_param_bands; idx++ ) { - set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); } FOR ( idx = 0; idx < n_param_bands_res; idx++ ) { - set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); } #endif @@ -655,19 +641,6 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx( /* free cov buffers */ FOR ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - - IF ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] != NULL ) - { - free( h_dirac_output_synthesis_state->mixing_matrix_old[idx] ); - h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; - } - - IF ( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] != NULL ) - { - free( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] ); - h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; - } - IF ( h_dirac_output_synthesis_state->mixing_matrix[idx] != NULL ) { free( h_dirac_output_synthesis_state->mixing_matrix[idx] ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ac39d5247..e875c9dce 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -241,14 +241,6 @@ ivas_error ivas_dec_setup( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -294,16 +286,6 @@ ivas_error ivas_dec_setup( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ((float)(st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i]) / (1LL << (Q11))); /*Rounding off*/ } } - // fix2float (to be cleaned) - IF((LT_32(hDecoderConfig->ivas_total_brate, IVAS_24k4)) && ((EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2)) || (EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3)))) - { - fixedToFloat_arr(hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS); - FOR(Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++) - { - fixedToFloat_arrL(hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1); - } - } - // fix2float end FOR(Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++) { IF(st_ivas->cldfbSynDec[out_ch]) @@ -591,10 +573,52 @@ ivas_error ivas_dec_setup( num_bits_read = add(num_bits_read, MC_LS_SETUP_BITS); /* select MC format mode; reconfigure the MC format decoder */ + +#ifndef IVAS_FLOAT_FIXED IF ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } +#else +#if 1 /*TODO: To be removed(Float to fixed conversion)*/ + IF(st_ivas->hTcBuffer) + FOR ( int ch = 0; ch < st_ivas->hTcBuffer->nchan_transport_internal; ch++ ) + { + floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); + } + if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + if ( st_ivas->hParamMC ) + { + if ( st_ivas->hParamMC->diff_proto_info ) + FOR( Word16 i = 0; i < st_ivas->hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + floatToFixed_arrL( st_ivas->hParamMC->diff_proto_info->proto_fac[i], st_ivas->hParamMC->diff_proto_info->proto_fac_fx[i], Q26, st_ivas->hParamMC->diff_proto_info->num_source_chan_diff[i] ); + } + } + } +#endif + IF ( ( error = ivas_mc_dec_config_fx( st_ivas, idx, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1 + if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + if ( st_ivas->hParamMC ) + { + fixedToFloat_arrL( st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_fx, st_ivas->hParamMC->h_output_synthesis_params.proto_matrix, 26, st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_len ); + IF( st_ivas->hParamMC->diff_proto_info ) + FOR( Word16 i = 0; i < st_ivas->hParamMC->diff_proto_info->num_protos_diff; i++ ) + { + fixedToFloat_arrL( st_ivas->hParamMC->diff_proto_info->proto_fac_fx[i], st_ivas->hParamMC->diff_proto_info->proto_fac[i], 26, st_ivas->hParamMC->diff_proto_info->num_source_chan_diff[i] ); + } + if ( st_ivas->hParamMC->hoa_encoder_fx ) + fixedToFloat_arrL( st_ivas->hParamMC->hoa_encoder_fx, st_ivas->hParamMC->hoa_encoder, Q29, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); + } + } +#endif +#endif } /*-------------------------------------------------------------------* @@ -1829,7 +1853,7 @@ ivas_error ivas_init_decoder_fx( return error; } - IF ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_omasa_data_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1956,6 +1980,8 @@ ivas_error ivas_init_decoder_fx( { return error; } + + st_ivas->hParamMC->proto_matrix_int_e = 0; #if 1/*Fixed to float conversions*/ PARAM_MC_DEC_HANDLE hParamMC; hParamMC = st_ivas->hParamMC; @@ -1982,19 +2008,6 @@ ivas_error ivas_init_decoder_fx( { fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); } - //if ( st_ivas->hLsSetUpConversion ) - //{ - // for ( k = 0; k < nchan_transport; k++ ) - // { - // for ( i = 0; i < nchan_out_cov; i++ ) - // { - // st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); - // } - // } - //} - fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, s_min(hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) ); - //if ( hParamMC->ls_conv_dmx_matrix ) - // fixedToFloat_arrL( hParamMC->ls_conv_dmx_matrix_fx, hParamMC->ls_conv_dmx_matrix, Q30, nchan_out_transport * nchan_out_cov ); if ( hParamMC->hoa_encoder_fx ) fixedToFloat_arrL( hParamMC->hoa_encoder_fx, hParamMC->hoa_encoder, Q29, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); } @@ -2462,7 +2475,6 @@ ivas_error ivas_init_decoder_fx( return error; } - set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); @@ -4182,7 +4194,11 @@ void ivas_destroy_dec( #endif /* OMASA structure */ +#ifdef IVAS_FLOAT_FIXED + ivas_omasa_data_close_fx( &st_ivas->hMasaIsmData ); +#else ivas_omasa_data_close( &st_ivas->hMasaIsmData ); +#endif /* Head track data handle */ ivas_headTrack_close( &st_ivas->hHeadTrackData ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 3e52052fa..6eade5553 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -3919,9 +3919,14 @@ void ivas_jbm_dec_feed_tc_to_renderer( nchan_out_cov = nchan_out_transport; } f2me_buf(st_ivas->hParamMC->h_output_synthesis_params.proto_matrix, st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_fx, &st_ivas->hParamMC->h_output_synthesis_params.proto_matrix_e, nchan_out_cov * nchan_transport); - f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_transport * nchan_out_transport)); + + scale_sig32(st_ivas->hParamMC->proto_matrix_int_fx, st_ivas->hParamMC->proto_matrix_int_len, -1); + st_ivas->hParamMC->proto_matrix_int_e = 1; ivas_param_mc_dec_digest_tc_fx( st_ivas, (uint8_t) n_render_timeslots, (Word32 **)p_data_f_fx, in_q ); + + scale_sig32(st_ivas->hParamMC->proto_matrix_int_fx, st_ivas->hParamMC->proto_matrix_int_len, 1); + Word16 shift; FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) { @@ -4760,16 +4765,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -4841,14 +4836,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -4890,16 +4877,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5042,14 +5019,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5077,16 +5046,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); } } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5132,14 +5091,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5167,16 +5118,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5221,14 +5162,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5256,14 +5189,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -5734,7 +5659,6 @@ ivas_error ivas_jbm_dec_render( IF(st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr) { f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_out_cov * nchan_out_cov); - f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_exp[param_band_idx], nchan_out_cov * nchan_out_cov); } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 64f125f30..4d13c4049 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -394,10 +394,6 @@ ivas_error ivas_param_mc_dec_open_fx( } Copy32( ivas_param_mc_conf[config_index].dmx_fac_fx, hParamMC->proto_matrix_int_fx, nchan_transport * nchan_out_transport );/*Q31*/ - if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } hParamMC->proto_matrix_int_len = nchan_out_transport * nchan_transport; move16(); @@ -1467,13 +1463,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( IF ( NE_16(nchan_transport_old , nchan_transport) ) { -#if 1 - free( hParamMC->proto_matrix_int ); - IF ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); - } -#endif free( hParamMC->proto_matrix_int_fx ); IF ( ( hParamMC->proto_matrix_int_fx = (Word32 *) malloc( nchan_out_transport * nchan_transport * sizeof(Word32) ) ) == NULL ) { @@ -2475,13 +2464,6 @@ void ivas_param_mc_dec_close_fx( hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; } #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED /*TODO: To be removed later(Floating point memory dealloc)------------------------------- */ - - IF( hParamMC->proto_matrix_int != NULL ) - { - free( hParamMC->proto_matrix_int ); - hParamMC->proto_matrix_int = NULL; - } - IF( hParamMC->proto_frame_f != NULL ) { free( hParamMC->proto_frame_f ); @@ -2492,11 +2474,6 @@ void ivas_param_mc_dec_close_fx( free( hParamMC->proto_frame_dec_f ); hParamMC->proto_frame_dec_f = NULL; } - //IF( hParamMC->ls_conv_dmx_matrix != NULL ) - //{ - // free( hParamMC->ls_conv_dmx_matrix ); - // hParamMC->ls_conv_dmx_matrix = NULL; - //} IF( hParamMC->hoa_encoder != NULL ) { free( hParamMC->hoa_encoder ); diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index a4bf16d6c..039e42cfa 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1324,11 +1324,12 @@ void ivas_mct_dec_close( *-------------------------------------------------------------------------*/ /*! r : MC format mode */ -ivas_error ivas_mc_dec_config( +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_mc_dec_config_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t idx, /* i : LS config. index */ - uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + const Word16 idx, /* i : LS config. index */ + UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ + Word16 *data /* o : output synthesis signal */ ) { AUDIO_CONFIG signaled_config; @@ -1338,12 +1339,12 @@ ivas_error ivas_mc_dec_config( /* store last frame MC mode */ last_mc_mode = st_ivas->mc_mode; - if ( !st_ivas->bfi ) + IF ( EQ_16(st_ivas->bfi, 0) ) { /* set transported MC LS setup */ signaled_config = ivas_mc_map_ls_setup_to_output_config( idx ); - if ( st_ivas->ini_frame == 0 ) + IF ( EQ_16(st_ivas->ini_frame, 0) ) { st_ivas->transport_config = signaled_config; } @@ -1352,107 +1353,10 @@ ivas_error ivas_mc_dec_config( st_ivas->mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); /* MC format switching */ - if ( st_ivas->ini_frame != 0 ) + IF ( st_ivas->ini_frame != 0 ) { - if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) + IF ( NE_32(st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->hDecoderConfig->ivas_total_brate) || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*TODO: To be removed(Float to fixed conversion)*/ - //DECODER_TC_BUFFER_HANDLE hTcBuffer; - //hTcBuffer = st_ivas->hTcBuffer; - //RENDERER_TYPE renderer_type_old; - //renderer_type_old = st_ivas->renderer_type; - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } - //SPAR_DEC_HANDLE hSpar; - //hSpar = st_ivas->hSpar; - Word16 nchan_transport_old = st_ivas->nchan_transport; - //uint16_t nchan_internal; - Word32 ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - //nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - //DECODER_CONFIG_HANDLE hDecoderConfig; - //hDecoderConfig = st_ivas->hDecoderConfig; - - Word16 n_tc; - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for ( int ch = 0; ch < n_tc; ch++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); - } - Word16 mmo_e = 0, mmro_e = 0; - PARAM_MC_DEC_HANDLE hParamMC; - hParamMC = st_ivas->hParamMC; - Word16 nchan_out_transport, nchan_out_cov; - MC_LS_SETUP mc_ls_setup; - Word16 nchan_transport; - if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) - { - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); - nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - if ( st_ivas->hParamMC ) - { - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - } - else - { - nchan_out_cov = nchan_out_transport; - } - Word32 max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; - float max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i] ) - { - for ( int j = 0; j < nchan_transport_old * nchan_out_cov; j++ ) - max_mix_matrix_old = max( max_mix_matrix_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i][j] ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) - max_mix_matrix_res_old = max( max_mix_matrix_res_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i][j] ); - } - } - f2me( max_mix_matrix_old, &max_mix_matrix_old_fx, &mmo_e ); - f2me( max_mix_matrix_res_old, &max_mix_matrix_res_old_fx, &mmro_e ); - if ( mmo_e < 0 ) - mmo_e = 0; - if ( mmro_e < 0 ) - mmro_e = 0; - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i] ) - { - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); - } - } - floatToFixed_arrL( hParamMC->proto_matrix_int, hParamMC->proto_matrix_int_fx, Q31, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) ); - FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - if ( hParamMC->diff_proto_info ) - floatToFixed_arrL( hParamMC->diff_proto_info->proto_fac[i], hParamMC->diff_proto_info->proto_fac_fx[i], Q26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); - } - } - } -#endif IF ( st_ivas->hRenderConfig ) { FOR( Word16 i = 0; i < 4; i++ ) @@ -1460,7 +1364,7 @@ ivas_error ivas_mc_dec_config( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = shl_sat( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2], 9 ); } } - if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } @@ -1471,59 +1375,52 @@ ivas_error ivas_mc_dec_config( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = shr( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2], 9 ); } } -#if 1 - if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) - { - hParamMC = st_ivas->hParamMC; - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); - st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); - nchan_transport = st_ivas->nchan_transport; - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - } - else - { - nchan_out_cov = nchan_out_transport; - } - if ( hParamMC ) - { - fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); - IF( hParamMC->diff_proto_info ) - FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 26, hParamMC->diff_proto_info->num_source_chan_diff[i] ); - } - fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) ); - if ( last_mc_mode == MC_MODE_PARAMMC ) - { - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i] ) - { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); - } - } - } - if ( hParamMC->hoa_encoder_fx ) - fixedToFloat_arrL( hParamMC->hoa_encoder_fx, hParamMC->hoa_encoder, Q29, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS ); - } - } -#endif + } + } + + st_ivas->transport_config = signaled_config; + } + + return IVAS_ERR_OK; +} #else +ivas_error ivas_mc_dec_config( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t idx, /* i : LS config. index */ + uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ + int16_t *data /* o : output synthesis signal */ +) +{ + AUDIO_CONFIG signaled_config; + MC_MODE last_mc_mode; + ivas_error error; + + /* store last frame MC mode */ + last_mc_mode = st_ivas->mc_mode; + + if ( !st_ivas->bfi ) + { + /* set transported MC LS setup */ + signaled_config = ivas_mc_map_ls_setup_to_output_config( idx ); + + if ( st_ivas->ini_frame == 0 ) + { + st_ivas->transport_config = signaled_config; + } + + /* select MC format mode */ + st_ivas->mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); + + /* MC format switching */ + if ( st_ivas->ini_frame != 0 ) + { + if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) + { if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { return error; } -#endif // IVAS_FLOAT_FIXED } } @@ -1532,7 +1429,7 @@ ivas_error ivas_mc_dec_config( return IVAS_ERR_OK; } - +#endif /*------------------------------------------------------------------------- * ivas_mc_dec_reconfig() diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 16008fb1f..732bca24d 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -2297,7 +2297,7 @@ void ivas_mdct_core_tns_ns_fx( Word32 *x_fx[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ Word32 Aq_fx[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - Word16 x_e[MAX_CICP_CHANNELS][NB_DIV] + Word16 x_e[CPE_CHANNELS][NB_DIV] ) { Word16 ch, k, bfi; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b3980c49c..7ee3f1e7e 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -88,9 +88,6 @@ ivas_error ivas_omasa_data_open( hMasaIsmData->objectsMoved = 0; hMasaIsmData->delayBuffer = NULL; -#ifdef IVAS_FLOAT_FIXED - hMasaIsmData->delayBuffer_fx = NULL; -#endif for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ ) { @@ -106,9 +103,6 @@ ivas_error ivas_omasa_data_open( for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ ) { set_zero( hMasaIsmData->energy_ratio_ism[obj_idx][sf], CLDFB_NO_CHANNELS_MAX ); -#ifdef IVAS_FLOAT_FIXED - set32_fx( hMasaIsmData->energy_ratio_ism_fx[obj_idx][sf], 0, CLDFB_NO_CHANNELS_MAX ); -#endif } } set_s( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); @@ -119,47 +113,55 @@ ivas_error ivas_omasa_data_open( return IVAS_ERR_OK; } #else -ivas_error ivas_omasa_data_open( +ivas_error ivas_omasa_data_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { MASA_ISM_DATA_HANDLE hMasaIsmData; - int16_t ch, bin; - int16_t sf, obj_idx; + Word16 ch, bin; + Word16 sf, obj_idx; - IF ( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) + IF( ( hMasaIsmData = (MASA_ISM_DATA_HANDLE) malloc( sizeof( MASA_ISM_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA ISM data\n" ) ); } - FOR ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + FOR( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) { - FOR ( ch = 0; ch < 2; ch++ ) + FOR( ch = 0; ch < 2; ch++ ) { - hMasaIsmData->ismPreprocMatrix_fx[ch][ch][bin] = 32767; + hMasaIsmData->ismPreprocMatrix_fx[ch][ch][bin] = 32767; /* 1.0f in Q15 */ + move16(); hMasaIsmData->ismPreprocMatrix_fx[1 - ch][ch][bin] = 0; + move16(); hMasaIsmData->eneMoveIIR_fx[ch][bin] = 0; + move32(); hMasaIsmData->enePreserveIIR_fx[ch][bin] = 0; + move32(); } hMasaIsmData->preprocEneTarget_fx[bin] = 0; + move32(); hMasaIsmData->preprocEneRealized_fx[bin] = 0; + move32(); } hMasaIsmData->objectsMoved = 0; hMasaIsmData->delayBuffer_fx = NULL; - for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ ) + FOR( ch = 0; ch < MAX_NUM_OBJECTS; ch++ ) { hMasaIsmData->ism_is_edited[ch] = 0; hMasaIsmData->q_elevation_old_fx[ch] = 0; + move32(); hMasaIsmData->q_azimuth_old_fx[ch] = 0; + move32(); } - for ( obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ ) + FOR( obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ ) { - set_s( hMasaIsmData->azimuth_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); - set_s( hMasaIsmData->elevation_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); - for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ ) + set16_fx( hMasaIsmData->azimuth_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); + set16_fx( hMasaIsmData->elevation_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); + FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ ) { // To be removed later ///////////////////////////////////////////////////////////////////////// set_zero( hMasaIsmData->energy_ratio_ism[obj_idx][sf], CLDFB_NO_CHANNELS_MAX ); @@ -167,24 +169,8 @@ ivas_error ivas_omasa_data_open( set32_fx( hMasaIsmData->energy_ratio_ism_fx[obj_idx][sf], 0, CLDFB_NO_CHANNELS_MAX ); } } - set_s( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); - set_s( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); - - // to be removed later //////////////////////////////////////////////////////////////////////////////////// - FOR ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) - { - FOR ( ch = 0; ch < 2; ch++ ) - { - hMasaIsmData->ismPreprocMatrix[ch][ch][bin] = 1.0f; - hMasaIsmData->ismPreprocMatrix[1 - ch][ch][bin] = 0.0f; - hMasaIsmData->eneMoveIIR[ch][bin] = 0.0f; - hMasaIsmData->enePreserveIIR[ch][bin] = 0.0f; - } - hMasaIsmData->preprocEneTarget[bin] = 0.0f; - hMasaIsmData->preprocEneRealized[bin] = 0.0f; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + set16_fx( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); + set16_fx( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); st_ivas->hMasaIsmData = hMasaIsmData; @@ -221,38 +207,27 @@ void ivas_omasa_data_close( ( *hMasaIsmData )->delayBuffer = NULL; } -#ifdef IVAS_FLOAT_FIXED - IF ( ( *hMasaIsmData )->delayBuffer_fx != NULL ) - { - FOR ( i = 0; i < ( *hMasaIsmData )->delayBuffer_nchan; i++ ) - { - free( ( *hMasaIsmData )->delayBuffer_fx[i] ); - } - free( ( *hMasaIsmData )->delayBuffer_fx ); - ( *hMasaIsmData )->delayBuffer_fx = NULL; - } -#endif - free( *hMasaIsmData ); *hMasaIsmData = NULL; return; } #else -void ivas_omasa_data_close( +void ivas_omasa_data_close_fx( MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ ) { Word16 i; - IF ( hMasaIsmData == NULL || *hMasaIsmData == NULL ) + test(); + IF( hMasaIsmData == NULL || *hMasaIsmData == NULL ) { return; } - IF ( ( *hMasaIsmData )->delayBuffer_fx != NULL ) + IF( ( *hMasaIsmData )->delayBuffer_fx != NULL ) { - FOR ( i = 0; i < ( *hMasaIsmData )->delayBuffer_nchan; i++ ) + FOR( i = 0; i < ( *hMasaIsmData )->delayBuffer_nchan; i++ ) { free( ( *hMasaIsmData )->delayBuffer_fx[i] ); } @@ -389,14 +364,6 @@ ivas_error ivas_omasa_dec_config_fx( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * (1LL << (Q11))); } } - if ((hDecoderConfig->ivas_total_brate < IVAS_24k4) && ((hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2) || (hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3))) - { - for (Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++) - { - floatToFixed_arrL(hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1); - } - floatToFixed_arr(hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS); - } FOR(Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++) { IF(st_ivas->cldfbSynDec[out_ch]) @@ -438,16 +405,6 @@ ivas_error ivas_omasa_dec_config_fx( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ((float)(st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i]) / (1LL << (Q11))); /*Rounding off*/ } } - // fix2float (to be cleaned) - IF((LT_32(hDecoderConfig->ivas_total_brate, IVAS_24k4)) && ((EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2)) || (EQ_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3)))) - { - fixedToFloat_arr(hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS); - FOR(Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++) - { - fixedToFloat_arrL(hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1); - } - } - // fix2float end FOR(Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++) { IF(st_ivas->cldfbSynDec[out_ch]) @@ -477,7 +434,7 @@ ivas_error ivas_omasa_dec_config_fx( test(); IF( st_ivas->hMasaIsmData == NULL && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { - IF( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_omasa_data_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -691,7 +648,6 @@ ivas_error ivas_omasa_dec_config_fx( return IVAS_ERR_OK; } #else - ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ @@ -765,17 +721,11 @@ ivas_error ivas_omasa_dec_config( ivas_set_omasa_TC( st_ivas->ism_mode, st_ivas->nchan_ism, &st_ivas->nSCE, &st_ivas->nCPE ); /* re-configure hp20 memories */ -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) { return error; } -#endif + /* reconfigure core-coders for ISMs */ k = 0; while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) @@ -788,17 +738,10 @@ ivas_error ivas_omasa_dec_config( ism_total_brate += sep_object_brate[k - 2][st_ivas->nSCE - 1]; } -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, 1, 2, 0, st_ivas->nSCE > 0 ? sep_object_brate[k - 2][st_ivas->nSCE - 1] : 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, st_ivas->nSCE > 0 ? sep_object_brate[k - 2][st_ivas->nSCE - 1] : 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED if ( ism_mode_old != st_ivas->ism_mode ) { @@ -811,11 +754,7 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->hIsmMetaData[0] == NULL ) { -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_ism_metadata_dec_create_fx( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -827,11 +766,7 @@ ivas_error ivas_omasa_dec_config( ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_ism_metadata_dec_create_fx( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -877,7 +812,7 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Allocate TD renderer for the objects in DISC mode */ - if ((error = ivas_td_binaural_open(st_ivas)) != IVAS_ERR_OK) + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -892,7 +827,6 @@ ivas_error ivas_omasa_dec_config( { /* TD renderer handle */ ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; /* ISM renderer handle + ISM data handle */ @@ -902,11 +836,7 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->renderer_type == RENDERER_DIRAC ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -942,6 +872,7 @@ ivas_error ivas_omasa_dec_config( /*-----------------------------------------------------------------* * CLDFB instances *-----------------------------------------------------------------*/ + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { return error; @@ -952,7 +883,6 @@ ivas_error ivas_omasa_dec_config( *-----------------------------------------------------------------*/ nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; @@ -964,6 +894,7 @@ ivas_error ivas_omasa_dec_config( } #endif + /*--------------------------------------------------------------------------* * ivas_set_surplus_brate_dec() * diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 09bef1197..3ea7685a7 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -412,14 +412,6 @@ ivas_error ivas_osba_render_sf_fx( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( int i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -444,16 +436,6 @@ ivas_error ivas_osba_render_sf_fx( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ } } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( int i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index dea30f1e8..7b3202d6a 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -1729,7 +1729,7 @@ void ivas_ls_setup_conversion_process_mdct( void ivas_ls_setup_conversion_process_mdct_param_mc_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word32 *x_fx[][NB_DIV], - Word16 x_e[MAX_CICP_CHANNELS][NB_DIV] /* i/o: Exponent for output synthesis signal */ + Word16 x_e[CPE_CHANNELS][NB_DIV] /* i/o: Exponent for output synthesis signal */ ) { Word32 targetEnergy_fx[MAX_SFB + 2], dmxEnergy_fx[MAX_SFB + 2]; diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 7267195a8..f058777e0 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -320,14 +320,12 @@ void stereo_dft_dec_core_switching_fx( st->last_core = st->last_core_bfi; } +#ifndef MSAN_FIX IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX - Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); -#else Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, sub( *q, Q11 ) ); -#endif } +#endif IF( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE || ( st->bfi == 1 && st->core == ACELP_CORE && st->con_tcx == 1 ) ) { @@ -339,6 +337,9 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 && st->core != HQ_CORE ) { +#ifdef MSAN_FIX + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); +#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 2, 0, q, q_DFT ); } /* st->p_bpf_noise_buf not updated FOR HQ core -> skip analysis and set input memory to zero */ @@ -478,6 +479,9 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { +#ifdef MSAN_FIX + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); +#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } } @@ -503,6 +507,9 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { +#ifdef MSAN_FIX + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); +#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } @@ -568,6 +575,9 @@ void stereo_dft_dec_core_switching_fx( /* BPF */ IF( st->p_bpf_noise_buf_32 ) { +#ifdef MSAN_FIX + Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( *q, Q11 ) ); +#endif stereo_dft_dec_analyze_fx( hCPE, st->p_bpf_noise_buf_32, DFT_fx, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 0, 0, q, q_DFT ); } @@ -702,14 +712,12 @@ void stereo_dft_dec_core_switching_fx( } } +#ifndef MSAN_FIX IF( st->p_bpf_noise_buf_32 ) { -#ifdef MSAN_FIX - Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, negate( sub( *q, Q11 ) ) ); -#else Scale_sig32( st->p_bpf_noise_buf_32, L_FRAME16k, negate( sub( *q, Q11 ) ) ); -#endif } +#endif return; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 7b1a6c442..561335d86 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1083,14 +1083,6 @@ ivas_error ivas_sba_dec_reconfigure_fx( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -1141,16 +1133,6 @@ ivas_error ivas_sba_dec_reconfigure_fx( } } }*/ - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 5af8a70b8..63c16aa1d 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -330,8 +330,6 @@ ivas_error ivas_spar_md_dec_matrix_open_fx( } } } - hMdDec->mix_mat_dim_0_1 = num_channels; - hMdDec->mix_mat_dim_2 = num_md_sub_frames * IVAS_MAX_NUM_BANDS; if ( ( hMdDec->spar_coeffs.C_re_fx = (Word32 ***) malloc( num_channels * sizeof(Word32 ** ) ) ) == NULL ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 49b4b3b22..04f2452d7 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -782,9 +782,9 @@ typedef struct dirac_output_synthesis_cov_state_structure #ifndef IVAS_FLOAT_FIXED float *cx_old[CLDFB_NO_CHANNELS_MAX]; float *cy_old[CLDFB_NO_CHANNELS_MAX]; -#endif float *mixing_matrix_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res_old[CLDFB_NO_CHANNELS_MAX]; +#endif float *mixing_matrix[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res[CLDFB_NO_CHANNELS_MAX]; #ifdef IVAS_FLOAT_FIXED @@ -883,8 +883,8 @@ typedef struct ivas_param_mc_dec_data_structure int16_t max_param_band_abs_cov; #ifndef IVAS_FLOAT_FIXED float *ls_conv_dmx_matrix; -#endif float *proto_matrix_int; +#endif #ifdef IVAS_FLOAT_FIXED Word16 q_proto_frame_f; Word32 *ls_conv_dmx_matrix_fx; @@ -978,6 +978,10 @@ typedef struct ivas_spar_md_dec_state_t #ifndef IVAS_FLOAT_FIXED float ***mixer_mat; float mixer_mat_prev[MAX_PARAM_SPATIAL_SUBFRAMES + 1][IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; +#else + Word32 ***mixer_mat_fx; /* Q(Q_mixer_mat) */ + Word32 mixer_mat_prev_fx[MAX_PARAM_SPATIAL_SUBFRAMES + 1][IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; /* Q(Q_mixer_mat) */ + Word16 Q_mixer_mat; #endif ivas_spar_md_com_cfg spar_md_cfg; ivas_arith_coeffs_t arith_coeffs; @@ -987,28 +991,18 @@ typedef struct ivas_spar_md_dec_state_t int16_t spar_hoa_md_flag; int16_t spar_hoa_dirac2spar_md_flag; int16_t HOA_md_ind[IVAS_SPAR_MAX_CH]; - +#ifndef IVAS_FLOAT_FIXED float smooth_buf[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; float smooth_fac[IVAS_MAX_NUM_BANDS]; -#ifdef IVAS_FLOAT_FIXED - Word32 smooth_buf_fx[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; - Word16 smooth_fac_fx[IVAS_MAX_NUM_BANDS]; -#endif -#ifndef IVAS_FLOAT_FIXED float mixer_mat_prev2[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; +#else + Word32 smooth_buf_fx[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; /* Q0 */ + Word16 smooth_fac_fx[IVAS_MAX_NUM_BANDS]; /* Q15 */ + Word32 mixer_mat_prev2_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; /* Q(Q_mixer_mat) */ #endif int16_t first_valid_frame; ivas_band_coeffs_t *band_coeffs_prev; int16_t base_band_coeffs_age[IVAS_MAX_NUM_BANDS]; - -#ifdef IVAS_FLOAT_FIXED - Word32 ***mixer_mat_fx; - Word32 mixer_mat_prev_fx[MAX_PARAM_SPATIAL_SUBFRAMES + 1][IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH][IVAS_MAX_NUM_BANDS]; - Word16 mix_mat_dim_0_1; - Word16 mix_mat_dim_2; - Word32 mixer_mat_prev2_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; - Word16 Q_mixer_mat; -#endif } ivas_spar_md_dec_state_t; @@ -1039,17 +1033,19 @@ typedef struct #ifndef IVAS_FLOAT_FIXED float prev_ql[IVAS_PCA_INTERP]; float prev_qr[IVAS_PCA_INTERP]; +#else + Word16 prev_ql_fx[IVAS_PCA_INTERP]; + Word16 prev_qr_fx[IVAS_PCA_INTERP]; #endif int16_t prev_pca_bypass; #ifndef IVAS_FLOAT_FIXED float mem_eigVec_interp[IVAS_PCA_LEN_INTERP_EIG_DEC]; +#else + Word16 mem_eigVec_interp_fx[IVAS_PCA_LEN_INTERP_EIG_DEC]; #endif /* parser output: */ int16_t pca_bypass; int32_t index[2]; - Word16 prev_ql_fx[IVAS_PCA_INTERP]; - Word16 prev_qr_fx[IVAS_PCA_INTERP]; - Word16 mem_eigVec_interp_fx[IVAS_PCA_LEN_INTERP_EIG_DEC]; } PCA_DEC_STATE; @@ -1245,8 +1241,8 @@ typedef struct ivas_lfe_dec_data_structure Word32 prior_out_buffer_fx[L_FRAME48k]; /* Q9 */ #endif - float prevsynth_buf[LFE_PLC_BUFLEN]; #ifndef IVAS_FLOAT_FIXED + float prevsynth_buf[LFE_PLC_BUFLEN]; float *lfe_delay_buf; #else Word32 prevsynth_buf_fx[LFE_PLC_BUFLEN]; /* Q9 */ @@ -1305,7 +1301,11 @@ typedef struct ivas_binaural_rendering_struct #endif /* Variables related to reverberator module */ +#ifndef IVAS_FLOAT_FIXED float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; +#else + Word32 earlyPartEneCorrection_fx[CLDFB_NO_CHANNELS_MAX]; +#endif REVERB_STRUCT_HANDLE hReverb; } BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; @@ -1379,25 +1379,29 @@ typedef struct ivas_masa_ism_data_structure Word32 q_elevation_old_fx[MAX_NUM_OBJECTS]; /* Q22 */ #endif +#ifndef IVAS_FLOAT_FIXED float ismPreprocMatrix[2][2][CLDFB_NO_CHANNELS_MAX]; +#else + Word16 ismPreprocMatrix_fx[2][2][CLDFB_NO_CHANNELS_MAX]; /* Q15 */ +#endif uint8_t objectsMoved; +#ifndef IVAS_FLOAT_FIXED float eneMoveIIR[2][CLDFB_NO_CHANNELS_MAX]; float enePreserveIIR[2][CLDFB_NO_CHANNELS_MAX]; float preprocEneTarget[CLDFB_NO_CHANNELS_MAX]; float preprocEneRealized[CLDFB_NO_CHANNELS_MAX]; - -#ifndef IVAS_FLOAT_FIXED - float **delayBuffer; -#endif -#ifdef IVAS_FLOAT_FIXED - Word32 **delayBuffer_fx; /* Q11 */ - Word16 ismPreprocMatrix_fx[2][2][CLDFB_NO_CHANNELS_MAX]; +#else Word32 eneMoveIIR_fx[2][CLDFB_NO_CHANNELS_MAX]; Word32 enePreserveIIR_fx[2][CLDFB_NO_CHANNELS_MAX]; Word32 preprocEneTarget_fx[CLDFB_NO_CHANNELS_MAX]; Word32 preprocEneRealized_fx[CLDFB_NO_CHANNELS_MAX]; #endif +#ifndef IVAS_FLOAT_FIXED + float **delayBuffer; +#else + Word32 **delayBuffer_fx; /* Q11 */ +#endif int16_t delayBuffer_size; int16_t delayBuffer_nchan; diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index e730824c5..5215ba636 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -54,7 +54,7 @@ static void apply_dmx_weights_fx( CPE_DEC_HANDLE hCPE, Word32 *x[CPE_CHANNELS][N static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, float *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); #endif -static void run_min_stats_fx( Decoder_State **sts, Word32 *x[CPE_CHANNELS][NB_DIV], Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]); +static void run_min_stats_fx( Decoder_State **sts, Word32 *x[CPE_CHANNELS][NB_DIV], Word16 x_e[CPE_CHANNELS][NB_DIV]); /*-------------------------------------------------------------------* * stereo_mdct_dec_stereo() @@ -957,7 +957,7 @@ static void apply_dmx_weights_fx( static void run_min_stats_fx( Decoder_State **sts, Word32 *x[CPE_CHANNELS][NB_DIV], /* i/o: MDCT Spectrum */ - Word16 x_e[MAX_CICP_CHANNELS][NB_DIV] + Word16 x_e[CPE_CHANNELS][NB_DIV] ) { int16_t ch, will_estimate_noise_on_channel[CPE_CHANNELS], save_VAD[CPE_CHANNELS]; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 6ba9a2653..36689712d 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -386,6 +386,9 @@ static ivas_error allocate_CoreCoder_fx( } hf_synth_init_fx( st->hBWE_zero ); +#ifdef MSAN_FIX + set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); +#endif } IF ( st->cldfbAna == NULL ) @@ -3150,7 +3153,7 @@ void stereo_switching_dec( sts[1]->last_L_frame = sts[0]->last_L_frame; - Copy( sts[0]->old_exc_fx, sts[1]->old_exc_fx, L_EXC_MEM_DEC ); + Copy_Scale_sig( sts[0]->old_exc_fx, sts[1]->old_exc_fx, L_EXC_MEM_DEC, sub( sts[1]->Q_exc, sts[0]->Q_exc ) ); Copy( sts[0]->lsf_old_fx, sts[1]->lsf_old_fx, M ); Copy( sts[0]->lsp_old_fx, sts[1]->lsp_old_fx, M ); IF( hCPE->element_mode == IVAS_CPE_MDCT ) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 6f38cbe77..7fe92402c 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1466,9 +1466,27 @@ ivas_error IVAS_DEC_FeedHeadTrackData( } #ifdef IVAS_FLOAT_FIXED - IF((error = ivas_orient_trk_Process_fx(hHeadTrackData->OrientationTracker, orientation, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[subframe_idx])) != IVAS_ERR_OK) + Word32 updateRate_fx = 1677721600; // value is 200 in Q23 + orientation.w_fx = L_shl( orientation.w_fx, Q29 - orientation.q_fact ); + orientation.x_fx = L_shl( orientation.x_fx, Q29 - orientation.q_fact ); + orientation.y_fx = L_shl( orientation.y_fx, Q29 - orientation.q_fact ); + orientation.z_fx = L_shl( orientation.z_fx, Q29 - orientation.q_fact ); + hHeadTrackData->OrientationTracker->refRot.w_fx = L_shl( hHeadTrackData->OrientationTracker->refRot.w_fx, Q29 - hHeadTrackData->OrientationTracker->refRot.q_fact ); + hHeadTrackData->OrientationTracker->refRot.x_fx = L_shl( hHeadTrackData->OrientationTracker->refRot.x_fx, Q29 - hHeadTrackData->OrientationTracker->refRot.q_fact ); + hHeadTrackData->OrientationTracker->refRot.y_fx = L_shl( hHeadTrackData->OrientationTracker->refRot.y_fx, Q29 - hHeadTrackData->OrientationTracker->refRot.q_fact ); + hHeadTrackData->OrientationTracker->refRot.z_fx = L_shl( hHeadTrackData->OrientationTracker->refRot.z_fx, Q29 - hHeadTrackData->OrientationTracker->refRot.q_fact ); + hHeadTrackData->OrientationTracker->absAvgRot.w_fx = L_shl( hHeadTrackData->OrientationTracker->absAvgRot.w_fx, Q29 - hHeadTrackData->OrientationTracker->absAvgRot.q_fact ); + hHeadTrackData->OrientationTracker->absAvgRot.x_fx = L_shl( hHeadTrackData->OrientationTracker->absAvgRot.x_fx, Q29 - hHeadTrackData->OrientationTracker->absAvgRot.q_fact ); + hHeadTrackData->OrientationTracker->absAvgRot.y_fx = L_shl( hHeadTrackData->OrientationTracker->absAvgRot.y_fx, Q29 - hHeadTrackData->OrientationTracker->absAvgRot.q_fact ); + hHeadTrackData->OrientationTracker->absAvgRot.z_fx = L_shl( hHeadTrackData->OrientationTracker->absAvgRot.z_fx, Q29 - hHeadTrackData->OrientationTracker->absAvgRot.q_fact ); + + orientation.q_fact = Q29; + hHeadTrackData->OrientationTracker->refRot.q_fact = Q29; + hHeadTrackData->OrientationTracker->absAvgRot.q_fact = Q29; + + IF( ( error = ivas_orient_trk_Process_fx( hHeadTrackData->OrientationTracker, orientation, updateRate_fx, &hHeadTrackData->Quaternions[subframe_idx] ) ) != IVAS_ERR_OK ) { - return error; + return error; } #else IF( ( error = ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[subframe_idx] ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/swb_bwe_dec_fx.c b/lib_dec/swb_bwe_dec_fx.c index a4e8bc3f9..5773b3010 100644 --- a/lib_dec/swb_bwe_dec_fx.c +++ b/lib_dec/swb_bwe_dec_fx.c @@ -386,7 +386,7 @@ Word16 ivas_wb_bwe_dec_fx( { /* IVAS_fmToDo: wtda() does not support L_FRAME length; thus temporarily resample the signal */ /* IVAS_fmToDo: delay output[] by 1.25ms ? */ - lerp( (Word16 *)output, ysynth_fx, L_FRAME16k, st_fx->L_frame ); + lerp( output, ysynth_fx, L_FRAME16k, st_fx->L_frame ); wtda_fx( ysynth_fx, &new_input_fx_exp, L_wtda_synth_fx, hBWE_FD->L_old_wtda_swb_fx, &hBWE_FD->old_wtda_swb_fx_exp, ALDO_WINDOW, ALDO_WINDOW, /*st->L_frame*/ L_FRAME16k ); *Qpost = sub( new_input_fx_exp, 15 ); diff --git a/lib_enc/gp_clip_fx.c b/lib_enc/gp_clip_fx.c index 39ad250b5..7bffed0bf 100644 --- a/lib_enc/gp_clip_fx.c +++ b/lib_enc/gp_clip_fx.c @@ -317,7 +317,7 @@ void gp_clip_test_gain_pit_fx( * - target energy drops by 6 dB AND a good pitch prediction (lp_gp>1.0) *-------------------------------------------------------------------*/ Word16 Mode2_gp_clip( - const Word16 voicing[3], /* i : normalized correlations from OL pitch Q15 */ + const Word16 *voicing, /* i : normalized correlations from OL pitch Q15 */ const Word16 i_subfr, /* i : subframe index */ const Word16 coder_type, /* i : type of coder */ const Word16 xn[], /* i : target vector Q_xn */ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 9fa5649ac..743fafd61 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -2169,7 +2169,7 @@ void spec_center_fx( void spec_flatness_fx(Word32 *spec_amp, /*(i) spectral amplitude*/ Word32 smooth_spec_amp[], /*(i) smoothed spectral amplitude*/ - Word16 sSFM[5] /*(o) spectral flatness rate*/ + Word16 sSFM[SFM_NUM] /*(o) spectral flatness rate*/ ); void SetModeIndex_fx( diff --git a/lib_enc/spec_flatness_fx.c b/lib_enc/spec_flatness_fx.c index 115e86545..03b920107 100644 --- a/lib_enc/spec_flatness_fx.c +++ b/lib_enc/spec_flatness_fx.c @@ -21,7 +21,7 @@ void spec_flatness_fx( Word32 *spec_amp, /* i : spectral amplitude*/ Word32 smooth_spec_amp[], /* i : smoothed spectral amplitude*/ - Word16 sSFM[ ] /* o : spectral flatness rate*/ + Word16 sSFM[SFM_NUM] /* o : spectral flatness rate*/ ) { Word32 i; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 9dc46a56e..39d7df4e5 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -5415,7 +5415,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( return; } -#endif +#else /*-------------------------------------------------------------------* * ivas_omasa_preProcessStereoTransportsForMovedObjects() * @@ -5509,45 +5509,25 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects( { float panGainsOut[2]; float panGainsIn[2]; -#ifdef IVAS_FLOAT_FIXED - Word16 panGainsOut_fx[2]; - Word16 panGainsIn_fx[2]; -#endif - float ratio_float; + float ratio; float panEnesOut[2]; float panEnesIn[2]; float centeringFactor; - ratio_float = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; + ratio = hMasaIsmData->energy_ratio_ism[ismDirIndex][dirac_read_idx][bin]; - ismRatioAcc += ratio_float; + ismRatioAcc += ratio; /* Get input and output panning gains */ -#ifdef IVAS_FLOAT_FIXED - ivas_get_stereo_panning_gains_fx( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], - hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], - panGainsIn_fx ); - panGainsIn[0] = (float) panGainsIn_fx[0] / 32767; - panGainsIn[1] = (float) panGainsIn_fx[1] / 32767; -#else ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism[ismDirIndex][dirac_read_idx], hMasaIsmData->elevation_ism[ismDirIndex][dirac_read_idx], panGainsIn ); -#endif if ( hMasaIsmData->ism_is_edited[ismDirIndex] ) { -#ifdef IVAS_FLOAT_FIXED - ivas_get_stereo_panning_gains_fx( hMasaIsmData->azimuth_ism_edited[ismDirIndex], - hMasaIsmData->elevation_ism_edited[ismDirIndex], - panGainsOut_fx ); - panGainsOut[0] = (float) panGainsOut_fx[0] / 32767; - panGainsOut[1] = (float) panGainsOut_fx[1] / 32767; -#else ivas_get_stereo_panning_gains( hMasaIsmData->azimuth_ism_edited[ismDirIndex], hMasaIsmData->elevation_ism_edited[ismDirIndex], panGainsOut ); -#endif } else { @@ -5582,11 +5562,11 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects( eneMoveThis = fmaxf( 0.0f, panEnesIn[ch] - panEnesOut[ch] ); enePreserveThis = panEnesIn[ch] - eneMoveThis; - eneMove[ch] += ratio_float * eneMoveThis; - enePreserve[ch] += ratio_float * enePreserveThis; + eneMove[ch] += ratio * eneMoveThis; + enePreserve[ch] += ratio * enePreserveThis; /* Subtract object parts from normEnes */ - normEnes[ch] -= panEnesIn[ch] * ratio_float; + normEnes[ch] -= panEnesIn[ch] * ratio; } } @@ -5660,6 +5640,8 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects( return; } +#endif + #ifndef IVAS_FLOAT_FIXED static void ivas_masa_ext_rend_parambin_internal( @@ -5680,14 +5662,6 @@ static void ivas_masa_ext_rend_parambin_internal( int16_t i, j; int16_t nchan_transport; -#ifdef IVAS_FLOAT_FIXED - Word32 *output_fx[MAX_OUTPUT_CHANNELS]; - Word32 output_fx_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 Cldfb_RealBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_in_fx[6][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 Rmat_fx[3][3]; -#endif - hDiracDecBin = hMasaExtRend->hDiracDecBin; assert( hDiracDecBin ); hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; @@ -5708,28 +5682,7 @@ static void ivas_masa_ext_rend_parambin_internal( /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; -#ifdef IVAS_FLOAT_FIXED - Rmat_fx[0][0] = ONE_IN_Q31; - move32(); - Rmat_fx[0][1] = 0; - move32(); - Rmat_fx[0][2] = 0; - move32(); - - Rmat_fx[1][0] = 0; - move32(); - Rmat_fx[1][1] = ONE_IN_Q31; - move32(); - Rmat_fx[1][2] = 0; - move32(); - Rmat_fx[2][0] = 0; - move32(); - Rmat_fx[2][1] = 0; - move32(); - Rmat_fx[2][2] = ONE_IN_Q31; - move32(); -#endif Rmat[0][0] = 1.0f; Rmat[0][1] = 0.0f; Rmat[0][2] = 0.0f; @@ -5774,221 +5727,32 @@ static void ivas_masa_ext_rend_parambin_internal( { for ( j = 0; j < 3; j++ ) { -#ifdef IVAS_FLOAT_FIXED - Rmat_fx[i][j] = hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][i][j]; // Q30// -#endif Rmat[i][j] = hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][i][j]; } } - IF( EQ_16( nchan_transport, 2 ) ) + if ( nchan_transport == 2 ) { -#ifdef IVAS_FLOAT_FIXED - Word16 q_inp = Q6; - FOR( Word16 cha = 0; cha < 2; cha++ ) - FOR( slot = 0; slot < 4; slot++ ) - FOR( Word16 ind = 0; ind < 60; ind++ ) - { - Cldfb_RealBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_RealBuffer_in[cha][slot][ind], q_inp ); - Cldfb_ImagBuffer_in_fx[cha][slot][ind] = float_to_fix( Cldfb_ImagBuffer_in[cha][slot][ind], q_inp ); - } - adaptTransportSignalsHeadtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); - - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( hCombinedOrientationData, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat_fx ); - FOR( Word16 cha = 0; cha < 2; cha++ ) - FOR( slot = 0; slot < 4; slot++ ) - FOR( Word16 ind = 0; ind < 60; ind++ ) - { - Cldfb_RealBuffer_in[cha][slot][ind] = fix_to_float( Cldfb_RealBuffer_in_fx[cha][slot][ind], q_inp ); - Cldfb_ImagBuffer_in[cha][slot][ind] = fix_to_float( Cldfb_ImagBuffer_in_fx[cha][slot][ind], q_inp ); - } -#else adaptTransportSignalsHeadtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( hCombinedOrientationData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hSpatParamRendCom->subframe_nbslots[subframe], Rmat ); -#endif - } - } - -#ifdef IVAS_FLOAT_FIXED -#if 1 - Word16 q_earlyPartEneCorrection = Q_factor_arrL( hDiracDecBin->earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); - hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; - floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); - FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) - { - f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); - f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); - f2me( hDiracDecBin->ChCrossReOutPrev[j], &hDiracDecBin->ChCrossReOutPrev_fx[j], &hDiracDecBin->ChCrossReOutPrev_e[j] ); - f2me( hDiracDecBin->ChCrossImOutPrev[j], &hDiracDecBin->ChCrossImOutPrev_fx[j], &hDiracDecBin->ChCrossImOutPrev_e[j] ); - FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - f2me( hDiracDecBin->ChEnePrev[i][j], &hDiracDecBin->ChEnePrev_fx[i][j], &hDiracDecBin->ChEnePrev_e[i][j] ); - f2me( hDiracDecBin->ChEneOutPrev[i][j], &hDiracDecBin->ChEneOutPrev_fx[i][j], &hDiracDecBin->ChEneOutPrev_e[i][j] ); - } - } - FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - IF( hSpatParamRendCom->energy_ratio1 ) - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[i], hSpatParamRendCom->energy_ratio1_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); - IF( hSpatParamRendCom->energy_ratio2 ) - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[i], hSpatParamRendCom->energy_ratio2_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); - } - floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, 31, hSpatParamRendCom->num_freq_bands ); - IF( hDiracDecBin->hDiffuseDist ) - { - floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioX, hDiracDecBin->hDiffuseDist->diffuseRatioX_fx, 31, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceX, hDiracDecBin->diffuseFieldCoherenceX_fx, 31, 9 ); - floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioY, hDiracDecBin->hDiffuseDist->diffuseRatioY_fx, 31, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceY, hDiracDecBin->diffuseFieldCoherenceY_fx, 31, 9 ); - floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioZ, hDiracDecBin->hDiffuseDist->diffuseRatioZ_fx, 31, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceZ, hDiracDecBin->diffuseFieldCoherenceZ_fx, 31, 9 ); - } - config_data.qualityBasedSmFactor_fx = (Word32) ( config_data.qualityBasedSmFactor * ONE_IN_Q31 ); -#endif - Word16 shift = 31; - Word32 Cldfb_RealBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Cldfb_ImagBuffer_inTmp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - FOR( i = 0; i < 2; i++ ) - { - FOR( j = 0; j < 4; j++ ) - { - shift = s_min(shift, getScaleFactor32(Cldfb_RealBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); - shift = s_min(shift, getScaleFactor32(Cldfb_ImagBuffer_in_fx[i][j], CLDFB_NO_CHANNELS_MAX)); - } - } - - Word16 q = q_inp + shift; - - FOR( i = 0; i < 2; i++ ) - { - FOR( j = 0; j < 4; j++ ) - { - FOR( Word16 k = 0; k < 60; k++ ) - { - Cldfb_RealBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_RealBuffer_in_fx[i][j][k], shift ); - Cldfb_ImagBuffer_inTmp_fx[i][j][k] = L_shl( Cldfb_ImagBuffer_in_fx[i][j][k], shift ); - } } } - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, Rmat_fx, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL, q ); -#if 1 - FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) - { - hDiracDecBin->ChEnePrev[i][j] = me2f( hDiracDecBin->ChEnePrev_fx[i][j], hDiracDecBin->ChEnePrev_e[i][j] ); - hDiracDecBin->ChEne[i][j] = me2f( hDiracDecBin->ChEne_fx[i][j], hDiracDecBin->ChEne_e[i][j] ); - hDiracDecBin->ChEneOut[i][j] = me2f( hDiracDecBin->ChEneOut_fx[i][j], hDiracDecBin->ChEneOut_e[i][j] ); - hDiracDecBin->ChEneOutPrev[i][j] = me2f( hDiracDecBin->ChEneOutPrev_fx[i][j], hDiracDecBin->ChEneOutPrev_e[i][j] ); - } - } - - FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) - { - hDiracDecBin->ChCrossRePrev[j] = me2f( hDiracDecBin->ChCrossRePrev_fx[j], hDiracDecBin->ChCrossRePrev_e[j] ); - hDiracDecBin->ChCrossImPrev[j] = me2f( hDiracDecBin->ChCrossImPrev_fx[j], hDiracDecBin->ChCrossImPrev_e[j] ); - hDiracDecBin->ChCrossRe[j] = me2f( hDiracDecBin->ChCrossRe_fx[j], hDiracDecBin->ChCrossRe_e[j] ); - hDiracDecBin->ChCrossIm[j] = me2f( hDiracDecBin->ChCrossIm_fx[j], hDiracDecBin->ChCrossIm_e[j] ); - hDiracDecBin->ChCrossReOut[j] = me2f( hDiracDecBin->ChCrossReOut_fx[j], hDiracDecBin->ChCrossReOut_e[j] ); - hDiracDecBin->ChCrossImOut[j] = me2f( hDiracDecBin->ChCrossImOut_fx[j], hDiracDecBin->ChCrossImOut_e[j] ); - hDiracDecBin->ChCrossReOutPrev[j] = me2f( hDiracDecBin->ChCrossReOutPrev_fx[j], hDiracDecBin->ChCrossReOutPrev_e[j] ); - hDiracDecBin->ChCrossImOutPrev[j] = me2f( hDiracDecBin->ChCrossImOutPrev_fx[j], hDiracDecBin->ChCrossImOutPrev_e[j] ); - } - fixedToFloat_arrL( hDiracDecBin->frameMeanDiffuseness_fx, hDiracDecBin->frameMeanDiffuseness, 29, CLDFB_NO_CHANNELS_MAX ); - -#endif -#else ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL ); -#endif + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, NULL ); + /* Always using CLDFB decorrelation in MASA EXT renderer */ max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; - ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, - 0, NULL ); - - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef IVAS_FLOAT_FIXED - Word16 q_out; - Word16 q_mat = 15; - q_inp = Q6; - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - output_fx[ch] = output_fx_buff[ch]; - } - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - FOR( slot = 0; slot < BINAURAL_CHANNELS; slot++ ) - { - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecRe[ch][slot], nBins ) ); - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecIm[ch][slot], nBins ) ); - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecRePrev[ch][slot], nBins ) ); - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxDecImPrev[ch][slot], nBins ) ); - } - } - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - FOR( slot = 0; slot < numInChannels; slot++ ) - { - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxRe[ch][slot], nBins ) ); - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxIm[ch][slot], nBins ) ); - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxRePrev[ch][slot], nBins ) ); - q_mat = s_min( q_mat, Q_factor_arr( hDiracDecBin->processMtxImPrev[ch][slot], nBins ) ); - } - } - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - output_fx[ch] = output_fx_buff[ch]; - } - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - FOR( slot = 0; slot < BINAURAL_CHANNELS; slot++ ) - { - floatToFixed_arr16( hDiracDecBin->processMtxDecRe[ch][slot], hDiracDecBin->processMtxDecRe_fx[ch][slot], q_mat, nBins ); - floatToFixed_arr16( hDiracDecBin->processMtxDecIm[ch][slot], hDiracDecBin->processMtxDecIm_fx[ch][slot], q_mat, nBins ); - floatToFixed_arr16( hDiracDecBin->processMtxDecRePrev[ch][slot], hDiracDecBin->processMtxDecRePrev_fx[ch][slot], q_mat, nBins ); - floatToFixed_arr16( hDiracDecBin->processMtxDecImPrev[ch][slot], hDiracDecBin->processMtxDecImPrev_fx[ch][slot], q_mat, nBins ); - } - } - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - FOR( slot = 0; slot < numInChannels; slot++ ) - { - floatToFixed_arr16( hDiracDecBin->processMtxRe[ch][slot], hDiracDecBin->processMtxRe_fx[ch][slot], q_mat, nBins ); - floatToFixed_arr16( hDiracDecBin->processMtxIm[ch][slot], hDiracDecBin->processMtxIm_fx[ch][slot], q_mat, nBins ); - floatToFixed_arr16( hDiracDecBin->processMtxRePrev[ch][slot], hDiracDecBin->processMtxRePrev_fx[ch][slot], q_mat, nBins ); - floatToFixed_arr16( hDiracDecBin->processMtxImPrev[ch][slot], hDiracDecBin->processMtxImPrev_fx[ch][slot], q_mat, nBins ); - } - floatToFixed_arrL( hMasaExtRend->cldfbSynRend[ch]->cldfb_state, hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx, Q11, hMasaExtRend->cldfbSynRend[ch]->p_filter_length ); - hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state = Q11; - } - FOR( Word16 cha = 0; cha < 6; cha++ ) - FOR( slot = 0; slot < 4; slot++ ) - FOR( Word16 ind = 0; ind < 60; ind++ ) - { - Cldfb_RealBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_RealBuffer_in[cha][slot][ind], Q6 ); - Cldfb_ImagBuffer_in_fx[cha][slot][ind] = floatToFixed( Cldfb_ImagBuffer_in[cha][slot][ind], Q6 ); - } - ivas_dirac_dec_binaural_process_output_fx( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_fx, &q_out, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_inp, max_band_decorr, numInChannels, config_data.processReverb, subframe, q_mat ); + ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, + 0, NULL ); - FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - fixedToFloat_arrL32( output_fx[ch], output_f[ch], q_out, nBins * hSpatParamRendCom->subframe_nbslots[subframe] ); - fixedToFloat_arrL32( hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx, hMasaExtRend->cldfbSynRend[ch]->cldfb_state, hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state, hMasaExtRend->cldfbSynRend[ch]->p_filter_length ); - } -#else ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, hMasaExtRend->cldfbSynRend, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, config_data.processReverb, subframe ); -#endif - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - hDiracDecBin->hDiffuseDist = NULL; @@ -5996,7 +5760,7 @@ static void ivas_masa_ext_rend_parambin_internal( hSpatParamRendCom->subframes_rendered++; return; - } +} #else static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtRend, @@ -6045,11 +5809,8 @@ static void ivas_masa_ext_rend_parambin_internal( floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, 31, hSpatParamRendCom->num_freq_bands ); IF( hDiracDecBin->hDiffuseDist ) { - floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioX, hDiracDecBin->hDiffuseDist->diffuseRatioX_fx, 31, hSpatParamRendCom->num_freq_bands ); floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceX, hDiracDecBin->diffuseFieldCoherenceX_fx, 31, 9 ); - floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioY, hDiracDecBin->hDiffuseDist->diffuseRatioY_fx, 31, hSpatParamRendCom->num_freq_bands ); floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceY, hDiracDecBin->diffuseFieldCoherenceY_fx, 31, 9 ); - floatToFixed_arr32( hDiracDecBin->hDiffuseDist->diffuseRatioZ, hDiracDecBin->hDiffuseDist->diffuseRatioZ_fx, 31, hSpatParamRendCom->num_freq_bands ); floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherenceZ, hDiracDecBin->diffuseFieldCoherenceZ_fx, 31, 9 ); } FOR( ch = 0; ch < 2; ch++) diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 44c665e1b..172c4d30c 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -65,6 +65,7 @@ * *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static IVAS_QUATERNION IdentityQuaternion( void ) { @@ -75,8 +76,7 @@ static IVAS_QUATERNION IdentityQuaternion( return q; } - -#ifdef IVAS_FLOAT_FIXED +#else static IVAS_QUATERNION IdentityQuaternion_fx( void ) { @@ -96,6 +96,7 @@ static IVAS_QUATERNION IdentityQuaternion_fx( * Quaternion product *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void QuaternionProduct( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, @@ -111,8 +112,7 @@ void QuaternionProduct( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void QuaternionProduct_fx( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, @@ -138,14 +138,14 @@ void QuaternionProduct_fx( * Quaternion dot product *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float QuaternionDotProduct( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2 ) { return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; } - -#ifdef IVAS_FLOAT_FIXED +#else static Word32 QuaternionDotProduct_fx( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, @@ -168,6 +168,7 @@ static Word32 QuaternionDotProduct_fx( * Divides a quaternion by a scalar *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void QuaternionDivision( const IVAS_QUATERNION q, const float d, @@ -180,8 +181,7 @@ static void QuaternionDivision( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void QuaternionDivision_fx( const IVAS_QUATERNION q, const Word32 d, @@ -223,6 +223,7 @@ static void QuaternionDivision_fx( * Normalizes a quaternion *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void QuaternionNormalize( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) @@ -232,8 +233,7 @@ static void QuaternionNormalize( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void QuaternionNormalize_fx( const IVAS_QUATERNION q_fx, IVAS_QUATERNION *const r_fx ) @@ -419,6 +419,7 @@ void QuaternionSlerp_fx( * Computes a quaternion conjugate *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void QuaternionConjugate( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) @@ -430,8 +431,7 @@ static void QuaternionConjugate( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void QuaternionConjugate_fx( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) @@ -466,9 +466,7 @@ static float QuaternionAngle( return angle; } -#endif - -#ifdef IVAS_FLOAT_FIXED +#else static Word32 QuaternionAngle_fx( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2 ) @@ -533,6 +531,7 @@ static Word32 QuaternionAngle_fx( * Computes an inverse quaternion *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void QuaternionInverse( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) @@ -545,8 +544,7 @@ void QuaternionInverse( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void QuaternionInverse_fx( const IVAS_QUATERNION q, IVAS_QUATERNION *const r ) @@ -568,6 +566,7 @@ void QuaternionInverse_fx( * Computes the difference of two vectors *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static IVAS_VECTOR3 VectorSubtract( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) @@ -580,8 +579,7 @@ static IVAS_VECTOR3 VectorSubtract( return result; } - -#ifdef IVAS_FLOAT_FIXED +#else static IVAS_VECTOR3 VectorSubtract_fx( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) @@ -614,6 +612,7 @@ static IVAS_VECTOR3 VectorSubtract_fx( * Computes the cross product of two vectors *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static IVAS_VECTOR3 VectorCrossProduct( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) @@ -625,8 +624,7 @@ static IVAS_VECTOR3 VectorCrossProduct( return result; } - -#ifdef IVAS_FLOAT_FIXED +#else static IVAS_VECTOR3 VectorCrossProduct_fx( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) @@ -648,14 +646,14 @@ static IVAS_VECTOR3 VectorCrossProduct_fx( * Computes the dot product of two vectors *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float VectorDotProduct( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2 ) { return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z; } - -#ifdef IVAS_FLOAT_FIXED +#else static Word32 VectorDotProduct_fx( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2, @@ -676,13 +674,13 @@ static Word32 VectorDotProduct_fx( * Computes the length of a vector *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float VectorLength( const IVAS_VECTOR3 p ) { return sqrtf( p.x * p.x + p.y * p.y + p.z * p.z ); } - -#ifdef IVAS_FLOAT_FIXED +#else static Word32 VectorLength_fx( IVAS_VECTOR3 p, Word16 *q_fact ) @@ -701,6 +699,7 @@ static Word32 VectorLength_fx( * Normalizes a vector *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static IVAS_VECTOR3 VectorNormalize( const IVAS_VECTOR3 p ) { @@ -714,8 +713,7 @@ static IVAS_VECTOR3 VectorNormalize( return result; } - -#ifdef IVAS_FLOAT_FIXED +#else static IVAS_VECTOR3 VectorNormalize_fx( const IVAS_VECTOR3 p ) { @@ -749,6 +747,7 @@ static IVAS_VECTOR3 VectorNormalize_fx( * Computes a quaternion representing the rotation from vector p1 to vector p2 *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void VectorRotationToQuaternion( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2, @@ -761,7 +760,6 @@ static void VectorRotationToQuaternion( p2_normalized = VectorNormalize( p2 ); cross_product = VectorCrossProduct( p1_normalized, p2_normalized ); dot_product = VectorDotProduct( p1_normalized, p2_normalized ); - if ( dot_product < -0.999999 ) { /* happens when the p1 vector is parallel to p2, but direction is flipped */ @@ -783,8 +781,7 @@ static void VectorRotationToQuaternion( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void VectorRotationToQuaternion_fx( const IVAS_VECTOR3 p1, const IVAS_VECTOR3 p2, @@ -800,9 +797,8 @@ static void VectorRotationToQuaternion_fx( dot_product_fx = VectorDotProduct_fx( p1_normalized_fx, p2_normalized_fx, &q_dot ); // dot & cross product are same q// - Word32 comp_fx = 0; - Word16 comp_e, check_flag; - f2me( -0.999999f, &comp_fx, &comp_e ); + Word32 comp_fx = -2147481472;//-0.999999f in Q31 + Word16 comp_e = 0, check_flag; IF( GT_32( dot_product_fx, 0 ) ) { check_flag = 0; @@ -884,12 +880,10 @@ ivas_error ivas_orient_trk_Init_fx( { IVAS_QUATERNION identity_fx; - //===================Remove float code once caller function is converted to fixed=================// IF ( pOTR == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - identity_fx.w_fx = ONE_IN_Q31; identity_fx.x_fx = identity_fx.y_fx = identity_fx.z_fx = 0; identity_fx.q_fact = Q31; @@ -905,6 +899,7 @@ ivas_error ivas_orient_trk_Init_fx( /* initial adaptivity filter coefficient, will be auto-adapted */ // pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ pOTR->alpha_fx = 33731208; // Q31 + pOTR->Q_alpha = Q31; pOTR->trkRot = identity_fx; pOTR->absAvgRot = identity_fx; /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ @@ -913,12 +908,6 @@ ivas_error ivas_orient_trk_Init_fx( // this part still float// /* set safe default tracking mode */ pOTR->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; - pOTR->alpha = me2f(pOTR->alpha_fx, 0 ); - pOTR->refRot.w = pOTR->absAvgRot.w = pOTR->trkRot.w = fix_to_float(pOTR->trkRot.w_fx, pOTR->trkRot.q_fact); - pOTR->refRot.x = pOTR->absAvgRot.x = pOTR->trkRot.x = fix_to_float(pOTR->trkRot.x_fx, pOTR->trkRot.q_fact); - pOTR->refRot.y = pOTR->absAvgRot.y = pOTR->trkRot.y = fix_to_float(pOTR->trkRot.y_fx, pOTR->trkRot.q_fact); - pOTR->refRot.z = pOTR->absAvgRot.z = pOTR->trkRot.z = fix_to_float(pOTR->trkRot.z_fx, pOTR->trkRot.q_fact); - return IVAS_ERR_OK; } #endif @@ -1019,6 +1008,7 @@ ivas_error ivas_orient_trk_SetReferenceRotation( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_orient_trk_GetMainOrientation( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION *pOrientation /* i/o: average/reference orientation */ @@ -1046,8 +1036,7 @@ ivas_error ivas_orient_trk_GetMainOrientation( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_orient_trk_GetMainOrientation_fx( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION *pOrientation /* i/o: average/reference orientation */ @@ -1122,6 +1111,7 @@ ivas_error ivas_orient_trk_GetTrackedRotation_fx( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_orient_trk_SetReferenceVector( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ @@ -1173,8 +1163,7 @@ ivas_error ivas_orient_trk_SetReferenceVector( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_orient_trk_SetReferenceVector_fx( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ @@ -1339,43 +1328,23 @@ ivas_error ivas_orient_trk_Process( ivas_error ivas_orient_trk_Process_fx( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION absRot, /* i : absolute head rotation */ - float updateRate, /* i : rotation update rate [Hz] */ + Word32 updateRate_fx, /* i : rotation update rate [Hz] */ IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ) { - //===================Remove float code once caller function is converted to fixed=================// - float alpha = pOTR->alpha; ivas_error result; - Word32 updateRate_fx; Word32 rateRange_fx; Word32 cutoffFrequency_fx, cutoff_prod; Word16 q_cutoff_prod = 0; - Word32 alpha_fx = float_to_fix( alpha, Q30 ); - pOTR->refRot.q_fact = Q29; - absRot.q_fact = Q29; - pOTR->absAvgRot.q_fact = Q29; - updateRate_fx = float_to_fix( updateRate, Q23 ); // value is 200// - absRot.w_fx = float_to_fix( absRot.w, absRot.q_fact); - absRot.x_fx = float_to_fix( absRot.x, absRot.q_fact); - absRot.y_fx = float_to_fix( absRot.y, absRot.q_fact); - absRot.z_fx = float_to_fix( absRot.z, absRot.q_fact); - pOTR->refRot.w_fx = float_to_fix( pOTR->refRot.w, pOTR->refRot.q_fact); - pOTR->refRot.x_fx = float_to_fix( pOTR->refRot.x, pOTR->refRot.q_fact); - pOTR->refRot.y_fx = float_to_fix( pOTR->refRot.y, pOTR->refRot.q_fact); - pOTR->refRot.z_fx = float_to_fix( pOTR->refRot.z, pOTR->refRot.q_fact); - pOTR->absAvgRot.w_fx = float_to_fix( pOTR->absAvgRot.w, pOTR->absAvgRot.q_fact); - pOTR->absAvgRot.x_fx = float_to_fix( pOTR->absAvgRot.x, pOTR->absAvgRot.q_fact); - pOTR->absAvgRot.y_fx = float_to_fix( pOTR->absAvgRot.y, pOTR->absAvgRot.q_fact); - pOTR->absAvgRot.z_fx = float_to_fix( pOTR->absAvgRot.z, pOTR->absAvgRot.q_fact); - - IF ( pOTR == NULL || pTrkRot == NULL ) + Word32 alpha_fx = L_shl( pOTR->alpha_fx, Q30 - pOTR->Q_alpha ); + IF( pOTR == NULL || pTrkRot == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } result = IVAS_ERR_OK; - SWITCH ( pOTR->orientation_tracking ) + SWITCH( pOTR->orientation_tracking ) { case IVAS_HEAD_ORIENT_TRK_NONE: pOTR->trkRot = absRot; @@ -1396,7 +1365,6 @@ ivas_error ivas_orient_trk_Process_fx( /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse_fx( pOTR->refRot, &pOTR->trkRot ); QuaternionProduct_fx( pOTR->trkRot, absRot, &pOTR->trkRot ); - ; BREAK; case IVAS_HEAD_ORIENT_TRK_AVG: @@ -1411,8 +1379,8 @@ ivas_error ivas_orient_trk_Process_fx( Word16 result_e = 0; Word16 temp_result = BASOP_Util_Divide3232_Scale( angle_fx, pOTR->adaptationAngle_fx, &result_e ); relativeOrientationRate_fx = L_deposit_h( temp_result ); - Word32 one_fx; - Word16 temp = result_e; + Word32 one_fx = 1073741824; + Word16 temp = 1; f2me( 1.0, &one_fx, &temp ); IF( GT_32( relativeOrientationRate_fx, one_fx ) ) { @@ -1446,26 +1414,17 @@ ivas_error ivas_orient_trk_Process_fx( temp_result = BASOP_Util_Divide3232_Scale( cutoff_prod, updateRate_fx, &result_e ); result_e = result_e + ( 23 - q_cutoff_prod ); pOTR->alpha_fx = L_deposit_h( temp_result ); - pOTR->alpha = me2f( pOTR->alpha_fx, result_e ); // Remove this floating code// + pOTR->Q_alpha = Q31 - result_e; BREAK; default: result = IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); BREAK; } - IF ( result == IVAS_ERR_OK ) + if ( result == IVAS_ERR_OK ) { - pOTR->trkRot.w = me2f( pOTR->trkRot.w_fx, 31 - pOTR->trkRot.q_fact ); - pOTR->trkRot.x = me2f( pOTR->trkRot.x_fx, 31 - pOTR->trkRot.q_fact); - pOTR->trkRot.y = me2f( pOTR->trkRot.y_fx, 31 - pOTR->trkRot.q_fact); - pOTR->trkRot.z = me2f( pOTR->trkRot.z_fx, 31 - pOTR->trkRot.q_fact); - pOTR->absAvgRot.w = me2f( pOTR->absAvgRot.w_fx, 31 - pOTR->absAvgRot.q_fact); - pOTR->absAvgRot.x = me2f( pOTR->absAvgRot.x_fx, 31 - pOTR->absAvgRot.q_fact); - pOTR->absAvgRot.y = me2f( pOTR->absAvgRot.y_fx, 31 - pOTR->absAvgRot.q_fact); - pOTR->absAvgRot.z = me2f( pOTR->absAvgRot.z_fx, 31 - pOTR->absAvgRot.q_fact); *pTrkRot = pOTR->trkRot; } - return result; } #endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ea57f5e9e..491286d4c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -2503,19 +2503,13 @@ ivas_error ivas_render_config_init_from_rom( * Quaternion operations *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void QuaternionProduct( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2, IVAS_QUATERNION *const r ); -#ifdef IVAS_FLOAT_FIXED -void QuaternionProduct_fx( - const IVAS_QUATERNION q1, - const IVAS_QUATERNION q2, - IVAS_QUATERNION *const r); -#endif - void QuaternionInverse( const IVAS_QUATERNION q, IVAS_QUATERNION *const r @@ -2527,8 +2521,13 @@ void QuaternionSlerp( const float t, IVAS_QUATERNION *const r ); +#else +void QuaternionProduct_fx( + const IVAS_QUATERNION q1, + const IVAS_QUATERNION q2, + IVAS_QUATERNION *const r +); -#ifdef IVAS_FLOAT_FIXED void QuaternionInverse_fx( const IVAS_QUATERNION q, IVAS_QUATERNION *const r @@ -2560,6 +2559,7 @@ ivas_error ivas_orient_trk_SetReferenceRotation( const IVAS_QUATERNION refRot /* i : reference rotation */ ); +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_orient_trk_SetReferenceVector( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ @@ -2570,6 +2570,7 @@ ivas_error ivas_orient_trk_GetMainOrientation( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION *pOrientation /* i/o: average/reference orientation */ ); +#endif ivas_error ivas_orient_trk_GetTrackedRotation( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ @@ -2618,7 +2619,7 @@ ivas_error ivas_orient_trk_GetTrackedRotation_fx( ivas_error ivas_orient_trk_Process_fx( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ IVAS_QUATERNION absRot, /* i : absolute head rotation */ - float updateRate, /* i : rotation update rate [Hz] */ + Word32 updateRate_fx, /* i : rotation update rate [Hz] */ IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index fef1c9987..2f3ad8378 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -345,6 +345,7 @@ typedef struct dirac_output_synthesis_params_structure #ifdef IVAS_FLOAT_FIXED Word32 *proto_matrix_fx; Word16 proto_matrix_e; + Word16 proto_matrix_len; Word32 diffuse_compensation_factor_fx; // Q27 Word32 diffuse_compensation_factor_decorr_fx; // Q29 #endif @@ -804,14 +805,15 @@ typedef struct ivas_binaural_reverb_struct /* Diffuse sound directional distribution data structure */ typedef struct ivas_diffuse_distribution_data_structure { +#ifndef IVAS_FLOAT_FIXED float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; - - Word32 diffuseRatioX_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 diffuseRatioY_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 diffuseRatioZ_fx[CLDFB_NO_CHANNELS_MAX]; - +#else + Word32 diffuseRatioX_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ + Word32 diffuseRatioY_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ + Word32 diffuseRatioZ_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ +#endif } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; @@ -1044,9 +1046,9 @@ typedef struct ivas_orient_trk_state_t float centerAdaptationRate; float offCenterAdaptationRate; float adaptationAngle; + float alpha; #endif - float alpha; #ifdef IVAS_FLOAT_FIXED Word32 centerAdaptationRate_fx; /* Q31 */ Word32 offCenterAdaptationRate_fx; /* Q31 */ @@ -1054,6 +1056,7 @@ typedef struct ivas_orient_trk_state_t #endif Word32 alpha_fx; + Word16 Q_alpha; IVAS_QUATERNION absAvgRot; /* average absolute orientation */ IVAS_QUATERNION refRot; /* reference orientation */ IVAS_QUATERNION trkRot; /* tracked rotation */ @@ -2506,7 +2509,7 @@ typedef struct ivas_masa_prerend_data_structure float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; #ifdef IVAS_FLOAT_FIXED Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES]; #endif } MASA_PREREND_DATA, *MASA_PREREND_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1d745cfb7..6398820da 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2297,7 +2297,6 @@ static ivas_error setRendInputActiveIsm( inputIsm->crendWrapper = NULL; inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); - #ifndef IVAS_FLOAT_FIXED initRotMatrix( inputIsm->rot_mat_prev ); #else @@ -3743,7 +3742,7 @@ static ivas_error initMcBinauralRendering( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, - uint8_t reconfigureFlag) + uint8_t reconfigureFlag ) { ivas_error error; int32_t binauralDelayNs; @@ -3753,49 +3752,49 @@ static ivas_error initMcBinauralRendering( /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) or planar MC layouts with headrotation, CREND for the rest */ useTDRend = FALSE; - if (outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) + if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { - if (inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) + if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { useTDRend = TRUE; } - else if ((inConfig == IVAS_AUDIO_CONFIG_5_1 || inConfig == IVAS_AUDIO_CONFIG_7_1) && - (inputMc->base.ctx.pHeadRotData->headRotEnabled)) + else if ( ( inConfig == IVAS_AUDIO_CONFIG_5_1 || inConfig == IVAS_AUDIO_CONFIG_7_1 ) && + ( inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) { useTDRend = TRUE; } } /* if TD renderer was open and we need to use CREND, close it */ - if (!reconfigureFlag || (!useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL)) + if ( !reconfigureFlag || ( !useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL ) ) { - ivas_td_binaural_close_fx(&inputMc->tdRendWrapper.hBinRendererTd); + ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } /* if we need to use TD renderer and CREND was open, close it */ - if (useTDRend) + if ( useTDRend ) { - ivas_rend_closeCrend(&inputMc->crendWrapper); + ivas_rend_closeCrend( &inputMc->crendWrapper ); } - if (!reconfigureFlag || (!useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL)) + if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) { - ivas_reverb_close(&inputMc->hReverb); + ivas_reverb_close( &inputMc->hReverb ); } - if (!reconfigureFlag || (inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled)) + if ( !reconfigureFlag || ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) { - if (inputMc->efapInWrapper.hEfap != NULL) + if ( inputMc->efapInWrapper.hEfap != NULL ) { - efap_free_data(&inputMc->efapInWrapper.hEfap); + efap_free_data( &inputMc->efapInWrapper.hEfap ); } } outSampleRate = *inputMc->base.ctx.pOutSampleRate; - if (useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL) + if ( useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL ) { #ifdef IVAS_FLOAT_FIXED Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; @@ -3835,73 +3834,73 @@ static ivas_error initMcBinauralRendering( return error; } #endif - if (outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL) + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { #ifdef IVAS_FLOAT_FIXED - if ((error = ivas_reverb_open_fx(&(inputMc->hReverb), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate)) != IVAS_ERR_OK) + if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } #else - if ((error = ivas_reverb_open(&(inputMc->hReverb), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate)) != IVAS_ERR_OK) + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } #endif } } - else if (!useTDRend && inputMc->crendWrapper == NULL) + else if ( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ #ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ - IF(hRendCfg) + IF( hRendCfg ) { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed(hRendCfg->roomAcoustics.acousticPreDelay, 27); - FOR(int i = 0; i < 60; i++) + hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); + FOR( int i = 0; i < 60; i++ ) { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32)(hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32)((hRendCfg->roomAcoustics.pAcoustic_rt60[i]) * ONE_IN_Q26); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32)(hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30); + hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); + hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); + hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); } - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32)(hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32)(hRendCfg->roomAcoustics.dimensions.x * 4194304); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32)(hRendCfg->roomAcoustics.dimensions.y * 4194304); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32)(hRendCfg->roomAcoustics.dimensions.z * 4194304); // Q10.22 + hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); + hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 + hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 + hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - FOR(int ii = 0; ii < 6; ii++) + FOR( int ii = 0; ii < 6; ii++ ) { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32)(hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824); // Q2.30 min :0 max 1 + hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 } - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32)(hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32)(hRendCfg->roomAcoustics.ListenerOrigin.y * (4194304)); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32)(hRendCfg->roomAcoustics.ListenerOrigin.z * (4194304)); + hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); + hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); + hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); } #endif // 1 - if ((error = ivas_rend_openCrend(&inputMc->crendWrapper, (inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate)) != IVAS_ERR_OK) + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } } /* Initialise the EFAP handle for rotation on input layout */ - if (inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL) + if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL ) { - if ((error = initEfap(&inputMc->efapInWrapper, inConfig, NULL)) != IVAS_ERR_OK) + if ( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) { return error; } } /* determine binaural delay ( used for aligning LFE to output signal ) */ - binauralDelayNs = max((inputMc->crendWrapper != NULL) ? inputMc->crendWrapper->binaural_latency_ns : 0, inputMc->tdRendWrapper.binaural_latency_ns); - inputMc->binauralDelaySmp = (int16_t)roundf((float)binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f); + binauralDelayNs = max( ( inputMc->crendWrapper != NULL ) ? inputMc->crendWrapper->binaural_latency_ns : 0, inputMc->tdRendWrapper.binaural_latency_ns ); + inputMc->binauralDelaySmp = (int16_t) roundf( (float) binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f ); - if (inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES) + if ( inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES ) { - return IVAS_ERROR(IVAS_ERR_WRONG_PARAMS, "Invalid delay for LFE binaural rendering!)"); + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid delay for LFE binaural rendering!)" ); } return IVAS_ERR_OK; @@ -3994,7 +3993,6 @@ static ivas_error initMcBinauralRendering( FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) { fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - } Src_p->SrcSpatial_p->q_Pos_p = Q31; } @@ -4072,26 +4070,26 @@ static ivas_error initMcBinauralRendering( static ivas_error initMcMasaRendering( input_mc *inputMc, const AUDIO_CONFIG inConfig, - const Word32 inSampleRate) + const Word32 inSampleRate ) { ivas_error error; - IF (inputMc->tdRendWrapper.hBinRendererTd != NULL) + IF( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { - ivas_td_binaural_close_fx(&inputMc->tdRendWrapper.hBinRendererTd); + ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } - ivas_rend_closeCrend(&inputMc->crendWrapper); + ivas_rend_closeCrend( &inputMc->crendWrapper ); - ivas_reverb_close(&inputMc->hReverb); + ivas_reverb_close( &inputMc->hReverb ); - IF (inputMc->efapInWrapper.hEfap != NULL) + IF( inputMc->efapInWrapper.hEfap != NULL ) { - efap_free_data(&inputMc->efapInWrapper.hEfap); + efap_free_data( &inputMc->efapInWrapper.hEfap ); } - IF ((error = ivas_mcmasa_ana_open(&inputMc->hMcMasa, inConfig, inSampleRate)) != IVAS_ERR_OK) + IF( ( error = ivas_mcmasa_ana_open( &inputMc->hMcMasa, inConfig, inSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -4130,7 +4128,7 @@ static ivas_error initMcMasaRendering( return error; } #ifdef IVAS_FLOAT_FIXED -#if 0 /*Fixed to float conversion for ivas_mcmasa_ana_open (to be removed later)*/ +#if 0 /*Fixed to float conversion for ivas_mcmasa_ana_open (to be removed later)*/ MCMASA_ANA_HANDLE hMcMasa = inputMc->hMcMasa; Word16 i, j; //fixedToFloat_arrL( hMcMasa->ls_azimuth_fx, hMcMasa->ls_azimuth, Q22, MCMASA_MAX_ANA_CHANS ); @@ -4285,21 +4283,21 @@ static ivas_error setRendInputActiveMc( rendCtx = inputMc->base.ctx; outConfig = *rendCtx.pOutConfig; - IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) + IF( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - IF ( ( error = allocateMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) + IF( ( error = allocateMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx, MAX_BIN_DELAY_SAMPLES ) ) != IVAS_ERR_OK ) { return error; } - IF((error = allocateInputBaseBufferData(&inputMc->bufferData, MAX_BUFFER_LENGTH)) != IVAS_ERR_OK) + IF( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } - initRendInputBase(&inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH); + initRendInputBase( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH ); - IF ( ( error = allocateInputBaseBufferData_fx( &inputMc->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF( ( error = allocateInputBaseBufferData_fx( &inputMc->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } @@ -4320,23 +4318,23 @@ static ivas_error setRendInputActiveMc( set_val_Word32( inputMc->lfeDelayBuffer_fx, 0, MAX_BIN_DELAY_SAMPLES ); inputMc->binauralDelaySmp = 0; - IF (EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL) || EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) || EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - IF ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) + IF( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) { return error; } } - IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_MASA1) || EQ_16(outConfig , IVAS_AUDIO_CONFIG_MASA2 )) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { - IF ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - IF ( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) + IF( ( error = updateMcPanGains( inputMc, outConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -4424,7 +4422,7 @@ static void clearInputMc( initRendInputBase_fx( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ - IF ( inputMc->efapInWrapper.hEfap != NULL ) + IF( inputMc->efapInWrapper.hEfap != NULL ) { efap_free_data( &inputMc->efapInWrapper.hEfap ); } @@ -4433,7 +4431,7 @@ static void clearInputMc( ivas_reverb_close( &inputMc->hReverb ); - IF ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) + IF( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; @@ -4800,13 +4798,13 @@ static ivas_error updateSbaPanGains( #ifdef IVAS_FLOAT_FIXED static ivas_error initSbaMasaRendering( input_sba *inputSba, - Word32 inSampleRate) + Word32 inSampleRate ) { ivas_error error; - ivas_rend_closeCrend(&inputSba->crendWrapper); + ivas_rend_closeCrend( &inputSba->crendWrapper ); - IF((error = ivas_dirac_ana_open_fx(&inputSba->hDirAC, inSampleRate)) != IVAS_ERR_OK) + IF( ( error = ivas_dirac_ana_open_fx( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -5049,50 +5047,50 @@ static ivas_error setRendInputActiveMasa( outConfig = *rendCtx.pOutConfig; (void) hRendCfg; /* Suppress warning */ - IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) + IF( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - IF ( ( error = allocateInputBaseBufferData_fx( &inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF( ( error = allocateInputBaseBufferData_fx( &inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } -#if 1/*To be removed later:(contains malloc for inputMasa->bufferData)*/ - IF ( ( error = allocateInputBaseBufferData( &inputMasa->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) +#if 1 /*To be removed later:(contains malloc for inputMasa->bufferData)*/ + IF( ( error = allocateInputBaseBufferData( &inputMasa->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } #endif initRendInputBase_fx( &inputMasa->base, inConfig, id, rendCtx, inputMasa->bufferData_fx, MAX_BUFFER_LENGTH ); - IF ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) + IF( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) { return error; } - IF ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + IF( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { inputMasa->metadataHasBeenFed = false; - IF ( ( error = masaPrerendOpen_fx( &inputMasa->hMasaPrerend, EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA1) ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + IF( ( error = masaPrerendOpen_fx( &inputMasa->hMasaPrerend, EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA1 ) ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) { return error; } } ELSE { - IF ( ( error = initMasaExtRenderer( inputMasa, outConfig ) ) != IVAS_ERR_OK ) + IF( ( error = initMasaExtRenderer( inputMasa, outConfig ) ) != IVAS_ERR_OK ) { return error; } inputMasa->metadataHasBeenFed = false; } -#if 1 /*TODO: To be removed later(fixed to float)*/ +#if 1 /*TODO: To be removed later(fixed to float)*/ IF( inputMasa->hMasaExtRend ) { DIRAC_REND_HANDLE hDirACRend = inputMasa->hMasaExtRend->hDirACRend; - IF ( hDirACRend ) + IF( hDirACRend ) { FOR( int i = 0; i < hDirACRend->num_outputs_dir; i++ ) { @@ -5101,8 +5099,8 @@ static ivas_error setRendInputActiveMasa( IF( hDirACRend->hoa_encoder_fx ) fixedToFloat_arrL( hDirACRend->hoa_encoder_fx, hDirACRend->hoa_encoder, Q29, hDirACRend->hoa_encoder_len ); } - IF ( inputMasa->hMasaExtRend->hDiracDecBin ) - fixedToFloat_arrL( inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection_fx, inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection, (Word16) Q28 /*1.0f Q28*/, (Word16) CLDFB_NO_CHANNELS_MAX ); + IF( inputMasa->hMasaExtRend->hDiracDecBin ) + fixedToFloat_arrL( inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection_fx, inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection, (Word16) Q28 /*1.0f Q28*/, (Word16) CLDFB_NO_CHANNELS_MAX ); } inputMasa->base.inputBuffer.data = inputMasa->bufferData; fixedToFloat_arrL( inputMasa->base.inputBuffer.data_fx, inputMasa->base.inputBuffer.data, 0, MAX_BUFFER_LENGTH ); /*fixed to float only for set zero(that's why q0)*/ @@ -6864,43 +6862,43 @@ ivas_error IVAS_REND_FeedInputAudio_fx( Word16 numInputChannels; /* Validate function arguments */ - IF ( hIvasRend == NULL || inputAudio.data == NULL ) + IF( hIvasRend == NULL || inputAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - IF (LE_16( inputAudio.config.numSamplesPerChannel , 0 )|| LT_16(MAX_BUFFER_LENGTH_PER_CHANNEL , inputAudio.config.numSamplesPerChannel) ) + IF( LE_16( inputAudio.config.numSamplesPerChannel, 0 ) || LT_16( MAX_BUFFER_LENGTH_PER_CHANNEL, inputAudio.config.numSamplesPerChannel ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } - IF ( LE_16(inputAudio.config.numChannels , 0) ||LT_16( MAX_INPUT_CHANNELS , inputAudio.config.numChannels) ) + IF( LE_16( inputAudio.config.numChannels, 0 ) || LT_16( MAX_INPUT_CHANNELS, inputAudio.config.numChannels ) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } - IF ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) + IF( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); } - IF ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) + IF( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ) != IVAS_ERR_OK ) + IF( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_AUDIO_CONFIG_OBA ) + IF( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_AUDIO_CONFIG_OBA ) { numInputChannels = (Word16) hIvasRend->inputsIsm[0].total_num_objects; } - IF (NE_16( numInputChannels , inputAudio.config.numChannels )) + IF( NE_16( numInputChannels, inputAudio.config.numChannels ) ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } @@ -6913,6 +6911,7 @@ ivas_error IVAS_REND_FeedInputAudio_fx( return IVAS_ERR_OK; } + #endif /*-------------------------------------------------------------------* * IVAS_REND_FeedInputAudio() @@ -6973,7 +6972,10 @@ ivas_error IVAS_REND_FeedInputAudio( } inputBase->inputBuffer.config = inputAudio.config; +#ifdef IVAS_FLOAT_FIXED + mvr2r_Word32( inputAudio.data_fx, inputBase->inputBuffer.data_fx, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); +#endif mvr2r( inputAudio.data, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel * inputAudio.config.numChannels ); inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; @@ -7434,8 +7436,25 @@ ivas_error IVAS_REND_SetHeadRotation( { rotQuat = headRot; } + Word32 updateRate_fx = 1677721600; // value is 200 in Q23 + rotQuat.w_fx = L_shl( rotQuat.w_fx, Q29 - rotQuat.q_fact ); + rotQuat.x_fx = L_shl( rotQuat.x_fx, Q29 - rotQuat.q_fact ); + rotQuat.y_fx = L_shl( rotQuat.y_fx, Q29 - rotQuat.q_fact ); + rotQuat.z_fx = L_shl( rotQuat.z_fx, Q29 - rotQuat.q_fact ); + hIvasRend->headRotData.hOrientationTracker->refRot.w_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); + hIvasRend->headRotData.hOrientationTracker->refRot.x_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.x_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); + hIvasRend->headRotData.hOrientationTracker->refRot.y_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); + hIvasRend->headRotData.hOrientationTracker->refRot.z_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->refRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact ); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx = L_shl( hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact ); - IF( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) + hIvasRend->headRotData.hOrientationTracker->refRot.q_fact = Q29; + hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact = Q29; + rotQuat.q_fact = Q29; + + IF( ( error = ivas_orient_trk_Process_fx( hIvasRend->headRotData.hOrientationTracker, rotQuat, updateRate_fx, &hIvasRend->headRotData.headPositions[sf_idx] ) ) != IVAS_ERR_OK ) { return error; } @@ -7543,7 +7562,7 @@ ivas_error IVAS_REND_SetReferenceRotation( ivas_error error; /* Validate function arguments */ - IF ( hIvasRend == NULL ) + IF( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -7552,7 +7571,7 @@ ivas_error IVAS_REND_SetReferenceRotation( error = ivas_orient_trk_SetReferenceRotation_fx( hIvasRend->headRotData.hOrientationTracker, refRot ); - IF ( error != IVAS_ERR_OK ) + IF( error != IVAS_ERR_OK ) { return error; @@ -7624,8 +7643,70 @@ ivas_error IVAS_REND_GetTrackedRotation( return IVAS_ERR_OK; } #endif +#ifdef IVAS_FLOAT_FIXED + +/*---------------------------------------------------------------------* + * IVAS_REND_SetReferenceVector( ) + * + * Sets a reference vector spanning from listenerPos to refPos. Only + * available in OTR_TRACKING_REF_VEC and OTR_TRACKING_REF_VEC_LEV modes. + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_SetReferenceVector( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) +{ + IF( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + return ivas_orient_trk_SetReferenceVector_fx( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_SetExternalOrientation() + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_SetExternalOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *orientation, /* i : external orientation data */ + Word8 enableHeadRotation, /* i : flag to enable head rotation for this frame */ + Word8 enableExternalOrientation, /* i : flag to enable external orientation for this frame */ + Word8 enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ + Word16 numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ + const Word16 sf_idx /* i : subframe index */ +) +{ + /* Validate function arguments */ + IF( hIvasRend == NULL || hIvasRend->hExternalOrientationData == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF( orientation == NULL ) + { + hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = 0; + } + ELSE + { + QuaternionInverse_fx( *orientation, &hIvasRend->hExternalOrientationData->Quaternions[sf_idx] ); + hIvasRend->hExternalOrientationData->enableHeadRotation[sf_idx] = enableHeadRotation; + hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = enableExternalOrientation; + hIvasRend->hExternalOrientationData->enableRotationInterpolation[sf_idx] = enableRotationInterpolation; + hIvasRend->hExternalOrientationData->numFramesToTargetOrientation[sf_idx] = numFramesToTargetOrientation; + move16(); + } + return IVAS_ERR_OK; +} +#else /*---------------------------------------------------------------------* * IVAS_REND_SetReferenceVector( ) * @@ -7633,6 +7714,21 @@ ivas_error IVAS_REND_GetTrackedRotation( * available in OTR_TRACKING_REF_VEC and OTR_TRACKING_REF_VEC_LEV modes. *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetReferenceVector( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) +{ + IF( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + return ivas_orient_trk_SetReferenceVector_fx( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); +} +#else ivas_error IVAS_REND_SetReferenceVector( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_VECTOR3 listenerPos, /* i : Listener position */ @@ -7646,7 +7742,7 @@ ivas_error IVAS_REND_SetReferenceVector( return ivas_orient_trk_SetReferenceVector( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); } - +#endif /*---------------------------------------------------------------------* * IVAS_REND_SetExternalOrientation() @@ -7654,6 +7750,40 @@ ivas_error IVAS_REND_SetReferenceVector( * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetExternalOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *orientation, /* i : external orientation data */ + Word8 enableHeadRotation, /* i : flag to enable head rotation for this frame */ + Word8 enableExternalOrientation, /* i : flag to enable external orientation for this frame */ + Word8 enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ + Word16 numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ + const Word16 sf_idx /* i : subframe index */ +) +{ + /* Validate function arguments */ + IF (hIvasRend == NULL || hIvasRend->hExternalOrientationData == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF (orientation == NULL) + { + hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = 0; + } + ELSE + { + QuaternionInverse_fx(*orientation, &hIvasRend->hExternalOrientationData->Quaternions[sf_idx]); + + hIvasRend->hExternalOrientationData->enableHeadRotation[sf_idx] = enableHeadRotation; + hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = enableExternalOrientation; + hIvasRend->hExternalOrientationData->enableRotationInterpolation[sf_idx] = enableRotationInterpolation; + hIvasRend->hExternalOrientationData->numFramesToTargetOrientation[sf_idx] = numFramesToTargetOrientation; + } + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_SetExternalOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *orientation, /* i : external orientation data */ @@ -7686,7 +7816,7 @@ ivas_error IVAS_REND_SetExternalOrientation( return IVAS_ERR_OK; } - +#endif /*---------------------------------------------------------------------* * IVAS_REND_CombineHeadAndExternalOrientation() @@ -7698,7 +7828,7 @@ ivas_error IVAS_REND_CombineHeadAndExternalOrientation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ) { - IF ( hIvasRend == NULL ) + IF( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -7855,7 +7985,7 @@ static void renderBufferChannelLerp_fx( /* Set output pointer to first output channel sample */ outSmpl = getSmplPtr_fx( outAudio, outChnlIdx, 0 ); - IF( gainsPrev == NULL || LE_32( abs( L_sub( L_shr(previousGain,1), L_shr(currentGain,1) ) ), EPSILON_FX ) ) + IF( gainsPrev == NULL || LE_32( abs( L_sub( L_shr( previousGain, 1 ), L_shr( currentGain, 1 ) ) ), EPSILON_FX ) ) { /* If no interpolation from previous frame, apply current gain */ DO @@ -8955,18 +9085,18 @@ static ivas_error renderIsmToMc( ismInput->previousPos.elevation_fx = L_shl( L_shr( L_add( ismInput->previousPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); - IF ( *ismInput->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_STEREO ) + IF( *ismInput->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_STEREO ) { - IF ( ismInput->nonDiegeticPan ) + IF( ismInput->nonDiegeticPan ) { - currentPanGains_fx[0] = L_add(L_shr(ismInput->nonDiegeticPanGain_fx,1),ONE_IN_Q30); - currentPanGains_fx[1] = L_sub(ONE_IN_Q31, currentPanGains_fx[0]); - ismInput->prev_pan_gains_fx[0] = currentPanGains_fx[0]; //Q31 - ismInput->prev_pan_gains_fx[1] = currentPanGains_fx[1]; //Q31 + currentPanGains_fx[0] = L_add( L_shr( ismInput->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 ); + currentPanGains_fx[1] = L_sub( ONE_IN_Q31, currentPanGains_fx[0] ); + ismInput->prev_pan_gains_fx[0] = currentPanGains_fx[0]; // Q31 + ismInput->prev_pan_gains_fx[1] = currentPanGains_fx[1]; // Q31 } ELSE { - set32_fx( currentPanGains_fx, 0,MAX_OUTPUT_CHANNELS ); + set32_fx( currentPanGains_fx, 0, MAX_OUTPUT_CHANNELS ); Word16 gains_fx[2]; Word16 azimuth_tmp, elevation_tmp; @@ -8975,28 +9105,28 @@ static ivas_error renderIsmToMc( elevation_tmp = extract_l( L_shr( ismInput->currentPos.elevation_fx, Q22 ) ); ivas_ism_get_stereo_gains_fx( azimuth_tmp, elevation_tmp, &gains_fx[0], &gains_fx[1] ); - currentPanGains_fx[0] = L_deposit_h( gains_fx[0] ); //Q31 - currentPanGains_fx[1] = L_deposit_h( gains_fx[1] ); //Q31 + currentPanGains_fx[0] = L_deposit_h( gains_fx[0] ); // Q31 + currentPanGains_fx[1] = L_deposit_h( gains_fx[1] ); // Q31 azimuth_tmp = extract_l( L_shr( ismInput->previousPos.azimuth_fx, Q22 ) ); elevation_tmp = extract_l( L_shr( ismInput->previousPos.elevation_fx, Q22 ) ); set32_fx( ismInput->prev_pan_gains_fx, 0, MAX_OUTPUT_CHANNELS ); ivas_ism_get_stereo_gains_fx( azimuth_tmp, elevation_tmp, &gains_fx[0], &gains_fx[1] ); - ismInput->prev_pan_gains_fx[0] = L_deposit_h( gains_fx[0] ); //Q31 - ismInput->prev_pan_gains_fx[1] = L_deposit_h( gains_fx[1] ); //Q31 + ismInput->prev_pan_gains_fx[0] = L_deposit_h( gains_fx[0] ); // Q31 + ismInput->prev_pan_gains_fx[1] = L_deposit_h( gains_fx[1] ); // Q31 } } ELSE { /* compute gains only if position changed */ - IF ( position_changed ) + IF( position_changed ) { // TODO tmu review when #215 is resolved - IF ( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - ismInput->currentPos.azimuth_fx, - ismInput->currentPos.elevation_fx, - currentPanGains_fx ) ) != IVAS_ERR_OK ) + IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, + ismInput->currentPos.azimuth_fx, + ismInput->currentPos.elevation_fx, + currentPanGains_fx ) ) != IVAS_ERR_OK ) { return error; } @@ -9007,9 +9137,9 @@ static ivas_error renderIsmToMc( { // TODO tmu review when #215 is resolved IF( ( error = getEfapGains_fx( *ismInput->base.ctx.pEfapOutWrapper, - ismInput->previousPos.azimuth_fx, - ismInput->previousPos.elevation_fx, - ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) + ismInput->previousPos.azimuth_fx, + ismInput->previousPos.elevation_fx, + ismInput->prev_pan_gains_fx ) ) != IVAS_ERR_OK ) { return error; } @@ -9020,9 +9150,9 @@ static ivas_error renderIsmToMc( /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp_fx( ismInput->base.inputBuffer, 0, - position_changed ? currentPanGains_fx : ismInput->prev_pan_gains_fx, - position_changed ? ismInput->prev_pan_gains_fx : NULL, - outAudio ); + position_changed ? currentPanGains_fx : ismInput->prev_pan_gains_fx, + position_changed ? ismInput->prev_pan_gains_fx : NULL, + outAudio ); IF( position_changed ) { @@ -9124,19 +9254,19 @@ static ivas_error renderIsmToSba( ivas_error error; error = IVAS_ERR_OK; - ismInput->currentPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->currentPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); + ismInput->currentPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->currentPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); ismInput->currentPos.elevation_fx = L_shl( L_shr( L_add( ismInput->currentPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); ismInput->previousPos.azimuth_fx = L_shl( L_shr( L_add( ismInput->previousPos.azimuth_fx, ONE_IN_Q21 ), Q22 ), Q22 ); ismInput->previousPos.elevation_fx = L_shl( L_shr( L_add( ismInput->previousPos.elevation_fx, ONE_IN_Q21 ), Q22 ), Q22 ); push_wmops( "renderIsmToSba" ); - IF ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) + IF( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ) != IVAS_ERR_OK ) + IF( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ) != IVAS_ERR_OK ) { return error; } @@ -9145,16 +9275,16 @@ static ivas_error renderIsmToSba( /* set previous gains if this is the first frame */ Word16 azimuth_tmp, elevation_tmp; - IF ( !ismInput->firstFrameRendered ) + IF( !ismInput->firstFrameRendered ) { // TODO tmu review when #215 is resolved - azimuth_tmp = extract_l(L_shr( ismInput->previousPos.azimuth_fx, Q22 )); - elevation_tmp = extract_l(L_shr( ismInput->previousPos.elevation_fx, Q22 )); + azimuth_tmp = extract_l( L_shr( ismInput->previousPos.azimuth_fx, Q22 ) ); + elevation_tmp = extract_l( L_shr( ismInput->previousPos.elevation_fx, Q22 ) ); ivas_dirac_dec_get_response_fixed( azimuth_tmp, elevation_tmp, ismInput->prev_pan_gains_fx, ambiOrderOut ); - FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { ismInput->prev_pan_gains_fx[i] = L_shl_sat( ismInput->prev_pan_gains_fx[i], Q2 ); } @@ -9164,8 +9294,8 @@ static ivas_error renderIsmToSba( IF( position_changed ) { // TODO tmu review when #215 is resolved - azimuth_tmp = extract_l(L_shr( ismInput->currentPos.azimuth_fx, Q22 )); - elevation_tmp = extract_l(L_shr( ismInput->currentPos.elevation_fx, Q22 )); + azimuth_tmp = extract_l( L_shr( ismInput->currentPos.azimuth_fx, Q22 ) ); + elevation_tmp = extract_l( L_shr( ismInput->currentPos.elevation_fx, Q22 ) ); ivas_dirac_dec_get_response_fixed( azimuth_tmp, elevation_tmp, currentPanGains_fx, @@ -9179,14 +9309,14 @@ static ivas_error renderIsmToSba( /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp_fx( ismInput->base.inputBuffer, 0, - position_changed ? currentPanGains_fx : ismInput->prev_pan_gains_fx, - position_changed ? ismInput->prev_pan_gains_fx : NULL, - outAudio ); + position_changed ? currentPanGains_fx : ismInput->prev_pan_gains_fx, + position_changed ? ismInput->prev_pan_gains_fx : NULL, + outAudio ); - IF ( position_changed ) + IF( position_changed ) { Copy32( currentPanGains_fx, ismInput->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); - //mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); + // mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); } pop_wmops(); @@ -9279,6 +9409,7 @@ static void renderIsmToMasa( Word16 guard_bits = find_guarded_bits_fx( L_FRAME48k ); max_e = input_e[0]; + FOR( i = 1; i < MAX_NUM_OBJECTS; i++ ) { IF( max_e < input_e[0] ) @@ -9300,7 +9431,7 @@ static void renderIsmToMasa( ivas_omasa_ana_fx( ismInput->hOMasa, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels ); - *exp = q_fact; + *exp = q_fact; accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); @@ -9370,7 +9501,7 @@ static ivas_error renderInputIsm( ismInput->currentPos.elevation_fx = (Word32) ( ismInput->currentPos.elevation * ONE_IN_Q22 ); move32(); - fixedToFloat_arrL(ismInput->base.inputBuffer.data_fx, ismInput->base.inputBuffer.data,Q8, ismInput->base.inputBuffer.config.numSamplesPerChannel*ismInput->base.inputBuffer.config.numChannels); + fixedToFloat_arrL( ismInput->base.inputBuffer.data_fx, ismInput->base.inputBuffer.data, Q8, ismInput->base.inputBuffer.config.numSamplesPerChannel * ismInput->base.inputBuffer.config.numChannels ); floatToFixed_arrL( ismInput->prev_pan_gains, ismInput->prev_pan_gains_fx, Q31, MAX_OUTPUT_CHANNELS ); ismInput->nonDiegeticPanGain_fx = floatToFixed_32( ismInput->nonDiegeticPanGain, Q31 ); @@ -9454,7 +9585,7 @@ static ivas_error renderInputIsm( #else renderIsmToMasa( ismInput, outAudio ); #endif - break; + break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } @@ -10392,7 +10523,7 @@ static ivas_error renderInputMc( inAudio = mcInput->base.inputBuffer; - IF ( NE_32(mcInput->base.numNewSamplesPerChannel , outAudio.config.numSamplesPerChannel) ) + IF( NE_32( mcInput->base.numNewSamplesPerChannel, outAudio.config.numSamplesPerChannel ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); } @@ -10403,7 +10534,7 @@ static ivas_error renderInputMc( /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *( mcInput->base.ctx.pCombinedOrientationData ) ); - SWITCH ( getAudioConfigType( outConfig ) ) + SWITCH( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: renderMcToMc( mcInput, outAudio ); @@ -10412,21 +10543,20 @@ static ivas_error renderInputMc( renderMcToSba( mcInput, outAudio ); BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - SWITCH ( outConfig ) + SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: error = renderMcToBinaural( mcInput, outConfig, outAudio ); BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - IF ( mcInput->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF( mcInput->base.inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { error = renderMcCustomLsToBinauralRoom( mcInput, outConfig, outAudio ); } ELSE { error = renderMcToBinauralRoom( mcInput, outConfig, outAudio ); - } BREAK; default: @@ -10512,13 +10642,13 @@ static ivas_error renderActiveInputsMc( ivas_error error; for ( i = 0, pCurrentInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pCurrentInput ) { - IF ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + IF( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ CONTINUE; } - IF ( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) + IF( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; } @@ -11183,7 +11313,76 @@ static ivas_error renderActiveInputsSba( return IVAS_ERR_OK; } #endif +#ifdef IVAS_FLOAT_FIXED +static void copyMasaMetadataToDiracRenderer_fx( + MASA_METADATA_FRAME *meta, + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, + const int16_t maxBin ) +{ + Word16 band, sf, bin; + Word16 meta_write_index; + hSpatParamRendCom->numParametricDirections = meta->descriptive_meta.numberOfDirections + 1; + hSpatParamRendCom->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; + + FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + sf ) % hSpatParamRendCom->dirac_md_buffer_length; + + FOR( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) + { + FOR( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1] && bin < maxBin; bin++ ) + { + // hSpatParamRendCom->azimuth[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[0].azimuth_fx[sf][band], Q22 ); + // hSpatParamRendCom->elevation[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[0].elevation_fx[sf][band], Q22 ); + hSpatParamRendCom->energy_ratio1_fx[meta_write_index][bin] = meta->directional_meta[0].energy_ratio_fx[sf][band]; + hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] = L_sub( ONE_IN_Q30, meta->directional_meta[0].energy_ratio_fx[sf][band] ); + hSpatParamRendCom->spreadCoherence_fx[meta_write_index][bin] = meta->directional_meta[0].spread_coherence_fx[sf][band]; + hSpatParamRendCom->surroundingCoherence_fx[meta_write_index][bin] = meta->common_meta.surround_coherence_fx[sf][band]; +#if 0 // Tobe removed after masa the path is complete + hSpatParamRendCom->energy_ratio1[meta_write_index][bin] = (float) hSpatParamRendCom->energy_ratio1_fx[meta_write_index][bin] / ONE_IN_Q30; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = (float) hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] / ONE_IN_Q30; + hSpatParamRendCom->spreadCoherence[meta_write_index][bin] = (float) hSpatParamRendCom->spreadCoherence_fx[meta_write_index][bin] / ONE_IN_Q15; + hSpatParamRendCom->surroundingCoherence[meta_write_index][bin] = (float) hSpatParamRendCom->surroundingCoherence_fx[meta_write_index][bin] / ONE_IN_Q15; +#else + hSpatParamRendCom->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; + hSpatParamRendCom->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; + hSpatParamRendCom->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; + hSpatParamRendCom->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; + hSpatParamRendCom->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; + +#endif + + IF( hSpatParamRendCom->numSimultaneousDirections == 2 ) + { + // hSpatParamRendCom->azimuth2[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[1].azimuth_fx[sf][band], Q22 ); + // hSpatParamRendCom->elevation2[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[1].elevation[sf][band], Q22 ); + hSpatParamRendCom->energy_ratio2_fx[meta_write_index][bin] = meta->directional_meta[1].energy_ratio_fx[sf][band]; + hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] = L_sub( hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin], meta->directional_meta[1].energy_ratio_fx[sf][band] ); + hSpatParamRendCom->spreadCoherence2_fx[meta_write_index][bin] = meta->directional_meta[1].spread_coherence_fx[sf][band]; +#if 0 // Tobe removed after the masa path is complete + hSpatParamRendCom->energy_ratio2[meta_write_index][bin] = (float) hSpatParamRendCom->energy_ratio2_fx[meta_write_index][bin] / ONE_IN_Q30; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = (float) hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] / ONE_IN_Q30; + hSpatParamRendCom->spreadCoherence2[meta_write_index][bin] = (float) hSpatParamRendCom->spreadCoherence2_fx[meta_write_index][bin] / ONE_IN_Q15; +#else + hSpatParamRendCom->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; + hSpatParamRendCom->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; + hSpatParamRendCom->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; + hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; + hSpatParamRendCom->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; + +#endif + } + } + } + } + + hSpatParamRendCom->dirac_bs_md_write_idx = ( hSpatParamRendCom->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hSpatParamRendCom->dirac_md_buffer_length; + + return; +} +#else static void copyMasaMetadataToDiracRenderer( MASA_METADATA_FRAME *meta, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, @@ -11226,8 +11425,178 @@ static void copyMasaMetadataToDiracRenderer( return; } +#endif +#ifdef IVAS_FLOAT_FIXED +static void renderMasaToMasa( + input_masa *masaInput, + IVAS_REND_AudioBuffer outAudio ) +{ + Word16 sf, band, dir, numDirs; + Word32 ratioSum_fx; + MASA_DECODER_EXT_OUT_META_HANDLE outMeta; + MASA_METADATA_FRAME *inMeta; + Word32 tmpBuffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word16 ts, i, j, l_ts; + Word32 Chan_RealBuffer_fx[MASA_MAX_TRANSPORT_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 Chan_ImagBuffer_fx[MASA_MAX_TRANSPORT_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word16 band_m_idx, block_m_idx; + Word16 mrange[2]; + Word16 brange[2]; + Word16 numAnalysisChannels; + Word16 tmp_energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + copyBufferTo2dArray_fx( masaInput->base.inputBuffer, tmpBuffer_fx ); + Word16 q_cldfb = *outAudio.pq_fact; + Word16 q_cldfb_out = *outAudio.pq_fact; + Word16 scale_factor = 31; + move16(); + /* Calculate energy */ + l_ts = masaInput->base.inputBuffer.config.numSamplesPerChannel / CLDFB_NO_COL_MAX; + numAnalysisChannels = masaInput->hMasaPrerend->num_Cldfb_instances; + /* do processing over all CLDFB time slots */ + FOR( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + mrange[0] = DirAC_block_grouping[block_m_idx]; + mrange[1] = DirAC_block_grouping[block_m_idx + 1]; + + set_zero_fx( masaInput->hMasaPrerend->energy_fx[block_m_idx], MASA_FREQUENCY_BANDS ); + FOR( ts = mrange[0]; ts < mrange[1]; ts++ ) + { + FOR( i = 0; i < numAnalysisChannels; i++ ) + { + scale_factor = 31; + move16(); + masaInput->hMasaPrerend->cldfbAnaEnc[i]->Q_cldfb_state = q_cldfb; + q_cldfb_out = q_cldfb; + move16(); + cldfbAnalysis_ts_fx_fixed_q( &( tmpBuffer_fx[i][l_ts * ts] ), Chan_RealBuffer_fx[i], Chan_ImagBuffer_fx[i], l_ts, masaInput->hMasaPrerend->cldfbAnaEnc[i], &q_cldfb_out ); + scale_factor = s_min( scale_factor, s_min( getScaleFactor32( Chan_RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX ), getScaleFactor32( Chan_ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX ) ) ); + scale_factor = sub( scale_factor, 1 ); + scale_sig32( Chan_RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, scale_factor ); // Q17 + scale_sig32( Chan_ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, scale_factor ); // Q17 + } + + Word16 q_add = sub(31 , add( scale_factor , q_cldfb_out )); + /* Compute channel energy for metadata processing */ + FOR( band_m_idx = 0; band_m_idx < MASA_FREQUENCY_BANDS; band_m_idx++ ) + { + brange[0] = MASA_band_grouping_24[band_m_idx]; + move16(); + brange[1] = MASA_band_grouping_24[band_m_idx + 1]; + move16(); + FOR( j = brange[0]; j < brange[1]; j++ ) + { + FOR( i = 0; i < numAnalysisChannels; i++ ) + { + Word32 temp = L_add( Mult_32_32( Chan_RealBuffer_fx[0][j], Chan_RealBuffer_fx[0][j] ), Mult_32_32( Chan_ImagBuffer_fx[0][j], Chan_ImagBuffer_fx[0][j] ) ); + masaInput->hMasaPrerend->energy_fx[block_m_idx][band_m_idx] = BASOP_Util_Add_Mant32Exp( masaInput->hMasaPrerend->energy_fx[block_m_idx][band_m_idx], tmp_energy_e[block_m_idx][band_m_idx], temp, ( 2 * q_add ), &tmp_energy_e[block_m_idx][band_m_idx] ); + } + } + } + } + } + FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + Word16 max_e = MIN_16; + move16(); + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + { + + max_e = s_max( max_e, tmp_energy_e[i][j] ); + } + masaInput->hMasaPrerend->energy_e[i] = max_e; + move16(); + FOR( j = 0; j < MASA_FREQUENCY_BANDS; j++ ) + { + masaInput->hMasaPrerend->energy_fx[i][j] = L_shr( masaInput->hMasaPrerend->energy_fx[i][j], sub( max_e, tmp_energy_e[i][j] ) ); + } + } + /* Copy audio channels if mismatch in number of transports */ + IF( masaInput->base.inputBuffer.config.numChannels == 1 && outAudio.config.numChannels == 2 ) + { + mvr2r_Word32( tmpBuffer_fx[0], tmpBuffer_fx[1], masaInput->base.inputBuffer.config.numSamplesPerChannel ); + } + ELSE IF( masaInput->base.inputBuffer.config.numChannels == 2 && outAudio.config.numChannels == 1 ) + { + // v_add( tmpBuffer[0], tmpBuffer[1], tmpBuffer[0], masaInput->base.inputBuffer.config.numSamplesPerChannel ); + v_add_fixed( tmpBuffer_fx[0], tmpBuffer_fx[1], tmpBuffer_fx[0], masaInput->base.inputBuffer.config.numSamplesPerChannel, 0 ); + } + + /* Copy metadata */ + outMeta = masaInput->hMasaPrerend->hMasaOut; + inMeta = &masaInput->masaMetadata; + numDirs = inMeta->descriptive_meta.numberOfDirections + 1; + + FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + FOR( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + /* Remainder is always set to zero and energy removal is compensated in following steps + * to other ratios. */ + // inMeta->common_meta.remainder_to_total_ratio[sf][band] = 0.0f; + inMeta->common_meta.remainder_to_total_ratio_fx[sf][band] = 0; + move32(); + ratioSum_fx = 0; + move32(); + FOR( dir = 0; dir < numDirs; dir++ ) + { + ratioSum_fx = L_add( ratioSum_fx, inMeta->directional_meta[dir].energy_ratio_fx[sf][band] ); + } + ratioSum_fx = L_add( ratioSum_fx, inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] ); + + IF( EQ_32(ratioSum_fx , 0 )) + { + FOR( dir = 0; dir < numDirs; dir++ ) + { + inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = 0; + } + inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = ONE_IN_Q30; + } + ELSE IF( NE_32(ratioSum_fx , ONE_IN_Q30) ) + { + Word16 tmp_e = 0; + move16(); + Word32 tmp = 0; + move32(); + FOR( dir = 0; dir < numDirs; dir++ ) + { + tmp = BASOP_Util_Divide3232_Scale_cadence( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); + inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( tmp, tmp_e - 1 ); // Q30 + } + tmp_e = 0; + move16(); + tmp = 0; + move32(); + tmp = BASOP_Util_Divide3232_Scale_cadence( inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); + inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( tmp, tmp_e - 1 ); // Q30 + } + } + } + + FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + FOR( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + outMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX; + FOR( dir = 0; dir < numDirs; dir++ ) + { + outMeta->directionIndex[dir][sf][band] = index_theta_phi_16_fx( &inMeta->directional_meta[dir].elevation_fx[sf][band], &inMeta->directional_meta[dir].azimuth_fx[sf][band], masaInput->hMasaPrerend->sph_grid16 ); + outMeta->directToTotalRatio[dir][sf][band] = (UWord8) L_shr( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], 22 ); + outMeta->diffuseToTotalRatio[sf][band] -= outMeta->directToTotalRatio[dir][sf][band]; + outMeta->spreadCoherence[dir][sf][band] = (UWord8) shr( inMeta->directional_meta[dir].spread_coherence_fx[sf][band], Q7 ); + } + outMeta->surroundCoherence[sf][band] = (UWord8) shr( inMeta->common_meta.surround_coherence_fx[sf][band], Q7 ); + } + } + + copy_masa_descriptive_meta( &( outMeta->descriptiveMeta ), &( inMeta->descriptive_meta ) ); + + accumulate2dArrayToBuffer_fx( tmpBuffer_fx, &outAudio ); + + return; +} +#else static void renderMasaToMasa( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) @@ -11353,7 +11722,7 @@ static void renderMasaToMasa( return; } - +#endif static ivas_error renderInputMasa( input_masa *masaInput, @@ -11365,7 +11734,10 @@ static ivas_error renderInputMasa( int16_t maxBin; float *tmpBuffer[MAX_OUTPUT_CHANNELS]; float tmpBuffer_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - +#ifndef IVAS_FLOAT_FIXED + Word32 *tmpBuffer_fx[MAX_OUTPUT_CHANNELS]; + Word32 tmpBuffer_buff_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#endif if ( !masaInput->metadataHasBeenFed ) { return IVAS_ERR_MISSING_METADATA; @@ -11380,7 +11752,11 @@ static ivas_error renderInputMasa( #ifdef IVAS_FLOAT_FIXED masaInput->base.gain = fix_to_float( masaInput->base.gain_fx, Q30 ); -#endif // IVAS_FLOAT_FIXED + *outAudio.pq_fact = outAudio.q_factor; + /* Apply input gain to new audio */ + v_multc_fixed( inAudio.data_fx, masaInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); + *outAudio.pq_fact -= 1; // to compensate for the qfactor reduction in gain multiplication. +#endif // IVAS_FLOAT_FIXED /* Apply input gain to new audio */ v_multc( inAudio.data, masaInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); @@ -11394,6 +11770,10 @@ static ivas_error renderInputMasa( { /* MASA prerendering path for MASA -> MASA */ renderMasaToMasa( masaInput, outAudio ); + for ( Word16 i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) + { + outAudio.data[i] = (float) outAudio.data_fx[i] / ( 1 << *outAudio.pq_fact ); + } } else { @@ -11403,7 +11783,13 @@ static ivas_error renderInputMasa( { tmpBuffer[ch] = tmpBuffer_buff[ch]; } - +#ifndef IVAS_FLOAT_FIXED + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + tmpBuffer_fx[ch] = tmpBuffer_buff_fx[ch]; + } + copyBufferTo2dArray_fx( masaInput->base.inputBuffer, tmpBuffer_buff_fx ); +#endif copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer_buff ); num_subframes = (int16_t) ( masaInput->base.inputBuffer.config.numSamplesPerChannel / ( *masaInput->base.ctx.pOutSampleRate / ( IVAS_NUM_FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); @@ -11411,13 +11797,13 @@ static ivas_error renderInputMasa( switch ( masaInput->hMasaExtRend->renderer_type ) { case RENDERER_DIRAC: - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + copyMasaMetadataToDiracRenderer_fx( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); ivas_masa_ext_dirac_render( masaInput->hMasaExtRend, tmpBuffer, num_subframes ); break; case RENDERER_STEREO_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC_ROOM: - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + copyMasaMetadataToDiracRenderer_fx( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); ivas_masa_ext_rend_parambin_render( masaInput->hMasaExtRend, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, num_subframes ); break; case RENDERER_DISABLE: @@ -11460,16 +11846,17 @@ static ivas_error renderActiveInputsMasa( { return error; } - } #ifdef IVAS_FLOAT_FIXED - if ( hIvasRend->inputsSba[0].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) - { - for ( i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) + if ( ( hIvasRend->inputsSba[0].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) && ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ) { - outAudio.data_fx[i] = (Word32) outAudio.data[i] * ( 1 << *outAudio.pq_fact ); + for ( Word16 k = 0; k < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; k++ ) + { + outAudio.data_fx[k] = (Word32) outAudio.data[k] * ( 1 << *outAudio.pq_fact ); + } } - } #endif + } + return IVAS_ERR_OK; } @@ -11567,8 +11954,8 @@ ivas_error IVAS_REND_MergeMasaMetadata( #endif Word32( *inEne1_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word32( *inEne2_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word16 *inEne1_e; - Word16 *inEne2_e; + Word16 *inEne1_e; + Word16 *inEne2_e; if ( hIvasRend == NULL ) { @@ -11581,14 +11968,14 @@ ivas_error IVAS_REND_MergeMasaMetadata( *hMasaExtOutMeta = hIvasRend->inputsIsm->hOMasa->hMasaOut; inEne1 = &( hIvasRend->inputsIsm->hOMasa->energy ); #ifdef IVAS_FLOAT_FIXED - inEne1_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); - inEne1_e = (hIvasRend->inputsIsm->hOMasa->energy_e); + inEne1_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); + inEne1_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) - { - f2me_buf(hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS); - } + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + f2me_buf( hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS ); + } #endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) @@ -11597,12 +11984,12 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne1 = &( hIvasRend->inputsMc->hMcMasa->energy ); #ifdef IVAS_FLOAT_FIXED inEne1_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); - inEne1_e = (hIvasRend->inputsMc->hMcMasa->energy_exp); + inEne1_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) - { - f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS); - } + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + f2me_buf( hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS ); + } #endif } else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) @@ -11610,12 +11997,12 @@ ivas_error IVAS_REND_MergeMasaMetadata( *hMasaExtOutMeta = hIvasRend->inputsSba->hDirAC->hMasaOut; inEne1 = &( hIvasRend->inputsSba->hDirAC->energy ); #ifdef IVAS_FLOAT_FIXED - inEne1_fx = &(hIvasRend->inputsSba->hDirAC->energy_fx); - inEne1_e = (hIvasRend->inputsSba->hDirAC->energy_exp); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) - { - f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS); - } + inEne1_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); + inEne1_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + f2me_buf( hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS ); + } #endif } @@ -11625,10 +12012,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne1 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); #ifdef IVAS_FLOAT_FIXED inEne1_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); - inEne1_e = (hIvasRend->inputsMasa->hMasaPrerend->energy_e); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + inEne1_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - f2me_buf(hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS); + f2me_buf( hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS ); } #endif } @@ -11645,12 +12032,12 @@ ivas_error IVAS_REND_MergeMasaMetadata( inEne2 = &( hIvasRend->inputsIsm->hOMasa->energy ); #endif #ifdef IVAS_FLOAT_FIXED - inEne2_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); - inEne2_e = (hIvasRend->inputsIsm->hOMasa->energy_e); + inEne2_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); + inEne2_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - f2me_buf(hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS); + f2me_buf( hIvasRend->inputsIsm->hOMasa->energy[i], hIvasRend->inputsIsm->hOMasa->energy_fx[i], &hIvasRend->inputsIsm->hOMasa->energy_e[i], MASA_FREQUENCY_BANDS ); } #endif @@ -11663,10 +12050,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( #endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); - inEne2_e = (hIvasRend->inputsMc->hMcMasa->energy_exp); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + inEne2_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - f2me_buf(hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS); + f2me_buf( hIvasRend->inputsMc->hMcMasa->energy[i], hIvasRend->inputsMc->hMcMasa->energy_fx[i], &hIvasRend->inputsMc->hMcMasa->energy_exp[i], MASA_FREQUENCY_BANDS ); } #endif } @@ -11678,10 +12065,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( #endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); - inEne2_e = (hIvasRend->inputsSba->hDirAC->energy_exp); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + inEne2_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - f2me_buf(hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS); + f2me_buf( hIvasRend->inputsSba->hDirAC->energy[i], hIvasRend->inputsSba->hDirAC->energy_fx[i], &hIvasRend->inputsSba->hDirAC->energy_exp[i], MASA_FREQUENCY_BANDS ); } #endif } @@ -11693,10 +12080,10 @@ ivas_error IVAS_REND_MergeMasaMetadata( #endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); - inEne2_e = (hIvasRend->inputsMasa->hMasaPrerend->energy_e); - for (Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + inEne2_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); + for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - f2me_buf(hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS); + f2me_buf( hIvasRend->inputsMasa->hMasaPrerend->energy[i], hIvasRend->inputsMasa->hMasaPrerend->energy_fx[i], &hIvasRend->inputsMasa->hMasaPrerend->energy_e[i], MASA_FREQUENCY_BANDS ); } #endif @@ -11710,16 +12097,16 @@ ivas_error IVAS_REND_MergeMasaMetadata( #ifdef IVAS_FLOAT_FIXED ivas_prerend_merge_masa_metadata_fx( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1_fx, inEne1_e, inMeta2, inputType2, *inEne2_fx, inEne2_e ); - FOR(Word32 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++) + FOR( Word32 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - me2f_buf((*inEne1_fx)[i], inEne1_e[i], (*inEne1)[i], MASA_FREQUENCY_BANDS); + me2f_buf( ( *inEne1_fx )[i], inEne1_e[i], ( *inEne1 )[i], MASA_FREQUENCY_BANDS ); } #else ivas_prerend_merge_masa_metadata( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1, inMeta2, inputType2, *inEne2 ); ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; #endif - (*hMasaExtOutMeta)->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; + ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; return IVAS_ERR_OK; } @@ -12114,8 +12501,8 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( Word16 nchan_out_woLFE; Word16 nchan_transport; UWord16 i, j, k; - Word32 ls_azimuth_fx[MAX_OUTPUT_CHANNELS];/*Q22*/ - Word32 ls_elevation_fx[MAX_OUTPUT_CHANNELS];/*Q22*/ + Word32 ls_azimuth_fx[MAX_OUTPUT_CHANNELS]; /*Q22*/ + Word32 ls_elevation_fx[MAX_OUTPUT_CHANNELS]; /*Q22*/ Word32 output_Fs; ivas_error error; DIRAC_REND_HANDLE hDirACRend; @@ -12133,12 +12520,12 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( * prepare library opening *-----------------------------------------------------------------*/ - IF ( ( hDirACRend = (DIRAC_REND_HANDLE) malloc( sizeof( DIRAC_REND_DATA ) ) ) == NULL ) + IF( ( hDirACRend = (DIRAC_REND_HANDLE) malloc( sizeof( DIRAC_REND_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC renderer\n" ) ); } - nchan_transport = EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA2) ? 2 : 1; + nchan_transport = EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA2 ) ? 2 : 1; /*-----------------------------------------------------------------* * output setup: for parametric binaural renderer, use output setup, otherwise internal setup @@ -12146,12 +12533,12 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( ivas_output_init( &hDirACRend->hOutSetup, *inputMasa->base.ctx.pOutConfig ); - IF ( EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_LS_CUSTOM) ) + IF( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { /* Copy from ivas_ls_custom_setup */ hDirACRend->hOutSetup.nchan_out_woLFE = inputMasa->base.ctx.pCustomLsOut->num_spk; move16(); -#if 1/*TODO: To be removed later(floating buffer init)*/ +#if 1 /*TODO: To be removed later(floating buffer init)*/ hDirACRend->hOutSetup.ls_azimuth = inputMasa->base.ctx.pCustomLsOut->ls_azimuth; hDirACRend->hOutSetup.ls_elevation = inputMasa->base.ctx.pCustomLsOut->ls_elevation; #endif @@ -12172,23 +12559,23 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; move16(); - IF ( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) + IF( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) { Copy32( hDirACRend->hOutSetup.ls_azimuth_fx, ls_azimuth_fx, nchan_out_woLFE ); Copy32( hDirACRend->hOutSetup.ls_elevation_fx, ls_elevation_fx, nchan_out_woLFE ); } - IF ( EQ_16(hDirACRend->hOutSetup.ambisonics_order , -1) ) + IF( EQ_16( hDirACRend->hOutSetup.ambisonics_order, -1 ) ) { hDirACRend->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; /* Order 3 is used by default in DirAC for SHD processing */ move16(); - IF ( EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_MONO) || EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_STEREO) ) + IF( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { hDirACRend->hOutSetup.ambisonics_order = SBA_FOA_ORDER; move16(); } } - ELSE IF ( GE_16(hDirACRend->hOutSetup.ambisonics_order , SBA_FOA_ORDER) ) + ELSE IF( GE_16( hDirACRend->hOutSetup.ambisonics_order, SBA_FOA_ORDER ) ) { Copy32( ls_azimuth_4d4_fx, ls_azimuth_fx, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); Copy32( ls_elevation_4d4_fx, ls_elevation_fx, DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS ); @@ -12198,19 +12585,19 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( * set input parameters *-----------------------------------------------------------------*/ - IF ( EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_MONO) ) + IF( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_MONO ) ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_MONO; hDirACRend->panningConf = DIRAC_PANNING_HOA3; nchan_out_woLFE = 1; move16(); } - ELSE IF ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + ELSE IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirACRend->panningConf = DIRAC_PANNING_VBAP; } - ELSE IF ( !hDirACRend->hOutSetup.is_loudspeaker_setup && GT_16(nchan_transport , 1) ) + ELSE IF( !hDirACRend->hOutSetup.is_loudspeaker_setup && GT_16( nchan_transport, 1 ) ) { hDirACRend->synthesisConf = DIRAC_SYNTHESIS_PSD_SHD; hDirACRend->panningConf = DIRAC_PANNING_HOA3; @@ -12221,8 +12608,8 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->panningConf = DIRAC_PANNING_HOA3; } -#if 1/*TODO: To be removed later(floating buffer malloc and init)*/ - IF ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) +#if 1 /*TODO: To be removed later(floating buffer malloc and init)*/ + IF( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -12237,9 +12624,9 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( ivas_dirac_dec_get_frequency_axis_fx( hDirACRend->frequency_axis_fx, output_Fs, hSpatParamRendCom->num_freq_bands ); - IF ( EQ_16(hDirACRend->panningConf , DIRAC_PANNING_HOA3) && EQ_16(nchan_transport , 2) ) + IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) && EQ_16( nchan_transport, 2 ) ) { - IF ( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) + IF( ( hDirACRend->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -12259,25 +12646,25 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* prototype signal computation */ /* allocate output setup related arrays */ - IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_LS) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ) ) { /* Directional and diffuses components in output LS format */ hDirACRend->num_outputs_diff = nchan_out_woLFE; hDirACRend->num_outputs_dir = nchan_out_woLFE; } - ELSE IF (EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) + ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { /* Directional and diffuses components in SHD */ /* Diffuseness components up to 1st order */ hDirACRend->num_outputs_diff = ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ); hDirACRend->num_outputs_dir = ivas_sba_get_nchan( hDirACRend->hOutSetup.ambisonics_order, 0 ); } - ELSE IF (EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD) ) + ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) { hDirACRend->num_outputs_diff = DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS; hDirACRend->num_outputs_dir = nchan_out_woLFE; } - ELSE IF (EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_MONO) ) + ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { hDirACRend->num_outputs_diff = 1; /* There is one output channel in mono */ hDirACRend->num_outputs_dir = 2; /* Two channels are pre-rendered for stereo type detection */ @@ -12289,12 +12676,12 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( move16(); move16(); - IF ( ( hDirACRend->proto_index_dir = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) + IF( ( hDirACRend->proto_index_dir = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hDirACRend->proto_index_diff = (Word16 *) malloc( sizeof(Word16) * hDirACRend->num_outputs_diff ) ) == NULL ) + IF( ( hDirACRend->proto_index_diff = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } @@ -12304,7 +12691,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->sba_map_tc = sba_map_tc; - IF ( EQ_16(nchan_transport , 1) ) + IF( EQ_16( nchan_transport, 1 ) ) { hDirACRend->num_protos_ambi = 1; hDirACRend->num_protos_dir = 1; @@ -12313,9 +12700,9 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( move16(); move16(); } - ELSE IF ( EQ_16(nchan_transport , 2) ) + ELSE IF( EQ_16( nchan_transport, 2 ) ) { - IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { hDirACRend->num_protos_ambi = 2; hDirACRend->num_protos_diff = 1; @@ -12326,7 +12713,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( move16(); move16(); } - ELSE IF (EQ_16(hDirACRend->hOutSetup.output_config , IVAS_AUDIO_CONFIG_MONO) ) + ELSE IF( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_MONO ) ) { /* Following the foa rendering for code compatibility */ hDirACRend->num_protos_ambi = 2; @@ -12347,13 +12734,13 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( move16(); move16(); - FOR ( k = 0; k < hDirACRend->num_outputs_diff; k++ ) + FOR( k = 0; k < hDirACRend->num_outputs_diff; k++ ) { - IF ( GT_32(ls_azimuth_fx[k] , 0) ) + IF( GT_32( ls_azimuth_fx[k], 0 ) ) { hDirACRend->proto_index_diff[k] = 1; } - ELSE IF ( LT_32(ls_azimuth_fx[k] , 0) ) + ELSE IF( LT_32( ls_azimuth_fx[k], 0 ) ) { hDirACRend->proto_index_diff[k] = 2; } @@ -12364,7 +12751,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( move16(); } - IF ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { hDirACRend->num_protos_dir = 3; move16(); @@ -12386,14 +12773,14 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#if 1/*TODO: To be removed later (Float buffer malloc)*/ +#if 1 /*TODO: To be removed later (Float buffer malloc)*/ if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } #endif - IF ( EQ_16( hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_LS ) || EQ_16( hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf , DIRAC_SYNTHESIS_MONO ) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); @@ -12404,20 +12791,20 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); } -#if 1/*TODO: To be removed later(after dependecny on float buffer hoa_encoder is removed)*/ +#if 1 /*TODO: To be removed later(after dependecny on float buffer hoa_encoder is removed)*/ hDirACRend->hoa_encoder = NULL; #endif hDirACRend->hoa_encoder_fx = NULL; - IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) { - IF ( ( hDirACRend->hoa_encoder_fx = (Word32 *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( Word32 ) ) ) == NULL ) + IF( ( hDirACRend->hoa_encoder_fx = (Word32 *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set32_fx( hDirACRend->hoa_encoder_fx, 0, nchan_out_woLFE * hDirACRend->num_outputs_diff ); - hDirACRend->hoa_encoder_len = imult1616(nchan_out_woLFE , hDirACRend->num_outputs_diff); -#if 1/*TODO: To be removed later(float buffer malloc and init)*/ + hDirACRend->hoa_encoder_len = imult1616( nchan_out_woLFE, hDirACRend->num_outputs_diff ); +#if 1 /*TODO: To be removed later(float buffer malloc and init)*/ if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); @@ -12431,7 +12818,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* VBAP */ inputMasa->hMasaExtRend->hVBAPdata = NULL; - IF ( EQ_16(hDirACRend->panningConf , DIRAC_PANNING_VBAP) ) + IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) { IF( ( error = vbap_init_data_fx( &( inputMasa->hMasaExtRend->hVBAPdata ), ls_azimuth_fx, ls_elevation_fx, nchan_out_woLFE, MASA_FORMAT ) ) != IVAS_ERR_OK ) { @@ -12441,11 +12828,11 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* HOA panning/dec */ hDirACRend->hoa_decoder = NULL; - IF ( EQ_16(hDirACRend->panningConf , DIRAC_PANNING_HOA3) ) + IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) ) { - IF ( hDirACRend->hOutSetup.is_loudspeaker_setup ) + IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_sba_get_hoa_dec_matrix_fx( hDirACRend->hOutSetup, &inputMasa->hMasaExtRend->hoa_dec_mtx, hDirACRend->hOutSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } @@ -12456,37 +12843,36 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* decorrelation */ hDirACRend->proto_signal_decorr_on = 1; - IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_MONO) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { hDirACRend->proto_signal_decorr_on = 0; } - IF ( hDirACRend->proto_signal_decorr_on ) + IF( hDirACRend->proto_signal_decorr_on ) { - IF ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), - &( hDirACRend->h_freq_domain_decorr_ap_state ), - hSpatParamRendCom->num_freq_bands, - hDirACRend->num_outputs_diff, - hDirACRend->num_protos_diff, - hDirACRend->synthesisConf, - hDirACRend->frequency_axis_fx, - nchan_transport, - output_Fs ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), + &( hDirACRend->h_freq_domain_decorr_ap_state ), + hSpatParamRendCom->num_freq_bands, + hDirACRend->num_outputs_diff, + hDirACRend->num_protos_diff, + hDirACRend->synthesisConf, + hDirACRend->frequency_axis_fx, + nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) { return error; } - } /* output synthesis */ - IF ( ( ivas_dirac_dec_output_synthesis_open_fx( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ) != IVAS_ERR_OK ) + IF( ( ivas_dirac_dec_output_synthesis_open_fx( hSpatParamRendCom, hDirACRend, RENDERER_DIRAC, nchan_transport, output_Fs, 0 ) ) != IVAS_ERR_OK ) { return error; } hDirACRend->h_output_synthesis_psd_params.use_onset_filters = hDirACRend->proto_signal_decorr_on; move16(); - IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_PSD_SHD) || EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { hDirACRend->h_output_synthesis_psd_params.use_onset_filters = 0; move16(); @@ -12496,32 +12882,32 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( * memory allocation *-----------------------------------------------------------------*/ - IF ( EQ_16(hDirACRend->synthesisConf , DIRAC_SYNTHESIS_GAIN_SHD) ) + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { hDirACRend->proto_frame_f = NULL; } ELSE { -#if 1/*TODO: To be removed later(after dependency on proto_frame_f is completely removed)*/ - IF ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) +#if 1 /*TODO: To be removed later(after dependency on proto_frame_f is completely removed)*/ + IF( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } #endif - IF( ( hDirACRend->proto_frame_f_fx = (Word32 *) malloc( sizeof(Word32) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) + IF( ( hDirACRend->proto_frame_f_fx = (Word32 *) malloc( sizeof( Word32 ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } -#if 1/*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ +#if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ hDirACRend->buffer_energy = NULL; #endif - FOR ( i = 0; i < DIRAC_NUM_DIMS; i++ ) + FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - FOR ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) + FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { #if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ hDirACRend->buffer_intensity_real[i][j] = NULL; @@ -12534,7 +12920,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( ivas_dirac_dec_output_synthesis_init_fx( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, 0 ); /* Allocate stack memory */ - IF ( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_dirac_alloc_mem( hDirACRend, RENDERER_DIRAC, hSpatParamRendCom->num_freq_bands, &( hDirACRend->stack_mem ), 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -13090,7 +13476,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ - IF ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + IF( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); } @@ -13103,35 +13489,35 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ move16(); - FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - FOR ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) + FOR( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { -#if 1/*To be removed later(floating buffer init)*/ +#if 1 /*To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); #endif - set16_fx( hDiracDecBin->processMtxRe_fx[j][k],0, nBins ); - set16_fx( hDiracDecBin->processMtxIm_fx[j][k],0, nBins ); + set16_fx( hDiracDecBin->processMtxRe_fx[j][k], 0, nBins ); + set16_fx( hDiracDecBin->processMtxIm_fx[j][k], 0, nBins ); } - FOR ( k = 0; k < BINAURAL_CHANNELS; k++ ) + FOR( k = 0; k < BINAURAL_CHANNELS; k++ ) { -#if 1/*To be removed later(floating buffer init)*/ +#if 1 /*To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); #endif - set16_fx( hDiracDecBin->processMtxDecRe_fx[j][k],0, nBins ); - set16_fx( hDiracDecBin->processMtxDecIm_fx[j][k],0, nBins ); + set16_fx( hDiracDecBin->processMtxDecRe_fx[j][k], 0, nBins ); + set16_fx( hDiracDecBin->processMtxDecIm_fx[j][k], 0, nBins ); } -#if 1/*TODO:To be removed later(floating buffer init)*/ +#if 1 /*TODO:To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->ChEnePrev[j], nBins ); set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); #endif set_zero_fx( hDiracDecBin->ChEnePrev_fx[j], nBins ); set_zero_fx( hDiracDecBin->ChEneOutPrev_fx[j], nBins ); } -#if 1/*TODO:To be removed later(floating buffer init)*/ +#if 1 /*TODO:To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->ChCrossRePrev, nBins ); set_zero( hDiracDecBin->ChCrossImPrev, nBins ); set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); @@ -13143,24 +13529,24 @@ static ivas_error ivas_masa_ext_rend_parambin_init( set_zero_fx( hDiracDecBin->ChCrossImOutPrev_fx, nBins ); hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - FOR ( bin = 0; bin < nBins; bin++ ) + FOR( bin = 0; bin < nBins; bin++ ) { - binCenterFreq_fx = L_mult0(extract_l(L_shr(output_Fs,1)), div_s(add(shl(bin, 1), 1), shl(nBins, 1)))/*( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f )*/;/*Q15*/ + binCenterFreq_fx = L_mult0( extract_l( L_shr( output_Fs, 1 ) ), div_s( add( shl( bin, 1 ), 1 ), shl( nBins, 1 ) ) ) /*( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f )*/; /*Q15*/ /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmp = BASOP_Util_Divide3232_Scale( binCenterFreq_fx, 2700<diffuseFieldCoherence_fx[bin] = L_shl(L_mult0(divide3232(tmpFloat_fx, Mult_32_16(binCenterFreq_fx, 187/*2^15*pi/550*/)), getSineWord16R2(tmp2)), tmp_e);/*tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f );*/ + tmpFloat_fx = s_max( 0, sub( shl_sat( 1, 15 - tmp_e ), tmp ) ) /*max( 0.0f, 1.0f - binCenterFreq / 2700.0f )*/; /*Q30*/ + tmp2 = extract_l( Mult_32_32( binCenterFreq_fx, 1952258 /*=2^31*180/(550)/360*/ ) % 32767 ); //*binCenterFreq_fx * EVS_PI / 550.0f*/ + hDiracDecBin->diffuseFieldCoherence_fx[bin] = L_shl( L_mult0( divide3232( tmpFloat_fx, Mult_32_16( binCenterFreq_fx, 187 /*2^15*pi/550*/ ) ), getSineWord16R2( tmp2 ) ), tmp_e ); /*tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f );*/ hDiracDecBin->diffuseFieldCoherence[bin] = fixedToFloat( hDiracDecBin->diffuseFieldCoherence_fx[bin], Q30 ); } /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ -#if 1/*TODO: To be removed later(floating buffer init)*/ +#if 1 /*TODO: To be removed later(floating buffer init)*/ set_zero( hDiracDecBin->diffuseFieldCoherenceX, BINAURAL_COHERENCE_DIFFERENCE_BINS ); set_zero( hDiracDecBin->diffuseFieldCoherenceY, BINAURAL_COHERENCE_DIFFERENCE_BINS ); set_zero( hDiracDecBin->diffuseFieldCoherenceZ, BINAURAL_COHERENCE_DIFFERENCE_BINS ); @@ -13169,25 +13555,25 @@ static ivas_error ivas_masa_ext_rend_parambin_init( set_zero_fx( hDiracDecBin->diffuseFieldCoherenceY_fx, BINAURAL_COHERENCE_DIFFERENCE_BINS ); set_zero_fx( hDiracDecBin->diffuseFieldCoherenceZ_fx, BINAURAL_COHERENCE_DIFFERENCE_BINS ); - IF ( EQ_16(renderer_type , RENDERER_BINAURAL_PARAMETRIC) ) /* Indication of binaural rendering without room effect */ + IF( EQ_16( renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ) /* Indication of binaural rendering without room effect */ { - set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28/*1.0f Q28*/, CLDFB_NO_CHANNELS_MAX ); + set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28 /*1.0f Q28*/, CLDFB_NO_CHANNELS_MAX ); hDiracDecBin->hReverb = NULL; } - ELSE IF ( EQ_16(renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) ) /* Indication of binaural rendering with room effect */ + ELSE IF( EQ_16( renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) /* Indication of binaural rendering with room effect */ { Copy32( hHrtfParambin->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins ); - IF ( hDiracDecBin->hReverb == NULL ) + IF( hDiracDecBin->hReverb == NULL ) { /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - IF ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } } } - ELSE IF ( EQ_16(renderer_type , RENDERER_STEREO_PARAMETRIC) ) + ELSE IF( EQ_16( renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { set32_fx( hDiracDecBin->earlyPartEneCorrection_fx, ONE_IN_Q28 /*1.0f Q28*/, CLDFB_NO_CHANNELS_MAX ); hDiracDecBin->hReverb = NULL; @@ -13201,15 +13587,15 @@ static ivas_error ivas_masa_ext_rend_parambin_init( /* Always open frequency domain decorrelator */ ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); - IF ( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis_fx, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis_fx, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -13397,7 +13783,7 @@ static ivas_error initMasaExtRenderer( error = IVAS_ERR_OK; - IF ( ( hMasaExtRend = (MASA_EXT_REND_HANDLE) malloc( sizeof( MASA_EXT_REND_DATA ) ) ) == NULL ) + IF( ( hMasaExtRend = (MASA_EXT_REND_HANDLE) malloc( sizeof( MASA_EXT_REND_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA external renderer structure\n" ) ); } @@ -13414,20 +13800,20 @@ static ivas_error initMasaExtRenderer( hMasaExtRend->hVBAPdata = NULL; hMasaExtRend->hoa_dec_mtx = NULL; - IF ( ( error = getAudioConfigNumChannels( inputMasa->base.inConfig, &hMasaExtRend->nchan_input ) ) != IVAS_ERR_OK ) + IF( ( error = getAudioConfigNumChannels( inputMasa->base.inConfig, &hMasaExtRend->nchan_input ) ) != IVAS_ERR_OK ) { return error; } - IF ( ( error = getAudioConfigNumChannels( outConfig, &hMasaExtRend->nchan_output ) ) != IVAS_ERR_OK ) + IF( ( error = getAudioConfigNumChannels( outConfig, &hMasaExtRend->nchan_output ) ) != IVAS_ERR_OK ) { return error; } - SWITCH ( outConfig ) + SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_MONO: - IF ( EQ_16(inputMasa->base.inConfig , IVAS_AUDIO_CONFIG_MASA2) ) + IF( EQ_16( inputMasa->base.inConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { hMasaExtRend->renderer_type = RENDERER_DIRAC; } @@ -13467,7 +13853,7 @@ static ivas_error initMasaExtRenderer( return ( IVAS_ERROR( IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, "Wrong output config for MASA input in external renderer\n" ) ); } - IF ( NE_16(hMasaExtRend->renderer_type , RENDERER_DISABLE) ) + IF( NE_16( hMasaExtRend->renderer_type, RENDERER_DISABLE ) ) { Word16 subframe; IF( ( error = ivas_spat_hSpatParamRendCom_config_fx( &hMasaExtRend->hSpatParamRendCom, DIRAC_OPEN, 0, MASA_FORMAT, MC_MODE_NONE, *( inputMasa->base.ctx.pOutSampleRate ), 0, 1 ) ) != IVAS_ERR_OK ) @@ -13476,7 +13862,7 @@ static ivas_error initMasaExtRenderer( } /* Simple population of the metadata index map as no adaptation is present */ set16_fx( hMasaExtRend->hSpatParamRendCom->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); - FOR ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) + FOR( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) { hMasaExtRend->hSpatParamRendCom->render_to_md_map[subframe] = subframe; move16(); @@ -13485,23 +13871,23 @@ static ivas_error initMasaExtRenderer( move16(); } - IF ( EQ_16(hMasaExtRend->renderer_type , RENDERER_DIRAC) ) + IF( EQ_16( hMasaExtRend->renderer_type, RENDERER_DIRAC ) ) { - IF ( ( error = ivas_masa_ext_rend_dirac_rend_init( inputMasa ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_masa_ext_rend_dirac_rend_init( inputMasa ) ) != IVAS_ERR_OK ) { return error; } } - IF ( EQ_16(hMasaExtRend->renderer_type , RENDERER_BINAURAL_PARAMETRIC) || EQ_16(hMasaExtRend->renderer_type , RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(hMasaExtRend->renderer_type , RENDERER_STEREO_PARAMETRIC) ) + IF( EQ_16( hMasaExtRend->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( hMasaExtRend->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( hMasaExtRend->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { - IF ( NE_16(hMasaExtRend->renderer_type , RENDERER_STEREO_PARAMETRIC) ) + IF( NE_16( hMasaExtRend->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { - IF ( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } -#if 1/*TODO: To be removed later after dependency on floating buffers in hHrtfParambin is removed*/ +#if 1 /*TODO: To be removed later after dependency on floating buffers in hHrtfParambin is removed*/ if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; @@ -13509,36 +13895,36 @@ static ivas_error initMasaExtRenderer( #endif // IVAS_FLOAT_FIXED } - IF ( ( error = ivas_masa_ext_rend_parambin_init( inputMasa ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_masa_ext_rend_parambin_init( inputMasa ) ) != IVAS_ERR_OK ) { return error; } } /* Init CLDFB for analysis & synthesis if renderer is used. Otherwise, NULL. */ - FOR ( i = 0; i < MASA_MAX_TRANSPORT_CHANNELS; i++ ) + FOR( i = 0; i < MASA_MAX_TRANSPORT_CHANNELS; i++ ) { hMasaExtRend->cldfbAnaRend[i] = NULL; } - FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { hMasaExtRend->cldfbSynRend[i] = NULL; } - IF ( hMasaExtRend->renderer_type != RENDERER_DISABLE ) + IF( hMasaExtRend->renderer_type != RENDERER_DISABLE ) { - FOR ( i = 0; i < hMasaExtRend->nchan_input; i++ ) + FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF ( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } } - FOR ( i = 0; i < hMasaExtRend->nchan_output; i++ ) + FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF ( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 902d63ace..a2dc9888c 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -184,6 +184,9 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { deindex_sph_idx( readIndex[b], &self->sph_grid16, &( hMeta->directional_meta[i].elevation[j][b] ), &( hMeta->directional_meta[i].azimuth[j][b] ) ); +#ifdef IVAS_FLOAT_FIXED + deindex_sph_idx_fx( readIndex[b], &self->sph_grid16, &( hMeta->directional_meta[i].elevation_fx[j][b] ), &( hMeta->directional_meta[i].azimuth_fx[j][b] ) ); +#endif hMeta->directional_meta[i].spherical_index[j][b] = readIndex[b]; } @@ -196,6 +199,10 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { hMeta->directional_meta[i].energy_ratio[j][b] = ( (float) readOther[b] ) / UINT8_MAX; +#ifdef IVAS_FLOAT_FIXED + hMeta->directional_meta[i].energy_ratio_fx[j][b] = (Word32) ( readOther[b] * ONE_IN_Q22 );//Q30 + +#endif } /* Spread coherence */ @@ -207,6 +214,10 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { hMeta->directional_meta[i].spread_coherence[j][b] = ( (float) readOther[b] ) / UINT8_MAX; +#ifdef IVAS_FLOAT_FIXED + hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( readOther[b] * ONE_IN_Q7 );//Q15 + +#endif } } @@ -220,6 +231,10 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { hMeta->common_meta.diffuse_to_total_ratio[j][b] = ( (float) readOther[b] ) / UINT8_MAX; +#ifdef IVAS_FLOAT_FIXED + hMeta->common_meta.diffuse_to_total_ratio_fx[j][b] = (Word32) ( readOther[b] * ONE_IN_Q22 ); // Q30 + +#endif } /* Surround coherence */ -- GitLab From 24da0bebaf3e65c289dad94577884107b288889f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 17 May 2024 21:38:51 +0530 Subject: [PATCH 056/101] Remove duplicated code --- lib_rend/lib_rend.c | 63 --------------------------------------------- 1 file changed, 63 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6398820da..eb7a591bd 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7643,70 +7643,7 @@ ivas_error IVAS_REND_GetTrackedRotation( return IVAS_ERR_OK; } #endif -#ifdef IVAS_FLOAT_FIXED - -/*---------------------------------------------------------------------* - * IVAS_REND_SetReferenceVector( ) - * - * Sets a reference vector spanning from listenerPos to refPos. Only - * available in OTR_TRACKING_REF_VEC and OTR_TRACKING_REF_VEC_LEV modes. - *---------------------------------------------------------------------*/ - -ivas_error IVAS_REND_SetReferenceVector( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_VECTOR3 listenerPos, /* i : Listener position */ - const IVAS_VECTOR3 refPos /* i : Reference position */ -) -{ - IF( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - return ivas_orient_trk_SetReferenceVector_fx( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); -} - - -/*---------------------------------------------------------------------* - * IVAS_REND_SetExternalOrientation() - * - * - *---------------------------------------------------------------------*/ -ivas_error IVAS_REND_SetExternalOrientation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - IVAS_QUATERNION *orientation, /* i : external orientation data */ - Word8 enableHeadRotation, /* i : flag to enable head rotation for this frame */ - Word8 enableExternalOrientation, /* i : flag to enable external orientation for this frame */ - Word8 enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ - Word16 numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ - const Word16 sf_idx /* i : subframe index */ -) -{ - /* Validate function arguments */ - IF( hIvasRend == NULL || hIvasRend->hExternalOrientationData == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - IF( orientation == NULL ) - { - hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = 0; - } - ELSE - { - QuaternionInverse_fx( *orientation, &hIvasRend->hExternalOrientationData->Quaternions[sf_idx] ); - - hIvasRend->hExternalOrientationData->enableHeadRotation[sf_idx] = enableHeadRotation; - hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = enableExternalOrientation; - hIvasRend->hExternalOrientationData->enableRotationInterpolation[sf_idx] = enableRotationInterpolation; - hIvasRend->hExternalOrientationData->numFramesToTargetOrientation[sf_idx] = numFramesToTargetOrientation; - move16(); - } - - return IVAS_ERR_OK; -} -#else /*---------------------------------------------------------------------* * IVAS_REND_SetReferenceVector( ) * -- GitLab From 6c830ca23e53b04114f086b0f2eca9f183510dd6 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 17 May 2024 22:03:03 +0530 Subject: [PATCH 057/101] MSAN fixes for issues in multichannel and masa formats cases. --- lib_dec/ivas_mc_paramupmix_dec.c | 5 +++++ lib_dec/ivas_mdct_core_dec.c | 9 +++++++++ lib_dec/ivas_stereo_dft_dec_fx.c | 3 +++ lib_dec/ivas_tcx_core_dec.c | 6 ++++++ lib_dec/tonalMDCTconcealment_fx.c | 4 ++++ 5 files changed, 27 insertions(+) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 12fbda0d4..fe17075e1 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -662,8 +662,13 @@ static void ivas_mc_paramupmix_dec_sf( int16_t noparamupmix_delay, n_samples_rendered; MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; int16_t subframeIdx, idx_in, maxBand; +#ifdef MSAN_FIX + Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; + Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] = { 0 }; +#else Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif // MSAN_FIX Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 732bca24d..865381ef1 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -936,6 +936,10 @@ void ivas_mdct_core_invQ_fx( { spectralData_tmp[k] = malloc( N_MAX * sizeof( Word32 ) ); } +#ifdef MSAN_FIX + set32_fx( spectralData_tmp[0], 0, L_FRAME_MAX ); + set32_fx( spectralData_tmp[1], 0, L_FRAME_MAX ); +#endif // MSAN_FIX push_wmops( "mdct_core_invQ" ); sts = hCPE->hCoreCoder; @@ -976,8 +980,13 @@ void ivas_mdct_core_invQ_fx( common_exp = s_max( sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ); +#ifdef MSAN_FIX + Copy_Scale_sig_16_32( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_frameTCX[0], 15 - ( common_exp - sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp1 + Copy_Scale_sig_16_32( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_frameTCX[1], 15 - ( common_exp - sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp2 +#else Copy_Scale_sig_16_32( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[0], L_FRAME_MAX, 15 - ( common_exp - sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp1 Copy_Scale_sig_16_32( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, spectralData_tmp[1], L_FRAME_MAX, 15 - ( common_exp - sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp ) ); // 30 - spectral_exp2 +#endif // MSAN_FIX sts[0]->hTonalMDCTConc->lastBlockData.spectralData_exp = sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp = common_exp; move16(); diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index de55c77bd..95f6d119b 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -399,6 +399,9 @@ ivas_error stereo_dft_dec_create_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } +#ifdef MSAN_FIX + set_zero_fx( hStereoDft_loc->hb_nrg_subr_fx, STEREO_DFT_NBDIV );/*Setting hb_nrg_subr_fx to zero*/ +#endif // MSAN_FIX hStereoDft_loc->hConfig->force_mono_transmission = 0; move16(); diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index a7eccb6c7..761c7c94b 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -770,14 +770,20 @@ void stereo_tcx_core_dec_fx( st->last_is_cng = 0; /* Postfiltering */ +#ifndef MSAN_FIX IF( st->p_bpf_noise_buf_32 ) { Copy_Scale_sig_32_16( st->p_bpf_noise_buf_32, st->p_bpf_noise_buf, st->L_frame, negate( Q11 ) ); } +#endif post_decoder( st, synth_buf_fx, pit_gain_fx, pitch, signal_out_fx, st->p_bpf_noise_buf ); +#ifdef MSAN_FIX + IF( st->p_bpf_noise_buf_32 && st->tcxonly == 0) +#else IF( st->p_bpf_noise_buf_32 ) +#endif // MSAN_FIX { Copy_Scale_sig_16_32_no_sat( st->p_bpf_noise_buf, st->p_bpf_noise_buf_32, st->L_frame, Q11 ); } diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 8ec2abe05..640e19ee7 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -721,7 +721,11 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( Word16 nSamples; Word16 i; Word16 floorPowerSpectrum; /* Minimum significant value of a spectral line in the power spectrum */ +#ifdef MSAN_FIX + Word32 powerSpectrum[L_FRAME_MAX] = { 0 }; +#else Word32 powerSpectrum[L_FRAME_MAX]; +#endif Word16 invScaleFactors[FDNS_NPTS]; Word16 invScaleFactors_exp[FDNS_NPTS]; Word16 powerSpectrum_exp, tmp_exp, old_exp; -- GitLab From 82816a289de46314839eb97ad9852450410294f7 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 18 May 2024 20:25:07 +0530 Subject: [PATCH 058/101] MASA LTV crash issue fixes, OMASA+ISM msan fixes, MASA ext dirac render conv. [x] Fixes for crash issues in MASA format: [MASA 1dir 1TC at 16.4 kbps, 48kHz in, 48kHz out, HOA3 out, random FER at 5%] [MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, FOA out, JBM Prof 5] [MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, FOA out] [MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 16kHz out, BINAURAL out, JBM Prof 5] [MASA 2dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 16kHz out, BINAURAL out, JBM Prof 5] [MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out, bandwidth switching] [x] MSAN error fixes for OMASA, ISM [x] MASA ext dirac render converted to fixed point. --- lib_dec/core_switching_dec.c | 4 + lib_dec/dec_uv_fx.c | 3 +- lib_dec/init_dec_fx.c | 9 + lib_dec/ivas_dirac_dec.c | 10 +- lib_dec/ivas_ism_param_dec.c | 5 + lib_dec/ivas_jbm_dec.c | 24 + lib_dec/ivas_omasa_dec.c | 22 + lib_rend/ivas_dirac_onsets_dec.c | 3 + lib_rend/ivas_dirac_output_synthesis_dec.c | 49 +- lib_rend/ivas_dirac_rend.c | 552 +++++++++++++++------ lib_rend/ivas_prot_rend.h | 6 +- lib_rend/ivas_stat_rend.h | 20 + lib_rend/lib_rend.c | 400 ++++++++++++++- 13 files changed, 941 insertions(+), 166 deletions(-) diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 11e1fb89a..18bd70f51 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -114,6 +114,10 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( st->hBWE_TD != NULL && NE_16( st->last_core, ACELP_CORE ) ) { +#ifdef MSAN_FIX + st->hBWE_TD->prev_hb_synth_fx_exp = 31; + move16(); +#endif // MSAN_FIX /* reset BWE memories */ set16_fx( st->hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index 3ab65b728..cc33c23b0 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -294,10 +294,9 @@ static void gain_dec_gacelp_uv_fx( /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */ L_tmp = calc_gain_inov(code, lcode, NULL, NULL); *gain_inov = round_fx(L_shl(L_tmp, 15 - 3)); /* gain_inov in Q12 */ - /* gcode = pred_nrg_frame * (*gain_inov); */ L_tmp = Mpy_32_16_1(pred_nrg_frame, *gain_inov); /* 18Q13 */ - i = norm_l(L_tmp); + i = sub(norm_l(L_tmp),1); //gaurd-bits g_code = round_fx(L_shl(L_tmp, i)); exp_gcode = sub(18, i); diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index bc1fb287d..ef0539a24 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -529,6 +529,9 @@ ivas_error init_decoder_fx( #endif st_fx->output_Fs); +#ifdef MSAN_FIX + st_fx->hBWE_TD->prev_hb_synth_fx_exp = 31; +#endif } ELSE { @@ -1279,6 +1282,9 @@ ivas_error init_decoder_ivas_fx( } hf_synth_init_fx(st_fx->hBWE_zero); +#ifdef MSAN_FIX + set16_fx( st_fx->hBWE_zero->mem_hp400_fx, 0, 6 ); +#endif } ELSE { @@ -1424,6 +1430,9 @@ ivas_error init_decoder_ivas_fx( } td_bwe_dec_init_ivas_fx(st_fx, st_fx->hBWE_TD, st_fx->output_Fs); +#ifdef MSAN_FIX + st_fx->hBWE_TD->prev_hb_synth_fx_exp = 31; +#endif } ELSE { diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 143d8e2b8..ff1a6655f 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5523,13 +5523,13 @@ void ivas_dirac_dec_render_sf_fx( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q6 - 1; move16(); - // Scaling the output to Q10 - scale_sig32(output_buf_fx[ch], samplesToProcess + index_slot * hSpatParamRendCom->num_freq_bands, Q10 - Q11 ); + // Scaling the output to Q8 + scale_sig32(output_buf_fx[ch], samplesToProcess + index_slot * hSpatParamRendCom->num_freq_bands, Q8 - Q11 ); cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[idx_in] ); - // Scaling output from Q6-1 to Q10 - scale_sig32(p_out, out_len, (Q10 - (Q6 - 1))); + // Scaling output from Q6-1 to Q8 + scale_sig32(p_out, out_len, (Q8 - (Q6 - 1))); #if 1 /* TODO: remove fixed to float */ fixedToFloat_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); @@ -5846,7 +5846,7 @@ void ivas_dirac_dec_render_sf_fx( ELSE { // Fixed to float - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q10, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] + index_slot * hSpatParamRendCom->num_freq_bands); + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q8, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] + index_slot * hSpatParamRendCom->num_freq_bands); } } } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 823eaae5f..a9bcb7f64 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -715,6 +715,9 @@ static ivas_error ivas_param_ism_rendering_init( { set32_fx( hParamIsmRendering->mixing_matrix_lin_old_fx[bin_idx], 0, PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX ); } +#ifdef MSAN_FIX + hParamIsmRendering->exp_mixing_matrix_lin_old_fx = 0; +#endif /* memory allocation for proto matrix and interpolator */ if ( ( hParamIsmRendering->proto_matrix = (float *) malloc( hOutSetup.nchan_out_woLFE * nchan_transport * sizeof( float ) ) ) == NULL ) @@ -2044,6 +2047,7 @@ void ivas_param_ism_dec_digest_tc( { #ifdef IVAS_FLOAT_FIXED ivas_param_ism_dec_dequant_DOA_fx( hParamIsmDec, st_ivas->nchan_ism ); +#ifndef MSAN_FIX for ( i = 0; i < 11; i++ ) { for ( int j = 0; j < 1; j++ ) @@ -2054,6 +2058,7 @@ void ivas_param_ism_dec_digest_tc( } } } +#endif ivas_param_ism_dec_dequant_powrat_fx( hParamIsmDec ); for ( i = 0; i < 11; i++ ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 6eade5553..2a7614384 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -3203,6 +3203,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( #if 1 /*Float to fix */ PARAM_ISM_DEC_HANDLE hParamIsmDec; hParamIsmDec = st_ivas->hParamIsmDec; +#ifndef IVAS_FLOAT_FIXED FOR( i = 0; i < 11; i++ ) { FOR( Word16 j = 0; j < 1; j++ ) @@ -3213,6 +3214,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } } +#endif // st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx = float_to_fix16( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_flt, 15 ); SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; hSpatParamRendCom = st_ivas->hSpatParamRendCom; @@ -4554,6 +4556,16 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ +#ifdef MSAN_FIX + FOR( i = 0; i < st_ivas->nchan_transport; i++ ) + { + FOR( j = 0; j < 16; j++ ) + { + st_ivas->hIsmRendererData->gains_fx[i][j] = L_shr( st_ivas->hIsmRendererData->gains_fx[i][j], 1 ); // Q30 -> Q29 + st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shr( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q30 -> Q29 + } + } +#else FOR( i = 0; i < 15; i++ ) { FOR( j = 0; j < 16; j++ ) @@ -4562,6 +4574,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shr( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q30 -> Q29 } } +#endif Word16 Q_buffer_in = 31; FOR( i = 0; i < st_ivas->nchan_transport; i++ ) { @@ -4578,6 +4591,16 @@ ivas_error ivas_jbm_dec_render( fixedToFloat_arrL( p_output_fx[j], p_output[j], Q_buffer_in + 29 - 31, *nSamplesRendered ); } +#ifdef MSAN_FIX + FOR( i = 0; i < st_ivas->nchan_transport; i++ ) + { + FOR( j = 0; j < 16; j++ ) + { + st_ivas->hIsmRendererData->gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->gains_fx[i][j], 1 ); // Q29 -> Q30 + st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q29 -> Q30 + } + } +#else FOR( i = 0; i < 15; i++ ) { FOR( j = 0; j < 16; j++ ) @@ -4586,6 +4609,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q29 -> Q30 } } +#endif } /* Binaural rendering */ diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 7ee3f1e7e..8e5411073 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1292,8 +1292,22 @@ void ivas_omasa_dirac_rend_jbm( Word16 q_output = 31; Word32 **output_fx, data_separated_objects_fx[4][960]; q_output = Q11; +#ifdef MSAN_FIX/*Can be removed when dependency on data_separated_objects is removed*/ + Word16 no_channels; + IF ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + no_channels = 1; + } + ELSE + { + no_channels = st_ivas->nchan_ism; + } + FOR( Word16 ind = 0; ind < no_channels; ind++ ) + { +#else FOR(Word16 ind = 0; ind < MAX_NUM_OBJECTS; ind++) { +#endif // MSAN_FIX FOR(Word16 ind2 = 0; ind2 < nSamplesAsked; ind2++) { //data_separated_objects_fx[ind][ind2] = (Word32)(data_separated_objects[ind][ind2] * (1<proto_power_smooth_prev_len = hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir; } IF ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) { @@ -212,6 +213,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->proto_power_diff_smooth_prev_len = dirac_output_synthesis_params->max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE; } ELSE { @@ -250,6 +252,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->cy_cross_dir_smooth_prev_len = size; IF ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*TODO : remove float code*/ @@ -263,6 +266,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->cy_auto_dir_smooth_prev_len = dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff; } ELSE { @@ -290,6 +294,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->cy_auto_dir_smooth_prev_len = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; IF( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { @@ -297,6 +302,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->cy_auto_diff_smooth_prev_len = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } ELSE { @@ -304,6 +310,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->cy_auto_diff_smooth_prev_len = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff; } } @@ -317,7 +324,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - + dirac_output_synthesis_state->gains_dir_prev_len = size; IF ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*TODO : remove float code*/ @@ -329,6 +336,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->gains_diff_prev_len = dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff; } ELSE IF ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_MONO ) { @@ -341,6 +349,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->gains_diff_prev_len = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff; } ELSE { @@ -353,6 +362,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + dirac_output_synthesis_state->gains_diff_prev_len = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } /*-----------------------------------------------------------------* @@ -401,6 +411,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } set32_fx( dirac_output_synthesis_state->reference_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); + dirac_output_synthesis_state->reference_power_smooth_prev_q = Q31; set32_fx( dirac_output_synthesis_state->direction_smoothness_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); /*TODO : remove float code*/ @@ -967,6 +978,7 @@ void ivas_dirac_dec_output_synthesis_init_fx( IF( h_dirac_output_synthesis_state->proto_power_smooth_prev_fx != NULL ) { set32_fx( h_dirac_output_synthesis_state->proto_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir ); + h_dirac_output_synthesis_state->proto_power_smooth_prev_q = Q31; } set32_fx( h_dirac_output_synthesis_state->gains_dir_prev_fx, 0, size ); h_dirac_output_synthesis_state->gains_dir_prev_q = 0; @@ -985,6 +997,7 @@ void ivas_dirac_dec_output_synthesis_init_fx( { set32_fx( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx, 0, h_dirac_output_synthesis_params->max_band_decorr * nchan_out_woLFE ); } + h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_q = Q31; #endif return; @@ -3183,10 +3196,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { q_com = s_min( *q_reference_power_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); scale_sig32( reference_power_smooth, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); + scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_freq_bands, nchan_target_psds ), sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ); *q_reference_power_smooth = q_com; + h_dirac_output_synthesis_state->reference_power_smooth_prev_q = q_com; + move16(); h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; move16(); @@ -6283,9 +6299,24 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( Word32 diffuse_power[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ Word32 aux_buffer_res[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */ + Word16 q_common, q_reference_power_min_one; + + q_reference_power_min_one = sub( *q_reference_power, Q1 ); + /* estimate direct and diffuse power */ v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_decorr_freq_bands ); // (Q31, q_reference_power) -> q_reference_power + IF( GT_16( *q_cy_auto_diff_smooth, q_reference_power_min_one ) ) + { + q_common = q_reference_power_min_one; + move16(); + } + ELSE + { + q_common = *q_cy_auto_diff_smooth; + move16(); + } + /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { @@ -6300,13 +6331,21 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( v_multc_fixed( aux_buffer_res, diffuse_response_p4, aux_buffer_res, num_decorr_freq_bands ); // (Q30, Q31) -> Q30 v_add_fixed( aux_buffer_res1, aux_buffer_res, aux_buffer_res, num_decorr_freq_bands, 0 ); // Q30 v_mult_fixed( aux_buffer_res, diffuse_power, aux_buffer_res, num_decorr_freq_bands ); // (Q30, q_reference_power) -> q_reference_power - Q1 - Scale_sig32( aux_buffer_res, num_decorr_freq_bands, sub( *q_cy_auto_diff_smooth, sub( *q_reference_power, Q1 ) ) ); // q_cy_auto_diff_smooth - v_add_fixed( &cy_auto_diff_smooth[cur_idx], aux_buffer_res, &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, Q1 ); // (q_cy_auto_diff_smooth - Q1) - Scale_sig32( &cy_auto_diff_smooth[cur_idx + num_decorr_freq_bands], sub( num_freq_bands, num_decorr_freq_bands ), negate( Q1 ) ); // (q_cy_auto_diff_smooth - Q1) + + IF( NE_16( q_common, q_reference_power_min_one ) ) + { + scale_sig32( aux_buffer_res, num_decorr_freq_bands, sub( q_common, q_reference_power_min_one ) ); // q_common + } + IF( NE_16( q_common, *q_cy_auto_diff_smooth ) ) + { + scale_sig32( &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, sub( q_common, *q_cy_auto_diff_smooth ) ); // q_common + } + v_add_fixed( &cy_auto_diff_smooth[cur_idx], aux_buffer_res, &cy_auto_diff_smooth[cur_idx], num_decorr_freq_bands, Q1 ); // (q_common - Q1) + scale_sig32( &cy_auto_diff_smooth[cur_idx + num_decorr_freq_bands], sub( num_freq_bands, num_decorr_freq_bands ), sub( sub( q_common, Q1 ), *q_cy_auto_diff_smooth ) ); // (q_common - Q1) } /* Q adjustment */ - *q_cy_auto_diff_smooth = sub( *q_cy_auto_diff_smooth, Q1 ); + *q_cy_auto_diff_smooth = sub( q_common, Q1 ); move16(); return; diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index bd0300711..94cd7e02a 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1506,6 +1506,7 @@ ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero_fx( hDirAC_mem->cy_auto_dir_smooth_fx, size ); + hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len = size; #endif if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) @@ -1519,8 +1520,8 @@ ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero_fx( hDirAC_mem->proto_power_smooth_fx, size ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len = size; #endif - if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); @@ -1603,10 +1604,12 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } + hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len = size_ho; #ifdef MSAN_FIX set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size_ho ); #else set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size ); + hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len = size_ho; #endif #endif @@ -1623,6 +1626,7 @@ ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero_fx( hDirAC_mem->cy_auto_diff_smooth_fx, size ); + hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len = size; #endif } else @@ -1638,6 +1642,7 @@ ivas_error ivas_dirac_alloc_mem( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero_fx( hDirAC_mem->cy_auto_diff_smooth_fx, num_outputs_diff * num_freq_bands_diff ); + hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len = num_outputs_diff * num_freq_bands_diff; #endif } hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; @@ -1692,6 +1697,8 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } + + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len = 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands; #endif if ( hDirACRend->proto_signal_decorr_on ) @@ -1799,6 +1806,10 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } + + hDirAC_mem->reference_power_len = 2 * num_freq_bands; + hDirAC_mem->reference_power_q = Q31; + hDirAC_mem->reference_power_smooth_q = Q31; #endif if ( hDirACRend->proto_signal_decorr_on ) { @@ -1815,6 +1826,7 @@ ivas_error ivas_dirac_alloc_mem( set_zero( hDirAC_mem->onset_filter, num_outputs_diff * num_freq_bands); set_zero_fx( hDirAC_mem->onset_filter_fx, num_outputs_diff * num_freq_bands ); #endif + hDirAC_mem->onset_filter_len = 2 * num_freq_bands; #endif } } @@ -1832,6 +1844,8 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } + + hDirAC_mem->reference_power_len = 5 * num_freq_bands; #endif } @@ -1850,6 +1864,7 @@ ivas_error ivas_dirac_alloc_mem( set_zero( hDirAC_mem->onset_filter, 2 * num_freq_bands ); set_zero_fx( hDirAC_mem->onset_filter_fx, 2 * num_freq_bands ); #endif + hDirAC_mem->onset_filter_len = 2 * num_freq_bands; #endif } } @@ -3010,7 +3025,11 @@ void protoSignalComputation2_fx( q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], num_freq_bands ), L_norm_arr( ImagBuffer_fx[l][0], num_freq_bands ) ); min_q_shift = s_min( min_q_shift, q_shift ); +#ifdef MSAN_FIX + q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], s_min(num_freq_bands, MASA_SUM_FREQ_RANGE_BINS)), L_norm_arr( ImagBuffer_fx[l][0], s_min(num_freq_bands, MASA_SUM_FREQ_RANGE_BINS)) ); +#else q_shift = s_min( L_norm_arr( RealBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ), L_norm_arr( ImagBuffer_fx[l][0], MASA_SUM_FREQ_RANGE_BINS ) ); +#endif // MSAN_FIX temp_q_shift = s_min( temp_q_shift, q_shift ); } @@ -4685,6 +4704,7 @@ void ivas_masa_init_stereotype_detection_fx( stereo_type_detect->subtract_power_y_fx = 0; stereo_type_detect->q_subtract_power_y = Q31; stereo_type_detect->subtract_power_y_smooth_fx = 0; + stereo_type_detect->q_subtract_power_y_smooth = Q31; stereo_type_detect->target_power_y_smooth_fx = 0; stereo_type_detect->lr_total_bb_ratio_db_fx = 0; @@ -5440,6 +5460,7 @@ void rotateAziEle_DirAC( } /* A reduced rewrite of the corresponding decoder side function */ +#ifndef IVAS_FLOAT_FIXED static void ivas_masa_ext_dirac_render_sf( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: IVAS decoder structure */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -5715,35 +5736,7 @@ static void ivas_masa_ext_dirac_render_sf( if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { /* Compute diffuse prototypes */ -#ifdef IVAS_FLOAT_FIXED_u - /* Float to fixed */ - if (hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0) - { - f2me_buf(hDirACRend->proto_frame_dec_f, hDirACRend->proto_frame_dec_f_fx, &hDirACRend->proto_frame_dec_f_q, hDirACRend->proto_frame_dec_f_len); - hDirACRend->proto_frame_dec_f_q = 31 - hDirACRend->proto_frame_dec_f_q; - DIRAC_OUTPUT_SYNTHESIS_STATE *state = &(hDirACRend->h_output_synthesis_psd_state); - f2me_buf(state->proto_power_diff_smooth, state->proto_power_diff_smooth_fx, &state->proto_power_diff_smooth_q, state->proto_power_diff_smooth_len); - state->proto_power_diff_smooth_q = 31 - state->proto_power_diff_smooth_q; - f2me_buf(state->proto_diffuse_buffer_f, state->proto_diffuse_buffer_f_fx, &state->proto_diffuse_buffer_f_q, state->proto_diffuse_buffer_f_len); - state->proto_diffuse_buffer_f_q = 31 - state->proto_diffuse_buffer_f_q; - } - ivas_dirac_dec_compute_diffuse_proto_fx( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); - /* Fixed to float */ - if (hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0) - { - DIRAC_OUTPUT_SYNTHESIS_STATE *state = &(hDirACRend->h_output_synthesis_psd_state); - me2f_buf(state->proto_power_diff_smooth_fx, - 31 - state->proto_power_diff_smooth_q, - state->proto_power_diff_smooth, - state->proto_power_diff_smooth_len); - me2f_buf(state->proto_diffuse_buffer_f_fx, - 31 - state->proto_diffuse_buffer_f_q, - state->proto_diffuse_buffer_f, - state->proto_diffuse_buffer_f_len); - } -#else ivas_dirac_dec_compute_diffuse_proto( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); -#endif } ivas_dirac_dec_output_synthesis_process_slot( reference_power, @@ -5768,13 +5761,7 @@ static void ivas_masa_ext_dirac_render_sf( } } -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_dec_output_synthesis_get_interpolator_fx( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); - fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -#else ivas_dirac_dec_output_synthesis_get_interpolator( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -#endif - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { @@ -5852,38 +5839,47 @@ static void ivas_masa_ext_dirac_render_sf( return; } -#ifdef IVAS_FLOAT_FIXED_u //Currently disabled +#else static void ivas_masa_ext_dirac_render_sf_fx( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: IVAS decoder structure */ - Word32 *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ + Word32 *output_f_fx[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { - int16_t i, ch, idx_in, idx_lfe; + Word16 i, ch, idx_in, idx_lfe; DIRAC_REND_HANDLE hDirACRend; - Word32 dirEne; - Word32 surCohEner; - Word16 surCohRatio[CLDFB_NO_CHANNELS_MAX]; - Word16 surCohRatio_exp; Word16 subframe_idx; Word16 slot_idx, index_slot; Word16 slot_idx_start, slot_idx_start_cldfb_synth, md_idx; - Word16 nchan_transport, q_cldfb; + Word16 nchan_transport; Word16 masa_band_mapping[MASA_FREQUENCY_BANDS + 1]; - /* CLDFB: last output channels reserved to LFT for CICPx */ - Word32 Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - /* local copies of azi, ele, diffuseness */ Word16 azimuth[CLDFB_NO_CHANNELS_MAX]; Word16 elevation[CLDFB_NO_CHANNELS_MAX]; - Word32 diffuseness_vector[CLDFB_NO_CHANNELS_MAX]; + + Word32 diffuseness_vector_fx[CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word16 q_cldfb = 0; + Word32 surCohRatio_fx[CLDFB_NO_CHANNELS_MAX]; + Word16 Q_surCohRatio, surCohRatio_exp[CLDFB_NO_CHANNELS_MAX]; + Word32 dirEne_fx; + Word32 surCohEner_fx; + + FOR(Word16 ii = 0; ii < MAX_OUTPUT_CHANNELS; ii++) + { + FOR(Word16 jj = 0; jj < MAX_PARAM_SPATIAL_SUBFRAMES; jj++) + { + set_zero_fx( Cldfb_RealBuffer_fx[ii][jj], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( Cldfb_ImagBuffer_fx[ii][jj], CLDFB_NO_CHANNELS_MAX ); + } + } DIRAC_DEC_STACK_MEM DirAC_mem; - Word32 *reference_power, *reference_power_smooth; - Word16 q_reference_power; - Word32 *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; - uint16_t coherence_flag; + + Word32 *onset_filter_fx, *onset_filter_subframe_fx, *p_onset_filter_fx = NULL; + Word32 *reference_power_smooth_fx, *reference_power_fix; + UWord16 coherence_flag; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; push_wmops( "ivas_masa_ext_dirac_render_sf" ); @@ -5891,20 +5887,21 @@ static void ivas_masa_ext_dirac_render_sf_fx( /* Initialize aux buffers */ hDirACRend = hMasaExtRend->hDirACRend; hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; - nchan_transport = hMasaExtRend->nchan_input; - move16(); + nchan_transport = hMasaExtRend->nchan_input; move16(); + DirAC_mem = hDirACRend->stack_mem; - reference_power = DirAC_mem.reference_power_fx; move32(); - reference_power_smooth = ( DirAC_mem.reference_power_fx == NULL ) ? NULL : DirAC_mem.reference_power_fx + hSpatParamRendCom->num_freq_bands; - onset_filter = DirAC_mem.onset_filter_fx; - onset_filter_subframe = ( DirAC_mem.onset_filter_fx == NULL ) ? NULL : DirAC_mem.onset_filter_fx + hSpatParamRendCom->num_freq_bands; + onset_filter_fx = DirAC_mem.onset_filter_fx; + reference_power_fix = DirAC_mem.reference_power_fx; + reference_power_smooth_fx = ( DirAC_mem.reference_power_fx == NULL ) ? NULL : DirAC_mem.reference_power_fx + hSpatParamRendCom->num_freq_bands; + //DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q = Q31; + onset_filter_subframe_fx = ( DirAC_mem.onset_filter_fx == NULL ) ? NULL : DirAC_mem.onset_filter_fx + hSpatParamRendCom->num_freq_bands; coherence_flag = 1; /* There is always coherence assumed for ext rend of MASA */ move16(); /* Construct default MASA band mapping */ FOR ( i = 0; i < MASA_FREQUENCY_BANDS + 1; i++ ) { - masa_band_mapping[i] = i; move16(); + masa_band_mapping[i] = i; move16(); } /* Subframe loop */ @@ -5914,44 +5911,61 @@ static void ivas_masa_ext_dirac_render_sf_fx( subframe_idx = hSpatParamRendCom->subframes_rendered; move16(); md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; move16(); + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + /* copy parameters into local buffers*/ + Copy( hSpatParamRendCom->azimuth[hSpatParamRendCom->render_to_md_map[subframe_idx]], azimuth, hSpatParamRendCom->num_freq_bands ); Copy( hSpatParamRendCom->elevation[hSpatParamRendCom->render_to_md_map[subframe_idx]], elevation, hSpatParamRendCom->num_freq_bands ); - Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); + Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); IF ( NE_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) { - set32_fx( reference_power_smooth, 0, hSpatParamRendCom->num_freq_bands ); + set32_fx( reference_power_smooth_fx, 0, hSpatParamRendCom->num_freq_bands ); } ELSE { - set32_fx( onset_filter_subframe, 0, hSpatParamRendCom->num_freq_bands ); + set32_fx( onset_filter_subframe_fx, 0, hSpatParamRendCom->num_freq_bands ); } /* compute response */ IF ( NE_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) { ivas_dirac_dec_compute_power_factors_fx( hSpatParamRendCom->num_freq_bands, - diffuseness_vector, - hDirACRend->h_output_synthesis_psd_params.max_band_decorr, - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx ); + diffuseness_vector_fx, + hDirACRend->h_output_synthesis_psd_params.max_band_decorr, + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx ); + + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q29; move16(); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q29; move16(); + IF ( coherence_flag ) { + Word16 temp_exp = MIN_16; move16(); FOR ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - dirEne = hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i]; move32(); - surCohEner = Mpy_32_16_1(hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]); //Q.31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i] = L_sub(hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], surCohEner); - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i] = L_add(hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], surCohEner); + dirEne_fx = hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i]; move32(); + surCohEner_fx = Mpy_32_16_1(hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]); //Q.29 + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i] = L_sub(hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], surCohEner_fx); + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i] = L_add(hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], surCohEner_fx); - surCohRatio[i] = BASOP_Util_Divide3232_Scale( surCohEner, L_add( L_add(1, dirEne), surCohEner ), &surCohRatio_exp); + surCohRatio_fx[i] = L_deposit_h(BASOP_Util_Divide3232_Scale( surCohEner_fx, L_add( L_add(1, dirEne_fx), surCohEner_fx ), &surCohRatio_exp[i])); + temp_exp = s_max(temp_exp, surCohRatio_exp[i]); } + + FOR(i = 0; i < hSpatParamRendCom->num_freq_bands; i++) + { + surCohRatio_fx[i] = L_shr(surCohRatio_fx[i], sub(temp_exp, surCohRatio_exp[i])); + } + Q_surCohRatio = sub(31, temp_exp); } ELSE { - set16_fx( surCohRatio, 0, hSpatParamRendCom->num_freq_bands ); + set32_fx( surCohRatio_fx, 0, hSpatParamRendCom->num_freq_bands ); + Q_surCohRatio = 31; move16(); } } ELSE @@ -5961,20 +5975,23 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, &hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, - &hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q + &hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); - + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = sub(31, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = sub(31, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q); IF ( coherence_flag ) { FOR ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - surCohRatio[i] = hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]; move16(); + surCohRatio_fx[i] = L_deposit_h(hSpatParamRendCom->surroundingCoherence_fx[md_idx][i]); move16(); } } ELSE { - set16_fx( surCohRatio, 0, hSpatParamRendCom->num_freq_bands ); + set32_fx( surCohRatio_fx, 0, hSpatParamRendCom->num_freq_bands ); } + + Q_surCohRatio = Q31; move16(); } ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, @@ -5985,94 +6002,137 @@ static void ivas_masa_ext_dirac_render_sf_fx( azimuth, elevation, md_idx, - surCohRatio, - surCohRatio_exp, + surCohRatio_fx, + Q_surCohRatio, 0, NULL, 0 ); + Word16 proto_direct_buffer_f_temp_q[60]; + Word16 temp_proto_frame_q; FOR ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = add(slot_idx_start, slot_idx); md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; move16(); + proto_direct_buffer_f_temp_q[slot_idx] = MAX_16; move16(); /* CLDFB Analysis*/ FOR ( ch = 0; ch < nchan_transport; ch++ ) { - cldfbAnalysis_ts_fx( &( output_f[ch][hSpatParamRendCom->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - hSpatParamRendCom->num_freq_bands, - hMasaExtRend->cldfbAnaRend[ch], q_cldfb); + q_cldfb = 11; move16(); + hMasaExtRend->cldfbAnaRend[ch]->Q_cldfb_state = q_cldfb; move16(); + cldfbAnalysis_ts_fx_fixed_q( &( output_f_fx[ch][hSpatParamRendCom->num_freq_bands * index_slot] ) , + Cldfb_RealBuffer_fx[ch][0], + Cldfb_ImagBuffer_fx[ch][0], + hSpatParamRendCom->num_freq_bands, + hMasaExtRend->cldfbAnaRend[ch], &q_cldfb ); } - IF ( EQ_16(nchan_transport, 1 )) { /* Need to set second CLDFB channel to zero as further processing assumes CNA content in it */ - set16_fx( Cldfb_RealBuffer[1][0], 0, hSpatParamRendCom->num_freq_bands ); - set16_fx( Cldfb_ImagBuffer[1][0], 0, hSpatParamRendCom->num_freq_bands ); + set32_fx( Cldfb_RealBuffer_fx[1][0], 0, hSpatParamRendCom->num_freq_bands ); + set32_fx( Cldfb_ImagBuffer_fx[1][0], 0, hSpatParamRendCom->num_freq_bands ); } - /*-----------------------------------------------------------------* * prototype signal computation *-----------------------------------------------------------------*/ IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) { - protoSignalComputation_shd_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, + protoSignalComputation_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - reference_power, q_reference_power, slot_idx, nchan_transport, + reference_power_fix, &DirAC_mem.reference_power_q, slot_idx, nchan_transport, hDirACRend->num_outputs_diff, hSpatParamRendCom->num_freq_bands, 0, q_cldfb); - } + + proto_direct_buffer_f_temp_q[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; move16(); + } ELSE IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO )) { - protoSignalComputation2_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, + protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, &hDirACRend->proto_frame_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - reference_power, q_reference_power, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power_fix, &DirAC_mem.reference_power_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, + &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, 0, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect, q_cldfb); + + proto_direct_buffer_f_temp_q[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; move16(); + IF(LT_16(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)){ + Scale_sig32(reference_power_fix + hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands), sub(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)); + DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; move16(); + } ELSE { + Scale_sig32(reference_power_fix, hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q)); + DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; move16(); + } + temp_proto_frame_q = getScaleFactor32(hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len) - 2; + Scale_sig32(hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len, temp_proto_frame_q); + hDirACRend->proto_frame_f_q = add(hDirACRend->proto_frame_f_q, temp_proto_frame_q); } ELSE { SWITCH ( nchan_transport ) { case 2: - protoSignalComputation2_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, + protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, - hDirACRend->proto_frame_f_q, + &hDirACRend->proto_frame_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - reference_power, - q_reference_power, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power_fix, &DirAC_mem.reference_power_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->hOutSetup.is_loudspeaker_setup, slot_idx, hSpatParamRendCom->num_freq_bands, hDirACRend->masa_stereo_type_detect, q_cldfb); - BREAK; + + proto_direct_buffer_f_temp_q[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; move16(); + IF(LT_16(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)){ + Scale_sig32(reference_power_fix + hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands), sub(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)); + DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; move16(); + } ELSE { + Scale_sig32(reference_power_fix, hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q)); + DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; move16(); + } + temp_proto_frame_q = getScaleFactor32(hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len) -2; + Scale_sig32(hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len, temp_proto_frame_q); + hDirACRend->proto_frame_f_q = add(hDirACRend->proto_frame_f_q, temp_proto_frame_q); + + BREAK; case 1: - protoSignalComputation1_fx( Cldfb_RealBuffer, Cldfb_ImagBuffer, + protoSignalComputation1_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, - hDirACRend->proto_frame_f_q, + &hDirACRend->proto_frame_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - reference_power, - q_reference_power, + &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, + reference_power_fix, &DirAC_mem.reference_power_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, + &hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, slot_idx, hDirACRend->num_protos_diff, hSpatParamRendCom->num_freq_bands, q_cldfb); - BREAK; + + proto_direct_buffer_f_temp_q[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; move16(); + + IF(LT_16(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)){ + Scale_sig32(reference_power_fix + hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands), sub(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)); + DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; move16(); + } ELSE { + Scale_sig32(reference_power_fix, hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q)); + DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; move16(); + } + + temp_proto_frame_q = getScaleFactor32(hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len) - 2; + Scale_sig32(hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_len, temp_proto_frame_q); + hDirACRend->proto_frame_f_q = add(hDirACRend->proto_frame_f_q, temp_proto_frame_q); + + BREAK; default: return; } @@ -6081,7 +6141,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ - IF ( EQ_16(hDirACRend->proto_signal_decorr_on, 1 )) { /* decorrelate prototype frame */ @@ -6092,22 +6151,26 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->num_protos_diff, hDirACRend->synthesisConf, nchan_transport, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + i_mult(i_mult(slot_idx, hSpatParamRendCom->num_freq_bands), shl( hDirACRend->num_outputs_diff, 1)), + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->num_protos_diff, hDirACRend->proto_index_diff, - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + add (i_mult(i_mult(slot_idx, hSpatParamRendCom->num_freq_bands), shl(hDirACRend->num_outputs_diff, 1)) , shl(i_mult(hSpatParamRendCom->num_freq_bands, s_min( 4, nchan_transport )), 1)), - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - onset_filter, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport ), + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, + onset_filter_fx, hDirACRend->h_freq_domain_decorr_ap_params, hDirACRend->h_freq_domain_decorr_ap_state ); - v_multc_fixed( onset_filter, ONE_IN_Q28, onset_filter, hSpatParamRendCom->num_freq_bands ); /*0.25 in Q31 = Q28*/ - v_add_fixed( onset_filter, onset_filter_subframe, onset_filter_subframe, hSpatParamRendCom->num_freq_bands, 1); - p_onset_filter = onset_filter_subframe; + Scale_sig32(onset_filter_fx, hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands, -1); + + v_multc_fixed( onset_filter_fx, ONE_IN_Q29, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); /*0.25 in Q30 = Q28*/ + v_add_fixed( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands, 1); + p_onset_filter_fx = onset_filter_subframe_fx; } ELSE { + set_zero_fx(DirAC_mem.frame_dec_f_fx, DirAC_mem.frame_dec_f_len); + ivas_dirac_dec_decorr_process_fx( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, @@ -6118,45 +6181,61 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->num_protos_diff, hDirACRend->proto_index_diff, DirAC_mem.frame_dec_f_fx, - DirAC_mem.frame_dec_f_q, - onset_filter, + &DirAC_mem.frame_dec_f_q, + onset_filter_fx, hDirACRend->h_freq_domain_decorr_ap_params, hDirACRend->h_freq_domain_decorr_ap_state ); - + + Scale_sig32(onset_filter_fx, hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands, -1); hDirACRend->proto_frame_dec_f_fx = DirAC_mem.frame_dec_f_fx; - p_onset_filter = onset_filter; + hDirACRend->proto_frame_dec_f_q = DirAC_mem.frame_dec_f_q; move16(); + p_onset_filter_fx = onset_filter_fx; } } ELSE { IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) { - set32_fx( onset_filter_subframe, MAX_32, hSpatParamRendCom->num_freq_bands ); - p_onset_filter = onset_filter_subframe; + set32_fx( onset_filter_subframe_fx, MAX_32, hSpatParamRendCom->num_freq_bands ); + p_onset_filter_fx = onset_filter_subframe_fx; } ELSE { /* no frequency domain decorrelation: use prototype frame */ hDirACRend->proto_frame_dec_f_fx = hDirACRend->proto_frame_f_fx; - p_onset_filter = NULL; + hDirACRend->proto_frame_dec_f_q = hDirACRend->proto_frame_f_q; + p_onset_filter_fx = NULL; } } /*-----------------------------------------------------------------* * output synthesis *-----------------------------------------------------------------*/ + test(); IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS) || EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD )) { /* Compute diffuse prototypes */ ivas_dirac_dec_compute_diffuse_proto_fx( hDirACRend, hSpatParamRendCom->num_freq_bands, slot_idx ); + } + Scale_sig32(h_dirac_output_synthesis_state->diffuse_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub(31, h_dirac_output_synthesis_state->diffuse_power_factor_q)); + h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; move16(); - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub(31, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q)); + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; move16(); + + /*Word16 q_cy_auto_diff_smooth = getScaleFactor32(h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_len); + Scale_sig32(h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_len, q_cy_auto_diff_smooth); + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add(h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, q_cy_auto_diff_smooth);*/ + + ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fix, + DirAC_mem.reference_power_q, + p_onset_filter_fx, azimuth, elevation, hSpatParamRendCom->diffuseness_vector_fx[md_idx], + hSpatParamRendCom->q_diffuseness_vector, hSpatParamRendCom, hDirACRend, 0, @@ -6170,39 +6249,200 @@ static void ivas_masa_ext_dirac_render_sf_fx( IF ( NE_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) { - v_add_fixed( reference_power, reference_power_smooth, reference_power_smooth, hSpatParamRendCom->num_freq_bands, 1); + Scale_sig32(DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len, -1); + DirAC_mem.reference_power_q = sub(DirAC_mem.reference_power_q, 1); + DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; + v_add_fixed( reference_power_fix, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 0); } } + /*Rescaling proto_direct_buffer_f*/ + Word16 temp = MAX_16; + + FOR(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++) + { + temp = s_min(temp, proto_direct_buffer_f_temp_q[slot_idx]); + } + + IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) + { + FOR(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++) + { + Scale_sig32(&hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult(slot_idx , idiv1616(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len , hSpatParamRendCom->subframe_nbslots[subframe_idx]))], idiv1616(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len , hSpatParamRendCom->subframe_nbslots[subframe_idx]), sub(temp, proto_direct_buffer_f_temp_q[slot_idx])); + } + } + ELSE + { + FOR(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++) + { + Scale_sig32(&hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult(slot_idx , idiv1616(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len , hSpatParamRendCom->subframe_nbslots[subframe_idx]))], idiv1616(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len , hSpatParamRendCom->subframe_nbslots[subframe_idx]), sub(temp, proto_direct_buffer_f_temp_q[slot_idx])); + } + + } + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q = temp; move16(); + ivas_dirac_dec_output_synthesis_get_interpolator_fx( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + /*Memories Scaling*/ + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub(31, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q)); + hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; move16(); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub(31, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q)); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q31; move16(); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands, sub(31, hDirACRend->h_output_synthesis_psd_state.direct_responses_q)); + hDirACRend->h_output_synthesis_psd_state.direct_responses_q = Q31; move16(); + IF ( EQ_16(hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD )) { - ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( Cldfb_RealBuffer, - Cldfb_ImagBuffer, + FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + { + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + Scale_sig32(Cldfb_RealBuffer_fx[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, sub(6, q_cldfb)); + Scale_sig32(Cldfb_ImagBuffer_fx[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, sub(6, q_cldfb)); + } + } + q_cldfb = 6; move16(); + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len, sub(26, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth)); + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = Q26; move16(); + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len, sub(26, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth)); + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = Q26; move16(); + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_len, sub(26, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev)); + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = Q26; move16(); + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len, sub(26, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev)); + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = Q26; move16(); + + ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( Cldfb_RealBuffer_fx, + Cldfb_ImagBuffer_fx, hSpatParamRendCom, hDirACRend, nchan_transport, hSpatParamRendCom->subframe_nbslots[subframe_idx], - p_onset_filter, - diffuseness_vector, - 0, + p_onset_filter_fx, + diffuseness_vector_fx, 0, + 0, &hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, - &hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev - ); + &hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev); + q_cldfb = -2; move16(); + hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev; move16(); + hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev; move16(); } ELSE { - ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, - Cldfb_ImagBuffer, +#if 1 + IF( hDirACRend->proto_signal_decorr_on ) + { + //hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; + + Word16 new_proto_diffuse_buffer_f_q = getScaleFactor32(hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len); + Word16 new_proto_direct_buffer_f_q = getScaleFactor32(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len); + + scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, new_proto_diffuse_buffer_f_q); + scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len, new_proto_direct_buffer_f_q); + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q = add(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, new_proto_direct_buffer_f_q); + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = add(hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, new_proto_diffuse_buffer_f_q); + + /*scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, sub(s_min(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q), hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q)); + scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len, sub(s_min(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q), hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q)); + hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q = s_min(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q); + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = s_min(hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q);*/ + } +#endif + /*Buffer Scaling*/ + FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + { + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + Scale_sig32(Cldfb_RealBuffer_fx[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, sub(11, q_cldfb)); + Scale_sig32(Cldfb_ImagBuffer_fx[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, sub(11, q_cldfb)); + } + } + q_cldfb = 11; move16(); + + + Word16 reference_power_temp_q = getScaleFactor32(DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len); + scale_sig32(DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len, reference_power_temp_q); + DirAC_mem.reference_power_q = add(DirAC_mem.reference_power_q, reference_power_temp_q); + DirAC_mem.reference_power_smooth_q = add(DirAC_mem.reference_power_q, reference_power_temp_q); + + Word16 q_cy_auto_diff_smooth = getScaleFactor32(h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_len); + Scale_sig32(h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_len, q_cy_auto_diff_smooth); + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add(h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, q_cy_auto_diff_smooth); + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands, sub(31, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q)); + hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q = Q31; move16(); + Scale_sig32(h_dirac_output_synthesis_state->diffuse_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub(31, h_dirac_output_synthesis_state->diffuse_power_factor_q)); + h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; move16(); + Scale_sig32(h_dirac_output_synthesis_state->direct_responses_fx, hSpatParamRendCom->num_freq_bands, sub(31, h_dirac_output_synthesis_state->direct_responses_q)); + h_dirac_output_synthesis_state->direct_responses_q = Q31; move16(); + + /*Q-adjustment*/ + IF( hDirACRend->masa_stereo_type_detect ) + { + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = L_shl(hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, sub(s_min(hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y),hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth)); + hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = L_shl(hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, sub(s_min(hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y),hDirACRend->masa_stereo_type_detect->q_subtract_power_y)); + + hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth = s_min(hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y); + hDirACRend->masa_stereo_type_detect->q_subtract_power_y = s_min(hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y); + } + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, sub(s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q),hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q)); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q); + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, sub(s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q), hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q)); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q); + + Word16 proto_power_diff_smooth_prev_temp_q = getScaleFactor32(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len); + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len, proto_power_diff_smooth_prev_temp_q); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = add(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, proto_power_diff_smooth_prev_temp_q); + + Word16 proto_power_diff_smooth_temp_q = getScaleFactor32(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len); + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len, proto_power_diff_smooth_temp_q); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = add(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, proto_power_diff_smooth_temp_q); + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len, sub(s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q),hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q)); + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len, sub(s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q),hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q)); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = s_min(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q); + + Scale_sig32(diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands, 1); + + /*Buffer rescaling*/ + + Scale_sig32(hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hSpatParamRendCom->num_freq_bands, sub(s_min(hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q),hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q)); + Scale_sig32(DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len, sub(s_min(hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q),DirAC_mem.reference_power_q)); + + hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = s_min(hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q); + DirAC_mem.reference_power_q = s_min(hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q); + DirAC_mem.reference_power_smooth_q = s_min(hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, DirAC_mem.reference_power_q); + + ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Cldfb_RealBuffer_fx, + Cldfb_ImagBuffer_fx, hSpatParamRendCom, hDirACRend, hSpatParamRendCom->subframe_nbslots[subframe_idx], - diffuseness_vector, - reference_power_smooth, - 1.0f, - 0 ); + diffuseness_vector_fx, + reference_power_smooth_fx, + &DirAC_mem.reference_power_smooth_q, + ONE_IN_Q31, + 0, &q_cldfb ); + + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q; + hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = DirAC_mem.reference_power_smooth_q; + IF(LT_16(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)){ + Scale_sig32(reference_power_fix + hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_len, hSpatParamRendCom->num_freq_bands), sub(DirAC_mem.reference_power_q, DirAC_mem.reference_power_smooth_q)); + DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q; move16(); + } ELSE { + Scale_sig32(reference_power_fix, hSpatParamRendCom->num_freq_bands, sub(DirAC_mem.reference_power_smooth_q, DirAC_mem.reference_power_q)); + DirAC_mem.reference_power_q = DirAC_mem.reference_power_smooth_q; move16(); + } } /*-----------------------------------------------------------------* @@ -6212,9 +6452,22 @@ static void ivas_masa_ext_dirac_render_sf_fx( index_slot = slot_idx_start_cldfb_synth; move16(); { - Word32 *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - Word32 *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; Word16 outchannels; + Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; + + FOR( ch = 0; ch < hDirACRend->num_outputs_dir; ch++ ) + { + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + Scale_sig32(Cldfb_RealBuffer_fx[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, sub(10, q_cldfb)); + Scale_sig32(Cldfb_ImagBuffer_fx[ch][slot_idx], + hSpatParamRendCom->num_freq_bands, sub(10, q_cldfb)); + } + } + q_cldfb = 10; move16(); + hMasaExtRend->cldfbSynRend[0]->Q_cldfb_state = q_cldfb; move16(); idx_in = 0; move16(); idx_lfe = 0; move16(); @@ -6222,13 +6475,12 @@ static void ivas_masa_ext_dirac_render_sf_fx( outchannels = add(hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe); /* Note here that compared to decoder path, there is no separate channel ever for MASA ext rend path */ - FOR ( ch = 0; ch < outchannels; ch++ ) { IF ( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ) && ( EQ_16(hDirACRend->hOutSetup.index_lfe[idx_lfe], ch )) ) { /* No LFE for MASA rendering */ - set32_fx( &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), 0, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); + set32_fx( &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), 0, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); IF ( LT_16(idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) )) { @@ -6238,15 +6490,18 @@ static void ivas_masa_ext_dirac_render_sf_fx( ELSE { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + FOR ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + RealBuffer_fx[i] = Cldfb_RealBuffer_fx[idx_in][i]; + ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; } - cldfbSynthesis_ivas_fx( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], hMasaExtRend->cldfbSynRend[idx_in] ); + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_f_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], hMasaExtRend->cldfbSynRend[idx_in] ); idx_in++; } } + + hMasaExtRend->cldfbSynRend[0]->Q_cldfb_state = sub(q_cldfb, 1); } hSpatParamRendCom->slots_rendered = add(hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->slots_rendered); hSpatParamRendCom->subframes_rendered++; @@ -6256,6 +6511,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( return; } #endif +#ifndef IVAS_FLOAT_FIXED void ivas_masa_ext_dirac_render( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ float *output_f[], /* i/o: input/output signals in time domain */ @@ -6292,7 +6548,7 @@ void ivas_masa_ext_dirac_render( return; } -#ifdef IVAS_FLOAT_FIXED_u //Currently disabled +#else void ivas_masa_ext_dirac_render_fx( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ Word32 *output_f[], /* i/o: input/output signals in time domain */ @@ -6317,7 +6573,7 @@ void ivas_masa_ext_dirac_render_fx( FOR ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { - hSpatParamRendCom->slots_rendered = 0; + hSpatParamRendCom->slots_rendered = 0; move16(); ivas_masa_ext_dirac_render_sf_fx( hMasaExtRend, output_f_local ); FOR ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 491286d4c..ebb3e8c4b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1057,19 +1057,19 @@ void ivas_dirac_deallocate_parameters( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ const int16_t params_flag /* i : set of parameters flag */ ); - +#ifndef IVAS_FLOAT_FIXED void ivas_masa_ext_dirac_render( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ float *output_f[], /* i/o: input/output signals in time domain */ const int16_t num_subframes /* i : number of subframes to render */ ); - +#else void ivas_masa_ext_dirac_render_fx( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ Word32 *output_f[], /* i/o: input/output signals in time domain */ const Word16 num_subframes /* i : number of subframes to render */ ); - +#endif /*----------------------------------------------------------------------------------* * HRTF *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2f3ad8378..f469a5fe5 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -315,7 +315,10 @@ typedef struct dirac_dec_stack_mem #ifdef IVAS_FLOAT_FIXED Word32 *reference_power_fx; Word16 reference_power_q; + Word16 reference_power_smooth_q; + Word16 reference_power_len; Word32 *onset_filter_fx; + Word16 onset_filter_len; #endif } DIRAC_DEC_STACK_MEM, *DIRAC_DEC_STACK_MEM_HANDLE; @@ -411,17 +414,22 @@ typedef struct dirac_output_synthesis_state_structure Word32 *proto_power_smooth_fx; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ Word16 proto_power_smooth_q; + Word16 proto_power_smooth_len; Word32 *proto_power_smooth_prev_fx; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ Word16 proto_power_smooth_prev_q; + Word16 proto_power_smooth_prev_len; Word32 *proto_power_diff_smooth_fx; Word32 *proto_power_diff_smooth_prev_fx; + Word16 proto_power_diff_smooth_prev_len; + Word16 proto_power_diff_smooth_prev_q; Word16 proto_power_diff_smooth_q; Word16 proto_power_diff_smooth_len; /* only pointer to local buffers */ Word32 *proto_direct_buffer_f_fx; /* Buffer for direct sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ Word16 proto_direct_buffer_f_q; + Word16 proto_direct_buffer_f_len; Word32 *proto_diffuse_buffer_f_fx; /* Buffer for diffuse sound prototype signals. Size: 2*num_freq_bands*num_channels*buffer_length (complex interleaved). */ Word16 proto_diffuse_buffer_f_q; Word16 proto_diffuse_buffer_f_len; @@ -433,6 +441,9 @@ typedef struct dirac_output_synthesis_state_structure Word16 gains_dir_prev_q; Word16 gains_diff_prev_q; + Word16 gains_dir_prev_len; + Word16 gains_diff_prev_len; + /* only pointer to local buffers */ Word32 *cy_auto_dir_smooth_fx; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ Word32 *cy_cross_dir_smooth_fx; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ @@ -442,6 +453,10 @@ typedef struct dirac_output_synthesis_state_structure Word16 q_cy_cross_dir_smooth; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ Word16 q_cy_auto_diff_smooth; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + Word16 cy_auto_dir_smooth_len; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ + Word16 cy_cross_dir_smooth_len; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ + Word16 cy_auto_diff_smooth_len; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + /* PSD memories */ Word32 *cy_auto_dir_smooth_prev_fx; /* Target auto PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ Word32 *cy_cross_dir_smooth_prev_fx; /* Target cross PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ @@ -451,10 +466,15 @@ typedef struct dirac_output_synthesis_state_structure Word16 q_cy_cross_dir_smooth_prev; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ Word16 q_cy_auto_diff_smooth_prev; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + Word16 cy_auto_dir_smooth_prev_len; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ + Word16 cy_cross_dir_smooth_prev_len; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ + Word16 cy_auto_diff_smooth_prev_len; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ + const Word32 *onset_filter_fx; /* Temporal smoothing memories */ Word32 *reference_power_smooth_prev_fx; + Word16 reference_power_smooth_prev_q; Word32 *direction_smoothness_prev_fx; // Q31 #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index eb7a591bd..aba41dfe4 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -371,7 +371,14 @@ struct IVAS_REND static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG outConfig ); static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut ); - +#ifdef IVAS_FLOAT_FIXED //TOBE REMOVED +static void intermidiate_ext_dirac_render( + MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ + Word32 *output_f[], /* i/o: input/output signals in time domain */ + float *output_f_flt[], /* i/o: input/output signals in time domain */ + Word16 to_fix +); +#endif /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ @@ -11671,7 +11678,7 @@ static ivas_error renderInputMasa( int16_t maxBin; float *tmpBuffer[MAX_OUTPUT_CHANNELS]; float tmpBuffer_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#ifndef IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED Word32 *tmpBuffer_fx[MAX_OUTPUT_CHANNELS]; Word32 tmpBuffer_buff_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; #endif @@ -11707,10 +11714,12 @@ static ivas_error renderInputMasa( { /* MASA prerendering path for MASA -> MASA */ renderMasaToMasa( masaInput, outAudio ); +#ifdef IVAS_FLOAT_FIXED for ( Word16 i = 0; i < outAudio.config.numChannels * outAudio.config.numSamplesPerChannel; i++ ) { outAudio.data[i] = (float) outAudio.data_fx[i] / ( 1 << *outAudio.pq_fact ); } +#endif } else { @@ -11720,7 +11729,7 @@ static ivas_error renderInputMasa( { tmpBuffer[ch] = tmpBuffer_buff[ch]; } -#ifndef IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) { tmpBuffer_fx[ch] = tmpBuffer_buff_fx[ch]; @@ -11734,13 +11743,32 @@ static ivas_error renderInputMasa( switch ( masaInput->hMasaExtRend->renderer_type ) { case RENDERER_DIRAC: +#ifdef IVAS_FLOAT_FIXED copyMasaMetadataToDiracRenderer_fx( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); +#else + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); +#endif +#ifdef IVAS_FLOAT_FIXED +#if 1 //TOBE REMOVED + intermidiate_ext_dirac_render(masaInput->hMasaExtRend, tmpBuffer_fx, tmpBuffer, 1); +#endif + ivas_masa_ext_dirac_render_fx( masaInput->hMasaExtRend, tmpBuffer_fx, num_subframes ); + +#if 1 //TOBE REMOVED + intermidiate_ext_dirac_render(masaInput->hMasaExtRend, tmpBuffer_fx, tmpBuffer, 0); +#endif +#else ivas_masa_ext_dirac_render( masaInput->hMasaExtRend, tmpBuffer, num_subframes ); +#endif break; case RENDERER_STEREO_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC_ROOM: +#ifdef IVAS_FLOAT_FIXED copyMasaMetadataToDiracRenderer_fx( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); +#else + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); +#endif ivas_masa_ext_rend_parambin_render( masaInput->hMasaExtRend, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, num_subframes ); break; case RENDERER_DISABLE: @@ -12835,6 +12863,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } + hDirACRend->proto_frame_f_len = 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands; } @@ -12980,7 +13009,11 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } +#ifdef IVAS_FLOAT_FIXED + ivas_masa_init_stereotype_detection_fx( hDirACRend->masa_stereo_type_detect ); +#else ivas_masa_init_stereotype_detection( hDirACRend->masa_stereo_type_detect ); +#endif } else { @@ -13192,10 +13225,20 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { +#ifdef IVAS_FLOAT_FIXED + hDirACRend->proto_frame_f_fx = NULL; +#endif hDirACRend->proto_frame_f = NULL; } else { +#ifdef IVAS_FLOAT_FIXED + IF ( ( hDirACRend->proto_frame_f_fx = (Word32 *) malloc( sizeof( Word32 ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + hDirACRend->proto_frame_f_len = 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands; +#endif if ( ( hDirACRend->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirACRend->num_protos_diff * hSpatParamRendCom->num_freq_bands ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); @@ -13958,3 +14001,354 @@ static void freeMasaExtRenderer( return; } + +#ifdef IVAS_FLOAT_FIXED +static void intermidiate_ext_dirac_render( + MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ + Word32 *output_f[], /* i/o: input/output signals in time domain */ + float *output_f_flt[], /* i/o: input/output signals in time domain */ + Word16 to_fix +) +{ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; + DIRAC_DEC_STACK_MEM DirAC_mem; + int16_t i, ch, q_cldfb; + DIRAC_REND_HANDLE hDirACRend; + int16_t subframe_idx; + int16_t slot_idx; + int16_t nchan_transport; + int16_t masa_band_mapping[MASA_FREQUENCY_BANDS + 1]; + + hDirACRend = hMasaExtRend->hDirACRend; + hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; + nchan_transport = hMasaExtRend->nchan_input; + DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; + + h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); + + subframe_idx = hSpatParamRendCom->subframes_rendered; + + DirAC_mem = hDirACRend->stack_mem; + + if(to_fix) + { + DirAC_mem.reference_power_smooth_q = DirAC_mem.reference_power_q = Q31; + floatToFixed_arrL(hDirACRend->stack_mem.onset_filter, hDirACRend->stack_mem.onset_filter_fx, Q30, hDirACRend->stack_mem.onset_filter_len ); + q_cldfb = 11; + for(i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + floatToFixed_arrL(output_f_flt[i], output_f[i], q_cldfb, L_FRAME48k); + } + + for(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++){ + for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[slot_idx]][i] = floatToFixed( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[slot_idx]][i], Q30 ); + floatToFixed_arr(hSpatParamRendCom->surroundingCoherence[slot_idx], hSpatParamRendCom->surroundingCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + } + } + for(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++){ + IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) + { + IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) + { + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + else + { + if(hDirACRend->panningConf == DIRAC_PANNING_HOA3) + { + if (masa_band_mapping == NULL && hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD) + { + hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + else if (((hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD) && (masa_band_mapping != NULL)) || + hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_MONO) + { + hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + ELSE IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) /*VBAP*/ + { + hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + + } + else if (hDirACRend->panningConf == DIRAC_PANNING_VBAP) /*VBAP*/ + { + hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); + } + } + } + if(h_dirac_output_synthesis_state->diffuse_responses_square_fx){ + h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; + floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, hDirACRend->num_outputs_dir ); + } + + if(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth){ + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = L_get_q_buf1(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); + } + + if(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev){ + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = L_get_q_buf1(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len);; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth){ + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len ); + } + Word16 num_channels_dir = hDirACRend->num_outputs_dir; + + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) + { + num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE; + } + if(h_dirac_output_synthesis_state->cy_auto_diff_smooth){ + h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len ); + } + + if(hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev){ + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = L_get_q_buf1(hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_len);; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_len ); + } + + hDirACRend->h_output_synthesis_psd_params.diffuse_compensation_factor_fx = floatToFixed( hDirACRend->h_output_synthesis_psd_params.diffuse_compensation_factor, Q27 ); // Q27 + + hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = Q26; + hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_len ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_len ); + if(hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev){ + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len ); + } + + IF( hDirACRend->masa_stereo_type_detect ) + { + IF( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db == -INFINITY ) + { + hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = MIN_32; + } + ELSE + { + hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db, Q21 ); + } + } + + floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); + if ( hDirACRend->proto_signal_decorr_on == 1 ) + { + Word16 tmp_e; + f2me_buf(hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer, hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_fx, &tmp_e, hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_len ); + hDirACRend->h_freq_domain_decorr_ap_state->q_decorr_buffer = 31 - tmp_e; + } + + f2me_buf(hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len); + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = 31 - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q; + + if( hDirACRend->masa_stereo_type_detect != NULL ) + { + hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->target_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->target_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); + + hDirACRend->masa_stereo_type_detect->q_subtract_power_y = L_get_q(hDirACRend->masa_stereo_type_detect->subtract_power_y); + + hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth = L_get_q(hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth); + + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + //floatToFixed_arrL32( hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f_len ); + + FOR ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + /* CLDFB Analysis*/ + FOR ( ch = 0; ch < nchan_transport; ch++ ) + { + q_cldfb = 11; + hMasaExtRend->cldfbAnaRend[ch]->Q_cldfb_state = q_cldfb; + + /*for (i = 0; i < CLDFB_NO_CHANNELS_MAX; i++) { + output_f_fx[ch][hSpatParamRendCom->num_freq_bands * index_slot + i] = (Word32)(output_f[ch][hSpatParamRendCom->num_freq_bands * index_slot + i] * (1 << q_cldfb)); + }*/ + for (i = 0; i < hMasaExtRend->cldfbAnaRend[ch]->p_filter_length - hMasaExtRend->cldfbAnaRend[ch]->no_channels; i++) { + hMasaExtRend->cldfbAnaRend[ch]->cldfb_state_fx[i] = (Word32)(hMasaExtRend->cldfbAnaRend[ch]->cldfb_state[i] * (1 << (hMasaExtRend->cldfbAnaRend[ch]->Q_cldfb_state))); + } + } + } + floatToFixed_arrL32( hDirACRend->hoa_encoder, hDirACRend->hoa_encoder_fx, Q29, hDirACRend->hoa_encoder_len ); + if(DirAC_mem.frame_dec_f) + { + //f2me_buf(DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_fx, &hDirACRend->proto_frame_dec_f_q, DirAC_mem.frame_dec_f_len); + } + hDirACRend->proto_frame_dec_f_q = 31 - hDirACRend->proto_frame_dec_f_q; + if(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth){ + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); + } + + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); + + if( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + { + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); + } + + for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; ch++ ) + { + q_cldfb = 11; + hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state = q_cldfb; + for (i = 0; i < hMasaExtRend->cldfbSynRend[ch]->p_filter_length; i++) { + hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx[i] = (Word32)(hMasaExtRend->cldfbSynRend[ch]->cldfb_state[i] * (1 << (hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state - 1))); + } + } + } + else + { + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q); + } + IF(EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + ELSE + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + + fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + fixedToFloat_arrL(hDirACRend->stack_mem.onset_filter_fx, hDirACRend->stack_mem.onset_filter, Q30, hDirACRend->stack_mem.onset_filter_len ); + if(DirAC_mem.reference_power) + { + fixedToFloat_arrL(DirAC_mem.reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, DirAC_mem.reference_power_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len); + } + if(hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.gains_dir_prev){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.gains_diff_prev){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_len ); + } + if(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); + } + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len); + if ( hDirACRend->proto_signal_decorr_on == 1 ) + { + fixedToFloat_arrL32(hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_fx, hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer, hDirACRend->h_freq_domain_decorr_ap_state->q_decorr_buffer, hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_len); + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL(hDirACRend->h_freq_domain_decorr_ap_state->direct_energy_smooth_fx, hDirACRend->h_freq_domain_decorr_ap_state->direct_energy_smooth, hDirACRend->h_freq_domain_decorr_ap_state->q_direct_energy_smooth, hDirACRend->num_protos_diff * hDirACRend->h_freq_domain_decorr_ap_params->max_band_decorr); + fixedToFloat_arrL(hDirACRend->h_freq_domain_decorr_ap_state->reverb_energy_smooth_fx, hDirACRend->h_freq_domain_decorr_ap_state->reverb_energy_smooth, hDirACRend->h_freq_domain_decorr_ap_state->q_reverb_energy_smooth, hDirACRend->num_protos_diff * hDirACRend->h_freq_domain_decorr_ap_params->max_band_decorr); + } + } + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len); + IF( hDirACRend->masa_stereo_type_detect != NULL ) + { + hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx, Q21 ); + + hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f_len ); + //fixedToFloat_arrL32(DirAC_mem.frame_dec_f_fx, DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_q, DirAC_mem.frame_dec_f_len); + + FOR ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[hSpatParamRendCom->subframes_rendered]; slot_idx++ ) + { + //q_cldfb = 11; + //hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state = q_cldfb; + /* CLDFB Analysis*/ + FOR ( ch = 0; ch < nchan_transport; ch++ ) + { + for (i = 0; i < hMasaExtRend->cldfbAnaRend[ch]->p_filter_length - hMasaExtRend->cldfbAnaRend[ch]->no_channels; i++) { + hMasaExtRend->cldfbAnaRend[ch]->cldfb_state[i] = (float)(hMasaExtRend->cldfbAnaRend[ch]->cldfb_state_fx[i] / (1 << (hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state))); + } + } + } + if(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); + } + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); + } + + for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; ch++ ) + { + for (i = 0; i < hMasaExtRend->cldfbSynRend[ch]->p_filter_length; i++) + { + hMasaExtRend->cldfbSynRend[ch]->cldfb_state[i] = ((float)hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx[i] / (1 << ((hMasaExtRend->cldfbSynRend[0]->Q_cldfb_state)))); + } + } + if(hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx){ + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, hSpatParamRendCom->num_freq_bands ); + } + for(i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + fixedToFloat_arrL(output_f[i], output_f_flt[i], hMasaExtRend->cldfbSynRend[0]->Q_cldfb_state, L_FRAME48k); + } + } + +} +#endif \ No newline at end of file -- GitLab From 30de5886ed078d4b0f1c30d7544179b1e0e8f57c Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sun, 19 May 2024 20:29:22 +0530 Subject: [PATCH 059/101] MSAN fixes for stereo, isma, omasa, osba, float cleanup [x] MSAN fix for stereo format errors [x] MSAN fixes for ISM format errors [x] MSAN fixes for OSBA and OMASA errors [x] Float code cleanup in lib_rend [x] MSAN fix for test_sba_enc_system cases --- lib_com/fd_cng_com.c | 10 - lib_com/float_to_fix_ops.c | 4 +- lib_com/ivas_prot_fx.h | 3 + lib_com/ivas_spar_com.c | 6 +- lib_com/ivas_spar_com_quant_util.c | 170 ++++++++------ lib_com/swb_tbe_com_fx.c | 2 +- lib_dec/core_switching_dec_fx.c | 6 +- lib_dec/dec_gen_voic_fx.c | 2 +- lib_dec/ivas_binRenderer_internal.c | 70 +++--- lib_dec/ivas_dirac_dec.c | 80 +++---- lib_dec/ivas_jbm_dec.c | 1 + lib_dec/ivas_omasa_dec.c | 20 ++ lib_dec/ivas_spar_decoder.c | 73 ++++-- lib_dec/swb_bwe_dec_fx.c | 14 +- lib_rend/ivas_crend.c | 116 +++++----- lib_rend/ivas_dirac_dec_binaural_functions.c | 13 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 105 +++------ lib_rend/ivas_dirac_rend.c | 59 ++--- lib_rend/ivas_efap.c | 192 ++++++++-------- lib_rend/ivas_orient_trk.c | 44 ++-- lib_rend/ivas_prot_rend.h | 3 +- lib_rend/ivas_reverb.c | 220 +++++++++++++------ lib_rend/ivas_rotation.c | 123 ++++++----- 23 files changed, 729 insertions(+), 607 deletions(-) diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index 7f8411445..eba4a7980 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -51,9 +51,7 @@ * Local function prototypes *-------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED static void mhvals_flt( const int16_t d, float *m ); -#endif static void getmidbands( int16_t *part, const int16_t npart, int16_t *midband, float *psize_flt, float *psize_inv_flt ); @@ -93,7 +91,6 @@ void initFdCngCom_flt( const float scale ) { -#ifndef IVAS_FLOAT_FIXED /* Calculate FFT scaling factor */ hFdCngCom->scalingFactor_flt = 1 / ( scale * scale * 8.f ); @@ -104,7 +101,6 @@ void initFdCngCom_flt( /* Initialize the comfort noise generation */ set_f( hFdCngCom->fftBuffer_flt, 0.0f, FFTLEN ); -#endif UNUSED_PARAM(scale); set_f( hFdCngCom->cngNoiseLevel_flt, 0.0f, FFTCLDFBLEN ); set_f( hFdCngCom->olapBufferSynth2_flt, 0.0f, FFTLEN ); @@ -137,7 +133,6 @@ void initFdCngCom_flt( hFdCngCom->seed2 = 1; hFdCngCom->seed3 = 2; hFdCngCom->CngBitrate = -1; -#ifndef IVAS_FLOAT_FIXED /* Initialize noise estimation algorithm */ set_f( hFdCngCom->periodog_flt, 0.0f, PERIODOGLEN ); mhvals_flt( MSNUMSUBFR * MSSUBFRLEN, &( hFdCngCom->msM_win_flt ) ); @@ -147,17 +142,14 @@ void initFdCngCom_flt( set_f( hFdCngCom->msSlope_flt, 0.0f, 2 ); set_f( hFdCngCom->msQeqInvAv_flt, 0.0f, 2 ); hFdCngCom->init_old_flt = 0; -#endif hFdCngCom->msFrCnt_init_counter = 0; hFdCngCom->msFrCnt_init_thresh = 1; hFdCngCom->offsetflag = 0; hFdCngCom->msFrCnt = MSSUBFRLEN; hFdCngCom->msMinBufferPtr = 0; -#ifndef IVAS_FLOAT_FIXED set_f( hFdCngCom->msAlphaCor_flt, 0.3f, 2 ); hFdCngCom->coherence_flt = 0.5f; -#endif return; } @@ -1217,7 +1209,6 @@ void SynthesisSTFT_dirac_fx( * Compute some values used in the bias correction of the minimum statistics algorithm *-------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED static void mhvals_flt( const int16_t d, float *m ) @@ -1257,7 +1248,6 @@ static void mhvals_flt( return; } -#endif /*------------------------------------------------------------------- * rand_gauss_flt() diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 9da36155b..57c6ded70 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -12,11 +12,11 @@ Word32 floatToFixed(float f, Word16 Q) if (f == 1.0f && Q == Q31) return MAXVAL_WORD32; if (Q < 0) - return (Word32)((float)(f) / (float)(((unsigned)1) << (-Q)) + (f >= 0 ? 0.5 : -0.5)); + return (Word32)((float)(f) / (double)(1llu << (-Q)) + (f >= 0 ? 0.5 : -0.5)); else { Word64 result_32; - result_32=(Word64)(f * (float)((unsigned int)1 << Q) + (f >= 0 ? 0.5 : -0.5)); + result_32=(Word64)(f * (double)(1llu << Q) + (f >= 0 ? 0.5 : -0.5)); if (result_32 > MAX_32) return MAX_32; if (result_32 < MIN_32) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 814fde0dd..c1c36e15b 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2107,6 +2107,9 @@ void td_bwe_dec_init_ivas_fx( void ivas_dirac_dec_render_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#ifdef MSAN_FIX + Word32 *output_fx[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif // MSAN_FIX const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 2f867f212..624d8e345 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -6644,8 +6644,10 @@ void ivas_spar_set_bitrate_config_fx( pSpar_md_cfg->active_w = ivas_spar_br_table_consts[table_idx].active_w; pSpar_md_cfg->agc_bits_ch_idx = ivas_spar_br_table_consts[table_idx].agc_bits_ch_idx; -#if 1 //Some issues - ivas_spar_get_uniform_quant_strat(pSpar_md_cfg, table_idx); +#ifdef IVAS_FLOAT_FIXED + ivas_spar_get_uniform_quant_strat_fx( pSpar_md_cfg, table_idx ); +#else + ivas_spar_get_uniform_quant_strat( pSpar_md_cfg, table_idx ); #endif pSpar_md_cfg->quant_strat_bits = ivas_get_bits_to_encode(MAX_QUANT_STRATS); diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index 763eb9d84..79e55940a 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -135,7 +135,6 @@ void ivas_quantise_real_values_fx( } -#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_spar_get_uniform_quant_strat() * @@ -214,73 +213,120 @@ void ivas_spar_get_uniform_quant_strat( return; } -#else -void ivas_spar_get_uniform_quant_strat( - ivas_spar_md_com_cfg *pSpar_md_com_cfg, - const Word16 table_idx) + + +#ifdef IVAS_FLOAT_FIXED +/*-----------------------------------------------------------------------------------------* + * Function ivas_spar_get_uniform_quant_strat_fx() + * + * Sets the quant strat values + *-----------------------------------------------------------------------------------------*/ +void ivas_spar_get_uniform_quant_strat_fx( + ivas_spar_md_com_cfg *pSpar_md_com_cfg, + const Word16 table_idx ) { - Word16 i; - Word16 active_w = ivas_spar_br_table_consts[table_idx].active_w; - Word16 PQ_q_lvl, C_q_lvl, Pr_q_lvl, Pc_q_lvl; + Word16 i; + Word16 active_w = ivas_spar_br_table_consts[table_idx].active_w; + move16(); + Word16 PQ_q_lvl, C_q_lvl, Pr_q_lvl, Pc_q_lvl; - pSpar_md_com_cfg->num_quant_strats = MAX_QUANT_STRATS; + pSpar_md_com_cfg->num_quant_strats = MAX_QUANT_STRATS; + move16(); - for ( i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++ ) - { - PQ_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; - C_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; - Pr_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; - Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3]; - - if ( active_w ) - { - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -322122547;//1.2*Q28 - pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 322122547;//1.2*Q28 - - pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.min_fx = -214748364; - pSpar_md_com_cfg->quant_strat[i].C.max_fx = 214748364;//.8*Q28 - - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; - pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 214748364;//.8*Q28 - - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -214748364;//.8*Q28 - pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 214748364; //.8*Q28 - } - else - { - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; - pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28; - pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -ONE_IN_Q28; - - pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; - pSpar_md_com_cfg->quant_strat[i].C.max_fx = 2 *ONE_IN_Q28; - pSpar_md_com_cfg->quant_strat[i].C.min_fx = -2*ONE_IN_Q28; - - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q28; - pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; - - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; - pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; //.5* Q28 - pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -ONE_IN_Q27;//.5* Q28 - } - } + FOR( i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++ ) + { + PQ_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; + move16(); + C_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; + move16(); + Pr_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; + move16(); + Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3]; + move16(); - return; + if ( active_w ) + { + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].PR.min_fx = L_negate( 322122547 ); // -1.2*Q28 + move32(); + pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 322122547; // 1.2*Q28 + move32(); + + pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].C.min_fx = L_negate( 214748364 ); //-.8*Q28 + move32(); + pSpar_md_com_cfg->quant_strat[i].C.max_fx = 214748364; //.8*Q28 + move32(); + + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; + move32(); + pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 214748364; //.8*Q28 + move32(); + + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = L_negate( 214748364 ); //-.8*Q28 + move32(); + pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 214748364; //.8*Q28 + move32(); + } + else + { + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28; // Q28 + move32(); + pSpar_md_com_cfg->quant_strat[i].PR.min_fx = L_negate( ONE_IN_Q28 ); // Q28 + move32(); + + pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].C.max_fx = ONE_IN_Q29; // Q28 + move32(); + pSpar_md_com_cfg->quant_strat[i].C.min_fx = L_negate( ONE_IN_Q29 ); // Q28 + move32(); + + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q28; // Q28 + move32(); + pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; // Q28 + move32(); + + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl; + move16(); + pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; // Q28 + move32(); + pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = L_negate( ONE_IN_Q27 ); // Q28 + move32(); + } + } + + return; } #endif + + /*-----------------------------------------------------------------------------------------* * Function ivas_map_prior_coeffs_quant() * diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 300433048..97a0ff3d2 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -761,7 +761,7 @@ static void filt_mu_fx( tmp = sub(32767 , tmp); exp = norm_s(tmp); tmp = div_s(shl(1,sub(14,exp)),tmp);/*(14 - exp) */ - ga = shl(tmp ,exp);/*Q14 */ + ga = shl_sat(tmp ,exp);/*Q14 */ /* ga = (float) 1. / ((float) 1. - (float) fabs (mu)); */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 252bec195..2cf9bcc3a 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1863,7 +1863,7 @@ ivas_error core_switching_post_dec_ivas_fx( nzeroes = i_mult2( delta, N_ZERO_8 ); shift = i_mult2( Fs_kHz, 3 ); test(); - IF( st_fx->prev_bfi && hHQ_core->HqVoicing && st_fx->hHQ_core != NULL && st_fx->last_core == HQ_CORE ) + IF( st_fx->prev_bfi && st_fx->hHQ_core != NULL && hHQ_core->HqVoicing && st_fx->last_core == HQ_CORE ) { Copy_Scale_sig( hHQ_core->fer_samples_fx, &hHQ_core->old_out_fx[nzeroes], shift, *Qsynth ); } @@ -1945,8 +1945,8 @@ ivas_error core_switching_post_dec_ivas_fx( move16(); } - IF( ( NE_16( st_fx->last_extl, SWB_BWE ) && EQ_16( st_fx->extl, SWB_BWE ) ) || ( NE_16( st_fx->last_extl, FB_BWE ) && EQ_16( st_fx->extl, FB_BWE ) ) || - ( ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_extl, SWB_TBE ) ) && st_fx->extl < 0 && NE_16( st_fx->core, HQ_CORE ) ) || ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) && ( ( NE_16( st_fx->prev_coder_type, INACTIVE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) || ( NE_16( st_fx->prev_coder_type, AUDIO ) && EQ_16( st_fx->coder_type, AUDIO ) ) ) && st_fx->bws_cnt > 0 ) ) + IF( ( st_fx->hBWE_FD != NULL ) && ( ( NE_16( st_fx->last_extl, SWB_BWE ) && EQ_16( st_fx->extl, SWB_BWE ) ) || ( NE_16( st_fx->last_extl, FB_BWE ) && EQ_16( st_fx->extl, FB_BWE ) ) || + ( ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_extl, SWB_TBE ) ) && st_fx->extl < 0 && NE_16( st_fx->core, HQ_CORE ) ) || ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) && ( ( NE_16( st_fx->prev_coder_type, INACTIVE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) || ( NE_16( st_fx->prev_coder_type, AUDIO ) && EQ_16( st_fx->coder_type, AUDIO ) ) ) && st_fx->bws_cnt > 0 ) ) ) { set16_fx( hBWE_FD->L_old_wtda_swb_fx, 0, output_frame ); hBWE_FD->old_wtda_swb_fx_exp = 0; diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c index 7b43ca054..8e016830a 100644 --- a/lib_dec/dec_gen_voic_fx.c +++ b/lib_dec/dec_gen_voic_fx.c @@ -248,7 +248,7 @@ ivas_error decod_gen_voic_fx( Word32 Ltmp1; /* Contribution from AVQ layer */ Ltmp1 = L_mult(gain_preQ_fx, code_preQ_fx[i]); /* Q2 + Q6 -> Q9*/ - Ltmp1 = L_shl(Ltmp1,tmp1_fx); /* Q16 + Q_exc */ + Ltmp1 = L_shl_sat(Ltmp1,tmp1_fx); /* Q16 + Q_exc */ /* Compute exc2 */ #ifdef BASOP_NOGLOB diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index d3b86d78b..e7fd85edf 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -257,52 +257,52 @@ static ivas_error ivas_binRenderer_convModuleOpen( ELSE { /* Note: needs to be revisited if multiple LFE support is required */ - hBinRenderer->nInChannels = ( audioCfg2channels( input_config ) - isLoudspeaker ); + hBinRenderer->nInChannels = sub( audioCfg2channels( input_config ), isLoudspeaker ); } - IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + IF(EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM )) { - hBinRenConvModule->numTaps = BINAURAL_NTAPS_MAX; + hBinRenConvModule->numTaps = BINAURAL_NTAPS_MAX; move16(); /* Use variable order filtering */ - bandIdx = 0; + bandIdx = 0; move16(); FOR( ; bandIdx < 5; bandIdx++ ) { - hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps; + hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps; move16(); } FOR( ; bandIdx < 10; bandIdx++ ) { - hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_6; + hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_6; move16(); } FOR( ; bandIdx < 20; bandIdx++ ) { - hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_5; + hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_5; move16(); } FOR( ; bandIdx < 30; bandIdx++ ) { - hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_4; + hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_4; move16(); } FOR( ; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { - hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_3; + hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_3; move16(); } } ELSE { - IF( hBinRenderer->ivas_format == SBA_FORMAT ) + IF( EQ_16(hBinRenderer->ivas_format, SBA_FORMAT )) { - hBinRenConvModule->numTaps = BINAURAL_NTAPS_SBA; + hBinRenConvModule->numTaps = BINAURAL_NTAPS_SBA; move16(); } ELSE { - hBinRenConvModule->numTaps = BINAURAL_NTAPS; + hBinRenConvModule->numTaps = BINAURAL_NTAPS; move16(); } /* Use fixed order filtering */ - bandIdx = 0; + bandIdx = 0; move16(); FOR( ; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { - hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps; + hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps; move16(); } } @@ -406,38 +406,38 @@ static ivas_error ivas_binRenderer_convModuleOpen( { FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { - Word16 tmp = 0; + Word16 tmp = 0; move16(); IF( isLoudspeaker ) { - IF( input_config == IVAS_AUDIO_CONFIG_5_1 ) + IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_5_1 )) { - tmp = channelIndex_CICP6[chIdx]; + tmp = channelIndex_CICP6[chIdx]; move16(); } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_7_1 ) + ELSE IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_7_1 )) { - tmp = channelIndex_CICP12[chIdx]; + tmp = channelIndex_CICP12[chIdx]; move16(); } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_5_1_2 ) + ELSE IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_5_1_2 )) { - tmp = channelIndex_CICP14[chIdx]; + tmp = channelIndex_CICP14[chIdx]; move16(); } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_5_1_4 ) + ELSE IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_5_1_4 )) { - tmp = channelIndex_CICP16[chIdx]; + tmp = channelIndex_CICP16[chIdx]; move16(); } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_7_1_4 ) + ELSE IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_7_1_4 )) { - tmp = channelIndex_CICP19[chIdx]; + tmp = channelIndex_CICP19[chIdx]; move16(); } } - IF( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + IF( EQ_16(renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM )) { /* set the memories to zero */ - set_l( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); - set_l( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); - set_s( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTapsArray[bandIdx] ); + set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); + set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] ); + set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTapsArray[bandIdx] ); IF( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftBRIRReal_fx[bandIdx][tmp]; @@ -449,9 +449,9 @@ static ivas_error ivas_binRenderer_convModuleOpen( ELSE { /* set the memories to zero */ - set_l( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); - set_l( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); - set_s( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTaps ); + set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); + set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx], 0, hBinRenConvModule->numTaps ); + set16_fx( hBinRenConvModule->Q_filterStatesLeft[bandIdx][chIdx], 31, hBinRenConvModule->numTaps ); IF( isLoudspeaker ) { hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_fx[bandIdx][tmp]; @@ -461,7 +461,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( } ELSE { - IF( input_config == IVAS_AUDIO_CONFIG_HOA3 ) + IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_HOA3 )) { /* HOA3 filter coefficients */ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA3_fx[bandIdx][chIdx]; @@ -469,7 +469,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA3_fx[bandIdx][chIdx]; hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA3_fx[bandIdx][chIdx]; } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_HOA2 ) + ELSE IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_HOA2 )) { /* HOA2 filter coefficients */ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA2_fx[bandIdx][chIdx]; @@ -477,7 +477,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA2_fx[bandIdx][chIdx]; hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA2_fx[bandIdx][chIdx]; } - ELSE IF( input_config == IVAS_AUDIO_CONFIG_FOA ) + ELSE IF( EQ_16(input_config, IVAS_AUDIO_CONFIG_FOA )) { /* FOA filter coefficients */ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_FOA_fx[bandIdx][chIdx]; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ff1a6655f..80f3e11ed 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1625,14 +1625,14 @@ ivas_error ivas_dirac_dec_config_fx( /* Solve and setup flags for inits */ dec_config_flag = ( EQ_16( flag_config_inp, DIRAC_RECONFIGURE_MODE ) ) ? DIRAC_RECONFIGURE : flag_config_inp; - output_Fs = st_ivas->hDecoderConfig->output_Fs; + output_Fs = st_ivas->hDecoderConfig->output_Fs; move32(); hodirac_flag = ivas_get_hodirac_flag_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); dec_param_estim_old = ( dec_config_flag == DIRAC_RECONFIGURE ) ? st_ivas->hDirAC->hConfig->dec_param_estim : FALSE; - sparfoa_flag = 0; + sparfoa_flag = 0; move16(); IF( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) { - sparfoa_flag = 1; + sparfoa_flag = 1; move16(); } IF( ( error = ivas_dirac_dec_config_internal_fx( st_ivas, dec_config_flag ) ) != IVAS_ERR_OK ) @@ -1641,25 +1641,26 @@ ivas_error ivas_dirac_dec_config_fx( } /* This is required for parambin */ - IF( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + test(); test(); + IF( EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC )) { - st_ivas->hDirAC->hConfig->dec_param_estim = FALSE; + st_ivas->hDirAC->hConfig->dec_param_estim = FALSE; move16(); } - dec_param_estim_new = st_ivas->hDirAC->hConfig->dec_param_estim; + dec_param_estim_new = st_ivas->hDirAC->hConfig->dec_param_estim; move16(); /* Setup renderers and meta */ /* First, free everything if in reconfig and not the active renderer */ - need_parambin = 0; + need_parambin = 0; move16(); SWITCH( st_ivas->renderer_type ) { case RENDERER_BINAURAL_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC_ROOM: case RENDERER_STEREO_PARAMETRIC: - need_parambin = 1; + need_parambin = 1; move16(); BREAK; default: - need_parambin = 0; + need_parambin = 0; move16(); } IF( !need_parambin ) @@ -1667,7 +1668,7 @@ ivas_error ivas_dirac_dec_config_fx( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } - need_dirac_rend = 0; + need_dirac_rend = 0; move16(); SWITCH( st_ivas->renderer_type ) { case RENDERER_DIRAC: @@ -1677,56 +1678,37 @@ ivas_error ivas_dirac_dec_config_fx( case RENDERER_SBA_LINEAR_DEC: case RENDERER_OSBA_AMBI: case RENDERER_OSBA_LS: - need_dirac_rend = 1; + need_dirac_rend = 1; move16(); BREAK; default: - need_dirac_rend = 0; + need_dirac_rend = 0; move16(); } IF( !need_dirac_rend ) { -#ifdef IVAS_FLOAT_FIXED ivas_dirac_rend_close_fx( &st_ivas->hDirACRend ); -#else - ivas_dirac_rend_close( &st_ivas->hDirACRend ); -#endif } IF( !sparfoa_flag ) { common_rend_config_flag = st_ivas->hSpatParamRendCom == NULL ? DIRAC_OPEN : flag_config_inp; -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, common_rend_config_flag, dec_param_estim_new, st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, hodirac_flag, 0 ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_spat_hSpatParamRendCom_config( &st_ivas->hSpatParamRendCom, common_rend_config_flag, dec_param_estim_new, - st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, hodirac_flag, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif IF( need_dirac_rend ) { rend_config_flag = st_ivas->hDirACRend == NULL ? DIRAC_OPEN : flag_config_inp; -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_dirac_rend_config_fx( st_ivas, rend_config_flag, dec_param_estim_old ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_dirac_rend_config( st_ivas, rend_config_flag, dec_param_estim_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } IF( need_parambin ) { - IF( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) + IF( NE_16(st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC )) { /*WIP*/ IF( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -1760,40 +1742,17 @@ ivas_error ivas_dirac_dec_config_fx( { IF( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) { - //float frequency_axis[CLDFB_NO_CHANNELS_MAX]; -#ifdef IVAS_FLOAT_FIXED Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); - /*FOR( int i = 0; i < st_ivas->hSpatParamRendCom->num_freq_bands; i++ ) - { - frequency_axis[i] = (float) frequency_axis_fx[i]; - }*/ - IF( ( error = ivas_dirac_dec_decorr_open_fx( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, DIRAC_SYNTHESIS_PSD_LS, frequency_axis_fx, BINAURAL_CHANNELS, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#else - - ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); - - IF((error = ivas_dirac_dec_decorr_open(&(st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params), &(st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, frequency_axis, BINAURAL_CHANNELS, st_ivas->hDecoderConfig->output_Fs)) != IVAS_ERR_OK) - { - return error; - } -#endif - } } - -#ifdef IVAS_FLOAT_FIXED st_ivas->hDiracDecBin->reqularizationFactor_fx = configure_reqularization_factor_fx( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); -#else - st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); -#endif } } } @@ -3442,7 +3401,11 @@ void ivas_dirac_dec_render_fx( FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { +#ifdef MSAN_FIX + ivas_dirac_dec_render_sf_fx( st_ivas, output_f_local, output_f_local_fx, nchan_transport, NULL, NULL ); +#else ivas_dirac_dec_render_sf_fx( st_ivas, output_f_local, nchan_transport, NULL, NULL ); +#endif // MSAN_FIX n_samples_sf = i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->slot_size ); @@ -3577,6 +3540,9 @@ void ivas_dirac_dec_render( void ivas_dirac_dec_render_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#ifdef MSAN_FIX + Word32 *output_buf_fx[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif // MSAN_FIX const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) @@ -5143,7 +5109,9 @@ void ivas_dirac_dec_render_sf_fx( #ifdef IVAS_FLOAT_FIXED //////////////////////////////////////////////// FLOAT TO FIXED ///////////////////////////////////////////// +#ifndef MSAN_FIX Word32 output_buf_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#endif // MSAN_FIX if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { // Float to fixed @@ -5172,10 +5140,12 @@ void ivas_dirac_dec_render_sf_fx( outchannels = add(outchannels, 1); } +#ifndef MSAN_FIX for (i = 0; i < outchannels; i++) { floatToFixed_arrL(output_f[i], output_buf_fx[i], Q11, L_FRAME48k); } +#endif } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endif diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2a7614384..289027ca4 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -153,6 +153,7 @@ ivas_error ivas_jbm_dec_tc( { st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; #if 1 // TODO: To be removed later + set_zero(st_ivas->p_output_f[n], L_FRAME48k); st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; #ifndef MSAN_FIX floatToFixed_arrL( st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->tc_fx[n], Q11, L_FRAME48k ); diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 8e5411073..04d732ee9 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1417,10 +1417,17 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( ivas_error error; float *p_sepobj[MAX_NUM_OBJECTS]; float *tc_local[MAX_TRANSPORT_CHANNELS]; +#ifdef MSAN_FIX + Word32 *p_sepobj_fx[MAX_NUM_OBJECTS]; + Word32 data_separated_objects_fx[MAX_NUM_OBJECTS][L_FRAME48k]; +#endif // MSAN_FIX for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) { p_sepobj[n] = &data_separated_objects[n][0]; +#ifdef MSAN_FIX + p_sepobj_fx[n] = &data_separated_objects_fx[n][0]; +#endif // MSAN_FIX } /* Delay the object signals to match the CLDFB delay. Delay the whole buffer with the first rendering call of the stretched buffer. */ @@ -1454,6 +1461,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( #ifdef IVAS_FLOAT_FIXED #if 1 /* TODO: remove float to fix conversions */ Word16 q_factor = Q11; +#ifndef MSAN_FIX Word32 rend_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; Word32 *p_rend_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; for (int i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) @@ -1464,6 +1472,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( p_rend_output_fx[i][j] = floatToFixed(p_sepobj[i][j], Q11); } } +#endif Word16 n_tc; if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) n_tc = st_ivas->nchan_ism; @@ -1474,16 +1483,27 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); } #endif +#ifdef MSAN_FIX + IF( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_sepobj_fx, q_factor, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } +#else IF ( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_rend_output_fx, q_factor, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; } +#endif #if 1 /* TODO: remove fixed to float conversions */ for (int i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) { for (int j = 0; j < L_FRAME48k; j++) { +#ifdef MSAN_FIX + p_sepobj[i][j] = fixedToFloat(p_sepobj_fx[i][j], Q11); +#else p_sepobj[i][j] = fixedToFloat(p_rend_output_fx[i][j], Q11); +#endif } } #endif diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 494a6a035..7bbf1b85a 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -3205,17 +3205,34 @@ void ivas_spar_dec_upmixer_sf_fx( } #ifdef IVAS_FLOAT_FIXED /*Fixed to float */ - FOR ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - FOR ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - cldfb_in_ts_re[in_ch][ts][i] = (float) ( cldfb_in_ts_re_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ - cldfb_in_ts_im[in_ch][ts][i] = (float) ( cldfb_in_ts_im_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ - } - } - } + IF(NE_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA)) + { + FOR(in_ch = 0; in_ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; in_ch++) + { + FOR(ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++) + { + FOR(i = 0; i < CLDFB_NO_CHANNELS_MAX; i++) + { + cldfb_in_ts_re[in_ch][ts][i] = (float)(cldfb_in_ts_re_fx[in_ch][ts][i]) / (float)(1LL << 6); /*Resultant q is 6*/ + cldfb_in_ts_im[in_ch][ts][i] = (float)(cldfb_in_ts_im_fx[in_ch][ts][i]) / (float)(1LL << 6); /*Resultant q is 6*/ + } + } + } + } + ELSE + { + FOR ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + FOR ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + { + FOR ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) + { + cldfb_in_ts_re[in_ch][ts][i] = (float) ( cldfb_in_ts_re_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ + cldfb_in_ts_im[in_ch][ts][i] = (float) ( cldfb_in_ts_im_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ + } + } + } + } #endif IF ( NE_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_FOA) && NE_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) && NE_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) ) { @@ -3224,7 +3241,11 @@ void ivas_spar_dec_upmixer_sf_fx( fixedToFloat_arrL( output_fx[ch], output[ch], Q11, out_len ); p_output[ch] = output[ch]; } +#ifdef MSAN_FIX + ivas_dirac_dec_render_sf_fx( st_ivas, p_output, output_fx, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); +#else ivas_dirac_dec_render_sf_fx( st_ivas, p_output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); +#endif // MSAN_FIX FOR( Word16 ch = 0; ch < add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ); ch++ ) { floatToFixed_arrL( output[ch], output_fx[ch], Q11, out_len ); @@ -3242,14 +3263,28 @@ void ivas_spar_dec_upmixer_sf_fx( } } #ifdef MSAN_FIX - FOR( out_ch = 0; out_ch < st_ivas->hOutSetup.nchan_out_woLFE; out_ch++ ) - { - FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - floatToFixed_arrL( cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, num_cldfb_bands ); - floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, num_cldfb_bands ); - } - } + IF(NE_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA)) + { + FOR(out_ch = 0; out_ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; out_ch++) + { + FOR(ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++) + { + floatToFixed_arrL(cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, num_cldfb_bands); + floatToFixed_arrL(cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, num_cldfb_bands); + } + } + } + ELSE + { + FOR( out_ch = 0; out_ch < st_ivas->hOutSetup.nchan_out_woLFE; out_ch++ ) + { + FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + { + floatToFixed_arrL( cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, num_cldfb_bands ); + floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, num_cldfb_bands ); + } + } + } #else FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { diff --git a/lib_dec/swb_bwe_dec_fx.c b/lib_dec/swb_bwe_dec_fx.c index 5773b3010..306643818 100644 --- a/lib_dec/swb_bwe_dec_fx.c +++ b/lib_dec/swb_bwe_dec_fx.c @@ -399,7 +399,11 @@ Word16 ivas_wb_bwe_dec_fx( output_frame ); *Qpost = sub( new_input_fx_exp, 15 ); /* DCT of the ACELP core synthesis */ +#ifdef MSAN_FIX + direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode ); +#else direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode ); +#endif } /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */ scl = sub( 16 + MAX_Q_NEW_INPUT, new_input_fx_exp ); @@ -408,11 +412,19 @@ Word16 ivas_wb_bwe_dec_fx( { /* Yes */ /* Calc Room to Upscale */ +#ifdef MSAN_FIX + Q_syn = Find_Max_Norm32( ysynth_32, L_FRAME16k ); +#else Q_syn = Find_Max_Norm32( ysynth_32, output_frame ); +#endif /* Stay within MAX_Q_NEW_INPUT */ scl = s_min( Q_syn, scl ); } +#ifdef MSAN_FIX + Copy_Scale_sig32_16( ysynth_32, ysynth_fx, L_FRAME16k, scl ); +#else Copy_Scale_sig32_16( ysynth_32, ysynth_fx, output_frame, scl ); +#endif Q_syn = add( sub( new_input_fx_exp, 16 ), scl ); IF( !st_fx->bfi ) { @@ -705,7 +717,7 @@ Word16 swb_bwe_gain_deq_fx( /* o : BWE class */ FOR( n_band = 0; n_band < SWB_TENV; n_band++ ) { index = (Word16)get_next_indice(st_fx, 4 ); - SWB_tenv[n_band] = shl(1, index); + SWB_tenv[n_band] = shl_sat(1, index); move16(); } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index e2596eacb..ad97eeeae 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -3088,7 +3088,7 @@ static ivas_error ivas_rend_crendConvolver( Word16 subframe_length, idx_in; Word16 lfe_idx_in; Word16 offset, offset_in, offset_diffuse; - Word16 nchan_in, nchan_out; + Word16 nchan_in, nchan_out, scale; const Word32 *pIn; Word32 *pFreq_buf_re, *pFreq_buf_im; const Word32 *pFreq_filt_re, *pFreq_filt_im; @@ -3101,54 +3101,58 @@ static ivas_error ivas_rend_crendConvolver( hCrend = pCrend->hCrend; - if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ), IVAS_ERR_OK ) ) { return error; } - if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; } - subframe_length = (Word16) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; + subframe_length = (Word16) BASOP_Util_Divide3232_Scale( output_Fs, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &scale ); + subframe_length = shr(subframe_length, 15 - scale); lfe_idx_in = -1; - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + move16(); + IF ( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { - if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF ( NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { lfe_idx_in = LFE_CHANNEL; + move16(); } - else + ELSE { assert( 0 && "Custom LS not supported in CRend" ); } } - offset = hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ + offset = imult1616( hCrend->delay_line_rw_index, subframe_length ); /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ offset_diffuse = hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ - if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) + IF ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { set_val_Word32( &hCrend->freq_buffer_re_diffuse_fx[offset_diffuse], 0, subframe_length ); set_val_Word32( &hCrend->freq_buffer_im_diffuse_fx[offset_diffuse], 0, subframe_length ); } i = 0; - for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) + move16(); + FOR ( idx_in = 0; idx_in < nchan_in; idx_in++ ) { pIn = &pcm_in[idx_in][i_ts * subframe_length]; - if ( idx_in != lfe_idx_in ) + IF ( idx_in != lfe_idx_in ) { - if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) + IF ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { pFreq_buf_re = &hCrend->freq_buffer_re_diffuse_fx[offset_diffuse]; pFreq_buf_im = &hCrend->freq_buffer_im_diffuse_fx[offset_diffuse]; pFreq_filt_re = &hCrend->freq_buffer_re_fx[i][offset]; pFreq_filt_im = &hCrend->freq_buffer_im_fx[i][offset]; - for ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ ) + FOR ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ ) { pFreq_buf_re[k] = L_add( Mpy_32_16_r( pFreq_filt_re[k], pCrend->hHrtfCrend->inv_diffuse_weight_fx[i] ), pFreq_buf_re[k] ); pFreq_buf_im[k] = L_add( Mpy_32_16_r( pFreq_filt_im[k], pCrend->hHrtfCrend->inv_diffuse_weight_fx[i] ), pFreq_buf_im[k] ); @@ -3167,53 +3171,56 @@ static ivas_error ivas_rend_crendConvolver( } } - for ( j = 0; j < nchan_out; j++ ) + FOR ( j = 0; j < nchan_out; j++ ) { set_val_Word32( tmp_out_re, 0, subframe_length ); set_val_Word32( tmp_out_im, 0, subframe_length ); i = 0; - for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) + move16(); + FOR ( idx_in = 0; idx_in < nchan_in; idx_in++ ) { - if ( idx_in != lfe_idx_in ) + IF ( NE_16( idx_in, lfe_idx_in ) ) { offset = 0; - for ( m = 0; m < pCrend->hHrtfCrend->num_iterations[i][j]; m++ ) + move16(); + FOR ( m = 0; m < pCrend->hHrtfCrend->num_iterations[i][j]; m++ ) { - offset_in = ( hCrend->delay_line_rw_index + pCrend->hHrtfCrend->max_num_iterations - pCrend->hHrtfCrend->num_iterations[i][j] + m + 1 ); + offset_in = add( add( hCrend->delay_line_rw_index, sub( pCrend->hHrtfCrend->max_num_iterations, pCrend->hHrtfCrend->num_iterations[i][j] ) ), add( m, 1 )); offset_in = offset_in % ( pCrend->hHrtfCrend->max_num_iterations ); - offset_in = offset_in * subframe_length; + offset_in = imult1616( offset_in, subframe_length ); pFreq_buf_re = &hCrend->freq_buffer_re_fx[i][offset_in]; pFreq_buf_im = &hCrend->freq_buffer_im_fx[i][offset_in]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_re_fx[i][j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_im_fx[i][j][offset]; - for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max[i][j][m]; k++ ) + FOR ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max[i][j][m]; k++ ) { tmp_out_re[k] = L_add( Msub_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_re[k] ), pFreq_buf_im[k], pFreq_filt_im[k] ) << 2, tmp_out_re[k] ); tmp_out_im[k] = L_add( Madd_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_im[k] ), pFreq_buf_im[k], pFreq_filt_re[k] ) << 2, tmp_out_im[k] ); } - offset = offset + k; + offset = add( offset, k ); } - i++; + i = add( i, 1 ); } } offset = 0; - for ( m = 0; m < pCrend->hHrtfCrend->num_iterations_diffuse[j]; m++ ) + move16(); + FOR ( m = 0; m < pCrend->hHrtfCrend->num_iterations_diffuse[j]; m++ ) { - offset_diffuse = ( hCrend->diffuse_delay_line_rw_index + m + 1 ); + offset_diffuse = add( hCrend->diffuse_delay_line_rw_index, add( m, 1 ) ); offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0]; - offset_diffuse = offset_diffuse * subframe_length; + offset_diffuse = imult1616( offset_diffuse, subframe_length ); pFreq_buf_re = &hCrend->freq_buffer_re_diffuse_fx[offset_diffuse]; pFreq_buf_im = &hCrend->freq_buffer_im_diffuse_fx[offset_diffuse]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_re_fx[j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_im_fx[j][offset]; - for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max_diffuse[j][m]; k++ ) + FOR ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max_diffuse[j][m]; k++ ) { tmp_out_re[k] = L_add( Msub_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_re[k] ), pFreq_buf_im[k], pFreq_filt_im[k] ), tmp_out_re[k] ); tmp_out_im[k] = L_add( Madd_32_32( Mpy_32_32( pFreq_buf_re[k], pFreq_filt_im[k] ), pFreq_buf_im[k], pFreq_filt_re[k] ), tmp_out_im[k] ); } - offset = offset + k; + offset = add( offset, k ); } ivas_imdft_fx( tmp_out_re, tmp_out_im, pOut, subframe_length ); @@ -3222,18 +3229,18 @@ static ivas_error ivas_rend_crendConvolver( dbgwrite_txt( pOut, subframe_length << 1, "Fixed_imdft_out.txt", NULL ); #endif pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; - for ( k = 0; k < subframe_length; k++ ) + FOR ( k = 0; k < subframe_length; k++ ) { pFreq_buf_re[k] = L_add( pOut[k], hCrend->prev_out_buffer_fx[j][k] ); hCrend->prev_out_buffer_fx[j][k] = pOut[k + subframe_length]; } } - hCrend->delay_line_rw_index++; + hCrend->delay_line_rw_index = add( hCrend->delay_line_rw_index, 1 ); hCrend->delay_line_rw_index = hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations ); - if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) + IF ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { - hCrend->diffuse_delay_line_rw_index++; + hCrend->diffuse_delay_line_rw_index = add( hCrend->diffuse_delay_line_rw_index, 1); hCrend->diffuse_delay_line_rw_index = hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] ); } @@ -3443,7 +3450,7 @@ ivas_error ivas_rend_crendProcess( hCrend = pCrend->hCrend; combinedOrientationEnabled = 0; - if ( hCombinedOrientationData != NULL ) + IF ( hCombinedOrientationData != NULL ) { FOR ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { @@ -3468,15 +3475,19 @@ ivas_error ivas_rend_crendProcess( { case 48000: subframe_len = L_SUBFRAME_48k; + move16(); BREAK; case 32000: subframe_len = L_SUBFRAME_32k; + move16(); BREAK; case 16000: subframe_len = L_SUBFRAME_16k; + move16(); BREAK; case 8000: subframe_len = L_SUBFRAME_8k; + move16(); BREAK; default: BREAK; @@ -3491,12 +3502,12 @@ ivas_error ivas_rend_crendProcess( FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { /* Early Reflections */ - if ( hCrend->reflections != NULL ) + IF ( hCrend->reflections != NULL ) { test(); IF( EQ_16( hCrend->reflections->use_er, 1 ) && EQ_16(hCrend->reflections->is_ready , 1) ) { - IF ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -3504,7 +3515,7 @@ ivas_error ivas_rend_crendProcess( } } - if ( hDecoderConfig && combinedOrientationEnabled ) + IF ( hDecoderConfig && combinedOrientationEnabled ) { /* Orientation tracking */ @@ -3717,7 +3728,7 @@ ivas_error ivas_rend_crendProcessSubframe( combinedOrientationEnabled = 0; IF ( hCombinedOrientationData != NULL ) { - if ( hCombinedOrientationData->enableCombinedOrientation[0] != 0 ) + IF ( NE_16( hCombinedOrientationData->enableCombinedOrientation[0], 0 ) ) { combinedOrientationEnabled = 1; } @@ -3726,12 +3737,12 @@ ivas_error ivas_rend_crendProcessSubframe( push_wmops( "ivas_rend_crendProcessSubframe" ); inConfigType = getAudioConfigType( inConfig ); - IF ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; } - IF ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ), IVAS_ERR_OK ) ) { return error; } @@ -3749,22 +3760,24 @@ ivas_error ivas_rend_crendProcessSubframe( /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ slots_to_render = min( hTcBuffer->num_slots - hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); first_sf = hTcBuffer->subframes_rendered; + move16(); last_sf = first_sf; + move16(); - while ( slots_to_render > 0 ) + WHILE ( slots_to_render > 0 ) { - slots_to_render -= hTcBuffer->subframe_nbslots[last_sf]; - last_sf++; + slots_to_render = sub( slots_to_render, hTcBuffer->subframe_nbslots[last_sf] ); + last_sf = add(last_sf, 1); } FOR ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { - subframe_len = hTcBuffer->subframe_nbslots[subframe_idx] * hTcBuffer->n_samples_granularity; + subframe_len = imult1616( hTcBuffer->subframe_nbslots[subframe_idx], hTcBuffer->n_samples_granularity ); /* Early Reflections */ IF ( hCrend->reflections != NULL ) { IF ( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) { - IF ( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local_fx, inConfig ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local_fx, inConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -3778,25 +3791,22 @@ ivas_error ivas_rend_crendProcessSubframe( MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL SBA SPAR -> BINAURAL or BINAURAL_ROOM */ - IF ( inConfig == IVAS_AUDIO_CONFIG_FOA || inConfig == IVAS_AUDIO_CONFIG_HOA2 || inConfig == IVAS_AUDIO_CONFIG_HOA3 ) + IF ( EQ_32( inConfig, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( inConfig, IVAS_AUDIO_CONFIG_HOA3 ) ) { rotateFrame_shd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, 0 ); } /* Rotation in SD for MC -> BINAURAL_ROOM */ ELSE IF ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { - //Word16 nchan; - //nchan = hIntSetup->nchan_out_woLFE + hIntSetup->num_lfe; - rotateFrame_sd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, hEFAPdata, 0 ); } } - IF( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) + IF( EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local_fx, p_pcm_tmp_fx, output_Fs, 0 ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local_fx, p_pcm_tmp_fx, output_Fs, 0 ) ), IVAS_ERR_OK ) ) { return error; @@ -3804,7 +3814,7 @@ ivas_error ivas_rend_crendProcessSubframe( IF ( pCrend->hCrend->hReverb != NULL ) { - if ( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ) != IVAS_ERR_OK ) + IF ( NE_32( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ), IVAS_ERR_OK ) ) { return error; } @@ -3818,7 +3828,7 @@ ivas_error ivas_rend_crendProcessSubframe( { p_pcm_tmp_fx[ch] += subframe_len; } - hTcBuffer->slots_rendered += hTcBuffer->subframe_nbslots[subframe_idx]; + hTcBuffer->slots_rendered = add( hTcBuffer->subframe_nbslots[subframe_idx], hTcBuffer->slots_rendered ); } ELSE { @@ -3830,9 +3840,9 @@ ivas_error ivas_rend_crendProcessSubframe( IF ( pCrend->hCrend->hReverb != NULL ) { *pCrend->p_io_qfactor -= 2; - for (int i = nchan_out; i < nchan_in; i++) + FOR (Word16 i = nchan_out; i < nchan_in; i++) { - for (int j = 0; j < n_samples_to_render; j++) + FOR (Word16 j = 0; j < n_samples_to_render; j++) { output[i][j] = (Word32)L_shr(output[i][j], 2); } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 39d7df4e5..3fb71bb4d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -179,7 +179,7 @@ static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtR * * Initialize parametric binaural renderer *------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ @@ -263,11 +263,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) { -#ifdef IVAS_FLOAT_FIXED - ivas_binaural_reverb_close_fx( &( hDiracDecBin->hReverb ) ); -#else ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); -#endif } if ( hDiracDecBin->hReverb == NULL ) @@ -353,8 +349,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( } return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_dirac_dec_init_binaural_data_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ @@ -562,11 +557,7 @@ void ivas_dirac_dec_close_binaural_data( IF( ( *hBinaural )->hReverb != NULL ) { -#ifdef IVAS_FLOAT_FIXED ivas_binaural_reverb_close_fx( &( ( *hBinaural )->hReverb ) ); -#else - ivas_binaural_reverb_close( &( ( *hBinaural )->hReverb ) ); -#endif } ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 1311f5ed9..421048ba9 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -61,7 +61,6 @@ #define DIRECTION_SMOOTHNESS_ALPHA 0.01f #define DIRECTION_SMOOTHNESS_ALPHA_Q31 (Word32)(0.01f * ONE_IN_Q31) - /*------------------------------------------------------------------------- * Local function prototypes *------------------------------------------------------------------------*/ @@ -76,7 +75,7 @@ static void computeTargetPSDs_diffuse_fx( const Word16 num_channels, const Word1 static void computeTargetPSDs_diffuse_subframe_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word16 start_band, const Word32 *diffuse_power_factor, const Word32 *reference_power, const Word16 *q_reference_power, const Word32 *diffuse_responses_square, Word32 *cy_auto_diff_smooth, Word16 *q_cy_auto_diff_smooth ); static void computeTargetPSDs_diffuse_with_onsets_fx( const Word16 num_channels, const Word16 num_freq_bands, const Word16 num_decorr_freq_bands, const Word16 *proto_frame_diff_index, const Word32 *diffuse_power_factor, const Word32 *reference_power, const Word16 *q_reference_power, const Word32 *diffuse_responses_square, const Word32 *onset_filter, Word32 *cy_auto_diff_smooth, Word16 *q_cy_auto_diff_smooth ); -#endif +#else static void computeTargetPSDs_direct( const int16_t num_channels, const int16_t num_freq_bands, const float *direct_power_factor, const float *reference_power, const float *direct_responses, const float *direct_responses_square, float *cy_auto_dir_smooth, float *cy_cross_dir_smooth ); @@ -87,7 +86,7 @@ static void computeTargetPSDs_diffuse( const int16_t num_channels, const int16_t static void computeTargetPSDs_diffuse_subframe( const int16_t num_channels, const int16_t num_freq_bands, const int16_t start_band, const float *diffuse_power_factor, const float *reference_power, const float *diffuse_responses_square, float *cy_auto_diff_smooth ); static void computeTargetPSDs_diffuse_with_onsets( const int16_t num_channels, const int16_t num_freq_bands, const int16_t num_decorr_freq_bands, const int16_t *proto_frame_diff_index, const float *diffuse_power_factor, const float *reference_power, const float *diffuse_responses_square, const float *onset_filter, float *cy_auto_diff_smooth ); - +#endif #ifndef IVAS_FLOAT_FIXED static void computeAlphaSynthesis( float *alpha_synthesis, const int16_t averaging_length_ms, const float maxAlpha, int16_t *numAlphas, const int16_t slot_size, const int16_t num_freq_bands, const float *frequency_axis, const int32_t output_Fs ); #endif @@ -101,12 +100,13 @@ static void spreadCoherencePanningVbap_fx( const int16_t azimuth, const int16_t static void normalizePanningGains_fx( Word32 *direct_response_fx, Word16 *q_direct_res, const Word16 num_channels_dir ); #endif +#ifndef IVAS_FLOAT_FIXED static void spreadCoherencePanningHoa( const int16_t azimuth, const int16_t elevation, const float spreadCoh, float *direct_response, const int16_t num_channels_dir, const int16_t ambisonics_order ); static void spreadCoherencePanningVbap( const int16_t azimuth, const int16_t elevation, const float spreadCoh, float *direct_response, const int16_t num_channels_dir, const VBAP_HANDLE hVBAPdata ); static void normalizePanningGains( float *direct_response, const int16_t num_channels_dir ); - +#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_output_synthesis_open() @@ -1284,7 +1284,7 @@ void ivas_dirac_dec_output_synthesis_close_fx( * * *------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_output_synthesis_process_slot( const float *reference_power, /* i : Estimated power */ const float *onset, /* i : onset filter */ @@ -1517,8 +1517,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_dirac_dec_output_synthesis_process_slot_fx( const Word32 *reference_power, /* i : Estimated power */ const Word16 q_reference_power, /* i : Estimated power */ @@ -2627,7 +2626,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( return; } -#endif +#else /*------------------------------------------------------------------------- @@ -3007,11 +3006,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( if ( hDirACRend->hOutSetup.is_loudspeaker_setup && hDirACRend->hoa_decoder != NULL ) { float *p_real, *p_imag; -#ifndef IVAS_FLOAT_FIXED const float *hoa_decoder; -#else - const Word32 *hoa_decoder; -#endif hoa_decoder = hDirACRend->hoa_decoder; @@ -3024,22 +3019,12 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( { p_out_real = output_real + l * num_channels_dir; p_out_imag = output_imag + l * num_channels_dir; -#ifndef IVAS_FLOAT_FIXED p_real[l] = *( p_out_real++ ) * hoa_decoder[0]; p_imag[l] = *( p_out_imag++ ) * hoa_decoder[0]; -#else - p_real[l] = *( p_out_real++ ) * ( (float) hoa_decoder[0] ) / ONE_IN_Q29; - p_imag[l] = *( p_out_imag++ ) * ( (float) hoa_decoder[0] ) / ONE_IN_Q29; -#endif for ( i = 1; i < num_channels_dir; i++ ) { -#ifndef IVAS_FLOAT_FIXED p_real[l] += *( p_out_real++ ) * hoa_decoder[i]; p_imag[l] += *( p_out_imag++ ) * hoa_decoder[i]; -#else - p_real[l] += *( p_out_real++ ) * ( (float) hoa_decoder[i] ) / ONE_IN_Q29; - p_imag[l] += *( p_out_imag++ ) * ( (float) hoa_decoder[i] ) / ONE_IN_Q29; -#endif } } hoa_decoder += 16; @@ -3088,7 +3073,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -3715,7 +3700,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( return; } -#endif +#else /*------------------------------------------------------------------------- @@ -4076,7 +4061,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -4352,7 +4337,7 @@ static void ivas_dirac_dec_get_response_split_order_fx( return; } -#endif +#else /*------------------------------------------------------------------------- * ivas_dirac_dec_get_response_split_order() * @@ -4514,7 +4499,7 @@ static void ivas_dirac_dec_get_response_split_order( return; } - +#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_compute_directional_responses() @@ -5070,7 +5055,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( ismDirect_fx = L_add( ismDirect_fx, hMasaIsm->energy_ratio_ism_fx[dir][md_idx][k] ); } - totalDirect_fx = L_add( masaDirect_fx, ismDirect_fx ); + totalDirect_fx = L_add_sat( masaDirect_fx, ismDirect_fx ); // saturating as 1.0 (Q30) + 1.0 (Q30) is observed Word16 var_a = 0, var_b = 0; move16(); var_a = BASOP_Util_Divide3232_Scale( masaDirect_fx, totalDirect_fx, &exp_1 ); @@ -5205,7 +5190,7 @@ void ivas_dirac_dec_compute_directional_responses_fx( return; } -#endif +#else void ivas_dirac_dec_compute_directional_responses( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ @@ -5554,7 +5539,7 @@ void ivas_dirac_dec_compute_directional_responses( return; } - +#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_compute_gain_factors() * @@ -6039,7 +6024,7 @@ static void computeTargetPSDs_direct_fx( return; } -#endif +#else static void computeTargetPSDs_direct( const int16_t num_channels, @@ -6074,7 +6059,7 @@ static void computeTargetPSDs_direct( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_direct_subframe_fx( const Word16 num_channels, @@ -6113,7 +6098,7 @@ static void computeTargetPSDs_direct_subframe_fx( return; } -#endif +#else static void computeTargetPSDs_direct_subframe( @@ -6145,7 +6130,7 @@ static void computeTargetPSDs_direct_subframe( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_diffuse_fx( @@ -6187,7 +6172,7 @@ static void computeTargetPSDs_diffuse_fx( return; } -#endif +#else static void computeTargetPSDs_diffuse( const int16_t num_channels, @@ -6217,7 +6202,7 @@ static void computeTargetPSDs_diffuse( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_diffuse_subframe_fx( const Word16 num_channels, @@ -6249,7 +6234,7 @@ static void computeTargetPSDs_diffuse_subframe_fx( return; } -#endif +#else static void computeTargetPSDs_diffuse_subframe( @@ -6277,7 +6262,7 @@ static void computeTargetPSDs_diffuse_subframe( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_diffuse_with_onsets_fx( @@ -6350,7 +6335,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( return; } -#endif +#else static void computeTargetPSDs_diffuse_with_onsets( @@ -6392,7 +6377,7 @@ static void computeTargetPSDs_diffuse_with_onsets( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void computeAlphaSynthesis_fx(Word16 *alpha_synthesis_fx, const Word16 averaging_length_ms, const Word16 maxAlpha_fx, Word16 *numAlphas, const Word16 slot_size, const Word16 num_freq_bands, Word16 *frequency_axis_fx, const Word32 output_Fs) { @@ -6571,7 +6556,7 @@ static void spreadCoherencePanningHoa_fx( return; } -#endif +#else static void spreadCoherencePanningHoa( const int16_t azimuth, @@ -6614,7 +6599,7 @@ static void spreadCoherencePanningHoa( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void spreadCoherencePanningVbap_fx( const Word16 azimuth, @@ -6694,7 +6679,7 @@ static void spreadCoherencePanningVbap_fx( return; } -#endif +#else static void spreadCoherencePanningVbap( const int16_t azimuth, @@ -6707,12 +6692,6 @@ static void spreadCoherencePanningVbap( int16_t i; float direct_response_left[MAX_OUTPUT_CHANNELS]; float direct_response_right[MAX_OUTPUT_CHANNELS]; -#ifdef IVAS_FLOAT_FIXED - Word32 direct_response_left_fx[MAX_OUTPUT_CHANNELS]; - Word32 direct_response_right_fx[MAX_OUTPUT_CHANNELS]; - set32_fx(direct_response_left_fx, 0, MAX_OUTPUT_CHANNELS); - set32_fx(direct_response_right_fx, 0, MAX_OUTPUT_CHANNELS); -#endif float gainCenter; float gainSide; @@ -6723,35 +6702,12 @@ static void spreadCoherencePanningVbap( return; } -#ifdef IVAS_FLOAT_FIXED - Word32 direct_response_fx[MAX_OUTPUT_CHANNELS]; - set32_fx( direct_response_fx, 0, MAX_OUTPUT_CHANNELS ); - vbap_determine_gains_fx( hVBAPdata, direct_response_fx, azimuth, elevation, 0 ); - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - direct_response[i] = fix_to_float( direct_response_fx[i], Q29 ); - } -#else vbap_determine_gains( hVBAPdata, direct_response, azimuth, elevation, 0 ); -#endif if ( spreadCoh > 0.f ) { -#ifdef IVAS_FLOAT_FIXED - vbap_determine_gains_fx(hVBAPdata, direct_response_left_fx, azimuth + 30, elevation, 0); - FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - direct_response_left[i] = fix_to_float(direct_response_left_fx[i], Q29); - } - vbap_determine_gains_fx(hVBAPdata, direct_response_right_fx, azimuth - 30, elevation, 0); - FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - direct_response_right[i] = fix_to_float(direct_response_right_fx[i], Q29); - } -#else vbap_determine_gains( hVBAPdata, direct_response_left, azimuth + 30, elevation, 0 ); vbap_determine_gains( hVBAPdata, direct_response_right, azimuth - 30, elevation, 0 ); -#endif if ( spreadCoh < 0.5f ) { @@ -6772,7 +6728,7 @@ static void spreadCoherencePanningVbap( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void normalizePanningGains_fx( Word32 *direct_response_fx, @@ -6811,7 +6767,7 @@ static void normalizePanningGains_fx( return; } -#endif +#else static void normalizePanningGains( float *direct_response, @@ -6830,3 +6786,4 @@ static void normalizePanningGains( return; } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 94cd7e02a..50a0bbcc5 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -676,21 +676,13 @@ ivas_error ivas_spat_hSpatParamRendCom_config( hSpatParamRendCom->render_to_md_map[map_idx] = hSpatParamRendCom->dirac_read_idx + map_idx / num_slots_in_subfr; } } -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_dirac_allocate_parameters_fx( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) -#endif { return error; } if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && hodirac_flag ) ) { -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_dirac_allocate_parameters_fx( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2094,7 +2086,7 @@ void compute_hoa_encoder_mtx_fx( return; } -#endif +#else void compute_hoa_encoder_mtx( const float *azimuth, @@ -2114,13 +2106,13 @@ void compute_hoa_encoder_mtx( return; } - +#endif /*------------------------------------------------------------------------- * ivas_dirac_dec_get_frequency_axis() * * DirAC decoding initialization *------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_get_frequency_axis( float *frequency_axis, const int32_t output_Fs, @@ -2138,8 +2130,7 @@ void ivas_dirac_dec_get_frequency_axis( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_dirac_dec_get_frequency_axis_fx( Word16 *frequency_axis, /* Q0 */ const Word32 output_Fs, @@ -2165,7 +2156,7 @@ void ivas_dirac_dec_get_frequency_axis_fx( * * *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void initDiffuseResponses( float *diffuse_response_function, const int16_t num_channels, @@ -2271,8 +2262,7 @@ void initDiffuseResponses( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void initDiffuseResponses_fx( Word16 *diffuse_response_function_fx, const Word16 num_channels, @@ -2657,7 +2647,7 @@ void protoSignalComputation_shd_fx( return; } -#endif +#else /*------------------------------------------------------------------------- * protoSignalComputation_shd() * @@ -2818,7 +2808,7 @@ void protoSignalComputation_shd( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -2921,7 +2911,7 @@ void protoSignalComputation1_fx( return; } -#endif +#else /*------------------------------------------------------------------------- * protoSignalComputation1() * @@ -2960,7 +2950,7 @@ void protoSignalComputation1( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * protoSignalComputation2_fx() @@ -3723,7 +3713,7 @@ void protoSignalComputation2_fx( return; } -#endif +#else /*------------------------------------------------------------------------- * protoSignalComputation2() * @@ -4049,7 +4039,7 @@ void protoSignalComputation2( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * protoSignalComputation4_fx() @@ -4222,11 +4212,7 @@ void protoSignalComputation4( const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands, -#ifndef IVAS_FLOAT_FIXED const float *mtx_hoa_decoder, -#else - const Word32 *mtx_hoa_decoder, -#endif const int16_t nchan_transport, const int16_t *sba_map_tc_ind ) { @@ -4254,13 +4240,8 @@ void protoSignalComputation4( proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] = 0.f; for ( n = 0; n < nchan_transport; n++ ) { -#ifndef IVAS_FLOAT_FIXED proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; -#else - proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * ( (float) mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]] ) / ONE_IN_Q29; - proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * ( (float) mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]] ) / ONE_IN_Q29; -#endif } } } @@ -4412,7 +4393,7 @@ void ivas_dirac_dec_compute_diffuse_proto_fx( return; } -#endif +#else void ivas_dirac_dec_compute_diffuse_proto( DIRAC_REND_HANDLE hDirACRend, const int16_t num_freq_bands, @@ -4488,7 +4469,7 @@ void ivas_dirac_dec_compute_diffuse_proto( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -4714,7 +4695,7 @@ void ivas_masa_init_stereotype_detection_fx( return; } -#endif +#else void ivas_masa_init_stereotype_detection( MASA_STEREO_TYPE_DETECT *stereo_type_detect ) { @@ -4750,7 +4731,7 @@ void ivas_masa_init_stereotype_detection( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_masa_stereotype_detection_fx() @@ -4889,7 +4870,7 @@ void ivas_masa_stereotype_detection_fx( return; } -#endif +#else /*------------------------------------------------------------------------- * ivas_masa_stereotype_detection() * @@ -4987,7 +4968,7 @@ void ivas_masa_stereotype_detection( return; } - +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -5414,7 +5395,7 @@ void rotateAziEle_DirAC_fx( return; } -#endif +#else /*------------------------------------------------------------------------- * rotateAziEle_DirAC() * @@ -5458,7 +5439,7 @@ void rotateAziEle_DirAC( return; } - +#endif /* A reduced rewrite of the corresponding decoder side function */ #ifndef IVAS_FLOAT_FIXED static void ivas_masa_ext_dirac_render_sf( diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index be1678638..c712da4b5 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -191,6 +191,7 @@ ivas_error efap_init_data_fx( error = IVAS_ERR_OK; /* Basic init checks */ + test(); IF( !speaker_node_azi_deg || !speaker_node_ele_deg ) { hEFAPdata = NULL; @@ -233,10 +234,10 @@ ivas_error efap_init_data_fx( * Initialize values *-----------------------------------------------------------------*/ - efap->numSpk = num_speaker_nodes; + efap->numSpk = num_speaker_nodes; move16(); /* The number of vertex is first set to the number of LS but will evolve further */ - efap->vtxData.numVtx = num_speaker_nodes; + efap->vtxData.numVtx = num_speaker_nodes; move16(); /* Loudspeaker configuration */ mvl2l( speaker_node_azi_deg, efap->aziSpk, num_speaker_nodes ); @@ -377,8 +378,8 @@ void efap_determine_gains_fx( Word32 normBuffer; /* Resetting bufferShort and bufferLong */ - set_l( hEFAPdata->bufferShort_fx, 0, hEFAPdata->numSpk ); - set_l( hEFAPdata->bufferLong_fx, 0, hEFAPdata->vtxData.numVtx ); + set32_fx( hEFAPdata->bufferShort_fx, 0, hEFAPdata->numSpk ); + set32_fx( hEFAPdata->bufferLong_fx, 0, hEFAPdata->vtxData.numVtx ); /* Wrap angles to correct range */ panning_wrap_angles_fixed( azi_deg, ele_deg, &azi_wrap_int, &ele_wrap_int ); @@ -388,10 +389,10 @@ void efap_determine_gains_fx( IF( EQ_16( efap_mode, EFAP_MODE_EFAP ) ) { - normBuffer = 0; + normBuffer = 0; move16(); FOR( j = 0; j < hEFAPdata->numSpk; ++j ) { - hEFAPdata->bufferShort_fx[j] = 0; + hEFAPdata->bufferShort_fx[j] = 0; move16(); /* Multiplying by the downmixMatrix */ FOR( i = 0; i < hEFAPdata->vtxData.numVtx; ++i ) { @@ -399,7 +400,7 @@ void efap_determine_gains_fx( } normBuffer = L_add_sat( normBuffer, Mpy_32_32( hEFAPdata->bufferShort_fx[j], hEFAPdata->bufferShort_fx[j] ) ); // Q29 } - Word16 exp = 2; + Word16 exp = 2; move16(); normBuffer = ISqrt32( normBuffer, &exp ); FOR( j = 0; j < hEFAPdata->numSpk; ++j ) @@ -410,10 +411,10 @@ void efap_determine_gains_fx( } ELSE { - normBuffer = 0; + normBuffer = 0; move16(); FOR( j = 0; j < hEFAPdata->numSpk; ++j ) { - hEFAPdata->bufferShort_fx[j] = 0; + hEFAPdata->bufferShort_fx[j] = 0; move16(); /* Multiplying by the downmixMatrix */ FOR( i = 0; i < hEFAPdata->vtxData.numVtx; ++i ) { @@ -421,12 +422,12 @@ void efap_determine_gains_fx( } normBuffer = L_add_sat( normBuffer, L_shr( hEFAPdata->bufferShort_fx[j], Q1 ) ); // Q29 } - Word16 exp = 2; + Word16 exp = 2; move16(); normBuffer = Inv16( (Word16) L_shr( normBuffer, Q16 ), &exp ); FOR( j = 0; j < hEFAPdata->numSpk; ++j ) { - Word16 exp_temp = exp + 1; + Word16 exp_temp = add(exp, 1); hEFAPdata->bufferShort_fx[j] = Sqrt32( Mpy_32_16_1( hEFAPdata->bufferShort_fx[j], (Word16) normBuffer ), &exp_temp ); hEFAPdata->bufferShort_fx[j] = L_shl( hEFAPdata->bufferShort_fx[j], sub( exp_temp, 1 ) ); // Q30 } @@ -528,6 +529,7 @@ void efap_free_data( Word16 i, dim1; void **p_dmTranspose; + test(); IF( hEFAPdata == NULL || *hEFAPdata == NULL ) { return; @@ -636,10 +638,10 @@ static ivas_error poly_init_fx( const Word16 efip_flag /* i : flag to indicate whether initialization is for EFIP (used for ALLRAD) */ ) { - int16_t n, m, j; - int16_t finalLength, lengthTri2PolyPS; - int16_t lengthTri2PolySorted[EFAP_MAX_POLY_SET]; - int16_t sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM]; + Word16 n, m, j; + Word16 finalLength, lengthTri2PolyPS; + Word16 lengthTri2PolySorted[EFAP_MAX_POLY_SET]; + Word16 sortedChan[EFAP_MAX_POLY_SET][EFAP_MAX_CHAN_NUM]; Word32 tmpMax, tmpMin; ivas_error error; @@ -650,7 +652,7 @@ static ivas_error poly_init_fx( FOR( n = 0; n < EFAP_MAX_POLY_SET; n++ ) { - set_s( sortedChan[n], 0, EFAP_MAX_CHAN_NUM ); + set16_fx( sortedChan[n], 0, EFAP_MAX_CHAN_NUM ); } /* Computing the different ghost vertex, the downmix matrix and the triangle array */ @@ -665,7 +667,7 @@ static ivas_error poly_init_fx( IF( GT_32( efap->vtxData.vertexArray[n].ele, L_sub( Q22_90_DEG, 4 ) ) || LT_32( efap->vtxData.vertexArray[n].ele, L_sub( 4, Q22_90_DEG ) ) ) { - efap->vtxData.vertexArray[n].isNaN = 1; + efap->vtxData.vertexArray[n].isNaN = 1; move16(); } } @@ -673,22 +675,22 @@ static ivas_error poly_init_fx( tri_to_poly_fx( efap->vtxData.vertexArray, efap->polyData.triArray, efap->vtxData.numVtx, efap->polyData.numTri, sortedChan, &lengthTri2PolyPS, lengthTri2PolySorted ); /* Completing the polyData Structure */ - finalLength = -1; + finalLength = -1; move16(); FOR( n = 0; n < lengthTri2PolyPS; ++n ) { - m = finalLength + 1; + m = add(finalLength, 1); /* Complete the fields of the polygon */ FOR( j = 0; j < lengthTri2PolySorted[n]; ++j ) { - efap->polyData.polysetArray[m].chan[j] = sortedChan[n][j]; - efap->polyData.polysetArray[m].polyAzi[j] = efap->vtxData.vertexArray[sortedChan[n][j]].azi; - efap->polyData.polysetArray[m].polyEle[j] = efap->vtxData.vertexArray[sortedChan[n][j]].ele; - efap->polyData.polysetArray[m].isNaN[j] = efap->vtxData.vertexArray[sortedChan[n][j]].isNaN; + efap->polyData.polysetArray[m].chan[j] = sortedChan[n][j]; move16(); + efap->polyData.polysetArray[m].polyAzi[j] = efap->vtxData.vertexArray[sortedChan[n][j]].azi; move32(); + efap->polyData.polysetArray[m].polyEle[j] = efap->vtxData.vertexArray[sortedChan[n][j]].ele; move32(); + efap->polyData.polysetArray[m].isNaN[j] = efap->vtxData.vertexArray[sortedChan[n][j]].isNaN; move16(); } - efap->polyData.polysetArray[m].numChan = lengthTri2PolySorted[n]; + efap->polyData.polysetArray[m].numChan = lengthTri2PolySorted[n]; move16(); /* In case tmpMax - tmpMin > 180, wrap polygon azimuth */ maximum_l( efap->polyData.polysetArray[m].polyAzi, lengthTri2PolySorted[n], &tmpMax ); @@ -722,7 +724,7 @@ static ivas_error poly_init_fx( finalLength = add( finalLength, 1 ); /* Updating the number of polygons */ - efap->polyData.numPoly = finalLength; + efap->polyData.numPoly = finalLength; move16(); return error; @@ -1132,7 +1134,7 @@ static void initial_polyeder_fx( } /* 2. attempt to create a triangle with nonzero area */ - tmp = 0; + tmp = 0; move16(); v_sub_fixed( vtxData->vertexArray[tetrahedron[1]].pos, vtxData->vertexArray[tetrahedron[0]].pos, tmp1, 3, 1 ); WHILE( LT_16( tetrahedron[2], numVtx ) ) { @@ -1403,19 +1405,19 @@ static void add_ghost_speakers_fx( vtxDmxType = EFAP_DMX_INTENSITY; numVertex = *numVtx; - maxAngle = 13421773; //(1.f / 160.0f) in Q31 + maxAngle = 13421773; move32();//(1.f / 160.0f) in Q31 /* Extracting Azi and Ele for computation purposes */ FOR( i = 0; i < numVertex; ++i ) { - ele[i] = vertexArray[i].ele; + ele[i] = vertexArray[i].ele; move32(); } /* ADD VOG IF NECESSERAY (i.e. if the elevation of the highest LS is < 90 deg) */ - a = 0; + a = 0; move16(); maximum_l( ele, numVertex, &tmpEle ); - lengthVertGhst = 0; + lengthVertGhst = 0; move16(); IF( LT_32( tmpEle, Q22_90_DEG ) ) { IF( efip_flag ) @@ -1457,7 +1459,7 @@ static void add_ghost_speakers_fx( } /* LIST ALL SURROUNDING loudspeakers */ - k = 0; + k = 0; move16(); FOR( i = 0; i < numVertex; ++i ) { @@ -1468,21 +1470,21 @@ static void add_ghost_speakers_fx( } } - lengthHorGhst = 0; + lengthHorGhst = 0; move16(); IF( EQ_16( k, 0 ) ) /* no speakers found: add a triangle of ghost speakers */ { - add_vertex_fx( vertexArray, 0, 0, numVertex + a, EFAP_DMX_INTENSITY ); - add_vertex_fx( vertexArray, Q22_120_DEG, 0, numVertex + a + 1, EFAP_DMX_INTENSITY ); - add_vertex_fx( vertexArray, Q22_240_DEG, 0, numVertex + a + 2, EFAP_DMX_INTENSITY ); - a += 3; - lengthHorGhst += 3; + add_vertex_fx( vertexArray, 0, 0, add(numVertex, a), EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, Q22_120_DEG, 0, add(add(numVertex, a), 1), EFAP_DMX_INTENSITY ); + add_vertex_fx( vertexArray, Q22_240_DEG, 0, add(add(numVertex, a), 2), EFAP_DMX_INTENSITY ); + a = add(a, 3); + lengthHorGhst = add(lengthHorGhst, 3); } ELSE IF( EQ_16( k, 1 ) ) /* only one speaker found: add two ghost speakers to complete a triangle */ { add_vertex_fx( vertexArray, L_add( tmpAzi[0], Q22_120_DEG ), 0, numVertex + a, EFAP_DMX_INTENSITY ); add_vertex_fx( vertexArray, L_add( tmpAzi[0], Q22_240_DEG ), 0, numVertex + a + 1, EFAP_DMX_INTENSITY ); - a += 2; - lengthHorGhst += 2; + a = add(a, 2); + lengthHorGhst = add(lengthHorGhst, 2); } ELSE /* fill gaps greater than maxAngle */ { @@ -1704,7 +1706,7 @@ static void add_vertex_to_convex_hull_fx( Word16 surface[3]; Word32 numHullVtx; Word32 centroid[3]; - const Word32 threshold = -268; // -1e-6f in Q28 + const Word32 threshold = -268; move32();// -1e-6f in Q28 Word32 tmpDist; EFAP_LS_TRIANGLE triArrayNew[EFAP_MAX_POLY_SET]; @@ -1715,8 +1717,8 @@ static void add_vertex_to_convex_hull_fx( } /* Compute the centroid of the current convex hull */ - numHullVtx = 0; - set_l( centroid, 0, 3 ); + numHullVtx = 0; move32(); + set32_fx( centroid, 0, 3 ); FOR( i = 0; i < vtxData->numVtx; i++ ) { IF( vtxInHull[i] ) @@ -1738,15 +1740,15 @@ static void add_vertex_to_convex_hull_fx( centroid[2] = L_shl( centroid[2], 4 ); /* Processing */ - k = 0; - l = 0; + k = 0; move16(); + l = 0; move16(); FOR( i = 0; i < *szTri; ++i ) { tmpDist = vertex_distance_fx( vtxData->vertexArray, triArray[i], vtxIdx ); // Q28 IF( GT_32( tmpDist, threshold ) ) { - visible[k] = i; + visible[k] = i; move16(); ++k; } ELSE @@ -1760,9 +1762,9 @@ static void add_vertex_to_convex_hull_fx( FOR( i = 0; i < numEdges[0]; i += 2 ) { - surface[0] = edges[i]; - surface[1] = edges[i + 1]; - surface[2] = vtxIdx; + surface[0] = edges[i]; move16(); + surface[1] = edges[i + 1]; move16(); + surface[2] = vtxIdx; move16(); flip_plane_fx( vtxData->vertexArray, surface, centroid ); @@ -1778,7 +1780,7 @@ static void add_vertex_to_convex_hull_fx( *szTri = l; /* Flag the vertex as added to the hull */ - vtxInHull[vtxIdx] = 1; + vtxInHull[vtxIdx] = 1; move16(); return; } #endif @@ -1808,29 +1810,29 @@ static void visible_edges_fx( /* Set counter and counterTranspose to 0 */ FOR( i = 0; i < EFAP_MAX_SIZE_TMP_BUFF; i++ ) { - set_s( counter[i], 0, EFAP_MAX_SIZE_TMP_BUFF ); - set_s( counterTranspose[i], 0, EFAP_MAX_SIZE_TMP_BUFF ); + set16_fx( counter[i], 0, EFAP_MAX_SIZE_TMP_BUFF ); + set16_fx( counterTranspose[i], 0, EFAP_MAX_SIZE_TMP_BUFF ); } /* Finding the max vertex */ FOR( i = 0; i < numSurface; ++i ) { - tmpMax[i] = triArray[visible[i]].LS[0]; + tmpMax[i] = triArray[visible[i]].LS[0]; move16(); FOR( j = 1; j < 3; ++j ) { IF( tmpMax[i] < triArray[visible[i]].LS[j] ) { - tmpMax[i] = triArray[visible[i]].LS[j]; + tmpMax[i] = triArray[visible[i]].LS[j]; move16(); } } } maxVertex = tmpMax[maximum_s( tmpMax, numSurface, NULL )]; FOR( i = 0; i < numSurface; ++i ) { - tmpSurface[0] = triArray[visible[i]].LS[0]; - tmpSurface[1] = triArray[visible[i]].LS[1]; - tmpSurface[2] = triArray[visible[i]].LS[2]; - tmpSurface[3] = triArray[visible[i]].LS[0]; + tmpSurface[0] = triArray[visible[i]].LS[0]; move16(); + tmpSurface[1] = triArray[visible[i]].LS[1]; move16(); + tmpSurface[2] = triArray[visible[i]].LS[2]; move16(); + tmpSurface[3] = triArray[visible[i]].LS[0]; move16(); FOR( j = 0; j < 3; ++j ) { @@ -1858,15 +1860,15 @@ static void visible_edges_fx( { IF( counter[a][b] == 1 ) { - edges[k] = a; - edges[k + 1] = b; - k += 2; + edges[k] = a; move16(); + edges[k + 1] = b; move16(); + k = add(k, 2); } } } /* Outputs */ - *numEdges = k; + *numEdges = k; move16(); return; } @@ -2199,10 +2201,10 @@ static void remap_ghosts_fx( Word32 tmpMat[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; Word32 tmpNewMat[EFAP_MAX_SIZE_TMP_BUFF][EFAP_MAX_SIZE_TMP_BUFF]; Word32 tmpDist; - const Word32 thresh = 214748; // 1e-4f in Q31 + const Word32 thresh = 214748; move32();// 1e-4f in Q31 - set_l( tmpVec, 0, EFAP_MAX_SIZE_TMP_BUFF ); - set_l( tmpVec2, 0, EFAP_MAX_SIZE_TMP_BUFF ); + set32_fx( tmpVec, 0, EFAP_MAX_SIZE_TMP_BUFF ); + set32_fx( tmpVec2, 0, EFAP_MAX_SIZE_TMP_BUFF ); /* Finding unused ghosts (i.e. ghost speakers that aren't used for triangulation */ FOR( g = numVtx - 1; g > numSpk - 1; --g ) @@ -2235,8 +2237,8 @@ static void remap_ghosts_fx( /* Initializing tmpMat as the identity matrix */ FOR( i = 0; i < numTot; ++i ) { - set_l( tmpMat[i], 0, numTot ); - set_l( tmpNewMat[i], 0, numTot ); + set32_fx( tmpMat[i], 0, numTot ); + set32_fx( tmpNewMat[i], 0, numTot ); tmpMat[i][i] = 0x7fffffff; tmpNewMat[i][i] = 0x7fffffff; @@ -2299,7 +2301,7 @@ static void remap_ghosts_fx( } ELSE { - Word16 exp = 0; + Word16 exp = 0; move16(); Word32 tmp_sqrt = Sqrt32( tmpNewMat[j][i], &exp ); tmp_sqrt = L_shl( tmp_sqrt, exp ); downmixMatrixTranspose[j][i] = tmp_sqrt; @@ -2324,7 +2326,7 @@ static void remap_ghosts_fx( } ELSE { - Word16 exp = 0; + Word16 exp = 0; move16(); Word32 tmp_sqrt = Sqrt32( tmpNewMat[j][i], &exp ); tmp_sqrt = L_shl( tmp_sqrt, exp ); downmixMatrixTranspose[j][i] = tmp_sqrt; @@ -2335,7 +2337,7 @@ static void remap_ghosts_fx( } /* Output */ - *numVertex = numTot; + *numVertex = numTot; move16(); return; } @@ -2507,7 +2509,7 @@ static void efap_panning_fx( /* Computing the norm of the tmp buffer */ normTmpBuff = dotp_fixed( tmpBuff, tmpBuff, numChan ); - Word16 exp = 0; + Word16 exp = 0; move16(); normTmpBuff = ISqrt32( normTmpBuff, &exp ); /* Updating the buffer structure */ @@ -2697,9 +2699,9 @@ static Word32 get_tri_gain_fx( tmpDot1 = dotp_fixed( tmpN, tmpSub1, 2 ); // Q13 - Word16 exp = Q13; + Word16 exp = Q13; move16(); Word32 inv_tmpDot2 = L_shl( tmpDot1, norm_l( tmpDot1 ) ); - exp = exp - norm_l( tmpDot1 ); + exp = sub(exp, norm_l( tmpDot1 )); Word16 inv_tmpDot1 = Inv16( (Word16) L_shr( inv_tmpDot2, Q16 ), &exp ); v_multc_fixed( tmpN, L_shl( inv_tmpDot1, Q16 + exp ), N, 2 ); @@ -2709,7 +2711,7 @@ static Word32 get_tri_gain_fx( /* Set gains <= -60dB to 0 to avoid problems in SVD */ IF( LT_32( L_abs( gain ), 1 ) ) { - gain = 0; + gain = 0; move32(); } return gain; // Q18 } @@ -2806,14 +2808,14 @@ static void add_vertex_fx( /* IdxEleTmp */ tmp = L_abs( vtxArray[pos].ele ); - idxEleTmp = tmp; + idxEleTmp = tmp; move16(); idxEleTmp = L_sub( Q22_90_DEG, idxEleTmp ); /* Final Idx */ vtxArray[pos].idx = add( (Word16) idxAziTmp, i_mult( 181, (Word16) L_shr( idxEleTmp, Q22 ) ) ); /* Setting the nan flag to 0 */ - vtxArray[pos].isNaN = 0; + vtxArray[pos].isNaN = 0; move16(); /* Set the default downmix type */ vtxArray[pos].dmxType = dmxType; @@ -3070,7 +3072,7 @@ static Word32 point_plane_distance_fx( // returns output in Q28 /* Dot Product */ tmpNorm = dotp_fixed( resultCross, resultCross, 3 ); // Q27 - Word16 exp = 4; + Word16 exp = 4; move16(); tmpNorm = ISqrt32( tmpNorm, &exp ); // Q29 v_sub_fixed( X, P1, tmpDot1, 3, 1 ); // Q30 v_multc_fixed( resultCross, tmpNorm, tmpDot2, 3 ); // Q29 - exp @@ -3255,7 +3257,7 @@ static Word16 get_neighbours_fx( mvs2s( triArray[i].LS, tmpTriArray[i].LS, 3 ); } - k = 0; + k = 0; move16(); WHILE( 1 ) { IF( EQ_16(find_int_in_tri_fx( tmpTriArray, vtxIdx, numTri, tmpPos ), 0 ) ) @@ -3282,7 +3284,7 @@ static Word16 get_neighbours_fx( /* Creating the output vector, by eliminating redundancies and also deleting the indice == vtxIdx*/ neighbours[0] = tmpNeighbours[0]; - j = 1; + j = 1; move16(); FOR( i = 1; i < k; ++i ) { @@ -3444,12 +3446,12 @@ static void tri_to_poly_fx( Word32 dist; - lenPolySet = 0; + lenPolySet = 0; move16(); /* Sorting the polygons */ FOR( i = 0; i < numTri; ++i ) { /* search for coplanar vertices and add them to the polygon */ - lenPoly = 0; + lenPoly = 0; move16(); FOR( j = 0; j < numVtx; ++j ) { dist = L_abs( point_plane_distance_fx( @@ -3467,8 +3469,8 @@ static void tri_to_poly_fx( } /* search existing polygons to determine whether the new one already exists/is a subset or is a superset */ - found = 0; - replaceIdx = -1; + found = 0; move16(); + replaceIdx = -1; move16(); FOR( j = 0; j < lenPolySet; ++j ) { found = compare_poly_fx( sortedChan[j], sortedLengths[j], poly, lenPoly ); @@ -3507,7 +3509,7 @@ static void tri_to_poly_fx( } /* Output */ - *outLengthPS = lenPolySet; + *outLengthPS = lenPolySet; move16(); mvs2s( sortedLengths, outLengthSorted, EFAP_MAX_POLY_SET ); return; } @@ -3621,7 +3623,7 @@ static Word16 compare_poly_fx( Word16 i, j; Word16 count; - count = 0; + count = 0; move16(); FOR( i = 0; i < lenOld; ++i ) { @@ -3828,7 +3830,7 @@ static void sort_channels_vertex_fx( /* First Base Vector */ v_sub_fixed( P2, P1, tmpU, 3, 1 ); // tmpU Q30 - Word16 exp1 = 2; + Word16 exp1 = 2; move16(); normU = ISqrt32( dotp_fixed( tmpU, tmpU, 3 ), &exp1 ); // normU = L_shl_sat( normU, exp ); //normU Q31 v_multc_fixed( tmpU, normU, U, 3 ); // U Q30 - exp1 @@ -3843,7 +3845,7 @@ static void sort_channels_vertex_fx( } v_sub_fixed( tmpV1, tmpV2, tmpV3, 3, 0 ); // tmpV3 Q30 - Word16 exp2 = 2; + Word16 exp2 = 2; move16(); normV = ISqrt32( dotp_fixed( tmpV3, tmpV3, 3 ), &exp2 ); v_multc_fixed( tmpV3, normV, V, 3 ); // V Q30 - exp2 @@ -4001,7 +4003,7 @@ static Word16 get_poly_num_fx( Word32 dist_tmp; Word32 pos[3]; - num_poly = 0; + num_poly = 0; move16(); sph2cart_fx( P[0], P[1], &pos[0] ); @@ -4030,8 +4032,8 @@ static Word16 get_poly_num_fx( } /* select the polygon with the smallest distance */ - found_poly = poly_tmp[0]; - dist_tmp = poly_dist[0]; + found_poly = poly_tmp[0]; move16(); + dist_tmp = poly_dist[0]; move16(); FOR( i = 1; i < num_poly; i++ ) { IF( LT_32( poly_dist[i], dist_tmp ) ) @@ -4145,11 +4147,11 @@ static Word16 in_poly_fx( /* Angles are in Q22 */ IF( poly.isNaN[0] ) { - A[0] = P[0]; + A[0] = P[0]; move32(); } ELSE { - A[0] = poly.polyAzi[0]; + A[0] = poly.polyAzi[0]; move32(); } A[1] = poly.polyEle[0]; @@ -4304,20 +4306,20 @@ static Word16 in_tri_fx( { FOR( Word32 j = 0; j < 2; j++ ) { - matInv_exp[i][j] = 31; + matInv_exp[i][j] = 31; move16(); IF( NE_32( matInv[i][j], 0 ) ) { matInv_exp[i][j] = norm_l( matInv[i][j] ); } } - matInv_exp_final[i] = min( matInv_exp[i][0], matInv_exp[i][1] ); - P_minus_A_exp[i] = 31; + matInv_exp_final[i] = s_min( matInv_exp[i][0], matInv_exp[i][1] ); + P_minus_A_exp[i] = 31; move16(); IF( NE_32( P_minus_A[i], 0 ) ) { P_minus_A_exp[i] = norm_l( P_minus_A[i] ); } } - P_minus_A_exp_final = min( P_minus_A_exp[0], P_minus_A_exp[1] ); + P_minus_A_exp_final = s_min( P_minus_A_exp[0], P_minus_A_exp[1] ); S[0] = L_add( L_shr( Mpy_32_32( L_shl( matInv[0][0], matInv_exp_final[0] ), L_shl( P_minus_A[0], P_minus_A_exp_final ) ), Q1 ), L_shr( Mpy_32_32( L_shl( matInv[0][1], matInv_exp_final[0] ), L_shl( P_minus_A[1], P_minus_A_exp_final ) ), Q1 ) ); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 172c4d30c..d869e2df8 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -884,9 +884,9 @@ ivas_error ivas_orient_trk_Init_fx( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - identity_fx.w_fx = ONE_IN_Q31; - identity_fx.x_fx = identity_fx.y_fx = identity_fx.z_fx = 0; - identity_fx.q_fact = Q31; + identity_fx.w_fx = ONE_IN_Q31; move32(); + identity_fx.x_fx = identity_fx.y_fx = identity_fx.z_fx = 0; move32(); move32(); + identity_fx.q_fact = Q31; move16(); /* configuration parameters */ pOTR->centerAdaptationRate_fx = C_ADP_RATE_Q31; @@ -898,8 +898,8 @@ ivas_error ivas_orient_trk_Init_fx( /* initial adaptivity filter coefficient, will be auto-adapted */ // pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ - pOTR->alpha_fx = 33731208; // Q31 - pOTR->Q_alpha = Q31; + pOTR->alpha_fx = 33731208; move32();// Q31 + pOTR->Q_alpha = Q31; move16(); pOTR->trkRot = identity_fx; pOTR->absAvgRot = identity_fx; /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ @@ -1336,7 +1336,7 @@ ivas_error ivas_orient_trk_Process_fx( Word32 rateRange_fx; Word32 cutoffFrequency_fx, cutoff_prod; Word16 q_cutoff_prod = 0; - Word32 alpha_fx = L_shl( pOTR->alpha_fx, Q30 - pOTR->Q_alpha ); + Word32 alpha_fx = L_shl( pOTR->alpha_fx, sub(Q30, pOTR->Q_alpha) ); IF( pOTR == NULL || pTrkRot == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -1359,9 +1359,9 @@ ivas_error ivas_orient_trk_Process_fx( Word32 div; div = L_deposit_h( BASOP_Util_Divide3232_Scale( pOTR->centerAdaptationRate_fx, updateRate_fx, &scale_e ) ); - scale_e = scale_e - 8; // e+e1-e2// + scale_e = sub(scale_e, 8); // e+e1-e2// // here div value is less so we can use sandwitch rule of sine// - pOTR->alpha_fx = div; + pOTR->alpha_fx = div; move32(); /* Compute relative orientation = (absolute orientation) - (reference orientation) */ QuaternionInverse_fx( pOTR->refRot, &pOTR->trkRot ); QuaternionProduct_fx( pOTR->trkRot, absRot, &pOTR->trkRot ); @@ -1373,18 +1373,16 @@ ivas_error ivas_orient_trk_Process_fx( /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ QuaternionInverse_fx( pOTR->absAvgRot, &pOTR->trkRot ); - Word32 angle_fx, relativeOrientationRate_fx = 0; + Word32 angle_fx, relativeOrientationRate_fx = 0; move32(); QuaternionProduct_fx( pOTR->trkRot, absRot, &pOTR->trkRot ); angle_fx = QuaternionAngle_fx( absRot, pOTR->trkRot ); // Q29 - Word16 result_e = 0; + Word16 result_e = 0; move16(); Word16 temp_result = BASOP_Util_Divide3232_Scale( angle_fx, pOTR->adaptationAngle_fx, &result_e ); relativeOrientationRate_fx = L_deposit_h( temp_result ); - Word32 one_fx = 1073741824; - Word16 temp = 1; - f2me( 1.0, &one_fx, &temp ); + Word32 one_fx = 1073741824; move32(); IF( GT_32( relativeOrientationRate_fx, one_fx ) ) { - relativeOrientationRate_fx = 1; + relativeOrientationRate_fx = 1; move32(); } /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ @@ -1392,29 +1390,29 @@ ivas_error ivas_orient_trk_Process_fx( /* 'if' assumed to perform comparison to 0 */ IF( GT_32( 0, rateRange_fx ) ) { - rateRange_fx = 0; + rateRange_fx = 0;move32(); } - IF( relativeOrientationRate_fx == 1 ) + IF( EQ_32(relativeOrientationRate_fx, 1 )) { - cutoff_prod = rateRange_fx; - q_cutoff_prod = Q31; + cutoff_prod = rateRange_fx;move32(); + q_cutoff_prod = Q31; move16(); } ELSE { cutoff_prod = Mpy_32_32( relativeOrientationRate_fx, rateRange_fx ); - q_cutoff_prod = Q31 + ( 31 - result_e ) - 31; + q_cutoff_prod = add(Q31, sub(sub( 31, result_e ), 31)); } Word16 temp_diff; - temp_diff = 31 - q_cutoff_prod; + temp_diff = sub(31, q_cutoff_prod); cutoff_prod = L_shl( cutoff_prod, temp_diff ); /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ cutoffFrequency_fx = L_add( pOTR->centerAdaptationRate_fx, cutoff_prod ); cutoff_prod = Mpy_32_32( cutoffFrequency_fx, PI2_C_Q28 ); - q_cutoff_prod = 31 + 28 - 31; + q_cutoff_prod = sub(add(31, 28), 31); temp_result = BASOP_Util_Divide3232_Scale( cutoff_prod, updateRate_fx, &result_e ); - result_e = result_e + ( 23 - q_cutoff_prod ); + result_e = add(result_e, sub( 23, q_cutoff_prod )); pOTR->alpha_fx = L_deposit_h( temp_result ); - pOTR->Q_alpha = Q31 - result_e; + pOTR->Q_alpha = sub(Q31, result_e); BREAK; default: result = IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ebb3e8c4b..6cdabb683 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -355,11 +355,12 @@ void ivas_masa_ext_rend_parambin_render( float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t num_subframes /* i : number of subframes to render */ ); +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ ); -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_dirac_dec_init_binaural_data_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index b85a8cce1..01e97442f 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -399,9 +399,11 @@ static void ivas_binaural_reverb_setReverbTimes_fx( Word16 tmp, tmp_exp, diffuseFieldICC_exp, scale, tmpVal_exp, attenuationFactorPerSample_exp, attenuationFactorPerSampleSq_exp, energyBuildup_exp, currentEnergy_exp, intendedEnergy_exp, actualizedEnergy_exp; Word16 sine_inp, norm, sub_res, sub_exp, div_exp1, div1, sine, binCenterFreq_exp; Word16 reverb_exp = 0; + move16(); hReverb->binRend_RandNext = (UWord16) BIN_REND_RANDOM_SEED; hReverb->highestBinauralCoherenceBin = 0; + move16(); FOR ( bin = 0; bin < hReverb->numBins; bin++ ) { @@ -409,32 +411,34 @@ static void ivas_binaural_reverb_setReverbTimes_fx( Word16 exp; tmp_exp = BASOP_Util_Add_MantExp(bin, 15, 1, 14, &tmp); tmp = BASOP_Util_Divide3232_Scale(L_deposit_h(tmp), L_deposit_h(hReverb->numBins), &exp); - exp = exp + ( tmp_exp - 15); + exp = add( exp, sub( tmp_exp, 15) ); L_tmp = Mpy_32_16_1(output_Fs, tmp); - binCenterFreq_exp = 31 + exp; + binCenterFreq_exp = sub(31, exp); binCenterFreq_fx = L_shr(L_tmp, 1); // divide by 2 - IF ( bin == 0 ) + IF ( EQ_16( bin, 0 ) ) { diffuseFieldICC_fx = 1073741824; // 2 ^ 30, Q30 + move32(); diffuseFieldICC_exp = 1; + move16(); } ELSE IF ( BASOP_Util_Cmp_Mant32Exp(binCenterFreq_fx, binCenterFreq_exp, 2700, 31 ) == -1) { tmp = BASOP_Util_Divide3232_Scale(binCenterFreq_fx, 550, &scale); - exp = scale + ( binCenterFreq_exp - 31 ); + exp = add( scale, sub( binCenterFreq_exp, 31 ) ); tmp = add(mult(EVS_PI_FX, tmp), EPSILLON_FX); // to avoid divide by 0 issue - tmp_exp = exp + 2; + tmp_exp = add( exp, 2 ); - sine_inp = wrap_rad_fixed(L_shl(tmp, tmp_exp - 2)); + sine_inp = wrap_rad_fixed(L_shl(tmp, sub( tmp_exp, 2))); sine = getSinWord16(sine_inp); // Q15 div1 = BASOP_Util_Divide1616_Scale(sine, tmp, &scale); - div_exp1 = scale + ( 0 - tmp_exp); + div_exp1 = add( scale, sub( 0, tmp_exp)); tmp = BASOP_Util_Divide3232_Scale(binCenterFreq_fx, 2700, &scale); - scale = scale + (binCenterFreq_exp - 31); + scale = add(scale, sub(binCenterFreq_exp, 31)); - L_tmp = L_sub(L_shl(1, (15 - scale)), tmp); + L_tmp = L_sub(L_shl(1, sub(15, scale)), tmp); norm = norm_l(L_tmp); L_tmp = L_shl(L_tmp, norm); @@ -442,15 +446,18 @@ static void ivas_binaural_reverb_setReverbTimes_fx( sub_exp = sub(scale, sub(norm, 16)); diffuseFieldICC_fx = L_deposit_h(mult(sub_res, div1)); - diffuseFieldICC_exp = div_exp1 + sub_exp; + diffuseFieldICC_exp = add(div_exp1, sub_exp); hReverb->highestBinauralCoherenceBin = bin; + move16(); } ELSE { diffuseFieldICC_fx = 0; + move32(); diffuseFieldICC_exp = 0; + move16(); } /* Mixing gains to generate a diffuse-binaural sound based on incoherent sound */ @@ -481,9 +488,9 @@ static void ivas_binaural_reverb_setReverbTimes_fx( L_tmp = Mpy_32_32(1677721600, revTimes_fx[bin]); // e10 --> 800 * 2^21, + e0 tmp = BASOP_Util_Divide3232_Scale(1073741824, L_tmp, &scale); - scale = scale + ( 1 - 10 ); + scale = add(scale, sub( 1, 10 )); L_tmp = Mpy_32_16_1(-1610612736, tmp); // * -3 - scale = 2 + scale; + scale = add( 2, scale ); L_tmp = Mpy_32_32(1783446563, L_tmp); // scale + 2 attenuationFactorPerSample_fx = BASOP_util_Pow2(L_tmp, scale + 2, &attenuationFactorPerSample_exp ); @@ -491,7 +498,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( scale = norm_l(hReverb->loopBufLength[bin]); tmp_mul = L_shl(hReverb->loopBufLength[bin], scale); L_tmp = BASOP_Util_Log2( attenuationFactorPerSample_fx ); - L_tmp = L_add(L_tmp, attenuationFactorPerSample_exp * (1 << 25)); + L_tmp = L_add(L_tmp, L_shl( attenuationFactorPerSample_exp, 25)); L_tmp = Mpy_32_32(L_tmp, tmp_mul); hReverb->loopAttenuationFactor_fx[bin] = BASOP_util_Pow2(L_tmp, 6 + 31 - scale, &exp); hReverb->loopAttenuationFactor_fx[bin] = L_shl(hReverb->loopAttenuationFactor_fx[bin], exp); // making as Q31 @@ -503,19 +510,28 @@ static void ivas_binaural_reverb_setReverbTimes_fx( * may affect the spectrum of the output. The spectral effect is therefore monitored and compensated for. */ intendedEnergy_fx = 0; + move32(); intendedEnergy_exp = 0; + move16(); actualizedEnergy_fx = 0; + move32(); actualizedEnergy_exp = 0; + move16(); FOR ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { energyBuildup_fx = 0; + move32(); energyBuildup_exp = 0; + move16(); currentEnergy_fx = 1073741824; + move32(); currentEnergy_exp = 1; + move16(); tap = 0; + move16(); FOR ( sample = 0; sample < hReverb->loopBufLength[bin]; sample++ ) { @@ -533,7 +549,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( { IF(BASOP_Util_Cmp_Mant32Exp(energyBuildup_fx, energyBuildup_exp, 1, 31) >= 0) { /* Four efficient phase operations: n*pi/2, n=0,1,2,3 */ - hReverb->tapPhaseShiftType[bin][ch][tap] = (int16_t)(binRend_rand(hReverb) % 4); + hReverb->tapPhaseShiftType[bin][ch][tap] = (Word16)(binRend_rand(hReverb) % 4); /* Set the tapPointer to point to the determined sample at the loop buffer */ hReverb->tapPointersReal_fx[bin][ch][tap] = &(hReverb->loopBufReal_fx[bin][sample]); @@ -541,7 +557,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( energyBuildup_fx = BASOP_Util_Add_Mant32Exp(energyBuildup_fx, energyBuildup_exp, L_negate(1073741824), 1, &energyBuildup_exp); /* A tap is added, thus remove its energy from the buildup */ - tap++; + tap = add( tap, 1); actualizedEnergy_fx = BASOP_Util_Add_Mant32Exp(actualizedEnergy_fx, actualizedEnergy_exp, 1073741824, 1, &actualizedEnergy_exp); } @@ -553,26 +569,28 @@ static void ivas_binaural_reverb_setReverbTimes_fx( } hReverb->taps[bin][ch] = tap; /* Number of taps determined at the above random procedure */ + move16(); } /* The decorrelator design and IIR attenuation rate affects the energy of reverb, which is compensated here */ reverb_exp = 0; + move16(); hReverb->reverbEqGains_fx[bin] = Sqrt32(revEnes_fx[bin], &reverb_exp); /* Determined reverb spectrum */ hReverb->reverbEqGains_fx[bin] = BASOP_Util_Add_Mant32Exp(hReverb->reverbEqGains_fx[bin], reverb_exp, 0, 0, &reverb_exp); tmp = BASOP_Util_Divide3232_Scale(intendedEnergy_fx, actualizedEnergy_fx, &tmp_exp); - tmp_exp = tmp_exp + (intendedEnergy_exp - actualizedEnergy_exp); + tmp_exp = add(tmp_exp, sub(intendedEnergy_exp, actualizedEnergy_exp)); hReverb->reverbEqGains_fx[bin] = BASOP_Util_Add_Mant32Exp(hReverb->reverbEqGains_fx[bin], reverb_exp, 0, 0, &reverb_exp); L_tmp = Sqrt32(L_deposit_h(tmp), &tmp_exp); hReverb->reverbEqGains_fx[bin] = Mpy_32_32(hReverb->reverbEqGains_fx[bin], L_tmp); - reverb_exp = reverb_exp + tmp_exp; + reverb_exp = add(reverb_exp, tmp_exp); L_tmp = BASOP_Util_Add_Mant32Exp(1073741824, 1, L_negate(attenuationFactorPerSampleSq_fx), attenuationFactorPerSampleSq_exp, &tmp_exp); L_tmp = Mpy_32_32(L_tmp, 1073741824); // tmp_exp + 1 - tmp_exp = tmp_exp + 0; + tmp_exp = add(tmp_exp, 0); L_tmp = Sqrt32(L_tmp, &tmp_exp); hReverb->reverbEqGains_fx[bin] = Mpy_32_32(L_tmp, hReverb->reverbEqGains_fx[bin]); - reverb_exp = reverb_exp + tmp_exp; + reverb_exp = add( reverb_exp, tmp_exp ); hReverb->reverbEqGains_fx[bin] = L_shl(hReverb->reverbEqGains_fx[bin], reverb_exp); // making as Q31 } return; @@ -603,8 +621,11 @@ static ivas_error compute_feedback_matrix_fx( FOR( j = 0; j < x; j++ ) { pFeedbackMatrix[( i + x ) * n + j] = pFeedbackMatrix[i * n + j]; + move32(); pFeedbackMatrix[i * n + j + x] = pFeedbackMatrix[i * n + j]; + move32(); pFeedbackMatrix[( i + x ) * n + j + x] = -pFeedbackMatrix[i * n + j]; + move32(); } } } @@ -628,11 +649,15 @@ static void compute_2_out_extract_matrix_fx( Word16 i; ff = 1; + move16(); + FOR( i = 0; i < n; i++ ) { pExtractMatrix[i] = 1; + move16(); pExtractMatrix[i + n] = ff; - ff = -ff; + move16(); + ff = negate(ff); } return; @@ -921,11 +946,13 @@ static void calc_predelay_fx( IF ( LT_16(predelay , 0) ) { predelay = 0; + move16(); } IF ( LT_16(output_frame , predelay) ) { predelay = output_frame; + move16(); } pParams->pre_delay = predelay; @@ -986,17 +1013,19 @@ static ivas_error compute_t60_coeffs_fx( Word16 target_gains_db_exp[RV_LENGTH_NR_FC]; error = IVAS_ERR_OK; tf_T60_len = nr_fc_fft_filter; - len = pParams->t60_filter_order + 1; + move16(); + len = add( pParams->t60_filter_order, 1 ); pFc_fx = pParams->pFc_fx; targetT60_fx = pParams->pRt60_fx; targetT60_e = pParams->pRt60_e; + move16(); FOR (bin_idx = 0; bin_idx < tf_T60_len; bin_idx++) { norm_f_fx[bin_idx] = BASOP_Util_Divide3232_Scale(pFc_fx[bin_idx], freq_Nyquist_fx, &norm_f_e); - norm_f_e = norm_f_e + (17 - 31); - norm_f_fx[bin_idx] = shl(norm_f_fx[bin_idx], norm_f_e - 1); // making Q14 + norm_f_e = add( norm_f_e, sub( 17, 31 ) ); + norm_f_fx[bin_idx] = shl(norm_f_fx[bin_idx], sub( norm_f_e, 1) ); // making Q14 } FOR ( loop_idx = 0; loop_idx < pParams->nr_loops; loop_idx++ ) @@ -1010,12 +1039,14 @@ static ivas_error compute_t60_coeffs_fx( tmp = BASOP_Util_Divide3232_Scale(L_deposit_h(loop_delay_sec_fx), targetT60_fx[bin_idx], &target_gains_db_exp[bin_idx]); target_gains_db_exp[bin_idx] = target_gains_db_exp[bin_idx] + (loop_delay_sec_fx_exp - targetT60_e[bin_idx]); target_gains_db_fx[bin_idx] = mult( -30720, tmp ); // -60 in Q9 -> -30720 - target_gains_db_exp[bin_idx] = target_gains_db_exp[bin_idx] + 6; // Q9 -> e6 + target_gains_db_exp[bin_idx] = add( target_gains_db_exp[bin_idx], 6 ); // Q9 -> e6 tmp = BASOP_Util_Cmp_Mant32Exp( L_deposit_h(target_gains_db_fx[bin_idx]), target_gains_db_exp[bin_idx], -2013265920, 7); IF (tmp < 0) { target_gains_db_fx[bin_idx] = -30720; + move16(); target_gains_db_exp[bin_idx] = 7; + move16(); } } @@ -1023,6 +1054,7 @@ static ivas_error compute_t60_coeffs_fx( pCoeffs_b_fx = &pParams->pT60_filter_coeff_fx[2 * len * loop_idx]; Word16 val = target_gains_db_exp[0]; + move16(); FOR (Word16 i = 1; i < nr_fc_fft_filter; i++) { val = s_max(val, target_gains_db_exp[i]); @@ -1038,10 +1070,10 @@ static ivas_error compute_t60_coeffs_fx( } } - len = ( pParams->t60_filter_order + 1 ) >> 1; /* == floor( (order+1) / 2) */ + len = shr( ( add( pParams->t60_filter_order, 1 ) ), 1 ); /* == floor( (order+1) / 2) */ FOR ( loop_idx = 0; loop_idx < pParams->nr_loops; loop_idx++ ) { - pParams->pLoop_delays[loop_idx] -= len; + pParams->pLoop_delays[loop_idx] = sub( pParams->pLoop_delays[loop_idx], len ); } return error; } @@ -1166,7 +1198,7 @@ static void calc_low_shelf_first_order_filter_fx( cos_val = getCosWord16(shl(tmp, 1)); // Q14 tan_val = BASOP_Util_Divide1616_Scale(sine_val, cos_val, &tan_exp); - tan_exp = tan_exp + (0 - 1); + tan_exp = add( tan_exp, sub(0, 1) ); Word16 gain_fx; gain_fx = BASOP_Util_Divide1616_Scale(lin_gain_lf, lin_gain_hf, &gain_exp); @@ -1175,21 +1207,23 @@ static void calc_low_shelf_first_order_filter_fx( { tmp = mult(tan_val, gain_fx); - norm_num0 = tan_exp + gain_exp; + norm_num0 = add( tan_exp, gain_exp ); L_tmp = L_add(L_shl(1, sub( 15, norm_num0) ), tmp); shift = norm_l(L_tmp); L_tmp = L_shl(L_tmp, shift); tmp = extract_h(L_tmp); pNum[0] = tmp; + move16(); norm_num0 = sub( norm_num0, sub(shift, 16) ); tmp = mult(tan_val, gain_fx); - norm_num1 = tan_exp + gain_exp; + norm_num1 = add( tan_exp, gain_exp ); L_tmp = L_sub(tmp, L_shl(1, sub(15, norm_num1))); shift = norm_l(L_tmp); L_tmp = L_shl(L_tmp, shift); tmp = extract_h(L_tmp); pNum[1] = tmp; + move16(); norm_num1 = sub( norm_num1, sub(shift, 16) ); L_tmp = L_add(L_shl(1, sub( 15, tan_exp) ), tan_val); @@ -1197,6 +1231,7 @@ static void calc_low_shelf_first_order_filter_fx( L_tmp = L_shl(L_tmp, shift); tmp = extract_h(L_tmp); pDen[0] = tmp; + move16(); norm_den0 = sub( tan_exp, sub(shift, 16 ) ); L_tmp = L_sub(tan_val, L_shl(1, sub( 15, tan_exp ) ) ); @@ -1204,6 +1239,7 @@ static void calc_low_shelf_first_order_filter_fx( L_tmp = L_shl(L_tmp, shift); tmp = extract_h(L_tmp); pDen[1] = tmp; + move16(); norm_den1 = sub(tan_exp, sub(shift, 16)); } ELSE @@ -1361,29 +1397,38 @@ static ivas_error calc_jot_t60_coeffs_fx( Word16 f0_fx, tmp_fx, lf_target_gain_dB_fx, hf_target_gain_dB_fx, mid_crossing_gain_dB_fx; Word16 lin_gain_lf_fx, lin_gain_hf_fx, shift, expl, exph; int16_t f_idx, e = pH_dB_exp; + move16(); uint16_t n_points_lf, n_points_hf; lf_target_gain_dB_fx = 0; + move16(); hf_target_gain_dB_fx = 0; + move16(); Word32 minval_fx = 1455191552; + move32(); Word16 minval_e = 67, exp; + move16(); Word32 L_tmpl = 0, L_tmph = 0; + move32(); + move32(); n_points_lf = 0; + move16(); n_points_hf = 0; - Word16 minidx_fx = nrFrequencies - 1; + move16(); + Word16 minidx_fx = sub( nrFrequencies, 1 ); FOR ( f_idx = 0; f_idx < nrFrequencies; f_idx++ ) { IF( GE_16( pFrequencies_fx[f_idx], ref_lf_min_norm_fx ) && LE_16( pFrequencies_fx[f_idx], ref_lf_max_norm_fx ) ) { L_tmpl = L_add( L_tmpl, pH_dB_fx[f_idx] ); - n_points_lf++; + n_points_lf = add(n_points_lf, 1); } IF( GE_16( pFrequencies_fx[f_idx], ref_hf_min_norm_fx ) && LE_16( pFrequencies_fx[f_idx], ref_hf_max_norm_fx ) ) { L_tmph = L_add(L_tmph, pH_dB_fx[f_idx]); - n_points_hf++; + n_points_hf = add(n_points_hf, 1); } } shift = norm_l(L_tmpl); @@ -1404,10 +1449,10 @@ static ivas_error calc_jot_t60_coeffs_fx( } lf_target_gain_dB_fx = BASOP_Util_Divide1616_Scale( lf_target_gain_dB_fx, n_points_lf, &e ); - expl = e + (expl - 15 ); + expl = add( e, sub(expl, 15 )); hf_target_gain_dB_fx = BASOP_Util_Divide1616_Scale(hf_target_gain_dB_fx, n_points_hf, &e); - exph = e + ( exph - 15 ); + exph = add( e, sub( exph, 15 )); e = BASOP_Util_Add_MantExp(lf_target_gain_dB_fx, expl, negate( hf_target_gain_dB_fx ), exph, &tmp_fx); exp = BASOP_Util_Add_MantExp(hf_target_gain_dB_fx, exph, tmp_fx, e - 1, &mid_crossing_gain_dB_fx); @@ -1424,11 +1469,14 @@ static ivas_error calc_jot_t60_coeffs_fx( { minval_fx = L_deposit_h(tmp1); minval_e = e; + move16(); minidx_fx = f_idx; + move16(); } } f0_fx = pFrequencies_fx[minidx_fx]; + move16(); tmp_fx = mult(lf_target_gain_dB_fx, 5443); // expl L_tmp = BASOP_util_Pow2(L_deposit_h(tmp_fx), expl, &e); @@ -1436,7 +1484,7 @@ static ivas_error calc_jot_t60_coeffs_fx( tmp_fx = mult(hf_target_gain_dB_fx, 5443); // exph L_tmp = BASOP_util_Pow2(L_deposit_h(tmp_fx), exph, &e); - lin_gain_hf_fx = (Word16)L_shr(L_tmp, 16 - e); + lin_gain_hf_fx = (Word16)L_shr(L_tmp, sub(16, e)); /* call low-pass iir shelf */ calc_low_shelf_first_order_filter_fx( pCoeffB_fx, pCoeffA_fx, f0_fx, lin_gain_lf_fx, lin_gain_hf_fx ); @@ -1796,7 +1844,7 @@ static ivas_error set_mixer_level_fx( const UWord16 channel, const Word16 level[] ) { - uint16_t branch_idx; + UWord16 branch_idx; IF ( channel >= BINAURAL_CHANNELS ) { return IVAS_ERR_INTERNAL; @@ -1827,6 +1875,7 @@ static void clear_buffers_fx( delay_line = &( hReverb->delay_line[branch_idx] ); set_val_Word32( delay_line->pBuffer_fx, 0, delay_line->MaxDelay ); delay_line->BufferPos = 0; + move16(); iirFilter = &( hReverb->t60[branch_idx] ); set_val_Word32( iirFilter->pBuffer_fx, 0, iirFilter->MaxTaps ); @@ -1851,17 +1900,23 @@ static void set_fft_and_datablock_sizes_fx( IF( EQ_16( subframe_len, 240 /*L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES*/ ) ) { hReverb->fft_size = IVAS_REVERB_FFT_SIZE_48K; + move16(); hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_48K; + move16(); } ELSE IF( EQ_16( subframe_len, 160 /*L_FRAME32k / MAX_PARAM_SPATIAL_SUBFRAMES*/ ) ) { hReverb->fft_size = IVAS_REVERB_FFT_SIZE_32K; + move16(); hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_32K; + move16(); } ELSE IF( EQ_16( subframe_len, 80 /*L_FRAME16k / MAX_PARAM_SPATIAL_SUBFRAMES*/ ) ) { hReverb->fft_size = IVAS_REVERB_FFT_SIZE_16K; + move16(); hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_16K; + move16(); } ELSE { @@ -2053,7 +2108,7 @@ static void set_reverb_acoustic_data_fx( { L_tmp = Mpy_32_32(pRt60_fx[bin_idx], ln_1e6_inverted_fx ); // exp = pRt60_e[bin_idx] + 0 exp_argument_fx = BASOP_Util_Divide3232_Scale(delay_diff_fx, L_tmp, &exp_argument_e); - exp_argument_e = exp_argument_e + (4 - pRt60_e[bin_idx]); // Q27 -> e4 + exp_argument_e = add( exp_argument_e, sub(4, pRt60_e[bin_idx])); // Q27 -> e4 /* Limit exponent to approx +/-100 dB in case of incoherent value of delay_diff, to prevent overflow */ // 23 in Q26 @@ -2085,10 +2140,12 @@ static void set_reverb_acoustic_data_fx( tmp_exp = add( exp_argument_e, 1 ); L_tmp = BASOP_util_Pow2(L_deposit_h(tmp), tmp_exp, &pow_exp); L_tmp = Mpy_32_32( L_tmp, pDsr_fx[bin_idx] ); - tmp_exp = tmp_exp + pDsr_e[bin_idx]; + tmp_exp = add( tmp_exp, pDsr_e[bin_idx] ); pDsr_fx[bin_idx] = L_tmp; + move32(); pDsr_e[bin_idx] = tmp_exp; + move16(); } return; @@ -2194,7 +2251,9 @@ static ivas_error setup_FDN_branches_fx( ivas_rev_delay_line_init( &( hReverb->delay_line[branch_idx] ), hReverb->loop_delay_buffer_fx[branch_idx], init_loop_delay[branch_idx], pParams->pLoop_delays[branch_idx] ); ivas_reverb_iir_filt_init( &( hReverb->t60[branch_idx] ), IVAS_REV_MAX_IIR_FILTER_LENGTH ); hReverb->mixer_fx[0][branch_idx] = 0; + move16(); hReverb->mixer_fx[1][branch_idx] = 0; + move16(); } clear_buffers_fx( hReverb ); nr_coefs = add(pParams->t60_filter_order , 1); @@ -2334,6 +2393,7 @@ ivas_error ivas_reverb_open_fx( output_frame = extract_l(Mult_32_16( output_Fs , INV_FRAME_PER_SEC_Q15)); subframe_len = shr(output_frame , 2); /*output_frame / MAX_PARAM_SPATIAL_SUBFRAMES*/ predelay_bf_len = output_frame; + move16(); nr_fc_input = hRenderConfig->roomAcoustics.nBands; /* Allocate main reverb. handle */ @@ -2363,6 +2423,7 @@ ivas_error ivas_reverb_open_fx( } pState->nr_of_branches = IVAS_REV_MAX_NR_BRANCHES; + move16(); set_fft_and_datablock_sizes_fx( pState, subframe_len ); nr_fc_fft_filter = add( extract_l( L_shr( pState->fft_size, 1 ) ), 1 ); @@ -2401,7 +2462,7 @@ ivas_error ivas_reverb_open_fx( set_reverb_acoustic_data_fx( ¶ms, input_audio_config, hHrtf, &hRenderConfig->roomAcoustics, subframe_len, nr_fc_input, nr_fc_fft_filter ); Scale_sig32( params.pFc_fx, nr_fc_fft_filter, -2 ); - for ( int i = 0; i < nr_fc_fft_filter; i++ ) + FOR ( Word16 i = 0; i < nr_fc_fft_filter; i++ ) { params.pRt60_fx[i] = L_abs(params.pRt60_fx[i]); params.pDsr_fx[i] = L_abs(params.pDsr_fx[i]); @@ -2432,8 +2493,8 @@ ivas_error ivas_reverb_open_fx( /* Compute target levels (gains) for the coloration filters */ Word32 *pHrtf_avg_pwr_response_l_const = (Word32*)malloc(nr_fc_fft_filter * sizeof(Word32*)); Word32 *pHrtf_avg_pwr_response_r_const = (Word32*)malloc(nr_fc_fft_filter * sizeof(Word32*)); - Word16 lenT60_filter_coeff = add(params.t60_filter_order, 1); - lenT60_filter_coeff = add(i_mult(shl(lenT60_filter_coeff, 1), sub(params.nr_loops, 1)), add(lenT60_filter_coeff, 2)); + Word16 lenT60_filter_coeff = add(params.t60_filter_order, 1); + lenT60_filter_coeff = add(i_mult(shl(lenT60_filter_coeff, 1), sub(params.nr_loops, 1)), add(lenT60_filter_coeff, 2)); Word32 *pT60_filter_coeff = (Word32*)malloc((lenT60_filter_coeff) * sizeof(Word32*)); @@ -2466,6 +2527,7 @@ ivas_error ivas_reverb_open_fx( /* === to be used for subsequent audio signal processing === */ pState->do_corr_filter = params.do_corr_filter; + move16(); /* clear & init jot reverb fft filters */ IF ( ( error = initialize_reverb_filters_fx( pState ) ) != IVAS_ERR_OK ) @@ -2476,7 +2538,9 @@ ivas_error ivas_reverb_open_fx( IF ( pState->do_corr_filter ) { q_pFft_wf_filter_ch0_fx = 31; + move16(); q_pFft_wf_filter_ch1_fx = 31; + move16(); /* Computing correlation filters on the basis of target IA coherence */ FOR (int i = 0; i < nr_fc_fft_filter; i++) { pFft_wf_filter_ch0_fx[i][0] = L_shl_sat(pFft_wf_filter_ch0_fx[i][0] , 8); @@ -2938,7 +3002,9 @@ static void reverb_block_fx( FOR( i = 0; i < inner_bsize; i++ ) { pO0[i] = 0; + move16(); pO1[i] = 0; + move16(); } /* feedback network: */ @@ -2963,7 +3029,7 @@ static void reverb_block_fx( FOR( ns = 0; ns < inner_bsize; ns++ ) { - pFeedback_input_fx[ns] = pIn[ns] >> 3; // to make the Qfactor similar to pOutput + pFeedback_input_fx[ns] = L_shr( pIn[ns], 3 ); // to make the Qfactor similar to pOutput } FOR( j = 0; j < nr_branches; j++ ) @@ -2985,8 +3051,8 @@ static void reverb_block_fx( // Applying guard bits for the DoRTFT inside the post_fft_filter function FOR( k = 0; k < hReverb->fft_filter_ols.block_size; k++ ) { - pOut0_fx[k] = (Word32) pOut0_fx[k] >> ( r_shift ); - pOut1_fx[k] = (Word32) pOut1_fx[k] >> ( r_shift ); + pOut0_fx[k] = (Word32) L_shr( pOut0_fx[k], ( r_shift ) ); + pOut1_fx[k] = (Word32) L_shr( pOut1_fx[k], ( r_shift ) ); } /* Applying FFT filter to each sub-frame */ FOR( blk_idx = 0; blk_idx < hReverb->num_fft_subblocks; blk_idx++ ) @@ -3632,7 +3698,7 @@ void ivas_binaural_reverb_processSubframe_fx( ) { /* Declare the required variables */ - int16_t idx, bin, ch, sample, invertSampleIndex, tapIdx, *phaseShiftTypePr; + Word16 idx, bin, ch, sample, invertSampleIndex, tapIdx, *phaseShiftTypePr; // float **tapRealPr, **tapImagPr; Word32 **tapRealPr_fx, **tapImagPr_fx; push_wmops( "binaural_reverb" ); @@ -3657,7 +3723,7 @@ void ivas_binaural_reverb_processSubframe_fx( idx = hReverb->preDelayBufferIndex; FOR( sample = 0; sample < numSlots; sample++ ) { - invertSampleIndex = numSlots - sample - 1; + invertSampleIndex = sub(sub( numSlots, sample ), 1 ); FOR( bin = 0; bin < hReverb->numBins; bin++ ) { @@ -3689,6 +3755,7 @@ void ivas_binaural_reverb_processSubframe_fx( idx = ( idx + 1 ) % hReverb->preDelayBufferLength; } hReverb->preDelayBufferIndex = idx; + move16(); /* 3) Perform the filtering/decorrelating, using complex and sparse FIR filtering */ FOR( bin = 0; bin < hReverb->numBins; bin++ ) @@ -3764,17 +3831,21 @@ void ivas_binaural_reverb_processSubframe_fx( FOR( sample = 0; sample < numSlots; sample++ ) { /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ - invertSampleIndex = numSlots - sample - 1; + invertSampleIndex = sub( sub( numSlots, sample ), 1 ); FOR( bin = 0; bin < hReverb->numBins; bin++ ) { outReal[ch][sample][bin] = hReverb->outputBufferReal_fx[bin][ch][invertSampleIndex]; // Q_in + Q30 + move32(); outImag[ch][sample][bin] = hReverb->outputBufferImag_fx[bin][ch][invertSampleIndex]; // Q_in + Q30 + move32(); } FOR( ; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) { outReal[ch][sample][bin] = 0; + move32(); outImag[ch][sample][bin] = 0; + move32(); } } } @@ -3800,10 +3871,10 @@ static ivas_error ivas_binaural_reverb_open_fx( const Word16 preDelay /* i : reverb pre-delay in CLDFB slots */ ) { - int16_t bin, chIdx, k, len; + Word16 bin, chIdx, k, len, scale, tmp; REVERB_STRUCT_HANDLE hReverb; - if ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) malloc( sizeof( REVERB_STRUCT ) ) ) == NULL ) + IF ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) malloc( sizeof( REVERB_STRUCT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } @@ -3811,26 +3882,35 @@ static ivas_error ivas_binaural_reverb_open_fx( hReverb = *hReverbPr; hReverb->useBinauralCoherence = 1; + move16(); hReverb->preDelayBufferLength = 1; + move16(); hReverb->preDelayBufferIndex = 0; + move16(); hReverb->numBins = numBins; + move16(); hReverb->blockSize = numCldfbSlotsPerFrame; + move16(); - for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) + FOR ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) { set32_fx( hReverb->preDelayBufferReal_fx[k], 0, hReverb->numBins ); set32_fx( hReverb->preDelayBufferImag_fx[k], 0, hReverb->numBins ); } - for ( bin = 0; bin < hReverb->numBins; bin++ ) + FOR ( bin = 0; bin < hReverb->numBins; bin++ ) { /* Loop Buffer */ - hReverb->loopBufLengthMax[bin] = (int16_t) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); - len = hReverb->loopBufLengthMax[bin] + hReverb->blockSize; + tmp = BASOP_Util_Divide1616_Scale(500, add(bin, 1), &scale); + tmp = shr(tmp, sub( 15, scale) ); + hReverb->loopBufLengthMax[bin] = add( tmp, sub( CLDFB_NO_CHANNELS_MAX, bin ) ); + //hReverb->loopBufLengthMax[bin] = (Word16) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); - if ( ( hReverb->loopBufReal_fx[bin] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) + len = add( hReverb->loopBufLengthMax[bin], hReverb->blockSize ); + + IF ( ( hReverb->loopBufReal_fx[bin] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } @@ -3849,36 +3929,38 @@ static ivas_error ivas_binaural_reverb_open_fx( Word32 L_tmp_BufLength = L_shl( L_shr( Mpy_32_32( revTimes_fx[bin], 1258291200 /*150.0 in Q23*/ ), 23 ), 23 ); L_tmp_BufLength = L_add( Mpy_32_32( 1556925645 /*1.45 in Q30*/, L_tmp_BufLength ), ONE_IN_Q22 ); hReverb->loopBufLength[bin] = (Word16) L_shr( L_tmp_BufLength, 22 ); - hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); + hReverb->loopBufLength[bin] = s_min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); /* Sparse Filter Tap Locations */ - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + FOR ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { len = hReverb->loopBufLength[bin]; + move16(); - if ( ( hReverb->tapPhaseShiftType[bin][chIdx] = (int16_t *) malloc( len * sizeof( int16_t ) ) ) == NULL ) + IF ( ( hReverb->tapPhaseShiftType[bin][chIdx] = (Word16 *) malloc( len * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } set_s( hReverb->tapPhaseShiftType[bin][chIdx], 0, len ); - if ( ( hReverb->tapPointersReal_fx[bin][chIdx] = (Word32 **) malloc( len * sizeof( Word32 * ) ) ) == NULL ) + IF ( ( hReverb->tapPointersReal_fx[bin][chIdx] = (Word32 **) malloc( len * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } - if ( ( hReverb->tapPointersImag_fx[bin][chIdx] = (Word32 **) malloc( len * sizeof( Word32 * ) ) ) == NULL ) + IF ( ( hReverb->tapPointersImag_fx[bin][chIdx] = (Word32 **) malloc( len * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } len = hReverb->blockSize; - if ( ( hReverb->outputBufferReal_fx[bin][chIdx] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) + move16(); + IF ( ( hReverb->outputBufferReal_fx[bin][chIdx] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } - if ( ( hReverb->outputBufferImag_fx[bin][chIdx] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) + IF ( ( hReverb->outputBufferImag_fx[bin][chIdx] = (Word32 *) malloc( len * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } @@ -3887,12 +3969,6 @@ static ivas_error ivas_binaural_reverb_open_fx( } } - /*Word32 *revTimes_fx = (Word32 *)malloc(sizeof(Word32) * hReverb->numBins); - Word32 *revEnes_fx = (Word32 *)malloc(sizeof(Word32) * hReverb->numBins); - FOR(int i = 0; i < hReverb->numBins; i++) { - revTimes_fx[i] = (Word32)(revTimes[i] * ONE_IN_Q31); - revEnes_fx[i] = (Word32)(revEnes[i] * ONE_IN_Q31); - }*/ ivas_binaural_reverb_setReverbTimes_fx( hReverb, sampling_rate, revTimes_fx, revEnes_fx ); /*free(revTimes_fx); @@ -4104,7 +4180,7 @@ ivas_error ivas_binaural_reverb_open_fastconv_fx( { return error; } - preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); + preDelay = (Word16) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); floatToFixed_arrL(t60_flt, t60, Q31, CLDFB_NO_CHANNELS_MAX); floatToFixed_arrL(ene_flt, ene, Q31, CLDFB_NO_CHANNELS_MAX); } @@ -4113,6 +4189,7 @@ ivas_error ivas_binaural_reverb_open_fastconv_fx( revTimes = hHrtfFastConv->fastconvReverberationTimes_fx; revEne = hHrtfFastConv->fastconvReverberationEneCorrections_fx; preDelay = 10; + move16(); } error = ivas_binaural_reverb_open_fx( hReverbPr, numBins, numCldfbSlotsPerFrame, sampling_rate, revTimes, revEne, preDelay ); @@ -4170,8 +4247,8 @@ ivas_error ivas_binaural_reverb_open_fastconv( #ifdef IVAS_FLOAT_FIXED ivas_error ivas_binaural_reverb_open_parambin( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ - const int16_t numBins, /* i : number of CLDFB bins */ - const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + const Word16 numBins, /* i : number of CLDFB bins */ + const Word16 numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ const int32_t sampling_rate, /* i : sampling rate */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ @@ -4182,7 +4259,7 @@ ivas_error ivas_binaural_reverb_open_parambin( const Word32 *revEne; Word32 t60[CLDFB_NO_CHANNELS_MAX]; Word32 ene[CLDFB_NO_CHANNELS_MAX]; - int16_t preDelay; + Word16 preDelay; error = IVAS_ERR_OK; @@ -4203,6 +4280,7 @@ ivas_error ivas_binaural_reverb_open_parambin( revTimes = hHrtfParambin->parametricReverberationTimes_fx; revEne = hHrtfParambin->parametricReverberationEneCorrections_fx; preDelay = 10; + move16(); } error = ivas_binaural_reverb_open_fx( hReverbPr, numBins, numCldfbSlotsPerFrame, sampling_rate, revTimes, revEne, preDelay ); diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index e9f05808f..33874261e 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1804,10 +1804,6 @@ ivas_error ivas_external_orientation_open( Word16 i; IVAS_QUATERNION identity; -#if 0 // to be removed later - identity.w = 1.0f; - identity.x = identity.y = identity.z = 0.0f; -#endif identity.w_fx = ONE_IN_Q31; move32(); identity.x_fx = 0; @@ -1925,11 +1921,6 @@ ivas_error ivas_combined_orientation_open( Word16 tmp_e = 0, tmp; IVAS_QUATERNION identity; IVAS_VECTOR3 origo; -#if 0 // to be removed later - identity.w = 1.0f; - identity.x = identity.y = identity.z = 0.0f; - origo.x = origo.y = origo.z = 0.0f; -#endif identity.w_fx = ONE_IN_Q31; move32(); identity.x_fx = 0; @@ -3038,28 +3029,42 @@ static Word32 SHrot_p_fx( { Word16 ri1 = 0, rim1 = 0, ri0 = 0, R_lm1_1 = 0, R_lm1_2 = 0; + move16(); + move16(); + move16(); + move16(); + move16(); + Word32 p = 0; + move32(); + ri1 = SHrotmat[i + 1 + 1][1 + 1 + 1]; + move16(); rim1 = SHrotmat[i + 1 + 1][-1 + 1 + 1]; + move16(); ri0 = SHrotmat[i + 1 + 1][0 + 1 + 1]; + move16(); - if ( b == -l ) + IF ( EQ_16( b, -l ) ) { R_lm1_1 = R_lm1[a + l - 1][0]; + move16(); R_lm1_2 = R_lm1[a + l - 1][2 * l - 2]; + move16(); p = L_mac0( L_mult0( ri1, R_lm1_1 ), rim1, R_lm1_2 ); } - else + ELSE { - if ( b == l ) + IF ( EQ_16( b, l ) ) { - R_lm1_1 = R_lm1[a + l - 1][2 * l - 2]; + R_lm1_1 = R_lm1[a + l - 1][sub( shl( l, 1 ), 2 ) ]; R_lm1_2 = R_lm1[a + l - 1][0]; p = L_msu0( L_mult0( ri1, R_lm1_1 ), rim1, R_lm1_2 ); } - else + ELSE { R_lm1_1 = R_lm1[a + l - 1][b + l - 1]; + move16(); p = L_mult0( ri0, R_lm1_1 ); } } @@ -3216,27 +3221,27 @@ static Word32 SHrot_v_fx( Word32 p0, p1; Word16 d; - if ( m == 0 ) + IF ( EQ_16( m, 0 ) ) { p0 = SHrot_p_fx( 1, l, 1, n, SHrotmat, R_lm1 ); // Q28 p1 = SHrot_p_fx( -1, l, -1, n, SHrotmat, R_lm1 ); // Q28 - result = L_add( p0, p1 ) / 2; // converting to Q27 + result = L_shr( L_add( p0, p1 ), 2 ); // converting to Q27 } - else + ELSE { - if ( m > 0 ) + IF ( GT_16( m, 0 ) ) { d = ( m == 1 ) ? 1 : 0; p0 = (Word32) SHrot_p_fx( 1, l, m - 1, n, SHrotmat, R_lm1 ); p1 = (Word32) SHrot_p_fx( -1, l, -m + 1, n, SHrotmat, R_lm1 ); - result = Msub_32_16_r( Mpy_32_16_r( p0, square_root16_table[1 + d] ), p1, ( 1 - d ) * ( 1 << 14 ) ); // Q27 + result = Msub_32_16_r( Mpy_32_16_r( p0, square_root16_table[1 + d] ), p1, shl( sub( 1, d ), 14 ) ); // Q27 } - else + ELSE { d = ( m == -1 ) ? 1 : 0; p0 = (Word32) SHrot_p_fx( 1, l, m + 1, n, SHrotmat, R_lm1 ); p1 = (Word32) SHrot_p_fx( -1, l, -m - 1, n, SHrotmat, R_lm1 ); - result = Madd_32_16_r( Mpy_32_16_r( p0, ( 1 - d ) * ( 1 << 14 ) ), p1, square_root16_table[1 + d] ); // Q27 + result = Madd_32_16_r( Mpy_32_16_r( p0, shl( sub( 1, d ), 14 ) ), p1, square_root16_table[1 + d] ); // Q27 } } return result; // Q27 @@ -3251,20 +3256,20 @@ static Word32 SHrot_w_fx( { Word32 result, p0, p1; - if ( m == 0 ) + IF ( EQ_16( m, 0 ) ) { printf( "ERROR should not be called\n" ); return 0; } - else + ELSE { - if ( m > 0 ) + IF ( GT_16( m, 0 ) ) { p0 = SHrot_p_fx( 1, l, m + 1, n, SHrotmat, R_lm1 ); p1 = SHrot_p_fx( -1, l, -m - 1, n, SHrotmat, R_lm1 ); result = L_add( p0, p1 ); } - else + ELSE { p0 = SHrot_p_fx( 1, l, m - 1, n, SHrotmat, R_lm1 ); p1 = SHrot_p_fx( -1, l, -m + 1, n, SHrotmat, R_lm1 ); @@ -3291,17 +3296,31 @@ void SHrotmatgen_fx( ) { Word16 d = 0; + move16(); Word16 band_idx = 0; + move16(); Word16 i, j; Word16 l, m, n; Word16 absm; Word16 sqdenom = 0, sql2mm2 = 0, sqdabsm = 0, sqlabsm = 0; Word16 u = 0, v = 0, w = 0; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + Word32 u32_fx = 0, v32_fx = 0, w32_fx = 0; + move32(); + move32(); + move32(); + Word16 R_lm1[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; Word16 R_l[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; Word32 result; SHrotmat[0][0] = ONE_IN_Q14; + move16(); SHrotmat[1][1] = extract_h( Rmat[1][1] ); SHrotmat[1][2] = extract_h( Rmat[1][2] ); @@ -3315,77 +3334,83 @@ void SHrotmatgen_fx( SHrotmat[3][2] = extract_h( Rmat[0][2] ); SHrotmat[3][3] = extract_h( Rmat[0][0] ); - for ( i = 0; i < 2 * 1 + 1; i++ ) + FOR ( i = 0; i < 2 * 1 + 1; i++ ) { - for ( j = 0; j < 2 * 1 + 1; j++ ) + FOR ( j = 0; j < 2 * 1 + 1; j++ ) { R_lm1[i][j] = SHrotmat[i + 1][j + 1]; + move16(); } } band_idx = 4; - for ( l = 2; l <= order; l++ ) + move16(); + FOR ( l = 2; l <= order; l++ ) { set_val_Word16( &R_l[0][0], 0, HEADROT_SHMAT_DIM2 ); - for ( m = -l; m <= l; m++ ) + FOR ( m = -l; m <= l; m++ ) { d = ( m == 0 ) ? 1 : 0; absm = (Word16) abs( m ); - sql2mm2 = square_root30_q12[( l * l - m * m )]; - sqdabsm = square_root30_q12[( ( 1 + d ) * ( l + absm - 1 ) * ( l + absm ) )]; - sqlabsm = square_root30_q12[( ( l - absm - 1 ) * ( l - absm ) )]; - for ( n = -l; n <= l; n++ ) + sql2mm2 = square_root30_q12[imult1616(shl(l, 1), sub(shl(l, 1), 1))]; + sqdabsm = square_root30_q12[imult1616((1 + d), imult1616(sub(add( l, absm), 1), add(l, absm)))]; + sqlabsm = square_root30_q12[imult1616( sub( l, sub( absm, 1 ) ), sub( l, absm ) )]; + + FOR ( n = -l; n <= l; n++ ) { - if ( abs( n ) == l ) + IF ( EQ_16( abs_s( n ), l ) ) { - sqdenom = square_root30_q12[( ( 2 * l ) * ( 2 * l - 1 ) )]; + sqdenom = square_root30_q12[imult1616( shl( l, 1 ), sub( shl( l, 1 ), 1 ) )]; } - else + ELSE { - sqdenom = square_root30_q12[( l * l - n * n )]; + sqdenom = square_root30_q12[sub(imult1616( l, l ), imult1616( n, n) )]; } - u = div_l( (Word32) ( sql2mm2 * ( 1 << 15 ) ), sqdenom ); // Q14 - v = div_l( (Word32) ( sqdabsm * ( 1 << 14 ) ), sqdenom ) * ( 1 - 2 * d ); // Q14 - w = div_l( (Word32) ( sqlabsm * ( 1 << 14 ) ), sqdenom ) * ( 1 - d ) * -1; // Q14 - if ( u != 0 ) + u = div_l( L_shl( (Word32) sql2mm2, 15 ), sqdenom ); // Q14 + v = imult1616( div_l( L_shl( (Word32) sqdabsm, 14 ), sqdenom ), sub( 1, shl( d, 1 ) ) ); // Q14 + w = imult1616( div_l( L_shl( (Word32) sqlabsm, 14 ), sqdenom ), negate( sub( 1, d ) ) ); // Q14 + + IF ( NE_16( u, 0 ) ) { result = SHrot_u_fx( l, m, n, SHrotmat, R_lm1 ); // Q28 u32_fx = Mpy_32_16_r( result, u ); // Q27 } - if ( v != 0 ) + IF ( NE_16( v, 0 ) ) { result = SHrot_v_fx( l, m, n, SHrotmat, R_lm1 ); v32_fx = Mpy_32_16_r( result, v ); // Q26 } - if ( w != 0 ) + IF ( NE_16( w, 0 ) ) { result = SHrot_w_fx( l, m, n, SHrotmat, R_lm1 ); w32_fx = Mpy_32_16_r( result, w ); // Q27 } // Addind and converting to 16 bit integer of Q14 - R_l[m + l][n + l] = extract_h( L_add( L_add( u32_fx >> 1, v32_fx ), w32_fx >> 1 ) * ( 1 << 4 ) ); // Q14 + R_l[m + l][n + l] = extract_h( L_add( L_add( L_shr( u32_fx, 1 ), v32_fx ), L_shr( w32_fx, 1 ) ) * L_shl( 1, 4 ) ); // Q14 } } - for ( i = 0; i < 2 * l + 1; i++ ) + FOR ( i = 0; i < 2 * l + 1; i++ ) { - for ( j = 0; j < 2 * l + 1; j++ ) + FOR ( j = 0; j < 2 * l + 1; j++ ) { SHrotmat[band_idx + i][band_idx + j] = R_l[i][j]; + move16(); } } - for ( i = 0; i < 2 * l + 1; i++ ) + FOR ( i = 0; i < 2 * l + 1; i++ ) { - for ( j = 0; j < 2 * l + 1; j++ ) + FOR ( j = 0; j < 2 * l + 1; j++ ) { R_lm1[i][j] = R_l[i][j]; + move16(); } } - band_idx += 2 * l + 1; + band_idx = add( shl( l, 1 ), 1 ); } return; -- GitLab From cc2872a7ac2fca01624760996230002a17bdd479 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 20 May 2024 21:20:57 +0530 Subject: [PATCH 060/101] LTV crash issue fix for stereo, OMASA formats and float code cleanup [x] LTV crash fix for stereo format streams caused due to incorrect table values and intermediate float to fix conversions [stereo at 16.4 kbps, 32kHz in, 16kHz out, DTX on] [stereo at 16.4 kbps, 32kHz in, 16kHz out, random FER at 5%, DTX on] [stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on, random FER at 5%, bandwidth switching] [stereo at 16.4 kbps, 16kHz in, 16kHz out, DTX on, random FER at 5%] [stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, random FER at 5%, bandwidth switching] [stereo bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out] [x] LTV crash fix for OMASA and MASA formats. [OMASA 1Dir1TC 4ISM at br sw techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, JBM Prof 5] [OMASA 1Dir2TC 4ISM at br sw techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, FOA out, JBM Prof 5] [MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 16kHz out, BINAURAL out, JBM Prof 5] [x] Float code clean up in init_dec_fx.c, dirac dec and dirac lib_rend files --- lib_com/float_to_fix_ops.c | 92 - lib_com/ivas_sns_com_fx.c | 2 +- lib_com/lsf_tools_fx.c | 16 +- lib_com/rom_com.c | 28 +- lib_com/stat_com.h | 2 +- lib_dec/acelp_core_dec_ivas_fx.c | 14 +- lib_dec/fd_cng_dec.c | 23 +- lib_dec/init_dec_fx.c | 1925 ++++++++---------- lib_dec/ivas_core_dec.c | 27 - lib_dec/ivas_cpe_dec_fx.c | 14 - lib_dec/ivas_dirac_dec.c | 6 +- lib_dec/ivas_ism_dtx_dec.c | 4 +- lib_dec/ivas_jbm_dec.c | 132 +- lib_dec/ivas_mc_param_dec.c | 12 +- lib_dec/ivas_sce_dec_fx.c | 5 - lib_dec/ivas_stereo_cng_dec.c | 10 +- lib_dec/jbm_pcmdsp_apa.c | 2 +- lib_dec/tonalMDCTconcealment_fx.c | 12 + lib_rend/ivas_dirac_dec_binaural_functions.c | 20 +- lib_rend/ivas_dirac_decorr_dec.c | 238 ++- lib_rend/ivas_dirac_onsets_dec.c | 31 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 3 +- lib_rend/ivas_dirac_rend.c | 46 +- lib_rend/ivas_prot_rend.h | 7 + lib_rend/ivas_rotation.c | 7 + lib_rend/lib_rend.c | 4 + 26 files changed, 1089 insertions(+), 1593 deletions(-) diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 57c6ded70..8ed6c56c0 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -831,15 +831,6 @@ void fixed_to_float_stereo_tcx_core_dec( if ( EQ_16( st->core, ACELP_CORE ) ) { - - for ( int p = 0; p < st->L_frame / 2; p++ ) - { - //st->hTcxDec->syn_OverlFB_float[p] = (float) st->hTcxDec->syn_OverlFB[p] / (float) pow( 2, st->Q_syn ); - //st->hTcxDec->syn_Overl_float[p] = (float) st->hTcxDec->syn_Overl[p] / (float) pow( 2, st->Q_syn ); - //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); - } if (st->hHQ_core->Q_old_wtda >= 0) { for ( int p = 0; p < st->L_frame; p++ ) @@ -855,35 +846,8 @@ void fixed_to_float_stereo_tcx_core_dec( st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); } } - //for ( int p = 0; p < st->L_frame; p++ ) - //{ - // st->hTcxDec->old_excFB[p] = (float) ( st->hTcxDec->old_excFB_fx[p] ) / ( 1u << st->Q_exc ); - //} } - //if ( st->lpcQuantization ) - //{ - // st->safety_net = st->safety_net; - // st->mid_lsf_int = st->mid_lsf_int; - //} - - //hTcxDec->tcxltp_last_gain_unmodified_float = fixedToFloat( hTcxDec->tcxltp_last_gain_unmodified, Q15 ); - - //st->hTcxDec->conceal_eof_gain_float = fixedToFloat( st->hTcxDec->conceal_eof_gain, Q14 ); - - //st->hTcxDec->CngLevelBackgroundTrace_bfi = fix16_to_float( st->hTcxDec->conCngLevelBackgroundTrace, 15 - st->hTcxDec->conCngLevelBackgroundTrace_e ); - - //fixedToFloat_arr( hTcxDec->old_synth, hTcxDec->old_synth_float, 0, hTcxDec->old_synth_len ); - //fixedToFloat_arr( hTcxDec->synth_history_fx, hTcxDec->synth_history, 0, NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ) ); - //st->hTcxDec->q_synth_history_fx = 0; - - //fixedToFloat_arr( hTcxDec->old_synthFB_fx, hTcxDec->old_synthFB, 0, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) + hTcxDec->old_synth_lenFB ); - - //if ( !st->tcxonly ) - //{ - // fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); - //} - st->hBPF->pst_mem_deemp_err_fx = (Word16)st->mem_error; /*=================================*/ if ( st->hFdCngDec != NULL && ( st->sr_core == INT_FS_12k8 || st->sr_core == INT_FS_16k ) && st->total_brate <= MAX_ACELP_BRATE ) @@ -902,62 +866,14 @@ void fixed_to_float_stereo_tcx_core_dec( ( ( st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT ) && ( st->hFdCngDec->hFdCngCom->active_frame_counter > 0 ) ) || ( ( st->bfi == 1 ) && ( st->nbLostCmpt == 1 ) ) ) ) || ( st->m_frame_type == ZERO_FRAME ) ) { - //st->hTcxDec->CngLevelBackgroundTrace_bfi = fix_to_float( st->hTcxDec->CngLevelBackgroundTrace_bfi_fx, ( 31 - st->hTcxDec->CngLevelBackgroundTrace_bfi_exp ) ); - //st->hTcxDec->CngLevelBackgroundTrace_bfi = fix16_to_float( st->hTcxDec->conCngLevelBackgroundTrace, ( 15 - st->hTcxDec->conCngLevelBackgroundTrace_e) ); - //st->cngTDLevel_float = fixedToFloat( st->cngTDLevel, ( 15 - st->cngTDLevel_e ) ); - //for ( int p = 0; p < st->hFdCngDec->hFdCngCom->fftlen; p++ ) - //{ - // st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->fftBuffer[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) ); - //} - if(( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) >= 0) - { - for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) - { - st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - } - } - else{ - for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) - { - st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] * ( 1u << ( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp - 31) ) ); - } - } - for ( int p = 0; p < ( st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand ); p++ ) - { - //st->hFdCngDec->bandNoiseShape_float[p] = ( (float) st->hFdCngDec->bandNoiseShape[p] / ( 1u << ( 31 - st->hFdCngDec->bandNoiseShape_exp ) ) ); - } - - for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ ) { st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ); } - if ( st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT ) - { - for ( int p = 0; p < L_FRAME16k - st->hFdCngDec->hFdCngCom->startBand; p++ ) - { - //st->hFdCngDec->smoothed_psd[st->hFdCngDec->hFdCngCom->startBand + p] = ( (float) st->hFdCngDec->smoothed_psd_fx[st->hFdCngDec->hFdCngCom->startBand + p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ) ); - } - st->hFdCngDec->q_smoothed_psd = sub( 31 , st->hFdCngDec->msNoiseEst_exp ); - } - - //int A_cng_q = 14; - if ( st->element_mode != IVAS_CPE_MDCT || st->core == ACELP_CORE ) - { - //A_cng_q = 15 - norm_s( st->hFdCngDec->hFdCngCom->A_cng[0] ); - } - //Scale_sig(st->hFdCngDec->hFdCngCom->A_cng, M + 1, A_cng_q - norm_s(st->hFdCngDec->hFdCngCom->A_cng[0] - 1)); - - for ( int p = 0; p < M; p++ ) - { - //st->hFdCngDec->hFdCngCom->A_cng_flt[p] = ( (float) st->hFdCngDec->hFdCngCom->A_cng[p] / ( 1u << A_cng_q ) ); - } } } } - - //me2f_buf(st->hIGFDec->virtualSpec, st->hIGFDec->virtualSpec_e, st->hIGFDec->virtualSpecBuf, (N_MAX_TCX - IGF_START_MN)); IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) { @@ -969,14 +885,6 @@ void fixed_to_float_stereo_tcx_core_dec( { st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); } - FOR( Word16 ind = 0; ind < L_FRAME32k / 2; ind++ ) - { - //st->hTcxDec->syn_Overl_float[ind] = (float) st->hTcxDec->syn_Overl[ind] / ( (float) pow( 2, st->Q_syn + 1 ) ); - } - FOR( Word16 ind = 0; ind < L_FRAME_MAX / 2; ind++ ) - { - //st->hTcxDec->syn_OverlFB_float[ind] = (float) st->hTcxDec->syn_OverlFB[ind] / ( (float) pow( 2, st->Q_syn ) ); - } } } #endif // IVAS_FLOAT_FIXED diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index d04de5815..d192118d9 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -138,7 +138,7 @@ void sns_compute_scf_fx( FOR( i = 0; i < FDNS_NPTS; i++ ) { xs[i] = Mpy_32_16_1( xs[i], pow_tilt[i] ); - xs[i] = L_shl( xs[i], Q8 ); // xs => Q12 + xs[i] = L_shl( xs[i], Q6 ); // xs => Q10 } /* Noise floor at -40dB */ diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index d1aa039b5..05934803f 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -1206,10 +1206,12 @@ void E_LPC_f_lsp_a_conversion(const Word16 *lsp, Word16 *a, const Word16 m) { #ifdef BASOP_NOGLOB t0 = L_max(t0, L_abs(L_add_o(f1[i], f2[i], &Overflow))); + t0 = L_max(t0, L_abs(L_sub_o(f1[i], f2[i], &Overflow))); #else t0 = L_max(t0, L_abs(L_add(f1[i], f2[i]))); + t0 = L_max(t0, L_abs(L_sub(f1[i], f2[i]))); #endif - t0 = L_max(t0, L_abs(L_sub(f1[i], f2[i]))); + } k = s_min(norm_l(t0), 6); a[0] = shl(256, k); @@ -1237,9 +1239,17 @@ void E_LPC_f_lsp_a_conversion(const Word16 *lsp, Word16 *a, const Word16 m) #endif /* a[j] = 0.5*(f1[i] - f2[i]) */ - t0 = L_sub(f1[i], f2[i]); +#ifdef BASOP_NOGLOB + t0 = L_sub_o(f1[i], f2[i], &Overflow); +#else + t0 = L_sub(f1[i], f2[i]); +#endif t0 = L_shl(t0, k); - a[j] = round_fx(t0); /* from Q23 to Qx and * 0.5 */ +#ifdef BASOP_NOGLOB + a[j] = round_fx_o(t0, &Overflow); /* from Q23 to Qx and * 0.5 */ +#else + a[j] = round_fx(t0); /* from Q23 to Qx and * 0.5 */ +#endif j--; } diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 256fc16d7..f41b789b1 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -10980,25 +10980,25 @@ const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO] = const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN] = { - { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/, 20295 }, - { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, - { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, - { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, + { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/, -28672 }, + { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, -24576 }, + { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, + { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, -16384 }, { 0, 16400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, - { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, - { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, - { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 }, - { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, - { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, + { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, -24576 }, + { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, + { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/, -12288 }, + { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, + { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, -4096 }, { 1, 24400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, - { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, - { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, - { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, - { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/, 4242 }, + { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, + { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, + { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, -16384 }, + { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/, -8192 }, - { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, + { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, -4096 }, { 2, 24400, 32000, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, { 2, 32000,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 } }; diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 3c9f4cfbc..e58393e8d 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -461,7 +461,7 @@ typedef struct Word16 exp_cldfb_periodog; Word32 cngNoiseLevel[FFTCLDFBLEN]; /* Noise level applied for the CNG in each (sub)band */ - Word16 q_cngNoiseLevel; + //Word16 q_cngNoiseLevel; Word16 cngNoiseLevelExp; int16_t seed; /* Seed memory (for random function) */ diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index ef617eed6..baebf97be 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -136,7 +136,13 @@ ivas_error acelp_core_dec_ivas_fx( ivas_error error; Word32 bpf_error_signal_fx[L_FRAME16k]; +#ifdef MSAN_FIX + set32_fx(bpf_error_signal_fx, 0, L_FRAME16k); +#endif Word16 bpf_error_signal_16fx[L_FRAME16k]; +#ifdef MSAN_FIX + set_s(bpf_error_signal_16fx, 0, L_FRAME16k); +#endif Word16 tmp; error = IVAS_ERR_OK; @@ -1981,13 +1987,6 @@ void acelp_decoder_state_float2fix(Decoder_State *st/*, STEREO_CNG_DEC_HANDLE hS if(st->cldfbSynHB) floatToFixed_arrL(st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q10, st->cldfbSynHB->p_filter_length); floatToFixed_arrL(st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q10, st->cldfbSyn->p_filter_length); - - //FdCng - if ( st->hFdCngDec ) - { - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = Q31 - 4; - floatToFixed_arrL(st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, Q31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN); - } } void acelp_decoder_state_fix2float(Decoder_State *st) { @@ -2006,7 +2005,6 @@ void acelp_decoder_state_fix2float(Decoder_State *st) { //FdCng if ( st->hFdCngDec ) { - fixedToFloat_arrL( st->hFdCngDec->hFdCngCom->cngNoiseLevel, st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, Q31 - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN ); if ((st->hFdCngDec != NULL || st->idchan == 1) && st->element_mode != IVAS_CPE_MDCT) { if (st->element_mode == IVAS_CPE_TD || st->flag_cna || (st->cng_type == FD_CNG && st->total_brate <= ACELP_32k) || (st->cng_type == LP_CNG && st->core_brate <= SID_2k40)) diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 80cfcdce9..102dde8cd 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1457,21 +1457,17 @@ void FdCng_decodeSID_ivas_fx( if (hFdCngCom->CngBandwidth == NB) { - //sidNoiseEst_flt[N - 1] *= NB_LAST_BAND_SCALE_FLT; sidNoiseEst[N - 1] = Mpy_32_16_1(sidNoiseEst[N - 1], NB_LAST_BAND_SCALE); } if (hFdCngCom->CngBandwidth == SWB && hFdCngCom->CngBitrate <= ACELP_13k20) { - //sidNoiseEst_flt[N - 1] *= SWB_13k2_LAST_BAND_SCALE_FLT; sidNoiseEst[N - 1] = Mpy_32_16_1(sidNoiseEst[N - 1], SWB_13k2_LAST_BAND_SCALE); } - //scalebands_flt(sidNoiseEst_flt, hFdCngCom->part, hFdCngCom->npart, hFdCngCom->midband, hFdCngCom->nFFTpart, hFdCngCom->stopBand - hFdCngCom->startBand, hFdCngCom->cngNoiseLevel_flt, 1); scalebands(sidNoiseEst, hFdCngCom->part, hFdCngCom->npart, hFdCngCom->midband, hFdCngCom->nFFTpart, hFdCngCom->stopBand - hFdCngCom->startBand, hFdCngCom->cngNoiseLevel, 1); hFdCngCom->cngNoiseLevelExp = hFdCngCom->sidNoiseEstExp; - //lpc_from_spectrum_flt(hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, st->preemph_fac_float); lpc_from_spectrum(hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, st->preemph_fac); return; @@ -2013,10 +2009,7 @@ void generate_masking_noise_ivas_fx( const int16_t nchan_out /* i : number of output channels */ ) { - float *cngNoiseLevel_flt = hFdCngCom->cngNoiseLevel_flt; - Word32 max_cngNoiseLevel = 0; Word32 *cngNoiseLevel_fx = hFdCngCom->cngNoiseLevel; - Word16 noise_exp; Word32 *ptr_level_fx = cngNoiseLevel_fx; Word32 *fftBuffer_fx = hFdCngCom->fftBuffer; Word16 i; @@ -2027,16 +2020,6 @@ void generate_masking_noise_ivas_fx( Word16 *seed = &( hFdCngCom->seed ); Word32 scale_fx = 0x40000000; // 1.0 in Q30 - FOR( i = 0; i < FFTCLDFBLEN; i++ ) - { - max_cngNoiseLevel = L_max( L_abs( (Word32) cngNoiseLevel_flt[i] ), max_cngNoiseLevel ); - } - noise_exp = norm_l( max_cngNoiseLevel ); - FOR( i = 0; i < FFTCLDFBLEN; i++ ) - { - cngNoiseLevel_fx[i] = float_to_fix( cngNoiseLevel_flt[i], noise_exp ); - } - /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */ *exp_out = Q15; IF( hFdCngCom->likelihood_noisy_speech_32fx > DELTA_MASKING_NOISE_Q31 ) @@ -2093,7 +2076,7 @@ void generate_masking_noise_ivas_fx( { rand_gauss_fx( &fftBuffer_fx[0], seed, *exp_out); // Q15 ptr_r_fx = fftBuffer_fx + 2; - Word16 exp1 = 32 - noise_exp; + Word16 exp1 = 32 - hFdCngCom->cngNoiseLevelExp; Word32 mpy1 = Sqrt32( Mpy_32_32( scale_fx, *ptr_level_fx ), &exp1 ); // Q = noise_exp-1 mpy1 = L_shl( mpy1, exp1 ); // Q31 fftBuffer_fx[0] = Mpy_32_32( fftBuffer_fx[0], mpy1 ); /* DC component in FFT */ // Q = Q15 @@ -2110,7 +2093,7 @@ void generate_masking_noise_ivas_fx( { /* Real part in FFT bins */ rand_gauss_fx( ptr_r_fx, seed, *exp_out); // Q15 - Word16 exp2 = 32 - noise_exp; + Word16 exp2 = 32 - hFdCngCom->cngNoiseLevelExp; Word32 mpy2 = Sqrt32( L_shr( Mpy_32_32( scale_fx, *ptr_level_fx ), 1 ), &exp2 ); // Q = noise_exp-1 ( *ptr_r_fx ) = L_shl( Mpy_32_32( *ptr_r_fx, mpy2 ), exp2 ); // Q = Q15 ptr_r_fx += 2; @@ -2170,6 +2153,7 @@ void generate_masking_noise_ivas_fx( * not called based on signal statistics *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void generate_masking_noise_update_seed( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ) @@ -2199,6 +2183,7 @@ void generate_masking_noise_update_seed( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index ef0539a24..332eef94e 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -837,1180 +837,893 @@ ivas_error init_decoder_fx( } +/*----------------------------------------------------------------------* + * init_decoder_ivas_fx() + * + * Initialization of static variables for the IVAS decoder + *----------------------------------------------------------------------*/ ivas_error init_decoder_ivas_fx( - Decoder_State *st_fx, /* o: Decoder static variables structure */ - const Word16 idchan, /* i : channel ID */ - const MC_MODE mc_mode /* i : MC mode */ + Decoder_State *st_fx, /* o: Decoder static variables structure */ + const Word16 idchan, /* i : channel ID */ + const MC_MODE mc_mode /* i : MC mode */ ) { - Word16 i; - ivas_error error; - - error = IVAS_ERR_OK; - - /*-----------------------------------------------------------------* - * General parameters - *-----------------------------------------------------------------*/ - - st_fx->codec_mode = MODE1; - move16(); - st_fx->last_codec_mode = MODE1; - move16(); - st_fx->core = ACELP_CORE; - move16(); - st_fx->L_frame = L_FRAME; - move16(); - st_fx->extl = -1; - move16(); - st_fx->extl_orig = -1; /* extension layer */ - move16(); - st_fx->extl_brate_orig = 0; /* extension layer bitrate */ - move16(); - st_fx->last_bits_frame_nominal = -1; - move16(); - st_fx->total_brate = ACELP_8k00; - move16(); - st_fx->last_total_brate = -1; - move16(); - st_fx->last_total_brate_ber = -1; - move32(); - st_fx->core_brate = ACELP_8k00; - move16(); - st_fx->ini_frame = 0; - move16(); - st_fx->bwidth = NB; - move16(); - st_fx->last_bwidth = NB; - move16(); - st_fx->extl_brate = 0; - move16(); - -#ifdef ISM_DISABLE - if ( st_fx->ivas_format != ISM_FORMAT ) - { - st_fx->coder_type = GENERIC; - st_fx->last_coder_type = GENERIC; + Word16 i; + ivas_error error; + + error = IVAS_ERR_OK; + move32(); + + /*-----------------------------------------------------------------* + * General parameters + *-----------------------------------------------------------------*/ + + st_fx->codec_mode = MODE1; + move16(); + st_fx->last_codec_mode = MODE1; + move16(); + st_fx->core = ACELP_CORE; + move16(); + st_fx->L_frame = L_FRAME; + move16(); + st_fx->extl = -1; + move16(); + st_fx->extl_orig = -1; /* extension layer */ + move16(); + st_fx->extl_brate_orig = 0; /* extension layer bitrate */ + move16(); + st_fx->last_bits_frame_nominal = -1; + move16(); + st_fx->total_brate = ACELP_8k00; + move16(); + st_fx->last_total_brate = -1; + move16(); + st_fx->last_total_brate_ber = -1; + move32(); + st_fx->core_brate = ACELP_8k00; + move16(); + st_fx->ini_frame = 0; + move16(); + st_fx->bwidth = NB; + move16(); + st_fx->last_bwidth = NB; + move16(); + st_fx->extl_brate = 0; + move16(); + st_fx->coder_type = GENERIC; /* low-rate mode flag */ + move16(); + st_fx->last_coder_type = GENERIC; + move16(); + st_fx->inactive_coder_type_flag = 0; + move16(); + st_fx->last_L_frame = st_fx->L_frame; + move16(); + st_fx->last_core_brate = st_fx->core_brate; + move16(); + st_fx->last_core = -1; + move16(); + st_fx->last_extl = st_fx->extl; + move16(); + + st_fx->flag_ACELP16k = set_ACELP_flag( st_fx->element_mode, st_fx->total_brate, st_fx->total_brate, idchan, 0, -1, -1 ); + + /*-----------------------------------------------------------------* + * ACELP core parameters + *-----------------------------------------------------------------*/ + + /* LSF initilaizations */ + Copy( GEWB_Ave_fx, st_fx->mem_AR_fx, M ); + + init_lvq_fx( st_fx->offset_scale1_fx, st_fx->offset_scale2_fx, st_fx->offset_scale1_p_fx, st_fx->offset_scale2_p_fx, st_fx->no_scales_fx, st_fx->no_scales_p_fx ); + + set16_fx( st_fx->mem_MA_fx, 0, M ); + + st_fx->dm_fx.prev_state = 0; /* This corresponds to st_fx->dispMem in FLP */ + move16(); + st_fx->dm_fx.prev_gain_code = L_deposit_l( 0 ); + FOR( i = 2; i < 8; i++ ) + { + st_fx->dm_fx.prev_gain_pit[i - 2] = 0; + move16(); + } + st_fx->tilt_code_fx = 0; + move16(); + st_fx->gc_threshold_fx = 0; + move32(); + st_fx->last_good = UNVOICED_CLAS; + move16(); + st_fx->clas_dec = UNVOICED_CLAS; + move16(); + st_fx->low_rate_mode = 0; /* low-rate mode flag */ + move16(); + st_fx->last_low_rate_mode = 0; /* low-rate mode flag */ + move16(); + st_fx->lp_gainp_fx = 0; + move16(); + st_fx->lp_gainc_fx = 0; + move16(); + + set16_fx( st_fx->old_exc_fx, 0, L_EXC_MEM_DEC ); + + /* AVQ pre-quantizer memory */ + st_fx->mem_preemp_preQ_fx = 0; + move16(); + st_fx->last_nq_preQ = 0; + move16(); + st_fx->use_acelp_preq = 0; + move16(); + + st_fx->mem_deemph_fx = 0; + move16(); + + set16_fx( st_fx->mem_syn1_fx, 0, M ); + set16_fx( st_fx->mem_syn2_fx, 0, M ); + st_fx->stab_fac_fx = 0; + move16(); + st_fx->stab_fac_smooth_fx = 0; + move16(); + set16_fx( st_fx->agc_mem_fx, 0, 2 ); + set16_fx( st_fx->mem_syn3_fx, 0, M ); + + st_fx->stab_fac_smooth_lt_fx = 0; + move16(); + st_fx->log_energy_diff_lt_fx = 0; + move32(); + st_fx->log_energy_old_fx = 0; + move32(); + + Copy( GEWB_Ave_fx, st_fx->lsf_old_fx, M ); + lsf2lsp_fx( st_fx->lsf_old_fx, st_fx->lsp_old_fx, M, INT_FS_12k8 ); + + st_fx->mid_lsf_int = 0; + move16(); + st_fx->safety_net = 0; + move16(); + + /* FEC */ + st_fx->scaling_flag = 0; + move16(); + st_fx->lp_ener_FEC_av = 500000; + move32(); + st_fx->lp_ener_FEC_max = 500000; + move32(); + st_fx->prev_bfi = 0; + move16(); + st_fx->lp_ener_FER_fx = 15360; /*60 in Q8*/ + move16(); + st_fx->old_enr_LP = 0; + move16(); + st_fx->lp_ener_fx = L_deposit_l( 0 ); + st_fx->enr_old_fx = L_deposit_l( 0 ); + st_fx->bfi_pitch_fx = L_SUBFR_Q6; + move16(); + st_fx->bfi_pitch_frame = L_FRAME; + move16(); + set16_fx( st_fx->mem_syn_clas_estim_fx, 0, L_SYN_MEM_CLAS_ESTIM ); + st_fx->classifier_Q_mem_syn = 0; + move16(); + st_fx->last_con_tcx = 0; + move16(); + + FOR( i = 0; i < 2 * NB_SUBFR16k; i++ ) + { + st_fx->old_pitch_buf_fx[i] = L_shl( L_SUBFR, 16 ); /*15Q16*/ + move32(); + } + + st_fx->upd_cnt = MAX_UPD_CNT; + move16(); + Copy( GEWB_Ave_fx, st_fx->lsfoldbfi0_fx, M ); + Copy( GEWB_Ave_fx, st_fx->lsfoldbfi1_fx, M ); + Copy( GEWB_Ave_fx, st_fx->lsf_adaptive_mean_fx, M ); + + st_fx->seed_acelp = RANDOM_INITSEED; + move16(); + st_fx->seed = RANDOM_INITSEED; + move16(); + st_fx->nbLostCmpt = 0; + move16(); + st_fx->decision_hyst = 0; + move16(); + st_fx->unv_cnt = 0; + move16(); + st_fx->ge_sm_fx = L_deposit_l( 640 ); /*Q(GE_SHIFT)*/ + st_fx->uv_count = 0; + move16(); + st_fx->act_count = 3; + move16(); + Copy( st_fx->lsp_old_fx, st_fx->lspold_s_fx, M ); + st_fx->noimix_seed = RANDOM_INITSEED; + move16(); + st_fx->min_alpha_fx = 32767; /*1; Q15*/ + move16(); + st_fx->exc_pe_fx = 0; + move16(); +#ifdef MSAN_FIX + st_fx->Q_stat_noise = 31; + move16(); +#endif + st_fx->prev_coder_type = GENERIC; + move16(); + + st_fx->tilt_wb_fx = 0; + move16(); + + st_fx->last_voice_factor_fx = 0; + move16(); + + set16_fx( st_fx->prev_synth_buffer_fx, 0, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) ); + st_fx->Qprev_synth_buffer_fx = 15; + move16(); + set32_fx( st_fx->prev_synth_buffer32_fx, 0, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) ); + + st_fx->old_bfi_cnt = 0; + move16(); + + /*-----------------------------------------------------------------* + * parameters for AC mode (GSC) + *-----------------------------------------------------------------*/ + + st_fx->GSC_noisy_speech = 0; + move16(); + st_fx->GSC_IVAS_mode = 0; + move16(); + st_fx->Last_GSC_noisy_speech_flag = 0; + move16(); + + IF( ( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) + { + IF( ( st_fx->hGSCDec = (GSC_DEC_HANDLE) count_malloc( sizeof( GSC_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for GSC\n" ) ); + } + + GSC_dec_init_ivas_fx( st_fx->hGSCDec ); + } + ELSE + { + st_fx->hGSCDec = NULL; + } + + /*-----------------------------------------------------------------* + * parameters for fast recovery (WI) + *-----------------------------------------------------------------*/ + + IF( EQ_32( st_fx->output_Fs, 16000 ) && EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + IF( ( st_fx->hWIDec = (WI_DEC_HANDLE) count_malloc( sizeof( WI_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FEC WI\n" ) ); + } + set16_fx( st_fx->hWIDec->old_exc2_fx, 0, L_EXC_MEM ); + set16_fx( st_fx->hWIDec->old_syn2_fx, 0, L_EXC_MEM ); + } + ELSE + { + st_fx->hWIDec = NULL; + } + + /* NB post-filter */ + /*-----------------------------------------------------------------* + * NB/formant post-filter + *-----------------------------------------------------------------*/ + IF( ( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) + { + IF( ( st_fx->hPFstat = (PFSTAT_HANDLE) count_malloc( sizeof( PFSTAT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for NB/formant postflter\n" ) ); + } + + Init_post_filter_fx( st_fx->hPFstat ); + st_fx->psf_lp_noise_fx = 0; + move16(); + } + ELSE + { + st_fx->hPFstat = NULL; + } + + /*-----------------------------------------------------------------* + * HF (6-7kHz) (zero) BWE parameters + *-----------------------------------------------------------------*/ + + IF( ( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) + { + IF( ( st_fx->hBWE_zero = (ZERO_BWE_DEC_HANDLE) malloc( sizeof( ZERO_BWE_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for zero BWE\n" ) ); + } + + hf_synth_init_fx( st_fx->hBWE_zero ); +#ifdef MSAN_FIX + set16_fx( st_fx->hBWE_zero->mem_hp400_fx, 0, 6 ); +#endif + } + ELSE + { + st_fx->hBWE_zero = NULL; + } + + /*-----------------------------------------------------------------* + * LD music post-filter + *-----------------------------------------------------------------*/ + + IF( ( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) + { + IF( ( st_fx->hMusicPF = (MUSIC_POSTFILT_HANDLE) count_malloc( sizeof( MUSIC_POSTFILT_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LD music postflter\n" ) ); + } + + music_postfilt_init( st_fx->hMusicPF ); + } + ELSE + { + st_fx->hMusicPF = NULL; + } + + /*-----------------------------------------------------------------* + * CNG and DTX + *-----------------------------------------------------------------*/ + + st_fx->first_CNG = 0; + move16(); + st_fx->cng_type = -1; + move16(); + st_fx->last_active_brate = ACELP_7k20; + move32(); + st_fx->last_CNG_L_frame = L_FRAME; + move16(); + st_fx->last_vad_fx = 0; + move16(); + st_fx->active_cnt = 20; + move16(); + + IF( EQ_16( idchan, 0 ) && ( EQ_16( st_fx->element_mode, EVS_MONO ) || EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) ) + { + if ( ( st_fx->hTdCngDec = (TD_CNG_DEC_HANDLE) count_malloc( sizeof( TD_CNG_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX/TD CNG\n" ) ); + } + + td_cng_dec_init_ivas_fx( st_fx ); + } + ELSE + { + st_fx->hTdCngDec = NULL; + } + + st_fx->masa_sid_format = 0; + move16(); + st_fx->Q_stat_noise_ge = GE_SHIFT; + move16(); + + /*-----------------------------------------------------------------* + * HQ core parameters + *-----------------------------------------------------------------*/ + + st_fx->prev_old_bfi = 0; + move16(); + + set16_fx( st_fx->delay_buf_out_fx, 0, HQ_DELTA_MAX * HQ_DELAY_COMP ); + set16_fx( st_fx->previoussynth_fx, 0, L_FRAME48k ); + + set32_fx( st_fx->delay_buf_out32_fx, 0, HQ_DELTA_MAX * HQ_DELAY_COMP ); + set32_fx( st_fx->previoussynth_fx_32, 0, L_FRAME48k ); + + IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + set16_fx( st_fx->old_synth_sw_fx, 0, NS2SA( 48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ) ); + } + + IF( ( EQ_16( idchan, 0 ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) || EQ_16( st_fx->element_mode, IVAS_SCE ) || EQ_16( st_fx->element_mode, EVS_MONO ) ) ) + { + IF( ( st_fx->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) ); + } + + /* HQ core initialization */ +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. + HQ_core_dec_init_flt( st_fx->hHQ_core ); +#endif + HQ_core_dec_init_fx( st_fx->hHQ_core ); + + IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + /* HQ NB FEC initialization */ + IF( ( st_fx->hHQ_nbfec = (HQ_NBFEC_HANDLE) malloc( sizeof( HQ_NBFEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ NB FEC\n" ) ); + } + + HQ_nbfec_init_fx( st_fx->hHQ_nbfec ); + } + ELSE + { + st_fx->hHQ_nbfec = NULL; + } + } + ELSE + { + st_fx->hHQ_core = NULL; + st_fx->hHQ_nbfec = NULL; + } + + /*-----------------------------------------------------------------* + * TBE parameters + *-----------------------------------------------------------------*/ + + IF( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) + { + if ( ( st_fx->hBWE_TD = (TD_BWE_DEC_HANDLE) malloc( sizeof( TD_BWE_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); + } + + td_bwe_dec_init_ivas_fx( st_fx, st_fx->hBWE_TD, st_fx->output_Fs ); +#ifdef MSAN_FIX + st_fx->hBWE_TD->prev_hb_synth_fx_exp = 31; + move16(); +#endif + } + ELSE + { + st_fx->hBWE_TD = NULL; + } + + st_fx->old_bwe_delay = -1; /*Q0*/ + move16(); + set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_fx2( 48000, DELAY_BWE_TOTAL_NS ) ); + + /*-----------------------------------------------------------------* + * SWB BWE parameters + *-----------------------------------------------------------------*/ + + IF( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) + { + IF( ( st_fx->hBWE_FD = (FD_BWE_DEC_HANDLE) malloc( sizeof( FD_BWE_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD BWE\n" ) ); + } + + fd_bwe_dec_init( st_fx, st_fx->hBWE_FD ); + } + ELSE + { + st_fx->hBWE_FD = NULL; + } + + /*-----------------------------------------------------------------* + * WB/SWB bandwidth switching parameters + *-----------------------------------------------------------------*/ + + st_fx->tilt_swb_fx = 0; + move16(); + st_fx->prev_ener_shb_fx = 0; + move16(); + st_fx->prev_enerLH_fx = 0; + move16(); + st_fx->enerLH_fx = L_deposit_l( 0 ); + st_fx->enerLL_fx = L_deposit_l( 0 ); + st_fx->prev_enerLL_fx = 0; + move16(); + st_fx->prev_fractive = 0; + move16(); + st_fx->prev_bws_cnt = 0; + move16(); + st_fx->bws_cnt = N_WS2N_FRAMES; + move16(); + st_fx->bws_cnt1 = N_NS2W_FRAMES; + move16(); + st_fx->attenu_fx = 3277; + move16(); + st_fx->last_inner_frame = L_FRAME8k; + move16(); + + /*-----------------------------------------------------------------* + * HR SWB BWE parameters + *-----------------------------------------------------------------*/ + + IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + IF( ( st_fx->hBWE_FD_HR = (HR_BWE_DEC_HANDLE) count_malloc( sizeof( HR_BWE_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HR BWE\n" ) ); + } + + hr_bwe_dec_init( st_fx->hBWE_FD_HR ); + } + ELSE + { + st_fx->hBWE_FD_HR = NULL; + } + + /*----------------------------------------------------------------------------------* + * AMR-WB IO mode parameters + *----------------------------------------------------------------------------------*/ + + IF( st_fx->Opt_AMR_WB || EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE) count_malloc( sizeof( AMRWB_IO_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for AMR-WB IO\n" ) ); + } + + /* AMR-WB IO init */ + amr_wb_dec_init_fx( st_fx->hAmrwb_IO ); + + /* AMR-WB IO HF synth init */ + hf_synth_amr_wb_init_fx( st_fx->hAmrwb_IO ); + } + ELSE + { + st_fx->hAmrwb_IO = NULL; + } + + /*-----------------------------------------------------------------* + * channel-aware mode parameters + *-----------------------------------------------------------------*/ + + set16_fx( st_fx->tilt_code_dec_fx, 0, NB_SUBFR16k ); + st_fx->use_partial_copy = 0; + move16(); + st_fx->prev_use_partial_copy = 0; + move16(); + st_fx->rf_flag = 0; + move16(); + st_fx->rf_flag_last = 0; + move16(); + st_fx->prev_rf_frame_type = 0; + move16(); + st_fx->next_coder_type = 0; + move16(); + st_fx->rf_target_bits = 0; + move16(); + st_fx->rf_indx_nelp_fid = 0; + move16(); + st_fx->rf_indx_nelp_iG1 = 0; + move16(); + st_fx->rf_indx_nelp_iG2[0] = 0; + move16(); + st_fx->rf_indx_nelp_iG2[1] = 0; + move16(); + st_fx->rf_indx_tbeGainFr = 0; + move16(); + + /*-----------------------------------------------------------------* + * Bass post-filter parameters + *-----------------------------------------------------------------*/ + + st_fx->bpf_off = 0; + move16(); + + IF( ( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) + { + IF( ( st_fx->hBPF = (BPF_DEC_HANDLE) malloc( sizeof( BPF_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for BPF\n" ) ); + } + + bass_psfilter_init_fx( st_fx->hBPF ); + } + ELSE + { + st_fx->hBPF = NULL; } -#endif - st_fx->coder_type = GENERIC; /* low-rate mode flag */ - move16(); - st_fx->last_coder_type = GENERIC; - move16(); - st_fx->inactive_coder_type_flag = 0; - move16(); - st_fx->last_L_frame = st_fx->L_frame; - move16(); - st_fx->last_core_brate = st_fx->core_brate; - move16(); - st_fx->last_core = -1; - move16(); - st_fx->last_extl = st_fx->extl; - move16(); - - st_fx->flag_ACELP16k = set_ACELP_flag(st_fx->element_mode, st_fx->total_brate, st_fx->total_brate, idchan, 0, -1, -1); - - /*-----------------------------------------------------------------* - * ACELP core parameters - *-----------------------------------------------------------------*/ - - /* LSF initilaizations */ -#ifdef ISM_DISABLE // Remove once fixed version is present. - // if ( st_fx->ivas_format != ISM_FORMAT ) - // { - //mvr2r(GEWB_Ave, st_fx->mem_AR, M); - - //set_f(st_fx->mem_MA, 0, M); - //set_f(st_fx->dispMem, 0, 8); - //st_fx->tilt_code = 0.0f; - //st_fx->gc_threshold = 0.0f; - //} -#endif - Copy(GEWB_Ave_fx, st_fx->mem_AR_fx, M); - init_lvq_fx(st_fx->offset_scale1_fx, st_fx->offset_scale2_fx, st_fx->offset_scale1_p_fx, st_fx->offset_scale2_p_fx, st_fx->no_scales_fx, st_fx->no_scales_p_fx); + /*-----------------------------------------------------------------* + * FD BPF & resampling tools parameters + *-----------------------------------------------------------------*/ - set16_fx(st_fx->mem_MA_fx, 0, M); + IF( ( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) + { + /* open analysis for max. SR 48kHz */ + IF( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) + { + return error; + } - st_fx->dm_fx.prev_state = 0; - move16(); /* This corresponds to st_fx->dispMem in FLP */ - st_fx->dm_fx.prev_gain_code = L_deposit_l(0); - FOR(i = 2; i < 8; i++) - { - st_fx->dm_fx.prev_gain_pit[i - 2] = 0; - move16(); - } - st_fx->tilt_code_fx = 0; - move16(); - st_fx->gc_threshold_fx = 0; + /* open analysis BPF for max. SR 16kHz */ + IF( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + st_fx->cldfbAna = NULL; + st_fx->cldfbBPF = NULL; + } -#ifdef ISM_DISABLE - if ( st_fx->ivas_format != ISM_FORMAT ) + /* open synthesis for output SR */ + IF( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { - st_fx->last_good = UNVOICED_CLAS; + return error; } -#endif - st_fx->last_good = UNVOICED_CLAS; - move16(); - st_fx->clas_dec = UNVOICED_CLAS; - move16(); - st_fx->low_rate_mode = 0; /* low-rate mode flag */ - st_fx->last_low_rate_mode = 0; /* low-rate mode flag */ - -#ifdef ISM_DISABLE // Remove once fixed version is present. - //if ( st_fx->ivas_format != ISM_FORMAT ) - //{ - //st_fx->lp_gainp = 0.0f; - //st_fx->lp_gainc = 0.0f; - - //set_f(st_fx->old_exc, 0, L_EXC_MEM_DEC); - //} -#endif - st_fx->lp_gainp_fx = 0; + st_fx->cldfbSynHB = NULL; + st_fx->last_active_bandsToZero_bwdec = 0; move16(); - st_fx->lp_gainc_fx = 0; + st_fx->perc_bwddec = 0; + move16(); + st_fx->last_flag_filter_NB = 0; + move16(); + st_fx->active_frame_cnt_bwddec = 0; + move16(); + st_fx->total_frame_cnt_bwddec = 0; move16(); + set16_fx( st_fx->flag_buffer, 0, 20 ); + st_fx->avg_nrg_LT = 0; + move32(); - set16_fx(st_fx->old_exc_fx, 0, L_EXC_MEM_DEC); - -//++To be removed -#ifndef IVAS_FLOAT_FIXED - mvr2r( GEWB_Ave, st_fx->lsf_old, M ); - lsf2lsp( st_fx->lsf_old, st_fx->lsp_old, M, INT_FS_12k8 ); -#endif//IVAS_FLOAT_FIXED -//++To be removed - -#ifdef ISM_DISABLE // Remove once fixed version is present. - if ( st_fx->ivas_format != ISM_FORMAT ) - { - /* AVQ pre-quantizer memory */ - //st_fx->mem_preemp_preQ = 0.0f; - st_fx->last_nq_preQ = 0; - st_fx->last_code_preq = 0; - st_fx->use_acelp_preq = 0; - - -#ifndef IVAS_FLOAT_FIXED - st_fx->stab_fac = 0.0f; - st_fx->mem_deemph = 0.0f; - set_f(st_fx->mem_syn1, 0, M); - set_f(st_fx->mem_syn2, 0, M); - st_fx->stab_fac_smooth = 0.0f; - set_f(st_fx->agc_mem2, 0, 2); - set_f(st_fx->mem_syn3, 0, M); -#endif // #ifndef IVAS_FLOAT_FIXED - - //st_fx->stab_fac_smooth_lt = 0.0f; - //st_fx->log_energy_diff_lt = 0.0f; - //st_fx->log_energy_old = 0.0f; - - // mvr2r(GEWB_Ave, st_fx->lsf_old, M); - // lsf2lsp(st_fx->lsf_old, st_fx->lsp_old, M, INT_FS_12k8); - - st_fx->mid_lsf_int = 0; - st_fx->safety_net = 0; - } -#endif + /*-----------------------------------------------------------------* + * Noise gate parameters + *-----------------------------------------------------------------*/ - /* AVQ pre-quantizer memory */ - st_fx->mem_preemp_preQ_fx = 0; - move16(); - st_fx->last_nq_preQ = 0; - move16(); - st_fx->use_acelp_preq = 0; - move16(); - - st_fx->mem_deemph_fx = 0; - move16(); - - set16_fx(st_fx->mem_syn1_fx, 0, M); - move16(); - set16_fx(st_fx->mem_syn2_fx, 0, M); - st_fx->stab_fac_fx = 0; - move16(); - st_fx->stab_fac_smooth_fx = 0; - move16(); - set16_fx(st_fx->agc_mem_fx, 0, 2); - set16_fx(st_fx->mem_syn3_fx, 0, M); - - st_fx->stab_fac_smooth_lt_fx = 0; - st_fx->log_energy_diff_lt_fx = 0; - st_fx->log_energy_old_fx = 0; - - Copy(GEWB_Ave_fx, st_fx->lsf_old_fx, M); - lsf2lsp_fx(st_fx->lsf_old_fx, st_fx->lsp_old_fx, M, INT_FS_12k8); + set16_fx( st_fx->old_Aq_12_8_fx + 1, 0, M ); + st_fx->old_Aq_12_8_fx[0] = ONE_IN_Q12; + move16(); + st_fx->Ng_ener_ST_fx = -13056; /*-51 IN Q8*/ + move16(); + st_fx->old_Es_pred_fx = 0; + move16(); + set16_fx( st_fx->old_Aq_12_8_fx + 1, 0, M ); + st_fx->old_Aq_12_8_fx[0] = 4096; /*1 in Q12*/ + move16(); - st_fx->mid_lsf_int = 0; - st_fx->safety_net = 0; + /*-----------------------------------------------------------------* + * SC-VBR parameters + *-----------------------------------------------------------------*/ -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) - { - /* FEC */ - st_fx->scaling_flag = 0; - //st_fx->lp_ener_FEC_av_float = 5.0e5f; - //st_fx->lp_ener_FEC_max_float = 5.0e5f; - st_fx->prev_bfi = 0; - //st_fx->lp_ener_bfi = 60.0f; - //st_fx->old_enr_LP_float = 0.0f; - //st_fx->lp_ener = 0.0f; - //st_fx->enr_old = 0.0f; - //st_fx->bfi_pitch = (float)L_SUBFR; - st_fx->bfi_pitch_frame = L_FRAME; - //set_f(st_fx->mem_syn_clas_estim, 0.0f, L_SYN_MEM_CLAS_ESTIM); - st_fx->last_con_tcx = 0; - - //for (i = 0; i < 2 * NB_SUBFR16k; i++) - //{ - // st_fx->old_pitch_buf[i] = (float)L_SUBFR; - //} - - st_fx->upd_cnt = MAX_UPD_CNT; - - //mvr2r(GEWB_Ave, st_fx->lsfoldbfi0, M); - //mvr2r(GEWB_Ave, st_fx->lsfoldbfi1, M); - //mvr2r(GEWB_Ave, st_fx->lsf_adaptive_mean, M); - - st_fx->seed_acelp = RANDOM_INITSEED; - st_fx->seed = RANDOM_INITSEED; - st_fx->nbLostCmpt = 0; - st_fx->decision_hyst = 0; - } -#endif + IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + IF( ( st_fx->hSC_VBR = (SC_VBR_DEC_HANDLE) count_malloc( sizeof( SC_VBR_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SC-VBR\n" ) ); + } - /* FEC */ - st_fx->scaling_flag = 0; - move16(); - st_fx->lp_ener_FEC_av = 500000; - move32(); - st_fx->lp_ener_FEC_max = 500000; - move32(); - st_fx->prev_bfi = 0; - move16(); - st_fx->lp_ener_FER_fx = 15360; - move16(); /*60 in Q8*/ - st_fx->old_enr_LP = 0; - move16(); - st_fx->lp_ener_fx = L_deposit_l(0); - st_fx->enr_old_fx = L_deposit_l(0); - st_fx->bfi_pitch_fx = L_SUBFR_Q6; - move16(); - st_fx->bfi_pitch_frame = L_FRAME; - move16(); - set16_fx(st_fx->mem_syn_clas_estim_fx, 0, L_SYN_MEM_CLAS_ESTIM); - st_fx->classifier_Q_mem_syn = 0; - move16(); - st_fx->last_con_tcx = 0; - move16(); - - FOR(i = 0; i < 2 * NB_SUBFR16k; i++) - { - st_fx->old_pitch_buf_fx[i] = L_SUBFR << 16; - move32(); /*15Q16*/ - } - - st_fx->upd_cnt = MAX_UPD_CNT; - move16(); - Copy(GEWB_Ave_fx, st_fx->lsfoldbfi0_fx, M); - Copy(GEWB_Ave_fx, st_fx->lsfoldbfi1_fx, M); - Copy(GEWB_Ave_fx, st_fx->lsf_adaptive_mean_fx, M); - - st_fx->seed_acelp = RANDOM_INITSEED; - move16(); - st_fx->seed = RANDOM_INITSEED; - move16(); - st_fx->nbLostCmpt = 0; - move16(); - st_fx->decision_hyst = 0; - move16(); - -#ifdef ISM_DISABLE // To be removed when fixed version is available. - /* Stationary noise UV modification */ - if ( st_fx->ivas_format != ISM_FORMAT ) - { - st_fx->unv_cnt = 0; - //st_fx->ge_sm = 10; - st_fx->uv_count = 0; - st_fx->act_count = 3; - - //mvr2r(st_fx->lsp_old, st_fx->lspold_s, M); - st_fx->noimix_seed = RANDOM_INITSEED; - //st_fx->exc_pe = 0; - - st_fx->prev_coder_type = GENERIC; - //st_fx->tilt_wb = 0.0f; - - //st_fx->last_voice_factor = 0.0f; - //set_f(st_fx->prev_synth_buffer, 0, NS2SA(48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS)); - - st_fx->old_bfi_cnt = 0; + sc_vbr_dec_init( st_fx->hSC_VBR ); + } + ELSE + { + st_fx->hSC_VBR = NULL; } -#endif - //st_fx->min_alpha = 1; - st_fx->unv_cnt = 0; - move16(); - st_fx->ge_sm_fx = L_deposit_l(640); /*Q(GE_SHIFT)*/ - st_fx->uv_count = 0; - move16(); - st_fx->act_count = 3; - move16(); - Copy(st_fx->lsp_old_fx, st_fx->lspold_s_fx, M); - st_fx->noimix_seed = RANDOM_INITSEED; - move16(); - st_fx->min_alpha_fx = 32767; - move16(); /*1; Q15*/ - st_fx->exc_pe_fx = 0; - move16(); -#ifdef MSAN_FIX - st_fx->Q_stat_noise = 31; - move16(); -#endif - st_fx->prev_coder_type = GENERIC; - move16(); - - st_fx->tilt_wb_fx = 0; - move16(); - st_fx->last_voice_factor_fx = 0; + st_fx->last_ppp_mode_dec = 0; move16(); - - set16_fx(st_fx->prev_synth_buffer_fx, 0, NS2SA_fx2(48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS)); - st_fx->Qprev_synth_buffer_fx = 15; + st_fx->old_ppp_mode = 0; move16(); - set32_fx(st_fx->prev_synth_buffer32_fx, 0, NS2SA_fx2(48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS)); - - st_fx->old_bfi_cnt = 0; + st_fx->ppp_mode_dec = 0; + move16(); + st_fx->last_nelp_mode_dec = 0; + move16(); + st_fx->nelp_mode_dec = 0; + move16(); + st_fx->prev_gain_pit_dec_fx = 0; + move16(); + st_fx->prev_tilt_code_dec_fx = 0; + move16(); + st_fx->vbr_hw_BWE_disable_dec = 0; + move16(); + st_fx->last_vbr_hw_BWE_disable_dec = 0; move16(); - /*-----------------------------------------------------------------* - * parameters for AC mode (GSC) - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * TCX core + *-----------------------------------------------------------------*/ -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) + /* TCX-LTP */ + IF( ( EQ_16( idchan, 0 ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) ) { - st_fx->GSC_noisy_speech = 0; - st_fx->GSC_IVAS_mode = 0; - st_fx->Last_GSC_noisy_speech_flag = 0; - } -#endif - st_fx->GSC_noisy_speech = 0; - st_fx->GSC_IVAS_mode = 0; - st_fx->Last_GSC_noisy_speech_flag = 0; - - IF((idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) - { - IF((st_fx->hGSCDec = (GSC_DEC_HANDLE)count_malloc(sizeof(GSC_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for GSC\n")); - } -#ifdef ISM_DISABLE // To be removed when fixed version is available. -#ifndef IVAS_FLOAT_FIXED - if ( st_fx->ivas_format != ISM_FORMAT ) - { - GSC_dec_init_ivas(st_fx->hGSCDec); - } -#endif -#endif - GSC_dec_init_ivas_fx(st_fx->hGSCDec); - } - ELSE - { - st_fx->hGSCDec = NULL; - } - - /*-----------------------------------------------------------------* - * parameters for fast recovery (WI) - *-----------------------------------------------------------------*/ - - IF(EQ_32(st_fx->output_Fs, 16000) && EQ_16(st_fx->element_mode, EVS_MONO)) - { - IF((st_fx->hWIDec = (WI_DEC_HANDLE)count_malloc(sizeof(WI_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FEC WI\n")); - } -#ifdef ISM_DISABLE // To be removed when fixed version is available. -#ifndef IVAS_FLOAT_FIXED - if ( st_fx->ivas_format != ISM_FORMAT ) + IF( ( st_fx->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) count_malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) { - set_f(st_fx->hWIDec->old_exc2, 0, L_EXC_MEM); - set_f(st_fx->hWIDec->old_syn2, 0, L_EXC_MEM); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } -#endif -#endif - set16_fx(st_fx->hWIDec->old_exc2_fx, 0, L_EXC_MEM); - set16_fx(st_fx->hWIDec->old_syn2_fx, 0, L_EXC_MEM); - } - ELSE - { - st_fx->hWIDec = NULL; - } - - /* NB post-filter */ - /*-----------------------------------------------------------------* - * NB/formant post-filter - *-----------------------------------------------------------------*/ - IF((idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) - { - IF((st_fx->hPFstat = (PFSTAT_HANDLE)count_malloc(sizeof(PFSTAT))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for NB/formant postflter\n")); - } - -#ifndef IVAS_FLOAT_FIXED - Init_post_filter_ivas(st_fx->hPFstat); - st_fx->psf_lp_noise = 0.0f; -#endif - Init_post_filter_fx(st_fx->hPFstat); - st_fx->psf_lp_noise_fx = 0; - } - ELSE - { - st_fx->hPFstat = NULL; - } - - /*-----------------------------------------------------------------* - * HF (6-7kHz) (zero) BWE parameters - *-----------------------------------------------------------------*/ - - IF((idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) - { - IF((st_fx->hBWE_zero = (ZERO_BWE_DEC_HANDLE)malloc(sizeof(ZERO_BWE_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for zero BWE\n")); - } - - hf_synth_init_fx(st_fx->hBWE_zero); -#ifdef MSAN_FIX - set16_fx( st_fx->hBWE_zero->mem_hp400_fx, 0, 6 ); -#endif - } - ELSE - { - st_fx->hBWE_zero = NULL; - } - - /*-----------------------------------------------------------------* - * LD music post-filter - *-----------------------------------------------------------------*/ - - IF((idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) - { - IF((st_fx->hMusicPF = (MUSIC_POSTFILT_HANDLE)count_malloc(sizeof(MUSIC_POSTFILT_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LD music postflter\n")); - } - -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - music_postfilt_init_flt(st_fx->hMusicPF); -#endif - music_postfilt_init(st_fx->hMusicPF); - } - ELSE - { - st_fx->hMusicPF = NULL; - } - - /*-----------------------------------------------------------------* - * CNG and DTX - *-----------------------------------------------------------------*/ - - st_fx->first_CNG = 0; - move16(); - st_fx->cng_type = -1; - move16(); - st_fx->last_active_brate = ACELP_7k20; - move32(); - st_fx->last_CNG_L_frame = L_FRAME; - move16(); - -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) - { - st_fx->last_vad = 0; } -#endif - st_fx->last_vad_fx = 0; - move16(); - - st_fx->active_cnt = 20; - move16(); - - IF(idchan == 0 && (EQ_16(st_fx->element_mode, EVS_MONO) || EQ_16(st_fx->element_mode, IVAS_CPE_DFT) || EQ_16(st_fx->element_mode, IVAS_CPE_TD))) - { - if ((st_fx->hTdCngDec = (TD_CNG_DEC_HANDLE)count_malloc(sizeof(TD_CNG_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX/TD CNG\n")); - } - -#ifdef IVAS_FLOAT_FIXED - td_cng_dec_init_ivas_fx( st_fx ); -#else - td_cng_dec_init( st_fx ); -#endif // IVAS_FLOAT_FIXED - } - ELSE - { - st_fx->hTdCngDec = NULL; - } - - st_fx->masa_sid_format = 0; - move16(); - st_fx->Q_stat_noise_ge = GE_SHIFT; - move16(); - - /*-----------------------------------------------------------------* - * HQ core parameters - *-----------------------------------------------------------------*/ - - st_fx->prev_old_bfi = 0; - - set16_fx(st_fx->delay_buf_out_fx, 0, HQ_DELTA_MAX* HQ_DELAY_COMP); - set16_fx(st_fx->previoussynth_fx, 0, L_FRAME48k); - - set32_fx(st_fx->delay_buf_out32_fx, 0, HQ_DELTA_MAX* HQ_DELAY_COMP); - set32_fx(st_fx->previoussynth_fx_32, 0, L_FRAME48k); - - IF(EQ_16(st_fx->element_mode, EVS_MONO)) - { - set16_fx(st_fx->old_synth_sw_fx, 0, NS2SA(48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS)); - } - - IF((idchan == 0 || EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) || EQ_16(st_fx->element_mode, IVAS_SCE) || EQ_16(st_fx->element_mode, EVS_MONO))) - { - IF((st_fx->hHQ_core = (HQ_DEC_HANDLE)malloc(sizeof(HQ_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n")); - } - - /* HQ core initialization */ - -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - HQ_core_dec_init_flt(st_fx->hHQ_core); -#endif - HQ_core_dec_init_fx(st_fx->hHQ_core); - - IF(EQ_16(st_fx->element_mode, EVS_MONO)) - { - /* HQ NB FEC initialization */ - IF((st_fx->hHQ_nbfec = (HQ_NBFEC_HANDLE)malloc(sizeof(HQ_NBFEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ NB FEC\n")); - } -#ifndef IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - HQ_nbfec_init_flt(st_fx->hHQ_nbfec); -#endif -#endif - HQ_nbfec_init_fx(st_fx->hHQ_nbfec); - } - ELSE - { - st_fx->hHQ_nbfec = NULL; - move16(); - } - } - ELSE - { - st_fx->hHQ_core = NULL; - st_fx->hHQ_nbfec = NULL; - move16(); move16(); - } - - /*-----------------------------------------------------------------* - * TBE parameters - *-----------------------------------------------------------------*/ - - IF(idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) - { - if ((st_fx->hBWE_TD = (TD_BWE_DEC_HANDLE)malloc(sizeof(TD_BWE_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n")); - } - - td_bwe_dec_init_ivas_fx(st_fx, st_fx->hBWE_TD, st_fx->output_Fs); -#ifdef MSAN_FIX - st_fx->hBWE_TD->prev_hb_synth_fx_exp = 31; -#endif - } - ELSE - { - st_fx->hBWE_TD = NULL; - } - -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) + ELSE { - st_fx->old_bwe_delay = -1; - //set_f(st_fx->hb_prev_synth_buffer, 0, NS2SA(48000, DELAY_BWE_TOTAL_NS)); + st_fx->hTcxLtpDec = NULL; } -#endif - st_fx->old_bwe_delay = -1; /*Q0*/ move16(); - set16_fx(st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_fx2(48000, DELAY_BWE_TOTAL_NS)); - - /*-----------------------------------------------------------------* - * SWB BWE parameters - *-----------------------------------------------------------------*/ - IF(idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) - { - IF((st_fx->hBWE_FD = (FD_BWE_DEC_HANDLE)malloc(sizeof(FD_BWE_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD BWE\n")); - } + /* TCX core */ + IF( EQ_16( idchan, 0 ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) + { + IF( ( st_fx->hTcxDec = (TCX_DEC_HANDLE) malloc( sizeof( TCX_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxDec\n" ) ); + } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - // fd_bwe_dec_init_flt(st_fx->hBWE_FD); -#endif + set32_fx( st_fx->hTcxDec->FBTCXdelayBuf_32, 0, 111 ); - fd_bwe_dec_init(st_fx, st_fx->hBWE_FD); - } - ELSE - { - st_fx->hBWE_FD = NULL; - } - - /*-----------------------------------------------------------------* - * WB/SWB bandwidth switching parameters - *-----------------------------------------------------------------*/ - -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) - { - //st_fx->tilt_swb = 0.0f; - //st_fx->prev_ener_shb = 0.0f; - //st_fx->prev_enerLH = 0.0f; - //st_fx->enerLH = 0.0f; - //st_fx->enerLL = 0.0f; - //st_fx->prev_enerLL = 0.0f; - st_fx->prev_fractive = 0; - st_fx->prev_bws_cnt = 0; - st_fx->bws_cnt = N_WS2N_FRAMES; - st_fx->bws_cnt1 = N_NS2W_FRAMES; + st_fx->hTcxDec->old_synthFB_fx = st_fx->hTcxDec->synth_history_fx + NS2SA( st_fx->output_Fs, PH_ECU_MEM_NS ); + st_fx->hTcxDec->prev_good_synth_fx = st_fx->hTcxDec->old_synthFB_fx + NS2SA( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS ); } -#endif - st_fx->tilt_swb_fx = 0; - move16(); - - st_fx->prev_ener_shb_fx = 0; - move16(); - st_fx->prev_enerLH_fx = 0; - move16(); - st_fx->enerLH_fx = L_deposit_l(0); - st_fx->enerLL_fx = L_deposit_l(0); - st_fx->prev_enerLL_fx = 0; - move16(); - st_fx->prev_fractive = 0; - move16(); - st_fx->prev_bws_cnt = 0; - move16(); - st_fx->bws_cnt = N_WS2N_FRAMES; - move16(); - st_fx->bws_cnt1 = N_NS2W_FRAMES; - move16(); - st_fx->attenu_fx = 3277; - move16(); - - st_fx->last_inner_frame = L_FRAME8k; - move16(); - - /*-----------------------------------------------------------------* - * HR SWB BWE parameters - *-----------------------------------------------------------------*/ - - IF(EQ_16(st_fx->element_mode, EVS_MONO)) - { - IF((st_fx->hBWE_FD_HR = (HR_BWE_DEC_HANDLE)count_malloc(sizeof(HR_BWE_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HR BWE\n")); - } -#ifdef ISM_DISABLE // To be removed when fixed version is available. -#ifndef IVAS_FLOAT_FIXED - if ( st_fx->ivas_format != ISM_FORMAT ) + ELSE + { + st_fx->hTcxDec = NULL; + } + + /* TCX config. data structure */ + IF( ( EQ_16( idchan, 0 ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) ) + { + IF( ( st_fx->hTcxCfg = (TCX_CONFIG_HANDLE) count_malloc( sizeof( TCX_config ) ) ) == NULL ) { - hr_bwe_dec_init_flt(st_fx->hBWE_FD_HR); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n" ) ); } -#endif -#endif - hr_bwe_dec_init(st_fx->hBWE_FD_HR); - } - ELSE - { - st_fx->hBWE_FD_HR = NULL; - } - - /*----------------------------------------------------------------------------------* - * AMR-WB IO mode parameters - *----------------------------------------------------------------------------------*/ - - IF(st_fx->Opt_AMR_WB || EQ_16(st_fx->element_mode, EVS_MONO)) - { - IF((st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE)count_malloc(sizeof(AMRWB_IO_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for AMR-WB IO\n")); - } - -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) + } + ELSE + { + st_fx->hTcxCfg = NULL; + } + + /* Tonal MDCT concealment data structure */ + IF( ( EQ_16( idchan, 0 ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) ) + { + IF( ( st_fx->hTonalMDCTConc = (TonalMDCTConcealPtr) malloc( sizeof( TonalMDCTConceal_INSTANCE ) ) ) == NULL ) { - /* AMR-WB IO init */ - amr_wb_dec_init(st_fx->hAmrwb_IO); - - /* AMR-WB IO HF synth init */ - hf_synth_amr_wb_init(st_fx->hAmrwb_IO); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TonalMDCTConcealment\n" ) ); } -#endif - /* AMR-WB IO init */ - amr_wb_dec_init_fx(st_fx->hAmrwb_IO); - - /* AMR-WB IO HF synth init */ - hf_synth_amr_wb_init_fx(st_fx->hAmrwb_IO); - } - ELSE - { - st_fx->hAmrwb_IO = NULL; - } - - /*-----------------------------------------------------------------* - * channel-aware mode parameters - *-----------------------------------------------------------------*/ - - set16_fx(st_fx->tilt_code_dec_fx, 0, NB_SUBFR16k); - - st_fx->use_partial_copy = 0; - move16(); - st_fx->prev_use_partial_copy = 0; - move16(); - st_fx->rf_flag = 0; - move16(); - st_fx->rf_flag_last = 0; - st_fx->prev_rf_frame_type = 0; - move16(); - st_fx->next_coder_type = 0; - move16(); - - st_fx->rf_target_bits = 0; - move16(); - - st_fx->rf_indx_nelp_fid = 0; - move16(); - st_fx->rf_indx_nelp_iG1 = 0; - move16(); - st_fx->rf_indx_nelp_iG2[0] = 0; - move16(); - st_fx->rf_indx_nelp_iG2[1] = 0; - move16(); - st_fx->rf_indx_tbeGainFr = 0; - move16(); - - - /*-----------------------------------------------------------------* - * Bass post-filter parameters - *-----------------------------------------------------------------*/ - - st_fx->bpf_off = 0; - - IF((idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) - { - IF((st_fx->hBPF = (BPF_DEC_HANDLE)malloc(sizeof(BPF_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for BPF\n")); - } -#ifndef IVAS_FLOAT_FIXED - bass_psfilter_init(st_fx->hBPF); -#endif - bass_psfilter_init_fx(st_fx->hBPF); - } - ELSE - { - st_fx->hBPF = NULL; - } - - /*-----------------------------------------------------------------* - * FD BPF & resampling tools parameters - *-----------------------------------------------------------------*/ - - IF ((idchan == 0 && NE_16(st_fx->element_mode , IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) - { - /* open analysis for max. SR 48kHz */ - IF ((error = openCldfb_ivas_fx(&st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS)) != IVAS_ERR_OK) - { - return error; - } - - /* open analysis BPF for max. SR 16kHz */ - IF ((error = openCldfb_ivas_fx(&st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS)) != IVAS_ERR_OK) - { - return error; - } - } - ELSE { - st_fx->cldfbAna = NULL; - st_fx->cldfbBPF = NULL; - } - - /* open synthesis for output SR */ - IF ((error = openCldfb_ivas_fx(&st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS)) != IVAS_ERR_OK) - { - return error; - } - -#if 0//def IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - if ((idchan == 0 && st_fx->element_mode != IVAS_CPE_MDCT) || st_fx->element_mode == IVAS_CPE_TD) - { - /* open analysis for max. sampling rate 48kHz */ - if ((error = openCldfb_ivas(&st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS)) != IVAS_ERR_OK) - { - return error; - } - - /* open analysis BPF for max. internal sampling rate 16kHz */ - if ((error = openCldfb_ivas(&st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS)) != IVAS_ERR_OK) - { - return error; - } - } - else - { - st_fx->cldfbAna = NULL; - st_fx->cldfbBPF = NULL; - } - - /* open synthesis for output sampling rate */ - if ((error = openCldfb_ivas(&st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS)) != IVAS_ERR_OK) - { - return error; - } -#endif + } + ELSE + { + st_fx->hTonalMDCTConc = NULL; + } - st_fx->cldfbSynHB = NULL; + /*-----------------------------------------------------------------* + * IGF + *-----------------------------------------------------------------*/ - st_fx->last_active_bandsToZero_bwdec = 0; - st_fx->perc_bwddec = 0; - st_fx->last_flag_filter_NB = 0; - st_fx->active_frame_cnt_bwddec = 0; - st_fx->total_frame_cnt_bwddec = 0; - set16_fx(st_fx->flag_buffer, 0, 20); - st_fx->avg_nrg_LT = 0; + IF( ( EQ_16( idchan, 0 ) || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) ) + { + IF( ( st_fx->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for IGF\n" ) ); + } - /*-----------------------------------------------------------------* - * Noise gate parameters - *-----------------------------------------------------------------*/ + st_fx->igf = 0; + move16(); + init_igf_dec( st_fx->hIGFDec ); + } + ELSE + { + st_fx->hIGFDec = NULL; + } -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) + /*-----------------------------------------------------------------* + * Mode 2 initialization + *-----------------------------------------------------------------*/ + IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { - //st_fx->ng_ener_ST = -51.0f; - - //st_fx->old_Es_pred = 0; - //set_f(st_fx->old_Aq_12_8 + 1, 0, M); - //st_fx->old_Aq_12_8[0] = 1; + IF( ( st_fx->hPlcInfo = (T_PLCInfo_HANDLE) malloc( sizeof( T_PLCInfo ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PLC handle\n" ) ); + } } -#endif -#ifdef IVAS_FLOAT_FIXED - set16_fx(st_fx->old_Aq_12_8_fx + 1, 0, M); - st_fx->old_Aq_12_8_fx[0] = ONE_IN_Q12; -#endif - st_fx->Ng_ener_ST_fx = -13056; - move16(); /*-51 IN Q8*/ - st_fx->old_Es_pred_fx = 0; - move16(); - set16_fx(st_fx->old_Aq_12_8_fx + 1, 0, M); - st_fx->old_Aq_12_8_fx[0] = 4096; - move16(); /*1 in Q12*/ - - /*-----------------------------------------------------------------* - * SC-VBR parameters - *-----------------------------------------------------------------*/ - - IF(EQ_16(st_fx->element_mode, EVS_MONO)) - { - IF((st_fx->hSC_VBR = (SC_VBR_DEC_HANDLE)count_malloc(sizeof(SC_VBR_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SC-VBR\n")); - } -#ifndef IVAS_FLOAT_FIXED - if ( st_fx->ivas_format != ISM_FORMAT ) - { - sc_vbr_dec_init_flt(st_fx->hSC_VBR); - } -#endif - sc_vbr_dec_init(st_fx->hSC_VBR); - } - ELSE - { - st_fx->hSC_VBR = NULL; - } - -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) - { - st_fx->last_ppp_mode_dec = 0; - st_fx->old_ppp_mode = 0; - st_fx->ppp_mode_dec = 0; - st_fx->last_nelp_mode_dec = 0; - st_fx->nelp_mode_dec = 0; - //st_fx->prev_gain_pit_dec = 0.0f; - //st_fx->prev_tilt_code_dec = 0.0f; - st_fx->vbr_hw_BWE_disable_dec = 0; - st_fx->last_vbr_hw_BWE_disable_dec = 0; + ELSE + { + st_fx->hPlcInfo = NULL; } -#endif - st_fx->last_ppp_mode_dec = 0; - move16(); - st_fx->old_ppp_mode = 0; - move16(); - st_fx->ppp_mode_dec = 0; - move16(); - st_fx->last_nelp_mode_dec = 0; - move16(); - st_fx->nelp_mode_dec = 0; - move16(); - st_fx->prev_gain_pit_dec_fx = 0; - move16(); - st_fx->prev_tilt_code_dec_fx = 0; - move16(); - st_fx->vbr_hw_BWE_disable_dec = 0; - move16(); - st_fx->last_vbr_hw_BWE_disable_dec = 0; - move16(); - - /*-----------------------------------------------------------------* - * TCX core - *-----------------------------------------------------------------*/ - - /* TCX-LTP */ - IF((idchan == 0 || EQ_16(st_fx->element_mode, IVAS_CPE_MDCT))) - { - IF((st_fx->hTcxLtpDec = (TCX_LTP_DEC_HANDLE)count_malloc(sizeof(TCX_LTP_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n")); - } - } - ELSE - { - st_fx->hTcxLtpDec = NULL; - } - - /* TCX core */ - IF(idchan == 0 || EQ_16(st_fx->element_mode, IVAS_CPE_MDCT)) - { - IF((st_fx->hTcxDec = (TCX_DEC_HANDLE)malloc(sizeof(TCX_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxDec\n")); - } - -#ifndef IVAS_FLOAT_FIXED - set_f(st_fx->hTcxDec->FBTCXdelayBuf_float, 0.0f, 111); - // - st_fx->hTcxDec->old_synthFB = st_fx->hTcxDec->synth_history + NS2SA(st_fx->output_Fs, PH_ECU_MEM_NS); - st_fx->hTcxDec->prev_good_synth = st_fx->hTcxDec->old_synthFB + NS2SA(st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS); -#endif - set32_fx(st_fx->hTcxDec->FBTCXdelayBuf_32, 0, 111); - - st_fx->hTcxDec->old_synthFB_fx = st_fx->hTcxDec->synth_history_fx + NS2SA(st_fx->output_Fs, PH_ECU_MEM_NS); - st_fx->hTcxDec->prev_good_synth_fx = st_fx->hTcxDec->old_synthFB_fx + NS2SA(st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS); - } - ELSE - { - st_fx->hTcxDec = NULL; - } - - /* TCX config. data structure */ - IF((idchan == 0 || EQ_16(st_fx->element_mode, IVAS_CPE_MDCT))) - { - IF((st_fx->hTcxCfg = (TCX_CONFIG_HANDLE)count_malloc(sizeof(TCX_config))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxCfg\n")); - } - } - ELSE - { - st_fx->hTcxCfg = NULL; - } - - /* Tonal MDCT concealment data structure */ - IF((idchan == 0 || EQ_16(st_fx->element_mode, IVAS_CPE_MDCT))) - { - IF ((st_fx->hTonalMDCTConc = (TonalMDCTConcealPtr)malloc(sizeof(TonalMDCTConceal_INSTANCE))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TonalMDCTConcealment\n")); - } - } - ELSE - { - st_fx->hTonalMDCTConc = NULL; - } - - - - /*-----------------------------------------------------------------* - * IGF - *-----------------------------------------------------------------*/ - - IF((idchan == 0 || EQ_16(st_fx->element_mode, IVAS_CPE_MDCT))) - { - IF((st_fx->hIGFDec = (IGF_DEC_INSTANCE_HANDLE)malloc(sizeof(IGFDEC_INSTANCE))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for IGF\n")); - } - - st_fx->igf = 0; - move16(); - init_igf_dec(st_fx->hIGFDec); -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) + + IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + IF( ( st_fx->hTECDec = (TEC_DEC_HANDLE) malloc( sizeof( TEC_DEC_DATA ) ) ) == NULL ) { - init_igf_dec_flt(st_fx->hIGFDec); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TEC\n" ) ); } -#endif - } - ELSE - { - st_fx->hIGFDec = NULL; - } - - /*-----------------------------------------------------------------* - * Mode 2 initialization - *-----------------------------------------------------------------*/ - IF(EQ_16(st_fx->element_mode, EVS_MONO)) - { - IF ((st_fx->hPlcInfo = (T_PLCInfo_HANDLE)malloc(sizeof(T_PLCInfo))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PLC handle\n")); - } - } - ELSE - { - st_fx->hPlcInfo = NULL; - } - - IF(EQ_16(st_fx->element_mode, EVS_MONO)) - { - IF ((st_fx->hTECDec = (TEC_DEC_HANDLE)malloc(sizeof(TEC_DEC_DATA))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TEC\n")); - } - } - ELSE - { - st_fx->hTECDec = NULL; - } - - - - /* Init Decoder */ - Word16 Q_syn_Overl_TDAC = 0, Q_fer_samples = 0, Q_syn_Overl = 0, Q_syn_Overl_TDACFB = 0, Q_syn_OverlFB = 0, Q_old_out = 0, Q_old_outLB = 0, Q_old_Aq_12_8 = 0; - open_decoder_LPD_ivas_fx(st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8); + } + ELSE + { + st_fx->hTECDec = NULL; + } + + /* Init Decoder */ + Word16 Q_syn_Overl_TDAC = 0, Q_fer_samples = 0, Q_syn_Overl = 0, Q_syn_Overl_TDACFB = 0, Q_syn_OverlFB = 0, Q_old_out = 0, Q_old_outLB = 0, Q_old_Aq_12_8 = 0; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + open_decoder_LPD_ivas_fx( st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8 ); #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - open_decoder_LPD(st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1); + open_decoder_LPD( st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1 ); #endif - /* PLC mode initialization */ - st_fx->m_decodeMode = DEC_NO_FRAM_LOSS; - move16(); - - /* Init bandwidth / frame_type */ - st_fx->m_frame_type = ACTIVE_FRAME; - move16(); - st_fx->m_old_frame_type = ACTIVE_FRAME; - move16(); - - IF ((idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT))) - { - resampleCldfb_ivas_fx(st_fx->cldfbAna, L_mult0( st_fx->L_frame, FRAMES_PER_SEC )); - resampleCldfb_ivas_fx(st_fx->cldfbBPF, L_mult0( st_fx->L_frame, FRAMES_PER_SEC )); -#ifdef ISM_DISABLE // To be removed when fixed version is available. - if ( st_fx->ivas_format != ISM_FORMAT ) + /* PLC mode initialization */ + st_fx->m_decodeMode = DEC_NO_FRAM_LOSS; + move16(); + + /* Init bandwidth / frame_type */ + st_fx->m_frame_type = ACTIVE_FRAME; + move16(); + st_fx->m_old_frame_type = ACTIVE_FRAME; + move16(); + + IF( ( EQ_16( idchan, 0 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) ) + { + resampleCldfb_ivas_fx( st_fx->cldfbAna, L_mult0( st_fx->L_frame, FRAMES_PER_SEC ) ); + resampleCldfb_ivas_fx( st_fx->cldfbBPF, L_mult0( st_fx->L_frame, FRAMES_PER_SEC ) ); + } + + /*-----------------------------------------------------------------* + * FD-CNG decoder + *-----------------------------------------------------------------*/ + + IF( ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) || EQ_16( idchan, 0 ) ) && NE_16( mc_mode, MC_MODE_MCT ) && NE_16( mc_mode, MC_MODE_PARAMUPMIX ) ) + { + /* Create FD_CNG instance */ + + IF( ( error = createFdCngDec_fx( &st_fx->hFdCngDec ) ) != IVAS_ERR_OK ) { - resampleCldfb_ivas(st_fx->cldfbAna, st_fx->L_frame * FRAMES_PER_SEC); - resampleCldfb_ivas(st_fx->cldfbBPF, st_fx->L_frame * FRAMES_PER_SEC); + return error; } -#endif - } - /*-----------------------------------------------------------------* - * FD-CNG decoder - *-----------------------------------------------------------------*/ + /* Init FD-CNG */ + initFdCngDec_ivas_fx( st_fx, st_fx->cldfbSyn->scale ); + } + ELSE + { + st_fx->hFdCngDec = NULL; + } - IF((EQ_16(st_fx->element_mode, IVAS_CPE_MDCT) || idchan == 0) && NE_16(mc_mode, MC_MODE_MCT) && NE_16(mc_mode, MC_MODE_PARAMUPMIX)) - { - /* Create FD_CNG instance */ + st_fx->cngTDLevel = 0; + move16(); + st_fx->cngTDLevel_e = 0; + move16(); + st_fx->lp_noise = -167772160l /*-20.f Q23*/; + move32(); + st_fx->force_lpd_reset = 0; + move16(); - IF ((error = createFdCngDec_fx(&st_fx->hFdCngDec)) != IVAS_ERR_OK) - { - return error; - } - /* Init FD-CNG */ -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - initFdCngDec(st_fx); -#endif - initFdCngDec_ivas_fx(st_fx, st_fx->cldfbSyn->scale); - } - ELSE - { - st_fx->hFdCngDec = NULL; - } - - st_fx->cngTDLevel = 0; - move16(); - st_fx->cngTDLevel_e = 0; - move16(); - st_fx->lp_noise = -167772160l/*-20.f Q23*/; - st_fx->force_lpd_reset = 0; - move16(); - -#ifdef ISM_DISABLE // To be removed when fixed version is available. - //if ( st_fx->ivas_format != ISM_FORMAT ) - //{ - //st_fx->cngTDLevel_float = 0.f; - //st_fx->lp_noise_float = -20.0f; - //} -#endif + /*-----------------------------------------------------------------* + * initialzie Q values + *-----------------------------------------------------------------*/ - /*-----------------------------------------------------------------* - * initialzie Q values - *-----------------------------------------------------------------*/ - - st_fx->Q_syn2 = 0; - move16(); - st_fx->Q_exc = 8; - st_fx->prev_Q_exc = 0; - move16(); - st_fx->Q_syn = 0; - move16(); - st_fx->prev_Q_syn = 0; - move16(); - - FOR(i = 0; i < L_Q_MEM; i++) - { - st_fx->Q_subfr[i] = 8; - move16(); - } + st_fx->Q_syn2 = 0; + move16(); + st_fx->Q_exc = 8; + move16(); + st_fx->prev_Q_exc = 0; + move16(); + st_fx->Q_syn = 0; + move16(); + st_fx->prev_Q_syn = 0; + move16(); - st_fx->prev_Q_exc_fr = 0; - move16(); - st_fx->prev_Q_syn_fr = 0; - move16(); + FOR( i = 0; i < L_Q_MEM; i++ ) + { + st_fx->Q_subfr[i] = 8; + move16(); + } - /*-----------------------------------------------------------------* - * IVAS parameters - *-----------------------------------------------------------------*/ + st_fx->prev_Q_exc_fr = 0; + move16(); + st_fx->prev_Q_syn_fr = 0; + move16(); - st_fx->tdm_LRTD_flag = 0; /* LRTD stereo mode flag */ - st_fx->cna_dirac_flag = 0; /* CNA in DirAC flag */ - st_fx->cng_sba_flag = 0; /* CNG in SBA flag */ - st_fx->cng_ism_flag = 0; + /*-----------------------------------------------------------------* + * IVAS parameters + *-----------------------------------------------------------------*/ - return error; + st_fx->tdm_LRTD_flag = 0; /* LRTD stereo mode flag */ + move16(); + st_fx->cna_dirac_flag = 0; /* CNA in DirAC flag */ + move16(); + st_fx->cng_sba_flag = 0; /* CNG in SBA flag */ + move16(); + st_fx->cng_ism_flag = 0; + move16(); + return error; } - /*----------------------------------------------------------------------* * reset_preecho_dec() * diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index fc2bf862c..e25cfe2bc 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -333,13 +333,6 @@ ivas_error ivas_core_dec( fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, 0, L_FRAME32k ); } } - IF( sts[0]->element_mode == IVAS_CPE_MDCT && sts[0]->total_brate == SID_2k40 ) - { - FOR( Word16 ch = 0; ch < CPE_CHANNELS; ++ch ) - { - me2f_buf( sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand ); - } - } #endif @@ -634,21 +627,6 @@ ivas_error ivas_core_dec( { sts[ch]->hFdCngDec->msNoiseEst_float[p] = ( (float) sts[ch]->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); } - - for ( int p = 0; p < s_min( 340, sts[ch]->hFdCngDec->hFdCngCom->stopFFTbin - sts[ch]->hFdCngDec->hFdCngCom->startBand ); p++ ) - { - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - } - } - else if ( ( ( sts[ch]->bfi == 1 ) && ( sts[ch]->nbLostCmpt == 1 ) ) && ( sum_f( sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt + sts[ch]->hFdCngDec->hFdCngCom->startBand, sts[ch]->hFdCngDec->hFdCngCom->stopFFTbin - sts[ch]->hFdCngDec->hFdCngCom->startBand ) > 0.01f ) ) - { - if ( sts[ch]->element_mode == IVAS_CPE_MDCT && sts[ch]->core != ACELP_CORE ) - { - for ( int p = 0; p < s_min( 340, sts[ch]->hFdCngDec->hFdCngCom->stopFFTbin - sts[ch]->hFdCngDec->hFdCngCom->startBand ); p++ ) - { - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = ( (float) sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - } - } } } @@ -722,11 +700,6 @@ ivas_error ivas_core_dec( sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 27; TonalMdctConceal_whiten_noise_shape_ivas_fx( sts[n], L_FRAME16k, ON_FIRST_GOOD_FRAME ); - - for ( int p = 0; p < sts[n]->hFdCngDec->hFdCngCom->stopFFTbin - sts[n]->hFdCngDec->hFdCngCom->startBand; p++ ) - { - sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[p] = (float) sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel[p] / ( 1u << ( 31 - sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ); - } } } } diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index e3bb1fe3d..2fa750755 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -589,14 +589,6 @@ ivas_error ivas_cpe_dec_fx( } } - IF( sts[0]->element_mode == IVAS_CPE_MDCT && sts[0]->total_brate == SID_2k40 ) - { - FOR(Word16 ch = 0; ch < CPE_CHANNELS; ++ch) - { - f2me_buf(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, &sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, sts[ch]->hFdCngDec->hFdCngCom->stopBand - sts[ch]->hFdCngDec->hFdCngCom->startBand); - } - } - #endif /* core decoder */ @@ -658,14 +650,8 @@ ivas_error ivas_cpe_dec_fx( q_dft = hCPE->hStereoDft->q_dft; //TODO : To check this - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel = Q31 - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp; stereo_dtf_cng_fx( hCPE, ivas_total_brate, DFT_fx, output_frame, q_dft ); - - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[0], - &hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[0], - hCPE->hCoreCoder[0]->hFdCngDec->hFdCngCom->q_cngNoiseLevel, - FFTCLDFBLEN ); } /* decoding */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 80f3e11ed..5ec1d414c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -750,14 +750,14 @@ static ivas_error ivas_dirac_rend_config_fx( } ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( !hDirACRend->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) { - ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close_fx( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); } ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->proto_signal_decorr_on && proto_signal_decorr_on_old ) { IF( NE_16( nchan_transport, nchan_transport_old ) || NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) || EQ_16( flag_config_inp, DIRAC_RECONFIGURE_MODE ) ) { /* close and reopen the decorrelator */ - ivas_dirac_dec_decorr_close( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close_fx( &hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state ); #ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDirACRend->h_freq_domain_decorr_ap_params ), &( hDirACRend->h_freq_domain_decorr_ap_state ), hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff, hDirACRend->num_protos_diff, hDirACRend->synthesisConf, hDirACRend->frequency_axis_fx, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) @@ -1729,7 +1729,7 @@ ivas_error ivas_dirac_dec_config_fx( /* This is required to keep BE in rate switching. This probably means that 1TC and 2TC MASA perform differently. */ IF( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params != NULL && !( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nSCE > 0 ) ) { - ivas_dirac_dec_decorr_close( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ); // done + ivas_dirac_dec_decorr_close_fx( &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params, &st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ); // done } IF( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 6aa3e6b78..0e22492ac 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -289,8 +289,7 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( } return; } -#endif // IVAS_FLOAT_FIXED - +#else void ivas_ism_dtx_limit_noise_energy_for_near_silence( SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ @@ -328,3 +327,4 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence( return; } +#endif diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 289027ca4..d94f11435 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -233,33 +233,15 @@ ivas_error ivas_jbm_dec_tc( } #ifdef IVAS_FLOAT_FIXED -#if 1 Word16 Q_cngNoiseLevel[MAX_SCE]; - Word16 cng_noise_level_len, ch; - HANDLE_FD_CNG_COM hFdCngCom; - FOR( ch = 0; ch < 4; ch++ ) + FOR( Word16 ch = 0; ch < 4; ch++ ) { IF( st_ivas->hSCE[ch] != NULL ) { - hFdCngCom = st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom; - cng_noise_level_len = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); - Q_cngNoiseLevel[ch] = Q_factor_arrL( hFdCngCom->cngNoiseLevel_flt, cng_noise_level_len ); - floatToFixed_arrL( hFdCngCom->cngNoiseLevel_flt, hFdCngCom->cngNoiseLevel, Q_cngNoiseLevel[ch], cng_noise_level_len ); + Q_cngNoiseLevel[ch] = sub(31, st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp); } } -#endif ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( st_ivas->hSCE, st_ivas->hISMDTX.sce_id_dtx, st_ivas->nchan_transport, Q_cngNoiseLevel ); -#if 1 - FOR( ch = 0; ch < 4; ch++ ) - { - IF( st_ivas->hSCE[ch] != NULL ) - { - hFdCngCom = st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom; - cng_noise_level_len = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); - fixedToFloat_arrL( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel_flt, Q_cngNoiseLevel[ch], cng_noise_level_len ); - } - } -#endif #endif // IVAS_FLOAT_FIXED } ELSE IF( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -3325,27 +3307,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( { nchan_transport = 1; /* Only one channel transported */ } - - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Word32 max_cngNoiseLevel = 0; - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - FOR( i = 0; i < FFTCLDFBLEN; i++ ) - { - max_cngNoiseLevel = L_max( L_abs( (Word32) st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[i] ), max_cngNoiseLevel ); - } - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = norm_l( max_cngNoiseLevel ); - - //floatToFixed_arr( st->hFdCngDec->hFdCngCom->A_cng_flt, st->hFdCngDec->hFdCngCom->A_cng, Q13, M + 1 ); - - floatToFixed_arrL( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN ); - - //for ( i = 0; i < FFTLEN; i++ ) - //{ - // st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx[i] = float_to_fix( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt[i], 15 ); - //} - } #endif ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); @@ -3487,27 +3448,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( { nchan_transport = 1; /* Only one channel transported */ } - - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Word32 max_cngNoiseLevel = 0; - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - FOR( i = 0; i < FFTCLDFBLEN; i++ ) - { - max_cngNoiseLevel = L_max( L_abs( (Word32) st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[i] ), max_cngNoiseLevel ); - } - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = norm_l( max_cngNoiseLevel ); - - //floatToFixed_arr( st->hFdCngDec->hFdCngCom->A_cng_flt, st->hFdCngDec->hFdCngCom->A_cng, Q13, M + 1 ); - - floatToFixed_arrL( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN ); - - //for ( i = 0; i < FFTLEN; i++ ) - //{ - // st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx[i] = float_to_fix( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt[i], 15 ); - //} - } #endif ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 @@ -3624,27 +3564,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( { nchan_transport = 1; /* Only one channel transported */ } - - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Word32 max_cngNoiseLevel = 0; - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - FOR( i = 0; i < FFTCLDFBLEN; i++ ) - { - max_cngNoiseLevel = L_max( L_abs( (Word32) st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[i] ), max_cngNoiseLevel ); - } - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = norm_l( max_cngNoiseLevel ); - - //floatToFixed_arr( st->hFdCngDec->hFdCngCom->A_cng_flt, st->hFdCngDec->hFdCngCom->A_cng, Q13, M + 1 ); - - floatToFixed_arrL( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN ); - - //for ( i = 0; i < FFTLEN; i++ ) - //{ - // st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx[i] = float_to_fix( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt[i], 15 ); - //} - } #endif ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 @@ -3692,10 +3611,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - //fixedToFloat_arrL(st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, 15, st->hFdCngDec->hFdCngCom->fftlen); - - //fixedToFloat_arrL( st->hFdCngDec->hFdCngCom->exc_cng_32fx, st->hFdCngDec->hFdCngCom->exc_cng_flt, 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); } #endif @@ -3763,27 +3679,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( { nchan_transport = 1; /* Only one channel transported */ } - - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Word32 max_cngNoiseLevel = 0; - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - FOR( i = 0; i < FFTCLDFBLEN; i++ ) - { - max_cngNoiseLevel = L_max( L_abs( (Word32) st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[i] ), max_cngNoiseLevel ); - } - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = norm_l( max_cngNoiseLevel ); - - //floatToFixed_arr( st->hFdCngDec->hFdCngCom->A_cng_flt, st->hFdCngDec->hFdCngCom->A_cng, Q13, M + 1 ); - - floatToFixed_arrL( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN ); - - //for ( i = 0; i < FFTLEN; i++ ) - //{ - // st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx[i] = float_to_fix( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt[i], 15 ); - //} - } #endif ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 @@ -4016,27 +3911,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( { nchan_transport = 1; /* Only one channel transported */ } - - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Word32 max_cngNoiseLevel = 0; - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - FOR( i = 0; i < FFTCLDFBLEN; i++ ) - { - max_cngNoiseLevel = L_max( L_abs( (Word32) st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[i] ), max_cngNoiseLevel ); - } - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = norm_l( max_cngNoiseLevel ); - - //floatToFixed_arr( st->hFdCngDec->hFdCngCom->A_cng_flt, st->hFdCngDec->hFdCngCom->A_cng, Q13, M + 1 ); - - floatToFixed_arrL( st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, FFTCLDFBLEN ); - - //for ( i = 0; i < FFTLEN; i++ ) - //{ - // st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx[i] = float_to_fix( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt[i], 15 ); - //} - } #endif ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 4d13c4049..c55f1b039 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1512,7 +1512,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( Word16 len; /* close decorrelator */ - ivas_dirac_dec_decorr_close( &hParamMC->h_freq_domain_decorr_ap_params, &hParamMC->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close_fx( &hParamMC->h_freq_domain_decorr_ap_params, &hParamMC->h_freq_domain_decorr_ap_state ); /* deallocate diffuse prototype info */ IF ( hParamMC->diff_proto_info ) @@ -1586,10 +1586,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx, len ); set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx, len ); hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector = Q31; -#if 1/*To be removed later*/ - set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1, len ); - set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2, len ); -#endif } } hParamMC->max_band_energy_compensation = hParamMC->band_grouping[hParamMC->hMetadataPMC->nbands_coded]; @@ -2363,7 +2359,7 @@ void ivas_param_mc_dec_close_fx( IF( hParamMC->h_freq_domain_decorr_ap_params != NULL || hParamMC->h_freq_domain_decorr_ap_state != NULL ) { - ivas_dirac_dec_decorr_close( &hParamMC->h_freq_domain_decorr_ap_params, &hParamMC->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close_fx( &hParamMC->h_freq_domain_decorr_ap_params, &hParamMC->h_freq_domain_decorr_ap_state ); } /* parameter decoding */ @@ -4528,10 +4524,6 @@ static void ivas_param_mc_dec_init_fx( set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1_fx, len ); set_zero_fx( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2_fx, len ); hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector = Q31; -#if 1/*Floating point intialization: to be removed later*/ - set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_1, len ); - set_zero( hParamMC->h_freq_domain_decorr_ap_state->h_onset_detection_power_state.onset_detector_2, len ); -#endif } max_param_band_residual = 0; diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index b27f665e3..c49a1fac3 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -243,11 +243,6 @@ ivas_error ivas_sce_dec_fx( floatToFixed_arr(st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, 0, L_FRAME32k); floatToFixed_arrL(st->hHQ_core->old_outLB, st->hHQ_core->old_outLB_fx, 11, L_FRAME32k); } - - IF(st->hFdCngDec != NULL && (st->element_mode == IVAS_CPE_MDCT && st->total_brate == SID_2k40)) - { - f2me_buf(st->hFdCngDec->hFdCngCom->cngNoiseLevel_flt, st->hFdCngDec->hFdCngCom->cngNoiseLevel, &st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, st->hFdCngDec->hFdCngCom->stopBand - st->hFdCngDec->hFdCngCom->startBand); - } #endif set32_fx(output[0], 0, L_FRAME48k); diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 21fda4add..c103dff09 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1200,7 +1200,7 @@ static void stereo_dft_generate_comfort_noise_fx( lp_noise = 0; move32(); ptr_level = hFdCngCom->cngNoiseLevel + sub(sub(hFdCngCom->stopFFTbin , hFdCngCom->startBand) , 1); ptr_tmp = cngNoiseLevel_upd + sub(shr(sub( hFdCngCom->stopFFTbin , hFdCngCom->startBand ) , 1) , 1); - rshift_cng = sub(hFdCngCom->q_cngNoiseLevel, sub(shl(q_cngNoiseLevel_upd, 1), Q31)); + rshift_cng = sub(sub(31, hFdCngCom->cngNoiseLevelExp), sub(shl(q_cngNoiseLevel_upd, 1), Q31)); FOR ( i = 0; i < shr(sub( hFdCngCom->stopFFTbin , hFdCngCom->startBand ) , 1); i++ ) { IF (norm_l(*ptr_tmp) >= rshift_cng) @@ -1252,7 +1252,7 @@ static void stereo_dft_generate_comfort_noise_fx( ptr_level = hFdCngCom->cngNoiseLevel; ptr_r = DFT[chan] + hFdCngCom->startBand + k * STEREO_DFT32MS_N_MAX; ptr_i = ptr_r + 1; - q_cngNoiseLevel = hFdCngCom->q_cngNoiseLevel; + q_cngNoiseLevel = sub(Q31, hFdCngCom->cngNoiseLevelExp); FOR( i = 0; i < shr( sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), 1 ); i++ ) { Word16 q_sqrt; @@ -1318,7 +1318,7 @@ static void stereo_dft_generate_comfort_noise_fx( IF( hStereoCng->last_act_element_mode == IVAS_CPE_TD && chan > 0 ) { - Word32 log_lp_noise = L_add( L_shl( sub( Q31, hFdCngCom->q_cngNoiseLevel ), Q25 ), BASOP_Util_Log2( lp_noise + DELTA_FX ) ); + Word32 log_lp_noise = L_add( L_shl( hFdCngCom->cngNoiseLevelExp, Q25 ), BASOP_Util_Log2( lp_noise + DELTA_FX ) ); // log10(x) is computed as log2(x) * log10(2) // log_lp_noise at this stage is in Q25. where as the structure value is in Q23 // Hence the 16-bit constant log10(2) will be stored in Q13 @@ -1329,7 +1329,7 @@ static void stereo_dft_generate_comfort_noise_fx( ELSE IF( EQ_16( chan, 0 ) ) { Word16 q_lp_noise = 0; // st->hFdCngDec->q_lp_noise; // to be populated appropriately. - Word32 log_lp_noise = L_add( L_shl( sub( Q31, hFdCngCom->q_cngNoiseLevel ), Q25 ), BASOP_Util_Log2( lp_noise + DELTA_FX ) ); + Word32 log_lp_noise = L_add( L_shl( hFdCngCom->cngNoiseLevelExp, Q25 ), BASOP_Util_Log2( lp_noise + DELTA_FX ) ); move16(); // log10(x) is computed as log2(x) * log10(2) // log_lp_noise at this stage is in Q25. where as the structure value is in Q23 @@ -1353,7 +1353,7 @@ static void stereo_dft_generate_comfort_noise_fx( /* update smoothed periodogram used by stereo CNA in SID and NO_DATA frames from cngNoiseLevel_flt */ FOR( i = hFdCngCom->startBand; i < hFdCngCom->stopFFTbin; i++ ) { - Word16 l_shift_val = sub(st->hFdCngDec->q_smoothed_psd, hFdCngCom->q_cngNoiseLevel); + Word16 l_shift_val = sub(st->hFdCngDec->q_smoothed_psd, sub(Q31, hFdCngCom->cngNoiseLevelExp)); move16(); l_shift_val = max_smoothed_psd == 0 ? 0 :l_shift_val; ftmp = hFdCngCom->cngNoiseLevel[i - hFdCngCom->startBand]; diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 744bfea7b..328cfaab7 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -1836,7 +1836,7 @@ static bool shrink_frm( frm_in += l_frm; #ifdef IVAS_FLOAT_FIXED - Word16 frm_in_fx[960*4]; + Word16 frm_in_fx[APA_BUF]; for ( i = 0; i < l_frm/*960*ps->num_channels*/; i++ ) { frm_in_fx[i] = (Word16) frm_in[i]; diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 640e19ee7..d709b697f 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -149,16 +149,28 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->tcx_cfg = hTcxCfg; hTonalMDCTConc->lastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[0]; +#ifdef MSAN_FIX + set_s(hTonalMDCTConc->lastBlockData.spectralData, 0, L_FRAME_MAX); +#endif move16(); hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[1]; +#ifdef MSAN_FIX + set_s( hTonalMDCTConc->secondLastBlockData.spectralData, 0, L_FRAME_MAX ); +#endif move16(); hTonalMDCTConc->secondLastPowerSpectrum = hTonalMDCTConc->secondLastBlockData.spectralData; move16(); hTonalMDCTConc->secondLastPowerSpectrum_exp = hTonalMDCTConc->secondLastBlockData.spectralData_exp; move16(); hTonalMDCTConc->lastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[0]; +#ifdef MSAN_FIX + set_s(hTonalMDCTConc->lastBlockData.scaleFactors, 0, FDNS_NPTS); +#endif move16(); hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; +#ifdef MSAN_FIX + set_s(hTonalMDCTConc->secondLastBlockData.scaleFactors, 0, FDNS_NPTS); +#endif move16(); hTonalMDCTConc->lastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[0]; move16(); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 3fb71bb4d..15a45f4a7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -481,7 +481,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) { - ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close_fx( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); } if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) @@ -563,7 +563,7 @@ void ivas_dirac_dec_close_binaural_data( ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); IF( ( *hBinaural )->h_freq_domain_decorr_ap_params != NULL ) { - ivas_dirac_dec_decorr_close( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); + ivas_dirac_dec_decorr_close_fx( &( *hBinaural )->h_freq_domain_decorr_ap_params, &( *hBinaural )->h_freq_domain_decorr_ap_state ); } free( *hBinaural ); @@ -1118,7 +1118,6 @@ static void ivas_dirac_dec_binaural_internal( const int16_t subframe ) { #if 1 - double maxim = 0; Word16 q_input = 11; #ifdef MSAN_FIX_ Word16 nchan_tc; @@ -1167,21 +1166,6 @@ static void ivas_dirac_dec_binaural_internal( IF( abs_s( (Word16) st_ivas->cldfbAnaDec[1]->scale_flt ) != 0 ) st_ivas->cldfbAnaDec[1]->q_scale = norm_s( (Word16) st_ivas->cldfbAnaDec[1]->scale_flt ); st_ivas->cldfbAnaDec[1]->scale = (Word16) ( st_ivas->cldfbAnaDec[1]->scale_flt * ( 1 << st_ivas->cldfbAnaDec[1]->q_scale ) ); - maxim = 0; - IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] ) - FOR( Word16 ind = 0; ind < FFTCLDFBLEN; ind++ ) - { - maxim = fmax( maxim, fabs( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] ) ); - } - IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] ) - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 0; - IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] && L_abs( (Word32) maxim ) != 0 ) - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - norm_l( (Word32) maxim ); - IF( st_ivas->hSCE[0] && st_ivas->hSCE[0]->hCoreCoder[0] ) - FOR( Word16 ind = 0; ind < FFTCLDFBLEN; ind++ ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel[ind] = (Word32) ( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel_flt[ind] * ( 1LL << ( 31 - st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) ) ); - } Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME] = { 0 }; FOR( Word16 ind = 0; ind < 6; ind++ ) { diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 607bbce5e..b476af9e3 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -1493,6 +1493,181 @@ void ivas_dirac_dec_decorr_process_fx( * *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_dec_decorr_close_fx( + HANDLE_DIRAC_DECORR_PARAMS *ph_freq_domain_decorr_ap_params, + HANDLE_DIRAC_DECORR_STATE *ph_freq_domain_decorr_ap_state) +{ + DIRAC_ONSET_DETECTION_STATE *dirac_onset_detection_state; + + /*-----------------------------------------------------------------* + * check input handles + *-----------------------------------------------------------------*/ + + if (ph_freq_domain_decorr_ap_params == NULL || ph_freq_domain_decorr_ap_state == NULL) + { + return; + } + + if (*ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL) + { + return; + } + + /*-----------------------------------------------------------------* + * free onset filter arrays + *-----------------------------------------------------------------*/ + + dirac_onset_detection_state = &(*ph_freq_domain_decorr_ap_state)->h_onset_detection_power_state; + +#ifdef IVAS_FLOAT_FIXED + IF(dirac_onset_detection_state->onset_detector_1_fx != NULL) + { + free(dirac_onset_detection_state->onset_detector_1_fx); + dirac_onset_detection_state->onset_detector_1_fx = NULL; + } + + IF(dirac_onset_detection_state->onset_detector_2_fx != NULL) + { + free(dirac_onset_detection_state->onset_detector_2_fx); + dirac_onset_detection_state->onset_detector_2_fx = NULL; + } +#endif + + /*-----------------------------------------------------------------* + * memory deallocation + *-----------------------------------------------------------------*/ + + /* free decorrelation buffer */ + if ((*ph_freq_domain_decorr_ap_state)->decorr_buffer != NULL) + { + free((*ph_freq_domain_decorr_ap_state)->decorr_buffer); + (*ph_freq_domain_decorr_ap_state)->decorr_buffer = NULL; + } + + /* free ducker smoothed direct energy buffer */ + if ((*ph_freq_domain_decorr_ap_state)->direct_energy_smooth != NULL) + { + free((*ph_freq_domain_decorr_ap_state)->direct_energy_smooth); + (*ph_freq_domain_decorr_ap_state)->direct_energy_smooth = NULL; + } + + /* free ducker smoothed reverb energy buffer */ + if ((*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth != NULL) + { + free((*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth); + (*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth = NULL; + } + +#ifdef IVAS_FLOAT_FIXED + IF((*ph_freq_domain_decorr_ap_state)->decorr_buffer_fx != NULL) + { + free((*ph_freq_domain_decorr_ap_state)->decorr_buffer_fx); + (*ph_freq_domain_decorr_ap_state)->decorr_buffer_fx = NULL; + } + + /* free ducker smoothed direct energy buffer */ + IF((*ph_freq_domain_decorr_ap_state)->direct_energy_smooth_fx != NULL) + { + free((*ph_freq_domain_decorr_ap_state)->direct_energy_smooth_fx); + (*ph_freq_domain_decorr_ap_state)->direct_energy_smooth_fx = NULL; + } + + /* free ducker smoothed reverb energy buffer */ + IF((*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth_fx != NULL) + { + free((*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth_fx); + (*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth_fx = NULL; + } +#endif + + /* free pre-delay param buffer */ + if ((*ph_freq_domain_decorr_ap_params)->pre_delay != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->pre_delay); + (*ph_freq_domain_decorr_ap_params)->pre_delay = NULL; + } + + /* free filter length param buffer */ + if ((*ph_freq_domain_decorr_ap_params)->filter_length != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->filter_length); + (*ph_freq_domain_decorr_ap_params)->filter_length = NULL; + } + + /* free filter coeff param buffers */ + if ((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real); + (*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real = NULL; + } + + /* free pre-delay param buffer */ + if ((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real); + (*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real = NULL; + } + + /* free pre-delay param buffer */ + if ((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag); + (*ph_freq_domain_decorr_ap_params)->phase_coeff_imag = NULL; + } + + /* free pre-delay param buffer */ + if ((*ph_freq_domain_decorr_ap_params)->phase_coeff_real != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->phase_coeff_real); + (*ph_freq_domain_decorr_ap_params)->phase_coeff_real = NULL; + } + + /* free pre-delay param buffer */ + if ((*ph_freq_domain_decorr_ap_params)->split_frequency_bands != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->split_frequency_bands); + (*ph_freq_domain_decorr_ap_params)->split_frequency_bands = NULL; + } + +#ifdef IVAS_FLOAT_FIXED + IF((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real_fx != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real_fx); + (*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real_fx = NULL; + } + + IF((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real_fx != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real_fx); + (*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real_fx = NULL; + } + + /* free pre-delay param buffer */ + IF((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag_fx != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag_fx); + (*ph_freq_domain_decorr_ap_params)->phase_coeff_imag_fx = NULL; + } + + /* free pre-delay param buffer */ + IF((*ph_freq_domain_decorr_ap_params)->phase_coeff_real_fx != NULL) + { + free((*ph_freq_domain_decorr_ap_params)->phase_coeff_real_fx); + (*ph_freq_domain_decorr_ap_params)->phase_coeff_real_fx = NULL; + } +#endif + /* free pointers to state and parameter structs */ + free(*ph_freq_domain_decorr_ap_params); + *ph_freq_domain_decorr_ap_params = NULL; + + free(*ph_freq_domain_decorr_ap_state); + *ph_freq_domain_decorr_ap_state = NULL; + + return; +} +#else + void ivas_dirac_dec_decorr_close( HANDLE_DIRAC_DECORR_PARAMS *ph_freq_domain_decorr_ap_params, HANDLE_DIRAC_DECORR_STATE *ph_freq_domain_decorr_ap_state ) @@ -1530,19 +1705,6 @@ void ivas_dirac_dec_decorr_close( free(dirac_onset_detection_state->onset_detector_2); dirac_onset_detection_state->onset_detector_2 = NULL; } -#ifdef IVAS_FLOAT_FIXED - IF( dirac_onset_detection_state->onset_detector_1_fx != NULL ) - { - free( dirac_onset_detection_state->onset_detector_1_fx ); - dirac_onset_detection_state->onset_detector_1_fx = NULL; - } - - IF( dirac_onset_detection_state->onset_detector_2_fx != NULL ) - { - free( dirac_onset_detection_state->onset_detector_2_fx ); - dirac_onset_detection_state->onset_detector_2_fx = NULL; - } -#endif /*-----------------------------------------------------------------* * memory deallocation @@ -1569,28 +1731,6 @@ void ivas_dirac_dec_decorr_close( (*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth = NULL; } -#ifdef IVAS_FLOAT_FIXED - IF( ( *ph_freq_domain_decorr_ap_state )->decorr_buffer_fx != NULL ) - { - free( ( *ph_freq_domain_decorr_ap_state )->decorr_buffer_fx ); - ( *ph_freq_domain_decorr_ap_state )->decorr_buffer_fx = NULL; - } - - /* free ducker smoothed direct energy buffer */ - IF( ( *ph_freq_domain_decorr_ap_state )->direct_energy_smooth_fx != NULL ) - { - free( ( *ph_freq_domain_decorr_ap_state )->direct_energy_smooth_fx ); - ( *ph_freq_domain_decorr_ap_state )->direct_energy_smooth_fx = NULL; - } - - /* free ducker smoothed reverb energy buffer */ - IF( ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth_fx != NULL ) - { - free( ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth_fx ); - ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth_fx = NULL; - } -#endif - /* free pre-delay param buffer */ if ((*ph_freq_domain_decorr_ap_params)->pre_delay != NULL) { @@ -1640,33 +1780,6 @@ void ivas_dirac_dec_decorr_close( (*ph_freq_domain_decorr_ap_params)->split_frequency_bands = NULL; } -#ifdef IVAS_FLOAT_FIXED - IF( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_num_real_fx != NULL ) - { - free( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_num_real_fx ); - ( *ph_freq_domain_decorr_ap_params )->filter_coeff_num_real_fx = NULL; - } - - IF( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_den_real_fx != NULL ) - { - free( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_den_real_fx ); - ( *ph_freq_domain_decorr_ap_params )->filter_coeff_den_real_fx = NULL; - } - - /* free pre-delay param buffer */ - IF( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_imag_fx != NULL ) - { - free( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_imag_fx ); - ( *ph_freq_domain_decorr_ap_params )->phase_coeff_imag_fx = NULL; - } - - /* free pre-delay param buffer */ - IF( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real_fx != NULL ) - { - free( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real_fx ); - ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real_fx = NULL; - } -#endif /* free pointers to state and parameter structs */ free(*ph_freq_domain_decorr_ap_params); *ph_freq_domain_decorr_ap_params = NULL; @@ -1677,6 +1790,7 @@ void ivas_dirac_dec_decorr_close( return; } +#endif // IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * Local functions *------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index d2aec25dd..0f0eb51a4 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -164,21 +164,6 @@ ivas_error ivas_dirac_dec_onset_detection_open( dirac_onset_detection_params->max_band_decorr = max_band_decorr; /* memory allocation */ -#ifdef IVAS_FLOAT_FIXED - IF((dirac_onset_detection_state->onset_detector_1_fx = (Word32 *)malloc(sizeof(Word32) * num_protos_diff * dirac_onset_detection_params->max_band_decorr)) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n")); - } - IF((dirac_onset_detection_state->onset_detector_2_fx = (Word32 *)malloc(sizeof(Word32) * num_protos_diff * dirac_onset_detection_params->max_band_decorr)) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n")); - } - /* init to zero */ - set32_fx(dirac_onset_detection_state->onset_detector_1_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr); - set32_fx(dirac_onset_detection_state->onset_detector_2_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr); - dirac_onset_detection_state->q_onset_detector = Q31; -#endif - /*to be cleand up*/ IF((dirac_onset_detection_state->onset_detector_1 = (float *)malloc(sizeof(float) * num_protos_diff * dirac_onset_detection_params->max_band_decorr)) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n")); @@ -214,7 +199,7 @@ ivas_error ivas_dirac_dec_onset_detection_open_fx( dirac_onset_detection_params->max_band_decorr = max_band_decorr; /* memory allocation */ -#ifdef IVAS_FLOAT_FIXED + IF( ( dirac_onset_detection_state->onset_detector_1_fx = (Word32 *) malloc( sizeof( Word32 ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); @@ -227,20 +212,6 @@ ivas_error ivas_dirac_dec_onset_detection_open_fx( set32_fx(dirac_onset_detection_state->onset_detector_1_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr); set32_fx(dirac_onset_detection_state->onset_detector_2_fx, 0, num_protos_diff * dirac_onset_detection_params->max_band_decorr); dirac_onset_detection_state->q_onset_detector = Q31; -#endif - /*to be cleand up*/ - IF( ( dirac_onset_detection_state->onset_detector_1 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); - } - IF( ( dirac_onset_detection_state->onset_detector_2 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); - } - - /* init to zero */ - set_zero( dirac_onset_detection_state->onset_detector_1, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); - set_zero( dirac_onset_detection_state->onset_detector_2, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 421048ba9..67f70250c 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -102,8 +102,9 @@ static void normalizePanningGains_fx( Word32 *direct_response_fx, Word16 *q_dire #endif #ifndef IVAS_FLOAT_FIXED static void spreadCoherencePanningHoa( const int16_t azimuth, const int16_t elevation, const float spreadCoh, float *direct_response, const int16_t num_channels_dir, const int16_t ambisonics_order ); - +#ifndef IVAS_FLOAT_FIXED static void spreadCoherencePanningVbap( const int16_t azimuth, const int16_t elevation, const float spreadCoh, float *direct_response, const int16_t num_channels_dir, const VBAP_HANDLE hVBAPdata ); +#endif // !IVAS_FLOAT_FIXED static void normalizePanningGains( float *direct_response, const int16_t num_channels_dir ); #endif diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 50a0bbcc5..ef12aa814 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -447,7 +447,6 @@ ivas_error ivas_spat_hSpatParamRendCom_config_fx( hSpatParamRendCom->subframes_rendered = 0; hSpatParamRendCom->slots_rendered = 0; hSpatParamRendCom->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - hSpatParamRendCom->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); var1 = BASOP_Util_Divide3232_Scale(output_Fs, CLDFB_BANDWIDTH, &exp_tmp3); var2 = shl(1, 15 - exp_tmp3 - 1 ); hSpatParamRendCom->num_freq_bands = shr(add(var1, var2), 15 - exp_tmp3); @@ -464,22 +463,14 @@ ivas_error ivas_spat_hSpatParamRendCom_config_fx( { IF( hodirac_flag && hSpatParamRendCom->azimuth2 == NULL ) { -#ifdef IVAS_FLOAT_FIXED if ( ( error = ivas_dirac_allocate_parameters_fx( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) -#endif { return error; } } ELSE IF( !hodirac_flag && hSpatParamRendCom->azimuth2 != NULL ) { -#ifdef IVAS_FLOAT_FIXED ivas_dirac_deallocate_parameters_fx( hSpatParamRendCom, 2 ); -#else - ivas_dirac_deallocate_parameters( hSpatParamRendCom, 2 ); -#endif } } @@ -523,31 +514,18 @@ ivas_error ivas_spat_hSpatParamRendCom_config_fx( hSpatParamRendCom->render_to_md_map[map_idx] = hSpatParamRendCom->dirac_read_idx + map_idx / num_slots_in_subfr; } } -#ifdef IVAS_FLOAT_FIXED + IF( ( error = ivas_dirac_allocate_parameters_fx( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif IF( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT || ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && hodirac_flag ) ) { -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_dirac_allocate_parameters_fx( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } ELSE { @@ -769,7 +747,7 @@ void ivas_dirac_rend_close_fx( /* close Decorrelator sub-module */ IF (hDirACRend->proto_signal_decorr_on) { - ivas_dirac_dec_decorr_close(&hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state); + ivas_dirac_dec_decorr_close_fx(&hDirACRend->h_freq_domain_decorr_ap_params, &hDirACRend->h_freq_domain_decorr_ap_state); } /* Params */ @@ -890,7 +868,7 @@ void ivas_dirac_rend_close_fx( return; } -#endif +#else void ivas_dirac_rend_close( DIRAC_REND_HANDLE *hDirACRend_out ) @@ -923,15 +901,6 @@ void ivas_dirac_rend_close( hDirACRend->frequency_axis = NULL; } - // this should be removed when close_fx is called// -#ifdef IVAS_FLOAT_FIXED - IF( hDirACRend->frequency_axis_fx != NULL ) - { - free( hDirACRend->frequency_axis_fx ); - hDirACRend->frequency_axis_fx = NULL; - } -#endif - if ( hDirACRend->diffuse_response_function != NULL ) { free( hDirACRend->diffuse_response_function ); @@ -943,13 +912,6 @@ void ivas_dirac_rend_close( free( hDirACRend->hoa_encoder ); hDirACRend->hoa_encoder = NULL; } -#ifdef IVAS_FLOAT_FIXED - IF( hDirACRend->hoa_encoder_fx != NULL ) - { - free( hDirACRend->hoa_encoder_fx ); - hDirACRend->hoa_encoder_fx = NULL; - } -#endif /* prototype indexing */ if ( hDirACRend->proto_index_dir != NULL ) @@ -1003,7 +965,7 @@ void ivas_dirac_rend_close( return; } - +#endif /*------------------------------------------------------------------------- * ivas_dirac_deallocate_parameters() * diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 6cdabb683..59657b592 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -774,6 +774,13 @@ void ivas_dirac_dec_decorr_close( HANDLE_DIRAC_DECORR_PARAMS *ph_dirac_decorr_params, HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state ); +#ifdef IVAS_FLOAT_FIXED +void ivas_dirac_dec_decorr_close_fx( + HANDLE_DIRAC_DECORR_PARAMS *ph_dirac_decorr_params, + HANDLE_DIRAC_DECORR_STATE *ph_dirac_decorr_state +); +#endif // IVAS_FLOAT_FIXED + ivas_error ivas_dirac_dec_output_synthesis_open( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 33874261e..4c5c7da2e 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -3317,6 +3317,13 @@ void SHrotmatgen_fx( move32(); Word16 R_lm1[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; + +#ifdef MSAN_FIX + FOR(i = 0; i < HEADROT_SHMAT_DIM; i++) + { + set_s(R_lm1[i], 0, HEADROT_SHMAT_DIM); + } +#endif Word16 R_l[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; Word32 result; SHrotmat[0][0] = ONE_IN_Q14; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index aba41dfe4..ce3c64321 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -13932,7 +13932,11 @@ static void freeMasaExtRenderer( if ( hMasaExtRend->hDirACRend != NULL ) { +#ifdef IVAS_FLOAT_FIXED + ivas_dirac_rend_close_fx( &hMasaExtRend->hDirACRend ); +#else ivas_dirac_rend_close( &hMasaExtRend->hDirACRend ); +#endif // IVAS_FLOAT_FIXED } if ( hMasaExtRend->hSpatParamRendCom != NULL ) -- GitLab From f42e79b13c1dcdf9c257bf17d7e4956d278844b2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 21 May 2024 21:22:48 +0530 Subject: [PATCH 061/101] Stereo, OMASA LTV crash fixes, Float buffer cleanup [x] Stereo LTV crash issues fixed: [stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on, random FER at 5%, bandwidth switching] [stereo bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out] [x] OMASA LTV crash issues fixed: [OMASA 1Dir1TC 4ISM at br sw techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, FER at 5%] [OMASA 1Dir1TC 4ISM at br sw techs 13.2 to 512 kbps start 32 kbps, 48kHz in, 48kHz out, BINAURAL out, JBM Prof 5] [OMASA 2Dir2TC 3ISM at br sw techs 13.2 to 512 kbps start 160 kbps, 48kHz in, 48kHz out, MONO out, JBM Prof 5] [x] Float buffers removal and cleanup changes --- lib_com/float_to_fix_ops.c | 48 ++-- lib_com/ivas_sns_com_fx.c | 2 +- lib_com/prot.h | 10 + lib_com/prot_fx2.h | 2 + lib_dec/ACcontextMapping_dec.c | 5 +- lib_dec/ACcontextMapping_dec_fx.c | 7 +- lib_dec/FEC_HQ_core_fx.c | 13 +- lib_dec/FEC_HQ_phase_ecu.c | 6 +- lib_dec/FEC_HQ_phase_ecu_fx.c | 7 +- lib_dec/FEC_adapt_codebook.c | 2 + lib_dec/FEC_adapt_codebook_fx.c | 4 +- lib_dec/FEC_clas_estim.c | 3 +- lib_dec/FEC_clas_estim_fx.c | 3 +- lib_dec/FEC_pitch_estim_fx.c | 3 +- lib_dec/FEC_scale_syn.c | 2 + lib_dec/FEC_scale_syn_fx.c | 3 +- lib_dec/LD_music_post_filter.c | 2 +- lib_dec/acelp_core_dec_ivas_fx.c | 2 +- lib_dec/amr_wb_dec.c | 2 +- lib_dec/ari_dec.c | 2 + lib_dec/ari_hm_dec.c | 6 +- lib_dec/arith_coder_dec.c | 6 +- lib_dec/arith_coder_dec_fx.c | 4 + lib_dec/avq_dec.c | 8 +- lib_dec/avq_dec_fx.c | 8 +- lib_dec/bass_psfilter.c | 8 +- lib_dec/bass_psfilter_fx.c | 9 + lib_dec/cng_dec_fx.c | 15 + lib_dec/core_dec_init.c | 9 +- lib_dec/core_dec_init_fx.c | 6 + lib_dec/core_dec_reconf.c | 7 - lib_dec/core_dec_reconf_fx.c | 2 + lib_dec/core_dec_switch.c | 342 +++++++++++------------ lib_dec/core_switching_dec.c | 1 + lib_dec/core_switching_dec_fx.c | 21 +- lib_dec/d_gain2p.c | 12 +- lib_dec/dec2t32.c | 4 +- lib_dec/dec2t32_fx.c | 4 +- lib_dec/dec4t64.c | 27 +- lib_dec/dec_acelp.c | 3 +- lib_dec/dec_acelp_tcx_main.c | 368 ++++++++++++------------- lib_dec/dec_higher_acelp_fx.c | 4 + lib_dec/dec_prm.c | 3 + lib_dec/dec_tcx.c | 3 +- lib_dec/dec_tcx_fx.c | 4 +- lib_dec/decision_matrix_dec.c | 3 +- lib_dec/decision_matrix_dec_fx.c | 3 +- lib_dec/dlpc_avq.c | 2 + lib_dec/er_scale_syn.c | 3 +- lib_dec/er_sync_exc.c | 2 + lib_dec/fd_cng_dec.c | 3 +- lib_dec/fd_cng_dec_fx.c | 25 +- lib_dec/hf_synth.c | 4 +- lib_dec/hq_core_dec.c | 254 +---------------- lib_dec/hq_core_dec_fx.c | 9 +- lib_dec/init_dec_fx.c | 3 - lib_dec/inov_dec.c | 2 + lib_dec/ivas_core_dec.c | 219 +++++++-------- lib_dec/ivas_cpe_dec_fx.c | 30 +- lib_dec/ivas_mct_dec.c | 3 - lib_dec/ivas_sce_dec_fx.c | 12 +- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 7 +- lib_dec/ivas_stereo_switching_dec.c | 6 - lib_dec/stat_dec.h | 101 ++++--- lib_rend/ivas_reverb.c | 4 +- lib_rend/ivas_rotation.c | 6 +- 66 files changed, 815 insertions(+), 898 deletions(-) diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 8ed6c56c0..62c15f1f1 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -371,8 +371,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k ); st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k ); st->hHQ_core->Q_fer_samples = 0; - floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); - floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); + //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -461,8 +461,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( IF( st->hHQ_core ) { - fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k ); - fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k ); + //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -591,8 +591,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st->hHQ_core->Q_old_out = 0; st->hHQ_core->Q_old_outLB = 0; st->hHQ_core->Q_fer_samples = 0; - floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); - floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); + //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -684,8 +684,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( IF( st->hHQ_core ) { - fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k ); - fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k ); + //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -763,7 +763,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( hTcxDec->tcxltp_last_gain_unmodified_float, Q15 ); } - floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + //floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); //if ( !st->tcxonly ) //{ @@ -833,17 +833,17 @@ void fixed_to_float_stereo_tcx_core_dec( { if (st->hHQ_core->Q_old_wtda >= 0) { - for ( int p = 0; p < st->L_frame; p++ ) + for ( int p = 0; p < 960; p++ ) { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); + //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); + //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); } } else{ - for ( int p = 0; p < st->L_frame; p++ ) + for ( int p = 0; p < 960; p++ ) { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); + //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); + //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); } } } @@ -868,7 +868,7 @@ void fixed_to_float_stereo_tcx_core_dec( { for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ ) { - st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ); + //st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ); } } @@ -877,13 +877,21 @@ void fixed_to_float_stereo_tcx_core_dec( IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) { - FOR( Word16 ind = 0; ind < 640; ind++ ) + //FOR( Word16 ind = 0; ind < 640; ind++ ) + //{ + // st->hHQ_core->old_outLB[ind] = (float) st->hHQ_core->old_out_LB_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //} + //FOR( Word16 ind = 0; ind < 960; ind++ ) + //{ + // st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //} + FOR( Word16 ind = 0; ind < L_FRAME32k / 2; ind++ ) { - st->hHQ_core->old_outLB[ind] = (float) st->hHQ_core->old_out_LB_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //st->hTcxDec->syn_Overl_float[ind] = (float) st->hTcxDec->syn_Overl[ind] / ( (float) pow( 2, st->Q_syn + 1 ) ); } - FOR( Word16 ind = 0; ind < 960; ind++ ) + FOR( Word16 ind = 0; ind < L_FRAME_MAX / 2; ind++ ) { - st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //st->hTcxDec->syn_OverlFB_float[ind] = (float) st->hTcxDec->syn_OverlFB[ind] / ( (float) pow( 2, st->Q_syn ) ); } } } diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index d192118d9..3d96e4819 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -138,7 +138,7 @@ void sns_compute_scf_fx( FOR( i = 0; i < FDNS_NPTS; i++ ) { xs[i] = Mpy_32_16_1( xs[i], pow_tilt[i] ); - xs[i] = L_shl( xs[i], Q6 ); // xs => Q10 + xs[i] = L_shl( xs[i], Q4 ); // xs => Q8 } /* Noise floor at -40dB */ diff --git a/lib_com/prot.h b/lib_com/prot.h index b4ef842c5..f47b3d917 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -4623,6 +4623,7 @@ void signaling_enc_rf( Encoder_State *st /* i/o: encoder state structure */ ); +#ifndef IVAS_FLOAT_FIXED ivas_error acelp_core_dec( Decoder_State *st, /* i/o: Decoder state structure */ float output[], /* o : synthesis @internal Fs */ @@ -4646,6 +4647,7 @@ ivas_error acelp_core_dec( STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ const int16_t read_sid_info /* i : read SID info flag */ ); +#endif #ifdef IVAS_FLOAT_FIXED ivas_error acelp_core_dec_ivas_fx( @@ -7437,6 +7439,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC( int16_t resQMaxBits, CONTEXT_HM_CONFIG *hm_cfg ); +#ifndef IVAS_FLOAT_FIXED int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -7445,6 +7448,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( int16_t resQMaxBits, /* i : residual coding maximum bits */ CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration */ ); +#endif int16_t ACcontextMapping_encode2_estimate_no_mem_s17_LC( const int16_t *x, @@ -7464,6 +7468,7 @@ void RCcontextMapping_encode2_no_mem_s17_LCS( const int16_t resQMaxBits, CONTEXT_HM_CONFIG *hm_cfg ); +#ifndef IVAS_FLOAT_FIXED int16_t RCcontextMapping_decode2_no_mem_s17_LCS( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -7472,6 +7477,7 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS( const int16_t resQMaxBits, /* i : residual coding maximum bits */ CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration */ ); +#endif int16_t RCcontextMapping_encode2_estimate_no_mem_s17_LCS( int16_t *x, /* Spectral coefficients */ @@ -7822,11 +7828,13 @@ int16_t ari_start_decoding_14bits_prm_ivas( int16_t bp, Tastat *s ); +#ifdef IVAS_FLOAT_FIXED Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, Tastat *s ); +#endif void ari_decode_14bits_s17_ext_ivas( Decoder_State *st, @@ -9880,12 +9888,14 @@ int16_t GetPLCModeDecision( Decoder_State *st /* i/o: decoder memory state pointer */ ); +#ifndef IVAS_FLOAT_FIXED void addBassPostFilter( const float *harm_timeIn, const int16_t samplesToProcess, float **rAnalysis, float **iAnalysis, HANDLE_CLDFB_FILTER_BANK cldfb ); +#endif ivas_error TonalMDCTConceal_Init_ivas( TonalMDCTConcealPtr hTonalMDCTConc, diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index cedbc4b7d..3eebc5bc4 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -8970,6 +8970,7 @@ void decoder_acelp_fx( #endif //d_gain2p.c +#ifdef IVAS_FLOAT_FIXED void decode_acelp_gains_fx( Word16 *code, Word16 gains_mode, @@ -8984,6 +8985,7 @@ void decode_acelp_gains_fx( Word16 *code2, Word32 *gain_code2 ); +#endif void d_gain_pred_fx( Word16 nrg_mode, /* i : NRG mode */ diff --git a/lib_dec/ACcontextMapping_dec.c b/lib_dec/ACcontextMapping_dec.c index 6b400d02c..cb3863a5e 100644 --- a/lib_dec/ACcontextMapping_dec.c +++ b/lib_dec/ACcontextMapping_dec.c @@ -51,6 +51,7 @@ *-------------------------------------------------------------------*/ /*! r: resQBits */ +#ifndef IVAS_FLOAT_FIXED int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -318,7 +319,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( return resQBits; } - +#endif /*-------------------------------------------------------------------* * RCcontextMapping_decode2_no_mem_s17_LCS() @@ -327,6 +328,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( *-------------------------------------------------------------------*/ /*! r: resQBits */ +#ifndef IVAS_FLOAT_FIXED int16_t RCcontextMapping_decode2_no_mem_s17_LCS( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -670,3 +672,4 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS( return resQBits; } +#endif \ No newline at end of file diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 5e668d2e9..cdb1d1a17 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -20,6 +20,7 @@ * Arithmetic decoder *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED Word16 ACcontextMapping_decode2_no_mem_s17_LC( Decoder_State *st,/* i/o: decoder state */ Word16 *x, /* o: decoded spectrum */ @@ -323,6 +324,9 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( return resQBits; } +#endif + +#ifdef IVAS_FLOAT_FIXED #define IVAS_CONTEXT_MAPPING #ifdef IVAS_CONTEXT_MAPPING @@ -690,4 +694,5 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx( } #endif -#undef IVAS_CONTEXT_MAPPING \ No newline at end of file +#undef IVAS_CONTEXT_MAPPING +#endif \ No newline at end of file diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index e101096e9..63caeaaf9 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -15,7 +15,7 @@ /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static Word16 FEC_phase_matching_fx(HQ_NBFEC_HANDLE st_fx, Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB]); static void FEC_phase_matching_nextgood_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB],Word16 mean_en_high_fx); static void FEC_phase_matching_burst_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB], Word16* prev_oldauOut_fx ); @@ -28,13 +28,14 @@ static void Windowing_2nd_NB_fx(Word16* ImdctOutWin_fx, const Word32* ImdctOut_ static void Scaledown_fx(Word16 x[], Word16 y[], Word16 scale_v,const Word16 N ); static void Next_good_after_burst_erasures_fx(const Word32* ImdctOut_fx, Word16* auOut_fx,Word16* OldauOut_fx, const Word16 ol_size); static void common_overlapping_fx(Word16* auOut_fx, Word16* ImdctOutWin_fx, Word16* OldauOut_fx, Word16 end1, Word16 offset1, Word16 start2, Word16 end2, Word16 offset_i2, Word16 offset2); - +#endif /*--------------------------------------------------------------------------* * Regression_Anal() * * *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void Regression_Anal_fx( const Word32 *values_fx, /* i : Previous values */ Word32 *r_p_fx, /* o : Output r[a b] array : y=ax+b */ @@ -400,6 +401,7 @@ void HQ_FEC_processing_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED void ivas_HQ_FEC_Mem_update_fx( @@ -688,6 +690,7 @@ void ivas_HQ_FEC_Mem_update_fx( } #endif +#ifdef IVAS_FLOAT_FIXED void HQ_FEC_Mem_update_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word32 *t_audio_q_fx, /*Q12*/ @@ -981,8 +984,9 @@ void HQ_FEC_Mem_update_fx( return; } +#endif - +#ifdef IVAS_FLOAT_FIXED static Word16 find_best_delay_fx( Word16 *mu_o_fx, Word16 *in_fx, @@ -1388,7 +1392,9 @@ static void FEC_phase_matching_nextgood_fx( return; } +#endif +#ifdef IVAS_FLOAT_FIXED static void FEC_phase_matching_burst_fx( const Word32 *ImdctOut_fx, /* i : input */ Word16 *auOut_fx, /* o : output audio */ @@ -1964,6 +1970,7 @@ static void Next_good_after_burst_erasures_fx( return; } +#endif #ifdef ADD_IVAS_HQ_CODE_FEC /*-------------------------------------------------------------------------- diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 5208ca9b2..5c8e917b6 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -452,6 +452,7 @@ static void trans_ana( * Peak-picking algorithm *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void peakfinder( const float *x0, /* i : vector from which the maxima will be found */ const int16_t len0, /* i : length of input vector */ @@ -648,7 +649,7 @@ void peakfinder( return; } - +#endif /*-------------------------------------------------------------------* * imax_pos() @@ -657,6 +658,7 @@ void peakfinder( *-------------------------------------------------------------------*/ /*! r: interpolated maximum position */ +#ifndef IVAS_FLOAT_FIXED float imax_pos( const float *y /* i : Input vector for peak interpolation */ ) @@ -698,7 +700,7 @@ float imax_pos( return posi + 1.0f; } - +#endif /*-------------------------------------------------------------------* * spec_ana() diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 8a5efde94..71f7860d8 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -73,7 +73,7 @@ #define FEC_HQ_WIN_A0 FEC_HQ_HAMM_A0 #define FEC_HQ_WIN_A1 FEC_HQ_HAMM_A1 - +#ifdef IVAS_FLOAT_FIXED static Word16 sqrt2ndOrder(const Word16); static void windowing(const Word16*, Word16*, const Word16*, const Word16, const Word16); @@ -93,7 +93,9 @@ static void spec_ana_fx(const Word16* prevsynth, Word16* plocs, Word32* plocsi, ); static void subst_spec_fx(const Word16*, const Word32*, Word16*, const Word16, Word16*, const Word16*, const Word16, const Word16*, const Word16, Word16* ,const Word16*, const Word16*, Word16, const Word16*); +#ifdef IVAS_FLOAT_FIXED static Word16 rand_phase_fx(const Word16 seed, Word16 *sin_F, Word16 *cos_F); +#endif #ifdef IVAS_FEC_ECU_TO_COMPLETE static float imax2_jacobsen_mag(const float* y_re, const float* y_im); #endif @@ -103,6 +105,7 @@ static float imax2_jacobsen_mag(const float* y_re, const float* y_im); * * randomized phase in form of sin and cos components *------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static Word16 rand_phase_fx(const Word16 seed, Word16 *sin_F, Word16 *cos_F) { const Word16 *sincos = sincos_t_ext_fx + 128; @@ -127,6 +130,7 @@ static Word16 rand_phase_fx(const Word16 seed, Word16 *sin_F, Word16 *cos_F) return seed2; } +#endif #ifdef IVAS_FLOAT_FIXED /*! r: The location, relative to the middle of the 3 given data point, of the maximum. (Q15)*/ @@ -5392,3 +5396,4 @@ static void windowing_ROM_optimized( pSine += downSamples; /* Increment address counter */ } } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_adapt_codebook.c b/lib_dec/FEC_adapt_codebook.c index 4db1f06e2..bb638b3a4 100644 --- a/lib_dec/FEC_adapt_codebook.c +++ b/lib_dec/FEC_adapt_codebook.c @@ -49,6 +49,7 @@ *------------------------------------------------------------------------*/ /*! r: do_WI flag */ +#ifndef IVAS_FLOAT_FIXED static int16_t FEC_synchro_exc( const int16_t L_frame, /* i : length of the frame */ float *exc, /* i/o: exc vector to modify */ @@ -491,3 +492,4 @@ int16_t FEC_enhACB( return do_WI; } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_adapt_codebook_fx.c b/lib_dec/FEC_adapt_codebook_fx.c index af58ed757..fab0dfe43 100644 --- a/lib_dec/FEC_adapt_codebook_fx.c +++ b/lib_dec/FEC_adapt_codebook_fx.c @@ -15,6 +15,7 @@ * * Create an artificial onset when it is lost *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED Word16 FEC_SinOnset_fx ( Word16 *exc, /* i/o : exc vector to modify */ Word16 puls_pos, /* i : last pulse position desired */ @@ -533,4 +534,5 @@ Word16 FEC_synchro_exc_fx( /* o : do_WI flag return 1; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/lib_dec/FEC_clas_estim.c b/lib_dec/FEC_clas_estim.c index 9f2633a20..1fb0e735b 100644 --- a/lib_dec/FEC_clas_estim.c +++ b/lib_dec/FEC_clas_estim.c @@ -65,7 +65,7 @@ /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static float calculate_zero_crossings( const float *synth, const int16_t L_frame ); static float calculate_pitch_synchr_norm_correlation( const float *pitch, const float *synth, const int16_t L_frame, const int16_t L_subfr ); @@ -799,3 +799,4 @@ int16_t FEC_pos_dec( return T0; } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_clas_estim_fx.c b/lib_dec/FEC_clas_estim_fx.c index e5f9f34b7..74606fb86 100644 --- a/lib_dec/FEC_clas_estim_fx.c +++ b/lib_dec/FEC_clas_estim_fx.c @@ -47,6 +47,7 @@ static void Corre(const Word16 *x,const Word16 *y,const Word16 l,Word16 *gain); /* */ /*======================================================================*/ +#ifdef IVAS_FLOAT_FIXED void FEC_clas_estim_fx( Decoder_State *st_fx , /* i/o: decoder state handle */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ /*A*/ @@ -931,4 +932,4 @@ static void Corre( #endif move16(); } - +#endif diff --git a/lib_dec/FEC_pitch_estim_fx.c b/lib_dec/FEC_pitch_estim_fx.c index 2b5446093..713e4c579 100644 --- a/lib_dec/FEC_pitch_estim_fx.c +++ b/lib_dec/FEC_pitch_estim_fx.c @@ -35,6 +35,7 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*========================================================================*/ +#ifdef IVAS_FLOAT_FIXED void FEC_pitch_estim_fx( const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ const Word16 last_core, /* i : last core */ @@ -108,4 +109,4 @@ void FEC_pitch_estim_fx( } } } - +#endif diff --git a/lib_dec/FEC_scale_syn.c b/lib_dec/FEC_scale_syn.c index c91081b2e..cd6feb24d 100644 --- a/lib_dec/FEC_scale_syn.c +++ b/lib_dec/FEC_scale_syn.c @@ -49,6 +49,7 @@ * Smooth speech energy evolution when recovering after erasure(s) *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void FEC_scale_syn( const int16_t L_frame, /* i : length of the frame */ int16_t clas, /* i/o: frame classification */ @@ -439,3 +440,4 @@ void FEC_scale_syn( return; } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_scale_syn_fx.c b/lib_dec/FEC_scale_syn_fx.c index a547be7e7..120855b12 100644 --- a/lib_dec/FEC_scale_syn_fx.c +++ b/lib_dec/FEC_scale_syn_fx.c @@ -51,7 +51,7 @@ /* _ None */ /*========================================================================*/ - +#ifdef IVAS_FLOAT_FIXED void FEC_scale_syn_fx( const Word16 L_frame, /* i : length of the frame */ Word16 *update_flg, /* o: flag indicating re-synthesis after scaling*/ @@ -666,3 +666,4 @@ void FEC_scale_syn_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index 494fa1357..58cf9c869 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -802,7 +802,7 @@ void music_postfilt_init_flt( #endif } - set_f( hMusicPF->filt_lfE, 1.0f, DCT_L_POST ); + //set_f( hMusicPF->filt_lfE, 1.0f, DCT_L_POST ); hMusicPF->last_nonfull_music = 0; #ifdef IVAS_FLOAT_FIXED hMusicPF->Old_ener_Q = 0; diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index baebf97be..35cec94d9 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -2021,7 +2021,7 @@ void acelp_decoder_state_fix2float(Decoder_State *st) { ((st->m_frame_type == ZERO_FRAME) && (st != NULL && st->cng_type == LP_CNG)) ) { - fixedToFloat_arrL(st->hFdCngDec->msNoiseEst, st->hFdCngDec->msNoiseEst_float, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); + //fixedToFloat_arrL(st->hFdCngDec->msNoiseEst, st->hFdCngDec->msNoiseEst_float, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); } } } diff --git a/lib_dec/amr_wb_dec.c b/lib_dec/amr_wb_dec.c index 90bbfede8..81ec8ebed 100644 --- a/lib_dec/amr_wb_dec.c +++ b/lib_dec/amr_wb_dec.c @@ -816,7 +816,6 @@ ivas_error amr_wb_dec( return error; } -#endif /*------------------------------------------------------------------* * amr_wb_dec_init() @@ -847,3 +846,4 @@ void amr_wb_dec_init( return; } +#endif \ No newline at end of file diff --git a/lib_dec/ari_dec.c b/lib_dec/ari_dec.c index b8604b6e6..8757e5c12 100644 --- a/lib_dec/ari_dec.c +++ b/lib_dec/ari_dec.c @@ -100,6 +100,7 @@ int16_t ari_start_decoding_14bits_prm_ivas( return bp; } +#ifdef IVAS_FLOAT_FIXED Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, @@ -126,6 +127,7 @@ Word16 ari_start_decoding_14bits_prm_ivas_fx( return add(bp, i); } +#endif /*--------------------------------------------------------------- * ari_decode_14bits_s17_ext_ivas() diff --git a/lib_dec/ari_hm_dec.c b/lib_dec/ari_hm_dec.c index d0069e5c3..0072f3c69 100644 --- a/lib_dec/ari_hm_dec.c +++ b/lib_dec/ari_hm_dec.c @@ -77,6 +77,8 @@ int16_t DecodeIndex( } } #endif + +#ifdef IVAS_FLOAT_FIXED Word16 DecodeIndex_fx( Decoder_State *st, @@ -111,7 +113,7 @@ DecodeIndex_fx( return 8; } } - +#endif /*-------------------------------------------------------------------* * tcx_hm_dequantize_gain() @@ -299,4 +301,4 @@ void tcx_hm_decode( return; -} \ No newline at end of file +} diff --git a/lib_dec/arith_coder_dec.c b/lib_dec/arith_coder_dec.c index 12abd4d92..5cb38bf24 100644 --- a/lib_dec/arith_coder_dec.c +++ b/lib_dec/arith_coder_dec.c @@ -118,6 +118,7 @@ static int16_t tcx_arith_decode( } #endif +#ifdef IVAS_FLOAT_FIXED static Word16 tcx_arith_decode_ivas_fx( const Word16 L_frame, /* i : number of spectral lines */ const Word16 envelope[], /* i : scaled envelope (Q15-e) */ @@ -186,7 +187,7 @@ static Word16 tcx_arith_decode_ivas_fx( return bp; } - +#endif /*-------------------------------------------------------* * tcx_arith_decode_envelope() @@ -293,6 +294,8 @@ void tcx_arith_decode_envelope( return; } #endif + +#ifdef IVAS_FLOAT_FIXED void tcx_arith_decode_envelope_ivas_fx( Decoder_State *st, /* i/o: coder state */ Word32 q_spectrum[], /* o : quantised MDCT coefficients */ @@ -405,3 +408,4 @@ void tcx_arith_decode_envelope_ivas_fx( return; } +#endif diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 7cc34f46e..475f87572 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -11,6 +11,7 @@ #include "prot_fx2.h" /* Returns: number of bits consumed */ +#ifdef IVAS_FLOAT_FIXED static Word16 tcx_arith_decode_fx( Word16 L_frame, /* i: number of spectral lines Q0 */ const Word16 envelope[], /* i: scaled envelope Q15-e */ @@ -92,7 +93,9 @@ static Word16 tcx_arith_decode_fx( return bp; } +#endif +#ifdef IVAS_FLOAT_FIXED void tcx_arith_decode_envelope_fx( Word32 q_spectrum[], /* o: quantised MDCT coefficients Q31-e */ Word16 *q_spectrum_e, /* o: MDCT exponent Q0 */ @@ -208,3 +211,4 @@ void tcx_arith_decode_envelope_fx( set32_fx(q_spectrum + L_spec, 0, sub(L_frame, L_spec)); } +#endif \ No newline at end of file diff --git a/lib_dec/avq_dec.c b/lib_dec/avq_dec.c index 43372eddb..10cd09cd7 100644 --- a/lib_dec/avq_dec.c +++ b/lib_dec/avq_dec.c @@ -44,8 +44,9 @@ /*-------------------------------------------------------------------* * Local prototypes *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void read_cv( Decoder_State *st, uint16_t *I, int16_t *kv, int16_t nq, int16_t *nbits ); +#endif /*-----------------------------------------------------------------* * AVQ_demuxdec() @@ -54,6 +55,7 @@ static void read_cv( Decoder_State *st, uint16_t *I, int16_t *kv, int16_t nq, in * split algebraic vector dequantizer based on RE8 latice. *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void AVQ_demuxdec( Decoder_State *st, /* i/o: decoder state structure */ int16_t xriq[], /* o : decoded subvectors [0..8*Nsv-1]*/ @@ -283,7 +285,7 @@ void AVQ_demuxdec( return; } - +#endif /*-----------------------------------------------------------------* * AVQ_dec_lpc_ivas() @@ -371,6 +373,7 @@ void AVQ_dec_lpc_ivas( * read codebook indices (rank I and event. Voronoi index kv) *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void read_cv( Decoder_State *st, /* i/o: decoder state structure */ uint16_t *I, /* o : rank I code book index */ @@ -422,3 +425,4 @@ static void read_cv( return; } +#endif \ No newline at end of file diff --git a/lib_dec/avq_dec_fx.c b/lib_dec/avq_dec_fx.c index ab73ea4b0..62a551909 100644 --- a/lib_dec/avq_dec_fx.c +++ b/lib_dec/avq_dec_fx.c @@ -24,6 +24,7 @@ static void read_cv_fx( Decoder_State *st, UWord16 *I, Word16 *kv, Word16 nq, Wo * split algebraic vector dequantizer based on RE8 latice. *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void AVQ_demuxdec_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 xriq[], /* o : decoded subvectors [0..8*Nsv-1]*/ @@ -272,7 +273,7 @@ void AVQ_demuxdec_fx( return; } - +#endif /*-----------------------------------------------------------------* @@ -282,6 +283,7 @@ void AVQ_demuxdec_fx( * using split algebraic vector dequantizer *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void AVQ_dec_lpc( Word16 *indx, /* input: index[] (4 bits per words) */ Word16 *nvecq, /* output: vector quantized */ @@ -363,7 +365,7 @@ void AVQ_dec_lpc( return; } - +#endif /*-----------------------------------------------------------------* * read_cv_fx() @@ -371,6 +373,7 @@ void AVQ_dec_lpc( * read codebook indices (rank I and event. Voronoi index kv) *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void read_cv_fx( Decoder_State *st, /* i/o: decoder state structure */ UWord16 *I, /* o : rank I code book index */ @@ -422,3 +425,4 @@ static void read_cv_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index ac9a9d608..a58000d62 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -461,6 +461,7 @@ static int16_t Pit_track( * Add BPF component in cldfb domain *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void addBassPostFilter( const float *harm_timeIn, const int16_t samplesToProcess, @@ -519,6 +520,7 @@ void addBassPostFilter( return; } +#endif #ifdef IVAS_FLOAT_FIXED void addBassPostFilter_ivas_fx( @@ -652,7 +654,7 @@ int16_t res_bpf_adapt( return res_bpf_flag; } -#else +#endif /*---------------------------------------------------------------------* * res_bpf_adapt_ivas_fx() * @@ -661,6 +663,7 @@ int16_t res_bpf_adapt( *---------------------------------------------------------------------*/ /*! r: Decision to enable or disable BPF on DFT stereo residual */ +#ifdef IVAS_FLOAT_FIXED Word16 res_bpf_adapt_ivas_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ @@ -772,6 +775,8 @@ void bpf_pitch_coherence( return; } #endif + +#ifdef IVAS_FLOAT_FIXED void bpf_pitch_coherence_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word32 pitch_buf[] /* i : pitch for every subfr [0,1,2,3] */ @@ -838,3 +843,4 @@ void bpf_pitch_coherence_ivas_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c index e843018a8..36655d691 100644 --- a/lib_dec/bass_psfilter_fx.c +++ b/lib_dec/bass_psfilter_fx.c @@ -29,6 +29,7 @@ static Word16 Pit_track_fx(Word16 syn[], Word16 T); * * Initialisation of postfiltering variables *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void bass_psfilter_init_fx( BPF_DEC_HANDLE hBPF /* o : BPF data handle */ ) @@ -46,6 +47,7 @@ void bass_psfilter_init_fx( return; } +#endif /*=========================================================================*/ /* FUNCTION : void bass_psfilter_fx () */ @@ -75,6 +77,7 @@ void bass_psfilter_init_fx( /* CALLED FROM : TX/RX */ /*=========================================================================*/ +#ifdef IVAS_FLOAT_FIXED void bass_psfilter_fx( BPF_DEC_HANDLE hBPF, /* i/o: BPF data handle */ const Word16 Opt_AMR_WB, /* i : AMR-WB IO flag */ @@ -737,6 +740,7 @@ void bass_psfilter_fx( return; } +#endif /*==============================================================================*/ /* FUNCTION : Word16 Pit_track_fx ( ) */ @@ -753,6 +757,7 @@ void bass_psfilter_fx( /* CALLED FROM : TX/RX */ /*==============================================================================*/ +#ifdef IVAS_FLOAT_FIXED static Word16 Pit_track_fx( /* o : Pitch */ Word16 syn[], /* i : synthesis [-PIT_MAX..L_SUBFR] */ Word16 T /* i : pitch period (>= PIT_MIN) */ @@ -875,6 +880,7 @@ static Word16 Pit_track_fx( /* o : Pitch */ return T; } +#endif /*---------------------------------------------------------------------* * addBassPostFilter() @@ -882,6 +888,7 @@ static Word16 Pit_track_fx( /* o : Pitch */ * Add BPF component in cldfb domain *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void addBassPostFilter_fx( const Word16 *harm_timeIn_Fx, Word32 **rAnalysis_Fx, @@ -975,6 +982,8 @@ void addBassPostFilter_fx( return; } +#endif + #ifdef ADD_BPF_ADAPT /*---------------------------------------------------------------------* * res_bpf_adapt() diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index abb6fd166..daa789153 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -19,7 +19,9 @@ void E_LPC_f_lsp_a_conversion(const Word16 *isp, Word16 *a, const Word16 m); * Local function prototypes *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_fx( Decoder_State *st_fx, const Word16 *synth_fx, Word16 *shb_synth_fx, const Word16 sid_bw,const Word16 Qsyn); +#endif #ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_ivas_fx( Decoder_State *st_fx, const Word16 *synth_fx, Word16 *shb_synth_fx, const Word16 sid_bw, const Word16 Qsyn ); @@ -29,6 +31,7 @@ static void shb_CNG_decod_ivas_fx( Decoder_State *st_fx, const Word16 *synth_fx, * Decode residual signal energy *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void CNG_dec_fx( Decoder_State *st_fx, /* i/o: State structure */ const Word16 last_element_mode, /* i : last element mode Q0 */ @@ -698,11 +701,14 @@ void CNG_dec_fx( return; } +#endif + /*---------------------------------------------------------------------* * swb_CNG_dec() * * Comfort noise generation for SHB signal *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void swb_CNG_dec_fx( Decoder_State *st_fx, /* i/o: State structure */ const Word16 *synth_fx, /* i : ACELP core synthesis at 32kHz */ @@ -739,6 +745,7 @@ void swb_CNG_dec_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED void swb_CNG_dec_ivas_fx( @@ -784,6 +791,7 @@ void swb_CNG_dec_ivas_fx( * * Main routine of SHB SID decoding and CNG *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_fx( Decoder_State *st_fx, /* i/o: State structure */ const Word16 *synth_fx, /* i : ACELP core synthesis at 32kHz */ @@ -1063,6 +1071,7 @@ static void shb_CNG_decod_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_ivas_fx( @@ -1237,7 +1246,11 @@ static void shb_CNG_decod_ivas_fx( L_tmp = L_shl(L_tmp, q); q = sub(q, 32); ener_excSHB_fx = round_fx(L_tmp); /*Qq */ +#ifdef MSAN_FIX + IF ( EQ_16(st->last_vad_fx, 1)) +#else IF ( EQ_16(st->last_vad, 1)) +#endif { st->hTdCngDec->trans_cnt = 0; move16(); @@ -1334,6 +1347,7 @@ static void shb_CNG_decod_ivas_fx( * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void td_cng_dec_init_fx( DEC_CORE_HANDLE st /* i/o: decoder state structure */ ) @@ -1407,6 +1421,7 @@ void td_cng_dec_init_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED void td_cng_dec_init_ivas_fx( diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 7c773725e..3d9ae2933 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -682,7 +682,7 @@ void open_decoder_LPD( if (st->ini_frame == 0 || (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO)) { - hTcxDec->tcxltp_last_gain_unmodified_float = 0.f; + //hTcxDec->tcxltp_last_gain_unmodified_float = 0.f; } /* TCX */ @@ -1489,8 +1489,8 @@ void tcxltp_dec_init( if ( ini_frame == 0 ) { - set_f( hTcxLtpDec->tcxltp_mem_in_float, 0.0f, TCXLTP_MAX_DELAY ); - set_f( hTcxLtpDec->tcxltp_mem_out_float, 0.0f, L_FRAME48k ); + //set_f( hTcxLtpDec->tcxltp_mem_in_float, 0.0f, TCXLTP_MAX_DELAY ); + //set_f( hTcxLtpDec->tcxltp_mem_out_float, 0.0f, L_FRAME48k ); #ifdef IVAS_FLOAT_FIXED set32_fx(hTcxLtpDec->tcxltp_mem_in_32, 0, TCXLTP_MAX_DELAY); set32_fx(hTcxLtpDec->tcxltp_mem_out_32, 0, L_FRAME48k); @@ -1558,6 +1558,8 @@ void reset_tcx_overl_buf( return; } #endif + +#ifdef IVAS_FLOAT_FIXED void reset_tcx_overl_buf_fx( TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */ ) @@ -1572,6 +1574,7 @@ void reset_tcx_overl_buf_fx( hTcxDec->Q_syn_Overl_TDACFB = 0; return; } +#endif /*-----------------------------------------------------------------------* * acelp_plc_mdct_transition() diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index eb47d3849..ab367e3a4 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1012,6 +1012,7 @@ void open_decoder_LPD_fx( return; } +#ifdef IVAS_FLOAT_FIXED void tcxltp_dec_init_fx( TCX_LTP_DEC_HANDLE hTcxLtpDec, const Word16 ini_frame, @@ -1042,6 +1043,9 @@ void tcxltp_dec_init_fx( return; } +#endif + +#ifdef IVAS_FLOAT_FIXED void acelp_plc_mdct_transition_fx( Decoder_State *st /* i/o: Decoder state */ ) @@ -1088,6 +1092,8 @@ void acelp_plc_mdct_transition_fx( return; } +#endif + #ifdef IVAS_FLOAT_FIXED void open_decoder_LPD_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ diff --git a/lib_dec/core_dec_reconf.c b/lib_dec/core_dec_reconf.c index 3718a38d8..4448e1310 100644 --- a/lib_dec/core_dec_reconf.c +++ b/lib_dec/core_dec_reconf.c @@ -72,9 +72,6 @@ void reconfig_decoder_LPD_ivas( st->narrowBand = 0; } -#ifdef IVAS_FLOAT_FIXED - BITS_ALLOC_init_config_acelp(st->total_brate, st->narrowBand, st->nb_subfr, &(st->acelp_cfg)); -#endif // IVAS_Fixed BITS_ALLOC_init_config_acelp_IVAS( st->total_brate, st->narrowBand, st->nb_subfr, &( st->acelp_cfg ) ); @@ -170,17 +167,13 @@ void reconfig_decoder_LPD_ivas( oldLen = L_SYN_MEM_CLAS_ESTIM; newLen = L_SYN_MEM_CLAS_ESTIM * st->L_frame / st->last_L_frame; } -#ifndef IVAS_FLOAT_FIXED lerp_flt(&st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - oldLen], &st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - newLen], newLen, oldLen); -#endif // #ifndef IVAS_FLOAT_FIXED } } -#ifndef IVAS_FLOAT_FIXED else { set_zero(st->mem_syn_clas_estim, L_SYN_MEM_CLAS_ESTIM); } -#endif // #ifndef IVAS_FLOAT_FIXED } } diff --git a/lib_dec/core_dec_reconf_fx.c b/lib_dec/core_dec_reconf_fx.c index 116bd7f23..a99c92ddb 100644 --- a/lib_dec/core_dec_reconf_fx.c +++ b/lib_dec/core_dec_reconf_fx.c @@ -178,6 +178,7 @@ void reconfig_decoder_LPD_ivas_fx( } #endif +#ifdef IVAS_FLOAT_FIXED void reconfig_decoder_LPD_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 bits_frame, /* i : bit budget */ @@ -357,3 +358,4 @@ void reconfig_decoder_LPD_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index a6e1ef258..67dcade7e 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -64,6 +64,7 @@ void open_decoder_LPD_ivas_fx( Word16* Q_old_outLB, Word16* Q_old_Aq_12_8); #endif // IVAS_FLOAT_FIXED + #ifndef IVAS_FLOAT_FIXED void mode_switch_decoder_LPD( Decoder_State *st, /* i/o: decoder state structure */ @@ -75,190 +76,171 @@ void mode_switch_decoder_LPD( const int16_t last_element_mode /* i : last element mode */ ) { - int16_t fscale, switchWB; - int32_t sr_core; - int16_t bSwitchFromAmrwbIO; - int16_t frame_size; - TCX_DEC_HANDLE hTcxDec = st->hTcxDec; - - switchWB = 0; - bSwitchFromAmrwbIO = 0; - if ( st->last_core == AMR_WB_CORE ) - { - bSwitchFromAmrwbIO = 1; - } - sr_core = getCoreSamplerateMode2_flt( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); - fscale = sr2fscale( sr_core ); - - /* set number of coded lines */ - st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth ); - - if ( ( bwidth >= WB ) && ( fscale == ( FSCALE_DENOM * 16000 ) / 12800 ) && ( fscale == st->fscale ) ) - { - if ( ( ( total_brate > ACELP_32k ) && ( st->tcxonly == 0 ) ) || ( ( total_brate <= ACELP_32k ) && ( st->tcxonly == 1 ) ) ) - { - switchWB = 1; - } - } - - if ( st->last_L_frame > L_FRAME16k && total_brate <= ACELP_32k ) - { - switchWB = 1; /*force init when coming from MODE1*/ - } - - st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag ); - - if ( st->hIGFDec != NULL ) - { - st->hIGFDec->infoIGFStopFreq = -1; - } - - if ( st->igf && ( st->idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) - { - /* switch IGF configuration */ - IGFDecSetMode_flt( st->hIGFDec, total_brate, bwidth, st->element_mode, -1, -1, st->rf_flag ); - } - - if ( fscale != st->fscale || switchWB || bSwitchFromAmrwbIO || st->last_codec_mode == MODE1 || st->force_lpd_reset ) - { - /* Init Decoder */ -#ifdef IVAS_FLOAT_FIXED - Word16 Q_syn_Overl_TDAC = 0, Q_fer_samples = 0, Q_syn_Overl = 0, Q_syn_Overl_TDACFB = 0, Q_syn_OverlFB = 0, Q_old_out = 0, Q_old_outLB = 0, Q_old_Aq_12_8 = 0; - open_decoder_LPD_ivas_fx(st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8); -#endif - open_decoder_LPD( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0 ); - } - else - { - assert( fscale > ( FSCALE_DENOM / 2 ) ); - st->fscale_old = st->fscale; - st->fscale = fscale; - st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); - if ( st->hTcxDec != NULL ) - { - st->hTcxDec->L_frameTCX = (int16_t) ( st->output_Fs / FRAMES_PER_SEC ); - } - - if ( st->hTcxCfg != NULL ) - { - st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, total_brate, st->rf_flag ); - st->hTcxCfg->resq = getResq( total_brate ); - } - - hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( total_brate, st->rf_flag, st->element_mode ); - - if ( bwidth == NB ) - { - st->narrowBand = 1; - } - else - { - st->narrowBand = 0; - } -#ifndef IVAS_FLOAT_FIXED - st->TcxBandwidth_float = getTcxBandwidth_flt( bwidth ); -#endif - if ( st->hTcxCfg != NULL ) - { - st->hTcxCfg->pCurrentTnsConfig = NULL; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode ); - } +int16_t fscale, switchWB; +int32_t sr_core; +int16_t bSwitchFromAmrwbIO; +int16_t frame_size; +TCX_DEC_HANDLE hTcxDec = st->hTcxDec; + +switchWB = 0; +bSwitchFromAmrwbIO = 0; +if (st->last_core == AMR_WB_CORE) +{ + bSwitchFromAmrwbIO = 1; +} +sr_core = getCoreSamplerateMode2_flt(st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format); - if ( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL ) - { - InitTnsConfigs_flt( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag ); +fscale = sr2fscale(sr_core); - SetAllowTnsOnWhite_flt( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT ); - } - } +/* set number of coded lines */ +st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines(bwidth); - frame_size = FrameSizeConfig[frame_size_index].frame_net_bits; - reconfig_decoder_LPD_ivas( st, frame_size, bwidth, total_brate, st->last_L_frame ); +if ((bwidth >= WB) && (fscale == (FSCALE_DENOM * 16000) / 12800) && (fscale == st->fscale)) +{ + if (((total_brate > ACELP_32k) && (st->tcxonly == 0)) || ((total_brate <= ACELP_32k) && (st->tcxonly == 1))) + { + switchWB = 1; + } +} -#ifndef IVAS_FLOAT_FIXED - if ( hTcxDec->envWeighted && !hTcxDec->enableTcxLpc ) - { - mvr2r( st->lspold_uw_float, st->lsp_old, M ); - mvr2r( st->lsfold_uw_float, st->lsf_old, M ); - hTcxDec->envWeighted = 0; - } - - /* update PLC LSF memories */ - lsp2lsf( st->lsp_old, st->lsfoldbfi1, M, st->sr_core ); - mvr2r( st->lsfoldbfi1, st->lsfoldbfi0, M ); - mvr2r( st->lsfoldbfi1, st->lsf_adaptive_mean, M ); -#endif // #ifndef IVAS_FLOAT_FIXED - - if ( st->igf && st->hBWE_TD != NULL ) - { - /* reset TBE */ - if ( ( st->bwidth == WB && st->last_extl != WB_TBE ) || - ( st->bwidth == SWB && st->last_extl != SWB_TBE ) || - ( st->bwidth == FB && st->last_extl != FB_TBE ) ) - { - TBEreset_dec( st ); - } - else - { -#ifndef IVAS_FLOAT_FIXED - set_f( st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER ); - set_f( st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD ); - set_f( st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER ); - set_f( st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); - st->hBWE_TD->gain_prec_swb = 1.0f; -#endif -#ifdef IVAS_FLOAT_FIXED - set_val_Word16(st->hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER); - set_val_Word16( st->hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD ); - set_val_Word16( st->hBWE_TD->mem_stp_swb_fx, 0, LPC_SHB_ORDER ); - set_val_Word16( st->hBWE_TD->mem_zero_swb_fx, 0, LPC_SHB_ORDER ); - st->hBWE_TD->gain_prec_swb_fx = 16384; -#endif - } - } +if (st->last_L_frame > L_FRAME16k && total_brate <= ACELP_32k) +{ + switchWB = 1; /*force init when coming from MODE1*/ +} - if ( bwidth == SWB && ( total_brate == ACELP_16k40 || total_brate == ACELP_24k40 ) && st->element_mode == EVS_MONO ) - { - if ( st->tec_tfa == 0 && st->hTECDec != NULL ) - { -#ifndef IVAS_FLOAT_FIXED - set_zero( st->hTECDec->loBuffer_flt, MAX_TEC_SMOOTHING_DEG ); -#endif -#ifdef IVAS_FLOAT_FIXED - set_val_Word16( st->hTECDec->loBuffer, 0, MAX_TEC_SMOOTHING_DEG ); -#endif - } - st->tec_tfa = 1; - } - else - { - st->tec_tfa = 0; - } - - st->tec_flag = 0; - st->tfa_flag = 0; - - /* needed in decoder to read the bitstream */ - if ( bwidth >= WB && total_brate == ACELP_24k40 && st->element_mode == EVS_MONO ) - { - st->enableGplc = 1; - } - else - { - st->enableGplc = 0; - } - - if ( ( total_brate == ACELP_9k60 || total_brate == ACELP_16k40 || total_brate == ACELP_24k40 ) && st->element_mode == EVS_MONO ) - { - st->dec_glr = 1; - } - else - { - st->dec_glr = 0; - } - - st->dec_glr_idx = 0; - - return; +st->igf = getIgfPresent(st->element_mode, total_brate, bwidth, st->rf_flag); + +if (st->hIGFDec != NULL) +{ + st->hIGFDec->infoIGFStopFreq = -1; +} + +if (st->igf && (st->idchan == 0 || st->element_mode == IVAS_CPE_MDCT)) +{ + /* switch IGF configuration */ + IGFDecSetMode_flt(st->hIGFDec, total_brate, bwidth, st->element_mode, -1, -1, st->rf_flag); + +} + +if (fscale != st->fscale || switchWB || bSwitchFromAmrwbIO || st->last_codec_mode == MODE1 || st->force_lpd_reset) +{ + open_decoder_LPD(st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0); +} +else +{ + assert(fscale > (FSCALE_DENOM / 2)); + st->fscale_old = st->fscale; + st->fscale = fscale; + st->L_frame = (int16_t)(st->sr_core / FRAMES_PER_SEC); + if (st->hTcxDec != NULL) + { + st->hTcxDec->L_frameTCX = (int16_t)(st->output_Fs / FRAMES_PER_SEC); + } + + if (st->hTcxCfg != NULL) + { + st->hTcxCfg->ctx_hm = getCtxHm(st->element_mode, total_brate, st->rf_flag); + st->hTcxCfg->resq = getResq(total_brate); + } + + hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri(total_brate, st->rf_flag, st->element_mode); + + if (bwidth == NB) + { + st->narrowBand = 1; + } + else + { + st->narrowBand = 0; + } + st->TcxBandwidth = getTcxBandwidth_flt(bwidth); + + if (st->hTcxCfg != NULL) + { + st->hTcxCfg->pCurrentTnsConfig = NULL; + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed(total_brate, st->igf, st->element_mode); + } + + if (st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL) + { + InitTnsConfigs_flt(bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag); + + SetAllowTnsOnWhite_flt(st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT); + + } +} + +frame_size = FrameSizeConfig[frame_size_index].frame_net_bits; +reconfig_decoder_LPD_ivas(st, frame_size, bwidth, total_brate, st->last_L_frame); + +if (hTcxDec->envWeighted && !hTcxDec->enableTcxLpc) +{ + mvr2r(st->lspold_uw, st->lsp_old, M); + mvr2r(st->lsfold_uw, st->lsf_old, M); + hTcxDec->envWeighted = 0; +} + +/* update PLC LSF memories */ +lsp2lsf(st->lsp_old, st->lsfoldbfi1, M, st->sr_core); +mvr2r(st->lsfoldbfi1, st->lsfoldbfi0, M); +mvr2r(st->lsfoldbfi1, st->lsf_adaptive_mean, M); + +if (st->igf && st->hBWE_TD != NULL) +{ + /* reset TBE */ + if ((st->bwidth == WB && st->last_extl != WB_TBE) || + (st->bwidth == SWB && st->last_extl != SWB_TBE) || + (st->bwidth == FB && st->last_extl != FB_TBE)) + { + TBEreset_dec(st); + } + else + { + set_f(st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER); + set_f(st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD); + set_f(st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER); + set_f(st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER); + st->hBWE_TD->gain_prec_swb = 1.0f; + } +} + +if (bwidth == SWB && (total_brate == ACELP_16k40 || total_brate == ACELP_24k40) && st->element_mode == EVS_MONO) +{ + if (st->tec_tfa == 0 && st->hTECDec != NULL) + { + set_zero(st->hTECDec->loBuffer, MAX_TEC_SMOOTHING_DEG); + } + st->tec_tfa = 1; +} +else +{ + st->tec_tfa = 0; +} + +st->tec_flag = 0; +st->tfa_flag = 0; + +/* needed in decoder to read the bitstream */ +if (bwidth >= WB && total_brate == ACELP_24k40 && st->element_mode == EVS_MONO) +{ + st->enableGplc = 1; +} +else +{ + st->enableGplc = 0; +} + +if ((total_brate == ACELP_9k60 || total_brate == ACELP_16k40 || total_brate == ACELP_24k40) && st->element_mode == EVS_MONO) +{ + st->dec_glr = 1; +} +else +{ + st->dec_glr = 0; +} + +st->dec_glr_idx = 0; + +return; } #endif diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 18bd70f51..654fd2293 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -573,6 +573,7 @@ ivas_error core_switching_pre_dec_ivas_fx( #endif // 1 set16_fx( st->hHQ_core->old_out_fx, 0, output_frame ); set32_fx( st->hHQ_core->old_outLB_fx, 0, L_FRAME16k ); + set16_fx(st->hHQ_core->old_out_LB_fx, 0, L_FRAME16k); } st->hHQ_core->no_att_hangover = 0; diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 2cf9bcc3a..b8b82dea7 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -29,6 +29,7 @@ static void smoothTransitionDtxToTcx_fx(Word16 synth[], const Word16 output_fram static void core_switch_lb_upsamp_fx(Decoder_State* st, Word32* output); #endif +#ifdef IVAS_FLOAT_FIXED void bandwidth_switching_detect_fx( Decoder_State *st_fx /* i/o: encoder state structure */ ) @@ -141,6 +142,7 @@ void bandwidth_switching_detect_fx( return; } +#endif /*---------------------------------------------------------------------* * Calc_freq_ener_fx() @@ -148,6 +150,7 @@ void bandwidth_switching_detect_fx( * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static Word32 Calc_freq_ener_fx(Word32 L_tmp, const Word16 Q_syn2) { Word32 enerLL_fx; @@ -170,6 +173,7 @@ static Word32 Calc_freq_ener_fx(Word32 L_tmp, const Word16 Q_syn2) } return enerLL_fx; } +#endif /*---------------------------------------------------------------------* * bw_switching_pre_proc_fx() @@ -177,6 +181,7 @@ static Word32 Calc_freq_ener_fx(Word32 L_tmp, const Word16 Q_syn2) * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void bw_switching_pre_proc_fx( const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ Decoder_State *st_fx /* i/o: decoder state structure */ @@ -330,6 +335,7 @@ void bw_switching_pre_proc_fx( } return; } +#endif #ifdef IVAS_CODE_SWITCHING @@ -479,6 +485,7 @@ static void smoothTransitionMdctStereoDtx( * * Preprocessing/preparation for ACELP/HQ core switching *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED ivas_error core_switching_pre_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ const Word16 output_frame /* i : frame length */ @@ -955,8 +962,8 @@ ivas_error core_switching_pre_dec_fx( #endif { set16_fx(hHQ_core->old_out_fx, 0, output_frame); - hHQ_core->Q_old_wtda_LB = 15; - hHQ_core->Q_old_wtda = 15; + hHQ_core->Q_old_wtda_LB = 0; + hHQ_core->Q_old_wtda = 0; #ifdef IVAS_CODE_SWITCHING set_f(st->hHQ_core->old_outLB, 0, L_FRAME16k); #endif @@ -1093,6 +1100,7 @@ ivas_error core_switching_pre_dec_fx( return error; } +#endif /*---------------------------------------------------------------------* * core_switching_post_dec() @@ -1100,6 +1108,7 @@ ivas_error core_switching_pre_dec_fx( * Postprocessing for ACELP/HQ core switching *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED ivas_error core_switching_post_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 *synth, /* i/o: output synthesis Qsynth */ @@ -1499,6 +1508,7 @@ ivas_error core_switching_post_dec_fx( return error; } +#endif #ifdef IVAS_FLOAT_FIXED ivas_error core_switching_post_dec_ivas_fx( @@ -1854,7 +1864,10 @@ ivas_error core_switching_post_dec_ivas_fx( hHQ_core->Q_old_wtda = Qtmp; move16(); } - Scale_sig( output_mem_fx, NS2SA( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), Qtmp ); + IF ( output_mem_fx != NULL ) + { + Scale_sig( output_mem_fx, NS2SA( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), Qtmp ); + } *Qsynth = Qtmp; move16(); @@ -2095,6 +2108,7 @@ ivas_error core_switching_post_dec_ivas_fx( * - modify bit allocation for HQ core by removing CELP subframe budget *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void core_switching_hq_prepare_dec_fx( Decoder_State *st_fx, /* i/o: encoder state structure */ Word16 *num_bits, /* i/o: bit budget update */ @@ -2165,6 +2179,7 @@ void core_switching_hq_prepare_dec_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void core_switch_lb_upsamp_fx( diff --git a/lib_dec/d_gain2p.c b/lib_dec/d_gain2p.c index 8d675a4d9..bd2366c9a 100644 --- a/lib_dec/d_gain2p.c +++ b/lib_dec/d_gain2p.c @@ -47,7 +47,7 @@ * * Decoding of pitch and codebook gains without updating long term energies *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void Mode2_gain_dec_mless_flt( const int16_t index, /* i : index of quantizer */ const float code[], /* i : Innovative code vector */ @@ -132,6 +132,7 @@ static void Mode2_gain_dec_mless_flt( return; } +#endif /*---------------------------------------------------------------------* @@ -139,7 +140,7 @@ static void Mode2_gain_dec_mless_flt( * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void gain_dec_uv( const int16_t index, /* i/o: Quantization index vector */ const float *code, /* i : algebraic code excitation */ @@ -178,6 +179,7 @@ static void gain_dec_uv( return; } +#endif /*---------------------------------------------------------------------* @@ -185,7 +187,7 @@ static void gain_dec_uv( * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void gain_dec_gacelp_uv( int16_t index, /* i/o: Quantization index vector */ const float *code, /* i : algebraic code excitation */ @@ -237,6 +239,7 @@ void gain_dec_gacelp_uv( return; } +#endif /*---------------------------------------------------------------------* @@ -244,7 +247,7 @@ void gain_dec_gacelp_uv( * * *---------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void decode_acelp_gains( const float *code, const int16_t gains_mode, @@ -286,3 +289,4 @@ void decode_acelp_gains( return; } +#endif diff --git a/lib_dec/dec2t32.c b/lib_dec/dec2t32.c index afb8fd8f5..a794e5618 100644 --- a/lib_dec/dec2t32.c +++ b/lib_dec/dec2t32.c @@ -53,7 +53,7 @@ * * See cod2t32.c for more details of the algebraic code. *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void dec_acelp_2t32( Decoder_State *st, /* i/o: decoder state structure */ float code[] /* o : algebraic (fixed) codebook excitation */ @@ -86,7 +86,6 @@ void dec_acelp_2t32( return; } - /*----------------------------------------------------------------------------------* * dec_acelp_1t64() * @@ -129,3 +128,4 @@ void dec_acelp_1t64( return; } +#endif diff --git a/lib_dec/dec2t32_fx.c b/lib_dec/dec2t32_fx.c index b1cd2af3a..85181bb88 100644 --- a/lib_dec/dec2t32_fx.c +++ b/lib_dec/dec2t32_fx.c @@ -33,7 +33,7 @@ /* CALLED FROM : */ /*==========================================================================*/ - +#ifdef IVAS_FLOAT_FIXED void dec_acelp_2t32_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 code[] /* o: algebraic (fixed) codebook excitation */ @@ -74,7 +74,6 @@ void dec_acelp_2t32_fx( } - /*==========================================================================*/ /* FUNCTION : void dec_acelp_1t64_fx () */ /*--------------------------------------------------------------------------*/ @@ -133,3 +132,4 @@ void dec_acelp_1t64_fx( return; } +#endif diff --git a/lib_dec/dec4t64.c b/lib_dec/dec4t64.c index be4ab425d..4b02cfb2f 100644 --- a/lib_dec/dec4t64.c +++ b/lib_dec/dec4t64.c @@ -46,6 +46,7 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void add_pulses( const int16_t pos[], const int16_t nb_pulse, const int16_t track, float code[] ); static void dec_1p_N1( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); static void dec_2p_2N1( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); @@ -55,7 +56,7 @@ static void dec_4p_4N( const int32_t index, const int16_t N, const int16_t offse static void dec_5p_5N( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); static void dec_6p_6N2( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); static void fcb_decode_PI( int32_t code_index, int16_t sector_6p[], const int16_t pulse_num ); - +#endif /*----------------------------------------------------------------------------------* * dec_acelp_4t64() @@ -72,6 +73,7 @@ static void fcb_decode_PI( int32_t code_index, int16_t sector_6p[], const int16_ * See cod4t64.c for more details of the algebraic code. *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void dec_acelp_4t64( Decoder_State *st, /* i/o: decoder state structure */ int16_t nbbits, /* i : number of bits per codebook */ @@ -262,6 +264,7 @@ void dec_acelp_4t64( return; } +#endif /*-------------------------------------------------------* * add_pulses() @@ -269,6 +272,7 @@ void dec_acelp_4t64( * Add decoded pulses to the codeword *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void add_pulses( const int16_t pos[], /* i : pulse position */ const int16_t nb_pulse, /* i : nb. of pulses */ @@ -293,13 +297,14 @@ static void add_pulses( return; } +#endif /*-------------------------------------------------------* * dec_1p_N1() * * Decode 1 pulse with N+1 bits *-------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void dec_1p_N1( const int32_t index, /* i : quantization index */ const int16_t N, /* i : nb. of bits */ @@ -372,6 +377,8 @@ void dec_2p_2N1( return; } +#endif + /*-------------------------------------------------------* * dec_3p_3N1() @@ -379,6 +386,7 @@ void dec_2p_2N1( * Decode 3 pulses with 3*N+1 bits: *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dec_3p_3N1( const int32_t index, /* i : quantization index */ const int16_t N, /* i : nb. of bits */ @@ -526,13 +534,14 @@ static void dec_5p_5N( return; } +#endif /*-------------------------------------------------------* * dec_6p_6N2() * * Decode 6 pulses with 6*N+2 bits: *-------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void dec_6p_6N2( const int32_t index, /* i : quantization index */ const int16_t N, /* i : nb. of bits */ @@ -688,6 +697,7 @@ static void fcb_decode_position( return; } +#endif /*---------------------------------------------------------------------* * fcb_decode_PI() @@ -696,6 +706,7 @@ static void fcb_decode_position( *---------------------------------------------------------------------*/ /*! r: return pulse position number */ +#ifndef IVAS_FLOAT_FIXED static void fcb_decode_PI( int32_t code_index, /* i : fcb index information */ int16_t sector_6p[], /* o : decoded pulse position */ @@ -735,11 +746,13 @@ static void fcb_decode_PI( return; } +#endif /*---------------------------------------------------------------------* * Read FCB index * *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void D_ACELP_decode_43bit( uint16_t idxs[], float code[], @@ -775,6 +788,7 @@ void D_ACELP_decode_43bit( return; } +#endif /*-------------------------------------------------------* * dec_1p_N1() @@ -782,6 +796,7 @@ void D_ACELP_decode_43bit( * Decode 1 pulse with N+1 bits *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dec_1p_N1_L_subfr( const int32_t index, /* i : quantization index */ const int16_t nb_pos, /* i : number of positions */ @@ -805,6 +820,7 @@ static void dec_1p_N1_L_subfr( return; } +#endif /*-------------------------------------------------------* * add_pulses() @@ -812,6 +828,7 @@ static void dec_1p_N1_L_subfr( * Add decoded pulses to the codeword *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void add_pulses_L_subfr( const int16_t nb_pos, /* i : number of positions */ const int16_t pos[], /* i : pulse position */ @@ -837,13 +854,14 @@ static void add_pulses_L_subfr( return; } +#endif /*----------------------------------------------------------------------------------* * dec_acelp_fast() * * fast algebraic codebook decoder *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void dec_acelp_fast( Decoder_State *st, /* i/o: decoder state structure */ const int16_t cdk_index, /* i : codebook index */ @@ -1009,3 +1027,4 @@ void dec_acelp_fast( return; } +#endif \ No newline at end of file diff --git a/lib_dec/dec_acelp.c b/lib_dec/dec_acelp.c index 2a4c44b7d..3480a7794 100644 --- a/lib_dec/dec_acelp.c +++ b/lib_dec/dec_acelp.c @@ -45,6 +45,7 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void D_ACELP_decode_arithtrack_ivas( float v[], uint32_t s, int16_t p, const int16_t trackstep, const int16_t tracklen ); /*---------------------------------------------------------------------* @@ -243,7 +244,6 @@ static void D_ACELP_decode_arithtrack_ivas( return; } - void fcb_pulse_track_joint_decode_ivas( uint16_t *idxs, const int16_t wordcnt, @@ -365,3 +365,4 @@ void fcb_pulse_track_joint_decode_ivas( return; } +#endif \ No newline at end of file diff --git a/lib_dec/dec_acelp_tcx_main.c b/lib_dec/dec_acelp_tcx_main.c index ab9447b9a..f04ce92f9 100644 --- a/lib_dec/dec_acelp_tcx_main.c +++ b/lib_dec/dec_acelp_tcx_main.c @@ -53,224 +53,216 @@ static void decode_frame_type_flt( STEREO_CNG_DEC_HANDLE hStereoCng /* i/o: Stereo CNG data structure */ ) { - int16_t frame_size_index, n; - int32_t total_brate; + int16_t frame_size_index, n; + int32_t total_brate; - frame_size_index = 0; - total_brate = st->total_brate; + frame_size_index = 0; + total_brate = st->total_brate; - /* Get Frame Type (NULL,SID,ACTIVE) and Frame Mode (2kbps, 4kbps,...) */ + /* Get Frame Type (NULL,SID,ACTIVE) and Frame Mode (2kbps, 4kbps,...) */ - if ( st->mdct_sw == MODE1 ) - { - st->m_frame_type = ACTIVE_FRAME; + if (st->mdct_sw == MODE1) + { + st->m_frame_type = ACTIVE_FRAME; - for ( n = 0; n < FRAME_SIZE_NB; n++ ) - { - if ( FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC ) - { - frame_size_index = n; - break; - } - } + for (n = 0; n < FRAME_SIZE_NB; n++) + { + if (FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC) + { + frame_size_index = n; + break; + } } - else + } + else + { + /* ZERO Frame */ + if (st->total_brate == FRAME_NO_DATA) + { + st->bwidth = st->last_bwidth; + st->m_frame_type = ZERO_FRAME; + } + + /* SID frame */ + else if (st->total_brate == SID_2k40) { - /* ZERO Frame */ - if ( st->total_brate == FRAME_NO_DATA ) + uint16_t frame_len_indicator; + + st->cng_type = get_next_indice(st, 1); + + if (st->cng_type != FD_CNG) + { + st->BER_detect = 1; + st->cng_type = FD_CNG; + } + st->m_frame_type = SID_FRAME; + frame_size_index = 1; + st->bwidth = get_next_indice(st, 2); + + frame_len_indicator = get_next_indice(st, 1); + if (st->bwidth == NB) + { + if (frame_len_indicator) { - st->bwidth = st->last_bwidth; - st->m_frame_type = ZERO_FRAME; + st->BER_detect = 1; } - - /* SID frame */ - else if ( st->total_brate == SID_2k40 ) + frame_len_indicator = 0; + } + if (frame_len_indicator == 0) + { + st->L_frame = L_FRAME; + st->total_brate = ACELP_9k60; + } + else + { + st->L_frame = L_FRAME16k; + if (st->last_total_brate == ACELP_16k40 || st->last_total_brate == ACELP_24k40) { - uint16_t frame_len_indicator; - - st->cng_type = get_next_indice( st, 1 ); - - if ( st->cng_type != FD_CNG ) - { - st->BER_detect = 1; - st->cng_type = FD_CNG; - } - st->m_frame_type = SID_FRAME; - frame_size_index = 1; - st->bwidth = get_next_indice( st, 2 ); - - frame_len_indicator = get_next_indice( st, 1 ); - if ( st->bwidth == NB ) - { - if ( frame_len_indicator ) - { - st->BER_detect = 1; - } - frame_len_indicator = 0; - } - if ( frame_len_indicator == 0 ) - { - st->L_frame = L_FRAME; - st->total_brate = ACELP_9k60; - } - else - { - st->L_frame = L_FRAME16k; - if ( st->last_total_brate == ACELP_16k40 || st->last_total_brate == ACELP_24k40 ) - { - st->total_brate = st->last_total_brate; - } - else - { - st->total_brate = 16400; - } - } - - for ( n = 0; n < FRAME_SIZE_NB; n++ ) - { - if ( FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC ) - { - frame_size_index = n; - break; - } - } + st->total_brate = st->last_total_brate; } - /* EVS MODES */ else { - /* Get Frame mode */ - st->m_frame_type = ACTIVE_FRAME; - - for ( n = 0; n < FRAME_SIZE_NB; n++ ) - { - if ( FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC ) - { - frame_size_index = n; - break; - } - } - - if ( st->rf_flag == 0 ) - { - /* Get bandwidth info */ - st->bwidth = get_next_indice( st, FrameSizeConfig[frame_size_index].bandwidth_bits ); - st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; - } - else - { - st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; - } - - if ( st->bwidth > FB ) - { - st->bwidth = FB; - st->BER_detect = 1; - } - - if ( st->bwidth > SWB && st->total_brate < ACELP_16k40 ) - { - st->bwidth = SWB; - st->BER_detect = 1; - } + st->total_brate = 16400; + } + } - /* Get reserved bit */ - if ( FrameSizeConfig[frame_size_index].reserved_bits && st->rf_flag == 0 ) - { - if ( get_next_indice( st, 1 ) != 0 ) - { - st->BER_detect = 1; - } - assert( FrameSizeConfig[frame_size_index].reserved_bits == 1 ); - } + for (n = 0; n < FRAME_SIZE_NB; n++) + { + if (FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC) + { + frame_size_index = n; + break; } + } } - - st->rate_switching_init = 0; - - if ( st->last_codec_mode != MODE2 || !st->BER_detect ) + /* EVS MODES */ + else { - /* Mode or Rate Change */ - if ( ( st->m_frame_type == ACTIVE_FRAME || st->m_frame_type == SID_FRAME ) && ( ( st->total_brate != st->last_total_brate ) || ( st->bwidth != st->last_bwidth ) || ( st->last_codec_mode == MODE1 ) || ( st->rf_flag != st->rf_flag_last ) || st->force_lpd_reset ) ) + /* Get Frame mode */ + st->m_frame_type = ACTIVE_FRAME; + + for (n = 0; n < FRAME_SIZE_NB; n++) + { + if (FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC) { - st->rate_switching_init = 1; + frame_size_index = n; + break; + } + } + + if (st->rf_flag == 0) + { + /* Get bandwidth info */ + st->bwidth = get_next_indice(st, FrameSizeConfig[frame_size_index].bandwidth_bits); + st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; + } + else + { + st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; + } + + if (st->bwidth > FB) + { + st->bwidth = FB; + st->BER_detect = 1; + } + + if (st->bwidth > SWB && st->total_brate < ACELP_16k40) + { + st->bwidth = SWB; + st->BER_detect = 1; + } + + /* Get reserved bit */ + if (FrameSizeConfig[frame_size_index].reserved_bits && st->rf_flag == 0) + { + if (get_next_indice(st, 1) != 0) + { + st->BER_detect = 1; + } + assert(FrameSizeConfig[frame_size_index].reserved_bits == 1); + } + } + } - /* Reconf Core */ - mode_switch_decoder_LPD( st, st->bwidth, st->total_brate, st->last_total_brate, frame_size_index, 0, st->element_mode ); + st->rate_switching_init = 0; - /* Reconf. CLDFB: check if the CLDFB works on the right sample rate */ - if ( ( st->cldfbAna->no_channels * st->cldfbAna->no_col ) != st->L_frame ) - { - resampleCldfb_ivas( st->cldfbAna, ( st->L_frame * FRAMES_PER_SEC ) ); - if ( st->L_frame <= L_FRAME16k ) - { - resampleCldfb_ivas( st->cldfbBPF, ( st->L_frame * FRAMES_PER_SEC ) ); - } - } - if ( st->bwidth == NB ) - { - int16_t nBand_nb = (int16_t) ( 8000 * st->cldfbSyn->no_channels / st->output_Fs ); - st->cldfbSyn->bandsToZero = st->cldfbSyn->no_channels - nBand_nb; - } - else - { - st->cldfbSyn->bandsToZero = 0; - } + if (st->last_codec_mode != MODE2 || !st->BER_detect) + { + /* Mode or Rate Change */ + if ((st->m_frame_type == ACTIVE_FRAME || st->m_frame_type == SID_FRAME) && ((st->total_brate != st->last_total_brate) || (st->bwidth != st->last_bwidth) || (st->last_codec_mode == MODE1) || (st->rf_flag != st->rf_flag_last) || st->force_lpd_reset)) + { + st->rate_switching_init = 1; - /*Reconf Frequency-domain based CNG*/ - configureFdCngDec( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); - if ( st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k ) - { - lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->L_frame * 2, st->last_L_frame * 2 ); - if ( st->m_frame_type == SID_FRAME && st->hFdCngDec->hFdCngCom->frame_type_previous != ACTIVE_FRAME ) - { - lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->L_frame * 2, st->last_L_frame * 2 ); - lerp_flt( hStereoCng->olapBufferSynth22, hStereoCng->olapBufferSynth22, st->L_frame * 2, st->last_L_frame * 2 ); - - if ( st->L_frame == L_FRAME ) - { - for ( n = 0; n < st->L_frame * 2; n++ ) - { - st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] * 1.25f; - } - } - else - { - for ( n = 0; n < st->L_frame * 2; n++ ) - { - st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] / 1.25f; - } - } - } - } + /* Reconf Core */ + mode_switch_decoder_LPD(st, st->bwidth, st->total_brate, st->last_total_brate, frame_size_index, 0, st->element_mode); - if ( st->bwidth != st->last_bwidth ) - { - st->hFdCngDec->hFdCngCom->msFrCnt_init_counter = 0; - st->hFdCngDec->hFdCngCom->init_old_flt = FLT_MAX; - } + /* Reconf. CLDFB: check if the CLDFB works on the right sample rate */ + if ((st->cldfbAna->no_channels * st->cldfbAna->no_col) != st->L_frame) + { + resampleCldfb_ivas(st->cldfbAna, (st->L_frame * FRAMES_PER_SEC)); + if (st->L_frame <= L_FRAME16k) + { + resampleCldfb_ivas(st->cldfbBPF, (st->L_frame * FRAMES_PER_SEC)); + } + } + if (st->bwidth == NB) + { + int16_t nBand_nb = (int16_t)(8000 * st->cldfbSyn->no_channels / st->output_Fs); + st->cldfbSyn->bandsToZero = st->cldfbSyn->no_channels - nBand_nb; + } + else + { + st->cldfbSyn->bandsToZero = 0; + } + + /*Reconf Frequency-domain based CNG*/ + configureFdCngDec(st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode); + if (st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k) + { + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->L_frame * 2, st->last_L_frame * 2); + if (st->m_frame_type == SID_FRAME && st->hFdCngDec->hFdCngCom->frame_type_previous != ACTIVE_FRAME) + { + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth, st->hFdCngDec->hFdCngCom->olapBufferSynth, st->L_frame * 2, st->last_L_frame * 2); + lerp_flt(hStereoCng->olapBufferSynth22, hStereoCng->olapBufferSynth22, st->L_frame * 2, st->last_L_frame * 2); - if ( st->tcxonly ) + if (st->L_frame == L_FRAME) + { + for (n = 0; n < st->L_frame * 2; n++) { - st->p_bpf_noise_buf_float = NULL; -#ifdef IVAS_FLOAT_FIXED - st->p_bpf_noise_buf_32 = NULL; -#endif - + st->hFdCngDec->hFdCngCom->olapBufferSynth[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth[n] * 1.25f; } - else + } + else + { + for (n = 0; n < st->L_frame * 2; n++) { - st->p_bpf_noise_buf_float = st->bpf_noise_buf_float; -#ifdef IVAS_FLOAT_FIXED - st->p_bpf_noise_buf_32 = st->bpf_noise_buf_32; -#endif - + st->hFdCngDec->hFdCngCom->olapBufferSynth[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth[n] / 1.25f; } + } } + } + + if (st->bwidth != st->last_bwidth) + { + st->hFdCngDec->hFdCngCom->msFrCnt_init_counter = 0; + st->hFdCngDec->hFdCngCom->init_old = FLT_MAX; + } + + if (st->tcxonly) + { + st->p_bpf_noise_buf = NULL; + } + else + { + st->p_bpf_noise_buf = st->bpf_noise_buf; + } } + } - st->total_brate = total_brate; + st->total_brate = total_brate; - return; + return; } diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index af41df508..dc20741ad 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -15,6 +15,7 @@ * transf_cdbk_dec() * Transform domain contribution decoding *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void transf_cdbk_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ const Word16 harm_flag_acelp,/* i : harmonic flag for higher rates ACELP */ @@ -238,6 +239,7 @@ void transf_cdbk_dec_fx( return; } +#endif /*==========================================================================*/ /* FUNCTION : Word16 gain_dequant_fx () */ @@ -262,6 +264,7 @@ void transf_cdbk_dec_fx( /*--------------------------------------------------------------------------*/ /* CALLED FROM : */ /*==========================================================================*/ +#ifdef IVAS_FLOAT_FIXED Word16 gain_dequant_fx( /* o: decoded gain */ Word16 index, /* i: quantization index */ const Word16 min_val, /* i: value of lower limit */ @@ -322,3 +325,4 @@ Word16 gain_dequant_fx( /* o: decoded gain */ return( gain ); } +#endif \ No newline at end of file diff --git a/lib_dec/dec_prm.c b/lib_dec/dec_prm.c index cf8428090..f16965fa6 100644 --- a/lib_dec/dec_prm.c +++ b/lib_dec/dec_prm.c @@ -329,6 +329,7 @@ void getTCXWindowing_ivas( * get LPC parameters *--------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void getLPCparam_ivas( Decoder_State *st, /* i/o: decoder memory state */ int16_t param_lpc[], /* o : LTP parameters */ @@ -402,6 +403,8 @@ void getLPCparam_ivas( return; } +#endif + #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * getTCXparam_ivas() diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index aa9170ca7..c995f2a50 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1489,7 +1489,7 @@ void decoder_tcx_noiseshaping_igf( * * TCX: TNS application *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void decoder_tcx_tns( Decoder_State *st, /* i/o: coder memory state */ const int16_t L_frame_glob, /* i : frame length */ @@ -1579,6 +1579,7 @@ void decoder_tcx_tns( return; } +#endif #ifdef IVAS_FLOAT_FIXED void decoder_tcx_tns_fx( diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 2b8d3209c..1c8b8ec1d 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3637,9 +3637,9 @@ void decoder_tcx_ivas_fx( decoder_tcx_noiseshaping_igf_fx( st, L_spec, L_frame, L_frameTCX, left_rect, x_fx, &x_e, &x_len, gainlpc2_fx, gainlpc2_e, &tmp_concealment_method, bfi ); - shift = Find_Max_Norm32( x_fx, N_MAX ) - 5; + shift = sub(Find_Max_Norm32( x_fx, N_MAX ) , 6); //6 -> guardbits// move16(); - Scale_sig32( x_fx, N_MAX, shift ); + Scale_sig32( x_fx, N_MAX, shift); x_e = sub( x_e, shift ); move16(); diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index 02f552450..8f540d8fa 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -48,7 +48,7 @@ * Read ACELP signaling bits from the bitstream * Set extension layers *-----------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void decision_matrix_dec( Decoder_State *st, /* i/o: decoder state structure */ int16_t *sharpFlag, /* o : formant sharpening flag */ @@ -567,3 +567,4 @@ void decision_matrix_dec( return; } +#endif \ No newline at end of file diff --git a/lib_dec/decision_matrix_dec_fx.c b/lib_dec/decision_matrix_dec_fx.c index 44b34f3fd..bb2a0546e 100644 --- a/lib_dec/decision_matrix_dec_fx.c +++ b/lib_dec/decision_matrix_dec_fx.c @@ -18,7 +18,7 @@ * Read ACELP signaling bits from the bitstream * Set extension layers *-----------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void decision_matrix_dec_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 *sharpFlag, /* o : formant sharpening flag */ @@ -709,3 +709,4 @@ void decision_matrix_dec_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/dlpc_avq.c b/lib_dec/dlpc_avq.c index 6e161254c..0a9dfe053 100644 --- a/lib_dec/dlpc_avq.c +++ b/lib_dec/dlpc_avq.c @@ -46,6 +46,7 @@ * Variable bitrate multiple LPC un-quantizer *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED int16_t dlpc_avq( int16_t *index, /* i : Quantization indices */ float *LSF_Q, /* o : Quantized LSF vectors */ @@ -321,3 +322,4 @@ int16_t decode_lpc_avq( return st->next_bit_pos - start_bit_pos; } +#endif \ No newline at end of file diff --git a/lib_dec/er_scale_syn.c b/lib_dec/er_scale_syn.c index 1a4cd3334..06947c5a4 100644 --- a/lib_dec/er_scale_syn.c +++ b/lib_dec/er_scale_syn.c @@ -47,7 +47,7 @@ * * Estimate damping factor *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED float Damping_fact_flt( const int16_t coder_type, const int16_t nbLostCmpt, @@ -138,3 +138,4 @@ float Damping_fact_flt( return alpha; } +#endif \ No newline at end of file diff --git a/lib_dec/er_sync_exc.c b/lib_dec/er_sync_exc.c index 70b930f18..f419be764 100644 --- a/lib_dec/er_sync_exc.c +++ b/lib_dec/er_sync_exc.c @@ -56,6 +56,7 @@ *--------------------------------------------------------------------*/ /*! r: Index of the position of the minimum energy, that is the position i where filter(x[i-filterLength/2],...,x[i+(filterLength-filterLength/2)-1]) is at maximum. */ +#ifndef IVAS_FLOAT_FIXED static int16_t GetMinimumPosition( const float *x, /* i : input signal */ const int16_t length, /* i : length of the filter length used for the energy calculation */ @@ -333,3 +334,4 @@ void PulseResynchronization( return; } +#endif \ No newline at end of file diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 102dde8cd..7cdbfbc2b 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -84,6 +84,7 @@ static void perform_noise_estimation_dec( const float *timeDomainInput, float *p * Create an instance of type FD_CNG *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error createFdCngDec( HANDLE_FD_CNG_DEC *hFdCngDec ) { @@ -109,7 +110,7 @@ ivas_error createFdCngDec( return error; } - +#endif /*------------------------------------------------------------------- * initFdCngDec() diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 22ae6ea99..290e0f5be 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -44,6 +44,7 @@ const Word16 stages_37bits = FD_CNG_stages_37bits; Function: create an instance of type FD_CNG */ +#ifdef IVAS_FLOAT_FIXED ivas_error createFdCngDec_fx (HANDLE_FD_CNG_DEC *hFdCngDec) { HANDLE_FD_CNG_DEC hs; @@ -65,6 +66,7 @@ ivas_error createFdCngDec_fx (HANDLE_FD_CNG_DEC *hFdCngDec) *hFdCngDec = hs; return error; } +#endif #ifdef IVAS_FLOAT_FIXED void initFdCngDec_ivas_fx( @@ -183,7 +185,7 @@ void initFdCngDec_ivas_fx( Copy( st->lsp_old_fx, st->lspCNG_fx, M ); return; } -#endif + void initFdCngDec_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale @@ -294,7 +296,7 @@ void initFdCngDec_fx( return; } - +#endif /* configureFdCngDec_fx @@ -883,7 +885,7 @@ Word16 ApplyFdCng_fx ( #else if (st->element_mode == IVAS_CPE_MDCT && st->core != ACELP_CORE) { - float scf[SNS_NPTS]; + float scf[SNS_NPTS]; float scf_int[FDNS_NPTS]; float whitenend_noise_shape[L_FRAME16k]; int16_t inc, start_idx, stop_idx; @@ -2985,6 +2987,7 @@ void perform_noise_estimation_dec_ivas_fx( Returns: void */ +#ifdef IVAS_FLOAT_FIXED void FdCng_decodeSID_fx (HANDLE_FD_CNG_COM st, Decoder_State *corest) { Word16 i, N, index; @@ -3110,7 +3113,7 @@ void FdCng_decodeSID_fx (HANDLE_FD_CNG_COM st, Decoder_State *corest) } - +#endif /* noisy_speech_detection_fx @@ -3132,6 +3135,7 @@ void FdCng_decodeSID_fx (HANDLE_FD_CNG_COM st, Decoder_State *corest) void */ +#ifdef IVAS_FLOAT_FIXED void noisy_speech_detection_fx ( HANDLE_FD_CNG_DEC hFdCngDec,/* i/o: FD_CNG structure */ const Word16 vad, @@ -3240,8 +3244,9 @@ void noisy_speech_detection_fx ( return; } +#endif - +#ifdef IVAS_FLOAT_FIXED void generate_comfort_noise_dec_fx ( Word32 **bufferReal, /* o : matrix to real part of input bands */ @@ -3729,7 +3734,6 @@ generate_comfort_noise_dec_hf_fx ( } } - void generate_comfort_noise_dec_hf_ivas_fx( Word32 **bufferReal, /* o : matrix to real part of input bands */ Word32 **bufferImag, /* o : matrix to imaginary part of input bands */ @@ -3856,7 +3860,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( return; } - +#endif /* @@ -3875,6 +3879,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( void */ +#ifdef IVAS_FLOAT_FIXED void generate_masking_noise_fx ( Word16 *timeDomainBuffer, /* i/o : pointer to time domain output buffer 15Q0 */ Word16 Q, @@ -4059,6 +4064,7 @@ void generate_masking_noise_fx ( } } +#endif /*------------------------------------------------------------------- * generate_masking_noise_update_seed_fx() @@ -4067,6 +4073,7 @@ void generate_masking_noise_fx ( * not called based on signal statistics *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void generate_masking_noise_update_seed_fx ( HANDLE_FD_CNG_COM hFdCngCom /* i/o : pointer to FD_CNG_COM structure */ ) @@ -4094,11 +4101,12 @@ void generate_masking_noise_update_seed_fx ( return; } - +#endif /************************************************************ * Generate additional comfort noise (kind of noise filling) * ************************************************************/ +#ifdef IVAS_FLOAT_FIXED void generate_masking_noise_mdct_fx ( Word32 *mdctBuffer, /* i/o: time-domain signal */ Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */ @@ -4266,6 +4274,7 @@ void generate_masking_noise_mdct_fx ( } } +#endif #ifdef IVAS_CODE_CNG diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index 66b39ade4..38aaab11f 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -102,7 +102,7 @@ void hf_synth_init( } #endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hf_synth_amr_wb_init() * @@ -130,7 +130,7 @@ void hf_synth_amr_wb_init( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hf_synth_amr_wb_reset() diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 839d6b299..2de4bd34a 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -42,12 +42,6 @@ #include "rom_com.h" #include "wmc_auto.h" #include "ivas_prot.h" -#ifdef IVAS_FLOAT_FIXED -#include "prot_fx1.h" -#include "prot_fx2.h" -#include "ivas_prot_fx.h" -#endif - /*-------------------------------------------------------------------------- * hq_core_dec() @@ -83,9 +77,7 @@ void hq_core_dec( int16_t index, left_rect, tcx_offsetFB, overlapFB, L_frameTCX; int16_t tcx_offset, overlap, L_frame, L_spec, fscaleFB; int16_t L_frameTCX_glob, L_frame_glob; -#ifndef IVAS_FLOAT_FIXED float acelp_zir[L_FRAME_MAX / 2]; -#endif int16_t encoderLookahead, encoderLookaheadFB; int16_t hq_recovery_flag; int16_t mdctWindowLength; @@ -152,17 +144,10 @@ void hq_core_dec( } } -#ifdef IVAS_FLOAT_FIXED - IF( hq_recovery_flag ) - { - acelp_plc_mdct_transition_fx( st ); - } -#else if ( hq_recovery_flag ) { acelp_plc_mdct_transition( st ); } -#endif /* subtract signaling bits */ num_bits -= st->next_bit_pos; @@ -324,88 +309,6 @@ void hq_core_dec( * Pre-echo reduction *--------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - IF( st->element_mode > EVS_MONO && ( core_switching_flag || hq_recovery_flag ) ) - { - // Float to fix code - Word32 t_audio_q_fx[L_FRAME48k_EXT]; /* Q12 */ - Word16 Q_audio = Q12; - Word16 E_audio = 31 - Q_audio; - Word16 wtda_audio_16_fx[2 * L_FRAME48k]; - Word16 acelp_zir_fx[L_FRAME_MAX / 2]; - Word16 output_fx[L_FRAME48k]; - Word16 synth_fx[L_FRAME48k]; - - Word16 Q_old_syn_Overl = -1; - //Word16 Q_old_Aq_12_8 = 12; - floatToFixed_arrL( t_audio_q, t_audio_q_fx, Q_audio, L_FRAME48k_EXT ); - floatToFixed_arr( hHQ_core->old_out, hHQ_core->old_out_fx, hHQ_core->Q_old_wtda, L_FRAME48k ); - floatToFixed_arr( hHQ_core->old_outLB, hHQ_core->old_out_LB_fx, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, Q_old_syn_Overl, L_FRAME32k / 2 ); - //floatToFixed_arr( st->old_Aq_12_8, st->old_Aq_12_8_fx, Q_old_Aq_12_8, M + 1 ); - - /* Initializations for TCX MDCT framework, to be used for switching frame */ - tcx_cfg = st->hTcxCfg; - L_frameTCX_glob = hTcxDec->L_frameTCX; - L_frame_glob = st->L_frame; - L_spec = hTcxDec->L_frameTCX; - st->fscale = sr2fscale( st->sr_core ); - fscaleFB = sr2fscale( st->output_Fs ); - encoderLookahead = ( L_LOOK_12k8 * st->fscale ) / FSCALE_DENOM; - encoderLookaheadFB = ( L_LOOK_12k8 * fscaleFB ) / FSCALE_DENOM; - mdctWindowLength = getMdctWindowLength( st->fscale ); - mdctWindowLengthFB = (int16_t) ( mdctWindowLength * st->output_Fs / st->sr_core ); - IF( core_switching_flag ) - { - tcx_cfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; - tcx_cfg->tcx_curr_overlap_mode = FULL_OVERLAP; - } - ELSE - { - tcx_cfg->tcx_last_overlap_mode = ALDO_WINDOW; - tcx_cfg->tcx_curr_overlap_mode = ALDO_WINDOW; - st->last_core = HQ_CORE; /* Needed to decode non-transition frame */ - } - - init_tcx_window_cfg_fx( tcx_cfg, st->sr_core, st->output_Fs, st->L_frame, hTcxDec->L_frameTCX, mdctWindowLength, mdctWindowLengthFB, st->element_mode ); - - init_tcx_info_fx( st, L_frame_glob, L_frameTCX_glob, 0, st->bfi, &tcx_offset, &tcx_offsetFB, &L_frame, &L_frameTCX, &left_rect, &L_spec ); - - overlap = tcx_cfg->tcx_mdct_window_length; - overlapFB = tcx_cfg->tcx_mdct_window_lengthFB; - index = tcx_cfg->tcx_last_overlap_mode; - - /* LB synthesis */ - - IMDCT_fx( t_audio_q_fx, E_audio, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, - left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, st, 0, acelp_zir_fx ); - - Scale_sig( wtda_audio_16_fx + L_frame, overlap, Q1 ); - - Copy( wtda_audio_16_fx + ( overlap >> 1 ) - tcx_offset, output_fx, L_frame_glob ); // output Q - Q0 - - /* FB synthesis */ - - IMDCT_fx( t_audio_q_fx, E_audio, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1_FB, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, - left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir_fx ); - - Scale_sig( wtda_audio_16_fx + L_frameTCX, overlapFB, Q1 ); - - Copy( wtda_audio_16_fx + ( overlapFB >> 1 ) - tcx_offsetFB, synth_fx, L_frameTCX_glob ); - - IF( !core_switching_flag ) - { - st->last_core = ACELP_CORE; /* Restore last core */ - } - // Fixed to Float - fixedToFloat_arrL( t_audio_q_fx, t_audio_q, Q_audio, L_FRAME48k_EXT ); - //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, Q_old_syn_Overl, L_FRAME32k / 2 ); - fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); - fixedToFloat_arr( output_fx, output, 0, L_frame_glob ); - fixedToFloat_arr( synth_fx, synth, 0, L_frameTCX_glob ); - } -#else if ( st->element_mode > EVS_MONO && ( core_switching_flag || hq_recovery_flag ) ) { /* Initializations for TCX MDCT framework, to be used for switching frame */ @@ -440,15 +343,13 @@ void hq_core_dec( index = tcx_cfg->tcx_last_overlap_mode; /* LB synthesis */ - - IMDCT( t_audio_q, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc_flt, tcx_cfg->tcx_aldo_window_2_flt, tcx_cfg->tcx_mdct_window_half_flt, tcx_cfg->tcx_mdct_window_minimum_flt, tcx_cfg->tcx_mdct_window_trans_flt, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, + IMDCT( t_audio_q, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, MDCT_IV, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_outLB, 0, st, 0, acelp_zir ); mvr2r( wtda_audio + ( overlap >> 1 ) - tcx_offset, output, L_frame_glob ); /* FB synthesis */ - - IMDCT( t_audio_q, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc_flt, tcx_cfg->tcx_aldo_window_2_FB_flt, tcx_cfg->tcx_mdct_window_halfFB_flt, tcx_cfg->tcx_mdct_window_minimumFB_flt, tcx_cfg->tcx_mdct_window_transFB_flt, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, + IMDCT( t_audio_q, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, MDCT_IV, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); mvr2r( wtda_audio + ( overlapFB >> 1 ) - tcx_offsetFB, synth, L_frameTCX_glob ); @@ -458,7 +359,6 @@ void hq_core_dec( st->last_core = ACELP_CORE; /* Restore last core */ } } -#endif else { if ( output_frame == L_FRAME8k || st->bfi == 0 ) @@ -475,33 +375,6 @@ void hq_core_dec( if ( st->element_mode > EVS_MONO ) { -#ifdef IVAS_FLOAT_FIXED - Word16 ener_match_fx; /* Q13 */ - Word32 t_audio_q_fx[L_FRAME48k_EXT]; /* Q12 */ - Word16 Q_audio = Q12; - Word32 wtda_audio_LB_fx[2 * L_FRAME16k]; - Word16 tmp, tmp_e; - floatToFixed_arrL( t_audio_q, t_audio_q_fx, Q_audio, L_FRAME48k_EXT ); - IF( st->bfi ) - { - /* Rough resampling, but reduces energy loss in case of switch to ACELP in first good frame */ - L_lerp_fx_q11( t_audio_q_fx, wtda_audio_LB_fx, st->L_frame, inner_frame ); - v_multc_fixed_16( t_audio_q_fx, ONE_IN_Q14, wtda_audio_LB_fx, st->L_frame ); - } - ELSE - { - /* LB synthesis for potential switch to ACELP */ - tmp = BASOP_Util_Divide1616_Scale( st->L_frame, output_frame, &tmp_e ); - tmp = Sqrt16( tmp, &tmp_e ); - ener_match_fx = shr( tmp, 2 - tmp_e ); // Q13 - - v_multc_fixed_16( t_audio_q_fx, ener_match_fx, t_audio_q_fx, inner_frame ); // Q - - Scale_sig32( t_audio_q_fx, inner_frame, Q2 ); - Inverse_Transform( t_audio_q_fx, &Q_audio, wtda_audio_LB_fx, is_transient, st->L_frame, inner_frame, st->element_mode ); - } - fixedToFloat_arrL( wtda_audio_LB_fx, wtda_audio_LB, Q_audio, 2 * L_FRAME16k ); -#else if ( st->bfi ) { /* Rough resampling, but reduces energy loss in case of switch to ACELP in first good frame */ @@ -515,7 +388,6 @@ void hq_core_dec( v_multc( t_audio_q, ener_match, t_audio_q, inner_frame ); inverse_transform( t_audio_q, wtda_audio_LB, is_transient, st->L_frame, inner_frame, st->element_mode ); } -#endif } if ( output_frame == L_FRAME8k ) @@ -558,27 +430,7 @@ void hq_core_dec( if ( st->element_mode > EVS_MONO ) { /* LB synthesis for potential switch to ACELP */ -#ifdef IVAS_FLOAT_FIXED - Word16 Q_audio = Q15; - Word32 wtda_audio_LB_fx[2 * L_FRAME16k]; - Word16 output_fx[L_FRAME48k]; - Word16 Q_output, Q_oldgapsynth, Q_wtda_audio; - Q_wtda_audio = Q_audio; - - Q_output = Q_factor_arr( output, L_FRAME48k ); - Q_oldgapsynth = Q_factor_arr( hHQ_core->oldgapsynth, L_FRAME48k ); - floatToFixed_arrL( wtda_audio_LB, wtda_audio_LB_fx, Q_wtda_audio, 2 * L_FRAME16k ); - floatToFixed_arr( output, output_fx, Q_output, L_FRAME48k ); - floatToFixed_arr( hHQ_core->old_outLB, hHQ_core->old_out_LB_fx, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - floatToFixed_arr( hHQ_core->oldgapsynth, hHQ_core->oldgapsynth_fx, Q_oldgapsynth, L_FRAME32k ); - - window_ola_fx( wtda_audio_LB_fx, output_fx, &Q_output, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, st->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx ); - - fixedToFloat_arr( output_fx, output, Q_output, L_FRAME48k ); - fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); -#else window_ola( wtda_audio_LB, output, hHQ_core->old_outLB, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, st->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth ); -#endif } if ( ( !st->bfi && !st->prev_bfi ) || ( !( output_frame >= L_FRAME16k ) ) ) @@ -590,7 +442,7 @@ void hq_core_dec( if ( !st->bfi && st->prev_bfi && st->last_total_brate >= HQ_48k && st->last_codec_mode == MODE2 && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hPlcInfo->concealment_method == TCX_NONTONAL && st->hPlcInfo->nbLostCmpt < 4 ) { - waveform_adj2( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut_float, synth, 0, st->hPlcInfo->nbLostCmpt + 1, st->bfi ); + waveform_adj2( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut, synth, 0, st->hPlcInfo->nbLostCmpt + 1, st->bfi ); } if ( output_frame >= L_FRAME16k ) @@ -630,8 +482,8 @@ void hq_core_dec( } mvr2r( &st->old_pitch_buf[st->L_frame / L_SUBFR], st->old_pitch_buf, st->L_frame / L_SUBFR ); set_f( &st->old_pitch_buf[st->L_frame / L_SUBFR], (float) L_SUBFR, st->L_frame / L_SUBFR ); - mvr2r( &st->mem_pitch_gain_float[2], &st->mem_pitch_gain_float[st->L_frame / L_SUBFR + 2], st->L_frame / L_SUBFR ); - set_zero( &st->mem_pitch_gain_float[2], st->L_frame / L_SUBFR ); + mvr2r( &st->mem_pitch_gain[2], &st->mem_pitch_gain[st->L_frame / L_SUBFR + 2], st->L_frame / L_SUBFR ); + set_zero( &st->mem_pitch_gain[2], st->L_frame / L_SUBFR ); /* Move LB excitation to old_exc memory in case of switch HQ->ACELP */ if ( st->element_mode > EVS_MONO ) @@ -649,103 +501,7 @@ void hq_core_dec( * * Initialize HQ core state structure *-------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void HQ_core_dec_init_flt( - HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ -) -{ - - set_f( hHQ_core->old_out, 0, L_FRAME48k ); - set_f( hHQ_core->old_outLB, 0, L_FRAME32k ); - set_s( hHQ_core->old_is_transient, 0, 3 ); - -#ifdef IVAS_FLOAT_FIXED - hHQ_core->Q_old_wtda = 0; - hHQ_core->Q_old_wtda_LB = 0; -#endif - - hHQ_core->oldHqVoicing = 0; - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->prev_noise_level, 0.0f, 2 ); -#endif - hHQ_core->prev_R = 0; -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE ); -#endif - set_s( hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM ); - - /* HQ GENERIC */ - hHQ_core->hq_generic_seed = RANDOM_INITSEED; - - hHQ_core->mem_norm[0] = 31; - set_s( hHQ_core->mem_norm + 1, 39, SFM_N_ENV_STAB - 1 ); - hHQ_core->mem_env_delta = 0; - hHQ_core->no_att_hangover = 0; - //hHQ_core->energy_lt = 300.0f; - - hHQ_core->HqVoicing = 0; -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->fer_samples, 0, L_FRAME48k ); - set_f( hHQ_core->prev_env, 0, SFM_N_WB ); - set_f( hHQ_core->prev_normq, 0, SFM_N_WB ); -#endif - hHQ_core->prev_hqswb_clas = HQ_NORMAL; - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->last_ni_gain, 0, BANDS_MAX ); - set_f( hHQ_core->last_env, 0, BANDS_MAX ); -#endif - hHQ_core->last_max_pos_pulse = 0; - hHQ_core->prev_frm_hfe2 = 0; - hHQ_core->prev_stab_hfe2 = 0; #ifndef IVAS_FLOAT_FIXED - hHQ_core->prev_ni_ratio = 0.5f; - set_f( hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS ); -#endif - - - /*----------------------------------------------------------------------------------* - * HQ FEC - *----------------------------------------------------------------------------------*/ - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->X_sav, 0.0f, PH_ECU_SPEC_SIZE ); -#endif - hHQ_core->num_p = 0; - hHQ_core->ph_ecu_active = 0; - hHQ_core->ni_seed_forfec = 0; - hHQ_core->last_fec = 0; - hHQ_core->ph_ecu_HqVoicing = 0; -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->oldgapsynth, 0.0f, L_FRAME48k ); - hHQ_core->env_stab = 0.75f; -#endif - hHQ_core->mem_norm_hqfec[0] = 31; - set_s( hHQ_core->mem_norm_hqfec + 1, 39, SFM_N_ENV_STAB - 1 ); - hHQ_core->mem_env_delta_hqfec = 0; -#ifndef IVAS_FLOAT_FIXED - hHQ_core->env_stab_plc = 0.0f; - set_f( hHQ_core->env_stab_state_p, 1.0f / NUM_ENV_STAB_PLC_STATES, NUM_ENV_STAB_PLC_STATES ); -#endif - hHQ_core->envstabplc_hocnt = 0; - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->mag_chg_1st, 1.0f, LGW_MAX ); - set_f( hHQ_core->Xavg, 0.0f, LGW_MAX ); - hHQ_core->beta_mute = BETA_MUTE_FAC_INI_FLT; -#endif - - hHQ_core->time_offs = 0; - hHQ_core->ber_occured_in_pvq = 0; - - hHQ_core->last_hq_core_type = -1; - - reset_preecho_dec( hHQ_core ); - - return; -} -#else void HQ_core_dec_init_flt( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ) diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index a3d31ee09..2573f9955 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -1209,14 +1209,15 @@ void HQ_core_dec_init_fx( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ) { - +#if 1 //TOBE Removed later + set_f( hHQ_core->old_out, 0, L_FRAME48k ); + set_f( hHQ_core->old_outLB, 0, L_FRAME32k ); +#endif set16_fx(hHQ_core->old_out_fx, 0, L_FRAME48k); set16_fx(hHQ_core->old_out_LB_fx, 0, L_FRAME32k); -#ifdef IVAS_FLOAT_FIXED set32_fx(hHQ_core->oldOut_fx, 0, L_FRAME48k); set32_fx(hHQ_core->old_outLB_fx, 0, L_FRAME32k); -#endif - hHQ_core->Q_old_wtda = 15; + hHQ_core->Q_old_wtda = 0; hHQ_core->Q_old_postdec = 0; hHQ_core->Q_old_wtda_LB = 0; hHQ_core->Q_old_out = 0; diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 332eef94e..9f74296f3 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1225,9 +1225,6 @@ ivas_error init_decoder_ivas_fx( } /* HQ core initialization */ -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - HQ_core_dec_init_flt( st_fx->hHQ_core ); -#endif HQ_core_dec_init_fx( st_fx->hHQ_core ); IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) diff --git a/lib_dec/inov_dec.c b/lib_dec/inov_dec.c index 482d867d9..83b66adf8 100644 --- a/lib_dec/inov_dec.c +++ b/lib_dec/inov_dec.c @@ -49,6 +49,7 @@ * Decode the algebraic innovation and do pitch sharpening *----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void inov_decode( Decoder_State *st, /* i/o: decoder state structure */ const int32_t core_brate, /* i : core bitrate */ @@ -191,3 +192,4 @@ void inov_decode( return; } +#endif \ No newline at end of file diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index e25cfe2bc..2129ca3db 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -233,7 +233,7 @@ ivas_error ivas_core_dec( L_tmp = L_shl( L_tmp, st->last_concealed_gain_syn_deemph_e ); st->hHQ_core->old_out_LB_fx[i] = extract_l( L_tmp ); // Q0 } - Copy_Scale_sig_16_32( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB_fx, st->L_frame, 11 ); + //Copy_Scale_sig_16_32( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB_fx, st->L_frame, 11 ); } set16_fx( voice_factors_fx[n], 0, NB_SUBFR16k ); @@ -272,8 +272,9 @@ ivas_error ivas_core_dec( Word16 ovl, fade_len; IF( sts[0]->L_frame != sts[0]->last_L_frame ) { + Copy_Scale_sig_16_32( sts[0]->hHQ_core->old_out_LB_fx, sts[0]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - sts[0]->hHQ_core->Q_old_wtda_LB ); L_lerp_fx_q11( sts[0]->hHQ_core->old_outLB_fx, sts[0]->hHQ_core->old_outLB_fx, sts[0]->L_frame, sts[0]->last_L_frame ); - Copy_Scale_sig_32_16( sts[0]->hHQ_core->old_outLB_fx, sts[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, -11 ); + Copy_Scale_sig_32_16( sts[0]->hHQ_core->old_outLB_fx, sts[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sts[0]->hHQ_core->Q_old_wtda_LB - Q11); } IF( sts[0]->L_frame != L_FRAME16k ) { @@ -324,18 +325,6 @@ ivas_error ivas_core_dec( ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps ); } -#ifndef TO_BE_REMOVED_CONVERSION - for (Word16 k = 0; k < n_channels; k++ ) - { - if ( sts[k]->hTcxDec != NULL ) - { - fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, 0, L_FRAME48k ); - fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, 0, L_FRAME32k ); - } - } - -#endif - /*------------------------------------------------------------------* * Core Decoding *-----------------------------------------------------------------*/ @@ -477,16 +466,18 @@ ivas_error ivas_core_dec( stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 1, last_element_mode, frameMode[n]); /* TCX decoder */ - Scale_sig(st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp); - Scale_sig(st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp); - Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27)); + Scale_sig( st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp ); + Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp ); + Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) ); st->hFdCngDec->msNoiseEst_exp = 27; + Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, -st->hHQ_core->Q_old_wtda_LB ); + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda ); stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); + st->hHQ_core->Q_old_wtda_LB = st->hHQ_core->Q_old_wtda; + Copy_Scale_sig_16_32( output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 ); - Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k,Q11); - - stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 0, last_element_mode, frameMode[n]); + stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 0, last_element_mode, frameMode[n] ); fixed_to_float_stereo_tcx_core_dec( st, output_16_fx[n] ); } @@ -495,17 +486,9 @@ ivas_error ivas_core_dec( /* HQ core decoder */ Q_synth = 0; Word16 Q_output = 0; - HQ_DEC_HANDLE hHQ_core; - - hHQ_core = st->hHQ_core; - - st->hHQ_core->Q_old_wtda = -1; - st->hHQ_core->Q_old_wtda_LB = -1; + //HQ_DEC_HANDLE hHQ_core; -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - floatToFixed_arr( hHQ_core->old_out, hHQ_core->old_out_fx, hHQ_core->Q_old_wtda, L_FRAME48k ); - floatToFixed_arr( hHQ_core->old_outLB, hHQ_core->old_out_LB_fx, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); -#endif + //hHQ_core = st->hHQ_core; ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); @@ -518,8 +501,8 @@ ivas_error ivas_core_dec( Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); - fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + //fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); + //fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); #endif } @@ -573,11 +556,14 @@ ivas_error ivas_core_dec( st->prev_Q_syn = st->Q_syn; - IF( st->hHQ_core ) - floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->Q_syn, L_FRAME32k ); + Scale_sig(st->hHQ_core->old_out_LB_fx, L_FRAME32k, st->Q_syn - st->hHQ_core->Q_old_wtda_LB); + Scale_sig(st->hHQ_core->old_out_fx, L_FRAME48k, st->Q_syn - st->hHQ_core->Q_old_wtda); + + //IF( st->hHQ_core ) + //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->Q_syn, L_FRAME32k ); - IF( st->hHQ_core ) - floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); + //IF( st->hHQ_core ) + //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) //{ // st->hTcxDec->conLastFrameLevel_e = 0; @@ -607,6 +593,8 @@ ivas_error ivas_core_dec( #endif stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx ); + + #if 1 // Fix to float conversion //IF( st_ivas->hLsSetUpConversion ) //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); @@ -625,31 +613,32 @@ ivas_error ivas_core_dec( { for ( int p = 0; p < s_min( 62, sts[ch]->hFdCngDec->npart_shaping ); p++ ) { - sts[ch]->hFdCngDec->msNoiseEst_float[p] = ( (float) sts[ch]->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); + //sts[ch]->hFdCngDec->msNoiseEst_float[p] = ( (float) sts[ch]->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); } } } - + st->hHQ_core->Q_old_wtda_LB = st->Q_syn; + st->hHQ_core->Q_old_wtda = st->Q_syn; if(st->Q_syn >= 0){ - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } - - for ( int p = 0; p < 960; p++ ) - { - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); - } + //for ( int p = 0; p < 640; p++ ) + //{ + // st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); + //} + + //for ( int p = 0; p < 960; p++ ) + //{ + // st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); + //} }else{ - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->Q_syn) ); - } - - for ( int p = 0; p < 960; p++ ) - { - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->Q_syn) ); - } + //for ( int p = 0; p < 640; p++ ) + //{ + // st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->Q_syn) ); + //} + + //for ( int p = 0; p < 960; p++ ) + //{ + // st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->Q_syn) ); + //} } } @@ -673,15 +662,19 @@ ivas_error ivas_core_dec( if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); - f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); + sts[0]->hHQ_core->exp_old_out = 15 - sts[0]->hHQ_core->Q_old_wtda; + sts[1]->hHQ_core->exp_old_out = 15 - sts[1]->hHQ_core->Q_old_wtda; + // f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); + // f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); } updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx ); if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - me2f_buf_16( sts[0]->hHQ_core->old_out_fx, sts[0]->hHQ_core->exp_old_out, sts[0]->hHQ_core->old_out, L_FRAME48k ); - me2f_buf_16( sts[1]->hHQ_core->old_out_fx, sts[1]->hHQ_core->exp_old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); + sts[0]->hHQ_core->Q_old_wtda = 15 - sts[0]->hHQ_core->exp_old_out; + sts[1]->hHQ_core->Q_old_wtda = 15 - sts[1]->hHQ_core->exp_old_out; + //me2f_buf_16( sts[0]->hHQ_core->old_out_fx, sts[0]->hHQ_core->exp_old_out, sts[0]->hHQ_core->old_out, L_FRAME48k ); + //me2f_buf_16( sts[1]->hHQ_core->old_out_fx, sts[1]->hHQ_core->exp_old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); } #else @@ -744,7 +737,7 @@ ivas_error ivas_core_dec( if (st->hHQ_core != NULL) { st->hHQ_core->Q_old_postdec = 0; - st->hHQ_core->Q_old_wtda = 0; + //st->hHQ_core->Q_old_wtda = 0; } /*------------------fix-to-fix-end-----------------------*/ @@ -765,9 +758,12 @@ ivas_error ivas_core_dec( Scale_sig32(output_32_fx[n], L_FRAME48k, Q4 - Q11); - IF(st->hHQ_core != NULL) + IF( st->hHQ_core != NULL ) { - floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, 0, L_FRAME48k); + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda ); + st->hHQ_core->Q_old_wtda = 0; + + //floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_wtda, L_FRAME48k); } /*size of synth is choosen as delay comp to start with*/ @@ -888,10 +884,10 @@ ivas_error ivas_core_dec( #else Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); #endif - IF(st->hHQ_core != NULL) { - fixedToFloat_arr(st->hHQ_core->old_out_fx, st->hHQ_core->old_out, 0, L_FRAME48k); + //st->hHQ_core->Q_old_wtda = 0; + //fixedToFloat_arr(st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k); } @@ -1291,34 +1287,38 @@ ivas_error ivas_core_dec( { if (hCPE->hCoreCoder[ch_ind]->hHQ_core != NULL) { - FOR(int ind = 0; ind < L_FRAME32k; ind++) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB[ind] * (1 << 11)); - } - FOR(int ind = 0; ind < L_FRAME48k; ind++) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] * (1 << 11)); - } + Copy_Scale_sig_16_32(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda_LB); + //FOR(int ind = 0; ind < L_FRAME32k; ind++) + //{ + // hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB[ind] * (1 << 11)); + //} + Copy_Scale_sig_16_32(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx, L_FRAME48k, Q11 - hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda); + //FOR(int ind = 0; ind < L_FRAME48k; ind++) + //{ + // hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] * (1 << 11)); + //} } } } } - if (hSCE != NULL) + if ( hSCE != NULL ) { - if (hSCE->hCoreCoder[0] != NULL) - { - if (hSCE->hCoreCoder[0]->hHQ_core != NULL) + if ( hSCE->hCoreCoder[0] != NULL ) { - FOR(int ind = 0; ind < L_FRAME32k; ind++) - { - hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx[ind] = (Word32)(hSCE->hCoreCoder[0]->hHQ_core->old_outLB[ind] * (1 << 11)); - } - FOR(int ind = 0; ind < L_FRAME48k; ind++) - { - hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] = (Word32)(hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] * (1 << 11)); - } + if ( hSCE->hCoreCoder[0]->hHQ_core != NULL ) + { + Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); + /*FOR( int ind = 0; ind < L_FRAME32k; ind++ ) + { + hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx[ind] = (Word32) ( hSCE->hCoreCoder[0]->hHQ_core->old_outLB[ind] * ( 1 << 11 ) ); + }*/ + Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_fx, hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx, L_FRAME48k, Q11 - hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); + /*FOR( int ind = 0; ind < L_FRAME48k; ind++ ) + { + hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] = (Word32) ( hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] * ( 1 << 11 ) ); + }*/ + } } - } } Word16 exp_max = 0; @@ -1418,50 +1418,17 @@ ivas_error ivas_core_dec( Scale_sig( st->delay_buf_out_fx, NS2SA( st->output_Fs, DELAY_CLDFB_NS ), -exp_max ); -#ifdef IVAS_FLOAT_FIXED - - if ( hCPE != NULL ) - { + } /* n_channels loop */ - FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ ) - { - if ( hCPE->hCoreCoder[ch_ind] != NULL ) - { - if ( hCPE->hCoreCoder[ch_ind]->hHQ_core != NULL ) - { - FOR( int ind = 0; ind < L_FRAME32k; ind++ ) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB[ind] = (float) hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx[ind] / (float) ( 1 << 11 ); - } - FOR( int ind = 0; ind < L_FRAME48k; ind++ ) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] = (float) hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] / (float) ( 1 << 11 ); - } - } - } - } - } - if ( hSCE != NULL ) + for ( Word16 k = 0; k < n_channels; k++ ) + { + if ( sts[k]->hHQ_core != NULL ) { - if ( hSCE->hCoreCoder[0] != NULL ) - { - if ( hSCE->hCoreCoder[0]->hHQ_core != NULL ) - { - FOR( int ind = 0; ind < L_FRAME32k; ind++ ) - { - hSCE->hCoreCoder[0]->hHQ_core->old_outLB[ind] = (float) hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx[ind] / (float) ( 1 << 11 ); - } - FOR( int ind = 0; ind < L_FRAME48k; ind++ ) - { - hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] = (float) hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] / (float) ( 1 << 11 ); - } - } - } + fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + //fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); } -#endif - } /* n_channels loop */ - + } pop_wmops(); return error; diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 2fa750755..26cefab72 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -545,10 +545,10 @@ ivas_error ivas_cpe_dec_fx( Word16 k; for ( k = 0; k < n_channels; k++ ) { - if ( sts[k]->hTcxDec != NULL ) + if ( sts[k]->hHQ_core != NULL ) { - floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, 0, L_FRAME48k ); - floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, 0, L_FRAME32k ); + floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); } } @@ -557,6 +557,15 @@ ivas_error ivas_cpe_dec_fx( { return error; } + + for ( k = 0; k < n_channels; k++ ) + { + if ( sts[k]->hHQ_core != NULL ) + { + fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + } + } } IF( st_ivas->hMCT ) @@ -581,10 +590,10 @@ ivas_error ivas_cpe_dec_fx( Word16 k; for ( k = 0; k < n_channels; k++ ) { - if ( sts[k]->hTcxDec != NULL ) + if ( sts[k]->hHQ_core != NULL ) { - floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, 0, L_FRAME48k ); - floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, 0, L_FRAME32k ); + floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); } } @@ -597,6 +606,15 @@ ivas_error ivas_cpe_dec_fx( return error; } + for ( k = 0; k < n_channels; k++ ) + { + if ( sts[k]->hHQ_core != NULL ) + { + fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + } + } + // Scaling of DFT's Word16 shift; Word32 tmp1, tmp2; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 039e42cfa..7be244980 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1766,9 +1766,6 @@ static ivas_error ivas_mc_dec_reconfig( } /* HQ core initialization */ -#if 1/*TODO: To be removed later*/ - HQ_core_dec_init_flt( st->hHQ_core ); -#endif HQ_core_dec_init_fx( st->hHQ_core ); } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index c49a1fac3..139edc693 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -237,10 +237,10 @@ ivas_error ivas_sce_dec_fx( * Decoder *----------------------------------------------------------------*/ #ifndef TO_BE_REMOVED_CONVERSION - if (st->hTcxDec != NULL) + if (st->hHQ_core != NULL) { - floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, 0, L_FRAME48k); - floatToFixed_arr(st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, 0, L_FRAME32k); + floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_wtda, L_FRAME48k); + floatToFixed_arr(st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_wtda_LB, L_FRAME32k); floatToFixed_arrL(st->hHQ_core->old_outLB, st->hHQ_core->old_outLB_fx, 11, L_FRAME32k); } #endif @@ -251,6 +251,12 @@ ivas_error ivas_sce_dec_fx( return error; } + IF ( st->hHQ_core != NULL ) + { + fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k ); + fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + } + IF( st_ivas->sba_dirac_stereo_flag && ( GT_32( st->core_brate, SID_2k40 ) || EQ_16( st->cng_type, LP_CNG ) ) ) { /* skip addition of ACELP BWE for now, will be done after upmix */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 5215ba636..207232428 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -456,7 +456,12 @@ void stereo_mdct_core_dec_fx( IF(sts[ch]->hFdCngDec && sts[ch]->hFdCngDec->hFdCngCom) { s = getScaleFactor32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); - Scale_sig32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, s); + IF(GT_16(s, sub(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4))) + { + s = sub(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + move16(); + } + scale_sig32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, s); sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, s); } IF(sts[ch]->hFdCngDec && sts[ch]->hFdCngDec->hFdCngCom) { diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 36689712d..55f04691e 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -191,9 +191,6 @@ static ivas_error allocate_CoreCoder_TCX_fx( } HQ_core_dec_init_fx( st->hHQ_core ); -#if 1 // TODO: To be removed later - HQ_core_dec_init_flt( st->hHQ_core ); -#endif } IF ( st->hIGFDec == NULL ) @@ -1402,9 +1399,6 @@ ivas_error stereo_memory_dec_fx( } HQ_core_dec_init_fx( st->hHQ_core ); -#if 1 // TODO: to be removed later - HQ_core_dec_init_flt( st->hHQ_core ); -#endif } /* allocate TD CNG handle */ diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 105e33499..45b8bbcfc 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -144,10 +144,10 @@ typedef struct float msNoiseFloor_float[NPART_SHAPING]; /* Estimated noise floor */ #endif Word16 msNoiseFloor[NPART_SHAPING]; /* Estimated noise floor */ - +#ifndef IVAS_FLOAT_FIXED float msNoiseEst_float[NPART_SHAPING]; /* Estimated noise level */ +#endif Word32 msNoiseEst[NPART_SHAPING]; /* Estimated noise level */ - Word16 msNoiseEst_exp; #ifndef IVAS_FLOAT_FIXED float msLogPeriodog_float[NPART_SHAPING]; /* Periodogram */ @@ -335,8 +335,9 @@ typedef struct Word16 * spectralData; Word16 spectralData_exp; - +#ifndef IVAS_FLOAT_FIXED float *scaleFactors_float; +#endif Word16 * scaleFactors; Word16 * scaleFactors_exp; @@ -611,15 +612,17 @@ typedef struct tcx_ltp_dec_structure int16_t tcxltp_pitch_int; int16_t tcxltp_pitch_fr; - +#ifndef IVAS_FLOAT_FIXED float tcxltp_mem_in_float[TCXLTP_MAX_DELAY]; +#endif Word16 tcxltp_mem_in[TCXLTP_MAX_DELAY]; Word32 tcxltp_mem_in_32[TCXLTP_MAX_DELAY]; #ifdef IVAS_FLOAT_FIXED Word16 exp_tcxltp_mem_in; #endif - +#ifndef IVAS_FLOAT_FIXED float tcxltp_mem_out_float[L_FRAME48k]; +#endif Word16 tcxltp_mem_out[L_FRAME48k]; Word32 tcxltp_mem_out_32[L_FRAME48k]; #ifdef IVAS_FLOAT_FIXED @@ -657,8 +660,9 @@ typedef struct tcx_dec_structure Word32 tcxltp_second_last_pitch; Word32 tcxltp_third_last_pitch; - +#ifndef IVAS_FLOAT_FIXED float tcxltp_last_gain_unmodified_float; +#endif Word16 tcxltp_last_gain_unmodified; int16_t tcx_hm_LtpPitchLag; @@ -930,8 +934,9 @@ typedef struct ld_music_postfilt_structure float LDm_bckr_noise[MBANDS_GN_LD]; /* LD music post-filter - background noise estimation per critical band */ #endif Word32 LDm_bckr_noise_fx[MBANDS_GN_LD]; /* LD music post-filter - background noise estimation per critical band */ - +#ifndef IVAS_FLOAT_FIXED float filt_lfE[DCT_L_POST]; +#endif Word16 filt_lfE_fx[DCT_L_POST]; int16_t last_nonfull_music; @@ -2055,33 +2060,48 @@ typedef struct pvq_dec_structure typedef struct amrwb_io_dec_structure { +#ifndef IVAS_FLOAT_FIXED float past_qua_en[GAIN_PRED_ORDER]; /* gain quantization memory (used also in AMR-WB IO mode) */ +#endif Word16 past_qua_en_fx[GAIN_PRED_ORDER]; /* gain quantization memory (used also in AMR-WB IO mode) */ +#ifndef IVAS_FLOAT_FIXED float prev_r; /* HF BWE - previous sub-frame gain */ +#endif Word16 prev_r_fx; /* HF BWE - previous sub-frame gain */ - + +#ifndef IVAS_FLOAT_FIXED float fmerit_w_sm; /* HF BWE - fmerit parameter memory */ - Word16 fmerit_w_sm_fx; /* HF BWE - fmerit parameter memory */ - +#endif + Word16 fmerit_w_sm_fx; /* HF BWE - fmerit parameter memory */ + int16_t frame_count; /* HF BWE - frame count */ Word16 frame_count_fx; /* HF BWE - frame count */ - +#ifndef IVAS_FLOAT_FIXED float ne_min; /* HF BWE - minimum Noise gate - short-term energy */ - Word16 ne_min_fx; /* HF BWE - minimum Noise gate - short-term energy */ - +#endif + Word16 ne_min_fx; /* HF BWE - minimum Noise gate - short-term energy */ + +#ifndef IVAS_FLOAT_FIXED float fmerit_m_sm; /* HF BWE - memory of fmerit_m param */ - Word16 fmerit_m_sm_fx; /* HF BWE - memory of fmerit_m param */ - +#endif + Word16 fmerit_m_sm_fx; /* HF BWE - memory of fmerit_m param */ + +#ifndef IVAS_FLOAT_FIXED float voice_fac_amr_wb_hf_float; /* HF BWE - voice factor */ - Word16 voice_fac_amr_wb_hf; /* HF BWE - voice factor */ - +#endif + Word16 voice_fac_amr_wb_hf; /* HF BWE - voice factor */ + +#ifndef IVAS_FLOAT_FIXED float unvoicing; /* HF BWE - unvoiced parameter */ - Word16 unvoicing_fx; /* HF BWE - unvoiced parameter */ - +#endif + Word16 unvoicing_fx; /* HF BWE - unvoiced parameter */ + +#ifndef IVAS_FLOAT_FIXED float unvoicing_sm; /* HF BWE - smoothed unvoiced parameter */ - Word16 unvoicing_sm_fx; /* HF BWE - smoothed unvoiced parameter */ - +#endif + Word16 unvoicing_sm_fx; /* HF BWE - smoothed unvoiced parameter */ + int16_t unvoicing_flag; /* HF BWE - unvoiced flag */ Word16 unvoicing_flag_fx; /* HF BWE - unvoiced flag */ @@ -2090,30 +2110,38 @@ typedef struct amrwb_io_dec_structure int16_t start_band_old; /* HF BWE - previous start point for copying frequency band */ Word16 start_band_old_fx; /* HF BWE - previous start point for copying frequency band */ - +#ifndef IVAS_FLOAT_FIXED float OptCrit_old; /* HF BWE - previous criterion value for deciding the start point */ - Word32 OptCrit_old_fx; /* HF BWE - previous criterion value for deciding the start point */ - +#endif + Word32 OptCrit_old_fx; /* HF BWE - previous criterion value for deciding the start point */ /* Improvement of unvoiced and audio signals in AMR-WB IO mode */ int16_t UV_cnt; /* number of consecutives frames classified as UV */ Word16 UV_cnt_fx; /* number of consecutives frames classified as UV */ - +#ifndef IVAS_FLOAT_FIXED float LT_UV_cnt; /* long-term consecutives frames classified as UV */ - Word16 LT_UV_cnt_fx; /* long-term consecutives frames classified as UV */ - +#endif + Word16 LT_UV_cnt_fx; /* long-term consecutives frames classified as UV */ + +#ifndef IVAS_FLOAT_FIXED float Last_ener; /* last_energy frame */ - Word16 Last_ener_fx; /* last_energy frame */ - +#endif + Word16 Last_ener_fx; /* last_energy frame */ + +#ifndef IVAS_FLOAT_FIXED float lt_diff_etot[MAX_LT]; /* stability estimation - long-term total energy variation */ - Word16 lt_diff_etot_fx[MAX_LT]; /* stability estimation - long-term total energy variation */ - +#endif + Word16 lt_diff_etot_fx[MAX_LT]; /* stability estimation - long-term total energy variation */ + +#ifndef IVAS_FLOAT_FIXED float old_Aq[NB_SUBFR * ( M + 1 )]; /* old LPC filter coefficient */ - Word16 old_Aq_fx[68]; /* old LPC filter coefficient */ - - float lt_voice_fac; /* average voice factor over 4 sub-frames */ - Word16 lt_voice_fac_fx; /* average voice factor over 4 sub-frames */ +#endif + Word16 old_Aq_fx[68]; /* old LPC filter coefficient */ +#ifndef IVAS_FLOAT_FIXED + float lt_voice_fac; /* average voice factor over 4 sub-frames */ +#endif + Word16 lt_voice_fac_fx; /* average voice factor over 4 sub-frames */ } AMRWB_IO_DEC_DATA, *AMRWB_IO_DEC_HANDLE; @@ -2819,8 +2847,9 @@ typedef struct Decoder_State #ifndef IVAS_FLOAT_FIXED float *acelp_zir; #endif // !IVAS_FLOAT_FIXED - +#ifndef IVAS_FLOAT_FIXED float syn_float[M + 1]; +#endif Word16 syn[M + 1]; int16_t bpf_gain_param; /* bass post-filter gain factor parameter (0->noBpf)*/ diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 01e97442f..adc92af83 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -413,7 +413,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( tmp = BASOP_Util_Divide3232_Scale(L_deposit_h(tmp), L_deposit_h(hReverb->numBins), &exp); exp = add( exp, sub( tmp_exp, 15) ); L_tmp = Mpy_32_16_1(output_Fs, tmp); - binCenterFreq_exp = sub(31, exp); + binCenterFreq_exp = add(31, exp); binCenterFreq_fx = L_shr(L_tmp, 1); // divide by 2 IF ( EQ_16( bin, 0 ) ) { @@ -498,7 +498,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( scale = norm_l(hReverb->loopBufLength[bin]); tmp_mul = L_shl(hReverb->loopBufLength[bin], scale); L_tmp = BASOP_Util_Log2( attenuationFactorPerSample_fx ); - L_tmp = L_add(L_tmp, L_shl( attenuationFactorPerSample_exp, 25)); + L_tmp = L_add(L_tmp, L_shl( (Word32)attenuationFactorPerSample_exp, 25)); L_tmp = Mpy_32_32(L_tmp, tmp_mul); hReverb->loopAttenuationFactor_fx[bin] = BASOP_util_Pow2(L_tmp, 6 + 31 - scale, &exp); hReverb->loopAttenuationFactor_fx[bin] = L_shl(hReverb->loopAttenuationFactor_fx[bin], exp); // making as Q31 diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 4c5c7da2e..c2d84fab9 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -3359,8 +3359,8 @@ void SHrotmatgen_fx( d = ( m == 0 ) ? 1 : 0; absm = (Word16) abs( m ); - sql2mm2 = square_root30_q12[imult1616(shl(l, 1), sub(shl(l, 1), 1))]; - sqdabsm = square_root30_q12[imult1616((1 + d), imult1616(sub(add( l, absm), 1), add(l, absm)))]; + sql2mm2 = square_root30_q12[sub( imult1616(l, l), imult1616(m, m))]; + sqdabsm = square_root30_q12[imult1616(add(1, d), imult1616(sub(add( l, absm), 1), add(l, absm)))]; sqlabsm = square_root30_q12[imult1616( sub( l, sub( absm, 1 ) ), sub( l, absm ) )]; FOR ( n = -l; n <= l; n++ ) @@ -3417,7 +3417,7 @@ void SHrotmatgen_fx( } } - band_idx = add( shl( l, 1 ), 1 ); + band_idx = add( band_idx, add( shl( l, 1 ), 1 ) ); } return; -- GitLab From b90b8a81fa7e76f57d8579e4d1a6af4a70db6207 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 21 May 2024 18:56:25 -0400 Subject: [PATCH 062/101] Fix proposal for 747 to solve energy burst within TDBWE --- lib_com/options.h | 1 + lib_dec/core_switching_dec_fx.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 0c348e36b..8a960be74 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -134,6 +134,7 @@ #define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ #define FIX_736_BWE_SECT_C // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE #define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP +#define FIX_747_TDBWE_ENERGY_BURST /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 2cf9bcc3a..55dfe2f50 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2012,9 +2012,18 @@ ivas_error core_switching_post_dec_ivas_fx( test(); test(); test(); + +#ifdef FIX_747_TDBWE_ENERGY_BURST + IF( ( ( EQ_16( st_fx->extl, SWB_TBE ) || EQ_16( st_fx->extl, FB_TBE ) || EQ_16( st_fx->extl, SWB_CNG ) ) && + ( NE_16( st_fx->L_frame, st_fx->last_L_frame ) || ( NE_16( st_fx->last_extl, SWB_TBE ) && NE_16( st_fx->last_extl, FB_TBE ) && NE_16( st_fx->last_core, TCX_20_CORE ) && NE_16( st_fx->last_core, TCX_10_CORE ) ) || EQ_16( st_fx->last_core, HQ_CORE ) ) ) || + ( LT_16( st_fx->bwidth, st_fx->last_bwidth ) && NE_16( st_fx->last_extl, SWB_TBE ) ) || st_fx->old_ppp_mode || ( ( EQ_16( st_fx->prev_coder_type, AUDIO ) || EQ_16( st_fx->prev_coder_type, INACTIVE ) ) && st_fx->bws_cnt > 0 ) + || ( st_fx->bws_cnt == 0 && EQ_16( st_fx->prev_bws_cnt, N_WS2N_FRAMES ) ) ) +#else IF( ( ( EQ_16( st_fx->extl, SWB_TBE ) || EQ_16( st_fx->extl, FB_TBE ) || EQ_16( st_fx->extl, SWB_CNG ) ) && ( NE_16( st_fx->L_frame, st_fx->last_L_frame ) || ( NE_16( st_fx->last_extl, SWB_TBE ) && NE_16( st_fx->last_extl, FB_TBE ) ) || EQ_16( st_fx->last_core, HQ_CORE ) ) ) || ( LT_16( st_fx->bwidth, st_fx->last_bwidth ) && NE_16( st_fx->last_extl, SWB_TBE ) ) || st_fx->old_ppp_mode || ( ( EQ_16( st_fx->prev_coder_type, AUDIO ) || EQ_16( st_fx->prev_coder_type, INACTIVE ) ) && st_fx->bws_cnt > 0 ) || ( st_fx->bws_cnt == 0 && EQ_16( st_fx->prev_bws_cnt, N_WS2N_FRAMES ) ) ) + +#endif { swb_tbe_reset_fx( hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx, hBWE_TD->syn_overlap_fx, hBWE_TD->state_syn_shbexc_fx, &( hBWE_TD->tbe_demph_fx ), &( hBWE_TD->tbe_premph_fx ), hBWE_TD->mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ) ); -- GitLab From b055ae4e54ddf745ffa94f677b0fc09910771985 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 22 May 2024 09:20:04 +0530 Subject: [PATCH 063/101] Fix for EVS bit-inexactness issue and Float code bitexactness --- lib_dec/core_switching_dec_fx.c | 4 ++-- lib_dec/hq_core_dec.c | 10 +++++----- lib_dec/hq_core_dec_fx.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index b8b82dea7..bed7107f6 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -962,8 +962,8 @@ ivas_error core_switching_pre_dec_fx( #endif { set16_fx(hHQ_core->old_out_fx, 0, output_frame); - hHQ_core->Q_old_wtda_LB = 0; - hHQ_core->Q_old_wtda = 0; + hHQ_core->Q_old_wtda_LB = 15; + hHQ_core->Q_old_wtda = 15; #ifdef IVAS_CODE_SWITCHING set_f(st->hHQ_core->old_outLB, 0, L_FRAME16k); #endif diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 2de4bd34a..a1f61cf3c 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -343,13 +343,13 @@ void hq_core_dec( index = tcx_cfg->tcx_last_overlap_mode; /* LB synthesis */ - IMDCT( t_audio_q, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, + IMDCT( t_audio_q, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc_flt, tcx_cfg->tcx_aldo_window_2_flt, tcx_cfg->tcx_mdct_window_half_flt, tcx_cfg->tcx_mdct_window_minimum_flt, tcx_cfg->tcx_mdct_window_trans_flt, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, MDCT_IV, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_outLB, 0, st, 0, acelp_zir ); mvr2r( wtda_audio + ( overlap >> 1 ) - tcx_offset, output, L_frame_glob ); /* FB synthesis */ - IMDCT( t_audio_q, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, + IMDCT( t_audio_q, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc_flt, tcx_cfg->tcx_aldo_window_2_FB_flt, tcx_cfg->tcx_mdct_window_halfFB_flt, tcx_cfg->tcx_mdct_window_minimumFB_flt, tcx_cfg->tcx_mdct_window_transFB_flt, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, MDCT_IV, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); mvr2r( wtda_audio + ( overlapFB >> 1 ) - tcx_offsetFB, synth, L_frameTCX_glob ); @@ -442,7 +442,7 @@ void hq_core_dec( if ( !st->bfi && st->prev_bfi && st->last_total_brate >= HQ_48k && st->last_codec_mode == MODE2 && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hPlcInfo->concealment_method == TCX_NONTONAL && st->hPlcInfo->nbLostCmpt < 4 ) { - waveform_adj2( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut, synth, 0, st->hPlcInfo->nbLostCmpt + 1, st->bfi ); + waveform_adj2( st->hPlcInfo, st->hTonalMDCTConc->secondLastPcmOut_float, synth, 0, st->hPlcInfo->nbLostCmpt + 1, st->bfi ); } if ( output_frame >= L_FRAME16k ) @@ -482,8 +482,8 @@ void hq_core_dec( } mvr2r( &st->old_pitch_buf[st->L_frame / L_SUBFR], st->old_pitch_buf, st->L_frame / L_SUBFR ); set_f( &st->old_pitch_buf[st->L_frame / L_SUBFR], (float) L_SUBFR, st->L_frame / L_SUBFR ); - mvr2r( &st->mem_pitch_gain[2], &st->mem_pitch_gain[st->L_frame / L_SUBFR + 2], st->L_frame / L_SUBFR ); - set_zero( &st->mem_pitch_gain[2], st->L_frame / L_SUBFR ); + mvr2r( &st->mem_pitch_gain_float[2], &st->mem_pitch_gain_float[st->L_frame / L_SUBFR + 2], st->L_frame / L_SUBFR ); + set_zero( &st->mem_pitch_gain_float[2], st->L_frame / L_SUBFR ); /* Move LB excitation to old_exc memory in case of switch HQ->ACELP */ if ( st->element_mode > EVS_MONO ) diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 2573f9955..bc433d630 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -1217,7 +1217,7 @@ void HQ_core_dec_init_fx( set16_fx(hHQ_core->old_out_LB_fx, 0, L_FRAME32k); set32_fx(hHQ_core->oldOut_fx, 0, L_FRAME48k); set32_fx(hHQ_core->old_outLB_fx, 0, L_FRAME32k); - hHQ_core->Q_old_wtda = 0; + hHQ_core->Q_old_wtda = 15; hHQ_core->Q_old_postdec = 0; hHQ_core->Q_old_wtda_LB = 0; hHQ_core->Q_old_out = 0; -- GitLab From 36cad2a87d0b39881b3deea8658ed92289b9c75c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 22 May 2024 15:24:10 +0200 Subject: [PATCH 064/101] add job for gitlab pages setup --- .gitlab-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1fa026c4f..bc5f3c532 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -599,3 +599,18 @@ be-2-evs-26444: reports: junit: - report-junit.xml + +# job that sets up gitlab pages website +pages: + stage: deploy + tags: + - ivas-linux + rules: + - if: $UPDATE_PAGES + script: + - mkdir public + - echo "Hello BASOP world!" >> public/index.html + artifacts: + paths: + - public + expire_in: 1 day -- GitLab From f98867c34c0b8edcb9b34be9547f6869bb2d98a2 Mon Sep 17 00:00:00 2001 From: kiene Date: Wed, 22 May 2024 13:26:59 +0000 Subject: [PATCH 065/101] add missing stage in CI config --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc5f3c532..a8381ea10 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,6 +74,7 @@ workflow: stages: + - deploy - build - test -- GitLab From f220b457dfb9b14435c2332318714c1b24e3b076 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 22 May 2024 15:29:44 +0200 Subject: [PATCH 066/101] correct tag --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a8381ea10..af98e9964 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -605,7 +605,7 @@ be-2-evs-26444: pages: stage: deploy tags: - - ivas-linux + - ivas-basop-linux rules: - if: $UPDATE_PAGES script: -- GitLab From acb31f6c6ebc6935b569b1eda361a15eda52879f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 22 May 2024 15:32:36 +0200 Subject: [PATCH 067/101] do not run build pipeline for pages update --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af98e9964..1cfcb97db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -300,7 +300,7 @@ stages: # ensure that codec builds on linux build-codec-linux-make: rules: - - if: $CI_PIPELINE_SOURCE == 'web' + - if: $CI_PIPELINE_SOURCE == 'web' && "UPDATE_PAGES" == "" - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'schedule' @@ -316,7 +316,7 @@ build-codec-linux-make: # ensure that codec builds on linux with instrumentation active build-codec-linux-instrumented-make: rules: - - if: $CI_PIPELINE_SOURCE == 'web' + - if: $CI_PIPELINE_SOURCE == 'web' && "UPDATE_PAGES" == "" - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'schedule' -- GitLab From a394da0df6e92d87b45c8ef5d51aa4a126442e90 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 22 May 2024 15:43:28 +0200 Subject: [PATCH 068/101] try pages job with getting the last ltv run id --- .gitlab-ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1cfcb97db..2762e62b2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -576,7 +576,7 @@ be-2-evs-26444: timeout: "120 minutes" # To be revisited script: - *print-common-info - - *update-scripts-repo + - *update-scripts-repo - sed -i".bak" "s/\(#define EVS_FLOAT\)/\/\/\1/" lib_com/options.h - make -j @@ -603,14 +603,20 @@ be-2-evs-26444: # job that sets up gitlab pages website pages: + variables: + # TODO: only for testing, remove! + BASOP_CI_BRANCH_PC_REPO: "basop-ci/add-project-id-as-argument-for-get_id_of_last_job_occurence" stage: deploy tags: - ivas-basop-linux rules: - if: $UPDATE_PAGES script: + - *print-common-info + - *update-scripts-repo + - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME ivas-pytest-mld-long-dec $CI_PROJECT_ID) - mkdir public - - echo "Hello BASOP world!" >> public/index.html + - echo "Hello BASOP world!\n\nLast long selftest run had id $job_id" >> public/index.html artifacts: paths: - public -- GitLab From ee181e0f0d070e3132f23477e58081b7b041f87a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 22 May 2024 15:47:10 +0200 Subject: [PATCH 069/101] use correct variable --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2762e62b2..5cd4273c3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -614,7 +614,7 @@ pages: script: - *print-common-info - *update-scripts-repo - - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME ivas-pytest-mld-long-dec $CI_PROJECT_ID) + - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH ivas-pytest-mld-long-dec $CI_PROJECT_ID) - mkdir public - echo "Hello BASOP world!\n\nLast long selftest run had id $job_id" >> public/index.html artifacts: -- GitLab From 0c045f8df27114905c624fd8b51313fd7e2fa091 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 23 May 2024 11:09:57 +0200 Subject: [PATCH 070/101] run setup_pages.py script --- .gitlab-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5cd4273c3..01ea43106 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -614,9 +614,7 @@ pages: script: - *print-common-info - *update-scripts-repo - - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH ivas-pytest-mld-long-dec $CI_PROJECT_ID) - - mkdir public - - echo "Hello BASOP world!\n\nLast long selftest run had id $job_id" >> public/index.html + - python3 ci/setup_pages.py artifacts: paths: - public -- GitLab From be30e10fdc062b6be7ab20e4cdf1d5fcbb430c45 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 24 May 2024 10:50:38 +0530 Subject: [PATCH 071/101] Cleanup in initializations, lib_rend, JBM files [x] Float dependencies clean up in lib_rend modules [x] Float dependencies clean up in jbm_dec [x] Cleanup of decoder initializations [x] Macro additions for float code and fixed code --- apps/renderer.c | 13 +- lib_com/float_to_fix_ops.c | 4 +- lib_com/ivas_prot.h | 20 +- lib_com/ivas_prot_fx.h | 4 +- lib_com/ivas_tools.c | 26 + lib_com/prot.h | 36 +- lib_com/rom_com.c | 28 +- lib_com/swb_tbe_com_fx.c | 29 +- lib_dec/core_dec_init.c | 793 ---------- lib_dec/core_dec_init_fx.c | 35 +- lib_dec/core_switching_dec.c | 58 +- lib_dec/dec_tcx.c | 4 +- lib_dec/fd_cng_dec.c | 60 +- lib_dec/hdecnrm.c | 13 +- lib_dec/hq_classifier_dec.c | 2 + lib_dec/hq_classifier_dec_fx.c | 3 +- lib_dec/hq_conf_fec.c | 2 + lib_dec/hq_conf_fec_fx.c | 2 + lib_dec/hq_core_dec_fx.c | 6 +- lib_dec/hq_env_dec.c | 4 + lib_dec/hq_env_dec_fx.c | 4 + lib_dec/hq_hr_dec_fx.c | 4 +- lib_dec/hq_lr_dec_fx.c | 3 +- lib_dec/igf_dec.c | 57 +- lib_dec/igf_dec_fx.c | 23 +- lib_dec/igf_scf_dec.c | 2 + lib_dec/igf_scf_dec_fx.c | 3 +- lib_dec/init_dec.c | 11 +- lib_dec/init_dec_fx.c | 4 - lib_dec/ivas_core_dec.c | 124 -- lib_dec/ivas_cpe_dec_fx.c | 77 +- lib_dec/ivas_dirac_dec.c | 1546 +++++++++----------- lib_dec/ivas_init_dec.c | 5 +- lib_dec/ivas_ism_renderer.c | 2 +- lib_dec/ivas_jbm_dec.c | 1268 ++-------------- lib_dec/ivas_ls_custom_dec.c | 4 +- lib_dec/ivas_mc_param_dec.c | 2 +- lib_dec/ivas_mct_dec.c | 2 + lib_dec/ivas_mdct_core_dec.c | 4 +- lib_dec/ivas_out_setup_conversion.c | 2 +- lib_dec/ivas_sce_dec_fx.c | 17 +- lib_dec/ivas_spar_decoder.c | 86 +- lib_dec/ivas_stereo_dft_dec_fx.c | 6 +- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 2 +- lib_dec/ivas_stereo_switching_dec.c | 9 +- lib_dec/lib_dec_fx.c | 363 ++++- lib_dec/peak_vq_dec.c | 18 + lib_dec/stat_dec.h | 14 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 7 +- lib_rend/ivas_dirac_rend.c | 7 +- lib_rend/ivas_objectRenderer.c | 6 +- lib_rend/ivas_output_init.c | 28 - lib_rend/ivas_rotation.c | 18 +- lib_rend/ivas_stat_rend.h | 7 +- lib_rend/lib_rend.c | 545 ++++++- lib_util/ism_file_reader.c | 7 + 56 files changed, 1990 insertions(+), 3439 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 5667a3042..82eb11067 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -48,7 +48,6 @@ #include "vector3_pair_file_reader.h" #include "wmc_auto.h" - #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* @@ -2538,6 +2537,10 @@ void getMetadataFromFileReader( fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) ); exit( -1 ); } +#ifdef IVAS_FLOAT_FIXED + objectMetadataBuffer->positions[objIdx].azimuth_fx = (Word32)(ismMetadata.azimuth * (1<<22)); + objectMetadataBuffer->positions[objIdx].elevation_fx = (Word32)(ismMetadata.elevation * (1 << 22)); +#endif // DEBUG objectMetadataBuffer->positions[objIdx].azimuth = ismMetadata.azimuth; objectMetadataBuffer->positions[objIdx].elevation = ismMetadata.elevation; @@ -2617,6 +2620,10 @@ static void IsmPositionProvider_getNextFrame( /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */ objectMetadataBuffer->positions[objIdx].elevation = min( max( objectMetadataBuffer->positions[objIdx].elevation, -90 ), 90 ); +#ifdef IVAS_FLOAT_FIXED + objectMetadataBuffer->positions[objIdx].azimuth_fx = (Word32)(objectMetadataBuffer->positions[objIdx].azimuth * (1 << 22)); + objectMetadataBuffer->positions[objIdx].elevation_fx = (Word32)(objectMetadataBuffer->positions[objIdx].elevation * (1 << 22)); +#endif // IVAS_FLOAT_FIXED /* Wrap yaw to lie within (-180, 180] range */ while ( objectMetadataBuffer->positions[objIdx].yaw < 0.0f ) { @@ -2935,6 +2942,10 @@ static void parseObjectPosition( position->azimuth = meta_prm[0]; position->elevation = meta_prm[1]; +#ifdef IVAS_FLOAT_FIXED + position->azimuth_fx = (Word32)(meta_prm[0] * (1 << 22)); + position->elevation_fx = (Word32)(meta_prm[1] * (1 << 22)); +#endif // IVAS_FLOAT_FIXED position->radius = meta_prm[2]; position->yaw = meta_prm[5]; position->pitch = meta_prm[6]; diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 62c15f1f1..41d1d6b2f 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -368,8 +368,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( } IF( st->hHQ_core ) { - st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k ); - st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k ); + //st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k ); + //st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k ); st->hHQ_core->Q_fer_samples = 0; //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 290ef3f88..aa02ae30c 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -280,6 +280,15 @@ void ivas_syn_output_f( float *synth_out /* o : integer 16 bits synthesis signal */ ); +#ifdef IVAS_FLOAT_FIXED +void ivas_syn_output_f_fx( + Word32 *synth[], /* i/o: float synthesis signal */ + const Word16 output_frame, /* i : output frame length (one channel) */ + const Word16 n_channels, /* i : number of output channels */ + Word32 *synth_out /* o : integer 16 bits synthesis signal */ +); +#endif + void ivas_initialize_handles_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -881,12 +890,14 @@ void TonalMdctConceal_whiten_noise_shape_ivas( const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE ); +#ifndef IVAS_FLOAT_FIXED /*! r: IGF start line */ int16_t get_igf_startline_flt( Decoder_State *st, /* i : decoder state */ const int16_t L_frame, /* i : length of the frame */ const int16_t L_frameTCX /* i : full band frame length */ ); +#endif float rand_triangular_signed( int16_t *seed ); @@ -918,10 +929,17 @@ void ivas_apply_non_diegetic_panning( * JBM prototypes *----------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_jbm_dec_tc_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *data_fx +); +#else ivas_error ivas_jbm_dec_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *data /* o : output synthesis signals */ + float *data /* o : output synthesis signals */ ); +#endif ivas_error ivas_jbm_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index c1c36e15b..177156f76 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2111,8 +2111,8 @@ void ivas_dirac_dec_render_sf_fx( Word32 *output_fx[], /* i/o: synthesized core-coder transport channels/DirAC output */ #endif // MSAN_FIX const int16_t nchan_transport, /* i : number of transport channels */ - float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] + Word32 *pppQMfFrame_ts_re_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], + Word32 *pppQMfFrame_ts_im_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ); void ivas_dirac_dec_render_fx( diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index 49b1fea1d..c8a0475b5 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -215,6 +215,32 @@ void ivas_syn_output_f( return; } +#ifdef IVAS_FLOAT_FIXED +void ivas_syn_output_f_fx( + Word32 *synth[], /* i/o: float synthesis signal */ + const Word16 output_frame, /* i : output frame length (one channel) */ + const Word16 n_channels, /* i : number of output channels */ + Word32 *synth_out /* o : integer 16 bits synthesis signal */ +) +{ + Word16 i, n; + + /*-----------------------------------------------------------------* + * float to integer conversion with saturation control + *-----------------------------------------------------------------*/ + + FOR ( n = 0; n < n_channels; n++ ) + { + FOR ( i = 0; i < output_frame; i++ ) + { + synth_out[i * n_channels + n] = synth[n][i]; + } + } + + return; +} + +#endif /*-------------------------------------------------------------------* * mvr2r_inc() diff --git a/lib_com/prot.h b/lib_com/prot.h index f47b3d917..18a0d52b9 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -1756,6 +1756,7 @@ void diff_envelope_coding( int16_t *difidx /* o : differential code */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: Number of bits */ int16_t decode_envelope_indices( Decoder_State *st, /* i/o: decoder state structure */ @@ -1766,7 +1767,9 @@ int16_t decode_envelope_indices( const int16_t flag_HQ2, /* i : indicator of HQ2 core */ const int16_t is_transient /* i : transient flag */ ); +#endif +#ifndef IVAS_FLOAT_FIXED /*! r: Number of bits */ void dequantize_norms( Decoder_State *st, /* i/o: decoder state structure */ @@ -1776,6 +1779,7 @@ void dequantize_norms( int16_t *ynrm, /* o : Decoded norm indices */ int16_t *normqlg2 /* o : Log2 of decoded norms */ ); +#endif void hq_configure( const int16_t length, /* i : Frame length */ @@ -1822,6 +1826,7 @@ int16_t hq_classifier_enc( int16_t *hqswb_clas /* o : HQ class */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: Consumed bits */ int16_t hq_classifier_dec( Decoder_State *st, /* i/o: decoder state structure */ @@ -1830,6 +1835,7 @@ int16_t hq_classifier_dec( int16_t *is_transient, /* o : Transient flag */ int16_t *hqswb_clas /* o : HQ class */ ); +#endif void hq_bit_allocation( const int32_t core_brate, /* i : Core bitrate */ @@ -5440,6 +5446,7 @@ void logqnorm( const int16_t N, /* i : sub-vector size */ const float *thren ); +#ifndef IVAS_FLOAT_FIXED void huff_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : Number of codewords to decode */ @@ -5450,6 +5457,7 @@ void huff_dec( const int16_t *huff_tab, /* i : Huffman table order by codeword lengths */ int16_t *index /* o : Decoded index */ ); +#endif void calc_norm( const float *x, /* i : Input vector. */ @@ -5590,30 +5598,38 @@ void hq_hr_dec( ); +#ifndef IVAS_FLOAT_FIXED void hdecnrm_context( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of norms */ int16_t *index, /* o : indices of quantized norms */ int16_t *n_length /* o : decoded stream length */ ); +#endif +#ifndef IVAS_FLOAT_FIXED void hdecnrm_tran( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of norms */ int16_t *index /* o : indices of quantized norms */ ); +#endif +#ifndef IVAS_FLOAT_FIXED void hdecnrm_resize( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of SFMs */ int16_t *index /* o : norm quantization index vector */ ); +#endif +#ifndef IVAS_FLOAT_FIXED void hdecnrm( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of norms */ int16_t *index /* o : indices of quantized norms */ ); +#endif /*! r: index of last band */ int16_t find_last_band( @@ -8881,13 +8897,13 @@ void generate_masking_noise_ivas_fx( Word32 *timeDomainBuffer, /* i/o: time-domain signal */ Word16 *exp_out, /* o : time-domain signal exp */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t length, /* i : frame size */ - const int16_t core, /* i : core */ - const int16_t return_noise, /* i : noise is returned instead of added */ - const int16_t secondary, /* i : flag to indicate secondary noise generation */ - const int16_t element_mode, /* i : element mode */ + const Word16 length, /* i : frame size */ + const Word16 core, /* i : core */ + const Word16 return_noise, /* i : noise is returned instead of added */ + const Word16 secondary, /* i : flag to indicate secondary noise generation */ + const Word16 element_mode, /* i : element mode */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ + const Word16 nchan_out /* i : number of output channels */ ); #endif @@ -10244,6 +10260,7 @@ void IGFDecReadData_flt( const int16_t isIndepFrame /* i : if 1: arith dec force reset, if 0: no reset */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: return igfAllZero flag indicating if no envelope is transmitted */ int16_t IGFDecReadLevel_flt( const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Deccoder */ @@ -10251,6 +10268,7 @@ int16_t IGFDecReadLevel_flt( const int16_t igfGridIdx, /* i : in case of CELP->TCX switching, use 1.25 framelength */ const int16_t isIndepFrame /* i : if 1: arith dec force reset, if 0: no reset */ ); +#endif void IGFDecRestoreTCX10SubFrameData_flt( const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* o : instance handle of IGF Decoder */ @@ -10354,6 +10372,7 @@ void IGFSCFEncoderRestoreContextState( const int16_t igfGridIdx /* i : igf grid index see declaration of IGF_GRID_IDX for details */ ); +#ifndef IVAS_FLOAT_FIXED void IGFSCFDecoderOpen_ivas( IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i : handle to public data */ H_IGF_INFO hIgfInfo, /* i : IGF info handle */ @@ -10361,11 +10380,15 @@ void IGFSCFDecoderOpen_ivas( const int16_t bwidth, const int16_t element_mode, const int16_t rf_mode ); +#endif +#ifndef IVAS_FLOAT_FIXED void IGFSCFDecoderReset_ivas( IGFSCFDEC_INSTANCE_HANDLE hPublicData /* i : handle to public data or NULL in case there was no instance created */ ); +#endif +#ifndef IVAS_FLOAT_FIXED void IGFSCFDecoderDecode_ivas( IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i : handle to public data or NULL in case there was no instance created */ Decoder_State *st, /* i/o: pointer to decoder state */ @@ -10374,6 +10397,7 @@ void IGFSCFDecoderDecode_ivas( const int16_t indepFlag /* i : if 1 on input the decoder will be forced to reset, if 0 on input the decoder will be forced to encode without a reset */ ); +#endif /*! r: offset value */ int16_t tbe_celp_exc_offset_flt( diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index f41b789b1..256fc16d7 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -10980,25 +10980,25 @@ const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO] = const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN] = { - { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/, -28672 }, - { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, -24576 }, - { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, - { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, -16384 }, + { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/, 20295 }, + { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, + { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, { 0, 16400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, - { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, -24576 }, - { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, - { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/, -12288 }, - { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, - { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, -4096 }, + { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, + { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 }, + { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, { 1, 24400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, - { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, - { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, -20480 }, - { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, -16384 }, - { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/, -8192 }, + { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, + { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/, 4242 }, - { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, -4096 }, + { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, { 2, 24400, 32000, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, { 2, 32000,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 } }; diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 97a0ff3d2..dea9b6a63 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -2828,7 +2828,7 @@ void GenShapedSHBExcitation_ivas_fx( } White_exc16k = exc16k; - + Word16 Q_excTmp2 = getScaleFactor16(excTmp2, L_FRAME16k) + *Q_bwe_exc; /* Track the low band envelope */ IF(element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT) { @@ -2839,13 +2839,13 @@ void GenShapedSHBExcitation_ivas_fx( FOR (k = 0; k < L_FRAME16k; k++) { //excNoisyEnvLeft[k] = mem_csfilt_left + csfilt_num2[0] * excTmp2[k]; - excNoisyEnvLeft[k] = add(mem_csfilt_left, mult_r(csfilt_num2[0], excTmp2[k])); + excNoisyEnvLeft[k] = add(mem_csfilt_left, mult_r(csfilt_num2[0], shl(excTmp2[k], sub(Q_excTmp2, *Q_bwe_exc)))); //Q_excTmp2 //mem_csfilt_left = -csfilt_den2[1] * excNoisyEnvLeft[k]; - mem_csfilt_left = mult_r(neg_csfilt_den2[1], excNoisyEnvLeft[k]); + mem_csfilt_left = mult_r(neg_csfilt_den2[1], excNoisyEnvLeft[k]); //Q_excTmp2 //excNoisyEnvRight[L_FRAME16k - k - 1] = mem_csfilt_right + csfilt_num2[0] * excTmp2[L_FRAME16k - k - 1]; - excNoisyEnvRight[L_FRAME16k - k - 1] = add(mem_csfilt_right, mult_r(csfilt_num2[0], excTmp2[L_FRAME16k - k - 1])); + excNoisyEnvRight[L_FRAME16k - k - 1] = add(mem_csfilt_right, mult_r(csfilt_num2[0], shl(excTmp2[L_FRAME16k - k - 1], sub(Q_excTmp2, *Q_bwe_exc)))); //Q_excTmp2 //mem_csfilt_right = -csfilt_den2[1] * excNoisyEnvRight[L_FRAME16k - k - 1]; - mem_csfilt_right = mult_r(neg_csfilt_den2[1], excNoisyEnvRight[L_FRAME16k - k - 1]); + mem_csfilt_right = mult_r(neg_csfilt_den2[1], excNoisyEnvRight[L_FRAME16k - k - 1]); //Q_excTmp2 } alpha = 0; @@ -2854,7 +2854,7 @@ void GenShapedSHBExcitation_ivas_fx( FOR (k = 0; k < L_FRAME16k; k++) { //excNoisyEnv[k] = alpha * excNoisyEnvLeft[k] + (1 - alpha) * excNoisyEnvRight[k]; - excNoisyEnv[k] = add(mult_r(alpha, excNoisyEnvLeft[k]), mult_r((32767 - alpha), excNoisyEnvRight[k])); + excNoisyEnv[k] = add(mult_r(alpha, excNoisyEnvLeft[k]), mult_r((32767 - alpha), excNoisyEnvRight[k])); //Q_excTmp2 alpha = add(alpha, step); } } @@ -2867,11 +2867,11 @@ void GenShapedSHBExcitation_ivas_fx( move32(); FOR(i = 0; i < L_FRAME16k; i++) { - excNoisyEnv[i] = mac_r(L_tmp, csfilt_num2[0], excTmp2[i]); + excNoisyEnv[i] = mac_r(L_tmp, csfilt_num2[0], shl(excTmp2[i], sub(Q_excTmp2, *Q_bwe_exc))); move16(); - /* excNoisyEnv : Q_bwe_exc, - *mem_csfilt: Q_bwe_exc+16, excTmp2: Q_bwe_exc, csfilt_num2[0] Q15 */ - L_tmp = L_mult(excNoisyEnv[i], neg_csfilt_den2[1]); /* Q_bwe_exc+16 */ + /* excNoisyEnv : Q_excTmp2, + *mem_csfilt: Q_excTmp2+16, excTmp2: Q_excTmp2, csfilt_num2[0] Q_excTmp2 */ + L_tmp = L_mult(excNoisyEnv[i], neg_csfilt_den2[1]); /* Q_excTmp2 + 16 */ } *mem_csfilt = L_tmp; move32(); @@ -2928,7 +2928,7 @@ void GenShapedSHBExcitation_ivas_fx( #endif IF (excNoisyEnv[k] != 0) { - L_tmp4 = L_mult(excNoisyEnv[k], White_exc16k[k]);/* (Q_bwe_exc) +5 +1*/ + L_tmp4 = L_mult(shr(excNoisyEnv[k], sub(Q_excTmp2, *Q_bwe_exc)), White_exc16k[k]);/* (Q_bwe_exc) +5 +1*/ } White_exc16k_32[k] = L_tmp4; move32(); @@ -2944,8 +2944,8 @@ void GenShapedSHBExcitation_ivas_fx( /* calculate pow22 */ /* pow22=0.00001f */ - tmp = sub(shl(sub(*Q_bwe_exc, NOISE_QADJ), 1), 31); - pow22 = L_shl(21475l/*0.00001f Q31*/, tmp); /* 0.00001f in 2*(Q_bwe_exc-NOISE_QADJ) */ + tmp = sub(shl(sub(Q_excTmp2, NOISE_QADJ), 1), 31); + pow22 = L_shl(21475l/*0.00001f Q31*/, tmp); /* 0.00001f in 2*(Q_excTmp2-NOISE_QADJ) */ tmp = sub(NOISE_QFAC, 5); FOR(k = 0; k < L_FRAME16k; k++) { @@ -2963,7 +2963,8 @@ void GenShapedSHBExcitation_ivas_fx( #endif } /*Q_pow22 = sub( shl(*Q_bwe_exc,1), 18 );*/ - Q_pow22 = shl(sub(*Q_bwe_exc, NOISE_QADJ), 1); + Q_pow22 = shl(sub(Q_excTmp2, NOISE_QADJ), 1); + Scale_sig(White_exc16k, L_FRAME16k, sub(*Q_bwe_exc, Q_excTmp2)); } #if 1//def ADD_IVAS_TBE_CODE diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 3d9ae2933..04f66be5b 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -47,760 +47,7 @@ * * Initialization of state variables *-----------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void open_decoder_LPD( - Decoder_State *st, /* i/o: decoder state structure */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t last_total_brate, /* i : last total bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const int16_t last_element_mode, /* i : last element mode */ - const int16_t is_init /* i : indicate call during initialization */ -) -{ -#ifndef IVAS_FLOAT_FIXED - int16_t mem_syn_r_size_old; - int16_t mem_syn_r_size_new; -#endif -#ifndef IVAS_FLOAT_FIXED - int16_t fscaleFB; -#endif - -#ifndef IVAS_FLOAT_FIXED - int16_t encoderLookahead; - int16_t encoderLookaheadFB; -#endif - TCX_LTP_DEC_HANDLE hTcxLtpDec = st->hTcxLtpDec; - TCX_DEC_HANDLE hTcxDec = st->hTcxDec; - - if ( st->codec_mode != MODE1 ) /*already updated in MODE1*/ - { - st->fscale_old = st->fscale; - } - - st->sr_core = getCoreSamplerateMode2_flt( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); - st->fscale = sr2fscale( st->sr_core ); -#ifndef IVAS_FLOAT_FIXED - fscaleFB = sr2fscale( st->output_Fs ); -#endif - - /* initializing variables for frame lengths etc. right in the beginning */ - st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); - if ( st->ini_frame == 0 ) - { - st->last_L_frame = st->L_frame_past = st->L_frame; - } - if ( st->hTcxDec != NULL ) - { - st->hTcxDec->L_frameTCX = (int16_t) ( st->output_Fs / FRAMES_PER_SEC ); - if ( st->ini_frame == 0 ) - { - st->L_frameTCX_past = st->hTcxDec->L_frameTCX; - } - } - - st->tcxonly = getTcxonly_ivas( st->element_mode, total_brate, MCT_flag, st->is_ism_format ); - - /* the TD TCX PLC in MODE1 still runs with 80ms subframes */ - if ( ( st->element_mode == EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= ACELP_32k ) || ( st->element_mode > EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= MAX_ACELP_BRATE ) || ( st->tcxonly && ( st->sr_core == 32000 || st->sr_core == 16000 ) ) ) - { - st->nb_subfr = NB_SUBFR16k; - } - else - { - st->nb_subfr = NB_SUBFR; - } - st->bits_frame = (int16_t) ( ( (float) st->L_frame / (float) st->fscale ) * (float) FSCALE_DENOM / 128.0f * (float) total_brate / 100.0f + 0.49f ); -#ifndef IVAS_FLOAT_FIXED - st->TcxBandwidth_float = getTcxBandwidth_flt(bwidth); -#endif - st->narrowBand = (bwidth == NB) ? 1 : 0; - -#ifndef IVAS_FLOAT_FIXED - encoderLookahead = (L_LOOK_12k8 * st->fscale) / FSCALE_DENOM; - encoderLookaheadFB = (L_LOOK_12k8 * fscaleFB) / FSCALE_DENOM; -#endif - - if (st->element_mode == IVAS_CPE_MDCT) - { - st->pit_res_max = initPitchLagParameters(12800, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max); - hTcxDec->pit_max_TCX = (int16_t)(st->pit_max * st->output_Fs / 12800); - hTcxDec->pit_min_TCX = (int16_t)(st->pit_min * st->output_Fs / 12800); - } - else - { - st->pit_res_max = initPitchLagParameters(st->sr_core, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max); - if (hTcxDec != NULL) - { - hTcxDec->pit_max_TCX = (int16_t)(st->pit_max * st->output_Fs / st->sr_core); - hTcxDec->pit_min_TCX = (int16_t)(st->pit_min * st->output_Fs / st->sr_core); - } - } - - if (st->ini_frame == 0) - { - st->pit_res_max_past = st->pit_res_max; - } - -#ifndef IVAS_FLOAT_FIXED - /*Preemphasis param*/ - if (st->fscale < (16000 * FSCALE_DENOM) / 12800) - { - st->preemph_fac_float = PREEMPH_FAC_FLT; /*NB*/ - } - else if (st->fscale < (24000 * FSCALE_DENOM) / 12800) - { - st->preemph_fac_float = PREEMPH_FAC_16k_FLT; /*WB*/ - } - else - { - st->preemph_fac_float = PREEMPH_FAC_SWB_FLT; /*SWB*/ - } - - if (st->sr_core == INT_FS_16k) - { - st->gamma_float = GAMMA16k_FLT; - } - else if (st->sr_core > INT_FS_16k && st->element_mode == IVAS_CPE_MDCT) - { - st->gamma_float = GAMMA16k_FLT; - } - else - { - st->gamma_float = GAMMA1_FLT; - } -#endif // #ifndef IVAS_FLOAT_FIXED - - /* LPC quantization */ - if (st->sr_core <= INT_FS_16k && st->tcxonly == 0) - { - st->lpcQuantization = 1; - } - else - { - st->lpcQuantization = 0; - } - - if (st->tcxonly == 0) - { - st->numlpc = 1; - } - else - { - st->numlpc = 2; - } - - /* Initialize TBE */ - st->prev_coder_type = GENERIC; -#ifndef IVAS_FLOAT_FIXED - if (st->hBWE_TD != NULL) - { - set_f(st->hBWE_TD->prev_lsf_diff, 0.5f, LPC_SHB_ORDER - 2); - st->hBWE_TD->prev_tilt_para = 0.0f; - set_zero(st->hBWE_TD->cur_sub_Aq, M + 1); - } -#endif -#ifdef IVAS_FLOAT_FIXED - if (st->hBWE_TD != NULL) - { - set16_fx(st->hBWE_TD->prev_lsf_diff_fx, 16384, LPC_SHB_ORDER - 2); - st->hBWE_TD->prev_tilt_para_fx = 0; - set16_fx(st->hBWE_TD->cur_sub_Aq_fx, 0, M + 1); - } -#endif - - if (st->hIGFDec != NULL) - { - if (!is_init || st->element_mode != IVAS_CPE_MDCT) - { -#ifndef IVAS_FLOAT_FIXED - init_tcx_cfg(st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac_float, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag); -#endif - - } - else - { - st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; - st->hTcxCfg->last_aldo = 1; - } - } - -#ifndef IVAS_FLOAT_FIXED - if (st->hTECDec != NULL) - { - resetTecDec(st->hTECDec); - } -#endif -#ifdef IVAS_FLOAT_FIXED - if ( st->hTECDec != NULL ) - { - resetTecDec_Fx( st->hTECDec ); - } -#endif - - if (st->element_mode != IVAS_SCE) - { - st->flag_cna = 0; - } - if (st->ini_frame == 0) - { - st->flag_cna = 0; - st->last_flag_cna = 0; - } - - /* Static vectors to zero */ - if (st->ini_frame == 0) - { - st->last_is_cng = 0; - - st->rate_switching_reset = 0; -#ifndef IVAS_FLOAT_FIXED - if (st->hTcxDec != NULL) - { - reset_tcx_overl_buf(st->hTcxDec); - - set_zero(st->hTcxDec->syn_OverlFB_float, L_FRAME_MAX / 2); - set_zero(st->hTcxDec->old_synth_float, OLD_SYNTH_INTERNAL_DEC); - - set_zero(st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX); - } -#endif - -#ifndef IVAS_FLOAT_FIXED - set_zero(st->syn_float, M + 1); - set_zero(st->mem_syn_r_float, L_SYN_MEM); -#endif // #ifndef IVAS_FLOAT_FIXED - -#ifndef IVAS_FLOAT_FIXED - mem_syn_r_size_old = 0; /* just to avoid MSVC warnings */ - mem_syn_r_size_new = 0; /* just to avoid MSVC warnings */ -#endif - - st->con_tcx = 0; - } - else - { - /* Reset old_synth in case of core sampling rate switching and Mode 1/2 switching*/ -#ifndef IVAS_FLOAT_FIXED - if (st->hTcxDec != NULL && ((st->L_frame != st->last_L_frame) || (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO))) - { - set_zero(st->hTcxDec->old_synth_float, OLD_SYNTH_INTERNAL_DEC); - } -#endif - /*Compute size of old and new memories*/ -#ifndef IVAS_FLOAT_FIXED - mem_syn_r_size_old = (int16_t)(1.25 * st->last_L_frame / 20.f); - mem_syn_r_size_new = (int16_t)(1.25 * st->L_frame / 20.f); -#endif - -#ifndef IVAS_FLOAT_FIXED - /*Reset LPC mem*/ - if ((st->L_frame != st->last_L_frame) || (st->last_core == AMR_WB_CORE) || (st->last_core == HQ_CORE)) - { - set_zero(st->mem_MA, M); - if (st->sr_core == INT_FS_16k) - { - mvr2r(GEWB2_Ave, st->mem_AR, M); - } - else - { - mvr2r(GEWB_Ave, st->mem_AR, M); - } - } -#endif - /*Mode 1/2 switching*/ - if (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO) - { -#ifndef IVAS_FLOAT_FIXED - mvr2r(st->lsp_old, st->lspold_uw_float, M); - mvr2r(st->lsf_old, st->lsfold_uw_float, M); - set_zero(st->syn_float, M); -#endif - } - if (st->last_core == AMR_WB_CORE) - { - st->last_core = ACELP_CORE; - st->last_core_bfi = ACELP_CORE; - } - - if (((st->element_mode != IVAS_CPE_DFT) || (st->element_mode == IVAS_CPE_DFT && st->prev_bfi)) && st->last_codec_mode == MODE1 && st->last_core == ACELP_CORE) - { - /* Switching from Mode 1 ACELP */ - st->last_core_bfi = ACELP_CORE; -#ifndef IVAS_FLOAT_FIXED - acelp_plc_mdct_transition(st); -#endif - } - - if (st->last_codec_mode == MODE2 && - st->L_frame != st->last_L_frame && - ((st->m_frame_type == SID_FRAME && st->last_core > ACELP_CORE) || - (st->last_core > ACELP_CORE && st->core > ACELP_CORE) || st->prev_bfi)) - { - lerp_flt(st->hHQ_core->old_outLB, st->hHQ_core->old_outLB, st->L_frame, st->last_L_frame); - } - - /* Rate switching */ - if (st->last_codec_mode == MODE1 && st->last_core == HQ_CORE) - { - /* Switching from MDCT */ - - /*Reset of ACELP memories*/ - st->rate_switching_reset = 1; -#ifndef IVAS_FLOAT_FIXED - st->tilt_code = TILT_CODE_FLT; - set_zero(st->old_exc, L_EXC_MEM_DEC); - set_zero(st->mem_syn2, M); - set_zero(st->syn_float, 1 + M); -#endif -#ifndef IVAS_FLOAT_FIXED - /*OLA -> zero */ - if (st->hTcxDec != NULL) - { - reset_tcx_overl_buf(st->hTcxDec); - - } -#endif - if (st->hTcxCfg != NULL) - { -#ifndef IVAS_FLOAT_FIXED - mvr2r(st->hHQ_core->old_out + NS2SA(st->output_Fs, N_ZERO_MDCT_NS), st->hTcxDec->syn_OverlFB_float, st->hTcxCfg->tcx_mdct_window_lengthFB); -#endif - st->hTcxCfg->last_aldo = 1; /*It was previously ALDO*/ - st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; - } - - /*OLA for Mode 2 TCX always reset in Mode switching cases*/ - if (st->hHQ_core != NULL) - { - set_f(st->hHQ_core->old_outLB, 0, st->L_frame); - } - - st->last_core_bfi = TCX_20_CORE; - - if (st->hPFstat != NULL) - { - st->hPFstat->on = 0; - } - - /* reset CLDFB memories */ - cldfb_reset_memory_ivas(st->cldfbAna); - cldfb_reset_memory_ivas(st->cldfbBPF); - cldfb_reset_memory_ivas(st->cldfbSyn); - if (st->cldfbSynHB != NULL) - { - cldfb_reset_memory_ivas(st->cldfbSynHB); - } - } - else if ((st->L_frame != st->last_L_frame) && (st->L_frame <= L_FRAME16k) && (st->last_L_frame <= L_FRAME16k)) /* Rate switching between 12.8 and 16 kHz*/ - { - /*Interpolation of ACELP memories*/ - - /* convert quantized LSP vector */ -#ifndef IVAS_FLOAT_FIXED - st->rate_switching_reset = lsp_convert_poly(st->lsp_old, st->L_frame, 0); - lsp2a_stab(st->lsp_old, st->old_Aq_12_8, M); - - lsp2lsf(st->lsp_old, st->lsf_old, M, st->sr_core); - mvr2r(st->lsp_old, st->lspold_uw_float, M); - mvr2r(st->lsf_old, st->lsfold_uw_float, M); - - if (!st->last_con_tcx) - { - synth_mem_updt2_flt(st->L_frame, st->last_L_frame, st->old_exc, st->mem_syn_r_float, st->mem_syn2, NULL, DEC); - } - -#endif - /*mem of deemphasis stayed unchanged.*/ - } - else if (st->L_frame != st->last_L_frame) /* Rate switching involving TCX only modes */ - { - /*Partial reset of ACELP memories*/ - st->rate_switching_reset = 1; - - /*reset partly some memories*/ -#ifndef IVAS_FLOAT_FIXED - st->tilt_code = TILT_CODE_FLT; - if (!st->last_con_tcx) - { - set_zero(st->old_exc, L_EXC_MEM_DEC); - } - set_zero(st->old_Aq_12_8, M + 1); - - /*Resamp others memories*/ - /*Size of LPC syn memory*/ - lerp_flt(st->mem_syn_r_float + L_SYN_MEM - mem_syn_r_size_old, st->mem_syn_r_float + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); - mvr2r(st->mem_syn_r_float + L_SYN_MEM - M, st->mem_syn2, M); -#endif // #ifndef IVAS_FLOAT_FIXED - } - /* update of lsf_old only needed in BASOP */ - /* else if( !st->tcxonly && (st->L_frame == L_FRAME16k) && (st->last_total_brate > ACELP_32k) ) */ - /* { */ - /* lsp2lsf( st->lsp_old, st->lsf_old, M, st->sr_core ); */ - /* } */ - } - - if (st->last_bwidth == NB && st->bwidth != NB && st->ini_frame != 0) - { - st->rate_switching_reset = 1; - } - - if (st->hTcxDec != NULL) - { - st->hTcxDec->old_synth_len = 2 * st->L_frame; - st->hTcxDec->old_synth_lenFB = 2 * st->hTcxDec->L_frameTCX; - } - - /* bass pf reset */ - st->bpf_gain_param = 0; -#ifndef IVAS_FLOAT_FIXED - if (st->hBPF != NULL) - { - set_f(st->hBPF->pst_old_syn, 0, NBPSF_PIT_MAX); - } -#endif - /* Formant postfilter */ - if (st->ini_frame == 0) - { - /* do nothing */ - } -#ifndef IVAS_FLOAT_FIXED - else if (st->last_codec_mode == MODE2) - { - if (!st->tcxonly) - { - if (st->hPFstat->on) - { - lerp_flt(st->hPFstat->mem_stp_flt + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp_flt + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); - lerp_flt(st->hPFstat->mem_pf_in_flt + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in_flt + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); - } - else - { - set_zero(st->hPFstat->mem_stp_flt, L_SYN_MEM); - set_zero(st->hPFstat->mem_pf_in_flt, L_SYN_MEM); - st->hPFstat->reset = 1; - st->hPFstat->gain_prec_flt = 1.f; - } - } - else if (st->hPFstat->on) - { - lerp_flt(st->hPFstat->mem_stp_flt + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp_flt + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); - lerp_flt(st->hPFstat->mem_pf_in_flt + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in_flt + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); - } - } - else - { - /*codec mode switching*/ - - /*reset post-filter except for Narrowband*/ - if (((int16_t)(st->output_Fs / FRAMES_PER_SEC)) != L_FRAME8k) - { - if (st->hPFstat != NULL) - { - st->hPFstat->reset = 1; - if (st->hPFstat->on != 0) - { - st->hPFstat->reset = 0; - lerp_flt(st->hPFstat->mem_stp_flt + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_stp_flt + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); - lerp_flt(st->hPFstat->mem_pf_in_flt + L_SYN_MEM - mem_syn_r_size_old, st->hPFstat->mem_pf_in_flt + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); - } - } - } - else - { - /*feed last value old_synth as it is used for pre-emphasis mem*/ - if (st->hTcxDec != NULL) - { - st->hTcxDec->old_synth_float[st->hTcxDec->old_synth_len - 1] = st->syn_float[M]; - } -#ifndef IVAS_FLOAT_FIXED - if (st->hBPF != NULL) - { - st->hBPF->pst_old_syn[NBPSF_PIT_MAX - 1] = st->syn_float[M]; - } -#endif - } - } -#endif - /* lsf and lsp initialization */ -#ifndef IVAS_FLOAT_FIXED - if (st->ini_frame == 0) - { - mvr2r(st->lsp_old, st->lspold_uw_float, M); - mvr2r(st->lsf_old, st->lsfold_uw_float, M); - - set_zero(st->lsf_cng_float, M); - } - st->gc_threshold = 0.0f; -#endif - - st->seed_tcx_plc = RANDOM_INITSEED; - st->plcBackgroundNoiseUpdated = 0; -#ifndef IVAS_FLOAT_FIXED - st->past_gpit_float = 0.0f; - st->past_gcode_float = 0.0f; - - lsf2lsp(st->lsf_cng_float, st->lspold_cng_float, M, INT_FS_12k8); - lsp2a_stab(st->lspold_cng_float, st->Aq_cng_float, M); - mvr2r(st->lsf_old, st->lsf_q_cng_float, M); - mvr2r(st->lsf_old, st->old_lsf_q_cng_float, M); - mvr2r(st->lsp_old, st->lsp_q_cng_float, M); - mvr2r(st->lsp_old, st->old_lsp_q_cng_float, M); - set_zero(st->mem_syn_unv_back_float, M); - st->last_gain_syn_deemph_float = 1.f; -#endif // #ifndef IVAS_FLOAT_FIXED - - if (st->last_codec_mode == MODE1 || st->ini_frame == 0) - { - /* this assumes that MODE1 fades out in the frequency domain - - otherwise some data from MODE1 would be needed here */ -#ifndef IVAS_FLOAT_FIXED - st->last_concealed_gain_syn_deemph_float = 1.f; - if (hTcxDec != NULL) - { - hTcxDec->conceal_eof_gain_float = 1.0f; - } -#endif // #ifndef IVAS_FLOAT_FIXED - } - /* Post processing */ -#ifndef IVAS_FLOAT_FIXED - set_zero(st->mem_Aq_float, NB_SUBFR16k * (M + 1)); - - st->lp_ener_bfi = 60.0f; -#endif - if (st->ini_frame == 0) - { - st->prev_bfi = 0; - st->last_core_bfi = -1; - if (st->hTcxDec != NULL) - { - hTcxDec->tcxConceal_recalc_exc = 0; - } - } - st->prev_old_bfi = 0; - - if (st->hTcxDec != NULL) - { - st->hTcxDec->noise_filling_index[0] = st->hTcxDec->noise_filling_index[1] = 0; - st->hTcxDec->tnsActive[0] = st->hTcxDec->tnsActive[1] = 0; -#ifndef IVAS_FLOAT_FIXED - set_f(st->hTcxDec->ltpGainMemory, 0.0f, N_LTP_GAIN_MEMS); -#endif - } - -#ifndef IVAS_FLOAT_FIXED - mvr2r(st->lsf_old, st->lsf_adaptive_mean, M); - mvr2r(st->lsf_old, st->lsfoldbfi0, M); - mvr2r(st->lsf_old, st->lsfoldbfi1, M); - - if (!st->last_con_tcx) - { - st->old_enr_LP_float = 0.0f; /* LP filter E of last good voiced frame or local LP filter E in TD TCX PLC */ - } -#endif - - st->clas_dec = UNVOICED_CLAS; - - if (st->prev_bfi) - { -#ifndef IVAS_FLOAT_FIXED - /* calculate energy at the end of the previous frame */ - if (st->core == ACELP_CORE && st->last_core == HQ_CORE) - { - fer_energy(st->hTcxDec->L_frameTCX, UNVOICED_CLAS, st->previoussynth, -1, &st->enr_old, 1); - } -#endif // #ifndef IVAS_FLOAT_FIXED - } - else - { - st->last_good = UNVOICED_CLAS; /* last good received frame for concealment */ -#ifndef IVAS_FLOAT_FIXED - st->enr_old = 0.0f; /* energy at the end of the previous frame */ -#endif // #ifndef IVAS_FLOAT_FIXED - } -#ifndef IVAS_FLOAT_FIXED - st->lp_gainc = 0.0f; - st->lp_gainp = 0.0f; -#endif // #ifndef IVAS_FLOAT_FIXED - - if (st->hTcxDec != NULL) - { - st->hTcxDec->prev_widow_left_rect = 0; - - if (is_init || MCT_flag || !(st->element_mode == IVAS_CPE_MDCT && st->element_mode == last_element_mode)) - { - st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1; - st->hTcxDec->CurrLevelIndex_bfi = 0; -#ifndef IVAS_FLOAT_FIXED - st->hTcxDec->CngLevelBackgroundTrace_bfi = PLC_MIN_CNG_LEV_FLT; - st->hTcxDec->LastFrameLevel_bfi = PLC_MIN_CNG_LEV_FLT; - set_f(st->hTcxDec->NoiseLevelMemory_bfi, PLC_MIN_CNG_LEV_FLT, PLC_MIN_STAT_BUFF_SIZE); - - st->hTcxDec->cummulative_damping_tcx_float = 1.0f; -#endif - } - } - - - -#ifndef IVAS_FLOAT_FIXED - for (i = 0; i < 2 * NB_SUBFR16k + 2; i++) - { - st->old_pitch_buf[i] = (float)st->pit_min; - } - st->cummulative_damping_float = 1.0f; - for (i = 0; i < 2 * NB_SUBFR16k + 2; i++) - { - st->mem_pitch_gain_float[i] = 1.f; - } - st->old_fpitch_float = (float)st->pit_min; -#endif // #ifndef IVAS_FLOAT_FIXED - - - st->rate_switching_init = 1; - - st->reset_mem_AR = 0; - -#ifndef IVAS_FLOAT_FIXED - /* For phase dispersion */ - set_zero(st->dispMem, 8); - st->voice_fac_float = -1; /* purely unvoiced */ -#endif // #ifndef IVAS_FLOAT_FIXED - - /* TCX-LTP */ - if (hTcxLtpDec != NULL) - { - tcxltp_dec_init(hTcxLtpDec, st->ini_frame, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core); - } - - /* TCX */ - if (hTcxDec != NULL) - { -#ifndef IVAS_FLOAT_FIXED - st->old_fpitchFB_float = (float)hTcxDec->pit_min_TCX; -#endif // #ifndef IVAS_FLOAT_FIXED - - if (st->ini_frame == 0 || (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO)) - { - //hTcxDec->tcxltp_last_gain_unmodified_float = 0.f; - } - - /* TCX */ - hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri(total_brate, st->rf_flag, st->element_mode); - - hTcxDec->envWeighted = 0; - } #ifndef IVAS_FLOAT_FIXED - if (st->hBPF != NULL) - { - st->hBPF->pst_mem_deemp_err = 0.0f; - } - if (st->tcxonly) - { - st->p_bpf_noise_buf_float = NULL; - - } - else - { - st->p_bpf_noise_buf_float = st->bpf_noise_buf_float; - - } -#endif - - if (bwidth == SWB && (total_brate == ACELP_16k40 || total_brate == ACELP_24k40) && st->element_mode == EVS_MONO) - { - st->tec_tfa = 1; - } - else - { - st->tec_tfa = 0; - } - - st->tec_flag = 0; - st->tfa_flag = 0; - - /* needed in decoder to read the bitstream */ - st->enableGplc = 0; - - st->flagGuidedAcelp = 0; - st->tonal_mdct_plc_active = 0; - st->T0_4th = L_SUBFR; - st->guidedT0 = st->T0_4th; - - if (st->hPlcInfo != NULL && total_brate >= HQ_48k && st->element_mode == EVS_MONO) - { - st->enablePlcWaveadjust = 1; - - if (st->hTcxDec != NULL && (st->ini_frame == 0 || last_total_brate < HQ_48k || st->last_codec_mode == MODE1 || st->force_lpd_reset)) - { - concealment_init(st->hTcxDec->L_frameTCX, st->hPlcInfo); - } - } - else - { - st->enablePlcWaveadjust = 0; - } - - /* PLC: [TCX: Tonal Concealment] */ - if (st->hTonalMDCTConc != NULL && !(st->element_mode > EVS_MONO && st->ini_frame != 0 && st->hTonalMDCTConc->nSamples == st->hTcxDec->L_frameTCX)) - { - st->hTonalMDCTConc->nScaleFactors = 0; - st->hTonalMDCTConc->nSamples = 0; -#ifndef IVAS_FLOAT_FIXED - st->hTonalMDCTConc->lastPcmOut_float = 0x0; -#endif - st->hTonalMDCTConc->lastBlockData.tonalConcealmentActive = 0; - st->hTonalMDCTConc->lastBlockData.nSamples = 0; - - TonalMDCTConceal_Init_ivas(st->hTonalMDCTConc, st->hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg); - } - - st->last_tns_active = 0; - st->second_last_tns_active = 0; - st->second_last_core = -1; - - if (st->hTcxCfg != NULL && - st->element_mode != EVS_MONO) - { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed(is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode); - } -#ifndef IVAS_FLOAT_FIXED - if (hTcxDec != NULL) - { - hTcxDec->tcxltp_second_last_pitch_float = st->old_fpitch_float; - hTcxDec->tcxltp_third_last_pitch_float = st->old_fpitch_float; - } -#endif // #ifndef IVAS_FLOAT_FIXED - - if ( ( total_brate == ACELP_9k60 || total_brate == ACELP_16k40 || total_brate == ACELP_24k40 ) && st->element_mode == EVS_MONO ) - { - st->dec_glr = 1; - } - else - { - st->dec_glr = 0; - } - - st->dec_glr_idx = 0; - - st->VAD = 0; - if ( hTcxDec != NULL ) - { - hTcxDec->enableTcxLpc = 1; -#ifndef IVAS_FLOAT_FIXED - hTcxDec->old_gaintcx_bfi_float = 0.0f; -#endif - hTcxDec->tcx_hm_LtpPitchLag = -1; - } - - if ( st->hTcxCfg != NULL ) - { - st->hTcxCfg->na_scale_flt = 1.f; - } - - return; -} -#else void open_decoder_LPD( Decoder_State *st, /* i/o: decoder state structure */ const int32_t total_brate, /* i : total bitrate */ @@ -1467,47 +714,7 @@ void open_decoder_LPD( * * Initialization TCX-LTP handle *-----------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void tcxltp_dec_init( - TCX_LTP_DEC_HANDLE hTcxLtpDec, - const int16_t ini_frame, - const int16_t last_codec_mode, - const int16_t element_mode, - const int16_t pit_max, - const int32_t sr_core ) -{ #ifndef IVAS_FLOAT_FIXED - hTcxLtpDec->tcxltp_gain_float = 0.0f; -#endif - hTcxLtpDec->tcxltp = getTcxLtp( sr_core ); - - if ( ini_frame == 0 || ( last_codec_mode == MODE1 && element_mode == EVS_MONO ) ) - { - - hTcxLtpDec->tcxltp_pitch_int = pit_max; - hTcxLtpDec->tcxltp_pitch_fr = 0; - - if ( ini_frame == 0 ) - { - //set_f( hTcxLtpDec->tcxltp_mem_in_float, 0.0f, TCXLTP_MAX_DELAY ); - //set_f( hTcxLtpDec->tcxltp_mem_out_float, 0.0f, L_FRAME48k ); -#ifdef IVAS_FLOAT_FIXED - set32_fx(hTcxLtpDec->tcxltp_mem_in_32, 0, TCXLTP_MAX_DELAY); - set32_fx(hTcxLtpDec->tcxltp_mem_out_32, 0, L_FRAME48k); -#endif // IVAS_FLOAT_FIXED - hTcxLtpDec->tcxltp_pitch_int_post_prev = 0; - hTcxLtpDec->tcxltp_pitch_fr_post_prev = 0; - //hTcxLtpDec->tcxltp_gain_post_prev_float = 0.f; -#ifdef IVAS_FLOAT_FIXED - hTcxLtpDec->tcxltp_gain_post_prev = 0; -#endif // IVAS_FLOAT_FIXED - hTcxLtpDec->tcxltp_filt_idx_prev = -1; - } - } - - return; -} -#else void tcxltp_dec_init( TCX_LTP_DEC_HANDLE hTcxLtpDec, const int16_t ini_frame, diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index ab367e3a4..045c54345 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -8,6 +8,7 @@ #include #include "options.h" #include "prot_fx1.h" +#include "prot.h" //Can be removed later #include "prot_fx2.h" #include "basop_util.h" #include "rom_com.h" @@ -1034,6 +1035,8 @@ void tcxltp_dec_init_fx( { set16_fx( hTcxLtpDec->tcxltp_mem_in, 0, TCXLTP_MAX_DELAY ); set16_fx( hTcxLtpDec->tcxltp_mem_out, 0, L_FRAME48k ); + set32_fx(hTcxLtpDec->tcxltp_mem_in_32, 0, TCXLTP_MAX_DELAY); + set32_fx(hTcxLtpDec->tcxltp_mem_out_32, 0, L_FRAME48k); hTcxLtpDec->tcxltp_pitch_int_post_prev = 0; hTcxLtpDec->tcxltp_pitch_fr_post_prev = 0; hTcxLtpDec->tcxltp_gain_post_prev = 0; @@ -1814,19 +1817,6 @@ void open_decoder_LPD_ivas_fx( IF( st->hTcxDec != NULL && ( EQ_16( st->ini_frame, 0 ) || LT_32( last_total_brate, HQ_48k ) || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset ) ) { concealment_init_ivas_fx( st->hTcxDec->L_frameTCX, st->hPlcInfo ); - //---------------- To be removed later : Only initializations -#ifndef IVAS_FLOAT_FIXED - st->hPlcInfo->outx_new_n1 = 0.0f; - st->hPlcInfo->nsapp_gain = 0.0f; -#endif -#ifndef IVAS_FLOAT_FIXED - st->hPlcInfo->nsapp_gain_n = 0.0f; - st->hPlcInfo->ener_mean = 59.4260f; - st->hPlcInfo->ener = 0.0f; - st->hPlcInfo->recovery_gain_float = 0.0f; - st->hPlcInfo->step_concealgain = 0.0f; -#endif - //-------------------To be removed later } } ELSE @@ -1840,28 +1830,9 @@ void open_decoder_LPD_ivas_fx( st->hTonalMDCTConc->nScaleFactors = 0; st->hTonalMDCTConc->nSamples = 0; st->hTonalMDCTConc->lastPcmOut = 0x0; -#ifndef IVAS_FLOAT_FIXED - //----------To be removed later: pointer initializations - st->hTonalMDCTConc->lastPcmOut_float = 0x0; - //---------- - st->hTonalMDCTConc->lastPcmOut_float = 0x0; -#endif st->hTonalMDCTConc->lastBlockData.tonalConcealmentActive = 0; st->hTonalMDCTConc->lastBlockData.nSamples = 0; TonalMDCTConceal_Init_ivas_fx( st->hTonalMDCTConc, st->hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); -#ifndef IVAS_FLOAT_FIXED - //st->hTonalMDCTConc->pTCI = (TonalComponentsInfo *) st->hTonalMDCTConc->timeDataBuffer_float; - st->hTonalMDCTConc->pTCI = &st->hTonalMDCTConc->pTCI1; - st->hTonalMDCTConc->lastPitchLag_float = 0; - st->hTonalMDCTConc->scf_fadeout_flt = 1.0f; - st->hTonalMDCTConc->last_block_nrg_flt = 0.0f; - st->hTonalMDCTConc->curr_noise_nrg_flt = 0.0f; - st->hTonalMDCTConc->faded_signal_nrg_flt = 0.0f; - st->hTonalMDCTConc->secondLastPcmOut_float = &st->hTonalMDCTConc->timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2 - imult1616( 3, shr( s_min( L_FRAME_MAX, st->hTcxDec->L_frameTCX ), 1 ) )]; - st->hTonalMDCTConc->lastPcmOut_float = &st->hTonalMDCTConc->timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2 - s_min( L_FRAME_MAX, st->hTcxDec->L_frameTCX )]; - //---------------To be removed later - assert( sizeof( *st->hTonalMDCTConc->pTCI ) <= ( st->hTonalMDCTConc->lastPcmOut_float - st->hTonalMDCTConc->timeDataBuffer_float ) * sizeof( st->hTonalMDCTConc->timeDataBuffer_float[0] ) ); -#endif // #ifndef IVAS_FLOAT_FIXED } st->last_tns_active = 0; diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 654fd2293..a1c1db294 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -218,38 +218,25 @@ ivas_error core_switching_pre_dec_ivas_fx( { /*TODO None of the test dtreams are entering this block,hence enabled assert(0)*/ assert( 0 ); -#ifdef IVAS_FLOAT_FIXED Word32 *realBuffer_fx[CLDFB_NO_COL_MAX_SWITCH], *imagBuffer_fx[CLDFB_NO_COL_MAX_SWITCH]; Word32 realBufferTmp_fx[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX], imagBufferTmp_fx[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX]; Word32 syn_Overl_fx[320]; Word32 fer_samples_fx[960]; Copy_Scale_sig_16_32( st->hTcxDec->syn_Overl, syn_Overl_fx, 320, 15 ); Copy_Scale_sig_16_32( st->hHQ_core->fer_samples_fx, fer_samples_fx, 960, 15 ); -#else - float *realBuffer[CLDFB_NO_COL_MAX_SWITCH], *imagBuffer[CLDFB_NO_COL_MAX_SWITCH]; - float realBufferTmp[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX], imagBufferTmp[CLDFB_NO_COL_MAX_SWITCH][CLDFB_NO_CHANNELS_MAX]; -#endif // IVAS_FLOAT_FIXED FOR( i = 0; i < CLDFB_NO_COL_MAX_SWITCH; i++ ) { -#ifdef IVAS_FLOAT_FIXED set32_fx( realBufferTmp_fx[i], 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( imagBufferTmp_fx[i], 0, CLDFB_NO_CHANNELS_MAX ); realBuffer_fx[i] = realBufferTmp_fx[i]; imagBuffer_fx[i] = imagBufferTmp_fx[i]; move32(); move32(); -#else - set_f( realBufferTmp[i], 0, CLDFB_NO_CHANNELS_MAX ); - set_f( imagBufferTmp[i], 0, CLDFB_NO_CHANNELS_MAX ); - realBuffer[i] = realBufferTmp[i]; - imagBuffer[i] = imagBufferTmp[i]; -#endif // IVAS_FLOAT_FIXED } /* CLDFB analysis of the synthesis at internal sampling rate */ -#ifdef IVAS_FLOAT_FIXED IF( ( error = cldfb_save_memory_ivas_fx( st->cldfbAna ) ) != IVAS_ERR_OK ) { return error; @@ -268,23 +255,6 @@ ivas_error core_switching_pre_dec_ivas_fx( cldfb_restore_memory_ivas_fx( st->cldfbSyn ); Copy_Scale_sig_32_16( syn_Overl_fx, st->hTcxDec->syn_Overl, 320, 15 ); Copy_Scale_sig_32_16( fer_samples_fx, st->hHQ_core->fer_samples_fx, 960, 9 ); -#else - if ( ( error = cldfb_save_memory_ivas( st->cldfbAna ) ) != IVAS_ERR_OK ) - { - return error; - } - cldfbAnalysis_ivas( st->hTcxDec->syn_Overl_float, realBuffer, imagBuffer, delay_comp, st->cldfbAna ); - cldfb_restore_memory_ivas( st->cldfbAna ); - - /* CLDFB synthesis of the combined signal */ - if ( ( error = cldfb_save_memory_ivas( st->cldfbSyn ) ) != IVAS_ERR_OK ) - { - return error; - } - - cldfbSynthesis_ivas( realBuffer, imagBuffer, st->hHQ_core->fer_samples, delay_comp, st->cldfbSyn ); - cldfb_restore_memory_ivas( st->cldfbSyn ); -#endif // IVAS_FLOAT_FIXED } IF( !st->last_con_tcx && EQ_16( st->last_core_bfi, ACELP_CORE ) && EQ_16( st->core, HQ_CORE ) ) @@ -425,9 +395,6 @@ ivas_error core_switching_pre_dec_ivas_fx( st->lp_gainc_fx = extract_h( Sqrt32( st->lp_ener_fx, &exp ) ); /*Q=15-exp*/ st->lp_gainc_fx = shr( st->lp_gainc_fx, 12 - exp ); /*Q3*/ -#ifndef IVAS_FLOAT_FIXED /*To be removed later: floating point initializations*/ - st->last_voice_factor = 0; -#endif st->last_voice_factor_fx = 0; st->Last_GSC_noisy_speech_flag = 0; move16(); @@ -476,12 +443,7 @@ ivas_error core_switching_pre_dec_ivas_fx( move32(); set16_fx( st->hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); } -#if 1 - //st->tilt_code = 0.0f; - //st->gc_threshold = 0.0f; - //set_f( st->dispMem, 0, 8 ); -#endif st->tilt_code_fx = 0; st->gc_threshold_fx = 0; st->dm_fx.prev_gain_code = 0; @@ -500,9 +462,6 @@ ivas_error core_switching_pre_dec_ivas_fx( st->lp_gainc_fx = extract_h( Sqrt32( st->lp_ener_fx, &exp ) ); /*Q=15-exp*/ st->lp_gainc_fx = shr( st->lp_gainc_fx, 12 - exp ); /*Q3*/ -#ifndef IVAS_FLOAT_FIXED - st->last_voice_factor = 0; -#endif // st->last_voice_factor_fx = 0; st->Last_GSC_noisy_speech_flag = 0; move16(); @@ -567,10 +526,6 @@ ivas_error core_switching_pre_dec_ivas_fx( IF( NE_16(st->last_core , TCX_20_CORE) && NE_16(st->last_core , TCX_10_CORE) ) { -#if 1 /*Floating point initialization*/ - set_f( st->hHQ_core->old_out, 0, output_frame ); - set_f( st->hHQ_core->old_outLB, 0, L_FRAME16k ); -#endif // 1 set16_fx( st->hHQ_core->old_out_fx, 0, output_frame ); set32_fx( st->hHQ_core->old_outLB_fx, 0, L_FRAME16k ); set16_fx(st->hHQ_core->old_out_LB_fx, 0, L_FRAME16k); @@ -578,12 +533,6 @@ ivas_error core_switching_pre_dec_ivas_fx( st->hHQ_core->no_att_hangover = 0; move16(); -#if 1 /*To be removed later: Floating point initialization*/ - //st->hHQ_core->energy_lt = 300.0f; - //set_f( st->hHQ_core->prev_noise_level, 0.0f, 2 ); - //st->hHQ_core->prev_ni_ratio = 0.5f; - //set_f( st->hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS ); -#endif st->hHQ_core->energy_lt_fx = 2457600;/*300.0f Q13*/ move32(); set16_fx( st->hHQ_core->old_is_transient, 0, 3 ); @@ -599,10 +548,6 @@ ivas_error core_switching_pre_dec_ivas_fx( } ELSE { -#if 1 /*To be removed later: Floating point initialization*/ - set_f( st->hHQ_core->old_out, 0, output_frame ); - set_f( st->hHQ_core->old_outLB, 0, L_FRAME16k ); -#endif // set16_fx( st->hHQ_core->old_out_fx, 0, output_frame ); set32_fx( st->hHQ_core->old_outLB_fx, 0, L_FRAME16k ); } @@ -1660,6 +1605,7 @@ void core_switching_hq_prepare_dec( * Classification for band-width switching *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void bandwidth_switching_detect( Decoder_State *st /* i/o: decoder state structure */ ) @@ -1706,7 +1652,7 @@ void bandwidth_switching_detect( return; } -#ifdef IVAS_FLOAT_FIXED +#else void bandwidth_switching_detect_ivas_fx( Decoder_State *st_fx /* i/o: encoder state structure */ ) diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index c995f2a50..0c7d6c194 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -2170,7 +2170,7 @@ void decoder_tcx_imdct_fx( * * Initialize lengths for TCX processing, update IGF subframe info *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void init_tcx_info( Decoder_State *st, /* i/o: coder memory state */ const int16_t L_frame_glob, /* i : global frame length */ @@ -2264,7 +2264,7 @@ void init_tcx_info( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 7cdbfbc2b..ba1d1f4b1 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -2001,13 +2001,13 @@ void generate_masking_noise_ivas_fx( Word32 *timeDomainBuffer, /* i/o: time-domain signal */ Word16 *exp_out, /* o : time-domain signal exp */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t length, /* i : frame size */ - const int16_t core, /* i : core */ - const int16_t return_noise, /* i : noise is returned instead of added */ - const int16_t secondary, /* i : flag to indicate secondary noise generation */ - const int16_t element_mode, /* i : element mode */ + const Word16 length, /* i : frame size */ + const Word16 core, /* i : core */ + const Word16 return_noise, /* i : noise is returned instead of added */ + const Word16 secondary, /* i : flag to indicate secondary noise generation */ + const Word16 element_mode, /* i : element mode */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ + const Word16 nchan_out /* i : number of output channels */ ) { Word32 *cngNoiseLevel_fx = hFdCngCom->cngNoiseLevel; @@ -2020,51 +2020,49 @@ void generate_masking_noise_ivas_fx( Word16 startBand = hFdCngCom->startBand; Word16 *seed = &( hFdCngCom->seed ); Word32 scale_fx = 0x40000000; // 1.0 in Q30 + move32(); /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */ *exp_out = Q15; - IF( hFdCngCom->likelihood_noisy_speech_32fx > DELTA_MASKING_NOISE_Q31 ) + move16(); + IF( GT_32( hFdCngCom->likelihood_noisy_speech_32fx, DELTA_MASKING_NOISE_Q31 ) ) { - IF( core != AMR_WB_CORE ) + IF( NE_16( core, AMR_WB_CORE ) ) { /* Compute additional CN level */ FOR( i = 0; i < SIZE_SCALE_TABLE_CN; i++ ) { - IF( ( hFdCngCom->CngBandwidth == scaleTable_cn_only[i].bwmode ) && - ( hFdCngCom->CngBitrate >= scaleTable_cn_only[i].bitrateFrom ) && - ( hFdCngCom->CngBitrate < scaleTable_cn_only[i].bitrateTo ) ) + test(); + test(); + IF( EQ_16( hFdCngCom->CngBandwidth, scaleTable_cn_only[i].bwmode ) && + GE_32( hFdCngCom->CngBitrate, scaleTable_cn_only[i].bitrateFrom ) && + LT_32( hFdCngCom->CngBitrate, scaleTable_cn_only[i].bitrateTo ) ) { - break; + BREAK; } } - Word16 exp; - //Word32 scale_temp = BASOP_util_Pow2( Mpy_32_32( float_to_fix( -scaleTable_cn_only[i].scale_flt / 10.f, Q31 ), LOG_10_BASE_2 ), Q2, &exp ); - Word32 scale_temp = BASOP_util_Pow2( Mpy_32_32( L_shl( negate( scaleTable_cn_only[i].scale_ivas / 10 ), 18 ), LOG_10_BASE_2 ), Q2, &exp ); - scale_temp = L_sub( scale_temp, L_shl( 1, Q31 - exp ) ); - scale_fx = L_shl( scale_temp, exp - Q1 ); // Q30 + scale_fx = L_deposit_h( scaleTable_cn_only[i].scale_ivas ); /* Q30 */ } ELSE { /* Compute additional CN level */ FOR( i = 0; i < SIZE_SCALE_TABLE_CN_AMRWB; i++ ) { - IF( hFdCngCom->CngBitrate >= scaleTable_cn_only_amrwbio_flt[i][0] ) + IF( GE_32( hFdCngCom->CngBitrate, scaleTable_cn_only_amrwbio[i][0] ) ) { - break; + BREAK; } } IF( i < SIZE_SCALE_TABLE_CN_AMRWB ) { - Word16 exp; - Word32 scale_temp = BASOP_util_Pow2( Mpy_32_32( scaleTable_cn_only_amrwbio_fx_by_10f[i][1], LOG_10_BASE_2 ), Q2, &exp ); - scale_temp = L_sub( scale_temp, L_shl( 1, Q31 - exp ) ); - scale_fx = L_shl( Mpy_32_32( scale_fx, scale_temp ), exp ); // Q30 + scale_fx = L_deposit_h( scaleTable_cn_only_amrwbio[i][1] ); /* Q30 */ } ELSE { scale_fx = 0; + move32(); } } @@ -2073,9 +2071,9 @@ void generate_masking_noise_ivas_fx( /* Generate Gaussian random noise in real and imaginary parts of the FFT bins Amplitudes are adjusted to the estimated noise level cngNoiseLevel_flt in each bin */ - IF( startBand == 0 ) + IF( EQ_16( startBand, 0 ) ) { - rand_gauss_fx( &fftBuffer_fx[0], seed, *exp_out); // Q15 + rand_gauss_fx( &fftBuffer_fx[0], seed, *exp_out ); // Q15 ptr_r_fx = fftBuffer_fx + 2; Word16 exp1 = 32 - hFdCngCom->cngNoiseLevelExp; Word32 mpy1 = Sqrt32( Mpy_32_32( scale_fx, *ptr_level_fx ), &exp1 ); // Q = noise_exp-1 @@ -2086,6 +2084,7 @@ void generate_masking_noise_ivas_fx( ELSE { fftBuffer_fx[0] = 0; + move32(); set_l( fftBuffer_fx + 2, 0, 2 * ( startBand - 1 ) ); ptr_r_fx = fftBuffer_fx + 2 * startBand; } @@ -2093,14 +2092,14 @@ void generate_masking_noise_ivas_fx( FOR( ; ptr_level_fx < cngNoiseLevel_fx + hFdCngCom->stopFFTbin - startBand; ptr_level_fx++ ) { /* Real part in FFT bins */ - rand_gauss_fx( ptr_r_fx, seed, *exp_out); // Q15 + rand_gauss_fx( ptr_r_fx, seed, *exp_out ); // Q15 Word16 exp2 = 32 - hFdCngCom->cngNoiseLevelExp; Word32 mpy2 = Sqrt32( L_shr( Mpy_32_32( scale_fx, *ptr_level_fx ), 1 ), &exp2 ); // Q = noise_exp-1 ( *ptr_r_fx ) = L_shl( Mpy_32_32( *ptr_r_fx, mpy2 ), exp2 ); // Q = Q15 ptr_r_fx += 2; /* Imaginary part in FFT bins */ - rand_gauss_fx( ptr_i_fx, seed, *exp_out); // Q15 + rand_gauss_fx( ptr_i_fx, seed, *exp_out ); // Q15 ( *ptr_i_fx ) = L_shl( Mpy_32_32( *ptr_i_fx, mpy2 ), exp2 ); // Q = Q15 ptr_i_fx += 2; } @@ -2109,6 +2108,7 @@ void generate_masking_noise_ivas_fx( set_l( fftBuffer_fx + 2 * hFdCngCom->stopFFTbin, 0, hFdCngCom->fftlen - 2 * hFdCngCom->stopFFTbin ); /* Nyquist frequency is discarded */ fftBuffer_fx[1] = 0; + move32(); } ELSE { @@ -2121,25 +2121,21 @@ void generate_masking_noise_ivas_fx( /* Perform STFT synthesis */ IF( secondary ) { - // SynthesisSTFT_flt(fftBuffer, maskingNoise, hStereoCng->olapBufferSynth22, hFdCngCom->olapWinSyn_flt, 0, hFdCngCom, element_mode, nchan_out); SynthesisSTFT_fx( fftBuffer_fx, *exp_out, maskingNoise_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->olapWinSyn_fx, 0, hFdCngCom, element_mode, nchan_out ); } ELSE { - // SynthesisSTFT_flt(fftBuffer, maskingNoise, hFdCngCom->olapBufferSynth2_flt, hFdCngCom->olapWinSyn_flt, 0, hFdCngCom, element_mode, nchan_out); SynthesisSTFT_fx( fftBuffer_fx, *exp_out, maskingNoise_fx, hFdCngCom->olapBufferSynth2_fx, hFdCngCom->olapWinSyn_fx, 0, hFdCngCom, element_mode, nchan_out ); } - *exp_out = *exp_out - 9; + *exp_out = sub( *exp_out, Q9 ); /* Add some comfort noise on top of decoded signal */ IF( return_noise ) { - // mvr2r(maskingNoise, timeDomainBuffer, min(hFdCngCom->frameSize, length)); mvl2l( maskingNoise_fx, timeDomainBuffer, min( hFdCngCom->frameSize, length ) ); } ELSE { - // v_add(maskingNoise, timeDomainBuffer, timeDomainBuffer, min(hFdCngCom->frameSize, length)); v_add_fixed( maskingNoise_fx, timeDomainBuffer, timeDomainBuffer, min( hFdCngCom->frameSize, length ), 0 ); } diff --git a/lib_dec/hdecnrm.c b/lib_dec/hdecnrm.c index 861e7c96c..907926b68 100644 --- a/lib_dec/hdecnrm.c +++ b/lib_dec/hdecnrm.c @@ -49,6 +49,7 @@ /* Context based Huffman decoding for indices of quantized norms */ /*--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: decoded index */ static int16_t decode_huff_context( Decoder_State *st, /* i/o: decoder state structure */ @@ -64,7 +65,7 @@ static int16_t decode_huff_context( return ( -*hufftab ); } - +#endif /*--------------------------------------------------------------------------*/ /* Function hdecnrm() */ @@ -72,6 +73,7 @@ static int16_t decode_huff_context( /* Huffman decoding for indices of quantized norms */ /*--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void hdecnrm( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of norms */ @@ -143,6 +145,7 @@ void hdecnrm( return; } +#endif /*-------------------------------------------------------------------------- * huff_dec() @@ -150,6 +153,7 @@ void hdecnrm( * Huffman decoding *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void huff_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : Number of codewords to decode */ @@ -189,6 +193,7 @@ void huff_dec( return; } +#endif /*-------------------------------------------------------------------------- @@ -197,6 +202,7 @@ void huff_dec( * Huffman decoding for indices of quantized norms *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void hdecnrm_context( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of norms */ @@ -233,6 +239,7 @@ void hdecnrm_context( return; } +#endif /*-------------------------------------------------------------------------- @@ -241,6 +248,7 @@ void hdecnrm_context( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void hdecnrm_resize( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of SFMs */ @@ -300,6 +308,7 @@ void hdecnrm_resize( return; } +#endif /*-------------------------------------------------------------------------- @@ -308,6 +317,7 @@ void hdecnrm_resize( * Huffman decoding for indices of quantized norms *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void hdecnrm_tran( Decoder_State *st, /* i/o: decoder state structure */ const int16_t N, /* i : number of norms */ @@ -398,3 +408,4 @@ void hdecnrm_tran( return; } +#endif diff --git a/lib_dec/hq_classifier_dec.c b/lib_dec/hq_classifier_dec.c index 3700d0df2..06678866c 100644 --- a/lib_dec/hq_classifier_dec.c +++ b/lib_dec/hq_classifier_dec.c @@ -41,6 +41,7 @@ #include "rom_com.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_classifier_dec() * @@ -101,3 +102,4 @@ int16_t hq_classifier_dec( return bits; } +#endif diff --git a/lib_dec/hq_classifier_dec_fx.c b/lib_dec/hq_classifier_dec_fx.c index af6521ae8..bf263e431 100644 --- a/lib_dec/hq_classifier_dec_fx.c +++ b/lib_dec/hq_classifier_dec_fx.c @@ -85,6 +85,7 @@ Word16 ivas_hq_classifier_dec_fx( /* o : Consumed bits } #endif +#ifdef IVAS_FLOAT_FIXED Word16 hq_classifier_dec_fx( /* o : Consumed bits Q0 */ Decoder_State *st_fx, /* i/o: decoder state structure */ const Word32 core_brate, /* i : Core bit rate Q0 */ @@ -158,4 +159,4 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits Q0 */ return bits; } - +#endif diff --git a/lib_dec/hq_conf_fec.c b/lib_dec/hq_conf_fec.c index 80c61052a..fc1431311 100644 --- a/lib_dec/hq_conf_fec.c +++ b/lib_dec/hq_conf_fec.c @@ -41,6 +41,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_configure_bfi() * @@ -65,3 +66,4 @@ void hq_configure_bfi( return; } +#endif \ No newline at end of file diff --git a/lib_dec/hq_conf_fec_fx.c b/lib_dec/hq_conf_fec_fx.c index 31c13c254..86bdfd6bc 100644 --- a/lib_dec/hq_conf_fec_fx.c +++ b/lib_dec/hq_conf_fec_fx.c @@ -10,6 +10,7 @@ #include "cnst.h" +#ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_configure_bfi_fx() * @@ -37,3 +38,4 @@ void hq_configure_bfi_fx( move16(); return; } +#endif diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index bc433d630..9157a79b6 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -1209,15 +1209,11 @@ void HQ_core_dec_init_fx( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ) { -#if 1 //TOBE Removed later - set_f( hHQ_core->old_out, 0, L_FRAME48k ); - set_f( hHQ_core->old_outLB, 0, L_FRAME32k ); -#endif set16_fx(hHQ_core->old_out_fx, 0, L_FRAME48k); set16_fx(hHQ_core->old_out_LB_fx, 0, L_FRAME32k); set32_fx(hHQ_core->oldOut_fx, 0, L_FRAME48k); set32_fx(hHQ_core->old_outLB_fx, 0, L_FRAME32k); - hHQ_core->Q_old_wtda = 15; + hHQ_core->Q_old_wtda = 15; hHQ_core->Q_old_postdec = 0; hHQ_core->Q_old_wtda_LB = 0; hHQ_core->Q_old_out = 0; diff --git a/lib_dec/hq_env_dec.c b/lib_dec/hq_env_dec.c index 77f897c45..e806f1b62 100644 --- a/lib_dec/hq_env_dec.c +++ b/lib_dec/hq_env_dec.c @@ -40,6 +40,7 @@ #include "rom_com.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* * decode_envelope_indices() * @@ -137,7 +138,9 @@ int16_t decode_envelope_indices( return hcode_l; } +#endif +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* * dequantize_norms() * @@ -197,3 +200,4 @@ void dequantize_norms( return; } +#endif diff --git a/lib_dec/hq_env_dec_fx.c b/lib_dec/hq_env_dec_fx.c index 6362cc798..8ecc8b6da 100644 --- a/lib_dec/hq_env_dec_fx.c +++ b/lib_dec/hq_env_dec_fx.c @@ -8,6 +8,7 @@ #include "prot_fx2.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ +#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* * decode_envelope_indices_fx() * @@ -136,7 +137,9 @@ Word16 decode_envelope_indices_fx( /* o : Number of bits */ return hcode_l; } +#endif +#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* * dequantize_norms_fx() * @@ -213,4 +216,5 @@ void dequantize_norms_fx( return; } +#endif diff --git a/lib_dec/hq_hr_dec_fx.c b/lib_dec/hq_hr_dec_fx.c index abd15b6a7..f8b66cb29 100644 --- a/lib_dec/hq_hr_dec_fx.c +++ b/lib_dec/hq_hr_dec_fx.c @@ -68,7 +68,6 @@ void ivas_hq_pred_hb_bws_fx( return; } -#endif void hq_pred_hb_bws_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ @@ -135,6 +134,7 @@ void hq_pred_hb_bws_fx( return; } +#endif /*--------------------------------------------------------------------------* * hq_hr_dec_fx() * @@ -404,7 +404,6 @@ void ivas_hq_hr_dec_fx( return; } -#endif void hq_hr_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure fx */ @@ -668,3 +667,4 @@ void hq_hr_dec_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/hq_lr_dec_fx.c b/lib_dec/hq_lr_dec_fx.c index a7b4d7041..e233a420a 100644 --- a/lib_dec/hq_lr_dec_fx.c +++ b/lib_dec/hq_lr_dec_fx.c @@ -14,7 +14,7 @@ /*--------------------------------------------------------------------------* * Local function prototypes *--------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static Word16 p2a_threshold_dequant_fx( Decoder_State *st_fx, Word16 *p2a_flags, const Word16 bands, const Word16 p2a_bands ); static void mdct_spectrum_fine_gain_dec_fx( Decoder_State *st_fx, Word32 L_y2[], const Word16 band_start[], const Word16 band_end[], @@ -1383,3 +1383,4 @@ static void mdct_spectrum_fine_gain_dec_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index 494780d7b..d6eb6d466 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -196,6 +196,7 @@ static void IGF_replaceTCXNoise_2_new_flt( * reads whitening levels *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_decode_whitening_level_flt( Decoder_State *st, /* i : decoder state */ IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /* i/o: instance handle of IGF Deccoder */ @@ -225,6 +226,7 @@ static void IGF_decode_whitening_level_flt( return; } +#endif /*-------------------------------------------------------------------* @@ -1007,6 +1009,7 @@ static void IGF_RefineGrid_flt( * reads whitening information from the bitstream *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void IGFDecReadData_flt( const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Deccoder */ Decoder_State *st, /* i : decoder state */ @@ -1085,8 +1088,9 @@ void IGFDecReadData_flt( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IGFDecReadLevel_flt() * @@ -1133,6 +1137,7 @@ int16_t IGFDecReadLevel_flt( return IGFAllZero; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -1441,7 +1446,7 @@ void IGFDecSetMode_flt( * * updates the start/stop frequency of IGF according to igfGridIdx *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void IGFDecUpdateInfo_flt( const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Decoder */ const int16_t subFrameIdx, /* i : index of subframe */ @@ -1453,14 +1458,8 @@ void IGFDecUpdateInfo_flt( hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[0]; hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[0]; -#ifndef IVAS_FLOAT_FIXED hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[0]; hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[0]; -#endif -#ifdef IVAS_FLOAT_FIXED - hIGFDec->virtualSpec_fx = &hIGFDec->virtualSpec[0]; - hIGFDec->igfData.pSpecFlat = &hIGFDec->igfData.pSpecFlatBuf_fx[0]; -#endif hIGFDec->igfData.igfInfo.nfSeed = &hIGFDec->igfData.igfInfo.nfSeedBuf[0]; if ( igfGridIdx == IGF_GRID_LB_SHORT ) @@ -1480,7 +1479,7 @@ void IGFDecUpdateInfo_flt( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -1544,7 +1543,7 @@ void IGFDecCopyLPCFlatSpectrum_flt( * * store the IGF bitstream information for TCX10 subframes *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void IGFDecStoreTCX10SubFrameData_flt( const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Decoder */ const int16_t subFrameIdx /* i : index of subframe */ @@ -1567,14 +1566,14 @@ void IGFDecStoreTCX10SubFrameData_flt( return; } - +#endif /*-------------------------------------------------------------------* * IGFDecRestoreTCX10SubFrameData_flt() * * restore the IGF bitstream information for TCX10 subframes *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void IGFDecRestoreTCX10SubFrameData_flt( const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i/o: instance handle of IGF Decoder */ const int16_t subFrameIdx /* i : index of subframe */ @@ -1596,49 +1595,19 @@ void IGFDecRestoreTCX10SubFrameData_flt( hIGFDec->flatteningTrigger = hPrivateData->igf_flatteningTrigger_subframe[subFrameIdx]; hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[subFrameIdx * ( IGF_START_MX ) / 2]; -#ifndef IVAS_FLOAT_FIXED hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[subFrameIdx * IGF_START_MX / 2]; -#endif -#ifdef IVAS_FLOAT_FIXED - hIGFDec->virtualSpec_fx = &hIGFDec->virtualSpec[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; -#endif -#ifdef IVAS_FLOAT_FIXED - hIGFDec->igfData.pSpecFlat = &hIGFDec->igfData.pSpecFlatBuf_fx[subFrameIdx * IGF_START_MX / 2]; -#endif hIGFDec->igfData.igfInfo.nfSeed = &hIGFDec->igfData.igfInfo.nfSeedBuf[subFrameIdx]; return; } - +#endif /*-----------------------------------------------------------------------* * init_igf_dec_flt() * * Initialize IGF decoder parameters *-----------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void init_igf_dec_flt( - IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */ -) -{ - set_c( (int8_t *) ( hIGFDec->infoTCXNoiseBuf ), 0, IGF_START_MX ); -#ifndef IVAS_FLOAT_FIXED - set_f( hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX ); -#endif - hIGFDec->igfData.igfInfo.nfSeedBuf[0] = 9733; - hIGFDec->igfData.igfInfo.nfSeedBuf[1] = 9733; - hIGFDec->igfData.igfInfo.nfSeed = &hIGFDec->igfData.igfInfo.nfSeedBuf[0]; #ifndef IVAS_FLOAT_FIXED - hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[0]; -#endif - hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[0]; - hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[0]; -#ifndef IVAS_FLOAT_FIXED - hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[0]; -#endif - return; -} -#else void init_igf_dec_flt( IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */ ) @@ -1662,6 +1631,7 @@ void init_igf_dec_flt( * *-----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: IGF start line */ int16_t get_igf_startline_flt( Decoder_State *st, /* i : decoder state */ @@ -1691,3 +1661,4 @@ int16_t get_igf_startline_flt( return igf_startline; } +#endif diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 8f32c1179..8a9d8fc87 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -22,7 +22,7 @@ #include "ivas_prot_fx.h" #endif - +#ifdef IVAS_FLOAT_FIXED /**********************************************************************/ /* get scalefactor of an Word32 array with condition **************************************************************************/ @@ -2969,7 +2969,6 @@ static void IGF_RefineGrid(H_IGF_GRID hGrid } -#ifdef IVAS_FLOAT_FIXED static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid handle */ ) { @@ -3025,11 +3024,10 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han move16(); } } -#endif // IVAS_FLOAT_FIXED + /**********************************************************************/ /* reads whitening information from the bitstream **************************************************************************/ -#ifdef IVAS_FLOAT_FIXED void IGFDecReadData_ivas_fx( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Deccoder */ Decoder_State *st, /**< in: | decoder state */ const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */ @@ -3112,7 +3110,7 @@ void IGFDecReadData_ivas_fx( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: IGF_decode_temp_flattening_trigger( st, hInstance ); } } -#endif + void IGFDecReadData(const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Deccoder */ Decoder_State *st, /**< in: | decoder state */ const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */ @@ -3939,7 +3937,6 @@ void IGFDecSetMode( } -#ifdef IVAS_FLOAT_FIXED void IGFDecSetMode_ivas_fx( const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i : instance handle of IGF Decoder */ const Word32 total_brate, /* i : bitrate */ @@ -4001,7 +3998,6 @@ void IGFDecSetMode_ivas_fx( hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[0]; return; } -#endif // IVAS_FLOAT_FIXED /**********************************************************************/ /* updates the start/stop frequency of IGF according to igfGridIdx **************************************************************************/ @@ -4049,12 +4045,6 @@ void IGFDecUpdateInfo_ivas_fx( hIGFDec->virtualSpec_fx = &hIGFDec->virtualSpec[0]; hIGFDec->igfData.pSpecFlat = &hIGFDec->igfData.pSpecFlatBuf_fx[0]; - /* TODO: remove float init */ -#ifndef IVAS_FLOAT_FIXED - hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[0]; - hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[0]; -#endif - hIGFDec->igfData.igfInfo.nfSeed = &hIGFDec->igfData.igfInfo.nfSeedBuf[0]; IF ( EQ_16( igfGridIdx, IGF_GRID_LB_SHORT ) ) @@ -4231,12 +4221,6 @@ void IGFDecRestoreTCX10SubFrameData_fx( hIGFDec->virtualSpec_fx = &hIGFDec->virtualSpec[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; hIGFDec->igfData.pSpecFlat = &hIGFDec->igfData.pSpecFlatBuf_fx[subFrameIdx * IGF_START_MX / 2]; - /* TODO: remove float init */ -#ifndef IVAS_FLOAT_FIXED - hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; - hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[subFrameIdx * IGF_START_MX / 2]; -#endif - hIGFDec->igfData.igfInfo.nfSeed = &hIGFDec->igfData.igfInfo.nfSeedBuf[subFrameIdx]; return; @@ -4317,3 +4301,4 @@ Word16 get_igf_startline( return igf_startline; } +#endif \ No newline at end of file diff --git a/lib_dec/igf_scf_dec.c b/lib_dec/igf_scf_dec.c index 57c8ff6a4..f92142600 100644 --- a/lib_dec/igf_scf_dec.c +++ b/lib_dec/igf_scf_dec.c @@ -41,6 +41,7 @@ #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * IGFSCFDecoderOpen_ivas() * @@ -325,3 +326,4 @@ void IGFSCFDecoderDecode_ivas( return; } +#endif \ No newline at end of file diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index 2a4d4cad2..b08bcf499 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -13,7 +13,7 @@ #include "stat_dec.h" #include "basop_util.h" - +#ifdef IVAS_FLOAT_FIXED /**********************************************************************/ /** initialization of an instance of this module **************************************************************************/ @@ -335,3 +335,4 @@ void IGFSCFDecoderDecode( hPublicData->bitsRead = sub(st->next_bit_pos, hPublicData->bitsRead); } +#endif \ No newline at end of file diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index e2ff37a54..954ed19fa 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -742,25 +742,23 @@ ivas_error init_decoder( * * Initialization of static variables for pre-echo *----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void reset_preecho_dec( HQ_DEC_HANDLE hHQ_core /* i/o: HQ decoder handle */ ) -{ -#ifndef IVAS_FLOAT_FIXED +{ hHQ_core->memfilt_lb = 0; hHQ_core->mean_prev_hb = 0; hHQ_core->smoothmem = 1; hHQ_core->mean_prev = 0; hHQ_core->mean_prev_nc = 0; hHQ_core->wmold_hb = 1; -#endif hHQ_core->prevflag = 0; hHQ_core->pastpre = 0; return; } - +#endif /*----------------------------------------------------------------------* * destroy_cldfb_decoder_flt() @@ -782,7 +780,7 @@ void destroy_cldfb_decoder_ivas_fx( return; } -#endif // IVAS_FLOAT_FIXED +#else // IVAS_FLOAT_FIXED void destroy_cldfb_decoder_flt( Decoder_State *st /* o : Decoder static variables structure */ @@ -798,3 +796,4 @@ void destroy_cldfb_decoder_flt( return; } +#endif \ No newline at end of file diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 9f74296f3..195c656cd 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -14,7 +14,6 @@ #include "ivas_prot_fx.h" #endif #ifdef IVAS_FLOAT_FIXED -#define IVAS_FLOAT_FIXED_TO_BE_REMOVED /*----------------------------------------------------------------------* * init_decoder() @@ -1627,9 +1626,6 @@ ivas_error init_decoder_ivas_fx( move16(); move16(); open_decoder_LPD_ivas_fx( st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8 ); -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - open_decoder_LPD( st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1 ); -#endif /* PLC mode initialization */ st_fx->m_decodeMode = DEC_NO_FRAM_LOSS; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 2129ca3db..f82732ab3 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -233,7 +233,6 @@ ivas_error ivas_core_dec( L_tmp = L_shl( L_tmp, st->last_concealed_gain_syn_deemph_e ); st->hHQ_core->old_out_LB_fx[i] = extract_l( L_tmp ); // Q0 } - //Copy_Scale_sig_16_32( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB_fx, st->L_frame, 11 ); } set16_fx( voice_factors_fx[n], 0, NB_SUBFR16k ); @@ -486,9 +485,6 @@ ivas_error ivas_core_dec( /* HQ core decoder */ Q_synth = 0; Word16 Q_output = 0; - //HQ_DEC_HANDLE hHQ_core; - - //hHQ_core = st->hHQ_core; ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); @@ -499,12 +495,6 @@ ivas_error ivas_core_dec( Scale_sig(synth_16_fx[n], L_FRAME48k, -Q_synth); #endif Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); - -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - //fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); - //fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); -#endif - } /*---------------------------------------------------------------------* @@ -544,10 +534,6 @@ ivas_error ivas_core_dec( Word16 e_sig = 17; Word16 ch; sts = hCPE->hCoreCoder; - Word16 will_estimate_noise_on_channel[CPE_CHANNELS]; - - will_estimate_noise_on_channel[0] = sts[0]->core == TCX_20_CORE && !sts[0]->VAD; - will_estimate_noise_on_channel[1] = sts[1]->core == TCX_20_CORE && !sts[1]->VAD; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { stereo_tcx_dec_mode_switch_reconf_To_fixed( sts[ch], 1, hCPE->last_element_mode ); @@ -559,47 +545,18 @@ ivas_error ivas_core_dec( Scale_sig(st->hHQ_core->old_out_LB_fx, L_FRAME32k, st->Q_syn - st->hHQ_core->Q_old_wtda_LB); Scale_sig(st->hHQ_core->old_out_fx, L_FRAME48k, st->Q_syn - st->hHQ_core->Q_old_wtda); - //IF( st->hHQ_core ) - //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->Q_syn, L_FRAME32k ); - - //IF( st->hHQ_core ) - //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); - //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - //{ - // st->hTcxDec->conLastFrameLevel_e = 0; - //} - //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - //{ - // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - //} IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; IF( st->hTcxDec ) st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; } - //IF( st_ivas->hLsSetUpConversion ) - //f2me_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); - //IF( st_ivas->hLsSetUpConversion ) - //f2me_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], &st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->sfbCnt ); - FOR( Word16 chOutIdx = 0; chOutIdx < st_ivas->hDecoderConfig->nchan_out; chOutIdx++ ) - { - FOR( Word16 chInIdx = 0; chInIdx < s_min( st_ivas->nchan_transport, 16 ); chInIdx++ ) - { - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxMtx_fx[chInIdx] ) - //st_ivas->hLsSetUpConversion->dmxMtx_fx[chInIdx][chOutIdx] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx], 30 ); /*Q30*/ - } - } #endif stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx ); #if 1 // Fix to float conversion - //IF( st_ivas->hLsSetUpConversion ) - //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - //IF( st_ivas->hLsSetUpConversion ) - //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); FOR( ch = 0; ch < 2; ch++ ) { @@ -607,39 +564,8 @@ ivas_error ivas_core_dec( st = hCPE->hCoreCoder[ch]; - IF( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] || sts[ch]->bfi ) - { - if ( !sts[ch]->bfi ) - { - for ( int p = 0; p < s_min( 62, sts[ch]->hFdCngDec->npart_shaping ); p++ ) - { - //sts[ch]->hFdCngDec->msNoiseEst_float[p] = ( (float) sts[ch]->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); - } - } - } st->hHQ_core->Q_old_wtda_LB = st->Q_syn; st->hHQ_core->Q_old_wtda = st->Q_syn; - if(st->Q_syn >= 0){ - //for ( int p = 0; p < 640; p++ ) - //{ - // st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - //} - - //for ( int p = 0; p < 960; p++ ) - //{ - // st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); - //} - }else{ - //for ( int p = 0; p < 640; p++ ) - //{ - // st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->Q_syn) ); - //} - - //for ( int p = 0; p < 960; p++ ) - //{ - // st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->Q_syn) ); - //} - } } #ifdef MSAN_FIX @@ -664,8 +590,6 @@ ivas_error ivas_core_dec( { sts[0]->hHQ_core->exp_old_out = 15 - sts[0]->hHQ_core->Q_old_wtda; sts[1]->hHQ_core->exp_old_out = 15 - sts[1]->hHQ_core->Q_old_wtda; - // f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); - // f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); } updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx ); @@ -673,8 +597,6 @@ ivas_error ivas_core_dec( { sts[0]->hHQ_core->Q_old_wtda = 15 - sts[0]->hHQ_core->exp_old_out; sts[1]->hHQ_core->Q_old_wtda = 15 - sts[1]->hHQ_core->exp_old_out; - //me2f_buf_16( sts[0]->hHQ_core->old_out_fx, sts[0]->hHQ_core->exp_old_out, sts[0]->hHQ_core->old_out, L_FRAME48k ); - //me2f_buf_16( sts[1]->hHQ_core->old_out_fx, sts[1]->hHQ_core->exp_old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); } #else @@ -762,8 +684,6 @@ ivas_error ivas_core_dec( { Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda ); st->hHQ_core->Q_old_wtda = 0; - - //floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_wtda, L_FRAME48k); } /*size of synth is choosen as delay comp to start with*/ @@ -828,7 +748,6 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && NE_16(st->element_mode, IVAS_CPE_MDCT) && !(EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG))) { - //Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, hSCE->q_save_synth_fx - Q_synth); } @@ -841,7 +760,6 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && hSCE && EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG)) { - //Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, hSCE->q_save_synth_fx - Q_synth); } @@ -884,13 +802,6 @@ ivas_error ivas_core_dec( #else Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); #endif - IF(st->hHQ_core != NULL) - { - //st->hHQ_core->Q_old_wtda = 0; - //fixedToFloat_arr(st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k); - } - - /*------------------reset-code-start---------------------*/ @@ -920,9 +831,6 @@ ivas_error ivas_core_dec( Q_synth_fx = 0; move16(); - //TD_BWE_DEC_HANDLE hBWE_TD; - //hBWE_TD = st->hBWE_TD; - FD_BWE_DEC_HANDLE hBWE_FD; hBWE_FD = st->hBWE_FD; @@ -1080,7 +988,6 @@ ivas_error ivas_core_dec( if ( hCPE->hStereoDft != NULL ) { - //floatToFixed_arrL( hCPE->hStereoDft->hb_stefi_sig, hCPE->hStereoDft->hb_stefi_sig_fx, q, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); hCPE->hStereoDft->td_gain_fx[0] = 1; } Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); @@ -1221,12 +1128,6 @@ ivas_error ivas_core_dec( } st->old_bwe_delay = tmps; -#ifndef IVAS_FLOAT_FIXED - IF( st->hBWE_TD != NULL ) - { - Copy_Scale_sig_32_16( hb_synth_32_fx[n], st->hBWE_TD->old_hb_synth_fx, output_frame, negate( Q11 ) ); - } -#endif /* SWB CNG/DTX - calculate SHB energy */ test(); test(); test(); @@ -1288,15 +1189,7 @@ ivas_error ivas_core_dec( if (hCPE->hCoreCoder[ch_ind]->hHQ_core != NULL) { Copy_Scale_sig_16_32(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda_LB); - //FOR(int ind = 0; ind < L_FRAME32k; ind++) - //{ - // hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB[ind] * (1 << 11)); - //} Copy_Scale_sig_16_32(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx, L_FRAME48k, Q11 - hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda); - //FOR(int ind = 0; ind < L_FRAME48k; ind++) - //{ - // hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] * (1 << 11)); - //} } } } @@ -1308,15 +1201,7 @@ ivas_error ivas_core_dec( if ( hSCE->hCoreCoder[0]->hHQ_core != NULL ) { Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); - /*FOR( int ind = 0; ind < L_FRAME32k; ind++ ) - { - hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx[ind] = (Word32) ( hSCE->hCoreCoder[0]->hHQ_core->old_outLB[ind] * ( 1 << 11 ) ); - }*/ Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_fx, hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx, L_FRAME48k, Q11 - hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); - /*FOR( int ind = 0; ind < L_FRAME48k; ind++ ) - { - hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] = (Word32) ( hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] * ( 1 << 11 ) ); - }*/ } } } @@ -1421,15 +1306,6 @@ ivas_error ivas_core_dec( } /* n_channels loop */ - for ( Word16 k = 0; k < n_channels; k++ ) - { - if ( sts[k]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); - //fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - } - } - pop_wmops(); return error; } diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 26cefab72..cdb223d87 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -121,42 +121,23 @@ ivas_error ivas_cpe_dec_fx( *----------------------------------------------------------------*/ #if 1 // Float to fix conversions - float maxim = 0; - Word16 q_old_out = 31, q_old_out_LB = 31; + Word16 q_old_out_LB = 31; //q_output_mem = 11; - maxim = 0; //q_buff_LBTCX_mem = 11; //q_input_mem_LB = q_buff_LBTCX_mem; - maxim = 0; - q_old_out = Q11; FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) { IF( hCPE->hCoreCoder[ind1] && hCPE->hCoreCoder[ind1]->hHQ_core ) - FOR( Word16 ind2 = 0; ind2 < 960; ind2++ ) { - hCPE->hCoreCoder[ind1]->hHQ_core->oldOut_fx[ind2] = (Word32) ( hCPE->hCoreCoder[ind1]->hHQ_core->old_out[ind2] * ( 1 << q_old_out ) ); + Copy_Scale_sig_16_32( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ind1]->hHQ_core->oldOut_fx, L_FRAME48k, Q11 - hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda ); } } - maxim = 0; - FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) - { - IF( hCPE->hCoreCoder[ind1]->hHQ_core ) - FOR( Word16 ind2 = 0; ind2 < L_FRAME32k; ind2++ ) - { - maxim = fmaxf( fabsf( hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB[ind2] ), maxim ); - } - } - IF( maxim > 1.f ) - q_old_out_LB = norm_l( (Word32) maxim ); - q_old_out_LB -= 1; + q_old_out_LB = Q11; FOR( Word16 ind1 = 0; ind1 < 1; ind1++ ) { IF( hCPE->hCoreCoder[ind1]->hHQ_core ) { - FOR( Word16 ind2 = 0; ind2 < L_FRAME32k; ind2++ ) - { - hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB_fx[ind2] = (Word32) ( hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB[ind2] * ( 1 << q_old_out_LB ) ); - } + Copy_Scale_sig_16_32( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB ); hCPE->hCoreCoder[ind1]->hHQ_core->q_old_outLB_fx = q_old_out_LB; } } @@ -176,17 +157,15 @@ ivas_error ivas_cpe_dec_fx( FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) { IF( hCPE->hCoreCoder[ind1] && hCPE->hCoreCoder[ind1]->hHQ_core ) - FOR( Word16 ind2 = 0; ind2 < 960; ind2++ ) { - hCPE->hCoreCoder[ind1]->hHQ_core->old_out[ind2] = (float) ( hCPE->hCoreCoder[ind1]->hHQ_core->oldOut_fx[ind2] ) / ( 1 << q_old_out ); + Copy_Scale_sig_32_16( hCPE->hCoreCoder[ind1]->hHQ_core->oldOut_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda - Q11 ); } } FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) { IF( hCPE->hCoreCoder[ind1] && hCPE->hCoreCoder[ind1]->hHQ_core ) - FOR( Word16 ind2 = 0; ind2 < L_FRAME32k; ind2++ ) { - hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB[ind2] = (float) ( hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB_fx[ind2] ) / ( 1 << q_old_out_LB ); + Copy_Scale_sig_32_16( hCPE->hCoreCoder[ind1]->hHQ_core->old_outLB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, L_FRAME32k, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB - Q11 ); } } #endif @@ -541,31 +520,10 @@ ivas_error ivas_cpe_dec_fx( test(); IF( NE_16( hCPE->element_mode, IVAS_CPE_DFT ) || ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) ) { -#ifndef TO_BE_REMOVED_CONVERSION - Word16 k; - for ( k = 0; k < n_channels; k++ ) - { - if ( sts[k]->hHQ_core != NULL ) - { - floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); - floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); - } - } -#endif IF( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { return error; } - - for ( k = 0; k < n_channels; k++ ) - { - if ( sts[k]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); - fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - } - } } IF( st_ivas->hMCT ) @@ -586,35 +544,12 @@ ivas_error ivas_cpe_dec_fx( set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX ); set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX ); -#ifndef TO_BE_REMOVED_CONVERSION - Word16 k; - for ( k = 0; k < n_channels; k++ ) - { - if ( sts[k]->hHQ_core != NULL ) - { - floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); - floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); - } - } - -#endif - /* core decoder */ IF( ( error = ivas_core_dec( NULL, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, DFT_fx, 0 ) ) != IVAS_ERR_OK ) { return error; } - for ( k = 0; k < n_channels; k++ ) - { - if ( sts[k]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); - fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - } - } - // Scaling of DFT's Word16 shift; Word32 tmp1, tmp2; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 5ec1d414c..d78695d1e 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3543,33 +3543,28 @@ void ivas_dirac_dec_render_sf_fx( #ifdef MSAN_FIX Word32 *output_buf_fx[], /* i/o: synthesized core-coder transport channels/DirAC output */ #endif // MSAN_FIX - const int16_t nchan_transport, /* i : number of transport channels */ - float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) + const Word16 nchan_transport, /* i : number of transport channels */ + Word32 *pppQMfFrame_ts_re_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], + Word32 *pppQMfFrame_ts_im_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) { - int16_t i, ch, idx_in, idx_lfe; + Word16 i, ch, idx_in, idx_lfe; DIRAC_DEC_HANDLE hDirAC; DIRAC_REND_HANDLE hDirACRend; - int16_t subframe_idx; - int16_t slot_idx, index_slot; - int16_t hodirac_flag; -#ifndef IVAS_FLOAT_FIXED - float *p_Rmat; -#endif - int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; + Word16 subframe_idx; + Word16 slot_idx, index_slot; + Word16 hodirac_flag; + Word16 slot_idx_start, slot_idx_start_cldfb_synth, md_idx; /*CLDFB: last output channels reserved to LFT for CICPx*/ Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - int16_t index = 0, num_freq_bands = 0; + Word16 index = 0, num_freq_bands = 0; /* local copies of azi, ele, diffuseness */ Word16 azimuth[CLDFB_NO_CHANNELS_MAX]; Word16 elevation[CLDFB_NO_CHANNELS_MAX]; - float diffuseness_vector[CLDFB_NO_CHANNELS_MAX]; -#ifdef IVAS_FLOAT_FIXED Word32 diffuseness_vector_fx[CLDFB_NO_CHANNELS_MAX]; Word32 *p_Rmat_fx; Word32 *reference_power_fx, *reference_power_smooth_fx, *onset_filter_fx, *onset_filter_subframe_fx; @@ -3580,32 +3575,23 @@ void ivas_dirac_dec_render_sf_fx( Word32 Cldfb_RealBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; Word16 cldfb_buf_q; - Word16 offset; - Word32 pppQMfFrame_ts_re_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - Word32 pppQMfFrame_ts_im_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - set_zero_fx( surCohRatio_fx, CLDFB_NO_CHANNELS_MAX ); + Word16 offset, buff_len; Word16 q_cldfb, q_temp_cldfb = 0; Word16 proto_length = 0; - Word32 proto_diffuse_buffer_f_fx[2 * MAX_OUTPUT_CHANNELS * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX]; - set_zero_fx( &proto_diffuse_buffer_f_fx[0], 2 * CLDFB_SLOTS_PER_SUBFRAME * CLDFB_NO_CHANNELS_MAX * MAX_OUTPUT_CHANNELS ); Word16 q_proto_direct_buffer[CLDFB_SLOTS_PER_SUBFRAME]; Word16 q_proto_diffuse_buffer[CLDFB_SLOTS_PER_SUBFRAME]; -#endif + Word16 size, size_ho; DIRAC_DEC_STACK_MEM DirAC_mem; - float *reference_power, *reference_power_smooth; - float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; -#ifdef IVAS_FLOAT_FIXED Word32 *p_onset_filter_fx = NULL; -#endif uint16_t coherence_flag; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - Word16 q_onset_filter = 0; Word16 scale = 0; DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; Word16 num_channels_dir, exp; Word16 q_diffuseness_vector = Q31, q_reference_power_smooth = Q31; + Word16 proto_power_smooth_len = 0; push_wmops( "ivas_dirac_dec_render" ); @@ -3616,10 +3602,6 @@ void ivas_dirac_dec_render_sf_fx( DirAC_mem = hDirACRend->stack_mem; - reference_power = DirAC_mem.reference_power; - reference_power_smooth = ( DirAC_mem.reference_power == NULL ) ? NULL : DirAC_mem.reference_power + hSpatParamRendCom->num_freq_bands; - onset_filter = DirAC_mem.onset_filter; - onset_filter_subframe = ( DirAC_mem.onset_filter == NULL ) ? NULL : DirAC_mem.onset_filter + hSpatParamRendCom->num_freq_bands; reference_power_fx = DirAC_mem.reference_power_fx; reference_power_smooth_fx = ( DirAC_mem.reference_power_fx == NULL ) ? NULL : DirAC_mem.reference_power_fx + hSpatParamRendCom->num_freq_bands; onset_filter_fx = DirAC_mem.onset_filter_fx; @@ -3628,33 +3610,18 @@ void ivas_dirac_dec_render_sf_fx( move16(); set_s( q_proto_direct_buffer, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); set_s( q_proto_diffuse_buffer, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); - + set_zero_fx( surCohRatio_fx, CLDFB_NO_CHANNELS_MAX ); //////////////////////////////////////////////////////////////////////////// to be removed /////////////////////////////////////////////////////////////////// IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) { - mvr2r( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], diffuseness_vector, hSpatParamRendCom->num_freq_bands ); - // Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL32( diffuseness_vector, hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], Q30, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL32( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], Q30, hSpatParamRendCom->num_freq_bands ); md_idx = hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]; } ELSE { - set_zero( diffuseness_vector, hSpatParamRendCom->num_freq_bands ); md_idx = hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->slots_rendered]; } - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - set_zero( reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - } - ELSE - { - set_zero( onset_filter_subframe, hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED - set_zero_fx( onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands ); -#endif - } - IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) { p_Rmat_fx = &st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; @@ -3683,11 +3650,7 @@ void ivas_dirac_dec_render_sf_fx( { IF( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - floatToFixed_arrL32( pppQMfFrame_ts_re[ch][slot_idx], pppQMfFrame_ts_re_fx[ch][slot_idx], Q6, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL32( pppQMfFrame_ts_im[ch][slot_idx], pppQMfFrame_ts_im_fx[ch][slot_idx], Q6, hSpatParamRendCom->num_freq_bands ); - } + } ELSE { @@ -3751,6 +3714,7 @@ void ivas_dirac_dec_render_sf_fx( { hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db, Q21 ); } + hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed(hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y); } } BREAK; @@ -3824,6 +3788,130 @@ void ivas_dirac_dec_render_sf_fx( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q_factor_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); + floatToFixed_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); + } + } + else if ( !L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) + { + idx_lfe = 0; + idx_in = 0; + Word16 outchannels = add( hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe ); + + IF( hDirACRend->hOutSetup.separateChannelEnabled && ( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_7_1 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || + ( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + { + outchannels = add( outchannels, 1 ); + } + + IF( ( hDirACRend->hOutSetup.separateChannelEnabled && EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ) + { + FOR( ch = 0; ch < outchannels; ch++ ) + { + IF( L_and( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ), ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) ) + { + IF( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) + { + idx_lfe = add( idx_lfe, 1 ); + } + } + } + } + ELSE + { + FOR( ch = 0; ch < outchannels; ch++ ) + { + IF( L_and( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ), ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) ) + { + IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && !hDirACRend->hOutSetup.separateChannelEnabled ) + { + Word16 cldfbSynIdx = add( hDirACRend->hOutSetup.nchan_out_woLFE, idx_lfe ); + st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = Q_factor_arrL( st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length ); + floatToFixed_arrL( st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length ); + } + } + ELSE IF( ( hDirACRend->hOutSetup.separateChannelEnabled ) && EQ_16( hDirACRend->hOutSetup.separateChannelIndex, ch ) ) + { + } + ELSE + { + st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q_factor_arrL( st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length ); + floatToFixed_arrL( st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length ); + idx_in = add( idx_in, 1 ); + } + } + } + } + + /////////////////////////////////////////////////////////////////////////////////////////////// + size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; + size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; + hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = Q26; + hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = Q26; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = Q26; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = Q26; + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); + + hDirACRend->diffuse_response_function_q = Q15; + floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, hDirACRend->diffuse_response_function_q, hDirACRend->num_outputs_dir ); + } + ELSE + { + IF( st_ivas->hMasa != NULL ) + { + st_ivas->hMasa->data.dir_decode_quality_fx = float_to_fix16( st_ivas->hMasa->data.dir_decode_quality, Q15 ); + } + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + IF( hDirACRend->masa_stereo_type_detect != NULL ) + { + hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->target_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->target_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->q_subtract_power_y = L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y ); + hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = L_get_q_buf( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, hSpatParamRendCom->num_freq_bands ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + { + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + } + } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// hodirac_flag = ivas_get_hodirac_flag_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); @@ -3861,12 +3949,16 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) { Copy32( hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[subframe_idx]], diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands ); + q_diffuseness_vector = Q30; + move16(); Copy( hSpatParamRendCom->azimuth[hSpatParamRendCom->render_to_md_map[subframe_idx]], azimuth, hSpatParamRendCom->num_freq_bands ); Copy( hSpatParamRendCom->elevation[hSpatParamRendCom->render_to_md_map[subframe_idx]], elevation, hSpatParamRendCom->num_freq_bands ); } ELSE { set32_fx( diffuseness_vector_fx, 0, hSpatParamRendCom->num_freq_bands ); + q_diffuseness_vector = Q31; + move16(); } IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) @@ -4117,7 +4209,7 @@ void ivas_dirac_dec_render_sf_fx( protoSignalComputation_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - proto_diffuse_buffer_f_fx, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, reference_power_fx, &DirAC_mem.reference_power_q, slot_idx, nchan_transport, @@ -4130,7 +4222,7 @@ void ivas_dirac_dec_render_sf_fx( protoSignalComputation_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - proto_diffuse_buffer_f_fx, + hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, reference_power_fx, &DirAC_mem.reference_power_q, slot_idx, nchan_transport, @@ -4161,6 +4253,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); proto_length = i_mult( 6, hSpatParamRendCom->num_freq_bands ); + proto_power_smooth_len = i_mult( 2, hSpatParamRendCom->num_freq_bands ); } ELSE { @@ -4185,6 +4278,7 @@ void ivas_dirac_dec_render_sf_fx( nchan_transport, hDirACRend->sba_map_tc, q_cldfb ); proto_length = i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + proto_power_smooth_len = i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ); BREAK; case 2: protoSignalComputation2_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hDirACRend->proto_frame_f_fx, @@ -4201,6 +4295,14 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->masa_stereo_type_detect, q_cldfb ); proto_length = i_mult( 6, hSpatParamRendCom->num_freq_bands ); + IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) + { + proto_power_smooth_len = i_mult( 3, hSpatParamRendCom->num_freq_bands ); + } + ELSE + { + proto_power_smooth_len = i_mult( 2, hSpatParamRendCom->num_freq_bands ); + } BREAK; case 1: protoSignalComputation1_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, @@ -4216,6 +4318,8 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->num_protos_diff, hSpatParamRendCom->num_freq_bands, q_cldfb ); proto_length = i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ); + proto_power_smooth_len = hSpatParamRendCom->num_freq_bands; + move16(); BREAK; default: return; @@ -4286,21 +4390,21 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->num_protos_diff, hDirACRend->synthesisConf, nchan_transport, - &proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff], + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->num_protos_diff, hDirACRend->proto_index_diff, - &proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport )], + &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx[slot_idx * 2 * hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff + 2 * hSpatParamRendCom->num_freq_bands * min( 4, nchan_transport )], &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, onset_filter_fx, hDirACRend->h_freq_domain_decorr_ap_params, hDirACRend->h_freq_domain_decorr_ap_state ); - q_onset_filter = Q31; + DirAC_mem.q_onset_filter = Q31; move16(); v_multc_fixed( onset_filter_fx, 268435456, onset_filter_fx, hSpatParamRendCom->num_freq_bands ); // 268435456 = 0.25 in Q30 - q_onset_filter = sub( add( q_onset_filter, Q30 ), Q31 ); + DirAC_mem.q_onset_filter = sub( add( DirAC_mem.q_onset_filter, Q30 ), Q31 ); v_add_fixed( onset_filter_fx, onset_filter_subframe_fx, onset_filter_subframe_fx, hSpatParamRendCom->num_freq_bands, 0 ); // Q30 p_onset_filter_fx = onset_filter_subframe_fx; @@ -4332,8 +4436,8 @@ void ivas_dirac_dec_render_sf_fx( move16(); p_onset_filter_fx = onset_filter_fx; - scale_sig32( onset_filter_fx, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff, -1 ); - q_onset_filter = Q30; + scale_sig32( onset_filter_fx, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ), -1 ); + DirAC_mem.q_onset_filter = Q30; move16(); } } @@ -4342,7 +4446,7 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { set_l( onset_filter_subframe_fx, ONE_IN_Q30, hSpatParamRendCom->num_freq_bands ); - q_onset_filter = Q30; + DirAC_mem.q_onset_filter = Q30; move16(); p_onset_filter_fx = onset_filter_subframe_fx; } @@ -4522,18 +4626,28 @@ void ivas_dirac_dec_render_sf_fx( } } -#ifdef IVAS_FLOAT_FIXED - ////////////////////////////////// to be removed ///////////////////////////////////// + minimum_s( q_proto_direct_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q ); + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + minimum_s( q_proto_diffuse_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q ); + } FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ), q_proto_direct_buffer[slot_idx], 2 * nchan_transport * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( &proto_diffuse_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), q_proto_diffuse_buffer[slot_idx], 2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); + offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ); + buff_len = i_mult( 2, i_mult( nchan_transport, hSpatParamRendCom->num_freq_bands ) ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); + + offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + buff_len = 2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands; + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, q_proto_diffuse_buffer[slot_idx] ) ); } ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ), q_proto_direct_buffer[slot_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); + offset = i_mult( slot_idx, i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); + buff_len = i_mult( 4, hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); } ELSE { @@ -4544,304 +4658,93 @@ void ivas_dirac_dec_render_sf_fx( case 6: case 4: offset = i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[offset], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f[offset], q_proto_direct_buffer[slot_idx], i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); + buff_len = i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); BREAK; case 2: IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 3 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 3 ), q_proto_direct_buffer[slot_idx], i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + offset = i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 3 ); + buff_len = i_mult( 6, hSpatParamRendCom->num_freq_bands ); } ELSE { - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ), q_proto_direct_buffer[slot_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ); + offset = i_mult( i_mult( i_mult( slot_idx, 2 ), hSpatParamRendCom->num_freq_bands ), 2 ); + buff_len = i_mult( 4, hSpatParamRendCom->num_freq_bands ); } + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); BREAK; case 1: - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ), q_proto_direct_buffer[slot_idx], i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + offset = i_mult( slot_idx, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + buff_len = i_mult( 2, hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + offset, buff_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, q_proto_direct_buffer[slot_idx] ) ); BREAK; } } + q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; } - IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) - { - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); - } - ELSE - { - me2f_buf( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hSpatParamRendCom->num_freq_bands ); - me2f_buf( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hSpatParamRendCom->num_freq_bands ); - } - } - IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - IF( hodirac_flag ) - { - fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } + ivas_dirac_dec_output_synthesis_get_interpolator_fx( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + + size = i_mult( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ); + IF( hodirac_flag ) + { + size_ho = i_mult( size, DIRAC_HO_NUMSECTORS ); } ELSE { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - } + size_ho = size; + move16(); } - IF( !( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) ) + + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - FOR( ch = 0; ch < nchan_transport; ch++ ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, Q26 ) ) { - fixedToFloat_arrL32( st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, st_ivas->cldfbAnaDec[ch]->cldfb_state, Q11, ( st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels ) ); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, size_ho, sub( Q26, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth ) ); + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = Q26; } - } - IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - IF( nchan_transport >= 4 ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, Q26 ) ) { - fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, 5 * hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, size_ho, sub( Q26, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev ) ); } - } - ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - IF( hDirACRend->masa_stereo_type_detect ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, Q31 ) ) { - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, ( size_ho / hDirACRend->num_outputs_dir ), sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ) ); } - } - ELSE - { - SWITCH( nchan_transport ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.direct_responses_q, Q31 ) ) { - case 11: - case 8: - case 6: - case 4: - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); - me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); - fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - BREAK; - case 2: - IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); - } - ELSE - { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); - IF( hDirACRend->masa_stereo_type_detect ) - { - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } - } - me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); - fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - BREAK; - case 1: - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); - me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ) ); - fixedToFloat_arrL32( reference_power_fx, reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); - BREAK; + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, size_ho, sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_responses_q ) ); } - } - - IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) - { - FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, Q31 ) ) { - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[0][i], hDirACRend->buffer_intensity_real[0][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[1][i], hDirACRend->buffer_intensity_real[1][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[2][i], hDirACRend->buffer_intensity_real[2][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( &hDirACRend->buffer_energy_fx[i * num_freq_bands], &hDirACRend->buffer_energy[i * num_freq_bands], hDirACRend->q_buffer_energy[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr, sub( Q31, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ) ); } - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + IF( NE_16( hDirACRend->diffuse_response_function_q, Q15 ) ) { - md_idx = hSpatParamRendCom->render_to_md_map[add( hSpatParamRendCom->slots_rendered, slot_idx )]; - fixedToFloat_arrL32( hSpatParamRendCom->diffuseness_vector_fx[md_idx], hSpatParamRendCom->diffuseness_vector[md_idx], Q30, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + Scale_sig( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, sub( Q15, hDirACRend->diffuse_response_function_q ) ); } - } - - IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) - { - IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, Q26 ) ) { - fixedToFloat_arrL( onset_filter_fx, onset_filter, q_onset_filter, hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( onset_filter_subframe_fx, onset_filter_subframe, q_onset_filter, hSpatParamRendCom->num_freq_bands ); - p_onset_filter = onset_filter_subframe; + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, i_mult( hDirACRend->num_outputs_diff, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ), sub( Q26, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth ) ); } - ELSE + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, Q26 ) ) { - fixedToFloat_arrL( onset_filter_fx, onset_filter, q_onset_filter, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); - me2f_buf( DirAC_mem.frame_dec_f_fx, 31 - DirAC_mem.frame_dec_f_q, DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_len ); - - hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; - p_onset_filter = onset_filter; + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, i_mult( hDirACRend->num_outputs_diff, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ), sub( Q26, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev ) ); } - } - ELSE - { - IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + IF( NE_16( q_diffuseness_vector, Q30 ) ) { - fixedToFloat_arrL( onset_filter_fx, onset_filter, q_onset_filter, hSpatParamRendCom->num_freq_bands ); - p_onset_filter = onset_filter_subframe; + scale_sig32( diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands, sub( Q30, q_diffuseness_vector ) ); } - ELSE + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, Q26 ) ) { - hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; - p_onset_filter = NULL; + scale_sig32( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, size, sub( Q26, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q ) ); } - } - IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) - { - if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, Q26 ) ) { - DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state ); - me2f_buf( state->proto_power_diff_smooth_fx, - 31 - state->proto_power_diff_smooth_q, - state->proto_power_diff_smooth, - state->proto_power_diff_smooth_len ); - me2f_buf( state->proto_diffuse_buffer_f_fx, - 31 - state->proto_diffuse_buffer_f_q, - state->proto_diffuse_buffer_f, - state->proto_diffuse_buffer_f_len ); - } - } - - if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) - { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL( h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); - } - else - { - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); - } - } - } - else if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->diffuse_power_factor_q ); - } - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, (num_channels_dir) *hSpatParamRendCom->num_freq_bands ); - } - else - { - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); - } + scale_sig32( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, i_mult( hDirACRend->num_outputs_diff, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ), sub( Q26, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q ) ); } - } - - if ( h_dirac_output_synthesis_params->use_onset_filters && ( hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); - } - - if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - } - - if ( hDirAC->hConfig->dec_param_estim ) - { - fixedToFloat_arrL32( diffuseness_vector_fx, diffuseness_vector, q_diffuseness_vector, hSpatParamRendCom->num_freq_bands ); - } - - if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - fixedToFloat_arrL32( reference_power_smooth_fx, reference_power_smooth, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - } - ////////////////////////////////////////////////////////////////////////////////////// -#endif - -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_dec_output_synthesis_get_interpolator_fx( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); - fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -#else - ivas_dirac_dec_output_synthesis_get_interpolator( &hDirACRend->h_output_synthesis_psd_params, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); -#endif - - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { -#ifdef IVAS_FLOAT_FIXED - Word16 size, size_ho; - size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; - size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; - - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); - - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, ( hodirac_flag ) ? hSpatParamRendCom->num_freq_bands * DIRAC_HO_NUMSECTORS : hSpatParamRendCom->num_freq_bands ); - hDirACRend->h_output_synthesis_psd_state.direct_responses_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, size_ho ); - - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - - hDirACRend->diffuse_response_function_q = Q15; - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, hDirACRend->diffuse_response_function_q, hDirACRend->num_outputs_dir ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - floatToFixed_arrL( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f[i_mult( i_mult( slot_idx, 2 ), - i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) )], - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + - i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ), - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - 2 * nchan_transport * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f[i_mult( i_mult( slot_idx, 2 ), - i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + - i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - 2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); - } - - floatToFixed_arrL( p_onset_filter, p_onset_filter_fx, Q30, hSpatParamRendCom->num_freq_bands ); // Q30 - floatToFixed_arrL( diffuseness_vector, diffuseness_vector_fx, Q30, hSpatParamRendCom->num_freq_bands ); // Q30 - hDirACRend->h_output_synthesis_psd_params.diffuse_compensation_factor_fx = floatToFixed( hDirACRend->h_output_synthesis_psd_params.diffuse_compensation_factor, Q27 ); // Q27 - - hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); - - hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); -#endif - -#ifdef IVAS_FLOAT_FIXED ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hSpatParamRendCom, @@ -4854,29 +4757,6 @@ void ivas_dirac_dec_render_sf_fx( hDirAC->hConfig->dec_param_estim, &hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, &hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev ); -#else - ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hSpatParamRendCom, - hDirACRend, - nchan_transport, - hSpatParamRendCom->subframe_nbslots[subframe_idx], - p_onset_filter, - diffuseness_vector, - hodirac_flag, - hDirAC->hConfig->dec_param_estim ); -#endif - -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - - hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev; - hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev; - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); IF( hDirACRend->hOutSetup.is_loudspeaker_setup && hDirACRend->hoa_decoder != NULL ) { @@ -4900,24 +4780,17 @@ void ivas_dirac_dec_render_sf_fx( } } } -#endif } - else + ELSE { -#ifdef IVAS_FLOAT_FIXED - Word16 size, size_ho, q_Cldfb; - size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; - size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; -#endif /* Determine encoding quality based additional smoothing factor */ -#ifdef IVAS_FLOAT_FIXED Word32 qualityBasedSmFactor_fx = ONE_IN_Q31; move32(); + Word16 q_Cldfb = 0; + move16(); IF( st_ivas->hMasa != NULL ) { - st_ivas->hMasa->data.dir_decode_quality_fx = float_to_fix16( st_ivas->hMasa->data.dir_decode_quality, Q15 ); - IF( EQ_16( st_ivas->hMasa->data.dir_decode_quality_fx, MAX_16 ) ) { qualityBasedSmFactor_fx = MAX_32; @@ -4927,116 +4800,115 @@ void ivas_dirac_dec_render_sf_fx( qualityBasedSmFactor_fx = L_mult( st_ivas->hMasa->data.dir_decode_quality_fx, st_ivas->hMasa->data.dir_decode_quality_fx ); // (Q15, Q15) -> Q31 } } -#else - float qualityBasedSmFactor = 1.0f; - if ( st_ivas->hMasa != NULL ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, Q31 ) ) { - qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; - qualityBasedSmFactor *= qualityBasedSmFactor; + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ) ); + } + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.direct_responses_q, Q31 ) ) + { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, size, sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_responses_q ) ); + } + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, Q31 ) ) + { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hSpatParamRendCom->num_freq_bands, sub( Q31, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ) ); + } + IF( NE_16( q_diffuseness_vector, Q31 ) ) + { + Scale_sig32( diffuseness_vector_fx, hSpatParamRendCom->num_freq_bands, sub( Q31, q_diffuseness_vector ) ); + } + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, Q31 ) ) + { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, i_mult( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ), sub( Q31, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q ) ); + } + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q, Q31 ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_fx, hDirACRend->num_outputs_dir, sub( Q31, hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q ) ); } -#endif - -#ifdef IVAS_FLOAT_FIXED - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); - - hDirACRend->h_output_synthesis_psd_state.direct_responses_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); - - hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); - - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); - - hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q = Q31; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square, hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_responses_square_q, hDirACRend->num_outputs_dir ); - - floatToFixed_arrL( diffuseness_vector, diffuseness_vector_fx, Q31, hSpatParamRendCom->num_freq_bands ); // Q31 - - q_reference_power_smooth = L_get_q_buf( reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - q_reference_power_smooth = s_min( q_reference_power_smooth, L_get_q_buf( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hSpatParamRendCom->num_freq_bands ) ); - floatToFixed_arrL( reference_power_smooth, reference_power_smooth_fx, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, size_ho ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size_ho ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, size_ho ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho ); - - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, size_ho ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + exp = L_norm_arr( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands ); + scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, exp ); + q_reference_power_smooth = add( q_reference_power_smooth, exp ); + IF( LT_16( q_reference_power_smooth, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hSpatParamRendCom->num_freq_bands, sub( q_reference_power_smooth, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q ) ); + hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q = q_reference_power_smooth; + move16(); + } + ELSE + { + scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, q_reference_power_smooth ) ); + q_reference_power_smooth = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q; + move16(); + } IF( hDirACRend->masa_stereo_type_detect != NULL ) { - hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->target_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->target_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); - - hDirACRend->masa_stereo_type_detect->q_subtract_power_y = s_min( L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y ), - L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth ) ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + IF( LT_16( hDirACRend->masa_stereo_type_detect->q_subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth ) ) + { + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = L_shr( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, sub( hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ) ); + hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth = hDirACRend->masa_stereo_type_detect->q_subtract_power_y; + move16(); + } + ELSE + { + hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = L_shr( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, sub( hDirACRend->masa_stereo_type_detect->q_subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth ) ); + hDirACRend->masa_stereo_type_detect->q_subtract_power_y = hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth; + move16(); + } } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, - L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ) ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + exp = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, proto_power_smooth_len ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, proto_power_smooth_len, exp ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, exp ); - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) ) { - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = s_min( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, - L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ) ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, i_mult( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q ) ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q; + move16(); } - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + ELSE { - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, i_mult( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q ) ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q; + move16(); } - hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = Q26; - hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + exp = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ), exp ); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, exp ); + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != 0 ) + { + IF( LT_16( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q ) ); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q; + move16(); + } + ELSE + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ), sub( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q ) ); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q; + move16(); + } + } - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, Q26 ) ) + { + scale_sig32( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, size, sub( Q26, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q ) ); + } + IF( NE_16( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, Q26 ) ) { - floatToFixed_arrL( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f[i_mult( i_mult( slot_idx, 2 ), - i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ) )], - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx + - i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_dir ) ), - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, - 2 * hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->hOutSetup.nchan_out_woLFE ), sub( Q26, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q ) ); } IF( hDirACRend->proto_signal_decorr_on ) { + Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, sub( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q ) ); hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - floatToFixed_arrL( &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f[i_mult( i_mult( slot_idx, 2 ), - i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) )], - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx + - i_mult( i_mult( slot_idx, 2 ), i_mult( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, hDirACRend->hOutSetup.nchan_out_woLFE ) ), - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, - 2 * hDirACRend->hOutSetup.nchan_out_woLFE * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - } + move16(); } -#endif - -#ifdef IVAS_FLOAT_FIXED + ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hSpatParamRendCom, @@ -5048,47 +4920,6 @@ void ivas_dirac_dec_render_sf_fx( qualityBasedSmFactor_fx, hDirAC->hConfig->enc_param_start_band, &q_Cldfb ); -#else - ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hSpatParamRendCom, - hDirACRend, - hSpatParamRendCom->subframe_nbslots[subframe_idx], - diffuseness_vector, - reference_power_smooth, - qualityBasedSmFactor, - hDirAC->hConfig->enc_param_start_band ); -#endif - -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); - - IF( hDirACRend->masa_stereo_type_detect != NULL ) - { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx, Q21 ); - - hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } - - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); - } FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { @@ -5098,7 +4929,6 @@ void ivas_dirac_dec_render_sf_fx( scale_sig32( Cldfb_ImagBuffer_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands, sub( Q6, q_Cldfb ) ); } } -#endif } /*-----------------------------------------------------------------* @@ -5106,58 +4936,15 @@ void ivas_dirac_dec_render_sf_fx( *-----------------------------------------------------------------*/ index_slot = slot_idx_start_cldfb_synth; + move16(); -#ifdef IVAS_FLOAT_FIXED - //////////////////////////////////////////////// FLOAT TO FIXED ///////////////////////////////////////////// -#ifndef MSAN_FIX - Word32 output_buf_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; -#endif // MSAN_FIX - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + IF( L_or( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ), EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { - // Float to fixed -#ifndef MSAN_FIX - for (i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) - { - floatToFixed_arrL(output_f[i], output_buf_fx[i], Q11, L_FRAME48k); - } -#endif - } - else if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - { - /* output_f not being used here. */ - } - else - { - Word16 outchannels = add(hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe); - - IF(hDirACRend->hOutSetup.separateChannelEnabled && (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || - (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found))) - { - outchannels = add(outchannels, 1); - } - -#ifndef MSAN_FIX - for (i = 0; i < outchannels; i++) - { - floatToFixed_arrL(output_f[i], output_buf_fx[i], Q11, L_FRAME48k); - } -#endif - } - ////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#endif - -#ifdef IVAS_FLOAT_FIXED - IF( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - /* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */ - IF ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + /* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */ + IF( L_and( L_and( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ), EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ), EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { Word16 in_ch; - FOR ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) + FOR( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) { Word16 j, k, j2, l; Word16 num_objects, nchan_out_woLFE, lfe_index; @@ -5187,7 +4974,7 @@ void ivas_dirac_dec_render_sf_fx( FOR( i = 0; i < num_objects; i++ ) { /* Combined rotation: rotate the object positions depending the head and external orientations */ - IF( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) + IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) ) { Word16 az_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, Q22 ) ); Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) ); @@ -5208,19 +4995,31 @@ void ivas_dirac_dec_render_sf_fx( move16(); for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ ) { - IF( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( EQ_16( st_ivas->hIntSetup.index_lfe[lfe_index], j ) ) ) + IF( L_and( GT_16( st_ivas->hIntSetup.num_lfe, 0 ), ( EQ_16( st_ivas->hIntSetup.index_lfe[lfe_index], j ) ) ) ) { - ( lfe_index < ( st_ivas->hIntSetup.num_lfe - 1 ) ) ? ( lfe_index++, j2++ ) : j2++; + IF( LT_16( lfe_index, sub( st_ivas->hIntSetup.num_lfe, 1 ) ) ) + { + lfe_index++; + j2++; + } + ELSE + { + j2++; + } } gain_fx = st_ivas->hIsmRendererData->gains_fx[i][j]; + move32(); prev_gain_fx = st_ivas->hIsmRendererData->prev_gains_fx[i][j]; - IF( L_abs( gain_fx ) > 0 || L_abs( prev_gain_fx ) > 0 ) + move32(); + IF( L_or( GT_32( L_abs( gain_fx ), 0 ), GT_32( L_abs( prev_gain_fx ), 0 ) ) ) { Word32 *tc_re_fx, *tc_im_fx; Word16 *w1_fx, w2_fx; w1_fx = &st_ivas->hIsmRendererData->interpolator_fx[interp_offset]; - tc_re_fx = pppQMfFrame_ts_re_fx[nchan_transport + i][0]; - tc_im_fx = pppQMfFrame_ts_im_fx[nchan_transport + i][0]; + tc_re_fx = pppQMfFrame_ts_re_fx[add( nchan_transport, i )][0]; + move32(); + tc_im_fx = pppQMfFrame_ts_im_fx[add( nchan_transport, i )][0]; + move32(); FOR( k = 0; k < n_slots_to_render; k++ ) { Word32 g_fx; @@ -5230,10 +5029,10 @@ void ivas_dirac_dec_render_sf_fx( { Word32 tmp; tmp = Mpy_32_32( g_fx, *tc_re_fx ); - Cldfb_RealBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l] = L_add( Cldfb_RealBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l], tmp ); + Cldfb_RealBuffer_fx[j2][0][add( i_mult( k, hSpatParamRendCom->num_freq_bands ), l )] = L_add( Cldfb_RealBuffer_fx[j2][0][add( i_mult( k, hSpatParamRendCom->num_freq_bands ), l )], tmp ); tc_re_fx++; tmp = Mpy_32_32( g_fx, *tc_im_fx ); - Cldfb_ImagBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l] = L_add( Cldfb_ImagBuffer_fx[j2][0][k * hSpatParamRendCom->num_freq_bands + l], tmp ); + Cldfb_ImagBuffer_fx[j2][0][add( i_mult( k, hSpatParamRendCom->num_freq_bands ), l )] = L_add( Cldfb_ImagBuffer_fx[j2][0][add( i_mult( k, hSpatParamRendCom->num_freq_bands ), l )], tmp ); tc_re_fx++; } w1_fx += hSpatParamRendCom->num_freq_bands; @@ -5243,6 +5042,7 @@ void ivas_dirac_dec_render_sf_fx( IF( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) { st_ivas->hIsmRendererData->prev_gains_fx[i][j] = gain_fx; + move32(); } } } @@ -5251,6 +5051,7 @@ void ivas_dirac_dec_render_sf_fx( /* Perform binaural rendering */ Word16 input_q = Q6; + move16(); IF( st_ivas->hCombinedOrientationData != NULL ) { @@ -5274,59 +5075,50 @@ void ivas_dirac_dec_render_sf_fx( } } - FOR ( Word16 idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++ ) - { - FOR ( Word16 idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++ ) - { - Scale_sig32(Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); - Scale_sig32(Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, Q6 - input_q ); - } - } + Scale_sig32( Cldfb_RealBuffer_Binaural_fx[0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); + Scale_sig32( Cldfb_ImagBuffer_Binaural_fx[0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); /* Inverse CLDFB*/ - FOR ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#if 1 // TODOD: remove float to fixed - st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q_factor_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); - floatToFixed_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); -#endif - Word32 *synth_fx = &output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands]; - + Word32 *synth_fx = &output_buf_fx[ch][i_mult( index_slot, hSpatParamRendCom->num_freq_bands )]; Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; - FOR ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer_fx[i] = Cldfb_RealBuffer_Binaural_fx[ch][i]; + move32(); ImagBuffer_fx[i] = Cldfb_ImagBuffer_Binaural_fx[ch][i]; + move32(); } - scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( Q6 - 1, st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); - st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q6 - 1; + scale_sig32( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub( sub( Q6, 1 ), st_ivas->cldfbSynDec[ch]->Q_cldfb_state ) ); + st_ivas->cldfbSynDec[ch]->Q_cldfb_state = sub( Q6, 1 ); move16(); - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, synth_fx, i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), st_ivas->cldfbSynDec[ch] ); - Word16 no_col = st_ivas->cldfbSynDec[ch]->no_col, no_channels = st_ivas->cldfbSynDec[ch]->no_channels; - Word16 samplesToProcess = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; + Word16 no_col = st_ivas->cldfbSynDec[ch]->no_col; + move16(); + Word16 no_channels = st_ivas->cldfbSynDec[ch]->no_channels; + move16(); + Word16 samplesToProcess = i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + move16(); IF( GT_16( samplesToProcess, -1 ) ) { - no_col = s_min( no_col, ( samplesToProcess + st_ivas->cldfbSynDec[ch]->no_channels - 1 ) / st_ivas->cldfbSynDec[ch]->no_channels ); + no_col = s_min( no_col, ( add( samplesToProcess, sub( st_ivas->cldfbSynDec[ch]->no_channels, 1 ) ) ) / st_ivas->cldfbSynDec[ch]->no_channels ); } Word16 synth_len = imult1616( no_col, no_channels ); - scale_sig32( synth_fx, synth_len, Q11 - ( Q6 - 1 ) ); - -#if 1 // TODOD: remove Fixed to float - fixedToFloat_arrL( st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length ); -#endif + scale_sig32( synth_fx, synth_len, sub( Q11, sub( Q6, 1 ) ) ); } } - ELSE IF( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + ELSE IF( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) { - for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { - for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { Copy32( Cldfb_RealBuffer_fx[ch][slot_idx], pppQMfFrame_ts_re_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); // Q6 Copy32( Cldfb_ImagBuffer_fx[ch][slot_idx], pppQMfFrame_ts_im_fx[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); // Q6 @@ -5346,17 +5138,17 @@ void ivas_dirac_dec_render_sf_fx( outchannels = add( hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe ); - IF ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || - ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + IF( hDirACRend->hOutSetup.separateChannelEnabled && ( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_7_1 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || + ( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) { - outchannels = add(outchannels, 1); + outchannels = add( outchannels, 1 ); } - IF( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF( hDirACRend->hOutSetup.separateChannelEnabled && EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { Word32 tmp_separated_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; Word32 tmp_lfe_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -5368,7 +5160,7 @@ void ivas_dirac_dec_render_sf_fx( Copy32( &( output_buf_fx[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe_fx, num_samples_subframe ); FOR( ch = 0; ch < outchannels; ch++ ) { - IF( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) + IF( L_and( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ), ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) ) { /* Move the LFE channel to the correct place */ Copy32( tmp_lfe_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe ); @@ -5390,7 +5182,9 @@ void ivas_dirac_dec_render_sf_fx( FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer_fx[i] = Cldfb_RealBuffer_fx[idx_in][i]; + move32(); ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; + move32(); } cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_buf_fx[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); @@ -5407,58 +5201,55 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { - FOR ( ch = 0; ch < outchannels; ch++ ) + FOR( ch = 0; ch < outchannels; ch++ ) { - IF ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) + IF( L_and( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ), ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) ) { - IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && !hDirACRend->hOutSetup.separateChannelEnabled ) { - FOR(i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { - RealBuffer_fx[i] = Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; - ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; + RealBuffer_fx[i] = Cldfb_RealBuffer_fx[sub( MAX_OUTPUT_CHANNELS, 1 )][i]; + move32(); + ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[sub( MAX_OUTPUT_CHANNELS, 1 )][i]; + move32(); } - Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe; + Word16 cldfbSynIdx = add( hDirACRend->hOutSetup.nchan_out_woLFE, idx_lfe ); + Word16 samplesToProcess = i_mult( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + Word32 *p_out = &( output_buf_fx[ch][i_mult( index_slot, hSpatParamRendCom->num_freq_bands )] ); -#if 1 // TODO: remove float to fixed code - st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); - floatToFixed_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); -#endif - Word16 samplesToProcess = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; - Word32 *p_out = &(output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands]); + scale_sig32( st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length, sub( sub( Q6, 1 ), st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state ) ); + st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = sub( Q6, 1 ); - scale_sig32(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length, sub(Q6 - 1, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state)); - st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = Q6 - 1; - - cldfbSynthesis_ivas_fx(RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[cldfbSynIdx]); + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[cldfbSynIdx] ); // Calculating length of output - Word16 no_col = st_ivas->cldfbSynDec[cldfbSynIdx]->no_col, no_channels = st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels; - IF(GT_16(samplesToProcess, -1)) + Word16 no_col = st_ivas->cldfbSynDec[cldfbSynIdx]->no_col; + move16(); + Word16 no_channels = st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels; + move16(); + IF( GT_16( samplesToProcess, -1 ) ) { - no_col = s_min(no_col, (samplesToProcess + st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels - 1) / st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels); + no_col = s_min( no_col, ( add( samplesToProcess, sub( st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels, 1 ) ) ) / st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels ); } - Word16 synth_len = imult1616(no_col, no_channels); + Word16 synth_len = imult1616( no_col, no_channels ); - scale_sig32(p_out, synth_len, (Q11 - (Q6 - 1))); -#if 1 // TODO: remove fixed to float code - fixedToFloat_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); -#endif + scale_sig32( p_out, synth_len, sub( Q11, sub( Q6, 1 ) ) ); } - ELSE IF( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) + ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && hDirACRend->hOutSetup.separateChannelEnabled ) { /* LFE has been synthesized in the time domain, do nothing. */ } ELSE { - set32_fx( &( output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), 0, imult1616( hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->num_freq_bands ) ); + set32_fx( &( output_buf_fx[ch][i_mult( index_slot, hSpatParamRendCom->num_freq_bands )] ), 0, imult1616( hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->num_freq_bands ) ); } IF( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) { idx_lfe = add( idx_lfe, 1 ); } } - ELSE IF ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && EQ_16( hDirACRend->hOutSetup.separateChannelIndex, ch ) ) + ELSE IF( ( hDirACRend->hOutSetup.separateChannelEnabled ) && EQ_16( hDirACRend->hOutSetup.separateChannelIndex, ch ) ) { /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated * channel is combined with the synthesized channels here. */ @@ -5466,44 +5257,38 @@ void ivas_dirac_dec_render_sf_fx( ELSE { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - -#if 1 // TODO: remove float to fixed code - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); - floatToFixed_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); -#endif Word32 *p_out = &( output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ); Word16 samplesToProcess, out_len; FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { - RealBuffer_fx[i] = Cldfb_RealBuffer_fx[idx_in][i]; // Q6 - ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; // Q6 + RealBuffer_fx[i] = Cldfb_RealBuffer_fx[idx_in][i]; // Q6 + move32(); + ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; // Q6 + move32(); } samplesToProcess = imult1616( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); - + // Calculating length of processed output - Word16 no_col = st_ivas->cldfbSynDec[idx_in]->no_col, no_channels = st_ivas->cldfbSynDec[idx_in]->no_channels; - IF(GT_16(samplesToProcess, -1)) + Word16 no_col = st_ivas->cldfbSynDec[idx_in]->no_col; + move16(); + Word16 no_channels = st_ivas->cldfbSynDec[idx_in]->no_channels; + move16(); + IF( GT_16( samplesToProcess, -1 ) ) { - no_col = s_min(no_col, (samplesToProcess + st_ivas->cldfbSynDec[idx_in]->no_channels - 1) / st_ivas->cldfbSynDec[idx_in]->no_channels); + no_col = s_min( no_col, ( add( samplesToProcess, sub( st_ivas->cldfbSynDec[idx_in]->no_channels, 1 ) ) ) / st_ivas->cldfbSynDec[idx_in]->no_channels ); } - out_len = imult1616(no_col, no_channels); + out_len = imult1616( no_col, no_channels ); // Scaling cldfb_state to Q6-1 - scale_sig32(st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->p_filter_length, sub(Q6 - 1, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state)); - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q6 - 1; + scale_sig32( st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->p_filter_length, sub( sub( Q6, 1 ), st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state ) ); + st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = sub( Q6, 1 ); move16(); - // Scaling the output to Q8 - scale_sig32(output_buf_fx[ch], samplesToProcess + index_slot * hSpatParamRendCom->num_freq_bands, Q8 - Q11 ); - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[idx_in] ); - // Scaling output from Q6-1 to Q8 - scale_sig32(p_out, out_len, (Q8 - (Q6 - 1))); + // Scaling output from Q6-1 to Q11 + Scale_sig32(p_out, out_len, (Q11 - (Q6 - 1))); -#if 1 /* TODO: remove fixed to float */ - fixedToFloat_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); -#endif idx_in = add( idx_in, 1 ); } } @@ -5513,302 +5298,349 @@ void ivas_dirac_dec_render_sf_fx( hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); -#else - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + +#ifdef IVAS_FLOAT_FIXED + /////////////////////////////////////////////////////// FIXED TO FLOAT ////////////////////////////////////////////////////////////////////////////////////////// + IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) { - /* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */ - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - int16_t in_ch; - for ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ ) - { - int16_t j, k, j2, l; - int16_t num_objects, nchan_out_woLFE, lfe_index; - int16_t az1, el1; - int16_t n_slots_to_render; - int16_t n_samples_to_render; - int16_t interp_offset; - - float gain, prev_gain; - - num_objects = st_ivas->nchan_ism; - nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; - n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; - n_samples_to_render = hSpatParamRendCom->num_freq_bands * n_slots_to_render; - interp_offset = st_ivas->hTcBuffer->n_samples_rendered; + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); + } + ELSE + { + me2f_buf( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hSpatParamRendCom->num_freq_bands ); + me2f_buf( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hSpatParamRendCom->num_freq_bands ); + } + } + IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) + IF( hodirac_flag ) + { + fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.direct_responses_fx[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], &hDirACRend->h_output_synthesis_psd_state.direct_responses[i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir )], hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + ELSE + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_square, hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); + } + } + IF( !( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) ) + { + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + fixedToFloat_arrL32( st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, st_ivas->cldfbAnaDec[ch]->cldfb_state, Q11, ( st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels ) ); + } + } + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + IF( nchan_transport >= 4 ) + { + fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, 5 * hSpatParamRendCom->num_freq_bands ); + } + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, 2 * nchan_transport * hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, 2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + } + ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) + { + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ) ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + IF( hDirACRend->masa_stereo_type_detect ) + { + hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + } + } + ELSE + { + SWITCH( nchan_transport ) + { + case 11: + case 8: + case 6: + case 4: + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( i_mult( 2, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); + me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); + fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + BREAK; + case 2: + IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { - ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx ); - - interp_offset = 0; + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 6, hSpatParamRendCom->num_freq_bands ) ) ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); } - for ( i = 0; i < num_objects; i++ ) + ELSE { - /* Combined rotation: rotate the object positions depending the head and external orientations */ - if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ) ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); + IF( hDirACRend->masa_stereo_type_detect ) { - rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &az1, &el1, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup ); - if ( st_ivas->hEFAPdata != NULL ) - { - efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], az1, el1, EFAP_MODE_EFAP ); - } + hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); } + } + me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); + fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + BREAK; + case 1: + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 2, hSpatParamRendCom->num_freq_bands ) ) ); + fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); + me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ) ); + fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); + BREAK; + } + } - lfe_index = 0; - for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ ) - { - if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[lfe_index] == j ) ) - { - ( lfe_index < ( st_ivas->hIntSetup.num_lfe - 1 ) ) ? ( lfe_index++, j2++ ) : j2++; - } - gain = st_ivas->hIsmRendererData->gains[i][j]; - prev_gain = st_ivas->hIsmRendererData->prev_gains[i][j]; - if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f ) - { - float *tc_re, *tc_im; - float *w1, w2; - w1 = &st_ivas->hIsmRendererData->interpolator[interp_offset]; - tc_re = pppQMfFrame_ts_re[nchan_transport + i][0]; - tc_im = pppQMfFrame_ts_im[nchan_transport + i][0]; - for ( k = 0; k < n_slots_to_render; k++ ) - { - float g; - w2 = 1.0f - *w1; - g = ( *w1 * gain + w2 * prev_gain ); + IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) + { + FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) + { + fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[0][i], hDirACRend->buffer_intensity_real[0][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[1][i], hDirACRend->buffer_intensity_real[1][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[2][i], hDirACRend->buffer_intensity_real[2][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + fixedToFloat_arrL32( &hDirACRend->buffer_energy_fx[i * num_freq_bands], &hDirACRend->buffer_energy[i * num_freq_bands], hDirACRend->q_buffer_energy[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + } + FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + md_idx = hSpatParamRendCom->render_to_md_map[add( hSpatParamRendCom->slots_rendered, slot_idx )]; + fixedToFloat_arrL32( hSpatParamRendCom->diffuseness_vector_fx[md_idx], hSpatParamRendCom->diffuseness_vector[md_idx], Q30, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); + } + } - for ( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ ) - { - Cldfb_RealBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_re++ ); - Cldfb_ImagBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_im++ ); - } - w1 += hSpatParamRendCom->num_freq_bands; - } - } - /* update here only in case of head rotation */ - if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) - { - st_ivas->hIsmRendererData->prev_gains[i][j] = gain; - } - } - } - } + IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) + { + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL( onset_filter_fx, DirAC_mem.onset_filter, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( onset_filter_subframe_fx, DirAC_mem.onset_filter + hSpatParamRendCom->num_freq_bands, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands ); } + ELSE + { + fixedToFloat_arrL( onset_filter_fx, DirAC_mem.onset_filter, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); + me2f_buf( DirAC_mem.frame_dec_f_fx, 31 - DirAC_mem.frame_dec_f_q, DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_len ); - /* Perform binaural rendering */ - ivas_binRenderer( st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - hSpatParamRendCom->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + hDirACRend->proto_frame_dec_f = DirAC_mem.frame_dec_f; + } + } + ELSE + { + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL( onset_filter_fx, DirAC_mem.onset_filter, DirAC_mem.q_onset_filter, hSpatParamRendCom->num_freq_bands ); + } + ELSE + { + hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; + } + } + IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) + { + if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 ) + { + DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state ); + me2f_buf( state->proto_power_diff_smooth_fx, + 31 - state->proto_power_diff_smooth_q, + state->proto_power_diff_smooth, + state->proto_power_diff_smooth_len ); + me2f_buf( state->proto_diffuse_buffer_f_fx, + 31 - state->proto_diffuse_buffer_f_q, + state->proto_diffuse_buffer_f, + state->proto_diffuse_buffer_f_len ); + } + } - /* Inverse CLDFB*/ - for (ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++) + if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) + { + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + fixedToFloat_arrL( h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); + } + else + { + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); } - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); } } - else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + else if ( hDirAC->hConfig->dec_param_estim == TRUE ) { - for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hSpatParamRendCom->num_freq_bands ); + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->diffuse_power_factor_q ); + } + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, (num_channels_dir) *hSpatParamRendCom->num_freq_bands ); + } + else + { + FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) + { + hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); } } } - else + + if ( h_dirac_output_synthesis_params->use_onset_filters && ( hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ) { - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t outchannels; + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands ); + } - idx_in = 0; - idx_lfe = 0; + if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + } - outchannels = hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; - if ( hDirACRend->hOutSetup.separateChannelEnabled && ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || - ( hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); + + hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev; + hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev; + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); + } + ELSE + { + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev, q_reference_power_smooth, hSpatParamRendCom->num_freq_bands ); + + IF( hDirACRend->masa_stereo_type_detect != NULL ) { - outchannels++; + hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx, Q21 ); + + hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); + hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); + hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); } - if ( hDirACRend->hOutSetup.separateChannelEnabled && hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); + + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) { - float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - const int16_t subframe_start_sample = index_slot * hSpatParamRendCom->num_freq_bands; - const int16_t num_samples_subframe = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; + fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + } + } - /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ - mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); - mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); - for ( ch = 0; ch < outchannels; ch++ ) - { - if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) - { - /* Move the LFE channel to the correct place */ - mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + for ( i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++ ) + { + fixedToFloat_arrL( st_ivas->cldfbSynDec[i]->cldfb_state_fx, st_ivas->cldfbSynDec[i]->cldfb_state, st_ivas->cldfbSynDec[i]->Q_cldfb_state, st_ivas->cldfbSynDec[i]->p_filter_length ); + fixedToFloat_arrL( output_buf_fx[i], output_f[i], Q11, index_slot * hSpatParamRendCom->num_freq_bands + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + } + else + { + idx_lfe = 0; + idx_in = 0; + Word16 outchannels = add( hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe ); - if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) - { - /* Move the separated channel to the correct place. Thus, the separated channel is - * combined with the synthesized channels here when there is a matching channel. */ - mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } - else - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); + IF( hDirACRend->hOutSetup.separateChannelEnabled && ( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_7_1 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || + EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || + ( EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + { + outchannels = add( outchannels, 1 ); + } - if ( !st_ivas->hLsSetupCustom->separate_ch_found ) + IF( ( hDirACRend->hOutSetup.separateChannelEnabled && EQ_16( hDirACRend->hOutSetup.output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ) + { + FOR( ch = 0; ch < outchannels; ch++ ) + { + IF( L_and( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ), ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) ) + { + IF( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) { - /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel - * is combined with the synthesized channels here when there is no matching channel. */ - v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + idx_lfe = add( idx_lfe, 1 ); } - - idx_in++; } } } - else + ELSE { - for ( ch = 0; ch < outchannels; ch++ ) + FOR( ch = 0; ch < outchannels; ch++ ) { - if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) + IF( L_and( GT_16( hDirACRend->hOutSetup.num_lfe, 0 ), ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) ) { - if (st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) - { - for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) - { - RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - } - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); - } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) + IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && !hDirACRend->hOutSetup.separateChannelEnabled ) { - /* LFE has been synthesized in the time domain, do nothing. */ - } - else - { - set_zero( &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); - } - if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; + Word16 cldfbSynIdx = add( hDirACRend->hOutSetup.nchan_out_woLFE, idx_lfe ); + fixedToFloat_arrL( st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length ); } } - else if ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) + ELSE IF( ( hDirACRend->hOutSetup.separateChannelEnabled ) && EQ_16( hDirACRend->hOutSetup.separateChannelIndex, ch ) ) { - /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated - * channel is combined with the synthesized channels here. */ } - else + ELSE { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); - idx_in++; + fixedToFloat_arrL( st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length ); + idx_in = add( idx_in, 1 ); } } } - } - - hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe_idx]; - hSpatParamRendCom->subframes_rendered++; -#endif - -#ifdef IVAS_FLOAT_FIXED - /////////////////////////////////////////////////////// FIXED TO FLOAT ////////////////////////////////////////////////////////////////////////////////////////// - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) - { - for (i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) - { - fixedToFloat_arrL(output_buf_fx[i], output_f[i], Q11, index_slot * hSpatParamRendCom->num_freq_bands + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]); - } - } - else if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - { - for (ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++) - { - for (slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++) - { - fixedToFloat_arrL(pppQMfFrame_ts_re_fx[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], Q6, hSpatParamRendCom->num_freq_bands); - fixedToFloat_arrL(pppQMfFrame_ts_im_fx[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], Q6, hSpatParamRendCom->num_freq_bands); - } - } - } - else - { - Word16 outchannels = add(hDirACRend->hOutSetup.nchan_out_woLFE, hDirACRend->hOutSetup.num_lfe); - - IF(hDirACRend->hOutSetup.separateChannelEnabled && (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_2 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_5_1_4 || - hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_7_1_4 || - (hDirACRend->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found))) - { - outchannels = add(outchannels, 1); - } - if (!hDirACRend->hOutSetup.separateChannelEnabled || hDirACRend->hOutSetup.output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM) + if ( !hDirACRend->hOutSetup.separateChannelEnabled || hDirACRend->hOutSetup.output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM ) { Word16 tmp_lfe_idx = 0; - for (ch = 0; ch < outchannels; ch++) + for ( ch = 0; ch < outchannels; ch++ ) { - //fixedToFloat_arrL(output_buf_fx[i], output_f[i], Q11, index_slot * hSpatParamRendCom->num_freq_bands + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]); - IF((hDirACRend->hOutSetup.num_lfe > 0) && (EQ_16(hDirACRend->hOutSetup.index_lfe[tmp_lfe_idx], ch))) + // fixedToFloat_arrL(output_buf_fx[i], output_f[i], Q11, index_slot * hSpatParamRendCom->num_freq_bands + hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]); + IF( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( EQ_16( hDirACRend->hOutSetup.index_lfe[tmp_lfe_idx], ch ) ) ) { - IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + IF( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled ) { // Fixed to float - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); + fixedToFloat_arrL( output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands ); } - ELSE IF(st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled) + ELSE IF( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) { /* LFE has been synthesized in the time domain, do nothing. */ } ELSE { // Float to fixed. - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); + fixedToFloat_arrL( output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands ); } - IF(LT_16(tmp_lfe_idx, sub(hDirACRend->hOutSetup.num_lfe, 1))) + IF( LT_16( tmp_lfe_idx, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) { - tmp_lfe_idx = add(tmp_lfe_idx, 1); + tmp_lfe_idx = add( tmp_lfe_idx, 1 ); } } - ELSE IF((hDirACRend->hOutSetup.separateChannelEnabled) && EQ_16(hDirACRend->hOutSetup.separateChannelIndex, ch)) + ELSE IF( ( hDirACRend->hOutSetup.separateChannelEnabled ) && EQ_16( hDirACRend->hOutSetup.separateChannelIndex, ch ) ) { /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated * channel is combined with the synthesized channels here. */ @@ -5816,7 +5648,7 @@ void ivas_dirac_dec_render_sf_fx( ELSE { // Fixed to float - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q8, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] + index_slot * hSpatParamRendCom->num_freq_bands); + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] + index_slot * hSpatParamRendCom->num_freq_bands); } } } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e875c9dce..ebf6b23e2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1361,11 +1361,12 @@ ivas_error ivas_init_decoder_fx( } IF ( ( error = ivas_ls_custom_output_init_fx( st_ivas ) ) == IVAS_ERR_OK ) { +#ifndef IVAS_FLOAT_FIXED st_ivas->hOutSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; st_ivas->hOutSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; -#ifdef IVAS_FLOAT_FIXED +#else st_ivas->hOutSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; st_ivas->hOutSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; st_ivas->hIntSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; @@ -1393,7 +1394,7 @@ ivas_error ivas_init_decoder_fx( /* check for a speaker at (0, 0) if minimum speaker count is available */ FOR ( i = 0; i < st_ivas->hOutSetup.nchan_out_woLFE; i++ ) { - IF ( st_ivas->hOutSetup.ls_azimuth[i] == 0.0f && st_ivas->hOutSetup.ls_elevation[i] == 0.0f ) + IF ( L_shr(st_ivas->hOutSetup.ls_azimuth_fx[i], Q22) == 0 && L_shr(st_ivas->hOutSetup.ls_elevation_fx[i], Q22) == 0 ) { st_ivas->hIntSetup.separateChannelIndex = i; st_ivas->hLsSetupCustom->separate_ch_found = 1; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 1b45dbe78..7c6eeeaa4 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -127,7 +127,7 @@ ivas_error ivas_ism_renderer_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM renderer\n" ) ); } - IF ( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth != NULL && st_ivas->hIntSetup.ls_elevation != NULL && st_ivas->hEFAPdata == NULL ) + IF ( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL && st_ivas->hEFAPdata == NULL ) { IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index d94f11435..6460c0c5d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -95,17 +95,14 @@ static Word16 ceil_fx16( Word16 inp, Word16 Q ) *--------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -ivas_error ivas_jbm_dec_tc( +ivas_error ivas_jbm_dec_tc_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *data /* o : transport channel signals */ + Word32 *data_fx ) { Word16 n, output_frame, nchan_out, i, j; - Decoder_State *st, **sts; /* used for bitstream handling */ - float *p_output[MAX_TRANSPORT_CHANNELS]; /* 'float' buffer for output synthesis */ -#ifdef IVAS_FLOAT_FIXED + Decoder_State *st; /* used for bitstream handling */ Word32 *p_output_fx[MAX_TRANSPORT_CHANNELS]; /* 'float' buffer for output synthesis */ -#endif Word16 nchan_remapped; Word16 nb_bits_metadata[MAX_SCE + 1]; Word32 output_Fs, ivas_total_brate; @@ -115,7 +112,6 @@ ivas_error ivas_jbm_dec_tc( Word32 ism_total_brate; Word16 s; - MCT_DEC_HANDLE hMCT; CPE_DEC_HANDLE hCPE; SCE_DEC_HANDLE hSCE; push_wmops( "ivas_jbm_dec_tc" ); @@ -125,21 +121,17 @@ ivas_error ivas_jbm_dec_tc( *----------------------------------------------------------------*/ output_Fs = st_ivas->hDecoderConfig->output_Fs; + move32(); nchan_out = st_ivas->hTcBuffer->nchan_transport_jbm; + move16(); output_config = st_ivas->hDecoderConfig->output_config; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + move32(); output_frame = (Word16) ( output_Fs / FRAMES_PER_SEC ); FOR( n = 0; n < MAX_TRANSPORT_CHANNELS; n++ ) { -#if 1 // TODO: To be removed later - p_output[n] = st_ivas->p_output_f[n]; - IF( p_output[n] != NULL ) - { - set_zero( p_output[n], L_FRAME48k ); - } -#endif p_output_fx[n] = st_ivas->p_output_fx[n]; IF( p_output_fx[n] != NULL ) { @@ -151,20 +143,17 @@ ivas_error ivas_jbm_dec_tc( { FOR( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { + set_zero_fx(st_ivas->p_output_fx[n], L_FRAME48k); st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; -#if 1 // TODO: To be removed later - set_zero(st_ivas->p_output_f[n], L_FRAME48k); - st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; -#ifndef MSAN_FIX - floatToFixed_arrL( st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->tc_fx[n], Q11, L_FRAME48k ); -#endif -#endif } #ifdef MSAN_FIX st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec(st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); #endif } + Word16 ch; + + /*----------------------------------------------------------------* * Decoding + pre-rendering *----------------------------------------------------------------*/ @@ -180,7 +169,7 @@ ivas_error ivas_jbm_dec_tc( ELSE IF( st_ivas->ivas_format == STEREO_FORMAT ) { st_ivas->hCPE[0]->element_brate = ivas_total_brate; - Word16 q_output = 11; + Word16 q_output = 11; move16(); set32_fx( &p_output_fx[0][0], 0, L_FRAME48k ); set32_fx( &p_output_fx[1][0], 0, L_FRAME48k ); @@ -201,9 +190,8 @@ ivas_error ivas_jbm_dec_tc( hp20_fix32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } - IF( st_ivas->renderer_type == RENDERER_MC && EQ_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) + IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) && EQ_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) { -#ifdef IVAS_FLOAT_FIXED s = sub( Q16, Q11 ); s = sub( s, find_guarded_bits_fx( st_ivas->nchan_transport ) ); FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) @@ -215,7 +203,6 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); } -#endif } } ELSE IF( st_ivas->ivas_format == ISM_FORMAT ) @@ -231,10 +218,8 @@ ivas_error ivas_jbm_dec_tc( { return error; } - -#ifdef IVAS_FLOAT_FIXED Word16 Q_cngNoiseLevel[MAX_SCE]; - FOR( Word16 ch = 0; ch < 4; ch++ ) + FOR( ch = 0; ch < 4; ch++ ) { IF( st_ivas->hSCE[ch] != NULL ) { @@ -242,7 +227,6 @@ ivas_error ivas_jbm_dec_tc( } } ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( st_ivas->hSCE, st_ivas->hISMDTX.sce_id_dtx, st_ivas->nchan_transport, Q_cngNoiseLevel ); -#endif // IVAS_FLOAT_FIXED } ELSE IF( st_ivas->ism_mode == ISM_MODE_PARAM ) { @@ -303,50 +287,11 @@ ivas_error ivas_jbm_dec_tc( { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; -#ifdef IVAS_FLOAT_FIXED - // Float to fix conversion ends here. - IF( ( error = ivas_masa_decode_fx( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } - // Fix to float conversion starts here. - IF( st_ivas->hSpatParamRendCom != NULL ) - { - FOR( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - FOR( j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++ ) - { - st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) - { - st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15 ); - } - st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15 ); - st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15 ); - } - } - } - st_ivas->hMasa->data.dir_decode_quality = fix16_to_float( st_ivas->hMasa->data.dir_decode_quality_fx, Q14 ); - IF( st_ivas->hSpatParamRendCom != NULL ) - { - FOR( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) - { - FOR( Word16 block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - FOR( Word16 b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++ ) - { - st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b] = fix_to_float( st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][block][b], Q30 ); - } - } - } - } - // Fixed to float conversion ends here. -#endif - IF( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); @@ -397,159 +342,10 @@ ivas_error ivas_jbm_dec_tc( } ELSE IF( GT_16( st_ivas->nCPE, 1 ) ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 // Float to fix - - Word16 ch, nCPE, cpe_id; - Word16 l; - - nCPE = st_ivas->nCPE; - move16(); - hMCT = st_ivas->hMCT; - FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - st = hCPE->hCoreCoder[n]; - IF( sts[n]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // u8bit to 16bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; - } - } - - //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - //{ - // st->hTcxDec->conLastFrameLevel_e = 0; - //} - //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - //{ - // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - //} - IF( st->hTcxDec ) - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - IF( st->hTcxDec ) - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - /*cldfb struct*/ - - /*------------------fix-to-fix-start---------------------*/ - /*core_switching_post_dec*/ - if ( hCPE->hCoreCoder[n]->hHQ_core != NULL ) - { - hCPE->hCoreCoder[n]->hHQ_core->Q_old_postdec = 0; - hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda = 0; - } - } - } -#endif // Float to fix - if ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } -#if 1 // Fix to float - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - st = hCPE->hCoreCoder[ch]; - IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // 16bit to u8bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - - FOR( n = 0; n < 2; n++ ) - { - st = hCPE->hCoreCoder[n]; - sts = hCPE->hCoreCoder; - - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } - - /*-------------------cldfb-start-------------------------*/ - - if ( sts[n]->cldfbAna != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbAna->cldfb_state_fx, sts[n]->cldfbAna->cldfb_state, 10, sts[n]->cldfbAna->cldfb_state_length ); - } - if ( sts[n]->cldfbSyn != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbSyn->cldfb_state_fx, sts[n]->cldfbSyn->cldfb_state, 4, sts[n]->cldfbSyn->p_filter_length ); - } - if ( sts[n]->cldfbBPF != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbBPF->cldfb_state_fx, sts[n]->cldfbBPF->cldfb_state, 11, sts[n]->cldfbBPF->cldfb_state_length ); - } - - /*-------------------cldfb-end---------------------------*/ - - IF( sts[n]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[n]->hHQ_core->old_out_fx, sts[n]->hHQ_core->old_out, 0, L_FRAME48k ); - } - - - /*------------------reset-code-start---------------------*/ - - /* reset WB BWE buffers */ - - IF( NE_16( sts[n]->last_extl, WB_BWE ) && EQ_16( sts[n]->extl, WB_BWE ) && sts[n]->hBWE_FD != NULL ) - { - - IF( NE_16( sts[n]->last_extl, SWB_BWE ) && NE_16( sts[n]->last_extl, FB_BWE ) ) - { - sts[n]->hBWE_FD->prev_mode = sts[n]->hBWE_FD->prev_mode; - } - sts[n]->hBWE_FD->prev_L_swb_norm = sts[n]->hBWE_FD->prev_L_swb_norm; - sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; - } - - /*------------------reset-code-end-----------------------*/ - } - } - - - IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf ) - { - IF( !hMCT->currBlockDataCnt ) - { - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->igf ) - { - FOR( l = 0; l < IGF_START_MX; l++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - } - } - } - - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - -#endif // Fix to float -#endif } /* TCs remapping */ @@ -557,26 +353,21 @@ ivas_error ivas_jbm_dec_tc( IF( st_ivas->sba_dirac_stereo_flag ) { nchan_remapped = nchan_out; + move16(); IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*Float to Fixed changes */ FOR( i = 0; i < st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; i++ ) { Scale_sig32( p_output_fx[i], output_frame, sub( Q14, Q11 ) ); } SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 nchan_transport; - //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - //Word16 num_out_ch; - //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + move16(); hSpar->hMdDec->Q_mixer_mat = 31; - //Word16 num_in_ch; - //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#endif + move16(); ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx ), ( p_output_fx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); IF( st_ivas->hSpar->hPCA != NULL ) @@ -585,18 +376,13 @@ ivas_error ivas_jbm_dec_tc( } ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes(st_ivas->sba_order, ivas_total_brate, st_ivas->last_active_ivas_total_brate)); -#endif } - -#ifdef IVAS_FLOAT_FIXED { Word16 q; - //float max_val = 0.0; - //int i_max_val_op; hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; - //i_max_val_op = (int) max_val; - s = 0; + + s = 0; move16(); FOR( i = 0; i < 2; i++ ) { s = s_min( s, L_norm_arr( p_output_fx[i], L_FRAME48k ) - 11 ) /* Guard bits */; @@ -609,9 +395,12 @@ ivas_error ivas_jbm_dec_tc( IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; + move16(); hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; + move16(); } q = hCPE->hStereoDft->q_dft; + move16(); scale_sig32(hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub(hCPE->hStereoDft->q_dft, Q11)); FOR( i = 0; i < CPE_CHANNELS; ++i ) { @@ -620,9 +409,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hCoreCoder[0] != NULL ) { - floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], q, L_FRAME32k ); + Copy_Scale_sig_16_32(hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx,L_FRAME32k,q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB); + Copy_Scale_sig_16_32(hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx,L_FRAME48k,q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda); hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; - floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], q, L_FRAME48k ); } IF( hCPE->hStereoDft != NULL ) { @@ -670,13 +459,13 @@ ivas_error ivas_jbm_dec_tc( hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; } st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } #ifdef MSAN_FIX - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) { Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 ); } @@ -708,8 +497,8 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hCoreCoder[0] != NULL ) { - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], q, L_FRAME32k ); - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], q, L_FRAME48k ); + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB - q ); + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); } IF( hCPE->hStereoDft != NULL ) { @@ -749,13 +538,12 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; } st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR ( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); hCPE->q_output_mem_fx[ii] = Q11; } } -#endif } ELSE IF( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_5k2 || ( ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) { @@ -772,43 +560,38 @@ ivas_error ivas_jbm_dec_tc( { nchan_remapped = ivas_sba_remapTCs_fx( p_output_fx, st_ivas, output_frame ); - IF( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); -#ifdef IVAS_FLOAT_FIXED -#if 1 - Word16 ch; + SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 Q_p_output = 14; + move16(); Word16 nchan_transport; - //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + move16(); nchan_out = nchan_transport; + move16(); FOR( ch = 0; ch < nchan_transport; ch++ ) { Scale_sig32( p_output_fx[ch], output_frame, sub( Q_p_output, Q11 ) ); } - //Word16 num_out_ch; - //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + hSpar->hMdDec->Q_mixer_mat = 31; - //Word16 num_in_ch; - //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#endif + move16(); + ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, p_output_fx, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); -#if 1 /*Fixed to float changes */ FOR( Word16 c = 0; c < nchan_transport; c++ ) { Scale_sig32( p_output_fx[c], output_frame, 11 ); } -#endif -#endif } - else if ( st_ivas->renderer_type != RENDERER_DISABLE ) + ELSE IF ( st_ivas->renderer_type != RENDERER_DISABLE ) { -#ifdef IVAS_FLOAT_FIXED Word16 size = st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; - if ( st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport == 3 ) - size += 1; + IF ( st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport == 3 ) + size = add( size, 1 ); FOR( i = 0; i < size; i++ ) { @@ -816,20 +599,17 @@ ivas_error ivas_jbm_dec_tc( } ivas_spar_dec_agc_pca_fx( st_ivas, p_output_fx, output_frame ); -#endif } } - IF( st_ivas->ivas_format == MASA_FORMAT ) + IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) { -#ifdef IVAS_FLOAT_FIXED Word16 q_shift = 0; ivas_masa_prerender_fx( st_ivas, p_output_fx, &q_shift, output_frame, nchan_remapped ); FOR( i = 0; i < 2; i++ ) { Scale_sig32( p_output_fx[i], output_frame, negate( q_shift ) ); } -#endif } ELSE IF( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { @@ -868,23 +648,28 @@ ivas_error ivas_jbm_dec_tc( /* set ISM parameters and decode ISM metadata in OMASA format */ -#ifdef IVAS_FLOAT_FIXED - Word16 q_output = 11; + Word16 q_output = 11; move16(); // NOTE: the following is done to calculate the number of hIsmMetaData indices Word16 tmp_nchan_ism; - IF( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) - tmp_nchan_ism = 1; - ELSE IF( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + IF(st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ) + { + tmp_nchan_ism = 1; + move16(); + } + ELSE IF(st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ) + { tmp_nchan_ism = 0; - ELSE + move16(); + } + ELSE{ tmp_nchan_ism = st_ivas->nchan_ism; - ///////////////////////////////////// Float to fix conversion starts here. /////////////////////////////////// + move16(); + } FOR( n = 0; n < tmp_nchan_ism; n++ ) { set32_fx( p_output_fx[n], 0, L_FRAME48k ); } - ///////////////////////////////////// Float to fix conversion ends here. /////////////////////////////////// /* MASA metadata decoding */ IF( ( error = ivas_masa_decode_fx( st_ivas, st_ivas->hCPE[0]->hCoreCoder[0], &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) @@ -917,7 +702,7 @@ ivas_error ivas_jbm_dec_tc( } /* shifting both the channels from variable q_output to constant Q-factor (Q11) */ - FOR( int k = 0; k < output_frame; k++ ) + FOR( Word16 k = 0; k < output_frame; k++ ) { p_output_fx[0][k] = L_shr( p_output_fx[0][k], 11 - q_output ); move32(); @@ -959,39 +744,6 @@ ivas_error ivas_jbm_dec_tc( ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); } - //////////////////////////// Fix to float conversion starts here. /////////////////////////////////// - IF( st_ivas->hSpatParamRendCom != NULL ) - { - FOR( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - FOR( j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++ ) - { - st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) - { - st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15 ); - } - st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15 ); - st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15 ); - } - } - } - st_ivas->hMasa->data.dir_decode_quality = fix16_to_float( st_ivas->hMasa->data.dir_decode_quality_fx, Q14 ); - IF( st_ivas->hSpatParamRendCom != NULL ) - { - FOR( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) - { - FOR( Word16 block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - FOR( Word16 b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++ ) - { - st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b] = fix_to_float( st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][block][b], Q30 ); - } - } - } - } IF( NE_16( output_q, Q11 ) ) { FOR( n = 0; n < s_max( getNumChanSynthesis( st_ivas ), nchan_transport_ism + st_ivas->nchan_transport ); n++ ) @@ -999,29 +751,21 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( p_output_fx[n], output_frame, sub( Q11, output_q ) ); } } - /////////////////////////////////// Fixed to float conversion ends here. /////////////////////////////////// -#endif + } ELSE IF( st_ivas->ivas_format == SBA_ISM_FORMAT ) { - int16_t nchan_ism, sba_ch_idx; + Word16 nchan_ism, sba_ch_idx; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); nchan_ism = st_ivas->nchan_ism; IF( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { /* set ISM parameters and decode ISM metadata in OSBA format */ -#ifdef IVAS_FLOAT_FIXED IF((error = ivas_osba_ism_metadata_dec_fx(st_ivas, ivas_total_brate, &nchan_ism, &nb_bits_metadata[1])) != IVAS_ERR_OK) { return error; } -#else - if ( ( error = ivas_osba_ism_metadata_dec( st_ivas, ivas_total_brate, &nchan_ism, &nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif sba_ch_idx = st_ivas->nchan_ism; } ELSE @@ -1031,12 +775,10 @@ ivas_error ivas_jbm_dec_tc( } /* SBA metadata decoding */ -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_spar_dec_fx( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } -#endif IF( EQ_16( st_ivas->nchan_transport, CPE_CHANNELS ) && GE_16( st_ivas->nCPE, 1 ) ) { @@ -1044,7 +786,7 @@ ivas_error ivas_jbm_dec_tc( } /* core-decoding of transport channels */ - Word16 q_output = 11; + Word16 q_output = 11; move16(); IF( EQ_16( st_ivas->nSCE, 1 ) ) { @@ -1071,202 +813,40 @@ ivas_error ivas_jbm_dec_tc( } ELSE IF( GT_16( st_ivas->nCPE, 1 ) ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 // Float to fix - Word16 ch, nCPE, cpe_id; - Word16 l; - - nCPE = st_ivas->nCPE; - move16(); - hMCT = st_ivas->hMCT; - FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + IF ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - st = hCPE->hCoreCoder[n]; - - IF( sts[n]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; - } - } - //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - //{ - // st->hTcxDec->conLastFrameLevel_e = 0; - //} - //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - //{ - // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - //} - IF( st->hTcxDec ) - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - IF( st->hTcxDec ) - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - - /*------------------fix-to-fix-start---------------------*/ - /*core_switching_post_dec*/ - if ( hCPE->hCoreCoder[n]->hHQ_core != NULL ) - { - hCPE->hCoreCoder[n]->hHQ_core->Q_old_postdec = 0; - hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda = 0; - } - } + return error; } + } + IF ( st_ivas->sba_dirac_stereo_flag ) + { + FOR( i = 0; i < st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; i++ ) + { + Scale_sig32( p_output_fx[i + sba_ch_idx], output_frame, sub( Q14, Q11 ) ); + } + SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; + Word16 nchan_transport; + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; move16(); + nchan_out = nchan_transport; move16(); + hSpar->hMdDec->Q_mixer_mat = 31; move16(); + ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); -#endif // Float to fix - if ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) + IF( st_ivas->hSpar->hPCA != NULL ) { - return error; + ivas_pca_dec_fx( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, &p_output_fx[sba_ch_idx] ); } -#if 1 // Fix to float - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) + ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) + Word16 q; + hCPE = st_ivas->hCPE[0]; + hSCE = st_ivas->hSCE[0]; + s = 0; move16(); + FOR( i = 0; i < 2; i++ ) { - st = hCPE->hCoreCoder[ch]; - IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // 16bit to u8bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } + s = s_min( s, L_norm_arr( p_output_fx[sba_ch_idx + i], L_FRAME48k ) - 11 /* Guard bits */ ); } - - FOR( n = 0; n < 2; n++ ) - { - st = hCPE->hCoreCoder[n]; - sts = hCPE->hCoreCoder; - - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } - - /*-------------------cldfb-start-------------------------*/ - - /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ - - if ( sts[n]->cldfbAna != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbAna->cldfb_state_fx, sts[n]->cldfbAna->cldfb_state, 10, sts[n]->cldfbAna->cldfb_state_length ); - } - if ( sts[n]->cldfbSyn != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbSyn->cldfb_state_fx, sts[n]->cldfbSyn->cldfb_state, 4, sts[n]->cldfbSyn->p_filter_length ); - } - if ( sts[n]->cldfbBPF != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbBPF->cldfb_state_fx, sts[n]->cldfbBPF->cldfb_state, 11, sts[n]->cldfbBPF->cldfb_state_length ); - } - - /*-------------------cldfb-end---------------------------*/ - - IF( sts[n]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[n]->hHQ_core->old_out_fx, sts[n]->hHQ_core->old_out, 0, L_FRAME48k ); - } - /*------------------reset-code-start---------------------*/ - - - /* reset WB BWE buffers */ - - IF( NE_16( sts[n]->last_extl, WB_BWE ) && EQ_16( sts[n]->extl, WB_BWE ) && sts[n]->hBWE_FD != NULL ) - { - - IF( NE_16( sts[n]->last_extl, SWB_BWE ) && NE_16( sts[n]->last_extl, FB_BWE ) ) - { - sts[n]->hBWE_FD->prev_mode = sts[n]->hBWE_FD->prev_mode; - } - sts[n]->hBWE_FD->prev_L_swb_norm = sts[n]->hBWE_FD->prev_L_swb_norm; - sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; - } - } - } - - - IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf ) - { - IF( !hMCT->currBlockDataCnt ) - { - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->igf ) - { - FOR( l = 0; l < IGF_START_MX; l++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - } - } - } - - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - -#endif // Fix to float -#endif - } - - if ( st_ivas->sba_dirac_stereo_flag ) - { - FOR( i = 0; i < st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; i++ ) - { - Scale_sig32( p_output_fx[i + sba_ch_idx], output_frame, sub( Q14, Q11 ) ); - } -#ifdef IVAS_FLOAT_FIXED -#if 1 /*Float to Fixed changes */ - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - Word16 nchan_transport; - //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - nchan_out = nchan_transport; - //Word16 num_out_ch; - //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; - hSpar->hMdDec->Q_mixer_mat = 31; - //Word16 num_in_ch; - //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#endif - ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); - - IF( st_ivas->hSpar->hPCA != NULL ) - { - ivas_pca_dec_fx( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, &p_output_fx[sba_ch_idx] ); - } - -#ifndef IVAS_FLOAT_FIXED - ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); -#else - ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); -#endif -#endif -#ifdef IVAS_FLOAT_FIXED - { - Word16 q; - hCPE = st_ivas->hCPE[0]; - hSCE = st_ivas->hSCE[0]; - s = 0; - FOR( i = 0; i < 2; i++ ) - { - s = s_min( s, L_norm_arr( p_output_fx[sba_ch_idx + i], L_FRAME48k ) - 11 /* Guard bits */ ); - } - FOR( i = 0; i < 2; i++ ) + FOR( i = 0; i < 2; i++ ) { Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, s ); } @@ -1277,7 +857,7 @@ ivas_error ivas_jbm_dec_tc( hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; } - q = hCPE->hStereoDft->q_dft; + q = hCPE->hStereoDft->q_dft; move16(); scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); FOR( i = 0; i < CPE_CHANNELS; ++i ) { @@ -1286,9 +866,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hCoreCoder[0] != NULL ) { - floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], q, L_FRAME32k ); + Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); + Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; - floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], q, L_FRAME48k ); } IF( hCPE->hStereoDft != NULL ) { @@ -1305,7 +885,7 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( &hSCE->save_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; } - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; @@ -1338,8 +918,9 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hCoreCoder[0] != NULL ) { - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], q, L_FRAME32k ); - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], q, L_FRAME48k ); + + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB - q ); + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); } IF( hCPE->hStereoDft != NULL ) { @@ -1354,7 +935,6 @@ ivas_error ivas_jbm_dec_tc( hCPE->q_output_mem_fx[ii] = Q11; } } -#endif } /* HP filtering */ @@ -1368,10 +948,6 @@ ivas_error ivas_jbm_dec_tc( IF( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - -#ifdef IVAS_FLOAT_FIXED -#if 1 - Word16 ch; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 Q_p_output = 14; Word16 nchan_transport; @@ -1382,20 +958,14 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[sba_ch_idx + ch], output_frame, sub( Q_p_output, Q11 ) ); } - //Word16 num_out_ch; - //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - //Word16 num_in_ch; - //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; -#endif + ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, &p_output_fx[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); -#if 1 FOR( Word16 c = 0; c < nchan_transport; c++ ) { Scale_sig32( p_output_fx[sba_ch_idx + c], output_frame, Q11 ); } -#endif -#endif // IVAS_FLOAT_FIXED + } ELSE IF( st_ivas->renderer_type != RENDERER_DISABLE && EQ_16( st_ivas->sba_dirac_stereo_flag, 0 ) ) { @@ -1414,22 +984,18 @@ ivas_error ivas_jbm_dec_tc( IF( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { /* loudness correction */ -#ifdef IVAS_FLOAT_FIXED ivas_dirac_dec_binaural_sba_gain_fx( &p_output_fx[sba_ch_idx], nchan_remapped, output_frame ); /*returns Q-1*/ FOR( i = 0; i < nchan_remapped; i++ ) { Scale_sig32( p_output_fx[i], output_frame, 1 ); } -#endif // IVAS_FLOAT_FIXED } ELSE IF( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { -#ifdef IVAS_FLOAT_FIXED ivas_mono_downmix_render_passive_fx( st_ivas, p_output_fx, output_frame ); Scale_sig32( p_output_fx[0], L_FRAME48k, sub( Q11, Q8 ) ); -#endif /* add W */ FOR( n = 0; n < nchan_out; n++ ) @@ -1445,166 +1011,13 @@ ivas_error ivas_jbm_dec_tc( IF( st_ivas->mc_mode == MC_MODE_MCT ) { /* LFE channel decoder */ -#ifdef IVAS_FLOAT_FIXED ivas_lfe_dec_fx( st_ivas->hLFE, st, output_frame, st_ivas->bfi, p_output_fx[LFE_CHANNEL] ); Scale_sig32( p_output_fx[LFE_CHANNEL], L_FRAME48k, sub( Q11, Q9 ) ); -#endif // IVAS_FLOAT_FIXED - -#ifdef IVAS_FLOAT_FIXED -#if 1 // Float to fix - - Word16 ch, nCPE, cpe_id; - Word16 l; - - nCPE = st_ivas->nCPE; - move16(); - hMCT = st_ivas->hMCT; - FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - st = hCPE->hCoreCoder[n]; - - IF( sts[n]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // u8bit to 16bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; - } - } - //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - //{ - // st->hTcxDec->conLastFrameLevel_e = 0; - //} - //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - //{ - // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - //} - IF( st->hTcxDec ) - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - IF( st->hTcxDec ) - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - /*cldfb struct*/ - - /*------------------fix-to-fix-start---------------------*/ - /*core_switching_post_dec*/ - if ( hCPE->hCoreCoder[n]->hHQ_core != NULL ) - { - hCPE->hCoreCoder[n]->hHQ_core->Q_old_postdec = 0; - hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda = 0; - } - } - } -#endif // Float to fix IF( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, 0 ) ) != IVAS_ERR_OK ) { return error; } -#if 1 // Fix to float - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - st = hCPE->hCoreCoder[ch]; - IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // 16bit to u8bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - - FOR( n = 0; n < 2; n++ ) - { - st = hCPE->hCoreCoder[n]; - sts = hCPE->hCoreCoder; - - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } - - /*-------------------cldfb-start-------------------------*/ - - /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ - - if ( sts[n]->cldfbAna != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbAna->cldfb_state_fx, sts[n]->cldfbAna->cldfb_state, 10, sts[n]->cldfbAna->cldfb_state_length ); - } - if ( sts[n]->cldfbSyn != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbSyn->cldfb_state_fx, sts[n]->cldfbSyn->cldfb_state, 4, sts[n]->cldfbSyn->p_filter_length ); - } - if ( sts[n]->cldfbBPF != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbBPF->cldfb_state_fx, sts[n]->cldfbBPF->cldfb_state, 11, sts[n]->cldfbBPF->cldfb_state_length ); - } - - /*-------------------cldfb-end---------------------------*/ - - IF( sts[n]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[n]->hHQ_core->old_out_fx, sts[n]->hHQ_core->old_out, 0, L_FRAME48k ); - } - - /*------------------reset-code-start---------------------*/ - - - /* reset WB BWE buffers */ - - IF( NE_16( sts[n]->last_extl, WB_BWE ) && EQ_16( sts[n]->extl, WB_BWE ) && sts[n]->hBWE_FD != NULL ) - { - - IF( NE_16( sts[n]->last_extl, SWB_BWE ) && NE_16( sts[n]->last_extl, FB_BWE ) ) - { - sts[n]->hBWE_FD->prev_mode = sts[n]->hBWE_FD->prev_mode; - } - sts[n]->hBWE_FD->prev_L_swb_norm = sts[n]->hBWE_FD->prev_L_swb_norm; - sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; - } - } - } - - - IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf ) - { - IF( !hMCT->currBlockDataCnt ) - { - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->igf ) - { - FOR( l = 0; l < IGF_START_MX; l++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - } - } - } - - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - -#endif // Fix to float -#endif - /* HP filtering */ FOR( n = 0; n < st_ivas->nchan_transport; n++ ) { @@ -1626,7 +1039,6 @@ ivas_error ivas_jbm_dec_tc( { IF( st_ivas->renderer_type == RENDERER_MC ) { -#ifdef IVAS_FLOAT_FIXED s = sub( Q16, Q11 ); s = sub( s, find_guarded_bits_fx( st_ivas->nchan_transport ) ); FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) @@ -1638,7 +1050,6 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); } -#endif } ELSE IF( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { @@ -1655,156 +1066,10 @@ ivas_error ivas_jbm_dec_tc( ivas_mc_paramupmix_dec_read_BS( st_ivas, st, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] ); -#ifdef IVAS_FLOAT_FIXED -#if 1 // Float to fix - - Word16 ch, nCPE, cpe_id; - Word16 l; - - nCPE = st_ivas->nCPE; - move16(); - hMCT = st_ivas->hMCT; - FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - st = hCPE->hCoreCoder[n]; - - IF( sts[n]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // u8bit to 16bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; - } - } - //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - //{ - // st->hTcxDec->conLastFrameLevel_e = 0; - //} - //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - //{ - // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - //} - IF( st->hTcxDec ) - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - IF( st->hTcxDec ) - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - - /*------------------fix-to-fix-start---------------------*/ - /*core_switching_post_dec*/ - if ( hCPE->hCoreCoder[n]->hHQ_core != NULL ) - { - hCPE->hCoreCoder[n]->hHQ_core->Q_old_postdec = 0; - hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda = 0; - } - } - } -#endif // Float to fix - if ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } -#if 1 // Fix to float - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - st = hCPE->hCoreCoder[ch]; - IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // 16bit to u8bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - - FOR( n = 0; n < 2; n++ ) - { - st = hCPE->hCoreCoder[n]; - sts = hCPE->hCoreCoder; - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } - - /*-------------------cldfb-start-------------------------*/ - /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ - if ( sts[n]->cldfbAna != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbAna->cldfb_state_fx, sts[n]->cldfbAna->cldfb_state, 10, sts[n]->cldfbAna->cldfb_state_length ); - } - if ( sts[n]->cldfbSyn != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbSyn->cldfb_state_fx, sts[n]->cldfbSyn->cldfb_state, 4, sts[n]->cldfbSyn->p_filter_length ); - } - if ( sts[n]->cldfbBPF != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbBPF->cldfb_state_fx, sts[n]->cldfbBPF->cldfb_state, 11, sts[n]->cldfbBPF->cldfb_state_length ); - } - - /*-------------------cldfb-end---------------------------*/ - - IF( sts[n]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[n]->hHQ_core->old_out_fx, sts[n]->hHQ_core->old_out, 0, L_FRAME48k ); - } - - /*------------------reset-code-start---------------------*/ - - - /* reset WB BWE buffers */ - - IF( NE_16( sts[n]->last_extl, WB_BWE ) && EQ_16( sts[n]->extl, WB_BWE ) && sts[n]->hBWE_FD != NULL ) - { - - IF( NE_16( sts[n]->last_extl, SWB_BWE ) && NE_16( sts[n]->last_extl, FB_BWE ) ) - { - sts[n]->hBWE_FD->prev_mode = sts[n]->hBWE_FD->prev_mode; - } - sts[n]->hBWE_FD->prev_L_swb_norm = sts[n]->hBWE_FD->prev_L_swb_norm; - sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; - } - } - } - - - IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf ) - { - IF( !hMCT->currBlockDataCnt ) - { - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->igf ) - { - FOR( l = 0; l < IGF_START_MX; l++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - } - } - } - - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - -#endif // Fix to float -#endif - /* HP filtering */ FOR( n = 0; n < st_ivas->nchan_transport; n++ ) { @@ -1825,7 +1090,6 @@ ivas_error ivas_jbm_dec_tc( IF( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) { -#ifdef IVAS_FLOAT_FIXED s = sub( Q16, Q11 ); Word16 nchan_transport; nchan_transport = audioCfg2channels( IVAS_AUDIO_CONFIG_5_1_2 ); @@ -1839,7 +1103,6 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); } -#endif } } } @@ -1864,157 +1127,10 @@ ivas_error ivas_jbm_dec_tc( } ELSE IF( st_ivas->nCPE > 1 ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 // Float to fix - - Word16 ch, nCPE, cpe_id; - Word16 l; - - nCPE = st_ivas->nCPE; - move16(); - hMCT = st_ivas->hMCT; - FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - st = hCPE->hCoreCoder[n]; - IF( sts[n]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // u8bit to 16bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16) sts[n]->hIGFDec->infoTCXNoise[l]; - } - } - //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) - //{ - // st->hTcxDec->conLastFrameLevel_e = 0; - //} - //if ( st->hTcxDec && st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - //{ - // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - //} - IF( st->hTcxDec ) - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - IF( st->hTcxDec ) - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - - /*cldfb struct*/ - - /*------------------fix-to-fix-start---------------------*/ - /*core_switching_post_dec*/ - if ( hCPE->hCoreCoder[n]->hHQ_core != NULL ) - { - hCPE->hCoreCoder[n]->hHQ_core->Q_old_postdec = 0; - hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda = 0; - } - } - } -#endif // Float to fix - if ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } -#if 1 // Fix to float - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - st = hCPE->hCoreCoder[ch]; - IF( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) - { - // 16bit to u8bit - FOR( l = 0; l < IGF_START_MX; l++ ) - { - sts[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - - FOR( n = 0; n < 2; n++ ) - { - st = hCPE->hCoreCoder[n]; - sts = hCPE->hCoreCoder; - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } - - /*-------------------cldfb-start-------------------------*/ - - /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ - - if ( sts[n]->cldfbAna != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbAna->cldfb_state_fx, sts[n]->cldfbAna->cldfb_state, 10, sts[n]->cldfbAna->cldfb_state_length ); - } - if ( sts[n]->cldfbSyn != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbSyn->cldfb_state_fx, sts[n]->cldfbSyn->cldfb_state, 4, sts[n]->cldfbSyn->p_filter_length ); - } - if ( sts[n]->cldfbBPF != NULL ) - { - fixedToFloat_arrL( sts[n]->cldfbBPF->cldfb_state_fx, sts[n]->cldfbBPF->cldfb_state, 11, sts[n]->cldfbBPF->cldfb_state_length ); - } - - /*-------------------cldfb-end---------------------------*/ - - IF( sts[n]->hHQ_core != NULL ) - { - fixedToFloat_arr( sts[n]->hHQ_core->old_out_fx, sts[n]->hHQ_core->old_out, 0, L_FRAME48k ); - } - - /*------------------reset-code-start---------------------*/ - - /* reset WB BWE buffers */ - - IF( NE_16( sts[n]->last_extl, WB_BWE ) && EQ_16( sts[n]->extl, WB_BWE ) && sts[n]->hBWE_FD != NULL ) - { - - IF( NE_16( sts[n]->last_extl, SWB_BWE ) && NE_16( sts[n]->last_extl, FB_BWE ) ) - { - sts[n]->hBWE_FD->prev_mode = sts[n]->hBWE_FD->prev_mode; - } - sts[n]->hBWE_FD->prev_L_swb_norm = sts[n]->hBWE_FD->prev_L_swb_norm; - sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; - } - } - } - - - IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf ) - { - IF( !hMCT->currBlockDataCnt ) - { - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - IF( st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->igf ) - { - FOR( l = 0; l < IGF_START_MX; l++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise[l] = (uint8_t) st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise_evs[l]; - } - } - } - } - } - } - - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->targetEnergyPrev ) - //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - //IF( st_ivas->hLsSetUpConversion && st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx ) - //me2f_buf( st_ivas->hLsSetUpConversion->dmxEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->dmx_prev_exp, st_ivas->hLsSetUpConversion->dmxEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); - -#endif // Fix to float -#endif } /* HP filtering */ @@ -2026,7 +1142,6 @@ ivas_error ivas_jbm_dec_tc( /* Rendering */ IF( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) { -#ifdef IVAS_FLOAT_FIXED s = sub( Q16, Q11 ); s = sub( s, find_guarded_bits_fx( st_ivas->nchan_transport ) ); FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) @@ -2038,7 +1153,6 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); } -#endif } } ELSE IF( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -2049,7 +1163,6 @@ ivas_error ivas_jbm_dec_tc( } /* read McMASA parameters from the bitstream */ -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_masa_decode_fx( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { @@ -2090,7 +1203,6 @@ ivas_error ivas_jbm_dec_tc( } } // Fixed to float conversion ends here. -#endif IF( st_ivas->hOutSetup.separateChannelEnabled ) { /* Decode the transport audio signals */ @@ -2110,14 +1222,13 @@ ivas_error ivas_jbm_dec_tc( n = LFE_CHANNEL - 1; /* Decode the separated channel to output[n] to be combined with the synthesized channels */ -#ifdef IVAS_FLOAT_FIXED + set32_fx( p_output_fx[n], 0, L_FRAME48k ); IF( ( error = ivas_sce_dec_fx( st_ivas, 0, &p_output_fx[n], output_frame, 0 ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */ IF( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || @@ -2125,7 +1236,7 @@ ivas_error ivas_jbm_dec_tc( { ivas_lfe_synth_with_filters_fx( st_ivas->hMasa->hMasaLfeSynth, p_output_fx, output_frame, n, LFE_CHANNEL ); } - ELSE IF( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) + ELSE IF( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && EQ_16( st_ivas->hOutSetup.num_lfe, 0 ) ) { /* Delay the separated channel to sync with the DirAC rendering */ delay_signal_fx(p_output_fx[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); @@ -2133,8 +1244,7 @@ ivas_error ivas_jbm_dec_tc( } ELSE { -#ifdef IVAS_FLOAT_FIXED - Word16 q_output = 11; + Word16 q_output = 11; move16(); IF( EQ_16( st_ivas->nSCE, 1 ) ) { set32_fx( p_output_fx[0], 0, L_FRAME48k ); @@ -2157,19 +1267,14 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); } } -#endif // IVAS_FLOAT_FIXED } IF( NE_16( st_ivas->sba_dirac_stereo_flag, 0 ) ) /* use the flag to trigger the DFT upmix */ { -#ifdef IVAS_FLOAT_FIXED Word16 q; - //float max_val = 0.0; - //int i_max_val_op; hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; - //i_max_val_op = (int) max_val; - s = 0; + s = 0; move16(); FOR( i = 0; i < 2; i++ ) { s = s_min( s, L_norm_arr( p_output_fx[i], L_FRAME48k ) - 11 /* Guard bits */ ); @@ -2195,9 +1300,9 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hCoreCoder[0] != NULL ) { - floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], q, L_FRAME32k ); + Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); + Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q; - floatToFixed_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], q, L_FRAME48k ); } IF( hCPE->hStereoDft != NULL ) { @@ -2217,7 +1322,7 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( &hSCE->save_synth_fx[0], (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; } - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; @@ -2249,27 +1354,24 @@ ivas_error ivas_jbm_dec_tc( IF( hCPE->hCoreCoder[0] != NULL ) { - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_outLB[0], q, L_FRAME32k ); - fixedToFloat_arrL( &hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx[0], &hCPE->hCoreCoder[0]->hHQ_core->old_out[0], q, L_FRAME48k ); + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_outLB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB - q ); + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->oldOut_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); } IF( hCPE->hStereoDft != NULL ) { scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; - - //fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); } IF( st_ivas->hSpar != NULL ) { - st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; - FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; move16(); + FOR( Word16 ii = 0; ii < CPE_CHANNELS; ii++ ) { scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); - hCPE->q_output_mem_fx[ii] = Q11; + hCPE->q_output_mem_fx[ii] = Q11; move16(); } } -#endif } /* HP filtering */ @@ -2285,181 +1387,43 @@ ivas_error ivas_jbm_dec_tc( } } - FOR( Word16 ch = 0; ch < 12; ch++ ) IF(p_output[ch]) - { - fixedToFloat_arrL( p_output_fx[ch], p_output[ch], Q11, L_FRAME48k ); - } - /*----------------------------------------------------------------* * Write IVAS transport channels *----------------------------------------------------------------*/ - if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) + IF ( EQ_16( st_ivas->hDecoderConfig->Opt_tsm, 1 ) ) { - ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data ); + ivas_syn_output_f_fx(p_output_fx, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data_fx ); } - else + ELSE { /* directly copy to tc buffers */ -#ifdef IVAS_FLOAT_FIXED /*note : the q of cldfb buffers (imag/real) are needed to be Q_p_output - 5 here 6 is taken for that*/ - /*------------------------flt 2 fix----------------------*/ - Word16 Q_tc = 11; - DECODER_TC_BUFFER_HANDLE hTcBuffer = st_ivas->hTcBuffer; - Word16 n_ch_full_copy_temp = s_min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); - Word16 n_ch_cldfb_tmp = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; - if ( st_ivas->hParamIsmDec != NULL ) - { - f2me_16( st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain, &st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_fx, &st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_e ); - } - // cldfb_state - - for ( int ch = 0; ch < n_ch_cldfb_tmp; ch++ ) - { - Word16 cldfb_size = st_ivas->cldfbAnaDec[ch]->cldfb_size; - for ( int lp = 0; lp < cldfb_size; lp++ ) - { - st_ivas->cldfbAnaDec[ch]->cldfb_state_fx[lp] = floatToFixed( st_ivas->cldfbAnaDec[ch]->cldfb_state[lp], Q_tc ); - } - } - // cldfb - Word16 num_freq_bands = 0; - - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - if ( st_ivas->hSpatParamRendCom != NULL ) - { - num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; - } - for ( int lp = 0; lp < n_ch_cldfb_tmp; lp++ ) - { - Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * ( n_ch_cldfb_tmp - 1 ) + st_ivas->cldfbAnaDec[lp]->no_channels; - for ( i = 0; i < length; i++ ) - { - st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[i] = - floatToFixed( st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[i], 6 ); - st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[i] = - floatToFixed( st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[i], 6 ); - } - } - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - if ( st_ivas->hParamMC != NULL ) - { - num_freq_bands = st_ivas->hParamMC->num_freq_bands; - } - for ( int lp = 0; lp < n_ch_cldfb_tmp; lp++ ) - { - Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * ( n_ch_cldfb_tmp - 1 ) + st_ivas->cldfbAnaDec[lp]->no_channels; - for ( Word16 lp2 = 0; lp2 < length; lp2++ ) - { - st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[lp2] = - floatToFixed( st_ivas->hParamMC->Cldfb_RealBuffer_tc[lp2], 6 ); - st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[lp2] = - floatToFixed( st_ivas->hParamMC->Cldfb_ImagBuffer_tc[lp2], 6 ); - } - } - } - - /*------------------------flt 2 fix----------------------*/ - for ( int lp = 0; lp < n_ch_cldfb_tmp; lp++ ) - { - floatToFixed_arrL( p_output[lp], p_output_fx[lp], 11, 960 ); - } ivas_jbm_dec_copy_tc_no_tsm_fx( st_ivas, p_output_fx, output_frame ); - /*------------------------fix 2 flt----------------------*/ - // cldfb_state - for ( int lp = 0; lp < n_ch_cldfb_tmp; lp++ ) - { - fixedToFloat_arrL( p_output_fx[lp], p_output[lp], 11, 960 ); - } - - for ( int ch = 0; ch < n_ch_cldfb_tmp; ch++ ) - { - Word16 cldfb_size = st_ivas->cldfbAnaDec[ch]->cldfb_size; - for ( int lp = 0; lp < cldfb_size; lp++ ) - { - st_ivas->cldfbAnaDec[ch]->cldfb_state[lp] = fixedToFloat( st_ivas->cldfbAnaDec[ch]->cldfb_state_fx[lp], Q_tc ); - } - } - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - if ( st_ivas->hSpatParamRendCom != NULL ) - { - num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; - } - for ( int lp = 0; lp < n_ch_cldfb_tmp; lp++ ) - { - Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * ( n_ch_cldfb_tmp - 1 ) + st_ivas->cldfbAnaDec[lp]->no_channels; - for ( Word16 lp2 = 0; lp2 < length; lp2++ ) - { - st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[lp2] = - fixedToFloat( st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[lp2], 6 ); - st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[lp2] = - fixedToFloat( st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[lp2], 6 ); - } - } - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - if ( st_ivas->hParamMC != NULL ) - { - num_freq_bands = st_ivas->hParamMC->num_freq_bands; - } - for ( int lp = 0; lp < n_ch_cldfb_tmp; lp++ ) - { - Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * ( n_ch_cldfb_tmp - 1 ) + st_ivas->cldfbAnaDec[lp]->no_channels; - for ( Word16 lp2 = 0; lp2 < length; lp2++ ) - { - st_ivas->hParamMC->Cldfb_RealBuffer_tc[lp2] = - fixedToFloat( st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[lp2], 6 ); - st_ivas->hParamMC->Cldfb_ImagBuffer_tc[lp2] = - fixedToFloat( st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[lp2], 6 ); - } - } - } - - if ( st_ivas->hParamIsmDec != NULL ) - { - st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain = me2f_16( st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_fx, st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_e ); - } - - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - FOR( int lp = 0; lp < n_ch_full_copy_temp; lp++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[lp], st_ivas->hTcBuffer->tc[lp], Q_tc, hTcBuffer->n_samples_buffered ); - } - } - /*------------------------fix 2 flt----------------------*/ -#endif } /*----------------------------------------------------------------* * Common updates *----------------------------------------------------------------*/ - if ( !st_ivas->bfi ) /* do not update if first frame(s) are lost or NO_DATA */ + IF ( !st_ivas->bfi ) /* do not update if first frame(s) are lost or NO_DATA */ { - st_ivas->hDecoderConfig->last_ivas_total_brate = ivas_total_brate; + st_ivas->hDecoderConfig->last_ivas_total_brate = ivas_total_brate; move32(); st_ivas->last_active_ivas_total_brate = ( ivas_total_brate <= IVAS_SID_5k2 ) ? st_ivas->last_active_ivas_total_brate : ivas_total_brate; } - if ( st_ivas->ini_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) ) /* keep "st_ivas->ini_frame = 0" until first good received frame */ + IF ( st_ivas->ini_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) ) /* keep "st_ivas->ini_frame = 0" until first good received frame */ { - st_ivas->ini_frame++; + st_ivas->ini_frame = add( st_ivas->ini_frame, 1 ); } - if ( st_ivas->ini_active_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && ivas_total_brate > IVAS_SID_5k2 ) /* needed in MASA decoder in case the first active frame is BFI, and there were SID-frames decoded before */ + IF ( st_ivas->ini_active_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && ivas_total_brate > IVAS_SID_5k2 ) /* needed in MASA decoder in case the first active frame is BFI, and there were SID-frames decoded before */ { - st_ivas->ini_active_frame++; + st_ivas->ini_active_frame = add( st_ivas->ini_active_frame, 1 ); } st_ivas->last_ivas_format = st_ivas->ivas_format; - - pop_wmops(); return IVAS_ERR_OK; diff --git a/lib_dec/ivas_ls_custom_dec.c b/lib_dec/ivas_ls_custom_dec.c index 7c35700f2..25a0cec62 100644 --- a/lib_dec/ivas_ls_custom_dec.c +++ b/lib_dec/ivas_ls_custom_dec.c @@ -119,10 +119,10 @@ void ivas_ls_custom_setup( } hOutSetup->ls_azimuth_fx = hLsSetupCustom->ls_azimuth_fx; hOutSetup->ls_elevation_fx = hLsSetupCustom->ls_elevation_fx; -#endif +#else hOutSetup->ls_azimuth = hLsSetupCustom->ls_azimuth; hOutSetup->ls_elevation = hLsSetupCustom->ls_elevation; - +#endif hOutSetup->num_lfe = hLsSetupCustom->num_lfe; hOutSetup->index_lfe[0] = hLsSetupCustom->lfe_idx[0]; /* IVAS_OUTPUT_SETUP only supports 1 LFE */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index c55f1b039..0cb463858 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -235,7 +235,7 @@ ivas_error ivas_param_mc_dec_open_fx( if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hLsSetupCustom->num_spk; -#if 1/*TODO: To be removed later*/ +#if 0/*TODO: To be removed later*/ st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; #endif diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 7be244980..183e03395 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -53,7 +53,9 @@ * Local function prototypes *-----------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, int16_t *data ); +#endif /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 865381ef1..e04332462 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -93,7 +93,7 @@ void mdct_read_IGF_bits_fx( return; } #endif - +#ifndef IVAS_FLOAT_FIXED void mdct_read_IGF_bits( Decoder_State *st, /* i/o: Decoder state handle */ Decoder_State *st0 /* i : pointer to handle where bitstream is read */ @@ -127,7 +127,7 @@ void mdct_read_IGF_bits( return; } - +#endif /*-----------------------------------------------------------------* * Function dec_prm_tcx_sidebits() diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 7b3202d6a..0510723e9 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -329,7 +329,7 @@ static void get_custom_ls_conversion_matrix_fx( { /* Set the values of hLsSetUpConversion->dmxMtx to EFAP gains, skipping LFE */ /*angles float2fix conversion: to be removed*/ - efap_determine_gains_fx( hEFAPdata, tmp_gains, L_shl((Word32)hTransSetup.ls_azimuth[ch_in_woLFE], Q22), L_shl((Word32)hTransSetup.ls_elevation[ch_in_woLFE], Q22), EFAP_MODE_EFAP ); + efap_determine_gains_fx( hEFAPdata, tmp_gains, hTransSetup.ls_azimuth_fx[ch_in_woLFE], hTransSetup.ls_elevation_fx[ch_in_woLFE], EFAP_MODE_EFAP ); FOR( ( ch_out = 0, ch_out_woLFE = 0 ); ch_out < nchan_out; ( ch_out++, ch_out_woLFE++ ) ) { diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 139edc693..b448f259f 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -236,27 +236,14 @@ ivas_error ivas_sce_dec_fx( /*----------------------------------------------------------------* * Decoder *----------------------------------------------------------------*/ -#ifndef TO_BE_REMOVED_CONVERSION - if (st->hHQ_core != NULL) - { - floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_wtda, L_FRAME48k); - floatToFixed_arr(st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_wtda_LB, L_FRAME32k); - floatToFixed_arrL(st->hHQ_core->old_outLB, st->hHQ_core->old_outLB_fx, 11, L_FRAME32k); - } -#endif - set32_fx(output[0], 0, L_FRAME48k); + + set32_fx( output[0], 0, L_FRAME48k ); IF( ( error = ivas_core_dec( st_ivas, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { return error; } - IF ( st->hHQ_core != NULL ) - { - fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k ); - fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - } - IF( st_ivas->sba_dirac_stereo_flag && ( GT_32( st->core_brate, SID_2k40 ) || EQ_16( st->cng_type, LP_CNG ) ) ) { /* skip addition of ACELP BWE for now, will be done after upmix */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7bbf1b85a..40f8de567 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -2915,9 +2915,6 @@ void ivas_spar_dec_upmixer_sf_fx( ) { /*TODO: To be removed later--------------------------------------------------------*/ - float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; - float *cldfb_in_ts_im[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX]; - float Pcm_tmp[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_output[MAX_OUTPUT_CHANNELS]; /*---------------------------------------------------------------------------*/ @@ -3011,14 +3008,8 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { - /*TODO:To be removed when ivas_dirac_dec_render_sf is integerated*/ - cldfb_in_ts_re[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands]; - cldfb_in_ts_im[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; - /****************************************************************/ -#ifdef IVAS_FLOAT_FIXED cldfb_in_ts_re_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands]; cldfb_in_ts_im_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; -#endif } } } @@ -3028,14 +3019,8 @@ void ivas_spar_dec_upmixer_sf_fx( { FOR ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { - /*TODO:To be removed when ivas_dirac_dec_render_sf is integerated*/ - cldfb_in_ts_re[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands]; - cldfb_in_ts_im[in_ch][ts] = &Pcm_tmp[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; - /****************************************************************/ -#ifdef IVAS_FLOAT_FIXED cldfb_in_ts_re_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands]; cldfb_in_ts_im_fx[in_ch][ts] = &Pcm_tmp_fx[in_ch][ts * num_cldfb_bands + 4 * num_cldfb_bands]; -#endif } } } @@ -3204,36 +3189,6 @@ void ivas_spar_dec_upmixer_sf_fx( } } -#ifdef IVAS_FLOAT_FIXED /*Fixed to float */ - IF(NE_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA)) - { - FOR(in_ch = 0; in_ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; in_ch++) - { - FOR(ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++) - { - FOR(i = 0; i < CLDFB_NO_CHANNELS_MAX; i++) - { - cldfb_in_ts_re[in_ch][ts][i] = (float)(cldfb_in_ts_re_fx[in_ch][ts][i]) / (float)(1LL << 6); /*Resultant q is 6*/ - cldfb_in_ts_im[in_ch][ts][i] = (float)(cldfb_in_ts_im_fx[in_ch][ts][i]) / (float)(1LL << 6); /*Resultant q is 6*/ - } - } - } - } - ELSE - { - FOR ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - FOR ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - cldfb_in_ts_re[in_ch][ts][i] = (float) ( cldfb_in_ts_re_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ - cldfb_in_ts_im[in_ch][ts][i] = (float) ( cldfb_in_ts_im_fx[in_ch][ts][i] ) / (float) ( 1LL << 6 ); /*Resultant q is 6*/ - } - } - } - } -#endif IF ( NE_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_FOA) && NE_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_STEREO) && NE_16(hDecoderConfig->output_config , IVAS_AUDIO_CONFIG_MONO) ) { FOR( Word16 ch = 0; ch < add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ); ch++ ) @@ -3242,14 +3197,10 @@ void ivas_spar_dec_upmixer_sf_fx( p_output[ch] = output[ch]; } #ifdef MSAN_FIX - ivas_dirac_dec_render_sf_fx( st_ivas, p_output, output_fx, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); + ivas_dirac_dec_render_sf_fx( st_ivas, p_output, output_fx, nchan_internal, cldfb_in_ts_re_fx, cldfb_in_ts_im_fx ); #else - ivas_dirac_dec_render_sf_fx( st_ivas, p_output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); + ivas_dirac_dec_render_sf_fx( st_ivas, p_output, nchan_internal, cldfb_in_ts_re_fx, cldfb_in_ts_im_fx ); #endif // MSAN_FIX - FOR( Word16 ch = 0; ch < add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ); ch++ ) - { - floatToFixed_arrL( output[ch], output_fx[ch], Q11, out_len ); - } /*TODO: To be removed later when ivas_dirac_dec_render_sf is integerated*/ FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { @@ -3262,39 +3213,6 @@ void ivas_spar_dec_upmixer_sf_fx( } } } -#ifdef MSAN_FIX - IF(NE_16(hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA)) - { - FOR(out_ch = 0; out_ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; out_ch++) - { - FOR(ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++) - { - floatToFixed_arrL(cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, num_cldfb_bands); - floatToFixed_arrL(cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, num_cldfb_bands); - } - } - } - ELSE - { - FOR( out_ch = 0; out_ch < st_ivas->hOutSetup.nchan_out_woLFE; out_ch++ ) - { - FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - floatToFixed_arrL( cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, num_cldfb_bands ); - floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, num_cldfb_bands ); - } - } - } -#else - FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - floatToFixed_arrL( cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, 60 ); - floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, 60 ); - } - } -#endif /*------------------------------------------------------------------ends*/ IF ( st_ivas->hDirAC != NULL ) { diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 95f6d119b..0aa7f0f61 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -145,7 +145,7 @@ void stereo_dft_dec_reset_fx( move16(); bass_psfilter_init_fx( hStereoDft->hBpf ); - tcxltp_dec_init( hStereoDft->hTcxLtpDec, 0, MODE1, IVAS_CPE_DFT, PIT_MAX, 12800 ); + tcxltp_dec_init_fx( hStereoDft->hTcxLtpDec, 0, MODE1, IVAS_CPE_DFT, PIT_MAX, 12800 ); hStereoDft->reverb_flag = 0; move16(); @@ -3351,11 +3351,11 @@ void stereo_dft_dec_read_BS_fx( /* read number of bands in the bitstream - depends on the audio bandwidth and not to output_Fs */ IF( hStereoDft->frame_sid ) { - NFFT_inner = mult( inner_frame_tbl[bwidth], divide1616( STEREO_DFT32MS_N_MAX, L_FRAME48k ) ); + NFFT_inner = mult_r( inner_frame_tbl[bwidth], divide1616( STEREO_DFT32MS_N_MAX, L_FRAME48k ) ); } ELSE { - NFFT_inner = mult( inner_frame_tbl[st->bwidth], divide1616( STEREO_DFT32MS_N_MAX, L_FRAME48k ) ); + NFFT_inner = mult_r( inner_frame_tbl[st->bwidth], divide1616( STEREO_DFT32MS_N_MAX, L_FRAME48k ) ); } /* Use coarse band partition in inactive frames */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 207232428..99534d9b9 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -287,7 +287,7 @@ void stereo_mdct_core_dec_fx( { L_spec[ch] = idiv1616(sts[ch]->hTcxCfg->tcx_coded_lines, nSubframes[ch]); - init_tcx_info( sts[ch], sts[ch]->L_frame / nSubframes[ch], sts[ch]->hTcxDec->L_frameTCX / nSubframes[ch], k, bfi, &tcx_offset[ch], &tcx_offsetFB[ch], &L_frame[ch], &L_frameTCX[ch], &left_rect[ch], &L_spec[ch] ); + init_tcx_info_fx( sts[ch], sts[ch]->L_frame / nSubframes[ch], sts[ch]->hTcxDec->L_frameTCX / nSubframes[ch], k, bfi, &tcx_offset[ch], &tcx_offsetFB[ch], &L_frame[ch], &L_frameTCX[ch], &left_rect[ch], &L_spec[ch] ); } } diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 55f04691e..b8a5cc5c0 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -176,10 +176,6 @@ static ivas_error allocate_CoreCoder_TCX_fx( } tcxltp_dec_init_fx( st->hTcxLtpDec, 0, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core ); - -#if 1 // TODO: TO be removed later - tcxltp_dec_init( st->hTcxLtpDec, 0, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core ); -#endif } /* allocate HQ structure */ @@ -203,9 +199,6 @@ static ivas_error allocate_CoreCoder_TCX_fx( st->igf = 0; move16(); init_igf_dec( st->hIGFDec ); -#if 1 // TODO: TO be removed later - init_igf_dec_flt( st->hIGFDec ); -#endif } IF ( st->hTonalMDCTConc == NULL ) @@ -3156,7 +3149,7 @@ void stereo_switching_dec( sts[1]->last_coder_type = sts[0]->last_coder_type; #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - mvr2r( sts[0]->hHQ_core->old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); + //mvr2r( sts[0]->hHQ_core->old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); //mvr2r( sts[0]->hTcxDec->old_syn_Overl_float, sts[1]->hTcxDec->old_syn_Overl_float, 256 ); #endif #ifndef IVAS_FLOAT_FIXED diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 7fe92402c..97c00f323 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -79,6 +79,10 @@ struct IVAS_DEC Word16 tsm_max_scaling; float tsm_quality; float *apaExecBuffer; /* Buffer for APA scaling */ + +#ifdef IVAS_FLOAT_FIXED + Word32 *apaExecBuffer_fx; /* Buffer for APA scaling */ +#endif PCMDSP_APA_HANDLE hTimeScaler; bool needNewFrame; bool hasBeenFedFrame; @@ -105,7 +109,7 @@ static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_form static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const UWord16 nTransportChannels, const UWord16 l_ts ); static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, UWord16 *nTcBufferGranularity, UWord8 *nTransportChannels, UWord8 *nOutChannels, UWord16 *nSamplesRendered, Word16 *data ); -static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, Word16 *nOutSamples ); +static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, Word32 *pcmBuf_fx, Word16 *nOutSamples ); static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesForRendering, Word16 *nSamplesResidual, float *pcmBuf ); static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const UWord16 nSamplesForRendering, UWord16 *nSamplesRendered, UWord16 *nSamplesAvailableNext, Word16 *pcmBuf ); static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, Word16 *nSamplesBuffered ); @@ -143,6 +147,9 @@ ivas_error IVAS_DEC_Open( hIvasDec = *phIvasDec; hIvasDec->hVoIP = NULL; hIvasDec->apaExecBuffer = NULL; +#ifdef IVAS_FLOAT_FIXED + hIvasDec->apaExecBuffer_fx = NULL; +#endif hIvasDec->hTimeScaler = NULL; hIvasDec->tsm_scale = 100; hIvasDec->tsm_max_scaling = 0; @@ -297,6 +304,12 @@ void IVAS_DEC_Close( { free( ( *phIvasDec )->apaExecBuffer ); } +#ifdef IVAS_FLOAT_FIXED + IF( ( *phIvasDec )->apaExecBuffer_fx != NULL ) + { + free( ( *phIvasDec )->apaExecBuffer_fx ); + } +#endif free( *phIvasDec ); *phIvasDec = NULL; phIvasDec = NULL; @@ -918,7 +931,7 @@ ivas_error IVAS_DEC_GetSamples( } /* IVAS decoder */ - IF( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) + IF( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer, hIvasDec->apaExecBuffer_fx, &nOutSamplesElse ) ) != IVAS_ERR_OK ) { return error; } @@ -1059,6 +1072,7 @@ static ivas_error IVAS_DEC_Setup( static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ float *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + Word32 *pcmBuf_fx, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ Word16 *nOutSamples /* o : number of samples per channel written to output buffer */ ) { @@ -1081,17 +1095,334 @@ static ivas_error IVAS_DEC_GetTcSamples( return error; } } - ELSE IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_IVAS ) ) + ELSE IF(EQ_16((Word16)hIvasDec->mode, IVAS_DEC_MODE_IVAS)) { /* run the main IVAS decoding routine */ - IF( ( error = ivas_jbm_dec_tc( st_ivas, pcmBuf ) ) != IVAS_ERR_OK ) + /*------------------------flt 2 fix----------------------*/ + Word16 l, n; + Decoder_State *st, **sts; /* used for bitstream handling */ + MCT_DEC_HANDLE hMCT; + Word16 ch, nCPE, cpe_id; + nCPE = st_ivas->nCPE; + Word16 Q_tc = 11; + DECODER_TC_BUFFER_HANDLE hTcBuffer = st_ivas->hTcBuffer; + Word16 n_ch_cldfb_tmp = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; + hMCT = st_ivas->hMCT; + Word16 num_freq_bands = 0; + /* Float to Fixed */ + + Word16 n_ch_full_copy_temp = s_min(hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full); + IF(pcmBuf != NULL) + { + floatToFixed_arrL(pcmBuf, pcmBuf_fx, 11, (Word16)(st_ivas->hTcBuffer->nchan_transport_jbm * st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC)); + } + + IF(EQ_16(st_ivas->hDecoderConfig->Opt_tsm, 0)) { + FOR( n = 0; n < ivas_get_nchan_buffers_dec_ivas_fx(st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); n++) + { + set_zero(st_ivas->p_output_f[n], L_FRAME48k); + st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; + } + } + + +#if 1 + CPE_DEC_HANDLE hCPE; + IF(((st_ivas->mc_mode == MC_MODE_PARAMUPMIX) || (st_ivas->mc_mode == MC_MODE_MCT) || st_ivas->ivas_format == SBA_ISM_FORMAT || (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT) || st_ivas->mc_mode == MC_MODE_PARAMMC) && (GT_16(st_ivas->nCPE, 1))) { + + nCPE = st_ivas->nCPE; + move16(); + hMCT = st_ivas->hMCT; + FOR(cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++) + { + hCPE = st_ivas->hCPE[cpe_id]; + sts = hCPE->hCoreCoder; + + + FOR(n = 0; n < CPE_CHANNELS; n++) + { + st = hCPE->hCoreCoder[n]; + IF(sts[n]->mct_chan_mode != MCT_CHAN_MODE_IGNORE) + { + // u8bit to 16bit + FOR(l = 0; l < IGF_START_MX; l++) + { + sts[n]->hIGFDec->infoTCXNoise_evs[l] = (Word16)sts[n]->hIGFDec->infoTCXNoise[l]; + } + } + IF(st->hTcxDec) + st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; + IF(st->hTcxDec) + st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; + + /*cldfb struct*/ + + /*------------------fix-to-fix-start---------------------*/ + /*core_switching_post_dec*/ + IF(hCPE->hCoreCoder[n]->hHQ_core != NULL) + { + hCPE->hCoreCoder[n]->hHQ_core->Q_old_postdec = 0; + hCPE->hCoreCoder[n]->hHQ_core->Q_old_wtda = 0; + } + } + } + } + + IF( NE_16( st_ivas->hDecoderConfig->Opt_tsm, 1) ) { + + IF (st_ivas->hParamIsmDec != NULL) + { + f2me_16(st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain, &st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_fx, &st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_e); + } + // cldfb_state + + FOR ( ch = 0; ch < n_ch_cldfb_tmp; ch++) + { + Word16 cldfb_size = st_ivas->cldfbAnaDec[ch]->cldfb_size; + FOR (Word16 lp = 0; lp < cldfb_size; lp++) + { + st_ivas->cldfbAnaDec[ch]->cldfb_state_fx[lp] = floatToFixed(st_ivas->cldfbAnaDec[ch]->cldfb_state[lp], Q_tc); + } + } + // cldfb + + + IF (st_ivas->ivas_format == ISM_FORMAT) + { + IF (st_ivas->hSpatParamRendCom != NULL) + { + num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; + } + FOR (Word16 lp = 0; lp < n_ch_cldfb_tmp; lp++) + { + Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * (n_ch_cldfb_tmp - 1) + st_ivas->cldfbAnaDec[lp]->no_channels; + FOR (Word16 i = 0; i < length; i++) + { + st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[i] = + floatToFixed(st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[i], 6); + st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[i] = + floatToFixed(st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[i], 6); + } + } + } + ELSE IF(st_ivas->ivas_format == MC_FORMAT) + { + IF(st_ivas->hParamMC != NULL) + { + num_freq_bands = st_ivas->hParamMC->num_freq_bands; + } + FOR(Word16 lp = 0; lp < n_ch_cldfb_tmp; lp++) + { + Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * (n_ch_cldfb_tmp - 1) + st_ivas->cldfbAnaDec[lp]->no_channels; + FOR(Word16 lp2 = 0; lp2 < length; lp2++) + { + st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[lp2] = + floatToFixed(st_ivas->hParamMC->Cldfb_RealBuffer_tc[lp2], 6); + st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[lp2] = + floatToFixed(st_ivas->hParamMC->Cldfb_ImagBuffer_tc[lp2], 6); + } + } + } + } +#endif + + /* Function call: ivas_jbm_dec_tc function */ + IF((error = ivas_jbm_dec_tc_fx(st_ivas, pcmBuf_fx)) != IVAS_ERR_OK) { return error; } +#if 1 + /* Fixed to Float */ + IF(pcmBuf != NULL) + { + fixedToFloat_arrL(pcmBuf_fx, pcmBuf, 11, (Word16)(st_ivas->hTcBuffer->nchan_transport_jbm * st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC)); + } + + FOR(n = 0; n < MAX_TRANSPORT_CHANNELS; n++) { + IF(st_ivas->p_output_f[n] != NULL) + { + fixedToFloat_arrL(st_ivas->p_output_fx[n], st_ivas->p_output_f[n], 11, L_FRAME48k); + } + } + + IF( NE_16( st_ivas->hDecoderConfig->Opt_tsm, 1 ) ) + { + FOR(Word16 lp = 0; lp < n_ch_full_copy_temp; lp++) + { + fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[lp], st_ivas->hTcBuffer->tc[lp], Q11, st_ivas->hTcBuffer->n_samples_buffered); + } + + FOR( ch = 0; ch < n_ch_cldfb_tmp; ch++) + { + Word16 cldfb_size = st_ivas->cldfbAnaDec[ch]->cldfb_size; + FOR(Word16 lp = 0; lp < cldfb_size; lp++) + { + st_ivas->cldfbAnaDec[ch]->cldfb_state[lp] = fixedToFloat(st_ivas->cldfbAnaDec[ch]->cldfb_state_fx[lp], Q_tc); + } + } + IF(st_ivas->ivas_format == ISM_FORMAT) + { + IF(st_ivas->hSpatParamRendCom != NULL) + { + num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; + } + FOR(Word16 lp = 0; lp < n_ch_cldfb_tmp; lp++) + { + Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * (n_ch_cldfb_tmp - 1) + st_ivas->cldfbAnaDec[lp]->no_channels; + FOR(Word16 lp2 = 0; lp2 < length; lp2++) + { + st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[lp2] = + fixedToFloat(st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[lp2], 6); + st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[lp2] = + fixedToFloat(st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[lp2], 6); + } + } + } + ELSE IF(st_ivas->ivas_format == MC_FORMAT) + { + IF(st_ivas->hParamMC != NULL) + { + num_freq_bands = st_ivas->hParamMC->num_freq_bands; + } + FOR(Word16 lp = 0; lp < n_ch_cldfb_tmp; lp++) + { + Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * (n_ch_cldfb_tmp - 1) + st_ivas->cldfbAnaDec[lp]->no_channels; + FOR(Word16 lp2 = 0; lp2 < length; lp2++) + { + st_ivas->hParamMC->Cldfb_RealBuffer_tc[lp2] = + fixedToFloat(st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[lp2], 6); + st_ivas->hParamMC->Cldfb_ImagBuffer_tc[lp2] = + fixedToFloat(st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[lp2], 6); + } + } + } + + IF(st_ivas->hParamIsmDec != NULL) + { + st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain = me2f_16(st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_fx, st_ivas->hParamIsmDec->hParamIsm->last_dmx_gain_e); + } + /*------------------------fix 2 flt----------------------*/ + } + hIvasDec->isInitialized = true; /* Initialization done in ivas_dec() */ - } + IF((st_ivas->ivas_format == MASA_FORMAT && st_ivas->hQMetaData != NULL) || (st_ivas->ivas_format == MASA_ISM_FORMAT)) + { + // Fix to float conversion starts here. + IF(st_ivas->hSpatParamRendCom != NULL) + { + FOR(Word16 i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++) + { + FOR(Word16 j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++) + { + st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30); + st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30); + IF(EQ_32(st_ivas->hQMetaData->no_directions, 2)) + { + st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30); + st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15); + } + st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15); + st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15); + } + } + } + st_ivas->hMasa->data.dir_decode_quality = fix16_to_float(st_ivas->hMasa->data.dir_decode_quality_fx, Q14); + IF(st_ivas->hSpatParamRendCom != NULL) + { + FOR(Word16 i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++) + { + FOR(Word16 block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++) + { + FOR(Word16 b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++) + { + st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b] = fix_to_float(st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][block][b], Q30); + } + } + } + } + } + + IF(((st_ivas->mc_mode == MC_MODE_PARAMUPMIX) || (st_ivas->mc_mode == MC_MODE_MCT) || st_ivas->ivas_format == SBA_ISM_FORMAT || (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT) || st_ivas->mc_mode == MC_MODE_PARAMMC) && (GT_16(st_ivas->nCPE, 1))) { + FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) + { + hCPE = st_ivas->hCPE[cpe_id]; + sts = hCPE->hCoreCoder; + FOR(ch = 0; ch < CPE_CHANNELS; ch++) + { + st = hCPE->hCoreCoder[ch]; + IF(sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE) + { + // 16bit to u8bit + FOR(l = 0; l < IGF_START_MX; l++) + { + sts[ch]->hIGFDec->infoTCXNoise[l] = (UWord8) sts[ch]->hIGFDec->infoTCXNoise_evs[l]; + } + } + } + + FOR(n = 0; n < 2; n++) + { + st = hCPE->hCoreCoder[n]; + sts = hCPE->hCoreCoder; + + /*-------------------cldfb-start-------------------------*/ + /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ + IF (sts[n]->cldfbAna != NULL) + { + fixedToFloat_arrL(sts[n]->cldfbAna->cldfb_state_fx, sts[n]->cldfbAna->cldfb_state, 10, sts[n]->cldfbAna->cldfb_state_length); + } + IF (sts[n]->cldfbSyn != NULL) + { + fixedToFloat_arrL(sts[n]->cldfbSyn->cldfb_state_fx, sts[n]->cldfbSyn->cldfb_state, 4, sts[n]->cldfbSyn->p_filter_length); + } + IF (sts[n]->cldfbBPF != NULL) + { + fixedToFloat_arrL(sts[n]->cldfbBPF->cldfb_state_fx, sts[n]->cldfbBPF->cldfb_state, 11, sts[n]->cldfbBPF->cldfb_state_length); + } + + /*-------------------cldfb-end---------------------------*/ + + /* reset WB BWE buffers */ + + IF(NE_16(sts[n]->last_extl, WB_BWE) && EQ_16(sts[n]->extl, WB_BWE) && sts[n]->hBWE_FD != NULL) + { + + IF(NE_16(sts[n]->last_extl, SWB_BWE) && NE_16(sts[n]->last_extl, FB_BWE)) + { + sts[n]->hBWE_FD->prev_mode = sts[n]->hBWE_FD->prev_mode; + } + sts[n]->hBWE_FD->prev_L_swb_norm = sts[n]->hBWE_FD->prev_L_swb_norm; + sts[n]->hBWE_FD->prev_flag = sts[n]->hBWE_FD->prev_flag; + } + } + } + + + IF(st_ivas->hCPE[0]->hCoreCoder[0]->igf) + { + IF(!hMCT->currBlockDataCnt) + { + FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) + { + FOR(ch = 0; ch < CPE_CHANNELS; ch++) + { + IF(st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->igf) + { + FOR(l = 0; l < IGF_START_MX; l++) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise[l] = (UWord8)st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hIGFDec->infoTCXNoise_evs[l]; + } + } + } + } + } + } + } +#endif // fixed to float + + } IF( hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->hasDecodedFirstGoodFrame = true; @@ -1393,6 +1724,10 @@ ivas_error IVAS_DEC_GetObjectMetadata( metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag; } +#ifdef IVAS_FLOAT_FIXED + metadata->azimuth_fx = floatToFixed(metadata->azimuth,Q22); + metadata->elevation_fx = floatToFixed(metadata->elevation,Q22); +#endif return IVAS_ERR_OK; } @@ -3131,6 +3466,15 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); + +#ifdef IVAS_FLOAT_FIXED + IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + + set_zero_fx( hIvasDec->apaExecBuffer_fx, apa_buffer_size * nTransportChannels ); +#endif } } ELSE @@ -3148,6 +3492,15 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); + +#ifdef IVAS_FLOAT_FIXED + free( hIvasDec->apaExecBuffer_fx ); + IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + set_zero_fx( hIvasDec->apaExecBuffer_fx, apa_buffer_size * nTransportChannels ); +#endif } /* realloc apa_exe_buffer */ } diff --git a/lib_dec/peak_vq_dec.c b/lib_dec/peak_vq_dec.c index b48e384df..56cb50050 100644 --- a/lib_dec/peak_vq_dec.c +++ b/lib_dec/peak_vq_dec.c @@ -48,13 +48,21 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dequant_peaks( Decoder_State *st, float *vect_out, const float *peak_gain ); +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t hvq_dec_pos( Decoder_State *st, int16_t *pos_vec, const int16_t length, const int16_t num_peaks ); +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t sparse_dec_pos( Decoder_State *st, int16_t *out, const int16_t length ); +#endif +#ifndef IVAS_FLOAT_FIXED static void peak_vq_dec( Decoder_State *st, float *coefs_out, const int32_t core_brate, const int16_t num_bits, const int16_t *ynrm, int16_t *R, int16_t *vq_peak_idx, int16_t *Npeaks, const int16_t core ); +#endif /*-------------------------------------------------------------------------- @@ -63,6 +71,7 @@ static void peak_vq_dec( Decoder_State *st, float *coefs_out, const int32_t core * HVQ decoder *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void hvq_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t num_bits, /* i : Number of available bits */ @@ -94,6 +103,7 @@ void hvq_dec( return; } +#endif /*-------------------------------------------------------------------------- @@ -102,6 +112,7 @@ void hvq_dec( * Vector de-quantization of MDCT peaks *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void peak_vq_dec( Decoder_State *st, /* i/o: decoder state structure */ float *coefs_out, /* o : Output coefficient vector */ @@ -343,6 +354,7 @@ static void peak_vq_dec( return; } +#endif /*-------------------------------------------------------------------------- * dequant_peaks() @@ -350,6 +362,7 @@ static void peak_vq_dec( * Reads codebook vector and scales peak *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dequant_peaks( Decoder_State *st, /* i/o: decoder state structure */ float *vect_out, /* o : Quantized vector */ @@ -402,6 +415,7 @@ static void dequant_peaks( return; } +#endif /*-------------------------------------------------------------------------- * hvq_dec_pos() @@ -409,6 +423,7 @@ static void dequant_peaks( * HVQ decode peak positions *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t hvq_dec_pos( Decoder_State *st, /* i/o: decoder state structure */ int16_t *pos_vec, /* o : decoded peak positions */ @@ -483,7 +498,9 @@ static int16_t hvq_dec_pos( return num_bits; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * sparse_dec_pos() * @@ -540,3 +557,4 @@ static int16_t sparse_dec_pos( return bits; } +#endif diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 45b8bbcfc..eb4aeca2f 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1324,23 +1324,23 @@ typedef struct hq_nbfec_structure typedef struct hq_dec_structure { +#ifndef IVAS_FLOAT_FIXED float old_out[L_FRAME48k]; /* HQ core - previous synthesis for OLA */ -#ifdef IVAS_FLOAT_FIXED - Word32 oldOut_fx[L_FRAME48k]; /* HQ core - previous synthesis for OLA */ #endif + Word32 oldOut_fx[L_FRAME48k]; /* HQ core - previous synthesis for OLA */ Word16 old_out_fx[L_FRAME48k]; /* HQ core - previous synthesis for OLA */ Word16 Q_old_out; #ifdef IVAS_FLOAT_FIXED Word16 exp_old_out; #endif +#ifndef IVAS_FLOAT_FIXED float old_outLB[L_FRAME32k]; - Word16 old_out_LB_fx[L_FRAME32k]; /* HQ core - previous synthesis for OLA for Low Band */ - Word16 Q_old_outLB; -#ifdef IVAS_FLOAT_FIXED - Word32 old_outLB_fx[L_FRAME32k]; - Word16 q_old_outLB_fx; #endif + Word16 old_out_LB_fx[L_FRAME32k]; /* HQ core - previous synthesis for OLA for Low Band */ + Word16 Q_old_outLB; + Word32 old_outLB_fx[L_FRAME32k]; + Word16 q_old_outLB_fx; Word16 Q_old_wtda_LB; Word16 Q_old_wtda; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 67f70250c..a24ade9d3 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -407,12 +407,13 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } + set32_fx( dirac_output_synthesis_state->reference_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); + dirac_output_synthesis_state->reference_power_smooth_prev_q = Q31; + IF( ( dirac_output_synthesis_state->direction_smoothness_prev_fx = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } - set32_fx( dirac_output_synthesis_state->reference_power_smooth_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); - dirac_output_synthesis_state->reference_power_smooth_prev_q = Q31; set32_fx( dirac_output_synthesis_state->direction_smoothness_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); /*TODO : remove float code*/ @@ -6787,4 +6788,4 @@ static void normalizePanningGains( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index ef12aa814..22d904986 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1539,6 +1539,9 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx = hDirAC_mem->proto_power_smooth_fx; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = Q31; + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = Q31; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = Q31; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = Q31; set_s( hDirACRend->q_buffer_energy, Q31, CLDFB_NO_CHANNELS_MAX ); set_s( hDirACRend->q_buffer_intensity_real, Q31, CLDFB_NO_CHANNELS_MAX ); #endif @@ -1779,6 +1782,7 @@ ivas_error ivas_dirac_alloc_mem( #ifdef MSAN_FIX set_zero( hDirAC_mem->onset_filter, num_outputs_diff * num_freq_bands); set_zero_fx( hDirAC_mem->onset_filter_fx, num_outputs_diff * num_freq_bands ); + hDirAC_mem->q_onset_filter = Q31; #endif hDirAC_mem->onset_filter_len = 2 * num_freq_bands; #endif @@ -1817,6 +1821,7 @@ ivas_error ivas_dirac_alloc_mem( #ifdef MSAN_FIX set_zero( hDirAC_mem->onset_filter, 2 * num_freq_bands ); set_zero_fx( hDirAC_mem->onset_filter_fx, 2 * num_freq_bands ); + hDirAC_mem->q_onset_filter = Q31; #endif hDirAC_mem->onset_filter_len = 2 * num_freq_bands; #endif @@ -6528,4 +6533,4 @@ void ivas_masa_ext_dirac_render_fx( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index ba2b6e575..9f461a590 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -1628,6 +1628,10 @@ ivas_error ivas_td_binaural_renderer_ext_fx( num_src = 1; transport_config = IVAS_AUDIO_CONFIG_ISM1; hIsmMetaData[0] = &hIsmMetaDataFrame; +#ifdef IVAS_FLOAT_FIXED + hIsmMetaData[0]->azimuth_fx = currentPos->azimuth_fx; + hIsmMetaData[0]->elevation_fx = currentPos->elevation_fx; +#endif // IVAS_FLOAT_FIXED hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; hIsmMetaData[0]->yaw = currentPos->yaw; @@ -1736,7 +1740,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( { for (j = 0; j < L_FRAME48k; j++) { - output[ch][j] = (Word32)output_fl[ch][j] * (1 << (exp)); + output[ch][j] = (Word32)(output_fl[ch][j] * (1 << (exp))); } } #endif diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 3494c4266..bc3fb87dc 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -240,10 +240,6 @@ void ivas_output_init( ELSE { /* Set default values for all other than custom LS setup */ - // To be removed later:->Floating-point pointer assignments-------- - hOutSetup->ls_azimuth = NULL; - hOutSetup->ls_elevation = NULL; - //--------------------------------------------------------ends here hOutSetup->ls_azimuth_fx = NULL; hOutSetup->ls_elevation_fx = NULL; hOutSetup->num_lfe = 0; @@ -258,10 +254,6 @@ void ivas_output_init( BREAK; case IVAS_AUDIO_CONFIG_STEREO: hOutSetup->is_loudspeaker_setup = 1; - // To be removed later:->Floating-point pointer assignments-------- - hOutSetup->ls_azimuth = ls_azimuth_CICP2; - hOutSetup->ls_elevation = ls_elevation_CICP2; - //---------------------------------------------------------ends here hOutSetup->ls_azimuth_fx = ls_azimuth_CICP2_fx; hOutSetup->ls_elevation_fx = ls_elevation_CICP2_fx; BREAK; @@ -278,10 +270,6 @@ void ivas_output_init( hOutSetup->num_lfe = 1; hOutSetup->index_lfe[0] = 3; hOutSetup->is_loudspeaker_setup = 1; - // To be removed later:->Floating-point pointer assignments-------- - hOutSetup->ls_azimuth = ls_azimuth_CICP6; - hOutSetup->ls_elevation = ls_elevation_CICP6; - //---------------------------------------------------------ends here hOutSetup->ls_azimuth_fx = ls_azimuth_CICP6_fx; hOutSetup->ls_elevation_fx = ls_elevation_CICP6_fx; hOutSetup->is_planar_setup = 1; @@ -290,10 +278,6 @@ void ivas_output_init( hOutSetup->num_lfe = 1; hOutSetup->index_lfe[0] = 3; hOutSetup->is_loudspeaker_setup = 1; - // To be removed later:->Floating-point pointer assignments-------- - hOutSetup->ls_azimuth = ls_azimuth_CICP12; - hOutSetup->ls_elevation = ls_elevation_CICP12; - //---------------------------------------------------------ends here hOutSetup->ls_azimuth_fx = ls_azimuth_CICP12_fx; hOutSetup->ls_elevation_fx = ls_elevation_CICP12_fx; hOutSetup->is_planar_setup = 1; @@ -302,10 +286,6 @@ void ivas_output_init( hOutSetup->num_lfe = 1; hOutSetup->index_lfe[0] = 3; hOutSetup->is_loudspeaker_setup = 1; - // To be removed later:->Floating-point pointer assignments-------- - hOutSetup->ls_azimuth = ls_azimuth_CICP14; - hOutSetup->ls_elevation = ls_elevation_CICP14; - //---------------------------------------------------------ends here hOutSetup->ls_azimuth_fx = ls_azimuth_CICP14_fx; hOutSetup->ls_elevation_fx = ls_elevation_CICP14_fx; hOutSetup->is_planar_setup = 0; @@ -314,10 +294,6 @@ void ivas_output_init( hOutSetup->num_lfe = 1; hOutSetup->index_lfe[0] = 3; hOutSetup->is_loudspeaker_setup = 1; - // To be removed later:->Floating-point pointer assignments-------- - hOutSetup->ls_azimuth = ls_azimuth_CICP16; - hOutSetup->ls_elevation = ls_elevation_CICP16; - //---------------------------------------------------------ends here hOutSetup->ls_azimuth_fx = ls_azimuth_CICP16_fx; hOutSetup->ls_elevation_fx = ls_elevation_CICP16_fx; hOutSetup->is_planar_setup = 0; @@ -326,10 +302,6 @@ void ivas_output_init( hOutSetup->num_lfe = 1; hOutSetup->index_lfe[0] = 3; hOutSetup->is_loudspeaker_setup = 1; - // To be removed later:->Floating-point pointer assignments-------- - hOutSetup->ls_azimuth = ls_azimuth_CICP19; - hOutSetup->ls_elevation = ls_elevation_CICP19; - //---------------------------------------------------------ends here hOutSetup->ls_azimuth_fx = ls_azimuth_CICP19_fx; hOutSetup->ls_elevation_fx = ls_elevation_CICP19_fx; hOutSetup->is_planar_setup = 0; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index c2d84fab9..d5e8ee954 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1131,10 +1131,11 @@ void rotateFrame_sd( ch_in_woLFE = ( ch_in >= index_lfe ) ? sub( ch_in, 1 ) : ch_in; /* gains for previous subframe rotation */ - rotateAziEle_fx( (Word16) hTransSetup.ls_azimuth[ch_in_woLFE], (Word16) hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev_fx, hTransSetup.is_planar_setup ); + rotateAziEle_fx((Word16)L_shr(hTransSetup.ls_azimuth_fx[ch_in_woLFE], Q22), (Word16)L_shr(hTransSetup.ls_elevation_fx[ch_in_woLFE], Q22), &azimuth, &elevation, hCombinedOrientationData->Rmat_prev_fx, hTransSetup.is_planar_setup); + test(); test(); - IF( hEFAPdata != NULL && ( hTransSetup.ls_azimuth[ch_in_woLFE] != azimuth || hTransSetup.ls_elevation[ch_in_woLFE] != elevation ) ) + IF( hEFAPdata != NULL && ((Word16)L_shr(hTransSetup.ls_azimuth_fx[ch_in_woLFE], Q22) != azimuth || (Word16)L_shr(hTransSetup.ls_elevation_fx[ch_in_woLFE], Q22) != elevation ) ) { azimuth_fx = L_shl( (Word32) azimuth, Q22 ); elevation_fx = L_shl( (Word32) elevation, Q22 ); @@ -1156,9 +1157,9 @@ void rotateFrame_sd( } /* gains for current subframe rotation */ - rotateAziEle_fx( (Word16) hTransSetup.ls_azimuth[ch_in_woLFE], (Word16) hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hTransSetup.is_planar_setup ); + rotateAziEle_fx((Word16)L_shr(hTransSetup.ls_azimuth_fx[ch_in_woLFE], Q22), (Word16)L_shr(hTransSetup.ls_elevation_fx[ch_in_woLFE], Q22), &azimuth, &elevation, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hTransSetup.is_planar_setup); - IF( hEFAPdata != NULL && ( hTransSetup.ls_azimuth[ch_in_woLFE] != azimuth || hTransSetup.ls_elevation[ch_in_woLFE] != elevation ) ) + IF( hEFAPdata != NULL && ((Word16)L_shr(hTransSetup.ls_azimuth_fx[ch_in_woLFE], Q22) != azimuth || (Word16)L_shr(hTransSetup.ls_elevation_fx[ch_in_woLFE], Q22) != elevation ) ) { azimuth_fx = L_shl( (Word32) azimuth, Q22 ); @@ -1696,7 +1697,7 @@ void rotateFrame_sd_cldfb_fixed( isPlanar = 1; FOR( n = 0; n < nInChannels; n++ ) { - IF( hOutputSetup->ls_elevation[n] != 0 ) + IF( hOutputSetup->ls_elevation_fx[n] != 0 ) { isPlanar = 0; BREAK; @@ -1706,9 +1707,8 @@ void rotateFrame_sd_cldfb_fixed( /* rotation of Euler angles */ FOR( n = 0; n < nInChannels; n++ ) { - // rotateAziEle( hOutputSetup->ls_azimuth[n], hOutputSetup->ls_elevation[n], &azimuth, &elevation, Rmat, isPlanar ); - rotateAziEle_fx( (Word16) hOutputSetup->ls_azimuth[n], (Word16) hOutputSetup->ls_elevation[n], &azimuth, &elevation, Rmat_fx, isPlanar ); - IF( hEFAPdata != NULL && ( hOutputSetup->ls_azimuth[n] != azimuth || hOutputSetup->ls_elevation[n] != elevation ) ) + rotateAziEle_fx((Word16)L_shr(hOutputSetup->ls_azimuth_fx[n], Q22), (Word16)L_shr(hOutputSetup->ls_elevation_fx[n], Q22), &azimuth, &elevation, Rmat_fx, isPlanar); + IF( hEFAPdata != NULL && ((Word16)L_shr(hOutputSetup->ls_azimuth_fx[n], Q22) != azimuth || (Word16)L_shr(hOutputSetup->ls_elevation_fx[n], Q22) != elevation ) ) { // efap_determine_gains( hEFAPdata, gains[n], azimuth, elevation, EFAP_MODE_EFAP ); efap_determine_gains_fx( hEFAPdata, gains_fx[n], L_shl( azimuth, Q22 ), L_shl( elevation, Q22 ), EFAP_MODE_EFAP ); @@ -3361,7 +3361,7 @@ void SHrotmatgen_fx( sql2mm2 = square_root30_q12[sub( imult1616(l, l), imult1616(m, m))]; sqdabsm = square_root30_q12[imult1616(add(1, d), imult1616(sub(add( l, absm), 1), add(l, absm)))]; - sqlabsm = square_root30_q12[imult1616( sub( l, sub( absm, 1 ) ), sub( l, absm ) )]; + sqlabsm = square_root30_q12[imult1616( sub( l, add( absm, 1 ) ), sub( l, absm ) )]; FOR ( n = -l; n <= l; n++ ) { diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index f469a5fe5..bc48b7d3f 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -58,12 +58,8 @@ typedef struct ivas_output_setup_structure Word16 num_lfe; Word16 index_lfe[1]; - const float *ls_azimuth; - const float *ls_elevation; -#ifdef IVAS_FLOAT_FIXED const Word32 *ls_azimuth_fx; const Word32 *ls_elevation_fx; -#endif UWord8 separateChannelEnabled; Word16 separateChannelIndex; @@ -319,6 +315,7 @@ typedef struct dirac_dec_stack_mem Word16 reference_power_len; Word32 *onset_filter_fx; Word16 onset_filter_len; + Word16 q_onset_filter; #endif } DIRAC_DEC_STACK_MEM, *DIRAC_DEC_STACK_MEM_HANDLE; @@ -2418,9 +2415,9 @@ typedef struct ivas_omasa_ana_data_structure #ifndef IVAS_FLOAT_FIXED float ism_azimuth[MAX_NUM_OBJECTS]; float ism_elevation[MAX_NUM_OBJECTS]; + float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; #endif - float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; #ifdef IVAS_FLOAT_FIXED Word32 **direction_vector_m_fx[DIRAC_NUM_DIMS]; /* Average direction vector */ Word16 direction_vector_m_q; /* Average direction vector */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ce3c64321..eabff932b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2119,11 +2119,16 @@ static void initRendInputBase( } +#ifdef IVAS_FLOAT_FIXED static IVAS_ISM_METADATA defaultObjectPosition( void ) { IVAS_ISM_METADATA pos; + pos.azimuth_fx = 0; + pos.elevation_fx = 0; + +#if 1/*TODO: To be removed*/ pos.azimuth = 0.0f; pos.elevation = 0.0f; pos.radius = 1.0f; @@ -2132,10 +2137,29 @@ static IVAS_ISM_METADATA defaultObjectPosition( pos.yaw = 0.0f; pos.pitch = 0.0f; pos.non_diegetic_flag = 0; +#endif return pos; } +#else +static IVAS_ISM_METADATA defaultObjectPosition( + void ) +{ + IVAS_ISM_METADATA pos; + + pos.azimuth = 0.0f; + pos.elevation = 0.0f; + pos.radius = 1.0f; + pos.spread = 0.0f; + pos.gainFactor = 1.0f; + pos.yaw = 0.0f; + pos.pitch = 0.0f; + pos.non_diegetic_flag = 0; + + return pos; +} +#endif // DEBUG static int8_t checkObjectPositionChanged( IVAS_ISM_METADATA *currentPos, @@ -4509,9 +4533,6 @@ static ivas_error initSbaPanGainsForMcOut( SWITCH( outConfig ) { case IVAS_AUDIO_CONFIG_MONO: - hOutSetup.ls_azimuth = ls_azimuth_CICP1; - hOutSetup.ls_elevation = ls_elevation_CICP1; - hOutSetup.ls_azimuth_fx = ls_azimuth_CICP1_fx; hOutSetup.ls_elevation_fx = ls_elevation_CICP1_fx; ivas_output_init( &hOutSetup, outConfig ); @@ -5235,7 +5256,11 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; hIvasRend->inputsIsm[i].bufferData = NULL; hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; +#ifndef IVAS_FLOAT_FIXED hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; +#else + hIvasRend->inputsIsm[i].nonDiegeticPanGain_fx = floatToFixed_32( nonDiegeticPanGain, Q31 ); +#endif // !IVAS_FLOAT_FIXED hIvasRend->inputsIsm[i].hOMasa = NULL; #ifdef IVAS_FLOAT_FIXED hIvasRend->inputsIsm[i].bufferData_fx = NULL; @@ -6237,7 +6262,66 @@ ivas_error IVAS_REND_AddInput_fx( * * Note: this will reset any custom LFE routing set for the input *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_CUSTOM_LS_DATA layout /* i : custom loudspeaker layout for input */ +) +{ + input_mc *inputMc; + ivas_error error; + + /* Validate function arguments */ + IF (hIvasRend == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF((error = validateCustomLsLayout_fx(layout)) != IVAS_ERR_OK) + { + return error; + } + + IF ((error = getInputById(hIvasRend, inputId, (void **)&inputMc)) != IVAS_ERR_OK) + { + return error; + } + + IF (inputMc->base.inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM) + { + /* Specifying details of custom speaker layout only makes sense if input config is set to custom speaker layout */ + return IVAS_ERR_INVALID_INPUT_FORMAT; + } + + /* Re-initialize panning gains for the MC input, This includes re-initializing LFE handling + * for the new input layout, which means custom LFE handling is overwritten, if previously + * set for the MC input. */ + inputMc->customLsInput = makeCustomLsSetup(layout); + + inputMc->lfeRouting = defaultLfeRouting(inputMc->base.inConfig, inputMc->customLsInput, hIvasRend->outputConfig, *inputMc->base.ctx.pCustomLsOut); + IF ((error = initEfap(&inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput)) != IVAS_ERR_OK) + { + return error; + } + + IF (EQ_16(hIvasRend->outputConfig , IVAS_AUDIO_CONFIG_BINAURAL) || EQ_16(hIvasRend->outputConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) || EQ_16(hIvasRend->outputConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB)) + { + IF ((error = initMcBinauralRendering(inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, FALSE)) != IVAS_ERR_OK) + { + return error; + } + } + + IF ((error = updateMcPanGains(inputMc, hIvasRend->outputConfig)) != IVAS_ERR_OK) + { + return error; + } + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -6303,7 +6387,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------* * IVAS_REND_SetInputGain() @@ -7073,7 +7157,26 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( * * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const Word16 inputIndex, /* i : Index of the input */ + const IVAS_ISM_METADATA objectPosition /* i : object position struct */ +) +{ + /* Validate function arguments */ + IF (hIvasRend == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + /* Set position to OMasa struct */ + hIvasRend->inputsIsm->hOMasa->ism_azimuth_fx[inputIndex] = floatToFixed(objectPosition.azimuth, Q22); + hIvasRend->inputsIsm->hOMasa->ism_elevation_fx[inputIndex] = floatToFixed(objectPosition.elevation, Q22); + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const int16_t inputIndex, /* i : Index of the input */ @@ -7097,7 +7200,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------* * IVAS_REND_FeedInputMasaMetadata() @@ -7181,7 +7284,52 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( * * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_InitConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ +) +{ + ivas_error error; + bool rendererConfigEnabled; + + rendererConfigEnabled = (getAudioConfigType(outAudioConfig) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL); + + IF (rendererConfigEnabled) + { + hIvasRend->rendererConfigEnabled = 1; + } + ELSE + { + hIvasRend->rendererConfigEnabled = 0; + } + IF (rendererConfigEnabled) + { + IF ((error = ivas_render_config_open(&(hIvasRend->hRendererConfig))) != IVAS_ERR_OK) + { + return error; + } +#ifdef IVAS_FLOAT_FIXED + IF((error = ivas_render_config_init_from_rom_fx(&hIvasRend->hRendererConfig)) != IVAS_ERR_OK) + { + return error; + } +//#else + IF ((error = ivas_render_config_init_from_rom(&hIvasRend->hRendererConfig)) != IVAS_ERR_OK) + { + return error; + } +#endif + } + ELSE + { + hIvasRend->hRendererConfig = NULL; + } + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ @@ -7227,6 +7375,7 @@ ivas_error IVAS_REND_InitConfig( return IVAS_ERR_OK; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -7395,7 +7544,82 @@ int16_t IVAS_REND_FeedRenderConfig( * * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetHeadRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ + const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ + const Word16 sf_idx /* i : subframe index */ +) +{ + Word16 i; + IVAS_QUATERNION rotQuat; + ivas_error error; + + /* Validate function arguments */ + IF (hIvasRend == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + IF (getAudioConfigType(hIvasRend->outputConfig) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL) + { + /* Head rotation can be set only with binaural output */ + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } + + hIvasRend->headRotData.headRotEnabled = 1; + + /* reconfigure binaural rendering to allocate the necessary renderers and free unused ones */ + FOR (i = 0; i < RENDERER_MAX_MC_INPUTS; ++i) + { + IF (hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID) + { + IF ((error = initMcBinauralRendering(&hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE)) != IVAS_ERR_OK) + { + return error; + } + } + } + + /* check for Euler angle signaling */ + IF(EQ_32(headRot.w_fx, -1610612736 /* -3.0f in Q29 */)) + { + Euler2Quat_fx(deg2rad_fx(headRot.x_fx), deg2rad_fx(headRot.y_fx), deg2rad_fx(headRot.z_fx), &rotQuat); + } + ELSE + { + rotQuat = headRot; + } + + Word32 updateRate_fx = 1677721600; // value is 200 in Q23 + rotQuat.w_fx = L_shl(rotQuat.w_fx, Q29 - rotQuat.q_fact); + rotQuat.x_fx = L_shl(rotQuat.x_fx, Q29 - rotQuat.q_fact); + rotQuat.y_fx = L_shl(rotQuat.y_fx, Q29 - rotQuat.q_fact); + rotQuat.z_fx = L_shl(rotQuat.z_fx, Q29 - rotQuat.q_fact); + hIvasRend->headRotData.hOrientationTracker->refRot.w_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->refRot.w_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->refRot.x_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->refRot.x_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->refRot.y_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->refRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->refRot.z_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->refRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->refRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->absAvgRot.w_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->absAvgRot.x_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->absAvgRot.y_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact); + hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx = L_shl(hIvasRend->headRotData.hOrientationTracker->absAvgRot.z_fx, Q29 - hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact); + + hIvasRend->headRotData.hOrientationTracker->refRot.q_fact = Q29; + hIvasRend->headRotData.hOrientationTracker->absAvgRot.q_fact = Q29; + rotQuat.q_fact = Q29; + + IF((error = ivas_orient_trk_Process_fx(hIvasRend->headRotData.hOrientationTracker, rotQuat, updateRate_fx, &hIvasRend->headRotData.headPositions[sf_idx])) != IVAS_ERR_OK) + { + return error; + } + + hIvasRend->headRotData.Pos[sf_idx] = Pos; + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ @@ -7487,14 +7711,48 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------* * IVAS_REND_DisableHeadRotation() * * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_DisableHeadRotation( + IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ +) +{ + Word16 i; + ivas_error error; + + /* Validate function arguments */ + IF (hIvasRend == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + hIvasRend->headRotData.headRotEnabled = 0; + + /* reconfigure binaural rendering to allocate the necessary renderers and free unused ones */ + IF (getAudioConfigType(hIvasRend->outputConfig) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL) + { + FOR (i = 0; i < RENDERER_MAX_MC_INPUTS; ++i) + { + IF (hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID) + { + IF ((error = initMcBinauralRendering(&hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE)) != IVAS_ERR_OK) + { + + return error; + } + } + } + } + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_DisableHeadRotation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ) @@ -7528,7 +7786,7 @@ ivas_error IVAS_REND_DisableHeadRotation( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------* * IVAS_REND_SetOrientationTrackingMode() @@ -8581,6 +8839,41 @@ static ivas_error rotateFrameSba( #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error renderIsmToBinaural( + const input_ism *ismInput, + IVAS_REND_AudioBuffer outAudio ) +{ + Word32 tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + ivas_error error; + Word16 ism_md_subframe_update_ext; + + push_wmops( "renderIsmToBinaural" ); + /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ + ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*To be cleaned up later*/ + copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpTDRendBuffer ); + + IF ( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, + *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ,*outAudio.pq_fact) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( ismInput->hReverb != NULL ) + { + FOR ( int i = 0; i < outAudio.config.numChannels; i++ ) + { + FOR ( int j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) + tmpTDRendBuffer[i][j] = L_shl( tmpTDRendBuffer[i][j], 2 ); + } + } + accumulate2dArrayToBuffer_fx( tmpTDRendBuffer, &outAudio ); + + pop_wmops(); + + return IVAS_ERR_OK; +} +#else static ivas_error renderIsmToBinaural( const input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -8607,6 +8900,7 @@ static ivas_error renderIsmToBinaural( return IVAS_ERR_OK; } +#endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED static Word16 getNumSubframesInBuffer( @@ -8985,6 +9279,41 @@ static ivas_error renderIsmToBinauralRoom( } #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error renderIsmToBinauralReverb( + input_ism *ismInput, + IVAS_REND_AudioBuffer outAudio ) +{ + Word32 tmpRendBuffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + ivas_error error; + Word16 ism_md_subframe_update_ext; + + push_wmops( "renderIsmToBinauralRoom" ); + + /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ + ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*ism_metadata_delay_ms :To be replaced later*/ + + copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpRendBuffer_fx ); + + IF ( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx , *outAudio.pq_fact) ) != IVAS_ERR_OK ) + { + return error; + } + + IF( ismInput->hReverb != NULL ) + { + FOR ( int i = 0; i < outAudio.config.numChannels; i++ ) + { + FOR ( int j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) + tmpRendBuffer_fx[i][j] = L_shl( tmpRendBuffer_fx[i][j], 2 ); + } + } + accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); + pop_wmops(); + + return IVAS_ERR_OK; +} +#else static ivas_error renderIsmToBinauralReverb( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -9011,6 +9340,7 @@ static ivas_error renderIsmToBinauralReverb( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error renderIsmToMc( @@ -9404,6 +9734,85 @@ static void renderIsmToMasa( } #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error renderInputIsm( + input_ism *ismInput, + const AUDIO_CONFIG outConfig, + const IVAS_REND_AudioBuffer outAudio ) +{ + ivas_error error; + IVAS_REND_AudioBuffer inAudio; + Word16 exp = 8; + move16(); + + error = IVAS_ERR_OK; + inAudio = ismInput->base.inputBuffer; + + IF ( NE_32(ismInput->base.numNewSamplesPerChannel , outAudio.config.numSamplesPerChannel) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); + } + ismInput->base.numNewSamplesPerChannel = 0; + + + /* Apply input gain to new audio */ + v_multc_fixed( inAudio.data_fx, ismInput->base.gain_fx, inAudio.data_fx, imult1616(inAudio.config.numSamplesPerChannel , inAudio.config.numChannels) ); + /* set combined orientation subframe info to start info */ + ivas_combined_orientation_set_to_start_index( *ismInput->base.ctx.pCombinedOrientationData ); + + scale_sig32( ismInput->base.inputBuffer.data_fx, imult1616( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ), 1 ); + + SWITCH ( getAudioConfigType( outConfig ) ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + error = renderIsmToMc( ismInput, outAudio ); + exp = Q8; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + error = renderIsmToSba( ismInput, outConfig, outAudio ); + exp = Q8; + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: + switch ( outConfig ) + { + case IVAS_AUDIO_CONFIG_BINAURAL: + error = renderIsmToBinaural( ismInput, outAudio ); + exp = *outAudio.pq_fact; + BREAK; + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: + error = renderIsmToBinauralRoom( ismInput, outAudio, &exp ); + BREAK; + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + error = renderIsmToBinauralReverb( ismInput, outAudio ); + exp = *outAudio.pq_fact; + BREAK; + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } + BREAK; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + renderIsmToMasa( ismInput, outAudio, &exp ); + FOR( Word16 block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) + { + ismInput->hOMasa->energy_e[block_m_idx]= 31- ismInput->hOMasa->energy_q; + } + BREAK; + default: + return IVAS_ERR_INVALID_OUTPUT_FORMAT; + } + + /* Check error here to keep switch statement more compact */ + IF ( error != IVAS_ERR_OK ) + { + return error; + } + + ismInput->firstFrameRendered = TRUE; + + *outAudio.pq_fact = exp; + return error; +} +#else static ivas_error renderInputIsm( input_ism *ismInput, const AUDIO_CONFIG outConfig, @@ -9544,19 +9953,20 @@ static ivas_error renderInputIsm( return error; } +#endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED static ivas_error renderActiveInputsIsm( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) { - int16_t i; + Word16 i; input_ism *pCurrentInput; ivas_error error; Word16 input_q = *outAudio.pq_fact; for ( i = 0, pCurrentInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pCurrentInput ) { - if ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + IF ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ continue; @@ -9566,11 +9976,22 @@ static ivas_error renderActiveInputsIsm( { return error; } + FOR(Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) + { + outAudio.data_fx[j] = L_shl( outAudio.data_fx[j], sub( input_q , ( *outAudio.pq_fact ) ) ); + } + *outAudio.pq_fact = input_q; } - for ( i = 0; i < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++i ) + FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) { - outAudio.data_fx[i] = (Word32) ( outAudio.data[i] * ( 1 << ( input_q - 1 ) ) ); + outAudio.data_fx[j] = L_shr( outAudio.data_fx[j], 1); } +#if 1/*To be removed later when dependency on data is removed*/ + FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) + { + outAudio.data[j] = fixedToFloat( outAudio.data_fx[j], input_q - 1 ); + } +#endif return IVAS_ERR_OK; } #else @@ -11905,6 +12326,95 @@ ivas_error IVAS_REND_GetMasaMetadata( * Merge MASA metadata from two formats *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_MergeMasaMetadata( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to merged metadata */ + const IVAS_REND_AudioConfigType inputType1, /* i : Input type 1 */ + const IVAS_REND_AudioConfigType inputType2 /* i : Input type 2 */ +) +{ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta2; + Word32( *inEne1_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32( *inEne2_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 *inEne1_e; + Word16 *inEne2_e; + + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + /* Input1 metadata and energy */ + if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) + { + *hMasaExtOutMeta = hIvasRend->inputsIsm->hOMasa->hMasaOut; + inEne1_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); + inEne1_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); + } + else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + *hMasaExtOutMeta = hIvasRend->inputsMc->hMcMasa->hMasaOut; + inEne1_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); + inEne1_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); + } + else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + { + *hMasaExtOutMeta = hIvasRend->inputsSba->hDirAC->hMasaOut; + inEne1_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); + inEne1_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); + } + else if ( inputType1 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + { + *hMasaExtOutMeta = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; + inEne1_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); + inEne1_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); + } + else + { + return IVAS_ERR_NOT_SUPPORTED_OPTION; + } + + /* Input2 metadata and energy */ + if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) + { + inMeta2 = hIvasRend->inputsIsm->hOMasa->hMasaOut; + inEne2_fx = &( hIvasRend->inputsIsm->hOMasa->energy_fx ); + inEne2_e = ( hIvasRend->inputsIsm->hOMasa->energy_e ); + } + else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + { + inMeta2 = hIvasRend->inputsMc->hMcMasa->hMasaOut; + inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); + inEne2_e = ( hIvasRend->inputsMc->hMcMasa->energy_exp ); + } + else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + { + inMeta2 = hIvasRend->inputsSba->hDirAC->hMasaOut; + inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); + inEne2_e = ( hIvasRend->inputsSba->hDirAC->energy_exp ); + } + else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) + { + inMeta2 = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; + inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); + inEne2_e = ( hIvasRend->inputsMasa->hMasaPrerend->energy_e ); + } + else + { + return IVAS_ERR_NOT_SUPPORTED_OPTION; + } + + /* Merge metadata */ + ivas_prerend_merge_masa_metadata_fx( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1_fx, inEne1_e, inMeta2, inputType2, *inEne2_fx, inEne2_e ); + + + ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_MASA1 ? 0u : 1u; + + return IVAS_ERR_OK; +} + +#else ivas_error IVAS_REND_MergeMasaMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to merged metadata */ @@ -12075,7 +12585,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( return IVAS_ERR_OK; } - +#endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * IVAS_REND_SetTotalNumberOfObjects( ) @@ -12134,7 +12644,6 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { hIvasRend->inputsIsm[i].ism_metadata_delay_ms = sync_md_delay; @@ -12503,10 +13012,6 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( /* Copy from ivas_ls_custom_setup */ hDirACRend->hOutSetup.nchan_out_woLFE = inputMasa->base.ctx.pCustomLsOut->num_spk; move16(); -#if 1 /*TODO: To be removed later(floating buffer init)*/ - hDirACRend->hOutSetup.ls_azimuth = inputMasa->base.ctx.pCustomLsOut->ls_azimuth; - hDirACRend->hOutSetup.ls_elevation = inputMasa->base.ctx.pCustomLsOut->ls_elevation; -#endif hDirACRend->hOutSetup.ls_azimuth_fx = inputMasa->base.ctx.pCustomLsOut->ls_azimuth_fx; hDirACRend->hOutSetup.ls_elevation_fx = inputMasa->base.ctx.pCustomLsOut->ls_elevation_fx; @@ -12524,7 +13029,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; move16(); - IF( hDirACRend->hOutSetup.ls_azimuth != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) + IF( hDirACRend->hOutSetup.ls_azimuth_fx != NULL && hDirACRend->hOutSetup.ls_elevation_fx != NULL ) { Copy32( hDirACRend->hOutSetup.ls_azimuth_fx, ls_azimuth_fx, nchan_out_woLFE ); Copy32( hDirACRend->hOutSetup.ls_elevation_fx, ls_elevation_fx, nchan_out_woLFE ); @@ -12850,6 +13355,9 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { hDirACRend->proto_frame_f = NULL; +#if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ + hDirACRend->proto_frame_f_fx = NULL; +#endif } ELSE { @@ -12870,6 +13378,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( #if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ hDirACRend->buffer_energy = NULL; #endif + hDirACRend->buffer_energy_fx = NULL; FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 48e870ac3..768398b8d 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -34,6 +34,9 @@ #include "cmdl_tools.h" #include #include +#ifdef IVAS_FLOAT_FIXED +#include "prot_fx2.h" +#endif // IVAS_FLOAT_FIXED #define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ #define NUM_ISM_METADATA_PER_LINE 8 /* Number of ISM metadata per line in a metadata file */ @@ -147,6 +150,10 @@ ivas_error IsmFileReader_readNextFrame( /* Invalid number of metadata parameters (2-7 supported) */ return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; } +#ifdef IVAS_FLOAT_FIXED + ismMetadata->azimuth_fx = floatToFixed( meta_prm[0], Q22 ); + ismMetadata->elevation_fx = floatToFixed( meta_prm[1], Q22 ); +#endif // IVAS_FLOAT_FIXED ismMetadata->azimuth = meta_prm[0]; ismMetadata->elevation = meta_prm[1]; -- GitLab From 3370be1db9ca61b5b9f30bf2c9c3b87c2bc4fe07 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 24 May 2024 11:44:42 +0530 Subject: [PATCH 072/101] Fixed LTV crash for [stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on, JBM Prof 5] --- lib_dec/er_dec_tcx_fx.c | 4 +- lib_dec/fd_cng_dec.c | 8 +++ lib_dec/fd_cng_dec_fx.c | 10 ++-- lib_dec/ivas_jbm_dec.c | 57 ++++++++++++++++++++ lib_rend/ivas_dirac_dec_binaural_functions.c | 10 ++++ 5 files changed, 82 insertions(+), 7 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 4a0208b9d..0e42d360e 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1949,13 +1949,13 @@ void con_tcx_ivas_fx( { Word16 lsp_local[M], lsp_fade[M], alpha_inv; - alpha_inv = 16384 - alpha_delayed; + alpha_inv = sub(16384, alpha_delayed); E_LPC_a_lsp_conversion(A_local, lsp_local, lsp_local, M); FOR (i = 0; i < M; i++) { - lsp_fade[i] = alpha_delayed * lsp_local[i] + alpha_inv * st->lspold_cng[i]; + lsp_fade[i] = add(mult_r(alpha_delayed, lsp_local[i]), mult_r(alpha_inv, st->lspold_cng[i])); } E_LPC_f_lsp_a_conversion(lsp_fade, A_local, M); diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index ba1d1f4b1..11b68e171 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -2022,6 +2022,14 @@ void generate_masking_noise_ivas_fx( Word32 scale_fx = 0x40000000; // 1.0 in Q30 move32(); + Word16 shift = getScaleFactor32(hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + hFdCngCom->cngNoiseLevelExp = sub(hFdCngCom->cngNoiseLevelExp, shift); + /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */ *exp_out = Q15; move16(); diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 290e0f5be..4aa367379 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1207,7 +1207,6 @@ Word16 ApplyFdCng_ivas_fx( Flag Overflow = 0; Flag Carry = 0; #endif - Word64 W_tmp; Word16 L_frame, last_L_frame; //Word32 *sidNoiseEst; @@ -1556,13 +1555,14 @@ Word16 ApplyFdCng_ivas_fx( } /* update isf cng estimate for concealment. Do that during concealment, in order to avoid addition clean channel complexity*/ - W_tmp = 0; + L_tmp = 0; + move32(); FOR( j = hFdCngCom->startBand; j < hFdCngCom->stopFFTbin; j++ ) { - W_tmp = W_add( W_tmp, L_shr( cngNoiseLevel[j], sub( 31, *cngNoiseLevel_exp ) ) ); + L_tmp = L_add_sat( L_tmp, L_shl_sat(cngNoiseLevel[j], 31 - *cngNoiseLevel_exp) ); } - L_tmp = W_extract_h( W_shl( W_tmp, 32 ) ); - L_tmp_exp = 31; + L_tmp_exp = 0; + move16(); #ifdef BASOP_NOGLOB IF(L_shl_o(L_tmp, L_tmp_exp, &Overflow) > 21474836 /*0.01f Q31*/) #else diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 6460c0c5d..4ed5d0f63 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -223,6 +223,13 @@ ivas_error ivas_jbm_dec_tc_fx( { IF( st_ivas->hSCE[ch] != NULL ) { + Word16 shift = getScaleFactor32(st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); Q_cngNoiseLevel[ch] = sub(31, st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp); } } @@ -2271,6 +2278,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( { nchan_transport = 1; /* Only one channel transported */ } + IF(st_ivas->hSCE[0]) + { + Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); + } #endif ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); @@ -2413,6 +2430,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( nchan_transport = 1; /* Only one channel transported */ } #endif + IF(st_ivas->hSCE[0]) + { + Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); + } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -2529,6 +2556,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( nchan_transport = 1; /* Only one channel transported */ } #endif + IF(st_ivas->hSCE[0]) + { + Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); + } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -2644,6 +2681,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( nchan_transport = 1; /* Only one channel transported */ } #endif + IF(st_ivas->hSCE[0]) + { + Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); + } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -2876,6 +2923,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( nchan_transport = 1; /* Only one channel transported */ } #endif + IF(st_ivas->hSCE[0]) + { + Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); + } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #if 1 if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 15a45f4a7..0b9a5447d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1166,6 +1166,16 @@ static void ivas_dirac_dec_binaural_internal( IF( abs_s( (Word16) st_ivas->cldfbAnaDec[1]->scale_flt ) != 0 ) st_ivas->cldfbAnaDec[1]->q_scale = norm_s( (Word16) st_ivas->cldfbAnaDec[1]->scale_flt ); st_ivas->cldfbAnaDec[1]->scale = (Word16) ( st_ivas->cldfbAnaDec[1]->scale_flt * ( 1 << st_ivas->cldfbAnaDec[1]->q_scale ) ); + IF(st_ivas->hSCE[0]) + { + Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); + IF(LT_16(sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift), 4)) + { + shift = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + } + scale_sig32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift); + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); + } Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME] = { 0 }; FOR( Word16 ind = 0; ind < 6; ind++ ) { -- GitLab From 6aed0cbf61b65b07d93a24a0665b1e706ffaa5e9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 24 May 2024 10:12:34 +0200 Subject: [PATCH 073/101] add job name and git commit sha value to mld csv artifact --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1fa026c4f..ac6569dcd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -216,6 +216,8 @@ stages: stage: test needs: ["build-codec-linux-make"] timeout: "240 minutes" + variables: + MLD_ARTIFACT_NAME: "mld-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.csv" script: - *print-common-info - *update-scripts-repo @@ -237,7 +239,7 @@ stages: - python3 -m pytest $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv + - python3 scripts/parse_mld_xml.py report-junit.xml $MLD_ARTIFACT_NAME - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi @@ -253,7 +255,7 @@ stages: paths: - report-junit.xml - report.html - - mld.csv + - $MLD_ARTIFACT_NAME expose_as: "pytest mld results" reports: junit: -- GitLab From f54621f6fa18491b31c11e2cd3b277a82bc9d55e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 24 May 2024 14:24:59 +0530 Subject: [PATCH 074/101] Float buffers cleanup from Dirac structures [x] Buffer cleanup in structures: DIRAC_ONSET_DETECTION_STATE, DIRAC_DECORR_PARAMS, SPAT_PARAM_REND_COMMON_DATA, DIRAC_OUTPUT_SYNTHESIS_PARAMS, DIRAC_REND_DATA, DIRAC_DEC_BIN_DATA, HRTFS_PARAMBIN, MASA_PREREND_DATA, DIRAC_ANA_DATA, MCMASA_ANA_DATA, TDREND_HRFILT_FiltSet_t [x] Converted ivas_lfe_window_init. Integrated at decoder calling place [x] Restoring ivas_param_mc_dec_render, ivas_dirac_dec_onset_detection_open and ivas_dirac_dec_decorr_open [x] Basop and cleanup of ivas_dirac_dec_onset_detection_process_fx and lattice2allpass_fx [x] Removed dependency of hoa_encoder_len from DIRAC_REND_DATA [x] Disabling ivas_td_binaural_close and TDREND_MIX_Dealloc --- lib_com/ivas_lfe_com.c | 73 ++-- lib_com/ivas_prot.h | 4 +- lib_com/ivas_prot_fx.h | 14 +- lib_dec/ivas_dirac_dec.c | 84 +--- lib_dec/ivas_dirac_output_synthesis_cov.c | 39 +- lib_dec/ivas_init_dec.c | 1 - lib_dec/ivas_jbm_dec.c | 13 - lib_dec/ivas_lfe_dec_fx.c | 2 +- lib_dec/ivas_masa_dec.c | 2 - lib_dec/ivas_mc_param_dec.c | 453 ++++----------------- lib_dec/ivas_spar_decoder.c | 4 - lib_dec/lib_dec_fx.c | 3 - lib_rend/ivas_dirac_decorr_dec.c | 412 ++++++------------- lib_rend/ivas_dirac_onsets_dec.c | 102 ++--- lib_rend/ivas_dirac_output_synthesis_dec.c | 76 +--- lib_rend/ivas_dirac_rend.c | 109 +---- lib_rend/ivas_objectRenderer.c | 11 +- lib_rend/ivas_objectRenderer_mix.c | 32 +- lib_rend/ivas_rom_TdBinauralRenderer.c | 2 +- lib_rend/ivas_stat_rend.h | 132 +++--- lib_rend/lib_rend.c | 61 +-- lib_util/hrtf_file_reader.c | 26 +- 22 files changed, 483 insertions(+), 1172 deletions(-) diff --git a/lib_com/ivas_lfe_com.c b/lib_com/ivas_lfe_com.c index 1a464a0b8..01e479da4 100644 --- a/lib_com/ivas_lfe_com.c +++ b/lib_com/ivas_lfe_com.c @@ -41,6 +41,9 @@ #include "cnst.h" #include #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" +#endif /*-----------------------------------------------------------------------------------------* @@ -153,36 +156,25 @@ void ivas_lfe_lpf_select_filt_coeff_fx( * Initialize LFE window *-----------------------------------------------------------------------------------------*/ -void ivas_lfe_window_init( +#ifdef IVAS_FLOAT_FIXED +void ivas_lfe_window_init_fx( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ - const Word32 sampling_rate, /* i : sampling rate */ - const Word16 frame_len /* i : frame length in samples */ + const Word32 sampling_rate, /* i : sampling rate */ + const Word16 frame_len /* i : frame length in samples */ ) { /* Set window coefficients */ - IF ( EQ_32(sampling_rate, 48000 )) + IF( EQ_32( sampling_rate, 48000 ) ) { - hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k; -#ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_48k_fx; -#endif - } - ELSE IF ( EQ_32(sampling_rate, 32000) ) + ELSE IF( EQ_32( sampling_rate, 32000 ) ) { - hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k; -#ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_32k_fx; -#endif - } - ELSE IF ( EQ_32(sampling_rate, 16000) ) + ELSE IF( EQ_32( sampling_rate, 16000 ) ) { - hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k; -#ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_16k_fx; -#endif - } ELSE { @@ -190,20 +182,47 @@ void ivas_lfe_window_init( } /* 10ms stride, MDCT will be done in two iterations */ - hLFEWindow->dct_len = shr(frame_len, 1); + hLFEWindow->dct_len = shr( frame_len, 1 ); - hLFEWindow->fade_len = NS2SA(sampling_rate, IVAS_LFE_FADE_NS); - -#ifdef IVAS_FLOAT_FIXED /* 8ms of latency */ - hLFEWindow->zero_pad_len = (mult(IVAS_ZERO_PAD_LEN_MULT_FAC_fx, sub(hLFEWindow->dct_len, hLFEWindow->fade_len))); - hLFEWindow->full_len = add(add(hLFEWindow->zero_pad_len, hLFEWindow->fade_len), hLFEWindow->dct_len); -#else - hLFEWindow->zero_pad_len = (int16_t)(IVAS_ZERO_PAD_LEN_MULT_FAC * (hLFEWindow->dct_len - hLFEWindow->fade_len)); - hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len; + hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS ); + hLFEWindow->zero_pad_len = ( mult( IVAS_ZERO_PAD_LEN_MULT_FAC_fx, sub( hLFEWindow->dct_len, hLFEWindow->fade_len ) ) ); + hLFEWindow->full_len = add( add( hLFEWindow->zero_pad_len, hLFEWindow->fade_len ), hLFEWindow->dct_len ); + + return; +} #endif +void ivas_lfe_window_init( + LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ + const int32_t sampling_rate, /* i : sampling rate */ + const int16_t frame_len /* i : frame length in samples */ +) +{ + /* Set window coefficients */ + if ( sampling_rate == 48000 ) + { + hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k; + } + else if ( sampling_rate == 32000 ) + { + hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k; + } + else if ( sampling_rate == 16000 ) + { + hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k; + } + else + { + assert( !"8kHz LFE Window not supported" ); + } + /* 10ms stride, MDCT will be done in two iterations */ + hLFEWindow->dct_len = frame_len >> 1; + /* 8ms of latency */ + hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS ); + hLFEWindow->zero_pad_len = (int16_t) ( IVAS_ZERO_PAD_LEN_MULT_FAC * ( hLFEWindow->dct_len - hLFEWindow->fade_len ) ); + hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len; return; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index aa02ae30c..41fa20009 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -7002,8 +7002,8 @@ void ivas_lfe_tdplc( void ivas_lfe_window_init( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ - const Word32 sampling_rate, /* i : sampling rate */ - const Word16 frame_len /* i : frame length in samples */ + const int32_t sampling_rate, /* i : sampling rate */ + const int16_t frame_len /* i : frame length in samples */ ); void ivas_lfe_lpf_select_filt_coeff( diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 177156f76..a9b72e067 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2190,17 +2190,23 @@ void ivas_param_mc_dec_read_BS_fx( ); ivas_error ivas_omasa_data_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_omasa_data_close_fx( - MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ + MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */ ); ivas_error ivas_mc_dec_config_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word16 idx, /* i : LS config. index */ UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ - Word16 *data /* o : output synthesis signal */ + Word16 *data /* o : output synthesis signal */ +); + +void ivas_lfe_window_init_fx( + LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ + const Word32 sampling_rate, /* i : sampling rate */ + const Word16 frame_len /* i : frame length in samples */ ); #endif diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index d78695d1e..29cca5c92 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -330,25 +330,12 @@ static ivas_error ivas_dirac_rend_config_fx( IF( EQ_16( flag_config, DIRAC_OPEN ) ) { -#ifdef TRUE - /*TODO : remove float code*/ - if ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); -#endif IF( ( hDirACRend->frequency_axis_fx = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set16_fx( hDirACRend->frequency_axis_fx, 0, hSpatParamRendCom->num_freq_bands ); ivas_dirac_dec_get_frequency_axis_fx( hDirACRend->frequency_axis_fx, output_Fs, hSpatParamRendCom->num_freq_bands ); - - FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hDirACRend->frequency_axis[i] = (float) hDirACRend->frequency_axis_fx[i]; - } } IF( ( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) && EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) && EQ_16( nchan_transport, 2 ) ) @@ -550,13 +537,6 @@ static ivas_error ivas_dirac_rend_config_fx( /* direct/diffuse responses */ IF( EQ_16( flag_config, DIRAC_OPEN ) ) { -#ifdef TRUE - /*Todo : to clean up float code*/ - IF( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } -#endif IF( ( hDirACRend->diffuse_response_function_fx = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); @@ -565,15 +545,6 @@ static ivas_error ivas_dirac_rend_config_fx( /* reallocate static memory */ ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && NE_16( hDirACRend->num_outputs_dir, num_outputs_dir_old ) ) { -#ifdef TRUE - /*Todo : Remove float code*/ - free( hDirACRend->diffuse_response_function ); - hDirACRend->diffuse_response_function = NULL; - IF( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } -#endif free( hDirACRend->diffuse_response_function_fx ); hDirACRend->diffuse_response_function_fx = NULL; IF( ( hDirACRend->diffuse_response_function_fx = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) @@ -586,44 +557,15 @@ static ivas_error ivas_dirac_rend_config_fx( initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, st_ivas->transport_config ); - FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) - { - hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], 15 ); - } } ELSE { initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, IVAS_AUDIO_CONFIG_FOA, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); - - FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) - { - hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], 15 ); - } } IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) { -#ifdef TRUE - /*TODO : to remove float code*/ - if ( EQ_16( flag_config, DIRAC_OPEN ) ) - { - if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - } - else if ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) - { - free( hDirACRend->hoa_encoder ); - hDirACRend->hoa_encoder = NULL; - if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - } - set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); -#endif IF( EQ_16( flag_config, DIRAC_OPEN ) ) { IF( ( hDirACRend->hoa_encoder_fx = (Word32 *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( Word32 ) ) ) == NULL ) @@ -631,7 +573,7 @@ static ivas_error ivas_dirac_rend_config_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } - ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) + ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder_fx && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) { free( hDirACRend->hoa_encoder_fx ); hDirACRend->hoa_encoder_fx = NULL; @@ -641,24 +583,10 @@ static ivas_error ivas_dirac_rend_config_fx( } } set32_fx( hDirACRend->hoa_encoder_fx, 0, nchan_out_woLFE * hDirACRend->num_outputs_diff ); - hDirACRend->hoa_encoder_len = nchan_out_woLFE * hDirACRend->num_outputs_diff; - compute_hoa_encoder_mtx_fx( ls_azimuth_fx, ls_elevation_fx, hDirACRend->hoa_encoder_fx, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); - FOR( i = 0; i < nchan_out_woLFE * hDirACRend->num_outputs_diff; i++ ) - { - hDirACRend->hoa_encoder[i] = fix_to_float( hDirACRend->hoa_encoder_fx[i], Q29 ); - } } ELSE { -#ifdef TRUE - /*todo: clean up float code*/ - IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder ) - { - free( hDirACRend->hoa_encoder ); - } - hDirACRend->hoa_encoder = NULL; -#endif IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder_fx ) { free( hDirACRend->hoa_encoder_fx ); @@ -3635,7 +3563,6 @@ void ivas_dirac_dec_render_sf_fx( { IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) { - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); } @@ -3871,9 +3798,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - - hDirACRend->diffuse_response_function_q = Q15; - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, hDirACRend->diffuse_response_function_q, hDirACRend->num_outputs_dir ); } ELSE { @@ -4720,10 +4644,6 @@ void ivas_dirac_dec_render_sf_fx( { Scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr, sub( Q31, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ) ); } - IF( NE_16( hDirACRend->diffuse_response_function_q, Q15 ) ) - { - Scale_sig( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, sub( Q15, hDirACRend->diffuse_response_function_q ) ); - } IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, Q26 ) ) { scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, i_mult( hDirACRend->num_outputs_diff, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ), sub( Q26, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth ) ); @@ -5505,8 +5425,6 @@ void ivas_dirac_dec_render_sf_fx( fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); } - - fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index f1f010f5b..21ae3761b 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -194,14 +194,13 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } - for ( idx = 1; idx <= interp_length; ++idx ) + FOR( idx = 1; idx <= interp_length; ++idx ) { h_dirac_output_synthesis_params->interpolator_fx[idx - 1] = div_s( idx, interp_length ); } Copy32( proto_matrix, h_dirac_output_synthesis_params->proto_matrix_fx, nchan_in * nchan_out ); #if 1 /*TODO: To be removed later***************************************************************************************/ - h_dirac_output_synthesis_params->alpha_synthesis = NULL; if ( ( h_dirac_output_synthesis_params->proto_matrix = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); @@ -234,22 +233,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; } - - /*-----------------------------------------------------------------* - * prepare processing parameters - *-----------------------------------------------------------------*/ - - /* compute interpolator */ - if ( ( h_dirac_output_synthesis_params->interpolator = (float *) malloc( interp_length * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); - } - - for ( idx = 1; idx <= interp_length; ++idx ) - { - h_dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) interp_length; - } - #endif return IVAS_ERR_OK; } @@ -369,6 +352,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } #endif + #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator_fx() @@ -394,9 +378,7 @@ void ivas_dirac_dec_output_synthesis_get_interpolator_fx( return; } -#endif - - +#else /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator() * @@ -417,6 +399,7 @@ void ivas_dirac_dec_output_synthesis_get_interpolator( return; } +#endif /*-------------------------------------------------------------------* @@ -617,20 +600,6 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx( h_dirac_output_synthesis_state->mixing_matrix_res_exp = NULL; } #if 1/*TODO: To be removed later(floating point dealloc)*/ - /* free interpolator */ - IF ( h_dirac_output_synthesis_params->interpolator != NULL ) - { - free( h_dirac_output_synthesis_params->interpolator ); - h_dirac_output_synthesis_params->interpolator = NULL; - } - - /* free alpha */ - IF ( h_dirac_output_synthesis_params->alpha_synthesis != NULL ) - { - free( h_dirac_output_synthesis_params->alpha_synthesis ); - h_dirac_output_synthesis_params->alpha_synthesis = NULL; - } - /* free proto_matrix */ IF ( h_dirac_output_synthesis_params->proto_matrix != NULL ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ebf6b23e2..0947468a2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2003,7 +2003,6 @@ ivas_error ivas_init_decoder_fx( } if ( hParamMC ) { - fixedToFloat_arr( hParamMC->h_output_synthesis_params.interpolator_fx, hParamMC->h_output_synthesis_params.interpolator, 15, DEFAULT_JBM_CLDFB_TIMESLOTS ); fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 26, nchan_transport * nchan_out_cov ); FOR( i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 4ed5d0f63..76a0a6951 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1188,10 +1188,7 @@ ivas_error ivas_jbm_dec_tc_fx( IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) { st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15 ); } - st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15 ); - st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15 ); } } } @@ -2178,9 +2175,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( for ( Word16 bin_idx = 0; bin_idx < nBins; bin_idx++ ) { hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx] = float_to_fix16( hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->spreadCoherence_fx[sf_idx][bin_idx] = float_to_fix16( hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->surroundingCoherence_fx[sf_idx][bin_idx] = float_to_fix16( hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->spreadCoherence2_fx[sf_idx][bin_idx] = float_to_fix16( hSpatParamRendCom->spreadCoherence2[sf_idx][bin_idx], 15 ); hSpatParamRendCom->energy_ratio2_fx[sf_idx][bin_idx] = float_to_fix16( hSpatParamRendCom->energy_ratio2[sf_idx][bin_idx], 15 ); } } @@ -2202,9 +2196,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( for ( Word16 bin_idx = 0; bin_idx < nBins; bin_idx++ ) { hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->spreadCoherence[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->spreadCoherence_fx[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->surroundingCoherence_fx[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->spreadCoherence2[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->spreadCoherence2_fx[sf_idx][bin_idx], 15 ); hSpatParamRendCom->energy_ratio2[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->energy_ratio2_fx[sf_idx][bin_idx], 15 ); } } @@ -2848,9 +2839,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = sub(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], shift); } - me2f_buf_16(st_ivas->hParamMC->h_output_synthesis_params.interpolator_fx, 0, st_ivas->hParamMC->h_output_synthesis_params.interpolator, n_render_timeslots ); - - FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++) { me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], nchan_out_cov * nchan_transport); @@ -4582,7 +4570,6 @@ ivas_error ivas_jbm_dec_render( } } - floatToFixed_arr16(st_ivas->hParamMC->h_output_synthesis_params.interpolator, st_ivas->hParamMC->h_output_synthesis_params.interpolator_fx, 15, DEFAULT_JBM_CLDFB_TIMESLOTS); if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM)) { if (st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV) diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index ecda2cb2e..18bb18224 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -437,7 +437,7 @@ ivas_error ivas_create_lfe_dec_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LFE window structure\n" ) ); } - ivas_lfe_window_init( hLFE->pWindow_state, output_Fs, output_frame ); + ivas_lfe_window_init_fx( hLFE->pWindow_state, output_Fs, output_frame ); /* Initialization for entropy coding */ hLFE->cum_freq_models[0][0] = ivas_str_lfe_freq_models.entropy_coder_model_fine_sg1; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 06b7ed543..d83a1bfb4 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -3656,8 +3656,6 @@ void ivas_spar_param_to_masa_param_mapping_fx( // Tobe deleted hSpatParamRendCom->energy_ratio1[dirac_write_idx][bin] = (float) hSpatParamRendCom->energy_ratio1_fx[dirac_write_idx][bin] / ONE_IN_Q31; hSpatParamRendCom->diffuseness_vector[dirac_write_idx][bin] = (float) hSpatParamRendCom->diffuseness_vector_fx[dirac_write_idx][bin] / ONE_IN_Q31; - hSpatParamRendCom->spreadCoherence[dirac_write_idx][bin] = 0.0f; - hSpatParamRendCom->surroundingCoherence[dirac_write_idx][bin] = 0.0f; //// diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 0cb463858..9db6b9ae6 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -3526,11 +3526,13 @@ void ivas_param_mc_dec_digest_tc( } #endif + /*------------------------------------------------------------------------- * ivas_param_mc_dec() * * Parametric MC decoding process *------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED void ivas_param_mc_dec_render_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -3916,33 +3918,10 @@ void ivas_param_mc_dec_render( int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; int16_t nchan_out_cov; /*CLDFB*/ - -#ifdef IVAS_FLOAT_FIXED - Word32 Cldfb_RealBuffer_fx[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_fx[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - Word32 output_f_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 *p_output_f_fx[MAX_OUTPUT_CHANNELS]; - for (i = 0; i < MAX_OUTPUT_CHANNELS; i++) { - p_output_f_fx[i] = output_f_fx[i]; - } -#endif float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#ifndef IVAS_FLOAT_FIXED float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#endif - for ( i = 0; i < MAX_INTERN_CHANNELS; i++) { - for (int j = 0; j < PARAM_MC_MAX_NSLOTS_IN_SUBFRAME; j++) { - for (int k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) { - Cldfb_RealBuffer[i][j][k] = 0; - Cldfb_ImagBuffer[i][j][k] = 0; - - } - } - } /*Decorrelator*/ float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* format converter */ @@ -3952,198 +3931,130 @@ void ivas_param_mc_dec_render( uint32_t output_Fs; hParamMC = st_ivas->hParamMC; - assert(hParamMC); + assert( hParamMC ); - push_wmops("param_mc_dec_render"); + push_wmops( "param_mc_dec_render" ); - set_s(channel_active, 0, MAX_CICP_CHANNELS); + set_s( channel_active, 0, MAX_CICP_CHANNELS ); nchan_transport = st_ivas->nchan_transport; nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; nchan_out_init = nchan_out_transport; output_Fs = st_ivas->hDecoderConfig->output_Fs; - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { nchan_out_cldfb = BINAURAL_CHANNELS; - set_s(channel_active, 1, nchan_out_cldfb); - if (st_ivas->hCombinedOrientationData) + set_s( channel_active, 1, nchan_out_cldfb ); + if ( st_ivas->hCombinedOrientationData ) { nchan_out_init = MAX_INTERN_CHANNELS; } nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; } - else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB) + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) { nchan_out_cov = nchan_out_transport; nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; } - else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO) + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; nchan_out_cldfb = nchan_out_cov; - set_s(channel_active, 1, nchan_out_cov); + set_s( channel_active, 1, nchan_out_cov ); } else { nchan_out_cov = nchan_out_transport; nchan_out_cldfb = nchan_out_transport; - set_s(channel_active, 1, nchan_out_cov); + set_s( channel_active, 1, nchan_out_cov ); } /* set everything to zero that will not be decoded */ nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; nbands_to_zero = hParamMC->num_freq_bands - nband_synth; - for (ch = 0; ch < nchan_out_init; ch++) + for ( ch = 0; ch < nchan_out_init; ch++ ) { - for (slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++) + for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) { - set_zero(&(Cldfb_RealBuffer[ch][slot_idx][nband_synth]), nbands_to_zero); - set_zero(&(Cldfb_ImagBuffer[ch][slot_idx][nband_synth]), nbands_to_zero); -#ifdef IVAS_FLOAT_FIXED - set32_fx(&(Cldfb_RealBuffer_fx[ch][slot_idx][nband_synth]), 0, nbands_to_zero); - set32_fx(&(Cldfb_ImagBuffer_fx[ch][slot_idx][nband_synth]), 0, nbands_to_zero); -#endif + set_zero( &( Cldfb_RealBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); + set_zero( &( Cldfb_ImagBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); } } /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ - slots_to_render = min(hParamMC->num_slots - hParamMC->slots_rendered, nSamplesAsked / NS2SA(output_Fs, CLDFB_SLOT_NS)); - *nSamplesRendered = slots_to_render * NS2SA(output_Fs, CLDFB_SLOT_NS); + slots_to_render = min( hParamMC->num_slots - hParamMC->slots_rendered, nSamplesAsked / NS2SA( output_Fs, CLDFB_SLOT_NS ) ); + *nSamplesRendered = slots_to_render * NS2SA( output_Fs, CLDFB_SLOT_NS ); first_sf = hParamMC->subframes_rendered; last_sf = first_sf; - while (slots_to_render > 0) + while ( slots_to_render > 0 ) { slots_to_render -= hParamMC->subframe_nbslots[last_sf]; last_sf++; } - if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { - for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { slots_to_render += hParamMC->subframe_nbslots[subframe_idx]; } } slot_idx_start = hParamMC->slots_rendered; slot_idx_start_cldfb_synth = 0; - for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { -#ifdef IVAS_FLOAT_FIXED - Word16 len = slot_idx_start_cldfb_synth * hParamMC->num_freq_bands + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]; - for (i = 0; i < nchan_out_cldfb; i++) - { - floatToFixed_arrL(output_f[i], output_f_fx[i], Q11, len); - } -#endif - - for (slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++, hParamMC->slots_rendered++) + for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++, hParamMC->slots_rendered++ ) { - if (hParamMC->max_band_decorr > 0) + if ( hParamMC->max_band_decorr > 0 ) { /*-----------------------------------------------------------------* * protoype signal computation *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - - floatToFixed_arrL(hParamMC->Cldfb_RealBuffer_tc, hParamMC->Cldfb_RealBuffer_tc_fx, Q12, hParamMC->sz); - - floatToFixed_arrL(hParamMC->Cldfb_ImagBuffer_tc, hParamMC->Cldfb_ImagBuffer_tc_fx, Q12, hParamMC->sz); - - FOR(Word16 x = 0; x < hParamMC->diff_proto_info->num_protos_diff; x++) - { - Word16 num_source_ch = hParamMC->diff_proto_info->num_source_chan_diff[x]; - move16(); - - floatToFixed_arrL(hParamMC->diff_proto_info->proto_fac[x], hParamMC->diff_proto_info->proto_fac_fx[x], Q30, num_source_ch); - } - - param_mc_protoSignalComputation_fx(&hParamMC->Cldfb_RealBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc_fx[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - hParamMC->proto_frame_f_fx, hParamMC->diff_proto_info, - hParamMC->num_freq_bands); - - fixedToFloat_arrL(hParamMC->proto_frame_f_fx, hParamMC->proto_frame_f, Q11, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands); - -#else - param_mc_protoSignalComputation(&hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - hParamMC->proto_frame_f, hParamMC->diff_proto_info, - hParamMC->num_freq_bands); -#endif + param_mc_protoSignalComputation( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + hParamMC->proto_frame_f, hParamMC->diff_proto_info, + hParamMC->num_freq_bands ); /*-----------------------------------------------------------------* * frequency domain decorrelation *-----------------------------------------------------------------*/ - /* decorrelate prototype frame */ - ivas_dirac_dec_decorr_process(hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - nchan_transport, - hParamMC->proto_frame_f, - hParamMC->diff_proto_info->num_protos_diff, - hParamMC->diff_proto_info->proto_index_diff, - hParamMC->proto_frame_dec_f,//output - onset_filter, - hParamMC->h_freq_domain_decorr_ap_params, - hParamMC->h_freq_domain_decorr_ap_state); + /* decorrelate prototype frame */ + ivas_dirac_dec_decorr_process( hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + nchan_transport, + hParamMC->proto_frame_f, + hParamMC->diff_proto_info->num_protos_diff, + hParamMC->diff_proto_info->proto_index_diff, + hParamMC->proto_frame_dec_f, + onset_filter, + hParamMC->h_freq_domain_decorr_ap_params, + hParamMC->h_freq_domain_decorr_ap_state ); /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ /* memory for the decorrelated signal */ -#ifdef IVAS_FLOAT_FIXED - f2me_buf(hParamMC->proto_frame_dec_f, hParamMC->proto_frame_dec_f_fx, &hParamMC->exp_proto_frame_dec_f, nchan_out_cov * 2 * hParamMC->num_freq_bands); - ivas_param_mc_dec_copy_diffuse_proto(hParamMC, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nchan_out_cov, slot_idx); - FOR(int k = 0; k < nchan_out_cov; k++) - { - FOR(int l = 0; l < hParamMC->h_output_synthesis_params.max_band_decorr; l++) - { - Cldfb_RealBuffer[k][slot_idx][l] = me2f(Cldfb_RealBuffer_fx[k][slot_idx][l], hParamMC->exp_proto_frame_dec_f); - Cldfb_ImagBuffer[k][slot_idx][l] = me2f(Cldfb_ImagBuffer_fx[k][slot_idx][l], hParamMC->exp_proto_frame_dec_f); - } - } -#else - ivas_param_mc_dec_copy_diffuse_proto(hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx); -#endif + ivas_param_mc_dec_copy_diffuse_proto( hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx ); } /*-----------------------------------------------------------------* * output synthesis *-----------------------------------------------------------------*/ - ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot(&hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], - Cldfb_RealBuffer, Cldfb_ImagBuffer, - hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, - nchan_transport, nchan_out_cov, hParamMC); + ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + Cldfb_RealBuffer, Cldfb_ImagBuffer, + hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, + nchan_transport, nchan_out_cov, hParamMC ); - if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM)) + if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { if ( - st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV) + st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 - Word16 Q_hoa_encoder = 31; - floatToFixed_arrL(hParamMC->hoa_encoder, hParamMC->hoa_encoder_fx, Q_hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS); - - Word16 Q_Cldfb_ImagBuffer, Q_Cldfb_RealBuffer; - Q_Cldfb_ImagBuffer = Q_factor_arrL(&Cldfb_ImagBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX) - 5;/*max value =MAX_INTERN_CHANNELS(=16)*Cldfb_ImagBuffer_fx*/ - Q_Cldfb_RealBuffer = Q_factor_arrL(&Cldfb_RealBuffer[0][0][0], 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX) - 5; - floatToFixed_arrL(&Cldfb_ImagBuffer[0][0][0], &Cldfb_ImagBuffer_fx[0][0][0], Q_Cldfb_ImagBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); - floatToFixed_arrL(&Cldfb_RealBuffer[0][0][0], &Cldfb_RealBuffer_fx[0][0][0], Q_Cldfb_RealBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); -#endif - ivas_param_mc_mc2sba_cldfb_fx(st_ivas->hTransSetup, hParamMC->hoa_encoder_fx, slot_idx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, nband_synth, GAIN_LFE_FX); -#if 1 - - fixedToFloat_arrL(&Cldfb_ImagBuffer_fx[0][0][0], &Cldfb_ImagBuffer[0][0][0], Q_Cldfb_ImagBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); - fixedToFloat_arrL(&Cldfb_RealBuffer_fx[0][0][0], &Cldfb_RealBuffer[0][0][0], Q_Cldfb_RealBuffer, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); -#endif // IVAS_FLOAT_FIXED -#else - ivas_param_mc_mc2sba_cldfb(st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE); -#endif // IVAS_FLOAT_FIXED - + ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); } else { @@ -4153,41 +4064,43 @@ void ivas_param_mc_dec_render( IVAS_OUTPUT_SETUP hLsSetup; hLsSetup = st_ivas->hTransSetup; + /* If LFE should be rendered, add it to other channels before removing */ - if (st_ivas->hBinRenderer->render_lfe) + if ( st_ivas->hBinRenderer->render_lfe ) { - for (idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++) + for ( idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++ ) { /* Copy just the first band of LFE*/ - v_multc(Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], (GAIN_LFE / hLsSetup.nchan_out_woLFE), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1); - v_multc(Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], (GAIN_LFE / hLsSetup.nchan_out_woLFE), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1); + v_multc( Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + v_multc( Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); - for (ch = 0; ch < (hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe); ch++) + for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) { - if (hLsSetup.index_lfe[idx_lfe] != ch) + if ( hLsSetup.index_lfe[idx_lfe] != ch ) { - v_add(Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1); - v_add(Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1); + v_add( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1 ); + v_add( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1 ); } } } } + idx_out = 0; idx_lfe = 0; - for (ch = 0; ch < (hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe); ch++) + for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) { - if ((hLsSetup.num_lfe > 0) && (hLsSetup.index_lfe[idx_lfe] == ch)) + if ( ( hLsSetup.num_lfe > 0 ) && ( hLsSetup.index_lfe[idx_lfe] == ch ) ) { - if (idx_lfe < (hLsSetup.num_lfe - 1)) + if ( idx_lfe < ( hLsSetup.num_lfe - 1 ) ) { idx_lfe++; } } - else if (ch != idx_out) + else if ( ch != idx_out ) { - mvr2r(Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth); - mvr2r(Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth); + mvr2r( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth ); idx_out++; } else @@ -4199,183 +4112,36 @@ void ivas_param_mc_dec_render( } } - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifdef IVAS_FLOAT_FIXED - Word16 j, k; - for (i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - for (j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++) - { - for (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) - { - Cldfb_RealBuffer_fx[i][j][k] = (Word32)floatToFixed(Cldfb_RealBuffer[i][j][k], Q6); - Cldfb_ImagBuffer_fx[i][j][k] = (Word32)floatToFixed(Cldfb_ImagBuffer[i][j][k], Q6); - } - } - } - if (st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hBinRenderer->rotInCldfb) - { - if (st_ivas->hBinRenderer->hInputSetup->is_loudspeaker_setup == 0) - { - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i][j] = (Word32)floatToFixed(st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][i][j], 30); - } - } - } - } + ivas_binRenderer( st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + hParamMC->subframe_nbslots[subframe_idx], + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - Word16 input_q = 6; - /* Implement binaural rendering */ - ivas_binRenderer_fx(st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - hParamMC->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, - Cldfb_RealBuffer_fx, - Cldfb_ImagBuffer_fx, &input_q); - /* fixed to float */ - for (i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - for (j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++) - { - for (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) - { - Cldfb_RealBuffer[i][j][k] = fixedToFloat(Cldfb_RealBuffer_fx[i][j][k], input_q); - Cldfb_ImagBuffer[i][j][k] = fixedToFloat(Cldfb_ImagBuffer_fx[i][j][k], input_q); - } - } - } - - for (int idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++) - { - for (int idx2 = 0; idx2 < hParamMC->subframe_nbslots[subframe_idx]; idx2++) - { - Scale_sig32(Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6 - input_q); - Scale_sig32(Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6 - input_q); - } - } - - /* for (i = 0; i < BINAURAL_CHANNELS; i++) - { - for (j = 0; j < hParamMC->subframe_nbslots[subframe_idx]; j++) - { - for (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) - { - Cldfb_RealBuffer_Binaural[i][j][k] = fix_to_float(Cldfb_RealBuffer_Binaural_fx[i][j][k], Q6); - Cldfb_ImagBuffer_Binaural[i][j][k] = fix_to_float(Cldfb_ImagBuffer_Binaural_fx[i][j][k], Q6); - } - } - }*/ -#else - ivas_binRenderer(st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - hParamMC->subframe_nbslots[subframe_idx], - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer); - -#endif /* update combined orientation access index */ - ivas_combined_orientation_update_index(st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); + ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); } - else if (hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB) + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) { /* format conversion*/ -#ifdef IVAS_FLOAT_FIXED - Word16 inChannels = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; - Word16 num_timeslots = hParamMC->subframe_nbslots[subframe_idx]; - Word16 j; - FOR(i = 0; i < inChannels; ++i) - { - FOR(j = 0; j < num_timeslots; ++j) - { - floatToFixed_arrL(Cldfb_RealBuffer[i][j], Cldfb_RealBuffer_fx[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); - floatToFixed_arrL(Cldfb_ImagBuffer[i][j], Cldfb_ImagBuffer_fx[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); - } - } - ivas_lssetupconversion_process_param_mc_fx(st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, channel_active); - FOR(i = 0; i < inChannels; ++i) - { - FOR(j = 0; j < num_timeslots; ++j) - { - fixedToFloat_arrL(Cldfb_RealBuffer_fx[i][j], Cldfb_RealBuffer[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); - fixedToFloat_arrL(Cldfb_ImagBuffer_fx[i][j], Cldfb_ImagBuffer[i][j], Q9, st_ivas->hLsSetUpConversion->sfbCnt); - } - } -#else - ivas_lssetupconversion_process_param_mc(st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active); -#endif + ivas_lssetupconversion_process_param_mc( st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active ); } /* CLDFB synthesis */ -#ifdef IVAS_FLOAT_FIXED - - floatToFixed_arrL(&Cldfb_ImagBuffer[0][0][0], &Cldfb_ImagBuffer_fx[0][0][0], Q6, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); - floatToFixed_arrL(&Cldfb_RealBuffer[0][0][0], &Cldfb_RealBuffer_fx[0][0][0], Q6, 16 * MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX); - - /* CLDFB synthesis */ - for (ch = 0; ch < nchan_out_cldfb; ch++) - { - Word32 *RealBuffer_fx[16]; - Word32 *ImagBuffer_fx[16]; - - if (channel_active[ch]) - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for (i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++) - { - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) - { - RealBuffer_fx[i] = Cldfb_RealBuffer_Binaural_fx[ch][i]; - ImagBuffer_fx[i] = Cldfb_ImagBuffer_Binaural_fx[ch][i]; - } - else - { - RealBuffer_fx[i] = Cldfb_RealBuffer_fx[ch][i]; - ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[ch][i]; - } - } - - for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) - { - st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbSynDec[ch]->cldfb_state[i] * (1LL << (5))); - } - scale_sig32(output_f_fx[ch], len, 5 - 11); - - cldfbSynthesis_ivas_fx(RealBuffer_fx, ImagBuffer_fx, &(output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch]); - - scale_sig32(output_f_fx[ch], len, 11 - 5); - for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) - { - st_ivas->cldfbSynDec[ch]->cldfb_state[i] = ((float)st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] / (1LL << (5))); - } - fixedToFloat_arrL(output_f_fx[ch], output_f[ch], Q11, len); - } - else - { - set32_fx(&(output_f_fx[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), 0, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); - fixedToFloat_arrL(output_f_fx[ch], output_f[ch], Q11, len); - } - } - slot_idx_start += hParamMC->subframe_nbslots[subframe_idx]; - slot_idx_start_cldfb_synth += hParamMC->subframe_nbslots[subframe_idx]; - } -#else - for (ch = 0; ch < nchan_out_cldfb; ch++) + for ( ch = 0; ch < nchan_out_cldfb; ch++ ) { float *RealBuffer[16]; float *ImagBuffer[16]; - if (channel_active[ch]) + if ( channel_active[ch] ) { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for (i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++) + for ( i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++ ) { - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; @@ -4387,77 +4153,38 @@ void ivas_param_mc_dec_render( } } - cldfbSynthesis_ivas(RealBuffer, ImagBuffer, &(output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch]); + cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); } else { - set_f(&(output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands]), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx]); + set_f( &( output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); } } slot_idx_start += hParamMC->subframe_nbslots[subframe_idx]; slot_idx_start_cldfb_synth += hParamMC->subframe_nbslots[subframe_idx]; -} -#endif - -#ifdef IVAS_FLOAT_FIXED - if (hParamMC->slots_rendered == hParamMC->num_slots) - { - FOR(Word16 param_band_idx = 0; param_band_idx < hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { - f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport * nchan_out_cov); - IF(hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr) { - f2me_buf(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_transport * nchan_out_cov); - } - } } -#endif - if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef IVAS_FLOAT_FIXED - ivas_mc2sba_fx(st_ivas->hIntSetup, p_output_f_fx, p_output_f_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0); -#else - ivas_mc2sba(st_ivas->hIntSetup, output_f, output_f, hParamMC->num_freq_bands * slots_to_render, st_ivas->hOutSetup.ambisonics_order, 0.f); -#endif // IVAS_FLOAT_FIXED + ivas_mc2sba( st_ivas->hIntSetup, output_f, output_f, hParamMC->num_freq_bands * slots_to_render, st_ivas->hOutSetup.ambisonics_order, 0.f ); } /* update */ - - if (hParamMC->slots_rendered == hParamMC->num_slots) + if ( hParamMC->slots_rendered == hParamMC->num_slots ) { -#ifdef IVAS_FLOAT_FIXED hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; - param_mc_update_mixing_matrices_fx(hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_transport, nchan_out_cov); -#else - param_mc_update_mixing_matrices(hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_transport, nchan_out_cov); -#endif + param_mc_update_mixing_matrices( hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_transport, nchan_out_cov ); } + hParamMC->subframes_rendered = last_sf; + *nSamplesAvailableNext = ( hParamMC->num_slots - hParamMC->slots_rendered ) * NS2SA( output_Fs, CLDFB_SLOT_NS ); + pop_wmops(); -#ifdef IVAS_FLOAT_FIXED -if (st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) -{ - FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - fixedToFloat_arrL(output_f_fx[i], output_f[i], Q11, *nSamplesRendered); - } -} -if (hParamMC->slots_rendered == hParamMC->num_slots) -{ - FOR(Word16 param_band_idx = 0; param_band_idx < hParamMC->hMetadataPMC->nbands_coded; param_band_idx++) { - IF(hParamMC->band_grouping[param_band_idx] < hParamMC->h_output_synthesis_params.max_band_decorr) { - mvr2r(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[param_band_idx], nchan_transport * nchan_out_cov); - } - mvr2r(hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[param_band_idx], nchan_transport * nchan_out_cov); - } + return; } #endif -hParamMC->subframes_rendered = last_sf; -*nSamplesAvailableNext = (hParamMC->num_slots - hParamMC->slots_rendered) * NS2SA(output_Fs, CLDFB_SLOT_NS); -pop_wmops(); -return; -} -#endif + /*------------------------------------------------------------------------- * ivas_param_mc_dec() * diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 40f8de567..d29f63ceb 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -613,8 +613,6 @@ ivas_error ivas_spar_dec_fx( { st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j] = float_to_fix( st_ivas->hSpatParamRendCom->energy_ratio2[i][j], 30 ); } - st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j] = float_to_fix16( st_ivas->hSpatParamRendCom->surroundingCoherence[i][j], 15 ); - st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j] = float_to_fix16( st_ivas->hSpatParamRendCom->spreadCoherence[i][j], 15 ); } } } @@ -712,8 +710,6 @@ ivas_error ivas_spar_dec_fx( { st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); } - st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15 ); - st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15 ); } } } diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 97c00f323..69c5ddb67 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1321,10 +1321,7 @@ static ivas_error IVAS_DEC_GetTcSamples( IF(EQ_32(st_ivas->hQMetaData->no_directions, 2)) { st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30); - st_ivas->hSpatParamRendCom->spreadCoherence2[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->spreadCoherence2_fx[i][j], 15); } - st_ivas->hSpatParamRendCom->surroundingCoherence[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->surroundingCoherence_fx[i][j], 15); - st_ivas->hSpatParamRendCom->spreadCoherence[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->spreadCoherence_fx[i][j], 15); } } } diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index b476af9e3..657e633a3 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -54,9 +54,9 @@ #define DIRAC_DUCK_ALPHA 0.8f #define DIRAC_DUCK_GAMMA 1.5f #ifdef IVAS_FLOAT_FIXED -#define DIRAC_DUCK_GAMMA_FX 1610612736 // Q30 -#define DIRAC_DUCK_ALPHA_FX 1717986944 //Q31 -#define ONE_M_DIRAC_DUCK_ALPHA 429496736 //Q31 +#define DIRAC_DUCK_GAMMA_FX 1610612736 /* Q30 */ +#define DIRAC_DUCK_ALPHA_FX 1717986944 /* Q31 */ +#define ONE_M_DIRAC_DUCK_ALPHA 429496736 /* Q31 */ #endif /*------------------------------------------------------------------------- @@ -65,9 +65,8 @@ #ifndef IVAS_FLOAT_FIXED static void get_lattice_coeffs( const int16_t band_index, const int16_t channel_index, float *lattice_coeffs ); -#endif static void lattice2allpass( const int16_t filter_length, const float *lattice_coeffs, float *filter_coeffs_num_real, float *filter_coeffs_den_real ); -#ifdef IVAS_FLOAT_FIXED +#else static void get_lattice_coeffs_fx( const Word16 band_index, const Word16 channel_index, Word16 *lattice_coeffs ); static void lattice2allpass_fx( const int16_t filter_length, const Word16 *lattice_coeffs_fx, Word16 *filter_coeffs_num_real_fx, Word16 *filter_coeffs_den_real_fx ); #endif @@ -77,6 +76,8 @@ static void lattice2allpass_fx( const int16_t filter_length, const Word16 *latti * * Allocate and initialize TD decorrelator decoder handle *------------------------------------------------------------------------*/ + +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_dec_decorr_open( DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, @@ -105,72 +106,72 @@ ivas_error ivas_dirac_dec_decorr_open( * prepare library opening *-----------------------------------------------------------------*/ - /* allocate structs */ - if ((freq_domain_decorr_ap_params = (DIRAC_DECORR_PARAMS *)malloc(sizeof(DIRAC_DECORR_PARAMS))) == NULL) + /* allocate structs */ + if ( ( freq_domain_decorr_ap_params = (DIRAC_DECORR_PARAMS *) malloc( sizeof( DIRAC_DECORR_PARAMS ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_state = (DIRAC_DECORR_STATE *)malloc(sizeof(DIRAC_DECORR_STATE))) == NULL) + if ( ( freq_domain_decorr_ap_state = (DIRAC_DECORR_STATE *) malloc( sizeof( DIRAC_DECORR_STATE ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } /*-----------------------------------------------------------------* * check input parameters *-----------------------------------------------------------------*/ - assert((num_freq_bands > 0) && "Error: Number of frequency bands <= 0!"); + assert( ( num_freq_bands > 0 ) && "Error: Number of frequency bands <= 0!" ); - if (synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD) + if ( synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { num_outputs_diff -= nchan_transport; } - assert((num_outputs_diff >= 0) && (num_outputs_diff <= DIRAC_MAX_NUM_DECORR_FILTERS) && "Error: Number of channels <= 0 or > DIRAC_MAX_NUM_DECORR_FILTERS"); + assert( ( num_outputs_diff >= 0 ) && ( num_outputs_diff <= DIRAC_MAX_NUM_DECORR_FILTERS ) && "Error: Number of channels <= 0 or > DIRAC_MAX_NUM_DECORR_FILTERS" ); /*-----------------------------------------------------------------* * set default parameters *-----------------------------------------------------------------*/ - if (synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD) + if ( synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*Decorrelation in SHD*/ freq_domain_decorr_ap_params->add_back_onsets_on = 0; - if (nchan_transport > 2) + if ( nchan_transport > 2 ) { freq_domain_decorr_ap_params->max_frequency = 2000; } else { - freq_domain_decorr_ap_params->max_frequency = (min(num_freq_bands, DIRAC_MAX_DECORR_CLDFB_BANDS_AMBI) * 24000) / CLDFB_NO_CHANNELS_MAX; + freq_domain_decorr_ap_params->max_frequency = ( min( num_freq_bands, DIRAC_MAX_DECORR_CLDFB_BANDS_AMBI ) * 24000 ) / CLDFB_NO_CHANNELS_MAX; } } - else if (synthesisConf == DIRAC_SYNTHESIS_COV_MC_LS) + else if ( synthesisConf == DIRAC_SYNTHESIS_COV_MC_LS ) { /*Decorrelation in LS channels for MC*/ freq_domain_decorr_ap_params->add_back_onsets_on = 1; - freq_domain_decorr_ap_params->max_frequency = (PARAM_MC_MAX_DECORR_CLDFB_BANDS * 24000) / CLDFB_NO_CHANNELS_MAX; + freq_domain_decorr_ap_params->max_frequency = ( PARAM_MC_MAX_DECORR_CLDFB_BANDS * 24000 ) / CLDFB_NO_CHANNELS_MAX; } else { /*Decorrelation in LS channels*/ freq_domain_decorr_ap_params->add_back_onsets_on = 1; - freq_domain_decorr_ap_params->max_frequency = (DIRAC_MAX_DECORR_CLDFB_BANDS * 24000) / CLDFB_NO_CHANNELS_MAX; + freq_domain_decorr_ap_params->max_frequency = ( DIRAC_MAX_DECORR_CLDFB_BANDS * 24000 ) / CLDFB_NO_CHANNELS_MAX; } freq_domain_decorr_ap_params->use_ducker = 1; - assert((freq_domain_decorr_ap_params->max_frequency >= 0) && (freq_domain_decorr_ap_params->max_frequency <= output_Fs / 2) && "Error: max_frequency invalid!"); + assert( ( freq_domain_decorr_ap_params->max_frequency >= 0 ) && ( freq_domain_decorr_ap_params->max_frequency <= output_Fs / 2 ) && "Error: max_frequency invalid!" ); /* compute maximum band for decorrelation */ - assert(frequency_axis != NULL); - for (k = num_freq_bands - 1; k > 0; --k) + assert( frequency_axis != NULL ); + for ( k = num_freq_bands - 1; k > 0; --k ) { freq_domain_decorr_ap_params->max_band_decorr = k + 1; /* outside "if" to avoid uninitialized variable */ - if (frequency_axis[k] < freq_domain_decorr_ap_params->max_frequency) + if ( frequency_axis[k] < freq_domain_decorr_ap_params->max_frequency ) { break; } @@ -180,70 +181,53 @@ ivas_error ivas_dirac_dec_decorr_open( * open sub-modules *-----------------------------------------------------------------*/ - /* open onset detection module */ -#ifdef IVAS_FLOAT_FIXED - IF (synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD) - { - /*Onset detector up to Nyquist and not only up to max_band_decorr*/ - IF ((error = ivas_dirac_dec_onset_detection_open_fx(num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state)) != IVAS_ERR_OK) - { - return error; - } - } - ELSE - { - if ((error = ivas_dirac_dec_onset_detection_open_fx(num_protos_diff, num_freq_bands, freq_domain_decorr_ap_params->max_band_decorr, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state)) != IVAS_ERR_OK) - { - return error; - } - } -#else - if (synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD) + /* open onset detection module */ + if ( synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*Onset detector up to Nyquist and not only up to max_band_decorr*/ - if ((error = ivas_dirac_dec_onset_detection_open(num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state)) != IVAS_ERR_OK) + if ( ( error = ivas_dirac_dec_onset_detection_open( num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) { return error; } } else { - if ((error = ivas_dirac_dec_onset_detection_open(num_protos_diff, num_freq_bands, freq_domain_decorr_ap_params->max_band_decorr, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state)) != IVAS_ERR_OK) + if ( ( error = ivas_dirac_dec_onset_detection_open( num_protos_diff, num_freq_bands, freq_domain_decorr_ap_params->max_band_decorr, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) { return error; } } -#endif + /*-----------------------------------------------------------------* * prepare processing parameters *-----------------------------------------------------------------*/ - /* calculate decorrelation split bands */ + /* calculate decorrelation split bands */ split_freq_ptr = &split_frequencies_bands[0]; split_freq_ptr[0] = 0; - for (k = 1; k < DIRAC_DECORR_NUM_SPLIT_BANDS; k++) + for ( k = 1; k < DIRAC_DECORR_NUM_SPLIT_BANDS; k++ ) { - split_freq_ptr[k] = (int16_t)((float)CLDFB_NO_CHANNELS_MAX * ap_split_frequencies[k] + 0.5f) - 1; + split_freq_ptr[k] = (int16_t) ( (float) CLDFB_NO_CHANNELS_MAX * ap_split_frequencies[k] + 0.5f ) - 1; } split_band_index_start = 0; split_frequencies_bands[k] = 0; freq_domain_decorr_ap_params->num_split_frequency_bands = 0; - for (k = 1; k < DIRAC_DECORR_NUM_SPLIT_BANDS + 1; k++) + for ( k = 1; k < DIRAC_DECORR_NUM_SPLIT_BANDS + 1; k++ ) { freq_domain_decorr_ap_params->num_split_frequency_bands++; - if (split_frequencies_bands[k] >= freq_domain_decorr_ap_params->max_band_decorr) + if ( split_frequencies_bands[k] >= freq_domain_decorr_ap_params->max_band_decorr ) { split_frequencies_bands[k] = freq_domain_decorr_ap_params->max_band_decorr; break; } } - if ((freq_domain_decorr_ap_params->split_frequency_bands = (int16_t *)malloc(sizeof(int16_t) * (freq_domain_decorr_ap_params->num_split_frequency_bands + 1))) == NULL) + if ( ( freq_domain_decorr_ap_params->split_frequency_bands = (int16_t *) malloc( sizeof( int16_t ) * ( freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ) ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - mvs2s(&split_frequencies_bands[0], freq_domain_decorr_ap_params->split_frequency_bands, freq_domain_decorr_ap_params->num_split_frequency_bands + 1); + mvs2s( &split_frequencies_bands[0], freq_domain_decorr_ap_params->split_frequency_bands, freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ); /* calc buffer size and allocate arrays */ freq_domain_decorr_ap_state->decorr_buffer = NULL; @@ -256,72 +240,59 @@ ivas_error ivas_dirac_dec_decorr_open( freq_domain_decorr_ap_params->pre_delay = NULL; freq_domain_decorr_ap_params->filter_length = NULL; -#ifdef IVAS_FLOAT_FIXED - freq_domain_decorr_ap_state->decorr_buffer_fx = NULL; -#endif - - if (num_outputs_diff > 0) + if ( num_outputs_diff > 0 ) { - buffer_size_decorr = (ap_pre_delay[split_band_index_start] + ap_filter_length[split_band_index_start]); - if ((freq_domain_decorr_ap_state->decorr_buffer = (float *)malloc(sizeof(float) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr)) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); - } - set_f(freq_domain_decorr_ap_state->decorr_buffer, 0.0f, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr); - -#ifdef IVAS_FLOAT_FIXED - IF((freq_domain_decorr_ap_state->decorr_buffer_fx = (Word32 *)malloc(sizeof(Word32) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr)) == NULL) + buffer_size_decorr = ( ap_pre_delay[split_band_index_start] + ap_filter_length[split_band_index_start] ); + if ( ( freq_domain_decorr_ap_state->decorr_buffer = (float *) malloc( sizeof( float ) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - set32_fx(freq_domain_decorr_ap_state->decorr_buffer_fx, 0, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr); - freq_domain_decorr_ap_state->q_decorr_buffer = Q31; -#endif + set_f( freq_domain_decorr_ap_state->decorr_buffer, 0.0f, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); - if ((freq_domain_decorr_ap_params->filter_coeff_num_real = (float *)malloc(sizeof(float) * (ap_filter_length[split_band_index_start] + 1) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff)) == NULL) + if ( ( freq_domain_decorr_ap_params->filter_coeff_num_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_params->filter_coeff_den_real = (float *)malloc(sizeof(float) * (ap_filter_length[split_band_index_start] + 1) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff)) == NULL) + if ( ( freq_domain_decorr_ap_params->filter_coeff_den_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_params->phase_coeff_real = (float *)malloc(sizeof(float) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff)) == NULL) + if ( ( freq_domain_decorr_ap_params->phase_coeff_real = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_params->phase_coeff_imag = (float *)malloc(sizeof(float) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff)) == NULL) + if ( ( freq_domain_decorr_ap_params->phase_coeff_imag = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_state->direct_energy_smooth = (float *)malloc(sizeof(float) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff)) == NULL) + if ( ( freq_domain_decorr_ap_state->direct_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_state->reverb_energy_smooth = (float *)malloc(sizeof(float) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff)) == NULL) + if ( ( freq_domain_decorr_ap_state->reverb_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_params->pre_delay = (int16_t *)malloc(sizeof(int16_t) * freq_domain_decorr_ap_params->num_split_frequency_bands)) == NULL) + if ( ( freq_domain_decorr_ap_params->pre_delay = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - if ((freq_domain_decorr_ap_params->filter_length = (int16_t *)malloc(sizeof(int16_t) * freq_domain_decorr_ap_params->num_split_frequency_bands)) == NULL) + if ( ( freq_domain_decorr_ap_params->filter_length = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } - set_f(freq_domain_decorr_ap_state->direct_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff); - set_f(freq_domain_decorr_ap_state->reverb_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff); + set_f( freq_domain_decorr_ap_state->direct_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); + set_f( freq_domain_decorr_ap_state->reverb_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); /* compute filter coefficients */ - for (k = 0; k < freq_domain_decorr_ap_params->num_split_frequency_bands; k++) + for ( k = 0; k < freq_domain_decorr_ap_params->num_split_frequency_bands; k++ ) { k_in = freq_domain_decorr_ap_params->split_frequency_bands[k]; k_out = freq_domain_decorr_ap_params->split_frequency_bands[k + 1]; @@ -330,31 +301,20 @@ ivas_error ivas_dirac_dec_decorr_open( freq_domain_decorr_ap_params->filter_length[k] = ap_filter_length[band_table_idx] + 1; freq_domain_decorr_ap_params->pre_delay[k] = ap_pre_delay[band_table_idx]; - for (l = 0; l < num_outputs_diff; l++) + for ( l = 0; l < num_outputs_diff; l++ ) { - for (m = 0; m < num_bands; m++) + for ( m = 0; m < num_bands; m++ ) { n = k_in + m; cur_lattice_delta_phi = ap_lattice_delta_phi[l * DIRAC_MAX_DECORR_FILTER_LEN + ap_filter_length[k] - 1] * n; - static int count = 0; - count++; - freq_domain_decorr_ap_params->phase_coeff_real[l * freq_domain_decorr_ap_params->max_band_decorr + n] = cosf(cur_lattice_delta_phi); - freq_domain_decorr_ap_params->phase_coeff_imag[l * freq_domain_decorr_ap_params->max_band_decorr + n] = -sinf(cur_lattice_delta_phi); + freq_domain_decorr_ap_params->phase_coeff_real[l * freq_domain_decorr_ap_params->max_band_decorr + n] = cosf( cur_lattice_delta_phi ); + freq_domain_decorr_ap_params->phase_coeff_imag[l * freq_domain_decorr_ap_params->max_band_decorr + n] = -sinf( cur_lattice_delta_phi ); /* calculate phase offset */ -#ifdef IVAS_FLOAT_FIXED - Word16 lattice_coeffs_fx[2 * DIRAC_MAX_DECORR_FILTER_LEN]; - get_lattice_coeffs_fx(band_table_idx, l, lattice_coeffs_fx); - FOR(Word16 i = 0; i < ap_filter_length[band_table_idx]; i++) { - lattice_coeffs[i] = (float)lattice_coeffs_fx[i] / (1 << 15); - } -#else - get_lattice_coeffs(band_table_idx, l, lattice_coeffs); -#endif - + get_lattice_coeffs( band_table_idx, l, lattice_coeffs ); /* calcualte transfer function coefficients from the lattice coefficients */ - lattice2allpass(freq_domain_decorr_ap_params->filter_length[k], lattice_coeffs, &freq_domain_decorr_ap_params->filter_coeff_num_real[(k_in + m) * (freq_domain_decorr_ap_params->filter_length[0] * num_outputs_diff) + l * freq_domain_decorr_ap_params->filter_length[0]], &freq_domain_decorr_ap_params->filter_coeff_den_real[(k_in + m) * (freq_domain_decorr_ap_params->filter_length[0] * num_outputs_diff) + l * freq_domain_decorr_ap_params->filter_length[0]]); + lattice2allpass( freq_domain_decorr_ap_params->filter_length[k], lattice_coeffs, &freq_domain_decorr_ap_params->filter_coeff_num_real[( k_in + m ) * ( freq_domain_decorr_ap_params->filter_length[0] * num_outputs_diff ) + l * freq_domain_decorr_ap_params->filter_length[0]], &freq_domain_decorr_ap_params->filter_coeff_den_real[( k_in + m ) * ( freq_domain_decorr_ap_params->filter_length[0] * num_outputs_diff ) + l * freq_domain_decorr_ap_params->filter_length[0]] ); } } } @@ -365,8 +325,7 @@ ivas_error ivas_dirac_dec_decorr_open( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_dirac_dec_decorr_open_fx( DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, @@ -533,10 +492,6 @@ ivas_error ivas_dirac_dec_decorr_open_fx( #if 1 /*float code to be cleaned up*/ freq_domain_decorr_ap_state->decorr_buffer = NULL; - freq_domain_decorr_ap_params->filter_coeff_num_real = NULL; - freq_domain_decorr_ap_params->filter_coeff_den_real = NULL; - freq_domain_decorr_ap_params->phase_coeff_real = NULL; - freq_domain_decorr_ap_params->phase_coeff_imag = NULL; freq_domain_decorr_ap_state->direct_energy_smooth = NULL; freq_domain_decorr_ap_state->reverb_energy_smooth = NULL; freq_domain_decorr_ap_params->pre_delay = NULL; @@ -564,26 +519,6 @@ ivas_error ivas_dirac_dec_decorr_open_fx( } set_f( freq_domain_decorr_ap_state->decorr_buffer, 0.0f, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); - if ( ( freq_domain_decorr_ap_params->filter_coeff_num_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); - } - - if ( ( freq_domain_decorr_ap_params->filter_coeff_den_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); - } - - if ( ( freq_domain_decorr_ap_params->phase_coeff_real = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); - } - - if ( ( freq_domain_decorr_ap_params->phase_coeff_imag = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); - } - if ( ( freq_domain_decorr_ap_state->direct_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); @@ -680,25 +615,13 @@ ivas_error ivas_dirac_dec_decorr_open_fx( freq_domain_decorr_ap_params->phase_coeff_real_fx[l * freq_domain_decorr_ap_params->max_band_decorr + n] = temp_a; freq_domain_decorr_ap_params->phase_coeff_imag_fx[l * freq_domain_decorr_ap_params->max_band_decorr + n] = temp_b; - /*To be cleaned up later*/ - freq_domain_decorr_ap_params->phase_coeff_real[l * freq_domain_decorr_ap_params->max_band_decorr + n] = fixedToFloat( freq_domain_decorr_ap_params->phase_coeff_real_fx[l * freq_domain_decorr_ap_params->max_band_decorr + n], Q14 ); - freq_domain_decorr_ap_params->phase_coeff_imag[l * freq_domain_decorr_ap_params->max_band_decorr + n] = fixedToFloat( freq_domain_decorr_ap_params->phase_coeff_imag_fx[l * freq_domain_decorr_ap_params->max_band_decorr + n], Q14 ); - /* calculate phase offset */ get_lattice_coeffs_fx( band_table_idx, l, lattice_coeffs_fx ); /* calcualte transfer function coefficients from the lattice coefficients */ Word16 a = ( k_in + m ) * ( freq_domain_decorr_ap_params->filter_length[0] * num_outputs_diff ) + l * freq_domain_decorr_ap_params->filter_length[0]; - Word16 filter_length = freq_domain_decorr_ap_params->filter_length[k]; lattice2allpass_fx( freq_domain_decorr_ap_params->filter_length[k], lattice_coeffs_fx, &freq_domain_decorr_ap_params->filter_coeff_num_real_fx[a], &freq_domain_decorr_ap_params->filter_coeff_den_real_fx[a] ); - - /*To be cleaned up later*/ - FOR( Word16 i = 0; i < filter_length; i++ ) - { - freq_domain_decorr_ap_params->filter_coeff_num_real[a + i] = fixedToFloat( freq_domain_decorr_ap_params->filter_coeff_num_real_fx[a + i], Q12 ); - freq_domain_decorr_ap_params->filter_coeff_den_real[a + i] = fixedToFloat( freq_domain_decorr_ap_params->filter_coeff_den_real_fx[a + i], Q12 ); - } } } } @@ -710,12 +633,15 @@ ivas_error ivas_dirac_dec_decorr_open_fx( return IVAS_ERR_OK; } #endif + + /*------------------------------------------------------------------------- * ivas_dirac_dec_decorr_process() * * *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_decorr_process( const int16_t num_freq_bands, int16_t num_channels, @@ -992,8 +918,7 @@ void ivas_dirac_dec_decorr_process( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_dirac_dec_decorr_process_fx( const Word16 num_freq_bands, Word16 num_channels, @@ -1487,6 +1412,7 @@ void ivas_dirac_dec_decorr_process_fx( } #endif + /*------------------------------------------------------------------------- * ivas_dirac_dec_decorr_close() * @@ -1595,34 +1521,6 @@ void ivas_dirac_dec_decorr_close_fx( (*ph_freq_domain_decorr_ap_params)->filter_length = NULL; } - /* free filter coeff param buffers */ - if ((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real != NULL) - { - free((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real); - (*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real = NULL; - } - - /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real != NULL) - { - free((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real); - (*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real = NULL; - } - - /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag != NULL) - { - free((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag); - (*ph_freq_domain_decorr_ap_params)->phase_coeff_imag = NULL; - } - - /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->phase_coeff_real != NULL) - { - free((*ph_freq_domain_decorr_ap_params)->phase_coeff_real); - (*ph_freq_domain_decorr_ap_params)->phase_coeff_real = NULL; - } - /* free pre-delay param buffer */ if ((*ph_freq_domain_decorr_ap_params)->split_frequency_bands != NULL) { @@ -1631,12 +1529,14 @@ void ivas_dirac_dec_decorr_close_fx( } #ifdef IVAS_FLOAT_FIXED + /* free filter coeff param buffers */ IF((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real_fx != NULL) { free((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real_fx); (*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real_fx = NULL; } + /* free pre-delay param buffer */ IF((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real_fx != NULL) { free((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real_fx); @@ -1667,7 +1567,6 @@ void ivas_dirac_dec_decorr_close_fx( return; } #else - void ivas_dirac_dec_decorr_close( HANDLE_DIRAC_DECORR_PARAMS *ph_freq_domain_decorr_ap_params, HANDLE_DIRAC_DECORR_STATE *ph_freq_domain_decorr_ap_state ) @@ -1683,7 +1582,7 @@ void ivas_dirac_dec_decorr_close( return; } - if (*ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL) + if ( *ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL ) { return; } @@ -1692,17 +1591,17 @@ void ivas_dirac_dec_decorr_close( * free onset filter arrays *-----------------------------------------------------------------*/ - dirac_onset_detection_state = &(*ph_freq_domain_decorr_ap_state)->h_onset_detection_power_state; + dirac_onset_detection_state = &( *ph_freq_domain_decorr_ap_state )->h_onset_detection_power_state; - if (dirac_onset_detection_state->onset_detector_1 != NULL) + if ( dirac_onset_detection_state->onset_detector_1 != NULL ) { - free(dirac_onset_detection_state->onset_detector_1); + free( dirac_onset_detection_state->onset_detector_1 ); dirac_onset_detection_state->onset_detector_1 = NULL; } - if (dirac_onset_detection_state->onset_detector_2 != NULL) + if ( dirac_onset_detection_state->onset_detector_2 != NULL ) { - free(dirac_onset_detection_state->onset_detector_2); + free( dirac_onset_detection_state->onset_detector_2 ); dirac_onset_detection_state->onset_detector_2 = NULL; } @@ -1710,87 +1609,88 @@ void ivas_dirac_dec_decorr_close( * memory deallocation *-----------------------------------------------------------------*/ - /* free decorrelation buffer */ - if ((*ph_freq_domain_decorr_ap_state)->decorr_buffer != NULL) + /* free decorrelation buffer */ + if ( ( *ph_freq_domain_decorr_ap_state )->decorr_buffer != NULL ) { - free((*ph_freq_domain_decorr_ap_state)->decorr_buffer); - (*ph_freq_domain_decorr_ap_state)->decorr_buffer = NULL; + free( ( *ph_freq_domain_decorr_ap_state )->decorr_buffer ); + ( *ph_freq_domain_decorr_ap_state )->decorr_buffer = NULL; } /* free ducker smoothed direct energy buffer */ - if ((*ph_freq_domain_decorr_ap_state)->direct_energy_smooth != NULL) + if ( ( *ph_freq_domain_decorr_ap_state )->direct_energy_smooth != NULL ) { - free((*ph_freq_domain_decorr_ap_state)->direct_energy_smooth); - (*ph_freq_domain_decorr_ap_state)->direct_energy_smooth = NULL; + free( ( *ph_freq_domain_decorr_ap_state )->direct_energy_smooth ); + ( *ph_freq_domain_decorr_ap_state )->direct_energy_smooth = NULL; } /* free ducker smoothed reverb energy buffer */ - if ((*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth != NULL) + if ( ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth != NULL ) { - free((*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth); - (*ph_freq_domain_decorr_ap_state)->reverb_energy_smooth = NULL; + free( ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth ); + ( *ph_freq_domain_decorr_ap_state )->reverb_energy_smooth = NULL; } /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->pre_delay != NULL) + if ( ( *ph_freq_domain_decorr_ap_params )->pre_delay != NULL ) { - free((*ph_freq_domain_decorr_ap_params)->pre_delay); - (*ph_freq_domain_decorr_ap_params)->pre_delay = NULL; + free( ( *ph_freq_domain_decorr_ap_params )->pre_delay ); + ( *ph_freq_domain_decorr_ap_params )->pre_delay = NULL; } /* free filter length param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->filter_length != NULL) + if ( ( *ph_freq_domain_decorr_ap_params )->filter_length != NULL ) { - free((*ph_freq_domain_decorr_ap_params)->filter_length); - (*ph_freq_domain_decorr_ap_params)->filter_length = NULL; + free( ( *ph_freq_domain_decorr_ap_params )->filter_length ); + ( *ph_freq_domain_decorr_ap_params )->filter_length = NULL; } /* free filter coeff param buffers */ - if ((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real != NULL) + if ( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_num_real != NULL ) { - free((*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real); - (*ph_freq_domain_decorr_ap_params)->filter_coeff_num_real = NULL; + free( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_num_real ); + ( *ph_freq_domain_decorr_ap_params )->filter_coeff_num_real = NULL; } /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real != NULL) + if ( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_den_real != NULL ) { - free((*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real); - (*ph_freq_domain_decorr_ap_params)->filter_coeff_den_real = NULL; + free( ( *ph_freq_domain_decorr_ap_params )->filter_coeff_den_real ); + ( *ph_freq_domain_decorr_ap_params )->filter_coeff_den_real = NULL; } /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag != NULL) + if ( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_imag != NULL ) { - free((*ph_freq_domain_decorr_ap_params)->phase_coeff_imag); - (*ph_freq_domain_decorr_ap_params)->phase_coeff_imag = NULL; + free( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_imag ); + ( *ph_freq_domain_decorr_ap_params )->phase_coeff_imag = NULL; } /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->phase_coeff_real != NULL) + if ( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real != NULL ) { - free((*ph_freq_domain_decorr_ap_params)->phase_coeff_real); - (*ph_freq_domain_decorr_ap_params)->phase_coeff_real = NULL; + free( ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real ); + ( *ph_freq_domain_decorr_ap_params )->phase_coeff_real = NULL; } /* free pre-delay param buffer */ - if ((*ph_freq_domain_decorr_ap_params)->split_frequency_bands != NULL) + if ( ( *ph_freq_domain_decorr_ap_params )->split_frequency_bands != NULL ) { - free((*ph_freq_domain_decorr_ap_params)->split_frequency_bands); - (*ph_freq_domain_decorr_ap_params)->split_frequency_bands = NULL; + free( ( *ph_freq_domain_decorr_ap_params )->split_frequency_bands ); + ( *ph_freq_domain_decorr_ap_params )->split_frequency_bands = NULL; } /* free pointers to state and parameter structs */ - free(*ph_freq_domain_decorr_ap_params); + free( *ph_freq_domain_decorr_ap_params ); *ph_freq_domain_decorr_ap_params = NULL; - free(*ph_freq_domain_decorr_ap_state); + free( *ph_freq_domain_decorr_ap_state ); *ph_freq_domain_decorr_ap_state = NULL; return; } - #endif // IVAS_FLOAT_FIXED + + /*------------------------------------------------------------------------- * Local functions *------------------------------------------------------------------------*/ @@ -1812,9 +1712,7 @@ static void get_lattice_coeffs( return; } -#endif - -#ifdef IVAS_FLOAT_FIXED +#else static void get_lattice_coeffs_fx( const Word16 band_index, const Word16 channel_index, @@ -1834,7 +1732,9 @@ static void get_lattice_coeffs_fx( } #endif + /* convert lattice filter coeffs to all pass transfer function coeffs */ +#ifndef IVAS_FLOAT_FIXED static void lattice2allpass( const int16_t filter_length, const float *lattice_coeffs, @@ -1878,98 +1778,56 @@ static void lattice2allpass( return; } - -#ifdef IVAS_FLOAT_FIXED +#else static void lattice2allpass_fx( const int16_t filter_length, const Word16 *lattice_coeffs_fx, Word16 *filter_coeffs_num_real_fx, - Word16 *filter_coeffs_den_real_fx) + Word16 *filter_coeffs_den_real_fx ) { Word16 i, p; - -#ifdef IVAS_FLOAT_FIXED + Word16 alpha_real_fx[2][DIRAC_MAX_DECORR_FILTER_LEN + 1]; Word16 *alpha_real_p_old_fx = &alpha_real_fx[0][0]; Word16 *alpha_real_p_fx = &alpha_real_fx[1][0]; Word16 *tmp_fx; -#else - float alpha_real[2][DIRAC_MAX_DECORR_FILTER_LEN + 1]; - float *alpha_real_p_old = &alpha_real[0][0]; - float *alpha_real_p = &alpha_real[1][0]; - float *tmp; -#endif - FOR (i = 0; i < 2; i++) + FOR( i = 0; i < 2; i++ ) { -#ifdef IVAS_FLOAT_FIXED - set16_fx(alpha_real_fx[i], 0, DIRAC_MAX_DECORR_FILTER_LEN + 1); -#else - set_f(alpha_real[i], 0.0f, DIRAC_MAX_DECORR_FILTER_LEN + 1); -#endif + set16_fx( alpha_real_fx[i], 0, DIRAC_MAX_DECORR_FILTER_LEN + 1 ); } - -#ifdef IVAS_FLOAT_FIXED + alpha_real_p_fx[0] = ONE_IN_Q12; - alpha_real_p_old_fx[0] = ONE_IN_Q12; move16(); + alpha_real_p_old_fx[0] = ONE_IN_Q12; move16(); -#else - alpha_real_p[0] = 1.0f; - alpha_real_p_old[0] = 1.0f; -#endif /* recursion */ - -#ifdef IVAS_FLOAT_FIXED Word16 lattice_alpha = 0; move16(); - FOR (p = 1; p < filter_length; p++) + FOR( p = 1; p < filter_length; p++ ) { - alpha_real_p_fx[p] = shr(lattice_coeffs_fx[(p - 1)], 3);//Q12 + alpha_real_p_fx[p] = shr( lattice_coeffs_fx[( p - 1 )], 3 ); /* Q12 */ - FOR (i = 1; i < p; i++) + FOR( i = 1; i < p; i++ ) { - lattice_alpha = mult(lattice_coeffs_fx[(p - 1)] , alpha_real_p_old_fx[p - i]);//Q12 - alpha_real_p_fx[i] = add(alpha_real_p_old_fx[i] , lattice_alpha);//Q12 + lattice_alpha = mult( lattice_coeffs_fx[( p - 1 )], alpha_real_p_old_fx[p - i] ); /* Q12 */ + alpha_real_p_fx[i] = add( alpha_real_p_old_fx[i], lattice_alpha ); /* Q12 */ + move16(); } /* switch pointers */ tmp_fx = alpha_real_p_old_fx; alpha_real_p_old_fx = alpha_real_p_fx; alpha_real_p_fx = tmp_fx; } -#else - for (p = 1; p < filter_length; p++) - { - alpha_real_p[p] = lattice_coeffs[(p - 1)]; - - for (i = 1; i < p; i++) - { - alpha_real_p[i] = alpha_real_p_old[i] + lattice_coeffs[(p - 1)] * alpha_real_p_old[p - i]; - } - /* switch pointers */ - tmp = alpha_real_p_old; - alpha_real_p_old = alpha_real_p; - alpha_real_p = tmp; - } -#endif - -#ifdef IVAS_FLOAT_FIXED - FOR (i = 0; i < filter_length; i++) + FOR( i = 0; i < filter_length; i++ ) { - filter_coeffs_den_real_fx[i] = alpha_real_p_old_fx[i]; - filter_coeffs_num_real_fx[i] = alpha_real_p_old_fx[filter_length - i - 1]; + filter_coeffs_den_real_fx[i] = alpha_real_p_old_fx[i]; /* Q12 */ move16(); + filter_coeffs_num_real_fx[i] = alpha_real_p_old_fx[filter_length - i - 1]; /* Q12 */ move16(); - }//Q12 -#else - for (i = 0; i < filter_length; i++) - { - filter_coeffs_den_real[i] = alpha_real_p_old[i]; - filter_coeffs_num_real[i] = alpha_real_p_old[filter_length - i - 1]; } -#endif return; } diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index 0f0eb51a4..ff9c0a573 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -44,12 +44,6 @@ #include "prot_fx1.h" #include "prot_fx2.h" -/*------------------------------------------------------------------------- - * ivas_dirac_dec_onset_detection_open() - * - * onset detection - *------------------------------------------------------------------------*/ - #ifdef IVAS_FLOAT_FIXED static Word16 BASOP_Util_Cmp_Mant32Exp_sat(Word32 a_m, Word16 a_e, Word32 b_m, Word16 b_e); Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ @@ -146,6 +140,14 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ } #endif + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_onset_detection_open() + * + * onset detection + *------------------------------------------------------------------------*/ + +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_dec_onset_detection_open( const int16_t num_protos_diff, const int16_t num_freq_bands, @@ -159,28 +161,27 @@ ivas_error ivas_dirac_dec_onset_detection_open( /* check / set input parameters */ dirac_onset_detection_params->num_freq_bands = num_freq_bands; - assert(dirac_onset_detection_params->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!"); + assert( dirac_onset_detection_params->num_freq_bands > 0 && "Error: Number of frequency bands <= 0!" ); dirac_onset_detection_params->max_band_decorr = max_band_decorr; /* memory allocation */ - IF((dirac_onset_detection_state->onset_detector_1 = (float *)malloc(sizeof(float) * num_protos_diff * dirac_onset_detection_params->max_band_decorr)) == NULL) + if ( ( dirac_onset_detection_state->onset_detector_1 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); } - IF((dirac_onset_detection_state->onset_detector_2 = (float *)malloc(sizeof(float) * num_protos_diff * dirac_onset_detection_params->max_band_decorr)) == NULL) + if ( ( dirac_onset_detection_state->onset_detector_2 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n")); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); } /* init to zero */ - set_zero(dirac_onset_detection_state->onset_detector_1, num_protos_diff * dirac_onset_detection_params->max_band_decorr); - set_zero(dirac_onset_detection_state->onset_detector_2, num_protos_diff * dirac_onset_detection_params->max_band_decorr); + set_zero( dirac_onset_detection_state->onset_detector_1, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); + set_zero( dirac_onset_detection_state->onset_detector_2, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_dirac_dec_onset_detection_open_fx( const Word16 num_protos_diff, const Word16 num_freq_bands, @@ -216,12 +217,15 @@ ivas_error ivas_dirac_dec_onset_detection_open_fx( return IVAS_ERR_OK; } #endif + + /*------------------------------------------------------------------------- * ivas_dirac_dec_onset_detection_process() * * *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_onset_detection_process( const float *input_power_f, float *onset_filter, @@ -264,8 +268,7 @@ void ivas_dirac_dec_onset_detection_process( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_dirac_dec_onset_detection_process_fx( const Word32 *input_power_f, Word16 q_input_power, @@ -281,55 +284,62 @@ void ivas_dirac_dec_onset_detection_process_fx( Word32 *p_onset_detector_1_fx, *p_onset_detector_2_fx; Word16 e_scale; - //Scale_sig32(h_dirac_onset_detection_state.onset_detector_1_fx, num_protos_diff * h_dirac_onset_detection_params.max_band_decorr, -h_dirac_onset_detection_state.q_onset_detector); - //Scale_sig32(h_dirac_onset_detection_state.onset_detector_2_fx, num_protos_diff * h_dirac_onset_detection_params.max_band_decorr, -h_dirac_onset_detection_state.q_onset_detector); - //h_dirac_onset_detection_state.q_onset_detector = 0; - p_onset_detector_1_fx = h_dirac_onset_detection_state.onset_detector_1_fx;//Q0 - p_onset_detector_2_fx = h_dirac_onset_detection_state.onset_detector_2_fx;//Q0 + p_onset_detector_1_fx = h_dirac_onset_detection_state.onset_detector_1_fx; /* Q(q_onset_detector) */ + p_onset_detector_2_fx = h_dirac_onset_detection_state.onset_detector_2_fx; /* Q(q_onset_detector) */ FOR( ch_idx = 0; ch_idx < num_protos_diff; ch_idx++ ) { FOR( b = 0; b < h_dirac_onset_detection_params.max_band_decorr; b++ ) { /*detector 1: envelope max*/ - *p_onset_detector_1_fx = Mpy_32_16_1(*p_onset_detector_1_fx, DIRAC_ONSET_ALPHA_FX); //same Q0 - //Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( *p_onset_detector_1_fx, 31 - q_p_onset_detector_1, *input_power_f, 31- q_input_power); - UNUSED_PARAM(q_input_power); - IF(GT_32(*p_onset_detector_1_fx, *input_power_f)) + *p_onset_detector_1_fx = Mpy_32_16_1( *p_onset_detector_1_fx, DIRAC_ONSET_ALPHA_FX ); /* Q(q_onset_detector) */ + UNUSED_PARAM( q_input_power ); + IF( GT_32( *p_onset_detector_1_fx, *input_power_f ) ) { - *p_onset_detector_1_fx = *p_onset_detector_1_fx; + *p_onset_detector_1_fx = *p_onset_detector_1_fx; + move32(); } ELSE { - *p_onset_detector_1_fx = *input_power_f; + *p_onset_detector_1_fx = *input_power_f; + move32(); } /*detector 2: envelope min*/ - *p_onset_detector_2_fx = L_add(Mpy_32_16_1( *p_onset_detector_2_fx,DIRAC_ONSET_BETA_FX ), Mpy_32_16_1(*p_onset_detector_1_fx,ONE_DIRAC_ONSET_BETA_FX)); - IF(LT_32(*p_onset_detector_2_fx, *p_onset_detector_1_fx)) - *p_onset_detector_2_fx = *p_onset_detector_2_fx; - ELSE - { - *p_onset_detector_2_fx = *p_onset_detector_1_fx; - } - - IF(EQ_32(*p_onset_detector_1_fx, 0)) - *p_onset_detector_1_fx = L_add(*p_onset_detector_1_fx, EPSILON_FX); + *p_onset_detector_2_fx = L_add( Mpy_32_16_1( *p_onset_detector_2_fx, DIRAC_ONSET_BETA_FX ), Mpy_32_16_1( *p_onset_detector_1_fx, ONE_DIRAC_ONSET_BETA_FX ) ); /* Q(q_onset_detector) */ + IF( LT_32( *p_onset_detector_2_fx, *p_onset_detector_1_fx ) ) + { + *p_onset_detector_2_fx = *p_onset_detector_2_fx; + move32(); + } + ELSE + { + *p_onset_detector_2_fx = *p_onset_detector_1_fx; + move32(); + } + + IF( EQ_32( *p_onset_detector_1_fx, 0 ) ) + { + + *p_onset_detector_1_fx = L_add( *p_onset_detector_1_fx, EPSILON_FX ); + } /*onset filter limited between 0 and 1*/ - tmp_fx = BASOP_Util_Divide3232_Scale(*p_onset_detector_2_fx, *p_onset_detector_1_fx, &e_scale); - tmp32_fx = L_mult0(tmp_fx, DIRAC_ONSET_GAIN_FX); - IF(LT_32(tmp32_fx, 0)) + tmp_fx = BASOP_Util_Divide3232_Scale( *p_onset_detector_2_fx, *p_onset_detector_1_fx, &e_scale ); + tmp32_fx = L_mult0( tmp_fx, DIRAC_ONSET_GAIN_FX ); + IF( LT_32( tmp32_fx, 0 ) ) { - tmp32_fx = 0; + tmp32_fx = 0; + move32(); } - Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp_sat(tmp32_fx, e_scale + 4, ONE_IN_Q30, 1); - IF(EQ_16(comp_flag, 1) || EQ_16(comp_flag, 0)) - tmp32_fx = ONE_IN_Q31; + Word16 comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( tmp32_fx, e_scale + 4, ONE_IN_Q30, 1 ); + IF( EQ_16( comp_flag, 1 ) || EQ_16( comp_flag, 0 ) ) + tmp32_fx = ONE_IN_Q31; ELSE { - tmp32_fx = L_shl(tmp32_fx, e_scale + 4); + tmp32_fx = L_shl( tmp32_fx, e_scale + 4 ); } onset_filter[b] = tmp32_fx; + move32(); input_power_f++; p_onset_detector_1_fx++; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index a24ade9d3..a7ad619dd 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -114,6 +114,7 @@ static void normalizePanningGains( float *direct_response, const int16_t num_cha * * *------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED extern Word16 find_guarded_bits_fx(Word32 n); @@ -129,7 +130,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( int16_t idx, ch_idx; int16_t size; uint16_t num_diffuse_responses; - float temp_alpha_synthesis[CLDFB_NO_CHANNELS_MAX]; Word16 tmp_fx; Word16 temp_alpha_synthesis_fx[CLDFB_NO_CHANNELS_MAX]; @@ -143,7 +143,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( assert( hDirACRend->num_outputs_diff > 0 ); assert( hSpatParamRendCom->slot_size > 0 ); assert( hDirACRend->hOutSetup.is_loudspeaker_setup == 0 || hDirACRend->hOutSetup.is_loudspeaker_setup == 1 ); - assert( hDirACRend->diffuse_response_function != NULL ); + assert( hDirACRend->diffuse_response_function_fx != NULL ); IF ( hDirACRend->proto_signal_decorr_on ) { @@ -224,12 +224,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } /* buffer length and interpolator */ - /*TODO : remove float code*/ - if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( JBM_CLDFB_SLOTS_IN_SUBFRAME * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); - } - IF ((dirac_output_synthesis_params->interpolator_fx = (Word16 *)malloc(JBM_CLDFB_SLOTS_IN_SUBFRAME * sizeof(Word16))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); @@ -375,17 +369,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( { computeAlphaSynthesis_fx(temp_alpha_synthesis_fx, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX_Q15, &dirac_output_synthesis_params->numAlphas, hSpatParamRendCom->slot_size, hSpatParamRendCom->num_freq_bands, hDirACRend->frequency_axis_fx, output_Fs); - for (int k = 0; k < hSpatParamRendCom->num_freq_bands; k++) { - temp_alpha_synthesis[k] = fix16_to_float(temp_alpha_synthesis_fx[k], 15); - } - - /*TODO : remove float code*/ - if ( ( dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); - } - mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis, dirac_output_synthesis_params->numAlphas ); - IF((dirac_output_synthesis_params->alpha_synthesis_fx = (Word16 *)malloc(dirac_output_synthesis_params->numAlphas * sizeof(Word16))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); @@ -393,9 +376,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( Copy(temp_alpha_synthesis_fx, dirac_output_synthesis_params->alpha_synthesis_fx, dirac_output_synthesis_params->numAlphas); computeAlphaSynthesis_fx( temp_alpha_synthesis_fx, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST_Q15, &dirac_output_synthesis_params->numAlphasFast, hSpatParamRendCom->slot_size, hSpatParamRendCom->num_freq_bands , hDirACRend->frequency_axis_fx, output_Fs); - for (int k = 0; k < hSpatParamRendCom->num_freq_bands; k++) { - temp_alpha_synthesis[k] = fix16_to_float(temp_alpha_synthesis_fx[k], 15); - } IF ((dirac_output_synthesis_params->alpha_synthesis_fast_fx = (Word16 *)malloc(dirac_output_synthesis_params->numAlphasFast * sizeof(Word16))) == NULL) { @@ -416,13 +396,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } set32_fx( dirac_output_synthesis_state->direction_smoothness_prev_fx, 0, hSpatParamRendCom->num_freq_bands ); - /*TODO : remove float code*/ - if ((dirac_output_synthesis_params->alpha_synthesis_fast = (float *)malloc(dirac_output_synthesis_params->numAlphasFast * sizeof(float))) == NULL) - { - return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); - } - mvr2r(temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis_fast, dirac_output_synthesis_params->numAlphasFast); - if ((dirac_output_synthesis_state->reference_power_smooth_prev = (float *)malloc(hSpatParamRendCom->num_freq_bands * sizeof(float))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n")); @@ -436,8 +409,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } ELSE { - dirac_output_synthesis_params->alpha_synthesis = NULL; - dirac_output_synthesis_params->alpha_synthesis_fast = NULL; dirac_output_synthesis_state->reference_power_smooth_prev = NULL; dirac_output_synthesis_state->direction_smoothness_prev = NULL; #ifdef IVAS_FLOAT_FIXED @@ -449,13 +420,9 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } /* compute interpolator */ - FOR (idx = 1; idx <= JBM_CLDFB_SLOTS_IN_SUBFRAME; ++idx) + FOR( idx = 1; idx <= JBM_CLDFB_SLOTS_IN_SUBFRAME; ++idx ) { - dirac_output_synthesis_params->interpolator[idx - 1] = (float)idx / (float)JBM_CLDFB_SLOTS_IN_SUBFRAME; - Word16 tmp_exp = 0; - dirac_output_synthesis_params->interpolator_fx[idx - 1] = BASOP_Util_Divide1616_Scale(idx , JBM_CLDFB_SLOTS_IN_SUBFRAME, &tmp_exp); - /*TODO : Remove float code*/ - dirac_output_synthesis_params->interpolator[idx - 1] = me2f_16(dirac_output_synthesis_params->interpolator_fx[idx - 1] , tmp_exp); + dirac_output_synthesis_params->interpolator_fx[idx - 1] = div_s( idx, JBM_CLDFB_SLOTS_IN_SUBFRAME ); } /* prepare diffuse response function */ @@ -517,27 +484,19 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( Word16 exp_1 = 0, exp_2 = 0, tmp; tmp = BASOP_Util_Divide3232_Scale( diff_nrg_total_fx, diff_nrg_trans_fx, &exp_1 ); // (Q15 - exp_diff) dirac_output_synthesis_params->diffuse_compensation_factor_fx = L_shl( L_deposit_l( tmp ), add( Q12, exp_1 ) ); // Q27 - /*TODO : remove float code*/ - dirac_output_synthesis_params->diffuse_compensation_factor = fixedToFloat( dirac_output_synthesis_params->diffuse_compensation_factor_fx, Q27 ); tmp = BASOP_Util_Divide3232_Scale( diff_nrg_total_fx, diff_nrg_decorr_fx, &exp_2 ); // (Q15 - exp_diff) dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx = L_shl( L_deposit_l( tmp ), add( Q14, exp_2 ) ); // Q29 - /*TODO : remove float code*/ - dirac_output_synthesis_params->diffuse_compensation_factor_decorr = fixedToFloat( dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, Q29 ); } ELSE { dirac_output_synthesis_params->diffuse_compensation_factor_fx = 0; dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx = 0; - /*TODO : remove float code*/ - dirac_output_synthesis_params->diffuse_compensation_factor = 0.f; - dirac_output_synthesis_params->diffuse_compensation_factor_decorr = 0.f; } return IVAS_ERR_OK; } #else - ivas_error ivas_dirac_dec_output_synthesis_open( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ @@ -799,6 +758,8 @@ ivas_error ivas_dirac_dec_output_synthesis_open( return IVAS_ERR_OK; } #endif + + /*------------------------------------------------------------------------- * ivas_dirac_dec_output_synthesis_init() * @@ -1012,6 +973,7 @@ void ivas_dirac_dec_output_synthesis_init_fx( * Memory deallocation of Output synthesis sub-module *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_output_synthesis_close( DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ ) @@ -1105,8 +1067,7 @@ void ivas_dirac_dec_output_synthesis_close( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_dirac_dec_output_synthesis_close_fx( DIRAC_REND_HANDLE hDirACRend /* i/o: DirAC handle */ ) @@ -1119,25 +1080,6 @@ void ivas_dirac_dec_output_synthesis_close_fx( * memory deallocation *-----------------------------------------------------------------*/ - /* free interpolator */ - if ((dirac_output_synthesis_params)->interpolator != NULL) - { - free((dirac_output_synthesis_params)->interpolator); - (dirac_output_synthesis_params)->interpolator = NULL; - } - - /* free alpha */ - if ((dirac_output_synthesis_params)->alpha_synthesis != NULL) - { - free((dirac_output_synthesis_params)->alpha_synthesis); - (dirac_output_synthesis_params)->alpha_synthesis = NULL; - } - if ((dirac_output_synthesis_params)->alpha_synthesis_fast != NULL) - { - free((dirac_output_synthesis_params)->alpha_synthesis_fast); - (dirac_output_synthesis_params)->alpha_synthesis_fast = NULL; - } - if ((dirac_output_synthesis_state)->reference_power_smooth_prev != NULL) { free((dirac_output_synthesis_state)->reference_power_smooth_prev); @@ -1281,6 +1223,8 @@ void ivas_dirac_dec_output_synthesis_close_fx( return; } #endif + + /*------------------------------------------------------------------------- * ivas_dirac_dec_output_synthesis_process_slot() * diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 22d904986..3210d47e7 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -53,6 +53,7 @@ * Allocate and initialize DirAC parameters *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_allocate_parameters( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ const int16_t params_flag /* i : set of parameters flag */ @@ -183,8 +184,7 @@ ivas_error ivas_dirac_allocate_parameters( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_dirac_allocate_parameters_fx( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ const Word16 params_flag /* i : set of parameters flag */ @@ -214,15 +214,6 @@ ivas_error ivas_dirac_allocate_parameters_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->spreadCoherence = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - IF ( ( hSpatParamRendCom->surroundingCoherence = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } #ifdef IVAS_FLOAT_FIXED IF ( ( hSpatParamRendCom->diffuseness_vector_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) { @@ -269,17 +260,6 @@ ivas_error ivas_dirac_allocate_parameters_fx( } set_f( hSpatParamRendCom->energy_ratio1[i], 0.0f, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->spreadCoherence[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hSpatParamRendCom->spreadCoherence[i], 0.0f, hSpatParamRendCom->num_freq_bands ); - - IF ( ( hSpatParamRendCom->surroundingCoherence[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hSpatParamRendCom->surroundingCoherence[i], 0.0f, hSpatParamRendCom->num_freq_bands ); #ifdef IVAS_FLOAT_FIXED IF ( ( hSpatParamRendCom->diffuseness_vector_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { @@ -324,10 +304,6 @@ ivas_error ivas_dirac_allocate_parameters_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->spreadCoherence2 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } #ifdef IVAS_FLOAT_FIXED IF ( ( hSpatParamRendCom->energy_ratio2_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) { @@ -360,11 +336,6 @@ ivas_error ivas_dirac_allocate_parameters_fx( } set_f( hSpatParamRendCom->energy_ratio2[i], 0.0f, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->spreadCoherence2[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hSpatParamRendCom->spreadCoherence2[i], 0.0f, hSpatParamRendCom->num_freq_bands ); #ifdef IVAS_FLOAT_FIXED IF ( ( hSpatParamRendCom->energy_ratio2_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { @@ -385,11 +356,14 @@ ivas_error ivas_dirac_allocate_parameters_fx( } #endif + + /*------------------------------------------------------------------------- * ivas_spat_hSpatParamRendCom_config() * * *-------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED ivas_error ivas_spat_hSpatParamRendCom_config_fx( SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: IVAS decoder structure */ @@ -535,7 +509,6 @@ ivas_error ivas_spat_hSpatParamRendCom_config_fx( hSpatParamRendCom->spreadCoherence2_fx = NULL; /*TODO: to remove float*/ hSpatParamRendCom->energy_ratio2 = NULL; - hSpatParamRendCom->spreadCoherence2 = NULL; } } @@ -684,6 +657,7 @@ ivas_error ivas_spat_hSpatParamRendCom_config( * *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_spat_hSpatParamRendCom_close( SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out ) { @@ -699,11 +673,11 @@ void ivas_spat_hSpatParamRendCom_close( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_spat_hSpatParamRendCom_close_fx( SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out) { + test(); IF (hSpatParamRendCom_out == NULL || *hSpatParamRendCom_out == NULL) { return; @@ -723,6 +697,7 @@ void ivas_spat_hSpatParamRendCom_close_fx( * * *-------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED void ivas_dirac_rend_close_fx( DIRAC_REND_HANDLE *hDirACRend_out) @@ -752,13 +727,8 @@ void ivas_dirac_rend_close_fx( /* Params */ - /* free frequency axis buffer */ - IF (hDirACRend->frequency_axis != NULL) - { - free(hDirACRend->frequency_axis); - hDirACRend->frequency_axis = NULL; - } #ifdef IVAS_FLOAT_FIXED + /* free frequency axis buffer */ IF(hDirACRend->frequency_axis_fx != NULL) { free(hDirACRend->frequency_axis_fx); @@ -775,17 +745,6 @@ void ivas_dirac_rend_close_fx( hDirACRend->hoa_encoder_fx = NULL; } #endif - IF (hDirACRend->diffuse_response_function != NULL) - { - free(hDirACRend->diffuse_response_function); - hDirACRend->diffuse_response_function = NULL; - } - - IF (hDirACRend->hoa_encoder != NULL) - { - free(hDirACRend->hoa_encoder); - hDirACRend->hoa_encoder = NULL; - } #ifdef IVAS_FLOAT_FIXED IF (hDirACRend->hoa_encoder_fx != NULL) { @@ -966,6 +925,8 @@ void ivas_dirac_rend_close( return; } #endif + + /*------------------------------------------------------------------------- * ivas_dirac_deallocate_parameters() * @@ -1078,20 +1039,6 @@ void ivas_dirac_deallocate_parameters_fx( hSpatParamRendCom->diffuseness_vector_fx = NULL; } - if (hSpatParamRendCom->spreadCoherence != NULL) - { - for (i = 0; i < md_buffer_length; i++) - { - if (hSpatParamRendCom->spreadCoherence[i] != NULL) - { - free(hSpatParamRendCom->spreadCoherence[i]); - hSpatParamRendCom->spreadCoherence[i] = NULL; - } - } - free(hSpatParamRendCom->spreadCoherence); - hSpatParamRendCom->spreadCoherence = NULL; - } - if (hSpatParamRendCom->spreadCoherence_fx != NULL) { for (i = 0; i < md_buffer_length; i++) @@ -1106,20 +1053,6 @@ void ivas_dirac_deallocate_parameters_fx( hSpatParamRendCom->spreadCoherence_fx = NULL; } - if (hSpatParamRendCom->surroundingCoherence != NULL) - { - for (i = 0; i < md_buffer_length; i++) - { - if (hSpatParamRendCom->surroundingCoherence[i] != NULL) - { - free(hSpatParamRendCom->surroundingCoherence[i]); - hSpatParamRendCom->surroundingCoherence[i] = NULL; - } - } - free(hSpatParamRendCom->surroundingCoherence); - hSpatParamRendCom->surroundingCoherence = NULL; - } - if (hSpatParamRendCom->surroundingCoherence_fx != NULL) { for (i = 0; i < md_buffer_length; i++) @@ -1192,20 +1125,6 @@ void ivas_dirac_deallocate_parameters_fx( hSpatParamRendCom->energy_ratio2_fx = NULL; } - if (hSpatParamRendCom->spreadCoherence2 != NULL) - { - for (i = 0; i < md_buffer_length; i++) - { - if (hSpatParamRendCom->spreadCoherence2[i] != NULL) - { - free(hSpatParamRendCom->spreadCoherence2[i]); - hSpatParamRendCom->spreadCoherence2[i] = NULL; - } - } - free(hSpatParamRendCom->spreadCoherence2); - hSpatParamRendCom->spreadCoherence2 = NULL; - } - if (hSpatParamRendCom->spreadCoherence2_fx != NULL) { for (i = 0; i < md_buffer_length; i++) @@ -1223,8 +1142,7 @@ void ivas_dirac_deallocate_parameters_fx( return; } -#endif - +#else void ivas_dirac_deallocate_parameters( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ const int16_t params_flag /* i : set of parameters flag */ @@ -1390,6 +1308,7 @@ void ivas_dirac_deallocate_parameters( return; } +#endif /*------------------------------------------------------------------------- diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 9f461a590..a37504cb9 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -269,8 +269,6 @@ ivas_error ivas_td_binaural_open_unwrap_fx( IF( NE_16( ivas_format, MASA_ISM_FORMAT ) && NE_16( ivas_format, SBA_ISM_FORMAT ) ) { - // To be removed later - ( *hBinRendererTd )->HrFiltSet_p->latency_s_fx = floatToFixed( ( *hBinRendererTd )->HrFiltSet_p->latency_s, 31 ); *binaural_latency_ns = Mult_32_32( ( *hBinRendererTd )->HrFiltSet_p->latency_s_fx, 1000000000 ); } @@ -501,6 +499,7 @@ ivas_error ivas_td_binaural_open_unwrap( * * Close TD Object binaural renderer *---------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED void ivas_td_binaural_close_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd /* i/o: TD binaural object renderer handle */ @@ -510,15 +509,18 @@ void ivas_td_binaural_close_fx( { return; } + free( ( *hBinRendererTd )->TdRend_MixSpatSpec_p ); free( ( *hBinRendererTd )->DirAtten_p ); + TDREND_MIX_Dealloc_fx( *hBinRendererTd ); + free( *hBinRendererTd ); *hBinRendererTd = NULL; + return; } -#endif // IVAS_FLOAT_FIXED - +#else void ivas_td_binaural_close( BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd /* i/o: TD binaural object renderer handle */ ) @@ -538,6 +540,7 @@ void ivas_td_binaural_close( return; } +#endif /*---------------------------------------------------------------------* diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 95a36a8db..76c146dd2 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -198,6 +198,7 @@ void TDREND_MIX_Dealloc_fx( ) { Word16 i; + /* Deallocate source list */ FOR ( i = 0; i < hBinRendererTd->NumOfSrcs; i++ ) { @@ -221,28 +222,6 @@ void TDREND_MIX_Dealloc_fx( } ELSE { -#if 1 - IF( hBinRendererTd->HrFiltSet_p->Elev_p != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->Elev_p ); - hBinRendererTd->HrFiltSet_p->Elev_p = NULL; - } - IF( hBinRendererTd->HrFiltSet_p->Azim_p != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->Azim_p ); - hBinRendererTd->HrFiltSet_p->Azim_p = NULL; - } - IF( hBinRendererTd->HrFiltSet_p->LeftFiltSet_p != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->LeftFiltSet_p ); - hBinRendererTd->HrFiltSet_p->LeftFiltSet_p = NULL; - } - IF( hBinRendererTd->HrFiltSet_p->RightFiltSet_p != NULL ) - { - free( hBinRendererTd->HrFiltSet_p->RightFiltSet_p ); - hBinRendererTd->HrFiltSet_p->RightFiltSet_p = NULL; - } -#endif // 1 IF ( hBinRendererTd->HrFiltSet_p->Elev_p_fx != NULL ) { free( hBinRendererTd->HrFiltSet_p->Elev_p_fx); @@ -267,9 +246,10 @@ void TDREND_MIX_Dealloc_fx( free( hBinRendererTd->HrFiltSet_p ); hBinRendererTd->HrFiltSet_p = NULL; } + return; } -#endif // IVAS_FLOAT_FIXED +#else void TDREND_MIX_Dealloc( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd /* i/o: TD renderer handle */ ) @@ -324,6 +304,7 @@ void TDREND_MIX_Dealloc( return; } +#endif /*-------------------------------------------------------------------* @@ -1025,10 +1006,9 @@ static ivas_error DefaultBSplineModel_fx( move16(); modelITD->azimBsShape_fx = defaultHRIR_rom_ITD_azimBsShape_fx; modelITD->elevBsShape_fx = defaultHRIR_rom_ITD_elevBsShape_fx; + HRTF_model_precalc( model ); -#if 1/*To be removed later : floating point initialization*/ - HrFiltSet_p->latency_s = defaultHRIR_rom_latency_s; -#endif + HrFiltSet_p->latency_s_fx = defaultHRIR_rom_latency_s_fx; move32(); HrFiltSet_p->SampleRate = output_Fs; diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.c b/lib_rend/ivas_rom_TdBinauralRenderer.c index 95d0e4514..2bd48fa60 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.c +++ b/lib_rend/ivas_rom_TdBinauralRenderer.c @@ -45,7 +45,7 @@ *------------------------------------------------------------------------*/ /* TD renderer default HRIR model */ const float defaultHRIR_rom_latency_s = 0.000020834f; -const Word32 defaultHRIR_rom_latency_s_fx = 44741;/*Q-31*/ +const Word32 defaultHRIR_rom_latency_s_fx = 44741; /* Q31 */ const int16_t defaultHRIR_rom_azimDim2[15] = { 1, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 1, }; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index bc48b7d3f..4bae85cf6 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -139,11 +139,12 @@ typedef struct dirac_onset_detection_params_structure typedef struct dirac_onset_detection_state_structure { +#ifndef IVAS_FLOAT_FIXED float *onset_detector_1; float *onset_detector_2; -#ifdef IVAS_FLOAT_FIXED - Word32 *onset_detector_1_fx; - Word32 *onset_detector_2_fx; +#else + Word32 *onset_detector_1_fx; /* Q(q_onset_detector) */ + Word32 *onset_detector_2_fx; /* Q(q_onset_detector) */ Word16 q_onset_detector; #endif @@ -157,17 +158,16 @@ typedef struct dirac_decorr_params_structure int16_t *pre_delay; int16_t *filter_length; +#ifndef IVAS_FLOAT_FIXED float *filter_coeff_num_real; float *filter_coeff_den_real; - float *phase_coeff_real; float *phase_coeff_imag; -#ifdef IVAS_FLOAT_FIXED - Word16 *filter_coeff_num_real_fx; - Word16 *filter_coeff_den_real_fx; - - Word16 *phase_coeff_real_fx; - Word16 *phase_coeff_imag_fx; +#else + Word16 *filter_coeff_num_real_fx; /* Q12 */ + Word16 *filter_coeff_den_real_fx; /* Q12 */ + Word16 *phase_coeff_real_fx; /* Q14 */ + Word16 *phase_coeff_imag_fx; /* Q14 */ #endif int16_t *split_frequency_bands; int16_t num_split_frequency_bands; @@ -228,13 +228,14 @@ typedef struct ivas_spatial_parametric_rend_common_data_structure Word32 **energy_ratio2_fx; #endif +#ifndef IVAS_FLOAT_FIXED float **spreadCoherence; float **spreadCoherence2; float **surroundingCoherence; -#ifdef IVAS_FLOAT_FIXED - Word16 **spreadCoherence_fx; - Word16 **spreadCoherence2_fx; - Word16 **surroundingCoherence_fx; +#else + Word16 **spreadCoherence_fx; /* Q15 */ + Word16 **spreadCoherence2_fx; /* Q15 */ + Word16 **surroundingCoherence_fx; /* Q15 */ #endif /* Metadata access indices and buffer size */ @@ -327,27 +328,31 @@ typedef struct dirac_output_synthesis_params_structure int16_t use_onset_filters; +#ifndef IVAS_FLOAT_FIXED float *interpolator; float *alpha_synthesis; float *alpha_synthesis_fast; -#ifdef IVAS_FLOAT_FIXED - Word16 *interpolator_fx; // Q15 - Word16 *alpha_synthesis_fx; - Word16 *alpha_synthesis_fast_fx; +#else + Word16 *interpolator_fx; /* Q15 */ + Word16 *alpha_synthesis_fx; /* Q15 */ + Word16 *alpha_synthesis_fast_fx; /* Q15 */ #endif int16_t numAlphas; int16_t numAlphasFast; float *proto_matrix; - - float diffuse_compensation_factor; - float diffuse_compensation_factor_decorr; #ifdef IVAS_FLOAT_FIXED Word32 *proto_matrix_fx; Word16 proto_matrix_e; Word16 proto_matrix_len; - Word32 diffuse_compensation_factor_fx; // Q27 - Word32 diffuse_compensation_factor_decorr_fx; // Q29 +#endif + +#ifndef IVAS_FLOAT_FIXED + float diffuse_compensation_factor; + float diffuse_compensation_factor_decorr; +#else + Word32 diffuse_compensation_factor_fx; /* Q27 */ + Word32 diffuse_compensation_factor_decorr_fx; /* Q29 */ #endif } DIRAC_OUTPUT_SYNTHESIS_PARAMS; @@ -632,27 +637,24 @@ typedef struct ivas_dirac_rend_data_structure int16_t index_buffer_intensity; float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; float *buffer_energy; - - float *frequency_axis; - float *diffuse_response_function; #ifdef IVAS_FLOAT_FIXED Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; Word16 q_buffer_intensity_real[CLDFB_NO_CHANNELS_MAX]; Word32 *buffer_energy_fx; Word16 q_buffer_energy[CLDFB_NO_CHANNELS_MAX]; - Word16 *diffuse_response_function_fx; - Word16 diffuse_response_function_q; // Q15 - Word16 *frequency_axis_fx; - Word32 *hoa_encoder_fx; // Q29 - Word16 hoa_encoder_len; #endif - float *hoa_encoder; + #ifndef IVAS_FLOAT_FIXED + float *frequency_axis; + float *diffuse_response_function; + float *hoa_encoder; const float *hoa_decoder; #else - const Word32 *hoa_decoder; + Word16 *frequency_axis_fx; /* Q0 */ + Word16 *diffuse_response_function_fx; /* Q15 */ + Word32 *hoa_encoder_fx; /* Q29 */ + const Word32 *hoa_decoder; /* Q29 */ #endif - /*Decoder parameters */ /*Prototypes*/ int16_t num_outputs_dir; @@ -912,9 +914,10 @@ typedef struct ivas_dirac_dec_binaural_data_structure #endif uint16_t useTdDecorr; ivas_td_decorr_state_t *hTdDecorr; +#ifndef IVAS_FLOAT_FIXED float reqularizationFactor; -#ifdef IVAS_FLOAT_FIXED - Word16 reqularizationFactor_fx; +#else + Word16 reqularizationFactor_fx; /* Q14 */ #endif DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; @@ -1063,17 +1066,18 @@ typedef struct ivas_orient_trk_state_t float centerAdaptationRate; float offCenterAdaptationRate; float adaptationAngle; - float alpha; -#endif - -#ifdef IVAS_FLOAT_FIXED +#else Word32 centerAdaptationRate_fx; /* Q31 */ Word32 offCenterAdaptationRate_fx; /* Q31 */ Word32 adaptationAngle_fx; /* Q29 */ #endif - Word32 alpha_fx; +#ifndef IVAS_FLOAT_FIXED + float alpha; +#else + Word32 alpha_fx; /* Q(Q_alpha) */ Word16 Q_alpha; +#endif IVAS_QUATERNION absAvgRot; /* average absolute orientation */ IVAS_QUATERNION refRot; /* reference orientation */ IVAS_QUATERNION trkRot; /* tracked rotation */ @@ -1727,30 +1731,40 @@ typedef struct TDREND_HRFILT_FiltSet_struct int32_t SampleRate; /* Sample rate of the HR filter */ int16_t NumPos; int16_t NumElev; +#ifndef IVAS_FLOAT_FIXED float Dist; float *ItdSet_p; +#else + Word32 Dist_fx; + Word32 *ItdSet_p_fx; +#endif int16_t FiltLength; +#ifndef IVAS_FLOAT_FIXED float *Azim_p; float *Elev_p; float *ItdSetNominal_p; float *LeftFiltSet_p; float *RightFiltSet_p; +#else + Word16 *Azim_p_fx; + Word16 *Elev_p_fx; + Word16 *ItdSetNominal_p_fx; + Word16 *LeftFiltSet_p_fx; + Word16 *RightFiltSet_p_fx; +#endif ModelParams_t ModelParams; ModelEval_t ModelEval; ModelParamsITD_t ModelParamsITD; TDREND_HRFILT_Method_t FilterMethod; /* HR filtering method */ +#ifndef IVAS_FLOAT_FIXED float latency_s; const float *lr_energy_and_iac[3]; /* left/right energy and interaural coherence for late reverb */ -#ifdef IVAS_FLOAT_FIXED - Word16 *Azim_p_fx; - Word16 *Elev_p_fx; - Word16 *LeftFiltSet_p_fx; - Word16 *RightFiltSet_p_fx; - Word32 *lr_energy_and_iac_dyn_fx[3]; + float *lr_energy_and_iac_dyn[3]; +#else + Word32 latency_s_fx; /* Q31 */ const Word32 *lr_energy_and_iac_fx[3]; /* left/right energy and interaural coherence for late reverb */ - Word32 latency_s_fx;/*Q-31*/ + Word32 *lr_energy_and_iac_dyn_fx[3]; #endif // IVAS_FLOAT_FIXED - float *lr_energy_and_iac_dyn[3]; } TDREND_HRFILT_FiltSet_t; @@ -1766,7 +1780,7 @@ typedef struct Word32 RefDist_fx; /* Q30 */ Word32 MaxDist_fx; /* Q27 */ Word32 RollOffFactor_fx; /* Q30 */ -#endif // IVAS_FLOAT_FIXED +#endif // IVAS_FLOAT_FIXED- } TDREND_DistAtten_t; @@ -2026,9 +2040,10 @@ typedef struct ivas_hrtfs_fastconv_struct #ifdef IVAS_FLOAT_FIXED Word32 FASTCONV_HOA3_latency_s_fx; Word32 FASTCONV_HRIR_latency_s_fx; -#endif +#else float FASTCONV_HOA3_latency_s; float FASTCONV_HRIR_latency_s; +#endif #ifdef IVAS_FLOAT_FIXED Word32 ***leftHRIRReal_HOA3_fx; @@ -2333,9 +2348,6 @@ typedef struct ivas_mcmasa_ana_data_structure Word32 prevDownmixEne_fx; Word32 prevEQ_fx; Word16 interpolator_fx[L_FRAME48k]; - Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word16 energy_exp[MAX_PARAM_SPATIAL_SUBFRAMES]; Word16 chnlToFoaMtx_e; Word16 prevMultiChEne_e; Word16 prevDownmixEne_e; @@ -2371,7 +2383,13 @@ typedef struct ivas_mcmasa_ana_data_structure MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; +#ifndef IVAS_FLOAT_FIXED float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#else + Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word16 energy_exp[MAX_PARAM_SPATIAL_SUBFRAMES]; +#endif } MCMASA_ANA_DATA, *MCMASA_ANA_HANDLE; @@ -2476,8 +2494,9 @@ typedef struct ivas_dirac_ana_data_structure MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; +#ifndef IVAS_FLOAT_FIXED float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#ifdef IVAS_FLOAT_FIXED +#else Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 energy_exp[MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -2523,8 +2542,9 @@ typedef struct ivas_masa_prerend_data_structure MASA_DECODER_EXT_OUT_META_HANDLE hMasaOut; SPHERICAL_GRID_DATA *sph_grid16; +#ifndef IVAS_FLOAT_FIXED float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#ifdef IVAS_FLOAT_FIXED +#else Word32 energy_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 energy_e[MAX_PARAM_SPATIAL_SUBFRAMES]; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index eabff932b..92088eed9 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5117,16 +5117,6 @@ static ivas_error setRendInputActiveMasa( #if 1 /*TODO: To be removed later(fixed to float)*/ IF( inputMasa->hMasaExtRend ) { - DIRAC_REND_HANDLE hDirACRend = inputMasa->hMasaExtRend->hDirACRend; - IF( hDirACRend ) - { - FOR( int i = 0; i < hDirACRend->num_outputs_dir; i++ ) - { - hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], Q15 ); - } - IF( hDirACRend->hoa_encoder_fx ) - fixedToFloat_arrL( hDirACRend->hoa_encoder_fx, hDirACRend->hoa_encoder, Q29, hDirACRend->hoa_encoder_len ); - } IF( inputMasa->hMasaExtRend->hDiracDecBin ) fixedToFloat_arrL( inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection_fx, inputMasa->hMasaExtRend->hDiracDecBin->earlyPartEneCorrection, (Word16) Q28 /*1.0f Q28*/, (Word16) CLDFB_NO_CHANNELS_MAX ); } @@ -11714,8 +11704,6 @@ static void copyMasaMetadataToDiracRenderer_fx( hSpatParamRendCom->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; hSpatParamRendCom->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; - hSpatParamRendCom->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; - hSpatParamRendCom->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; #endif @@ -11735,7 +11723,6 @@ static void copyMasaMetadataToDiracRenderer_fx( hSpatParamRendCom->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; hSpatParamRendCom->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; - hSpatParamRendCom->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; #endif } @@ -13078,14 +13065,6 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->panningConf = DIRAC_PANNING_HOA3; } -#if 1 /*TODO: To be removed later(floating buffer malloc and init)*/ - IF( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); - -#endif IF( ( hDirACRend->frequency_axis_fx = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); @@ -13243,12 +13222,6 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#if 1 /*TODO: To be removed later (Float buffer malloc)*/ - if ( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } -#endif IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) || EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { @@ -13261,9 +13234,6 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, MASA_FORMAT, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); } -#if 1 /*TODO: To be removed later(after dependecny on float buffer hoa_encoder is removed)*/ - hDirACRend->hoa_encoder = NULL; -#endif hDirACRend->hoa_encoder_fx = NULL; IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) { @@ -13273,15 +13243,6 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( } set32_fx( hDirACRend->hoa_encoder_fx, 0, nchan_out_woLFE * hDirACRend->num_outputs_diff ); - hDirACRend->hoa_encoder_len = imult1616( nchan_out_woLFE, hDirACRend->num_outputs_diff ); -#if 1 /*TODO: To be removed later(float buffer malloc and init)*/ - if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - - set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); -#endif compute_hoa_encoder_mtx_fx( ls_azimuth_fx, ls_elevation_fx, hDirACRend->hoa_encoder_fx, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); } @@ -14450,7 +14411,11 @@ static void freeMasaExtRenderer( if ( hMasaExtRend->hSpatParamRendCom != NULL ) { +#ifdef IVAS_FLOAT_FIXED + ivas_spat_hSpatParamRendCom_close_fx( &hMasaExtRend->hSpatParamRendCom ); +#else ivas_spat_hSpatParamRendCom_close( &hMasaExtRend->hSpatParamRendCom ); +#endif // IVAS_FLOAT_FIXED } if ( hMasaExtRend->hDiracDecBin != NULL ) @@ -14558,7 +14523,6 @@ static void intermidiate_ext_dirac_render( for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[slot_idx]][i] = floatToFixed( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[slot_idx]][i], Q30 ); - floatToFixed_arr(hSpatParamRendCom->surroundingCoherence[slot_idx], hSpatParamRendCom->surroundingCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); } } for(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++){ @@ -14566,15 +14530,11 @@ static void intermidiate_ext_dirac_render( { IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) { - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } @@ -14592,9 +14552,6 @@ static void intermidiate_ext_dirac_render( { hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } @@ -14602,9 +14559,6 @@ static void intermidiate_ext_dirac_render( { hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } @@ -14614,9 +14568,6 @@ static void intermidiate_ext_dirac_render( { hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence[slot_idx], hSpatParamRendCom->spreadCoherence_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr(hSpatParamRendCom->spreadCoherence2[slot_idx], hSpatParamRendCom->spreadCoherence2_fx[slot_idx], Q15, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } @@ -14656,8 +14607,6 @@ static void intermidiate_ext_dirac_render( floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_len ); } - hDirACRend->h_output_synthesis_psd_params.diffuse_compensation_factor_fx = floatToFixed( hDirACRend->h_output_synthesis_psd_params.diffuse_compensation_factor, Q27 ); // Q27 - hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = Q26; hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_len ); @@ -14720,7 +14669,6 @@ static void intermidiate_ext_dirac_render( } } } - floatToFixed_arrL32( hDirACRend->hoa_encoder, hDirACRend->hoa_encoder_fx, Q29, hDirACRend->hoa_encoder_len ); if(DirAC_mem.frame_dec_f) { //f2me_buf(DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_fx, &hDirACRend->proto_frame_dec_f_q, DirAC_mem.frame_dec_f_len); @@ -14771,7 +14719,6 @@ static void intermidiate_ext_dirac_render( } } - fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); fixedToFloat_arrL(hDirACRend->stack_mem.onset_filter_fx, hDirACRend->stack_mem.onset_filter, Q30, hDirACRend->stack_mem.onset_filter_len ); if(DirAC_mem.reference_power) { diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index a6267035c..8575ffd29 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -362,9 +362,16 @@ static ivas_error LoadBSplineBinary( ModelParams_t *model; int16_t i, tmp; - fread( &HrFiltSet_p->latency_s, sizeof( float ), 1, f_hrtf ); #ifdef IVAS_FLOAT_FIXED - HrFiltSet_p->latency_s_fx = float_to_fix( HrFiltSet_p->latency_s, Q31 ); + float f_tmp_latency_s; + float f_tmp_lr_energy_and_iac_dyn[LR_IAC_LENGTH_NR_FC]; +#endif + +#ifndef IVAS_FLOAT_FIXED + fread( &HrFiltSet_p->latency_s, sizeof( float ), 1, f_hrtf ); +#else + fread( &f_tmp_latency_s, sizeof( float ), 1, f_hrtf ); + HrFiltSet_p->latency_s_fx = float_to_fix( f_tmp_latency_s, Q31 ); #endif // IVAS_FLOAT_FIXED model = &( HrFiltSet_p->ModelParams ); @@ -568,15 +575,21 @@ static ivas_error LoadBSplineBinary( /* left/right energy and interaural coherence for late reverb */ for ( i = 0; i < 3; i++ ) { +#ifndef IVAS_FLOAT_FIXED HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) ); fread( HrFiltSet_p->lr_energy_and_iac_dyn[i], sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf ); HrFiltSet_p->lr_energy_and_iac[i] = (const float *) HrFiltSet_p->lr_energy_and_iac_dyn[i]; -#ifdef IVAS_FLOAT_FIXED +#else + fread( f_tmp_lr_energy_and_iac_dyn, sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf ); HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); IF( i == 2 ) - floatToFixed_arr32( HrFiltSet_p->lr_energy_and_iac_dyn[i], HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q27, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + { + floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q27, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + } ELSE - floatToFixed_arr32( HrFiltSet_p->lr_energy_and_iac_dyn[i], HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q23, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + { + floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q23, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + } HrFiltSet_p->lr_energy_and_iac_fx[i] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[i]; #endif // IVAS_FLOAT_FIXED } @@ -905,8 +918,9 @@ ivas_error dealloc_HRTF_binary( for ( i = 0; i < 3; i++ ) { +#ifndef IVAS_FLOAT_FIXED free( hHrtf->lr_energy_and_iac_dyn[i] ); -#ifdef IVAS_FLOAT_FIXED +#else free( hHrtf->lr_energy_and_iac_dyn_fx[i] ); #endif // IVAS_FLOAT_FIXED } -- GitLab From 4d0f9bf3a4a4fb11de8a37cb67cb6ac08e69ec6f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 24 May 2024 11:09:29 +0200 Subject: [PATCH 075/101] add another hyphon in artifact name --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac6569dcd..4c8c637c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -217,7 +217,7 @@ stages: needs: ["build-codec-linux-make"] timeout: "240 minutes" variables: - MLD_ARTIFACT_NAME: "mld-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.csv" + MLD_ARTIFACT_NAME: "mld--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.csv" script: - *print-common-info - *update-scripts-repo -- GitLab From 3080f94e68e735948180dc821d38c47bd005a13e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 24 May 2024 11:13:24 +0200 Subject: [PATCH 076/101] add job id in artifact name --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c8c637c0..e69d3dd99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -217,7 +217,7 @@ stages: needs: ["build-codec-linux-make"] timeout: "240 minutes" variables: - MLD_ARTIFACT_NAME: "mld--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.csv" + MLD_ARTIFACT_NAME: "mld--$CI_JOB_NAME-$CI_JOB_ID--sha-$CI_COMMIT_SHORT_SHA.csv" script: - *print-common-info - *update-scripts-repo -- GitLab From 20a19e96b72675fb42be9bddb272c47484330677 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 24 May 2024 18:14:43 +0200 Subject: [PATCH 077/101] get id of last occurence in ltv job --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 01ea43106..cb8069abd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -240,6 +240,8 @@ stages: - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv + - if $UPDATE_PAGES; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID: $CI_JOB_ID"; fi + - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi - exit 0 -- GitLab From ac0db3911572683bd3d96f71197727c766324a2e Mon Sep 17 00:00:00 2001 From: kiene Date: Fri, 24 May 2024 16:17:01 +0000 Subject: [PATCH 078/101] Fix CI file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cb8069abd..1a6a36ec0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -240,7 +240,7 @@ stages: - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv - - if $UPDATE_PAGES; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID: $CI_JOB_ID"; fi + - if [ $UPDATE_PAGES != "" ]; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi -- GitLab From efe6fabe03d2ca595dbfab0cff883e1f4542e88c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 24 May 2024 18:20:00 +0200 Subject: [PATCH 079/101] stop test after first failure for faster checking --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a6a36ec0..a563a404b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -235,7 +235,7 @@ stages: ### run pytest - exit_code=0 - - python3 -m pytest $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? + - python3 -m pytest $TEST_SUITE -v -x --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv -- GitLab From e71f59b178f71ce65b3a81fe0e1671707c44023f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 24 May 2024 18:21:44 +0200 Subject: [PATCH 080/101] allow build jobs with UPDATE_PAGES --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a563a404b..d7f836b8c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -302,7 +302,7 @@ stages: # ensure that codec builds on linux build-codec-linux-make: rules: - - if: $CI_PIPELINE_SOURCE == 'web' && "UPDATE_PAGES" == "" + - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'schedule' @@ -318,7 +318,7 @@ build-codec-linux-make: # ensure that codec builds on linux with instrumentation active build-codec-linux-instrumented-make: rules: - - if: $CI_PIPELINE_SOURCE == 'web' && "UPDATE_PAGES" == "" + - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'schedule' -- GitLab From 52db5e8c68818ac159647bc3e7e1381b35977707 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 24 May 2024 13:52:18 -0400 Subject: [PATCH 081/101] Proposed fix to 770, fix discontinuities when going from TCX to ACELP --- lib_com/options.h | 1 + lib_dec/core_switching_dec.c | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8a960be74..7e8d91b52 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -135,6 +135,7 @@ #define FIX_736_BWE_SECT_C // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE #define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP #define FIX_747_TDBWE_ENERGY_BURST +#define FIX_770_DISCONTINUITIES_SW_TCX2ACELP // Fix discontinuities when switching from TCX to ACELP /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index a1c1db294..ffe9f5a69 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -85,6 +85,7 @@ ivas_error core_switching_pre_dec_ivas_fx( /* Codec mode switching */ IF( EQ_16( st->last_codec_mode, MODE2 ) || ( ( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) ) && GT_16( st->element_mode, EVS_MONO ) ) ) { +#ifndef FIX_770_DISCONTINUITIES_SW_TCX2ACELP Copy( st->mem_syn2_fx, st->mem_syn1_fx, M ); set16_fx( st->agc_mem_fx, 0, 2 ); st->mem_deemph_fx = st->syn[M]; @@ -97,7 +98,30 @@ ivas_error core_switching_pre_dec_ivas_fx( st->hBPF->pst_mem_deemp_err_fx = 0; move32(); } - st->psf_lp_noise_fx = round_fx(L_shl(st->lp_noise, 1)); +#else + st->mem_deemph_fx = st->syn[M]; + move16(); + set16_fx( st->agc_mem_fx, 0, 2 ); + Scale_sig( &( st->mem_deemph_fx ), 1, st->Q_syn ); /* Brings mem_deemph to Qsyn */ + + Copy_Scale_sig( st->mem_syn2_fx, st->mem_syn1_fx, M, sub( -1, st->Q_syn ) ); /*Q-1*/ + + st->bpf_off = 1; + move16(); + IF( st->hPFstat != NULL ) + { + Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, st->Q_syn ); /* Post_filter mem */ + Scale_sig( st->hPFstat->mem_res2, DECMEM_RES2, st->Q_syn ); /* NB post_filter mem */ + Scale_sig( st->hPFstat->mem_stp, L_SUBFR, st->Q_syn ); /* Post_filter mem */ + set16_fx( st->hBPF->pst_old_syn_fx, 0, NBPSF_PIT_MAX ); /* BPF mem*/ + } + IF( st->hBPF != NULL ) + { + st->hBPF->pst_lp_ener_fx = round_fx( L_shl( Mpy_32_16_1( st->lp_error_ener, 0x6054 ), 2 + 8 ) ); /* convert from 15Q16, log2 -> 7Q8 10*log10 */ + st->hBPF->pst_mem_deemp_err_fx = 0; + } +#endif + st->psf_lp_noise_fx = round_fx( L_shl( st->lp_noise, 1 ) ); move16(); /* reset old HB synthesis buffer */ -- GitLab From 210e424e4181784a9ff552c5626c19bf58629eb4 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 25 May 2024 15:42:09 +0530 Subject: [PATCH 082/101] Renderer functions integration, float buffers and structure elements cleanup [x] Binaural renderer unwrap conversion and integration [x] getDirectPartGains_fx integration [x] ivas_dirac_dec_render_sf_fx float buffers cleanup [x] lib rend.c float code cleanup --- apps/renderer.c | 15 +- lib_com/common_api_types.h | 6 + lib_com/ivas_cnst.h | 2 +- lib_com/ivas_prot.h | 14 + lib_com/ivas_stat_com.h | 16 +- lib_com/stat_com.h | 4 +- lib_dec/ivas_dirac_dec.c | 62 +-- lib_dec/ivas_init_dec.c | 41 +- lib_dec/ivas_ism_dec.c | 4 +- lib_dec/ivas_ism_param_dec.c | 208 ++++----- lib_dec/ivas_jbm_dec.c | 85 +--- lib_dec/ivas_masa_dec.c | 37 +- lib_dec/ivas_omasa_dec.c | 3 - lib_dec/ivas_sba_dec.c | 7 - lib_dec/ivas_spar_decoder.c | 31 -- lib_dec/ivas_spar_md_dec.c | 95 ++--- lib_dec/ivas_stat_dec.h | 30 +- lib_dec/ivas_stereo_cng_dec.c | 47 ++- lib_dec/lib_dec_fx.c | 34 -- lib_rend/ivas_dirac_dec_binaural_functions.c | 66 ++- lib_rend/ivas_dirac_rend.c | 149 ++----- lib_rend/ivas_objectRenderer.c | 362 +++++----------- lib_rend/ivas_objectRenderer_sources.c | 14 +- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/ivas_stat_rend.h | 21 +- lib_rend/lib_rend.c | 423 ++++++++++++------- lib_rend/lib_rend.h | 12 + 27 files changed, 731 insertions(+), 1059 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 82eb11067..df81d926b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -48,6 +48,10 @@ #include "vector3_pair_file_reader.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "prot_fx1.h" +#endif + #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* @@ -826,11 +830,20 @@ int main( } const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) ); - if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) +#ifdef IVAS_FLOAT_FIXED + Word32 nonDiegeticPanGain_fx = (args.nonDiegeticPanGain ==1.0f)? ONE_IN_Q31: (args.nonDiegeticPanGain == -1.0f)? L_negate(ONE_IN_Q31):(Word32)(args.nonDiegeticPanGain*(1LL<< Q31 )); + IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, nonDiegeticPanGain_fx, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } +#else + IF ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } +#endif // IVAS_FLOAT_FIXED /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 563c51d6d..6af1b0ee1 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -121,6 +121,11 @@ typedef struct _IVAS_ISM_METADATA #ifdef IVAS_FLOAT_FIXED Word32 azimuth_fx; Word32 elevation_fx; + Word16 radius_fx; + Word32 spread_fx; + Word32 gainFactor_fx; + Word32 yaw_fx; + Word32 pitch_fx; #endif float azimuth; float elevation; @@ -255,4 +260,5 @@ typedef struct _IVAS_RENDER_CONFIG #endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; + #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index c7b930a31..da5d5fcef 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -48,7 +48,7 @@ #define ONE_BY_PI_OVER_180_Q25 ( 1922527360 ) #define _180_OVER_PI ( 180.0f / EVS_PI ) #ifdef IVAS_FLOAT_FIXED -#define _180_OVER_PI_Q25 1922527233 +#define _180_OVER_PI_Q25 1922521886 #define _180_IN_Q22 (754974720) #define _360_IN_Q22 (1509949440) #define _180_OVER_PI_FX (Word32) (( 180.0f / EVS_PI ) *ONE_IN_Q10) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 41fa20009..11d2199a1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1280,15 +1280,29 @@ ivas_error ivas_ism_dec_config( ); #endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_param_ism_dec_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#else ivas_error ivas_param_ism_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#endif +#ifdef IVAS_FLOAT_FIXED +void ivas_param_ism_dec_close_fx( + PARAM_ISM_DEC_HANDLE *hParamIsmDec, /* i/o: decoder ParamISM handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ + const AUDIO_CONFIG output_config /* i : output audio configuration */ +); +#else void ivas_param_ism_dec_close( PARAM_ISM_DEC_HANDLE *hParamIsmDec, /* i/o: decoder ParamISM handle */ SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ const AUDIO_CONFIG output_config /* i : output audio configuration */ ); +#endif void ivas_param_ism_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index dfe9942a5..efd2b299d 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -446,10 +446,10 @@ typedef struct ivas_masa_directional_spatial_meta_struct float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; #ifdef IVAS_FLOAT_FIXED - Word32 azimuth_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word32 elevation_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word32 energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - Word16 spread_coherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + Word32 azimuth_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q22 */ + Word32 elevation_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q22 */ + Word32 energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q30 */ + Word16 spread_coherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q15 */ #endif uint16_t spherical_index[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; @@ -522,15 +522,15 @@ typedef struct ivas_qdirection_band_data_struct float azimuth[MAX_PARAM_SPATIAL_SUBFRAMES]; float elevation[MAX_PARAM_SPATIAL_SUBFRAMES]; #ifdef IVAS_FLOAT_FIXED - Word32 azimuth_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; - Word32 elevation_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 azimuth_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Q22 */ + Word32 elevation_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Q22 */ #endif int16_t elevation_m_alphabet[MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t azimuth_m_alphabet[MAX_PARAM_SPATIAL_SUBFRAMES]; float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES]; #ifdef IVAS_FLOAT_FIXED - Word32 energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Q30 */ #endif uint8_t distance[MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -595,7 +595,7 @@ typedef struct ivas_masa_qmetadata_frame_struct #ifndef IVAS_FLOAT_FIXED float dir_comp_ratio; #else - Word16 dir_comp_ratio_fx; + Word16 dir_comp_ratio_fx; /* Q15 */ #endif uint8_t is_masa_ivas_format; diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index e58393e8d..538d5c934 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -519,8 +519,8 @@ typedef struct #endif Word16 likelihood_noisy_speech; - float coherence_flt; /* inter-channel coherence of noise */ - Word16 coherence_fx; /* inter-channel coherence of noise */ + float coherence_flt; /* inter-channel coherence of noise */ + Word16 coherence_fx; /* inter-channel coherence of noise */ /* Q15 */ int16_t no_side_flag; /* indicates whether the side noise shape should be zeroed-out or not */ } FD_CNG_COM, *HANDLE_FD_CNG_COM; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 29cca5c92..ec86f6303 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3540,15 +3540,6 @@ void ivas_dirac_dec_render_sf_fx( set_s( q_proto_diffuse_buffer, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, CLDFB_SLOTS_PER_SUBFRAME ); set_zero_fx( surCohRatio_fx, CLDFB_NO_CHANNELS_MAX ); //////////////////////////////////////////////////////////////////////////// to be removed /////////////////////////////////////////////////////////////////// - IF( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) - { - floatToFixed_arrL32( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]], Q30, hSpatParamRendCom->num_freq_bands ); - md_idx = hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->subframes_rendered]; - } - ELSE - { - md_idx = hSpatParamRendCom->render_to_md_map[hSpatParamRendCom->slots_rendered]; - } IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) { @@ -3559,14 +3550,6 @@ void ivas_dirac_dec_render_sf_fx( { p_Rmat_fx = 0; } - IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) - { - IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) - { - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - } - } IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) { @@ -3601,14 +3584,6 @@ void ivas_dirac_dec_render_sf_fx( floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); IF( hDirACRend->masa_stereo_type_detect ) { - IF( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db == -INFINITY ) - { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = MIN_32; - } - ELSE - { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db, Q21 ); - } hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = 0; hDirACRend->masa_stereo_type_detect->q_subtract_power_y = Q31; } @@ -3633,14 +3608,6 @@ void ivas_dirac_dec_render_sf_fx( floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); IF( hDirACRend->masa_stereo_type_detect ) { - IF( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db == -INFINITY ) - { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = MIN_32; - } - ELSE - { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db, Q21 ); - } hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed(hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y); } } @@ -3687,15 +3654,6 @@ void ivas_dirac_dec_render_sf_fx( num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE; } - if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) - { - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); - } - } - if ( h_dirac_output_synthesis_params->use_onset_filters && ( hDirAC->hConfig->dec_param_estim != TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ) { h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); @@ -3801,10 +3759,6 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { - IF( st_ivas->hMasa != NULL ) - { - st_ivas->hMasa->data.dir_decode_quality_fx = float_to_fix16( st_ivas->hMasa->data.dir_decode_quality, Q15 ); - } floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); IF( hDirACRend->masa_stereo_type_detect != NULL ) { @@ -4711,14 +4665,7 @@ void ivas_dirac_dec_render_sf_fx( IF( st_ivas->hMasa != NULL ) { - IF( EQ_16( st_ivas->hMasa->data.dir_decode_quality_fx, MAX_16 ) ) - { - qualityBasedSmFactor_fx = MAX_32; - } - ELSE - { - qualityBasedSmFactor_fx = L_mult( st_ivas->hMasa->data.dir_decode_quality_fx, st_ivas->hMasa->data.dir_decode_quality_fx ); // (Q15, Q15) -> Q31 - } + qualityBasedSmFactor_fx = L_mult( st_ivas->hMasa->data.dir_decode_quality_fx, st_ivas->hMasa->data.dir_decode_quality_fx ); /* (Q15, Q15) -> Q31 */ } IF( NE_16( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, Q31 ) ) @@ -5327,11 +5274,6 @@ void ivas_dirac_dec_render_sf_fx( fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[2][i], hDirACRend->buffer_intensity_real[2][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); fixedToFloat_arrL32( &hDirACRend->buffer_energy_fx[i * num_freq_bands], &hDirACRend->buffer_energy[i * num_freq_bands], hDirACRend->q_buffer_energy[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); } - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - md_idx = hSpatParamRendCom->render_to_md_map[add( hSpatParamRendCom->slots_rendered, slot_idx )]; - fixedToFloat_arrL32( hSpatParamRendCom->diffuseness_vector_fx[md_idx], hSpatParamRendCom->diffuseness_vector[md_idx], Q30, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - } } IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) @@ -5443,8 +5385,6 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirACRend->masa_stereo_type_detect != NULL ) { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx, Q21 ); - hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0947468a2..9e57b7245 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -362,16 +362,9 @@ ivas_error ivas_dec_setup( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p->SrcSpatial_p != NULL ) { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); - } Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); SrcSpatial_p->q_Pos_p = Q31; } } @@ -469,16 +462,9 @@ ivas_error ivas_dec_setup( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p->SrcSpatial_p != NULL ) { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); - } Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); SrcSpatial_p->q_Pos_p = Q31; } } @@ -1472,7 +1458,7 @@ ivas_error ivas_init_decoder_fx( st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; st_ivas->nSCE = MAX_PARAM_ISM_WAVE; - IF ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_param_ism_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -2230,16 +2216,9 @@ ivas_error ivas_init_decoder_fx( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p->SrcSpatial_p != NULL ) { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); - } Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); SrcSpatial_p->q_Pos_p = Q31; } #endif @@ -2348,16 +2327,9 @@ ivas_error ivas_init_decoder_fx( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF(Src_p->SrcSpatial_p != NULL) { - FOR(Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++) - { - fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); - fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); - } Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); - fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); SrcSpatial_p->q_Pos_p = Q31; } #endif @@ -2426,16 +2398,9 @@ ivas_error ivas_init_decoder_fx( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF(Src_p->SrcSpatial_p != NULL) { - FOR(Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++) - { - fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); - fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); - } Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); - fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); SrcSpatial_p->q_Pos_p = Q31; } #endif @@ -4087,7 +4052,11 @@ void ivas_destroy_dec( /* DirAC handle */ IF ( st_ivas->ivas_format == ISM_FORMAT ) { +#ifdef IVAS_FLOAT_FIXED + ivas_param_ism_dec_close_fx( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); +#else ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); +#endif } ELSE { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index ce704794f..f016a00e6 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -182,7 +182,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( IF ( EQ_32( st_ivas->ism_mode, ISM_MODE_DISC ) && EQ_32( last_ism_mode, ISM_MODE_PARAM ) ) { /* Deallocate the ParamISM struct */ - ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); + ivas_param_ism_dec_close_fx( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); IF ( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { @@ -236,7 +236,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) && EQ_32( last_ism_mode, ISM_MODE_DISC ) ) { /* Allocate and initialize the ParamISM struct */ - IF( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_param_ism_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index a9bcb7f64..1dc4b95bd 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -46,6 +46,7 @@ #include "debug.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED #endif // IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------* @@ -492,7 +493,11 @@ static void ivas_param_ism_compute_mixing_matrix( } else { +#ifndef IVAS_FLOAT_FIXED direct_power[w] = hParamIsmDec->power_ratios[band_idx][0][w] * ref_power[bin_idx]; +#else + direct_power[w] = fix16_to_float( hParamIsmDec->power_ratios_fx[band_idx][0][w], Q15 ) * ref_power[bin_idx]; +#endif } if ( direct_power[w] != 0.f ) @@ -701,7 +706,7 @@ static void ivas_param_ism_rendering( #ifdef IVAS_FLOAT_FIXED -static ivas_error ivas_param_ism_rendering_init( +static ivas_error ivas_param_ism_rendering_init_fx( PARAM_ISM_RENDERING_HANDLE hParamIsmRendering, IVAS_OUTPUT_SETUP hOutSetup, const Word16 nchan_transport, @@ -720,16 +725,17 @@ static ivas_error ivas_param_ism_rendering_init( #endif /* memory allocation for proto matrix and interpolator */ - if ( ( hParamIsmRendering->proto_matrix = (float *) malloc( hOutSetup.nchan_out_woLFE * nchan_transport * sizeof( float ) ) ) == NULL ) +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + IF ( ( hParamIsmRendering->proto_matrix = (float *) malloc( hOutSetup.nchan_out_woLFE * nchan_transport * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for proto matrix\n" ) ); } -#ifdef IVAS_FLOAT_FIXED +#endif IF( ( hParamIsmRendering->proto_matrix_fx = (Word16 *) malloc( hOutSetup.nchan_out_woLFE * nchan_transport * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for proto matrix\n" ) ); } -#endif // IVAS_FLOAT_FIXED + IF( ( hParamIsmRendering->interpolator_fx = (Word16 *) malloc( subframe_nbslots * sizeof( Word16 ) ) ) == NULL ) { @@ -741,15 +747,14 @@ static ivas_error ivas_param_ism_rendering_init( IF( !( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) { /* computation of proto matrix */ -#ifdef IVAS_FLOAT_FIXED ivas_ism_get_proto_matrix_fx( hOutSetup, nchan_transport, hParamIsmRendering->proto_matrix_fx ); - for ( int idx = 0; idx < hOutSetup.nchan_out_woLFE; idx++ ) + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + FOR ( Word16 idx = 0; idx < hOutSetup.nchan_out_woLFE; idx++ ) { hParamIsmRendering->proto_matrix[idx] = (float) hParamIsmRendering->proto_matrix_fx[idx] / ( 1 << 15 ); hParamIsmRendering->proto_matrix[idx + hOutSetup.nchan_out_woLFE] = (float) hParamIsmRendering->proto_matrix_fx[idx + hOutSetup.nchan_out_woLFE] / ( 1 << 15 ); } -#else - ivas_ism_get_proto_matrix( hOutSetup, nchan_transport, hParamIsmRendering->proto_matrix ); #endif } @@ -871,16 +876,16 @@ static void ivas_param_ism_update_mixing_matrix( * Open Param ISM handle *-------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -ivas_error ivas_param_ism_dec_open( +ivas_error ivas_param_ism_dec_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t i; + Word16 i, scale, tmp; PARAM_ISM_DEC_HANDLE hParamIsmDec; IVAS_OUTPUT_SETUP hOutSetup; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; AUDIO_CONFIG output_config; - int32_t output_Fs; + Word32 output_Fs; ivas_error error; error = IVAS_ERR_OK; @@ -891,61 +896,66 @@ ivas_error ivas_param_ism_dec_open( * prepare library opening *-----------------------------------------------------------------*/ - if ( ( hParamIsmDec = (PARAM_ISM_DEC_HANDLE) malloc( sizeof( PARAM_ISM_DEC_DATA ) ) ) == NULL ) + IF ( ( hParamIsmDec = (PARAM_ISM_DEC_HANDLE) malloc( sizeof( PARAM_ISM_DEC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM\n" ) ); } - if ( ( hSpatParamRendCom = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) + IF ( ( hSpatParamRendCom = (SPAT_PARAM_REND_COMMON_DATA_HANDLE) malloc( sizeof( SPAT_PARAM_REND_COMMON_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } /* Assign memory to Param Object handle */ - if ( ( hParamIsmDec->hParamIsm = (PARAM_ISM_CONFIG_HANDLE) malloc( sizeof( PARAM_ISM_CONFIG_DATA ) ) ) == NULL ) + IF ( ( hParamIsmDec->hParamIsm = (PARAM_ISM_CONFIG_HANDLE) malloc( sizeof( PARAM_ISM_CONFIG_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM\n" ) ); } - if ( ( hParamIsmDec->hParamIsmRendering = (PARAM_ISM_RENDERING_HANDLE) malloc( sizeof( PARAM_ISM_RENDERING_DATA ) ) ) == NULL ) + IF ( ( hParamIsmDec->hParamIsmRendering = (PARAM_ISM_RENDERING_HANDLE) malloc( sizeof( PARAM_ISM_RENDERING_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM Rendering handle\n" ) ); } output_Fs = st_ivas->hDecoderConfig->output_Fs; + move32(); output_config = st_ivas->hDecoderConfig->output_config; -#ifdef IVAS_FLOAT_FIXED - ivas_param_ism_config_fx( hParamIsmDec->hParamIsm, st_ivas->nchan_ism ); // assuming Q14 for gains; +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED hParamIsmDec->hParamIsm->last_dmx_gain = 1.0f; set_f(hParamIsmDec->hParamIsm->last_cardioid_left, 1.0f, MAX_NUM_OBJECTS ); -#else - ivas_param_ism_config( hParamIsmDec->hParamIsm, st_ivas->nchan_ism ); #endif /*-----------------------------------------------------------------* * set input parameters *-----------------------------------------------------------------*/ - hSpatParamRendCom->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + tmp = BASOP_Util_Divide3232_Scale( output_Fs, CLDFB_BANDWIDTH, &scale ); // FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + hSpatParamRendCom->slot_size = shr(tmp, 15 - scale); set_s( hSpatParamRendCom->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hSpatParamRendCom->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hSpatParamRendCom->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; hSpatParamRendCom->subframes_rendered = 0; + move16(); hSpatParamRendCom->slots_rendered = 0; + move16(); + hSpatParamRendCom->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; - hSpatParamRendCom->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + tmp = BASOP_Util_Divide3232_Scale( output_Fs, CLDFB_BANDWIDTH, &scale ); + hSpatParamRendCom->num_freq_bands = shr(tmp, 15 - scale ); hParamIsmDec->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; - for ( i = 0; i < ( hParamIsmDec->hParamIsm->nbands + 1 ); i++ ) + FOR ( i = 0; i < ( hParamIsmDec->hParamIsm->nbands + 1 ); i++ ) { hParamIsmDec->hParamIsm->band_grouping[i] = Param_ISM_band_grouping[i]; + move16(); - if ( hParamIsmDec->hParamIsm->band_grouping[i] > hSpatParamRendCom->num_freq_bands ) + IF ( GT_16( hParamIsmDec->hParamIsm->band_grouping[i], hSpatParamRendCom->num_freq_bands ) ) { hParamIsmDec->hParamIsm->band_grouping[i] = hSpatParamRendCom->num_freq_bands; + move16(); } } @@ -954,123 +964,127 @@ ivas_error ivas_param_ism_dec_open( *-----------------------------------------------------------------*/ /* hIntSetup and hOutSetup differs only for Binaural rendering */ - if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + IF ( EQ_16( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { /* nchan_out is essential for memory initialization for CLDFB Synthesis */ st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->nchan_ism; + move16(); st_ivas->hIntSetup.is_loudspeaker_setup = 1; } hOutSetup = st_ivas->hIntSetup; - if ( !( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) + test(); + IF ( !( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) ) { /* Initialize Param ISM Rendering handle */ - if ( st_ivas->hDecoderConfig->Opt_tsm ) + IF ( st_ivas->hDecoderConfig->Opt_tsm ) { - if ( ( error = ivas_param_ism_rendering_init( hParamIsmDec->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, MAX_JBM_CLDFB_TIMESLOTS, output_config ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_param_ism_rendering_init_fx( hParamIsmDec->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, MAX_JBM_CLDFB_TIMESLOTS, output_config ) ) != IVAS_ERR_OK ) { return error; } } - else + ELSE { - if ( ( error = ivas_param_ism_rendering_init( hParamIsmDec->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, CLDFB_NO_COL_MAX, output_config ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_param_ism_rendering_init_fx( hParamIsmDec->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, CLDFB_NO_COL_MAX, output_config ) ) != IVAS_ERR_OK ) { return error; } } } - if ( !( output_config == IVAS_AUDIO_CONFIG_EXTERNAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || + test(); test(); test(); test(); test(); + IF ( !( output_config == IVAS_AUDIO_CONFIG_EXTERNAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) { /* Initialize efap handle */ - if ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } } /* Azi and Ele values are transmitted once per frame per object */ -#ifdef IVAS_FLOAT_FIXED + set32_fx( hParamIsmDec->azimuth_values_fx, 0, MAX_NUM_OBJECTS ); set32_fx( hParamIsmDec->elevation_values_fx, 0, MAX_NUM_OBJECTS ); -#else - set_zero( hParamIsmDec->azimuth_values, MAX_NUM_OBJECTS ); - set_zero( hParamIsmDec->elevation_values, MAX_NUM_OBJECTS ); -#endif hSpatParamRendCom->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; + move16(); hSpatParamRendCom->dirac_bs_md_write_idx = 0; + move16(); hSpatParamRendCom->dirac_read_idx = 0; + move16(); - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + test(); test(); + IF ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_dirac_allocate_parameters_fx( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 1 ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_dirac_allocate_parameters_fx( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_allocate_parameters( hSpatParamRendCom, 2 ) ) != IVAS_ERR_OK ) -#endif { return error; } } st_ivas->hISMDTX.dtx_flag = 0; + move16(); st_ivas->hParamIsmDec = hParamIsmDec; st_ivas->hSpatParamRendCom = hSpatParamRendCom; - if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) + test(); + IF ( NE_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) ) { - int16_t nchan_transport = st_ivas->nchan_transport; - int16_t nchan_full = 0; + Word16 nchan_transport = st_ivas->nchan_transport; + move16(); + Word16 nchan_full = 0; + move16(); - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + test(); + IF ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { nchan_full = nchan_transport; +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; -#ifdef IVAS_FLOAT_FIXED +#endif hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx = NULL; hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx = NULL; -#endif // IVAS_FLOAT_FIXED } - else + ELSE { - int16_t n_slots_to_alloc; - if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) + Word16 n_slots_to_alloc; + IF ( EQ_16( st_ivas->hDecoderConfig->Opt_tsm, 1 ) ) { n_slots_to_alloc = MAX_JBM_CLDFB_TIMESLOTS; + move16(); } - else + ELSE { n_slots_to_alloc = CLDFB_SLOTS_PER_SUBFRAME * MAX_PARAM_SPATIAL_SUBFRAMES; + move16(); } - if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + IF ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); - if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + IF ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED +#endif + IF( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); @@ -1082,38 +1096,30 @@ ivas_error ivas_param_ism_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } set32_fx( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx, 0, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); -#endif // IVAS_FLOAT_FIXED } - if ( st_ivas->hTcBuffer == NULL ) + IF ( st_ivas->hTcBuffer == NULL ) { + IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } } } - else + ELSE { +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; -#ifdef IVAS_FLOAT_FIXED +#endif hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx = NULL; hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx = NULL; -#endif // IVAS_FLOAT_FIXED - if ( st_ivas->hTcBuffer == NULL ) + IF ( st_ivas->hTcBuffer == NULL ) { - int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif + Word16 nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; + move16(); + IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1335,7 +1341,7 @@ ivas_error ivas_param_ism_dec_open( *-------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -void ivas_param_ism_dec_close( +void ivas_param_ism_dec_close_fx( PARAM_ISM_DEC_HANDLE *hParamIsmDec_out, /* i/o: decoder DirAC handle */ SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ AUDIO_CONFIG output_config /* i : output audio configuration */ @@ -1356,13 +1362,14 @@ void ivas_param_ism_dec_close( IF( !( EQ_16( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) ) { /* Param ISM Rendering */ +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed later: Freeing memory allocated to float pointers IF( hParamIsmDec->hParamIsmRendering->proto_matrix != NULL ) { free( hParamIsmDec->hParamIsmRendering->proto_matrix ); hParamIsmDec->hParamIsmRendering->proto_matrix = NULL; } - //------------------------------------------------------------ +#endif IF( hParamIsmDec->hParamIsmRendering->interpolator_fx != NULL ) { free( hParamIsmDec->hParamIsmRendering->interpolator_fx ); @@ -1374,6 +1381,7 @@ void ivas_param_ism_dec_close( hParamIsmDec->hParamIsmRendering->proto_matrix_fx = NULL; } } +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed later: Freeing memory allocated to float pointers IF( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) { @@ -1385,7 +1393,7 @@ void ivas_param_ism_dec_close( free( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc ); hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } - //----------------------------------------------------------------- +#endif IF( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx != NULL ) { free( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx ); @@ -1410,13 +1418,8 @@ void ivas_param_ism_dec_close( { IF( EQ_16( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { -#ifdef IVAS_FLOAT_FIXED ivas_dirac_deallocate_parameters_fx( *hSpatParamRendCom_out, 1 ); ivas_dirac_deallocate_parameters_fx( *hSpatParamRendCom_out, 2 ); -#else - ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 1 ); - ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 2 ); -#endif } free( *hSpatParamRendCom_out ); @@ -1484,13 +1487,8 @@ void ivas_param_ism_dec_close( { if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_deallocate_parameters_fx(*hSpatParamRendCom_out, 1); - ivas_dirac_deallocate_parameters_fx(*hSpatParamRendCom_out, 2); -#else ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 1 ); ivas_dirac_deallocate_parameters( *hSpatParamRendCom_out, 2 ); -#endif } free( *hSpatParamRendCom_out ); @@ -2047,29 +2045,7 @@ void ivas_param_ism_dec_digest_tc( { #ifdef IVAS_FLOAT_FIXED ivas_param_ism_dec_dequant_DOA_fx( hParamIsmDec, st_ivas->nchan_ism ); -#ifndef MSAN_FIX - for ( i = 0; i < 11; i++ ) - { - for ( int j = 0; j < 1; j++ ) - { - for ( int k = 0; k < 2; k++ ) - { - hParamIsmDec->power_ratios_fx[i][j][k] = (Word16) floatToFixed( hParamIsmDec->power_ratios[i][j][k], 15 ); - } - } - } -#endif ivas_param_ism_dec_dequant_powrat_fx( hParamIsmDec ); - for ( i = 0; i < 11; i++ ) - { - for ( int j = 0; j < 1; j++ ) - { - for ( int k = 0; k < 2; k++ ) - { - hParamIsmDec->power_ratios[i][j][k] = fixedToFloat( hParamIsmDec->power_ratios_fx[i][j][k], 15 ); - } - } - } #else ivas_param_ism_dec_dequant_DOA( hParamIsmDec, st_ivas->nchan_ism ); ivas_param_ism_dec_dequant_powrat( hParamIsmDec ); @@ -2862,7 +2838,7 @@ void ivas_param_ism_params_to_masa_param_mapping_fx( Word16 brange[2]; Word16 azimuth[2]; Word16 elevation[2]; - Word16 power_ratio_fx[2]; + Word16 power_ratio_fx[2]; /* Q15 */ Word32 ivas_total_brate; hParamIsmDec = st_ivas->hParamIsmDec; @@ -2890,8 +2866,8 @@ void ivas_param_ism_params_to_masa_param_mapping_fx( { IF ( st_ivas->hISMDTX.dtx_flag ) { - Word16 energy_ratio_fx; - energy_ratio_fx = mult( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx, st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx );/*Q15*/ + Word32 energy_ratio_fx; /* Q30 */ + energy_ratio_fx = L_mult0( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx, st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx ); /* Q15 + Q15 -> Q30 */ hSpatParamRendCom->numSimultaneousDirections = 1; move16(); @@ -2945,10 +2921,10 @@ void ivas_param_ism_params_to_masa_param_mapping_fx( { hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; - hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx] = power_ratio_fx[0]; + hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx] = L_shl( power_ratio_fx[0], Q15 ); hSpatParamRendCom->azimuth2[sf_idx][bin_idx] = azimuth[1]; hSpatParamRendCom->elevation2[sf_idx][bin_idx] = elevation[1]; - hSpatParamRendCom->energy_ratio2_fx[sf_idx][bin_idx] = power_ratio_fx[1]; + hSpatParamRendCom->energy_ratio2_fx[sf_idx][bin_idx] = L_shl( power_ratio_fx[1], Q15 ); move16(); move16(); move16(); @@ -2986,7 +2962,7 @@ void ivas_param_ism_params_to_masa_param_mapping_fx( { hSpatParamRendCom->azimuth[sf_idx][bin_idx] = azimuth[0]; hSpatParamRendCom->elevation[sf_idx][bin_idx] = elevation[0]; - hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx] = 32767; + hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx] = ONE_IN_Q30; /* 1.0f in Q30 */ hSpatParamRendCom->spreadCoherence_fx[sf_idx][bin_idx] = 0; hSpatParamRendCom->surroundingCoherence_fx[sf_idx][bin_idx] = 0; move16(); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 76a0a6951..2666c13d5 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -100,7 +100,7 @@ ivas_error ivas_jbm_dec_tc_fx( Word32 *data_fx ) { - Word16 n, output_frame, nchan_out, i, j; + Word16 n, output_frame, nchan_out, i; Decoder_State *st; /* used for bitstream handling */ Word32 *p_output_fx[MAX_TRANSPORT_CHANNELS]; /* 'float' buffer for output synthesis */ Word16 nchan_remapped; @@ -1176,36 +1176,6 @@ ivas_error ivas_jbm_dec_tc_fx( return error; } - // Fix to float conversion starts here. - IF( st_ivas->hSpatParamRendCom != NULL ) - { - FOR( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - FOR( j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++ ) - { - st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) - { - st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); - } - } - } - } - st_ivas->hMasa->data.dir_decode_quality = fix16_to_float( st_ivas->hMasa->data.dir_decode_quality_fx, Q14 ); - IF( st_ivas->hSpatParamRendCom != NULL ) - { - FOR( i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++ ) - { - FOR( Word16 block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) - { - FOR( Word16 b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++ ) - { - st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b] = fix_to_float( st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][block][b], Q30 ); - } - } - } - } // Fixed to float conversion ends here. IF( st_ivas->hOutSetup.separateChannelEnabled ) { @@ -2150,55 +2120,14 @@ void ivas_jbm_dec_feed_tc_to_renderer( { if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { - ivas_dirac_dec_set_md_map_fx( st_ivas, n_render_timeslots ); -#if 1 /*Float to fix */ - PARAM_ISM_DEC_HANDLE hParamIsmDec; - hParamIsmDec = st_ivas->hParamIsmDec; #ifndef IVAS_FLOAT_FIXED - FOR( i = 0; i < 11; i++ ) - { - FOR( Word16 j = 0; j < 1; j++ ) - { - FOR( Word16 k = 0; k < 2; k++ ) - { - hParamIsmDec->power_ratios_fx[i][j][k] = (Word16) floatToFixed( hParamIsmDec->power_ratios[i][j][k], 15 ); - } - } - } -#endif - // st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_fx = float_to_fix16( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence_flt, 15 ); - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - Word16 nBins = hSpatParamRendCom->num_freq_bands; - for ( Word16 sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) - { - for ( Word16 bin_idx = 0; bin_idx < nBins; bin_idx++ ) - { - hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx] = float_to_fix16( hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->energy_ratio2_fx[sf_idx][bin_idx] = float_to_fix16( hSpatParamRendCom->energy_ratio2[sf_idx][bin_idx], 15 ); - } - } -#endif // IVAS_FLOAT_FIXED + ivas_dirac_dec_set_md_map(st_ivas, n_render_timeslots); + + ivas_param_ism_params_to_masa_param_mapping(st_ivas); +#else + ivas_dirac_dec_set_md_map_fx( st_ivas, n_render_timeslots ); + ivas_param_ism_params_to_masa_param_mapping_fx( st_ivas ); -#if 1 /*Fix to float*/ - FOR( i = 0; i < 11; i++ ) - { - FOR( Word16 j = 0; j < 1; j++ ) - { - FOR( Word16 k = 0; k < 2; k++ ) - { - hParamIsmDec->power_ratios[i][j][k] = fixedToFloat( hParamIsmDec->power_ratios_fx[i][j][k], 15 ); - } - } - } - for ( Word16 sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) - { - for ( Word16 bin_idx = 0; bin_idx < nBins; bin_idx++ ) - { - hSpatParamRendCom->energy_ratio1[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->energy_ratio1_fx[sf_idx][bin_idx], 15 ); - hSpatParamRendCom->energy_ratio2[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->energy_ratio2_fx[sf_idx][bin_idx], 15 ); - } - } #endif } else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index d83a1bfb4..424726a4d 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -641,7 +641,7 @@ ivas_error ivas_masa_decode_fx( ivas_format = st_ivas->ivas_format; move32(); - hMasa->data.dir_decode_quality_fx = ONE_IN_Q14; /* Set to default of max quality */ + hMasa->data.dir_decode_quality_fx = MAX16B; /* Set to default of max quality */ /* 1.0f in Q15 */ move16(); hQMetaData->is_masa_ivas_format = 1; @@ -951,7 +951,7 @@ ivas_error ivas_masa_decode_fx( /* Get direction decoding quality. EC 1 and 2 are handled by the default value. */ IF( EQ_16( hQMetaData->ec_flag, 2 ) ) { - hMasa->data.dir_decode_quality_fx = shr( hQMetaData->dir_comp_ratio_fx, 1 ); // Q14 + hMasa->data.dir_decode_quality_fx = hQMetaData->dir_comp_ratio_fx; /* Q15 */ } hMasa->config.coherencePresent = !hQMetaData->all_coherence_zero; @@ -3306,7 +3306,7 @@ void ivas_spar_param_to_masa_param_mapping_fx( Word16 num_q, denom_q, res_q; Word16 headroom_left_max_common = 63; // 0 value Word16 q_max_common = 31; - Word32 ratio_float_fx_Q15, max_ratio_1_Q15; + Word32 ratio_fx; /* Q30 */ FOR( Word16 ind = 0; ind < 6; ind++ ) { FOR( Word16 ind2 = 0; ind2 < 4; ind2++ ) @@ -3603,20 +3603,10 @@ void ivas_spar_param_to_masa_param_mapping_fx( E_fx = GT_32( E_fx, 0 ) ? E_fx : 1; ratio_float_fx = BASOP_Util_Divide3232_Scale( I_fx, E_fx, &res_q ); res_q = sub( res_q, sub( num_q, denom_q ) ); - IF( LT_16( res_q, 0 ) ) - { - ratio_float_fx = L_shr( ratio_float_fx, -1 * res_q ); - res_q = 0; - move16(); - } - ratio_float_fx_Q15 = L_shl( ratio_float_fx, res_q ); - max_ratio_1_Q15 = MAX_WORD16; - move32(); - IF( GT_32( ratio_float_fx_Q15, max_ratio_1_Q15 ) ) - { - ratio_float_fx_Q15 = max_ratio_1_Q15; - move32(); - } + ratio_fx = L_shl_sat( ratio_float_fx, Q15 + res_q ); + + ratio_fx = L_max( 0, L_min( ratio_fx, ONE_IN_Q30 ) ); + azi_val = (Word64) azi_fx * ONE_BY_PI_OVER_180_Q25; IF( LT_64( azi_val, 0 ) ) { @@ -3642,23 +3632,16 @@ void ivas_spar_param_to_masa_param_mapping_fx( move16(); hSpatParamRendCom->elevation[dirac_write_idx][bin] = (Word16) ele_val; move16(); - - hSpatParamRendCom->energy_ratio1_fx[dirac_write_idx][bin] = L_deposit_h( (Word16) ratio_float_fx_Q15 ); + hSpatParamRendCom->energy_ratio1_fx[dirac_write_idx][bin] = ratio_fx; move32(); - hSpatParamRendCom->diffuseness_vector_fx[dirac_write_idx][bin] = L_deposit_h( sub( 32767, (Word16) ratio_float_fx_Q15 ) ); + hSpatParamRendCom->diffuseness_vector_fx[dirac_write_idx][bin] = L_sub( ONE_IN_Q30, ratio_fx ); move32(); + hSpatParamRendCom->spreadCoherence_fx[dirac_write_idx][bin] = 0; move16(); hSpatParamRendCom->surroundingCoherence_fx[dirac_write_idx][bin] = 0; move16(); - - // Tobe deleted - hSpatParamRendCom->energy_ratio1[dirac_write_idx][bin] = (float) hSpatParamRendCom->energy_ratio1_fx[dirac_write_idx][bin] / ONE_IN_Q31; - hSpatParamRendCom->diffuseness_vector[dirac_write_idx][bin] = (float) hSpatParamRendCom->diffuseness_vector_fx[dirac_write_idx][bin] / ONE_IN_Q31; - //// - - /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ IF( hDiffuseDist != NULL ) { diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 04d732ee9..af6a0705f 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -163,9 +163,6 @@ ivas_error ivas_omasa_data_open_fx( set16_fx( hMasaIsmData->elevation_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ ) { - // To be removed later ///////////////////////////////////////////////////////////////////////// - set_zero( hMasaIsmData->energy_ratio_ism[obj_idx][sf], CLDFB_NO_CHANNELS_MAX ); - ///////////////////////////////////////////////////////////////////////////////////////////////// set32_fx( hMasaIsmData->energy_ratio_ism_fx[obj_idx][sf], 0, CLDFB_NO_CHANNELS_MAX ); } } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 561335d86..6cae8ac1e 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1478,16 +1478,9 @@ ivas_error ivas_sba_dec_reconfigure_fx( TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; IF(Src_p->SrcSpatial_p != NULL) { - FOR(Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++) - { - fixedToFloat_arrL(Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3); - fixedToFloat_arrL(Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3); - } Src_p->SrcSpatial_p->q_Pos_p = Q31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL(SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3); - fixedToFloat_arrL(SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3); SrcSpatial_p->q_Pos_p = Q31; } #endif diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index d29f63ceb..e54f30546 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -575,7 +575,6 @@ ivas_error ivas_spar_dec_fx( hDecoderConfig = st_ivas->hDecoderConfig; #ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - Word16 hodirac_flag = ivas_get_hodirac_flag_fx( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); Word16 j, k, d; IF( st_ivas->hQMetaData != NULL ) { @@ -601,21 +600,6 @@ ivas_error ivas_spar_dec_fx( } } } - IF( st_ivas->hDirAC != NULL && st_ivas->hSpatParamRendCom != NULL ) - { - for ( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - for ( j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++ ) - { - st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j] = float_to_fix( st_ivas->hSpatParamRendCom->diffuseness_vector[i][j], 30 ); - st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j] = float_to_fix( st_ivas->hSpatParamRendCom->energy_ratio1[i][j], 30 ); - IF( hodirac_flag ) - { - st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j] = float_to_fix( st_ivas->hSpatParamRendCom->energy_ratio2[i][j], 30 ); - } - } - } - } } #endif @@ -698,21 +682,6 @@ ivas_error ivas_spar_dec_fx( } } } - IF( st_ivas->hDirAC != NULL && st_ivas->hSpatParamRendCom != NULL ) - { - for ( i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - for ( j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++ ) - { - st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30 ); - st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30 ); - IF( hodirac_flag ) - { - st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float( st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30 ); - } - } - } - } } #endif diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 63c16aa1d..1b05166dc 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -1211,11 +1211,13 @@ static ivas_error ivas_spar_set_dec_config( } #endif + /*-----------------------------------------------------------------------------------------* * Function ivas_dec_mono_sba_handling() * * *-----------------------------------------------------------------------------------------*/ + #ifndef IVAS_FLOAT_FIXED static void ivas_dec_mono_sba_handling( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ @@ -1272,74 +1274,72 @@ static void ivas_dec_mono_sba_handling( } #else static void ivas_dec_mono_sba_handling_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { - Word16 mono_flag, b, block; + Word16 mono_flag, b, block; - mono_flag = 1; + mono_flag = 1; + move16(); - FOR ( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) - { - FOR( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) - { - - Word32 azimuth_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; - Word32 elevation_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; - Word32 energy_ratio_fx = st_ivas->hQMetaData->q_direction[0].band_data[0].energy_ratio_fx[block]; + FOR( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + FOR( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + Word32 azimuth_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; + move32(); + Word32 elevation_fx = st_ivas->hQMetaData->q_direction[0].band_data[b].azimuth_fx[block]; + move32(); + Word32 energy_ratio_fx = st_ivas->hQMetaData->q_direction[0].band_data[0].energy_ratio_fx[block]; + move32(); - IF ( - ( NE_32(azimuth_fx, 0) ) || - (NE_32(elevation_fx, 0) ) || - (GT_32(energy_ratio_fx, 161061274) ) ) /* 0.15f is just above the lowest quantised value. */ + test(); + test(); + IF( + ( NE_32( azimuth_fx, 0 ) ) || + ( NE_32( elevation_fx, 0 ) ) || + ( GT_32( energy_ratio_fx, 161061274 /* 0.15f in Q30 */ ) ) ) /* 0.15f is just above the lowest quantised value. */ { mono_flag = 0; + move16(); } } } /* Combine the SPAR prediction coefs flag with the azimuth, elevation and energy ratio flag.*/ - //mono_flag = mono_flag && ivas_spar_chk_zero_coefs( st_ivas ); mono_flag = mono_flag && ivas_spar_chk_zero_coefs_fx( st_ivas ); - if ( mono_flag ) + IF( mono_flag ) { /* Set Energy Ratio values to be zero */ - for ( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) + FOR( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) { +#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED set_zero( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio, MAX_PARAM_SPATIAL_SUBFRAMES ); - - set32_fx( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio_fx,0, MAX_PARAM_SPATIAL_SUBFRAMES ); - +#endif + set32_fx( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } - if ( st_ivas->hDirAC != NULL ) + IF( st_ivas->hDirAC != NULL ) { - for ( block = 0; block < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; ++block ) + FOR( block = 0; block < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; ++block ) { /* Set directional Energy Ratio values to be zero */ - set_zero( st_ivas->hSpatParamRendCom->energy_ratio1[block], st_ivas->hSpatParamRendCom->num_freq_bands ); - - set32_fx( st_ivas->hSpatParamRendCom->energy_ratio1_fx[block],0, st_ivas->hSpatParamRendCom->num_freq_bands ); - - if ( st_ivas->hQMetaData->no_directions == 2 ) + set32_fx( st_ivas->hSpatParamRendCom->energy_ratio1_fx[block], 0, st_ivas->hSpatParamRendCom->num_freq_bands ); + IF( EQ_32( st_ivas->hQMetaData->no_directions, 2 ) ) { - set_zero( st_ivas->hSpatParamRendCom->energy_ratio2[block], st_ivas->hSpatParamRendCom->num_freq_bands ); - - set32_fx( st_ivas->hSpatParamRendCom->energy_ratio2_fx[block],0, st_ivas->hSpatParamRendCom->num_freq_bands ); - + set32_fx( st_ivas->hSpatParamRendCom->energy_ratio2_fx[block], 0, st_ivas->hSpatParamRendCom->num_freq_bands ); } /* Set Diffuseness values to be 1.0 */ - set_f( st_ivas->hSpatParamRendCom->diffuseness_vector[block], 1.0f, st_ivas->hSpatParamRendCom->num_freq_bands ); - set32_fx( st_ivas->hSpatParamRendCom->diffuseness_vector_fx[block], ONE_IN_Q30, st_ivas->hSpatParamRendCom->num_freq_bands ); - } } } return; } -#endif +#endif + + #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_spar_md_dec_process_fx() @@ -5160,32 +5160,29 @@ void ivas_spar_to_dirac_fx( for (b = qmf_band_start; b < qmf_band_end; b++) { - azi_dith = azi[band]; - ele_dith = ele[band]; + azi_dith = azi[band]; + ele_dith = ele[band]; - hSpatParamRendCom->energy_ratio1[block][b] = en_ratio_fx / ((float)ONE_IN_Q30); - hSpatParamRendCom->energy_ratio1_fx[block][b] = en_ratio_fx; - tmp_write_idx_band = tmp_write_idx_param_band; + hSpatParamRendCom->energy_ratio1_fx[block][b] = en_ratio_fx; + tmp_write_idx_band = tmp_write_idx_param_band; if (hDirAC->hConfig->dec_param_estim == FALSE) { - hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; - hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; - hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness_fx[band] / ((float)ONE_IN_Q30); + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; - hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; + hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; } else { for (ts = ts_start; ts < ts_end; ts++) { - hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; - hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; - hSpatParamRendCom->diffuseness_vector[tmp_write_idx_band][b] = diffuseness_fx[band] / ((float)ONE_IN_Q30); + hSpatParamRendCom->elevation[tmp_write_idx_band][b] = ele_dith; + hSpatParamRendCom->azimuth[tmp_write_idx_band][b] = azi_dith; - hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; + hSpatParamRendCom->diffuseness_vector_fx[tmp_write_idx_band][b] = diffuseness_fx[band]; tmp_write_idx_band = (tmp_write_idx_band + 1) % hSpatParamRendCom->dirac_md_buffer_length; } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 04f2452d7..ca390f894 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -726,12 +726,12 @@ typedef struct ivas_param_ism_dec_data_structure #ifndef IVAS_FLOAT_FIXED float azimuth_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; float elevation_values[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; -#else - Word32 azimuth_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; /* Q22 */ - Word32 elevation_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; /* Q22 */ - Word16 power_ratios_fx[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; -#endif // IVAS_FLOAT_FIXED float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; +#else + Word32 azimuth_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; /* Q22 */ + Word32 elevation_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; /* Q22 */ + Word16 power_ratios_fx[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; /* Q15 */ +#endif /*sub-modules*/ PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM common handle */ @@ -1334,9 +1334,10 @@ typedef struct ivas_masa_decoder_data_struct SPHERICAL_GRID_DATA *sph_grid16; MASA_DECODER_EXT_OUT_META *extOutMeta; +#ifndef IVAS_FLOAT_FIXED float dir_decode_quality; -#ifdef IVAS_FLOAT_FIXED - Word16 dir_decode_quality_fx; // Q14 +#else + Word16 dir_decode_quality_fx; /* Q15 */ #endif } MASA_DECODER_DATA; @@ -1354,15 +1355,14 @@ typedef struct ivas_masa_ism_data_structure { int16_t azimuth_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; int16_t elevation_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR]; - float energy_ratio_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; -#ifdef IVAS_FLOAT_FIXED - Word32 energy_ratio_ism_fx[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; /* Q30 */ -#endif #ifndef IVAS_FLOAT_FIXED + float energy_ratio_ism[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; #else - Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q30 */ + Word32 energy_ratio_ism_fx[MAX_NUM_OBJECTS][MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; /* Q30 */ + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q30 */ #endif + int16_t azimuth_ism_edited[MAX_NUM_OBJECTS]; int16_t elevation_ism_edited[MAX_NUM_OBJECTS]; uint8_t ism_is_edited[MAX_NUM_OBJECTS]; @@ -1375,14 +1375,14 @@ typedef struct ivas_masa_ism_data_structure float q_azimuth_old[MAX_NUM_OBJECTS]; float q_elevation_old[MAX_NUM_OBJECTS]; #else - Word32 q_azimuth_old_fx[MAX_NUM_OBJECTS]; /* Q22 */ - Word32 q_elevation_old_fx[MAX_NUM_OBJECTS]; /* Q22 */ + Word32 q_azimuth_old_fx[MAX_NUM_OBJECTS]; /* Q22 */ + Word32 q_elevation_old_fx[MAX_NUM_OBJECTS]; /* Q22 */ #endif #ifndef IVAS_FLOAT_FIXED float ismPreprocMatrix[2][2][CLDFB_NO_CHANNELS_MAX]; #else - Word16 ismPreprocMatrix_fx[2][2][CLDFB_NO_CHANNELS_MAX]; /* Q15 */ + Word16 ismPreprocMatrix_fx[2][2][CLDFB_NO_CHANNELS_MAX]; /* Q15 */ #endif uint8_t objectsMoved; #ifndef IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index c103dff09..e2e0c238c 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -689,6 +689,7 @@ static void stereo_dft_generate_comfort_noise_fx( Word16 *ptr_q_shb; Word16 dmpf[M + 2], Atmp[M + 2]; Word32 cngNoiseLevel_upd[L_FRAME16k], cngNoiseLevel_hist[L_FRAME16k - 2]; + Word16 q_cng_temp[L_FRAME16k]; Word32 *ptr_tmp, *ptr_cng; Word32 E0, E1; Word16 b, q_cngNoiseLevel_upd, q_cngNoiseLevel; @@ -705,7 +706,7 @@ static void stereo_dft_generate_comfort_noise_fx( const Word16 *pTrigo; Word16 trigo_step; Word16 addl_guard_bits; - + Word16 max_diff; /* * The additional guard bits data is added to tackle very small shb_cng_gain_fx_32. * One additional guard bit is added for every 6dB post -12dB. @@ -916,6 +917,8 @@ static void stereo_dft_generate_comfort_noise_fx( // by adjusting q_inv_sqrt. minimum_abs32_fx( ptr0, st->L_frame, &min_val ); //q_inv_sqrt = sub( sub( Q31, norm_l( L_abs( min_val ) ) ), add( q_div, 1 ) ); + + /* cngNoiseLevel_upd buffer has Q of ( Q30 - rshift_cng )*/ FOR( i = 0; i < shr( st->L_frame, 1 ) - 1; i++ ) { //if ((*ptr1 == 0) && (*ptr2 == 0)) @@ -938,13 +941,47 @@ static void stereo_dft_generate_comfort_noise_fx( } tmp = ISqrt32(ftmp, &q_sqrt); tmp = Mpy_32_16_1(tmp, factor); - tmp = L_shl(tmp, add(sub(sub(Q30, rshift_cng), sub(Q31, q_sqrt)), add(q_div, 1))); - *ptr0++ = tmp; move32(); + q_cng_temp[i] = sub( add( sub( Q31, q_sqrt ), sub( Q15, add( q_div, 1 ) ) ), Q15 ); + *ptr0++ = tmp; + move32(); ptr1 += 2; ptr2 += 2; } - // q_div + 1 has to be added back to q_inv_sqrt. - q_cngNoiseLevel_upd = sub(Q30, rshift_cng); + + /* The initial values in the cngNoiseLevel_upd buffer, from index 0 to st->L_frame / 2 - 1, are updated in the for loop above, + with their Q factors stored in q_cng_temp. The values stored after index st->L_frame / 2 - 1 have a Q factor of (Q30 - rshift_cng). + + Calculate the maximum difference between (Q30 - rshift_cng) and the headroom available for the values stored in cngNoiseLevel_upd + for the initial st->L_frame / 2 - 1 value that were updated in the above for loop. + - If the maximum difference is negative, the cngNoiseLevel_upd buffer has enough headroom to accommodate all the values + with a Q factor of (Q30 - rshift_cng). + + - If the maximum difference is positive, some values in the cngNoiseLevel_upd buffer may overflow with a Q factor of + (Q30 - rshift_cng). In this case, scale the cngNoiseLevel_upd buffer to a Q factor of (Q30 - rshift_cng - max_diff) + to prevent overflows. */ + + max_diff = sub( sub( sub( Q30, rshift_cng ), q_cng_temp[0] ), norm_l( cngNoiseLevel_upd[0] ) ); + FOR( i = 1; i < shr( st->L_frame, 1 ) - 1; i++ ) + { + max_diff = s_max( max_diff, sub( sub( sub( Q30, rshift_cng ), q_cng_temp[i] ), norm_l( cngNoiseLevel_upd[i] ) ) ); + } + IF( LT_16( max_diff, 0 ) ) + { + FOR( i = 0; i < shr( st->L_frame, 1 ) - 1; i++ ) + { + cngNoiseLevel_upd[i] = L_shl( cngNoiseLevel_upd[i], sub( sub( Q30, rshift_cng ), q_cng_temp[i] ) ); + } + q_cngNoiseLevel_upd = sub( Q30, rshift_cng ); + } + ELSE + { + FOR( i = 0; i < shr( st->L_frame, 1 ) - 1; i++ ) + { + cngNoiseLevel_upd[i] = L_shl( cngNoiseLevel_upd[i], sub( sub( sub( Q30, rshift_cng ), q_cng_temp[i] ), max_diff ) ); + } + scale_sig32( cngNoiseLevel_upd + shr( st->L_frame, 1 ) - 1, shr( st->L_frame, 1 ) + 1, -max_diff ); + q_cngNoiseLevel_upd = sub( sub( Q30, rshift_cng ), max_diff ); + } IF( GT_16( sub( s_min( output_frame, L_FRAME32k ), hFdCngCom->stopFFTbin ), 0 ) ) { diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 69c5ddb67..95a3d4a25 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1307,40 +1307,6 @@ static ivas_error IVAS_DEC_GetTcSamples( hIvasDec->isInitialized = true; /* Initialization done in ivas_dec() */ - IF((st_ivas->ivas_format == MASA_FORMAT && st_ivas->hQMetaData != NULL) || (st_ivas->ivas_format == MASA_ISM_FORMAT)) - { - // Fix to float conversion starts here. - IF(st_ivas->hSpatParamRendCom != NULL) - { - FOR(Word16 i = 0; i < st_ivas->hSpatParamRendCom->dirac_md_buffer_length; i++) - { - FOR(Word16 j = 0; j < st_ivas->hSpatParamRendCom->num_freq_bands; j++) - { - st_ivas->hSpatParamRendCom->energy_ratio1[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->energy_ratio1_fx[i][j], 30); - st_ivas->hSpatParamRendCom->diffuseness_vector[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->diffuseness_vector_fx[i][j], 30); - IF(EQ_32(st_ivas->hQMetaData->no_directions, 2)) - { - st_ivas->hSpatParamRendCom->energy_ratio2[i][j] = fix_to_float(st_ivas->hSpatParamRendCom->energy_ratio2_fx[i][j], 30); - } - } - } - } - st_ivas->hMasa->data.dir_decode_quality = fix16_to_float(st_ivas->hMasa->data.dir_decode_quality_fx, Q14); - IF(st_ivas->hSpatParamRendCom != NULL) - { - FOR(Word16 i = 0; i < st_ivas->hSpatParamRendCom->numIsmDirections; i++) - { - FOR(Word16 block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++) - { - FOR(Word16 b = 0; b < st_ivas->hSpatParamRendCom->num_freq_bands; b++) - { - st_ivas->hMasaIsmData->energy_ratio_ism[i][block][b] = fix_to_float(st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][block][b], Q30); - } - } - } - } - } - IF(((st_ivas->mc_mode == MC_MODE_PARAMUPMIX) || (st_ivas->mc_mode == MC_MODE_MCT) || st_ivas->ivas_format == SBA_ISM_FORMAT || (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT) || st_ivas->mc_mode == MC_MODE_PARAMMC) && (GT_16(st_ivas->nCPE, 1))) { FOR(cpe_id = 0; cpe_id < nCPE; cpe_id++) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 0b9a5447d..037435a67 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -104,9 +104,10 @@ typedef struct parambin_rend_config_data MC_MODE mc_mode; int32_t ivas_total_brate; int16_t nchan_transport; +#ifndef IVAS_FLOAT_FIXED float qualityBasedSmFactor; -#ifdef IVAS_FLOAT_FIXED - Word32 qualityBasedSmFactor_fx; +#else + Word32 qualityBasedSmFactor_fx; /* Q31 */ #endif int16_t processReverb; ISM_MODE ism_mode; @@ -158,16 +159,16 @@ static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float #ifdef IVAS_FLOAT_FIXED static void hrtfShGetHrtf_fx( const Word16 bin, const Word16 aziDeg, const Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 useCachedValue ); -#endif +#else static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t useCachedValue ); - +#endif #ifdef IVAS_FLOAT_FIXED static void getDirectPartGains_fx( const Word16 bin, Word16 aziDeg, Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, const UWord8 renderStereoOutputInsteadOfBinaural, Word32 Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 isHeadtracked ); -#endif +#else static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t isHeadtracked ); - +#endif static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); @@ -1184,10 +1185,6 @@ static void ivas_dirac_dec_binaural_internal( q_cldfb[ind][ind2] = q_input; } } - IF(st_ivas->hMasa) - { - st_ivas->hMasa->data.dir_decode_quality_fx = float_to_fix16(st_ivas->hMasa->data.dir_decode_quality, 14); - } #endif DIRAC_DEC_BIN_HANDLE hDiracDecBin; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -1216,8 +1213,7 @@ static void ivas_dirac_dec_binaural_internal( move32(); config_data.nchan_transport = st_ivas->nchan_transport; move16(); - config_data.qualityBasedSmFactor = st_ivas->hMasa != NULL ? st_ivas->hMasa->data.dir_decode_quality : 1.0f; - config_data.qualityBasedSmFactor_fx = st_ivas->hMasa != NULL ? L_shl_sat(st_ivas->hMasa->data.dir_decode_quality_fx, 17) : ONE_IN_Q31; + config_data.qualityBasedSmFactor_fx = st_ivas->hMasa != NULL ? L_deposit_h( st_ivas->hMasa->data.dir_decode_quality_fx ) : ONE_IN_Q31; move32(); config_data.processReverb = st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; move16(); @@ -1442,21 +1438,6 @@ static void ivas_dirac_dec_binaural_internal( f2me( hDiracDecBin->ChEneOutPrev[i][j], &hDiracDecBin->ChEneOutPrev_fx[i][j], &hDiracDecBin->ChEneOutPrev_e[i][j] ); } } - FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - IF( hSpatParamRendCom->energy_ratio1 ) - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[i], hSpatParamRendCom->energy_ratio1_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); - IF( hSpatParamRendCom->energy_ratio2 ) - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[i], hSpatParamRendCom->energy_ratio2_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); - } - IF( st_ivas->hMasaIsmData ) - FOR( i = 0; i < 4; i++ ) - { - FOR( j = 0; j < 6; j++ ) - { - floatToFixed_arrL32( st_ivas->hMasaIsmData->energy_ratio_ism[i][j], st_ivas->hMasaIsmData->energy_ratio_ism_fx[i][j], Q30, 60 ); - } - } floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, 31, hSpatParamRendCom->num_freq_bands ); IF( hDiracDecBin->hDiffuseDist ) { @@ -3059,9 +3040,22 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin->processMtxRePrev[chA][chB + 2][bin] = hDiracDecBin->processMtxRe[chA][chB + 2][bin]; hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; } +#ifdef IVAS_FLOAT_FIXED + Word32 Rmat_fx[3][3], lRealp_fx, lImagp_fx, rRealp_fx, rImagp_fx; + for ( int p = 0; p < 3; p++ ) + { + floatToFixed_arrL( Rmat[p], Rmat_fx[p], Q30, 3 ); + } - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); + getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[chB], isHeadtracked ); + lRealp = fixedToFloat_32( lRealp_fx, Q28 ); + lImagp = fixedToFloat_32( lImagp_fx, Q28 ); + rRealp = fixedToFloat_32( rRealp_fx, Q28 ); + rImagp = fixedToFloat_32( rImagp_fx, Q28 ); +#else + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); +#endif hDiracDecBin->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; hDiracDecBin->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; hDiracDecBin->processMtxRe[1][chB + 2][bin] = rRealp * gainFactor; @@ -4732,7 +4726,7 @@ static void getDirectPartGains_fx( return; } -#endif +#else static void getDirectPartGains( const int16_t bin, @@ -4806,7 +4800,7 @@ static void getDirectPartGains( return; } - +#endif #ifdef IVAS_FLOAT_FIXED static void hrtfShGetHrtf_fx( @@ -4865,7 +4859,7 @@ static void hrtfShGetHrtf_fx( return; } -#endif +#else static void hrtfShGetHrtf( const int16_t bin, @@ -4920,7 +4914,7 @@ static void hrtfShGetHrtf( return; } - +#endif /*------------------------------------------------------------------------- * configure_reqularization_factor() @@ -5784,13 +5778,6 @@ static void ivas_masa_ext_rend_parambin_internal( f2me( hDiracDecBin->ChEneOutPrev[i][j], &hDiracDecBin->ChEneOutPrev_fx[i][j], &hDiracDecBin->ChEneOutPrev_e[i][j] ); } } - FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - IF( hSpatParamRendCom->energy_ratio1 ) - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[i], hSpatParamRendCom->energy_ratio1_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); - IF( hSpatParamRendCom->energy_ratio2 ) - floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[i], hSpatParamRendCom->energy_ratio2_fx[i], Q30, hSpatParamRendCom->num_freq_bands ); - } floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, 31, hSpatParamRendCom->num_freq_bands ); IF( hDiracDecBin->hDiffuseDist ) { @@ -5825,7 +5812,6 @@ static void ivas_masa_ext_rend_parambin_internal( move32(); config_data.nchan_transport = hMasaExtRend->nchan_input; move16(); - config_data.qualityBasedSmFactor = 1.0f; config_data.qualityBasedSmFactor_fx = ONE_IN_Q31; move32(); config_data.processReverb = hMasaExtRend->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ? 1 : 0; diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 3210d47e7..accca0e5b 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -187,174 +187,132 @@ ivas_error ivas_dirac_allocate_parameters( #else ivas_error ivas_dirac_allocate_parameters_fx( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common data for spatial parametric rendering */ - const Word16 params_flag /* i : set of parameters flag */ + const Word16 params_flag /* i : set of parameters flag */ ) { Word16 i; - IF ( params_flag == 1 ) + IF( EQ_16( params_flag, 1 ) ) { - IF ( ( hSpatParamRendCom->azimuth = ( Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->azimuth = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->elevation = ( Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->elevation = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->diffuseness_vector = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->diffuseness_vector_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - - IF ( ( hSpatParamRendCom->energy_ratio1 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - -#ifdef IVAS_FLOAT_FIXED - IF ( ( hSpatParamRendCom->diffuseness_vector_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->energy_ratio1_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->energy_ratio1_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - IF ( ( hSpatParamRendCom->spreadCoherence_fx = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->spreadCoherence_fx = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->surroundingCoherence_fx = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->surroundingCoherence_fx = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#endif - FOR ( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) + FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) { - IF ( ( hSpatParamRendCom->azimuth[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof(Word16) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( hSpatParamRendCom->azimuth[i], 0, hSpatParamRendCom->num_freq_bands ); - - IF ( ( hSpatParamRendCom->elevation[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof(Word16) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_s( hSpatParamRendCom->elevation[i], 0, hSpatParamRendCom->num_freq_bands ); - - IF ( ( hSpatParamRendCom->diffuseness_vector[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + IF( ( hSpatParamRendCom->azimuth[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hSpatParamRendCom->diffuseness_vector[i], 1.0f, hSpatParamRendCom->num_freq_bands ); + set16_fx( hSpatParamRendCom->azimuth[i], 0, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->energy_ratio1[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + IF( ( hSpatParamRendCom->elevation[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_f( hSpatParamRendCom->energy_ratio1[i], 0.0f, hSpatParamRendCom->num_freq_bands ); + set16_fx( hSpatParamRendCom->elevation[i], 0, hSpatParamRendCom->num_freq_bands ); -#ifdef IVAS_FLOAT_FIXED - IF ( ( hSpatParamRendCom->diffuseness_vector_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + IF( ( hSpatParamRendCom->diffuseness_vector_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set32_fx( hSpatParamRendCom->diffuseness_vector_fx[i], ONE_IN_Q30, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->energy_ratio1_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + IF( ( hSpatParamRendCom->energy_ratio1_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set32_fx( hSpatParamRendCom->energy_ratio1_fx[i], 0, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->spreadCoherence_fx[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) + IF( ( hSpatParamRendCom->spreadCoherence_fx[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set16_fx( hSpatParamRendCom->spreadCoherence_fx[i], 0, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->surroundingCoherence_fx[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) + IF( ( hSpatParamRendCom->surroundingCoherence_fx[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set16_fx( hSpatParamRendCom->surroundingCoherence_fx[i], 0, hSpatParamRendCom->num_freq_bands ); -#endif } } - ELSE IF ( params_flag == 2 ) + ELSE IF( EQ_16( params_flag, 2 ) ) { - IF ( ( hSpatParamRendCom->azimuth2 = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof(Word16 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->azimuth2 = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->elevation2 = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof(Word16 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->elevation2 = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->energy_ratio2 = (float **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->energy_ratio2_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - IF ( ( hSpatParamRendCom->energy_ratio2_fx = (Word32 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word32 * ) ) ) == NULL ) + IF( ( hSpatParamRendCom->spreadCoherence2_fx = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - IF ( ( hSpatParamRendCom->spreadCoherence2_fx = (Word16 **) malloc( hSpatParamRendCom->dirac_md_buffer_length * sizeof( Word16 * ) ) ) == NULL ) + FOR( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } -#endif - - FOR ( i = 0; i < hSpatParamRendCom->dirac_md_buffer_length; i++ ) - { - IF ( ( hSpatParamRendCom->azimuth2[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof(Word16) ) ) == NULL ) + IF( ( hSpatParamRendCom->azimuth2[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_s( hSpatParamRendCom->azimuth2[i], 0, hSpatParamRendCom->num_freq_bands ); + set16_fx( hSpatParamRendCom->azimuth2[i], 0, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->elevation2[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof(Word16) ) ) == NULL ) + IF( ( hSpatParamRendCom->elevation2[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - set_s( hSpatParamRendCom->elevation2[i], 0, hSpatParamRendCom->num_freq_bands ); + set16_fx( hSpatParamRendCom->elevation2[i], 0, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->energy_ratio2[i] = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hSpatParamRendCom->energy_ratio2[i], 0.0f, hSpatParamRendCom->num_freq_bands ); - -#ifdef IVAS_FLOAT_FIXED - IF ( ( hSpatParamRendCom->energy_ratio2_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + IF( ( hSpatParamRendCom->energy_ratio2_fx[i] = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set32_fx( hSpatParamRendCom->energy_ratio2_fx[i], 0, hSpatParamRendCom->num_freq_bands ); - IF ( ( hSpatParamRendCom->spreadCoherence2_fx[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) + IF( ( hSpatParamRendCom->spreadCoherence2_fx[i] = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set16_fx( hSpatParamRendCom->spreadCoherence2_fx[i], 0, hSpatParamRendCom->num_freq_bands ); -#endif } } return IVAS_ERR_OK; } - #endif @@ -507,8 +465,6 @@ ivas_error ivas_spat_hSpatParamRendCom_config_fx( hSpatParamRendCom->elevation2 = NULL; hSpatParamRendCom->energy_ratio2_fx = NULL; hSpatParamRendCom->spreadCoherence2_fx = NULL; - /*TODO: to remove float*/ - hSpatParamRendCom->energy_ratio2 = NULL; } } @@ -981,20 +937,6 @@ void ivas_dirac_deallocate_parameters_fx( hSpatParamRendCom->elevation = NULL; } - if (hSpatParamRendCom->energy_ratio1 != NULL) - { - for (i = 0; i < md_buffer_length; i++) - { - if (hSpatParamRendCom->energy_ratio1[i] != NULL) - { - free(hSpatParamRendCom->energy_ratio1[i]); - hSpatParamRendCom->energy_ratio1[i] = NULL; - } - } - free(hSpatParamRendCom->energy_ratio1); - hSpatParamRendCom->energy_ratio1 = NULL; - } - if (hSpatParamRendCom->energy_ratio1_fx != NULL) { for (i = 0; i < md_buffer_length; i++) @@ -1009,21 +951,6 @@ void ivas_dirac_deallocate_parameters_fx( hSpatParamRendCom->energy_ratio1_fx = NULL; } - if (hSpatParamRendCom->diffuseness_vector != NULL) - { - for (i = 0; i < md_buffer_length; i++) - { - if (hSpatParamRendCom->diffuseness_vector[i] != NULL) - { - free(hSpatParamRendCom->diffuseness_vector[i]); - hSpatParamRendCom->diffuseness_vector[i] = NULL; - } - } - - free(hSpatParamRendCom->diffuseness_vector); - hSpatParamRendCom->diffuseness_vector = NULL; - } - if (hSpatParamRendCom->diffuseness_vector_fx != NULL) { for (i = 0; i < md_buffer_length; i++) @@ -1097,20 +1024,6 @@ void ivas_dirac_deallocate_parameters_fx( hSpatParamRendCom->elevation2 = NULL; } - if (hSpatParamRendCom->energy_ratio2 != NULL) - { - for (i = 0; i < md_buffer_length; i++) - { - if (hSpatParamRendCom->energy_ratio2[i] != NULL) - { - free(hSpatParamRendCom->energy_ratio2[i]); - hSpatParamRendCom->energy_ratio2[i] = NULL; - } - } - free(hSpatParamRendCom->energy_ratio2); - hSpatParamRendCom->energy_ratio2 = NULL; - } - if (hSpatParamRendCom->energy_ratio2_fx != NULL) { for (i = 0; i < md_buffer_length; i++) @@ -4532,10 +4445,6 @@ void ivas_masa_init_stereotype_detection_fx( stereo_type_detect->subtract_power_y_smooth = 0.0f; stereo_type_detect->target_power_y_smooth = 0.0f; - stereo_type_detect->lr_total_bb_ratio_db = 0.0f; - stereo_type_detect->lr_total_hi_ratio_db = 0.0f; - stereo_type_detect->min_sum_total_ratio_db = 0.0f; - stereo_type_detect->subtract_target_ratio_db = 0.0f; /*--------------------------------------------*/ stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index a37504cb9..e205df6e0 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -64,8 +64,6 @@ static void TDREND_Clear_Update_flags_fx( #endif // IVAS_FLOAT_FIXED -static void angles_to_vec( const float radius, const float azimuth, const float elevation, float *vec ); - #ifdef IVAS_FLOAT_FIXED static void angles_to_vec_fx( const Word16 radius, /* i : radius */ @@ -73,6 +71,8 @@ static void angles_to_vec_fx( const Word32 elevation, /* i : Elevation angle */ Word32 *vec /* o : Pos/Dir vector */ ); +#else +static void angles_to_vec(const float radius, const float azimuth, const float elevation, float *vec); #endif /*---------------------------------------------------------------------* @@ -584,7 +584,7 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( { enableCombinedOrientation = hCombinedOrientationData->enableCombinedOrientation; Quaternions = hCombinedOrientationData->Quaternions; - Pos = hCombinedOrientationData->listenerPos; + Pos = hCombinedOrientationData->listenerPos; move16(); } FOR(ch = 0; ch < BINAURAL_CHANNELS; ch++) @@ -592,23 +592,23 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( p_reverb_signal_fx[ch] = reverb_signal_fx[ch]; } - subframe_length = output_frame / num_subframes; + subframe_length = idiv1616(output_frame, num_subframes); - c_indx = 0; + c_indx = 0; move16(); FOR(nS = 0; nS < num_src; nS++) { IF(!(ivas_format == MC_FORMAT && nS == lfe_idx)) /* Skip LFE for MC */ { hBinRendererTd->Sources[c_indx]->InputFrame_p_fx = output_fx[nS]; - hBinRendererTd->Sources[c_indx]->InputFrame_p_q = Q7; - hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; + hBinRendererTd->Sources[c_indx]->InputFrame_p_q = Q11; move16(); + hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; move16(); c_indx = add(c_indx, 1); } } FOR(subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++) { - IF(subframe_idx == ism_md_subframe_update) + IF(EQ_16(subframe_idx, ism_md_subframe_update)) { /* Update object position(s) */ IF((error = TDREND_Update_object_positions_fx(hBinRendererTd, num_src, ivas_format, hIsmMetaData)) != IVAS_ERR_OK) @@ -619,11 +619,7 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( /* Update the listener's location/orientation */ Word16 tmp_headRotEnabled; - - tmp_headRotEnabled = 0; - move16(); - - + tmp_headRotEnabled = 0; move16(); IF(enableCombinedOrientation != NULL) { tmp_headRotEnabled = enableCombinedOrientation[hCombinedOrientationData->subframe_idx]; @@ -637,51 +633,26 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( IF(hReverb != NULL) { - Word16 i, j; - Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; - Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; - Word32 *pcm_out_fx[BINAURAL_CHANNELS]; - Word16 nchan_transport = audioCfg2channels(transport_config); - //exp = Q7; - move16(); - FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - pcm_in_fx[i] = pcm_in_buff[i]; - } - FOR(i = 0; i < nchan_transport; i++) - { - - FOR(j = 0; j < ((subframe_idx + 1) * hReverb->full_block_size); j++) - { + Word16 i; - pcm_in_fx[i][j] = output_fx[i][j]; - } - } - FOR(i = 0; i < BINAURAL_CHANNELS; i++) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - pcm_out_fx[i] = pcm_out_buff[i]; + Scale_sig32(output_fx[i], L_FRAME48k, -4); } - FOR(i = 0; i < BINAURAL_CHANNELS; i++) - { - FOR(j = 0; j < (hReverb->full_block_size); j++) - { - pcm_out_fx[i][j] = p_reverb_signal_fx[i][j]; - } - } - IF((error = ivas_reverb_process_fx(hReverb, transport_config, 0, pcm_in_fx, pcm_out_fx, subframe_idx)) != IVAS_ERR_OK) + IF((error = ivas_reverb_process_fx(hReverb, transport_config, 0, output_fx, p_reverb_signal_fx, subframe_idx)) != IVAS_ERR_OK) { return error; } - FOR(i = 0; i < BINAURAL_CHANNELS; i++) - { - FOR(j = 0; j < (hReverb->full_block_size); j++) - { + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + Scale_sig32(output_fx[i], L_FRAME48k, 4); + } - p_reverb_signal_fx[i][subframe_idx * hReverb->full_block_size + j] = L_shl(pcm_out_fx[i][subframe_idx * hReverb->full_block_size + j], 2); - } + FOR( i = 0; i < BINAURAL_CHANNELS; ++i ) + { + Scale_sig32(p_reverb_signal_fx[i] + subframe_idx * hReverb->full_block_size, hReverb->full_block_size, 2); } } @@ -693,8 +664,7 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( /* Advance subframe pointer */ - c_indx = 0; - move16(); + c_indx = 0; move16(); FOR(nS = 0; nS < num_src; nS++) { IF(!(ivas_format == MC_FORMAT && nS == lfe_idx)) /* Skip LFE for MC */ @@ -794,10 +764,27 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( subframe_idx == ism_md_subframe_update ) { /* Update object position(s) */ +#ifdef IVAS_FLOAT_FIXED + FOR( Word16 i = 0; i < num_src; i++ ) + { + FOR( int j = 0; j < 3; j++ ) + { + IF( ivas_format == ISM_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == SBA_ISM_FORMAT ) + hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j] = L_shr( hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j], hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p - Q25 ); + } + IF( ivas_format == ISM_FORMAT || ivas_format == MASA_ISM_FORMAT || ivas_format == SBA_ISM_FORMAT ) + hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p = 25; + } + IF ( ( error = TDREND_Update_object_positions_fx( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK ) { return error; } +#endif // IVAS_FLOAT_FIXED } /* Update the listener's location/orientation */ @@ -908,9 +895,8 @@ ivas_error ivas_td_binaural_renderer_unwrap( { FOR( int j = 0; j < 3; j++ ) { - hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j] = float_to_fix( hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p[j], Q25 ); - //hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j] = L_shr( hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j], hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p - Q25 ); + hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j] = L_shr( hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx[j], hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p - Q25 ); } hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p = 25; } @@ -1184,6 +1170,10 @@ ivas_error TDREND_Update_object_positions_fx( angles_to_vec_fx( hIsmMetaData[nS]->radius_fx /*Q9*/, hIsmMetaData[nS]->azimuth_fx, hIsmMetaData[nS]->elevation_fx, Pos_fx ); angles_to_vec_fx( ONE_IN_Q14, hIsmMetaData[nS]->yaw_fx, hIsmMetaData[nS]->pitch_fx, Dir_fx ); + DirAtten_p->ConeInnerAngle_fx = DEG_360_IN_Q22; + DirAtten_p->ConeOuterAngle_fx = DEG_360_IN_Q22; + DirAtten_p->ConeOuterGain_fx = ONE_IN_Q30; + IF ( ( error = TDREND_MIX_SRC_SetPos_fx( hBinRendererTd, nS, Pos_fx ) ) != IVAS_ERR_OK ) { return error; @@ -1222,8 +1212,7 @@ ivas_error TDREND_Update_object_positions_fx( return IVAS_ERR_OK; } -#endif - +#else /*---------------------------------------------------------------------* * TDREND_Update_object_positions() * @@ -1297,6 +1286,7 @@ ivas_error TDREND_Update_object_positions( return IVAS_ERR_OK; } +#endif /*---------------------------------------------------------------------* * TDREND_Update_listener_orientation() @@ -1571,7 +1561,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( const Word32 output_Fs, /* i : output sampling rate */ const Word16 output_frame, /* i : output frame length */ Word32 output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - Word16 exp + Word16 *exp ) { ISM_METADATA_FRAME hIsmMetaDataFrame; @@ -1582,35 +1572,24 @@ ivas_error ivas_td_binaural_renderer_ext_fx( IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; ivas_error error; -#if 1 - float *p_output[MAX_OUTPUT_CHANNELS]; - float output_fl[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word16 ch,j; - /*This intermediate conversion will be removed once the subfunctions are also converted to fixed*/ - for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) - { - for ( j = 0; j < L_FRAME48k ;j++) - { - output_fl[ch][j] = (float)output[ch][j]/(1<azimuth_fx = currentPos->azimuth_fx; - hIsmMetaData[0]->elevation_fx = currentPos->elevation_fx; -#endif // IVAS_FLOAT_FIXED - hIsmMetaData[0]->azimuth = currentPos->azimuth; - hIsmMetaData[0]->elevation = currentPos->elevation; - hIsmMetaData[0]->yaw = currentPos->yaw; - hIsmMetaData[0]->pitch = currentPos->pitch; - hIsmMetaData[0]->radius = currentPos->radius; - hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; + ivas_format = ISM_FORMAT;move16(); + num_src = 1; move16(); + transport_config = IVAS_AUDIO_CONFIG_ISM1; move16(); + hIsmMetaData[0] = &hIsmMetaDataFrame; move16(); + hIsmMetaData[0]->azimuth_fx = currentPos->azimuth_fx; move32(); + hIsmMetaData[0]->elevation_fx = currentPos->elevation_fx; move32(); + hIsmMetaData[0]->yaw_fx = currentPos->yaw_fx; move32(); + hIsmMetaData[0]->pitch_fx = currentPos->pitch_fx; move32(); + hIsmMetaData[0]->radius_fx = currentPos->radius_fx; move32(); + hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; move16(); } -#ifdef IVAS_FLOAT_FIXED_S - //Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 *p_output_fx[MAX_OUTPUT_CHANNELS]; - FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - Scale_sig32(output[i], Q7 - (31 - exp), L_FRAME48k); - p_output_fx[i] = output[i]; - } - - Word16 subframe_length; Word16 num_subframes = (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); - subframe_length = output_frame / num_subframes; - -#if 1 - for ( Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) + for (Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++) { - Word16 idx = subframe_idx; + Word16 idx = subframe_idx; + Word16 pos_q = Q25; + IF((*hCombinedOrientationData)->listenerPos != NULL) + { + (*hCombinedOrientationData)->listenerPos[idx].x_fx = L_shr((*hCombinedOrientationData)->listenerPos[idx].x_fx, (*hCombinedOrientationData)->listenerPos[idx].q_fact - pos_q); + (*hCombinedOrientationData)->listenerPos[idx].y_fx = L_shr((*hCombinedOrientationData)->listenerPos[idx].y_fx, (*hCombinedOrientationData)->listenerPos[idx].q_fact - pos_q); + (*hCombinedOrientationData)->listenerPos[idx].z_fx = L_shr((*hCombinedOrientationData)->listenerPos[idx].z_fx, (*hCombinedOrientationData)->listenerPos[idx].q_fact - pos_q); + (*hCombinedOrientationData)->listenerPos[idx].q_fact = pos_q; + } + FOR(int i = 0; i < 3; i++) + { + pTDRend->hBinRendererTd->Listener_p->Pos_fx[i] = L_shr(pTDRend->hBinRendererTd->Listener_p->Pos_fx[i], pTDRend->hBinRendererTd->Listener_p->Pos_q - pos_q); + pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; move16(); + } + } - IF( ( *hCombinedOrientationData )->Quaternions ) - { - float max_val = 0; - max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].w ) ); - max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].x ) ); - max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].y ) ); - max_val = (float) max( max_val, fabs( ( *hCombinedOrientationData )->Quaternions[idx].z ) ); - Word16 quat_q = Q_factor_L( max_val ); - ( *hCombinedOrientationData )->Quaternions[idx].w_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].w, quat_q ); - ( *hCombinedOrientationData )->Quaternions[idx].x_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].x, quat_q ); - ( *hCombinedOrientationData )->Quaternions[idx].y_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].y, quat_q ); - ( *hCombinedOrientationData )->Quaternions[idx].z_fx = float_to_fix( ( *hCombinedOrientationData )->Quaternions[idx].z, quat_q ); - } - Word16 pos_q = Q25; - IF((*hCombinedOrientationData)->listenerPos != NULL) - { - (*hCombinedOrientationData)->listenerPos[idx].x_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].x, pos_q); - (*hCombinedOrientationData)->listenerPos[idx].y_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].y, pos_q); - (*hCombinedOrientationData)->listenerPos[idx].z_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].z, pos_q); - } - FOR(int i = 0; i < 3; i++) - { - pTDRend->hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Front[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Up_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Up[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Right_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Right[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; - pTDRend->hBinRendererTd->Listener_p->Pos_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Pos[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); - } - } -#endif - if ((error = ivas_td_binaural_renderer_unwrap_fx(hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, - ism_md_subframe_update_ext, p_output_fx, output_frame, (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs))) != IVAS_ERR_OK) + IF ((error = ivas_td_binaural_renderer_unwrap_fx(hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, + ism_md_subframe_update_ext, p_output_fx, output_frame, (Word16)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs))) != IVAS_ERR_OK) { return error; } - -#if 1 - for (int i = 0; i < 3; i++) - { - pTDRend->hBinRendererTd->Listener_p->Front[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Front_fx[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Up[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Up_fx[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Right[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Right_fx[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Pos[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Pos_fx[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); - } - + +#if 0 //TO-BE-REMOVED for (Word16 subframe_idx = 0; subframe_idx < (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); subframe_idx++) { - if (subframe_idx == ism_md_subframe_update_ext) + if (subframe_idx == ism_md_subframe_update_ext) + { + Word16 i = 0; + FOR(Word16 ns = 0; ns < num_src; ns++) { - FOR(Word16 ns = 0; ns < num_src - 1; ns++) - { - fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p, Q30, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); - fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p, Q25, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); - } + if(ns != lfe_idx){ + fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[i]->SrcSpatial_p->Front_p_fx, pTDRend->hBinRendererTd->Sources[i]->SrcSpatial_p->Front_p, Q30, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p_fx, pTDRend->hBinRendererTd->Sources[i]->SrcSpatial_p->Pos_p, pTDRend->hBinRendererTd->Sources[i]->SrcSpatial_p->q_Pos_p, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); + + i = add(i, 1); + } } + } } - exp = 31 - Q7; #endif - -#if 0 - FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) + IF(hReverb != NULL) { - fixedToFloat_arrL(output_fx[i], output[i], Q7, L_FRAME48k); + *exp = sub(*exp, 2); } -#endif -#else - if ((error = ivas_td_binaural_renderer_unwrap(hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, - ism_md_subframe_update_ext, p_output, output_frame, (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs))) != IVAS_ERR_OK) - { - return error; - } -#if 1 - IF(hReverb != NULL) - { - exp = sub(exp, 2); - } - /*This intermediate conversion will be removed once the subfunctions are also converted to fixed*/ - for (ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) - { - for (j = 0; j < L_FRAME48k; j++) - { - output[ch][j] = (Word32)(output_fl[ch][j] * (1 << (exp))); - } - } -#endif -#endif pop_wmops(); return IVAS_ERR_OK; } -#endif +#else /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_ext() * @@ -1783,6 +1701,7 @@ ivas_error ivas_td_binaural_renderer_ext( IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; ivas_error error; + float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) @@ -1827,98 +1746,18 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0]->radius = currentPos->radius; hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; } -#ifdef IVAS_FLOAT_FIXED_s - Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - Word32 *p_output_fx[MAX_OUTPUT_CHANNELS]; - FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - floatToFixed_arrL(output[i], output_fx[i], Q7, L_FRAME48k); - p_output_fx[i] = output_fx[i]; - } - - Word16 subframe_length; - Word16 num_subframes = (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); - subframe_length = output_frame / num_subframes; - -#if 1 - for (Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++) - { - Word16 idx = subframe_idx; - - IF((*hCombinedOrientationData)->Quaternions) { - float max_val = 0; - max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].w)); - max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].x)); - max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].y)); - max_val = (float)max(max_val, fabs((*hCombinedOrientationData)->Quaternions[idx].z)); - Word16 quat_q = Q_factor_L(max_val); - (*hCombinedOrientationData)->Quaternions[idx].w_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].w, quat_q); - (*hCombinedOrientationData)->Quaternions[idx].x_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].x, quat_q); - (*hCombinedOrientationData)->Quaternions[idx].y_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].y, quat_q); - (*hCombinedOrientationData)->Quaternions[idx].z_fx = float_to_fix((*hCombinedOrientationData)->Quaternions[idx].z, quat_q); - } - Word16 pos_q = Q25; - - IF((*hCombinedOrientationData)->listenerPos != NULL) - { - (*hCombinedOrientationData)->listenerPos[idx].x_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].x, pos_q); - (*hCombinedOrientationData)->listenerPos[idx].y_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].y, pos_q); - (*hCombinedOrientationData)->listenerPos[idx].z_fx = (Word32)float_to_fix((*hCombinedOrientationData)->listenerPos[idx].z, pos_q); - } - FOR(int i = 0; i < 3; i++) - { - pTDRend->hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Front[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Up_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Up[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Right_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Right[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; - pTDRend->hBinRendererTd->Listener_p->Pos_fx[i] = float_to_fix(pTDRend->hBinRendererTd->Listener_p->Pos[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); - } - } -#endif - if ((error = ivas_td_binaural_renderer_unwrap_fx(hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, - ism_md_subframe_update_ext, p_output_fx, output_frame, (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs))) != IVAS_ERR_OK) - { - return error; - } - -#if 1 - for (int i = 0; i < 3; i++) - { - pTDRend->hBinRendererTd->Listener_p->Front[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Front_fx[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Up[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Up_fx[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Right[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Right_fx[i], Q30); - pTDRend->hBinRendererTd->Listener_p->Pos[i] = fix_to_float(pTDRend->hBinRendererTd->Listener_p->Pos_fx[i], pTDRend->hBinRendererTd->Listener_p->Pos_q); - } - for (Word16 subframe_idx = 0; subframe_idx < (int16_t)((output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs); subframe_idx++) - { - if (subframe_idx == ism_md_subframe_update_ext) - { - FOR(Word16 ns = 0; ns < num_src; ns++) - { - fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p, Q30, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); - fixedToFloat_arrL(pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p_fx, pTDRend->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p, Q25, 3 * SPAT_BIN_MAX_INPUT_CHANNELS); - } - } - } - FOR(Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++) - { - fixedToFloat_arrL(output_fx[i], output[i], Q7, L_FRAME48k); - } -#endif -#else if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, ism_md_subframe_update_ext, p_output, output_frame, (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ) ) ) != IVAS_ERR_OK ) { return error; } -#endif pop_wmops(); return IVAS_ERR_OK; } - +#endif /*---------------------------------------------------------------------* * angles_to_vec() @@ -1941,7 +1780,7 @@ static void angles_to_vec_fx( vec[2] = L_mult( radius, getSineWord16R2( elevation_fx ) ); return; } -#endif // IVAS_FLOAT_FIXED +#else static void angles_to_vec( const float radius, /* i : radius */ @@ -1956,3 +1795,4 @@ static void angles_to_vec( return; } +#endif // IVAS_FLOAT_FIXED \ No newline at end of file diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 298a45c4d..fac68039a 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -75,7 +75,7 @@ ivas_error TDREND_MIX_SRC_SetPos_fx( const Word16 SrcInd, /* i : Source index */ const Word32 *Vec_p /* i : Position vector */ ) -{ + { TDREND_SRC_SPATIAL_t *SrcSpatial_p; IF(GT_16(SrcInd, hBinRendererTd->MaxSrcInd)) @@ -85,7 +85,10 @@ ivas_error TDREND_MIX_SRC_SetPos_fx( ELSE { SrcSpatial_p = hBinRendererTd->Sources[SrcInd]->SrcSpatial_p; - + SrcSpatial_p->Pos_p_fx[0] = L_shr(SrcSpatial_p->Pos_p_fx[0], SrcSpatial_p->q_Pos_p - Q25); + SrcSpatial_p->Pos_p_fx[1] = L_shr(SrcSpatial_p->Pos_p_fx[1], SrcSpatial_p->q_Pos_p - Q25); + SrcSpatial_p->Pos_p_fx[2] = L_shr(SrcSpatial_p->Pos_p_fx[2], SrcSpatial_p->q_Pos_p - Q25); + SrcSpatial_p->q_Pos_p = Q25; IF(NE_32(SrcSpatial_p->Pos_p_fx[0] , Vec_p[0]) || NE_32(SrcSpatial_p->Pos_p_fx[1] , Vec_p[1]) || NE_32(SrcSpatial_p->Pos_p_fx[2] , Vec_p[2])) { Copy32(Vec_p, SrcSpatial_p->Pos_p_fx, 3); @@ -96,7 +99,7 @@ ivas_error TDREND_MIX_SRC_SetPos_fx( return IVAS_ERR_OK; } -#endif +#else ivas_error TDREND_MIX_SRC_SetPos( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const int16_t SrcInd, /* i : Source index */ @@ -122,6 +125,7 @@ ivas_error TDREND_MIX_SRC_SetPos( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* @@ -156,8 +160,7 @@ ivas_error TDREND_MIX_SRC_SetDir_fx( } return IVAS_ERR_OK; } -#endif // IVAS_FLOAT_FIXED - +#else ivas_error TDREND_MIX_SRC_SetDir( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ const int16_t SrcInd, /* i : Source index */ @@ -184,6 +187,7 @@ ivas_error TDREND_MIX_SRC_SetDir( return IVAS_ERR_OK; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 59657b592..c9a125cae 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1206,7 +1206,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( const Word32 output_Fs, /* i : output sampling rate */ const Word16 output_frame, /* i : output frame length */ Word32 output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - Word16 exp + Word16 *exp ); ivas_error ivas_td_binaural_open_unwrap_fx( diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 4bae85cf6..f699b4416 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -218,14 +218,15 @@ typedef struct ivas_spatial_parametric_rend_common_data_structure int16_t **azimuth2; int16_t **elevation2; +#ifndef IVAS_FLOAT_FIXED float **diffuseness_vector; float **energy_ratio1; float **energy_ratio2; -#ifdef IVAS_FLOAT_FIXED +#else Word32 **diffuseness_vector_fx; Word16 q_diffuseness_vector; - Word32 **energy_ratio1_fx; - Word32 **energy_ratio2_fx; + Word32 **energy_ratio1_fx; /* Q30 */ + Word32 **energy_ratio2_fx; /* Q30 */ #endif #ifndef IVAS_FLOAT_FIXED @@ -506,10 +507,17 @@ typedef struct float subtract_power_y_smooth; float target_power_y_smooth; +#ifndef IVAS_FLOAT_FIXED float lr_total_bb_ratio_db; float lr_total_hi_ratio_db; float min_sum_total_ratio_db; float subtract_target_ratio_db; +#else + Word32 lr_total_bb_ratio_db_fx; /* Q21 */ + Word32 lr_total_hi_ratio_db_fx; /* Q21 */ + Word32 min_sum_total_ratio_db_fx; /* Q21 */ + Word32 subtract_target_ratio_db_fx; /* Q21 */ +#endif #ifdef IVAS_FLOAT_FIXED Word32 left_bb_power_fx; @@ -538,11 +546,6 @@ typedef struct Word16 q_subtract_power_y; Word16 q_subtract_power_y_smooth; Word16 q_target_power_y_smooth; - - Word32 lr_total_bb_ratio_db_fx; - Word32 lr_total_hi_ratio_db_fx; - Word32 min_sum_total_ratio_db_fx; - Word32 subtract_target_ratio_db_fx; // Q21 #endif int16_t counter; @@ -1834,8 +1837,10 @@ typedef struct { int16_t Updated; TDREND_PosType_t PosType; +#ifndef IVAS_FLOAT_FIXED float Pos_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; float Front_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; +#endif #ifdef IVAS_FLOAT_FIXED Word32 Pos_p_fx[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; // Q25 Word16 q_Pos_p; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 92088eed9..09c3f0b80 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -162,7 +162,9 @@ typedef struct #endif pan_vector prev_pan_gains; int8_t firstFrameRendered; +#ifndef IVAS_FLOAT_FIXED float *bufferData; +#endif Word32 *bufferData_fx; Word16 nonDiegeticPan; float nonDiegeticPanGain; @@ -239,7 +241,9 @@ typedef struct Word32 nonDiegeticPanGain_fx; lfe_routing lfeRouting; Word32 *bufferData_fx; +#ifndef IVAS_FLOAT_FIXED float *bufferData; +#endif int16_t binauralDelaySmp; #ifndef IVAS_FLOAT_FIXED float nonDiegeticPanGain; @@ -281,7 +285,9 @@ typedef struct CREND_WRAPPER_HANDLE crendWrapper; rotation_gains rot_gains_prev; rotation_gains_fx rot_gains_prev_fx; +#ifndef IVAS_FLOAT_FIXED float *bufferData; +#endif Word32 *bufferData_fx; DIRAC_ANA_HANDLE hDirAC; } input_sba; @@ -2261,11 +2267,11 @@ static bool isIoConfigPairSupported( static ivas_error initIsmMasaRendering( input_ism *inputIsm, - const int32_t inSampleRate ) + const Word32 inSampleRate ) { ivas_error error; - if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) + IF ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { #ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); @@ -2279,7 +2285,7 @@ static ivas_error initIsmMasaRendering( ivas_reverb_close( &inputIsm->hReverb ); - if ( ( error = ivas_omasa_ana_open( &inputIsm->hOMasa, inSampleRate, inputIsm->total_num_objects ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_omasa_ana_open( &inputIsm->hOMasa, inSampleRate, inputIsm->total_num_objects ) ) != IVAS_ERR_OK ) { return error; } @@ -2288,6 +2294,104 @@ static ivas_error initIsmMasaRendering( } +#ifdef IVAS_FLOAT_FIXED +static ivas_error setRendInputActiveIsm( + void *input, + const AUDIO_CONFIG inConfig, + const IVAS_REND_InputId id, + RENDER_CONFIG_DATA *hRendCfg ) +{ + ivas_error error; + rendering_context rendCtx; + AUDIO_CONFIG outConfig; + input_ism *inputIsm; + + inputIsm = (input_ism *) input; + rendCtx = inputIsm->base.ctx; + outConfig = *rendCtx.pOutConfig; + + IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + + IF ( ( error = allocateInputBaseBufferData_fx( &inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } + initRendInputBase_fx( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ); + + inputIsm->firstFrameRendered = FALSE; + + inputIsm->currentPos = defaultObjectPosition(); + inputIsm->previousPos = defaultObjectPosition(); + inputIsm->crendWrapper = NULL; + inputIsm->hReverb = NULL; + inputIsm->tdRendWrapper = defaultTdRendWrapper(); + + initRotMatrix_fx( inputIsm->rot_mat_prev ); + + set_zero_fx( inputIsm->prev_pan_gains_fx, MAX_OUTPUT_CHANNELS ); + + inputIsm->hOMasa = NULL; + + error = IVAS_ERR_OK; + + IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) ) + { + IF ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_MASA1) || EQ_16(outConfig , IVAS_AUDIO_CONFIG_MASA2) ) + { + IF ( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; + IF( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + { + return error; + } + + Word16 nchan_rend = num_src; + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend--; /* Skip LFE channel -- added to the others */ + } + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) + { + IF( Src_p->SrcSpatial_p != NULL ) + { + Src_p->SrcSpatial_p->q_Pos_p = Q31; + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + SrcSpatial_p->q_Pos_p = Q31; + } + } + + IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) ) + { + IF ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + return IVAS_ERR_OK; +} +#else static ivas_error setRendInputActiveIsm( void *input, const AUDIO_CONFIG inConfig, @@ -2312,7 +2416,9 @@ static ivas_error setRendInputActiveIsm( { return error; } +#if 0 initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); +#endif #ifdef IVAS_FLOAT_FIXED if ( ( error = allocateInputBaseBufferData_fx( &inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { @@ -2419,7 +2525,37 @@ static ivas_error setRendInputActiveIsm( return IVAS_ERR_OK; } +#endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED +static void clearInputIsm( + input_ism *inputIsm ) +{ + rendering_context rendCtx; + + rendCtx = inputIsm->base.ctx; + + freeInputBaseBufferData_fx( &inputIsm->base.inputBuffer.data_fx ); + + initRendInputBase_fx( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); + + /* Free input's internal handles */ + ivas_rend_closeCrend( &inputIsm->crendWrapper ); + + ivas_reverb_close( &inputIsm->hReverb ); + + if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) + { + ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); + inputIsm->tdRendWrapper.hHrtfTD = NULL; + } + + + ivas_omasa_ana_close( &( inputIsm->hOMasa ) ); + + return; +} +#else static void clearInputIsm( input_ism *inputIsm ) { @@ -2454,6 +2590,7 @@ static void clearInputIsm( return; } +#endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED static void copyLsConversionMatrixToPanMatrix_fx( @@ -3848,15 +3985,10 @@ static ivas_error initMcBinauralRendering( { IF( Src_p->SrcSpatial_p != NULL ) { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); - } + Src_p->SrcSpatial_p->q_Pos_p = 31; } TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); + SrcSpatial_p->q_Pos_p = 31; } } #else @@ -4322,11 +4454,6 @@ static ivas_error setRendInputActiveMc( { return error; } - IF( ( error = allocateInputBaseBufferData( &inputMc->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } - initRendInputBase( &inputMc->base, inConfig, id, rendCtx, inputMc->bufferData, MAX_BUFFER_LENGTH ); IF( ( error = allocateInputBaseBufferData_fx( &inputMc->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { @@ -4449,7 +4576,9 @@ static void clearInputMc( rendCtx = inputMc->base.ctx; freeMcLfeDelayBuffer_fx( &inputMc->lfeDelayBuffer_fx ); freeInputBaseBufferData_fx( &inputMc->bufferData_fx ); +#if 0 initRendInputBase( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); +#endif initRendInputBase_fx( &inputMc->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ @@ -5161,7 +5290,7 @@ ivas_error IVAS_REND_Open( const Word32 outputSampleRate, const AUDIO_CONFIG outConfig, const Word16 nonDiegeticPan, - const float nonDiegeticPanGain, + const Word32 nonDiegeticPanGain,/*Q31*/ const Word16 num_subframes ) { Word16 i; @@ -5186,7 +5315,7 @@ ivas_error IVAS_REND_Open( } *phIvasRend = (IVAS_REND_HANDLE) malloc( sizeof( struct IVAS_REND ) ); - if ( *phIvasRend == NULL ) + IF ( *phIvasRend == NULL ) { return IVAS_ERR_FAILED_ALLOC; } @@ -5206,7 +5335,7 @@ ivas_error IVAS_REND_Open( return error; } - if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -5218,77 +5347,69 @@ ivas_error IVAS_REND_Open( } /* Initialize external orientation data */ - if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) { return error; } /* Initilize combined orientation data */ - if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) { return error; } /* Initialize EFAP */ - if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + IF ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) { return error; } /* Initialize inputs */ - for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) + FOR ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); -#ifdef IVAS_FLOAT_FIXED initRendInputBase_fx( &hIvasRend->inputsIsm[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); -#endif hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; +#if 0 hIvasRend->inputsIsm[i].bufferData = NULL; +#endif hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; -#ifndef IVAS_FLOAT_FIXED - hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; -#else - hIvasRend->inputsIsm[i].nonDiegeticPanGain_fx = floatToFixed_32( nonDiegeticPanGain, Q31 ); -#endif // !IVAS_FLOAT_FIXED + hIvasRend->inputsIsm[i].nonDiegeticPanGain_fx = nonDiegeticPanGain; hIvasRend->inputsIsm[i].hOMasa = NULL; -#ifdef IVAS_FLOAT_FIXED hIvasRend->inputsIsm[i].bufferData_fx = NULL; -#endif } - for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) + FOR ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + initRendInputBase_fx( &hIvasRend->inputsMc[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; hIvasRend->inputsMc[i].crendWrapper = NULL; hIvasRend->inputsMc[i].hReverb = NULL; hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; +#if 0 hIvasRend->inputsMc[i].bufferData = NULL; +#endif hIvasRend->inputsMc[i].bufferData_fx = NULL; hIvasRend->inputsMc[i].lfeDelayBuffer_fx = NULL; hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; -#ifndef IVAS_FLOAT_FIXED - hIvasRend->inputsMc[i].lfeDelayBuffer = NULL; - hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; -#endif - Word32 temp = ( abs( (Word32) nonDiegeticPanGain ) ); - hIvasRend->inputsMc[i].nonDiegeticPanGain_fx = ( temp == 1 ) ? ( ( nonDiegeticPanGain < 0 ) ? L_negate( ONE_IN_Q31 ) : ONE_IN_Q31 ) : (Word32) ( nonDiegeticPanGain * ( ONE_IN_Q31 ) ); + hIvasRend->inputsMc[i].nonDiegeticPanGain_fx = nonDiegeticPanGain; hIvasRend->inputsMc[i].hMcMasa = NULL; } - for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) + FOR ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); + initRendInputBase_fx( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsSba[i].crendWrapper = NULL; +#if 0 hIvasRend->inputsSba[i].bufferData = NULL; +#endif hIvasRend->inputsSba[i].bufferData_fx = NULL; hIvasRend->inputsSba[i].hDirAC = NULL; } - for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) + FOR ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); @@ -8828,32 +8949,49 @@ static ivas_error rotateFrameSba( #endif - #ifdef IVAS_FLOAT_FIXED static ivas_error renderIsmToBinaural( - const input_ism *ismInput, + input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) { Word32 tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; Word16 ism_md_subframe_update_ext; - + Word16 i; + Word16 exp = *outAudio.pq_fact; push_wmops( "renderIsmToBinaural" ); /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*To be cleaned up later*/ copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpTDRendBuffer ); +#if 1 + ismInput->currentPos.azimuth_fx = floatToFixed(ismInput->currentPos.azimuth, Q22); + ismInput->currentPos.elevation_fx = floatToFixed(ismInput->currentPos.elevation, Q22); + ismInput->currentPos.spread_fx = floatToFixed(ismInput->currentPos.spread, Q22); + ismInput->currentPos.yaw_fx = floatToFixed(ismInput->currentPos.yaw, Q22); + ismInput->currentPos.pitch_fx = floatToFixed(ismInput->currentPos.pitch, Q22); + ismInput->currentPos.radius_fx = float_to_fix16(ismInput->currentPos.radius, Q9); +#endif + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + Scale_sig32(tmpTDRendBuffer[i], L_FRAME48k, sub(11, exp)); + } IF ( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, - *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ,*outAudio.pq_fact) ) != IVAS_ERR_OK ) + *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer , &exp) ) != IVAS_ERR_OK ) { return error; } + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + Scale_sig32(tmpTDRendBuffer[i], L_FRAME48k, -sub(11, exp)); + } + IF( ismInput->hReverb != NULL ) { - FOR ( int i = 0; i < outAudio.config.numChannels; i++ ) + FOR ( i = 0; i < outAudio.config.numChannels; i++ ) { - FOR ( int j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) + FOR ( Word16 j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) tmpTDRendBuffer[i][j] = L_shl( tmpTDRendBuffer[i][j], 2 ); } } @@ -8865,7 +9003,7 @@ static ivas_error renderIsmToBinaural( } #else static ivas_error renderIsmToBinaural( - const input_ism *ismInput, + input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) { float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -8876,7 +9014,14 @@ static ivas_error renderIsmToBinaural( /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer ); - +#ifdef IVAS_FLOAT_FIXED + ismInput->currentPos.azimuth_fx = float_to_fix(ismInput->currentPos.azimuth, Q22); + ismInput->currentPos.elevation_fx = float_to_fix(ismInput->currentPos.elevation, Q22); + ismInput->currentPos.spread_fx = float_to_fix(ismInput->currentPos.spread, Q22); + ismInput->currentPos.yaw_fx = float_to_fix(ismInput->currentPos.yaw, Q22); + ismInput->currentPos.pitch_fx = float_to_fix(ismInput->currentPos.pitch, Q22); + ismInput->currentPos.radius_fx = float_to_fix(ismInput->currentPos.radius, Q9); +#endif if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { @@ -8889,7 +9034,6 @@ static ivas_error renderIsmToBinaural( return IVAS_ERR_OK; } - #endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED @@ -9268,7 +9412,6 @@ static ivas_error renderIsmToBinauralRoom( return IVAS_ERR_OK; } #endif - #ifdef IVAS_FLOAT_FIXED static ivas_error renderIsmToBinauralReverb( input_ism *ismInput, @@ -9276,7 +9419,8 @@ static ivas_error renderIsmToBinauralReverb( { Word32 tmpRendBuffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; - Word16 ism_md_subframe_update_ext; + Word16 ism_md_subframe_update_ext, i; + Word16 exp = *outAudio.pq_fact; push_wmops( "renderIsmToBinauralRoom" ); @@ -9284,17 +9428,34 @@ static ivas_error renderIsmToBinauralReverb( ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*ism_metadata_delay_ms :To be replaced later*/ copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpRendBuffer_fx ); +#if 1 + ismInput->currentPos.azimuth_fx = floatToFixed(ismInput->currentPos.azimuth, Q22); + ismInput->currentPos.elevation_fx = floatToFixed(ismInput->currentPos.elevation, Q22); + ismInput->currentPos.spread_fx = floatToFixed(ismInput->currentPos.spread, Q22); + ismInput->currentPos.yaw_fx = floatToFixed(ismInput->currentPos.yaw, Q22); + ismInput->currentPos.pitch_fx = floatToFixed(ismInput->currentPos.pitch, Q22); + ismInput->currentPos.radius_fx = float_to_fix16(ismInput->currentPos.radius, Q9); +#endif + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + Scale_sig32(tmpRendBuffer_fx[i], L_FRAME48k, sub(11, exp)); + } - IF ( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx , *outAudio.pq_fact) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx , &exp) ) != IVAS_ERR_OK ) { return error; } + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + Scale_sig32(tmpRendBuffer_fx[i], L_FRAME48k, -sub(11, exp)); + } + IF( ismInput->hReverb != NULL ) { - FOR ( int i = 0; i < outAudio.config.numChannels; i++ ) + FOR ( i = 0; i < outAudio.config.numChannels; i++ ) { - FOR ( int j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) + FOR ( Word16 j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) tmpRendBuffer_fx[i][j] = L_shl( tmpRendBuffer_fx[i][j], 2 ); } } @@ -9732,7 +9893,7 @@ static ivas_error renderInputIsm( { ivas_error error; IVAS_REND_AudioBuffer inAudio; - Word16 exp = 8; + Word16 exp = *outAudio.pq_fact; move16(); error = IVAS_ERR_OK; @@ -9747,34 +9908,31 @@ static ivas_error renderInputIsm( /* Apply input gain to new audio */ v_multc_fixed( inAudio.data_fx, ismInput->base.gain_fx, inAudio.data_fx, imult1616(inAudio.config.numSamplesPerChannel , inAudio.config.numChannels) ); + *outAudio.pq_fact -= 1; + exp = *outAudio.pq_fact; /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *ismInput->base.ctx.pCombinedOrientationData ); - scale_sig32( ismInput->base.inputBuffer.data_fx, imult1616( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ), 1 ); SWITCH ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: error = renderIsmToMc( ismInput, outAudio ); - exp = Q8; BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: error = renderIsmToSba( ismInput, outConfig, outAudio ); - exp = Q8; BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: error = renderIsmToBinaural( ismInput, outAudio ); - exp = *outAudio.pq_fact; BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: error = renderIsmToBinauralRoom( ismInput, outAudio, &exp ); BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: error = renderIsmToBinauralReverb( ismInput, outAudio ); - exp = *outAudio.pq_fact; BREAK; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -9953,7 +10111,7 @@ static ivas_error renderActiveInputsIsm( Word16 i; input_ism *pCurrentInput; ivas_error error; - Word16 input_q = *outAudio.pq_fact; + Word16 input_q = Q8; for ( i = 0, pCurrentInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pCurrentInput ) { IF ( pCurrentInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) @@ -9962,21 +10120,18 @@ static ivas_error renderActiveInputsIsm( continue; } + *outAudio.pq_fact = Q8; if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; } FOR(Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) { - outAudio.data_fx[j] = L_shl( outAudio.data_fx[j], sub( input_q , ( *outAudio.pq_fact ) ) ); + outAudio.data_fx[j] = L_shl( outAudio.data_fx[j], sub( sub(input_q,1) , ( *outAudio.pq_fact ) ) ); } - *outAudio.pq_fact = input_q; + *outAudio.pq_fact = sub(input_q,1); } - FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) - { - outAudio.data_fx[j] = L_shr( outAudio.data_fx[j], 1); - } -#if 1/*To be removed later when dependency on data is removed*/ +#if 0/*To be removed later when dependency on data is removed*/ FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) { outAudio.data[j] = fixedToFloat( outAudio.data_fx[j], input_q - 1 ); @@ -10197,16 +10352,19 @@ static ivas_error renderMcToBinaural( { copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer_fx ); + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + Scale_sig32(tmpRendBuffer_fx[i], L_FRAME48k, sub(11, exp)); + } IF( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, - 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer_fx, *outAudio.pq_fact ) ) != IVAS_ERR_OK ) + 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ) != IVAS_ERR_OK ) { return error; } - IF( mcInput->hReverb != NULL ) + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - exp = sub( *outAudio.pq_fact, 2 ); - move16(); + Scale_sig32(tmpRendBuffer_fx[i], L_FRAME48k, -sub(11, exp)); } } ELSE @@ -10399,16 +10557,22 @@ static ivas_error renderMcToBinauralRoom( { copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer ); + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) + { + Scale_sig32(tmpRendBuffer[i], L_FRAME48k, sub(11, exp)); + } + IF( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, - 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer, *outAudio.pq_fact ) ) != IVAS_ERR_OK ) + 0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer, &exp ) ) != IVAS_ERR_OK ) { return error; } - IF( mcInput->hReverb != NULL ) + + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - exp = sub( *outAudio.pq_fact, 2 ); - move16(); + Scale_sig32(tmpRendBuffer[i], L_FRAME48k, -sub(11, exp)); } + //*outAudio.pq_fact = exp; } ELSE { @@ -11003,6 +11167,7 @@ static ivas_error renderActiveInputsMc( CONTINUE; } + *outAudio.pq_fact = Q8; IF( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -11635,6 +11800,7 @@ static ivas_error renderActiveInputsSba( /* Skip inactive inputs */ CONTINUE; } + *outAudio.pq_fact = Q8; IF( ( error = renderInputSba( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -11668,63 +11834,53 @@ static ivas_error renderActiveInputsSba( return IVAS_ERR_OK; } #endif + + #ifdef IVAS_FLOAT_FIXED static void copyMasaMetadataToDiracRenderer_fx( MASA_METADATA_FRAME *meta, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, - const int16_t maxBin ) + const Word16 maxBin ) { Word16 band, sf, bin; Word16 meta_write_index; - hSpatParamRendCom->numParametricDirections = meta->descriptive_meta.numberOfDirections + 1; - hSpatParamRendCom->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; + hSpatParamRendCom->numParametricDirections = add( meta->descriptive_meta.numberOfDirections, 1 ); + hSpatParamRendCom->numSimultaneousDirections = add( meta->descriptive_meta.numberOfDirections, 1 ); FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { - meta_write_index = ( hSpatParamRendCom->dirac_bs_md_write_idx + sf ) % hSpatParamRendCom->dirac_md_buffer_length; + meta_write_index = add( hSpatParamRendCom->dirac_bs_md_write_idx, sf ) % hSpatParamRendCom->dirac_md_buffer_length; FOR( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) { FOR( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1] && bin < maxBin; bin++ ) { - // hSpatParamRendCom->azimuth[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[0].azimuth_fx[sf][band], Q22 ); - // hSpatParamRendCom->elevation[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[0].elevation_fx[sf][band], Q22 ); + hSpatParamRendCom->azimuth[meta_write_index][bin] = (Word16) meta->directional_meta[0].azimuth[sf][band]; + move16(); + hSpatParamRendCom->elevation[meta_write_index][bin] = (Word16) meta->directional_meta[0].elevation[sf][band]; + move16(); hSpatParamRendCom->energy_ratio1_fx[meta_write_index][bin] = meta->directional_meta[0].energy_ratio_fx[sf][band]; + move32(); hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] = L_sub( ONE_IN_Q30, meta->directional_meta[0].energy_ratio_fx[sf][band] ); + move32(); hSpatParamRendCom->spreadCoherence_fx[meta_write_index][bin] = meta->directional_meta[0].spread_coherence_fx[sf][band]; + move16(); hSpatParamRendCom->surroundingCoherence_fx[meta_write_index][bin] = meta->common_meta.surround_coherence_fx[sf][band]; -#if 0 // Tobe removed after masa the path is complete - hSpatParamRendCom->energy_ratio1[meta_write_index][bin] = (float) hSpatParamRendCom->energy_ratio1_fx[meta_write_index][bin] / ONE_IN_Q30; - hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = (float) hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] / ONE_IN_Q30; - hSpatParamRendCom->spreadCoherence[meta_write_index][bin] = (float) hSpatParamRendCom->spreadCoherence_fx[meta_write_index][bin] / ONE_IN_Q15; - hSpatParamRendCom->surroundingCoherence[meta_write_index][bin] = (float) hSpatParamRendCom->surroundingCoherence_fx[meta_write_index][bin] / ONE_IN_Q15; -#else - hSpatParamRendCom->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; - hSpatParamRendCom->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; - hSpatParamRendCom->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; - hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; - -#endif + move16(); - IF( hSpatParamRendCom->numSimultaneousDirections == 2 ) + IF( EQ_16( hSpatParamRendCom->numSimultaneousDirections, 2 ) ) { - // hSpatParamRendCom->azimuth2[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[1].azimuth_fx[sf][band], Q22 ); - // hSpatParamRendCom->elevation2[meta_write_index][bin] = (Word16) L_shr( meta->directional_meta[1].elevation[sf][band], Q22 ); + hSpatParamRendCom->azimuth2[meta_write_index][bin] = (Word16) meta->directional_meta[1].azimuth[sf][band]; + move16(); + hSpatParamRendCom->elevation2[meta_write_index][bin] = (Word16) meta->directional_meta[1].elevation[sf][band]; + move16(); hSpatParamRendCom->energy_ratio2_fx[meta_write_index][bin] = meta->directional_meta[1].energy_ratio_fx[sf][band]; + move32(); hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] = L_sub( hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin], meta->directional_meta[1].energy_ratio_fx[sf][band] ); + move32(); hSpatParamRendCom->spreadCoherence2_fx[meta_write_index][bin] = meta->directional_meta[1].spread_coherence_fx[sf][band]; -#if 0 // Tobe removed after the masa path is complete - hSpatParamRendCom->energy_ratio2[meta_write_index][bin] = (float) hSpatParamRendCom->energy_ratio2_fx[meta_write_index][bin] / ONE_IN_Q30; - hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] = (float) hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][bin] / ONE_IN_Q30; - hSpatParamRendCom->spreadCoherence2[meta_write_index][bin] = (float) hSpatParamRendCom->spreadCoherence2_fx[meta_write_index][bin] / ONE_IN_Q15; -#else - hSpatParamRendCom->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; - hSpatParamRendCom->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; - hSpatParamRendCom->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; - hSpatParamRendCom->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; - -#endif + move16(); } } } @@ -11778,6 +11934,8 @@ static void copyMasaMetadataToDiracRenderer( return; } #endif + + #ifdef IVAS_FLOAT_FIXED static void renderMasaToMasa( input_masa *masaInput, @@ -12215,6 +12373,9 @@ static ivas_error renderActiveInputsMasa( continue; } +#ifdef IVAS_FLOAT_FIXED + *outAudio.pq_fact = Q8; +#endif // IVAS_FLOAT_FIXED if ( ( error = renderInputMasa( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -12746,7 +12907,7 @@ static ivas_error getSamplesInternal( return error; } - IF( NE_32( hIvasRend->inputsSba[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) || NE_32( hIvasRend->inputsMc[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + IF( NE_32( hIvasRend->inputsSba[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) || NE_32( hIvasRend->inputsMc[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )|| NE_32( hIvasRend->inputsIsm[0].base.inConfig, IVAS_AUDIO_CONFIG_INVALID )) { #ifndef DISABLE_LIMITER Word32 limiter_thresold = L_lshl( IVAS_LIMITER_THRESHOLD, *outAudio.pq_fact ); @@ -13315,10 +13476,10 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - hDirACRend->proto_frame_f = NULL; #if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ - hDirACRend->proto_frame_f_fx = NULL; + hDirACRend->proto_frame_f = NULL; #endif + hDirACRend->proto_frame_f_fx = NULL; } ELSE { @@ -13340,7 +13501,6 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( hDirACRend->buffer_energy = NULL; #endif hDirACRend->buffer_energy_fx = NULL; - FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) @@ -14519,24 +14679,11 @@ static void intermidiate_ext_dirac_render( floatToFixed_arrL(output_f_flt[i], output_f[i], q_cldfb, L_FRAME48k); } - for(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++){ - for ( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) - { - hSpatParamRendCom->diffuseness_vector_fx[hSpatParamRendCom->render_to_md_map[slot_idx]][i] = floatToFixed( hSpatParamRendCom->diffuseness_vector[hSpatParamRendCom->render_to_md_map[slot_idx]][i], Q30 ); - } - } for(slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++){ IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) { - IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) - { - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); - } hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } else { @@ -14552,15 +14699,11 @@ static void intermidiate_ext_dirac_render( { hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } ELSE IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) /*VBAP*/ { hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } } @@ -14568,8 +14711,6 @@ static void intermidiate_ext_dirac_render( { hDirACRend->h_output_synthesis_psd_state.direct_responses_q = 30; floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_responses, hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, hDirACRend->h_output_synthesis_psd_state.direct_responses_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio1[slot_idx], hSpatParamRendCom->energy_ratio1_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hSpatParamRendCom->energy_ratio2[slot_idx], hSpatParamRendCom->energy_ratio2_fx[slot_idx], Q30, hSpatParamRendCom->num_freq_bands ); } } } @@ -14616,18 +14757,6 @@ static void intermidiate_ext_dirac_render( floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len ); } - IF( hDirACRend->masa_stereo_type_detect ) - { - IF( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db == -INFINITY ) - { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = MIN_32; - } - ELSE - { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db, Q21 ); - } - } - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); if ( hDirACRend->proto_signal_decorr_on == 1 ) { @@ -14764,8 +14893,6 @@ static void intermidiate_ext_dirac_render( fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len); IF( hDirACRend->masa_stereo_type_detect != NULL ) { - hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_target_ratio_db_fx, Q21 ); - hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 95a6dbfd5..3d6cac982 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -133,6 +133,16 @@ typedef enum _IVAS_REND_COMPLEXITY_LEVEL /* Functions to be called before rendering */ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_Open( + IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ + const Word32 outputSampleRate, /* i : output sampling rate */ + const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ + const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ + const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain */ + const Word16 num_subframes /* i : number of subframes */ +); +#else ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ const int32_t outputSampleRate, /* i : output sampling rate */ @@ -141,6 +151,7 @@ ivas_error IVAS_REND_Open( const float nonDiegeticPanGain, /* i : non-diegetic panning gain */ const int16_t num_subframes /* i : number of subframes */ ); +#endif // IVAS_FLOAT_FIXED /* Note: this will reset custom LFE routings set for any MC input */ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( @@ -253,6 +264,7 @@ ivas_error IVAS_REND_FeedInputAudio_fx( const IVAS_REND_InputId inputId, /* i : ID of the input */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio /* i : buffer with input audio */ ); + #endif ivas_error IVAS_REND_FeedInputObjectMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -- GitLab From f8b87bd4d3b06f359d69209a5d31f142f5ffa5d9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 08:16:31 +0200 Subject: [PATCH 083/101] make try-out part use the new version of script --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7f836b8c..b5968564e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -240,7 +240,9 @@ stages: - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv - - if [ $UPDATE_PAGES != "" ]; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi + # TODO change back to this - need to get new version from branch so that the project id argument is there + #- if [ $UPDATE_PAGES != "" ]; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi + - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi -- GitLab From 6c4525403ee26397b047134aaf3ed88e3b77873a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 08:20:12 +0200 Subject: [PATCH 084/101] select only few tests for faster testing --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5968564e..f708445fd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -235,14 +235,14 @@ stages: ### run pytest - exit_code=0 - - python3 -m pytest $TEST_SUITE -v -x --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? + - python3 -m pytest $TEST_SUITE -v -k "stereo and MONO" --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv # TODO change back to this - need to get new version from branch so that the project id argument is there #- if [ $UPDATE_PAGES != "" ]; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi - - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi + - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID from variables - $CI_JOB_ID"; fi - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi -- GitLab From b80f0908b8c07a4b5dcfd49705a77f833a207fab Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 08:25:44 +0200 Subject: [PATCH 085/101] also shorten ref creation --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f708445fd..0962ab06d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -117,8 +117,8 @@ stages: - python3 tests/create_short_testvectors.py # create references - exit_code=0 - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests + - python3 -m pytest $TEST_SUITE -v -k "stereo and MONO" --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? + - python3 -m pytest $TEST_SUITE -v -k "stereo and MONO" --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests .update-scripts-repo: &update-scripts-repo -- GitLab From 51062e075445b0f50c61aecc16cb1575a10ac160 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 08:34:30 +0200 Subject: [PATCH 086/101] move deplot stage last --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0962ab06d..a9ee9f85a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,9 +74,9 @@ workflow: stages: - - deploy - build - test + - deploy # --------------------------------------------------------------- # Generic script anchors -- GitLab From a8e2fb3480e94157e795b8738f7fdca60a598a32 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 08:41:43 +0200 Subject: [PATCH 087/101] get mld file from prev job --- .gitlab-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a9ee9f85a..360a40613 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -242,7 +242,11 @@ stages: # TODO change back to this - need to get new version from branch so that the project id argument is there #- if [ $UPDATE_PAGES != "" ]; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi - - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID from variables - $CI_JOB_ID"; fi + - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; id_previous=$(python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID); echo "Job ID from variables - $CI_JOB_ID, Job ID from script: $id_previous"; fi + - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip + - unzip artifacts.zip -d previous_artifacts + - head mld.csv + - head previous_artifacts/mld.csv - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi -- GitLab From 0a457f8e84eaab39c9ab787432f4af4a2a959442 Mon Sep 17 00:00:00 2001 From: kiene Date: Mon, 27 May 2024 06:44:15 +0000 Subject: [PATCH 088/101] Fix .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 360a40613..129569b31 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -242,7 +242,7 @@ stages: # TODO change back to this - need to get new version from branch so that the project id argument is there #- if [ $UPDATE_PAGES != "" ]; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi - - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; id_previous=$(python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID); echo "Job ID from variables - $CI_JOB_ID, Job ID from script: $id_previous"; fi + - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; id_previous=$(python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID); echo "Job ID from variables - $CI_JOB_ID, Job ID from script - $id_previous"; fi - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip - unzip artifacts.zip -d previous_artifacts - head mld.csv -- GitLab From 1f50bfb3d2434f1cc607ba5b3cdb1c8ad163c844 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 08:55:38 +0200 Subject: [PATCH 089/101] create html page in mld job --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 129569b31..ee1e55425 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -245,8 +245,9 @@ stages: - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; id_previous=$(python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID); echo "Job ID from variables - $CI_JOB_ID, Job ID from script - $id_previous"; fi - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip - unzip artifacts.zip -d previous_artifacts - - head mld.csv - - head previous_artifacts/mld.csv + # This wildcard thingy relies on only one csv file being present per job + - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" + - python3 ci/basop-pages/create_report_pages.py index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi -- GitLab From af9f344159a8b34f2d918ce189347924beb19857 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 27 May 2024 13:59:42 +0530 Subject: [PATCH 090/101] High MLD fix for MASA, Float code cleanup [x] High MLD fix for MASA format in negative 10dB input case [x] Float code cleanup in ivas_init_dec.c, ivas_mc_dec_reconfig, ivas_dirac_dec_render_sf [x] Fix for LTV crash issue for 10dB case: stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on --- apps/decoder.c | 2 +- lib_com/float_to_fix_ops.c | 453 +--------- lib_com/ivas_prot_fx.h | 12 + lib_com/ivas_sba_config.c | 10 +- lib_com/prot_fx2.h | 4 - lib_dec/acelp_core_dec_ivas_fx.c | 76 +- lib_dec/core_dec_init_fx.c | 7 +- lib_dec/igf_dec_fx.c | 4 +- lib_dec/ivas_core_dec.c | 115 ++- lib_dec/ivas_corecoder_dec_reconfig.c | 2 +- lib_dec/ivas_cpe_dec_fx.c | 2 +- lib_dec/ivas_dirac_dec.c | 103 +-- lib_dec/ivas_init_dec.c | 903 ++++++++++++++----- lib_dec/ivas_jbm_dec.c | 43 - lib_dec/ivas_mc_paramupmix_dec.c | 14 - lib_dec/ivas_mct_dec.c | 682 ++------------ lib_dec/ivas_omasa_dec.c | 9 - lib_dec/ivas_osba_dec.c | 15 +- lib_dec/ivas_sba_dec.c | 8 - lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/ivas_stat_dec.h | 6 +- lib_dec/lib_dec_fx.c | 11 +- lib_dec/swb_tbe_dec.c | 14 +- lib_enc/ivas_lfe_enc.c | 3 + lib_rend/ivas_dirac_dec_binaural_functions.c | 8 +- lib_rend/ivas_dirac_decorr_dec.c | 30 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 8 +- lib_rend/ivas_dirac_rend.c | 37 +- lib_rend/ivas_hrtf.c | 18 +- lib_rend/ivas_prot_rend.h | 5 + lib_rend/ivas_rotation.c | 18 +- lib_rend/ivas_stat_rend.h | 61 +- lib_rend/lib_rend.c | 8 +- lib_util/hrtf_file_reader.c | 9 +- 34 files changed, 957 insertions(+), 1745 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 5c7bf1765..5c2c1e9ce 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -452,7 +452,7 @@ int main( { renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) ); renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) ); - renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( 1u << 15 ) ); + renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( (1u << 15)-1 ) ); } #endif // IVAS_FLOAT_FIXED diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 41d1d6b2f..cc820e04e 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -310,69 +310,21 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ); if ( reconf ) { - - //H_IGF_GRID hGrid; - //IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; - //hPrivateData = &st->hIGFDec->igfData; - //H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo; - //ACELP_config *pConfigAcelp = &( st->acelp_cfg ); - Word16 i = 0, - //Q_syn = 0,/* Q_synth_history = 0,*/ /*Q_fer_samples = 0,*/ - Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, - //Q_pst_old_syn = 0, - //delay_comp = 0; + Word16 Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, if ( tofix ) { - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; - //floatToFixed_arr( &hGrid->whiteningThreshold_flt[0][0], &hGrid->whiteningThreshold[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor = (Word16) floatToFixed( hGrid->gFactor_flt, 14 ); - //hGrid->fFactor = (Word16) floatToFixed( hGrid->fFactor_flt, 14 ); - //hGrid->lFactor = (Word16) floatToFixed( hGrid->lFactor_flt, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_TRAN]; - //floatToFixed_arr( &hGrid->whiteningThreshold_flt[0][0], &hGrid->whiteningThreshold[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor = (Word16) floatToFixed( hGrid->gFactor_flt, 14 ); - //hGrid->fFactor = (Word16) floatToFixed( hGrid->fFactor_flt, 14 ); - //hGrid->lFactor = (Word16) floatToFixed( hGrid->lFactor_flt, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_SHORT]; - //floatToFixed_arr( &hGrid->whiteningThreshold_flt[0][0], &hGrid->whiteningThreshold[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor = (Word16) floatToFixed( hGrid->gFactor_flt, 14 ); - //hGrid->fFactor = (Word16) floatToFixed( hGrid->fFactor_flt, 14 ); - //hGrid->lFactor = (Word16) floatToFixed( hGrid->lFactor_flt, 14 ); - //delay_comp = NS2SA_fx2( st->output_Fs, DELAY_CLDFB_NS ); /*CLDFB delay*/ - //st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); - //st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); IF( st->hTcxDec ) { - //st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; - //st->hTcxDec->Q_syn_Overl_TDAC = Q_factor_arr( st->hTcxDec->syn_Overl_TDAC_float, L_FRAME32k / 2 ) - 1; - //st->hTcxDec->Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, L_FRAME32k / 2 ) - 1; - //st->hTcxDec->Q_syn_Overl_TDACFB = Q_factor_arr( st->hTcxDec->syn_Overl_TDACFB_float, L_FRAME32k / 2 ); - //st->hTcxDec->Q_syn_OverlFB = Q_factor_arr( st->hTcxDec->syn_OverlFB_float, L_FRAME_MAX / 2 ); - //Q_old_synth = Q_syn; - //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); - //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 ); - //floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); - //floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX ); st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); - //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 ); st->output_frame_fx = st->hTcxDec->L_frameTCX; - //st->hTcxDec->CngLevelBackgroundTrace_bfi_fx = floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, 15 ); - //st->hTcxDec->conCngLevelBackgroundTrace = floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, 15 ); - //st->hTcxDec->conceal_eof_gain = (Word16) floatToFixed( st->hTcxDec->conceal_eof_gain_float, 14 ); } IF( st->hHQ_core ) { //st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k ); //st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k ); st->hHQ_core->Q_fer_samples = 0; - //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); - //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -394,76 +346,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; floatToFixed_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); } - - IF( st->hTcxLtpDec ) - { - //Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY ); - //Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k ); - //floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_in_float, st->hTcxLtpDec->tcxltp_mem_in, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY ); - //floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_out_float, st->hTcxLtpDec->tcxltp_mem_out, Q_tcxltp_mem_out, L_FRAME48k ); - } - - st->last_gain_syn_deemph = 0; - //IF( hBWE_TD ) - //{ - // Q_syn_overlap = Q_factor_arr( hBWE_TD->syn_overlap, 20 ); - // floatToFixed_arr( hBWE_TD->syn_overlap, hBWE_TD->syn_overlap_fx, Q_syn_overlap, 20 ); - //} } else { - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; - //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); - //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); - //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_TRAN]; - //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); - //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); - //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_SHORT]; - //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); - //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); - //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - //IF( st->hIGFDec ) - //{ - // //st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; - // //st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; - // //st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0]; - //} - //st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 ); - - //IF( st->hBWE_TD != NULL ) - //{ - // Q_syn_overlap = Q_factor_arr( hBWE_TD->syn_overlap, 20 ); - // fixedToFloat_arr( hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap, Q_syn_overlap, 20 ); - //} - IF( st->hTcxDec ) - { - //Q_old_synth = Q_syn; - //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); - //st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; - //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); - //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 ); - //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 ); - //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 ); - //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); - //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX ); - //st->hTcxDec->q_synth_history_fx = Q_synth_history; - //st->hTcxDec->conceal_eof_gain_float = fixedToFloat( st->hTcxDec->conceal_eof_gain, 14 ); - //st->hTcxDec->CngLevelBackgroundTrace_bfi = fixedToFloat( st->hTcxDec->CngLevelBackgroundTrace_bfi_fx, 15 ); - //st->hTcxDec->CngLevelBackgroundTrace_bfi = fix16_to_float( st->hTcxDec->conCngLevelBackgroundTrace,15-st->hTcxDec->conCngLevelBackgroundTrace_e ); - } - - IF( st->hHQ_core ) - { - //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k ); - //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); - } IF( st->cldfbAna ) { Q_cldfbAna_cldfb_state = Q_factor_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_length ) - 1; @@ -484,21 +370,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); } - - IF( st->hTcxLtpDec != NULL ) - { - //Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY ); - //Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k ); - //fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_in, st->hTcxLtpDec->tcxltp_mem_in_float, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY ); - //fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_out, st->hTcxLtpDec->tcxltp_mem_out_float, Q_tcxltp_mem_out, L_FRAME48k ); - } - IF( st->hTonalMDCTConc ) - { - FOR( i = 0; i < FDNS_NPTS; i++ ) - { - //st->hTonalMDCTConc->scaleFactorsBackground_flt[i] = fixedToFloat( st->hTonalMDCTConc->scaleFactorsBackground[i], 15 ); - } - } } } } @@ -509,390 +380,70 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( Word16 last_element_mode, const FRAME_MODE frameMode) { - TCX_LTP_DEC_HANDLE hTcxLtpDec = st->hTcxLtpDec; - TCX_DEC_HANDLE hTcxDec = st->hTcxDec; - Word16 i = 0; //bfi = 0; - UNUSED_PARAM(frameMode); - //IF(EQ_32(frameMode, FRAMEMODE_NORMAL)) - //{ - // bfi = 0; - //} - - //IF(EQ_32(frameMode, FRAMEMODE_MISSING)) - //{ - // bfi = 1; - //} bool reconf = ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || ( st->bwidth != st->last_bwidth ) || ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ); if ( reconf ) { - - //H_IGF_GRID hGrid; - //IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; - //hPrivateData = &st->hIGFDec->igfData; - //H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo; - //ACELP_config *pConfigAcelp = &( st->acelp_cfg ); - Word16 /*i = 0,*/ - /* Q_syn = 0,*/ /* Q_fer_samples = 0,*/ - Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, - //Q_pst_old_syn = 0, - //delay_comp = 0; + Word16 Q_cldfbSynHB_cldfb_state = 0;//, if ( tofix ) { - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; - //floatToFixed_arr( &hGrid->whiteningThreshold_flt[0][0], &hGrid->whiteningThreshold[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor = (Word16) floatToFixed( hGrid->gFactor_flt, 14 ); - //hGrid->fFactor = (Word16) floatToFixed( hGrid->fFactor_flt, 14 ); - //hGrid->lFactor = (Word16) floatToFixed( hGrid->lFactor_flt, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_TRAN]; - //floatToFixed_arr( &hGrid->whiteningThreshold_flt[0][0], &hGrid->whiteningThreshold[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor = (Word16) floatToFixed( hGrid->gFactor_flt, 14 ); - //hGrid->fFactor = (Word16) floatToFixed( hGrid->fFactor_flt, 14 ); - //hGrid->lFactor = (Word16) floatToFixed( hGrid->lFactor_flt, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_SHORT]; - //floatToFixed_arr( &hGrid->whiteningThreshold_flt[0][0], &hGrid->whiteningThreshold[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor = (Word16) floatToFixed( hGrid->gFactor_flt, 14 ); - //hGrid->fFactor = (Word16) floatToFixed( hGrid->fFactor_flt, 14 ); - //hGrid->lFactor = (Word16) floatToFixed( hGrid->lFactor_flt, 14 ); - //delay_comp = NS2SA_fx2( st->output_Fs, DELAY_CLDFB_NS ); /*CLDFB delay*/ - //st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); - //st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); - //Q_syn = 0; IF( st->hTcxDec ) { - //st->hTcxDec->Q_old_syn_Overl = 0; - //st->hTcxDec->Q_syn_Overl_TDAC = 0; - //st->hTcxDec->Q_syn_Overl = 0; - //st->hTcxDec->Q_syn_Overl_TDACFB = 0; - //st->hTcxDec->Q_syn_OverlFB = 0; - //Q_old_synth = 0; - //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 ); - //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 ); - //floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); - //floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX ); st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); - //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 ); st->output_frame_fx = st->hTcxDec->L_frameTCX; - //st->hTcxDec->CngLevelBackgroundTrace_bfi_fx = floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, 15 ); - //st->hTcxDec->conCngLevelBackgroundTrace = floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, 15 ); - //st->hTcxDec->conceal_eof_gain = (Word16) floatToFixed( st->hTcxDec->conceal_eof_gain_float, 14 ); } IF( st->hHQ_core ) { st->hHQ_core->Q_old_out = 0; st->hHQ_core->Q_old_outLB = 0; st->hHQ_core->Q_fer_samples = 0; - //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); - //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); - } - IF( st->cldfbAna ) - { - Q_cldfbAna_cldfb_state = Q_factor_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q_cldfbAna_cldfb_state, st->cldfbAna->cldfb_state_length ); - } - IF( st->cldfbBPF ) - { - Q_cldfbBPF_cldfb_state = Q_factor_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q_cldfbBPF_cldfb_state, st->cldfbBPF->cldfb_state_length ); - } - IF( st->cldfbSyn ) - { - Q_cldfbSyn_cldfb_state = Q_factor_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q_cldfbSyn_cldfb_state, st->cldfbSyn->cldfb_state_length ); } IF( st->cldfbSynHB ) { Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; floatToFixed_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); } - IF( st->hTcxLtpDec ) - { - //Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY ); - //Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k ); - //floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_in_float, st->hTcxLtpDec->tcxltp_mem_in, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY ); - //floatToFixed_arr( st->hTcxLtpDec->tcxltp_mem_out_float, st->hTcxLtpDec->tcxltp_mem_out, Q_tcxltp_mem_out, L_FRAME48k ); - } st->last_gain_syn_deemph = 0; - //IF( hBWE_TD ) - //{ - // Q_syn_overlap = Q_factor_arr( hBWE_TD->syn_overlap, 20 ); - // floatToFixed_arr( hBWE_TD->syn_overlap, hBWE_TD->syn_overlap_fx, Q_syn_overlap, 20 ); - //} } else { - //Q_syn = st->Q_syn; - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; - //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); - //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); - //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_TRAN]; - //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); - //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); - //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - //hGrid = &hIGFInfo->grid[IGF_GRID_LB_SHORT]; - //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); - //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); - //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); - //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - IF( st->hIGFDec ) - { - //st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; - //st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; - //st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0]; - } - //IF( st->hBWE_TD != NULL ) - //{ - // Q_syn_overlap = Q_factor_arr( hBWE_TD->syn_overlap, 20 ); - // fixedToFloat_arr( hBWE_TD->syn_overlap_fx, hBWE_TD->syn_overlap, Q_syn_overlap, 20 ); - //} IF( st->hTcxDec ) { - //Q_old_synth = Q_syn; - //st->hTcxDec->Q_old_syn_Overl = st->Q_syn + 1; - //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); - //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 ); - //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 ); - //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 ); - //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); - //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX ); - //st->hTcxDec->q_synth_history_fx = Q_synth_history; - //st->hTcxDec->conceal_eof_gain_float = fixedToFloat( st->hTcxDec->conceal_eof_gain, 14 ); st->hTcxDec->conCngLevelBackgroundTrace_e = 0; - //st->hTcxDec->CngLevelBackgroundTrace_bfi = fix16_to_float( st->hTcxDec->conCngLevelBackgroundTrace,15 - st->hTcxDec->conCngLevelBackgroundTrace_e); - //st->hTcxDec->CngLevelBackgroundTrace_bfi = fixedToFloat( st->hTcxDec->CngLevelBackgroundTrace_bfi_fx, 15 ); - //st->hTcxDec->conCngLevelBackgroundTrace = (Word16) st->hTcxDec->CngLevelBackgroundTrace_bfi_fx; st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; st->hTcxDec->conLastFrameLevel = st->hTcxDec->LastFrameLevel_bfi_fx; - //st->hTcxDec->conLastFrameLevel_e = 0; - } - - IF( st->hHQ_core ) - { - //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k ); - //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); - } - IF( st->cldfbAna ) - { - Q_cldfbAna_cldfb_state = Q_factor_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q_cldfbAna_cldfb_state, st->cldfbAna->cldfb_state_length ); - } - IF( st->cldfbBPF ) - { - Q_cldfbBPF_cldfb_state = Q_factor_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q_cldfbBPF_cldfb_state, st->cldfbBPF->cldfb_state_length ); - } - IF( st->cldfbSyn ) - { - Q_cldfbSyn_cldfb_state = Q_factor_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q_cldfbSyn_cldfb_state, st->cldfbSyn->cldfb_state_length ); } IF( st->cldfbSynHB ) { Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); } - - IF( st->hTcxLtpDec != NULL ) - { - //Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY ); - //Q_tcxltp_mem_out = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_out_float, L_FRAME48k ); - //fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_in, st->hTcxLtpDec->tcxltp_mem_in_float, Q_tcxltp_mem_in, TCXLTP_MAX_DELAY ); - //fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_out, st->hTcxLtpDec->tcxltp_mem_out_float, Q_tcxltp_mem_out, L_FRAME48k ); - } - IF( st->hTonalMDCTConc ) - { - FOR( i = 0; i < FDNS_NPTS; i++ ) - { - //st->hTonalMDCTConc->scaleFactorsBackground_flt[i] = fixedToFloat( st->hTonalMDCTConc->scaleFactorsBackground[i], 15 ); - } - } } } if ( tofix ) { - /*==========*/ - for ( int p = 0; p < hTcxDec->old_synth_len; p++ ) - { - //hTcxDec->old_synth[p] = (Word16) ( hTcxDec->old_synth_float[p] ); - } - for ( int p = 0; p < hTcxDec->old_synth_lenFB; p++ ) - { - //hTcxDec->old_synthFB_fx[p] = (Word16) ( hTcxDec->old_synthFB[p] ); - } - - //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 ); - //if ( st->hTonalMDCTConc != NULL ) - //{ - // floatToFixed_arr( st->hTonalMDCTConc->secondLastPcmOut_float, st->hTonalMDCTConc->secondLastPcmOut, 0, st->hTonalMDCTConc->nSamples ); - //} - st->Q_syn = 0; - - //for ( int p = 0; p < st->L_frame; p++ ) - //{ - // st->hTcxDec->old_excFB_fx[p] = (Word16) ( st->hTcxDec->old_excFB[p] * ( 1u << st->Q_exc ) ); - //} st->prev_Q_syn = st->Q_syn; - //st->hTcxDec->conceal_eof_gain = (Word16) floatToFixed( st->hTcxDec->conceal_eof_gain_float, Q14 ); - //st->hTcxDec->conCngLevelBackgroundTrace = (Word16) floatToFixed( st->hTcxDec->CngLevelBackgroundTrace_bfi, Q15 - st->hTcxDec->conCngLevelBackgroundTrace_e ); - //if ( st->hTcxDec->conNoiseLevelMemory_e[0] < 0 ) - //{ - // set16_fx( st->hTcxDec->conNoiseLevelMemory_e, 0, PLC_MIN_STAT_BUFF_SIZE ); - //} st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - if ( hTcxLtpDec->tcxltp ) - { - //hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( hTcxDec->tcxltp_last_gain_unmodified_float, Q15 ); - } - - //floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); - - //if ( !st->tcxonly ) - //{ - // floatToFixed_arr( st->p_bpf_noise_buf_float, st->p_bpf_noise_buf, 0, L_FRAME_16k ); - //} st->mem_error = st->hBPF->pst_mem_deemp_err_fx; - - if ( st->hFdCngDec != NULL && ( st->sr_core == INT_FS_12k8 || st->sr_core == INT_FS_16k ) && st->total_brate <= MAX_ACELP_BRATE ) - { - //for ( int p = 0; p < PERIODOGLEN; p++ ) - //{ - // st->hFdCngDec->hFdCngCom->periodog[p] = (Word32) ( st->hFdCngDec->hFdCngCom->periodog_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->periodog_exp ) ) ); - //} - - //for ( int p = 0; p < st->hFdCngDec->hFdCngCom->fftlen; p++ ) - //{ - // st->hFdCngDec->hFdCngCom->fftBuffer[p] = (Word32) ( st->hFdCngDec->hFdCngCom->fftBuffer_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp ) ) ); - //} - //st->hFdCngDec->msNoiseEst_exp = 31 - Q4; - - for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ ) - { - //st->hFdCngDec->msNoiseEst[p] = (Word32) ( st->hFdCngDec->msNoiseEst_float[p] * ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ) ); - // st->hFdCngDec->msPeriodog[p] = (Word32) ( st->hFdCngDec->msPeriodog_float[p] * ( 1u << ( 31 - st->hFdCngDec->msPeriodog_exp ) ) ); - //st->hFdCngDec->msPeriodog_ST_fx[p] = (Word32) ( st->hFdCngDec->msPeriodog_ST[p] * ( 1u << ( 31 - st->hFdCngDec->msPeriodog_ST_exp ) ) ); - } - - //} - //st->hFdCngDec->hFdCngCom->sidNoiseEstExp = 31 - Q4; - //st->hFdCngDec->partNoiseShape_exp = 31 - Q4; - //for ( int p = 0; p < NPART; p++ ) - //{ - // st->hFdCngDec->hFdCngCom->sidNoiseEst[p] = (Word32) ( st->hFdCngDec->hFdCngCom->sidNoiseEst_flt[p] * ( 1u << ( 31 - st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) ) ); - //} - //for ( int p = 0; p < 24; p++ ) - //{ - //st->hFdCngDec->partNoiseShape[p] = (Word32) ( st->hFdCngDec->partNoiseShape_float[p] * ( 1u << ( 31 - st->hFdCngDec->partNoiseShape_exp ) ) ); - //} - } // u8bit to 16bit FOR(int l = 0; l < IGF_START_MX; l++) { st->hIGFDec->infoTCXNoise_evs[l] = (Word16)st->hIGFDec->infoTCXNoise[l]; } - - //st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = float_to_fix16(st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt, 15); - - //floatToFixed_arr(st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->Q_syn + 1, L_FRAME32k / 2); - //floatToFixed_arr(st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->Q_syn, 320); - //floatToFixed_arr(st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->Q_syn+1, 320); - //floatToFixed_arr(st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->Q_syn, 480); - //floatToFixed_arr(st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->Q_syn, 480); - } -} - -void fixed_to_float_stereo_tcx_core_dec( - Decoder_State *st, - Word16 *signal_out ) -{ - //TCX_DEC_HANDLE hTcxDec = st->hTcxDec; - //Word16 q_Aq; - //st->hTcxDec->tcxltp_last_gain_unmodified_float = (Word16) fixedToFloat( st->hTcxDec->tcxltp_last_gain_unmodified, Q15 ); - - if ( EQ_16( st->core, ACELP_CORE ) ) - { - if (st->hHQ_core->Q_old_wtda >= 0) - { - for ( int p = 0; p < 960; p++ ) - { - //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); - //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); - } - } - else{ - for ( int p = 0; p < 960; p++ ) - { - //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); - //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); - } - } - } - - st->hBPF->pst_mem_deemp_err_fx = (Word16)st->mem_error; - /*=================================*/ - if ( st->hFdCngDec != NULL && ( st->sr_core == INT_FS_12k8 || st->sr_core == INT_FS_16k ) && st->total_brate <= MAX_ACELP_BRATE ) - { - if ( st->element_mode != IVAS_CPE_TD || ( st->element_mode == IVAS_CPE_TD && st->idchan == 0 ) ) - { - if ( ( ( st->m_frame_type == ACTIVE_FRAME ) && ( ( st->bfi == 0 && - ( signal_out == NULL || - ( *signal_out < MAXVAL_WORD16 && * signal_out>( MINVAL_WORD16 ) && - *( signal_out + st->hFdCngDec->hFdCngCom->frameSize - 1 ) < MAXVAL_WORD16 && - *( signal_out + st->hFdCngDec->hFdCngCom->frameSize - 1 ) > ( MINVAL_WORD16 ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && st->hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_format ) ) && - !( st->cng_type == LP_CNG && st->hFdCngDec->flag_dtx_mode ) ) || - ( st->element_mode == IVAS_CPE_TD ) ) && - ( !st->BER_detect ) ) || - ( ( st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT ) && ( st->hFdCngDec->hFdCngCom->active_frame_counter > 0 ) ) || ( ( st->bfi == 1 ) && ( st->nbLostCmpt == 1 ) ) ) ) || - ( st->m_frame_type == ZERO_FRAME ) ) - { - for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ ) - { - //st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ); - - } - } - } - } - IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) - { - - //FOR( Word16 ind = 0; ind < 640; ind++ ) - //{ - // st->hHQ_core->old_outLB[ind] = (float) st->hHQ_core->old_out_LB_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); - //} - //FOR( Word16 ind = 0; ind < 960; ind++ ) - //{ - // st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); - //} - FOR( Word16 ind = 0; ind < L_FRAME32k / 2; ind++ ) - { - //st->hTcxDec->syn_Overl_float[ind] = (float) st->hTcxDec->syn_Overl[ind] / ( (float) pow( 2, st->Q_syn + 1 ) ); - } - FOR( Word16 ind = 0; ind < L_FRAME_MAX / 2; ind++ ) - { - //st->hTcxDec->syn_OverlFB_float[ind] = (float) st->hTcxDec->syn_OverlFB[ind] / ( (float) pow( 2, st->Q_syn ) ); - } } } #endif // IVAS_FLOAT_FIXED diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index a9b72e067..78faac5ae 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2146,10 +2146,22 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state /* i/o: handle for the covariance synthesis state */ ); +ivas_error ivas_init_decoder_front_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + ivas_error ivas_init_decoder_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +void destroy_core_dec_fx( + DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */ +); + +void ivas_destroy_dec_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + ivas_error ivas_ism_dec_config_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index c901dd2d9..308813ea9 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -167,8 +167,8 @@ void ivas_sba_config_fx( ELSE { *nSCE = 0; - *nCPE = shr( *nchan_transport, 2 ); - IF( NE_16( mult( 2, ( *nCPE ) ), *nchan_transport ) ) + *nCPE = shr( *nchan_transport, 1 ); + IF( NE_16( i_mult( 2, ( *nCPE ) ), *nchan_transport ) ) { *nCPE = add( *nCPE, 1 ); } @@ -320,18 +320,18 @@ Word16 ivas_sba_get_nchan_metadata( { Word16 nb_channels; - IF ( EQ_16(sba_order , SBA_FOA_ORDER) ) + IF( EQ_16( sba_order, SBA_FOA_ORDER ) ) { nb_channels = FOA_CHANNELS; move16(); } ELSE { - IF ( GE_32(ivas_total_brate , IVAS_512k) ) + IF( GE_32( ivas_total_brate, IVAS_512k ) ) { nb_channels = IVAS_SPAR_MAX_CH; move16(); - nb_channels = s_min( nb_channels, imult1616(add( sba_order , 1 ) , add( sba_order , 1 )) ); + nb_channels = s_min( nb_channels, imult1616( add( sba_order, 1 ), add( sba_order, 1 ) ) ); } ELSE { diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 3eebc5bc4..6c37b6b07 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -74,10 +74,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( Word16 last_element_mode, const FRAME_MODE frameMode); -void fixed_to_float_stereo_tcx_core_dec( - Decoder_State *st, - Word16 *signal_out -); // Float to Word32 Word32 float_to_fix( float number, Word32 Q ); // Word32 to Float diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 35cec94d9..bf525061e 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1658,15 +1658,15 @@ ivas_error acelp_core_dec_ivas_fx( } } Word32 max_val = max(max_real, max_imag); - Q_imag = norm_s((Word16)max_val); + Q_imag = norm_l(max_val) - 3/* Guard bits */; Q_real = Q_imag; for (i = 0; i < CLDFB_NO_COL_MAX; i++) { - Scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); - Scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_imag); + scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); + scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_imag); } - Scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, ( Q_real - 1 ) - Q10 ); // (Q_real-1) + scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, ( Q_real - 1 ) - Q10 ); // (Q_real-1) Scale_sig32(save_hb_synth_fx, L_FRAME48k, Q_real - 1); FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ ) @@ -1716,26 +1716,26 @@ ivas_error acelp_core_dec_ivas_fx( } } Word32 max_val = max(max_real, max_imag); - Q_imag = norm_s((Word16)max_val); + Q_imag = norm_l(max_val) - 3/* Guard bits */; Q_real = Q_imag; for (i = 0; i < CLDFB_NO_COL_MAX; i++) { - Scale_sig32(realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); - Scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); + scale_sig32(realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); + scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); } - Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1) + scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1) #ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1); #endif cldfbSynthesis_ivas_fx(realBuffer_fx, imagBuffer_fx, synth_fx, -1, st->cldfbSyn); #ifdef MSAN_FIX - Scale_sig32(synth_fx, output_frame, -(Q_real - 1)); + scale_sig32(synth_fx, output_frame, -(Q_real - 1)); #else Scale_sig32(synth_fx, L_FRAME48k, -(Q_real - 1)); #endif - Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q10 - (Q_real - 1)); //Q10 + scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q10 - (Q_real - 1)); //Q10 } /* save synthesis - needed in case of core switching */ @@ -1802,15 +1802,15 @@ ivas_error acelp_core_dec_ivas_fx( } } Word32 max_val = max(max_real, max_imag); - Q_imag = norm_s((Word16)max_val); + Q_imag = norm_l(max_val) - 3/* Guard bits */; Q_real = Q_imag; for (i = 0; i < CLDFB_NO_COL_MAX; i++) { - Scale_sig32(realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); - Scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); + scale_sig32(realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); + scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); } - Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1) + scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1) #ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1); #endif @@ -1970,63 +1970,15 @@ ivas_error acelp_core_dec_ivas_fx( } void acelp_decoder_state_float2fix(Decoder_State *st/*, STEREO_CNG_DEC_HANDLE hStereoCng*/) { - - - /* CLDFB */ - Word16 old_len_ana, old_len_bpf; - // The following lines are to calculate the length of the buffers before and - // after calling the function for fixed pt conversion. The calculations are taken - // based on the logic used in resampleCldfb_ivas_fx - old_len_ana = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; - old_len_bpf = st->cldfbBPF->p_filter_length - st->cldfbBPF->no_channels; - - //Word16 new_len; - //new_len = 9 * (int16_t)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f); - floatToFixed_arrL(st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q11, old_len_ana); - floatToFixed_arrL(st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q10, old_len_bpf); if(st->cldfbSynHB) floatToFixed_arrL(st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q10, st->cldfbSynHB->p_filter_length); - floatToFixed_arrL(st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q10, st->cldfbSyn->p_filter_length); } void acelp_decoder_state_fix2float(Decoder_State *st) { - - st->prev_Q_syn = st->Q_syn; - /* CLDFB */ - Word16 new_len; - new_len = 9 * (int16_t)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f); - fixedToFloat_arrL(st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q11, new_len); - fixedToFloat_arrL(st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q10, new_len); if (st->cldfbSynHB) fixedToFloat_arrL(st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q10, st->cldfbSynHB->p_filter_length); - fixedToFloat_arrL(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q10, st->cldfbSyn->p_filter_length); - //FdCng - if ( st->hFdCngDec ) - { - if ((st->hFdCngDec != NULL || st->idchan == 1) && st->element_mode != IVAS_CPE_MDCT) - { - if (st->element_mode == IVAS_CPE_TD || st->flag_cna || (st->cng_type == FD_CNG && st->total_brate <= ACELP_32k) || (st->cng_type == LP_CNG && st->core_brate <= SID_2k40)) - { - if (st->element_mode != IVAS_CPE_TD && !st->cng_ism_flag) - { - if ( - ((st->m_frame_type == ACTIVE_FRAME) && ((st->bfi == 0 && - ((((st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && st->hFdCngDec->flag_dtx_mode) || !st->VAD || (st->ini_frame < 100 && st->is_ism_format)) && - !(st->cng_type == LP_CNG && st->hFdCngDec->flag_dtx_mode)) || - (st->element_mode == IVAS_CPE_TD)) && - (!st->BER_detect)) || - ((st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT) && (st->hFdCngDec->hFdCngCom->active_frame_counter > 0)) || ((st->bfi == 1) && (st->nbLostCmpt == 1)))) || - ((st->m_frame_type == ZERO_FRAME) && (st != NULL && st->cng_type == LP_CNG)) - ) - { - //fixedToFloat_arrL(st->hFdCngDec->msNoiseEst, st->hFdCngDec->msNoiseEst_float, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); - } - } - } - } - } } static void rescale_fdCngDec(HANDLE_FD_CNG_DEC hFdCngDec, Word16 Exp_diff) { diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 045c54345..b20c34570 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1119,7 +1119,6 @@ void open_decoder_LPD_ivas_fx( Word16 mem_syn_r_size_new; Word16 mem_syn_r_size_old; Word16 fscaleFB; - //Word16 encoderLookahead, encoderLookaheadFB; BPF_DEC_HANDLE hBPF; TD_BWE_DEC_HANDLE hBWE_TD; TCX_LTP_DEC_HANDLE hTcxLtpDec; @@ -1182,9 +1181,7 @@ void open_decoder_LPD_ivas_fx( { st->narrowBand = 1; } - // To be replaced with basops - //encoderLookahead = mult( L_LOOK_12k8<<6 , st->fscale ); - //encoderLookaheadFB = mult(L_LOOK_12k8<<6 , fscaleFB ); + IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { st->pit_res_max = initPitchLagParameters( INT_FS_12k8, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max ); @@ -1701,8 +1698,6 @@ void open_decoder_LPD_ivas_fx( IF( is_init || MCT_flag || !( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( st->element_mode, last_element_mode ) ) ) { - //st->hTcxDec->CngLevelBackgroundTrace_bfi_fx = PLC_MIN_CNG_LEV; - //st->hTcxDec->CngLevelBackgroundTrace_bfi_exp = 16; st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1; st->hTcxDec->CurrLevelIndex_bfi = 0; st->hTcxDec->LastFrameLevel_bfi_fx = PLC_MIN_CNG_LEV; diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 8a9d8fc87..0442b2c68 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2860,7 +2860,9 @@ static void IGF_getWhiteSpectralData_ivas( move16(); max_out_e = 0; move16(); - s_l = sub( s_l, 2 ); + /* find the gaurd bits for a length of (i + level + 1) - (i - level)*/ + Word16 guard_bits = add( find_guarded_bits_fx( add( i_mult( 2, level ), 1 ) ), 1 ) / 2; + s_l = sub( s_l, guard_bits ); FOR( i = start; i < stop - level; i++ ) { diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index f82732ab3..157c6180c 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -172,6 +172,22 @@ ivas_error ivas_core_dec( } } + FOR(n = 0; n < n_channels; n++) + { + st = sts[n]; + IF( st->cldfbAna ) + { + floatToFixed_arr32( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q10, st->cldfbAna->cldfb_size ); + } + + IF( st->cldfbBPF ) + floatToFixed_arr32( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q11, st->cldfbBPF->cldfb_size ); + IF( st->cldfbSyn ) + { + floatToFixed_arr32( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q11, st->cldfbSyn->cldfb_size ); + } + } + output_Fs = sts[0]->output_Fs; output_frame = extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) ); @@ -369,38 +385,14 @@ ivas_error ivas_core_dec( /*---------------------------------------------------------------------* * Preprocessing (preparing) for ACELP/HQ core switching *---------------------------------------------------------------------*/ - -#if 1 /*Float to fix conversions*/ Word16 Q_olapBufferSynth = 15, Q_olapBufferSynth2 = 15; /*Initializing with max values to avoid warnings*/ - IF( st->cldfbAna ) - { - floatToFixed_arr32( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q10, st->cldfbAna->cldfb_state_length ); - } - IF( st->cldfbSyn ) - { - floatToFixed_arr32( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q11, st->cldfbSyn->cldfb_state_length ); - } - - IF( st->cldfbBPF ) - floatToFixed_arr32( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q11, st->cldfbBPF->cldfb_state_length ); - -#endif Copy_Scale_sig_16_32( st->previoussynth_fx, st->previoussynth_fx_32, L_FRAME48k, 0 ); IF ( ( error = core_switching_pre_dec_ivas_fx( st, output_frame, sts[0]->last_core_brate, nchan_out, last_element_mode, last_element_brate, st->Q_syn, &Q_olapBufferSynth, &Q_olapBufferSynth2) ) != IVAS_ERR_OK ) { return error; } -#if 1 /*Fixed to float function changes*/ - - IF( st->cldfbAna ) - fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q10, st->cldfbAna->cldfb_state_length ); - IF( st->cldfbSyn ) - fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q11, st->cldfbSyn->cldfb_state_length ); - IF( st->cldfbBPF ) - fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q11, st->cldfbBPF->cldfb_state_length ); -#endif flag_sec_CNA = -1; IF ( hCPE != NULL ) @@ -428,6 +420,12 @@ ivas_error ivas_core_dec( } /* float2fix, to be removed */ + IF(st->cldfbAna) + scale_sig32(st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, sub(Q11, Q10)); + IF(st->cldfbBPF) + scale_sig32(st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_size, sub(Q10, Q11)); + IF(st->cldfbSyn) + scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_size, sub(Q10, Q11)); acelp_decoder_state_float2fix(st); IF( st->hFdCngDec != NULL ) @@ -447,6 +445,13 @@ ivas_error ivas_core_dec( Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k, Q11 - st->Q_syn2); Scale_sig(output_16_fx[n], L_FRAME48k, -st->Q_syn2); acelp_decoder_state_fix2float(st); + IF(st->cldfbAna) + scale_sig32(st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, sub(Q10, Q11)); /* 9 * (Word16)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f) */ + IF(st->cldfbBPF) + scale_sig32(st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_size, sub(Q11, Q10)); + IF(st->cldfbSyn) + scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_size, sub(Q11, Q10)); + st->prev_Q_syn = st->Q_syn; if ( save_hb_synth_32_fx ) { @@ -477,7 +482,7 @@ ivas_error ivas_core_dec( Copy_Scale_sig_16_32( output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 ); stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 0, last_element_mode, frameMode[n] ); - fixed_to_float_stereo_tcx_core_dec( st, output_16_fx[n] ); + st->hBPF->pst_mem_deemp_err_fx = (Word16)st->mem_error; } if ( st->core == HQ_CORE ) @@ -513,6 +518,17 @@ ivas_error ivas_core_dec( } /* n_channels loop */ + FOR(n = 0; n < n_channels; n++) + { + st = sts[n]; + IF( st->cldfbAna ) + fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q10, st->cldfbAna->cldfb_size ); + IF( st->cldfbBPF ) + fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q11, st->cldfbBPF->cldfb_size ); + IF( st->cldfbSyn ) + fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q11, st->cldfbSyn->cldfb_size ); + } + /*---------------------------------------------------------------------* * MDCT stereo: joint TCX Core Decoding *---------------------------------------------------------------------*/ @@ -542,8 +558,8 @@ ivas_error ivas_core_dec( st->prev_Q_syn = st->Q_syn; - Scale_sig(st->hHQ_core->old_out_LB_fx, L_FRAME32k, st->Q_syn - st->hHQ_core->Q_old_wtda_LB); - Scale_sig(st->hHQ_core->old_out_fx, L_FRAME48k, st->Q_syn - st->hHQ_core->Q_old_wtda); + Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, st->Q_syn - st->hHQ_core->Q_old_wtda_LB ); + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, st->Q_syn - st->hHQ_core->Q_old_wtda ); IF( st->hTcxDec ) st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; @@ -564,16 +580,16 @@ ivas_error ivas_core_dec( st = hCPE->hCoreCoder[ch]; - st->hHQ_core->Q_old_wtda_LB = st->Q_syn; - st->hHQ_core->Q_old_wtda = st->Q_syn; + st->hHQ_core->Q_old_wtda_LB = st->Q_syn; + st->hHQ_core->Q_old_wtda = st->Q_syn; } #ifdef MSAN_FIX Scale_sig( synth_16_fx[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX, e_sig - 15 ); Scale_sig( synth_16_fx[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX, e_sig - 15 ); #else - Scale_sig(synth_16_fx[0],L_FRAME48k,e_sig - 15); - Scale_sig(synth_16_fx[1],L_FRAME48k,e_sig - 15); + Scale_sig( synth_16_fx[0], L_FRAME48k, e_sig - 15 ); + Scale_sig( synth_16_fx[1], L_FRAME48k, e_sig - 15 ); #endif #endif } @@ -581,8 +597,6 @@ ivas_error ivas_core_dec( /* for inactive frames with mono output, copy and (if necessary) downmix buffers */ ELSE IF( hCPE->nchan_out == 1 ) { -#ifdef IVAS_FLOAT_FIXED - sts[0] = hCPE->hCoreCoder[0]; sts[1] = hCPE->hCoreCoder[1]; @@ -598,10 +612,6 @@ ivas_error ivas_core_dec( sts[0]->hHQ_core->Q_old_wtda = 15 - sts[0]->hHQ_core->exp_old_out; sts[1]->hHQ_core->Q_old_wtda = 15 - sts[1]->hHQ_core->exp_old_out; } - -#else - updateBuffersForDmxMdctStereo( hCPE, output_frame, output, synth ); -#endif } test(); IF ( EQ_16(sts[0]->bfi, 0) && EQ_16(sts[0]->prev_bfi, 1 )) @@ -650,10 +660,6 @@ ivas_error ivas_core_dec( * TD-BWE for ACELP to TCX transitions *---------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - - /*cldfb struct*/ - /*------------------fix-to-fix-start---------------------*/ /*core_switching_post_dec*/ Q_synth = 0; if (st->hHQ_core != NULL) @@ -702,11 +708,9 @@ ivas_error ivas_core_dec( floatToFixed_arrL(st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, 11, st->cldfbBPF->cldfb_size); } - /*-------------------cldfb-end---------------------------*/ Word16 q_audio, old_syn_fx; old_syn_fx = Q11; q_audio = Q12; -#endif test(); test(); test(); test(); IF ( EQ_16(st->last_core, ACELP_CORE) && (EQ_16(st->core, TCX_20_CORE) || EQ_16(st->core, TCX_10_CORE) || EQ_16(st->core, HQ_CORE) ) && st->hBWE_TD != NULL ) { @@ -748,7 +752,7 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && NE_16(st->element_mode, IVAS_CPE_MDCT) && !(EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG))) { - Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, hSCE->q_save_synth_fx - Q_synth); + Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, hSCE->q_save_synth_fx - Q_synth); } IF ( ( error = core_switching_post_dec_ivas_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE, &Q_synth ) ) != IVAS_ERR_OK ) @@ -778,14 +782,12 @@ ivas_error ivas_core_dec( Copy_Scale_sig_16_32(st->delay_buf_out_fx, st->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP, Q11); Scale_sig32(output_32_fx[n], L_FRAME48k, Q11 - Q4); -#ifdef IVAS_FLOAT_FIXED - /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ if (st->cldfbAna != NULL) { - fixedToFloat_arrL(st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, 10, st->cldfbAna->cldfb_state_length); + fixedToFloat_arrL(st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, 10, st->cldfbAna->cldfb_size); } if (st->cldfbSyn != NULL) { @@ -793,10 +795,9 @@ ivas_error ivas_core_dec( } if (st->cldfbBPF != NULL) { - fixedToFloat_arrL(st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, 11, st->cldfbBPF->cldfb_state_length); + fixedToFloat_arrL(st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, 11, st->cldfbBPF->cldfb_size); } - /*-------------------cldfb-end---------------------------*/ #ifdef MSAN_FIX Scale_sig(synth_16_fx[n], output_frame, negate(Q_synth)); #else @@ -815,14 +816,12 @@ ivas_error ivas_core_dec( st->hBWE_FD->prev_L_swb_norm = st->hBWE_FD->prev_L_swb_norm; st->hBWE_FD->prev_flag = st->hBWE_FD->prev_flag; } -#endif + /*---------------------------------------------------------------------* * WB TBE decoding * WB BWE decoding *---------------------------------------------------------------------*/ - -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED Word16 Q_input, Q_hb_synth_fx, Q_synth_fx; Word16 Q_syn_hb; @@ -834,9 +833,8 @@ ivas_error ivas_core_dec( FD_BWE_DEC_HANDLE hBWE_FD; hBWE_FD = st->hBWE_FD; - Copy_Scale_sig_32_16(output_32_fx[n], output_16_fx[n], L_FRAME48k, negate(Q11)); - Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, negate(Q11)); -#endif + Copy_Scale_sig_32_16( output_32_fx[n], output_16_fx[n], L_FRAME48k, negate( Q11 ) ); + Copy_Scale_sig_32_16( hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, negate( Q11 ) ); test(); test(); test(); @@ -1133,9 +1131,7 @@ ivas_error ivas_core_dec( test(); test(); test(); IF ( GE_16(output_frame, L_FRAME32k) && GT_16(st->extl, SWB_CNG) && EQ_16(st->core, ACELP_CORE) && st->hTdCngDec != NULL ) { -#ifdef IVAS_FLOAT_FIXED - Word16 exp, fra; -#endif + Word16 exp, fra; SWITCH(output_frame) { case L_FRAME8k: @@ -1178,8 +1174,6 @@ ivas_error ivas_core_dec( * - core switching in DFT stereo * - updates for potential TD->DFT stereo switching *----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - if (hCPE != NULL) { FOR(int ch_ind = 0; ch_ind < n_channels; ch_ind++) @@ -1208,7 +1202,6 @@ ivas_error ivas_core_dec( Word16 exp_max = 0; Word32 output_fx_loc[L_FRAME48k]; -#endif IF ( NE_16(st->element_mode, IVAS_CPE_DFT )) { diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index aa32ce707..8d0f2014a 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -198,7 +198,7 @@ ivas_error ivas_corecoder_dec_reconfig_fx( { IF( st_ivas->hCPE[cpe_id]->hCoreCoder[n] != NULL ) { - destroy_core_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + destroy_core_dec_fx( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); free( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); st_ivas->hCPE[cpe_id]->hCoreCoder[n] = NULL; diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index cdb223d87..5ffceb2c1 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -1146,7 +1146,7 @@ void destroy_cpe_dec( IF( st != NULL ) { - destroy_core_dec( st ); + destroy_core_dec_fx( st ); free( st ); st = NULL; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ec86f6303..612d7b82d 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -789,7 +789,6 @@ static ivas_error ivas_dirac_rend_config_fx( IF( EQ_16( flag_config, DIRAC_OPEN ) ) { hDirACRend->buffer_energy_fx = NULL; - hDirACRend->buffer_energy = NULL; } IF( ( EQ_16( flag_config, DIRAC_OPEN ) && hDirAC->hConfig->dec_param_estim == TRUE ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( hDirAC->hConfig->dec_param_estim == TRUE && dec_param_estim_old == FALSE ) ) ) @@ -806,6 +805,7 @@ static ivas_error ivas_dirac_rend_config_fx( set32_fx( hDirACRend->buffer_intensity_real_fx[i][j], 0, CLDFB_NO_CHANNELS_MAX ); } } + set16_fx( hDirACRend->q_buffer_intensity_real, Q31, DIRAC_NO_COL_AVG_DIFF ); IF( hDirACRend->buffer_energy_fx == NULL ) { IF( ( hDirACRend->buffer_energy_fx = (Word32 *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( Word32 ) ) ) == NULL ) @@ -814,27 +814,7 @@ static ivas_error ivas_dirac_rend_config_fx( } } set32_fx( hDirACRend->buffer_energy_fx, 0, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); -#ifdef TRUE - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) - { - if ( ( hDirACRend->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_f( hDirACRend->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); - } - } - if ( hDirACRend->buffer_energy == NULL ) - { - if ( ( hDirACRend->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - } - set_f( hDirACRend->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); -#endif + set16_fx( hDirACRend->q_buffer_energy, Q31, DIRAC_NO_COL_AVG_DIFF ); } ELSE IF( ( EQ_16( flag_config, DIRAC_OPEN ) && hDirAC->hConfig->dec_param_estim == FALSE ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( hDirAC->hConfig->dec_param_estim == FALSE && dec_param_estim_old == TRUE ) ) ) { @@ -854,24 +834,6 @@ static ivas_error ivas_dirac_rend_config_fx( free( hDirACRend->buffer_energy_fx ); hDirACRend->buffer_energy_fx = NULL; } -#ifdef TRUE - for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) - { - for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) - { - if ( flag_config == DIRAC_RECONFIGURE && hDirACRend->buffer_intensity_real[i][j] ) - { - free( hDirACRend->buffer_intensity_real[i][j] ); - } - hDirACRend->buffer_intensity_real[i][j] = NULL; - } - } - if ( hDirACRend->buffer_energy != NULL ) - { - free( hDirACRend->buffer_energy ); - hDirACRend->buffer_energy = NULL; - } -#endif } /* output synthesis */ ivas_dirac_dec_output_synthesis_init_fx( hSpatParamRendCom, hDirACRend, nchan_out_woLFE, hodirac_flag ); @@ -3541,21 +3503,6 @@ void ivas_dirac_dec_render_sf_fx( set_zero_fx( surCohRatio_fx, CLDFB_NO_CHANNELS_MAX ); //////////////////////////////////////////////////////////////////////////// to be removed /////////////////////////////////////////////////////////////////// - IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) - { - p_Rmat_fx = &st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; - floatToFixed_arrL32( &st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][0][0], p_Rmat_fx, Q29, 9 ); - } - ELSE - { - p_Rmat_fx = 0; - } - - IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) - { - floatToFixed_arrL32( &st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][0][0], &st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][0][0], Q29, 9 ); - } - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[hSpatParamRendCom->subframes_rendered]; slot_idx++ ) { IF( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -3617,23 +3564,6 @@ void ivas_dirac_dec_render_sf_fx( BREAK; } } - IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) - { - // Word16 val = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - FOR( i = 0; i < 32; i++ ) - { - Word16 exp1 = 0, exp2 = 0, exp3 = 0; - f2me_buf( hDirACRend->buffer_intensity_real[0][i], hDirACRend->buffer_intensity_real_fx[0][i], &exp1, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - f2me_buf( hDirACRend->buffer_intensity_real[1][i], hDirACRend->buffer_intensity_real_fx[1][i], &exp2, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - f2me_buf( hDirACRend->buffer_intensity_real[2][i], hDirACRend->buffer_intensity_real_fx[2][i], &exp3, hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - hDirACRend->q_buffer_intensity_real[i] = sub( 31, s_max( s_max( exp1, exp2 ), exp3 ) ); - scale_sig32( hDirACRend->buffer_intensity_real_fx[0][i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band], sub( hDirACRend->q_buffer_intensity_real[i], sub( 31, exp1 ) ) ); - scale_sig32( hDirACRend->buffer_intensity_real_fx[1][i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band], sub( hDirACRend->q_buffer_intensity_real[i], sub( 31, exp2 ) ) ); - scale_sig32( hDirACRend->buffer_intensity_real_fx[2][i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band], sub( hDirACRend->q_buffer_intensity_real[i], sub( 31, exp3 ) ) ); - f2me_buf( &hDirACRend->buffer_energy[i * hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]], &hDirACRend->buffer_energy_fx[i * hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]], &hDirACRend->q_buffer_energy[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - hDirACRend->q_buffer_energy[i] = sub( 31, hDirACRend->q_buffer_energy[i] ); - } - } IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) { @@ -4918,15 +4848,7 @@ void ivas_dirac_dec_render_sf_fx( /* Perform binaural rendering */ Word16 input_q = Q6; - move16(); - - IF( st_ivas->hCombinedOrientationData != NULL ) - { - FOR( i = 0; i < 3; i++ ) - { - scale_sig32( st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i], 3, Q1 ); /* Q29 -> Q30 */ - } - } + move16(); ivas_binRenderer_fx( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, @@ -4934,14 +4856,6 @@ void ivas_dirac_dec_render_sf_fx( Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q ); - IF( st_ivas->hCombinedOrientationData != NULL ) - { - FOR( i = 0; i < 3; i++ ) - { - scale_sig32( st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i], 3, -Q1 ); /* Q30 -> Q29 */ - } - } - Scale_sig32( Cldfb_RealBuffer_Binaural_fx[0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); Scale_sig32( Cldfb_ImagBuffer_Binaural_fx[0][0], i_mult( BINAURAL_CHANNELS, i_mult( MAX_PARAM_SPATIAL_SUBFRAMES, CLDFB_NO_CHANNELS_MAX ) ), sub( Q6, input_q ) ); @@ -5265,17 +5179,6 @@ void ivas_dirac_dec_render_sf_fx( } } - IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) - { - FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; i++ ) - { - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[0][i], hDirACRend->buffer_intensity_real[0][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[1][i], hDirACRend->buffer_intensity_real[1][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( hDirACRend->buffer_intensity_real_fx[2][i], hDirACRend->buffer_intensity_real[2][i], hDirACRend->q_buffer_intensity_real[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - fixedToFloat_arrL32( &hDirACRend->buffer_energy_fx[i * num_freq_bands], &hDirACRend->buffer_energy[i * num_freq_bands], hDirACRend->q_buffer_energy[i], hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ); - } - } - IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 9e57b7245..52bad0aba 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -45,6 +45,7 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "ivas_prot_fx.h" +#define IVAS_FLOAT_FIXED_TO_BE_REMOVED #endif // IVAS_FLOAT_FIXED @@ -158,7 +159,7 @@ ivas_error ivas_dec_setup( { /* set Ambisonic (SBA) order used for analysis and coding */ st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); -#ifdef IVAS_FLOAT_FIXED0 +#ifdef IVAS_FLOAT_FIXED ivas_sba_config_fx( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); #else ivas_sba_config(ivas_total_brate, st_ivas->sba_analysis_order, -1, &(st_ivas->nchan_transport), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init); @@ -208,15 +209,6 @@ ivas_error ivas_dec_setup( { IF( LT_16( n_samples_granularity, st_ivas->hTcBuffer->n_samples_granularity ) ) { - - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } if ( st_ivas->hSbaIsmData ) { for ( Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++ ) @@ -1027,8 +1019,8 @@ void copy_decoder_config( * * Set decoder parameters to initial values *-------------------------------------------------------------------*/ - -ivas_error ivas_init_decoder_front( +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_init_decoder_front_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { @@ -1058,21 +1050,16 @@ ivas_error ivas_init_decoder_front( IF ( st_ivas->hDecoderConfig->Opt_LsCustom ) { -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_ls_custom_open_fx( &( st_ivas->hLsSetupCustom ) ) ) == IVAS_ERR_OK ) { +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED set_zero((st_ivas->hLsSetupCustom)->ls_azimuth, MAX_OUTPUT_CHANNELS ); set_zero((st_ivas->hLsSetupCustom)->ls_elevation, MAX_OUTPUT_CHANNELS ); -#ifdef IVAS_FLOAT_FIXED +#endif set_zero_fx((st_ivas->hLsSetupCustom)->ls_azimuth_fx, MAX_OUTPUT_CHANNELS ); set_zero_fx((st_ivas->hLsSetupCustom)->ls_elevation_fx, MAX_OUTPUT_CHANNELS ); -#endif - //set_f( ( st_ivas->hLsSetupCustom )->separate_ch_gains, 0.0f, MAX_OUTPUT_CHANNELS ); } ELSE -#else - IF ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1082,7 +1069,6 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Head-Tracking handle *--------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED IF( st_ivas->hDecoderConfig->Opt_Headrotation ) { IF( ( error = ivas_headTrack_open_fx( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) @@ -1095,19 +1081,7 @@ ivas_error ivas_init_decoder_front( return error; } } -#else - IF( st_ivas->hDecoderConfig->Opt_Headrotation ) - { - IF( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - IF( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif + /*-------------------------------------------------------------------* * Allocate and initialize external orientation handle *--------------------------------------------------------------------*/ @@ -1118,7 +1092,7 @@ ivas_error ivas_init_decoder_front( { return error; } -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { st_ivas->hExtOrientationData->Quaternions[i].w = fixedToFloat_32( st_ivas->hExtOrientationData->Quaternions[i].w_fx, st_ivas->hExtOrientationData->Quaternions[i].q_fact ); @@ -1140,7 +1114,7 @@ ivas_error ivas_init_decoder_front( { return error; } -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED for ( Word16 i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { st_ivas->hCombinedOrientationData->Quaternions[i].w = fixedToFloat_32( st_ivas->hCombinedOrientationData->Quaternions[i].w_fx, st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); @@ -1151,20 +1125,6 @@ ivas_error ivas_init_decoder_front( st_ivas->hCombinedOrientationData->listenerPos[i].x = fixedToFloat_32( st_ivas->hCombinedOrientationData->listenerPos[i].x_fx, st_ivas->hCombinedOrientationData->listenerPos[i].q_fact ); st_ivas->hCombinedOrientationData->listenerPos[i].y = fixedToFloat_32( st_ivas->hCombinedOrientationData->listenerPos[i].y_fx, st_ivas->hCombinedOrientationData->listenerPos[i].q_fact ); st_ivas->hCombinedOrientationData->listenerPos[i].z = fixedToFloat_32( st_ivas->hCombinedOrientationData->listenerPos[i].z_fx, st_ivas->hCombinedOrientationData->listenerPos[i].q_fact ); - for ( Word16 j = 0; j < 3; j++ ) - { - for ( Word16 k = 0; k < 3; k++ ) - { - st_ivas->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( st_ivas->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); - } - } - } - for ( Word16 j = 0; j < 3; j++ ) - { - for ( Word16 k = 0; k < 3; k++ ) - { - st_ivas->hCombinedOrientationData->Rmat_prev[j][k] = (float) fixedToFloat_32( st_ivas->hCombinedOrientationData->Rmat_prev_fx[j][k], 30 ); - } } #endif } @@ -1175,7 +1135,6 @@ ivas_error ivas_init_decoder_front( IF ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) { -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_HRTF_binary_open_fx( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) { return error; @@ -1185,34 +1144,147 @@ ivas_error ivas_init_decoder_front( { return error; } -#else - if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) + + IF ( ( error = ivas_HRTF_fastconv_binary_open_fx( &st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_HRTF_CRend_binary_open( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_HRTF_parambin_binary_open_fx( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } -#endif + } - IF ( ( error = ivas_HRTF_fastconv_binary_open( &st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) + /*-------------------------------------------------------------------* + * Allocate and initialize Binaural Renderer configuration handle + *--------------------------------------------------------------------*/ + + IF ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB + ) + { + IF ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) { return error; } -#ifdef IVAS_FLOAT_FIXED - IF( ( error = ivas_HRTF_parambin_binary_open_fx( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + IF((error = ivas_render_config_init_from_rom_fx(&st_ivas->hRenderConfig)) != IVAS_ERR_OK) + { + return error; + } + +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + IF ( ( error = ivas_render_config_init_from_rom( &st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) { return error; } +#endif + } + + return error; +} #else +ivas_error ivas_init_decoder_front( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + ivas_error error; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * Resets + *-----------------------------------------------------------------*/ + + st_ivas->nSCE = 0; + st_ivas->nCPE = 0; + st_ivas->nchan_transport = -1; + + st_ivas->ism_mode = ISM_MODE_NONE; + st_ivas->mc_mode = MC_MODE_NONE; + + st_ivas->sba_dirac_stereo_flag = 0; + + /* HRTF binauralization latency in ns */ + st_ivas->binaural_latency_ns = 0; + + /*-------------------------------------------------------------------* + * Allocate and initialize Custom loudspeaker layout handle + *--------------------------------------------------------------------*/ + + IF ( st_ivas->hDecoderConfig->Opt_LsCustom ) + { + IF ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-------------------------------------------------------------------* + * Allocate and initialize Head-Tracking handle + *--------------------------------------------------------------------*/ + + IF( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + IF( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + IF( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-------------------------------------------------------------------* + * Allocate and initialize external orientation handle + *--------------------------------------------------------------------*/ + + IF ( st_ivas->hDecoderConfig->Opt_ExternalOrientation ) + { + IF ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-------------------------------------------------------------------* + * Allocate and initialize combined orientation handle + *--------------------------------------------------------------------*/ + + IF ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) + { + IF ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-------------------------------------------------------------------* + * Allocate HRTF binary handle + *--------------------------------------------------------------------*/ + + IF ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) + { + if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_HRTF_CRend_binary_open( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = ivas_HRTF_fastconv_binary_open( &st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = ivas_HRTF_parambin_binary_open( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } -#endif } /*-------------------------------------------------------------------* @@ -1227,12 +1299,6 @@ ivas_error ivas_init_decoder_front( return error; } -#ifdef IVAS_FLOAT_FIXED - IF((error = ivas_render_config_init_from_rom_fx(&st_ivas->hRenderConfig)) != IVAS_ERR_OK) - { - return error; - } -#endif /*FLOAT CODE*/ IF ( ( error = ivas_render_config_init_from_rom( &st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) { @@ -1243,7 +1309,7 @@ ivas_error ivas_init_decoder_front( return error; } - +#endif /*-------------------------------------------------------------------* * ivas_init_decoder() @@ -1347,17 +1413,17 @@ ivas_error ivas_init_decoder_fx( } IF ( ( error = ivas_ls_custom_output_init_fx( st_ivas ) ) == IVAS_ERR_OK ) { -#ifndef IVAS_FLOAT_FIXED - st_ivas->hOutSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; - st_ivas->hOutSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; - st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; - st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; -#else +//#ifndef IVAS_FLOAT_FIXED +// st_ivas->hOutSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; +// st_ivas->hOutSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; +// st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; +// st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; +//#else st_ivas->hOutSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; st_ivas->hOutSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; st_ivas->hIntSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; st_ivas->hIntSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; -#endif +//#endif } ELSE @@ -3713,23 +3779,12 @@ ivas_error ivas_init_decoder( * * Close core decoder handles *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void destroy_core_dec( DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */ ) { -#ifdef IVAS_FLOAT_FIXED - IF( EQ_16( hCoreCoder->element_mode, EVS_MONO ) ) - { - destroy_cldfb_decoder_fx( hCoreCoder ); - } - ELSE - { - destroy_cldfb_decoder_ivas_fx( hCoreCoder ); - } -#else destroy_cldfb_decoder_flt( hCoreCoder ); -#endif // IVAS_FLOAT_FIXED IF ( hCoreCoder->hGSCDec != NULL ) { @@ -3859,59 +3914,288 @@ void destroy_core_dec( return; } - - -/*------------------------------------------------------------------------- - * ivas_initialize_handles_dec() - * - * NULL initialization of handles - *-------------------------------------------------------------------------*/ - -void ivas_initialize_handles_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +#else +void destroy_core_dec_fx( + DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */ ) { - Word16 i; + IF( EQ_16( hCoreCoder->element_mode, EVS_MONO ) ) + { + destroy_cldfb_decoder_fx( hCoreCoder ); + } + ELSE + { + destroy_cldfb_decoder_ivas_fx( hCoreCoder ); + } - FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + IF ( hCoreCoder->hGSCDec != NULL ) { - st_ivas->cldfbAnaDec[i] = NULL; + free( hCoreCoder->hGSCDec ); + hCoreCoder->hGSCDec = NULL; } - FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + IF ( hCoreCoder->hPFstat != NULL ) { - st_ivas->cldfbSynDec[i] = NULL; + free( hCoreCoder->hPFstat ); + hCoreCoder->hPFstat = NULL; } - /* SCE handles */ - FOR ( i = 0; i < MAX_SCE; i++ ) + IF ( hCoreCoder->hMusicPF != NULL ) { - st_ivas->hSCE[i] = NULL; + free( hCoreCoder->hMusicPF ); + hCoreCoder->hMusicPF = NULL; } - /* CPE handles */ - FOR ( i = 0; i < MAX_CPE; i++ ) + IF ( hCoreCoder->hBPF != NULL ) { - st_ivas->hCPE[i] = NULL; + free( hCoreCoder->hBPF ); + hCoreCoder->hBPF = NULL; } - st_ivas->bit_stream = NULL; - //st_ivas->mem_hp20_out = NULL; -#ifdef IVAS_FLOAT_FIXED - st_ivas->mem_hp20_out_fx = NULL; -#endif // IVAS_FLOAT_FIXED - st_ivas->hLimiter = NULL; + IF ( hCoreCoder->hBWE_zero != NULL ) + { + free( hCoreCoder->hBWE_zero ); + hCoreCoder->hBWE_zero = NULL; + } - /* ISM metadata handles */ - FOR ( i = 0; i < MAX_NUM_OBJECTS; i++ ) + IF ( hCoreCoder->hTdCngDec != NULL ) { - st_ivas->hIsmMetaData[i] = NULL; + free( hCoreCoder->hTdCngDec ); + hCoreCoder->hTdCngDec = NULL; } - /* spatial coding handles */ - st_ivas->hDirAC = NULL; - st_ivas->hParamIsmDec = NULL; - st_ivas->hSpar = NULL; + IF ( hCoreCoder->hSC_VBR != NULL ) + { + free( hCoreCoder->hSC_VBR ); + hCoreCoder->hSC_VBR = NULL; + } + + IF ( hCoreCoder->hAmrwb_IO != NULL ) + { + free( hCoreCoder->hAmrwb_IO ); + hCoreCoder->hAmrwb_IO = NULL; + } + + IF ( hCoreCoder->hBWE_TD != NULL ) + { + free( hCoreCoder->hBWE_TD ); + hCoreCoder->hBWE_TD = NULL; + } + + IF ( hCoreCoder->hBWE_FD != NULL ) + { + free( hCoreCoder->hBWE_FD ); + hCoreCoder->hBWE_FD = NULL; + } + + IF ( hCoreCoder->hBWE_FD_HR != NULL ) + { + free( hCoreCoder->hBWE_FD_HR ); + hCoreCoder->hBWE_FD_HR = NULL; + } + + IF ( hCoreCoder->hWIDec != NULL ) + { + free( hCoreCoder->hWIDec ); + hCoreCoder->hWIDec = NULL; + } + + IF ( hCoreCoder->hTECDec != NULL ) + { + free( hCoreCoder->hTECDec ); + hCoreCoder->hTECDec = NULL; + } + + IF ( hCoreCoder->hTcxLtpDec != NULL ) + { + free( hCoreCoder->hTcxLtpDec ); + hCoreCoder->hTcxLtpDec = NULL; + } + + IF ( hCoreCoder->hTcxDec != NULL ) + { + free( hCoreCoder->hTcxDec ); + hCoreCoder->hTcxDec = NULL; + } + + IF ( hCoreCoder->hTcxCfg != NULL ) + { + free( hCoreCoder->hTcxCfg ); + hCoreCoder->hTcxCfg = NULL; + } + + IF ( hCoreCoder->hTonalMDCTConc != NULL ) + { + free( hCoreCoder->hTonalMDCTConc ); + hCoreCoder->hTonalMDCTConc = NULL; + } + + IF ( hCoreCoder->hIGFDec != NULL ) + { + free( hCoreCoder->hIGFDec ); + hCoreCoder->hIGFDec = NULL; + } + + IF ( hCoreCoder->hPlcInfo != NULL ) + { + free( hCoreCoder->hPlcInfo ); + hCoreCoder->hPlcInfo = NULL; + } + + IF ( hCoreCoder->hHQ_core != NULL ) + { + free( hCoreCoder->hHQ_core ); + hCoreCoder->hHQ_core = NULL; + } + + IF ( hCoreCoder->hHQ_nbfec != NULL ) + { + free( hCoreCoder->hHQ_nbfec ); + hCoreCoder->hHQ_nbfec = NULL; + } + + return; +} +#endif + +/*------------------------------------------------------------------------- + * ivas_initialize_handles_dec() + * + * NULL initialization of handles + *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED +void ivas_initialize_handles_dec( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + Word16 i; + + FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + st_ivas->cldfbAnaDec[i] = NULL; + } + + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + st_ivas->cldfbSynDec[i] = NULL; + } + + /* SCE handles */ + FOR ( i = 0; i < MAX_SCE; i++ ) + { + st_ivas->hSCE[i] = NULL; + } + + /* CPE handles */ + FOR ( i = 0; i < MAX_CPE; i++ ) + { + st_ivas->hCPE[i] = NULL; + } + + st_ivas->bit_stream = NULL; + st_ivas->mem_hp20_out = NULL; + st_ivas->hLimiter = NULL; + + /* ISM metadata handles */ + FOR ( i = 0; i < MAX_NUM_OBJECTS; i++ ) + { + st_ivas->hIsmMetaData[i] = NULL; + } + + /* spatial coding handles */ + st_ivas->hDirAC = NULL; + st_ivas->hParamIsmDec = NULL; + st_ivas->hSpar = NULL; + st_ivas->hMasa = NULL; + st_ivas->hQMetaData = NULL; + st_ivas->hMCT = NULL; + st_ivas->hMCParamUpmix = NULL; + st_ivas->hParamMC = NULL; + st_ivas->hLFE = NULL; + + /* rendering handles */ + st_ivas->hBinRenderer = NULL; + st_ivas->hDiracDecBin = NULL; + st_ivas->hDirACRend = NULL; + st_ivas->hSpatParamRendCom = NULL; + st_ivas->hLsSetUpConversion = NULL; + st_ivas->hEFAPdata = NULL; + st_ivas->hVBAPdata = NULL; + st_ivas->hIsmRendererData = NULL; + st_ivas->hBinRendererTd = NULL; + st_ivas->hMonoDmxRenderer = NULL; + st_ivas->hCrendWrapper = NULL; + st_ivas->hReverb = NULL; + st_ivas->hSetOfHRTF = NULL; + st_ivas->hHrtfFastConv = NULL; + st_ivas->hHrtfParambin = NULL; + st_ivas->hoa_dec_mtx = NULL; + st_ivas->hMasaIsmData = NULL; + st_ivas->hSbaIsmData = NULL; + + st_ivas->hHeadTrackData = NULL; + st_ivas->hHrtfTD = NULL; + st_ivas->hLsSetupCustom = NULL; + st_ivas->hRenderConfig = NULL; + st_ivas->hExtOrientationData = NULL; + st_ivas->hCombinedOrientationData = NULL; + + + /* JBM handles */ + st_ivas->hTcBuffer = NULL; + st_ivas->hJbmMetadata = NULL; + + /* floating-point output audio buffers */ + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) + { + st_ivas->p_output_f[i] = NULL; + } + + return; +} +#else +void ivas_initialize_handles_dec( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + Word16 i; + + FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + st_ivas->cldfbAnaDec[i] = NULL; + } + + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + st_ivas->cldfbSynDec[i] = NULL; + } + + /* SCE handles */ + FOR ( i = 0; i < MAX_SCE; i++ ) + { + st_ivas->hSCE[i] = NULL; + } + + /* CPE handles */ + FOR ( i = 0; i < MAX_CPE; i++ ) + { + st_ivas->hCPE[i] = NULL; + } + + st_ivas->bit_stream = NULL; + st_ivas->mem_hp20_out_fx = NULL; + st_ivas->hLimiter = NULL; + + /* ISM metadata handles */ + FOR ( i = 0; i < MAX_NUM_OBJECTS; i++ ) + { + st_ivas->hIsmMetaData[i] = NULL; + } + + /* spatial coding handles */ + st_ivas->hDirAC = NULL; + st_ivas->hParamIsmDec = NULL; + st_ivas->hSpar = NULL; st_ivas->hMasa = NULL; st_ivas->hQMetaData = NULL; st_ivas->hMCT = NULL; @@ -3919,58 +4203,270 @@ void ivas_initialize_handles_dec( st_ivas->hParamMC = NULL; st_ivas->hLFE = NULL; - /* rendering handles */ - st_ivas->hBinRenderer = NULL; - st_ivas->hDiracDecBin = NULL; - st_ivas->hDirACRend = NULL; - st_ivas->hSpatParamRendCom = NULL; - st_ivas->hLsSetUpConversion = NULL; - st_ivas->hEFAPdata = NULL; - st_ivas->hVBAPdata = NULL; - st_ivas->hIsmRendererData = NULL; - st_ivas->hBinRendererTd = NULL; - st_ivas->hMonoDmxRenderer = NULL; - st_ivas->hCrendWrapper = NULL; - st_ivas->hReverb = NULL; - st_ivas->hSetOfHRTF = NULL; - st_ivas->hHrtfFastConv = NULL; - st_ivas->hHrtfParambin = NULL; - st_ivas->hoa_dec_mtx = NULL; - st_ivas->hMasaIsmData = NULL; - st_ivas->hSbaIsmData = NULL; + /* rendering handles */ + st_ivas->hBinRenderer = NULL; + st_ivas->hDiracDecBin = NULL; + st_ivas->hDirACRend = NULL; + st_ivas->hSpatParamRendCom = NULL; + st_ivas->hLsSetUpConversion = NULL; + st_ivas->hEFAPdata = NULL; + st_ivas->hVBAPdata = NULL; + st_ivas->hIsmRendererData = NULL; + st_ivas->hBinRendererTd = NULL; + st_ivas->hMonoDmxRenderer = NULL; + st_ivas->hCrendWrapper = NULL; + st_ivas->hReverb = NULL; + st_ivas->hSetOfHRTF = NULL; + st_ivas->hHrtfFastConv = NULL; + st_ivas->hHrtfParambin = NULL; + st_ivas->hoa_dec_mtx = NULL; + st_ivas->hMasaIsmData = NULL; + st_ivas->hSbaIsmData = NULL; + + st_ivas->hHeadTrackData = NULL; + st_ivas->hHrtfTD = NULL; + st_ivas->hLsSetupCustom = NULL; + st_ivas->hRenderConfig = NULL; + st_ivas->hExtOrientationData = NULL; + st_ivas->hCombinedOrientationData = NULL; + + + /* JBM handles */ + st_ivas->hTcBuffer = NULL; + st_ivas->hJbmMetadata = NULL; + + /* floating-point output audio buffers */ + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) + { +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED + st_ivas->p_output_f[i] = NULL; +#endif + st_ivas->p_output_fx[i] = NULL; + } + + return; +} +#endif + +/*------------------------------------------------------------------------- + * ivas_destroy_dec() + * + * Close IVAS decoder handles + *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED +void ivas_destroy_dec( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) +{ + Word16 i; + + /* CLDFB handles */ + FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + IF ( st_ivas->cldfbAnaDec[i] != NULL ) + { + deleteCldfb_ivas( &( st_ivas->cldfbAnaDec[i] ) ); + } + } + + FOR ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + IF ( st_ivas->cldfbSynDec[i] != NULL ) + { + deleteCldfb_ivas( &( st_ivas->cldfbSynDec[i] ) ); + } + } + + /* SCE handles */ + FOR ( i = 0; i < MAX_SCE; i++ ) + { + IF ( st_ivas->hSCE[i] != NULL ) + { + destroy_sce_dec( st_ivas->hSCE[i] ); + st_ivas->hSCE[i] = NULL; + } + } + + /* CPE handles */ + FOR ( i = 0; i < MAX_CPE; i++ ) + { + IF ( st_ivas->hCPE[i] != NULL ) + { + /* set pointer to NULL as core coder already deallocated in destroy_sce_dec() */ + IF ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) + { + st_ivas->hCPE[i]->hCoreCoder[0] = NULL; + st_ivas->hCPE[i]->hCoreCoder[1] = NULL; + } + destroy_cpe_dec( st_ivas->hCPE[i] ); + st_ivas->hCPE[i] = NULL; + } + } + + /* HP20 filter handles */ + IF(st_ivas->mem_hp20_out != NULL) + { + FOR(i = 0; i < getNumChanSynthesis(st_ivas); i++) + { + free(st_ivas->mem_hp20_out[i]); + st_ivas->mem_hp20_out[i] = NULL; + } + free(st_ivas->mem_hp20_out); + st_ivas->mem_hp20_out = NULL; + } + /* ISM metadata handles */ + ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); + + /* ISM renderer handle */ + ivas_ism_renderer_close( &( st_ivas->hIsmRendererData ) ); + + /* DirAC handle */ + IF ( st_ivas->ivas_format == ISM_FORMAT ) + { + ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); + } + ELSE + { + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close(&(st_ivas->hSpatParamRendCom)); + ivas_dirac_dec_close(&(st_ivas->hDirAC)); + } + + /* SPAR handle */ + ivas_spar_dec_close( &( st_ivas->hSpar ), st_ivas->hDecoderConfig->output_Fs, 0 ); - st_ivas->hHeadTrackData = NULL; - st_ivas->hHrtfTD = NULL; - st_ivas->hLsSetupCustom = NULL; - st_ivas->hRenderConfig = NULL; - st_ivas->hExtOrientationData = NULL; - st_ivas->hCombinedOrientationData = NULL; + /* HOA decoder matrix */ + IF ( st_ivas->hoa_dec_mtx != NULL ) + { + free( st_ivas->hoa_dec_mtx ); + st_ivas->hoa_dec_mtx = NULL; + } + /* MASA decoder structure */ + ivas_masa_dec_close( &( st_ivas->hMasa ) ); - /* JBM handles */ - st_ivas->hTcBuffer = NULL; - st_ivas->hJbmMetadata = NULL; + /* Qmetadata handle */ + ivas_qmetadata_close( &st_ivas->hQMetaData ); + + /* MCT handle */ + ivas_mct_dec_close( &st_ivas->hMCT ); + + /* LFE handle */ + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); + + /* Param-Upmix MC handle */ + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); + + /* Parametric MC handle */ + ivas_param_mc_dec_close( &st_ivas->hParamMC ); + + /* EFAP handle */ + efap_free_data( &st_ivas->hEFAPdata ); + + /* VBAP handle */ + vbap_free_data( &( st_ivas->hVBAPdata ) ); + + /* Fastconv binaural renderer handle */ + ivas_binRenderer_close( &st_ivas->hBinRenderer ); + + /* Parametric binaural renderer handle */ + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + + /* Crend handle */ + + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); + + /* Reverb handle */ + ivas_reverb_close( &st_ivas->hReverb ); + + /* LS config converter handle */ + ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); + + /* Custom LS configuration handle */ + IF ( st_ivas->hLsSetupCustom != NULL ) + { + free( st_ivas->hLsSetupCustom ); + st_ivas->hLsSetupCustom = NULL; + } + + /* Mono downmix structure */ + ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); + + /* OSBA structure */ + ivas_osba_data_close( &st_ivas->hSbaIsmData ); + + /* OMASA structure */ + ivas_omasa_data_close( &st_ivas->hMasaIsmData ); + + /* Head track data handle */ + ivas_headTrack_close( &st_ivas->hHeadTrackData ); + + /* External orientation data handle */ + ivas_external_orientation_close( &st_ivas->hExtOrientationData ); + + /* Combined orientation data handle */ + ivas_combined_orientation_close( &st_ivas->hCombinedOrientationData ); + + /* Time Domain binaural renderer handle */ + IF ( st_ivas->hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + } + ELSE IF ( st_ivas->hHrtfTD != NULL ) + { + BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); + ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); + } + + /* CRend binaural renderer handle */ + ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); + + /* Fastconv HRTF memories */ + ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv ); + + /* Fastconv HRTF filters */ + ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); + + /* Parametric binauralizer HRTF filters */ + ivas_HRTF_parambin_binary_close(&st_ivas->hHrtfParambin); + + /* Config. Renderer */ + ivas_render_config_close( &( st_ivas->hRenderConfig ) ); + + /* Limiter struct */ + ivas_limiter_close( &( st_ivas->hLimiter ) ); + + IF ( st_ivas->hDecoderConfig != NULL ) + { + free( st_ivas->hDecoderConfig ); + st_ivas->hDecoderConfig = NULL; + } + + ivas_jbm_dec_tc_buffer_close( &st_ivas->hTcBuffer ); + + IF ( st_ivas->hJbmMetadata != NULL ) + { + free( st_ivas->hJbmMetadata ); + st_ivas->hJbmMetadata = NULL; + } /* floating-point output audio buffers */ FOR ( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { - st_ivas->p_output_f[i] = NULL; -#ifdef IVAS_FLOAT_FIXED - st_ivas->p_output_fx[i] = NULL; -#endif + IF ( st_ivas->p_output_f[i] != NULL ) + { + free( st_ivas->p_output_f[i] ); + st_ivas->p_output_f[i] = NULL; + } } + /* main IVAS handle */ + free( st_ivas ); + return; } - - -/*------------------------------------------------------------------------- - * ivas_destroy_dec() - * - * Close IVAS decoder handles - *-------------------------------------------------------------------------*/ - -void ivas_destroy_dec( +#else +void ivas_destroy_dec_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) { @@ -3981,7 +4477,7 @@ void ivas_destroy_dec( { IF ( st_ivas->cldfbAnaDec[i] != NULL ) { - deleteCldfb_ivas( &( st_ivas->cldfbAnaDec[i] ) ); + deleteCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ) ); } } @@ -3989,7 +4485,7 @@ void ivas_destroy_dec( { IF ( st_ivas->cldfbSynDec[i] != NULL ) { - deleteCldfb_ivas( &( st_ivas->cldfbSynDec[i] ) ); + deleteCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ) ); } } @@ -4020,7 +4516,6 @@ void ivas_destroy_dec( } /* HP20 filter handles */ -#ifdef IVAS_FLOAT_FIXED IF( st_ivas->mem_hp20_out_fx != NULL ) { FOR( i = 0; i < getNumChanSynthesis( st_ivas ); i++ ) @@ -4031,18 +4526,6 @@ void ivas_destroy_dec( free( st_ivas->mem_hp20_out_fx ); st_ivas->mem_hp20_out_fx = NULL; } -#else - IF(st_ivas->mem_hp20_out != NULL) - { - FOR(i = 0; i < getNumChanSynthesis(st_ivas); i++) - { - free(st_ivas->mem_hp20_out[i]); - st_ivas->mem_hp20_out[i] = NULL; - } - free(st_ivas->mem_hp20_out); - st_ivas->mem_hp20_out = NULL; - } -#endif /* ISM metadata handles */ ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); @@ -4052,23 +4535,13 @@ void ivas_destroy_dec( /* DirAC handle */ IF ( st_ivas->ivas_format == ISM_FORMAT ) { -#ifdef IVAS_FLOAT_FIXED ivas_param_ism_dec_close_fx( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); -#else - ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); -#endif } ELSE { -#ifdef IVAS_FLOAT_FIXED ivas_dirac_rend_close_fx(&(st_ivas->hDirACRend)); ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); -#else - ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_hSpatParamRendCom_close(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close(&(st_ivas->hDirAC)); -#endif } /* SPAR handle */ @@ -4082,11 +4555,7 @@ void ivas_destroy_dec( } /* MASA decoder structure */ -#ifdef IVAS_FLOAT_FIXED ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); -#else - ivas_masa_dec_close( &( st_ivas->hMasa ) ); -#endif /* Qmetadata handle */ ivas_qmetadata_close( &st_ivas->hQMetaData ); @@ -4095,38 +4564,22 @@ void ivas_destroy_dec( ivas_mct_dec_close( &st_ivas->hMCT ); /* LFE handle */ -#ifdef IVAS_FLOAT_FIXED ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); -#else - ivas_lfe_dec_close( &( st_ivas->hLFE ) ); -#endif // IVAS_FLOAT_FIXED /* Param-Upmix MC handle */ ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); /* Parametric MC handle */ -#ifdef IVAS_FLOAT_FIXED ivas_param_mc_dec_close_fx( &st_ivas->hParamMC ); -#else - ivas_param_mc_dec_close( &st_ivas->hParamMC ); -#endif /* EFAP handle */ efap_free_data( &st_ivas->hEFAPdata ); /* VBAP handle */ -#ifdef IVAS_FLOAT_FIXED vbap_free_data_fx(&(st_ivas->hVBAPdata)); -#else - vbap_free_data( &( st_ivas->hVBAPdata ) ); -#endif /* Fastconv binaural renderer handle */ -#ifdef IVAS_FLOAT_FIXED ivas_binRenderer_close_fx( &st_ivas->hBinRenderer ); -#else - ivas_binRenderer_close( &st_ivas->hBinRenderer ); -#endif /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); @@ -4139,11 +4592,7 @@ void ivas_destroy_dec( ivas_reverb_close( &st_ivas->hReverb ); /* LS config converter handle */ -#ifdef IVAS_FLOAT_FIXED ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); -#else - ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); -#endif /* Custom LS configuration handle */ IF ( st_ivas->hLsSetupCustom != NULL ) @@ -4156,18 +4605,10 @@ void ivas_destroy_dec( ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); /* OSBA structure */ -#ifdef IVAS_FLOAT_FIXED ivas_osba_data_close_fx( &st_ivas->hSbaIsmData ); -#else - ivas_osba_data_close( &st_ivas->hSbaIsmData ); -#endif /* OMASA structure */ -#ifdef IVAS_FLOAT_FIXED ivas_omasa_data_close_fx( &st_ivas->hMasaIsmData ); -#else - ivas_omasa_data_close( &st_ivas->hMasaIsmData ); -#endif /* Head track data handle */ ivas_headTrack_close( &st_ivas->hHeadTrackData ); @@ -4181,48 +4622,28 @@ void ivas_destroy_dec( /* Time Domain binaural renderer handle */ IF ( st_ivas->hBinRendererTd != NULL ) { -#ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); -#else - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); -#endif } ELSE IF ( st_ivas->hHrtfTD != NULL ) { +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); -#ifdef IVAS_FLOAT_FIXED - BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); #endif -#ifdef IVAS_FLOAT_FIXED + BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD ); -#else - ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); -#endif } /* CRend binaural renderer handle */ -#ifdef IVAS_FLOAT_FIXED ivas_HRTF_CRend_binary_close_fx( &st_ivas->hSetOfHRTF ); -#else - ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); -#endif /* Fastconv HRTF memories */ ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv ); -#ifdef IVAS_FLOAT_FIXED /* Fastconv HRTF filters */ ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv ); /* Parametric binauralizer HRTF filters */ ivas_HRTF_parambin_binary_close_fx( &st_ivas->hHrtfParambin ); -#else - /* Fastconv HRTF filters */ - ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); - - /* Parametric binauralizer HRTF filters */ - ivas_HRTF_parambin_binary_close(&st_ivas->hHrtfParambin); -#endif /* Config. Renderer */ ivas_render_config_close( &( st_ivas->hRenderConfig ) ); @@ -4247,18 +4668,18 @@ void ivas_destroy_dec( /* floating-point output audio buffers */ FOR ( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { +#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED IF ( st_ivas->p_output_f[i] != NULL ) { free( st_ivas->p_output_f[i] ); st_ivas->p_output_f[i] = NULL; } -#ifdef IVAS_FLOAT_FIXED +#endif IF(st_ivas->p_output_fx[i] != NULL) { free(st_ivas->p_output_fx[i]); st_ivas->p_output_fx[i] = NULL; } -#endif } /* main IVAS handle */ @@ -4266,7 +4687,7 @@ void ivas_destroy_dec( return; } - +#endif /*-------------------------------------------------------------------* * ivas_init_dec_get_num_cldfb_instances() diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2666c13d5..ad50220ce 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -3333,14 +3333,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->hTcBuffer->tc_fx[ind1][ind2] = (Word32) ( st_ivas->hTcBuffer->tc[ind1][ind2] * ( 1 << q ) ); } } - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } ivas_ism_render_sf_fx( st_ivas, p_output_fx, *nSamplesRendered ); FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) @@ -3764,15 +3756,6 @@ ivas_error ivas_jbm_dec_render( } } - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } - ivas_ism_render_sf_fx( st_ivas, p_output_fx, *nSamplesRendered ); FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) { @@ -3805,16 +3788,6 @@ ivas_error ivas_jbm_dec_render( } } } - IF(st_ivas->hCombinedOrientationData) - { - FOR(Word16 ind1 = 0; ind1 < 3; ind1++) - { - FOR(Word16 ind2 = 0; ind2 < 3; ind2++) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32)(st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * (1 << 15)); - } - } - } IF((error = ivas_osba_render_sf_fx(st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx)) != IVAS_ERR_OK) { return error; @@ -4508,22 +4481,6 @@ ivas_error ivas_jbm_dec_render( } } //ftf for ivas_binRenderer_fx - if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) - { - if (st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] && st_ivas->hBinRenderer->rotInCldfb) - { - if (st_ivas->hBinRenderer->hInputSetup->is_loudspeaker_setup == 0) - { - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i][j] = (Word32)floatToFixed(st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][i][j], 30); - } - } - } - } - } /* CLDFB synthesis */ for (int ch = 0; ch < nchan_out_cldfb; ch++) { diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index fe17075e1..2e30eff0c 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -783,20 +783,6 @@ static void ivas_mc_paramupmix_dec_sf( } } - - //to be deleted - if (st_ivas->hCombinedOrientationData) - { - for ( i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - - st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i][j] = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][i][j], 30); - } - } - } - /* Implement binaural rendering */ Word16 input_q = 6; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 183e03395..eac88cf6d 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -54,6 +54,8 @@ *-----------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_mc_dec_reconfig_fx( Decoder_Struct *st_ivas, UWord16 *nSamplesRendered, Word16 *data ); +#else static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, int16_t *data ); #endif @@ -1366,7 +1368,7 @@ ivas_error ivas_mc_dec_config_fx( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = shl_sat( st_ivas->hRenderConfig->directivity_fx[i * 3 + 2], 9 ); } } - IF ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_mc_dec_reconfig_fx( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } @@ -1433,13 +1435,15 @@ ivas_error ivas_mc_dec_config( } #endif + /*------------------------------------------------------------------------- * ivas_mc_dec_reconfig() * * reconfigure the MC format decoder *-------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED -static ivas_error ivas_mc_dec_reconfig( +static ivas_error ivas_mc_dec_reconfig_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ UWord16 *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ Word16 *data /* o : output synthesis signal */ @@ -2072,11 +2076,10 @@ static ivas_error ivas_mc_dec_reconfig( return error; } #else - static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; @@ -2104,12 +2107,7 @@ static ivas_error ivas_mc_dec_reconfig( ivas_init_dec_get_num_cldfb_instances() returns the correct counts */ mc_mode = st_ivas->mc_mode; st_ivas->mc_mode = last_mc_mode; -#ifdef IVAS_FLOAT_FIXED - ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); -#else ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); -#endif // IVAS_FLOAT_FIXED - st_ivas->mc_mode = mc_mode; nSCE_old = st_ivas->nSCE; @@ -2139,166 +2137,42 @@ static ivas_error ivas_mc_dec_reconfig( /* side effect of the renderer selection can be a changed internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( last_mc_mode == MC_MODE_PARAMMC ) - { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hParamMC->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hParamMC->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; -#ifdef IVAS_FLOAT_FIXED - Copy( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#else - mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif - } - else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; -#ifdef IVAS_FLOAT_FIXED - Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#else - mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif - } - - /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv - render what still fits in the new granularity */ -#ifdef IVAS_FLOAT_FIXED - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); -#else - tc_granularity_new = ivas_jbm_dec_get_render_granularity_flt( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); -#endif - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*Float to fixed conversion*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } - if ( st_ivas->hSbaIsmData ) - { - for ( Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++ ) - { - floatToFixed_arr32( st_ivas->hSbaIsmData->delayBuffer[ch_idx], st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], Q11, st_ivas->hSbaIsmData->delayBuffer_size ); - } - } - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in = 0, numch_out, num_md_sub_frames; - ; - Word16 numch_out_dirac = hDecoderConfig->nchan_out; - IF( hSpar ) - { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - hSpar->hMdDec->Q_mixer_mat = 30; - - for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); - } - } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] = float_to_fix( st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] , Q11 ); - } - } - } - } - Word16 n_tc; - if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for (int ch = 0; ch < n_tc; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } -#endif - if ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 /*Fixed to float */ - if ( hTcBuffer->tc_buffer ) - fixedToFloat_arrL( hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len ); - IF( hSpar ) - { - FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); - } - } + /* transfer subframe info from DirAC or ParamMC to central tc buffer */ + if ( last_mc_mode == MC_MODE_PARAMMC ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hParamMC->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hParamMC->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; + mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); - } - } - } - } -#endif -#else + /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv + render what still fits in the new granularity */ + tc_granularity_new = ivas_jbm_dec_get_render_granularity_flt( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); + if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) + { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED + { + return error; } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) + } + /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ + else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) + { + if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } + } if ( st_ivas->mc_mode == MC_MODE_MCT ) { @@ -2314,60 +2188,34 @@ static ivas_error ivas_mc_dec_reconfig( ivas_param_mc_dec_close( &st_ivas->hParamMC ); /* remove ls conversion if it was allocated by ParamMC */ -#ifdef IVAS_FLOAT_FIXED - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); -#else ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); -#endif } if ( last_mc_mode == MC_MODE_PARAMUPMIX ) { ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); -#ifdef IVAS_FLOAT_FIXED - ivas_ls_setup_conversion_close_fx( &( st_ivas->hLsSetUpConversion ) ); -#else ivas_ls_setup_conversion_close( &( st_ivas->hLsSetUpConversion ) ); -#endif } /* De-allocate McMasa-related handles */ -#ifdef IVAS_FLOAT_FIXED - ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); -#else ivas_masa_dec_close( &( st_ivas->hMasa ) ); -#endif - ivas_qmetadata_close( &st_ivas->hQMetaData ); + if ( st_ivas->hDirAC != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); - ivas_spat_hSpatParamRendCom_close_fx(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close_fx(&(st_ivas->hDirAC)); - vbap_free_data_fx(&(st_ivas->hVBAPdata)); -#else - ivas_dirac_rend_close(&(st_ivas->hDirACRend)); - ivas_spat_hSpatParamRendCom_close(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close(&(st_ivas->hDirAC)); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); -#endif } /* init LS conversion if the renderer type asks for it */ if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#endif } } } @@ -2385,34 +2233,19 @@ static ivas_error ivas_mc_dec_reconfig( ivas_param_mc_dec_close( &st_ivas->hParamMC ); /* remove ls conversion if it was allocated by ParamMC */ -#ifdef IVAS_FLOAT_FIXED - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); -#else ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); -#endif } -#ifdef IVAS_FLOAT_FIXED - ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); -#else ivas_masa_dec_close( &( st_ivas->hMasa ) ); -#endif ivas_qmetadata_close( &st_ivas->hQMetaData ); /* init LS conversion if the renderer type asks for it */ if ( ( st_ivas->renderer_type == RENDERER_MC ) && st_ivas->hLsSetUpConversion == NULL ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#endif } if ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -2428,11 +2261,7 @@ static ivas_error ivas_mc_dec_reconfig( /* remove old ls conversion for MCT if open, gets reopened correctly within ivas_param_mc_dec_open when needed */ if ( renderer_type_old == RENDERER_MC && st_ivas->hLsSetUpConversion != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); -#else ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); -#endif } if ( ( error = ivas_param_mc_dec_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -2442,170 +2271,23 @@ static ivas_error ivas_mc_dec_reconfig( } else { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*TODO: To be removed later (i/o: Float to fixed conversions) */ - PARAM_MC_DEC_HANDLE hParamMC; - hParamMC = st_ivas->hParamMC; - Word16 nchan_out_transport, nchan_out_cov; - MC_LS_SETUP mc_ls_setup; - Word16 nchan_transport; - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); - st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); - nchan_transport = st_ivas->nchan_transport; - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - Word16 cx_e=0, cy_e=0, mmo_e=0, mmro_e=0; - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - } - else - { - nchan_out_cov = nchan_out_transport; - } - if ( st_ivas->hLsSetUpConversion ) - { - for ( Word16 k = 0; k < nchan_out_transport; k++ ) - { - //floatToFixed_arr32( st_ivas->hLsSetUpConversion->dmxMtx[k], st_ivas->hLsSetUpConversion->dmxMtx_fx[k], Q30, nchan_out_cov ); - } - } - if ( st_ivas->hParamMC ) - { - floatToFixed_arr( hParamMC->icc_q, hParamMC->icc_q_fx, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - floatToFixed_arr( hParamMC->icld_q, hParamMC->icld_q_fx, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - //if ( hParamMC->ls_conv_dmx_matrix ) - // floatToFixed_arr32( hParamMC->ls_conv_dmx_matrix, hParamMC->ls_conv_dmx_matrix_fx, Q31, nchan_out_cov * nchan_out_transport ); - Word32 max_cx_old_fx, max_cy_old_fx, max_mix_matrix_old_fx, max_mix_matrix_res_old_fx; - float max_cx_old = hParamMC->h_output_synthesis_cov_state.cx_old[0][0], max_cy_old = hParamMC->h_output_synthesis_cov_state.cy_old[0][0], max_mix_matrix_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[0][0], max_mix_matrix_res_old = hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[0][0]; - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) - { - for ( int j = 0; j < nchan_transport_old * nchan_transport_old; j++ ) - max_cx_old = max( max_cx_old, hParamMC->h_output_synthesis_cov_state.cx_old[i][j] ); - for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) - max_cy_old = max( max_cy_old, hParamMC->h_output_synthesis_cov_state.cy_old[i][j] ); - for ( int j = 0; j < nchan_transport_old * nchan_out_cov; j++ ) - max_mix_matrix_old = max( max_mix_matrix_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i][j] ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - for ( int j = 0; j < nchan_out_cov * nchan_out_cov; j++ ) - max_mix_matrix_res_old = max( max_mix_matrix_res_old, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i][j] ); - } - } - f2me( max_cx_old, &max_cx_old_fx, &cx_e ); - f2me( max_cy_old, &max_cy_old_fx, &cy_e ); - f2me( max_mix_matrix_old, &max_mix_matrix_old_fx, &mmo_e ); - f2me( max_mix_matrix_res_old, &max_mix_matrix_res_old_fx, &mmro_e ); - if ( mmo_e < 0 ) - mmo_e = 0; - if ( mmro_e < 0 ) - mmro_e = 0; - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) - { - - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cx_old[i], hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.cy_old[i], hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - floatToFixed_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); - } - } - floatToFixed_arr16( hParamMC->h_output_synthesis_params.interpolator, hParamMC->h_output_synthesis_params.interpolator_fx, 15, DEFAULT_JBM_CLDFB_TIMESLOTS ); - floatToFixed_arrL( hParamMC->proto_matrix_int, hParamMC->proto_matrix_int_fx, Q31, nchan_out_transport * nchan_transport ); - FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - if ( hParamMC->diff_proto_info ) - floatToFixed_arrL( hParamMC->diff_proto_info->proto_fac[i], hParamMC->diff_proto_info->proto_fac_fx[i], 31, hParamMC->diff_proto_info->num_source_chan_diff[i] ); - } - } -#endif - if ( ( error = ivas_param_mc_dec_reconfig_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 - if ( hParamMC ) - { - fixedToFloat_arr( hParamMC->icc_q_fx, hParamMC->icc_q, Q15, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); - fixedToFloat_arr( hParamMC->icld_q_fx, hParamMC->icld_q, Q8, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); - fixedToFloat_arr( hParamMC->h_output_synthesis_params.interpolator_fx, hParamMC->h_output_synthesis_params.interpolator, 15, DEFAULT_JBM_CLDFB_TIMESLOTS ); - for ( int i = 0; i < hParamMC->hMetadataPMC->num_parameter_bands; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.cx_old[i] ) - { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cx_old_fx[i], hParamMC->h_output_synthesis_cov_state.cx_old[i], 31 - cx_e, nchan_transport_old * nchan_transport_old ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.cy_old_fx[i], hParamMC->h_output_synthesis_cov_state.cy_old[i], 31 - cy_e, nchan_out_cov * nchan_out_cov ); - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_old[i], 31 - mmo_e, nchan_transport_old * nchan_out_cov ); - } - } - for ( int i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - if ( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i] ) - { - fixedToFloat_arrL( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old_fx[i], hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_old[i], 31 - mmro_e, nchan_out_cov * nchan_out_cov ); - } - } - fixedToFloat_arrL( hParamMC->h_output_synthesis_params.proto_matrix_fx, hParamMC->h_output_synthesis_params.proto_matrix, 31, nchan_transport * nchan_out_cov ); - FOR( Word16 i = 0; i < hParamMC->diff_proto_info->num_protos_diff; i++ ) - { - fixedToFloat_arrL( hParamMC->diff_proto_info->proto_fac_fx[i], hParamMC->diff_proto_info->proto_fac[i], 31, hParamMC->diff_proto_info->num_source_chan_diff[i] ); - } - if ( st_ivas->hLsSetUpConversion ) - { - for (Word16 k = 0; k < nchan_transport; k++ ) - { - for ( int16_t i = 0; i < nchan_out_cov; i++ ) - { - //st_ivas->hLsSetUpConversion->dmxMtx[k][i] = fixedToFloat( st_ivas->hLsSetUpConversion->dmxMtx_fx[k][i], Q30 ); - } - } - } - fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport ); - //if ( hParamMC->ls_conv_dmx_matrix ) - // fixedToFloat_arrL( hParamMC->ls_conv_dmx_matrix_fx, hParamMC->ls_conv_dmx_matrix, Q31, nchan_out_transport * nchan_out_cov ); - } -#endif -#else if ( ( error = ivas_param_mc_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED } /* De-allocate McMasa-related handles */ -#ifdef IVAS_FLOAT_FIXED - ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); -#else ivas_masa_dec_close( &( st_ivas->hMasa ) ); -#endif ivas_qmetadata_close( &st_ivas->hQMetaData ); if ( st_ivas->hDirAC != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_rend_close_fx(&(st_ivas->hDirACRend)); - ivas_spat_hSpatParamRendCom_close_fx(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close_fx(&(st_ivas->hDirAC)); - vbap_free_data_fx(&(st_ivas->hVBAPdata)); -#else ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); - ivas_spat_hSpatParamRendCom_close(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close(&(st_ivas->hDirAC)); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + vbap_free_data( &( st_ivas->hVBAPdata ) ); -#endif } if ( last_mc_mode == MC_MODE_MCT ) @@ -2621,19 +2303,11 @@ static ivas_error ivas_mc_dec_reconfig( } /* LFE handle */ -#ifdef IVAS_FLOAT_FIXED - ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); -#else ivas_lfe_dec_close( &( st_ivas->hLFE ) ); -#endif // IVAS_FLOAT_FIXED } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { -#ifdef IVAS_FLOAT_FIXED - ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); -#else ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); -#endif if ( last_mc_mode != MC_MODE_MCMASA ) { @@ -2651,11 +2325,7 @@ static ivas_error ivas_mc_dec_reconfig( /* LS conversion */ if ( st_ivas->hLsSetUpConversion != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); -#else ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); -#endif } ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); @@ -2672,11 +2342,7 @@ static ivas_error ivas_mc_dec_reconfig( } /* LFE handle */ -#ifdef IVAS_FLOAT_FIXED - ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) ); -#else ivas_lfe_dec_close( &( st_ivas->hLFE ) ); -#endif // IVAS_FLOAT_FIXED } if ( st_ivas->mc_mode != MC_MODE_MCMASA ) @@ -2719,20 +2385,7 @@ static ivas_error ivas_mc_dec_reconfig( } st->igf = 0; -#ifdef IVAS_FLOAT_FIXED - init_igf_dec( st->hIGFDec ); -#if 1/*TODO: To be removed later(floating point initialization)*/ -#ifndef IVAS_FLOAT_FIXED - st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; - st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; - set_f( st->hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX ); -#endif - FOR(Word16 l = 0; l < IGF_START_MX; l++ ) - st->hIGFDec->infoTCXNoiseBuf[l] = (uint8_t) st->hIGFDec->infoTCXNoise_evs[l]; -#endif -#else init_igf_dec_flt( st->hIGFDec ); -#endif // IVAS_FLOAT_FIXED } if ( st->hHQ_core == NULL ) @@ -2743,14 +2396,7 @@ static ivas_error ivas_mc_dec_reconfig( } /* HQ core initialization */ -#if 1 HQ_core_dec_init_flt( st->hHQ_core ); -#endif -#ifdef IVAS_FLOAT_FIXED - HQ_core_dec_init_fx(st->hHQ_core); -#endif // IVAS_FLOAT_FIXED - - } /* check if we have a doubly used hTxcCfg, if so, allocate a distint one for the old MCT LFE channel */ @@ -2768,13 +2414,8 @@ static ivas_error ivas_mc_dec_reconfig( { uint8_t separateChannelEnabled; int16_t separateChannelIndex; -#ifdef IVAS_FLOAT_FIXED - ivas_mcmasa_set_separate_channel_mode_fx( &separateChannelEnabled, &separateChannelIndex, ivas_total_brate ); - ivas_mcmasa_split_brate_fx( separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); -#else ivas_mcmasa_set_separate_channel_mode( &separateChannelEnabled, &separateChannelIndex, ivas_total_brate ); ivas_mcmasa_split_brate( separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); -#endif } else if ( st_ivas->mc_mode == MC_MODE_MCT ) { @@ -2792,17 +2433,10 @@ static ivas_error ivas_mc_dec_reconfig( new_brate_CPE = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; } -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE ) ) != IVAS_ERR_OK ) { return error; } -#endif if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { @@ -2815,38 +2449,19 @@ static ivas_error ivas_mc_dec_reconfig( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } -#ifdef IVAS_FLOAT_FIXED - tcxltp_dec_init_fx( st->hTcxLtpDec, 0, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core ); - - IF( st->ini_frame == 0 || ( EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->element_mode, EVS_MONO ) ) ) - { - IF( st->ini_frame == 0 ) - { - //fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_in, st->hTcxLtpDec->tcxltp_mem_in_float, 0, TCXLTP_MAX_DELAY ); - //fixedToFloat_arr( st->hTcxLtpDec->tcxltp_mem_out, st->hTcxLtpDec->tcxltp_mem_out_float, 0, L_FRAME48k ); - } - } -#else tcxltp_dec_init( st->hTcxLtpDec, 0, st->last_codec_mode, st->element_mode, st->pit_max, st->sr_core ); -#endif // IVAS_FLOAT_FIXED } } /*-----------------------------------------------------------------* * re-configure HP20 memories *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - if ( (error = ivas_hp20_dec_reconfig_fx(st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK) - { - return error; - } -#else // IVAS_FLOAT_FIXED - /*To be removed later: Contains memory allocations for floating point buffers*/ + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) { return error; } -#endif + /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded separately after the allocation of the core coders *-----------------------------------------------------------------*/ @@ -2867,22 +2482,13 @@ static ivas_error ivas_mc_dec_reconfig( } } -#ifdef IVAS_FLOAT_FIXED - IF ( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) -#endif // IVAS_FLOAT_FIXED { return error; } -#ifndef IVAS_FLOAT_FIXED set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); -#else - set32_fx(st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN); - set32_fx(st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k); -#endif // IVAS_FLOAT_FIXED } /*-----------------------------------------------------------------* @@ -2896,11 +2502,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hDirAC != NULL ) { /* reconfigure existing DirAC dec */ -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2908,11 +2510,7 @@ static ivas_error ivas_mc_dec_reconfig( else { /* init a new DirAC dec */ -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2920,21 +2518,11 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); -#else ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); -#endif // IVAS_FLOAT_FIXED + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); -#ifdef IVAS_FLOAT_FIXED - ivas_spat_hSpatParamRendCom_close_fx(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close_fx(&(st_ivas->hDirAC)); - vbap_free_data_fx(&(st_ivas->hVBAPdata)); -#else - ivas_spat_hSpatParamRendCom_close(&(st_ivas->hSpatParamRendCom)); - ivas_dirac_dec_close(&(st_ivas->hDirAC)); vbap_free_data( &( st_ivas->hVBAPdata ) ); -#endif } } @@ -2945,8 +2533,7 @@ static ivas_error ivas_mc_dec_reconfig( output_config = st_ivas->hDecoderConfig->output_config; /* binaural renderers*/ - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { /* remove unneeded binaural renderers */ if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) @@ -2962,11 +2549,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { -#ifdef IVAS_FLOAT_FIXED - ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); -#else ivas_td_binaural_close( &st_ivas->hBinRendererTd ); -#endif // IVAS_FLOAT_FIXED st_ivas->hHrtfTD = NULL; } @@ -2988,84 +2571,11 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->hBinRendererTd == NULL && st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*Cleanup changes: float to fixed */ - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - FOR( Word16 i = 0; i < 4; i++ ) - { - st_ivas->hRenderConfig->directivity_fx[i * 3] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 1] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 1], 6 ); - st_ivas->hRenderConfig->directivity_fx[i * 3 + 2] = (Word16) floatToFixed( st_ivas->hRenderConfig->directivity[i * 3 + 2], 15 ); - } -#endif - IF( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, &num_src ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float - st_ivas->hBinRendererTd->Gain = 1.0f; /*1.0f Q15*/ - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Pos_fx, st_ivas->hBinRendererTd->Listener_p->Pos, st_ivas->hBinRendererTd->Listener_p->Pos_q, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Vel_fx, st_ivas->hBinRendererTd->Listener_p->Vel, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Front_fx, st_ivas->hBinRendererTd->Listener_p->Front, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Up_fx, st_ivas->hBinRendererTd->Listener_p->Up, Q30, 3 ); - fixedToFloat_arrL( st_ivas->hBinRendererTd->Listener_p->Right_fx, st_ivas->hBinRendererTd->Listener_p->Right, Q30, 3 ); - TDREND_DirAtten_t *DirAtten_p = st_ivas->hBinRendererTd->DirAtten_p; - DirAtten_p->ConeInnerAngle = fix_to_float( DirAtten_p->ConeInnerAngle_fx, Q22 ); - DirAtten_p->ConeOuterAngle = fix_to_float( DirAtten_p->ConeOuterAngle_fx, Q22 ); - DirAtten_p->ConeOuterGain = fix_to_float( DirAtten_p->ConeOuterGain_fx, Q30 ); - Word16 nchan_rend = num_src; - IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p->SrcSpatial_p != NULL ) - { - Src_p->SrcSpatial_p->DirAtten.ConeInnerAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterAngle = 360.0f; - Src_p->SrcSpatial_p->DirAtten.ConeOuterGain = 1.0f; - Src_p->SrcSpatial_p->DistAtten.RefDist = 1.0f; - Src_p->SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ - Src_p->SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, 15, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, 15, 3 ); - } - } - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - Src_p->SrcRend_p->SrcGainMin_p[nC] = 0.0f; - Src_p->SrcRend_p->SrcGainMax_p[nC] = 1.0f; - } - set_f( Src_p->mem_itd, 0.0f, ITD_MEM_LEN ); - set_f( Src_p->mem_hrf_left, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->mem_hrf_right, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 ); - set_f( Src_p->hrf_left_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - set_f( Src_p->hrf_right_prev, 0.0f, SFX_SPAT_BIN_MAX_FILTER_LENGTH ); - Src_p->hrf_left_prev[0] = 1; - Src_p->hrf_right_prev[0] = 1; - Src_p->azim_prev = 0.0f; - Src_p->elev_prev = 0.0f; - Src_p->Gain = 1.0f; - Src_p->prevGain = 1.0f; - TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, 31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, 31, 3 ); - SrcSpatial_p->DirAtten.ConeInnerAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeInnerAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterAngle = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterAngle_fx, Q22 ); - SrcSpatial_p->DirAtten.ConeOuterGain = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterGain_fx, Q30 ); - } -#endif -#else if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#endif + if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) @@ -3083,30 +2593,10 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ - RENDER_CONFIG_DATA *hRendCfg = st_ivas->hRenderConfig; - HRTFS_CREND_HANDLE hSetOfHRTF = st_ivas->hSetOfHRTF; - IF( hSetOfHRTF ) - { - hSetOfHRTF->hHRTF_brir_combined->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_brir_combined->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_foa->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_foa->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_combined->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_combined->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_hoa3->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa3->latency_s, 31 ); - hSetOfHRTF->hHRTF_hrir_hoa2->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa2->latency_s, 31 ); - } -#endif // 1 if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#ifdef IVAS_FLOAT_FIXED/*Cleanup changes: fixed to float*/ - IF(st_ivas->hCrendWrapper && st_ivas->hCrendWrapper->hHrtfCrend != NULL ) - { - st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); - st_ivas->hCrendWrapper->hHrtfCrend->latency_s = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->latency_s_fx, 31 ); - fixedToFloat_arr( st_ivas->hCrendWrapper->hHrtfCrend->inv_diffuse_weight_fx, st_ivas->hCrendWrapper->hHrtfCrend->inv_diffuse_weight, 15, 16 ); - } -#endif st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; } } @@ -3125,46 +2615,10 @@ static ivas_error ivas_mc_dec_reconfig( * CLDFB instances *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED1 -#if 1 /*Cleanup changes: float to fixed*/ - Word16 i, Q_cldfbSynDec = 21; - FOR( i = 0; i < 16; i++ ) - { - IF( st_ivas->cldfbAnaDec[i] ) - floatToFixed_arrL( st_ivas->cldfbAnaDec[i]->cldfb_state, st_ivas->cldfbAnaDec[i]->cldfb_state_fx, 11, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } - IF( st_ivas->hSpar ) - { - st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_factor_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, CLDFB_NO_COL_MAX ); - floatToFixed_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q, CLDFB_NO_COL_MAX ); - } - IF( st_ivas->cldfbSynDec[0] ) - { - Q_cldfbSynDec = s_min( Q_cldfbSynDec, Q_factor_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ) ); - floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } -#endif - if ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 /*CCleanup changes:fixed to float changes*/ - FOR( i = 0; i < 16; i++ ) - { - IF( st_ivas->cldfbAnaDec[i] ) - fixedToFloat_arrL( st_ivas->cldfbAnaDec[i]->cldfb_state_fx, st_ivas->cldfbAnaDec[i]->cldfb_state, 11, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } - IF( st_ivas->cldfbSynDec[0] ) - { - fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } -#endif -#else if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * JBM TC buffers @@ -3176,11 +2630,7 @@ static ivas_error ivas_mc_dec_reconfig( hTcBuffer = st_ivas->hTcBuffer; tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); -#ifdef IVAS_FLOAT_FIXED - tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); -#else tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); -#endif // IVAS_FLOAT_FIXED tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; @@ -3212,17 +2662,10 @@ static ivas_error ivas_mc_dec_reconfig( hTcBuffer->nchan_buffer_full != tc_nchan_full_new || hTcBuffer->nchan_transport_internal != tc_nchan_allocate_new || tc_granularity_new != hTcBuffer->n_samples_granularity ) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED } /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ if ( st_ivas->hSpatParamRendCom != NULL ) @@ -3231,11 +2674,7 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; -#ifdef IVAS_FLOAT_FIXED - Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#else mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif // IVAS_FLOAT_FIXED } else if ( st_ivas->hParamMC != NULL ) { @@ -3243,11 +2682,7 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hParamMC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; st_ivas->hParamMC->num_slots = st_ivas->hTcBuffer->num_slots; st_ivas->hParamMC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; -#ifdef IVAS_FLOAT_FIXED - Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#else mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif } } @@ -3256,23 +2691,12 @@ static ivas_error ivas_mc_dec_reconfig( * floating-point output audio buffers *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); -#else - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - -#endif + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); -#ifdef IVAS_FLOAT_FIXED - IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED - if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } return error; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index af6a0705f..3ccf653e9 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -327,15 +327,6 @@ ivas_error ivas_omasa_dec_config_fx( { IF(LT_16(n_samples_granularity, st_ivas->hTcBuffer->n_samples_granularity)) { - - IF(st_ivas->hCombinedOrientationData) - FOR(Word16 ind1 = 0; ind1 < 3; ind1++) - { - FOR(Word16 ind2 = 0; ind2 < 3; ind2++) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32)(st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * (1 << 15)); - } - } if (st_ivas->hSbaIsmData) { for (Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 3ea7685a7..771685410 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -53,6 +53,7 @@ * Allocate and initialize SBA_ISM rendering handle *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_osba_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) @@ -86,8 +87,7 @@ ivas_error ivas_osba_data_open( return IVAS_ERR_OK; } - -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_osba_data_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ) @@ -136,12 +136,14 @@ ivas_error ivas_osba_data_open_fx( } #endif + /*-------------------------------------------------------------------* * ivas_osba_data_close() * * Deallocate SBA_ISM rendering handle *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ) @@ -168,8 +170,7 @@ void ivas_osba_data_close( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_osba_data_close_fx( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ) @@ -210,6 +211,7 @@ void ivas_osba_data_close_fx( } #endif + /*--------------------------------------------------------------------------* * ivas_osba_dirac_td_binaural_jbm() * @@ -311,6 +313,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( * * ISM metadata decoding in OSBA format. *-------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED ivas_error ivas_osba_ism_metadata_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -336,7 +339,6 @@ ivas_error ivas_osba_ism_metadata_dec_fx( return IVAS_ERR_OK; } #else - ivas_error ivas_osba_ism_metadata_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int32_t ism_total_brate, /* i : ISM total bitrate */ @@ -361,11 +363,14 @@ ivas_error ivas_osba_ism_metadata_dec( return IVAS_ERR_OK; } #endif + + /*-------------------------------------------------------------------------* * ivas_osba_render_sf() * * Object + SBA rendering process. *-------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED ivas_error ivas_osba_render_sf_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 6cae8ac1e..608dafe55 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1025,14 +1025,6 @@ ivas_error ivas_sba_dec_reconfigure_fx( st_ivas->hIsmMetaData[ind1]->elevation_fx = (Word32) ( st_ivas->hIsmMetaData[ind1]->elevation * ( 1 << 22 ) ); } } - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } if ( st_ivas->hSbaIsmData ) { for ( Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++ ) diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index b448f259f..9974fcc2a 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -443,7 +443,7 @@ void destroy_sce_dec( IF( st != NULL ) { - destroy_core_dec( st ); + destroy_core_dec_fx( st ); free( st ); st = NULL; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ca390f894..3594b9492 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1076,10 +1076,10 @@ typedef struct ivas_spar_dec_lib_t /* Data structure for SBA_ISM rendering */ typedef struct ivas_osba_data { -#ifdef IVAS_FLOAT_FIXED - Word32 **delayBuffer_fx; -#endif // IVAS_FLOAT_FIXED float **delayBuffer; +#ifdef IVAS_FLOAT_FIXED + Word32 **delayBuffer_fx; /* Q11 */ +#endif int16_t delayBuffer_size; int16_t delayBuffer_nchan; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 95a3d4a25..ab8475dfe 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -294,7 +294,7 @@ void IVAS_DEC_Close( IF( ( *phIvasDec )->st_ivas ) { - ivas_destroy_dec( ( *phIvasDec )->st_ivas ); + ivas_destroy_dec_fx( ( *phIvasDec )->st_ivas ); ( *phIvasDec )->st_ivas = NULL; } @@ -451,7 +451,7 @@ ivas_error IVAS_DEC_Configure( /* Set decoder parameters to initial values */ - IF( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_init_decoder_front_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -869,13 +869,6 @@ ivas_error IVAS_DEC_GetSamples( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].x = fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].x_fx, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].y = fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].y_fx, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].z = fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].z_fx, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions[i].q_fact ); - for (Word16 j = 0; j < 3; j++ ) - { - for ( Word16 k = 0; k < 3; k++ ) - { - hIvasDec->st_ivas->hCombinedOrientationData->Rmat[i][j][k] = (float) fixedToFloat_32( hIvasDec->st_ivas->hCombinedOrientationData->Rmat_fx[i][j][k], 30 ); - } - } } hIvasDec->updateOrientation = false; } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index 671e069fe..824311873 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -1864,7 +1864,7 @@ void ivas_swb_tbe_dec_fx( #endif } } - ener_fx = s_max( 1, round_fx( L_shl( L_ener, sub( 19, shl( Q_bwe_exc, 1 ) ) ) ) ); /* Q3: 2*Q_bwe_exc+19-2*Q_bwe_exc-16 */ + ener_fx = s_max( 1, round_fx( L_shl( L_ener, sub( 18, shl( Q_bwe_exc, 1 ) ) ) ) ); /* Q2: 2*Q_bwe_exc+18-2*Q_bwe_exc-16 */ /* WB/SWB bandwidth switching */ IF( st->bws_cnt > 0 ) @@ -1911,10 +1911,10 @@ void ivas_swb_tbe_dec_fx( IF( ener_fx != 0 ) { - L_tmp = L_shl( L_mult0( ener_fx, st->tilt_wb_fx ), sub( st->Q_syn2, 14 ) ); /* 3+11 +st->Q_syn2 -14 = st->Q_syn2*/ + L_tmp = L_shl( L_mult0( ener_fx, st->tilt_wb_fx ), sub( st->Q_syn2, 13 ) ); /* 2+11 +st->Q_syn2 -13 = st->Q_syn2*/ exp_ener = norm_s( ener_fx ); - tmp = shl( ener_fx, exp_ener ); /*Q(3+exp)*/ - inv_ener = div_s( 16384, tmp ); /*Q(15+14-3-exp) = 26- exp*/ + tmp = shl( ener_fx, exp_ener ); /*Q(2+exp)*/ + inv_ener = shr(div_s( 16384, tmp ), 1); /*Q(15+14-2-exp-1) = 26 - exp*/ test(); IF( GT_32( L_tmp, st->enerLH_fx ) ) /*st->Q_syn2*/ @@ -1996,9 +1996,9 @@ void ivas_swb_tbe_dec_fx( { ener_fx = s_max( 1, ener_fx ); exp_ener = norm_s( ener_fx ); - tmp = shl( ener_fx, exp_ener ); /*Q(3+exp)*/ - inv_ener = div_s( 16384, tmp ); /*Q(15+14-3-exp)*/ - prev_ener_ratio_fx = L_shr( L_mult0( st->prev_ener_shb_fx, inv_ener ), sub( 9, exp_ener ) ); /*Q: 1+26-exp-9+exp = 18 */ + tmp = shl( ener_fx, exp_ener ); /*Q(2+exp)*/ + inv_ener = div_s( 16384, tmp ); /*Q(15+14-2-exp)*/ + prev_ener_ratio_fx = L_shr( L_mult0( st->prev_ener_shb_fx, inv_ener ), add( sub( 9, exp_ener ), 1 ) ); /*Q: 1+27-exp-9+exp-1 = 18 */ } IF( st->nbLostCmpt == 1 ) diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index b36d349cb..d248f6266 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -839,6 +839,9 @@ ivas_error ivas_create_lfe_enc( } ivas_lfe_window_init( hLFE->pWindow_state, input_Fs, input_frame ); +#ifdef IVAS_FLOAT_FIXED + ivas_lfe_window_init_fx( hLFE->pWindow_state, input_Fs, input_frame ); +#endif /* Initialization for entropy coding */ hLFE->cum_freq_models[0][0] = ivas_str_lfe_freq_models.entropy_coder_model_fine_sg1; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 037435a67..9fc7edc06 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -3803,9 +3803,9 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( Word32 switchOrderFactor, origOrderFactor; Word16 e_switchOrderFactor, e_origOrderFactor; - hHeadTrackData->lrSwitchInterpVal_fx = L_add( hHeadTrackData->lrSwitchInterpVal_fx, 2684354 ); /* Corresponds to 0.5 seconds interpolation time */ // Q14 + hHeadTrackData->lrSwitchInterpVal_fx = L_add( hHeadTrackData->lrSwitchInterpVal_fx, 2684354 /* 0.0025f in Q30 */ ); /* Corresponds to 0.5 seconds interpolation time */ /* Q30 */ - IF( GT_32( hHeadTrackData->lrSwitchInterpVal_fx, 1072668096 ) ) + IF( GT_32( hHeadTrackData->lrSwitchInterpVal_fx, 1072668096 /* 0.999f in Q30 */ ) ) { /* Stop interpolation, reset values */ hHeadTrackData->lrSwitchInterpVal_fx = 0; @@ -3813,8 +3813,8 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( } /* Gains for determining portion of switched channel order and original channel order */ - tmpVal = Mpy_32_16_1( hHeadTrackData->lrSwitchInterpVal_fx, (Word16) hHeadTrackData->lrSwitchedNext ); // Q15 - tmpVal = L_add( tmpVal, Mpy_32_16_1( L_sub( ONE_IN_Q30, hHeadTrackData->lrSwitchInterpVal_fx ), (Word16) hHeadTrackData->lrSwitchedCurrent ) ); // Q15 + tmpVal = Mpy_32_16_1( hHeadTrackData->lrSwitchInterpVal_fx, (Word16) hHeadTrackData->lrSwitchedNext ); /* Q15 */ + tmpVal = L_add( tmpVal, Mpy_32_16_1( L_sub( ONE_IN_Q30, hHeadTrackData->lrSwitchInterpVal_fx ), (Word16) hHeadTrackData->lrSwitchedCurrent ) ); /* Q15 */ e_switchOrderFactor = 0; e_origOrderFactor = 0; diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 657e633a3..398a63688 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -949,6 +949,10 @@ void ivas_dirac_dec_decorr_process_fx( Word32 *decorr_buffer_start_ptr_fx, *decorr_buffer_ptr_fx; Word32 input_real_fx, input_imag_fx, filter_frame_imag_fx, filter_frame_real_fx; Word16 q_aux_buffer, q_onset_dec, q_frame_f; + Word16 max_band_decorr_temp = h_freq_domain_decorr_ap_params->h_onset_detection_power_params.max_band_decorr; + Word16 q_shift, guarded_bits; + Word32 max_abs_val = 0; + push_wmops( "dirac_decorr_process" ); @@ -991,10 +995,8 @@ void ivas_dirac_dec_decorr_process_fx( /* compute power */ q_onset_dec = h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector; - Word16 max_band_decorr_temp = h_freq_domain_decorr_ap_params->h_onset_detection_power_params.max_band_decorr; - - Word16 q_shift, guarded_bits; guarded_bits = find_guarded_bits_fx( 2 ); +#if 0 FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { v_mult_fixed( &input_frame_fx[2 * ch_idx * num_freq_bands], &input_frame_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], 2 * max_band_decorr_temp ); @@ -1008,6 +1010,28 @@ void ivas_dirac_dec_decorr_process_fx( aux_buffer_fx[j] = L_shl( aux_buffer_fx[j], q_shift ); } q_aux_buffer += q_shift; +#else + (void)maximum_abs_32_fx(&input_frame_fx[0], 2 * num_protos_dir * num_freq_bands, &max_abs_val); + q_shift = getScaleFactor32( &input_frame_fx[0], 2 * num_protos_dir * num_freq_bands ) - guarded_bits; + IF (LT_16(q_shift , sub(0, guarded_bits)) && NE_32(max_abs_val, 0)) + { + q_shift = sub(0, guarded_bits); + } + ELSE IF (EQ_32(max_abs_val, 0)) + { + q_shift = 0; + } + FOR ( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++) + { + v_shr(&input_frame_fx[2 * ch_idx * num_freq_bands], negate(q_shift), &aux_buffer_fx[2 * ch_idx * num_freq_bands], 2 * num_freq_bands); + } + FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) + { + v_mult_fixed( &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], 2 * max_band_decorr_temp ); + } + q_aux_buffer = q_input_frame + q_input_frame + q_shift + q_shift - 31; + +#endif FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index a7ad619dd..36bb841ac 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -4021,7 +4021,7 @@ static void ivas_dirac_dec_get_response_split_order_fx( const Word16 elevation, Word32 *response, const Word16 shd_rot_max_order, - const Word32 *p_Rmat /*Q29*/, + const Word32 *p_Rmat /* Q30 */, Word16 *q_response ) { Word16 index_azimuth, index_elevation; @@ -4152,9 +4152,9 @@ static void ivas_dirac_dec_get_response_split_order_fx( dv_2 = L_shr( Mpy_32_16_1( dirac_gains_trg_term_int[el][0], e ), 1 ); // Q28 /*Rotation mtx multiplication*/ - dv_r_0 = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat[0], dv_0 ), p_Rmat[1], dv_1 ), p_Rmat[2], dv_2 ); // Q26 - dv_r_1 = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat[3], dv_0 ), p_Rmat[4], dv_1 ), p_Rmat[5], dv_2 ); // Q26 - dv_r_2 = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat[6], dv_0 ), p_Rmat[7], dv_1 ), p_Rmat[8], dv_2 ); // Q26 + dv_r_0 = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr( p_Rmat[0], Q1 ), dv_0 ), L_shr( p_Rmat[1], Q1 ), dv_1 ), L_shr( p_Rmat[2], Q1 ), dv_2 ); // Q26 + dv_r_1 = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr( p_Rmat[3], Q1 ), dv_0 ), L_shr( p_Rmat[4], Q1 ), dv_1 ), L_shr( p_Rmat[5], Q1 ), dv_2 ); // Q26 + dv_r_2 = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr( p_Rmat[6], Q1 ), dv_0 ), L_shr( p_Rmat[7], Q1 ), dv_1 ), L_shr( p_Rmat[8], Q1 ), dv_2 ); // Q26 tmp = BASOP_util_atan2( dv_r_1, dv_r_0, 0 ); // Q13 index_azimuth = shr( mult( tmp, _180_OVER_PI_Q9 ), 7 ); // Q0; diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index accca0e5b..ee6289366 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -743,13 +743,6 @@ void ivas_dirac_rend_close_fx( { FOR (j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++) { -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF (hDirACRend->buffer_intensity_real[i][j] != NULL) - { - free(hDirACRend->buffer_intensity_real[i][j]); - hDirACRend->buffer_intensity_real[i][j] = NULL; - } -#endif IF (hDirACRend->buffer_intensity_real_fx[i][j] != NULL) { free(hDirACRend->buffer_intensity_real_fx[i][j]); @@ -757,13 +750,6 @@ void ivas_dirac_rend_close_fx( } } } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF (hDirACRend->buffer_energy != NULL) - { - free(hDirACRend->buffer_energy); - hDirACRend->buffer_energy = NULL; - } -#endif IF (hDirACRend->buffer_energy_fx != NULL) { free(hDirACRend->buffer_energy_fx); @@ -782,9 +768,7 @@ void ivas_dirac_rend_close_fx( return; } - #else - void ivas_dirac_rend_close( DIRAC_REND_HANDLE *hDirACRend_out ) { @@ -1374,8 +1358,6 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = Q31; - set_s( hDirACRend->q_buffer_energy, Q31, CLDFB_NO_CHANNELS_MAX ); - set_s( hDirACRend->q_buffer_intensity_real, Q31, CLDFB_NO_CHANNELS_MAX ); #endif /* Target and smoothed nrg factors/gains */ @@ -1520,6 +1502,9 @@ ivas_error ivas_dirac_alloc_mem( hDirAC_mem->proto_diffuse_buffer_f_len = 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands; #endif } +#ifdef MSAN_FIX + set_zero_fx(hDirAC_mem->proto_diffuse_buffer_f_fx, hDirAC_mem->proto_diffuse_buffer_f_len); +#endif } } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; @@ -2212,7 +2197,7 @@ void protoSignalComputation_shd_fx( const Word16 num_inputs, const Word16 num_outputs_diff, const Word16 num_freq_bands, - Word32 *p_Rmat_fx, /* Q29*/ + Word32 *p_Rmat_fx, /* Q30 */ Word16 q_cldfb ) { Word16 l, k; @@ -2267,9 +2252,9 @@ void protoSignalComputation_shd_fx( move32(); p_proto_direct_buffer_fx[add( i_mult( 2, l ), 1 )] = im1; move32(); - p_proto_direct_buffer_fx[i_mult( 2, add( num_freq_bands, l ) )] = L_shl( Mpy_32_32( p_Rmat_fx[0], re2 ), 2 ); // left shift is done to maintain constant Q factor for p_proto_direct_buffer_fx + p_proto_direct_buffer_fx[i_mult( 2, add( num_freq_bands, l ) )] = L_shl( Mpy_32_32( p_Rmat_fx[0], re2 ), Q1 ); // left shift is done to maintain constant Q factor for p_proto_direct_buffer_fx move32(); - p_proto_direct_buffer_fx[add( i_mult( 2, add( num_freq_bands, l ) ), 1 )] = L_shl( Mpy_32_32( p_Rmat_fx[0], im2 ), 2 ); // left shift is done to maintain constant Q factor for p_proto_direct_buffer_fx + p_proto_direct_buffer_fx[add( i_mult( 2, add( num_freq_bands, l ) ), 1 )] = L_shl( Mpy_32_32( p_Rmat_fx[0], im2 ), Q1 ); // left shift is done to maintain constant Q factor for p_proto_direct_buffer_fx move32(); } *proto_direct_buffer_f_q = q_cldfb; @@ -2357,7 +2342,7 @@ void protoSignalComputation_shd_fx( *p_k_fx[k] = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat_fx[add( idx, 1 )], re1 ), p_Rmat_fx[add( idx, 2 )], re2 ), p_Rmat_fx[idx], re3 ); move32(); - *p_k_fx[k] = L_shl( *p_k_fx[k], 2 ); // left shift is done to maintain constant Q factor for p_k_fx + *p_k_fx[k] = L_shl( *p_k_fx[k], Q1 ); // left shift is done to maintain constant Q factor for p_k_fx move32(); reference_power_fx[idx1] = Mpy_32_32( *p_k_fx[k], *p_k_fx[k] ); move32(); @@ -2365,7 +2350,7 @@ void protoSignalComputation_shd_fx( *p_k_fx[k] = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat_fx[add( idx, 1 )], im1 ), p_Rmat_fx[add( idx, 2 )], im2 ), p_Rmat_fx[idx], im3 ); move32(); - *p_k_fx[k] = L_shl( *p_k_fx[k], 2 ); // left shift is done to maintain constant Q factor + *p_k_fx[k] = L_shl( *p_k_fx[k], Q1 ); // left shift is done to maintain constant Q factor move32(); reference_power_fx[idx1] = Mpy_32_32( *p_k_fx[k], *p_k_fx[k] ); move32(); @@ -5169,9 +5154,9 @@ void rotateAziEle_DirAC_fx( move32(); } - dv_r_0_fx = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat_fx[0], dv_0_fx ), p_Rmat_fx[1], dv_1_fx ), p_Rmat_fx[2], dv_2_fx ); // Q29 - dv_r_1_fx = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat_fx[3], dv_0_fx ), p_Rmat_fx[4], dv_1_fx ), p_Rmat_fx[5], dv_2_fx ); // Q29 - dv_r_2_fx = Madd_32_32( Madd_32_32( Mpy_32_32( p_Rmat_fx[6], dv_0_fx ), p_Rmat_fx[7], dv_1_fx ), p_Rmat_fx[8], dv_2_fx ); // Q29 + dv_r_0_fx = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr(p_Rmat_fx[0], Q1), dv_0_fx ), L_shr(p_Rmat_fx[1], Q1), dv_1_fx ), L_shr(p_Rmat_fx[2], Q1), dv_2_fx ); // Q29 + dv_r_1_fx = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr(p_Rmat_fx[3], Q1), dv_0_fx ), L_shr(p_Rmat_fx[4], Q1), dv_1_fx ), L_shr(p_Rmat_fx[5], Q1), dv_2_fx ); // Q29 + dv_r_2_fx = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr(p_Rmat_fx[6], Q1), dv_0_fx ), L_shr(p_Rmat_fx[7], Q1), dv_1_fx ), L_shr(p_Rmat_fx[8], Q1), dv_2_fx ); // Q29 /*Conversion spherical to cartesian coordinates*/ temp = BASOP_util_atan2( dv_r_1_fx, dv_r_0_fx, 0 ); // Q13 diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index f01ea233f..6a76c438d 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -201,8 +201,8 @@ void ivas_HRTF_CRend_binary_close( * * Allocate HRTF binary handle for FASTCONV renderer *-----------------------------------------------------------------------*/ - -ivas_error ivas_HRTF_fastconv_binary_open( +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_HRTF_fastconv_binary_open_fx( HRTFS_FASTCONV **hHrtfFastConv ) { *hHrtfFastConv = (HRTFS_FASTCONV *) malloc( sizeof( HRTFS_FASTCONV ) ); @@ -210,14 +210,22 @@ ivas_error ivas_HRTF_fastconv_binary_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FASTCONV HRTF tables!" ); } -#ifdef IVAS_FLOAT_FIXED ivas_init_binaural_hrtf_fx( *hHrtfFastConv ); + return IVAS_ERR_OK; +} #else +ivas_error ivas_HRTF_fastconv_binary_open( + HRTFS_FASTCONV **hHrtfFastConv ) +{ + *hHrtfFastConv = (HRTFS_FASTCONV *) malloc( sizeof( HRTFS_FASTCONV ) ); + if ( *hHrtfFastConv == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FASTCONV HRTF tables!" ); + } ivas_init_binaural_hrtf( *hHrtfFastConv ); -#endif return IVAS_ERR_OK; } - +#endif /*-----------------------------------------------------------------------* * ivas_HRTF_fastconv_binary_close() diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index c9a125cae..8e25239b7 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1105,6 +1105,11 @@ ivas_error ivas_HRTF_fastconv_binary_open( ); #ifdef IVAS_FLOAT_FIXED + +ivas_error ivas_HRTF_fastconv_binary_open_fx( + HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ +); + void ivas_HRTF_fastconv_binary_close_fx( HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ ); diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index d5e8ee954..df75987f4 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1950,7 +1950,7 @@ ivas_error ivas_combined_orientation_open( move16(); ( *hCombinedOrientationData )->interpolationCoefficient_fx = ONE_IN_Q30; move32(); - ( *hCombinedOrientationData )->interpolationIncrement_Fx = ONE_IN_Q30; + ( *hCombinedOrientationData )->interpolationIncrement_fx = ONE_IN_Q30; move32(); IF( EQ_16( num_subframes, 1 ) ) { @@ -2258,7 +2258,7 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->isInterpolationOngoing = FALSE; hCombinedOrientationData->interpolationCoefficient_fx = ONE_IN_Q30; move32(); - hCombinedOrientationData->interpolationIncrement_Fx = ONE_IN_Q30; + hCombinedOrientationData->interpolationIncrement_fx = ONE_IN_Q30; move32(); hCombinedOrientationData->Quaternions_ext_interpolation_start = identity; hCombinedOrientationData->Quaternions_ext_interpolation_target = identity; @@ -2326,7 +2326,7 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; move16(); QuaternionSlerp_fx( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i] ); - hCombinedOrientationData->interpolationCoefficient_fx = L_add( hCombinedOrientationData->interpolationIncrement_Fx, hCombinedOrientationData->interpolationCoefficient_fx ); + hCombinedOrientationData->interpolationCoefficient_fx = L_add( hCombinedOrientationData->interpolationIncrement_fx, hCombinedOrientationData->interpolationCoefficient_fx ); } ELSE { @@ -2334,7 +2334,7 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->isInterpolationOngoing = FALSE; hCombinedOrientationData->interpolationCoefficient_fx = ONE_IN_Q30; move32(); - hCombinedOrientationData->interpolationIncrement_Fx = ONE_IN_Q30; + hCombinedOrientationData->interpolationIncrement_fx = ONE_IN_Q30; move32(); external_target_interpolation( hExtOrientationData, hCombinedOrientationData, i ); Word16 l_shift = 0; @@ -2835,16 +2835,14 @@ static void external_target_interpolation( move16(); Word32 tmp; /* Calculate the interpolation increment and coefficient */ - // hCombinedOrientationData->interpolationIncrement_Fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, L_shl( L_deposit_l(hExtOrientationData->numFramesToTargetOrientation[i]), 2 ), &tmp_e ); // Multiplying with MAX_PARAM_SPATIAL_SUBFRAMES tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, L_shl( L_deposit_l( hExtOrientationData->numFramesToTargetOrientation[i] ), 2 ), &tmp_e ); - hCombinedOrientationData->interpolationIncrement_Fx = L_shl( tmp, sub( tmp_e, 31 ) ); // Q30 - hCombinedOrientationData->interpolationCoefficient_fx = hCombinedOrientationData->interpolationIncrement_Fx; + hCombinedOrientationData->interpolationIncrement_fx = L_shl( tmp, sub( tmp_e, 31 ) ); /* Q30 */ + hCombinedOrientationData->interpolationCoefficient_fx = hCombinedOrientationData->interpolationIncrement_fx; move32(); } /* Interpolate */ hCombinedOrientationData->isInterpolationOngoing = TRUE; - // hCombinedOrientationData->interpolationCoefficient_fx = float_to_fix( hCombinedOrientationData->interpolationCoefficient, Q30 ); hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.w_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.x_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx = L_shr( hCombinedOrientationData->Quaternions_ext_interpolation_start.y_fx, hCombinedOrientationData->Quaternions_ext_interpolation_start.q_fact - Q29 ); @@ -2860,7 +2858,7 @@ static void external_target_interpolation( hCombinedOrientationData->Quaternions_ext_interpolation_target.q_fact = Q29; move16(); QuaternionSlerp_fx( hCombinedOrientationData->Quaternions_ext_interpolation_start, hCombinedOrientationData->Quaternions_ext_interpolation_target, hCombinedOrientationData->interpolationCoefficient_fx, &hCombinedOrientationData->Quaternions[i] ); - hCombinedOrientationData->interpolationCoefficient_fx = L_add_sat( hCombinedOrientationData->interpolationCoefficient_fx, hCombinedOrientationData->interpolationIncrement_Fx ); + hCombinedOrientationData->interpolationCoefficient_fx = L_add_sat( hCombinedOrientationData->interpolationCoefficient_fx, hCombinedOrientationData->interpolationIncrement_fx ); } ELSE { @@ -2868,7 +2866,7 @@ static void external_target_interpolation( hCombinedOrientationData->isInterpolationOngoing = FALSE; hCombinedOrientationData->interpolationCoefficient_fx = ONE_IN_Q30; move32(); - hCombinedOrientationData->interpolationIncrement_Fx = ONE_IN_Q30; + hCombinedOrientationData->interpolationIncrement_fx = ONE_IN_Q30; move32(); hCombinedOrientationData->Quaternions[i] = hExtOrientationData->Quaternions[i]; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index f699b4416..28893b458 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -638,13 +638,14 @@ typedef struct ivas_dirac_rend_data_structure /*Parameter estimation*/ int16_t index_buffer_intensity; +#ifndef IVAS_FLOAT_FIXED float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; float *buffer_energy; -#ifdef IVAS_FLOAT_FIXED - Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; - Word16 q_buffer_intensity_real[CLDFB_NO_CHANNELS_MAX]; - Word32 *buffer_energy_fx; - Word16 q_buffer_energy[CLDFB_NO_CHANNELS_MAX]; +#else + Word32 *buffer_intensity_real_fx[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; /* Q(q_buffer_intensity_real[]) */ + Word16 q_buffer_intensity_real[DIRAC_NO_COL_AVG_DIFF]; + Word32 *buffer_energy_fx; /* Q(q_buffer_energy[]) */ + Word16 q_buffer_energy[DIRAC_NO_COL_AVG_DIFF]; #endif #ifndef IVAS_FLOAT_FIXED @@ -653,10 +654,10 @@ typedef struct ivas_dirac_rend_data_structure float *hoa_encoder; const float *hoa_decoder; #else - Word16 *frequency_axis_fx; /* Q0 */ - Word16 *diffuse_response_function_fx; /* Q15 */ - Word32 *hoa_encoder_fx; /* Q29 */ - const Word32 *hoa_decoder; /* Q29 */ + Word16 *frequency_axis_fx; /* Q0 */ + Word16 *diffuse_response_function_fx; /* Q15 */ + Word32 *hoa_encoder_fx; /* Q29 */ + const Word32 *hoa_decoder; /* Q29 */ #endif /*Decoder parameters */ /*Prototypes*/ @@ -1169,27 +1170,36 @@ typedef struct ivas_external_orientation_struct typedef struct ivas_combined_orientation_struct { Word16 enableCombinedOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifndef IVAS_FLOAT_FIXED float interpolationCoefficient; float interpolationIncrement; +#else + Word32 lrSwitchInterpVal_fx; /* Q30 */ + Word32 interpolationCoefficient_fx; /* Q30 */ +#endif Word16 maximumFramesToTargetOrientation; UWord8 lrSwitchedNext; UWord8 lrSwitchedCurrent; +#ifndef IVAS_FLOAT_FIXED float lrSwitchInterpVal; +#else + Word32 interpolationIncrement_fx; /* Q30 */ +#endif bool isInterpolationOngoing; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_QUATERNION Quaternion_prev_extOrientation; IVAS_QUATERNION Quaternions_ext_interpolation_start; IVAS_QUATERNION Quaternions_ext_interpolation_target; - Word32 Rmat_fx[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; +#ifndef IVAS_FLOAT_FIXED float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; float Rmat_prev[3][3]; - Word32 Rmat_prev_fx[3][3]; +#else + Word32 Rmat_fx[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; /* Q30 */ + Word32 Rmat_prev_fx[3][3]; /* Q30 */ +#endif float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ float procChEneIIR[2][MASA_FREQUENCY_BANDS]; #ifdef IVAS_FLOAT_FIXED - Word32 lrSwitchInterpVal_fx; - Word32 interpolationCoefficient_fx; - Word32 interpolationIncrement_Fx; Word32 chEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ Word16 q_chEneIIR; Word32 procChEneIIR_fx[2][MASA_FREQUENCY_BANDS]; @@ -1660,10 +1670,10 @@ typedef struct typedef struct { +#ifndef IVAS_FLOAT_FIXED float val; -#ifdef IVAS_FLOAT_FIXED +#else Word32 val_fx; - Word16 val_q; #endif int16_t i; @@ -1856,14 +1866,16 @@ typedef struct typedef struct { float *InputFrame_p; /* Input frame pointer */ +#ifdef IVAS_FLOAT_FIXED + Word32 *InputFrame_p_fx; /* Input frame pointer */ /* Q(InputFrame_p_q) */ + Word16 InputFrame_p_q; +#endif TDREND_SRC_SPATIAL_t *SrcSpatial_p; TDREND_SRC_REND_t *SrcRend_p; int16_t itd; int16_t previtd; int16_t filterlength; #ifdef IVAS_FLOAT_FIXED - Word32 *InputFrame_p_fx; /* Input frame pointer */ - Word16 InputFrame_p_q; Word32 mem_itd_fx[ITD_MEM_LEN]; Word32 mem_hrf_left_fx[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; Word32 mem_hrf_right_fx[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; @@ -2083,7 +2095,9 @@ typedef struct ivas_hrtfs_fastconv_struct float ***leftBRIRImag; float ***rightBRIRReal; float ***rightBRIRImag; +#ifndef IVAS_FLOAT_FIXED float FASTCONV_BRIR_latency_s; +#endif #ifdef IVAS_FLOAT_FIXED Word32 ***leftHRIRReal_HOA2_fx; @@ -2096,7 +2110,9 @@ typedef struct ivas_hrtfs_fastconv_struct float ***leftHRIRImag_HOA2; float ***rightHRIRReal_HOA2; float ***rightHRIRImag_HOA2; +#ifndef IVAS_FLOAT_FIXED float FASTCONV_HOA2_latency_s; +#endif #ifdef IVAS_FLOAT_FIXED Word32 ***leftHRIRReal_FOA_fx; @@ -2109,16 +2125,19 @@ typedef struct ivas_hrtfs_fastconv_struct float ***leftHRIRImag_FOA; float ***rightHRIRReal_FOA; float ***rightHRIRImag_FOA; +#ifndef IVAS_FLOAT_FIXED float FASTCONV_FOA_latency_s; +#endif int16_t allocate_init_flag; /*Memory allocation flag 0: if the hrtf pointers are allocated at application level , 1: of allocated at ivas_binaural_hrtf_open() */ #ifdef IVAS_FLOAT_FIXED - Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 fastconvReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; -#endif + Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ + Word32 fastconvReverberationEneCorrections_fx[CLDFB_NO_CHANNELS_MAX]; /* Q31 */ +#else float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; +#endif } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 09c3f0b80..5865e0184 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -13116,6 +13116,7 @@ void IVAS_REND_Close( return; } + #ifdef IVAS_FLOAT_FIXED static ivas_error ivas_masa_ext_rend_dirac_rend_init( input_masa *inputMasa ) @@ -13497,17 +13498,11 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( } -#if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ - hDirACRend->buffer_energy = NULL; -#endif hDirACRend->buffer_energy_fx = NULL; FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { -#if 1 /*TODO :To be removed later(after dependecy on buffer_energyis completely removed)*/ - hDirACRend->buffer_intensity_real[i][j] = NULL; -#endif hDirACRend->buffer_intensity_real_fx[i][j] = NULL; } } @@ -13901,6 +13896,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( } #endif + #ifndef IVAS_FLOAT_FIXED static ivas_error ivas_masa_ext_rend_parambin_init( input_masa *inputMasa /* i/o: MASA external renderer structure */ diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 8575ffd29..777e21e1e 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1432,6 +1432,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( float f_tmp; float f_tmp_ntaps_sba[BINAURAL_NTAPS]; float f_tmp_ntaps_max[BINAURAL_NTAPS_MAX]; + float f_tmp_brir_reverb[CLDFB_NO_CHANNELS_MAX]; char *hrtf_data_rptr; ( *hHRTF )->allocate_init_flag = 0; ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); @@ -1733,13 +1734,13 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } hrtf_data_rptr += sizeof( uint16_t ); - memcpy( ( *hHRTF )->fastconvReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + memcpy( f_tmp_brir_reverb, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); - floatToFixed_arrL( ( *hHRTF )->fastconvReverberationTimes, ( *hHRTF )->fastconvReverberationTimes_fx, Q31, CLDFB_NO_CHANNELS_MAX ); + floatToFixed_arrL( f_tmp_brir_reverb, ( *hHRTF )->fastconvReverberationTimes_fx, Q31, CLDFB_NO_CHANNELS_MAX ); - memcpy( ( *hHRTF )->fastconvReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + memcpy( f_tmp_brir_reverb, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); - floatToFixed_arrL( ( *hHRTF )->fastconvReverberationEneCorrections, ( *hHRTF )->fastconvReverberationEneCorrections_fx, Q31, CLDFB_NO_CHANNELS_MAX ); + floatToFixed_arrL( f_tmp_brir_reverb, ( *hHRTF )->fastconvReverberationEneCorrections_fx, Q31, CLDFB_NO_CHANNELS_MAX ); } return IVAS_ERR_OK; -- GitLab From d25eb903a18792c88a1db9f151da041641fe5ea5 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 23 May 2024 13:42:23 -0400 Subject: [PATCH 091/101] Proposed fixed to 680, where the scaling of the OVA step is correted --- lib_com/options.h | 1 + lib_dec/core_switching_dec_fx.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 7e8d91b52..16625f719 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -136,6 +136,7 @@ #define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP #define FIX_747_TDBWE_ENERGY_BURST #define FIX_770_DISCONTINUITIES_SW_TCX2ACELP // Fix discontinuities when switching from TCX to ACELP +#define FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step was right shift by 2, which made the OVA wrong */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 7f349804b..f2a03ebc8 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2325,7 +2325,9 @@ static void smoothTransitionDtxToTcx_fx( /* apply fades around transition */ step = div_s( 1, delay_comp ); +#ifndef FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step has to be in Q15, not in Q13 */ step = shr( step, 2 ); +#endif fade_in = extract_l( 0 ); FOR( i = 0; i < delay_comp; i++ ) { -- GitLab From 00a3d2cff8c899e00775b12a79833de0e7fc48ad Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 12:06:41 +0200 Subject: [PATCH 092/101] debug printout + add html out to artifacts --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee1e55425..d3a63f68b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -247,6 +247,7 @@ stages: - unzip artifacts.zip -d previous_artifacts # This wildcard thingy relies on only one csv file being present per job - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" + - ls ci - python3 ci/basop-pages/create_report_pages.py index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi @@ -264,6 +265,7 @@ stages: - report-junit.xml - report.html - mld.csv + - index.html expose_as: "pytest mld results" reports: junit: -- GitLab From d5e34420797df51906ac96c65078f54bb7b52757 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 12:15:33 +0200 Subject: [PATCH 093/101] temporarily get script from dev branch --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d3a63f68b..2a2c7a529 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -247,8 +247,9 @@ stages: - unzip artifacts.zip -d previous_artifacts # This wildcard thingy relies on only one csv file being present per job - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" - - ls ci - - python3 ci/basop-pages/create_report_pages.py index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME + # TODO: remove once that is merged to basop-ci-branch + - wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/basop-ci/add-project-id-as-argument-for-get_id_of_last_job_occurence/ci/basop-pages/create_report_pages.py + - python3 create_report_pages.py index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi -- GitLab From 811a51b43e42d0fdf8195881716de1063dcf5ceb Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 12:56:41 +0200 Subject: [PATCH 094/101] add debug outpout --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2a2c7a529..f06a0c0f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -627,6 +627,8 @@ pages: - *print-common-info - *update-scripts-repo - python3 ci/setup_pages.py + - ls + - ls public artifacts: paths: - public -- GitLab From c0f3366e7d3b748302fe2cecce4dfb0fa0cc70d8 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 15:35:41 +0200 Subject: [PATCH 095/101] change name of artifact --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f06a0c0f1..94398795a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -249,7 +249,7 @@ stages: - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" # TODO: remove once that is merged to basop-ci-branch - wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/basop-ci/add-project-id-as-argument-for-get_id_of_last_job_occurence/ci/basop-pages/create_report_pages.py - - python3 create_report_pages.py index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME + - python3 create_report_pages.py $CI_JOB_NAME-index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi @@ -266,7 +266,7 @@ stages: - report-junit.xml - report.html - mld.csv - - index.html + - $CI_JOB_NAME-index.html expose_as: "pytest mld results" reports: junit: -- GitLab From c1d885852b17347c05b9191f54885f214a936da0 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 15:42:54 +0200 Subject: [PATCH 096/101] remove temporary parts in CI file --- .gitlab-ci.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94398795a..d8fe48fcf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -117,8 +117,8 @@ stages: - python3 tests/create_short_testvectors.py # create references - exit_code=0 - - python3 -m pytest $TEST_SUITE -v -k "stereo and MONO" --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? - - python3 -m pytest $TEST_SUITE -v -k "stereo and MONO" --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests .update-scripts-repo: &update-scripts-repo @@ -235,21 +235,20 @@ stages: ### run pytest - exit_code=0 - - python3 -m pytest $TEST_SUITE -v -k "stereo and MONO" --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? + - python3 -m pytest $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv - # TODO change back to this - need to get new version from branch so that the project id argument is there - #- if [ $UPDATE_PAGES != "" ]; then python3 ci/get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID; echo "Job ID - $CI_JOB_ID"; fi - - if [ $UPDATE_PAGES != "" ]; then wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/3c1b6994912cbe6e3c5463b02a1a6c970f449b96/ci/get_id_of_last_job_occurence.py; id_previous=$(python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID); echo "Job ID from variables - $CI_JOB_ID, Job ID from script - $id_previous"; fi - - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip - - unzip artifacts.zip -d previous_artifacts + - if [ $UPDATE_PAGES != "" ]; then + - id_previous=$(python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID) + - echo "Job ID from variables - $CI_JOB_ID, Job ID from script - $id_previous" + - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip + - unzip artifacts.zip -d previous_artifacts # This wildcard thingy relies on only one csv file being present per job - - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" - # TODO: remove once that is merged to basop-ci-branch - - wget https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/raw/basop-ci/add-project-id-as-argument-for-get_id_of_last_job_occurence/ci/basop-pages/create_report_pages.py - - python3 create_report_pages.py $CI_JOB_NAME-index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME + - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" + - python3 ci/basop-pages/create_report_pages.py $CI_JOB_NAME-index.html mld.csv $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME + - fi - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_NON_BE; fi -- GitLab From a484c51927191535530ea79c4ba799b0300b3c0a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 16:12:50 +0200 Subject: [PATCH 097/101] adjust if and provide default html file for artifacts --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4e2a186d..0c09ffe46 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -242,7 +242,7 @@ stages: - python3 scripts/parse_mld_xml.py report-junit.xml $MLD_ARTIFACT_NAME - - if [ $UPDATE_PAGES != "" ]; then + - if [ $USE_LTV -eq 1 ] && [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then - id_previous=$(python3 get_id_of_last_job_occurence.py $CI_DEFAULT_BRANCH $CI_JOB_NAME $CI_PROJECT_ID) - echo "Job ID from variables - $CI_JOB_ID, Job ID from script - $id_previous" - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip @@ -250,6 +250,9 @@ stages: # This wildcard thingy relies on only one csv file being present per job - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" - python3 ci/basop-pages/create_report_pages.py $CI_JOB_NAME-index.html $MLD_ARTIFACT_NAME $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME + - else + # create empty file for artifacts to avoid errors + - touch $CI_JOB_NAME-index.html - fi - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi -- GitLab From 14b98fe48df61c1b956fb024d9a495b68ac4c3e5 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 27 May 2024 16:13:37 +0200 Subject: [PATCH 098/101] remove temporary variable overwrite --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0c09ffe46..db64eb93b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -619,9 +619,6 @@ be-2-evs-26444: # job that sets up gitlab pages website pages: - variables: - # TODO: only for testing, remove! - BASOP_CI_BRANCH_PC_REPO: "basop-ci/add-project-id-as-argument-for-get_id_of_last_job_occurence" stage: deploy tags: - ivas-basop-linux -- GitLab From cc50ec29935f0a7961e6fac28c2ab4685fbc7ce9 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 27 May 2024 21:07:02 +0530 Subject: [PATCH 099/101] lib_rend.c and ivas_core_dec cleanup [x] Cleanup of functions IVAS_DEC_GetObjectMetadata, initIsmMasaRendering, initMcBinauralRendering, IVAS_REND_SetIsmMetadataDelay, freeMasaExtRenderer [x] Disabled NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO as this is not enabled in ivas-float-update [x] cldfb buffers cleanup in ivas core dec --- apps/renderer.c | 10 +- lib_com/float_to_fix_ops.c | 150 --------------- lib_com/options.h | 2 +- lib_com/prot_fx2.h | 18 -- lib_dec/acelp_core_dec_ivas_fx.c | 16 +- lib_dec/core_dec_init_fx.c | 1 + lib_dec/core_dec_switch.c | 18 -- lib_dec/core_dec_switch_fx.c | 1 + lib_dec/ivas_core_dec.c | 109 +++++------ lib_dec/ivas_init_dec.c | 2 - lib_dec/ivas_stereo_dft_dec.c | 305 ------------------------------- lib_dec/lib_dec_fx.c | 56 +++++- lib_rend/lib_rend.c | 271 ++++++++++++++++++--------- lib_rend/lib_rend.h | 7 + 14 files changed, 315 insertions(+), 651 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index df81d926b..49fbee9dd 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -937,12 +937,20 @@ int main( fprintf( stderr, "Error in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) ); exit( -1 ); } - +#ifdef IVAS_FLOAT_FIXED + Word32 var1 = (Word32)(args.syncMdDelay); + IF((error = IVAS_REND_SetIsmMetadataDelay(hIvasRend, var1)) != IVAS_ERR_OK) + { + fprintf(stderr, "Error in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string(error)); + exit(-1); + } +#else if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) ); exit( -1 ); } +#endif } IVAS_REND_LfePanMtx lfePanMatrix; diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index cc820e04e..c11bc4f46 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -297,153 +297,3 @@ Word16 L_get_q_buf1( float *ptr_flt, Word16 length ) } } #endif - -#ifdef IVAS_FLOAT_FIXED -void stereo_tcx_dec_mode_switch_reconf_To_fixed( - Decoder_State *st, - Word16 tofix, - Word16 last_element_mode) -{ - bool reconf = ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || - ( st->bwidth != st->last_bwidth ) || - ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || - ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ); - if ( reconf ) - { - Word16 Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, - - if ( tofix ) - { - - IF( st->hTcxDec ) - { - st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); - st->output_frame_fx = st->hTcxDec->L_frameTCX; - } - IF( st->hHQ_core ) - { - //st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k ); - //st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k ); - st->hHQ_core->Q_fer_samples = 0; - } - IF( st->cldfbAna ) - { - Q_cldfbAna_cldfb_state = Q_factor_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q_cldfbAna_cldfb_state, st->cldfbAna->cldfb_state_length ); - } - IF( st->cldfbBPF ) - { - Q_cldfbBPF_cldfb_state = Q_factor_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q_cldfbBPF_cldfb_state, st->cldfbBPF->cldfb_state_length ); - } - IF( st->cldfbSyn ) - { - Q_cldfbSyn_cldfb_state = Q_factor_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q_cldfbSyn_cldfb_state, st->cldfbSyn->cldfb_state_length ); - } - IF( st->cldfbSynHB ) - { - Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); - } - st->last_gain_syn_deemph = 0; - } - else - { - IF( st->cldfbAna ) - { - Q_cldfbAna_cldfb_state = Q_factor_arrL( st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q_cldfbAna_cldfb_state, st->cldfbAna->cldfb_state_length ); - } - IF( st->cldfbBPF ) - { - Q_cldfbBPF_cldfb_state = Q_factor_arrL( st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q_cldfbBPF_cldfb_state, st->cldfbBPF->cldfb_state_length ); - } - IF( st->cldfbSyn ) - { - Q_cldfbSyn_cldfb_state = Q_factor_arrL( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q_cldfbSyn_cldfb_state, st->cldfbSyn->cldfb_state_length ); - } - IF( st->cldfbSynHB ) - { - Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); - } - } - } -} - -void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( - Decoder_State *st, - Word16 tofix, - Word16 last_element_mode, - const FRAME_MODE frameMode) -{ - UNUSED_PARAM(frameMode); - bool reconf = ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || - ( st->bwidth != st->last_bwidth ) || - ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || - ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ); - if ( reconf ) - { - Word16 Q_cldfbSynHB_cldfb_state = 0;//, - - - if ( tofix ) - { - - IF( st->hTcxDec ) - { - st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); - st->output_frame_fx = st->hTcxDec->L_frameTCX; - } - IF( st->hHQ_core ) - { - st->hHQ_core->Q_old_out = 0; - st->hHQ_core->Q_old_outLB = 0; - st->hHQ_core->Q_fer_samples = 0; - } - IF( st->cldfbSynHB ) - { - Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; - floatToFixed_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); - } - - - st->last_gain_syn_deemph = 0; - } - else - { - IF( st->hTcxDec ) - { - st->hTcxDec->conCngLevelBackgroundTrace_e = 0; - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - st->hTcxDec->conLastFrameLevel = st->hTcxDec->LastFrameLevel_bfi_fx; - } - IF( st->cldfbSynHB ) - { - Q_cldfbSynHB_cldfb_state = Q_factor_arrL( st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_length ) - 1; - fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); - } - } - } - - if ( tofix ) - { - st->Q_syn = 0; - st->prev_Q_syn = st->Q_syn; - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - - st->mem_error = st->hBPF->pst_mem_deemp_err_fx; - - // u8bit to 16bit - FOR(int l = 0; l < IGF_START_MX; l++) - { - st->hIGFDec->infoTCXNoise_evs[l] = (Word16)st->hIGFDec->infoTCXNoise[l]; - } - } -} -#endif // IVAS_FLOAT_FIXED diff --git a/lib_com/options.h b/lib_com/options.h index 16625f719..5f8aa90fe 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -140,7 +140,7 @@ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ -#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO +//#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO #define UNUSED_PARAM(...) (void)(__VA_ARGS__) diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 6c37b6b07..b883b924e 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -62,18 +62,6 @@ /* conversion functions: */ -// needed to be removed -void stereo_tcx_dec_mode_switch_reconf_To_fixed( - Decoder_State *st, - Word16 tofix, - Word16 last_element_mode ); - -void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( - Decoder_State *st, - Word16 tofix, - Word16 last_element_mode, - const FRAME_MODE frameMode); - // Float to Word32 Word32 float_to_fix( float number, Word32 Q ); // Word32 to Float @@ -9358,12 +9346,6 @@ void ivas_bw_switching_pre_proc_fx( Word16 Q_audio ); -#ifdef IVAS_FLOAT_FIXED -/* float2fix and fix2float utilities (to be removed) */ -void acelp_decoder_state_float2fix(Decoder_State *st); -void acelp_decoder_state_fix2float(Decoder_State *st); -#endif - uint32_t mvl2s_r( const Word32 x[], /* i : input vector */ const Word16 q, diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index bf525061e..d235d54b6 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1946,10 +1946,6 @@ ivas_error acelp_core_dec_ivas_fx( } } - pop_wmops(); - - - { if (save_hb_synth_fx16) { Copy_Scale_sig_32_16(save_hb_synth_fx, save_hb_synth_fx16, L_FRAME48k, 0); @@ -1966,20 +1962,10 @@ ivas_error acelp_core_dec_ivas_fx( } + pop_wmops(); return error; - } - -void acelp_decoder_state_float2fix(Decoder_State *st/*, STEREO_CNG_DEC_HANDLE hStereoCng*/) { - if(st->cldfbSynHB) - floatToFixed_arrL(st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q10, st->cldfbSynHB->p_filter_length); } -void acelp_decoder_state_fix2float(Decoder_State *st) { - /* CLDFB */ - if (st->cldfbSynHB) - fixedToFloat_arrL(st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q10, st->cldfbSynHB->p_filter_length); - -} static void rescale_fdCngDec(HANDLE_FD_CNG_DEC hFdCngDec, Word16 Exp_diff) { Scale_sig32(hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, Exp_diff); diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index b20c34570..7b22bf9e5 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1151,6 +1151,7 @@ void open_decoder_LPD_ivas_fx( IF( st->hTcxDec != NULL ) { st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); + st->output_frame_fx = st->hTcxDec->L_frameTCX; IF( EQ_16( st->ini_frame, 0 ) ) { st->L_frameTCX_past = st->hTcxDec->L_frameTCX; diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index 67dcade7e..2fe543ca8 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -46,24 +46,6 @@ * * *-------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void open_decoder_LPD_ivas_fx( - Decoder_State *st, /* i/o: decoder state structure */ - const Word32 total_brate, /* i : total bitrate */ - const Word32 last_total_brate, /* i : last total bitrate */ - const Word16 bwidth, /* i : audio bandwidth */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const Word16 last_element_mode, /* i : last element mode */ - const Word16 is_init, /* i : indicate call from init_decoder() to avoid double TC initialization */ - Word16* Q_syn_Overl_TDAC, - Word16* Q_fer_samples, - Word16* Q_syn_Overl, - Word16* Q_syn_Overl_TDACFB, - Word16* Q_syn_OverlFB, - Word16* Q_old_out, - Word16* Q_old_outLB, - Word16* Q_old_Aq_12_8); -#endif // IVAS_FLOAT_FIXED #ifndef IVAS_FLOAT_FIXED void mode_switch_decoder_LPD( diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 8f7f18de8..1d487992c 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -355,6 +355,7 @@ void mode_switch_decoder_LPD_ivas_fx( IF( st->hTcxDec != NULL ) { st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); + st->output_frame_fx = st->hTcxDec->L_frameTCX; } IF( st->hTcxCfg != NULL ) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 157c6180c..ae20b0b42 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -186,6 +186,8 @@ ivas_error ivas_core_dec( { floatToFixed_arr32( st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, Q11, st->cldfbSyn->cldfb_size ); } + IF(st->cldfbSynHB) + floatToFixed_arrL(st->cldfbSynHB->cldfb_state, st->cldfbSynHB->cldfb_state_fx, Q10, st->cldfbSynHB->p_filter_length); } output_Fs = sts[0]->output_Fs; @@ -426,7 +428,6 @@ ivas_error ivas_core_dec( scale_sig32(st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_size, sub(Q10, Q11)); IF(st->cldfbSyn) scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_size, sub(Q10, Q11)); - acelp_decoder_state_float2fix(st); IF( st->hFdCngDec != NULL ) { @@ -444,7 +445,6 @@ ivas_error ivas_core_dec( /* fix2float, to be removed */ Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k, Q11 - st->Q_syn2); Scale_sig(output_16_fx[n], L_FRAME48k, -st->Q_syn2); - acelp_decoder_state_fix2float(st); IF(st->cldfbAna) scale_sig32(st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, sub(Q10, Q11)); /* 9 * (Word16)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f) */ IF(st->cldfbBPF) @@ -467,7 +467,18 @@ ivas_error ivas_core_dec( IF( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { Word16 Qsyn_temp = st->Q_syn; - stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 1, last_element_mode, frameMode[n]); + st->Q_syn = 0; + st->prev_Q_syn = st->Q_syn; + st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; + st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; + + st->mem_error = st->hBPF->pst_mem_deemp_err_fx; + + // u8bit to 16bit + FOR(int l = 0; l < IGF_START_MX; l++) + { + st->hIGFDec->infoTCXNoise_evs[l] = (Word16)st->hIGFDec->infoTCXNoise[l]; + } /* TCX decoder */ Scale_sig( st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp ); @@ -481,11 +492,16 @@ ivas_error ivas_core_dec( st->hHQ_core->Q_old_wtda_LB = st->hHQ_core->Q_old_wtda; Copy_Scale_sig_16_32( output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 ); - stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 0, last_element_mode, frameMode[n] ); + IF( st->hTcxDec ) + { + st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; + st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; + st->hTcxDec->conLastFrameLevel = st->hTcxDec->LastFrameLevel_bfi_fx; + } st->hBPF->pst_mem_deemp_err_fx = (Word16)st->mem_error; } - if ( st->core == HQ_CORE ) + IF ( EQ_16(st->core, HQ_CORE) ) { /* HQ core decoder */ Q_synth = 0; @@ -518,16 +534,6 @@ ivas_error ivas_core_dec( } /* n_channels loop */ - FOR(n = 0; n < n_channels; n++) - { - st = sts[n]; - IF( st->cldfbAna ) - fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q10, st->cldfbAna->cldfb_size ); - IF( st->cldfbBPF ) - fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q11, st->cldfbBPF->cldfb_size ); - IF( st->cldfbSyn ) - fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q11, st->cldfbSyn->cldfb_size ); - } /*---------------------------------------------------------------------* * MDCT stereo: joint TCX Core Decoding @@ -540,22 +546,36 @@ ivas_error ivas_core_dec( { IF ( hMCT ) { - pop_wmops(); + FOR(n = 0; n < n_channels; n++) + { + st = sts[n]; + IF( st->cldfbAna ) + fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q10, st->cldfbAna->cldfb_size ); + IF( st->cldfbBPF ) + fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q11, st->cldfbBPF->cldfb_size ); + IF( st->cldfbSyn ) + fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q11, st->cldfbSyn->cldfb_size ); + IF(st->cldfbSynHB) + fixedToFloat_arrL(st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q10, st->cldfbSynHB->cldfb_size); + } + pop_wmops(); return error; } ELSE { -#if 1 Word16 e_sig = 17; Word16 ch; sts = hCPE->hCoreCoder; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { - stereo_tcx_dec_mode_switch_reconf_To_fixed( sts[ch], 1, hCPE->last_element_mode ); - st = sts[ch]; + st->last_gain_syn_deemph = 0; + IF( st->hHQ_core ) + { + st->hHQ_core->Q_fer_samples = 0; + } st->prev_Q_syn = st->Q_syn; Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, st->Q_syn - st->hHQ_core->Q_old_wtda_LB ); @@ -567,19 +587,11 @@ ivas_error ivas_core_dec( st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; } -#endif stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx ); - - -#if 1 // Fix to float conversion - FOR( ch = 0; ch < 2; ch++ ) { - stereo_tcx_dec_mode_switch_reconf_To_fixed( sts[ch], 0, hCPE->last_element_mode ); - st = hCPE->hCoreCoder[ch]; - st->hHQ_core->Q_old_wtda_LB = st->Q_syn; st->hHQ_core->Q_old_wtda = st->Q_syn; } @@ -590,7 +602,6 @@ ivas_error ivas_core_dec( #else Scale_sig( synth_16_fx[0], L_FRAME48k, e_sig - 15 ); Scale_sig( synth_16_fx[1], L_FRAME48k, e_sig - 15 ); -#endif #endif } } @@ -600,14 +611,14 @@ ivas_error ivas_core_dec( sts[0] = hCPE->hCoreCoder[0]; sts[1] = hCPE->hCoreCoder[1]; - if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) + IF ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { sts[0]->hHQ_core->exp_old_out = 15 - sts[0]->hHQ_core->Q_old_wtda; sts[1]->hHQ_core->exp_old_out = 15 - sts[1]->hHQ_core->Q_old_wtda; } updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx ); - if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) + IF ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { sts[0]->hHQ_core->Q_old_wtda = 15 - sts[0]->hHQ_core->exp_old_out; sts[1]->hHQ_core->Q_old_wtda = 15 - sts[1]->hHQ_core->exp_old_out; @@ -634,7 +645,7 @@ ivas_error ivas_core_dec( * Stereo CNG updates *---------------------------------------------------------------------*/ - if ( sts[0]->element_mode == IVAS_CPE_TD && hCPE->hStereoCng != NULL ) + IF ( EQ_16(sts[0]->element_mode, IVAS_CPE_TD) && hCPE->hStereoCng != NULL ) { /* To be cleaned up once the caller function is converted // These changes are for system testing of fixed changes made */ Word16 Q_c_PS_LT = 31, Q_output = 11; @@ -695,17 +706,9 @@ ivas_error ivas_core_dec( /*size of synth is choosen as delay comp to start with*/ /*-------------------cldfb-start-------------------------*/ - if (st->cldfbAna != NULL) + IF (st->cldfbSyn != NULL) { - floatToFixed_arrL(st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, 10, st->cldfbAna->cldfb_size); - } - if (st->cldfbSyn != NULL) - { - floatToFixed_arrL(st->cldfbSyn->cldfb_state, st->cldfbSyn->cldfb_state_fx, 4, st->cldfbSyn->p_filter_length); - } - if (st->cldfbBPF != NULL) - { - floatToFixed_arrL(st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, 11, st->cldfbBPF->cldfb_size); + scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub(Q4, Q11)); } Word16 q_audio, old_syn_fx; @@ -785,17 +788,9 @@ ivas_error ivas_core_dec( /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ - if (st->cldfbAna != NULL) - { - fixedToFloat_arrL(st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, 10, st->cldfbAna->cldfb_size); - } - if (st->cldfbSyn != NULL) + IF (st->cldfbSyn != NULL) { - fixedToFloat_arrL(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, 4, st->cldfbSyn->p_filter_length); - } - if (st->cldfbBPF != NULL) - { - fixedToFloat_arrL(st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, 11, st->cldfbBPF->cldfb_size); + scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub(Q11, Q4)); } #ifdef MSAN_FIX @@ -1298,6 +1293,18 @@ ivas_error ivas_core_dec( } /* n_channels loop */ + FOR(n = 0; n < n_channels; n++) + { + st = sts[n]; + IF( st->cldfbAna ) + fixedToFloat_arrL( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_state, Q10, st->cldfbAna->cldfb_size ); + IF( st->cldfbBPF ) + fixedToFloat_arrL( st->cldfbBPF->cldfb_state_fx, st->cldfbBPF->cldfb_state, Q11, st->cldfbBPF->cldfb_size ); + IF( st->cldfbSyn ) + fixedToFloat_arrL( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->cldfb_state, Q11, st->cldfbSyn->cldfb_size ); + IF(st->cldfbSynHB) + fixedToFloat_arrL(st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q10, st->cldfbSynHB->cldfb_size); + } pop_wmops(); return error; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 52bad0aba..826f7c883 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1299,12 +1299,10 @@ ivas_error ivas_init_decoder_front( return error; } - /*FLOAT CODE*/ IF ( ( error = ivas_render_config_init_from_rom( &st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) { return error; } - /*---------*/ } return error; diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 9895ea173..f1e909c95 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -3023,7 +3023,6 @@ void stereo_dft_generate_res_pred( * * ---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -#if 1 void stereo_dft_dec_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ const int16_t prev_sid_nodata, /* i : Previous SID/No data indicator */ @@ -3326,310 +3325,6 @@ void stereo_dft_dec_smooth_parameters( return; } -#else -void stereo_dft_dec_smooth_parameters( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const int16_t prev_sid_nodata, /* i : Previous SID/No data indicator */ - const int16_t active_frame_counter, /* i : Active frame counter */ - const int32_t element_brate /* i : Element bitrate */ -) -{ - int16_t k_offset, k, k2, b, N_div; - float *pIpd, *pInterpol; - float *pgIpd; - float *pSideGain; - float diff_ipd; - int16_t nbands; - int16_t max_res_pred_ind; - - N_div = STEREO_DFT_NBDIV; - k_offset = STEREO_DFT_OFFSET; - - if ( hStereoDft->frame_sid_nodata || prev_sid_nodata ) - { - k = 1; - for ( b = 0; b < hStereoDft->nbands; b++ ) - { - *( hStereoDft->side_gain + ( ( k + k_offset ) - 1 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b ); - } - - if ( hStereoDft->frame_sid_nodata ) - { - /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO - if ( hStereoDft->ipd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) -#else - if ( hStereoDft->gipd[k + k_offset] != hStereoDft->ipd_xfade_target ) -#endif - { - if ( ( hStereoDft->gipd[k + k_offset] - hStereoDft->ipd_xfade_prev ) > EVS_PI ) - { - hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset] - 2 * EVS_PI; - hStereoDft->ipd_xfade_step = ( hStereoDft->ipd_xfade_target - hStereoDft->ipd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->ipd_xfade_counter ); - } - else if ( ( hStereoDft->ipd_xfade_prev - hStereoDft->gipd[k + k_offset] ) > EVS_PI ) - { - hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset] + 2 * EVS_PI; - hStereoDft->ipd_xfade_step = ( hStereoDft->ipd_xfade_target - hStereoDft->ipd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->ipd_xfade_counter ); - } - else - { - hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset]; - hStereoDft->ipd_xfade_step = ( hStereoDft->ipd_xfade_target - hStereoDft->ipd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->ipd_xfade_counter ); - } - } - - /* xfade */ - if ( hStereoDft->ipd_xfade_prev != hStereoDft->ipd_xfade_target && hStereoDft->ipd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE && hStereoDft->last_active_element_brate <= 24400 ) - { - hStereoDft->gipd[k + k_offset] = hStereoDft->ipd_xfade_prev + hStereoDft->ipd_xfade_step; - hStereoDft->ipd_xfade_prev = hStereoDft->gipd[k + k_offset]; - hStereoDft->ipd_xfade_counter++; - } - } - else - { - /* First active frame, "reset" everything if long enough active encoding, only triggered if STEREO_DFT_ITD_CNG_XFADE_RESET = -1 */ - if ( active_frame_counter > STEREO_DFT_ITD_CNG_XFADE_RESET ) - { - hStereoDft->ipd_xfade_target = hStereoDft->gipd[k + k_offset]; - hStereoDft->ipd_xfade_prev = hStereoDft->gipd[k + k_offset]; - hStereoDft->ipd_xfade_counter = 0; - } - } - - for ( k2 = 1; k2 < hStereoDft->prm_res[k + k_offset]; k2++ ) - { - hStereoDft->gipd[( k + k_offset ) - k2] = hStereoDft->gipd[k + k_offset]; - } - - if ( hStereoDft->frame_sid_nodata ) - { - /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO - if ( hStereoDft->itd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) -#else - if ( hStereoDft->itd[k + k_offset] != hStereoDft->itd_xfade_target ) -#endif - { - hStereoDft->itd_xfade_target = hStereoDft->itd[k + k_offset]; - hStereoDft->itd_xfade_step = ( hStereoDft->itd_xfade_target - hStereoDft->itd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->itd_xfade_counter ); - } - - /* xfade */ - if ( hStereoDft->itd_xfade_prev != hStereoDft->itd_xfade_target && hStereoDft->itd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE && hStereoDft->last_active_element_brate <= 24400 ) - { - hStereoDft->itd[k + k_offset] = hStereoDft->itd_xfade_prev + hStereoDft->itd_xfade_step; - hStereoDft->itd_xfade_prev = hStereoDft->itd[k + k_offset]; - hStereoDft->itd_xfade_counter++; - } - } - else - { - /* First active frame, "reset" everything if long enough active encoding, only triggered if STEREO_DFT_ITD_CNG_XFADE_RESET = -1 */ - if ( active_frame_counter > STEREO_DFT_ITD_CNG_XFADE_RESET ) - { - hStereoDft->itd_xfade_target = hStereoDft->itd[k + k_offset]; - hStereoDft->itd_xfade_prev = hStereoDft->itd[k + k_offset]; - hStereoDft->itd_xfade_counter = 0; - } - - hStereoDft->last_active_element_brate = element_brate; - } - for ( k2 = 1; k2 < hStereoDft->prm_res[k + k_offset]; k2++ ) - { - hStereoDft->itd[( k + k_offset ) - k2] = hStereoDft->itd[k + k_offset]; - } - - return; - } - - /* Active frame, "reset" everything "reset" everything if long enough active encoding */ - if ( active_frame_counter > STEREO_DFT_ITD_CNG_XFADE_RESET ) - { - hStereoDft->itd_xfade_counter = 0; - hStereoDft->itd_xfade_target = hStereoDft->itd[STEREO_DFT_NBDIV - 1]; - hStereoDft->itd_xfade_prev = hStereoDft->itd[STEREO_DFT_NBDIV - 1]; - hStereoDft->ipd_xfade_counter = 0; - hStereoDft->ipd_xfade_target = hStereoDft->gipd[STEREO_DFT_NBDIV - 1]; - hStereoDft->ipd_xfade_prev = hStereoDft->gipd[STEREO_DFT_NBDIV - 1]; - } - - hStereoDft->last_active_element_brate = element_brate; - - for ( k = hStereoDft->prm_res[k_offset] - 1; k < N_div; k += hStereoDft->prm_res[k + k_offset] ) - { - max_res_pred_ind = 0; - - if ( hStereoDft->reverb_flag == 1 ) - { - nbands = min( 10, hStereoDft->nbands_respred ); - - /*Shift 2 last bands residual prediction gains for SWB/FB*/ - if ( hStereoDft->band_res[k_offset] == STEREO_DFT_BAND_RES_HIGH ) - { - for ( b = hStereoDft->nbands_respred - 1; b >= nbands; b-- ) - { - hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] = - hStereoDft->res_gains_ind[1][b - STEREO_DFT_RES_PRED_BAND_MIN_RED + hStereoDft->res_pred_band_min + STEREO_DFT_BAND_MAX]; - hStereoDft->res_gains_ind[1][b - STEREO_DFT_RES_PRED_BAND_MIN_RED + hStereoDft->res_pred_band_min + STEREO_DFT_BAND_MAX] = 0; - } - } - - /* Get maximal index */ - for ( b = hStereoDft->res_pred_band_min; b < ( nbands - STEREO_DFT_RES_PRED_BAND_MIN_CONST ); b++ ) - { - if ( max_res_pred_ind < hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] ) - { - max_res_pred_ind = (int16_t) hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; - } - } - - /* predictive values */ - for ( ; b < nbands; b++ ) - { - assert( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] == 0 ); - hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] = max_res_pred_ind; - } - } - - for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->res_cod_band_max; b++ ) - { - float tmp; - int16_t tmps1, tmps2; - - hStereoDft->res_gains_ind[0][b] = hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; - /*stereo_dft_dequantize_res_gains_f(&hStereoDft->res_gains_ind[0][b], &hStereoDft->res_gains_ind[1][b+STEREO_DFT_BAND_MAX],hStereoDft->side_gain+(k+k_offset)*STEREO_DFT_BAND_MAX+b, hStereoDft->res_pred_gain+(k+k_offset)*STEREO_DFT_BAND_MAX+b, 1);*/ - tmps1 = (int16_t) ( hStereoDft->res_gains_ind[0][b] ); - tmps2 = (int16_t) ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] ); - stereo_dft_dequantize_res_gains( &tmps1, &tmps2, hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, 1 ); - - if ( hStereoDft->attackPresent ) - { - hStereoDft->res_gains_ind[1][b] = 0.8f * hStereoDft->res_gains_ind[1][b]; - } - else if ( hStereoDft->trans || ( hStereoDft->res_pred_mode[k] && ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] < 2.f ) ) ) - { - hStereoDft->res_gains_ind[1][b] = 0.6f * hStereoDft->res_gains_ind[1][b] + 0.4f * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; - } - else - { - hStereoDft->res_gains_ind[1][b] = dft_alpha_s2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_s2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; - } - - stereo_dft_dequantize_res_gains_f( &hStereoDft->res_gains_ind[0][b], &hStereoDft->res_gains_ind[1][b], &tmp, hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, 1 ); - } - - /* Smoothing of prediction gains between ftrames */ - for ( ; b < hStereoDft->nbands; b++ ) - { - if ( hStereoDft->attackPresent ) - { - hStereoDft->res_gains_ind[0][b] = hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; - hStereoDft->res_gains_ind[1][b] = 0.8f * hStereoDft->res_gains_ind[1][b]; - } - else if ( hStereoDft->trans || ( hStereoDft->res_pred_mode[k] && ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] < 2.f ) ) ) - { - hStereoDft->res_gains_ind[0][b] = hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; - - if ( hStereoDft->hConfig->band_res == STEREO_DFT_BAND_RES_LOW ) - { - hStereoDft->res_gains_ind[1][b] = dft_alpha_w_b2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_w_b2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; - } - else - { - hStereoDft->res_gains_ind[1][b] = dft_alpha_w[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_w[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; - } - } - else - { - if ( hStereoDft->hConfig->band_res == STEREO_DFT_BAND_RES_LOW ) - { - hStereoDft->res_gains_ind[0][b] = dft_alpha_s_b2[b] * hStereoDft->res_gains_ind[0][b] + ( 1 - dft_alpha_s_b2[b] ) * hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; - hStereoDft->res_gains_ind[1][b] = dft_alpha_s2_b2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_s2_b2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; - } - else - { - hStereoDft->res_gains_ind[0][b] = dft_alpha_s[b] * hStereoDft->res_gains_ind[0][b] + ( 1 - dft_alpha_s[b] ) * hStereoDft->res_gains_ind[0][b + STEREO_DFT_BAND_MAX]; - hStereoDft->res_gains_ind[1][b] = dft_alpha_s2[b] * hStereoDft->res_gains_ind[1][b] + ( 1 - dft_alpha_s2[b] ) * hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX]; - } - } - - if ( !hStereoDft->recovery_flg ) - { - stereo_dft_dequantize_res_gains_f( &hStereoDft->res_gains_ind[0][b], &hStereoDft->res_gains_ind[1][b], hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, hStereoDft->res_pred_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b, 1 ); - } - } - - /* Smoothing of IPDs*/ - pgIpd = hStereoDft->gipd + ( k + k_offset ); - diff_ipd = pgIpd[0] - pgIpd[-hStereoDft->prm_res[k + k_offset]]; - if ( diff_ipd < -EVS_PI ) - { - pgIpd[0] += PI2; - } - else if ( diff_ipd > EVS_PI ) - { - pgIpd[0] -= PI2; - } - - if ( !hStereoDft->attackPresent ) - { - if ( hStereoDft->wasTransient ) - { - pgIpd[0] = 0.8f * pgIpd[0] + 0.2f * pgIpd[-hStereoDft->prm_res[k + k_offset]]; - } - else - { - pgIpd[0] = 0.5f * pgIpd[0] + 0.5f * pgIpd[-hStereoDft->prm_res[k + k_offset]]; - } - } - - - if ( !hStereoDft->attackPresent ) - { - pSideGain = hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX; - for ( b = 0; b < hStereoDft->res_cod_band_max; b++ ) - { - pSideGain[b] = dft_res_cod_alpha[b] * pSideGain[b] + ( 1 - dft_res_cod_alpha[b] ) * pSideGain[b - hStereoDft->prm_res[k + k_offset] * STEREO_DFT_BAND_MAX]; - } - } - - /*Interpolation between DFT slots*/ - for ( k2 = 1; k2 < hStereoDft->prm_res[k + k_offset]; k2++ ) - { - pInterpol = hStereoDft->gipd + ( ( k + k_offset ) - k2 ); - pIpd = hStereoDft->gipd + ( k + k_offset ); - if ( hStereoDft->attackPresent ) - { - *( pInterpol ) = *( pIpd ); - } - else - { - *( pInterpol ) = *( hStereoDft->gipd + ( k + k_offset - hStereoDft->prm_res[k + k_offset] ) ); - } - - for ( b = 0; b < hStereoDft->nbands; b++ ) - { - *( hStereoDft->res_pred_gain + ( ( k + k_offset ) - k2 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->res_pred_gain + ( k + k_offset - hStereoDft->prm_res[k + k_offset] ) * STEREO_DFT_BAND_MAX + b ); - - if ( b < hStereoDft->res_cod_band_max || hStereoDft->attackPresent || hStereoDft->trans || ( hStereoDft->res_pred_mode[k] && ( hStereoDft->res_gains_ind[1][b + STEREO_DFT_BAND_MAX] < 2.f ) ) ) - { - *( hStereoDft->side_gain + ( ( k + k_offset ) - k2 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->side_gain + ( k + k_offset ) * STEREO_DFT_BAND_MAX + b ); - } - else - { - *( hStereoDft->side_gain + ( ( k + k_offset ) - k2 ) * STEREO_DFT_BAND_MAX + b ) = *( hStereoDft->side_gain + ( k + k_offset - hStereoDft->prm_res[k + k_offset] ) * STEREO_DFT_BAND_MAX + b ); - } - } - - hStereoDft->itd[( k + k_offset ) - k2] = hStereoDft->itd[k + k_offset]; - } /*end of interpolation*/ - } - - return; -} -#endif #endif #ifndef IVAS_FLOAT_FIXED diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index ab8475dfe..9486ea931 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1620,7 +1620,61 @@ ivas_error IVAS_DEC_GetNumOutputChannels( * * Get metadata of one object decoded in the most recent frame *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_DEC_GetObjectMetadata( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */ + const UWord16 zero_flag, /* i : if this flag is enabled, this function outputs a zero-initialized metadata struct */ + const UWord16 objectIdx /* i : index of the queried object */ +) +{ + Decoder_Struct *st_ivas; + ISM_METADATA_HANDLE hIsmMeta; + + IF(hIvasDec == NULL || hIvasDec->st_ivas == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + st_ivas = hIvasDec->st_ivas; + IF(NE_16((Word16)st_ivas->ivas_format, ISM_FORMAT) && NE_16((Word16)st_ivas->ivas_format, MASA_ISM_FORMAT) && NE_16((Word16)st_ivas->ivas_format, SBA_ISM_FORMAT)) + { + return IVAS_ERR_WRONG_MODE; + } + IF(GE_16(objectIdx, st_ivas->nchan_ism)) + { + return IVAS_ERR_INVALID_INDEX; + } + + hIsmMeta = st_ivas->hIsmMetaData[objectIdx]; + + IF(hIsmMeta == NULL || zero_flag) + { + metadata->azimuth_fx = 0; + metadata->elevation_fx = 0; + metadata->radius_fx = 512; + metadata->yaw_fx = 0; + metadata->pitch_fx = 0; + metadata->spread_fx = 0; + metadata->gainFactor_fx = ONE_IN_Q31; + metadata->non_diegetic_flag = 0; + } + ELSE + { + metadata->azimuth_fx = hIsmMeta->azimuth_fx; + metadata->elevation_fx = hIsmMeta->elevation_fx; + metadata->radius_fx = hIsmMeta->radius_fx; + metadata->yaw_fx = hIsmMeta->yaw_fx; + metadata->pitch_fx = hIsmMeta->pitch_fx; + metadata->spread_fx = 0; + metadata->gainFactor_fx = ONE_IN_Q31; + metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag; + } + + return IVAS_ERR_OK; +} +#else ivas_error IVAS_DEC_GetObjectMetadata( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */ @@ -1686,7 +1740,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( #endif return IVAS_ERR_OK; } - +#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetMasaMetadata( ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5865e0184..eaa1f735a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -173,7 +173,11 @@ typedef struct #endif OMASA_ANA_HANDLE hOMasa; uint16_t total_num_objects; +#ifdef IVAS_FLOAT_FIXED + Word32 ism_metadata_delay_ms_fx; +#else float ism_metadata_delay_ms; +#endif } input_ism; #else typedef struct @@ -2264,7 +2268,31 @@ static bool isIoConfigPairSupported( } #endif +#ifdef IVAS_FLOAT_FIXED +static ivas_error initIsmMasaRendering( + input_ism *inputIsm, + const Word32 inSampleRate) +{ + ivas_error error; + + IF(inputIsm->tdRendWrapper.hBinRendererTd != NULL) + { + ivas_td_binaural_close_fx(&inputIsm->tdRendWrapper.hBinRendererTd); + inputIsm->tdRendWrapper.hHrtfTD = NULL; + } + + ivas_rend_closeCrend(&inputIsm->crendWrapper); + + ivas_reverb_close(&inputIsm->hReverb); + IF((error = ivas_omasa_ana_open(&inputIsm->hOMasa, inSampleRate, inputIsm->total_num_objects)) != IVAS_ERR_OK) + { + return error; + } + + return IVAS_ERR_OK; +} +#else static ivas_error initIsmMasaRendering( input_ism *inputIsm, const Word32 inSampleRate ) @@ -2292,6 +2320,7 @@ static ivas_error initIsmMasaRendering( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED @@ -3910,164 +3939,137 @@ static ivas_error initMcBinauralRendering( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, - uint8_t reconfigureFlag ) + UWord8 reconfigureFlag) { ivas_error error; - int32_t binauralDelayNs; - int32_t outSampleRate; - int8_t useTDRend; + Word32 binauralDelayNs; + Word32 outSampleRate; + Word8 useTDRend; /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) or planar MC layouts with headrotation, CREND for the rest */ useTDRend = FALSE; - if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF(NE_16(outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR)) { - if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + test(); + test(); + IF(EQ_16(inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM) && NE_16(outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB)) { useTDRend = TRUE; } - else if ( ( inConfig == IVAS_AUDIO_CONFIG_5_1 || inConfig == IVAS_AUDIO_CONFIG_7_1 ) && - ( inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) + ELSE IF((EQ_16(inConfig, IVAS_AUDIO_CONFIG_5_1) || EQ_16(inConfig, IVAS_AUDIO_CONFIG_7_1)) && + (inputMc->base.ctx.pHeadRotData->headRotEnabled)) { useTDRend = TRUE; } } /* if TD renderer was open and we need to use CREND, close it */ - if ( !reconfigureFlag || ( !useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL ) ) + test(); + IF(!reconfigureFlag || (!useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL)) { - ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); + ivas_td_binaural_close_fx(&inputMc->tdRendWrapper.hBinRendererTd); inputMc->tdRendWrapper.hHrtfTD = NULL; } /* if we need to use TD renderer and CREND was open, close it */ - if ( useTDRend ) + IF(useTDRend) { - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend(&inputMc->crendWrapper); } - if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) + test(); + test(); + IF(!reconfigureFlag || (!useTDRend && NE_16(outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) && inputMc->hReverb != NULL)) { - ivas_reverb_close( &inputMc->hReverb ); + ivas_reverb_close(&inputMc->hReverb); } - if ( !reconfigureFlag || ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) + test(); + test(); + IF(!reconfigureFlag || (EQ_16(inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM) && !inputMc->base.ctx.pHeadRotData->headRotEnabled)) { - if ( inputMc->efapInWrapper.hEfap != NULL ) + IF(inputMc->efapInWrapper.hEfap != NULL) { - efap_free_data( &inputMc->efapInWrapper.hEfap ); + efap_free_data(&inputMc->efapInWrapper.hEfap); } } outSampleRate = *inputMc->base.ctx.pOutSampleRate; - if ( useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL ) + test(); + test(); + IF(useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL) { -#ifdef IVAS_FLOAT_FIXED Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src; - Word16 ivas_format = ( EQ_16( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) ? MC_FORMAT : ISM_FORMAT; - if ( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + IF((error = ivas_td_binaural_open_ext_fx(&inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src)) != IVAS_ERR_OK) { return error; } - Word16 nchan_rend = num_src; - IF( EQ_16( ivas_format, MC_FORMAT ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + IF(EQ_16(outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) && inputMc->hReverb == NULL) { nchan_rend--; /* Skip LFE channel -- added to the others */ } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + FOR(Word16 nS = 0; nS < nchan_rend; nS++) { TDREND_SRC_t *Src_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p != NULL ) + IF(Src_p != NULL) { - IF( Src_p->SrcSpatial_p != NULL ) + IF(Src_p->SrcSpatial_p != NULL) { Src_p->SrcSpatial_p->q_Pos_p = 31; } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; - SrcSpatial_p->q_Pos_p = 31; + IF(inputMc->tdRendWrapper.hBinRendererTd->Sources[nS] != NULL) + { + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputMc->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + SrcSpatial_p->q_Pos_p = 31; } } -#else - if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) + } + if (outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL) { -#ifdef IVAS_FLOAT_FIXED - if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + IF((error = ivas_reverb_open_fx(&(inputMc->hReverb), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate)) != IVAS_ERR_OK) { return error; } -#else - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } } - else if ( !useTDRend && inputMc->crendWrapper == NULL ) + ELSE IF(!useTDRend && inputMc->crendWrapper == NULL) { /* open CREND */ -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif // 1 - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) + IF((error = ivas_rend_openCrend(&inputMc->crendWrapper, (EQ_16(inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM)) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate)) != IVAS_ERR_OK) { return error; } } /* Initialise the EFAP handle for rotation on input layout */ - if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL ) + IF(NE_16(inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM) && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL) { - if ( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) + IF((error = initEfap(&inputMc->efapInWrapper, inConfig, NULL)) != IVAS_ERR_OK) { return error; } } /* determine binaural delay ( used for aligning LFE to output signal ) */ - binauralDelayNs = max( ( inputMc->crendWrapper != NULL ) ? inputMc->crendWrapper->binaural_latency_ns : 0, inputMc->tdRendWrapper.binaural_latency_ns ); - inputMc->binauralDelaySmp = (int16_t) roundf( (float) binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f ); + binauralDelayNs = max((inputMc->crendWrapper != NULL) ? inputMc->crendWrapper->binaural_latency_ns : 0, inputMc->tdRendWrapper.binaural_latency_ns); + Word16 exp = 0; + Word16 var1 = BASOP_Util_Divide3232_Scale(*inputMc->base.ctx.pOutSampleRate, 1000000000, &exp); + Word32 var2 = L_shr_r(Mpy_32_32(binauralDelayNs, L_deposit_h(var1)), -exp);//31 + exp + inputMc->binauralDelaySmp = (Word16)var2; + //inputMc->binauralDelaySmp = (int16_t) roundf( (float) binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f ); - if ( inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES ) + IF(inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES) { - return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid delay for LFE binaural rendering!)" ); + return IVAS_ERROR(IVAS_ERR_WRONG_PARAMS, "Invalid delay for LFE binaural rendering!)"); } return IVAS_ERR_OK; -} + } #else static ivas_error initMcBinauralRendering( input_mc *inputMc, @@ -7426,7 +7428,7 @@ ivas_error IVAS_REND_InitConfig( { return error; } -//#else +#else IF ((error = ivas_render_config_init_from_rom(&hIvasRend->hRendererConfig)) != IVAS_ERR_OK) { return error; @@ -7466,18 +7468,10 @@ ivas_error IVAS_REND_InitConfig( { return error; } -#ifdef IVAS_FLOAT_FIXED - IF( ( error = ivas_render_config_init_from_rom_fx( &hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - /*FLOAT CODE*/ if ( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { return error; } - /*----------*/ } else { @@ -8961,7 +8955,11 @@ static ivas_error renderIsmToBinaural( Word16 exp = *outAudio.pq_fact; push_wmops( "renderIsmToBinaural" ); /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ +#ifdef IVAS_FLOAT_FIXED + ism_md_subframe_update_ext = round_fx(div_l(ismInput->ism_metadata_delay_ms_fx, (1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES))); +#else ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*To be cleaned up later*/ +#endif copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpTDRendBuffer ); #if 1 ismInput->currentPos.azimuth_fx = floatToFixed(ismInput->currentPos.azimuth, Q22); @@ -9425,8 +9423,11 @@ static ivas_error renderIsmToBinauralReverb( push_wmops( "renderIsmToBinauralRoom" ); /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ +#ifdef IVAS_FLOAT_FIXED + ism_md_subframe_update_ext = round_fx(div_l(ismInput->ism_metadata_delay_ms_fx, (1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES))); +#else ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*ism_metadata_delay_ms :To be replaced later*/ - +#endif copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpRendBuffer_fx ); #if 1 ismInput->currentPos.azimuth_fx = floatToFixed(ismInput->currentPos.azimuth, Q22); @@ -12780,7 +12781,26 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( * * Set the Metadata Delay in ms in order to sync with audio delay *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetIsmMetadataDelay( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const Word32 sync_md_delay /* i : ISM Metadata Delay in ms to sync with audio delay */ +) +{ + Word16 i; + + IF(hIvasRend == NULL) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + FOR(i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i) + { + hIvasRend->inputsIsm[i].ism_metadata_delay_ms_fx = sync_md_delay; + } + return IVAS_ERR_OK; +} +#else ivas_error IVAS_REND_SetIsmMetadataDelay( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const float sync_md_delay /* i : ISM Metadata Delay in ms to sync with audio delay */ @@ -12799,6 +12819,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -14543,6 +14564,77 @@ static ivas_error initMasaExtRenderer( } #endif // IVAS_FLOAT_FIXED +#ifdef IVAS_FLOAT_FIXED +static void freeMasaExtRenderer( + MASA_EXT_REND_HANDLE *hMasaExtRendOut) +{ + MASA_EXT_REND_HANDLE hMasaExtRend; + Word16 i; + + IF(hMasaExtRendOut == NULL || *hMasaExtRendOut == NULL) + { + return; + } + + hMasaExtRend = *hMasaExtRendOut; + + IF(hMasaExtRend->hDirACRend != NULL) + { + ivas_dirac_rend_close_fx(&hMasaExtRend->hDirACRend); + } + + IF(hMasaExtRend->hSpatParamRendCom != NULL) + { + ivas_spat_hSpatParamRendCom_close_fx(&hMasaExtRend->hSpatParamRendCom); + } + + IF(hMasaExtRend->hDiracDecBin != NULL) + { + ivas_dirac_dec_close_binaural_data(&hMasaExtRend->hDiracDecBin); + } + + IF (hMasaExtRend->hReverb != NULL) + { + ivas_binaural_reverb_close_fx(&hMasaExtRend->hReverb); + } + + IF(hMasaExtRend->hHrtfParambin != NULL) + { + ivas_HRTF_parambin_binary_close_fx(&hMasaExtRend->hHrtfParambin); + } + + IF(hMasaExtRend->hVBAPdata != NULL) + { + vbap_free_data_fx(&hMasaExtRend->hVBAPdata); + } + + IF(hMasaExtRend->hoa_dec_mtx != NULL) + { + free(hMasaExtRend->hoa_dec_mtx); + } + + FOR(i = 0; i < MASA_MAX_TRANSPORT_CHANNELS; i++) + { + IF(hMasaExtRend->cldfbAnaRend[i] != NULL) + { + deleteCldfb_ivas(&hMasaExtRend->cldfbAnaRend[i]); + } + } + + FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) + { + IF(hMasaExtRend->cldfbSynRend[i] != NULL) + { + deleteCldfb_ivas(&hMasaExtRend->cldfbSynRend[i]); + } + } + + free(hMasaExtRend); + *hMasaExtRendOut = NULL; + + return; +} +#else static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut ) { @@ -14635,6 +14727,7 @@ static void freeMasaExtRenderer( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void intermidiate_ext_dirac_render( diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 3d6cac982..08b14c4d6 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -383,10 +383,17 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( ); #endif +#ifdef IVAS_FLOAT_FIXED +ivas_error IVAS_REND_SetIsmMetadataDelay( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const Word32 sync_md_delay /* i : Metadata Delay in ms to sync with audio delay */ +); +#else ivas_error IVAS_REND_SetIsmMetadataDelay( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const float sync_md_delay /* i : Metadata Delay in ms to sync with audio delay */ ); +#endif ivas_error IVAS_REND_GetNumAllObjects( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ -- GitLab From 46984d172a16402435fab60e70588d15a76d1d48 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 28 May 2024 09:12:42 +0200 Subject: [PATCH 100/101] add merged csv file to artifacts --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db64eb93b..9bfbcb4ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -249,10 +249,11 @@ stages: - unzip artifacts.zip -d previous_artifacts # This wildcard thingy relies on only one csv file being present per job - file_previous="previous_artifacts/mld--ivas-pytest-mld-long-dec-$id_previous--sha-*.csv" - - python3 ci/basop-pages/create_report_pages.py $CI_JOB_NAME-index.html $MLD_ARTIFACT_NAME $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME + - python3 ci/basop-pages/create_report_pages.py $CI_JOB_NAME-index.html $CI_JOB_NAME--merged_csv--$CI_JOB_ID--$id_previous.csv $MLD_ARTIFACT_NAME $file_previous $CI_JOB_ID $id_previous $CI_JOB_NAME - else # create empty file for artifacts to avoid errors - touch $CI_JOB_NAME-index.html + - touch $CI_JOB_NAME--merged_csv--$CI_JOB_ID--$id_previous.csv - fi - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi @@ -271,6 +272,7 @@ stages: - report.html - $CI_JOB_NAME-index.html - $MLD_ARTIFACT_NAME + - $CI_JOB_NAME-merged_csv--$CI_JOB_ID--$id_previous.csv expose_as: "pytest mld results" reports: junit: -- GitLab From 34498a8a2ad6759c55af89e34a716b1a4fec5339 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 28 May 2024 14:12:21 +0530 Subject: [PATCH 101/101] SVD functions fixed point implementation --- lib_com/ivas_prot.h | 26 +- lib_com/options.h | 1 + lib_dec/ivas_dirac_output_synthesis_cov.c | 418 ++++---- lib_dec/ivas_svd_dec.c | 1159 ++++++++++++++++++++- 4 files changed, 1400 insertions(+), 204 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 11d2199a1..4bb9dcaa4 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4823,7 +4823,9 @@ Word16 matrix_product_mant_exp( Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ Word16 *Z_e /* o : resulting matrix after the matrix multiplication */ ); +#endif +#ifdef IVAS_FLOAT_FIXED void mat2svdMat_fx( const Word32 *mat, /* i : matrix as column ordered vector */ Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o : matrix as two-dimensional arry */ @@ -4838,7 +4840,7 @@ void svdMat2mat_fx( const Word16 nRows, /* i : number of rows of the matrix */ const Word16 mCols /* i : number of columns of the matrix */ ); -#endif +#else void mat2svdMat( const float *mat, /* i : matrix as column ordered vector */ @@ -4854,6 +4856,7 @@ void svdMat2mat( const int16_t nRows, /* i : number of rows of the matrix */ const int16_t mCols /* i : number of columns of the matrix */ ); +#endif int16_t matrix_diag_product( const float *X, /* i : left hand matrix */ @@ -4896,6 +4899,7 @@ void cmplx_matrix_square( float *imagZ /* o : imaginary part of the resulting matrix */ ); +#ifndef IVAS_FLOAT_FIXED int16_t computeMixingMatrices( const int16_t num_inputs, /* i : number of input channels */ const int16_t num_outputs, /* i : number of output channels */ @@ -4909,7 +4913,7 @@ int16_t computeMixingMatrices( float *Cr /* o : residual covariance matrix */ ); -#ifdef IVAS_FLOAT_FIXED +#else Word16 computeMixingMatrices_fx( const Word16 num_inputs, /* i : number of input channels */ const Word16 num_outputs, /* i : number of output channels */ @@ -4931,6 +4935,7 @@ Word16 computeMixingMatrices_fx( ); #endif +#ifndef IVAS_FLOAT_FIXED int16_t computeMixingMatricesResidual( const int16_t num_outputs, /* i : number of output channels */ const float *Cx, /* i : vector containing the diagonal diffuse prototype covariance */ @@ -4940,7 +4945,7 @@ int16_t computeMixingMatricesResidual( float *mixing_matrix /* o : resulting residual mixing matrix */ ); -#ifdef IVAS_FLOAT_FIXED +#else Word16 computeMixingMatricesResidual_fx( const Word32 num_outputs, /* i : number of output channels */ const Word32 *Cx_fx, /* i : vector containing the diagonal diffuse prototype covariance */ @@ -4956,6 +4961,19 @@ Word16 computeMixingMatricesResidual_fx( ); #endif +#ifdef IVAS_FLOAT_FIXED +/*! r: error or success */ +Word16 svd_fx( + Word32 InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) */ + Word16 InputMatrix_e, + Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* o : left singular vectors (U) */ + Word32 singularValues[MAX_OUTPUT_CHANNELS], /* o : singular values vector (S) */ + Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], /* o : right singular vectors (V) */ + Word16 *singularValues_fx_e, + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed */ + const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed */ +); +#else /*! r: error or success */ int16_t svd( float InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) */ @@ -4965,6 +4983,8 @@ int16_t svd( const int16_t nChannelsL, /* i : number of rows in the matrix to be decomposed */ const int16_t nChannelsC /* i : number of columns in the matrix to be decomposed */ ); +#endif + #ifdef IVAS_FLOAT_FIXED ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ diff --git a/lib_com/options.h b/lib_com/options.h index 5f8aa90fe..3ebbc28ef 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -137,6 +137,7 @@ #define FIX_747_TDBWE_ENERGY_BURST #define FIX_770_DISCONTINUITIES_SW_TCX2ACELP // Fix discontinuities when switching from TCX to ACELP #define FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step was right shift by 2, which made the OVA wrong */ +#define NONBE_FIX_1069_SVD_TUNING /* FhG: issue 1069: tune SVD constants */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 21ae3761b..42d1c3ce9 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -1229,6 +1229,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( * compute a mixing matrix using the convariance synthesis approach *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED int16_t computeMixingMatrices( const int16_t num_inputs, /* i : number of input channels */ const int16_t num_outputs, /* i : number of output channels */ @@ -1489,7 +1490,7 @@ int16_t computeMixingMatrices( -#ifdef IVAS_FLOAT_FIXED +#else Word16 computeMixingMatrices_fx( const Word16 num_inputs, /* i : number of input channels */ const Word16 num_outputs, /* i : number of output channels */ @@ -1510,28 +1511,24 @@ Word16 computeMixingMatrices_fx( Word16 *Cr_e ) { - int16_t i, j; - int16_t out = EXIT_SUCCESS; - int16_t nL, nC; - int16_t lengthCx = num_inputs; - int16_t lengthCy = num_outputs; - float svd_in_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - float svd_u_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - float svd_s_buffer[MAX_OUTPUT_CHANNELS]; - float svd_v_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; + Word16 i, j; + Word16 out = EXIT_SUCCESS; + Word16 nL, nC; + Word16 lengthCx = num_inputs; + Word16 lengthCy = num_outputs; Word32 svd_in_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; Word32 mat_mult_buffer1_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; Word32 mat_mult_buffer2_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; Word32 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word32 Cy_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word32 svd_u_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - Word32 svd_v_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; + Word32 svd_u_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; //Q31 out + Word32 svd_v_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; //Q31 out //Word16 mat_mult_buffer1_fx_e; Word16 Cx_fx_e; Word16 Cy_fx_e; - Word16 svd_u_buffer_fx_e[MAX_OUTPUT_CHANNELS]; - Word16 svd_v_buffer_fx_e[MAX_OUTPUT_CHANNELS]; + //Word16 svd_u_buffer_fx_e[MAX_OUTPUT_CHANNELS]; + //Word16 svd_v_buffer_fx_e[MAX_OUTPUT_CHANNELS]; Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS]; Word16 svd_s_buffer_e[MAX_OUTPUT_CHANNELS]; @@ -1614,19 +1611,8 @@ Word16 computeMixingMatrices_fx( /* Processing the SVD */ mat2svdMat_fx( Cy_fx, svd_in_buffer_fx, lengthCy, lengthCy, 0 ); - FOR ( Word32 g = 0; g < lengthCy; g++ ) - { - me2f_buf( ( svd_in_buffer_fx[g] ), Cy_fx_e, ( svd_in_buffer[g] ), lengthCy ); - } - svd( svd_in_buffer, svd_u_buffer, svd_s_buffer, svd_v_buffer, lengthCy, lengthCy ); - - f2me_buf(svd_s_buffer, svd_s_buffer_fx, &svd_s_buffer_fx_e, lengthCy); - FOR(Word32 g = 0; g < lengthCy; g++) - { - f2me_buf((svd_u_buffer[g]), (svd_u_buffer_fx[g]), &svd_u_buffer_fx_e[g], lengthCy); - f2me_buf((svd_v_buffer[g]), (svd_v_buffer_fx[g]), &svd_v_buffer_fx_e[g], lengthCy); - } + svd_fx(svd_in_buffer_fx, Cy_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, &svd_s_buffer_fx_e, lengthCy, lengthCy ); /* Computing Ky */ @@ -1639,7 +1625,7 @@ Word16 computeMixingMatrices_fx( tmp_e = svd_s_buffer_fx_e; L_tmp = Sqrt32(svd_s_buffer_fx[j], &tmp_e); Ky_fx[i + j * lengthCy] = Mpy_32_32( svd_u_buffer_fx[i][j], L_tmp ); - Ky_fx_e[i + j * lengthCy] = svd_u_buffer_fx_e[i] + tmp_e; + Ky_fx_e[i + j * lengthCy] = + tmp_e; } } @@ -1664,21 +1650,8 @@ Word16 computeMixingMatrices_fx( /* Processing the SVD */ mat2svdMat_fx( Cx_fx, svd_in_buffer_fx, lengthCx, lengthCx, 0 ); - FOR ( Word32 g = 0; g < lengthCx; g++ ) - { - me2f_buf( ( svd_in_buffer_fx[g] ), Cx_fx_e, ( svd_in_buffer[g] ), lengthCx ); - } - - - svd( svd_in_buffer, svd_u_buffer, svd_s_buffer, svd_v_buffer, lengthCx, lengthCx ); - f2me_buf(svd_s_buffer, svd_s_buffer_fx, &svd_s_buffer_fx_e, lengthCx); - FOR(Word32 g = 0; g < lengthCy; g++) - { - f2me_buf((svd_u_buffer[g]), (svd_u_buffer_fx[g]), &svd_u_buffer_fx_e[g], lengthCx); - f2me_buf((svd_v_buffer[g]), (svd_v_buffer_fx[g]), &svd_v_buffer_fx_e[g], lengthCx); - } - + svd_fx( svd_in_buffer_fx, Cx_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, &svd_s_buffer_fx_e, lengthCx, lengthCx ); FOR ( i = 0; i < lengthCx; ++i ) { @@ -1687,7 +1660,7 @@ Word16 computeMixingMatrices_fx( tmp_e = svd_s_buffer_fx_e; L_tmp = Sqrt32(svd_s_buffer_fx[j], &tmp_e); Kx_fx[i + j * lengthCx] = Mpy_32_32( svd_u_buffer_fx[i][j], L_tmp ); - Kx_fx_e[i + j * lengthCx] = svd_u_buffer_fx_e[i] + tmp_e; + Kx_fx_e[i + j * lengthCx] = tmp_e; } } @@ -1776,7 +1749,7 @@ Word16 computeMixingMatrices_fx( FOR ( j = 0; j < lengthCx; ++j ) { Kx_reg_inv_fx[i + j * lengthCx] = Mpy_32_16_1(svd_u_buffer_fx[j][i], reg_fac_fx ); - Kx_reg_inv_e[i + j * lengthCx] = svd_u_buffer_fx_e[j] + scale; + Kx_reg_inv_e[i + j * lengthCx] = scale; } } @@ -1906,17 +1879,17 @@ Word16 computeMixingMatrices_fx( mat2svdMat_fx( mat_mult_buffer1_fx, svd_in_buffer_fx, lengthCx, lengthCy, 1 ); #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR ( Word32 g = 0; g < lengthCy; g++ ) + /*FOR ( Word32 g = 0; g < lengthCy; g++ ) { me2f_buf( ( svd_in_buffer_fx[g] ), mat_mult_buffer1_e, ( svd_in_buffer[g] ), lengthCx ); - } + }*/ nL = lengthCy; move16(); nC = lengthCx; move16(); - svd( svd_in_buffer, svd_v_buffer, svd_s_buffer, svd_u_buffer, nL, nC ); + svd_fx(svd_in_buffer_fx, mat_mult_buffer1_e, svd_v_buffer_fx, svd_s_buffer_fx, svd_u_buffer_fx, &svd_s_buffer_fx_e, nL, nC ); #endif } ELSE @@ -1924,17 +1897,12 @@ Word16 computeMixingMatrices_fx( mat2svdMat_fx( mat_mult_buffer1_fx, svd_in_buffer_fx, lengthCx, lengthCy, 0 ); #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR ( Word32 g = 0; g < lengthCx; g++ ) - { - me2f_buf( ( svd_in_buffer_fx[g] ), mat_mult_buffer1_e, ( svd_in_buffer[g] ), lengthCy ); - } - nL = lengthCx; move16(); nC = lengthCy; move16(); - svd( svd_in_buffer, svd_u_buffer, svd_s_buffer, svd_v_buffer, nL, nC ); + svd_fx( svd_in_buffer_fx, mat_mult_buffer1_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, &svd_s_buffer_fx_e, nL, nC ); #endif } @@ -1943,53 +1911,11 @@ Word16 computeMixingMatrices_fx( /* can be skipped: lambda is always column-truncated identity matrix, so this operation just truncates V to num_input_channel columns */ - Word16 min_q = -1; - move16(); - FOR ( Word32 g = 0; g < lengthCy; g++ ) - { - f2me_buf( svd_v_buffer[g], svd_v_buffer_fx[g], &svd_v_buffer_fx_e[g], lengthCx ); - IF ( svd_v_buffer_fx_e[g] > min_q) - { - min_q = svd_v_buffer_fx_e[g]; - } - } - - FOR ( Word32 g = 0; g < lengthCy; g++ ) - { - FOR ( Word32 h = 0; h < lengthCx; h++ ) - { - svd_v_buffer_fx[g][h] = L_shr( svd_v_buffer_fx[g][h], min_q - svd_v_buffer_fx_e[g] ); - } - } - svd_v_buffer_fx_e[0] = min_q; - move16(); - - min_q = -1; - move16(); - FOR ( Word32 g = 0; g < lengthCx; g++ ) - { - f2me_buf( svd_u_buffer[g], svd_u_buffer_fx[g], &svd_u_buffer_fx_e[g], lengthCx ); - IF ( svd_u_buffer_fx_e[g] > min_q ) - { - min_q = svd_u_buffer_fx_e[g]; - move16(); - } - } - - FOR ( Word32 g = 0; g < lengthCx; g++ ) - { - FOR ( Word32 h = 0; h < lengthCx; h++ ) - { - svd_u_buffer_fx[g][h] = L_shr( svd_u_buffer_fx[g][h], min_q - svd_u_buffer_fx_e[g] ); - } - } - svd_u_buffer_fx_e[0] = min_q; - move16(); svdMat2mat_fx( svd_v_buffer_fx, mat_mult_buffer1_fx, lengthCy, lengthCx ); svdMat2mat_fx( svd_u_buffer_fx, mat_mult_buffer2_fx, lengthCx, lengthCx ); - mat_mult_buffer1_e = svd_v_buffer_fx_e[0]; - mat_mult_buffer2_e = svd_u_buffer_fx_e[0]; + mat_mult_buffer1_e = 0; + mat_mult_buffer2_e = 0; guard_bits = find_guarded_bits_fx(lengthCx + 1); FOR(i = 0; i < lengthCx * lengthCy; ++i) @@ -2151,6 +2077,7 @@ Word16 computeMixingMatrices_fx( * compute a residual mixing matrix using the covariance synthesis approach *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED int16_t computeMixingMatricesResidual( const int16_t num_outputs, /* i : number of output channels */ const float *Cx, /* i : vector containing the diagonal diffuse prototype covariance */ @@ -2343,7 +2270,7 @@ int16_t computeMixingMatricesResidual( return out; } -#ifdef IVAS_FLOAT_FIXED +#else Word16 computeMixingMatricesResidual_fx( const Word32 num_outputs, /* i : number of output channels */ const Word32 *Cx_fx, /* i : vector containing the diagonal diffuse prototype covariance */ @@ -2363,20 +2290,10 @@ Word16 computeMixingMatricesResidual_fx( Word16 lengthCx = extract_l(num_outputs); Word16 lengthCy = extract_l(num_outputs); -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - float svd_in_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - float svd_u_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - float svd_s_buffer[MAX_OUTPUT_CHANNELS]; - float svd_v_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; -#endif - Word32 svd_in_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; Word32 mat_mult_buffer2_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - Word32 svd_u_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - Word32 svd_v_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; - - Word16 svd_u_buffer_fx_e[MAX_OUTPUT_CHANNELS]; - Word16 svd_v_buffer_fx_e[MAX_OUTPUT_CHANNELS]; + Word32 svd_u_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; //Q31 out + Word32 svd_v_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; //Q31 out Word16 mat_mult_buffer1_buff_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; @@ -2428,20 +2345,7 @@ Word16 computeMixingMatricesResidual_fx( /* linear array to svd buffer */ mat2svdMat_fx( Cy_fx, svd_in_buffer_fx, lengthCy, lengthCy, 0 ); -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR ( Word32 g = 0; g < lengthCy; g++ ) - { - me2f_buf( ( svd_in_buffer_fx[g] ), Cy_fx_e, ( svd_in_buffer[g] ), lengthCy ); - } - - svd(svd_in_buffer, svd_u_buffer, svd_s_buffer, svd_v_buffer, lengthCy, lengthCy); - f2me_buf(svd_s_buffer, svd_s_buffer_fx, &svd_s_buffer_fx_e, lengthCy); - FOR(Word32 g = 0; g < lengthCy; g++) - { - f2me_buf((svd_u_buffer[g]), (svd_u_buffer_fx[g]), &svd_u_buffer_fx_e[g], lengthCy); - f2me_buf((svd_v_buffer[g]), (svd_v_buffer_fx[g]), &svd_v_buffer_fx_e[g], lengthCy); - } -#endif + svd_fx( svd_in_buffer_fx, Cy_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, &svd_s_buffer_fx_e, lengthCy, lengthCy ); /* Computing Ky */ FOR ( i = 0; i < lengthCy; ++i ) @@ -2451,7 +2355,7 @@ Word16 computeMixingMatricesResidual_fx( tmp_e = svd_s_buffer_fx_e; L_tmp = Sqrt32(svd_s_buffer_fx[j], &tmp_e); Ky_fx[i + j * lengthCy] = Mpy_32_32( svd_u_buffer_fx[i][j], L_tmp ); - Ky_fx_e[i + j * lengthCy] = svd_u_buffer_fx_e[i] + tmp_e; + Ky_fx_e[i + j * lengthCy] = tmp_e; } } @@ -2646,61 +2550,20 @@ Word16 computeMixingMatricesResidual_fx( mat2svdMat_fx( mat_mult_buffer1_fx, svd_in_buffer_fx, lengthCx, lengthCy, 0 ); - FOR ( Word32 g = 0; g < lengthCx; g++ ) + /*FOR ( Word32 g = 0; g < lengthCx; g++ ) { me2f_buf( ( svd_in_buffer_fx[g] ), mat_mult_buffer1_e, ( svd_in_buffer[g] ), lengthCy ); - } + }*/ -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - svd( svd_in_buffer, svd_u_buffer, svd_s_buffer, svd_v_buffer, lengthCx, lengthCy ); + svd_fx( svd_in_buffer_fx, mat_mult_buffer1_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, &svd_s_buffer_fx_e, lengthCx, lengthCy ); /* Actually Processing P */ - Word16 min_q = -1; - FOR ( Word32 g = 0; g < lengthCy; g++ ) - { - f2me_buf( svd_v_buffer[g], svd_v_buffer_fx[g], &svd_v_buffer_fx_e[g], lengthCx ); - IF ( svd_v_buffer_fx_e[g] > min_q ) - { - min_q = svd_v_buffer_fx_e[g]; - } - } - FOR ( Word32 g = 0; g < lengthCy; g++ ) - { - FOR ( Word32 h = 0; h < lengthCx; h++ ) - { - svd_v_buffer_fx[g][h] = L_shr( svd_v_buffer_fx[g][h], min_q - svd_v_buffer_fx_e[g] ); - } - } - svd_v_buffer_fx_e[0] = min_q; - - min_q = -1; - move16(); - FOR ( Word32 g = 0; g < lengthCx; g++ ) - { - f2me_buf( svd_u_buffer[g], svd_u_buffer_fx[g], &svd_u_buffer_fx_e[g], lengthCx ); - IF ( svd_u_buffer_fx_e[g] > min_q ) - { - min_q = svd_u_buffer_fx_e[g]; - move16(); - } - } - - FOR ( Word32 g = 0; g < lengthCx; g++ ) - { - FOR ( Word32 h = 0; h < lengthCx; h++ ) - { - svd_u_buffer_fx[g][h] = L_shr( svd_u_buffer_fx[g][h], min_q - svd_u_buffer_fx_e[g] ); - } - } - svd_u_buffer_fx_e[0] = min_q; - move16(); -#endif svdMat2mat_fx( svd_v_buffer_fx, mat_mult_buffer1_fx, lengthCy, lengthCx ); svdMat2mat_fx( svd_u_buffer_fx, mat_mult_buffer2_fx, lengthCx, lengthCx ); - mat_mult_buffer2_e = svd_u_buffer_fx_e[0]; + mat_mult_buffer2_e = 0; move16(); - mat_mult_buffer1_e = svd_v_buffer_fx_e[0]; + mat_mult_buffer1_e = 0; move16(); Word16 guard_bits = find_guarded_bits_fx( lengthCx + 1 ); @@ -2728,7 +2591,7 @@ Word16 computeMixingMatricesResidual_fx( matrix_product_fx( mat_mult_buffer1_fx, lengthCy, lengthCx, 0, mat_mult_buffer2_fx, lengthCx, lengthCx, 1, mat_mult_buffer3_fx ); - mat_mult_buffer3_e = svd_v_buffer_fx_e[0] + svd_u_buffer_fx_e[0]; + mat_mult_buffer3_e = 0; /*-----------------------------------------------------------------* * Formulate M @@ -2835,7 +2698,7 @@ Word16 computeMixingMatricesResidual_fx( * * *-------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED int16_t computeMixingMatricesISM( const int16_t num_inputs, const int16_t num_responses, @@ -2887,6 +2750,8 @@ int16_t computeMixingMatricesISM( Word32 svd_in_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; Word32 svd_u_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; + Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS]; + Word16 svd_s_buffer_fx_e; Word32 svd_v_buffer_fx[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; Word16 mat_mult_buffer1_fx_e; @@ -3034,36 +2899,44 @@ int16_t computeMixingMatricesISM( #ifdef IVAS_FLOAT_FIXED f2me_buf( mat_mult_buffer1, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e, lengthCx * num_responses ); mat2svdMat_fx( mat_mult_buffer1_fx, svd_in_buffer_fx, lengthCx, num_responses, 1 ); - - FOR ( Word32 g = 0; g < num_responses; g++ ) - { - me2f_buf( ( svd_in_buffer_fx[g] ), mat_mult_buffer1_fx_e, ( svd_in_buffer[g] ), lengthCx ); - } #else mat2svdMat( mat_mult_buffer1, svd_in_buffer, lengthCx, num_responses, 1 ); #endif nL = num_responses; nC = lengthCx; - svd( svd_in_buffer, svd_v_buffer, svd_s_buffer, svd_u_buffer, nL, nC ); + svd_fx( svd_in_buffer_fx, mat_mult_buffer1_fx_e, svd_v_buffer_fx, svd_s_buffer_fx, svd_u_buffer_fx, &svd_s_buffer_fx_e, nL, nC ); + + //local fix2float: to be removed + for ( i = 0; i < nL; i++) { + me2f_buf(svd_v_buffer_fx[i], 0, svd_v_buffer[i], nC); + } + for ( i = 0; i < nC; i++) { + me2f_buf(svd_u_buffer_fx[i], 0, svd_u_buffer[i], nC); + } + me2f_buf(svd_s_buffer_fx, svd_s_buffer_fx_e, svd_s_buffer, nC); } else { #ifdef IVAS_FLOAT_FIXED f2me_buf( mat_mult_buffer1, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e, lengthCx * num_responses ); mat2svdMat_fx( mat_mult_buffer1_fx, svd_in_buffer_fx, lengthCx, num_responses, 0 ); - - FOR ( Word32 g = 0; g < lengthCx; g++ ) - { - me2f_buf( ( svd_in_buffer_fx[g] ), mat_mult_buffer1_fx_e, ( svd_in_buffer[g] ), num_responses ); - } #else mat2svdMat( mat_mult_buffer1, svd_in_buffer, lengthCx, num_responses, 0 ); #endif nL = lengthCx; nC = num_responses; - svd( svd_in_buffer, svd_u_buffer, svd_s_buffer, svd_v_buffer, nL, nC ); + svd_fx(svd_in_buffer_fx, mat_mult_buffer1_fx_e, svd_u_buffer_fx, svd_s_buffer_fx, svd_v_buffer_fx, &svd_s_buffer_fx_e, nL, nC ); + + //local fix2float: to be removed + for ( i = 0; i < nL; i++) { + me2f_buf(svd_u_buffer_fx[i], 0, svd_u_buffer[i], nC); + } + for ( i = 0; i < nC; i++) { + me2f_buf(svd_v_buffer_fx[i], 0, svd_v_buffer[i], nC); + } + me2f_buf(svd_s_buffer_fx, svd_s_buffer_fx_e, svd_s_buffer, nC); } /* Actually Processing P */ @@ -3188,3 +3061,180 @@ int16_t computeMixingMatricesISM( return out; } +#else +int16_t computeMixingMatricesISM( + const int16_t num_inputs, + const int16_t num_responses, + const int16_t num_outputs, + const float *responses, + const float *ener, + const float *Cx_diag, + const float *Cy_diag, + const float *Q, + const int16_t energy_compensation_flag, + const float reg_Sx, + const float reg_ghat, + float *mixing_matrix ) +{ + int16_t i, out; + int16_t lengthCx, lengthCy; + float *Cy_tilde_p; + float *adj; + float limit; + float svd_in_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; + float svd_u_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; + float svd_s_buffer[MAX_OUTPUT_CHANNELS]; + float svd_v_buffer[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; + float Kx[MAX_TRANSPORT_CHANNELS]; + float Ky[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; + float Kx_reg_inv[MAX_TRANSPORT_CHANNELS]; + float Q_Cx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; + float Cy_hat_diag[MAX_OUTPUT_CHANNELS]; + float G_hat[MAX_OUTPUT_CHANNELS]; + float mat_mult_buffer1[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; + float mat_mult_buffer2[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; + float mat_mult_buffer3[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; + int16_t nL, nC; + + push_wmops( "dirac_cov_mix_mat" ); + + out = EXIT_SUCCESS; + lengthCx = num_inputs; + lengthCy = num_outputs; + + set_zero( svd_s_buffer, MAX_OUTPUT_CHANNELS ); + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + set_zero( svd_in_buffer[i], MAX_OUTPUT_CHANNELS ); + set_zero( svd_u_buffer[i], MAX_OUTPUT_CHANNELS ); + set_zero( svd_v_buffer[i], MAX_OUTPUT_CHANNELS ); + } + + /* Decomposition of Cy = Ky*Ky' */ + /* Ky = responses*diag(ener) */ + matrix_diag_product( responses, lengthCy, num_responses, 0, ener, num_responses, Ky ); + + /* Decomposition of Cx -> Computing Kx */ + v_sqrt( Cx_diag, Kx, lengthCx ); + + /* Regularization of Sx */ + maximum( Kx, lengthCx, &limit ); + limit = limit * reg_Sx + EPSILON; + + for ( i = 0; i < lengthCx; ++i ) + { + svd_s_buffer[i] = ( ( Kx[i] > limit ) ? Kx[i] : limit ); + } + + limit = 0.0f; + + /* regularized Kx-1 */ + + for ( i = 0; i < lengthCx; ++i ) + { + float reg_fac = ( 1.0f / svd_s_buffer[i] ); + Kx_reg_inv[i] = reg_fac; + } + + /************************ normalization matrix G hat **********************/ + + /* Computing Q*Cx*Q' */ + matrix_diag_product( Q, lengthCy, lengthCx, 0, Cx_diag, lengthCx, Q_Cx ); + matrix_product_diag( Q_Cx, lengthCy, lengthCx, 0, Q, lengthCy, lengthCx, 1, Cy_hat_diag ); + + /* Computing Cy_hat_diag */ + for ( i = 0; i < lengthCy; ++i ) + { + if ( Cy_hat_diag[i] > limit ) + { + limit = Cy_hat_diag[i]; + } + } + + + limit = limit * reg_ghat + EPSILON; + + /* Computing G_hat */ + for ( i = 0; i < lengthCy; ++i ) + { + if ( limit > Cy_hat_diag[i] ) /* Computing Cy_hat_diag = max(Cy_hat_diag,limit) */ + { + Cy_hat_diag[i] = limit; + } + G_hat[i] = sqrtf( Cy_diag[i] / Cy_hat_diag[i] ); + } + + /************************ Formulate optimal P **********************/ + + /* Computing the input matrix Kx'*Q'*G_hat'*Ky */ + diag_matrix_product( Kx, lengthCx, Q, lengthCy, lengthCx, 1, mat_mult_buffer1 ); + matrix_diag_product( mat_mult_buffer1, lengthCx, lengthCy, 0, G_hat, lengthCy, mat_mult_buffer2 ); + matrix_product( mat_mult_buffer2, lengthCx, lengthCy, 0, Ky, lengthCy, num_responses, 0, mat_mult_buffer1 ); + + if ( lengthCx < num_responses ) + { + mat2svdMat( mat_mult_buffer1, svd_in_buffer, lengthCx, num_responses, 1 ); + nL = num_responses; + nC = lengthCx; + svd( svd_in_buffer, svd_v_buffer, svd_s_buffer, svd_u_buffer, nL, nC ); + } + else + { + mat2svdMat( mat_mult_buffer1, svd_in_buffer, lengthCx, num_responses, 0 ); + nL = lengthCx; + nC = num_responses; + svd( svd_in_buffer, svd_u_buffer, svd_s_buffer, svd_v_buffer, nL, nC ); + } + + /* Actually Processing P */ + + /* can be skipped: lambda is always column-truncated identity matrix, so this operation just truncates V to num_input_channel columns */ + svdMat2mat( svd_v_buffer, mat_mult_buffer1, num_responses, lengthCx ); + svdMat2mat( svd_u_buffer, mat_mult_buffer2, lengthCx, lengthCx ); + + matrix_product( mat_mult_buffer1, num_responses, lengthCx, 0, mat_mult_buffer2, lengthCx, lengthCx, 1, mat_mult_buffer3 ); + + /************************ Formulate M **********************/ + + matrix_product( Ky, lengthCy, num_responses, 0, mat_mult_buffer3, num_responses, lengthCx, 0, mat_mult_buffer1 ); + + matrix_diag_product( mat_mult_buffer1, lengthCy, lengthCx, 0, Kx_reg_inv, lengthCx, mixing_matrix ); + + /*********************** Energy Compensation ****************/ + + /* Compute Cy_tilde = M*Cx*M' */ + matrix_diag_product( mixing_matrix, lengthCy, lengthCx, 0, Cx_diag, lengthCx, mat_mult_buffer1 ); + matrix_product( mat_mult_buffer1, lengthCy, lengthCx, 0, mixing_matrix, lengthCy, lengthCx, 1, mat_mult_buffer2 ); + + if ( energy_compensation_flag == 1 ) + { + adj = svd_s_buffer; + Cy_tilde_p = mat_mult_buffer2; + for ( i = 0; i < lengthCy; ++i ) + { + /* Avoid correction for very small energies, main diagonal elements of Cy_tilde_p may be negative */ + if ( Cy_tilde_p[i + i * lengthCy] < 0.0f ) + { + adj[i] = 1.0f; + } + else + { + adj[i] = sqrtf( Cy_diag[i] / ( Cy_tilde_p[i + i * lengthCy] + EPSILON ) ); + } + + if ( adj[i] > 4.0f ) + { + adj[i] = 4.0f; + } + } + + diag_matrix_product( adj, lengthCy, mixing_matrix, lengthCy, lengthCx, 0, mat_mult_buffer3 ); + + mvr2r( mat_mult_buffer3, mixing_matrix, lengthCy * lengthCx ); + } + + pop_wmops(); + + return out; +} +#endif \ No newline at end of file diff --git a/lib_dec/ivas_svd_dec.c b/lib_dec/ivas_svd_dec.c index eb1f7e16b..a107a4614 100644 --- a/lib_dec/ivas_svd_dec.c +++ b/lib_dec/ivas_svd_dec.c @@ -38,6 +38,8 @@ #include "ivas_cnst.h" #include #include "wmc_auto.h" +#include "prot_fx1.h" +#include "prot_fx2.h" /*-----------------------------------------------------------------------* @@ -45,16 +47,27 @@ *-----------------------------------------------------------------------*/ /* The SVD is sensitive to changes to the following constants, so please be careful when trying to tune things */ +#define SVD_MAX_NUM_ITERATION 75 /* maximum number of interations before exiting the SVD */ +#ifndef IVAS_FLOAT_FIXED +#ifdef NONBE_FIX_1069_SVD_TUNING +#define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ +#define CONVERGENCE_FACTOR 1.0e-04f /* factor for SVD convergence */ +#define SVD_ZERO_FLUSH_THRESHOLD 0.0f +#else #define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ #define CONVERGENCE_FACTOR 1.19209290e-07f /* factor for SVD convergence */ -#define SVD_MAX_NUM_ITERATION 75 /* maximum number of interations before exiting the SVD */ #define SVD_ZERO_FLUSH_THRESHOLD 1.0e-20f - - +#endif +#else +#define SVD_MINIMUM_VALUE_FX ( 2 ) /* minimum value */ +#define SVD_ZERO_FLUSH_THRESHOLD_FX ( 0 ) +#define CONVERGENCE_FACTOR_FX 214748 /* factor for SVD convergence (as per latest float code: 1.0e-04f) */ +#endif /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float GivensRotation( const float x, const float z ); static void biDiagonalReductionLeft( float singularVectors[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], float secDiag[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *sig_x, float *g ); @@ -78,6 +91,127 @@ static float maxWithSign( const float a ); static void flushToZeroArray( float arr[MAX_OUTPUT_CHANNELS], const int16_t length ); static void flushToZeroMat( float mat[][MAX_OUTPUT_CHANNELS], const int16_t m, const int16_t n ); +#else +static void HouseholderReduction_fx( + Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], + Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], + Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], + Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], + Word16 singularVectors_Left_e, + Word16 *singularValues_fx_e, + Word16 *secDiag_fx_e, + const int16_t nChannelsL, + const int16_t nChannelsC, + Word32 *eps_x_fx, + Word16 *eps_x_fx_e); + +static void biDiagonalReductionLeft_fx( + Word32 singularVectors[][MAX_OUTPUT_CHANNELS], + Word32 singularValues[MAX_OUTPUT_CHANNELS], + Word32 secDiag[MAX_OUTPUT_CHANNELS], + Word16 *singularVectors_e, + Word16 *singularValues_e, + Word16 *secDiag_e, + const Word16 nChannelsL, + const Word16 nChannelsC, + const Word16 currChannel, + Word32 *sig_x, + Word16 *sig_x_e, + Word32 *g); // Q31 + +static void biDiagonalReductionRight_fx( + Word32 singularVectors[][MAX_OUTPUT_CHANNELS], + Word32 secDiag[MAX_OUTPUT_CHANNELS], + Word16 *singularVectors_e, + Word16 *secDiag_e, + const Word16 nChannelsL, + const Word16 nChannelsC, + const Word16 currChannel, + Word32 *sig_x, + Word16 *sig_x_e, + Word32 *g); //Q31 + +static void singularVectorsAccumulationLeft_fx( + Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], //Q31 output + Word32 singularValues[MAX_OUTPUT_CHANNELS], + Word16 singularVectors_e, + Word16 singularValues_e, + const Word16 nChannelsL, + const Word16 nChannelsC); + +static void singularVectorsAccumulationRight_fx( + Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], + Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], //Q31 output + Word32 secDiag[MAX_OUTPUT_CHANNELS], + Word16 singularVectors_e, + Word16 secDiag_e, + const Word16 nChannelsC); + +static Word32 maxWithSign_fx( + const Word32 a); + +#if 0 +static void flushToZeroArray_fx( + Word32 arr[MAX_OUTPUT_CHANNELS], + const Word16 length); + +static void flushToZeroMat_fx( + Word32 mat[][MAX_OUTPUT_CHANNELS], + const Word16 m, + const Word16 n ); +#endif + +static Word16 BidagonalDiagonalisation_fx( + Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], /* i/o: left singular vectors (U) Q31 */ + Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ + Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) Q31 */ + Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], /* i/o: */ + Word16 *singularValues_fx_e, /* i/o: singular values vector (S) */ + Word16 *secDiag_fx_e, /* i/o: */ + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed */ + const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed */ + const Word32 eps_x, /* i : */ + const Word16 eps_x_e /* i : */ +); + +static void ApplyRotation_fx( + Word32 singularVector[][MAX_OUTPUT_CHANNELS], + const Word32 c, + const Word16 c_e, + const Word32 s, + const Word16 s_e, + Word32 x11, + Word16 x11_e, + Word32 x12, + Word16 x12_e, + Word32 *d, + Word16 *d_e, + Word32 *g, + Word16 *g_e, + const Word16 currentIndex1, + const Word16 currentIndex2, + const Word16 nChannels); + +static Word32 GivensRotation_fx( + const Word32 x, + const Word16 x_e, + const Word32 z, + const Word16 z_e, + Word16 *out_e); + +static void ApplyQRTransform_fx( + Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* i/o: left singular vectors (U) Q31 */ + Word32 singularValues[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ + Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) Q31 */ + Word32 secDiag[MAX_OUTPUT_CHANNELS], /* i/o: */ + Word16 singularValues_e[MAX_OUTPUT_CHANNELS], + Word16 secDiag_e[MAX_OUTPUT_CHANNELS], + const Word16 startIndex, /* i : */ + const Word16 currentIndex, /* i : */ + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed */ + const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed */ +); +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -160,7 +294,7 @@ void svdMat2mat_fx( return; } -#endif +#else /*------------------------------------------------------------------------- * mat2svdMat() @@ -244,7 +378,7 @@ void svdMat2mat( return; } - +#endif /*------------------------------------------------------------------------- * svd() @@ -252,6 +386,90 @@ void svdMat2mat( * perform a singular value decomposition X=USV of a matrix X *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED + /*! r: error or success */ +Word16 svd_fx( + Word32 InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) */ + Word16 InputMatrix_e, + Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], /* o : left singular vectors (U) (Q31) */ + Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], /* o : singular values vector (S) */ + Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* o : right singular vectors (V) (Q31) */ + Word16 *singularValues_fx_e, + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed */ + const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed */ +) +{ + Word16 iCh, jCh; + Word16 lengthSingularValues; + Word16 errorMessage, condition; + //int16_t max_length = ((nChannelsL > nChannelsC) ? nChannelsL : nChannelsC); + Word32 secDiag_fx[MAX_OUTPUT_CHANNELS]; + Word16 secDiag_fx_e = 0; + Word32 eps_x_fx = 0, temp_fx; + Word16 eps_x_fx_e = 0; + push_wmops("svd_fx"); + + set32_fx(secDiag_fx, 0, MAX_OUTPUT_CHANNELS); + + /* Collecting Values */ + FOR(iCh = 0; iCh < nChannelsL; iCh++) + { + FOR(jCh = 0; jCh < nChannelsC; jCh++) + { + singularVectors_Left_fx[iCh][jCh] = InputMatrix[iCh][jCh]; + } + } + + *singularValues_fx_e = 0; + + /* Householder reduction */ + HouseholderReduction_fx(singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, InputMatrix_e, singularValues_fx_e, &secDiag_fx_e, nChannelsL, nChannelsC, &eps_x_fx, &eps_x_fx_e); + + /* Set extremely small values to zero if needed */ + //flushToZeroArray(singularValues, max_length); + //flushToZeroMat(singularVectors_Left, nChannelsL, nChannelsL); + //flushToZeroMat(singularVectors_Right, nChannelsC, nChannelsC); + + /* BidagonalDiagonalisation */ + errorMessage = BidagonalDiagonalisation_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, singularValues_fx_e, &secDiag_fx_e, nChannelsL, nChannelsC, eps_x_fx, eps_x_fx_e); + + /* Sort the singular values descending order */ + lengthSingularValues = min(nChannelsL, nChannelsC); + + DO + { + condition = 0; + FOR( iCh = 0; iCh < lengthSingularValues - 1; iCh++ ) + { + IF( LT_32( singularValues_fx[iCh], singularValues_fx[iCh + 1] ) ) + { + condition = 1; + temp_fx = singularValues_fx[iCh]; + singularValues_fx[iCh] = singularValues_fx[iCh + 1]; + singularValues_fx[iCh + 1] = temp_fx; + + FOR(jCh = 0; jCh < nChannelsL; ++jCh) + { + temp_fx = singularVectors_Left_fx[jCh][iCh]; + singularVectors_Left_fx[jCh][iCh] = singularVectors_Left_fx[jCh][iCh + 1]; + singularVectors_Left_fx[jCh][iCh + 1] = temp_fx; + } + + FOR(jCh = 0; jCh < nChannelsC; ++jCh) + { + temp_fx = singularVectors_Right_fx[jCh][iCh]; + singularVectors_Right_fx[jCh][iCh] = singularVectors_Right_fx[jCh][iCh + 1]; + singularVectors_Right_fx[jCh][iCh + 1] = temp_fx; + } + } + } + } WHILE (EQ_16(condition, 1)); + + pop_wmops(); + return (errorMessage); +} + +#else /*! r: error or success */ int16_t svd( float InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) */ @@ -328,7 +546,7 @@ int16_t svd( pop_wmops(); return ( errorMessage ); } - +#endif /*-----------------------------------------------------------------------* * Local functions @@ -340,6 +558,162 @@ int16_t svd( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word16 BidagonalDiagonalisation_fx( + Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], /* i/o: left singular vectors (U) Q31 */ + Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ + Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) Q31 */ + Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], /* i/o: */ + Word16 *singularValues_fx_e, /* i/o: singular values vector (S) */ + Word16 *secDiag_fx_e, /* i/o: */ + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed */ + const Word16 nChannelsC, /* i : number of columns in the matrix to be decomposed */ + const Word32 eps_x, /* i : */ + const Word16 eps_x_e /* i : */ +) +{ + Word16 kCh, nCh, iCh, jCh, split; + Word32 c, s, f1, f2; + Word16 c_e, s_e, f1_e, f2_e; + Word16 x11_e = 0, x12_e = 0; + Word16 temp_exp; + Word32 g = 0; + Word16 g_e = 0; + Word16 convergence, iteration, found_split; + Word16 error = 0; + Word16 singularValues_new_e[MAX_OUTPUT_CHANNELS], secDiag_new_e[MAX_OUTPUT_CHANNELS]; + set16_fx( singularValues_new_e, *singularValues_fx_e, MAX_OUTPUT_CHANNELS ); + set16_fx( secDiag_new_e, *secDiag_fx_e, MAX_OUTPUT_CHANNELS ); + + FOR( iCh = nChannelsC - 1; iCh >= 0; iCh-- ) /* nChannelsC */ + { + convergence = 0; + iteration = 0; + split = iCh - 1; + + WHILE ( EQ_16(convergence, 0) ) + { + iteration++; + found_split = 1; + + FOR( jCh = iCh; jCh >= 0; jCh-- ) + { + split = jCh - 1; + IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( secDiag_fx[jCh] ), secDiag_new_e[jCh], Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) ) /* is secDiag[ch] vanishing compared to eps_x */ + { + found_split = 0; + BREAK; + } + IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( singularValues_fx[split] ), singularValues_new_e[split], Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) ) /* is singularValues[split] vanishing compared to eps_x */ + { + BREAK; + } + } + + convergence = ( jCh == iCh ) ? 1 : 0; + + IF ( found_split ) + { + s = MAX_32; + s_e = 0; + c = 0; + c_e = 0; + + FOR ( kCh = jCh; kCh <= iCh; kCh++ ) + { + g = Mpy_32_32( s, secDiag_fx[kCh] ); + g_e = add(s_e, secDiag_new_e[kCh]); + secDiag_fx[kCh] = Mpy_32_32( c, secDiag_fx[kCh] ); + secDiag_new_e[kCh] = add(c_e, secDiag_new_e[kCh]); + IF( LE_16( BASOP_Util_Cmp_Mant32Exp( L_abs( g ), g_e, Mpy_32_32( CONVERGENCE_FACTOR_FX, eps_x ), eps_x_e ), 0 ) ) /* is singularValues[split] vanishing compared to eps_x */ + { + BREAK; + } + + c = singularValues_fx[kCh]; + c_e = singularValues_new_e[kCh]; + singularValues_fx[kCh] = GivensRotation_fx( g, g_e, singularValues_fx[kCh], singularValues_new_e[kCh], &singularValues_new_e[kCh] ); + c = BASOP_Util_Divide3232_Scale_cadence( c, maxWithSign_fx(singularValues_fx[kCh] ), &temp_exp ); + c_e = add( temp_exp, sub( c_e, singularValues_new_e[kCh] ) ); + IF( GT_16( c_e, 0 ) ) + { + c = L_shl_sat(c, c_e); // Q31 + c_e = 0; + } + s = BASOP_Util_Divide3232_Scale_cadence( -g, maxWithSign_fx(singularValues_fx[kCh] ), &temp_exp ); + s_e = add( temp_exp, sub( g_e, singularValues_new_e[kCh] ) ); + IF( GT_16( s_e, 0 ) ) + { + s = L_shl_sat(s, s_e); // Q31 + s_e = 0; + } + + ApplyRotation_fx(singularVectors_Left_fx, c, c_e, s, s_e, 0, x11_e, 0, x12_e, &f1, &f1_e, &f2, &f2_e, kCh, split, nChannelsL ); /* nChannelsL */ + } + } + + IF ( convergence ) + { + singularValues_fx[iCh] = (Word32) singularValues_fx[iCh]; + IF( LT_32( singularValues_fx[iCh], 0 ) ) + { + singularValues_fx[iCh] = L_negate(singularValues_fx[iCh]); + FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */ + { + singularVectors_Right_fx[nCh][iCh] = L_negate(singularVectors_Right_fx[nCh][iCh]); + } + } + } + ELSE + { + IF( GT_16( iteration, SVD_MAX_NUM_ITERATION ) ) + { + IF( LT_32( singularValues_fx[iCh], 0 ) ) + { + singularValues_fx[iCh] = L_negate(singularValues_fx[iCh]); + + FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */ + { + singularVectors_Right_fx[nCh][iCh] = L_negate(singularVectors_Right_fx[nCh][iCh]); + } + } + error = 1; + convergence = 1; + } + ELSE + { + ApplyQRTransform_fx( singularVectors_Left_fx, singularValues_fx, singularVectors_Right_fx, secDiag_fx, singularValues_new_e, secDiag_new_e, jCh, iCh, nChannelsL, nChannelsC ); /* nChannelsC */ + } + } + } + } + + //rescaling block + Word16 max_exp = -31; + FOR (iCh = 0; iCh < nChannelsC; iCh++) { + IF(singularValues_fx[iCh]) { + max_exp = s_max(max_exp,singularValues_new_e[iCh]); + } + } + *singularValues_fx_e = max_exp; + FOR(iCh = 0; iCh < nChannelsC; iCh++) { + singularValues_fx[iCh] = L_shr_r(singularValues_fx[iCh], sub(*singularValues_fx_e, singularValues_new_e[iCh])); + } + + max_exp = -31; + FOR(iCh = 0; iCh < nChannelsC; iCh++) { + IF(secDiag_fx[iCh]) { + max_exp = s_max(max_exp, secDiag_new_e[iCh]); + } + } + *secDiag_fx_e = max_exp; + FOR(iCh = 0; iCh < nChannelsC; iCh++) { + secDiag_fx[iCh] = L_shr_r(secDiag_fx[iCh], sub(*secDiag_fx_e, secDiag_new_e[iCh])); + } + + return ( error ); +} +#else static int16_t BidagonalDiagonalisation( float singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* i/o: left singular vectors (U) */ float singularValues[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ @@ -444,7 +818,7 @@ static int16_t BidagonalDiagonalisation( return ( error ); } - +#endif /*------------------------------------------------------------------------- * ApplyQRTransform() @@ -452,6 +826,145 @@ static int16_t BidagonalDiagonalisation( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void ApplyQRTransform_fx( + Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* i/o: left singular vectors (U) Q31 */ + Word32 singularValues[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ + Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], /* i/o: right singular vectors (V) Q31 */ + Word32 secDiag[MAX_OUTPUT_CHANNELS], /* i/o: */ + Word16 singularValues_e[MAX_OUTPUT_CHANNELS], + Word16 secDiag_e[MAX_OUTPUT_CHANNELS], + const Word16 startIndex, /* i : */ + const Word16 currentIndex, /* i : */ + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed */ + const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed */ +) +{ + Word16 ch, split; + Word32 d = 0, g = 0, r = 0, x_ii = 0, x_split = 0, x_kk = 0, mu = 0, aux = 0; + Word16 d_e = 0, g_e = 0, r_e = 0, x_ii_e = 0, x_split_e = 0, x_kk_e = 0, mu_e = 0, aux_e = 0; + Word32 L_temp1, L_temp2, L_temp3, L_temp4; + Word16 L_temp1_e, L_temp2_e, L_temp3_e, L_temp4_e, temp_exp; + Word32 c = MAX_32; + Word16 c_e = 0; + Word32 s = MAX_32; + Word16 s_e = 0; + + x_kk = singularValues[currentIndex]; + x_kk_e = singularValues_e[currentIndex]; + x_ii = singularValues[startIndex]; + x_ii_e = singularValues_e[startIndex]; + split = currentIndex - 1; + + x_split = singularValues[split]; + x_split_e = singularValues_e[split]; + g = secDiag[split]; + g_e = secDiag_e[split]; + r = secDiag[currentIndex]; + r_e = secDiag_e[currentIndex]; + + //d = (x_split + x_kk) * (x_split - x_kk) + (g + r) * (g - r); + L_temp1 = BASOP_Util_Add_Mant32Exp( x_split, x_split_e, x_kk, x_kk_e, &L_temp1_e ); + L_temp2 = BASOP_Util_Add_Mant32Exp( x_split, x_split_e, -x_kk, x_kk_e, &L_temp2_e ); + L_temp3 = BASOP_Util_Add_Mant32Exp( g, g_e, r, r_e, &L_temp3_e ); + L_temp4 = BASOP_Util_Add_Mant32Exp( g, g_e, -r, r_e, &L_temp4_e ); + d = BASOP_Util_Add_Mant32Exp( Mpy_32_32( L_temp1, L_temp2 ), add( L_temp1_e, L_temp2_e ), Mpy_32_32( L_temp3, L_temp4 ), add( L_temp3_e, L_temp4_e ), &d_e ); + + //d /= maxWithSign((r + r) * x_split); + L_temp1 = BASOP_Util_Add_Mant32Exp( r, r_e, r, r_e, &L_temp1_e ); + L_temp1 = maxWithSign_fx( Mpy_32_32( L_temp1, x_split ) ); + L_temp1_e = add( L_temp1_e, x_split_e ); + d = BASOP_Util_Divide3232_Scale_cadence( d, L_temp1, &temp_exp ); + d_e = add( temp_exp, sub( d_e, L_temp1_e ) ); + + g = GivensRotation_fx(MAX_32, 0, d, d_e, &g_e); + + //mu = x_split / maxWithSign(d + (d >= 0.0f ? 1 : (-1)) * fabsf(g)) - r; + L_temp1 = d >= 0 ? L_abs( g ) : -L_abs( g ); + L_temp1_e = g_e; + L_temp2 = maxWithSign_fx( BASOP_Util_Add_Mant32Exp( d, d_e, L_temp1, L_temp1_e, &L_temp2_e ) ); + mu = BASOP_Util_Divide3232_Scale_cadence( x_split, L_temp2, &mu_e ); + mu_e = add( mu_e, sub( x_split_e, L_temp2_e ) ); + mu = BASOP_Util_Add_Mant32Exp( mu, mu_e, -r, r_e, &mu_e ); + + //d = ((x_ii + x_kk) * (x_ii - x_kk) + r * mu) / maxWithSign(x_ii); + L_temp1 = BASOP_Util_Add_Mant32Exp( x_ii, x_ii_e, x_kk, x_kk_e, &L_temp1_e ); + L_temp2 = BASOP_Util_Add_Mant32Exp( x_ii, x_ii_e, -x_kk, x_kk_e, &L_temp2_e ); + d = BASOP_Util_Add_Mant32Exp( Mpy_32_32( L_temp1, L_temp2 ), add( L_temp1_e, L_temp2_e ), Mpy_32_32( r, mu ), add( r_e, mu_e ), &d_e ); + d = BASOP_Util_Divide3232_Scale_cadence( d, maxWithSign_fx( x_ii ), &temp_exp ); + d_e = add( temp_exp, sub( d_e, x_ii_e ) ); + + /*QR transformation*/ + FOR(ch = startIndex; ch <= split; ch++) + { + r = Mpy_32_32(s, secDiag[ch + 1]); + r_e = add(s_e,secDiag_e[ch + 1]); + g = Mpy_32_32(c, secDiag[ch + 1]); + g_e = add(c_e,secDiag_e[ch + 1]); + + secDiag[ch] = GivensRotation_fx( d, d_e, r, r_e, &secDiag_e[ch] ); + c = BASOP_Util_Divide3232_Scale_cadence( d, maxWithSign_fx( secDiag[ch] ), &c_e ); + c_e = add(c_e, sub( d_e, secDiag_e[ch] ) ); + IF( GT_16( c_e, 0 ) ) + { + c = L_shl_sat(c, c_e); // Q31 + c_e = 0; + } + s = BASOP_Util_Divide3232_Scale_cadence( r, maxWithSign_fx( secDiag[ch] ), &s_e ); + s_e = add(s_e, sub( r_e, secDiag_e[ch] ) ); + IF( GT_16( s_e, 0 ) ) + { + s = L_shl_sat(s, s_e); // Q31 + s_e = 0; + } + + r = Mpy_32_32(s, singularValues[ch + 1]); + r_e = add(s_e,singularValues_e[ch + 1]); + x_split = Mpy_32_32(c, singularValues[ch + 1]); + x_split_e = add(c_e,singularValues_e[ch + 1]); + + aux = g; + aux_e = g_e; + + //ApplyRotation(singularVectors_Right, c, s, x_ii, aux, &d, &g, ch + 1, ch, nChannelsC); + ApplyRotation_fx( singularVectors_Right, c, c_e, s, s_e, x_ii, x_ii_e, aux, aux_e, &d, &d_e, &g, &g_e, ch + 1, ch, nChannelsC ); + + singularValues[ch] = GivensRotation_fx( d, d_e, r, r_e, &singularValues_e[ch] ); + IF( GT_32( L_abs( singularValues[ch] ), Mpy_32_32( CONVERGENCE_FACTOR_FX, L_abs( singularValues[ch] ) ) ) ) + { + aux = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, singularValues[ch], &aux_e ); + aux_e = add( aux_e, sub( 1, singularValues_e[ch] ) ); + + c = Mpy_32_32( d, aux ); + c_e = add( d_e, aux_e ); + IF( GT_16( c_e, 0 ) ) + { + c = L_shl_sat(c, c_e); // Q31 + c_e = 0; + } + + s = Mpy_32_32( r, aux ); + s_e = add( r_e, aux_e ); + IF( GT_16( s_e, 0 ) ) + { + s = L_shl_sat(s, s_e); // Q31 + s_e = 0; + } + } + + //ApplyRotation(singularVectors_Left, c, s, g, x_split, &d, &x_ii, ch + 1, ch, nChannelsL); + ApplyRotation_fx(singularVectors_Left, c, c_e, s, s_e, g, g_e, x_split, x_split_e, &d, &d_e, &x_ii, &x_ii_e, ch + 1, ch, nChannelsL); + } + + secDiag[startIndex] = 0; + secDiag[currentIndex] = d; + secDiag_e[currentIndex] = d_e; + singularValues[currentIndex] = x_ii; + singularValues_e[currentIndex] = x_ii_e; + + return; +} +#else static void ApplyQRTransform( float singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* i/o: left singular vectors (U) */ float singularValues[MAX_OUTPUT_CHANNELS], /* i/o: singular values vector (S) */ @@ -515,7 +1028,7 @@ static void ApplyQRTransform( return; } - +#endif /*------------------------------------------------------------------------- * ApplyRotation() @@ -523,6 +1036,44 @@ static void ApplyQRTransform( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void ApplyRotation_fx( + Word32 singularVector[][MAX_OUTPUT_CHANNELS], + const Word32 c, + const Word16 c_e, + const Word32 s, + const Word16 s_e, + Word32 x11, + Word16 x11_e, + Word32 x12, + Word16 x12_e, + Word32 *d, + Word16 *d_e, + Word32 *g, + Word16 *g_e, + const Word16 currentIndex1, + const Word16 currentIndex2, + const Word16 nChannels ) +{ + Word16 ch; + Word16 temp_exp; + + *d = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x11 ), add(c_e,x11_e), Mpy_32_32( s, x12 ), add(s_e,x12_e), d_e ); + *g = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), add(c_e,x12_e), Mpy_32_32( -s, x11 ), add(s_e,x11_e), g_e ); + + FOR( ch = 0; ch < nChannels; ch++ ) + { + x11 = singularVector[ch][currentIndex2]; + x12 = singularVector[ch][currentIndex1]; + singularVector[ch][currentIndex2] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x11 ), c_e, Mpy_32_32( s, x12 ), s_e, &temp_exp ); + singularVector[ch][currentIndex2] = L_shl_sat(singularVector[ch][currentIndex2], temp_exp); + singularVector[ch][currentIndex1] = BASOP_Util_Add_Mant32Exp( Mpy_32_32( c, x12 ), c_e, Mpy_32_32( -s, x11 ), s_e, &temp_exp); + singularVector[ch][currentIndex1] = L_shl_sat(singularVector[ch][currentIndex1], temp_exp); + } + + return; +} +#else static void ApplyRotation( float singularVector[][MAX_OUTPUT_CHANNELS], const float c, @@ -550,7 +1101,7 @@ static void ApplyRotation( return; } - +#endif /*------------------------------------------------------------------------- * HouseholderReduction() @@ -558,6 +1109,48 @@ static void ApplyRotation( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void HouseholderReduction_fx( + Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], + Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], + Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], + Word32 secDiag_fx[MAX_OUTPUT_CHANNELS], + Word16 singularVectors_Left_e, + Word16 *singularValues_fx_e, + Word16 *secDiag_fx_e, + const int16_t nChannelsL, + const int16_t nChannelsC, + Word32 *eps_x_fx, + Word16 *eps_x_fx_e) +{ + int16_t nCh; + //float g = 0.0f, sig_x = 0.0f;// to be removed + Word32 g_fx = 0, sig_x_fx = 0; + Word16 sig_x_fx_e = 0; + + /* Bidiagonal Reduction for every channel */ + FOR(nCh = 0; nCh < nChannelsC; nCh++) /* nChannelsC */ + { + biDiagonalReductionLeft_fx(singularVectors_Left_fx, singularValues_fx, secDiag_fx, &singularVectors_Left_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx); + biDiagonalReductionRight_fx(singularVectors_Left_fx, secDiag_fx, &singularVectors_Left_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx); + + Word16 L_temp_e; + Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), *singularValues_fx_e, L_abs( secDiag_fx[nCh] ), *secDiag_fx_e, &L_temp_e); + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_temp, L_temp_e, *eps_x_fx, *eps_x_fx_e ), 1 ) ) + { + *eps_x_fx = L_temp; + *eps_x_fx_e = L_temp_e; + } + } + + /* SingularVecotr Accumulation */ + singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_e, *secDiag_fx_e, nChannelsC ); + + singularVectorsAccumulationLeft_fx(singularVectors_Left_fx, singularValues_fx, singularVectors_Left_e, *singularValues_fx_e, nChannelsL, nChannelsC); + + return; +} +#else static void HouseholderReduction( float singularVectors_Left[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], @@ -584,7 +1177,7 @@ static void HouseholderReduction( return; } - +#endif /*------------------------------------------------------------------------- * biDiagonalReductionLeft() @@ -592,6 +1185,153 @@ static void HouseholderReduction( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void biDiagonalReductionLeft_fx( + Word32 singularVectors[][MAX_OUTPUT_CHANNELS], + Word32 singularValues[MAX_OUTPUT_CHANNELS], + Word32 secDiag[MAX_OUTPUT_CHANNELS], + Word16 *singularVectors_e, + Word16 *singularValues_e, + Word16 *secDiag_e, + const Word16 nChannelsL, + const Word16 nChannelsC, + const Word16 currChannel, + Word32 *sig_x, + Word16 *sig_x_e, + Word32 *g ) // Q31 +{ + Word16 iCh, jCh, idx; + Word32 norm_x, f, r; + Word16 norm_x_e, f_e, r_e; + Word16 sing_exp[MAX_OUTPUT_CHANNELS]; + Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; + Word32 L_temp; + Word16 L_temp_e; + FOR (jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++) { + set_s( sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS); + } + + secDiag[currChannel] = Mpy_32_32( *sig_x, *g ); + //rescaling block + IF( GT_16( *sig_x_e, *secDiag_e ) ) + { + FOR ( Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + IF( NE_16( i, currChannel ) ) + { + secDiag[i] = L_shl( secDiag[i], sub( *secDiag_e, *sig_x_e ) ); + } + } + *secDiag_e = *sig_x_e; + } + ELSE IF ( LT_16( *sig_x_e, *secDiag_e ) ) + { + secDiag[currChannel] = L_shr_r( secDiag[currChannel], sub( *secDiag_e, *sig_x_e ) ); + } + + /* Setting values to 0 */ + ( *sig_x ) = 0; + ( *g ) = 0; + + IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ + { + idx = currChannel; + + FOR ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { + ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), *singularVectors_e, sig_x_e ); + } + + IF ( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ + { + norm_x = 0; + norm_x_e = 0; + FOR ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { + singularVectors[jCh][currChannel] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[jCh][currChannel], maxWithSign_fx( *sig_x ), &sing_exp[jCh] ); + sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) ); + norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); + } + IF( GT_16( norm_x_e, 0 ) ) + { + norm_x = MAX_32; + norm_x_e = 0; + } + L_temp_e = norm_x_e; + L_temp = Sqrt32( norm_x, &L_temp_e ); + L_temp = L_shl_r( L_temp, L_temp_e ); // Q31 + ( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); + + r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[currChannel], -norm_x, norm_x_e, &r_e ); + singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[idx], -( *g ), 0, &sing_exp[currChannel] ); + + FOR ( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ + { + norm_x = 0; + norm_x_e = 0; + FOR ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { + norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( sing_exp[jCh], *singularVectors_e ), &norm_x_e ); + } + + f = BASOP_Util_Divide3232_Scale_cadence( norm_x, maxWithSign_fx( r ), &f_e ); + f_e = add( f_e, sub( norm_x_e, r_e ) ); + + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { + singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], *singularVectors_e, Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, sing_exp[jCh] ), &sing_exp2[jCh][iCh] ); + } + } + + + FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */ + { + singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); + sing_exp2[jCh][currChannel] = add( sing_exp[jCh], *sig_x_e ); + } + + //rescaling block + Word16 exp_max = *singularVectors_e; + FOR(iCh = 0; iCh < nChannelsC; iCh++) + { + FOR(jCh = 0; jCh < nChannelsL; jCh++) + { + exp_max = s_max(exp_max, sing_exp2[jCh][iCh]); + } + } + + FOR(iCh = 0; iCh < nChannelsC; iCh++) + { + FOR(jCh = 0; jCh < nChannelsL; jCh++) + { + singularVectors[jCh][iCh] = L_shr_r(singularVectors[jCh][iCh], sub(exp_max, sing_exp2[jCh][iCh])); + } + } + *singularVectors_e = exp_max; + } + + //rescaling block + singularValues[currChannel] = Mpy_32_32( ( *sig_x ), ( *g ) ); + IF( GT_16( *sig_x_e, *singularValues_e ) ) + { + FOR( Word16 i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + IF( NE_16( i, currChannel ) ) + { + singularValues[i] = L_shl( singularValues[i], sub( *singularValues_e, *sig_x_e ) ); + } + } + *singularValues_e = *sig_x_e; + } + ELSE IF ( LT_16( *sig_x_e, *singularValues_e ) ) + { + singularValues[currChannel] = L_shr_r( singularValues[currChannel], sub( *singularValues_e, *sig_x_e ) ); + } + } + + return; +} +#else static void biDiagonalReductionLeft( float singularVectors[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], @@ -662,7 +1402,7 @@ static void biDiagonalReductionLeft( return; } - +#endif /*------------------------------------------------------------------------- * biDiagonalReductionRight() @@ -670,6 +1410,129 @@ static void biDiagonalReductionLeft( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void biDiagonalReductionRight_fx( + Word32 singularVectors[][MAX_OUTPUT_CHANNELS], + Word32 secDiag[MAX_OUTPUT_CHANNELS], + Word16 *singularVectors_e, + Word16 *secDiag_e, + const Word16 nChannelsL, + const Word16 nChannelsC, + const Word16 currChannel, + Word32 *sig_x, + Word16 *sig_x_e, + Word32 *g ) +{ + Word16 iCh, jCh, idx; + Word32 norm_x, r; + Word16 norm_x_e, r_e; + Word16 sing_exp[MAX_OUTPUT_CHANNELS]; + Word16 secDiag_exp[MAX_OUTPUT_CHANNELS]; + Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; + Word32 L_temp; + Word16 L_temp_e; + FOR (jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++) { + set_s(sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS); + } + set_s(secDiag_exp, *secDiag_e, MAX_OUTPUT_CHANNELS); + + /* Setting values to 0 */ + ( *sig_x ) = 0; + ( *g ) = 0; + + IF( LT_16( currChannel, nChannelsL ) && NE_16( currChannel, sub( nChannelsC, 1 ) ) ) /* i <=m && i !=n */ + { + idx = add(currChannel, 1); + + FOR ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ + { + ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh]), *singularVectors_e, sig_x_e ); + } + + IF ( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */ + { + norm_x = 0; + norm_x_e = 0; + + FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */ + { + singularVectors[currChannel][jCh] = BASOP_Util_Divide3232_Scale_cadence(singularVectors[currChannel][jCh], maxWithSign_fx(*sig_x), &sing_exp[jCh]); + sing_exp[jCh] = add(sing_exp[jCh], sub(*singularVectors_e, *sig_x_e)); + norm_x = BASOP_Util_Add_Mant32Exp(norm_x, norm_x_e, Mpy_32_32(singularVectors[currChannel][jCh], singularVectors[currChannel][jCh]), shl(sing_exp[jCh], 1), &norm_x_e); + } + IF( GT_16( norm_x_e, 0 ) ) + { + norm_x = MAX_32; + norm_x_e = 0; + } + L_temp_e = norm_x_e; + L_temp = Sqrt32(norm_x, &L_temp_e); + L_temp = L_shl_r(L_temp, L_temp_e); // Q31 + ( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) ); + + r = BASOP_Util_Add_Mant32Exp(Mpy_32_32((*g), singularVectors[currChannel][idx]), sing_exp[idx], -norm_x, norm_x_e, &r_e); + singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp(singularVectors[currChannel][idx], sing_exp[idx], -(*g), 0, &sing_exp[idx]); + + FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ + { + secDiag[jCh] = BASOP_Util_Divide3232_Scale_cadence(singularVectors[currChannel][jCh], maxWithSign_fx(r), &secDiag_exp[jCh]); + secDiag_exp[jCh] = add( secDiag_exp[jCh], sub( sing_exp[jCh], r_e) ); + } + + FOR( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /* nChannelsL */ + { + norm_x = 0; + norm_x_e = 0; + FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ + { + norm_x = BASOP_Util_Add_Mant32Exp(norm_x, norm_x_e, Mpy_32_32(singularVectors[iCh][jCh], singularVectors[currChannel][jCh]), add( *singularVectors_e, sing_exp[jCh] ), &norm_x_e); + } + + FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ + { + singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp(singularVectors[iCh][jCh], *singularVectors_e, Mpy_32_32(norm_x, secDiag[jCh]), add(norm_x_e, secDiag_exp[jCh]), &sing_exp2[iCh][jCh]); + } + } + + FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */ + { + singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); + sing_exp2[currChannel][jCh] = add( sing_exp[jCh], *sig_x_e ); + } + + /*rescaling block*/ + Word16 exp_max = *secDiag_e; + FOR(jCh = 0; jCh < nChannelsC; jCh++) { + exp_max = s_max(exp_max, secDiag_exp[jCh]); + } + FOR(jCh = 0; jCh < nChannelsC; jCh++) { + secDiag[jCh] = L_shr_r( secDiag[jCh], sub( exp_max, secDiag_exp[jCh] ) ); + } + + + exp_max = *singularVectors_e; + FOR(iCh = 0; iCh < nChannelsL; iCh++) + { + FOR(jCh = 0; jCh < nChannelsC; jCh++) + { + exp_max = s_max(exp_max, sing_exp2[iCh][jCh]); + } + } + + FOR(iCh = 0; iCh < nChannelsL ; iCh++) + { + FOR(jCh = 0; jCh < nChannelsC; jCh++) + { + singularVectors[iCh][jCh] = L_shr_r(singularVectors[iCh][jCh], sub(exp_max, sing_exp2[iCh][jCh])); + } + } + *singularVectors_e = exp_max; + } + } + + return; +} +#else static void biDiagonalReductionRight( float singularVectors[][MAX_OUTPUT_CHANNELS], float secDiag[MAX_OUTPUT_CHANNELS], @@ -736,7 +1599,7 @@ static void biDiagonalReductionRight( return; } - +#endif /*------------------------------------------------------------------------- * singularVectorsAccumulationLeft() @@ -744,6 +1607,85 @@ static void biDiagonalReductionRight( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void singularVectorsAccumulationLeft_fx( + Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], //Q31 output + Word32 singularValues[MAX_OUTPUT_CHANNELS], + Word16 singularVectors_e, + Word16 singularValues_e, + const Word16 nChannelsL, + const Word16 nChannelsC) +{ + Word16 nCh, iCh, k; + Word16 nChannels; + Word32 norm_y, t_jj, t_ii; + Word16 norm_y_e, t_jj_e, t_ii_e, temp_exp; + Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; + FOR(nCh = 0; nCh < MAX_OUTPUT_CHANNELS; nCh++) { + set_s(sing_exp2[nCh], singularVectors_e, MAX_OUTPUT_CHANNELS); + } + + /* Processing */ + nChannels = min(nChannelsL, nChannelsC); /* min(nChannelsL,ChannelsC) */ + //FILE *fp = fopen("t_ii_out.txt","a"); + FOR(nCh = nChannels - 1; nCh >= 0; nCh--) /* min(nChannelsL,ChannelsC) */ + { + t_ii = singularValues[nCh]; + t_ii_e = singularValues_e; + + FOR(iCh = nCh + 1; iCh < nChannelsC; iCh++) /* nChannelsC */ + { + singularVectors_Left[nCh][iCh] = 0; + } + + IF(t_ii) /*if (fabsf(t_ii) > EPSILON *fabsf(t_ii)) {*/ + { + t_ii = BASOP_Util_Divide3232_Scale_cadence(ONE_IN_Q30, maxWithSign_fx(t_ii), &temp_exp); + t_ii_e = add( 1, sub( temp_exp, t_ii_e ) ); + //fprintf( fp, "%e\n", me2f( t_ii, t_ii_e ) ); + FOR(iCh = nCh + 1; iCh < nChannelsC; iCh++) /* nChannelsC */ + { + norm_y = 0; + norm_y_e = 0; + FOR(k = nCh + 1; k < nChannelsL; k++) /* nChannelsL */ + { + norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[k][nCh], singularVectors_Left[k][iCh] ), add( sing_exp2[k][nCh], sing_exp2[k][iCh] ), &norm_y_e ); + } + t_jj = BASOP_Util_Divide3232_Scale_cadence( Mpy_32_32( t_ii, norm_y ), maxWithSign_fx( singularVectors_Left[nCh][nCh] ), &temp_exp ); //t_ii_e+norm_y_e-*singularVectors_e, + t_jj_e = add( temp_exp, sub( add( t_ii_e, norm_y_e ), sing_exp2[nCh][nCh] ) ); + + FOR(k = nCh; k < nChannelsL; k++) /* nChannelsL */ + { + singularVectors_Left[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[k][iCh], sing_exp2[k][iCh], Mpy_32_32( t_jj, singularVectors_Left[k][nCh] ), add( t_jj_e, sing_exp2[k][nCh] ), &sing_exp2[k][iCh] ); + } + } + + FOR(iCh = nCh; iCh < nChannelsL; iCh++) /* nChannelsL */ + { + singularVectors_Left[iCh][nCh] = Mpy_32_32( singularVectors_Left[iCh][nCh], t_ii ); + sing_exp2[iCh][nCh] = add( sing_exp2[iCh][nCh], t_ii_e ); + } + } + ELSE + { + FOR(iCh = nCh; iCh < nChannelsL; iCh++) /* nChannelsL */ + { + singularVectors_Left[iCh][nCh] = 0; + } + } + + singularVectors_Left[nCh][nCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Left[nCh][nCh], sing_exp2[nCh][nCh], ONE_IN_Q30, 1, &sing_exp2[nCh][nCh] ); + } + //fclose(fp); + FOR(nCh = 0; nCh < nChannelsL; nCh++) { + FOR(iCh = 0; iCh < nChannelsC; iCh++) { + singularVectors_Left[nCh][iCh] = L_shl_sat( singularVectors_Left[nCh][iCh], sing_exp2[nCh][iCh] ); + } + } + + return; +} +#else static void singularVectorsAccumulationLeft( float singularVectors_Left[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], @@ -804,7 +1746,7 @@ static void singularVectorsAccumulationLeft( return; } - +#endif /*------------------------------------------------------------------------- * singularVectorsAccumulationRight() @@ -812,6 +1754,72 @@ static void singularVectorsAccumulationLeft( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void singularVectorsAccumulationRight_fx( + Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], + Word32 singularVectors_Right[][MAX_OUTPUT_CHANNELS], //Q31 + Word32 secDiag[MAX_OUTPUT_CHANNELS], + Word16 singularVectors_e, + Word16 secDiag_e, + const Word16 nChannelsC ) +{ + Word16 nCh, iCh, k; + Word16 nChannels; + Word32 norm_y, t_ii, ratio_float; + Word16 norm_y_e, temp_exp1, sing_right_exp[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 }; + + /* Processing */ + nChannels = nChannelsC; /* nChannelsC */ + + /* avoid compiler warning */ + t_ii = secDiag[nChannels - 1]; + + FOR( nCh = nChannels - 1; nCh >= 0; nCh-- ) /* nChannelsC, min(nChannelsLmnChannelsC) otherwise */ + { + + IF( LT_16( nCh, sub( nChannelsC, 1 ) ) ) /* nChannelsC */ + { + IF( t_ii ) /*if (fabsf(t_ii) > EPSILON *fabsf(t_ii)) {*/ + { + + FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC*/ + { + ratio_float = BASOP_Util_Divide3232_Scale_cadence( singularVectors_Left[nCh][iCh], maxWithSign_fx( singularVectors_Left[nCh][nCh + 1]), &temp_exp1); + singularVectors_Right[iCh][nCh] = BASOP_Util_Divide3232_Scale_cadence( ratio_float, maxWithSign_fx( t_ii ), &sing_right_exp[iCh][nCh]); + sing_right_exp[iCh][nCh] = add(sing_right_exp[iCh][nCh], sub( temp_exp1, secDiag_e ) ); + //singularVectors_Right[iCh][nCh] = L_shl_sat( singularVectors_Right[iCh][nCh], temp_exp2 ); + } + + FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ + { + norm_y = 0; + norm_y_e = 0; + + FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ + { + norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[nCh][k], singularVectors_Right[k][iCh] ), add( singularVectors_e, sing_right_exp[k][iCh] ), &norm_y_e ); + } + + FOR( k = nCh + 1; k < nChannelsC; k++ ) /* nChannelsC */ + { + singularVectors_Right[k][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors_Right[k][iCh], sing_right_exp[k][iCh], Mpy_32_32( norm_y, singularVectors_Right[k][nCh] ), add( norm_y_e, sing_right_exp[k][nCh] ), &sing_right_exp[k][iCh] ); + singularVectors_Right[k][iCh] = L_shl_sat( singularVectors_Right[k][iCh], sing_right_exp[k][iCh] ); + sing_right_exp[k][iCh] = 0; + } + } + } + + FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ + { + singularVectors_Right[nCh][iCh] = singularVectors_Right[iCh][nCh] = 0; + } + } + singularVectors_Right[nCh][nCh] = MAX_32; + t_ii = secDiag[nCh]; + } + return; +} +#else static void singularVectorsAccumulationRight( float singularVectors_Left[][MAX_OUTPUT_CHANNELS], float singularVectors_Right[][MAX_OUTPUT_CHANNELS], @@ -869,7 +1877,7 @@ static void singularVectorsAccumulationRight( return; } - +#endif /*------------------------------------------------------------------------- * GivensRotation() @@ -877,6 +1885,60 @@ static void singularVectorsAccumulationRight( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word32 GivensRotation_fx( + const Word32 x, + const Word16 x_e, + const Word32 z, + const Word16 z_e, + Word16 *out_e) +{ + Word32 x_abs, z_abs; + Word32 cotan, tan, r; + Word16 temp_exp; + Word32 L_temp; + x_abs = L_abs( x ); + z_abs = L_abs( z ); + IF( LE_32( x_abs, Mpy_32_32( CONVERGENCE_FACTOR_FX, x_abs ) ) && LE_32( z_abs, Mpy_32_32( CONVERGENCE_FACTOR_FX, z_abs ) ) ) + { + r = 0; + } + ELSE IF( GE_16( BASOP_Util_Cmp_Mant32Exp( x_abs, x_e, z_abs, z_e ), 0 ) ) + { + IF( LE_32( x_abs, SVD_MINIMUM_VALUE_FX ) ) + { + r = 0; + } + ELSE + { + cotan = BASOP_Util_Divide3232_Scale_cadence( z_abs, x_abs, &temp_exp ); + temp_exp = add( temp_exp, sub( z_e, x_e ) ); + L_temp = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, Mpy_32_32( cotan, cotan ), 2*temp_exp, &temp_exp ); + L_temp = Sqrt32( L_temp, &temp_exp ); + r = Mpy_32_32( x_abs, L_temp ); + *out_e = add( x_e, temp_exp ); + } + } + ELSE + { + IF( LE_32( z_abs, SVD_MINIMUM_VALUE_FX ) ) + { + r = 0; + } + ELSE + { + tan = BASOP_Util_Divide3232_Scale_cadence( x_abs, z_abs, &temp_exp ); + temp_exp = add( temp_exp, sub( x_e, z_e ) ); + L_temp = BASOP_Util_Add_Mant32Exp( ONE_IN_Q30, 1, Mpy_32_32( tan, tan ), 2*temp_exp, &temp_exp ); + L_temp = Sqrt32( L_temp, &temp_exp ); + r = Mpy_32_32( z_abs, L_temp ); + *out_e = add( z_e, temp_exp ); + } + } + + return ( r ); +} +#else static float GivensRotation( const float x, const float z ) @@ -916,7 +1978,7 @@ static float GivensRotation( return ( r ); } - +#endif /*------------------------------------------------------------------------- * maxWithSign() @@ -924,6 +1986,24 @@ static float GivensRotation( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word32 maxWithSign_fx( + const Word32 a ) +{ + IF( GT_32( L_abs( a ), SVD_MINIMUM_VALUE_FX ) ) + { + return a; + } + ELSE IF( LT_32( a, 0 ) ) + { + return -SVD_MINIMUM_VALUE_FX; + } + ELSE + { + return SVD_MINIMUM_VALUE_FX; + } +} +#else static float maxWithSign( const float a ) { @@ -940,7 +2020,7 @@ static float maxWithSign( return SVD_MINIMUM_VALUE; } } - +#endif /*------------------------------------------------------------------------- * flushToZeroArray() @@ -948,6 +2028,26 @@ static float maxWithSign( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +#if 0 +static void flushToZeroArray_fx( + Word32 arr[MAX_OUTPUT_CHANNELS], + const Word16 length ) +{ + Word16 i; + + FOR ( i = 0; i < length; ++i ) + { + IF( LT_32(L_abs( arr[i] ), SVD_ZERO_FLUSH_THRESHOLD_FX )) + { + arr[i] = 0; + } + } + + return; +} +#endif +#else static void flushToZeroArray( float arr[MAX_OUTPUT_CHANNELS], const int16_t length ) @@ -964,7 +2064,7 @@ static void flushToZeroArray( return; } - +#endif /*------------------------------------------------------------------------- * flushToZeroMat() @@ -972,6 +2072,30 @@ static void flushToZeroArray( * *-------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +#if 0 +static void flushToZeroMat_fx( + Word32 mat[][MAX_OUTPUT_CHANNELS], + const Word16 m, + const Word16 n ) +{ + Word16 i, j; + + FOR( i = 0; i < m; ++i ) + { + FOR( j = 0; j < n; ++j ) + { + IF( LT_32( L_abs( mat[i][j] ), SVD_ZERO_FLUSH_THRESHOLD_FX ) ) + { + mat[i][j] = 0; + } + } + } + + return; +} +#endif +#else static void flushToZeroMat( float mat[][MAX_OUTPUT_CHANNELS], const int16_t m, @@ -992,3 +2116,4 @@ static void flushToZeroMat( return; } +#endif -- GitLab